@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.
Files changed (27) hide show
  1. package/dist/components/checkout/CheckoutProvider.d.ts +1 -0
  2. package/dist/components/checkout/hooks/useCheckoutModel.d.ts +2 -0
  3. package/dist/components/checkout/steps/payment/PaymentMethods.d.ts +2 -2
  4. package/dist/components/checkout/steps/payment/PaymentStep.d.ts +1 -1
  5. package/dist/components/checkout/steps/payment/zuora/ZuoraPaymentForm.d.ts +3 -0
  6. package/dist/components/checkout/steps/payment/zuora/index.d.ts +3 -0
  7. package/dist/components/checkout/steps/payment/zuora/useZuoraIntegration.d.ts +5 -0
  8. package/dist/components/checkout/steps/payment/zuora/useZuoraSubmit.d.ts +11 -0
  9. package/dist/components/checkout/steps/payment/zuora/zuora.utils.d.ts +34 -0
  10. package/dist/react-sdk.cjs.development.js +583 -48
  11. package/dist/react-sdk.cjs.development.js.map +1 -1
  12. package/dist/react-sdk.cjs.production.min.js +1 -1
  13. package/dist/react-sdk.cjs.production.min.js.map +1 -1
  14. package/dist/react-sdk.esm.js +583 -48
  15. package/dist/react-sdk.esm.js.map +1 -1
  16. package/package.json +2 -2
  17. package/src/components/checkout/CheckoutContainer.tsx +19 -3
  18. package/src/components/checkout/CheckoutProvider.tsx +2 -0
  19. package/src/components/checkout/hooks/useCheckoutModel.ts +14 -3
  20. package/src/components/checkout/steps/payment/PaymentMethods.tsx +15 -2
  21. package/src/components/checkout/steps/payment/PaymentStep.tsx +8 -1
  22. package/src/components/checkout/steps/payment/zuora/ZuoraPaymentForm.tsx +128 -0
  23. package/src/components/checkout/steps/payment/zuora/index.ts +11 -0
  24. package/src/components/checkout/steps/payment/zuora/useZuoraIntegration.ts +56 -0
  25. package/src/components/checkout/steps/payment/zuora/useZuoraSubmit.ts +125 -0
  26. package/src/components/checkout/steps/payment/zuora/zuora.utils.ts +72 -0
  27. package/src/components/checkout/summary/CheckoutSummary.tsx +71 -44
@@ -1 +1 @@
1
- {"version":3,"file":"react-sdk.cjs.production.min.js","sources":["../src/components/paywall/utils/calculateUnitQuantityText.ts","../src/components/utils/formatNumber.ts","../src/components/common/Typography.tsx","../src/assets/addons.svg","../src/assets/billing-info-customer.svg","../src/assets/contact-support.svg","../src/assets/credit-card.svg","../src/assets/dollar-coin.svg","../src/assets/mini-schedule.svg","../src/components/common/iconColor.ts","../src/assets/promotions.svg","../src/assets/restore.svg","../src/assets/schedule-box.svg","../src/assets/schedule.svg","../src/assets/subscription-renews-icon.svg","../src/assets/trash.svg","../src/assets/payment-method.svg","../src/assets/outlined-circle.svg","../src/assets/outlined-checked-circle.svg","../src/assets/outlined-checked-circle-disabled.svg","../src/assets/arrow-forward.svg","../src/assets/close.svg","../src/assets/check.svg","../src/assets/pay-as-you-go-charge.svg","../src/assets/coupon.svg","../src/assets/add.svg","../src/assets/remove.svg","../src/assets/entitlement-check.svg","../src/components/common/Icon.tsx","../src/components/paywall/EntitlementRow.tsx","../src/components/paywall/types.ts","../src/components/paywall/PlanEntitlements.tsx","../src/theme/getResolvedTheme.ts","../src/components/utils/priceTierUtils.ts","../src/components/utils/getSubscriptionScheduleUpdateTexts.tsx","../src/components/paywall/PlanOfferingButton.tsx","../src/components/utils/currencyUtils.ts","../src/components/utils/numberUtils.ts","../src/components/utils/getPlanPrice.ts","../src/components/utils/getPaidPriceText.ts","../src/components/checkout/components/Button.tsx","../src/components/checkout/components/InputField.tsx","../src/components/checkout/components/Skeletons.style.ts","../src/components/checkout/components/ContentLoadingSkeleton.tsx","../src/components/utils/onWheelBlur.ts","../src/components/common/VolumePerUnitInput.tsx","../src/components/common/VolumeBulkSelect.tsx","../src/components/common/TiersSelectContainer.tsx","../src/components/paywall/PlanPrice.tsx","../src/components/paywall/PlanCompatibleAddons.tsx","../src/components/paywall/PlanOffering.tsx","../src/assets/powered-by-stigg.svg","../src/components/paywall/BillingPeriodPicker.tsx","../src/components/utils/calculateDiscountRate.ts","../src/components/common/PoweredByStigg.tsx","../src/components/paywall/utils/hasPricePoints.ts","../src/components/paywall/Paywall.tsx","../src/components/paywall/utils/getPlansToDisplay.ts","../node_modules/regenerator-runtime/runtime.js","../src/services/logger.ts","../src/components/paywall/utils/computeDefaultBillingPeriod.ts","../src/components/checkout/configurations/typography.ts","../src/components/common/mapExternalTheme.ts","../src/assets/check-stigg.svg","../src/components/StiggProvider.tsx","../src/hooks/useStiggContext.ts","../src/components/paywall/PaywallLoader.tsx","../src/theme/Fonts.tsx","../src/theme/Theme.tsx","../src/components/customerPortal/CustomerPortalProvider.tsx","../src/components/customerPortal/customerPortalTheme.ts","../src/components/customerPortal/hooks/useCustomerPortal.ts","../src/components/customerPortal/customerPortalTextOverrides.ts","../src/assets/edit-icon.svg","../src/components/customerPortal/common/StyledButton.tsx","../src/components/customerPortal/types.ts","../src/components/customerPortal/common/SectionHeader.ts","../src/components/customerPortal/common/SectionTitle.tsx","../src/components/customerPortal/subscriptionOverview/SubscriptionsOverviewHeader.tsx","../src/components/customerPortal/subscriptionOverview/tabs/AddonsList.tsx","../src/components/customerPortal/subscriptionOverview/tabs/Promotions.tsx","../src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.style.tsx","../src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.tsx","../src/components/common/mediaQuery.ts","../src/components/hooks/useIsScreenWiderThan.ts","../src/components/customerPortal/subscriptionOverview/SubscriptionOverviewLoader.tsx","../src/components/customerPortal/subscriptionOverview/subscriptionScheduledUpdates/SubscriptionScheduledUpdateRow.tsx","../src/components/customerPortal/subscriptionOverview/subscriptionScheduledUpdates/SubscriptionScheduledUpdatesAlert.tsx","../src/components/customerPortal/common/SectionContainer.tsx","../src/components/customerPortal/subscriptionOverview/upcomingBilling/NextEstimatedBill.tsx","../src/components/customerPortal/subscriptionOverview/upcomingBilling/NoUpcomingBilling.tsx","../src/components/customerPortal/subscriptionOverview/ContactCustomerSupport.tsx","../src/assets/sand-clock.svg","../src/components/customerPortal/subscriptionOverview/upcomingBilling/UpcomingBilling.tsx","../src/components/common/InformationTooltip.tsx","../src/components/common/LongText.tsx","../src/components/customerPortal/subscriptionOverview/subscriptionView/TrialPanel.tsx","../src/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.tsx","../src/components/customerPortal/usage/featureUsage/FeatureUsage.helper.ts","../src/components/customerPortal/usage/featureUsage/FeatureUsageProgressBar.tsx","../src/components/customerPortal/usage/featureUsage/EntitlementCTAButton.tsx","../src/components/customerPortal/subscriptionOverview/charges/ChargeItem.tsx","../src/components/customerPortal/subscriptionOverview/charges/ChargeList.tsx","../src/components/customerPortal/subscriptionOverview/SubscriptionsOverview.tsx","../src/components/customerPortal/CustomerPortalHeader.tsx","../src/components/customerPortal/common/ExternalLinkButton.tsx","../src/components/customerPortal/billing/InformationGrid.tsx","../src/components/customerPortal/common/SkeletonButton.tsx","../src/components/customerPortal/billing/PaymentDetailsSection.tsx","../src/components/customerPortal/paywall/CustomerPortalPaywall.style.ts","../src/components/customerPortal/paywall/CustomerPortalPaywall.tsx","../src/components/customerPortal/CustomerPortal.style.ts","../src/components/utils/getFeatureName.ts","../src/components/customerPortal/usage/featureUsage/FeatureUsage.style.ts","../src/components/customerPortal/usage/featureUsage/FeatureUsage.tsx","../src/components/customerPortal/usage/CustomerUsageData.style.tsx","../src/components/customerPortal/usage/CustomerUsageData.tsx","../src/components/customerPortal/CustomerPortalContainer.tsx","../src/components/customerPortal/billing/InvoicesSection.tsx","../src/components/checkout/steps/addons/addon.utils.ts","../src/components/checkout/hooks/useAddonsStepModel.ts","../src/components/checkout/hooks/useCheckoutModel.ts","../src/components/checkout/hooks/useProgressBarModel.ts","../src/components/utils/priceUtils.ts","../src/components/utils/planPrices.ts","../src/components/checkout/hooks/usePlanStepModel.ts","../src/components/checkout/hooks/useSubscriptionModel.ts","../src/components/checkout/hooks/usePreviewSubscription.ts","../src/components/checkout/hooks/usePaymentStepModel.ts","../src/components/checkout/configurations/theme.ts","../src/components/checkout/CheckoutProvider.tsx","../src/components/checkout/hooks/useLoadCheckout.ts","../src/components/checkout/configurations/textOverrides.ts","../src/assets/plus-icon.svg","../src/components/checkout/CheckoutContainer.style.ts","../src/components/checkout/progressBar/CheckoutProgressBar.style.ts","../src/components/checkout/progressBar/CheckoutProgressBar.tsx","../src/components/hooks/useChargeSort.ts","../src/components/checkout/hooks/useCouponModel.ts","../src/components/checkout/promotionCode/AddPromotionCodeButton.tsx","../src/components/checkout/promotionCode/AddPromotionCode.tsx","../src/components/checkout/promotionCode/AppliedPromotionCode.tsx","../src/components/checkout/promotionCode/PromotionCodeSection.tsx","../src/components/checkout/steps/payment/stripe/StripePaymentForm.tsx","../src/components/checkout/steps/payment/stripe/stripe.utils.ts","../src/components/checkout/summary/CheckoutSuccess.tsx","../src/components/checkout/steps/payment/stripe/useSubmit.ts","../src/components/checkout/summary/components/WithSkeleton.tsx","../src/components/checkout/summary/components/CheckoutCaptions.tsx","../src/components/checkout/summary/components/getPriceBreakdownString.ts","../src/components/checkout/summary/components/GraduatedPriceBreakdown.tsx","../src/components/common/CollapsableSectionIcon.tsx","../src/components/checkout/summary/components/LineItems.tsx","../src/components/checkout/summary/CheckoutSummary.tsx","../src/components/checkout/hooks/useSubscriptionState.ts","../src/components/checkout/summary/CheckoutSummarySkeleton.tsx","../src/components/checkout/steps/addons/CheckoutAddonsStep.style.tsx","../src/components/checkout/steps/addons/CheckoutAddonsStep.tsx","../src/components/checkout/steps/payment/PaymentMethods.style.ts","../src/components/checkout/steps/payment/PaymentMethods.tsx","../src/components/checkout/steps/payment/PaymentStep.tsx","../src/components/checkout/components/ChangePlanButton.tsx","../src/components/checkout/planHeader/PlanHeader.tsx","../src/components/checkout/formatting.ts","../src/components/checkout/steps/plan/BillingPeriodPicker.style.tsx","../src/components/checkout/steps/plan/BillingPeriodPicker.tsx","../src/components/checkout/steps/plan/CheckoutChargeList.tsx","../src/assets/arrow-right.svg","../src/components/checkout/steps/plan/CheckoutPlanStep.style.tsx","../src/components/checkout/steps/plan/CheckoutPlanStep.tsx","../src/components/checkout/components/StyledArrow.tsx","../src/components/checkout/components/DowngradeToFreeContainer.tsx","../src/components/checkout/CheckoutContainer.tsx","../src/components/checkout/steps/payment/stripe/useStripeIntegration.ts","../src/components/hooks/useWaitForCheckoutCompleted.ts","../src/hooks/useBooleanEntitlement.ts","../src/hooks/useNumericEntitlement.ts","../src/hooks/useMeteredEntitlement.ts","../src/hooks/useEnumEntitlement.ts","../src/hooks/useFetch.ts","../src/components/BooleanEntitlementGuard.tsx","../src/components/checkout/Checkout.tsx","../src/components/customerPortal/CustomerPortal.tsx","../src/components/EnumEntitlementGuard.tsx","../src/components/MeteredEntitlementGuard.tsx","../src/components/NumericEntitlementGuard.tsx","../src/components/paywall/PaywallContainer.tsx","../src/components/paywall/hooks/useLoadPaywallData.ts","../src/components/paywall/utils/mapPaywallData.ts","../src/components/paywall/utils/calculateTrialDaysLeft.ts","../src/components/paywall/paywallTextOverrides.ts","../src/hooks/useActiveSubscriptions.ts","../src/hooks/useCustomerPortal.ts","../src/hooks/usePaywall.ts"],"sourcesContent":["export function calculateUnitQuantityText(\n minUnitQuantity?: number | null,\n maxUnitQuantity?: number | null,\n unitsPlural?: string | null,\n) {\n const unitsText = unitsPlural ? ` ${unitsPlural}` : '';\n\n // copy for only maxunit\n if ((!minUnitQuantity || minUnitQuantity === 1) && maxUnitQuantity) {\n return `Up to ${maxUnitQuantity}${unitsText}`;\n }\n\n // both limits\n if (minUnitQuantity && minUnitQuantity > 1 && maxUnitQuantity) {\n return `${minUnitQuantity}-${maxUnitQuantity}${unitsText}`;\n }\n\n if (minUnitQuantity && minUnitQuantity > 1) {\n return `Minimum ${minUnitQuantity}${unitsText}`;\n }\n\n return '';\n}\n","export function formatNumber(usageLimit: number | null | undefined) {\n return usageLimit?.toLocaleString('en-US', {\n maximumFractionDigits: 0,\n });\n}\n","import React, { CSSProperties, forwardRef } from 'react';\nimport styled from '@emotion/styled/macro';\nimport { FontWeight as StyledFontWeight, Text, TypeProps } from 'styled-typography';\nimport { Theme, useTheme } from '@emotion/react';\nimport { FontWeight } from '../../theme/types';\n\ntype Colors =\n | 'primary'\n | 'primary.main'\n | 'primary.main.light'\n | 'secondary'\n | 'tertiary'\n | 'disabled'\n | 'white'\n | 'warning'\n | 'error';\n\nexport type TypographyProps = {\n children: React.ReactNode;\n variant?: 'h1' | 'h3' | 'h6' | 'body1' | 'caption';\n style?: CSSProperties | undefined;\n color?: Colors;\n // This is being used when passing color from the theming which\n // can be any color and not from the closed list of colors above\n overrideColor?: string;\n className?: string;\n bold?: boolean;\n span?: boolean;\n as?: 'div' | 'p' | 'span';\n} & Omit<TypeProps, 'color' | 'level'>;\n\nfunction getColor(theme: Theme, $color: Colors) {\n switch ($color) {\n case 'white':\n return 'white';\n case 'primary.main':\n return theme.stigg.palette.primary;\n case 'primary.main.light':\n return theme.stigg.palette.primaryLight;\n case 'warning':\n return theme.stigg.palette.warning;\n case 'error':\n return theme.stigg.palette.error;\n default:\n return theme.stigg.palette.text[$color];\n }\n}\n\nconst StyledText = styled(Text)<{ $span?: boolean }>`\n margin: 0;\n ${({ $span }) => $span && `display: inline`};\n`;\n\nfunction getLevel(variant: TypographyProps['variant']) {\n switch (variant) {\n case 'h1':\n return 1;\n case 'h3':\n return 2;\n case 'h6':\n return 3;\n case 'body1':\n return 4;\n case 'caption':\n return 5;\n default:\n return 3;\n }\n}\n\nfunction mapFontWeight(fontWeight: FontWeight) {\n switch (fontWeight) {\n case 'bold':\n return StyledFontWeight.Bold;\n case 'normal':\n return StyledFontWeight.Normal;\n default:\n return StyledFontWeight.Normal;\n }\n}\n\nfunction getFontWeight(theme: Theme, variant: TypographyProps['variant']) {\n const { typography } = theme.stigg;\n switch (variant) {\n case 'h1':\n return mapFontWeight(typography.h1.fontWeight);\n case 'h3':\n return mapFontWeight(typography.h2.fontWeight);\n case 'h6':\n return mapFontWeight(typography.h3.fontWeight);\n case 'body1':\n return mapFontWeight(typography.body.fontWeight);\n case 'caption':\n return mapFontWeight(typography.caption.fontWeight);\n default:\n return StyledFontWeight.Normal;\n }\n}\n\nexport const Typography = forwardRef((props: TypographyProps, ref) => {\n const {\n children,\n span,\n style,\n fontWeight,\n variant = 'body1',\n color = 'primary',\n overrideColor,\n bold,\n as = 'p',\n ...rest\n } = props;\n const theme = useTheme();\n const level = getLevel(variant);\n const levelClassName = `typography-level-${level}`;\n const className = props.className ? `${props.className} ${levelClassName}` : levelClassName;\n\n return (\n <StyledText\n as={as}\n ref={ref}\n {...rest}\n className={className}\n style={style}\n level={level}\n color={overrideColor || getColor(theme, color)}\n fontWeight={fontWeight ?? (bold ? StyledFontWeight.Bold : getFontWeight(theme, variant))}\n $span={span}>\n {children}\n </StyledText>\n );\n});\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_834_118930)\">\n<path d=\"M12 6.85712V17.1428\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M6.85712 12H17.1428\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M18 0.857117H5.99997C3.15966 0.857117 0.857117 3.15966 0.857117 5.99997V18C0.857117 20.8404 3.15966 23.1428 5.99997 23.1428H18C20.8404 23.1428 23.1428 20.8404 23.1428 18V5.99997C23.1428 3.15966 20.8404 0.857117 18 0.857117Z\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_834_118930\">\n<rect width=\"24\" height=\"24\" fill=\"white\"/>\n</clipPath>\n</defs>\n</svg>\n","<svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"#F5F6F9\"/>\n<path d=\"M26 27V25C26 22.7909 24.2091 21 22 21H14C11.7909 21 10 22.7909 10 25V27\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M18 17C20.2091 17 22 15.2091 22 13C22 10.7909 20.2091 9 18 9C15.7909 9 14 10.7909 14 13C14 15.2091 15.7909 17 18 17Z\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<defs>\n<linearGradient id=\"paint0_linear_67_8545\" x1=\"35.0204\" y1=\"1.22449\" x2=\"0\" y2=\"36\" gradientUnits=\"userSpaceOnUse\">\n<stop stop-color=\"#56ACF6\"/>\n<stop offset=\"1\" stop-color=\"#1559E6\"/>\n</linearGradient>\n</defs>\n</svg>\n","<svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"#F5F6F9\"/>\n<path d=\"M27 18.22C27 12.73 22.74 9 18 9C13.31 9 9 12.65 9 18.28C8.4 18.62 8 19.26 8 20V22C8 23.1 8.9 24 10 24H11V17.9C11 14.03 14.13 10.9 18 10.9C21.87 10.9 25 14.03 25 17.9V25H17V27H25C26.1 27 27 26.1 27 25V23.78C27.59 23.47 28 22.86 28 22.14V19.84C28 19.14 27.59 18.53 27 18.22Z\" fill=\"#7586B0\"/>\n<path d=\"M15 20C15.5523 20 16 19.5523 16 19C16 18.4477 15.5523 18 15 18C14.4477 18 14 18.4477 14 19C14 19.5523 14.4477 20 15 20Z\" fill=\"#7586B0\"/>\n<path d=\"M21 20C21.5523 20 22 19.5523 22 19C22 18.4477 21.5523 18 21 18C20.4477 18 20 18.4477 20 19C20 19.5523 20.4477 20 21 20Z\" fill=\"#7586B0\"/>\n<path d=\"M24 17.03C23.52 14.18 21.04 12 18.05 12C15.02 12 11.76 14.51 12.02 18.45C14.49 17.44 16.35 15.24 16.88 12.56C18.19 15.19 20.88 17 24 17.03Z\" fill=\"#7586B0\"/>\n<defs>\n<linearGradient id=\"paint0_linear_267_19310\" x1=\"35.0204\" y1=\"1.22449\" x2=\"0\" y2=\"36\" gradientUnits=\"userSpaceOnUse\">\n<stop stop-color=\"#56ACF6\"/>\n<stop offset=\"1\" stop-color=\"#1559E6\"/>\n</linearGradient>\n</defs>\n</svg>\n","<svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"#F5F6F9\"/>\n<path d=\"M26 10H10C8.89 10 8.01 10.89 8.01 12L8 24C8 25.11 8.89 26 10 26H26C27.11 26 28 25.11 28 24V12C28 10.89 27.11 10 26 10ZM26 24H10V18H26V24ZM26 14H10V12H26V14Z\" fill=\"#7586B0\"/>\n<defs>\n<linearGradient id=\"paint0_linear_67_8556\" x1=\"35.0204\" y1=\"1.22449\" x2=\"0\" y2=\"36\" gradientUnits=\"userSpaceOnUse\">\n<stop stop-color=\"#56ACF6\"/>\n<stop offset=\"1\" stop-color=\"#1559E6\"/>\n</linearGradient>\n</defs>\n</svg>\n","<svg width=\"21\" height=\"20\" viewBox=\"0 0 21 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_834_120339)\">\n<path d=\"M10.3336 19.2858C15.462 19.2858 19.6193 15.1285 19.6193 10.0001C19.6193 4.87171 15.462 0.714355 10.3336 0.714355C5.20521 0.714355 1.04785 4.87171 1.04785 10.0001C1.04785 15.1285 5.20521 19.2858 10.3336 19.2858Z\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12.7649 7.46052C12.6813 7.22393 12.5523 7.0088 12.3883 6.8256C12.0395 6.43592 11.5327 6.19067 10.9685 6.19067H9.4942C8.55517 6.19067 7.79395 6.9519 7.79395 7.89093C7.79395 8.68995 8.3503 9.38116 9.13086 9.5519L11.3756 10.0429C12.25 10.2342 12.8733 11.0091 12.8733 11.9043C12.8733 12.9562 12.0205 13.8097 10.9685 13.8097H9.6987C8.86936 13.8097 8.16382 13.2797 7.90233 12.5399\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M10.3335 6.19065V4.28589\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M10.3335 15.7144V13.8096\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_834_120339\">\n<rect width=\"20\" height=\"20\" fill=\"white\" transform=\"translate(0.333496)\"/>\n</clipPath>\n</defs>\n</svg>\n","<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M6.95392 1.03353C7.1196 1.56038 6.82682 2.12178 6.29997 2.28746C5.79034 2.44773 5.30237 2.68036 4.85175 2.98146C3.76168 3.70982 2.95789 4.79361 2.57732 6.04817C2.19675 7.30273 2.26296 8.65044 2.76466 9.86166C3.26637 11.0729 4.17252 12.0727 5.32873 12.6907C6.48494 13.3087 7.81967 13.5067 9.10549 13.2509C10.3913 12.9951 11.5487 12.3014 12.3804 11.288C13.2121 10.2746 13.6666 9.00413 13.6666 7.69312C13.6666 7.14083 14.1144 6.69312 14.6666 6.69312C15.2189 6.69312 15.6666 7.14083 15.6666 7.69312C15.6666 7.92228 15.6564 8.15052 15.6361 8.37721C15.6465 8.44937 15.6492 8.52379 15.6432 8.59952L15.6392 8.64883C15.6298 8.75932 15.6028 8.86407 15.5612 8.96057C15.3409 10.2743 14.7807 11.5158 13.9264 12.5568C12.8012 13.9279 11.2353 14.8664 9.49568 15.2125C7.75603 15.5585 5.95022 15.2906 4.38594 14.4545C2.82166 13.6184 1.59568 12.2657 0.916905 10.627C0.238131 8.98832 0.148554 7.16495 0.663439 5.4676C1.17832 3.77025 2.26581 2.30394 3.74061 1.31852C4.35023 0.911179 5.01049 0.596408 5.69999 0.379577C6.22684 0.213898 6.78824 0.506683 6.95392 1.03353ZM7.56761 1.27284C7.61434 0.722538 8.09832 0.314306 8.64863 0.361031L8.69791 0.365373C9.24791 0.415584 9.65307 0.902149 9.60286 1.45215C9.55265 2.00214 9.06608 2.4073 8.51608 2.35709L8.47942 2.35386C7.92912 2.30714 7.52089 1.82315 7.56761 1.27284ZM12.4186 2.90891C12.8384 2.55014 13.4697 2.59967 13.8284 3.01954C13.8498 3.04454 13.871 3.06967 13.892 3.09494C14.2454 3.51937 14.1878 4.14991 13.7634 4.50329C13.339 4.85667 12.7084 4.79906 12.355 4.37463C12.3395 4.35592 12.3238 4.33731 12.3079 4.31879C11.9492 3.89892 11.9987 3.26769 12.4186 2.90891ZM8.99998 5.33352C8.99998 4.78124 8.55226 4.33352 7.99998 4.33352C7.44769 4.33352 6.99998 4.78124 6.99998 5.33352V8.00019C6.99998 8.55247 7.44769 9.00019 7.99998 9.00019H10.6666C11.2189 9.00019 11.6666 8.55247 11.6666 8.00019C11.6666 7.4479 11.2189 7.00019 10.6666 7.00019H8.99998V5.33352Z\" fill=\"#7586B0\"/>\n</svg>\n","import { Theme } from '@emotion/react';\n\nexport type IconColor = 'primary' | 'secondary';\n\nexport const getIconColor = (color: IconColor | string | undefined, theme: Theme) => {\n switch (color) {\n case 'primary':\n return theme.stigg.palette.text.primary;\n case 'secondary':\n return theme.stigg.palette.text.secondary;\n default:\n return color;\n }\n};\n","<svg width=\"24\" height=\"25\" viewBox=\"0 0 24 25\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_834_116282)\">\n<path d=\"M21.4286 5.32483H2.57146C1.62469 5.32483 0.857178 6.09235 0.857178 7.03911V10.4677C0.857178 11.4145 1.62469 12.182 2.57146 12.182H21.4286C22.3754 12.182 23.1429 11.4145 23.1429 10.4677V7.03911C23.1429 6.09235 22.3754 5.32483 21.4286 5.32483Z\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M21.4287 12.182V21.6106C21.4287 22.0652 21.248 22.5013 20.9266 22.8227C20.6051 23.1442 20.169 23.3249 19.7144 23.3249H4.28582C3.83116 23.3249 3.39513 23.1442 3.07363 22.8227C2.75215 22.5013 2.57153 22.0652 2.57153 21.6106V12.182\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 5.32483V23.3248\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M17.1429 1.03912L12 5.32484L6.85718 1.03912\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_834_116282\">\n<rect width=\"24\" height=\"24\" fill=\"white\" transform=\"translate(0 0.182007)\"/>\n</clipPath>\n</defs>\n</svg>\n","<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M10.8333 2.5C6.69168 2.5 3.33334 5.85833 3.33334 10H0.833344L4.07501 13.2417L4.13334 13.3583L7.50001 10H5.00001C5.00001 6.775 7.60834 4.16667 10.8333 4.16667C14.0583 4.16667 16.6667 6.775 16.6667 10C16.6667 13.225 14.0583 15.8333 10.8333 15.8333C9.22501 15.8333 7.76668 15.175 6.71668 14.1167L5.53334 15.3C6.89168 16.6583 8.75834 17.5 10.8333 17.5C14.975 17.5 18.3333 14.1417 18.3333 10C18.3333 5.85833 14.975 2.5 10.8333 2.5ZM10 6.66667V10.8333L13.5667 12.95L14.1667 11.9417L11.25 10.2083V6.66667H10Z\" fill=\"#6678A7\"/>\n</svg>\n","<svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"url(#paint0_linear_834_118583)\"/>\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"#F5F6F9\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15.9539 7.70028C16.1196 8.22713 15.8268 8.78853 15.3 8.95421C14.4906 9.20875 13.7155 9.57824 12.9999 10.0564C11.2686 11.2132 9.99197 12.9346 9.38754 14.9271C8.78311 16.9196 8.88826 19.0601 9.68509 20.9838C10.4819 22.9075 11.9211 24.4954 13.7574 25.477C15.5938 26.4585 17.7136 26.7729 19.7558 26.3667C21.798 25.9605 23.6362 24.8588 24.9571 23.2492C26.278 21.6396 27 19.6219 27 17.5397C27 16.9874 27.4477 16.5397 28 16.5397C28.5523 16.5397 29 16.9874 29 17.5397C29 17.8969 28.9826 18.2526 28.9483 18.6056C28.9662 18.6949 28.9722 18.7883 28.9645 18.8837L28.9606 18.9309C28.9496 19.0607 28.9143 19.1825 28.8595 19.2924C28.5513 21.2017 27.7432 23.007 26.5031 24.518C24.8886 26.4852 22.642 27.8318 20.146 28.3283C17.65 28.8248 15.059 28.4405 12.8146 27.2408C10.5702 26.0411 8.81122 24.1004 7.83733 21.7492C6.86343 19.398 6.73491 16.7819 7.47366 14.3465C8.21241 11.9112 9.77272 9.80737 11.8887 8.3935C12.7634 7.80905 13.7107 7.35743 14.7 7.04633C15.2269 6.88065 15.7883 7.17343 15.9539 7.70028ZM17.8497 7.95155C17.8964 7.40125 18.3804 6.99302 18.9307 7.03974L18.9779 7.04385C19.528 7.0929 19.9342 7.57861 19.8851 8.12871C19.8361 8.67881 19.3503 9.085 18.8002 9.03595L18.7615 9.03257C18.2112 8.98585 17.8029 8.50186 17.8497 7.95155ZM22.8579 9.19953C23.172 8.74525 23.7949 8.63161 24.2492 8.9457C24.2751 8.96361 24.3009 8.98162 24.3266 8.99974C24.7782 9.31772 24.8865 9.94155 24.5685 10.3931C24.2505 10.8447 23.6267 10.953 23.1751 10.635C23.1541 10.6202 23.1329 10.6054 23.1118 10.5908C22.6575 10.2767 22.5438 9.6538 22.8579 9.19953ZM26.6058 12.8085C27.1045 12.5712 27.7011 12.7831 27.9384 13.2818C27.9519 13.3102 27.9653 13.3387 27.9786 13.3672C28.2116 13.868 27.9946 14.4628 27.4939 14.6958C26.9931 14.9288 26.3983 14.7117 26.1653 14.211L26.1506 14.1796L26.1324 14.1411C25.8951 13.6424 26.1071 13.0458 26.6058 12.8085ZM19 14.0003C19 13.448 18.5523 13.0003 18 13.0003C17.4477 13.0003 17 13.448 17 14.0003V18.0003C17 18.5526 17.4477 19.0003 18 19.0003H22C22.5523 19.0003 23 18.5526 23 18.0003C23 17.448 22.5523 17.0003 22 17.0003H19V14.0003Z\" fill=\"#7586B0\"/>\n<defs>\n<linearGradient id=\"paint0_linear_834_118583\" x1=\"35.0204\" y1=\"1.22449\" x2=\"0\" y2=\"36\" gradientUnits=\"userSpaceOnUse\">\n</linearGradient>\n</defs>\n</svg>\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9.95394 1.70028C10.1196 2.22713 9.82684 2.78853 9.29999 2.95421C8.49057 3.20875 7.71555 3.57824 6.99987 4.05644C5.26859 5.21324 3.99197 6.93456 3.38754 8.9271C2.78311 10.9196 2.88826 13.0601 3.68509 14.9838C4.48191 16.9075 5.9211 18.4954 7.75743 19.477C9.59377 20.4585 11.7136 20.7729 13.7558 20.3667C15.798 19.9605 17.6362 18.8588 18.9571 17.2492C20.278 15.6396 21 13.6219 21 11.5397C21 10.9874 21.4477 10.5397 22 10.5397C22.5523 10.5397 23 10.9874 23 11.5397C23 11.8969 22.9826 12.2526 22.9483 12.6056C22.9662 12.6949 22.9722 12.7883 22.9645 12.8837L22.9606 12.9309C22.9496 13.0607 22.9143 13.1825 22.8595 13.2924C22.5513 15.2017 21.7432 17.007 20.5031 18.518C18.8886 20.4852 16.642 21.8318 14.146 22.3283C11.65 22.8248 9.05905 22.4405 6.81464 21.2408C4.57023 20.0411 2.81122 18.1004 1.83733 15.7492C0.863434 13.398 0.734911 10.7819 1.47366 8.34653C2.21241 5.91121 3.77272 3.80737 5.88873 2.3935C6.76341 1.80905 7.71072 1.35743 8.70001 1.04633C9.22686 0.880646 9.78826 1.17343 9.95394 1.70028ZM11.8497 1.95155C11.8964 1.40125 12.3804 0.993017 12.9307 1.03974L12.9779 1.04385C13.528 1.0929 13.9342 1.57861 13.8851 2.12871C13.8361 2.67881 13.3503 3.085 12.8002 3.03595L12.7615 3.03257C12.2112 2.98585 11.8029 2.50186 11.8497 1.95155ZM16.8579 3.19953C17.172 2.74525 17.7949 2.63161 18.2492 2.9457C18.2751 2.96361 18.3009 2.98162 18.3266 2.99974C18.7782 3.31772 18.8865 3.94155 18.5685 4.39311C18.2505 4.84467 17.6267 4.95296 17.1751 4.63498C17.1541 4.62016 17.1329 4.60542 17.1118 4.59078C16.6575 4.27669 16.5438 3.6538 16.8579 3.19953ZM20.6058 6.80846C21.1045 6.57117 21.7011 6.78308 21.9384 7.28179C21.9519 7.3102 21.9653 7.33869 21.9786 7.36723C22.2116 7.86796 21.9946 8.46276 21.4939 8.69577C20.9931 8.92877 20.3983 8.71174 20.1653 8.21101L20.1506 8.17957L20.1324 8.14112C19.8951 7.64241 20.1071 7.04576 20.6058 6.80846ZM13 8.00027C13 7.44798 12.5523 7.00027 12 7.00027C11.4477 7.00027 11 7.44798 11 8.00027V12.0003C11 12.5526 11.4477 13.0003 12 13.0003H16C16.5523 13.0003 17 12.5526 17 12.0003C17 11.448 16.5523 11.0003 16 11.0003H13V8.00027Z\" fill=\"#7586B0\"/>\n</svg>\n","<svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"#F5F6F9\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 12C9 10.8954 9.89543 10 11 10H25C26.1046 10 27 10.8954 27 12V26C27 27.1046 26.1046 28 25 28H11C9.89543 28 9 27.1046 9 26V12Z\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M22 8V12\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M14 8V12\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M9 16H27\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<defs>\n<linearGradient id=\"paint0_linear_45_8861\" x1=\"35.0204\" y1=\"1.22449\" x2=\"0\" y2=\"36\" gradientUnits=\"userSpaceOnUse\">\n<stop stop-color=\"#56ACF6\"/>\n<stop offset=\"1\" stop-color=\"#1559E6\"/>\n</linearGradient>\n</defs>\n</svg>\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"trash-2\">\n<path id=\"Shape\" d=\"M3 6H5H21\" stroke=\"#F88078\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path id=\"Shape_2\" d=\"M20 6C20 5.44772 19.5523 5 19 5C18.4477 5 18 5.44772 18 6H20ZM6 6C6 5.44772 5.55228 5 5 5C4.44772 5 4 5.44772 4 6H6ZM7 6C7 6.55228 7.44772 7 8 7C8.55228 7 9 6.55228 9 6H7ZM15 6C15 6.55228 15.4477 7 16 7C16.5523 7 17 6.55228 17 6H15ZM18 6V20H20V6H18ZM18 20C18 20.5523 17.5523 21 17 21V23C18.6569 23 20 21.6569 20 20H18ZM17 21H7V23H17V21ZM7 21C6.44772 21 6 20.5523 6 20H4C4 21.6569 5.34315 23 7 23V21ZM6 20V6H4V20H6ZM9 6V4H7V6H9ZM9 4C9 3.44772 9.44772 3 10 3V1C8.34315 1 7 2.34315 7 4H9ZM10 3H14V1H10V3ZM14 3C14.5523 3 15 3.44772 15 4H17C17 2.34315 15.6569 1 14 1V3ZM15 4V6H17V4H15Z\" fill=\"#F88078\"/>\n<path id=\"Shape_3\" d=\"M10 11V17\" stroke=\"#F88078\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path id=\"Shape_4\" d=\"M14 11V17\" stroke=\"#F88078\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M21.1667 4H2.83333C1.82081 4 1 4.89543 1 6V18C1 19.1046 1.82081 20 2.83333 20H21.1667C22.1792 20 23 19.1046 23 18V6C23 4.89543 22.1792 4 21.1667 4Z\" fill=\"#C6C6C7\"/>\n<path opacity=\"0.3\" d=\"M19.75 16.4286H17.5C17.0125 16.4286 16.75 16.2 16.75 15.6667C16.75 15.1334 17.0125 14.9048 17.5 14.9048H19.75C20.2375 14.9048 20.5 15.1334 20.5 15.6667C20.5 16.2 20.2375 16.4286 19.75 16.4286ZM15.25 16.4286H13C12.5125 16.4286 12.25 16.2 12.25 15.6667C12.25 15.1334 12.5125 14.9048 13 14.9048H15.25C15.7375 14.9048 16 15.1334 16 15.6667C16 16.2 15.7375 16.4286 15.25 16.4286ZM10.75 16.4286H8.5C8.0125 16.4286 7.75 16.2 7.75 15.6667C7.75 15.1334 8.0125 14.9048 8.5 14.9048H10.75C11.2375 14.9048 11.5 15.1334 11.5 15.6667C11.5 16.2 11.2375 16.4286 10.75 16.4286ZM6.25 16.4286H4C3.5125 16.4286 3.25 16.2 3.25 15.6667C3.25 15.1334 3.5125 14.9048 4 14.9048H6.25C6.7375 14.9048 7 15.1334 7 15.6667C7 16.2 6.7375 16.4286 6.25 16.4286Z\" fill=\"black\"/>\n</svg>\n","<svg width=\"21\" height=\"20\" viewBox=\"0 0 21 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<circle cx=\"10.333\" cy=\"10\" r=\"9\" fill=\"white\" stroke=\"#327EEE\" stroke-width=\"2\"/>\n</svg>\n","<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"Group 16159\">\n<circle id=\"Ellipse 5\" cx=\"10\" cy=\"10\" r=\"9.25\" fill=\"#327EEE\" stroke=\"#327EEE\" stroke-width=\"1.5\"/>\n<path id=\"Shape\" d=\"M5 10.3636L8.63667 14L12.637 10L14.6372 8\" stroke=\"white\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","<svg width=\"21\" height=\"20\" viewBox=\"0 0 21 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"Stepper indicators\">\n<circle id=\"Ellipse 5\" cx=\"10.667\" cy=\"10\" r=\"9.25\" fill=\"#B3BCD3\" stroke=\"#B3BCD3\" stroke-width=\"1.5\"/>\n<path id=\"Shape\" d=\"M5.66699 10.3636L9.30366 14L13.304 10L15.3042 8\" stroke=\"white\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","<svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M9 3L7.9425 4.0575L12.1275 8.25H3V9.75H12.1275L7.9425 13.9425L9 15L15 9L9 3Z\" fill=\"white\"/>\n</svg>\n","<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M15.8337 5.34199L14.6587 4.16699L10.0003 8.82533L5.34199 4.16699L4.16699 5.34199L8.82533 10.0003L4.16699 14.6587L5.34199 15.8337L10.0003 11.1753L14.6587 15.8337L15.8337 14.6587L11.1753 10.0003L15.8337 5.34199Z\" fill=\"#327EEE\"/>\n</svg>\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"check\">\n<path id=\"Shape\" d=\"M20 7L9 18L4 13\" stroke=\"#F5F6F9\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>","<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_1889_12169)\">\n<path d=\"M11.4286 7.42578L8 13.1401\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M14.857 13.1412C15.3274 12.0123 15.5118 10.7848 15.3938 9.56751C15.2758 8.35027 14.8592 7.18097 14.1808 6.16341C13.5024 5.14585 12.5833 4.31152 11.5051 3.73446C10.4268 3.1574 9.22281 2.85547 7.99986 2.85547C6.77691 2.85547 5.57288 3.1574 4.49463 3.73446C3.41639 4.31152 2.49729 5.14585 1.81892 6.16341C1.14055 7.18097 0.723889 8.35027 0.605928 9.56751C0.487968 10.7848 0.672354 12.0123 1.14272 13.1412H14.857Z\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_1889_12169\">\n<rect width=\"16\" height=\"16\" fill=\"white\"/>\n</clipPath>\n</defs>\n</svg>\n","<svg width=\"16\" height=\"16\" viewBox=\"0 0 18 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"tag--tags-bookmark-favorite\">\n<path id=\"Vector\" d=\"M1.26995 11.9426L6.05743 16.7301C6.2305 16.903 6.4651 17.0001 6.7097 17.0001C6.95431 17.0001 7.18891 16.903 7.36198 16.7301L16.8631 7.22895C16.9108 7.18332 16.9478 7.12758 16.9712 7.06583C16.9946 7.00408 17.0039 6.93787 16.9985 6.87205L16.2724 2.15839C16.2664 2.04607 16.2192 1.93992 16.1396 1.86038C16.0601 1.78085 15.9539 1.73357 15.8416 1.72764L11.128 1.00152C11.0622 0.996055 10.9959 1.00538 10.9342 1.0288C10.8724 1.05222 10.8167 1.08916 10.7711 1.1369L1.26995 10.638C1.09709 10.8111 1 11.0457 1 11.2903C1 11.5349 1.09709 11.7695 1.26995 11.9426Z\" stroke=\"#327EEE\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path id=\"Vector_2\" d=\"M12.5548 6.05884C12.3916 6.05884 12.2351 5.99401 12.1197 5.87861C12.0043 5.76321 11.9395 5.60669 11.9395 5.44348C11.9395 5.28028 12.0043 5.12376 12.1197 5.00836C12.2351 4.89296 12.3916 4.82812 12.5548 4.82812C12.718 4.82812 12.8745 4.89296 12.9899 5.00836C13.1053 5.12376 13.1702 5.28028 13.1702 5.44348C13.1702 5.60669 13.1053 5.76321 12.9899 5.87861C12.8745 5.99401 12.718 6.05884 12.5548 6.05884Z\" stroke=\"#327EEE\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 3V21.0001M3 11.9446H21\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M3 12H21\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M3 11.1429L9.71572 17.8586C9.79383 17.9367 9.92046 17.9367 9.99856 17.8586L21.8571 6\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/>\n</svg> ","import styled from '@emotion/styled/macro';\nimport React, { CSSProperties } from 'react';\nimport { css, useTheme } from '@emotion/react';\nimport { getIconColor, IconColor } from './iconColor';\nimport * as customIcons from './customIcons';\n\nexport type Icons = keyof typeof customIcons;\n\nconst IconWrapper = styled.div<{ $pathColor?: string; $rectColor?: string; $strokeColor?: string }>`\n ${({ $pathColor }) =>\n $pathColor &&\n css`\n path {\n fill: ${$pathColor};\n }\n `}\n\n ${({ $rectColor }) =>\n $rectColor &&\n css`\n svg rect {\n fill: ${$rectColor};\n }\n `}\n\n\n ${({ $strokeColor }) =>\n $strokeColor &&\n css`\n g {\n stroke: ${$strokeColor};\n }\n `}\n`;\n\nexport type IconProps = {\n icon: Icons;\n className?: string;\n style?: CSSProperties;\n svgPathColor?: IconColor | string;\n svgRectColor?: IconColor | string;\n svgStrokeColor?: IconColor | string;\n};\n\nexport function Icon({ icon, className, style, svgPathColor, svgRectColor, svgStrokeColor }: IconProps) {\n const IconComponent = (customIcons as any)[icon];\n const theme = useTheme();\n\n return (\n <IconWrapper\n className={className}\n style={style}\n $pathColor={getIconColor(svgPathColor, theme)}\n $rectColor={getIconColor(svgRectColor, theme)}\n $strokeColor={getIconColor(svgStrokeColor, theme)}>\n <IconComponent />\n </IconWrapper>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { EntitlementResetPeriod } from '@stigg/js-client-sdk';\nimport { calculateUnitQuantityText } from './utils/calculateUnitQuantityText';\nimport { formatNumber } from '../utils/formatNumber';\nimport { Typography } from '../common/Typography';\nimport { Icon } from '../common/Icon';\n\nconst EntitlementName = styled(Typography)`\n margin: 0;\n`;\n\nconst EntitlementRowContainer = styled.div`\n display: flex;\n align-items: center;\n gap: 16px;\n`;\n\nconst EntitlementIconContainer = styled.div`\n display: flex;\n align-items: center;\n flex-shrink: 0;\n`;\n\nconst EntitlementIcon = styled(Icon)`\n width: 24px;\n height: 24px;\n color: ${({ theme }) => theme.stigg.palette.primary};\n`;\n\ntype EntitlementRowProps = {\n hasUnlimitedUsage?: boolean | null;\n isCustom?: boolean | null;\n usageLimit?: number | null;\n minUnitQuantity?: number | null;\n maxUnitQuantity?: number | null;\n resetPeriod?: EntitlementResetPeriod | null;\n displayNameOverride?: string | null;\n enumValues?: string[] | null;\n feature?: {\n id: string;\n units?: string | null | undefined;\n unitsPlural?: string | null | undefined;\n unitQuantity?: number | null;\n displayName: string;\n } | null;\n};\n\nfunction getResetPeriodText(resetPeriod?: EntitlementResetPeriod) {\n if (!resetPeriod) {\n return '';\n }\n\n switch (resetPeriod) {\n case EntitlementResetPeriod.Day: {\n return 'per day';\n }\n case EntitlementResetPeriod.Hour: {\n return 'per hour';\n }\n case EntitlementResetPeriod.Week: {\n return 'per week';\n }\n case EntitlementResetPeriod.Month: {\n return 'per month';\n }\n case EntitlementResetPeriod.Year: {\n return 'per year';\n }\n default: {\n return '';\n }\n }\n}\n\nfunction getEntitlementDisplay({\n hasUnlimitedUsage,\n feature,\n resetPeriod,\n usageLimit,\n minUnitQuantity,\n maxUnitQuantity,\n isCustom,\n enumValues,\n}: EntitlementRowProps) {\n const unitBasedEntitlement = minUnitQuantity || maxUnitQuantity;\n const resetPeriodSuffix = `${resetPeriod && usageLimit ? `${getResetPeriodText(resetPeriod)}` : ''}`;\n\n if (enumValues) {\n const featureUnits = enumValues.length === 1 ? feature?.units : feature?.unitsPlural;\n return `${enumValues.length} ${featureUnits}`;\n }\n\n if (hasUnlimitedUsage) {\n return `Unlimited ${feature?.unitsPlural}`;\n }\n\n if (isCustom) {\n return `Custom ${feature?.unitsPlural}`;\n }\n\n if (usageLimit) {\n const featureUnits = usageLimit === 1 ? feature?.units : feature?.unitsPlural;\n return `${formatNumber(usageLimit)} ${featureUnits} ${resetPeriodSuffix}`;\n }\n\n if (unitBasedEntitlement) {\n return calculateUnitQuantityText(minUnitQuantity, maxUnitQuantity, feature?.unitsPlural);\n }\n\n return feature?.displayName;\n}\n\nexport function EntitlementRow(props: EntitlementRowProps) {\n const { displayNameOverride, ...restProps } = props;\n const displayName = getEntitlementDisplay(restProps);\n\n return (\n <EntitlementRowContainer className={`stigg-entitlement-row-container stigg-entitlement-${restProps.feature?.id}`}>\n <EntitlementIconContainer>\n <EntitlementIcon icon=\"EntitlementCheck\" className=\"stigg-entitlement-row-icon\" />\n </EntitlementIconContainer>\n <EntitlementName className=\"stigg-entitlement-name\" variant=\"h6\" color=\"secondary\">\n {displayNameOverride || displayName}\n </EntitlementName>\n </EntitlementRowContainer>\n );\n}\n","import {\n BillingPeriod,\n Customer,\n Plan,\n Subscription,\n CustomerPortalSubscriptionScheduledUpdateDataFragment,\n PaywallCurrency,\n PaywallCalculatedPricePoint,\n BillableFeature,\n} from '@stigg/js-client-sdk';\nimport { CustomizedTheme } from '../../theme/Theme';\n\nexport type PaywallData = {\n plans: PaywallPlan[] | null;\n customer: Customer | null;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n isCustomerOnTrial: boolean;\n isLoading: boolean;\n selectedBillingPeriod: BillingPeriod;\n setSelectedBillingPeriod: (billingPeriod: BillingPeriod) => void;\n availableBillingPeriods: BillingPeriod[];\n locale: string;\n configuration?: CustomizedTheme;\n};\n\nexport type CurrentSubscriptionOverride = {\n planId: string;\n billableFeatures: BillableFeature[];\n};\n\nexport enum SubscribeIntentionType {\n START_TRIAL = 'START_TRIAL',\n UPGRADE_TRIAL_TO_PAID = 'UPGRADE_TRIAL_TO_PAID',\n REQUEST_CUSTOM_PLAN_ACCESS = 'REQUEST_CUSTOM_PLAN_ACCESS',\n CHANGE_BILLING_PERIOD = 'CHANGE_BILLING_PERIOD',\n CHANGE_UNIT_QUANTITY = 'CHANGE_UNIT_QUANTITY',\n UPGRADE_PLAN = 'UPGRADE_PLAN',\n DOWNGRADE_PLAN = 'DOWNGRADE_PLAN',\n CANCEL_SCHEDULED_UPDATES = 'CANCEL_SCHEDULED_UPDATES',\n}\n\nexport type PaywallPlan = Plan & {\n isLowerThanCurrentPlan?: boolean;\n isTriable: boolean;\n isCurrentCustomerPlan: boolean;\n currentCustomerPlanBillingPeriod?: BillingPeriod;\n trialDaysLeft?: number;\n isNextPlan?: (billingPeriod: BillingPeriod) => boolean;\n scheduledUpdate?: CustomerPortalSubscriptionScheduledUpdateDataFragment;\n paywallCurrency?: PaywallCurrency;\n paywallCalculatedPricePoints?: PaywallCalculatedPricePoint[];\n};\n\nexport type OnPlanSelectedCallbackFn = ({\n plan,\n customer,\n subscription,\n intentionType,\n selectedBillingPeriod,\n billableFeatures,\n}: {\n plan: Plan;\n customer: Customer | null;\n subscription: Subscription | null;\n intentionType: SubscribeIntentionType;\n selectedBillingPeriod: BillingPeriod;\n billableFeatures?: BillableFeature[];\n}) => void | Promise<void>;\n\nexport type ShouldHidePlanFn = ({ plan }: { plan: PaywallPlan }) => boolean | Promise<boolean>;\n\nexport type CurrentSubscriptionOverrideFn = ({\n currentSubscription,\n}: {\n currentSubscription: Subscription | null;\n}) => CurrentSubscriptionOverride | null | undefined;\n\nexport type SelectDefaultTierIndexFn = ({ plan }: { plan: PaywallPlan }) => number;\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { BillingPeriod, WidgetType } from '@stigg/js-client-sdk';\nimport { EntitlementRow } from './EntitlementRow';\nimport { PaywallPlan } from './types';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { Typography } from '../common/Typography';\n\nconst PlanEntitlementsContainer = styled.div`\n display: flex;\n flex-direction: column;\n gap: 16px;\n`;\n\nfunction getTitle(plan: PaywallPlan, paywallLocale: PaywallLocalization, hasFeatures: boolean) {\n if (paywallLocale.entitlementsTitle) {\n return paywallLocale.entitlementsTitle(plan);\n }\n let title = hasFeatures ? `Includes:` : '';\n if (plan.basePlan) {\n title = `Everything in ${plan.basePlan.displayName}${hasFeatures ? ', plus:' : ''}`;\n }\n\n return title;\n}\n\nexport function PlanEntitlements({\n plan,\n billingPeriod,\n paywallLocale,\n}: {\n plan: PaywallPlan;\n billingPeriod: BillingPeriod;\n paywallLocale: PaywallLocalization;\n}) {\n const prices = plan.pricePoints?.filter((price) => price.billingPeriod === billingPeriod) || [];\n const unitBasedEntitlements = prices\n .filter((price) => (price?.minUnitQuantity && price?.minUnitQuantity > 1) || price?.maxUnitQuantity)\n .map((price) => {\n return (\n <EntitlementRow\n key={`priceUnitEntitlement-${price?.feature?.displayName}`}\n feature={price?.feature ? { ...price.feature, id: price.feature.featureId } : null}\n minUnitQuantity={price?.minUnitQuantity}\n maxUnitQuantity={price?.maxUnitQuantity}\n />\n );\n });\n\n const visibleEntitlements = plan.entitlements\n .filter(({ isGranted }) => isGranted)\n .filter((entitlement) => !(entitlement.hiddenFromWidgets || []).includes(WidgetType.Paywall));\n\n const hasFeatures = unitBasedEntitlements.length > 0 || visibleEntitlements.length > 0;\n\n return (\n <PlanEntitlementsContainer className=\"stigg-plan-entitlements-container\">\n <Typography className=\"stigg-plan-entitlements-title\" color=\"secondary\" variant=\"h6\" bold>\n {getTitle(plan, paywallLocale, hasFeatures)}\n </Typography>\n {unitBasedEntitlements}\n {visibleEntitlements.map((entitlement) => (\n <EntitlementRow\n key={entitlement.feature?.id}\n displayNameOverride={entitlement.displayNameOverride}\n feature={entitlement.feature}\n resetPeriod={entitlement.resetPeriod}\n hasUnlimitedUsage={entitlement.hasUnlimitedUsage}\n usageLimit={entitlement.usageLimit}\n enumValues={entitlement.enumValues}\n isCustom={entitlement.isCustom}\n />\n ))}\n </PlanEntitlementsContainer>\n );\n}\n","import Color from 'color';\nimport merge from 'lodash/merge';\nimport { HorizontalAlignment, StiggTheme } from './types';\nimport { CustomizedTheme } from './Theme';\n\nexport const flexLayoutMapper = (horizontalAlignment: HorizontalAlignment) => {\n return {\n left: 'flex-start',\n center: 'center',\n right: 'flex-end',\n }[horizontalAlignment];\n};\n\nexport const getResolvedTheme = (customizedTheme?: CustomizedTheme): StiggTheme => {\n const primaryColor = Color(customizedTheme?.palette?.primary || '#327EEE');\n const textColor = Color(customizedTheme?.palette?.text?.primary || '#001E6C');\n const successColor = Color('#4CAF50');\n const errorColor = Color('#f44336');\n\n const baseTheme: StiggTheme = {\n palette: {\n primary: primaryColor.hex(),\n primaryDark: primaryColor.darken(0.3).hex(),\n primaryLight: primaryColor.alpha(0.5).toString(),\n backgroundPaper: '#FFFFFF',\n backgroundHighlight: '#F5F6F9',\n backgroundSection: primaryColor.alpha(0.1).toString(),\n backgroundButton: primaryColor.alpha(0.08).toString(),\n outlinedBorder: '#C4CBDD',\n outlinedRestingBorder: primaryColor.alpha(0.5).toString(),\n outlinedHoverBackground: primaryColor.lightness(95).hex(),\n switchBorder: primaryColor.lighten(0.1).hex(),\n switchFill: primaryColor.lighten(0.5).hex(),\n switchHandle: primaryColor.hex(),\n warning: '#ed6c02',\n error: errorColor.hex(),\n errorDark: errorColor.darken(0.3).hex(),\n success: successColor.hex(),\n successDark: successColor.darken(0.3).hex(),\n white: '#FFFFFF',\n text: {\n primary: textColor.hex(),\n secondary: textColor.alpha(0.75).toString(),\n tertiary: textColor.alpha(0.5).toString(),\n disabled: textColor.alpha(0.35).toString(),\n },\n },\n layout: {\n planMinWidth: '330px',\n planMaxWidth: '330px',\n planMargin: '20px',\n planPadding: '40px',\n ctaAlignment: 'left',\n headerAlignment: 'left',\n descriptionAlignment: 'left',\n descriptionMinHeight: '80px',\n switchBottomSpacing: '40px',\n },\n shadows: {\n light: '0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px rgba(0, 0, 0, 0.14), 0px 1px 3px rgba(0, 0, 0, 0.12)',\n popover:\n '0px 4px 5px -2px rgba(0, 30, 108, 0.2), 0px 7px 10px 1px rgba(0, 30, 108, 0.14), 0px 2px 16px 1px rgba(0, 30, 108, 0.12)',\n },\n border: {\n radius: '10px',\n },\n typography: {\n fontFamily: 'custom-font, DM Sans, sans-serif',\n h1: {\n fontSize: '32px',\n fontWeight: 'bold',\n },\n h2: {\n fontSize: '24px',\n fontWeight: 'normal',\n },\n h3: {\n fontSize: '16px',\n fontWeight: 'normal',\n },\n body: {\n fontSize: '14px',\n fontWeight: 'normal',\n },\n caption: {\n fontSize: '12px',\n fontWeight: 'normal',\n },\n },\n customCss: '',\n };\n\n return merge(baseTheme, customizedTheme);\n};\n","import { BillingModel, TiersMode, BillingPeriod, Price, PriceTierFragment, Subscription } from '@stigg/js-client-sdk';\nimport isNil from 'lodash/isNil';\nimport { sum } from 'lodash';\nimport { PaywallPlan } from '../paywall';\nimport { CurrentSubscriptionOverride, SelectDefaultTierIndexFn } from '../paywall/types';\n\nexport function getPriceFeatureUnit(price: Price) {\n if (!price.feature) {\n return '';\n }\n\n return (price.feature.unitQuantity !== 1 ? price.feature.unitsPlural : price.feature.units) || '';\n}\n\nexport function getTierByQuantity(tiers: PriceTierFragment[], quantity: number): PriceTierFragment {\n const ascendingTiers = [...tiers];\n // Sort tiers by upTo value, ascending, if upTo is not set,\n // put it at the end as it represent the last infinity tier\n ascendingTiers.sort((a, b) => (!a.upTo ? 1 : !b.upTo ? -1 : a.upTo - b.upTo));\n\n for (const tier of ascendingTiers) {\n if (tier.upTo && quantity <= tier.upTo) {\n return tier;\n }\n }\n\n return ascendingTiers[ascendingTiers.length - 1];\n}\n\nfunction getAmount(amount: number, selectedBillingPeriod?: BillingPeriod, shouldShowMonthlyPriceAmount?: boolean) {\n return selectedBillingPeriod === BillingPeriod.Annually && shouldShowMonthlyPriceAmount ? amount / 12 : amount;\n}\n\nfunction calculateTierPriceVolume(\n currentTier: PriceTierFragment,\n perUnitQuantity: number,\n selectedBillingPeriod?: BillingPeriod,\n shouldShowMonthlyPriceAmount?: boolean,\n): number {\n let amount = 0;\n\n if (currentTier.unitPrice) {\n const unitPrice = getAmount(currentTier.unitPrice.amount, selectedBillingPeriod, shouldShowMonthlyPriceAmount);\n amount += unitPrice * perUnitQuantity;\n }\n\n if (currentTier.flatPrice) {\n amount += getAmount(currentTier.flatPrice.amount, selectedBillingPeriod, shouldShowMonthlyPriceAmount);\n }\n\n return amount;\n}\n\nexport function calculateTierPriceGraduated(\n tiers: PriceTierFragment[],\n unitQuantity: number,\n selectedBillingPeriod?: BillingPeriod,\n shouldShowMonthlyPriceAmount?: boolean,\n): { total: number; breakdown: Array<{ unitQuantity: number; amount: number }> } {\n let remainingQuantity = unitQuantity;\n let prevUpTo = 0;\n let currentTierIndex = 0;\n\n const breakdown: Array<{ unitQuantity: number; amount: number }> = [];\n\n while (remainingQuantity > 0 && currentTierIndex < tiers.length) {\n const tier = tiers[currentTierIndex];\n const { upTo } = tier;\n\n if (isNil(upTo)) {\n breakdown.push({\n unitQuantity: remainingQuantity,\n amount: calculateTierPriceVolume(tier, remainingQuantity, selectedBillingPeriod, shouldShowMonthlyPriceAmount),\n });\n remainingQuantity = 0;\n } else {\n const unitsInTier = upTo - prevUpTo;\n const consumed = Math.min(remainingQuantity, unitsInTier);\n breakdown.push({\n unitQuantity: consumed,\n amount: calculateTierPriceVolume(tier, consumed, selectedBillingPeriod, shouldShowMonthlyPriceAmount),\n });\n remainingQuantity -= consumed;\n prevUpTo = upTo;\n }\n\n currentTierIndex += 1;\n }\n\n const total = sum(breakdown.map(({ amount }) => amount));\n\n return {\n breakdown,\n total,\n };\n}\n\nexport function calculateTierPrice(\n price: Pick<Price, 'tiers' | 'tiersMode'>,\n unitQuantity: number,\n selectedBillingPeriod?: BillingPeriod,\n shouldShowMonthlyPriceAmount?: boolean,\n): number {\n if (!price.tiers) {\n return 0;\n }\n\n switch (price.tiersMode) {\n case TiersMode.Volume: {\n const currentTier = getTierByQuantity(price.tiers, unitQuantity);\n return calculateTierPriceVolume(currentTier, unitQuantity, selectedBillingPeriod, shouldShowMonthlyPriceAmount);\n }\n case TiersMode.Graduated: {\n return calculateTierPriceGraduated(price.tiers, unitQuantity, selectedBillingPeriod, shouldShowMonthlyPriceAmount)\n .total;\n }\n default:\n return 0;\n }\n}\n\nexport function hasTierWithUnitPrice(tiers: PriceTierFragment[] | null | undefined) {\n return tiers?.some(({ unitPrice, upTo }) => unitPrice && !isNil(upTo));\n}\n\nexport function isBulkTiers(tiers: PriceTierFragment[] | null | undefined) {\n return tiers?.every(({ unitPrice, upTo }) => !unitPrice || isNil(upTo));\n}\n\nexport function isQuantityInFirstTier(tiers: PriceTierFragment[] | null | undefined, quantity: number) {\n return tiers?.[0].upTo && quantity <= tiers[0].upTo;\n}\n\nexport function getTiersPerUnitQuantities({\n plan,\n billingPeriod,\n currentSubscription,\n currentSubscriptionOverride,\n selectDefaultTierIndex,\n}: {\n plan: PaywallPlan;\n billingPeriod: BillingPeriod;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n selectDefaultTierIndex?: SelectDefaultTierIndexFn;\n}): Record<string, number> {\n const planTierPrices = plan.pricePoints.filter(\n (price) => price.billingPeriod === billingPeriod && price.isTieredPrice,\n );\n\n if (planTierPrices.length === 1) {\n const [price] = planTierPrices;\n const { featureId } = price.feature!;\n const selectedDefaultTierIndex = selectDefaultTierIndex ? selectDefaultTierIndex({ plan }) : 0;\n const currentTier = price.tiers![selectedDefaultTierIndex];\n let quantity = hasTierWithUnitPrice(price.tiers) ? 1 : currentTier.upTo || 1;\n\n if (currentSubscription && currentSubscription.plan.id === plan.id) {\n const tieredPrice = currentSubscription.prices.find(\n (subscriptionPrice) =>\n subscriptionPrice.pricingModel === BillingModel.PerUnit &&\n subscriptionPrice.tiersMode &&\n subscriptionPrice.feature?.featureId === featureId,\n );\n\n if (tieredPrice) {\n quantity = tieredPrice.feature!.unitQuantity || 1;\n }\n }\n\n if (currentSubscriptionOverride?.planId === plan.id) {\n const billableFeature = currentSubscriptionOverride.billableFeatures.find(\n (billableFeature) => billableFeature.featureId === featureId,\n );\n if (billableFeature) {\n quantity = billableFeature.quantity;\n }\n }\n\n const result: Record<string, number> = {};\n result[featureId] = quantity;\n\n return result;\n }\n\n return {};\n}\n\nexport enum PriceTierComparison {\n Lower = -1,\n Equal = 0,\n Higher = 1,\n}\n\nexport function compareSelectedTierToCurrentTier({\n perUnitQuantityByFeature,\n plan,\n currentSubscription,\n currentSubscriptionOverride,\n}: {\n perUnitQuantityByFeature: Record<string, number>;\n plan: PaywallPlan;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n}): PriceTierComparison {\n if (!currentSubscription) {\n return PriceTierComparison.Equal;\n }\n\n let currentTierPrice = currentSubscription.prices.find(\n (price) => price.pricingModel === BillingModel.PerUnit && price.tiersMode,\n );\n\n const isCurrentPlanOverride = plan.id === currentSubscriptionOverride?.planId;\n if (isCurrentPlanOverride) {\n currentTierPrice =\n plan.pricePoints.find((price) => price.pricingModel === BillingModel.PerUnit && price.tiersMode) ??\n currentTierPrice;\n }\n\n if (!currentTierPrice) {\n return PriceTierComparison.Equal;\n }\n\n const { featureId, unitQuantity } = currentTierPrice.feature!;\n let oldQuantity = unitQuantity;\n\n if (isCurrentPlanOverride) {\n const billableFeature = currentSubscriptionOverride?.billableFeatures?.find(\n (billableFeature) => billableFeature.featureId === featureId,\n );\n if (billableFeature) {\n oldQuantity = billableFeature.quantity;\n }\n }\n\n if (isNil(oldQuantity)) {\n return PriceTierComparison.Equal;\n }\n\n const newQuantity = perUnitQuantityByFeature[featureId];\n\n if (newQuantity < oldQuantity) {\n return PriceTierComparison.Lower;\n }\n if (newQuantity > oldQuantity) {\n return PriceTierComparison.Higher;\n }\n return PriceTierComparison.Equal;\n}\n","import React from 'react';\nimport moment from 'moment';\nimport isNil from 'lodash/isNil';\nimport {\n CustomerPortalSubscription,\n CustomerPortalSubscriptionScheduledUpdateDataFragment,\n SubscriptionScheduleType,\n} from '@stigg/js-client-sdk';\nimport { CustomerPortalSubscriptionPriceFragment } from '@stigg/api-client-js/src/generated/sdk';\nimport { compact, map } from 'lodash';\nimport { BillingPeriodChangeVariables, UnitAmountChangeVariables } from '../../types';\n\nconst formatDate = (date: string) => moment.utc(date).format('MMMM Do, yyyy');\n\ntype GetSubscriptionScheduleUpdateTextsProps = {\n scheduledUpdate: CustomerPortalSubscriptionScheduledUpdateDataFragment | undefined;\n subscriptionPrices?: CustomerPortalSubscriptionPriceFragment[];\n billingPeriodRange?: CustomerPortalSubscription['billingPeriodRange'];\n options?: { withDate?: boolean; postfix?: string };\n};\n\nexport function getSubscriptionScheduleUpdateTexts({\n scheduledUpdate,\n subscriptionPrices,\n billingPeriodRange,\n options = {},\n}: GetSubscriptionScheduleUpdateTextsProps) {\n if (!scheduledUpdate) {\n return {};\n }\n const { withDate, postfix = '' } = options;\n\n switch (scheduledUpdate.subscriptionScheduleType) {\n case SubscriptionScheduleType.Downgrade: {\n let shouldShowDate = withDate;\n if (isNil(shouldShowDate) && billingPeriodRange?.end) {\n shouldShowDate = !moment(scheduledUpdate.scheduledExecutionTime).isSame(billingPeriodRange?.end, 'day');\n }\n\n const line1 = (\n <>\n Your subscription will be downgraded to the <b>{scheduledUpdate.targetPackage?.displayName} plan</b>{' '}\n {shouldShowDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime)}</> : postfix}.\n </>\n );\n const line2 = `Until then you still have access to your current plan.`;\n\n return { line1, line2 };\n }\n\n case SubscriptionScheduleType.BillingPeriod: {\n const variables = scheduledUpdate.scheduleVariables as BillingPeriodChangeVariables;\n const line1 = (\n <>\n Your billing cycle will change to <b>{variables.billingPeriod?.toLocaleLowerCase()}</b>{' '}\n {withDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime)}</> : postfix}.\n </>\n );\n\n return { line1 };\n }\n\n case SubscriptionScheduleType.UnitAmount: {\n const variables = scheduledUpdate.scheduleVariables as UnitAmountChangeVariables;\n const feature = compact(map(subscriptionPrices, 'feature')).find(({ id }) => id === variables.featureId);\n const { featureUnits, featureUnitsPlural } = feature || {};\n const unitsText = variables.newUnitAmount === 1 ? featureUnits : featureUnitsPlural;\n\n const line1 = (\n <>\n Your subscription will be updated to <b>{variables.newUnitAmount}</b> {unitsText}{' '}\n {withDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime)}</> : postfix}.\n </>\n );\n\n const line2 = `Until then you still have access to your current ${featureUnits} count.`;\n\n return { line1, line2 };\n }\n\n default: {\n return {};\n }\n }\n}\n","import React, { useState } from 'react';\nimport { BillingPeriod, Customer, PricingType, Subscription } from '@stigg/js-client-sdk';\nimport { isFunction } from 'lodash';\nimport ClipLoader from 'react-spinners/ClipLoader';\nimport styled from '@emotion/styled/macro';\nimport { css, useTheme } from '@emotion/react';\nimport { CurrentSubscriptionOverride, PaywallPlan, SubscribeIntentionType } from './types';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { flexLayoutMapper } from '../../theme/getResolvedTheme';\nimport { Typography } from '../common/Typography';\nimport { getSubscriptionScheduleUpdateTexts } from '../utils/getSubscriptionScheduleUpdateTexts';\nimport { compareSelectedTierToCurrentTier, PriceTierComparison } from '../utils/priceTierUtils';\n\nconst LoadingIndicator = styled(ClipLoader)`\n margin-left: 10px;\n`;\n\nconst OfferingButton = styled.button<{ $disabled?: boolean }>`\n cursor: ${({ $disabled }) => ($disabled ? 'default' : 'pointer')};\n padding: 8px 12px;\n background-color: ${({ theme }) => theme.stigg.palette.backgroundButton};\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedRestingBorder}`};\n border-radius: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 42px;\n min-width: 120px;\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n opacity: 0.5;\n `}\n\n &:hover {\n background-color: ${({ theme, $disabled }) =>\n $disabled ? theme.stigg.palette.backgroundButton : theme.stigg.palette.outlinedHoverBackground};\n }\n`;\n\nconst ButtonText = styled(Typography)`\n margin: 0;\n font-size: 15px;\n`;\n\nconst ScheduledUpdateText = styled(Typography)`\n min-height: 87px;\n`;\n\nconst CancelScheduledUpdateButton = styled.button<{ $disabled?: boolean }>`\n background: none;\n border: none;\n padding: 0;\n color: ${({ theme }) => theme.stigg.palette.text.secondary};\n\n text-decoration: underline;\n cursor: pointer;\n`;\n\nconst TrialDaysLeft = styled(Typography)`\n margin-top: 8px;\n margin-bottom: 17px;\n min-height: 20px;\n`;\n\nconst ButtonLayout = styled.div`\n display: flex;\n flex-direction: column;\n margin-top: 4px;\n align-self: ${({ theme }) => flexLayoutMapper(theme.stigg.layout.ctaAlignment)};\n width: 100%;\n`;\n\ntype PlanOfferingButtonProps = {\n isNextPlan?: boolean;\n customer: Customer | null;\n plan: PaywallPlan;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n billingPeriod: BillingPeriod;\n isCustomerOnTrial: boolean;\n paywallLocale: PaywallLocalization;\n onPlanSelected: (intentionType: SubscribeIntentionType) => void | Promise<void>;\n withTrialLeftRow: boolean;\n perUnitQuantityByFeature: Record<string, number>;\n};\n\nexport function PlanOfferingButton({\n isNextPlan,\n customer,\n plan,\n billingPeriod,\n isCustomerOnTrial,\n onPlanSelected,\n paywallLocale,\n withTrialLeftRow,\n currentSubscription,\n currentSubscriptionOverride,\n perUnitQuantityByFeature,\n}: PlanOfferingButtonProps) {\n const theme = useTheme();\n const [isLoading, setIsLoading] = useState(false);\n const {\n currentPlan,\n custom,\n downgrade,\n startTrial,\n upgrade,\n startNew,\n switchToBillingPeriod,\n cancelScheduledUpdate,\n } = paywallLocale.planCTAButton;\n const resolvedDowngrade = isFunction(downgrade) ? downgrade(plan) : downgrade;\n const resolvedUpgrade = isFunction(upgrade) ? upgrade(plan) : upgrade;\n\n const buttonProps: {\n title: string;\n disabled: boolean;\n intentionType: SubscribeIntentionType;\n } = {\n title: customer ? (plan.isLowerThanCurrentPlan ? resolvedDowngrade : resolvedUpgrade) : startNew,\n disabled: false,\n intentionType: plan.isLowerThanCurrentPlan\n ? SubscribeIntentionType.DOWNGRADE_PLAN\n : isCustomerOnTrial\n ? SubscribeIntentionType.UPGRADE_TRIAL_TO_PAID\n : SubscribeIntentionType.UPGRADE_PLAN,\n };\n const isCustomPrice = plan.pricingType === PricingType.Custom;\n\n const { line1: scheduledUpdateText } = getSubscriptionScheduleUpdateTexts({\n scheduledUpdate: plan.scheduledUpdate,\n options: { withDate: true },\n });\n\n if (plan.isTriable && !plan.isCurrentCustomerPlan && !isCustomerOnTrial) {\n buttonProps.title = startTrial(plan);\n buttonProps.intentionType = SubscribeIntentionType.START_TRIAL;\n } else if (plan.isCurrentCustomerPlan && !isCustomerOnTrial) {\n const isSameBillingPeriod = billingPeriod === plan.currentCustomerPlanBillingPeriod;\n\n if (\n isSameBillingPeriod ||\n (plan.pricingType && [PricingType.Free, PricingType.Custom].includes(plan.pricingType))\n ) {\n const planComparison = compareSelectedTierToCurrentTier({\n perUnitQuantityByFeature,\n plan,\n currentSubscription,\n currentSubscriptionOverride,\n });\n switch (planComparison) {\n case PriceTierComparison.Lower:\n buttonProps.intentionType = SubscribeIntentionType.CHANGE_UNIT_QUANTITY;\n buttonProps.title = resolvedDowngrade;\n break;\n case PriceTierComparison.Higher:\n buttonProps.intentionType = SubscribeIntentionType.CHANGE_UNIT_QUANTITY;\n buttonProps.title = resolvedUpgrade;\n break;\n\n default:\n buttonProps.title = currentPlan;\n buttonProps.disabled = true;\n break;\n }\n } else {\n buttonProps.title = switchToBillingPeriod(billingPeriod);\n buttonProps.intentionType = SubscribeIntentionType.CHANGE_BILLING_PERIOD;\n }\n } else if (isCustomPrice) {\n buttonProps.title = typeof custom === 'function' ? custom({ plan, selectedBillingPeriod: billingPeriod }) : custom;\n buttonProps.intentionType = SubscribeIntentionType.REQUEST_CUSTOM_PLAN_ACCESS;\n }\n\n if (isNextPlan && plan.scheduledUpdate) {\n buttonProps.disabled = false;\n buttonProps.title = cancelScheduledUpdate;\n buttonProps.intentionType = SubscribeIntentionType.CANCEL_SCHEDULED_UPDATES;\n }\n\n const isDisabled = isLoading || buttonProps.disabled;\n return (\n <>\n <ButtonLayout className=\"stigg-paywall-plan-button-layout\">\n {isNextPlan && scheduledUpdateText ? (\n <ScheduledUpdateText color=\"secondary\" variant=\"body1\" className=\"stigg-paywall-schedule-update-text\">\n {scheduledUpdateText}{' '}\n <CancelScheduledUpdateButton\n color=\"secondary\"\n onClick={() => {\n setIsLoading(true);\n Promise.resolve(onPlanSelected(buttonProps.intentionType)).finally(() => setIsLoading(false));\n }}>\n {buttonProps.title}\n </CancelScheduledUpdateButton>\n </ScheduledUpdateText>\n ) : (\n <>\n <OfferingButton\n className=\"stigg-paywall-plan-button\"\n data-testid={`paywall-card-cta-${plan.displayName}`}\n disabled={isDisabled}\n $disabled={isDisabled}\n onClick={() => {\n setIsLoading(true);\n Promise.resolve(onPlanSelected(buttonProps.intentionType)).finally(() => setIsLoading(false));\n }}>\n <ButtonText className=\"stigg-paywall-plan-button-text\" variant=\"h6\" color=\"primary.main\">\n {buttonProps.title}\n </ButtonText>\n {isLoading && <LoadingIndicator color={theme.stigg.palette.text.disabled} loading size={16} />}\n </OfferingButton>\n\n {!withTrialLeftRow ? (\n <div style={{ height: '20px' }} />\n ) : (\n <TrialDaysLeft className=\"stigg-trial-days-left-text\" variant=\"h6\" color=\"secondary\">\n {plan.isCurrentCustomerPlan && plan.trialDaysLeft && (\n <>\n <b>{plan.trialDaysLeft} days</b> left on your free trial\n </>\n )}\n </TrialDaysLeft>\n )}\n </>\n )}\n </ButtonLayout>\n </>\n );\n}\n","import { Currency } from '@stigg/js-client-sdk';\nimport getSymbolFromCurrency from 'currency-symbol-map';\n\nexport const currencyPriceFormatter = ({\n amount,\n currency = Currency.Usd,\n locale,\n maximumFractionDigits = 5,\n minimumFractionDigits = 0,\n removeTrailingZero,\n}: {\n amount: number;\n currency?: Currency | string;\n locale?: string;\n maximumFractionDigits?: number;\n minimumFractionDigits?: number;\n removeTrailingZero?: boolean;\n}) => {\n const currencyString = currency.toString();\n const currencySymbol = getSymbolFromCurrency(currencyString);\n let formattedPrice = new Intl.NumberFormat(locale, {\n maximumFractionDigits,\n minimumFractionDigits,\n style: 'currency',\n currency: currencyString,\n trailingZeroDisplay: removeTrailingZero ? 'stripIfInteger' : 'auto',\n ...(currencySymbol ? { currencyDisplay: 'code' } : {}),\n } as Intl.NumberFormatOptions).format(amount || 0);\n\n if (currencySymbol) {\n formattedPrice = formattedPrice.replace(currencyString, currencySymbol);\n }\n\n // remove space between currency symbol and price\n formattedPrice = formattedPrice.replace(/\\s/g, '');\n\n return formattedPrice;\n};\n","export function numberFormatter(number: number, { locale }: { locale?: string } = {}) {\n return new Intl.NumberFormat(locale).format(number);\n}\n","import { BillingPeriod, PriceTierFragment, PricingType } from '@stigg/js-client-sdk';\nimport { getPaidPriceText } from './getPaidPriceText';\nimport { PaywallPlan, PaywallLocalization } from '../paywall';\n\nexport type PlanPriceText = {\n price: string;\n unit?: string;\n tiers?: PriceTierFragment[] | null | undefined;\n tierUnits?: string;\n};\n\nexport function getPlanPrice(\n plan: PaywallPlan,\n billingPeriod: BillingPeriod,\n paywallLocale: PaywallLocalization,\n locale: string,\n shouldShowMonthlyPriceAmount: boolean,\n perUnitQuantityByFeature?: Record<string, number>,\n): PlanPriceText {\n switch (plan.pricingType) {\n case PricingType.Free:\n if (typeof paywallLocale.price.free === 'function') {\n return paywallLocale.price.free(plan.paywallCurrency);\n }\n\n return paywallLocale.price.free;\n case PricingType.Custom:\n return {\n price:\n typeof paywallLocale.price.custom === 'function'\n ? paywallLocale.price.custom({ plan, selectedBillingPeriod: billingPeriod })\n : paywallLocale.price.custom,\n };\n case PricingType.Paid: {\n const planPrices = plan.pricePoints.filter((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n const paywallCalculatedPrice = plan.paywallCalculatedPricePoints?.find(\n (pricePoint) => pricePoint.billingPeriod === billingPeriod,\n );\n\n if (!planPrices?.length && !paywallCalculatedPrice) {\n return {\n price: paywallLocale.price.priceNotSet,\n };\n }\n\n const paidParams = {\n planPrices,\n paywallCalculatedPrice,\n selectedBillingPeriod: billingPeriod,\n perUnitQuantityByFeature: perUnitQuantityByFeature || {},\n };\n\n return paywallLocale.price.paid\n ? paywallLocale.price.paid({ ...paidParams, plan })\n : getPaidPriceText({ ...paidParams, locale, shouldShowMonthlyPriceAmount, paywallLocale });\n }\n default:\n return {\n price: '',\n };\n }\n}\n","import { BillingModel, BillingPeriod, PaywallCalculatedPricePoint, Price } from '@stigg/js-client-sdk';\nimport { currencyPriceFormatter } from './currencyUtils';\nimport { PlanPriceText } from './getPlanPrice';\nimport { calculateTierPrice, getPriceFeatureUnit } from './priceTierUtils';\nimport { PaywallLocalization } from '../paywall';\nimport { numberFormatter } from './numberUtils';\n\ntype GetPaidPriceTextParams = {\n planPrices: Price[];\n paywallCalculatedPrice?: PaywallCalculatedPricePoint;\n selectedBillingPeriod: BillingPeriod;\n locale: string;\n shouldShowMonthlyPriceAmount: boolean;\n paywallLocale: PaywallLocalization;\n perUnitQuantityByFeature?: Record<string, number>;\n};\n\nexport function getPaidPriceText({\n planPrices,\n paywallCalculatedPrice,\n selectedBillingPeriod,\n locale,\n shouldShowMonthlyPriceAmount,\n paywallLocale,\n perUnitQuantityByFeature,\n}: GetPaidPriceTextParams): PlanPriceText {\n const { amount, currency } = paywallCalculatedPrice || planPrices[0];\n const priceAmount = amount || 0;\n\n const isSinglePrice = planPrices.length === 1;\n let priceNumber =\n selectedBillingPeriod === BillingPeriod.Annually && shouldShowMonthlyPriceAmount ? priceAmount / 12 : priceAmount;\n\n let tiers;\n let tierUnits;\n const pricePeriod = paywallLocale.price.pricePeriod(\n shouldShowMonthlyPriceAmount ? BillingPeriod.Monthly : BillingPeriod.Annually,\n );\n let unit = pricePeriod;\n\n for (const price of planPrices) {\n if (price.isTieredPrice && price.tiers) {\n const quantity = perUnitQuantityByFeature?.[price.feature!.featureId] || 1;\n tiers = price.tiers;\n tierUnits = getPriceFeatureUnit(price);\n\n priceNumber += calculateTierPrice(price, quantity, selectedBillingPeriod, shouldShowMonthlyPriceAmount);\n }\n }\n\n if (isSinglePrice) {\n const price = planPrices[0];\n const formattedUnits =\n price.blockSize && price.blockSize > 1\n ? `for ${numberFormatter(price.blockSize)} ${price.feature?.unitsPlural || price.feature?.units || ''}`\n : `per ${price.feature?.units || ''}`;\n\n if (price.pricingModel === BillingModel.PerUnit && !price.isTieredPrice) {\n unit = `${formattedUnits} ${pricePeriod}`;\n } else if (price.pricingModel === BillingModel.UsageBased) {\n unit = `${formattedUnits}`;\n }\n }\n\n return {\n price: currencyPriceFormatter({\n amount: priceNumber,\n currency,\n locale,\n minimumFractionDigits: 2,\n removeTrailingZero: true,\n }),\n unit,\n tiers,\n tierUnits,\n };\n}\n","import React from 'react';\n\nimport styled from '@emotion/styled/macro';\nimport MuiButton, { ButtonProps } from '@mui/material/Button';\n\nexport type StyledButtonProps = { $success?: boolean; $error?: boolean };\n\nconst StyledButton = styled(MuiButton, { shouldForwardProp: (prop) => !prop.startsWith('$') })<StyledButtonProps>`\n border-radius: 10px;\n text-transform: none;\n\n background-color: ${({ theme, $success, $error }) => {\n if ($success) {\n return theme.stigg.palette.success;\n }\n if ($error) {\n return theme.stigg.palette.error;\n }\n return '';\n }};\n\n &:hover {\n background-color: ${({ theme, $success, $error }) => {\n if ($success) {\n return theme.stigg.palette.successDark;\n }\n if ($error) {\n return theme.stigg.palette.errorDark;\n }\n return '';\n }};\n }\n`;\n\nexport const Button = ({ variant = 'outlined', ...props }: ButtonProps & StyledButtonProps) => {\n return <StyledButton variant={variant} {...props} />;\n};\n","import styled from '@emotion/styled';\nimport { OutlinedInputProps } from '@mui/material/OutlinedInput';\nimport TextField from '@mui/material/TextField';\n\nexport const InputField = styled(TextField)<OutlinedInputProps>(({ theme }) => ({\n '& .MuiOutlinedInput-root': {\n height: '42px',\n borderRadius: theme.stigg.border.radius,\n fieldset: {\n borderColor: theme.stigg.palette.outlinedBorder,\n },\n '&:not(.Mui-focused):hover fieldset': {\n borderColor: theme.stigg.palette.outlinedRestingBorder,\n },\n },\n '& .MuiInputBase-input': {\n padding: '8px 12px',\n borderRadius: theme.stigg.border.radius,\n fontFamily: theme.stigg.typography.fontFamily,\n color: theme.stigg.palette.text.primary,\n ...theme.stigg.typography.body,\n },\n '& .Mui-error': {\n fontFamily: theme.stigg.typography.fontFamily,\n },\n}));\n","import styled from '@emotion/styled/macro';\nimport Grid from '@mui/material/Grid';\nimport ReactSkeleton from 'react-loading-skeleton';\n\nexport const SkeletonsContainer = styled(Grid, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{\n $gap: number;\n $flexDirection?: 'row' | 'column';\n}>`\n display: flex;\n flex-direction: ${({ $flexDirection }) => $flexDirection || 'row'};\n gap: ${({ $gap }) => $gap}px;\n`;\n\nexport const FlexedSkeletonContainer = styled(SkeletonsContainer)`\n span {\n display: flex;\n flex: 1;\n }\n`;\n\nexport const FlexedSkeleton = styled(Grid)<{ flex: number }>`\n span {\n display: flex;\n flex: ${({ flex }) => flex};\n }\n`;\n\nexport const Skeleton = styled(ReactSkeleton)`\n border-radius: 4px;\n`;\n","import React from 'react';\nimport Divider from '@mui/material/Divider';\nimport Grid from '@mui/material/Grid';\nimport styled from '@emotion/styled/macro';\nimport { FlexedSkeleton, FlexedSkeletonContainer, Skeleton, SkeletonsContainer } from './Skeletons.style';\n\nconst ContentContainer = styled(Grid)`\n display: flex;\n flex-direction: column;\n`;\n\nexport function ContentLoadingSkeleton() {\n return (\n <ContentContainer container>\n <SkeletonsContainer item $gap={48}>\n <Skeleton width={120} height={20} />\n <Skeleton width={120} height={20} />\n </SkeletonsContainer>\n\n <Divider className=\"stigg-checkout-plan-header-divider\" sx={{ marginY: 2 }} />\n\n <ContentContainer item>\n <Skeleton width={120} height={20} />\n\n <FlexedSkeletonContainer $gap={16} marginTop={3}>\n <Skeleton height={20} />\n <Skeleton height={20} />\n </FlexedSkeletonContainer>\n\n <SkeletonsContainer $gap={130} marginTop={3}>\n <FlexedSkeleton flex={1}>\n <Skeleton height={20} />\n </FlexedSkeleton>\n\n <FlexedSkeleton flex={3}>\n <Skeleton height={20} />\n </FlexedSkeleton>\n </SkeletonsContainer>\n </ContentContainer>\n </ContentContainer>\n );\n}\n","import React from 'react';\n\nexport const ON_WHEEL_BLUR = (e: React.WheelEvent<HTMLInputElement>) => (e.target as HTMLElement).blur();\n","import InputAdornment from '@mui/material/InputAdornment';\nimport React from 'react';\nimport { Typography } from './Typography';\nimport { InputField } from '../checkout/components';\nimport { TiersSelectContainerProps } from './TiersSelectContainer';\nimport { ON_WHEEL_BLUR } from '../utils/onWheelBlur';\n\nexport function VolumePerUnitInput({\n width,\n tierUnits,\n value,\n handleChange,\n}: Pick<TiersSelectContainerProps, 'width' | 'tierUnits' | 'value'> & {\n handleChange: (quantity: number) => void;\n}) {\n return (\n <InputField\n type=\"number\"\n onWheel={ON_WHEEL_BLUR}\n fullWidth\n sx={{ minHeight: '46px', width }}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <Typography variant=\"body1\" color=\"primary\">\n {tierUnits}\n </Typography>\n </InputAdornment>\n ),\n }}\n value={value}\n onChange={(event) => {\n const quantity = event?.target?.value ? Number(event?.target?.value) : null;\n if (quantity) {\n handleChange(quantity);\n }\n }}\n />\n );\n}\n","import { PriceTierFragment } from '@stigg/js-client-sdk';\nimport styled from '@emotion/styled/macro';\nimport OutlinedInput from '@mui/material/OutlinedInput';\nimport Select from '@mui/material/Select';\nimport MenuItem from '@mui/material/MenuItem';\nimport { map } from 'lodash';\nimport React from 'react';\nimport { Typography } from './Typography';\nimport { TiersSelectContainerProps } from './TiersSelectContainer';\nimport { formatNumber } from '../utils/formatNumber';\n\nconst TierSelect = styled(Select)`\n border-radius: 10px;\n min-height: 42px;\n min-width: 120px;\n\n &:hover .MuiOutlinedInput-notchedOutline {\n border-color: ${({ theme }) => theme.stigg.palette.outlinedBorder};\n }\n`;\n\nconst TierInput = styled(OutlinedInput)`\n & .MuiInputBase-input {\n padding: 10px 12px;\n }\n\n &.Mui-focused .MuiOutlinedInput-notchedOutline {\n border-color: ${({ theme }) => theme.stigg.palette.primary} !important;\n }\n`;\n\nexport function VolumeBulkSelect({\n value,\n componentId,\n tierUnits,\n tiers,\n handleChange,\n}: Pick<TiersSelectContainerProps, 'value' | 'componentId' | 'tiers' | 'tierUnits'> & {\n handleChange: (quantity: number) => void;\n}) {\n if (!tiers) {\n return null;\n }\n\n return (\n <TierSelect\n value={value.toString()}\n fullWidth\n onChange={(event) => {\n const quantity = event?.target?.value ? Number(event?.target?.value) : null;\n if (quantity) {\n handleChange(quantity);\n }\n }}\n id={componentId}\n input={<TierInput />}\n MenuProps={{\n MenuListProps: { disablePadding: true },\n PaperProps: {\n sx: { marginTop: '4px', borderRadius: '10px' },\n },\n }}>\n {map(tiers, (tier: PriceTierFragment) => (\n <MenuItem className=\"stigg-price-tier-menu-item-text\" key={tier.upTo} value={tier.upTo?.toString()}>\n <Typography variant=\"body1\" color=\"primary\" style={{ lineHeight: 'unset' }}>\n {formatNumber(tier.upTo)} {tierUnits}\n </Typography>\n </MenuItem>\n ))}\n </TierSelect>\n );\n}\n","import { PriceTierFragment, TiersMode } from '@stigg/js-client-sdk';\nimport React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { hasTierWithUnitPrice } from '../utils/priceTierUtils';\nimport { Typography } from './Typography';\nimport { VolumePerUnitInput } from './VolumePerUnitInput';\nimport { VolumeBulkSelect } from './VolumeBulkSelect';\n\nexport type TiersSelectContainerProps = {\n componentId: string;\n tiers?: PriceTierFragment[] | null;\n tierUnits?: string;\n tiersMode?: TiersMode | null;\n handleChange: (quantity: number) => void;\n value: number;\n width?: number;\n};\n\nconst TiersSelectLayout = styled(Typography)`\n min-height: 46px;\n`;\n\nexport function TiersSelectContainer(props: TiersSelectContainerProps) {\n const { tiers } = props;\n\n return (\n <TiersSelectLayout as=\"div\" className=\"stigg-price-tier-select\">\n {hasTierWithUnitPrice(tiers) ? <VolumePerUnitInput {...props} /> : <VolumeBulkSelect {...props} />}\n </TiersSelectLayout>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { BillingPeriod } from '@stigg/js-client-sdk';\nimport { PaywallPlan } from './types';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { getPlanPrice } from '../utils/getPlanPrice';\nimport { Typography } from '../common/Typography';\nimport { TiersSelectContainer } from '../common/TiersSelectContainer';\n\nconst EMPTY_CHAR = '‎';\n\nconst PlanPriceContainer = styled(Typography)`\n word-break: break-word;\n width: 100%;\n`;\n\nconst UnitSpan = styled(Typography)`\n white-space: nowrap;\n`;\n\nconst PriceSpan = styled(Typography)`\n white-space: normal;\n min-height: 39px;\n`;\n\ntype PriceBillingPeriodProps = {\n plan: PaywallPlan;\n billingPeriod: BillingPeriod;\n hasMonthlyPrice: boolean;\n hasAnnuallyPrice: boolean;\n paywallLocale: PaywallLocalization;\n};\n\nfunction PriceBillingPeriod({\n plan,\n billingPeriod,\n hasMonthlyPrice,\n hasAnnuallyPrice,\n paywallLocale,\n}: PriceBillingPeriodProps) {\n const hasPrice = plan.pricePoints.find((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n\n let content = EMPTY_CHAR;\n if (hasPrice && hasMonthlyPrice && hasAnnuallyPrice) {\n content = paywallLocale.price.billingPeriod?.(billingPeriod) || `, billed ${billingPeriod.toLowerCase()}`;\n }\n\n return (\n <Typography span className=\"stigg-price-billing-period-text\" variant=\"h6\" color=\"secondary\">\n {content}\n </Typography>\n );\n}\n\nexport const PlanPrice = ({\n showStartingAt,\n withUnitPriceRow,\n withStartingAtRow,\n withTiersRow,\n plan,\n billingPeriod,\n paywallLocale,\n locale,\n hasMonthlyPrice,\n hasAnnuallyPrice,\n perUnitQuantityByFeature,\n setPerUnitQuantityByFeature,\n}: {\n showStartingAt: boolean;\n withUnitPriceRow: boolean;\n withStartingAtRow: boolean;\n withTiersRow: boolean;\n perUnitQuantityByFeature: Record<string, number>;\n setPerUnitQuantityByFeature: React.Dispatch<React.SetStateAction<Record<string, number>>>;\n plan: PaywallPlan;\n billingPeriod: BillingPeriod;\n paywallLocale: PaywallLocalization;\n hasMonthlyPrice: boolean;\n hasAnnuallyPrice: boolean;\n locale: string;\n}) => {\n const { price, unit, tiers, tierUnits } = getPlanPrice(\n plan,\n billingPeriod,\n paywallLocale,\n locale,\n hasMonthlyPrice,\n perUnitQuantityByFeature,\n );\n\n // We currently only support prices with one tier - so we select the first one\n const tieredPrice = plan.pricePoints.find((planPrice) => {\n return planPrice.billingPeriod === billingPeriod && planPrice.isTieredPrice;\n });\n const featureId = tieredPrice ? tieredPrice.feature!.featureId : undefined;\n const perUnitQuantity = perUnitQuantityByFeature[featureId || ''] ?? 1;\n\n const handlePerUnitQuantityChange = (quantity: number) => {\n if (!featureId) {\n return;\n }\n\n setPerUnitQuantityByFeature((prevState) => ({\n ...prevState,\n [featureId]: quantity,\n }));\n };\n\n return (\n <PlanPriceContainer as=\"div\" className=\"stigg-price-text\">\n <>\n {withStartingAtRow && (\n <Typography\n style={{ minHeight: '20px' }}\n className=\"stigg-starting-at-text\"\n variant=\"body1\"\n color=\"secondary\">\n {showStartingAt ? paywallLocale.price.startingAtCaption : EMPTY_CHAR}\n </Typography>\n )}\n\n <PriceSpan className=\"stigg-price-point\" variant=\"h1\">\n {price}\n </PriceSpan>\n\n {withUnitPriceRow && (\n <Typography as=\"div\" className=\"stigg-price-unit-and-billing-period-text\" style={{ minHeight: '48px' }}>\n <UnitSpan className=\"stigg-price-unit-text\" span variant=\"h6\" color=\"secondary\">\n {unit}\n </UnitSpan>\n\n <PriceBillingPeriod\n plan={plan}\n billingPeriod={billingPeriod}\n hasAnnuallyPrice={hasAnnuallyPrice}\n hasMonthlyPrice={hasMonthlyPrice}\n paywallLocale={paywallLocale}\n />\n </Typography>\n )}\n\n {withTiersRow ? (\n <TiersSelectContainer\n componentId={`${plan.id}_${featureId}_tier`}\n tiers={tiers}\n tierUnits={tierUnits}\n tiersMode={tieredPrice?.tiersMode}\n handleChange={handlePerUnitQuantityChange}\n value={perUnitQuantity}\n />\n ) : null}\n </>\n </PlanPriceContainer>\n );\n};\n","import React, { useState } from 'react';\nimport { Addon, WidgetType } from '@stigg/js-client-sdk';\nimport MuiButton from '@mui/material/Button';\nimport styled from '@emotion/styled/macro';\nimport classNames from 'classnames';\nimport { Typography } from '../common/Typography';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { Icon } from '../common/Icon';\n\nexport const StyledButton = styled(MuiButton)`\n padding: 0px;\n text-transform: none;\n margin-left: 0px;\n`;\n\nconst ButtonText = styled(Typography)`\n font-size: 14px;\n font-weight: 500;\n`;\n\nconst AddonsBox = styled.div`\n width: 100%;\n gap: 10px;\n`;\n\nconst AddonsList = styled.div`\n margin-top: 10px;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n gap: 4px;\n width: 100%;\n`;\n\nconst AddonRow = styled.div`\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: space-between;\n padding: 8px 0px;\n max-height: 44px;\n gap: 16px;\n`;\n\nconst AddonName = styled(Typography)`\n overflow: hidden;\n font-feature-settings: 'liga' off, 'clig' off;\n text-overflow: ellipsis;\n font-family: 'DM Sans';\n letter-spacing: 0.15px;\n white-space: nowrap;\n min-width: 0;\n flex-shrink: 1;\n`;\n\nconst AddonIcon = styled(Icon)`\n width: 24px;\n height: 24px;\n color: ${({ theme }) => theme.stigg.palette.primary};\n`;\n\nconst AddonContent = styled.div`\n flex: 1;\n min-width: 0;\n`;\n\nconst Footer = styled.div`\n margin-top: 16px;\n display: flex;\n`;\n\nconst MAX_ADDONS = 4;\n\ntype PlanCompatibleAddonsProps = {\n addons: Addon[];\n paywallLocale: PaywallLocalization;\n};\n\nexport function PlanCompatibleAddons({ addons, paywallLocale }: PlanCompatibleAddonsProps) {\n const [showAllAddons, setShowAllAddons] = useState(false);\n\n if (!addons || addons.length === 0) return null;\n\n const visibleAddons = addons.filter((addon) => !addon.hiddenFromWidgets?.includes(WidgetType.Paywall));\n\n const toggleShowAllAddons = () => {\n setShowAllAddons(!showAllAddons);\n };\n\n const displayedAddons = showAllAddons ? visibleAddons : visibleAddons.slice(0, MAX_ADDONS);\n\n if (displayedAddons.length === 0) return null;\n\n return (\n <AddonsBox className=\"stigg-compatible-addons-container\">\n <Typography className=\"stigg-compatible-addons-header\" color=\"secondary\" variant=\"body1\" bold>\n {paywallLocale.addonsTitle}\n </Typography>\n <AddonsList className=\"stigg-compatible-addons-list\">\n {displayedAddons.map((addon) => {\n return (\n <AddonRow\n key={addon.id}\n className={classNames(`stigg-compatible-addon--${addon.id}`, 'stigg-compatible-addon-item')}>\n <AddonIcon icon=\"Add\" className=\"stigg-compatible-addon-icon\" />\n <AddonContent className=\"stigg-compatible-addon-content\">\n <AddonName variant=\"body1\" color=\"primary\" className=\"stigg-compatible-addon-name\">\n {addon.displayName}\n </AddonName>\n </AddonContent>\n </AddonRow>\n );\n })}\n </AddonsList>\n {visibleAddons.length > MAX_ADDONS && (\n <Footer>\n <StyledButton variant=\"text\" onClick={toggleShowAllAddons}>\n <ButtonText color=\"primary.main\">\n {showAllAddons ? 'Show less' : `Show ${visibleAddons.length - MAX_ADDONS} more`}\n </ButtonText>\n </StyledButton>\n </Footer>\n )}\n </AddonsBox>\n );\n}\n","import React, { useState } from 'react';\nimport { BillableFeature, BillingPeriod, Customer, PricingType, Subscription } from '@stigg/js-client-sdk';\nimport styled from '@emotion/styled/macro';\nimport classNames from 'classnames';\nimport Grid from '@mui/material/Grid';\nimport { PlanEntitlements } from './PlanEntitlements';\nimport { PlanOfferingButton } from './PlanOfferingButton';\nimport { CurrentSubscriptionOverride, PaywallPlan, SelectDefaultTierIndexFn, SubscribeIntentionType } from './types';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { flexLayoutMapper } from '../../theme/getResolvedTheme';\nimport { Typography } from '../common/Typography';\nimport MiniSchedule from '../../assets/mini-schedule.svg';\nimport { PlanPrice } from './PlanPrice';\nimport { getTiersPerUnitQuantities } from '../utils/priceTierUtils';\nimport { PlanCompatibleAddons } from './PlanCompatibleAddons';\n\nconst PlanOfferingButtonHeight = '66px';\n\nconst PlanOfferingContainer = styled.div<{ $isHighlighted: boolean; $isCurrentPlan: boolean }>`\n position: relative;\n background-color: ${({ theme, $isCurrentPlan }) =>\n $isCurrentPlan ? theme.stigg.palette.backgroundHighlight : theme.stigg.palette.backgroundPaper};\n border: ${({ theme, $isHighlighted }) =>\n $isHighlighted ? `3px solid ${theme.stigg.palette.primary}` : `1px solid ${theme.stigg.palette.outlinedBorder}`};\n border-radius: 10px;\n padding: ${({ theme }) => theme.stigg.layout.planPadding};\n display: flex;\n min-width: ${({ theme }) => theme.stigg.layout.planMinWidth};\n max-width: ${({ theme }) => theme.stigg.layout.planMaxWidth};\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n position: relative;\n`;\n\nconst AddonsContainer = styled.div<{ $planHasEntitlements: boolean }>`\n margin-top: ${({ $planHasEntitlements }) => ($planHasEntitlements ? '32px' : '0px')};\n`;\n\nconst PlanHeader = styled(Typography)`\n padding-bottom: 8px;\n`;\n\nconst Divider = styled.div`\n height: 2px;\n width: 100%;\n background-color: ${({ theme }) => theme.stigg.palette.outlinedBorder};\n margin-bottom: 40px;\n`;\n\nconst PlanDescription = styled(Typography)`\n text-align: ${({ theme }) => theme.stigg.layout.descriptionAlignment};\n min-height: ${({ theme }) => theme.stigg.layout.descriptionMinHeight};\n`;\n\nconst HighlightBadge = styled.div`\n background-color: ${({ theme }) => theme.stigg.palette.primary};\n border-radius: 40px;\n position: absolute;\n top: -12px;\n`;\n\nconst HighlightText = styled(Typography)`\n margin: 0;\n padding: 2px 8px;\n`;\n\nconst HeaderWrapper = styled.div`\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: ${({ theme }) => flexLayoutMapper(theme.stigg.layout.headerAlignment)};\n`;\n\ntype PlanOfferingProps = {\n withUnitPriceRow: boolean;\n withTiersRow: boolean;\n withTrialLeftRow: boolean;\n customer: Customer | null;\n plan: PaywallPlan;\n billingPeriod: BillingPeriod;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n isHighlighted: boolean;\n shouldShowDescriptionSection: boolean;\n hasAnnuallyPrice: boolean;\n hasMonthlyPrice: boolean;\n isCustomerOnTrial: boolean;\n onPlanSelected: (intentionType: SubscribeIntentionType, billableFeatures: BillableFeature[]) => void | Promise<void>;\n paywallLocale: PaywallLocalization;\n locale: string;\n withStartingAtRow: boolean;\n isCustomerInCustomPlan: boolean;\n selectDefaultTierIndex?: SelectDefaultTierIndexFn;\n hideCompatibleAddons?: boolean;\n};\n\nconst NextPlanTagContainer = styled.div`\n position: absolute;\n top: 0;\n background-color: ${({ theme }) => theme.stigg.palette.outlinedBorder};\n border-radius: 0px 0px 10px 10px;\n padding: 3px 12px;\n`;\n\nconst StyledMiniSchedule = styled(MiniSchedule)<{ $iconsColor?: string }>`\n display: flex;\n height: 100%;\n margin-right: 4px;\n\n path {\n fill: ${({ theme }) => theme.stigg.palette.text.primary};\n }\n`;\n\nfunction UpcomingChangeTag({ text = 'Next', iconsColor }: { text?: string; iconsColor?: string }) {\n return (\n <NextPlanTagContainer>\n <Grid display=\"flex\" alignItems=\"center\" gap={1}>\n <StyledMiniSchedule $iconsColor={iconsColor} />\n <Typography color=\"primary\" variant=\"body1\">\n {text}\n </Typography>\n </Grid>\n </NextPlanTagContainer>\n );\n}\n\nexport function PlanOffering({\n withUnitPriceRow,\n withTiersRow,\n withTrialLeftRow,\n customer,\n plan,\n billingPeriod,\n isHighlighted,\n currentSubscription,\n currentSubscriptionOverride,\n shouldShowDescriptionSection,\n hasMonthlyPrice,\n hasAnnuallyPrice,\n isCustomerOnTrial,\n onPlanSelected,\n paywallLocale,\n locale,\n withStartingAtRow,\n isCustomerInCustomPlan,\n selectDefaultTierIndex,\n hideCompatibleAddons,\n}: PlanOfferingProps) {\n const isNextPlan = plan.isNextPlan && plan.isNextPlan(billingPeriod);\n const planPrices = plan.pricePoints.filter((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n const paywallCalculatedPrice = plan.paywallCalculatedPricePoints?.find(\n (pricePoint) => pricePoint.billingPeriod === billingPeriod,\n );\n const showStartingAt = planPrices.length > 1 && !!paywallCalculatedPrice?.additionalChargesMayApply;\n const showCTAButton = !isCustomerInCustomPlan || plan.pricingType === PricingType.Custom;\n\n let planBadge = null;\n if (isNextPlan) {\n planBadge = <UpcomingChangeTag text=\"Next plan\" />;\n } else if (isHighlighted && paywallLocale.highlightChip) {\n planBadge = (\n <HighlightBadge className=\"stigg-highlight-badge\">\n <HighlightText className=\"stigg-highlight-badge-text\" color=\"white\" bold>\n {paywallLocale.highlightChip}\n </HighlightText>\n </HighlightBadge>\n );\n }\n\n const [perUnitQuantityByFeature, setPerUnitQuantityByFeature] = useState<Record<string, number>>(\n getTiersPerUnitQuantities({\n plan,\n billingPeriod,\n currentSubscription,\n currentSubscriptionOverride,\n selectDefaultTierIndex,\n }),\n );\n\n const onPlanButtonClick = (intentionType: SubscribeIntentionType) => {\n const perUnitBillableFeatures: BillableFeature[] = Object.keys(perUnitQuantityByFeature).map((featureId) => ({\n featureId,\n quantity: perUnitQuantityByFeature[featureId],\n }));\n\n return onPlanSelected(intentionType, perUnitBillableFeatures);\n };\n\n return (\n <PlanOfferingContainer\n className={classNames(`stigg-${plan.id}`, 'stigg-plan-offering-container', {\n 'stigg-current-plan': plan.isCurrentCustomerPlan,\n })}\n $isHighlighted={isHighlighted}\n $isCurrentPlan={plan.isCurrentCustomerPlan}>\n {planBadge}\n\n <HeaderWrapper className=\"stigg-header-wrapper\">\n <PlanHeader className=\"stigg-plan-header\" variant=\"h3\">\n {plan.displayName}\n </PlanHeader>\n\n {shouldShowDescriptionSection && (\n <PlanDescription className=\"stigg-plan-description\" variant=\"h6\" color=\"secondary\">\n {plan.description}\n </PlanDescription>\n )}\n\n <PlanPrice\n showStartingAt={showStartingAt}\n withUnitPriceRow={withUnitPriceRow}\n withStartingAtRow={withStartingAtRow}\n withTiersRow={withTiersRow}\n plan={plan}\n billingPeriod={billingPeriod}\n paywallLocale={paywallLocale}\n locale={locale}\n hasAnnuallyPrice={hasAnnuallyPrice}\n hasMonthlyPrice={hasMonthlyPrice}\n setPerUnitQuantityByFeature={setPerUnitQuantityByFeature}\n perUnitQuantityByFeature={perUnitQuantityByFeature}\n />\n\n {showCTAButton ? (\n <PlanOfferingButton\n isNextPlan={isNextPlan}\n customer={customer}\n plan={plan}\n currentSubscription={currentSubscription}\n currentSubscriptionOverride={currentSubscriptionOverride}\n billingPeriod={billingPeriod}\n isCustomerOnTrial={isCustomerOnTrial}\n onPlanSelected={onPlanButtonClick}\n paywallLocale={paywallLocale}\n withTrialLeftRow={withTrialLeftRow}\n perUnitQuantityByFeature={perUnitQuantityByFeature}\n />\n ) : (\n <div style={{ height: PlanOfferingButtonHeight }} />\n )}\n\n <Divider className=\"stigg-plan-header-divider\" />\n </HeaderWrapper>\n\n <PlanEntitlements plan={plan} billingPeriod={billingPeriod} paywallLocale={paywallLocale} />\n\n <AddonsContainer $planHasEntitlements={plan.entitlements.length > 0} className=\"stigg-addons-container\">\n {!hideCompatibleAddons && plan.compatibleAddons && plan.compatibleAddons.length > 0 && (\n <PlanCompatibleAddons addons={plan.compatibleAddons} paywallLocale={paywallLocale} />\n )}\n </AddonsContainer>\n </PlanOfferingContainer>\n );\n}\n","<svg width=\"135\" height=\"16\" viewBox=\"0 0 135 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.0987549 3.43016V12.9878H1.15589V9.52681H3.96527C5.94922 9.52681 7.28874 8.25245 7.28874 6.47848C7.28874 4.70452 5.94922 3.43016 3.96527 3.43016H0.0987549ZM1.15589 8.55656V4.40765H4.04492C5.33376 4.40765 6.18816 5.26205 6.18816 6.47848C6.18816 7.69492 5.33376 8.55656 4.04492 8.55656H1.15589Z\" fill=\"#001E6C\"/>\n<path d=\"M11.7787 13.1616C13.9075 13.1616 15.6525 11.5397 15.6525 9.38199C15.6525 7.21703 13.9365 5.62408 11.8077 5.62408C9.64999 5.62408 7.93395 7.24599 7.93395 9.41095C7.93395 11.5687 9.62103 13.1616 11.7787 13.1616ZM11.7932 12.2276C10.2365 12.2276 9.02005 11.0256 9.02005 9.39647C9.02005 7.76732 10.2365 6.56537 11.7932 6.56537C13.321 6.56537 14.5664 7.76732 14.5664 9.39647C14.5664 11.0256 13.321 12.2276 11.7932 12.2276Z\" fill=\"#001E6C\"/>\n<path d=\"M19.9054 12.9878L21.4766 6.94189H21.5056L23.0623 12.9878H24.4018L26.5958 5.8051H25.4155L23.7936 11.909H23.7647L22.2152 5.8051H20.7815L19.232 11.909H19.203L17.5522 5.8051H16.3575L18.5659 12.9878H19.9054Z\" fill=\"#001E6C\"/>\n<path d=\"M34.9835 9.42544C34.9835 7.30392 33.4051 5.62408 31.1532 5.62408C29.0534 5.62408 27.3084 7.18083 27.3084 9.41095C27.3084 11.5542 28.9086 13.1616 31.1822 13.1616C32.7679 13.1616 34.0567 12.3941 34.6794 11.1922L33.7816 10.707C33.3688 11.6049 32.3696 12.2348 31.1966 12.2348C29.5241 12.2348 28.5031 10.9894 28.4017 9.7223H34.969C34.9835 9.59197 34.9835 9.54129 34.9835 9.42544ZM31.1387 6.55089C32.5434 6.55089 33.6657 7.49942 33.854 8.80998H28.4307C28.6552 7.5501 29.7558 6.55089 31.1387 6.55089Z\" fill=\"#001E6C\"/>\n<path d=\"M39.5922 5.68201C38.564 5.68201 37.8182 6.20334 37.4924 6.93464L37.391 5.8051H36.486V12.9878H37.5431V8.5638C37.5431 7.44873 38.1585 6.77535 39.3171 6.77535H39.9977V5.68201H39.5922Z\" fill=\"#001E6C\"/>\n<path d=\"M48.2486 9.42544C48.2486 7.30392 46.6702 5.62408 44.4183 5.62408C42.3185 5.62408 40.5735 7.18083 40.5735 9.41095C40.5735 11.5542 42.1737 13.1616 44.4473 13.1616C46.033 13.1616 47.3218 12.3941 47.9445 11.1922L47.0467 10.707C46.634 11.6049 45.6348 12.2348 44.4618 12.2348C42.7892 12.2348 41.7682 10.9894 41.6669 9.7223H48.2342C48.2486 9.59197 48.2486 9.54129 48.2486 9.42544ZM44.4039 6.55089C45.8085 6.55089 46.9308 7.49942 47.1191 8.80998H41.6958C41.9203 7.5501 43.0209 6.55089 44.4039 6.55089Z\" fill=\"#001E6C\"/>\n<path d=\"M55.846 7.02877C55.2161 6.13817 54.2024 5.63132 53.0149 5.63132C50.9224 5.63132 49.2425 7.21703 49.2425 9.39647C49.2425 11.5759 50.8934 13.1616 52.986 13.1616C54.1807 13.1616 55.2161 12.6403 55.8533 11.7425L55.9981 12.9878H56.9032V2.56128L55.846 2.67713V7.02877ZM53.0294 12.2276C51.5306 12.2276 50.3286 11.0401 50.3286 9.39647C50.3286 7.75284 51.5306 6.56537 53.0294 6.56537C54.5789 6.56537 55.846 7.76732 55.846 9.39647C55.846 11.0256 54.5789 12.2276 53.0294 12.2276Z\" fill=\"#001E6C\"/>\n<path d=\"M65.7314 5.63132C64.5367 5.63132 63.5085 6.14541 62.8713 7.04325V2.56128L61.8142 2.67713V12.9878H62.7192L62.8641 11.7497C63.494 12.6475 64.5077 13.1616 65.7024 13.1616C67.795 13.1616 69.4748 11.5759 69.4748 9.39647C69.4748 7.21703 67.8239 5.63132 65.7314 5.63132ZM65.6879 12.2276C64.1384 12.2276 62.8713 11.0256 62.8713 9.39647C62.8713 7.76732 64.1384 6.56537 65.6879 6.56537C67.1867 6.56537 68.3887 7.75284 68.3887 9.39647C68.3887 11.0401 67.1867 12.2276 65.6879 12.2276Z\" fill=\"#001E6C\"/>\n<path d=\"M76.2187 5.8051V9.9178C76.2187 11.3297 75.3136 12.1841 74.0465 12.1841C72.7866 12.1841 72.077 11.4456 72.077 10.1133V5.8051H71.0199V10.2726C71.0199 11.9669 72.1349 13.0965 73.7641 13.0965C74.843 13.0965 75.6901 12.6765 76.2187 11.9814V12.8937C76.2187 14.1608 75.2629 15.0804 73.8727 15.0804C72.7504 15.0804 71.8236 14.4794 71.5847 13.4295L70.6579 13.9074C71.0995 15.16 72.3087 16 73.8582 16C75.8132 16 77.2758 14.5953 77.2758 12.7923V5.8051H76.2187Z\" fill=\"#001E6C\"/>\n<path d=\"M108.672 10.4867C108.672 11.9077 107.411 12.7873 105.491 12.7873C104.464 12.7873 103.634 12.6028 102.84 12.2091C102.914 11.76 102.982 11.2187 103 10.5913C103.738 11.0219 104.575 11.231 105.381 11.231C106.34 11.231 106.839 11.0096 106.839 10.5421C106.857 10.0807 106.5 9.87155 105.067 9.59473C103.406 9.26255 102.668 8.57359 102.668 7.35559C102.668 5.97767 103.929 5.0857 105.848 5.0857C106.697 5.0857 107.54 5.24564 108.186 5.52246L107.866 7.06647C107.226 6.7712 106.537 6.63587 105.848 6.63587C104.95 6.63587 104.507 6.85733 104.507 7.29408C104.507 7.67547 104.815 7.83541 106.217 8.12453C108.007 8.50592 108.678 9.19488 108.678 10.4744L108.672 10.4867ZM112.879 11.0957C112.16 11.0957 111.581 10.7143 111.581 9.70546V6.88808H113.408L113.747 5.25794H111.581V2.93884C111.157 3.06187 110.517 3.2095 109.681 3.28332L109.662 10.0315C109.662 11.8708 110.763 12.7996 112.412 12.7996C112.787 12.7996 113.113 12.7627 113.39 12.6951L113.753 10.9665C113.525 11.0465 113.236 11.1018 112.879 11.1018V11.0957ZM114.965 12.6889H116.884V5.25794H114.965V12.6889ZM115.93 2.21912C115.309 2.21297 114.829 2.66817 114.823 3.27102C114.823 3.89232 115.278 4.35983 115.894 4.36598C116.515 4.36598 116.976 3.92923 116.989 3.32638C117.001 2.70508 116.546 2.23142 115.937 2.21912H115.93ZM126.056 5.25794V11.5263C126.056 13.8946 124.456 15.5247 121.756 15.5247C120.784 15.5247 119.714 15.3094 118.994 14.8973C119.492 14.3867 119.831 13.9438 120.046 13.6239C120.532 13.79 121.042 13.8762 121.565 13.8762C123.275 13.8762 124.143 12.9288 124.143 11.7354V11.4955C123.534 12.1968 122.654 12.6336 121.602 12.6336C119.584 12.6336 118.065 11.1326 118.065 8.90577C118.065 6.67893 119.726 5.098 121.756 5.098C122.808 5.098 123.724 5.4794 124.333 6.19912L124.395 5.25179H126.062L126.056 5.25794ZM124.155 8.90577C124.155 7.72468 123.294 6.82657 122.107 6.82657C120.919 6.82657 120.046 7.72468 120.046 8.90577C120.046 10.0868 120.907 10.9542 122.107 10.9542C123.306 10.9542 124.155 10.0561 124.155 8.90577ZM134.994 5.25794V11.5263C134.994 13.8946 133.394 15.5247 130.694 15.5247C129.722 15.5247 128.652 15.3094 127.932 14.8973C128.43 14.3867 128.769 13.9438 128.984 13.6239C129.47 13.79 129.98 13.8762 130.503 13.8762C132.213 13.8762 133.081 12.9288 133.081 11.7354V11.4955C132.472 12.1968 131.592 12.6336 130.54 12.6336C128.523 12.6336 127.003 11.1326 127.003 8.90577C127.003 6.67893 128.664 5.098 130.694 5.098C131.746 5.098 132.662 5.4794 133.271 6.19912L133.333 5.25179H135L134.994 5.25794ZM133.093 8.90577C133.093 7.72468 132.232 6.82657 131.045 6.82657C129.857 6.82657 128.984 7.72468 128.984 8.90577C128.984 10.0868 129.845 10.9542 131.045 10.9542C132.244 10.9542 133.093 10.0561 133.093 8.90577Z\" fill=\"#001E6C\"/>\n<path d=\"M95.7092 14.9825C95.6354 15.0194 94.2267 15.6407 91.7353 15.5238C90.4374 15.4623 89.3117 15.2224 88.512 15.0009L92.8241 9.99361C93.5931 10.1905 94.5835 10.375 95.7092 10.4304C98.2005 10.5534 99.6092 9.92594 99.683 9.88903L95.7092 14.9886V14.9825ZM89.2686 5.36155C88.5612 2.96863 88.838 1.45537 88.8564 1.3754L84.8457 6.44421C84.8334 6.52418 84.5566 8.03744 85.2578 10.4304C85.6269 11.673 86.1252 12.7126 86.5312 13.4384L90.3759 8.0682C90.0068 7.36693 89.5885 6.44421 89.2686 5.3677V5.36155ZM99.2647 5.89058C98.6988 3.97132 97.813 2.55033 97.4501 2.009L93.8822 6.55494L94.5527 9.77216C94.9526 9.82752 95.3462 9.86443 95.7461 9.88903C95.9491 9.89518 96.1521 9.90134 96.3489 9.90134C98.2805 9.90134 99.357 9.44613 99.4739 9.39076L99.7507 9.26773C99.7753 8.60338 99.7322 7.42844 99.2709 5.88443L99.2647 5.89058ZM97.0256 1.68297C96.4166 1.45537 94.8295 0.932493 92.8303 0.83407C91.2248 0.754101 90.0744 0.987856 89.4347 1.1724L89.3793 1.46767C89.367 1.52919 89.121 2.96248 89.7792 5.20777C89.8899 5.58916 90.0252 5.9644 90.1729 6.33964L93.4577 6.22891L97.0318 1.68912L97.0256 1.68297Z\" fill=\"#001E6C\"/>\n</svg>\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport Switch from 'react-switch';\nimport { BillingPeriod } from '@stigg/js-client-sdk';\nimport { Typography } from '../common/Typography';\n\nconst PickerContainer = styled.div`\n height: 40px;\n padding: 0 20px;\n margin-bottom: ${({ theme }) => theme.stigg.layout.switchBottomSpacing};\n border-radius: 10px;\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedBorder}`};\n background-color: ${({ theme }) => theme.stigg.palette.backgroundPaper};\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst PeriodText = styled(Typography)`\n margin: 0 8px;\n`;\n\nconst StyledSwitch = styled(Switch)`\n & .react-switch-bg {\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.switchBorder}`};\n background: ${({ theme }) => theme.stigg.palette.switchFill} !important;\n }\n\n & .react-switch-handle {\n box-shadow: ${({ theme }) => theme.stigg.shadows.light};\n background: ${({ theme }) => theme.stigg.palette.switchHandle} !important;\n top: 0.5px !important;\n }\n`;\n\nfunction DiscountRate({ discount, disabled }: { discount: number; disabled: boolean }) {\n return (\n <Typography variant=\"h6\" color={disabled ? 'disabled' : 'primary'} className=\"stigg-discount-rate-text\">\n {discount}% off\n </Typography>\n );\n}\n\nexport function BillingPeriodPicker({\n discountRate,\n selectedBillingPeriod,\n onBillingPeriodChanged,\n availableBillingPeriods,\n}: {\n discountRate: number;\n selectedBillingPeriod: BillingPeriod;\n onBillingPeriodChanged: (billingPeriod: BillingPeriod) => void;\n availableBillingPeriods: BillingPeriod[];\n}) {\n if (availableBillingPeriods.length <= 1) {\n return null;\n }\n\n const isMonthlyBillingPeriod = selectedBillingPeriod === BillingPeriod.Monthly;\n\n return (\n <PickerContainer className=\"stigg-period-picker-container\">\n <PeriodText\n variant=\"h6\"\n className=\"stigg-monthly-period-text\"\n color={isMonthlyBillingPeriod ? 'primary' : 'disabled'}>\n Monthly\n </PeriodText>\n <StyledSwitch\n className=\"stigg-period-switch\"\n uncheckedIcon={false}\n checkedIcon={false}\n height={16}\n width={33}\n onChange={(isAnnuallySelected) =>\n onBillingPeriodChanged(isAnnuallySelected ? BillingPeriod.Annually : BillingPeriod.Monthly)\n }\n checked={!isMonthlyBillingPeriod}\n borderRadius={10}\n handleDiameter={19}\n />\n <PeriodText\n variant=\"h6\"\n className=\"stigg-annual-period-text\"\n color={!isMonthlyBillingPeriod ? 'primary' : 'disabled'}>\n Annual\n </PeriodText>\n {discountRate !== 0 && <DiscountRate discount={discountRate} disabled={isMonthlyBillingPeriod} />}\n </PickerContainer>\n );\n}\n","import { BillingPeriod, PaywallCalculatedPricePoint, Price } from '@stigg/js-client-sdk';\nimport isNil from 'lodash/isNil';\nimport { PaywallPlan } from '../paywall';\nimport { calculateTierPrice } from './priceTierUtils';\n\nexport function calculateDiscountRate(monthlyPrice?: number | null, annuallyPrice?: number | null) {\n if (!isNil(monthlyPrice) && !isNil(annuallyPrice)) {\n const annuallyPerMonthPrice = annuallyPrice / 12;\n return Math.round(((monthlyPrice - annuallyPerMonthPrice) / monthlyPrice) * 100);\n }\n\n return null;\n}\n\nfunction getPlanBillingPeriodAmount(plan: PaywallPlan, billingPeriod: BillingPeriod) {\n let pricePoint: PaywallCalculatedPricePoint | Price | undefined;\n\n pricePoint = plan.paywallCalculatedPricePoints?.find((price) => price.billingPeriod === billingPeriod);\n\n if (!pricePoint) {\n pricePoint = plan.pricePoints.find((price) => price.billingPeriod === billingPeriod);\n }\n\n if (!pricePoint?.amount) {\n const tieredPrice = plan.pricePoints.find((price) => {\n return price.isTieredPrice && price.billingPeriod === billingPeriod;\n });\n\n if (tieredPrice) {\n return calculateTierPrice(tieredPrice, 1);\n }\n }\n\n return pricePoint?.amount;\n}\n\nexport function calculatePaywallDiscountRate(plans: PaywallPlan[]) {\n return plans.reduce((maxDiscount, plan) => {\n const monthlyAmount = getPlanBillingPeriodAmount(plan, BillingPeriod.Monthly);\n const annuallyAmount = getPlanBillingPeriodAmount(plan, BillingPeriod.Annually);\n\n const discountRate = calculateDiscountRate(monthlyAmount, annuallyAmount);\n if (discountRate) {\n maxDiscount = Math.max(maxDiscount, discountRate);\n }\n\n return maxDiscount;\n }, 0);\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport PoweredByStiggSvg from '../../assets/powered-by-stigg.svg';\n\nexport const STIGG_WATERMARK_CLASSNAME = 'stigg-watermark';\n\nexport type PoweredByStiggSources = 'paywall' | 'customer_portal' | 'checkout';\n\nconst PoweredByStiggThemedSvg = styled(PoweredByStiggSvg)`\n * {\n fill: ${({ theme }) => theme.stigg.palette.text.secondary};\n }\n`;\n\ntype PoweredByStiggProps = {\n source: PoweredByStiggSources;\n showWatermark?: boolean;\n style?: React.CSSProperties;\n align?: 'center' | 'end';\n};\n\nconst StyledPoweredByStigg = styled.div<{ $alignSelf?: string }>`\n align-self: ${({ $alignSelf }) => $alignSelf || 'unset'};\n\n @media (max-width: 1040px) {\n align-self: center;\n }\n`;\n\nexport function PoweredByStigg({ source, showWatermark, align, style = {} }: PoweredByStiggProps) {\n if (!showWatermark) {\n return null;\n }\n\n const onWatermarkClick = () => {\n const sourceDomain = window.location.hostname.replace('www.', '');\n window.open(\n `https://www.stigg.io/?utm_source=${sourceDomain}&utm_medium=referral&utm_campaign=${source}`,\n '_blank',\n );\n };\n\n return (\n <StyledPoweredByStigg\n $alignSelf={align}\n className={STIGG_WATERMARK_CLASSNAME}\n style={{ cursor: 'pointer', ...style }}\n onClick={onWatermarkClick}>\n <PoweredByStiggThemedSvg />\n </StyledPoweredByStigg>\n );\n}\n","import { BillingPeriod } from '@stigg/js-client-sdk';\nimport { PaywallPlan } from '../types';\n\nexport function hasPricePoints(plan: PaywallPlan, billingPeriod: BillingPeriod): boolean {\n return plan.pricePoints.some((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n}\n\nexport function hasPricePointsForPlans(plans: PaywallPlan[], billingPeriod: BillingPeriod): boolean {\n return plans.some((plan) => hasPricePoints(plan, billingPeriod));\n}\n","import { BillableFeature, BillingPeriod, Customer, Plan, PricingType, Subscription } from '@stigg/js-client-sdk';\nimport React, { useCallback, useMemo } from 'react';\nimport styled from '@emotion/styled/macro';\nimport { PlanOffering } from './PlanOffering';\nimport { BillingPeriodPicker } from './BillingPeriodPicker';\nimport { calculatePaywallDiscountRate } from '../utils/calculateDiscountRate';\nimport {\n ShouldHidePlanFn,\n OnPlanSelectedCallbackFn,\n PaywallPlan,\n SubscribeIntentionType,\n SelectDefaultTierIndexFn,\n CurrentSubscriptionOverride,\n} from './types';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { PoweredByStigg } from '../common/PoweredByStigg';\nimport { useStiggContext } from '../..';\nimport { hasPricePointsForPlans } from './utils/hasPricePoints';\nimport { getPlansToDisplay } from './utils/getPlansToDisplay';\nimport { getPlanPrice } from '../utils/getPlanPrice';\nimport { getTiersPerUnitQuantities } from '../utils/priceTierUtils';\n\nconst PaywallPlansContainer = styled.div`\n color: ${({ theme }) => theme.stigg.palette.text.primary};\n display: flex;\n align-items: stretch;\n justify-content: center;\n flex-wrap: wrap;\n padding: 10px 0;\n gap: ${({ theme }) => theme.stigg.layout.planMargin};\n`;\n\nconst PaywallContainer = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n\n & * {\n box-sizing: border-box;\n }\n`;\n\nconst PaywallLayout = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n`;\n\ntype PaywallProps = {\n plans: PaywallPlan[];\n customer: Customer | null;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n selectedBillingPeriod: BillingPeriod;\n highlightedPlanId?: string;\n onBillingPeriodChanged: (billingPeriod: BillingPeriod) => void;\n availableBillingPeriods: BillingPeriod[];\n isCustomerOnTrial: boolean;\n onPlanSelected: OnPlanSelectedCallbackFn;\n paywallLocale: PaywallLocalization;\n locale: string;\n shouldHidePlan?: ShouldHidePlanFn;\n selectDefaultTierIndex?: SelectDefaultTierIndexFn;\n hideCompatibleAddons?: boolean;\n};\n\nexport const Paywall = ({\n plans,\n customer,\n currentSubscription,\n highlightedPlanId,\n selectedBillingPeriod,\n onBillingPeriodChanged,\n availableBillingPeriods,\n isCustomerOnTrial,\n onPlanSelected,\n paywallLocale,\n locale,\n shouldHidePlan,\n selectDefaultTierIndex,\n currentSubscriptionOverride,\n hideCompatibleAddons,\n}: PaywallProps) => {\n const { stigg } = useStiggContext();\n const discountRate = calculatePaywallDiscountRate(plans);\n const shouldShowDescriptionSection = plans.some((plan) => !!plan.description);\n const hasMonthlyPrice = hasPricePointsForPlans(plans, BillingPeriod.Monthly);\n const hasAnnuallyPrice = hasPricePointsForPlans(plans, BillingPeriod.Annually);\n const plansToShow = getPlansToDisplay(plans, selectedBillingPeriod, shouldHidePlan);\n\n const handleOnSubscribe = useCallback(\n (plan: Plan, intentionType: SubscribeIntentionType, billableFeatures: BillableFeature[]) => {\n return onPlanSelected({\n plan,\n customer,\n subscription: currentSubscription,\n intentionType,\n selectedBillingPeriod,\n billableFeatures,\n });\n },\n [customer, selectedBillingPeriod, currentSubscription, onPlanSelected],\n );\n\n const isCustomerInCustomPlan = !!currentSubscription && currentSubscription.plan.pricingType === PricingType.Custom;\n\n const withStartingAtRow = useMemo(\n () =>\n plansToShow.some((plan) => {\n const planPrices = plan.pricePoints.filter((pricePoint) => pricePoint.billingPeriod === selectedBillingPeriod);\n const paywallCalculatedPrice = plan.paywallCalculatedPricePoints?.find(\n (pricePoint) => pricePoint.billingPeriod === selectedBillingPeriod,\n );\n return planPrices.length > 1 && !!paywallCalculatedPrice?.additionalChargesMayApply;\n }),\n [selectedBillingPeriod, plansToShow],\n );\n\n const withUnitPriceRow = useMemo(\n () =>\n plansToShow.some((plan) => {\n return !!getPlanPrice(plan, selectedBillingPeriod, paywallLocale, locale, hasMonthlyPrice).unit;\n }),\n [selectedBillingPeriod, hasMonthlyPrice, locale, paywallLocale, plansToShow],\n );\n\n const withTiersRow = useMemo(() => {\n return (\n !isCustomerInCustomPlan &&\n plansToShow.some((plan) => {\n const tiers = getTiersPerUnitQuantities({\n plan,\n billingPeriod: selectedBillingPeriod,\n currentSubscription,\n currentSubscriptionOverride,\n });\n return Object.values(tiers).length > 0;\n })\n );\n }, [selectedBillingPeriod, currentSubscription, currentSubscriptionOverride, isCustomerInCustomPlan, plansToShow]);\n\n const withTrialLeftRow = plansToShow.some((plan) => {\n return plan.isCurrentCustomerPlan && plan.trialDaysLeft;\n });\n\n return (\n <PaywallContainer className=\"stigg-paywall-container\">\n <PaywallLayout className=\"stigg-paywall-layout\">\n <BillingPeriodPicker\n onBillingPeriodChanged={onBillingPeriodChanged}\n selectedBillingPeriod={selectedBillingPeriod}\n availableBillingPeriods={availableBillingPeriods}\n discountRate={discountRate}\n />\n\n <PaywallPlansContainer className=\"stigg-paywall-plans-layout\">\n {plansToShow.map((plan) => (\n <PlanOffering\n withUnitPriceRow={withUnitPriceRow}\n withTiersRow={withTiersRow}\n withTrialLeftRow={withTrialLeftRow}\n key={plan.id}\n shouldShowDescriptionSection={shouldShowDescriptionSection}\n hasMonthlyPrice={hasMonthlyPrice}\n hasAnnuallyPrice={hasAnnuallyPrice}\n plan={plan}\n withStartingAtRow={withStartingAtRow}\n currentSubscription={currentSubscription}\n currentSubscriptionOverride={currentSubscriptionOverride}\n billingPeriod={selectedBillingPeriod}\n isHighlighted={plan.id === highlightedPlanId}\n isCustomerOnTrial={isCustomerOnTrial}\n onPlanSelected={(intentionType: SubscribeIntentionType, billableFeatures: BillableFeature[]) =>\n handleOnSubscribe(plan, intentionType, billableFeatures)\n }\n paywallLocale={paywallLocale}\n locale={locale}\n customer={customer}\n isCustomerInCustomPlan={isCustomerInCustomPlan}\n selectDefaultTierIndex={selectDefaultTierIndex}\n hideCompatibleAddons={hideCompatibleAddons}\n />\n ))}\n </PaywallPlansContainer>\n <PoweredByStigg\n source=\"paywall\"\n align=\"end\"\n style={{ marginTop: 16 }}\n showWatermark={stigg.isWidgetWatermarkEnabled}\n />\n </PaywallLayout>\n </PaywallContainer>\n );\n};\n","import { BillingPeriod, PricingType } from '@stigg/js-client-sdk';\nimport { ShouldHidePlanFn, PaywallPlan } from '../types';\nimport { hasPricePoints } from './hasPricePoints';\n\nexport function getPlansToDisplay(\n plans: PaywallPlan[],\n selectedBillingPeriod: BillingPeriod,\n shouldHidePlan?: ShouldHidePlanFn,\n): PaywallPlan[] {\n return plans\n .filter((plan) => plan.pricingType !== PricingType.Paid || hasPricePoints(plan, selectedBillingPeriod))\n .filter((plan) => !shouldHidePlan || !shouldHidePlan({ plan }));\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","export interface Logger {\n log: (message: string, object?: Record<string, string>) => void;\n debug: (message: string, object?: Record<string, string>) => void;\n error: (message: string, error?: Error, ...params: Record<string, string>[]) => void;\n}\n\nexport class LoggerService implements Logger {\n error(message: string, error?: Error, ...params: Record<string, string>[]): void {\n console.error(message, error || {}, params);\n }\n\n log(message: string, object?: Record<string, string>): void {\n console.log(message, object || {});\n }\n\n debug(message: string, object?: Record<string, string> | undefined): void {\n console.debug(message, object || {});\n }\n}\n\n// Export a singleton logger service, in the future we might allow to user to configure external logger\nexport default new LoggerService();\n","import { BillingPeriod, Plan, Subscription, SubscriptionStatus } from '@stigg/js-client-sdk';\nimport { countBy, uniq } from 'lodash';\n\nexport function computeBillingPeriods(\n plans: Plan[],\n activeSubscriptions?: Subscription[] | null,\n preferredBillingPeriod?: BillingPeriod,\n): { defaultBillingPeriod: BillingPeriod; availableBillingPeriods: BillingPeriod[] } {\n const billingPeriods = plans.flatMap((x) => x.pricePoints).map((x) => x.billingPeriod);\n const counts = countBy(billingPeriods);\n\n const availableBillingPeriods = uniq(billingPeriods);\n let defaultBillingPeriod: BillingPeriod | undefined;\n\n if (preferredBillingPeriod && availableBillingPeriods.includes(preferredBillingPeriod)) {\n defaultBillingPeriod = preferredBillingPeriod;\n } else if (activeSubscriptions) {\n const activeSubscription = activeSubscriptions.find((x) => x.status === SubscriptionStatus.Active);\n\n if (activeSubscription && activeSubscription.prices.length > 0) {\n defaultBillingPeriod = activeSubscription?.prices[0].billingPeriod;\n }\n }\n\n if (!defaultBillingPeriod) {\n defaultBillingPeriod =\n (counts[BillingPeriod.Monthly] || 0) > (counts[BillingPeriod.Annually] || 0)\n ? BillingPeriod.Monthly\n : BillingPeriod.Annually;\n }\n\n return { defaultBillingPeriod, availableBillingPeriods };\n}\n","import { FontWeight, TypographyConfiguration } from '@stigg/js-client-sdk';\n\nexport const defaultCheckoutTypography: TypographyConfiguration = {\n h1: {\n fontSize: 24,\n fontWeight: FontWeight.Bold,\n },\n h2: {\n fontSize: 16,\n fontWeight: FontWeight.Normal,\n },\n h3: {\n fontSize: 16,\n fontWeight: FontWeight.Normal,\n },\n body: {\n fontSize: 14,\n fontWeight: FontWeight.Normal,\n },\n};\n","import {\n Alignment,\n CheckoutConfiguration,\n CustomerPortalConfiguration,\n FontWeight as JSFontWeight,\n PaywallConfiguration,\n TypographyConfiguration,\n} from '@stigg/js-client-sdk';\nimport { CustomizedTheme } from '../../theme/Theme';\nimport { HorizontalAlignment, FontWeight } from '../../theme/types';\nimport { defaultCheckoutTypography } from '../checkout/configurations/typography';\n\nfunction addCssUnits(value?: number | null, unit = 'px') {\n if (!value) {\n return undefined;\n }\n return `${value}${unit}`;\n}\n\nfunction mapFontWeight(defaultValue: FontWeight, fontWeight?: JSFontWeight | null): FontWeight {\n if (!fontWeight) {\n return defaultValue;\n }\n\n switch (fontWeight) {\n case JSFontWeight.Normal:\n return 'normal';\n case JSFontWeight.Bold:\n return 'bold';\n default:\n return 'normal';\n }\n}\n\nexport function mapTypography(\n typography?: TypographyConfiguration | null,\n defaultTypography?: TypographyConfiguration | null,\n): CustomizedTheme['typography'] {\n return {\n fontFamilyUrl: typography?.fontFamily || undefined,\n h1: {\n fontSize: addCssUnits(typography?.h1?.fontSize || defaultTypography?.h1?.fontSize),\n fontWeight: mapFontWeight('bold', typography?.h1?.fontWeight || defaultTypography?.h1?.fontWeight),\n },\n h2: {\n fontSize: addCssUnits(typography?.h2?.fontSize || defaultTypography?.h2?.fontSize),\n fontWeight: mapFontWeight('normal', defaultTypography?.h2?.fontWeight),\n },\n h3: {\n fontSize: addCssUnits(typography?.h3?.fontSize || defaultTypography?.h3?.fontSize),\n fontWeight: mapFontWeight('normal', typography?.h3?.fontWeight || defaultTypography?.h3?.fontWeight),\n },\n body: {\n fontSize: addCssUnits(typography?.body?.fontSize || defaultTypography?.body?.fontSize),\n fontWeight: mapFontWeight('normal', typography?.body?.fontWeight || defaultTypography?.body?.fontWeight),\n },\n };\n}\n\nfunction mapAlignment(alignment?: Alignment | null): HorizontalAlignment | undefined {\n if (!alignment) {\n return undefined;\n }\n\n switch (alignment) {\n case Alignment.Left:\n return 'left';\n case Alignment.Center:\n return 'center';\n case Alignment.Right:\n return 'right';\n default: {\n return undefined;\n }\n }\n}\n\nexport function mapCustomerPortalConfiguration(configuration: CustomerPortalConfiguration): CustomizedTheme {\n const { palette, customCss, typography } = configuration;\n return {\n palette: {\n primary: palette?.primary || undefined,\n backgroundPaper: palette?.paywallBackgroundColor || undefined,\n outlinedBorder: palette?.borderColor || undefined,\n backgroundHighlight: palette?.currentPlanBackground || undefined,\n text: {\n primary: palette?.textColor || undefined,\n },\n },\n typography: mapTypography(typography),\n customCss: customCss || undefined,\n };\n}\n\nexport function mapPaywallConfiguration(paywallConfiguration: PaywallConfiguration): CustomizedTheme {\n const { palette, layout, customCss, typography } = paywallConfiguration;\n return {\n customCss: customCss || undefined,\n palette: {\n primary: palette?.primary || undefined,\n backgroundPaper: palette?.backgroundColor || undefined,\n outlinedBorder: palette?.borderColor || undefined,\n backgroundHighlight: palette?.currentPlanBackground || undefined,\n text: {\n primary: palette?.textColor || undefined,\n },\n },\n typography: mapTypography(typography),\n layout: {\n ctaAlignment: mapAlignment(layout?.alignment),\n headerAlignment: mapAlignment(layout?.alignment),\n descriptionAlignment: mapAlignment(layout?.alignment),\n planMaxWidth: addCssUnits(layout?.planWidth),\n planMinWidth: addCssUnits(layout?.planWidth),\n planMargin: addCssUnits(layout?.planMargin),\n planPadding: addCssUnits(layout?.planPadding),\n },\n };\n}\n\nexport function mapCheckoutConfiguration(configuration: CheckoutConfiguration): CustomizedTheme {\n const { palette, typography, customCss } = configuration;\n return {\n palette: {\n primary: palette?.primary || undefined,\n backgroundPaper: palette?.backgroundColor || undefined,\n outlinedBorder: palette?.borderColor || undefined,\n text: {\n primary: palette?.textColor || undefined,\n },\n backgroundHighlight: palette?.summaryBackgroundColor || undefined,\n },\n typography: mapTypography(typography, defaultCheckoutTypography),\n customCss: customCss || undefined,\n };\n}\n","<svg width=\"15\" height=\"11\" viewBox=\"0 0 15 11\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.59 7.9899L2.125 4.5249C1.73524 4.13514 1.10365 4.13402 0.712509 4.52241V4.52241C0.319409 4.91274 0.318286 5.54819 0.710005 5.9399L5.59 10.8199L14.2948 2.11513C14.6843 1.72565 14.6843 1.09417 14.2948 0.704691V0.704691C13.9055 0.315381 13.2743 0.315184 12.8848 0.70425L5.59 7.9899Z\" fill=\"#B2BBD3\"/>\n</svg>\n","import React, { useEffect, useState, PropsWithChildren, useRef } from 'react';\nimport * as StiggJs from '@stigg/js-client-sdk';\nimport Stigg, { ClientConfiguration, EntitlementsFallback } from '@stigg/js-client-sdk';\nimport { SkeletonTheme } from 'react-loading-skeleton';\nimport { CustomizedTheme } from '../theme/Theme';\nimport logger from '../services/logger';\nimport { name as CLIENT_NAME, version as CLIENT_VERSION } from '../../package.json';\n\nexport interface StiggContextValue {\n stigg: StiggJs.StiggClient;\n isInitialized: boolean;\n locale: string;\n updatedAt?: Date;\n customerPortalUpdatedAt?: Date;\n refreshData: () => Promise<void>;\n theme?: CustomizedTheme;\n}\n\nexport const StiggContext = React.createContext<StiggContextValue | null>(null);\nStiggContext.displayName = 'StiggContext';\n\nexport type StiggProviderProps = {\n apiKey: string;\n baseUri?: string;\n baseEdgeUri?: string;\n enableEdge?: boolean;\n entitlementsFallback?: EntitlementsFallback;\n customerId?: string;\n customerToken?: string;\n resourceId?: string;\n theme?: CustomizedTheme;\n locale?: string;\n offline?: boolean;\n cacheTtlMs?: number;\n /** @deprecated not longer in use */\n useEntitlementPolling?: boolean;\n /** @deprecated not longer in use */\n entitlementPollingInterval?: number;\n stiggClient?: StiggJs.StiggClient;\n clientName?: string;\n clientVersion?: string;\n};\n\nconst DEFAULT_LOCALE = 'en-US';\n\nexport const StiggProvider: React.FC<PropsWithChildren<StiggProviderProps>> = ({\n apiKey,\n baseUri,\n baseEdgeUri,\n enableEdge,\n customerId,\n customerToken,\n resourceId,\n theme,\n locale,\n cacheTtlMs,\n useEntitlementPolling,\n entitlementPollingInterval,\n entitlementsFallback,\n stiggClient,\n children,\n offline,\n clientName = CLIENT_NAME,\n clientVersion = CLIENT_VERSION,\n}) => {\n const currentApiKey = useRef(apiKey);\n const initializeParams: ClientConfiguration = {\n apiKey,\n customerId,\n customerToken,\n resourceId,\n baseUri,\n baseEdgeUri,\n enableEdge,\n entitlementsFallback,\n cacheTtlMs,\n useEntitlementPolling,\n entitlementPollingInterval,\n clientName,\n clientVersion,\n offline,\n };\n const [ctx, setContext] = useState<StiggContextValue>(() => ({\n stigg:\n stiggClient ??\n Stigg.initialize({\n ...initializeParams,\n lazyLoad: true,\n }),\n locale: locale || DEFAULT_LOCALE,\n isInitialized: false,\n theme,\n refreshData: async () => {\n setContext((ctx) => ({ ...ctx, customerPortalUpdatedAt: new Date() }));\n await ctx.stigg.refresh();\n },\n }));\n\n useEffect(() => {\n let isMounted = true;\n\n const safeSetContext = (setContextFunc: React.SetStateAction<StiggContextValue>) => {\n if (isMounted) {\n setContext(setContextFunc);\n }\n };\n\n const onEntitlementsUpdated = () => safeSetContext((ctx) => ({ ...ctx, updatedAt: new Date() }));\n\n const setStiggInstance = (stigg: StiggJs.StiggClient) =>\n safeSetContext((ctx) => {\n if (ctx.stigg) {\n ctx.stigg.removeListener('entitlementsUpdated', onEntitlementsUpdated);\n }\n stigg.addListener('entitlementsUpdated', onEntitlementsUpdated);\n\n return {\n ...ctx,\n stigg,\n isInitialized: true,\n updatedAt: new Date(),\n };\n });\n\n const loadStiggClient = async () => {\n let stiggClient = ctx.stigg;\n if (apiKey !== currentApiKey.current) {\n logger.log('Updating stigg client', { apiKey });\n currentApiKey.current = apiKey;\n stiggClient = Stigg.initialize({\n ...initializeParams,\n });\n safeSetContext((ctx) => ({ ...ctx, isInitialized: false, updatedAt: new Date() }));\n }\n await stiggClient.waitForInitialization();\n setStiggInstance(stiggClient);\n };\n\n void loadStiggClient();\n\n return () => {\n isMounted = false;\n ctx.stigg.removeListener('entitlementsUpdated', onEntitlementsUpdated);\n ctx.stigg.clearCustomer();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [apiKey]);\n\n useEffect(() => {\n const stiggClient = ctx.stigg;\n if (customerId) {\n void stiggClient.setCustomerId(customerId, customerToken, resourceId);\n } else {\n stiggClient.clearCustomer();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [customerId, customerToken, resourceId]);\n\n useEffect(() => {\n setContext((ctx) => ({ ...ctx, theme }));\n }, [theme]);\n\n return (\n <StiggContext.Provider value={ctx}>\n <SkeletonTheme baseColor=\"#F5F6F9\" highlightColor=\"#e5e6ea\">\n {children}\n </SkeletonTheme>\n </StiggContext.Provider>\n );\n};\n","import { useContext } from 'react';\nimport { StiggContext, StiggContextValue } from '../components/StiggProvider';\n\nexport function useStiggContext(options?: { optional?: false }): StiggContextValue;\nexport function useStiggContext(options: { optional: true }): StiggContextValue | null;\nexport function useStiggContext(options?: { optional?: boolean }): StiggContextValue | null {\n const { optional } = options || {};\n const ctx = useContext(StiggContext);\n if (!ctx && !optional) {\n throw new Error('Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.');\n }\n return ctx;\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport Skeleton from 'react-loading-skeleton';\nimport CheckUrl from '../../assets/check-stigg.svg';\n\nconst SkeletonContainer = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n`;\n\nconst EntitlementCheckIcon = styled(CheckUrl)`\n margin-right: 16px;\n`;\n\nconst PlanOfferingSkeleton = styled.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 20px;\n border-radius: 10px;\n padding: ${({ theme }) => theme.stigg.layout.planPadding};\n background-color: ${({ theme }) => theme.stigg.palette.backgroundPaper};\n min-width: ${({ theme }) => theme.stigg.layout.planMinWidth};\n max-width: ${({ theme }) => theme.stigg.layout.planMaxWidth};\n min-height: 450px;\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedBorder}`};\n`;\n\nconst PlansContainer = styled.div`\n display: flex;\n gap: ${({ theme }) => theme.stigg.layout.planMargin};\n flex-wrap: wrap;\n justify-content: center;\n`;\n\nconst EntitlementContainer = styled.div`\n display: flex;\n align-items: center;\n margin-bottom: 12px;\n`;\n\nconst FooterSkeletonLoader = styled.div`\n margin-top: auto;\n`;\n\nconst BillingPeriodLoader = styled.div`\n width: 150px;\n margin-bottom: ${({ theme }) => theme.stigg.layout.switchBottomSpacing};\n padding: 12px 12px;\n border-radius: 10px;\n background-color: white;\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedBorder}`};\n`;\n\nfunction PlanOfferingLoader() {\n return (\n <PlanOfferingSkeleton>\n <Skeleton width={120} borderRadius={4} />\n <Skeleton circle width={40} height={40} />\n <Skeleton style={{ marginBottom: 33 }} width={120} borderRadius={4} />\n\n <EntitlementContainer>\n <EntitlementCheckIcon />\n <Skeleton width={120} borderRadius={4} />\n </EntitlementContainer>\n <EntitlementContainer>\n <EntitlementCheckIcon />\n <Skeleton width={120} borderRadius={4} />\n </EntitlementContainer>\n <EntitlementContainer>\n <EntitlementCheckIcon />\n <Skeleton width={120} borderRadius={4} />\n </EntitlementContainer>\n\n <FooterSkeletonLoader>\n <Skeleton height={50} borderRadius={4} />\n </FooterSkeletonLoader>\n </PlanOfferingSkeleton>\n );\n}\n\nexport function PaywallLoader() {\n return (\n <SkeletonContainer className=\"stigg-skeleton-loader-container\">\n <BillingPeriodLoader className=\"stigg-skeleton-loader-billing-period\">\n <Skeleton borderRadius={4} />\n </BillingPeriodLoader>\n\n <PlansContainer className=\"stigg-skeleton-loader-plans-container\">\n <PlanOfferingLoader />\n <PlanOfferingLoader />\n <PlanOfferingLoader />\n </PlansContainer>\n </SkeletonContainer>\n );\n}\n","import React from 'react';\nimport { Global, css } from '@emotion/react';\n\nexport const Fonts = ({ externalFontUrl }: { externalFontUrl?: string }) => {\n return (\n <Global\n styles={css`\n ${externalFontUrl &&\n `\n @font-face {\n font-family: 'custom-font';\n font-style: normal;\n font-weight: normal;\n src: local('custom-font'), url(${externalFontUrl}) format('woff');\n }\n `}\n\n /* latin-ext */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Hp2ywxg089UriCZ2IHTWEBlwu8Q.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F,\n U+A720-A7FF;\n }\n /* latin */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Hp2ywxg089UriCZOIHTWEBlw.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,\n U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n }\n /* latin-ext */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Cp2ywxg089UriAWCrCBamC3YU-CnE6Q.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F,\n U+A720-A7FF;\n }\n /* latin */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Cp2ywxg089UriAWCrCBimC3YU-Ck.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,\n U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n }\n /* latin-ext */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 700;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Cp2ywxg089UriASitCBamC3YU-CnE6Q.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F,\n U+A720-A7FF;\n }\n /* latin */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 700;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Cp2ywxg089UriASitCBimC3YU-Ck.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,\n U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n }\n `}\n />\n );\n};\n","import { merge } from 'lodash';\nimport React, { PropsWithChildren } from 'react';\nimport { ThemeProvider as StyledThemeProvider } from 'styled-components';\nimport { TypographyProps } from 'styled-typography';\nimport { css, ThemeProvider } from '@emotion/react';\nimport styled from '@emotion/styled/macro';\nimport { createTheme, ThemeProvider as MuiThemeProvider, THEME_ID } from '@mui/material/styles';\n\nimport { DeepPartial } from '../types';\nimport { Fonts } from './Fonts';\nimport { getResolvedTheme } from './getResolvedTheme';\nimport { StiggTheme } from './types';\nimport { useStiggContext } from '../hooks/useStiggContext';\n\nexport type CustomizedTheme = DeepPartial<StiggTheme>;\n\nconst CustomCssGlobal = styled.div<{ customCss?: string }>`\n ${({ customCss }) =>\n customCss &&\n css`\n ${customCss}\n `}\n`;\n\ntype SdkThemeProviderProps = {\n componentTheme?: CustomizedTheme;\n};\n\n/*\n This merge the theme from 3 places:\n 1. External theme that we got from the user in StiggProvider\n 2. Remote theme from api\n 3. Default theme\n*/\nexport function useStiggTheme(remoteThemeOverride?: CustomizedTheme): StiggTheme {\n const { theme: externalTheme } = useStiggContext();\n const mergedTheme = merge(remoteThemeOverride, externalTheme);\n const resolvedTheme = getResolvedTheme(mergedTheme);\n\n return resolvedTheme;\n}\n\nfunction createTypographyTheme(theme: StiggTheme): Partial<TypographyProps> {\n const { typography } = theme;\n const htmlFontSize = 16;\n const coef = Number(typography.body.fontSize.replace('px', '')) / 14;\n\n return {\n // Hack to fix theming issues\n // @ts-ignore\n pxToRem: (size) => `${(size / htmlFontSize) * coef}rem`,\n bodyFontFamily: typography.fontFamily,\n headingFontFamily: typography.fontFamily,\n fontSizes: [\n typography.h1.fontSize,\n typography.h2.fontSize,\n typography.h3.fontSize,\n typography.body.fontSize,\n '12px',\n '10px',\n ],\n };\n}\n\nconst createMuiPalette = (theme: StiggTheme) => {\n return {\n primary: {\n main: theme.palette.primary,\n },\n };\n};\n\nexport const SdkThemeProvider: React.FC<PropsWithChildren<SdkThemeProviderProps>> = ({ children, componentTheme }) => {\n const theme = useStiggTheme(componentTheme);\n const muiPalette = createMuiPalette(theme);\n const materialTheme = createTheme({ palette: muiPalette, stigg: theme });\n\n return (\n // We are using styled-components theme here only because we are using styled-typography\n // which depends on styled-components for the typography theming\n <MuiThemeProvider theme={{ [THEME_ID]: materialTheme }}>\n <ThemeProvider theme={{ stigg: theme }}>\n <CustomCssGlobal customCss={theme.customCss}>\n <Fonts externalFontUrl={theme.typography.fontFamilyUrl} />\n <StyledThemeProvider theme={{ typography: createTypographyTheme(theme) }}>{children}</StyledThemeProvider>\n </CustomCssGlobal>\n </ThemeProvider>\n </MuiThemeProvider>\n );\n};\n","import React, { useContext } from 'react';\nimport { CustomerPortal } from '@stigg/js-client-sdk';\nimport { useCustomerPortal } from './hooks/useCustomerPortal';\nimport { DeepPartial } from '../../types';\nimport { CustomerPortalLocalization, getResolvedCustomerPortalLocalize } from './customerPortalTextOverrides';\nimport { CustomerPortalTheme, getResolvedCustomerPortalTheme } from './customerPortalTheme';\nimport { SdkThemeProvider, useStiggTheme } from '../../theme/Theme';\nimport { useStiggContext } from '../..';\nimport { mapCustomerPortalConfiguration } from '../common/mapExternalTheme';\n\nexport interface CustomerPortalContextValue {\n customerPortal?: CustomerPortal | null;\n textOverrides: CustomerPortalLocalization;\n theme: CustomerPortalTheme;\n isLoading: boolean;\n resourceId?: string;\n}\n\nexport const CustomerPortalContext = React.createContext<CustomerPortalContextValue | null>(null);\nCustomerPortalContext.displayName = 'CustomerPortalContext';\n\nexport const useCustomerPortalContext = (): CustomerPortalContextValue => {\n const ctx = useContext(CustomerPortalContext);\n if (!ctx) {\n throw new Error(\n 'Could not find Customer portal context; You need to wrap your customer portal components in an <CustomerPortalProvider> component.',\n );\n }\n return ctx;\n};\n\nexport function useCheckContextExists<T>(contextType: React.Context<T>) {\n const ctx = useContext(contextType);\n return !!ctx;\n}\n\nexport function CustomerPortalProvider({\n children,\n textOverrides,\n theme,\n resourceId,\n productId,\n}: {\n children: React.ReactNode;\n textOverrides?: DeepPartial<CustomerPortalLocalization>;\n theme?: DeepPartial<CustomerPortalTheme>;\n resourceId?: string;\n productId?: string;\n}) {\n const { customerPortalUpdatedAt } = useStiggContext();\n const { customerPortal, isLoading } = useCustomerPortal({ resourceId, productId });\n const configuration = customerPortal?.configuration\n ? mapCustomerPortalConfiguration(customerPortal.configuration)\n : undefined;\n const globalTheme = useStiggTheme(configuration);\n const customerPortalTheme = getResolvedCustomerPortalTheme(globalTheme, theme, customerPortal?.configuration);\n const resolvedTextOverrides = getResolvedCustomerPortalLocalize(textOverrides);\n\n return (\n <SdkThemeProvider componentTheme={configuration}>\n <CustomerPortalContext.Provider\n key={customerPortalUpdatedAt?.toString()}\n value={{\n customerPortal,\n isLoading,\n textOverrides: resolvedTextOverrides,\n theme: customerPortalTheme,\n resourceId,\n }}>\n {children}\n </CustomerPortalContext.Provider>\n </SdkThemeProvider>\n );\n}\n","import { CustomerPortalConfiguration } from '@stigg/js-client-sdk';\nimport { StiggTheme } from '../../theme/types';\nimport { DeepPartial } from '../../types';\n\nexport type CustomerPortalTheme = {\n sectionTitleColor: string;\n planNameColor: string;\n backgroundColor: string;\n borderColor: string;\n listItemBackgroundColor: string;\n tabMaxHeight: string;\n iconsColor?: string;\n iconsBackgroundColor?: string;\n};\n\nexport function getResolvedCustomerPortalTheme(\n globalTheme: StiggTheme,\n themeOverride?: DeepPartial<CustomerPortalTheme>,\n remoteConfiguration?: CustomerPortalConfiguration | null,\n) {\n const customerPortalDefaultTheme: CustomerPortalTheme = {\n sectionTitleColor: themeOverride?.sectionTitleColor || globalTheme.palette.text.secondary,\n planNameColor: themeOverride?.planNameColor || globalTheme.palette.text.primary,\n backgroundColor: themeOverride?.backgroundColor || remoteConfiguration?.palette?.backgroundColor || 'white',\n borderColor: themeOverride?.borderColor || remoteConfiguration?.palette?.borderColor || 'rgba(0, 30, 108, 0.15)',\n listItemBackgroundColor: themeOverride?.backgroundColor || remoteConfiguration?.palette?.backgroundColor || 'white',\n tabMaxHeight: themeOverride?.tabMaxHeight || '380px',\n\n // add icons background color and apply to scheduled updates and customer support icons\n iconsColor: themeOverride?.iconsColor || remoteConfiguration?.palette?.iconsColor || undefined,\n iconsBackgroundColor: themeOverride?.iconsBackgroundColor,\n };\n\n return customerPortalDefaultTheme;\n}\n","import { CustomerPortal } from '@stigg/js-client-sdk';\nimport { useEffect, useState } from 'react';\nimport logger from '../../../services/logger';\nimport { useStiggContext } from '../../../hooks/useStiggContext';\n\ntype UseCustomerPortalProps = {\n resourceId?: string;\n productId?: string;\n};\n\nexport function useCustomerPortal({ resourceId, productId }: UseCustomerPortalProps) {\n const { stigg, customerPortalUpdatedAt } = useStiggContext();\n const [isLoading, setIsLoading] = useState(false);\n const [customerPortal, setCustomerPortal] = useState<CustomerPortal | null>();\n\n useEffect(() => {\n const loadCustomerPortal = async () => {\n if (stigg.isCustomerLoaded) {\n try {\n setIsLoading(true);\n const customerPortalData = await stigg.getCustomerPortal({ resourceId, productId });\n setCustomerPortal(customerPortalData);\n } catch (err) {\n logger.error(`Failed to load customer portal ${(err as any)?.message}`, err as any);\n } finally {\n setIsLoading(false);\n }\n }\n };\n\n void loadCustomerPortal();\n }, [stigg, stigg.isCustomerLoaded, customerPortalUpdatedAt, resourceId, productId]);\n\n return {\n customerPortal,\n isLoading,\n };\n}\n","import merge from 'lodash/merge';\nimport { DeepPartial } from '../../types';\n\nexport type CustomerPortalLocalization = {\n manageSubscription: string;\n usageTabTitle: string;\n addonsTabTitle: string;\n promotionsTabTitle: string;\n promotionsSubtitle: string;\n contactSupportTitle: string;\n contactSupportLink: string;\n editBilling: string;\n invoicesTitle: string;\n viewInvoiceHistory: string;\n editPaymentDetails: string;\n paywallSectionTitle: string;\n cancelScheduledUpdatesButtonTitle: string;\n};\n\nexport function getResolvedCustomerPortalLocalize(\n localizeOverride?: DeepPartial<CustomerPortalLocalization>,\n): CustomerPortalLocalization {\n const customerPortalDefaultLocalization: CustomerPortalLocalization = {\n manageSubscription: 'Manage',\n usageTabTitle: 'Usage',\n addonsTabTitle: 'Add-ons',\n promotionsTabTitle: 'Promotions',\n promotionsSubtitle: 'You were granted access to additional functionality at no additional cost.',\n contactSupportTitle: 'Have questions about your subscription?',\n contactSupportLink: 'Contact support',\n editBilling: 'Edit billing details',\n invoicesTitle: 'Invoices',\n viewInvoiceHistory: 'View invoice history',\n editPaymentDetails: 'Edit',\n paywallSectionTitle: 'Plans',\n cancelScheduledUpdatesButtonTitle: 'Cancel',\n };\n return merge(customerPortalDefaultLocalization, localizeOverride);\n}\n","<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M13.3333 2.5L17.5 6.66667L6.66667 17.5H2.5V13.3333L13.3333 2.5V2.5Z\" stroke=\"#327EEE\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","import styled from '@emotion/styled/macro';\nimport MuiButton from '@mui/material/Button';\n\nexport const StyledButton = styled(MuiButton)`\n border-radius: 10px;\n padding: 8px 16px;\n text-transform: none;\n\n &,\n &:hover {\n border-color: ${({ theme }) => theme.stigg.palette.outlinedRestingBorder};\n }\n`;\n","import { CustomerPortalEntitlement, CustomerPortalSubscription } from '@stigg/js-client-sdk';\nimport { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';\n\nexport type OnBuyMoreCallbackFn = (feature: FeatureFragment, entitlement: CustomerPortalEntitlement) => void;\n\nexport type FilterEntitlementsFn = (entitlements: CustomerPortalEntitlement[]) => CustomerPortalEntitlement[];\n\nexport enum CustomerPortalIntentionType {\n MANAGE_SUBSCRIPTION = 'MANAGE_SUBSCRIPTION',\n UPGRADE_PLAN = 'UPGRADE_PLAN',\n UPGRADE_TRIAL_PLAN = 'UPGRADE_TRIAL_PLAN',\n}\n\nexport type OnManageSubscriptionFn = ({\n intentionType,\n customerSubscriptions,\n}: {\n intentionType: CustomerPortalIntentionType;\n customerSubscriptions: CustomerPortalSubscription[];\n}) => Promise<void> | void;\n","import styled from '@emotion/styled/macro';\n\nexport const SectionHeader = styled.div<{ $disableMargin?: boolean }>`\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n ${({ $disableMargin }) =>\n !$disableMargin &&\n `\n &:not(:last-child) {\n margin-bottom: 32px;\n }\n `};\n`;\n","import React from 'react';\nimport Skeleton from 'react-loading-skeleton';\nimport { Typography } from '../../common/Typography';\nimport { useCustomerPortalContext } from '../CustomerPortalProvider';\n\nexport type SectionTitleProps = {\n title: string;\n className: string;\n isLoading?: boolean;\n};\n\nexport function SectionTitle({ title, className, isLoading }: SectionTitleProps) {\n const { theme } = useCustomerPortalContext();\n\n if (isLoading) {\n return <Skeleton width={120} />;\n }\n\n return (\n <Typography className={className} overrideColor={theme.sectionTitleColor} variant=\"h3\" bold>\n {title}\n </Typography>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { StyledButton } from '../common/StyledButton';\nimport { Typography } from '../../common/Typography';\nimport EditIcon from '../../../assets/edit-icon.svg';\nimport { CustomerPortalLocalization } from '../customerPortalTextOverrides';\nimport { SectionHeader } from '../common/SectionHeader';\nimport { SectionTitle } from '../common/SectionTitle';\nimport { OnManageClick } from '../CustomerPortalContainer';\nimport { CustomerPortalIntentionType } from '../types';\n\ntype SubscriptionsOverviewHeaderProps = {\n onManageSubscription: OnManageClick;\n hideManageButton: boolean;\n textOverrides: CustomerPortalLocalization;\n};\n\nconst StyledEditIcon = styled(EditIcon)`\n path {\n stroke: ${({ theme }) => theme.stigg.palette.primary};\n }\n`;\n\nexport function SubscriptionsOverviewHeader({\n onManageSubscription,\n hideManageButton,\n textOverrides,\n}: SubscriptionsOverviewHeaderProps) {\n return (\n <SectionHeader className=\"stigg-customer-portal-overview-header\" $disableMargin>\n <SectionTitle title=\"Subscription\" className=\"stigg-overview-title\" />\n {!hideManageButton && (\n <StyledButton\n className=\"stigg-manage-subscription-button\"\n variant=\"outlined\"\n onClick={() => onManageSubscription({ intentionType: CustomerPortalIntentionType.MANAGE_SUBSCRIPTION })}>\n <StyledEditIcon className=\"stigg-manage-subscription-button-image\" />\n <Typography\n className=\"stigg-manage-subscription-button-text\"\n color=\"primary.main\"\n style={{ marginLeft: '8px' }}\n variant=\"body1\">\n {textOverrides?.manageSubscription}\n </Typography>\n </StyledButton>\n )}\n </SectionHeader>\n );\n}\n","import flatMap from 'lodash/flatMap';\nimport isEmpty from 'lodash/isEmpty';\nimport React from 'react';\nimport { Typography } from '../../../common/Typography';\nimport { useCustomerPortalContext } from '../../CustomerPortalProvider';\n\nexport function AddonsList() {\n const { customerPortal } = useCustomerPortalContext();\n const addons = flatMap(customerPortal?.subscriptions, (subscription) => subscription.addons);\n if (isEmpty(addons)) {\n return null;\n }\n\n return (\n <div className=\"stigg-addons-list-layout\">\n {addons.map((addon, index) => (\n <Typography key={addon.addonId} span className=\"stigg-addon-list-item-text\" variant=\"body1\">\n {addon.quantity > 1 && `${addon.quantity} X `}\n {addon.displayName}\n {index === addons.length - 1 ? '' : ', '}\n </Typography>\n ))}\n </div>\n );\n}\n","import { CustomerPortalPromotionalEntitlement } from '@stigg/js-client-sdk';\nimport moment from 'moment';\nimport React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { Typography } from '../../../common/Typography';\nimport { useCustomerPortalContext } from '../../CustomerPortalProvider';\n\nconst Row = styled.div<{ $borderColor: string }>`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 64px;\n border-bottom: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n padding: 16px 0;\n\n & > *:first-of-type {\n max-width: 60%;\n }\n`;\n\nfunction getPromotionTitle(promotionalEntitlement: CustomerPortalPromotionalEntitlement) {\n const { displayName, usageLimit, hasUnlimitedUsage } = promotionalEntitlement;\n\n if (hasUnlimitedUsage) {\n return `Unlimited ${displayName}`;\n }\n if (usageLimit) {\n return `${displayName} x ${promotionalEntitlement.usageLimit?.toLocaleString()}`;\n }\n\n return displayName;\n}\n\nexport function Promotions() {\n const { customerPortal, textOverrides, theme } = useCustomerPortalContext();\n const promotionalEntitlements = customerPortal?.promotionalEntitlements;\n\n return (\n <div style={{ display: 'flex', flexDirection: 'column' }}>\n <Typography color=\"secondary\">{textOverrides.promotionsSubtitle}</Typography>\n <div style={{ display: 'flex', flexDirection: 'column' }}>\n <Row $borderColor={theme.borderColor}>\n <Typography variant=\"body1\" bold>\n Feature\n </Typography>\n <Typography variant=\"body1\" bold>\n Expiration date\n </Typography>\n </Row>\n {promotionalEntitlements?.map((promotionalEntitlement, index) => (\n <Row key={`${promotionalEntitlement.displayName}-${index}`} $borderColor={theme.borderColor}>\n <Typography variant=\"body1\">{getPromotionTitle(promotionalEntitlement)}</Typography>\n <Typography variant=\"body1\" color=\"disabled\">\n {promotionalEntitlement.endDate\n ? moment.utc(promotionalEntitlement.endDate).format('MMM Do, YYYY')\n : 'None'}\n </Typography>\n </Row>\n ))}\n </div>\n </div>\n );\n}\n","import styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport Tabs from '@mui/material/Tabs';\n\nexport const StyledTabs = styled(Tabs)`\n .MuiTabs-indicator {\n background-color: #001e6c;\n }\n`;\n\nexport const TabsLayout = styled.div`\n width: 100%;\n flex: 1;\n margin-top: 16px;\n`;\n\nexport const TabContent = styled(Box, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{ $maxHeight: string }>`\n margin-top: 16px;\n max-height: ${({ $maxHeight }) => $maxHeight};\n overflow-y: auto;\n`;\n\nexport const ListBox = styled.div<{ $backgroundColor: string; $borderColor: string }>`\n display: flex;\n flex-direction: column;\n padding: 24px;\n border: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n border-radius: 10px;\n margin-bottom: 16px;\n row-gap: 16px;\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n`;\n","import React, { useState } from 'react';\nimport { CustomerPortal } from '@stigg/js-client-sdk';\nimport flatMap from 'lodash/flatMap';\nimport Box from '@mui/material/Box';\nimport Tab from '@mui/material/Tab';\nimport { FontWeight } from 'styled-typography';\nimport { Typography } from '../../../common/Typography';\nimport { AddonsList } from './AddonsList';\nimport { Promotions } from './Promotions';\nimport { CustomerPortalSection } from '../../CustomerPortal';\nimport { CustomerPortalLocalization } from '../../customerPortalTextOverrides';\nimport { StyledTabs, TabContent, TabsLayout } from './SubscriptionTabs.style';\nimport { CustomerPortalTheme } from '../../customerPortalTheme';\nimport { Icon, Icons } from '../../../common/Icon';\n\ntype TabPanelProps = {\n children?: React.ReactNode;\n index: number;\n value: number;\n maxHeight: string;\n};\n\nfunction TabPanel(props: TabPanelProps) {\n const { children, value, index, maxHeight, ...other } = props;\n\n return (\n <div role=\"tabpanel\" hidden={value !== index} {...other}>\n {value === index && <TabContent $maxHeight={maxHeight}>{children}</TabContent>}\n </div>\n );\n}\n\nexport type SubscriptionTabsProps = {\n customerPortal: CustomerPortal;\n hiddenSections?: CustomerPortalSection[];\n textOverrides: CustomerPortalLocalization;\n theme: CustomerPortalTheme;\n};\n\nfunction TabTitle({ isSelected, label, icon }: { isSelected: boolean; label: string; icon: Icons }) {\n const color = isSelected ? 'primary' : 'secondary';\n return (\n <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>\n <Icon icon={icon} svgStrokeColor={color} />\n <Typography variant=\"h6\" bold={isSelected} fontWeight={FontWeight.Medium} color={color}>\n {label}\n </Typography>\n </div>\n );\n}\n\nexport function SubscriptionTabs({ customerPortal, hiddenSections, textOverrides, theme }: SubscriptionTabsProps) {\n const allAddons = flatMap(customerPortal.subscriptions, (subscription) => subscription.addons);\n const isSectionHidden = (sectionName: CustomerPortalSection) =>\n hiddenSections?.some((section) => section === sectionName);\n const showAddons = allAddons.length > 0 && !isSectionHidden('addons');\n const showPromotions =\n customerPortal.promotionalEntitlements.length > 0 && !isSectionHidden('promotionalEntitlements');\n const [value, setValue] = useState(showAddons ? 1 : 2);\n\n const handleChange = (_: React.SyntheticEvent, newValue: number) => {\n setValue(newValue);\n };\n const shouldShowTabs = showAddons || showPromotions;\n\n if (!shouldShowTabs) {\n return null;\n }\n\n return (\n <TabsLayout>\n <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>\n <StyledTabs value={value} onChange={handleChange}>\n {showAddons ? (\n <Tab\n sx={{ textTransform: 'none' }}\n value={1}\n label={<TabTitle isSelected={value === 1} label={textOverrides.addonsTabTitle} icon=\"Addons\" />}\n />\n ) : null}\n {showPromotions ? (\n <Tab\n sx={{ textTransform: 'none' }}\n value={2}\n label={<TabTitle isSelected={value === 2} label={textOverrides.promotionsTabTitle} icon=\"Promotions\" />}\n />\n ) : null}\n </StyledTabs>\n </Box>\n <TabPanel value={value} index={1} maxHeight={theme.tabMaxHeight}>\n <AddonsList />\n </TabPanel>\n <TabPanel value={value} index={2} maxHeight={theme.tabMaxHeight}>\n <Promotions />\n </TabPanel>\n </TabsLayout>\n );\n}\n","export const breakpoints = {\n xs: 320,\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n xxl: 1536,\n} as const;\n\nexport type Breakpoints = typeof breakpoints;\n\nexport type Breakpoint = keyof Breakpoints;\n\nexport const mqMinWidth = (breakpoint: Breakpoint) => `(min-width: ${breakpoints[breakpoint]}px)`;\n\nexport const mq = Object.keys(breakpoints).reduce(\n (obj, breakpoint) => ({ ...obj, [breakpoint]: `@media ${mqMinWidth(breakpoint as Breakpoint)}` }),\n {} as Record<Breakpoint, string>,\n);\n","import { useMediaQuery as useMediaQueryMui } from '@mui/material';\nimport { Breakpoint, mqMinWidth } from '../common/mediaQuery';\n\nexport function useIsScreenWiderThan(breakpoint: Breakpoint) {\n return useMediaQueryMui(mqMinWidth(breakpoint));\n}\n","import styled from '@emotion/styled/macro';\nimport React from 'react';\nimport Skeleton from 'react-loading-skeleton';\nimport { useIsScreenWiderThan } from '../../hooks/useIsScreenWiderThan';\n\nconst SkeletonLayout = styled.div`\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n`;\n\nconst SkeletonLayoutLeft = styled.div`\n display: flex;\n flex-direction: column;\n gap: 32px;\n`;\n\nexport function SubscriptionOverviewLoader() {\n const isScreenWiderThanMd = useIsScreenWiderThan('md');\n return (\n <SkeletonLayout className=\"stigg-subscription-overview-skeleton-layout\">\n <SkeletonLayoutLeft>\n <Skeleton width={120} />\n <Skeleton width={120} />\n </SkeletonLayoutLeft>\n <Skeleton width={isScreenWiderThanMd ? 295 : 260} height={193} />\n </SkeletonLayout>\n );\n}\n","import React from 'react';\nimport { ArrowDown } from 'react-feather';\nimport Grid from '@mui/material/Grid';\nimport {\n CustomerPortalSubscription,\n CustomerPortalSubscriptionScheduledUpdateDataFragment,\n SubscriptionScheduleType,\n BillingPeriod,\n} from '@stigg/js-client-sdk';\nimport { compact, map } from 'lodash';\nimport { Typography } from '../../../common/Typography';\nimport { BillingPeriodChangeVariables, UnitAmountChangeVariables } from '../../../../types';\n\nexport type SubscriptionScheduledUpdateRowProps = {\n scheduleUpdate: CustomerPortalSubscriptionScheduledUpdateDataFragment;\n};\n\nfunction SubscriptionScheduledUpdateDowngradeRow({ scheduleUpdate }: SubscriptionScheduledUpdateRowProps) {\n const { targetPackage } = scheduleUpdate;\n return (\n <Grid container alignItems=\"center\">\n <Grid>\n <ArrowDown color=\"#D94052\" height={20} className=\"stigg-scheduled-updates-arrow-down\" />\n </Grid>\n <Grid item>\n <Typography className=\"stigg-scheduled-updates-description\" variant=\"body1\">\n Downgrade to the <b>{targetPackage?.displayName}</b> plan\n </Typography>\n </Grid>\n </Grid>\n );\n}\n\nfunction SubscriptionScheduledUpdateBillingPeriodChangeRow({ scheduleUpdate }: SubscriptionScheduledUpdateRowProps) {\n const { scheduleVariables } = scheduleUpdate;\n const { billingPeriod } = scheduleVariables as BillingPeriodChangeVariables;\n const currentBillingPeriod = billingPeriod === BillingPeriod.Monthly ? 'annually' : 'monthly';\n const nextBillingPeriod = billingPeriod === BillingPeriod.Monthly ? 'monthly' : 'annually';\n\n return (\n <Grid container alignItems=\"center\">\n <Grid>\n <ArrowDown color=\"#D94052\" height={20} className=\"stigg-scheduled-updates-arrow-down\" />\n </Grid>\n <Grid item>\n <Typography className=\"stigg-scheduled-updates-description\" variant=\"body1\">\n Change from an {currentBillingPeriod} to a <b>{nextBillingPeriod}</b> billing cycle\n </Typography>\n </Grid>\n </Grid>\n );\n}\n\nfunction SubscriptionScheduledUpdateUnitQuantityChangeRow({\n subscription,\n scheduleUpdate,\n}: SubscriptionScheduledUpdateRowProps & { subscription: CustomerPortalSubscription }) {\n const { scheduleVariables } = scheduleUpdate;\n const { newUnitAmount, featureId } = scheduleVariables as UnitAmountChangeVariables;\n const feature = compact(map(subscription.prices, 'feature')).find(({ id }) => id === featureId);\n\n if (!feature) {\n return null;\n }\n\n const { featureUnits, featureUnitsPlural } = feature;\n const newQuantityUnits = newUnitAmount === 1 ? featureUnits : featureUnitsPlural;\n\n return (\n <Grid container alignItems=\"flex-start\" flexWrap=\"nowrap\">\n <Grid>\n <ArrowDown color=\"#D94052\" height={20} className=\"stigg-scheduled-updates-arrow-down\" />\n </Grid>\n <Grid item>\n <Typography className=\"stigg-scheduled-updates-description\" variant=\"body1\">\n Reduce the <b>{featureUnits}</b> quantity to {newUnitAmount} {newQuantityUnits}\n </Typography>\n </Grid>\n </Grid>\n );\n}\n\nexport function SubscriptionScheduledUpdateRow({\n scheduleUpdate,\n subscription,\n}: {\n scheduleUpdate: CustomerPortalSubscriptionScheduledUpdateDataFragment;\n subscription: CustomerPortalSubscription;\n}) {\n switch (scheduleUpdate.subscriptionScheduleType) {\n case SubscriptionScheduleType.Downgrade: {\n return <SubscriptionScheduledUpdateDowngradeRow scheduleUpdate={scheduleUpdate} />;\n }\n\n case SubscriptionScheduleType.BillingPeriod: {\n return <SubscriptionScheduledUpdateBillingPeriodChangeRow scheduleUpdate={scheduleUpdate} />;\n }\n\n case SubscriptionScheduleType.UnitAmount: {\n return (\n <SubscriptionScheduledUpdateUnitQuantityChangeRow scheduleUpdate={scheduleUpdate} subscription={subscription} />\n );\n }\n\n default: {\n return null;\n }\n }\n}\n","import React, { useState } from 'react';\nimport Box from '@mui/material/Box';\nimport Grid from '@mui/material/Grid';\nimport { CustomerPortalSubscription } from '@stigg/js-client-sdk';\nimport styled from '@emotion/styled/macro';\nimport { useTheme } from '@emotion/react';\nimport ClipLoader from 'react-spinners/ClipLoader';\nimport { CustomerPortalTheme } from '../../customerPortalTheme';\nimport Restore from '../../../../assets/restore.svg';\nimport { Icon } from '../../../common/Icon';\nimport { Typography } from '../../../common/Typography';\nimport { SubscriptionScheduledUpdateRow } from './SubscriptionScheduledUpdateRow';\nimport { getSubscriptionScheduleUpdateTexts } from '../../../utils/getSubscriptionScheduleUpdateTexts';\nimport { StyledButton } from '../../common/StyledButton';\n\nexport type SubscriptionScheduledUpdatesAlertProps = {\n subscription: CustomerPortalSubscription;\n onCancelScheduledUpdates?: (subscription: CustomerPortalSubscription) => void;\n theme: CustomerPortalTheme;\n cancelScheduledUpdatesButtonTitle: string;\n};\n\nconst SubscriptionScheduleUpdateAlertContainer = styled(Box)<{ $borderColor: string }>`\n border-bottom: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n margin: -64px -64px 64px -64px;\n padding: 24px 32px;\n`;\n\nconst LoadingIndicator = styled(ClipLoader)`\n margin-left: 4px;\n`;\n\nconst StyledRestoreIcon = styled(Restore)`\n color: ${({ theme }) => theme.stigg.palette.primary};\n path {\n fill: ${({ theme }) => theme.stigg.palette.primary};\n }\n`;\n\nfunction MultipleScheduledUpdates({ subscription }: Pick<SubscriptionScheduledUpdatesAlertProps, 'subscription'>) {\n const { scheduledUpdates } = subscription;\n\n return (\n <>\n <Grid container alignItems=\"center\" justifyContent=\"space-between\" gap={1}>\n <Grid>\n <Typography className=\"stigg-scheduled-updates-description\" variant=\"body1\">\n The following updates will take effect in the next billing cycle:\n </Typography>\n </Grid>\n </Grid>\n <Grid>\n {(scheduledUpdates || []).map((scheduleUpdate) => (\n <SubscriptionScheduledUpdateRow\n key={scheduleUpdate.subscriptionScheduleType}\n scheduleUpdate={scheduleUpdate}\n subscription={subscription}\n />\n ))}\n </Grid>\n </>\n );\n}\n\nfunction SingleScheduledUpdate({ subscription }: Pick<SubscriptionScheduledUpdatesAlertProps, 'subscription'>) {\n const { scheduledUpdates } = subscription;\n const [scheduledUpdate] = scheduledUpdates || [];\n\n const { line1, line2 } = getSubscriptionScheduleUpdateTexts({\n scheduledUpdate,\n subscriptionPrices: subscription.prices,\n billingPeriodRange: subscription.billingPeriodRange,\n options: {\n postfix: 'at the end of the current billing period', // We can later remove this if unnecessary\n },\n });\n\n return (\n <>\n <Grid container alignItems=\"center\" justifyContent=\"space-between\" gap={1}>\n <Grid>\n <Typography className=\"stigg-scheduled-updates-title\" variant=\"body1\" color=\"primary\">\n {line1}\n </Typography>\n </Grid>\n </Grid>\n {line2 && (\n <Grid>\n <Typography className=\"stigg-scheduled-updates-subtitle\" variant=\"body1\" color=\"secondary\">\n {line2}\n </Typography>\n </Grid>\n )}\n </>\n );\n}\n\nexport function SubscriptionScheduledUpdatesAlert({\n subscription,\n onCancelScheduledUpdates,\n theme,\n cancelScheduledUpdatesButtonTitle,\n}: SubscriptionScheduledUpdatesAlertProps) {\n const stiggTheme = useTheme();\n const [isLoading, setIsLoading] = useState(false);\n const { scheduledUpdates } = subscription;\n\n if (!scheduledUpdates || scheduledUpdates.length === 0) {\n return null;\n }\n\n const isSingleScheduledUpdate = scheduledUpdates.length === 1;\n\n return (\n <SubscriptionScheduleUpdateAlertContainer\n $borderColor={theme.borderColor}\n className=\"stigg-scheduled-updates-alert-container\">\n <Grid container alignItems={isSingleScheduledUpdate ? 'center' : 'flex-start'} gap={2}>\n <Grid item display=\"flex\">\n <Icon icon=\"ScheduleBox\" svgPathColor={theme.iconsColor} svgRectColor={theme.iconsBackgroundColor} />\n </Grid>\n\n <Grid item flex={1}>\n {isSingleScheduledUpdate ? (\n <SingleScheduledUpdate subscription={subscription} />\n ) : (\n <MultipleScheduledUpdates subscription={subscription} />\n )}\n </Grid>\n\n {!!onCancelScheduledUpdates && (\n <Grid item>\n <StyledButton\n variant=\"outlined\"\n onClick={() => {\n setIsLoading(true);\n Promise.resolve(onCancelScheduledUpdates(subscription)).finally(() => setIsLoading(false));\n }}>\n {isLoading ? (\n <LoadingIndicator loading size={16} color={stiggTheme.stigg.palette.text.disabled} />\n ) : (\n <StyledRestoreIcon\n style={{ display: 'flex', marginRight: 4 }}\n className=\"stigg-scheduled-updates-cancel-update-button-icon\"\n />\n )}\n <Typography variant=\"body1\" color=\"primary.main\" className=\"stigg-scheduled-updates-cancel-update-button\">\n {cancelScheduledUpdatesButtonTitle}\n </Typography>\n </StyledButton>\n </Grid>\n )}\n </Grid>\n </SubscriptionScheduleUpdateAlertContainer>\n );\n}\n","import styled from '@emotion/styled/macro';\nimport { mq } from '../../common/mediaQuery';\n\nexport const SectionContainer = styled.div<{ $backgroundColor: string; $borderColor: string }>`\n width: 100%;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n border: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n\n padding: 16px;\n ${mq.sm} {\n padding: 32px;\n }\n ${mq.md} {\n padding: 48px;\n }\n ${mq.lg} {\n padding: 64px;\n }\n`;\n","import { BillingPeriod, Currency } from '@stigg/js-client-sdk';\nimport moment from 'moment';\nimport React from 'react';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { Typography } from '../../../common/Typography';\n\nexport type NextEstimatedBillProps = {\n billingPeriod: BillingPeriod;\n rangeEnd: string;\n amount: number;\n currency: Currency;\n};\n\nexport function NextEstimatedBill({ billingPeriod, rangeEnd, amount, currency }: NextEstimatedBillProps) {\n return (\n <>\n <Typography variant=\"h6\">Next estimated bill</Typography>\n <Typography variant=\"h1\">{currencyPriceFormatter({ amount, currency, maximumFractionDigits: 2 })}</Typography>\n <Typography as=\"div\" variant=\"body1\" color=\"secondary\">\n Billed {billingPeriod === BillingPeriod.Monthly ? 'monthly' : 'annually'} on{' '}\n <Typography variant=\"body1\" span color=\"primary\">\n {moment.utc(rangeEnd).format('MMM Do, YYYY')}\n </Typography>\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n * Additional tax rates may apply\n </Typography>\n </>\n );\n}\n","import React from 'react';\nimport { Typography } from '../../../common/Typography';\n\ntype NoUpcomingBillingProps = {\n description: string;\n};\n\nexport function NoUpcomingBilling({ description }: NoUpcomingBillingProps) {\n return (\n <>\n <Typography variant=\"h6\" color=\"secondary\">\n No upcoming bill\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n {description}\n </Typography>\n </>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport Button from '@mui/material/Button';\nimport { Typography } from '../../common/Typography';\n\nconst ContactCustomerSupportLayout = styled.div`\n display: flex;\n flex-direction: column;\n align-items: left;\n gap: 8px;\n`;\n\nconst ContactSupportButton = styled(Button)`\n width: fit-content;\n &.MuiButton-root {\n padding: 0;\n &:hover {\n background: none;\n }\n }\n`;\n\ntype ContactCustomerSupportProps = {\n onContactSupport?: () => void;\n label: string;\n linkLabel: string;\n};\n\nexport function ContactCustomerSupport({ onContactSupport, label, linkLabel }: ContactCustomerSupportProps) {\n const contactSupportText = (\n <Typography color={onContactSupport ? 'primary.main' : 'secondary'}>{linkLabel}</Typography>\n );\n return (\n <ContactCustomerSupportLayout className=\"stigg-contact-support-layout\">\n <Typography className=\"stigg-contact-support-label\" color=\"secondary\">\n {label}\n </Typography>\n {onContactSupport ? (\n <ContactSupportButton\n className=\"stigg-contact-support-button\"\n style={{ textTransform: 'none' }}\n variant=\"text\"\n onClick={onContactSupport}>\n {contactSupportText}\n </ContactSupportButton>\n ) : (\n contactSupportText\n )}\n </ContactCustomerSupportLayout>\n );\n}\n","<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12.9469 13.5999H11.9344L11.935 10.7756C11.935 10.6288 11.87 10.4819 11.7557 10.3838L8.62061 7.91816L11.755 5.4532C11.8694 5.35507 11.9344 5.22444 11.9344 5.06132L11.935 2.40004H12.9475C13.225 2.40004 13.4375 2.18755 13.4375 1.91004C13.4375 1.63254 13.225 1.42004 12.9475 1.42004L3.05311 1.42067C2.77561 1.42067 2.56311 1.63316 2.56311 1.91067C2.56311 2.18817 2.77561 2.40067 3.05311 2.40067H4.06561L4.06498 5.06131C4.06498 5.20818 4.12998 5.35505 4.24436 5.45318L7.36244 7.91814L4.245 10.3837C4.13062 10.4819 4.06562 10.6125 4.06562 10.7756V13.5999H3.05313C2.77562 13.5999 2.56313 13.8124 2.56313 14.0899C2.56313 14.3674 2.77562 14.5799 3.05313 14.5799H12.9469C13.2244 14.5799 13.4369 14.3674 13.4369 14.0899C13.4369 13.8124 13.2244 13.5999 12.9469 13.5999ZM5.04498 2.39995H10.9551V4.81627L8.00002 7.16747L5.04498 4.81627V2.39995ZM5.04498 11.0206L8.00002 8.66939L10.9551 11.0044V13.5838H5.04498V11.0206Z\" fill=\"white\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M3.05303 1.25404L12.9474 1.25342C13.317 1.25342 13.6041 1.54053 13.6041 1.91008C13.6041 2.27964 13.317 2.56675 12.9474 2.56675H12.1016L12.101 5.06136V5.06136C12.101 5.2747 12.0135 5.45101 11.8635 5.57973L11.8581 5.58436L8.89014 7.9182L11.8642 10.2572C12.0164 10.3878 12.1016 10.5814 12.1016 10.7757L12.101 13.4333H12.9468C13.3164 13.4333 13.6035 13.7204 13.6035 14.09C13.6035 14.4595 13.3164 14.7466 12.9468 14.7466H3.05304C2.68349 14.7466 2.39638 14.4595 2.39638 14.09C2.39638 13.7204 2.68349 13.4333 3.05304 13.4333H3.89887V10.7757C3.89887 10.5623 3.98635 10.386 4.13639 10.2573L4.14144 10.253L7.09365 7.91821L4.13566 5.57982C3.98346 5.44923 3.89823 5.25562 3.89823 5.06135L3.89882 2.56738H3.05303C2.68348 2.56738 2.39636 2.28026 2.39636 1.91071C2.39636 1.54116 2.68348 1.25405 3.05303 1.25404V1.25404ZM12.9474 1.58675L3.05304 1.58738C2.86758 1.58738 2.7297 1.72525 2.7297 1.91071C2.7297 2.09617 2.86757 2.23404 3.05303 2.23404H4.23223L4.23157 5.06135V5.06135C4.23158 5.15983 4.27538 5.25908 4.35053 5.32476L7.63107 7.91815L4.35113 10.5123C4.2739 10.5795 4.23221 10.6639 4.23221 10.7757V13.7666H3.05304C2.86759 13.7666 2.72971 13.9045 2.72971 14.09C2.72971 14.2754 2.86759 14.4133 3.05304 14.4133H12.9468C13.1323 14.4133 13.2701 14.2754 13.2701 14.09C13.2701 13.9045 13.1323 13.7667 12.9468 13.7667H11.7676L11.7683 10.7757V10.7757C11.7683 10.6772 11.7245 10.5781 11.6495 10.5124L8.35092 7.91819L11.6489 5.32461C11.726 5.25743 11.7676 5.17306 11.7676 5.06136L11.7683 2.23342H12.9474C13.1329 2.23342 13.2708 2.09554 13.2708 1.91008C13.2708 1.72463 13.1329 1.58676 12.9474 1.58675V1.58675ZM4.87823 2.23332H11.1216V4.89669L7.99994 7.3805L4.87823 4.89669V2.23332ZM5.21157 2.56666V4.73593L7.99994 6.95452L10.7883 4.73593V2.56666H5.21157ZM7.99958 8.45673L11.1216 10.9237V13.7505H4.87823V10.9403L7.99958 8.45673ZM8.0003 8.88213L5.21157 11.101V13.4172H10.7883V11.0852L8.0003 8.88213Z\" fill=\"white\"/>\n</svg>\n","import styled from '@emotion/styled/macro';\nimport React, { ReactNode } from 'react';\nimport {\n BillingModel,\n CustomerPortalSubscription,\n PricingType,\n SubscriptionScheduleType,\n SubscriptionStatus,\n} from '@stigg/js-client-sdk';\nimport { CustomerPortalTheme } from '../../customerPortalTheme';\nimport { NextEstimatedBill } from './NextEstimatedBill';\nimport { NoUpcomingBilling } from './NoUpcomingBilling';\nimport { ContactCustomerSupport } from '../ContactCustomerSupport';\nimport { CustomerPortalLocalization } from '../../customerPortalTextOverrides';\n\nconst Container = styled.div<{ $borderColor: string }>`\n max-height: 278px;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n background-color: ${({ theme }) => theme.stigg.palette.backgroundSection};\n border: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n padding: 32px;\n gap: 16px;\n`;\n\nexport type UpcomingBillingProps = {\n subscription: CustomerPortalSubscription;\n theme: CustomerPortalTheme;\n textOverrides: CustomerPortalLocalization;\n onContactSupport?: () => Promise<void> | void;\n};\n\nexport function UpcomingBilling({ subscription, theme, textOverrides, onContactSupport }: UpcomingBillingProps) {\n const { pricingType } = subscription;\n let content: ReactNode;\n const noUsageBasedPrices =\n subscription.prices?.every((price) => price.billingModel !== BillingModel.UsageBased) ?? true;\n const scheduledDowngradeToFree = subscription.scheduledUpdates?.find(\n ({ subscriptionScheduleType, targetPackage }) =>\n subscriptionScheduleType === SubscriptionScheduleType.Downgrade &&\n targetPackage?.pricingType === PricingType.Free,\n );\n\n if (pricingType === PricingType.Free) {\n content = <NoUpcomingBilling description=\"You're on a free plan, so you don’t have any upcoming charges\" />;\n } else if (pricingType === PricingType.Paid) {\n if (scheduledDowngradeToFree && noUsageBasedPrices) {\n content = (\n <NoUpcomingBilling description=\"Your plan will be downgraded to a free plan, so you don’t have any upcoming charges\" />\n );\n } else if (subscription.status === SubscriptionStatus.InTrial) {\n content = (\n <NoUpcomingBilling\n description={`You’re on a free trial of the ${subscription.planName} plan, so you don’t have any upcoming charges`}\n />\n );\n } else {\n const billingPeriod = subscription.prices?.[0]?.billingPeriod;\n const rangeEnd = subscription.billingPeriodRange?.end;\n const total = subscription.totalPrice?.total;\n\n if (billingPeriod && rangeEnd && total) {\n content = (\n <NextEstimatedBill\n billingPeriod={billingPeriod}\n rangeEnd={rangeEnd}\n amount={total.amount}\n currency={total.currency}\n />\n );\n }\n }\n } else if (pricingType === PricingType.Custom) {\n content = (\n <ContactCustomerSupport\n onContactSupport={onContactSupport}\n label={textOverrides.contactSupportTitle}\n linkLabel={textOverrides.contactSupportLink}\n />\n );\n }\n\n return (\n <Container className=\"stigg-subscription-total-price-layout\" $borderColor={theme.borderColor}>\n {content}\n </Container>\n );\n}\n","import React from 'react';\nimport Tooltip, { tooltipClasses, TooltipProps } from '@mui/material/Tooltip';\nimport styled from '@emotion/styled/macro';\n\nexport type InformationTooltipProps = TooltipProps & { $padding?: number; $maxWidth?: number };\n\nexport const InformationTooltip = styled(\n ({ children, className, placement = 'top', ...props }: InformationTooltipProps) => (\n <Tooltip\n arrow\n placement={placement}\n {...props}\n classes={{ popper: className, tooltip: 'stigg-tooltip', arrow: 'stigg-tooltip-arrow' }}>\n <div>{children}</div>\n </Tooltip>\n ),\n)(({ theme, $padding = 8, $maxWidth = 300 }) => ({\n [`& .${tooltipClasses.tooltip}`]: {\n backgroundColor: theme.stigg.palette.white,\n maxWidth: $maxWidth,\n boxShadow: theme.stigg.shadows.popover,\n padding: $padding,\n borderRadius: theme.stigg.border.radius,\n color: theme.stigg.palette.text.primary,\n },\n [`& .${tooltipClasses.arrow}`]: {\n color: theme.stigg.palette.white,\n },\n}));\n","import React, { CSSProperties, ReactNode, useEffect, useRef, useState } from 'react';\nimport styled, { css } from 'styled-components';\nimport { TooltipProps } from '@mui/material/Tooltip';\nimport { InformationTooltip } from './InformationTooltip';\nimport { Typography, TypographyProps } from './Typography';\n\nconst StyledText = styled(Typography)<{ $maxLines: number; $wordBreak?: boolean; $display: string; $bold?: boolean }>`\n display: ${({ $display }) => $display};\n -webkit-line-clamp: ${({ $maxLines }) => $maxLines};\n -webkit-box-orient: vertical;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: normal;\n ${({ $wordBreak }) =>\n $wordBreak &&\n css`\n word-break: break-word;\n `}\n\n ${({ $bold }) =>\n $bold &&\n css`\n font-weight: bold;\n `}\n`;\n\nfunction checkTextClamped(element: HTMLSpanElement) {\n return element && (element.clientHeight < element.scrollHeight || element.offsetWidth < element.scrollWidth);\n}\n\nexport const LongText = ({\n leaveDelay,\n children,\n variant,\n color,\n maxLines = 1,\n wordBreak,\n bold,\n tooltipPlacement = 'top',\n className,\n display = '-webkit-box',\n style,\n 'data-testid': dataTestId,\n}: {\n children: ReactNode;\n leaveDelay?: number;\n variant?: TypographyProps['variant'];\n color?: TypographyProps['color'];\n maxLines?: number;\n wordBreak?: boolean;\n bold?: boolean;\n tooltipPlacement?: TooltipProps['placement'];\n className?: string;\n display?: string;\n style?: CSSProperties;\n ['data-testid']?: string;\n}) => {\n const [isTextClamped, setIsTextClamped] = useState(false);\n const ref = useRef<HTMLSpanElement>(null);\n const content = (\n <StyledText\n ref={ref}\n variant={variant}\n color={color}\n $maxLines={maxLines}\n $wordBreak={wordBreak}\n $bold={bold}\n className={className}\n $display={display}\n style={style}\n data-testid={dataTestId}>\n {children}\n </StyledText>\n );\n\n // Trigger recalculate of text clamped since ref is not always exists on first render\n useEffect(() => {\n if (ref?.current) {\n const textClamped = checkTextClamped(ref.current);\n setIsTextClamped(textClamped);\n }\n }, [ref]);\n\n const textClamped = ref?.current && checkTextClamped(ref.current);\n return (\n <span>\n {isTextClamped || textClamped ? (\n <InformationTooltip\n placement={tooltipPlacement}\n leaveDelay={leaveDelay}\n title={<Typography variant=\"body1\">{children}</Typography>}>\n {content}\n </InformationTooltip>\n ) : (\n content\n )}\n </span>\n );\n};\n","import styled from '@emotion/styled/macro';\nimport React from 'react';\nimport { CustomerPortalSubscription, SubscriptionStatus } from '@stigg/js-client-sdk';\nimport Link from '@mui/material/Link';\nimport SandClockIcon from '../../../../assets/sand-clock.svg';\nimport { Typography } from '../../../common/Typography';\nimport { LongText } from '../../../common/LongText';\nimport { OnManageClick } from '../../CustomerPortalContainer';\nimport { CustomerPortalIntentionType } from '../../types';\n\nconst OnTrialBadge = styled.div`\n width: 100%;\n display: flex;\n align-items: center;\n gap: 4px;\n background-color: ${({ theme }) => theme.stigg.palette.warning};\n border-radius: 10px;\n padding: 8px 16px;\n margin-top: 16px;\n`;\n\nconst StyledLink = styled(Link)`\n text-decoration-color: white;\n color: white;\n cursor: pointer;\n`;\n\nexport function TrialPanel({\n subscription,\n includePlanName,\n onManageSubscription,\n}: {\n subscription: CustomerPortalSubscription | undefined;\n includePlanName: boolean;\n onManageSubscription: OnManageClick;\n}) {\n if (subscription?.status !== SubscriptionStatus.InTrial) {\n return null;\n }\n\n return (\n <OnTrialBadge className=\"stigg-subscription-trial-badge\">\n <SandClockIcon className=\"stigg-subscription-trial-badge-image\" />\n\n <div style={{ flex: 1, marginRight: 4 }}>\n <LongText variant=\"body1\" className=\"stigg-subscription-trial-badge-text\" color=\"white\">\n {`${subscription.trialRemainingDays} days remaining in trial`}\n {includePlanName && ` of the ${subscription.planName} plan`}\n </LongText>\n </div>\n\n <StyledLink\n className=\"stigg-subscription-trial-upgrade-button\"\n onClick={() => onManageSubscription({ intentionType: CustomerPortalIntentionType.UPGRADE_TRIAL_PLAN })}>\n <Typography color=\"white\">Upgrade plan</Typography>\n </StyledLink>\n </OnTrialBadge>\n );\n}\n","import React from 'react';\nimport { CustomerPortalSubscription } from '@stigg/js-client-sdk';\nimport { Typography } from '../../../common/Typography';\nimport { TrialPanel } from './TrialPanel';\nimport { CustomerPortalTheme } from '../../customerPortalTheme';\nimport { OnManageClick } from '../../CustomerPortalContainer';\n\ntype SubscriptionViewProps = {\n mainSubscription: CustomerPortalSubscription;\n trialSubscription: CustomerPortalSubscription | undefined;\n onManageSubscription: OnManageClick;\n theme: CustomerPortalTheme;\n};\n\nexport function SubscriptionView({\n mainSubscription,\n trialSubscription,\n onManageSubscription,\n theme,\n}: SubscriptionViewProps) {\n return (\n <div className=\"stigg-subscription-view-layout\">\n <Typography\n className=\"stigg-subscription-plan-name\"\n variant=\"h1\"\n overrideColor={theme.planNameColor}\n style={{ marginTop: 8 }}>\n {mainSubscription.planName} plan\n </Typography>\n\n <TrialPanel\n subscription={trialSubscription}\n includePlanName={trialSubscription?.planName !== mainSubscription.planName}\n onManageSubscription={onManageSubscription}\n />\n </div>\n );\n}\n","import { CustomerPortalEntitlement } from '@stigg/js-client-sdk';\nimport moment from 'moment';\n\nexport const USAGE_PERCENTAGE_WARNING_THRESHOLD = 70;\n\nexport function getUsagePercentage(currentUsage: number, limit: number) {\n return Math.min(Math.floor((currentUsage / limit) * 100), 100);\n}\n\nexport function getUsageProgressStatus(currentUsage: number) {\n let status: 'standard' | 'warning' | 'error';\n\n if (currentUsage < USAGE_PERCENTAGE_WARNING_THRESHOLD) {\n status = 'standard';\n } else if (currentUsage < 100) {\n status = 'warning';\n } else {\n status = 'error';\n }\n\n return status;\n}\n\nexport function getResetUsageText(entitlement: CustomerPortalEntitlement) {\n if (!entitlement.resetPeriod || !entitlement.usagePeriodEnd) {\n return null;\n }\n\n const calculateResetDiff = (unit: 'days' | 'hours' | 'minutes') => {\n return moment.utc(entitlement.usagePeriodEnd).diff(moment.utc(), unit);\n };\n\n switch (entitlement.resetPeriod) {\n case 'MONTH':\n return `Resets monthly - in ${calculateResetDiff('days')} days`;\n case 'WEEK':\n return `Resets weekly - in ${calculateResetDiff('days')} days`;\n case 'DAY':\n return `Resets daily - in ${calculateResetDiff('hours')} hours`;\n case 'HOUR':\n return `Resets hourly - in ${calculateResetDiff('minutes')} minutes`;\n default:\n return null;\n }\n}\n","import styled from '@emotion/styled/macro';\nimport LinearProgress from '@mui/material/LinearProgress';\nimport React from 'react';\nimport { CustomerPortalEntitlement } from '@stigg/js-client-sdk';\nimport Divider from '@mui/material/Divider';\nimport Color from 'color';\nimport { getUsagePercentage, getUsageProgressStatus } from './FeatureUsage.helper';\n\nexport const StyledLinearProgress = styled(LinearProgress, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{\n $progressStatus: 'standard' | 'warning' | 'error';\n}>`\n height: 4px;\n background-color: ${({ theme }) => Color(theme.stigg.palette.primary).alpha(0.4).string()};\n\n span {\n background-color: ${({ $progressStatus, theme }) => {\n switch ($progressStatus) {\n case 'standard':\n return theme.stigg.palette.primary;\n case 'warning':\n return theme.stigg.palette.warning;\n case 'error':\n return theme.stigg.palette.error;\n default:\n return theme.stigg.palette.primary;\n }\n }};\n }\n`;\n\nexport const StyledDivider = styled(Divider)`\n border-style: dotted;\n border-bottom-width: 2px;\n border-color: ${({ theme }) => Color(theme.stigg.palette.outlinedRestingBorder).alpha(0.4).string()};\n`;\n\nexport type FeatureUsageProgressBarProps = {\n entitlement: CustomerPortalEntitlement;\n};\n\nexport function FeatureUsageProgressBar({ entitlement }: FeatureUsageProgressBarProps) {\n if (entitlement.hasUnlimitedUsage) {\n return <StyledDivider />;\n }\n\n const usagePercentage = getUsagePercentage(entitlement.currentUsage || 0, entitlement.usageLimit!);\n const linearProgressStatus = getUsageProgressStatus(usagePercentage);\n\n return (\n <StyledLinearProgress\n $progressStatus={linearProgressStatus}\n className={`stigg-feature-usage-progress-bar-${linearProgressStatus.toString()}`}\n variant=\"determinate\"\n value={usagePercentage}\n />\n );\n}\n","import { CustomerPortalEntitlement } from '@stigg/js-client-sdk';\nimport { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';\nimport Button from '@mui/material/Button';\nimport React from 'react';\nimport styled from 'styled-components';\nimport { getUsagePercentage, USAGE_PERCENTAGE_WARNING_THRESHOLD } from './FeatureUsage.helper';\nimport { Typography } from '../../../common/Typography';\nimport { CustomerPortalIntentionType, OnBuyMoreCallbackFn } from '../../types';\nimport { OnManageClick } from '../../CustomerPortalContainer';\n\nconst StyledButton = styled(Button)`\n text-transform: none;\n padding: 0;\n white-space: nowrap;\n`;\n\nexport type EntitlementCtaButtonProps = {\n entitlement: Exclude<CustomerPortalEntitlement, 'feature'>;\n feature: FeatureFragment;\n onManageSubscription: OnManageClick | undefined;\n onBuyMore?: OnBuyMoreCallbackFn;\n canBuyMore: boolean;\n canUpgradeSubscription: boolean;\n hasCustomSubscription: boolean;\n};\n\nexport function EntitlementCtaButton({\n entitlement,\n feature,\n onManageSubscription,\n onBuyMore,\n canBuyMore,\n canUpgradeSubscription,\n hasCustomSubscription,\n}: EntitlementCtaButtonProps) {\n if (hasCustomSubscription || entitlement.hasUnlimitedUsage) {\n return null;\n }\n\n if (getUsagePercentage(entitlement.currentUsage || 0, entitlement.usageLimit!) < USAGE_PERCENTAGE_WARNING_THRESHOLD) {\n return null;\n }\n\n if (canBuyMore) {\n return onBuyMore ? (\n <StyledButton variant=\"text\" onClick={() => onBuyMore(feature, entitlement)}>\n <Typography color=\"primary.main\">Buy more</Typography>\n </StyledButton>\n ) : null;\n }\n\n if (canUpgradeSubscription) {\n return onManageSubscription ? (\n <StyledButton\n variant=\"text\"\n onClick={() => onManageSubscription({ intentionType: CustomerPortalIntentionType.UPGRADE_PLAN })}>\n <Typography color=\"primary.main\">Upgrade</Typography>\n </StyledButton>\n ) : null;\n }\n\n return null;\n}\n","import { Currency, CustomerPortalEntitlement } from '@stigg/js-client-sdk';\nimport React from 'react';\nimport { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';\nimport { Typography } from '../../../common/Typography';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { FeatureUsageProgressBar } from '../../usage/featureUsage/FeatureUsageProgressBar';\nimport { LongText } from '../../../common/LongText';\nimport { EntitlementCtaButton } from '../../usage/featureUsage/EntitlementCTAButton';\nimport { OnBuyMoreCallbackFn } from '../../types';\nimport { OnManageClick } from '../../CustomerPortalContainer';\n\nexport type UsageBasedChargeProps = {\n entitlement: Exclude<CustomerPortalEntitlement, 'feature'>;\n feature: FeatureFragment;\n amount: number;\n blockSize?: number | null;\n currency: Currency;\n onBuyMore?: OnBuyMoreCallbackFn;\n onManageSubscription: OnManageClick;\n canUpgradeSubscription: boolean;\n hasCustomSubscription: boolean;\n hideChargePrice?: boolean;\n};\n\nexport function ChargeItem({\n amount,\n currency,\n blockSize,\n entitlement,\n feature,\n hideChargePrice,\n onBuyMore,\n onManageSubscription,\n canUpgradeSubscription,\n hasCustomSubscription,\n}: UsageBasedChargeProps) {\n return (\n <div\n className={`stigg-charge-list-item stigg-charge-list-item-${entitlement.feature!.refId}`}\n style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>\n <div style={{ display: 'flex', justifyContent: 'space-between', gap: 12 }}>\n <div style={{ display: 'flex', gap: 12 }}>\n <LongText variant=\"body1\" color=\"primary\">\n {feature.displayName}\n </LongText>\n {!hideChargePrice && (\n <LongText variant=\"body1\" color=\"secondary\">\n {currencyPriceFormatter({ amount, currency })} per {blockSize ? `${blockSize} ` : ''}\n {blockSize ? feature.featureUnitsPlural : feature.featureUnits}\n </LongText>\n )}\n </div>\n\n <div style={{ display: 'flex', gap: 12 }}>\n <EntitlementCtaButton\n entitlement={entitlement}\n feature={feature}\n canBuyMore\n onBuyMore={onBuyMore}\n onManageSubscription={onManageSubscription}\n canUpgradeSubscription={canUpgradeSubscription}\n hasCustomSubscription={hasCustomSubscription}\n />\n <Typography variant=\"body1\" color=\"primary\" style={{ whiteSpace: 'nowrap' }}>\n {entitlement.hasUnlimitedUsage\n ? entitlement.currentUsage?.toLocaleString()\n : `${entitlement.currentUsage?.toLocaleString()} of ${entitlement.usageLimit?.toLocaleString()}`}\n </Typography>\n </div>\n </div>\n\n <FeatureUsageProgressBar entitlement={entitlement} />\n </div>\n );\n}\n","import { BillingModel, CustomerPortalEntitlement, CustomerPortalSubscription } from '@stigg/js-client-sdk';\nimport React from 'react';\nimport { keyBy } from 'lodash';\nimport { ChargeItem } from './ChargeItem';\nimport { OnBuyMoreCallbackFn } from '../../types';\nimport { OnManageClick } from '../../CustomerPortalContainer';\n\nexport type ChargesProps = {\n subscription: CustomerPortalSubscription;\n entitlements: CustomerPortalEntitlement[];\n onBuyMore?: OnBuyMoreCallbackFn;\n onManageSubscription: OnManageClick;\n canUpgradeSubscription: boolean;\n hasCustomSubscription: boolean;\n};\n\nexport function ChargeList({\n subscription,\n entitlements,\n onBuyMore,\n onManageSubscription,\n hasCustomSubscription,\n canUpgradeSubscription,\n}: ChargesProps) {\n const entitlementByFeature = keyBy(entitlements, 'feature.refId');\n\n const filteredSubscriptionPrices = subscription.prices.filter(\n ({ feature, price }) => !!feature && entitlementByFeature[feature.refId] && !!price,\n );\n\n if (!filteredSubscriptionPrices.length) {\n return null;\n }\n\n return (\n <div className=\"stigg-charge-list\" style={{ display: 'flex', flexDirection: 'column', gap: 16, marginTop: 32 }}>\n {filteredSubscriptionPrices.map(({ feature, price, blockSize, billingModel }) => {\n if (!feature || !price) {\n return null;\n }\n\n const entitlement = entitlementByFeature[feature.refId];\n\n if (!entitlement || !entitlement.feature) {\n return null;\n }\n\n return (\n <ChargeItem\n key={feature.refId}\n entitlement={entitlement}\n feature={entitlement.feature}\n amount={price.amount}\n blockSize={blockSize}\n currency={price.currency}\n hideChargePrice={billingModel === BillingModel.PerUnit}\n onBuyMore={onBuyMore}\n onManageSubscription={onManageSubscription}\n canUpgradeSubscription={canUpgradeSubscription}\n hasCustomSubscription={hasCustomSubscription}\n />\n );\n })}\n </div>\n );\n}\n","import React from 'react';\nimport { CustomerPortalSubscription, PricingType, SubscriptionStatus } from '@stigg/js-client-sdk';\nimport { SubscriptionsOverviewHeader } from './SubscriptionsOverviewHeader';\nimport { SubscriptionTabs } from './tabs/SubscriptionTabs';\nimport { useCustomerPortalContext } from '../CustomerPortalProvider';\nimport { SubscriptionOverviewLoader } from './SubscriptionOverviewLoader';\nimport { CustomerPortalSection } from '../CustomerPortal';\nimport { SubscriptionScheduledUpdatesAlert } from './subscriptionScheduledUpdates/SubscriptionScheduledUpdatesAlert';\nimport { SectionContainer } from '../common/SectionContainer';\nimport { UpcomingBilling } from './upcomingBilling/UpcomingBilling';\nimport { SubscriptionView } from './subscriptionView/SubscriptionView';\nimport { ChargeList } from './charges/ChargeList';\nimport { OnBuyMoreCallbackFn } from '../types';\nimport { OnManageClick } from '../CustomerPortalContainer';\n\nexport type SubscriptionsOverviewProps = {\n onManageSubscription: OnManageClick;\n onBuyMore?: OnBuyMoreCallbackFn;\n onCancelScheduledUpdates?: (subscription: CustomerPortalSubscription) => void;\n onContactSupport?: () => void;\n hiddenSections?: CustomerPortalSection[];\n cancelScheduledUpdatesButtonTitle: string;\n};\n\nexport function SubscriptionsOverview({\n onManageSubscription,\n onBuyMore,\n onCancelScheduledUpdates,\n onContactSupport,\n hiddenSections,\n cancelScheduledUpdatesButtonTitle,\n}: SubscriptionsOverviewProps) {\n const { customerPortal, isLoading, textOverrides, theme } = useCustomerPortalContext();\n const isLoadingData = isLoading || !customerPortal;\n const { subscriptions, entitlements, canUpgradeSubscription } = customerPortal || {};\n\n const activeSubscription = subscriptions?.find(({ status }) => status === SubscriptionStatus.Active);\n const trialSubscription = subscriptions?.find(({ status }) => status === SubscriptionStatus.InTrial);\n const hasCustomSubscription = activeSubscription?.pricingType === PricingType.Custom;\n const mainSubscription = activeSubscription || trialSubscription;\n\n return (\n <SectionContainer\n className=\"stigg-customer-portal-subscriptions-overview\"\n $backgroundColor={theme.backgroundColor}\n $borderColor={theme.borderColor}>\n {!isLoadingData && activeSubscription && activeSubscription.scheduledUpdates && (\n <SubscriptionScheduledUpdatesAlert\n theme={theme}\n subscription={activeSubscription}\n onCancelScheduledUpdates={onCancelScheduledUpdates}\n cancelScheduledUpdatesButtonTitle={cancelScheduledUpdatesButtonTitle}\n />\n )}\n\n {isLoadingData || !mainSubscription ? (\n <SubscriptionOverviewLoader />\n ) : (\n <div\n className=\"stigg-overview-layout\"\n style={{ display: 'flex', alignItems: 'flex-start', gap: 64, flexWrap: 'wrap' }}>\n <div style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>\n <SubscriptionsOverviewHeader\n onManageSubscription={onManageSubscription}\n hideManageButton={hasCustomSubscription}\n textOverrides={textOverrides}\n />\n\n <SubscriptionView\n mainSubscription={mainSubscription}\n trialSubscription={trialSubscription}\n theme={theme}\n onManageSubscription={onManageSubscription}\n />\n\n {activeSubscription && entitlements && (\n <ChargeList\n subscription={activeSubscription}\n entitlements={entitlements}\n onBuyMore={onBuyMore}\n onManageSubscription={onManageSubscription}\n canUpgradeSubscription={!!canUpgradeSubscription}\n hasCustomSubscription={hasCustomSubscription}\n />\n )}\n\n <SubscriptionTabs\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n customerPortal={customerPortal!}\n hiddenSections={hiddenSections}\n textOverrides={textOverrides}\n theme={theme}\n />\n </div>\n\n <div style={{ display: 'flex', flexDirection: 'column', width: 319, gap: 24 }}>\n <UpcomingBilling\n subscription={mainSubscription}\n theme={theme}\n onContactSupport={onContactSupport}\n textOverrides={textOverrides}\n />\n </div>\n </div>\n )}\n </SectionContainer>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { PoweredByStigg } from '../common/PoweredByStigg';\n\nconst CustomerPortalHeaderLayout = styled.div`\n display: flex;\n width: 100%;\n align-items: flex-end;\n justify-content: flex-end;\n margin-bottom: 24px;\n`;\n\nexport function CustomerPortalHeader({ showWatermark }: { showWatermark?: boolean }) {\n return (\n <CustomerPortalHeaderLayout className=\"stigg-customer-portal-header-layout\">\n <PoweredByStigg source=\"customer_portal\" showWatermark={showWatermark} />\n </CustomerPortalHeaderLayout>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { ExternalLink as ExternalLinkIcon } from 'react-feather';\nimport { Typography } from '../../common/Typography';\nimport { StyledButton } from './StyledButton';\n\nconst ExternalLinkText = styled(Typography)`\n text-transform: none;\n`;\n\nconst LinkIcon = styled(ExternalLinkIcon)`\n color: ${({ theme }) => theme.stigg.palette.primary};\n`;\n\nexport type ExternalLinkButtonProps = {\n text: string;\n url: string;\n className: string;\n};\n\nexport function ExternalLinkButton({ text, url, className }: ExternalLinkButtonProps) {\n const onClick = () => {\n window.open(url, '_blank');\n };\n\n return (\n <StyledButton\n className={className}\n variant=\"outlined\"\n startIcon={<LinkIcon size={20} strokeWidth={2.5} />}\n onClick={onClick}>\n <ExternalLinkText color=\"primary.main\">{text}</ExternalLinkText>\n </StyledButton>\n );\n}\n","import styled from '@emotion/styled/macro';\nimport React from 'react';\nimport { FontWeight } from 'styled-typography';\nimport { Typography, TypographyProps } from '../../common/Typography';\n\nexport const InformationGridContainer = styled.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 16px;\n flex: 1 0 0;\n`;\n\nconst InformationGridRow = styled.div`\n display: flex;\n align-items: flex-start;\n gap: 16px;\n align-self: stretch;\n flex-wrap: wrap;\n`;\n\nexport type InformationGridProps = {\n title: string;\n rows: Array<{\n classNamePrefix: string;\n label: string;\n value: string;\n labelTypographyProps?: Partial<TypographyProps>;\n valueTypographyProps?: Partial<TypographyProps>;\n }>;\n};\n\nexport function InformationGrid({ title, rows }: InformationGridProps) {\n return (\n <InformationGridContainer>\n <Typography variant=\"h6\" color=\"secondary\" fontWeight={FontWeight.Medium}>\n {title}\n </Typography>\n {rows.map(({ classNamePrefix, label, value, labelTypographyProps, valueTypographyProps }) => (\n <InformationGridRow key={label}>\n <Typography\n className={`${classNamePrefix}-label`}\n variant=\"body1\"\n color=\"secondary\"\n style={{ width: 80 }}\n {...labelTypographyProps}>\n {label}\n </Typography>\n <Typography className={`${classNamePrefix}-text`} variant=\"body1\" color=\"secondary\" {...valueTypographyProps}>\n {value}\n </Typography>\n </InformationGridRow>\n ))}\n </InformationGridContainer>\n );\n}\n","import Skeleton from 'react-loading-skeleton';\nimport React from 'react';\n\nexport function SkeletonButton() {\n return <Skeleton width={220} height={42} />;\n}\n","import React, { ReactElement } from 'react';\nimport Divider from '@mui/material/Divider';\nimport { padStart } from 'lodash';\nimport Skeleton from 'react-loading-skeleton';\nimport { useCustomerPortalContext } from '../CustomerPortalProvider';\nimport { SectionTitle } from '../common/SectionTitle';\nimport { SectionContainer } from '../common/SectionContainer';\nimport { ExternalLinkButton } from '../common/ExternalLinkButton';\nimport { InformationGrid, InformationGridContainer } from './InformationGrid';\nimport { SectionHeader } from '../common/SectionHeader';\nimport { SkeletonButton } from '../common/SkeletonButton';\nimport { useIsScreenWiderThan } from '../../hooks/useIsScreenWiderThan';\n\nexport const EMPTY_CHAR = '-';\n\nexport function PaymentDetailsSection() {\n const { customerPortal, isLoading, textOverrides, theme } = useCustomerPortalContext();\n const isScreenWiderThanMd = useIsScreenWiderThan('md');\n const { billingInformation } = customerPortal || {};\n const isLoadingData = !billingInformation || isLoading;\n\n const items: ReactElement[] = [];\n\n if (isLoadingData) {\n items.push(\n ...[\n <InformationGridContainer key=\"information-loading-data-top\">\n <Skeleton width={220} height={12} />\n <Skeleton width={220} height={12} />\n <Skeleton width={220} height={12} />\n </InformationGridContainer>,\n <Divider\n key=\"information-loading-data-divider\"\n orientation=\"vertical\"\n style={{ minHeight: 93, display: isScreenWiderThanMd ? 'block' : 'none' }}\n />,\n <InformationGridContainer key=\"information-loading-data-bottom\">\n <Skeleton width={220} height={12} />\n <Skeleton width={220} height={12} />\n <Skeleton width={220} height={12} />\n </InformationGridContainer>,\n ],\n );\n } else {\n items.push(\n <InformationGrid\n key=\"information-billing-data-billed-to\"\n title=\"Billed to\"\n rows={[\n {\n classNamePrefix: 'stigg-customer-name',\n label: 'Name',\n value: billingInformation?.name || EMPTY_CHAR,\n valueTypographyProps: billingInformation?.name ? {} : { color: 'disabled' },\n },\n {\n classNamePrefix: 'stigg-customer-email',\n label: 'Email',\n value: billingInformation?.email || EMPTY_CHAR,\n valueTypographyProps: billingInformation?.email ? {} : { color: 'disabled' },\n },\n ]}\n />,\n );\n\n if (\n billingInformation?.defaultPaymentMethodId &&\n billingInformation.defaultPaymentMethodLast4Digits &&\n billingInformation.defaultPaymentExpirationMonth &&\n billingInformation.defaultPaymentExpirationYear\n ) {\n items.unshift(\n <Divider\n key=\"information-billing-data-divider\"\n orientation=\"vertical\"\n style={{ minHeight: 93, display: isScreenWiderThanMd ? 'block' : 'none' }}\n />,\n );\n items.unshift(\n <InformationGrid\n key=\"information-billing-data-payment-method\"\n title=\"Payment method\"\n rows={[\n {\n classNamePrefix: 'stigg-credit-card',\n label: 'Card',\n value: `Ending in ${billingInformation.defaultPaymentMethodLast4Digits}`,\n },\n {\n classNamePrefix: 'stigg-credit-card-expiration',\n label: 'Expires',\n value: `${padStart(billingInformation.defaultPaymentExpirationMonth.toString(), 2, '0')}/${\n billingInformation.defaultPaymentExpirationYear\n }`,\n },\n ]}\n />,\n );\n }\n }\n\n if (\n !isLoadingData &&\n !billingInformation?.name &&\n !billingInformation?.email &&\n !billingInformation?.defaultPaymentMethodId\n ) {\n return null;\n }\n\n const editButton = isLoadingData ? (\n <SkeletonButton />\n ) : customerPortal?.billingPortalUrl ? (\n <ExternalLinkButton\n url={customerPortal.billingPortalUrl}\n text={textOverrides.editPaymentDetails}\n className=\"stigg-edit-payment-details-button\"\n />\n ) : null;\n\n return (\n <SectionContainer\n className=\"stigg-payment-details-section-layout\"\n $backgroundColor={theme.backgroundColor}\n $borderColor={theme.borderColor}>\n <SectionHeader className=\"stigg-payment-details-section-header\">\n <SectionTitle\n isLoading={isLoadingData}\n className=\"stigg-payment-details-section-title\"\n title=\"Payment details\"\n />\n {editButton}\n </SectionHeader>\n\n <div style={{ display: 'flex', alignItems: 'stretch', gap: isScreenWiderThanMd ? 64 : 32, flexWrap: 'wrap' }}>\n {items}\n </div>\n </SectionContainer>\n );\n}\n","import styled from '@emotion/styled/macro';\nimport { STIGG_WATERMARK_CLASSNAME } from '../../common/PoweredByStigg';\nimport { SectionContainer } from '../common/SectionContainer';\n\nexport const CustomerPortalPaywallLayout = styled(SectionContainer)<{\n $backgroundColor: string;\n $borderColor: string;\n}>`\n position: relative;\n\n .stigg-paywall-layout {\n width: 100%;\n }\n\n .stigg-paywall-plans-layout {\n flex-wrap: nowrap;\n width: 100%;\n overflow-x: auto;\n justify-content: unset;\n padding: 10px 0px 0px 0px;\n }\n\n .stigg-paywall-plans-layout .stigg-plan-offering-container:first-of-type {\n margin-left: auto;\n }\n .stigg-paywall-plans-layout .stigg-plan-offering-container:last-child {\n margin-right: auto;\n }\n\n .${STIGG_WATERMARK_CLASSNAME} {\n display: none;\n }\n`;\n","import React from 'react';\nimport { CustomerPortalTheme } from '../customerPortalTheme';\nimport { CustomerPortalPaywallLayout } from './CustomerPortalPaywall.style';\nimport { SectionTitle } from '../common/SectionTitle';\nimport { SectionHeader } from '../common/SectionHeader';\n\ntype CustomerPortalPaywallProps = {\n paywallComponent?: React.ReactNode;\n theme: CustomerPortalTheme;\n title: string;\n isLoading: boolean;\n};\n\nexport const CustomerPortalPaywall = React.forwardRef<HTMLDivElement, CustomerPortalPaywallProps>(\n ({ paywallComponent, theme, title, isLoading }, ref) => {\n if (!paywallComponent) {\n return null;\n }\n\n return (\n <CustomerPortalPaywallLayout\n className=\"stigg-customer-portal-paywall-section\"\n ref={ref}\n $backgroundColor={theme.backgroundColor}\n $borderColor={theme.borderColor}>\n <SectionHeader className=\"stigg-customer-portal-paywall-header\">\n <SectionTitle isLoading={isLoading} className=\"stigg-customer-portal-paywall-section-title\" title={title} />\n </SectionHeader>\n\n {paywallComponent}\n </CustomerPortalPaywallLayout>\n );\n },\n);\n","import styled from '@emotion/styled/macro';\n\nexport const CustomerPortalLayout = styled.div`\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n\n & * {\n box-sizing: border-box;\n }\n`;\n\nexport const CustomerPortalSections = styled.div`\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n row-gap: 24px;\n`;\n","import { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';\nimport lowercase from 'lodash/lowerCase';\n\nexport function getFeatureDisplayNameText(\n featureDisplayName: string,\n featureUnits: string | undefined | null,\n featureUnitsPlural: string | undefined | null,\n) {\n if (!featureUnits && !featureUnitsPlural) {\n return featureDisplayName;\n }\n\n const displayNameLowerCase = lowercase(featureDisplayName);\n if (\n displayNameLowerCase === lowercase(featureUnits || '') ||\n displayNameLowerCase === lowercase(featureUnitsPlural || '')\n ) {\n return featureDisplayName;\n }\n\n return `${featureDisplayName} (${featureUnitsPlural})`;\n}\n\nexport function getFeatureDisplayName(feature: FeatureFragment) {\n return getFeatureDisplayNameText(feature.displayName, feature.featureUnits, feature.featureUnitsPlural);\n}\n","import styled from '@emotion/styled/macro';\n\nexport const FeatureUsageContainer = styled.div<{ $highlight: boolean; $borderColor: string }>`\n display: flex;\n flex-direction: column;\n padding: 24px;\n border: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n border-radius: 10px;\n row-gap: 16px;\n height: 100%;\n\n ${({ theme, $highlight }) => $highlight && `background-color: ${theme.stigg.palette.backgroundSection}`};\n`;\n","import isUndefined from 'lodash/isUndefined';\nimport React from 'react';\nimport { BillingModel, CustomerPortalEntitlement } from '@stigg/js-client-sdk';\nimport { CustomerPortalSubscriptionPriceFragment } from '@stigg/api-client-js/src/generated/sdk';\nimport { Typography } from '../../../common/Typography';\nimport { useCustomerPortalContext } from '../../CustomerPortalProvider';\nimport { getResetUsageText, getUsagePercentage } from './FeatureUsage.helper';\nimport { getFeatureDisplayName } from '../../../utils/getFeatureName';\nimport { FeatureUsageContainer } from './FeatureUsage.style';\nimport { FeatureUsageProgressBar } from './FeatureUsageProgressBar';\nimport { Icon } from '../../../common/Icon';\nimport { InformationTooltip } from '../../../common/InformationTooltip';\nimport { LongText } from '../../../common/LongText';\nimport { EntitlementCtaButton } from './EntitlementCTAButton';\nimport { OnBuyMoreCallbackFn } from '../../types';\nimport { OnManageClick } from '../../CustomerPortalContainer';\n\nexport type UsageBoxProps = {\n entitlement: CustomerPortalEntitlement;\n subscriptionPrice: CustomerPortalSubscriptionPriceFragment | undefined;\n onManageSubscription: OnManageClick | undefined;\n onBuyMore?: OnBuyMoreCallbackFn;\n hasCustomSubscription: boolean;\n canUpgradeSubscription: boolean;\n};\n\nexport function FeatureUsage({\n entitlement,\n subscriptionPrice,\n onManageSubscription,\n onBuyMore,\n hasCustomSubscription,\n canUpgradeSubscription,\n}: UsageBoxProps) {\n const { theme } = useCustomerPortalContext();\n\n const hasOverageUsage = !entitlement.hasUnlimitedUsage && entitlement.currentUsage! > entitlement.usageLimit!;\n\n if (!entitlement.feature) {\n return null;\n }\n\n return (\n <FeatureUsageContainer $highlight={!!subscriptionPrice} $borderColor={theme.borderColor}>\n <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 16 }}>\n <LongText variant=\"body1\">{entitlement.feature && getFeatureDisplayName(entitlement.feature)}</LongText>\n {subscriptionPrice && (\n <InformationTooltip\n title={\n <Typography variant=\"body1\">\n {subscriptionPrice.billingModel === BillingModel.PerUnit\n ? 'Billed for committed usage'\n : 'Billed for actual usage'}\n </Typography>\n }>\n <Icon icon=\"DollarCoin\" svgStrokeColor={theme.iconsColor} />\n </InformationTooltip>\n )}\n </div>\n\n <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 8 }}>\n <LongText\n variant=\"body1\"\n color={hasOverageUsage ? 'error' : 'primary'}\n data-testid={`usage-data-${entitlement.feature?.refId}`}>\n {entitlement.currentUsage?.toLocaleString()}\n {!entitlement.hasUnlimitedUsage &&\n ` / ${entitlement.usageLimit?.toLocaleString()} (${getUsagePercentage(\n entitlement.currentUsage || 0,\n entitlement.usageLimit!,\n )}%)`}\n </LongText>\n\n <EntitlementCtaButton\n entitlement={entitlement}\n feature={entitlement.feature}\n onBuyMore={onBuyMore}\n canBuyMore={!!subscriptionPrice}\n onManageSubscription={onManageSubscription}\n canUpgradeSubscription={canUpgradeSubscription}\n hasCustomSubscription={hasCustomSubscription}\n />\n </div>\n\n <FeatureUsageProgressBar entitlement={entitlement} />\n\n {!entitlement.hasUnlimitedUsage &&\n !isUndefined(entitlement.usageLimit) &&\n !isUndefined(entitlement.currentUsage) &&\n entitlement.resetPeriod &&\n entitlement.usagePeriodEnd ? (\n <Typography color=\"secondary\">{getResetUsageText(entitlement)}</Typography>\n ) : null}\n {entitlement.hasUnlimitedUsage && <Typography color=\"secondary\">In current billing period</Typography>}\n </FeatureUsageContainer>\n );\n}\n","import styled from '@emotion/styled/macro';\nimport Grid from '@mui/material/Grid';\nimport { range } from 'lodash';\nimport Skeleton from 'react-loading-skeleton';\nimport React from 'react';\nimport { useIsScreenWiderThan } from '../../hooks/useIsScreenWiderThan';\n\nexport const Footer = styled.div`\n margin-top: 32px;\n`;\n\nexport function CustomerUsageLoader() {\n const isMdScreen = useIsScreenWiderThan('md');\n return (\n <Grid container spacing={4} className=\"stigg-subscription-usage-skeleton-layout\" sx={{ flexWrap: 'wrap' }}>\n {range(6).map((item) => (\n <Grid key={item} item xs={isMdScreen ? 4 : 12}>\n <Skeleton width={280} height={120} />\n </Grid>\n ))}\n </Grid>\n );\n}\n","import { MeterType, PricingType, SubscriptionStatus } from '@stigg/js-client-sdk';\nimport React, { useState } from 'react';\nimport { compact, keyBy } from 'lodash';\nimport { Minus, Plus } from 'react-feather';\nimport Grid from '@mui/material/Grid';\nimport { useCustomerPortalContext } from '../CustomerPortalProvider';\nimport { FeatureUsage } from './featureUsage/FeatureUsage';\nimport { Footer, CustomerUsageLoader } from './CustomerUsageData.style';\nimport { SectionContainer } from '../common/SectionContainer';\nimport { SectionHeader } from '../common/SectionHeader';\nimport { SectionTitle } from '../common/SectionTitle';\nimport { StyledButton } from '../common/StyledButton';\nimport { FilterEntitlementsFn, OnBuyMoreCallbackFn } from '../types';\nimport { OnManageClick } from '../CustomerPortalContainer';\nimport { useIsScreenWiderThan } from '../../hooks/useIsScreenWiderThan';\n\nconst MAX_BOXES = 6;\n\nexport type CustomerUsageDataProps = {\n onManageSubscription?: OnManageClick;\n onBuyMore?: OnBuyMoreCallbackFn;\n filterEntitlements?: FilterEntitlementsFn;\n};\n\nexport function CustomerUsageData({ onManageSubscription, onBuyMore, filterEntitlements }: CustomerUsageDataProps) {\n const [showAll, setShowAll] = useState(false);\n const isMdScreen = useIsScreenWiderThan('md');\n\n const { customerPortal, isLoading, textOverrides, theme } = useCustomerPortalContext();\n const isLoadingData = isLoading || !customerPortal;\n const { entitlements, subscriptions } = customerPortal || {};\n const meteredEntitlements = entitlements?.filter(\n (entitlement) =>\n entitlement.feature?.meterType === MeterType.Fluctuating ||\n entitlement.feature?.meterType === MeterType.Incremental,\n );\n const activeSubscription = subscriptions?.find(({ status }) => status === SubscriptionStatus.Active);\n const hasCustomSubscription = activeSubscription?.pricingType === PricingType.Custom;\n const canUpgradeSubscription = !!customerPortal?.canUpgradeSubscription;\n\n const subscriptionPriceByFeature = keyBy(activeSubscription?.prices, 'feature.refId');\n const entitlementByFeature = keyBy(meteredEntitlements, 'feature.refId');\n\n // sort features by prices first, then other entitlements\n const priceEntitlements = compact(\n activeSubscription?.prices.map(\n (subscriptionPrice) => subscriptionPrice.feature && entitlementByFeature[subscriptionPrice.feature.refId],\n ),\n );\n const otherEntitlements = compact(\n meteredEntitlements?.filter((entitlement) => !subscriptionPriceByFeature[entitlement.feature!.refId]),\n );\n const sortedEntitlements = [...priceEntitlements, ...otherEntitlements];\n\n const filteredEntitlements = filterEntitlements ? filterEntitlements(sortedEntitlements) : sortedEntitlements;\n\n // 4 -> 3 per row, 6 -> 2 per row\n const xs = isMdScreen ? (filteredEntitlements.length > 2 ? 4 : 6) : 12;\n\n const entitlementsToShow = showAll ? filteredEntitlements : filteredEntitlements.slice(0, MAX_BOXES);\n\n const toggleShowAll = () => setShowAll((prevState) => !prevState);\n\n if (!isLoadingData && !meteredEntitlements?.length) {\n return null;\n }\n\n return (\n <SectionContainer\n className=\"stigg-subscription-usage-layout\"\n $backgroundColor={theme.backgroundColor}\n $borderColor={theme.borderColor}>\n <SectionHeader>\n <SectionTitle\n title={textOverrides.usageTabTitle}\n className=\"stigg-customer-portal-usage-section-title\"\n isLoading={isLoadingData}\n />\n </SectionHeader>\n\n {isLoadingData ? (\n <CustomerUsageLoader />\n ) : (\n <>\n <Grid container spacing={4}>\n {entitlementsToShow.map((entitlement) => (\n <Grid\n className={`stigg-entitlement-usage-${entitlement.feature!.refId}`}\n key={entitlement.feature!.refId}\n item\n xs={xs}>\n <FeatureUsage\n key={entitlement.feature!.refId}\n subscriptionPrice={subscriptionPriceByFeature[entitlement.feature!.refId]}\n entitlement={entitlement}\n onManageSubscription={onManageSubscription}\n onBuyMore={onBuyMore}\n hasCustomSubscription={hasCustomSubscription}\n canUpgradeSubscription={canUpgradeSubscription}\n />\n </Grid>\n ))}\n </Grid>\n\n {filteredEntitlements.length > MAX_BOXES && (\n <Footer>\n <StyledButton\n className=\"stigg-usage-toggle-many-button\"\n variant=\"text\"\n startIcon={showAll ? <Minus /> : <Plus />}\n onClick={toggleShowAll}>\n {showAll ? 'Show less' : 'Show more'}\n </StyledButton>\n </Footer>\n )}\n </>\n )}\n </SectionContainer>\n );\n}\n","import React, { useRef } from 'react';\nimport { SubscriptionsOverview } from './subscriptionOverview/SubscriptionsOverview';\nimport { CustomerPortalHeader } from './CustomerPortalHeader';\nimport { PaymentDetailsSection } from './billing/PaymentDetailsSection';\nimport { CustomerPortalPaywall } from './paywall/CustomerPortalPaywall';\nimport { useCustomerPortalContext } from './CustomerPortalProvider';\nimport { CustomerPortalLayout, CustomerPortalSections } from './CustomerPortal.style';\nimport { CustomerPortalProps } from './CustomerPortal';\nimport { InvoicesSection, useStiggContext } from '../..';\nimport { CustomerUsageData } from './usage/CustomerUsageData';\nimport { CustomerPortalIntentionType } from './types';\n\nexport type OnManageClick = ({ intentionType }: { intentionType: CustomerPortalIntentionType }) => void;\n\nexport function CustomerPortalContainer({\n onManageSubscription,\n onBuyMore,\n onCancelScheduledUpdates,\n onContactSupport,\n paywallComponent,\n hiddenSections,\n filterEntitlements,\n}: CustomerPortalProps) {\n const { stigg } = useStiggContext();\n const { customerPortal, textOverrides, theme, isLoading } = useCustomerPortalContext();\n const customerPortalSectionRef = useRef<HTMLDivElement>(null);\n\n const onManageClick: OnManageClick = ({ intentionType }: { intentionType: CustomerPortalIntentionType }) => {\n if (onManageSubscription) {\n void onManageSubscription({\n intentionType,\n customerSubscriptions: customerPortal?.subscriptions ?? [],\n });\n } else {\n customerPortalSectionRef?.current?.scrollIntoView({ behavior: 'smooth' });\n }\n };\n\n const shouldShowUsage = !hiddenSections?.some((section) => section === 'usage');\n const shouldShowPaymentDetails = !hiddenSections?.some(\n (section) => section === 'paymentDetails' || section === 'billingInformation',\n );\n const shouldShowInvoices = !hiddenSections?.some(\n (section) => section === 'invoices' || section === 'billingInformation',\n );\n\n return (\n <CustomerPortalLayout className=\"stigg-customer-portal-layout\">\n <CustomerPortalHeader showWatermark={stigg.isWidgetWatermarkEnabled && !!customerPortal} />\n <CustomerPortalSections className=\"stigg-customer-portal-sections\">\n <SubscriptionsOverview\n onCancelScheduledUpdates={onCancelScheduledUpdates}\n onBuyMore={onBuyMore}\n onManageSubscription={onManageClick}\n onContactSupport={onContactSupport}\n hiddenSections={hiddenSections}\n cancelScheduledUpdatesButtonTitle={textOverrides.cancelScheduledUpdatesButtonTitle}\n />\n {shouldShowUsage && (\n <CustomerUsageData\n onManageSubscription={onManageClick}\n onBuyMore={onBuyMore}\n filterEntitlements={filterEntitlements}\n />\n )}\n <CustomerPortalPaywall\n ref={customerPortalSectionRef}\n paywallComponent={paywallComponent}\n theme={theme}\n title={textOverrides.paywallSectionTitle}\n isLoading={!customerPortal || isLoading}\n />\n {shouldShowPaymentDetails && <PaymentDetailsSection />}\n {shouldShowInvoices && <InvoicesSection />}\n </CustomerPortalSections>\n </CustomerPortalLayout>\n );\n}\n","import React from 'react';\nimport { useCustomerPortalContext } from '../CustomerPortalProvider';\nimport { SectionTitle } from '../common/SectionTitle';\nimport { ExternalLinkButton } from '../common/ExternalLinkButton';\nimport { SectionContainer } from '../common/SectionContainer';\nimport { SectionHeader } from '../common/SectionHeader';\nimport { SkeletonButton } from '../common/SkeletonButton';\n\nexport function InvoicesSection() {\n const { customerPortal, isLoading, textOverrides, theme } = useCustomerPortalContext();\n const isLoadingData = !customerPortal || isLoading;\n\n const viewInvoiceHistoryButton = isLoadingData ? (\n <SkeletonButton />\n ) : customerPortal?.billingPortalUrl ? (\n <ExternalLinkButton\n url={customerPortal.billingPortalUrl}\n text={textOverrides.viewInvoiceHistory}\n className=\"stigg-view-invoice-history-button\"\n />\n ) : null;\n\n if (!isLoadingData && !customerPortal?.billingPortalUrl) {\n return null;\n }\n\n return (\n <SectionContainer\n className=\"stigg-invoices-section-layout\"\n $backgroundColor={theme.backgroundColor}\n $borderColor={theme.borderColor}>\n <SectionHeader className=\"stigg-invoices-section-header\">\n <SectionTitle\n isLoading={isLoadingData}\n className=\"stigg-invoices-section-title\"\n title={textOverrides.invoicesTitle}\n />\n {viewInvoiceHistoryButton}\n </SectionHeader>\n </SectionContainer>\n );\n}\n","import sortBy from 'lodash/sortBy';\nimport { Addon, BillingPeriod, Currency, SubscriptionAddon } from '@stigg/js-client-sdk';\n\ntype FilterAddonsBaseProps = {\n billingPeriod: BillingPeriod;\n currency: Currency;\n billingCountryCode?: string;\n};\n\nexport const sortAddons = (addons: Addon[]) => {\n return sortBy(addons, 'displayName');\n};\n\nexport const sortSubscriptionAddons = (addons: SubscriptionAddon[]) => {\n return sortBy(addons, 'addon.displayName');\n};\n\nfunction filterAddonPricePointsByBillingPeriod(addon: Addon, billingPeriod: BillingPeriod) {\n return addon.pricePoints.some((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n}\n\nfunction mapAddonPricePointsByBillingCountryCode({\n addon,\n currency,\n billingCountryCode,\n}: {\n addon: Addon;\n currency: Currency;\n billingCountryCode?: string;\n}) {\n return {\n ...addon,\n pricePoints: addon.pricePoints.filter(\n (pricePoint) =>\n pricePoint.currency === currency &&\n (billingCountryCode ? pricePoint.billingCountryCode === billingCountryCode : true),\n ),\n };\n}\n\nexport function filterAddons({\n addons,\n billingPeriod,\n billingCountryCode,\n currency,\n}: { addons?: Addon[] } & FilterAddonsBaseProps): Addon[] {\n return (\n addons\n ?.filter((addon) => filterAddonPricePointsByBillingPeriod(addon, billingPeriod))\n ?.map((addon) => mapAddonPricePointsByBillingCountryCode({ addon, currency, billingCountryCode })) || []\n );\n}\n\nexport function filterSubscriptionAddons({\n addons,\n billingPeriod,\n billingCountryCode,\n currency,\n}: { addons?: SubscriptionAddon[] } & FilterAddonsBaseProps): SubscriptionAddon[] {\n return (\n addons\n ?.filter((addon) => filterAddonPricePointsByBillingPeriod(addon.addon, billingPeriod))\n ?.map((addon) => ({\n ...addon,\n addon: mapAddonPricePointsByBillingCountryCode({ addon: addon.addon, currency, billingCountryCode }),\n })) || []\n );\n}\n","import cloneDeep from 'lodash/cloneDeep';\nimport remove from 'lodash/remove';\nimport { Addon, BillingPeriod, Currency, Plan, Subscription, SubscriptionAddon } from '@stigg/js-client-sdk';\nimport { useCheckoutContext } from '../CheckoutProvider';\nimport {\n filterAddons,\n filterSubscriptionAddons,\n sortAddons,\n sortSubscriptionAddons,\n} from '../steps/addons/addon.utils';\n\nexport type AddonsStepState = {\n addons: SubscriptionAddon[];\n initialAddons?: SubscriptionAddon[];\n availableAddons?: Addon[];\n};\n\ntype GetAddonsStepInitialStateProps = {\n plan?: Plan;\n billingPeriod: BillingPeriod;\n activeSubscription?: Subscription | null;\n billingCountryCode?: string;\n};\n\nexport function getAddonsStepInitialState({\n activeSubscription,\n plan,\n billingPeriod,\n billingCountryCode,\n}: GetAddonsStepInitialStateProps): AddonsStepState {\n let addons: SubscriptionAddon[] = [];\n const currency = plan?.pricePoints?.[0]?.currency || Currency.Usd;\n const availableAddons = sortAddons(\n filterAddons({\n addons: plan?.compatibleAddons,\n billingPeriod,\n billingCountryCode,\n currency,\n }),\n );\n\n const activeSubscriptionAddons = filterSubscriptionAddons({\n addons: activeSubscription?.addons,\n billingPeriod,\n billingCountryCode,\n currency,\n });\n\n if (activeSubscriptionAddons?.length && availableAddons?.length) {\n addons = sortSubscriptionAddons(\n activeSubscriptionAddons.filter((addon) => availableAddons.some((planAddon) => planAddon.id === addon.addon.id)),\n );\n }\n\n return { addons, initialAddons: cloneDeep(addons), availableAddons };\n}\n\nfunction useSetAddon() {\n const [, setState] = useCheckoutContext();\n\n return (addon: Addon, quantity: number) =>\n setState((draft) => {\n const addonToUpdate = draft.addonsStep.addons.find((currentAddon) => currentAddon.addon.id === addon.id);\n\n if (addonToUpdate) {\n addonToUpdate.quantity = quantity;\n } else {\n draft.addonsStep.addons.push({ addon, quantity });\n draft.addonsStep.addons = sortSubscriptionAddons(draft.addonsStep.addons);\n }\n });\n}\n\nfunction useRemoveAddon() {\n const [, setState] = useCheckoutContext();\n\n return (addonId: string) =>\n setState((draft) => {\n remove(draft.addonsStep.addons, (addon) => addon.addon.id === addonId);\n });\n}\n\nfunction useAddonsState() {\n const [{ addonsStep }] = useCheckoutContext();\n return addonsStep;\n}\n\nexport function useAddonsStepModel() {\n const state = useAddonsState();\n\n return {\n ...state,\n setAddon: useSetAddon(),\n removeAddon: useRemoveAddon(),\n };\n}\n","import { useCheckoutContext } from '../CheckoutProvider';\n\nexport type WidgetState = {\n readOnly?: boolean;\n isLoadingCheckoutData?: boolean;\n isValid?: boolean;\n};\n\nfunction useCheckoutState() {\n const [{ checkout, widgetState, checkoutLocalization }] = useCheckoutContext();\n return { checkoutState: checkout, widgetState, checkoutLocalization };\n}\n\nfunction useSetWidgetReadonly() {\n const [, setState] = useCheckoutContext();\n\n return (readOnly: boolean) =>\n setState((draft) => {\n draft.widgetState.readOnly = readOnly;\n });\n}\n\nfunction useSetIsValid() {\n const [, setState] = useCheckoutContext();\n\n return (isValid: boolean) =>\n setState((draft) => {\n draft.widgetState.isValid = isValid;\n });\n}\n\nexport function useCheckoutModel() {\n const { checkoutState, widgetState, checkoutLocalization } = useCheckoutState();\n\n return {\n checkoutState,\n widgetState,\n checkoutLocalization,\n setWidgetReadOnly: useSetWidgetReadonly(),\n setIsValid: useSetIsValid(),\n };\n}\n","import { BillableFeatureInput } from '@stigg/api-client-js/src/generated/sdk';\nimport { Addon, BillableFeature, BillingPeriod, CheckoutStatePlan } from '@stigg/js-client-sdk';\nimport { useCheckoutContext } from '../CheckoutProvider';\nimport { CheckoutSteps } from '../configurations/steps';\nimport { hasMultipleBillingPeriods } from '../../utils/planPrices';\n\nexport enum CheckoutStepKey {\n PLAN = 'PLAN',\n ADDONS = 'ADDONS',\n PAYMENT = 'PAYMENT',\n}\n\nexport type CheckoutStep = {\n key: CheckoutStepKey;\n label: string;\n};\n\nconst CHECKOUT_STEPS: CheckoutStep[] = [\n { key: CheckoutStepKey.PLAN, label: 'Plan' },\n { key: CheckoutStepKey.ADDONS, label: 'Add-ons' },\n { key: CheckoutStepKey.PAYMENT, label: 'Payment details' },\n];\n\nexport type ProgressBarState = {\n activeStep: number;\n completedSteps: number[];\n steps: CheckoutStep[];\n isDisabled: boolean;\n};\n\nconst INITIAL_STATE: ProgressBarState = {\n activeStep: 0,\n completedSteps: [],\n steps: CHECKOUT_STEPS,\n isDisabled: false,\n};\n\ntype GetProgressBarInitialStateProps = {\n isLoading: boolean;\n skipCheckoutSteps: CheckoutSteps[];\n plan?: CheckoutStatePlan;\n availableAddons?: Addon[];\n availableCharges: BillableFeatureInput[];\n preferredBillingPeriod?: BillingPeriod;\n preconfiguredBillableFeatures: BillableFeature[];\n};\n\nconst canSkipPlanStep = (\n plan: CheckoutStatePlan,\n availableCharges: BillableFeatureInput[],\n preconfiguredBillableFeatures: BillableFeature[],\n preferredBillingPeriod?: BillingPeriod,\n) => {\n // if multiple billing periods are available, a preferred billing period must be selected\n if (hasMultipleBillingPeriods(plan) && !preferredBillingPeriod) {\n return false;\n }\n\n const availableChargesIds = availableCharges.map((charge) => charge.featureId);\n const preconfiguredChargesIds = preconfiguredBillableFeatures.map((charge) => charge.featureId);\n\n // if there are available charges, they must be preconfigured\n if (\n availableChargesIds.length !== preconfiguredChargesIds.length ||\n !availableChargesIds.every((charge) => preconfiguredChargesIds.includes(charge))\n ) {\n return false;\n }\n\n return true;\n};\n\nexport function getProgressBarInitialState({\n isLoading,\n skipCheckoutSteps,\n plan,\n availableAddons,\n availableCharges,\n preferredBillingPeriod,\n preconfiguredBillableFeatures,\n}: GetProgressBarInitialStateProps) {\n if (isLoading || !plan) {\n return INITIAL_STATE;\n }\n\n const stepsToFilter: CheckoutStepKey[] = [];\n\n if (\n skipCheckoutSteps.includes('PLAN') &&\n canSkipPlanStep(plan, availableCharges, preconfiguredBillableFeatures, preferredBillingPeriod)\n ) {\n stepsToFilter.push(CheckoutStepKey.PLAN);\n }\n\n if (availableAddons?.length === 0 || skipCheckoutSteps.includes('ADDONS')) {\n stepsToFilter.push(CheckoutStepKey.ADDONS);\n }\n\n return { ...INITIAL_STATE, steps: CHECKOUT_STEPS.filter((step) => !stepsToFilter.includes(step.key)) };\n}\n\nfunction useProgressBarState() {\n const [{ progressBar }] = useCheckoutContext();\n return progressBar;\n}\n\nfunction useSetActiveStep() {\n const [, setState] = useCheckoutContext();\n return (stepNumber: number) =>\n setState(({ progressBar }) => {\n progressBar.activeStep = stepNumber;\n });\n}\nfunction useMarkStepAsCompleted() {\n const [, setState] = useCheckoutContext();\n return (stepNumber: number) =>\n setState(({ progressBar }) => {\n progressBar.completedSteps.push(stepNumber);\n });\n}\n\nfunction isCheckoutComplete(progressBar: ProgressBarState) {\n return progressBar.completedSteps.length >= progressBar.steps.length - 1;\n}\n\nfunction useGoNext() {\n const [, setState] = useCheckoutContext();\n return () =>\n setState(({ progressBar }) => {\n if (progressBar.isDisabled) {\n return;\n }\n\n if (!progressBar.completedSteps.includes(progressBar.activeStep)) {\n progressBar.completedSteps.push(progressBar.activeStep);\n }\n\n if (progressBar.activeStep < progressBar.steps.length - 1) {\n progressBar.activeStep += 1;\n }\n });\n}\n\nfunction useSetIsDisabled() {\n const [, setState] = useCheckoutContext();\n return (isDisabled?: boolean) =>\n setState(({ progressBar }) => {\n progressBar.isDisabled = !!isDisabled;\n });\n}\n\nexport function useProgressBarModel() {\n const progressBarState = useProgressBarState();\n const currentStep = progressBarState.steps[progressBarState.activeStep];\n\n return {\n currentStep,\n progressBarState,\n isLastStep: progressBarState.activeStep === progressBarState.steps.length - 1,\n isCheckoutComplete: isCheckoutComplete(progressBarState),\n setActiveStep: useSetActiveStep(),\n markStepAsCompleted: useMarkStepAsCompleted(),\n goNext: useGoNext(),\n setIsDisabled: useSetIsDisabled(),\n };\n}\n","import { Price } from '@stigg/js-client-sdk';\n\nexport const getValidPriceQuantity = (price: Price, quantity: number) => {\n if (price.minUnitQuantity && quantity < price.minUnitQuantity) {\n return price.minUnitQuantity;\n }\n if (price.maxUnitQuantity && quantity > price.maxUnitQuantity) {\n return price.maxUnitQuantity;\n }\n return quantity;\n};\n","import { Plan } from '@stigg/js-client-sdk';\nimport { BillingPeriod } from '@stigg/api-client-js/src/generated/sdk';\n\nexport const hasMonthlyPrices = (plan?: Plan) =>\n !!plan?.pricePoints.some((pricePoint) => pricePoint.billingPeriod === BillingPeriod.Monthly);\n\nexport const hasAnnualPrices = (plan?: Plan) =>\n !!plan?.pricePoints.some((pricePoint) => pricePoint.billingPeriod === BillingPeriod.Annually);\n\nexport const hasMultipleBillingPeriods = (plan?: Plan) => hasMonthlyPrices(plan) && hasAnnualPrices(plan);\n","import keyBy from 'lodash/keyBy';\nimport compact from 'lodash/compact';\nimport { BillableFeatureInput, BillingPeriod } from '@stigg/api-client-js/src/generated/sdk';\nimport { BillableFeature, BillingModel, Plan, Price, Subscription } from '@stigg/js-client-sdk';\nimport { useCheckoutContext } from '../CheckoutProvider';\nimport { getTierByQuantity, hasTierWithUnitPrice } from '../../utils/priceTierUtils';\nimport { getValidPriceQuantity } from '../../utils/priceUtils';\nimport { hasAnnualPrices, hasMonthlyPrices } from '../../utils/planPrices';\n\nexport type PlanStepState = {\n billingPeriod: BillingPeriod;\n billableFeatures: BillableFeatureInput[];\n billingCountryCode?: string;\n};\n\ntype GetPlanStepInitialStateProps = {\n preferredBillingPeriod?: BillingPeriod;\n plan?: Plan;\n activeSubscription?: Subscription | null;\n billingCountryCode?: string;\n preconfiguredBillableFeatures: BillableFeature[];\n};\n\nconst getBillingPeriod = (billingPeriod: BillingPeriod, hasMonthlyPrices?: boolean, hasAnnualPrices?: boolean) => {\n if (billingPeriod === BillingPeriod.Monthly && hasMonthlyPrices) {\n return billingPeriod;\n }\n if (billingPeriod === BillingPeriod.Annually && hasAnnualPrices) {\n return billingPeriod;\n }\n return null;\n};\n\nconst isInAdvanceCommitmentCharge = ({ pricingModel }: Price) => {\n return pricingModel === BillingModel.PerUnit;\n};\n\nfunction getBillableFeatures(\n preconfiguredBillableFeatures: BillableFeature[],\n planPrices?: Price[],\n activeSubscription?: Subscription | null,\n): BillableFeature[] {\n if (!planPrices) return [];\n\n const preconfBillableFeaturesByFeatureId = keyBy(preconfiguredBillableFeatures, 'featureId');\n\n const quantityByFeatureId = keyBy(\n compact(\n activeSubscription?.prices?.map((charge) => {\n const { feature } = charge;\n if (!feature || !isInAdvanceCommitmentCharge(charge)) {\n return null;\n }\n\n return {\n featureId: feature.featureId,\n quantity: feature.unitQuantity || null,\n };\n }),\n ),\n 'featureId',\n );\n\n return compact(\n planPrices?.map((price) => {\n const featureId = price.feature?.featureId;\n if (!featureId || !isInAdvanceCommitmentCharge(price)) {\n return null;\n }\n\n let quantity;\n const preconfiguredQuantity =\n preconfBillableFeaturesByFeatureId[featureId]?.quantity || quantityByFeatureId[featureId]?.quantity;\n\n quantity = getValidPriceQuantity(price, preconfiguredQuantity || 1);\n\n if (price.isTieredPrice && !hasTierWithUnitPrice(price.tiers)) {\n const tier = getTierByQuantity(price.tiers!, quantity);\n quantity = tier.upTo!;\n }\n\n return {\n featureId,\n quantity,\n };\n }),\n );\n}\n\nfunction resolveBillingPeriod({\n plan,\n activeSubscription,\n preferredBillingPeriod,\n}: {\n plan?: Plan;\n activeSubscription?: Subscription | null;\n preferredBillingPeriod?: BillingPeriod;\n}) {\n const hasMonthlyPlan = hasMonthlyPrices(plan);\n const hasAnnualPlan = hasAnnualPrices(plan);\n\n if (preferredBillingPeriod) {\n const billingPeriod = getBillingPeriod(preferredBillingPeriod, hasMonthlyPlan, hasAnnualPlan);\n if (billingPeriod) {\n return billingPeriod;\n }\n }\n\n const isUpdate = activeSubscription?.plan?.id === plan?.id;\n if (isUpdate) {\n return activeSubscription?.price?.billingPeriod || BillingPeriod.Monthly;\n }\n\n if (activeSubscription?.prices && activeSubscription?.prices.length > 0) {\n const billingPeriod = getBillingPeriod(activeSubscription?.prices[0].billingPeriod, hasMonthlyPlan, hasAnnualPlan);\n if (billingPeriod) {\n return billingPeriod;\n }\n }\n\n return hasAnnualPlan ? BillingPeriod.Annually : BillingPeriod.Monthly;\n}\n\nexport function getPlanStepInitialState({\n preferredBillingPeriod,\n plan,\n activeSubscription,\n billingCountryCode,\n preconfiguredBillableFeatures,\n}: GetPlanStepInitialStateProps): PlanStepState {\n const billingPeriod = resolveBillingPeriod({ plan, activeSubscription, preferredBillingPeriod });\n const planPrices = plan?.pricePoints.filter((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n const billableFeatures = getBillableFeatures(preconfiguredBillableFeatures, planPrices, activeSubscription);\n\n return {\n billingPeriod,\n billableFeatures,\n billingCountryCode,\n };\n}\n\nfunction usePlanState() {\n const [{ planStep }] = useCheckoutContext();\n return planStep;\n}\n\nfunction useSetBillableFeature() {\n const [, setState] = useCheckoutContext();\n\n return (featureId: string, quantity: number) =>\n setState((draft) => {\n const billableFeature = draft.planStep.billableFeatures.find(\n (billableFeature) => billableFeature.featureId === featureId,\n );\n\n if (billableFeature) {\n billableFeature.quantity = quantity;\n } else {\n draft.planStep.billableFeatures.push({ featureId, quantity });\n }\n });\n}\n\nfunction useSetBillingPeriod() {\n const [, setState] = useCheckoutContext();\n\n return (billingPeriod: BillingPeriod) =>\n setState((draft) => {\n draft.planStep.billingPeriod = billingPeriod;\n });\n}\n\nexport function usePlanStepModel() {\n const state = usePlanState();\n\n return {\n ...state,\n setBillingPeriod: useSetBillingPeriod(),\n setBillableFeature: useSetBillableFeature(),\n };\n}\n","import { useCheckoutContext } from '../CheckoutProvider';\nimport { AddonsStepState } from './useAddonsStepModel';\nimport { PromotionCodeState } from './useCouponModel';\nimport { PaymentStepState } from './usePaymentStepModel';\nimport { PlanStepState } from './usePlanStepModel';\n\nexport type SubscriptionState = PlanStepState &\n PromotionCodeState &\n Pick<AddonsStepState, 'addons'> &\n Pick<PaymentStepState, 'billingAddress' | 'taxPercentage'>;\n\nexport function useSubscriptionModel(): SubscriptionState {\n const [{ planStep, addonsStep, promotionCode, paymentStep }] = useCheckoutContext();\n\n return {\n ...planStep,\n addons: addonsStep.addons,\n promotionCode,\n billingAddress: paymentStep.billingAddress,\n taxPercentage: paymentStep.taxPercentage,\n };\n}\n","import { useCallback, useEffect, useState } from 'react';\nimport isEmpty from 'lodash/isEmpty';\nimport { BillingAddress, PreviewSubscription, StiggClient, SubscriptionPreviewV2 } from '@stigg/js-client-sdk';\nimport { useCheckoutContext } from '../CheckoutProvider';\nimport { useCheckoutModel } from './useCheckoutModel';\nimport { SubscriptionState, useSubscriptionModel } from './useSubscriptionModel';\nimport { MockCheckoutPreviewCallback } from '../types';\nimport { useStiggContext } from '../../../hooks/useStiggContext';\n\nfunction mapBillingInformation({\n billingAddress,\n taxPercentage,\n}: {\n billingAddress?: BillingAddress;\n taxPercentage?: number;\n}): Pick<PreviewSubscription, 'billingInformation'> {\n if (!billingAddress && !taxPercentage) {\n return {};\n }\n\n return {\n billingInformation: {\n ...(billingAddress ? { billingAddress } : {}),\n ...(taxPercentage ? { taxPercentage } : {}),\n },\n };\n}\n\ntype UsePreviewSubscriptionProps = {\n onMockCheckoutPreview?: MockCheckoutPreviewCallback;\n};\n\nexport type PreviewSubscriptionProps = {\n customerId?: string;\n planId?: string;\n resourceId?: string;\n stigg: StiggClient;\n} & SubscriptionState &\n UsePreviewSubscriptionProps;\n\nconst previewSubscription = async ({\n stigg,\n customerId,\n planId,\n resourceId,\n promotionCode,\n addons,\n billableFeatures,\n billingCountryCode,\n billingPeriod,\n billingAddress,\n taxPercentage,\n onMockCheckoutPreview,\n}: PreviewSubscriptionProps) => {\n const estimateAddons = addons.map(({ addon, quantity }) => ({ addonId: addon.id, quantity }));\n let subscriptionPreview: SubscriptionPreviewV2 | null = null;\n let errorMessage: string | null = null;\n\n try {\n if (customerId && planId) {\n const previewSubscriptionProps: PreviewSubscription = {\n customerId,\n planId,\n resourceId,\n billingCountryCode,\n addons: estimateAddons,\n billingPeriod,\n promotionCode,\n billableFeatures: isEmpty(billableFeatures) ? undefined : billableFeatures,\n ...mapBillingInformation({ billingAddress, taxPercentage }),\n };\n\n subscriptionPreview = onMockCheckoutPreview\n ? onMockCheckoutPreview(previewSubscriptionProps)\n : await stigg.previewSubscription(previewSubscriptionProps);\n }\n } catch (error) {\n const [, errorMsg] = (error as any)?.message?.split('Error:') || [];\n\n errorMessage = errorMsg?.trim();\n }\n\n return { subscriptionPreview, errorMessage };\n};\n\nexport const usePreviewSubscriptionAction = ({ onMockCheckoutPreview }: UsePreviewSubscriptionProps = {}) => {\n const { stigg } = useStiggContext();\n const subscription = useSubscriptionModel();\n const [{ resourceId }] = useCheckoutContext();\n const { checkoutState, widgetState } = useCheckoutModel();\n const { plan, customer } = checkoutState || {};\n\n const previewSubscriptionAction = useCallback(\n async ({ promotionCode }: { promotionCode?: string | null } = {}) => {\n if (!widgetState.isValid) {\n return { subscriptionPreview: null, errorMessage: null };\n }\n\n return previewSubscription({\n stigg,\n customerId: customer?.id,\n planId: plan?.id,\n resourceId,\n addons: subscription.addons,\n billableFeatures: subscription.billableFeatures,\n billingCountryCode: subscription.billingCountryCode,\n billingPeriod: subscription.billingPeriod,\n billingAddress: subscription.billingAddress,\n taxPercentage: subscription.taxPercentage,\n promotionCode: promotionCode ?? subscription.promotionCode,\n onMockCheckoutPreview,\n });\n },\n [\n stigg,\n customer?.id,\n plan?.id,\n resourceId,\n subscription.addons,\n subscription.billableFeatures,\n subscription.billingCountryCode,\n subscription.billingPeriod,\n subscription.billingAddress,\n subscription.taxPercentage,\n subscription.promotionCode,\n widgetState.isValid,\n onMockCheckoutPreview,\n ],\n );\n\n return { previewSubscriptionAction };\n};\n\nconst SUBSCRIPTION_PREVIEW_DEBOUNCE_TIME = 500;\n\nexport const usePreviewSubscription = ({ onMockCheckoutPreview }: UsePreviewSubscriptionProps = {}) => {\n const [subscriptionPreview, setSubscriptionPreview] = useState<SubscriptionPreviewV2 | null>(null);\n const [isFetchingSubscriptionPreview, setIsFetchingSubscriptionPreview] = useState(false);\n\n const { previewSubscriptionAction } = usePreviewSubscriptionAction({ onMockCheckoutPreview });\n\n useEffect(() => {\n const estimateSubscription = async () => {\n const { subscriptionPreview } = await previewSubscriptionAction();\n if (subscriptionPreview) {\n setSubscriptionPreview(subscriptionPreview);\n }\n\n setIsFetchingSubscriptionPreview(false);\n };\n\n setIsFetchingSubscriptionPreview(true);\n\n const timer = setTimeout(() => {\n setIsFetchingSubscriptionPreview(true);\n void estimateSubscription();\n }, SUBSCRIPTION_PREVIEW_DEBOUNCE_TIME);\n\n return () => {\n clearTimeout(timer);\n };\n }, [previewSubscriptionAction]);\n\n return { subscriptionPreview, isFetchingSubscriptionPreview };\n};\n","import { BillingAddress, Customer } from '@stigg/js-client-sdk';\n\nimport { useCheckoutContext } from '../CheckoutProvider';\n\nexport type PaymentStepState = {\n useNewPaymentMethod: boolean;\n errorMessage?: string;\n billingAddress?: BillingAddress;\n taxPercentage?: number;\n};\n\ntype GetPaymentStepInitialStateProps = {\n customer?: Customer;\n taxPercentage?: number;\n};\n\nexport function getPaymentStepInitialState({\n customer,\n taxPercentage,\n}: GetPaymentStepInitialStateProps): PaymentStepState {\n return {\n useNewPaymentMethod: !customer?.paymentMethodDetails,\n taxPercentage,\n };\n}\n\nfunction useSetUseNewPaymentMethod() {\n const [, setState] = useCheckoutContext();\n\n return (useNewPaymentMethod: boolean) =>\n setState((draft) => {\n draft.paymentStep.useNewPaymentMethod = useNewPaymentMethod;\n });\n}\n\nfunction useSetErrorMessage() {\n const [, setState] = useCheckoutContext();\n\n return (errorMessage?: string) =>\n setState((draft) => {\n draft.paymentStep.errorMessage = errorMessage;\n });\n}\n\nfunction useSetBillingAddress() {\n const [, setState] = useCheckoutContext();\n\n return (billingAddress?: BillingAddress) =>\n setState((draft) => {\n draft.paymentStep.billingAddress = billingAddress;\n });\n}\n\nfunction usePaymentState() {\n const [{ paymentStep }] = useCheckoutContext();\n return paymentStep;\n}\n\nexport function usePaymentStepModel() {\n const state = usePaymentState();\n\n return {\n ...state,\n setUseNewPaymentMethod: useSetUseNewPaymentMethod(),\n setErrorMessage: useSetErrorMessage(),\n setBillingAddress: useSetBillingAddress(),\n };\n}\n","import { CheckoutConfiguration } from '@stigg/js-client-sdk';\nimport { StiggTheme } from '../../../theme/types';\nimport { DeepPartial } from '../../../types';\n\nexport type CheckoutTheme = {\n primary: string;\n textColor: string;\n backgroundColor: string;\n borderColor: string;\n summaryBackgroundColor: string;\n paymentInputBackgroundColor?: string;\n paymentInputBorderColor?: string;\n paymentInputBorderRadius?: string;\n};\n\nconst defaultCheckoutTheme: CheckoutTheme = {\n primary: 'rgb(50, 126, 238)',\n textColor: 'rgb(0, 30, 108)',\n backgroundColor: 'rgb(255, 255, 255)',\n borderColor: 'rgb(235, 237, 243)',\n summaryBackgroundColor: 'rgb(109, 121, 144)',\n};\n\nexport function getResolvedCheckoutTheme(\n globalTheme: StiggTheme,\n themeOverride?: DeepPartial<CheckoutTheme>,\n // all the remote colors override theme colors, no need to use them here\n _remoteConfiguration?: CheckoutConfiguration | null,\n): CheckoutTheme {\n const { palette: globalPalette } = globalTheme || {};\n\n return {\n primary: themeOverride?.primary || globalPalette?.primary || defaultCheckoutTheme.primary,\n textColor: themeOverride?.textColor || globalPalette?.text.primary || defaultCheckoutTheme.textColor,\n backgroundColor:\n themeOverride?.backgroundColor || globalPalette?.backgroundPaper || defaultCheckoutTheme.backgroundColor,\n borderColor: themeOverride?.borderColor || globalPalette?.outlinedBorder || defaultCheckoutTheme.borderColor,\n summaryBackgroundColor:\n themeOverride?.summaryBackgroundColor ||\n globalPalette?.backgroundHighlight ||\n defaultCheckoutTheme.summaryBackgroundColor,\n paymentInputBackgroundColor: themeOverride?.paymentInputBackgroundColor,\n paymentInputBorderColor: themeOverride?.paymentInputBorderColor,\n paymentInputBorderRadius: themeOverride?.paymentInputBorderRadius,\n };\n}\n","import { produce } from 'immer';\nimport React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport { BillableFeature, BillingPeriod, GetCheckoutStateResults } from '@stigg/js-client-sdk';\nimport { CustomizedTheme, SdkThemeProvider, useStiggTheme } from '../../theme/Theme';\nimport { DeepPartial } from '../../types';\nimport { mapCheckoutConfiguration, mapTypography } from '../common/mapExternalTheme';\nimport {\n AddonsStepState,\n getAddonsStepInitialState,\n getPaymentStepInitialState,\n getPlanStepInitialState,\n getProgressBarInitialState,\n PaymentStepState,\n PlanStepState,\n ProgressBarState,\n useLoadCheckout,\n WidgetState,\n} from './hooks';\nimport { CheckoutLocalization, getResolvedCheckoutLocalize } from './configurations/textOverrides';\nimport { CheckoutTheme, getResolvedCheckoutTheme } from './configurations/theme';\nimport { StiggTheme } from '../../theme/types';\nimport { BillingInformation, MockCheckoutStateCallback } from './types';\nimport { defaultCheckoutTypography } from './configurations/typography';\nimport { CheckoutSteps } from './configurations/steps';\n\nexport interface CheckoutContextState {\n checkout?: GetCheckoutStateResults | null;\n checkoutLocalization: CheckoutLocalization;\n stiggTheme: StiggTheme;\n theme: CheckoutTheme;\n resourceId?: string;\n promotionCode?: string;\n progressBar: ProgressBarState;\n planStep: PlanStepState;\n addonsStep: AddonsStepState;\n paymentStep: PaymentStepState;\n widgetState: WidgetState;\n isWidgetWatermarkEnabled: boolean;\n}\n\nexport const CheckoutContext = React.createContext<\n [CheckoutContextState, (updater: (state: CheckoutContextState) => void) => void] | null\n>(null);\n\nCheckoutContext.displayName = 'CheckoutContext';\n\nexport const useCheckoutContext = () => {\n const ctx = useContext(CheckoutContext);\n if (!ctx) {\n throw new Error(\n 'Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.',\n );\n }\n return ctx;\n};\n\nconst CheckoutContextProvider: React.FC<{ children: React.ReactNode; initialState: CheckoutContextState }> = ({\n children,\n initialState,\n}) => {\n const [state, innerSetState] = useState(initialState);\n\n useEffect(() => {\n innerSetState(initialState);\n }, [initialState]);\n\n const setState = useCallback(\n (updater: (state: CheckoutContextState) => void) => innerSetState((old) => produce(old, (draft) => updater(draft))),\n [innerSetState],\n );\n\n const [contextValue, setContextValue] = useMemo(() => [state, setState], [setState, state]);\n\n return <CheckoutContext.Provider value={[contextValue, setContextValue]}>{children}</CheckoutContext.Provider>;\n};\n\nexport type CheckoutProviderProps = {\n textOverrides?: DeepPartial<CheckoutLocalization>;\n theme?: DeepPartial<CheckoutTheme>;\n resourceId?: string;\n planId: string;\n preferredBillingPeriod?: BillingPeriod;\n billingCountryCode?: string;\n billableFeatures?: BillableFeature[];\n billingInformation?: BillingInformation;\n onMockCheckoutState?: MockCheckoutStateCallback;\n skipCheckoutSteps?: CheckoutSteps[];\n};\n\nexport function CheckoutProvider({\n children,\n textOverrides,\n theme,\n preferredBillingPeriod,\n billableFeatures,\n resourceId,\n planId,\n billingCountryCode,\n billingInformation,\n onMockCheckoutState,\n skipCheckoutSteps,\n}: {\n children: React.ReactNode;\n} & CheckoutProviderProps) {\n const { checkout, isLoading, isWidgetWatermarkEnabled } = useLoadCheckout({\n resourceId,\n planId,\n billingCountryCode,\n onMockCheckoutState,\n });\n const configuration: CustomizedTheme = checkout?.configuration\n ? mapCheckoutConfiguration(checkout.configuration)\n : { typography: mapTypography(defaultCheckoutTypography) };\n const globalTheme: StiggTheme = useStiggTheme(configuration);\n\n const initialState = useMemo(() => {\n const checkoutTheme = getResolvedCheckoutTheme(globalTheme, theme, checkout?.configuration);\n const checkoutLocalization = getResolvedCheckoutLocalize(textOverrides);\n const planStep = getPlanStepInitialState({\n preferredBillingPeriod,\n plan: checkout?.plan,\n activeSubscription: checkout?.activeSubscription,\n billingCountryCode,\n preconfiguredBillableFeatures: billableFeatures ?? [],\n });\n const addonsStep = getAddonsStepInitialState({\n plan: checkout?.plan,\n billingPeriod: planStep.billingPeriod,\n activeSubscription: checkout?.activeSubscription,\n });\n const paymentStep = getPaymentStepInitialState({\n customer: checkout?.customer,\n taxPercentage: billingInformation?.taxDetails?.taxPercentage,\n });\n const progressBar = getProgressBarInitialState({\n isLoading,\n skipCheckoutSteps: skipCheckoutSteps ?? [],\n plan: checkout?.plan,\n availableAddons: addonsStep.availableAddons,\n availableCharges: planStep.billableFeatures,\n preferredBillingPeriod,\n preconfiguredBillableFeatures: billableFeatures ?? [],\n });\n\n const initialState: CheckoutContextState = {\n checkout,\n checkoutLocalization,\n stiggTheme: globalTheme,\n theme: checkoutTheme,\n progressBar,\n planStep,\n addonsStep,\n paymentStep,\n resourceId: checkout?.resource?.id,\n widgetState: { readOnly: false, isValid: true, isLoadingCheckoutData: isLoading },\n isWidgetWatermarkEnabled,\n };\n\n return initialState;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n preferredBillingPeriod,\n billingCountryCode,\n checkout,\n isLoading,\n skipCheckoutSteps,\n billingInformation?.taxDetails?.taxPercentage,\n ]);\n\n return (\n <SdkThemeProvider key={checkout?.plan.id} componentTheme={configuration}>\n <CheckoutContextProvider initialState={initialState}>{children}</CheckoutContextProvider>\n </SdkThemeProvider>\n );\n}\n","import { GetCheckoutStateResults } from '@stigg/js-client-sdk';\nimport { useEffect, useState } from 'react';\nimport logger from '../../../services/logger';\nimport { MockCheckoutStateCallback } from '../types';\nimport { useStiggContext } from '../../../hooks/useStiggContext';\n\ntype UseLoadCheckoutProps = {\n planId: string;\n resourceId?: string;\n billingCountryCode?: string;\n onMockCheckoutState?: MockCheckoutStateCallback;\n};\n\nexport function useLoadCheckout({ planId, resourceId, billingCountryCode, onMockCheckoutState }: UseLoadCheckoutProps) {\n const { stigg } = useStiggContext();\n const [isLoading, setIsLoading] = useState(true);\n const [checkout, setCheckout] = useState<GetCheckoutStateResults | null>();\n\n useEffect(() => {\n const loadCheckout = async () => {\n try {\n const checkout = await stigg.getCheckoutState({ planId, resourceId, billingCountryCode });\n setCheckout(checkout);\n } catch (err) {\n logger.error(`Failed to load checkout ${(err as any)?.message}`, err as any);\n } finally {\n setIsLoading(false);\n }\n };\n\n if (onMockCheckoutState) {\n setIsLoading(false);\n setCheckout(onMockCheckoutState({ planId, resourceId, billingCountryCode }));\n return;\n }\n\n if (stigg.isCustomerLoaded) {\n setIsLoading(true);\n void loadCheckout();\n }\n }, [stigg, stigg.isCustomerLoaded, resourceId, planId, billingCountryCode, onMockCheckoutState]);\n\n return {\n checkout,\n isLoading,\n isWidgetWatermarkEnabled: stigg.isWidgetWatermarkEnabled,\n };\n}\n","import {\n BillingPeriod,\n DiscountType,\n Plan,\n SubscriptionPreviewDiscount,\n SubscriptionPreviewTaxDetails,\n DiscountDurationType,\n} from '@stigg/js-client-sdk';\nimport moment from 'moment';\nimport merge from 'lodash/merge';\nimport { DeepPartial } from '../../../types';\nimport { currencyPriceFormatter } from '../../utils/currencyUtils';\n\nexport type CheckoutLocalization = {\n changePlan: string;\n billingPeriodsTitle: string;\n addAddonText: string;\n newPaymentMethodText: string;\n newPaymentMethodCardTitle: string;\n newPaymentMethodBillingAddressTitle: string;\n summary: {\n title: string;\n planName: (params: { plan: Plan }) => string;\n addCouponCodeText: string;\n couponCodeTitle: string;\n addonsSectionTitle: string;\n discountsSectionTitle: string;\n onlyPayAsYouGoText: string;\n startsAtText: string;\n proratedTotalDueText: string;\n baseChargeText: string | ((params: { billingPeriod: BillingPeriod }) => string);\n totalText: string;\n totalDueText: string;\n totalBillingPeriodText: (params: { billingPeriod: BillingPeriod }) => string;\n discountText: (params: { discountDetails: SubscriptionPreviewDiscount; currency: string }) => string;\n appliedCreditsTitle: string;\n taxTitle: (params: { taxDetails: SubscriptionPreviewTaxDetails }) => string;\n checkoutSuccessText: string;\n payAsYouGoTooltipText: string;\n changesWillApplyAtEndOfBillingPeriod: string | ((params: { billingPeriodEnd: Date }) => string);\n creditsForUnusedTimeText: (params: { credits: string }) => string;\n };\n checkoutButton: {\n nextText: string;\n noChangesText: string;\n updateText: string;\n downgradeToFreeText: string;\n upgradeText: string;\n };\n downgradeToFree: {\n alertText: (params: { plan: Plan }) => string;\n freePlanHeader: (params: { plan: Plan }) => string;\n freePlanName: (params: { plan: Plan }) => string;\n freePlanPriceText: (params: { plan: Plan }) => string;\n paidPlanHeader: (params: { plan: Plan }) => string;\n paidPlanName: (params: { plan: Plan }) => string;\n paidPlanPriceText: (params: { plan: Plan; billingPeriod?: BillingPeriod }) => string;\n };\n};\n\nexport function getResolvedCheckoutLocalize(\n localizeOverride?: DeepPartial<CheckoutLocalization>,\n): CheckoutLocalization {\n const checkoutDefaultLocalization: CheckoutLocalization = {\n changePlan: 'Change',\n billingPeriodsTitle: 'Billing cycle',\n addAddonText: 'Add',\n newPaymentMethodText: 'New payment method',\n newPaymentMethodBillingAddressTitle: 'Billing address',\n newPaymentMethodCardTitle: 'Payment method',\n summary: {\n title: 'Order summary',\n planName: ({ plan }) => `${plan.displayName} plan`,\n addCouponCodeText: 'Add promotion code',\n couponCodeTitle: 'Promotion code',\n addonsSectionTitle: 'Add-ons',\n discountsSectionTitle: 'Discounts',\n onlyPayAsYouGoText: 'Varies by usage',\n startsAtText: 'Starts at ',\n proratedTotalDueText: 'Prorated charge today',\n baseChargeText: () => 'Base charge',\n totalText: 'Total',\n totalDueText: 'Total due today',\n totalBillingPeriodText: ({ billingPeriod }) => `Billed ${billingPeriod.toLowerCase()}`,\n appliedCreditsTitle: 'Applied credits',\n creditsForUnusedTimeText: ({ credits }) =>\n `Your account will be granted credits worth ${credits} for unused time, which will be automatically applied to future payments.`,\n discountText: ({ discountDetails, currency }) => {\n let discountText = '';\n if (discountDetails.type === DiscountType.Percentage) {\n discountText = `${discountDetails.value}% off`;\n } else {\n discountText = `${currencyPriceFormatter({ amount: discountDetails.value, currency })}`;\n }\n\n let discountTextPostfix = '';\n switch (discountDetails.durationType) {\n case DiscountDurationType.Once: {\n discountTextPostfix = ' once';\n break;\n }\n case DiscountDurationType.Repeating: {\n const prefix = discountDetails.type === DiscountType.Fixed ? ' per month' : '';\n discountTextPostfix = `${prefix} for ${discountDetails.durationInMonths} months`;\n\n break;\n }\n\n case DiscountDurationType.Forever:\n default: {\n discountTextPostfix = '';\n }\n }\n\n return `${discountText}${discountTextPostfix}`;\n },\n taxTitle: ({ taxDetails }) => `Tax (${taxDetails?.percentage}%)`,\n changesWillApplyAtEndOfBillingPeriod: ({ billingPeriodEnd }) =>\n `Your changes will take effect at the end of your current billing cycle on ${moment(billingPeriodEnd).format(\n 'MMMM D, YYYY',\n )}.`,\n checkoutSuccessText: 'Changes applied',\n payAsYouGoTooltipText: 'Billed according to actual usage',\n },\n checkoutButton: {\n nextText: 'Next',\n noChangesText: 'No changes',\n updateText: 'Update subscription',\n downgradeToFreeText: 'Cancel subscription',\n upgradeText: 'Subscribe',\n },\n downgradeToFree: {\n alertText: () => `We’re sorry to see you cancel your paid subscription 😭`,\n freePlanHeader: () => 'New plan',\n freePlanName: ({ plan }) => `${plan.displayName}`,\n freePlanPriceText: () => 'Free',\n paidPlanHeader: () => 'Current plan',\n paidPlanName: ({ plan }) => `${plan.displayName}`,\n paidPlanPriceText: ({ billingPeriod }) =>\n `Paid plan${billingPeriod ? `, billed ${billingPeriod.toLowerCase()}` : ''}`,\n },\n };\n\n return merge(checkoutDefaultLocalization, localizeOverride);\n}\n","<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"plus\">\n<path id=\"Shape\" d=\"M10 4.16666V15.8333\" stroke=\"#327EEE\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path id=\"Shape_2\" d=\"M4.16699 10H15.8337\" stroke=\"#327EEE\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","import styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport { mq } from '../common/mediaQuery';\n\nexport const CheckoutLayout = styled.div`\n margin: auto;\n min-height: 760px;\n max-width: 920px;\n display: flex;\n position: relative;\n flex-direction: column;\n align-items: center;\n\n background-color: ${({ theme }) => theme.stigg.palette.backgroundPaper};\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedBorder}`};\n\n & * {\n box-sizing: border-box;\n }\n\n padding: 16px 16px;\n ${mq.md} {\n padding: 32px;\n width: calc(100% - 64px);\n border-radius: 10px;\n }\n`;\nexport const CheckoutContent = styled(Box)`\n display: flex;\n align-items: flex-start;\n gap: 32px;\n flex-wrap: wrap;\n width: 100%;\n\n flex-direction: column;\n ${mq.md} {\n flex-direction: row;\n }\n`;\n\nexport const CheckoutPanel = styled(Box)`\n display: flex;\n flex-direction: column;\n gap: 0;\n flex: 2;\n\n width: 100%;\n ${mq.md} {\n width: auto;\n }\n`;\n","import styled from '@emotion/styled/macro';\nimport LinearProgress, { linearProgressClasses } from '@mui/material/LinearProgress';\nimport Button, { buttonClasses } from '@mui/material/Button';\nimport { Icon } from '../../common/Icon';\n\nexport const StyledProgress = styled(LinearProgress, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{\n $disabled?: boolean;\n}>(({ theme, $disabled }) => ({\n [`&.${linearProgressClasses.root}`]: {\n borderRadius: theme.stigg.border.radius,\n backgroundColor: theme.stigg.palette.outlinedBorder,\n },\n [`& .${linearProgressClasses.bar}`]: {\n backgroundColor: $disabled ? theme.stigg.palette.primaryLight : theme.stigg.palette.primary,\n },\n}));\n\nexport const StyledStepButton = styled(Button)(() => ({\n [`&.${buttonClasses.root}`]: {\n textTransform: 'none',\n lineHeight: 'inherit',\n justifyContent: 'flex-start',\n padding: '8px 4px',\n },\n}));\n\nexport const StyledIcon = styled(Icon, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{\n $disabled?: boolean;\n $shouldFill?: boolean;\n}>(({ theme, $disabled, $shouldFill }) => ({\n circle: {\n stroke: $disabled ? theme.stigg.palette.primaryLight : theme.stigg.palette.primary,\n fill: $shouldFill ? ($disabled ? theme.stigg.palette.primaryLight : theme.stigg.palette.primary) : undefined,\n },\n}));\n","import React, { useEffect, useRef } from 'react';\nimport Grid from '@mui/material/Grid';\nimport Box from '@mui/material/Box';\nimport StepIcon from '@mui/material/StepIcon';\nimport { useCheckoutModel, useProgressBarModel } from '../hooks';\nimport { Typography } from '../../common/Typography';\nimport { StyledIcon, StyledProgress, StyledStepButton } from './CheckoutProgressBar.style';\nimport { Icons } from '../../common/Icon';\nimport { Skeleton } from '../components/Skeletons.style';\nimport { useIsScreenWiderThan } from '../../hooks/useIsScreenWiderThan';\n\nexport const CheckoutProgressBar = () => {\n const { progressBarState, setActiveStep, currentStep } = useProgressBarModel();\n const { widgetState } = useCheckoutModel();\n const isScreenWiderThanMd = useIsScreenWiderThan('md');\n const containerRef = useRef<HTMLElement>();\n const { readOnly, isLoadingCheckoutData } = widgetState;\n const { activeStep, completedSteps, steps } = progressBarState || {};\n const progress = ((activeStep + 1) * 100) / steps.length;\n\n const [previousStep, setPreviousStep] = React.useState(currentStep);\n useEffect(() => {\n if (!isScreenWiderThanMd) {\n if (containerRef.current && currentStep !== previousStep) {\n containerRef.current.scrollIntoView({ behavior: 'smooth' });\n }\n }\n setPreviousStep(currentStep);\n }, [currentStep, isScreenWiderThanMd, previousStep, setPreviousStep]);\n\n if (progressBarState.steps.length === 1) {\n return null;\n }\n\n return (\n <Box className=\"stigg-checkout-progress-container\" sx={{ width: '100%', mb: 3 }} ref={containerRef}>\n <StyledProgress variant=\"determinate\" value={progress} $disabled={readOnly} />\n <Grid container display=\"flex\">\n {steps.map(({ key, label }, index) => {\n const isCompleted = completedSteps.includes(index);\n const isDisabled =\n readOnly ||\n (index > activeStep && !isCompleted && !completedSteps.includes(index - 1)) ||\n (activeStep !== index && progressBarState.isDisabled);\n const checkedIcon: Icons = isDisabled ? 'OutlinedCheckedCircleDisabled' : 'OutlinedCheckedCircle';\n\n return (\n <Grid\n key={key}\n item\n display=\"flex\"\n flexDirection=\"row\"\n flex={isScreenWiderThanMd ? 1 : 'auto'}\n justifyContent=\"flex-start\">\n {isLoadingCheckoutData ? (\n <Skeleton width={120} height={20} style={{ marginTop: 8 }} />\n ) : (\n <StyledStepButton onClick={() => setActiveStep(index)} fullWidth disabled={isDisabled}>\n <Grid item display=\"flex\" flexDirection=\"row\" alignItems=\"center\" gap={1}>\n <StepIcon\n icon={\n <StyledIcon\n icon={isCompleted ? checkedIcon : 'OutlinedCircle'}\n $disabled={isDisabled}\n $shouldFill={isCompleted}\n />\n }\n />\n\n <Typography variant=\"h6\" color={isDisabled ? 'primary.main.light' : 'primary.main'}>\n {label}\n </Typography>\n </Grid>\n </StyledStepButton>\n )}\n </Grid>\n );\n })}\n </Grid>\n </Box>\n );\n};\n","import sortBy from 'lodash/sortBy';\nimport { useMemo } from 'react';\n\nimport { BillingModel, Price } from '@stigg/js-client-sdk';\n\nconst CHARGES_BILLING_MODEL_ORDER = [BillingModel.FlatFee, BillingModel.PerUnit, BillingModel.UsageBased];\n\nexport const sortCharges = (charges: Price[]) => {\n return sortBy(charges, [\n (charge) => CHARGES_BILLING_MODEL_ORDER.indexOf(charge.pricingModel),\n (charge) => charge.feature?.displayName,\n ]);\n};\n\nexport const useChargesSort = (charges: Price[]) => {\n return useMemo(() => sortCharges(charges), [charges]);\n};\n","import { useCheckoutContext } from '../CheckoutProvider';\n\nexport type PromotionCodeState = {\n promotionCode?: string;\n};\n\nfunction usePromotionCodeState() {\n const [{ promotionCode }] = useCheckoutContext();\n return promotionCode;\n}\n\nfunction useSetPromotionCode() {\n const [, setState] = useCheckoutContext();\n\n return (promotionCode: string) =>\n setState((draft) => {\n draft.promotionCode = promotionCode;\n });\n}\n\nexport function usePromotionCodeModel() {\n const promotionCode = usePromotionCodeState();\n\n return {\n promotionCode,\n setPromotionCode: useSetPromotionCode(),\n };\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\n\nimport PlusIcon from '../../../assets/plus-icon.svg';\nimport { Typography } from '../../common/Typography';\nimport { Button } from '../components';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\n\nconst StyledPlusIcon = styled(PlusIcon, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{ $disabled: boolean }>`\n margin-right: 8px;\n path {\n stroke: ${({ theme, $disabled }) => ($disabled ? theme.stigg.palette.text.disabled : theme.stigg.palette.primary)};\n }\n`;\n\nexport type AddPromotionCodeButtonProps = {\n onAddClick: () => void;\n checkoutLocalization: CheckoutLocalization;\n disabled: boolean;\n};\n\nexport const AddPromotionCodeButton = ({ onAddClick, checkoutLocalization, disabled }: AddPromotionCodeButtonProps) => (\n <Button\n disabled={disabled}\n fullWidth\n className=\"stigg-checkout-summary-add-coupon-code-button\"\n sx={{\n textTransform: 'none',\n justifyContent: 'flex-start',\n color: disabled ? 'text.disabled' : 'primary.main',\n }}\n variant=\"text\"\n size=\"medium\"\n onClick={onAddClick}>\n <StyledPlusIcon $disabled={disabled} className=\"stigg-checkout-summary-add-coupon-code-button-icon\" />\n <Typography\n className=\"stigg-checkout-change-plan-button-text\"\n color={disabled ? 'disabled' : 'primary.main'}\n style={{ lineHeight: '24px' }}\n variant=\"h3\">\n {checkoutLocalization.summary.addCouponCodeText}\n </Typography>\n </Button>\n);\n","import React, { useState } from 'react';\n\nimport styled from '@emotion/styled/macro';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport Grid from '@mui/material/Grid';\n\nimport { Icon } from '../../common/Icon';\nimport { Typography } from '../../common/Typography';\nimport { Button, InputField } from '../components';\nimport { usePreviewSubscriptionAction } from '../hooks';\nimport { usePromotionCodeModel } from '../hooks/useCouponModel';\nimport { AddPromotionCodeButton } from './AddPromotionCodeButton';\nimport { PromotionCodeSectionProps } from './PromotionCodeSection';\n\nconst CouponCodeAddButton = styled(Button)`\n padding: 4px 10px;\n min-width: unset;\n border-radius: ${({ theme }) => theme.stigg.border.radius};\n display: flex;\n align-items: center;\n`;\n\nexport const AddPromotionCode = ({\n disabled,\n checkoutLocalization,\n onMockCheckoutPreview,\n}: PromotionCodeSectionProps) => {\n const { setPromotionCode: persistPromotionCode } = usePromotionCodeModel();\n const [showInput, setShowInput] = useState(false);\n const [promotionCode, setPromotionCode] = React.useState('');\n const [isLoading, setIsLoading] = React.useState(false);\n const [errorMessage, setErrorMessage] = React.useState('');\n const { previewSubscriptionAction } = usePreviewSubscriptionAction({ onMockCheckoutPreview });\n\n const handlePromotionCode = async () => {\n setIsLoading(true);\n setErrorMessage('');\n\n const { subscriptionPreview, errorMessage } = await previewSubscriptionAction({ promotionCode });\n\n if (!errorMessage && subscriptionPreview?.immediateInvoice?.discountDetails) {\n persistPromotionCode(promotionCode.toUpperCase());\n setShowInput(false);\n } else if (errorMessage) {\n setErrorMessage(errorMessage);\n }\n setIsLoading(false);\n };\n\n if (!showInput) {\n return (\n <AddPromotionCodeButton\n disabled={disabled}\n onAddClick={() => setShowInput(true)}\n checkoutLocalization={checkoutLocalization}\n />\n );\n }\n\n return (\n <Grid>\n <Typography variant=\"body1\" color={errorMessage ? 'error' : disabled ? 'disabled' : 'primary.main'}>\n {checkoutLocalization.summary.couponCodeTitle}\n </Typography>\n\n <InputField\n disabled={disabled}\n autoFocus\n variant=\"outlined\"\n fullWidth\n error={!!errorMessage}\n value={promotionCode}\n onChange={(e) => {\n setPromotionCode(e.target.value);\n }}\n inputProps={{ maxLength: 20 }}\n onKeyDown={(e: any) => {\n if (e.key === 'Enter') {\n void handlePromotionCode();\n e.preventDefault();\n }\n }}\n // eslint-disable-next-line react/jsx-no-duplicate-props\n InputProps={{\n endAdornment: (\n <CouponCodeAddButton\n variant=\"contained\"\n disabled={disabled}\n onClick={() => {\n void handlePromotionCode();\n }}>\n {isLoading ? (\n <CircularProgress size={18} sx={{ color: 'white' }} />\n ) : (\n <Icon style={{ display: 'flex' }} icon=\"ArrowForward\" />\n )}\n </CouponCodeAddButton>\n ),\n }}\n />\n {!!errorMessage && (\n <Typography variant=\"body1\" color=\"error\">\n {errorMessage}\n </Typography>\n )}\n </Grid>\n );\n};\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport Grid from '@mui/material/Grid';\nimport { Icon } from '../../common/Icon';\nimport { Typography } from '../../common/Typography';\nimport { Button } from '../components';\n\nconst AppliedCouponContainer = styled(Grid)`\n width: auto;\n display: inline-flex;\n align-items: center;\n flex-direction: row;\n gap: 8px;\n padding: 6px 8px;\n border-radius: ${({ theme }) => theme.stigg.border.radius};\n border: 1px solid ${({ theme }) => theme.stigg.palette.primary};\n`;\n\nexport const StyledIcon = styled(Icon, { shouldForwardProp: (prop) => prop !== 'style' })<{ $shouldFill?: boolean }>`\n display: flex;\n\n g {\n stroke: ${({ theme }) => theme.stigg.palette.primary};\n }\n\n path {\n fill: ${({ theme, $shouldFill }) => ($shouldFill ? theme.stigg.palette.primary : undefined)};\n }\n`;\n\nexport type AppliedPromotionCodeProps = {\n promotionCode: string;\n onClearPromotionCode: () => void;\n};\n\nexport const AppliedPromotionCode = ({ promotionCode, onClearPromotionCode }: AppliedPromotionCodeProps) => (\n <AppliedCouponContainer container>\n <Grid item display=\"flex\" gap={1} alignItems=\"center\">\n <StyledIcon icon=\"Coupon\" />\n <Typography variant=\"body1\" color=\"primary.main\" lineHeight=\"auto\">\n {promotionCode}\n </Typography>\n </Grid>\n <Grid item>\n <Button variant=\"text\" sx={{ minWidth: 'unset', padding: 0 }} onClick={onClearPromotionCode}>\n <StyledIcon icon=\"Close\" $shouldFill />\n </Button>\n </Grid>\n </AppliedCouponContainer>\n);\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { usePromotionCodeModel } from '../hooks/useCouponModel';\nimport { AddPromotionCode } from './AddPromotionCode';\nimport { AppliedPromotionCode } from './AppliedPromotionCode';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\nimport { MockCheckoutPreviewCallback } from '../types';\n\nconst PromotionCodeSectionContainer = styled.div`\n margin: 16px 0;\n`;\n\nexport type PromotionCodeSectionProps = {\n disabled: boolean;\n checkoutLocalization: CheckoutLocalization;\n onMockCheckoutPreview?: MockCheckoutPreviewCallback;\n};\n\nexport const PromotionCodeSection = ({\n disabled,\n checkoutLocalization,\n onMockCheckoutPreview,\n}: PromotionCodeSectionProps) => {\n const { promotionCode, setPromotionCode } = usePromotionCodeModel();\n\n const onClearPromotionCode = () => {\n setPromotionCode('');\n };\n\n const content = promotionCode ? (\n <AppliedPromotionCode promotionCode={promotionCode} onClearPromotionCode={onClearPromotionCode} />\n ) : (\n <AddPromotionCode\n disabled={disabled}\n checkoutLocalization={checkoutLocalization}\n onMockCheckoutPreview={onMockCheckoutPreview}\n />\n );\n\n return <PromotionCodeSectionContainer>{content}</PromotionCodeSectionContainer>;\n};\n","import React from 'react';\nimport { StripeAddressElementChangeEvent } from '@stripe/stripe-js';\nimport Grid from '@mui/material/Grid';\nimport { BillingAddress } from '@stigg/js-client-sdk';\nimport { AddressElement, PaymentElement } from '@stripe/react-stripe-js';\nimport { Typography } from '../../../../common/Typography';\nimport { useCheckoutModel, usePaymentStepModel } from '../../../hooks';\nimport { CheckoutContainerProps } from '../../../CheckoutContainer';\n\nexport function StripePaymentForm({\n onBillingAddressChange,\n collectPhoneNumber,\n}: Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber'>) {\n const { checkoutState, checkoutLocalization, widgetState, setWidgetReadOnly } = useCheckoutModel();\n const { setBillingAddress } = usePaymentStepModel();\n const { customer, configuration } = checkoutState || {};\n const { readOnly } = widgetState;\n const shouldCollectPhoneNumber = !!(collectPhoneNumber ?? configuration?.content?.collectPhoneNumber);\n\n const handleAddressChange = (args: StripeAddressElementChangeEvent) => {\n if (!args.complete) {\n return;\n }\n\n const { postal_code: postalCode, ...addressFields } = args.value.address;\n const billingAddress: BillingAddress = {\n postalCode,\n ...addressFields,\n };\n\n setWidgetReadOnly(true);\n setBillingAddress(billingAddress);\n\n if (onBillingAddressChange) {\n const callExternalBillingAddressChanged = async () => {\n await onBillingAddressChange({ billingAddress });\n setWidgetReadOnly(false);\n };\n\n void callExternalBillingAddressChanged();\n } else {\n setWidgetReadOnly(false);\n }\n };\n\n return (\n <Grid flexDirection=\"column\" container gap={3} padding=\"16px\" sx={{ pointerEvents: readOnly ? 'none' : undefined }}>\n <Grid flexDirection=\"column\" container gap={2}>\n <Typography variant=\"h6\">{checkoutLocalization.newPaymentMethodBillingAddressTitle}</Typography>\n <AddressElement\n onChange={handleAddressChange}\n options={{\n mode: 'billing',\n fields: { phone: shouldCollectPhoneNumber ? 'always' : 'auto' },\n defaultValues: {\n ...(customer?.name && { name: customer.name }),\n },\n }}\n />\n </Grid>\n <Grid flexDirection=\"column\" container gap={2}>\n <Typography variant=\"h6\">{checkoutLocalization.newPaymentMethodCardTitle}</Typography>\n <PaymentElement\n onChange={() => {}}\n onReady={() => {}}\n options={{\n readOnly,\n terms: { card: 'never' },\n defaultValues: {\n billingDetails: {\n ...(customer?.name && { name: customer.name }),\n ...(customer?.email && { email: customer.email }),\n },\n },\n }}\n />\n </Grid>\n </Grid>\n );\n}\n","import { ApplySubscriptionResults, PaymentCollection } from '@stigg/js-client-sdk';\nimport { Stripe, StripeElements } from '@stripe/stripe-js';\n\ntype StripeElementsProps = {\n stripe: Stripe | null;\n elements: StripeElements | null;\n};\n\nconst FAILED_PAYMENT_COLLECTION_STATUSES = [PaymentCollection.Failed, PaymentCollection.Processing];\n\nexport async function handleStripeFormValidations({ elements }: Pick<StripeElementsProps, 'elements'>) {\n if (!elements) {\n const errorMessage = 'Stripe elements not initialized';\n console.error(errorMessage);\n return { success: false, errorMessage };\n }\n\n const { error: elementsError } = await elements.submit();\n\n if (elementsError) {\n console.log(elementsError.message);\n return { success: false, errorMessage: elementsError.message || '' };\n }\n\n return { success: true };\n}\n\nexport async function handleStripeNextAction({\n applySubscriptionResults,\n stripe,\n}: {\n applySubscriptionResults: ApplySubscriptionResults;\n stripe: Stripe | null;\n}) {\n const subscription = applySubscriptionResults?.subscription;\n const paymentIntentClientSecret = subscription?.latestInvoice?.paymentSecret;\n const paymentCollection = subscription?.paymentCollection;\n\n if (stripe && paymentIntentClientSecret && paymentCollection === PaymentCollection.ActionRequired) {\n const { error: NextActionError } = await stripe.handleNextAction({ clientSecret: paymentIntentClientSecret });\n if (NextActionError) {\n return { errorMessage: NextActionError.message || '' };\n }\n } else if (paymentCollection && FAILED_PAYMENT_COLLECTION_STATUSES.includes(paymentCollection)) {\n return { errorMessage: subscription?.latestInvoice?.errorMessage || 'An error occurred - try again later' };\n }\n\n return { subscription };\n}\n\nasync function handleStripeSetup({\n stripe,\n elements,\n clientSecret,\n}: {\n stripe: Stripe;\n elements: StripeElements;\n clientSecret: string;\n}) {\n let newPaymentMethodId: string | undefined;\n let setupErrorMessage: string | undefined;\n\n const { error: setupError } = await stripe.confirmSetup({\n elements,\n confirmParams: { return_url: window.location.href },\n redirect: 'if_required',\n });\n\n if (setupError) {\n if (setupError.type === 'card_error' || setupError.type === 'validation_error') {\n if (setupError.type === 'card_error') {\n // Set some error message\n setupErrorMessage = setupError.message || '';\n }\n } else {\n setupErrorMessage = 'An unexpected error occurred.';\n }\n } else {\n try {\n const { setupIntent } = await stripe.retrieveSetupIntent(clientSecret);\n if (setupIntent?.payment_method) {\n newPaymentMethodId = setupIntent.payment_method as string;\n }\n } catch (e) {\n setupErrorMessage = 'An unexpected error occurred.';\n console.error(e);\n }\n }\n\n return { newPaymentMethodId, setupErrorMessage };\n}\n\nexport async function handleNewPaymentMethod({\n stripe,\n elements,\n setupIntentClientSecret,\n}: {\n stripe: Stripe | null;\n elements: StripeElements | null;\n setupIntentClientSecret?: string;\n}): Promise<{ success: boolean; errorMessage?: string; paymentMethodId?: string }> {\n if (!stripe || !elements || !setupIntentClientSecret) {\n return { success: false };\n }\n\n const stripeFormValidationsResults = await handleStripeFormValidations({ elements });\n if (!stripeFormValidationsResults.success) {\n return { success: false, errorMessage: stripeFormValidationsResults.errorMessage };\n }\n\n const { newPaymentMethodId, setupErrorMessage } = await handleStripeSetup({\n stripe,\n elements,\n clientSecret: setupIntentClientSecret,\n });\n\n if (setupErrorMessage || !newPaymentMethodId) {\n return { success: false, errorMessage: setupErrorMessage };\n }\n\n return { success: true, paymentMethodId: newPaymentMethodId };\n}\n","import styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport Color from 'color';\nimport React, { useEffect, useRef } from 'react';\nimport Lottie from 'react-lottie';\nimport animationData from '../../../assets/lottie/checkout-success.json';\nimport { Typography } from '../../common/Typography';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\n\nexport const ANIMATION_DURATION = 5000;\n\nconst CheckoutSuccessContainer = styled(Box)`\n @keyframes blurFade {\n 0% {\n background-color: ${({ theme }) => Color(theme.stigg.palette.backgroundPaper).alpha(0).toString()};\n backdrop-filter: blur(0px);\n }\n 100% {\n background-color: ${({ theme }) => Color(theme.stigg.palette.backgroundPaper).alpha(0.9).toString()};\n backdrop-filter: blur(6.5px);\n }\n }\n\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n z-index: 5;\n background-color: ${({ theme }) => Color(theme.stigg.palette.backgroundPaper).alpha(0.9).toString()};\n animation: blurFade 2s ease-in forwards;\n display: flex;\n flex-direction: column;\n justify-content: center;\n\n * rect {\n fill: transparent;\n }\n\n & path {\n stroke: ${({ theme }) => theme.stigg.palette.primary};\n }\n`;\n\nconst CheckoutSuccessText = styled(Typography)`\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 75% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n align-self: center;\n animation: fadeIn 5s ease-in forwards;\n`;\n\nexport function CheckoutSuccess({ checkoutLocalization }: { checkoutLocalization: CheckoutLocalization }) {\n const containerRef = useRef<HTMLDivElement>();\n useEffect(() => {\n if (containerRef.current) {\n containerRef.current.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' });\n }\n }, []);\n return (\n <CheckoutSuccessContainer className=\"stigg-checkout-success-container\" ref={containerRef}>\n <Lottie\n options={{ animationData, loop: false, autoplay: true }}\n width={350}\n height=\"auto\"\n style={{ display: 'flex', justifyContent: 'center' }}\n />\n <CheckoutSuccessText variant=\"h1\" color=\"primary.main\">\n {checkoutLocalization.summary.checkoutSuccessText}\n </CheckoutSuccessText>\n </CheckoutSuccessContainer>\n );\n}\n","import { ApplySubscription, ApplySubscriptionResults } from '@stigg/js-client-sdk';\nimport { useElements, useStripe } from '@stripe/react-stripe-js';\nimport { useStiggContext } from '../../../../..';\nimport { useCheckoutModel } from '../../../hooks';\nimport { usePaymentStepModel } from '../../../hooks/usePaymentStepModel';\nimport { useSubscriptionState } from '../../../hooks/useSubscriptionState';\nimport { CheckoutContainerProps, CheckoutResult } from '../../../CheckoutContainer';\nimport { handleNewPaymentMethod, handleStripeNextAction } from './stripe.utils';\nimport { ANIMATION_DURATION } from '../../../summary/CheckoutSuccess';\n\nconst delay = (ms: number) => new Promise((res) => setTimeout(res, ms));\n\nexport type HandleSubmitResult = { results?: ApplySubscriptionResults; success: boolean; errorMessage?: string };\n\nexport type UseSubmitProps = {\n onSuccess?: () => void;\n isMocked?: boolean;\n} & Pick<CheckoutContainerProps, 'onCheckout' | 'onCheckoutCompleted' | 'disableSuccessAnimation'>;\n\nexport function useSubmit({\n isMocked = false,\n onCheckout,\n onCheckoutCompleted,\n onSuccess,\n disableSuccessAnimation,\n}: UseSubmitProps) {\n const { stigg } = useStiggContext();\n const { useNewPaymentMethod } = usePaymentStepModel();\n const subscriptionState = useSubscriptionState();\n const { checkoutState, widgetState, setWidgetReadOnly } = useCheckoutModel();\n const { setupSecret: setupIntentClientSecret, customer } = checkoutState || {};\n const stripe = useStripe();\n const elements = useElements();\n\n const handleSubmit = async (e: any): Promise<HandleSubmitResult> => {\n e.preventDefault();\n\n if (!subscriptionState) {\n return { success: false, errorMessage: 'Unexpected error, please contact support.' };\n }\n\n let success = true;\n let errorMessage: string | undefined;\n let usedStiggCheckoutAction = false;\n let paymentMethodId: string | undefined;\n\n setWidgetReadOnly(true);\n\n if (!isMocked && useNewPaymentMethod) {\n const paymentMethodResults = await handleNewPaymentMethod({ elements, stripe, setupIntentClientSecret });\n if (!paymentMethodResults.success) {\n errorMessage = paymentMethodResults.errorMessage;\n success = false;\n } else {\n paymentMethodId = paymentMethodResults.paymentMethodId;\n }\n }\n\n const checkoutParams: ApplySubscription = { ...subscriptionState, paymentMethodId };\n\n const checkoutAction = async (params: ApplySubscription): Promise<CheckoutResult> => {\n usedStiggCheckoutAction = true;\n\n try {\n const applySubscriptionResults = await stigg.applySubscription(params);\n\n const nextActionResults = await handleStripeNextAction({ applySubscriptionResults, stripe });\n\n return {\n success: !nextActionResults.errorMessage,\n errorMessage: nextActionResults.errorMessage,\n results: applySubscriptionResults,\n };\n } catch (e) {\n console.error(e);\n errorMessage = (e as any)?.message;\n return { success: false, errorMessage };\n }\n };\n\n let checkoutResults: ApplySubscriptionResults | undefined;\n\n if (success) {\n if (onCheckout) {\n const externalCheckoutResults = await onCheckout({\n customerId: customer!.id,\n checkoutParams,\n checkoutAction,\n });\n if (externalCheckoutResults.errorMessage) {\n errorMessage = externalCheckoutResults.errorMessage;\n }\n\n if (!usedStiggCheckoutAction && externalCheckoutResults.results && externalCheckoutResults.success) {\n const nextActionResults = await handleStripeNextAction({\n applySubscriptionResults: externalCheckoutResults.results,\n stripe,\n });\n\n if (nextActionResults.errorMessage) {\n errorMessage = nextActionResults.errorMessage;\n success = false;\n }\n }\n\n success = success && externalCheckoutResults.success && !errorMessage;\n checkoutResults = externalCheckoutResults.results;\n } else {\n const checkoutActionResults = await checkoutAction(checkoutParams);\n if (!checkoutActionResults.success && checkoutActionResults.errorMessage) {\n errorMessage = checkoutActionResults.errorMessage;\n }\n success = checkoutActionResults.success && !errorMessage;\n checkoutResults = checkoutActionResults.results;\n }\n }\n\n setWidgetReadOnly(false);\n\n if (success && onSuccess) {\n onSuccess();\n\n if (!disableSuccessAnimation) {\n await delay(ANIMATION_DURATION); // Wait for animation to finish\n }\n }\n\n await onCheckoutCompleted({ success, error: errorMessage });\n\n return { results: checkoutResults, success: !errorMessage, errorMessage };\n };\n\n return { handleSubmit, isLoading: !!widgetState?.readOnly };\n}\n","import React, { FC, PropsWithChildren } from 'react';\nimport { Skeleton } from '../../components/Skeletons.style';\n\nexport const WithSkeleton: FC<\n PropsWithChildren<{\n isLoading: boolean;\n width?: number | string;\n height?: number | string;\n }>\n> = ({ isLoading, width = 50, height = 16, children }) => {\n if (isLoading) {\n return <Skeleton width={width} height={height} />;\n }\n\n return <>{children}</>;\n};\n","/* eslint-disable react/no-unused-prop-types */\nimport React from 'react';\nimport moment from 'moment';\nimport { Box } from '@mui/material';\nimport { BillingModel, BillingPeriod, Plan, Subscription, SubscriptionPreviewV2 } from '@stigg/js-client-sdk';\nimport { Typography } from '../../../common/Typography';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { CheckoutLocalization } from '../../configurations/textOverrides';\nimport { WithSkeleton } from './WithSkeleton';\n\nexport type CheckoutCaptionProps = {\n subscriptionPreview?: SubscriptionPreviewV2 | null;\n isFetchingSubscriptionPreview: boolean;\n activeSubscription?: Subscription | null;\n plan?: Plan;\n checkoutLocalization: CheckoutLocalization;\n billingPeriod: BillingPeriod;\n};\n\nconst RemainingCreditsCaption = ({\n subscriptionPreview,\n isFetchingSubscriptionPreview,\n checkoutLocalization,\n}: CheckoutCaptionProps) => {\n const { immediateInvoice } = subscriptionPreview || {};\n if (!immediateInvoice?.proration?.netAmount?.amount || immediateInvoice?.proration?.netAmount?.amount >= 0) {\n return null;\n }\n\n const positiveAmount = immediateInvoice.proration.netAmount.amount * -1;\n\n const credits = currencyPriceFormatter({\n amount: positiveAmount,\n currency: immediateInvoice.proration.netAmount.currency,\n minimumFractionDigits: 2,\n });\n\n return (\n <Typography variant=\"body1\" style={{ marginTop: 14 }} className=\"stigg-checkout-summary-captions-remaining-credits\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview} width=\"100%\">\n {checkoutLocalization.summary.creditsForUnusedTimeText({ credits })}\n </WithSkeleton>\n </Typography>\n );\n};\n\nconst ScheduledUpdatesCaption = ({\n subscriptionPreview,\n activeSubscription,\n isFetchingSubscriptionPreview,\n checkoutLocalization,\n}: CheckoutCaptionProps) => {\n if (!subscriptionPreview?.hasScheduledUpdates || !activeSubscription?.currentBillingPeriodEnd) {\n return null;\n }\n\n const { currentBillingPeriodEnd } = activeSubscription;\n const changesWillApplyText =\n typeof checkoutLocalization.summary.changesWillApplyAtEndOfBillingPeriod === 'function'\n ? checkoutLocalization.summary.changesWillApplyAtEndOfBillingPeriod({ billingPeriodEnd: currentBillingPeriodEnd })\n : checkoutLocalization.summary.changesWillApplyAtEndOfBillingPeriod;\n\n return (\n <Typography variant=\"body1\" style={{ marginTop: 14 }} className=\"stigg-checkout-summary-captions-scheduled-updates\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview} width=\"100%\">\n {changesWillApplyText}\n </WithSkeleton>\n </Typography>\n );\n};\n\nconst NextBillingCaption = ({\n subscriptionPreview,\n activeSubscription,\n plan,\n isFetchingSubscriptionPreview,\n billingPeriod,\n}: CheckoutCaptionProps) => {\n const { recurringInvoice } = subscriptionPreview || {};\n if (!subscriptionPreview || !recurringInvoice?.total.amount) {\n return null;\n }\n\n const currentBillingPeriodEnd = subscriptionPreview.hasScheduledUpdates\n ? activeSubscription?.currentBillingPeriodEnd\n : subscriptionPreview?.billingPeriodRange.end;\n\n const total = currencyPriceFormatter({\n ...recurringInvoice.total,\n minimumFractionDigits: 2,\n });\n\n const hasUnitBasedPricing = plan?.pricePoints.some((price) => price.pricingModel === BillingModel.UsageBased);\n const hasNonUnitBasedPricing = plan?.pricePoints.some((price) => price.pricingModel !== BillingModel.UsageBased);\n\n let text = 'We will bill you ';\n let totalAmountText = `${total} `;\n\n if (hasUnitBasedPricing) {\n if (!hasNonUnitBasedPricing) {\n totalAmountText = 'for';\n } else {\n totalAmountText += '+';\n }\n\n totalAmountText += ' applicable usage-based charges for this subscription ';\n }\n\n let nextBillingDate;\n let billingPeriodText;\n\n switch (billingPeriod) {\n case BillingPeriod.Monthly:\n billingPeriodText = 'month';\n nextBillingDate = `the ${moment(currentBillingPeriodEnd).format('Do')}`;\n break;\n case BillingPeriod.Annually:\n billingPeriodText = 'year';\n nextBillingDate = moment(currentBillingPeriodEnd).format('MMMM Do');\n break;\n default: {\n break;\n }\n }\n\n text += `${totalAmountText}for this subscription every ${billingPeriodText} on ${nextBillingDate}, unless you cancel.`;\n\n return (\n <Typography variant=\"body1\" style={{ marginTop: 14 }} className=\"stigg-checkout-summary-captions-next-billing\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview} width=\"100%\">\n {text}\n </WithSkeleton>\n </Typography>\n );\n};\n\nexport function CheckoutCaptions(props: CheckoutCaptionProps) {\n return (\n <Box className=\"stigg-checkout-summary-captions\">\n <RemainingCreditsCaption {...props} />\n\n <ScheduledUpdatesCaption {...props} />\n\n <NextBillingCaption {...props} />\n </Box>\n );\n}\n","import { BillingModel, BillingPeriod, Currency, Price, TiersMode } from '@stigg/js-client-sdk';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { isBulkTiers, isQuantityInFirstTier } from '../../../utils/priceTierUtils';\nimport { numberFormatter } from '../../../utils/numberUtils';\n\nexport type GetPriceBreakdownStringProps = {\n totalAmount: number;\n quantity: number;\n tiersMode: Price['tiersMode'];\n tiers: Price['tiers'];\n currency: Currency;\n pricingModel: BillingModel;\n billingPeriod: BillingPeriod;\n blockSize?: number | null;\n priceAmount?: Price['amount'];\n};\n\nexport function formatPricePerUnit({\n quantity,\n totalAmount,\n pricingModel,\n billingPeriod,\n currency,\n blockSize,\n priceAmount,\n}: GetPriceBreakdownStringProps) {\n const isPerUnit = pricingModel === BillingModel.PerUnit;\n const aBlockSize = blockSize || 1;\n const featureUnits =\n quantity && (isPerUnit || quantity > 1) ? `${numberFormatter(quantity)} ${aBlockSize > 1 ? 'for' : 'x'} ` : '';\n const billingPeriodString = billingPeriod === BillingPeriod.Annually ? ' x 12 months' : '';\n\n const unitPrice = (priceAmount || totalAmount / quantity) / (billingPeriod === BillingPeriod.Annually ? 12 : 1);\n const formattedUnitPrice = currencyPriceFormatter({\n amount: unitPrice,\n currency,\n minimumFractionDigits: 2,\n });\n const formattedTotalPrice = currencyPriceFormatter({\n amount: totalAmount,\n currency,\n minimumFractionDigits: 2,\n });\n\n return `${featureUnits}${formattedUnitPrice}${billingPeriodString} ${\n billingPeriodString || featureUnits ? ` = ${formattedTotalPrice}` : ''\n }`;\n}\n\nexport function getPriceBreakdownString(params: GetPriceBreakdownStringProps) {\n const { totalAmount, quantity, tiersMode, tiers, currency } = params;\n if (isBulkTiers(tiers) || (tiersMode === TiersMode.Graduated && !isQuantityInFirstTier(tiers, quantity))) {\n const formattedTotalPrice = currencyPriceFormatter({\n amount: totalAmount,\n currency,\n minimumFractionDigits: 2,\n });\n return `${numberFormatter(quantity)} for ${formattedTotalPrice}`;\n }\n\n return formatPricePerUnit(params);\n}\n","import React from 'react';\nimport isNil from 'lodash/isNil';\nimport { Price, PriceTierFragment } from '@stigg/js-client-sdk';\nimport { Typography } from '../../../common/Typography';\nimport { calculateTierPriceGraduated } from '../../../utils/priceTierUtils';\nimport { formatPricePerUnit } from './getPriceBreakdownString';\nimport { LineItemContainer, LineItemRow } from './LineItems';\nimport { numberFormatter } from '../../../utils/numberUtils';\n\nfunction getLabel(tiers: PriceTierFragment[], index: number): string {\n const { unitPrice, upTo } = tiers[index];\n if (!unitPrice) {\n return '';\n }\n\n if (index === 0) {\n return `First ${upTo}`;\n }\n\n const previousTierUpTo = tiers[index - 1].upTo || 0;\n const startUnit = previousTierUpTo + 1;\n\n return isNil(upTo)\n ? `${numberFormatter(startUnit)} and above`\n : `Next ${numberFormatter(startUnit)} to ${numberFormatter(upTo)}`;\n}\n\nexport type GraduatedPriceBreakdownProps = {\n price: Price;\n unitQuantity: number;\n};\n\nexport function GraduatedPriceBreakdown({ price, unitQuantity }: GraduatedPriceBreakdownProps) {\n const tiers = price.tiers || [];\n\n const { breakdown } = calculateTierPriceGraduated(tiers, unitQuantity);\n\n if (breakdown.length === 1) {\n return null;\n }\n\n return (\n <>\n {breakdown.map(({ unitQuantity, amount }, index) => (\n <LineItemContainer>\n <LineItemRow key={index} style={{ alignItems: 'flex-start' }}>\n <Typography variant=\"body1\" color=\"tertiary\" style={{ whiteSpace: 'nowrap' }}>\n {getLabel(tiers, index)}\n </Typography>\n <Typography variant=\"body1\" color=\"tertiary\" style={{ whiteSpace: 'nowrap' }}>\n {formatPricePerUnit({\n quantity: unitQuantity,\n totalAmount: amount,\n currency: price.currency,\n pricingModel: price.pricingModel,\n billingPeriod: price.billingPeriod,\n tiers: price.tiers,\n tiersMode: price.tiersMode,\n blockSize: price.blockSize,\n priceAmount: price.amount,\n })}\n </Typography>\n </LineItemRow>\n </LineItemContainer>\n ))}\n </>\n );\n}\n","import { ChevronRight } from 'react-feather';\nimport styled from 'styled-components';\n\nexport const CollapsableSectionIcon = styled(ChevronRight)<{ $isOpen: boolean; $size?: number }>`\n height: ${({ $size = 24 }) => `${$size}px`};\n width: ${({ $size = 24 }) => `${$size}px`};\n transition: all 0.2s ease-in;\n ${({ $isOpen }) => $isOpen && `transform: rotate(90deg)`}\n`;\n","import React, { ReactNode, useState } from 'react';\nimport styled from '@emotion/styled/macro';\nimport Grid from '@mui/material/Grid';\nimport {\n BillingModel,\n Price,\n SubscriptionPreviewInvoice,\n SubscriptionPreviewV2,\n TiersMode,\n} from '@stigg/js-client-sdk';\nimport isEmpty from 'lodash/isEmpty';\nimport isNil from 'lodash/isNil';\nimport Link from '@mui/material/Link';\nimport { IconButton } from '@mui/material';\nimport Collapse from '@mui/material/Collapse';\nimport { Typography } from '../../../common/Typography';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { WithSkeleton } from './WithSkeleton';\nimport { Skeleton } from '../../components/Skeletons.style';\nimport { CheckoutLocalization } from '../../configurations/textOverrides';\nimport { Icon } from '../../../common/Icon';\nimport { InformationTooltip } from '../../../common/InformationTooltip';\nimport { getPriceBreakdownString } from './getPriceBreakdownString';\nimport { GraduatedPriceBreakdown } from './GraduatedPriceBreakdown';\nimport { CollapsableSectionIcon } from '../../../common/CollapsableSectionIcon';\nimport { calculateTierPrice } from '../../../utils/priceTierUtils';\nimport { useIsScreenWiderThan } from '../../../hooks/useIsScreenWiderThan';\nimport { mq } from '../../../common/mediaQuery';\n\nexport const LineItemContainer = styled.div`\n & + & {\n margin-top: 16px;\n }\n`;\n\nexport const NestedBreakdownContainer = styled.div`\n margin-top: 16px;\n margin-left: 16px;\n`;\n\nexport const LineItemRow = styled.div`\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n ${mq.lg} {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n`;\n\nconst PayAsYouGoPriceTooltip = ({ checkoutLocalization }: { checkoutLocalization: CheckoutLocalization }) => {\n const title = <Typography variant=\"body1\">{checkoutLocalization.summary.payAsYouGoTooltipText}</Typography>;\n return (\n <InformationTooltip placement=\"left\" title={title}>\n <Icon icon=\"PayAsYouGoCharge\" style={{ display: 'flex' }} />\n </InformationTooltip>\n );\n};\n\nexport const BilledPriceLineItem = ({\n checkoutLocalization,\n label,\n quantity,\n price,\n}: {\n checkoutLocalization: CheckoutLocalization;\n label: string;\n quantity: number;\n price: Price;\n}) => {\n const isScreenWiderThanLg = useIsScreenWiderThan('lg');\n const [isNestedBreakdownOpen, setIsNestedBreakdownOpen] = useState(false);\n const toggleNestedBreakdown = () => setIsNestedBreakdownOpen((prev) => !prev);\n\n const isPayAsYouGo = price.pricingModel === BillingModel.UsageBased;\n const totalAmount = price.isTieredPrice\n ? calculateTierPrice(price, quantity)\n : (price.amount || 0) * Math.ceil(quantity / (price.blockSize || 1));\n\n let nestedBreakdown: ReactNode;\n const shouldShowGraduatedPriceBreakdown =\n price.tiersMode === TiersMode.Graduated &&\n !!price.tiers &&\n !isEmpty(price.tiers) &&\n !isNil(price.tiers[0].upTo) &&\n quantity > price.tiers[0].upTo;\n\n if (shouldShowGraduatedPriceBreakdown) {\n nestedBreakdown = <GraduatedPriceBreakdown price={price} unitQuantity={quantity} />;\n }\n\n let title: ReactNode = (\n <Typography variant=\"body1\" color=\"secondary\">\n {label}\n </Typography>\n );\n\n if (nestedBreakdown) {\n title = (\n <Link onClick={toggleNestedBreakdown} underline=\"none\" style={{ cursor: 'pointer' }}>\n {title}\n </Link>\n );\n }\n\n return (\n <LineItemContainer className=\"stigg-checkout-summary-base-charges-container\">\n <LineItemRow style={{ alignItems: 'flex-start' }}>\n <Grid item display=\"flex\" gap={0.5} style={{ whiteSpace: isScreenWiderThanLg ? 'nowrap' : 'break-spaces' }}>\n {title}\n {nestedBreakdown && (\n <IconButton onClick={toggleNestedBreakdown} sx={{ padding: 0 }}>\n <CollapsableSectionIcon $isOpen={isNestedBreakdownOpen} $size={16} />\n </IconButton>\n )}\n </Grid>\n <Grid item display=\"flex\" gap={1} alignItems=\"center\">\n {isPayAsYouGo && <PayAsYouGoPriceTooltip checkoutLocalization={checkoutLocalization} />}\n <Typography\n variant=\"body1\"\n color=\"secondary\"\n style={{ whiteSpace: isScreenWiderThanLg ? 'nowrap' : 'break-spaces' }}>\n {getPriceBreakdownString({\n totalAmount,\n quantity,\n currency: price.currency,\n pricingModel: price.pricingModel,\n billingPeriod: price.billingPeriod,\n tiers: price.tiers,\n tiersMode: price.tiersMode,\n blockSize: price.blockSize,\n priceAmount: price.amount,\n })}\n {isPayAsYouGo && ' / unit'}\n </Typography>\n </Grid>\n </LineItemRow>\n {nestedBreakdown && (\n <Collapse in={isNestedBreakdownOpen}>\n <NestedBreakdownContainer>{nestedBreakdown}</NestedBreakdownContainer>\n </Collapse>\n )}\n </LineItemContainer>\n );\n};\n\nexport const FreeChargeLineItem = ({ label }: { label: string }) => {\n return (\n <LineItemContainer>\n <LineItemRow style={{ alignItems: 'flex-end' }}>\n <Grid item>\n <Typography variant=\"body1\" color=\"secondary\">\n {label}\n </Typography>\n </Grid>\n <Grid item display=\"flex\" gap={1} alignItems=\"center\">\n <Typography variant=\"body1\" color=\"secondary\" style={{ wordBreak: 'break-word' }}>\n Free\n </Typography>\n </Grid>\n </LineItemRow>\n </LineItemContainer>\n );\n};\n\nexport const DiscountLineItem = ({\n subscriptionPreview,\n isFetchingSubscriptionPreview,\n checkoutLocalization,\n}: {\n subscriptionPreview: SubscriptionPreviewV2;\n isFetchingSubscriptionPreview: boolean;\n checkoutLocalization: CheckoutLocalization;\n}) => {\n const { immediateInvoice, recurringInvoice } = subscriptionPreview;\n const { discount, discountDetails } = recurringInvoice || {};\n if (!discount || !discountDetails) {\n return null;\n }\n\n return (\n <LineItemContainer>\n <LineItemRow>\n <Typography variant=\"body1\" color=\"secondary\">\n {checkoutLocalization.summary.discountText({\n discountDetails,\n currency: immediateInvoice.total.currency,\n })}\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n {isFetchingSubscriptionPreview ? (\n <Skeleton width={50} height={16} />\n ) : (\n currencyPriceFormatter({\n amount: discount.amount,\n currency: discount.currency,\n minimumFractionDigits: 2,\n })\n )}\n </Typography>\n </LineItemRow>\n </LineItemContainer>\n );\n};\n\nexport const AppliedCreditsLineItem = ({\n subscriptionPreview,\n isFetchingSubscriptionPreview,\n checkoutLocalization,\n}: {\n subscriptionPreview: SubscriptionPreviewV2 | null;\n isFetchingSubscriptionPreview: boolean;\n checkoutLocalization: CheckoutLocalization;\n}) => {\n const { immediateInvoice } = subscriptionPreview || {};\n const { credits } = immediateInvoice || {};\n\n if (!credits || !credits.used || credits.used.amount <= 0) {\n return null;\n }\n\n return (\n <LineItemContainer>\n <LineItemRow>\n <Typography variant=\"body1\" color=\"secondary\">\n {checkoutLocalization.summary.appliedCreditsTitle}\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview}>\n {currencyPriceFormatter({\n amount: -1 * credits.used.amount,\n currency: credits.used.currency,\n minimumFractionDigits: 2,\n })}\n </WithSkeleton>\n </Typography>\n </LineItemRow>\n </LineItemContainer>\n );\n};\n\nexport const TaxLineItem = ({\n tax,\n taxDetails,\n isFetchingSubscriptionPreview,\n checkoutLocalization,\n}: {\n isFetchingSubscriptionPreview: boolean;\n checkoutLocalization: CheckoutLocalization;\n} & Pick<SubscriptionPreviewInvoice, 'tax' | 'taxDetails'>) => {\n if (!taxDetails || !tax || tax?.amount <= 0) {\n return null;\n }\n\n return (\n <LineItemContainer>\n <LineItemRow>\n <Typography variant=\"body1\" color=\"secondary\">\n {checkoutLocalization.summary.taxTitle({ taxDetails })}\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview}>\n {currencyPriceFormatter({ amount: tax?.amount, currency: tax?.currency, minimumFractionDigits: 2 })}\n </WithSkeleton>\n </Typography>\n </LineItemRow>\n </LineItemContainer>\n );\n};\n","import React, { useState } from 'react';\nimport partition from 'lodash/partition';\nimport styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport Divider from '@mui/material/Divider';\nimport Grid from '@mui/material/Grid';\nimport Paper from '@mui/material/Paper';\nimport { BillingModel } from '@stigg/js-client-sdk';\nimport { PoweredByStigg } from '../../common/PoweredByStigg';\nimport { Typography } from '../../common/Typography';\nimport { useChargesSort } from '../../hooks/useChargeSort';\nimport { currencyPriceFormatter } from '../../utils/currencyUtils';\nimport { Button } from '../components';\nimport {\n useCheckoutModel,\n useProgressBarModel,\n usePreviewSubscription,\n useSubscriptionModel,\n usePaymentStepModel,\n} from '../hooks';\nimport { PromotionCodeSection } from '../promotionCode';\nimport { useSubmit } from '../steps/payment/stripe';\nimport { CheckoutContainerProps } from '../CheckoutContainer';\nimport { CheckoutCaptions } from './components/CheckoutCaptions';\nimport {\n AppliedCreditsLineItem,\n BilledPriceLineItem,\n DiscountLineItem,\n FreeChargeLineItem,\n LineItemContainer,\n LineItemRow,\n TaxLineItem,\n} from './components/LineItems';\nimport { WithSkeleton } from './components/WithSkeleton';\nimport { Icon } from '../../common/Icon';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\nimport { CheckoutSuccess } from './CheckoutSuccess';\nimport { getFeatureDisplayNameText } from '../../utils/getFeatureName';\nimport { mq } from '../../common/mediaQuery';\n\nexport const SummaryContainer = styled(Box)`\n width: 100%;\n max-width: 470px;\n flex: 1.5;\n`;\n\nexport const SummaryCard = styled(Paper)`\n background: ${({ theme }) => theme.stigg.palette.backgroundHighlight};\n padding: 16px;\n\n ${mq.md} {\n border-radius: 10px;\n }\n`;\n\nSummaryCard.defaultProps = {\n elevation: 0,\n};\n\nconst SummaryTitle = styled(Typography)`\n margin-bottom: 16px;\n font-weight: 500;\n`;\n\nconst StyledDivider = styled(Divider)`\n margin: 16px 0;\n`;\n\nconst TotalDueText = styled(Typography)`\n margin-bottom: 8px;\n`;\n\nfunction resolveCheckoutButtonText({\n isLastStep,\n checkoutHasChanges,\n isFreeDowngrade,\n checkoutLocalization,\n isPlanUpdate,\n}: {\n isLastStep?: boolean;\n checkoutHasChanges: boolean;\n isFreeDowngrade: boolean;\n checkoutLocalization: CheckoutLocalization;\n isPlanUpdate?: boolean;\n}) {\n if (!isLastStep) {\n return checkoutLocalization.checkoutButton.nextText;\n }\n\n if (!checkoutHasChanges) {\n return checkoutLocalization.checkoutButton.noChangesText;\n }\n\n if (isPlanUpdate) {\n return checkoutLocalization.checkoutButton.updateText;\n }\n\n if (isFreeDowngrade) {\n return checkoutLocalization.checkoutButton.downgradeToFreeText;\n }\n\n return checkoutLocalization.checkoutButton.upgradeText;\n}\n\nexport const CheckoutSummary = ({\n onCheckout,\n onCheckoutCompleted,\n disablePromotionCode,\n disableSuccessAnimation,\n isFreeDowngrade,\n onMockCheckoutPreview,\n isWidgetWatermarkEnabled,\n}: CheckoutContainerProps & { isFreeDowngrade: boolean; isWidgetWatermarkEnabled: boolean }) => {\n const [isCheckoutCompletedSuccessfully, setIsCheckoutCompletedSuccessfully] = useState(false);\n const { setErrorMessage } = usePaymentStepModel();\n const progressBar = useProgressBarModel();\n const subscription = useSubscriptionModel();\n const { checkoutState, checkoutLocalization } = useCheckoutModel();\n const { plan, activeSubscription } = checkoutState || {};\n const planPrices = useChargesSort(\n plan?.pricePoints?.filter((price) => price.billingPeriod === subscription.billingPeriod) || [],\n );\n const [baseCharges, usageCharges] = partition(planPrices, (price) => price.pricingModel === BillingModel.FlatFee);\n const [baseCharge] = baseCharges || [];\n const isLastStep = isFreeDowngrade || (progressBar.isCheckoutComplete && progressBar.isLastStep);\n\n const { subscriptionPreview, isFetchingSubscriptionPreview } = usePreviewSubscription({ onMockCheckoutPreview });\n\n const { handleSubmit, isLoading } = useSubmit({\n isMocked: !!onMockCheckoutPreview, // This is a hack to make the submit button work with mocked data\n disableSuccessAnimation,\n onCheckout,\n onCheckoutCompleted,\n onSuccess: () => {\n setIsCheckoutCompletedSuccessfully(true);\n progressBar.markStepAsCompleted(progressBar.progressBarState.activeStep);\n },\n });\n\n const handleCheckout = async (e: any) => {\n if (isCheckoutCompletedSuccessfully) {\n return;\n }\n\n const { errorMessage } = (await handleSubmit(e)) || {};\n if (errorMessage) {\n setErrorMessage(errorMessage);\n setIsCheckoutCompletedSuccessfully(false);\n } else {\n setErrorMessage(undefined);\n }\n };\n\n const onCheckoutClick = async (e: any): Promise<void> => {\n if (isLoading) {\n return;\n }\n\n if (isLastStep) {\n await handleCheckout(e);\n } else {\n progressBar.goNext();\n }\n };\n\n const { immediateInvoice, recurringInvoice } = subscriptionPreview || {};\n const checkoutHasChanges =\n !!subscriptionPreview && (!!immediateInvoice?.proration || !!subscriptionPreview.hasScheduledUpdates);\n const showPromotionCodeLine = !disablePromotionCode && !isFreeDowngrade;\n const showDiscountLine = !!recurringInvoice?.discountDetails && !isFreeDowngrade;\n const hasDiscounts = showPromotionCodeLine || showDiscountLine;\n\n const hasPayAsYouGoCharges = usageCharges.some((price) => price.pricingModel === BillingModel.UsageBased);\n const onlyPayAsYouGoCharges =\n hasPayAsYouGoCharges &&\n !baseCharge &&\n usageCharges.every((price) => price.pricingModel === BillingModel.UsageBased);\n\n const baseChargeLabel =\n typeof checkoutLocalization.summary.baseChargeText === 'function'\n ? checkoutLocalization.summary.baseChargeText({ billingPeriod: subscription.billingPeriod })\n : checkoutLocalization.summary.baseChargeText;\n\n return (\n <SummaryContainer>\n <SummaryCard>\n <SummaryTitle variant=\"h3\">{checkoutLocalization.summary.title}</SummaryTitle>\n\n <Grid\n className=\"stigg-checkout-summary-plan-title-container\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginY={2}>\n <Typography variant=\"h6\" color=\"primary\" style={{ paddingRight: '8px' }}>\n {checkoutLocalization.summary.planName({ plan: plan! })}\n </Typography>\n <StyledDivider className=\"stigg-checkout-summary-divider\" sx={{ flex: 1, margin: '0 !important' }} />\n </Grid>\n\n {baseCharge && (\n <BilledPriceLineItem\n checkoutLocalization={checkoutLocalization}\n label={baseChargeLabel}\n quantity={1}\n price={baseCharge}\n />\n )}\n {!baseCharge && isFreeDowngrade ? <FreeChargeLineItem label={baseChargeLabel} /> : null}\n\n <Grid item className=\"stigg-checkout-summary-usage-charges-container\">\n {usageCharges.map((price) => {\n const priceBillableFeature = subscription.billableFeatures?.find(\n (billableFeature) => billableFeature.featureId === price.feature?.featureId,\n );\n\n return (\n <BilledPriceLineItem\n checkoutLocalization={checkoutLocalization}\n key={price.feature?.featureId}\n label={getFeatureDisplayNameText(\n price.feature?.displayName || '',\n price.feature?.units,\n price.feature?.unitsPlural,\n )}\n quantity={priceBillableFeature?.quantity || 1}\n price={price}\n />\n );\n })}\n </Grid>\n\n {!!subscription.addons?.length && (\n <>\n <Grid display=\"flex\" flexDirection=\"row\" alignItems=\"center\" marginY={2}>\n <Typography variant=\"h6\" color=\"primary\" style={{ paddingRight: '8px' }}>\n {checkoutLocalization.summary.addonsSectionTitle}\n </Typography>\n <StyledDivider className=\"stigg-checkout-summary-divider\" sx={{ flex: 1, margin: '0 !important' }} />\n </Grid>\n {subscription.addons.map((addon) => {\n const addonPrice = addon.addon.pricePoints?.find(\n (price) => price.billingPeriod === subscription.billingPeriod,\n );\n\n if (!addonPrice) return null;\n\n const addonQuantity = addon.quantity && addon.quantity > 0 ? addon.quantity : 1;\n\n return (\n <BilledPriceLineItem\n checkoutLocalization={checkoutLocalization}\n key={addon?.addon?.id}\n label={addon.addon.displayName}\n quantity={addonQuantity}\n price={addonPrice}\n />\n );\n })}\n </>\n )}\n\n {!hasDiscounts && <StyledDivider className=\"stigg-checkout-summary-divider\" />}\n {hasDiscounts && (\n <Grid display=\"flex\" flexDirection=\"row\" alignItems=\"center\" marginY={2}>\n <Typography variant=\"h6\" color=\"primary\" style={{ paddingRight: '8px' }}>\n {checkoutLocalization.summary.discountsSectionTitle}\n </Typography>\n <StyledDivider className=\"stigg-checkout-summary-divider\" sx={{ flex: 1, margin: '0 !important' }} />\n </Grid>\n )}\n\n {showPromotionCodeLine && (\n <PromotionCodeSection\n disabled={isLoading || isFetchingSubscriptionPreview}\n checkoutLocalization={checkoutLocalization}\n onMockCheckoutPreview={onMockCheckoutPreview}\n />\n )}\n\n {showDiscountLine && (\n <DiscountLineItem\n subscriptionPreview={subscriptionPreview!}\n isFetchingSubscriptionPreview={isFetchingSubscriptionPreview}\n checkoutLocalization={checkoutLocalization}\n />\n )}\n\n {hasDiscounts && <StyledDivider className=\"stigg-checkout-summary-divider\" />}\n\n <TaxLineItem\n tax={recurringInvoice?.tax}\n taxDetails={recurringInvoice?.taxDetails}\n isFetchingSubscriptionPreview={isFetchingSubscriptionPreview}\n checkoutLocalization={checkoutLocalization}\n />\n\n {!isFreeDowngrade ? (\n <>\n <LineItemRow style={{ marginTop: 16 }}>\n <Grid display=\"flex\" flexDirection=\"column\" container>\n <Grid item display=\"flex\" justifyContent=\"space-between\">\n <Typography variant=\"h6\">{checkoutLocalization.summary.totalText}</Typography>\n <Typography variant=\"h6\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview}>\n {onlyPayAsYouGoCharges ? checkoutLocalization.summary.onlyPayAsYouGoText : null}\n {!onlyPayAsYouGoCharges && hasPayAsYouGoCharges\n ? checkoutLocalization.summary.startsAtText\n : null}\n {!onlyPayAsYouGoCharges\n ? currencyPriceFormatter({\n amount: 0,\n ...recurringInvoice?.total,\n minimumFractionDigits: 2,\n })\n : null}\n </WithSkeleton>\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"body1\" color=\"secondary\">\n {checkoutLocalization.summary.totalBillingPeriodText({ billingPeriod: subscription.billingPeriod })}\n </Typography>\n </Grid>\n </Grid>\n </LineItemRow>\n <StyledDivider className=\"stigg-checkout-summary-divider\" />\n </>\n ) : null}\n\n {immediateInvoice?.proration?.hasProrations &&\n immediateInvoice?.subTotal &&\n immediateInvoice?.subTotal.amount > 0 ? (\n <LineItemContainer>\n <LineItemRow>\n <Typography variant=\"body1\" color=\"secondary\">\n {checkoutLocalization.summary.proratedTotalDueText}\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview}>\n {currencyPriceFormatter({\n amount: immediateInvoice?.subTotal?.amount + (immediateInvoice?.tax?.amount || 0),\n currency: immediateInvoice?.subTotal.currency,\n minimumFractionDigits: 2,\n })}\n </WithSkeleton>\n </Typography>\n </LineItemRow>\n </LineItemContainer>\n ) : null}\n\n <AppliedCreditsLineItem\n subscriptionPreview={subscriptionPreview}\n isFetchingSubscriptionPreview={isFetchingSubscriptionPreview}\n checkoutLocalization={checkoutLocalization}\n />\n\n <LineItemContainer>\n <LineItemRow>\n <TotalDueText variant=\"h6\">{checkoutLocalization.summary.totalDueText}</TotalDueText>\n <TotalDueText variant=\"h6\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview}>\n {currencyPriceFormatter({ amount: 0, ...immediateInvoice?.total, minimumFractionDigits: 2 })}\n </WithSkeleton>\n </TotalDueText>\n </LineItemRow>\n </LineItemContainer>\n\n <CheckoutCaptions\n plan={plan}\n activeSubscription={activeSubscription}\n subscriptionPreview={subscriptionPreview}\n isFetchingSubscriptionPreview={isFetchingSubscriptionPreview}\n checkoutLocalization={checkoutLocalization}\n billingPeriod={subscription.billingPeriod}\n />\n\n <Button\n $success={isCheckoutCompletedSuccessfully}\n $error={isLastStep && isFreeDowngrade}\n disabled={\n isLoading ||\n isFetchingSubscriptionPreview ||\n progressBar.progressBarState.isDisabled ||\n (isLastStep && !checkoutHasChanges)\n }\n className=\"stigg-checkout-summary-cta-button\"\n sx={{ textTransform: 'none', borderRadius: '10px', marginTop: '24px', height: '36px' }}\n variant=\"contained\"\n size=\"medium\"\n onClick={(e: any) => {\n void onCheckoutClick(e);\n }}\n fullWidth>\n <Typography\n className=\"stigg-checkout-summary-cta-button-text\"\n variant=\"h3\"\n color=\"white\"\n style={{ display: 'flex' }}>\n {isCheckoutCompletedSuccessfully ? (\n <Icon icon=\"Check\" style={{ display: 'contents' }} />\n ) : isLoading || isFetchingSubscriptionPreview ? (\n <CircularProgress size={20} sx={{ color: 'white' }} />\n ) : (\n resolveCheckoutButtonText({\n isLastStep,\n checkoutHasChanges,\n isFreeDowngrade,\n checkoutLocalization,\n isPlanUpdate: !!activeSubscription && activeSubscription?.plan.id === plan?.id,\n })\n )}\n </Typography>\n </Button>\n </SummaryCard>\n <PoweredByStigg\n source=\"checkout\"\n showWatermark={isWidgetWatermarkEnabled}\n style={{ marginTop: 8, display: 'flex', justifyContent: 'center' }}\n />\n {!disableSuccessAnimation && isCheckoutCompletedSuccessfully && (\n <CheckoutSuccess checkoutLocalization={checkoutLocalization} />\n )}\n </SummaryContainer>\n );\n};\n","import { ApplySubscription, PreviewSubscription } from '@stigg/js-client-sdk';\nimport { useCheckoutContext } from '../CheckoutProvider';\nimport { useCheckoutModel } from './useCheckoutModel';\nimport { useSubscriptionModel } from './useSubscriptionModel';\n\nexport function useSubscriptionState(): ApplySubscription | PreviewSubscription | undefined {\n const subscription = useSubscriptionModel();\n const [{ resourceId }] = useCheckoutContext();\n const { checkoutState } = useCheckoutModel();\n const { plan } = checkoutState || {};\n const addons = subscription.addons.map(({ addon, quantity }) => ({ addonId: addon.id, quantity }));\n\n if (!plan?.id) {\n return undefined;\n }\n\n return {\n resourceId,\n planId: plan.id,\n billingPeriod: subscription.billingPeriod,\n billableFeatures: subscription.billableFeatures,\n addons,\n promotionCode: subscription.promotionCode,\n billingCountryCode: subscription.billingCountryCode,\n };\n}\n","import React from 'react';\nimport { PoweredByStigg } from '../../common/PoweredByStigg';\nimport { SummaryCard, SummaryContainer } from './CheckoutSummary';\nimport { FlexedSkeleton, Skeleton, SkeletonsContainer } from '../components/Skeletons.style';\n\nexport const CheckoutSummarySkeleton = ({ isWidgetWatermarkEnabled }: { isWidgetWatermarkEnabled: boolean }) => {\n return (\n <SummaryContainer>\n <SummaryCard>\n <SkeletonsContainer $flexDirection=\"column\" $gap={24}>\n <Skeleton width={120} height={20} />\n\n <Skeleton width={120} height={20} />\n\n <Skeleton width={120} height={20} />\n\n <Skeleton width={120} height={20} />\n </SkeletonsContainer>\n\n <SkeletonsContainer $flexDirection=\"column\" $gap={24} marginTop={5}>\n <Skeleton height={20} />\n\n <Skeleton height={20} />\n\n <Skeleton height={20} />\n </SkeletonsContainer>\n\n <FlexedSkeleton flex={1} marginTop={5}>\n <Skeleton height={34} />\n </FlexedSkeleton>\n </SummaryCard>\n <PoweredByStigg\n source=\"checkout\"\n showWatermark={isWidgetWatermarkEnabled}\n style={{ marginTop: 8, display: 'flex', justifyContent: 'center' }}\n />\n </SummaryContainer>\n );\n};\n","import styled from '@emotion/styled/macro';\nimport Grid from '@mui/material/Grid';\n\nimport { Button } from '../../components';\nimport { mq } from '../../../common/mediaQuery';\n\nexport const CheckoutAddonsContainer = styled(Grid)`\n width: 100%;\n gap: 8px;\n`;\n\nexport const AddonListItemContainer = styled(Grid)`\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n ${mq.md} {\n gap: 0;\n flex-direction: row;\n justify-content: space-between;\n height: 80px;\n align-items: center;\n }\n`;\n\nexport const TrashButton = styled(Button)`\n min-width: unset;\n width: 41px;\n height: 41px;\n padding: 0;\n`;\n","import React, { useEffect, useState } from 'react';\n\nimport Grid from '@mui/material/Grid';\nimport { Addon, BillingPeriod, SubscriptionAddon } from '@stigg/js-client-sdk';\n\nimport { Icon } from '../../../common/Icon';\nimport { Typography } from '../../../common/Typography';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { Button, InputField } from '../../components';\nimport { useAddonsStepModel } from '../../hooks/useAddonsStepModel';\nimport { usePlanStepModel } from '../../hooks/usePlanStepModel';\nimport { AddonListItemContainer, CheckoutAddonsContainer, TrashButton } from './CheckoutAddonsStep.style';\nimport { CheckoutLocalization } from '../../configurations/textOverrides';\nimport { useCheckoutModel, useProgressBarModel } from '../../hooks';\nimport { ON_WHEEL_BLUR } from '../../../utils/onWheelBlur';\nimport { useIsScreenWiderThan } from '../../../hooks/useIsScreenWiderThan';\n\ntype UseAddonsStepModel = ReturnType<typeof useAddonsStepModel>;\n\ntype AddonListItemProps = {\n addon: Addon;\n addonState?: SubscriptionAddon;\n initialAddonState?: SubscriptionAddon;\n billingPeriod: BillingPeriod;\n setAddon: UseAddonsStepModel['setAddon'];\n removeAddon: UseAddonsStepModel['removeAddon'];\n checkoutLocalization: CheckoutLocalization;\n onAddonsValidationChange: (params: { addonId: string; isValid: boolean }) => void;\n isValid: boolean;\n};\n\nfunction AddonListItem({\n addon,\n billingPeriod,\n addonState,\n initialAddonState,\n setAddon,\n removeAddon,\n checkoutLocalization,\n onAddonsValidationChange,\n isValid,\n}: AddonListItemProps) {\n const isScreenWiderThanLg = useIsScreenWiderThan('lg');\n const addonPrice = addon.pricePoints.find((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n const isAdded = !!addonState;\n const hasChanges =\n (!!addonState && !!initialAddonState && addonState.quantity !== initialAddonState.quantity) ||\n (!!initialAddonState && !addonState);\n\n const handleQuantityChange = (quantity: number | null) => {\n if (!quantity || quantity <= 0) {\n onAddonsValidationChange({ addonId: addon.id, isValid: false });\n // Reset the input value to null\n // @ts-ignore\n setAddon(addon, quantity ?? null);\n return;\n }\n\n onAddonsValidationChange({ addonId: addon.id, isValid: true });\n setAddon(addon, quantity);\n };\n\n const handleUndo = () => {\n if (initialAddonState) {\n setAddon(addon, initialAddonState.quantity);\n } else {\n removeAddon(addon.id);\n }\n\n onAddonsValidationChange({ addonId: addon.id, isValid: true });\n };\n\n return (\n <AddonListItemContainer container>\n <Grid item>\n <Typography variant=\"h6\" lineHeight=\"24px\">\n {addon.displayName}\n </Typography>\n {!!addonPrice && (\n <Typography variant=\"body1\" lineHeight=\"20px\" color=\"secondary\">\n {`${currencyPriceFormatter({\n amount: addonPrice.amount!,\n currency: addonPrice.currency,\n minimumFractionDigits: 2,\n })}/${billingPeriod === BillingPeriod.Annually ? 'year' : 'month'}`}\n </Typography>\n )}\n </Grid>\n <Grid item sx={{ gap: '16px' }} container={!isScreenWiderThanLg}>\n {hasChanges && (\n <Button variant=\"text\" size=\"small\" sx={{ padding: '8px', minWidth: 'unset' }} onClick={handleUndo}>\n <Typography color=\"primary.main\" variant=\"body1\">\n Undo\n </Typography>\n </Button>\n )}\n {isAdded && (\n <>\n <InputField\n id={`${addon.id}-input`}\n type=\"number\"\n onWheel={ON_WHEEL_BLUR}\n sx={isScreenWiderThanLg ? { marginX: 2, width: 120 } : { flex: 1 }}\n value={addonState?.quantity ?? ''}\n error={!isValid}\n helperText={!isValid ? 'Minimum 1' : undefined}\n FormHelperTextProps={{ sx: { margin: '4px' } }}\n onChange={(event) => handleQuantityChange(event?.target?.value ? Number(event?.target?.value) : null)}\n />\n <TrashButton\n color=\"error\"\n onClick={() => {\n removeAddon(addon.id);\n onAddonsValidationChange({ addonId: addon.id, isValid: true });\n }}>\n <Icon icon=\"Trash\" style={{ display: 'flex' }} />\n </TrashButton>\n </>\n )}\n {!isAdded && (\n <Button sx={{ paddingX: '22px', paddingY: '8px' }} onClick={() => handleQuantityChange(1)}>\n <Typography color=\"primary.main\" variant=\"body1\">\n {checkoutLocalization.addAddonText}\n </Typography>\n </Button>\n )}\n </Grid>\n </AddonListItemContainer>\n );\n}\n\nexport function CheckoutAddonsStep() {\n const { checkoutLocalization, setIsValid } = useCheckoutModel();\n const { billingPeriod } = usePlanStepModel();\n const { setIsDisabled } = useProgressBarModel();\n const { initialAddons, addons, availableAddons, setAddon, removeAddon } = useAddonsStepModel();\n const [addonsValidation, setAddonsValidation] = useState(\n availableAddons?.reduce<Record<string, boolean>>((acc, curr) => {\n acc[curr.id] = true;\n return acc;\n }, {}) || {},\n );\n\n useEffect(() => {\n const isDisabled = Object.values(addonsValidation).some((x) => !x);\n setIsDisabled(isDisabled);\n setIsValid(!isDisabled);\n }, [addonsValidation, setIsDisabled, setIsValid]);\n\n return (\n <CheckoutAddonsContainer container>\n {availableAddons?.map((addon) => {\n const addonState = addons.find((x) => x.addon.id === addon.id);\n const initialAddonState = initialAddons?.find((x) => x.addon.id === addon.id);\n const isValid = addonsValidation[addon.id];\n\n return (\n <AddonListItem\n key={addon.id}\n addon={addon}\n billingPeriod={billingPeriod}\n addonState={addonState}\n initialAddonState={initialAddonState}\n setAddon={setAddon}\n removeAddon={removeAddon}\n checkoutLocalization={checkoutLocalization}\n onAddonsValidationChange={({ addonId, isValid }: { addonId: string; isValid: boolean }) =>\n setAddonsValidation({ ...addonsValidation, [addonId]: isValid })\n }\n isValid={isValid}\n />\n );\n })}\n </CheckoutAddonsContainer>\n );\n}\n","import { css } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport Grid from '@mui/material/Grid';\n\nexport const PaymentMethodContainer = styled(Grid, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{\n $disabled?: boolean;\n}>`\n padding: 8px;\n border-radius: 10px;\n border: 1px solid ${({ theme }) => theme.stigg.palette.outlinedBorder};\n cursor: ${({ $disabled }) => ($disabled ? 'not-allowed' : 'pointer')};\n opacity: ${({ $disabled }) => ($disabled ? 0.6 : 1)};\n`;\n\nexport const NewPaymentMethodContainer = styled(PaymentMethodContainer)<{ $hideBorders?: boolean }>`\n flex-direction: column;\n align-items: unset;\n ${({ $hideBorders }) =>\n $hideBorders &&\n css`\n border: none;\n padding: 0;\n `}\n`;\n\nexport const PaymentMethodLayoutContainer = styled(Grid)`\n display: flex;\n align-items: center;\n flex: 1;\n gap: 12px;\n`;\n\nexport const PaymentMethodTextContainer = styled(Grid)`\n display: flex;\n flex-direction: column;\n`;\n","import React from 'react';\n\nimport Collapse from '@mui/material/Collapse';\nimport Grid from '@mui/material/Grid';\nimport Radio from '@mui/material/Radio';\nimport { Customer } from '@stigg/js-client-sdk';\n\nimport { Typography } from '../../../common/Typography';\nimport {\n NewPaymentMethodContainer,\n PaymentMethodContainer,\n PaymentMethodLayoutContainer,\n PaymentMethodTextContainer,\n} from './PaymentMethods.style';\nimport { StripePaymentForm } from './stripe';\nimport { CheckoutLocalization } from '../../configurations/textOverrides';\nimport { CheckoutContainerProps } from '../../CheckoutContainer';\n\nexport type PaymentMethodLayoutProps = {\n checked: boolean;\n text: React.ReactNode;\n subtitle?: React.ReactNode;\n readOnly?: boolean;\n};\n\nexport type PaymentMethodProps = Pick<Customer, 'paymentMethodDetails'> &\n Pick<PaymentMethodLayoutProps, 'checked' | 'readOnly'> & { onSelect: () => void };\n\nexport type NewPaymentMethodProps = Pick<PaymentMethodLayoutProps, 'checked' | 'readOnly'> & {\n onSelect: () => void;\n checkoutLocalization: CheckoutLocalization;\n hasExistingPaymentMethod: boolean;\n} & Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber'>;\n\nfunction PaymentMethodLayout({ checked, text, subtitle, readOnly }: PaymentMethodLayoutProps) {\n return (\n <PaymentMethodLayoutContainer>\n <Radio checked={checked} disabled={readOnly} />\n <PaymentMethodTextContainer container>\n <Grid item>{text}</Grid>\n {subtitle && <Grid item>{subtitle}</Grid>}\n </PaymentMethodTextContainer>\n </PaymentMethodLayoutContainer>\n );\n}\n\nexport function ExistingPaymentMethod({ checked, paymentMethodDetails, readOnly, onSelect }: PaymentMethodProps) {\n if (!paymentMethodDetails) {\n return null;\n }\n const { last4Digits, expirationMonth, expirationYear } = paymentMethodDetails;\n\n return (\n <PaymentMethodContainer item onClick={onSelect} $disabled={readOnly}>\n <PaymentMethodLayout\n checked={checked}\n readOnly={readOnly}\n text={<Typography variant=\"h6\">{`Card ending in ${last4Digits}`}</Typography>}\n subtitle={\n !!expirationMonth &&\n !!expirationYear && (\n <Typography variant=\"body1\">{`Expires ${expirationMonth\n .toString()\n .padStart(2, '0')}/${expirationYear}`}</Typography>\n )\n }\n />\n </PaymentMethodContainer>\n );\n}\n\nexport function NewPaymentMethod({\n hasExistingPaymentMethod,\n checked,\n onSelect,\n readOnly,\n checkoutLocalization,\n onBillingAddressChange,\n collectPhoneNumber,\n}: NewPaymentMethodProps) {\n return (\n <NewPaymentMethodContainer item $hideBorders={!hasExistingPaymentMethod} onClick={onSelect} $disabled={readOnly}>\n {hasExistingPaymentMethod && (\n <PaymentMethodLayout\n checked={checked}\n readOnly={readOnly}\n text={<Typography variant=\"h6\">{checkoutLocalization.newPaymentMethodText}</Typography>}\n />\n )}\n <Collapse in={checked}>\n <StripePaymentForm onBillingAddressChange={onBillingAddressChange} collectPhoneNumber={collectPhoneNumber} />\n </Collapse>\n </NewPaymentMethodContainer>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled';\nimport Alert from '@mui/material/Alert';\nimport Grid from '@mui/material/Grid';\nimport { useCheckoutModel, usePaymentStepModel } from '../../hooks';\nimport { ExistingPaymentMethod, NewPaymentMethod } from './PaymentMethods';\nimport { Typography } from '../../../common/Typography';\nimport { CheckoutContainerProps } from '../../CheckoutContainer';\n\nconst PaymentContainer = styled(Grid)`\n display: flex;\n flex-direction: column;\n gap: 24px;\n`;\n\nexport function PaymentStep({\n onBillingAddressChange,\n collectPhoneNumber,\n}: Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber'>) {\n const { checkoutState, checkoutLocalization, widgetState } = useCheckoutModel();\n const { customer } = checkoutState || {};\n const { errorMessage, useNewPaymentMethod, setUseNewPaymentMethod } = usePaymentStepModel();\n const { readOnly } = widgetState;\n\n const handleOnSelect = (openNewPaymentMethod: boolean) => {\n if (readOnly) {\n return;\n }\n\n setUseNewPaymentMethod(openNewPaymentMethod);\n };\n\n return (\n <PaymentContainer container>\n {!!errorMessage && (\n <Alert severity=\"error\" sx={{ alignItems: 'center' }}>\n <Typography overrideColor=\"inherit\">{errorMessage}</Typography>\n </Alert>\n )}\n <ExistingPaymentMethod\n readOnly={readOnly}\n checked={!useNewPaymentMethod}\n paymentMethodDetails={customer?.paymentMethodDetails}\n onSelect={() => handleOnSelect(false)}\n />\n <NewPaymentMethod\n hasExistingPaymentMethod={!!customer?.paymentMethodDetails}\n readOnly={readOnly}\n checked={useNewPaymentMethod}\n checkoutLocalization={checkoutLocalization}\n onSelect={() => handleOnSelect(true)}\n onBillingAddressChange={onBillingAddressChange}\n collectPhoneNumber={collectPhoneNumber}\n />\n </PaymentContainer>\n );\n}\n","import React from 'react';\nimport Button, { ButtonProps } from '@mui/material/Button';\nimport { Typography } from '../../common/Typography';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\n\nexport const ChangePlanButton = ({\n onClick,\n checkoutLocalization,\n size,\n}: {\n onClick: () => void;\n checkoutLocalization: CheckoutLocalization;\n size: ButtonProps['size'];\n}) => {\n return (\n <Button\n className=\"stigg-checkout-change-plan-button\"\n sx={{ textTransform: 'none' }}\n variant=\"text\"\n size={size}\n onClick={onClick}>\n <Typography\n className=\"stigg-checkout-change-plan-button-text\"\n color=\"primary.main\"\n variant=\"h3\"\n style={{ lineHeight: '24px' }}>\n {checkoutLocalization.changePlan}\n </Typography>\n </Button>\n );\n};\n","import React from 'react';\n\nimport Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\n\nimport { Typography } from '../../common/Typography';\nimport { useCheckoutModel } from '../hooks/useCheckoutModel';\nimport { CheckoutContainerProps } from '../CheckoutContainer';\nimport { ChangePlanButton } from '../components/ChangePlanButton';\n\ntype PlanHeaderProps = {\n allowChangePlan?: boolean;\n} & Pick<CheckoutContainerProps, 'onChangePlan'>;\n\nexport function PlanHeader({ allowChangePlan = false, onChangePlan }: PlanHeaderProps) {\n const { checkoutState, checkoutLocalization } = useCheckoutModel();\n const { plan } = checkoutState || {};\n\n return (\n <>\n <Box sx={{ marginBottom: '16px' }}>\n <Typography variant=\"body1\" color=\"disabled\" style={{ opacity: 0.6, marginBottom: '8px' }}>\n Selected plan\n </Typography>\n\n <Box sx={{ display: 'flex', justifyContent: 'space-between' }}>\n <Typography variant=\"h1\">{plan?.displayName}</Typography>\n\n {allowChangePlan && onChangePlan && (\n <ChangePlanButton\n onClick={() => {\n onChangePlan({ currentPlan: plan });\n }}\n checkoutLocalization={checkoutLocalization}\n size=\"medium\"\n />\n )}\n </Box>\n </Box>\n <Divider className=\"stigg-checkout-plan-header-divider\" />\n </>\n );\n}\n","import { BillingPeriod } from '@stigg/js-client-sdk';\n\nexport function formatBillingPeriod(billingPeriod: BillingPeriod) {\n switch (billingPeriod) {\n case BillingPeriod.Annually:\n return 'Annual';\n case BillingPeriod.Monthly:\n return 'Monthly';\n default:\n return '';\n }\n}\n","import styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport Chip from '@mui/material/Chip';\nimport Color from 'color';\n\nexport const BillingPeriodPickerContainer = styled(Box)`\n margin: 16px 0;\n`;\n\nexport const BillingPeriodButton = styled.button<{\n $isActive?: boolean;\n $disabled?: boolean;\n $isOnlyBillingPeriod?: boolean;\n}>`\n cursor: ${({ $disabled, $isOnlyBillingPeriod }) =>\n $disabled ? 'default' : $isOnlyBillingPeriod ? 'default' : 'pointer'};\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 2px 8px;\n border-radius: 10px;\n border: ${({ theme, $isActive, $isOnlyBillingPeriod }) => {\n let borderColor = theme.stigg.palette.outlinedBorder;\n if ($isOnlyBillingPeriod) {\n borderColor = 'transparent';\n } else if ($isActive) {\n borderColor = theme.stigg.palette.outlinedRestingBorder;\n }\n return `1px solid ${borderColor}`;\n }};\n background: ${({ theme, $isActive, $isOnlyBillingPeriod }) => {\n if ($isOnlyBillingPeriod) {\n return 'transparent';\n }\n if ($isActive) {\n return Color(theme.stigg.palette.primary).alpha(0.15).toString();\n }\n return 'transparent';\n }};\n text-transform: none;\n text-align: start;\n height: 36px;\n\n &.MuiButton-root {\n padding: 0 16px 0 8px;\n &:hover {\n background: none;\n }\n }\n`;\n\nexport const BillingPeriodOptions = styled(Box)`\n display: flex;\n gap: 16px;\n margin-top: 16px;\n`;\n\nexport const BillingPeriodPrice = styled.div`\n display: flex;\n align-items: baseline;\n gap: 8px;\n`;\n\nexport const DiscountChip = styled(Chip)`\n & .MuiChip-label {\n font-size: 12px;\n }\n`;\n","import { partition } from 'lodash';\nimport React from 'react';\nimport { FontWeight } from 'styled-typography';\n\nimport Box from '@mui/material/Box';\nimport Radio from '@mui/material/Radio';\nimport { BillingPeriod, Plan } from '@stigg/js-client-sdk';\n\nimport { Typography } from '../../../common/Typography';\nimport { formatBillingPeriod } from '../../formatting';\nimport { usePlanStepModel } from '../../hooks/usePlanStepModel';\nimport { BillingPeriodButton, BillingPeriodOptions, BillingPeriodPickerContainer } from './BillingPeriodPicker.style';\nimport { CheckoutLocalization } from '../../configurations/textOverrides';\n\nconst BillingPeriodOption = ({\n billingPeriod,\n isOnlyBillingPeriod,\n}: {\n billingPeriod: BillingPeriod;\n isOnlyBillingPeriod: boolean;\n}) => {\n const { billingPeriod: selectedBillingPeriod, setBillingPeriod } = usePlanStepModel();\n const isActive = selectedBillingPeriod === billingPeriod;\n\n return (\n <BillingPeriodButton\n onClick={() => setBillingPeriod(billingPeriod)}\n $isActive={isActive}\n $isOnlyBillingPeriod={isOnlyBillingPeriod}>\n <Radio\n checked={isActive}\n onChange={() => setBillingPeriod(billingPeriod)}\n value={billingPeriod}\n disabled={isOnlyBillingPeriod}\n inputProps={{ 'aria-label': formatBillingPeriod(billingPeriod) }}\n sx={{ padding: 0, marginRight: '8px' }}\n />\n\n <Box>\n <Typography variant=\"h3\" color=\"primary\">\n {formatBillingPeriod(billingPeriod)}\n </Typography>\n </Box>\n </BillingPeriodButton>\n );\n};\n\ntype BillingPeriodPickerProps = {\n plan?: Plan;\n checkoutLocalization: CheckoutLocalization;\n};\n\nexport function BillingPeriodPicker({ plan, checkoutLocalization }: BillingPeriodPickerProps) {\n const [monthlyPrices, annualPrices] = partition(\n plan?.pricePoints,\n (price) => price.billingPeriod === BillingPeriod.Monthly,\n );\n\n const hasBothBillingPeriods = !!monthlyPrices?.length && !!annualPrices?.length;\n if (!hasBothBillingPeriods) {\n return null;\n }\n\n return (\n <BillingPeriodPickerContainer>\n <Typography variant=\"h6\" color=\"primary\" fontWeight={FontWeight.Medium}>\n {checkoutLocalization.billingPeriodsTitle}\n </Typography>\n\n <BillingPeriodOptions>\n {!!monthlyPrices?.length && (\n <BillingPeriodOption\n key={BillingPeriod.Monthly}\n billingPeriod={BillingPeriod.Monthly}\n isOnlyBillingPeriod={!hasBothBillingPeriods}\n />\n )}\n {!!annualPrices?.length && (\n <BillingPeriodOption\n key={BillingPeriod.Annually}\n billingPeriod={BillingPeriod.Annually}\n isOnlyBillingPeriod={!hasBothBillingPeriods}\n />\n )}\n </BillingPeriodOptions>\n </BillingPeriodPickerContainer>\n );\n}\n","import React, { useEffect, useState } from 'react';\n\nimport styled from '@emotion/styled';\nimport Box from '@mui/material/Box';\nimport { BillableFeatureInput } from '@stigg/api-client-js/src/generated/sdk';\nimport { BillingModel, BillingPeriod, Plan, Price } from '@stigg/js-client-sdk';\n\nimport { Typography } from '../../../common/Typography';\nimport { useChargesSort } from '../../../hooks/useChargeSort';\nimport { calculateUnitQuantityText } from '../../../paywall/utils/calculateUnitQuantityText';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { InputField } from '../../components';\nimport { useCheckoutModel, usePlanStepModel, useProgressBarModel } from '../../hooks';\nimport { TiersSelectContainer } from '../../../common/TiersSelectContainer';\nimport { getValidPriceQuantity } from '../../../utils/priceUtils';\nimport { getFeatureDisplayNameText } from '../../../utils/getFeatureName';\nimport { ON_WHEEL_BLUR } from '../../../utils/onWheelBlur';\nimport { mq } from '../../../common/mediaQuery';\nimport { useIsScreenWiderThan } from '../../../hooks/useIsScreenWiderThan';\n\nexport type UsePlanStepModel = ReturnType<typeof usePlanStepModel>;\n\ntype CheckoutChargeListProps = {\n plan?: Plan;\n billingPeriod: BillingPeriod;\n};\n\nconst StyledPlanCharge = styled.div`\n display: flex;\n min-height: 60px;\n margin-top: 16px;\n flex-direction: column;\n\n ${mq.md} {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n`;\n\nconst getValidationText = (charge: Price, quantity?: number) => {\n const { minUnitQuantity, maxUnitQuantity } = charge;\n if (!quantity || quantity < (minUnitQuantity || 1)) {\n return `Minimum ${minUnitQuantity || 1}`;\n }\n\n if (maxUnitQuantity && quantity > maxUnitQuantity) {\n return `Maximum ${maxUnitQuantity}`;\n }\n\n return '';\n};\n\nexport function PlanCharge({\n charge,\n isValid,\n setBillableFeature,\n billableFeature,\n onValidationChange,\n}: {\n charge: Price;\n isValid: boolean;\n billableFeature?: BillableFeatureInput;\n setBillableFeature: UsePlanStepModel['setBillableFeature'];\n onValidationChange: ({ featureId, isValid }: { featureId: string; isValid: boolean }) => void;\n}) {\n const isScreenWiderThanMd = useIsScreenWiderThan('md');\n const featureId = charge.feature?.featureId;\n const isBaseCharge = !featureId;\n const isPayAsYouGo = charge.pricingModel === BillingModel.UsageBased;\n const displayName = isBaseCharge\n ? 'Base charge'\n : getFeatureDisplayNameText(charge.feature?.displayName || '', charge.feature?.units, charge.feature?.unitsPlural);\n const hasQuantityRestrictions = !!(charge?.minUnitQuantity || charge?.maxUnitQuantity);\n\n const handleQuantityChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (isBaseCharge || !featureId) return;\n\n const { minUnitQuantity, maxUnitQuantity } = charge;\n const value = event?.target?.value ? Number(event?.target?.value) : null;\n if (\n !value ||\n value <= 0 ||\n (minUnitQuantity && value < minUnitQuantity) ||\n (maxUnitQuantity && value > maxUnitQuantity)\n ) {\n onValidationChange({ featureId, isValid: false });\n // Reset the input value to null\n // @ts-ignore\n setBillableFeature(featureId, value ?? null);\n return;\n }\n\n onValidationChange({ featureId, isValid: true });\n const quantity = getValidPriceQuantity(charge, value);\n setBillableFeature(featureId, quantity);\n };\n\n let chargeRow;\n\n if (isBaseCharge || isPayAsYouGo) {\n const formattedAmount = currencyPriceFormatter({\n amount: charge.amount!,\n currency: charge.currency,\n locale: 'en-us',\n minimumFractionDigits: 2,\n });\n\n chargeRow = `${formattedAmount}`;\n if (isPayAsYouGo) {\n chargeRow += ' / unit';\n }\n } else if (charge.isTieredPrice && charge.tiersMode && featureId) {\n const quantity = billableFeature?.quantity || 1;\n chargeRow = (\n <TiersSelectContainer\n componentId={`${featureId}-tiers`}\n tiers={charge.tiers}\n tiersMode={charge.tiersMode}\n value={quantity}\n handleChange={(quantity: number) => {\n setBillableFeature(featureId, quantity);\n }}\n width={120}\n />\n );\n } else {\n chargeRow = (\n <InputField\n sx={{ width: isScreenWiderThanMd ? 120 : '100%' }}\n id={`${featureId}-input`}\n type=\"number\"\n onWheel={ON_WHEEL_BLUR}\n error={!isValid}\n helperText={!isValid ? getValidationText(charge, billableFeature?.quantity) : undefined}\n FormHelperTextProps={{ sx: { margin: '4px' } }}\n value={billableFeature?.quantity ?? ''}\n onChange={handleQuantityChange}\n />\n );\n }\n\n return (\n <StyledPlanCharge>\n <Box display=\"flex\" flexDirection=\"column\">\n <Typography variant=\"h6\" color=\"primary\" lineHeight=\"24px\">\n {displayName}\n </Typography>\n {hasQuantityRestrictions && (\n <Typography variant=\"body1\" color=\"secondary\" lineHeight=\"20px\">\n {calculateUnitQuantityText(charge.minUnitQuantity, charge.maxUnitQuantity, charge.feature?.unitsPlural)}\n </Typography>\n )}\n </Box>\n\n <Typography variant=\"h6\" color=\"primary\">\n {chargeRow}\n </Typography>\n </StyledPlanCharge>\n );\n}\n\nexport function CheckoutChargeList({ plan, billingPeriod }: CheckoutChargeListProps) {\n const { billableFeatures, setBillableFeature } = usePlanStepModel();\n const { setIsDisabled } = useProgressBarModel();\n const { setIsValid } = useCheckoutModel();\n const planCharges = useChargesSort(plan?.pricePoints?.filter((p) => p.billingPeriod === billingPeriod) || []);\n const [chargesValidation, setChargesValidation] = useState(\n planCharges?.reduce<Record<string, boolean>>((acc, curr) => {\n acc[curr.feature?.featureId || 'base-charge'] = true;\n return acc;\n }, {}),\n );\n\n useEffect(() => {\n const isDisabled = Object.values(chargesValidation).some((x) => !x);\n setIsDisabled(isDisabled);\n setIsValid(!isDisabled);\n }, [chargesValidation, setIsDisabled, setIsValid]);\n\n return (\n <>\n {planCharges?.map((charge) => {\n const billableFeature = billableFeatures.find((x) => x.featureId === charge.feature?.featureId);\n return (\n <PlanCharge\n key={charge.feature?.featureId || 'base-charge'}\n charge={charge}\n setBillableFeature={setBillableFeature}\n billableFeature={billableFeature}\n isValid={chargesValidation[charge.feature?.featureId || 'base-charge']}\n onValidationChange={({ featureId, isValid }: { featureId: string; isValid: boolean }) =>\n setChargesValidation((prev) => ({ ...prev, [featureId]: isValid }))\n }\n />\n );\n })}\n </>\n );\n}\n","<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"arrow-right\">\n<path id=\"Shape\" d=\"M2.66699 8H13.3337\" stroke=\"#7586B0\" stroke-width=\"1.33333\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path id=\"Shape_2\" d=\"M9.33301 4L13.333 8L9.33301 12\" stroke=\"#7586B0\" stroke-width=\"1.33333\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","import styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\n\nexport const CheckoutPlanContainer = styled(Box)`\n width: 100%;\n`;\n","import React from 'react';\nimport { CheckoutContainerProps } from '../../CheckoutContainer';\n\nimport { useCheckoutModel } from '../../hooks/useCheckoutModel';\nimport { usePlanStepModel } from '../../hooks/usePlanStepModel';\nimport { PlanHeader } from '../../planHeader';\nimport { BillingPeriodPicker } from './BillingPeriodPicker';\nimport { CheckoutChargeList } from './CheckoutChargeList';\nimport { CheckoutPlanContainer } from './CheckoutPlanStep.style';\n\nexport const CheckoutPlanStep = ({ onChangePlan }: Pick<CheckoutContainerProps, 'onChangePlan'>) => {\n const { checkoutState, checkoutLocalization } = useCheckoutModel();\n const { plan } = checkoutState || {};\n const { billingPeriod } = usePlanStepModel();\n\n return (\n <>\n <PlanHeader allowChangePlan onChangePlan={onChangePlan} />\n <CheckoutPlanContainer>\n <BillingPeriodPicker plan={plan} checkoutLocalization={checkoutLocalization} />\n <CheckoutChargeList plan={plan} billingPeriod={billingPeriod} />\n </CheckoutPlanContainer>\n </>\n );\n};\n","import styled from '@emotion/styled/macro';\n\nimport ArrowRightIcon from '../../../assets/arrow-right.svg';\n\nexport const StyledArrowRightIcon = styled(ArrowRightIcon)`\n path {\n stroke: ${({ theme }) => theme.stigg.palette.text.secondary};\n }\n`;\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport Alert from '@mui/material/Alert';\nimport { CheckoutStatePlan, Subscription } from '@stigg/js-client-sdk';\nimport { StyledArrowRightIcon } from './StyledArrow';\nimport { Typography } from '../../common/Typography';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\nimport { CheckoutContainerProps } from '../CheckoutContainer';\nimport { ChangePlanButton } from './ChangePlanButton';\n\nconst DowngradeToFreePlansContainer = styled(Box)`\n display: flex;\n`;\n\nconst DowngradeToFreeAlert = styled(Alert)`\n margin-bottom: 16px;\n`;\n\nexport const DowngradeToFreePlanBox = styled(Box)`\n padding: 16px;\n border-radius: 10px;\n width: 100%;\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedBorder}`};\n`;\n\nexport const DowngradeToFreeContent = ({\n headerText,\n planName,\n priceText,\n}: {\n headerText: string;\n planName: string;\n priceText: string;\n}) => {\n return (\n <DowngradeToFreePlanBox className=\"stigg-checkout-downgrade-to-free-container\">\n <Typography\n className=\"stigg-checkout-downgrade-to-free-text-header\"\n style={{ opacity: 0.8 }}\n variant=\"caption\"\n color=\"disabled\">\n {headerText}\n </Typography>\n <Typography className=\"stigg-checkout-downgrade-to-free-plan-name\" bold variant=\"h3\" color=\"primary\">\n {planName}\n </Typography>\n <Typography className=\"stigg-checkout-downgrade-to-free-price-text\" color=\"secondary\">\n {priceText}\n </Typography>\n </DowngradeToFreePlanBox>\n );\n};\n\ntype DowngradeToFreePlanProps = {\n checkoutLocalization: CheckoutLocalization;\n activeSubscription: Subscription;\n freePlan: CheckoutStatePlan;\n allowChangePlan?: boolean;\n} & Pick<CheckoutContainerProps, 'onChangePlan'>;\n\nexport const DowngradeToFreePlan = ({\n checkoutLocalization,\n activeSubscription,\n freePlan,\n allowChangePlan = false,\n onChangePlan,\n}: DowngradeToFreePlanProps) => {\n let alertAction;\n if (allowChangePlan && onChangePlan) {\n alertAction = (\n <ChangePlanButton\n onClick={() => {\n onChangePlan({ currentPlan: freePlan });\n }}\n checkoutLocalization={checkoutLocalization}\n size=\"small\"\n />\n );\n }\n\n const paidBillingPeriod =\n activeSubscription.prices.length > 0 ? activeSubscription.prices[0].billingPeriod : undefined;\n\n return (\n <>\n <DowngradeToFreeAlert action={alertAction} className=\"stigg-checkout-downgrade-to-free-alert\" severity=\"info\">\n <Typography span color=\"secondary\">\n {checkoutLocalization.downgradeToFree.alertText({ plan: activeSubscription.plan })}\n </Typography>\n </DowngradeToFreeAlert>\n\n <DowngradeToFreePlansContainer className=\"stigg-checkout-downgrade-to-free-plans-container\">\n <DowngradeToFreeContent\n headerText={checkoutLocalization.downgradeToFree.paidPlanHeader({ plan: activeSubscription.plan })}\n planName={checkoutLocalization.downgradeToFree.paidPlanName({ plan: activeSubscription.plan })}\n priceText={checkoutLocalization.downgradeToFree.paidPlanPriceText({\n plan: activeSubscription.plan,\n billingPeriod: paidBillingPeriod,\n })}\n />\n\n <StyledArrowRightIcon\n className=\"stigg-checkout-downgrade-to-free-arrow\"\n style={{ margin: 'auto 16px', minWidth: '16px' }}\n />\n\n <DowngradeToFreeContent\n headerText={checkoutLocalization.downgradeToFree.freePlanHeader({ plan: freePlan })}\n planName={checkoutLocalization.downgradeToFree.freePlanName({ plan: freePlan })}\n priceText={checkoutLocalization.downgradeToFree.freePlanPriceText({ plan: freePlan })}\n />\n </DowngradeToFreePlansContainer>\n </>\n );\n};\n","import React, { useMemo } from 'react';\nimport { Elements } from '@stripe/react-stripe-js';\nimport {\n PricingType,\n BillingAddress,\n ApplySubscription,\n CheckoutStatePlan,\n ApplySubscriptionResults,\n} from '@stigg/js-client-sdk';\nimport { CheckoutContent, CheckoutLayout, CheckoutPanel } from './CheckoutContainer.style';\nimport { CheckoutProgressBar } from './progressBar/CheckoutProgressBar';\nimport { CheckoutSummary, CheckoutSummarySkeleton } from './summary';\nimport { CheckoutStep, CheckoutStepKey, useCheckoutModel, useProgressBarModel } from './hooks';\nimport { CheckoutAddonsStep } from './steps/addons';\nimport { PaymentStep } from './steps/payment';\nimport { useStripeIntegration } from './steps/payment/stripe';\nimport { CheckoutPlanStep } from './steps/plan';\nimport { useCheckoutContext } from './CheckoutProvider';\nimport { ContentLoadingSkeleton } from './components';\nimport { DowngradeToFreePlan } from './components/DowngradeToFreeContainer';\nimport { MockCheckoutPreviewCallback } from './types';\n\ntype StepProps = {\n content: React.ReactNode;\n};\n\ntype StripeClientSecret = { clientSecret: string };\ntype StripeManualMode = { mode: 'setup' | 'payment' | 'subscription'; currency: string };\n\nconst getStepProps = (\n currentStep: CheckoutStep,\n {\n onBillingAddressChange,\n onChangePlan,\n collectPhoneNumber,\n }: Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'onChangePlan' | 'collectPhoneNumber'>,\n): StepProps => {\n switch (currentStep.key) {\n case CheckoutStepKey.PLAN:\n return { content: <CheckoutPlanStep onChangePlan={onChangePlan} /> };\n case CheckoutStepKey.ADDONS:\n return { content: <CheckoutAddonsStep /> };\n case CheckoutStepKey.PAYMENT:\n return {\n content: (\n <PaymentStep onBillingAddressChange={onBillingAddressChange} collectPhoneNumber={collectPhoneNumber} />\n ),\n };\n default:\n return { content: null };\n }\n};\n\nexport type CheckoutResult = { success: boolean; errorMessage?: string; results?: ApplySubscriptionResults };\n\nexport type OnCheckoutParams = {\n customerId: string;\n checkoutParams: ApplySubscription;\n checkoutAction: (params: ApplySubscription) => Promise<CheckoutResult>;\n};\n\nexport type OnCheckoutCompletedParams = { success: boolean; error?: string };\n\nexport type CheckoutContainerProps = {\n onCheckout?: (params: OnCheckoutParams) => Promise<CheckoutResult>;\n onCheckoutCompleted: (params: OnCheckoutCompletedParams) => Promise<void>;\n onChangePlan?: (params: { currentPlan: CheckoutStatePlan | undefined }) => void;\n onBillingAddressChange?: (params: { billingAddress: BillingAddress }) => Promise<void>;\n disablePromotionCode?: boolean;\n disableSuccessAnimation?: boolean;\n collectPhoneNumber?: boolean;\n onMockCheckoutPreview?: MockCheckoutPreviewCallback;\n};\n\nexport function CheckoutContainer({\n onCheckout,\n onCheckoutCompleted,\n onChangePlan,\n onBillingAddressChange,\n collectPhoneNumber,\n disablePromotionCode,\n disableSuccessAnimation,\n onMockCheckoutPreview,\n}: CheckoutContainerProps) {\n const { stripePromise, setupIntentClientSecret } = useStripeIntegration();\n const [{ stiggTheme, widgetState, theme, isWidgetWatermarkEnabled }] = useCheckoutContext();\n const { currentStep } = useProgressBarModel();\n\n const { isLoadingCheckoutData } = widgetState;\n\n const { checkoutState, checkoutLocalization } = useCheckoutModel();\n const { plan, activeSubscription } = checkoutState || {};\n const isFreeDowngrade =\n !!plan &&\n plan.pricingType === PricingType.Free &&\n !!activeSubscription &&\n activeSubscription.pricingType !== PricingType.Free;\n\n const { content } = getStepProps(currentStep, { onBillingAddressChange, onChangePlan, collectPhoneNumber });\n\n const checkoutContent = (\n <>\n {isFreeDowngrade ? (\n <DowngradeToFreePlan\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n freePlan={plan!}\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n activeSubscription={activeSubscription!}\n allowChangePlan\n checkoutLocalization={checkoutLocalization}\n onChangePlan={onChangePlan}\n />\n ) : (\n <>{content}</>\n )}\n </>\n );\n\n const stripeElementsMode: StripeClientSecret | StripeManualMode = useMemo(\n () => (setupIntentClientSecret ? { clientSecret: setupIntentClientSecret } : { mode: 'setup', currency: 'usd' }),\n [setupIntentClientSecret],\n );\n\n return (\n <Elements\n key={setupIntentClientSecret}\n stripe={stripePromise}\n options={{\n ...stripeElementsMode,\n appearance: {\n theme: 'stripe',\n variables: {\n colorText: stiggTheme.palette.text.primary,\n colorPrimaryText: stiggTheme.palette.text.primary,\n colorTextPlaceholder: stiggTheme.palette.text.disabled,\n fontFamily: stiggTheme.typography.fontFamily,\n colorBackground: theme?.paymentInputBackgroundColor,\n borderRadius: theme?.paymentInputBorderRadius,\n },\n rules: theme?.paymentInputBorderColor\n ? {\n '.Input': {\n borderColor: theme?.paymentInputBorderColor,\n },\n }\n : undefined,\n },\n }}>\n <CheckoutLayout className=\"stigg-checkout-layout\">\n {!isFreeDowngrade && <CheckoutProgressBar />}\n <CheckoutContent>\n <CheckoutPanel>{isLoadingCheckoutData ? <ContentLoadingSkeleton /> : checkoutContent}</CheckoutPanel>\n {isLoadingCheckoutData ? (\n <CheckoutSummarySkeleton isWidgetWatermarkEnabled={isWidgetWatermarkEnabled} />\n ) : (\n <CheckoutSummary\n disablePromotionCode={disablePromotionCode}\n disableSuccessAnimation={disableSuccessAnimation}\n onCheckout={onCheckout}\n onCheckoutCompleted={onCheckoutCompleted}\n isFreeDowngrade={isFreeDowngrade}\n onMockCheckoutPreview={onMockCheckoutPreview}\n isWidgetWatermarkEnabled={isWidgetWatermarkEnabled}\n />\n )}\n </CheckoutContent>\n </CheckoutLayout>\n </Elements>\n );\n}\n","import { useEffect, useState } from 'react';\n\nimport { BillingVendorIdentifier } from '@stigg/js-client-sdk';\nimport { loadStripe, Stripe } from '@stripe/stripe-js';\n\nimport { useCheckoutModel } from '../../../hooks';\n\nexport function useStripeIntegration() {\n const [stripePromise, setStripePromise] = useState<Promise<Stripe | null> | null>(null);\n const { checkoutState } = useCheckoutModel();\n const { billingIntegration, setupSecret } = checkoutState || {};\n\n useEffect(() => {\n if (billingIntegration) {\n const { billingIdentifier, credentials } = billingIntegration;\n if (billingIdentifier !== BillingVendorIdentifier.Stripe) {\n return;\n }\n\n const { accountId, publicKey } = credentials;\n if (!accountId || !publicKey) {\n console.error('Stripe account ID or public key is missing');\n return;\n }\n\n setStripePromise(loadStripe(publicKey, { stripeAccount: accountId }));\n }\n }, [billingIntegration]);\n\n return { stripePromise, setupIntentClientSecret: setupSecret };\n}\n","import { Subscription } from '@stigg/js-client-sdk';\nimport { useEffect, useMemo, useState } from 'react';\nimport { useStiggContext } from '../../hooks/useStiggContext';\n\nfunction useQueryParams(paramName?: string) {\n return useMemo(() => {\n const urlSearchParams = new URLSearchParams(window.location.search);\n return paramName ? urlSearchParams.get(paramName) : urlSearchParams;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [paramName, window.location.search]);\n}\n\nexport enum ProvisionStatus {\n IN_PROGRESS = 'IN_PROGRESS',\n SUCCEEDED = 'SUCCEEDED',\n FAILED = 'FAILED',\n}\n\nexport const useWaitForCheckoutCompleted = ({\n onProvisionStart,\n onProvisionSucceeded,\n onProvisionFailed,\n}: {\n onProvisionStart?: () => void;\n onProvisionSucceeded?: (subscription?: Subscription | null) => void;\n onProvisionFailed?: (err?: any) => void;\n} = {}) => {\n const { stigg } = useStiggContext();\n const [provisionStatus, setProvisionStatus] = useState(ProvisionStatus.IN_PROGRESS);\n const [isAwaitingCheckout, setIsAwaitingCheckout] = useState(false);\n const checkoutCompleted = useQueryParams('checkoutCompleted') as string;\n\n useEffect(() => {\n const waitForCheckoutToComplete = async () => {\n if (!checkoutCompleted || checkoutCompleted.toLowerCase() === 'false' || isAwaitingCheckout) {\n return;\n }\n\n setIsAwaitingCheckout(true);\n if (onProvisionStart) {\n onProvisionStart();\n }\n try {\n const subscription = await stigg.waitForCheckoutCompleted();\n setProvisionStatus(ProvisionStatus.SUCCEEDED);\n if (onProvisionSucceeded) {\n onProvisionSucceeded(subscription);\n }\n } catch (err) {\n console.error('Failed to wait for checkout to complete', err);\n setProvisionStatus(ProvisionStatus.FAILED);\n if (onProvisionFailed) {\n onProvisionFailed(err);\n }\n } finally {\n setIsAwaitingCheckout(false);\n }\n };\n\n void waitForCheckoutToComplete();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [stigg, checkoutCompleted]);\n\n return { isAwaitingCheckout, provisionStatus };\n};\n","import { BooleanEntitlement, GetBooleanEntitlement, BOOLEAN_DEFAULT_FALLBACK_ENTITLEMENT } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\n\nexport type TypedGetBooleanEntitlement<T> = Omit<GetBooleanEntitlement, 'featureId'> & {\n featureId: T;\n};\n\nexport function useBooleanEntitlement<T extends string>(params: TypedGetBooleanEntitlement<T>): BooleanEntitlement {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n if (!stigg) {\n return {\n ...BOOLEAN_DEFAULT_FALLBACK_ENTITLEMENT,\n ...params.options?.fallback,\n };\n }\n\n return stigg.getBooleanEntitlement(params);\n}\n","import { NumericEntitlement, GetNumericEntitlement, NUMERIC_DEFAULT_FALLBACK_ENTITLEMENT } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\n\ntype TypedGetNumericEntitlement<T> = Omit<GetNumericEntitlement, 'featureId'> & {\n featureId: T;\n};\n\nexport function useNumericEntitlement<T extends string>(params: TypedGetNumericEntitlement<T>): NumericEntitlement {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n if (!stigg) {\n return {\n ...NUMERIC_DEFAULT_FALLBACK_ENTITLEMENT,\n ...params.options?.fallback,\n };\n }\n\n return stigg.getNumericEntitlement(params);\n}\n","import { GetMeteredEntitlement, METERED_DEFAULT_FALLBACK_ENTITLEMENT, MeteredEntitlement } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\n\ntype TypedGetMeteredEntitlement<T> = Omit<GetMeteredEntitlement, 'featureId'> & {\n featureId: T;\n};\n\nexport function useMeteredEntitlement<T extends string>(params: TypedGetMeteredEntitlement<T>): MeteredEntitlement {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n if (!stigg) {\n return {\n ...METERED_DEFAULT_FALLBACK_ENTITLEMENT,\n ...params.options?.fallback,\n };\n }\n\n return stigg.getMeteredEntitlement(params);\n}\n","import { GetEnumEntitlement, ENUM_DEFAULT_FALLBACK_ENTITLEMENT, EnumEntitlement } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\n\ntype TypedGetEnumEntitlement<T> = Omit<GetEnumEntitlement, 'featureId'> & {\n featureId: T;\n};\n\nexport function useEnumEntitlement<T extends string>(params: TypedGetEnumEntitlement<T>): EnumEntitlement {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n if (!stigg) {\n return {\n ...ENUM_DEFAULT_FALLBACK_ENTITLEMENT,\n ...params.options?.fallback,\n };\n }\n\n return stigg.getEnumEntitlement(params);\n}\n","import { useEffect, useState } from 'react';\n\nexport type FetchResult<T> = {\n isLoaded: boolean;\n error: Error | null;\n data: T | null;\n};\n\nexport function useFetch<T>({ func }: { func: () => Promise<T> }): FetchResult<T> {\n const [isLoaded, setIsLoaded] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [data, setData] = useState<T | null>(null);\n\n useEffect(() => {\n const fetchData = async () => {\n setIsLoaded(true);\n try {\n const result = await func();\n setData(result);\n } catch (error) {\n setError(error as Error);\n } finally {\n setIsLoaded(false);\n }\n };\n\n void fetchData();\n }, [func]);\n\n return { isLoaded, error, data };\n}\n","import React from 'react';\nimport { GetBooleanEntitlement } from '@stigg/js-client-sdk';\nimport { useBooleanEntitlement } from '../hooks';\n\ntype BooleanEntitlementGuardProps = GetBooleanEntitlement & {\n noAccessComponent?: React.ReactNode;\n children: React.ReactElement;\n};\n\nexport function BooleanEntitlementGuard({\n noAccessComponent,\n children,\n ...rest\n}: BooleanEntitlementGuardProps): JSX.Element {\n const { hasAccess } = useBooleanEntitlement(rest);\n\n if (!hasAccess) {\n return <>{noAccessComponent ?? null}</>;\n }\n\n return children;\n}\n","import React from 'react';\nimport { CheckoutProvider, CheckoutProviderProps } from './CheckoutProvider';\nimport { CheckoutContainer, CheckoutContainerProps } from './CheckoutContainer';\nimport { CheckoutMockProps } from './types';\n\nexport type CheckoutProps = CheckoutProviderProps & CheckoutContainerProps & CheckoutMockProps;\n\nexport const Checkout = ({\n textOverrides,\n theme,\n resourceId,\n planId,\n preferredBillingPeriod,\n billingCountryCode,\n billableFeatures,\n billingInformation,\n onMockCheckoutState,\n skipCheckoutSteps,\n ...containerProps\n}: CheckoutProps) => {\n return (\n <CheckoutProvider\n textOverrides={textOverrides}\n theme={theme}\n resourceId={resourceId}\n planId={planId}\n preferredBillingPeriod={preferredBillingPeriod}\n billingCountryCode={billingCountryCode}\n billableFeatures={billableFeatures}\n billingInformation={billingInformation}\n onMockCheckoutState={onMockCheckoutState}\n skipCheckoutSteps={skipCheckoutSteps}>\n <CheckoutContainer {...containerProps} />\n </CheckoutProvider>\n );\n};\n","import React from 'react';\nimport { CustomerPortalSubscription } from '@stigg/js-client-sdk';\nimport { CustomerPortalProvider } from './CustomerPortalProvider';\nimport { CustomerPortalContainer } from './CustomerPortalContainer';\nimport { DeepPartial } from '../../types';\nimport { CustomerPortalLocalization } from './customerPortalTextOverrides';\nimport { CustomerPortalTheme } from './customerPortalTheme';\nimport { FilterEntitlementsFn, OnBuyMoreCallbackFn, OnManageSubscriptionFn } from './types';\n\nexport type CustomerPortalSection =\n | 'usage'\n | 'addons'\n | 'promotionalEntitlements'\n | 'billingInformation'\n | 'paymentDetails'\n | 'invoices';\n\nexport type CustomerPortalProps = {\n onManageSubscription?: OnManageSubscriptionFn;\n onBuyMore?: OnBuyMoreCallbackFn;\n onCancelScheduledUpdates?: (subscription: CustomerPortalSubscription) => Promise<void> | void;\n onContactSupport?: () => Promise<void> | void;\n paywallComponent?: React.ReactNode;\n hiddenSections?: CustomerPortalSection[];\n textOverrides?: DeepPartial<CustomerPortalLocalization>;\n theme?: DeepPartial<CustomerPortalTheme>;\n filterEntitlements?: FilterEntitlementsFn;\n resourceId?: string;\n productId?: string;\n};\n\nexport function CustomerPortal({ textOverrides, theme, resourceId, productId, ...restProps }: CustomerPortalProps) {\n return (\n <CustomerPortalProvider textOverrides={textOverrides} theme={theme} resourceId={resourceId} productId={productId}>\n <CustomerPortalContainer {...restProps} />\n </CustomerPortalProvider>\n );\n}\n","import React from 'react';\nimport { GetEnumEntitlement } from '@stigg/js-client-sdk';\nimport { useEnumEntitlement } from '../hooks';\n\ntype EnumEntitlementGuardProps = GetEnumEntitlement & {\n noAccessComponent?: React.ReactNode;\n children: React.ReactElement;\n};\n\nexport function EnumEntitlementGuard({ noAccessComponent, children, ...rest }: EnumEntitlementGuardProps): JSX.Element {\n const { hasAccess } = useEnumEntitlement(rest);\n\n if (!hasAccess) {\n return <>{noAccessComponent ?? null}</>;\n }\n\n return children;\n}\n","import React from 'react';\nimport { GetMeteredEntitlement } from '@stigg/js-client-sdk';\nimport { useMeteredEntitlement } from '../hooks';\n\ntype MeteredEntitlementGuardProps = GetMeteredEntitlement & {\n noAccessComponent?: React.ReactNode;\n children: React.ReactElement;\n};\n\nexport function MeteredEntitlementGuard({\n noAccessComponent,\n children,\n ...rest\n}: MeteredEntitlementGuardProps): JSX.Element {\n const { hasAccess } = useMeteredEntitlement(rest);\n\n if (!hasAccess) {\n return <>{noAccessComponent ?? null}</>;\n }\n\n return children;\n}\n","import React from 'react';\nimport { GetNumericEntitlement } from '@stigg/js-client-sdk';\nimport { useNumericEntitlement } from '../hooks';\n\ntype NumericEntitlementGuardProps = GetNumericEntitlement & {\n noAccessComponent?: React.ReactNode;\n children: React.ReactElement;\n};\n\nexport function NumericEntitlementGuard({\n noAccessComponent,\n children,\n ...rest\n}: NumericEntitlementGuardProps): JSX.Element {\n const { hasAccess } = useNumericEntitlement(rest);\n\n if (!hasAccess) {\n return <>{noAccessComponent ?? null}</>;\n }\n\n return children;\n}\n","import React from 'react';\nimport { BillingPeriod } from '@stigg/js-client-sdk';\nimport { Paywall } from './Paywall';\nimport { useLoadPaywallData } from './hooks/useLoadPaywallData';\nimport {\n ShouldHidePlanFn,\n OnPlanSelectedCallbackFn,\n SelectDefaultTierIndexFn,\n CurrentSubscriptionOverrideFn,\n} from './types';\nimport { getResolvedPaywallLocalize, PaywallLocalization } from './paywallTextOverrides';\nimport { DeepPartial } from '../../types';\nimport { PaywallLoader } from './PaywallLoader';\nimport { SdkThemeProvider } from '../../theme/Theme';\nimport {\n CustomerPortalContext,\n useCheckContextExists,\n useCustomerPortalContext,\n} from '../customerPortal/CustomerPortalProvider';\n\nexport type PaywallContainerProps = {\n productId?: string;\n resourceId?: string;\n highlightedPlanId?: string;\n showOnlyEligiblePlans?: boolean;\n onPlanSelected: OnPlanSelectedCallbackFn;\n preferredBillingPeriod?: BillingPeriod;\n onBillingPeriodChange?: (billingPeriod: BillingPeriod) => void;\n textOverrides?: DeepPartial<PaywallLocalization>;\n billingCountryCode?: string;\n shouldHidePlan?: ShouldHidePlanFn;\n selectDefaultTierIndex?: SelectDefaultTierIndexFn;\n hideCompatibleAddons?: boolean;\n // This is used to override the current subscription in case a many to one plan mapping is needed\n // Many plans mapped to one (fictive) plan\n currentSubscriptionOverride?: CurrentSubscriptionOverrideFn;\n};\n\nexport const PaywallContainer = ({\n productId,\n resourceId,\n highlightedPlanId,\n showOnlyEligiblePlans,\n textOverrides,\n onPlanSelected,\n preferredBillingPeriod,\n onBillingPeriodChange,\n billingCountryCode,\n shouldHidePlan,\n selectDefaultTierIndex,\n currentSubscriptionOverride: currentSubscriptionOverrideFn,\n hideCompatibleAddons,\n}: PaywallContainerProps) => {\n const hasCustomerPortalContext = useCheckContextExists(CustomerPortalContext);\n let isCustomerPortalLoading = false;\n if (hasCustomerPortalContext) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const { isLoading, resourceId: customerPortalResourceId } = useCustomerPortalContext();\n isCustomerPortalLoading = isLoading;\n resourceId = customerPortalResourceId;\n }\n const {\n plans,\n customer,\n currentSubscription,\n currentSubscriptionOverride,\n isCustomerOnTrial,\n isLoading,\n selectedBillingPeriod,\n setSelectedBillingPeriod,\n availableBillingPeriods,\n locale,\n configuration,\n } = useLoadPaywallData({\n productId,\n resourceId,\n showOnlyEligiblePlans,\n billingCountryCode,\n preferredBillingPeriod,\n currentSubscriptionOverrideFn,\n });\n const paywallLocale = getResolvedPaywallLocalize(textOverrides);\n const handlePeriodChange = (billingPeriod: BillingPeriod) => {\n setSelectedBillingPeriod(billingPeriod);\n if (onBillingPeriodChange) {\n onBillingPeriodChange(billingPeriod);\n }\n };\n\n const component =\n !plans || isLoading || isCustomerPortalLoading ? (\n <PaywallLoader />\n ) : (\n <Paywall\n plans={plans}\n customer={customer}\n currentSubscription={currentSubscription}\n currentSubscriptionOverride={currentSubscriptionOverride}\n selectedBillingPeriod={selectedBillingPeriod}\n onBillingPeriodChanged={handlePeriodChange}\n availableBillingPeriods={availableBillingPeriods}\n highlightedPlanId={highlightedPlanId}\n isCustomerOnTrial={isCustomerOnTrial}\n onPlanSelected={onPlanSelected}\n paywallLocale={paywallLocale}\n locale={locale}\n shouldHidePlan={shouldHidePlan}\n selectDefaultTierIndex={selectDefaultTierIndex}\n hideCompatibleAddons={hideCompatibleAddons}\n />\n );\n\n // When rendering the paywall in the customer portal context we don't want to apply paywall theme\n if (hasCustomerPortalContext) {\n return component;\n }\n return <SdkThemeProvider componentTheme={configuration}>{component}</SdkThemeProvider>;\n};\n","import { BillingPeriod, Paywall } from '@stigg/js-client-sdk';\nimport { useEffect, useState } from 'react';\nimport logger from '../../../services/logger';\nimport { CurrentSubscriptionOverrideFn, PaywallData } from '../types';\nimport { computeBillingPeriods } from '../utils/computeDefaultBillingPeriod';\nimport { mapPaywallData } from '../utils/mapPaywallData';\nimport { useStiggContext } from '../../../hooks/useStiggContext';\n\ntype UseLoadPaywallDataProps = {\n productId?: string;\n resourceId?: string;\n showOnlyEligiblePlans?: boolean;\n billingCountryCode?: string;\n preferredBillingPeriod?: BillingPeriod;\n currentSubscriptionOverrideFn?: CurrentSubscriptionOverrideFn;\n};\n\nexport function useLoadPaywallData({\n productId,\n resourceId,\n showOnlyEligiblePlans,\n billingCountryCode,\n preferredBillingPeriod,\n currentSubscriptionOverrideFn,\n}: UseLoadPaywallDataProps): PaywallData {\n const { stigg, locale } = useStiggContext();\n const [selectedBillingPeriod, setSelectedBillingPeriod] = useState(BillingPeriod.Annually);\n const [availableBillingPeriods, setAvailableBillingPeriods] = useState<BillingPeriod[]>([]);\n const [paywall, setPaywall] = useState<Paywall | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n\n useEffect(() => {\n const loadPaywall = async () => {\n try {\n setIsLoading(true);\n\n await stigg.waitForInitialization();\n const paywallResult = await stigg.getPaywall({\n productId,\n resourceId,\n billingCountryCode,\n });\n const { availableBillingPeriods, defaultBillingPeriod } = computeBillingPeriods(\n paywallResult.plans,\n paywallResult.activeSubscriptions,\n preferredBillingPeriod,\n );\n\n setPaywall(paywallResult);\n setAvailableBillingPeriods(availableBillingPeriods);\n setSelectedBillingPeriod(defaultBillingPeriod);\n } catch (err) {\n logger.error(`Failed to load paywall ${(err as any)?.message}`, err as any);\n } finally {\n setIsLoading(false);\n }\n };\n\n void loadPaywall();\n }, [stigg, productId, stigg.isCustomerLoaded, billingCountryCode, resourceId, preferredBillingPeriod]);\n\n const paywallData = mapPaywallData(paywall, showOnlyEligiblePlans, currentSubscriptionOverrideFn);\n\n return {\n customer: paywall?.customer || null,\n isLoading,\n selectedBillingPeriod,\n setSelectedBillingPeriod,\n availableBillingPeriods,\n locale,\n configuration: paywallData.paywallConfiguration,\n ...paywallData,\n };\n}\n","import {\n BillingPeriod,\n SubscriptionStatus,\n Paywall,\n Plan,\n Subscription,\n SubscriptionScheduleType,\n} from '@stigg/js-client-sdk';\nimport isNil from 'lodash/isNil';\nimport sortBy from 'lodash/sortBy';\nimport { CurrentSubscriptionOverride, CurrentSubscriptionOverrideFn, PaywallPlan } from '../types';\nimport { calculateTrialDaysLeft } from './calculateTrialDaysLeft';\nimport { BillingPeriodChangeVariables, DeepPartial, DowngradeChangeVariables } from '../../../types';\nimport { StiggTheme } from '../../../theme/types';\nimport { mapPaywallConfiguration } from '../../common/mapExternalTheme';\n\nfunction getCustomerSubscriptionDetails(activeSubscriptions?: Subscription[] | null) {\n let isCustomerOnTrial = true;\n let currentSubscription: Subscription | null =\n activeSubscriptions?.find((s) => s.status === SubscriptionStatus.InTrial) || null;\n let currentPlan = currentSubscription?.plan;\n const trialDaysLeft = currentSubscription?.trialEndDate\n ? calculateTrialDaysLeft(currentSubscription.trialEndDate)\n : undefined;\n if (!currentPlan) {\n isCustomerOnTrial = false;\n currentSubscription = activeSubscriptions?.find((s) => s.status === SubscriptionStatus.Active) || null;\n currentPlan = currentSubscription?.plan;\n }\n\n return {\n currentSubscription,\n currentPlan,\n isCustomerOnTrial,\n trialDaysLeft,\n };\n}\n\ntype PaywallData = {\n currentPlan?: Plan;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride: CurrentSubscriptionOverride | null | undefined;\n isCustomerOnTrial: boolean;\n plans: PaywallPlan[];\n paywallConfiguration?: DeepPartial<StiggTheme>;\n};\n\nexport function mapPaywallData(\n paywall: Paywall | null,\n showOnlyEligiblePlans?: boolean,\n currentSubscriptionOverrideFn?: CurrentSubscriptionOverrideFn,\n): PaywallData {\n const { plans, currency, configuration, customer, activeSubscriptions, paywallCalculatedPricePoints } = paywall || {};\n const { currentSubscription, currentPlan, isCustomerOnTrial, trialDaysLeft } =\n getCustomerSubscriptionDetails(activeSubscriptions);\n\n const currentSubscriptionOverride = currentSubscriptionOverrideFn?.({ currentSubscription });\n\n const scheduledUpdates = currentSubscription?.scheduledUpdates || [];\n const currentCustomerPlanBillingPeriod = currentSubscription?.price?.billingPeriod;\n const downgradeSchedule = scheduledUpdates.find(\n ({ subscriptionScheduleType }) => subscriptionScheduleType === SubscriptionScheduleType.Downgrade,\n );\n const billingChangedSchedule = scheduledUpdates.find(\n ({ subscriptionScheduleType }) => subscriptionScheduleType === SubscriptionScheduleType.BillingPeriod,\n );\n\n let paywallPlans: PaywallPlan[] = sortBy(plans, (plan) => plan.order).map((plan) => {\n const eligibleForProductTrial = customer?.eligibleForTrial?.find(\n (productTrial) => productTrial.productId === plan.product.id,\n );\n const isCurrentCustomerPlan = currentSubscriptionOverride?.planId\n ? currentSubscriptionOverride?.planId === plan.id\n : plan.id === currentPlan?.id;\n\n const isNextPlan = (currentBillingPeriod: BillingPeriod) => {\n const downgradeVariables = downgradeSchedule?.scheduleVariables as DowngradeChangeVariables;\n const billingChangedVariables = billingChangedSchedule?.scheduleVariables as BillingPeriodChangeVariables;\n const isPlanHasBillingPeriodPrice = plan.pricePoints.some(\n (price) => price.billingPeriod === currentBillingPeriod,\n );\n\n return downgradeSchedule\n ? downgradeSchedule.targetPackage?.refId === plan.id &&\n (!isPlanHasBillingPeriodPrice || downgradeVariables.billingPeriod === currentBillingPeriod)\n : billingChangedSchedule && isCurrentCustomerPlan\n ? billingChangedVariables.billingPeriod === currentBillingPeriod\n : false;\n };\n\n return {\n ...plan,\n paywallCalculatedPricePoints: paywallCalculatedPricePoints?.filter((pricePoint) => pricePoint.planId === plan.id),\n isTriable: !isNil(plan.defaultTrialConfig) && (!eligibleForProductTrial || eligibleForProductTrial.eligible),\n isCurrentCustomerPlan,\n currentCustomerPlanBillingPeriod,\n isUpcomingPlan: false,\n trialDaysLeft,\n isNextPlan,\n paywallCurrency: currency,\n scheduledUpdate: downgradeSchedule || billingChangedSchedule,\n };\n });\n if (plans && currentPlan) {\n const currentPlanOrder = currentPlan && plans?.find((x) => x.id === currentPlan?.id)?.order;\n if (!isNil(currentPlanOrder)) {\n paywallPlans = paywallPlans.map<PaywallPlan>((plan) => ({\n ...plan,\n isLowerThanCurrentPlan: currentPlanOrder > plan.order,\n }));\n if (showOnlyEligiblePlans) {\n paywallPlans = paywallPlans.filter((plan) => plan.order >= currentPlanOrder);\n }\n }\n }\n const paywallConfiguration = configuration ? mapPaywallConfiguration(configuration) : undefined;\n\n return {\n currentPlan,\n currentSubscription,\n currentSubscriptionOverride,\n isCustomerOnTrial,\n plans: paywallPlans,\n paywallConfiguration,\n };\n}\n","import moment from 'moment';\n\nexport function calculateTrialDaysLeft(trialEndDate: Date) {\n return moment.utc(trialEndDate).diff(moment.utc(), 'days', false) + 1;\n}\n","import {\n BillingPeriod,\n PaywallCalculatedPricePoint,\n PaywallCurrency,\n Plan,\n Price,\n PriceTierFragment,\n} from '@stigg/js-client-sdk';\nimport merge from 'lodash/merge';\nimport { DeepPartial } from '../../types';\nimport { PlanPriceText } from '../utils/getPlanPrice';\nimport { PaywallPlan } from './types';\n\nexport { PlanPriceText } from '../utils/getPlanPrice';\n\nexport type CurrentPlanParams = {\n plan: Plan;\n selectedBillingPeriod: BillingPeriod;\n};\n\nexport type PaywallLocalization = {\n highlightChip: string;\n entitlementsTitle?: (plan: PaywallPlan) => string;\n addonsTitle?: string;\n planCTAButton: {\n upgrade: string | ((plan: PaywallPlan) => string);\n downgrade: string | ((plan: PaywallPlan) => string);\n startTrial: (plan: PaywallPlan) => string;\n custom: ((data: CurrentPlanParams) => string) | string;\n currentPlan: string;\n startNew: string;\n switchToBillingPeriod: (billingPeriod: BillingPeriod) => string;\n cancelScheduledUpdate: string;\n };\n price: {\n startingAtCaption: string;\n billingPeriod?: (billingPeriod: BillingPeriod) => string;\n pricePeriod: (billingPeriod: BillingPeriod) => string;\n custom: ((data: CurrentPlanParams) => string) | string;\n priceNotSet: string;\n free: PlanPriceText | ((currency?: PaywallCurrency) => PlanPriceText);\n paid?: (priceData: {\n planPrices: Price[];\n paywallCalculatedPrice?: PaywallCalculatedPricePoint;\n plan: Plan;\n selectedBillingPeriod: BillingPeriod;\n selectedTier?: PriceTierFragment;\n }) => PlanPriceText;\n };\n};\n\nexport function getResolvedPaywallLocalize(localizeOverride?: DeepPartial<PaywallLocalization>) {\n const paywallDefaultLocalization: PaywallLocalization = {\n highlightChip: 'Recommended',\n addonsTitle: 'Available add-ons:',\n planCTAButton: {\n upgrade: 'Upgrade',\n downgrade: 'Downgrade',\n startTrial: (plan: PaywallPlan) => `Start ${plan.defaultTrialConfig?.duration} day trial`,\n custom: 'Contact us',\n currentPlan: 'Current plan',\n startNew: 'Get started',\n switchToBillingPeriod: (billingPeriod) => {\n return billingPeriod === BillingPeriod.Monthly ? 'Switch to monthly billing' : 'Switch to annual billing';\n },\n cancelScheduledUpdate: 'Cancel',\n },\n price: {\n startingAtCaption: 'Starts at',\n pricePeriod: (billingPeriod: BillingPeriod) => (billingPeriod === BillingPeriod.Monthly ? '/ month' : '/ year'),\n free: (currency) => ({\n price: `${currency?.symbol}0`,\n }),\n custom: 'Custom',\n priceNotSet: 'Price not set',\n },\n };\n return merge(paywallDefaultLocalization, localizeOverride);\n}\n","import { useMemo, useCallback } from 'react';\nimport { GetActiveSubscriptions } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\nimport { useFetch } from './useFetch';\n\nexport function useActiveSubscriptions(params?: GetActiveSubscriptions) {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n const func = useCallback(() => (stigg ? stigg.getActiveSubscriptions(params) : Promise.resolve([])), [params, stigg]);\n const { data, error, isLoaded } = useFetch({ func });\n\n return useMemo(\n () => ({\n activeSubscriptions: data,\n isLoaded,\n error,\n }),\n [data, error, isLoaded],\n );\n}\n","import { useMemo, useCallback } from 'react';\nimport { GetCustomerPortal } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\nimport { useFetch } from './useFetch';\n\nexport function useCustomerPortal(params?: GetCustomerPortal) {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n const func = useCallback(() => (stigg ? stigg.getCustomerPortal(params) : Promise.resolve(null)), [params, stigg]);\n const { data, error, isLoaded } = useFetch({ func });\n\n return useMemo(\n () => ({\n customerPortal: data,\n isLoaded,\n error,\n }),\n [data, error, isLoaded],\n );\n}\n","import { useMemo, useCallback } from 'react';\nimport { GetPaywall } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\nimport { useFetch } from './useFetch';\n\nexport function usePaywall(params?: GetPaywall) {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n const func = useCallback(() => (stigg ? stigg.getPaywall(params) : Promise.resolve(null)), [params, stigg]);\n const { data, error, isLoaded } = useFetch({ func });\n\n return useMemo(\n () => ({\n paywall: data,\n isLoaded,\n error,\n }),\n [data, error, isLoaded],\n );\n}\n"],"names":["calculateUnitQuantityText","minUnitQuantity","maxUnitQuantity","unitsPlural","unitsText","formatNumber","usageLimit","toLocaleString","maximumFractionDigits","getColor","theme","$color","stigg","palette","primary","primaryLight","warning","error","text","StyledText","_styled","Text","$span","mapFontWeight","fontWeight","StyledFontWeight","Bold","Normal","getFontWeight","variant","typography","h1","h2","h3","body","caption","_g","_defs","_rect","_path","_path2","_path3","Typography","forwardRef","props","ref","children","span","style","color","overrideColor","bold","as","rest","useTheme","level","getLevel","levelClassName","React","className","getIconColor","secondary","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","SvgMiniSchedule","React.createElement","width","height","fill","xmlns","fillRule","clipRule","d","_rect2","_circle","SvgRestore","clipPath","stroke","strokeWidth","strokeLinecap","strokeLinejoin","id","rx","transform","x1","y1","x2","y2","gradientUnits","opacity","cx","cy","r","viewBox","IconWrapper","$pathColor","css","$rectColor","$strokeColor","Icon","svgPathColor","svgRectColor","svgStrokeColor","IconComponent","customIcons","icon","EntitlementName","EntitlementRowContainer","EntitlementIconContainer","EntitlementIcon","EntitlementRow","displayNameOverride","restProps","displayName","hasUnlimitedUsage","feature","resetPeriod","isCustom","enumValues","unitBasedEntitlement","resetPeriodSuffix","EntitlementResetPeriod","Day","Hour","Week","Month","Year","getResetPeriodText","units","featureUnits","getEntitlementDisplay","_restProps$feature","SubscribeIntentionType","PlanEntitlementsContainer","PlanEntitlements","plan","billingPeriod","paywallLocale","unitBasedEntitlements","pricePoints","filter","price","map","_price$feature","featureId","visibleEntitlements","entitlements","isGranted","entitlement","hiddenFromWidgets","includes","WidgetType","Paywall","hasFeatures","entitlementsTitle","title","basePlan","getTitle","_entitlement$feature","PriceTierComparison","flexLayoutMapper","horizontalAlignment","left","center","right","formatDate","date","moment","utc","format","getSubscriptionScheduleUpdateTexts","scheduledUpdate","subscriptionPrices","billingPeriodRange","options","withDate","postfix","subscriptionScheduleType","SubscriptionScheduleType","Downgrade","shouldShowDate","isNil","end","scheduledExecutionTime","isSame","line1","targetPackage","_scheduledUpdate$targ","line2","BillingPeriod","scheduleVariables","_variables$billingPer","toLocaleLowerCase","UnitAmount","variables","compact","find","newUnitAmount","featureUnitsPlural","getPriceFeatureUnit","unitQuantity","getTierByQuantity","tiers","quantity","ascendingTiers","sort","a","b","upTo","tier","getAmount","amount","selectedBillingPeriod","shouldShowMonthlyPriceAmount","Annually","calculateTierPriceVolume","currentTier","perUnitQuantity","unitPrice","flatPrice","calculateTierPriceGraduated","remainingQuantity","prevUpTo","currentTierIndex","breakdown","push","consumed","Math","min","total","sum","calculateTierPrice","tiersMode","TiersMode","Volume","Graduated","hasTierWithUnitPrice","some","getTiersPerUnitQuantities","currentSubscription","currentSubscriptionOverride","selectDefaultTierIndex","planTierPrices","isTieredPrice","selectedDefaultTierIndex","tieredPrice","prices","subscriptionPrice","pricingModel","BillingModel","PerUnit","planId","billableFeature","billableFeatures","result","LoadingIndicator","ClipLoader","OfferingButton","$disabled","backgroundButton","outlinedRestingBorder","outlinedHoverBackground","ButtonText","ScheduledUpdateText","CancelScheduledUpdateButton","TrialDaysLeft","ButtonLayout","layout","ctaAlignment","PlanOfferingButton","isNextPlan","customer","isCustomerOnTrial","onPlanSelected","withTrialLeftRow","perUnitQuantityByFeature","useState","isLoading","setIsLoading","planCTAButton","currentPlan","custom","downgrade","startTrial","upgrade","startNew","switchToBillingPeriod","cancelScheduledUpdate","resolvedDowngrade","isFunction","resolvedUpgrade","buttonProps","isLowerThanCurrentPlan","disabled","intentionType","DOWNGRADE_PLAN","UPGRADE_TRIAL_TO_PAID","UPGRADE_PLAN","isCustomPrice","pricingType","PricingType","Custom","scheduledUpdateText","isTriable","isCurrentCustomerPlan","currentCustomerPlanBillingPeriod","Free","Equal","currentTierPrice","isCurrentPlanOverride","oldQuantity","_currentSubscriptionO","newQuantity","Lower","Higher","compareSelectedTierToCurrentTier","CHANGE_UNIT_QUANTITY","CHANGE_BILLING_PERIOD","REQUEST_CUSTOM_PLAN_ACCESS","START_TRIAL","CANCEL_SCHEDULED_UPDATES","isDisabled","onClick","Promise","resolve","loading","size","trialDaysLeft","currencyPriceFormatter","currency","locale","minimumFractionDigits","removeTrailingZero","currencyString","Currency","Usd","toString","currencySymbol","getSymbolFromCurrency","formattedPrice","Intl","NumberFormat","trailingZeroDisplay","currencyDisplay","replace","numberFormatter","number","getPlanPrice","free","paywallCurrency","Paid","planPrices","pricePoint","paywallCalculatedPrice","paywallCalculatedPricePoints","_plan$paywallCalculat","priceNotSet","paidParams","paid","tierUnits","priceAmount","isSinglePrice","priceNumber","pricePeriod","Monthly","unit","formattedUnits","blockSize","_price$feature2","UsageBased","getPaidPriceText","StyledButton","MuiButton","shouldForwardProp","prop","startsWith","$success","success","$error","successDark","errorDark","Button","InputField","styled","TextField","borderRadius","border","radius","fieldset","borderColor","outlinedBorder","padding","fontFamily","SkeletonsContainer","Grid","$flexDirection","$gap","FlexedSkeletonContainer","FlexedSkeleton","flex","Skeleton","ReactSkeleton","ContentContainer","ContentLoadingSkeleton","container","item","Divider","sx","marginY","marginTop","ON_WHEEL_BLUR","e","blur","VolumePerUnitInput","value","handleChange","type","onWheel","fullWidth","minHeight","InputProps","endAdornment","InputAdornment","position","onChange","event","Number","_event$target2","TierSelect","Select","TierInput","OutlinedInput","VolumeBulkSelect","componentId","input","MenuProps","MenuListProps","disablePadding","PaperProps","MenuItem","_tier$upTo","lineHeight","TiersSelectLayout","TiersSelectContainer","PlanPriceContainer","UnitSpan","PriceSpan","PriceBillingPeriod","hasMonthlyPrice","hasAnnuallyPrice","content","toLowerCase","PlanPrice","showStartingAt","withUnitPriceRow","withStartingAtRow","withTiersRow","setPerUnitQuantityByFeature","planPrice","undefined","startingAtCaption","prevState","AddonsBox","AddonsList","AddonRow","AddonName","AddonIcon","AddonContent","Footer","PlanCompatibleAddons","addons","showAllAddons","setShowAllAddons","visibleAddons","addon","_addon$hiddenFromWidg","displayedAddons","slice","addonsTitle","classNames","PlanOfferingContainer","$isCurrentPlan","backgroundHighlight","backgroundPaper","$isHighlighted","planPadding","planMinWidth","planMaxWidth","AddonsContainer","$planHasEntitlements","PlanHeader","PlanDescription","descriptionAlignment","descriptionMinHeight","HighlightBadge","HighlightText","HeaderWrapper","headerAlignment","NextPlanTagContainer","StyledMiniSchedule","MiniSchedule","UpcomingChangeTag","display","alignItems","gap","iconsColor","PlanOffering","isHighlighted","shouldShowDescriptionSection","isCustomerInCustomPlan","hideCompatibleAddons","additionalChargesMayApply","showCTAButton","planBadge","highlightChip","description","perUnitBillableFeatures","keys","compatibleAddons","PickerContainer","switchBottomSpacing","PeriodText","StyledSwitch","Switch","switchBorder","switchFill","shadows","light","switchHandle","DiscountRate","discount","BillingPeriodPicker","discountRate","onBillingPeriodChanged","availableBillingPeriods","isMonthlyBillingPeriod","uncheckedIcon","checkedIcon","isAnnuallySelected","checked","handleDiameter","getPlanBillingPeriodAmount","_pricePoint","_pricePoint2","PoweredByStiggThemedSvg","StyledPoweredByStigg","$alignSelf","PoweredByStigg","showWatermark","align","cursor","sourceDomain","window","location","hostname","open","hasPricePoints","hasPricePointsForPlans","plans","PaywallPlansContainer","planMargin","PaywallContainer","PaywallLayout","highlightedPlanId","shouldHidePlan","useStiggContext","reduce","maxDiscount","monthlyPrice","annuallyPrice","monthlyAmount","round","max","calculatePaywallDiscountRate","plansToShow","getPlansToDisplay","handleOnSubscribe","useCallback","subscription","useMemo","values","isWidgetWatermarkEnabled","runtime","exports","Op","hasOwn","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","makeInvokeMethod","fn","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","reject","invoke","__await","then","unwrapped","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","doneResult","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","iter","object","reverse","pop","skipTempReset","prev","charAt","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","message","params","console","log","debug","computeBillingPeriods","activeSubscriptions","preferredBillingPeriod","defaultBillingPeriod","billingPeriods","flatMap","x","counts","countBy","uniq","activeSubscription","status","SubscriptionStatus","Active","defaultCheckoutTypography","fontSize","FontWeight","addCssUnits","defaultValue","JSFontWeight","mapTypography","defaultTypography","fontFamilyUrl","_defaultTypography$h","_defaultTypography$h2","_defaultTypography$h3","_defaultTypography$h4","_defaultTypography$h5","_defaultTypography$h6","_defaultTypography$bo","_defaultTypography$bo2","mapAlignment","alignment","Alignment","Left","Center","Right","StiggContext","createContext","optional","ctx","useContext","SvgCheckStigg","SkeletonContainer","EntitlementCheckIcon","CheckUrl","PlanOfferingSkeleton","PlansContainer","EntitlementContainer","FooterSkeletonLoader","BillingPeriodLoader","PlanOfferingLoader","circle","marginBottom","PaywallLoader","Fonts","externalFontUrl","Global","styles","CustomCssGlobal","customCss","useStiggTheme","remoteThemeOverride","customizedTheme","primaryColor","textColor","successColor","errorColor","baseTheme","mergedTheme","merge","Color","hex","primaryDark","darken","alpha","backgroundSection","lightness","lighten","white","tertiary","popover","createTypographyTheme","coef","pxToRem","bodyFontFamily","headingFontFamily","fontSizes","SdkThemeProvider","componentTheme","muiPalette","main","createMuiPalette","materialTheme","createTheme","MuiThemeProvider","THEME_ID","ThemeProvider","StyledThemeProvider","CustomerPortalContext","useCustomerPortalContext","CustomerPortalProvider","globalTheme","themeOverride","remoteConfiguration","textOverrides","resourceId","productId","customerPortalUpdatedAt","customerPortal","setCustomerPortal","useEffect","isCustomerLoaded","getCustomerPortal","logger","_context","loadCustomerPortal","useCustomerPortal","configuration","paywallBackgroundColor","currentPlanBackground","mapCustomerPortalConfiguration","customerPortalTheme","sectionTitleColor","planNameColor","backgroundColor","_remoteConfiguration$","_remoteConfiguration$2","listItemBackgroundColor","_remoteConfiguration$3","tabMaxHeight","_remoteConfiguration$4","iconsBackgroundColor","resolvedTextOverrides","manageSubscription","usageTabTitle","addonsTabTitle","promotionsTabTitle","promotionsSubtitle","contactSupportTitle","contactSupportLink","editBilling","invoicesTitle","viewInvoiceHistory","editPaymentDetails","paywallSectionTitle","cancelScheduledUpdatesButtonTitle","Provider","CustomerPortalIntentionType","SvgEditIcon","SectionHeader","$disableMargin","SectionTitle","StyledEditIcon","EditIcon","SubscriptionsOverviewHeader","onManageSubscription","hideManageButton","MANAGE_SUBSCRIPTION","marginLeft","subscriptions","isEmpty","index","addonId","Row","$borderColor","Promotions","promotionalEntitlements","flexDirection","promotionalEntitlement","_promotionalEntitleme","getPromotionTitle","endDate","StyledTabs","Tabs","TabsLayout","TabContent","Box","$maxHeight","TabPanel","maxHeight","other","role","hidden","TabTitle","isSelected","label","Medium","SubscriptionTabs","hiddenSections","isSectionHidden","sectionName","section","showAddons","showPromotions","setValue","borderBottom","_","newValue","Tab","textTransform","breakpoints","xs","sm","md","lg","xl","xxl","mqMinWidth","breakpoint","mq","useIsScreenWiderThan","useMediaQueryMui","SkeletonLayout","SkeletonLayoutLeft","SubscriptionOverviewLoader","isScreenWiderThanMd","SubscriptionScheduledUpdateDowngradeRow","scheduleUpdate","ArrowDown","SubscriptionScheduledUpdateBillingPeriodChangeRow","currentBillingPeriod","nextBillingPeriod","SubscriptionScheduledUpdateUnitQuantityChangeRow","newQuantityUnits","flexWrap","SubscriptionScheduledUpdateRow","SubscriptionScheduleUpdateAlertContainer","StyledRestoreIcon","Restore","MultipleScheduledUpdates","scheduledUpdates","justifyContent","SingleScheduledUpdate","SubscriptionScheduledUpdatesAlert","onCancelScheduledUpdates","stiggTheme","isSingleScheduledUpdate","marginRight","SectionContainer","$backgroundColor","NextEstimatedBill","rangeEnd","NoUpcomingBilling","ContactCustomerSupportLayout","ContactSupportButton","ContactCustomerSupport","onContactSupport","contactSupportText","linkLabel","Container","UpcomingBilling","noUsageBasedPrices","_subscription$prices","every","billingModel","scheduledDowngradeToFree","_subscription$schedul","InTrial","planName","_subscription$prices2","_subscription$prices3","_subscription$billing","totalPrice","_subscription$totalPr","SvgSandClock","InformationTooltip","placement","Tooltip","arrow","classes","popper","tooltip","$padding","$maxWidth","tooltipClasses","maxWidth","boxShadow","$display","$maxLines","$wordBreak","$bold","checkTextClamped","element","clientHeight","scrollHeight","offsetWidth","scrollWidth","LongText","leaveDelay","maxLines","wordBreak","tooltipPlacement","dataTestId","isTextClamped","setIsTextClamped","useRef","current","textClamped","OnTrialBadge","StyledLink","Link","TrialPanel","includePlanName","SandClockIcon","trialRemainingDays","UPGRADE_TRIAL_PLAN","SubscriptionView","mainSubscription","trialSubscription","getUsagePercentage","currentUsage","limit","floor","StyledLinearProgress","LinearProgress","string","$progressStatus","StyledDivider","FeatureUsageProgressBar","usagePercentage","linearProgressStatus","EntitlementCtaButton","onBuyMore","canBuyMore","canUpgradeSubscription","hasCustomSubscription","ChargeItem","hideChargePrice","refId","whiteSpace","_entitlement$currentU","_entitlement$currentU2","_entitlement$usageLim","ChargeList","entitlementByFeature","keyBy","filteredSubscriptionPrices","SubscriptionsOverview","isLoadingData","CustomerPortalHeaderLayout","CustomerPortalHeader","ExternalLinkText","LinkIcon","ExternalLinkIcon","ExternalLinkButton","url","startIcon","InformationGridContainer","InformationGridRow","InformationGrid","rows","classNamePrefix","valueTypographyProps","labelTypographyProps","SkeletonButton","PaymentDetailsSection","billingInformation","items","orientation","email","defaultPaymentMethodId","defaultPaymentMethodLast4Digits","defaultPaymentExpirationMonth","defaultPaymentExpirationYear","unshift","padStart","editButton","billingPortalUrl","CustomerPortalPaywallLayout","CustomerPortalPaywall","paywallComponent","CustomerPortalLayout","CustomerPortalSections","getFeatureDisplayNameText","featureDisplayName","displayNameLowerCase","lowercase","FeatureUsageContainer","$highlight","FeatureUsage","hasOverageUsage","isUndefined","usagePeriodEnd","calculateResetDiff","diff","getResetUsageText","CustomerUsageLoader","isMdScreen","spacing","range","CustomerUsageData","filterEntitlements","showAll","setShowAll","meteredEntitlements","meterType","MeterType","Fluctuating","Incremental","subscriptionPriceByFeature","priceEntitlements","otherEntitlements","sortedEntitlements","filteredEntitlements","entitlementsToShow","Minus","Plus","CustomerPortalContainer","customerPortalSectionRef","onManageClick","customerSubscriptions","scrollIntoView","behavior","shouldShowUsage","shouldShowPaymentDetails","shouldShowInvoices","InvoicesSection","viewInvoiceHistoryButton","sortSubscriptionAddons","sortBy","filterAddonPricePointsByBillingPeriod","mapAddonPricePointsByBillingCountryCode","billingCountryCode","useRemoveAddon","setState","useCheckoutContext","draft","remove","addonsStep","useSetIsValid","isValid","widgetState","useCheckoutModel","checkoutState","checkout","checkoutLocalization","setWidgetReadOnly","readOnly","setIsValid","CheckoutStepKey","getValidPriceQuantity","hasMonthlyPrices","hasAnnualPrices","getBillingPeriod","isInAdvanceCommitmentCharge","useSetBillableFeature","planStep","usePlanStepModel","setBillingPeriod","setBillableFeature","CHECKOUT_STEPS","PLAN","ADDONS","PAYMENT","INITIAL_STATE","activeStep","completedSteps","steps","useMarkStepAsCompleted","stepNumber","progressBar","useGoNext","useSetIsDisabled","useProgressBarModel","progressBarState","currentStep","isLastStep","isCheckoutComplete","setActiveStep","markStepAsCompleted","goNext","setIsDisabled","useSubscriptionModel","paymentStep","promotionCode","billingAddress","taxPercentage","mapBillingInformation","previewSubscription","customerId","onMockCheckoutPreview","estimateAddons","subscriptionPreview","errorMessage","previewSubscriptionProps","split","errorMsg","trim","usePreviewSubscriptionAction","previewSubscriptionAction","useSetErrorMessage","useSetBillingAddress","usePaymentStepModel","setUseNewPaymentMethod","useNewPaymentMethod","setErrorMessage","setBillingAddress","CheckoutContext","CheckoutContextProvider","initialState","innerSetState","updater","old","produce","CheckoutProvider","skipCheckoutSteps","onMockCheckoutState","setCheckout","loadCheckout","getCheckoutState","useLoadCheckout","summaryBackgroundColor","mapCheckoutConfiguration","checkoutTheme","_remoteConfiguration","globalPalette","paymentInputBackgroundColor","paymentInputBorderColor","paymentInputBorderRadius","getResolvedCheckoutTheme","changePlan","billingPeriodsTitle","addAddonText","newPaymentMethodText","newPaymentMethodBillingAddressTitle","newPaymentMethodCardTitle","summary","addCouponCodeText","couponCodeTitle","addonsSectionTitle","discountsSectionTitle","onlyPayAsYouGoText","startsAtText","proratedTotalDueText","baseChargeText","totalText","totalDueText","totalBillingPeriodText","appliedCreditsTitle","creditsForUnusedTimeText","credits","discountText","discountDetails","DiscountType","Percentage","discountTextPostfix","durationType","DiscountDurationType","Once","Repeating","Fixed","durationInMonths","Forever","taxTitle","taxDetails","percentage","changesWillApplyAtEndOfBillingPeriod","billingPeriodEnd","checkoutSuccessText","payAsYouGoTooltipText","checkoutButton","nextText","noChangesText","updateText","downgradeToFreeText","upgradeText","downgradeToFree","alertText","freePlanHeader","freePlanName","freePlanPriceText","paidPlanHeader","paidPlanName","paidPlanPriceText","preconfiguredBillableFeatures","hasMonthlyPlan","hasAnnualPlan","resolveBillingPeriod","preconfBillableFeaturesByFeatureId","quantityByFeatureId","_activeSubscription$p","charge","preconfiguredQuantity","_quantityByFeatureId$","getBillableFeatures","getPlanStepInitialState","availableAddons","sortAddons","filterAddons","activeSubscriptionAddons","filterSubscriptionAddons","planAddon","initialAddons","cloneDeep","getAddonsStepInitialState","_billingInformation$t","paymentMethodDetails","availableCharges","stepsToFilter","hasMultipleBillingPeriods","availableChargesIds","preconfiguredChargesIds","canSkipPlanStep","step","getProgressBarInitialState","resource","_checkout$resource","isLoadingCheckoutData","_billingInformation$t2","CheckoutLayout","CheckoutContent","CheckoutPanel","StyledProgress","linearProgressClasses","root","bar","StyledStepButton","buttonClasses","StyledIcon","$shouldFill","CheckoutProgressBar","containerRef","progress","previousStep","setPreviousStep","mb","isCompleted","StepIcon","CHARGES_BILLING_MODEL_ORDER","FlatFee","useChargesSort","charges","indexOf","_charge$feature","sortCharges","usePromotionCodeModel","setPromotionCode","StyledPlusIcon","AddPromotionCodeButton","onAddClick","CouponCodeAddButton","AddPromotionCode","persistPromotionCode","showInput","setShowInput","handlePromotionCode","immediateInvoice","_subscriptionPreview$","toUpperCase","autoFocus","inputProps","maxLength","onKeyDown","preventDefault","CircularProgress","AppliedCouponContainer","AppliedPromotionCode","onClearPromotionCode","minWidth","PromotionCodeSectionContainer","PromotionCodeSection","StripePaymentForm","onBillingAddressChange","collectPhoneNumber","shouldCollectPhoneNumber","_configuration$conten","pointerEvents","AddressElement","args","address","postalCode","postal_code","callExternalBillingAddressChanged","mode","fields","phone","defaultValues","PaymentElement","onReady","terms","card","billingDetails","FAILED_PAYMENT_COLLECTION_STATUSES","PaymentCollection","Failed","Processing","handleStripeFormValidations","elements","submit","elementsError","handleStripeNextAction","paymentIntentClientSecret","applySubscriptionResults","latestInvoice","_subscription$latestI","paymentSecret","paymentCollection","stripe","ActionRequired","handleNextAction","clientSecret","NextActionError","handleStripeSetup","confirmSetup","confirmParams","return_url","href","redirect","setupError","setupErrorMessage","retrieveSetupIntent","setupIntent","payment_method","newPaymentMethodId","handleNewPaymentMethod","setupIntentClientSecret","stripeFormValidationsResults","paymentMethodId","CheckoutSuccessContainer","CheckoutSuccessText","CheckoutSuccess","block","inline","Lottie","animationData","loop","autoplay","delay","ms","res","setTimeout","WithSkeleton","RemainingCreditsCaption","isFetchingSubscriptionPreview","proration","_immediateInvoice$pro","netAmount","_immediateInvoice$pro2","ScheduledUpdatesCaption","hasScheduledUpdates","currentBillingPeriodEnd","changesWillApplyText","NextBillingCaption","recurringInvoice","nextBillingDate","billingPeriodText","hasUnitBasedPricing","hasNonUnitBasedPricing","totalAmountText","CheckoutCaptions","formatPricePerUnit","totalAmount","aBlockSize","billingPeriodString","formattedUnitPrice","formattedTotalPrice","GraduatedPriceBreakdown","LineItemContainer","LineItemRow","startUnit","getLabel","CollapsableSectionIcon","ChevronRight","$size","$isOpen","NestedBreakdownContainer","PayAsYouGoPriceTooltip","BilledPriceLineItem","nestedBreakdown","isScreenWiderThanLg","isNestedBreakdownOpen","setIsNestedBreakdownOpen","toggleNestedBreakdown","isPayAsYouGo","ceil","underline","IconButton","isBulkTiers","isQuantityInFirstTier","getPriceBreakdownString","Collapse","FreeChargeLineItem","DiscountLineItem","AppliedCreditsLineItem","used","TaxLineItem","tax","SummaryContainer","SummaryCard","Paper","defaultProps","elevation","SummaryTitle","TotalDueText","CheckoutSummary","onCheckout","onCheckoutCompleted","disablePromotionCode","disableSuccessAnimation","isFreeDowngrade","isCheckoutCompletedSuccessfully","setIsCheckoutCompletedSuccessfully","partition","usageCharges","baseCharge","setSubscriptionPreview","setIsFetchingSubscriptionPreview","estimateSubscription","timer","clearTimeout","usePreviewSubscription","isMocked","onSuccess","subscriptionState","useSubscriptionState","setupSecret","useStripe","useElements","handleSubmit","usedStiggCheckoutAction","paymentMethodResults","checkoutParams","checkoutAction","applySubscription","nextActionResults","results","externalCheckoutResults","checkoutResults","checkoutActionResults","useSubmit","handleCheckout","onCheckoutClick","checkoutHasChanges","showPromotionCodeLine","showDiscountLine","hasDiscounts","hasPayAsYouGoCharges","onlyPayAsYouGoCharges","baseChargeLabel","paddingRight","margin","priceBillableFeature","_subscription$billabl","_price$feature4","_price$feature5","_subscription$addons","addonPrice","_addon$addon$pricePoi","_addon$addon","hasProrations","subTotal","isPlanUpdate","resolveCheckoutButtonText","CheckoutSummarySkeleton","CheckoutAddonsContainer","AddonListItemContainer","TrashButton","AddonListItem","addonState","initialAddonState","setAddon","removeAddon","onAddonsValidationChange","isAdded","hasChanges","handleQuantityChange","marginX","helperText","FormHelperTextProps","paddingX","paddingY","CheckoutAddonsStep","addonToUpdate","currentAddon","acc","curr","addonsValidation","setAddonsValidation","PaymentMethodContainer","NewPaymentMethodContainer","$hideBorders","PaymentMethodLayoutContainer","PaymentMethodTextContainer","PaymentMethodLayout","subtitle","Radio","ExistingPaymentMethod","expirationMonth","expirationYear","onSelect","last4Digits","NewPaymentMethod","hasExistingPaymentMethod","PaymentContainer","PaymentStep","handleOnSelect","openNewPaymentMethod","Alert","severity","ChangePlanButton","allowChangePlan","onChangePlan","formatBillingPeriod","BillingPeriodPickerContainer","BillingPeriodButton","$isOnlyBillingPeriod","$isActive","BillingPeriodOptions","BillingPeriodOption","isOnlyBillingPeriod","isActive","monthlyPrices","annualPrices","hasBothBillingPeriods","StyledPlanCharge","div","getValidationText","PlanCharge","chargeRow","onValidationChange","isBaseCharge","_charge$feature3","_charge$feature4","hasQuantityRestrictions","_charge$feature5","CheckoutChargeList","planCharges","p","chargesValidation","setChargesValidation","_charge$feature6","CheckoutPlanContainer","CheckoutPlanStep","StyledArrowRightIcon","DowngradeToFreePlansContainer","DowngradeToFreeAlert","DowngradeToFreePlanBox","DowngradeToFreeContent","priceText","headerText","DowngradeToFreePlan","alertAction","freePlan","paidBillingPeriod","action","CheckoutContainer","stripePromise","setStripePromise","billingIntegration","credentials","billingIdentifier","BillingVendorIdentifier","Stripe","accountId","publicKey","loadStripe","stripeAccount","useStripeIntegration","getStepProps","checkoutContent","stripeElementsMode","Elements","appearance","colorText","colorPrimaryText","colorTextPlaceholder","colorBackground","rules","ProvisionStatus","useBooleanEntitlement","stiggContext","getBooleanEntitlement","BOOLEAN_DEFAULT_FALLBACK_ENTITLEMENT","_params$options","fallback","useNumericEntitlement","getNumericEntitlement","NUMERIC_DEFAULT_FALLBACK_ENTITLEMENT","useMeteredEntitlement","getMeteredEntitlement","METERED_DEFAULT_FALLBACK_ENTITLEMENT","useEnumEntitlement","getEnumEntitlement","ENUM_DEFAULT_FALLBACK_ENTITLEMENT","useFetch","func","isLoaded","setIsLoaded","setError","data","setData","fetchData","noAccessComponent","hasAccess","containerProps","showOnlyEligiblePlans","onBillingPeriodChange","currentSubscriptionOverrideFn","hasCustomerPortalContext","isCustomerPortalLoading","setSelectedBillingPeriod","setAvailableBillingPeriods","paywall","setPaywall","waitForInitialization","getPaywall","paywallResult","loadPaywall","paywallData","s","_currentSubscription","trialEndDate","_currentSubscription3","getCustomerSubscriptionDetails","_currentSubscription$","downgradeSchedule","billingChangedSchedule","paywallPlans","order","eligibleForProductTrial","eligibleForTrial","_customer$eligibleFor","productTrial","product","defaultTrialConfig","eligible","isUpcomingPlan","downgradeVariables","billingChangedVariables","isPlanHasBillingPeriodPrice","currentPlanOrder","_plans$find","paywallConfiguration","planWidth","mapPaywallConfiguration","mapPaywallData","useLoadPaywallData","_plan$defaultTrialCon","duration","symbol","component","apiKey","baseUri","baseEdgeUri","enableEdge","customerToken","cacheTtlMs","useEntitlementPolling","entitlementPollingInterval","entitlementsFallback","stiggClient","offline","clientName","clientVersion","currentApiKey","initializeParams","Stigg","initialize","lazyLoad","isInitialized","refreshData","setContext","Date","refresh","isMounted","safeSetContext","setContextFunc","onEntitlementsUpdated","updatedAt","setStiggInstance","removeListener","addListener","loadStiggClient","clearCustomer","setCustomerId","SkeletonTheme","baseColor","highlightColor","getActiveSubscriptions","paramName","onProvisionStart","onProvisionSucceeded","onProvisionFailed","IN_PROGRESS","provisionStatus","setProvisionStatus","isAwaitingCheckout","setIsAwaitingCheckout","checkoutCompleted","urlSearchParams","URLSearchParams","search","get","waitForCheckoutCompleted","SUCCEEDED","FAILED","waitForCheckoutToComplete"],"mappings":"4gHAAgBA,GACdC,EACAC,EACAC,OAEMC,EAAYD,MAAkBA,EAAgB,UAG9CF,GAAuC,IAApBA,IAA0BC,EAK/CD,GAAmBA,EAAkB,GAAKC,EAClCD,MAAmBC,EAAkBE,EAG7CH,GAAmBA,EAAkB,aACrBA,EAAkBG,EAG/B,YAZWF,EAAkBE,WCTtBC,GAAaC,gBACpBA,SAAAA,EAAYC,eAAe,QAAS,CACzCC,sBAAuB,gIC6B3B,SAASC,GAASC,EAAcC,UACtBA,OACD,cACI,YACJ,sBACID,EAAME,MAAMC,QAAQC,YACxB,4BACIJ,EAAME,MAAMC,QAAQE,iBACxB,iBACIL,EAAME,MAAMC,QAAQG,YACxB,eACIN,EAAME,MAAMC,QAAQI,qBAEpBP,EAAME,MAAMC,QAAQK,KAAKP,IAItC,IAAMQ,GAAaC,EAAOC,2BAAPD,cAEf,qBAAGE,gCAoBP,SAASC,GAAcC,UACbA,OACD,cACIC,aAAiBC,SACrB,wBAGID,aAAiBE,QAI9B,SAASC,GAAclB,EAAcmB,OAC3BC,EAAepB,EAAME,MAArBkB,kBACAD,OACD,YACIN,GAAcO,EAAWC,GAAGP,gBAChC,YACID,GAAcO,EAAWE,GAAGR,gBAChC,YACID,GAAcO,EAAWG,GAAGT,gBAChC,eACID,GAAcO,EAAWI,KAAKV,gBAClC,iBACID,GAAcO,EAAWK,QAAQX,2BAEjCC,aAAiBE,QAI9B,ICnGIS,GAAIC,GCAJC,GAAOC,GAAOC,GCAdF,GAAOC,GAAOC,GAAQC,GCAtBH,GAAOC,GCAPH,GAAIC,GCAJE,GNmGSG,GAAaC,cAAW,SAACC,EAAwBC,OAE1DC,EAUEF,EAVFE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C,OAAoBC,OACrBC,EAzBCnsC,WAAQ,eACPosC,EAAkB,IAAIC,gBAAgBhuC,OAAOC,SAASguC,eACrDZ,EAAYU,EAAgBG,IAAIb,GAAaU,IAEnD,CALmBV,EA0BmB,oBArB1BrtC,OAAOC,SAASguC,gBAuB/Br9B,aAAU,yCAC0B,sFAC3Bk9B,GAAyD,UAApCA,EAAkBn0C,gBAA6Bi0C,0DAIzEC,GAAsB,GAClBP,GACFA,sBAG2B/vD,EAAM4wD,kCAA3BzsC,SACNisC,EAAmBrH,wBAAgB8H,WAC/Bb,GACFA,EAAqB7rC,qDAGvBgI,QAAQ9rB,MAAM,gDACd+vD,EAAmBrH,wBAAgB+H,QAC/Bb,GACFA,iCAGFK,GAAsB,oIAIrBS,KAEJ,CAAC/wD,EAAOuwD,IAEJ,CAAEF,mBAAAA,EAAoBF,gBAAAA"}
1
+ {"version":3,"file":"react-sdk.cjs.production.min.js","sources":["../src/components/paywall/utils/calculateUnitQuantityText.ts","../src/components/utils/formatNumber.ts","../src/components/common/Typography.tsx","../src/assets/addons.svg","../src/assets/billing-info-customer.svg","../src/assets/contact-support.svg","../src/assets/credit-card.svg","../src/assets/dollar-coin.svg","../src/assets/mini-schedule.svg","../src/components/common/iconColor.ts","../src/assets/promotions.svg","../src/assets/restore.svg","../src/assets/schedule-box.svg","../src/assets/schedule.svg","../src/assets/subscription-renews-icon.svg","../src/assets/trash.svg","../src/assets/payment-method.svg","../src/assets/outlined-circle.svg","../src/assets/outlined-checked-circle.svg","../src/assets/outlined-checked-circle-disabled.svg","../src/assets/arrow-forward.svg","../src/assets/close.svg","../src/assets/check.svg","../src/assets/pay-as-you-go-charge.svg","../src/assets/coupon.svg","../src/assets/add.svg","../src/assets/remove.svg","../src/assets/entitlement-check.svg","../src/components/common/Icon.tsx","../src/components/paywall/EntitlementRow.tsx","../src/components/paywall/types.ts","../src/components/paywall/PlanEntitlements.tsx","../src/theme/getResolvedTheme.ts","../src/components/utils/priceTierUtils.ts","../src/components/utils/getSubscriptionScheduleUpdateTexts.tsx","../src/components/paywall/PlanOfferingButton.tsx","../src/components/utils/currencyUtils.ts","../src/components/utils/numberUtils.ts","../src/components/utils/getPlanPrice.ts","../src/components/utils/getPaidPriceText.ts","../src/components/checkout/components/Button.tsx","../src/components/checkout/components/InputField.tsx","../src/components/checkout/components/Skeletons.style.ts","../src/components/checkout/components/ContentLoadingSkeleton.tsx","../src/components/utils/onWheelBlur.ts","../src/components/common/VolumePerUnitInput.tsx","../src/components/common/VolumeBulkSelect.tsx","../src/components/common/TiersSelectContainer.tsx","../src/components/paywall/PlanPrice.tsx","../src/components/paywall/PlanCompatibleAddons.tsx","../src/components/paywall/PlanOffering.tsx","../src/assets/powered-by-stigg.svg","../src/components/paywall/BillingPeriodPicker.tsx","../src/components/utils/calculateDiscountRate.ts","../src/components/common/PoweredByStigg.tsx","../src/components/paywall/utils/hasPricePoints.ts","../src/components/paywall/Paywall.tsx","../src/components/paywall/utils/getPlansToDisplay.ts","../node_modules/regenerator-runtime/runtime.js","../src/services/logger.ts","../src/components/paywall/utils/computeDefaultBillingPeriod.ts","../src/components/checkout/configurations/typography.ts","../src/components/common/mapExternalTheme.ts","../src/assets/check-stigg.svg","../src/components/StiggProvider.tsx","../src/hooks/useStiggContext.ts","../src/components/paywall/PaywallLoader.tsx","../src/theme/Fonts.tsx","../src/theme/Theme.tsx","../src/components/customerPortal/CustomerPortalProvider.tsx","../src/components/customerPortal/customerPortalTheme.ts","../src/components/customerPortal/hooks/useCustomerPortal.ts","../src/components/customerPortal/customerPortalTextOverrides.ts","../src/assets/edit-icon.svg","../src/components/customerPortal/common/StyledButton.tsx","../src/components/customerPortal/types.ts","../src/components/customerPortal/common/SectionHeader.ts","../src/components/customerPortal/common/SectionTitle.tsx","../src/components/customerPortal/subscriptionOverview/SubscriptionsOverviewHeader.tsx","../src/components/customerPortal/subscriptionOverview/tabs/AddonsList.tsx","../src/components/customerPortal/subscriptionOverview/tabs/Promotions.tsx","../src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.style.tsx","../src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.tsx","../src/components/common/mediaQuery.ts","../src/components/hooks/useIsScreenWiderThan.ts","../src/components/customerPortal/subscriptionOverview/SubscriptionOverviewLoader.tsx","../src/components/customerPortal/subscriptionOverview/subscriptionScheduledUpdates/SubscriptionScheduledUpdateRow.tsx","../src/components/customerPortal/subscriptionOverview/subscriptionScheduledUpdates/SubscriptionScheduledUpdatesAlert.tsx","../src/components/customerPortal/common/SectionContainer.tsx","../src/components/customerPortal/subscriptionOverview/upcomingBilling/NextEstimatedBill.tsx","../src/components/customerPortal/subscriptionOverview/upcomingBilling/NoUpcomingBilling.tsx","../src/components/customerPortal/subscriptionOverview/ContactCustomerSupport.tsx","../src/assets/sand-clock.svg","../src/components/customerPortal/subscriptionOverview/upcomingBilling/UpcomingBilling.tsx","../src/components/common/InformationTooltip.tsx","../src/components/common/LongText.tsx","../src/components/customerPortal/subscriptionOverview/subscriptionView/TrialPanel.tsx","../src/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.tsx","../src/components/customerPortal/usage/featureUsage/FeatureUsage.helper.ts","../src/components/customerPortal/usage/featureUsage/FeatureUsageProgressBar.tsx","../src/components/customerPortal/usage/featureUsage/EntitlementCTAButton.tsx","../src/components/customerPortal/subscriptionOverview/charges/ChargeItem.tsx","../src/components/customerPortal/subscriptionOverview/charges/ChargeList.tsx","../src/components/customerPortal/subscriptionOverview/SubscriptionsOverview.tsx","../src/components/customerPortal/CustomerPortalHeader.tsx","../src/components/customerPortal/common/ExternalLinkButton.tsx","../src/components/customerPortal/billing/InformationGrid.tsx","../src/components/customerPortal/common/SkeletonButton.tsx","../src/components/customerPortal/billing/PaymentDetailsSection.tsx","../src/components/customerPortal/paywall/CustomerPortalPaywall.style.ts","../src/components/customerPortal/paywall/CustomerPortalPaywall.tsx","../src/components/customerPortal/CustomerPortal.style.ts","../src/components/utils/getFeatureName.ts","../src/components/customerPortal/usage/featureUsage/FeatureUsage.style.ts","../src/components/customerPortal/usage/featureUsage/FeatureUsage.tsx","../src/components/customerPortal/usage/CustomerUsageData.style.tsx","../src/components/customerPortal/usage/CustomerUsageData.tsx","../src/components/customerPortal/CustomerPortalContainer.tsx","../src/components/customerPortal/billing/InvoicesSection.tsx","../src/components/checkout/steps/addons/addon.utils.ts","../src/components/checkout/hooks/useAddonsStepModel.ts","../src/components/checkout/hooks/useCheckoutModel.ts","../src/components/checkout/hooks/useProgressBarModel.ts","../src/components/utils/priceUtils.ts","../src/components/utils/planPrices.ts","../src/components/checkout/hooks/usePlanStepModel.ts","../src/components/checkout/hooks/useSubscriptionModel.ts","../src/components/checkout/hooks/usePreviewSubscription.ts","../src/components/checkout/hooks/usePaymentStepModel.ts","../src/components/checkout/configurations/theme.ts","../src/components/checkout/CheckoutProvider.tsx","../src/components/checkout/hooks/useLoadCheckout.ts","../src/components/checkout/configurations/textOverrides.ts","../src/assets/plus-icon.svg","../src/components/checkout/CheckoutContainer.style.ts","../src/components/checkout/progressBar/CheckoutProgressBar.style.ts","../src/components/checkout/progressBar/CheckoutProgressBar.tsx","../src/components/hooks/useChargeSort.ts","../src/components/checkout/hooks/useCouponModel.ts","../src/components/checkout/promotionCode/AddPromotionCodeButton.tsx","../src/components/checkout/promotionCode/AddPromotionCode.tsx","../src/components/checkout/promotionCode/AppliedPromotionCode.tsx","../src/components/checkout/promotionCode/PromotionCodeSection.tsx","../src/components/checkout/steps/payment/stripe/StripePaymentForm.tsx","../src/components/checkout/hooks/useSubscriptionState.ts","../src/components/checkout/steps/payment/stripe/stripe.utils.ts","../src/components/checkout/summary/CheckoutSuccess.tsx","../src/components/checkout/steps/payment/stripe/useSubmit.ts","../src/components/checkout/steps/payment/zuora/zuora.utils.ts","../src/components/checkout/steps/payment/zuora/useZuoraIntegration.ts","../src/components/checkout/steps/payment/zuora/useZuoraSubmit.ts","../src/components/checkout/summary/components/WithSkeleton.tsx","../src/components/checkout/summary/components/CheckoutCaptions.tsx","../src/components/checkout/summary/components/getPriceBreakdownString.ts","../src/components/checkout/summary/components/GraduatedPriceBreakdown.tsx","../src/components/common/CollapsableSectionIcon.tsx","../src/components/checkout/summary/components/LineItems.tsx","../src/components/checkout/summary/CheckoutSummary.tsx","../src/components/checkout/summary/CheckoutSummarySkeleton.tsx","../src/components/checkout/steps/addons/CheckoutAddonsStep.style.tsx","../src/components/checkout/steps/addons/CheckoutAddonsStep.tsx","../src/components/checkout/steps/payment/PaymentMethods.style.ts","../src/components/checkout/steps/payment/zuora/ZuoraPaymentForm.tsx","../src/components/checkout/steps/payment/PaymentMethods.tsx","../src/components/checkout/steps/payment/PaymentStep.tsx","../src/components/checkout/components/ChangePlanButton.tsx","../src/components/checkout/planHeader/PlanHeader.tsx","../src/components/checkout/formatting.ts","../src/components/checkout/steps/plan/BillingPeriodPicker.style.tsx","../src/components/checkout/steps/plan/BillingPeriodPicker.tsx","../src/components/checkout/steps/plan/CheckoutChargeList.tsx","../src/assets/arrow-right.svg","../src/components/checkout/steps/plan/CheckoutPlanStep.style.tsx","../src/components/checkout/steps/plan/CheckoutPlanStep.tsx","../src/components/checkout/components/StyledArrow.tsx","../src/components/checkout/components/DowngradeToFreeContainer.tsx","../src/components/checkout/CheckoutContainer.tsx","../src/components/checkout/steps/payment/stripe/useStripeIntegration.ts","../src/components/hooks/useWaitForCheckoutCompleted.ts","../src/hooks/useBooleanEntitlement.ts","../src/hooks/useNumericEntitlement.ts","../src/hooks/useMeteredEntitlement.ts","../src/hooks/useEnumEntitlement.ts","../src/hooks/useFetch.ts","../src/components/BooleanEntitlementGuard.tsx","../src/components/checkout/Checkout.tsx","../src/components/customerPortal/CustomerPortal.tsx","../src/components/EnumEntitlementGuard.tsx","../src/components/MeteredEntitlementGuard.tsx","../src/components/NumericEntitlementGuard.tsx","../src/components/paywall/PaywallContainer.tsx","../src/components/paywall/hooks/useLoadPaywallData.ts","../src/components/paywall/utils/mapPaywallData.ts","../src/components/paywall/utils/calculateTrialDaysLeft.ts","../src/components/paywall/paywallTextOverrides.ts","../src/hooks/useActiveSubscriptions.ts","../src/hooks/useCustomerPortal.ts","../src/hooks/usePaywall.ts"],"sourcesContent":["export function calculateUnitQuantityText(\n minUnitQuantity?: number | null,\n maxUnitQuantity?: number | null,\n unitsPlural?: string | null,\n) {\n const unitsText = unitsPlural ? ` ${unitsPlural}` : '';\n\n // copy for only maxunit\n if ((!minUnitQuantity || minUnitQuantity === 1) && maxUnitQuantity) {\n return `Up to ${maxUnitQuantity}${unitsText}`;\n }\n\n // both limits\n if (minUnitQuantity && minUnitQuantity > 1 && maxUnitQuantity) {\n return `${minUnitQuantity}-${maxUnitQuantity}${unitsText}`;\n }\n\n if (minUnitQuantity && minUnitQuantity > 1) {\n return `Minimum ${minUnitQuantity}${unitsText}`;\n }\n\n return '';\n}\n","export function formatNumber(usageLimit: number | null | undefined) {\n return usageLimit?.toLocaleString('en-US', {\n maximumFractionDigits: 0,\n });\n}\n","import React, { CSSProperties, forwardRef } from 'react';\nimport styled from '@emotion/styled/macro';\nimport { FontWeight as StyledFontWeight, Text, TypeProps } from 'styled-typography';\nimport { Theme, useTheme } from '@emotion/react';\nimport { FontWeight } from '../../theme/types';\n\ntype Colors =\n | 'primary'\n | 'primary.main'\n | 'primary.main.light'\n | 'secondary'\n | 'tertiary'\n | 'disabled'\n | 'white'\n | 'warning'\n | 'error';\n\nexport type TypographyProps = {\n children: React.ReactNode;\n variant?: 'h1' | 'h3' | 'h6' | 'body1' | 'caption';\n style?: CSSProperties | undefined;\n color?: Colors;\n // This is being used when passing color from the theming which\n // can be any color and not from the closed list of colors above\n overrideColor?: string;\n className?: string;\n bold?: boolean;\n span?: boolean;\n as?: 'div' | 'p' | 'span';\n} & Omit<TypeProps, 'color' | 'level'>;\n\nfunction getColor(theme: Theme, $color: Colors) {\n switch ($color) {\n case 'white':\n return 'white';\n case 'primary.main':\n return theme.stigg.palette.primary;\n case 'primary.main.light':\n return theme.stigg.palette.primaryLight;\n case 'warning':\n return theme.stigg.palette.warning;\n case 'error':\n return theme.stigg.palette.error;\n default:\n return theme.stigg.palette.text[$color];\n }\n}\n\nconst StyledText = styled(Text)<{ $span?: boolean }>`\n margin: 0;\n ${({ $span }) => $span && `display: inline`};\n`;\n\nfunction getLevel(variant: TypographyProps['variant']) {\n switch (variant) {\n case 'h1':\n return 1;\n case 'h3':\n return 2;\n case 'h6':\n return 3;\n case 'body1':\n return 4;\n case 'caption':\n return 5;\n default:\n return 3;\n }\n}\n\nfunction mapFontWeight(fontWeight: FontWeight) {\n switch (fontWeight) {\n case 'bold':\n return StyledFontWeight.Bold;\n case 'normal':\n return StyledFontWeight.Normal;\n default:\n return StyledFontWeight.Normal;\n }\n}\n\nfunction getFontWeight(theme: Theme, variant: TypographyProps['variant']) {\n const { typography } = theme.stigg;\n switch (variant) {\n case 'h1':\n return mapFontWeight(typography.h1.fontWeight);\n case 'h3':\n return mapFontWeight(typography.h2.fontWeight);\n case 'h6':\n return mapFontWeight(typography.h3.fontWeight);\n case 'body1':\n return mapFontWeight(typography.body.fontWeight);\n case 'caption':\n return mapFontWeight(typography.caption.fontWeight);\n default:\n return StyledFontWeight.Normal;\n }\n}\n\nexport const Typography = forwardRef((props: TypographyProps, ref) => {\n const {\n children,\n span,\n style,\n fontWeight,\n variant = 'body1',\n color = 'primary',\n overrideColor,\n bold,\n as = 'p',\n ...rest\n } = props;\n const theme = useTheme();\n const level = getLevel(variant);\n const levelClassName = `typography-level-${level}`;\n const className = props.className ? `${props.className} ${levelClassName}` : levelClassName;\n\n return (\n <StyledText\n as={as}\n ref={ref}\n {...rest}\n className={className}\n style={style}\n level={level}\n color={overrideColor || getColor(theme, color)}\n fontWeight={fontWeight ?? (bold ? StyledFontWeight.Bold : getFontWeight(theme, variant))}\n $span={span}>\n {children}\n </StyledText>\n );\n});\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_834_118930)\">\n<path d=\"M12 6.85712V17.1428\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M6.85712 12H17.1428\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M18 0.857117H5.99997C3.15966 0.857117 0.857117 3.15966 0.857117 5.99997V18C0.857117 20.8404 3.15966 23.1428 5.99997 23.1428H18C20.8404 23.1428 23.1428 20.8404 23.1428 18V5.99997C23.1428 3.15966 20.8404 0.857117 18 0.857117Z\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_834_118930\">\n<rect width=\"24\" height=\"24\" fill=\"white\"/>\n</clipPath>\n</defs>\n</svg>\n","<svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"#F5F6F9\"/>\n<path d=\"M26 27V25C26 22.7909 24.2091 21 22 21H14C11.7909 21 10 22.7909 10 25V27\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M18 17C20.2091 17 22 15.2091 22 13C22 10.7909 20.2091 9 18 9C15.7909 9 14 10.7909 14 13C14 15.2091 15.7909 17 18 17Z\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<defs>\n<linearGradient id=\"paint0_linear_67_8545\" x1=\"35.0204\" y1=\"1.22449\" x2=\"0\" y2=\"36\" gradientUnits=\"userSpaceOnUse\">\n<stop stop-color=\"#56ACF6\"/>\n<stop offset=\"1\" stop-color=\"#1559E6\"/>\n</linearGradient>\n</defs>\n</svg>\n","<svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"#F5F6F9\"/>\n<path d=\"M27 18.22C27 12.73 22.74 9 18 9C13.31 9 9 12.65 9 18.28C8.4 18.62 8 19.26 8 20V22C8 23.1 8.9 24 10 24H11V17.9C11 14.03 14.13 10.9 18 10.9C21.87 10.9 25 14.03 25 17.9V25H17V27H25C26.1 27 27 26.1 27 25V23.78C27.59 23.47 28 22.86 28 22.14V19.84C28 19.14 27.59 18.53 27 18.22Z\" fill=\"#7586B0\"/>\n<path d=\"M15 20C15.5523 20 16 19.5523 16 19C16 18.4477 15.5523 18 15 18C14.4477 18 14 18.4477 14 19C14 19.5523 14.4477 20 15 20Z\" fill=\"#7586B0\"/>\n<path d=\"M21 20C21.5523 20 22 19.5523 22 19C22 18.4477 21.5523 18 21 18C20.4477 18 20 18.4477 20 19C20 19.5523 20.4477 20 21 20Z\" fill=\"#7586B0\"/>\n<path d=\"M24 17.03C23.52 14.18 21.04 12 18.05 12C15.02 12 11.76 14.51 12.02 18.45C14.49 17.44 16.35 15.24 16.88 12.56C18.19 15.19 20.88 17 24 17.03Z\" fill=\"#7586B0\"/>\n<defs>\n<linearGradient id=\"paint0_linear_267_19310\" x1=\"35.0204\" y1=\"1.22449\" x2=\"0\" y2=\"36\" gradientUnits=\"userSpaceOnUse\">\n<stop stop-color=\"#56ACF6\"/>\n<stop offset=\"1\" stop-color=\"#1559E6\"/>\n</linearGradient>\n</defs>\n</svg>\n","<svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"#F5F6F9\"/>\n<path d=\"M26 10H10C8.89 10 8.01 10.89 8.01 12L8 24C8 25.11 8.89 26 10 26H26C27.11 26 28 25.11 28 24V12C28 10.89 27.11 10 26 10ZM26 24H10V18H26V24ZM26 14H10V12H26V14Z\" fill=\"#7586B0\"/>\n<defs>\n<linearGradient id=\"paint0_linear_67_8556\" x1=\"35.0204\" y1=\"1.22449\" x2=\"0\" y2=\"36\" gradientUnits=\"userSpaceOnUse\">\n<stop stop-color=\"#56ACF6\"/>\n<stop offset=\"1\" stop-color=\"#1559E6\"/>\n</linearGradient>\n</defs>\n</svg>\n","<svg width=\"21\" height=\"20\" viewBox=\"0 0 21 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_834_120339)\">\n<path d=\"M10.3336 19.2858C15.462 19.2858 19.6193 15.1285 19.6193 10.0001C19.6193 4.87171 15.462 0.714355 10.3336 0.714355C5.20521 0.714355 1.04785 4.87171 1.04785 10.0001C1.04785 15.1285 5.20521 19.2858 10.3336 19.2858Z\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12.7649 7.46052C12.6813 7.22393 12.5523 7.0088 12.3883 6.8256C12.0395 6.43592 11.5327 6.19067 10.9685 6.19067H9.4942C8.55517 6.19067 7.79395 6.9519 7.79395 7.89093C7.79395 8.68995 8.3503 9.38116 9.13086 9.5519L11.3756 10.0429C12.25 10.2342 12.8733 11.0091 12.8733 11.9043C12.8733 12.9562 12.0205 13.8097 10.9685 13.8097H9.6987C8.86936 13.8097 8.16382 13.2797 7.90233 12.5399\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M10.3335 6.19065V4.28589\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M10.3335 15.7144V13.8096\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_834_120339\">\n<rect width=\"20\" height=\"20\" fill=\"white\" transform=\"translate(0.333496)\"/>\n</clipPath>\n</defs>\n</svg>\n","<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M6.95392 1.03353C7.1196 1.56038 6.82682 2.12178 6.29997 2.28746C5.79034 2.44773 5.30237 2.68036 4.85175 2.98146C3.76168 3.70982 2.95789 4.79361 2.57732 6.04817C2.19675 7.30273 2.26296 8.65044 2.76466 9.86166C3.26637 11.0729 4.17252 12.0727 5.32873 12.6907C6.48494 13.3087 7.81967 13.5067 9.10549 13.2509C10.3913 12.9951 11.5487 12.3014 12.3804 11.288C13.2121 10.2746 13.6666 9.00413 13.6666 7.69312C13.6666 7.14083 14.1144 6.69312 14.6666 6.69312C15.2189 6.69312 15.6666 7.14083 15.6666 7.69312C15.6666 7.92228 15.6564 8.15052 15.6361 8.37721C15.6465 8.44937 15.6492 8.52379 15.6432 8.59952L15.6392 8.64883C15.6298 8.75932 15.6028 8.86407 15.5612 8.96057C15.3409 10.2743 14.7807 11.5158 13.9264 12.5568C12.8012 13.9279 11.2353 14.8664 9.49568 15.2125C7.75603 15.5585 5.95022 15.2906 4.38594 14.4545C2.82166 13.6184 1.59568 12.2657 0.916905 10.627C0.238131 8.98832 0.148554 7.16495 0.663439 5.4676C1.17832 3.77025 2.26581 2.30394 3.74061 1.31852C4.35023 0.911179 5.01049 0.596408 5.69999 0.379577C6.22684 0.213898 6.78824 0.506683 6.95392 1.03353ZM7.56761 1.27284C7.61434 0.722538 8.09832 0.314306 8.64863 0.361031L8.69791 0.365373C9.24791 0.415584 9.65307 0.902149 9.60286 1.45215C9.55265 2.00214 9.06608 2.4073 8.51608 2.35709L8.47942 2.35386C7.92912 2.30714 7.52089 1.82315 7.56761 1.27284ZM12.4186 2.90891C12.8384 2.55014 13.4697 2.59967 13.8284 3.01954C13.8498 3.04454 13.871 3.06967 13.892 3.09494C14.2454 3.51937 14.1878 4.14991 13.7634 4.50329C13.339 4.85667 12.7084 4.79906 12.355 4.37463C12.3395 4.35592 12.3238 4.33731 12.3079 4.31879C11.9492 3.89892 11.9987 3.26769 12.4186 2.90891ZM8.99998 5.33352C8.99998 4.78124 8.55226 4.33352 7.99998 4.33352C7.44769 4.33352 6.99998 4.78124 6.99998 5.33352V8.00019C6.99998 8.55247 7.44769 9.00019 7.99998 9.00019H10.6666C11.2189 9.00019 11.6666 8.55247 11.6666 8.00019C11.6666 7.4479 11.2189 7.00019 10.6666 7.00019H8.99998V5.33352Z\" fill=\"#7586B0\"/>\n</svg>\n","import { Theme } from '@emotion/react';\n\nexport type IconColor = 'primary' | 'secondary';\n\nexport const getIconColor = (color: IconColor | string | undefined, theme: Theme) => {\n switch (color) {\n case 'primary':\n return theme.stigg.palette.text.primary;\n case 'secondary':\n return theme.stigg.palette.text.secondary;\n default:\n return color;\n }\n};\n","<svg width=\"24\" height=\"25\" viewBox=\"0 0 24 25\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_834_116282)\">\n<path d=\"M21.4286 5.32483H2.57146C1.62469 5.32483 0.857178 6.09235 0.857178 7.03911V10.4677C0.857178 11.4145 1.62469 12.182 2.57146 12.182H21.4286C22.3754 12.182 23.1429 11.4145 23.1429 10.4677V7.03911C23.1429 6.09235 22.3754 5.32483 21.4286 5.32483Z\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M21.4287 12.182V21.6106C21.4287 22.0652 21.248 22.5013 20.9266 22.8227C20.6051 23.1442 20.169 23.3249 19.7144 23.3249H4.28582C3.83116 23.3249 3.39513 23.1442 3.07363 22.8227C2.75215 22.5013 2.57153 22.0652 2.57153 21.6106V12.182\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 5.32483V23.3248\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M17.1429 1.03912L12 5.32484L6.85718 1.03912\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_834_116282\">\n<rect width=\"24\" height=\"24\" fill=\"white\" transform=\"translate(0 0.182007)\"/>\n</clipPath>\n</defs>\n</svg>\n","<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M10.8333 2.5C6.69168 2.5 3.33334 5.85833 3.33334 10H0.833344L4.07501 13.2417L4.13334 13.3583L7.50001 10H5.00001C5.00001 6.775 7.60834 4.16667 10.8333 4.16667C14.0583 4.16667 16.6667 6.775 16.6667 10C16.6667 13.225 14.0583 15.8333 10.8333 15.8333C9.22501 15.8333 7.76668 15.175 6.71668 14.1167L5.53334 15.3C6.89168 16.6583 8.75834 17.5 10.8333 17.5C14.975 17.5 18.3333 14.1417 18.3333 10C18.3333 5.85833 14.975 2.5 10.8333 2.5ZM10 6.66667V10.8333L13.5667 12.95L14.1667 11.9417L11.25 10.2083V6.66667H10Z\" fill=\"#6678A7\"/>\n</svg>\n","<svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"url(#paint0_linear_834_118583)\"/>\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"#F5F6F9\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15.9539 7.70028C16.1196 8.22713 15.8268 8.78853 15.3 8.95421C14.4906 9.20875 13.7155 9.57824 12.9999 10.0564C11.2686 11.2132 9.99197 12.9346 9.38754 14.9271C8.78311 16.9196 8.88826 19.0601 9.68509 20.9838C10.4819 22.9075 11.9211 24.4954 13.7574 25.477C15.5938 26.4585 17.7136 26.7729 19.7558 26.3667C21.798 25.9605 23.6362 24.8588 24.9571 23.2492C26.278 21.6396 27 19.6219 27 17.5397C27 16.9874 27.4477 16.5397 28 16.5397C28.5523 16.5397 29 16.9874 29 17.5397C29 17.8969 28.9826 18.2526 28.9483 18.6056C28.9662 18.6949 28.9722 18.7883 28.9645 18.8837L28.9606 18.9309C28.9496 19.0607 28.9143 19.1825 28.8595 19.2924C28.5513 21.2017 27.7432 23.007 26.5031 24.518C24.8886 26.4852 22.642 27.8318 20.146 28.3283C17.65 28.8248 15.059 28.4405 12.8146 27.2408C10.5702 26.0411 8.81122 24.1004 7.83733 21.7492C6.86343 19.398 6.73491 16.7819 7.47366 14.3465C8.21241 11.9112 9.77272 9.80737 11.8887 8.3935C12.7634 7.80905 13.7107 7.35743 14.7 7.04633C15.2269 6.88065 15.7883 7.17343 15.9539 7.70028ZM17.8497 7.95155C17.8964 7.40125 18.3804 6.99302 18.9307 7.03974L18.9779 7.04385C19.528 7.0929 19.9342 7.57861 19.8851 8.12871C19.8361 8.67881 19.3503 9.085 18.8002 9.03595L18.7615 9.03257C18.2112 8.98585 17.8029 8.50186 17.8497 7.95155ZM22.8579 9.19953C23.172 8.74525 23.7949 8.63161 24.2492 8.9457C24.2751 8.96361 24.3009 8.98162 24.3266 8.99974C24.7782 9.31772 24.8865 9.94155 24.5685 10.3931C24.2505 10.8447 23.6267 10.953 23.1751 10.635C23.1541 10.6202 23.1329 10.6054 23.1118 10.5908C22.6575 10.2767 22.5438 9.6538 22.8579 9.19953ZM26.6058 12.8085C27.1045 12.5712 27.7011 12.7831 27.9384 13.2818C27.9519 13.3102 27.9653 13.3387 27.9786 13.3672C28.2116 13.868 27.9946 14.4628 27.4939 14.6958C26.9931 14.9288 26.3983 14.7117 26.1653 14.211L26.1506 14.1796L26.1324 14.1411C25.8951 13.6424 26.1071 13.0458 26.6058 12.8085ZM19 14.0003C19 13.448 18.5523 13.0003 18 13.0003C17.4477 13.0003 17 13.448 17 14.0003V18.0003C17 18.5526 17.4477 19.0003 18 19.0003H22C22.5523 19.0003 23 18.5526 23 18.0003C23 17.448 22.5523 17.0003 22 17.0003H19V14.0003Z\" fill=\"#7586B0\"/>\n<defs>\n<linearGradient id=\"paint0_linear_834_118583\" x1=\"35.0204\" y1=\"1.22449\" x2=\"0\" y2=\"36\" gradientUnits=\"userSpaceOnUse\">\n</linearGradient>\n</defs>\n</svg>\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9.95394 1.70028C10.1196 2.22713 9.82684 2.78853 9.29999 2.95421C8.49057 3.20875 7.71555 3.57824 6.99987 4.05644C5.26859 5.21324 3.99197 6.93456 3.38754 8.9271C2.78311 10.9196 2.88826 13.0601 3.68509 14.9838C4.48191 16.9075 5.9211 18.4954 7.75743 19.477C9.59377 20.4585 11.7136 20.7729 13.7558 20.3667C15.798 19.9605 17.6362 18.8588 18.9571 17.2492C20.278 15.6396 21 13.6219 21 11.5397C21 10.9874 21.4477 10.5397 22 10.5397C22.5523 10.5397 23 10.9874 23 11.5397C23 11.8969 22.9826 12.2526 22.9483 12.6056C22.9662 12.6949 22.9722 12.7883 22.9645 12.8837L22.9606 12.9309C22.9496 13.0607 22.9143 13.1825 22.8595 13.2924C22.5513 15.2017 21.7432 17.007 20.5031 18.518C18.8886 20.4852 16.642 21.8318 14.146 22.3283C11.65 22.8248 9.05905 22.4405 6.81464 21.2408C4.57023 20.0411 2.81122 18.1004 1.83733 15.7492C0.863434 13.398 0.734911 10.7819 1.47366 8.34653C2.21241 5.91121 3.77272 3.80737 5.88873 2.3935C6.76341 1.80905 7.71072 1.35743 8.70001 1.04633C9.22686 0.880646 9.78826 1.17343 9.95394 1.70028ZM11.8497 1.95155C11.8964 1.40125 12.3804 0.993017 12.9307 1.03974L12.9779 1.04385C13.528 1.0929 13.9342 1.57861 13.8851 2.12871C13.8361 2.67881 13.3503 3.085 12.8002 3.03595L12.7615 3.03257C12.2112 2.98585 11.8029 2.50186 11.8497 1.95155ZM16.8579 3.19953C17.172 2.74525 17.7949 2.63161 18.2492 2.9457C18.2751 2.96361 18.3009 2.98162 18.3266 2.99974C18.7782 3.31772 18.8865 3.94155 18.5685 4.39311C18.2505 4.84467 17.6267 4.95296 17.1751 4.63498C17.1541 4.62016 17.1329 4.60542 17.1118 4.59078C16.6575 4.27669 16.5438 3.6538 16.8579 3.19953ZM20.6058 6.80846C21.1045 6.57117 21.7011 6.78308 21.9384 7.28179C21.9519 7.3102 21.9653 7.33869 21.9786 7.36723C22.2116 7.86796 21.9946 8.46276 21.4939 8.69577C20.9931 8.92877 20.3983 8.71174 20.1653 8.21101L20.1506 8.17957L20.1324 8.14112C19.8951 7.64241 20.1071 7.04576 20.6058 6.80846ZM13 8.00027C13 7.44798 12.5523 7.00027 12 7.00027C11.4477 7.00027 11 7.44798 11 8.00027V12.0003C11 12.5526 11.4477 13.0003 12 13.0003H16C16.5523 13.0003 17 12.5526 17 12.0003C17 11.448 16.5523 11.0003 16 11.0003H13V8.00027Z\" fill=\"#7586B0\"/>\n</svg>\n","<svg width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n\n<rect width=\"36\" height=\"36\" rx=\"10\" fill=\"#F5F6F9\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 12C9 10.8954 9.89543 10 11 10H25C26.1046 10 27 10.8954 27 12V26C27 27.1046 26.1046 28 25 28H11C9.89543 28 9 27.1046 9 26V12Z\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M22 8V12\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M14 8V12\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M9 16H27\" stroke=\"#7586B0\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<defs>\n<linearGradient id=\"paint0_linear_45_8861\" x1=\"35.0204\" y1=\"1.22449\" x2=\"0\" y2=\"36\" gradientUnits=\"userSpaceOnUse\">\n<stop stop-color=\"#56ACF6\"/>\n<stop offset=\"1\" stop-color=\"#1559E6\"/>\n</linearGradient>\n</defs>\n</svg>\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"trash-2\">\n<path id=\"Shape\" d=\"M3 6H5H21\" stroke=\"#F88078\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path id=\"Shape_2\" d=\"M20 6C20 5.44772 19.5523 5 19 5C18.4477 5 18 5.44772 18 6H20ZM6 6C6 5.44772 5.55228 5 5 5C4.44772 5 4 5.44772 4 6H6ZM7 6C7 6.55228 7.44772 7 8 7C8.55228 7 9 6.55228 9 6H7ZM15 6C15 6.55228 15.4477 7 16 7C16.5523 7 17 6.55228 17 6H15ZM18 6V20H20V6H18ZM18 20C18 20.5523 17.5523 21 17 21V23C18.6569 23 20 21.6569 20 20H18ZM17 21H7V23H17V21ZM7 21C6.44772 21 6 20.5523 6 20H4C4 21.6569 5.34315 23 7 23V21ZM6 20V6H4V20H6ZM9 6V4H7V6H9ZM9 4C9 3.44772 9.44772 3 10 3V1C8.34315 1 7 2.34315 7 4H9ZM10 3H14V1H10V3ZM14 3C14.5523 3 15 3.44772 15 4H17C17 2.34315 15.6569 1 14 1V3ZM15 4V6H17V4H15Z\" fill=\"#F88078\"/>\n<path id=\"Shape_3\" d=\"M10 11V17\" stroke=\"#F88078\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path id=\"Shape_4\" d=\"M14 11V17\" stroke=\"#F88078\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M21.1667 4H2.83333C1.82081 4 1 4.89543 1 6V18C1 19.1046 1.82081 20 2.83333 20H21.1667C22.1792 20 23 19.1046 23 18V6C23 4.89543 22.1792 4 21.1667 4Z\" fill=\"#C6C6C7\"/>\n<path opacity=\"0.3\" d=\"M19.75 16.4286H17.5C17.0125 16.4286 16.75 16.2 16.75 15.6667C16.75 15.1334 17.0125 14.9048 17.5 14.9048H19.75C20.2375 14.9048 20.5 15.1334 20.5 15.6667C20.5 16.2 20.2375 16.4286 19.75 16.4286ZM15.25 16.4286H13C12.5125 16.4286 12.25 16.2 12.25 15.6667C12.25 15.1334 12.5125 14.9048 13 14.9048H15.25C15.7375 14.9048 16 15.1334 16 15.6667C16 16.2 15.7375 16.4286 15.25 16.4286ZM10.75 16.4286H8.5C8.0125 16.4286 7.75 16.2 7.75 15.6667C7.75 15.1334 8.0125 14.9048 8.5 14.9048H10.75C11.2375 14.9048 11.5 15.1334 11.5 15.6667C11.5 16.2 11.2375 16.4286 10.75 16.4286ZM6.25 16.4286H4C3.5125 16.4286 3.25 16.2 3.25 15.6667C3.25 15.1334 3.5125 14.9048 4 14.9048H6.25C6.7375 14.9048 7 15.1334 7 15.6667C7 16.2 6.7375 16.4286 6.25 16.4286Z\" fill=\"black\"/>\n</svg>\n","<svg width=\"21\" height=\"20\" viewBox=\"0 0 21 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<circle cx=\"10.333\" cy=\"10\" r=\"9\" fill=\"white\" stroke=\"#327EEE\" stroke-width=\"2\"/>\n</svg>\n","<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"Group 16159\">\n<circle id=\"Ellipse 5\" cx=\"10\" cy=\"10\" r=\"9.25\" fill=\"#327EEE\" stroke=\"#327EEE\" stroke-width=\"1.5\"/>\n<path id=\"Shape\" d=\"M5 10.3636L8.63667 14L12.637 10L14.6372 8\" stroke=\"white\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","<svg width=\"21\" height=\"20\" viewBox=\"0 0 21 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"Stepper indicators\">\n<circle id=\"Ellipse 5\" cx=\"10.667\" cy=\"10\" r=\"9.25\" fill=\"#B3BCD3\" stroke=\"#B3BCD3\" stroke-width=\"1.5\"/>\n<path id=\"Shape\" d=\"M5.66699 10.3636L9.30366 14L13.304 10L15.3042 8\" stroke=\"white\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","<svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M9 3L7.9425 4.0575L12.1275 8.25H3V9.75H12.1275L7.9425 13.9425L9 15L15 9L9 3Z\" fill=\"white\"/>\n</svg>\n","<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M15.8337 5.34199L14.6587 4.16699L10.0003 8.82533L5.34199 4.16699L4.16699 5.34199L8.82533 10.0003L4.16699 14.6587L5.34199 15.8337L10.0003 11.1753L14.6587 15.8337L15.8337 14.6587L11.1753 10.0003L15.8337 5.34199Z\" fill=\"#327EEE\"/>\n</svg>\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"check\">\n<path id=\"Shape\" d=\"M20 7L9 18L4 13\" stroke=\"#F5F6F9\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>","<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_1889_12169)\">\n<path d=\"M11.4286 7.42578L8 13.1401\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M14.857 13.1412C15.3274 12.0123 15.5118 10.7848 15.3938 9.56751C15.2758 8.35027 14.8592 7.18097 14.1808 6.16341C13.5024 5.14585 12.5833 4.31152 11.5051 3.73446C10.4268 3.1574 9.22281 2.85547 7.99986 2.85547C6.77691 2.85547 5.57288 3.1574 4.49463 3.73446C3.41639 4.31152 2.49729 5.14585 1.81892 6.16341C1.14055 7.18097 0.723889 8.35027 0.605928 9.56751C0.487968 10.7848 0.672354 12.0123 1.14272 13.1412H14.857Z\" stroke=\"#7586B0\" stroke-width=\"1.71429\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_1889_12169\">\n<rect width=\"16\" height=\"16\" fill=\"white\"/>\n</clipPath>\n</defs>\n</svg>\n","<svg width=\"16\" height=\"16\" viewBox=\"0 0 18 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"tag--tags-bookmark-favorite\">\n<path id=\"Vector\" d=\"M1.26995 11.9426L6.05743 16.7301C6.2305 16.903 6.4651 17.0001 6.7097 17.0001C6.95431 17.0001 7.18891 16.903 7.36198 16.7301L16.8631 7.22895C16.9108 7.18332 16.9478 7.12758 16.9712 7.06583C16.9946 7.00408 17.0039 6.93787 16.9985 6.87205L16.2724 2.15839C16.2664 2.04607 16.2192 1.93992 16.1396 1.86038C16.0601 1.78085 15.9539 1.73357 15.8416 1.72764L11.128 1.00152C11.0622 0.996055 10.9959 1.00538 10.9342 1.0288C10.8724 1.05222 10.8167 1.08916 10.7711 1.1369L1.26995 10.638C1.09709 10.8111 1 11.0457 1 11.2903C1 11.5349 1.09709 11.7695 1.26995 11.9426Z\" stroke=\"#327EEE\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path id=\"Vector_2\" d=\"M12.5548 6.05884C12.3916 6.05884 12.2351 5.99401 12.1197 5.87861C12.0043 5.76321 11.9395 5.60669 11.9395 5.44348C11.9395 5.28028 12.0043 5.12376 12.1197 5.00836C12.2351 4.89296 12.3916 4.82812 12.5548 4.82812C12.718 4.82812 12.8745 4.89296 12.9899 5.00836C13.1053 5.12376 13.1702 5.28028 13.1702 5.44348C13.1702 5.60669 13.1053 5.76321 12.9899 5.87861C12.8745 5.99401 12.718 6.05884 12.5548 6.05884Z\" stroke=\"#327EEE\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 3V21.0001M3 11.9446H21\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M3 12H21\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>","<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M3 11.1429L9.71572 17.8586C9.79383 17.9367 9.92046 17.9367 9.99856 17.8586L21.8571 6\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/>\n</svg> ","import styled from '@emotion/styled/macro';\nimport React, { CSSProperties } from 'react';\nimport { css, useTheme } from '@emotion/react';\nimport { getIconColor, IconColor } from './iconColor';\nimport * as customIcons from './customIcons';\n\nexport type Icons = keyof typeof customIcons;\n\nconst IconWrapper = styled.div<{ $pathColor?: string; $rectColor?: string; $strokeColor?: string }>`\n ${({ $pathColor }) =>\n $pathColor &&\n css`\n path {\n fill: ${$pathColor};\n }\n `}\n\n ${({ $rectColor }) =>\n $rectColor &&\n css`\n svg rect {\n fill: ${$rectColor};\n }\n `}\n\n\n ${({ $strokeColor }) =>\n $strokeColor &&\n css`\n g {\n stroke: ${$strokeColor};\n }\n `}\n`;\n\nexport type IconProps = {\n icon: Icons;\n className?: string;\n style?: CSSProperties;\n svgPathColor?: IconColor | string;\n svgRectColor?: IconColor | string;\n svgStrokeColor?: IconColor | string;\n};\n\nexport function Icon({ icon, className, style, svgPathColor, svgRectColor, svgStrokeColor }: IconProps) {\n const IconComponent = (customIcons as any)[icon];\n const theme = useTheme();\n\n return (\n <IconWrapper\n className={className}\n style={style}\n $pathColor={getIconColor(svgPathColor, theme)}\n $rectColor={getIconColor(svgRectColor, theme)}\n $strokeColor={getIconColor(svgStrokeColor, theme)}>\n <IconComponent />\n </IconWrapper>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { EntitlementResetPeriod } from '@stigg/js-client-sdk';\nimport { calculateUnitQuantityText } from './utils/calculateUnitQuantityText';\nimport { formatNumber } from '../utils/formatNumber';\nimport { Typography } from '../common/Typography';\nimport { Icon } from '../common/Icon';\n\nconst EntitlementName = styled(Typography)`\n margin: 0;\n`;\n\nconst EntitlementRowContainer = styled.div`\n display: flex;\n align-items: center;\n gap: 16px;\n`;\n\nconst EntitlementIconContainer = styled.div`\n display: flex;\n align-items: center;\n flex-shrink: 0;\n`;\n\nconst EntitlementIcon = styled(Icon)`\n width: 24px;\n height: 24px;\n color: ${({ theme }) => theme.stigg.palette.primary};\n`;\n\ntype EntitlementRowProps = {\n hasUnlimitedUsage?: boolean | null;\n isCustom?: boolean | null;\n usageLimit?: number | null;\n minUnitQuantity?: number | null;\n maxUnitQuantity?: number | null;\n resetPeriod?: EntitlementResetPeriod | null;\n displayNameOverride?: string | null;\n enumValues?: string[] | null;\n feature?: {\n id: string;\n units?: string | null | undefined;\n unitsPlural?: string | null | undefined;\n unitQuantity?: number | null;\n displayName: string;\n } | null;\n};\n\nfunction getResetPeriodText(resetPeriod?: EntitlementResetPeriod) {\n if (!resetPeriod) {\n return '';\n }\n\n switch (resetPeriod) {\n case EntitlementResetPeriod.Day: {\n return 'per day';\n }\n case EntitlementResetPeriod.Hour: {\n return 'per hour';\n }\n case EntitlementResetPeriod.Week: {\n return 'per week';\n }\n case EntitlementResetPeriod.Month: {\n return 'per month';\n }\n case EntitlementResetPeriod.Year: {\n return 'per year';\n }\n default: {\n return '';\n }\n }\n}\n\nfunction getEntitlementDisplay({\n hasUnlimitedUsage,\n feature,\n resetPeriod,\n usageLimit,\n minUnitQuantity,\n maxUnitQuantity,\n isCustom,\n enumValues,\n}: EntitlementRowProps) {\n const unitBasedEntitlement = minUnitQuantity || maxUnitQuantity;\n const resetPeriodSuffix = `${resetPeriod && usageLimit ? `${getResetPeriodText(resetPeriod)}` : ''}`;\n\n if (enumValues) {\n const featureUnits = enumValues.length === 1 ? feature?.units : feature?.unitsPlural;\n return `${enumValues.length} ${featureUnits}`;\n }\n\n if (hasUnlimitedUsage) {\n return `Unlimited ${feature?.unitsPlural}`;\n }\n\n if (isCustom) {\n return `Custom ${feature?.unitsPlural}`;\n }\n\n if (usageLimit) {\n const featureUnits = usageLimit === 1 ? feature?.units : feature?.unitsPlural;\n return `${formatNumber(usageLimit)} ${featureUnits} ${resetPeriodSuffix}`;\n }\n\n if (unitBasedEntitlement) {\n return calculateUnitQuantityText(minUnitQuantity, maxUnitQuantity, feature?.unitsPlural);\n }\n\n return feature?.displayName;\n}\n\nexport function EntitlementRow(props: EntitlementRowProps) {\n const { displayNameOverride, ...restProps } = props;\n const displayName = getEntitlementDisplay(restProps);\n\n return (\n <EntitlementRowContainer className={`stigg-entitlement-row-container stigg-entitlement-${restProps.feature?.id}`}>\n <EntitlementIconContainer>\n <EntitlementIcon icon=\"EntitlementCheck\" className=\"stigg-entitlement-row-icon\" />\n </EntitlementIconContainer>\n <EntitlementName className=\"stigg-entitlement-name\" variant=\"h6\" color=\"secondary\">\n {displayNameOverride || displayName}\n </EntitlementName>\n </EntitlementRowContainer>\n );\n}\n","import {\n BillingPeriod,\n Customer,\n Plan,\n Subscription,\n CustomerPortalSubscriptionScheduledUpdateDataFragment,\n PaywallCurrency,\n PaywallCalculatedPricePoint,\n BillableFeature,\n} from '@stigg/js-client-sdk';\nimport { CustomizedTheme } from '../../theme/Theme';\n\nexport type PaywallData = {\n plans: PaywallPlan[] | null;\n customer: Customer | null;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n isCustomerOnTrial: boolean;\n isLoading: boolean;\n selectedBillingPeriod: BillingPeriod;\n setSelectedBillingPeriod: (billingPeriod: BillingPeriod) => void;\n availableBillingPeriods: BillingPeriod[];\n locale: string;\n configuration?: CustomizedTheme;\n};\n\nexport type CurrentSubscriptionOverride = {\n planId: string;\n billableFeatures: BillableFeature[];\n};\n\nexport enum SubscribeIntentionType {\n START_TRIAL = 'START_TRIAL',\n UPGRADE_TRIAL_TO_PAID = 'UPGRADE_TRIAL_TO_PAID',\n REQUEST_CUSTOM_PLAN_ACCESS = 'REQUEST_CUSTOM_PLAN_ACCESS',\n CHANGE_BILLING_PERIOD = 'CHANGE_BILLING_PERIOD',\n CHANGE_UNIT_QUANTITY = 'CHANGE_UNIT_QUANTITY',\n UPGRADE_PLAN = 'UPGRADE_PLAN',\n DOWNGRADE_PLAN = 'DOWNGRADE_PLAN',\n CANCEL_SCHEDULED_UPDATES = 'CANCEL_SCHEDULED_UPDATES',\n}\n\nexport type PaywallPlan = Plan & {\n isLowerThanCurrentPlan?: boolean;\n isTriable: boolean;\n isCurrentCustomerPlan: boolean;\n currentCustomerPlanBillingPeriod?: BillingPeriod;\n trialDaysLeft?: number;\n isNextPlan?: (billingPeriod: BillingPeriod) => boolean;\n scheduledUpdate?: CustomerPortalSubscriptionScheduledUpdateDataFragment;\n paywallCurrency?: PaywallCurrency;\n paywallCalculatedPricePoints?: PaywallCalculatedPricePoint[];\n};\n\nexport type OnPlanSelectedCallbackFn = ({\n plan,\n customer,\n subscription,\n intentionType,\n selectedBillingPeriod,\n billableFeatures,\n}: {\n plan: Plan;\n customer: Customer | null;\n subscription: Subscription | null;\n intentionType: SubscribeIntentionType;\n selectedBillingPeriod: BillingPeriod;\n billableFeatures?: BillableFeature[];\n}) => void | Promise<void>;\n\nexport type ShouldHidePlanFn = ({ plan }: { plan: PaywallPlan }) => boolean | Promise<boolean>;\n\nexport type CurrentSubscriptionOverrideFn = ({\n currentSubscription,\n}: {\n currentSubscription: Subscription | null;\n}) => CurrentSubscriptionOverride | null | undefined;\n\nexport type SelectDefaultTierIndexFn = ({ plan }: { plan: PaywallPlan }) => number;\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { BillingPeriod, WidgetType } from '@stigg/js-client-sdk';\nimport { EntitlementRow } from './EntitlementRow';\nimport { PaywallPlan } from './types';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { Typography } from '../common/Typography';\n\nconst PlanEntitlementsContainer = styled.div`\n display: flex;\n flex-direction: column;\n gap: 16px;\n`;\n\nfunction getTitle(plan: PaywallPlan, paywallLocale: PaywallLocalization, hasFeatures: boolean) {\n if (paywallLocale.entitlementsTitle) {\n return paywallLocale.entitlementsTitle(plan);\n }\n let title = hasFeatures ? `Includes:` : '';\n if (plan.basePlan) {\n title = `Everything in ${plan.basePlan.displayName}${hasFeatures ? ', plus:' : ''}`;\n }\n\n return title;\n}\n\nexport function PlanEntitlements({\n plan,\n billingPeriod,\n paywallLocale,\n}: {\n plan: PaywallPlan;\n billingPeriod: BillingPeriod;\n paywallLocale: PaywallLocalization;\n}) {\n const prices = plan.pricePoints?.filter((price) => price.billingPeriod === billingPeriod) || [];\n const unitBasedEntitlements = prices\n .filter((price) => (price?.minUnitQuantity && price?.minUnitQuantity > 1) || price?.maxUnitQuantity)\n .map((price) => {\n return (\n <EntitlementRow\n key={`priceUnitEntitlement-${price?.feature?.displayName}`}\n feature={price?.feature ? { ...price.feature, id: price.feature.featureId } : null}\n minUnitQuantity={price?.minUnitQuantity}\n maxUnitQuantity={price?.maxUnitQuantity}\n />\n );\n });\n\n const visibleEntitlements = plan.entitlements\n .filter(({ isGranted }) => isGranted)\n .filter((entitlement) => !(entitlement.hiddenFromWidgets || []).includes(WidgetType.Paywall));\n\n const hasFeatures = unitBasedEntitlements.length > 0 || visibleEntitlements.length > 0;\n\n return (\n <PlanEntitlementsContainer className=\"stigg-plan-entitlements-container\">\n <Typography className=\"stigg-plan-entitlements-title\" color=\"secondary\" variant=\"h6\" bold>\n {getTitle(plan, paywallLocale, hasFeatures)}\n </Typography>\n {unitBasedEntitlements}\n {visibleEntitlements.map((entitlement) => (\n <EntitlementRow\n key={entitlement.feature?.id}\n displayNameOverride={entitlement.displayNameOverride}\n feature={entitlement.feature}\n resetPeriod={entitlement.resetPeriod}\n hasUnlimitedUsage={entitlement.hasUnlimitedUsage}\n usageLimit={entitlement.usageLimit}\n enumValues={entitlement.enumValues}\n isCustom={entitlement.isCustom}\n />\n ))}\n </PlanEntitlementsContainer>\n );\n}\n","import Color from 'color';\nimport merge from 'lodash/merge';\nimport { HorizontalAlignment, StiggTheme } from './types';\nimport { CustomizedTheme } from './Theme';\n\nexport const flexLayoutMapper = (horizontalAlignment: HorizontalAlignment) => {\n return {\n left: 'flex-start',\n center: 'center',\n right: 'flex-end',\n }[horizontalAlignment];\n};\n\nexport const getResolvedTheme = (customizedTheme?: CustomizedTheme): StiggTheme => {\n const primaryColor = Color(customizedTheme?.palette?.primary || '#327EEE');\n const textColor = Color(customizedTheme?.palette?.text?.primary || '#001E6C');\n const successColor = Color('#4CAF50');\n const errorColor = Color('#f44336');\n\n const baseTheme: StiggTheme = {\n palette: {\n primary: primaryColor.hex(),\n primaryDark: primaryColor.darken(0.3).hex(),\n primaryLight: primaryColor.alpha(0.5).toString(),\n backgroundPaper: '#FFFFFF',\n backgroundHighlight: '#F5F6F9',\n backgroundSection: primaryColor.alpha(0.1).toString(),\n backgroundButton: primaryColor.alpha(0.08).toString(),\n outlinedBorder: '#C4CBDD',\n outlinedRestingBorder: primaryColor.alpha(0.5).toString(),\n outlinedHoverBackground: primaryColor.lightness(95).hex(),\n switchBorder: primaryColor.lighten(0.1).hex(),\n switchFill: primaryColor.lighten(0.5).hex(),\n switchHandle: primaryColor.hex(),\n warning: '#ed6c02',\n error: errorColor.hex(),\n errorDark: errorColor.darken(0.3).hex(),\n success: successColor.hex(),\n successDark: successColor.darken(0.3).hex(),\n white: '#FFFFFF',\n text: {\n primary: textColor.hex(),\n secondary: textColor.alpha(0.75).toString(),\n tertiary: textColor.alpha(0.5).toString(),\n disabled: textColor.alpha(0.35).toString(),\n },\n },\n layout: {\n planMinWidth: '330px',\n planMaxWidth: '330px',\n planMargin: '20px',\n planPadding: '40px',\n ctaAlignment: 'left',\n headerAlignment: 'left',\n descriptionAlignment: 'left',\n descriptionMinHeight: '80px',\n switchBottomSpacing: '40px',\n },\n shadows: {\n light: '0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px rgba(0, 0, 0, 0.14), 0px 1px 3px rgba(0, 0, 0, 0.12)',\n popover:\n '0px 4px 5px -2px rgba(0, 30, 108, 0.2), 0px 7px 10px 1px rgba(0, 30, 108, 0.14), 0px 2px 16px 1px rgba(0, 30, 108, 0.12)',\n },\n border: {\n radius: '10px',\n },\n typography: {\n fontFamily: 'custom-font, DM Sans, sans-serif',\n h1: {\n fontSize: '32px',\n fontWeight: 'bold',\n },\n h2: {\n fontSize: '24px',\n fontWeight: 'normal',\n },\n h3: {\n fontSize: '16px',\n fontWeight: 'normal',\n },\n body: {\n fontSize: '14px',\n fontWeight: 'normal',\n },\n caption: {\n fontSize: '12px',\n fontWeight: 'normal',\n },\n },\n customCss: '',\n };\n\n return merge(baseTheme, customizedTheme);\n};\n","import { BillingModel, TiersMode, BillingPeriod, Price, PriceTierFragment, Subscription } from '@stigg/js-client-sdk';\nimport isNil from 'lodash/isNil';\nimport { sum } from 'lodash';\nimport { PaywallPlan } from '../paywall';\nimport { CurrentSubscriptionOverride, SelectDefaultTierIndexFn } from '../paywall/types';\n\nexport function getPriceFeatureUnit(price: Price) {\n if (!price.feature) {\n return '';\n }\n\n return (price.feature.unitQuantity !== 1 ? price.feature.unitsPlural : price.feature.units) || '';\n}\n\nexport function getTierByQuantity(tiers: PriceTierFragment[], quantity: number): PriceTierFragment {\n const ascendingTiers = [...tiers];\n // Sort tiers by upTo value, ascending, if upTo is not set,\n // put it at the end as it represent the last infinity tier\n ascendingTiers.sort((a, b) => (!a.upTo ? 1 : !b.upTo ? -1 : a.upTo - b.upTo));\n\n for (const tier of ascendingTiers) {\n if (tier.upTo && quantity <= tier.upTo) {\n return tier;\n }\n }\n\n return ascendingTiers[ascendingTiers.length - 1];\n}\n\nfunction getAmount(amount: number, selectedBillingPeriod?: BillingPeriod, shouldShowMonthlyPriceAmount?: boolean) {\n return selectedBillingPeriod === BillingPeriod.Annually && shouldShowMonthlyPriceAmount ? amount / 12 : amount;\n}\n\nfunction calculateTierPriceVolume(\n currentTier: PriceTierFragment,\n perUnitQuantity: number,\n selectedBillingPeriod?: BillingPeriod,\n shouldShowMonthlyPriceAmount?: boolean,\n): number {\n let amount = 0;\n\n if (currentTier.unitPrice) {\n const unitPrice = getAmount(currentTier.unitPrice.amount, selectedBillingPeriod, shouldShowMonthlyPriceAmount);\n amount += unitPrice * perUnitQuantity;\n }\n\n if (currentTier.flatPrice) {\n amount += getAmount(currentTier.flatPrice.amount, selectedBillingPeriod, shouldShowMonthlyPriceAmount);\n }\n\n return amount;\n}\n\nexport function calculateTierPriceGraduated(\n tiers: PriceTierFragment[],\n unitQuantity: number,\n selectedBillingPeriod?: BillingPeriod,\n shouldShowMonthlyPriceAmount?: boolean,\n): { total: number; breakdown: Array<{ unitQuantity: number; amount: number }> } {\n let remainingQuantity = unitQuantity;\n let prevUpTo = 0;\n let currentTierIndex = 0;\n\n const breakdown: Array<{ unitQuantity: number; amount: number }> = [];\n\n while (remainingQuantity > 0 && currentTierIndex < tiers.length) {\n const tier = tiers[currentTierIndex];\n const { upTo } = tier;\n\n if (isNil(upTo)) {\n breakdown.push({\n unitQuantity: remainingQuantity,\n amount: calculateTierPriceVolume(tier, remainingQuantity, selectedBillingPeriod, shouldShowMonthlyPriceAmount),\n });\n remainingQuantity = 0;\n } else {\n const unitsInTier = upTo - prevUpTo;\n const consumed = Math.min(remainingQuantity, unitsInTier);\n breakdown.push({\n unitQuantity: consumed,\n amount: calculateTierPriceVolume(tier, consumed, selectedBillingPeriod, shouldShowMonthlyPriceAmount),\n });\n remainingQuantity -= consumed;\n prevUpTo = upTo;\n }\n\n currentTierIndex += 1;\n }\n\n const total = sum(breakdown.map(({ amount }) => amount));\n\n return {\n breakdown,\n total,\n };\n}\n\nexport function calculateTierPrice(\n price: Pick<Price, 'tiers' | 'tiersMode'>,\n unitQuantity: number,\n selectedBillingPeriod?: BillingPeriod,\n shouldShowMonthlyPriceAmount?: boolean,\n): number {\n if (!price.tiers) {\n return 0;\n }\n\n switch (price.tiersMode) {\n case TiersMode.Volume: {\n const currentTier = getTierByQuantity(price.tiers, unitQuantity);\n return calculateTierPriceVolume(currentTier, unitQuantity, selectedBillingPeriod, shouldShowMonthlyPriceAmount);\n }\n case TiersMode.Graduated: {\n return calculateTierPriceGraduated(price.tiers, unitQuantity, selectedBillingPeriod, shouldShowMonthlyPriceAmount)\n .total;\n }\n default:\n return 0;\n }\n}\n\nexport function hasTierWithUnitPrice(tiers: PriceTierFragment[] | null | undefined) {\n return tiers?.some(({ unitPrice, upTo }) => unitPrice && !isNil(upTo));\n}\n\nexport function isBulkTiers(tiers: PriceTierFragment[] | null | undefined) {\n return tiers?.every(({ unitPrice, upTo }) => !unitPrice || isNil(upTo));\n}\n\nexport function isQuantityInFirstTier(tiers: PriceTierFragment[] | null | undefined, quantity: number) {\n return tiers?.[0].upTo && quantity <= tiers[0].upTo;\n}\n\nexport function getTiersPerUnitQuantities({\n plan,\n billingPeriod,\n currentSubscription,\n currentSubscriptionOverride,\n selectDefaultTierIndex,\n}: {\n plan: PaywallPlan;\n billingPeriod: BillingPeriod;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n selectDefaultTierIndex?: SelectDefaultTierIndexFn;\n}): Record<string, number> {\n const planTierPrices = plan.pricePoints.filter(\n (price) => price.billingPeriod === billingPeriod && price.isTieredPrice,\n );\n\n if (planTierPrices.length === 1) {\n const [price] = planTierPrices;\n const { featureId } = price.feature!;\n const selectedDefaultTierIndex = selectDefaultTierIndex ? selectDefaultTierIndex({ plan }) : 0;\n const currentTier = price.tiers![selectedDefaultTierIndex];\n let quantity = hasTierWithUnitPrice(price.tiers) ? 1 : currentTier.upTo || 1;\n\n if (currentSubscription && currentSubscription.plan.id === plan.id) {\n const tieredPrice = currentSubscription.prices.find(\n (subscriptionPrice) =>\n subscriptionPrice.pricingModel === BillingModel.PerUnit &&\n subscriptionPrice.tiersMode &&\n subscriptionPrice.feature?.featureId === featureId,\n );\n\n if (tieredPrice) {\n quantity = tieredPrice.feature!.unitQuantity || 1;\n }\n }\n\n if (currentSubscriptionOverride?.planId === plan.id) {\n const billableFeature = currentSubscriptionOverride.billableFeatures.find(\n (billableFeature) => billableFeature.featureId === featureId,\n );\n if (billableFeature) {\n quantity = billableFeature.quantity;\n }\n }\n\n const result: Record<string, number> = {};\n result[featureId] = quantity;\n\n return result;\n }\n\n return {};\n}\n\nexport enum PriceTierComparison {\n Lower = -1,\n Equal = 0,\n Higher = 1,\n}\n\nexport function compareSelectedTierToCurrentTier({\n perUnitQuantityByFeature,\n plan,\n currentSubscription,\n currentSubscriptionOverride,\n}: {\n perUnitQuantityByFeature: Record<string, number>;\n plan: PaywallPlan;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n}): PriceTierComparison {\n if (!currentSubscription) {\n return PriceTierComparison.Equal;\n }\n\n let currentTierPrice = currentSubscription.prices.find(\n (price) => price.pricingModel === BillingModel.PerUnit && price.tiersMode,\n );\n\n const isCurrentPlanOverride = plan.id === currentSubscriptionOverride?.planId;\n if (isCurrentPlanOverride) {\n currentTierPrice =\n plan.pricePoints.find((price) => price.pricingModel === BillingModel.PerUnit && price.tiersMode) ??\n currentTierPrice;\n }\n\n if (!currentTierPrice) {\n return PriceTierComparison.Equal;\n }\n\n const { featureId, unitQuantity } = currentTierPrice.feature!;\n let oldQuantity = unitQuantity;\n\n if (isCurrentPlanOverride) {\n const billableFeature = currentSubscriptionOverride?.billableFeatures?.find(\n (billableFeature) => billableFeature.featureId === featureId,\n );\n if (billableFeature) {\n oldQuantity = billableFeature.quantity;\n }\n }\n\n if (isNil(oldQuantity)) {\n return PriceTierComparison.Equal;\n }\n\n const newQuantity = perUnitQuantityByFeature[featureId];\n\n if (newQuantity < oldQuantity) {\n return PriceTierComparison.Lower;\n }\n if (newQuantity > oldQuantity) {\n return PriceTierComparison.Higher;\n }\n return PriceTierComparison.Equal;\n}\n","import React from 'react';\nimport moment from 'moment';\nimport isNil from 'lodash/isNil';\nimport {\n CustomerPortalSubscription,\n CustomerPortalSubscriptionScheduledUpdateDataFragment,\n SubscriptionScheduleType,\n} from '@stigg/js-client-sdk';\nimport { CustomerPortalSubscriptionPriceFragment } from '@stigg/api-client-js/src/generated/sdk';\nimport { compact, map } from 'lodash';\nimport { BillingPeriodChangeVariables, UnitAmountChangeVariables } from '../../types';\n\nconst formatDate = (date: string) => moment.utc(date).format('MMMM Do, yyyy');\n\ntype GetSubscriptionScheduleUpdateTextsProps = {\n scheduledUpdate: CustomerPortalSubscriptionScheduledUpdateDataFragment | undefined;\n subscriptionPrices?: CustomerPortalSubscriptionPriceFragment[];\n billingPeriodRange?: CustomerPortalSubscription['billingPeriodRange'];\n options?: { withDate?: boolean; postfix?: string };\n};\n\nexport function getSubscriptionScheduleUpdateTexts({\n scheduledUpdate,\n subscriptionPrices,\n billingPeriodRange,\n options = {},\n}: GetSubscriptionScheduleUpdateTextsProps) {\n if (!scheduledUpdate) {\n return {};\n }\n const { withDate, postfix = '' } = options;\n\n switch (scheduledUpdate.subscriptionScheduleType) {\n case SubscriptionScheduleType.Downgrade: {\n let shouldShowDate = withDate;\n if (isNil(shouldShowDate) && billingPeriodRange?.end) {\n shouldShowDate = !moment(scheduledUpdate.scheduledExecutionTime).isSame(billingPeriodRange?.end, 'day');\n }\n\n const line1 = (\n <>\n Your subscription will be downgraded to the <b>{scheduledUpdate.targetPackage?.displayName} plan</b>{' '}\n {shouldShowDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime)}</> : postfix}.\n </>\n );\n const line2 = `Until then you still have access to your current plan.`;\n\n return { line1, line2 };\n }\n\n case SubscriptionScheduleType.BillingPeriod: {\n const variables = scheduledUpdate.scheduleVariables as BillingPeriodChangeVariables;\n const line1 = (\n <>\n Your billing cycle will change to <b>{variables.billingPeriod?.toLocaleLowerCase()}</b>{' '}\n {withDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime)}</> : postfix}.\n </>\n );\n\n return { line1 };\n }\n\n case SubscriptionScheduleType.UnitAmount: {\n const variables = scheduledUpdate.scheduleVariables as UnitAmountChangeVariables;\n const feature = compact(map(subscriptionPrices, 'feature')).find(({ id }) => id === variables.featureId);\n const { featureUnits, featureUnitsPlural } = feature || {};\n const unitsText = variables.newUnitAmount === 1 ? featureUnits : featureUnitsPlural;\n\n const line1 = (\n <>\n Your subscription will be updated to <b>{variables.newUnitAmount}</b> {unitsText}{' '}\n {withDate ? <>on {formatDate(scheduledUpdate.scheduledExecutionTime)}</> : postfix}.\n </>\n );\n\n const line2 = `Until then you still have access to your current ${featureUnits} count.`;\n\n return { line1, line2 };\n }\n\n default: {\n return {};\n }\n }\n}\n","import React, { useState } from 'react';\nimport { BillingPeriod, Customer, PricingType, Subscription } from '@stigg/js-client-sdk';\nimport { isFunction } from 'lodash';\nimport ClipLoader from 'react-spinners/ClipLoader';\nimport styled from '@emotion/styled/macro';\nimport { css, useTheme } from '@emotion/react';\nimport { CurrentSubscriptionOverride, PaywallPlan, SubscribeIntentionType } from './types';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { flexLayoutMapper } from '../../theme/getResolvedTheme';\nimport { Typography } from '../common/Typography';\nimport { getSubscriptionScheduleUpdateTexts } from '../utils/getSubscriptionScheduleUpdateTexts';\nimport { compareSelectedTierToCurrentTier, PriceTierComparison } from '../utils/priceTierUtils';\n\nconst LoadingIndicator = styled(ClipLoader)`\n margin-left: 10px;\n`;\n\nconst OfferingButton = styled.button<{ $disabled?: boolean }>`\n cursor: ${({ $disabled }) => ($disabled ? 'default' : 'pointer')};\n padding: 8px 12px;\n background-color: ${({ theme }) => theme.stigg.palette.backgroundButton};\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedRestingBorder}`};\n border-radius: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 42px;\n min-width: 120px;\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n opacity: 0.5;\n `}\n\n &:hover {\n background-color: ${({ theme, $disabled }) =>\n $disabled ? theme.stigg.palette.backgroundButton : theme.stigg.palette.outlinedHoverBackground};\n }\n`;\n\nconst ButtonText = styled(Typography)`\n margin: 0;\n font-size: 15px;\n`;\n\nconst ScheduledUpdateText = styled(Typography)`\n min-height: 87px;\n`;\n\nconst CancelScheduledUpdateButton = styled.button<{ $disabled?: boolean }>`\n background: none;\n border: none;\n padding: 0;\n color: ${({ theme }) => theme.stigg.palette.text.secondary};\n\n text-decoration: underline;\n cursor: pointer;\n`;\n\nconst TrialDaysLeft = styled(Typography)`\n margin-top: 8px;\n margin-bottom: 17px;\n min-height: 20px;\n`;\n\nconst ButtonLayout = styled.div`\n display: flex;\n flex-direction: column;\n margin-top: 4px;\n align-self: ${({ theme }) => flexLayoutMapper(theme.stigg.layout.ctaAlignment)};\n width: 100%;\n`;\n\ntype PlanOfferingButtonProps = {\n isNextPlan?: boolean;\n customer: Customer | null;\n plan: PaywallPlan;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n billingPeriod: BillingPeriod;\n isCustomerOnTrial: boolean;\n paywallLocale: PaywallLocalization;\n onPlanSelected: (intentionType: SubscribeIntentionType) => void | Promise<void>;\n withTrialLeftRow: boolean;\n perUnitQuantityByFeature: Record<string, number>;\n};\n\nexport function PlanOfferingButton({\n isNextPlan,\n customer,\n plan,\n billingPeriod,\n isCustomerOnTrial,\n onPlanSelected,\n paywallLocale,\n withTrialLeftRow,\n currentSubscription,\n currentSubscriptionOverride,\n perUnitQuantityByFeature,\n}: PlanOfferingButtonProps) {\n const theme = useTheme();\n const [isLoading, setIsLoading] = useState(false);\n const {\n currentPlan,\n custom,\n downgrade,\n startTrial,\n upgrade,\n startNew,\n switchToBillingPeriod,\n cancelScheduledUpdate,\n } = paywallLocale.planCTAButton;\n const resolvedDowngrade = isFunction(downgrade) ? downgrade(plan) : downgrade;\n const resolvedUpgrade = isFunction(upgrade) ? upgrade(plan) : upgrade;\n\n const buttonProps: {\n title: string;\n disabled: boolean;\n intentionType: SubscribeIntentionType;\n } = {\n title: customer ? (plan.isLowerThanCurrentPlan ? resolvedDowngrade : resolvedUpgrade) : startNew,\n disabled: false,\n intentionType: plan.isLowerThanCurrentPlan\n ? SubscribeIntentionType.DOWNGRADE_PLAN\n : isCustomerOnTrial\n ? SubscribeIntentionType.UPGRADE_TRIAL_TO_PAID\n : SubscribeIntentionType.UPGRADE_PLAN,\n };\n const isCustomPrice = plan.pricingType === PricingType.Custom;\n\n const { line1: scheduledUpdateText } = getSubscriptionScheduleUpdateTexts({\n scheduledUpdate: plan.scheduledUpdate,\n options: { withDate: true },\n });\n\n if (plan.isTriable && !plan.isCurrentCustomerPlan && !isCustomerOnTrial) {\n buttonProps.title = startTrial(plan);\n buttonProps.intentionType = SubscribeIntentionType.START_TRIAL;\n } else if (plan.isCurrentCustomerPlan && !isCustomerOnTrial) {\n const isSameBillingPeriod = billingPeriod === plan.currentCustomerPlanBillingPeriod;\n\n if (\n isSameBillingPeriod ||\n (plan.pricingType && [PricingType.Free, PricingType.Custom].includes(plan.pricingType))\n ) {\n const planComparison = compareSelectedTierToCurrentTier({\n perUnitQuantityByFeature,\n plan,\n currentSubscription,\n currentSubscriptionOverride,\n });\n switch (planComparison) {\n case PriceTierComparison.Lower:\n buttonProps.intentionType = SubscribeIntentionType.CHANGE_UNIT_QUANTITY;\n buttonProps.title = resolvedDowngrade;\n break;\n case PriceTierComparison.Higher:\n buttonProps.intentionType = SubscribeIntentionType.CHANGE_UNIT_QUANTITY;\n buttonProps.title = resolvedUpgrade;\n break;\n\n default:\n buttonProps.title = currentPlan;\n buttonProps.disabled = true;\n break;\n }\n } else {\n buttonProps.title = switchToBillingPeriod(billingPeriod);\n buttonProps.intentionType = SubscribeIntentionType.CHANGE_BILLING_PERIOD;\n }\n } else if (isCustomPrice) {\n buttonProps.title = typeof custom === 'function' ? custom({ plan, selectedBillingPeriod: billingPeriod }) : custom;\n buttonProps.intentionType = SubscribeIntentionType.REQUEST_CUSTOM_PLAN_ACCESS;\n }\n\n if (isNextPlan && plan.scheduledUpdate) {\n buttonProps.disabled = false;\n buttonProps.title = cancelScheduledUpdate;\n buttonProps.intentionType = SubscribeIntentionType.CANCEL_SCHEDULED_UPDATES;\n }\n\n const isDisabled = isLoading || buttonProps.disabled;\n return (\n <>\n <ButtonLayout className=\"stigg-paywall-plan-button-layout\">\n {isNextPlan && scheduledUpdateText ? (\n <ScheduledUpdateText color=\"secondary\" variant=\"body1\" className=\"stigg-paywall-schedule-update-text\">\n {scheduledUpdateText}{' '}\n <CancelScheduledUpdateButton\n color=\"secondary\"\n onClick={() => {\n setIsLoading(true);\n Promise.resolve(onPlanSelected(buttonProps.intentionType)).finally(() => setIsLoading(false));\n }}>\n {buttonProps.title}\n </CancelScheduledUpdateButton>\n </ScheduledUpdateText>\n ) : (\n <>\n <OfferingButton\n className=\"stigg-paywall-plan-button\"\n data-testid={`paywall-card-cta-${plan.displayName}`}\n disabled={isDisabled}\n $disabled={isDisabled}\n onClick={() => {\n setIsLoading(true);\n Promise.resolve(onPlanSelected(buttonProps.intentionType)).finally(() => setIsLoading(false));\n }}>\n <ButtonText className=\"stigg-paywall-plan-button-text\" variant=\"h6\" color=\"primary.main\">\n {buttonProps.title}\n </ButtonText>\n {isLoading && <LoadingIndicator color={theme.stigg.palette.text.disabled} loading size={16} />}\n </OfferingButton>\n\n {!withTrialLeftRow ? (\n <div style={{ height: '20px' }} />\n ) : (\n <TrialDaysLeft className=\"stigg-trial-days-left-text\" variant=\"h6\" color=\"secondary\">\n {plan.isCurrentCustomerPlan && plan.trialDaysLeft && (\n <>\n <b>{plan.trialDaysLeft} days</b> left on your free trial\n </>\n )}\n </TrialDaysLeft>\n )}\n </>\n )}\n </ButtonLayout>\n </>\n );\n}\n","import { Currency } from '@stigg/js-client-sdk';\nimport getSymbolFromCurrency from 'currency-symbol-map';\n\nexport const currencyPriceFormatter = ({\n amount,\n currency = Currency.Usd,\n locale,\n maximumFractionDigits = 5,\n minimumFractionDigits = 0,\n removeTrailingZero,\n}: {\n amount: number;\n currency?: Currency | string;\n locale?: string;\n maximumFractionDigits?: number;\n minimumFractionDigits?: number;\n removeTrailingZero?: boolean;\n}) => {\n const currencyString = currency.toString();\n const currencySymbol = getSymbolFromCurrency(currencyString);\n let formattedPrice = new Intl.NumberFormat(locale, {\n maximumFractionDigits,\n minimumFractionDigits,\n style: 'currency',\n currency: currencyString,\n trailingZeroDisplay: removeTrailingZero ? 'stripIfInteger' : 'auto',\n ...(currencySymbol ? { currencyDisplay: 'code' } : {}),\n } as Intl.NumberFormatOptions).format(amount || 0);\n\n if (currencySymbol) {\n formattedPrice = formattedPrice.replace(currencyString, currencySymbol);\n }\n\n // remove space between currency symbol and price\n formattedPrice = formattedPrice.replace(/\\s/g, '');\n\n return formattedPrice;\n};\n","export function numberFormatter(number: number, { locale }: { locale?: string } = {}) {\n return new Intl.NumberFormat(locale).format(number);\n}\n","import { BillingPeriod, PriceTierFragment, PricingType } from '@stigg/js-client-sdk';\nimport { getPaidPriceText } from './getPaidPriceText';\nimport { PaywallPlan, PaywallLocalization } from '../paywall';\n\nexport type PlanPriceText = {\n price: string;\n unit?: string;\n tiers?: PriceTierFragment[] | null | undefined;\n tierUnits?: string;\n};\n\nexport function getPlanPrice(\n plan: PaywallPlan,\n billingPeriod: BillingPeriod,\n paywallLocale: PaywallLocalization,\n locale: string,\n shouldShowMonthlyPriceAmount: boolean,\n perUnitQuantityByFeature?: Record<string, number>,\n): PlanPriceText {\n switch (plan.pricingType) {\n case PricingType.Free:\n if (typeof paywallLocale.price.free === 'function') {\n return paywallLocale.price.free(plan.paywallCurrency);\n }\n\n return paywallLocale.price.free;\n case PricingType.Custom:\n return {\n price:\n typeof paywallLocale.price.custom === 'function'\n ? paywallLocale.price.custom({ plan, selectedBillingPeriod: billingPeriod })\n : paywallLocale.price.custom,\n };\n case PricingType.Paid: {\n const planPrices = plan.pricePoints.filter((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n const paywallCalculatedPrice = plan.paywallCalculatedPricePoints?.find(\n (pricePoint) => pricePoint.billingPeriod === billingPeriod,\n );\n\n if (!planPrices?.length && !paywallCalculatedPrice) {\n return {\n price: paywallLocale.price.priceNotSet,\n };\n }\n\n const paidParams = {\n planPrices,\n paywallCalculatedPrice,\n selectedBillingPeriod: billingPeriod,\n perUnitQuantityByFeature: perUnitQuantityByFeature || {},\n };\n\n return paywallLocale.price.paid\n ? paywallLocale.price.paid({ ...paidParams, plan })\n : getPaidPriceText({ ...paidParams, locale, shouldShowMonthlyPriceAmount, paywallLocale });\n }\n default:\n return {\n price: '',\n };\n }\n}\n","import { BillingModel, BillingPeriod, PaywallCalculatedPricePoint, Price } from '@stigg/js-client-sdk';\nimport { currencyPriceFormatter } from './currencyUtils';\nimport { PlanPriceText } from './getPlanPrice';\nimport { calculateTierPrice, getPriceFeatureUnit } from './priceTierUtils';\nimport { PaywallLocalization } from '../paywall';\nimport { numberFormatter } from './numberUtils';\n\ntype GetPaidPriceTextParams = {\n planPrices: Price[];\n paywallCalculatedPrice?: PaywallCalculatedPricePoint;\n selectedBillingPeriod: BillingPeriod;\n locale: string;\n shouldShowMonthlyPriceAmount: boolean;\n paywallLocale: PaywallLocalization;\n perUnitQuantityByFeature?: Record<string, number>;\n};\n\nexport function getPaidPriceText({\n planPrices,\n paywallCalculatedPrice,\n selectedBillingPeriod,\n locale,\n shouldShowMonthlyPriceAmount,\n paywallLocale,\n perUnitQuantityByFeature,\n}: GetPaidPriceTextParams): PlanPriceText {\n const { amount, currency } = paywallCalculatedPrice || planPrices[0];\n const priceAmount = amount || 0;\n\n const isSinglePrice = planPrices.length === 1;\n let priceNumber =\n selectedBillingPeriod === BillingPeriod.Annually && shouldShowMonthlyPriceAmount ? priceAmount / 12 : priceAmount;\n\n let tiers;\n let tierUnits;\n const pricePeriod = paywallLocale.price.pricePeriod(\n shouldShowMonthlyPriceAmount ? BillingPeriod.Monthly : BillingPeriod.Annually,\n );\n let unit = pricePeriod;\n\n for (const price of planPrices) {\n if (price.isTieredPrice && price.tiers) {\n const quantity = perUnitQuantityByFeature?.[price.feature!.featureId] || 1;\n tiers = price.tiers;\n tierUnits = getPriceFeatureUnit(price);\n\n priceNumber += calculateTierPrice(price, quantity, selectedBillingPeriod, shouldShowMonthlyPriceAmount);\n }\n }\n\n if (isSinglePrice) {\n const price = planPrices[0];\n const formattedUnits =\n price.blockSize && price.blockSize > 1\n ? `for ${numberFormatter(price.blockSize)} ${price.feature?.unitsPlural || price.feature?.units || ''}`\n : `per ${price.feature?.units || ''}`;\n\n if (price.pricingModel === BillingModel.PerUnit && !price.isTieredPrice) {\n unit = `${formattedUnits} ${pricePeriod}`;\n } else if (price.pricingModel === BillingModel.UsageBased) {\n unit = `${formattedUnits}`;\n }\n }\n\n return {\n price: currencyPriceFormatter({\n amount: priceNumber,\n currency,\n locale,\n minimumFractionDigits: 2,\n removeTrailingZero: true,\n }),\n unit,\n tiers,\n tierUnits,\n };\n}\n","import React from 'react';\n\nimport styled from '@emotion/styled/macro';\nimport MuiButton, { ButtonProps } from '@mui/material/Button';\n\nexport type StyledButtonProps = { $success?: boolean; $error?: boolean };\n\nconst StyledButton = styled(MuiButton, { shouldForwardProp: (prop) => !prop.startsWith('$') })<StyledButtonProps>`\n border-radius: 10px;\n text-transform: none;\n\n background-color: ${({ theme, $success, $error }) => {\n if ($success) {\n return theme.stigg.palette.success;\n }\n if ($error) {\n return theme.stigg.palette.error;\n }\n return '';\n }};\n\n &:hover {\n background-color: ${({ theme, $success, $error }) => {\n if ($success) {\n return theme.stigg.palette.successDark;\n }\n if ($error) {\n return theme.stigg.palette.errorDark;\n }\n return '';\n }};\n }\n`;\n\nexport const Button = ({ variant = 'outlined', ...props }: ButtonProps & StyledButtonProps) => {\n return <StyledButton variant={variant} {...props} />;\n};\n","import styled from '@emotion/styled';\nimport { OutlinedInputProps } from '@mui/material/OutlinedInput';\nimport TextField from '@mui/material/TextField';\n\nexport const InputField = styled(TextField)<OutlinedInputProps>(({ theme }) => ({\n '& .MuiOutlinedInput-root': {\n height: '42px',\n borderRadius: theme.stigg.border.radius,\n fieldset: {\n borderColor: theme.stigg.palette.outlinedBorder,\n },\n '&:not(.Mui-focused):hover fieldset': {\n borderColor: theme.stigg.palette.outlinedRestingBorder,\n },\n },\n '& .MuiInputBase-input': {\n padding: '8px 12px',\n borderRadius: theme.stigg.border.radius,\n fontFamily: theme.stigg.typography.fontFamily,\n color: theme.stigg.palette.text.primary,\n ...theme.stigg.typography.body,\n },\n '& .Mui-error': {\n fontFamily: theme.stigg.typography.fontFamily,\n },\n}));\n","import styled from '@emotion/styled/macro';\nimport Grid from '@mui/material/Grid';\nimport ReactSkeleton from 'react-loading-skeleton';\n\nexport const SkeletonsContainer = styled(Grid, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{\n $gap: number;\n $flexDirection?: 'row' | 'column';\n}>`\n display: flex;\n flex-direction: ${({ $flexDirection }) => $flexDirection || 'row'};\n gap: ${({ $gap }) => $gap}px;\n`;\n\nexport const FlexedSkeletonContainer = styled(SkeletonsContainer)`\n span {\n display: flex;\n flex: 1;\n }\n`;\n\nexport const FlexedSkeleton = styled(Grid)<{ flex: number }>`\n span {\n display: flex;\n flex: ${({ flex }) => flex};\n }\n`;\n\nexport const Skeleton = styled(ReactSkeleton)`\n border-radius: 4px;\n`;\n","import React from 'react';\nimport Divider from '@mui/material/Divider';\nimport Grid from '@mui/material/Grid';\nimport styled from '@emotion/styled/macro';\nimport { FlexedSkeleton, FlexedSkeletonContainer, Skeleton, SkeletonsContainer } from './Skeletons.style';\n\nconst ContentContainer = styled(Grid)`\n display: flex;\n flex-direction: column;\n`;\n\nexport function ContentLoadingSkeleton() {\n return (\n <ContentContainer container>\n <SkeletonsContainer item $gap={48}>\n <Skeleton width={120} height={20} />\n <Skeleton width={120} height={20} />\n </SkeletonsContainer>\n\n <Divider className=\"stigg-checkout-plan-header-divider\" sx={{ marginY: 2 }} />\n\n <ContentContainer item>\n <Skeleton width={120} height={20} />\n\n <FlexedSkeletonContainer $gap={16} marginTop={3}>\n <Skeleton height={20} />\n <Skeleton height={20} />\n </FlexedSkeletonContainer>\n\n <SkeletonsContainer $gap={130} marginTop={3}>\n <FlexedSkeleton flex={1}>\n <Skeleton height={20} />\n </FlexedSkeleton>\n\n <FlexedSkeleton flex={3}>\n <Skeleton height={20} />\n </FlexedSkeleton>\n </SkeletonsContainer>\n </ContentContainer>\n </ContentContainer>\n );\n}\n","import React from 'react';\n\nexport const ON_WHEEL_BLUR = (e: React.WheelEvent<HTMLInputElement>) => (e.target as HTMLElement).blur();\n","import InputAdornment from '@mui/material/InputAdornment';\nimport React from 'react';\nimport { Typography } from './Typography';\nimport { InputField } from '../checkout/components';\nimport { TiersSelectContainerProps } from './TiersSelectContainer';\nimport { ON_WHEEL_BLUR } from '../utils/onWheelBlur';\n\nexport function VolumePerUnitInput({\n width,\n tierUnits,\n value,\n handleChange,\n}: Pick<TiersSelectContainerProps, 'width' | 'tierUnits' | 'value'> & {\n handleChange: (quantity: number) => void;\n}) {\n return (\n <InputField\n type=\"number\"\n onWheel={ON_WHEEL_BLUR}\n fullWidth\n sx={{ minHeight: '46px', width }}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <Typography variant=\"body1\" color=\"primary\">\n {tierUnits}\n </Typography>\n </InputAdornment>\n ),\n }}\n value={value}\n onChange={(event) => {\n const quantity = event?.target?.value ? Number(event?.target?.value) : null;\n if (quantity) {\n handleChange(quantity);\n }\n }}\n />\n );\n}\n","import { PriceTierFragment } from '@stigg/js-client-sdk';\nimport styled from '@emotion/styled/macro';\nimport OutlinedInput from '@mui/material/OutlinedInput';\nimport Select from '@mui/material/Select';\nimport MenuItem from '@mui/material/MenuItem';\nimport { map } from 'lodash';\nimport React from 'react';\nimport { Typography } from './Typography';\nimport { TiersSelectContainerProps } from './TiersSelectContainer';\nimport { formatNumber } from '../utils/formatNumber';\n\nconst TierSelect = styled(Select)`\n border-radius: 10px;\n min-height: 42px;\n min-width: 120px;\n\n &:hover .MuiOutlinedInput-notchedOutline {\n border-color: ${({ theme }) => theme.stigg.palette.outlinedBorder};\n }\n`;\n\nconst TierInput = styled(OutlinedInput)`\n & .MuiInputBase-input {\n padding: 10px 12px;\n }\n\n &.Mui-focused .MuiOutlinedInput-notchedOutline {\n border-color: ${({ theme }) => theme.stigg.palette.primary} !important;\n }\n`;\n\nexport function VolumeBulkSelect({\n value,\n componentId,\n tierUnits,\n tiers,\n handleChange,\n}: Pick<TiersSelectContainerProps, 'value' | 'componentId' | 'tiers' | 'tierUnits'> & {\n handleChange: (quantity: number) => void;\n}) {\n if (!tiers) {\n return null;\n }\n\n return (\n <TierSelect\n value={value.toString()}\n fullWidth\n onChange={(event) => {\n const quantity = event?.target?.value ? Number(event?.target?.value) : null;\n if (quantity) {\n handleChange(quantity);\n }\n }}\n id={componentId}\n input={<TierInput />}\n MenuProps={{\n MenuListProps: { disablePadding: true },\n PaperProps: {\n sx: { marginTop: '4px', borderRadius: '10px' },\n },\n }}>\n {map(tiers, (tier: PriceTierFragment) => (\n <MenuItem className=\"stigg-price-tier-menu-item-text\" key={tier.upTo} value={tier.upTo?.toString()}>\n <Typography variant=\"body1\" color=\"primary\" style={{ lineHeight: 'unset' }}>\n {formatNumber(tier.upTo)} {tierUnits}\n </Typography>\n </MenuItem>\n ))}\n </TierSelect>\n );\n}\n","import { PriceTierFragment, TiersMode } from '@stigg/js-client-sdk';\nimport React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { hasTierWithUnitPrice } from '../utils/priceTierUtils';\nimport { Typography } from './Typography';\nimport { VolumePerUnitInput } from './VolumePerUnitInput';\nimport { VolumeBulkSelect } from './VolumeBulkSelect';\n\nexport type TiersSelectContainerProps = {\n componentId: string;\n tiers?: PriceTierFragment[] | null;\n tierUnits?: string;\n tiersMode?: TiersMode | null;\n handleChange: (quantity: number) => void;\n value: number;\n width?: number;\n};\n\nconst TiersSelectLayout = styled(Typography)`\n min-height: 46px;\n`;\n\nexport function TiersSelectContainer(props: TiersSelectContainerProps) {\n const { tiers } = props;\n\n return (\n <TiersSelectLayout as=\"div\" className=\"stigg-price-tier-select\">\n {hasTierWithUnitPrice(tiers) ? <VolumePerUnitInput {...props} /> : <VolumeBulkSelect {...props} />}\n </TiersSelectLayout>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { BillingPeriod } from '@stigg/js-client-sdk';\nimport { PaywallPlan } from './types';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { getPlanPrice } from '../utils/getPlanPrice';\nimport { Typography } from '../common/Typography';\nimport { TiersSelectContainer } from '../common/TiersSelectContainer';\n\nconst EMPTY_CHAR = '‎';\n\nconst PlanPriceContainer = styled(Typography)`\n word-break: break-word;\n width: 100%;\n`;\n\nconst UnitSpan = styled(Typography)`\n white-space: nowrap;\n`;\n\nconst PriceSpan = styled(Typography)`\n white-space: normal;\n min-height: 39px;\n`;\n\ntype PriceBillingPeriodProps = {\n plan: PaywallPlan;\n billingPeriod: BillingPeriod;\n hasMonthlyPrice: boolean;\n hasAnnuallyPrice: boolean;\n paywallLocale: PaywallLocalization;\n};\n\nfunction PriceBillingPeriod({\n plan,\n billingPeriod,\n hasMonthlyPrice,\n hasAnnuallyPrice,\n paywallLocale,\n}: PriceBillingPeriodProps) {\n const hasPrice = plan.pricePoints.find((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n\n let content = EMPTY_CHAR;\n if (hasPrice && hasMonthlyPrice && hasAnnuallyPrice) {\n content = paywallLocale.price.billingPeriod?.(billingPeriod) || `, billed ${billingPeriod.toLowerCase()}`;\n }\n\n return (\n <Typography span className=\"stigg-price-billing-period-text\" variant=\"h6\" color=\"secondary\">\n {content}\n </Typography>\n );\n}\n\nexport const PlanPrice = ({\n showStartingAt,\n withUnitPriceRow,\n withStartingAtRow,\n withTiersRow,\n plan,\n billingPeriod,\n paywallLocale,\n locale,\n hasMonthlyPrice,\n hasAnnuallyPrice,\n perUnitQuantityByFeature,\n setPerUnitQuantityByFeature,\n}: {\n showStartingAt: boolean;\n withUnitPriceRow: boolean;\n withStartingAtRow: boolean;\n withTiersRow: boolean;\n perUnitQuantityByFeature: Record<string, number>;\n setPerUnitQuantityByFeature: React.Dispatch<React.SetStateAction<Record<string, number>>>;\n plan: PaywallPlan;\n billingPeriod: BillingPeriod;\n paywallLocale: PaywallLocalization;\n hasMonthlyPrice: boolean;\n hasAnnuallyPrice: boolean;\n locale: string;\n}) => {\n const { price, unit, tiers, tierUnits } = getPlanPrice(\n plan,\n billingPeriod,\n paywallLocale,\n locale,\n hasMonthlyPrice,\n perUnitQuantityByFeature,\n );\n\n // We currently only support prices with one tier - so we select the first one\n const tieredPrice = plan.pricePoints.find((planPrice) => {\n return planPrice.billingPeriod === billingPeriod && planPrice.isTieredPrice;\n });\n const featureId = tieredPrice ? tieredPrice.feature!.featureId : undefined;\n const perUnitQuantity = perUnitQuantityByFeature[featureId || ''] ?? 1;\n\n const handlePerUnitQuantityChange = (quantity: number) => {\n if (!featureId) {\n return;\n }\n\n setPerUnitQuantityByFeature((prevState) => ({\n ...prevState,\n [featureId]: quantity,\n }));\n };\n\n return (\n <PlanPriceContainer as=\"div\" className=\"stigg-price-text\">\n <>\n {withStartingAtRow && (\n <Typography\n style={{ minHeight: '20px' }}\n className=\"stigg-starting-at-text\"\n variant=\"body1\"\n color=\"secondary\">\n {showStartingAt ? paywallLocale.price.startingAtCaption : EMPTY_CHAR}\n </Typography>\n )}\n\n <PriceSpan className=\"stigg-price-point\" variant=\"h1\">\n {price}\n </PriceSpan>\n\n {withUnitPriceRow && (\n <Typography as=\"div\" className=\"stigg-price-unit-and-billing-period-text\" style={{ minHeight: '48px' }}>\n <UnitSpan className=\"stigg-price-unit-text\" span variant=\"h6\" color=\"secondary\">\n {unit}\n </UnitSpan>\n\n <PriceBillingPeriod\n plan={plan}\n billingPeriod={billingPeriod}\n hasAnnuallyPrice={hasAnnuallyPrice}\n hasMonthlyPrice={hasMonthlyPrice}\n paywallLocale={paywallLocale}\n />\n </Typography>\n )}\n\n {withTiersRow ? (\n <TiersSelectContainer\n componentId={`${plan.id}_${featureId}_tier`}\n tiers={tiers}\n tierUnits={tierUnits}\n tiersMode={tieredPrice?.tiersMode}\n handleChange={handlePerUnitQuantityChange}\n value={perUnitQuantity}\n />\n ) : null}\n </>\n </PlanPriceContainer>\n );\n};\n","import React, { useState } from 'react';\nimport { Addon, WidgetType } from '@stigg/js-client-sdk';\nimport MuiButton from '@mui/material/Button';\nimport styled from '@emotion/styled/macro';\nimport classNames from 'classnames';\nimport { Typography } from '../common/Typography';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { Icon } from '../common/Icon';\n\nexport const StyledButton = styled(MuiButton)`\n padding: 0px;\n text-transform: none;\n margin-left: 0px;\n`;\n\nconst ButtonText = styled(Typography)`\n font-size: 14px;\n font-weight: 500;\n`;\n\nconst AddonsBox = styled.div`\n width: 100%;\n gap: 10px;\n`;\n\nconst AddonsList = styled.div`\n margin-top: 10px;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n gap: 4px;\n width: 100%;\n`;\n\nconst AddonRow = styled.div`\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: space-between;\n padding: 8px 0px;\n max-height: 44px;\n gap: 16px;\n`;\n\nconst AddonName = styled(Typography)`\n overflow: hidden;\n font-feature-settings: 'liga' off, 'clig' off;\n text-overflow: ellipsis;\n font-family: 'DM Sans';\n letter-spacing: 0.15px;\n white-space: nowrap;\n min-width: 0;\n flex-shrink: 1;\n`;\n\nconst AddonIcon = styled(Icon)`\n width: 24px;\n height: 24px;\n color: ${({ theme }) => theme.stigg.palette.primary};\n`;\n\nconst AddonContent = styled.div`\n flex: 1;\n min-width: 0;\n`;\n\nconst Footer = styled.div`\n margin-top: 16px;\n display: flex;\n`;\n\nconst MAX_ADDONS = 4;\n\ntype PlanCompatibleAddonsProps = {\n addons: Addon[];\n paywallLocale: PaywallLocalization;\n};\n\nexport function PlanCompatibleAddons({ addons, paywallLocale }: PlanCompatibleAddonsProps) {\n const [showAllAddons, setShowAllAddons] = useState(false);\n\n if (!addons || addons.length === 0) return null;\n\n const visibleAddons = addons.filter((addon) => !addon.hiddenFromWidgets?.includes(WidgetType.Paywall));\n\n const toggleShowAllAddons = () => {\n setShowAllAddons(!showAllAddons);\n };\n\n const displayedAddons = showAllAddons ? visibleAddons : visibleAddons.slice(0, MAX_ADDONS);\n\n if (displayedAddons.length === 0) return null;\n\n return (\n <AddonsBox className=\"stigg-compatible-addons-container\">\n <Typography className=\"stigg-compatible-addons-header\" color=\"secondary\" variant=\"body1\" bold>\n {paywallLocale.addonsTitle}\n </Typography>\n <AddonsList className=\"stigg-compatible-addons-list\">\n {displayedAddons.map((addon) => {\n return (\n <AddonRow\n key={addon.id}\n className={classNames(`stigg-compatible-addon--${addon.id}`, 'stigg-compatible-addon-item')}>\n <AddonIcon icon=\"Add\" className=\"stigg-compatible-addon-icon\" />\n <AddonContent className=\"stigg-compatible-addon-content\">\n <AddonName variant=\"body1\" color=\"primary\" className=\"stigg-compatible-addon-name\">\n {addon.displayName}\n </AddonName>\n </AddonContent>\n </AddonRow>\n );\n })}\n </AddonsList>\n {visibleAddons.length > MAX_ADDONS && (\n <Footer>\n <StyledButton variant=\"text\" onClick={toggleShowAllAddons}>\n <ButtonText color=\"primary.main\">\n {showAllAddons ? 'Show less' : `Show ${visibleAddons.length - MAX_ADDONS} more`}\n </ButtonText>\n </StyledButton>\n </Footer>\n )}\n </AddonsBox>\n );\n}\n","import React, { useState } from 'react';\nimport { BillableFeature, BillingPeriod, Customer, PricingType, Subscription } from '@stigg/js-client-sdk';\nimport styled from '@emotion/styled/macro';\nimport classNames from 'classnames';\nimport Grid from '@mui/material/Grid';\nimport { PlanEntitlements } from './PlanEntitlements';\nimport { PlanOfferingButton } from './PlanOfferingButton';\nimport { CurrentSubscriptionOverride, PaywallPlan, SelectDefaultTierIndexFn, SubscribeIntentionType } from './types';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { flexLayoutMapper } from '../../theme/getResolvedTheme';\nimport { Typography } from '../common/Typography';\nimport MiniSchedule from '../../assets/mini-schedule.svg';\nimport { PlanPrice } from './PlanPrice';\nimport { getTiersPerUnitQuantities } from '../utils/priceTierUtils';\nimport { PlanCompatibleAddons } from './PlanCompatibleAddons';\n\nconst PlanOfferingButtonHeight = '66px';\n\nconst PlanOfferingContainer = styled.div<{ $isHighlighted: boolean; $isCurrentPlan: boolean }>`\n position: relative;\n background-color: ${({ theme, $isCurrentPlan }) =>\n $isCurrentPlan ? theme.stigg.palette.backgroundHighlight : theme.stigg.palette.backgroundPaper};\n border: ${({ theme, $isHighlighted }) =>\n $isHighlighted ? `3px solid ${theme.stigg.palette.primary}` : `1px solid ${theme.stigg.palette.outlinedBorder}`};\n border-radius: 10px;\n padding: ${({ theme }) => theme.stigg.layout.planPadding};\n display: flex;\n min-width: ${({ theme }) => theme.stigg.layout.planMinWidth};\n max-width: ${({ theme }) => theme.stigg.layout.planMaxWidth};\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n position: relative;\n`;\n\nconst AddonsContainer = styled.div<{ $planHasEntitlements: boolean }>`\n margin-top: ${({ $planHasEntitlements }) => ($planHasEntitlements ? '32px' : '0px')};\n`;\n\nconst PlanHeader = styled(Typography)`\n padding-bottom: 8px;\n`;\n\nconst Divider = styled.div`\n height: 2px;\n width: 100%;\n background-color: ${({ theme }) => theme.stigg.palette.outlinedBorder};\n margin-bottom: 40px;\n`;\n\nconst PlanDescription = styled(Typography)`\n text-align: ${({ theme }) => theme.stigg.layout.descriptionAlignment};\n min-height: ${({ theme }) => theme.stigg.layout.descriptionMinHeight};\n`;\n\nconst HighlightBadge = styled.div`\n background-color: ${({ theme }) => theme.stigg.palette.primary};\n border-radius: 40px;\n position: absolute;\n top: -12px;\n`;\n\nconst HighlightText = styled(Typography)`\n margin: 0;\n padding: 2px 8px;\n`;\n\nconst HeaderWrapper = styled.div`\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: ${({ theme }) => flexLayoutMapper(theme.stigg.layout.headerAlignment)};\n`;\n\ntype PlanOfferingProps = {\n withUnitPriceRow: boolean;\n withTiersRow: boolean;\n withTrialLeftRow: boolean;\n customer: Customer | null;\n plan: PaywallPlan;\n billingPeriod: BillingPeriod;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n isHighlighted: boolean;\n shouldShowDescriptionSection: boolean;\n hasAnnuallyPrice: boolean;\n hasMonthlyPrice: boolean;\n isCustomerOnTrial: boolean;\n onPlanSelected: (intentionType: SubscribeIntentionType, billableFeatures: BillableFeature[]) => void | Promise<void>;\n paywallLocale: PaywallLocalization;\n locale: string;\n withStartingAtRow: boolean;\n isCustomerInCustomPlan: boolean;\n selectDefaultTierIndex?: SelectDefaultTierIndexFn;\n hideCompatibleAddons?: boolean;\n};\n\nconst NextPlanTagContainer = styled.div`\n position: absolute;\n top: 0;\n background-color: ${({ theme }) => theme.stigg.palette.outlinedBorder};\n border-radius: 0px 0px 10px 10px;\n padding: 3px 12px;\n`;\n\nconst StyledMiniSchedule = styled(MiniSchedule)<{ $iconsColor?: string }>`\n display: flex;\n height: 100%;\n margin-right: 4px;\n\n path {\n fill: ${({ theme }) => theme.stigg.palette.text.primary};\n }\n`;\n\nfunction UpcomingChangeTag({ text = 'Next', iconsColor }: { text?: string; iconsColor?: string }) {\n return (\n <NextPlanTagContainer>\n <Grid display=\"flex\" alignItems=\"center\" gap={1}>\n <StyledMiniSchedule $iconsColor={iconsColor} />\n <Typography color=\"primary\" variant=\"body1\">\n {text}\n </Typography>\n </Grid>\n </NextPlanTagContainer>\n );\n}\n\nexport function PlanOffering({\n withUnitPriceRow,\n withTiersRow,\n withTrialLeftRow,\n customer,\n plan,\n billingPeriod,\n isHighlighted,\n currentSubscription,\n currentSubscriptionOverride,\n shouldShowDescriptionSection,\n hasMonthlyPrice,\n hasAnnuallyPrice,\n isCustomerOnTrial,\n onPlanSelected,\n paywallLocale,\n locale,\n withStartingAtRow,\n isCustomerInCustomPlan,\n selectDefaultTierIndex,\n hideCompatibleAddons,\n}: PlanOfferingProps) {\n const isNextPlan = plan.isNextPlan && plan.isNextPlan(billingPeriod);\n const planPrices = plan.pricePoints.filter((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n const paywallCalculatedPrice = plan.paywallCalculatedPricePoints?.find(\n (pricePoint) => pricePoint.billingPeriod === billingPeriod,\n );\n const showStartingAt = planPrices.length > 1 && !!paywallCalculatedPrice?.additionalChargesMayApply;\n const showCTAButton = !isCustomerInCustomPlan || plan.pricingType === PricingType.Custom;\n\n let planBadge = null;\n if (isNextPlan) {\n planBadge = <UpcomingChangeTag text=\"Next plan\" />;\n } else if (isHighlighted && paywallLocale.highlightChip) {\n planBadge = (\n <HighlightBadge className=\"stigg-highlight-badge\">\n <HighlightText className=\"stigg-highlight-badge-text\" color=\"white\" bold>\n {paywallLocale.highlightChip}\n </HighlightText>\n </HighlightBadge>\n );\n }\n\n const [perUnitQuantityByFeature, setPerUnitQuantityByFeature] = useState<Record<string, number>>(\n getTiersPerUnitQuantities({\n plan,\n billingPeriod,\n currentSubscription,\n currentSubscriptionOverride,\n selectDefaultTierIndex,\n }),\n );\n\n const onPlanButtonClick = (intentionType: SubscribeIntentionType) => {\n const perUnitBillableFeatures: BillableFeature[] = Object.keys(perUnitQuantityByFeature).map((featureId) => ({\n featureId,\n quantity: perUnitQuantityByFeature[featureId],\n }));\n\n return onPlanSelected(intentionType, perUnitBillableFeatures);\n };\n\n return (\n <PlanOfferingContainer\n className={classNames(`stigg-${plan.id}`, 'stigg-plan-offering-container', {\n 'stigg-current-plan': plan.isCurrentCustomerPlan,\n })}\n $isHighlighted={isHighlighted}\n $isCurrentPlan={plan.isCurrentCustomerPlan}>\n {planBadge}\n\n <HeaderWrapper className=\"stigg-header-wrapper\">\n <PlanHeader className=\"stigg-plan-header\" variant=\"h3\">\n {plan.displayName}\n </PlanHeader>\n\n {shouldShowDescriptionSection && (\n <PlanDescription className=\"stigg-plan-description\" variant=\"h6\" color=\"secondary\">\n {plan.description}\n </PlanDescription>\n )}\n\n <PlanPrice\n showStartingAt={showStartingAt}\n withUnitPriceRow={withUnitPriceRow}\n withStartingAtRow={withStartingAtRow}\n withTiersRow={withTiersRow}\n plan={plan}\n billingPeriod={billingPeriod}\n paywallLocale={paywallLocale}\n locale={locale}\n hasAnnuallyPrice={hasAnnuallyPrice}\n hasMonthlyPrice={hasMonthlyPrice}\n setPerUnitQuantityByFeature={setPerUnitQuantityByFeature}\n perUnitQuantityByFeature={perUnitQuantityByFeature}\n />\n\n {showCTAButton ? (\n <PlanOfferingButton\n isNextPlan={isNextPlan}\n customer={customer}\n plan={plan}\n currentSubscription={currentSubscription}\n currentSubscriptionOverride={currentSubscriptionOverride}\n billingPeriod={billingPeriod}\n isCustomerOnTrial={isCustomerOnTrial}\n onPlanSelected={onPlanButtonClick}\n paywallLocale={paywallLocale}\n withTrialLeftRow={withTrialLeftRow}\n perUnitQuantityByFeature={perUnitQuantityByFeature}\n />\n ) : (\n <div style={{ height: PlanOfferingButtonHeight }} />\n )}\n\n <Divider className=\"stigg-plan-header-divider\" />\n </HeaderWrapper>\n\n <PlanEntitlements plan={plan} billingPeriod={billingPeriod} paywallLocale={paywallLocale} />\n\n <AddonsContainer $planHasEntitlements={plan.entitlements.length > 0} className=\"stigg-addons-container\">\n {!hideCompatibleAddons && plan.compatibleAddons && plan.compatibleAddons.length > 0 && (\n <PlanCompatibleAddons addons={plan.compatibleAddons} paywallLocale={paywallLocale} />\n )}\n </AddonsContainer>\n </PlanOfferingContainer>\n );\n}\n","<svg width=\"135\" height=\"16\" viewBox=\"0 0 135 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0.0987549 3.43016V12.9878H1.15589V9.52681H3.96527C5.94922 9.52681 7.28874 8.25245 7.28874 6.47848C7.28874 4.70452 5.94922 3.43016 3.96527 3.43016H0.0987549ZM1.15589 8.55656V4.40765H4.04492C5.33376 4.40765 6.18816 5.26205 6.18816 6.47848C6.18816 7.69492 5.33376 8.55656 4.04492 8.55656H1.15589Z\" fill=\"#001E6C\"/>\n<path d=\"M11.7787 13.1616C13.9075 13.1616 15.6525 11.5397 15.6525 9.38199C15.6525 7.21703 13.9365 5.62408 11.8077 5.62408C9.64999 5.62408 7.93395 7.24599 7.93395 9.41095C7.93395 11.5687 9.62103 13.1616 11.7787 13.1616ZM11.7932 12.2276C10.2365 12.2276 9.02005 11.0256 9.02005 9.39647C9.02005 7.76732 10.2365 6.56537 11.7932 6.56537C13.321 6.56537 14.5664 7.76732 14.5664 9.39647C14.5664 11.0256 13.321 12.2276 11.7932 12.2276Z\" fill=\"#001E6C\"/>\n<path d=\"M19.9054 12.9878L21.4766 6.94189H21.5056L23.0623 12.9878H24.4018L26.5958 5.8051H25.4155L23.7936 11.909H23.7647L22.2152 5.8051H20.7815L19.232 11.909H19.203L17.5522 5.8051H16.3575L18.5659 12.9878H19.9054Z\" fill=\"#001E6C\"/>\n<path d=\"M34.9835 9.42544C34.9835 7.30392 33.4051 5.62408 31.1532 5.62408C29.0534 5.62408 27.3084 7.18083 27.3084 9.41095C27.3084 11.5542 28.9086 13.1616 31.1822 13.1616C32.7679 13.1616 34.0567 12.3941 34.6794 11.1922L33.7816 10.707C33.3688 11.6049 32.3696 12.2348 31.1966 12.2348C29.5241 12.2348 28.5031 10.9894 28.4017 9.7223H34.969C34.9835 9.59197 34.9835 9.54129 34.9835 9.42544ZM31.1387 6.55089C32.5434 6.55089 33.6657 7.49942 33.854 8.80998H28.4307C28.6552 7.5501 29.7558 6.55089 31.1387 6.55089Z\" fill=\"#001E6C\"/>\n<path d=\"M39.5922 5.68201C38.564 5.68201 37.8182 6.20334 37.4924 6.93464L37.391 5.8051H36.486V12.9878H37.5431V8.5638C37.5431 7.44873 38.1585 6.77535 39.3171 6.77535H39.9977V5.68201H39.5922Z\" fill=\"#001E6C\"/>\n<path d=\"M48.2486 9.42544C48.2486 7.30392 46.6702 5.62408 44.4183 5.62408C42.3185 5.62408 40.5735 7.18083 40.5735 9.41095C40.5735 11.5542 42.1737 13.1616 44.4473 13.1616C46.033 13.1616 47.3218 12.3941 47.9445 11.1922L47.0467 10.707C46.634 11.6049 45.6348 12.2348 44.4618 12.2348C42.7892 12.2348 41.7682 10.9894 41.6669 9.7223H48.2342C48.2486 9.59197 48.2486 9.54129 48.2486 9.42544ZM44.4039 6.55089C45.8085 6.55089 46.9308 7.49942 47.1191 8.80998H41.6958C41.9203 7.5501 43.0209 6.55089 44.4039 6.55089Z\" fill=\"#001E6C\"/>\n<path d=\"M55.846 7.02877C55.2161 6.13817 54.2024 5.63132 53.0149 5.63132C50.9224 5.63132 49.2425 7.21703 49.2425 9.39647C49.2425 11.5759 50.8934 13.1616 52.986 13.1616C54.1807 13.1616 55.2161 12.6403 55.8533 11.7425L55.9981 12.9878H56.9032V2.56128L55.846 2.67713V7.02877ZM53.0294 12.2276C51.5306 12.2276 50.3286 11.0401 50.3286 9.39647C50.3286 7.75284 51.5306 6.56537 53.0294 6.56537C54.5789 6.56537 55.846 7.76732 55.846 9.39647C55.846 11.0256 54.5789 12.2276 53.0294 12.2276Z\" fill=\"#001E6C\"/>\n<path d=\"M65.7314 5.63132C64.5367 5.63132 63.5085 6.14541 62.8713 7.04325V2.56128L61.8142 2.67713V12.9878H62.7192L62.8641 11.7497C63.494 12.6475 64.5077 13.1616 65.7024 13.1616C67.795 13.1616 69.4748 11.5759 69.4748 9.39647C69.4748 7.21703 67.8239 5.63132 65.7314 5.63132ZM65.6879 12.2276C64.1384 12.2276 62.8713 11.0256 62.8713 9.39647C62.8713 7.76732 64.1384 6.56537 65.6879 6.56537C67.1867 6.56537 68.3887 7.75284 68.3887 9.39647C68.3887 11.0401 67.1867 12.2276 65.6879 12.2276Z\" fill=\"#001E6C\"/>\n<path d=\"M76.2187 5.8051V9.9178C76.2187 11.3297 75.3136 12.1841 74.0465 12.1841C72.7866 12.1841 72.077 11.4456 72.077 10.1133V5.8051H71.0199V10.2726C71.0199 11.9669 72.1349 13.0965 73.7641 13.0965C74.843 13.0965 75.6901 12.6765 76.2187 11.9814V12.8937C76.2187 14.1608 75.2629 15.0804 73.8727 15.0804C72.7504 15.0804 71.8236 14.4794 71.5847 13.4295L70.6579 13.9074C71.0995 15.16 72.3087 16 73.8582 16C75.8132 16 77.2758 14.5953 77.2758 12.7923V5.8051H76.2187Z\" fill=\"#001E6C\"/>\n<path d=\"M108.672 10.4867C108.672 11.9077 107.411 12.7873 105.491 12.7873C104.464 12.7873 103.634 12.6028 102.84 12.2091C102.914 11.76 102.982 11.2187 103 10.5913C103.738 11.0219 104.575 11.231 105.381 11.231C106.34 11.231 106.839 11.0096 106.839 10.5421C106.857 10.0807 106.5 9.87155 105.067 9.59473C103.406 9.26255 102.668 8.57359 102.668 7.35559C102.668 5.97767 103.929 5.0857 105.848 5.0857C106.697 5.0857 107.54 5.24564 108.186 5.52246L107.866 7.06647C107.226 6.7712 106.537 6.63587 105.848 6.63587C104.95 6.63587 104.507 6.85733 104.507 7.29408C104.507 7.67547 104.815 7.83541 106.217 8.12453C108.007 8.50592 108.678 9.19488 108.678 10.4744L108.672 10.4867ZM112.879 11.0957C112.16 11.0957 111.581 10.7143 111.581 9.70546V6.88808H113.408L113.747 5.25794H111.581V2.93884C111.157 3.06187 110.517 3.2095 109.681 3.28332L109.662 10.0315C109.662 11.8708 110.763 12.7996 112.412 12.7996C112.787 12.7996 113.113 12.7627 113.39 12.6951L113.753 10.9665C113.525 11.0465 113.236 11.1018 112.879 11.1018V11.0957ZM114.965 12.6889H116.884V5.25794H114.965V12.6889ZM115.93 2.21912C115.309 2.21297 114.829 2.66817 114.823 3.27102C114.823 3.89232 115.278 4.35983 115.894 4.36598C116.515 4.36598 116.976 3.92923 116.989 3.32638C117.001 2.70508 116.546 2.23142 115.937 2.21912H115.93ZM126.056 5.25794V11.5263C126.056 13.8946 124.456 15.5247 121.756 15.5247C120.784 15.5247 119.714 15.3094 118.994 14.8973C119.492 14.3867 119.831 13.9438 120.046 13.6239C120.532 13.79 121.042 13.8762 121.565 13.8762C123.275 13.8762 124.143 12.9288 124.143 11.7354V11.4955C123.534 12.1968 122.654 12.6336 121.602 12.6336C119.584 12.6336 118.065 11.1326 118.065 8.90577C118.065 6.67893 119.726 5.098 121.756 5.098C122.808 5.098 123.724 5.4794 124.333 6.19912L124.395 5.25179H126.062L126.056 5.25794ZM124.155 8.90577C124.155 7.72468 123.294 6.82657 122.107 6.82657C120.919 6.82657 120.046 7.72468 120.046 8.90577C120.046 10.0868 120.907 10.9542 122.107 10.9542C123.306 10.9542 124.155 10.0561 124.155 8.90577ZM134.994 5.25794V11.5263C134.994 13.8946 133.394 15.5247 130.694 15.5247C129.722 15.5247 128.652 15.3094 127.932 14.8973C128.43 14.3867 128.769 13.9438 128.984 13.6239C129.47 13.79 129.98 13.8762 130.503 13.8762C132.213 13.8762 133.081 12.9288 133.081 11.7354V11.4955C132.472 12.1968 131.592 12.6336 130.54 12.6336C128.523 12.6336 127.003 11.1326 127.003 8.90577C127.003 6.67893 128.664 5.098 130.694 5.098C131.746 5.098 132.662 5.4794 133.271 6.19912L133.333 5.25179H135L134.994 5.25794ZM133.093 8.90577C133.093 7.72468 132.232 6.82657 131.045 6.82657C129.857 6.82657 128.984 7.72468 128.984 8.90577C128.984 10.0868 129.845 10.9542 131.045 10.9542C132.244 10.9542 133.093 10.0561 133.093 8.90577Z\" fill=\"#001E6C\"/>\n<path d=\"M95.7092 14.9825C95.6354 15.0194 94.2267 15.6407 91.7353 15.5238C90.4374 15.4623 89.3117 15.2224 88.512 15.0009L92.8241 9.99361C93.5931 10.1905 94.5835 10.375 95.7092 10.4304C98.2005 10.5534 99.6092 9.92594 99.683 9.88903L95.7092 14.9886V14.9825ZM89.2686 5.36155C88.5612 2.96863 88.838 1.45537 88.8564 1.3754L84.8457 6.44421C84.8334 6.52418 84.5566 8.03744 85.2578 10.4304C85.6269 11.673 86.1252 12.7126 86.5312 13.4384L90.3759 8.0682C90.0068 7.36693 89.5885 6.44421 89.2686 5.3677V5.36155ZM99.2647 5.89058C98.6988 3.97132 97.813 2.55033 97.4501 2.009L93.8822 6.55494L94.5527 9.77216C94.9526 9.82752 95.3462 9.86443 95.7461 9.88903C95.9491 9.89518 96.1521 9.90134 96.3489 9.90134C98.2805 9.90134 99.357 9.44613 99.4739 9.39076L99.7507 9.26773C99.7753 8.60338 99.7322 7.42844 99.2709 5.88443L99.2647 5.89058ZM97.0256 1.68297C96.4166 1.45537 94.8295 0.932493 92.8303 0.83407C91.2248 0.754101 90.0744 0.987856 89.4347 1.1724L89.3793 1.46767C89.367 1.52919 89.121 2.96248 89.7792 5.20777C89.8899 5.58916 90.0252 5.9644 90.1729 6.33964L93.4577 6.22891L97.0318 1.68912L97.0256 1.68297Z\" fill=\"#001E6C\"/>\n</svg>\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport Switch from 'react-switch';\nimport { BillingPeriod } from '@stigg/js-client-sdk';\nimport { Typography } from '../common/Typography';\n\nconst PickerContainer = styled.div`\n height: 40px;\n padding: 0 20px;\n margin-bottom: ${({ theme }) => theme.stigg.layout.switchBottomSpacing};\n border-radius: 10px;\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedBorder}`};\n background-color: ${({ theme }) => theme.stigg.palette.backgroundPaper};\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nconst PeriodText = styled(Typography)`\n margin: 0 8px;\n`;\n\nconst StyledSwitch = styled(Switch)`\n & .react-switch-bg {\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.switchBorder}`};\n background: ${({ theme }) => theme.stigg.palette.switchFill} !important;\n }\n\n & .react-switch-handle {\n box-shadow: ${({ theme }) => theme.stigg.shadows.light};\n background: ${({ theme }) => theme.stigg.palette.switchHandle} !important;\n top: 0.5px !important;\n }\n`;\n\nfunction DiscountRate({ discount, disabled }: { discount: number; disabled: boolean }) {\n return (\n <Typography variant=\"h6\" color={disabled ? 'disabled' : 'primary'} className=\"stigg-discount-rate-text\">\n {discount}% off\n </Typography>\n );\n}\n\nexport function BillingPeriodPicker({\n discountRate,\n selectedBillingPeriod,\n onBillingPeriodChanged,\n availableBillingPeriods,\n}: {\n discountRate: number;\n selectedBillingPeriod: BillingPeriod;\n onBillingPeriodChanged: (billingPeriod: BillingPeriod) => void;\n availableBillingPeriods: BillingPeriod[];\n}) {\n if (availableBillingPeriods.length <= 1) {\n return null;\n }\n\n const isMonthlyBillingPeriod = selectedBillingPeriod === BillingPeriod.Monthly;\n\n return (\n <PickerContainer className=\"stigg-period-picker-container\">\n <PeriodText\n variant=\"h6\"\n className=\"stigg-monthly-period-text\"\n color={isMonthlyBillingPeriod ? 'primary' : 'disabled'}>\n Monthly\n </PeriodText>\n <StyledSwitch\n className=\"stigg-period-switch\"\n uncheckedIcon={false}\n checkedIcon={false}\n height={16}\n width={33}\n onChange={(isAnnuallySelected) =>\n onBillingPeriodChanged(isAnnuallySelected ? BillingPeriod.Annually : BillingPeriod.Monthly)\n }\n checked={!isMonthlyBillingPeriod}\n borderRadius={10}\n handleDiameter={19}\n />\n <PeriodText\n variant=\"h6\"\n className=\"stigg-annual-period-text\"\n color={!isMonthlyBillingPeriod ? 'primary' : 'disabled'}>\n Annual\n </PeriodText>\n {discountRate !== 0 && <DiscountRate discount={discountRate} disabled={isMonthlyBillingPeriod} />}\n </PickerContainer>\n );\n}\n","import { BillingPeriod, PaywallCalculatedPricePoint, Price } from '@stigg/js-client-sdk';\nimport isNil from 'lodash/isNil';\nimport { PaywallPlan } from '../paywall';\nimport { calculateTierPrice } from './priceTierUtils';\n\nexport function calculateDiscountRate(monthlyPrice?: number | null, annuallyPrice?: number | null) {\n if (!isNil(monthlyPrice) && !isNil(annuallyPrice)) {\n const annuallyPerMonthPrice = annuallyPrice / 12;\n return Math.round(((monthlyPrice - annuallyPerMonthPrice) / monthlyPrice) * 100);\n }\n\n return null;\n}\n\nfunction getPlanBillingPeriodAmount(plan: PaywallPlan, billingPeriod: BillingPeriod) {\n let pricePoint: PaywallCalculatedPricePoint | Price | undefined;\n\n pricePoint = plan.paywallCalculatedPricePoints?.find((price) => price.billingPeriod === billingPeriod);\n\n if (!pricePoint) {\n pricePoint = plan.pricePoints.find((price) => price.billingPeriod === billingPeriod);\n }\n\n if (!pricePoint?.amount) {\n const tieredPrice = plan.pricePoints.find((price) => {\n return price.isTieredPrice && price.billingPeriod === billingPeriod;\n });\n\n if (tieredPrice) {\n return calculateTierPrice(tieredPrice, 1);\n }\n }\n\n return pricePoint?.amount;\n}\n\nexport function calculatePaywallDiscountRate(plans: PaywallPlan[]) {\n return plans.reduce((maxDiscount, plan) => {\n const monthlyAmount = getPlanBillingPeriodAmount(plan, BillingPeriod.Monthly);\n const annuallyAmount = getPlanBillingPeriodAmount(plan, BillingPeriod.Annually);\n\n const discountRate = calculateDiscountRate(monthlyAmount, annuallyAmount);\n if (discountRate) {\n maxDiscount = Math.max(maxDiscount, discountRate);\n }\n\n return maxDiscount;\n }, 0);\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport PoweredByStiggSvg from '../../assets/powered-by-stigg.svg';\n\nexport const STIGG_WATERMARK_CLASSNAME = 'stigg-watermark';\n\nexport type PoweredByStiggSources = 'paywall' | 'customer_portal' | 'checkout';\n\nconst PoweredByStiggThemedSvg = styled(PoweredByStiggSvg)`\n * {\n fill: ${({ theme }) => theme.stigg.palette.text.secondary};\n }\n`;\n\ntype PoweredByStiggProps = {\n source: PoweredByStiggSources;\n showWatermark?: boolean;\n style?: React.CSSProperties;\n align?: 'center' | 'end';\n};\n\nconst StyledPoweredByStigg = styled.div<{ $alignSelf?: string }>`\n align-self: ${({ $alignSelf }) => $alignSelf || 'unset'};\n\n @media (max-width: 1040px) {\n align-self: center;\n }\n`;\n\nexport function PoweredByStigg({ source, showWatermark, align, style = {} }: PoweredByStiggProps) {\n if (!showWatermark) {\n return null;\n }\n\n const onWatermarkClick = () => {\n const sourceDomain = window.location.hostname.replace('www.', '');\n window.open(\n `https://www.stigg.io/?utm_source=${sourceDomain}&utm_medium=referral&utm_campaign=${source}`,\n '_blank',\n );\n };\n\n return (\n <StyledPoweredByStigg\n $alignSelf={align}\n className={STIGG_WATERMARK_CLASSNAME}\n style={{ cursor: 'pointer', ...style }}\n onClick={onWatermarkClick}>\n <PoweredByStiggThemedSvg />\n </StyledPoweredByStigg>\n );\n}\n","import { BillingPeriod } from '@stigg/js-client-sdk';\nimport { PaywallPlan } from '../types';\n\nexport function hasPricePoints(plan: PaywallPlan, billingPeriod: BillingPeriod): boolean {\n return plan.pricePoints.some((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n}\n\nexport function hasPricePointsForPlans(plans: PaywallPlan[], billingPeriod: BillingPeriod): boolean {\n return plans.some((plan) => hasPricePoints(plan, billingPeriod));\n}\n","import { BillableFeature, BillingPeriod, Customer, Plan, PricingType, Subscription } from '@stigg/js-client-sdk';\nimport React, { useCallback, useMemo } from 'react';\nimport styled from '@emotion/styled/macro';\nimport { PlanOffering } from './PlanOffering';\nimport { BillingPeriodPicker } from './BillingPeriodPicker';\nimport { calculatePaywallDiscountRate } from '../utils/calculateDiscountRate';\nimport {\n ShouldHidePlanFn,\n OnPlanSelectedCallbackFn,\n PaywallPlan,\n SubscribeIntentionType,\n SelectDefaultTierIndexFn,\n CurrentSubscriptionOverride,\n} from './types';\nimport { PaywallLocalization } from './paywallTextOverrides';\nimport { PoweredByStigg } from '../common/PoweredByStigg';\nimport { useStiggContext } from '../..';\nimport { hasPricePointsForPlans } from './utils/hasPricePoints';\nimport { getPlansToDisplay } from './utils/getPlansToDisplay';\nimport { getPlanPrice } from '../utils/getPlanPrice';\nimport { getTiersPerUnitQuantities } from '../utils/priceTierUtils';\n\nconst PaywallPlansContainer = styled.div`\n color: ${({ theme }) => theme.stigg.palette.text.primary};\n display: flex;\n align-items: stretch;\n justify-content: center;\n flex-wrap: wrap;\n padding: 10px 0;\n gap: ${({ theme }) => theme.stigg.layout.planMargin};\n`;\n\nconst PaywallContainer = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n\n & * {\n box-sizing: border-box;\n }\n`;\n\nconst PaywallLayout = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n`;\n\ntype PaywallProps = {\n plans: PaywallPlan[];\n customer: Customer | null;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride?: CurrentSubscriptionOverride | null;\n selectedBillingPeriod: BillingPeriod;\n highlightedPlanId?: string;\n onBillingPeriodChanged: (billingPeriod: BillingPeriod) => void;\n availableBillingPeriods: BillingPeriod[];\n isCustomerOnTrial: boolean;\n onPlanSelected: OnPlanSelectedCallbackFn;\n paywallLocale: PaywallLocalization;\n locale: string;\n shouldHidePlan?: ShouldHidePlanFn;\n selectDefaultTierIndex?: SelectDefaultTierIndexFn;\n hideCompatibleAddons?: boolean;\n};\n\nexport const Paywall = ({\n plans,\n customer,\n currentSubscription,\n highlightedPlanId,\n selectedBillingPeriod,\n onBillingPeriodChanged,\n availableBillingPeriods,\n isCustomerOnTrial,\n onPlanSelected,\n paywallLocale,\n locale,\n shouldHidePlan,\n selectDefaultTierIndex,\n currentSubscriptionOverride,\n hideCompatibleAddons,\n}: PaywallProps) => {\n const { stigg } = useStiggContext();\n const discountRate = calculatePaywallDiscountRate(plans);\n const shouldShowDescriptionSection = plans.some((plan) => !!plan.description);\n const hasMonthlyPrice = hasPricePointsForPlans(plans, BillingPeriod.Monthly);\n const hasAnnuallyPrice = hasPricePointsForPlans(plans, BillingPeriod.Annually);\n const plansToShow = getPlansToDisplay(plans, selectedBillingPeriod, shouldHidePlan);\n\n const handleOnSubscribe = useCallback(\n (plan: Plan, intentionType: SubscribeIntentionType, billableFeatures: BillableFeature[]) => {\n return onPlanSelected({\n plan,\n customer,\n subscription: currentSubscription,\n intentionType,\n selectedBillingPeriod,\n billableFeatures,\n });\n },\n [customer, selectedBillingPeriod, currentSubscription, onPlanSelected],\n );\n\n const isCustomerInCustomPlan = !!currentSubscription && currentSubscription.plan.pricingType === PricingType.Custom;\n\n const withStartingAtRow = useMemo(\n () =>\n plansToShow.some((plan) => {\n const planPrices = plan.pricePoints.filter((pricePoint) => pricePoint.billingPeriod === selectedBillingPeriod);\n const paywallCalculatedPrice = plan.paywallCalculatedPricePoints?.find(\n (pricePoint) => pricePoint.billingPeriod === selectedBillingPeriod,\n );\n return planPrices.length > 1 && !!paywallCalculatedPrice?.additionalChargesMayApply;\n }),\n [selectedBillingPeriod, plansToShow],\n );\n\n const withUnitPriceRow = useMemo(\n () =>\n plansToShow.some((plan) => {\n return !!getPlanPrice(plan, selectedBillingPeriod, paywallLocale, locale, hasMonthlyPrice).unit;\n }),\n [selectedBillingPeriod, hasMonthlyPrice, locale, paywallLocale, plansToShow],\n );\n\n const withTiersRow = useMemo(() => {\n return (\n !isCustomerInCustomPlan &&\n plansToShow.some((plan) => {\n const tiers = getTiersPerUnitQuantities({\n plan,\n billingPeriod: selectedBillingPeriod,\n currentSubscription,\n currentSubscriptionOverride,\n });\n return Object.values(tiers).length > 0;\n })\n );\n }, [selectedBillingPeriod, currentSubscription, currentSubscriptionOverride, isCustomerInCustomPlan, plansToShow]);\n\n const withTrialLeftRow = plansToShow.some((plan) => {\n return plan.isCurrentCustomerPlan && plan.trialDaysLeft;\n });\n\n return (\n <PaywallContainer className=\"stigg-paywall-container\">\n <PaywallLayout className=\"stigg-paywall-layout\">\n <BillingPeriodPicker\n onBillingPeriodChanged={onBillingPeriodChanged}\n selectedBillingPeriod={selectedBillingPeriod}\n availableBillingPeriods={availableBillingPeriods}\n discountRate={discountRate}\n />\n\n <PaywallPlansContainer className=\"stigg-paywall-plans-layout\">\n {plansToShow.map((plan) => (\n <PlanOffering\n withUnitPriceRow={withUnitPriceRow}\n withTiersRow={withTiersRow}\n withTrialLeftRow={withTrialLeftRow}\n key={plan.id}\n shouldShowDescriptionSection={shouldShowDescriptionSection}\n hasMonthlyPrice={hasMonthlyPrice}\n hasAnnuallyPrice={hasAnnuallyPrice}\n plan={plan}\n withStartingAtRow={withStartingAtRow}\n currentSubscription={currentSubscription}\n currentSubscriptionOverride={currentSubscriptionOverride}\n billingPeriod={selectedBillingPeriod}\n isHighlighted={plan.id === highlightedPlanId}\n isCustomerOnTrial={isCustomerOnTrial}\n onPlanSelected={(intentionType: SubscribeIntentionType, billableFeatures: BillableFeature[]) =>\n handleOnSubscribe(plan, intentionType, billableFeatures)\n }\n paywallLocale={paywallLocale}\n locale={locale}\n customer={customer}\n isCustomerInCustomPlan={isCustomerInCustomPlan}\n selectDefaultTierIndex={selectDefaultTierIndex}\n hideCompatibleAddons={hideCompatibleAddons}\n />\n ))}\n </PaywallPlansContainer>\n <PoweredByStigg\n source=\"paywall\"\n align=\"end\"\n style={{ marginTop: 16 }}\n showWatermark={stigg.isWidgetWatermarkEnabled}\n />\n </PaywallLayout>\n </PaywallContainer>\n );\n};\n","import { BillingPeriod, PricingType } from '@stigg/js-client-sdk';\nimport { ShouldHidePlanFn, PaywallPlan } from '../types';\nimport { hasPricePoints } from './hasPricePoints';\n\nexport function getPlansToDisplay(\n plans: PaywallPlan[],\n selectedBillingPeriod: BillingPeriod,\n shouldHidePlan?: ShouldHidePlanFn,\n): PaywallPlan[] {\n return plans\n .filter((plan) => plan.pricingType !== PricingType.Paid || hasPricePoints(plan, selectedBillingPeriod))\n .filter((plan) => !shouldHidePlan || !shouldHidePlan({ plan }));\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","export interface Logger {\n log: (message: string, object?: Record<string, string>) => void;\n debug: (message: string, object?: Record<string, string>) => void;\n error: (message: string, error?: Error, ...params: Record<string, string>[]) => void;\n}\n\nexport class LoggerService implements Logger {\n error(message: string, error?: Error, ...params: Record<string, string>[]): void {\n console.error(message, error || {}, params);\n }\n\n log(message: string, object?: Record<string, string>): void {\n console.log(message, object || {});\n }\n\n debug(message: string, object?: Record<string, string> | undefined): void {\n console.debug(message, object || {});\n }\n}\n\n// Export a singleton logger service, in the future we might allow to user to configure external logger\nexport default new LoggerService();\n","import { BillingPeriod, Plan, Subscription, SubscriptionStatus } from '@stigg/js-client-sdk';\nimport { countBy, uniq } from 'lodash';\n\nexport function computeBillingPeriods(\n plans: Plan[],\n activeSubscriptions?: Subscription[] | null,\n preferredBillingPeriod?: BillingPeriod,\n): { defaultBillingPeriod: BillingPeriod; availableBillingPeriods: BillingPeriod[] } {\n const billingPeriods = plans.flatMap((x) => x.pricePoints).map((x) => x.billingPeriod);\n const counts = countBy(billingPeriods);\n\n const availableBillingPeriods = uniq(billingPeriods);\n let defaultBillingPeriod: BillingPeriod | undefined;\n\n if (preferredBillingPeriod && availableBillingPeriods.includes(preferredBillingPeriod)) {\n defaultBillingPeriod = preferredBillingPeriod;\n } else if (activeSubscriptions) {\n const activeSubscription = activeSubscriptions.find((x) => x.status === SubscriptionStatus.Active);\n\n if (activeSubscription && activeSubscription.prices.length > 0) {\n defaultBillingPeriod = activeSubscription?.prices[0].billingPeriod;\n }\n }\n\n if (!defaultBillingPeriod) {\n defaultBillingPeriod =\n (counts[BillingPeriod.Monthly] || 0) > (counts[BillingPeriod.Annually] || 0)\n ? BillingPeriod.Monthly\n : BillingPeriod.Annually;\n }\n\n return { defaultBillingPeriod, availableBillingPeriods };\n}\n","import { FontWeight, TypographyConfiguration } from '@stigg/js-client-sdk';\n\nexport const defaultCheckoutTypography: TypographyConfiguration = {\n h1: {\n fontSize: 24,\n fontWeight: FontWeight.Bold,\n },\n h2: {\n fontSize: 16,\n fontWeight: FontWeight.Normal,\n },\n h3: {\n fontSize: 16,\n fontWeight: FontWeight.Normal,\n },\n body: {\n fontSize: 14,\n fontWeight: FontWeight.Normal,\n },\n};\n","import {\n Alignment,\n CheckoutConfiguration,\n CustomerPortalConfiguration,\n FontWeight as JSFontWeight,\n PaywallConfiguration,\n TypographyConfiguration,\n} from '@stigg/js-client-sdk';\nimport { CustomizedTheme } from '../../theme/Theme';\nimport { HorizontalAlignment, FontWeight } from '../../theme/types';\nimport { defaultCheckoutTypography } from '../checkout/configurations/typography';\n\nfunction addCssUnits(value?: number | null, unit = 'px') {\n if (!value) {\n return undefined;\n }\n return `${value}${unit}`;\n}\n\nfunction mapFontWeight(defaultValue: FontWeight, fontWeight?: JSFontWeight | null): FontWeight {\n if (!fontWeight) {\n return defaultValue;\n }\n\n switch (fontWeight) {\n case JSFontWeight.Normal:\n return 'normal';\n case JSFontWeight.Bold:\n return 'bold';\n default:\n return 'normal';\n }\n}\n\nexport function mapTypography(\n typography?: TypographyConfiguration | null,\n defaultTypography?: TypographyConfiguration | null,\n): CustomizedTheme['typography'] {\n return {\n fontFamilyUrl: typography?.fontFamily || undefined,\n h1: {\n fontSize: addCssUnits(typography?.h1?.fontSize || defaultTypography?.h1?.fontSize),\n fontWeight: mapFontWeight('bold', typography?.h1?.fontWeight || defaultTypography?.h1?.fontWeight),\n },\n h2: {\n fontSize: addCssUnits(typography?.h2?.fontSize || defaultTypography?.h2?.fontSize),\n fontWeight: mapFontWeight('normal', defaultTypography?.h2?.fontWeight),\n },\n h3: {\n fontSize: addCssUnits(typography?.h3?.fontSize || defaultTypography?.h3?.fontSize),\n fontWeight: mapFontWeight('normal', typography?.h3?.fontWeight || defaultTypography?.h3?.fontWeight),\n },\n body: {\n fontSize: addCssUnits(typography?.body?.fontSize || defaultTypography?.body?.fontSize),\n fontWeight: mapFontWeight('normal', typography?.body?.fontWeight || defaultTypography?.body?.fontWeight),\n },\n };\n}\n\nfunction mapAlignment(alignment?: Alignment | null): HorizontalAlignment | undefined {\n if (!alignment) {\n return undefined;\n }\n\n switch (alignment) {\n case Alignment.Left:\n return 'left';\n case Alignment.Center:\n return 'center';\n case Alignment.Right:\n return 'right';\n default: {\n return undefined;\n }\n }\n}\n\nexport function mapCustomerPortalConfiguration(configuration: CustomerPortalConfiguration): CustomizedTheme {\n const { palette, customCss, typography } = configuration;\n return {\n palette: {\n primary: palette?.primary || undefined,\n backgroundPaper: palette?.paywallBackgroundColor || undefined,\n outlinedBorder: palette?.borderColor || undefined,\n backgroundHighlight: palette?.currentPlanBackground || undefined,\n text: {\n primary: palette?.textColor || undefined,\n },\n },\n typography: mapTypography(typography),\n customCss: customCss || undefined,\n };\n}\n\nexport function mapPaywallConfiguration(paywallConfiguration: PaywallConfiguration): CustomizedTheme {\n const { palette, layout, customCss, typography } = paywallConfiguration;\n return {\n customCss: customCss || undefined,\n palette: {\n primary: palette?.primary || undefined,\n backgroundPaper: palette?.backgroundColor || undefined,\n outlinedBorder: palette?.borderColor || undefined,\n backgroundHighlight: palette?.currentPlanBackground || undefined,\n text: {\n primary: palette?.textColor || undefined,\n },\n },\n typography: mapTypography(typography),\n layout: {\n ctaAlignment: mapAlignment(layout?.alignment),\n headerAlignment: mapAlignment(layout?.alignment),\n descriptionAlignment: mapAlignment(layout?.alignment),\n planMaxWidth: addCssUnits(layout?.planWidth),\n planMinWidth: addCssUnits(layout?.planWidth),\n planMargin: addCssUnits(layout?.planMargin),\n planPadding: addCssUnits(layout?.planPadding),\n },\n };\n}\n\nexport function mapCheckoutConfiguration(configuration: CheckoutConfiguration): CustomizedTheme {\n const { palette, typography, customCss } = configuration;\n return {\n palette: {\n primary: palette?.primary || undefined,\n backgroundPaper: palette?.backgroundColor || undefined,\n outlinedBorder: palette?.borderColor || undefined,\n text: {\n primary: palette?.textColor || undefined,\n },\n backgroundHighlight: palette?.summaryBackgroundColor || undefined,\n },\n typography: mapTypography(typography, defaultCheckoutTypography),\n customCss: customCss || undefined,\n };\n}\n","<svg width=\"15\" height=\"11\" viewBox=\"0 0 15 11\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.59 7.9899L2.125 4.5249C1.73524 4.13514 1.10365 4.13402 0.712509 4.52241V4.52241C0.319409 4.91274 0.318286 5.54819 0.710005 5.9399L5.59 10.8199L14.2948 2.11513C14.6843 1.72565 14.6843 1.09417 14.2948 0.704691V0.704691C13.9055 0.315381 13.2743 0.315184 12.8848 0.70425L5.59 7.9899Z\" fill=\"#B2BBD3\"/>\n</svg>\n","import React, { useEffect, useState, PropsWithChildren, useRef } from 'react';\nimport * as StiggJs from '@stigg/js-client-sdk';\nimport Stigg, { ClientConfiguration, EntitlementsFallback } from '@stigg/js-client-sdk';\nimport { SkeletonTheme } from 'react-loading-skeleton';\nimport { CustomizedTheme } from '../theme/Theme';\nimport logger from '../services/logger';\nimport { name as CLIENT_NAME, version as CLIENT_VERSION } from '../../package.json';\n\nexport interface StiggContextValue {\n stigg: StiggJs.StiggClient;\n isInitialized: boolean;\n locale: string;\n updatedAt?: Date;\n customerPortalUpdatedAt?: Date;\n refreshData: () => Promise<void>;\n theme?: CustomizedTheme;\n}\n\nexport const StiggContext = React.createContext<StiggContextValue | null>(null);\nStiggContext.displayName = 'StiggContext';\n\nexport type StiggProviderProps = {\n apiKey: string;\n baseUri?: string;\n baseEdgeUri?: string;\n enableEdge?: boolean;\n entitlementsFallback?: EntitlementsFallback;\n customerId?: string;\n customerToken?: string;\n resourceId?: string;\n theme?: CustomizedTheme;\n locale?: string;\n offline?: boolean;\n cacheTtlMs?: number;\n /** @deprecated not longer in use */\n useEntitlementPolling?: boolean;\n /** @deprecated not longer in use */\n entitlementPollingInterval?: number;\n stiggClient?: StiggJs.StiggClient;\n clientName?: string;\n clientVersion?: string;\n};\n\nconst DEFAULT_LOCALE = 'en-US';\n\nexport const StiggProvider: React.FC<PropsWithChildren<StiggProviderProps>> = ({\n apiKey,\n baseUri,\n baseEdgeUri,\n enableEdge,\n customerId,\n customerToken,\n resourceId,\n theme,\n locale,\n cacheTtlMs,\n useEntitlementPolling,\n entitlementPollingInterval,\n entitlementsFallback,\n stiggClient,\n children,\n offline,\n clientName = CLIENT_NAME,\n clientVersion = CLIENT_VERSION,\n}) => {\n const currentApiKey = useRef(apiKey);\n const initializeParams: ClientConfiguration = {\n apiKey,\n customerId,\n customerToken,\n resourceId,\n baseUri,\n baseEdgeUri,\n enableEdge,\n entitlementsFallback,\n cacheTtlMs,\n useEntitlementPolling,\n entitlementPollingInterval,\n clientName,\n clientVersion,\n offline,\n };\n const [ctx, setContext] = useState<StiggContextValue>(() => ({\n stigg:\n stiggClient ??\n Stigg.initialize({\n ...initializeParams,\n lazyLoad: true,\n }),\n locale: locale || DEFAULT_LOCALE,\n isInitialized: false,\n theme,\n refreshData: async () => {\n setContext((ctx) => ({ ...ctx, customerPortalUpdatedAt: new Date() }));\n await ctx.stigg.refresh();\n },\n }));\n\n useEffect(() => {\n let isMounted = true;\n\n const safeSetContext = (setContextFunc: React.SetStateAction<StiggContextValue>) => {\n if (isMounted) {\n setContext(setContextFunc);\n }\n };\n\n const onEntitlementsUpdated = () => safeSetContext((ctx) => ({ ...ctx, updatedAt: new Date() }));\n\n const setStiggInstance = (stigg: StiggJs.StiggClient) =>\n safeSetContext((ctx) => {\n if (ctx.stigg) {\n ctx.stigg.removeListener('entitlementsUpdated', onEntitlementsUpdated);\n }\n stigg.addListener('entitlementsUpdated', onEntitlementsUpdated);\n\n return {\n ...ctx,\n stigg,\n isInitialized: true,\n updatedAt: new Date(),\n };\n });\n\n const loadStiggClient = async () => {\n let stiggClient = ctx.stigg;\n if (apiKey !== currentApiKey.current) {\n logger.log('Updating stigg client', { apiKey });\n currentApiKey.current = apiKey;\n stiggClient = Stigg.initialize({\n ...initializeParams,\n });\n safeSetContext((ctx) => ({ ...ctx, isInitialized: false, updatedAt: new Date() }));\n }\n await stiggClient.waitForInitialization();\n setStiggInstance(stiggClient);\n };\n\n void loadStiggClient();\n\n return () => {\n isMounted = false;\n ctx.stigg.removeListener('entitlementsUpdated', onEntitlementsUpdated);\n ctx.stigg.clearCustomer();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [apiKey]);\n\n useEffect(() => {\n const stiggClient = ctx.stigg;\n if (customerId) {\n void stiggClient.setCustomerId(customerId, customerToken, resourceId);\n } else {\n stiggClient.clearCustomer();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [customerId, customerToken, resourceId]);\n\n useEffect(() => {\n setContext((ctx) => ({ ...ctx, theme }));\n }, [theme]);\n\n return (\n <StiggContext.Provider value={ctx}>\n <SkeletonTheme baseColor=\"#F5F6F9\" highlightColor=\"#e5e6ea\">\n {children}\n </SkeletonTheme>\n </StiggContext.Provider>\n );\n};\n","import { useContext } from 'react';\nimport { StiggContext, StiggContextValue } from '../components/StiggProvider';\n\nexport function useStiggContext(options?: { optional?: false }): StiggContextValue;\nexport function useStiggContext(options: { optional: true }): StiggContextValue | null;\nexport function useStiggContext(options?: { optional?: boolean }): StiggContextValue | null {\n const { optional } = options || {};\n const ctx = useContext(StiggContext);\n if (!ctx && !optional) {\n throw new Error('Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.');\n }\n return ctx;\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport Skeleton from 'react-loading-skeleton';\nimport CheckUrl from '../../assets/check-stigg.svg';\n\nconst SkeletonContainer = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n`;\n\nconst EntitlementCheckIcon = styled(CheckUrl)`\n margin-right: 16px;\n`;\n\nconst PlanOfferingSkeleton = styled.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 20px;\n border-radius: 10px;\n padding: ${({ theme }) => theme.stigg.layout.planPadding};\n background-color: ${({ theme }) => theme.stigg.palette.backgroundPaper};\n min-width: ${({ theme }) => theme.stigg.layout.planMinWidth};\n max-width: ${({ theme }) => theme.stigg.layout.planMaxWidth};\n min-height: 450px;\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedBorder}`};\n`;\n\nconst PlansContainer = styled.div`\n display: flex;\n gap: ${({ theme }) => theme.stigg.layout.planMargin};\n flex-wrap: wrap;\n justify-content: center;\n`;\n\nconst EntitlementContainer = styled.div`\n display: flex;\n align-items: center;\n margin-bottom: 12px;\n`;\n\nconst FooterSkeletonLoader = styled.div`\n margin-top: auto;\n`;\n\nconst BillingPeriodLoader = styled.div`\n width: 150px;\n margin-bottom: ${({ theme }) => theme.stigg.layout.switchBottomSpacing};\n padding: 12px 12px;\n border-radius: 10px;\n background-color: white;\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedBorder}`};\n`;\n\nfunction PlanOfferingLoader() {\n return (\n <PlanOfferingSkeleton>\n <Skeleton width={120} borderRadius={4} />\n <Skeleton circle width={40} height={40} />\n <Skeleton style={{ marginBottom: 33 }} width={120} borderRadius={4} />\n\n <EntitlementContainer>\n <EntitlementCheckIcon />\n <Skeleton width={120} borderRadius={4} />\n </EntitlementContainer>\n <EntitlementContainer>\n <EntitlementCheckIcon />\n <Skeleton width={120} borderRadius={4} />\n </EntitlementContainer>\n <EntitlementContainer>\n <EntitlementCheckIcon />\n <Skeleton width={120} borderRadius={4} />\n </EntitlementContainer>\n\n <FooterSkeletonLoader>\n <Skeleton height={50} borderRadius={4} />\n </FooterSkeletonLoader>\n </PlanOfferingSkeleton>\n );\n}\n\nexport function PaywallLoader() {\n return (\n <SkeletonContainer className=\"stigg-skeleton-loader-container\">\n <BillingPeriodLoader className=\"stigg-skeleton-loader-billing-period\">\n <Skeleton borderRadius={4} />\n </BillingPeriodLoader>\n\n <PlansContainer className=\"stigg-skeleton-loader-plans-container\">\n <PlanOfferingLoader />\n <PlanOfferingLoader />\n <PlanOfferingLoader />\n </PlansContainer>\n </SkeletonContainer>\n );\n}\n","import React from 'react';\nimport { Global, css } from '@emotion/react';\n\nexport const Fonts = ({ externalFontUrl }: { externalFontUrl?: string }) => {\n return (\n <Global\n styles={css`\n ${externalFontUrl &&\n `\n @font-face {\n font-family: 'custom-font';\n font-style: normal;\n font-weight: normal;\n src: local('custom-font'), url(${externalFontUrl}) format('woff');\n }\n `}\n\n /* latin-ext */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Hp2ywxg089UriCZ2IHTWEBlwu8Q.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F,\n U+A720-A7FF;\n }\n /* latin */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Hp2ywxg089UriCZOIHTWEBlw.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,\n U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n }\n /* latin-ext */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Cp2ywxg089UriAWCrCBamC3YU-CnE6Q.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F,\n U+A720-A7FF;\n }\n /* latin */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Cp2ywxg089UriAWCrCBimC3YU-Ck.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,\n U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n }\n /* latin-ext */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 700;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Cp2ywxg089UriASitCBamC3YU-CnE6Q.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F,\n U+A720-A7FF;\n }\n /* latin */\n @font-face {\n font-family: 'DM Sans';\n font-style: normal;\n font-weight: 700;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dmsans/v11/rP2Cp2ywxg089UriASitCBimC3YU-Ck.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,\n U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n }\n `}\n />\n );\n};\n","import { merge } from 'lodash';\nimport React, { PropsWithChildren } from 'react';\nimport { ThemeProvider as StyledThemeProvider } from 'styled-components';\nimport { TypographyProps } from 'styled-typography';\nimport { css, ThemeProvider } from '@emotion/react';\nimport styled from '@emotion/styled/macro';\nimport { createTheme, ThemeProvider as MuiThemeProvider, THEME_ID } from '@mui/material/styles';\n\nimport { DeepPartial } from '../types';\nimport { Fonts } from './Fonts';\nimport { getResolvedTheme } from './getResolvedTheme';\nimport { StiggTheme } from './types';\nimport { useStiggContext } from '../hooks/useStiggContext';\n\nexport type CustomizedTheme = DeepPartial<StiggTheme>;\n\nconst CustomCssGlobal = styled.div<{ customCss?: string }>`\n ${({ customCss }) =>\n customCss &&\n css`\n ${customCss}\n `}\n`;\n\ntype SdkThemeProviderProps = {\n componentTheme?: CustomizedTheme;\n};\n\n/*\n This merge the theme from 3 places:\n 1. External theme that we got from the user in StiggProvider\n 2. Remote theme from api\n 3. Default theme\n*/\nexport function useStiggTheme(remoteThemeOverride?: CustomizedTheme): StiggTheme {\n const { theme: externalTheme } = useStiggContext();\n const mergedTheme = merge(remoteThemeOverride, externalTheme);\n const resolvedTheme = getResolvedTheme(mergedTheme);\n\n return resolvedTheme;\n}\n\nfunction createTypographyTheme(theme: StiggTheme): Partial<TypographyProps> {\n const { typography } = theme;\n const htmlFontSize = 16;\n const coef = Number(typography.body.fontSize.replace('px', '')) / 14;\n\n return {\n // Hack to fix theming issues\n // @ts-ignore\n pxToRem: (size) => `${(size / htmlFontSize) * coef}rem`,\n bodyFontFamily: typography.fontFamily,\n headingFontFamily: typography.fontFamily,\n fontSizes: [\n typography.h1.fontSize,\n typography.h2.fontSize,\n typography.h3.fontSize,\n typography.body.fontSize,\n '12px',\n '10px',\n ],\n };\n}\n\nconst createMuiPalette = (theme: StiggTheme) => {\n return {\n primary: {\n main: theme.palette.primary,\n },\n };\n};\n\nexport const SdkThemeProvider: React.FC<PropsWithChildren<SdkThemeProviderProps>> = ({ children, componentTheme }) => {\n const theme = useStiggTheme(componentTheme);\n const muiPalette = createMuiPalette(theme);\n const materialTheme = createTheme({ palette: muiPalette, stigg: theme });\n\n return (\n // We are using styled-components theme here only because we are using styled-typography\n // which depends on styled-components for the typography theming\n <MuiThemeProvider theme={{ [THEME_ID]: materialTheme }}>\n <ThemeProvider theme={{ stigg: theme }}>\n <CustomCssGlobal customCss={theme.customCss}>\n <Fonts externalFontUrl={theme.typography.fontFamilyUrl} />\n <StyledThemeProvider theme={{ typography: createTypographyTheme(theme) }}>{children}</StyledThemeProvider>\n </CustomCssGlobal>\n </ThemeProvider>\n </MuiThemeProvider>\n );\n};\n","import React, { useContext } from 'react';\nimport { CustomerPortal } from '@stigg/js-client-sdk';\nimport { useCustomerPortal } from './hooks/useCustomerPortal';\nimport { DeepPartial } from '../../types';\nimport { CustomerPortalLocalization, getResolvedCustomerPortalLocalize } from './customerPortalTextOverrides';\nimport { CustomerPortalTheme, getResolvedCustomerPortalTheme } from './customerPortalTheme';\nimport { SdkThemeProvider, useStiggTheme } from '../../theme/Theme';\nimport { useStiggContext } from '../..';\nimport { mapCustomerPortalConfiguration } from '../common/mapExternalTheme';\n\nexport interface CustomerPortalContextValue {\n customerPortal?: CustomerPortal | null;\n textOverrides: CustomerPortalLocalization;\n theme: CustomerPortalTheme;\n isLoading: boolean;\n resourceId?: string;\n}\n\nexport const CustomerPortalContext = React.createContext<CustomerPortalContextValue | null>(null);\nCustomerPortalContext.displayName = 'CustomerPortalContext';\n\nexport const useCustomerPortalContext = (): CustomerPortalContextValue => {\n const ctx = useContext(CustomerPortalContext);\n if (!ctx) {\n throw new Error(\n 'Could not find Customer portal context; You need to wrap your customer portal components in an <CustomerPortalProvider> component.',\n );\n }\n return ctx;\n};\n\nexport function useCheckContextExists<T>(contextType: React.Context<T>) {\n const ctx = useContext(contextType);\n return !!ctx;\n}\n\nexport function CustomerPortalProvider({\n children,\n textOverrides,\n theme,\n resourceId,\n productId,\n}: {\n children: React.ReactNode;\n textOverrides?: DeepPartial<CustomerPortalLocalization>;\n theme?: DeepPartial<CustomerPortalTheme>;\n resourceId?: string;\n productId?: string;\n}) {\n const { customerPortalUpdatedAt } = useStiggContext();\n const { customerPortal, isLoading } = useCustomerPortal({ resourceId, productId });\n const configuration = customerPortal?.configuration\n ? mapCustomerPortalConfiguration(customerPortal.configuration)\n : undefined;\n const globalTheme = useStiggTheme(configuration);\n const customerPortalTheme = getResolvedCustomerPortalTheme(globalTheme, theme, customerPortal?.configuration);\n const resolvedTextOverrides = getResolvedCustomerPortalLocalize(textOverrides);\n\n return (\n <SdkThemeProvider componentTheme={configuration}>\n <CustomerPortalContext.Provider\n key={customerPortalUpdatedAt?.toString()}\n value={{\n customerPortal,\n isLoading,\n textOverrides: resolvedTextOverrides,\n theme: customerPortalTheme,\n resourceId,\n }}>\n {children}\n </CustomerPortalContext.Provider>\n </SdkThemeProvider>\n );\n}\n","import { CustomerPortalConfiguration } from '@stigg/js-client-sdk';\nimport { StiggTheme } from '../../theme/types';\nimport { DeepPartial } from '../../types';\n\nexport type CustomerPortalTheme = {\n sectionTitleColor: string;\n planNameColor: string;\n backgroundColor: string;\n borderColor: string;\n listItemBackgroundColor: string;\n tabMaxHeight: string;\n iconsColor?: string;\n iconsBackgroundColor?: string;\n};\n\nexport function getResolvedCustomerPortalTheme(\n globalTheme: StiggTheme,\n themeOverride?: DeepPartial<CustomerPortalTheme>,\n remoteConfiguration?: CustomerPortalConfiguration | null,\n) {\n const customerPortalDefaultTheme: CustomerPortalTheme = {\n sectionTitleColor: themeOverride?.sectionTitleColor || globalTheme.palette.text.secondary,\n planNameColor: themeOverride?.planNameColor || globalTheme.palette.text.primary,\n backgroundColor: themeOverride?.backgroundColor || remoteConfiguration?.palette?.backgroundColor || 'white',\n borderColor: themeOverride?.borderColor || remoteConfiguration?.palette?.borderColor || 'rgba(0, 30, 108, 0.15)',\n listItemBackgroundColor: themeOverride?.backgroundColor || remoteConfiguration?.palette?.backgroundColor || 'white',\n tabMaxHeight: themeOverride?.tabMaxHeight || '380px',\n\n // add icons background color and apply to scheduled updates and customer support icons\n iconsColor: themeOverride?.iconsColor || remoteConfiguration?.palette?.iconsColor || undefined,\n iconsBackgroundColor: themeOverride?.iconsBackgroundColor,\n };\n\n return customerPortalDefaultTheme;\n}\n","import { CustomerPortal } from '@stigg/js-client-sdk';\nimport { useEffect, useState } from 'react';\nimport logger from '../../../services/logger';\nimport { useStiggContext } from '../../../hooks/useStiggContext';\n\ntype UseCustomerPortalProps = {\n resourceId?: string;\n productId?: string;\n};\n\nexport function useCustomerPortal({ resourceId, productId }: UseCustomerPortalProps) {\n const { stigg, customerPortalUpdatedAt } = useStiggContext();\n const [isLoading, setIsLoading] = useState(false);\n const [customerPortal, setCustomerPortal] = useState<CustomerPortal | null>();\n\n useEffect(() => {\n const loadCustomerPortal = async () => {\n if (stigg.isCustomerLoaded) {\n try {\n setIsLoading(true);\n const customerPortalData = await stigg.getCustomerPortal({ resourceId, productId });\n setCustomerPortal(customerPortalData);\n } catch (err) {\n logger.error(`Failed to load customer portal ${(err as any)?.message}`, err as any);\n } finally {\n setIsLoading(false);\n }\n }\n };\n\n void loadCustomerPortal();\n }, [stigg, stigg.isCustomerLoaded, customerPortalUpdatedAt, resourceId, productId]);\n\n return {\n customerPortal,\n isLoading,\n };\n}\n","import merge from 'lodash/merge';\nimport { DeepPartial } from '../../types';\n\nexport type CustomerPortalLocalization = {\n manageSubscription: string;\n usageTabTitle: string;\n addonsTabTitle: string;\n promotionsTabTitle: string;\n promotionsSubtitle: string;\n contactSupportTitle: string;\n contactSupportLink: string;\n editBilling: string;\n invoicesTitle: string;\n viewInvoiceHistory: string;\n editPaymentDetails: string;\n paywallSectionTitle: string;\n cancelScheduledUpdatesButtonTitle: string;\n};\n\nexport function getResolvedCustomerPortalLocalize(\n localizeOverride?: DeepPartial<CustomerPortalLocalization>,\n): CustomerPortalLocalization {\n const customerPortalDefaultLocalization: CustomerPortalLocalization = {\n manageSubscription: 'Manage',\n usageTabTitle: 'Usage',\n addonsTabTitle: 'Add-ons',\n promotionsTabTitle: 'Promotions',\n promotionsSubtitle: 'You were granted access to additional functionality at no additional cost.',\n contactSupportTitle: 'Have questions about your subscription?',\n contactSupportLink: 'Contact support',\n editBilling: 'Edit billing details',\n invoicesTitle: 'Invoices',\n viewInvoiceHistory: 'View invoice history',\n editPaymentDetails: 'Edit',\n paywallSectionTitle: 'Plans',\n cancelScheduledUpdatesButtonTitle: 'Cancel',\n };\n return merge(customerPortalDefaultLocalization, localizeOverride);\n}\n","<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M13.3333 2.5L17.5 6.66667L6.66667 17.5H2.5V13.3333L13.3333 2.5V2.5Z\" stroke=\"#327EEE\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","import styled from '@emotion/styled/macro';\nimport MuiButton from '@mui/material/Button';\n\nexport const StyledButton = styled(MuiButton)`\n border-radius: 10px;\n padding: 8px 16px;\n text-transform: none;\n\n &,\n &:hover {\n border-color: ${({ theme }) => theme.stigg.palette.outlinedRestingBorder};\n }\n`;\n","import { CustomerPortalEntitlement, CustomerPortalSubscription } from '@stigg/js-client-sdk';\nimport { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';\n\nexport type OnBuyMoreCallbackFn = (feature: FeatureFragment, entitlement: CustomerPortalEntitlement) => void;\n\nexport type FilterEntitlementsFn = (entitlements: CustomerPortalEntitlement[]) => CustomerPortalEntitlement[];\n\nexport enum CustomerPortalIntentionType {\n MANAGE_SUBSCRIPTION = 'MANAGE_SUBSCRIPTION',\n UPGRADE_PLAN = 'UPGRADE_PLAN',\n UPGRADE_TRIAL_PLAN = 'UPGRADE_TRIAL_PLAN',\n}\n\nexport type OnManageSubscriptionFn = ({\n intentionType,\n customerSubscriptions,\n}: {\n intentionType: CustomerPortalIntentionType;\n customerSubscriptions: CustomerPortalSubscription[];\n}) => Promise<void> | void;\n","import styled from '@emotion/styled/macro';\n\nexport const SectionHeader = styled.div<{ $disableMargin?: boolean }>`\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n ${({ $disableMargin }) =>\n !$disableMargin &&\n `\n &:not(:last-child) {\n margin-bottom: 32px;\n }\n `};\n`;\n","import React from 'react';\nimport Skeleton from 'react-loading-skeleton';\nimport { Typography } from '../../common/Typography';\nimport { useCustomerPortalContext } from '../CustomerPortalProvider';\n\nexport type SectionTitleProps = {\n title: string;\n className: string;\n isLoading?: boolean;\n};\n\nexport function SectionTitle({ title, className, isLoading }: SectionTitleProps) {\n const { theme } = useCustomerPortalContext();\n\n if (isLoading) {\n return <Skeleton width={120} />;\n }\n\n return (\n <Typography className={className} overrideColor={theme.sectionTitleColor} variant=\"h3\" bold>\n {title}\n </Typography>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { StyledButton } from '../common/StyledButton';\nimport { Typography } from '../../common/Typography';\nimport EditIcon from '../../../assets/edit-icon.svg';\nimport { CustomerPortalLocalization } from '../customerPortalTextOverrides';\nimport { SectionHeader } from '../common/SectionHeader';\nimport { SectionTitle } from '../common/SectionTitle';\nimport { OnManageClick } from '../CustomerPortalContainer';\nimport { CustomerPortalIntentionType } from '../types';\n\ntype SubscriptionsOverviewHeaderProps = {\n onManageSubscription: OnManageClick;\n hideManageButton: boolean;\n textOverrides: CustomerPortalLocalization;\n};\n\nconst StyledEditIcon = styled(EditIcon)`\n path {\n stroke: ${({ theme }) => theme.stigg.palette.primary};\n }\n`;\n\nexport function SubscriptionsOverviewHeader({\n onManageSubscription,\n hideManageButton,\n textOverrides,\n}: SubscriptionsOverviewHeaderProps) {\n return (\n <SectionHeader className=\"stigg-customer-portal-overview-header\" $disableMargin>\n <SectionTitle title=\"Subscription\" className=\"stigg-overview-title\" />\n {!hideManageButton && (\n <StyledButton\n className=\"stigg-manage-subscription-button\"\n variant=\"outlined\"\n onClick={() => onManageSubscription({ intentionType: CustomerPortalIntentionType.MANAGE_SUBSCRIPTION })}>\n <StyledEditIcon className=\"stigg-manage-subscription-button-image\" />\n <Typography\n className=\"stigg-manage-subscription-button-text\"\n color=\"primary.main\"\n style={{ marginLeft: '8px' }}\n variant=\"body1\">\n {textOverrides?.manageSubscription}\n </Typography>\n </StyledButton>\n )}\n </SectionHeader>\n );\n}\n","import flatMap from 'lodash/flatMap';\nimport isEmpty from 'lodash/isEmpty';\nimport React from 'react';\nimport { Typography } from '../../../common/Typography';\nimport { useCustomerPortalContext } from '../../CustomerPortalProvider';\n\nexport function AddonsList() {\n const { customerPortal } = useCustomerPortalContext();\n const addons = flatMap(customerPortal?.subscriptions, (subscription) => subscription.addons);\n if (isEmpty(addons)) {\n return null;\n }\n\n return (\n <div className=\"stigg-addons-list-layout\">\n {addons.map((addon, index) => (\n <Typography key={addon.addonId} span className=\"stigg-addon-list-item-text\" variant=\"body1\">\n {addon.quantity > 1 && `${addon.quantity} X `}\n {addon.displayName}\n {index === addons.length - 1 ? '' : ', '}\n </Typography>\n ))}\n </div>\n );\n}\n","import { CustomerPortalPromotionalEntitlement } from '@stigg/js-client-sdk';\nimport moment from 'moment';\nimport React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { Typography } from '../../../common/Typography';\nimport { useCustomerPortalContext } from '../../CustomerPortalProvider';\n\nconst Row = styled.div<{ $borderColor: string }>`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 64px;\n border-bottom: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n padding: 16px 0;\n\n & > *:first-of-type {\n max-width: 60%;\n }\n`;\n\nfunction getPromotionTitle(promotionalEntitlement: CustomerPortalPromotionalEntitlement) {\n const { displayName, usageLimit, hasUnlimitedUsage } = promotionalEntitlement;\n\n if (hasUnlimitedUsage) {\n return `Unlimited ${displayName}`;\n }\n if (usageLimit) {\n return `${displayName} x ${promotionalEntitlement.usageLimit?.toLocaleString()}`;\n }\n\n return displayName;\n}\n\nexport function Promotions() {\n const { customerPortal, textOverrides, theme } = useCustomerPortalContext();\n const promotionalEntitlements = customerPortal?.promotionalEntitlements;\n\n return (\n <div style={{ display: 'flex', flexDirection: 'column' }}>\n <Typography color=\"secondary\">{textOverrides.promotionsSubtitle}</Typography>\n <div style={{ display: 'flex', flexDirection: 'column' }}>\n <Row $borderColor={theme.borderColor}>\n <Typography variant=\"body1\" bold>\n Feature\n </Typography>\n <Typography variant=\"body1\" bold>\n Expiration date\n </Typography>\n </Row>\n {promotionalEntitlements?.map((promotionalEntitlement, index) => (\n <Row key={`${promotionalEntitlement.displayName}-${index}`} $borderColor={theme.borderColor}>\n <Typography variant=\"body1\">{getPromotionTitle(promotionalEntitlement)}</Typography>\n <Typography variant=\"body1\" color=\"disabled\">\n {promotionalEntitlement.endDate\n ? moment.utc(promotionalEntitlement.endDate).format('MMM Do, YYYY')\n : 'None'}\n </Typography>\n </Row>\n ))}\n </div>\n </div>\n );\n}\n","import styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport Tabs from '@mui/material/Tabs';\n\nexport const StyledTabs = styled(Tabs)`\n .MuiTabs-indicator {\n background-color: #001e6c;\n }\n`;\n\nexport const TabsLayout = styled.div`\n width: 100%;\n flex: 1;\n margin-top: 16px;\n`;\n\nexport const TabContent = styled(Box, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{ $maxHeight: string }>`\n margin-top: 16px;\n max-height: ${({ $maxHeight }) => $maxHeight};\n overflow-y: auto;\n`;\n\nexport const ListBox = styled.div<{ $backgroundColor: string; $borderColor: string }>`\n display: flex;\n flex-direction: column;\n padding: 24px;\n border: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n border-radius: 10px;\n margin-bottom: 16px;\n row-gap: 16px;\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n`;\n","import React, { useState } from 'react';\nimport { CustomerPortal } from '@stigg/js-client-sdk';\nimport flatMap from 'lodash/flatMap';\nimport Box from '@mui/material/Box';\nimport Tab from '@mui/material/Tab';\nimport { FontWeight } from 'styled-typography';\nimport { Typography } from '../../../common/Typography';\nimport { AddonsList } from './AddonsList';\nimport { Promotions } from './Promotions';\nimport { CustomerPortalSection } from '../../CustomerPortal';\nimport { CustomerPortalLocalization } from '../../customerPortalTextOverrides';\nimport { StyledTabs, TabContent, TabsLayout } from './SubscriptionTabs.style';\nimport { CustomerPortalTheme } from '../../customerPortalTheme';\nimport { Icon, Icons } from '../../../common/Icon';\n\ntype TabPanelProps = {\n children?: React.ReactNode;\n index: number;\n value: number;\n maxHeight: string;\n};\n\nfunction TabPanel(props: TabPanelProps) {\n const { children, value, index, maxHeight, ...other } = props;\n\n return (\n <div role=\"tabpanel\" hidden={value !== index} {...other}>\n {value === index && <TabContent $maxHeight={maxHeight}>{children}</TabContent>}\n </div>\n );\n}\n\nexport type SubscriptionTabsProps = {\n customerPortal: CustomerPortal;\n hiddenSections?: CustomerPortalSection[];\n textOverrides: CustomerPortalLocalization;\n theme: CustomerPortalTheme;\n};\n\nfunction TabTitle({ isSelected, label, icon }: { isSelected: boolean; label: string; icon: Icons }) {\n const color = isSelected ? 'primary' : 'secondary';\n return (\n <div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>\n <Icon icon={icon} svgStrokeColor={color} />\n <Typography variant=\"h6\" bold={isSelected} fontWeight={FontWeight.Medium} color={color}>\n {label}\n </Typography>\n </div>\n );\n}\n\nexport function SubscriptionTabs({ customerPortal, hiddenSections, textOverrides, theme }: SubscriptionTabsProps) {\n const allAddons = flatMap(customerPortal.subscriptions, (subscription) => subscription.addons);\n const isSectionHidden = (sectionName: CustomerPortalSection) =>\n hiddenSections?.some((section) => section === sectionName);\n const showAddons = allAddons.length > 0 && !isSectionHidden('addons');\n const showPromotions =\n customerPortal.promotionalEntitlements.length > 0 && !isSectionHidden('promotionalEntitlements');\n const [value, setValue] = useState(showAddons ? 1 : 2);\n\n const handleChange = (_: React.SyntheticEvent, newValue: number) => {\n setValue(newValue);\n };\n const shouldShowTabs = showAddons || showPromotions;\n\n if (!shouldShowTabs) {\n return null;\n }\n\n return (\n <TabsLayout>\n <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>\n <StyledTabs value={value} onChange={handleChange}>\n {showAddons ? (\n <Tab\n sx={{ textTransform: 'none' }}\n value={1}\n label={<TabTitle isSelected={value === 1} label={textOverrides.addonsTabTitle} icon=\"Addons\" />}\n />\n ) : null}\n {showPromotions ? (\n <Tab\n sx={{ textTransform: 'none' }}\n value={2}\n label={<TabTitle isSelected={value === 2} label={textOverrides.promotionsTabTitle} icon=\"Promotions\" />}\n />\n ) : null}\n </StyledTabs>\n </Box>\n <TabPanel value={value} index={1} maxHeight={theme.tabMaxHeight}>\n <AddonsList />\n </TabPanel>\n <TabPanel value={value} index={2} maxHeight={theme.tabMaxHeight}>\n <Promotions />\n </TabPanel>\n </TabsLayout>\n );\n}\n","export const breakpoints = {\n xs: 320,\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n xxl: 1536,\n} as const;\n\nexport type Breakpoints = typeof breakpoints;\n\nexport type Breakpoint = keyof Breakpoints;\n\nexport const mqMinWidth = (breakpoint: Breakpoint) => `(min-width: ${breakpoints[breakpoint]}px)`;\n\nexport const mq = Object.keys(breakpoints).reduce(\n (obj, breakpoint) => ({ ...obj, [breakpoint]: `@media ${mqMinWidth(breakpoint as Breakpoint)}` }),\n {} as Record<Breakpoint, string>,\n);\n","import { useMediaQuery as useMediaQueryMui } from '@mui/material';\nimport { Breakpoint, mqMinWidth } from '../common/mediaQuery';\n\nexport function useIsScreenWiderThan(breakpoint: Breakpoint) {\n return useMediaQueryMui(mqMinWidth(breakpoint));\n}\n","import styled from '@emotion/styled/macro';\nimport React from 'react';\nimport Skeleton from 'react-loading-skeleton';\nimport { useIsScreenWiderThan } from '../../hooks/useIsScreenWiderThan';\n\nconst SkeletonLayout = styled.div`\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n`;\n\nconst SkeletonLayoutLeft = styled.div`\n display: flex;\n flex-direction: column;\n gap: 32px;\n`;\n\nexport function SubscriptionOverviewLoader() {\n const isScreenWiderThanMd = useIsScreenWiderThan('md');\n return (\n <SkeletonLayout className=\"stigg-subscription-overview-skeleton-layout\">\n <SkeletonLayoutLeft>\n <Skeleton width={120} />\n <Skeleton width={120} />\n </SkeletonLayoutLeft>\n <Skeleton width={isScreenWiderThanMd ? 295 : 260} height={193} />\n </SkeletonLayout>\n );\n}\n","import React from 'react';\nimport { ArrowDown } from 'react-feather';\nimport Grid from '@mui/material/Grid';\nimport {\n CustomerPortalSubscription,\n CustomerPortalSubscriptionScheduledUpdateDataFragment,\n SubscriptionScheduleType,\n BillingPeriod,\n} from '@stigg/js-client-sdk';\nimport { compact, map } from 'lodash';\nimport { Typography } from '../../../common/Typography';\nimport { BillingPeriodChangeVariables, UnitAmountChangeVariables } from '../../../../types';\n\nexport type SubscriptionScheduledUpdateRowProps = {\n scheduleUpdate: CustomerPortalSubscriptionScheduledUpdateDataFragment;\n};\n\nfunction SubscriptionScheduledUpdateDowngradeRow({ scheduleUpdate }: SubscriptionScheduledUpdateRowProps) {\n const { targetPackage } = scheduleUpdate;\n return (\n <Grid container alignItems=\"center\">\n <Grid>\n <ArrowDown color=\"#D94052\" height={20} className=\"stigg-scheduled-updates-arrow-down\" />\n </Grid>\n <Grid item>\n <Typography className=\"stigg-scheduled-updates-description\" variant=\"body1\">\n Downgrade to the <b>{targetPackage?.displayName}</b> plan\n </Typography>\n </Grid>\n </Grid>\n );\n}\n\nfunction SubscriptionScheduledUpdateBillingPeriodChangeRow({ scheduleUpdate }: SubscriptionScheduledUpdateRowProps) {\n const { scheduleVariables } = scheduleUpdate;\n const { billingPeriod } = scheduleVariables as BillingPeriodChangeVariables;\n const currentBillingPeriod = billingPeriod === BillingPeriod.Monthly ? 'annually' : 'monthly';\n const nextBillingPeriod = billingPeriod === BillingPeriod.Monthly ? 'monthly' : 'annually';\n\n return (\n <Grid container alignItems=\"center\">\n <Grid>\n <ArrowDown color=\"#D94052\" height={20} className=\"stigg-scheduled-updates-arrow-down\" />\n </Grid>\n <Grid item>\n <Typography className=\"stigg-scheduled-updates-description\" variant=\"body1\">\n Change from an {currentBillingPeriod} to a <b>{nextBillingPeriod}</b> billing cycle\n </Typography>\n </Grid>\n </Grid>\n );\n}\n\nfunction SubscriptionScheduledUpdateUnitQuantityChangeRow({\n subscription,\n scheduleUpdate,\n}: SubscriptionScheduledUpdateRowProps & { subscription: CustomerPortalSubscription }) {\n const { scheduleVariables } = scheduleUpdate;\n const { newUnitAmount, featureId } = scheduleVariables as UnitAmountChangeVariables;\n const feature = compact(map(subscription.prices, 'feature')).find(({ id }) => id === featureId);\n\n if (!feature) {\n return null;\n }\n\n const { featureUnits, featureUnitsPlural } = feature;\n const newQuantityUnits = newUnitAmount === 1 ? featureUnits : featureUnitsPlural;\n\n return (\n <Grid container alignItems=\"flex-start\" flexWrap=\"nowrap\">\n <Grid>\n <ArrowDown color=\"#D94052\" height={20} className=\"stigg-scheduled-updates-arrow-down\" />\n </Grid>\n <Grid item>\n <Typography className=\"stigg-scheduled-updates-description\" variant=\"body1\">\n Reduce the <b>{featureUnits}</b> quantity to {newUnitAmount} {newQuantityUnits}\n </Typography>\n </Grid>\n </Grid>\n );\n}\n\nexport function SubscriptionScheduledUpdateRow({\n scheduleUpdate,\n subscription,\n}: {\n scheduleUpdate: CustomerPortalSubscriptionScheduledUpdateDataFragment;\n subscription: CustomerPortalSubscription;\n}) {\n switch (scheduleUpdate.subscriptionScheduleType) {\n case SubscriptionScheduleType.Downgrade: {\n return <SubscriptionScheduledUpdateDowngradeRow scheduleUpdate={scheduleUpdate} />;\n }\n\n case SubscriptionScheduleType.BillingPeriod: {\n return <SubscriptionScheduledUpdateBillingPeriodChangeRow scheduleUpdate={scheduleUpdate} />;\n }\n\n case SubscriptionScheduleType.UnitAmount: {\n return (\n <SubscriptionScheduledUpdateUnitQuantityChangeRow scheduleUpdate={scheduleUpdate} subscription={subscription} />\n );\n }\n\n default: {\n return null;\n }\n }\n}\n","import React, { useState } from 'react';\nimport Box from '@mui/material/Box';\nimport Grid from '@mui/material/Grid';\nimport { CustomerPortalSubscription } from '@stigg/js-client-sdk';\nimport styled from '@emotion/styled/macro';\nimport { useTheme } from '@emotion/react';\nimport ClipLoader from 'react-spinners/ClipLoader';\nimport { CustomerPortalTheme } from '../../customerPortalTheme';\nimport Restore from '../../../../assets/restore.svg';\nimport { Icon } from '../../../common/Icon';\nimport { Typography } from '../../../common/Typography';\nimport { SubscriptionScheduledUpdateRow } from './SubscriptionScheduledUpdateRow';\nimport { getSubscriptionScheduleUpdateTexts } from '../../../utils/getSubscriptionScheduleUpdateTexts';\nimport { StyledButton } from '../../common/StyledButton';\n\nexport type SubscriptionScheduledUpdatesAlertProps = {\n subscription: CustomerPortalSubscription;\n onCancelScheduledUpdates?: (subscription: CustomerPortalSubscription) => void;\n theme: CustomerPortalTheme;\n cancelScheduledUpdatesButtonTitle: string;\n};\n\nconst SubscriptionScheduleUpdateAlertContainer = styled(Box)<{ $borderColor: string }>`\n border-bottom: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n margin: -64px -64px 64px -64px;\n padding: 24px 32px;\n`;\n\nconst LoadingIndicator = styled(ClipLoader)`\n margin-left: 4px;\n`;\n\nconst StyledRestoreIcon = styled(Restore)`\n color: ${({ theme }) => theme.stigg.palette.primary};\n path {\n fill: ${({ theme }) => theme.stigg.palette.primary};\n }\n`;\n\nfunction MultipleScheduledUpdates({ subscription }: Pick<SubscriptionScheduledUpdatesAlertProps, 'subscription'>) {\n const { scheduledUpdates } = subscription;\n\n return (\n <>\n <Grid container alignItems=\"center\" justifyContent=\"space-between\" gap={1}>\n <Grid>\n <Typography className=\"stigg-scheduled-updates-description\" variant=\"body1\">\n The following updates will take effect in the next billing cycle:\n </Typography>\n </Grid>\n </Grid>\n <Grid>\n {(scheduledUpdates || []).map((scheduleUpdate) => (\n <SubscriptionScheduledUpdateRow\n key={scheduleUpdate.subscriptionScheduleType}\n scheduleUpdate={scheduleUpdate}\n subscription={subscription}\n />\n ))}\n </Grid>\n </>\n );\n}\n\nfunction SingleScheduledUpdate({ subscription }: Pick<SubscriptionScheduledUpdatesAlertProps, 'subscription'>) {\n const { scheduledUpdates } = subscription;\n const [scheduledUpdate] = scheduledUpdates || [];\n\n const { line1, line2 } = getSubscriptionScheduleUpdateTexts({\n scheduledUpdate,\n subscriptionPrices: subscription.prices,\n billingPeriodRange: subscription.billingPeriodRange,\n options: {\n postfix: 'at the end of the current billing period', // We can later remove this if unnecessary\n },\n });\n\n return (\n <>\n <Grid container alignItems=\"center\" justifyContent=\"space-between\" gap={1}>\n <Grid>\n <Typography className=\"stigg-scheduled-updates-title\" variant=\"body1\" color=\"primary\">\n {line1}\n </Typography>\n </Grid>\n </Grid>\n {line2 && (\n <Grid>\n <Typography className=\"stigg-scheduled-updates-subtitle\" variant=\"body1\" color=\"secondary\">\n {line2}\n </Typography>\n </Grid>\n )}\n </>\n );\n}\n\nexport function SubscriptionScheduledUpdatesAlert({\n subscription,\n onCancelScheduledUpdates,\n theme,\n cancelScheduledUpdatesButtonTitle,\n}: SubscriptionScheduledUpdatesAlertProps) {\n const stiggTheme = useTheme();\n const [isLoading, setIsLoading] = useState(false);\n const { scheduledUpdates } = subscription;\n\n if (!scheduledUpdates || scheduledUpdates.length === 0) {\n return null;\n }\n\n const isSingleScheduledUpdate = scheduledUpdates.length === 1;\n\n return (\n <SubscriptionScheduleUpdateAlertContainer\n $borderColor={theme.borderColor}\n className=\"stigg-scheduled-updates-alert-container\">\n <Grid container alignItems={isSingleScheduledUpdate ? 'center' : 'flex-start'} gap={2}>\n <Grid item display=\"flex\">\n <Icon icon=\"ScheduleBox\" svgPathColor={theme.iconsColor} svgRectColor={theme.iconsBackgroundColor} />\n </Grid>\n\n <Grid item flex={1}>\n {isSingleScheduledUpdate ? (\n <SingleScheduledUpdate subscription={subscription} />\n ) : (\n <MultipleScheduledUpdates subscription={subscription} />\n )}\n </Grid>\n\n {!!onCancelScheduledUpdates && (\n <Grid item>\n <StyledButton\n variant=\"outlined\"\n onClick={() => {\n setIsLoading(true);\n Promise.resolve(onCancelScheduledUpdates(subscription)).finally(() => setIsLoading(false));\n }}>\n {isLoading ? (\n <LoadingIndicator loading size={16} color={stiggTheme.stigg.palette.text.disabled} />\n ) : (\n <StyledRestoreIcon\n style={{ display: 'flex', marginRight: 4 }}\n className=\"stigg-scheduled-updates-cancel-update-button-icon\"\n />\n )}\n <Typography variant=\"body1\" color=\"primary.main\" className=\"stigg-scheduled-updates-cancel-update-button\">\n {cancelScheduledUpdatesButtonTitle}\n </Typography>\n </StyledButton>\n </Grid>\n )}\n </Grid>\n </SubscriptionScheduleUpdateAlertContainer>\n );\n}\n","import styled from '@emotion/styled/macro';\nimport { mq } from '../../common/mediaQuery';\n\nexport const SectionContainer = styled.div<{ $backgroundColor: string; $borderColor: string }>`\n width: 100%;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n border: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n\n padding: 16px;\n ${mq.sm} {\n padding: 32px;\n }\n ${mq.md} {\n padding: 48px;\n }\n ${mq.lg} {\n padding: 64px;\n }\n`;\n","import { BillingPeriod, Currency } from '@stigg/js-client-sdk';\nimport moment from 'moment';\nimport React from 'react';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { Typography } from '../../../common/Typography';\n\nexport type NextEstimatedBillProps = {\n billingPeriod: BillingPeriod;\n rangeEnd: string;\n amount: number;\n currency: Currency;\n};\n\nexport function NextEstimatedBill({ billingPeriod, rangeEnd, amount, currency }: NextEstimatedBillProps) {\n return (\n <>\n <Typography variant=\"h6\">Next estimated bill</Typography>\n <Typography variant=\"h1\">{currencyPriceFormatter({ amount, currency, maximumFractionDigits: 2 })}</Typography>\n <Typography as=\"div\" variant=\"body1\" color=\"secondary\">\n Billed {billingPeriod === BillingPeriod.Monthly ? 'monthly' : 'annually'} on{' '}\n <Typography variant=\"body1\" span color=\"primary\">\n {moment.utc(rangeEnd).format('MMM Do, YYYY')}\n </Typography>\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n * Additional tax rates may apply\n </Typography>\n </>\n );\n}\n","import React from 'react';\nimport { Typography } from '../../../common/Typography';\n\ntype NoUpcomingBillingProps = {\n description: string;\n};\n\nexport function NoUpcomingBilling({ description }: NoUpcomingBillingProps) {\n return (\n <>\n <Typography variant=\"h6\" color=\"secondary\">\n No upcoming bill\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n {description}\n </Typography>\n </>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport Button from '@mui/material/Button';\nimport { Typography } from '../../common/Typography';\n\nconst ContactCustomerSupportLayout = styled.div`\n display: flex;\n flex-direction: column;\n align-items: left;\n gap: 8px;\n`;\n\nconst ContactSupportButton = styled(Button)`\n width: fit-content;\n &.MuiButton-root {\n padding: 0;\n &:hover {\n background: none;\n }\n }\n`;\n\ntype ContactCustomerSupportProps = {\n onContactSupport?: () => void;\n label: string;\n linkLabel: string;\n};\n\nexport function ContactCustomerSupport({ onContactSupport, label, linkLabel }: ContactCustomerSupportProps) {\n const contactSupportText = (\n <Typography color={onContactSupport ? 'primary.main' : 'secondary'}>{linkLabel}</Typography>\n );\n return (\n <ContactCustomerSupportLayout className=\"stigg-contact-support-layout\">\n <Typography className=\"stigg-contact-support-label\" color=\"secondary\">\n {label}\n </Typography>\n {onContactSupport ? (\n <ContactSupportButton\n className=\"stigg-contact-support-button\"\n style={{ textTransform: 'none' }}\n variant=\"text\"\n onClick={onContactSupport}>\n {contactSupportText}\n </ContactSupportButton>\n ) : (\n contactSupportText\n )}\n </ContactCustomerSupportLayout>\n );\n}\n","<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12.9469 13.5999H11.9344L11.935 10.7756C11.935 10.6288 11.87 10.4819 11.7557 10.3838L8.62061 7.91816L11.755 5.4532C11.8694 5.35507 11.9344 5.22444 11.9344 5.06132L11.935 2.40004H12.9475C13.225 2.40004 13.4375 2.18755 13.4375 1.91004C13.4375 1.63254 13.225 1.42004 12.9475 1.42004L3.05311 1.42067C2.77561 1.42067 2.56311 1.63316 2.56311 1.91067C2.56311 2.18817 2.77561 2.40067 3.05311 2.40067H4.06561L4.06498 5.06131C4.06498 5.20818 4.12998 5.35505 4.24436 5.45318L7.36244 7.91814L4.245 10.3837C4.13062 10.4819 4.06562 10.6125 4.06562 10.7756V13.5999H3.05313C2.77562 13.5999 2.56313 13.8124 2.56313 14.0899C2.56313 14.3674 2.77562 14.5799 3.05313 14.5799H12.9469C13.2244 14.5799 13.4369 14.3674 13.4369 14.0899C13.4369 13.8124 13.2244 13.5999 12.9469 13.5999ZM5.04498 2.39995H10.9551V4.81627L8.00002 7.16747L5.04498 4.81627V2.39995ZM5.04498 11.0206L8.00002 8.66939L10.9551 11.0044V13.5838H5.04498V11.0206Z\" fill=\"white\"/>\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M3.05303 1.25404L12.9474 1.25342C13.317 1.25342 13.6041 1.54053 13.6041 1.91008C13.6041 2.27964 13.317 2.56675 12.9474 2.56675H12.1016L12.101 5.06136V5.06136C12.101 5.2747 12.0135 5.45101 11.8635 5.57973L11.8581 5.58436L8.89014 7.9182L11.8642 10.2572C12.0164 10.3878 12.1016 10.5814 12.1016 10.7757L12.101 13.4333H12.9468C13.3164 13.4333 13.6035 13.7204 13.6035 14.09C13.6035 14.4595 13.3164 14.7466 12.9468 14.7466H3.05304C2.68349 14.7466 2.39638 14.4595 2.39638 14.09C2.39638 13.7204 2.68349 13.4333 3.05304 13.4333H3.89887V10.7757C3.89887 10.5623 3.98635 10.386 4.13639 10.2573L4.14144 10.253L7.09365 7.91821L4.13566 5.57982C3.98346 5.44923 3.89823 5.25562 3.89823 5.06135L3.89882 2.56738H3.05303C2.68348 2.56738 2.39636 2.28026 2.39636 1.91071C2.39636 1.54116 2.68348 1.25405 3.05303 1.25404V1.25404ZM12.9474 1.58675L3.05304 1.58738C2.86758 1.58738 2.7297 1.72525 2.7297 1.91071C2.7297 2.09617 2.86757 2.23404 3.05303 2.23404H4.23223L4.23157 5.06135V5.06135C4.23158 5.15983 4.27538 5.25908 4.35053 5.32476L7.63107 7.91815L4.35113 10.5123C4.2739 10.5795 4.23221 10.6639 4.23221 10.7757V13.7666H3.05304C2.86759 13.7666 2.72971 13.9045 2.72971 14.09C2.72971 14.2754 2.86759 14.4133 3.05304 14.4133H12.9468C13.1323 14.4133 13.2701 14.2754 13.2701 14.09C13.2701 13.9045 13.1323 13.7667 12.9468 13.7667H11.7676L11.7683 10.7757V10.7757C11.7683 10.6772 11.7245 10.5781 11.6495 10.5124L8.35092 7.91819L11.6489 5.32461C11.726 5.25743 11.7676 5.17306 11.7676 5.06136L11.7683 2.23342H12.9474C13.1329 2.23342 13.2708 2.09554 13.2708 1.91008C13.2708 1.72463 13.1329 1.58676 12.9474 1.58675V1.58675ZM4.87823 2.23332H11.1216V4.89669L7.99994 7.3805L4.87823 4.89669V2.23332ZM5.21157 2.56666V4.73593L7.99994 6.95452L10.7883 4.73593V2.56666H5.21157ZM7.99958 8.45673L11.1216 10.9237V13.7505H4.87823V10.9403L7.99958 8.45673ZM8.0003 8.88213L5.21157 11.101V13.4172H10.7883V11.0852L8.0003 8.88213Z\" fill=\"white\"/>\n</svg>\n","import styled from '@emotion/styled/macro';\nimport React, { ReactNode } from 'react';\nimport {\n BillingModel,\n CustomerPortalSubscription,\n PricingType,\n SubscriptionScheduleType,\n SubscriptionStatus,\n} from '@stigg/js-client-sdk';\nimport { CustomerPortalTheme } from '../../customerPortalTheme';\nimport { NextEstimatedBill } from './NextEstimatedBill';\nimport { NoUpcomingBilling } from './NoUpcomingBilling';\nimport { ContactCustomerSupport } from '../ContactCustomerSupport';\nimport { CustomerPortalLocalization } from '../../customerPortalTextOverrides';\n\nconst Container = styled.div<{ $borderColor: string }>`\n max-height: 278px;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n background-color: ${({ theme }) => theme.stigg.palette.backgroundSection};\n border: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n padding: 32px;\n gap: 16px;\n`;\n\nexport type UpcomingBillingProps = {\n subscription: CustomerPortalSubscription;\n theme: CustomerPortalTheme;\n textOverrides: CustomerPortalLocalization;\n onContactSupport?: () => Promise<void> | void;\n};\n\nexport function UpcomingBilling({ subscription, theme, textOverrides, onContactSupport }: UpcomingBillingProps) {\n const { pricingType } = subscription;\n let content: ReactNode;\n const noUsageBasedPrices =\n subscription.prices?.every((price) => price.billingModel !== BillingModel.UsageBased) ?? true;\n const scheduledDowngradeToFree = subscription.scheduledUpdates?.find(\n ({ subscriptionScheduleType, targetPackage }) =>\n subscriptionScheduleType === SubscriptionScheduleType.Downgrade &&\n targetPackage?.pricingType === PricingType.Free,\n );\n\n if (pricingType === PricingType.Free) {\n content = <NoUpcomingBilling description=\"You're on a free plan, so you don’t have any upcoming charges\" />;\n } else if (pricingType === PricingType.Paid) {\n if (scheduledDowngradeToFree && noUsageBasedPrices) {\n content = (\n <NoUpcomingBilling description=\"Your plan will be downgraded to a free plan, so you don’t have any upcoming charges\" />\n );\n } else if (subscription.status === SubscriptionStatus.InTrial) {\n content = (\n <NoUpcomingBilling\n description={`You’re on a free trial of the ${subscription.planName} plan, so you don’t have any upcoming charges`}\n />\n );\n } else {\n const billingPeriod = subscription.prices?.[0]?.billingPeriod;\n const rangeEnd = subscription.billingPeriodRange?.end;\n const total = subscription.totalPrice?.total;\n\n if (billingPeriod && rangeEnd && total) {\n content = (\n <NextEstimatedBill\n billingPeriod={billingPeriod}\n rangeEnd={rangeEnd}\n amount={total.amount}\n currency={total.currency}\n />\n );\n }\n }\n } else if (pricingType === PricingType.Custom) {\n content = (\n <ContactCustomerSupport\n onContactSupport={onContactSupport}\n label={textOverrides.contactSupportTitle}\n linkLabel={textOverrides.contactSupportLink}\n />\n );\n }\n\n return (\n <Container className=\"stigg-subscription-total-price-layout\" $borderColor={theme.borderColor}>\n {content}\n </Container>\n );\n}\n","import React from 'react';\nimport Tooltip, { tooltipClasses, TooltipProps } from '@mui/material/Tooltip';\nimport styled from '@emotion/styled/macro';\n\nexport type InformationTooltipProps = TooltipProps & { $padding?: number; $maxWidth?: number };\n\nexport const InformationTooltip = styled(\n ({ children, className, placement = 'top', ...props }: InformationTooltipProps) => (\n <Tooltip\n arrow\n placement={placement}\n {...props}\n classes={{ popper: className, tooltip: 'stigg-tooltip', arrow: 'stigg-tooltip-arrow' }}>\n <div>{children}</div>\n </Tooltip>\n ),\n)(({ theme, $padding = 8, $maxWidth = 300 }) => ({\n [`& .${tooltipClasses.tooltip}`]: {\n backgroundColor: theme.stigg.palette.white,\n maxWidth: $maxWidth,\n boxShadow: theme.stigg.shadows.popover,\n padding: $padding,\n borderRadius: theme.stigg.border.radius,\n color: theme.stigg.palette.text.primary,\n },\n [`& .${tooltipClasses.arrow}`]: {\n color: theme.stigg.palette.white,\n },\n}));\n","import React, { CSSProperties, ReactNode, useEffect, useRef, useState } from 'react';\nimport styled, { css } from 'styled-components';\nimport { TooltipProps } from '@mui/material/Tooltip';\nimport { InformationTooltip } from './InformationTooltip';\nimport { Typography, TypographyProps } from './Typography';\n\nconst StyledText = styled(Typography)<{ $maxLines: number; $wordBreak?: boolean; $display: string; $bold?: boolean }>`\n display: ${({ $display }) => $display};\n -webkit-line-clamp: ${({ $maxLines }) => $maxLines};\n -webkit-box-orient: vertical;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: normal;\n ${({ $wordBreak }) =>\n $wordBreak &&\n css`\n word-break: break-word;\n `}\n\n ${({ $bold }) =>\n $bold &&\n css`\n font-weight: bold;\n `}\n`;\n\nfunction checkTextClamped(element: HTMLSpanElement) {\n return element && (element.clientHeight < element.scrollHeight || element.offsetWidth < element.scrollWidth);\n}\n\nexport const LongText = ({\n leaveDelay,\n children,\n variant,\n color,\n maxLines = 1,\n wordBreak,\n bold,\n tooltipPlacement = 'top',\n className,\n display = '-webkit-box',\n style,\n 'data-testid': dataTestId,\n}: {\n children: ReactNode;\n leaveDelay?: number;\n variant?: TypographyProps['variant'];\n color?: TypographyProps['color'];\n maxLines?: number;\n wordBreak?: boolean;\n bold?: boolean;\n tooltipPlacement?: TooltipProps['placement'];\n className?: string;\n display?: string;\n style?: CSSProperties;\n ['data-testid']?: string;\n}) => {\n const [isTextClamped, setIsTextClamped] = useState(false);\n const ref = useRef<HTMLSpanElement>(null);\n const content = (\n <StyledText\n ref={ref}\n variant={variant}\n color={color}\n $maxLines={maxLines}\n $wordBreak={wordBreak}\n $bold={bold}\n className={className}\n $display={display}\n style={style}\n data-testid={dataTestId}>\n {children}\n </StyledText>\n );\n\n // Trigger recalculate of text clamped since ref is not always exists on first render\n useEffect(() => {\n if (ref?.current) {\n const textClamped = checkTextClamped(ref.current);\n setIsTextClamped(textClamped);\n }\n }, [ref]);\n\n const textClamped = ref?.current && checkTextClamped(ref.current);\n return (\n <span>\n {isTextClamped || textClamped ? (\n <InformationTooltip\n placement={tooltipPlacement}\n leaveDelay={leaveDelay}\n title={<Typography variant=\"body1\">{children}</Typography>}>\n {content}\n </InformationTooltip>\n ) : (\n content\n )}\n </span>\n );\n};\n","import styled from '@emotion/styled/macro';\nimport React from 'react';\nimport { CustomerPortalSubscription, SubscriptionStatus } from '@stigg/js-client-sdk';\nimport Link from '@mui/material/Link';\nimport SandClockIcon from '../../../../assets/sand-clock.svg';\nimport { Typography } from '../../../common/Typography';\nimport { LongText } from '../../../common/LongText';\nimport { OnManageClick } from '../../CustomerPortalContainer';\nimport { CustomerPortalIntentionType } from '../../types';\n\nconst OnTrialBadge = styled.div`\n width: 100%;\n display: flex;\n align-items: center;\n gap: 4px;\n background-color: ${({ theme }) => theme.stigg.palette.warning};\n border-radius: 10px;\n padding: 8px 16px;\n margin-top: 16px;\n`;\n\nconst StyledLink = styled(Link)`\n text-decoration-color: white;\n color: white;\n cursor: pointer;\n`;\n\nexport function TrialPanel({\n subscription,\n includePlanName,\n onManageSubscription,\n}: {\n subscription: CustomerPortalSubscription | undefined;\n includePlanName: boolean;\n onManageSubscription: OnManageClick;\n}) {\n if (subscription?.status !== SubscriptionStatus.InTrial) {\n return null;\n }\n\n return (\n <OnTrialBadge className=\"stigg-subscription-trial-badge\">\n <SandClockIcon className=\"stigg-subscription-trial-badge-image\" />\n\n <div style={{ flex: 1, marginRight: 4 }}>\n <LongText variant=\"body1\" className=\"stigg-subscription-trial-badge-text\" color=\"white\">\n {`${subscription.trialRemainingDays} days remaining in trial`}\n {includePlanName && ` of the ${subscription.planName} plan`}\n </LongText>\n </div>\n\n <StyledLink\n className=\"stigg-subscription-trial-upgrade-button\"\n onClick={() => onManageSubscription({ intentionType: CustomerPortalIntentionType.UPGRADE_TRIAL_PLAN })}>\n <Typography color=\"white\">Upgrade plan</Typography>\n </StyledLink>\n </OnTrialBadge>\n );\n}\n","import React from 'react';\nimport { CustomerPortalSubscription } from '@stigg/js-client-sdk';\nimport { Typography } from '../../../common/Typography';\nimport { TrialPanel } from './TrialPanel';\nimport { CustomerPortalTheme } from '../../customerPortalTheme';\nimport { OnManageClick } from '../../CustomerPortalContainer';\n\ntype SubscriptionViewProps = {\n mainSubscription: CustomerPortalSubscription;\n trialSubscription: CustomerPortalSubscription | undefined;\n onManageSubscription: OnManageClick;\n theme: CustomerPortalTheme;\n};\n\nexport function SubscriptionView({\n mainSubscription,\n trialSubscription,\n onManageSubscription,\n theme,\n}: SubscriptionViewProps) {\n return (\n <div className=\"stigg-subscription-view-layout\">\n <Typography\n className=\"stigg-subscription-plan-name\"\n variant=\"h1\"\n overrideColor={theme.planNameColor}\n style={{ marginTop: 8 }}>\n {mainSubscription.planName} plan\n </Typography>\n\n <TrialPanel\n subscription={trialSubscription}\n includePlanName={trialSubscription?.planName !== mainSubscription.planName}\n onManageSubscription={onManageSubscription}\n />\n </div>\n );\n}\n","import { CustomerPortalEntitlement } from '@stigg/js-client-sdk';\nimport moment from 'moment';\n\nexport const USAGE_PERCENTAGE_WARNING_THRESHOLD = 70;\n\nexport function getUsagePercentage(currentUsage: number, limit: number) {\n return Math.min(Math.floor((currentUsage / limit) * 100), 100);\n}\n\nexport function getUsageProgressStatus(currentUsage: number) {\n let status: 'standard' | 'warning' | 'error';\n\n if (currentUsage < USAGE_PERCENTAGE_WARNING_THRESHOLD) {\n status = 'standard';\n } else if (currentUsage < 100) {\n status = 'warning';\n } else {\n status = 'error';\n }\n\n return status;\n}\n\nexport function getResetUsageText(entitlement: CustomerPortalEntitlement) {\n if (!entitlement.resetPeriod || !entitlement.usagePeriodEnd) {\n return null;\n }\n\n const calculateResetDiff = (unit: 'days' | 'hours' | 'minutes') => {\n return moment.utc(entitlement.usagePeriodEnd).diff(moment.utc(), unit);\n };\n\n switch (entitlement.resetPeriod) {\n case 'MONTH':\n return `Resets monthly - in ${calculateResetDiff('days')} days`;\n case 'WEEK':\n return `Resets weekly - in ${calculateResetDiff('days')} days`;\n case 'DAY':\n return `Resets daily - in ${calculateResetDiff('hours')} hours`;\n case 'HOUR':\n return `Resets hourly - in ${calculateResetDiff('minutes')} minutes`;\n default:\n return null;\n }\n}\n","import styled from '@emotion/styled/macro';\nimport LinearProgress from '@mui/material/LinearProgress';\nimport React from 'react';\nimport { CustomerPortalEntitlement } from '@stigg/js-client-sdk';\nimport Divider from '@mui/material/Divider';\nimport Color from 'color';\nimport { getUsagePercentage, getUsageProgressStatus } from './FeatureUsage.helper';\n\nexport const StyledLinearProgress = styled(LinearProgress, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{\n $progressStatus: 'standard' | 'warning' | 'error';\n}>`\n height: 4px;\n background-color: ${({ theme }) => Color(theme.stigg.palette.primary).alpha(0.4).string()};\n\n span {\n background-color: ${({ $progressStatus, theme }) => {\n switch ($progressStatus) {\n case 'standard':\n return theme.stigg.palette.primary;\n case 'warning':\n return theme.stigg.palette.warning;\n case 'error':\n return theme.stigg.palette.error;\n default:\n return theme.stigg.palette.primary;\n }\n }};\n }\n`;\n\nexport const StyledDivider = styled(Divider)`\n border-style: dotted;\n border-bottom-width: 2px;\n border-color: ${({ theme }) => Color(theme.stigg.palette.outlinedRestingBorder).alpha(0.4).string()};\n`;\n\nexport type FeatureUsageProgressBarProps = {\n entitlement: CustomerPortalEntitlement;\n};\n\nexport function FeatureUsageProgressBar({ entitlement }: FeatureUsageProgressBarProps) {\n if (entitlement.hasUnlimitedUsage) {\n return <StyledDivider />;\n }\n\n const usagePercentage = getUsagePercentage(entitlement.currentUsage || 0, entitlement.usageLimit!);\n const linearProgressStatus = getUsageProgressStatus(usagePercentage);\n\n return (\n <StyledLinearProgress\n $progressStatus={linearProgressStatus}\n className={`stigg-feature-usage-progress-bar-${linearProgressStatus.toString()}`}\n variant=\"determinate\"\n value={usagePercentage}\n />\n );\n}\n","import { CustomerPortalEntitlement } from '@stigg/js-client-sdk';\nimport { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';\nimport Button from '@mui/material/Button';\nimport React from 'react';\nimport styled from 'styled-components';\nimport { getUsagePercentage, USAGE_PERCENTAGE_WARNING_THRESHOLD } from './FeatureUsage.helper';\nimport { Typography } from '../../../common/Typography';\nimport { CustomerPortalIntentionType, OnBuyMoreCallbackFn } from '../../types';\nimport { OnManageClick } from '../../CustomerPortalContainer';\n\nconst StyledButton = styled(Button)`\n text-transform: none;\n padding: 0;\n white-space: nowrap;\n`;\n\nexport type EntitlementCtaButtonProps = {\n entitlement: Exclude<CustomerPortalEntitlement, 'feature'>;\n feature: FeatureFragment;\n onManageSubscription: OnManageClick | undefined;\n onBuyMore?: OnBuyMoreCallbackFn;\n canBuyMore: boolean;\n canUpgradeSubscription: boolean;\n hasCustomSubscription: boolean;\n};\n\nexport function EntitlementCtaButton({\n entitlement,\n feature,\n onManageSubscription,\n onBuyMore,\n canBuyMore,\n canUpgradeSubscription,\n hasCustomSubscription,\n}: EntitlementCtaButtonProps) {\n if (hasCustomSubscription || entitlement.hasUnlimitedUsage) {\n return null;\n }\n\n if (getUsagePercentage(entitlement.currentUsage || 0, entitlement.usageLimit!) < USAGE_PERCENTAGE_WARNING_THRESHOLD) {\n return null;\n }\n\n if (canBuyMore) {\n return onBuyMore ? (\n <StyledButton variant=\"text\" onClick={() => onBuyMore(feature, entitlement)}>\n <Typography color=\"primary.main\">Buy more</Typography>\n </StyledButton>\n ) : null;\n }\n\n if (canUpgradeSubscription) {\n return onManageSubscription ? (\n <StyledButton\n variant=\"text\"\n onClick={() => onManageSubscription({ intentionType: CustomerPortalIntentionType.UPGRADE_PLAN })}>\n <Typography color=\"primary.main\">Upgrade</Typography>\n </StyledButton>\n ) : null;\n }\n\n return null;\n}\n","import { Currency, CustomerPortalEntitlement } from '@stigg/js-client-sdk';\nimport React from 'react';\nimport { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';\nimport { Typography } from '../../../common/Typography';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { FeatureUsageProgressBar } from '../../usage/featureUsage/FeatureUsageProgressBar';\nimport { LongText } from '../../../common/LongText';\nimport { EntitlementCtaButton } from '../../usage/featureUsage/EntitlementCTAButton';\nimport { OnBuyMoreCallbackFn } from '../../types';\nimport { OnManageClick } from '../../CustomerPortalContainer';\n\nexport type UsageBasedChargeProps = {\n entitlement: Exclude<CustomerPortalEntitlement, 'feature'>;\n feature: FeatureFragment;\n amount: number;\n blockSize?: number | null;\n currency: Currency;\n onBuyMore?: OnBuyMoreCallbackFn;\n onManageSubscription: OnManageClick;\n canUpgradeSubscription: boolean;\n hasCustomSubscription: boolean;\n hideChargePrice?: boolean;\n};\n\nexport function ChargeItem({\n amount,\n currency,\n blockSize,\n entitlement,\n feature,\n hideChargePrice,\n onBuyMore,\n onManageSubscription,\n canUpgradeSubscription,\n hasCustomSubscription,\n}: UsageBasedChargeProps) {\n return (\n <div\n className={`stigg-charge-list-item stigg-charge-list-item-${entitlement.feature!.refId}`}\n style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>\n <div style={{ display: 'flex', justifyContent: 'space-between', gap: 12 }}>\n <div style={{ display: 'flex', gap: 12 }}>\n <LongText variant=\"body1\" color=\"primary\">\n {feature.displayName}\n </LongText>\n {!hideChargePrice && (\n <LongText variant=\"body1\" color=\"secondary\">\n {currencyPriceFormatter({ amount, currency })} per {blockSize ? `${blockSize} ` : ''}\n {blockSize ? feature.featureUnitsPlural : feature.featureUnits}\n </LongText>\n )}\n </div>\n\n <div style={{ display: 'flex', gap: 12 }}>\n <EntitlementCtaButton\n entitlement={entitlement}\n feature={feature}\n canBuyMore\n onBuyMore={onBuyMore}\n onManageSubscription={onManageSubscription}\n canUpgradeSubscription={canUpgradeSubscription}\n hasCustomSubscription={hasCustomSubscription}\n />\n <Typography variant=\"body1\" color=\"primary\" style={{ whiteSpace: 'nowrap' }}>\n {entitlement.hasUnlimitedUsage\n ? entitlement.currentUsage?.toLocaleString()\n : `${entitlement.currentUsage?.toLocaleString()} of ${entitlement.usageLimit?.toLocaleString()}`}\n </Typography>\n </div>\n </div>\n\n <FeatureUsageProgressBar entitlement={entitlement} />\n </div>\n );\n}\n","import { BillingModel, CustomerPortalEntitlement, CustomerPortalSubscription } from '@stigg/js-client-sdk';\nimport React from 'react';\nimport { keyBy } from 'lodash';\nimport { ChargeItem } from './ChargeItem';\nimport { OnBuyMoreCallbackFn } from '../../types';\nimport { OnManageClick } from '../../CustomerPortalContainer';\n\nexport type ChargesProps = {\n subscription: CustomerPortalSubscription;\n entitlements: CustomerPortalEntitlement[];\n onBuyMore?: OnBuyMoreCallbackFn;\n onManageSubscription: OnManageClick;\n canUpgradeSubscription: boolean;\n hasCustomSubscription: boolean;\n};\n\nexport function ChargeList({\n subscription,\n entitlements,\n onBuyMore,\n onManageSubscription,\n hasCustomSubscription,\n canUpgradeSubscription,\n}: ChargesProps) {\n const entitlementByFeature = keyBy(entitlements, 'feature.refId');\n\n const filteredSubscriptionPrices = subscription.prices.filter(\n ({ feature, price }) => !!feature && entitlementByFeature[feature.refId] && !!price,\n );\n\n if (!filteredSubscriptionPrices.length) {\n return null;\n }\n\n return (\n <div className=\"stigg-charge-list\" style={{ display: 'flex', flexDirection: 'column', gap: 16, marginTop: 32 }}>\n {filteredSubscriptionPrices.map(({ feature, price, blockSize, billingModel }) => {\n if (!feature || !price) {\n return null;\n }\n\n const entitlement = entitlementByFeature[feature.refId];\n\n if (!entitlement || !entitlement.feature) {\n return null;\n }\n\n return (\n <ChargeItem\n key={feature.refId}\n entitlement={entitlement}\n feature={entitlement.feature}\n amount={price.amount}\n blockSize={blockSize}\n currency={price.currency}\n hideChargePrice={billingModel === BillingModel.PerUnit}\n onBuyMore={onBuyMore}\n onManageSubscription={onManageSubscription}\n canUpgradeSubscription={canUpgradeSubscription}\n hasCustomSubscription={hasCustomSubscription}\n />\n );\n })}\n </div>\n );\n}\n","import React from 'react';\nimport { CustomerPortalSubscription, PricingType, SubscriptionStatus } from '@stigg/js-client-sdk';\nimport { SubscriptionsOverviewHeader } from './SubscriptionsOverviewHeader';\nimport { SubscriptionTabs } from './tabs/SubscriptionTabs';\nimport { useCustomerPortalContext } from '../CustomerPortalProvider';\nimport { SubscriptionOverviewLoader } from './SubscriptionOverviewLoader';\nimport { CustomerPortalSection } from '../CustomerPortal';\nimport { SubscriptionScheduledUpdatesAlert } from './subscriptionScheduledUpdates/SubscriptionScheduledUpdatesAlert';\nimport { SectionContainer } from '../common/SectionContainer';\nimport { UpcomingBilling } from './upcomingBilling/UpcomingBilling';\nimport { SubscriptionView } from './subscriptionView/SubscriptionView';\nimport { ChargeList } from './charges/ChargeList';\nimport { OnBuyMoreCallbackFn } from '../types';\nimport { OnManageClick } from '../CustomerPortalContainer';\n\nexport type SubscriptionsOverviewProps = {\n onManageSubscription: OnManageClick;\n onBuyMore?: OnBuyMoreCallbackFn;\n onCancelScheduledUpdates?: (subscription: CustomerPortalSubscription) => void;\n onContactSupport?: () => void;\n hiddenSections?: CustomerPortalSection[];\n cancelScheduledUpdatesButtonTitle: string;\n};\n\nexport function SubscriptionsOverview({\n onManageSubscription,\n onBuyMore,\n onCancelScheduledUpdates,\n onContactSupport,\n hiddenSections,\n cancelScheduledUpdatesButtonTitle,\n}: SubscriptionsOverviewProps) {\n const { customerPortal, isLoading, textOverrides, theme } = useCustomerPortalContext();\n const isLoadingData = isLoading || !customerPortal;\n const { subscriptions, entitlements, canUpgradeSubscription } = customerPortal || {};\n\n const activeSubscription = subscriptions?.find(({ status }) => status === SubscriptionStatus.Active);\n const trialSubscription = subscriptions?.find(({ status }) => status === SubscriptionStatus.InTrial);\n const hasCustomSubscription = activeSubscription?.pricingType === PricingType.Custom;\n const mainSubscription = activeSubscription || trialSubscription;\n\n return (\n <SectionContainer\n className=\"stigg-customer-portal-subscriptions-overview\"\n $backgroundColor={theme.backgroundColor}\n $borderColor={theme.borderColor}>\n {!isLoadingData && activeSubscription && activeSubscription.scheduledUpdates && (\n <SubscriptionScheduledUpdatesAlert\n theme={theme}\n subscription={activeSubscription}\n onCancelScheduledUpdates={onCancelScheduledUpdates}\n cancelScheduledUpdatesButtonTitle={cancelScheduledUpdatesButtonTitle}\n />\n )}\n\n {isLoadingData || !mainSubscription ? (\n <SubscriptionOverviewLoader />\n ) : (\n <div\n className=\"stigg-overview-layout\"\n style={{ display: 'flex', alignItems: 'flex-start', gap: 64, flexWrap: 'wrap' }}>\n <div style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>\n <SubscriptionsOverviewHeader\n onManageSubscription={onManageSubscription}\n hideManageButton={hasCustomSubscription}\n textOverrides={textOverrides}\n />\n\n <SubscriptionView\n mainSubscription={mainSubscription}\n trialSubscription={trialSubscription}\n theme={theme}\n onManageSubscription={onManageSubscription}\n />\n\n {activeSubscription && entitlements && (\n <ChargeList\n subscription={activeSubscription}\n entitlements={entitlements}\n onBuyMore={onBuyMore}\n onManageSubscription={onManageSubscription}\n canUpgradeSubscription={!!canUpgradeSubscription}\n hasCustomSubscription={hasCustomSubscription}\n />\n )}\n\n <SubscriptionTabs\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n customerPortal={customerPortal!}\n hiddenSections={hiddenSections}\n textOverrides={textOverrides}\n theme={theme}\n />\n </div>\n\n <div style={{ display: 'flex', flexDirection: 'column', width: 319, gap: 24 }}>\n <UpcomingBilling\n subscription={mainSubscription}\n theme={theme}\n onContactSupport={onContactSupport}\n textOverrides={textOverrides}\n />\n </div>\n </div>\n )}\n </SectionContainer>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { PoweredByStigg } from '../common/PoweredByStigg';\n\nconst CustomerPortalHeaderLayout = styled.div`\n display: flex;\n width: 100%;\n align-items: flex-end;\n justify-content: flex-end;\n margin-bottom: 24px;\n`;\n\nexport function CustomerPortalHeader({ showWatermark }: { showWatermark?: boolean }) {\n return (\n <CustomerPortalHeaderLayout className=\"stigg-customer-portal-header-layout\">\n <PoweredByStigg source=\"customer_portal\" showWatermark={showWatermark} />\n </CustomerPortalHeaderLayout>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { ExternalLink as ExternalLinkIcon } from 'react-feather';\nimport { Typography } from '../../common/Typography';\nimport { StyledButton } from './StyledButton';\n\nconst ExternalLinkText = styled(Typography)`\n text-transform: none;\n`;\n\nconst LinkIcon = styled(ExternalLinkIcon)`\n color: ${({ theme }) => theme.stigg.palette.primary};\n`;\n\nexport type ExternalLinkButtonProps = {\n text: string;\n url: string;\n className: string;\n};\n\nexport function ExternalLinkButton({ text, url, className }: ExternalLinkButtonProps) {\n const onClick = () => {\n window.open(url, '_blank');\n };\n\n return (\n <StyledButton\n className={className}\n variant=\"outlined\"\n startIcon={<LinkIcon size={20} strokeWidth={2.5} />}\n onClick={onClick}>\n <ExternalLinkText color=\"primary.main\">{text}</ExternalLinkText>\n </StyledButton>\n );\n}\n","import styled from '@emotion/styled/macro';\nimport React from 'react';\nimport { FontWeight } from 'styled-typography';\nimport { Typography, TypographyProps } from '../../common/Typography';\n\nexport const InformationGridContainer = styled.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 16px;\n flex: 1 0 0;\n`;\n\nconst InformationGridRow = styled.div`\n display: flex;\n align-items: flex-start;\n gap: 16px;\n align-self: stretch;\n flex-wrap: wrap;\n`;\n\nexport type InformationGridProps = {\n title: string;\n rows: Array<{\n classNamePrefix: string;\n label: string;\n value: string;\n labelTypographyProps?: Partial<TypographyProps>;\n valueTypographyProps?: Partial<TypographyProps>;\n }>;\n};\n\nexport function InformationGrid({ title, rows }: InformationGridProps) {\n return (\n <InformationGridContainer>\n <Typography variant=\"h6\" color=\"secondary\" fontWeight={FontWeight.Medium}>\n {title}\n </Typography>\n {rows.map(({ classNamePrefix, label, value, labelTypographyProps, valueTypographyProps }) => (\n <InformationGridRow key={label}>\n <Typography\n className={`${classNamePrefix}-label`}\n variant=\"body1\"\n color=\"secondary\"\n style={{ width: 80 }}\n {...labelTypographyProps}>\n {label}\n </Typography>\n <Typography className={`${classNamePrefix}-text`} variant=\"body1\" color=\"secondary\" {...valueTypographyProps}>\n {value}\n </Typography>\n </InformationGridRow>\n ))}\n </InformationGridContainer>\n );\n}\n","import Skeleton from 'react-loading-skeleton';\nimport React from 'react';\n\nexport function SkeletonButton() {\n return <Skeleton width={220} height={42} />;\n}\n","import React, { ReactElement } from 'react';\nimport Divider from '@mui/material/Divider';\nimport { padStart } from 'lodash';\nimport Skeleton from 'react-loading-skeleton';\nimport { useCustomerPortalContext } from '../CustomerPortalProvider';\nimport { SectionTitle } from '../common/SectionTitle';\nimport { SectionContainer } from '../common/SectionContainer';\nimport { ExternalLinkButton } from '../common/ExternalLinkButton';\nimport { InformationGrid, InformationGridContainer } from './InformationGrid';\nimport { SectionHeader } from '../common/SectionHeader';\nimport { SkeletonButton } from '../common/SkeletonButton';\nimport { useIsScreenWiderThan } from '../../hooks/useIsScreenWiderThan';\n\nexport const EMPTY_CHAR = '-';\n\nexport function PaymentDetailsSection() {\n const { customerPortal, isLoading, textOverrides, theme } = useCustomerPortalContext();\n const isScreenWiderThanMd = useIsScreenWiderThan('md');\n const { billingInformation } = customerPortal || {};\n const isLoadingData = !billingInformation || isLoading;\n\n const items: ReactElement[] = [];\n\n if (isLoadingData) {\n items.push(\n ...[\n <InformationGridContainer key=\"information-loading-data-top\">\n <Skeleton width={220} height={12} />\n <Skeleton width={220} height={12} />\n <Skeleton width={220} height={12} />\n </InformationGridContainer>,\n <Divider\n key=\"information-loading-data-divider\"\n orientation=\"vertical\"\n style={{ minHeight: 93, display: isScreenWiderThanMd ? 'block' : 'none' }}\n />,\n <InformationGridContainer key=\"information-loading-data-bottom\">\n <Skeleton width={220} height={12} />\n <Skeleton width={220} height={12} />\n <Skeleton width={220} height={12} />\n </InformationGridContainer>,\n ],\n );\n } else {\n items.push(\n <InformationGrid\n key=\"information-billing-data-billed-to\"\n title=\"Billed to\"\n rows={[\n {\n classNamePrefix: 'stigg-customer-name',\n label: 'Name',\n value: billingInformation?.name || EMPTY_CHAR,\n valueTypographyProps: billingInformation?.name ? {} : { color: 'disabled' },\n },\n {\n classNamePrefix: 'stigg-customer-email',\n label: 'Email',\n value: billingInformation?.email || EMPTY_CHAR,\n valueTypographyProps: billingInformation?.email ? {} : { color: 'disabled' },\n },\n ]}\n />,\n );\n\n if (\n billingInformation?.defaultPaymentMethodId &&\n billingInformation.defaultPaymentMethodLast4Digits &&\n billingInformation.defaultPaymentExpirationMonth &&\n billingInformation.defaultPaymentExpirationYear\n ) {\n items.unshift(\n <Divider\n key=\"information-billing-data-divider\"\n orientation=\"vertical\"\n style={{ minHeight: 93, display: isScreenWiderThanMd ? 'block' : 'none' }}\n />,\n );\n items.unshift(\n <InformationGrid\n key=\"information-billing-data-payment-method\"\n title=\"Payment method\"\n rows={[\n {\n classNamePrefix: 'stigg-credit-card',\n label: 'Card',\n value: `Ending in ${billingInformation.defaultPaymentMethodLast4Digits}`,\n },\n {\n classNamePrefix: 'stigg-credit-card-expiration',\n label: 'Expires',\n value: `${padStart(billingInformation.defaultPaymentExpirationMonth.toString(), 2, '0')}/${\n billingInformation.defaultPaymentExpirationYear\n }`,\n },\n ]}\n />,\n );\n }\n }\n\n if (\n !isLoadingData &&\n !billingInformation?.name &&\n !billingInformation?.email &&\n !billingInformation?.defaultPaymentMethodId\n ) {\n return null;\n }\n\n const editButton = isLoadingData ? (\n <SkeletonButton />\n ) : customerPortal?.billingPortalUrl ? (\n <ExternalLinkButton\n url={customerPortal.billingPortalUrl}\n text={textOverrides.editPaymentDetails}\n className=\"stigg-edit-payment-details-button\"\n />\n ) : null;\n\n return (\n <SectionContainer\n className=\"stigg-payment-details-section-layout\"\n $backgroundColor={theme.backgroundColor}\n $borderColor={theme.borderColor}>\n <SectionHeader className=\"stigg-payment-details-section-header\">\n <SectionTitle\n isLoading={isLoadingData}\n className=\"stigg-payment-details-section-title\"\n title=\"Payment details\"\n />\n {editButton}\n </SectionHeader>\n\n <div style={{ display: 'flex', alignItems: 'stretch', gap: isScreenWiderThanMd ? 64 : 32, flexWrap: 'wrap' }}>\n {items}\n </div>\n </SectionContainer>\n );\n}\n","import styled from '@emotion/styled/macro';\nimport { STIGG_WATERMARK_CLASSNAME } from '../../common/PoweredByStigg';\nimport { SectionContainer } from '../common/SectionContainer';\n\nexport const CustomerPortalPaywallLayout = styled(SectionContainer)<{\n $backgroundColor: string;\n $borderColor: string;\n}>`\n position: relative;\n\n .stigg-paywall-layout {\n width: 100%;\n }\n\n .stigg-paywall-plans-layout {\n flex-wrap: nowrap;\n width: 100%;\n overflow-x: auto;\n justify-content: unset;\n padding: 10px 0px 0px 0px;\n }\n\n .stigg-paywall-plans-layout .stigg-plan-offering-container:first-of-type {\n margin-left: auto;\n }\n .stigg-paywall-plans-layout .stigg-plan-offering-container:last-child {\n margin-right: auto;\n }\n\n .${STIGG_WATERMARK_CLASSNAME} {\n display: none;\n }\n`;\n","import React from 'react';\nimport { CustomerPortalTheme } from '../customerPortalTheme';\nimport { CustomerPortalPaywallLayout } from './CustomerPortalPaywall.style';\nimport { SectionTitle } from '../common/SectionTitle';\nimport { SectionHeader } from '../common/SectionHeader';\n\ntype CustomerPortalPaywallProps = {\n paywallComponent?: React.ReactNode;\n theme: CustomerPortalTheme;\n title: string;\n isLoading: boolean;\n};\n\nexport const CustomerPortalPaywall = React.forwardRef<HTMLDivElement, CustomerPortalPaywallProps>(\n ({ paywallComponent, theme, title, isLoading }, ref) => {\n if (!paywallComponent) {\n return null;\n }\n\n return (\n <CustomerPortalPaywallLayout\n className=\"stigg-customer-portal-paywall-section\"\n ref={ref}\n $backgroundColor={theme.backgroundColor}\n $borderColor={theme.borderColor}>\n <SectionHeader className=\"stigg-customer-portal-paywall-header\">\n <SectionTitle isLoading={isLoading} className=\"stigg-customer-portal-paywall-section-title\" title={title} />\n </SectionHeader>\n\n {paywallComponent}\n </CustomerPortalPaywallLayout>\n );\n },\n);\n","import styled from '@emotion/styled/macro';\n\nexport const CustomerPortalLayout = styled.div`\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n\n & * {\n box-sizing: border-box;\n }\n`;\n\nexport const CustomerPortalSections = styled.div`\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n row-gap: 24px;\n`;\n","import { FeatureFragment } from '@stigg/api-client-js/src/generated/sdk';\nimport lowercase from 'lodash/lowerCase';\n\nexport function getFeatureDisplayNameText(\n featureDisplayName: string,\n featureUnits: string | undefined | null,\n featureUnitsPlural: string | undefined | null,\n) {\n if (!featureUnits && !featureUnitsPlural) {\n return featureDisplayName;\n }\n\n const displayNameLowerCase = lowercase(featureDisplayName);\n if (\n displayNameLowerCase === lowercase(featureUnits || '') ||\n displayNameLowerCase === lowercase(featureUnitsPlural || '')\n ) {\n return featureDisplayName;\n }\n\n return `${featureDisplayName} (${featureUnitsPlural})`;\n}\n\nexport function getFeatureDisplayName(feature: FeatureFragment) {\n return getFeatureDisplayNameText(feature.displayName, feature.featureUnits, feature.featureUnitsPlural);\n}\n","import styled from '@emotion/styled/macro';\n\nexport const FeatureUsageContainer = styled.div<{ $highlight: boolean; $borderColor: string }>`\n display: flex;\n flex-direction: column;\n padding: 24px;\n border: ${({ $borderColor }) => `1px solid ${$borderColor}`};\n border-radius: 10px;\n row-gap: 16px;\n height: 100%;\n\n ${({ theme, $highlight }) => $highlight && `background-color: ${theme.stigg.palette.backgroundSection}`};\n`;\n","import isUndefined from 'lodash/isUndefined';\nimport React from 'react';\nimport { BillingModel, CustomerPortalEntitlement } from '@stigg/js-client-sdk';\nimport { CustomerPortalSubscriptionPriceFragment } from '@stigg/api-client-js/src/generated/sdk';\nimport { Typography } from '../../../common/Typography';\nimport { useCustomerPortalContext } from '../../CustomerPortalProvider';\nimport { getResetUsageText, getUsagePercentage } from './FeatureUsage.helper';\nimport { getFeatureDisplayName } from '../../../utils/getFeatureName';\nimport { FeatureUsageContainer } from './FeatureUsage.style';\nimport { FeatureUsageProgressBar } from './FeatureUsageProgressBar';\nimport { Icon } from '../../../common/Icon';\nimport { InformationTooltip } from '../../../common/InformationTooltip';\nimport { LongText } from '../../../common/LongText';\nimport { EntitlementCtaButton } from './EntitlementCTAButton';\nimport { OnBuyMoreCallbackFn } from '../../types';\nimport { OnManageClick } from '../../CustomerPortalContainer';\n\nexport type UsageBoxProps = {\n entitlement: CustomerPortalEntitlement;\n subscriptionPrice: CustomerPortalSubscriptionPriceFragment | undefined;\n onManageSubscription: OnManageClick | undefined;\n onBuyMore?: OnBuyMoreCallbackFn;\n hasCustomSubscription: boolean;\n canUpgradeSubscription: boolean;\n};\n\nexport function FeatureUsage({\n entitlement,\n subscriptionPrice,\n onManageSubscription,\n onBuyMore,\n hasCustomSubscription,\n canUpgradeSubscription,\n}: UsageBoxProps) {\n const { theme } = useCustomerPortalContext();\n\n const hasOverageUsage = !entitlement.hasUnlimitedUsage && entitlement.currentUsage! > entitlement.usageLimit!;\n\n if (!entitlement.feature) {\n return null;\n }\n\n return (\n <FeatureUsageContainer $highlight={!!subscriptionPrice} $borderColor={theme.borderColor}>\n <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 16 }}>\n <LongText variant=\"body1\">{entitlement.feature && getFeatureDisplayName(entitlement.feature)}</LongText>\n {subscriptionPrice && (\n <InformationTooltip\n title={\n <Typography variant=\"body1\">\n {subscriptionPrice.billingModel === BillingModel.PerUnit\n ? 'Billed for committed usage'\n : 'Billed for actual usage'}\n </Typography>\n }>\n <Icon icon=\"DollarCoin\" svgStrokeColor={theme.iconsColor} />\n </InformationTooltip>\n )}\n </div>\n\n <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 8 }}>\n <LongText\n variant=\"body1\"\n color={hasOverageUsage ? 'error' : 'primary'}\n data-testid={`usage-data-${entitlement.feature?.refId}`}>\n {entitlement.currentUsage?.toLocaleString()}\n {!entitlement.hasUnlimitedUsage &&\n ` / ${entitlement.usageLimit?.toLocaleString()} (${getUsagePercentage(\n entitlement.currentUsage || 0,\n entitlement.usageLimit!,\n )}%)`}\n </LongText>\n\n <EntitlementCtaButton\n entitlement={entitlement}\n feature={entitlement.feature}\n onBuyMore={onBuyMore}\n canBuyMore={!!subscriptionPrice}\n onManageSubscription={onManageSubscription}\n canUpgradeSubscription={canUpgradeSubscription}\n hasCustomSubscription={hasCustomSubscription}\n />\n </div>\n\n <FeatureUsageProgressBar entitlement={entitlement} />\n\n {!entitlement.hasUnlimitedUsage &&\n !isUndefined(entitlement.usageLimit) &&\n !isUndefined(entitlement.currentUsage) &&\n entitlement.resetPeriod &&\n entitlement.usagePeriodEnd ? (\n <Typography color=\"secondary\">{getResetUsageText(entitlement)}</Typography>\n ) : null}\n {entitlement.hasUnlimitedUsage && <Typography color=\"secondary\">In current billing period</Typography>}\n </FeatureUsageContainer>\n );\n}\n","import styled from '@emotion/styled/macro';\nimport Grid from '@mui/material/Grid';\nimport { range } from 'lodash';\nimport Skeleton from 'react-loading-skeleton';\nimport React from 'react';\nimport { useIsScreenWiderThan } from '../../hooks/useIsScreenWiderThan';\n\nexport const Footer = styled.div`\n margin-top: 32px;\n`;\n\nexport function CustomerUsageLoader() {\n const isMdScreen = useIsScreenWiderThan('md');\n return (\n <Grid container spacing={4} className=\"stigg-subscription-usage-skeleton-layout\" sx={{ flexWrap: 'wrap' }}>\n {range(6).map((item) => (\n <Grid key={item} item xs={isMdScreen ? 4 : 12}>\n <Skeleton width={280} height={120} />\n </Grid>\n ))}\n </Grid>\n );\n}\n","import { MeterType, PricingType, SubscriptionStatus } from '@stigg/js-client-sdk';\nimport React, { useState } from 'react';\nimport { compact, keyBy } from 'lodash';\nimport { Minus, Plus } from 'react-feather';\nimport Grid from '@mui/material/Grid';\nimport { useCustomerPortalContext } from '../CustomerPortalProvider';\nimport { FeatureUsage } from './featureUsage/FeatureUsage';\nimport { Footer, CustomerUsageLoader } from './CustomerUsageData.style';\nimport { SectionContainer } from '../common/SectionContainer';\nimport { SectionHeader } from '../common/SectionHeader';\nimport { SectionTitle } from '../common/SectionTitle';\nimport { StyledButton } from '../common/StyledButton';\nimport { FilterEntitlementsFn, OnBuyMoreCallbackFn } from '../types';\nimport { OnManageClick } from '../CustomerPortalContainer';\nimport { useIsScreenWiderThan } from '../../hooks/useIsScreenWiderThan';\n\nconst MAX_BOXES = 6;\n\nexport type CustomerUsageDataProps = {\n onManageSubscription?: OnManageClick;\n onBuyMore?: OnBuyMoreCallbackFn;\n filterEntitlements?: FilterEntitlementsFn;\n};\n\nexport function CustomerUsageData({ onManageSubscription, onBuyMore, filterEntitlements }: CustomerUsageDataProps) {\n const [showAll, setShowAll] = useState(false);\n const isMdScreen = useIsScreenWiderThan('md');\n\n const { customerPortal, isLoading, textOverrides, theme } = useCustomerPortalContext();\n const isLoadingData = isLoading || !customerPortal;\n const { entitlements, subscriptions } = customerPortal || {};\n const meteredEntitlements = entitlements?.filter(\n (entitlement) =>\n entitlement.feature?.meterType === MeterType.Fluctuating ||\n entitlement.feature?.meterType === MeterType.Incremental,\n );\n const activeSubscription = subscriptions?.find(({ status }) => status === SubscriptionStatus.Active);\n const hasCustomSubscription = activeSubscription?.pricingType === PricingType.Custom;\n const canUpgradeSubscription = !!customerPortal?.canUpgradeSubscription;\n\n const subscriptionPriceByFeature = keyBy(activeSubscription?.prices, 'feature.refId');\n const entitlementByFeature = keyBy(meteredEntitlements, 'feature.refId');\n\n // sort features by prices first, then other entitlements\n const priceEntitlements = compact(\n activeSubscription?.prices.map(\n (subscriptionPrice) => subscriptionPrice.feature && entitlementByFeature[subscriptionPrice.feature.refId],\n ),\n );\n const otherEntitlements = compact(\n meteredEntitlements?.filter((entitlement) => !subscriptionPriceByFeature[entitlement.feature!.refId]),\n );\n const sortedEntitlements = [...priceEntitlements, ...otherEntitlements];\n\n const filteredEntitlements = filterEntitlements ? filterEntitlements(sortedEntitlements) : sortedEntitlements;\n\n // 4 -> 3 per row, 6 -> 2 per row\n const xs = isMdScreen ? (filteredEntitlements.length > 2 ? 4 : 6) : 12;\n\n const entitlementsToShow = showAll ? filteredEntitlements : filteredEntitlements.slice(0, MAX_BOXES);\n\n const toggleShowAll = () => setShowAll((prevState) => !prevState);\n\n if (!isLoadingData && !meteredEntitlements?.length) {\n return null;\n }\n\n return (\n <SectionContainer\n className=\"stigg-subscription-usage-layout\"\n $backgroundColor={theme.backgroundColor}\n $borderColor={theme.borderColor}>\n <SectionHeader>\n <SectionTitle\n title={textOverrides.usageTabTitle}\n className=\"stigg-customer-portal-usage-section-title\"\n isLoading={isLoadingData}\n />\n </SectionHeader>\n\n {isLoadingData ? (\n <CustomerUsageLoader />\n ) : (\n <>\n <Grid container spacing={4}>\n {entitlementsToShow.map((entitlement) => (\n <Grid\n className={`stigg-entitlement-usage-${entitlement.feature!.refId}`}\n key={entitlement.feature!.refId}\n item\n xs={xs}>\n <FeatureUsage\n key={entitlement.feature!.refId}\n subscriptionPrice={subscriptionPriceByFeature[entitlement.feature!.refId]}\n entitlement={entitlement}\n onManageSubscription={onManageSubscription}\n onBuyMore={onBuyMore}\n hasCustomSubscription={hasCustomSubscription}\n canUpgradeSubscription={canUpgradeSubscription}\n />\n </Grid>\n ))}\n </Grid>\n\n {filteredEntitlements.length > MAX_BOXES && (\n <Footer>\n <StyledButton\n className=\"stigg-usage-toggle-many-button\"\n variant=\"text\"\n startIcon={showAll ? <Minus /> : <Plus />}\n onClick={toggleShowAll}>\n {showAll ? 'Show less' : 'Show more'}\n </StyledButton>\n </Footer>\n )}\n </>\n )}\n </SectionContainer>\n );\n}\n","import React, { useRef } from 'react';\nimport { SubscriptionsOverview } from './subscriptionOverview/SubscriptionsOverview';\nimport { CustomerPortalHeader } from './CustomerPortalHeader';\nimport { PaymentDetailsSection } from './billing/PaymentDetailsSection';\nimport { CustomerPortalPaywall } from './paywall/CustomerPortalPaywall';\nimport { useCustomerPortalContext } from './CustomerPortalProvider';\nimport { CustomerPortalLayout, CustomerPortalSections } from './CustomerPortal.style';\nimport { CustomerPortalProps } from './CustomerPortal';\nimport { InvoicesSection, useStiggContext } from '../..';\nimport { CustomerUsageData } from './usage/CustomerUsageData';\nimport { CustomerPortalIntentionType } from './types';\n\nexport type OnManageClick = ({ intentionType }: { intentionType: CustomerPortalIntentionType }) => void;\n\nexport function CustomerPortalContainer({\n onManageSubscription,\n onBuyMore,\n onCancelScheduledUpdates,\n onContactSupport,\n paywallComponent,\n hiddenSections,\n filterEntitlements,\n}: CustomerPortalProps) {\n const { stigg } = useStiggContext();\n const { customerPortal, textOverrides, theme, isLoading } = useCustomerPortalContext();\n const customerPortalSectionRef = useRef<HTMLDivElement>(null);\n\n const onManageClick: OnManageClick = ({ intentionType }: { intentionType: CustomerPortalIntentionType }) => {\n if (onManageSubscription) {\n void onManageSubscription({\n intentionType,\n customerSubscriptions: customerPortal?.subscriptions ?? [],\n });\n } else {\n customerPortalSectionRef?.current?.scrollIntoView({ behavior: 'smooth' });\n }\n };\n\n const shouldShowUsage = !hiddenSections?.some((section) => section === 'usage');\n const shouldShowPaymentDetails = !hiddenSections?.some(\n (section) => section === 'paymentDetails' || section === 'billingInformation',\n );\n const shouldShowInvoices = !hiddenSections?.some(\n (section) => section === 'invoices' || section === 'billingInformation',\n );\n\n return (\n <CustomerPortalLayout className=\"stigg-customer-portal-layout\">\n <CustomerPortalHeader showWatermark={stigg.isWidgetWatermarkEnabled && !!customerPortal} />\n <CustomerPortalSections className=\"stigg-customer-portal-sections\">\n <SubscriptionsOverview\n onCancelScheduledUpdates={onCancelScheduledUpdates}\n onBuyMore={onBuyMore}\n onManageSubscription={onManageClick}\n onContactSupport={onContactSupport}\n hiddenSections={hiddenSections}\n cancelScheduledUpdatesButtonTitle={textOverrides.cancelScheduledUpdatesButtonTitle}\n />\n {shouldShowUsage && (\n <CustomerUsageData\n onManageSubscription={onManageClick}\n onBuyMore={onBuyMore}\n filterEntitlements={filterEntitlements}\n />\n )}\n <CustomerPortalPaywall\n ref={customerPortalSectionRef}\n paywallComponent={paywallComponent}\n theme={theme}\n title={textOverrides.paywallSectionTitle}\n isLoading={!customerPortal || isLoading}\n />\n {shouldShowPaymentDetails && <PaymentDetailsSection />}\n {shouldShowInvoices && <InvoicesSection />}\n </CustomerPortalSections>\n </CustomerPortalLayout>\n );\n}\n","import React from 'react';\nimport { useCustomerPortalContext } from '../CustomerPortalProvider';\nimport { SectionTitle } from '../common/SectionTitle';\nimport { ExternalLinkButton } from '../common/ExternalLinkButton';\nimport { SectionContainer } from '../common/SectionContainer';\nimport { SectionHeader } from '../common/SectionHeader';\nimport { SkeletonButton } from '../common/SkeletonButton';\n\nexport function InvoicesSection() {\n const { customerPortal, isLoading, textOverrides, theme } = useCustomerPortalContext();\n const isLoadingData = !customerPortal || isLoading;\n\n const viewInvoiceHistoryButton = isLoadingData ? (\n <SkeletonButton />\n ) : customerPortal?.billingPortalUrl ? (\n <ExternalLinkButton\n url={customerPortal.billingPortalUrl}\n text={textOverrides.viewInvoiceHistory}\n className=\"stigg-view-invoice-history-button\"\n />\n ) : null;\n\n if (!isLoadingData && !customerPortal?.billingPortalUrl) {\n return null;\n }\n\n return (\n <SectionContainer\n className=\"stigg-invoices-section-layout\"\n $backgroundColor={theme.backgroundColor}\n $borderColor={theme.borderColor}>\n <SectionHeader className=\"stigg-invoices-section-header\">\n <SectionTitle\n isLoading={isLoadingData}\n className=\"stigg-invoices-section-title\"\n title={textOverrides.invoicesTitle}\n />\n {viewInvoiceHistoryButton}\n </SectionHeader>\n </SectionContainer>\n );\n}\n","import sortBy from 'lodash/sortBy';\nimport { Addon, BillingPeriod, Currency, SubscriptionAddon } from '@stigg/js-client-sdk';\n\ntype FilterAddonsBaseProps = {\n billingPeriod: BillingPeriod;\n currency: Currency;\n billingCountryCode?: string;\n};\n\nexport const sortAddons = (addons: Addon[]) => {\n return sortBy(addons, 'displayName');\n};\n\nexport const sortSubscriptionAddons = (addons: SubscriptionAddon[]) => {\n return sortBy(addons, 'addon.displayName');\n};\n\nfunction filterAddonPricePointsByBillingPeriod(addon: Addon, billingPeriod: BillingPeriod) {\n return addon.pricePoints.some((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n}\n\nfunction mapAddonPricePointsByBillingCountryCode({\n addon,\n currency,\n billingCountryCode,\n}: {\n addon: Addon;\n currency: Currency;\n billingCountryCode?: string;\n}) {\n return {\n ...addon,\n pricePoints: addon.pricePoints.filter(\n (pricePoint) =>\n pricePoint.currency === currency &&\n (billingCountryCode ? pricePoint.billingCountryCode === billingCountryCode : true),\n ),\n };\n}\n\nexport function filterAddons({\n addons,\n billingPeriod,\n billingCountryCode,\n currency,\n}: { addons?: Addon[] } & FilterAddonsBaseProps): Addon[] {\n return (\n addons\n ?.filter((addon) => filterAddonPricePointsByBillingPeriod(addon, billingPeriod))\n ?.map((addon) => mapAddonPricePointsByBillingCountryCode({ addon, currency, billingCountryCode })) || []\n );\n}\n\nexport function filterSubscriptionAddons({\n addons,\n billingPeriod,\n billingCountryCode,\n currency,\n}: { addons?: SubscriptionAddon[] } & FilterAddonsBaseProps): SubscriptionAddon[] {\n return (\n addons\n ?.filter((addon) => filterAddonPricePointsByBillingPeriod(addon.addon, billingPeriod))\n ?.map((addon) => ({\n ...addon,\n addon: mapAddonPricePointsByBillingCountryCode({ addon: addon.addon, currency, billingCountryCode }),\n })) || []\n );\n}\n","import cloneDeep from 'lodash/cloneDeep';\nimport remove from 'lodash/remove';\nimport { Addon, BillingPeriod, Currency, Plan, Subscription, SubscriptionAddon } from '@stigg/js-client-sdk';\nimport { useCheckoutContext } from '../CheckoutProvider';\nimport {\n filterAddons,\n filterSubscriptionAddons,\n sortAddons,\n sortSubscriptionAddons,\n} from '../steps/addons/addon.utils';\n\nexport type AddonsStepState = {\n addons: SubscriptionAddon[];\n initialAddons?: SubscriptionAddon[];\n availableAddons?: Addon[];\n};\n\ntype GetAddonsStepInitialStateProps = {\n plan?: Plan;\n billingPeriod: BillingPeriod;\n activeSubscription?: Subscription | null;\n billingCountryCode?: string;\n};\n\nexport function getAddonsStepInitialState({\n activeSubscription,\n plan,\n billingPeriod,\n billingCountryCode,\n}: GetAddonsStepInitialStateProps): AddonsStepState {\n let addons: SubscriptionAddon[] = [];\n const currency = plan?.pricePoints?.[0]?.currency || Currency.Usd;\n const availableAddons = sortAddons(\n filterAddons({\n addons: plan?.compatibleAddons,\n billingPeriod,\n billingCountryCode,\n currency,\n }),\n );\n\n const activeSubscriptionAddons = filterSubscriptionAddons({\n addons: activeSubscription?.addons,\n billingPeriod,\n billingCountryCode,\n currency,\n });\n\n if (activeSubscriptionAddons?.length && availableAddons?.length) {\n addons = sortSubscriptionAddons(\n activeSubscriptionAddons.filter((addon) => availableAddons.some((planAddon) => planAddon.id === addon.addon.id)),\n );\n }\n\n return { addons, initialAddons: cloneDeep(addons), availableAddons };\n}\n\nfunction useSetAddon() {\n const [, setState] = useCheckoutContext();\n\n return (addon: Addon, quantity: number) =>\n setState((draft) => {\n const addonToUpdate = draft.addonsStep.addons.find((currentAddon) => currentAddon.addon.id === addon.id);\n\n if (addonToUpdate) {\n addonToUpdate.quantity = quantity;\n } else {\n draft.addonsStep.addons.push({ addon, quantity });\n draft.addonsStep.addons = sortSubscriptionAddons(draft.addonsStep.addons);\n }\n });\n}\n\nfunction useRemoveAddon() {\n const [, setState] = useCheckoutContext();\n\n return (addonId: string) =>\n setState((draft) => {\n remove(draft.addonsStep.addons, (addon) => addon.addon.id === addonId);\n });\n}\n\nfunction useAddonsState() {\n const [{ addonsStep }] = useCheckoutContext();\n return addonsStep;\n}\n\nexport function useAddonsStepModel() {\n const state = useAddonsState();\n\n return {\n ...state,\n setAddon: useSetAddon(),\n removeAddon: useRemoveAddon(),\n };\n}\n","import { useCheckoutContext } from '../CheckoutProvider';\n\nexport type WidgetState = {\n readOnly?: boolean;\n isLoadingCheckoutData?: boolean;\n isValid?: boolean;\n};\n\nfunction useCheckoutState() {\n const [{ checkout, widgetState, checkoutLocalization, checkoutSuccess }] = useCheckoutContext();\n return { checkoutState: checkout, widgetState, checkoutLocalization, checkoutSuccess };\n}\n\nfunction useSetWidgetReadonly() {\n const [, setState] = useCheckoutContext();\n\n return (readOnly: boolean) =>\n setState((draft) => {\n draft.widgetState.readOnly = readOnly;\n });\n}\n\nfunction useSetIsValid() {\n const [, setState] = useCheckoutContext();\n\n return (isValid: boolean) =>\n setState((draft) => {\n draft.widgetState.isValid = isValid;\n });\n}\n\nfunction useSetCheckoutSuccess() {\n const [, setState] = useCheckoutContext();\n\n return (checkoutSuccess: boolean) =>\n setState((draft) => {\n draft.checkoutSuccess = checkoutSuccess;\n });\n}\n\nexport function useCheckoutModel() {\n const { checkoutState, widgetState, checkoutLocalization, checkoutSuccess } = useCheckoutState();\n\n return {\n checkoutState,\n widgetState,\n checkoutLocalization,\n checkoutSuccess,\n setWidgetReadOnly: useSetWidgetReadonly(),\n setIsValid: useSetIsValid(),\n setCheckoutSuccess: useSetCheckoutSuccess(),\n };\n}\n","import { BillableFeatureInput } from '@stigg/api-client-js/src/generated/sdk';\nimport { Addon, BillableFeature, BillingPeriod, CheckoutStatePlan } from '@stigg/js-client-sdk';\nimport { useCheckoutContext } from '../CheckoutProvider';\nimport { CheckoutSteps } from '../configurations/steps';\nimport { hasMultipleBillingPeriods } from '../../utils/planPrices';\n\nexport enum CheckoutStepKey {\n PLAN = 'PLAN',\n ADDONS = 'ADDONS',\n PAYMENT = 'PAYMENT',\n}\n\nexport type CheckoutStep = {\n key: CheckoutStepKey;\n label: string;\n};\n\nconst CHECKOUT_STEPS: CheckoutStep[] = [\n { key: CheckoutStepKey.PLAN, label: 'Plan' },\n { key: CheckoutStepKey.ADDONS, label: 'Add-ons' },\n { key: CheckoutStepKey.PAYMENT, label: 'Payment details' },\n];\n\nexport type ProgressBarState = {\n activeStep: number;\n completedSteps: number[];\n steps: CheckoutStep[];\n isDisabled: boolean;\n};\n\nconst INITIAL_STATE: ProgressBarState = {\n activeStep: 0,\n completedSteps: [],\n steps: CHECKOUT_STEPS,\n isDisabled: false,\n};\n\ntype GetProgressBarInitialStateProps = {\n isLoading: boolean;\n skipCheckoutSteps: CheckoutSteps[];\n plan?: CheckoutStatePlan;\n availableAddons?: Addon[];\n availableCharges: BillableFeatureInput[];\n preferredBillingPeriod?: BillingPeriod;\n preconfiguredBillableFeatures: BillableFeature[];\n};\n\nconst canSkipPlanStep = (\n plan: CheckoutStatePlan,\n availableCharges: BillableFeatureInput[],\n preconfiguredBillableFeatures: BillableFeature[],\n preferredBillingPeriod?: BillingPeriod,\n) => {\n // if multiple billing periods are available, a preferred billing period must be selected\n if (hasMultipleBillingPeriods(plan) && !preferredBillingPeriod) {\n return false;\n }\n\n const availableChargesIds = availableCharges.map((charge) => charge.featureId);\n const preconfiguredChargesIds = preconfiguredBillableFeatures.map((charge) => charge.featureId);\n\n // if there are available charges, they must be preconfigured\n if (\n availableChargesIds.length !== preconfiguredChargesIds.length ||\n !availableChargesIds.every((charge) => preconfiguredChargesIds.includes(charge))\n ) {\n return false;\n }\n\n return true;\n};\n\nexport function getProgressBarInitialState({\n isLoading,\n skipCheckoutSteps,\n plan,\n availableAddons,\n availableCharges,\n preferredBillingPeriod,\n preconfiguredBillableFeatures,\n}: GetProgressBarInitialStateProps) {\n if (isLoading || !plan) {\n return INITIAL_STATE;\n }\n\n const stepsToFilter: CheckoutStepKey[] = [];\n\n if (\n skipCheckoutSteps.includes('PLAN') &&\n canSkipPlanStep(plan, availableCharges, preconfiguredBillableFeatures, preferredBillingPeriod)\n ) {\n stepsToFilter.push(CheckoutStepKey.PLAN);\n }\n\n if (availableAddons?.length === 0 || skipCheckoutSteps.includes('ADDONS')) {\n stepsToFilter.push(CheckoutStepKey.ADDONS);\n }\n\n return { ...INITIAL_STATE, steps: CHECKOUT_STEPS.filter((step) => !stepsToFilter.includes(step.key)) };\n}\n\nfunction useProgressBarState() {\n const [{ progressBar }] = useCheckoutContext();\n return progressBar;\n}\n\nfunction useSetActiveStep() {\n const [, setState] = useCheckoutContext();\n return (stepNumber: number) =>\n setState(({ progressBar }) => {\n progressBar.activeStep = stepNumber;\n });\n}\nfunction useMarkStepAsCompleted() {\n const [, setState] = useCheckoutContext();\n return (stepNumber: number) =>\n setState(({ progressBar }) => {\n progressBar.completedSteps.push(stepNumber);\n });\n}\n\nfunction isCheckoutComplete(progressBar: ProgressBarState) {\n return progressBar.completedSteps.length >= progressBar.steps.length - 1;\n}\n\nfunction useGoNext() {\n const [, setState] = useCheckoutContext();\n return () =>\n setState(({ progressBar }) => {\n if (progressBar.isDisabled) {\n return;\n }\n\n if (!progressBar.completedSteps.includes(progressBar.activeStep)) {\n progressBar.completedSteps.push(progressBar.activeStep);\n }\n\n if (progressBar.activeStep < progressBar.steps.length - 1) {\n progressBar.activeStep += 1;\n }\n });\n}\n\nfunction useSetIsDisabled() {\n const [, setState] = useCheckoutContext();\n return (isDisabled?: boolean) =>\n setState(({ progressBar }) => {\n progressBar.isDisabled = !!isDisabled;\n });\n}\n\nexport function useProgressBarModel() {\n const progressBarState = useProgressBarState();\n const currentStep = progressBarState.steps[progressBarState.activeStep];\n\n return {\n currentStep,\n progressBarState,\n isLastStep: progressBarState.activeStep === progressBarState.steps.length - 1,\n isCheckoutComplete: isCheckoutComplete(progressBarState),\n setActiveStep: useSetActiveStep(),\n markStepAsCompleted: useMarkStepAsCompleted(),\n goNext: useGoNext(),\n setIsDisabled: useSetIsDisabled(),\n };\n}\n","import { Price } from '@stigg/js-client-sdk';\n\nexport const getValidPriceQuantity = (price: Price, quantity: number) => {\n if (price.minUnitQuantity && quantity < price.minUnitQuantity) {\n return price.minUnitQuantity;\n }\n if (price.maxUnitQuantity && quantity > price.maxUnitQuantity) {\n return price.maxUnitQuantity;\n }\n return quantity;\n};\n","import { Plan } from '@stigg/js-client-sdk';\nimport { BillingPeriod } from '@stigg/api-client-js/src/generated/sdk';\n\nexport const hasMonthlyPrices = (plan?: Plan) =>\n !!plan?.pricePoints.some((pricePoint) => pricePoint.billingPeriod === BillingPeriod.Monthly);\n\nexport const hasAnnualPrices = (plan?: Plan) =>\n !!plan?.pricePoints.some((pricePoint) => pricePoint.billingPeriod === BillingPeriod.Annually);\n\nexport const hasMultipleBillingPeriods = (plan?: Plan) => hasMonthlyPrices(plan) && hasAnnualPrices(plan);\n","import keyBy from 'lodash/keyBy';\nimport compact from 'lodash/compact';\nimport { BillableFeatureInput, BillingPeriod } from '@stigg/api-client-js/src/generated/sdk';\nimport { BillableFeature, BillingModel, Plan, Price, Subscription } from '@stigg/js-client-sdk';\nimport { useCheckoutContext } from '../CheckoutProvider';\nimport { getTierByQuantity, hasTierWithUnitPrice } from '../../utils/priceTierUtils';\nimport { getValidPriceQuantity } from '../../utils/priceUtils';\nimport { hasAnnualPrices, hasMonthlyPrices } from '../../utils/planPrices';\n\nexport type PlanStepState = {\n billingPeriod: BillingPeriod;\n billableFeatures: BillableFeatureInput[];\n billingCountryCode?: string;\n};\n\ntype GetPlanStepInitialStateProps = {\n preferredBillingPeriod?: BillingPeriod;\n plan?: Plan;\n activeSubscription?: Subscription | null;\n billingCountryCode?: string;\n preconfiguredBillableFeatures: BillableFeature[];\n};\n\nconst getBillingPeriod = (billingPeriod: BillingPeriod, hasMonthlyPrices?: boolean, hasAnnualPrices?: boolean) => {\n if (billingPeriod === BillingPeriod.Monthly && hasMonthlyPrices) {\n return billingPeriod;\n }\n if (billingPeriod === BillingPeriod.Annually && hasAnnualPrices) {\n return billingPeriod;\n }\n return null;\n};\n\nconst isInAdvanceCommitmentCharge = ({ pricingModel }: Price) => {\n return pricingModel === BillingModel.PerUnit;\n};\n\nfunction getBillableFeatures(\n preconfiguredBillableFeatures: BillableFeature[],\n planPrices?: Price[],\n activeSubscription?: Subscription | null,\n): BillableFeature[] {\n if (!planPrices) return [];\n\n const preconfBillableFeaturesByFeatureId = keyBy(preconfiguredBillableFeatures, 'featureId');\n\n const quantityByFeatureId = keyBy(\n compact(\n activeSubscription?.prices?.map((charge) => {\n const { feature } = charge;\n if (!feature || !isInAdvanceCommitmentCharge(charge)) {\n return null;\n }\n\n return {\n featureId: feature.featureId,\n quantity: feature.unitQuantity || null,\n };\n }),\n ),\n 'featureId',\n );\n\n return compact(\n planPrices?.map((price) => {\n const featureId = price.feature?.featureId;\n if (!featureId || !isInAdvanceCommitmentCharge(price)) {\n return null;\n }\n\n let quantity;\n const preconfiguredQuantity =\n preconfBillableFeaturesByFeatureId[featureId]?.quantity || quantityByFeatureId[featureId]?.quantity;\n\n quantity = getValidPriceQuantity(price, preconfiguredQuantity || 1);\n\n if (price.isTieredPrice && !hasTierWithUnitPrice(price.tiers)) {\n const tier = getTierByQuantity(price.tiers!, quantity);\n quantity = tier.upTo!;\n }\n\n return {\n featureId,\n quantity,\n };\n }),\n );\n}\n\nfunction resolveBillingPeriod({\n plan,\n activeSubscription,\n preferredBillingPeriod,\n}: {\n plan?: Plan;\n activeSubscription?: Subscription | null;\n preferredBillingPeriod?: BillingPeriod;\n}) {\n const hasMonthlyPlan = hasMonthlyPrices(plan);\n const hasAnnualPlan = hasAnnualPrices(plan);\n\n if (preferredBillingPeriod) {\n const billingPeriod = getBillingPeriod(preferredBillingPeriod, hasMonthlyPlan, hasAnnualPlan);\n if (billingPeriod) {\n return billingPeriod;\n }\n }\n\n const isUpdate = activeSubscription?.plan?.id === plan?.id;\n if (isUpdate) {\n return activeSubscription?.price?.billingPeriod || BillingPeriod.Monthly;\n }\n\n if (activeSubscription?.prices && activeSubscription?.prices.length > 0) {\n const billingPeriod = getBillingPeriod(activeSubscription?.prices[0].billingPeriod, hasMonthlyPlan, hasAnnualPlan);\n if (billingPeriod) {\n return billingPeriod;\n }\n }\n\n return hasAnnualPlan ? BillingPeriod.Annually : BillingPeriod.Monthly;\n}\n\nexport function getPlanStepInitialState({\n preferredBillingPeriod,\n plan,\n activeSubscription,\n billingCountryCode,\n preconfiguredBillableFeatures,\n}: GetPlanStepInitialStateProps): PlanStepState {\n const billingPeriod = resolveBillingPeriod({ plan, activeSubscription, preferredBillingPeriod });\n const planPrices = plan?.pricePoints.filter((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n const billableFeatures = getBillableFeatures(preconfiguredBillableFeatures, planPrices, activeSubscription);\n\n return {\n billingPeriod,\n billableFeatures,\n billingCountryCode,\n };\n}\n\nfunction usePlanState() {\n const [{ planStep }] = useCheckoutContext();\n return planStep;\n}\n\nfunction useSetBillableFeature() {\n const [, setState] = useCheckoutContext();\n\n return (featureId: string, quantity: number) =>\n setState((draft) => {\n const billableFeature = draft.planStep.billableFeatures.find(\n (billableFeature) => billableFeature.featureId === featureId,\n );\n\n if (billableFeature) {\n billableFeature.quantity = quantity;\n } else {\n draft.planStep.billableFeatures.push({ featureId, quantity });\n }\n });\n}\n\nfunction useSetBillingPeriod() {\n const [, setState] = useCheckoutContext();\n\n return (billingPeriod: BillingPeriod) =>\n setState((draft) => {\n draft.planStep.billingPeriod = billingPeriod;\n });\n}\n\nexport function usePlanStepModel() {\n const state = usePlanState();\n\n return {\n ...state,\n setBillingPeriod: useSetBillingPeriod(),\n setBillableFeature: useSetBillableFeature(),\n };\n}\n","import { useCheckoutContext } from '../CheckoutProvider';\nimport { AddonsStepState } from './useAddonsStepModel';\nimport { PromotionCodeState } from './useCouponModel';\nimport { PaymentStepState } from './usePaymentStepModel';\nimport { PlanStepState } from './usePlanStepModel';\n\nexport type SubscriptionState = PlanStepState &\n PromotionCodeState &\n Pick<AddonsStepState, 'addons'> &\n Pick<PaymentStepState, 'billingAddress' | 'taxPercentage'>;\n\nexport function useSubscriptionModel(): SubscriptionState {\n const [{ planStep, addonsStep, promotionCode, paymentStep }] = useCheckoutContext();\n\n return {\n ...planStep,\n addons: addonsStep.addons,\n promotionCode,\n billingAddress: paymentStep.billingAddress,\n taxPercentage: paymentStep.taxPercentage,\n };\n}\n","import { useCallback, useEffect, useState } from 'react';\nimport isEmpty from 'lodash/isEmpty';\nimport { BillingAddress, PreviewSubscription, StiggClient, SubscriptionPreviewV2 } from '@stigg/js-client-sdk';\nimport { useCheckoutContext } from '../CheckoutProvider';\nimport { useCheckoutModel } from './useCheckoutModel';\nimport { SubscriptionState, useSubscriptionModel } from './useSubscriptionModel';\nimport { MockCheckoutPreviewCallback } from '../types';\nimport { useStiggContext } from '../../../hooks/useStiggContext';\n\nfunction mapBillingInformation({\n billingAddress,\n taxPercentage,\n}: {\n billingAddress?: BillingAddress;\n taxPercentage?: number;\n}): Pick<PreviewSubscription, 'billingInformation'> {\n if (!billingAddress && !taxPercentage) {\n return {};\n }\n\n return {\n billingInformation: {\n ...(billingAddress ? { billingAddress } : {}),\n ...(taxPercentage ? { taxPercentage } : {}),\n },\n };\n}\n\ntype UsePreviewSubscriptionProps = {\n onMockCheckoutPreview?: MockCheckoutPreviewCallback;\n};\n\nexport type PreviewSubscriptionProps = {\n customerId?: string;\n planId?: string;\n resourceId?: string;\n stigg: StiggClient;\n} & SubscriptionState &\n UsePreviewSubscriptionProps;\n\nconst previewSubscription = async ({\n stigg,\n customerId,\n planId,\n resourceId,\n promotionCode,\n addons,\n billableFeatures,\n billingCountryCode,\n billingPeriod,\n billingAddress,\n taxPercentage,\n onMockCheckoutPreview,\n}: PreviewSubscriptionProps) => {\n const estimateAddons = addons.map(({ addon, quantity }) => ({ addonId: addon.id, quantity }));\n let subscriptionPreview: SubscriptionPreviewV2 | null = null;\n let errorMessage: string | null = null;\n\n try {\n if (customerId && planId) {\n const previewSubscriptionProps: PreviewSubscription = {\n customerId,\n planId,\n resourceId,\n billingCountryCode,\n addons: estimateAddons,\n billingPeriod,\n promotionCode,\n billableFeatures: isEmpty(billableFeatures) ? undefined : billableFeatures,\n ...mapBillingInformation({ billingAddress, taxPercentage }),\n };\n\n subscriptionPreview = onMockCheckoutPreview\n ? onMockCheckoutPreview(previewSubscriptionProps)\n : await stigg.previewSubscription(previewSubscriptionProps);\n }\n } catch (error) {\n const [, errorMsg] = (error as any)?.message?.split('Error:') || [];\n\n errorMessage = errorMsg?.trim();\n }\n\n return { subscriptionPreview, errorMessage };\n};\n\nexport const usePreviewSubscriptionAction = ({ onMockCheckoutPreview }: UsePreviewSubscriptionProps = {}) => {\n const { stigg } = useStiggContext();\n const subscription = useSubscriptionModel();\n const [{ resourceId }] = useCheckoutContext();\n const { checkoutState, widgetState } = useCheckoutModel();\n const { plan, customer } = checkoutState || {};\n\n const previewSubscriptionAction = useCallback(\n async ({ promotionCode }: { promotionCode?: string | null } = {}) => {\n if (!widgetState.isValid) {\n return { subscriptionPreview: null, errorMessage: null };\n }\n\n return previewSubscription({\n stigg,\n customerId: customer?.id,\n planId: plan?.id,\n resourceId,\n addons: subscription.addons,\n billableFeatures: subscription.billableFeatures,\n billingCountryCode: subscription.billingCountryCode,\n billingPeriod: subscription.billingPeriod,\n billingAddress: subscription.billingAddress,\n taxPercentage: subscription.taxPercentage,\n promotionCode: promotionCode ?? subscription.promotionCode,\n onMockCheckoutPreview,\n });\n },\n [\n stigg,\n customer?.id,\n plan?.id,\n resourceId,\n subscription.addons,\n subscription.billableFeatures,\n subscription.billingCountryCode,\n subscription.billingPeriod,\n subscription.billingAddress,\n subscription.taxPercentage,\n subscription.promotionCode,\n widgetState.isValid,\n onMockCheckoutPreview,\n ],\n );\n\n return { previewSubscriptionAction };\n};\n\nconst SUBSCRIPTION_PREVIEW_DEBOUNCE_TIME = 500;\n\nexport const usePreviewSubscription = ({ onMockCheckoutPreview }: UsePreviewSubscriptionProps = {}) => {\n const [subscriptionPreview, setSubscriptionPreview] = useState<SubscriptionPreviewV2 | null>(null);\n const [isFetchingSubscriptionPreview, setIsFetchingSubscriptionPreview] = useState(false);\n\n const { previewSubscriptionAction } = usePreviewSubscriptionAction({ onMockCheckoutPreview });\n\n useEffect(() => {\n const estimateSubscription = async () => {\n const { subscriptionPreview } = await previewSubscriptionAction();\n if (subscriptionPreview) {\n setSubscriptionPreview(subscriptionPreview);\n }\n\n setIsFetchingSubscriptionPreview(false);\n };\n\n setIsFetchingSubscriptionPreview(true);\n\n const timer = setTimeout(() => {\n setIsFetchingSubscriptionPreview(true);\n void estimateSubscription();\n }, SUBSCRIPTION_PREVIEW_DEBOUNCE_TIME);\n\n return () => {\n clearTimeout(timer);\n };\n }, [previewSubscriptionAction]);\n\n return { subscriptionPreview, isFetchingSubscriptionPreview };\n};\n","import { BillingAddress, Customer } from '@stigg/js-client-sdk';\n\nimport { useCheckoutContext } from '../CheckoutProvider';\n\nexport type PaymentStepState = {\n useNewPaymentMethod: boolean;\n errorMessage?: string;\n billingAddress?: BillingAddress;\n taxPercentage?: number;\n};\n\ntype GetPaymentStepInitialStateProps = {\n customer?: Customer;\n taxPercentage?: number;\n};\n\nexport function getPaymentStepInitialState({\n customer,\n taxPercentage,\n}: GetPaymentStepInitialStateProps): PaymentStepState {\n return {\n useNewPaymentMethod: !customer?.paymentMethodDetails,\n taxPercentage,\n };\n}\n\nfunction useSetUseNewPaymentMethod() {\n const [, setState] = useCheckoutContext();\n\n return (useNewPaymentMethod: boolean) =>\n setState((draft) => {\n draft.paymentStep.useNewPaymentMethod = useNewPaymentMethod;\n });\n}\n\nfunction useSetErrorMessage() {\n const [, setState] = useCheckoutContext();\n\n return (errorMessage?: string) =>\n setState((draft) => {\n draft.paymentStep.errorMessage = errorMessage;\n });\n}\n\nfunction useSetBillingAddress() {\n const [, setState] = useCheckoutContext();\n\n return (billingAddress?: BillingAddress) =>\n setState((draft) => {\n draft.paymentStep.billingAddress = billingAddress;\n });\n}\n\nfunction usePaymentState() {\n const [{ paymentStep }] = useCheckoutContext();\n return paymentStep;\n}\n\nexport function usePaymentStepModel() {\n const state = usePaymentState();\n\n return {\n ...state,\n setUseNewPaymentMethod: useSetUseNewPaymentMethod(),\n setErrorMessage: useSetErrorMessage(),\n setBillingAddress: useSetBillingAddress(),\n };\n}\n","import { CheckoutConfiguration } from '@stigg/js-client-sdk';\nimport { StiggTheme } from '../../../theme/types';\nimport { DeepPartial } from '../../../types';\n\nexport type CheckoutTheme = {\n primary: string;\n textColor: string;\n backgroundColor: string;\n borderColor: string;\n summaryBackgroundColor: string;\n paymentInputBackgroundColor?: string;\n paymentInputBorderColor?: string;\n paymentInputBorderRadius?: string;\n};\n\nconst defaultCheckoutTheme: CheckoutTheme = {\n primary: 'rgb(50, 126, 238)',\n textColor: 'rgb(0, 30, 108)',\n backgroundColor: 'rgb(255, 255, 255)',\n borderColor: 'rgb(235, 237, 243)',\n summaryBackgroundColor: 'rgb(109, 121, 144)',\n};\n\nexport function getResolvedCheckoutTheme(\n globalTheme: StiggTheme,\n themeOverride?: DeepPartial<CheckoutTheme>,\n // all the remote colors override theme colors, no need to use them here\n _remoteConfiguration?: CheckoutConfiguration | null,\n): CheckoutTheme {\n const { palette: globalPalette } = globalTheme || {};\n\n return {\n primary: themeOverride?.primary || globalPalette?.primary || defaultCheckoutTheme.primary,\n textColor: themeOverride?.textColor || globalPalette?.text.primary || defaultCheckoutTheme.textColor,\n backgroundColor:\n themeOverride?.backgroundColor || globalPalette?.backgroundPaper || defaultCheckoutTheme.backgroundColor,\n borderColor: themeOverride?.borderColor || globalPalette?.outlinedBorder || defaultCheckoutTheme.borderColor,\n summaryBackgroundColor:\n themeOverride?.summaryBackgroundColor ||\n globalPalette?.backgroundHighlight ||\n defaultCheckoutTheme.summaryBackgroundColor,\n paymentInputBackgroundColor: themeOverride?.paymentInputBackgroundColor,\n paymentInputBorderColor: themeOverride?.paymentInputBorderColor,\n paymentInputBorderRadius: themeOverride?.paymentInputBorderRadius,\n };\n}\n","import { produce } from 'immer';\nimport React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport { BillableFeature, BillingPeriod, GetCheckoutStateResults } from '@stigg/js-client-sdk';\nimport { CustomizedTheme, SdkThemeProvider, useStiggTheme } from '../../theme/Theme';\nimport { DeepPartial } from '../../types';\nimport { mapCheckoutConfiguration, mapTypography } from '../common/mapExternalTheme';\nimport {\n AddonsStepState,\n getAddonsStepInitialState,\n getPaymentStepInitialState,\n getPlanStepInitialState,\n getProgressBarInitialState,\n PaymentStepState,\n PlanStepState,\n ProgressBarState,\n useLoadCheckout,\n WidgetState,\n} from './hooks';\nimport { CheckoutLocalization, getResolvedCheckoutLocalize } from './configurations/textOverrides';\nimport { CheckoutTheme, getResolvedCheckoutTheme } from './configurations/theme';\nimport { StiggTheme } from '../../theme/types';\nimport { BillingInformation, MockCheckoutStateCallback } from './types';\nimport { defaultCheckoutTypography } from './configurations/typography';\nimport { CheckoutSteps } from './configurations/steps';\n\nexport interface CheckoutContextState {\n checkout?: GetCheckoutStateResults | null;\n checkoutLocalization: CheckoutLocalization;\n stiggTheme: StiggTheme;\n theme: CheckoutTheme;\n resourceId?: string;\n promotionCode?: string;\n progressBar: ProgressBarState;\n planStep: PlanStepState;\n addonsStep: AddonsStepState;\n paymentStep: PaymentStepState;\n widgetState: WidgetState;\n isWidgetWatermarkEnabled: boolean;\n checkoutSuccess: boolean;\n}\n\nexport const CheckoutContext = React.createContext<\n [CheckoutContextState, (updater: (state: CheckoutContextState) => void) => void] | null\n>(null);\n\nCheckoutContext.displayName = 'CheckoutContext';\n\nexport const useCheckoutContext = () => {\n const ctx = useContext(CheckoutContext);\n if (!ctx) {\n throw new Error(\n 'Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.',\n );\n }\n return ctx;\n};\n\nconst CheckoutContextProvider: React.FC<{ children: React.ReactNode; initialState: CheckoutContextState }> = ({\n children,\n initialState,\n}) => {\n const [state, innerSetState] = useState(initialState);\n\n useEffect(() => {\n innerSetState(initialState);\n }, [initialState]);\n\n const setState = useCallback(\n (updater: (state: CheckoutContextState) => void) => innerSetState((old) => produce(old, (draft) => updater(draft))),\n [innerSetState],\n );\n\n const [contextValue, setContextValue] = useMemo(() => [state, setState], [setState, state]);\n\n return <CheckoutContext.Provider value={[contextValue, setContextValue]}>{children}</CheckoutContext.Provider>;\n};\n\nexport type CheckoutProviderProps = {\n textOverrides?: DeepPartial<CheckoutLocalization>;\n theme?: DeepPartial<CheckoutTheme>;\n resourceId?: string;\n planId: string;\n preferredBillingPeriod?: BillingPeriod;\n billingCountryCode?: string;\n billableFeatures?: BillableFeature[];\n billingInformation?: BillingInformation;\n onMockCheckoutState?: MockCheckoutStateCallback;\n skipCheckoutSteps?: CheckoutSteps[];\n};\n\nexport function CheckoutProvider({\n children,\n textOverrides,\n theme,\n preferredBillingPeriod,\n billableFeatures,\n resourceId,\n planId,\n billingCountryCode,\n billingInformation,\n onMockCheckoutState,\n skipCheckoutSteps,\n}: {\n children: React.ReactNode;\n} & CheckoutProviderProps) {\n const { checkout, isLoading, isWidgetWatermarkEnabled } = useLoadCheckout({\n resourceId,\n planId,\n billingCountryCode,\n onMockCheckoutState,\n });\n const configuration: CustomizedTheme = checkout?.configuration\n ? mapCheckoutConfiguration(checkout.configuration)\n : { typography: mapTypography(defaultCheckoutTypography) };\n const globalTheme: StiggTheme = useStiggTheme(configuration);\n\n const initialState = useMemo(() => {\n const checkoutTheme = getResolvedCheckoutTheme(globalTheme, theme, checkout?.configuration);\n const checkoutLocalization = getResolvedCheckoutLocalize(textOverrides);\n const planStep = getPlanStepInitialState({\n preferredBillingPeriod,\n plan: checkout?.plan,\n activeSubscription: checkout?.activeSubscription,\n billingCountryCode,\n preconfiguredBillableFeatures: billableFeatures ?? [],\n });\n const addonsStep = getAddonsStepInitialState({\n plan: checkout?.plan,\n billingPeriod: planStep.billingPeriod,\n activeSubscription: checkout?.activeSubscription,\n });\n const paymentStep = getPaymentStepInitialState({\n customer: checkout?.customer,\n taxPercentage: billingInformation?.taxDetails?.taxPercentage,\n });\n const progressBar = getProgressBarInitialState({\n isLoading,\n skipCheckoutSteps: skipCheckoutSteps ?? [],\n plan: checkout?.plan,\n availableAddons: addonsStep.availableAddons,\n availableCharges: planStep.billableFeatures,\n preferredBillingPeriod,\n preconfiguredBillableFeatures: billableFeatures ?? [],\n });\n\n const initialState: CheckoutContextState = {\n checkout,\n checkoutLocalization,\n stiggTheme: globalTheme,\n theme: checkoutTheme,\n progressBar,\n planStep,\n addonsStep,\n paymentStep,\n resourceId: checkout?.resource?.id,\n widgetState: { readOnly: false, isValid: true, isLoadingCheckoutData: isLoading },\n isWidgetWatermarkEnabled,\n checkoutSuccess: false,\n };\n\n return initialState;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n preferredBillingPeriod,\n billingCountryCode,\n checkout,\n isLoading,\n skipCheckoutSteps,\n billingInformation?.taxDetails?.taxPercentage,\n ]);\n\n return (\n <SdkThemeProvider key={checkout?.plan.id} componentTheme={configuration}>\n <CheckoutContextProvider initialState={initialState}>{children}</CheckoutContextProvider>\n </SdkThemeProvider>\n );\n}\n","import { GetCheckoutStateResults } from '@stigg/js-client-sdk';\nimport { useEffect, useState } from 'react';\nimport logger from '../../../services/logger';\nimport { MockCheckoutStateCallback } from '../types';\nimport { useStiggContext } from '../../../hooks/useStiggContext';\n\ntype UseLoadCheckoutProps = {\n planId: string;\n resourceId?: string;\n billingCountryCode?: string;\n onMockCheckoutState?: MockCheckoutStateCallback;\n};\n\nexport function useLoadCheckout({ planId, resourceId, billingCountryCode, onMockCheckoutState }: UseLoadCheckoutProps) {\n const { stigg } = useStiggContext();\n const [isLoading, setIsLoading] = useState(true);\n const [checkout, setCheckout] = useState<GetCheckoutStateResults | null>();\n\n useEffect(() => {\n const loadCheckout = async () => {\n try {\n const checkout = await stigg.getCheckoutState({ planId, resourceId, billingCountryCode });\n setCheckout(checkout);\n } catch (err) {\n logger.error(`Failed to load checkout ${(err as any)?.message}`, err as any);\n } finally {\n setIsLoading(false);\n }\n };\n\n if (onMockCheckoutState) {\n setIsLoading(false);\n setCheckout(onMockCheckoutState({ planId, resourceId, billingCountryCode }));\n return;\n }\n\n if (stigg.isCustomerLoaded) {\n setIsLoading(true);\n void loadCheckout();\n }\n }, [stigg, stigg.isCustomerLoaded, resourceId, planId, billingCountryCode, onMockCheckoutState]);\n\n return {\n checkout,\n isLoading,\n isWidgetWatermarkEnabled: stigg.isWidgetWatermarkEnabled,\n };\n}\n","import {\n BillingPeriod,\n DiscountType,\n Plan,\n SubscriptionPreviewDiscount,\n SubscriptionPreviewTaxDetails,\n DiscountDurationType,\n} from '@stigg/js-client-sdk';\nimport moment from 'moment';\nimport merge from 'lodash/merge';\nimport { DeepPartial } from '../../../types';\nimport { currencyPriceFormatter } from '../../utils/currencyUtils';\n\nexport type CheckoutLocalization = {\n changePlan: string;\n billingPeriodsTitle: string;\n addAddonText: string;\n newPaymentMethodText: string;\n newPaymentMethodCardTitle: string;\n newPaymentMethodBillingAddressTitle: string;\n summary: {\n title: string;\n planName: (params: { plan: Plan }) => string;\n addCouponCodeText: string;\n couponCodeTitle: string;\n addonsSectionTitle: string;\n discountsSectionTitle: string;\n onlyPayAsYouGoText: string;\n startsAtText: string;\n proratedTotalDueText: string;\n baseChargeText: string | ((params: { billingPeriod: BillingPeriod }) => string);\n totalText: string;\n totalDueText: string;\n totalBillingPeriodText: (params: { billingPeriod: BillingPeriod }) => string;\n discountText: (params: { discountDetails: SubscriptionPreviewDiscount; currency: string }) => string;\n appliedCreditsTitle: string;\n taxTitle: (params: { taxDetails: SubscriptionPreviewTaxDetails }) => string;\n checkoutSuccessText: string;\n payAsYouGoTooltipText: string;\n changesWillApplyAtEndOfBillingPeriod: string | ((params: { billingPeriodEnd: Date }) => string);\n creditsForUnusedTimeText: (params: { credits: string }) => string;\n };\n checkoutButton: {\n nextText: string;\n noChangesText: string;\n updateText: string;\n downgradeToFreeText: string;\n upgradeText: string;\n };\n downgradeToFree: {\n alertText: (params: { plan: Plan }) => string;\n freePlanHeader: (params: { plan: Plan }) => string;\n freePlanName: (params: { plan: Plan }) => string;\n freePlanPriceText: (params: { plan: Plan }) => string;\n paidPlanHeader: (params: { plan: Plan }) => string;\n paidPlanName: (params: { plan: Plan }) => string;\n paidPlanPriceText: (params: { plan: Plan; billingPeriod?: BillingPeriod }) => string;\n };\n};\n\nexport function getResolvedCheckoutLocalize(\n localizeOverride?: DeepPartial<CheckoutLocalization>,\n): CheckoutLocalization {\n const checkoutDefaultLocalization: CheckoutLocalization = {\n changePlan: 'Change',\n billingPeriodsTitle: 'Billing cycle',\n addAddonText: 'Add',\n newPaymentMethodText: 'New payment method',\n newPaymentMethodBillingAddressTitle: 'Billing address',\n newPaymentMethodCardTitle: 'Payment method',\n summary: {\n title: 'Order summary',\n planName: ({ plan }) => `${plan.displayName} plan`,\n addCouponCodeText: 'Add promotion code',\n couponCodeTitle: 'Promotion code',\n addonsSectionTitle: 'Add-ons',\n discountsSectionTitle: 'Discounts',\n onlyPayAsYouGoText: 'Varies by usage',\n startsAtText: 'Starts at ',\n proratedTotalDueText: 'Prorated charge today',\n baseChargeText: () => 'Base charge',\n totalText: 'Total',\n totalDueText: 'Total due today',\n totalBillingPeriodText: ({ billingPeriod }) => `Billed ${billingPeriod.toLowerCase()}`,\n appliedCreditsTitle: 'Applied credits',\n creditsForUnusedTimeText: ({ credits }) =>\n `Your account will be granted credits worth ${credits} for unused time, which will be automatically applied to future payments.`,\n discountText: ({ discountDetails, currency }) => {\n let discountText = '';\n if (discountDetails.type === DiscountType.Percentage) {\n discountText = `${discountDetails.value}% off`;\n } else {\n discountText = `${currencyPriceFormatter({ amount: discountDetails.value, currency })}`;\n }\n\n let discountTextPostfix = '';\n switch (discountDetails.durationType) {\n case DiscountDurationType.Once: {\n discountTextPostfix = ' once';\n break;\n }\n case DiscountDurationType.Repeating: {\n const prefix = discountDetails.type === DiscountType.Fixed ? ' per month' : '';\n discountTextPostfix = `${prefix} for ${discountDetails.durationInMonths} months`;\n\n break;\n }\n\n case DiscountDurationType.Forever:\n default: {\n discountTextPostfix = '';\n }\n }\n\n return `${discountText}${discountTextPostfix}`;\n },\n taxTitle: ({ taxDetails }) => `Tax (${taxDetails?.percentage}%)`,\n changesWillApplyAtEndOfBillingPeriod: ({ billingPeriodEnd }) =>\n `Your changes will take effect at the end of your current billing cycle on ${moment(billingPeriodEnd).format(\n 'MMMM D, YYYY',\n )}.`,\n checkoutSuccessText: 'Changes applied',\n payAsYouGoTooltipText: 'Billed according to actual usage',\n },\n checkoutButton: {\n nextText: 'Next',\n noChangesText: 'No changes',\n updateText: 'Update subscription',\n downgradeToFreeText: 'Cancel subscription',\n upgradeText: 'Subscribe',\n },\n downgradeToFree: {\n alertText: () => `We’re sorry to see you cancel your paid subscription 😭`,\n freePlanHeader: () => 'New plan',\n freePlanName: ({ plan }) => `${plan.displayName}`,\n freePlanPriceText: () => 'Free',\n paidPlanHeader: () => 'Current plan',\n paidPlanName: ({ plan }) => `${plan.displayName}`,\n paidPlanPriceText: ({ billingPeriod }) =>\n `Paid plan${billingPeriod ? `, billed ${billingPeriod.toLowerCase()}` : ''}`,\n },\n };\n\n return merge(checkoutDefaultLocalization, localizeOverride);\n}\n","<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"plus\">\n<path id=\"Shape\" d=\"M10 4.16666V15.8333\" stroke=\"#327EEE\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path id=\"Shape_2\" d=\"M4.16699 10H15.8337\" stroke=\"#327EEE\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","import styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport { mq } from '../common/mediaQuery';\n\nexport const CheckoutLayout = styled.div`\n margin: auto;\n min-height: 760px;\n max-width: 920px;\n display: flex;\n position: relative;\n flex-direction: column;\n align-items: center;\n\n background-color: ${({ theme }) => theme.stigg.palette.backgroundPaper};\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedBorder}`};\n\n & * {\n box-sizing: border-box;\n }\n\n padding: 16px 16px;\n ${mq.md} {\n padding: 32px;\n width: calc(100% - 64px);\n border-radius: 10px;\n }\n`;\nexport const CheckoutContent = styled(Box)`\n display: flex;\n align-items: flex-start;\n gap: 32px;\n flex-wrap: wrap;\n width: 100%;\n\n flex-direction: column;\n ${mq.md} {\n flex-direction: row;\n }\n`;\n\nexport const CheckoutPanel = styled(Box)`\n display: flex;\n flex-direction: column;\n gap: 0;\n flex: 2;\n\n width: 100%;\n ${mq.md} {\n width: auto;\n }\n`;\n","import styled from '@emotion/styled/macro';\nimport LinearProgress, { linearProgressClasses } from '@mui/material/LinearProgress';\nimport Button, { buttonClasses } from '@mui/material/Button';\nimport { Icon } from '../../common/Icon';\n\nexport const StyledProgress = styled(LinearProgress, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{\n $disabled?: boolean;\n}>(({ theme, $disabled }) => ({\n [`&.${linearProgressClasses.root}`]: {\n borderRadius: theme.stigg.border.radius,\n backgroundColor: theme.stigg.palette.outlinedBorder,\n },\n [`& .${linearProgressClasses.bar}`]: {\n backgroundColor: $disabled ? theme.stigg.palette.primaryLight : theme.stigg.palette.primary,\n },\n}));\n\nexport const StyledStepButton = styled(Button)(() => ({\n [`&.${buttonClasses.root}`]: {\n textTransform: 'none',\n lineHeight: 'inherit',\n justifyContent: 'flex-start',\n padding: '8px 4px',\n },\n}));\n\nexport const StyledIcon = styled(Icon, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{\n $disabled?: boolean;\n $shouldFill?: boolean;\n}>(({ theme, $disabled, $shouldFill }) => ({\n circle: {\n stroke: $disabled ? theme.stigg.palette.primaryLight : theme.stigg.palette.primary,\n fill: $shouldFill ? ($disabled ? theme.stigg.palette.primaryLight : theme.stigg.palette.primary) : undefined,\n },\n}));\n","import React, { useEffect, useRef } from 'react';\nimport Grid from '@mui/material/Grid';\nimport Box from '@mui/material/Box';\nimport StepIcon from '@mui/material/StepIcon';\nimport { useCheckoutModel, useProgressBarModel } from '../hooks';\nimport { Typography } from '../../common/Typography';\nimport { StyledIcon, StyledProgress, StyledStepButton } from './CheckoutProgressBar.style';\nimport { Icons } from '../../common/Icon';\nimport { Skeleton } from '../components/Skeletons.style';\nimport { useIsScreenWiderThan } from '../../hooks/useIsScreenWiderThan';\n\nexport const CheckoutProgressBar = () => {\n const { progressBarState, setActiveStep, currentStep } = useProgressBarModel();\n const { widgetState } = useCheckoutModel();\n const isScreenWiderThanMd = useIsScreenWiderThan('md');\n const containerRef = useRef<HTMLElement>();\n const { readOnly, isLoadingCheckoutData } = widgetState;\n const { activeStep, completedSteps, steps } = progressBarState || {};\n const progress = ((activeStep + 1) * 100) / steps.length;\n\n const [previousStep, setPreviousStep] = React.useState(currentStep);\n useEffect(() => {\n if (!isScreenWiderThanMd) {\n if (containerRef.current && currentStep !== previousStep) {\n containerRef.current.scrollIntoView({ behavior: 'smooth' });\n }\n }\n setPreviousStep(currentStep);\n }, [currentStep, isScreenWiderThanMd, previousStep, setPreviousStep]);\n\n if (progressBarState.steps.length === 1) {\n return null;\n }\n\n return (\n <Box className=\"stigg-checkout-progress-container\" sx={{ width: '100%', mb: 3 }} ref={containerRef}>\n <StyledProgress variant=\"determinate\" value={progress} $disabled={readOnly} />\n <Grid container display=\"flex\">\n {steps.map(({ key, label }, index) => {\n const isCompleted = completedSteps.includes(index);\n const isDisabled =\n readOnly ||\n (index > activeStep && !isCompleted && !completedSteps.includes(index - 1)) ||\n (activeStep !== index && progressBarState.isDisabled);\n const checkedIcon: Icons = isDisabled ? 'OutlinedCheckedCircleDisabled' : 'OutlinedCheckedCircle';\n\n return (\n <Grid\n key={key}\n item\n display=\"flex\"\n flexDirection=\"row\"\n flex={isScreenWiderThanMd ? 1 : 'auto'}\n justifyContent=\"flex-start\">\n {isLoadingCheckoutData ? (\n <Skeleton width={120} height={20} style={{ marginTop: 8 }} />\n ) : (\n <StyledStepButton onClick={() => setActiveStep(index)} fullWidth disabled={isDisabled}>\n <Grid item display=\"flex\" flexDirection=\"row\" alignItems=\"center\" gap={1}>\n <StepIcon\n icon={\n <StyledIcon\n icon={isCompleted ? checkedIcon : 'OutlinedCircle'}\n $disabled={isDisabled}\n $shouldFill={isCompleted}\n />\n }\n />\n\n <Typography variant=\"h6\" color={isDisabled ? 'primary.main.light' : 'primary.main'}>\n {label}\n </Typography>\n </Grid>\n </StyledStepButton>\n )}\n </Grid>\n );\n })}\n </Grid>\n </Box>\n );\n};\n","import sortBy from 'lodash/sortBy';\nimport { useMemo } from 'react';\n\nimport { BillingModel, Price } from '@stigg/js-client-sdk';\n\nconst CHARGES_BILLING_MODEL_ORDER = [BillingModel.FlatFee, BillingModel.PerUnit, BillingModel.UsageBased];\n\nexport const sortCharges = (charges: Price[]) => {\n return sortBy(charges, [\n (charge) => CHARGES_BILLING_MODEL_ORDER.indexOf(charge.pricingModel),\n (charge) => charge.feature?.displayName,\n ]);\n};\n\nexport const useChargesSort = (charges: Price[]) => {\n return useMemo(() => sortCharges(charges), [charges]);\n};\n","import { useCheckoutContext } from '../CheckoutProvider';\n\nexport type PromotionCodeState = {\n promotionCode?: string;\n};\n\nfunction usePromotionCodeState() {\n const [{ promotionCode }] = useCheckoutContext();\n return promotionCode;\n}\n\nfunction useSetPromotionCode() {\n const [, setState] = useCheckoutContext();\n\n return (promotionCode: string) =>\n setState((draft) => {\n draft.promotionCode = promotionCode;\n });\n}\n\nexport function usePromotionCodeModel() {\n const promotionCode = usePromotionCodeState();\n\n return {\n promotionCode,\n setPromotionCode: useSetPromotionCode(),\n };\n}\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\n\nimport PlusIcon from '../../../assets/plus-icon.svg';\nimport { Typography } from '../../common/Typography';\nimport { Button } from '../components';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\n\nconst StyledPlusIcon = styled(PlusIcon, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{ $disabled: boolean }>`\n margin-right: 8px;\n path {\n stroke: ${({ theme, $disabled }) => ($disabled ? theme.stigg.palette.text.disabled : theme.stigg.palette.primary)};\n }\n`;\n\nexport type AddPromotionCodeButtonProps = {\n onAddClick: () => void;\n checkoutLocalization: CheckoutLocalization;\n disabled: boolean;\n};\n\nexport const AddPromotionCodeButton = ({ onAddClick, checkoutLocalization, disabled }: AddPromotionCodeButtonProps) => (\n <Button\n disabled={disabled}\n fullWidth\n className=\"stigg-checkout-summary-add-coupon-code-button\"\n sx={{\n textTransform: 'none',\n justifyContent: 'flex-start',\n color: disabled ? 'text.disabled' : 'primary.main',\n }}\n variant=\"text\"\n size=\"medium\"\n onClick={onAddClick}>\n <StyledPlusIcon $disabled={disabled} className=\"stigg-checkout-summary-add-coupon-code-button-icon\" />\n <Typography\n className=\"stigg-checkout-change-plan-button-text\"\n color={disabled ? 'disabled' : 'primary.main'}\n style={{ lineHeight: '24px' }}\n variant=\"h3\">\n {checkoutLocalization.summary.addCouponCodeText}\n </Typography>\n </Button>\n);\n","import React, { useState } from 'react';\n\nimport styled from '@emotion/styled/macro';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport Grid from '@mui/material/Grid';\n\nimport { Icon } from '../../common/Icon';\nimport { Typography } from '../../common/Typography';\nimport { Button, InputField } from '../components';\nimport { usePreviewSubscriptionAction } from '../hooks';\nimport { usePromotionCodeModel } from '../hooks/useCouponModel';\nimport { AddPromotionCodeButton } from './AddPromotionCodeButton';\nimport { PromotionCodeSectionProps } from './PromotionCodeSection';\n\nconst CouponCodeAddButton = styled(Button)`\n padding: 4px 10px;\n min-width: unset;\n border-radius: ${({ theme }) => theme.stigg.border.radius};\n display: flex;\n align-items: center;\n`;\n\nexport const AddPromotionCode = ({\n disabled,\n checkoutLocalization,\n onMockCheckoutPreview,\n}: PromotionCodeSectionProps) => {\n const { setPromotionCode: persistPromotionCode } = usePromotionCodeModel();\n const [showInput, setShowInput] = useState(false);\n const [promotionCode, setPromotionCode] = React.useState('');\n const [isLoading, setIsLoading] = React.useState(false);\n const [errorMessage, setErrorMessage] = React.useState('');\n const { previewSubscriptionAction } = usePreviewSubscriptionAction({ onMockCheckoutPreview });\n\n const handlePromotionCode = async () => {\n setIsLoading(true);\n setErrorMessage('');\n\n const { subscriptionPreview, errorMessage } = await previewSubscriptionAction({ promotionCode });\n\n if (!errorMessage && subscriptionPreview?.immediateInvoice?.discountDetails) {\n persistPromotionCode(promotionCode.toUpperCase());\n setShowInput(false);\n } else if (errorMessage) {\n setErrorMessage(errorMessage);\n }\n setIsLoading(false);\n };\n\n if (!showInput) {\n return (\n <AddPromotionCodeButton\n disabled={disabled}\n onAddClick={() => setShowInput(true)}\n checkoutLocalization={checkoutLocalization}\n />\n );\n }\n\n return (\n <Grid>\n <Typography variant=\"body1\" color={errorMessage ? 'error' : disabled ? 'disabled' : 'primary.main'}>\n {checkoutLocalization.summary.couponCodeTitle}\n </Typography>\n\n <InputField\n disabled={disabled}\n autoFocus\n variant=\"outlined\"\n fullWidth\n error={!!errorMessage}\n value={promotionCode}\n onChange={(e) => {\n setPromotionCode(e.target.value);\n }}\n inputProps={{ maxLength: 20 }}\n onKeyDown={(e: any) => {\n if (e.key === 'Enter') {\n void handlePromotionCode();\n e.preventDefault();\n }\n }}\n // eslint-disable-next-line react/jsx-no-duplicate-props\n InputProps={{\n endAdornment: (\n <CouponCodeAddButton\n variant=\"contained\"\n disabled={disabled}\n onClick={() => {\n void handlePromotionCode();\n }}>\n {isLoading ? (\n <CircularProgress size={18} sx={{ color: 'white' }} />\n ) : (\n <Icon style={{ display: 'flex' }} icon=\"ArrowForward\" />\n )}\n </CouponCodeAddButton>\n ),\n }}\n />\n {!!errorMessage && (\n <Typography variant=\"body1\" color=\"error\">\n {errorMessage}\n </Typography>\n )}\n </Grid>\n );\n};\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport Grid from '@mui/material/Grid';\nimport { Icon } from '../../common/Icon';\nimport { Typography } from '../../common/Typography';\nimport { Button } from '../components';\n\nconst AppliedCouponContainer = styled(Grid)`\n width: auto;\n display: inline-flex;\n align-items: center;\n flex-direction: row;\n gap: 8px;\n padding: 6px 8px;\n border-radius: ${({ theme }) => theme.stigg.border.radius};\n border: 1px solid ${({ theme }) => theme.stigg.palette.primary};\n`;\n\nexport const StyledIcon = styled(Icon, { shouldForwardProp: (prop) => prop !== 'style' })<{ $shouldFill?: boolean }>`\n display: flex;\n\n g {\n stroke: ${({ theme }) => theme.stigg.palette.primary};\n }\n\n path {\n fill: ${({ theme, $shouldFill }) => ($shouldFill ? theme.stigg.palette.primary : undefined)};\n }\n`;\n\nexport type AppliedPromotionCodeProps = {\n promotionCode: string;\n onClearPromotionCode: () => void;\n};\n\nexport const AppliedPromotionCode = ({ promotionCode, onClearPromotionCode }: AppliedPromotionCodeProps) => (\n <AppliedCouponContainer container>\n <Grid item display=\"flex\" gap={1} alignItems=\"center\">\n <StyledIcon icon=\"Coupon\" />\n <Typography variant=\"body1\" color=\"primary.main\" lineHeight=\"auto\">\n {promotionCode}\n </Typography>\n </Grid>\n <Grid item>\n <Button variant=\"text\" sx={{ minWidth: 'unset', padding: 0 }} onClick={onClearPromotionCode}>\n <StyledIcon icon=\"Close\" $shouldFill />\n </Button>\n </Grid>\n </AppliedCouponContainer>\n);\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport { usePromotionCodeModel } from '../hooks/useCouponModel';\nimport { AddPromotionCode } from './AddPromotionCode';\nimport { AppliedPromotionCode } from './AppliedPromotionCode';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\nimport { MockCheckoutPreviewCallback } from '../types';\n\nconst PromotionCodeSectionContainer = styled.div`\n margin: 16px 0;\n`;\n\nexport type PromotionCodeSectionProps = {\n disabled: boolean;\n checkoutLocalization: CheckoutLocalization;\n onMockCheckoutPreview?: MockCheckoutPreviewCallback;\n};\n\nexport const PromotionCodeSection = ({\n disabled,\n checkoutLocalization,\n onMockCheckoutPreview,\n}: PromotionCodeSectionProps) => {\n const { promotionCode, setPromotionCode } = usePromotionCodeModel();\n\n const onClearPromotionCode = () => {\n setPromotionCode('');\n };\n\n const content = promotionCode ? (\n <AppliedPromotionCode promotionCode={promotionCode} onClearPromotionCode={onClearPromotionCode} />\n ) : (\n <AddPromotionCode\n disabled={disabled}\n checkoutLocalization={checkoutLocalization}\n onMockCheckoutPreview={onMockCheckoutPreview}\n />\n );\n\n return <PromotionCodeSectionContainer>{content}</PromotionCodeSectionContainer>;\n};\n","import React from 'react';\nimport { StripeAddressElementChangeEvent } from '@stripe/stripe-js';\nimport Grid from '@mui/material/Grid';\nimport { BillingAddress } from '@stigg/js-client-sdk';\nimport { AddressElement, PaymentElement } from '@stripe/react-stripe-js';\nimport { Typography } from '../../../../common/Typography';\nimport { useCheckoutModel, usePaymentStepModel } from '../../../hooks';\nimport { CheckoutContainerProps } from '../../../CheckoutContainer';\n\nexport function StripePaymentForm({\n onBillingAddressChange,\n collectPhoneNumber,\n}: Pick<CheckoutContainerProps, 'onBillingAddressChange' | 'collectPhoneNumber'>) {\n const { checkoutState, checkoutLocalization, widgetState, setWidgetReadOnly } = useCheckoutModel();\n const { setBillingAddress } = usePaymentStepModel();\n const { customer, configuration } = checkoutState || {};\n const { readOnly } = widgetState;\n const shouldCollectPhoneNumber = !!(collectPhoneNumber ?? configuration?.content?.collectPhoneNumber);\n\n const handleAddressChange = (args: StripeAddressElementChangeEvent) => {\n if (!args.complete) {\n return;\n }\n\n const { postal_code: postalCode, ...addressFields } = args.value.address;\n const billingAddress: BillingAddress = {\n postalCode,\n ...addressFields,\n };\n\n setWidgetReadOnly(true);\n setBillingAddress(billingAddress);\n\n if (onBillingAddressChange) {\n const callExternalBillingAddressChanged = async () => {\n await onBillingAddressChange({ billingAddress });\n setWidgetReadOnly(false);\n };\n\n void callExternalBillingAddressChanged();\n } else {\n setWidgetReadOnly(false);\n }\n };\n\n return (\n <Grid flexDirection=\"column\" container gap={3} padding=\"16px\" sx={{ pointerEvents: readOnly ? 'none' : undefined }}>\n <Grid flexDirection=\"column\" container gap={2}>\n <Typography variant=\"h6\">{checkoutLocalization.newPaymentMethodBillingAddressTitle}</Typography>\n <AddressElement\n onChange={handleAddressChange}\n options={{\n mode: 'billing',\n fields: { phone: shouldCollectPhoneNumber ? 'always' : 'auto' },\n defaultValues: {\n ...(customer?.name && { name: customer.name }),\n },\n }}\n />\n </Grid>\n <Grid flexDirection=\"column\" container gap={2}>\n <Typography variant=\"h6\">{checkoutLocalization.newPaymentMethodCardTitle}</Typography>\n <PaymentElement\n onChange={() => {}}\n onReady={() => {}}\n options={{\n readOnly,\n terms: { card: 'never' },\n defaultValues: {\n billingDetails: {\n ...(customer?.name && { name: customer.name }),\n ...(customer?.email && { email: customer.email }),\n },\n },\n }}\n />\n </Grid>\n </Grid>\n );\n}\n","import { ApplySubscription, PreviewSubscription } from '@stigg/js-client-sdk';\nimport { useCheckoutContext } from '../CheckoutProvider';\nimport { useCheckoutModel } from './useCheckoutModel';\nimport { useSubscriptionModel } from './useSubscriptionModel';\n\nexport function useSubscriptionState(): ApplySubscription | PreviewSubscription | undefined {\n const subscription = useSubscriptionModel();\n const [{ resourceId }] = useCheckoutContext();\n const { checkoutState } = useCheckoutModel();\n const { plan } = checkoutState || {};\n const addons = subscription.addons.map(({ addon, quantity }) => ({ addonId: addon.id, quantity }));\n\n if (!plan?.id) {\n return undefined;\n }\n\n return {\n resourceId,\n planId: plan.id,\n billingPeriod: subscription.billingPeriod,\n billableFeatures: subscription.billableFeatures,\n addons,\n promotionCode: subscription.promotionCode,\n billingCountryCode: subscription.billingCountryCode,\n };\n}\n","import { ApplySubscriptionResults, PaymentCollection } from '@stigg/js-client-sdk';\nimport { Stripe, StripeElements } from '@stripe/stripe-js';\n\ntype StripeElementsProps = {\n stripe: Stripe | null;\n elements: StripeElements | null;\n};\n\nconst FAILED_PAYMENT_COLLECTION_STATUSES = [PaymentCollection.Failed, PaymentCollection.Processing];\n\nexport async function handleStripeFormValidations({ elements }: Pick<StripeElementsProps, 'elements'>) {\n if (!elements) {\n const errorMessage = 'Stripe elements not initialized';\n console.error(errorMessage);\n return { success: false, errorMessage };\n }\n\n const { error: elementsError } = await elements.submit();\n\n if (elementsError) {\n console.log(elementsError.message);\n return { success: false, errorMessage: elementsError.message || '' };\n }\n\n return { success: true };\n}\n\nexport async function handleStripeNextAction({\n applySubscriptionResults,\n stripe,\n}: {\n applySubscriptionResults: ApplySubscriptionResults;\n stripe: Stripe | null;\n}) {\n const subscription = applySubscriptionResults?.subscription;\n const paymentIntentClientSecret = subscription?.latestInvoice?.paymentSecret;\n const paymentCollection = subscription?.paymentCollection;\n\n if (stripe && paymentIntentClientSecret && paymentCollection === PaymentCollection.ActionRequired) {\n const { error: NextActionError } = await stripe.handleNextAction({ clientSecret: paymentIntentClientSecret });\n if (NextActionError) {\n return { errorMessage: NextActionError.message || '' };\n }\n } else if (paymentCollection && FAILED_PAYMENT_COLLECTION_STATUSES.includes(paymentCollection)) {\n return { errorMessage: subscription?.latestInvoice?.errorMessage || 'An error occurred - try again later' };\n }\n\n return { subscription };\n}\n\nasync function handleStripeSetup({\n stripe,\n elements,\n clientSecret,\n}: {\n stripe: Stripe;\n elements: StripeElements;\n clientSecret: string;\n}) {\n let newPaymentMethodId: string | undefined;\n let setupErrorMessage: string | undefined;\n\n const { error: setupError } = await stripe.confirmSetup({\n elements,\n confirmParams: { return_url: window.location.href },\n redirect: 'if_required',\n });\n\n if (setupError) {\n if (setupError.type === 'card_error' || setupError.type === 'validation_error') {\n if (setupError.type === 'card_error') {\n // Set some error message\n setupErrorMessage = setupError.message || '';\n }\n } else {\n setupErrorMessage = 'An unexpected error occurred.';\n }\n } else {\n try {\n const { setupIntent } = await stripe.retrieveSetupIntent(clientSecret);\n if (setupIntent?.payment_method) {\n newPaymentMethodId = setupIntent.payment_method as string;\n }\n } catch (e) {\n setupErrorMessage = 'An unexpected error occurred.';\n console.error(e);\n }\n }\n\n return { newPaymentMethodId, setupErrorMessage };\n}\n\nexport async function handleNewPaymentMethod({\n stripe,\n elements,\n setupIntentClientSecret,\n}: {\n stripe: Stripe | null;\n elements: StripeElements | null;\n setupIntentClientSecret?: string;\n}): Promise<{ success: boolean; errorMessage?: string; paymentMethodId?: string }> {\n if (!stripe || !elements || !setupIntentClientSecret) {\n return { success: false };\n }\n\n const stripeFormValidationsResults = await handleStripeFormValidations({ elements });\n if (!stripeFormValidationsResults.success) {\n return { success: false, errorMessage: stripeFormValidationsResults.errorMessage };\n }\n\n const { newPaymentMethodId, setupErrorMessage } = await handleStripeSetup({\n stripe,\n elements,\n clientSecret: setupIntentClientSecret,\n });\n\n if (setupErrorMessage || !newPaymentMethodId) {\n return { success: false, errorMessage: setupErrorMessage };\n }\n\n return { success: true, paymentMethodId: newPaymentMethodId };\n}\n","import styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport Color from 'color';\nimport React, { useEffect, useRef } from 'react';\nimport Lottie from 'react-lottie';\nimport animationData from '../../../assets/lottie/checkout-success.json';\nimport { Typography } from '../../common/Typography';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\n\nexport const ANIMATION_DURATION = 5000;\n\nconst CheckoutSuccessContainer = styled(Box)`\n @keyframes blurFade {\n 0% {\n background-color: ${({ theme }) => Color(theme.stigg.palette.backgroundPaper).alpha(0).toString()};\n backdrop-filter: blur(0px);\n }\n 100% {\n background-color: ${({ theme }) => Color(theme.stigg.palette.backgroundPaper).alpha(0.9).toString()};\n backdrop-filter: blur(6.5px);\n }\n }\n\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n z-index: 5;\n background-color: ${({ theme }) => Color(theme.stigg.palette.backgroundPaper).alpha(0.9).toString()};\n animation: blurFade 2s ease-in forwards;\n display: flex;\n flex-direction: column;\n justify-content: center;\n\n * rect {\n fill: transparent;\n }\n\n & path {\n stroke: ${({ theme }) => theme.stigg.palette.primary};\n }\n`;\n\nconst CheckoutSuccessText = styled(Typography)`\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 75% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n align-self: center;\n animation: fadeIn 5s ease-in forwards;\n`;\n\nexport function CheckoutSuccess({ checkoutLocalization }: { checkoutLocalization: CheckoutLocalization }) {\n const containerRef = useRef<HTMLDivElement>();\n useEffect(() => {\n if (containerRef.current) {\n containerRef.current.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'center' });\n }\n }, []);\n return (\n <CheckoutSuccessContainer className=\"stigg-checkout-success-container\" ref={containerRef}>\n <Lottie\n options={{ animationData, loop: false, autoplay: true }}\n width={350}\n height=\"auto\"\n style={{ display: 'flex', justifyContent: 'center' }}\n />\n <CheckoutSuccessText variant=\"h1\" color=\"primary.main\">\n {checkoutLocalization.summary.checkoutSuccessText}\n </CheckoutSuccessText>\n </CheckoutSuccessContainer>\n );\n}\n","import { ApplySubscription, ApplySubscriptionResults } from '@stigg/js-client-sdk';\nimport { useElements, useStripe } from '@stripe/react-stripe-js';\nimport { useStiggContext } from '../../../../..';\nimport { useCheckoutModel } from '../../../hooks';\nimport { usePaymentStepModel } from '../../../hooks/usePaymentStepModel';\nimport { useSubscriptionState } from '../../../hooks/useSubscriptionState';\nimport { CheckoutContainerProps, CheckoutResult } from '../../../CheckoutContainer';\nimport { handleNewPaymentMethod, handleStripeNextAction } from './stripe.utils';\nimport { ANIMATION_DURATION } from '../../../summary/CheckoutSuccess';\n\nconst delay = (ms: number) => new Promise((res) => setTimeout(res, ms));\n\nexport type HandleSubmitResult = { results?: ApplySubscriptionResults; success: boolean; errorMessage?: string };\n\nexport type UseSubmitProps = {\n onSuccess?: () => void;\n isMocked?: boolean;\n} & Pick<CheckoutContainerProps, 'onCheckout' | 'onCheckoutCompleted' | 'disableSuccessAnimation'>;\n\nexport function useSubmit({\n isMocked = false,\n onCheckout,\n onCheckoutCompleted,\n onSuccess,\n disableSuccessAnimation,\n}: UseSubmitProps) {\n const { stigg } = useStiggContext();\n const { useNewPaymentMethod } = usePaymentStepModel();\n const subscriptionState = useSubscriptionState();\n const { checkoutState, widgetState, setWidgetReadOnly } = useCheckoutModel();\n const { setupSecret: setupIntentClientSecret, customer } = checkoutState || {};\n const stripe = useStripe();\n const elements = useElements();\n\n const handleSubmit = async (e: any): Promise<HandleSubmitResult> => {\n e.preventDefault();\n\n if (!subscriptionState) {\n return { success: false, errorMessage: 'Unexpected error, please contact support.' };\n }\n\n let success = true;\n let errorMessage: string | undefined;\n let usedStiggCheckoutAction = false;\n let paymentMethodId: string | undefined;\n\n setWidgetReadOnly(true);\n\n if (!isMocked && useNewPaymentMethod) {\n const paymentMethodResults = await handleNewPaymentMethod({ elements, stripe, setupIntentClientSecret });\n if (!paymentMethodResults.success) {\n errorMessage = paymentMethodResults.errorMessage;\n success = false;\n } else {\n paymentMethodId = paymentMethodResults.paymentMethodId;\n }\n }\n\n const checkoutParams: ApplySubscription = { ...subscriptionState, paymentMethodId };\n\n const checkoutAction = async (params: ApplySubscription): Promise<CheckoutResult> => {\n usedStiggCheckoutAction = true;\n\n try {\n const applySubscriptionResults = await stigg.applySubscription(params);\n\n const nextActionResults = await handleStripeNextAction({ applySubscriptionResults, stripe });\n\n return {\n success: !nextActionResults.errorMessage,\n errorMessage: nextActionResults.errorMessage,\n results: applySubscriptionResults,\n };\n } catch (e) {\n console.error(e);\n errorMessage = (e as any)?.message;\n return { success: false, errorMessage };\n }\n };\n\n let checkoutResults: ApplySubscriptionResults | undefined;\n\n if (success) {\n if (onCheckout) {\n const externalCheckoutResults = await onCheckout({\n customerId: customer!.id,\n checkoutParams,\n checkoutAction,\n });\n if (externalCheckoutResults.errorMessage) {\n errorMessage = externalCheckoutResults.errorMessage;\n }\n\n if (!usedStiggCheckoutAction && externalCheckoutResults.results && externalCheckoutResults.success) {\n const nextActionResults = await handleStripeNextAction({\n applySubscriptionResults: externalCheckoutResults.results,\n stripe,\n });\n\n if (nextActionResults.errorMessage) {\n errorMessage = nextActionResults.errorMessage;\n success = false;\n }\n }\n\n success = success && externalCheckoutResults.success && !errorMessage;\n checkoutResults = externalCheckoutResults.results;\n } else {\n const checkoutActionResults = await checkoutAction(checkoutParams);\n if (!checkoutActionResults.success && checkoutActionResults.errorMessage) {\n errorMessage = checkoutActionResults.errorMessage;\n }\n success = checkoutActionResults.success && !errorMessage;\n checkoutResults = checkoutActionResults.results;\n }\n }\n\n setWidgetReadOnly(false);\n\n if (success && onSuccess) {\n onSuccess();\n\n if (!disableSuccessAnimation) {\n await delay(ANIMATION_DURATION); // Wait for animation to finish\n }\n }\n\n await onCheckoutCompleted({ success, error: errorMessage });\n\n return { results: checkoutResults, success: !errorMessage, errorMessage };\n };\n\n return { handleSubmit, isLoading: !!widgetState?.readOnly };\n}\n","import { Currency } from '@stigg/js-client-sdk';\n\n// Zuora Payment Form v3 API types\ndeclare global {\n interface Window {\n Zuora: (publishableKey: string) => ZuoraInstance;\n }\n}\n\nexport type ZuoraInstance = {\n createPaymentForm: (config: ZuoraPaymentFormConfig) => Promise<ZuoraPaymentForm>;\n};\n\nexport type ZuoraPaymentFormConfig = {\n locale?: string;\n region?: string;\n currency?: string;\n amount?: string;\n profile?: string;\n createPaymentSession: () => Promise<string>;\n onComplete: (result: ZuoraPaymentResult) => Promise<void>;\n};\n\nexport type ZuoraPaymentForm = {\n mount: (containerId: string) => void;\n};\n\nexport type ZuoraPaymentResult = {\n success: boolean;\n paymentMethodId?: string;\n paymentId?: string;\n error?: {\n type: string;\n code: string;\n message: string;\n };\n};\n\nexport function isZuoraLibraryAvailable(): boolean {\n return !!window.Zuora;\n}\n\nexport function loadZuoraLibrary() {\n const script = document.createElement('script');\n script.type = 'text/javascript';\n script.src = 'https://js.zuora.com/payment/v3/zuora.js';\n script.async = true;\n\n script.onerror = () => {\n throw new Error('Failed to load Zuora library');\n };\n\n document.head.appendChild(script);\n}\n\nexport function createZuoraPaymentFormConfig(\n createPaymentSession: () => Promise<string>,\n onComplete: (result: ZuoraPaymentResult) => Promise<void>,\n currency: Currency,\n billingCountryCode?: string,\n): ZuoraPaymentFormConfig {\n const AUTH_AMOUNT = '1';\n\n return {\n locale: billingCountryCode || 'en',\n region: billingCountryCode?.toUpperCase() || 'US',\n currency,\n amount: AUTH_AMOUNT,\n createPaymentSession,\n onComplete,\n };\n}\n","import { useCallback, useEffect, useState } from 'react';\nimport { useCheckoutModel, usePaymentStepModel, usePlanStepModel } from '../../../hooks';\nimport { isZuoraLibraryAvailable, loadZuoraLibrary } from './zuora.utils';\nimport { BillingVendorIdentifier, useStiggContext } from '../../../../..';\n\nexport function useZuoraIntegration() {\n const { stigg } = useStiggContext();\n const { setErrorMessage } = usePaymentStepModel();\n const { billingCountryCode } = usePlanStepModel();\n const [isInitialized, setIsInitialized] = useState(false);\n const { checkoutState } = useCheckoutModel();\n const { billingIntegration } = checkoutState || {};\n\n const createPaymentSession = useCallback(async () => {\n if (!checkoutState?.customer.id || !checkoutState?.plan.id) {\n throw new Error('Customer and plan are required');\n }\n\n const { token } = await stigg.createPaymentSession({\n planId: checkoutState.plan.id,\n billingCountryCode,\n });\n\n return token;\n }, [checkoutState, stigg, billingCountryCode]);\n\n const initializeZuora = useCallback(() => {\n try {\n if (!isZuoraLibraryAvailable()) {\n loadZuoraLibrary();\n }\n\n setIsInitialized(true);\n } catch (err) {\n setErrorMessage('Failed to initialize Zuora');\n }\n }, [setIsInitialized, setErrorMessage]);\n\n useEffect(() => {\n if (billingIntegration) {\n const { billingIdentifier } = billingIntegration;\n\n if (billingIdentifier === BillingVendorIdentifier.Zuora) {\n void initializeZuora();\n }\n }\n }, [billingIntegration, initializeZuora]);\n\n const isZuoraIntegration = billingIntegration?.billingIdentifier === BillingVendorIdentifier.Zuora;\n\n return {\n isZuoraIntegration,\n isInitialized,\n createPaymentSession,\n };\n}\n","import { useCallback } from 'react';\nimport { ApplySubscription } from '@stigg/js-client-sdk';\nimport { useStiggContext } from '../../../../..';\nimport { useSubscriptionState } from '../../../hooks/useSubscriptionState';\nimport { useCheckoutModel, usePaymentStepModel } from '../../../hooks';\nimport { CheckoutContainerProps } from '../../../CheckoutContainer';\nimport { ANIMATION_DURATION } from '../../../summary/CheckoutSuccess';\n\nconst delay = (ms: number) => new Promise((res) => setTimeout(res, ms));\n\nexport type ZuoraSubmitResult = {\n success: boolean;\n errorMessage?: string;\n};\n\nexport type UseZuoraSubmitProps = {\n onSuccess?: () => void;\n} & Pick<CheckoutContainerProps, 'onCheckout' | 'onCheckoutCompleted' | 'disableSuccessAnimation'>;\n\nexport function useZuoraSubmit({\n onCheckout,\n onCheckoutCompleted,\n onSuccess,\n disableSuccessAnimation,\n}: UseZuoraSubmitProps) {\n const { stigg } = useStiggContext();\n const subscriptionState = useSubscriptionState();\n const { checkoutState, setWidgetReadOnly, setCheckoutSuccess } = useCheckoutModel();\n const { setErrorMessage } = usePaymentStepModel();\n\n const handleZuoraSubmit = useCallback(\n async (paymentMethodId?: string): Promise<ZuoraSubmitResult> => {\n setWidgetReadOnly(true);\n\n let success = true;\n let errorMessage: string | undefined;\n\n const currentSubscriptionState = subscriptionState;\n if (!currentSubscriptionState) {\n success = false;\n errorMessage = 'Unexpected error, please contact support.';\n } else {\n const checkoutParams: ApplySubscription = {\n ...currentSubscriptionState,\n paymentMethodId,\n };\n\n const checkoutAction = async (params: ApplySubscription) => {\n try {\n const applySubscriptionResults = await stigg.applySubscription(params);\n return {\n success: true,\n results: applySubscriptionResults,\n };\n } catch (e) {\n console.error(e);\n return {\n success: false,\n errorMessage: (e as any)?.message || 'Failed to apply subscription',\n };\n }\n };\n\n try {\n if (onCheckout) {\n const externalCheckoutResults = await onCheckout({\n customerId: checkoutState!.customer.id,\n checkoutParams,\n checkoutAction,\n });\n\n if (externalCheckoutResults.errorMessage) {\n errorMessage = externalCheckoutResults.errorMessage;\n }\n\n success = success && externalCheckoutResults.success && !errorMessage;\n } else {\n const checkoutActionResults = await checkoutAction(checkoutParams);\n if (!checkoutActionResults.success && checkoutActionResults.errorMessage) {\n errorMessage = checkoutActionResults.errorMessage;\n }\n success = checkoutActionResults.success && !errorMessage;\n }\n } catch (err) {\n success = false;\n errorMessage = (err as Error).message || 'Failed to process checkout';\n }\n }\n\n if (success) {\n setCheckoutSuccess(true);\n\n if (onSuccess) {\n onSuccess();\n\n if (!disableSuccessAnimation) {\n await delay(ANIMATION_DURATION);\n }\n }\n } else {\n setErrorMessage(errorMessage);\n }\n\n setWidgetReadOnly(false);\n\n await onCheckoutCompleted({ success, error: errorMessage });\n\n return { success, errorMessage };\n },\n [\n stigg,\n subscriptionState,\n checkoutState,\n onCheckout,\n onCheckoutCompleted,\n onSuccess,\n disableSuccessAnimation,\n setWidgetReadOnly,\n setCheckoutSuccess,\n setErrorMessage,\n ],\n );\n\n return { handleZuoraSubmit };\n}\n","import React, { FC, PropsWithChildren } from 'react';\nimport { Skeleton } from '../../components/Skeletons.style';\n\nexport const WithSkeleton: FC<\n PropsWithChildren<{\n isLoading: boolean;\n width?: number | string;\n height?: number | string;\n }>\n> = ({ isLoading, width = 50, height = 16, children }) => {\n if (isLoading) {\n return <Skeleton width={width} height={height} />;\n }\n\n return <>{children}</>;\n};\n","/* eslint-disable react/no-unused-prop-types */\nimport React from 'react';\nimport moment from 'moment';\nimport { Box } from '@mui/material';\nimport { BillingModel, BillingPeriod, Plan, Subscription, SubscriptionPreviewV2 } from '@stigg/js-client-sdk';\nimport { Typography } from '../../../common/Typography';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { CheckoutLocalization } from '../../configurations/textOverrides';\nimport { WithSkeleton } from './WithSkeleton';\n\nexport type CheckoutCaptionProps = {\n subscriptionPreview?: SubscriptionPreviewV2 | null;\n isFetchingSubscriptionPreview: boolean;\n activeSubscription?: Subscription | null;\n plan?: Plan;\n checkoutLocalization: CheckoutLocalization;\n billingPeriod: BillingPeriod;\n};\n\nconst RemainingCreditsCaption = ({\n subscriptionPreview,\n isFetchingSubscriptionPreview,\n checkoutLocalization,\n}: CheckoutCaptionProps) => {\n const { immediateInvoice } = subscriptionPreview || {};\n if (!immediateInvoice?.proration?.netAmount?.amount || immediateInvoice?.proration?.netAmount?.amount >= 0) {\n return null;\n }\n\n const positiveAmount = immediateInvoice.proration.netAmount.amount * -1;\n\n const credits = currencyPriceFormatter({\n amount: positiveAmount,\n currency: immediateInvoice.proration.netAmount.currency,\n minimumFractionDigits: 2,\n });\n\n return (\n <Typography variant=\"body1\" style={{ marginTop: 14 }} className=\"stigg-checkout-summary-captions-remaining-credits\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview} width=\"100%\">\n {checkoutLocalization.summary.creditsForUnusedTimeText({ credits })}\n </WithSkeleton>\n </Typography>\n );\n};\n\nconst ScheduledUpdatesCaption = ({\n subscriptionPreview,\n activeSubscription,\n isFetchingSubscriptionPreview,\n checkoutLocalization,\n}: CheckoutCaptionProps) => {\n if (!subscriptionPreview?.hasScheduledUpdates || !activeSubscription?.currentBillingPeriodEnd) {\n return null;\n }\n\n const { currentBillingPeriodEnd } = activeSubscription;\n const changesWillApplyText =\n typeof checkoutLocalization.summary.changesWillApplyAtEndOfBillingPeriod === 'function'\n ? checkoutLocalization.summary.changesWillApplyAtEndOfBillingPeriod({ billingPeriodEnd: currentBillingPeriodEnd })\n : checkoutLocalization.summary.changesWillApplyAtEndOfBillingPeriod;\n\n return (\n <Typography variant=\"body1\" style={{ marginTop: 14 }} className=\"stigg-checkout-summary-captions-scheduled-updates\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview} width=\"100%\">\n {changesWillApplyText}\n </WithSkeleton>\n </Typography>\n );\n};\n\nconst NextBillingCaption = ({\n subscriptionPreview,\n activeSubscription,\n plan,\n isFetchingSubscriptionPreview,\n billingPeriod,\n}: CheckoutCaptionProps) => {\n const { recurringInvoice } = subscriptionPreview || {};\n if (!subscriptionPreview || !recurringInvoice?.total.amount) {\n return null;\n }\n\n const currentBillingPeriodEnd = subscriptionPreview.hasScheduledUpdates\n ? activeSubscription?.currentBillingPeriodEnd\n : subscriptionPreview?.billingPeriodRange.end;\n\n const total = currencyPriceFormatter({\n ...recurringInvoice.total,\n minimumFractionDigits: 2,\n });\n\n const hasUnitBasedPricing = plan?.pricePoints.some((price) => price.pricingModel === BillingModel.UsageBased);\n const hasNonUnitBasedPricing = plan?.pricePoints.some((price) => price.pricingModel !== BillingModel.UsageBased);\n\n let text = 'We will bill you ';\n let totalAmountText = `${total} `;\n\n if (hasUnitBasedPricing) {\n if (!hasNonUnitBasedPricing) {\n totalAmountText = 'for';\n } else {\n totalAmountText += '+';\n }\n\n totalAmountText += ' applicable usage-based charges for this subscription ';\n }\n\n let nextBillingDate;\n let billingPeriodText;\n\n switch (billingPeriod) {\n case BillingPeriod.Monthly:\n billingPeriodText = 'month';\n nextBillingDate = `the ${moment(currentBillingPeriodEnd).format('Do')}`;\n break;\n case BillingPeriod.Annually:\n billingPeriodText = 'year';\n nextBillingDate = moment(currentBillingPeriodEnd).format('MMMM Do');\n break;\n default: {\n break;\n }\n }\n\n text += `${totalAmountText}for this subscription every ${billingPeriodText} on ${nextBillingDate}, unless you cancel.`;\n\n return (\n <Typography variant=\"body1\" style={{ marginTop: 14 }} className=\"stigg-checkout-summary-captions-next-billing\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview} width=\"100%\">\n {text}\n </WithSkeleton>\n </Typography>\n );\n};\n\nexport function CheckoutCaptions(props: CheckoutCaptionProps) {\n return (\n <Box className=\"stigg-checkout-summary-captions\">\n <RemainingCreditsCaption {...props} />\n\n <ScheduledUpdatesCaption {...props} />\n\n <NextBillingCaption {...props} />\n </Box>\n );\n}\n","import { BillingModel, BillingPeriod, Currency, Price, TiersMode } from '@stigg/js-client-sdk';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { isBulkTiers, isQuantityInFirstTier } from '../../../utils/priceTierUtils';\nimport { numberFormatter } from '../../../utils/numberUtils';\n\nexport type GetPriceBreakdownStringProps = {\n totalAmount: number;\n quantity: number;\n tiersMode: Price['tiersMode'];\n tiers: Price['tiers'];\n currency: Currency;\n pricingModel: BillingModel;\n billingPeriod: BillingPeriod;\n blockSize?: number | null;\n priceAmount?: Price['amount'];\n};\n\nexport function formatPricePerUnit({\n quantity,\n totalAmount,\n pricingModel,\n billingPeriod,\n currency,\n blockSize,\n priceAmount,\n}: GetPriceBreakdownStringProps) {\n const isPerUnit = pricingModel === BillingModel.PerUnit;\n const aBlockSize = blockSize || 1;\n const featureUnits =\n quantity && (isPerUnit || quantity > 1) ? `${numberFormatter(quantity)} ${aBlockSize > 1 ? 'for' : 'x'} ` : '';\n const billingPeriodString = billingPeriod === BillingPeriod.Annually ? ' x 12 months' : '';\n\n const unitPrice = (priceAmount || totalAmount / quantity) / (billingPeriod === BillingPeriod.Annually ? 12 : 1);\n const formattedUnitPrice = currencyPriceFormatter({\n amount: unitPrice,\n currency,\n minimumFractionDigits: 2,\n });\n const formattedTotalPrice = currencyPriceFormatter({\n amount: totalAmount,\n currency,\n minimumFractionDigits: 2,\n });\n\n return `${featureUnits}${formattedUnitPrice}${billingPeriodString} ${\n billingPeriodString || featureUnits ? ` = ${formattedTotalPrice}` : ''\n }`;\n}\n\nexport function getPriceBreakdownString(params: GetPriceBreakdownStringProps) {\n const { totalAmount, quantity, tiersMode, tiers, currency } = params;\n if (isBulkTiers(tiers) || (tiersMode === TiersMode.Graduated && !isQuantityInFirstTier(tiers, quantity))) {\n const formattedTotalPrice = currencyPriceFormatter({\n amount: totalAmount,\n currency,\n minimumFractionDigits: 2,\n });\n return `${numberFormatter(quantity)} for ${formattedTotalPrice}`;\n }\n\n return formatPricePerUnit(params);\n}\n","import React from 'react';\nimport isNil from 'lodash/isNil';\nimport { Price, PriceTierFragment } from '@stigg/js-client-sdk';\nimport { Typography } from '../../../common/Typography';\nimport { calculateTierPriceGraduated } from '../../../utils/priceTierUtils';\nimport { formatPricePerUnit } from './getPriceBreakdownString';\nimport { LineItemContainer, LineItemRow } from './LineItems';\nimport { numberFormatter } from '../../../utils/numberUtils';\n\nfunction getLabel(tiers: PriceTierFragment[], index: number): string {\n const { unitPrice, upTo } = tiers[index];\n if (!unitPrice) {\n return '';\n }\n\n if (index === 0) {\n return `First ${upTo}`;\n }\n\n const previousTierUpTo = tiers[index - 1].upTo || 0;\n const startUnit = previousTierUpTo + 1;\n\n return isNil(upTo)\n ? `${numberFormatter(startUnit)} and above`\n : `Next ${numberFormatter(startUnit)} to ${numberFormatter(upTo)}`;\n}\n\nexport type GraduatedPriceBreakdownProps = {\n price: Price;\n unitQuantity: number;\n};\n\nexport function GraduatedPriceBreakdown({ price, unitQuantity }: GraduatedPriceBreakdownProps) {\n const tiers = price.tiers || [];\n\n const { breakdown } = calculateTierPriceGraduated(tiers, unitQuantity);\n\n if (breakdown.length === 1) {\n return null;\n }\n\n return (\n <>\n {breakdown.map(({ unitQuantity, amount }, index) => (\n <LineItemContainer>\n <LineItemRow key={index} style={{ alignItems: 'flex-start' }}>\n <Typography variant=\"body1\" color=\"tertiary\" style={{ whiteSpace: 'nowrap' }}>\n {getLabel(tiers, index)}\n </Typography>\n <Typography variant=\"body1\" color=\"tertiary\" style={{ whiteSpace: 'nowrap' }}>\n {formatPricePerUnit({\n quantity: unitQuantity,\n totalAmount: amount,\n currency: price.currency,\n pricingModel: price.pricingModel,\n billingPeriod: price.billingPeriod,\n tiers: price.tiers,\n tiersMode: price.tiersMode,\n blockSize: price.blockSize,\n priceAmount: price.amount,\n })}\n </Typography>\n </LineItemRow>\n </LineItemContainer>\n ))}\n </>\n );\n}\n","import { ChevronRight } from 'react-feather';\nimport styled from 'styled-components';\n\nexport const CollapsableSectionIcon = styled(ChevronRight)<{ $isOpen: boolean; $size?: number }>`\n height: ${({ $size = 24 }) => `${$size}px`};\n width: ${({ $size = 24 }) => `${$size}px`};\n transition: all 0.2s ease-in;\n ${({ $isOpen }) => $isOpen && `transform: rotate(90deg)`}\n`;\n","import React, { ReactNode, useState } from 'react';\nimport styled from '@emotion/styled/macro';\nimport Grid from '@mui/material/Grid';\nimport {\n BillingModel,\n Price,\n SubscriptionPreviewInvoice,\n SubscriptionPreviewV2,\n TiersMode,\n} from '@stigg/js-client-sdk';\nimport isEmpty from 'lodash/isEmpty';\nimport isNil from 'lodash/isNil';\nimport Link from '@mui/material/Link';\nimport { IconButton } from '@mui/material';\nimport Collapse from '@mui/material/Collapse';\nimport { Typography } from '../../../common/Typography';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { WithSkeleton } from './WithSkeleton';\nimport { Skeleton } from '../../components/Skeletons.style';\nimport { CheckoutLocalization } from '../../configurations/textOverrides';\nimport { Icon } from '../../../common/Icon';\nimport { InformationTooltip } from '../../../common/InformationTooltip';\nimport { getPriceBreakdownString } from './getPriceBreakdownString';\nimport { GraduatedPriceBreakdown } from './GraduatedPriceBreakdown';\nimport { CollapsableSectionIcon } from '../../../common/CollapsableSectionIcon';\nimport { calculateTierPrice } from '../../../utils/priceTierUtils';\nimport { useIsScreenWiderThan } from '../../../hooks/useIsScreenWiderThan';\nimport { mq } from '../../../common/mediaQuery';\n\nexport const LineItemContainer = styled.div`\n & + & {\n margin-top: 16px;\n }\n`;\n\nexport const NestedBreakdownContainer = styled.div`\n margin-top: 16px;\n margin-left: 16px;\n`;\n\nexport const LineItemRow = styled.div`\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n ${mq.lg} {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n`;\n\nconst PayAsYouGoPriceTooltip = ({ checkoutLocalization }: { checkoutLocalization: CheckoutLocalization }) => {\n const title = <Typography variant=\"body1\">{checkoutLocalization.summary.payAsYouGoTooltipText}</Typography>;\n return (\n <InformationTooltip placement=\"left\" title={title}>\n <Icon icon=\"PayAsYouGoCharge\" style={{ display: 'flex' }} />\n </InformationTooltip>\n );\n};\n\nexport const BilledPriceLineItem = ({\n checkoutLocalization,\n label,\n quantity,\n price,\n}: {\n checkoutLocalization: CheckoutLocalization;\n label: string;\n quantity: number;\n price: Price;\n}) => {\n const isScreenWiderThanLg = useIsScreenWiderThan('lg');\n const [isNestedBreakdownOpen, setIsNestedBreakdownOpen] = useState(false);\n const toggleNestedBreakdown = () => setIsNestedBreakdownOpen((prev) => !prev);\n\n const isPayAsYouGo = price.pricingModel === BillingModel.UsageBased;\n const totalAmount = price.isTieredPrice\n ? calculateTierPrice(price, quantity)\n : (price.amount || 0) * Math.ceil(quantity / (price.blockSize || 1));\n\n let nestedBreakdown: ReactNode;\n const shouldShowGraduatedPriceBreakdown =\n price.tiersMode === TiersMode.Graduated &&\n !!price.tiers &&\n !isEmpty(price.tiers) &&\n !isNil(price.tiers[0].upTo) &&\n quantity > price.tiers[0].upTo;\n\n if (shouldShowGraduatedPriceBreakdown) {\n nestedBreakdown = <GraduatedPriceBreakdown price={price} unitQuantity={quantity} />;\n }\n\n let title: ReactNode = (\n <Typography variant=\"body1\" color=\"secondary\">\n {label}\n </Typography>\n );\n\n if (nestedBreakdown) {\n title = (\n <Link onClick={toggleNestedBreakdown} underline=\"none\" style={{ cursor: 'pointer' }}>\n {title}\n </Link>\n );\n }\n\n return (\n <LineItemContainer className=\"stigg-checkout-summary-base-charges-container\">\n <LineItemRow style={{ alignItems: 'flex-start' }}>\n <Grid item display=\"flex\" gap={0.5} style={{ whiteSpace: isScreenWiderThanLg ? 'nowrap' : 'break-spaces' }}>\n {title}\n {nestedBreakdown && (\n <IconButton onClick={toggleNestedBreakdown} sx={{ padding: 0 }}>\n <CollapsableSectionIcon $isOpen={isNestedBreakdownOpen} $size={16} />\n </IconButton>\n )}\n </Grid>\n <Grid item display=\"flex\" gap={1} alignItems=\"center\">\n {isPayAsYouGo && <PayAsYouGoPriceTooltip checkoutLocalization={checkoutLocalization} />}\n <Typography\n variant=\"body1\"\n color=\"secondary\"\n style={{ whiteSpace: isScreenWiderThanLg ? 'nowrap' : 'break-spaces' }}>\n {getPriceBreakdownString({\n totalAmount,\n quantity,\n currency: price.currency,\n pricingModel: price.pricingModel,\n billingPeriod: price.billingPeriod,\n tiers: price.tiers,\n tiersMode: price.tiersMode,\n blockSize: price.blockSize,\n priceAmount: price.amount,\n })}\n {isPayAsYouGo && ' / unit'}\n </Typography>\n </Grid>\n </LineItemRow>\n {nestedBreakdown && (\n <Collapse in={isNestedBreakdownOpen}>\n <NestedBreakdownContainer>{nestedBreakdown}</NestedBreakdownContainer>\n </Collapse>\n )}\n </LineItemContainer>\n );\n};\n\nexport const FreeChargeLineItem = ({ label }: { label: string }) => {\n return (\n <LineItemContainer>\n <LineItemRow style={{ alignItems: 'flex-end' }}>\n <Grid item>\n <Typography variant=\"body1\" color=\"secondary\">\n {label}\n </Typography>\n </Grid>\n <Grid item display=\"flex\" gap={1} alignItems=\"center\">\n <Typography variant=\"body1\" color=\"secondary\" style={{ wordBreak: 'break-word' }}>\n Free\n </Typography>\n </Grid>\n </LineItemRow>\n </LineItemContainer>\n );\n};\n\nexport const DiscountLineItem = ({\n subscriptionPreview,\n isFetchingSubscriptionPreview,\n checkoutLocalization,\n}: {\n subscriptionPreview: SubscriptionPreviewV2;\n isFetchingSubscriptionPreview: boolean;\n checkoutLocalization: CheckoutLocalization;\n}) => {\n const { immediateInvoice, recurringInvoice } = subscriptionPreview;\n const { discount, discountDetails } = recurringInvoice || {};\n if (!discount || !discountDetails) {\n return null;\n }\n\n return (\n <LineItemContainer>\n <LineItemRow>\n <Typography variant=\"body1\" color=\"secondary\">\n {checkoutLocalization.summary.discountText({\n discountDetails,\n currency: immediateInvoice.total.currency,\n })}\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n {isFetchingSubscriptionPreview ? (\n <Skeleton width={50} height={16} />\n ) : (\n currencyPriceFormatter({\n amount: discount.amount,\n currency: discount.currency,\n minimumFractionDigits: 2,\n })\n )}\n </Typography>\n </LineItemRow>\n </LineItemContainer>\n );\n};\n\nexport const AppliedCreditsLineItem = ({\n subscriptionPreview,\n isFetchingSubscriptionPreview,\n checkoutLocalization,\n}: {\n subscriptionPreview: SubscriptionPreviewV2 | null;\n isFetchingSubscriptionPreview: boolean;\n checkoutLocalization: CheckoutLocalization;\n}) => {\n const { immediateInvoice } = subscriptionPreview || {};\n const { credits } = immediateInvoice || {};\n\n if (!credits || !credits.used || credits.used.amount <= 0) {\n return null;\n }\n\n return (\n <LineItemContainer>\n <LineItemRow>\n <Typography variant=\"body1\" color=\"secondary\">\n {checkoutLocalization.summary.appliedCreditsTitle}\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview}>\n {currencyPriceFormatter({\n amount: -1 * credits.used.amount,\n currency: credits.used.currency,\n minimumFractionDigits: 2,\n })}\n </WithSkeleton>\n </Typography>\n </LineItemRow>\n </LineItemContainer>\n );\n};\n\nexport const TaxLineItem = ({\n tax,\n taxDetails,\n isFetchingSubscriptionPreview,\n checkoutLocalization,\n}: {\n isFetchingSubscriptionPreview: boolean;\n checkoutLocalization: CheckoutLocalization;\n} & Pick<SubscriptionPreviewInvoice, 'tax' | 'taxDetails'>) => {\n if (!taxDetails || !tax || tax?.amount <= 0) {\n return null;\n }\n\n return (\n <LineItemContainer>\n <LineItemRow>\n <Typography variant=\"body1\" color=\"secondary\">\n {checkoutLocalization.summary.taxTitle({ taxDetails })}\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview}>\n {currencyPriceFormatter({ amount: tax?.amount, currency: tax?.currency, minimumFractionDigits: 2 })}\n </WithSkeleton>\n </Typography>\n </LineItemRow>\n </LineItemContainer>\n );\n};\n","import React, { useState } from 'react';\nimport partition from 'lodash/partition';\nimport styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport Divider from '@mui/material/Divider';\nimport Grid from '@mui/material/Grid';\nimport Paper from '@mui/material/Paper';\nimport { BillingModel } from '@stigg/js-client-sdk';\nimport { PoweredByStigg } from '../../common/PoweredByStigg';\nimport { Typography } from '../../common/Typography';\nimport { useChargesSort } from '../../hooks/useChargeSort';\nimport { currencyPriceFormatter } from '../../utils/currencyUtils';\nimport { Button } from '../components';\nimport {\n useCheckoutModel,\n useProgressBarModel,\n usePreviewSubscription,\n useSubscriptionModel,\n usePaymentStepModel,\n} from '../hooks';\nimport { PromotionCodeSection } from '../promotionCode';\nimport { useSubmit } from '../steps/payment/stripe';\nimport { useZuoraIntegration } from '../steps/payment/zuora/useZuoraIntegration';\nimport { useZuoraSubmit } from '../steps/payment/zuora/useZuoraSubmit';\nimport { CheckoutContainerProps } from '../CheckoutContainer';\nimport { CheckoutCaptions } from './components/CheckoutCaptions';\nimport {\n AppliedCreditsLineItem,\n BilledPriceLineItem,\n DiscountLineItem,\n FreeChargeLineItem,\n LineItemContainer,\n LineItemRow,\n TaxLineItem,\n} from './components/LineItems';\nimport { WithSkeleton } from './components/WithSkeleton';\nimport { Icon } from '../../common/Icon';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\nimport { CheckoutSuccess } from './CheckoutSuccess';\nimport { getFeatureDisplayNameText } from '../../utils/getFeatureName';\nimport { mq } from '../../common/mediaQuery';\n\nexport const SummaryContainer = styled(Box)`\n width: 100%;\n max-width: 470px;\n flex: 1.5;\n`;\n\nexport const SummaryCard = styled(Paper)`\n background: ${({ theme }) => theme.stigg.palette.backgroundHighlight};\n padding: 16px;\n\n ${mq.md} {\n border-radius: 10px;\n }\n`;\n\nSummaryCard.defaultProps = {\n elevation: 0,\n};\n\nconst SummaryTitle = styled(Typography)`\n margin-bottom: 16px;\n font-weight: 500;\n`;\n\nconst StyledDivider = styled(Divider)`\n margin: 16px 0;\n`;\n\nconst TotalDueText = styled(Typography)`\n margin-bottom: 8px;\n`;\n\nfunction resolveCheckoutButtonText({\n isLastStep,\n checkoutHasChanges,\n isFreeDowngrade,\n checkoutLocalization,\n isPlanUpdate,\n}: {\n isLastStep?: boolean;\n checkoutHasChanges: boolean;\n isFreeDowngrade: boolean;\n checkoutLocalization: CheckoutLocalization;\n isPlanUpdate?: boolean;\n}) {\n if (!isLastStep) {\n return checkoutLocalization.checkoutButton.nextText;\n }\n\n if (!checkoutHasChanges) {\n return checkoutLocalization.checkoutButton.noChangesText;\n }\n\n if (isPlanUpdate) {\n return checkoutLocalization.checkoutButton.updateText;\n }\n\n if (isFreeDowngrade) {\n return checkoutLocalization.checkoutButton.downgradeToFreeText;\n }\n\n return checkoutLocalization.checkoutButton.upgradeText;\n}\n\nexport const CheckoutSummary = ({\n onCheckout,\n onCheckoutCompleted,\n disablePromotionCode,\n disableSuccessAnimation,\n isFreeDowngrade,\n onMockCheckoutPreview,\n isWidgetWatermarkEnabled,\n}: CheckoutContainerProps & { isFreeDowngrade: boolean; isWidgetWatermarkEnabled: boolean }) => {\n const [isCheckoutCompletedSuccessfully, setIsCheckoutCompletedSuccessfully] = useState(false);\n const { setErrorMessage, useNewPaymentMethod } = usePaymentStepModel();\n const progressBar = useProgressBarModel();\n const subscription = useSubscriptionModel();\n const { checkoutState, checkoutLocalization, checkoutSuccess, widgetState } = useCheckoutModel();\n const { plan, activeSubscription } = checkoutState || {};\n const planPrices = useChargesSort(\n plan?.pricePoints?.filter((price) => price.billingPeriod === subscription.billingPeriod) || [],\n );\n const [baseCharges, usageCharges] = partition(planPrices, (price) => price.pricingModel === BillingModel.FlatFee);\n const [baseCharge] = baseCharges || [];\n const isLastStep = isFreeDowngrade || (progressBar.isCheckoutComplete && progressBar.isLastStep);\n const { isZuoraIntegration } = useZuoraIntegration();\n\n const isCheckoutCompleted = isCheckoutCompletedSuccessfully || checkoutSuccess;\n\n const { subscriptionPreview, isFetchingSubscriptionPreview } = usePreviewSubscription({ onMockCheckoutPreview });\n\n const { handleSubmit: handleStripeSubmit, isLoading: isStripeLoading } = useSubmit({\n isMocked: !!onMockCheckoutPreview, // This is a hack to make the submit button work with mocked data\n disableSuccessAnimation,\n onCheckout,\n onCheckoutCompleted,\n onSuccess: () => {\n setIsCheckoutCompletedSuccessfully(true);\n progressBar.markStepAsCompleted(progressBar.progressBarState.activeStep);\n },\n });\n\n const { handleZuoraSubmit } = useZuoraSubmit({\n onCheckout,\n onCheckoutCompleted,\n disableSuccessAnimation,\n onSuccess: () => {\n progressBar.markStepAsCompleted(progressBar.progressBarState.activeStep);\n },\n });\n\n const handleCheckout = async (e: any) => {\n if (isCheckoutCompleted) {\n return;\n }\n\n let result;\n\n if (isZuoraIntegration && !useNewPaymentMethod) {\n result = await handleZuoraSubmit();\n } else {\n result = await handleStripeSubmit(e);\n }\n\n const { errorMessage } = result || {};\n if (errorMessage) {\n setErrorMessage(errorMessage);\n setIsCheckoutCompletedSuccessfully(false);\n } else {\n setErrorMessage(undefined);\n }\n };\n\n // This is sad\n const isLoading = isZuoraIntegration && !useNewPaymentMethod ? widgetState.readOnly : isStripeLoading;\n\n const onCheckoutClick = async (e: any): Promise<void> => {\n if (isLoading) {\n return;\n }\n\n if (isLastStep) {\n await handleCheckout(e);\n } else {\n progressBar.goNext();\n }\n };\n\n const { immediateInvoice, recurringInvoice } = subscriptionPreview || {};\n const checkoutHasChanges =\n !!subscriptionPreview && (!!immediateInvoice?.proration || !!subscriptionPreview.hasScheduledUpdates);\n const showPromotionCodeLine = !disablePromotionCode && !isFreeDowngrade && !isZuoraIntegration;\n const showDiscountLine = !!recurringInvoice?.discountDetails && !isFreeDowngrade;\n const hasDiscounts = showPromotionCodeLine || showDiscountLine;\n\n const hasPayAsYouGoCharges = usageCharges.some((price) => price.pricingModel === BillingModel.UsageBased);\n const onlyPayAsYouGoCharges =\n hasPayAsYouGoCharges &&\n !baseCharge &&\n usageCharges.every((price) => price.pricingModel === BillingModel.UsageBased);\n\n const baseChargeLabel =\n typeof checkoutLocalization.summary.baseChargeText === 'function'\n ? checkoutLocalization.summary.baseChargeText({ billingPeriod: subscription.billingPeriod })\n : checkoutLocalization.summary.baseChargeText;\n\n return (\n <SummaryContainer>\n <SummaryCard>\n <SummaryTitle variant=\"h3\">{checkoutLocalization.summary.title}</SummaryTitle>\n\n <Grid\n className=\"stigg-checkout-summary-plan-title-container\"\n display=\"flex\"\n flexDirection=\"row\"\n alignItems=\"center\"\n marginY={2}>\n <Typography variant=\"h6\" color=\"primary\" style={{ paddingRight: '8px' }}>\n {checkoutLocalization.summary.planName({ plan: plan! })}\n </Typography>\n <StyledDivider className=\"stigg-checkout-summary-divider\" sx={{ flex: 1, margin: '0 !important' }} />\n </Grid>\n\n {baseCharge && (\n <BilledPriceLineItem\n checkoutLocalization={checkoutLocalization}\n label={baseChargeLabel}\n quantity={1}\n price={baseCharge}\n />\n )}\n {!baseCharge && isFreeDowngrade ? <FreeChargeLineItem label={baseChargeLabel} /> : null}\n\n <Grid item className=\"stigg-checkout-summary-usage-charges-container\">\n {usageCharges.map((price) => {\n const priceBillableFeature = subscription.billableFeatures?.find(\n (billableFeature) => billableFeature.featureId === price.feature?.featureId,\n );\n\n return (\n <BilledPriceLineItem\n checkoutLocalization={checkoutLocalization}\n key={price.feature?.featureId}\n label={getFeatureDisplayNameText(\n price.feature?.displayName || '',\n price.feature?.units,\n price.feature?.unitsPlural,\n )}\n quantity={priceBillableFeature?.quantity || 1}\n price={price}\n />\n );\n })}\n </Grid>\n\n {!!subscription.addons?.length && (\n <>\n <Grid display=\"flex\" flexDirection=\"row\" alignItems=\"center\" marginY={2}>\n <Typography variant=\"h6\" color=\"primary\" style={{ paddingRight: '8px' }}>\n {checkoutLocalization.summary.addonsSectionTitle}\n </Typography>\n <StyledDivider className=\"stigg-checkout-summary-divider\" sx={{ flex: 1, margin: '0 !important' }} />\n </Grid>\n {subscription.addons.map((addon) => {\n const addonPrice = addon.addon.pricePoints?.find(\n (price) => price.billingPeriod === subscription.billingPeriod,\n );\n\n if (!addonPrice) return null;\n\n const addonQuantity = addon.quantity && addon.quantity > 0 ? addon.quantity : 1;\n\n return (\n <BilledPriceLineItem\n checkoutLocalization={checkoutLocalization}\n key={addon?.addon?.id}\n label={addon.addon.displayName}\n quantity={addonQuantity}\n price={addonPrice}\n />\n );\n })}\n </>\n )}\n\n {!hasDiscounts && <StyledDivider className=\"stigg-checkout-summary-divider\" />}\n {hasDiscounts && (\n <Grid display=\"flex\" flexDirection=\"row\" alignItems=\"center\" marginY={2}>\n <Typography variant=\"h6\" color=\"primary\" style={{ paddingRight: '8px' }}>\n {checkoutLocalization.summary.discountsSectionTitle}\n </Typography>\n <StyledDivider className=\"stigg-checkout-summary-divider\" sx={{ flex: 1, margin: '0 !important' }} />\n </Grid>\n )}\n\n {showPromotionCodeLine && (\n <PromotionCodeSection\n disabled={isLoading || isFetchingSubscriptionPreview}\n checkoutLocalization={checkoutLocalization}\n onMockCheckoutPreview={onMockCheckoutPreview}\n />\n )}\n\n {showDiscountLine && (\n <DiscountLineItem\n subscriptionPreview={subscriptionPreview!}\n isFetchingSubscriptionPreview={isFetchingSubscriptionPreview}\n checkoutLocalization={checkoutLocalization}\n />\n )}\n\n {hasDiscounts && <StyledDivider className=\"stigg-checkout-summary-divider\" />}\n\n <TaxLineItem\n tax={recurringInvoice?.tax}\n taxDetails={recurringInvoice?.taxDetails}\n isFetchingSubscriptionPreview={isFetchingSubscriptionPreview}\n checkoutLocalization={checkoutLocalization}\n />\n\n {!isFreeDowngrade ? (\n <>\n <LineItemRow style={{ marginTop: 16 }}>\n <Grid display=\"flex\" flexDirection=\"column\" container>\n <Grid item display=\"flex\" justifyContent=\"space-between\">\n <Typography variant=\"h6\">{checkoutLocalization.summary.totalText}</Typography>\n <Typography variant=\"h6\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview}>\n {onlyPayAsYouGoCharges ? checkoutLocalization.summary.onlyPayAsYouGoText : null}\n {!onlyPayAsYouGoCharges && hasPayAsYouGoCharges\n ? checkoutLocalization.summary.startsAtText\n : null}\n {!onlyPayAsYouGoCharges\n ? currencyPriceFormatter({\n amount: 0,\n ...recurringInvoice?.total,\n minimumFractionDigits: 2,\n })\n : null}\n </WithSkeleton>\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"body1\" color=\"secondary\">\n {checkoutLocalization.summary.totalBillingPeriodText({ billingPeriod: subscription.billingPeriod })}\n </Typography>\n </Grid>\n </Grid>\n </LineItemRow>\n <StyledDivider className=\"stigg-checkout-summary-divider\" />\n </>\n ) : null}\n\n {immediateInvoice?.proration?.hasProrations &&\n immediateInvoice?.subTotal &&\n immediateInvoice?.subTotal.amount > 0 ? (\n <LineItemContainer>\n <LineItemRow>\n <Typography variant=\"body1\" color=\"secondary\">\n {checkoutLocalization.summary.proratedTotalDueText}\n </Typography>\n <Typography variant=\"body1\" color=\"secondary\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview}>\n {currencyPriceFormatter({\n amount: immediateInvoice?.subTotal?.amount + (immediateInvoice?.tax?.amount || 0),\n currency: immediateInvoice?.subTotal.currency,\n minimumFractionDigits: 2,\n })}\n </WithSkeleton>\n </Typography>\n </LineItemRow>\n </LineItemContainer>\n ) : null}\n\n <AppliedCreditsLineItem\n subscriptionPreview={subscriptionPreview}\n isFetchingSubscriptionPreview={isFetchingSubscriptionPreview}\n checkoutLocalization={checkoutLocalization}\n />\n\n <LineItemContainer>\n <LineItemRow>\n <TotalDueText variant=\"h6\">{checkoutLocalization.summary.totalDueText}</TotalDueText>\n <TotalDueText variant=\"h6\">\n <WithSkeleton isLoading={isFetchingSubscriptionPreview}>\n {currencyPriceFormatter({ amount: 0, ...immediateInvoice?.total, minimumFractionDigits: 2 })}\n </WithSkeleton>\n </TotalDueText>\n </LineItemRow>\n </LineItemContainer>\n\n <CheckoutCaptions\n plan={plan}\n activeSubscription={activeSubscription}\n subscriptionPreview={subscriptionPreview}\n isFetchingSubscriptionPreview={isFetchingSubscriptionPreview}\n checkoutLocalization={checkoutLocalization}\n billingPeriod={subscription.billingPeriod}\n />\n\n {(!isLastStep || !isZuoraIntegration || (isZuoraIntegration && !useNewPaymentMethod)) && (\n <Button\n $success={isCheckoutCompleted}\n $error={isLastStep && isFreeDowngrade}\n disabled={\n isLoading ||\n isFetchingSubscriptionPreview ||\n progressBar.progressBarState.isDisabled ||\n (isLastStep && !checkoutHasChanges)\n }\n className=\"stigg-checkout-summary-cta-button\"\n sx={{ textTransform: 'none', borderRadius: '10px', marginTop: '24px', height: '36px' }}\n variant=\"contained\"\n size=\"medium\"\n onClick={(e: any) => {\n void onCheckoutClick(e);\n }}\n fullWidth>\n <Typography\n className=\"stigg-checkout-summary-cta-button-text\"\n variant=\"h3\"\n color=\"white\"\n style={{ display: 'flex' }}>\n {isCheckoutCompleted ? (\n <Icon icon=\"Check\" style={{ display: 'contents' }} />\n ) : isLoading || isFetchingSubscriptionPreview ? (\n <CircularProgress size={20} sx={{ color: 'white' }} />\n ) : (\n resolveCheckoutButtonText({\n isLastStep,\n checkoutHasChanges,\n isFreeDowngrade,\n checkoutLocalization,\n isPlanUpdate: !!activeSubscription && activeSubscription?.plan.id === plan?.id,\n })\n )}\n </Typography>\n </Button>\n )}\n </SummaryCard>\n <PoweredByStigg\n source=\"checkout\"\n showWatermark={isWidgetWatermarkEnabled}\n style={{ marginTop: 8, display: 'flex', justifyContent: 'center' }}\n />\n {!disableSuccessAnimation && isCheckoutCompleted && (\n <CheckoutSuccess checkoutLocalization={checkoutLocalization} />\n )}\n </SummaryContainer>\n );\n};\n","import React from 'react';\nimport { PoweredByStigg } from '../../common/PoweredByStigg';\nimport { SummaryCard, SummaryContainer } from './CheckoutSummary';\nimport { FlexedSkeleton, Skeleton, SkeletonsContainer } from '../components/Skeletons.style';\n\nexport const CheckoutSummarySkeleton = ({ isWidgetWatermarkEnabled }: { isWidgetWatermarkEnabled: boolean }) => {\n return (\n <SummaryContainer>\n <SummaryCard>\n <SkeletonsContainer $flexDirection=\"column\" $gap={24}>\n <Skeleton width={120} height={20} />\n\n <Skeleton width={120} height={20} />\n\n <Skeleton width={120} height={20} />\n\n <Skeleton width={120} height={20} />\n </SkeletonsContainer>\n\n <SkeletonsContainer $flexDirection=\"column\" $gap={24} marginTop={5}>\n <Skeleton height={20} />\n\n <Skeleton height={20} />\n\n <Skeleton height={20} />\n </SkeletonsContainer>\n\n <FlexedSkeleton flex={1} marginTop={5}>\n <Skeleton height={34} />\n </FlexedSkeleton>\n </SummaryCard>\n <PoweredByStigg\n source=\"checkout\"\n showWatermark={isWidgetWatermarkEnabled}\n style={{ marginTop: 8, display: 'flex', justifyContent: 'center' }}\n />\n </SummaryContainer>\n );\n};\n","import styled from '@emotion/styled/macro';\nimport Grid from '@mui/material/Grid';\n\nimport { Button } from '../../components';\nimport { mq } from '../../../common/mediaQuery';\n\nexport const CheckoutAddonsContainer = styled(Grid)`\n width: 100%;\n gap: 8px;\n`;\n\nexport const AddonListItemContainer = styled(Grid)`\n display: flex;\n flex-direction: column;\n gap: 16px;\n\n ${mq.md} {\n gap: 0;\n flex-direction: row;\n justify-content: space-between;\n height: 80px;\n align-items: center;\n }\n`;\n\nexport const TrashButton = styled(Button)`\n min-width: unset;\n width: 41px;\n height: 41px;\n padding: 0;\n`;\n","import React, { useEffect, useState } from 'react';\n\nimport Grid from '@mui/material/Grid';\nimport { Addon, BillingPeriod, SubscriptionAddon } from '@stigg/js-client-sdk';\n\nimport { Icon } from '../../../common/Icon';\nimport { Typography } from '../../../common/Typography';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { Button, InputField } from '../../components';\nimport { useAddonsStepModel } from '../../hooks/useAddonsStepModel';\nimport { usePlanStepModel } from '../../hooks/usePlanStepModel';\nimport { AddonListItemContainer, CheckoutAddonsContainer, TrashButton } from './CheckoutAddonsStep.style';\nimport { CheckoutLocalization } from '../../configurations/textOverrides';\nimport { useCheckoutModel, useProgressBarModel } from '../../hooks';\nimport { ON_WHEEL_BLUR } from '../../../utils/onWheelBlur';\nimport { useIsScreenWiderThan } from '../../../hooks/useIsScreenWiderThan';\n\ntype UseAddonsStepModel = ReturnType<typeof useAddonsStepModel>;\n\ntype AddonListItemProps = {\n addon: Addon;\n addonState?: SubscriptionAddon;\n initialAddonState?: SubscriptionAddon;\n billingPeriod: BillingPeriod;\n setAddon: UseAddonsStepModel['setAddon'];\n removeAddon: UseAddonsStepModel['removeAddon'];\n checkoutLocalization: CheckoutLocalization;\n onAddonsValidationChange: (params: { addonId: string; isValid: boolean }) => void;\n isValid: boolean;\n};\n\nfunction AddonListItem({\n addon,\n billingPeriod,\n addonState,\n initialAddonState,\n setAddon,\n removeAddon,\n checkoutLocalization,\n onAddonsValidationChange,\n isValid,\n}: AddonListItemProps) {\n const isScreenWiderThanLg = useIsScreenWiderThan('lg');\n const addonPrice = addon.pricePoints.find((pricePoint) => pricePoint.billingPeriod === billingPeriod);\n const isAdded = !!addonState;\n const hasChanges =\n (!!addonState && !!initialAddonState && addonState.quantity !== initialAddonState.quantity) ||\n (!!initialAddonState && !addonState);\n\n const handleQuantityChange = (quantity: number | null) => {\n if (!quantity || quantity <= 0) {\n onAddonsValidationChange({ addonId: addon.id, isValid: false });\n // Reset the input value to null\n // @ts-ignore\n setAddon(addon, quantity ?? null);\n return;\n }\n\n onAddonsValidationChange({ addonId: addon.id, isValid: true });\n setAddon(addon, quantity);\n };\n\n const handleUndo = () => {\n if (initialAddonState) {\n setAddon(addon, initialAddonState.quantity);\n } else {\n removeAddon(addon.id);\n }\n\n onAddonsValidationChange({ addonId: addon.id, isValid: true });\n };\n\n return (\n <AddonListItemContainer container>\n <Grid item>\n <Typography variant=\"h6\" lineHeight=\"24px\">\n {addon.displayName}\n </Typography>\n {!!addonPrice && (\n <Typography variant=\"body1\" lineHeight=\"20px\" color=\"secondary\">\n {`${currencyPriceFormatter({\n amount: addonPrice.amount!,\n currency: addonPrice.currency,\n minimumFractionDigits: 2,\n })}/${billingPeriod === BillingPeriod.Annually ? 'year' : 'month'}`}\n </Typography>\n )}\n </Grid>\n <Grid item sx={{ gap: '16px' }} container={!isScreenWiderThanLg}>\n {hasChanges && (\n <Button variant=\"text\" size=\"small\" sx={{ padding: '8px', minWidth: 'unset' }} onClick={handleUndo}>\n <Typography color=\"primary.main\" variant=\"body1\">\n Undo\n </Typography>\n </Button>\n )}\n {isAdded && (\n <>\n <InputField\n id={`${addon.id}-input`}\n type=\"number\"\n onWheel={ON_WHEEL_BLUR}\n sx={isScreenWiderThanLg ? { marginX: 2, width: 120 } : { flex: 1 }}\n value={addonState?.quantity ?? ''}\n error={!isValid}\n helperText={!isValid ? 'Minimum 1' : undefined}\n FormHelperTextProps={{ sx: { margin: '4px' } }}\n onChange={(event) => handleQuantityChange(event?.target?.value ? Number(event?.target?.value) : null)}\n />\n <TrashButton\n color=\"error\"\n onClick={() => {\n removeAddon(addon.id);\n onAddonsValidationChange({ addonId: addon.id, isValid: true });\n }}>\n <Icon icon=\"Trash\" style={{ display: 'flex' }} />\n </TrashButton>\n </>\n )}\n {!isAdded && (\n <Button sx={{ paddingX: '22px', paddingY: '8px' }} onClick={() => handleQuantityChange(1)}>\n <Typography color=\"primary.main\" variant=\"body1\">\n {checkoutLocalization.addAddonText}\n </Typography>\n </Button>\n )}\n </Grid>\n </AddonListItemContainer>\n );\n}\n\nexport function CheckoutAddonsStep() {\n const { checkoutLocalization, setIsValid } = useCheckoutModel();\n const { billingPeriod } = usePlanStepModel();\n const { setIsDisabled } = useProgressBarModel();\n const { initialAddons, addons, availableAddons, setAddon, removeAddon } = useAddonsStepModel();\n const [addonsValidation, setAddonsValidation] = useState(\n availableAddons?.reduce<Record<string, boolean>>((acc, curr) => {\n acc[curr.id] = true;\n return acc;\n }, {}) || {},\n );\n\n useEffect(() => {\n const isDisabled = Object.values(addonsValidation).some((x) => !x);\n setIsDisabled(isDisabled);\n setIsValid(!isDisabled);\n }, [addonsValidation, setIsDisabled, setIsValid]);\n\n return (\n <CheckoutAddonsContainer container>\n {availableAddons?.map((addon) => {\n const addonState = addons.find((x) => x.addon.id === addon.id);\n const initialAddonState = initialAddons?.find((x) => x.addon.id === addon.id);\n const isValid = addonsValidation[addon.id];\n\n return (\n <AddonListItem\n key={addon.id}\n addon={addon}\n billingPeriod={billingPeriod}\n addonState={addonState}\n initialAddonState={initialAddonState}\n setAddon={setAddon}\n removeAddon={removeAddon}\n checkoutLocalization={checkoutLocalization}\n onAddonsValidationChange={({ addonId, isValid }: { addonId: string; isValid: boolean }) =>\n setAddonsValidation({ ...addonsValidation, [addonId]: isValid })\n }\n isValid={isValid}\n />\n );\n })}\n </CheckoutAddonsContainer>\n );\n}\n","import { css } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport Grid from '@mui/material/Grid';\n\nexport const PaymentMethodContainer = styled(Grid, { shouldForwardProp: (prop) => !prop.startsWith('$') })<{\n $disabled?: boolean;\n}>`\n padding: 8px;\n border-radius: 10px;\n border: 1px solid ${({ theme }) => theme.stigg.palette.outlinedBorder};\n cursor: ${({ $disabled }) => ($disabled ? 'not-allowed' : 'pointer')};\n opacity: ${({ $disabled }) => ($disabled ? 0.6 : 1)};\n`;\n\nexport const NewPaymentMethodContainer = styled(PaymentMethodContainer)<{ $hideBorders?: boolean }>`\n flex-direction: column;\n align-items: unset;\n ${({ $hideBorders }) =>\n $hideBorders &&\n css`\n border: none;\n padding: 0;\n `}\n`;\n\nexport const PaymentMethodLayoutContainer = styled(Grid)`\n display: flex;\n align-items: center;\n flex: 1;\n gap: 12px;\n`;\n\nexport const PaymentMethodTextContainer = styled(Grid)`\n display: flex;\n flex-direction: column;\n`;\n","import React, { useCallback, useEffect, useRef } from 'react';\nimport styled from '@emotion/styled';\nimport Box from '@mui/material/Box';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport { Currency, ZuoraCheckoutCredentialsFragment } from '@stigg/js-client-sdk';\nimport { useZuoraIntegration } from './useZuoraIntegration';\nimport { createZuoraPaymentFormConfig, ZuoraPaymentResult } from './zuora.utils';\nimport { useZuoraSubmit } from './useZuoraSubmit';\nimport { useCheckoutModel, usePaymentStepModel, usePlanStepModel } from '../../../hooks';\nimport { CheckoutContainerProps } from '../../../CheckoutContainer';\n\nconst Container = styled(Box)`\n position: relative;\n max-width: 500px;\n`;\n\nconst PaymentContainer = styled(Box)<{ $showLoading: boolean }>`\n opacity: ${({ $showLoading }) => ($showLoading ? 0.6 : 1)};\n pointer-events: ${({ $showLoading }) => ($showLoading ? 'none' : 'auto')};\n`;\n\nconst LoadingOverlay = styled(Box)`\n position: absolute;\n top: 40px;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(255, 255, 255, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n z-index: 10;\n`;\n\nconst LoadingContent = styled(Box)`\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n`;\n\nexport function ZuoraPaymentForm({\n onCheckout,\n onCheckoutCompleted,\n}: Pick<CheckoutContainerProps, 'onCheckout' | 'onCheckoutCompleted'>) {\n const { isZuoraIntegration, isInitialized, createPaymentSession } = useZuoraIntegration();\n const { setErrorMessage } = usePaymentStepModel();\n const { billingCountryCode } = usePlanStepModel();\n const { checkoutState, widgetState } = useCheckoutModel();\n const { handleZuoraSubmit } = useZuoraSubmit({ onCheckout, onCheckoutCompleted });\n const hasRenderedRef = useRef(false);\n const [paymentFormLoading, setPaymentFormLoading] = React.useState(false);\n\n const currency = checkoutState?.plan?.pricePoints?.[0]?.currency || Currency.Usd;\n const { publishableKey } = checkoutState?.billingIntegration.billingCredentials as ZuoraCheckoutCredentialsFragment;\n\n const handleZuoraComplete = useCallback(\n async (result: ZuoraPaymentResult) => {\n if (!result.success || !result.paymentMethodId) {\n const errorMessage = result.error?.message || 'Payment failed';\n setErrorMessage(errorMessage);\n await onCheckoutCompleted({ success: false, error: errorMessage });\n return;\n }\n\n await handleZuoraSubmit(result.paymentMethodId);\n },\n [handleZuoraSubmit, setErrorMessage, onCheckoutCompleted],\n );\n\n useEffect(() => {\n const renderZuoraForm = async () => {\n if (!isInitialized || hasRenderedRef.current) {\n return;\n }\n\n setPaymentFormLoading(true);\n setErrorMessage(undefined);\n\n try {\n hasRenderedRef.current = true;\n\n const zuora = window.Zuora(publishableKey);\n const config = createZuoraPaymentFormConfig(\n createPaymentSession,\n handleZuoraComplete,\n currency,\n billingCountryCode,\n );\n\n const paymentForm = await zuora.createPaymentForm(config);\n paymentForm.mount('#zuora_payment');\n } catch (err) {\n hasRenderedRef.current = false;\n setErrorMessage('Failed to render Zuora payment form');\n } finally {\n setPaymentFormLoading(false);\n }\n };\n\n void renderZuoraForm();\n\n return () => {\n hasRenderedRef.current = false;\n };\n // Only depend on isInitialized to prevent multiple form renders\n // createPaymentSession and handleZuoraComplete are intentionally omitted\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isInitialized]);\n\n if (!isZuoraIntegration) {\n return null;\n }\n\n return (\n <Container>\n <PaymentContainer id=\"zuora_payment\" $showLoading={widgetState.readOnly || paymentFormLoading} />\n {(widgetState.readOnly || paymentFormLoading) && (\n <LoadingOverlay>\n <LoadingContent>\n <CircularProgress size={28} />\n </LoadingContent>\n </LoadingOverlay>\n )}\n </Container>\n );\n}\n","import React from 'react';\n\nimport Collapse from '@mui/material/Collapse';\nimport Grid from '@mui/material/Grid';\nimport Radio from '@mui/material/Radio';\nimport { Customer } from '@stigg/js-client-sdk';\n\nimport { Typography } from '../../../common/Typography';\nimport {\n NewPaymentMethodContainer,\n PaymentMethodContainer,\n PaymentMethodLayoutContainer,\n PaymentMethodTextContainer,\n} from './PaymentMethods.style';\nimport { StripePaymentForm } from './stripe';\nimport { ZuoraPaymentForm } from './zuora/ZuoraPaymentForm';\nimport { useZuoraIntegration } from './zuora/useZuoraIntegration';\nimport { CheckoutLocalization } from '../../configurations/textOverrides';\nimport { CheckoutContainerProps } from '../../CheckoutContainer';\n\nexport type PaymentMethodLayoutProps = {\n checked: boolean;\n text: React.ReactNode;\n subtitle?: React.ReactNode;\n readOnly?: boolean;\n};\n\nexport type PaymentMethodProps = Pick<Customer, 'paymentMethodDetails'> &\n Pick<PaymentMethodLayoutProps, 'checked' | 'readOnly'> & { onSelect: () => void };\n\nexport type NewPaymentMethodProps = Pick<PaymentMethodLayoutProps, 'checked' | 'readOnly'> & {\n onSelect: () => void;\n checkoutLocalization: CheckoutLocalization;\n hasExistingPaymentMethod: boolean;\n} & Pick<\n CheckoutContainerProps,\n 'onBillingAddressChange' | 'collectPhoneNumber' | 'onCheckout' | 'onCheckoutCompleted'\n >;\n\nfunction PaymentMethodLayout({ checked, text, subtitle, readOnly }: PaymentMethodLayoutProps) {\n return (\n <PaymentMethodLayoutContainer>\n <Radio checked={checked} disabled={readOnly} />\n <PaymentMethodTextContainer container>\n <Grid item>{text}</Grid>\n {subtitle && <Grid item>{subtitle}</Grid>}\n </PaymentMethodTextContainer>\n </PaymentMethodLayoutContainer>\n );\n}\n\nexport function ExistingPaymentMethod({ checked, paymentMethodDetails, readOnly, onSelect }: PaymentMethodProps) {\n if (!paymentMethodDetails) {\n return null;\n }\n const { last4Digits, expirationMonth, expirationYear } = paymentMethodDetails;\n\n return (\n <PaymentMethodContainer item onClick={onSelect} $disabled={readOnly}>\n <PaymentMethodLayout\n checked={checked}\n readOnly={readOnly}\n text={<Typography variant=\"h6\">{`Card ending in ${last4Digits}`}</Typography>}\n subtitle={\n !!expirationMonth &&\n !!expirationYear && (\n <Typography variant=\"body1\">{`Expires ${expirationMonth\n .toString()\n .padStart(2, '0')}/${expirationYear}`}</Typography>\n )\n }\n />\n </PaymentMethodContainer>\n );\n}\n\nexport function NewPaymentMethod({\n hasExistingPaymentMethod,\n checked,\n onSelect,\n readOnly,\n checkoutLocalization,\n onBillingAddressChange,\n collectPhoneNumber,\n onCheckout,\n onCheckoutCompleted,\n}: NewPaymentMethodProps) {\n const { isZuoraIntegration } = useZuoraIntegration();\n\n return (\n <NewPaymentMethodContainer item $hideBorders={!hasExistingPaymentMethod} onClick={onSelect} $disabled={readOnly}>\n {hasExistingPaymentMethod && (\n <PaymentMethodLayout\n checked={checked}\n readOnly={readOnly}\n text={<Typography variant=\"h6\">{checkoutLocalization.newPaymentMethodText}</Typography>}\n />\n )}\n <Collapse in={checked}>\n {isZuoraIntegration ? (\n <ZuoraPaymentForm onCheckout={onCheckout} onCheckoutCompleted={onCheckoutCompleted} />\n ) : (\n <StripePaymentForm onBillingAddressChange={onBillingAddressChange} collectPhoneNumber={collectPhoneNumber} />\n )}\n </Collapse>\n </NewPaymentMethodContainer>\n );\n}\n","import React from 'react';\nimport styled from '@emotion/styled';\nimport Alert from '@mui/material/Alert';\nimport Grid from '@mui/material/Grid';\nimport { useCheckoutModel, usePaymentStepModel } from '../../hooks';\nimport { ExistingPaymentMethod, NewPaymentMethod } from './PaymentMethods';\nimport { Typography } from '../../../common/Typography';\nimport { CheckoutContainerProps } from '../../CheckoutContainer';\n\nconst PaymentContainer = styled(Grid)`\n display: flex;\n flex-direction: column;\n gap: 24px;\n`;\n\nexport function PaymentStep({\n onBillingAddressChange,\n collectPhoneNumber,\n onCheckout,\n onCheckoutCompleted,\n}: Pick<\n CheckoutContainerProps,\n 'onBillingAddressChange' | 'collectPhoneNumber' | 'onCheckout' | 'onCheckoutCompleted'\n>) {\n const { checkoutState, checkoutLocalization, widgetState } = useCheckoutModel();\n const { customer } = checkoutState || {};\n const { errorMessage, useNewPaymentMethod, setUseNewPaymentMethod } = usePaymentStepModel();\n const { readOnly } = widgetState;\n\n const handleOnSelect = (openNewPaymentMethod: boolean) => {\n if (readOnly) {\n return;\n }\n\n setUseNewPaymentMethod(openNewPaymentMethod);\n };\n\n return (\n <PaymentContainer container>\n {!!errorMessage && (\n <Alert severity=\"error\" sx={{ alignItems: 'center' }}>\n <Typography overrideColor=\"inherit\">{errorMessage}</Typography>\n </Alert>\n )}\n <ExistingPaymentMethod\n readOnly={readOnly}\n checked={!useNewPaymentMethod}\n paymentMethodDetails={customer?.paymentMethodDetails}\n onSelect={() => handleOnSelect(false)}\n />\n <NewPaymentMethod\n hasExistingPaymentMethod={!!customer?.paymentMethodDetails}\n readOnly={readOnly}\n checked={useNewPaymentMethod}\n checkoutLocalization={checkoutLocalization}\n onSelect={() => handleOnSelect(true)}\n onBillingAddressChange={onBillingAddressChange}\n collectPhoneNumber={collectPhoneNumber}\n onCheckout={onCheckout}\n onCheckoutCompleted={onCheckoutCompleted}\n />\n </PaymentContainer>\n );\n}\n","import React from 'react';\nimport Button, { ButtonProps } from '@mui/material/Button';\nimport { Typography } from '../../common/Typography';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\n\nexport const ChangePlanButton = ({\n onClick,\n checkoutLocalization,\n size,\n}: {\n onClick: () => void;\n checkoutLocalization: CheckoutLocalization;\n size: ButtonProps['size'];\n}) => {\n return (\n <Button\n className=\"stigg-checkout-change-plan-button\"\n sx={{ textTransform: 'none' }}\n variant=\"text\"\n size={size}\n onClick={onClick}>\n <Typography\n className=\"stigg-checkout-change-plan-button-text\"\n color=\"primary.main\"\n variant=\"h3\"\n style={{ lineHeight: '24px' }}>\n {checkoutLocalization.changePlan}\n </Typography>\n </Button>\n );\n};\n","import React from 'react';\n\nimport Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\n\nimport { Typography } from '../../common/Typography';\nimport { useCheckoutModel } from '../hooks/useCheckoutModel';\nimport { CheckoutContainerProps } from '../CheckoutContainer';\nimport { ChangePlanButton } from '../components/ChangePlanButton';\n\ntype PlanHeaderProps = {\n allowChangePlan?: boolean;\n} & Pick<CheckoutContainerProps, 'onChangePlan'>;\n\nexport function PlanHeader({ allowChangePlan = false, onChangePlan }: PlanHeaderProps) {\n const { checkoutState, checkoutLocalization } = useCheckoutModel();\n const { plan } = checkoutState || {};\n\n return (\n <>\n <Box sx={{ marginBottom: '16px' }}>\n <Typography variant=\"body1\" color=\"disabled\" style={{ opacity: 0.6, marginBottom: '8px' }}>\n Selected plan\n </Typography>\n\n <Box sx={{ display: 'flex', justifyContent: 'space-between' }}>\n <Typography variant=\"h1\">{plan?.displayName}</Typography>\n\n {allowChangePlan && onChangePlan && (\n <ChangePlanButton\n onClick={() => {\n onChangePlan({ currentPlan: plan });\n }}\n checkoutLocalization={checkoutLocalization}\n size=\"medium\"\n />\n )}\n </Box>\n </Box>\n <Divider className=\"stigg-checkout-plan-header-divider\" />\n </>\n );\n}\n","import { BillingPeriod } from '@stigg/js-client-sdk';\n\nexport function formatBillingPeriod(billingPeriod: BillingPeriod) {\n switch (billingPeriod) {\n case BillingPeriod.Annually:\n return 'Annual';\n case BillingPeriod.Monthly:\n return 'Monthly';\n default:\n return '';\n }\n}\n","import styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport Chip from '@mui/material/Chip';\nimport Color from 'color';\n\nexport const BillingPeriodPickerContainer = styled(Box)`\n margin: 16px 0;\n`;\n\nexport const BillingPeriodButton = styled.button<{\n $isActive?: boolean;\n $disabled?: boolean;\n $isOnlyBillingPeriod?: boolean;\n}>`\n cursor: ${({ $disabled, $isOnlyBillingPeriod }) =>\n $disabled ? 'default' : $isOnlyBillingPeriod ? 'default' : 'pointer'};\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 2px 8px;\n border-radius: 10px;\n border: ${({ theme, $isActive, $isOnlyBillingPeriod }) => {\n let borderColor = theme.stigg.palette.outlinedBorder;\n if ($isOnlyBillingPeriod) {\n borderColor = 'transparent';\n } else if ($isActive) {\n borderColor = theme.stigg.palette.outlinedRestingBorder;\n }\n return `1px solid ${borderColor}`;\n }};\n background: ${({ theme, $isActive, $isOnlyBillingPeriod }) => {\n if ($isOnlyBillingPeriod) {\n return 'transparent';\n }\n if ($isActive) {\n return Color(theme.stigg.palette.primary).alpha(0.15).toString();\n }\n return 'transparent';\n }};\n text-transform: none;\n text-align: start;\n height: 36px;\n\n &.MuiButton-root {\n padding: 0 16px 0 8px;\n &:hover {\n background: none;\n }\n }\n`;\n\nexport const BillingPeriodOptions = styled(Box)`\n display: flex;\n gap: 16px;\n margin-top: 16px;\n`;\n\nexport const BillingPeriodPrice = styled.div`\n display: flex;\n align-items: baseline;\n gap: 8px;\n`;\n\nexport const DiscountChip = styled(Chip)`\n & .MuiChip-label {\n font-size: 12px;\n }\n`;\n","import { partition } from 'lodash';\nimport React from 'react';\nimport { FontWeight } from 'styled-typography';\n\nimport Box from '@mui/material/Box';\nimport Radio from '@mui/material/Radio';\nimport { BillingPeriod, Plan } from '@stigg/js-client-sdk';\n\nimport { Typography } from '../../../common/Typography';\nimport { formatBillingPeriod } from '../../formatting';\nimport { usePlanStepModel } from '../../hooks/usePlanStepModel';\nimport { BillingPeriodButton, BillingPeriodOptions, BillingPeriodPickerContainer } from './BillingPeriodPicker.style';\nimport { CheckoutLocalization } from '../../configurations/textOverrides';\n\nconst BillingPeriodOption = ({\n billingPeriod,\n isOnlyBillingPeriod,\n}: {\n billingPeriod: BillingPeriod;\n isOnlyBillingPeriod: boolean;\n}) => {\n const { billingPeriod: selectedBillingPeriod, setBillingPeriod } = usePlanStepModel();\n const isActive = selectedBillingPeriod === billingPeriod;\n\n return (\n <BillingPeriodButton\n onClick={() => setBillingPeriod(billingPeriod)}\n $isActive={isActive}\n $isOnlyBillingPeriod={isOnlyBillingPeriod}>\n <Radio\n checked={isActive}\n onChange={() => setBillingPeriod(billingPeriod)}\n value={billingPeriod}\n disabled={isOnlyBillingPeriod}\n inputProps={{ 'aria-label': formatBillingPeriod(billingPeriod) }}\n sx={{ padding: 0, marginRight: '8px' }}\n />\n\n <Box>\n <Typography variant=\"h3\" color=\"primary\">\n {formatBillingPeriod(billingPeriod)}\n </Typography>\n </Box>\n </BillingPeriodButton>\n );\n};\n\ntype BillingPeriodPickerProps = {\n plan?: Plan;\n checkoutLocalization: CheckoutLocalization;\n};\n\nexport function BillingPeriodPicker({ plan, checkoutLocalization }: BillingPeriodPickerProps) {\n const [monthlyPrices, annualPrices] = partition(\n plan?.pricePoints,\n (price) => price.billingPeriod === BillingPeriod.Monthly,\n );\n\n const hasBothBillingPeriods = !!monthlyPrices?.length && !!annualPrices?.length;\n if (!hasBothBillingPeriods) {\n return null;\n }\n\n return (\n <BillingPeriodPickerContainer>\n <Typography variant=\"h6\" color=\"primary\" fontWeight={FontWeight.Medium}>\n {checkoutLocalization.billingPeriodsTitle}\n </Typography>\n\n <BillingPeriodOptions>\n {!!monthlyPrices?.length && (\n <BillingPeriodOption\n key={BillingPeriod.Monthly}\n billingPeriod={BillingPeriod.Monthly}\n isOnlyBillingPeriod={!hasBothBillingPeriods}\n />\n )}\n {!!annualPrices?.length && (\n <BillingPeriodOption\n key={BillingPeriod.Annually}\n billingPeriod={BillingPeriod.Annually}\n isOnlyBillingPeriod={!hasBothBillingPeriods}\n />\n )}\n </BillingPeriodOptions>\n </BillingPeriodPickerContainer>\n );\n}\n","import React, { useEffect, useState } from 'react';\n\nimport styled from '@emotion/styled';\nimport Box from '@mui/material/Box';\nimport { BillableFeatureInput } from '@stigg/api-client-js/src/generated/sdk';\nimport { BillingModel, BillingPeriod, Plan, Price } from '@stigg/js-client-sdk';\n\nimport { Typography } from '../../../common/Typography';\nimport { useChargesSort } from '../../../hooks/useChargeSort';\nimport { calculateUnitQuantityText } from '../../../paywall/utils/calculateUnitQuantityText';\nimport { currencyPriceFormatter } from '../../../utils/currencyUtils';\nimport { InputField } from '../../components';\nimport { useCheckoutModel, usePlanStepModel, useProgressBarModel } from '../../hooks';\nimport { TiersSelectContainer } from '../../../common/TiersSelectContainer';\nimport { getValidPriceQuantity } from '../../../utils/priceUtils';\nimport { getFeatureDisplayNameText } from '../../../utils/getFeatureName';\nimport { ON_WHEEL_BLUR } from '../../../utils/onWheelBlur';\nimport { mq } from '../../../common/mediaQuery';\nimport { useIsScreenWiderThan } from '../../../hooks/useIsScreenWiderThan';\n\nexport type UsePlanStepModel = ReturnType<typeof usePlanStepModel>;\n\ntype CheckoutChargeListProps = {\n plan?: Plan;\n billingPeriod: BillingPeriod;\n};\n\nconst StyledPlanCharge = styled.div`\n display: flex;\n min-height: 60px;\n margin-top: 16px;\n flex-direction: column;\n\n ${mq.md} {\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n`;\n\nconst getValidationText = (charge: Price, quantity?: number) => {\n const { minUnitQuantity, maxUnitQuantity } = charge;\n if (!quantity || quantity < (minUnitQuantity || 1)) {\n return `Minimum ${minUnitQuantity || 1}`;\n }\n\n if (maxUnitQuantity && quantity > maxUnitQuantity) {\n return `Maximum ${maxUnitQuantity}`;\n }\n\n return '';\n};\n\nexport function PlanCharge({\n charge,\n isValid,\n setBillableFeature,\n billableFeature,\n onValidationChange,\n}: {\n charge: Price;\n isValid: boolean;\n billableFeature?: BillableFeatureInput;\n setBillableFeature: UsePlanStepModel['setBillableFeature'];\n onValidationChange: ({ featureId, isValid }: { featureId: string; isValid: boolean }) => void;\n}) {\n const isScreenWiderThanMd = useIsScreenWiderThan('md');\n const featureId = charge.feature?.featureId;\n const isBaseCharge = !featureId;\n const isPayAsYouGo = charge.pricingModel === BillingModel.UsageBased;\n const displayName = isBaseCharge\n ? 'Base charge'\n : getFeatureDisplayNameText(charge.feature?.displayName || '', charge.feature?.units, charge.feature?.unitsPlural);\n const hasQuantityRestrictions = !!(charge?.minUnitQuantity || charge?.maxUnitQuantity);\n\n const handleQuantityChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n if (isBaseCharge || !featureId) return;\n\n const { minUnitQuantity, maxUnitQuantity } = charge;\n const value = event?.target?.value ? Number(event?.target?.value) : null;\n if (\n !value ||\n value <= 0 ||\n (minUnitQuantity && value < minUnitQuantity) ||\n (maxUnitQuantity && value > maxUnitQuantity)\n ) {\n onValidationChange({ featureId, isValid: false });\n // Reset the input value to null\n // @ts-ignore\n setBillableFeature(featureId, value ?? null);\n return;\n }\n\n onValidationChange({ featureId, isValid: true });\n const quantity = getValidPriceQuantity(charge, value);\n setBillableFeature(featureId, quantity);\n };\n\n let chargeRow;\n\n if (isBaseCharge || isPayAsYouGo) {\n const formattedAmount = currencyPriceFormatter({\n amount: charge.amount!,\n currency: charge.currency,\n locale: 'en-us',\n minimumFractionDigits: 2,\n });\n\n chargeRow = `${formattedAmount}`;\n if (isPayAsYouGo) {\n chargeRow += ' / unit';\n }\n } else if (charge.isTieredPrice && charge.tiersMode && featureId) {\n const quantity = billableFeature?.quantity || 1;\n chargeRow = (\n <TiersSelectContainer\n componentId={`${featureId}-tiers`}\n tiers={charge.tiers}\n tiersMode={charge.tiersMode}\n value={quantity}\n handleChange={(quantity: number) => {\n setBillableFeature(featureId, quantity);\n }}\n width={120}\n />\n );\n } else {\n chargeRow = (\n <InputField\n sx={{ width: isScreenWiderThanMd ? 120 : '100%' }}\n id={`${featureId}-input`}\n type=\"number\"\n onWheel={ON_WHEEL_BLUR}\n error={!isValid}\n helperText={!isValid ? getValidationText(charge, billableFeature?.quantity) : undefined}\n FormHelperTextProps={{ sx: { margin: '4px' } }}\n value={billableFeature?.quantity ?? ''}\n onChange={handleQuantityChange}\n />\n );\n }\n\n return (\n <StyledPlanCharge>\n <Box display=\"flex\" flexDirection=\"column\">\n <Typography variant=\"h6\" color=\"primary\" lineHeight=\"24px\">\n {displayName}\n </Typography>\n {hasQuantityRestrictions && (\n <Typography variant=\"body1\" color=\"secondary\" lineHeight=\"20px\">\n {calculateUnitQuantityText(charge.minUnitQuantity, charge.maxUnitQuantity, charge.feature?.unitsPlural)}\n </Typography>\n )}\n </Box>\n\n <Typography variant=\"h6\" color=\"primary\">\n {chargeRow}\n </Typography>\n </StyledPlanCharge>\n );\n}\n\nexport function CheckoutChargeList({ plan, billingPeriod }: CheckoutChargeListProps) {\n const { billableFeatures, setBillableFeature } = usePlanStepModel();\n const { setIsDisabled } = useProgressBarModel();\n const { setIsValid } = useCheckoutModel();\n const planCharges = useChargesSort(plan?.pricePoints?.filter((p) => p.billingPeriod === billingPeriod) || []);\n const [chargesValidation, setChargesValidation] = useState(\n planCharges?.reduce<Record<string, boolean>>((acc, curr) => {\n acc[curr.feature?.featureId || 'base-charge'] = true;\n return acc;\n }, {}),\n );\n\n useEffect(() => {\n const isDisabled = Object.values(chargesValidation).some((x) => !x);\n setIsDisabled(isDisabled);\n setIsValid(!isDisabled);\n }, [chargesValidation, setIsDisabled, setIsValid]);\n\n return (\n <>\n {planCharges?.map((charge) => {\n const billableFeature = billableFeatures.find((x) => x.featureId === charge.feature?.featureId);\n return (\n <PlanCharge\n key={charge.feature?.featureId || 'base-charge'}\n charge={charge}\n setBillableFeature={setBillableFeature}\n billableFeature={billableFeature}\n isValid={chargesValidation[charge.feature?.featureId || 'base-charge']}\n onValidationChange={({ featureId, isValid }: { featureId: string; isValid: boolean }) =>\n setChargesValidation((prev) => ({ ...prev, [featureId]: isValid }))\n }\n />\n );\n })}\n </>\n );\n}\n","<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g id=\"arrow-right\">\n<path id=\"Shape\" d=\"M2.66699 8H13.3337\" stroke=\"#7586B0\" stroke-width=\"1.33333\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path id=\"Shape_2\" d=\"M9.33301 4L13.333 8L9.33301 12\" stroke=\"#7586B0\" stroke-width=\"1.33333\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</g>\n</svg>\n","import styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\n\nexport const CheckoutPlanContainer = styled(Box)`\n width: 100%;\n`;\n","import React from 'react';\nimport { CheckoutContainerProps } from '../../CheckoutContainer';\n\nimport { useCheckoutModel } from '../../hooks/useCheckoutModel';\nimport { usePlanStepModel } from '../../hooks/usePlanStepModel';\nimport { PlanHeader } from '../../planHeader';\nimport { BillingPeriodPicker } from './BillingPeriodPicker';\nimport { CheckoutChargeList } from './CheckoutChargeList';\nimport { CheckoutPlanContainer } from './CheckoutPlanStep.style';\n\nexport const CheckoutPlanStep = ({ onChangePlan }: Pick<CheckoutContainerProps, 'onChangePlan'>) => {\n const { checkoutState, checkoutLocalization } = useCheckoutModel();\n const { plan } = checkoutState || {};\n const { billingPeriod } = usePlanStepModel();\n\n return (\n <>\n <PlanHeader allowChangePlan onChangePlan={onChangePlan} />\n <CheckoutPlanContainer>\n <BillingPeriodPicker plan={plan} checkoutLocalization={checkoutLocalization} />\n <CheckoutChargeList plan={plan} billingPeriod={billingPeriod} />\n </CheckoutPlanContainer>\n </>\n );\n};\n","import styled from '@emotion/styled/macro';\n\nimport ArrowRightIcon from '../../../assets/arrow-right.svg';\n\nexport const StyledArrowRightIcon = styled(ArrowRightIcon)`\n path {\n stroke: ${({ theme }) => theme.stigg.palette.text.secondary};\n }\n`;\n","import React from 'react';\nimport styled from '@emotion/styled/macro';\nimport Box from '@mui/material/Box';\nimport Alert from '@mui/material/Alert';\nimport { CheckoutStatePlan, Subscription } from '@stigg/js-client-sdk';\nimport { StyledArrowRightIcon } from './StyledArrow';\nimport { Typography } from '../../common/Typography';\nimport { CheckoutLocalization } from '../configurations/textOverrides';\nimport { CheckoutContainerProps } from '../CheckoutContainer';\nimport { ChangePlanButton } from './ChangePlanButton';\n\nconst DowngradeToFreePlansContainer = styled(Box)`\n display: flex;\n`;\n\nconst DowngradeToFreeAlert = styled(Alert)`\n margin-bottom: 16px;\n`;\n\nexport const DowngradeToFreePlanBox = styled(Box)`\n padding: 16px;\n border-radius: 10px;\n width: 100%;\n border: ${({ theme }) => `1px solid ${theme.stigg.palette.outlinedBorder}`};\n`;\n\nexport const DowngradeToFreeContent = ({\n headerText,\n planName,\n priceText,\n}: {\n headerText: string;\n planName: string;\n priceText: string;\n}) => {\n return (\n <DowngradeToFreePlanBox className=\"stigg-checkout-downgrade-to-free-container\">\n <Typography\n className=\"stigg-checkout-downgrade-to-free-text-header\"\n style={{ opacity: 0.8 }}\n variant=\"caption\"\n color=\"disabled\">\n {headerText}\n </Typography>\n <Typography className=\"stigg-checkout-downgrade-to-free-plan-name\" bold variant=\"h3\" color=\"primary\">\n {planName}\n </Typography>\n <Typography className=\"stigg-checkout-downgrade-to-free-price-text\" color=\"secondary\">\n {priceText}\n </Typography>\n </DowngradeToFreePlanBox>\n );\n};\n\ntype DowngradeToFreePlanProps = {\n checkoutLocalization: CheckoutLocalization;\n activeSubscription: Subscription;\n freePlan: CheckoutStatePlan;\n allowChangePlan?: boolean;\n} & Pick<CheckoutContainerProps, 'onChangePlan'>;\n\nexport const DowngradeToFreePlan = ({\n checkoutLocalization,\n activeSubscription,\n freePlan,\n allowChangePlan = false,\n onChangePlan,\n}: DowngradeToFreePlanProps) => {\n let alertAction;\n if (allowChangePlan && onChangePlan) {\n alertAction = (\n <ChangePlanButton\n onClick={() => {\n onChangePlan({ currentPlan: freePlan });\n }}\n checkoutLocalization={checkoutLocalization}\n size=\"small\"\n />\n );\n }\n\n const paidBillingPeriod =\n activeSubscription.prices.length > 0 ? activeSubscription.prices[0].billingPeriod : undefined;\n\n return (\n <>\n <DowngradeToFreeAlert action={alertAction} className=\"stigg-checkout-downgrade-to-free-alert\" severity=\"info\">\n <Typography span color=\"secondary\">\n {checkoutLocalization.downgradeToFree.alertText({ plan: activeSubscription.plan })}\n </Typography>\n </DowngradeToFreeAlert>\n\n <DowngradeToFreePlansContainer className=\"stigg-checkout-downgrade-to-free-plans-container\">\n <DowngradeToFreeContent\n headerText={checkoutLocalization.downgradeToFree.paidPlanHeader({ plan: activeSubscription.plan })}\n planName={checkoutLocalization.downgradeToFree.paidPlanName({ plan: activeSubscription.plan })}\n priceText={checkoutLocalization.downgradeToFree.paidPlanPriceText({\n plan: activeSubscription.plan,\n billingPeriod: paidBillingPeriod,\n })}\n />\n\n <StyledArrowRightIcon\n className=\"stigg-checkout-downgrade-to-free-arrow\"\n style={{ margin: 'auto 16px', minWidth: '16px' }}\n />\n\n <DowngradeToFreeContent\n headerText={checkoutLocalization.downgradeToFree.freePlanHeader({ plan: freePlan })}\n planName={checkoutLocalization.downgradeToFree.freePlanName({ plan: freePlan })}\n priceText={checkoutLocalization.downgradeToFree.freePlanPriceText({ plan: freePlan })}\n />\n </DowngradeToFreePlansContainer>\n </>\n );\n};\n","import React, { useMemo } from 'react';\nimport { Elements } from '@stripe/react-stripe-js';\nimport {\n PricingType,\n BillingAddress,\n ApplySubscription,\n CheckoutStatePlan,\n ApplySubscriptionResults,\n} from '@stigg/js-client-sdk';\nimport { CheckoutContent, CheckoutLayout, CheckoutPanel } from './CheckoutContainer.style';\nimport { CheckoutProgressBar } from './progressBar/CheckoutProgressBar';\nimport { CheckoutSummary, CheckoutSummarySkeleton } from './summary';\nimport { CheckoutStep, CheckoutStepKey, useCheckoutModel, useProgressBarModel } from './hooks';\nimport { CheckoutAddonsStep } from './steps/addons';\nimport { PaymentStep } from './steps/payment';\nimport { useStripeIntegration } from './steps/payment/stripe';\nimport { CheckoutPlanStep } from './steps/plan';\nimport { useCheckoutContext } from './CheckoutProvider';\nimport { ContentLoadingSkeleton } from './components';\nimport { DowngradeToFreePlan } from './components/DowngradeToFreeContainer';\nimport { MockCheckoutPreviewCallback } from './types';\n\ntype StepProps = {\n content: React.ReactNode;\n};\n\ntype StripeClientSecret = { clientSecret: string };\ntype StripeManualMode = { mode: 'setup' | 'payment' | 'subscription'; currency: string };\n\nconst getStepProps = (\n currentStep: CheckoutStep,\n {\n onBillingAddressChange,\n onChangePlan,\n collectPhoneNumber,\n onCheckout,\n onCheckoutCompleted,\n }: Pick<\n CheckoutContainerProps,\n 'onBillingAddressChange' | 'onChangePlan' | 'collectPhoneNumber' | 'onCheckout' | 'onCheckoutCompleted'\n >,\n): StepProps => {\n switch (currentStep.key) {\n case CheckoutStepKey.PLAN:\n return { content: <CheckoutPlanStep onChangePlan={onChangePlan} /> };\n case CheckoutStepKey.ADDONS:\n return { content: <CheckoutAddonsStep /> };\n case CheckoutStepKey.PAYMENT:\n return {\n content: (\n <PaymentStep\n onBillingAddressChange={onBillingAddressChange}\n collectPhoneNumber={collectPhoneNumber}\n onCheckout={onCheckout}\n onCheckoutCompleted={onCheckoutCompleted}\n />\n ),\n };\n default:\n return { content: null };\n }\n};\n\nexport type CheckoutResult = { success: boolean; errorMessage?: string; results?: ApplySubscriptionResults };\n\nexport type OnCheckoutParams = {\n customerId: string;\n checkoutParams: ApplySubscription;\n checkoutAction: (params: ApplySubscription) => Promise<CheckoutResult>;\n};\n\nexport type OnCheckoutCompletedParams = { success: boolean; error?: string };\n\nexport type CheckoutContainerProps = {\n onCheckout?: (params: OnCheckoutParams) => Promise<CheckoutResult>;\n onCheckoutCompleted: (params: OnCheckoutCompletedParams) => Promise<void>;\n onChangePlan?: (params: { currentPlan: CheckoutStatePlan | undefined }) => void;\n onBillingAddressChange?: (params: { billingAddress: BillingAddress }) => Promise<void>;\n disablePromotionCode?: boolean;\n disableSuccessAnimation?: boolean;\n collectPhoneNumber?: boolean;\n onMockCheckoutPreview?: MockCheckoutPreviewCallback;\n};\n\nexport function CheckoutContainer({\n onCheckout,\n onCheckoutCompleted,\n onChangePlan,\n onBillingAddressChange,\n collectPhoneNumber,\n disablePromotionCode,\n disableSuccessAnimation,\n onMockCheckoutPreview,\n}: CheckoutContainerProps) {\n const { stripePromise, setupIntentClientSecret } = useStripeIntegration();\n const [{ stiggTheme, widgetState, theme, isWidgetWatermarkEnabled }] = useCheckoutContext();\n const { currentStep } = useProgressBarModel();\n\n const { isLoadingCheckoutData } = widgetState;\n\n const { checkoutState, checkoutLocalization } = useCheckoutModel();\n const { plan, activeSubscription } = checkoutState || {};\n const isFreeDowngrade =\n !!plan &&\n plan.pricingType === PricingType.Free &&\n !!activeSubscription &&\n activeSubscription.pricingType !== PricingType.Free;\n\n const { content } = getStepProps(currentStep, {\n onBillingAddressChange,\n onChangePlan,\n collectPhoneNumber,\n onCheckout,\n onCheckoutCompleted,\n });\n\n const checkoutContent = (\n <>\n {isFreeDowngrade ? (\n <DowngradeToFreePlan\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n freePlan={plan!}\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n activeSubscription={activeSubscription!}\n allowChangePlan\n checkoutLocalization={checkoutLocalization}\n onChangePlan={onChangePlan}\n />\n ) : (\n <>{content}</>\n )}\n </>\n );\n\n const stripeElementsMode: StripeClientSecret | StripeManualMode = useMemo(\n () => (setupIntentClientSecret ? { clientSecret: setupIntentClientSecret } : { mode: 'setup', currency: 'usd' }),\n [setupIntentClientSecret],\n );\n\n return (\n <Elements\n key={setupIntentClientSecret}\n stripe={stripePromise}\n options={{\n ...stripeElementsMode,\n appearance: {\n theme: 'stripe',\n variables: {\n colorText: stiggTheme.palette.text.primary,\n colorPrimaryText: stiggTheme.palette.text.primary,\n colorTextPlaceholder: stiggTheme.palette.text.disabled,\n fontFamily: stiggTheme.typography.fontFamily,\n colorBackground: theme?.paymentInputBackgroundColor,\n borderRadius: theme?.paymentInputBorderRadius,\n },\n rules: theme?.paymentInputBorderColor\n ? {\n '.Input': {\n borderColor: theme?.paymentInputBorderColor,\n },\n }\n : undefined,\n },\n }}>\n <CheckoutLayout className=\"stigg-checkout-layout\">\n {!isFreeDowngrade && <CheckoutProgressBar />}\n <CheckoutContent>\n <CheckoutPanel>{isLoadingCheckoutData ? <ContentLoadingSkeleton /> : checkoutContent}</CheckoutPanel>\n {isLoadingCheckoutData ? (\n <CheckoutSummarySkeleton isWidgetWatermarkEnabled={isWidgetWatermarkEnabled} />\n ) : (\n <CheckoutSummary\n disablePromotionCode={disablePromotionCode}\n disableSuccessAnimation={disableSuccessAnimation}\n onCheckout={onCheckout}\n onCheckoutCompleted={onCheckoutCompleted}\n isFreeDowngrade={isFreeDowngrade}\n onMockCheckoutPreview={onMockCheckoutPreview}\n isWidgetWatermarkEnabled={isWidgetWatermarkEnabled}\n />\n )}\n </CheckoutContent>\n </CheckoutLayout>\n </Elements>\n );\n}\n","import { useEffect, useState } from 'react';\n\nimport { BillingVendorIdentifier } from '@stigg/js-client-sdk';\nimport { loadStripe, Stripe } from '@stripe/stripe-js';\n\nimport { useCheckoutModel } from '../../../hooks';\n\nexport function useStripeIntegration() {\n const [stripePromise, setStripePromise] = useState<Promise<Stripe | null> | null>(null);\n const { checkoutState } = useCheckoutModel();\n const { billingIntegration, setupSecret } = checkoutState || {};\n\n useEffect(() => {\n if (billingIntegration) {\n const { billingIdentifier, credentials } = billingIntegration;\n if (billingIdentifier !== BillingVendorIdentifier.Stripe) {\n return;\n }\n\n const { accountId, publicKey } = credentials;\n if (!accountId || !publicKey) {\n console.error('Stripe account ID or public key is missing');\n return;\n }\n\n setStripePromise(loadStripe(publicKey, { stripeAccount: accountId }));\n }\n }, [billingIntegration]);\n\n return { stripePromise, setupIntentClientSecret: setupSecret };\n}\n","import { Subscription } from '@stigg/js-client-sdk';\nimport { useEffect, useMemo, useState } from 'react';\nimport { useStiggContext } from '../../hooks/useStiggContext';\n\nfunction useQueryParams(paramName?: string) {\n return useMemo(() => {\n const urlSearchParams = new URLSearchParams(window.location.search);\n return paramName ? urlSearchParams.get(paramName) : urlSearchParams;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [paramName, window.location.search]);\n}\n\nexport enum ProvisionStatus {\n IN_PROGRESS = 'IN_PROGRESS',\n SUCCEEDED = 'SUCCEEDED',\n FAILED = 'FAILED',\n}\n\nexport const useWaitForCheckoutCompleted = ({\n onProvisionStart,\n onProvisionSucceeded,\n onProvisionFailed,\n}: {\n onProvisionStart?: () => void;\n onProvisionSucceeded?: (subscription?: Subscription | null) => void;\n onProvisionFailed?: (err?: any) => void;\n} = {}) => {\n const { stigg } = useStiggContext();\n const [provisionStatus, setProvisionStatus] = useState(ProvisionStatus.IN_PROGRESS);\n const [isAwaitingCheckout, setIsAwaitingCheckout] = useState(false);\n const checkoutCompleted = useQueryParams('checkoutCompleted') as string;\n\n useEffect(() => {\n const waitForCheckoutToComplete = async () => {\n if (!checkoutCompleted || checkoutCompleted.toLowerCase() === 'false' || isAwaitingCheckout) {\n return;\n }\n\n setIsAwaitingCheckout(true);\n if (onProvisionStart) {\n onProvisionStart();\n }\n try {\n const subscription = await stigg.waitForCheckoutCompleted();\n setProvisionStatus(ProvisionStatus.SUCCEEDED);\n if (onProvisionSucceeded) {\n onProvisionSucceeded(subscription);\n }\n } catch (err) {\n console.error('Failed to wait for checkout to complete', err);\n setProvisionStatus(ProvisionStatus.FAILED);\n if (onProvisionFailed) {\n onProvisionFailed(err);\n }\n } finally {\n setIsAwaitingCheckout(false);\n }\n };\n\n void waitForCheckoutToComplete();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [stigg, checkoutCompleted]);\n\n return { isAwaitingCheckout, provisionStatus };\n};\n","import { BooleanEntitlement, GetBooleanEntitlement, BOOLEAN_DEFAULT_FALLBACK_ENTITLEMENT } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\n\nexport type TypedGetBooleanEntitlement<T> = Omit<GetBooleanEntitlement, 'featureId'> & {\n featureId: T;\n};\n\nexport function useBooleanEntitlement<T extends string>(params: TypedGetBooleanEntitlement<T>): BooleanEntitlement {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n if (!stigg) {\n return {\n ...BOOLEAN_DEFAULT_FALLBACK_ENTITLEMENT,\n ...params.options?.fallback,\n };\n }\n\n return stigg.getBooleanEntitlement(params);\n}\n","import { NumericEntitlement, GetNumericEntitlement, NUMERIC_DEFAULT_FALLBACK_ENTITLEMENT } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\n\ntype TypedGetNumericEntitlement<T> = Omit<GetNumericEntitlement, 'featureId'> & {\n featureId: T;\n};\n\nexport function useNumericEntitlement<T extends string>(params: TypedGetNumericEntitlement<T>): NumericEntitlement {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n if (!stigg) {\n return {\n ...NUMERIC_DEFAULT_FALLBACK_ENTITLEMENT,\n ...params.options?.fallback,\n };\n }\n\n return stigg.getNumericEntitlement(params);\n}\n","import { GetMeteredEntitlement, METERED_DEFAULT_FALLBACK_ENTITLEMENT, MeteredEntitlement } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\n\ntype TypedGetMeteredEntitlement<T> = Omit<GetMeteredEntitlement, 'featureId'> & {\n featureId: T;\n};\n\nexport function useMeteredEntitlement<T extends string>(params: TypedGetMeteredEntitlement<T>): MeteredEntitlement {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n if (!stigg) {\n return {\n ...METERED_DEFAULT_FALLBACK_ENTITLEMENT,\n ...params.options?.fallback,\n };\n }\n\n return stigg.getMeteredEntitlement(params);\n}\n","import { GetEnumEntitlement, ENUM_DEFAULT_FALLBACK_ENTITLEMENT, EnumEntitlement } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\n\ntype TypedGetEnumEntitlement<T> = Omit<GetEnumEntitlement, 'featureId'> & {\n featureId: T;\n};\n\nexport function useEnumEntitlement<T extends string>(params: TypedGetEnumEntitlement<T>): EnumEntitlement {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n if (!stigg) {\n return {\n ...ENUM_DEFAULT_FALLBACK_ENTITLEMENT,\n ...params.options?.fallback,\n };\n }\n\n return stigg.getEnumEntitlement(params);\n}\n","import { useEffect, useState } from 'react';\n\nexport type FetchResult<T> = {\n isLoaded: boolean;\n error: Error | null;\n data: T | null;\n};\n\nexport function useFetch<T>({ func }: { func: () => Promise<T> }): FetchResult<T> {\n const [isLoaded, setIsLoaded] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [data, setData] = useState<T | null>(null);\n\n useEffect(() => {\n const fetchData = async () => {\n setIsLoaded(true);\n try {\n const result = await func();\n setData(result);\n } catch (error) {\n setError(error as Error);\n } finally {\n setIsLoaded(false);\n }\n };\n\n void fetchData();\n }, [func]);\n\n return { isLoaded, error, data };\n}\n","import React from 'react';\nimport { GetBooleanEntitlement } from '@stigg/js-client-sdk';\nimport { useBooleanEntitlement } from '../hooks';\n\ntype BooleanEntitlementGuardProps = GetBooleanEntitlement & {\n noAccessComponent?: React.ReactNode;\n children: React.ReactElement;\n};\n\nexport function BooleanEntitlementGuard({\n noAccessComponent,\n children,\n ...rest\n}: BooleanEntitlementGuardProps): JSX.Element {\n const { hasAccess } = useBooleanEntitlement(rest);\n\n if (!hasAccess) {\n return <>{noAccessComponent ?? null}</>;\n }\n\n return children;\n}\n","import React from 'react';\nimport { CheckoutProvider, CheckoutProviderProps } from './CheckoutProvider';\nimport { CheckoutContainer, CheckoutContainerProps } from './CheckoutContainer';\nimport { CheckoutMockProps } from './types';\n\nexport type CheckoutProps = CheckoutProviderProps & CheckoutContainerProps & CheckoutMockProps;\n\nexport const Checkout = ({\n textOverrides,\n theme,\n resourceId,\n planId,\n preferredBillingPeriod,\n billingCountryCode,\n billableFeatures,\n billingInformation,\n onMockCheckoutState,\n skipCheckoutSteps,\n ...containerProps\n}: CheckoutProps) => {\n return (\n <CheckoutProvider\n textOverrides={textOverrides}\n theme={theme}\n resourceId={resourceId}\n planId={planId}\n preferredBillingPeriod={preferredBillingPeriod}\n billingCountryCode={billingCountryCode}\n billableFeatures={billableFeatures}\n billingInformation={billingInformation}\n onMockCheckoutState={onMockCheckoutState}\n skipCheckoutSteps={skipCheckoutSteps}>\n <CheckoutContainer {...containerProps} />\n </CheckoutProvider>\n );\n};\n","import React from 'react';\nimport { CustomerPortalSubscription } from '@stigg/js-client-sdk';\nimport { CustomerPortalProvider } from './CustomerPortalProvider';\nimport { CustomerPortalContainer } from './CustomerPortalContainer';\nimport { DeepPartial } from '../../types';\nimport { CustomerPortalLocalization } from './customerPortalTextOverrides';\nimport { CustomerPortalTheme } from './customerPortalTheme';\nimport { FilterEntitlementsFn, OnBuyMoreCallbackFn, OnManageSubscriptionFn } from './types';\n\nexport type CustomerPortalSection =\n | 'usage'\n | 'addons'\n | 'promotionalEntitlements'\n | 'billingInformation'\n | 'paymentDetails'\n | 'invoices';\n\nexport type CustomerPortalProps = {\n onManageSubscription?: OnManageSubscriptionFn;\n onBuyMore?: OnBuyMoreCallbackFn;\n onCancelScheduledUpdates?: (subscription: CustomerPortalSubscription) => Promise<void> | void;\n onContactSupport?: () => Promise<void> | void;\n paywallComponent?: React.ReactNode;\n hiddenSections?: CustomerPortalSection[];\n textOverrides?: DeepPartial<CustomerPortalLocalization>;\n theme?: DeepPartial<CustomerPortalTheme>;\n filterEntitlements?: FilterEntitlementsFn;\n resourceId?: string;\n productId?: string;\n};\n\nexport function CustomerPortal({ textOverrides, theme, resourceId, productId, ...restProps }: CustomerPortalProps) {\n return (\n <CustomerPortalProvider textOverrides={textOverrides} theme={theme} resourceId={resourceId} productId={productId}>\n <CustomerPortalContainer {...restProps} />\n </CustomerPortalProvider>\n );\n}\n","import React from 'react';\nimport { GetEnumEntitlement } from '@stigg/js-client-sdk';\nimport { useEnumEntitlement } from '../hooks';\n\ntype EnumEntitlementGuardProps = GetEnumEntitlement & {\n noAccessComponent?: React.ReactNode;\n children: React.ReactElement;\n};\n\nexport function EnumEntitlementGuard({ noAccessComponent, children, ...rest }: EnumEntitlementGuardProps): JSX.Element {\n const { hasAccess } = useEnumEntitlement(rest);\n\n if (!hasAccess) {\n return <>{noAccessComponent ?? null}</>;\n }\n\n return children;\n}\n","import React from 'react';\nimport { GetMeteredEntitlement } from '@stigg/js-client-sdk';\nimport { useMeteredEntitlement } from '../hooks';\n\ntype MeteredEntitlementGuardProps = GetMeteredEntitlement & {\n noAccessComponent?: React.ReactNode;\n children: React.ReactElement;\n};\n\nexport function MeteredEntitlementGuard({\n noAccessComponent,\n children,\n ...rest\n}: MeteredEntitlementGuardProps): JSX.Element {\n const { hasAccess } = useMeteredEntitlement(rest);\n\n if (!hasAccess) {\n return <>{noAccessComponent ?? null}</>;\n }\n\n return children;\n}\n","import React from 'react';\nimport { GetNumericEntitlement } from '@stigg/js-client-sdk';\nimport { useNumericEntitlement } from '../hooks';\n\ntype NumericEntitlementGuardProps = GetNumericEntitlement & {\n noAccessComponent?: React.ReactNode;\n children: React.ReactElement;\n};\n\nexport function NumericEntitlementGuard({\n noAccessComponent,\n children,\n ...rest\n}: NumericEntitlementGuardProps): JSX.Element {\n const { hasAccess } = useNumericEntitlement(rest);\n\n if (!hasAccess) {\n return <>{noAccessComponent ?? null}</>;\n }\n\n return children;\n}\n","import React from 'react';\nimport { BillingPeriod } from '@stigg/js-client-sdk';\nimport { Paywall } from './Paywall';\nimport { useLoadPaywallData } from './hooks/useLoadPaywallData';\nimport {\n ShouldHidePlanFn,\n OnPlanSelectedCallbackFn,\n SelectDefaultTierIndexFn,\n CurrentSubscriptionOverrideFn,\n} from './types';\nimport { getResolvedPaywallLocalize, PaywallLocalization } from './paywallTextOverrides';\nimport { DeepPartial } from '../../types';\nimport { PaywallLoader } from './PaywallLoader';\nimport { SdkThemeProvider } from '../../theme/Theme';\nimport {\n CustomerPortalContext,\n useCheckContextExists,\n useCustomerPortalContext,\n} from '../customerPortal/CustomerPortalProvider';\n\nexport type PaywallContainerProps = {\n productId?: string;\n resourceId?: string;\n highlightedPlanId?: string;\n showOnlyEligiblePlans?: boolean;\n onPlanSelected: OnPlanSelectedCallbackFn;\n preferredBillingPeriod?: BillingPeriod;\n onBillingPeriodChange?: (billingPeriod: BillingPeriod) => void;\n textOverrides?: DeepPartial<PaywallLocalization>;\n billingCountryCode?: string;\n shouldHidePlan?: ShouldHidePlanFn;\n selectDefaultTierIndex?: SelectDefaultTierIndexFn;\n hideCompatibleAddons?: boolean;\n // This is used to override the current subscription in case a many to one plan mapping is needed\n // Many plans mapped to one (fictive) plan\n currentSubscriptionOverride?: CurrentSubscriptionOverrideFn;\n};\n\nexport const PaywallContainer = ({\n productId,\n resourceId,\n highlightedPlanId,\n showOnlyEligiblePlans,\n textOverrides,\n onPlanSelected,\n preferredBillingPeriod,\n onBillingPeriodChange,\n billingCountryCode,\n shouldHidePlan,\n selectDefaultTierIndex,\n currentSubscriptionOverride: currentSubscriptionOverrideFn,\n hideCompatibleAddons,\n}: PaywallContainerProps) => {\n const hasCustomerPortalContext = useCheckContextExists(CustomerPortalContext);\n let isCustomerPortalLoading = false;\n if (hasCustomerPortalContext) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const { isLoading, resourceId: customerPortalResourceId } = useCustomerPortalContext();\n isCustomerPortalLoading = isLoading;\n resourceId = customerPortalResourceId;\n }\n const {\n plans,\n customer,\n currentSubscription,\n currentSubscriptionOverride,\n isCustomerOnTrial,\n isLoading,\n selectedBillingPeriod,\n setSelectedBillingPeriod,\n availableBillingPeriods,\n locale,\n configuration,\n } = useLoadPaywallData({\n productId,\n resourceId,\n showOnlyEligiblePlans,\n billingCountryCode,\n preferredBillingPeriod,\n currentSubscriptionOverrideFn,\n });\n const paywallLocale = getResolvedPaywallLocalize(textOverrides);\n const handlePeriodChange = (billingPeriod: BillingPeriod) => {\n setSelectedBillingPeriod(billingPeriod);\n if (onBillingPeriodChange) {\n onBillingPeriodChange(billingPeriod);\n }\n };\n\n const component =\n !plans || isLoading || isCustomerPortalLoading ? (\n <PaywallLoader />\n ) : (\n <Paywall\n plans={plans}\n customer={customer}\n currentSubscription={currentSubscription}\n currentSubscriptionOverride={currentSubscriptionOverride}\n selectedBillingPeriod={selectedBillingPeriod}\n onBillingPeriodChanged={handlePeriodChange}\n availableBillingPeriods={availableBillingPeriods}\n highlightedPlanId={highlightedPlanId}\n isCustomerOnTrial={isCustomerOnTrial}\n onPlanSelected={onPlanSelected}\n paywallLocale={paywallLocale}\n locale={locale}\n shouldHidePlan={shouldHidePlan}\n selectDefaultTierIndex={selectDefaultTierIndex}\n hideCompatibleAddons={hideCompatibleAddons}\n />\n );\n\n // When rendering the paywall in the customer portal context we don't want to apply paywall theme\n if (hasCustomerPortalContext) {\n return component;\n }\n return <SdkThemeProvider componentTheme={configuration}>{component}</SdkThemeProvider>;\n};\n","import { BillingPeriod, Paywall } from '@stigg/js-client-sdk';\nimport { useEffect, useState } from 'react';\nimport logger from '../../../services/logger';\nimport { CurrentSubscriptionOverrideFn, PaywallData } from '../types';\nimport { computeBillingPeriods } from '../utils/computeDefaultBillingPeriod';\nimport { mapPaywallData } from '../utils/mapPaywallData';\nimport { useStiggContext } from '../../../hooks/useStiggContext';\n\ntype UseLoadPaywallDataProps = {\n productId?: string;\n resourceId?: string;\n showOnlyEligiblePlans?: boolean;\n billingCountryCode?: string;\n preferredBillingPeriod?: BillingPeriod;\n currentSubscriptionOverrideFn?: CurrentSubscriptionOverrideFn;\n};\n\nexport function useLoadPaywallData({\n productId,\n resourceId,\n showOnlyEligiblePlans,\n billingCountryCode,\n preferredBillingPeriod,\n currentSubscriptionOverrideFn,\n}: UseLoadPaywallDataProps): PaywallData {\n const { stigg, locale } = useStiggContext();\n const [selectedBillingPeriod, setSelectedBillingPeriod] = useState(BillingPeriod.Annually);\n const [availableBillingPeriods, setAvailableBillingPeriods] = useState<BillingPeriod[]>([]);\n const [paywall, setPaywall] = useState<Paywall | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n\n useEffect(() => {\n const loadPaywall = async () => {\n try {\n setIsLoading(true);\n\n await stigg.waitForInitialization();\n const paywallResult = await stigg.getPaywall({\n productId,\n resourceId,\n billingCountryCode,\n });\n const { availableBillingPeriods, defaultBillingPeriod } = computeBillingPeriods(\n paywallResult.plans,\n paywallResult.activeSubscriptions,\n preferredBillingPeriod,\n );\n\n setPaywall(paywallResult);\n setAvailableBillingPeriods(availableBillingPeriods);\n setSelectedBillingPeriod(defaultBillingPeriod);\n } catch (err) {\n logger.error(`Failed to load paywall ${(err as any)?.message}`, err as any);\n } finally {\n setIsLoading(false);\n }\n };\n\n void loadPaywall();\n }, [stigg, productId, stigg.isCustomerLoaded, billingCountryCode, resourceId, preferredBillingPeriod]);\n\n const paywallData = mapPaywallData(paywall, showOnlyEligiblePlans, currentSubscriptionOverrideFn);\n\n return {\n customer: paywall?.customer || null,\n isLoading,\n selectedBillingPeriod,\n setSelectedBillingPeriod,\n availableBillingPeriods,\n locale,\n configuration: paywallData.paywallConfiguration,\n ...paywallData,\n };\n}\n","import {\n BillingPeriod,\n SubscriptionStatus,\n Paywall,\n Plan,\n Subscription,\n SubscriptionScheduleType,\n} from '@stigg/js-client-sdk';\nimport isNil from 'lodash/isNil';\nimport sortBy from 'lodash/sortBy';\nimport { CurrentSubscriptionOverride, CurrentSubscriptionOverrideFn, PaywallPlan } from '../types';\nimport { calculateTrialDaysLeft } from './calculateTrialDaysLeft';\nimport { BillingPeriodChangeVariables, DeepPartial, DowngradeChangeVariables } from '../../../types';\nimport { StiggTheme } from '../../../theme/types';\nimport { mapPaywallConfiguration } from '../../common/mapExternalTheme';\n\nfunction getCustomerSubscriptionDetails(activeSubscriptions?: Subscription[] | null) {\n let isCustomerOnTrial = true;\n let currentSubscription: Subscription | null =\n activeSubscriptions?.find((s) => s.status === SubscriptionStatus.InTrial) || null;\n let currentPlan = currentSubscription?.plan;\n const trialDaysLeft = currentSubscription?.trialEndDate\n ? calculateTrialDaysLeft(currentSubscription.trialEndDate)\n : undefined;\n if (!currentPlan) {\n isCustomerOnTrial = false;\n currentSubscription = activeSubscriptions?.find((s) => s.status === SubscriptionStatus.Active) || null;\n currentPlan = currentSubscription?.plan;\n }\n\n return {\n currentSubscription,\n currentPlan,\n isCustomerOnTrial,\n trialDaysLeft,\n };\n}\n\ntype PaywallData = {\n currentPlan?: Plan;\n currentSubscription: Subscription | null;\n currentSubscriptionOverride: CurrentSubscriptionOverride | null | undefined;\n isCustomerOnTrial: boolean;\n plans: PaywallPlan[];\n paywallConfiguration?: DeepPartial<StiggTheme>;\n};\n\nexport function mapPaywallData(\n paywall: Paywall | null,\n showOnlyEligiblePlans?: boolean,\n currentSubscriptionOverrideFn?: CurrentSubscriptionOverrideFn,\n): PaywallData {\n const { plans, currency, configuration, customer, activeSubscriptions, paywallCalculatedPricePoints } = paywall || {};\n const { currentSubscription, currentPlan, isCustomerOnTrial, trialDaysLeft } =\n getCustomerSubscriptionDetails(activeSubscriptions);\n\n const currentSubscriptionOverride = currentSubscriptionOverrideFn?.({ currentSubscription });\n\n const scheduledUpdates = currentSubscription?.scheduledUpdates || [];\n const currentCustomerPlanBillingPeriod = currentSubscription?.price?.billingPeriod;\n const downgradeSchedule = scheduledUpdates.find(\n ({ subscriptionScheduleType }) => subscriptionScheduleType === SubscriptionScheduleType.Downgrade,\n );\n const billingChangedSchedule = scheduledUpdates.find(\n ({ subscriptionScheduleType }) => subscriptionScheduleType === SubscriptionScheduleType.BillingPeriod,\n );\n\n let paywallPlans: PaywallPlan[] = sortBy(plans, (plan) => plan.order).map((plan) => {\n const eligibleForProductTrial = customer?.eligibleForTrial?.find(\n (productTrial) => productTrial.productId === plan.product.id,\n );\n const isCurrentCustomerPlan = currentSubscriptionOverride?.planId\n ? currentSubscriptionOverride?.planId === plan.id\n : plan.id === currentPlan?.id;\n\n const isNextPlan = (currentBillingPeriod: BillingPeriod) => {\n const downgradeVariables = downgradeSchedule?.scheduleVariables as DowngradeChangeVariables;\n const billingChangedVariables = billingChangedSchedule?.scheduleVariables as BillingPeriodChangeVariables;\n const isPlanHasBillingPeriodPrice = plan.pricePoints.some(\n (price) => price.billingPeriod === currentBillingPeriod,\n );\n\n return downgradeSchedule\n ? downgradeSchedule.targetPackage?.refId === plan.id &&\n (!isPlanHasBillingPeriodPrice || downgradeVariables.billingPeriod === currentBillingPeriod)\n : billingChangedSchedule && isCurrentCustomerPlan\n ? billingChangedVariables.billingPeriod === currentBillingPeriod\n : false;\n };\n\n return {\n ...plan,\n paywallCalculatedPricePoints: paywallCalculatedPricePoints?.filter((pricePoint) => pricePoint.planId === plan.id),\n isTriable: !isNil(plan.defaultTrialConfig) && (!eligibleForProductTrial || eligibleForProductTrial.eligible),\n isCurrentCustomerPlan,\n currentCustomerPlanBillingPeriod,\n isUpcomingPlan: false,\n trialDaysLeft,\n isNextPlan,\n paywallCurrency: currency,\n scheduledUpdate: downgradeSchedule || billingChangedSchedule,\n };\n });\n if (plans && currentPlan) {\n const currentPlanOrder = currentPlan && plans?.find((x) => x.id === currentPlan?.id)?.order;\n if (!isNil(currentPlanOrder)) {\n paywallPlans = paywallPlans.map<PaywallPlan>((plan) => ({\n ...plan,\n isLowerThanCurrentPlan: currentPlanOrder > plan.order,\n }));\n if (showOnlyEligiblePlans) {\n paywallPlans = paywallPlans.filter((plan) => plan.order >= currentPlanOrder);\n }\n }\n }\n const paywallConfiguration = configuration ? mapPaywallConfiguration(configuration) : undefined;\n\n return {\n currentPlan,\n currentSubscription,\n currentSubscriptionOverride,\n isCustomerOnTrial,\n plans: paywallPlans,\n paywallConfiguration,\n };\n}\n","import moment from 'moment';\n\nexport function calculateTrialDaysLeft(trialEndDate: Date) {\n return moment.utc(trialEndDate).diff(moment.utc(), 'days', false) + 1;\n}\n","import {\n BillingPeriod,\n PaywallCalculatedPricePoint,\n PaywallCurrency,\n Plan,\n Price,\n PriceTierFragment,\n} from '@stigg/js-client-sdk';\nimport merge from 'lodash/merge';\nimport { DeepPartial } from '../../types';\nimport { PlanPriceText } from '../utils/getPlanPrice';\nimport { PaywallPlan } from './types';\n\nexport { PlanPriceText } from '../utils/getPlanPrice';\n\nexport type CurrentPlanParams = {\n plan: Plan;\n selectedBillingPeriod: BillingPeriod;\n};\n\nexport type PaywallLocalization = {\n highlightChip: string;\n entitlementsTitle?: (plan: PaywallPlan) => string;\n addonsTitle?: string;\n planCTAButton: {\n upgrade: string | ((plan: PaywallPlan) => string);\n downgrade: string | ((plan: PaywallPlan) => string);\n startTrial: (plan: PaywallPlan) => string;\n custom: ((data: CurrentPlanParams) => string) | string;\n currentPlan: string;\n startNew: string;\n switchToBillingPeriod: (billingPeriod: BillingPeriod) => string;\n cancelScheduledUpdate: string;\n };\n price: {\n startingAtCaption: string;\n billingPeriod?: (billingPeriod: BillingPeriod) => string;\n pricePeriod: (billingPeriod: BillingPeriod) => string;\n custom: ((data: CurrentPlanParams) => string) | string;\n priceNotSet: string;\n free: PlanPriceText | ((currency?: PaywallCurrency) => PlanPriceText);\n paid?: (priceData: {\n planPrices: Price[];\n paywallCalculatedPrice?: PaywallCalculatedPricePoint;\n plan: Plan;\n selectedBillingPeriod: BillingPeriod;\n selectedTier?: PriceTierFragment;\n }) => PlanPriceText;\n };\n};\n\nexport function getResolvedPaywallLocalize(localizeOverride?: DeepPartial<PaywallLocalization>) {\n const paywallDefaultLocalization: PaywallLocalization = {\n highlightChip: 'Recommended',\n addonsTitle: 'Available add-ons:',\n planCTAButton: {\n upgrade: 'Upgrade',\n downgrade: 'Downgrade',\n startTrial: (plan: PaywallPlan) => `Start ${plan.defaultTrialConfig?.duration} day trial`,\n custom: 'Contact us',\n currentPlan: 'Current plan',\n startNew: 'Get started',\n switchToBillingPeriod: (billingPeriod) => {\n return billingPeriod === BillingPeriod.Monthly ? 'Switch to monthly billing' : 'Switch to annual billing';\n },\n cancelScheduledUpdate: 'Cancel',\n },\n price: {\n startingAtCaption: 'Starts at',\n pricePeriod: (billingPeriod: BillingPeriod) => (billingPeriod === BillingPeriod.Monthly ? '/ month' : '/ year'),\n free: (currency) => ({\n price: `${currency?.symbol}0`,\n }),\n custom: 'Custom',\n priceNotSet: 'Price not set',\n },\n };\n return merge(paywallDefaultLocalization, localizeOverride);\n}\n","import { useMemo, useCallback } from 'react';\nimport { GetActiveSubscriptions } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\nimport { useFetch } from './useFetch';\n\nexport function useActiveSubscriptions(params?: GetActiveSubscriptions) {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n const func = useCallback(() => (stigg ? stigg.getActiveSubscriptions(params) : Promise.resolve([])), [params, stigg]);\n const { data, error, isLoaded } = useFetch({ func });\n\n return useMemo(\n () => ({\n activeSubscriptions: data,\n isLoaded,\n error,\n }),\n [data, error, isLoaded],\n );\n}\n","import { useMemo, useCallback } from 'react';\nimport { GetCustomerPortal } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\nimport { useFetch } from './useFetch';\n\nexport function useCustomerPortal(params?: GetCustomerPortal) {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n const func = useCallback(() => (stigg ? stigg.getCustomerPortal(params) : Promise.resolve(null)), [params, stigg]);\n const { data, error, isLoaded } = useFetch({ func });\n\n return useMemo(\n () => ({\n customerPortal: data,\n isLoaded,\n error,\n }),\n [data, error, isLoaded],\n );\n}\n","import { useMemo, useCallback } from 'react';\nimport { GetPaywall } from '@stigg/js-client-sdk';\nimport { useStiggContext } from './useStiggContext';\nimport { useFetch } from './useFetch';\n\nexport function usePaywall(params?: GetPaywall) {\n const stiggContext = useStiggContext({ optional: true });\n const stigg = stiggContext?.stigg;\n\n const func = useCallback(() => (stigg ? stigg.getPaywall(params) : Promise.resolve(null)), [params, stigg]);\n const { data, error, isLoaded } = useFetch({ func });\n\n return useMemo(\n () => ({\n paywall: data,\n isLoaded,\n error,\n }),\n [data, error, isLoaded],\n );\n}\n"],"names":["calculateUnitQuantityText","minUnitQuantity","maxUnitQuantity","unitsPlural","unitsText","formatNumber","usageLimit","toLocaleString","maximumFractionDigits","getColor","theme","$color","stigg","palette","primary","primaryLight","warning","error","text","StyledText","_styled","Text","$span","mapFontWeight","fontWeight","StyledFontWeight","Bold","Normal","getFontWeight","variant","typography","h1","h2","h3","body","caption","_g","_defs","_rect","_path","_path2","_path3","Typography","forwardRef","props","ref","children","span","style","color","overrideColor","bold","as","rest","useTheme","level","getLevel","levelClassName","React","className","getIconColor","secondary","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","SvgMiniSchedule","React.createElement","width","height","fill","xmlns","fillRule","clipRule","d","_rect2","_circle","SvgRestore","clipPath","stroke","strokeWidth","strokeLinecap","strokeLinejoin","id","rx","transform","x1","y1","x2","y2","gradientUnits","opacity","cx","cy","r","viewBox","IconWrapper","$pathColor","css","$rectColor","$strokeColor","Icon","svgPathColor","svgRectColor","svgStrokeColor","IconComponent","customIcons","icon","EntitlementName","EntitlementRowContainer","EntitlementIconContainer","EntitlementIcon","EntitlementRow","displayNameOverride","restProps","displayName","hasUnlimitedUsage","feature","resetPeriod","isCustom","enumValues","unitBasedEntitlement","resetPeriodSuffix","EntitlementResetPeriod","Day","Hour","Week","Month","Year","getResetPeriodText","units","featureUnits","getEntitlementDisplay","_restProps$feature","SubscribeIntentionType","PlanEntitlementsContainer","PlanEntitlements","plan","billingPeriod","paywallLocale","unitBasedEntitlements","pricePoints","filter","price","map","_price$feature","featureId","visibleEntitlements","entitlements","isGranted","entitlement","hiddenFromWidgets","includes","WidgetType","Paywall","hasFeatures","entitlementsTitle","title","basePlan","getTitle","_entitlement$feature","PriceTierComparison","flexLayoutMapper","horizontalAlignment","left","center","right","formatDate","date","moment","utc","format","getSubscriptionScheduleUpdateTexts","scheduledUpdate","subscriptionPrices","billingPeriodRange","options","withDate","postfix","subscriptionScheduleType","SubscriptionScheduleType","Downgrade","shouldShowDate","isNil","end","scheduledExecutionTime","isSame","line1","targetPackage","_scheduledUpdate$targ","line2","BillingPeriod","scheduleVariables","_variables$billingPer","toLocaleLowerCase","UnitAmount","variables","compact","find","newUnitAmount","featureUnitsPlural","getPriceFeatureUnit","unitQuantity","getTierByQuantity","tiers","quantity","ascendingTiers","sort","a","b","upTo","tier","getAmount","amount","selectedBillingPeriod","shouldShowMonthlyPriceAmount","Annually","calculateTierPriceVolume","currentTier","perUnitQuantity","unitPrice","flatPrice","calculateTierPriceGraduated","remainingQuantity","prevUpTo","currentTierIndex","breakdown","push","consumed","Math","min","total","sum","calculateTierPrice","tiersMode","TiersMode","Volume","Graduated","hasTierWithUnitPrice","some","getTiersPerUnitQuantities","currentSubscription","currentSubscriptionOverride","selectDefaultTierIndex","planTierPrices","isTieredPrice","selectedDefaultTierIndex","tieredPrice","prices","subscriptionPrice","pricingModel","BillingModel","PerUnit","planId","billableFeature","billableFeatures","result","LoadingIndicator","ClipLoader","OfferingButton","$disabled","backgroundButton","outlinedRestingBorder","outlinedHoverBackground","ButtonText","ScheduledUpdateText","CancelScheduledUpdateButton","TrialDaysLeft","ButtonLayout","layout","ctaAlignment","PlanOfferingButton","isNextPlan","customer","isCustomerOnTrial","onPlanSelected","withTrialLeftRow","perUnitQuantityByFeature","useState","isLoading","setIsLoading","planCTAButton","currentPlan","custom","downgrade","startTrial","upgrade","startNew","switchToBillingPeriod","cancelScheduledUpdate","resolvedDowngrade","isFunction","resolvedUpgrade","buttonProps","isLowerThanCurrentPlan","disabled","intentionType","DOWNGRADE_PLAN","UPGRADE_TRIAL_TO_PAID","UPGRADE_PLAN","isCustomPrice","pricingType","PricingType","Custom","scheduledUpdateText","isTriable","isCurrentCustomerPlan","currentCustomerPlanBillingPeriod","Free","Equal","currentTierPrice","isCurrentPlanOverride","oldQuantity","_currentSubscriptionO","newQuantity","Lower","Higher","compareSelectedTierToCurrentTier","CHANGE_UNIT_QUANTITY","CHANGE_BILLING_PERIOD","REQUEST_CUSTOM_PLAN_ACCESS","START_TRIAL","CANCEL_SCHEDULED_UPDATES","isDisabled","onClick","Promise","resolve","loading","size","trialDaysLeft","currencyPriceFormatter","currency","locale","minimumFractionDigits","removeTrailingZero","currencyString","Currency","Usd","toString","currencySymbol","getSymbolFromCurrency","formattedPrice","Intl","NumberFormat","trailingZeroDisplay","currencyDisplay","replace","numberFormatter","number","getPlanPrice","free","paywallCurrency","Paid","planPrices","pricePoint","paywallCalculatedPrice","paywallCalculatedPricePoints","_plan$paywallCalculat","priceNotSet","paidParams","paid","tierUnits","priceAmount","isSinglePrice","priceNumber","pricePeriod","Monthly","unit","formattedUnits","blockSize","_price$feature2","UsageBased","getPaidPriceText","StyledButton","MuiButton","shouldForwardProp","prop","startsWith","$success","success","$error","successDark","errorDark","Button","InputField","styled","TextField","borderRadius","border","radius","fieldset","borderColor","outlinedBorder","padding","fontFamily","SkeletonsContainer","Grid","$flexDirection","$gap","FlexedSkeletonContainer","FlexedSkeleton","flex","Skeleton","ReactSkeleton","ContentContainer","ContentLoadingSkeleton","container","item","Divider","sx","marginY","marginTop","ON_WHEEL_BLUR","e","blur","VolumePerUnitInput","value","handleChange","type","onWheel","fullWidth","minHeight","InputProps","endAdornment","InputAdornment","position","onChange","event","Number","_event$target2","TierSelect","Select","TierInput","OutlinedInput","VolumeBulkSelect","componentId","input","MenuProps","MenuListProps","disablePadding","PaperProps","MenuItem","_tier$upTo","lineHeight","TiersSelectLayout","TiersSelectContainer","PlanPriceContainer","UnitSpan","PriceSpan","PriceBillingPeriod","hasMonthlyPrice","hasAnnuallyPrice","content","toLowerCase","PlanPrice","showStartingAt","withUnitPriceRow","withStartingAtRow","withTiersRow","setPerUnitQuantityByFeature","planPrice","undefined","startingAtCaption","prevState","AddonsBox","AddonsList","AddonRow","AddonName","AddonIcon","AddonContent","Footer","PlanCompatibleAddons","addons","showAllAddons","setShowAllAddons","visibleAddons","addon","_addon$hiddenFromWidg","displayedAddons","slice","addonsTitle","classNames","PlanOfferingContainer","$isCurrentPlan","backgroundHighlight","backgroundPaper","$isHighlighted","planPadding","planMinWidth","planMaxWidth","AddonsContainer","$planHasEntitlements","PlanHeader","PlanDescription","descriptionAlignment","descriptionMinHeight","HighlightBadge","HighlightText","HeaderWrapper","headerAlignment","NextPlanTagContainer","StyledMiniSchedule","MiniSchedule","UpcomingChangeTag","display","alignItems","gap","iconsColor","PlanOffering","isHighlighted","shouldShowDescriptionSection","isCustomerInCustomPlan","hideCompatibleAddons","additionalChargesMayApply","showCTAButton","planBadge","highlightChip","description","perUnitBillableFeatures","keys","compatibleAddons","PickerContainer","switchBottomSpacing","PeriodText","StyledSwitch","Switch","switchBorder","switchFill","shadows","light","switchHandle","DiscountRate","discount","BillingPeriodPicker","discountRate","onBillingPeriodChanged","availableBillingPeriods","isMonthlyBillingPeriod","uncheckedIcon","checkedIcon","isAnnuallySelected","checked","handleDiameter","getPlanBillingPeriodAmount","_pricePoint","_pricePoint2","PoweredByStiggThemedSvg","StyledPoweredByStigg","$alignSelf","PoweredByStigg","showWatermark","align","cursor","sourceDomain","window","location","hostname","open","hasPricePoints","hasPricePointsForPlans","plans","PaywallPlansContainer","planMargin","PaywallContainer","PaywallLayout","highlightedPlanId","shouldHidePlan","useStiggContext","reduce","maxDiscount","monthlyPrice","annuallyPrice","monthlyAmount","round","max","calculatePaywallDiscountRate","plansToShow","getPlansToDisplay","handleOnSubscribe","useCallback","subscription","useMemo","values","isWidgetWatermarkEnabled","runtime","exports","Op","hasOwn","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","makeInvokeMethod","fn","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","reject","invoke","__await","then","unwrapped","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","doneResult","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","iter","object","reverse","pop","skipTempReset","prev","charAt","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","message","params","console","log","debug","computeBillingPeriods","activeSubscriptions","preferredBillingPeriod","defaultBillingPeriod","billingPeriods","flatMap","x","counts","countBy","uniq","activeSubscription","status","SubscriptionStatus","Active","defaultCheckoutTypography","fontSize","FontWeight","addCssUnits","defaultValue","JSFontWeight","mapTypography","defaultTypography","fontFamilyUrl","_defaultTypography$h","_defaultTypography$h2","_defaultTypography$h3","_defaultTypography$h4","_defaultTypography$h5","_defaultTypography$h6","_defaultTypography$bo","_defaultTypography$bo2","mapAlignment","alignment","Alignment","Left","Center","Right","StiggContext","createContext","optional","ctx","useContext","SvgCheckStigg","SkeletonContainer","EntitlementCheckIcon","CheckUrl","PlanOfferingSkeleton","PlansContainer","EntitlementContainer","FooterSkeletonLoader","BillingPeriodLoader","PlanOfferingLoader","circle","marginBottom","PaywallLoader","Fonts","externalFontUrl","Global","styles","CustomCssGlobal","customCss","useStiggTheme","remoteThemeOverride","customizedTheme","primaryColor","textColor","successColor","errorColor","baseTheme","mergedTheme","merge","Color","hex","primaryDark","darken","alpha","backgroundSection","lightness","lighten","white","tertiary","popover","createTypographyTheme","coef","pxToRem","bodyFontFamily","headingFontFamily","fontSizes","SdkThemeProvider","componentTheme","muiPalette","main","createMuiPalette","materialTheme","createTheme","MuiThemeProvider","THEME_ID","ThemeProvider","StyledThemeProvider","CustomerPortalContext","useCustomerPortalContext","CustomerPortalProvider","globalTheme","themeOverride","remoteConfiguration","textOverrides","resourceId","productId","customerPortalUpdatedAt","customerPortal","setCustomerPortal","useEffect","isCustomerLoaded","getCustomerPortal","logger","_context","loadCustomerPortal","useCustomerPortal","configuration","paywallBackgroundColor","currentPlanBackground","mapCustomerPortalConfiguration","customerPortalTheme","sectionTitleColor","planNameColor","backgroundColor","_remoteConfiguration$","_remoteConfiguration$2","listItemBackgroundColor","_remoteConfiguration$3","tabMaxHeight","_remoteConfiguration$4","iconsBackgroundColor","resolvedTextOverrides","manageSubscription","usageTabTitle","addonsTabTitle","promotionsTabTitle","promotionsSubtitle","contactSupportTitle","contactSupportLink","editBilling","invoicesTitle","viewInvoiceHistory","editPaymentDetails","paywallSectionTitle","cancelScheduledUpdatesButtonTitle","Provider","CustomerPortalIntentionType","SvgEditIcon","SectionHeader","$disableMargin","SectionTitle","StyledEditIcon","EditIcon","SubscriptionsOverviewHeader","onManageSubscription","hideManageButton","MANAGE_SUBSCRIPTION","marginLeft","subscriptions","isEmpty","index","addonId","Row","$borderColor","Promotions","promotionalEntitlements","flexDirection","promotionalEntitlement","_promotionalEntitleme","getPromotionTitle","endDate","StyledTabs","Tabs","TabsLayout","TabContent","Box","$maxHeight","TabPanel","maxHeight","other","role","hidden","TabTitle","isSelected","label","Medium","SubscriptionTabs","hiddenSections","isSectionHidden","sectionName","section","showAddons","showPromotions","setValue","borderBottom","_","newValue","Tab","textTransform","breakpoints","xs","sm","md","lg","xl","xxl","mqMinWidth","breakpoint","mq","useIsScreenWiderThan","useMediaQueryMui","SkeletonLayout","SkeletonLayoutLeft","SubscriptionOverviewLoader","isScreenWiderThanMd","SubscriptionScheduledUpdateDowngradeRow","scheduleUpdate","ArrowDown","SubscriptionScheduledUpdateBillingPeriodChangeRow","currentBillingPeriod","nextBillingPeriod","SubscriptionScheduledUpdateUnitQuantityChangeRow","newQuantityUnits","flexWrap","SubscriptionScheduledUpdateRow","SubscriptionScheduleUpdateAlertContainer","StyledRestoreIcon","Restore","MultipleScheduledUpdates","scheduledUpdates","justifyContent","SingleScheduledUpdate","SubscriptionScheduledUpdatesAlert","onCancelScheduledUpdates","stiggTheme","isSingleScheduledUpdate","marginRight","SectionContainer","$backgroundColor","NextEstimatedBill","rangeEnd","NoUpcomingBilling","ContactCustomerSupportLayout","ContactSupportButton","ContactCustomerSupport","onContactSupport","contactSupportText","linkLabel","Container","UpcomingBilling","noUsageBasedPrices","_subscription$prices","every","billingModel","scheduledDowngradeToFree","_subscription$schedul","InTrial","planName","_subscription$prices2","_subscription$prices3","_subscription$billing","totalPrice","_subscription$totalPr","SvgSandClock","InformationTooltip","placement","Tooltip","arrow","classes","popper","tooltip","$padding","$maxWidth","tooltipClasses","maxWidth","boxShadow","$display","$maxLines","$wordBreak","$bold","checkTextClamped","element","clientHeight","scrollHeight","offsetWidth","scrollWidth","LongText","leaveDelay","maxLines","wordBreak","tooltipPlacement","dataTestId","isTextClamped","setIsTextClamped","useRef","current","textClamped","OnTrialBadge","StyledLink","Link","TrialPanel","includePlanName","SandClockIcon","trialRemainingDays","UPGRADE_TRIAL_PLAN","SubscriptionView","mainSubscription","trialSubscription","getUsagePercentage","currentUsage","limit","floor","StyledLinearProgress","LinearProgress","string","$progressStatus","StyledDivider","FeatureUsageProgressBar","usagePercentage","linearProgressStatus","EntitlementCtaButton","onBuyMore","canBuyMore","canUpgradeSubscription","hasCustomSubscription","ChargeItem","hideChargePrice","refId","whiteSpace","_entitlement$currentU","_entitlement$currentU2","_entitlement$usageLim","ChargeList","entitlementByFeature","keyBy","filteredSubscriptionPrices","SubscriptionsOverview","isLoadingData","CustomerPortalHeaderLayout","CustomerPortalHeader","ExternalLinkText","LinkIcon","ExternalLinkIcon","ExternalLinkButton","url","startIcon","InformationGridContainer","InformationGridRow","InformationGrid","rows","classNamePrefix","valueTypographyProps","labelTypographyProps","SkeletonButton","PaymentDetailsSection","billingInformation","items","orientation","email","defaultPaymentMethodId","defaultPaymentMethodLast4Digits","defaultPaymentExpirationMonth","defaultPaymentExpirationYear","unshift","padStart","editButton","billingPortalUrl","CustomerPortalPaywallLayout","CustomerPortalPaywall","paywallComponent","CustomerPortalLayout","CustomerPortalSections","getFeatureDisplayNameText","featureDisplayName","displayNameLowerCase","lowercase","FeatureUsageContainer","$highlight","FeatureUsage","hasOverageUsage","isUndefined","usagePeriodEnd","calculateResetDiff","diff","getResetUsageText","CustomerUsageLoader","isMdScreen","spacing","range","CustomerUsageData","filterEntitlements","showAll","setShowAll","meteredEntitlements","meterType","MeterType","Fluctuating","Incremental","subscriptionPriceByFeature","priceEntitlements","otherEntitlements","sortedEntitlements","filteredEntitlements","entitlementsToShow","Minus","Plus","CustomerPortalContainer","customerPortalSectionRef","onManageClick","customerSubscriptions","scrollIntoView","behavior","shouldShowUsage","shouldShowPaymentDetails","shouldShowInvoices","InvoicesSection","viewInvoiceHistoryButton","sortSubscriptionAddons","sortBy","filterAddonPricePointsByBillingPeriod","mapAddonPricePointsByBillingCountryCode","billingCountryCode","useRemoveAddon","setState","useCheckoutContext","draft","remove","addonsStep","useSetIsValid","isValid","widgetState","useSetCheckoutSuccess","checkoutSuccess","useCheckoutModel","checkoutState","checkout","checkoutLocalization","setWidgetReadOnly","readOnly","setIsValid","setCheckoutSuccess","CheckoutStepKey","getValidPriceQuantity","hasMonthlyPrices","hasAnnualPrices","getBillingPeriod","isInAdvanceCommitmentCharge","useSetBillableFeature","planStep","usePlanStepModel","setBillingPeriod","setBillableFeature","CHECKOUT_STEPS","PLAN","ADDONS","PAYMENT","INITIAL_STATE","activeStep","completedSteps","steps","useMarkStepAsCompleted","stepNumber","progressBar","useGoNext","useSetIsDisabled","useProgressBarModel","progressBarState","currentStep","isLastStep","isCheckoutComplete","setActiveStep","markStepAsCompleted","goNext","setIsDisabled","useSubscriptionModel","paymentStep","promotionCode","billingAddress","taxPercentage","mapBillingInformation","previewSubscription","customerId","onMockCheckoutPreview","estimateAddons","subscriptionPreview","errorMessage","previewSubscriptionProps","split","errorMsg","trim","usePreviewSubscriptionAction","previewSubscriptionAction","useSetErrorMessage","useSetBillingAddress","usePaymentStepModel","setUseNewPaymentMethod","useNewPaymentMethod","setErrorMessage","setBillingAddress","CheckoutContext","CheckoutContextProvider","initialState","innerSetState","updater","old","produce","CheckoutProvider","skipCheckoutSteps","onMockCheckoutState","setCheckout","loadCheckout","getCheckoutState","useLoadCheckout","summaryBackgroundColor","mapCheckoutConfiguration","checkoutTheme","_remoteConfiguration","globalPalette","paymentInputBackgroundColor","paymentInputBorderColor","paymentInputBorderRadius","getResolvedCheckoutTheme","changePlan","billingPeriodsTitle","addAddonText","newPaymentMethodText","newPaymentMethodBillingAddressTitle","newPaymentMethodCardTitle","summary","addCouponCodeText","couponCodeTitle","addonsSectionTitle","discountsSectionTitle","onlyPayAsYouGoText","startsAtText","proratedTotalDueText","baseChargeText","totalText","totalDueText","totalBillingPeriodText","appliedCreditsTitle","creditsForUnusedTimeText","credits","discountText","discountDetails","DiscountType","Percentage","discountTextPostfix","durationType","DiscountDurationType","Once","Repeating","Fixed","durationInMonths","Forever","taxTitle","taxDetails","percentage","changesWillApplyAtEndOfBillingPeriod","billingPeriodEnd","checkoutSuccessText","payAsYouGoTooltipText","checkoutButton","nextText","noChangesText","updateText","downgradeToFreeText","upgradeText","downgradeToFree","alertText","freePlanHeader","freePlanName","freePlanPriceText","paidPlanHeader","paidPlanName","paidPlanPriceText","preconfiguredBillableFeatures","hasMonthlyPlan","hasAnnualPlan","resolveBillingPeriod","preconfBillableFeaturesByFeatureId","quantityByFeatureId","_activeSubscription$p","charge","preconfiguredQuantity","_quantityByFeatureId$","getBillableFeatures","getPlanStepInitialState","availableAddons","sortAddons","filterAddons","activeSubscriptionAddons","filterSubscriptionAddons","planAddon","initialAddons","cloneDeep","getAddonsStepInitialState","_billingInformation$t","paymentMethodDetails","availableCharges","stepsToFilter","hasMultipleBillingPeriods","availableChargesIds","preconfiguredChargesIds","canSkipPlanStep","step","getProgressBarInitialState","resource","_checkout$resource","isLoadingCheckoutData","_billingInformation$t2","CheckoutLayout","CheckoutContent","CheckoutPanel","StyledProgress","linearProgressClasses","root","bar","StyledStepButton","buttonClasses","StyledIcon","$shouldFill","CheckoutProgressBar","containerRef","progress","previousStep","setPreviousStep","mb","isCompleted","StepIcon","CHARGES_BILLING_MODEL_ORDER","FlatFee","useChargesSort","charges","indexOf","_charge$feature","sortCharges","usePromotionCodeModel","setPromotionCode","StyledPlusIcon","AddPromotionCodeButton","onAddClick","CouponCodeAddButton","AddPromotionCode","persistPromotionCode","showInput","setShowInput","handlePromotionCode","immediateInvoice","_subscriptionPreview$","toUpperCase","autoFocus","inputProps","maxLength","onKeyDown","preventDefault","CircularProgress","AppliedCouponContainer","AppliedPromotionCode","onClearPromotionCode","minWidth","PromotionCodeSectionContainer","PromotionCodeSection","StripePaymentForm","onBillingAddressChange","collectPhoneNumber","shouldCollectPhoneNumber","_configuration$conten","pointerEvents","AddressElement","args","address","postalCode","postal_code","callExternalBillingAddressChanged","mode","fields","phone","defaultValues","PaymentElement","onReady","terms","card","billingDetails","useSubscriptionState","FAILED_PAYMENT_COLLECTION_STATUSES","PaymentCollection","Failed","Processing","handleStripeFormValidations","elements","submit","elementsError","handleStripeNextAction","paymentIntentClientSecret","applySubscriptionResults","latestInvoice","_subscription$latestI","paymentSecret","paymentCollection","stripe","ActionRequired","handleNextAction","clientSecret","NextActionError","handleStripeSetup","confirmSetup","confirmParams","return_url","href","redirect","setupError","setupErrorMessage","retrieveSetupIntent","setupIntent","payment_method","newPaymentMethodId","handleNewPaymentMethod","setupIntentClientSecret","stripeFormValidationsResults","paymentMethodId","CheckoutSuccessContainer","CheckoutSuccessText","CheckoutSuccess","block","inline","Lottie","animationData","loop","autoplay","delay","ms","res","setTimeout","createZuoraPaymentFormConfig","createPaymentSession","onComplete","region","useZuoraIntegration","isInitialized","setIsInitialized","billingIntegration","token","initializeZuora","Zuora","script","document","createElement","src","onerror","head","appendChild","billingIdentifier","BillingVendorIdentifier","isZuoraIntegration","useZuoraSubmit","onCheckout","onCheckoutCompleted","onSuccess","disableSuccessAnimation","subscriptionState","handleZuoraSubmit","currentSubscriptionState","checkoutParams","checkoutAction","applySubscription","results","externalCheckoutResults","checkoutActionResults","_context2","WithSkeleton","RemainingCreditsCaption","isFetchingSubscriptionPreview","proration","_immediateInvoice$pro","netAmount","_immediateInvoice$pro2","ScheduledUpdatesCaption","hasScheduledUpdates","currentBillingPeriodEnd","changesWillApplyText","NextBillingCaption","recurringInvoice","nextBillingDate","billingPeriodText","hasUnitBasedPricing","hasNonUnitBasedPricing","totalAmountText","CheckoutCaptions","formatPricePerUnit","totalAmount","aBlockSize","billingPeriodString","formattedUnitPrice","formattedTotalPrice","GraduatedPriceBreakdown","LineItemContainer","LineItemRow","startUnit","getLabel","CollapsableSectionIcon","ChevronRight","$size","$isOpen","NestedBreakdownContainer","PayAsYouGoPriceTooltip","BilledPriceLineItem","nestedBreakdown","isScreenWiderThanLg","isNestedBreakdownOpen","setIsNestedBreakdownOpen","toggleNestedBreakdown","isPayAsYouGo","ceil","underline","IconButton","isBulkTiers","isQuantityInFirstTier","getPriceBreakdownString","Collapse","FreeChargeLineItem","DiscountLineItem","AppliedCreditsLineItem","used","TaxLineItem","tax","SummaryContainer","SummaryCard","Paper","defaultProps","elevation","SummaryTitle","TotalDueText","CheckoutSummary","disablePromotionCode","isFreeDowngrade","isCheckoutCompletedSuccessfully","setIsCheckoutCompletedSuccessfully","partition","usageCharges","baseCharge","isCheckoutCompleted","setSubscriptionPreview","setIsFetchingSubscriptionPreview","estimateSubscription","timer","clearTimeout","usePreviewSubscription","isMocked","setupSecret","useStripe","useElements","handleSubmit","usedStiggCheckoutAction","paymentMethodResults","nextActionResults","checkoutResults","useSubmit","handleStripeSubmit","isStripeLoading","handleCheckout","onCheckoutClick","checkoutHasChanges","showPromotionCodeLine","showDiscountLine","hasDiscounts","hasPayAsYouGoCharges","onlyPayAsYouGoCharges","baseChargeLabel","paddingRight","margin","priceBillableFeature","_subscription$billabl","_price$feature4","_price$feature5","_subscription$addons","addonPrice","_addon$addon$pricePoi","_addon$addon","hasProrations","subTotal","isPlanUpdate","resolveCheckoutButtonText","CheckoutSummarySkeleton","CheckoutAddonsContainer","AddonListItemContainer","TrashButton","AddonListItem","addonState","initialAddonState","setAddon","removeAddon","onAddonsValidationChange","isAdded","hasChanges","handleQuantityChange","marginX","helperText","FormHelperTextProps","paddingX","paddingY","CheckoutAddonsStep","addonToUpdate","currentAddon","acc","curr","addonsValidation","setAddonsValidation","PaymentMethodContainer","NewPaymentMethodContainer","$hideBorders","PaymentMethodLayoutContainer","PaymentMethodTextContainer","PaymentContainer","$showLoading","LoadingOverlay","LoadingContent","ZuoraPaymentForm","hasRenderedRef","paymentFormLoading","setPaymentFormLoading","publishableKey","billingCredentials","handleZuoraComplete","zuora","config","createPaymentForm","mount","renderZuoraForm","PaymentMethodLayout","subtitle","Radio","ExistingPaymentMethod","expirationMonth","expirationYear","onSelect","last4Digits","NewPaymentMethod","hasExistingPaymentMethod","PaymentStep","handleOnSelect","openNewPaymentMethod","Alert","severity","ChangePlanButton","allowChangePlan","onChangePlan","formatBillingPeriod","BillingPeriodPickerContainer","BillingPeriodButton","$isOnlyBillingPeriod","$isActive","BillingPeriodOptions","BillingPeriodOption","isOnlyBillingPeriod","isActive","monthlyPrices","annualPrices","hasBothBillingPeriods","StyledPlanCharge","div","getValidationText","PlanCharge","chargeRow","onValidationChange","isBaseCharge","_charge$feature3","_charge$feature4","hasQuantityRestrictions","_charge$feature5","CheckoutChargeList","planCharges","p","chargesValidation","setChargesValidation","_charge$feature6","CheckoutPlanContainer","CheckoutPlanStep","StyledArrowRightIcon","DowngradeToFreePlansContainer","DowngradeToFreeAlert","DowngradeToFreePlanBox","DowngradeToFreeContent","priceText","headerText","DowngradeToFreePlan","alertAction","freePlan","paidBillingPeriod","action","CheckoutContainer","stripePromise","setStripePromise","credentials","Stripe","accountId","publicKey","loadStripe","stripeAccount","useStripeIntegration","getStepProps","checkoutContent","stripeElementsMode","Elements","appearance","colorText","colorPrimaryText","colorTextPlaceholder","colorBackground","rules","ProvisionStatus","useBooleanEntitlement","stiggContext","getBooleanEntitlement","BOOLEAN_DEFAULT_FALLBACK_ENTITLEMENT","_params$options","fallback","useNumericEntitlement","getNumericEntitlement","NUMERIC_DEFAULT_FALLBACK_ENTITLEMENT","useMeteredEntitlement","getMeteredEntitlement","METERED_DEFAULT_FALLBACK_ENTITLEMENT","useEnumEntitlement","getEnumEntitlement","ENUM_DEFAULT_FALLBACK_ENTITLEMENT","useFetch","func","isLoaded","setIsLoaded","setError","data","setData","fetchData","noAccessComponent","hasAccess","containerProps","showOnlyEligiblePlans","onBillingPeriodChange","currentSubscriptionOverrideFn","hasCustomerPortalContext","isCustomerPortalLoading","setSelectedBillingPeriod","setAvailableBillingPeriods","paywall","setPaywall","waitForInitialization","getPaywall","paywallResult","loadPaywall","paywallData","s","_currentSubscription","trialEndDate","_currentSubscription3","getCustomerSubscriptionDetails","_currentSubscription$","downgradeSchedule","billingChangedSchedule","paywallPlans","order","eligibleForProductTrial","eligibleForTrial","_customer$eligibleFor","productTrial","product","defaultTrialConfig","eligible","isUpcomingPlan","downgradeVariables","billingChangedVariables","isPlanHasBillingPeriodPrice","currentPlanOrder","_plans$find","paywallConfiguration","planWidth","mapPaywallConfiguration","mapPaywallData","useLoadPaywallData","_plan$defaultTrialCon","duration","symbol","component","apiKey","baseUri","baseEdgeUri","enableEdge","customerToken","cacheTtlMs","useEntitlementPolling","entitlementPollingInterval","entitlementsFallback","stiggClient","offline","clientName","clientVersion","currentApiKey","initializeParams","Stigg","initialize","lazyLoad","refreshData","setContext","Date","refresh","isMounted","safeSetContext","setContextFunc","onEntitlementsUpdated","updatedAt","setStiggInstance","removeListener","addListener","loadStiggClient","clearCustomer","setCustomerId","SkeletonTheme","baseColor","highlightColor","getActiveSubscriptions","paramName","onProvisionStart","onProvisionSucceeded","onProvisionFailed","IN_PROGRESS","provisionStatus","setProvisionStatus","isAwaitingCheckout","setIsAwaitingCheckout","checkoutCompleted","urlSearchParams","URLSearchParams","search","get","waitForCheckoutCompleted","SUCCEEDED","FAILED","waitForCheckoutToComplete"],"mappings":"4gHAAgBA,GACdC,EACAC,EACAC,OAEMC,EAAYD,MAAkBA,EAAgB,UAG9CF,GAAuC,IAApBA,IAA0BC,EAK/CD,GAAmBA,EAAkB,GAAKC,EAClCD,MAAmBC,EAAkBE,EAG7CH,GAAmBA,EAAkB,aACrBA,EAAkBG,EAG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