@pelcro/react-pelcro-js 3.13.0-beta.3 → 3.13.0-beta.4

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
@@ -16486,8 +16486,8 @@ const PaymentMethodContainerWithoutStripe = ({
16486
16486
  } else {
16487
16487
  if (isRenewingGift) {
16488
16488
  window.Pelcro.subscription.renewGift({
16489
- source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
16490
- stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
16489
+ source_id: stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
16490
+ stripe_token: !(stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource) ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
16491
16491
  auth_token: window.Pelcro.user.read().auth_token,
16492
16492
  plan_id: plan.id,
16493
16493
  quantity: plan.quantity,
@@ -16519,8 +16519,8 @@ const PaymentMethodContainerWithoutStripe = ({
16519
16519
  });
16520
16520
  } else {
16521
16521
  window.Pelcro.subscription.renew({
16522
- source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
16523
- stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
16522
+ source_id: stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
16523
+ stripe_token: !(stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource) ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
16524
16524
  auth_token: window.Pelcro.user.read().auth_token,
16525
16525
  plan_id: plan.id,
16526
16526
  campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
@@ -18136,7 +18136,7 @@ const SubscriptionRenewView = ({
18136
18136
  onGiftRenewalSuccess = () => {},
18137
18137
  onFailure = () => {}
18138
18138
  }) => {
18139
- var _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
18139
+ var _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
18140
18140
 
18141
18141
  const {
18142
18142
  t
@@ -18145,6 +18145,8 @@ const SubscriptionRenewView = ({
18145
18145
  product,
18146
18146
  plan
18147
18147
  } = usePelcro();
18148
+ const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
18149
+ const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
18148
18150
 
18149
18151
  const getPricingText = plan => {
18150
18152
  const autoRenewed = plan.auto_renew;
@@ -18181,7 +18183,8 @@ const SubscriptionRenewView = ({
18181
18183
  showExternalPaymentMethods: false,
18182
18184
  onSuccess: onSuccess,
18183
18185
  onGiftRenewalSuccess: onGiftRenewalSuccess,
18184
- onFailure: onFailure
18186
+ onFailure: onFailure,
18187
+ showSubscriptionButton: showSubscriptionButton
18185
18188
  }));
18186
18189
  };
18187
18190
 
package/dist/index.esm.js CHANGED
@@ -16456,8 +16456,8 @@ const PaymentMethodContainerWithoutStripe = ({
16456
16456
  } else {
16457
16457
  if (isRenewingGift) {
16458
16458
  window.Pelcro.subscription.renewGift({
16459
- source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
16460
- stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
16459
+ source_id: stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
16460
+ stripe_token: !(stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource) ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
16461
16461
  auth_token: window.Pelcro.user.read().auth_token,
16462
16462
  plan_id: plan.id,
16463
16463
  quantity: plan.quantity,
@@ -16489,8 +16489,8 @@ const PaymentMethodContainerWithoutStripe = ({
16489
16489
  });
16490
16490
  } else {
16491
16491
  window.Pelcro.subscription.renew({
16492
- source_id: stripeSource.isExistingSource ? stripeSource.id : undefined,
16493
- stripe_token: !stripeSource.isExistingSource ? stripeSource.id : undefined,
16492
+ source_id: stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
16493
+ stripe_token: !(stripeSource !== null && stripeSource !== void 0 && stripeSource.isExistingSource) ? stripeSource === null || stripeSource === void 0 ? void 0 : stripeSource.id : undefined,
16494
16494
  auth_token: window.Pelcro.user.read().auth_token,
16495
16495
  plan_id: plan.id,
16496
16496
  campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
@@ -18106,7 +18106,7 @@ const SubscriptionRenewView = ({
18106
18106
  onGiftRenewalSuccess = () => {},
18107
18107
  onFailure = () => {}
18108
18108
  }) => {
18109
- var _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
18109
+ var _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
18110
18110
 
18111
18111
  const {
18112
18112
  t
@@ -18115,6 +18115,8 @@ const SubscriptionRenewView = ({
18115
18115
  product,
18116
18116
  plan
18117
18117
  } = usePelcro();
18118
+ const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
18119
+ const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
18118
18120
 
18119
18121
  const getPricingText = plan => {
18120
18122
  const autoRenewed = plan.auto_renew;
@@ -18151,7 +18153,8 @@ const SubscriptionRenewView = ({
18151
18153
  showExternalPaymentMethods: false,
18152
18154
  onSuccess: onSuccess,
18153
18155
  onGiftRenewalSuccess: onGiftRenewalSuccess,
18154
- onFailure: onFailure
18156
+ onFailure: onFailure,
18157
+ showSubscriptionButton: showSubscriptionButton
18155
18158
  }));
18156
18159
  };
18157
18160
 
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.13.0-beta.3",
4
+ "version": "3.13.0-beta.4",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",