@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.
Files changed (55) hide show
  1. package/dist/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.d.ts +1 -1
  2. package/dist/components/customerPortal/usage/featureUsage/EntitlementCTAButton.d.ts +1 -1
  3. package/dist/components/paywall/Paywall.d.ts +3 -2
  4. package/dist/components/paywall/PaywallContainer.d.ts +3 -2
  5. package/dist/components/paywall/types.d.ts +3 -0
  6. package/dist/components/paywall/utils/getPlansToDisplay.d.ts +2 -2
  7. package/dist/react-sdk.cjs.development.js +30 -23
  8. package/dist/react-sdk.cjs.development.js.map +1 -1
  9. package/dist/react-sdk.cjs.production.min.js +1 -1
  10. package/dist/react-sdk.cjs.production.min.js.map +1 -1
  11. package/dist/react-sdk.esm.js +30 -23
  12. package/dist/react-sdk.esm.js.map +1 -1
  13. package/package.json +7 -4
  14. package/src/components/checkout/hooks/useCouponModel.ts +1 -1
  15. package/src/components/checkout/steps/addons/addon.utils.ts +6 -6
  16. package/src/components/common/PoweredByStigg.tsx +1 -2
  17. package/src/components/common/iconColor.ts +2 -4
  18. package/src/components/customerPortal/CustomerPortal.style.ts +2 -2
  19. package/src/components/customerPortal/CustomerPortalProvider.tsx +1 -2
  20. package/src/components/customerPortal/billing/InformationGrid.tsx +1 -2
  21. package/src/components/customerPortal/billing/InvoicesSection.tsx +9 -4
  22. package/src/components/customerPortal/common/ExternalLinkButton.tsx +2 -3
  23. package/src/components/customerPortal/common/SectionContainer.tsx +1 -1
  24. package/src/components/customerPortal/common/SectionHeader.ts +4 -2
  25. package/src/components/customerPortal/common/SkeletonButton.tsx +1 -1
  26. package/src/components/customerPortal/subscriptionOverview/ContactCustomerSupport.tsx +1 -2
  27. package/src/components/customerPortal/subscriptionOverview/SubscriptionsOverview.tsx +1 -2
  28. package/src/components/customerPortal/subscriptionOverview/SubscriptionsOverviewHeader.tsx +3 -8
  29. package/src/components/customerPortal/subscriptionOverview/charges/ChargeItem.tsx +1 -1
  30. package/src/components/customerPortal/subscriptionOverview/charges/ChargeList.tsx +1 -1
  31. package/src/components/customerPortal/subscriptionOverview/subscriptionView/SubscriptionView.tsx +8 -4
  32. package/src/components/customerPortal/subscriptionOverview/tabs/AddonsList.tsx +1 -1
  33. package/src/components/customerPortal/subscriptionOverview/tabs/Promotions.tsx +1 -1
  34. package/src/components/customerPortal/subscriptionOverview/tabs/SubscriptionTabs.tsx +2 -2
  35. package/src/components/customerPortal/subscriptionOverview/upcomingBilling/NoUpcomingBilling.tsx +4 -2
  36. package/src/components/customerPortal/subscriptionOverview/upcomingBilling/UpcomingBilling.tsx +1 -1
  37. package/src/components/customerPortal/types.ts +2 -2
  38. package/src/components/customerPortal/usage/featureUsage/EntitlementCTAButton.tsx +10 -3
  39. package/src/components/customerPortal/usage/featureUsage/FeatureUsage.style.ts +1 -1
  40. package/src/components/customerPortal/usage/featureUsage/FeatureUsage.tsx +2 -4
  41. package/src/components/hooks/useChargeSort.ts +2 -2
  42. package/src/components/paywall/Paywall.tsx +4 -2
  43. package/src/components/paywall/PaywallContainer.tsx +4 -1
  44. package/src/components/paywall/PlanEntitlements.tsx +4 -4
  45. package/src/components/paywall/paywallTextOverrides.ts +2 -2
  46. package/src/components/paywall/types.ts +2 -0
  47. package/src/components/paywall/utils/computeDefaultBillingPeriod.ts +2 -2
  48. package/src/components/paywall/utils/getPlansToDisplay.ts +10 -4
  49. package/src/components/paywall/utils/hasPricePoints.ts +3 -3
  50. package/src/components/utils/calculateDiscountRate.ts +3 -3
  51. package/src/components/utils/getFeatureName.ts +7 -3
  52. package/src/components/utils/getPlanPrice.ts +2 -2
  53. package/src/components/utils/priceTierUtils.ts +6 -4
  54. package/src/stories/Paywall.stories.tsx +1 -0
  55. 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(featureDisplayName: string, featureUnits: string | undefined | null, featureUnitsPlural: string | undefined | null) {
9
- if(!featureUnits && !featureUnitsPlural) {
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(price => price.billingPeriod === billingPeriod && price.isTieredPrice);
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;
@@ -39,6 +39,7 @@ const Template: ComponentStory<any> = (args) => (
39
39
  resourceId={args.resourceId}
40
40
  billingCountryCode={args.billingCountryCode}
41
41
  preferredBillingPeriod={args.preferredBillingPeriod}
42
+ shouldHidePlan={args.shouldHidePlan}
42
43
  />
43
44
  );
44
45
 
package/src/types.ts CHANGED
@@ -19,4 +19,4 @@ export type BillingPeriodChangeVariables = {
19
19
  export type UnitAmountChangeVariables = {
20
20
  newUnitAmount?: number;
21
21
  featureId: string;
22
- };
22
+ };