@flopay/react 0.1.4 → 0.1.6
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 +279 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.mjs +279 -92
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -64,6 +64,8 @@ interface FloPayCheckoutProps {
|
|
|
64
64
|
showApplePay?: boolean;
|
|
65
65
|
/** Whether to show Google Pay button (default: true). Only renders on supported devices. */
|
|
66
66
|
showGooglePay?: boolean;
|
|
67
|
+
/** Layout mode: 'default' (all visible) or 'buttons' (PayPal/wallets + expandable card form). */
|
|
68
|
+
layout?: 'default' | 'buttons';
|
|
67
69
|
/** Label for the submit button. */
|
|
68
70
|
submitLabel?: string;
|
|
69
71
|
/** Additional CSS class for the wrapper. */
|
|
@@ -107,7 +109,7 @@ interface FloPayCheckoutProps {
|
|
|
107
109
|
* />
|
|
108
110
|
* ```
|
|
109
111
|
*/
|
|
110
|
-
declare function FloPayCheckout({ sessionId, billingApiUrl, appearance, locale, fallbackPublishableKey, loading: loadingNode, error: errorNode, onComplete, onError, showPayPal, showApplePay, showGooglePay, submitLabel, className, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
112
|
+
declare function FloPayCheckout({ sessionId, billingApiUrl, appearance, locale, fallbackPublishableKey, loading: loadingNode, error: errorNode, onComplete, onError, showPayPal, showApplePay, showGooglePay, layout, submitLabel, className, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
111
113
|
|
|
112
114
|
/**
|
|
113
115
|
* Returns the current `FloPay` instance, or `null` if the provider
|
|
@@ -330,6 +332,13 @@ interface SplitCardFormProps {
|
|
|
330
332
|
showApplePay?: boolean;
|
|
331
333
|
/** Show Google Pay button. Defaults to `true`. Only renders on supported devices. */
|
|
332
334
|
showGooglePay?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Layout mode for the payment form.
|
|
337
|
+
* - `'default'` — all payment methods + card form shown together (current behavior)
|
|
338
|
+
* - `'buttons'` — PayPal, wallets, and a "Credit / Debit Card" button; clicking the card
|
|
339
|
+
* button expands the card form with a back button to return to the button view
|
|
340
|
+
*/
|
|
341
|
+
layout?: 'default' | 'buttons';
|
|
333
342
|
/** Total amount in cents (smallest currency unit). Used for wallet/PayPal Elements config. */
|
|
334
343
|
totalAmount?: number;
|
|
335
344
|
/** Currency code (used for PayPal Elements config). */
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ interface FloPayCheckoutProps {
|
|
|
64
64
|
showApplePay?: boolean;
|
|
65
65
|
/** Whether to show Google Pay button (default: true). Only renders on supported devices. */
|
|
66
66
|
showGooglePay?: boolean;
|
|
67
|
+
/** Layout mode: 'default' (all visible) or 'buttons' (PayPal/wallets + expandable card form). */
|
|
68
|
+
layout?: 'default' | 'buttons';
|
|
67
69
|
/** Label for the submit button. */
|
|
68
70
|
submitLabel?: string;
|
|
69
71
|
/** Additional CSS class for the wrapper. */
|
|
@@ -107,7 +109,7 @@ interface FloPayCheckoutProps {
|
|
|
107
109
|
* />
|
|
108
110
|
* ```
|
|
109
111
|
*/
|
|
110
|
-
declare function FloPayCheckout({ sessionId, billingApiUrl, appearance, locale, fallbackPublishableKey, loading: loadingNode, error: errorNode, onComplete, onError, showPayPal, showApplePay, showGooglePay, submitLabel, className, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
112
|
+
declare function FloPayCheckout({ sessionId, billingApiUrl, appearance, locale, fallbackPublishableKey, loading: loadingNode, error: errorNode, onComplete, onError, showPayPal, showApplePay, showGooglePay, layout, submitLabel, className, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
111
113
|
|
|
112
114
|
/**
|
|
113
115
|
* Returns the current `FloPay` instance, or `null` if the provider
|
|
@@ -330,6 +332,13 @@ interface SplitCardFormProps {
|
|
|
330
332
|
showApplePay?: boolean;
|
|
331
333
|
/** Show Google Pay button. Defaults to `true`. Only renders on supported devices. */
|
|
332
334
|
showGooglePay?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Layout mode for the payment form.
|
|
337
|
+
* - `'default'` — all payment methods + card form shown together (current behavior)
|
|
338
|
+
* - `'buttons'` — PayPal, wallets, and a "Credit / Debit Card" button; clicking the card
|
|
339
|
+
* button expands the card form with a back button to return to the button view
|
|
340
|
+
*/
|
|
341
|
+
layout?: 'default' | 'buttons';
|
|
333
342
|
/** Total amount in cents (smallest currency unit). Used for wallet/PayPal Elements config. */
|
|
334
343
|
totalAmount?: number;
|
|
335
344
|
/** Currency code (used for PayPal Elements config). */
|
package/dist/index.mjs
CHANGED
|
@@ -163,7 +163,7 @@ function useBillingApiUrl() {
|
|
|
163
163
|
import { FloPayError } from "@flopay/shared";
|
|
164
164
|
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
165
165
|
var WALLET_RESUME_KEY = "flopay_wallet_resume";
|
|
166
|
-
function ProcessingOverlay({ status }) {
|
|
166
|
+
function ProcessingOverlay({ status, errorMessage }) {
|
|
167
167
|
return /* @__PURE__ */ jsx3("div", { style: {
|
|
168
168
|
position: "fixed",
|
|
169
169
|
inset: 0,
|
|
@@ -239,11 +239,21 @@ function ProcessingOverlay({ status }) {
|
|
|
239
239
|
status === "success" && "PAYMENT SUCCESSFUL",
|
|
240
240
|
status === "error" && "PAYMENT FAILED"
|
|
241
241
|
] }),
|
|
242
|
+
status === "error" && errorMessage && /* @__PURE__ */ jsx3("p", { style: {
|
|
243
|
+
fontSize: 13,
|
|
244
|
+
color: "#6b7280",
|
|
245
|
+
fontWeight: 400,
|
|
246
|
+
maxWidth: 260,
|
|
247
|
+
lineHeight: 1.4,
|
|
248
|
+
margin: 0
|
|
249
|
+
}, children: errorMessage }),
|
|
242
250
|
/* @__PURE__ */ jsx3("style", { children: `
|
|
243
251
|
@keyframes flopay-spin { to { transform: rotate(360deg); } }
|
|
244
252
|
@keyframes flopay-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
|
|
245
253
|
@keyframes flopay-draw { to { stroke-dashoffset: 0; } }
|
|
246
254
|
@keyframes flopay-shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-4px); } 40%,80% { transform: translateX(4px); } }
|
|
255
|
+
@keyframes flopay-expand { 0% { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateY(-8px); } 100% { opacity: 1; clip-path: inset(0 0 0 0); transform: translateY(0); } }
|
|
256
|
+
@keyframes flopay-fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }
|
|
247
257
|
` })
|
|
248
258
|
] }) });
|
|
249
259
|
}
|
|
@@ -465,10 +475,12 @@ function WalletButtonInner({
|
|
|
465
475
|
options: {
|
|
466
476
|
buttonType: { applePay: "plain", googlePay: "plain" },
|
|
467
477
|
paymentMethods: {
|
|
468
|
-
applePay: showApplePay ? "
|
|
469
|
-
googlePay: showGooglePay ? "
|
|
478
|
+
applePay: showApplePay ? "always" : "never",
|
|
479
|
+
googlePay: showGooglePay ? "always" : "never",
|
|
470
480
|
paypal: "never",
|
|
471
|
-
link: "never"
|
|
481
|
+
link: "never",
|
|
482
|
+
amazonPay: "never",
|
|
483
|
+
klarna: "never"
|
|
472
484
|
},
|
|
473
485
|
layout: { overflow: "never" }
|
|
474
486
|
}
|
|
@@ -499,6 +511,7 @@ function SplitCardFormInner({
|
|
|
499
511
|
showPayPal = true,
|
|
500
512
|
showApplePay = true,
|
|
501
513
|
showGooglePay = true,
|
|
514
|
+
layout = "default",
|
|
502
515
|
totalAmount = 0,
|
|
503
516
|
currency = "usd",
|
|
504
517
|
innerRef
|
|
@@ -508,6 +521,7 @@ function SplitCardFormInner({
|
|
|
508
521
|
const contextBillingUrl = useBillingApiUrl();
|
|
509
522
|
const [processing, setProcessing] = useState2(false);
|
|
510
523
|
const [error, setError] = useState2(null);
|
|
524
|
+
const [showCardForm, setShowCardForm] = useState2(false);
|
|
511
525
|
const [is3DSActive, setIs3DSActive] = useState2(false);
|
|
512
526
|
const [fullName, setFullName] = useState2("");
|
|
513
527
|
const [formReady, setFormReady] = useState2(false);
|
|
@@ -792,8 +806,265 @@ function SplitCardFormInner({
|
|
|
792
806
|
if (!isReady) {
|
|
793
807
|
return /* @__PURE__ */ jsx3("div", { "data-testid": "flopay-loading", "aria-busy": "true", children: "Loading payment form..." });
|
|
794
808
|
}
|
|
809
|
+
const isButtons = layout === "buttons";
|
|
810
|
+
const cardBorderColor = isButtons ? "#e5e7eb" : "#A4A4FF";
|
|
811
|
+
const cardBg = isButtons ? "white" : "#EDEDFF";
|
|
812
|
+
const cardFormBlock = /* @__PURE__ */ jsxs("div", { style: {
|
|
813
|
+
backgroundColor: cardBg,
|
|
814
|
+
borderRadius: "8px",
|
|
815
|
+
padding: isButtons ? "0" : "1rem",
|
|
816
|
+
...isButtons && showCardForm ? {
|
|
817
|
+
animation: "flopay-expand 0.4s cubic-bezier(0.16,1,0.3,1) both"
|
|
818
|
+
} : {}
|
|
819
|
+
}, children: [
|
|
820
|
+
isButtons && showCardForm && /* @__PURE__ */ jsxs("div", { style: {
|
|
821
|
+
display: "flex",
|
|
822
|
+
alignItems: "center",
|
|
823
|
+
padding: "0.75rem 0 0.625rem"
|
|
824
|
+
}, children: [
|
|
825
|
+
/* @__PURE__ */ jsxs(
|
|
826
|
+
"button",
|
|
827
|
+
{
|
|
828
|
+
type: "button",
|
|
829
|
+
onClick: () => setShowCardForm(false),
|
|
830
|
+
style: {
|
|
831
|
+
display: "inline-flex",
|
|
832
|
+
alignItems: "center",
|
|
833
|
+
gap: "0.5rem",
|
|
834
|
+
background: "none",
|
|
835
|
+
border: "none",
|
|
836
|
+
cursor: "pointer",
|
|
837
|
+
color: "#4b5563",
|
|
838
|
+
fontSize: "0.85rem",
|
|
839
|
+
fontWeight: 500,
|
|
840
|
+
padding: 0,
|
|
841
|
+
transition: "color 0.15s",
|
|
842
|
+
flexShrink: 0
|
|
843
|
+
},
|
|
844
|
+
onMouseOver: (e) => {
|
|
845
|
+
e.currentTarget.style.color = "#1f2937";
|
|
846
|
+
},
|
|
847
|
+
onMouseOut: (e) => {
|
|
848
|
+
e.currentTarget.style.color = "#4b5563";
|
|
849
|
+
},
|
|
850
|
+
"aria-label": "Back to payment methods",
|
|
851
|
+
children: [
|
|
852
|
+
/* @__PURE__ */ jsx3("span", { style: {
|
|
853
|
+
display: "inline-flex",
|
|
854
|
+
alignItems: "center",
|
|
855
|
+
justifyContent: "center",
|
|
856
|
+
width: 28,
|
|
857
|
+
height: 28,
|
|
858
|
+
borderRadius: "50%",
|
|
859
|
+
backgroundColor: "#f3f4f6",
|
|
860
|
+
transition: "background-color 0.15s"
|
|
861
|
+
}, 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" }) }) }),
|
|
862
|
+
"Go back"
|
|
863
|
+
]
|
|
864
|
+
}
|
|
865
|
+
),
|
|
866
|
+
/* @__PURE__ */ jsx3("div", { style: { flex: 1, textAlign: "center", fontWeight: 600, fontSize: "1.05rem", color: "#262833", paddingRight: 80 }, children: "Secure card checkout" })
|
|
867
|
+
] }),
|
|
868
|
+
!isButtons && /* @__PURE__ */ jsx3("div", { style: { textAlign: "center", fontWeight: 600, fontSize: "1.1rem", padding: "0.5rem 0", color: "#262833" }, children: "Secure card checkout" }),
|
|
869
|
+
/* @__PURE__ */ jsx3("div", { style: {
|
|
870
|
+
backgroundColor: "white",
|
|
871
|
+
border: `1px solid ${cardBorderColor}`,
|
|
872
|
+
borderTopLeftRadius: "8px",
|
|
873
|
+
borderTopRightRadius: "8px",
|
|
874
|
+
padding: "10px"
|
|
875
|
+
}, children: /* @__PURE__ */ jsx3(CardNumberElement, { onReady: () => setFormReady(true) }) }),
|
|
876
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex" }, children: [
|
|
877
|
+
/* @__PURE__ */ jsx3("div", { style: {
|
|
878
|
+
flex: 1,
|
|
879
|
+
backgroundColor: "white",
|
|
880
|
+
border: `1px solid ${cardBorderColor}`,
|
|
881
|
+
borderTop: "none",
|
|
882
|
+
borderRight: "none",
|
|
883
|
+
borderBottomLeftRadius: "8px",
|
|
884
|
+
padding: "10px"
|
|
885
|
+
}, children: /* @__PURE__ */ jsx3(CardExpiryElement, {}) }),
|
|
886
|
+
/* @__PURE__ */ jsx3("div", { style: {
|
|
887
|
+
flex: 1,
|
|
888
|
+
backgroundColor: "white",
|
|
889
|
+
border: `1px solid ${cardBorderColor}`,
|
|
890
|
+
borderTop: "none",
|
|
891
|
+
borderBottomRightRadius: "8px",
|
|
892
|
+
padding: "10px"
|
|
893
|
+
}, children: /* @__PURE__ */ jsx3(CardCvcElement, {}) })
|
|
894
|
+
] }),
|
|
895
|
+
/* @__PURE__ */ jsx3("div", { style: {
|
|
896
|
+
backgroundColor: "white",
|
|
897
|
+
border: `1px solid ${cardBorderColor}`,
|
|
898
|
+
borderRadius: "8px",
|
|
899
|
+
marginTop: "0.5rem",
|
|
900
|
+
padding: "10px"
|
|
901
|
+
}, children: /* @__PURE__ */ jsx3(
|
|
902
|
+
"input",
|
|
903
|
+
{
|
|
904
|
+
placeholder: "Full Name on Card",
|
|
905
|
+
autoComplete: "cc-name",
|
|
906
|
+
value: fullName,
|
|
907
|
+
onChange: (e) => handleNameChange(e.target.value),
|
|
908
|
+
disabled: isSubmitting,
|
|
909
|
+
required: true,
|
|
910
|
+
style: {
|
|
911
|
+
width: "100%",
|
|
912
|
+
border: "none",
|
|
913
|
+
outline: "none",
|
|
914
|
+
fontSize: "16px",
|
|
915
|
+
fontFamily: "Poppins, sans-serif",
|
|
916
|
+
color: "#262833"
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
) }),
|
|
920
|
+
displayError && /* @__PURE__ */ jsxs("div", { role: "alert", "data-testid": "flopay-error", style: {
|
|
921
|
+
margin: "0.75rem 0",
|
|
922
|
+
padding: "0.625rem 0.875rem",
|
|
923
|
+
background: "#FEF2F2",
|
|
924
|
+
border: "1px solid #FECACA",
|
|
925
|
+
borderRadius: "8px",
|
|
926
|
+
color: "#991B1B",
|
|
927
|
+
fontSize: "0.85rem",
|
|
928
|
+
fontWeight: 600,
|
|
929
|
+
display: "flex",
|
|
930
|
+
alignItems: "center",
|
|
931
|
+
gap: "0.5rem"
|
|
932
|
+
}, children: [
|
|
933
|
+
/* @__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" }) }),
|
|
934
|
+
displayError
|
|
935
|
+
] }),
|
|
936
|
+
children ?? /* @__PURE__ */ jsx3(
|
|
937
|
+
"button",
|
|
938
|
+
{
|
|
939
|
+
type: "submit",
|
|
940
|
+
disabled: !formReady || isSubmitting,
|
|
941
|
+
"data-testid": "flopay-submit",
|
|
942
|
+
style: {
|
|
943
|
+
width: "100%",
|
|
944
|
+
padding: "0.875rem",
|
|
945
|
+
marginTop: "1rem",
|
|
946
|
+
backgroundColor: "#4A49FF",
|
|
947
|
+
color: "white",
|
|
948
|
+
border: "none",
|
|
949
|
+
borderRadius: "8px",
|
|
950
|
+
fontSize: "1rem",
|
|
951
|
+
fontWeight: 600,
|
|
952
|
+
cursor: !formReady || isSubmitting ? "not-allowed" : "pointer",
|
|
953
|
+
opacity: !formReady || isSubmitting ? 0.5 : 1
|
|
954
|
+
},
|
|
955
|
+
children: isSubmitting ? "PROCESSING..." : submitLabel
|
|
956
|
+
}
|
|
957
|
+
),
|
|
958
|
+
!isButtons && /* @__PURE__ */ jsx3("div", { style: {
|
|
959
|
+
backgroundColor: "#EFF9F0",
|
|
960
|
+
borderRadius: "8px",
|
|
961
|
+
padding: "0.75rem",
|
|
962
|
+
marginTop: "0.75rem",
|
|
963
|
+
textAlign: "center",
|
|
964
|
+
fontSize: "0.85rem",
|
|
965
|
+
fontWeight: 600,
|
|
966
|
+
color: "#7DAD3A"
|
|
967
|
+
}, children: "Secure Card Checkout" })
|
|
968
|
+
] });
|
|
969
|
+
if (layout === "buttons") {
|
|
970
|
+
return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
|
|
971
|
+
overlayStatus && /* @__PURE__ */ jsx3(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
|
|
972
|
+
/* @__PURE__ */ jsxs("div", { style: {
|
|
973
|
+
display: showCardForm ? "none" : "flex",
|
|
974
|
+
flexDirection: "column",
|
|
975
|
+
gap: "0.5rem"
|
|
976
|
+
}, children: [
|
|
977
|
+
showPayPal && stripeInstance && /* @__PURE__ */ jsx3(StripeElements, { stripe: stripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx3(
|
|
978
|
+
PayPalButtonInner,
|
|
979
|
+
{
|
|
980
|
+
sessionId,
|
|
981
|
+
email,
|
|
982
|
+
billingApiUrl: resolvedBillingApiUrl,
|
|
983
|
+
onTokenizedBody: dispatchTokenizedBody,
|
|
984
|
+
onErrorChange: updateError,
|
|
985
|
+
isProcessing: isSubmitting
|
|
986
|
+
}
|
|
987
|
+
) }),
|
|
988
|
+
showWallets && stripeInstance && /* @__PURE__ */ jsx3(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx3(
|
|
989
|
+
WalletButtonInner,
|
|
990
|
+
{
|
|
991
|
+
sessionId,
|
|
992
|
+
email,
|
|
993
|
+
billingApiUrl: resolvedBillingApiUrl,
|
|
994
|
+
showApplePay,
|
|
995
|
+
showGooglePay,
|
|
996
|
+
onTokenizedBody: dispatchTokenizedBody,
|
|
997
|
+
onErrorChange: updateError
|
|
998
|
+
}
|
|
999
|
+
) }),
|
|
1000
|
+
/* @__PURE__ */ jsxs(
|
|
1001
|
+
"button",
|
|
1002
|
+
{
|
|
1003
|
+
type: "button",
|
|
1004
|
+
onClick: () => setShowCardForm(true),
|
|
1005
|
+
style: {
|
|
1006
|
+
width: "100%",
|
|
1007
|
+
padding: "0.9rem 1rem",
|
|
1008
|
+
backgroundColor: "white",
|
|
1009
|
+
color: "#262833",
|
|
1010
|
+
border: "1px solid #d1d5db",
|
|
1011
|
+
borderRadius: "8px",
|
|
1012
|
+
fontSize: "0.95rem",
|
|
1013
|
+
fontWeight: 600,
|
|
1014
|
+
cursor: "pointer",
|
|
1015
|
+
display: "flex",
|
|
1016
|
+
alignItems: "center",
|
|
1017
|
+
justifyContent: "center",
|
|
1018
|
+
gap: "0.625rem",
|
|
1019
|
+
transition: "border-color 0.2s, box-shadow 0.2s, transform 0.1s",
|
|
1020
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.04)"
|
|
1021
|
+
},
|
|
1022
|
+
onMouseOver: (e) => {
|
|
1023
|
+
e.currentTarget.style.borderColor = "#A4A4FF";
|
|
1024
|
+
e.currentTarget.style.boxShadow = "0 0 0 1px #A4A4FF, 0 2px 8px rgba(74,73,255,0.08)";
|
|
1025
|
+
},
|
|
1026
|
+
onMouseOut: (e) => {
|
|
1027
|
+
e.currentTarget.style.borderColor = "#d1d5db";
|
|
1028
|
+
e.currentTarget.style.boxShadow = "0 1px 2px rgba(0,0,0,0.04)";
|
|
1029
|
+
},
|
|
1030
|
+
onMouseDown: (e) => {
|
|
1031
|
+
e.currentTarget.style.transform = "scale(0.985)";
|
|
1032
|
+
},
|
|
1033
|
+
onMouseUp: (e) => {
|
|
1034
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
1035
|
+
},
|
|
1036
|
+
children: [
|
|
1037
|
+
/* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1038
|
+
/* @__PURE__ */ jsx3("rect", { width: "20", height: "14", x: "2", y: "5", rx: "2" }),
|
|
1039
|
+
/* @__PURE__ */ jsx3("line", { x1: "2", x2: "22", y1: "10", y2: "10" })
|
|
1040
|
+
] }),
|
|
1041
|
+
"Credit / Debit Card",
|
|
1042
|
+
/* @__PURE__ */ jsx3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "#9ca3af", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx3("path", { d: "M9 18l6-6-6-6" }) })
|
|
1043
|
+
]
|
|
1044
|
+
}
|
|
1045
|
+
),
|
|
1046
|
+
displayError && !showCardForm && /* @__PURE__ */ jsxs("div", { role: "alert", "data-testid": "flopay-error", style: {
|
|
1047
|
+
margin: "0.25rem 0",
|
|
1048
|
+
padding: "0.625rem 0.875rem",
|
|
1049
|
+
background: "#FEF2F2",
|
|
1050
|
+
border: "1px solid #FECACA",
|
|
1051
|
+
borderRadius: "8px",
|
|
1052
|
+
color: "#991B1B",
|
|
1053
|
+
fontSize: "0.85rem",
|
|
1054
|
+
fontWeight: 600,
|
|
1055
|
+
display: "flex",
|
|
1056
|
+
alignItems: "center",
|
|
1057
|
+
gap: "0.5rem"
|
|
1058
|
+
}, children: [
|
|
1059
|
+
/* @__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" }) }),
|
|
1060
|
+
displayError
|
|
1061
|
+
] })
|
|
1062
|
+
] }),
|
|
1063
|
+
showCardForm && cardFormBlock
|
|
1064
|
+
] });
|
|
1065
|
+
}
|
|
795
1066
|
return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className, style: { position: "relative" }, children: [
|
|
796
|
-
overlayStatus && /* @__PURE__ */ jsx3(ProcessingOverlay, { status: overlayStatus }),
|
|
1067
|
+
overlayStatus && /* @__PURE__ */ jsx3(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
|
|
797
1068
|
showWallets && stripeInstance && /* @__PURE__ */ jsx3(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx3(
|
|
798
1069
|
WalletButtonInner,
|
|
799
1070
|
{
|
|
@@ -829,93 +1100,7 @@ function SplitCardFormInner({
|
|
|
829
1100
|
/* @__PURE__ */ jsx3("span", { children: "or pay with card" }),
|
|
830
1101
|
/* @__PURE__ */ jsx3("div", { style: { flex: 1, height: 1, backgroundColor: "#ddd" } })
|
|
831
1102
|
] }),
|
|
832
|
-
|
|
833
|
-
/* @__PURE__ */ jsx3("div", { style: { textAlign: "center", fontWeight: 600, fontSize: "1.1rem", padding: "0.5rem 0", color: "#262833" }, children: "Secure card checkout" }),
|
|
834
|
-
/* @__PURE__ */ jsx3("div", { style: {
|
|
835
|
-
backgroundColor: "white",
|
|
836
|
-
border: "1px solid #A4A4FF",
|
|
837
|
-
borderTopLeftRadius: "8px",
|
|
838
|
-
borderTopRightRadius: "8px",
|
|
839
|
-
padding: "10px"
|
|
840
|
-
}, children: /* @__PURE__ */ jsx3(CardNumberElement, { onReady: () => setFormReady(true) }) }),
|
|
841
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex" }, children: [
|
|
842
|
-
/* @__PURE__ */ jsx3("div", { style: {
|
|
843
|
-
flex: 1,
|
|
844
|
-
backgroundColor: "white",
|
|
845
|
-
border: "1px solid #A4A4FF",
|
|
846
|
-
borderTop: "none",
|
|
847
|
-
borderRight: "none",
|
|
848
|
-
borderBottomLeftRadius: "8px",
|
|
849
|
-
padding: "10px"
|
|
850
|
-
}, children: /* @__PURE__ */ jsx3(CardExpiryElement, {}) }),
|
|
851
|
-
/* @__PURE__ */ jsx3("div", { style: {
|
|
852
|
-
flex: 1,
|
|
853
|
-
backgroundColor: "white",
|
|
854
|
-
border: "1px solid #A4A4FF",
|
|
855
|
-
borderTop: "none",
|
|
856
|
-
borderBottomRightRadius: "8px",
|
|
857
|
-
padding: "10px"
|
|
858
|
-
}, children: /* @__PURE__ */ jsx3(CardCvcElement, {}) })
|
|
859
|
-
] }),
|
|
860
|
-
/* @__PURE__ */ jsx3("div", { style: {
|
|
861
|
-
backgroundColor: "white",
|
|
862
|
-
border: "1px solid #A4A4FF",
|
|
863
|
-
borderRadius: "8px",
|
|
864
|
-
marginTop: "0.5rem",
|
|
865
|
-
padding: "10px"
|
|
866
|
-
}, children: /* @__PURE__ */ jsx3(
|
|
867
|
-
"input",
|
|
868
|
-
{
|
|
869
|
-
placeholder: "Full Name on Card",
|
|
870
|
-
autoComplete: "cc-name",
|
|
871
|
-
value: fullName,
|
|
872
|
-
onChange: (e) => handleNameChange(e.target.value),
|
|
873
|
-
disabled: isSubmitting,
|
|
874
|
-
required: true,
|
|
875
|
-
style: {
|
|
876
|
-
width: "100%",
|
|
877
|
-
border: "none",
|
|
878
|
-
outline: "none",
|
|
879
|
-
fontSize: "16px",
|
|
880
|
-
fontFamily: "Poppins, sans-serif",
|
|
881
|
-
color: "#262833"
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
) }),
|
|
885
|
-
displayError && /* @__PURE__ */ jsx3("div", { role: "alert", "data-testid": "flopay-error", style: { color: "red", margin: "0.75rem 0", fontSize: "0.9rem" }, children: displayError }),
|
|
886
|
-
children ?? /* @__PURE__ */ jsx3(
|
|
887
|
-
"button",
|
|
888
|
-
{
|
|
889
|
-
type: "submit",
|
|
890
|
-
disabled: !formReady || isSubmitting,
|
|
891
|
-
"data-testid": "flopay-submit",
|
|
892
|
-
style: {
|
|
893
|
-
width: "100%",
|
|
894
|
-
padding: "0.875rem",
|
|
895
|
-
marginTop: "1rem",
|
|
896
|
-
backgroundColor: "#4A49FF",
|
|
897
|
-
color: "white",
|
|
898
|
-
border: "none",
|
|
899
|
-
borderRadius: "8px",
|
|
900
|
-
fontSize: "1rem",
|
|
901
|
-
fontWeight: 600,
|
|
902
|
-
cursor: !formReady || isSubmitting ? "not-allowed" : "pointer",
|
|
903
|
-
opacity: !formReady || isSubmitting ? 0.5 : 1
|
|
904
|
-
},
|
|
905
|
-
children: isSubmitting ? "PROCESSING..." : submitLabel
|
|
906
|
-
}
|
|
907
|
-
),
|
|
908
|
-
/* @__PURE__ */ jsx3("div", { style: {
|
|
909
|
-
backgroundColor: "#EFF9F0",
|
|
910
|
-
borderRadius: "8px",
|
|
911
|
-
padding: "0.75rem",
|
|
912
|
-
marginTop: "0.75rem",
|
|
913
|
-
textAlign: "center",
|
|
914
|
-
fontSize: "0.85rem",
|
|
915
|
-
fontWeight: 600,
|
|
916
|
-
color: "#7DAD3A"
|
|
917
|
-
}, children: "Secure Card Checkout" })
|
|
918
|
-
] })
|
|
1103
|
+
cardFormBlock
|
|
919
1104
|
] });
|
|
920
1105
|
}
|
|
921
1106
|
|
|
@@ -934,6 +1119,7 @@ function FloPayCheckout({
|
|
|
934
1119
|
showPayPal = true,
|
|
935
1120
|
showApplePay = true,
|
|
936
1121
|
showGooglePay = true,
|
|
1122
|
+
layout,
|
|
937
1123
|
submitLabel,
|
|
938
1124
|
className,
|
|
939
1125
|
children,
|
|
@@ -1309,6 +1495,7 @@ function FloPayCheckout({
|
|
|
1309
1495
|
showPayPal,
|
|
1310
1496
|
showApplePay,
|
|
1311
1497
|
showGooglePay,
|
|
1498
|
+
layout,
|
|
1312
1499
|
submitLabel,
|
|
1313
1500
|
className
|
|
1314
1501
|
}
|