@flopay/react 0.3.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.cjs +278 -239
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +189 -150
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -67,13 +67,61 @@ function FloPayProvider({
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// src/flopay-checkout.tsx
|
|
70
|
-
import
|
|
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
|
|
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__ */
|
|
170
|
+
return /* @__PURE__ */ jsx3("div", { ref: containerRef, className, id, style });
|
|
123
171
|
}
|
|
124
172
|
ElementComponent.displayName = displayName;
|
|
125
173
|
return ElementComponent;
|
|
@@ -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
|
|
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__ */
|
|
236
|
+
return /* @__PURE__ */ jsx4("style", { children: FLOPAY_KEYFRAMES });
|
|
189
237
|
}
|
|
190
238
|
function ProcessingOverlay({ status, errorMessage }) {
|
|
191
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
213
|
-
status === "processing" && /* @__PURE__ */
|
|
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__ */
|
|
224
|
-
/* @__PURE__ */
|
|
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__ */
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
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__ */
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
402
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
495
|
-
/* @__PURE__ */
|
|
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__ */
|
|
564
|
+
submitting && /* @__PURE__ */ jsx4(ProcessingOverlay, { status: "processing" })
|
|
517
565
|
] });
|
|
518
566
|
}
|
|
519
567
|
function SplitCardFormInner({
|
|
@@ -541,6 +589,7 @@ function SplitCardFormInner({
|
|
|
541
589
|
layout = "default",
|
|
542
590
|
buttonsTheme,
|
|
543
591
|
buttonsStyles: buttonsStylesOverride,
|
|
592
|
+
cardButtonContent,
|
|
544
593
|
onButtonClick,
|
|
545
594
|
enableAVS = false,
|
|
546
595
|
avsLayout: avsLayoutProp = "row",
|
|
@@ -881,7 +930,7 @@ function SplitCardFormInner({
|
|
|
881
930
|
);
|
|
882
931
|
const isReady = flopay !== null && elements !== null;
|
|
883
932
|
if (!isReady) {
|
|
884
|
-
return /* @__PURE__ */
|
|
933
|
+
return /* @__PURE__ */ jsx4("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." });
|
|
885
934
|
}
|
|
886
935
|
const isButtons = layout === "buttons";
|
|
887
936
|
const resolvedBorder = isButtons ? bStyles.cardInputBorder ?? "#e5e7eb" : "#A4A4FF";
|
|
@@ -897,19 +946,19 @@ function SplitCardFormInner({
|
|
|
897
946
|
invalid: { color: "#ef4444" }
|
|
898
947
|
}
|
|
899
948
|
} : {};
|
|
900
|
-
const cardFormBlock = /* @__PURE__ */
|
|
949
|
+
const cardFormBlock = /* @__PURE__ */ jsxs2("div", { style: {
|
|
901
950
|
backgroundColor: cardBg,
|
|
902
951
|
borderRadius: "8px",
|
|
903
952
|
padding: isButtons ? "0" : "1rem",
|
|
904
953
|
...isButtons ? bStyles.cardFormContainer : {},
|
|
905
954
|
...isButtons ? { padding: bStyles.cardFormContainer?.padding ?? "0" } : {}
|
|
906
955
|
}, children: [
|
|
907
|
-
isButtons && showCardForm && /* @__PURE__ */
|
|
956
|
+
isButtons && showCardForm && /* @__PURE__ */ jsxs2("div", { style: {
|
|
908
957
|
display: "flex",
|
|
909
958
|
alignItems: "center",
|
|
910
959
|
padding: "0.75rem 0 0.625rem"
|
|
911
960
|
}, children: [
|
|
912
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ jsxs2(
|
|
913
962
|
"button",
|
|
914
963
|
{
|
|
915
964
|
type: "button",
|
|
@@ -931,7 +980,7 @@ function SplitCardFormInner({
|
|
|
931
980
|
},
|
|
932
981
|
"aria-label": "Back to payment methods",
|
|
933
982
|
children: [
|
|
934
|
-
/* @__PURE__ */
|
|
983
|
+
/* @__PURE__ */ jsx4("span", { style: {
|
|
935
984
|
display: "inline-flex",
|
|
936
985
|
alignItems: "center",
|
|
937
986
|
justifyContent: "center",
|
|
@@ -941,12 +990,12 @@ function SplitCardFormInner({
|
|
|
941
990
|
backgroundColor: "#f3f4f6",
|
|
942
991
|
transition: "background-color 0.15s",
|
|
943
992
|
...bStyles.backButtonIcon
|
|
944
|
-
}, children: /* @__PURE__ */
|
|
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" }) }) }),
|
|
945
994
|
"Go back"
|
|
946
995
|
]
|
|
947
996
|
}
|
|
948
997
|
),
|
|
949
|
-
/* @__PURE__ */
|
|
998
|
+
/* @__PURE__ */ jsx4("div", { style: {
|
|
950
999
|
flex: 1,
|
|
951
1000
|
textAlign: "center",
|
|
952
1001
|
fontWeight: 600,
|
|
@@ -956,16 +1005,16 @@ function SplitCardFormInner({
|
|
|
956
1005
|
...bStyles.title
|
|
957
1006
|
}, children: "Secure card checkout" })
|
|
958
1007
|
] }),
|
|
959
|
-
!isButtons && /* @__PURE__ */
|
|
960
|
-
/* @__PURE__ */
|
|
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: {
|
|
961
1010
|
backgroundColor: cardInputBg,
|
|
962
1011
|
border: `1px solid ${resolvedBorder}`,
|
|
963
1012
|
borderTopLeftRadius: "8px",
|
|
964
1013
|
borderTopRightRadius: "8px",
|
|
965
1014
|
padding: "10px"
|
|
966
|
-
}, children: /* @__PURE__ */
|
|
967
|
-
/* @__PURE__ */
|
|
968
|
-
/* @__PURE__ */
|
|
1015
|
+
}, children: /* @__PURE__ */ jsx4(CardNumberElement, { onReady: () => setFormReady(true), options: stripeElementStyle }) }),
|
|
1016
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex" }, children: [
|
|
1017
|
+
/* @__PURE__ */ jsx4("div", { style: {
|
|
969
1018
|
flex: 1,
|
|
970
1019
|
backgroundColor: cardInputBg,
|
|
971
1020
|
border: `1px solid ${resolvedBorder}`,
|
|
@@ -973,23 +1022,23 @@ function SplitCardFormInner({
|
|
|
973
1022
|
borderRight: "none",
|
|
974
1023
|
borderBottomLeftRadius: "8px",
|
|
975
1024
|
padding: "10px"
|
|
976
|
-
}, children: /* @__PURE__ */
|
|
977
|
-
/* @__PURE__ */
|
|
1025
|
+
}, children: /* @__PURE__ */ jsx4(CardExpiryElement, { options: stripeElementStyle }) }),
|
|
1026
|
+
/* @__PURE__ */ jsx4("div", { style: {
|
|
978
1027
|
flex: 1,
|
|
979
1028
|
backgroundColor: cardInputBg,
|
|
980
1029
|
border: `1px solid ${resolvedBorder}`,
|
|
981
1030
|
borderTop: "none",
|
|
982
1031
|
borderBottomRightRadius: "8px",
|
|
983
1032
|
padding: "10px"
|
|
984
|
-
}, children: /* @__PURE__ */
|
|
1033
|
+
}, children: /* @__PURE__ */ jsx4(CardCvcElement, { options: stripeElementStyle }) })
|
|
985
1034
|
] }),
|
|
986
|
-
/* @__PURE__ */
|
|
1035
|
+
/* @__PURE__ */ jsx4("div", { style: {
|
|
987
1036
|
backgroundColor: cardInputBg,
|
|
988
1037
|
border: `1px solid ${resolvedBorder}`,
|
|
989
1038
|
borderRadius: "8px",
|
|
990
1039
|
marginTop: "0.5rem",
|
|
991
1040
|
padding: "10px"
|
|
992
|
-
}, children: /* @__PURE__ */
|
|
1041
|
+
}, children: /* @__PURE__ */ jsx4(
|
|
993
1042
|
"input",
|
|
994
1043
|
{
|
|
995
1044
|
placeholder: "Full Name on Card",
|
|
@@ -1010,20 +1059,20 @@ function SplitCardFormInner({
|
|
|
1010
1059
|
}
|
|
1011
1060
|
}
|
|
1012
1061
|
) }),
|
|
1013
|
-
enableAVS && /* @__PURE__ */
|
|
1062
|
+
enableAVS && /* @__PURE__ */ jsxs2("div", { style: {
|
|
1014
1063
|
display: "flex",
|
|
1015
1064
|
flexDirection: avsLayoutProp === "column" ? "column" : "row",
|
|
1016
1065
|
gap: avsLayoutProp === "column" ? "0.5rem" : "0",
|
|
1017
1066
|
marginTop: "0.5rem"
|
|
1018
1067
|
}, children: [
|
|
1019
|
-
/* @__PURE__ */
|
|
1068
|
+
/* @__PURE__ */ jsx4("div", { style: {
|
|
1020
1069
|
flex: avsLayoutProp === "row" ? 1 : void 0,
|
|
1021
1070
|
backgroundColor: cardInputBg,
|
|
1022
1071
|
border: `1px solid ${resolvedBorder}`,
|
|
1023
1072
|
padding: "10px",
|
|
1024
1073
|
...avsLayoutProp === "row" ? { borderRadius: "0", borderTopLeftRadius: "8px", borderBottomLeftRadius: "8px", borderRight: "none" } : { borderRadius: "8px" },
|
|
1025
1074
|
...isButtons && bStyles.countrySelect ? bStyles.countrySelect : {}
|
|
1026
|
-
}, children: /* @__PURE__ */
|
|
1075
|
+
}, children: /* @__PURE__ */ jsx4(
|
|
1027
1076
|
"select",
|
|
1028
1077
|
{
|
|
1029
1078
|
value: selectedCountry,
|
|
@@ -1046,21 +1095,21 @@ function SplitCardFormInner({
|
|
|
1046
1095
|
cursor: "pointer",
|
|
1047
1096
|
...isButtons && bStyles.nameInput ? bStyles.nameInput : {}
|
|
1048
1097
|
},
|
|
1049
|
-
children: COUNTRY_OPTIONS.map((c) => /* @__PURE__ */
|
|
1098
|
+
children: COUNTRY_OPTIONS.map((c) => /* @__PURE__ */ jsxs2("option", { value: c.code, children: [
|
|
1050
1099
|
c.flag,
|
|
1051
1100
|
" ",
|
|
1052
1101
|
c.name
|
|
1053
1102
|
] }, c.code))
|
|
1054
1103
|
}
|
|
1055
1104
|
) }),
|
|
1056
|
-
/* @__PURE__ */
|
|
1105
|
+
/* @__PURE__ */ jsx4("div", { style: {
|
|
1057
1106
|
flex: avsLayoutProp === "row" ? 1 : void 0,
|
|
1058
1107
|
backgroundColor: cardInputBg,
|
|
1059
1108
|
border: `1px solid ${resolvedBorder}`,
|
|
1060
1109
|
padding: "10px",
|
|
1061
1110
|
...avsLayoutProp === "row" ? { borderRadius: "0", borderTopRightRadius: "8px", borderBottomRightRadius: "8px" } : { borderRadius: "8px" },
|
|
1062
1111
|
...isButtons && bStyles.zipInput ? bStyles.zipInput : {}
|
|
1063
|
-
}, children: /* @__PURE__ */
|
|
1112
|
+
}, children: /* @__PURE__ */ jsx4(
|
|
1064
1113
|
"input",
|
|
1065
1114
|
{
|
|
1066
1115
|
placeholder: getPostalCodeLabel(selectedCountry),
|
|
@@ -1087,7 +1136,7 @@ function SplitCardFormInner({
|
|
|
1087
1136
|
}
|
|
1088
1137
|
) })
|
|
1089
1138
|
] }),
|
|
1090
|
-
displayError && /* @__PURE__ */
|
|
1139
|
+
displayError && /* @__PURE__ */ jsxs2("div", { role: "alert", "data-testid": "flopay-error", style: {
|
|
1091
1140
|
margin: "0.75rem 0",
|
|
1092
1141
|
padding: "0.625rem 0.875rem",
|
|
1093
1142
|
background: "#FEF2F2",
|
|
@@ -1101,10 +1150,10 @@ function SplitCardFormInner({
|
|
|
1101
1150
|
gap: "0.5rem",
|
|
1102
1151
|
...isButtons && bStyles.errorBanner ? bStyles.errorBanner : {}
|
|
1103
1152
|
}, children: [
|
|
1104
|
-
/* @__PURE__ */
|
|
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" }) }),
|
|
1105
1154
|
displayError
|
|
1106
1155
|
] }),
|
|
1107
|
-
children ?? /* @__PURE__ */
|
|
1156
|
+
children ?? /* @__PURE__ */ jsx4(
|
|
1108
1157
|
"button",
|
|
1109
1158
|
{
|
|
1110
1159
|
type: "submit",
|
|
@@ -1127,7 +1176,7 @@ function SplitCardFormInner({
|
|
|
1127
1176
|
children: isSubmitting ? "PROCESSING..." : submitLabel
|
|
1128
1177
|
}
|
|
1129
1178
|
),
|
|
1130
|
-
!isButtons && /* @__PURE__ */
|
|
1179
|
+
!isButtons && /* @__PURE__ */ jsx4("div", { style: {
|
|
1131
1180
|
backgroundColor: "#EFF9F0",
|
|
1132
1181
|
borderRadius: "8px",
|
|
1133
1182
|
padding: "0.75rem",
|
|
@@ -1143,11 +1192,11 @@ function SplitCardFormInner({
|
|
|
1143
1192
|
const isCardView = viewState === "expanding" || viewState === "card" || viewState === "collapsing";
|
|
1144
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;
|
|
1145
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;
|
|
1146
|
-
return /* @__PURE__ */
|
|
1147
|
-
/* @__PURE__ */
|
|
1148
|
-
overlayStatus && /* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1150
|
-
/* @__PURE__ */
|
|
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: {
|
|
1151
1200
|
gridArea: "1 / 1",
|
|
1152
1201
|
display: "flex",
|
|
1153
1202
|
flexDirection: "column",
|
|
@@ -1156,7 +1205,7 @@ function SplitCardFormInner({
|
|
|
1156
1205
|
...!isButtonsView && !buttonsAnim ? { visibility: "hidden", position: "absolute", pointerEvents: "none", width: "100%" } : {},
|
|
1157
1206
|
...buttonsAnim ? { animation: buttonsAnim, pointerEvents: "none" } : {}
|
|
1158
1207
|
}, children: [
|
|
1159
|
-
showPayPal && stripeInstance ? /* @__PURE__ */
|
|
1208
|
+
showPayPal && stripeInstance ? /* @__PURE__ */ jsx4(StripeElements, { stripe: stripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx4(
|
|
1160
1209
|
PayPalButtonInner,
|
|
1161
1210
|
{
|
|
1162
1211
|
sessionId,
|
|
@@ -1167,8 +1216,8 @@ function SplitCardFormInner({
|
|
|
1167
1216
|
isProcessing: isSubmitting,
|
|
1168
1217
|
onButtonClick
|
|
1169
1218
|
}
|
|
1170
|
-
) }) : showPayPal ? /* @__PURE__ */
|
|
1171
|
-
showWallets && stripeInstance ? /* @__PURE__ */
|
|
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(
|
|
1172
1221
|
WalletButtonInner,
|
|
1173
1222
|
{
|
|
1174
1223
|
sessionId,
|
|
@@ -1180,8 +1229,8 @@ function SplitCardFormInner({
|
|
|
1180
1229
|
onErrorChange: updateError,
|
|
1181
1230
|
onButtonClick
|
|
1182
1231
|
}
|
|
1183
|
-
) }) : showWallets ? /* @__PURE__ */
|
|
1184
|
-
/* @__PURE__ */
|
|
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(
|
|
1185
1234
|
"button",
|
|
1186
1235
|
{
|
|
1187
1236
|
type: "button",
|
|
@@ -1214,17 +1263,10 @@ function SplitCardFormInner({
|
|
|
1214
1263
|
onMouseUp: (e) => {
|
|
1215
1264
|
e.currentTarget.style.transform = "scale(1)";
|
|
1216
1265
|
},
|
|
1217
|
-
children:
|
|
1218
|
-
/* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1219
|
-
/* @__PURE__ */ jsx3("rect", { width: "20", height: "14", x: "2", y: "5", rx: "2" }),
|
|
1220
|
-
/* @__PURE__ */ jsx3("line", { x1: "2", x2: "22", y1: "10", y2: "10" })
|
|
1221
|
-
] }),
|
|
1222
|
-
"Credit / Debit Card",
|
|
1223
|
-
/* @__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" }) })
|
|
1224
|
-
]
|
|
1266
|
+
children: /* @__PURE__ */ jsx4(CardButtonContentSlot, { content: cardButtonContent })
|
|
1225
1267
|
}
|
|
1226
1268
|
),
|
|
1227
|
-
displayError && viewState === "buttons" && /* @__PURE__ */
|
|
1269
|
+
displayError && viewState === "buttons" && /* @__PURE__ */ jsxs2("div", { role: "alert", "data-testid": "flopay-error", style: {
|
|
1228
1270
|
margin: "0.25rem 0",
|
|
1229
1271
|
padding: "0.625rem 0.875rem",
|
|
1230
1272
|
background: "#FEF2F2",
|
|
@@ -1238,11 +1280,11 @@ function SplitCardFormInner({
|
|
|
1238
1280
|
gap: "0.5rem",
|
|
1239
1281
|
...bStyles.errorBanner ? bStyles.errorBanner : {}
|
|
1240
1282
|
}, children: [
|
|
1241
|
-
/* @__PURE__ */
|
|
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" }) }),
|
|
1242
1284
|
displayError
|
|
1243
1285
|
] })
|
|
1244
1286
|
] }),
|
|
1245
|
-
isCardView && /* @__PURE__ */
|
|
1287
|
+
isCardView && /* @__PURE__ */ jsx4("div", { style: {
|
|
1246
1288
|
gridArea: "1 / 1",
|
|
1247
1289
|
...cardAnim ? { animation: cardAnim } : {},
|
|
1248
1290
|
...viewState === "collapsing" ? { pointerEvents: "none" } : {}
|
|
@@ -1250,10 +1292,10 @@ function SplitCardFormInner({
|
|
|
1250
1292
|
] })
|
|
1251
1293
|
] });
|
|
1252
1294
|
}
|
|
1253
|
-
return /* @__PURE__ */
|
|
1254
|
-
/* @__PURE__ */
|
|
1255
|
-
overlayStatus && /* @__PURE__ */
|
|
1256
|
-
showWallets && stripeInstance && /* @__PURE__ */
|
|
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(
|
|
1257
1299
|
WalletButtonInner,
|
|
1258
1300
|
{
|
|
1259
1301
|
sessionId,
|
|
@@ -1265,7 +1307,7 @@ function SplitCardFormInner({
|
|
|
1265
1307
|
onErrorChange: updateError
|
|
1266
1308
|
}
|
|
1267
1309
|
) }),
|
|
1268
|
-
showPayPal && stripeInstance && /* @__PURE__ */
|
|
1310
|
+
showPayPal && stripeInstance && /* @__PURE__ */ jsx4(StripeElements, { stripe: stripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx4(
|
|
1269
1311
|
PayPalButtonInner,
|
|
1270
1312
|
{
|
|
1271
1313
|
sessionId,
|
|
@@ -1276,7 +1318,7 @@ function SplitCardFormInner({
|
|
|
1276
1318
|
isProcessing: isSubmitting
|
|
1277
1319
|
}
|
|
1278
1320
|
) }),
|
|
1279
|
-
(showWallets && stripeInstance || showPayPal && stripeInstance) && /* @__PURE__ */
|
|
1321
|
+
(showWallets && stripeInstance || showPayPal && stripeInstance) && /* @__PURE__ */ jsxs2("div", { style: {
|
|
1280
1322
|
display: "flex",
|
|
1281
1323
|
alignItems: "center",
|
|
1282
1324
|
gap: "0.75rem",
|
|
@@ -1284,16 +1326,16 @@ function SplitCardFormInner({
|
|
|
1284
1326
|
color: "#999",
|
|
1285
1327
|
fontSize: "0.85rem"
|
|
1286
1328
|
}, children: [
|
|
1287
|
-
/* @__PURE__ */
|
|
1288
|
-
/* @__PURE__ */
|
|
1289
|
-
/* @__PURE__ */
|
|
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" } })
|
|
1290
1332
|
] }),
|
|
1291
1333
|
cardFormBlock
|
|
1292
1334
|
] });
|
|
1293
1335
|
}
|
|
1294
1336
|
|
|
1295
1337
|
// src/flopay-checkout.tsx
|
|
1296
|
-
import { Fragment as
|
|
1338
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1297
1339
|
function FloPayCheckout({
|
|
1298
1340
|
sessionId: sessionIdProp,
|
|
1299
1341
|
createSession: createSessionParams,
|
|
@@ -1311,6 +1353,7 @@ function FloPayCheckout({
|
|
|
1311
1353
|
layout,
|
|
1312
1354
|
buttonsTheme,
|
|
1313
1355
|
buttonsStyles,
|
|
1356
|
+
cardButtonContent,
|
|
1314
1357
|
onButtonClick,
|
|
1315
1358
|
enableAVS,
|
|
1316
1359
|
avsLayout,
|
|
@@ -1716,23 +1759,23 @@ function FloPayCheckout({
|
|
|
1716
1759
|
[session, isLoading, loadError, currentMode]
|
|
1717
1760
|
);
|
|
1718
1761
|
if (isLoading) {
|
|
1719
|
-
if (loadingNode) return /* @__PURE__ */
|
|
1762
|
+
if (loadingNode) return /* @__PURE__ */ jsx5(Fragment3, { children: loadingNode });
|
|
1720
1763
|
if (layout === "buttons") {
|
|
1721
|
-
const skeletonBar = (h) => /* @__PURE__ */
|
|
1764
|
+
const skeletonBar = (h) => /* @__PURE__ */ jsx5("div", { style: {
|
|
1722
1765
|
height: h,
|
|
1723
1766
|
borderRadius: 8,
|
|
1724
1767
|
background: "#e5e7eb",
|
|
1725
1768
|
animation: "flopay-loading-pulse 1.5s ease-in-out infinite"
|
|
1726
1769
|
} });
|
|
1727
|
-
return /* @__PURE__ */
|
|
1770
|
+
return /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
|
|
1728
1771
|
showPayPal && skeletonBar(44),
|
|
1729
1772
|
(showApplePay || showGooglePay) && skeletonBar(44),
|
|
1730
1773
|
skeletonBar(48),
|
|
1731
|
-
/* @__PURE__ */
|
|
1774
|
+
/* @__PURE__ */ jsx5("style", { children: `@keyframes flopay-loading-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
|
|
1732
1775
|
] });
|
|
1733
1776
|
}
|
|
1734
|
-
return /* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ jsxs3("div", { style: { display: "flex", justifyContent: "center", padding: 32 }, children: [
|
|
1778
|
+
/* @__PURE__ */ jsx5("div", { style: {
|
|
1736
1779
|
width: 24,
|
|
1737
1780
|
height: 24,
|
|
1738
1781
|
border: "2px solid #e5e7eb",
|
|
@@ -1740,12 +1783,12 @@ function FloPayCheckout({
|
|
|
1740
1783
|
borderRadius: "50%",
|
|
1741
1784
|
animation: "spin 0.6s linear infinite"
|
|
1742
1785
|
} }),
|
|
1743
|
-
/* @__PURE__ */
|
|
1786
|
+
/* @__PURE__ */ jsx5("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` })
|
|
1744
1787
|
] });
|
|
1745
1788
|
}
|
|
1746
1789
|
if (loadError) {
|
|
1747
|
-
if (errorNode) return /* @__PURE__ */
|
|
1748
|
-
return /* @__PURE__ */
|
|
1790
|
+
if (errorNode) return /* @__PURE__ */ jsx5(Fragment3, { children: errorNode(loadError) });
|
|
1791
|
+
return /* @__PURE__ */ jsx5(
|
|
1749
1792
|
"div",
|
|
1750
1793
|
{
|
|
1751
1794
|
style: {
|
|
@@ -1759,7 +1802,7 @@ function FloPayCheckout({
|
|
|
1759
1802
|
);
|
|
1760
1803
|
}
|
|
1761
1804
|
if ((!flopay || !providerOptions) && createSessionParams && layout === "buttons") {
|
|
1762
|
-
return /* @__PURE__ */
|
|
1805
|
+
return /* @__PURE__ */ jsx5(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsx5(
|
|
1763
1806
|
InterimButtonsView,
|
|
1764
1807
|
{
|
|
1765
1808
|
onButtonClick,
|
|
@@ -1767,14 +1810,15 @@ function FloPayCheckout({
|
|
|
1767
1810
|
showApplePay,
|
|
1768
1811
|
showGooglePay,
|
|
1769
1812
|
buttonsTheme,
|
|
1770
|
-
buttonsStyles
|
|
1813
|
+
buttonsStyles,
|
|
1814
|
+
cardButtonContent
|
|
1771
1815
|
}
|
|
1772
1816
|
) });
|
|
1773
1817
|
}
|
|
1774
|
-
if (!flopay || !providerOptions) return /* @__PURE__ */
|
|
1818
|
+
if (!flopay || !providerOptions) return /* @__PURE__ */ jsx5(Fragment3, {});
|
|
1775
1819
|
if (currentMode === "confirm") {
|
|
1776
|
-
return /* @__PURE__ */
|
|
1777
|
-
modeError && /* @__PURE__ */
|
|
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(
|
|
1778
1822
|
"div",
|
|
1779
1823
|
{
|
|
1780
1824
|
style: {
|
|
@@ -1789,7 +1833,7 @@ function FloPayCheckout({
|
|
|
1789
1833
|
renderConfirmButton ? renderConfirmButton({
|
|
1790
1834
|
onConfirm: handleConfirmCheckout,
|
|
1791
1835
|
isProcessing: confirmProcessing
|
|
1792
|
-
}) : /* @__PURE__ */
|
|
1836
|
+
}) : /* @__PURE__ */ jsx5(
|
|
1793
1837
|
"button",
|
|
1794
1838
|
{
|
|
1795
1839
|
type: "button",
|
|
@@ -1812,8 +1856,8 @@ function FloPayCheckout({
|
|
|
1812
1856
|
)
|
|
1813
1857
|
] }) }) });
|
|
1814
1858
|
}
|
|
1815
|
-
return /* @__PURE__ */
|
|
1816
|
-
modeError && /* @__PURE__ */
|
|
1859
|
+
return /* @__PURE__ */ jsx5(CheckoutContext.Provider, { value: checkoutValue, children: /* @__PURE__ */ jsxs3(FloPayProvider, { flopay, options: providerOptions, children: [
|
|
1860
|
+
modeError && /* @__PURE__ */ jsx5(
|
|
1817
1861
|
"div",
|
|
1818
1862
|
{
|
|
1819
1863
|
style: {
|
|
@@ -1828,7 +1872,7 @@ function FloPayCheckout({
|
|
|
1828
1872
|
children: modeError
|
|
1829
1873
|
}
|
|
1830
1874
|
),
|
|
1831
|
-
children ? /* @__PURE__ */
|
|
1875
|
+
children ? /* @__PURE__ */ jsx5(
|
|
1832
1876
|
SessionInjector,
|
|
1833
1877
|
{
|
|
1834
1878
|
sessionId: resolvedSessionId,
|
|
@@ -1836,7 +1880,7 @@ function FloPayCheckout({
|
|
|
1836
1880
|
session,
|
|
1837
1881
|
children
|
|
1838
1882
|
}
|
|
1839
|
-
) : /* @__PURE__ */
|
|
1883
|
+
) : /* @__PURE__ */ jsx5(
|
|
1840
1884
|
SplitCardForm,
|
|
1841
1885
|
{
|
|
1842
1886
|
sessionId: resolvedSessionId,
|
|
@@ -1854,6 +1898,7 @@ function FloPayCheckout({
|
|
|
1854
1898
|
layout,
|
|
1855
1899
|
buttonsTheme,
|
|
1856
1900
|
buttonsStyles,
|
|
1901
|
+
cardButtonContent,
|
|
1857
1902
|
onButtonClick,
|
|
1858
1903
|
enableAVS,
|
|
1859
1904
|
avsLayout,
|
|
@@ -1871,8 +1916,8 @@ function SessionInjector({
|
|
|
1871
1916
|
session,
|
|
1872
1917
|
children
|
|
1873
1918
|
}) {
|
|
1874
|
-
return /* @__PURE__ */
|
|
1875
|
-
if (!
|
|
1919
|
+
return /* @__PURE__ */ jsx5(Fragment3, { children: React5.Children.map(children, (child) => {
|
|
1920
|
+
if (!React5.isValidElement(child)) return child;
|
|
1876
1921
|
const existing = child.props;
|
|
1877
1922
|
const injected = {};
|
|
1878
1923
|
if (!existing.sessionId) injected.sessionId = sessionId;
|
|
@@ -1886,7 +1931,7 @@ function SessionInjector({
|
|
|
1886
1931
|
injected.lastName = session.customer.lastName;
|
|
1887
1932
|
}
|
|
1888
1933
|
if (Object.keys(injected).length === 0) return child;
|
|
1889
|
-
return
|
|
1934
|
+
return React5.cloneElement(child, injected);
|
|
1890
1935
|
}) });
|
|
1891
1936
|
}
|
|
1892
1937
|
function InterimButtonsView({
|
|
@@ -1895,7 +1940,8 @@ function InterimButtonsView({
|
|
|
1895
1940
|
showApplePay,
|
|
1896
1941
|
showGooglePay,
|
|
1897
1942
|
buttonsTheme,
|
|
1898
|
-
buttonsStyles: stylesOverride
|
|
1943
|
+
buttonsStyles: stylesOverride,
|
|
1944
|
+
cardButtonContent
|
|
1899
1945
|
}) {
|
|
1900
1946
|
const [showCardForm, setShowCardForm] = useState3(false);
|
|
1901
1947
|
const bStyles = useMemo3(() => {
|
|
@@ -1910,7 +1956,7 @@ function InterimButtonsView({
|
|
|
1910
1956
|
title: { ...base.title, ...stylesOverride.title }
|
|
1911
1957
|
};
|
|
1912
1958
|
}, [buttonsTheme, stylesOverride]);
|
|
1913
|
-
const skeleton = (h) => /* @__PURE__ */
|
|
1959
|
+
const skeleton = (h) => /* @__PURE__ */ jsx5("div", { style: {
|
|
1914
1960
|
height: h,
|
|
1915
1961
|
borderRadius: 8,
|
|
1916
1962
|
background: "#e5e7eb",
|
|
@@ -1919,15 +1965,15 @@ function InterimButtonsView({
|
|
|
1919
1965
|
if (showCardForm) {
|
|
1920
1966
|
const inputBorder = bStyles.cardInputBorder ?? "#e5e7eb";
|
|
1921
1967
|
const inputBg = bStyles.cardInputBackground ?? "white";
|
|
1922
|
-
return /* @__PURE__ */
|
|
1968
|
+
return /* @__PURE__ */ jsxs3("div", { style: {
|
|
1923
1969
|
backgroundColor: bStyles.cardFormContainer?.backgroundColor ?? "white",
|
|
1924
1970
|
borderRadius: "8px",
|
|
1925
1971
|
animation: "flopay-interim-expand 0.35s cubic-bezier(0.4, 0, 0.2, 1) both",
|
|
1926
1972
|
overflow: "hidden",
|
|
1927
1973
|
...bStyles.cardFormContainer
|
|
1928
1974
|
}, children: [
|
|
1929
|
-
/* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
1975
|
+
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", alignItems: "center", padding: "0.75rem 0 0.625rem" }, children: [
|
|
1976
|
+
/* @__PURE__ */ jsxs3(
|
|
1931
1977
|
"button",
|
|
1932
1978
|
{
|
|
1933
1979
|
type: "button",
|
|
@@ -1947,7 +1993,7 @@ function InterimButtonsView({
|
|
|
1947
1993
|
...bStyles.backButton
|
|
1948
1994
|
},
|
|
1949
1995
|
children: [
|
|
1950
|
-
/* @__PURE__ */
|
|
1996
|
+
/* @__PURE__ */ jsx5("span", { style: {
|
|
1951
1997
|
display: "inline-flex",
|
|
1952
1998
|
alignItems: "center",
|
|
1953
1999
|
justifyContent: "center",
|
|
@@ -1956,12 +2002,12 @@ function InterimButtonsView({
|
|
|
1956
2002
|
borderRadius: "50%",
|
|
1957
2003
|
backgroundColor: "#f3f4f6",
|
|
1958
2004
|
...bStyles.backButtonIcon
|
|
1959
|
-
}, children: /* @__PURE__ */
|
|
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" }) }) }),
|
|
1960
2006
|
"Go back"
|
|
1961
2007
|
]
|
|
1962
2008
|
}
|
|
1963
2009
|
),
|
|
1964
|
-
/* @__PURE__ */
|
|
2010
|
+
/* @__PURE__ */ jsx5("div", { style: {
|
|
1965
2011
|
flex: 1,
|
|
1966
2012
|
textAlign: "center",
|
|
1967
2013
|
fontWeight: 600,
|
|
@@ -1971,13 +2017,13 @@ function InterimButtonsView({
|
|
|
1971
2017
|
...bStyles.title
|
|
1972
2018
|
}, children: "Secure card checkout" })
|
|
1973
2019
|
] }),
|
|
1974
|
-
/* @__PURE__ */
|
|
1975
|
-
/* @__PURE__ */
|
|
1976
|
-
/* @__PURE__ */
|
|
1977
|
-
/* @__PURE__ */
|
|
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" } }) })
|
|
1978
2024
|
] }),
|
|
1979
|
-
/* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
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: {
|
|
1981
2027
|
height: 50,
|
|
1982
2028
|
borderRadius: 8,
|
|
1983
2029
|
marginTop: 16,
|
|
@@ -1986,7 +2032,7 @@ function InterimButtonsView({
|
|
|
1986
2032
|
...bStyles.submitButton,
|
|
1987
2033
|
opacity: 0.5
|
|
1988
2034
|
} }),
|
|
1989
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ jsx5("style", { children: `
|
|
1990
2036
|
@keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
|
|
1991
2037
|
@keyframes flopay-interim-expand {
|
|
1992
2038
|
0% { opacity: 0; max-height: 0; transform: translateY(-12px); }
|
|
@@ -1996,10 +2042,10 @@ function InterimButtonsView({
|
|
|
1996
2042
|
` })
|
|
1997
2043
|
] });
|
|
1998
2044
|
}
|
|
1999
|
-
return /* @__PURE__ */
|
|
2045
|
+
return /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
|
|
2000
2046
|
showPayPal && skeleton(44),
|
|
2001
2047
|
(showApplePay || showGooglePay) && skeleton(44),
|
|
2002
|
-
/* @__PURE__ */
|
|
2048
|
+
/* @__PURE__ */ jsx5(
|
|
2003
2049
|
"button",
|
|
2004
2050
|
{
|
|
2005
2051
|
type: "button",
|
|
@@ -2032,28 +2078,21 @@ function InterimButtonsView({
|
|
|
2032
2078
|
onMouseUp: (e) => {
|
|
2033
2079
|
e.currentTarget.style.transform = "scale(1)";
|
|
2034
2080
|
},
|
|
2035
|
-
children:
|
|
2036
|
-
/* @__PURE__ */ jsxs2("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2037
|
-
/* @__PURE__ */ jsx4("rect", { width: "20", height: "14", x: "2", y: "5", rx: "2" }),
|
|
2038
|
-
/* @__PURE__ */ jsx4("line", { x1: "2", x2: "22", y1: "10", y2: "10" })
|
|
2039
|
-
] }),
|
|
2040
|
-
"Credit / Debit Card",
|
|
2041
|
-
/* @__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" }) })
|
|
2042
|
-
]
|
|
2081
|
+
children: /* @__PURE__ */ jsx5(CardButtonContentSlot, { content: cardButtonContent })
|
|
2043
2082
|
}
|
|
2044
2083
|
),
|
|
2045
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ jsx5("style", { children: `@keyframes flopay-interim-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }` })
|
|
2046
2085
|
] });
|
|
2047
2086
|
}
|
|
2048
2087
|
|
|
2049
2088
|
// src/checkout-form.tsx
|
|
2050
2089
|
import { FloPayError as FloPayError3 } from "@flopay/shared";
|
|
2051
2090
|
import { forwardRef as forwardRef2, useCallback as useCallback3, useEffect as useEffect5, useImperativeHandle as useImperativeHandle2, useState as useState4 } from "react";
|
|
2052
|
-
import { Fragment as
|
|
2091
|
+
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2053
2092
|
var WALLET_RESUME_KEY2 = "flopay_wallet_resume";
|
|
2054
2093
|
var CheckoutForm = forwardRef2(
|
|
2055
2094
|
function CheckoutForm2(props, ref) {
|
|
2056
|
-
return /* @__PURE__ */
|
|
2095
|
+
return /* @__PURE__ */ jsx6(CheckoutFormInner, { ...props, innerRef: ref });
|
|
2057
2096
|
}
|
|
2058
2097
|
);
|
|
2059
2098
|
function CheckoutFormInner({
|
|
@@ -2296,8 +2335,8 @@ function CheckoutFormInner({
|
|
|
2296
2335
|
[flopay, elements, isSubmitting, sessionId, email, baseUrl, isSelfContained, dispatchTokenizedBody, onError, updateError]
|
|
2297
2336
|
);
|
|
2298
2337
|
const isReady = flopay !== null && elements !== null;
|
|
2299
|
-
return /* @__PURE__ */
|
|
2300
|
-
(is3DSActive || isSubmitting) && /* @__PURE__ */
|
|
2338
|
+
return /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
|
|
2339
|
+
(is3DSActive || isSubmitting) && /* @__PURE__ */ jsx6("div", { "data-testid": "flopay-overlay", style: {
|
|
2301
2340
|
position: "absolute",
|
|
2302
2341
|
inset: 0,
|
|
2303
2342
|
background: "rgba(255,255,255,0.7)",
|
|
@@ -2306,12 +2345,12 @@ function CheckoutFormInner({
|
|
|
2306
2345
|
justifyContent: "center",
|
|
2307
2346
|
zIndex: 10
|
|
2308
2347
|
}, children: is3DSActive ? "Verifying payment..." : "Processing..." }),
|
|
2309
|
-
!isReady && /* @__PURE__ */
|
|
2310
|
-
isReady && /* @__PURE__ */
|
|
2311
|
-
/* @__PURE__ */
|
|
2312
|
-
showAddress && /* @__PURE__ */
|
|
2313
|
-
displayError && /* @__PURE__ */
|
|
2314
|
-
children ?? /* @__PURE__ */
|
|
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(
|
|
2315
2354
|
"button",
|
|
2316
2355
|
{
|
|
2317
2356
|
type: "submit",
|
|
@@ -2327,7 +2366,7 @@ function CheckoutFormInner({
|
|
|
2327
2366
|
// src/paypal-button.tsx
|
|
2328
2367
|
import { FloPayError as FloPayError4 } from "@flopay/shared";
|
|
2329
2368
|
import { useCallback as useCallback4, useEffect as useEffect6, useRef as useRef4, useState as useState5 } from "react";
|
|
2330
|
-
import { Fragment as
|
|
2369
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2331
2370
|
function PayPalButton({
|
|
2332
2371
|
sessionId,
|
|
2333
2372
|
billingApiUrl,
|
|
@@ -2482,11 +2521,11 @@ function PayPalButton({
|
|
|
2482
2521
|
}
|
|
2483
2522
|
}, [flopay, elements, sessionId, email, baseUrl, dispatchTokenizedBody, onErrorChange]);
|
|
2484
2523
|
if (!flopay || !elements) {
|
|
2485
|
-
return /* @__PURE__ */
|
|
2524
|
+
return /* @__PURE__ */ jsx7("div", { style: { height: 45, background: "#f0f0f0", borderRadius: 6, animation: "pulse 1.5s infinite" } });
|
|
2486
2525
|
}
|
|
2487
|
-
return /* @__PURE__ */
|
|
2488
|
-
!ready && /* @__PURE__ */
|
|
2489
|
-
/* @__PURE__ */
|
|
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(
|
|
2490
2529
|
"button",
|
|
2491
2530
|
{
|
|
2492
2531
|
type: "button",
|
|
@@ -2508,7 +2547,7 @@ function PayPalButton({
|
|
|
2508
2547
|
children: submitting ? "Processing..." : "PayPal"
|
|
2509
2548
|
}
|
|
2510
2549
|
) }),
|
|
2511
|
-
(submitting || isProcessing) && /* @__PURE__ */
|
|
2550
|
+
(submitting || isProcessing) && /* @__PURE__ */ jsx7("div", { style: {
|
|
2512
2551
|
position: "fixed",
|
|
2513
2552
|
inset: 0,
|
|
2514
2553
|
background: "rgba(0,0,0,0.4)",
|
|
@@ -2516,7 +2555,7 @@ function PayPalButton({
|
|
|
2516
2555
|
alignItems: "center",
|
|
2517
2556
|
justifyContent: "center",
|
|
2518
2557
|
zIndex: 1e3
|
|
2519
|
-
}, children: /* @__PURE__ */
|
|
2558
|
+
}, children: /* @__PURE__ */ jsx7("div", { style: {
|
|
2520
2559
|
background: "white",
|
|
2521
2560
|
borderRadius: 8,
|
|
2522
2561
|
padding: "1.5rem",
|