diff --git a/src/orca-loader/Elements.res b/src/orca-loader/Elements.res index 5ea77b0d5..57adb5e1c 100644 --- a/src/orca-loader/Elements.res +++ b/src/orca-loader/Elements.res @@ -10,6 +10,8 @@ type trustPayFunctions = { executeGooglePayment: (string, GooglePayType.paymentDataRequest) => Promise.t, } @new external trustPayApi: JSON.t => trustPayFunctions = "TrustPayApi" +@val @scope("window") +external alert: 't => unit = "alert" let make = ( options, @@ -452,6 +454,9 @@ let make = ( switch dict->Dict.get("applePayButtonClicked") { | Some(val) => if val->JSON.Decode.bool->Belt.Option.getWithDefault(false) { + alert(event) + alert("event.isTrusted handleApplePayThirdPartyFlow") + alert(event.isTrusted) let applePaySessionTokenData = dict ->Dict.get("applePayPresent") diff --git a/src/orca-loader/Types.res b/src/orca-loader/Types.res index af364c201..efcb52b4d 100644 --- a/src/orca-loader/Types.res +++ b/src/orca-loader/Types.res @@ -10,7 +10,7 @@ type eventData = { confirmTriggered: bool, oneClickConfirmTriggered: bool, } -type event = {key: string, data: eventData} +type event = {key: string, data: eventData, isTrusted: bool} type eventParam = Event(event) | EventData(eventData) | Empty type eventHandler = option => unit @send external onload: (Dom.element, unit => Promise.t<'a>) => Promise.t<'a> = "onload" diff --git a/webpack.common.js b/webpack.common.js index c8fc54102..6802ee965 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -39,12 +39,12 @@ let backendEndPoint; if (envBackendUrl === undefined) { backendEndPoint = sdkEnv === "prod" - ? "https://checkout.hyperswitch.io/api" + ? "https://api.hyperswitch.io" : sdkEnv === "sandbox" - ? "https://beta.hyperswitch.io/api" + ? "https://sandbox.hyperswitch.io" : sdkEnv === "integ" ? "https://integ-api.hyperswitch.io" - : "https://beta.hyperswitch.io/api"; + : "https://sandbox.hyperswitch.io"; } else { backendEndPoint = envBackendUrl; } @@ -53,12 +53,12 @@ let confirmEndPoint; if (envBackendUrl === undefined) { confirmEndPoint = sdkEnv === "prod" - ? "https://checkout.hyperswitch.io/api" + ? "https://api.hyperswitch.io" : sdkEnv === "sandbox" - ? "https://beta.hyperswitch.io/api" + ? "https://sandbox.hyperswitch.io" : sdkEnv === "integ" ? "https://integ-api.hyperswitch.io" - : "https://beta.hyperswitch.io/api"; + : "https://sandbox.hyperswitch.io"; } else { confirmEndPoint = envBackendUrl; } diff --git a/webpack.dev.js b/webpack.dev.js index 89044d741..d702a8003 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -6,12 +6,12 @@ const sdkEnv = process.env.sdkEnv; let backendEndPoint = sdkEnv === "prod" - ? "https://checkout.hyperswitch.io/api/payments" + ? "https://api.hyperswitch.io/payments" : sdkEnv === "sandbox" - ? "https://beta.hyperswitch.io/api/payments" + ? "https://sandbox.hyperswitch.io/payments" : sdkEnv === "integ" ? "https://integ-api.hyperswitch.io/payments" - : "https://beta.hyperswitch.io/api/payments"; + : "https://sandbox.hyperswitch.io/payments"; let devServer = { contentBase: path.join(__dirname, "dist"), @@ -20,7 +20,7 @@ let devServer = { port: 9050, historyApiFallback: true, proxy: { - "/api/payments": { + "/payments": { target: backendEndPoint, changeOrigin: true, secure: true,