@stigg/react-sdk 4.1.1 → 4.2.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.
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { BillingPeriod, Customer, Subscription } from '@stigg/js-client-sdk';
2
+ import { BillableFeature, BillingPeriod, Customer, Subscription } from '@stigg/js-client-sdk';
3
3
  import { PaywallPlan, SubscribeIntentionType } from './types';
4
4
  import { PaywallLocalization } from './paywallTextOverrides';
5
5
  declare type PlanOfferingProps = {
6
6
  withUnitPriceRow: boolean;
7
+ withTiersRow: boolean;
8
+ withTrialLeftRow: boolean;
7
9
  customer: Customer | null;
8
10
  plan: PaywallPlan;
9
11
  billingPeriod: BillingPeriod;
@@ -13,10 +15,10 @@ declare type PlanOfferingProps = {
13
15
  hasAnnuallyPrice: boolean;
14
16
  hasMonthlyPrice: boolean;
15
17
  isCustomerOnTrial: boolean;
16
- onPlanSelected: (intentionType: SubscribeIntentionType) => void | Promise<void>;
18
+ onPlanSelected: (intentionType: SubscribeIntentionType, billableFeatures: BillableFeature[]) => void | Promise<void>;
17
19
  paywallLocale: PaywallLocalization;
18
20
  locale: string;
19
- withStartingAtRow?: boolean;
21
+ withStartingAtRow: boolean;
20
22
  };
21
- export declare function PlanOffering({ withUnitPriceRow, customer, plan, billingPeriod, isHighlighted, currentSubscription, shouldShowDescriptionSection, hasMonthlyPrice, hasAnnuallyPrice, isCustomerOnTrial, onPlanSelected, paywallLocale, locale, withStartingAtRow, }: PlanOfferingProps): JSX.Element;
23
+ export declare function PlanOffering({ withUnitPriceRow, withTiersRow, withTrialLeftRow, customer, plan, billingPeriod, isHighlighted, currentSubscription, shouldShowDescriptionSection, hasMonthlyPrice, hasAnnuallyPrice, isCustomerOnTrial, onPlanSelected, paywallLocale, locale, withStartingAtRow, }: PlanOfferingProps): JSX.Element;
22
24
  export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { BillingPeriod, Customer, Subscription } from '@stigg/js-client-sdk';
2
+ import { BillingPeriod, Customer, PriceTierFragment, Subscription } from '@stigg/js-client-sdk';
3
3
  import { PaywallPlan, SubscribeIntentionType } from './types';
4
4
  import { PaywallLocalization } from './paywallTextOverrides';
5
5
  declare type PlanOfferingButtonProps = {
@@ -11,6 +11,9 @@ declare type PlanOfferingButtonProps = {
11
11
  isCustomerOnTrial: boolean;
12
12
  paywallLocale: PaywallLocalization;
13
13
  onPlanSelected: (intentionType: SubscribeIntentionType) => void | Promise<void>;
14
+ hasTiersRow: boolean;
15
+ withTrialLeftRow: boolean;
16
+ selectedTierByFeature: Record<string, PriceTierFragment>;
14
17
  };
15
- export declare function PlanOfferingButton({ isNextPlan, customer, plan, billingPeriod, isCustomerOnTrial, onPlanSelected, paywallLocale, }: PlanOfferingButtonProps): JSX.Element;
18
+ export declare function PlanOfferingButton({ isNextPlan, customer, plan, billingPeriod, isCustomerOnTrial, onPlanSelected, paywallLocale, hasTiersRow, withTrialLeftRow, currentSubscription, selectedTierByFeature, }: PlanOfferingButtonProps): JSX.Element;
16
19
  export {};
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { PaywallPlan } from './types';
3
+ import { PaywallLocalization } from './paywallTextOverrides';
4
+ import { BillingPeriod, PriceTierFragment } from '@stigg/js-client-sdk';
5
+ export declare const PlanPrice: ({ showStartingAt, withUnitPriceRow, withStartingAtRow, withTiersRow, selectedTierByFeature, setSelectedTierByFeature, plan, billingPeriod, paywallLocale, locale, hasMonthlyPrice, hasAnnuallyPrice, }: {
6
+ showStartingAt: boolean;
7
+ withUnitPriceRow: boolean;
8
+ withStartingAtRow: boolean;
9
+ withTiersRow: boolean;
10
+ selectedTierByFeature: Record<string, PriceTierFragment>;
11
+ setSelectedTierByFeature: (selectedTierByFeature: Record<string, PriceTierFragment>) => void;
12
+ plan: PaywallPlan;
13
+ billingPeriod: BillingPeriod;
14
+ paywallLocale: PaywallLocalization;
15
+ hasMonthlyPrice: boolean;
16
+ hasAnnuallyPrice: boolean;
17
+ locale: string;
18
+ }) => JSX.Element;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { PaywallPlan } from './types';
3
+ import { PriceTierFragment } from '@stigg/js-client-sdk';
4
+ export declare function TiersLayout({ plan, tiers, tierUnits, selectedTier, handleTierChange, }: {
5
+ plan: PaywallPlan;
6
+ tiers?: PriceTierFragment[] | null;
7
+ tierUnits?: string;
8
+ selectedTier?: PriceTierFragment;
9
+ handleTierChange: (tier: PriceTierFragment) => void;
10
+ }): JSX.Element;
@@ -1,4 +1,4 @@
1
- import { BillingPeriod, PaywallCalculatedPricePoint, PaywallCurrency, Plan, Price } from '@stigg/js-client-sdk';
1
+ import { BillingPeriod, PaywallCalculatedPricePoint, PaywallCurrency, Plan, Price, PriceTierFragment } from '@stigg/js-client-sdk';
2
2
  import { DeepPartial } from '../../types';
3
3
  import { PlanPriceText } from '../utils/getPlanPrice';
4
4
  import { PaywallPlan } from './types';
@@ -25,6 +25,7 @@ export declare type PaywallLocalization = {
25
25
  paywallCalculatedPrice?: PaywallCalculatedPricePoint;
26
26
  plan: Plan;
27
27
  selectedBillingPeriod: BillingPeriod;
28
+ selectedTier?: PriceTierFragment;
28
29
  }) => PlanPriceText;
29
30
  };
