@pelcro/react-pelcro-js 3.13.0-beta.17 → 3.13.0-beta.18

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
@@ -10337,7 +10337,7 @@ toast.confirm = (onConfirm, {
10337
10337
  ...options
10338
10338
  });
10339
10339
  setTimeout(() => {
10340
- notify.dismiss(id);
10340
+ notify$1.dismiss(id);
10341
10341
  }, 3000);
10342
10342
  };
10343
10343
 
@@ -10347,12 +10347,12 @@ toast.confirm = (onConfirm, {
10347
10347
  ...options
10348
10348
  });
10349
10349
  setTimeout(() => {
10350
- notify.dismiss(id);
10350
+ notify$1.dismiss(id);
10351
10351
  }, 3000);
10352
10352
  };
10353
10353
  };
10354
10354
 
10355
- const notify = toast;
10355
+ const notify$1 = toast;
10356
10356
 
10357
10357
  const translations = i18next.t("common:buttons", {
10358
10358
  returnObjects: true
@@ -10423,7 +10423,7 @@ const init$1 = () => {
10423
10423
  const errorMessage = i18next.t("messages:invalidSubscription", {
10424
10424
  returnObjects: true
10425
10425
  });
10426
- return notify.error(errorMessage);
10426
+ return notify$1.error(errorMessage);
10427
10427
  }
10428
10428
 
10429
10429
  switchView("manage-members");
@@ -10432,7 +10432,7 @@ const init$1 = () => {
10432
10432
  const errorMessage = i18next.t("messages:invalidSubscription", {
10433
10433
  returnObjects: true
10434
10434
  });
10435
- return notify.error(errorMessage);
10435
+ return notify$1.error(errorMessage);
10436
10436
  }
10437
10437
  }
10438
10438
  }
@@ -10602,7 +10602,7 @@ const init$1 = () => {
10602
10602
  const errorMsg = i18next.t("shop:messages.currencyMismatch", {
10603
10603
  currency: userCurrency
10604
10604
  });
10605
- notify.error(errorMsg);
10605
+ notify$1.error(errorMsg);
10606
10606
  }
10607
10607
  });
10608
10608
  }
