@stigg/react-sdk 4.3.0-beta.0 → 4.3.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 (170) 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 +0 -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 +2 -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/index.d.ts +0 -1
  13. package/dist/react-sdk.cjs.development.js +201 -3447
  14. package/dist/react-sdk.cjs.development.js.map +1 -1
  15. package/dist/react-sdk.cjs.production.min.js +1 -1
  16. package/dist/react-sdk.cjs.production.min.js.map +1 -1
  17. package/dist/react-sdk.esm.js +207 -3590
  18. package/dist/react-sdk.esm.js.map +1 -1
  19. package/dist/theme/getResolvedTheme.d.ts +0 -1
  20. package/dist/theme/types.d.ts +0 -1
  21. package/package.json +22 -11
  22. package/src/components/StiggProvider.tsx +2 -0
  23. package/src/components/common/Icon.tsx +22 -17
  24. package/src/components/common/PoweredByStigg.tsx +1 -1
  25. package/src/components/common/Typography.tsx +1 -11
  26. package/src/components/common/customIcons.ts +28 -17
  27. package/src/components/common/mapExternalTheme.ts +0 -6
  28. package/src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.tsx +12 -6
  29. package/src/components/paywall/Paywall.tsx +1 -1
  30. package/src/components/paywall/PlanOffering.tsx +1 -1
  31. package/src/components/paywall/PlanOfferingButton.tsx +1 -1
  32. package/src/components/paywall/PlanPrice.tsx +13 -5
  33. package/src/components/{common/TiersSelectContainer.tsx → paywall/TiersLayout.tsx} +7 -8
  34. package/src/components/paywall/paywallTextOverrides.ts +1 -0
  35. package/src/components/{utils/priceTierUtils.ts → paywall/planPriceTier.ts} +3 -25
  36. package/src/components/paywall/utils/calculateUnitQuantityText.ts +4 -9
  37. package/src/components/utils/calculateDiscountRate.ts +1 -1
  38. package/src/components/utils/currencyUtils.ts +1 -1
  39. package/src/components/utils/getPaidPriceText.ts +2 -2
  40. package/src/index.ts +0 -1
  41. package/src/stories/CustomerPortal.stories.tsx +11 -11
  42. package/src/stories/Paywall.stories.tsx +4 -6
  43. package/src/stories/baseArgs.ts +1 -1
  44. package/src/theme/Fonts.tsx +1 -1
  45. package/src/theme/Theme.tsx +7 -9
  46. package/src/theme/getResolvedTheme.ts +0 -1
  47. package/src/theme/types.ts +0 -1
  48. package/dist/components/checkout/Checkout.d.ts +0 -5
  49. package/dist/components/checkout/CheckoutContainer.d.ts +0 -22
  50. package/dist/components/checkout/CheckoutContainer.style.d.ts +0 -29
  51. package/dist/components/checkout/CheckoutProvider.d.ts +0 -33
  52. package/dist/components/checkout/CheckoutSummary.d.ts +0 -9
  53. package/dist/components/checkout/components/Button.d.ts +0 -6
  54. package/dist/components/checkout/components/InputField.d.ts +0 -8
  55. package/dist/components/checkout/components/index.d.ts +0 -2
  56. package/dist/components/checkout/formatting.d.ts +0 -2
  57. package/dist/components/checkout/hooks/index.d.ts +0 -8
  58. package/dist/components/checkout/hooks/useAddonsStepModel.d.ts +0 -21
  59. package/dist/components/checkout/hooks/useCheckoutModel.d.ts +0 -9
  60. package/dist/components/checkout/hooks/useCouponModel.d.ts +0 -7
  61. package/dist/components/checkout/hooks/useLoadCheckout.d.ts +0 -13
  62. package/dist/components/checkout/hooks/usePaymentStepModel.d.ts +0 -16
  63. package/dist/components/checkout/hooks/usePlanStepModel.d.ts +0 -23
  64. package/dist/components/checkout/hooks/usePreviewSubscription.d.ts +0 -13
  65. package/dist/components/checkout/hooks/useProgressBarModel.d.ts +0 -26
  66. package/dist/components/checkout/hooks/useSubscriptionModel.d.ts +0 -5
  67. package/dist/components/checkout/hooks/useSubscriptionState.d.ts +0 -2
  68. package/dist/components/checkout/index.d.ts +0 -3
  69. package/dist/components/checkout/planHeader/PlanHeader.d.ts +0 -7
  70. package/dist/components/checkout/planHeader/PlanHeader.style.d.ts +0 -25
  71. package/dist/components/checkout/planHeader/index.d.ts +0 -1
  72. package/dist/components/checkout/progressBar/CheckoutProgressBar.d.ts +0 -2
  73. package/dist/components/checkout/progressBar/CheckoutProgressBar.style.d.ts +0 -45
  74. package/dist/components/checkout/promotionCode/AddPromotionCode.d.ts +0 -5
  75. package/dist/components/checkout/promotionCode/AddPromotionCodeButton.d.ts +0 -7
  76. package/dist/components/checkout/promotionCode/AppliedPromotionCode.d.ts +0 -6
  77. package/dist/components/checkout/promotionCode/PromotionCodeSection.d.ts +0 -5
  78. package/dist/components/checkout/promotionCode/index.d.ts +0 -1
  79. package/dist/components/checkout/steps/addons/CheckoutAddonsStep.d.ts +0 -2
  80. package/dist/components/checkout/steps/addons/CheckoutAddonsStep.style.d.ts +0 -93
  81. package/dist/components/checkout/steps/addons/addon.utils.d.ts +0 -15
  82. package/dist/components/checkout/steps/addons/index.d.ts +0 -1
  83. package/dist/components/checkout/steps/payment/PaymentMethods.d.ts +0 -19
  84. package/dist/components/checkout/steps/payment/PaymentMethods.style.d.ts +0 -113
  85. package/dist/components/checkout/steps/payment/PaymentStep.d.ts +0 -2
  86. package/dist/components/checkout/steps/payment/index.d.ts +0 -1
  87. package/dist/components/checkout/steps/payment/stripe/StripePaymentForm.d.ts +0 -2
  88. package/dist/components/checkout/steps/payment/stripe/index.d.ts +0 -3
  89. package/dist/components/checkout/steps/payment/stripe/stripe.utils.d.ts +0 -33
  90. package/dist/components/checkout/steps/payment/stripe/useStripeIntegration.d.ts +0 -5
  91. package/dist/components/checkout/steps/payment/stripe/useSubmit.d.ts +0 -10
  92. package/dist/components/checkout/steps/plan/BillingPeriodPicker.d.ts +0 -9
  93. package/dist/components/checkout/steps/plan/BillingPeriodPicker.style.d.ts +0 -52
  94. package/dist/components/checkout/steps/plan/CheckoutChargeList.d.ts +0 -16
  95. package/dist/components/checkout/steps/plan/CheckoutPlanStep.d.ts +0 -4
  96. package/dist/components/checkout/steps/plan/CheckoutPlanStep.style.d.ts +0 -12
  97. package/dist/components/checkout/steps/plan/index.d.ts +0 -1
  98. package/dist/components/checkout/steps/surprise/SurpriseStep.d.ts +0 -2
  99. package/dist/components/checkout/textOverrides.d.ts +0 -28
  100. package/dist/components/checkout/theme.d.ts +0 -8
  101. package/dist/components/checkout/types.d.ts +0 -7
  102. package/dist/components/hooks/useChargeSort.d.ts +0 -3
  103. package/dist/components/utils/priceUtils.d.ts +0 -2
  104. package/dist/stories/Checkout.stories.d.ts +0 -3
  105. package/src/assets/arrow-forward.svg +0 -3
  106. package/src/assets/arrow-right.svg +0 -6
  107. package/src/assets/close.svg +0 -3
  108. package/src/assets/nyancat.svg +0 -634
  109. package/src/assets/outlined-checked-circle.svg +0 -6
  110. package/src/assets/outlined-circle.svg +0 -3
  111. package/src/assets/payment-method.svg +0 -11
  112. package/src/assets/plus-icon.svg +0 -6
  113. package/src/assets/trash.svg +0 -8
  114. package/src/components/checkout/Checkout.tsx +0 -30
  115. package/src/components/checkout/CheckoutContainer.style.ts +0 -34
  116. package/src/components/checkout/CheckoutContainer.tsx +0 -92
  117. package/src/components/checkout/CheckoutProvider.tsx +0 -135
  118. package/src/components/checkout/CheckoutSummary.tsx +0 -361
  119. package/src/components/checkout/components/Button.tsx +0 -30
  120. package/src/components/checkout/components/InputField.tsx +0 -23
  121. package/src/components/checkout/components/index.ts +0 -2
  122. package/src/components/checkout/formatting.ts +0 -12
  123. package/src/components/checkout/hooks/index.ts +0 -8
  124. package/src/components/checkout/hooks/useAddonsStepModel.ts +0 -96
  125. package/src/components/checkout/hooks/useCheckoutModel.ts +0 -31
  126. package/src/components/checkout/hooks/useCouponModel.ts +0 -28
  127. package/src/components/checkout/hooks/useLoadCheckout.ts +0 -40
  128. package/src/components/checkout/hooks/usePaymentStepModel.ts +0 -49
  129. package/src/components/checkout/hooks/usePlanStepModel.ts +0 -170
  130. package/src/components/checkout/hooks/usePreviewSubscription.ts +0 -82
  131. package/src/components/checkout/hooks/useProgressBarModel.ts +0 -89
  132. package/src/components/checkout/hooks/useSubscriptionModel.ts +0 -16
  133. package/src/components/checkout/hooks/useSubscriptionState.ts +0 -26
  134. package/src/components/checkout/index.ts +0 -3
  135. package/src/components/checkout/planHeader/PlanHeader.style.tsx +0 -23
  136. package/src/components/checkout/planHeader/PlanHeader.tsx +0 -61
  137. package/src/components/checkout/planHeader/index.ts +0 -1
  138. package/src/components/checkout/progressBar/CheckoutProgressBar.style.ts +0 -29
  139. package/src/components/checkout/progressBar/CheckoutProgressBar.tsx +0 -48
  140. package/src/components/checkout/promotionCode/AddPromotionCode.tsx +0 -85
  141. package/src/components/checkout/promotionCode/AddPromotionCodeButton.tsx +0 -39
  142. package/src/components/checkout/promotionCode/AppliedPromotionCode.tsx +0 -37
  143. package/src/components/checkout/promotionCode/PromotionCodeSection.tsx +0 -27
  144. package/src/components/checkout/promotionCode/index.ts +0 -1
  145. package/src/components/checkout/steps/addons/CheckoutAddonsStep.style.tsx +0 -24
  146. package/src/components/checkout/steps/addons/CheckoutAddonsStep.tsx +0 -125
  147. package/src/components/checkout/steps/addons/addon.utils.ts +0 -68
  148. package/src/components/checkout/steps/addons/index.ts +0 -1
  149. package/src/components/checkout/steps/payment/PaymentMethods.style.ts +0 -26
  150. package/src/components/checkout/steps/payment/PaymentMethods.tsx +0 -83
  151. package/src/components/checkout/steps/payment/PaymentStep.tsx +0 -41
  152. package/src/components/checkout/steps/payment/index.ts +0 -1
  153. package/src/components/checkout/steps/payment/stripe/StripePaymentForm.tsx +0 -43
  154. package/src/components/checkout/steps/payment/stripe/index.ts +0 -3
  155. package/src/components/checkout/steps/payment/stripe/stripe.utils.ts +0 -109
  156. package/src/components/checkout/steps/payment/stripe/useStripeIntegration.ts +0 -27
  157. package/src/components/checkout/steps/payment/stripe/useSubmit.ts +0 -100
  158. package/src/components/checkout/steps/plan/BillingPeriodPicker.style.tsx +0 -46
  159. package/src/components/checkout/steps/plan/BillingPeriodPicker.tsx +0 -63
  160. package/src/components/checkout/steps/plan/CheckoutChargeList.tsx +0 -138
  161. package/src/components/checkout/steps/plan/CheckoutPlanStep.style.tsx +0 -6
  162. package/src/components/checkout/steps/plan/CheckoutPlanStep.tsx +0 -22
  163. package/src/components/checkout/steps/plan/index.ts +0 -1
  164. package/src/components/checkout/steps/surprise/SurpriseStep.tsx +0 -27
  165. package/src/components/checkout/textOverrides.ts +0 -58
  166. package/src/components/checkout/theme.ts +0 -26
  167. package/src/components/checkout/types.ts +0 -7
  168. package/src/components/hooks/useChargeSort.ts +0 -17
  169. package/src/components/utils/priceUtils.ts +0 -10
  170. package/src/stories/Checkout.stories.tsx +0 -59
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,6 +1,4 @@
1
1
  import { CustomerPortalConfiguration, PaywallConfiguration } from '@stigg/js-client-sdk';
2
2
  import { CustomizedTheme } from '../../theme/Theme';
3
- import { CheckoutConfiguration } from '../checkout/types';
4
3
  export declare function mapCustomerPortalConfiguration(configuration: CustomerPortalConfiguration): CustomizedTheme;
5
4
  export declare function mapPaywallConfiguration(paywallConfiguration: PaywallConfiguration): CustomizedTheme;
6
- 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,7 @@ export declare type PaywallLocalization = {
17
17
  };
18
18
  price: {
19
19
  startingAtCaption: string;
20
+ billingPeriod?: (billingPeriod: BillingPeriod) => string;
20
21
  custom: string;
21
22
  priceNotSet: string;
22
23
  free: PlanPriceText | ((currency?: PaywallCurrency) => PlanPriceText);
@@ -44,6 +45,7 @@ export declare function getResolvedPaywallLocalize(localizeOverride?: DeepPartia
44
45
  } | undefined;
45
46
  price?: {
46
47
  startingAtCaption?: string | undefined;
48
+ billingPeriod?: {} | undefined;
47
49
  custom?: string | undefined;
48
50
  priceNotSet?: string | undefined;
49
51
  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;
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, CheckoutConfiguration } 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';