@stigg/react-sdk 4.3.0-beta.1 → 4.3.1

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 (171) hide show
  1. package/README.md +1 -1
  2. package/dist/components/common/Icon.d.ts +2 -3
  3. package/dist/components/common/PoweredByStigg.d.ts +1 -1
  4. package/dist/components/common/customIcons.d.ts +5 -17
  5. package/dist/components/common/mapExternalTheme.d.ts +1 -2
  6. package/dist/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.d.ts +1 -1
  7. package/dist/components/{common/TiersSelectContainer.d.ts → paywall/TiersLayout.d.ts} +3 -2
  8. package/dist/components/paywall/paywallTextOverrides.d.ts +4 -0
  9. package/dist/components/{utils/priceTierUtils.d.ts → paywall/planPriceTier.d.ts} +1 -3
  10. package/dist/components/utils/calculateDiscountRate.d.ts +0 -1
  11. package/dist/components/utils/currencyUtils.d.ts +1 -1
  12. package/dist/components/utils/getPaidPriceText.d.ts +3 -1
  13. package/dist/index.d.ts +0 -1
  14. package/dist/react-sdk.cjs.development.js +217 -3483
  15. package/dist/react-sdk.cjs.development.js.map +1 -1
  16. package/dist/react-sdk.cjs.production.min.js +1 -1
  17. package/dist/react-sdk.cjs.production.min.js.map +1 -1
  18. package/dist/react-sdk.esm.js +223 -3623
  19. package/dist/react-sdk.esm.js.map +1 -1
  20. package/dist/stories/CustomerPortal.stories.d.ts +1 -1
  21. package/dist/theme/getResolvedTheme.d.ts +0 -1
  22. package/dist/theme/types.d.ts +0 -1
  23. package/package.json +22 -11
  24. package/src/components/StiggProvider.tsx +2 -0
  25. package/src/components/common/Icon.tsx +22 -17
  26. package/src/components/common/PoweredByStigg.tsx +1 -1
  27. package/src/components/common/Typography.tsx +1 -11
  28. package/src/components/common/customIcons.ts +28 -17
  29. package/src/components/common/mapExternalTheme.ts +8 -24
  30. package/src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.tsx +12 -6
  31. package/src/components/paywall/Paywall.tsx +1 -1
  32. package/src/components/paywall/PlanOffering.tsx +1 -1
  33. package/src/components/paywall/PlanOfferingButton.tsx +1 -1
  34. package/src/components/paywall/PlanPrice.tsx +13 -5
  35. package/src/components/{common/TiersSelectContainer.tsx → paywall/TiersLayout.tsx} +7 -8
  36. package/src/components/paywall/paywallTextOverrides.ts +3 -0
  37. package/src/components/{utils/priceTierUtils.ts → paywall/planPriceTier.ts} +3 -25
  38. package/src/components/paywall/utils/calculateUnitQuantityText.ts +4 -9
  39. package/src/components/utils/calculateDiscountRate.ts +1 -1
  40. package/src/components/utils/currencyUtils.ts +1 -1
  41. package/src/components/utils/getPaidPriceText.ts +10 -4
  42. package/src/components/utils/getPlanPrice.ts +1 -1
  43. package/src/index.ts +0 -1
  44. package/src/stories/CustomerPortal.stories.tsx +12 -12
  45. package/src/stories/Paywall.stories.tsx +4 -6
  46. package/src/stories/baseArgs.ts +1 -1
  47. package/src/theme/Fonts.tsx +1 -1
  48. package/src/theme/Theme.tsx +7 -9
  49. package/src/theme/getResolvedTheme.ts +0 -1
  50. package/src/theme/types.ts +0 -1
  51. package/dist/components/checkout/Checkout.d.ts +0 -5
  52. package/dist/components/checkout/CheckoutContainer.d.ts +0 -22
  53. package/dist/components/checkout/CheckoutContainer.style.d.ts +0 -26
  54. package/dist/components/checkout/CheckoutProvider.d.ts +0 -35
  55. package/dist/components/checkout/CheckoutSummary.d.ts +0 -9
  56. package/dist/components/checkout/components/Button.d.ts +0 -6
  57. package/dist/components/checkout/components/InputField.d.ts +0 -8
  58. package/dist/components/checkout/components/index.d.ts +0 -2
  59. package/dist/components/checkout/formatting.d.ts +0 -2
  60. package/dist/components/checkout/hooks/index.d.ts +0 -8
  61. package/dist/components/checkout/hooks/useAddonsStepModel.d.ts +0 -21
  62. package/dist/components/checkout/hooks/useCheckoutModel.d.ts +0 -9
  63. package/dist/components/checkout/hooks/useCouponModel.d.ts +0 -7
  64. package/dist/components/checkout/hooks/useLoadCheckout.d.ts +0 -11
  65. package/dist/components/checkout/hooks/usePaymentStepModel.d.ts +0 -16
  66. package/dist/components/checkout/hooks/usePlanStepModel.d.ts +0 -23
  67. package/dist/components/checkout/hooks/usePreviewSubscription.d.ts +0 -13
  68. package/dist/components/checkout/hooks/useProgressBarModel.d.ts +0 -26
  69. package/dist/components/checkout/hooks/useSubscriptionModel.d.ts +0 -5
  70. package/dist/components/checkout/hooks/useSubscriptionState.d.ts +0 -2
  71. package/dist/components/checkout/index.d.ts +0 -3
  72. package/dist/components/checkout/planHeader/PlanHeader.d.ts +0 -7
  73. package/dist/components/checkout/planHeader/PlanHeader.style.d.ts +0 -25
  74. package/dist/components/checkout/planHeader/index.d.ts +0 -1
  75. package/dist/components/checkout/progressBar/CheckoutProgressBar.d.ts +0 -2
  76. package/dist/components/checkout/progressBar/CheckoutProgressBar.style.d.ts +0 -45
  77. package/dist/components/checkout/promotionCode/AddPromotionCode.d.ts +0 -5
  78. package/dist/components/checkout/promotionCode/AddPromotionCodeButton.d.ts +0 -7
  79. package/dist/components/checkout/promotionCode/AppliedPromotionCode.d.ts +0 -6
  80. package/dist/components/checkout/promotionCode/PromotionCodeSection.d.ts +0 -5
  81. package/dist/components/checkout/promotionCode/index.d.ts +0 -1
  82. package/dist/components/checkout/steps/addons/CheckoutAddonsStep.d.ts +0 -2
  83. package/dist/components/checkout/steps/addons/CheckoutAddonsStep.style.d.ts +0 -93
  84. package/dist/components/checkout/steps/addons/addon.utils.d.ts +0 -15
  85. package/dist/components/checkout/steps/addons/index.d.ts +0 -1
  86. package/dist/components/checkout/steps/payment/PaymentMethods.d.ts +0 -19
  87. package/dist/components/checkout/steps/payment/PaymentMethods.style.d.ts +0 -113
  88. package/dist/components/checkout/steps/payment/PaymentStep.d.ts +0 -2
  89. package/dist/components/checkout/steps/payment/index.d.ts +0 -1
  90. package/dist/components/checkout/steps/payment/stripe/StripePaymentForm.d.ts +0 -2
  91. package/dist/components/checkout/steps/payment/stripe/index.d.ts +0 -3
  92. package/dist/components/checkout/steps/payment/stripe/stripe.utils.d.ts +0 -33
  93. package/dist/components/checkout/steps/payment/stripe/useStripeIntegration.d.ts +0 -5
  94. package/dist/components/checkout/steps/payment/stripe/useSubmit.d.ts +0 -10
  95. package/dist/components/checkout/steps/plan/BillingPeriodPicker.d.ts +0 -9
  96. package/dist/components/checkout/steps/plan/BillingPeriodPicker.style.d.ts +0 -52
  97. package/dist/components/checkout/steps/plan/CheckoutChargeList.d.ts +0 -16
  98. package/dist/components/checkout/steps/plan/CheckoutPlanStep.d.ts +0 -4
  99. package/dist/components/checkout/steps/plan/CheckoutPlanStep.style.d.ts +0 -12
  100. package/dist/components/checkout/steps/plan/index.d.ts +0 -1
  101. package/dist/components/checkout/steps/surprise/SurpriseStep.d.ts +0 -2
  102. package/dist/components/checkout/textOverrides.d.ts +0 -28
  103. package/dist/components/checkout/theme.d.ts +0 -12
  104. package/dist/components/hooks/useChargeSort.d.ts +0 -3
  105. package/dist/components/utils/priceUtils.d.ts +0 -2
  106. package/dist/stories/Checkout.stories.d.ts +0 -3
  107. package/src/assets/arrow-forward.svg +0 -3
  108. package/src/assets/arrow-right.svg +0 -6
  109. package/src/assets/close.svg +0 -3
  110. package/src/assets/nyancat.svg +0 -634
  111. package/src/assets/outlined-checked-circle.svg +0 -6
  112. package/src/assets/outlined-circle.svg +0 -3
  113. package/src/assets/payment-method.svg +0 -11
  114. package/src/assets/plus-icon.svg +0 -6
  115. package/src/assets/trash.svg +0 -8
  116. package/src/components/checkout/Checkout.tsx +0 -30
  117. package/src/components/checkout/CheckoutContainer.style.ts +0 -34
  118. package/src/components/checkout/CheckoutContainer.tsx +0 -88
  119. package/src/components/checkout/CheckoutProvider.tsx +0 -140
  120. package/src/components/checkout/CheckoutSummary.tsx +0 -361
  121. package/src/components/checkout/components/Button.tsx +0 -30
  122. package/src/components/checkout/components/InputField.tsx +0 -22
  123. package/src/components/checkout/components/index.ts +0 -2
  124. package/src/components/checkout/formatting.ts +0 -12
  125. package/src/components/checkout/hooks/index.ts +0 -8
  126. package/src/components/checkout/hooks/useAddonsStepModel.ts +0 -96
  127. package/src/components/checkout/hooks/useCheckoutModel.ts +0 -31
  128. package/src/components/checkout/hooks/useCouponModel.ts +0 -28
  129. package/src/components/checkout/hooks/useLoadCheckout.ts +0 -40
  130. package/src/components/checkout/hooks/usePaymentStepModel.ts +0 -49
  131. package/src/components/checkout/hooks/usePlanStepModel.ts +0 -170
  132. package/src/components/checkout/hooks/usePreviewSubscription.ts +0 -82
  133. package/src/components/checkout/hooks/useProgressBarModel.ts +0 -89
  134. package/src/components/checkout/hooks/useSubscriptionModel.ts +0 -16
  135. package/src/components/checkout/hooks/useSubscriptionState.ts +0 -26
  136. package/src/components/checkout/index.ts +0 -3
  137. package/src/components/checkout/planHeader/PlanHeader.style.tsx +0 -23
  138. package/src/components/checkout/planHeader/PlanHeader.tsx +0 -61
  139. package/src/components/checkout/planHeader/index.ts +0 -1
  140. package/src/components/checkout/progressBar/CheckoutProgressBar.style.ts +0 -29
  141. package/src/components/checkout/progressBar/CheckoutProgressBar.tsx +0 -48
  142. package/src/components/checkout/promotionCode/AddPromotionCode.tsx +0 -85
  143. package/src/components/checkout/promotionCode/AddPromotionCodeButton.tsx +0 -39
  144. package/src/components/checkout/promotionCode/AppliedPromotionCode.tsx +0 -37
  145. package/src/components/checkout/promotionCode/PromotionCodeSection.tsx +0 -27
  146. package/src/components/checkout/promotionCode/index.ts +0 -1
  147. package/src/components/checkout/steps/addons/CheckoutAddonsStep.style.tsx +0 -24
  148. package/src/components/checkout/steps/addons/CheckoutAddonsStep.tsx +0 -125
  149. package/src/components/checkout/steps/addons/addon.utils.ts +0 -68
  150. package/src/components/checkout/steps/addons/index.ts +0 -1
  151. package/src/components/checkout/steps/payment/PaymentMethods.style.ts +0 -26
  152. package/src/components/checkout/steps/payment/PaymentMethods.tsx +0 -83
  153. package/src/components/checkout/steps/payment/PaymentStep.tsx +0 -41
  154. package/src/components/checkout/steps/payment/index.ts +0 -1
  155. package/src/components/checkout/steps/payment/stripe/StripePaymentForm.tsx +0 -43
  156. package/src/components/checkout/steps/payment/stripe/index.ts +0 -3
  157. package/src/components/checkout/steps/payment/stripe/stripe.utils.ts +0 -109
  158. package/src/components/checkout/steps/payment/stripe/useStripeIntegration.ts +0 -27
  159. package/src/components/checkout/steps/payment/stripe/useSubmit.ts +0 -100
  160. package/src/components/checkout/steps/plan/BillingPeriodPicker.style.tsx +0 -46
  161. package/src/components/checkout/steps/plan/BillingPeriodPicker.tsx +0 -63
  162. package/src/components/checkout/steps/plan/CheckoutChargeList.tsx +0 -138
  163. package/src/components/checkout/steps/plan/CheckoutPlanStep.style.tsx +0 -6
  164. package/src/components/checkout/steps/plan/CheckoutPlanStep.tsx +0 -22
  165. package/src/components/checkout/steps/plan/index.ts +0 -1
  166. package/src/components/checkout/steps/surprise/SurpriseStep.tsx +0 -27
  167. package/src/components/checkout/textOverrides.ts +0 -58
  168. package/src/components/checkout/theme.ts +0 -43
  169. package/src/components/hooks/useChargeSort.ts +0 -17
  170. package/src/components/utils/priceUtils.ts +0 -10
  171. package/src/stories/Checkout.stories.tsx +0 -62
