@stigg/react-sdk 4.4.0-beta.1 → 4.4.0-beta.3
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 -1
- package/dist/components/checkout/hooks/useProgressBarModel.d.ts +1 -0
- package/dist/components/checkout/index.d.ts +1 -0
- package/dist/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.style.d.ts +1 -1
- package/dist/react-sdk.cjs.development.js +19 -16
- 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 +19 -16
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/checkout/Checkout.tsx +1 -2
- package/src/components/checkout/CheckoutContainer.tsx +9 -9
- package/src/components/checkout/CheckoutProvider.tsx +10 -14
- package/src/components/checkout/hooks/usePreviewSubscription.ts +1 -2
- package/src/components/checkout/hooks/useProgressBarModel.ts +3 -0
- package/src/components/checkout/index.ts +1 -0
- package/src/stories/Checkout.stories.tsx +1 -1
package/dist/react-sdk.esm.js
CHANGED
|
@@ -6920,7 +6920,9 @@ function useGoNext() {
|
|
|
6920
6920
|
|
|
6921
6921
|
function useProgressBarModel() {
|
|
6922
6922
|
var progressBarState = useProgressBarState();
|
|
6923
|
+
var currentStep = progressBarState.steps[progressBarState.activeStep];
|
|
6923
6924
|
return {
|
|
6925
|
+
currentStep: currentStep,
|
|
6924
6926
|
progressBarState: progressBarState,
|
|
6925
6927
|
isLastStep: progressBarState.activeStep === progressBarState.steps.length - 1,
|
|
6926
6928
|
isCheckoutComplete: isCheckoutComplete(progressBarState),
|
|
@@ -6959,7 +6961,6 @@ var usePreviewSubscriptionAction = function usePreviewSubscriptionAction() {
|
|
|
6959
6961
|
|
|
6960
6962
|
var _ref = checkoutState || {},
|
|
6961
6963
|
plan = _ref.plan,
|
|
6962
|
-
activeSubscription = _ref.activeSubscription,
|
|
6963
6964
|
customer = _ref.customer;
|
|
6964
6965
|
|
|
6965
6966
|
var previewSubscriptionAction = useCallback( /*#__PURE__*/function () {
|
|
@@ -7031,7 +7032,7 @@ var usePreviewSubscriptionAction = function usePreviewSubscriptionAction() {
|
|
|
7031
7032
|
return function (_x) {
|
|
7032
7033
|
return _ref2.apply(this, arguments);
|
|
7033
7034
|
};
|
|
7034
|
-
}(), [
|
|
7035
|
+
}(), [customer, plan, resourceId, stigg, subscription.addons, subscription.billingPeriod, subscription.billableFeatures, subscription.promotionCode, planStep.billingCountryCode]);
|
|
7035
7036
|
return {
|
|
7036
7037
|
previewSubscriptionAction: previewSubscriptionAction
|
|
7037
7038
|
};
|
|
@@ -7223,6 +7224,9 @@ var CheckoutContextProvider = function CheckoutContextProvider(_ref) {
|
|
|
7223
7224
|
state = _useState[0],
|
|
7224
7225
|
innerSetState = _useState[1];
|
|
7225
7226
|
|
|
7227
|
+
useEffect(function () {
|
|
7228
|
+
innerSetState(initialState);
|
|
7229
|
+
}, [initialState]);
|
|
7226
7230
|
var setState = useCallback(function (updater) {
|
|
7227
7231
|
return innerSetState(function (old) {
|
|
7228
7232
|
return produce(old, function (draft) {
|
|
@@ -7233,7 +7237,7 @@ var CheckoutContextProvider = function CheckoutContextProvider(_ref) {
|
|
|
7233
7237
|
|
|
7234
7238
|
var _useMemo = useMemo(function () {
|
|
7235
7239
|
return [state, setState];
|
|
7236
|
-
}, [state]),
|
|
7240
|
+
}, [setState, state]),
|
|
7237
7241
|
contextValue = _useMemo[0],
|
|
7238
7242
|
setContextValue = _useMemo[1];
|
|
7239
7243
|
|
|
@@ -7246,11 +7250,11 @@ function CheckoutProvider(_ref2) {
|
|
|
7246
7250
|
var children = _ref2.children,
|
|
7247
7251
|
textOverrides = _ref2.textOverrides,
|
|
7248
7252
|
theme = _ref2.theme,
|
|
7253
|
+
preferredBillingPeriod = _ref2.preferredBillingPeriod,
|
|
7254
|
+
billableFeatures = _ref2.billableFeatures,
|
|
7249
7255
|
resourceId = _ref2.resourceId,
|
|
7250
7256
|
planId = _ref2.planId,
|
|
7251
|
-
|
|
7252
|
-
billingCountryCode = _ref2.billingCountryCode,
|
|
7253
|
-
billableFeatures = _ref2.billableFeatures;
|
|
7257
|
+
billingCountryCode = _ref2.billingCountryCode;
|
|
7254
7258
|
|
|
7255
7259
|
var _useLoadCheckout = useLoadCheckout({
|
|
7256
7260
|
resourceId: resourceId,
|
|
@@ -7300,8 +7304,8 @@ function CheckoutProvider(_ref2) {
|
|
|
7300
7304
|
isLoadingCheckoutData: isLoading
|
|
7301
7305
|
}
|
|
7302
7306
|
};
|
|
7303
|
-
return initialState;
|
|
7304
|
-
}, [
|
|
7307
|
+
return initialState; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7308
|
+
}, [preferredBillingPeriod, billingCountryCode, checkout, isLoading]);
|
|
7305
7309
|
return React__default.createElement(SdkThemeProvider, {
|
|
7306
7310
|
key: checkout == null ? void 0 : checkout.plan.id,
|
|
7307
7311
|
componentTheme: configuration
|
|
@@ -12927,20 +12931,20 @@ var CheckoutPlanStep = function CheckoutPlanStep() {
|
|
|
12927
12931
|
}));
|
|
12928
12932
|
};
|
|
12929
12933
|
|
|
12930
|
-
var getStepProps = function getStepProps(
|
|
12931
|
-
switch (
|
|
12932
|
-
case
|
|
12934
|
+
var getStepProps = function getStepProps(currentStep) {
|
|
12935
|
+
switch (currentStep.key) {
|
|
12936
|
+
case CheckoutStepKey.PLAN:
|
|
12933
12937
|
return {
|
|
12934
12938
|
allowChangePlan: true,
|
|
12935
12939
|
content: React__default.createElement(CheckoutPlanStep, null)
|
|
12936
12940
|
};
|
|
12937
12941
|
|
|
12938
|
-
case
|
|
12942
|
+
case CheckoutStepKey.ADDONS:
|
|
12939
12943
|
return {
|
|
12940
12944
|
content: React__default.createElement(CheckoutAddonsStep, null)
|
|
12941
12945
|
};
|
|
12942
12946
|
|
|
12943
|
-
case
|
|
12947
|
+
case CheckoutStepKey.PAYMENT:
|
|
12944
12948
|
return {
|
|
12945
12949
|
content: React__default.createElement(PaymentStep, null)
|
|
12946
12950
|
};
|
|
@@ -12967,15 +12971,14 @@ function CheckoutContainer(_ref) {
|
|
|
12967
12971
|
widgetState = _useCheckoutContext$.widgetState;
|
|
12968
12972
|
|
|
12969
12973
|
var _useProgressBarModel = useProgressBarModel(),
|
|
12970
|
-
|
|
12974
|
+
currentStep = _useProgressBarModel.currentStep;
|
|
12971
12975
|
|
|
12972
|
-
var activeStep = progressBarState.activeStep;
|
|
12973
12976
|
var isLoadingCheckoutData = widgetState.isLoadingCheckoutData; // uncomment for fun!
|
|
12974
12977
|
// if (activeStep > 2) {
|
|
12975
12978
|
// return <SurpriseStep />;
|
|
12976
12979
|
// }
|
|
12977
12980
|
|
|
12978
|
-
var _getStepProps = getStepProps(
|
|
12981
|
+
var _getStepProps = getStepProps(currentStep),
|
|
12979
12982
|
content = _getStepProps.content,
|
|
12980
12983
|
allowChangePlan = _getStepProps.allowChangePlan;
|
|
12981
12984
|
|