Skip to content

Commit

Permalink
Pull request #228: webpack changes for main repo release [REVIEW THOR…
Browse files Browse the repository at this point in the history
…OUGHLY DO NOT MERGE BEFORE]

Merge in EXC/orca-elements from webpackChangesForRelease to main

* commit '86374aceb6c16d191ea5ecbb41d91dbd0e8dd61f':
  minor changes
  resolving PR comments
  webpack changes for main repo release
  • Loading branch information
arun.mishra authored and prafulkoppalkar committed Sep 15, 2023
2 parents 6d0d4be + 86374ac commit 4a4f2b1
Show file tree
Hide file tree
Showing 14 changed files with 172 additions and 144 deletions.
34 changes: 8 additions & 26 deletions package-lock.json

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

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@
"bs-webapi": "^0.19.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"recoil": "^0.1.2"
"recoil": "^0.1.2",
"webpack-merge": "^5.9.0"
},
"scripts": {
"start": "concurrently \"webpack serve --config webpack.common.js\" \"webpack --config webpack.common.js\" \"webpack serve ./dist/HyperLoader.js --port 9090\"",
"build": "webpack --config webpack.common.js",
"build:dev": "sdkEnv=sandbox webpack --config webpack.dev.js",
"build:dev-integ": "sdkEnv=integ webpack --config webpack.dev.js",
"start": "webpack serve --config webpack.dev.js",
"build:prod":"sdkEnv=prod webpack --config webpack.common.js",
"build:sandbox":"sdkEnv=sandbox webpack --config webpack.common.js",
"build:integ":"sdkEnv=integ webpack --config webpack.common.js",
"test": "react-scripts test",
"eject": "react-scripts eject",
"re:build": "rescript",
Expand Down
63 changes: 63 additions & 0 deletions public/build.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- <link rel="icon" href="/orca/elements/favicon.ico" /> -->
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"
/>
<meta name="theme-color" content="#000000" />
<link
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;600;700;800&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Qwitcher+Grypen:wght@400;700&display=swap"
rel="stylesheet"
/>
<link href="<%= publicPath%>/app.css" rel="stylesheet" />

<!-- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> -->
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<!-- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> -->
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Hyperswitch</title>
<script
id="braintree-checkout"
src="https://js.braintreegateway.com/web/3.88.4/js/paypal-checkout.min.js"
></script>
<script
id="braintree-client"
src="https://js.braintreegateway.com/web/3.88.4/js/client.min.js"
></script>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="app"></div>
<script src="<%= publicPath%>/app.js"></script>

<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
53 changes: 0 additions & 53 deletions public/index.html

This file was deleted.

2 changes: 2 additions & 0 deletions src/GlobalVars.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@val external repoName: string = "repoName"
@val external repoVersion: string = "repoVersion"
@val external repoPublicPath: string = "publicPath"
@val external backendEndPoint: string = "backendEndPoint"
@val external sdkUrl: string = "sdkUrl"
let targetOrigin: string = "*"
let sentryDSN = "https://[email protected]/6"
11 changes: 1 addition & 10 deletions src/Utilities/ApiEndpoint.res
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
let switchToInteg = false
let isLocal = false

let getSdkDomainUrl = (~publishableKey) => {
let sdkDomainUrl =
publishableKey->Js.String2.startsWith("pk_prd")
? `https://checkout.hyperswitch.io${GlobalVars.repoPublicPath}`
: publishableKey->Js.String2.startsWith("pk_snd")
? `https://beta.hyperswitch.io${GlobalVars.repoPublicPath}`
: `https://dev.hyperswitch.io${GlobalVars.repoPublicPath}`
isLocal ? "http://localhost:9050" : sdkDomainUrl
}
let sdkDomainUrl = `${GlobalVars.sdkUrl}${GlobalVars.repoPublicPath}`

let getApiEndPoint = (~publishableKey="", ()) => {
let testMode = publishableKey->Js.String2.startsWith("pk_snd_")
Expand Down
4 changes: 2 additions & 2 deletions src/Utilities/PaymentHelpers.res
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,8 @@ let useSessions = (
~wallets=[],
~isDelayedSessionToken=false,
~optLogger,
~endpoint,
~switchToCustomPod,
~endpoint,
(),
) => {
open Promise
Expand Down Expand Up @@ -581,9 +581,9 @@ let useSessions = (
let usePaymentMethodList = (
~clientSecret,
~publishableKey,
~endpoint,
~logger,
~switchToCustomPod,
~endpoint,
) => {
open Promise
let headers = [("Content-Type", "application/json"), ("api-key", publishableKey)]
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/RecoilAtoms.res
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ let userAddressPincode = Recoil.atom(. "userAddressPincode", defaultFieldValues)
let userAddressState = Recoil.atom(. "userAddressState", defaultFieldValues)
let userAddressCountry = Recoil.atom(. "userAddressCountry", defaultFieldValues)
let userBlikCode = Recoil.atom(. "userBlikCode", defaultFieldValues)
let endPoint = Recoil.atom(. "endpoint", "https://sandbox.hyperswitch.io")
let endPoint = Recoil.atom(. "endpoint", GlobalVars.backendEndPoint)
let fieldsComplete = Recoil.atom(. "fieldsComplete", false)
let isManualRetryEnabled = Recoil.atom(. "isManualRetryEnabled", false)
let userCurrency = Recoil.atom(. "userCurrency", "")
8 changes: 3 additions & 5 deletions src/orca-loader/Elements.res
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ let make = (
~publishableKey,
~applePaySessionRef,
~handleApplePayMessages,
~sdkDomainUrl,
~logger: option<OrcaLogger.loggerMake>,
) => {
try {
Expand Down Expand Up @@ -62,16 +61,16 @@ let make = (
~clientSecret=clientSecretId,
~publishableKey,
~optLogger=Some(logger),
~endpoint,
~switchToCustomPod,
~endpoint,
(),
)
let paymentMethodListPromise = PaymentHelpers.usePaymentMethodList(
~clientSecret=clientSecretId,
~publishableKey,
~endpoint,
~logger,
~switchToCustomPod,
~endpoint,
)

let locale = localOptions->getJsonStringFromDict("locale", "")
Expand Down Expand Up @@ -146,9 +145,9 @@ let make = (
let customerDetailsPromise = PaymentHelpers.useCustomerDetails(
~clientSecret=clientSecretId,
~publishableKey,
~endpoint,
~optLogger=Some(logger),
~switchToCustomPod,
~endpoint,
)
open Promise
customerDetailsPromise
Expand Down Expand Up @@ -585,7 +584,6 @@ let make = (
setElementIframeRef,
iframeRef,
mountPostMessage,
sdkDomainUrl,
// ~handleApplePayMessages,
)
savedPaymentElement->Js.Dict.set(componentType, paymentElement)
Expand Down
Loading

0 comments on commit 4a4f2b1

Please sign in to comment.