@flopay/react 0.5.17 → 0.5.19

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.mjs CHANGED
@@ -100,8 +100,8 @@ function FloPayProvider({
100
100
  }
101
101
 
102
102
  // src/flopay-checkout.tsx
103
- import React7, { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef3, useState as useState4 } from "react";
104
- import { PaymentAPI as PaymentAPI2 } from "@flopay/js";
103
+ import React6, { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef3, useState as useState3 } from "react";
104
+ import { PaymentAPI as PaymentAPI3 } from "@flopay/js";
105
105
  import { SDK_VERSION, FloPayError as FloPayError4, resolveBillingApiUrl as resolveBillingApiUrl3, buildCheckoutDisplayData, resolveButtonsLayoutTheme as resolveButtonsLayoutTheme2 } from "@flopay/shared";
106
106
 
107
107
  // src/card-button-content.tsx
@@ -248,7 +248,8 @@ import {
248
248
  isAVSFieldVisible,
249
249
  getStateFromPostalCode
250
250
  } from "@flopay/shared";
251
- import { forwardRef, useCallback as useCallback2, useContext as useContext3, useEffect as useEffect4, useImperativeHandle, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
251
+ import { PaymentAPI } from "@flopay/js";
252
+ import { forwardRef, useCallback, useContext as useContext3, useEffect as useEffect3, useImperativeHandle, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
252
253
 
253
254
  // src/hooks.ts
254
255
  import { useContext as useContext2 } from "react";
@@ -621,9 +622,6 @@ function wasSessionRecentlyCompleted(sessionId) {
621
622
  }
622
623
  }
623
624
 
624
- // src/in-app-browser-notice.tsx
625
- import { useCallback, useEffect as useEffect3, useState as useState2 } from "react";
626
-
627
625
  // src/in-app-browser.ts
628
626
  function isInAppBrowser(userAgent) {
629
627
  const ua = userAgent ?? (typeof navigator !== "undefined" ? navigator.userAgent : "");
@@ -639,101 +637,9 @@ function isInAppBrowser(userAgent) {
639
637
  return false;
640
638
  }
641
639
 
642
- // src/in-app-browser-notice.tsx
643
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
644
- var DEFAULT_MESSAGE = "PayPal and some digital wallets aren't supported in this browser. Open this page in your device's browser to use them.";
645
- function InAppBrowserNotice({
646
- message,
647
- openButtonLabel,
648
- copiedButtonLabel,
649
- containerStyle,
650
- buttonStyle,
651
- onOpenInBrowser
652
- }) {
653
- const [copied, setCopied] = useState2(false);
654
- const [inAppBrowser, setInAppBrowser] = useState2(false);
655
- useEffect3(() => {
656
- setInAppBrowser(isInAppBrowser());
657
- }, []);
658
- const defaultOpenLabel = inAppBrowser ? "Copy link" : "Open in browser";
659
- const defaultCopiedLabel = inAppBrowser ? "Link copied \u2014 open Safari/Chrome and paste" : "Link copied \u2014 paste in your browser";
660
- const effectiveOpenLabel = openButtonLabel ?? defaultOpenLabel;
661
- const effectiveCopiedLabel = copiedButtonLabel ?? defaultCopiedLabel;
662
- const handleClick = useCallback(async () => {
663
- if (typeof window === "undefined") return;
664
- const url = window.location.href;
665
- let opened = false;
666
- if (!inAppBrowser) {
667
- try {
668
- const win = window.open(url, "_blank");
669
- opened = !!win;
670
- } catch {
671
- opened = false;
672
- }
673
- }
674
- let didCopy = false;
675
- if (!opened) {
676
- if (typeof navigator !== "undefined" && typeof navigator.clipboard?.writeText === "function") {
677
- try {
678
- await navigator.clipboard.writeText(url);
679
- didCopy = true;
680
- setCopied(true);
681
- } catch {
682
- didCopy = false;
683
- }
684
- }
685
- }
686
- onOpenInBrowser?.({ opened, copied: didCopy });
687
- }, [inAppBrowser, onOpenInBrowser]);
688
- return /* @__PURE__ */ jsxs3(
689
- "div",
690
- {
691
- role: "status",
692
- "data-testid": "flopay-in-app-browser-notice",
693
- style: {
694
- marginTop: "0.75rem",
695
- padding: "0.75rem 0.875rem",
696
- background: "#FFFBEB",
697
- border: "1px solid #FDE68A",
698
- borderRadius: 8,
699
- color: "#92400E",
700
- fontSize: "0.85rem",
701
- lineHeight: 1.4,
702
- display: "flex",
703
- flexDirection: "column",
704
- gap: "0.5rem",
705
- ...containerStyle
706
- },
707
- children: [
708
- /* @__PURE__ */ jsx5("span", { children: message ?? DEFAULT_MESSAGE }),
709
- /* @__PURE__ */ jsx5(
710
- "button",
711
- {
712
- type: "button",
713
- onClick: handleClick,
714
- style: {
715
- alignSelf: "flex-start",
716
- padding: "0.4rem 0.75rem",
717
- background: "transparent",
718
- border: "1px solid #92400E",
719
- borderRadius: 6,
720
- color: "#92400E",
721
- fontSize: "0.85rem",
722
- fontWeight: 600,
723
- cursor: "pointer",
724
- ...buttonStyle
725
- },
726
- children: copied ? effectiveCopiedLabel : effectiveOpenLabel
727
- }
728
- )
729
- ]
730
- }
731
- );
732
- }
733
-
734
640
  // src/split-card-form.tsx
735
641
  import { FloPayError as FloPayError2 } from "@flopay/shared";
736
- import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
642
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
737
643
  var WALLET_RESUME_KEY = "flopay_wallet_resume";
738
644
  var FLOPAY_KEYFRAMES = `
739
645
  @keyframes flopay-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@@ -775,7 +681,7 @@ function normalizeBeforeButtonClickError(method, err) {
775
681
  );
776
682
  }
777
683
  function FloPayKeyframes() {
778
- return /* @__PURE__ */ jsx6("style", { children: FLOPAY_KEYFRAMES });
684
+ return /* @__PURE__ */ jsx5("style", { children: FLOPAY_KEYFRAMES });
779
685
  }
780
686
  function toCssSize(value) {
781
687
  if (typeof value === "number") return `${value}px`;
@@ -796,8 +702,8 @@ function ExpressCheckoutReadySwap({
796
702
  children
797
703
  }) {
798
704
  if (state === "unavailable" || state === "load_error") return null;
799
- return /* @__PURE__ */ jsxs4("div", { style: { position: "relative", minHeight: 44 }, children: [
800
- /* @__PURE__ */ jsx6(
705
+ return /* @__PURE__ */ jsxs3("div", { style: { position: "relative", minHeight: 44 }, children: [
706
+ /* @__PURE__ */ jsx5(
801
707
  "div",
802
708
  {
803
709
  "data-testid": placeholderTestId,
@@ -816,7 +722,7 @@ function ExpressCheckoutReadySwap({
816
722
  }
817
723
  }
818
724
  ),
819
- /* @__PURE__ */ jsx6(
725
+ /* @__PURE__ */ jsx5(
820
726
  "div",
821
727
  {
822
728
  style: {
@@ -831,9 +737,12 @@ function ExpressCheckoutReadySwap({
831
737
  )
832
738
  ] });
833
739
  }
740
+ function isExpressCheckoutRowVisible(state) {
741
+ return state !== "unavailable" && state !== "load_error";
742
+ }
834
743
  var SplitCardForm = forwardRef(
835
744
  function SplitCardForm2(props, ref) {
836
- return /* @__PURE__ */ jsx6(SplitCardFormInner, { ...props, innerRef: ref });
745
+ return /* @__PURE__ */ jsx5(SplitCardFormInner, { ...props, innerRef: ref });
837
746
  }
838
747
  );
839
748
  function PayPalButtonInner({
@@ -850,19 +759,15 @@ function PayPalButtonInner({
850
759
  }) {
851
760
  const stripe = useStripeRaw();
852
761
  const elements = useStripeElements();
853
- const [loadState, setLoadState] = useState3("loading");
854
- const onLoadStateChangeRef = useRef2(onLoadStateChange);
855
- useEffect4(() => {
856
- onLoadStateChangeRef.current = onLoadStateChange;
857
- }, [onLoadStateChange]);
858
- useEffect4(() => {
859
- onLoadStateChangeRef.current?.(loadState);
860
- }, [loadState]);
861
- const [submitting, setSubmitting] = useState3(false);
762
+ const [loadState, setLoadState] = useState2("loading");
763
+ useEffect3(() => {
764
+ onLoadStateChange?.(loadState);
765
+ }, [loadState, onLoadStateChange]);
766
+ const [submitting, setSubmitting] = useState2(false);
862
767
  const paypalResumeAttempted = useRef2(false);
863
768
  const beforeClickRef = useRef2(null);
864
769
  const baseUrl = billingApiUrl.replace(/\/+$/, "");
865
- useEffect4(() => {
770
+ useEffect3(() => {
866
771
  if (!stripe || paypalResumeAttempted.current) return;
867
772
  const params = new URLSearchParams(window.location.search);
868
773
  const paymentIntentId = params.get("payment_intent");
@@ -909,7 +814,7 @@ function PayPalButtonInner({
909
814
  }
910
815
  })();
911
816
  }, [stripe, onTokenizedBody, onErrorChange, onDecline]);
912
- const handlePayPalClick = useCallback2(async (event) => {
817
+ const handlePayPalClick = useCallback(async (event) => {
913
818
  if (isProcessing || submitting) {
914
819
  event.reject();
915
820
  return;
@@ -927,7 +832,7 @@ function PayPalButtonInner({
927
832
  onButtonClick?.("paypal");
928
833
  event.resolve();
929
834
  }, [isProcessing, onButtonClick, runBeforeButtonClick, submitting]);
930
- const handlePayPalConfirm = useCallback2(async (event) => {
835
+ const handlePayPalConfirm = useCallback(async (event) => {
931
836
  if (!stripe || !elements) return;
932
837
  let prepared = beforeClickRef.current;
933
838
  beforeClickRef.current = null;
@@ -1019,8 +924,8 @@ function PayPalButtonInner({
1019
924
  setSubmitting(false);
1020
925
  }
1021
926
  }, [stripe, elements, sessionId, email, baseUrl, onTokenizedBody, onErrorChange, onDecline, runBeforeButtonClick]);
1022
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
1023
- /* @__PURE__ */ jsx6(ExpressCheckoutReadySwap, { state: loadState, placeholderTestId: "flopay-paypal-placeholder", children: /* @__PURE__ */ jsx6(
927
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
928
+ /* @__PURE__ */ jsx5(ExpressCheckoutReadySwap, { state: loadState, placeholderTestId: "flopay-paypal-placeholder", children: /* @__PURE__ */ jsx5(
1024
929
  ExpressCheckoutElement,
1025
930
  {
1026
931
  onReady: (event) => setLoadState(resolveExpressCheckoutLoadState(event, ["paypal"])),
@@ -1045,7 +950,7 @@ function PayPalButtonInner({
1045
950
  }
1046
951
  }
1047
952
  ) }),
1048
- submitting && /* @__PURE__ */ jsx6(ProcessingOverlay, { status: "processing" })
953
+ submitting && /* @__PURE__ */ jsx5(ProcessingOverlay, { status: "processing" })
1049
954
  ] });
1050
955
  }
1051
956
  function WalletButtonInner({
@@ -1063,19 +968,15 @@ function WalletButtonInner({
1063
968
  }) {
1064
969
  const stripe = useStripeRaw();
1065
970
  const elements = useStripeElements();
1066
- const [loadState, setLoadState] = useState3("loading");
1067
- const onLoadStateChangeRef = useRef2(onLoadStateChange);
1068
- useEffect4(() => {
1069
- onLoadStateChangeRef.current = onLoadStateChange;
1070
- }, [onLoadStateChange]);
1071
- useEffect4(() => {
1072
- onLoadStateChangeRef.current?.(loadState);
1073
- }, [loadState]);
1074
- const [submitting, setSubmitting] = useState3(false);
971
+ const [loadState, setLoadState] = useState2("loading");
972
+ useEffect3(() => {
973
+ onLoadStateChange?.(loadState);
974
+ }, [loadState, onLoadStateChange]);
975
+ const [submitting, setSubmitting] = useState2(false);
1075
976
  const baseUrl = billingApiUrl.replace(/\/+$/, "");
1076
977
  const lastWalletMethodRef = useRef2("card");
1077
978
  const beforeClickRef = useRef2(null);
1078
- const handleWalletConfirm = useCallback2(
979
+ const handleWalletConfirm = useCallback(
1079
980
  async (event) => {
1080
981
  if (!stripe || !elements) return;
1081
982
  const walletType = event.expressPaymentType;
@@ -1164,8 +1065,8 @@ function WalletButtonInner({
1164
1065
  },
1165
1066
  [stripe, elements, sessionId, email, baseUrl, onTokenizedBody, onErrorChange, onDecline, runBeforeButtonClick]
1166
1067
  );
1167
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
1168
- /* @__PURE__ */ jsx6(ExpressCheckoutReadySwap, { state: loadState, placeholderTestId: "flopay-wallet-placeholder", children: /* @__PURE__ */ jsx6(
1068
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
1069
+ /* @__PURE__ */ jsx5(ExpressCheckoutReadySwap, { state: loadState, placeholderTestId: "flopay-wallet-placeholder", children: /* @__PURE__ */ jsx5(
1169
1070
  ExpressCheckoutElement,
1170
1071
  {
1171
1072
  onReady: (event) => setLoadState(resolveExpressCheckoutLoadState(event, ["applePay", "googlePay"])),
@@ -1204,7 +1105,7 @@ function WalletButtonInner({
1204
1105
  }
1205
1106
  }
1206
1107
  ) }),
1207
- submitting && /* @__PURE__ */ jsx6(ProcessingOverlay, { status: "processing" })
1108
+ submitting && /* @__PURE__ */ jsx5(ProcessingOverlay, { status: "processing" })
1208
1109
  ] });
1209
1110
  }
1210
1111
  function SplitCardFormInner({
@@ -1263,16 +1164,16 @@ function SplitCardFormInner({
1263
1164
  const elements = useElements();
1264
1165
  const checkout = useContext3(CheckoutContext);
1265
1166
  const contextBillingUrl = useBillingApiUrl();
1266
- const [processing, setProcessing] = useState3(false);
1267
- const [error, setError] = useState3(null);
1268
- const [is3DSActive, setIs3DSActive] = useState3(false);
1269
- const [selectedCountry, setSelectedCountry] = useState3(countryProp ?? "US");
1270
- const [zipCode, setZipCode] = useState3(zipProp ?? "");
1271
- const [addressLine1, setAddressLine1] = useState3(addressLine1Prop ?? "");
1272
- const [addressLine2, setAddressLine2] = useState3(addressLine2Prop ?? "");
1273
- const [city, setCity] = useState3(cityProp ?? "");
1274
- const [stateValue, setStateValue] = useState3(stateProp ?? "");
1275
- const [accountPatch, setAccountPatch] = useState3({});
1167
+ const [processing, setProcessing] = useState2(false);
1168
+ const [error, setError] = useState2(null);
1169
+ const [is3DSActive, setIs3DSActive] = useState2(false);
1170
+ const [selectedCountry, setSelectedCountry] = useState2(countryProp ?? "US");
1171
+ const [zipCode, setZipCode] = useState2(zipProp ?? "");
1172
+ const [addressLine1, setAddressLine1] = useState2(addressLine1Prop ?? "");
1173
+ const [addressLine2, setAddressLine2] = useState2(addressLine2Prop ?? "");
1174
+ const [city, setCity] = useState2(cityProp ?? "");
1175
+ const [stateValue, setStateValue] = useState2(stateProp ?? "");
1176
+ const [accountPatch, setAccountPatch] = useState2({});
1276
1177
  const zipCodeRef = useRef2(zipProp ?? "");
1277
1178
  const selectedCountryRef = useRef2(countryProp ?? "US");
1278
1179
  const addressLine1Ref = useRef2(addressLine1Prop ?? "");
@@ -1281,25 +1182,25 @@ function SplitCardFormInner({
1281
1182
  const stateRef = useRef2(stateProp ?? "");
1282
1183
  const avsConfig = useMemo2(() => resolveAVSConfig(enableAVSProp), [enableAVSProp]);
1283
1184
  const enableAVS = avsConfig !== null;
1284
- const [viewState, setViewState] = useState3(initialCardOpen ? "card" : "buttons");
1185
+ const [viewState, setViewState] = useState2(initialCardOpen ? "card" : "buttons");
1285
1186
  const showCardForm = viewState === "expanding" || viewState === "card";
1286
1187
  const TRANSITION_MS = 280;
1287
- const expandToCard = useCallback2(() => {
1188
+ const expandToCard = useCallback(() => {
1288
1189
  setViewState("expanding");
1289
1190
  setTimeout(() => setViewState("card"), TRANSITION_MS);
1290
1191
  }, []);
1291
- const collapseToButtons = useCallback2(() => {
1192
+ const collapseToButtons = useCallback(() => {
1292
1193
  setViewState("collapsing");
1293
1194
  setTimeout(() => setViewState("buttons"), TRANSITION_MS);
1294
1195
  }, []);
1295
- useEffect4(() => {
1196
+ useEffect3(() => {
1296
1197
  if (layout === "buttons" && initialCardOpen) {
1297
1198
  setViewState("card");
1298
1199
  }
1299
1200
  }, [layout, initialCardOpen]);
1300
- const [fullName, setFullName] = useState3("");
1301
- const [formReady, setFormReady] = useState3(false);
1302
- const [overlayStatus, setOverlayStatus] = useState3(null);
1201
+ const [fullName, setFullName] = useState2("");
1202
+ const [formReady, setFormReady] = useState2(false);
1203
+ const [overlayStatus, setOverlayStatus] = useState2(null);
1303
1204
  const processingRef = useRef2(false);
1304
1205
  const resolvedBillingApiUrl = billingApiUrl || contextBillingUrl;
1305
1206
  const displayError = externalError ?? error;
@@ -1352,39 +1253,40 @@ function SplitCardFormInner({
1352
1253
  captureMethod: "manual",
1353
1254
  setupFutureUsage: "off_session"
1354
1255
  }), [amountInCents, currency]);
1355
- const updateError = useCallback2(
1256
+ const updateError = useCallback(
1356
1257
  (err) => {
1357
1258
  setError(err);
1358
1259
  onErrorChange?.(err);
1359
1260
  },
1360
1261
  [onErrorChange]
1361
1262
  );
1362
- const emitDecline = useCallback2(
1263
+ const emitDecline = useCallback(
1363
1264
  (method, input, overrides) => {
1364
1265
  onDecline?.(buildDeclineEvent(method, input, overrides));
1365
1266
  },
1366
1267
  [onDecline]
1367
1268
  );
1368
1269
  const showWallets = showApplePay || showGooglePay;
1369
- const [paypalLoadState, setPaypalLoadState] = useState3("loading");
1370
- const [walletLoadState, setWalletLoadState] = useState3("loading");
1371
- const [inAppBrowserDetected, setInAppBrowserDetected] = useState3(false);
1372
- useEffect4(() => {
1270
+ const [paypalLoadState, setPaypalLoadState] = useState2("loading");
1271
+ const [walletLoadState, setWalletLoadState] = useState2("loading");
1272
+ const [inAppBrowserDetected, setInAppBrowserDetected] = useState2();
1273
+ useEffect3(() => {
1373
1274
  setInAppBrowserDetected(isInAppBrowser());
1374
1275
  }, []);
1375
- const expectedPayPal = showPayPal && !!paypalStripeInstance;
1376
- const expectedWallets = showWallets && !!stripeInstance;
1377
- const paypalLoadFailed = expectedPayPal && (paypalLoadState === "load_error" || paypalLoadState === "unavailable");
1378
- const walletsLoadFailed = expectedWallets && walletLoadState === "load_error";
1379
- const showInAppBrowserNotice = (expectedPayPal || expectedWallets) && (inAppBrowserDetected || paypalLoadFailed || walletsLoadFailed);
1380
- const handleNameChange = useCallback2((value) => {
1276
+ const shouldShowPayPal = showPayPal && inAppBrowserDetected === false;
1277
+ const shouldShowWallets = showWallets && inAppBrowserDetected === false;
1278
+ const shouldRenderPayPal = shouldShowPayPal && !!paypalStripeInstance;
1279
+ const shouldRenderWallets = shouldShowWallets && !!stripeInstance;
1280
+ const shouldDisplayPayPalRow = shouldRenderPayPal && isExpressCheckoutRowVisible(paypalLoadState);
1281
+ const shouldDisplayWalletRow = shouldRenderWallets && isExpressCheckoutRowVisible(walletLoadState);
1282
+ const handleNameChange = useCallback((value) => {
1381
1283
  setFullName(value);
1382
1284
  onFullNameChange?.(value);
1383
1285
  const parts = value.trim().split(/\s+/);
1384
1286
  onFirstNameChange?.(parts[0] ?? "");
1385
1287
  onLastNameChange?.(parts.length > 1 ? parts.slice(1).join(" ") : "");
1386
1288
  }, [onFullNameChange, onFirstNameChange, onLastNameChange]);
1387
- const applyInlineSessionPatch = useCallback2(
1289
+ const applyInlineSessionPatch = useCallback(
1388
1290
  (patch, method) => {
1389
1291
  if (!checkout.applyInlineSessionPatch) {
1390
1292
  return Promise.resolve({ error: null, sessionId });
@@ -1401,7 +1303,7 @@ function SplitCardFormInner({
1401
1303
  },
1402
1304
  [checkout.applyInlineSessionPatch, onError, sessionId, updateError]
1403
1305
  );
1404
- const runBeforeButtonClick = useCallback2(async (method) => {
1306
+ const runBeforeButtonClick = useCallback(async (method) => {
1405
1307
  if (!onBeforeButtonClick) return { proceed: true };
1406
1308
  try {
1407
1309
  const result = await onBeforeButtonClick({
@@ -1437,7 +1339,7 @@ function SplitCardFormInner({
1437
1339
  return { proceed: false };
1438
1340
  }
1439
1341
  }, [applyInlineSessionPatch, checkout.inlineSessionDraft, onBeforeButtonClick, onError, sessionId, updateError]);
1440
- const processPaymentInternal = useCallback2(
1342
+ const processPaymentInternal = useCallback(
1441
1343
  async (tokenizedBody, overrides) => {
1442
1344
  if (processingRef.current) return;
1443
1345
  processingRef.current = true;
@@ -1449,53 +1351,47 @@ function SplitCardFormInner({
1449
1351
  const resolvedCompletionPaymentMethodId = overrides?.completionPaymentMethodId ?? resolveTokenizedPaymentMethodId(tokenizedBody);
1450
1352
  const requestTokenizedBody = tokenizedBody.originalPaymentMethodId ? { ...tokenizedBody, originalPaymentMethodId: void 0 } : tokenizedBody;
1451
1353
  try {
1452
- const response = await fetch(`${baseUrl}/v1/checkouts/sessions/process`, {
1453
- method: "POST",
1454
- headers: {
1455
- "Content-Type": "application/json",
1456
- "x-user-id": effectiveAccount.userId ?? ""
1354
+ const api = new PaymentAPI(baseUrl);
1355
+ const response = await api.processPayment(effectiveAccount.userId ?? "", {
1356
+ sessionId: effectiveSessionId,
1357
+ tokenizedData: requestTokenizedBody,
1358
+ accountData: {
1359
+ userId: effectiveAccount.userId ?? "",
1360
+ email: effectiveAccount.email ?? "",
1361
+ firstName: effectiveAccount.firstName ?? fullName.trim().split(/\s+/)[0] ?? "",
1362
+ lastName: effectiveAccount.lastName ?? fullName.trim().split(/\s+/).slice(1).join(" ") ?? "",
1363
+ ...avsConfig ? (() => {
1364
+ const c = selectedCountryRef.current;
1365
+ const stateVisible = isAVSFieldVisible(avsConfig.state, c);
1366
+ const line1Visible = isAVSFieldVisible(avsConfig.address_line_1, c);
1367
+ const zipVisible = isAVSFieldVisible(avsConfig.postal_code, c);
1368
+ const derivedState = line1Visible && !stateVisible && zipVisible ? getStateFromPostalCode(c, zipCodeRef.current ?? "") : null;
1369
+ const stateValue2 = stateVisible ? stateRef.current : derivedState;
1370
+ return {
1371
+ country: c,
1372
+ ...zipVisible && zipCodeRef.current ? { zip: zipCodeRef.current } : {},
1373
+ ...isAVSFieldVisible(avsConfig.city, c) && cityRef.current ? { city: cityRef.current } : {},
1374
+ ...stateValue2 ? { state: stateValue2 } : {},
1375
+ ...line1Visible && addressLine1Ref.current ? { addressLine1: addressLine1Ref.current } : {},
1376
+ ...isAVSFieldVisible(avsConfig.address_line_2, c) && addressLine2Ref.current ? { addressLine2: addressLine2Ref.current } : {}
1377
+ };
1378
+ })() : {}
1457
1379
  },
1458
- body: JSON.stringify({
1459
- sessionId: effectiveSessionId,
1460
- tokenizedData: requestTokenizedBody,
1461
- accountData: {
1462
- userId: effectiveAccount.userId ?? "",
1463
- email: effectiveAccount.email ?? "",
1464
- firstName: effectiveAccount.firstName ?? fullName.trim().split(/\s+/)[0] ?? "",
1465
- lastName: effectiveAccount.lastName ?? fullName.trim().split(/\s+/).slice(1).join(" ") ?? "",
1466
- ...avsConfig ? (() => {
1467
- const c = selectedCountryRef.current;
1468
- const stateVisible = isAVSFieldVisible(avsConfig.state, c);
1469
- const line1Visible = isAVSFieldVisible(avsConfig.address_line_1, c);
1470
- const zipVisible = isAVSFieldVisible(avsConfig.postal_code, c);
1471
- const derivedState = line1Visible && !stateVisible && zipVisible ? getStateFromPostalCode(c, zipCodeRef.current ?? "") : null;
1472
- const stateValue2 = stateVisible ? stateRef.current : derivedState;
1473
- return {
1474
- country: c,
1475
- ...zipVisible && zipCodeRef.current ? { zip: zipCodeRef.current } : {},
1476
- ...isAVSFieldVisible(avsConfig.city, c) && cityRef.current ? { city: cityRef.current } : {},
1477
- ...stateValue2 ? { state: stateValue2 } : {},
1478
- ...line1Visible && addressLine1Ref.current ? { addressLine1: addressLine1Ref.current } : {},
1479
- ...isAVSFieldVisible(avsConfig.address_line_2, c) && addressLine2Ref.current ? { addressLine2: addressLine2Ref.current } : {}
1480
- };
1481
- })() : {}
1482
- },
1483
- chv,
1484
- // Checkout analytics metadata
1485
- avsCheck: avsCheckProp ?? false,
1486
- checkoutType: checkoutTypeProp,
1487
- checkoutLayout: checkoutLayoutProp,
1488
- // Resolved exposure: which fields were actually shown for the active country.
1489
- // Country-scoped rules (e.g. ['US', 'CA']) are flattened to booleans here.
1490
- avsConfig: avsConfig ? {
1491
- country: isAVSFieldVisible(avsConfig.country, selectedCountryRef.current),
1492
- postal_code: isAVSFieldVisible(avsConfig.postal_code, selectedCountryRef.current),
1493
- address_line_1: isAVSFieldVisible(avsConfig.address_line_1, selectedCountryRef.current),
1494
- address_line_2: isAVSFieldVisible(avsConfig.address_line_2, selectedCountryRef.current),
1495
- city: isAVSFieldVisible(avsConfig.city, selectedCountryRef.current),
1496
- state: isAVSFieldVisible(avsConfig.state, selectedCountryRef.current)
1497
- } : void 0
1498
- })
1380
+ chv,
1381
+ // Checkout analytics metadata
1382
+ avsCheck: avsCheckProp ?? false,
1383
+ checkoutType: checkoutTypeProp,
1384
+ checkoutLayout: checkoutLayoutProp,
1385
+ // Resolved exposure: which fields were actually shown for the active country.
1386
+ // Country-scoped rules (e.g. ['US', 'CA']) are flattened to booleans here.
1387
+ avsConfig: avsConfig ? {
1388
+ country: isAVSFieldVisible(avsConfig.country, selectedCountryRef.current),
1389
+ postal_code: isAVSFieldVisible(avsConfig.postal_code, selectedCountryRef.current),
1390
+ address_line_1: isAVSFieldVisible(avsConfig.address_line_1, selectedCountryRef.current),
1391
+ address_line_2: isAVSFieldVisible(avsConfig.address_line_2, selectedCountryRef.current),
1392
+ city: isAVSFieldVisible(avsConfig.city, selectedCountryRef.current),
1393
+ state: isAVSFieldVisible(avsConfig.state, selectedCountryRef.current)
1394
+ } : void 0
1499
1395
  });
1500
1396
  if (response.ok) {
1501
1397
  markSessionRecentlyCompleted(effectiveSessionId);
@@ -1627,7 +1523,7 @@ function SplitCardFormInner({
1627
1523
  },
1628
1524
  [baseUrl, sessionId, resolvedAccount, fullName, chv, flopay, paypalFlopay, onComplete, onError, updateError, emitDecline]
1629
1525
  );
1630
- const dispatchTokenizedBody = useCallback2(
1526
+ const dispatchTokenizedBody = useCallback(
1631
1527
  (tokenizedBody, overrides) => {
1632
1528
  if (onTokenizedBody) {
1633
1529
  onTokenizedBody(tokenizedBody);
@@ -1664,7 +1560,7 @@ function SplitCardFormInner({
1664
1560
  }
1665
1561
  }
1666
1562
  }), [flopay, dispatchTokenizedBody, onError, updateError, emitDecline]);
1667
- useEffect4(() => {
1563
+ useEffect3(() => {
1668
1564
  if (typeof window === "undefined") return;
1669
1565
  const stored = localStorage.getItem(WALLET_RESUME_KEY);
1670
1566
  if (!stored) return;
@@ -1682,7 +1578,7 @@ function SplitCardFormInner({
1682
1578
  localStorage.removeItem(WALLET_RESUME_KEY);
1683
1579
  }
1684
1580
  }, [sessionId, dispatchTokenizedBody]);
1685
- const handleSubmit = useCallback2(
1581
+ const handleSubmit = useCallback(
1686
1582
  async (e) => {
1687
1583
  e.preventDefault();
1688
1584
  if (!flopay || !elements || isSubmitting || processingRef.current) return;
@@ -1824,7 +1720,7 @@ function SplitCardFormInner({
1824
1720
  );
1825
1721
  const isReady = flopay !== null && elements !== null;
1826
1722
  if (!isReady) {
1827
- return /* @__PURE__ */ jsx6("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." });
1723
+ return /* @__PURE__ */ jsx5("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." });
1828
1724
  }
1829
1725
  const isButtons = layout === "buttons";
1830
1726
  const resolvedBorder = isButtons ? bStyles.cardInputBorder ?? "#e5e7eb" : "#A4A4FF";
@@ -1867,7 +1763,7 @@ function SplitCardFormInner({
1867
1763
  invalid: { color: "#ef4444" }
1868
1764
  }
1869
1765
  };
1870
- const cardFormBlock = /* @__PURE__ */ jsxs4("div", { style: {
1766
+ const cardFormBlock = /* @__PURE__ */ jsxs3("div", { style: {
1871
1767
  backgroundColor: cardBg,
1872
1768
  borderRadius: "8px",
1873
1769
  padding: isButtons ? "0" : "1rem",
@@ -1875,7 +1771,7 @@ function SplitCardFormInner({
1875
1771
  ...isButtons ? { padding: bStyles.cardFormContainer?.padding ?? "0" } : {},
1876
1772
  ...sharedInputPlaceholderVars
1877
1773
  }, children: [
1878
- /* @__PURE__ */ jsx6("style", { children: `
1774
+ /* @__PURE__ */ jsx5("style", { children: `
1879
1775
  .flopay-shared-input::placeholder {
1880
1776
  color: var(--flopay-input-placeholder-color);
1881
1777
  opacity: 1;
@@ -1884,12 +1780,12 @@ function SplitCardFormInner({
1884
1780
  font-weight: var(--flopay-input-font-weight);
1885
1781
  }
1886
1782
  ` }),
1887
- isButtons && showCardForm && /* @__PURE__ */ jsxs4("div", { style: {
1783
+ isButtons && showCardForm && /* @__PURE__ */ jsxs3("div", { style: {
1888
1784
  display: "flex",
1889
1785
  alignItems: "center",
1890
1786
  padding: "0.75rem 0 0.625rem"
1891
1787
  }, children: [
1892
- /* @__PURE__ */ jsxs4(
1788
+ /* @__PURE__ */ jsxs3(
1893
1789
  "button",
1894
1790
  {
1895
1791
  type: "button",
@@ -1911,7 +1807,7 @@ function SplitCardFormInner({
1911
1807
  },
1912
1808
  "aria-label": "Back to payment methods",
1913
1809
  children: [
1914
- /* @__PURE__ */ jsx6("span", { style: {
1810
+ /* @__PURE__ */ jsx5("span", { style: {
1915
1811
  display: "inline-flex",
1916
1812
  alignItems: "center",
1917
1813
  justifyContent: "center",
@@ -1921,12 +1817,12 @@ function SplitCardFormInner({
1921
1817
  backgroundColor: "#f3f4f6",
1922
1818
  transition: "background-color 0.15s",
1923
1819
  ...bStyles.backButtonIcon
1924
- }, children: /* @__PURE__ */ jsx6("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx6("path", { d: "M15 18l-6-6 6-6" }) }) }),
1925
- /* @__PURE__ */ jsx6(BackButtonContentSlot, { content: cardBackButtonContent })
1820
+ }, children: /* @__PURE__ */ jsx5("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx5("path", { d: "M15 18l-6-6 6-6" }) }) }),
1821
+ /* @__PURE__ */ jsx5(BackButtonContentSlot, { content: cardBackButtonContent })
1926
1822
  ]
1927
1823
  }
1928
1824
  ),
1929
- hideTitle ? /* @__PURE__ */ jsx6("div", { style: { flex: 1 } }) : /* @__PURE__ */ jsx6("div", { style: {
1825
+ hideTitle ? /* @__PURE__ */ jsx5("div", { style: { flex: 1 } }) : /* @__PURE__ */ jsx5("div", { style: {
1930
1826
  flex: 1,
1931
1827
  textAlign: "center",
1932
1828
  fontWeight: 600,
@@ -1934,18 +1830,18 @@ function SplitCardFormInner({
1934
1830
  color: "#262833",
1935
1831
  paddingRight: 80,
1936
1832
  ...bStyles.title
1937
- }, children: /* @__PURE__ */ jsx6(TitleContentSlot, { content: cardTitleContent }) })
1833
+ }, children: /* @__PURE__ */ jsx5(TitleContentSlot, { content: cardTitleContent }) })
1938
1834
  ] }),
1939
- !isButtons && !hideTitle && /* @__PURE__ */ jsx6("div", { style: { textAlign: "center", fontWeight: 600, fontSize: "1.1rem", padding: "0.5rem 0", color: "#262833" }, children: /* @__PURE__ */ jsx6(TitleContentSlot, { content: cardTitleContent }) }),
1940
- /* @__PURE__ */ jsx6("div", { style: {
1835
+ !isButtons && !hideTitle && /* @__PURE__ */ jsx5("div", { style: { textAlign: "center", fontWeight: 600, fontSize: "1.1rem", padding: "0.5rem 0", color: "#262833" }, children: /* @__PURE__ */ jsx5(TitleContentSlot, { content: cardTitleContent }) }),
1836
+ /* @__PURE__ */ jsx5("div", { style: {
1941
1837
  backgroundColor: cardInputBg,
1942
1838
  border: `1px solid ${resolvedBorder}`,
1943
1839
  borderTopLeftRadius: "8px",
1944
1840
  borderTopRightRadius: "8px",
1945
1841
  padding: "10px"
1946
- }, children: /* @__PURE__ */ jsx6(CardNumberElement, { onReady: () => setFormReady(true), options: stripeElementStyle }) }),
1947
- /* @__PURE__ */ jsxs4("div", { style: { display: "flex" }, children: [
1948
- /* @__PURE__ */ jsx6("div", { style: {
1842
+ }, children: /* @__PURE__ */ jsx5(CardNumberElement, { onReady: () => setFormReady(true), options: stripeElementStyle }) }),
1843
+ /* @__PURE__ */ jsxs3("div", { style: { display: "flex" }, children: [
1844
+ /* @__PURE__ */ jsx5("div", { style: {
1949
1845
  flex: 1,
1950
1846
  backgroundColor: cardInputBg,
1951
1847
  border: `1px solid ${resolvedBorder}`,
@@ -1953,23 +1849,23 @@ function SplitCardFormInner({
1953
1849
  borderRight: "none",
1954
1850
  borderBottomLeftRadius: "8px",
1955
1851
  padding: "10px"
1956
- }, children: /* @__PURE__ */ jsx6(CardExpiryElement, { options: stripeElementStyle }) }),
1957
- /* @__PURE__ */ jsx6("div", { style: {
1852
+ }, children: /* @__PURE__ */ jsx5(CardExpiryElement, { options: stripeElementStyle }) }),
1853
+ /* @__PURE__ */ jsx5("div", { style: {
1958
1854
  flex: 1,
1959
1855
  backgroundColor: cardInputBg,
1960
1856
  border: `1px solid ${resolvedBorder}`,
1961
1857
  borderTop: "none",
1962
1858
  borderBottomRightRadius: "8px",
1963
1859
  padding: "10px"
1964
- }, children: /* @__PURE__ */ jsx6(CardCvcElement, { options: stripeElementStyle }) })
1860
+ }, children: /* @__PURE__ */ jsx5(CardCvcElement, { options: stripeElementStyle }) })
1965
1861
  ] }),
1966
- /* @__PURE__ */ jsx6("div", { style: {
1862
+ /* @__PURE__ */ jsx5("div", { style: {
1967
1863
  backgroundColor: cardInputBg,
1968
1864
  border: `1px solid ${resolvedBorder}`,
1969
1865
  borderRadius: "8px",
1970
1866
  marginTop: "0.5rem",
1971
1867
  padding: "10px"
1972
- }, children: /* @__PURE__ */ jsx6(
1868
+ }, children: /* @__PURE__ */ jsx5(
1973
1869
  "input",
1974
1870
  {
1975
1871
  className: "flopay-shared-input",
@@ -2008,8 +1904,8 @@ function SplitCardFormInner({
2008
1904
  ...isButtons && bStyles.nameInput ? bStyles.nameInput : {}
2009
1905
  });
2010
1906
  const stateOpts = getStateOptions(cc);
2011
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
2012
- isAVSFieldVisible(avsConfig.address_line_1, cc) && /* @__PURE__ */ jsx6("div", { style: inputWrapStyle(bStyles.addressLine1Input), children: /* @__PURE__ */ jsx6(
1907
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
1908
+ isAVSFieldVisible(avsConfig.address_line_1, cc) && /* @__PURE__ */ jsx5("div", { style: inputWrapStyle(bStyles.addressLine1Input), children: /* @__PURE__ */ jsx5(
2013
1909
  "input",
2014
1910
  {
2015
1911
  className: "flopay-shared-input",
@@ -2026,7 +1922,7 @@ function SplitCardFormInner({
2026
1922
  style: inputFieldStyle()
2027
1923
  }
2028
1924
  ) }),
2029
- isAVSFieldVisible(avsConfig.address_line_2, cc) && /* @__PURE__ */ jsx6("div", { style: inputWrapStyle(bStyles.addressLine2Input), children: /* @__PURE__ */ jsx6(
1925
+ isAVSFieldVisible(avsConfig.address_line_2, cc) && /* @__PURE__ */ jsx5("div", { style: inputWrapStyle(bStyles.addressLine2Input), children: /* @__PURE__ */ jsx5(
2030
1926
  "input",
2031
1927
  {
2032
1928
  className: "flopay-shared-input",
@@ -2042,12 +1938,12 @@ function SplitCardFormInner({
2042
1938
  style: inputFieldStyle()
2043
1939
  }
2044
1940
  ) }),
2045
- (isAVSFieldVisible(avsConfig.city, cc) || isAVSFieldVisible(avsConfig.state, cc)) && /* @__PURE__ */ jsxs4("div", { style: {
1941
+ (isAVSFieldVisible(avsConfig.city, cc) || isAVSFieldVisible(avsConfig.state, cc)) && /* @__PURE__ */ jsxs3("div", { style: {
2046
1942
  display: "flex",
2047
1943
  gap: "0",
2048
1944
  marginTop: "0.5rem"
2049
1945
  }, children: [
2050
- isAVSFieldVisible(avsConfig.city, cc) && /* @__PURE__ */ jsx6("div", { style: {
1946
+ isAVSFieldVisible(avsConfig.city, cc) && /* @__PURE__ */ jsx5("div", { style: {
2051
1947
  flex: 1,
2052
1948
  backgroundColor: cardInputBg,
2053
1949
  border: `1px solid ${resolvedBorder}`,
@@ -2056,7 +1952,7 @@ function SplitCardFormInner({
2056
1952
  borderBottomLeftRadius: "8px",
2057
1953
  ...isAVSFieldVisible(avsConfig.state, cc) ? { borderRight: "none", borderTopRightRadius: 0, borderBottomRightRadius: 0 } : { borderRadius: "8px" },
2058
1954
  ...isButtons && bStyles.cityInput ? bStyles.cityInput : {}
2059
- }, children: /* @__PURE__ */ jsx6(
1955
+ }, children: /* @__PURE__ */ jsx5(
2060
1956
  "input",
2061
1957
  {
2062
1958
  className: "flopay-shared-input",
@@ -2073,7 +1969,7 @@ function SplitCardFormInner({
2073
1969
  style: inputFieldStyle()
2074
1970
  }
2075
1971
  ) }),
2076
- isAVSFieldVisible(avsConfig.state, cc) && /* @__PURE__ */ jsx6("div", { style: {
1972
+ isAVSFieldVisible(avsConfig.state, cc) && /* @__PURE__ */ jsx5("div", { style: {
2077
1973
  flex: 1,
2078
1974
  backgroundColor: cardInputBg,
2079
1975
  border: `1px solid ${resolvedBorder}`,
@@ -2082,7 +1978,7 @@ function SplitCardFormInner({
2082
1978
  borderBottomRightRadius: "8px",
2083
1979
  ...isAVSFieldVisible(avsConfig.city, cc) ? { borderTopLeftRadius: 0, borderBottomLeftRadius: 0 } : { borderRadius: "8px" },
2084
1980
  ...isButtons && bStyles.stateInput ? bStyles.stateInput : {}
2085
- }, children: stateOpts ? /* @__PURE__ */ jsxs4(
1981
+ }, children: stateOpts ? /* @__PURE__ */ jsxs3(
2086
1982
  "select",
2087
1983
  {
2088
1984
  value: stateValue,
@@ -2096,11 +1992,11 @@ function SplitCardFormInner({
2096
1992
  "data-testid": "flopay-state",
2097
1993
  style: { ...inputFieldStyle(), cursor: "pointer" },
2098
1994
  children: [
2099
- /* @__PURE__ */ jsx6("option", { value: "", children: getStateLabel(cc) }),
2100
- stateOpts.map((s) => /* @__PURE__ */ jsx6("option", { value: s.code, children: s.name }, s.code))
1995
+ /* @__PURE__ */ jsx5("option", { value: "", children: getStateLabel(cc) }),
1996
+ stateOpts.map((s) => /* @__PURE__ */ jsx5("option", { value: s.code, children: s.name }, s.code))
2101
1997
  ]
2102
1998
  }
2103
- ) : /* @__PURE__ */ jsx6(
1999
+ ) : /* @__PURE__ */ jsx5(
2104
2000
  "input",
2105
2001
  {
2106
2002
  className: "flopay-shared-input",
@@ -2118,20 +2014,20 @@ function SplitCardFormInner({
2118
2014
  }
2119
2015
  ) })
2120
2016
  ] }),
2121
- (isAVSFieldVisible(avsConfig.country, cc) || isAVSFieldVisible(avsConfig.postal_code, cc)) && /* @__PURE__ */ jsxs4("div", { style: {
2017
+ (isAVSFieldVisible(avsConfig.country, cc) || isAVSFieldVisible(avsConfig.postal_code, cc)) && /* @__PURE__ */ jsxs3("div", { style: {
2122
2018
  display: "flex",
2123
2019
  flexDirection: avsLayoutProp === "column" ? "column" : "row",
2124
2020
  gap: avsLayoutProp === "column" ? "0.5rem" : "0",
2125
2021
  marginTop: "0.5rem"
2126
2022
  }, children: [
2127
- isAVSFieldVisible(avsConfig.country, cc) && /* @__PURE__ */ jsx6("div", { style: {
2023
+ isAVSFieldVisible(avsConfig.country, cc) && /* @__PURE__ */ jsx5("div", { style: {
2128
2024
  flex: avsLayoutProp === "row" ? 1 : void 0,
2129
2025
  backgroundColor: cardInputBg,
2130
2026
  border: `1px solid ${resolvedBorder}`,
2131
2027
  padding: "10px",
2132
2028
  ...avsLayoutProp === "row" && isAVSFieldVisible(avsConfig.postal_code, cc) ? { borderRadius: "0", borderTopLeftRadius: "8px", borderBottomLeftRadius: "8px", borderRight: "none" } : { borderRadius: "8px" },
2133
2029
  ...isButtons && bStyles.countrySelect ? bStyles.countrySelect : {}
2134
- }, children: /* @__PURE__ */ jsx6(
2030
+ }, children: /* @__PURE__ */ jsx5(
2135
2031
  "select",
2136
2032
  {
2137
2033
  value: selectedCountry,
@@ -2146,21 +2042,21 @@ function SplitCardFormInner({
2146
2042
  autoComplete: "country",
2147
2043
  "data-testid": "flopay-country",
2148
2044
  style: { ...inputFieldStyle(), cursor: "pointer" },
2149
- children: COUNTRY_OPTIONS.map((c) => /* @__PURE__ */ jsxs4("option", { value: c.code, children: [
2045
+ children: COUNTRY_OPTIONS.map((c) => /* @__PURE__ */ jsxs3("option", { value: c.code, children: [
2150
2046
  c.flag,
2151
2047
  " ",
2152
2048
  c.name
2153
2049
  ] }, c.code))
2154
2050
  }
2155
2051
  ) }),
2156
- isAVSFieldVisible(avsConfig.postal_code, cc) && /* @__PURE__ */ jsx6("div", { style: {
2052
+ isAVSFieldVisible(avsConfig.postal_code, cc) && /* @__PURE__ */ jsx5("div", { style: {
2157
2053
  flex: avsLayoutProp === "row" ? 1 : void 0,
2158
2054
  backgroundColor: cardInputBg,
2159
2055
  border: `1px solid ${resolvedBorder}`,
2160
2056
  padding: "10px",
2161
2057
  ...avsLayoutProp === "row" && isAVSFieldVisible(avsConfig.country, cc) ? { borderRadius: "0", borderTopRightRadius: "8px", borderBottomRightRadius: "8px" } : { borderRadius: "8px" },
2162
2058
  ...isButtons && bStyles.zipInput ? bStyles.zipInput : {}
2163
- }, children: /* @__PURE__ */ jsx6(
2059
+ }, children: /* @__PURE__ */ jsx5(
2164
2060
  "input",
2165
2061
  {
2166
2062
  className: "flopay-shared-input",
@@ -2181,7 +2077,7 @@ function SplitCardFormInner({
2181
2077
  ] })
2182
2078
  ] });
2183
2079
  })(),
2184
- displayError && /* @__PURE__ */ jsxs4("div", { role: "alert", "data-testid": "flopay-error", style: {
2080
+ displayError && /* @__PURE__ */ jsxs3("div", { role: "alert", "data-testid": "flopay-error", style: {
2185
2081
  margin: "0.75rem 0",
2186
2082
  padding: "0.625rem 0.875rem",
2187
2083
  background: "#FEF2F2",
@@ -2195,10 +2091,10 @@ function SplitCardFormInner({
2195
2091
  gap: "0.5rem",
2196
2092
  ...isButtons && bStyles.errorBanner ? bStyles.errorBanner : {}
2197
2093
  }, children: [
2198
- /* @__PURE__ */ jsx6("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx6("path", { d: "M12 9v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z", stroke: "#DC2626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
2094
+ /* @__PURE__ */ jsx5("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx5("path", { d: "M12 9v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z", stroke: "#DC2626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
2199
2095
  displayError
2200
2096
  ] }),
2201
- children ?? /* @__PURE__ */ jsx6(
2097
+ children ?? /* @__PURE__ */ jsx5(
2202
2098
  "button",
2203
2099
  {
2204
2100
  type: "submit",
@@ -2221,7 +2117,7 @@ function SplitCardFormInner({
2221
2117
  children: isSubmitting ? "PROCESSING..." : submitLabel
2222
2118
  }
2223
2119
  ),
2224
- !isButtons && showSecurityFooter && /* @__PURE__ */ jsx6("div", { style: {
2120
+ !isButtons && showSecurityFooter && /* @__PURE__ */ jsx5("div", { style: {
2225
2121
  backgroundColor: "#EFF9F0",
2226
2122
  borderRadius: "8px",
2227
2123
  padding: "0.75rem",
@@ -2238,11 +2134,11 @@ function SplitCardFormInner({
2238
2134
  const cardButtonSizing = cardButtonContent === void 0 ? { boxSizing: "border-box", height: DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT, padding: "0 1rem" } : { padding: "0.9rem 1rem" };
2239
2135
  const buttonsAnim = viewState === "expanding" ? `flopay-buttons-exit ${TRANSITION_MS}ms cubic-bezier(0.4, 0, 0.2, 1) both` : viewState === "collapsing" ? `flopay-buttons-enter ${TRANSITION_MS}ms cubic-bezier(0, 0, 0.2, 1) both` : void 0;
2240
2136
  const cardAnim = viewState === "expanding" ? `flopay-card-enter ${TRANSITION_MS}ms cubic-bezier(0, 0, 0.2, 1) both` : viewState === "collapsing" ? `flopay-card-exit ${TRANSITION_MS}ms cubic-bezier(0.4, 0, 0.2, 1) both` : void 0;
2241
- return /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
2242
- /* @__PURE__ */ jsx6(FloPayKeyframes, {}),
2243
- overlayStatus && /* @__PURE__ */ jsx6(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
2244
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid" }, children: [
2245
- /* @__PURE__ */ jsxs4("div", { style: {
2137
+ return /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
2138
+ /* @__PURE__ */ jsx5(FloPayKeyframes, {}),
2139
+ overlayStatus && /* @__PURE__ */ jsx5(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
2140
+ /* @__PURE__ */ jsxs3("div", { style: { display: "grid" }, children: [
2141
+ /* @__PURE__ */ jsxs3("div", { style: {
2246
2142
  gridArea: "1 / 1",
2247
2143
  display: "flex",
2248
2144
  flexDirection: "column",
@@ -2251,7 +2147,7 @@ function SplitCardFormInner({
2251
2147
  ...!isButtonsView && !buttonsAnim ? { visibility: "hidden", position: "absolute", pointerEvents: "none", width: "100%" } : {},
2252
2148
  ...buttonsAnim ? { animation: buttonsAnim, pointerEvents: "none" } : {}
2253
2149
  }, children: [
2254
- showPayPal && paypalStripeInstance && /* @__PURE__ */ jsx6(StripeElements, { stripe: paypalStripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx6(
2150
+ shouldRenderPayPal && /* @__PURE__ */ jsx5(StripeElements, { stripe: paypalStripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx5(
2255
2151
  PayPalButtonInner,
2256
2152
  {
2257
2153
  sessionId,
@@ -2266,7 +2162,7 @@ function SplitCardFormInner({
2266
2162
  onLoadStateChange: setPaypalLoadState
2267
2163
  }
2268
2164
  ) }),
2269
- showWallets && stripeInstance ? /* @__PURE__ */ jsx6(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx6(
2165
+ shouldRenderWallets ? /* @__PURE__ */ jsx5(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx5(
2270
2166
  WalletButtonInner,
2271
2167
  {
2272
2168
  sessionId,
@@ -2281,9 +2177,8 @@ function SplitCardFormInner({
2281
2177
  runBeforeButtonClick,
2282
2178
  onLoadStateChange: setWalletLoadState
2283
2179
  }
2284
- ) }) : showWallets ? /* @__PURE__ */ jsx6("div", { style: { height: DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT, borderRadius: 8, background: "#e5e7eb", animation: "flopay-pulse 1.5s ease-in-out infinite" } }) : null,
2285
- showInAppBrowserNotice && /* @__PURE__ */ jsx6(InAppBrowserNotice, {}),
2286
- /* @__PURE__ */ jsx6(
2180
+ ) }) : shouldShowWallets ? /* @__PURE__ */ jsx5("div", { style: { height: DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT, borderRadius: 8, background: "#e5e7eb", animation: "flopay-pulse 1.5s ease-in-out infinite" } }) : null,
2181
+ /* @__PURE__ */ jsx5(
2287
2182
  "button",
2288
2183
  {
2289
2184
  type: "button",
@@ -2321,10 +2216,10 @@ function SplitCardFormInner({
2321
2216
  onMouseUp: (e) => {
2322
2217
  e.currentTarget.style.transform = "scale(1)";
2323
2218
  },
2324
- children: /* @__PURE__ */ jsx6(CardButtonContentSlot, { content: cardButtonContent })
2219
+ children: /* @__PURE__ */ jsx5(CardButtonContentSlot, { content: cardButtonContent })
2325
2220
  }
2326
2221
  ),
2327
- displayError && viewState === "buttons" && /* @__PURE__ */ jsxs4("div", { role: "alert", "data-testid": "flopay-error", style: {
2222
+ displayError && viewState === "buttons" && /* @__PURE__ */ jsxs3("div", { role: "alert", "data-testid": "flopay-error", style: {
2328
2223
  margin: "0.25rem 0",
2329
2224
  padding: "0.625rem 0.875rem",
2330
2225
  background: "#FEF2F2",
@@ -2338,11 +2233,11 @@ function SplitCardFormInner({
2338
2233
  gap: "0.5rem",
2339
2234
  ...bStyles.errorBanner ? bStyles.errorBanner : {}
2340
2235
  }, children: [
2341
- /* @__PURE__ */ jsx6("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx6("path", { d: "M12 9v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z", stroke: "#DC2626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
2236
+ /* @__PURE__ */ jsx5("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx5("path", { d: "M12 9v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z", stroke: "#DC2626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
2342
2237
  displayError
2343
2238
  ] })
2344
2239
  ] }),
2345
- isCardView && /* @__PURE__ */ jsx6("div", { style: {
2240
+ isCardView && /* @__PURE__ */ jsx5("div", { style: {
2346
2241
  gridArea: "1 / 1",
2347
2242
  ...cardAnim ? { animation: cardAnim } : {},
2348
2243
  ...viewState === "collapsing" ? { pointerEvents: "none" } : {}
@@ -2350,10 +2245,10 @@ function SplitCardFormInner({
2350
2245
  ] })
2351
2246
  ] });
2352
2247
  }
2353
- return /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
2354
- /* @__PURE__ */ jsx6(FloPayKeyframes, {}),
2355
- overlayStatus && /* @__PURE__ */ jsx6(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
2356
- showWallets && stripeInstance && /* @__PURE__ */ jsx6(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx6(
2248
+ return /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
2249
+ /* @__PURE__ */ jsx5(FloPayKeyframes, {}),
2250
+ overlayStatus && /* @__PURE__ */ jsx5(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
2251
+ shouldRenderWallets && /* @__PURE__ */ jsx5(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx5(
2357
2252
  WalletButtonInner,
2358
2253
  {
2359
2254
  sessionId,
@@ -2367,7 +2262,7 @@ function SplitCardFormInner({
2367
2262
  onLoadStateChange: setWalletLoadState
2368
2263
  }
2369
2264
  ) }),
2370
- showPayPal && paypalStripeInstance && /* @__PURE__ */ jsx6(StripeElements, { stripe: paypalStripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx6(
2265
+ shouldRenderPayPal && /* @__PURE__ */ jsx5(StripeElements, { stripe: paypalStripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx5(
2371
2266
  PayPalButtonInner,
2372
2267
  {
2373
2268
  sessionId,
@@ -2380,8 +2275,7 @@ function SplitCardFormInner({
2380
2275
  onLoadStateChange: setPaypalLoadState
2381
2276
  }
2382
2277
  ) }),
2383
- showInAppBrowserNotice && /* @__PURE__ */ jsx6(InAppBrowserNotice, {}),
2384
- (showWallets && stripeInstance || showPayPal && paypalStripeInstance) && /* @__PURE__ */ jsxs4("div", { style: {
2278
+ (shouldDisplayWalletRow || shouldDisplayPayPalRow) && /* @__PURE__ */ jsxs3("div", { style: {
2385
2279
  display: "flex",
2386
2280
  alignItems: "center",
2387
2281
  gap: "0.75rem",
@@ -2389,16 +2283,16 @@ function SplitCardFormInner({
2389
2283
  color: "#999",
2390
2284
  fontSize: "0.85rem"
2391
2285
  }, children: [
2392
- /* @__PURE__ */ jsx6("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } }),
2393
- /* @__PURE__ */ jsx6("span", { children: "or pay with card" }),
2394
- /* @__PURE__ */ jsx6("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } })
2286
+ /* @__PURE__ */ jsx5("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } }),
2287
+ /* @__PURE__ */ jsx5("span", { children: "or pay with card" }),
2288
+ /* @__PURE__ */ jsx5("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } })
2395
2289
  ] }),
2396
2290
  cardFormBlock
2397
2291
  ] });
2398
2292
  }
2399
2293
 
2400
2294
  // src/saved-payment-flow.ts
2401
- import { loadFloPay, PaymentAPI } from "@flopay/js";
2295
+ import { loadFloPay, PaymentAPI as PaymentAPI2 } from "@flopay/js";
2402
2296
  import { FloPayError as FloPayError3 } from "@flopay/shared";
2403
2297
  var DEFAULT_SAVED_PAYMENT_DECLINE_METHOD = "card";
2404
2298
  function getRedirectResultFromCheckoutProcessError(error) {
@@ -2506,7 +2400,7 @@ async function recover3DSRedirectResult({
2506
2400
  return null;
2507
2401
  }
2508
2402
  try {
2509
- const api = new PaymentAPI(billingApiUrl);
2403
+ const api = new PaymentAPI2(billingApiUrl);
2510
2404
  const unified = await api.getUnifiedCheckoutSession(sessionId);
2511
2405
  const refreshedToken = unified.provider === "stripe" ? unified.data.stripe?.clientSecret : void 0;
2512
2406
  if (isStripePaymentIntentClientSecret(refreshedToken)) {
@@ -2534,25 +2428,19 @@ async function processSavedPaymentForMode({
2534
2428
  const lastName = session.customer?.lastName ?? session.accountData?.lastName ?? "";
2535
2429
  const country = session.customer?.country ?? session.accountData?.country ?? void 0;
2536
2430
  const zip = session.customer?.zip ?? session.accountData?.zip ?? void 0;
2537
- const response = await retryOnceOnFetchFailure(() => fetch(`${baseUrl}/v1/checkouts/sessions/process`, {
2538
- method: "POST",
2539
- headers: {
2540
- "Content-Type": "application/json",
2541
- "x-user-id": customerId
2431
+ const api = new PaymentAPI2(baseUrl);
2432
+ const response = await retryOnceOnFetchFailure(() => api.processPayment(customerId, {
2433
+ sessionId: resolvedSessionId,
2434
+ tokenizedData,
2435
+ accountData: {
2436
+ userId: customerId,
2437
+ email: customerEmail,
2438
+ firstName,
2439
+ lastName,
2440
+ country,
2441
+ zip
2542
2442
  },
2543
- body: JSON.stringify({
2544
- sessionId: resolvedSessionId,
2545
- tokenizedData,
2546
- accountData: {
2547
- userId: customerId,
2548
- email: customerEmail,
2549
- firstName,
2550
- lastName,
2551
- country,
2552
- zip
2553
- },
2554
- returnUrl: returnUrl ?? resolveSavedPaymentReturnUrl(session)
2555
- })
2443
+ returnUrl: returnUrl ?? resolveSavedPaymentReturnUrl(session)
2556
2444
  }));
2557
2445
  if (response.ok) {
2558
2446
  return {
@@ -2625,7 +2513,7 @@ async function processSavedPaymentWithIntent({
2625
2513
  { checkoutMethod: "card" }
2626
2514
  );
2627
2515
  }
2628
- const api = new PaymentAPI(billingApiUrl);
2516
+ const api = new PaymentAPI2(billingApiUrl);
2629
2517
  const intentResponse = await retryOnceOnFetchFailure(() => api.createPaymentIntent(
2630
2518
  sessionId,
2631
2519
  customerEmail,
@@ -2930,7 +2818,7 @@ async function loadSavedPaymentProviders({
2930
2818
  }
2931
2819
 
2932
2820
  // src/flopay-checkout.tsx
2933
- import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
2821
+ import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
2934
2822
  var DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2 = 44;
2935
2823
  var PAYPAL_RESUME_STORAGE_KEY = "flopay_checkout_saved_payment_resume";
2936
2824
  var sessionInflightMap = /* @__PURE__ */ new Map();
@@ -3033,25 +2921,25 @@ function FloPayCheckout({
3033
2921
  const resolvedBillingUrl = resolveBillingApiUrl3(billingApiUrl);
3034
2922
  const checkoutType = createSessionParams ? "embedded_checkout" : "standard_checkout";
3035
2923
  const checkoutLayout = children ? "custom_layout" : layout === "buttons" ? "buttons_layout" : "default_layout";
3036
- const [unified, setUnified] = useState4(null);
3037
- const [flopay, setFloPay] = useState4(null);
2924
+ const [unified, setUnified] = useState3(null);
2925
+ const [flopay, setFloPay] = useState3(null);
3038
2926
  const flopayRef = useRef3(null);
3039
- const [paypalFlopay, setPaypalFloPay] = useState4(null);
2927
+ const [paypalFlopay, setPaypalFloPay] = useState3(null);
3040
2928
  const paypalFlopayRef = useRef3(null);
3041
- const [session, setSession] = useState4(null);
3042
- const [resolvedSessionId, setResolvedSessionId] = useState4(sessionIdProp ?? "");
2929
+ const [session, setSession] = useState3(null);
2930
+ const [resolvedSessionId, setResolvedSessionId] = useState3(sessionIdProp ?? "");
3043
2931
  const activeSessionId = sessionIdProp ?? resolvedSessionId;
3044
2932
  const initSessionDependency = createSessionParams ? "" : activeSessionId;
3045
- const [isLoading, setIsLoading] = useState4(true);
3046
- const [loadError, setLoadError] = useState4(null);
3047
- const [currentMode, setCurrentMode] = useState4("full");
3048
- const [confirmProcessing, setConfirmProcessing] = useState4(false);
3049
- const [modeError, setModeError] = useState4(initialErrorMessage);
3050
- const [modeOverlayStatus, setModeOverlayStatus] = useState4(null);
3051
- const [modeOverlayError, setModeOverlayError] = useState4(null);
3052
- const [createSessionPatch, setCreateSessionPatch] = useState4(void 0);
3053
- const [createSessionPatchBaseHash, setCreateSessionPatchBaseHash] = useState4("");
3054
- const [cardBootstrapPending, setCardBootstrapPending] = useState4(false);
2933
+ const [isLoading, setIsLoading] = useState3(true);
2934
+ const [loadError, setLoadError] = useState3(null);
2935
+ const [currentMode, setCurrentMode] = useState3("full");
2936
+ const [confirmProcessing, setConfirmProcessing] = useState3(false);
2937
+ const [modeError, setModeError] = useState3(initialErrorMessage);
2938
+ const [modeOverlayStatus, setModeOverlayStatus] = useState3(null);
2939
+ const [modeOverlayError, setModeOverlayError] = useState3(null);
2940
+ const [createSessionPatch, setCreateSessionPatch] = useState3(void 0);
2941
+ const [createSessionPatchBaseHash, setCreateSessionPatchBaseHash] = useState3("");
2942
+ const [cardBootstrapPending, setCardBootstrapPending] = useState3(false);
3055
2943
  const autoCheckoutAttempted = useRef3(false);
3056
2944
  const paypalResumeAttempted = useRef3(false);
3057
2945
  const savedPaymentKeysRef = useRef3(null);
@@ -3063,7 +2951,7 @@ function FloPayCheckout({
3063
2951
  onDeclineRef.current = onDecline;
3064
2952
  const onSessionCompletedRef = useRef3(onSessionCompleted);
3065
2953
  onSessionCompletedRef.current = onSessionCompleted;
3066
- useEffect5(() => {
2954
+ useEffect4(() => {
3067
2955
  console.info("[FloPay] Checkout initialized", {
3068
2956
  sdk_version: SDK_VERSION,
3069
2957
  checkout_type: checkoutType,
@@ -3091,20 +2979,20 @@ function FloPayCheckout({
3091
2979
  } : void 0,
3092
2980
  [effectiveCreateSessionBase, effectiveCreateSessionMode]
3093
2981
  );
3094
- useEffect5(() => {
2982
+ useEffect4(() => {
3095
2983
  setCreateSessionPatch(void 0);
3096
2984
  setCreateSessionPatchBaseHash(baseCreateSessionHash);
3097
2985
  }, [baseCreateSessionHash]);
3098
- useEffect5(() => {
2986
+ useEffect4(() => {
3099
2987
  setModeError(initialErrorMessage);
3100
2988
  }, [initialErrorMessage]);
3101
- const emitDecline = useCallback3(
2989
+ const emitDecline = useCallback2(
3102
2990
  (method, input, overrides) => {
3103
2991
  onDeclineRef.current?.(buildDeclineEvent(method, input, overrides));
3104
2992
  },
3105
2993
  []
3106
2994
  );
3107
- const runSavedPaymentFlow = useCallback3(
2995
+ const runSavedPaymentFlow = useCallback2(
3108
2996
  async (sess, options) => {
3109
2997
  setModeError(null);
3110
2998
  setModeOverlayError(null);
@@ -3132,6 +3020,17 @@ function FloPayCheckout({
3132
3020
  if (redirectResult.type === "paypal_redirect_required") {
3133
3021
  clearPayPalResumeState();
3134
3022
  }
3023
+ } else if (options?.initialAutoProcessingPending) {
3024
+ const api = new PaymentAPI3(resolvedBillingUrl);
3025
+ const completed = await api.waitForCheckoutSessionCompletion(options.initialAutoProcessingPending.sessionId, {
3026
+ initialDelayMs: options.initialAutoProcessingPending.retryAfterMs
3027
+ });
3028
+ if (completed.data.session?.status !== "complete") {
3029
+ throw new FloPayError4("Automatic payment failed. Please try again.", "api_error", {
3030
+ code: completed.data.session?.status === "expired" ? "checkout_session_expired" : "checkout_processing_timeout"
3031
+ });
3032
+ }
3033
+ paymentResult = { status: "succeeded" };
3135
3034
  } else if (options?.initialAutoProcessingError) {
3136
3035
  throw checkoutProcessErrorToFloPayError(
3137
3036
  options.initialAutoProcessingError,
@@ -3211,7 +3110,7 @@ function FloPayCheckout({
3211
3110
  resolvedBillingUrl
3212
3111
  ]
3213
3112
  );
3214
- useEffect5(() => {
3113
+ useEffect4(() => {
3215
3114
  if (typeof window === "undefined" || paypalResumeAttempted.current) {
3216
3115
  return;
3217
3116
  }
@@ -3274,7 +3173,7 @@ function FloPayCheckout({
3274
3173
  const paymentMethodId = typeof paymentIntent.payment_method === "string" ? paymentIntent.payment_method : paymentIntent.payment_method?.id;
3275
3174
  let finalResultStatus = resultStatus;
3276
3175
  if (resumeState.sessionId) {
3277
- const resumeApi = new PaymentAPI2(resolvedBillingUrl);
3176
+ const resumeApi = new PaymentAPI3(resolvedBillingUrl);
3278
3177
  const resumeSessionResult = await resumeApi.getUnifiedCheckoutSession(resumeState.sessionId);
3279
3178
  const resumeSession = resumeSessionResult.data.session;
3280
3179
  if (resumeSession && resumeSession.status !== "complete") {
@@ -3358,17 +3257,17 @@ function FloPayCheckout({
3358
3257
  );
3359
3258
  const createSessionParamsRef = useRef3(effectiveCreateSession);
3360
3259
  createSessionParamsRef.current = effectiveCreateSession;
3361
- useEffect5(() => {
3260
+ useEffect4(() => {
3362
3261
  setResolvedSessionId(sessionIdProp ?? "");
3363
3262
  }, [sessionIdProp]);
3364
- useEffect5(() => {
3263
+ useEffect4(() => {
3365
3264
  autoCheckoutAttempted.current = false;
3366
3265
  setModeError(initialErrorMessage);
3367
3266
  setModeOverlayError(null);
3368
3267
  setModeOverlayStatus(null);
3369
3268
  }, [createSessionHash, initialErrorMessage, sessionIdProp]);
3370
3269
  async function resolveInlineSession(params, cacheKey) {
3371
- const api = new PaymentAPI2(resolvedBillingUrl);
3270
+ const api = new PaymentAPI3(resolvedBillingUrl);
3372
3271
  let sid = typeof window !== "undefined" ? window.sessionStorage.getItem(cacheKey) : null;
3373
3272
  let realResult = null;
3374
3273
  if (sid) {
@@ -3404,7 +3303,7 @@ function FloPayCheckout({
3404
3303
  }
3405
3304
  return { sid: sid ?? "", result: realResult };
3406
3305
  }
3407
- const bootstrapInlineSession = useCallback3(
3306
+ const bootstrapInlineSession = useCallback2(
3408
3307
  async (patch) => {
3409
3308
  const baseParams = createSessionParamsRef.current;
3410
3309
  if (!baseParams) {
@@ -3465,7 +3364,7 @@ function FloPayCheckout({
3465
3364
  },
3466
3365
  [locale, resolvedBillingUrl]
3467
3366
  );
3468
- const handleInlineSessionPatch = useCallback3(async (patch) => {
3367
+ const handleInlineSessionPatch = useCallback2(async (patch) => {
3469
3368
  if (!hasInlineSessionPatchData(patch) || cardBootstrapPending) {
3470
3369
  return {
3471
3370
  sessionId: resolvedSessionId,
@@ -3488,7 +3387,7 @@ function FloPayCheckout({
3488
3387
  resolvedSessionId,
3489
3388
  session
3490
3389
  ]);
3491
- useEffect5(() => {
3390
+ useEffect4(() => {
3492
3391
  let cancelled = false;
3493
3392
  setLoadError(null);
3494
3393
  if (createSessionHash) {
@@ -3520,6 +3419,7 @@ function FloPayCheckout({
3520
3419
  fallbackToFull: true,
3521
3420
  fromCreateSession: true,
3522
3421
  initialAutoProcessingError: resolved.result.autoProcessingError,
3422
+ initialAutoProcessingPending: resolved.result.autoProcessingPending,
3523
3423
  autoProcessingAttempted: resolved.result.autoProcessingAttempted,
3524
3424
  sessionId: resolved.sid || resolvedSession.id
3525
3425
  });
@@ -3558,7 +3458,7 @@ function FloPayCheckout({
3558
3458
  setIsLoading(true);
3559
3459
  async function init() {
3560
3460
  try {
3561
- const api = new PaymentAPI2(resolvedBillingUrl);
3461
+ const api = new PaymentAPI3(resolvedBillingUrl);
3562
3462
  const result = await api.getUnifiedCheckoutSession(activeSessionId);
3563
3463
  if (cancelled) return;
3564
3464
  setUnified(result);
@@ -3647,7 +3547,7 @@ function FloPayCheckout({
3647
3547
  initSessionDependency,
3648
3548
  runSavedPaymentFlow
3649
3549
  ]);
3650
- const handleConfirmCheckout = useCallback3(async () => {
3550
+ const handleConfirmCheckout = useCallback2(async () => {
3651
3551
  if (confirmProcessing || !session) return;
3652
3552
  setConfirmProcessing(true);
3653
3553
  setModeError(null);
@@ -3701,7 +3601,7 @@ function FloPayCheckout({
3701
3601
  ]
3702
3602
  );
3703
3603
  const shouldShowInterimButtons = Boolean(createSessionParams) && layout === "buttons" && (!flopay || !providerOptions);
3704
- const modeOverlay = modeOverlayStatus ? /* @__PURE__ */ jsx7(
3604
+ const modeOverlay = modeOverlayStatus ? /* @__PURE__ */ jsx6(
3705
3605
  ProcessingOverlay,
3706
3606
  {
3707
3607
  status: modeOverlayStatus,
@@ -3710,31 +3610,31 @@ function FloPayCheckout({
3710
3610
  ) : null;
3711
3611
  if (isLoading) {
3712
3612
  if (loadingNode) {
3713
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
3613
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
3714
3614
  loadingNode,
3715
3615
  modeOverlay
3716
3616
  ] });
3717
3617
  }
3718
3618
  if (layout === "buttons") {
3719
- const skeletonBar = (h) => /* @__PURE__ */ jsx7("div", { style: {
3619
+ const skeletonBar = (h) => /* @__PURE__ */ jsx6("div", { style: {
3720
3620
  height: h,
3721
3621
  borderRadius: 8,
3722
3622
  background: "#e5e7eb",
3723
3623
  animation: "flopay-loading-pulse 1.5s ease-in-out infinite"
3724
3624
  } });
3725
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
3726
- /* @__PURE__ */ jsxs5("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
3625
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
3626
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
3727
3627
  showPayPal && skeletonBar(DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2),
3728
3628
  (showApplePay || showGooglePay) && skeletonBar(DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2),
3729
3629
  skeletonBar(DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2),
3730
- /* @__PURE__ */ jsx7("style", { children: `@keyframes flopay-loading-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
3630
+ /* @__PURE__ */ jsx6("style", { children: `@keyframes flopay-loading-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
3731
3631
  ] }),
3732
3632
  modeOverlay
3733
3633
  ] });
3734
3634
  }
3735
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
3736
- /* @__PURE__ */ jsxs5("div", { style: { display: "flex", justifyContent: "center", padding: 32 }, children: [
3737
- /* @__PURE__ */ jsx7("div", { style: {
3635
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
3636
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "center", padding: 32 }, children: [
3637
+ /* @__PURE__ */ jsx6("div", { style: {
3738
3638
  width: 24,
3739
3639
  height: 24,
3740
3640
  border: "2px solid #e5e7eb",
@@ -3742,16 +3642,16 @@ function FloPayCheckout({
3742
3642
  borderRadius: "50%",
3743
3643
  animation: "spin 0.6s linear infinite"
3744
3644
  } }),
3745
- /* @__PURE__ */ jsx7("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` })
3645
+ /* @__PURE__ */ jsx6("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` })
3746
3646
  ] }),
3747
3647
  modeOverlay
3748
3648
  ] });
3749
3649
  }
3750
3650
  if (loadError) {
3751
3651
  if (errorNode) {
3752
- return /* @__PURE__ */ jsx7(CheckoutContext.Provider, { value: checkoutValue, children: errorNode(loadError) });
3652
+ return /* @__PURE__ */ jsx6(CheckoutContext.Provider, { value: checkoutValue, children: errorNode(loadError) });
3753
3653
  }
3754
- return /* @__PURE__ */ jsx7(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx7(
3654
+ return /* @__PURE__ */ jsx6(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx6(
3755
3655
  "div",
3756
3656
  {
3757
3657
  style: {
@@ -3765,8 +3665,8 @@ function FloPayCheckout({
3765
3665
  ) });
3766
3666
  }
3767
3667
  if (shouldShowInterimButtons) {
3768
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
3769
- /* @__PURE__ */ jsx7(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx7(
3668
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
3669
+ /* @__PURE__ */ jsx6(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx6(
3770
3670
  InterimButtonsView,
3771
3671
  {
3772
3672
  onButtonClick,
@@ -3784,12 +3684,12 @@ function FloPayCheckout({
3784
3684
  ] });
3785
3685
  }
3786
3686
  if (!flopay || !providerOptions) {
3787
- return /* @__PURE__ */ jsx7(Fragment3, { children: modeOverlay });
3687
+ return /* @__PURE__ */ jsx6(Fragment3, { children: modeOverlay });
3788
3688
  }
3789
3689
  if (currentMode === "confirm") {
3790
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
3791
- /* @__PURE__ */ jsx7(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx7(FloPayProvider, { flopay, paypalFlopay, options: providerOptions, children: /* @__PURE__ */ jsxs5("div", { className, children: [
3792
- modeError && /* @__PURE__ */ jsx7(
3690
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
3691
+ /* @__PURE__ */ jsx6(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx6(FloPayProvider, { flopay, paypalFlopay, options: providerOptions, children: /* @__PURE__ */ jsxs4("div", { className, children: [
3692
+ modeError && /* @__PURE__ */ jsx6(
3793
3693
  "div",
3794
3694
  {
3795
3695
  style: {
@@ -3804,7 +3704,7 @@ function FloPayCheckout({
3804
3704
  renderConfirmButton ? renderConfirmButton({
3805
3705
  onConfirm: handleConfirmCheckout,
3806
3706
  isProcessing: confirmProcessing
3807
- }) : /* @__PURE__ */ jsx7(
3707
+ }) : /* @__PURE__ */ jsx6(
3808
3708
  "button",
3809
3709
  {
3810
3710
  type: "button",
@@ -3829,9 +3729,9 @@ function FloPayCheckout({
3829
3729
  modeOverlay
3830
3730
  ] });
3831
3731
  }
3832
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
3833
- /* @__PURE__ */ jsx7(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx7(FloPayProvider, { flopay, paypalFlopay, options: providerOptions, children: children ? /* @__PURE__ */ jsxs5(Fragment3, { children: [
3834
- modeError && /* @__PURE__ */ jsx7(
3732
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
3733
+ /* @__PURE__ */ jsx6(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx6(FloPayProvider, { flopay, paypalFlopay, options: providerOptions, children: children ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
3734
+ modeError && /* @__PURE__ */ jsx6(
3835
3735
  "div",
3836
3736
  {
3837
3737
  style: {
@@ -3846,7 +3746,7 @@ function FloPayCheckout({
3846
3746
  children: modeError
3847
3747
  }
3848
3748
  ),
3849
- /* @__PURE__ */ jsx7(
3749
+ /* @__PURE__ */ jsx6(
3850
3750
  SessionInjector,
3851
3751
  {
3852
3752
  sessionId: activeSessionId,
@@ -3855,7 +3755,7 @@ function FloPayCheckout({
3855
3755
  children
3856
3756
  }
3857
3757
  )
3858
- ] }) : /* @__PURE__ */ jsx7(
3758
+ ] }) : /* @__PURE__ */ jsx6(
3859
3759
  SplitCardForm,
3860
3760
  {
3861
3761
  sessionId: activeSessionId,
@@ -3906,8 +3806,8 @@ function SessionInjector({
3906
3806
  session,
3907
3807
  children
3908
3808
  }) {
3909
- return /* @__PURE__ */ jsx7(Fragment3, { children: React7.Children.map(children, (child) => {
3910
- if (!React7.isValidElement(child)) return child;
3809
+ return /* @__PURE__ */ jsx6(Fragment3, { children: React6.Children.map(children, (child) => {
3810
+ if (!React6.isValidElement(child)) return child;
3911
3811
  const existing = child.props;
3912
3812
  const injected = {};
3913
3813
  if (!existing.sessionId) injected.sessionId = sessionId;
@@ -3921,7 +3821,7 @@ function SessionInjector({
3921
3821
  injected.lastName = session.customer.lastName;
3922
3822
  }
3923
3823
  if (Object.keys(injected).length === 0) return child;
3924
- return React7.cloneElement(child, injected);
3824
+ return React6.cloneElement(child, injected);
3925
3825
  }) });
3926
3826
  }
3927
3827
  function InterimButtonsView({
@@ -3939,9 +3839,9 @@ function InterimButtonsView({
3939
3839
  cardBackButtonContent,
3940
3840
  cardTitleContent
3941
3841
  }) {
3942
- const [showCardForm, setShowCardForm] = useState4(false);
3842
+ const [showCardForm, setShowCardForm] = useState3(false);
3943
3843
  const isCardOpenControlled = typeof cardOpen === "boolean";
3944
- useEffect5(() => {
3844
+ useEffect4(() => {
3945
3845
  if (isCardOpenControlled) {
3946
3846
  setShowCardForm(cardOpen);
3947
3847
  }
@@ -3960,7 +3860,7 @@ function InterimButtonsView({
3960
3860
  title: { ...base.title, ...stylesOverride.title }
3961
3861
  };
3962
3862
  }, [buttonsTheme, stylesOverride]);
3963
- const skeleton = (h) => /* @__PURE__ */ jsx7("div", { style: {
3863
+ const skeleton = (h) => /* @__PURE__ */ jsx6("div", { style: {
3964
3864
  height: h,
3965
3865
  borderRadius: 8,
3966
3866
  background: "#e5e7eb",
@@ -3972,15 +3872,15 @@ function InterimButtonsView({
3972
3872
  const inputBg = bStyles.cardInputBackground ?? "white";
3973
3873
  const hideBackButtonLabel = isEmptySlotContent(cardBackButtonContent);
3974
3874
  const hideTitle = isEmptySlotContent(cardTitleContent);
3975
- return /* @__PURE__ */ jsxs5("div", { style: {
3875
+ return /* @__PURE__ */ jsxs4("div", { style: {
3976
3876
  backgroundColor: bStyles.cardFormContainer?.backgroundColor ?? "white",
3977
3877
  borderRadius: "8px",
3978
3878
  animation: "flopay-interim-expand 0.35s cubic-bezier(0.4, 0, 0.2, 1) both",
3979
3879
  overflow: "hidden",
3980
3880
  ...bStyles.cardFormContainer
3981
3881
  }, children: [
3982
- /* @__PURE__ */ jsxs5("div", { style: { display: "flex", alignItems: "center", padding: "0.75rem 0 0.625rem" }, children: [
3983
- /* @__PURE__ */ jsxs5(
3882
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", padding: "0.75rem 0 0.625rem" }, children: [
3883
+ /* @__PURE__ */ jsxs4(
3984
3884
  "button",
3985
3885
  {
3986
3886
  type: "button",
@@ -4007,7 +3907,7 @@ function InterimButtonsView({
4007
3907
  ...bStyles.backButton
4008
3908
  },
4009
3909
  children: [
4010
- /* @__PURE__ */ jsx7("span", { style: {
3910
+ /* @__PURE__ */ jsx6("span", { style: {
4011
3911
  display: "inline-flex",
4012
3912
  alignItems: "center",
4013
3913
  justifyContent: "center",
@@ -4016,12 +3916,12 @@ function InterimButtonsView({
4016
3916
  borderRadius: "50%",
4017
3917
  backgroundColor: "#f3f4f6",
4018
3918
  ...bStyles.backButtonIcon
4019
- }, children: /* @__PURE__ */ jsx7("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx7("path", { d: "M15 18l-6-6 6-6" }) }) }),
4020
- /* @__PURE__ */ jsx7(BackButtonContentSlot, { content: cardBackButtonContent })
3919
+ }, children: /* @__PURE__ */ jsx6("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx6("path", { d: "M15 18l-6-6 6-6" }) }) }),
3920
+ /* @__PURE__ */ jsx6(BackButtonContentSlot, { content: cardBackButtonContent })
4021
3921
  ]
4022
3922
  }
4023
3923
  ),
4024
- hideTitle ? /* @__PURE__ */ jsx7("div", { style: { flex: 1 } }) : /* @__PURE__ */ jsx7("div", { style: {
3924
+ hideTitle ? /* @__PURE__ */ jsx6("div", { style: { flex: 1 } }) : /* @__PURE__ */ jsx6("div", { style: {
4025
3925
  flex: 1,
4026
3926
  textAlign: "center",
4027
3927
  fontWeight: 600,
@@ -4029,15 +3929,15 @@ function InterimButtonsView({
4029
3929
  color: "#262833",
4030
3930
  paddingRight: 80,
4031
3931
  ...bStyles.title
4032
- }, children: /* @__PURE__ */ jsx7(TitleContentSlot, { content: cardTitleContent }) })
3932
+ }, children: /* @__PURE__ */ jsx6(TitleContentSlot, { content: cardTitleContent }) })
4033
3933
  ] }),
4034
- /* @__PURE__ */ jsx7("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTopLeftRadius: 8, borderTopRightRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx7("div", { style: { width: "60%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
4035
- /* @__PURE__ */ jsxs5("div", { style: { display: "flex" }, children: [
4036
- /* @__PURE__ */ jsx7("div", { style: { flex: 1, backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTop: "none", borderRight: "none", borderBottomLeftRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx7("div", { style: { width: "50%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
4037
- /* @__PURE__ */ jsx7("div", { style: { flex: 1, backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTop: "none", borderBottomRightRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx7("div", { style: { width: "40%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) })
3934
+ /* @__PURE__ */ jsx6("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTopLeftRadius: 8, borderTopRightRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx6("div", { style: { width: "60%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
3935
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex" }, children: [
3936
+ /* @__PURE__ */ jsx6("div", { style: { flex: 1, backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTop: "none", borderRight: "none", borderBottomLeftRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx6("div", { style: { width: "50%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
3937
+ /* @__PURE__ */ jsx6("div", { style: { flex: 1, backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTop: "none", borderBottomRightRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx6("div", { style: { width: "40%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) })
4038
3938
  ] }),
4039
- /* @__PURE__ */ jsx7("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderRadius: 8, marginTop: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx7("div", { style: { width: "45%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
4040
- /* @__PURE__ */ jsx7("div", { style: {
3939
+ /* @__PURE__ */ jsx6("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderRadius: 8, marginTop: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx6("div", { style: { width: "45%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
3940
+ /* @__PURE__ */ jsx6("div", { style: {
4041
3941
  height: 50,
4042
3942
  borderRadius: 8,
4043
3943
  marginTop: 16,
@@ -4046,7 +3946,7 @@ function InterimButtonsView({
4046
3946
  ...bStyles.submitButton,
4047
3947
  opacity: 0.5
4048
3948
  } }),
4049
- /* @__PURE__ */ jsx7("style", { children: `
3949
+ /* @__PURE__ */ jsx6("style", { children: `
4050
3950
  @keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
4051
3951
  @keyframes flopay-interim-expand {
4052
3952
  0% { opacity: 0; max-height: 0; transform: translateY(-12px); }
@@ -4056,10 +3956,10 @@ function InterimButtonsView({
4056
3956
  ` })
4057
3957
  ] });
4058
3958
  }
4059
- return /* @__PURE__ */ jsxs5("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
3959
+ return /* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
4060
3960
  showPayPal && skeleton(DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2),
4061
3961
  (showApplePay || showGooglePay) && skeleton(DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2),
4062
- /* @__PURE__ */ jsx7(
3962
+ /* @__PURE__ */ jsx6(
4063
3963
  "button",
4064
3964
  {
4065
3965
  type: "button",
@@ -4099,10 +3999,10 @@ function InterimButtonsView({
4099
3999
  onMouseUp: (e) => {
4100
4000
  e.currentTarget.style.transform = "scale(1)";
4101
4001
  },
4102
- children: /* @__PURE__ */ jsx7(CardButtonContentSlot, { content: cardButtonContent })
4002
+ children: /* @__PURE__ */ jsx6(CardButtonContentSlot, { content: cardButtonContent })
4103
4003
  }
4104
4004
  ),
4105
- errorMessage && /* @__PURE__ */ jsxs5("div", { style: {
4005
+ errorMessage && /* @__PURE__ */ jsxs4("div", { style: {
4106
4006
  margin: "0.25rem 0",
4107
4007
  padding: "0.625rem 0.875rem",
4108
4008
  background: "#FEF2F2",
@@ -4116,21 +4016,22 @@ function InterimButtonsView({
4116
4016
  gap: "0.5rem",
4117
4017
  ...bStyles.errorBanner
4118
4018
  }, children: [
4119
- /* @__PURE__ */ jsx7("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx7("path", { d: "M12 9v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z", stroke: "#DC2626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
4019
+ /* @__PURE__ */ jsx6("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx6("path", { d: "M12 9v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z", stroke: "#DC2626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
4120
4020
  errorMessage
4121
4021
  ] }),
4122
- /* @__PURE__ */ jsx7("style", { children: `@keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
4022
+ /* @__PURE__ */ jsx6("style", { children: `@keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
4123
4023
  ] });
4124
4024
  }
4125
4025
 
4126
4026
  // src/checkout-form.tsx
4027
+ import { PaymentAPI as PaymentAPI4 } from "@flopay/js";
4127
4028
  import { FloPayError as FloPayError5 } from "@flopay/shared";
4128
- import { forwardRef as forwardRef2, useCallback as useCallback4, useEffect as useEffect6, useImperativeHandle as useImperativeHandle2, useState as useState5 } from "react";
4129
- import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
4029
+ import { forwardRef as forwardRef2, useCallback as useCallback3, useEffect as useEffect5, useImperativeHandle as useImperativeHandle2, useState as useState4 } from "react";
4030
+ import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
4130
4031
  var WALLET_RESUME_KEY2 = "flopay_wallet_resume";
4131
4032
  var CheckoutForm = forwardRef2(
4132
4033
  function CheckoutForm2(props, ref) {
4133
- return /* @__PURE__ */ jsx8(CheckoutFormInner, { ...props, innerRef: ref });
4034
+ return /* @__PURE__ */ jsx7(CheckoutFormInner, { ...props, innerRef: ref });
4134
4035
  }
4135
4036
  );
4136
4037
  function CheckoutFormInner({
@@ -4159,50 +4060,44 @@ function CheckoutFormInner({
4159
4060
  const paypalFlopay = usePayPalFloPay();
4160
4061
  const elements = useElements();
4161
4062
  const contextBillingUrl = useBillingApiUrl();
4162
- const [processing, setProcessing] = useState5(false);
4163
- const [error, setError] = useState5(null);
4164
- const [is3DSActive, setIs3DSActive] = useState5(false);
4063
+ const [processing, setProcessing] = useState4(false);
4064
+ const [error, setError] = useState4(null);
4065
+ const [is3DSActive, setIs3DSActive] = useState4(false);
4165
4066
  const displayError = externalError ?? error;
4166
4067
  const isSubmitting = externalProcessing ?? processing;
4167
4068
  const isSelfContained = !onTokenizedBody;
4168
4069
  const baseUrl = (billingApiUrl || contextBillingUrl).replace(/\/+$/, "");
4169
- const updateError = useCallback4(
4070
+ const updateError = useCallback3(
4170
4071
  (err) => {
4171
4072
  setError(err);
4172
4073
  onErrorChange?.(err);
4173
4074
  },
4174
4075
  [onErrorChange]
4175
4076
  );
4176
- const emitDecline = useCallback4(
4077
+ const emitDecline = useCallback3(
4177
4078
  (input, overrides) => {
4178
4079
  onDecline?.(buildDeclineEvent("card", input, overrides));
4179
4080
  },
4180
4081
  [onDecline]
4181
4082
  );
4182
- const processPaymentInternal = useCallback4(
4083
+ const processPaymentInternal = useCallback3(
4183
4084
  async (tokenizedBody, completionPaymentMethodId) => {
4184
4085
  setProcessing(true);
4185
4086
  updateError(null);
4186
4087
  const resolvedCompletionPaymentMethodId = completionPaymentMethodId ?? resolveTokenizedPaymentMethodId(tokenizedBody);
4187
4088
  const requestTokenizedBody = tokenizedBody.originalPaymentMethodId ? { ...tokenizedBody, originalPaymentMethodId: void 0 } : tokenizedBody;
4188
4089
  try {
4189
- const response = await fetch(`${baseUrl}/v1/checkouts/sessions/process`, {
4190
- method: "POST",
4191
- headers: {
4192
- "Content-Type": "application/json",
4193
- "x-user-id": userId ?? ""
4090
+ const api = new PaymentAPI4(baseUrl);
4091
+ const response = await api.processPayment(userId ?? "", {
4092
+ sessionId,
4093
+ tokenizedData: requestTokenizedBody,
4094
+ accountData: {
4095
+ userId: userId ?? "",
4096
+ email: email ?? "",
4097
+ firstName: firstName ?? "",
4098
+ lastName: lastName ?? ""
4194
4099
  },
4195
- body: JSON.stringify({
4196
- sessionId,
4197
- tokenizedData: requestTokenizedBody,
4198
- accountData: {
4199
- userId: userId ?? "",
4200
- email: email ?? "",
4201
- firstName: firstName ?? "",
4202
- lastName: lastName ?? ""
4203
- },
4204
- chv
4205
- })
4100
+ chv
4206
4101
  });
4207
4102
  if (response.ok) {
4208
4103
  onComplete?.({
@@ -4296,7 +4191,7 @@ function CheckoutFormInner({
4296
4191
  },
4297
4192
  [baseUrl, sessionId, userId, email, firstName, lastName, chv, flopay, paypalFlopay, onComplete, onError, onDecline, updateError, emitDecline]
4298
4193
  );
4299
- const dispatchTokenizedBody = useCallback4(
4194
+ const dispatchTokenizedBody = useCallback3(
4300
4195
  (tokenizedBody) => {
4301
4196
  if (onTokenizedBody) {
4302
4197
  onTokenizedBody(tokenizedBody);
@@ -4333,7 +4228,7 @@ function CheckoutFormInner({
4333
4228
  }
4334
4229
  }
4335
4230
  }), [flopay, dispatchTokenizedBody, onError, updateError, emitDecline]);
4336
- useEffect6(() => {
4231
+ useEffect5(() => {
4337
4232
  if (typeof window === "undefined") return;
4338
4233
  const stored = localStorage.getItem(WALLET_RESUME_KEY2);
4339
4234
  if (!stored) return;
@@ -4351,7 +4246,7 @@ function CheckoutFormInner({
4351
4246
  localStorage.removeItem(WALLET_RESUME_KEY2);
4352
4247
  }
4353
4248
  }, [sessionId, dispatchTokenizedBody]);
4354
- const handleSubmit = useCallback4(
4249
+ const handleSubmit = useCallback3(
4355
4250
  async (e) => {
4356
4251
  e.preventDefault();
4357
4252
  if (!flopay || !elements || isSubmitting) return;
@@ -4441,8 +4336,8 @@ function CheckoutFormInner({
4441
4336
  [flopay, elements, isSubmitting, sessionId, email, baseUrl, isSelfContained, dispatchTokenizedBody, onError, updateError, emitDecline]
4442
4337
  );
4443
4338
  const isReady = flopay !== null && elements !== null;
4444
- return /* @__PURE__ */ jsxs6("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
4445
- (is3DSActive || isSubmitting) && /* @__PURE__ */ jsx8("div", { "data-testid": "flopay-overlay", style: {
4339
+ return /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
4340
+ (is3DSActive || isSubmitting) && /* @__PURE__ */ jsx7("div", { "data-testid": "flopay-overlay", style: {
4446
4341
  position: "absolute",
4447
4342
  inset: 0,
4448
4343
  background: "rgba(255,255,255,0.7)",
@@ -4451,12 +4346,12 @@ function CheckoutFormInner({
4451
4346
  justifyContent: "center",
4452
4347
  zIndex: 10
4453
4348
  }, children: is3DSActive ? "Verifying payment..." : "Processing..." }),
4454
- !isReady && /* @__PURE__ */ jsx8("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." }),
4455
- isReady && /* @__PURE__ */ jsxs6(Fragment4, { children: [
4456
- /* @__PURE__ */ jsx8(PaymentElement, { options: { layout } }),
4457
- showAddress && /* @__PURE__ */ jsx8(AddressElement, { options: { mode: showAddress === true ? "billing" : showAddress } }),
4458
- displayError && /* @__PURE__ */ jsx8("div", { role: "alert", "data-testid": "flopay-error", style: { color: "red", margin: "0.75rem 0" }, children: displayError }),
4459
- children ?? /* @__PURE__ */ jsx8(
4349
+ !isReady && /* @__PURE__ */ jsx7("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." }),
4350
+ isReady && /* @__PURE__ */ jsxs5(Fragment4, { children: [
4351
+ /* @__PURE__ */ jsx7(PaymentElement, { options: { layout } }),
4352
+ showAddress && /* @__PURE__ */ jsx7(AddressElement, { options: { mode: showAddress === true ? "billing" : showAddress } }),
4353
+ displayError && /* @__PURE__ */ jsx7("div", { role: "alert", "data-testid": "flopay-error", style: { color: "red", margin: "0.75rem 0" }, children: displayError }),
4354
+ children ?? /* @__PURE__ */ jsx7(
4460
4355
  "button",
4461
4356
  {
4462
4357
  type: "submit",
@@ -4470,9 +4365,10 @@ function CheckoutFormInner({
4470
4365
  }
4471
4366
 
4472
4367
  // src/paypal-button.tsx
4368
+ import { PaymentAPI as PaymentAPI5 } from "@flopay/js";
4473
4369
  import { FloPayError as FloPayError6 } from "@flopay/shared";
4474
- import { useCallback as useCallback5, useEffect as useEffect7, useRef as useRef4, useState as useState6 } from "react";
4475
- import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
4370
+ import { useCallback as useCallback4, useEffect as useEffect6, useRef as useRef4, useState as useState5 } from "react";
4371
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
4476
4372
  function PayPalButton({
4477
4373
  sessionId,
4478
4374
  billingApiUrl,
@@ -4489,30 +4385,24 @@ function PayPalButton({
4489
4385
  const flopay = useFloPay();
4490
4386
  const elements = useElements();
4491
4387
  const contextBillingUrl = useBillingApiUrl();
4492
- const [ready, setReady] = useState6(false);
4493
- const [submitting, setSubmitting] = useState6(false);
4388
+ const [ready, setReady] = useState5(false);
4389
+ const [submitting, setSubmitting] = useState5(false);
4494
4390
  const paypalResumeAttempted = useRef4(false);
4495
4391
  const baseUrl = (billingApiUrl || contextBillingUrl).replace(/\/+$/, "");
4496
- const processPaymentInternal = useCallback5(
4392
+ const processPaymentInternal = useCallback4(
4497
4393
  async (tokenizedBody) => {
4498
4394
  try {
4499
- const response = await fetch(`${baseUrl}/v1/checkouts/sessions/process`, {
4500
- method: "POST",
4501
- headers: {
4502
- "Content-Type": "application/json",
4503
- "x-user-id": userId ?? ""
4395
+ const api = new PaymentAPI5(baseUrl);
4396
+ const response = await api.processPayment(userId ?? "", {
4397
+ sessionId,
4398
+ tokenizedData: tokenizedBody,
4399
+ accountData: {
4400
+ userId: userId ?? "",
4401
+ email: email ?? "",
4402
+ firstName: firstName ?? "",
4403
+ lastName: lastName ?? ""
4504
4404
  },
4505
- body: JSON.stringify({
4506
- sessionId,
4507
- tokenizedData: tokenizedBody,
4508
- accountData: {
4509
- userId: userId ?? "",
4510
- email: email ?? "",
4511
- firstName: firstName ?? "",
4512
- lastName: lastName ?? ""
4513
- },
4514
- chv
4515
- })
4405
+ chv
4516
4406
  });
4517
4407
  if (response.ok) {
4518
4408
  onComplete?.();
@@ -4526,7 +4416,7 @@ function PayPalButton({
4526
4416
  },
4527
4417
  [baseUrl, sessionId, userId, email, firstName, lastName, chv, onComplete, onErrorChange]
4528
4418
  );
4529
- const dispatchTokenizedBody = useCallback5(
4419
+ const dispatchTokenizedBody = useCallback4(
4530
4420
  (body) => {
4531
4421
  if (onTokenizedBody) {
4532
4422
  onTokenizedBody(body);
@@ -4536,7 +4426,7 @@ function PayPalButton({
4536
4426
  },
4537
4427
  [onTokenizedBody, processPaymentInternal]
4538
4428
  );
4539
- useEffect7(() => {
4429
+ useEffect6(() => {
4540
4430
  if (!flopay || paypalResumeAttempted.current) return;
4541
4431
  const params = new URLSearchParams(window.location.search);
4542
4432
  const paymentIntentId = params.get("payment_intent");
@@ -4584,7 +4474,7 @@ function PayPalButton({
4584
4474
  }
4585
4475
  })();
4586
4476
  }, [flopay, dispatchTokenizedBody, onErrorChange]);
4587
- const handlePayPalConfirm = useCallback5(async () => {
4477
+ const handlePayPalConfirm = useCallback4(async () => {
4588
4478
  if (!flopay || !elements) return;
4589
4479
  try {
4590
4480
  setSubmitting(true);
@@ -4617,11 +4507,11 @@ function PayPalButton({
4617
4507
  }
4618
4508
  }, [flopay, elements, sessionId, email, baseUrl, dispatchTokenizedBody, onErrorChange]);
4619
4509
  if (!flopay || !elements) {
4620
- return /* @__PURE__ */ jsx9("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6, animation: "pulse 1.5s infinite" } });
4510
+ return /* @__PURE__ */ jsx8("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6, animation: "pulse 1.5s infinite" } });
4621
4511
  }
4622
- return /* @__PURE__ */ jsxs7(Fragment5, { children: [
4623
- !ready && /* @__PURE__ */ jsx9("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6 } }),
4624
- /* @__PURE__ */ jsx9("div", { style: ready ? {} : { display: "none" }, children: /* @__PURE__ */ jsx9(
4512
+ return /* @__PURE__ */ jsxs6(Fragment5, { children: [
4513
+ !ready && /* @__PURE__ */ jsx8("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6 } }),
4514
+ /* @__PURE__ */ jsx8("div", { style: ready ? {} : { display: "none" }, children: /* @__PURE__ */ jsx8(
4625
4515
  "button",
4626
4516
  {
4627
4517
  type: "button",
@@ -4643,7 +4533,7 @@ function PayPalButton({
4643
4533
  children: submitting ? "Processing..." : "PayPal"
4644
4534
  }
4645
4535
  ) }),
4646
- (submitting || isProcessing) && /* @__PURE__ */ jsx9("div", { style: {
4536
+ (submitting || isProcessing) && /* @__PURE__ */ jsx8("div", { style: {
4647
4537
  position: "fixed",
4648
4538
  inset: 0,
4649
4539
  background: "rgba(0,0,0,0.4)",
@@ -4651,7 +4541,7 @@ function PayPalButton({
4651
4541
  alignItems: "center",
4652
4542
  justifyContent: "center",
4653
4543
  zIndex: 1e3
4654
- }, children: /* @__PURE__ */ jsx9("div", { style: {
4544
+ }, children: /* @__PURE__ */ jsx8("div", { style: {
4655
4545
  background: "white",
4656
4546
  borderRadius: 8,
4657
4547
  padding: "1.5rem",
@@ -4663,10 +4553,10 @@ function PayPalButton({
4663
4553
  }
4664
4554
 
4665
4555
  // src/automatic-payment-button.tsx
4666
- import { useCallback as useCallback6, useEffect as useEffect8, useMemo as useMemo4, useRef as useRef5, useState as useState7 } from "react";
4667
- import { PaymentAPI as PaymentAPI3 } from "@flopay/js";
4556
+ import { useCallback as useCallback5, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
4557
+ import { PaymentAPI as PaymentAPI6 } from "@flopay/js";
4668
4558
  import { FloPayError as FloPayError7, resolveBillingApiUrl as resolveBillingApiUrl4, resolveButtonsLayoutTheme as resolveButtonsLayoutTheme3 } from "@flopay/shared";
4669
- import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
4559
+ import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
4670
4560
  var DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT3 = 44;
4671
4561
  var PAYPAL_RESUME_STORAGE_KEY2 = "flopay_automatic_payment_button_resume";
4672
4562
  function sleep2(ms) {
@@ -4813,10 +4703,10 @@ function FloPayAutomaticPaymentButton({
4813
4703
  utmMetadata
4814
4704
  ]
4815
4705
  );
4816
- const [isProcessing, setIsProcessing] = useState7(false);
4817
- const [overlayStatus, setOverlayStatus] = useState7(null);
4818
- const [overlayError, setOverlayError] = useState7(null);
4819
- const [fallbackSession, setFallbackSession] = useState7(null);
4706
+ const [isProcessing, setIsProcessing] = useState6(false);
4707
+ const [overlayStatus, setOverlayStatus] = useState6(null);
4708
+ const [overlayError, setOverlayError] = useState6(null);
4709
+ const [fallbackSession, setFallbackSession] = useState6(null);
4820
4710
  const automaticPaymentToken = useMemo4(
4821
4711
  () => paymentMethodId ? {
4822
4712
  id: paymentMethodId,
@@ -4831,25 +4721,25 @@ function FloPayAutomaticPaymentButton({
4831
4721
  const onSuccessRef = useRef5(onSuccess);
4832
4722
  const onErrorRef = useRef5(onError);
4833
4723
  const onDeclineRef = useRef5(onDecline);
4834
- useEffect8(() => {
4724
+ useEffect7(() => {
4835
4725
  fallbackSessionRef.current = fallbackSession;
4836
4726
  }, [fallbackSession]);
4837
- useEffect8(() => {
4727
+ useEffect7(() => {
4838
4728
  onSuccessRef.current = onSuccess;
4839
4729
  }, [onSuccess]);
4840
- useEffect8(() => {
4730
+ useEffect7(() => {
4841
4731
  onErrorRef.current = onError;
4842
4732
  }, [onError]);
4843
- useEffect8(() => {
4733
+ useEffect7(() => {
4844
4734
  onDeclineRef.current = onDecline;
4845
4735
  }, [onDecline]);
4846
- useEffect8(() => {
4736
+ useEffect7(() => {
4847
4737
  isMountedRef.current = true;
4848
4738
  return () => {
4849
4739
  isMountedRef.current = false;
4850
4740
  };
4851
4741
  }, []);
4852
- useEffect8(() => {
4742
+ useEffect7(() => {
4853
4743
  if (!fallbackSession || typeof window === "undefined") {
4854
4744
  return;
4855
4745
  }
@@ -4863,13 +4753,13 @@ function FloPayAutomaticPaymentButton({
4863
4753
  window.removeEventListener("keydown", handleKeyDown);
4864
4754
  };
4865
4755
  }, [fallbackSession]);
4866
- const emitDecline = useCallback6((error, method = DEFAULT_SAVED_PAYMENT_DECLINE_METHOD) => {
4756
+ const emitDecline = useCallback5((error, method = DEFAULT_SAVED_PAYMENT_DECLINE_METHOD) => {
4867
4757
  onDeclineRef.current?.(buildDeclineEvent(method, error, {
4868
4758
  code: error.code,
4869
4759
  declineCode: error.declineCode
4870
4760
  }));
4871
4761
  }, []);
4872
- const showSuccess = useCallback6(async (event) => {
4762
+ const showSuccess = useCallback5(async (event) => {
4873
4763
  if (!isMountedRef.current) return;
4874
4764
  setOverlayError(null);
4875
4765
  setOverlayStatus("success");
@@ -4877,7 +4767,7 @@ function FloPayAutomaticPaymentButton({
4877
4767
  if (!isMountedRef.current) return;
4878
4768
  onSuccessRef.current?.(event);
4879
4769
  }, []);
4880
- const showError = useCallback6(async (error, options) => {
4770
+ const showError = useCallback5(async (error, options) => {
4881
4771
  if (!isMountedRef.current) return;
4882
4772
  onErrorRef.current?.(error);
4883
4773
  if (options?.emitDecline) {
@@ -4887,7 +4777,7 @@ function FloPayAutomaticPaymentButton({
4887
4777
  setOverlayStatus("error");
4888
4778
  await sleep2(PROCESSING_OVERLAY_ERROR_DELAY_MS);
4889
4779
  }, [emitDecline]);
4890
- const processResolvedSession = useCallback6(async (apiResult, resolvedSessionId, options) => {
4780
+ const processResolvedSession = useCallback5(async (apiResult, resolvedSessionId, options) => {
4891
4781
  const session = apiResult.data.session ?? null;
4892
4782
  if (!session) {
4893
4783
  throw new FloPayError7("No session data returned", "api_error");
@@ -4911,6 +4801,29 @@ function FloPayAutomaticPaymentButton({
4911
4801
  const redirectResult = getRedirectResultFromCheckoutProcessError(apiResult.autoProcessingError);
4912
4802
  const shouldTreatCreateSessionFlowAsServerAutoAttempt = options?.fromCreateSession && (apiResult.autoProcessingAttempted === true || !!apiResult.autoProcessingError || !!redirectResult);
4913
4803
  const shouldRetryPayPalClientSide = checkoutMethod === "paypal" && automaticPaymentToken?.isPaypal === true && options?.fromCreateSession === true;
4804
+ if (apiResult.autoProcessingPending) {
4805
+ const api = new PaymentAPI6(resolvedBillingUrl);
4806
+ const completed = await api.waitForCheckoutSessionCompletion(apiResult.autoProcessingPending.sessionId, {
4807
+ initialDelayMs: apiResult.autoProcessingPending.retryAfterMs
4808
+ });
4809
+ const completedSession = completed.data.session;
4810
+ if (!completedSession || completedSession.status !== "complete") {
4811
+ throw new FloPayError7("Automatic payment failed. Please try again.", "api_error", {
4812
+ code: completedSession?.status === "expired" ? "checkout_session_expired" : "checkout_processing_timeout"
4813
+ });
4814
+ }
4815
+ await showSuccess({
4816
+ result: {
4817
+ status: "succeeded",
4818
+ paymentMethodId: paymentMethodId ?? void 0,
4819
+ checkoutMethod
4820
+ },
4821
+ session: completedSession,
4822
+ sessionId: completedSession.id || resolvedSessionId,
4823
+ autoCompleted: false
4824
+ });
4825
+ return;
4826
+ }
4914
4827
  if (redirectResult) {
4915
4828
  const {
4916
4829
  publishableKey,
@@ -5087,7 +5000,7 @@ function FloPayAutomaticPaymentButton({
5087
5000
  showError,
5088
5001
  showSuccess
5089
5002
  ]);
5090
- const handleButtonClick = useCallback6(async (event) => {
5003
+ const handleButtonClick = useCallback5(async (event) => {
5091
5004
  buttonProps.onClick?.(event);
5092
5005
  if (event.defaultPrevented || disabled || isProcessing) {
5093
5006
  return;
@@ -5121,7 +5034,7 @@ function FloPayAutomaticPaymentButton({
5121
5034
  setOverlayError(null);
5122
5035
  setOverlayStatus("processing");
5123
5036
  try {
5124
- const api = new PaymentAPI3(resolvedBillingUrl);
5037
+ const api = new PaymentAPI6(resolvedBillingUrl);
5125
5038
  if (sessionId) {
5126
5039
  const result = await api.getUnifiedCheckoutSession(sessionId);
5127
5040
  await processResolvedSession(result, sessionId);
@@ -5169,7 +5082,7 @@ function FloPayAutomaticPaymentButton({
5169
5082
  showError,
5170
5083
  showSuccess
5171
5084
  ]);
5172
- const handleFallbackComplete = useCallback6((result) => {
5085
+ const handleFallbackComplete = useCallback5((result) => {
5173
5086
  const activeFallback = fallbackSessionRef.current;
5174
5087
  setFallbackSession(null);
5175
5088
  onSuccessRef.current?.({
@@ -5179,13 +5092,13 @@ function FloPayAutomaticPaymentButton({
5179
5092
  autoCompleted: false
5180
5093
  });
5181
5094
  }, []);
5182
- const handleFallbackError = useCallback6((error) => {
5095
+ const handleFallbackError = useCallback5((error) => {
5183
5096
  onErrorRef.current?.(error);
5184
5097
  }, []);
5185
- const handleFallbackDecline = useCallback6((decline) => {
5098
+ const handleFallbackDecline = useCallback5((decline) => {
5186
5099
  onDeclineRef.current?.(decline);
5187
5100
  }, []);
5188
- useEffect8(() => {
5101
+ useEffect7(() => {
5189
5102
  if (typeof window === "undefined" || resumeAttemptedRef.current) {
5190
5103
  return;
5191
5104
  }
@@ -5251,7 +5164,7 @@ function FloPayAutomaticPaymentButton({
5251
5164
  { checkoutMethod: "paypal" }
5252
5165
  );
5253
5166
  }
5254
- const api = new PaymentAPI3(resolvedBillingUrl);
5167
+ const api = new PaymentAPI6(resolvedBillingUrl);
5255
5168
  const sessionResult = await api.getUnifiedCheckoutSession(resumeState.sessionId);
5256
5169
  let resumeSession = sessionResult.data.session;
5257
5170
  if (!resumeSession) {
@@ -5326,8 +5239,8 @@ function FloPayAutomaticPaymentButton({
5326
5239
  };
5327
5240
  }, [buttonsTheme, stylesOverride]);
5328
5241
  const cardButtonSizing = children === void 0 ? { boxSizing: "border-box", height: DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT3, padding: "0 1rem" } : { padding: "0.9rem 1rem" };
5329
- return /* @__PURE__ */ jsxs8(Fragment6, { children: [
5330
- /* @__PURE__ */ jsx10(
5242
+ return /* @__PURE__ */ jsxs7(Fragment6, { children: [
5243
+ /* @__PURE__ */ jsx9(
5331
5244
  "button",
5332
5245
  {
5333
5246
  ...buttonProps,
@@ -5368,17 +5281,17 @@ function FloPayAutomaticPaymentButton({
5368
5281
  e.currentTarget.style.transform = "scale(1)";
5369
5282
  }
5370
5283
  },
5371
- children: /* @__PURE__ */ jsx10(CardButtonContentSlot, { content: children })
5284
+ children: /* @__PURE__ */ jsx9(CardButtonContentSlot, { content: children })
5372
5285
  }
5373
5286
  ),
5374
- overlayStatus && /* @__PURE__ */ jsx10(
5287
+ overlayStatus && /* @__PURE__ */ jsx9(
5375
5288
  ProcessingOverlay,
5376
5289
  {
5377
5290
  status: overlayStatus,
5378
5291
  errorMessage: overlayError
5379
5292
  }
5380
5293
  ),
5381
- fallbackSession && /* @__PURE__ */ jsx10(
5294
+ fallbackSession && /* @__PURE__ */ jsx9(
5382
5295
  "div",
5383
5296
  {
5384
5297
  "data-testid": "flopay-automatic-payment-fallback",
@@ -5399,7 +5312,7 @@ function FloPayAutomaticPaymentButton({
5399
5312
  padding: "1.5rem",
5400
5313
  zIndex: 1100
5401
5314
  },
5402
- children: /* @__PURE__ */ jsx10(
5315
+ children: /* @__PURE__ */ jsx9(
5403
5316
  "div",
5404
5317
  {
5405
5318
  style: {
@@ -5415,7 +5328,7 @@ function FloPayAutomaticPaymentButton({
5415
5328
  flexDirection: "column",
5416
5329
  gap: "1rem"
5417
5330
  },
5418
- children: /* @__PURE__ */ jsx10(
5331
+ children: /* @__PURE__ */ jsx9(
5419
5332
  FloPayCheckout,
5420
5333
  {
5421
5334
  sessionId: fallbackSession.sessionId,
@@ -5445,11 +5358,9 @@ export {
5445
5358
  FloPayAutomaticPaymentButton,
5446
5359
  FloPayCheckout,
5447
5360
  FloPayProvider,
5448
- InAppBrowserNotice,
5449
5361
  PayPalButton,
5450
5362
  PaymentElement,
5451
5363
  SplitCardForm,
5452
- isInAppBrowser,
5453
5364
  useCheckout,
5454
5365
  useElements,
5455
5366
  useFloPay,