@stigg/react-sdk 4.13.2 → 4.14.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.
- package/dist/components/common/TiersSelectContainer.d.ts +8 -3
- package/dist/components/common/VolumeBulkSelect.d.ts +5 -0
- package/dist/components/common/VolumePerUnitInput.d.ts +5 -0
- package/dist/components/paywall/PlanOfferingButton.d.ts +2 -1
- package/dist/components/paywall/PlanPrice.d.ts +3 -1
- package/dist/components/paywall/paywallTextOverrides.d.ts +1 -1
- package/dist/components/utils/getPaidPriceText.d.ts +2 -1
- package/dist/components/utils/getPlanPrice.d.ts +1 -1
- package/dist/components/utils/priceTierUtils.d.ts +3 -2
- package/dist/react-sdk.cjs.development.js +522 -352
- package/dist/react-sdk.cjs.development.js.map +1 -1
- package/dist/react-sdk.cjs.production.min.js +1 -1
- package/dist/react-sdk.cjs.production.min.js.map +1 -1
- package/dist/react-sdk.esm.js +553 -378
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/checkout/hooks/usePlanStepModel.ts +3 -3
- package/src/components/checkout/steps/plan/CheckoutChargeList.tsx +10 -2
- package/src/components/common/TiersSelectContainer.tsx +33 -62
- package/src/components/common/VolumeBulkSelect.tsx +68 -0
- package/src/components/common/VolumePerUnitInput.tsx +40 -0
- package/src/components/paywall/PlanOffering.tsx +15 -6
- package/src/components/paywall/PlanOfferingButton.tsx +7 -1
- package/src/components/paywall/PlanPrice.tsx +20 -0
- package/src/components/utils/getPaidPriceText.ts +9 -1
- package/src/components/utils/getPlanPrice.ts +2 -0
- package/src/components/utils/priceTierUtils.ts +60 -14
- package/src/stories/mocks/checkout/mockCheckoutPreview.ts +1 -1
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PriceTierFragment } from '@stigg/js-client-sdk';
|
|
3
|
-
export declare
|
|
2
|
+
import { PriceTierFragment, TiersMode } from '@stigg/js-client-sdk';
|
|
3
|
+
export declare type TiersSelectContainerProps = {
|
|
4
4
|
componentId: string;
|
|
5
5
|
tiers?: PriceTierFragment[] | null;
|
|
6
6
|
tierUnits?: string;
|
|
7
7
|
selectedTier?: PriceTierFragment;
|
|
8
8
|
handleTierChange: (tier: PriceTierFragment) => void;
|
|
9
|
-
|
|
9
|
+
tiersMode?: TiersMode | null;
|
|
10
|
+
handlePerUnitQuantityChange: (quantity: number) => void;
|
|
11
|
+
perUnitQuantity?: number;
|
|
12
|
+
width?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function TiersSelectContainer(props: TiersSelectContainerProps): JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TiersSelectContainerProps } from './TiersSelectContainer';
|
|
3
|
+
export declare function VolumeBulkSelect({ selectedTier, componentId, tierUnits, tiers, handleChange, }: Pick<TiersSelectContainerProps, 'selectedTier' | 'componentId' | 'tiers' | 'tierUnits'> & {
|
|
4
|
+
handleChange: (quantity: number) => void;
|
|
5
|
+
}): JSX.Element | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TiersSelectContainerProps } from './TiersSelectContainer';
|
|
3
|
+
export declare function VolumePerUnitInput({ width, tierUnits, perUnitQuantity, handlePerUnitQuantityChange, handleChange, }: Pick<TiersSelectContainerProps, 'width' | 'tierUnits' | 'perUnitQuantity' | 'handlePerUnitQuantityChange'> & {
|
|
4
|
+
handleChange: (quantity: number) => void;
|
|
5
|
+
}): JSX.Element;
|
|
@@ -13,6 +13,7 @@ declare type PlanOfferingButtonProps = {
|
|
|
13
13
|
onPlanSelected: (intentionType: SubscribeIntentionType) => void | Promise<void>;
|
|
14
14
|
withTrialLeftRow: boolean;
|
|
15
15
|
selectedTierByFeature: Record<string, PriceTierFragment>;
|
|
16
|
+
perUnitQuantityByFeature: Record<string, number>;
|
|
16
17
|
};
|
|
17
|
-
export declare function PlanOfferingButton({ isNextPlan, customer, plan, billingPeriod, isCustomerOnTrial, onPlanSelected, paywallLocale, withTrialLeftRow, currentSubscription, selectedTierByFeature, }: PlanOfferingButtonProps): JSX.Element;
|
|
18
|
+
export declare function PlanOfferingButton({ isNextPlan, customer, plan, billingPeriod, isCustomerOnTrial, onPlanSelected, paywallLocale, withTrialLeftRow, currentSubscription, selectedTierByFeature, perUnitQuantityByFeature, }: PlanOfferingButtonProps): JSX.Element;
|
|
18
19
|
export {};
|
|
@@ -2,13 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import { BillingPeriod, PriceTierFragment } from '@stigg/js-client-sdk';
|
|
3
3
|
import { PaywallPlan } from './types';
|
|
4
4
|
import { PaywallLocalization } from './paywallTextOverrides';
|
|
5
|
-
export declare const PlanPrice: ({ showStartingAt, withUnitPriceRow, withStartingAtRow, withTiersRow, selectedTierByFeature, setSelectedTierByFeature, plan, billingPeriod, paywallLocale, locale, hasMonthlyPrice, hasAnnuallyPrice, }: {
|
|
5
|
+
export declare const PlanPrice: ({ showStartingAt, withUnitPriceRow, withStartingAtRow, withTiersRow, selectedTierByFeature, setSelectedTierByFeature, plan, billingPeriod, paywallLocale, locale, hasMonthlyPrice, hasAnnuallyPrice, perUnitQuantityByFeature, setPerUnitQuantityByFeature, }: {
|
|
6
6
|
showStartingAt: boolean;
|
|
7
7
|
withUnitPriceRow: boolean;
|
|
8
8
|
withStartingAtRow: boolean;
|
|
9
9
|
withTiersRow: boolean;
|
|
10
10
|
selectedTierByFeature: Record<string, PriceTierFragment>;
|
|
11
11
|
setSelectedTierByFeature: React.Dispatch<React.SetStateAction<Record<string, PriceTierFragment>>>;
|
|
12
|
+
perUnitQuantityByFeature: Record<string, number>;
|
|
13
|
+
setPerUnitQuantityByFeature: React.Dispatch<React.SetStateAction<Record<string, number>>>;
|
|
12
14
|
plan: PaywallPlan;
|
|
13
15
|
billingPeriod: BillingPeriod;
|
|
14
16
|
paywallLocale: PaywallLocalization;
|
|
@@ -60,7 +60,7 @@ export declare function getResolvedPaywallLocalize(localizeOverride?: DeepPartia
|
|
|
60
60
|
unit?: string | undefined;
|
|
61
61
|
tiers?: ({
|
|
62
62
|
__typename?: "PriceTier" | undefined;
|
|
63
|
-
upTo?: number | undefined;
|
|
63
|
+
upTo?: number | null | undefined;
|
|
64
64
|
unitPrice?: {
|
|
65
65
|
__typename?: "Money" | undefined;
|
|
66
66
|
amount?: number | undefined;
|
|
@@ -9,6 +9,7 @@ declare type GetPaidPriceTextParams = {
|
|
|
9
9
|
shouldShowMonthlyPriceAmount: boolean;
|
|
10
10
|
selectedTierByFeature: Record<string, PriceTierFragment>;
|
|
11
11
|
paywallLocale: PaywallLocalization;
|
|
12
|
+
perUnitQuantityByFeature?: Record<string, number>;
|
|
12
13
|
};
|
|
13
|
-
export declare function getPaidPriceText({ planPrices, paywallCalculatedPrice, selectedBillingPeriod, locale, shouldShowMonthlyPriceAmount, selectedTierByFeature, paywallLocale, }: GetPaidPriceTextParams): PlanPriceText;
|
|
14
|
+
export declare function getPaidPriceText({ planPrices, paywallCalculatedPrice, selectedBillingPeriod, locale, shouldShowMonthlyPriceAmount, selectedTierByFeature, paywallLocale, perUnitQuantityByFeature, }: GetPaidPriceTextParams): PlanPriceText;
|
|
14
15
|
export {};
|
|
@@ -6,4 +6,4 @@ export declare type PlanPriceText = {
|
|
|
6
6
|
tiers?: PriceTierFragment[] | null | undefined;
|
|
7
7
|
tierUnits?: string;
|
|
8
8
|
};
|
|
9
|
-
export declare function getPlanPrice(plan: PaywallPlan, billingPeriod: BillingPeriod, paywallLocale: PaywallLocalization, locale: string, shouldShowMonthlyPriceAmount: boolean, selectedTierByFeature?: Record<string, PriceTierFragment>): PlanPriceText;
|
|
9
|
+
export declare function getPlanPrice(plan: PaywallPlan, billingPeriod: BillingPeriod, paywallLocale: PaywallLocalization, locale: string, shouldShowMonthlyPriceAmount: boolean, selectedTierByFeature?: Record<string, PriceTierFragment>, perUnitQuantityByFeature?: Record<string, number>): PlanPriceText;
|
|
@@ -3,11 +3,12 @@ import { PaywallPlan } from '../paywall';
|
|
|
3
3
|
import { SelectDefaultTierIndexFn } from '../paywall/types';
|
|
4
4
|
export declare function getPriceFeatureUnit(price: Price): string;
|
|
5
5
|
export declare function getTierByQuantity(tiers: PriceTierFragment[], quantity: number): PriceTierFragment | undefined;
|
|
6
|
-
export declare function calculateTierPrice(price: Price, currentTier: PriceTierFragment, selectedBillingPeriod: BillingPeriod, shouldShowMonthlyPriceAmount: boolean): number;
|
|
6
|
+
export declare function calculateTierPrice(price: Price, currentTier: PriceTierFragment, selectedBillingPeriod: BillingPeriod, shouldShowMonthlyPriceAmount: boolean, perUnitQuantity?: number): number;
|
|
7
|
+
export declare function getSelectedTierQuantityBeFeature(plan: PaywallPlan, billingPeriod: BillingPeriod, currentSubscription: Subscription | null): Record<string, number>;
|
|
7
8
|
export declare function getSelectedTier(plan: PaywallPlan, billingPeriod: BillingPeriod, currentSubscription: Subscription | null, selectedTierByFeature: Record<string, PriceTierFragment>, selectDefaultTierIndex?: SelectDefaultTierIndexFn): Record<string, PriceTierFragment>;
|
|
8
9
|
export declare enum PriceTierComparison {
|
|
9
10
|
Lower = -1,
|
|
10
11
|
Equal = 0,
|
|
11
12
|
Higher = 1
|
|
12
13
|
}
|
|
13
|
-
export declare function compareSelectedTierToCurrentTier(selectedTierByFeature: Record<string, PriceTierFragment>, currentSubscription: Subscription | null): PriceTierComparison;
|
|
14
|
+
export declare function compareSelectedTierToCurrentTier(selectedTierByFeature: Record<string, PriceTierFragment>, perUnitQuantityByFeature: Record<string, number>, currentSubscription: Subscription | null): PriceTierComparison;
|