Skip to content

Commit

Permalink
Merge branch 'main' into two-shimmer-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
PritishBudhiraja authored Jun 7, 2024
2 parents 416aaac + 80f7393 commit cd8844a
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 179 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [0.61.1](https://github.com/juspay/hyperswitch-web/compare/v0.61.0...v0.61.1) (2024-06-07)

# [0.61.0](https://github.com/juspay/hyperswitch-web/compare/v0.60.0...v0.61.0) (2024-06-07)


### Features

* self serve url in env ([#425](https://github.com/juspay/hyperswitch-web/issues/425)) ([107e914](https://github.com/juspay/hyperswitch-web/commit/107e914865a0b6a677663746689c6452287fae19))

# [0.60.0](https://github.com/juspay/hyperswitch-web/compare/v0.59.2...v0.60.0) (2024-06-05)


Expand Down
1 change: 1 addition & 0 deletions Hyperswitch-React-Demo-App/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ HYPERSWITCH_PUBLISHABLE_KEY=
HYPERSWITCH_SECRET_KEY=
HYPERSWITCH_SERVER_URL=
HYPERSWITCH_CLIENT_URL=
SELF_SERVER_URL=

8 changes: 5 additions & 3 deletions Hyperswitch-React-Demo-App/src/Payment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-undef */
import { useEffect, useState } from "react";
import React from "react";
import { HyperElements } from "@juspay-tech/react-hyper-js";
Expand All @@ -8,10 +9,11 @@ function Payment() {
const [clientSecret, setClientSecret] = useState("");

useEffect(() => {
let url = SELF_SERVER_URL === "" ? ENDPOINT : SELF_SERVER_URL;
Promise.all([
fetch(`${endPoint}/config`),
fetch(`${endPoint}/urls`),
fetch(`${endPoint}/create-payment-intent`),
fetch(`${url}/config`),
fetch(`${url}/urls`),
fetch(`${url}/create-payment-intent`),
])
.then((responses) => {
return Promise.all(responses.map((response) => response.json()));
Expand Down
16 changes: 6 additions & 10 deletions Hyperswitch-React-Demo-App/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const BundleAnalyzerPlugin =
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
require("dotenv").config({ path: "./.env" });

module.exports = (endpoint, publicPath = "auto") => {
let entries = {
const entries = {
app: "./src/index.js",
};

return {
mode: "development",
devtool: "source-map",
Expand All @@ -37,21 +37,17 @@ module.exports = (endpoint, publicPath = "auto") => {
new CopyPlugin({
patterns: [
{ from: "public" },
{
from: path.resolve(__dirname, "server.js"),
},
{ from: path.resolve(__dirname, "server.js") },
],
}),
new HtmlWebpackPlugin({
inject: false,
template: "./public/playgroundIndex.html",
}),
new webpack.DefinePlugin({
endPoint:
typeof endpoint === "string"
? JSON.stringify(endpoint)
: JSON.stringify(process.env.SELF_SERVER_URL),
ENDPOINT: JSON.stringify(endpoint),
SCRIPT_SRC: JSON.stringify(process.env.HYPERSWITCH_CLIENT_URL),
SELF_SERVER_URL: JSON.stringify(process.env.SELF_SERVER_URL ?? ""),
}),
new BundleAnalyzerPlugin({
analyzerMode: "static",
Expand Down
13 changes: 5 additions & 8 deletions Hyperswitch-React-Demo-App/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require("path");
const { merge } = require("webpack-merge");
const common = require("./webpack.common.js");

let devServer = {
const devServer = {
contentBase: path.join(__dirname, "dist"),
hot: true,
port: 9060,
Expand All @@ -20,10 +20,7 @@ let devServer = {
},
};

module.exports = merge([
common("/payments"),
{
mode: "development",
devServer: devServer,
},
]);
module.exports = merge(common("/payments"), {
mode: "development",
devServer,
});
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ Before you start the local setup, you will need an understanding of few keys -

- **`HYPERSWITCH_CLIENT_URL`:** The URL of your hosted Hyperswitch SDK. You can also use our Sandbox URL (https://beta.hyperswitch.io/v1) or specify your app running locally (e.g., http://localhost:9050).

- **`SELF_SERVER_URL`:** The URL of the hosted server file for generating client-secret and for fetching urls & configs. (eg: http://localhost:9060/payments)

### About Env Configs for SDK

- **`ENV_BACKEND_URL`:** Sets the endpoint for all the APIs used within the SDK to interact with the backend service. If you are running your own backend service, you can configure and specify its endpoint here for local setups.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orca-payment-page",
"version": "0.60.0",
"version": "0.61.1",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down
Loading

0 comments on commit cd8844a

Please sign in to comment.