@@ -10704,7 +10704,7 @@ const init = () => {
10704
10704
  elemDeepClone.setAttribute("style", "filter:blur(3px) !important; pointer-events:none !important; user-select:none !important");
10705
10705
  unblurElemWhenUserSubscribes(elemDeepClone, entitlements);
10706
10706
  const NOTIFICATION_ID = "entitlement";
10707
- notify( /*#__PURE__*/React__default['default'].createElement("p", null, /*#__PURE__*/React__default['default'].createElement(Trans, {
10707
+ notify$1( /*#__PURE__*/React__default['default'].createElement("p", null, /*#__PURE__*/React__default['default'].createElement(Trans, {
10708
10708
  i18nKey: "messages:entitlement"
10709
10709
  }, "Some of the content on this page is available with one or more of our plans.", /*#__PURE__*/React__default['default'].createElement(Link, {
10710
10710
  onClick: () => {
@@ -10721,7 +10721,7 @@ const init = () => {
10721
10721
  });
10722
10722
  }
10723
10723
 
10724
- notify.dismiss(NOTIFICATION_ID);
10724
+ notify$1.dismiss(NOTIFICATION_ID);
10725
10725
  switchView("_plan-select-entitlements");
10726
10726
  }
10727
10727
  }, "Subscribe"), "now to get full page access.")), {
@@ -11481,10 +11481,10 @@ const verifyEmailTokenFromUrl = () => {
11481
11481
  token: emailToken
11482
11482
  }, (err, res) => {
11483
11483
  if (err) {
11484
- return notify.error(getErrorMessages(err));
11484
+ return notify$1.error(getErrorMessages(err));
11485
11485
  }
11486
11486
 
11487
- return notify.success(translations.success);
11487
+ return notify$1.success(translations.success);
11488
11488
  });
11489
11489
  }, {
11490
11490
  once: true
@@ -11510,7 +11510,7 @@ const verifyLinkTokenFromUrl = () => {
11510
11510
  token: loginToken
11511
11511
  }, (err, res) => {
11512
11512
  if (err) {
11513
- return notify.error(getErrorMessages(err));
11513
+ return notify$1.error(getErrorMessages(err));
11514
11514
  }
11515
11515
 
11516
11516
  const {
@@ -11520,11 +11520,11 @@ const verifyLinkTokenFromUrl = () => {
11520
11520
  auth_token
11521
11521
  }, (err, res) => {
11522
11522
  if (err) {
11523
- return notify.error(getErrorMessages(err));
11523
+ return notify$1.error(getErrorMessages(err));
11524
11524
  }
11525
11525
 
11526
11526
  resetView();
11527
- return notify.success(translations.success);
11527
+ return notify$1.success(translations.success);
11528
11528
  });
11529
11529
  });
11530
11530
  }, {
@@ -11567,7 +11567,7 @@ const showInvoiceDetailsFromUrl = () => {
11567
11567
  const errorMessage = i18next.t("messages:invalidInvoice", {
11568
11568
  returnObjects: true
11569
11569
  });
11570
- return notify.error(errorMessage);
11570
+ return notify$1.error(errorMessage);
11571
11571
  }
11572
11572
 
11573
11573
  const {
@@ -11578,7 +11578,7 @@ const showInvoiceDetailsFromUrl = () => {
11578
11578
  const errorMessage = i18next.t("messages:zeroTotalInvoice", {
11579
11579
  returnObjects: true
11580
11580
  });
11581
- return notify.error(errorMessage);
11581
+ return notify$1.error(errorMessage);
11582
11582
  }
11583
11583
 
11584
11584
  return switchView("invoice-details");
@@ -11607,7 +11607,7 @@ const showSubscriptionManageMembersFromUrl = () => {
11607
11607
  const errorMessage = i18next.t("messages:invalidSubscription", {
11608
11608
  returnObjects: true
11609
11609
  });
11610
- return notify.error(errorMessage);
11610
+ return notify$1.error(errorMessage);
11611
11611
  }
11612
11612
 
11613
11613
  return switchView("manage-members");
@@ -13468,7 +13468,7 @@ function LoginModal({
13468
13468
  switchView,
13469
13469
  resetView,
13470
13470
  product,
13471
- plan,
13471
+ order,
13472
13472
  switchToAddressView,
13473
13473
  switchToPaymentView
13474
13474
  } = usePelcro$1();
@@ -13482,7 +13482,7 @@ function LoginModal({
13482
13482
  initPaywalls();
13483
13483
  }
13484
13484
 
13485
- if (product && plan) {
13485
+ if (product) {
13486
13486
  if (product.address_required) {
13487
13487
  return switchToAddressView();
13488
13488
  } else {
@@ -13490,6 +13490,10 @@ function LoginModal({
13490
13490
  }
13491
13491
  }
13492
13492
 
13493
+ if (order) {
13494
+ return switchToAddressView();
13495
+ }
13496
+
13493
13497
  resetView();
13494
13498
  const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
13495
13499
  const viewsURLs = ["invoice-details", "gift-redeem", "plan-select"];
@@ -19594,7 +19598,7 @@ const SubscriptionCancelNowButton = ({
19594
19598
 
19595
19599
  switchView(null); //Show confirmation alert after closing the modal
19596
19600
 
19597
- notify.confirm((onSuccess, onFailure) => {
19601
+ notify$1.confirm((onSuccess, onFailure) => {
19598
19602
  cancelSubscription(payload, onSuccess, onFailure);
19599
19603
  }, {
19600
19604
  confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
@@ -19666,7 +19670,7 @@ const SubscriptionCancelLaterButton = ({
19666
19670
 
19667
19671
  switchView(null); //Show confirmation alert after closing the modal
19668
19672
 
19669
- notify.confirm((onSuccess, onFailure) => {
19673
+ notify$1.confirm((onSuccess, onFailure) => {
19670
19674
  cancelSubscription(payload, onSuccess, onFailure);
19671
19675
  }, {
19672
19676
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -19903,7 +19907,7 @@ const SubscriptionSuspendButton = ({
19903
19907
 
19904
19908
  switchView(null); //Show confirmation alert after closing the modal
19905
19909
 
19906
- notify.confirm((onSuccess, onFailure) => {
19910
+ notify$1.confirm((onSuccess, onFailure) => {
19907
19911
  suspendSubscription(payload, onSuccess, onFailure);
19908
19912
  }, {
19909
19913
  confirmMessage: t("messages.subCancellation.isSureToSuspendNow"),
@@ -22035,7 +22039,7 @@ const AddressCreateContainer = ({
22035
22039
  return onFailure(err);
22036
22040
  }
22037
22041
 
22038
- notify.success(t("messages.addressUpdated"));
22042
+ notify$1.success(t("messages.addressUpdated"));
22039
22043
  return onMembershipAdressUpdateSuccess(res);
22040
22044
  });
22041
22045
  }
@@ -24805,7 +24809,7 @@ const ShopView = () => {
24805
24809
  className: "plc-mt-2"
24806
24810
  }), /*#__PURE__*/React__default['default'].createElement(ShopPurchaseButton, {
24807
24811
  itemId: item.id,
24808
- className: "plc-mt-2"
24812
+ className: "plc-mt-2 pelcro-purchase-button"
24809
24813
  })));
24810
24814
  })));
24811
24815
  };
@@ -25639,7 +25643,7 @@ const AddressSelectContainer = ({
25639
25643
  return onFailure(err);
25640
25644
  }
25641
25645
 
25642
- notify.success(t("messages.addressUpdated"));
25646
+ notify$1.success(t("messages.addressUpdated"));
25643
25647
  return onMembershipAdressUpdateSuccess(res);
25644
25648
  });
25645
25649
  }
@@ -27633,7 +27637,7 @@ const SubscriptionsItems = ({
27633
27637
  }
27634
27638
 
27635
27639
  onClose === null || onClose === void 0 ? void 0 : onClose();
27636
- notify.confirm((onSuccess, onFailure) => {
27640
+ notify$1.confirm((onSuccess, onFailure) => {
27637
27641
  cancelSubscription(sub.id, onSuccess, onFailure);
27638
27642
  }, {
27639
27643
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -27691,7 +27695,7 @@ const SubscriptionsItems = ({
27691
27695
  }
27692
27696
 
27693
27697
  onClose === null || onClose === void 0 ? void 0 : onClose();
27694
- notify.confirm((onSuccess, onFailure) => {
27698
+ notify$1.confirm((onSuccess, onFailure) => {
27695
27699
  unSuspendSubscription(sub.id, onSuccess, onFailure);
27696
27700
  }, {
27697
27701
  confirmMessage: t("messages.subUnSuspend.isSureToUnSuspend"),
@@ -28137,11 +28141,56 @@ function SvgQrcode(props) {
28137
28141
  })));
28138
28142
  }
28139
28143
 
28140
- const DonationsMenu = () => {
28144
+ const DonationsMenu = ({
28145
+ reactivateSubscription,
28146
+ disableSubmit,
28147
+ cancelSubscription
28148
+ }) => {
28141
28149
  const {
28142
28150
  t
28143
28151
  } = useTranslation("dashboard");
28152
+ const {
28153
+ switchView,
28154
+ setSubscriptionToCancel
28155
+ } = usePelcro$1();
28144
28156
  const subscriptions = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
28157
+ // Cancel button click handlers
28158
+ const onCancelClick = () => {
28159
+ var _onClose;
28160
+
28161
+ const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
28162
+
28163
+ if (isImmediateCancelationEnabled) {
28164
+ setSubscriptionToCancel(sub.id);
28165
+ return switchView("subscription-cancel");
28166
+ }
28167
+
28168
+ if (userMustVerifyEmail()) {
28169
+ return switchView("email-verify");
28170
+ }
28171
+
28172
+ (_onClose = onClose) === null || _onClose === void 0 ? void 0 : _onClose();
28173
+ notify.confirm((onSuccess, onFailure) => {
28174
+ cancelSubscription(sub.id, onSuccess, onFailure);
28175
+ }, {
28176
+ confirmMessage: t("messages.subCancellation.isSureToCancel"),
28177
+ loadingMessage: t("messages.subCancellation.loading"),
28178
+ successMessage: t("messages.subCancellation.success"),
28179
+ errorMessage: t("messages.subCancellation.error")
28180
+ }, {
28181
+ closeButtonLabel: t("labels.subCancellation.goBack")
28182
+ });
28183
+ }; // Reactivate button click handlers
28184
+
28185
+
28186
+ const onReactivateClick = () => {
28187
+ if (userMustVerifyEmail()) {
28188
+ return switchView("email-verify");
28189
+ }
28190
+
28191
+ reactivateSubscription(sub.id);
28192
+ };
28193
+
28145
28194
  return /*#__PURE__*/React__default['default'].createElement("tr", {
28146
28195
  key: sub.id,
28147
28196
  className: "plc-w-full plc-align-top pelcro-donation-row"
@@ -28153,7 +28202,21 @@ const DonationsMenu = () => {
28153
28202
  className: "plc-text-xs plc-text-gray-400 pelcro-donation-price"
28154
28203
  }, getFormattedPriceByLocal(sub.plan.amount * sub.quantity, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("div", {
28155
28204
  className: "plc-mb-4 plc-text-gray-500 pelcro-donation-date"
28156
- }, sub.status && /*#__PURE__*/React__default['default'].createElement("span", null, formatStartDate(sub.start)))));
28205
+ }, sub.status && /*#__PURE__*/React__default['default'].createElement("span", null, formatStartDate(sub.start)))), /*#__PURE__*/React__default['default'].createElement("td", null, sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
28206
+ variant: "ghost",
28207
+ className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
28208
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
28209
+ onClick: onReactivateClick,
28210
+ disabled: disableSubmit,
28211
+ "data-key": sub.id
28212
+ }, t("labels.reactivate")), !sub.plan.auto_renew || sub.plan.auto_renew && sub.cancel_at_period_end === 0 ? /*#__PURE__*/React__default['default'].createElement(Button, {
28213
+ variant: "ghost",
28214
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
28215
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
28216
+ onClick: onCancelClick,
28217
+ disabled: disableSubmit,
28218
+ "data-key": sub.id
28219
+ }, t("labels.unsubscribe")) : ""));
28157
28220
  });
28158
28221
  return /*#__PURE__*/React__default['default'].createElement("table", {
28159
28222
  className: "plc-w-full plc-table-fixed pelcro-donations-table"
@@ -28163,7 +28226,9 @@ const DonationsMenu = () => {
28163
28226
  className: "plc-w-6/12 "
28164
28227
  }, t("labels.plan")), /*#__PURE__*/React__default['default'].createElement("th", {
28165
28228
  className: "plc-w-6/12 "
28166
- }, t("labels.startDate")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
28229
+ }, t("labels.startDate")), /*#__PURE__*/React__default['default'].createElement("th", {
28230
+ className: "plc-w-3/12 "
28231
+ }, t("labels.actions")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
28167
28232
  className: "plc-h-4"
28168
28233
  }), subscriptions));
28169
28234
  };
@@ -28996,7 +29061,11 @@ class Dashboard extends React.Component {
28996
29061
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
28997
29062
  }),
28998
29063
  title: this.locale("labels.donations"),
28999
- content: /*#__PURE__*/React__default['default'].createElement(DonationsMenu, null)
29064
+ content: /*#__PURE__*/React__default['default'].createElement(DonationsMenu, {
29065
+ reactivateSubscription: this.reactivateSubscription,
29066
+ disableSubmit: this.state.disableSubmit,
29067
+ cancelSubscription: this.cancelSubscription
29068
+ })
29000
29069
  }), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
29001
29070
  name: SUB_MENUS.GIFTS,
29002
29071
  icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, null),
@@ -31057,7 +31126,7 @@ const EmailVerifyModal = ({
31057
31126
 
31058
31127
  (_props$onSuccess = (_props = props).onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(_props, res);
31059
31128
 
31060
- if (product && plan) {
31129
+ if (product) {
31061
31130
  if (product.address_required) {
31062
31131
  return switchToAddressView();
31063
31132
  } else {
@@ -31227,7 +31296,7 @@ function VerifyLinkTokenModal({
31227
31296
 
31228
31297
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
31229
31298
  resetView();
31230
- notify.success(t("messages.success"));
31299
+ notify$1.success(t("messages.success"));
31231
31300
  };
31232
31301
 
31233
31302
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -33121,6 +33190,6 @@ exports.i18n = i18next;
33121
33190
  exports.initButtons = init$1;
33122
33191
  exports.initContentEntitlement = init;
33123
33192
  exports.invoicePaymentSubmitButton = invoicePaymentSubmitButton;
33124
- exports.notify = notify;
33193
+ exports.notify = notify$1;
33125
33194
  exports.unauthenticatedButtons = unauthenticatedButtons;
33126
33195
  exports.usePelcro = usePelcro$1;
package/dist/index.esm.js CHANGED
@@ -10307,7 +10307,7 @@ toast.confirm = (onConfirm, {
10307
10307
  ...options
10308
10308
  });
10309
10309
  setTimeout(() => {
10310
- notify.dismiss(id);
10310
+ notify$1.dismiss(id);
10311
10311
  }, 3000);
10312
10312
  };
10313
10313
 
@@ -10317,12 +10317,12 @@ toast.confirm = (onConfirm, {
10317
10317
  ...options
10318
10318
  });
10319
10319
  setTimeout(() => {
10320
- notify.dismiss(id);
10320
+ notify$1.dismiss(id);
10321
10321
  }, 3000);
10322
10322
  };
10323
10323
  };
10324
10324
 
10325
- const notify = toast;
10325
+ const notify$1 = toast;
10326
10326
 
10327
10327
  const translations = i18next.t("common:buttons", {
10328
10328
  returnObjects: true
@@ -10393,7 +10393,7 @@ const init$1 = () => {
10393
10393
  const errorMessage = i18next.t("messages:invalidSubscription", {
10394
10394
  returnObjects: true
10395
10395
  });
10396
- return notify.error(errorMessage);
10396
+ return notify$1.error(errorMessage);
10397
10397
  }
10398
10398
 
10399
10399
  switchView("manage-members");
@@ -10402,7 +10402,7 @@ const init$1 = () => {
10402
10402
  const errorMessage = i18next.t("messages:invalidSubscription", {
10403
10403
  returnObjects: true
10404
10404
  });
10405
- return notify.error(errorMessage);
10405
+ return notify$1.error(errorMessage);
10406
10406
  }
10407
10407
  }
10408
10408
  }
@@ -10572,7 +10572,7 @@ const init$1 = () => {
10572
10572
  const errorMsg = i18next.t("shop:messages.currencyMismatch", {
10573
10573
  currency: userCurrency
10574
10574
  });
10575
- notify.error(errorMsg);
10575
+ notify$1.error(errorMsg);
10576
10576
  }
10577
10577
  });
10578
10578
  }
@@ -10674,7 +10674,7 @@ const init = () => {
10674
10674
  elemDeepClone.setAttribute("style", "filter:blur(3px) !important; pointer-events:none !important; user-select:none !important");
10675
10675
  unblurElemWhenUserSubscribes(elemDeepClone, entitlements);
10676
10676
  const NOTIFICATION_ID = "entitlement";
10677
- notify( /*#__PURE__*/React__default.createElement("p", null, /*#__PURE__*/React__default.createElement(Trans, {
10677
+ notify$1( /*#__PURE__*/React__default.createElement("p", null, /*#__PURE__*/React__default.createElement(Trans, {
10678
10678
  i18nKey: "messages:entitlement"
10679
10679
  }, "Some of the content on this page is available with one or more of our plans.", /*#__PURE__*/React__default.createElement(Link, {
10680
10680
  onClick: () => {
@@ -10691,7 +10691,7 @@ const init = () => {
10691
10691
  });
10692
10692
  }
10693
10693
 
10694
- notify.dismiss(NOTIFICATION_ID);
10694
+ notify$1.dismiss(NOTIFICATION_ID);
10695
10695
  switchView("_plan-select-entitlements");
10696
10696
  }
10697
10697
  }, "Subscribe"), "now to get full page access.")), {
@@ -11451,10 +11451,10 @@ const verifyEmailTokenFromUrl = () => {
11451
11451
  token: emailToken
11452
11452
  }, (err, res) => {
11453
11453
  if (err) {
11454
- return notify.error(getErrorMessages(err));
11454
+ return notify$1.error(getErrorMessages(err));
11455
11455
  }
11456
11456
 
11457
- return notify.success(translations.success);
11457
+ return notify$1.success(translations.success);
11458
11458
  });
11459
11459
  }, {
11460
11460
  once: true
@@ -11480,7 +11480,7 @@ const verifyLinkTokenFromUrl = () => {
11480
11480
  token: loginToken
11481
11481
  }, (err, res) => {
11482
11482
  if (err) {
11483
- return notify.error(getErrorMessages(err));
11483
+ return notify$1.error(getErrorMessages(err));
11484
11484
  }
11485
11485
 
11486
11486
  const {
@@ -11490,11 +11490,11 @@ const verifyLinkTokenFromUrl = () => {
11490
11490
  auth_token
11491
11491
  }, (err, res) => {
11492
11492
  if (err) {
11493
- return notify.error(getErrorMessages(err));
11493
+ return notify$1.error(getErrorMessages(err));
11494
11494
  }
11495
11495
 
11496
11496
  resetView();
11497
- return notify.success(translations.success);
11497
+ return notify$1.success(translations.success);
11498
11498
  });
11499
11499
  });
11500
11500
  }, {
@@ -11537,7 +11537,7 @@ const showInvoiceDetailsFromUrl = () => {
11537
11537
  const errorMessage = i18next.t("messages:invalidInvoice", {
11538
11538
  returnObjects: true
11539
11539
  });
11540
- return notify.error(errorMessage);
11540
+ return notify$1.error(errorMessage);
11541
11541
  }
11542
11542
 
11543
11543
  const {
@@ -11548,7 +11548,7 @@ const showInvoiceDetailsFromUrl = () => {
11548
11548
  const errorMessage = i18next.t("messages:zeroTotalInvoice", {
11549
11549
  returnObjects: true
11550
11550
  });
11551
- return notify.error(errorMessage);
11551
+ return notify$1.error(errorMessage);
11552
11552
  }
11553
11553
 
11554
11554
  return switchView("invoice-details");
@@ -11577,7 +11577,7 @@ const showSubscriptionManageMembersFromUrl = () => {
11577
11577
  const errorMessage = i18next.t("messages:invalidSubscription", {
11578
11578
  returnObjects: true
11579
11579
  });
11580
- return notify.error(errorMessage);
11580
+ return notify$1.error(errorMessage);
11581
11581
  }
11582
11582
 
11583
11583
  return switchView("manage-members");
@@ -13438,7 +13438,7 @@ function LoginModal({
13438
13438
  switchView,
13439
13439
  resetView,
13440
13440
  product,
13441
- plan,
13441
+ order,
13442
13442
  switchToAddressView,
13443
13443
  switchToPaymentView
13444
13444
  } = usePelcro$1();
@@ -13452,7 +13452,7 @@ function LoginModal({
13452
13452
  initPaywalls();
13453
13453
  }
13454
13454
 
13455
- if (product && plan) {
13455
+ if (product) {
13456
13456
  if (product.address_required) {
13457
13457
  return switchToAddressView();
13458
13458
  } else {
@@ -13460,6 +13460,10 @@ function LoginModal({
13460
13460
  }
13461
13461
  }
13462
13462
 
13463
+ if (order) {
13464
+ return switchToAddressView();
13465
+ }
13466
+
13463
13467
  resetView();
13464
13468
  const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
13465
13469
  const viewsURLs = ["invoice-details", "gift-redeem", "plan-select"];
@@ -19564,7 +19568,7 @@ const SubscriptionCancelNowButton = ({
19564
19568
 
19565
19569
  switchView(null); //Show confirmation alert after closing the modal
19566
19570
 
19567
- notify.confirm((onSuccess, onFailure) => {
19571
+ notify$1.confirm((onSuccess, onFailure) => {
19568
19572
  cancelSubscription(payload, onSuccess, onFailure);
19569
19573
  }, {
19570
19574
  confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
@@ -19636,7 +19640,7 @@ const SubscriptionCancelLaterButton = ({
19636
19640
 
19637
19641
  switchView(null); //Show confirmation alert after closing the modal
19638
19642
 
19639
- notify.confirm((onSuccess, onFailure) => {
19643
+ notify$1.confirm((onSuccess, onFailure) => {
19640
19644
  cancelSubscription(payload, onSuccess, onFailure);
19641
19645
  }, {
19642
19646
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -19873,7 +19877,7 @@ const SubscriptionSuspendButton = ({
19873
19877
 
19874
19878
  switchView(null); //Show confirmation alert after closing the modal
19875
19879
 
19876
- notify.confirm((onSuccess, onFailure) => {
19880
+ notify$1.confirm((onSuccess, onFailure) => {
19877
19881
  suspendSubscription(payload, onSuccess, onFailure);
19878
19882
  }, {
19879
19883
  confirmMessage: t("messages.subCancellation.isSureToSuspendNow"),
@@ -22005,7 +22009,7 @@ const AddressCreateContainer = ({
22005
22009
  return onFailure(err);
22006
22010
  }
22007
22011
 
22008
- notify.success(t("messages.addressUpdated"));
22012
+ notify$1.success(t("messages.addressUpdated"));
22009
22013
  return onMembershipAdressUpdateSuccess(res);
22010
22014
  });
22011
22015
  }
@@ -24775,7 +24779,7 @@ const ShopView = () => {
24775
24779
  className: "plc-mt-2"
24776
24780
  }), /*#__PURE__*/React__default.createElement(ShopPurchaseButton, {
24777
24781
  itemId: item.id,
24778
- className: "plc-mt-2"
24782
+ className: "plc-mt-2 pelcro-purchase-button"
24779
24783
  })));
24780
24784
  })));
24781
24785
  };
@@ -25609,7 +25613,7 @@ const AddressSelectContainer = ({
25609
25613
  return onFailure(err);
25610
25614
  }
25611
25615
 
25612
- notify.success(t("messages.addressUpdated"));
25616
+ notify$1.success(t("messages.addressUpdated"));
25613
25617
  return onMembershipAdressUpdateSuccess(res);
25614
25618
  });
25615
25619
  }
@@ -27603,7 +27607,7 @@ const SubscriptionsItems = ({
27603
27607
  }
27604
27608
 
27605
27609
  onClose === null || onClose === void 0 ? void 0 : onClose();
27606
- notify.confirm((onSuccess, onFailure) => {
27610
+ notify$1.confirm((onSuccess, onFailure) => {
27607
27611
  cancelSubscription(sub.id, onSuccess, onFailure);
27608
27612
  }, {
27609
27613
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -27661,7 +27665,7 @@ const SubscriptionsItems = ({
27661
27665
  }
27662
27666
 
27663
27667
  onClose === null || onClose === void 0 ? void 0 : onClose();
27664
- notify.confirm((onSuccess, onFailure) => {
27668
+ notify$1.confirm((onSuccess, onFailure) => {
27665
27669
  unSuspendSubscription(sub.id, onSuccess, onFailure);
27666
27670
  }, {
27667
27671
  confirmMessage: t("messages.subUnSuspend.isSureToUnSuspend"),
@@ -28107,11 +28111,56 @@ function SvgQrcode(props) {
28107
28111
  })));
28108
28112
  }
28109
28113
 
28110
- const DonationsMenu = () => {
28114
+ const DonationsMenu = ({
28115
+ reactivateSubscription,
28116
+ disableSubmit,
28117
+ cancelSubscription
28118
+ }) => {
28111
28119
  const {
28112
28120
  t
28113
28121
  } = useTranslation("dashboard");
28122
+ const {
28123
+ switchView,
28124
+ setSubscriptionToCancel
28125
+ } = usePelcro$1();
28114
28126
  const subscriptions = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
28127
+ // Cancel button click handlers
28128
+ const onCancelClick = () => {
28129
+ var _onClose;
28130
+
28131
+ const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
28132
+
28133
+ if (isImmediateCancelationEnabled) {
28134
+ setSubscriptionToCancel(sub.id);
28135
+ return switchView("subscription-cancel");
28136
+ }
28137
+
28138
+ if (userMustVerifyEmail()) {
28139
+ return switchView("email-verify");
28140
+ }
28141
+
28142
+ (_onClose = onClose) === null || _onClose === void 0 ? void 0 : _onClose();
28143
+ notify.confirm((onSuccess, onFailure) => {
28144
+ cancelSubscription(sub.id, onSuccess, onFailure);
28145
+ }, {
28146
+ confirmMessage: t("messages.subCancellation.isSureToCancel"),
28147
+ loadingMessage: t("messages.subCancellation.loading"),
28148
+ successMessage: t("messages.subCancellation.success"),
28149
+ errorMessage: t("messages.subCancellation.error")
28150
+ }, {
28151
+ closeButtonLabel: t("labels.subCancellation.goBack")
28152
+ });
28153
+ }; // Reactivate button click handlers
28154
+
28155
+
28156
+ const onReactivateClick = () => {
28157
+ if (userMustVerifyEmail()) {
28158
+ return switchView("email-verify");
28159
+ }
28160
+
28161
+ reactivateSubscription(sub.id);
28162
+ };
28163
+
28115
28164
  return /*#__PURE__*/React__default.createElement("tr", {
28116
28165
  key: sub.id,
28117
28166
  className: "plc-w-full plc-align-top pelcro-donation-row"
@@ -28123,7 +28172,21 @@ const DonationsMenu = () => {
28123
28172
  className: "plc-text-xs plc-text-gray-400 pelcro-donation-price"
28124
28173
  }, getFormattedPriceByLocal(sub.plan.amount * sub.quantity, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("div", {
28125
28174
  className: "plc-mb-4 plc-text-gray-500 pelcro-donation-date"
28126
- }, sub.status && /*#__PURE__*/React__default.createElement("span", null, formatStartDate(sub.start)))));
28175
+ }, sub.status && /*#__PURE__*/React__default.createElement("span", null, formatStartDate(sub.start)))), /*#__PURE__*/React__default.createElement("td", null, sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default.createElement(Button, {
28176
+ variant: "ghost",
28177
+ className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
28178
+ icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
28179
+ onClick: onReactivateClick,
28180
+ disabled: disableSubmit,
28181
+ "data-key": sub.id
28182
+ }, t("labels.reactivate")), !sub.plan.auto_renew || sub.plan.auto_renew && sub.cancel_at_period_end === 0 ? /*#__PURE__*/React__default.createElement(Button, {
28183
+ variant: "ghost",
28184
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
28185
+ icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
28186
+ onClick: onCancelClick,
28187
+ disabled: disableSubmit,
28188
+ "data-key": sub.id
28189
+ }, t("labels.unsubscribe")) : ""));
28127
28190
  });
28128
28191
  return /*#__PURE__*/React__default.createElement("table", {
28129
28192
  className: "plc-w-full plc-table-fixed pelcro-donations-table"
@@ -28133,7 +28196,9 @@ const DonationsMenu = () => {
28133
28196
  className: "plc-w-6/12 "
28134
28197
  }, t("labels.plan")), /*#__PURE__*/React__default.createElement("th", {
28135
28198
  className: "plc-w-6/12 "
28136
- }, t("labels.startDate")))), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
28199
+ }, t("labels.startDate")), /*#__PURE__*/React__default.createElement("th", {
28200
+ className: "plc-w-3/12 "
28201
+ }, t("labels.actions")))), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
28137
28202
  className: "plc-h-4"
28138
28203
  }), subscriptions));
28139
28204
  };
@@ -28966,7 +29031,11 @@ class Dashboard extends Component {
28966
29031
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
28967
29032
  }),
28968
29033
  title: this.locale("labels.donations"),
28969
- content: /*#__PURE__*/React__default.createElement(DonationsMenu, null)
29034
+ content: /*#__PURE__*/React__default.createElement(DonationsMenu, {
29035
+ reactivateSubscription: this.reactivateSubscription,
29036
+ disableSubmit: this.state.disableSubmit,
29037
+ cancelSubscription: this.cancelSubscription
29038
+ })
28970
29039
  }), /*#__PURE__*/React__default.createElement(Accordion.item, {
28971
29040
  name: SUB_MENUS.GIFTS,
28972
29041
  icon: /*#__PURE__*/React__default.createElement(SvgGift, null),
@@ -31027,7 +31096,7 @@ const EmailVerifyModal = ({
31027
31096
 
31028
31097
  (_props$onSuccess = (_props = props).onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(_props, res);
31029
31098
 
31030
- if (product && plan) {
31099
+ if (product) {
31031
31100
  if (product.address_required) {
31032
31101
  return switchToAddressView();
31033
31102
  } else {
@@ -31197,7 +31266,7 @@ function VerifyLinkTokenModal({
31197
31266
 
31198
31267
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
31199
31268
  resetView();
31200
- notify.success(t("messages.success"));
31269
+ notify$1.success(t("messages.success"));
31201
31270
  };
31202
31271
 
31203
31272
  return /*#__PURE__*/React__default.createElement(Modal, {
@@ -32859,4 +32928,4 @@ const QrCodeModal = ({
32859
32928
  };
32860
32929
  QrCodeModal.viewId = "qrcode";
32861
32930
 
32862
- export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro$1 as usePelcro };
32931
+ export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify$1 as notify, unauthenticatedButtons, usePelcro$1 as usePelcro };
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.17",
4
+ "version": "3.13.0-beta.18",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",