package/README.md CHANGED
@@ -186,7 +186,7 @@ yarn build-storybook
186
186
  yarn publish-storybook
187
187
  ```
188
188
 
189
- **NOTE:** The `STORYBOOK_STIGG_BASE_URI` environment parameter in `.env.local` file controlling the API url that storybook is going to use.
189
+ **NOTE:** The `BASE_URI` environment parameter in `.env.local` file controlling the API url that storybook is going to use.
190
190
 
191
191
  ### Link package
192
192
 
@@ -1,7 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
+ import { Icons } from './customIcons';
2
3
  import { IconColor } from './iconColor';
3
- import * as customIcons from './customIcons';
4
- export declare type Icons = keyof typeof customIcons;
5
4
  export declare type IconProps = {
6
5
  icon: Icons;
7
6
  className?: string;
@@ -10,4 +9,4 @@ export declare type IconProps = {
10
9
  svgRectColor?: IconColor | string;
11
10
  svgStrokeColor?: IconColor | string;
12
11
  };
13
- export declare function Icon({ icon, className, style, svgPathColor, svgRectColor, svgStrokeColor }: IconProps): JSX.Element;
12
+ export declare function Icon({ icon, className, style, svgPathColor, svgRectColor, svgStrokeColor, }: IconProps): JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  export declare const STIGG_WATERMARK_CLASSNAME = "stigg-watermark";
3
- export declare type PoweredByStiggSources = 'paywall' | 'customer_portal' | 'checkout';
3
+ export declare type PoweredByStiggSources = 'paywall' | 'customer_portal';
4
4
  declare type PoweredByStiggProps = {
5
5
  source: PoweredByStiggSources;
6
6
  showWatermark?: boolean;
@@ -1,17 +1,5 @@
1
- export { default as Addons } from '../../assets/addons.svg';
2
- export { default as BillingInfoCustomer } from '../../assets/billing-info-customer.svg';
3
- export { default as ContactSupport } from '../../assets/contact-support.svg';
4
- export { default as CreditCard } from '../../assets/credit-card.svg';
5
- export { default as DollarCoin } from '../../assets/dollar-coin.svg';
6
- export { default as MiniSchedule } from '../../assets/mini-schedule.svg';
7
- export { default as Promotions } from '../../assets/promotions.svg';
8
- export { default as Restore } from '../../assets/restore.svg';
9
- export { default as ScheduleBox } from '../../assets/schedule-box.svg';
10
- export { default as ScheduleClock } from '../../assets/schedule.svg';
11
- export { default as RenewSubscription } from '../../assets/subscription-renews-icon.svg';
12
- export { default as Trash } from '../../assets/trash.svg';
13
- export { default as PaymentMethod } from '../../assets/payment-method.svg';
14
- export { default as OutlinedCircle } from '../../assets/outlined-circle.svg';
15
- export { default as OutlinedCheckedCircle } from '../../assets/outlined-checked-circle.svg';
16
- export { default as ArrowForward } from '../../assets/arrow-forward.svg';
17
- export { default as Close } from '../../assets/close.svg';
1
+ import { ReactElement, SVGProps } from 'react';
2
+ export declare const ICON_COMPONENTS: {
3
+ [name: string]: ((props: SVGProps<SVGElement>) => ReactElement);
4
+ };
5
+ export declare type Icons = keyof typeof ICON_COMPONENTS;
@@ -1,5 +1,4 @@
1
- import { CheckoutConfiguration, CustomerPortalConfiguration, PaywallConfiguration } from '@stigg/js-client-sdk';
1
+ import { CustomerPortalConfiguration, PaywallConfiguration } from '@stigg/js-client-sdk';
2
2
  import { CustomizedTheme } from '../../theme/Theme';
3
3
  export declare function mapCustomerPortalConfiguration(configuration: CustomerPortalConfiguration): CustomizedTheme;
4
4
  export declare function mapPaywallConfiguration(paywallConfiguration: PaywallConfiguration): CustomizedTheme;
5
- export declare function mapCheckoutConfiguration(configuration: CheckoutConfiguration): CustomizedTheme;
@@ -9,4 +9,4 @@ export declare type SubscriptionTabsProps = {
9
9
  textOverrides: CustomerPortalLocalization;
10
10
  theme: CustomerPortalTheme;
11
11
  };
12
- export declare function SubscriptionTabs({ customerPortal, hiddenSections, textOverrides, theme }: SubscriptionTabsProps): JSX.Element | null;
12
+ export declare function SubscriptionTabs({ customerPortal, hiddenSections, textOverrides, theme, }: SubscriptionTabsProps): JSX.Element | null;
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import { PaywallPlan } from './types';
2
3
  import { PriceTierFragment } from '@stigg/js-client-sdk';
3
- export declare function TiersSelectContainer({ componentId, tiers, tierUnits, selectedTier, handleTierChange, }: {
4
- componentId: string;
4
+ export declare function TiersLayout({ plan, tiers, tierUnits, selectedTier, handleTierChange, }: {
5
+ plan: PaywallPlan;
5
6
  tiers?: PriceTierFragment[] | null;
6
7
  tierUnits?: string;
7
8
  selectedTier?: PriceTierFragment;
@@ -17,6 +17,8 @@ export declare type PaywallLocalization = {
17
17
  };
18
18
  price: {
19
19
  startingAtCaption: string;
20
+ billingPeriod?: (billingPeriod: BillingPeriod) => string;
21
+ pricePeriod: (billingPeriod: BillingPeriod) => string;
20
22
  custom: string;
21
23
  priceNotSet: string;
22
24
  free: PlanPriceText | ((currency?: PaywallCurrency) => PlanPriceText);
@@ -44,6 +46,8 @@ export declare function getResolvedPaywallLocalize(localizeOverride?: DeepPartia
44
46
  } | undefined;
45
47
  price?: {
46
48
  startingAtCaption?: string | undefined;
49
+ billingPeriod?: {} | undefined;
50
+ pricePeriod?: {} | undefined;
47
51
  custom?: string | undefined;
48
52
  priceNotSet?: string | undefined;
49
53
  free?: {
@@ -1,7 +1,5 @@
1
- import { PaywallPlan } from '../paywall/types';
1
+ import { PaywallPlan } from './types';
2
2
  import { BillingPeriod, Price, PriceTierFragment, Subscription } from '@stigg/js-client-sdk';
3
- export declare function getPriceFeatureUnit(price: Price): string;
4
- export declare function getTierByQuantity(tiers: PriceTierFragment[], quantity: number): PriceTierFragment | undefined;
5
3
  export declare function calculateTierPrice(price: Price, currentTier: PriceTierFragment, selectedBillingPeriod: BillingPeriod, shouldShowMonthlyPriceAmount: boolean): number;
6
4
  export declare function getSelectedTier(plan: PaywallPlan, billingPeriod: BillingPeriod, currentSubscription: Subscription | null, selectedTierByFeature: Record<string, PriceTierFragment>): Record<string, PriceTierFragment>;
7
5
  export declare enum PriceTierComparison {
@@ -1,3 +1,2 @@
1
1
  import { PaywallPlan } from '../paywall';
2
- export declare function calculateDiscountRate(monthlyPrice?: number | null, annuallyPrice?: number | null): number | null;
3
2
  export declare function calculatePaywallDiscountRate(plans: PaywallPlan[]): number;
@@ -1,7 +1,7 @@
1
1
  import { Currency } from '@stigg/js-client-sdk';
2
2
  export declare const currencyPriceFormatter: ({ amount, currency, locale, maximumFractionDigits, }: {
3
3
  amount: number;
4
- currency?: string | undefined;
4
+ currency?: Currency | undefined;
5
5
  locale?: string | undefined;
6
6
  maximumFractionDigits?: number | undefined;
7
7
  }) => string;
@@ -1,5 +1,6 @@
1
1
  import { BillingPeriod, PaywallCalculatedPricePoint, Price, PriceTierFragment } from '@stigg/js-client-sdk';
2
2
  import { PlanPriceText } from './getPlanPrice';
3
+ import { PaywallLocalization } from '../paywall';
3
4
  declare type GetPaidPriceTextParams = {
4
5
  planPrices: Price[];
5
6
  paywallCalculatedPrice?: PaywallCalculatedPricePoint;
@@ -7,6 +8,7 @@ declare type GetPaidPriceTextParams = {
7
8
  locale: string;
8
9
  shouldShowMonthlyPriceAmount: boolean;
9
10
  selectedTierByFeature: Record<string, PriceTierFragment>;
11
+ paywallLocale: PaywallLocalization;
10
12
  };
11
- export declare function getPaidPriceText({ planPrices, paywallCalculatedPrice, selectedBillingPeriod, locale, shouldShowMonthlyPriceAmount, selectedTierByFeature, }: GetPaidPriceTextParams): PlanPriceText;
13
+ export declare function getPaidPriceText({ planPrices, paywallCalculatedPrice, selectedBillingPeriod, locale, shouldShowMonthlyPriceAmount, selectedTierByFeature, paywallLocale, }: GetPaidPriceTextParams): PlanPriceText;
12
14
  export {};
package/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ export * from '@stigg/js-client-sdk';
3
3
  export { Paywall, PaywallProps, OnPlanSelectedCallbackFn, PaywallPlan, SubscribeIntentionType, PaywallLocalization, } from './components/paywall';
4
4
  export { CustomerPortalProvider, CustomerPortal, CustomerPortalProps, CustomerPortalSection, AddonsList, PaymentDetailsSection, InvoicesSection, CustomerUsageData, CustomerUsageDataProps, SubscriptionsOverview, SubscriptionsOverviewProps, Promotions, } from './components/customerPortal';
5
5
  export { StiggProvider, StiggProviderProps, useStiggContext, StiggContextValue, StiggContext, } from './components/StiggProvider';
6
- export { Checkout, CheckoutProps, CheckoutTheme } from './components/checkout';
7
6
  export { useWaitForCheckoutCompleted, ProvisionStatus } from './components/hooks';
8
7
  export { HorizontalAlignment, TextAlignment } from './theme/types';
9
8
  export { CustomizedTheme as Theme } from './theme/Theme';