@stigg/react-sdk 7.6.0 → 7.7.1-beta.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/index.d.ts +935 -2
- package/dist/react-sdk.cjs.js +716 -3504
- package/dist/react-sdk.esm.js +10953 -76805
- package/package.json +4 -14
- package/src/components/checkout/CheckoutContainer.tsx +4 -3
- package/src/components/checkout/configurations/textOverrides.ts +1 -1
- package/src/components/checkout/hooks/useLoadCheckout.ts +1 -1
- package/src/components/checkout/hooks/usePreviewSubscription.ts +1 -1
- package/src/components/checkout/hooks/useProgressBarModel.ts +1 -6
- package/src/components/checkout/index.ts +2 -6
- package/src/components/checkout/steps/addons/components/AddonInputContainer.tsx +3 -3
- package/src/components/checkout/steps/payment/stripe/useSubmit.ts +2 -2
- package/src/components/checkout/steps/payment/zuora/useZuoraIntegration.ts +2 -1
- package/src/components/checkout/steps/payment/zuora/useZuoraSubmit.ts +2 -2
- package/src/components/checkout/summary/CheckoutSummary.tsx +2 -2
- package/src/components/checkout/types.ts +5 -2
- package/src/components/common/Icon.tsx +6 -4
- package/src/components/common/StatusChip.tsx +2 -2
- package/src/components/common/chart/chartjs.tooltip.plugin.tsx +2 -2
- package/src/components/common/iconColor.ts +2 -1
- package/src/components/common/table/LoadingRows.tsx +1 -1
- package/src/components/credits/creditUsageChart/CreditUsage.chartjs.ts +1 -1
- package/src/components/credits/creditUsageChart/CreditUsageChart.tsx +2 -2
- package/src/components/credits/grants/utils.ts +1 -1
- package/src/components/credits/utils/creditGrantUtils.ts +3 -3
- package/src/components/customerPortal/hooks/useCustomerPortal.ts +1 -1
- package/src/components/customerPortal/subscriptionOverview/SubscriptionsOverview.tsx +1 -1
- package/src/components/customerPortal/subscriptionOverview/tabs/Promotions.tsx +2 -2
- package/src/components/customerPortal/subscriptionOverview/upcomingBilling/UpcomingBilling.tsx +1 -1
- package/src/components/customerPortal/usage/featureUsage/FeatureUsage.helper.ts +7 -7
- package/src/components/paywall/hooks/useLoadPaywallData.ts +1 -1
- package/src/components/utils/dateUtils.ts +3 -3
- package/src/components/utils/getSubscriptionScheduleUpdateTexts.tsx +8 -5
- package/src/index.ts +1 -1
- package/src/services/logger.ts +1 -1
- package/src/stories/Checkout.stories.tsx +21 -12
- package/src/stories/CreditBalance.stories.tsx +18 -8
- package/src/stories/CreditUsageChart.stories.tsx +4 -3
- package/dist/react-sdk.cjs.js.map +0 -1
- package/dist/react-sdk.esm.js.map +0 -1
- package/dist/react-sdk.umd.js +0 -6234
- package/dist/react-sdk.umd.js.map +0 -1
- package/dist/src/assets/lottie/checkout-success.json.d.ts +0 -3
- package/dist/src/components/StiggProvider.d.ts +0 -36
- package/dist/src/components/checkout/Checkout.d.ts +0 -5
- package/dist/src/components/checkout/CheckoutContainer.d.ts +0 -14
- package/dist/src/components/checkout/CheckoutContainer.style.d.ts +0 -15
- package/dist/src/components/checkout/CheckoutProvider.d.ts +0 -43
- package/dist/src/components/checkout/components/Button.d.ts +0 -6
- package/dist/src/components/checkout/components/ChangePlanButton.d.ts +0 -7
- package/dist/src/components/checkout/components/ContentLoadingSkeleton.d.ts +0 -2
- package/dist/src/components/checkout/components/DowngradeToFreeContainer.d.ts +0 -21
- package/dist/src/components/checkout/components/InputField.d.ts +0 -6
- package/dist/src/components/checkout/components/Skeletons.style.d.ts +0 -27
- package/dist/src/components/checkout/components/StyledArrow.d.ts +0 -4
- package/dist/src/components/checkout/components/index.d.ts +0 -3
- package/dist/src/components/checkout/configurations/steps.d.ts +0 -1
- package/dist/src/components/checkout/configurations/textOverrides.d.ts +0 -82
- package/dist/src/components/checkout/configurations/theme.d.ts +0 -14
- package/dist/src/components/checkout/configurations/typography.d.ts +0 -7
- package/dist/src/components/checkout/formatting.d.ts +0 -2
- package/dist/src/components/checkout/hooks/index.d.ts +0 -8
- package/dist/src/components/checkout/hooks/useAddonsStepModel.d.ts +0 -20
- package/dist/src/components/checkout/hooks/useCheckoutModel.d.ts +0 -14
- package/dist/src/components/checkout/hooks/useCouponModel.d.ts +0 -7
- package/dist/src/components/checkout/hooks/useLoadCheckout.d.ts +0 -14
- package/dist/src/components/checkout/hooks/usePaymentStepModel.d.ts +0 -22
- package/dist/src/components/checkout/hooks/usePlanStepModel.d.ts +0 -23
- package/dist/src/components/checkout/hooks/usePreviewSubscription.d.ts +0 -25
- package/dist/src/components/checkout/hooks/useProgressBarModel.d.ts +0 -39
- package/dist/src/components/checkout/hooks/useSubscriptionModel.d.ts +0 -6
- package/dist/src/components/checkout/hooks/useSubscriptionState.d.ts +0 -2
- package/dist/src/components/checkout/index.d.ts +0 -7
- package/dist/src/components/checkout/planHeader/PlanHeader.d.ts +0 -6
- package/dist/src/components/checkout/planHeader/index.d.ts +0 -1
- package/dist/src/components/checkout/progressBar/CheckoutProgressBar.d.ts +0 -1
- package/dist/src/components/checkout/progressBar/CheckoutProgressBar.style.d.ts +0 -17
- package/dist/src/components/checkout/promotionCode/AddPromotionCode.d.ts +0 -2
- package/dist/src/components/checkout/promotionCode/AddPromotionCodeButton.d.ts +0 -7
- package/dist/src/components/checkout/promotionCode/AppliedPromotionCode.d.ts +0 -10
- package/dist/src/components/checkout/promotionCode/PromotionCodeSection.d.ts +0 -8
- package/dist/src/components/checkout/promotionCode/index.d.ts +0 -1
- package/dist/src/components/checkout/steps/addons/CheckoutAddonsStep.d.ts +0 -4
- package/dist/src/components/checkout/steps/addons/CheckoutAddonsStep.style.d.ts +0 -18
- package/dist/src/components/checkout/steps/addons/addon.utils.d.ts +0 -15
- package/dist/src/components/checkout/steps/addons/components/AddonInputContainer.d.ts +0 -15
- package/dist/src/components/checkout/steps/addons/components/AddonTextContainer.d.ts +0 -9
- package/dist/src/components/checkout/steps/addons/index.d.ts +0 -1
- package/dist/src/components/checkout/steps/payment/PaymentMethods.d.ts +0 -19
- package/dist/src/components/checkout/steps/payment/PaymentMethods.style.d.ts +0 -27
- package/dist/src/components/checkout/steps/payment/PaymentStep.d.ts +0 -2
- package/dist/src/components/checkout/steps/payment/index.d.ts +0 -1
- package/dist/src/components/checkout/steps/payment/stripe/StripePaymentForm.d.ts +0 -2
- package/dist/src/components/checkout/steps/payment/stripe/index.d.ts +0 -3
- package/dist/src/components/checkout/steps/payment/stripe/stripe.utils.d.ts +0 -33
- package/dist/src/components/checkout/steps/payment/stripe/useStripeIntegration.d.ts +0 -5
- package/dist/src/components/checkout/steps/payment/stripe/useSubmit.d.ts +0 -15
- package/dist/src/components/checkout/steps/payment/zuora/ZuoraPaymentForm.d.ts +0 -2
- package/dist/src/components/checkout/steps/payment/zuora/index.d.ts +0 -4
- package/dist/src/components/checkout/steps/payment/zuora/useZuoraIntegration.d.ts +0 -5
- package/dist/src/components/checkout/steps/payment/zuora/useZuoraSubmit.d.ts +0 -11
- package/dist/src/components/checkout/steps/payment/zuora/zuora.utils.d.ts +0 -34
- package/dist/src/components/checkout/steps/plan/BillingPeriodPicker.d.ts +0 -8
- package/dist/src/components/checkout/steps/plan/BillingPeriodPicker.style.d.ts +0 -28
- package/dist/src/components/checkout/steps/plan/CheckoutChargeList.d.ts +0 -22
- package/dist/src/components/checkout/steps/plan/CheckoutPlanStep.d.ts +0 -2
- package/dist/src/components/checkout/steps/plan/CheckoutPlanStep.style.d.ts +0 -6
- package/dist/src/components/checkout/steps/plan/index.d.ts +0 -1
- package/dist/src/components/checkout/summary/CheckoutSuccess.d.ts +0 -5
- package/dist/src/components/checkout/summary/CheckoutSummary.d.ts +0 -15
- package/dist/src/components/checkout/summary/CheckoutSummarySkeleton.d.ts +0 -3
- package/dist/src/components/checkout/summary/components/CheckoutCaptions.d.ts +0 -11
- package/dist/src/components/checkout/summary/components/GraduatedPriceBreakdown.d.ts +0 -6
- package/dist/src/components/checkout/summary/components/LineItems.d.ts +0 -37
- package/dist/src/components/checkout/summary/components/WithSkeleton.d.ts +0 -6
- package/dist/src/components/checkout/summary/components/getPriceBreakdownString.d.ts +0 -15
- package/dist/src/components/checkout/summary/index.d.ts +0 -2
- package/dist/src/components/checkout/types.d.ts +0 -83
- package/dist/src/components/common/CollapsableSectionIcon.d.ts +0 -6
- package/dist/src/components/common/Icon.d.ts +0 -13
- package/dist/src/components/common/InformationTooltip.d.ts +0 -11
- package/dist/src/components/common/LongText.d.ts +0 -17
- package/dist/src/components/common/PoweredByStigg.d.ts +0 -12
- package/dist/src/components/common/ProgressBar.d.ts +0 -6
- package/dist/src/components/common/StatusChip.d.ts +0 -16
- package/dist/src/components/common/TiersSelectContainer.d.ts +0 -12
- package/dist/src/components/common/Typography.d.ts +0 -15
- package/dist/src/components/common/VolumeBulkSelect.d.ts +0 -5
- package/dist/src/components/common/VolumePerUnitInput.d.ts +0 -5
- package/dist/src/components/common/chart/chartjs.helpers.d.ts +0 -2
- package/dist/src/components/common/chart/chartjs.plugins.d.ts +0 -1
- package/dist/src/components/common/chart/chartjs.theme.d.ts +0 -23
- package/dist/src/components/common/chart/chartjs.tooltip.plugin.d.ts +0 -38
- package/dist/src/components/common/customIcons.d.ts +0 -24
- package/dist/src/components/common/iconColor.d.ts +0 -3
- package/dist/src/components/common/mapExternalTheme.d.ts +0 -7
- package/dist/src/components/common/mediaQuery.d.ts +0 -12
- package/dist/src/components/common/table/DataRows.d.ts +0 -9
- package/dist/src/components/common/table/EmptyState.d.ts +0 -7
- package/dist/src/components/common/table/ErrorState.d.ts +0 -7
- package/dist/src/components/common/table/GenericTable.d.ts +0 -25
- package/dist/src/components/common/table/LoadingRows.d.ts +0 -8
- package/dist/src/components/common/table/index.d.ts +0 -6
- package/dist/src/components/common/table/types.d.ts +0 -27
- package/dist/src/components/credits/balance/CreditBalance.d.ts +0 -11
- package/dist/src/components/credits/balance/CreditBalanceValue.d.ts +0 -7
- package/dist/src/components/credits/creditUsageChart/CreditUsage.chartjs.d.ts +0 -12
- package/dist/src/components/credits/creditUsageChart/CreditUsageChart.d.ts +0 -8
- package/dist/src/components/credits/creditUsageChart/CreditUsageChartEmptyState.d.ts +0 -2
- package/dist/src/components/credits/creditUsageChart/CreditUsageChartErrorState.d.ts +0 -2
- package/dist/src/components/credits/creditUsageChart/CreditUsageChartHeader.d.ts +0 -12
- package/dist/src/components/credits/creditUsageChart/CreditUsageChartTooltip.d.ts +0 -19
- package/dist/src/components/credits/creditUsageChart/CreditUsageLegend.d.ts +0 -6
- package/dist/src/components/credits/creditUsageChart/types.d.ts +0 -4
- package/dist/src/components/credits/grants/CreditGrants.d.ts +0 -6
- package/dist/src/components/credits/grants/CreditGrantsTable.d.ts +0 -10
- package/dist/src/components/credits/grants/types.d.ts +0 -21
- package/dist/src/components/credits/grants/utils.d.ts +0 -5
- package/dist/src/components/credits/hooks/useCreditBalance.d.ts +0 -32
- package/dist/src/components/credits/hooks/useCreditGrants.d.ts +0 -6
- package/dist/src/components/credits/hooks/useCreditUsage.d.ts +0 -13
- package/dist/src/components/credits/index.d.ts +0 -12
- package/dist/src/components/credits/localization.d.ts +0 -22
- package/dist/src/components/credits/utilization/CreditUtilization.d.ts +0 -12
- package/dist/src/components/credits/utilization/CreditUtilizationValue.d.ts +0 -9
- package/dist/src/components/credits/utils/creditBalanceUtils.d.ts +0 -11
- package/dist/src/components/credits/utils/creditGrantUtils.d.ts +0 -3
- package/dist/src/components/customerPortal/CustomerPortal.d.ts +0 -20
- package/dist/src/components/customerPortal/CustomerPortal.style.d.ts +0 -9
- package/dist/src/components/customerPortal/CustomerPortalContainer.d.ts +0 -6
- package/dist/src/components/customerPortal/CustomerPortalContext.d.ts +0 -16
- package/dist/src/components/customerPortal/CustomerPortalHeader.d.ts +0 -4
- package/dist/src/components/customerPortal/CustomerPortalProvider.d.ts +0 -11
- package/dist/src/components/customerPortal/billing/InformationGrid.d.ts +0 -16
- package/dist/src/components/customerPortal/billing/InvoicesSection.d.ts +0 -2
- package/dist/src/components/customerPortal/billing/PaymentDetailsSection.d.ts +0 -3
- package/dist/src/components/customerPortal/common/ExternalLinkButton.d.ts +0 -7
- package/dist/src/components/customerPortal/common/SectionContainer.d.ts +0 -8
- package/dist/src/components/customerPortal/common/SectionHeader.d.ts +0 -7
- package/dist/src/components/customerPortal/common/SectionTitle.d.ts +0 -7
- package/dist/src/components/customerPortal/common/SkeletonButton.d.ts +0 -2
- package/dist/src/components/customerPortal/common/StyledButton.d.ts +0 -6
- package/dist/src/components/customerPortal/customerPortalTextOverrides.d.ts +0 -17
- package/dist/src/components/customerPortal/customerPortalTheme.d.ts +0 -14
- package/dist/src/components/customerPortal/hooks/useCustomerPortal.d.ts +0 -11
- package/dist/src/components/customerPortal/index.d.ts +0 -16
- package/dist/src/components/customerPortal/paywall/CustomerPortalPaywall.d.ts +0 -10
- package/dist/src/components/customerPortal/paywall/CustomerPortalPaywall.style.d.ts +0 -13
- package/dist/src/components/customerPortal/subscriptionOverview/ContactCustomerSupport.d.ts +0 -8
- package/dist/src/components/customerPortal/subscriptionOverview/SubscriptionOverviewLoader.d.ts +0 -2
- package/dist/src/components/customerPortal/subscriptionOverview/SubscriptionsOverview.d.ts +0 -13
- package/dist/src/components/customerPortal/subscriptionOverview/SubscriptionsOverviewHeader.d.ts +0 -9
- package/dist/src/components/customerPortal/subscriptionOverview/charges/ChargeItem.d.ts +0 -17
- package/dist/src/components/customerPortal/subscriptionOverview/charges/ChargeList.d.ts +0 -12
- package/dist/src/components/customerPortal/subscriptionOverview/subscriptionScheduledUpdates/SubscriptionScheduledUpdateRow.d.ts +0 -8
- package/dist/src/components/customerPortal/subscriptionOverview/subscriptionScheduledUpdates/SubscriptionScheduledUpdatesAlert.d.ts +0 -9
- package/dist/src/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.d.ts +0 -11
- package/dist/src/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.style.d.ts +0 -5
- package/dist/src/components/customerPortal/subscriptionOverview/subscriptionView/TrialPanel.d.ts +0 -7
- package/dist/src/components/customerPortal/subscriptionOverview/tabs/AddonsList.d.ts +0 -2
- package/dist/src/components/customerPortal/subscriptionOverview/tabs/Promotions.d.ts +0 -2
- package/dist/src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.d.ts +0 -11
- package/dist/src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.style.d.ts +0 -24
- package/dist/src/components/customerPortal/subscriptionOverview/types/customerPortal.types.d.ts +0 -3
- package/dist/src/components/customerPortal/subscriptionOverview/upcomingBilling/NextEstimatedBill.d.ts +0 -8
- package/dist/src/components/customerPortal/subscriptionOverview/upcomingBilling/NoUpcomingBilling.d.ts +0 -6
- package/dist/src/components/customerPortal/subscriptionOverview/upcomingBilling/UpcomingBilling.d.ts +0 -10
- package/dist/src/components/customerPortal/types.d.ts +0 -13
- package/dist/src/components/customerPortal/usage/CustomerUsageData.d.ts +0 -8
- package/dist/src/components/customerPortal/usage/CustomerUsageData.style.d.ts +0 -6
- package/dist/src/components/customerPortal/usage/featureUsage/EntitlementCTAButton.d.ts +0 -14
- package/dist/src/components/customerPortal/usage/featureUsage/FeatureUsage.d.ts +0 -13
- package/dist/src/components/customerPortal/usage/featureUsage/FeatureUsage.helper.d.ts +0 -5
- package/dist/src/components/customerPortal/usage/featureUsage/FeatureUsage.style.d.ts +0 -8
- package/dist/src/components/customerPortal/usage/featureUsage/FeatureUsageProgressBar.d.ts +0 -15
- package/dist/src/components/guards/BooleanEntitlementGuard.d.ts +0 -7
- package/dist/src/components/guards/EnumEntitlementGuard.d.ts +0 -7
- package/dist/src/components/guards/MeteredEntitlementGuard.d.ts +0 -7
- package/dist/src/components/guards/NumericEntitlementGuard.d.ts +0 -7
- package/dist/src/components/hooks/index.d.ts +0 -1
- package/dist/src/components/hooks/useChargeSort.d.ts +0 -3
- package/dist/src/components/hooks/useIsScreenWiderThan.d.ts +0 -2
- package/dist/src/components/hooks/useWaitForCheckoutCompleted.d.ts +0 -14
- package/dist/src/components/paywall/BillingPeriodPicker.d.ts +0 -7
- package/dist/src/components/paywall/EntitlementRow.d.ts +0 -20
- package/dist/src/components/paywall/Paywall.d.ts +0 -23
- package/dist/src/components/paywall/PaywallContainer.d.ts +0 -20
- package/dist/src/components/paywall/PaywallLoader.d.ts +0 -2
- package/dist/src/components/paywall/PlanCompatibleAddons.d.ts +0 -13
- package/dist/src/components/paywall/PlanEntitlements.d.ts +0 -8
- package/dist/src/components/paywall/PlanOffering.d.ts +0 -27
- package/dist/src/components/paywall/PlanOfferingButton.d.ts +0 -18
- package/dist/src/components/paywall/PlanPrice.d.ts +0 -17
- package/dist/src/components/paywall/hooks/useLoadPaywallData.d.ts +0 -12
- package/dist/src/components/paywall/index.d.ts +0 -5
- package/dist/src/components/paywall/paywallTextOverrides.d.ts +0 -81
- package/dist/src/components/paywall/types.d.ts +0 -58
- package/dist/src/components/paywall/utils/calculateTrialDaysLeft.d.ts +0 -1
- package/dist/src/components/paywall/utils/calculateUnitQuantityText.d.ts +0 -1
- package/dist/src/components/paywall/utils/computeDefaultBillingPeriod.d.ts +0 -5
- package/dist/src/components/paywall/utils/getPlansToDisplay.d.ts +0 -3
- package/dist/src/components/paywall/utils/hasPricePoints.d.ts +0 -4
- package/dist/src/components/paywall/utils/mapPaywallData.d.ts +0 -14
- package/dist/src/components/utils/calculateDiscountRate.d.ts +0 -3
- package/dist/src/components/utils/currencyUtils.d.ts +0 -9
- package/dist/src/components/utils/dateUtils.d.ts +0 -10
- package/dist/src/components/utils/fixtures/price.fixtures.d.ts +0 -7
- package/dist/src/components/utils/formatNumber.d.ts +0 -1
- package/dist/src/components/utils/getFeatureName.d.ts +0 -3
- package/dist/src/components/utils/getPaidPriceText.d.ts +0 -14
- package/dist/src/components/utils/getPlanPrice.d.ts +0 -9
- package/dist/src/components/utils/getSubscriptionScheduleUpdateTexts.d.ts +0 -22
- package/dist/src/components/utils/numberUtils.d.ts +0 -4
- package/dist/src/components/utils/onWheelBlur.d.ts +0 -2
- package/dist/src/components/utils/planPrices.d.ts +0 -4
- package/dist/src/components/utils/priceTierUtils.d.ts +0 -34
- package/dist/src/components/utils/priceUtils.d.ts +0 -2
- package/dist/src/hooks/index.d.ts +0 -8
- package/dist/src/hooks/useActiveSubscriptions.d.ts +0 -6
- package/dist/src/hooks/useBooleanEntitlement.d.ts +0 -5
- package/dist/src/hooks/useCustomerPortal.d.ts +0 -6
- package/dist/src/hooks/useEnumEntitlement.d.ts +0 -6
- package/dist/src/hooks/useFetch.d.ts +0 -8
- package/dist/src/hooks/useMeteredEntitlement.d.ts +0 -6
- package/dist/src/hooks/useNumericEntitlement.d.ts +0 -6
- package/dist/src/hooks/usePaywall.d.ts +0 -6
- package/dist/src/hooks/useStiggContext.d.ts +0 -7
- package/dist/src/index.d.ts +0 -27
- package/dist/src/services/logger.d.ts +0 -12
- package/dist/src/stories/CustomTheme.d.ts +0 -2
- package/dist/src/stories/baseArgs.d.ts +0 -11
- package/dist/src/stories/mocks/checkout/consts.d.ts +0 -11
- package/dist/src/stories/mocks/checkout/mockCheckoutPreview.d.ts +0 -2
- package/dist/src/stories/mocks/checkout/mockCheckoutState.d.ts +0 -2
- package/dist/src/theme/Fonts.d.ts +0 -3
- package/dist/src/theme/Theme.d.ts +0 -10
- package/dist/src/theme/getResolvedTheme.d.ts +0 -4
- package/dist/src/theme/types.d.ts +0 -83
- package/dist/src/types.d.ts +0 -16
- package/dist/src/utils/styledUtils.d.ts +0 -2
- package/dist/stripe.esm-BkoVJ3BR.js +0 -67
- package/dist/stripe.esm-BkoVJ3BR.js.map +0 -1
- package/dist/stripe.esm-XRG9pJRV.cjs +0 -2
- package/dist/stripe.esm-XRG9pJRV.cjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "7.
|
|
2
|
+
"version": "7.7.1-beta.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/react-sdk.cjs.js",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"prepare": "husky install",
|
|
37
37
|
"docs": "typedoc",
|
|
38
38
|
"link-sdk": "yarn link && cd node_modules/react && yarn link && cd ../../node_modules/react-dom && yarn link && cd ../../",
|
|
39
|
-
"publish-storybook": "yarn build-storybook && npx chromatic --project-token=cbd1660d8132 --exit-once-uploaded"
|
|
39
|
+
"publish-storybook": "yarn build-storybook && npx chromatic --project-token=cbd1660d8132 --exit-once-uploaded",
|
|
40
|
+
"type-check": "tsc --noEmit --skipLibCheck"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
43
|
"react": ">=16"
|
|
@@ -56,16 +57,6 @@
|
|
|
56
57
|
"author": {
|
|
57
58
|
"name": "Stigg"
|
|
58
59
|
},
|
|
59
|
-
"size-limit": [
|
|
60
|
-
{
|
|
61
|
-
"path": "dist/react-sdk.cjs.js",
|
|
62
|
-
"limit": "10 KB"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"path": "dist/react-sdk.esm.js",
|
|
66
|
-
"limit": "10 KB"
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
60
|
"devDependencies": {
|
|
70
61
|
"@commitlint/cli": "^19.7.1",
|
|
71
62
|
"@commitlint/config-conventional": "^19.7.1",
|
|
@@ -135,6 +126,5 @@
|
|
|
135
126
|
"react-spinners": "^0.13.3",
|
|
136
127
|
"react-switch": "^7.0.0"
|
|
137
128
|
},
|
|
138
|
-
"readme": "ERROR: No README data found!"
|
|
139
|
-
"_id": "@stigg/react-sdk@5.23.0"
|
|
129
|
+
"readme": "ERROR: No README data found!"
|
|
140
130
|
}
|
|
@@ -4,7 +4,8 @@ import { PricingType } from '@stigg/js-client-sdk';
|
|
|
4
4
|
import { CheckoutContent, CheckoutLayout, CheckoutPanel } from './CheckoutContainer.style';
|
|
5
5
|
import { CheckoutProgressBar } from './progressBar/CheckoutProgressBar';
|
|
6
6
|
import { CheckoutSummary, CheckoutSummarySkeleton } from './summary';
|
|
7
|
-
import { CheckoutStep,
|
|
7
|
+
import { CheckoutStep, useCheckoutModel, useProgressBarModel } from './hooks';
|
|
8
|
+
import { CheckoutStepKey } from './types';
|
|
8
9
|
import { CheckoutAddonsStep } from './steps/addons';
|
|
9
10
|
import { PaymentStep } from './steps/payment';
|
|
10
11
|
import { useStripeIntegration } from './steps/payment/stripe';
|
|
@@ -126,8 +127,8 @@ export function CheckoutContainer({
|
|
|
126
127
|
<>
|
|
127
128
|
{isFreeDowngrade ? (
|
|
128
129
|
<DowngradeToFreePlan
|
|
129
|
-
freePlan={plan
|
|
130
|
-
activeSubscription={activeSubscription
|
|
130
|
+
freePlan={plan}
|
|
131
|
+
activeSubscription={activeSubscription}
|
|
131
132
|
allowChangePlan
|
|
132
133
|
checkoutLocalization={checkoutLocalization}
|
|
133
134
|
onChangePlan={onChangePlan}
|
|
@@ -21,7 +21,7 @@ export type CheckoutLocalization = {
|
|
|
21
21
|
newPaymentMethodBillingAddressTitle: string;
|
|
22
22
|
summary: {
|
|
23
23
|
title: string;
|
|
24
|
-
planName: (params: { plan:
|
|
24
|
+
planName: (params: { plan: { displayName: string } }) => string;
|
|
25
25
|
addCouponCodeText: string;
|
|
26
26
|
couponCodeTitle: string;
|
|
27
27
|
addonsSectionTitle: string;
|
|
@@ -22,7 +22,7 @@ export function useLoadCheckout({ planId, resourceId, billingCountryCode, onMock
|
|
|
22
22
|
const checkout = await stigg.getCheckoutState({ planId, resourceId, billingCountryCode });
|
|
23
23
|
setCheckout(checkout);
|
|
24
24
|
} catch (err) {
|
|
25
|
-
logger.error(`Failed to load checkout ${(err as any)?.message}`, err as
|
|
25
|
+
logger.error(`Failed to load checkout ${(err as any)?.message}`, err as Error);
|
|
26
26
|
} finally {
|
|
27
27
|
setIsLoading(false);
|
|
28
28
|
}
|
|
@@ -75,7 +75,7 @@ const previewSubscription = async ({
|
|
|
75
75
|
: await stigg.previewSubscription(previewSubscriptionProps);
|
|
76
76
|
}
|
|
77
77
|
} catch (error) {
|
|
78
|
-
const [, errorMsg] = (error as
|
|
78
|
+
const [, errorMsg] = (error as Error)?.message?.split('Error:') || [];
|
|
79
79
|
|
|
80
80
|
errorMessage = errorMsg?.trim();
|
|
81
81
|
}
|
|
@@ -3,12 +3,7 @@ import { Addon, BillableFeature, BillingPeriod, CheckoutStatePlan } from '@stigg
|
|
|
3
3
|
import { useCheckoutContext } from '../CheckoutProvider';
|
|
4
4
|
import { CheckoutSteps } from '../configurations/steps';
|
|
5
5
|
import { hasMultipleBillingPeriods } from '../../utils/planPrices';
|
|
6
|
-
|
|
7
|
-
export enum CheckoutStepKey {
|
|
8
|
-
PLAN = 'PLAN',
|
|
9
|
-
ADDONS = 'ADDONS',
|
|
10
|
-
PAYMENT = 'PAYMENT',
|
|
11
|
-
}
|
|
6
|
+
import { CheckoutStepKey } from '../types';
|
|
12
7
|
|
|
13
8
|
export type CheckoutStep = {
|
|
14
9
|
key: CheckoutStepKey;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
export { Checkout } from './Checkout';
|
|
2
2
|
export * from './types';
|
|
3
3
|
export type { CheckoutTheme } from './configurations/theme';
|
|
4
|
-
export type {
|
|
5
|
-
OnCheckoutCompletedParams,
|
|
6
|
-
OnCheckoutParams,
|
|
7
|
-
CheckoutResult,
|
|
8
|
-
CheckoutContainerProps,
|
|
9
|
-
} from './CheckoutContainer';
|
|
4
|
+
export type { CheckoutContainerProps } from './CheckoutContainer';
|
|
10
5
|
export type { CheckoutProviderProps } from './CheckoutProvider';
|
|
11
6
|
export type { CheckoutLocalization } from './configurations/textOverrides';
|
|
12
7
|
export type { CheckoutProps } from './Checkout';
|
|
8
|
+
export type { CheckoutSteps } from './configurations/steps';
|
|
@@ -23,9 +23,9 @@ type AddonInputContainerProps = {
|
|
|
23
23
|
errorMessage?: string;
|
|
24
24
|
isPriceForBillingPeriodAvailable: boolean;
|
|
25
25
|
checkoutLocalization: CheckoutLocalization;
|
|
26
|
-
handleQuantityChange: (quantity?: number | null) => void
|
|
27
|
-
handleUndo: () => void
|
|
28
|
-
handleRemoveAddon: () => void
|
|
26
|
+
handleQuantityChange: (quantity?: number | null) => Promise<void>;
|
|
27
|
+
handleUndo: () => Promise<void>;
|
|
28
|
+
handleRemoveAddon: () => Promise<void>;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export function AddonInputContainer({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApplySubscription, ApplySubscriptionResults } from '@stigg/js-client-sdk';
|
|
2
2
|
import { useElements, useStripe } from '@stripe/react-stripe-js';
|
|
3
|
-
import { useStiggContext } from '
|
|
3
|
+
import { useStiggContext } from '../../../../../hooks';
|
|
4
4
|
import { useCheckoutModel } from '../../../hooks';
|
|
5
5
|
import { usePaymentStepModel } from '../../../hooks/usePaymentStepModel';
|
|
6
6
|
import { useSubscriptionState } from '../../../hooks/useSubscriptionState';
|
|
@@ -74,7 +74,7 @@ export function useSubmit({
|
|
|
74
74
|
};
|
|
75
75
|
} catch (e) {
|
|
76
76
|
console.error(e);
|
|
77
|
-
errorMessage = (e as
|
|
77
|
+
errorMessage = (e as Error)?.message;
|
|
78
78
|
return { success: false, errorMessage };
|
|
79
79
|
}
|
|
80
80
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { useCheckoutModel, usePaymentStepModel, usePlanStepModel } from '../../../hooks';
|
|
3
3
|
import { isZuoraLibraryAvailable, loadZuoraLibrary } from './zuora.utils';
|
|
4
|
-
import { BillingVendorIdentifier
|
|
4
|
+
import { BillingVendorIdentifier } from '@stigg/js-client-sdk';
|
|
5
|
+
import { useStiggContext } from '../../../../../hooks';
|
|
5
6
|
|
|
6
7
|
export function useZuoraIntegration() {
|
|
7
8
|
const { stigg } = useStiggContext();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import { ApplySubscription } from '@stigg/js-client-sdk';
|
|
3
|
-
import { useStiggContext } from '
|
|
3
|
+
import { useStiggContext } from '../../../../../hooks';
|
|
4
4
|
import { useSubscriptionState } from '../../../hooks/useSubscriptionState';
|
|
5
5
|
import { useCheckoutModel, usePaymentStepModel } from '../../../hooks';
|
|
6
6
|
import { CheckoutContainerProps } from '../../../CheckoutContainer';
|
|
@@ -56,7 +56,7 @@ export function useZuoraSubmit({
|
|
|
56
56
|
console.error(e);
|
|
57
57
|
return {
|
|
58
58
|
success: false,
|
|
59
|
-
errorMessage: (e as
|
|
59
|
+
errorMessage: (e as Error)?.message || 'Failed to apply subscription',
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
};
|
|
@@ -222,7 +222,7 @@ export const CheckoutSummary = ({
|
|
|
222
222
|
alignItems="center"
|
|
223
223
|
marginY={2}>
|
|
224
224
|
<Typography variant="h6" color="primary" style={{ paddingRight: '8px' }}>
|
|
225
|
-
{checkoutLocalization.summary.planName({ plan })}
|
|
225
|
+
{checkoutLocalization.summary.planName({ plan: plan! })}
|
|
226
226
|
</Typography>
|
|
227
227
|
<StyledDivider className="stigg-checkout-summary-divider" sx={{ flex: 1, margin: '0 !important' }} />
|
|
228
228
|
</Grid>
|
|
@@ -307,7 +307,7 @@ export const CheckoutSummary = ({
|
|
|
307
307
|
/>
|
|
308
308
|
)}
|
|
309
309
|
|
|
310
|
-
{showDiscountLine && (
|
|
310
|
+
{showDiscountLine && subscriptionPreview && (
|
|
311
311
|
<DiscountLineItem
|
|
312
312
|
subscriptionPreview={subscriptionPreview}
|
|
313
313
|
isFetchingSubscriptionPreview={isFetchingSubscriptionPreview}
|
|
@@ -14,9 +14,12 @@ import {
|
|
|
14
14
|
import { AddonsStepState } from './hooks';
|
|
15
15
|
import { PaymentStepState } from './hooks/usePaymentStepModel';
|
|
16
16
|
import { PlanStepState } from './hooks/usePlanStepModel';
|
|
17
|
-
import { CheckoutStepKey } from './hooks/useProgressBarModel';
|
|
18
17
|
|
|
19
|
-
export
|
|
18
|
+
export enum CheckoutStepKey {
|
|
19
|
+
PLAN = 'PLAN',
|
|
20
|
+
ADDONS = 'ADDONS',
|
|
21
|
+
PAYMENT = 'PAYMENT',
|
|
22
|
+
}
|
|
20
23
|
|
|
21
24
|
export type CheckoutState = {
|
|
22
25
|
planStep: PlanStepState;
|
|
@@ -33,17 +33,19 @@ const IconWrapper = styled.div<{ $pathColor?: string; $rectColor?: string; $stro
|
|
|
33
33
|
`}
|
|
34
34
|
`;
|
|
35
35
|
|
|
36
|
+
export type IconColorValue = IconColor | (string & {});
|
|
37
|
+
|
|
36
38
|
export type IconProps = {
|
|
37
39
|
icon: Icons;
|
|
38
40
|
className?: string;
|
|
39
41
|
style?: CSSProperties;
|
|
40
|
-
svgPathColor?:
|
|
41
|
-
svgRectColor?:
|
|
42
|
-
svgStrokeColor?:
|
|
42
|
+
svgPathColor?: IconColorValue;
|
|
43
|
+
svgRectColor?: IconColorValue;
|
|
44
|
+
svgStrokeColor?: IconColorValue;
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
export function Icon({ icon, className, style, svgPathColor, svgRectColor, svgStrokeColor }: IconProps) {
|
|
46
|
-
const IconComponent = (customIcons as
|
|
48
|
+
const IconComponent = (customIcons as Record<Icons, React.FC>)[icon];
|
|
47
49
|
const theme = useTheme();
|
|
48
50
|
|
|
49
51
|
return (
|
|
@@ -12,8 +12,8 @@ const StyledChip = styled(Chip)<{ $variant: StatusChipVariant }>`
|
|
|
12
12
|
height: 24px;
|
|
13
13
|
border-radius: 4px;
|
|
14
14
|
border: none;
|
|
15
|
-
background-color: ${({ theme, $variant }) =>
|
|
16
|
-
color: ${({ theme, $variant }) =>
|
|
15
|
+
background-color: ${({ theme, $variant }) => theme?.stigg?.palette?.statusChips?.[$variant]?.background};
|
|
16
|
+
color: ${({ theme, $variant }) => theme?.stigg?.palette?.statusChips?.[$variant]?.text};
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -57,8 +57,8 @@ export function bottomBarTooltipPositioner(chart: Chart, tooltip: TooltipModel<'
|
|
|
57
57
|
const segmentCenterY = tooltip.caretY + segmentHeight / 2;
|
|
58
58
|
|
|
59
59
|
// Get the bar element to find its left edge
|
|
60
|
-
const bar = chart.getDatasetMeta(dataPoint.datasetIndex).data[dataPoint.dataIndex]
|
|
61
|
-
const barLeftEdge = bar.x - bar.width / 2;
|
|
60
|
+
const bar = chart.getDatasetMeta(dataPoint.datasetIndex).data[dataPoint.dataIndex];
|
|
61
|
+
const barLeftEdge = bar.x - (bar as any).width / 2;
|
|
62
62
|
|
|
63
63
|
const top = chart.canvas.offsetTop + segmentCenterY;
|
|
64
64
|
const left = chart.canvas.offsetLeft + barLeftEdge;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Theme } from '@emotion/react';
|
|
2
|
+
import { IconColorValue } from './Icon';
|
|
2
3
|
|
|
3
4
|
export type IconColor = 'primary' | 'secondary';
|
|
4
5
|
|
|
5
|
-
export const getIconColor = (color:
|
|
6
|
+
export const getIconColor = (color: IconColorValue | undefined, theme: Theme) => {
|
|
6
7
|
switch (color) {
|
|
7
8
|
case 'primary':
|
|
8
9
|
return theme.stigg.palette.text.primary;
|
|
@@ -12,7 +12,7 @@ interface LoadingRowsProps<T> {
|
|
|
12
12
|
export function LoadingRows<T>({ skeletonRows, visibleHeadCells, hideLastRowBorder }: LoadingRowsProps<T>) {
|
|
13
13
|
return (
|
|
14
14
|
<>
|
|
15
|
-
{
|
|
15
|
+
{Array.from({ length: skeletonRows }).map((_, index) => (
|
|
16
16
|
<TableRow key={index}>
|
|
17
17
|
{visibleHeadCells.map((headCell) => (
|
|
18
18
|
<StyledTableCell
|
|
@@ -191,7 +191,7 @@ export function computeChartData(
|
|
|
191
191
|
|
|
192
192
|
const dataMap = new Map<string, number>();
|
|
193
193
|
series.points.forEach((point) => {
|
|
194
|
-
const dateKey = generateDateKeyForTimeRange(new Date(point.timestamp), timeRange);
|
|
194
|
+
const dateKey = generateDateKeyForTimeRange(new Date(point.timestamp as string), timeRange);
|
|
195
195
|
// Accumulate values for the same date instead of overwriting
|
|
196
196
|
const existingValue = dataMap.get(dateKey) || 0;
|
|
197
197
|
dataMap.set(dateKey, existingValue + point.value);
|
|
@@ -33,8 +33,8 @@ const CreditUsageChartCard = styled.div`
|
|
|
33
33
|
gap: 8px;
|
|
34
34
|
padding: 16px;
|
|
35
35
|
border-radius: 8px;
|
|
36
|
-
border: 1px solid ${({ theme }) =>
|
|
37
|
-
background-color: ${({ theme }) =>
|
|
36
|
+
border: 1px solid ${({ theme }) => theme?.stigg?.palette?.outlinedBorder || '#e0e0e0'};
|
|
37
|
+
background-color: ${({ theme }) => theme?.stigg?.palette?.backgroundPaper || '#ffffff'};
|
|
38
38
|
`;
|
|
39
39
|
|
|
40
40
|
const ChartSkeleton = styled(Skeleton)`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StatusChipVariant } from '@/theme/types';
|
|
2
2
|
import { CreditGrantStatus } from './types';
|
|
3
|
-
import { CreditGrantType } from '
|
|
3
|
+
import { CreditGrantType } from '@stigg/js-client-sdk';
|
|
4
4
|
|
|
5
5
|
export const mapCreditGrantStatusToVariant = (status: CreditGrantStatus): StatusChipVariant => {
|
|
6
6
|
switch (status) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
1
|
+
import moment, { MomentInput } from 'moment';
|
|
2
2
|
import { CreditGrant, CreditGrantStatus } from '../grants/types';
|
|
3
3
|
import { formatValue } from './creditBalanceUtils';
|
|
4
4
|
|
|
@@ -7,8 +7,8 @@ The credit grant status is currently derived, but later will be provided by the
|
|
|
7
7
|
*/
|
|
8
8
|
export function getCreditGrantStatus(grant: CreditGrant): CreditGrantStatus {
|
|
9
9
|
const now = moment();
|
|
10
|
-
const effectiveAt = moment(grant.effectiveAt);
|
|
11
|
-
const expireAt = grant.expireAt ? moment(grant.expireAt) : null;
|
|
10
|
+
const effectiveAt = moment(grant.effectiveAt as MomentInput);
|
|
11
|
+
const expireAt = grant.expireAt ? moment(grant.expireAt as MomentInput) : null;
|
|
12
12
|
|
|
13
13
|
if (effectiveAt.isAfter(now)) {
|
|
14
14
|
return CreditGrantStatus.SCHEDULED;
|
|
@@ -21,7 +21,7 @@ export function useCustomerPortal({ resourceId, productId }: UseCustomerPortalPr
|
|
|
21
21
|
const customerPortalData = await stigg.getCustomerPortal({ resourceId, productId });
|
|
22
22
|
setCustomerPortal(customerPortalData);
|
|
23
23
|
} catch (err) {
|
|
24
|
-
logger.error(`Failed to load customer portal ${(err as any)?.message}`, err as
|
|
24
|
+
logger.error(`Failed to load customer portal ${(err as any)?.message}`, err as Error);
|
|
25
25
|
} finally {
|
|
26
26
|
setIsLoading(false);
|
|
27
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomerPortalPromotionalEntitlement } from '@stigg/js-client-sdk';
|
|
2
|
-
import moment from 'moment';
|
|
2
|
+
import moment, { MomentInput } from 'moment';
|
|
3
3
|
import styled from '@utils/style';
|
|
4
4
|
import { Typography } from '../../../common/Typography';
|
|
5
5
|
import { useCustomerPortalContext } from '../../CustomerPortalContext';
|
|
@@ -51,7 +51,7 @@ export function Promotions() {
|
|
|
51
51
|
<Typography variant="body1">{getPromotionTitle(promotionalEntitlement)}</Typography>
|
|
52
52
|
<Typography variant="body1" color="disabled">
|
|
53
53
|
{promotionalEntitlement.endDate
|
|
54
|
-
? moment.utc(promotionalEntitlement.endDate).format('MMM Do, YYYY')
|
|
54
|
+
? moment.utc(promotionalEntitlement.endDate as MomentInput).format('MMM Do, YYYY')
|
|
55
55
|
: 'None'}
|
|
56
56
|
</Typography>
|
|
57
57
|
</Row>
|
package/src/components/customerPortal/subscriptionOverview/upcomingBilling/UpcomingBilling.tsx
CHANGED
|
@@ -57,7 +57,7 @@ export function UpcomingBilling({ subscription, theme, textOverrides, onContactS
|
|
|
57
57
|
);
|
|
58
58
|
} else {
|
|
59
59
|
const billingPeriod = subscription.prices?.[0]?.billingPeriod;
|
|
60
|
-
const rangeEnd = subscription.billingPeriodRange?.end;
|
|
60
|
+
const rangeEnd = subscription.billingPeriodRange?.end as string;
|
|
61
61
|
const total = subscription.totalPrice?.total;
|
|
62
62
|
|
|
63
63
|
if (billingPeriod && rangeEnd && total) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CustomerPortalEntitlement } from '@stigg/js-client-sdk';
|
|
2
|
-
import moment from 'moment';
|
|
1
|
+
import { CustomerPortalEntitlement, EntitlementResetPeriod } from '@stigg/js-client-sdk';
|
|
2
|
+
import moment, { MomentInput } from 'moment';
|
|
3
3
|
|
|
4
4
|
export const USAGE_PERCENTAGE_WARNING_THRESHOLD = 70;
|
|
5
5
|
|
|
@@ -27,17 +27,17 @@ export function getResetUsageText(entitlement: CustomerPortalEntitlement) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const calculateResetDiff = (unit: 'days' | 'hours' | 'minutes') => {
|
|
30
|
-
return moment.utc(entitlement.usagePeriodEnd).diff(moment.utc(), unit);
|
|
30
|
+
return moment.utc(entitlement.usagePeriodEnd as MomentInput).diff(moment.utc(), unit);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
switch (entitlement.resetPeriod) {
|
|
34
|
-
case
|
|
34
|
+
case EntitlementResetPeriod.Month:
|
|
35
35
|
return `Resets monthly - in ${calculateResetDiff('days')} days`;
|
|
36
|
-
case
|
|
36
|
+
case EntitlementResetPeriod.Week:
|
|
37
37
|
return `Resets weekly - in ${calculateResetDiff('days')} days`;
|
|
38
|
-
case
|
|
38
|
+
case EntitlementResetPeriod.Day:
|
|
39
39
|
return `Resets daily - in ${calculateResetDiff('hours')} hours`;
|
|
40
|
-
case
|
|
40
|
+
case EntitlementResetPeriod.Hour:
|
|
41
41
|
return `Resets hourly - in ${calculateResetDiff('minutes')} minutes`;
|
|
42
42
|
default:
|
|
43
43
|
return null;
|
|
@@ -50,7 +50,7 @@ export function useLoadPaywallData({
|
|
|
50
50
|
setAvailableBillingPeriods(availableBillingPeriods);
|
|
51
51
|
setSelectedBillingPeriod(defaultBillingPeriod);
|
|
52
52
|
} catch (err) {
|
|
53
|
-
logger.error(`Failed to load paywall ${(err as any)?.message}`, err as
|
|
53
|
+
logger.error(`Failed to load paywall ${(err as any)?.message}`, err as Error);
|
|
54
54
|
} finally {
|
|
55
55
|
setIsLoading(false);
|
|
56
56
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
1
|
+
import moment, { MomentInput } from 'moment';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Formats a date with time in the format "MMM D, YYYY h:mmA"
|
|
5
5
|
* Example: "Aug 2, 2025 3:45PM"
|
|
6
6
|
*/
|
|
7
7
|
export function formatDateTime(date: any): string {
|
|
8
|
-
return moment(date).format('MMM D, YYYY h:mmA');
|
|
8
|
+
return moment(date as MomentInput).format('MMM D, YYYY h:mmA');
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -13,5 +13,5 @@ export function formatDateTime(date: any): string {
|
|
|
13
13
|
* Example: "Aug 2, 2025"
|
|
14
14
|
*/
|
|
15
15
|
export function formatDateOnly(date: any): string {
|
|
16
|
-
return moment(date).format('MMM D, YYYY');
|
|
16
|
+
return moment(date as MomentInput).format('MMM D, YYYY');
|
|
17
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import moment from 'moment';
|
|
1
|
+
import moment, { MomentInput } from 'moment';
|
|
2
2
|
import { isNil, compact } from 'lodash';
|
|
3
3
|
import {
|
|
4
4
|
CustomerPortalSubscription,
|
|
@@ -33,13 +33,16 @@ export function getSubscriptionScheduleUpdateTexts({
|
|
|
33
33
|
case SubscriptionScheduleType.Downgrade: {
|
|
34
34
|
let shouldShowDate = withDate;
|
|
35
35
|
if (isNil(shouldShowDate) && billingPeriodRange?.end) {
|
|
36
|
-
shouldShowDate = !moment(scheduledUpdate.scheduledExecutionTime).isSame(
|
|
36
|
+
shouldShowDate = !moment(scheduledUpdate.scheduledExecutionTime as MomentInput).isSame(
|
|
37
|
+
billingPeriodRange?.end as MomentInput,
|
|
38
|
+
'day',
|
|
39
|
+
);
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
const line1 = (
|
|
40
43
|
<>
|
|
41
44
|
Your subscription will be downgraded to the <b>{scheduledUpdate.targetPackage?.displayName} plan</b>{' '}
|
|
42
|
-
{shouldShowDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime)}</> : postfix}.
|
|
45
|
+
{shouldShowDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime as string)}</> : postfix}.
|
|
43
46
|
</>
|
|
44
47
|
);
|
|
45
48
|
const line2 = `Until then you still have access to your current plan.`;
|
|
@@ -52,7 +55,7 @@ export function getSubscriptionScheduleUpdateTexts({
|
|
|
52
55
|
const line1 = (
|
|
53
56
|
<>
|
|
54
57
|
Your billing cycle will change to <b>{variables.billingPeriod?.toLocaleLowerCase()}</b>{' '}
|
|
55
|
-
{withDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime)}</> : postfix}.
|
|
58
|
+
{withDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime as string)}</> : postfix}.
|
|
56
59
|
</>
|
|
57
60
|
);
|
|
58
61
|
|
|
@@ -69,7 +72,7 @@ export function getSubscriptionScheduleUpdateTexts({
|
|
|
69
72
|
const line1 = (
|
|
70
73
|
<>
|
|
71
74
|
Your subscription will be updated to <b>{variables.newUnitAmount}</b> {unitsText}{' '}
|
|
72
|
-
{withDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime)}</> : postfix}.
|
|
75
|
+
{withDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime as string)}</> : postfix}.
|
|
73
76
|
</>
|
|
74
77
|
);
|
|
75
78
|
|
package/src/index.ts
CHANGED
|
@@ -53,13 +53,13 @@ export type {
|
|
|
53
53
|
MockCheckoutPreviewCallback,
|
|
54
54
|
MockCheckoutStateCallback,
|
|
55
55
|
BillingInformation,
|
|
56
|
+
CheckoutStepKey,
|
|
56
57
|
TaxDetailsInput,
|
|
57
58
|
OnBeforeStepChangeCallback,
|
|
58
59
|
OnBillableFeatureChangeCallback,
|
|
59
60
|
OnAddonChangeCallback,
|
|
60
61
|
CheckoutState,
|
|
61
62
|
} from './components/checkout';
|
|
62
|
-
export { CheckoutStepKey } from './components/checkout';
|
|
63
63
|
export { useWaitForCheckoutCompleted, ProvisionStatus } from './components/hooks';
|
|
64
64
|
export {
|
|
65
65
|
useBooleanEntitlement,
|
package/src/services/logger.ts
CHANGED
|
@@ -13,7 +13,7 @@ export class LoggerService implements Logger {
|
|
|
13
13
|
console.log(message, object || {});
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
debug(message: string, object?: Record<string, string>
|
|
16
|
+
debug(message: string, object?: Record<string, string>): void {
|
|
17
17
|
console.debug(message, object || {});
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import styled from '@utils/style';
|
|
2
2
|
import { BillingPeriod } from '@stigg/js-client-sdk';
|
|
3
3
|
import { Meta, StoryFn } from '@storybook/react';
|
|
4
|
-
import { Checkout, CheckoutProviderProps } from '../components/checkout';
|
|
4
|
+
import { Checkout, CheckoutProviderProps, CheckoutSteps } from '../components/checkout';
|
|
5
5
|
import { StiggProvider, StiggProviderProps } from '../components/StiggProvider';
|
|
6
|
+
import { CustomizedTheme } from '../theme/Theme';
|
|
6
7
|
import { defaultArgsWithCustomer } from './baseArgs';
|
|
7
8
|
import { mockCheckoutState } from './mocks/checkout/mockCheckoutState';
|
|
8
9
|
import { mockPreviewSubscription } from './mocks/checkout/mockCheckoutPreview';
|
|
@@ -19,12 +20,12 @@ const meta = {
|
|
|
19
20
|
decorators: [
|
|
20
21
|
(Story, { args }) => (
|
|
21
22
|
<StiggProvider
|
|
22
|
-
apiKey={args.apiKey}
|
|
23
|
-
customerId={args.customerId}
|
|
24
|
-
theme={args.theme}
|
|
25
|
-
locale={args.locale}
|
|
26
|
-
baseUri={args.baseUri}
|
|
27
|
-
enableEdge={args.enableEdge}>
|
|
23
|
+
apiKey={args.apiKey as string}
|
|
24
|
+
customerId={args.customerId as string}
|
|
25
|
+
theme={args.theme as CustomizedTheme | undefined}
|
|
26
|
+
locale={args.locale as string | undefined}
|
|
27
|
+
baseUri={args.baseUri as string | undefined}
|
|
28
|
+
enableEdge={args.enableEdge as boolean | undefined}>
|
|
28
29
|
<Story />
|
|
29
30
|
</StiggProvider>
|
|
30
31
|
),
|
|
@@ -53,15 +54,23 @@ const meta = {
|
|
|
53
54
|
],
|
|
54
55
|
},
|
|
55
56
|
},
|
|
56
|
-
} as Meta<
|
|
57
|
+
} as Meta<any>;
|
|
57
58
|
|
|
58
59
|
export default meta;
|
|
59
60
|
|
|
60
|
-
const Template: StoryFn<
|
|
61
|
+
const Template: StoryFn<
|
|
62
|
+
StiggProviderProps &
|
|
63
|
+
CheckoutProviderProps & {
|
|
64
|
+
useMockData?: boolean;
|
|
65
|
+
skipSteps?: string[];
|
|
66
|
+
billingPeriod?: BillingPeriod | null;
|
|
67
|
+
disablePromotionCode?: boolean;
|
|
68
|
+
}
|
|
69
|
+
> = (args) => (
|
|
61
70
|
<Wrapper>
|
|
62
71
|
<Checkout
|
|
63
72
|
planId={args.planId}
|
|
64
|
-
preferredBillingPeriod={args.billingPeriod}
|
|
73
|
+
preferredBillingPeriod={args.billingPeriod ?? undefined}
|
|
65
74
|
billingCountryCode={args.billingCountryCode}
|
|
66
75
|
resourceId={args.resourceId}
|
|
67
76
|
onCheckoutCompleted={(results) => {
|
|
@@ -78,11 +87,11 @@ const Template: StoryFn<any> = (args) => (
|
|
|
78
87
|
const { success, errorMessage, results } = await checkoutAction(checkoutParams);
|
|
79
88
|
return { success, errorMessage, results };
|
|
80
89
|
}}
|
|
81
|
-
billableFeatures={args.billableFeatures || []}
|
|
90
|
+
billableFeatures={(args.billableFeatures as any[]) || []}
|
|
82
91
|
onChangePlan={({ currentPlan }) => {
|
|
83
92
|
console.log('plan changed clicked!', { currentPlan });
|
|
84
93
|
}}
|
|
85
|
-
skipCheckoutSteps={args.skipSteps}
|
|
94
|
+
skipCheckoutSteps={(args.skipSteps ?? []) as CheckoutSteps[]}
|
|
86
95
|
onMockCheckoutState={
|
|
87
96
|
args.useMockData
|
|
88
97
|
? (params) => {
|