@flopay/react 1.1.5 → 1.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 +179 -163
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +179 -163
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1246,6 +1246,14 @@ var FLOPAY_KEYFRAMES = `
|
|
|
1246
1246
|
}
|
|
1247
1247
|
`;
|
|
1248
1248
|
var DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT = 44;
|
|
1249
|
+
var BUTTONS_PANEL_HIDDEN_STYLE = {
|
|
1250
|
+
visibility: "hidden",
|
|
1251
|
+
position: "absolute",
|
|
1252
|
+
pointerEvents: "none",
|
|
1253
|
+
width: "100%",
|
|
1254
|
+
height: 0,
|
|
1255
|
+
overflow: "hidden"
|
|
1256
|
+
};
|
|
1249
1257
|
function getButtonMethodLabel(method) {
|
|
1250
1258
|
switch (method) {
|
|
1251
1259
|
case "paypal":
|
|
@@ -2767,173 +2775,181 @@ function SplitCardFormInner({
|
|
|
2767
2775
|
/* @__PURE__ */ jsx6(FloPayKeyframes, {}),
|
|
2768
2776
|
overlayStatus && /* @__PURE__ */ jsx6(ProcessingOverlay, { status: overlayStatus, errorMessage: displayError }),
|
|
2769
2777
|
/* @__PURE__ */ jsxs4("div", { style: { display: "grid" }, children: [
|
|
2770
|
-
/* @__PURE__ */ jsxs4(
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
"
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2778
|
+
/* @__PURE__ */ jsxs4(
|
|
2779
|
+
"div",
|
|
2780
|
+
{
|
|
2781
|
+
"data-testid": "flopay-buttons-panel",
|
|
2782
|
+
"aria-hidden": !isButtonsView && !buttonsAnim ? true : void 0,
|
|
2783
|
+
style: {
|
|
2784
|
+
gridArea: "1 / 1",
|
|
2785
|
+
display: "flex",
|
|
2786
|
+
flexDirection: "column",
|
|
2787
|
+
gap: "0.5rem",
|
|
2788
|
+
// When card form is showing (and not transitioning), hide but keep mounted.
|
|
2789
|
+
...!isButtonsView && !buttonsAnim ? BUTTONS_PANEL_HIDDEN_STYLE : {},
|
|
2790
|
+
...buttonsAnim ? { animation: buttonsAnim, pointerEvents: "none" } : {}
|
|
2791
|
+
},
|
|
2792
|
+
children: [
|
|
2793
|
+
debug && showPayPal && /* @__PURE__ */ jsx6(
|
|
2794
|
+
"pre",
|
|
2795
|
+
{
|
|
2796
|
+
"data-testid": "flopay-direct-paypal-gate-debug",
|
|
2797
|
+
style: {
|
|
2798
|
+
margin: 0,
|
|
2799
|
+
padding: "6px 8px",
|
|
2800
|
+
background: "#eef2ff",
|
|
2801
|
+
border: "1px solid #c7d2fe",
|
|
2802
|
+
borderRadius: 6,
|
|
2803
|
+
color: "#111827",
|
|
2804
|
+
font: "11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
2805
|
+
whiteSpace: "pre-wrap",
|
|
2806
|
+
wordBreak: "break-word"
|
|
2807
|
+
},
|
|
2808
|
+
children: [
|
|
2809
|
+
"FloPay/DirectPayPal-debug (parent gate)",
|
|
2810
|
+
` showPayPal=${showPayPal}`,
|
|
2811
|
+
` directPaypalConfigured=${directPaypalConfigured}`,
|
|
2812
|
+
` inAppBrowserDetected=${String(inAppBrowserDetected)}`,
|
|
2813
|
+
` shouldRenderDirectPayPal=${shouldRenderDirectPayPal}`,
|
|
2814
|
+
` shouldRenderStripePayPal=${shouldRenderStripePayPal}`,
|
|
2815
|
+
` hasPaypalStripeInstance=${!!paypalStripeInstance}`
|
|
2816
|
+
].join("\n")
|
|
2817
|
+
}
|
|
2818
|
+
),
|
|
2819
|
+
shouldRenderDirectPayPal && directPaypal && /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
2820
|
+
paypalDirectRetry && /* @__PURE__ */ jsx6(
|
|
2821
|
+
"div",
|
|
2822
|
+
{
|
|
2823
|
+
"data-testid": "flopay-paypal-direct-retry-notice",
|
|
2824
|
+
style: {
|
|
2825
|
+
padding: "8px 10px",
|
|
2826
|
+
background: "#fef3c7",
|
|
2827
|
+
border: "1px solid #fcd34d",
|
|
2828
|
+
borderRadius: 6,
|
|
2829
|
+
color: "#78350f",
|
|
2830
|
+
fontSize: 13,
|
|
2831
|
+
lineHeight: 1.4
|
|
2832
|
+
},
|
|
2833
|
+
children: "Please confirm your PayPal payment to complete checkout."
|
|
2834
|
+
}
|
|
2835
|
+
),
|
|
2836
|
+
/* @__PURE__ */ jsx6(
|
|
2837
|
+
DirectPayPalButton,
|
|
2838
|
+
{
|
|
2839
|
+
sessionId,
|
|
2840
|
+
billingApiUrl: resolvedBillingApiUrl,
|
|
2841
|
+
email: resolvedAccount.email,
|
|
2842
|
+
clientId: directPaypal.clientId,
|
|
2843
|
+
environment: directPaypal.environment,
|
|
2844
|
+
currency: currency.toUpperCase(),
|
|
2845
|
+
isSubscription,
|
|
2846
|
+
onTokenizedBody: dispatchTokenizedBody,
|
|
2847
|
+
onComplete,
|
|
2848
|
+
onErrorChange: updateError,
|
|
2849
|
+
onDecline,
|
|
2850
|
+
onButtonClick,
|
|
2851
|
+
runBeforeButtonClick,
|
|
2852
|
+
isProcessing: isSubmitting,
|
|
2853
|
+
onLoadStateChange: setDirectPaypalReady,
|
|
2854
|
+
session: session ?? null,
|
|
2855
|
+
existingOrderId: paypalDirectRetry?.orderId,
|
|
2856
|
+
debug
|
|
2857
|
+
},
|
|
2858
|
+
paypalDirectRetry?.orderId ?? "fresh"
|
|
2859
|
+
)
|
|
2860
|
+
] }),
|
|
2861
|
+
shouldRenderStripePayPal && /* @__PURE__ */ jsx6(StripeElements, { stripe: paypalStripeInstance, options: paypalOptions, children: /* @__PURE__ */ jsx6(
|
|
2862
|
+
PayPalButtonInner,
|
|
2863
|
+
{
|
|
2864
|
+
sessionId,
|
|
2865
|
+
email: resolvedAccount.email,
|
|
2866
|
+
billingApiUrl: resolvedBillingApiUrl,
|
|
2867
|
+
onTokenizedBody: dispatchTokenizedBody,
|
|
2868
|
+
onErrorChange: updateError,
|
|
2869
|
+
isProcessing: isSubmitting,
|
|
2870
|
+
onButtonClick,
|
|
2871
|
+
onDecline,
|
|
2872
|
+
runBeforeButtonClick,
|
|
2873
|
+
onLoadStateChange: setPaypalLoadState
|
|
2874
|
+
}
|
|
2875
|
+
) }),
|
|
2876
|
+
shouldRenderWallets ? /* @__PURE__ */ jsx6(StripeElements, { stripe: stripeInstance, options: walletOptions, children: /* @__PURE__ */ jsx6(
|
|
2877
|
+
WalletButtonInner,
|
|
2878
|
+
{
|
|
2879
|
+
sessionId,
|
|
2880
|
+
email: resolvedAccount.email,
|
|
2881
|
+
billingApiUrl: resolvedBillingApiUrl,
|
|
2882
|
+
showApplePay,
|
|
2883
|
+
showGooglePay,
|
|
2884
|
+
onTokenizedBody: dispatchTokenizedBody,
|
|
2885
|
+
onErrorChange: updateError,
|
|
2886
|
+
onButtonClick,
|
|
2887
|
+
onDecline,
|
|
2888
|
+
runBeforeButtonClick,
|
|
2889
|
+
onLoadStateChange: setWalletLoadState
|
|
2890
|
+
}
|
|
2891
|
+
) }) : shouldShowWallets ? /* @__PURE__ */ jsx6("div", { style: { height: DEFAULT_BUTTONS_LAYOUT_BUTTON_HEIGHT, borderRadius: 8, background: "#e5e7eb", animation: "flopay-pulse 1.5s ease-in-out infinite" } }) : null,
|
|
2892
|
+
/* @__PURE__ */ jsx6(
|
|
2893
|
+
"button",
|
|
2894
|
+
{
|
|
2895
|
+
type: "button",
|
|
2896
|
+
onClick: async () => {
|
|
2897
|
+
if (isSubmitting) return;
|
|
2898
|
+
const beforeClick = await runBeforeButtonClick("card");
|
|
2899
|
+
if (!beforeClick.proceed) return;
|
|
2900
|
+
onButtonClick?.("card");
|
|
2901
|
+
expandToCard();
|
|
2902
|
+
},
|
|
2903
|
+
disabled: isSubmitting,
|
|
2904
|
+
style: {
|
|
2905
|
+
width: "100%",
|
|
2906
|
+
...cardButtonSizing,
|
|
2907
|
+
backgroundColor: "white",
|
|
2908
|
+
color: "#262833",
|
|
2909
|
+
border: "1px solid #d1d5db",
|
|
2910
|
+
borderRadius: "8px",
|
|
2911
|
+
fontSize: bStyles.cardButtonFontSize ?? "0.95rem",
|
|
2912
|
+
fontWeight: 600,
|
|
2913
|
+
cursor: isSubmitting ? "not-allowed" : "pointer",
|
|
2914
|
+
display: "flex",
|
|
2915
|
+
alignItems: "center",
|
|
2916
|
+
justifyContent: "center",
|
|
2917
|
+
gap: "0.625rem",
|
|
2918
|
+
transition: "border-color 0.2s, box-shadow 0.2s, transform 0.1s",
|
|
2919
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.04)",
|
|
2920
|
+
position: "relative",
|
|
2921
|
+
opacity: isSubmitting ? 0.6 : 1,
|
|
2922
|
+
...bStyles.cardButton
|
|
2923
|
+
},
|
|
2924
|
+
onMouseDown: (e) => {
|
|
2925
|
+
e.currentTarget.style.transform = "scale(0.985)";
|
|
2926
|
+
},
|
|
2927
|
+
onMouseUp: (e) => {
|
|
2928
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
2929
|
+
},
|
|
2930
|
+
children: /* @__PURE__ */ jsx6(CardButtonContentSlot, { content: cardButtonContent })
|
|
2931
|
+
}
|
|
2932
|
+
),
|
|
2933
|
+
displayError && viewState === "buttons" && /* @__PURE__ */ jsxs4("div", { role: "alert", "data-testid": "flopay-error", style: {
|
|
2934
|
+
margin: "0.25rem 0",
|
|
2935
|
+
padding: "0.625rem 0.875rem",
|
|
2936
|
+
background: "#FEF2F2",
|
|
2937
|
+
border: "1px solid #FECACA",
|
|
2896
2938
|
borderRadius: "8px",
|
|
2897
|
-
|
|
2939
|
+
color: "#991B1B",
|
|
2940
|
+
fontSize: "0.85rem",
|
|
2898
2941
|
fontWeight: 600,
|
|
2899
|
-
cursor: isSubmitting ? "not-allowed" : "pointer",
|
|
2900
2942
|
display: "flex",
|
|
2901
2943
|
alignItems: "center",
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
e.currentTarget.style.transform = "scale(0.985)";
|
|
2912
|
-
},
|
|
2913
|
-
onMouseUp: (e) => {
|
|
2914
|
-
e.currentTarget.style.transform = "scale(1)";
|
|
2915
|
-
},
|
|
2916
|
-
children: /* @__PURE__ */ jsx6(CardButtonContentSlot, { content: cardButtonContent })
|
|
2917
|
-
}
|
|
2918
|
-
),
|
|
2919
|
-
displayError && viewState === "buttons" && /* @__PURE__ */ jsxs4("div", { role: "alert", "data-testid": "flopay-error", style: {
|
|
2920
|
-
margin: "0.25rem 0",
|
|
2921
|
-
padding: "0.625rem 0.875rem",
|
|
2922
|
-
background: "#FEF2F2",
|
|
2923
|
-
border: "1px solid #FECACA",
|
|
2924
|
-
borderRadius: "8px",
|
|
2925
|
-
color: "#991B1B",
|
|
2926
|
-
fontSize: "0.85rem",
|
|
2927
|
-
fontWeight: 600,
|
|
2928
|
-
display: "flex",
|
|
2929
|
-
alignItems: "center",
|
|
2930
|
-
gap: "0.5rem",
|
|
2931
|
-
...bStyles.errorBanner ? bStyles.errorBanner : {}
|
|
2932
|
-
}, children: [
|
|
2933
|
-
/* @__PURE__ */ jsx6("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx6("path", { d: "M12 9v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z", stroke: "#DC2626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
2934
|
-
displayError
|
|
2935
|
-
] })
|
|
2936
|
-
] }),
|
|
2944
|
+
gap: "0.5rem",
|
|
2945
|
+
...bStyles.errorBanner ? bStyles.errorBanner : {}
|
|
2946
|
+
}, children: [
|
|
2947
|
+
/* @__PURE__ */ jsx6("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx6("path", { d: "M12 9v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z", stroke: "#DC2626", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
2948
|
+
displayError
|
|
2949
|
+
] })
|
|
2950
|
+
]
|
|
2951
|
+
}
|
|
2952
|
+
),
|
|
2937
2953
|
isCardView && /* @__PURE__ */ jsx6("div", { style: {
|
|
2938
2954
|
gridArea: "1 / 1",
|
|
2939
2955
|
...cardAnim ? { animation: cardAnim } : {},
|