@stigg/react-sdk 4.5.3 → 4.5.4

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 (31) hide show
  1. package/README.md +7 -0
  2. package/dist/components/checkout/CheckoutContainer.d.ts +3 -2
  3. package/dist/components/checkout/hooks/useSubscriptionState.d.ts +2 -2
  4. package/dist/components/checkout/steps/payment/stripe/stripe.utils.d.ts +9 -13
  5. package/dist/components/checkout/steps/payment/stripe/useSubmit.d.ts +2 -1
  6. package/dist/components/customerPortal/paywall/CustomerPortalPaywall.d.ts +0 -1
  7. package/dist/components/customerPortal/paywall/CustomerPortalPaywall.style.d.ts +0 -1
  8. package/dist/components/paywall/Paywall.d.ts +0 -1
  9. package/dist/components/paywall/PlanOffering.d.ts +2 -1
  10. package/dist/components/paywall/PlanOfferingButton.d.ts +1 -2
  11. package/dist/react-sdk.cjs.development.js +284 -259
  12. package/dist/react-sdk.cjs.development.js.map +1 -1
  13. package/dist/react-sdk.cjs.production.min.js +1 -1
  14. package/dist/react-sdk.cjs.production.min.js.map +1 -1
  15. package/dist/react-sdk.esm.js +285 -260
  16. package/dist/react-sdk.esm.js.map +1 -1
  17. package/package.json +2 -2
  18. package/src/components/checkout/CheckoutContainer.tsx +12 -3
  19. package/src/components/checkout/hooks/useSubscriptionState.ts +2 -3
  20. package/src/components/checkout/steps/payment/stripe/stripe.utils.ts +31 -22
  21. package/src/components/checkout/steps/payment/stripe/useSubmit.ts +59 -46
  22. package/src/components/checkout/summary/CheckoutSummary.tsx +1 -0
  23. package/src/components/customerPortal/CustomerPortalContainer.tsx +5 -8
  24. package/src/components/customerPortal/paywall/CustomerPortalPaywall.style.ts +0 -10
  25. package/src/components/customerPortal/paywall/CustomerPortalPaywall.tsx +2 -5
  26. package/src/components/paywall/Paywall.tsx +36 -20
  27. package/src/components/paywall/PaywallContainer.tsx +2 -2
  28. package/src/components/paywall/PlanOffering.tsx +32 -17
  29. package/src/components/paywall/PlanOfferingButton.tsx +1 -3
  30. package/src/components/paywall/utils/mapPaywallData.ts +13 -11
  31. package/src/stories/Checkout.stories.tsx +2 -2
package/README.md CHANGED
@@ -158,6 +158,7 @@ yarn
158
158
  ```
159
159
 
160
160
  2. Create `.env.local` file and add the following environment variables:
161
+
161
162
  ```
162
163
  BASE_URI='http://localhost:4000'
163
164
  API_KEY='<your-api-key>'
