@shoppexio/storefront 1.0.62 → 1.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4993,7 +4993,7 @@ var TURNSTILE_FRAME_READY_TIMEOUT_MS = 1e4;
4993
4993
  function readFrameMessage(value, nonce) {
4994
4994
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
4995
4995
  const record2 = value;
4996
- if (record2.source !== TURNSTILE_FRAME_MESSAGE_SOURCE || record2.version !== TURNSTILE_FRAME_MESSAGE_VERSION || record2.nonce !== nonce || !["ready", "success", "expired", "timeout", "error"].includes(String(record2.type))) return null;
4996
+ if (record2.source !== TURNSTILE_FRAME_MESSAGE_SOURCE || record2.version !== TURNSTILE_FRAME_MESSAGE_VERSION || record2.nonce !== nonce || !["ready", "visible", "hidden", "success", "expired", "timeout", "error"].includes(String(record2.type))) return null;
4997
4997
  if (record2.type === "success" && (typeof record2.token !== "string" || !record2.token.trim())) {
4998
4998
  return null;
4999
4999
  }
@@ -5022,7 +5022,7 @@ function mountCheckoutChallenge(container, challenge, callbacks) {
5022
5022
  frame.referrerPolicy = "no-referrer";
5023
5023
  frame.style.border = "0";
5024
5024
  frame.style.width = "100%";
5025
- frame.style.height = "72px";
5025
+ frame.style.height = "0";
5026
5026
  let disposed = false;
5027
5027
  let ready = false;
5028
5028
  const readyTimeout = win.setTimeout(() => {
@@ -5034,7 +5034,12 @@ function mountCheckoutChallenge(container, challenge, callbacks) {
5034
5034
  if (!message) return;
5035
5035
  ready = true;
5036
5036
  win.clearTimeout(readyTimeout);
5037
- if (message.type === "success") callbacks.onSuccess(message.token);
5037
+ if (message.type === "visible") frame.style.height = "72px";
5038
+ if (message.type === "hidden") frame.style.height = "0";
5039
+ if (message.type === "success") {
5040
+ frame.style.height = "0";
5041
+ callbacks.onSuccess(message.token);
5042
+ }
5038
5043
  if (message.type === "expired" || message.type === "timeout") callbacks.onExpired?.();
5039
5044
  if (message.type === "error") callbacks.onUnavailable?.();
5040
5045
  };