@flopay/react 0.4.4 → 0.4.5
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 +23 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +23 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -128,6 +128,8 @@ interface FloPayCheckoutProps {
|
|
|
128
128
|
submitLabel?: string;
|
|
129
129
|
/** Additional CSS class for the wrapper. */
|
|
130
130
|
className?: string;
|
|
131
|
+
/** Seed an initial checkout error message for the rendered payment form. */
|
|
132
|
+
initialErrorMessage?: string | null;
|
|
131
133
|
/**
|
|
132
134
|
* Override the default `SplitCardForm`. When provided, children are rendered
|
|
133
135
|
* inside the initialized `FloPayProvider` with session props auto-injected.
|
|
@@ -167,7 +169,7 @@ interface FloPayCheckoutProps {
|
|
|
167
169
|
* />
|
|
168
170
|
* ```
|
|
169
171
|
*/
|
|
170
|
-
declare function FloPayCheckout({ sessionId: sessionIdProp, createSession: createSessionParams, billingApiUrl, appearance, locale, fallbackPublishableKey, loading: loadingNode, error: errorNode, onComplete, onError, onDecline, onFullNameChange, onCountryChange, onZipChange, showPayPal, showApplePay, showGooglePay, layout, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, avsLayout, submitLabel, className, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
172
|
+
declare function FloPayCheckout({ sessionId: sessionIdProp, createSession: createSessionParams, billingApiUrl, appearance, locale, fallbackPublishableKey, loading: loadingNode, error: errorNode, onComplete, onError, onDecline, onFullNameChange, onCountryChange, onZipChange, showPayPal, showApplePay, showGooglePay, layout, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, avsLayout, submitLabel, className, initialErrorMessage, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
171
173
|
|
|
172
174
|
/**
|
|
173
175
|
* Returns the current `FloPay` instance, or `null` if the provider
|
package/dist/index.d.ts
CHANGED
|
@@ -128,6 +128,8 @@ interface FloPayCheckoutProps {
|
|
|
128
128
|
submitLabel?: string;
|
|
129
129
|
/** Additional CSS class for the wrapper. */
|
|
130
130
|
className?: string;
|
|
131
|
+
/** Seed an initial checkout error message for the rendered payment form. */
|
|
132
|
+
initialErrorMessage?: string | null;
|
|
131
133
|
/**
|
|
132
134
|
* Override the default `SplitCardForm`. When provided, children are rendered
|
|
133
135
|
* inside the initialized `FloPayProvider` with session props auto-injected.
|
|
@@ -167,7 +169,7 @@ interface FloPayCheckoutProps {
|
|
|
167
169
|
* />
|
|
168
170
|
* ```
|
|
169
171
|
*/
|
|
170
|
-
declare function FloPayCheckout({ sessionId: sessionIdProp, createSession: createSessionParams, billingApiUrl, appearance, locale, fallbackPublishableKey, loading: loadingNode, error: errorNode, onComplete, onError, onDecline, onFullNameChange, onCountryChange, onZipChange, showPayPal, showApplePay, showGooglePay, layout, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, avsLayout, submitLabel, className, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
172
|
+
declare function FloPayCheckout({ sessionId: sessionIdProp, createSession: createSessionParams, billingApiUrl, appearance, locale, fallbackPublishableKey, loading: loadingNode, error: errorNode, onComplete, onError, onDecline, onFullNameChange, onCountryChange, onZipChange, showPayPal, showApplePay, showGooglePay, layout, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, avsLayout, submitLabel, className, initialErrorMessage, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
171
173
|
|
|
172
174
|
/**
|
|
173
175
|
* Returns the current `FloPay` instance, or `null` if the provider
|
package/dist/index.mjs
CHANGED
|
@@ -2399,6 +2399,7 @@ function FloPayCheckout({
|
|
|
2399
2399
|
avsLayout,
|
|
2400
2400
|
submitLabel,
|
|
2401
2401
|
className,
|
|
2402
|
+
initialErrorMessage = null,
|
|
2402
2403
|
children,
|
|
2403
2404
|
checkoutMode: checkoutModeProp,
|
|
2404
2405
|
confirmLabel,
|
|
@@ -2421,7 +2422,7 @@ function FloPayCheckout({
|
|
|
2421
2422
|
const [loadError, setLoadError] = useState3(null);
|
|
2422
2423
|
const [currentMode, setCurrentMode] = useState3("full");
|
|
2423
2424
|
const [confirmProcessing, setConfirmProcessing] = useState3(false);
|
|
2424
|
-
const [modeError, setModeError] = useState3(
|
|
2425
|
+
const [modeError, setModeError] = useState3(initialErrorMessage);
|
|
2425
2426
|
const [modeOverlayStatus, setModeOverlayStatus] = useState3(null);
|
|
2426
2427
|
const [modeOverlayError, setModeOverlayError] = useState3(null);
|
|
2427
2428
|
const [createSessionPatch, setCreateSessionPatch] = useState3(void 0);
|
|
@@ -2468,6 +2469,9 @@ function FloPayCheckout({
|
|
|
2468
2469
|
setCreateSessionPatch(void 0);
|
|
2469
2470
|
setCreateSessionPatchBaseHash(baseCreateSessionHash);
|
|
2470
2471
|
}, [baseCreateSessionHash]);
|
|
2472
|
+
useEffect4(() => {
|
|
2473
|
+
setModeError(initialErrorMessage);
|
|
2474
|
+
}, [initialErrorMessage]);
|
|
2471
2475
|
const emitDecline = useCallback2(
|
|
2472
2476
|
(method, input, overrides) => {
|
|
2473
2477
|
onDeclineRef.current?.(buildDeclineEvent(method, input, overrides));
|
|
@@ -2560,10 +2564,10 @@ function FloPayCheckout({
|
|
|
2560
2564
|
}, [sessionIdProp]);
|
|
2561
2565
|
useEffect4(() => {
|
|
2562
2566
|
autoCheckoutAttempted.current = false;
|
|
2563
|
-
setModeError(
|
|
2567
|
+
setModeError(initialErrorMessage);
|
|
2564
2568
|
setModeOverlayError(null);
|
|
2565
2569
|
setModeOverlayStatus(null);
|
|
2566
|
-
}, [
|
|
2570
|
+
}, [createSessionHash, initialErrorMessage, sessionIdProp]);
|
|
2567
2571
|
async function resolveInlineSession(params, cacheKey) {
|
|
2568
2572
|
const api = new PaymentAPI2(resolvedBillingUrl);
|
|
2569
2573
|
let sid = typeof window !== "undefined" ? window.sessionStorage.getItem(cacheKey) : null;
|
|
@@ -4408,7 +4412,7 @@ function FloPayAutomaticPaymentButton({
|
|
|
4408
4412
|
padding: "1.5rem",
|
|
4409
4413
|
zIndex: 1100
|
|
4410
4414
|
},
|
|
4411
|
-
children: /* @__PURE__ */
|
|
4415
|
+
children: /* @__PURE__ */ jsx9(
|
|
4412
4416
|
"div",
|
|
4413
4417
|
{
|
|
4414
4418
|
style: {
|
|
@@ -4424,48 +4428,21 @@ function FloPayAutomaticPaymentButton({
|
|
|
4424
4428
|
flexDirection: "column",
|
|
4425
4429
|
gap: "1rem"
|
|
4426
4430
|
},
|
|
4427
|
-
children:
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
color: "#b91c1c",
|
|
4443
|
-
border: "1px solid #fecaca",
|
|
4444
|
-
borderRadius: "12px",
|
|
4445
|
-
padding: "0.75rem 1rem",
|
|
4446
|
-
fontSize: "0.9rem",
|
|
4447
|
-
lineHeight: 1.5
|
|
4448
|
-
},
|
|
4449
|
-
children: fallbackSession.errorMessage
|
|
4450
|
-
}
|
|
4451
|
-
)
|
|
4452
|
-
}
|
|
4453
|
-
),
|
|
4454
|
-
/* @__PURE__ */ jsx9(
|
|
4455
|
-
FloPayCheckout,
|
|
4456
|
-
{
|
|
4457
|
-
sessionId: fallbackSession.sessionId,
|
|
4458
|
-
checkoutMode: "full",
|
|
4459
|
-
billingApiUrl: resolvedBillingUrl,
|
|
4460
|
-
fallbackPublishableKey,
|
|
4461
|
-
cardTitleContent: null,
|
|
4462
|
-
showSecurityFooter: false,
|
|
4463
|
-
onComplete: handleFallbackComplete,
|
|
4464
|
-
onError: handleFallbackError,
|
|
4465
|
-
onDecline: handleFallbackDecline
|
|
4466
|
-
}
|
|
4467
|
-
)
|
|
4468
|
-
]
|
|
4431
|
+
children: /* @__PURE__ */ jsx9(
|
|
4432
|
+
FloPayCheckout,
|
|
4433
|
+
{
|
|
4434
|
+
sessionId: fallbackSession.sessionId,
|
|
4435
|
+
checkoutMode: "full",
|
|
4436
|
+
billingApiUrl: resolvedBillingUrl,
|
|
4437
|
+
fallbackPublishableKey,
|
|
4438
|
+
initialErrorMessage: fallbackSession.errorMessage,
|
|
4439
|
+
cardTitleContent: null,
|
|
4440
|
+
showSecurityFooter: false,
|
|
4441
|
+
onComplete: handleFallbackComplete,
|
|
4442
|
+
onError: handleFallbackError,
|
|
4443
|
+
onDecline: handleFallbackDecline
|
|
4444
|
+
}
|
|
4445
|
+
)
|
|
4469
4446
|
}
|
|
4470
4447
|
)
|
|
4471
4448
|
}
|