@@ -198,3 +199,9 @@ yarn link "@stigg/react-sdk" && yarn link "react" && yarn link "react-dom"
198
199
  ```
199
200
 
200
201
  **NOTE:** It's required to link also react and react-dom packages because otherwise it complains about multiple react versions error (see issue [here](https://github.com/facebook/react/issues/14257#issuecomment-595183610))
202
+
203
+ ### Publish beta version
204
+
205
+ 1. Change `package.json` version to desired beta version in the format of `x.x.x-beta.x`
206
+ 2. Make sure to do a clean build -- `rm -rf dist & yarn build`
207
+ 3. Publish to npm -- `npm publish --tag beta`
@@ -1,13 +1,14 @@
1
1
  /// <reference types="react" />
2
- import { BillingAddress, ApplySubscription, CheckoutStatePlan } from '@stigg/js-client-sdk';
2
+ import { BillingAddress, ApplySubscription, CheckoutStatePlan, ApplySubscriptionResults } from '@stigg/js-client-sdk';
3
3
  import { MockCheckoutPreviewCallback } from './types';
4
4
  export declare type CheckoutResult = {
5
5
  success: boolean;
6
6
  errorMessage?: string;
7
+ results?: ApplySubscriptionResults;
7
8
  };
8
9
  export declare type OnCheckoutParams = {
9
10
  checkoutParams: ApplySubscription;
10
- checkoutAction: () => Promise<CheckoutResult>;
11
+ checkoutAction: (params: ApplySubscription) => Promise<CheckoutResult>;
11
12
  };
12
13
  export declare type OnCheckoutCompletedParams = {
13
14
  success: boolean;
@@ -1,2 +1,2 @@
1
- import { ApplySubscription } from '@stigg/js-client-sdk';
2
- export declare function useSubscriptionState(): ApplySubscription | undefined;
1
+ import { ApplySubscription, PreviewSubscription } from '@stigg/js-client-sdk';
2
+ export declare function useSubscriptionState(): ApplySubscription | PreviewSubscription | undefined;
@@ -11,19 +11,6 @@ export declare function handleStripeFormValidations({ elements }: Pick<StripeEle
11
11
  success: boolean;
12
12
  errorMessage?: undefined;
13
13
  }>;
14
- export declare function handleNewPaymentMethod({ stripe, elements, setupIntentClientSecret, }: {
15
- stripe: Stripe | null;
16
- elements: StripeElements | null;
17
- setupIntentClientSecret?: string;
18
- }): Promise<{
19
- success: boolean;
20
- paymentMethodId?: undefined;
21
- errorMessage?: undefined;
22
- } | {
23
- success: boolean;
24
- paymentMethodId: string | undefined;
25
- errorMessage: string | undefined;
26
- }>;
27
14
  export declare function handleStripeNextAction({ applySubscriptionResults, stripe, }: {
28
15
  applySubscriptionResults: ApplySubscriptionResults;
29
16
  stripe: Stripe | null;
@@ -34,4 +21,13 @@ export declare function handleStripeNextAction({ applySubscriptionResults, strip
34
21
  subscription: import("@stigg/js-client-sdk").Subscription | undefined;
35
22
  errorMessage?: undefined;
36
23
  }>;
24
+ export declare function handleNewPaymentMethod({ stripe, elements, setupIntentClientSecret, }: {
25
+ stripe: Stripe | null;
26
+ elements: StripeElements | null;
27
+ setupIntentClientSecret?: string;
28
+ }): Promise<{
29
+ success: boolean;
30
+ errorMessage?: string;
31
+ paymentMethodId?: string;
32
+ }>;
37
33
  export {};
@@ -7,8 +7,9 @@ export declare type HandleSubmitResult = {
7
7
  };
8
8
  export declare type UseSubmitProps = {
9
9
  onSuccess?: () => void;
10
+ isMocked?: boolean;
10
11
  } & Pick<CheckoutContainerProps, 'onCheckout' | 'onCheckoutCompleted' | 'disableSuccessAnimation'>;
11
- export declare function useSubmit({ onCheckout, onCheckoutCompleted, onSuccess, disableSuccessAnimation }: UseSubmitProps): {
12
+ export declare function useSubmit({ isMocked, onCheckout, onCheckoutCompleted, onSuccess, disableSuccessAnimation, }: UseSubmitProps): {
12
13
  handleSubmit: (e: any) => Promise<HandleSubmitResult>;
13
14
  isLoading: boolean;
14
15
  };
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { CustomerPortalTheme } from '../customerPortalTheme';
3
3
  declare type CustomerPortalPaywallProps = {
4
4
  paywallComponent?: React.ReactNode;
5
- hidePaywallButtons: boolean;
6
5
  theme: CustomerPortalTheme;
7
6
  title: string;
8
7
  isLoading: boolean;
@@ -9,7 +9,6 @@ export declare const CustomerPortalPaywallLayout: import("@emotion/styled/macro"
9
9
  } & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
10
10
  theme?: import("@emotion/react").Theme | undefined;
11
11
  } & {
12
- $hideButtons: boolean;
13
12
  $backgroundColor: string;
14
13
  $borderColor: string;
15
14
  }, {}, {}>;
@@ -10,7 +10,6 @@ declare type PaywallProps = {
10
10
  highlightedPlanId?: string;
11
11
  onBillingPeriodChanged: (billingPeriod: BillingPeriod) => void;
12
12
  availableBillingPeriods: BillingPeriod[];
13
- isLoading: boolean;
14
13
  isCustomerOnTrial: boolean;
15
14
  onPlanSelected: OnPlanSelectedCallbackFn;
16
15
  paywallLocale: PaywallLocalization;
@@ -19,6 +19,7 @@ declare type PlanOfferingProps = {
19
19
  paywallLocale: PaywallLocalization;
20
20
  locale: string;
21
21
  withStartingAtRow: boolean;
22
+ isCustomerInCustomPlan: boolean;
22
23
  };
23
- export declare function PlanOffering({ withUnitPriceRow, withTiersRow, withTrialLeftRow, customer, plan, billingPeriod, isHighlighted, currentSubscription, shouldShowDescriptionSection, hasMonthlyPrice, hasAnnuallyPrice, isCustomerOnTrial, onPlanSelected, paywallLocale, locale, withStartingAtRow, }: PlanOfferingProps): JSX.Element;
24
+ export declare function PlanOffering({ withUnitPriceRow, withTiersRow, withTrialLeftRow, customer, plan, billingPeriod, isHighlighted, currentSubscription, shouldShowDescriptionSection, hasMonthlyPrice, hasAnnuallyPrice, isCustomerOnTrial, onPlanSelected, paywallLocale, locale, withStartingAtRow, isCustomerInCustomPlan, }: PlanOfferingProps): JSX.Element;
24
25
  export {};
@@ -11,9 +11,8 @@ declare type PlanOfferingButtonProps = {
11
11
  isCustomerOnTrial: boolean;
12
12
  paywallLocale: PaywallLocalization;
13
13
  onPlanSelected: (intentionType: SubscribeIntentionType) => void | Promise<void>;
14
- hasTiersRow: boolean;
15
14
  withTrialLeftRow: boolean;
16
15
  selectedTierByFeature: Record<string, PriceTierFragment>;
17
16
  };
18
- export declare function PlanOfferingButton({ isNextPlan, customer, plan, billingPeriod, isCustomerOnTrial, onPlanSelected, paywallLocale, hasTiersRow, withTrialLeftRow, currentSubscription, selectedTierByFeature, }: PlanOfferingButtonProps): JSX.Element;
17
+ export declare function PlanOfferingButton({ isNextPlan, customer, plan, billingPeriod, isCustomerOnTrial, onPlanSelected, paywallLocale, withTrialLeftRow, currentSubscription, selectedTierByFeature, }: PlanOfferingButtonProps): JSX.Element;
19
18
  export {};