@stigg/react-sdk 4.8.1 → 4.10.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/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.d.ts +1 -1
- package/dist/components/customerPortal/usage/featureUsage/EntitlementCTAButton.d.ts +1 -1
- package/dist/components/paywall/Paywall.d.ts +3 -2
- package/dist/components/paywall/PaywallContainer.d.ts +3 -2
- package/dist/components/paywall/types.d.ts +3 -0
- package/dist/components/paywall/utils/getPlansToDisplay.d.ts +2 -2
- package/dist/react-sdk.cjs.development.js +30 -23
- 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 +30 -23
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +7 -4
- package/src/components/checkout/hooks/useCouponModel.ts +1 -1
- package/src/components/checkout/steps/addons/addon.utils.ts +6 -6
- package/src/components/common/PoweredByStigg.tsx +1 -2
- package/src/components/common/iconColor.ts +2 -4
- package/src/components/customerPortal/CustomerPortal.style.ts +2 -2
- package/src/components/customerPortal/CustomerPortalProvider.tsx +1 -2
- package/src/components/customerPortal/billing/InformationGrid.tsx +1 -2
- package/src/components/customerPortal/billing/InvoicesSection.tsx +9 -4
- package/src/components/customerPortal/common/ExternalLinkButton.tsx +2 -3
- package/src/components/customerPortal/common/SectionContainer.tsx +1 -1
- package/src/components/customerPortal/common/SectionHeader.ts +4 -2
- package/src/components/customerPortal/common/SkeletonButton.tsx +1 -1
- package/src/components/customerPortal/subscriptionOverview/ContactCustomerSupport.tsx +1 -2
- package/src/components/customerPortal/subscriptionOverview/SubscriptionsOverview.tsx +1 -2
- package/src/components/customerPortal/subscriptionOverview/SubscriptionsOverviewHeader.tsx +3 -8
- package/src/components/customerPortal/subscriptionOverview/charges/ChargeItem.tsx +1 -1
- package/src/components/customerPortal/subscriptionOverview/charges/ChargeList.tsx +1 -1
- package/src/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.tsx +8 -4
- package/src/components/customerPortal/subscriptionOverview/tabs/AddonsList.tsx +1 -1
- package/src/components/customerPortal/subscriptionOverview/tabs/Promotions.tsx +1 -1
- package/src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.tsx +2 -2
- package/src/components/customerPortal/subscriptionOverview/upcomingBilling/NoUpcomingBilling.tsx +4 -2
- package/src/components/customerPortal/subscriptionOverview/upcomingBilling/UpcomingBilling.tsx +1 -1
- package/src/components/customerPortal/types.ts +2 -2
- package/src/components/customerPortal/usage/featureUsage/EntitlementCTAButton.tsx +10 -3
- package/src/components/customerPortal/usage/featureUsage/FeatureUsage.style.ts +1 -1
- package/src/components/customerPortal/usage/featureUsage/FeatureUsage.tsx +2 -4
- package/src/components/hooks/useChargeSort.ts +2 -2
- package/src/components/paywall/Paywall.tsx +4 -2
- package/src/components/paywall/PaywallContainer.tsx +4 -1
- package/src/components/paywall/PlanEntitlements.tsx +4 -4
- package/src/components/paywall/paywallTextOverrides.ts +2 -2
- package/src/components/paywall/types.ts +2 -0
- package/src/components/paywall/utils/computeDefaultBillingPeriod.ts +2 -2
- package/src/components/paywall/utils/getPlansToDisplay.ts +10 -4
- package/src/components/paywall/utils/hasPricePoints.ts +3 -3
- package/src/components/utils/calculateDiscountRate.ts +3 -3
- package/src/components/utils/getFeatureName.ts +7 -3
- package/src/components/utils/getPlanPrice.ts +2 -2
- package/src/components/utils/priceTierUtils.ts +6 -4
- package/src/stories/Paywall.stories.tsx +1 -0
- package/src/types.ts +1 -1
|
@@ -5,8 +5,12 @@ export function getFeatureDisplayName(feature: FeatureFragment) {
|
|
|
5
5
|
return getFeatureDisplayNameText(feature.displayName, feature.featureUnits, feature.featureUnitsPlural);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export function getFeatureDisplayNameText(
|
|
9
|
-
|
|
8
|
+
export function getFeatureDisplayNameText(
|
|
9
|
+
featureDisplayName: string,
|
|
10
|
+
featureUnits: string | undefined | null,
|
|
11
|
+
featureUnitsPlural: string | undefined | null,
|
|
12
|
+
) {
|
|
13
|
+
if (!featureUnits && !featureUnitsPlural) {
|
|
10
14
|
return featureDisplayName;
|
|
11
15
|
}
|
|
12
16
|
|
|
@@ -19,4 +23,4 @@ export function getFeatureDisplayNameText(featureDisplayName: string, featureUni
|
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
return `${featureDisplayName} (${featureUnitsPlural})`;
|
|
22
|
-
}
|
|
26
|
+
}
|
|
@@ -30,9 +30,9 @@ export function getPlanPrice(
|
|
|
30
30
|
price: paywallLocale.price.custom,
|
|
31
31
|
};
|
|
32
32
|
case PricingType.Paid: {
|
|
33
|
-
const planPrices = plan.pricePoints.filter(pricePoint => pricePoint.billingPeriod === billingPeriod);
|
|
33
|
+
const planPrices = plan.pricePoints.filter((pricePoint) => pricePoint.billingPeriod === billingPeriod);
|
|
34
34
|
const paywallCalculatedPrice = plan.paywallCalculatedPricePoints?.find(
|
|
35
|
-
pricePoint => pricePoint.billingPeriod === billingPeriod,
|
|
35
|
+
(pricePoint) => pricePoint.billingPeriod === billingPeriod,
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
if (!planPrices?.length && !paywallCalculatedPrice) {
|
|
@@ -50,7 +50,9 @@ export function getSelectedTier(
|
|
|
50
50
|
currentSubscription: Subscription | null,
|
|
51
51
|
selectedTierByFeature: Record<string, PriceTierFragment>,
|
|
52
52
|
): Record<string, PriceTierFragment> {
|
|
53
|
-
const planTierPrices = plan.pricePoints.filter(
|
|
53
|
+
const planTierPrices = plan.pricePoints.filter(
|
|
54
|
+
(price) => price.billingPeriod === billingPeriod && price.isTieredPrice,
|
|
55
|
+
);
|
|
54
56
|
|
|
55
57
|
if (planTierPrices.length == 1) {
|
|
56
58
|
const [price] = planTierPrices;
|
|
@@ -59,10 +61,10 @@ export function getSelectedTier(
|
|
|
59
61
|
let currentTier = price.tiers![0];
|
|
60
62
|
|
|
61
63
|
if (selectedTierByFeature[featureId]) {
|
|
62
|
-
currentTier = price.tiers?.find(tier => tier.upTo === selectedTierByFeature[featureId].upTo) || currentTier;
|
|
64
|
+
currentTier = price.tiers?.find((tier) => tier.upTo === selectedTierByFeature[featureId].upTo) || currentTier;
|
|
63
65
|
} else if (currentSubscription) {
|
|
64
66
|
const tieredPrice = currentSubscription.prices.find(
|
|
65
|
-
subscriptionPrice =>
|
|
67
|
+
(subscriptionPrice) =>
|
|
66
68
|
subscriptionPrice.pricingModel == BillingModel.PerUnit &&
|
|
67
69
|
subscriptionPrice.tiersMode &&
|
|
68
70
|
subscriptionPrice.feature?.featureId === featureId,
|
|
@@ -97,7 +99,7 @@ export function compareSelectedTierToCurrentTier(
|
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
const currentTierPrice = currentSubscription.prices.find(
|
|
100
|
-
price => price.pricingModel == BillingModel.PerUnit && price.tiersMode,
|
|
102
|
+
(price) => price.pricingModel == BillingModel.PerUnit && price.tiersMode,
|
|
101
103
|
);
|
|
102
104
|
if (!currentTierPrice) {
|
|
103
105
|
return PriceTierComparison.Equal;
|
package/src/types.ts
CHANGED