@stigg/react-sdk 4.4.1 → 4.4.2
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/CheckoutContainer.d.ts +2 -1
- package/dist/components/checkout/index.d.ts +3 -2
- 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/stripe/StripePaymentForm.d.ts +1 -1
- package/dist/react-sdk.cjs.development.js +20 -10
- 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 +20 -10
- package/dist/react-sdk.esm.js.map +1 -1
- package/dist/stories/mocks/checkout/mockCheckoutState.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/checkout/CheckoutContainer.tsx +14 -4
- package/src/components/checkout/index.ts +8 -2
- package/src/components/checkout/steps/payment/PaymentMethods.tsx +3 -2
- package/src/components/checkout/steps/payment/PaymentStep.tsx +5 -1
- package/src/components/checkout/steps/payment/stripe/StripePaymentForm.tsx +6 -2
- package/src/stories/mocks/checkout/mockCheckoutState.ts +1 -1
|
@@ -24,6 +24,7 @@ export declare type CheckoutContainerProps = {
|
|
|
24
24
|
}) => Promise<void>;
|
|
25
25
|
disablePromotionCode?: boolean;
|
|
26
26
|
disableSuccessAnimation?: boolean;
|
|
27
|
+
collectPhoneNumber?: boolean;
|
|
27
28
|
onMockCheckoutPreview?: MockCheckoutPreviewCallback;
|
|
28
29
|
};
|
|
29
|
-
export declare function CheckoutContainer({ onCheckout, onCheckoutCompleted, onChangePlan, onBillingAddressChange, disablePromotionCode, disableSuccessAnimation, onMockCheckoutPreview, }: CheckoutContainerProps): JSX.Element;
|
|
30
|
+
export declare function CheckoutContainer({ onCheckout, onCheckoutCompleted, onChangePlan, onBillingAddressChange, collectPhoneNumber, disablePromotionCode, disableSuccessAnimation, onMockCheckoutPreview, }: CheckoutContainerProps): JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { CheckoutTheme } from './theme';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { OnCheckoutCompletedParams, OnCheckoutParams, CheckoutResult, CheckoutContainerProps, } from './CheckoutContainer';
|
|
3
|
+
export { CheckoutProviderProps } from './CheckoutProvider';
|
|
4
4
|
export { CheckoutLocalization } from './textOverrides';
|
|
5
|
+
export { Checkout, CheckoutProps } from './Checkout';
|
|
5
6
|
export * from './types';
|
|
@@ -16,6 +16,6 @@ export declare type PaymentMethodProps = Pick<Customer, 'paymentMethodDetails'>
|
|
|
16
16
|
export declare type NewPaymentMethodProps = Pick<PaymentMethodLayoutProps, 'checked' | 'readOnly'> & {
|
|
17
17
|
onSelect: () => void;
|
|
18
18
|
checkoutLocalization: CheckoutLocalization;
|
|
19
|
-
} & Pick<CheckoutContainerProps, 'onBillingAddressChange'>;
|
|
19
|
+
} & Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber'>;
|
|
20
20
|
export declare function ExistingPaymentMethod({ checked, paymentMethodDetails, readOnly, onSelect }: PaymentMethodProps): JSX.Element | null;
|
|
21
|
-
export declare function NewPaymentMethod({ checked, onSelect, readOnly, checkoutLocalization, onBillingAddressChange, }: NewPaymentMethodProps): JSX.Element;
|
|
21
|
+
export declare function NewPaymentMethod({ checked, onSelect, readOnly, checkoutLocalization, onBillingAddressChange, collectPhoneNumber, }: NewPaymentMethodProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckoutContainerProps } from '../../CheckoutContainer';
|
|
3
|
-
export declare function PaymentStep({ onBillingAddressChange }: Pick<CheckoutContainerProps, 'onBillingAddressChange'>): JSX.Element;
|
|
3
|
+
export declare function PaymentStep({ onBillingAddressChange, collectPhoneNumber, }: Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber'>): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckoutContainerProps } from '../../../CheckoutContainer';
|
|
3
|
-
export declare function StripePaymentForm({ onBillingAddressChange }: Pick<CheckoutContainerProps, 'onBillingAddressChange'>): JSX.Element;
|
|
3
|
+
export declare function StripePaymentForm({ onBillingAddressChange, collectPhoneNumber, }: Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber'>): JSX.Element;
|
|
@@ -8019,7 +8019,8 @@ var _excluded$6 = ["postal_code"];
|
|
|
8019
8019
|
function StripePaymentForm(_ref) {
|
|
8020
8020
|
var _configuration$conten;
|
|
8021
8021
|
|
|
8022
|
-
var onBillingAddressChange = _ref.onBillingAddressChange
|
|
8022
|
+
var onBillingAddressChange = _ref.onBillingAddressChange,
|
|
8023
|
+
collectPhoneNumber = _ref.collectPhoneNumber;
|
|
8023
8024
|
|
|
8024
8025
|
var _useCheckoutModel = useCheckoutModel(),
|
|
8025
8026
|
checkoutState = _useCheckoutModel.checkoutState,
|
|
@@ -8035,6 +8036,7 @@ function StripePaymentForm(_ref) {
|
|
|
8035
8036
|
configuration = _ref2.configuration;
|
|
8036
8037
|
|
|
8037
8038
|
var readOnly = widgetState.readOnly;
|
|
8039
|
+
var shouldCollectPhoneNumber = !!(collectPhoneNumber != null ? collectPhoneNumber : configuration == null ? void 0 : (_configuration$conten = configuration.content) == null ? void 0 : _configuration$conten.collectPhoneNumber);
|
|
8038
8040
|
|
|
8039
8041
|
var handleAddressChange = function handleAddressChange(args) {
|
|
8040
8042
|
if (!args.complete) {
|
|
@@ -8105,7 +8107,7 @@ function StripePaymentForm(_ref) {
|
|
|
8105
8107
|
options: {
|
|
8106
8108
|
mode: 'billing',
|
|
8107
8109
|
fields: {
|
|
8108
|
-
phone:
|
|
8110
|
+
phone: shouldCollectPhoneNumber ? 'always' : 'auto'
|
|
8109
8111
|
},
|
|
8110
8112
|
defaultValues: _extends({}, (customer == null ? void 0 : customer.name) && {
|
|
8111
8113
|
name: customer.name
|
|
@@ -12859,7 +12861,8 @@ function NewPaymentMethod(_ref3) {
|
|
|
12859
12861
|
onSelect = _ref3.onSelect,
|
|
12860
12862
|
readOnly = _ref3.readOnly,
|
|
12861
12863
|
checkoutLocalization = _ref3.checkoutLocalization,
|
|
12862
|
-
onBillingAddressChange = _ref3.onBillingAddressChange
|
|
12864
|
+
onBillingAddressChange = _ref3.onBillingAddressChange,
|
|
12865
|
+
collectPhoneNumber = _ref3.collectPhoneNumber;
|
|
12863
12866
|
return React__default.createElement(NewPaymentMethodContainer, {
|
|
12864
12867
|
item: true,
|
|
12865
12868
|
onClick: onSelect,
|
|
@@ -12874,14 +12877,16 @@ function NewPaymentMethod(_ref3) {
|
|
|
12874
12877
|
}), React__default.createElement(material.Collapse, {
|
|
12875
12878
|
"in": checked
|
|
12876
12879
|
}, React__default.createElement(StripePaymentForm, {
|
|
12877
|
-
onBillingAddressChange: onBillingAddressChange
|
|
12880
|
+
onBillingAddressChange: onBillingAddressChange,
|
|
12881
|
+
collectPhoneNumber: collectPhoneNumber
|
|
12878
12882
|
})));
|
|
12879
12883
|
}
|
|
12880
12884
|
|
|
12881
12885
|
var _templateObject$8;
|
|
12882
12886
|
var PaymentContainer = /*#__PURE__*/styled$1(material.Grid)(_templateObject$8 || (_templateObject$8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 24px;\n"])));
|
|
12883
12887
|
function PaymentStep(_ref) {
|
|
12884
|
-
var onBillingAddressChange = _ref.onBillingAddressChange
|
|
12888
|
+
var onBillingAddressChange = _ref.onBillingAddressChange,
|
|
12889
|
+
collectPhoneNumber = _ref.collectPhoneNumber;
|
|
12885
12890
|
|
|
12886
12891
|
var _useCheckoutModel = useCheckoutModel(),
|
|
12887
12892
|
checkoutState = _useCheckoutModel.checkoutState,
|
|
@@ -12929,7 +12934,8 @@ function PaymentStep(_ref) {
|
|
|
12929
12934
|
onSelect: function onSelect() {
|
|
12930
12935
|
return handleOnSelect(true);
|
|
12931
12936
|
},
|
|
12932
|
-
onBillingAddressChange: onBillingAddressChange
|
|
12937
|
+
onBillingAddressChange: onBillingAddressChange,
|
|
12938
|
+
collectPhoneNumber: collectPhoneNumber
|
|
12933
12939
|
}));
|
|
12934
12940
|
}
|
|
12935
12941
|
|
|
@@ -13498,7 +13504,8 @@ var DowngradeToFreePlan = function DowngradeToFreePlan(_ref3) {
|
|
|
13498
13504
|
|
|
13499
13505
|
var getStepProps = function getStepProps(currentStep, _ref) {
|
|
13500
13506
|
var onBillingAddressChange = _ref.onBillingAddressChange,
|
|
13501
|
-
onChangePlan = _ref.onChangePlan
|
|
13507
|
+
onChangePlan = _ref.onChangePlan,
|
|
13508
|
+
collectPhoneNumber = _ref.collectPhoneNumber;
|
|
13502
13509
|
|
|
13503
13510
|
switch (currentStep.key) {
|
|
13504
13511
|
case CheckoutStepKey.PLAN:
|
|
@@ -13516,7 +13523,8 @@ var getStepProps = function getStepProps(currentStep, _ref) {
|
|
|
13516
13523
|
case CheckoutStepKey.PAYMENT:
|
|
13517
13524
|
return {
|
|
13518
13525
|
content: React__default.createElement(PaymentStep, {
|
|
13519
|
-
onBillingAddressChange: onBillingAddressChange
|
|
13526
|
+
onBillingAddressChange: onBillingAddressChange,
|
|
13527
|
+
collectPhoneNumber: collectPhoneNumber
|
|
13520
13528
|
})
|
|
13521
13529
|
};
|
|
13522
13530
|
|
|
@@ -13532,6 +13540,7 @@ function CheckoutContainer(_ref2) {
|
|
|
13532
13540
|
onCheckoutCompleted = _ref2.onCheckoutCompleted,
|
|
13533
13541
|
onChangePlan = _ref2.onChangePlan,
|
|
13534
13542
|
onBillingAddressChange = _ref2.onBillingAddressChange,
|
|
13543
|
+
collectPhoneNumber = _ref2.collectPhoneNumber,
|
|
13535
13544
|
disablePromotionCode = _ref2.disablePromotionCode,
|
|
13536
13545
|
disableSuccessAnimation = _ref2.disableSuccessAnimation,
|
|
13537
13546
|
onMockCheckoutPreview = _ref2.onMockCheckoutPreview;
|
|
@@ -13562,15 +13571,16 @@ function CheckoutContainer(_ref2) {
|
|
|
13562
13571
|
|
|
13563
13572
|
var _getStepProps = getStepProps(currentStep, {
|
|
13564
13573
|
onBillingAddressChange: onBillingAddressChange,
|
|
13565
|
-
onChangePlan: onChangePlan
|
|
13574
|
+
onChangePlan: onChangePlan,
|
|
13575
|
+
collectPhoneNumber: collectPhoneNumber
|
|
13566
13576
|
}),
|
|
13567
13577
|
content = _getStepProps.content;
|
|
13568
13578
|
|
|
13569
13579
|
var checkoutContent = React__default.createElement(React__default.Fragment, null, isFreeDowngrade ? React__default.createElement(DowngradeToFreePlan, {
|
|
13570
|
-
checkoutLocalization: checkoutLocalization,
|
|
13571
13580
|
freePlan: plan,
|
|
13572
13581
|
activeSubscription: activeSubscription,
|
|
13573
13582
|
allowChangePlan: true,
|
|
13583
|
+
checkoutLocalization: checkoutLocalization,
|
|
13574
13584
|
onChangePlan: onChangePlan
|
|
13575
13585
|
}) : React__default.createElement(React__default.Fragment, null, content));
|
|
13576
13586
|
var stripeElementsMode = React.useMemo(function () {
|