@pelcro/react-pelcro-js 3.27.0 → 3.29.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/index.cjs.js CHANGED
@@ -3452,7 +3452,7 @@ var labels$11 = {
3452
3452
  code: "Coupon code",
3453
3453
  "for": "for",
3454
3454
  interval: "{{count}} {{interval}}",
3455
- interval_plural: "{{count}} {{interval}}s",
3455
+ interval_plural: "{{count}} {{interval}}",
3456
3456
  tax: "Tax",
3457
3457
  removeCoupon: "REMOVE",
3458
3458
  firstName: "First name",
@@ -4323,7 +4323,7 @@ var labels$M = {
4323
4323
  code: "Code promo",
4324
4324
  "for": "pour",
4325
4325
  interval: "{{count}} {{interval}}",
4326
- interval_plural: "{{count}} {{interval}}s",
4326
+ interval_plural: "{{count}} {{interval}}",
4327
4327
  tax: "Taxe",
4328
4328
  removeCoupon: "RETIRER",
4329
4329
  firstName: "Prénom",
@@ -6169,7 +6169,7 @@ var labels$e = {
6169
6169
  code: "Código de cupón",
6170
6170
  "for": "por",
6171
6171
  interval: "{{count}} {{interval}}",
6172
- interval_plural: "{{count}} {{interval}}s",
6172
+ interval_plural: "{{count}} {{interval}}",
6173
6173
  tax: "Impuesto",
6174
6174
  removeCoupon: "ELIMINAR",
6175
6175
  firstName: "Nombre",
@@ -11561,21 +11561,33 @@ const initPaywalls = () => {
11561
11561
  return;
11562
11562
  }
11563
11563
  const {
11564
- switchView
11564
+ switchView,
11565
+ isAuthenticated
11565
11566
  } = usePelcro.getStore();
11566
- if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11567
- /*
11568
- showing both the meter and the entitlements notification doesn't make sense from
11569
- a product prespective + they would take half the screen on mobile devies, so we're
11570
- not showing the meter, and only showing the entitlements notification.
11571
- */
11572
- if (!didBlurContent) {
11573
- switchView("meter");
11567
+
11568
+ // eslint-disable-next-line no-inner-declarations
11569
+ function displayPaywalls() {
11570
+ if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11571
+ /*
11572
+ showing both the meter and the entitlements notification doesn't make sense from
11573
+ a product prespective + they would take half the screen on mobile devies, so we're
11574
+ not showing the meter, and only showing the entitlements notification.
11575
+ */
11576
+ if (!didBlurContent) {
11577
+ switchView("meter");
11578
+ }
11579
+ } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
11580
+ switchView("newsletter");
11581
+ } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
11582
+ switchView("plan-select");
11574
11583
  }
11575
- } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
11576
- switchView("newsletter");
11577
- } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
11578
- switchView("plan-select");
11584
+ }
11585
+ if ("id" in Pelcro.user.read() || !isAuthenticated()) {
11586
+ displayPaywalls();
11587
+ } else {
11588
+ addEventListener("PelcroUserLoaded", function () {
11589
+ displayPaywalls();
11590
+ }, true);
11579
11591
  }
11580
11592
  }
11581
11593
  };
@@ -14802,7 +14814,7 @@ class SelectModal extends React.Component {
14802
14814
  startingPlan = plan;
14803
14815
  }
14804
14816
  }
14805
- return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval}s` : `${startingPlan.interval}`}`;
14817
+ return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval_translated}` : `${startingPlan.interval_translated}`}`;
14806
14818
  });
