-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added apple pay support inside an iframe #743
Conversation
Review changes with SemanticDiff. |
let handleApplePayIframePostMessage = (msg, componentName, mountedIframeRef) => { | ||
let isApplePayMessageSent = ref(false) | ||
|
||
let iframes = Window.querySelectorAll("iframe") | ||
|
||
iframes->Array.forEach(iframe => { | ||
let iframeSrc = iframe->Window.getAttribute("src")->Option.getOr("") | ||
if iframeSrc->String.includes(`componentName=${componentName}`) { | ||
iframe->Js.Nullable.return->Window.iframePostMessage(msg) | ||
isApplePayMessageSent := true | ||
} | ||
}) | ||
|
||
if !isApplePayMessageSent.contents { | ||
mountedIframeRef->Window.iframePostMessage(msg) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let handleApplePayIframePostMessage = (msg, componentName, mountedIframeRef) => { | |
let isApplePayMessageSent = ref(false) | |
let iframes = Window.querySelectorAll("iframe") | |
iframes->Array.forEach(iframe => { | |
let iframeSrc = iframe->Window.getAttribute("src")->Option.getOr("") | |
if iframeSrc->String.includes(`componentName=${componentName}`) { | |
iframe->Js.Nullable.return->Window.iframePostMessage(msg) | |
isApplePayMessageSent := true | |
} | |
}) | |
if !isApplePayMessageSent.contents { | |
mountedIframeRef->Window.iframePostMessage(msg) | |
} | |
} | |
let handleApplePayIframePostMessage = (msg, componentName, mountedIframeRef) => { | |
let isApplePayMessageSent = ref(false) | |
let iframes = Window.querySelectorAll("iframe") | |
iframes->Array.forEach(iframe => | |
if ( | |
iframe | |
->Window.getAttribute("src") | |
->Option.getOr("") | |
->String.includes(`componentName=${componentName}`) | |
) { | |
iframe->Nullable.make->Window.iframePostMessage(msg) | |
isApplePayMessageSent := true | |
} | |
) | |
if !isApplePayMessageSent.contents { | |
mountedIframeRef->Window.iframePostMessage(msg) | |
} | |
} |
@@ -250,9 +241,9 @@ let useHandleApplePayResponse = ( | |||
let json = ev.data->safeParse | |||
try { | |||
let dict = json->getDictFromJson | |||
if dict->Dict.get("applePayProcessPayment")->Option.isSome { | |||
if dict->Dict.get("applePayPaymentToken")->Option.isSome { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if dict->Dict.get("applePayPaymentToken")->Option.isSome { | |
if dict->getDictIsSome("applePayPaymentToken") { |
->Dict.fromArray | ||
->JSON.Encode.object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
->Dict.fromArray | |
->JSON.Encode.object | |
->getJsonFromArrayOfJson |
->Dict.fromArray | ||
->JSON.Encode.object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
->Dict.fromArray | |
->JSON.Encode.object | |
->getJsonFromArrayOfJson |
# [0.96.0](juspay/hyperswitch-web@v0.95.3...v0.96.0) (2024-10-23) ### Features * added apple pay support inside an iframe ([juspay#743](juspay#743)) ([44ed3a8](juspay@44ed3a8))
Type of Change
Description
Implemented support for initiating an ApplePay session within an iframe, provided that a HyperLoader script is present at the parent level.
How did you test it?
Checklist
npm run re:build