@flopay/react 0.2.1 → 0.3.4

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
@@ -67,13 +67,61 @@ function FloPayProvider({
67
67
  }
68
68
 
69
69
  // src/flopay-checkout.tsx
70
- import React4, { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef3, useState as useState3 } from "react";
70
+ import React5, { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef3, useState as useState3 } from "react";
71
71
  import { loadFloPay, PaymentAPI } from "@flopay/js";
72
72
  import { FloPayError as FloPayError2, resolveBillingApiUrl as resolveBillingApiUrl3, buildCheckoutDisplayData, resolveButtonsLayoutTheme as resolveButtonsLayoutTheme2 } from "@flopay/shared";
73
73
 
74
+ // src/card-button-content.tsx
75
+ import "react";
76
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
77
+ function DefaultCardButtonContent() {
78
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
79
+ /* @__PURE__ */ jsxs(
80
+ "svg",
81
+ {
82
+ width: "20",
83
+ height: "20",
84
+ viewBox: "0 0 24 24",
85
+ fill: "none",
86
+ stroke: "currentColor",
87
+ strokeWidth: "1.5",
88
+ strokeLinecap: "round",
89
+ strokeLinejoin: "round",
90
+ "aria-hidden": "true",
91
+ children: [
92
+ /* @__PURE__ */ jsx2("rect", { width: "20", height: "14", x: "2", y: "5", rx: "2" }),
93
+ /* @__PURE__ */ jsx2("line", { x1: "2", x2: "22", y1: "10", y2: "10" })
94
+ ]
95
+ }
96
+ ),
97
+ "Credit / Debit Card",
98
+ /* @__PURE__ */ jsx2(
99
+ "svg",
100
+ {
101
+ width: "16",
102
+ height: "16",
103
+ viewBox: "0 0 24 24",
104
+ fill: "none",
105
+ stroke: "#9ca3af",
106
+ strokeWidth: "2",
107
+ strokeLinecap: "round",
108
+ strokeLinejoin: "round",
109
+ style: { position: "absolute", right: "1rem" },
110
+ "aria-hidden": "true",
111
+ children: /* @__PURE__ */ jsx2("path", { d: "M9 18l6-6-6-6" })
112
+ }
113
+ )
114
+ ] });
115
+ }
116
+ function CardButtonContentSlot({
117
+ content
118
+ }) {
119
+ return /* @__PURE__ */ jsx2(Fragment, { children: content ?? /* @__PURE__ */ jsx2(DefaultCardButtonContent, {}) });
120
+ }
121
+
74
122
  // src/elements.tsx
75
123
  import { useEffect as useEffect2, useRef, useContext } from "react";
76
- import { jsx as jsx2 } from "react/jsx-runtime";
124
+ import { jsx as jsx3 } from "react/jsx-runtime";
77
125
  function createElementComponent(elementType, displayName) {
78
126
  function ElementComponent({
79
127
  className,
@@ -119,7 +167,7 @@ function createElementComponent(elementType, displayName) {
119
167
  }
120
168
  };
121
169
  }, [elements]);
122
- return /* @__PURE__ */ jsx2("div", { ref: containerRef, className, id, style });
170
+ return /* @__PURE__ */ jsx3("div", { ref: containerRef, className, id, style });
123
171
  }
124
172
  ElementComponent.displayName = displayName;
125
173
  return ElementComponent;
@@ -138,7 +186,7 @@ import {
138
186
  useElements as useStripeElements,
139
187
  useStripe as useStripeRaw
140
188
  } from "@stripe/react-stripe-js";
