Skip to content

Commit

Permalink
Merge branch 'main' of github.com:juspay/hyperswitch-web into webpack…
Browse files Browse the repository at this point in the history
…-cleaning-readability
  • Loading branch information
PritishBudhiraja committed Jun 7, 2024
2 parents e252662 + c2cf5c8 commit 072ea81
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [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
5 changes: 2 additions & 3 deletions Hyperswitch-React-Demo-App/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ module.exports = (endpoint, publicPath = "auto") => {
template: "./public/playgroundIndex.html",
}),
new webpack.DefinePlugin({
endPoint: JSON.stringify(
typeof endpoint === "string" ? endpoint : 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
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.0",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down

0 comments on commit 072ea81

Please sign in to comment.