30
31
  };
@@ -48,6 +49,16 @@ export declare function getResolvedPaywallLocalize(localizeOverride?: DeepPartia
48
49
  free?: {
49
50
  price?: string | undefined;
50
51
  unit?: string | undefined;
52
+ tiers?: ({
53
+ __typename?: "PriceTier" | undefined;
54
+ upTo?: number | undefined;
55
+ unitPrice?: {
56
+ __typename?: "Money" | undefined;
57
+ amount?: number | undefined;
58
+ currency?: import("@stigg/js-client-sdk").Currency | undefined;
59
+ } | undefined;
60
+ } | undefined)[] | null | undefined;
61
+ tierUnits?: string | undefined;
51
62
  } | {} | undefined;
52
63
  paid?: {} | undefined;
53
64
  } | undefined;
@@ -0,0 +1,10 @@
1
+ import { PaywallPlan } from './types';
2
+ import { BillingPeriod, Price, PriceTierFragment, Subscription } from '@stigg/js-client-sdk';
3
+ export declare function calculateTierPrice(price: Price, currentTier: PriceTierFragment, selectedBillingPeriod: BillingPeriod, shouldShowMonthlyPriceAmount: boolean): number;
4
+ export declare function getSelectedTier(plan: PaywallPlan, billingPeriod: BillingPeriod, currentSubscription: Subscription | null, selectedTierByFeature: Record<string, PriceTierFragment>): Record<string, PriceTierFragment>;
5
+ export declare enum PriceTierComparison {
6
+ Lower = -1,
7
+ Equal = 0,
8
+ Higher = 1
9
+ }
10
+ export declare function compareSelectedTierToCurrentTier(selectedTierByFeature: Record<string, PriceTierFragment>, currentSubscription: Subscription | null): PriceTierComparison;
@@ -1,4 +1,4 @@
1
- import { BillingPeriod, Customer, Plan, Subscription, CustomerPortalSubscriptionScheduledUpdateDataFragment, PaywallCurrency, PaywallCalculatedPricePoint } from '@stigg/js-client-sdk';
1
+ import { BillingPeriod, Customer, Plan, Subscription, CustomerPortalSubscriptionScheduledUpdateDataFragment, PaywallCurrency, PaywallCalculatedPricePoint, BillableFeature } from '@stigg/js-client-sdk';
2
2
  import { CustomizedTheme } from '../../theme/Theme';
