@flopay/react 1.4.0 → 1.4.1

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
@@ -193,7 +193,7 @@ function FloPayProvider({
193
193
  }
194
194
 
195
195
  // src/flopay-checkout.tsx
196
- import React8, { useCallback as useCallback4, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef6, useState as useState4 } from "react";
196
+ import React9, { useCallback as useCallback4, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef6, useState as useState4 } from "react";
197
197
  import { PaymentAPI as PaymentAPI4 } from "@flopay/js";
198
198
  import { SDK_VERSION as SDK_VERSION2, FloPayError as FloPayError5, resolveBillingApiUrl as resolveBillingApiUrl3, buildCheckoutDisplayData, resolveButtonsLayoutTheme as resolveButtonsLayoutTheme2, resolveTheme as resolveTheme2 } from "@flopay/shared";
199
199
 
@@ -428,8 +428,65 @@ function VaultCardFields({
428
428
  return /* @__PURE__ */ jsx4("div", { ref: containerRef, "data-testid": "flopay-vault-card-fields", style: containerStyle });
429
429
  }
430
430
 
431
+ // src/error-banner.tsx
432
+ import "react";
433
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
434
+ function ErrorBanner({
435
+ children,
436
+ margin,
437
+ icon = true,
438
+ styleOverride
439
+ }) {
440
+ return /* @__PURE__ */ jsxs2(
441
+ "div",
442
+ {
443
+ role: "alert",
444
+ "data-testid": "flopay-error",
445
+ style: {
446
+ margin,
447
+ padding: "0.625rem 0.875rem",
448
+ background: "#FEF2F2",
449
+ border: "1px solid #FECACA",
450
+ borderRadius: "8px",
451
+ color: "#991B1B",
452
+ fontSize: "0.85rem",
453
+ fontWeight: 600,
454
+ ...icon ? { display: "flex", alignItems: "center", gap: "0.5rem" } : {},
455
+ ...styleOverride ?? {}
456
+ },
457
+ children: [
458
+ icon && /* @__PURE__ */ jsx5("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx5(
459
+ "path",
460
+ {
461
+ d: "M12 9v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z",
462
+ stroke: "#DC2626",
463
+ strokeWidth: "2",
464
+ strokeLinecap: "round",
465
+ strokeLinejoin: "round"
466
+ }
467
+ ) }),
468
+ children
469
+ ]
470
+ }
471
+ );
472
+ }
473
+
474
+ // src/payment-logos.generated.ts
475
+ var PAYMENT_METHOD_LOGO_URLS = {
476
+ "alipay": new URL("./payment-logos/alipay.svg", import.meta.url).href,
477
+ "bancontact": new URL("./payment-logos/bancontact.svg", import.meta.url).href,
478
+ "blik": new URL("./payment-logos/blik.svg", import.meta.url).href,
479
+ "eps": new URL("./payment-logos/eps.svg", import.meta.url).href,
480
+ "giropay": new URL("./payment-logos/giropay.svg", import.meta.url).href,
481
+ "ideal": new URL("./payment-logos/ideal.svg", import.meta.url).href,
482
+ "klarna": new URL("./payment-logos/klarna.svg", import.meta.url).href,
483
+ "p24": new URL("./payment-logos/p24.svg", import.meta.url).href,
484
+ "sepa_debit": new URL("./payment-logos/sepa_debit.svg", import.meta.url).href,
485
+ "wechat_pay": new URL("./payment-logos/wechat_pay.svg", import.meta.url).href
486
+ };
487
+
431
488
  // src/split-card-form.tsx
432
- import React7, { forwardRef, useCallback as useCallback3, useContext as useContext3, useEffect as useEffect5, useImperativeHandle, useMemo as useMemo3, useRef as useRef5, useState as useState3 } from "react";
489
+ import React8, { forwardRef, useCallback as useCallback3, useContext as useContext3, useEffect as useEffect5, useImperativeHandle, useMemo as useMemo3, useRef as useRef5, useState as useState3 } from "react";
433
490
 
434
491
  // src/hooks.ts
435
492
  import { useContext as useContext2 } from "react";