141
- import { resolveButtonsLayoutTheme } from "@flopay/shared";
189
+ import { resolveButtonsLayoutTheme, getPostalCodeLabel, COUNTRY_OPTIONS } from "@flopay/shared";
142
190
  import { forwardRef, useCallback, useEffect as useEffect3, useImperativeHandle, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
143
191
 
144
192
  // src/hooks.ts
@@ -162,7 +210,7 @@ function useBillingApiUrl() {
162
210
 
163
211
  // src/split-card-form.tsx
164
212
  import { FloPayError } from "@flopay/shared";
165
- import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
213
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
166
214
  var WALLET_RESUME_KEY = "flopay_wallet_resume";
167
215
  var FLOPAY_KEYFRAMES = `
168
216
  @keyframes flopay-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@@ -185,10 +233,10 @@ var FLOPAY_KEYFRAMES = `
185
233
  }
186
234
  `;
187
235
  function FloPayKeyframes() {
188
- return /* @__PURE__ */ jsx3("style", { children: FLOPAY_KEYFRAMES });
236
+ return /* @__PURE__ */ jsx4("style", { children: FLOPAY_KEYFRAMES });
189
237
  }
190
238
  function ProcessingOverlay({ status, errorMessage }) {
191
- return /* @__PURE__ */ jsx3("div", { style: {
239
+ return /* @__PURE__ */ jsx4("div", { style: {
192
240
  position: "fixed",
193
241
  inset: 0,
194
242
  background: "rgba(0,0,0,0.35)",
@@ -197,7 +245,7 @@ function ProcessingOverlay({ status, errorMessage }) {
197
245
  justifyContent: "center",
198
246
  zIndex: 1e3,
199
247
  backdropFilter: "blur(2px)"
200
- }, children: /* @__PURE__ */ jsxs("div", { style: {
248
+ }, children: /* @__PURE__ */ jsxs2("div", { style: {
201
249
  background: "white",
202
250
  borderRadius: 12,
203
251
  padding: "2rem 2.5rem",
@@ -209,8 +257,8 @@ function ProcessingOverlay({ status, errorMessage }) {
209
257
  alignItems: "center",
210
258
  gap: 16
211
259
  }, children: [
212
- /* @__PURE__ */ jsxs("div", { style: { width: 48, height: 48, position: "relative" }, children: [
213
- status === "processing" && /* @__PURE__ */ jsxs(
260
+ /* @__PURE__ */ jsxs2("div", { style: { width: 48, height: 48, position: "relative" }, children: [
261
+ status === "processing" && /* @__PURE__ */ jsxs2(
214
262
  "svg",
215
263
  {
216
264
  width: "48",
@@ -220,14 +268,14 @@ function ProcessingOverlay({ status, errorMessage }) {
220
268
  xmlns: "http://www.w3.org/2000/svg",
221
269
  style: { animation: "flopay-spin 0.8s linear infinite" },
222
270
  children: [
223
- /* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "10", stroke: "#e5e7eb", strokeWidth: "3" }),
224
- /* @__PURE__ */ jsx3("path", { d: "M4 12a8 8 0 018-8v3a5 5 0 00-5 5H4z", fill: "#4A49FF" })
271
+ /* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "10", stroke: "#e5e7eb", strokeWidth: "3" }),
272
+ /* @__PURE__ */ jsx4("path", { d: "M4 12a8 8 0 018-8v3a5 5 0 00-5 5H4z", fill: "#4A49FF" })
225
273
  ]
226
274
  }
227
275
  ),
228
- status === "success" && /* @__PURE__ */ jsx3("div", { style: { animation: "flopay-pop 0.4s cubic-bezier(0.34,1.56,0.64,1)" }, children: /* @__PURE__ */ jsxs("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
229
- /* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "11", fill: "#22c55e" }),
230
- /* @__PURE__ */ jsx3(
276
+ status === "success" && /* @__PURE__ */ jsx4("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: [
277
+ /* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "11", fill: "#22c55e" }),
278
+ /* @__PURE__ */ jsx4(
231
279
  "path",
232
280
  {
233
281
  d: "M7 12.5l3 3 7-7",
@@ -239,9 +287,9 @@ function ProcessingOverlay({ status, errorMessage }) {
239
287
  }
240
288
  )
241
289
  ] }) }),
242
- status === "error" && /* @__PURE__ */ jsx3("div", { style: { animation: "flopay-shake 0.4s ease" }, children: /* @__PURE__ */ jsxs("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
243
- /* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "11", fill: "#ef4444" }),
244
- /* @__PURE__ */ jsx3(
290
+ status === "error" && /* @__PURE__ */ jsx4("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: [
291
+ /* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "11", fill: "#ef4444" }),
292
+ /* @__PURE__ */ jsx4(
245
293
  "path",
246
294
  {
247
295
  d: "M8 8l8 8M16 8l-8 8",
@@ -253,7 +301,7 @@ function ProcessingOverlay({ status, errorMessage }) {
253
301
  )
254
302
  ] }) })
255
303
  ] }),
256
- /* @__PURE__ */ jsxs("span", { style: {
304
+ /* @__PURE__ */ jsxs2("span", { style: {
257
305
  fontSize: 14,
258
306
  fontWeight: 600,
259
307
  letterSpacing: "0.05em",
@@ -263,7 +311,7 @@ function ProcessingOverlay({ status, errorMessage }) {
263
311
  status === "success" && "PAYMENT SUCCESSFUL",
264
312
  status === "error" && "PAYMENT FAILED"
265
313
  ] }),
266
- status === "error" && errorMessage && /* @__PURE__ */ jsx3("p", { style: {
314
+ status === "error" && errorMessage && /* @__PURE__ */ jsx4("p", { style: {
267
315
  fontSize: 13,
268
316
  color: "#6b7280",
269
317
  fontWeight: 400,
@@ -271,7 +319,7 @@ function ProcessingOverlay({ status, errorMessage }) {
271
319
  lineHeight: 1.4,
272
320
  margin: 0
273
321
  }, children: errorMessage }),
274
- /* @__PURE__ */ jsx3("style", { children: `
322
+ /* @__PURE__ */ jsx4("style", { children: `
275
323
  @keyframes flopay-spin { to { transform: rotate(360deg); } }
276
324
  @keyframes flopay-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
277
325
  @keyframes flopay-draw { to { stroke-dashoffset: 0; } }
@@ -281,7 +329,7 @@ function ProcessingOverlay({ status, errorMessage }) {
281
329
  }
282
330
  var SplitCardForm = forwardRef(
283
331
  function SplitCardForm2(props, ref) {
284
- return /* @__PURE__ */ jsx3(SplitCardFormInner, { ...props, innerRef: ref });
332
+ return /* @__PURE__ */ jsx4(SplitCardFormInner, { ...props, innerRef: ref });
285
333
  }
286
334
  );
287
335
  function PayPalButtonInner({
@@ -398,8 +446,8 @@ function PayPalButtonInner({
398
446
  setSubmitting(false);
399
447
  }
400
448
  }, [stripe, elements, sessionId, email, baseUrl, onTokenizedBody, onErrorChange]);
401
- return /* @__PURE__ */ jsxs(Fragment, { children: [
402
- /* @__PURE__ */ jsx3("div", { children: /* @__PURE__ */ jsx3(
449
+ return /* @__PURE__ */ jsxs2(Fragment2, { children: [
450
+ /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(
403
451
  ExpressCheckoutElement,
404
452
  {
405
453
  onReady: () => setReady(true),
@@ -417,7 +465,7 @@ function PayPalButtonInner({
417
465
  }
418
466
  }
419
467
  ) }),
420
- submitting && /* @__PURE__ */ jsx3(ProcessingOverlay, { status: "processing" })
468
+ submitting && /* @__PURE__ */ jsx4(ProcessingOverlay, { status: "processing" })
421
469
  ] });
422
470
  }
423
471
  function WalletButtonInner({
@@ -491,8 +539,8 @@ function WalletButtonInner({
491
539
  },
492
540
  [stripe, elements, sessionId, email, baseUrl, onTokenizedBody, onErrorChange]
493
541
  );
494
- return /* @__PURE__ */ jsxs(Fragment, { children: [
495
- /* @__PURE__ */ jsx3("div", { children: /* @__PURE__ */ jsx3(
542
+ return /* @__PURE__ */ jsxs2(Fragment2, { children: [
543
+ /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(
496
544
  ExpressCheckoutElement,
497
545
  {
498
546
  onReady: () => setReady(true),
@@ -513,7 +561,7 @@ function WalletButtonInner({
513
561
  }
514
562
  }
515
563
  ) }),
516
- submitting && /* @__PURE__ */ jsx3(ProcessingOverlay, { status: "processing" })
564
+ submitting && /* @__PURE__ */ jsx4(ProcessingOverlay, { status: "processing" })
517
565
  ] });
518
566
  }
519
567
  function SplitCardFormInner({
@@ -541,7 +589,14 @@ function SplitCardFormInner({
541
589
  layout = "default",
542
590
  buttonsTheme,
543
591
  buttonsStyles: buttonsStylesOverride,
592
+ cardButtonContent,
544
593
  onButtonClick,
594
+ enableAVS = false,
595
+ avsLayout: avsLayoutProp = "row",
596
+ country: countryProp,
597
+ zip: zipProp,
598
+ onCountryChange,
599
+ onZipChange,
545
600
  totalAmount = 0,
546
601
  currency = "usd",
547
602
  innerRef
@@ -552,6 +607,10 @@ function SplitCardFormInner({
552
607
  const [processing, setProcessing] = useState2(false);
553
608
  const [error, setError] = useState2(null);
554
609
  const [is3DSActive, setIs3DSActive] = useState2(false);
610
+ const [selectedCountry, setSelectedCountry] = useState2(countryProp ?? "US");
611
+ const [zipCode, setZipCode] = useState2(zipProp ?? "");
612
+ const zipCodeRef = useRef2(zipProp ?? "");
613
+ const selectedCountryRef = useRef2(countryProp ?? "US");
555
614
  const [viewState, setViewState] = useState2("buttons");
556
615
  const showCardForm = viewState === "expanding" || viewState === "card";
557
616
  const TRANSITION_MS = 280;
@@ -639,7 +698,8 @@ function SplitCardFormInner({
639
698
  userId: userId ?? "",
640
699
  email: email ?? "",
641
700
  firstName: firstName ?? fullName.trim().split(/\s+/)[0] ?? "",
642
- lastName: lastName ?? fullName.trim().split(/\s+/).slice(1).join(" ") ?? ""
701
+ lastName: lastName ?? fullName.trim().split(/\s+/).slice(1).join(" ") ?? "",
702
+ ...enableAVS ? { zip: zipCodeRef.current, country: selectedCountryRef.current } : {}
643
703
  },
644
704
  chv
645
705
  })
@@ -800,13 +860,24 @@ function SplitCardFormInner({
800
860
  updateError(null);
801
861
  let handedOff = false;
802
862
  try {
863
+ if (enableAVS && !zipCodeRef.current.trim()) {
864
+ updateError(getPostalCodeLabel(selectedCountryRef.current) + " is required");
865
+ return;
866
+ }
803
867
  const submitResult = await flopay.submitElements();
804
868
  if (submitResult.error) {
805
869
  updateError(submitResult.error.message);
806
870
  onError?.(submitResult.error);
807
871
  return;
808
872
  }
809
- const pmResult = await flopay.createPaymentMethod();
873
+ const billingDetails = enableAVS ? {
874
+ name: fullName,
875
+ address: {
876
+ country: selectedCountryRef.current,
877
+ postal_code: zipCodeRef.current
878
+ }
879
+ } : void 0;
880
+ const pmResult = await flopay.createPaymentMethod(billingDetails);
810
881
  if (pmResult.error || !pmResult.paymentMethodId) {
811
882
  updateError(pmResult.error?.message ?? "Failed to create payment method.");
812
883
  return;
@@ -859,7 +930,7 @@ function SplitCardFormInner({
859
930
  );
860
931
  const isReady = flopay !== null && elements !== null;
861
932
  if (!isReady) {
862
- return /* @__PURE__ */ jsx3("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." });
933
+ return /* @__PURE__ */ jsx4("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." });
863
934
  }
864
935
  const isButtons = layout === "buttons";
865
936
  const resolvedBorder = isButtons ? bStyles.cardInputBorder ?? "#e5e7eb" : "#A4A4FF";
@@ -875,19 +946,19 @@ function SplitCardFormInner({
875
946
  invalid: { color: "#ef4444" }
876
947
  }
877
948
  } : {};
878
- const cardFormBlock = /* @__PURE__ */ jsxs("div", { style: {
949
+ const cardFormBlock = /* @__PURE__ */ jsxs2("div", { style: {
879
950
  backgroundColor: cardBg,
880
951
  borderRadius: "8px",
881
952
  padding: isButtons ? "0" : "1rem",
882
953
  ...isButtons ? bStyles.cardFormContainer : {},
883
954
  ...isButtons ? { padding: bStyles.cardFormContainer?.padding ?? "0" } : {}
884
955
  }, children: [
885
- isButtons && showCardForm && /* @__PURE__ */ jsxs("div", { style: {
956
+ isButtons && showCardForm && /* @__PURE__ */ jsxs2("div", { style: {
886
957
  display: "flex",
887
958
  alignItems: "center",
888
959
  padding: "0.75rem 0 0.625rem"
889
960
  }, children: [
890
- /* @__PURE__ */ jsxs(
961
+ /* @__PURE__ */ jsxs2(
891
962
  "button",
892
963
  {
893
964
  type: "button",
@@ -909,7 +980,7 @@ function SplitCardFormInner({
909
980
  },
910
981
  "aria-label": "Back to payment methods",
911
982
  children: [
912
- /* @__PURE__ */ jsx3("span", { style: {
983
+ /* @__PURE__ */ jsx4("span", { style: {
913
984
  display: "inline-flex",
914
985
  alignItems: "center",
915
986
  justifyContent: "center",
@@ -919,12 +990,12 @@ function SplitCardFormInner({
919
990
  backgroundColor: "#f3f4f6",
920
991
  transition: "background-color 0.15s",
921
992
  ...bStyles.backButtonIcon
922
- }, children: /* @__PURE__ */ jsx3("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx3("path", { d: "M15 18l-6-6 6-6" }) }) }),
993
+ }, children: /* @__PURE__ */ jsx4("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx4("path", { d: "M15 18l-6-6 6-6" }) }) }),
923
994
  "Go back"
924
995
  ]
925
996
  }
926
997
  ),
927
- /* @__PURE__ */ jsx3("div", { style: {
998
+ /* @__PURE__ */ jsx4("div", { style: {
928
999
  flex: 1,
929
1000
  textAlign: "center",
930
1001
  fontWeight: 600,
@@ -934,16 +1005,16 @@ function SplitCardFormInner({
934
1005
  ...bStyles.title
935
1006
  }, children: "Secure card checkout" })
936
1007
  ] }),
937
- !isButtons && /* @__PURE__ */ jsx3("div", { style: { textAlign: "center", fontWeight: 600, fontSize: "1.1rem", padding: "0.5rem 0", color: "#262833" }, children: "Secure card checkout" }),
938
- /* @__PURE__ */ jsx3("div", { style: {
1008
+ !isButtons && /* @__PURE__ */ jsx4("div", { style: { textAlign: "center", fontWeight: 600, fontSize: "1.1rem", padding: "0.5rem 0", color: "#262833" }, children: "Secure card checkout" }),
1009
+ /* @__PURE__ */ jsx4("div", { style: {
939
1010
  backgroundColor: cardInputBg,
940
1011
  border: `1px solid ${resolvedBorder}`,
941
1012
  borderTopLeftRadius: "8px",
942
1013
  borderTopRightRadius: "8px",
943
1014
  padding: "10px"
944
- }, children: /* @__PURE__ */ jsx3(CardNumberElement, { onReady: () => setFormReady(true), options: stripeElementStyle }) }),
945
- /* @__PURE__ */ jsxs("div", { style: { display: "flex" }, children: [
946
- /* @__PURE__ */ jsx3("div", { style: {
1015
+ }, children: /* @__PURE__ */ jsx4(CardNumberElement, { onReady: () => setFormReady(true), options: stripeElementStyle }) }),
1016
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex" }, children: [
1017
+ /* @__PURE__ */ jsx4("div", { style: {
947
1018
  flex: 1,
948
1019
  backgroundColor: cardInputBg,
949
1020
  border: `1px solid ${resolvedBorder}`,
@@ -951,23 +1022,23 @@ function SplitCardFormInner({
951
1022
  borderRight: "none",
952
1023
  borderBottomLeftRadius: "8px",
953
1024
  padding: "10px"
954
- }, children: /* @__PURE__ */ jsx3(CardExpiryElement, { options: stripeElementStyle }) }),
955
- /* @__PURE__ */ jsx3("div", { style: {
1025
+ }, children: /* @__PURE__ */ jsx4(CardExpiryElement, { options: stripeElementStyle }) }),
1026
+ /* @__PURE__ */ jsx4("div", { style: {
956
1027
  flex: 1,
957
1028
  backgroundColor: cardInputBg,
958
1029
  border: `1px solid ${resolvedBorder}`,
959
1030
  borderTop: "none",
960
1031
  borderBottomRightRadius: "8px",
961
1032
  padding: "10px"
962
- }, children: /* @__PURE__ */ jsx3(CardCvcElement, { options: stripeElementStyle }) })
1033
+ }, children: /* @__PURE__ */ jsx4(CardCvcElement, { options: stripeElementStyle }) })
963
1034
  ] }),
964
- /* @__PURE__ */ jsx3("div", { style: {
1035
+ /* @__PURE__ */ jsx4("div", { style: {
965
1036
  backgroundColor: cardInputBg,
966
1037
  border: `1px solid ${resolvedBorder}`,
967
1038
  borderRadius: "8px",
968
1039
  marginTop: "0.5rem",
969
1040
  padding: "10px"
970
- }, children: /* @__PURE__ */ jsx3(
1041
+ }, children: /* @__PURE__ */ jsx4(
971
1042
  "input",
972
1043
  {
973
1044
  placeholder: "Full Name on Card",
@@ -988,7 +1059,84 @@ function SplitCardFormInner({
988
1059
  }
989
1060
  }
990
1061
  ) }),
991
- displayError && /* @__PURE__ */ jsxs("div", { role: "alert", "data-testid": "flopay-error", style: {
1062
+ enableAVS && /* @__PURE__ */ jsxs2("div", { style: {
1063
+ display: "flex",
1064
+ flexDirection: avsLayoutProp === "column" ? "column" : "row",
1065
+ gap: avsLayoutProp === "column" ? "0.5rem" : "0",
1066
+ marginTop: "0.5rem"
1067
+ }, children: [
1068
+ /* @__PURE__ */ jsx4("div", { style: {
1069
+ flex: avsLayoutProp === "row" ? 1 : void 0,
1070
+ backgroundColor: cardInputBg,
1071
+ border: `1px solid ${resolvedBorder}`,
1072
+ padding: "10px",
1073
+ ...avsLayoutProp === "row" ? { borderRadius: "0", borderTopLeftRadius: "8px", borderBottomLeftRadius: "8px", borderRight: "none" } : { borderRadius: "8px" },
1074
+ ...isButtons && bStyles.countrySelect ? bStyles.countrySelect : {}
1075
+ }, children: /* @__PURE__ */ jsx4(
1076
+ "select",
1077
+ {
1078
+ value: selectedCountry,
1079
+ onChange: (e) => {
1080
+ selectedCountryRef.current = e.target.value;
1081
+ setSelectedCountry(e.target.value);
1082
+ onCountryChange?.(e.target.value);
1083
+ },
1084
+ disabled: isSubmitting,
1085
+ autoComplete: "country",
1086
+ "data-testid": "flopay-country",
1087
+ style: {
1088
+ width: "100%",
1089
+ border: "none",
1090
+ outline: "none",
1091
+ background: "transparent",
1092
+ fontSize: bStyles.cardInputFontSize ?? "16px",
1093
+ fontFamily: "Poppins, sans-serif",
1094
+ color: bStyles.cardInputColor ?? "#262833",
1095
+ cursor: "pointer",
1096
+ ...isButtons && bStyles.nameInput ? bStyles.nameInput : {}
1097
+ },
1098
+ children: COUNTRY_OPTIONS.map((c) => /* @__PURE__ */ jsxs2("option", { value: c.code, children: [
1099
+ c.flag,
1100
+ " ",
1101
+ c.name
1102
+ ] }, c.code))
1103
+ }
1104
+ ) }),
1105
+ /* @__PURE__ */ jsx4("div", { style: {
1106
+ flex: avsLayoutProp === "row" ? 1 : void 0,
1107
+ backgroundColor: cardInputBg,
1108
+ border: `1px solid ${resolvedBorder}`,
1109
+ padding: "10px",
1110
+ ...avsLayoutProp === "row" ? { borderRadius: "0", borderTopRightRadius: "8px", borderBottomRightRadius: "8px" } : { borderRadius: "8px" },
1111
+ ...isButtons && bStyles.zipInput ? bStyles.zipInput : {}
1112
+ }, children: /* @__PURE__ */ jsx4(
1113
+ "input",
1114
+ {
1115
+ placeholder: getPostalCodeLabel(selectedCountry),
1116
+ autoComplete: "postal-code",
1117
+ value: zipCode,
1118
+ onChange: (e) => {
1119
+ zipCodeRef.current = e.target.value;
1120
+ setZipCode(e.target.value);
1121
+ onZipChange?.(e.target.value);
1122
+ },
1123
+ disabled: isSubmitting,
1124
+ required: true,
1125
+ "data-testid": "flopay-zip",
1126
+ style: {
1127
+ width: "100%",
1128
+ border: "none",
1129
+ outline: "none",
1130
+ background: "transparent",
1131
+ fontSize: bStyles.cardInputFontSize ?? "16px",
1132
+ fontFamily: "Poppins, sans-serif",
1133
+ color: bStyles.cardInputColor ?? "#262833",
1134
+ ...isButtons && bStyles.nameInput ? bStyles.nameInput : {}
1135
+ }
1136
+ }
1137
+ ) })
1138
+ ] }),
1139
+ displayError && /* @__PURE__ */ jsxs2("div", { role: "alert", "data-testid": "flopay-error", style: {
992
1140
  margin: "0.75rem 0",
993
1141
  padding: "0.625rem 0.875rem",
994
1142
  background: "#FEF2F2",
@@ -1002,10 +1150,10 @@ function SplitCardFormInner({
1002
1150
  gap: "0.5rem",
1003
1151
  ...isButtons && bStyles.errorBanner ? bStyles.errorBanner : {}
1004
1152
  }, children: [
1005
- /* @__PURE__ */ jsx3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx3("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" }) }),
1153
+ /* @__PURE__ */ jsx4("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx4("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" }) }),
1006
1154
  displayError
1007
1155
  ] }),
1008
- children ?? /* @__PURE__ */ jsx3(
1156
+ children ?? /* @__PURE__ */ jsx4(
1009
1157
  "button",
1010
1158
  {
1011
1159
  type: "submit",
@@ -1028,7 +1176,7 @@ function SplitCardFormInner({
1028
1176
  children: isSubmitting ? "PROCESSING..." : submitLabel
1029
1177
  }
1030
1178
  ),
1031
- !isButtons && /* @__PURE__ */ jsx3("div", { style: {
1179
+ !isButtons && /* @__PURE__ */ jsx4("div", { style: {
1032
1180
  backgroundColor: "#EFF9F0",
1033
1181
  borderRadius: "8px",
1034
1182
  padding: "0.75rem",
@@ -1044,11 +1192,11 @@ function SplitCardFormInner({
1044
1192
  const isCardView = viewState === "expanding" || viewState === "card" || viewState === "collapsing";
1045
1193
  const buttonsAnim = viewState === "expanding" ? `flopay-buttons-exit ${TRANSITION_MS}ms cubic-bezier(0.4, 0, 0.2, 1) both` : viewState === "collapsing" ? `flopay-buttons-enter ${TRANSITION_MS}ms cubic-bezier(0, 0, 0.2, 1) both` : void 0;
1046
1194
  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;
1047
- return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
1048
- /* @__PURE__ */ jsx3(FloPayKeyframes, {}),
1049
- overlayStatus && /* @__PURE__ */ jsx3(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
1050
- /* @__PURE__ */ jsxs("div", { style: { display: "grid" }, children: [
1051
- /* @__PURE__ */ jsxs("div", { style: {
1195
+ return /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
1196
+ /* @__PURE__ */ jsx4(FloPayKeyframes, {}),
1197
+ overlayStatus && /* @__PURE__ */ jsx4(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
1198
+ /* @__PURE__ */ jsxs2("div", { style: { display: "grid" }, children: [
1199
+ /* @__PURE__ */ jsxs2("div", { style: {
1052
1200
  gridArea: "1 / 1",
1053
1201
  display: "flex",
1054
1202
  flexDirection: "column",
@@ -1057,7 +1205,7 @@ function SplitCardFormInner({
1057
1205
  ...!isButtonsView && !buttonsAnim ? { visibility: "hidden", position: "absolute", pointerEvents: "none", width: "100%" } : {},
1058
1206
  ...buttonsAnim ? { animation: buttonsAnim, pointerEvents: "none" } : {}
1059
1207
  }, children: [
1060
- showPayPal && stripeInstance ? /* @__PURE__ */ jsx3(StripeElements, { stripe: stripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx3(
1208
+ showPayPal && stripeInstance ? /* @__PURE__ */ jsx4(StripeElements, { stripe: stripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx4(
1061
1209
  PayPalButtonInner,
1062
1210
  {
1063
1211
  sessionId,
@@ -1068,8 +1216,8 @@ function SplitCardFormInner({
1068
1216
  isProcessing: isSubmitting,
1069
1217
  onButtonClick
1070
1218
  }
1071
- ) }) : showPayPal ? /* @__PURE__ */ jsx3("div", { style: { height: 44, borderRadius: 8, background: "#e5e7eb", animation: "flopay-pulse 1.5s ease-in-out infinite" } }) : null,
1072
- showWallets && stripeInstance ? /* @__PURE__ */ jsx3(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx3(
1219
+ ) }) : showPayPal ? /* @__PURE__ */ jsx4("div", { style: { height: 44, borderRadius: 8, background: "#e5e7eb", animation: "flopay-pulse 1.5s ease-in-out infinite" } }) : null,
1220
+ showWallets && stripeInstance ? /* @__PURE__ */ jsx4(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx4(
1073
1221
  WalletButtonInner,
1074
1222
  {
1075
1223
  sessionId,
@@ -1081,8 +1229,8 @@ function SplitCardFormInner({
1081
1229
  onErrorChange: updateError,
1082
1230
  onButtonClick
1083
1231
  }
1084
- ) }) : showWallets ? /* @__PURE__ */ jsx3("div", { style: { height: 44, borderRadius: 8, background: "#e5e7eb", animation: "flopay-pulse 1.5s ease-in-out infinite" } }) : null,
1085
- /* @__PURE__ */ jsxs(
1232
+ ) }) : showWallets ? /* @__PURE__ */ jsx4("div", { style: { height: 44, borderRadius: 8, background: "#e5e7eb", animation: "flopay-pulse 1.5s ease-in-out infinite" } }) : null,
1233
+ /* @__PURE__ */ jsx4(
1086
1234
  "button",
1087
1235
  {
1088
1236
  type: "button",
@@ -1115,17 +1263,10 @@ function SplitCardFormInner({
1115
1263
  onMouseUp: (e) => {
1116
1264
  e.currentTarget.style.transform = "scale(1)";
1117
1265
  },
1118
- children: [
1119
- /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
1120
- /* @__PURE__ */ jsx3("rect", { width: "20", height: "14", x: "2", y: "5", rx: "2" }),
1121
- /* @__PURE__ */ jsx3("line", { x1: "2", x2: "22", y1: "10", y2: "10" })
1122
- ] }),
1123
- "Credit / Debit Card",
1124
- /* @__PURE__ */ jsx3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "#9ca3af", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { position: "absolute", right: "1rem" }, children: /* @__PURE__ */ jsx3("path", { d: "M9 18l6-6-6-6" }) })
1125
- ]
1266
+ children: /* @__PURE__ */ jsx4(CardButtonContentSlot, { content: cardButtonContent })
1126
1267
  }
1127
1268
  ),
1128
- displayError && viewState === "buttons" && /* @__PURE__ */ jsxs("div", { role: "alert", "data-testid": "flopay-error", style: {
1269
+ displayError && viewState === "buttons" && /* @__PURE__ */ jsxs2("div", { role: "alert", "data-testid": "flopay-error", style: {
1129
1270
  margin: "0.25rem 0",
1130
1271
  padding: "0.625rem 0.875rem",
1131
1272
  background: "#FEF2F2",
@@ -1139,11 +1280,11 @@ function SplitCardFormInner({
1139
1280
  gap: "0.5rem",
1140
1281
  ...bStyles.errorBanner ? bStyles.errorBanner : {}
1141
1282
  }, children: [
1142
- /* @__PURE__ */ jsx3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx3("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" }) }),
1283
+ /* @__PURE__ */ jsx4("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx4("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" }) }),
1143
1284
  displayError
1144
1285
  ] })
1145
1286
  ] }),
1146
- isCardView && /* @__PURE__ */ jsx3("div", { style: {
1287
+ isCardView && /* @__PURE__ */ jsx4("div", { style: {
1147
1288
  gridArea: "1 / 1",
1148
1289
  ...cardAnim ? { animation: cardAnim } : {},
1149
1290
  ...viewState === "collapsing" ? { pointerEvents: "none" } : {}
@@ -1151,10 +1292,10 @@ function SplitCardFormInner({
1151
1292
  ] })
1152
1293
  ] });
1153
1294
  }
1154
- return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
1155
- /* @__PURE__ */ jsx3(FloPayKeyframes, {}),
1156
- overlayStatus && /* @__PURE__ */ jsx3(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
1157
- showWallets && stripeInstance && /* @__PURE__ */ jsx3(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx3(
1295
+ return /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
1296
+ /* @__PURE__ */ jsx4(FloPayKeyframes, {}),
1297
+ overlayStatus && /* @__PURE__ */ jsx4(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
1298
+ showWallets && stripeInstance && /* @__PURE__ */ jsx4(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx4(
1158
1299
  WalletButtonInner,
1159
1300
  {
1160
1301
  sessionId,
@@ -1166,7 +1307,7 @@ function SplitCardFormInner({
1166
1307
  onErrorChange: updateError
1167
1308
  }
1168
1309
  ) }),
1169
- showPayPal && stripeInstance && /* @__PURE__ */ jsx3(StripeElements, { stripe: stripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx3(
1310
+ showPayPal && stripeInstance && /* @__PURE__ */ jsx4(StripeElements, { stripe: stripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx4(
1170
1311
  PayPalButtonInner,
1171
1312
  {
1172
1313
  sessionId,
@@ -1177,7 +1318,7 @@ function SplitCardFormInner({
1177
1318
  isProcessing: isSubmitting
1178
1319
  }
1179
1320
  ) }),
1180
- (showWallets && stripeInstance || showPayPal && stripeInstance) && /* @__PURE__ */ jsxs("div", { style: {
1321
+ (showWallets && stripeInstance || showPayPal && stripeInstance) && /* @__PURE__ */ jsxs2("div", { style: {
1181
1322
  display: "flex",
1182
1323
  alignItems: "center",
1183
1324
  gap: "0.75rem",
@@ -1185,16 +1326,16 @@ function SplitCardFormInner({
1185
1326
  color: "#999",
1186
1327
  fontSize: "0.85rem"
1187
1328
  }, children: [
1188
- /* @__PURE__ */ jsx3("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } }),
1189
- /* @__PURE__ */ jsx3("span", { children: "or pay with card" }),
1190
- /* @__PURE__ */ jsx3("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } })
1329
+ /* @__PURE__ */ jsx4("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } }),
1330
+ /* @__PURE__ */ jsx4("span", { children: "or pay with card" }),
1331
+ /* @__PURE__ */ jsx4("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } })
1191
1332
  ] }),
1192
1333
  cardFormBlock
1193
1334
  ] });
1194
1335
  }
1195
1336
 
1196
1337
  // src/flopay-checkout.tsx
1197
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
1338
+ import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1198
1339
  function FloPayCheckout({
1199
1340
  sessionId: sessionIdProp,
1200
1341
  createSession: createSessionParams,
@@ -1212,7 +1353,10 @@ function FloPayCheckout({
1212
1353
  layout,
1213
1354
  buttonsTheme,
1214
1355
  buttonsStyles,
1356
+ cardButtonContent,
1215
1357
  onButtonClick,
1358
+ enableAVS,
1359
+ avsLayout,
1216
1360
  submitLabel,
1217
1361
  className,
1218
1362
  children,
@@ -1615,23 +1759,23 @@ function FloPayCheckout({
1615
1759
  [session, isLoading, loadError, currentMode]
1616
1760
  );
1617
1761
  if (isLoading) {
1618
- if (loadingNode) return /* @__PURE__ */ jsx4(Fragment2, { children: loadingNode });
1762
+ if (loadingNode) return /* @__PURE__ */ jsx5(Fragment3, { children: loadingNode });
1619
1763
  if (layout === "buttons") {
1620
- const skeletonBar = (h) => /* @__PURE__ */ jsx4("div", { style: {
1764
+ const skeletonBar = (h) => /* @__PURE__ */ jsx5("div", { style: {
1621
1765
  height: h,
1622
1766
  borderRadius: 8,
1623
1767
  background: "#e5e7eb",
1624
1768
  animation: "flopay-loading-pulse 1.5s ease-in-out infinite"
1625
1769
  } });
1626
- return /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
1770
+ return /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
1627
1771
  showPayPal && skeletonBar(44),
1628
1772
  (showApplePay || showGooglePay) && skeletonBar(44),
1629
1773
  skeletonBar(48),
1630
- /* @__PURE__ */ jsx4("style", { children: `@keyframes flopay-loading-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
1774
+ /* @__PURE__ */ jsx5("style", { children: `@keyframes flopay-loading-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
1631
1775
  ] });
1632
1776
  }
1633
- return /* @__PURE__ */ jsxs2("div", { style: { display: "flex", justifyContent: "center", padding: 32 }, children: [
1634
- /* @__PURE__ */ jsx4("div", { style: {
1777
+ return /* @__PURE__ */ jsxs3("div", { style: { display: "flex", justifyContent: "center", padding: 32 }, children: [
1778
+ /* @__PURE__ */ jsx5("div", { style: {
1635
1779
  width: 24,
1636
1780
  height: 24,
1637
1781
  border: "2px solid #e5e7eb",
@@ -1639,12 +1783,12 @@ function FloPayCheckout({
1639
1783
  borderRadius: "50%",
1640
1784
  animation: "spin 0.6s linear infinite"
1641
1785
  } }),
1642
- /* @__PURE__ */ jsx4("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` })
1786
+ /* @__PURE__ */ jsx5("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` })
1643
1787
  ] });
1644
1788
  }
