@flopay/react 0.4.3 → 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.d.cts CHANGED
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { FloPay, FloPayElements } from '@flopay/js';
3
3
  import * as _flopay_shared from '@flopay/shared';
4
- import { FloPayAppearance, InlineSessionDraft, FloPayError, PaymentResult, DeclineEvent, CheckoutButtonMethod, BeforeButtonClickEvent, InlineSessionPatch, CheckoutMode, CheckoutSession, ElementOptions, ElementChangeEvent, TokenizedBody } from '@flopay/shared';
4
+ import { FloPayAppearance, InlineSessionDraft, FloPayError, PaymentResult, DeclineEvent, CheckoutButtonMethod, BeforeButtonClickEvent, InlineSessionPatch, CheckoutMode, CheckoutSession, ElementOptions, ElementChangeEvent, TokenizedBody, CheckoutItem, CheckoutSubscription, ButtonsLayoutTheme, ButtonsLayoutStyles } from '@flopay/shared';
5
5
  export { BeforeButtonClickEvent, CheckoutButtonMethod, DeclineEvent, InlineSessionDraft, InlineSessionPatch } from '@flopay/shared';
6
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
7
 
7
8
  /** Props for the `FloPayProvider` component. */
8
9
  interface FloPayProviderProps {
@@ -102,6 +103,8 @@ interface FloPayCheckoutProps {
102
103
  cardBackButtonContent?: React.ReactNode;
103
104
  /** Custom React content rendered for the card-form title. */
104
105
  cardTitleContent?: React.ReactNode;
106
+ /** Whether to show the default security footer in `layout="default"`. Defaults to `true`. */
107
+ showSecurityFooter?: boolean;
105
108
  /**
106
109
  * Called when a payment method button is clicked.
107
110
  * `method`: `'card'` | `'paypal'` | `'apple_pay'` | `'google_pay'`
@@ -125,6 +128,8 @@ interface FloPayCheckoutProps {
125
128
  submitLabel?: string;
126
129
  /** Additional CSS class for the wrapper. */
127
130
  className?: string;
131
+ /** Seed an initial checkout error message for the rendered payment form. */
132
+ initialErrorMessage?: string | null;
128
133
  /**
129
134
  * Override the default `SplitCardForm`. When provided, children are rendered
130
135
  * inside the initialized `FloPayProvider` with session props auto-injected.
@@ -164,7 +169,7 @@ interface FloPayCheckoutProps {
164
169
  * />
165
170
  * ```
166
171
  */
167
- 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, 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;
168
173
 
169
174
  /**
170
175
  * Returns the current `FloPay` instance, or `null` if the provider
@@ -425,6 +430,8 @@ interface SplitCardFormProps {
425
430
  cardBackButtonContent?: React.ReactNode;
426
431
  /** Custom React content rendered for the card-form title. */
427
432
  cardTitleContent?: React.ReactNode;
433
+ /** Whether to show the default security footer in `layout="default"`. Defaults to `true`. */
434
+ showSecurityFooter?: boolean;
428
435
  /**
429
436
  * Called when a payment method button is clicked.
430
437
  * `method`: `'card'` | `'paypal'` | `'apple_pay'` | `'google_pay'`
@@ -521,4 +528,35 @@ interface PayPalButtonProps {
521
528
  */
522
529
  declare function PayPalButton({ sessionId, billingApiUrl, email, userId, firstName, lastName, chv, onTokenizedBody, onComplete, onErrorChange, isProcessing, }: PayPalButtonProps): React.ReactElement;
523
530
 
524
- export { AddressElement, CardCvcElement, CardElement, CardExpiryElement, CardNumberElement, CheckoutForm, type CheckoutFormProps, type CheckoutFormRef, type CheckoutState, type ElementComponentProps, FloPayCheckout, type FloPayCheckoutProps, FloPayProvider, type FloPayProviderProps, PayPalButton, type PayPalButtonProps, PaymentElement, SplitCardForm, type SplitCardFormProps, type SplitCardFormRef, useCheckout, useElements, useFloPay, usePayPalFloPay };
531
+ interface FloPayAutomaticPaymentSuccessEvent {
532
+ result: PaymentResult;
533
+ session: CheckoutSession | null;
534
+ sessionId: string | null;
535
+ autoCompleted: boolean;
536
+ }
537
+ interface FloPayAutomaticPaymentButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onError'> {
538
+ sessionId?: string;
539
+ createSession?: InlineSessionDraft;
540
+ paymentMethodId?: string;
541
+ clientId?: string;
542
+ items?: CheckoutItem[];
543
+ subscriptions?: CheckoutSubscription[];
544
+ account?: InlineSessionDraft['account'];
545
+ successUrl?: string;
546
+ cancelUrl?: string;
547
+ couponCodes?: string[];
548
+ tagsData?: InlineSessionDraft['tagsData'];
549
+ utmMetadata?: InlineSessionDraft['utmMetadata'];
550
+ billingApiUrl?: string;
551
+ locale?: string;
552
+ fallbackPublishableKey?: string;
553
+ buttonsTheme?: ButtonsLayoutTheme;
554
+ buttonsStyles?: ButtonsLayoutStyles;
555
+ onSuccess?: (event: FloPayAutomaticPaymentSuccessEvent) => void;
556
+ onError?: (error: FloPayError) => void;
557
+ onDecline?: (decline: DeclineEvent) => void;
558
+ children?: React.ReactNode;
559
+ }
560
+ declare function FloPayAutomaticPaymentButton({ sessionId, createSession, paymentMethodId, clientId, items, subscriptions, account, successUrl, cancelUrl, couponCodes, tagsData, utmMetadata, billingApiUrl, locale, fallbackPublishableKey, buttonsTheme, buttonsStyles: stylesOverride, onSuccess, onError, onDecline, children, disabled, type, style, ...buttonProps }: FloPayAutomaticPaymentButtonProps): react_jsx_runtime.JSX.Element;
561
+
562
+ export { AddressElement, CardCvcElement, CardElement, CardExpiryElement, CardNumberElement, CheckoutForm, type CheckoutFormProps, type CheckoutFormRef, type CheckoutState, 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
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import { FloPay, FloPayElements } from '@flopay/js';
3
3
  import * as _flopay_shared from '@flopay/shared';
4
- import { FloPayAppearance, InlineSessionDraft, FloPayError, PaymentResult, DeclineEvent, CheckoutButtonMethod, BeforeButtonClickEvent, InlineSessionPatch, CheckoutMode, CheckoutSession, ElementOptions, ElementChangeEvent, TokenizedBody } from '@flopay/shared';
4
+ import { FloPayAppearance, InlineSessionDraft, FloPayError, PaymentResult, DeclineEvent, CheckoutButtonMethod, BeforeButtonClickEvent, InlineSessionPatch, CheckoutMode, CheckoutSession, ElementOptions, ElementChangeEvent, TokenizedBody, CheckoutItem, CheckoutSubscription, ButtonsLayoutTheme, ButtonsLayoutStyles } from '@flopay/shared';
5
5
  export { BeforeButtonClickEvent, CheckoutButtonMethod, DeclineEvent, InlineSessionDraft, InlineSessionPatch } from '@flopay/shared';
6
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
7
 
7
8
  /** Props for the `FloPayProvider` component. */
8
9
  interface FloPayProviderProps {
@@ -102,6 +103,8 @@ interface FloPayCheckoutProps {
102
103
  cardBackButtonContent?: React.ReactNode;
103
104
  /** Custom React content rendered for the card-form title. */
104
105
  cardTitleContent?: React.ReactNode;
106
+ /** Whether to show the default security footer in `layout="default"`. Defaults to `true`. */
107
+ showSecurityFooter?: boolean;
105
108
  /**
106
109
  * Called when a payment method button is clicked.
107
110
  * `method`: `'card'` | `'paypal'` | `'apple_pay'` | `'google_pay'`
@@ -125,6 +128,8 @@ interface FloPayCheckoutProps {
125
128
  submitLabel?: string;
126
129
  /** Additional CSS class for the wrapper. */
127
130
  className?: string;
131
+ /** Seed an initial checkout error message for the rendered payment form. */
132
+ initialErrorMessage?: string | null;
128
133
  /**
129
134
  * Override the default `SplitCardForm`. When provided, children are rendered
130
135
  * inside the initialized `FloPayProvider` with session props auto-injected.
@@ -164,7 +169,7 @@ interface FloPayCheckoutProps {
164
169
  * />
165
170
  * ```
166
171
  */
167
- 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, 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;
168
173
 
169
174
  /**
170
175
  * Returns the current `FloPay` instance, or `null` if the provider
@@ -425,6 +430,8 @@ interface SplitCardFormProps {
425
430
  cardBackButtonContent?: React.ReactNode;
426
431
  /** Custom React content rendered for the card-form title. */
427
432
  cardTitleContent?: React.ReactNode;
433
+ /** Whether to show the default security footer in `layout="default"`. Defaults to `true`. */
434
+ showSecurityFooter?: boolean;
428
435
  /**
429
436
  * Called when a payment method button is clicked.
430
437
  * `method`: `'card'` | `'paypal'` | `'apple_pay'` | `'google_pay'`
@@ -521,4 +528,35 @@ interface PayPalButtonProps {
521
528
  */
522
529
  declare function PayPalButton({ sessionId, billingApiUrl, email, userId, firstName, lastName, chv, onTokenizedBody, onComplete, onErrorChange, isProcessing, }: PayPalButtonProps): React.ReactElement;
523
530
 
524
- export { AddressElement, CardCvcElement, CardElement, CardExpiryElement, CardNumberElement, CheckoutForm, type CheckoutFormProps, type CheckoutFormRef, type CheckoutState, type ElementComponentProps, FloPayCheckout, type FloPayCheckoutProps, FloPayProvider, type FloPayProviderProps, PayPalButton, type PayPalButtonProps, PaymentElement, SplitCardForm, type SplitCardFormProps, type SplitCardFormRef, useCheckout, useElements, useFloPay, usePayPalFloPay };
531
+ interface FloPayAutomaticPaymentSuccessEvent {
532
+ result: PaymentResult;
533
+ session: CheckoutSession | null;
534
+ sessionId: string | null;
535
+ autoCompleted: boolean;
536
+ }
537
+ interface FloPayAutomaticPaymentButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onError'> {
538
+ sessionId?: string;
539
+ createSession?: InlineSessionDraft;
540
+ paymentMethodId?: string;
541
+ clientId?: string;
542
+ items?: CheckoutItem[];
543
+ subscriptions?: CheckoutSubscription[];
544
+ account?: InlineSessionDraft['account'];
545
+ successUrl?: string;
546
+ cancelUrl?: string;
547
+ couponCodes?: string[];
548
+ tagsData?: InlineSessionDraft['tagsData'];
549
+ utmMetadata?: InlineSessionDraft['utmMetadata'];
550
+ billingApiUrl?: string;
551
+ locale?: string;
552
+ fallbackPublishableKey?: string;
553
+ buttonsTheme?: ButtonsLayoutTheme;
554
+ buttonsStyles?: ButtonsLayoutStyles;
555
+ onSuccess?: (event: FloPayAutomaticPaymentSuccessEvent) => void;
556
+ onError?: (error: FloPayError) => void;
557
+ onDecline?: (decline: DeclineEvent) => void;
558
+ children?: React.ReactNode;
559
+ }
560
+ declare function FloPayAutomaticPaymentButton({ sessionId, createSession, paymentMethodId, clientId, items, subscriptions, account, successUrl, cancelUrl, couponCodes, tagsData, utmMetadata, billingApiUrl, locale, fallbackPublishableKey, buttonsTheme, buttonsStyles: stylesOverride, onSuccess, onError, onDecline, children, disabled, type, style, ...buttonProps }: FloPayAutomaticPaymentButtonProps): react_jsx_runtime.JSX.Element;
561
+
562
+ export { AddressElement, CardCvcElement, CardElement, CardExpiryElement, CardNumberElement, CheckoutForm, type CheckoutFormProps, type CheckoutFormRef, type CheckoutState, 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 };