@@ -456,14 +513,14 @@ function useBillingApiUrl() {
456
513
 
457
514
  // src/processing-overlay.tsx
458
515
  import "react";
459
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
516
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
460
517
  var PROCESSING_OVERLAY_SUCCESS_DELAY_MS = 1200;
461
518
  var PROCESSING_OVERLAY_ERROR_DELAY_MS = 1500;
462
519
  function ProcessingOverlay({
463
520
  status,
464
521
  errorMessage
465
522
  }) {
466
- return /* @__PURE__ */ jsx5(
523
+ return /* @__PURE__ */ jsx6(
467
524
  "div",
468
525
  {
469
526
  "data-testid": "flopay-processing-overlay",
@@ -480,7 +537,7 @@ function ProcessingOverlay({
480
537
  zIndex: 1e3,
481
538
  backdropFilter: "blur(2px)"
482
539
  },
483
- children: /* @__PURE__ */ jsxs2(
540
+ children: /* @__PURE__ */ jsxs3(
484
541
  "div",
485
542
  {
486
543
  style: {
@@ -496,8 +553,8 @@ function ProcessingOverlay({
496
553
  gap: 16
497
554
  },
498
555
  children: [
499
- /* @__PURE__ */ jsxs2("div", { style: { width: 48, height: 48, position: "relative" }, children: [
500
- status === "processing" && /* @__PURE__ */ jsxs2(
556
+ /* @__PURE__ */ jsxs3("div", { style: { width: 48, height: 48, position: "relative" }, children: [
557
+ status === "processing" && /* @__PURE__ */ jsxs3(
501
558
  "svg",
502
559
  {
503
560
  width: "48",
@@ -507,14 +564,14 @@ function ProcessingOverlay({
507
564
  xmlns: "http://www.w3.org/2000/svg",
508
565
  style: { animation: "flopay-spin 0.8s linear infinite" },
509
566
  children: [
510
- /* @__PURE__ */ jsx5("circle", { cx: "12", cy: "12", r: "10", stroke: "#e5e7eb", strokeWidth: "3" }),
511
- /* @__PURE__ */ jsx5("path", { d: "M4 12a8 8 0 018-8v3a5 5 0 00-5 5H4z", fill: "#4A49FF" })
567
+ /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "10", stroke: "#e5e7eb", strokeWidth: "3" }),
568
+ /* @__PURE__ */ jsx6("path", { d: "M4 12a8 8 0 018-8v3a5 5 0 00-5 5H4z", fill: "#4A49FF" })
512
569
  ]
513
570
  }
514
571
  ),
515
- status === "success" && /* @__PURE__ */ jsx5("div", { style: { animation: "flopay-pop 0.4s cubic-bezier(0.34,1.56,0.64,1)" }, children: /* @__PURE__ */ jsxs2("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
516
- /* @__PURE__ */ jsx5("circle", { cx: "12", cy: "12", r: "11", fill: "#22c55e" }),
517
- /* @__PURE__ */ jsx5(
572
+ status === "success" && /* @__PURE__ */ jsx6("div", { style: { animation: "flopay-pop 0.4s cubic-bezier(0.34,1.56,0.64,1)" }, children: /* @__PURE__ */ jsxs3("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
573
+ /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "11", fill: "#22c55e" }),
574
+ /* @__PURE__ */ jsx6(
518
575
  "path",
519
576
  {
520
577
  d: "M7 12.5l3 3 7-7",
@@ -530,9 +587,9 @@ function ProcessingOverlay({
530
587
  }
531
588
  )
532
589
  ] }) }),
533
- status === "error" && /* @__PURE__ */ jsx5("div", { style: { animation: "flopay-shake 0.4s ease" }, children: /* @__PURE__ */ jsxs2("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
534
- /* @__PURE__ */ jsx5("circle", { cx: "12", cy: "12", r: "11", fill: "#ef4444" }),
535
- /* @__PURE__ */ jsx5(
590
+ status === "error" && /* @__PURE__ */ jsx6("div", { style: { animation: "flopay-shake 0.4s ease" }, children: /* @__PURE__ */ jsxs3("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
591
+ /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "11", fill: "#ef4444" }),
592
+ /* @__PURE__ */ jsx6(
536
593
  "path",
537
594
  {
538
595
  d: "M8 8l8 8M16 8l-8 8",
@@ -548,7 +605,7 @@ function ProcessingOverlay({
548
605
  )
549
606
  ] }) })
550
607
  ] }),
551
- /* @__PURE__ */ jsxs2(
608
+ /* @__PURE__ */ jsxs3(
552
609
  "span",
553
610
  {
554
611
  style: {
@@ -564,7 +621,7 @@ function ProcessingOverlay({
564
621
  ]
565
622
  }
566
623
  ),
567
- status === "success" && /* @__PURE__ */ jsx5(
624
+ status === "success" && /* @__PURE__ */ jsx6(
568
625
  "p",
569
626
  {
570
627
  style: {
@@ -578,7 +635,7 @@ function ProcessingOverlay({
578
635
  children: "You will be automatically redirected, do not close or navigate away from this window."
579
636
  }
580
637
  ),
581
- status === "error" && errorMessage && /* @__PURE__ */ jsx5(
638
+ status === "error" && errorMessage && /* @__PURE__ */ jsx6(
582
639
  "p",
583
640
  {
584
641
  style: {
@@ -592,7 +649,7 @@ function ProcessingOverlay({
592
649
  children: errorMessage
593
650
  }
594
651
  ),
595
- /* @__PURE__ */ jsx5("style", { children: `
652
+ /* @__PURE__ */ jsx6("style", { children: `
596
653
  @keyframes flopay-spin { to { transform: rotate(360deg); } }
597
654
  @keyframes flopay-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
598
655
  @keyframes flopay-draw { to { stroke-dashoffset: 0; } }
@@ -754,6 +811,14 @@ async function buildFloPayApiErrorFromResponse(response, fallbackMessage) {
754
811
  const payload = await response.json().catch(() => null);
755
812
  return buildFloPayApiError(payload, fallbackMessage);
756
813
  }
814
+ function intentRequestHeaders(nonce) {
815
+ const headers = { "Content-Type": "application/json" };
816
+ if (nonce) headers["x-checkout-session-token"] = nonce;
817
+ return headers;
818
+ }
819
+ function isSuccessfulPaymentIntentStatus(status) {
820
+ return status === "succeeded" || status === "requires_capture" || status === "processing";
821
+ }
757
822
  function mapPayPalIntentStatusToPaymentResult(status) {
758
823
  if (status === "succeeded") {
759
824
  return "succeeded";
@@ -921,7 +986,7 @@ function isPopupBlockedError(err) {
921
986
  }
922
987
 
923
988
  // src/direct-paypal-button.tsx
924
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
989
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
925
990
  var DEFAULT_BUTTON_HEIGHT = 45;
926
991
  var DIRECT_PAYPAL_RECOVERY_MESSAGE = "We couldn't open PayPal. Try again or choose another payment method.";
927
992
  var DIRECT_PAYPAL_RECOVERY_ACTION_STYLE = {
@@ -1485,9 +1550,8 @@ function DirectPayPalButtonImplementation({
1485
1550
  const prepared = beforeClickRef.current;
1486
1551
  const effectiveSessionId = prepared?.sessionId ?? sessionId;
1487
1552
  const effectiveEmail = prepared?.accountPatch?.email ?? emailRef.current;
1488
- const intentHeaders = { "Content-Type": "application/json" };
1489
1553
  const currentNonce = prepared?.nonce ?? nonceRef.current;
1490
- if (currentNonce) intentHeaders["x-checkout-session-token"] = currentNonce;
1554
+ const intentHeaders = intentRequestHeaders(currentNonce);
1491
1555
  telemetrySource.log({
1492
1556
  name: "payment.intent.started",
1493
1557
  stage: "processing",
@@ -1816,7 +1880,7 @@ function DirectPayPalButtonImplementation({
1816
1880
  }
1817
1881
  };
1818
1882
  }, [baseUrl, clientId, currency, environment, isSubscription, sessionId, existingOrderId, renderGeneration, telemetrySource]);
1819
- const debugPanel = debug ? /* @__PURE__ */ jsxs3(
1883
+ const debugPanel = debug ? /* @__PURE__ */ jsxs4(
1820
1884
  "pre",
1821
1885
  {
1822
1886
  "data-testid": "flopay-direct-paypal-debug",
@@ -1841,17 +1905,17 @@ ${debugLines.join("\n")}`
1841
1905
  }
1842
1906
  ) : null;
1843
1907
  if (failed) {
1844
- return debug ? /* @__PURE__ */ jsx6("div", { children: debugPanel }) : null;
1908
+ return debug ? /* @__PURE__ */ jsx7("div", { children: debugPanel }) : null;
1845
1909
  }
1846
1910
  return (
1847
1911
  // Single wrapper so the parent flex container sees exactly one flex item
1848
1912
  // (otherwise the fragment's placeholder + container become two siblings
1849
1913
  // and any spacing-sensitive layout has to reason about both). The wrapper
1850
1914
  // intentionally has no margin/padding so the parent owns all spacing.
1851
- /* @__PURE__ */ jsxs3("div", { children: [
1915
+ /* @__PURE__ */ jsxs4("div", { children: [
1852
1916
  debugPanel,
1853
- /* @__PURE__ */ jsxs3("div", { style: { position: "relative", minHeight: DEFAULT_BUTTON_HEIGHT }, children: [
1854
- !ready && /* @__PURE__ */ jsx6(
1917
+ /* @__PURE__ */ jsxs4("div", { style: { position: "relative", minHeight: DEFAULT_BUTTON_HEIGHT }, children: [
1918
+ !ready && /* @__PURE__ */ jsx7(
1855
1919
  "div",
1856
1920
  {
1857
1921
  "data-testid": "flopay-direct-paypal-placeholder",
@@ -1865,7 +1929,7 @@ ${debugLines.join("\n")}`
1865
1929
  }
1866
1930
  }
1867
1931
  ),
1868
- /* @__PURE__ */ jsx6(
1932
+ /* @__PURE__ */ jsx7(
1869
1933
  "div",
1870
1934
  {
1871
1935
  ref: containerRef,
@@ -1882,7 +1946,7 @@ ${debugLines.join("\n")}`
1882
1946
  renderGeneration
1883
1947
  )
1884
1948
  ] }),
1885
- showRetryFocusTarget && /* @__PURE__ */ jsx6(
1949
+ showRetryFocusTarget && /* @__PURE__ */ jsx7(
1886
1950
  "button",
1887
1951
  {
1888
1952
  ref: focusTargetRef,
@@ -1897,15 +1961,15 @@ ${debugLines.join("\n")}`
1897
1961
  );
1898
1962
  }
1899
1963
  function DirectPayPalButton(props) {
1900
- return /* @__PURE__ */ jsx6(DirectPayPalButtonImplementation, { ...props });
1964
+ return /* @__PURE__ */ jsx7(DirectPayPalButtonImplementation, { ...props });
1901
1965
  }
1902
1966
  function InstrumentedDirectPayPalButton(props) {
1903
- return /* @__PURE__ */ jsx6(DirectPayPalButtonImplementation, { ...props });
1967
+ return /* @__PURE__ */ jsx7(DirectPayPalButtonImplementation, { ...props });
1904
1968
  }
1905
1969
 
1906
1970
  // src/split-card-form.tsx
1907
1971
  import { FloPayError as FloPayError3, isSetupIntentClientSecret as isSetupIntentClientSecret2, resolveTheme } from "@flopay/shared";
1908
- import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1972
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1909
1973
  var STRIPE_RESUME_KEY = "flopay_stripe_resume";
1910
1974
  var LEGACY_WALLET_RESUME_KEY = "flopay_wallet_resume";
1911
1975
  var PAYPAL_RESUME_KEY = "flopay_paypal_resume";
@@ -2138,7 +2202,7 @@ function normalizeBeforeButtonClickError(method, err) {
2138
2202
  );
2139
2203
  }
2140
2204
  function FloPayKeyframes() {
2141
- return /* @__PURE__ */ jsx7("style", { children: FLOPAY_KEYFRAMES });
2205
+ return /* @__PURE__ */ jsx8("style", { children: FLOPAY_KEYFRAMES });
2142
2206
  }
2143
2207
  function toCssSize(value) {
2144
2208
  if (typeof value === "number") return `${value}px`;
@@ -2160,8 +2224,8 @@ function ExpressCheckoutReadySwap({
2160
2224
  children
2161
2225
  }) {
2162
2226
  if (state === "unavailable" || state === "load_error") return null;
2163
- return /* @__PURE__ */ jsxs4("div", { style: { position: "relative", minHeight: 44 }, children: [
2164
- /* @__PURE__ */ jsx7(
2227
+ return /* @__PURE__ */ jsxs5("div", { style: { position: "relative", minHeight: 44 }, children: [
2228
+ /* @__PURE__ */ jsx8(
2165
2229
  "div",
2166
2230
  {
2167
2231
  "data-testid": placeholderTestId,
@@ -2180,7 +2244,7 @@ function ExpressCheckoutReadySwap({
2180
2244
  }
2181
2245
  }
2182
2246
  ),
2183
- /* @__PURE__ */ jsx7(
2247
+ /* @__PURE__ */ jsx8(
2184
2248
  "div",
2185
2249
  {
2186
2250
  style: {
@@ -2200,7 +2264,7 @@ function isExpressCheckoutRowVisible(state) {
2200
2264
  }
2201
2265
  var SplitCardForm = forwardRef(
2202
2266
  function SplitCardForm2(props, ref) {
2203
- return /* @__PURE__ */ jsx7(SplitCardFormInner, { ...props, innerRef: ref });
2267
+ return /* @__PURE__ */ jsx8(SplitCardFormInner, { ...props, innerRef: ref });
2204
2268
  }
2205
2269
  );
2206
2270
  function PayPalButtonInner({
@@ -2404,8 +2468,7 @@ function PayPalButtonInner({
2404
2468
  event.paymentFailed({ reason: "fail" });
2405
2469
  return;
2406
2470
  }
2407
- const intentHeaders = { "Content-Type": "application/json" };
2408
- if (effectiveNonce) intentHeaders["x-checkout-session-token"] = effectiveNonce;
2471
+ const intentHeaders = intentRequestHeaders(effectiveNonce);
2409
2472
  const intentResponse = await fetch(`${baseUrl}/v1/checkouts/payments/intents`, {
2410
2473
  method: "POST",
2411
2474
  headers: intentHeaders,
@@ -2496,14 +2559,14 @@ function PayPalButtonInner({
2496
2559
  setSubmitting(false);
2497
2560
  }
2498
2561
  }, [stripe, elements, sessionId, nonce, email, baseUrl, onTokenizedBody, onErrorChange, onDecline, runBeforeButtonClick, recoverTechnicalFailure, finishAttempt, isAttemptCurrent, isAttemptInvalidated, surfaceKey]);
2499
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
2500
- /* @__PURE__ */ jsx7(
2562
+ return /* @__PURE__ */ jsxs5(Fragment2, { children: [
2563
+ /* @__PURE__ */ jsx8(
2501
2564
  ExpressCheckoutReadySwap,
2502
2565
  {
2503
2566
  state: loadState,
2504
2567
  placeholderTestId: "flopay-paypal-placeholder",
2505
2568
  borderRadius: placeholderBorderRadius,
2506
- children: /* @__PURE__ */ jsxs4(
2569
+ children: /* @__PURE__ */ jsxs5(
2507
2570
  "div",
2508
2571
  {
2509
2572
  ref: focusTargetRef,
@@ -2512,7 +2575,7 @@ function PayPalButtonInner({
2512
2575
  "aria-label": "PayPal payment method",
2513
2576
  style: { borderRadius: 8, outlineOffset: 4 },
2514
2577
  children: [
2515
- showRecoveryAction && /* @__PURE__ */ jsx7(
2578
+ showRecoveryAction && /* @__PURE__ */ jsx8(
2516
2579
  "button",
2517
2580
  {
2518
2581
  ref: recoveryActionRef,
@@ -2523,7 +2586,7 @@ function PayPalButtonInner({
2523
2586
  children: "Try PayPal again"
2524
2587
  }
2525
2588
  ),
2526
- /* @__PURE__ */ jsx7(
2589
+ /* @__PURE__ */ jsx8(
2527
2590
  ExpressCheckoutElement,
2528
2591
  {
2529
2592
  onReady: (event) => setLoadState(resolveExpressCheckoutLoadState(event, ["paypal"])),
@@ -2563,7 +2626,7 @@ function PayPalButtonInner({
2563
2626
  )
2564
2627
  }
2565
2628
  ),
2566
- submitting && /* @__PURE__ */ jsx7(ProcessingOverlay, { status: "processing" })
2629
+ submitting && /* @__PURE__ */ jsx8(ProcessingOverlay, { status: "processing" })
2567
2630
  ] });
2568
2631
  }
2569
2632
  function WalletButtonInner({
@@ -2690,8 +2753,7 @@ function WalletButtonInner({
2690
2753
  if (!effectiveSessionId || !effectiveEmail) {
2691
2754
  throw new Error("Missing sessionId or email for wallet payment");
2692
2755
  }
2693
- const intentHeaders = { "Content-Type": "application/json" };
2694
- if (effectiveNonce) intentHeaders["x-checkout-session-token"] = effectiveNonce;
2756
+ const intentHeaders = intentRequestHeaders(effectiveNonce);
2695
2757
  const intentResponse = await fetch(`${baseUrl}/v1/checkouts/payments/intents`, {
2696
2758
  method: "POST",
2697
2759
  headers: intentHeaders,
@@ -2764,14 +2826,14 @@ function WalletButtonInner({
2764
2826
  () => expressMethods.map(stripeExpressMethodToOptionKey),
2765
2827
  [expressMethods]
2766
2828
  );
2767
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
2768
- /* @__PURE__ */ jsx7(
2829
+ return /* @__PURE__ */ jsxs5(Fragment2, { children: [
2830
+ /* @__PURE__ */ jsx8(
2769
2831
  ExpressCheckoutReadySwap,
2770
2832
  {
2771
2833
  state: loadState,
2772
2834
  placeholderTestId: "flopay-wallet-placeholder",
2773
2835
  borderRadius: placeholderBorderRadius,
2774
- children: /* @__PURE__ */ jsxs4(
2836
+ children: /* @__PURE__ */ jsxs5(
2775
2837
  "div",
2776
2838
  {
2777
2839
  ref: focusTargetRef,
@@ -2780,7 +2842,7 @@ function WalletButtonInner({
2780
2842
  "aria-label": "Wallet payment methods",
2781
2843
  style: { borderRadius: 8, outlineOffset: 4 },
2782
2844
  children: [
2783
- showRecoveryAction && /* @__PURE__ */ jsxs4(
2845
+ showRecoveryAction && /* @__PURE__ */ jsxs5(
2784
2846
  "button",
2785
2847
  {
2786
2848
  ref: recoveryActionRef,
@@ -2795,7 +2857,7 @@ function WalletButtonInner({
2795
2857
  ]
2796
2858
  }
2797
2859
  ),
2798
- /* @__PURE__ */ jsx7(
2860
+ /* @__PURE__ */ jsx8(
2799
2861
  ExpressCheckoutElement,
2800
2862
  {
2801
2863
  onReady: (event) => {
@@ -2859,7 +2921,7 @@ function WalletButtonInner({
2859
2921
  )
2860
2922
  }
2861
2923
  ),
2862
- submitting && /* @__PURE__ */ jsx7(ProcessingOverlay, { status: "processing" })
2924
+ submitting && /* @__PURE__ */ jsx8(ProcessingOverlay, { status: "processing" })
2863
2925
  ] });
2864
2926
  }
2865
2927
  function StripeMethodButton({
@@ -2877,10 +2939,11 @@ function StripeMethodButton({
2877
2939
  fontFamily
2878
2940
  }) {
2879
2941
  const brand = resolveStripeMethodBrandVariant(method, themeId);
2942
+ const vendoredLogoUrl = PAYMENT_METHOD_LOGO_URLS[method];
2880
2943
  const resolvedBackground = brand?.backgroundColor ?? backgroundColor ?? "#ffffff";
2881
2944
  const resolvedBorder = brand?.borderColor ?? borderColor ?? "#d1d5db";
2882
2945
  const resolvedTextColor = brand?.textColor ?? textColor ?? "#262833";
2883
- return /* @__PURE__ */ jsx7(
2946
+ return /* @__PURE__ */ jsx8(
2884
2947
  "button",
2885
2948
  {
2886
2949
  type: "button",
@@ -2927,9 +2990,9 @@ function StripeMethodButton({
2927
2990
  // Pulse-skeleton parity with the wallet ECE: no spinner, just the
2928
2991
  // status text on top of the pulsing background. Keeps the loading
2929
2992
  // affordance shape-equivalent across both kinds of tile.
2930
- /* @__PURE__ */ jsx7("span", { style: { margin: "0 auto" }, children: `Connecting to ${getStripeMethodDisplayName(method)}\u2026` })
2931
- ) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
2932
- /* @__PURE__ */ jsxs4(
2993
+ /* @__PURE__ */ jsx8("span", { style: { margin: "0 auto" }, children: `Connecting to ${getStripeMethodDisplayName(method)}\u2026` })
2994
+ ) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
2995
+ /* @__PURE__ */ jsxs5(
2933
2996
  "span",
2934
2997
  {
2935
2998
  style: {
@@ -2942,15 +3005,36 @@ function StripeMethodButton({
2942
3005
  gap: hasVendoredStripeMethodLogo(method) ? 8 : 0
2943
3006
  },
2944
3007
  children: [
2945
- brand?.logoSvg && /* @__PURE__ */ jsx7(
3008
+ vendoredLogoUrl ? (
3009
+ // Vendored brand logo — an <img> asset (not inline SVG) so its
3010
+ // bytes ship as a sibling file, out of the JS bundle. 3:2 box
3011
+ // matching the datatrans logos' 120×80 viewBox; each ships its own
3012
+ // white rounded-rect background so it stays legible on any tile.
3013
+ /* @__PURE__ */ jsx8(
3014
+ "img",
3015
+ {
3016
+ src: vendoredLogoUrl,
3017
+ alt: "",
3018
+ "aria-hidden": "true",
3019
+ loading: "lazy",
3020
+ decoding: "async",
3021
+ width: 30,
3022
+ height: 20,
3023
+ style: {
3024
+ width: 30,
3025
+ height: 20,
3026
+ flexShrink: 0,
3027
+ borderRadius: 3,
3028
+ objectFit: "contain",
3029
+ display: "inline-flex"
3030
+ }
3031
+ }
3032
+ )
3033
+ ) : brand?.logoSvg ? /* @__PURE__ */ jsx8(
2946
3034
  "span",
2947
3035
  {
2948
3036
  "aria-hidden": "true",
2949
3037
  style: {
2950
- // 3:2 box matching the vendored datatrans logos' 120×80
2951
- // viewBox. Each logo ships with its own white rounded-rect
2952
- // background baked in, so the mark stays legible on any
2953
- // brand-coloured tile without an extra chip wrapper here.
2954
3038
  width: 30,
2955
3039
  height: 20,
2956
3040
  flexShrink: 0,
@@ -2960,12 +3044,12 @@ function StripeMethodButton({
2960
3044
  },
2961
3045
  dangerouslySetInnerHTML: { __html: brand.logoSvg }
2962
3046
  }
2963
- ),
2964
- /* @__PURE__ */ jsx7("span", { children: getStripeMethodDisplayName(method) })
3047
+ ) : null,
3048
+ /* @__PURE__ */ jsx8("span", { children: getStripeMethodDisplayName(method) })
2965
3049
  ]
2966
3050
  }
2967
3051
  ),
2968
- hasNextStep && /* @__PURE__ */ jsx7(
3052
+ hasNextStep && /* @__PURE__ */ jsx8(
2969
3053
  "svg",
2970
3054
  {
2971
3055
  width: "14",
@@ -2985,7 +3069,7 @@ function StripeMethodButton({
2985
3069
  opacity: 0.7
2986
3070
  },
2987
3071
  "aria-hidden": "true",
2988
- children: /* @__PURE__ */ jsx7("path", { d: "M9 18l6-6-6-6" })
3072
+ children: /* @__PURE__ */ jsx8("path", { d: "M9 18l6-6-6-6" })
2989
3073
  }
2990
3074
  )
2991
3075
  ] })
@@ -3049,8 +3133,7 @@ function StripeMethodInlineForm({
3049
3133
  if (!effectiveSessionId || !effectiveEmail) {
3050
3134
  throw new Error("Missing sessionId or email for payment.");
3051
3135
  }
3052
- const intentHeaders = { "Content-Type": "application/json" };
3053
- if (effectiveNonce) intentHeaders["x-checkout-session-token"] = effectiveNonce;
3136
+ const intentHeaders = intentRequestHeaders(effectiveNonce);
3054
3137
  const intentResponse = await fetch(`${baseUrl}/v1/checkouts/payments/intents`, {
3055
3138
  method: "POST",
3056
3139
  headers: intentHeaders,
@@ -3104,9 +3187,8 @@ function StripeMethodInlineForm({
3104
3187
  onDecline?.(buildDeclineEvent("card", message, { code: confirmError.code }));
3105
3188
  return;
3106
3189
  }
3107
- const SUCCESSFUL_PI_STATUSES = /* @__PURE__ */ new Set(["succeeded", "requires_capture", "processing"]);
3108
3190
  const piStatus = paymentIntent?.status;
3109
- if (!piStatus || !SUCCESSFUL_PI_STATUSES.has(piStatus)) {
3191
+ if (!isSuccessfulPaymentIntentStatus(piStatus)) {
3110
3192
  if (typeof window !== "undefined") {
3111
3193
  try {
3112
3194
  localStorage.removeItem(STRIPE_RESUME_KEY);
@@ -3159,8 +3241,8 @@ function StripeMethodInlineForm({
3159
3241
  onDecline
3160
3242
  ]);
3161
3243
  void onCancel;
3162
- return /* @__PURE__ */ jsxs4("div", { "data-testid": `flopay-stripe-method-form-${method}`, style: { display: "flex", flexDirection: "column" }, children: [
3163
- /* @__PURE__ */ jsx7(
3244
+ return /* @__PURE__ */ jsxs5("div", { "data-testid": `flopay-stripe-method-form-${method}`, style: { display: "flex", flexDirection: "column" }, children: [
3245
+ /* @__PURE__ */ jsx8(
3164
3246
  PaymentElement2,
3165
3247
  {
3166
3248
  onReady: () => setLoadState("ready"),
@@ -3189,7 +3271,7 @@ function StripeMethodInlineForm({
3189
3271
  }
3190
3272
  }
3191
3273
  ),
3192
- /* @__PURE__ */ jsx7(
3274
+ /* @__PURE__ */ jsx8(
3193
3275
  "button",
3194
3276
  {
3195
3277
  type: "button",
@@ -3216,22 +3298,7 @@ function StripeMethodInlineForm({
3216
3298
  children: submitting ? "Processing\u2026" : `Pay with ${getStripeMethodDisplayName(method)}`
3217
3299
  }
3218
3300
  ),
3219
- errorText && /* @__PURE__ */ jsxs4("div", { role: "alert", "data-testid": "flopay-error", style: {
3220
- margin: "0.75rem 0 0",
3221
- padding: "0.625rem 0.875rem",
3222
- background: "#FEF2F2",
3223
- border: "1px solid #FECACA",
3224
- borderRadius: "8px",
3225
- color: "#991B1B",
3226
- fontSize: "0.85rem",
3227
- fontWeight: 600,
3228
- display: "flex",
3229
- alignItems: "center",
3230
- gap: "0.5rem"
3231
- }, children: [
3232
- /* @__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" }) }),
3233
- errorText
3234
- ] })
3301
+ errorText && /* @__PURE__ */ jsx8(ErrorBanner, { margin: "0.75rem 0 0", children: errorText })
3235
3302
  ] });
3236
3303
  }
3237
3304
  function StripePaymentElementInner({
@@ -3289,8 +3356,7 @@ function StripePaymentElementInner({
3289
3356
  if (!effectiveSessionId || !effectiveEmail) {
3290
3357
  throw new Error("Missing sessionId or email for payment.");
3291
3358
  }
3292
- const intentHeaders = { "Content-Type": "application/json" };
3293
- if (effectiveNonce) intentHeaders["x-checkout-session-token"] = effectiveNonce;
3359
+ const intentHeaders = intentRequestHeaders(effectiveNonce);
3294
3360
  const intentResponse = await fetch(`${baseUrl}/v1/checkouts/payments/intents`, {
3295
3361
  method: "POST",
3296
3362
  headers: intentHeaders,
@@ -3356,9 +3422,8 @@ function StripePaymentElementInner({
3356
3422
  onDecline?.(buildDeclineEvent("card", message, { code: confirmError.code }));
3357
3423
  return;
3358
3424
  }
3359
- const SUCCESSFUL_PI_STATUSES = /* @__PURE__ */ new Set(["succeeded", "requires_capture", "processing"]);
3360
3425
  const piStatus = paymentIntent?.status;
3361
- if (!piStatus || !SUCCESSFUL_PI_STATUSES.has(piStatus)) {
3426
+ if (!isSuccessfulPaymentIntentStatus(piStatus)) {
3362
3427
  if (typeof window !== "undefined") {
3363
3428
  try {
3364
3429
  localStorage.removeItem(STRIPE_RESUME_KEY);
@@ -3430,7 +3495,7 @@ function StripePaymentElementInner({
3430
3495
  paymentMethodTypes: [localExpandedMethod]
3431
3496
  };
3432
3497
  }, [localExpandedMethod, paymentElementBaseOptions]);
3433
- return /* @__PURE__ */ jsx7(
3498
+ return /* @__PURE__ */ jsx8(
3434
3499
  "div",
3435
3500
  {
3436
3501
  "data-testid": "flopay-stripe-payment-element-region",
@@ -3439,8 +3504,8 @@ function StripePaymentElementInner({
3439
3504
  const isExpanded = expandedApmMethod === method;
3440
3505
  const isSubmittingThis = submittingMethod === method;
3441
3506
  const otherInProgress = submittingMethod !== null && submittingMethod !== method || expandedApmMethod !== null && expandedApmMethod !== void 0 && expandedApmMethod !== method;
3442
- return /* @__PURE__ */ jsxs4(React7.Fragment, { children: [
3443
- /* @__PURE__ */ jsx7(
3507
+ return /* @__PURE__ */ jsxs5(React8.Fragment, { children: [
3508
+ /* @__PURE__ */ jsx8(
3444
3509
  StripeMethodButton,
3445
3510
  {
3446
3511
  method,
@@ -3457,12 +3522,12 @@ function StripePaymentElementInner({
3457
3522
  fontFamily: buttonAppearance?.fontFamily
3458
3523
  }
3459
3524
  ),
3460
- !onExpandApm && localExpandedMethod === method && localInlineElementsOptions && stripeInstance && /* @__PURE__ */ jsx7(
3525
+ !onExpandApm && localExpandedMethod === method && localInlineElementsOptions && stripeInstance && /* @__PURE__ */ jsx8(
3461
3526
  StripeElements,
3462
3527
  {
3463
3528
  stripe: stripeInstance,
3464
3529
  options: localInlineElementsOptions,
3465
- children: /* @__PURE__ */ jsx7(
3530
+ children: /* @__PURE__ */ jsx8(
3466
3531
  StripeMethodInlineForm,
3467
3532
  {
3468
3533
  method,
@@ -4430,7 +4495,7 @@ function SplitCardFormInner({
4430
4495
  return;
4431
4496
  }
4432
4497
  const piStatus = paymentIntent?.status;
4433
- const successful = piStatus === "succeeded" || piStatus === "requires_capture" || piStatus === "processing";
4498
+ const successful = isSuccessfulPaymentIntentStatus(piStatus);
4434
4499
  if (!paymentIntent || !successful) {
4435
4500
  const message = piStatus === "canceled" ? "Payment was canceled." : "Payment was not completed. Please try again.";
4436
4501
  updateError(message);
@@ -4530,8 +4595,7 @@ function SplitCardFormInner({
4530
4595
  updateError(pmResult.error?.message ?? "Failed to create payment method.");
4531
4596
  return;
4532
4597
  }
4533
- const intentHeaders = { "Content-Type": "application/json" };
4534
- if (nonce) intentHeaders["x-checkout-session-token"] = nonce;
4598
+ const intentHeaders = intentRequestHeaders(nonce);
4535
4599
  const intentResponse = await fetch(`${baseUrl}/v1/checkouts/payments/intents`, {
4536
4600
  method: "POST",
4537
4601
  headers: intentHeaders,
@@ -4607,7 +4671,7 @@ function SplitCardFormInner({
4607
4671
  );
4608
4672
  const isReady = flopay !== null && (vaultActive || elements !== null);
4609
4673
  if (!isReady) {
4610
- return /* @__PURE__ */ jsx7("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." });
4674
+ return /* @__PURE__ */ jsx8("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." });
4611
4675
  }
4612
4676
  const isButtons = layout === "buttons";
4613
4677
  const appearanceVars = appearance?.variables;
@@ -4666,7 +4730,7 @@ function SplitCardFormInner({
4666
4730
  const containerOverrides = bStyles.cardFormContainer ?? {};
4667
4731
  const containerPadding = containerOverrides.padding ?? (isButtons ? "0" : "1rem");
4668
4732
  const containerRadius = containerOverrides.borderRadius ?? resolvedBorderRadius;
4669
- const vaultCardFieldsNode = cardCapture && vaultMount ? /* @__PURE__ */ jsx7(
4733
+ const vaultCardFieldsNode = cardCapture && vaultMount ? /* @__PURE__ */ jsx8(
4670
4734
  VaultCardFields,
4671
4735
  {
4672
4736
  capture: cardCapture,
@@ -4704,7 +4768,7 @@ function SplitCardFormInner({
4704
4768
  if (message) setOverlayStatus(null);
4705
4769
  }
4706
4770
  }
4707
- ) : /* @__PURE__ */ jsx7(
4771
+ ) : /* @__PURE__ */ jsx8(
4708
4772
  "div",
4709
4773
  {
4710
4774
  "data-testid": "flopay-vault-loading",
@@ -4719,7 +4783,7 @@ function SplitCardFormInner({
4719
4783
  children: "Loading secure card form\u2026"
4720
4784
  }
4721
4785
  );
4722
- const cardFormBlock = /* @__PURE__ */ jsxs4("div", { style: {
4786
+ const cardFormBlock = /* @__PURE__ */ jsxs5("div", { style: {
4723
4787
  backgroundColor: cardBg,
4724
4788
  borderRadius: containerRadius,
4725
4789
  ...containerOverrides,
@@ -4732,7 +4796,7 @@ function SplitCardFormInner({
4732
4796
  display: "flex",
4733
4797
  flexDirection: "column"
4734
4798
  }, children: [
4735
- /* @__PURE__ */ jsx7("style", { children: `
4799
+ /* @__PURE__ */ jsx8("style", { children: `
4736
4800
  .flopay-shared-input::placeholder {
4737
4801
  color: var(--flopay-input-placeholder-color);
4738
4802
  opacity: 1;
@@ -4741,14 +4805,14 @@ function SplitCardFormInner({
4741
4805
  font-weight: var(--flopay-input-font-weight);
4742
4806
  }
4743
4807
  ` }),
4744
- isButtons && showCardForm && /* @__PURE__ */ jsxs4("div", { style: {
4808
+ isButtons && showCardForm && /* @__PURE__ */ jsxs5("div", { style: {
4745
4809
  display: "flex",
4746
4810
  alignItems: "center",
4747
4811
  padding: "0.75rem 0 0.625rem",
4748
4812
  // Keep the header on top when AVS is ordered above the card on vault.
4749
4813
  order: vaultActive ? -2 : 0
4750
4814
  }, children: [
4751
- /* @__PURE__ */ jsxs4(
4815
+ /* @__PURE__ */ jsxs5(
4752
4816
  "button",
4753
4817
  {
4754
4818
  type: "button",
@@ -4770,7 +4834,7 @@ function SplitCardFormInner({
4770
4834
  },
4771
4835
  "aria-label": "Back to payment methods",
4772
4836
  children: [
4773
- /* @__PURE__ */ jsx7("span", { style: {
4837
+ /* @__PURE__ */ jsx8("span", { style: {
4774
4838
  display: "inline-flex",
4775
4839
  alignItems: "center",
4776
4840
  justifyContent: "center",
@@ -4780,12 +4844,12 @@ function SplitCardFormInner({
4780
4844
  backgroundColor: "#f3f4f6",
4781
4845
  transition: "background-color 0.15s",
4782
4846
  ...bStyles.backButtonIcon
4783
- }, 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" }) }) }),
4784
- /* @__PURE__ */ jsx7(BackButtonContentSlot, { content: cardBackButtonContent })
4847
+ }, children: /* @__PURE__ */ jsx8("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx8("path", { d: "M15 18l-6-6 6-6" }) }) }),
4848
+ /* @__PURE__ */ jsx8(BackButtonContentSlot, { content: cardBackButtonContent })
4785
4849
  ]
4786
4850
  }
4787
4851
  ),
4788
- hideTitle ? /* @__PURE__ */ jsx7("div", { style: { flex: 1 } }) : /* @__PURE__ */ jsx7("div", { style: {
4852
+ hideTitle ? /* @__PURE__ */ jsx8("div", { style: { flex: 1 } }) : /* @__PURE__ */ jsx8("div", { style: {
4789
4853
  flex: 1,
4790
4854
  textAlign: "center",
4791
4855
  fontWeight: 600,
@@ -4793,9 +4857,9 @@ function SplitCardFormInner({
4793
4857
  color: "#262833",
4794
4858
  paddingRight: 80,
4795
4859
  ...bStyles.title
4796
- }, children: /* @__PURE__ */ jsx7(TitleContentSlot, { content: cardTitleContent }) })
4860
+ }, children: /* @__PURE__ */ jsx8(TitleContentSlot, { content: cardTitleContent }) })
4797
4861
  ] }),
4798
- !isButtons && !hideTitle && /* @__PURE__ */ jsx7("div", { style: {
4862
+ !isButtons && !hideTitle && /* @__PURE__ */ jsx8("div", { style: {
4799
4863
  textAlign: "center",
4800
4864
  fontWeight: 600,
4801
4865
  fontSize: "1.1rem",
@@ -4805,17 +4869,17 @@ function SplitCardFormInner({
4805
4869
  // (-2) and AVS block (-1) are ordered below it but above the card form.
4806
4870
  order: vaultActive ? -3 : 0,
4807
4871
  ...bStyles.title
4808
- }, children: /* @__PURE__ */ jsx7(TitleContentSlot, { content: cardTitleContent }) }),
4809
- !vaultActive && /* @__PURE__ */ jsxs4(Fragment2, { children: [
4810
- /* @__PURE__ */ jsx7("div", { style: {
4872
+ }, children: /* @__PURE__ */ jsx8(TitleContentSlot, { content: cardTitleContent }) }),
4873
+ !vaultActive && /* @__PURE__ */ jsxs5(Fragment2, { children: [
4874
+ /* @__PURE__ */ jsx8("div", { style: {
4811
4875
  backgroundColor: cardInputBg,
4812
4876
  border: `1px solid ${resolvedBorder}`,
4813
4877
  borderTopLeftRadius: resolvedBorderRadius,
4814
4878
  borderTopRightRadius: resolvedBorderRadius,
4815
4879
  padding: "10px"
4816
- }, children: /* @__PURE__ */ jsx7(CardNumberElement, { onReady: () => setFormReady(true), options: stripeElementStyle }) }),
4817
- /* @__PURE__ */ jsxs4("div", { style: { display: "flex" }, children: [
4818
- /* @__PURE__ */ jsx7("div", { style: {
4880
+ }, children: /* @__PURE__ */ jsx8(CardNumberElement, { onReady: () => setFormReady(true), options: stripeElementStyle }) }),
4881
+ /* @__PURE__ */ jsxs5("div", { style: { display: "flex" }, children: [
4882
+ /* @__PURE__ */ jsx8("div", { style: {
4819
4883
  flex: 1,
4820
4884
  backgroundColor: cardInputBg,
4821
4885
  // Longhand only — mixing `border` shorthand with per-side
@@ -4827,8 +4891,8 @@ function SplitCardFormInner({
4827
4891
  borderLeft: `1px solid ${resolvedBorder}`,
4828
4892
  borderBottomLeftRadius: resolvedBorderRadius,
4829
4893
  padding: "10px"
4830
- }, children: /* @__PURE__ */ jsx7(CardExpiryElement, { options: stripeElementStyle }) }),
4831
- /* @__PURE__ */ jsx7("div", { style: {
4894
+ }, children: /* @__PURE__ */ jsx8(CardExpiryElement, { options: stripeElementStyle }) }),
4895
+ /* @__PURE__ */ jsx8("div", { style: {
4832
4896
  flex: 1,
4833
4897
  backgroundColor: cardInputBg,
4834
4898
  borderTop: "none",
@@ -4837,16 +4901,16 @@ function SplitCardFormInner({
4837
4901
  borderLeft: `1px solid ${resolvedBorder}`,
4838
4902
  borderBottomRightRadius: resolvedBorderRadius,
4839
4903
  padding: "10px"
4840
- }, children: /* @__PURE__ */ jsx7(CardCvcElement, { options: stripeElementStyle }) })
4904
+ }, children: /* @__PURE__ */ jsx8(CardCvcElement, { options: stripeElementStyle }) })
4841
4905
  ] })
4842
4906
  ] }),
4843
- !vaultActive && /* @__PURE__ */ jsx7("div", { style: {
4907
+ !vaultActive && /* @__PURE__ */ jsx8("div", { style: {
4844
4908
  backgroundColor: cardInputBg,
4845
4909
  border: `1px solid ${resolvedBorder}`,
4846
4910
  borderRadius: resolvedBorderRadius,
4847
4911
  marginTop: "0.5rem",
4848
4912
  padding: "10px"
4849
- }, children: /* @__PURE__ */ jsx7(
4913
+ }, children: /* @__PURE__ */ jsx8(
4850
4914
  "input",
4851
4915
  {
4852
4916
  className: "flopay-shared-input",
@@ -4868,7 +4932,7 @@ function SplitCardFormInner({
4868
4932
  }
4869
4933
  }
4870
4934
  ) }),
4871
- avsConfig && /* @__PURE__ */ jsx7("div", { style: { order: vaultActive ? -1 : 0 }, "data-testid": "flopay-avs-fields", children: (() => {
4935
+ avsConfig && /* @__PURE__ */ jsx8("div", { style: { order: vaultActive ? -1 : 0 }, "data-testid": "flopay-avs-fields", children: (() => {
4872
4936
  const cc = selectedCountry;
4873
4937
  const inputWrapStyle = (invalid = false) => ({
4874
4938
  backgroundColor: cardInputBg,
@@ -4885,8 +4949,8 @@ function SplitCardFormInner({
4885
4949
  ...sharedInputTypography
4886
4950
  });
4887
4951
  const stateOpts = getStateOptions(cc);
4888
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
4889
- isAVSFieldVisible(avsConfig.address_line_1, cc) && /* @__PURE__ */ jsx7("div", { style: inputWrapStyle(invalidAvsFields.line1), children: /* @__PURE__ */ jsx7(
4952
+ return /* @__PURE__ */ jsxs5(Fragment2, { children: [
4953
+ isAVSFieldVisible(avsConfig.address_line_1, cc) && /* @__PURE__ */ jsx8("div", { style: inputWrapStyle(invalidAvsFields.line1), children: /* @__PURE__ */ jsx8(
4890
4954
  "input",
4891
4955
  {
4892
4956
  className: "flopay-shared-input",
@@ -4905,7 +4969,7 @@ function SplitCardFormInner({
4905
4969
  style: inputFieldStyle()
4906
4970
  }
4907
4971
  ) }),
4908
- isAVSFieldVisible(avsConfig.address_line_2, cc) && /* @__PURE__ */ jsx7("div", { style: inputWrapStyle(), children: /* @__PURE__ */ jsx7(
4972
+ isAVSFieldVisible(avsConfig.address_line_2, cc) && /* @__PURE__ */ jsx8("div", { style: inputWrapStyle(), children: /* @__PURE__ */ jsx8(
4909
4973
  "input",
4910
4974
  {
4911
4975
  className: "flopay-shared-input",
@@ -4923,12 +4987,12 @@ function SplitCardFormInner({
4923
4987
  style: inputFieldStyle()
4924
4988
  }
4925
4989
  ) }),
4926
- (isAVSFieldVisible(avsConfig.city, cc) || isAVSFieldVisible(avsConfig.state, cc)) && /* @__PURE__ */ jsxs4("div", { style: {
4990
+ (isAVSFieldVisible(avsConfig.city, cc) || isAVSFieldVisible(avsConfig.state, cc)) && /* @__PURE__ */ jsxs5("div", { style: {
4927
4991
  display: "flex",
4928
4992
  gap: "0",
4929
4993
  marginTop: "0.5rem"
4930
4994
  }, children: [
4931
- isAVSFieldVisible(avsConfig.city, cc) && /* @__PURE__ */ jsx7("div", { style: {
4995
+ isAVSFieldVisible(avsConfig.city, cc) && /* @__PURE__ */ jsx8("div", { style: {
4932
4996
  flex: 1,
4933
4997
  backgroundColor: cardInputBg,
4934
4998
  borderTop: `1px solid ${avsBorderColor(invalidAvsFields.city)}`,
@@ -4939,7 +5003,7 @@ function SplitCardFormInner({
4939
5003
  borderTopLeftRadius: resolvedBorderRadius,
4940
5004
  borderBottomLeftRadius: resolvedBorderRadius,
4941
5005
  ...isAVSFieldVisible(avsConfig.state, cc) ? { borderRight: "none", borderTopRightRadius: 0, borderBottomRightRadius: 0 } : { borderRadius: resolvedBorderRadius }
4942
- }, children: /* @__PURE__ */ jsx7(
5006
+ }, children: /* @__PURE__ */ jsx8(
4943
5007
  "input",
4944
5008
  {
4945
5009
  className: "flopay-shared-input",
@@ -4958,7 +5022,7 @@ function SplitCardFormInner({
4958
5022
  style: inputFieldStyle()
4959
5023
  }
4960
5024
  ) }),
4961
- isAVSFieldVisible(avsConfig.state, cc) && /* @__PURE__ */ jsx7("div", { style: {
5025
+ isAVSFieldVisible(avsConfig.state, cc) && /* @__PURE__ */ jsx8("div", { style: {
4962
5026
  flex: 1,
4963
5027
  backgroundColor: cardInputBg,
4964
5028
  border: `1px solid ${avsBorderColor(invalidAvsFields.state)}`,
@@ -4966,7 +5030,7 @@ function SplitCardFormInner({
4966
5030
  borderTopRightRadius: resolvedBorderRadius,
4967
5031
  borderBottomRightRadius: resolvedBorderRadius,
4968
5032
  ...isAVSFieldVisible(avsConfig.city, cc) ? { borderTopLeftRadius: 0, borderBottomLeftRadius: 0 } : { borderRadius: resolvedBorderRadius }
4969
- }, children: stateOpts ? /* @__PURE__ */ jsxs4(
5033
+ }, children: stateOpts ? /* @__PURE__ */ jsxs5(
4970
5034
  "select",
4971
5035
  {
4972
5036
  id: "flopay-billing-state",
@@ -4982,11 +5046,11 @@ function SplitCardFormInner({
4982
5046
  "data-testid": "flopay-state",
4983
5047
  style: { ...inputFieldStyle(), cursor: "pointer" },
4984
5048
  children: [
4985
- /* @__PURE__ */ jsx7("option", { value: "", children: getStateLabel(cc) }),
4986
- stateOpts.map((s) => /* @__PURE__ */ jsx7("option", { value: s.code, children: s.name }, s.code))
5049
+ /* @__PURE__ */ jsx8("option", { value: "", children: getStateLabel(cc) }),
5050
+ stateOpts.map((s) => /* @__PURE__ */ jsx8("option", { value: s.code, children: s.name }, s.code))
4987
5051
  ]
4988
5052
  }
4989
- ) : /* @__PURE__ */ jsx7(
5053
+ ) : /* @__PURE__ */ jsx8(
4990
5054
  "input",
4991
5055
  {
4992
5056
  className: "flopay-shared-input",
@@ -5006,13 +5070,13 @@ function SplitCardFormInner({
5006
5070
  }
5007
5071
  ) })
5008
5072
  ] }),
5009
- (isAVSFieldVisible(avsConfig.country, cc) || isAVSFieldVisible(avsConfig.postal_code, cc)) && /* @__PURE__ */ jsxs4("div", { style: {
5073
+ (isAVSFieldVisible(avsConfig.country, cc) || isAVSFieldVisible(avsConfig.postal_code, cc)) && /* @__PURE__ */ jsxs5("div", { style: {
5010
5074
  display: "flex",
5011
5075
  flexDirection: avsLayoutProp === "column" ? "column" : "row",
5012
5076
  gap: avsLayoutProp === "column" ? "0.5rem" : "0",
5013
5077
  marginTop: "0.5rem"
5014
5078
  }, children: [
5015
- isAVSFieldVisible(avsConfig.country, cc) && /* @__PURE__ */ jsx7("div", { style: {
5079
+ isAVSFieldVisible(avsConfig.country, cc) && /* @__PURE__ */ jsx8("div", { style: {
5016
5080
  flex: avsLayoutProp === "row" ? 1 : void 0,
5017
5081
  backgroundColor: cardInputBg,
5018
5082
  borderTop: `1px solid ${resolvedBorder}`,
@@ -5021,7 +5085,7 @@ function SplitCardFormInner({
5021
5085
  borderLeft: `1px solid ${resolvedBorder}`,
5022
5086
  padding: "10px",
5023
5087
  ...avsLayoutProp === "row" && isAVSFieldVisible(avsConfig.postal_code, cc) ? { borderRadius: "0", borderTopLeftRadius: resolvedBorderRadius, borderBottomLeftRadius: resolvedBorderRadius, borderRight: "none" } : { borderRadius: resolvedBorderRadius }
5024
- }, children: /* @__PURE__ */ jsx7(
5088
+ }, children: /* @__PURE__ */ jsx8(
5025
5089
  "select",
5026
5090
  {
5027
5091
  id: "flopay-billing-country",
@@ -5038,20 +5102,20 @@ function SplitCardFormInner({
5038
5102
  autoComplete: "billing country",
5039
5103
  "data-testid": "flopay-country",
5040
5104
  style: { ...inputFieldStyle(), cursor: "pointer" },
5041
- children: COUNTRY_OPTIONS.map((c) => /* @__PURE__ */ jsxs4("option", { value: c.code, children: [
5105
+ children: COUNTRY_OPTIONS.map((c) => /* @__PURE__ */ jsxs5("option", { value: c.code, children: [
5042
5106
  c.flag,
5043
5107
  " ",
5044
5108
  c.name
5045
5109
  ] }, c.code))
5046
5110
  }
5047
5111
  ) }),
5048
- isAVSFieldVisible(avsConfig.postal_code, cc) && /* @__PURE__ */ jsx7("div", { style: {
5112
+ isAVSFieldVisible(avsConfig.postal_code, cc) && /* @__PURE__ */ jsx8("div", { style: {
5049
5113
  flex: avsLayoutProp === "row" ? 1 : void 0,
5050
5114
  backgroundColor: cardInputBg,
5051
5115
  border: `1px solid ${zipBorderColor}`,
5052
5116
  padding: "10px",
5053
5117
  ...avsLayoutProp === "row" && isAVSFieldVisible(avsConfig.country, cc) ? { borderRadius: "0", borderTopRightRadius: resolvedBorderRadius, borderBottomRightRadius: resolvedBorderRadius } : { borderRadius: resolvedBorderRadius }
5054
- }, children: /* @__PURE__ */ jsx7(
5118
+ }, children: /* @__PURE__ */ jsx8(
5055
5119
  "input",
5056
5120
  {
5057
5121
  className: "flopay-shared-input",
@@ -5075,7 +5139,7 @@ function SplitCardFormInner({
5075
5139
  }
5076
5140
  ) })
5077
5141
  ] }),
5078
- showPostcodeError && /* @__PURE__ */ jsx7(
5142
+ showPostcodeError && /* @__PURE__ */ jsx8(
5079
5143
  "div",
5080
5144
  {
5081
5145
  id: "flopay-billing-postal-code-error",
@@ -5092,26 +5156,10 @@ function SplitCardFormInner({
5092
5156
  )
5093
5157
  ] });
5094
5158
  })() }),
5095
- vaultActive && cardPreFormSlot && /* @__PURE__ */ jsx7("div", { style: { order: -2, width: "100%" }, children: cardPreFormSlot }),
5159
+ vaultActive && cardPreFormSlot && /* @__PURE__ */ jsx8("div", { style: { order: -2, width: "100%" }, children: cardPreFormSlot }),
5096
5160
  vaultActive && vaultCardFieldsNode,
5097
- displayError && /* @__PURE__ */ jsxs4("div", { role: "alert", "data-testid": "flopay-error", style: {
5098
- margin: "0.75rem 0",
5099
- padding: "0.625rem 0.875rem",
5100
- background: "#FEF2F2",
5101
- border: "1px solid #FECACA",
5102
- borderRadius: "8px",
5103
- color: "#991B1B",
5104
- fontSize: "0.85rem",
5105
- fontWeight: 600,
5106
- display: "flex",
5107
- alignItems: "center",
5108
- gap: "0.5rem",
5109
- ...bStyles.errorBanner ? bStyles.errorBanner : {}
5110
- }, children: [
5111
- /* @__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" }) }),
5112
- displayError
5113
- ] }),
5114
- !vaultActive && (children ?? /* @__PURE__ */ jsx7(
5161
+ displayError && /* @__PURE__ */ jsx8(ErrorBanner, { margin: "0.75rem 0", styleOverride: bStyles.errorBanner, children: displayError }),
5162
+ !vaultActive && (children ?? /* @__PURE__ */ jsx8(
5115
5163
  "button",
5116
5164
  {
5117
5165
  type: "submit",
@@ -5156,9 +5204,9 @@ function SplitCardFormInner({
5156
5204
  const renderDirectPaypalGateDebug = (testId) => {
5157
5205
  if (!debug) return null;
5158
5206
  if (!showPayPal || !directPaypalConfigured) {
5159
- return /* @__PURE__ */ jsx7("pre", { "data-testid": testId, style: gateDebugStyle, children: "FloPay/DirectPayPal-debug - not enabled" });
5207
+ return /* @__PURE__ */ jsx8("pre", { "data-testid": testId, style: gateDebugStyle, children: "FloPay/DirectPayPal-debug - not enabled" });
5160
5208
  }
5161
- return /* @__PURE__ */ jsx7("pre", { "data-testid": testId, style: gateDebugStyle, children: [
5209
+ return /* @__PURE__ */ jsx8("pre", { "data-testid": testId, style: gateDebugStyle, children: [
5162
5210
  "FloPay/DirectPayPal-debug (parent gate)",
5163
5211
  ` showPayPal=${showPayPal}`,
5164
5212
  ` directPaypalConfigured=${directPaypalConfigured}`,
@@ -5171,9 +5219,9 @@ function SplitCardFormInner({
5171
5219
  const renderStripeGateDebug = (testId) => {
5172
5220
  if (!debug) return null;
5173
5221
  if (!showStripe || !stripeInstance) {
5174
- return /* @__PURE__ */ jsx7("pre", { "data-testid": testId, style: gateDebugStyle, children: "FloPay/Stripe-debug - not enabled" });
5222
+ return /* @__PURE__ */ jsx8("pre", { "data-testid": testId, style: gateDebugStyle, children: "FloPay/Stripe-debug - not enabled" });
5175
5223
  }
5176
- return /* @__PURE__ */ jsx7("pre", { "data-testid": testId, style: gateDebugStyle, children: [
5224
+ return /* @__PURE__ */ jsx8("pre", { "data-testid": testId, style: gateDebugStyle, children: [
5177
5225
  "FloPay/Stripe-debug (parent gate)",
5178
5226
  ` showStripe=${showStripe}`,
5179
5227
  ` currency=${currency}`,
@@ -5202,11 +5250,11 @@ function SplitCardFormInner({
5202
5250
  const cardButtonSizing = cardButtonContent === void 0 ? { boxSizing: "border-box", height: DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT, padding: "0 1rem" } : { padding: "0.9rem 1rem" };
5203
5251
  const buttonsAnim = viewState === "expanding" || viewState === "apm-expanding" ? `flopay-buttons-exit ${TRANSITION_MS}ms cubic-bezier(0.4, 0, 0.2, 1) both` : viewState === "collapsing" || viewState === "apm-collapsing" ? `flopay-buttons-enter ${TRANSITION_MS}ms cubic-bezier(0, 0, 0.2, 1) both` : void 0;
5204
5252
  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;
5205
- return /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
5206
- /* @__PURE__ */ jsx7(FloPayKeyframes, {}),
5207
- overlayStatus && /* @__PURE__ */ jsx7(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
5208
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid" }, children: [
5209
- /* @__PURE__ */ jsxs4(
5253
+ return /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
5254
+ /* @__PURE__ */ jsx8(FloPayKeyframes, {}),
5255
+ overlayStatus && /* @__PURE__ */ jsx8(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
5256
+ /* @__PURE__ */ jsxs5("div", { style: { display: "grid" }, children: [
5257
+ /* @__PURE__ */ jsxs5(
5210
5258
  "div",
5211
5259
  {
5212
5260
  "data-testid": "flopay-buttons-panel",
@@ -5223,8 +5271,8 @@ function SplitCardFormInner({
5223
5271
  children: [
5224
5272
  renderDirectPaypalGateDebug("flopay-direct-paypal-gate-debug"),
5225
5273
  renderStripeGateDebug("flopay-stripe-gate-debug"),
5226
- shouldRenderDirectPayPal && directPaypal && /* @__PURE__ */ jsxs4(Fragment2, { children: [
5227
- paypalDirectRetry && /* @__PURE__ */ jsx7(
5274
+ shouldRenderDirectPayPal && directPaypal && /* @__PURE__ */ jsxs5(Fragment2, { children: [
5275
+ paypalDirectRetry && /* @__PURE__ */ jsx8(
5228
5276
  "div",
5229
5277
  {
5230
5278
  "data-testid": "flopay-paypal-direct-retry-notice",
@@ -5240,7 +5288,7 @@ function SplitCardFormInner({
5240
5288
  children: "Please confirm your PayPal payment to complete checkout."
5241
5289
  }
5242
5290
  ),
5243
- /* @__PURE__ */ jsx7(
5291
+ /* @__PURE__ */ jsx8(
5244
5292
  DirectPayPalButton,
5245
5293
  {
5246
5294
  sessionId,
@@ -5267,7 +5315,7 @@ function SplitCardFormInner({
5267
5315
  paypalDirectRetry?.orderId ?? "fresh"
5268
5316
  )
5269
5317
  ] }),
5270
- shouldRenderStripePayPal && /* @__PURE__ */ jsx7(StripeElements, { stripe: paypalStripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx7(
5318
+ shouldRenderStripePayPal && /* @__PURE__ */ jsx8(StripeElements, { stripe: paypalStripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx8(
5271
5319
  PayPalButtonInner,
5272
5320
  {
5273
5321
  sessionId,
@@ -5285,7 +5333,7 @@ function SplitCardFormInner({
5285
5333
  placeholderBorderRadius: buttonBorderRadius
5286
5334
  }
5287
5335
  ) }),
5288
- shouldRenderWallets ? /* @__PURE__ */ jsx7(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx7(
5336
+ shouldRenderWallets ? /* @__PURE__ */ jsx8(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx8(
5289
5337
  WalletButtonInner,
5290
5338
  {
5291
5339
  sessionId,
@@ -5302,8 +5350,8 @@ function SplitCardFormInner({
5302
5350
  onLoadStateChange: setWalletLoadState,
5303
5351
  placeholderBorderRadius: buttonBorderRadius
5304
5352
  }
5305
- ) }) : shouldShowWallets ? /* @__PURE__ */ jsx7("div", { style: { height: DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT, borderRadius: buttonBorderRadius, background: "#e5e7eb", animation: "flopay-pulse 1.5s ease-in-out infinite" } }) : null,
5306
- shouldRenderPaymentElement && /* @__PURE__ */ jsx7(
5353
+ ) }) : shouldShowWallets ? /* @__PURE__ */ jsx8("div", { style: { height: DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT, borderRadius: buttonBorderRadius, background: "#e5e7eb", animation: "flopay-pulse 1.5s ease-in-out infinite" } }) : null,
5354
+ shouldRenderPaymentElement && /* @__PURE__ */ jsx8(
5307
5355
  StripePaymentElementInner,
5308
5356
  {
5309
5357
  sessionId,
@@ -5335,7 +5383,7 @@ function SplitCardFormInner({
5335
5383
  }
5336
5384
  }
5337
5385
  ),
5338
- showStripe && /* @__PURE__ */ jsx7(
5386
+ showStripe && /* @__PURE__ */ jsx8(
5339
5387
  "button",
5340
5388
  {
5341
5389
  type: "button",
@@ -5391,50 +5439,34 @@ function SplitCardFormInner({
5391
5439
  onMouseUp: (e) => {
5392
5440
  e.currentTarget.style.transform = "scale(1)";
5393
5441
  },
5394
- children: /* @__PURE__ */ jsx7(CardButtonContentSlot, { content: cardButtonContent })
5442
+ children: /* @__PURE__ */ jsx8(CardButtonContentSlot, { content: cardButtonContent })
5395
5443
  }
5396
5444
  ),
5397
- displayError && viewState === "buttons" && /* @__PURE__ */ jsxs4("div", { role: "alert", "data-testid": "flopay-error", style: {
5398
- margin: "0.25rem 0",
5399
- padding: "0.625rem 0.875rem",
5400
- background: "#FEF2F2",
5401
- border: "1px solid #FECACA",
5402
- borderRadius: "8px",
5403
- color: "#991B1B",
5404
- fontSize: "0.85rem",
5405
- fontWeight: 600,
5406
- display: "flex",
5407
- alignItems: "center",
5408
- gap: "0.5rem",
5409
- ...bStyles.errorBanner ? bStyles.errorBanner : {}
5410
- }, children: [
5411
- /* @__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" }) }),
5412
- displayError
5413
- ] })
5445
+ displayError && viewState === "buttons" && /* @__PURE__ */ jsx8(ErrorBanner, { margin: "0.25rem 0", styleOverride: bStyles.errorBanner, children: displayError })
5414
5446
  ]
5415
5447
  }
5416
5448
  ),
5417
- showStripe && isCardView && /* @__PURE__ */ jsx7("div", { style: {
5449
+ showStripe && isCardView && /* @__PURE__ */ jsx8("div", { style: {
5418
5450
  gridArea: "1 / 1",
5419
5451
  ...cardAnim ? { animation: cardAnim } : {},
5420
5452
  ...viewState === "collapsing" ? { pointerEvents: "none" } : {}
5421
5453
  }, children: cardFormBlock }),
5422
- showStripe && isApmView && expandedApmMethod && apmInlineOptions && stripeInstance && /* @__PURE__ */ jsx7("div", { style: {
5454
+ showStripe && isApmView && expandedApmMethod && apmInlineOptions && stripeInstance && /* @__PURE__ */ jsx8("div", { style: {
5423
5455
  gridArea: "1 / 1",
5424
5456
  ...apmAnim ? { animation: apmAnim } : {},
5425
5457
  ...viewState === "apm-collapsing" ? { pointerEvents: "none" } : {}
5426
- }, children: /* @__PURE__ */ jsxs4("div", { style: {
5458
+ }, children: /* @__PURE__ */ jsxs5("div", { style: {
5427
5459
  backgroundColor: cardBg,
5428
5460
  borderRadius: containerRadius,
5429
5461
  ...containerOverrides,
5430
5462
  padding: containerPadding
5431
5463
  }, children: [
5432
- /* @__PURE__ */ jsxs4("div", { style: {
5464
+ /* @__PURE__ */ jsxs5("div", { style: {
5433
5465
  display: "flex",
5434
5466
  alignItems: "center",
5435
5467
  padding: "0.75rem 0 0.625rem"
5436
5468
  }, children: [
5437
- /* @__PURE__ */ jsxs4(
5469
+ /* @__PURE__ */ jsxs5(
5438
5470
  "button",
5439
5471
  {
5440
5472
  type: "button",
@@ -5457,7 +5489,7 @@ function SplitCardFormInner({
5457
5489
  },
5458
5490
  "aria-label": "Back to payment methods",
5459
5491
  children: [
5460
- /* @__PURE__ */ jsx7("span", { style: {
5492
+ /* @__PURE__ */ jsx8("span", { style: {
5461
5493
  display: "inline-flex",
5462
5494
  alignItems: "center",
5463
5495
  justifyContent: "center",
@@ -5467,12 +5499,12 @@ function SplitCardFormInner({
5467
5499
  backgroundColor: "#f3f4f6",
5468
5500
  transition: "background-color 0.15s",
5469
5501
  ...bStyles.backButtonIcon
5470
- }, 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" }) }) }),
5471
- /* @__PURE__ */ jsx7(BackButtonContentSlot, { content: cardBackButtonContent })
5502
+ }, children: /* @__PURE__ */ jsx8("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx8("path", { d: "M15 18l-6-6 6-6" }) }) }),
5503
+ /* @__PURE__ */ jsx8(BackButtonContentSlot, { content: cardBackButtonContent })
5472
5504
  ]
5473
5505
  }
5474
5506
  ),
5475
- /* @__PURE__ */ jsx7("div", { style: {
5507
+ /* @__PURE__ */ jsx8("div", { style: {
5476
5508
  flex: 1,
5477
5509
  textAlign: "center",
5478
5510
  fontWeight: 600,
@@ -5482,12 +5514,12 @@ function SplitCardFormInner({
5482
5514
  ...bStyles.title
5483
5515
  }, children: `Pay with ${getStripeMethodDisplayName(expandedApmMethod)}` })
5484
5516
  ] }),
5485
- /* @__PURE__ */ jsx7(
5517
+ /* @__PURE__ */ jsx8(
5486
5518
  StripeElements,
5487
5519
  {
5488
5520
  stripe: stripeInstance,
5489
5521
  options: apmInlineOptions,
5490
- children: /* @__PURE__ */ jsx7(
5522
+ children: /* @__PURE__ */ jsx8(
5491
5523
  StripeMethodInlineForm,
5492
5524
  {
5493
5525
  method: expandedApmMethod,
@@ -5517,24 +5549,24 @@ function SplitCardFormInner({
5517
5549
  ] });
5518
5550
  }
5519
5551
  if (isApmView && expandedApmMethod && apmInlineOptions && stripeInstance && showStripe) {
5520
- return /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
5521
- /* @__PURE__ */ jsx7(FloPayKeyframes, {}),
5522
- overlayStatus && /* @__PURE__ */ jsx7(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
5523
- /* @__PURE__ */ jsx7("div", { style: {
5552
+ return /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
5553
+ /* @__PURE__ */ jsx8(FloPayKeyframes, {}),
5554
+ overlayStatus && /* @__PURE__ */ jsx8(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
5555
+ /* @__PURE__ */ jsx8("div", { style: {
5524
5556
  ...apmAnim ? { animation: apmAnim } : {},
5525
5557
  ...viewState === "apm-collapsing" ? { pointerEvents: "none" } : {}
5526
- }, children: /* @__PURE__ */ jsxs4("div", { style: {
5558
+ }, children: /* @__PURE__ */ jsxs5("div", { style: {
5527
5559
  backgroundColor: cardBg,
5528
5560
  borderRadius: containerRadius,
5529
5561
  ...containerOverrides,
5530
5562
  padding: containerPadding
5531
5563
  }, children: [
5532
- /* @__PURE__ */ jsxs4("div", { style: {
5564
+ /* @__PURE__ */ jsxs5("div", { style: {
5533
5565
  display: "flex",
5534
5566
  alignItems: "center",
5535
5567
  padding: "0.75rem 0 0.625rem"
5536
5568
  }, children: [
5537
- /* @__PURE__ */ jsxs4(
5569
+ /* @__PURE__ */ jsxs5(
5538
5570
  "button",
5539
5571
  {
5540
5572
  type: "button",
@@ -5557,7 +5589,7 @@ function SplitCardFormInner({
5557
5589
  },
5558
5590
  "aria-label": "Back to payment methods",
5559
5591
  children: [
5560
- /* @__PURE__ */ jsx7("span", { style: {
5592
+ /* @__PURE__ */ jsx8("span", { style: {
5561
5593
  display: "inline-flex",
5562
5594
  alignItems: "center",
5563
5595
  justifyContent: "center",
@@ -5567,12 +5599,12 @@ function SplitCardFormInner({
5567
5599
  backgroundColor: "#f3f4f6",
5568
5600
  transition: "background-color 0.15s",
5569
5601
  ...bStyles.backButtonIcon
5570
- }, 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" }) }) }),
5571
- /* @__PURE__ */ jsx7(BackButtonContentSlot, { content: cardBackButtonContent })
5602
+ }, children: /* @__PURE__ */ jsx8("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx8("path", { d: "M15 18l-6-6 6-6" }) }) }),
5603
+ /* @__PURE__ */ jsx8(BackButtonContentSlot, { content: cardBackButtonContent })
5572
5604
  ]
5573
5605
  }
5574
5606
  ),
5575
- /* @__PURE__ */ jsx7("div", { style: {
5607
+ /* @__PURE__ */ jsx8("div", { style: {
5576
5608
  flex: 1,
5577
5609
  textAlign: "center",
5578
5610
  fontWeight: 600,
@@ -5582,12 +5614,12 @@ function SplitCardFormInner({
5582
5614
  ...bStyles.title
5583
5615
  }, children: `Pay with ${getStripeMethodDisplayName(expandedApmMethod)}` })
5584
5616
  ] }),
5585
- /* @__PURE__ */ jsx7(
5617
+ /* @__PURE__ */ jsx8(
5586
5618
  StripeElements,
5587
5619
  {
5588
5620
  stripe: stripeInstance,
5589
5621
  options: apmInlineOptions,
5590
- children: /* @__PURE__ */ jsx7(
5622
+ children: /* @__PURE__ */ jsx8(
5591
5623
  StripeMethodInlineForm,
5592
5624
  {
5593
5625
  method: expandedApmMethod,
@@ -5615,14 +5647,14 @@ function SplitCardFormInner({
5615
5647
  ] }) })
5616
5648
  ] });
5617
5649
  }
5618
- return /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
5619
- /* @__PURE__ */ jsx7(FloPayKeyframes, {}),
5620
- overlayStatus && /* @__PURE__ */ jsx7(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
5621
- /* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
5650
+ return /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
5651
+ /* @__PURE__ */ jsx8(FloPayKeyframes, {}),
5652
+ overlayStatus && /* @__PURE__ */ jsx8(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
5653
+ /* @__PURE__ */ jsxs5("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
5622
5654
  renderDirectPaypalGateDebug("flopay-direct-paypal-gate-debug-default"),
5623
5655
  renderStripeGateDebug("flopay-stripe-gate-debug-default"),
5624
- shouldRenderDirectPayPal && directPaypal && /* @__PURE__ */ jsxs4(Fragment2, { children: [
5625
- paypalDirectRetry && /* @__PURE__ */ jsx7(
5656
+ shouldRenderDirectPayPal && directPaypal && /* @__PURE__ */ jsxs5(Fragment2, { children: [
5657
+ paypalDirectRetry && /* @__PURE__ */ jsx8(
5626
5658
  "div",
5627
5659
  {
5628
5660
  "data-testid": "flopay-paypal-direct-retry-notice-default",
@@ -5638,7 +5670,7 @@ function SplitCardFormInner({
5638
5670
  children: "Please confirm your PayPal payment to complete checkout."
5639
5671
  }
5640
5672
  ),
5641
- /* @__PURE__ */ jsx7(
5673
+ /* @__PURE__ */ jsx8(
5642
5674
  DirectPayPalButton,
5643
5675
  {
5644
5676
  sessionId,
@@ -5665,7 +5697,7 @@ function SplitCardFormInner({
5665
5697
  paypalDirectRetry?.orderId ?? "fresh"
5666
5698
  )
5667
5699
  ] }),
5668
- shouldRenderStripePayPal && /* @__PURE__ */ jsx7(StripeElements, { stripe: paypalStripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx7(
5700
+ shouldRenderStripePayPal && /* @__PURE__ */ jsx8(StripeElements, { stripe: paypalStripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx8(
5669
5701
  PayPalButtonInner,
5670
5702
  {
5671
5703
  sessionId,
@@ -5683,7 +5715,7 @@ function SplitCardFormInner({
5683
5715
  placeholderBorderRadius: buttonBorderRadius
5684
5716
  }
5685
5717
  ) }),
5686
- shouldRenderWallets && /* @__PURE__ */ jsx7(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx7(
5718
+ shouldRenderWallets && /* @__PURE__ */ jsx8(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx8(
5687
5719
  WalletButtonInner,
5688
5720
  {
5689
5721
  sessionId,
@@ -5701,7 +5733,7 @@ function SplitCardFormInner({
5701
5733
  placeholderBorderRadius: buttonBorderRadius
5702
5734
  }
5703
5735
  ) }),
5704
- shouldRenderPaymentElement && /* @__PURE__ */ jsx7(
5736
+ shouldRenderPaymentElement && /* @__PURE__ */ jsx8(
5705
5737
  StripePaymentElementInner,
5706
5738
  {
5707
5739
  sessionId,
@@ -5734,7 +5766,7 @@ function SplitCardFormInner({
5734
5766
  }
5735
5767
  )
5736
5768
  ] }),
5737
- showStripe && (shouldDisplayWalletRow || shouldDisplayPayPalRow || shouldDisplayPaymentElementRow) && /* @__PURE__ */ jsxs4("div", { style: {
5769
+ showStripe && (shouldDisplayWalletRow || shouldDisplayPayPalRow || shouldDisplayPaymentElementRow) && /* @__PURE__ */ jsxs5("div", { style: {
5738
5770
  display: "flex",
5739
5771
  alignItems: "center",
5740
5772
  gap: "0.75rem",
@@ -5742,9 +5774,9 @@ function SplitCardFormInner({
5742
5774
  color: "#999",
5743
5775
  fontSize: "0.85rem"
5744
5776
  }, children: [
5745
- /* @__PURE__ */ jsx7("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } }),
5746
- /* @__PURE__ */ jsx7("span", { children: "or pay with card" }),
5747
- /* @__PURE__ */ jsx7("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } })
5777
+ /* @__PURE__ */ jsx8("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } }),
5778
+ /* @__PURE__ */ jsx8("span", { children: "or pay with card" }),
5779
+ /* @__PURE__ */ jsx8("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } })
5748
5780
  ] }),
5749
5781
  showStripe && cardFormBlock
5750
5782
  ] });
@@ -5774,6 +5806,9 @@ async function confirmResumeIntent(stripe, clientSecret, data, isSetupIntent) {
5774
5806
  const { paymentIntent, error } = await stripe.confirmCardPayment(clientSecret, data);
5775
5807
  return { error, intent: paymentIntent ?? null };
5776
5808
  }
5809
+ function withCheckoutMethod(error, checkoutMethod) {
5810
+ return Object.assign(error, { checkoutMethod });
5811
+ }
5777
5812
  function getRedirectResultFromCheckoutProcessError(error) {
5778
5813
  if (!error?.type || !error.threeDSecureToken) {
5779
5814
  return null;
@@ -5995,7 +6030,7 @@ function checkoutProcessErrorToFloPayError(error, fallbackMessage = "Payment fai
5995
6030
  const checkoutMethod = options?.checkoutMethod ?? error?.checkoutMethod ?? (error?.type === "paypal_redirect_required" ? "paypal" : "card");
5996
6031
  const rawMessage = error?.message ?? fallbackMessage;
5997
6032
  const message = applyFriendlyMessageOverride(rawMessage) ?? rawMessage;
5998
- return Object.assign(
6033
+ return withCheckoutMethod(
5999
6034
  new FloPayError4(
6000
6035
  message,
6001
6036
  "api_error",
@@ -6003,7 +6038,7 @@ function checkoutProcessErrorToFloPayError(error, fallbackMessage = "Payment fai
6003
6038
  code: error?.gatewayErrorCode
6004
6039
  }
6005
6040
  ),
6006
- { checkoutMethod }
6041
+ checkoutMethod
6007
6042
  );
6008
6043
  }
6009
6044
  function resolveSavedPaymentReturnUrl(session) {
@@ -6175,13 +6210,13 @@ async function processSavedPaymentForMode({
6175
6210
  if (recoveredRedirect) {
6176
6211
  return recoveredRedirect;
6177
6212
  }
6178
- throw Object.assign(
6213
+ throw withCheckoutMethod(
6179
6214
  new FloPayError4(
6180
6215
  "Your card requires authentication. Please enter your payment details below.",
6181
6216
  "api_error",
6182
6217
  { code: "authentication_required" }
6183
6218
  ),
6184
- { checkoutMethod: "card" }
6219
+ "card"
6185
6220
  );
6186
6221
  }
6187
6222
  throw new FloPayError4(
@@ -6209,13 +6244,13 @@ async function handleSavedPaymentRedirectResult(redirectResult, {
6209
6244
  }
6210
6245
  if (redirectResult.type === "3ds_required") {
6211
6246
  if (!attempt3DS || !redirectResult.threeDSecureToken) {
6212
- throw Object.assign(
6247
+ throw withCheckoutMethod(
6213
6248
  new FloPayError4(
6214
6249
  "Your card requires authentication. Please enter your payment details below.",
6215
6250
  "api_error",
6216
6251
  { code: "authentication_required" }
6217
6252
  ),
6218
- { checkoutMethod: "card" }
6253
+ "card"
6219
6254
  );
6220
6255
  }
6221
6256
  const isSetupIntent = isSetupIntentClientSecret3(redirectResult.threeDSecureToken);
@@ -6224,13 +6259,13 @@ async function handleSavedPaymentRedirectResult(redirectResult, {
6224
6259
  const retrieved = await retrieveResumeIntent(stripe, redirectResult.threeDSecureToken, isSetupIntent);
6225
6260
  if (retrieved) {
6226
6261
  if (retrieved.error) {
6227
- throw Object.assign(
6262
+ throw withCheckoutMethod(
6228
6263
  new FloPayError4(
6229
6264
  retrieved.error.message ?? `Failed to retrieve 3DS ${isSetupIntent ? "setup" : "payment"} status.`,
6230
6265
  "api_error",
6231
6266
  { code: retrieved.error.code }
6232
6267
  ),
6233
- { checkoutMethod: "card" }
6268
+ "card"
6234
6269
  );
6235
6270
  }
6236
6271
  const existingIntent = retrieved.intent;
@@ -6253,13 +6288,13 @@ async function handleSavedPaymentRedirectResult(redirectResult, {
6253
6288
  ) : null;
6254
6289
  if (confirmed) {
6255
6290
  if (confirmed.error) {
6256
- throw Object.assign(
6291
+ throw withCheckoutMethod(
6257
6292
  new FloPayError4(
6258
6293
  confirmed.error.message ?? "3DS authentication failed.",
6259
6294
  "api_error",
6260
6295
  { code: confirmed.error.code }
6261
6296
  ),
6262
- { checkoutMethod: "card" }
6297
+ "card"
6263
6298
  );
6264
6299
  }
6265
6300
  paymentIntent = confirmed.intent;
@@ -6268,13 +6303,13 @@ async function handleSavedPaymentRedirectResult(redirectResult, {
6268
6303
  clientSecret: redirectResult.threeDSecureToken
6269
6304
  });
6270
6305
  if (nextAction.error) {
6271
- throw Object.assign(
6306
+ throw withCheckoutMethod(
6272
6307
  new FloPayError4(
6273
6308
  nextAction.error.message ?? "3DS authentication failed.",
6274
6309
  "api_error",
6275
6310
  { code: nextAction.error.code }
6276
6311
  ),
6277
- { checkoutMethod: "card" }
6312
+ "card"
6278
6313
  );
6279
6314
  }
6280
6315
  paymentIntent = (isSetupIntent ? nextAction.setupIntent : nextAction.paymentIntent) ?? null;
@@ -6310,17 +6345,17 @@ async function handleSavedPaymentRedirectResult(redirectResult, {
6310
6345
  telemetry
6311
6346
  });
6312
6347
  }
6313
- throw Object.assign(
6348
+ throw withCheckoutMethod(
6314
6349
  new FloPayError4("3DS authentication did not complete successfully.", "api_error"),
6315
- { checkoutMethod: "card" }
6350
+ "card"
6316
6351
  );
6317
6352
  }
6318
6353
  if (redirectResult.type === "paypal_redirect_required") {
6319
6354
  const paypalStripe = (paypalFlopay ?? flopay)?.getRawProvider();
6320
6355
  if (!paypalStripe) {
6321
- throw Object.assign(
6356
+ throw withCheckoutMethod(
6322
6357
  new FloPayError4("PayPal is not available.", "api_error"),
6323
- { checkoutMethod: "paypal" }
6358
+ "paypal"
6324
6359
  );
6325
6360
  }
6326
6361
  if (redirectResult.paymentMethodId) {
@@ -6328,13 +6363,13 @@ async function handleSavedPaymentRedirectResult(redirectResult, {
6328
6363
  clientSecret: redirectResult.threeDSecureToken
6329
6364
  });
6330
6365
  if (error2) {
6331
- throw Object.assign(
6366
+ throw withCheckoutMethod(
6332
6367
  new FloPayError4(
6333
6368
  error2.message ?? "PayPal authorization failed.",
6334
6369
  "api_error",
6335
6370
  { code: error2.code }
6336
6371
  ),
6337
- { checkoutMethod: "paypal" }
6372
+ "paypal"
6338
6373
  );
6339
6374
  }
6340
6375
  return {
@@ -6351,13 +6386,13 @@ async function handleSavedPaymentRedirectResult(redirectResult, {
6351
6386
  redirect: "if_required"
6352
6387
  });
6353
6388
  if (error) {
6354
- throw Object.assign(
6389
+ throw withCheckoutMethod(
6355
6390
  new FloPayError4(
6356
6391
  error.message ?? "PayPal authorization failed.",
6357
6392
  "api_error",
6358
6393
  { code: error.code }
6359
6394
  ),
6360
- { checkoutMethod: "paypal" }
6395
+ "paypal"
6361
6396
  );
6362
6397
  }
6363
6398
  return {
@@ -6442,7 +6477,7 @@ async function loadSavedPaymentProviders({
6442
6477
  }
6443
6478
 
6444
6479
  // src/flopay-checkout.tsx
6445
- import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
6480
+ import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
6446
6481
  var DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2 = 44;
6447
6482
  var PAYPAL_RESUME_STORAGE_KEY = "flopay_checkout_saved_payment_resume";
6448
6483
  var sessionInflightMap = /* @__PURE__ */ new Map();
@@ -7657,7 +7692,7 @@ function FloPayCheckout({
7657
7692
  ]
7658
7693
  );
7659
7694
  const shouldShowInterimButtons = Boolean(createSessionParams) && layout === "buttons" && !isPaypalOnlySession && (!flopay || !providerOptions);
7660
- const modeOverlay = modeOverlayStatus ? /* @__PURE__ */ jsx8(
7695
+ const modeOverlay = modeOverlayStatus ? /* @__PURE__ */ jsx9(
7661
7696
  ProcessingOverlay,
7662
7697
  {
7663
7698
  status: modeOverlayStatus,
@@ -7666,32 +7701,32 @@ function FloPayCheckout({
7666
7701
  ) : null;
7667
7702
  if (isLoading) {
7668
7703
  if (loadingNode) {
7669
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
7704
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
7670
7705
  loadingNode,
7671
7706
  modeOverlay
7672
7707
  ] });
7673
7708
  }
7674
7709
  if (layout === "buttons") {
7675
7710
  const bundleRadius = themeBundle?.buttonsLayout?.cardButton?.borderRadius ?? themeBundle?.appearance.variables?.borderRadius ?? 8;
7676
- const skeletonBar = (h) => /* @__PURE__ */ jsx8("div", { style: {
7711
+ const skeletonBar = (h) => /* @__PURE__ */ jsx9("div", { style: {
7677
7712
  height: h,
7678
7713
  borderRadius: bundleRadius,
7679
7714
  background: "#e5e7eb",
7680
7715
  animation: "flopay-loading-pulse 1.5s ease-in-out infinite"
7681
7716
  } });
7682
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
7683
- /* @__PURE__ */ jsxs5("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
7717
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
7718
+ /* @__PURE__ */ jsxs6("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
7684
7719
  showPayPal && skeletonBar(DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2),
7685
7720
  showStripe && (showApplePay || showGooglePay) && skeletonBar(DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2),
7686
7721
  showStripe && skeletonBar(DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2),
7687
- /* @__PURE__ */ jsx8("style", { children: `@keyframes flopay-loading-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
7722
+ /* @__PURE__ */ jsx9("style", { children: `@keyframes flopay-loading-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
7688
7723
  ] }),
7689
7724
  modeOverlay
7690
7725
  ] });
7691
7726
  }
7692
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
7693
- /* @__PURE__ */ jsxs5("div", { style: { display: "flex", justifyContent: "center", padding: 32 }, children: [
7694
- /* @__PURE__ */ jsx8("div", { style: {
7727
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
7728
+ /* @__PURE__ */ jsxs6("div", { style: { display: "flex", justifyContent: "center", padding: 32 }, children: [
7729
+ /* @__PURE__ */ jsx9("div", { style: {
7695
7730
  width: 24,
7696
7731
  height: 24,
7697
7732
  border: "2px solid #e5e7eb",
@@ -7699,16 +7734,16 @@ function FloPayCheckout({
7699
7734
  borderRadius: "50%",
7700
7735
  animation: "spin 0.6s linear infinite"
7701
7736
  } }),
7702
- /* @__PURE__ */ jsx8("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` })
7737
+ /* @__PURE__ */ jsx9("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` })
7703
7738
  ] }),
7704
7739
  modeOverlay
7705
7740
  ] });
7706
7741
  }
7707
7742
  if (loadError) {
7708
7743
  if (errorNode) {
7709
- return /* @__PURE__ */ jsx8(CheckoutContext.Provider, { value: checkoutValue, children: errorNode(loadError) });
7744
+ return /* @__PURE__ */ jsx9(CheckoutContext.Provider, { value: checkoutValue, children: errorNode(loadError) });
7710
7745
  }
7711
- return /* @__PURE__ */ jsx8(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx8(
7746
+ return /* @__PURE__ */ jsx9(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx9(
7712
7747
  "div",
7713
7748
  {
7714
7749
  role: "alert",
@@ -7724,8 +7759,8 @@ function FloPayCheckout({
7724
7759
  ) });
7725
7760
  }
7726
7761
  if (shouldShowInterimButtons) {
7727
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
7728
- /* @__PURE__ */ jsx8(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx8(
7762
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
7763
+ /* @__PURE__ */ jsx9(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx9(
7729
7764
  InterimButtonsView,
7730
7765
  {
7731
7766
  onButtonClick,
@@ -7745,26 +7780,10 @@ function FloPayCheckout({
7745
7780
  ] });
7746
7781
  }
7747
7782
  if (isPaypalOnlySession && session && directPaypalConfig) {
7748
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
7749
- /* @__PURE__ */ jsx8(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsxs5("div", { className, style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
7750
- modeError && /* @__PURE__ */ jsx8(
7751
- "div",
7752
- {
7753
- role: "alert",
7754
- "data-testid": "flopay-error",
7755
- style: {
7756
- padding: "0.625rem 0.875rem",
7757
- background: "#FEF2F2",
7758
- border: "1px solid #FECACA",
7759
- borderRadius: "8px",
7760
- color: "#991B1B",
7761
- fontSize: "0.85rem",
7762
- fontWeight: 600
7763
- },
7764
- children: modeError
7765
- }
7766
- ),
7767
- /* @__PURE__ */ jsx8(
7783
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
7784
+ /* @__PURE__ */ jsx9(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsxs6("div", { className, style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
7785
+ modeError && /* @__PURE__ */ jsx9(ErrorBanner, { icon: false, children: modeError }),
7786
+ /* @__PURE__ */ jsx9(
7768
7787
  InstrumentedDirectPayPalButton,
7769
7788
  {
7770
7789
  sessionId: activeSessionId,
@@ -7790,12 +7809,12 @@ function FloPayCheckout({
7790
7809
  ] });
7791
7810
  }
7792
7811
  if (!flopay || !providerOptions) {
7793
- return /* @__PURE__ */ jsx8(Fragment3, { children: modeOverlay });
7812
+ return /* @__PURE__ */ jsx9(Fragment3, { children: modeOverlay });
7794
7813
  }
7795
7814
  if (currentMode === "confirm") {
7796
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
7797
- /* @__PURE__ */ jsx8(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx8(FloPayProvider, { flopay, paypalFlopay, options: providerOptions, children: /* @__PURE__ */ jsxs5("div", { className, children: [
7798
- modeError && /* @__PURE__ */ jsx8(
7815
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
7816
+ /* @__PURE__ */ jsx9(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx9(FloPayProvider, { flopay, paypalFlopay, options: providerOptions, children: /* @__PURE__ */ jsxs6("div", { className, children: [
7817
+ modeError && /* @__PURE__ */ jsx9(
7799
7818
  "div",
7800
7819
  {
7801
7820
  style: {
@@ -7810,7 +7829,7 @@ function FloPayCheckout({
7810
7829
  renderConfirmButton ? renderConfirmButton({
7811
7830
  onConfirm: handleConfirmCheckout,
7812
7831
  isProcessing: confirmProcessing
7813
- }) : /* @__PURE__ */ jsx8(
7832
+ }) : /* @__PURE__ */ jsx9(
7814
7833
  "button",
7815
7834
  {
7816
7835
  type: "button",
@@ -7835,9 +7854,9 @@ function FloPayCheckout({
7835
7854
  modeOverlay
7836
7855
  ] });
7837
7856
  }
7838
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
7839
- /* @__PURE__ */ jsx8(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx8(FloPayProvider, { flopay, paypalFlopay, options: providerOptions, children: children ? /* @__PURE__ */ jsxs5(Fragment3, { children: [
7840
- modeError && /* @__PURE__ */ jsx8(
7857
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
7858
+ /* @__PURE__ */ jsx9(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx9(FloPayProvider, { flopay, paypalFlopay, options: providerOptions, children: children ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
7859
+ modeError && /* @__PURE__ */ jsx9(
7841
7860
  "div",
7842
7861
  {
7843
7862
  style: {
@@ -7852,7 +7871,7 @@ function FloPayCheckout({
7852
7871
  children: modeError
7853
7872
  }
7854
7873
  ),
7855
- /* @__PURE__ */ jsx8(
7874
+ /* @__PURE__ */ jsx9(
7856
7875
  SessionInjector,
7857
7876
  {
7858
7877
  sessionId: activeSessionId,
@@ -7862,7 +7881,7 @@ function FloPayCheckout({
7862
7881
  children
7863
7882
  }
7864
7883
  )
7865
- ] }) : /* @__PURE__ */ jsx8(
7884
+ ] }) : /* @__PURE__ */ jsx9(
7866
7885
  SplitCardForm,
7867
7886
  {
7868
7887
  sessionId: activeSessionId,
@@ -7925,8 +7944,8 @@ function SessionInjector({
7925
7944
  session,
7926
7945
  children
7927
7946
  }) {
7928
- return /* @__PURE__ */ jsx8(Fragment3, { children: React8.Children.map(children, (child) => {
7929
- if (!React8.isValidElement(child)) return child;
7947
+ return /* @__PURE__ */ jsx9(Fragment3, { children: React9.Children.map(children, (child) => {
7948
+ if (!React9.isValidElement(child)) return child;
7930
7949
  const existing = child.props;
7931
7950
  const injected = {};
7932
7951
  if (!existing.sessionId) injected.sessionId = sessionId;
@@ -7941,15 +7960,11 @@ function SessionInjector({
7941
7960
  injected.lastName = session.customer.lastName;
7942
7961
  }
7943
7962
  if (Object.keys(injected).length === 0) return child;
7944
- return React8.cloneElement(child, injected);
7963
+ return React9.cloneElement(child, injected);
7945
7964
  }) });
7946
7965
  }
7947
7966
  function InterimButtonsView({
7948
7967
  onButtonClick,
7949
- onCardButtonClick,
7950
- cardLoading = false,
7951
- cardOpen,
7952
- errorMessage,
7953
7968
  showPayPal,
7954
7969
  showStripe = true,
7955
7970
  showApplePay,
@@ -7962,12 +7977,6 @@ function InterimButtonsView({
7962
7977
  cardTitleContent
7963
7978
  }) {
7964
7979
  const [showCardForm, setShowCardForm] = useState4(false);
7965
- const isCardOpenControlled = typeof cardOpen === "boolean";
7966
- useEffect6(() => {
7967
- if (isCardOpenControlled) {
7968
- setShowCardForm(cardOpen);
7969
- }
7970
- }, [cardOpen, isCardOpenControlled]);
7971
7980
  const themeBundle = useMemo4(() => resolveTheme2(theme), [theme]);
7972
7981
  const bStyles = useMemo4(() => {
7973
7982
  const base = themeBundle?.buttonsLayout ?? resolveButtonsLayoutTheme2(buttonsTheme);
@@ -7984,7 +7993,7 @@ function InterimButtonsView({
7984
7993
  };
7985
7994
  }, [themeBundle, buttonsTheme, stylesOverride]);
7986
7995
  const skeletonRadius = themeBundle?.buttonsLayout?.cardButton?.borderRadius ?? themeBundle?.appearance.variables?.borderRadius ?? 8;
7987
- const skeleton = (h) => /* @__PURE__ */ jsx8("div", { style: {
7996
+ const skeleton = (h) => /* @__PURE__ */ jsx9("div", { style: {
7988
7997
  height: h,
7989
7998
  borderRadius: skeletonRadius,
7990
7999
  background: "#e5e7eb",
@@ -7996,25 +8005,20 @@ function InterimButtonsView({
7996
8005
  const inputBg = bStyles.cardInputBackground ?? "white";
7997
8006
  const hideBackButtonLabel = isEmptySlotContent(cardBackButtonContent);
7998
8007
  const hideTitle = isEmptySlotContent(cardTitleContent);
7999
- return /* @__PURE__ */ jsxs5("div", { style: {
8008
+ return /* @__PURE__ */ jsxs6("div", { style: {
8000
8009
  backgroundColor: bStyles.cardFormContainer?.backgroundColor ?? "white",
8001
8010
  borderRadius: "8px",
8002
8011
  animation: "flopay-interim-expand 0.35s cubic-bezier(0.4, 0, 0.2, 1) both",
8003
8012
  overflow: "hidden",
8004
8013
  ...bStyles.cardFormContainer
8005
8014
  }, children: [
8006
- /* @__PURE__ */ jsxs5("div", { style: { display: "flex", alignItems: "center", padding: "0.75rem 0 0.625rem" }, children: [
8007
- /* @__PURE__ */ jsxs5(
8015
+ /* @__PURE__ */ jsxs6("div", { style: { display: "flex", alignItems: "center", padding: "0.75rem 0 0.625rem" }, children: [
8016
+ /* @__PURE__ */ jsxs6(
8008
8017
  "button",
8009
8018
  {
8010
8019
  type: "button",
8011
- onClick: () => {
8012
- if (!isCardOpenControlled) {
8013
- setShowCardForm(false);
8014
- }
8015
- },
8020
+ onClick: () => setShowCardForm(false),
8016
8021
  "aria-label": "Back to payment methods",
8017
- disabled: isCardOpenControlled || cardLoading,
8018
8022
  style: {
8019
8023
  display: "inline-flex",
8020
8024
  alignItems: "center",
@@ -8026,12 +8030,12 @@ function InterimButtonsView({
8026
8030
  fontWeight: 500,
8027
8031
  padding: 0,
8028
8032
  flexShrink: 0,
8029
- opacity: isCardOpenControlled || cardLoading ? 0.6 : 1,
8030
- cursor: isCardOpenControlled || cardLoading ? "not-allowed" : "pointer",
8033
+ opacity: 1,
8034
+ cursor: "pointer",
8031
8035
  ...bStyles.backButton
8032
8036
  },
8033
8037
  children: [
8034
- /* @__PURE__ */ jsx8("span", { style: {
8038
+ /* @__PURE__ */ jsx9("span", { style: {
8035
8039
  display: "inline-flex",
8036
8040
  alignItems: "center",
8037
8041
  justifyContent: "center",
@@ -8040,12 +8044,12 @@ function InterimButtonsView({
8040
8044
  borderRadius: "50%",
8041
8045
  backgroundColor: "#f3f4f6",
8042
8046
  ...bStyles.backButtonIcon
8043
- }, children: /* @__PURE__ */ jsx8("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx8("path", { d: "M15 18l-6-6 6-6" }) }) }),
8044
- /* @__PURE__ */ jsx8(BackButtonContentSlot, { content: cardBackButtonContent })
8047
+ }, children: /* @__PURE__ */ jsx9("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx9("path", { d: "M15 18l-6-6 6-6" }) }) }),
8048
+ /* @__PURE__ */ jsx9(BackButtonContentSlot, { content: cardBackButtonContent })
8045
8049
  ]
8046
8050
  }
8047
8051
  ),
8048
- hideTitle ? /* @__PURE__ */ jsx8("div", { style: { flex: 1 } }) : /* @__PURE__ */ jsx8("div", { style: {
8052
+ hideTitle ? /* @__PURE__ */ jsx9("div", { style: { flex: 1 } }) : /* @__PURE__ */ jsx9("div", { style: {
8049
8053
  flex: 1,
8050
8054
  textAlign: "center",
8051
8055
  fontWeight: 600,
@@ -8053,11 +8057,11 @@ function InterimButtonsView({
8053
8057
  color: "#262833",
8054
8058
  paddingRight: 80,
8055
8059
  ...bStyles.title
8056
- }, children: /* @__PURE__ */ jsx8(TitleContentSlot, { content: cardTitleContent }) })
8060
+ }, children: /* @__PURE__ */ jsx9(TitleContentSlot, { content: cardTitleContent }) })
8057
8061
  ] }),
8058
- /* @__PURE__ */ jsx8("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTopLeftRadius: 8, borderTopRightRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx8("div", { style: { width: "60%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
8059
- /* @__PURE__ */ jsxs5("div", { style: { display: "flex" }, children: [
8060
- /* @__PURE__ */ jsx8("div", { style: {
8062
+ /* @__PURE__ */ jsx9("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTopLeftRadius: 8, borderTopRightRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx9("div", { style: { width: "60%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
8063
+ /* @__PURE__ */ jsxs6("div", { style: { display: "flex" }, children: [
8064
+ /* @__PURE__ */ jsx9("div", { style: {
8061
8065
  flex: 1,
8062
8066
  backgroundColor: inputBg,
8063
8067
  borderTop: "none",
@@ -8067,8 +8071,8 @@ function InterimButtonsView({
8067
8071
  borderBottomLeftRadius: 8,
8068
8072
  padding: 12,
8069
8073
  height: 45
8070
- }, children: /* @__PURE__ */ jsx8("div", { style: { width: "50%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
8071
- /* @__PURE__ */ jsx8("div", { style: {
8074
+ }, children: /* @__PURE__ */ jsx9("div", { style: { width: "50%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
8075
+ /* @__PURE__ */ jsx9("div", { style: {
8072
8076
  flex: 1,
8073
8077
  backgroundColor: inputBg,
8074
8078
  borderTop: "none",
@@ -8078,10 +8082,10 @@ function InterimButtonsView({
8078
8082
  borderBottomRightRadius: 8,
8079
8083
  padding: 12,
8080
8084
  height: 45
8081
- }, children: /* @__PURE__ */ jsx8("div", { style: { width: "40%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) })
8085
+ }, children: /* @__PURE__ */ jsx9("div", { style: { width: "40%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) })
8082
8086
  ] }),
8083
- /* @__PURE__ */ jsx8("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderRadius: 8, marginTop: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx8("div", { style: { width: "45%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
8084
- /* @__PURE__ */ jsx8("div", { style: {
8087
+ /* @__PURE__ */ jsx9("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderRadius: 8, marginTop: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx9("div", { style: { width: "45%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
8088
+ /* @__PURE__ */ jsx9("div", { style: {
8085
8089
  height: 50,
8086
8090
  borderRadius: 8,
8087
8091
  marginTop: 16,
@@ -8090,7 +8094,7 @@ function InterimButtonsView({
8090
8094
  ...bStyles.submitButton,
8091
8095
  opacity: 0.5
8092
8096
  } }),
8093
- /* @__PURE__ */ jsx8("style", { children: `
8097
+ /* @__PURE__ */ jsx9("style", { children: `
8094
8098
  @keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
8095
8099
  @keyframes flopay-interim-expand {
8096
8100
  0% { opacity: 0; max-height: 0; transform: translateY(-12px); }
@@ -8100,23 +8104,17 @@ function InterimButtonsView({
8100
8104
  ` })
8101
8105
  ] });
8102
8106
  }
8103
- return /* @__PURE__ */ jsxs5("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
8107
+ return /* @__PURE__ */ jsxs6("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
8104
8108
  showPayPal && skeleton(DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2),
8105
8109
  showStripe && (showApplePay || showGooglePay) && skeleton(DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT2),
8106
- showStripe && /* @__PURE__ */ jsx8(
8110
+ showStripe && /* @__PURE__ */ jsx9(
8107
8111
  "button",
8108
8112
  {
8109
8113
  type: "button",
8110
- onClick: async () => {
8111
- if (cardLoading) return;
8112
- if (onCardButtonClick) {
8113
- await onCardButtonClick();
8114
- return;
8115
- }
8114
+ onClick: () => {
8116
8115
  onButtonClick?.("card");
8117
8116
  setShowCardForm(true);
8118
8117
  },
8119
- disabled: cardLoading,
8120
8118
  style: {
8121
8119
  width: "100%",
8122
8120
  ...cardButtonSizing,
@@ -8126,7 +8124,7 @@ function InterimButtonsView({
8126
8124
  borderRadius: "8px",
8127
8125
  fontSize: bStyles.cardButtonFontSize ?? "0.95rem",
8128
8126
  fontWeight: 600,
8129
- cursor: cardLoading ? "not-allowed" : "pointer",
8127
+ cursor: "pointer",
8130
8128
  display: "flex",
8131
8129
  alignItems: "center",
8132
8130
  justifyContent: "center",
@@ -8134,7 +8132,7 @@ function InterimButtonsView({
8134
8132
  boxShadow: "0 1px 2px rgba(0,0,0,0.04)",
8135
8133
  transition: "transform 0.1s",
8136
8134
  position: "relative",
8137
- opacity: cardLoading ? 0.6 : 1,
8135
+ opacity: 1,
8138
8136
  ...bStyles.cardButton
8139
8137
  },
8140
8138
  onMouseDown: (e) => {
@@ -8143,27 +8141,10 @@ function InterimButtonsView({
8143
8141
  onMouseUp: (e) => {
8144
8142
  e.currentTarget.style.transform = "scale(1)";
8145
8143
  },
8146
- children: /* @__PURE__ */ jsx8(CardButtonContentSlot, { content: cardButtonContent })
8144
+ children: /* @__PURE__ */ jsx9(CardButtonContentSlot, { content: cardButtonContent })
8147
8145
  }
8148
8146
  ),
8149
- errorMessage && /* @__PURE__ */ jsxs5("div", { style: {
8150
- margin: "0.25rem 0",
8151
- padding: "0.625rem 0.875rem",
8152
- background: "#FEF2F2",
8153
- border: "1px solid #FECACA",
8154
- borderRadius: "8px",
8155
- color: "#991B1B",
8156
- fontSize: "0.85rem",
8157
- fontWeight: 600,
8158
- display: "flex",
8159
- alignItems: "center",
8160
- gap: "0.5rem",
8161
- ...bStyles.errorBanner
8162
- }, children: [
8163
- /* @__PURE__ */ jsx8("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx8("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" }) }),
8164
- errorMessage
8165
- ] }),
8166
- /* @__PURE__ */ jsx8("style", { children: `@keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
8147
+ /* @__PURE__ */ jsx9("style", { children: `@keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
8167
8148
  ] });
8168
8149
  }
8169
8150
 
@@ -8171,11 +8152,11 @@ function InterimButtonsView({
8171
8152
  import { PaymentAPI as PaymentAPI5 } from "@flopay/js";
8172
8153
  import { FloPayError as FloPayError6 } from "@flopay/shared";
8173
8154
  import { forwardRef as forwardRef2, useCallback as useCallback5, useEffect as useEffect7, useImperativeHandle as useImperativeHandle2, useState as useState5 } from "react";
8174
- import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
8155
+ import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
8175
8156
  var WALLET_RESUME_KEY = "flopay_wallet_resume";
8176
8157
  var CheckoutForm = forwardRef2(
8177
8158
  function CheckoutForm2(props, ref) {
8178
- return /* @__PURE__ */ jsx9(CheckoutFormInner, { ...props, innerRef: ref });
8159
+ return /* @__PURE__ */ jsx10(CheckoutFormInner, { ...props, innerRef: ref });
8179
8160
  }
8180
8161
  );
8181
8162
  function CheckoutFormInner({
@@ -8418,8 +8399,7 @@ function CheckoutFormInner({
8418
8399
  if (!sessionId || !email) {
8419
8400
  throw new FloPayError6("Missing sessionId or email", "validation_error");
8420
8401
  }
8421
- const intentHeaders = { "Content-Type": "application/json" };
8422
- if (nonce) intentHeaders["x-checkout-session-token"] = nonce;
8402
+ const intentHeaders = intentRequestHeaders(nonce);
8423
8403
  const intentResponse = await fetch(`${baseUrl}/v1/checkouts/payments/intents`, {
8424
8404
  method: "POST",
8425
8405
  headers: intentHeaders,
@@ -8484,8 +8464,8 @@ function CheckoutFormInner({
8484
8464
  [flopay, elements, isSubmitting, sessionId, nonce, email, firstName, lastName, baseUrl, isSelfContained, dispatchTokenizedBody, onError, updateError, emitDecline]
8485
8465
  );
8486
8466
  const isReady = flopay !== null && elements !== null;
8487
- return /* @__PURE__ */ jsxs6("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
8488
- (is3DSActive || isSubmitting) && /* @__PURE__ */ jsx9("div", { "data-testid": "flopay-overlay", style: {
8467
+ return /* @__PURE__ */ jsxs7("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
8468
+ (is3DSActive || isSubmitting) && /* @__PURE__ */ jsx10("div", { "data-testid": "flopay-overlay", style: {
8489
8469
  position: "absolute",
8490
8470
  inset: 0,
8491
8471
  background: "rgba(255,255,255,0.7)",
@@ -8494,12 +8474,12 @@ function CheckoutFormInner({
8494
8474
  justifyContent: "center",
8495
8475
  zIndex: 10
8496
8476
  }, children: is3DSActive ? "Verifying payment..." : "Processing..." }),
8497
- !isReady && /* @__PURE__ */ jsx9("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." }),
8498
- isReady && /* @__PURE__ */ jsxs6(Fragment4, { children: [
8499
- /* @__PURE__ */ jsx9(PaymentElement, { options: { layout } }),
8500
- showAddress && /* @__PURE__ */ jsx9(AddressElement, { options: { mode: showAddress === true ? "billing" : showAddress } }),
8501
- displayError && /* @__PURE__ */ jsx9("div", { role: "alert", "data-testid": "flopay-error", style: { color: "red", margin: "0.75rem 0" }, children: displayError }),
8502
- children ?? /* @__PURE__ */ jsx9(
8477
+ !isReady && /* @__PURE__ */ jsx10("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." }),
8478
+ isReady && /* @__PURE__ */ jsxs7(Fragment4, { children: [
8479
+ /* @__PURE__ */ jsx10(PaymentElement, { options: { layout } }),
8480
+ showAddress && /* @__PURE__ */ jsx10(AddressElement, { options: { mode: showAddress === true ? "billing" : showAddress } }),
8481
+ displayError && /* @__PURE__ */ jsx10("div", { role: "alert", "data-testid": "flopay-error", style: { color: "red", margin: "0.75rem 0" }, children: displayError }),
8482
+ children ?? /* @__PURE__ */ jsx10(
8503
8483
  "button",
8504
8484
  {
8505
8485
  type: "submit",
@@ -8516,7 +8496,7 @@ function CheckoutFormInner({
8516
8496
  import { PaymentAPI as PaymentAPI6 } from "@flopay/js";
8517
8497
  import { FloPayError as FloPayError7 } from "@flopay/shared";
8518
8498
  import { useCallback as useCallback6, useEffect as useEffect8, useRef as useRef7, useState as useState6 } from "react";
8519
- import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
8499
+ import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
8520
8500
  function PayPalButton({
8521
8501
  sessionId,
8522
8502
  nonce,
@@ -8658,11 +8638,11 @@ function PayPalButton({
8658
8638
  }
8659
8639
  }, [flopay, elements, sessionId, nonce, email, baseUrl, dispatchTokenizedBody, onErrorChange]);
8660
8640
  if (!flopay || !elements) {
8661
- return /* @__PURE__ */ jsx10("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6, animation: "pulse 1.5s infinite" } });
8641
+ return /* @__PURE__ */ jsx11("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6, animation: "pulse 1.5s infinite" } });
8662
8642
  }
8663
- return /* @__PURE__ */ jsxs7(Fragment5, { children: [
8664
- !ready && /* @__PURE__ */ jsx10("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6 } }),
8665
- /* @__PURE__ */ jsx10("div", { style: ready ? {} : { display: "none" }, children: /* @__PURE__ */ jsx10(
8643
+ return /* @__PURE__ */ jsxs8(Fragment5, { children: [
8644
+ !ready && /* @__PURE__ */ jsx11("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6 } }),
8645
+ /* @__PURE__ */ jsx11("div", { style: ready ? {} : { display: "none" }, children: /* @__PURE__ */ jsx11(
8666
8646
  "button",
8667
8647
  {
8668
8648
  type: "button",
@@ -8684,7 +8664,7 @@ function PayPalButton({
8684
8664
  children: submitting ? "Processing..." : "PayPal"
8685
8665
  }
8686
8666
  ) }),
8687
- (submitting || isProcessing) && /* @__PURE__ */ jsx10("div", { style: {
8667
+ (submitting || isProcessing) && /* @__PURE__ */ jsx11("div", { style: {
8688
8668
  position: "fixed",
8689
8669
  inset: 0,
8690
8670
  background: "rgba(0,0,0,0.4)",
@@ -8692,7 +8672,7 @@ function PayPalButton({
8692
8672
  alignItems: "center",
8693
8673
  justifyContent: "center",
8694
8674
  zIndex: 1e3
8695
- }, children: /* @__PURE__ */ jsx10("div", { style: {
8675
+ }, children: /* @__PURE__ */ jsx11("div", { style: {
8696
8676
  background: "white",
8697
8677
  borderRadius: 8,
8698
8678
  padding: "1.5rem",
@@ -8707,7 +8687,7 @@ function PayPalButton({
8707
8687
  import { useCallback as useCallback7, useEffect as useEffect9, useMemo as useMemo5, useRef as useRef8, useState as useState7 } from "react";
8708
8688
  import { PaymentAPI as PaymentAPI7 } from "@flopay/js";
8709
8689
  import { FloPayError as FloPayError8, resolveBillingApiUrl as resolveBillingApiUrl4, resolveButtonsLayoutTheme as resolveButtonsLayoutTheme3, resolveTheme as resolveTheme3 } from "@flopay/shared";
8710
- import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
8690
+ import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
8711
8691
  var DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT3 = 44;
8712
8692
  function sleep2(ms) {
8713
8693
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -9168,8 +9148,8 @@ function FloPayAutomaticPaymentButton({
9168
9148
  const resolvedPrimaryHoverColor = resolvedAppearanceVars?.colorPrimaryHover ?? darkenHex(resolvedPrimaryColor, 0.12);
9169
9149
  const resolvedButtonBorderRadius = resolvedAppearanceVars?.borderRadius ?? "8px";
9170
9150
  const cardButtonSizing = children === void 0 ? { boxSizing: "border-box", height: DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT3, padding: "0 1rem" } : { padding: "0.9rem 1rem" };
9171
- return /* @__PURE__ */ jsxs8(Fragment6, { children: [
9172
- /* @__PURE__ */ jsx11(
9151
+ return /* @__PURE__ */ jsxs9(Fragment6, { children: [
9152
+ /* @__PURE__ */ jsx12(
9173
9153
  "button",
9174
9154
  {
9175
9155
  ...buttonProps,
@@ -9233,17 +9213,17 @@ function FloPayAutomaticPaymentButton({
9233
9213
  e.currentTarget.style.transform = "scale(1)";
9234
9214
  }
9235
9215
  },
9236
- children: /* @__PURE__ */ jsx11(CardButtonContentSlot, { content: children })
9216
+ children: /* @__PURE__ */ jsx12(CardButtonContentSlot, { content: children })
9237
9217
  }
9238
9218
  ),
9239
- overlayStatus && /* @__PURE__ */ jsx11(
9219
+ overlayStatus && /* @__PURE__ */ jsx12(
9240
9220
  ProcessingOverlay,
9241
9221
  {
9242
9222
  status: overlayStatus,
9243
9223
  errorMessage: overlayError
9244
9224
  }
9245
9225
  ),
9246
- fallbackSession && /* @__PURE__ */ jsx11(
9226
+ fallbackSession && /* @__PURE__ */ jsx12(
9247
9227
  "div",
9248
9228
  {
9249
9229
  "data-testid": "flopay-automatic-payment-fallback",
@@ -9264,7 +9244,7 @@ function FloPayAutomaticPaymentButton({
9264
9244
  padding: "1.5rem",
9265
9245
  zIndex: 1100
9266
9246
  },
9267
- children: /* @__PURE__ */ jsx11(
9247
+ children: /* @__PURE__ */ jsx12(
9268
9248
  "div",
9269
9249
  {
9270
9250
  style: {
@@ -9280,7 +9260,7 @@ function FloPayAutomaticPaymentButton({
9280
9260
  flexDirection: "column",
9281
9261
  gap: "1rem"
9282
9262
  },
9283
- children: /* @__PURE__ */ jsx11(
9263
+ children: /* @__PURE__ */ jsx12(
9284
9264
  FloPayCheckout,
9285
9265
  {
9286
9266
  sessionId: fallbackSession.sessionId,