@flopay/react 1.2.5 → 1.2.7
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 +16 -7
- 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 +16 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -806,6 +806,15 @@ interface FloPayAutomaticPaymentSuccessEvent {
|
|
|
806
806
|
}
|
|
807
807
|
interface FloPayAutomaticPaymentButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onError'> {
|
|
808
808
|
sessionId?: string;
|
|
809
|
+
/**
|
|
810
|
+
* Session-bound checkout token for a consumer-supplied {@link sessionId}
|
|
811
|
+
* (the `nonce` returned when that session was created). Post-#640 backends
|
|
812
|
+
* require it as `x-checkout-session-token` to read the session and to
|
|
813
|
+
* `/process` it; without it the existing-session path 401s with
|
|
814
|
+
* "Missing checkout session token.". Ignored on the create-session path,
|
|
815
|
+
* where the SDK mints and threads the nonce itself.
|
|
816
|
+
*/
|
|
817
|
+
nonce?: string;
|
|
809
818
|
createSession?: InlineSessionDraft;
|
|
810
819
|
/**
|
|
811
820
|
* @deprecated Ignored. The backend now picks the customer's most recent
|
|
@@ -858,6 +867,6 @@ interface FloPayAutomaticPaymentButtonProps extends Omit<React.ButtonHTMLAttribu
|
|
|
858
867
|
onDecline?: (decline: DeclineEvent) => void;
|
|
859
868
|
children?: React.ReactNode;
|
|
860
869
|
}
|
|
861
|
-
declare function FloPayAutomaticPaymentButton({ sessionId, createSession, paymentMethodId: _deprecatedPaymentMethodId, checkoutMethod: _deprecatedCheckoutMethod, clientId, products, items, subscriptions, account, successUrl, cancelUrl, couponCodes, tagsData, utmMetadata, billingApiUrl, locale, theme, buttonsTheme, buttonsStyles: stylesOverride, onSuccess, onError, onDecline, children, disabled, type, style, ...buttonProps }: FloPayAutomaticPaymentButtonProps): react_jsx_runtime.JSX.Element;
|
|
870
|
+
declare function FloPayAutomaticPaymentButton({ sessionId, nonce, createSession, paymentMethodId: _deprecatedPaymentMethodId, checkoutMethod: _deprecatedCheckoutMethod, clientId, products, items, subscriptions, account, successUrl, cancelUrl, couponCodes, tagsData, utmMetadata, billingApiUrl, locale, theme, buttonsTheme, buttonsStyles: stylesOverride, onSuccess, onError, onDecline, children, disabled, type, style, ...buttonProps }: FloPayAutomaticPaymentButtonProps): react_jsx_runtime.JSX.Element;
|
|
862
871
|
|
|
863
872
|
export { AddressElement, CardCvcElement, CardElement, CardExpiryElement, CardNumberElement, CheckoutForm, type CheckoutFormProps, type CheckoutFormRef, type CheckoutState, DirectPayPalButton, type DirectPayPalButtonProps, type ElementComponentProps, FloPayAutomaticPaymentButton, type FloPayAutomaticPaymentButtonProps, type FloPayAutomaticPaymentSuccessEvent, FloPayCheckout, type FloPayCheckoutProps, FloPayProvider, type FloPayProviderProps, PayPalButton, type PayPalButtonProps, PaymentElement, SplitCardForm, type SplitCardFormProps, type SplitCardFormRef, useCheckout, useElements, useFloPay, usePayPalFloPay };
|
package/dist/index.d.ts
CHANGED
|
@@ -806,6 +806,15 @@ interface FloPayAutomaticPaymentSuccessEvent {
|
|
|
806
806
|
}
|
|
807
807
|
interface FloPayAutomaticPaymentButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onError'> {
|
|
808
808
|
sessionId?: string;
|
|
809
|
+
/**
|
|
810
|
+
* Session-bound checkout token for a consumer-supplied {@link sessionId}
|
|
811
|
+
* (the `nonce` returned when that session was created). Post-#640 backends
|
|
812
|
+
* require it as `x-checkout-session-token` to read the session and to
|
|
813
|
+
* `/process` it; without it the existing-session path 401s with
|
|
814
|
+
* "Missing checkout session token.". Ignored on the create-session path,
|
|
815
|
+
* where the SDK mints and threads the nonce itself.
|
|
816
|
+
*/
|
|
817
|
+
nonce?: string;
|
|
809
818
|
createSession?: InlineSessionDraft;
|
|
810
819
|
/**
|
|
811
820
|
* @deprecated Ignored. The backend now picks the customer's most recent
|
|
@@ -858,6 +867,6 @@ interface FloPayAutomaticPaymentButtonProps extends Omit<React.ButtonHTMLAttribu
|
|
|
858
867
|
onDecline?: (decline: DeclineEvent) => void;
|
|
859
868
|
children?: React.ReactNode;
|
|
860
869
|
}
|
|
861
|
-
declare function FloPayAutomaticPaymentButton({ sessionId, createSession, paymentMethodId: _deprecatedPaymentMethodId, checkoutMethod: _deprecatedCheckoutMethod, clientId, products, items, subscriptions, account, successUrl, cancelUrl, couponCodes, tagsData, utmMetadata, billingApiUrl, locale, theme, buttonsTheme, buttonsStyles: stylesOverride, onSuccess, onError, onDecline, children, disabled, type, style, ...buttonProps }: FloPayAutomaticPaymentButtonProps): react_jsx_runtime.JSX.Element;
|
|
870
|
+
declare function FloPayAutomaticPaymentButton({ sessionId, nonce, createSession, paymentMethodId: _deprecatedPaymentMethodId, checkoutMethod: _deprecatedCheckoutMethod, clientId, products, items, subscriptions, account, successUrl, cancelUrl, couponCodes, tagsData, utmMetadata, billingApiUrl, locale, theme, buttonsTheme, buttonsStyles: stylesOverride, onSuccess, onError, onDecline, children, disabled, type, style, ...buttonProps }: FloPayAutomaticPaymentButtonProps): react_jsx_runtime.JSX.Element;
|
|
862
871
|
|
|
863
872
|
export { AddressElement, CardCvcElement, CardElement, CardExpiryElement, CardNumberElement, CheckoutForm, type CheckoutFormProps, type CheckoutFormRef, type CheckoutState, DirectPayPalButton, type DirectPayPalButtonProps, type ElementComponentProps, FloPayAutomaticPaymentButton, type FloPayAutomaticPaymentButtonProps, type FloPayAutomaticPaymentSuccessEvent, FloPayCheckout, type FloPayCheckoutProps, FloPayProvider, type FloPayProviderProps, PayPalButton, type PayPalButtonProps, PaymentElement, SplitCardForm, type SplitCardFormProps, type SplitCardFormRef, useCheckout, useElements, useFloPay, usePayPalFloPay };
|
package/dist/index.mjs
CHANGED
|
@@ -516,9 +516,9 @@ function buildSyntheticSession(params, checkoutModeOverride) {
|
|
|
516
516
|
cancelUrl: params.cancelUrl,
|
|
517
517
|
checkoutMode: checkoutModeOverride ?? params.checkoutMode ?? "full",
|
|
518
518
|
products: inputProducts.map((p, idx) => ({
|
|
519
|
-
uuid: `synthetic-${p.type}-${idx}`,
|
|
519
|
+
uuid: `synthetic-${p.type ?? "item"}-${idx}`,
|
|
520
520
|
checkoutSessionId: "",
|
|
521
|
-
type: p.type,
|
|
521
|
+
type: p.type ?? "item",
|
|
522
522
|
code: p.code,
|
|
523
523
|
name: p.name ?? null,
|
|
524
524
|
quantity: p.quantity ?? 1,
|
|
@@ -4418,11 +4418,13 @@ async function processSavedPaymentForMode({
|
|
|
4418
4418
|
billingApiUrl,
|
|
4419
4419
|
sessionId,
|
|
4420
4420
|
session,
|
|
4421
|
+
nonce,
|
|
4421
4422
|
tokenizedData,
|
|
4422
4423
|
returnUrl
|
|
4423
4424
|
}) {
|
|
4424
4425
|
const baseUrl = billingApiUrl.replace(/\/+$/, "");
|
|
4425
4426
|
const resolvedSessionId = sessionId ?? session.id;
|
|
4427
|
+
const resolvedNonce = nonce ?? session.clientSecret;
|
|
4426
4428
|
const customerId = session.customer?.id ?? session.accountData?.userId ?? "";
|
|
4427
4429
|
const customerEmail = session.customer?.email ?? session.accountData?.email ?? "";
|
|
4428
4430
|
const firstName = session.customer?.firstName ?? session.accountData?.firstName ?? "";
|
|
@@ -4432,7 +4434,7 @@ async function processSavedPaymentForMode({
|
|
|
4432
4434
|
const api = new PaymentAPI3(baseUrl);
|
|
4433
4435
|
const response = await retryOnceOnFetchFailure(() => api.processPayment(customerId, {
|
|
4434
4436
|
sessionId: resolvedSessionId,
|
|
4435
|
-
nonce:
|
|
4437
|
+
nonce: resolvedNonce,
|
|
4436
4438
|
tokenizedData,
|
|
4437
4439
|
accountData: {
|
|
4438
4440
|
userId: customerId,
|
|
@@ -4475,7 +4477,7 @@ async function processSavedPaymentForMode({
|
|
|
4475
4477
|
const recoveredRedirect = await recover3DSRedirectResult({
|
|
4476
4478
|
billingApiUrl: baseUrl,
|
|
4477
4479
|
sessionId: resolvedSessionId,
|
|
4478
|
-
nonce:
|
|
4480
|
+
nonce: resolvedNonce,
|
|
4479
4481
|
responseJson: json
|
|
4480
4482
|
});
|
|
4481
4483
|
if (recoveredRedirect) {
|
|
@@ -6653,6 +6655,7 @@ function resolveCreateSessionDraft(props) {
|
|
|
6653
6655
|
}
|
|
6654
6656
|
function FloPayAutomaticPaymentButton({
|
|
6655
6657
|
sessionId,
|
|
6658
|
+
nonce,
|
|
6656
6659
|
createSession,
|
|
6657
6660
|
// Deprecated — accepted for back-compat and silently ignored. Backend
|
|
6658
6661
|
// resolves the customer's latest payment method server-side.
|
|
@@ -6784,6 +6787,7 @@ function FloPayAutomaticPaymentButton({
|
|
|
6784
6787
|
if (!session) {
|
|
6785
6788
|
throw new FloPayError8("No session data returned", "api_error");
|
|
6786
6789
|
}
|
|
6790
|
+
const effectiveNonce = session.clientSecret || nonce;
|
|
6787
6791
|
if (session.status === "complete") {
|
|
6788
6792
|
await showSuccess({
|
|
6789
6793
|
result: { status: "succeeded" },
|
|
@@ -6839,7 +6843,8 @@ function FloPayAutomaticPaymentButton({
|
|
|
6839
6843
|
const result = await processSavedPaymentForMode({
|
|
6840
6844
|
billingApiUrl: resolvedBillingUrl,
|
|
6841
6845
|
sessionId: resolvedSessionId ?? session.id,
|
|
6842
|
-
session
|
|
6846
|
+
session,
|
|
6847
|
+
nonce: effectiveNonce
|
|
6843
6848
|
});
|
|
6844
6849
|
if (result.type !== "success") {
|
|
6845
6850
|
throw checkoutProcessErrorToFloPayError(
|
|
@@ -6866,11 +6871,13 @@ function FloPayAutomaticPaymentButton({
|
|
|
6866
6871
|
if (shouldShowFallbackCheckout(floPayErr, fallbackSessionId) && fallbackSessionId && isMountedRef.current) {
|
|
6867
6872
|
setFallbackSession({
|
|
6868
6873
|
sessionId: fallbackSessionId,
|
|
6869
|
-
errorMessage: floPayErr.message
|
|
6874
|
+
errorMessage: floPayErr.message,
|
|
6875
|
+
nonce: effectiveNonce || void 0
|
|
6870
6876
|
});
|
|
6871
6877
|
}
|
|
6872
6878
|
}
|
|
6873
6879
|
}, [
|
|
6880
|
+
nonce,
|
|
6874
6881
|
resolvedBillingUrl,
|
|
6875
6882
|
showError,
|
|
6876
6883
|
showSuccess
|
|
@@ -6911,7 +6918,7 @@ function FloPayAutomaticPaymentButton({
|
|
|
6911
6918
|
try {
|
|
6912
6919
|
const api = new PaymentAPI7(resolvedBillingUrl);
|
|
6913
6920
|
if (sessionId) {
|
|
6914
|
-
const result = await api.getUnifiedCheckoutSession(sessionId);
|
|
6921
|
+
const result = await api.getUnifiedCheckoutSession(sessionId, nonce);
|
|
6915
6922
|
await processResolvedSession(result, sessionId);
|
|
6916
6923
|
return;
|
|
6917
6924
|
}
|
|
@@ -6950,6 +6957,7 @@ function FloPayAutomaticPaymentButton({
|
|
|
6950
6957
|
createSessionDraft,
|
|
6951
6958
|
disabled,
|
|
6952
6959
|
isProcessing,
|
|
6960
|
+
nonce,
|
|
6953
6961
|
processResolvedSession,
|
|
6954
6962
|
resolvedBillingUrl,
|
|
6955
6963
|
sessionId,
|
|
@@ -7084,6 +7092,7 @@ function FloPayAutomaticPaymentButton({
|
|
|
7084
7092
|
FloPayCheckout,
|
|
7085
7093
|
{
|
|
7086
7094
|
sessionId: fallbackSession.sessionId,
|
|
7095
|
+
nonce: fallbackSession.nonce,
|
|
7087
7096
|
checkoutMode: "full",
|
|
7088
7097
|
billingApiUrl: resolvedBillingUrl,
|
|
7089
7098
|
locale,
|