@stigg/react-sdk 4.3.0 → 4.3.2

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.
@@ -18,6 +18,7 @@ export declare type PaywallLocalization = {
18
18
  price: {
19
19
  startingAtCaption: string;
20
20
  billingPeriod?: (billingPeriod: BillingPeriod) => string;
21
+ pricePeriod: (billingPeriod: BillingPeriod) => string;
21
22
  custom: string;
22
23
  priceNotSet: string;
23
24
  free: PlanPriceText | ((currency?: PaywallCurrency) => PlanPriceText);
@@ -46,6 +47,7 @@ export declare function getResolvedPaywallLocalize(localizeOverride?: DeepPartia
46
47
  price?: {
47
48
  startingAtCaption?: string | undefined;
48
49
  billingPeriod?: {} | undefined;
50
+ pricePeriod?: {} | undefined;
49
51
  custom?: string | undefined;
50
52
  priceNotSet?: string | undefined;
51
53
  free?: {
@@ -1,5 +1,6 @@
1
1
  import { BillingPeriod, PaywallCalculatedPricePoint, Price, PriceTierFragment } from '@stigg/js-client-sdk';
2
2
  import { PlanPriceText } from './getPlanPrice';
3
+ import { PaywallLocalization } from '../paywall';
3
4
  declare type GetPaidPriceTextParams = {
4
5
  planPrices: Price[];
5
6
  paywallCalculatedPrice?: PaywallCalculatedPricePoint;
@@ -7,6 +8,7 @@ declare type GetPaidPriceTextParams = {
7
8
  locale: string;
8
9
  shouldShowMonthlyPriceAmount: boolean;
9
10
  selectedTierByFeature: Record<string, PriceTierFragment>;
11
+ paywallLocale: PaywallLocalization;
10
12
  };
11
- export declare function getPaidPriceText({ planPrices, paywallCalculatedPrice, selectedBillingPeriod, locale, shouldShowMonthlyPriceAmount, selectedTierByFeature, }: GetPaidPriceTextParams): PlanPriceText;
13
+ export declare function getPaidPriceText({ planPrices, paywallCalculatedPrice, selectedBillingPeriod, locale, shouldShowMonthlyPriceAmount, selectedTierByFeature, paywallLocale, }: GetPaidPriceTextParams): PlanPriceText;
12
14
  export {};
@@ -1010,7 +1010,8 @@ function getPaidPriceText(_ref) {
1010
1010
  selectedBillingPeriod = _ref.selectedBillingPeriod,
1011
1011
  locale = _ref.locale,
1012
1012
  shouldShowMonthlyPriceAmount = _ref.shouldShowMonthlyPriceAmount,
1013
- selectedTierByFeature = _ref.selectedTierByFeature;
1013
+ selectedTierByFeature = _ref.selectedTierByFeature,
1014
+ paywallLocale = _ref.paywallLocale;
1014
1015
 
1015
1016
  var _ref2 = paywallCalculatedPrice || planPrices[0],
1016
1017
  amount = _ref2.amount,
@@ -1021,7 +1022,8 @@ function getPaidPriceText(_ref) {
1021
1022
  var priceNumber = selectedBillingPeriod === Stigg.BillingPeriod.Annually && shouldShowMonthlyPriceAmount ? priceAmount / 12 : priceAmount;
1022
1023
  var tiers;
1023
1024
  var tierUnits;
1024
- var unit = shouldShowMonthlyPriceAmount ? '/ month' : '/ year';
1025
+ var pricePeriod = paywallLocale.price.pricePeriod(shouldShowMonthlyPriceAmount ? Stigg.BillingPeriod.Monthly : Stigg.BillingPeriod.Annually);
1026
+ var unit = pricePeriod;
1025
1027
 
1026
1028
  for (var _iterator = _createForOfIteratorHelperLoose(planPrices), _step; !(_step = _iterator()).done;) {
1027
1029
  var _price = _step.value;
@@ -1046,7 +1048,7 @@ function getPaidPriceText(_ref) {
1046
1048
  var featureUnit = ((_price$feature = price.feature) == null ? void 0 : _price$feature.units) || '';
1047
1049
 
1048
1050
  if (price.pricingModel === Stigg.BillingModel.PerUnit && !price.isTieredPrice) {
1049
- unit = shouldShowMonthlyPriceAmount ? "per " + featureUnit + " / month" : "per " + featureUnit + " / year";
1051
+ unit = shouldShowMonthlyPriceAmount ? "per " + featureUnit + " " + pricePeriod : "per " + featureUnit + " " + pricePeriod;
1050
1052
  } else if (price.pricingModel === Stigg.BillingModel.UsageBased) {
1051
1053
  unit = "per " + featureUnit;
1052
1054
  }
@@ -1105,7 +1107,8 @@ function getPlanPrice(plan, billingPeriod, paywallLocale, locale, shouldShowMont
1105
1107
  plan: plan
1106
1108
  })) : getPaidPriceText(_extends({}, paidParams, {
1107
1109
  locale: locale,
1108
- shouldShowMonthlyPriceAmount: shouldShowMonthlyPriceAmount
1110
+ shouldShowMonthlyPriceAmount: shouldShowMonthlyPriceAmount,
1111
+ paywallLocale: paywallLocale
1109
1112
  }));
1110
1113
  }
1111
1114
 
@@ -3245,6 +3248,9 @@ function getResolvedPaywallLocalize(localizeOverride) {
3245
3248
  },
3246
3249
  price: {
3247
3250
  startingAtCaption: 'Starts at',
3251
+ pricePeriod: function pricePeriod(billingPeriod) {
3252
+ return billingPeriod === Stigg.BillingPeriod.Monthly ? '/ month' : '/ year';
3253
+ },
3248
3254
  free: function free(currency) {
3249
3255
  return {
3250
3256
  price: (currency == null ? void 0 : currency.symbol) + "0"
@@ -5543,10 +5549,10 @@ var _templateObject$6;
5543
5549
  var CustomerPortalPaywallLayout = /*#__PURE__*/_styled(SectionContainer, {
5544
5550
  target: "eqpkdww0",
5545
5551
  label: "CustomerPortalPaywallLayout"
5546
- })("position:relative;.stigg-paywall-layout{width:100%;}.stigg-paywall-plans-layout{flex-wrap:nowrap;width:100%;overflow-x:auto;justify-content:unset;padding:0;}.stigg-paywall-plans-layout .stigg-plan-offering-container:first-of-type{margin-left:auto;}.stigg-paywall-plans-layout .stigg-plan-offering-container:last-child{margin-right:auto;}", function (_ref) {
5552
+ })("position:relative;.stigg-paywall-layout{width:100%;}.stigg-paywall-plans-layout{flex-wrap:nowrap;width:100%;overflow-x:auto;justify-content:unset;padding:10px 0px 0px 0px;}.stigg-paywall-plans-layout .stigg-plan-offering-container:first-of-type{margin-left:auto;}.stigg-paywall-plans-layout .stigg-plan-offering-container:last-child{margin-right:auto;}", function (_ref) {
5547
5553
  var $hideButtons = _ref.$hideButtons;
5548
5554
  return $hideButtons && react.css(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n .stigg-paywall-plan-button:not([disabled]) {\n display: none;\n }\n "])));
5549
- }, " .", STIGG_WATERMARK_CLASSNAME, "{display:none;}" + ( "/*# sourceMappingURL=data:application/json;char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2ctcGF5d2FsbC1wbGFucy1sYXlvdXQgLnN0aWdnLXBsYW4tb2ZmZXJpbmctY29udGFpbmVyOmxhc3QtY2hpbGQge1xuICAgIG1hcmdpbi1yaWdodDogYXV0bztcbiAgfVxuXG4gICR7KHsgJGhpZGVCdXR0b25zIH0pID0+ICRoaWRlQnV0dG9ucyAmJlxyXG4gICAgY3NzIGBcbiAgICAgIC5zdGlnZy1wYXl3YWxsLXBsYW4tYnV0dG9uOm5vdChbZGlzYWJsZWRdKSB7XG4gICAgICAgIGRpc3BsYXk6IG5vbmU7XG4gICAgICB9XG4gICAgYH1cblxuICAuJHtTVElHR19XQVRFUk1BUktfQ0xBU1NOQU1FfSB7XG4gICAgZGlzcGxheTogbm9uZVxuICB9XG5gO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1DdXN0b21lclBvcnRhbFBheXdhbGwuc3R5bGUuanMubWFwIl19 */"));
5555
+ }, " .", STIGG_WATERMARK_CLASSNAME, "{display:none;}" + ( "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkN1c3RvbWVyUG9ydGFsUGF5d2FsbC5zdHlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJb0UiLCJmaWxlIjoiQ3VzdG9tZXJQb3J0YWxQYXl3YWxsLnN0eWxlLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xyXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZC9tYWNybyc7XHJcbmltcG9ydCB7IFNUSUdHX1dBVEVSTUFSS19DTEFTU05BTUUgfSBmcm9tICcuLi8uLi9jb21tb24vUG93ZXJlZEJ5U3RpZ2cnO1xyXG5pbXBvcnQgeyBTZWN0aW9uQ29udGFpbmVyIH0gZnJvbSAnLi4vY29tbW9uL1NlY3Rpb25Db250YWluZXInO1x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5556
 
5551
5557
  var CustomerPortalPaywall = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
5552
5558
  var paywallComponent = _ref.paywallComponent,