@stigg/react-sdk 6.9.1 → 6.11.0
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/components/checkout/CheckoutProvider.d.ts +1 -0
- package/dist/components/checkout/hooks/useCheckoutModel.d.ts +2 -0
- package/dist/components/checkout/steps/payment/PaymentMethods.d.ts +2 -2
- package/dist/components/checkout/steps/payment/PaymentStep.d.ts +1 -1
- package/dist/components/checkout/steps/payment/zuora/ZuoraPaymentForm.d.ts +3 -0
- package/dist/components/checkout/steps/payment/zuora/index.d.ts +3 -0
- package/dist/components/checkout/steps/payment/zuora/useZuoraIntegration.d.ts +5 -0
- package/dist/components/checkout/steps/payment/zuora/useZuoraSubmit.d.ts +11 -0
- package/dist/components/checkout/steps/payment/zuora/zuora.utils.d.ts +34 -0
- package/dist/react-sdk.cjs.development.js +583 -48
- package/dist/react-sdk.cjs.development.js.map +1 -1
- package/dist/react-sdk.cjs.production.min.js +1 -1
- package/dist/react-sdk.cjs.production.min.js.map +1 -1
- package/dist/react-sdk.esm.js +583 -48
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/checkout/CheckoutContainer.tsx +19 -3
- package/src/components/checkout/CheckoutProvider.tsx +2 -0
- package/src/components/checkout/hooks/useCheckoutModel.ts +14 -3
- package/src/components/checkout/steps/payment/PaymentMethods.tsx +15 -2
- package/src/components/checkout/steps/payment/PaymentStep.tsx +8 -1
- package/src/components/checkout/steps/payment/zuora/ZuoraPaymentForm.tsx +128 -0
- package/src/components/checkout/steps/payment/zuora/index.ts +11 -0
- package/src/components/checkout/steps/payment/zuora/useZuoraIntegration.ts +56 -0
- package/src/components/checkout/steps/payment/zuora/useZuoraSubmit.ts +125 -0
- package/src/components/checkout/steps/payment/zuora/zuora.utils.ts +72 -0
- package/src/components/checkout/summary/CheckoutSummary.tsx +71 -44
|
@@ -20,6 +20,7 @@ export interface CheckoutContextState {
|
|
|
20
20
|
paymentStep: PaymentStepState;
|
|
21
21
|
widgetState: WidgetState;
|
|
22
22
|
isWidgetWatermarkEnabled: boolean;
|
|
23
|
+
checkoutSuccess: boolean;
|
|
23
24
|
}
|
|
24
25
|
export declare const CheckoutContext: React.Context<[CheckoutContextState, (updater: (state: CheckoutContextState) => void) => void] | null>;
|
|
25
26
|
export declare const useCheckoutContext: () => [CheckoutContextState, (updater: (state: CheckoutContextState) => void) => void];
|
|
@@ -7,6 +7,8 @@ export declare function useCheckoutModel(): {
|
|
|
7
7
|
checkoutState: import("@stigg/js-client-sdk").GetCheckoutStateResults | null | undefined;
|
|
8
8
|
widgetState: WidgetState;
|
|
9
9
|
checkoutLocalization: import("..").CheckoutLocalization;
|
|
10
|
+
checkoutSuccess: boolean;
|
|
10
11
|
setWidgetReadOnly: (readOnly: boolean) => void;
|
|
11
12
|
setIsValid: (isValid: boolean) => void;
|
|
13
|
+
setCheckoutSuccess: (checkoutSuccess: boolean) => void;
|
|
12
14
|
};
|
|
@@ -15,6 +15,6 @@ export declare type NewPaymentMethodProps = Pick<PaymentMethodLayoutProps, 'chec
|
|
|
15
15
|
onSelect: () => void;
|
|
16
16
|
checkoutLocalization: CheckoutLocalization;
|
|
17
17
|
hasExistingPaymentMethod: boolean;
|
|
18
|
-
} & Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber'>;
|
|
18
|
+
} & Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber' | 'onCheckout' | 'onCheckoutCompleted'>;
|
|
19
19
|
export declare function ExistingPaymentMethod({ checked, paymentMethodDetails, readOnly, onSelect }: PaymentMethodProps): JSX.Element | null;
|
|
20
|
-
export declare function NewPaymentMethod({ hasExistingPaymentMethod, checked, onSelect, readOnly, checkoutLocalization, onBillingAddressChange, collectPhoneNumber, }: NewPaymentMethodProps): JSX.Element;
|
|
20
|
+
export declare function NewPaymentMethod({ hasExistingPaymentMethod, checked, onSelect, readOnly, checkoutLocalization, onBillingAddressChange, collectPhoneNumber, onCheckout, onCheckoutCompleted, }: NewPaymentMethodProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckoutContainerProps } from '../../CheckoutContainer';
|
|
3
|
-
export declare function PaymentStep({ onBillingAddressChange, collectPhoneNumber, }: Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber'>): JSX.Element;
|
|
3
|
+
export declare function PaymentStep({ onBillingAddressChange, collectPhoneNumber, onCheckout, onCheckoutCompleted, }: Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber' | 'onCheckout' | 'onCheckoutCompleted'>): JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ZuoraPaymentForm } from './ZuoraPaymentForm';
|
|
2
|
+
export { useZuoraIntegration } from './useZuoraIntegration';
|
|
3
|
+
export { isZuoraLibraryAvailable, loadZuoraLibrary, createZuoraPaymentFormConfig, ZuoraInstance, ZuoraPaymentFormConfig, ZuoraPaymentForm as ZuoraPaymentFormType, ZuoraPaymentResult, } from './zuora.utils';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CheckoutContainerProps } from '../../../CheckoutContainer';
|
|
2
|
+
export declare type ZuoraSubmitResult = {
|
|
3
|
+
success: boolean;
|
|
4
|
+
errorMessage?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type UseZuoraSubmitProps = {
|
|
7
|
+
onSuccess?: () => void;
|
|
8
|
+
} & Pick<CheckoutContainerProps, 'onCheckout' | 'onCheckoutCompleted' | 'disableSuccessAnimation'>;
|
|
9
|
+
export declare function useZuoraSubmit({ onCheckout, onCheckoutCompleted, onSuccess, disableSuccessAnimation, }: UseZuoraSubmitProps): {
|
|
10
|
+
handleZuoraSubmit: (paymentMethodId?: string | undefined) => Promise<ZuoraSubmitResult>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Currency } from '@stigg/js-client-sdk';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
Zuora: (publishableKey: string) => ZuoraInstance;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export declare type ZuoraInstance = {
|
|
8
|
+
createPaymentForm: (config: ZuoraPaymentFormConfig) => Promise<ZuoraPaymentForm>;
|
|
9
|
+
};
|
|
10
|
+
export declare type ZuoraPaymentFormConfig = {
|
|
11
|
+
locale?: string;
|
|
12
|
+
region?: string;
|
|
13
|
+
currency?: string;
|
|
14
|
+
amount?: string;
|
|
15
|
+
profile?: string;
|
|
16
|
+
createPaymentSession: () => Promise<string>;
|
|
17
|
+
onComplete: (result: ZuoraPaymentResult) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
export declare type ZuoraPaymentForm = {
|
|
20
|
+
mount: (containerId: string) => void;
|
|
21
|
+
};
|
|
22
|
+
export declare type ZuoraPaymentResult = {
|
|
23
|
+
success: boolean;
|
|
24
|
+
paymentMethodId?: string;
|
|
25
|
+
paymentId?: string;
|
|
26
|
+
error?: {
|
|
27
|
+
type: string;
|
|
28
|
+
code: string;
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare function isZuoraLibraryAvailable(): boolean;
|
|
33
|
+
export declare function loadZuoraLibrary(): void;
|
|
34
|
+
export declare function createZuoraPaymentFormConfig(createPaymentSession: () => Promise<string>, onComplete: (result: ZuoraPaymentResult) => Promise<void>, currency: Currency, billingCountryCode?: string): ZuoraPaymentFormConfig;
|