Skip to content

Commit

Permalink
fix: do not unmount preMountLoader iframe (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsrivatsa-edinburgh authored May 14, 2024
1 parent 98e98ca commit ba47e5f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/Payments/PreMountLoader.res
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ let make = (~sessionId, ~publishableKey, ~clientSecret, ~endpoint) => {
if (
paymentMethodsResponseSent && customerPaymentMethodsResponseSent && sessionTokensResponseSent
) {
handlePostMessage([("preMountLoaderIframeUnMount", true->JSON.Encode.bool)])
Window.removeEventListener("message", handle)
}
None
Expand Down
9 changes: 0 additions & 9 deletions src/orca-loader/Elements.res
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,12 @@ let make = (

let preMountLoaderIframeDiv = mountPreMountLoaderIframe()

let unMountPreMountLoaderIframe = () => {
switch preMountLoaderIframeDiv->Nullable.toOption {
| Some(iframe) => iframe->remove
| None => ()
}
}

let preMountLoaderMountedPromise = Promise.make((resolve, _reject) => {
let preMountLoaderIframeCallback = (ev: Types.event) => {
let json = ev.data->Identity.anyTypeToJson
let dict = json->Utils.getDictFromJson
if dict->Dict.get("preMountLoaderIframeMountedCallback")->Option.isSome {
resolve(true->JSON.Encode.bool)
} else if dict->Dict.get("preMountLoaderIframeUnMount")->Option.isSome {
unMountPreMountLoaderIframe()
}
}
addSmartEventListener(
Expand Down

0 comments on commit ba47e5f

Please sign in to comment.