1645
1789
  if (loadError) {
1646
- if (errorNode) return /* @__PURE__ */ jsx4(Fragment2, { children: errorNode(loadError) });
1647
- return /* @__PURE__ */ jsx4(
1790
+ if (errorNode) return /* @__PURE__ */ jsx5(Fragment3, { children: errorNode(loadError) });
1791
+ return /* @__PURE__ */ jsx5(
1648
1792
  "div",
1649
1793
  {
1650
1794
  style: {
@@ -1658,7 +1802,7 @@ function FloPayCheckout({
1658
1802
  );
1659
1803
  }
1660
1804
  if ((!flopay || !providerOptions) && createSessionParams && layout === "buttons") {
1661
- return /* @__PURE__ */ jsx4(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx4(
1805
+ return /* @__PURE__ */ jsx5(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx5(
1662
1806
  InterimButtonsView,
1663
1807
  {
1664
1808
  onButtonClick,
@@ -1666,14 +1810,15 @@ function FloPayCheckout({
1666
1810
  showApplePay,
1667
1811
  showGooglePay,
1668
1812
  buttonsTheme,
1669
- buttonsStyles
1813
+ buttonsStyles,
1814
+ cardButtonContent
1670
1815
  }
1671
1816
  ) });
1672
1817
  }
1673
- if (!flopay || !providerOptions) return /* @__PURE__ */ jsx4(Fragment2, {});
1818
+ if (!flopay || !providerOptions) return /* @__PURE__ */ jsx5(Fragment3, {});
1674
1819
  if (currentMode === "confirm") {
1675
- return /* @__PURE__ */ jsx4(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx4(FloPayProvider, { flopay, options: providerOptions, children: /* @__PURE__ */ jsxs2("div", { className, children: [
1676
- modeError && /* @__PURE__ */ jsx4(
1820
+ return /* @__PURE__ */ jsx5(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx5(FloPayProvider, { flopay, options: providerOptions, children: /* @__PURE__ */ jsxs3("div", { className, children: [
1821
+ modeError && /* @__PURE__ */ jsx5(
1677
1822
  "div",
1678
1823
  {
1679
1824
  style: {
@@ -1688,7 +1833,7 @@ function FloPayCheckout({
1688
1833
  renderConfirmButton ? renderConfirmButton({
1689
1834
  onConfirm: handleConfirmCheckout,
1690
1835
  isProcessing: confirmProcessing
1691
- }) : /* @__PURE__ */ jsx4(
1836
+ }) : /* @__PURE__ */ jsx5(
1692
1837
  "button",
1693
1838
  {
1694
1839
  type: "button",
@@ -1711,8 +1856,8 @@ function FloPayCheckout({
1711
1856
  )
1712
1857
  ] }) }) });
1713
1858
  }
1714
- return /* @__PURE__ */ jsx4(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsxs2(FloPayProvider, { flopay, options: providerOptions, children: [
1715
- modeError && /* @__PURE__ */ jsx4(
1859
+ return /* @__PURE__ */ jsx5(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsxs3(FloPayProvider, { flopay, options: providerOptions, children: [
1860
+ modeError && /* @__PURE__ */ jsx5(
1716
1861
  "div",
1717
1862
  {
1718
1863
  style: {
@@ -1727,7 +1872,7 @@ function FloPayCheckout({
1727
1872
  children: modeError
1728
1873
  }
1729
1874
  ),
1730
- children ? /* @__PURE__ */ jsx4(
1875
+ children ? /* @__PURE__ */ jsx5(
1731
1876
  SessionInjector,
1732
1877
  {
1733
1878
  sessionId: resolvedSessionId,
@@ -1735,7 +1880,7 @@ function FloPayCheckout({
1735
1880
  session,
1736
1881
  children
1737
1882
  }
1738
- ) : /* @__PURE__ */ jsx4(
1883
+ ) : /* @__PURE__ */ jsx5(
1739
1884
  SplitCardForm,
1740
1885
  {
1741
1886
  sessionId: resolvedSessionId,
@@ -1753,7 +1898,12 @@ function FloPayCheckout({
1753
1898
  layout,
1754
1899
  buttonsTheme,
1755
1900
  buttonsStyles,
1901
+ cardButtonContent,
1756
1902
  onButtonClick,
1903
+ enableAVS,
1904
+ avsLayout,
1905
+ country: session?.customer?.country,
1906
+ zip: session?.customer?.zip,
1757
1907
  submitLabel,
1758
1908
  className
1759
1909
  }
@@ -1766,8 +1916,8 @@ function SessionInjector({
1766
1916
  session,
1767
1917
  children
1768
1918
  }) {
1769
- return /* @__PURE__ */ jsx4(Fragment2, { children: React4.Children.map(children, (child) => {
1770
- if (!React4.isValidElement(child)) return child;
1919
+ return /* @__PURE__ */ jsx5(Fragment3, { children: React5.Children.map(children, (child) => {
1920
+ if (!React5.isValidElement(child)) return child;
1771
1921
  const existing = child.props;
1772
1922
  const injected = {};
1773
1923
  if (!existing.sessionId) injected.sessionId = sessionId;
@@ -1781,7 +1931,7 @@ function SessionInjector({
1781
1931
  injected.lastName = session.customer.lastName;
1782
1932
  }
1783
1933
  if (Object.keys(injected).length === 0) return child;
1784
- return React4.cloneElement(child, injected);
1934
+ return React5.cloneElement(child, injected);
1785
1935
  }) });
1786
1936
  }
1787
1937
  function InterimButtonsView({
@@ -1790,7 +1940,8 @@ function InterimButtonsView({
1790
1940
  showApplePay,
1791
1941
  showGooglePay,
1792
1942
  buttonsTheme,
1793
- buttonsStyles: stylesOverride
1943
+ buttonsStyles: stylesOverride,
1944
+ cardButtonContent
1794
1945
  }) {
1795
1946
  const [showCardForm, setShowCardForm] = useState3(false);
1796
1947
  const bStyles = useMemo3(() => {
@@ -1805,7 +1956,7 @@ function InterimButtonsView({
1805
1956
  title: { ...base.title, ...stylesOverride.title }
1806
1957
  };
1807
1958
  }, [buttonsTheme, stylesOverride]);
1808
- const skeleton = (h) => /* @__PURE__ */ jsx4("div", { style: {
1959
+ const skeleton = (h) => /* @__PURE__ */ jsx5("div", { style: {
1809
1960
  height: h,
1810
1961
  borderRadius: 8,
1811
1962
  background: "#e5e7eb",
@@ -1814,15 +1965,15 @@ function InterimButtonsView({
1814
1965
  if (showCardForm) {
1815
1966
  const inputBorder = bStyles.cardInputBorder ?? "#e5e7eb";
1816
1967
  const inputBg = bStyles.cardInputBackground ?? "white";
1817
- return /* @__PURE__ */ jsxs2("div", { style: {
1968
+ return /* @__PURE__ */ jsxs3("div", { style: {
1818
1969
  backgroundColor: bStyles.cardFormContainer?.backgroundColor ?? "white",
1819
1970
  borderRadius: "8px",
1820
1971
  animation: "flopay-interim-expand 0.35s cubic-bezier(0.4, 0, 0.2, 1) both",
1821
1972
  overflow: "hidden",
1822
1973
  ...bStyles.cardFormContainer
1823
1974
  }, children: [
1824
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", padding: "0.75rem 0 0.625rem" }, children: [
1825
- /* @__PURE__ */ jsxs2(
1975
+ /* @__PURE__ */ jsxs3("div", { style: { display: "flex", alignItems: "center", padding: "0.75rem 0 0.625rem" }, children: [
1976
+ /* @__PURE__ */ jsxs3(
1826
1977
  "button",
1827
1978
  {
1828
1979
  type: "button",
@@ -1842,7 +1993,7 @@ function InterimButtonsView({
1842
1993
  ...bStyles.backButton
1843
1994
  },
1844
1995
  children: [
1845
- /* @__PURE__ */ jsx4("span", { style: {
1996
+ /* @__PURE__ */ jsx5("span", { style: {
1846
1997
  display: "inline-flex",
1847
1998
  alignItems: "center",
1848
1999
  justifyContent: "center",
@@ -1851,12 +2002,12 @@ function InterimButtonsView({
1851
2002
  borderRadius: "50%",
1852
2003
  backgroundColor: "#f3f4f6",
1853
2004
  ...bStyles.backButtonIcon
1854
- }, children: /* @__PURE__ */ jsx4("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx4("path", { d: "M15 18l-6-6 6-6" }) }) }),
2005
+ }, children: /* @__PURE__ */ jsx5("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx5("path", { d: "M15 18l-6-6 6-6" }) }) }),
1855
2006
  "Go back"
1856
2007
  ]
1857
2008
  }
1858
2009
  ),
1859
- /* @__PURE__ */ jsx4("div", { style: {
2010
+ /* @__PURE__ */ jsx5("div", { style: {
1860
2011
  flex: 1,
1861
2012
  textAlign: "center",
1862
2013
  fontWeight: 600,
@@ -1866,13 +2017,13 @@ function InterimButtonsView({
1866
2017
  ...bStyles.title
1867
2018
  }, children: "Secure card checkout" })
1868
2019
  ] }),
1869
- /* @__PURE__ */ jsx4("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTopLeftRadius: 8, borderTopRightRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx4("div", { style: { width: "60%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
1870
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex" }, children: [
1871
- /* @__PURE__ */ jsx4("div", { style: { flex: 1, backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTop: "none", borderRight: "none", borderBottomLeftRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx4("div", { style: { width: "50%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
1872
- /* @__PURE__ */ jsx4("div", { style: { flex: 1, backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTop: "none", borderBottomRightRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx4("div", { style: { width: "40%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) })
2020
+ /* @__PURE__ */ jsx5("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTopLeftRadius: 8, borderTopRightRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx5("div", { style: { width: "60%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
2021
+ /* @__PURE__ */ jsxs3("div", { style: { display: "flex" }, children: [
2022
+ /* @__PURE__ */ jsx5("div", { style: { flex: 1, backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTop: "none", borderRight: "none", borderBottomLeftRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx5("div", { style: { width: "50%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
2023
+ /* @__PURE__ */ jsx5("div", { style: { flex: 1, backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderTop: "none", borderBottomRightRadius: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx5("div", { style: { width: "40%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) })
1873
2024
  ] }),
1874
- /* @__PURE__ */ jsx4("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderRadius: 8, marginTop: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx4("div", { style: { width: "45%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
1875
- /* @__PURE__ */ jsx4("div", { style: {
2025
+ /* @__PURE__ */ jsx5("div", { style: { backgroundColor: inputBg, border: `1px solid ${inputBorder}`, borderRadius: 8, marginTop: 8, padding: 12, height: 45 }, children: /* @__PURE__ */ jsx5("div", { style: { width: "45%", height: 14, borderRadius: 4, background: "#e5e7eb", animation: "flopay-interim-pulse 1.5s ease-in-out infinite" } }) }),
2026
+ /* @__PURE__ */ jsx5("div", { style: {
1876
2027
  height: 50,
1877
2028
  borderRadius: 8,
1878
2029
  marginTop: 16,
@@ -1881,7 +2032,7 @@ function InterimButtonsView({
1881
2032
  ...bStyles.submitButton,
1882
2033
  opacity: 0.5
1883
2034
  } }),
1884
- /* @__PURE__ */ jsx4("style", { children: `
2035
+ /* @__PURE__ */ jsx5("style", { children: `
1885
2036
  @keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
1886
2037
  @keyframes flopay-interim-expand {
1887
2038
  0% { opacity: 0; max-height: 0; transform: translateY(-12px); }
@@ -1891,10 +2042,10 @@ function InterimButtonsView({
1891
2042
  ` })
1892
2043
  ] });
1893
2044
  }
1894
- return /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
2045
+ return /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
1895
2046
  showPayPal && skeleton(44),
1896
2047
  (showApplePay || showGooglePay) && skeleton(44),
1897
- /* @__PURE__ */ jsxs2(
2048
+ /* @__PURE__ */ jsx5(
1898
2049
  "button",
1899
2050
  {
1900
2051
  type: "button",
@@ -1927,28 +2078,21 @@ function InterimButtonsView({
1927
2078
  onMouseUp: (e) => {
1928
2079
  e.currentTarget.style.transform = "scale(1)";
1929
2080
  },
1930
- children: [
1931
- /* @__PURE__ */ jsxs2("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
1932
- /* @__PURE__ */ jsx4("rect", { width: "20", height: "14", x: "2", y: "5", rx: "2" }),
1933
- /* @__PURE__ */ jsx4("line", { x1: "2", x2: "22", y1: "10", y2: "10" })
1934
- ] }),
1935
- "Credit / Debit Card",
1936
- /* @__PURE__ */ jsx4("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "#9ca3af", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { position: "absolute", right: "1rem" }, children: /* @__PURE__ */ jsx4("path", { d: "M9 18l6-6-6-6" }) })
1937
- ]
2081
+ children: /* @__PURE__ */ jsx5(CardButtonContentSlot, { content: cardButtonContent })
1938
2082
  }
1939
2083
  ),
1940
- /* @__PURE__ */ jsx4("style", { children: `@keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
2084
+ /* @__PURE__ */ jsx5("style", { children: `@keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
1941
2085
  ] });
1942
2086
  }
1943
2087
 
1944
2088
  // src/checkout-form.tsx
1945
2089
  import { FloPayError as FloPayError3 } from "@flopay/shared";
1946
2090
  import { forwardRef as forwardRef2, useCallback as useCallback3, useEffect as useEffect5, useImperativeHandle as useImperativeHandle2, useState as useState4 } from "react";
1947
- import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
2091
+ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1948
2092
  var WALLET_RESUME_KEY2 = "flopay_wallet_resume";
1949
2093
  var CheckoutForm = forwardRef2(
1950
2094
  function CheckoutForm2(props, ref) {
1951
- return /* @__PURE__ */ jsx5(CheckoutFormInner, { ...props, innerRef: ref });
2095
+ return /* @__PURE__ */ jsx6(CheckoutFormInner, { ...props, innerRef: ref });
1952
2096
  }
1953
2097
  );
1954
2098
  function CheckoutFormInner({
@@ -2191,8 +2335,8 @@ function CheckoutFormInner({
2191
2335
  [flopay, elements, isSubmitting, sessionId, email, baseUrl, isSelfContained, dispatchTokenizedBody, onError, updateError]
2192
2336
  );
2193
2337
  const isReady = flopay !== null && elements !== null;
2194
- return /* @__PURE__ */ jsxs3("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
2195
- (is3DSActive || isSubmitting) && /* @__PURE__ */ jsx5("div", { "data-testid": "flopay-overlay", style: {
2338
+ return /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
2339
+ (is3DSActive || isSubmitting) && /* @__PURE__ */ jsx6("div", { "data-testid": "flopay-overlay", style: {
2196
2340
  position: "absolute",
2197
2341
  inset: 0,
2198
2342
  background: "rgba(255,255,255,0.7)",
@@ -2201,12 +2345,12 @@ function CheckoutFormInner({
2201
2345
  justifyContent: "center",
2202
2346
  zIndex: 10
2203
2347
  }, children: is3DSActive ? "Verifying payment..." : "Processing..." }),
2204
- !isReady && /* @__PURE__ */ jsx5("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." }),
2205
- isReady && /* @__PURE__ */ jsxs3(Fragment3, { children: [
2206
- /* @__PURE__ */ jsx5(PaymentElement, { options: { layout } }),
2207
- showAddress && /* @__PURE__ */ jsx5(AddressElement, { options: { mode: showAddress === true ? "billing" : showAddress } }),
2208
- displayError && /* @__PURE__ */ jsx5("div", { role: "alert", "data-testid": "flopay-error", style: { color: "red", margin: "0.75rem 0" }, children: displayError }),
2209
- children ?? /* @__PURE__ */ jsx5(
2348
+ !isReady && /* @__PURE__ */ jsx6("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." }),
2349
+ isReady && /* @__PURE__ */ jsxs4(Fragment4, { children: [
2350
+ /* @__PURE__ */ jsx6(PaymentElement, { options: { layout } }),
2351
+ showAddress && /* @__PURE__ */ jsx6(AddressElement, { options: { mode: showAddress === true ? "billing" : showAddress } }),
2352
+ displayError && /* @__PURE__ */ jsx6("div", { role: "alert", "data-testid": "flopay-error", style: { color: "red", margin: "0.75rem 0" }, children: displayError }),
2353
+ children ?? /* @__PURE__ */ jsx6(
2210
2354
  "button",
2211
2355
  {
2212
2356
  type: "submit",
@@ -2222,7 +2366,7 @@ function CheckoutFormInner({
2222
2366
  // src/paypal-button.tsx
2223
2367
  import { FloPayError as FloPayError4 } from "@flopay/shared";
2224
2368
  import { useCallback as useCallback4, useEffect as useEffect6, useRef as useRef4, useState as useState5 } from "react";
2225
- import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
2369
+ import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
2226
2370
  function PayPalButton({
2227
2371
  sessionId,
2228
2372
  billingApiUrl,
@@ -2377,11 +2521,11 @@ function PayPalButton({
2377
2521
  }
2378
2522
  }, [flopay, elements, sessionId, email, baseUrl, dispatchTokenizedBody, onErrorChange]);
2379
2523
  if (!flopay || !elements) {
2380
- return /* @__PURE__ */ jsx6("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6, animation: "pulse 1.5s infinite" } });
2524
+ return /* @__PURE__ */ jsx7("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6, animation: "pulse 1.5s infinite" } });
2381
2525
  }
2382
- return /* @__PURE__ */ jsxs4(Fragment4, { children: [
2383
- !ready && /* @__PURE__ */ jsx6("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6 } }),
2384
- /* @__PURE__ */ jsx6("div", { style: ready ? {} : { display: "none" }, children: /* @__PURE__ */ jsx6(
2526
+ return /* @__PURE__ */ jsxs5(Fragment5, { children: [
2527
+ !ready && /* @__PURE__ */ jsx7("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6 } }),
2528
+ /* @__PURE__ */ jsx7("div", { style: ready ? {} : { display: "none" }, children: /* @__PURE__ */ jsx7(
2385
2529
  "button",
2386
2530
  {
2387
2531
  type: "button",
@@ -2403,7 +2547,7 @@ function PayPalButton({
2403
2547
  children: submitting ? "Processing..." : "PayPal"
2404
2548
  }
2405
2549
  ) }),
2406
- (submitting || isProcessing) && /* @__PURE__ */ jsx6("div", { style: {
2550
+ (submitting || isProcessing) && /* @__PURE__ */ jsx7("div", { style: {
2407
2551
  position: "fixed",
2408
2552
  inset: 0,
2409
2553
  background: "rgba(0,0,0,0.4)",
@@ -2411,7 +2555,7 @@ function PayPalButton({
2411
2555
  alignItems: "center",
2412
2556
  justifyContent: "center",
2413
2557
  zIndex: 1e3
2414
- }, children: /* @__PURE__ */ jsx6("div", { style: {
2558
+ }, children: /* @__PURE__ */ jsx7("div", { style: {
2415
2559
  background: "white",
2416
2560
  borderRadius: 8,
2417
2561
  padding: "1.5rem",