14807
14819
  _defineProperty$3(this, "renderOneProduct", (product, index, options) => {
14808
14820
  const isPlanMode = Boolean(this.state.mode === "plan");
@@ -20303,11 +20315,11 @@ const SubscriptionRenewView = _ref => {
20303
20315
  const getPricingText = plan => {
20304
20316
  const autoRenewed = plan.auto_renew;
20305
20317
  const {
20306
- interval,
20318
+ interval_translated,
20307
20319
  interval_count
20308
20320
  } = plan;
20309
20321
  const intervalText = t("labels.interval", {
20310
- interval,
20322
+ interval: interval_translated,
20311
20323
  count: interval_count
20312
20324
  });
20313
20325
  return /*#__PURE__*/React__default['default'].createElement("p", {
@@ -21674,11 +21686,11 @@ const SubscriptionCreateView = _ref => {
21674
21686
  var _plan$quantity;
21675
21687
  const autoRenewed = plan.auto_renew;
21676
21688
  const {
21677
- interval,
21689
+ interval_translated,
21678
21690
  interval_count
21679
21691
  } = plan;
21680
21692
  const intervalText = t("labels.interval", {
21681
- interval,
21693
+ interval: interval_translated,
21682
21694
  count: interval_count
21683
21695
  });
21684
21696
  const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
package/dist/index.esm.js CHANGED
@@ -3422,7 +3422,7 @@ var labels$11 = {
3422
3422
  code: "Coupon code",
3423
3423
  "for": "for",
3424
3424
  interval: "{{count}} {{interval}}",
3425
- interval_plural: "{{count}} {{interval}}s",
3425
+ interval_plural: "{{count}} {{interval}}",
3426
3426
  tax: "Tax",
3427
3427
  removeCoupon: "REMOVE",
3428
3428
  firstName: "First name",
@@ -4293,7 +4293,7 @@ var labels$M = {
4293
4293
  code: "Code promo",
4294
4294
  "for": "pour",
4295
4295
  interval: "{{count}} {{interval}}",
4296
- interval_plural: "{{count}} {{interval}}s",
4296
+ interval_plural: "{{count}} {{interval}}",
4297
4297
  tax: "Taxe",
4298
4298
  removeCoupon: "RETIRER",
4299
4299
  firstName: "Prénom",
@@ -6139,7 +6139,7 @@ var labels$e = {
6139
6139
  code: "Código de cupón",
6140
6140
  "for": "por",
6141
6141
  interval: "{{count}} {{interval}}",
6142
- interval_plural: "{{count}} {{interval}}s",
6142
+ interval_plural: "{{count}} {{interval}}",
6143
6143
  tax: "Impuesto",
6144
6144
  removeCoupon: "ELIMINAR",
6145
6145
  firstName: "Nombre",
@@ -11531,21 +11531,33 @@ const initPaywalls = () => {
11531
11531
  return;
11532
11532
  }
11533
11533
  const {
11534
- switchView
11534
+ switchView,
11535
+ isAuthenticated
11535
11536
  } = usePelcro.getStore();
11536
- if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11537
- /*
11538
- showing both the meter and the entitlements notification doesn't make sense from
11539
- a product prespective + they would take half the screen on mobile devies, so we're
11540
- not showing the meter, and only showing the entitlements notification.
11541
- */
11542
- if (!didBlurContent) {
11543
- switchView("meter");
11537
+
11538
+ // eslint-disable-next-line no-inner-declarations
11539
+ function displayPaywalls() {
11540
+ if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11541
+ /*
11542
+ showing both the meter and the entitlements notification doesn't make sense from
11543
+ a product prespective + they would take half the screen on mobile devies, so we're
11544
+ not showing the meter, and only showing the entitlements notification.
11545
+ */
11546
+ if (!didBlurContent) {
11547
+ switchView("meter");
11548
+ }
11549
+ } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
11550
+ switchView("newsletter");
11551
+ } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
11552
+ switchView("plan-select");
11544
11553
  }
11545
- } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
11546
- switchView("newsletter");
11547
- } else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
11548
- switchView("plan-select");
11554
+ }
11555
+ if ("id" in Pelcro.user.read() || !isAuthenticated()) {
11556
+ displayPaywalls();
11557
+ } else {
11558
+ addEventListener("PelcroUserLoaded", function () {
11559
+ displayPaywalls();
11560
+ }, true);
11549
11561
  }
11550
11562
  }
11551
11563
  };
@@ -14772,7 +14784,7 @@ class SelectModal extends Component {
14772
14784
  startingPlan = plan;
14773
14785
  }
14774
14786
  }
14775
- return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval}s` : `${startingPlan.interval}`}`;
14787
+ return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval_translated}` : `${startingPlan.interval_translated}`}`;
14776
14788
  });
14777
14789
  _defineProperty$3(this, "renderOneProduct", (product, index, options) => {
14778
14790
  const isPlanMode = Boolean(this.state.mode === "plan");
@@ -20273,11 +20285,11 @@ const SubscriptionRenewView = _ref => {
20273
20285
  const getPricingText = plan => {
20274
20286
  const autoRenewed = plan.auto_renew;
20275
20287
  const {
20276
- interval,
20288
+ interval_translated,
20277
20289
  interval_count
20278
20290
  } = plan;
20279
20291
  const intervalText = t("labels.interval", {
20280
- interval,
20292
+ interval: interval_translated,
20281
20293
  count: interval_count
20282
20294
  });
20283
20295
  return /*#__PURE__*/React__default.createElement("p", {
@@ -21644,11 +21656,11 @@ const SubscriptionCreateView = _ref => {
21644
21656
  var _plan$quantity;
21645
21657
  const autoRenewed = plan.auto_renew;
21646
21658
  const {
21647
- interval,
21659
+ interval_translated,
21648
21660
  interval_count
21649
21661
  } = plan;
21650
21662
  const intervalText = t("labels.interval", {
21651
- interval,
21663
+ interval: interval_translated,
21652
21664
  count: interval_count
21653
21665
  });
21654
21666
  const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.27.0",
4
+ "version": "3.29.0",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",