3
3
  export declare type PaywallData = {
4
4
  plans: PaywallPlan[] | null;
@@ -32,10 +32,11 @@ export declare type PaywallPlan = Plan & {
32
32
  paywallCurrency?: PaywallCurrency;
33
33
  paywallCalculatedPricePoints?: PaywallCalculatedPricePoint[];
34
34
  };
35
- export declare type OnPlanSelectedCallbackFn = ({ plan, customer, subscription, intentionType, selectedBillingPeriod, }: {
35
+ export declare type OnPlanSelectedCallbackFn = ({ plan, customer, subscription, intentionType, selectedBillingPeriod, billableFeatures, }: {
36
36
  plan: Plan;
37
37
  customer: Customer | null;
38
38
  subscription: Subscription | null;
39
39
  intentionType: SubscribeIntentionType;
40
40
  selectedBillingPeriod: BillingPeriod;
41
+ billableFeatures?: BillableFeature[];
41
42
  }) => void | Promise<void>;
@@ -1,4 +1,4 @@
1
- import { BillingPeriod, PaywallCalculatedPricePoint, Price } from '@stigg/js-client-sdk';
1
+ import { BillingPeriod, PaywallCalculatedPricePoint, Price, PriceTierFragment } from '@stigg/js-client-sdk';
2
2
  import { PlanPriceText } from './getPlanPrice';
3
3
  declare type GetPaidPriceTextParams = {
4
4
  planPrices: Price[];
@@ -6,6 +6,7 @@ declare type GetPaidPriceTextParams = {
6
6
  selectedBillingPeriod: BillingPeriod;
7
7
  locale: string;
8
8
  shouldShowMonthlyPriceAmount: boolean;
9
+ selectedTierByFeature: Record<string, PriceTierFragment>;
9
10
  };
10
- export declare function getPaidPriceText({ planPrices, paywallCalculatedPrice, selectedBillingPeriod, locale, shouldShowMonthlyPriceAmount, }: GetPaidPriceTextParams): PlanPriceText;
11
+ export declare function getPaidPriceText({ planPrices, paywallCalculatedPrice, selectedBillingPeriod, locale, shouldShowMonthlyPriceAmount, selectedTierByFeature, }: GetPaidPriceTextParams): PlanPriceText;
11
12
  export {};
@@ -1,8 +1,10 @@
1
- import { BillingPeriod } from '@stigg/js-client-sdk';
1
+ import { BillingPeriod, PriceTierFragment } from '@stigg/js-client-sdk';
2
2
  import { PaywallPlan } from '../paywall';
3
3
  import { PaywallLocalization } from '../paywall';
4
4
  export declare type PlanPriceText = {
5
5
  price: string;
6
6
  unit?: string;
7
+ tiers?: PriceTierFragment[] | null | undefined;
8
+ tierUnits?: string;
7
9
  };
8
- export declare function getPlanPrice(plan: PaywallPlan, billingPeriod: BillingPeriod, paywallLocale: PaywallLocalization, locale: string, shouldShowMonthlyPriceAmount: boolean): PlanPriceText;
10
+ export declare function getPlanPrice(plan: PaywallPlan, billingPeriod: BillingPeriod, paywallLocale: PaywallLocalization, locale: string, shouldShowMonthlyPriceAmount: boolean, selectedTierByFeature?: Record<string, PriceTierFragment>): PlanPriceText;