@pelcro/react-pelcro-js 3.22.0-beta.17 → 3.22.0-beta.19

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
@@ -3945,6 +3945,9 @@ var labels$Y = {
3945
3945
  },
3946
3946
  subCancellation: {
3947
3947
  goBack: "Go back"
3948
+ },
3949
+ donationCancellation: {
3950
+ goBack: "Go back"
3948
3951
  }
3949
3952
  };
3950
3953
  var messages$_ = {
@@ -3964,6 +3967,22 @@ var messages$_ = {
3964
3967
  loading: "Unsuspending your subscription",
3965
3968
  success: "Subscription is successfully unsuspended",
3966
3969
  error: "Error while unsuspending your subscription"
3970
+ },
3971
+ donationCancellation: {
3972
+ isSureToCancel: "Are you sure you want to cancel your donation?",
3973
+ loading: "Cancelling your donation",
3974
+ success: "Donation is successfully cancelled",
3975
+ error: "Error while cancelling your donation"
3976
+ },
3977
+ donationReactivation: {
3978
+ success: "Donation is successfully reactivated",
3979
+ error: "Error while reactivating your donation"
3980
+ },
3981
+ donationUnSuspend: {
3982
+ isSureToUnSuspend: "Are you sure you want to unsuspend your donation?",
3983
+ loading: "Unsuspending your donation",
3984
+ success: "Donation is successfully unsuspended",
3985
+ error: "Error while unsuspending your donation"
3967
3986
  }
3968
3987
  };
3969
3988
  var dashboard_en = {
@@ -4923,6 +4942,9 @@ var labels$C = {
4923
4942
  },
4924
4943
  subCancellation: {
4925
4944
  goBack: "Retourner"
4945
+ },
4946
+ donationCancellation: {
4947
+ goBack: "Go back"
4926
4948
  }
4927
4949
  };
4928
4950
  var messages$F = {
@@ -4942,6 +4964,22 @@ var messages$F = {
4942
4964
  loading: "Annulation de la suspension de votre abonnement",
4943
4965
  success: "L'abonnement a été suspendu avec succès",
4944
4966
  error: "Erreur lors de l'annulation de la suspension de votre abonnement"
4967
+ },
4968
+ donationCancellation: {
4969
+ isSureToCancel: "Êtes-vous certain de vouloir annuler votre don?",
4970
+ loading: "Annulation de l'don",
4971
+ success: "L'don a été annulé avec succès",
4972
+ error: "Une erreur s'est produite lors de l'annulation de l'don"
4973
+ },
4974
+ donationReactivation: {
4975
+ success: "L'don a été réactivé avec succès",
4976
+ error: "Erreur lors de la réactivation de votre don"
4977
+ },
4978
+ donationUnSuspend: {
4979
+ isSureToUnSuspend: "Êtes-vous sûr de vouloir annuler la suspension de votre don ?",
4980
+ loading: "Annulation de la suspension de votre don",
4981
+ success: "L'don a été suspendu avec succès",
4982
+ error: "Erreur lors de l'annulation de la suspension de votre don"
4945
4983
  }
4946
4984
  };
4947
4985
  var dashboard_fr = {
@@ -5846,6 +5884,9 @@ var savedItems = {
5846
5884
  var subCancellation = {
5847
5885
  goBack: "뒤로 가기"
5848
5886
  };
5887
+ var donationCancellation = {
5888
+ goBack: "뒤로 가기"
5889
+ };
5849
5890
  var messages$n = {
5850
5891
  noCard: "등록된 카드가 없습니다.",
5851
5892
  subCancellation: {
@@ -5863,6 +5904,22 @@ var messages$n = {
5863
5904
  loading: "구독 일시 중단 해제",
5864
5905
  success: "구독이 성공적으로 일시 중단 해제되었습니다",
5865
5906
  error: "구독 일시 중단을 해제하는 동안 오류가 발생했습니다."
5907
+ },
5908
+ donationCancellation: {
5909
+ isSureToCancel: "정말로 유료 멤버십을 취소하시겠습니까?",
5910
+ loading: "귀하의 유료 멤버십을 취소합니다.",
5911
+ success: "유료 멤버십이 성공적으로 취소되었습니다.",
5912
+ error: "유료 멤버십 취소 과정에서 오류가 발생했습니다."
5913
+ },
5914
+ donationReactivation: {
5915
+ success: "구독이 성공적으로 재활성화되었습니다.",
5916
+ error: "구독을 재활성화하는 동안 오류가 발생했습니다."
5917
+ },
5918
+ donationUnSuspend: {
5919
+ isSureToUnSuspend: "구독 일시 중단을 해제하시겠습니까?",
5920
+ loading: "구독 일시 중단 해제",
5921
+ success: "구독이 성공적으로 일시 중단 해제되었습니다",
5922
+ error: "구독 일시 중단을 해제하는 동안 오류가 발생했습니다."
5866
5923
  }
5867
5924
  };
5868
5925
  var dashboard_ko = {
@@ -5915,6 +5972,7 @@ var dashboard_ko = {
5915
5972
  orders: orders,
5916
5973
  savedItems: savedItems,
5917
5974
  subCancellation: subCancellation,
5975
+ donationCancellation: donationCancellation,
5918
5976
  messages: messages$n
5919
5977
  };
5920
5978
 
@@ -6746,6 +6804,9 @@ var labels$6 = {
6746
6804
  },
6747
6805
  subCancellation: {
6748
6806
  goBack: "Volver"
6807
+ },
6808
+ donationCancellation: {
6809
+ goBack: "Go back"
6749
6810
  }
6750
6811
  };
6751
6812
  var messages$5 = {
@@ -6765,6 +6826,22 @@ var messages$5 = {
6765
6826
  loading: "Reanudando tu suscripción",
6766
6827
  success: "La suscripción se reanudó con éxito",
6767
6828
  error: "Error al reanudar tu suscripción"
6829
+ },
6830
+ donationCancellation: {
6831
+ isSureToCancel: "¿Estás seguro de que quieres cancelar tu donación?",
6832
+ loading: "Cancelando tu donación",
6833
+ success: "La donación se canceló con éxito",
6834
+ error: "Error al cancelar tu donación"
6835
+ },
6836
+ donationReactivation: {
6837
+ success: "La donación se reactivó con éxito",
6838
+ error: "Error al reactivar su donación"
6839
+ },
6840
+ donationUnSuspend: {
6841
+ isSureToUnSuspend: "¿Estás seguro de que quieres reanudar tu donación?",
6842
+ loading: "Reanudando tu donación",
6843
+ success: "La donación se reanudó con éxito",
6844
+ error: "Error al reanudar tu donación"
6768
6845
  }
6769
6846
  };
6770
6847
  var dashboard_es = {
@@ -10574,7 +10651,7 @@ toast.confirm = function (onConfirm, _ref3) {
10574
10651
  ...options
10575
10652
  });
10576
10653
  setTimeout(() => {
10577
- notify$1.dismiss(id);
10654
+ notify.dismiss(id);
10578
10655
  }, 3000);
10579
10656
  };
10580
10657
  const onFailure = errorValue => {
@@ -10583,11 +10660,11 @@ toast.confirm = function (onConfirm, _ref3) {
10583
10660
  ...options
10584
10661
  });
10585
10662
  setTimeout(() => {
10586
- notify$1.dismiss(id);
10663
+ notify.dismiss(id);
10587
10664
  }, 3000);
10588
10665
  };
10589
10666
  };
10590
- const notify$1 = toast;
10667
+ const notify = toast;
10591
10668
 
10592
10669
  const translations = i18next.t("common:buttons", {
10593
10670
  returnObjects: true
@@ -10648,7 +10725,7 @@ const init$1 = () => {
10648
10725
  const errorMessage = i18next.t("messages:invalidSubscription", {
10649
10726
  returnObjects: true
10650
10727
  });
10651
- return notify$1.error(errorMessage);
10728
+ return notify.error(errorMessage);
10652
10729
  }
10653
10730
  switchView("manage-members");
10654
10731
  });
@@ -10656,7 +10733,7 @@ const init$1 = () => {
10656
10733
  const errorMessage = i18next.t("messages:invalidSubscription", {
10657
10734
  returnObjects: true
10658
10735
  });
10659
- return notify$1.error(errorMessage);
10736
+ return notify.error(errorMessage);
10660
10737
  }
10661
10738
  }
10662
10739
  }
@@ -10844,7 +10921,7 @@ const init$1 = () => {
10844
10921
  const errorMsg = i18next.t("shop:messages.currencyMismatch", {
10845
10922
  currency: userCurrency
10846
10923
  });
10847
- notify$1.error(errorMsg);
10924
+ notify.error(errorMsg);
10848
10925
  }
10849
10926
  });
10850
10927
  }
@@ -10937,7 +11014,7 @@ const init = () => {
10937
11014
  unblurElemWhenUserLogsIn(elemDeepClone, entitlements);
10938
11015
  unblurElemWhenUserLogsOut(elemDeepClone, entitlements);
10939
11016
  const NOTIFICATION_ID = "entitlement";
10940
- notify$1( /*#__PURE__*/React__default['default'].createElement("p", null, /*#__PURE__*/React__default['default'].createElement(Trans, {
11017
+ notify( /*#__PURE__*/React__default['default'].createElement("p", null, /*#__PURE__*/React__default['default'].createElement(Trans, {
10941
11018
  i18nKey: "messages:entitlement"
10942
11019
  }, "Some of the content on this page is available with one or more of our plans.", /*#__PURE__*/React__default['default'].createElement(Link, {
10943
11020
  onClick: () => {
@@ -10952,7 +11029,7 @@ const init = () => {
10952
11029
  plan: selectedPlan
10953
11030
  });
10954
11031
  }
10955
- notify$1.dismiss(NOTIFICATION_ID);
11032
+ notify.dismiss(NOTIFICATION_ID);
10956
11033
  switchView("_plan-select-entitlements");
10957
11034
  }
10958
11035
  }, "Subscribe"), "now to get full page access.")), {
@@ -11164,16 +11241,12 @@ const initPaywalls = () => {
11164
11241
  };
11165
11242
  const loadPaymentSDKs = () => {
11166
11243
  // Lazy load stripe's SDK
11167
- const {
11168
- whenUserReady
11169
- } = usePelcro.getStore();
11244
+ usePelcro.getStore();
11170
11245
  const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
11171
11246
  const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
11172
- whenUserReady(() => {
11173
- if (!window.Stripe && !supportsVantiv && !supportsTap) {
11174
- pure_1(window.Pelcro.environment.stripe);
11175
- }
11176
- });
11247
+ if (!window.Stripe && !supportsVantiv && !supportsTap) {
11248
+ pure_1(window.Pelcro.environment.stripe);
11249
+ }
11177
11250
 
11178
11251
  // Load PayPal SDKs
11179
11252
  const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
@@ -11563,9 +11636,9 @@ const verifyEmailTokenFromUrl = () => {
11563
11636
  token: emailToken
11564
11637
  }, (err, res) => {
11565
11638
  if (err) {
11566
- return notify$1.error(getErrorMessages(err));
11639
+ return notify.error(getErrorMessages(err));
11567
11640
  }
11568
- return notify$1.success(translations.success);
11641
+ return notify.success(translations.success);
11569
11642
  });
11570
11643
  }, {
11571
11644
  once: true
@@ -11589,7 +11662,7 @@ const verifyLinkTokenFromUrl = () => {
11589
11662
  token: loginToken
11590
11663
  }, (err, res) => {
11591
11664
  if (err) {
11592
- return notify$1.error(getErrorMessages(err));
11665
+ return notify.error(getErrorMessages(err));
11593
11666
  }
11594
11667
  const {
11595
11668
  auth_token
@@ -11598,10 +11671,10 @@ const verifyLinkTokenFromUrl = () => {
11598
11671
  auth_token
11599
11672
  }, (err, res) => {
11600
11673
  if (err) {
11601
- return notify$1.error(getErrorMessages(err));
11674
+ return notify.error(getErrorMessages(err));
11602
11675
  }
11603
11676
  resetView();
11604
- return notify$1.success(translations.success);
11677
+ return notify.success(translations.success);
11605
11678
  });
11606
11679
  });
11607
11680
  }, {
@@ -11676,7 +11749,7 @@ const showInvoiceDetailsFromUrl = () => {
11676
11749
  const errorMessage = i18next.t("messages:invalidInvoice", {
11677
11750
  returnObjects: true
11678
11751
  });
11679
- return notify$1.error(errorMessage);
11752
+ return notify.error(errorMessage);
11680
11753
  }
11681
11754
  const {
11682
11755
  invoice
@@ -11685,7 +11758,7 @@ const showInvoiceDetailsFromUrl = () => {
11685
11758
  const errorMessage = i18next.t("messages:zeroTotalInvoice", {
11686
11759
  returnObjects: true
11687
11760
  });
11688
- return notify$1.error(errorMessage);
11761
+ return notify.error(errorMessage);
11689
11762
  }
11690
11763
  return switchView("invoice-details");
11691
11764
  });
@@ -11710,7 +11783,7 @@ const showSubscriptionManageMembersFromUrl = () => {
11710
11783
  const errorMessage = i18next.t("messages:invalidSubscription", {
11711
11784
  returnObjects: true
11712
11785
  });
11713
- return notify$1.error(errorMessage);
11786
+ return notify.error(errorMessage);
11714
11787
  }
11715
11788
  return switchView("manage-members");
11716
11789
  });
@@ -14820,7 +14893,7 @@ class DonationModal extends React.Component {
14820
14893
  className: "plc-bg-gray-100 plc-rounded-md plc-p-3 plc-mt-3 plc-text-sm plc-flex plc-items-center"
14821
14894
  }, /*#__PURE__*/React__default['default'].createElement("div", {
14822
14895
  className: "plc-flex plc-items-center plc-flex-1"
14823
- }, "Auto renewed:", " ", /*#__PURE__*/React__default['default'].createElement("span", {
14896
+ }, "Auto renew:", " ", /*#__PURE__*/React__default['default'].createElement("span", {
14824
14897
  className: "plc-inline-flex plc-w-6 plc-ml-1"
14825
14898
  }, plan.auto_renew ? /*#__PURE__*/React__default['default'].createElement(SvgCheck, {
14826
14899
  className: "plc-text-green-500"
@@ -14839,7 +14912,7 @@ class DonationModal extends React.Component {
14839
14912
  }, plan.preset_donation_values.map(value => /*#__PURE__*/React__default['default'].createElement("li", {
14840
14913
  key: value
14841
14914
  }, /*#__PURE__*/React__default['default'].createElement("button", {
14842
- className: `plc-bg-white plc-rounded-md plc-flex plc-items-center plc-justify-center plc-text-lg plc-w-full plc-min-h-20 focus:plc-outline-none ${isChecked && +this.state.selectedDonationAmount === +value ? "plc-border-primary-500 plc-text-primary-900 plc-border-2" : "plc-border-gray-200 plc-text-gray-900 plc-border"}`,
14915
+ className: `plc-bg-white plc-rounded-md plc-flex plc-items-center plc-justify-center plc-text-lg plc-w-full plc-min-h-16 focus:plc-outline-none ${isChecked && +this.state.selectedDonationAmount === +value ? "plc-border-primary-500 plc-text-primary-900 plc-border-2" : "plc-border-gray-200 plc-text-gray-900 plc-border"}`,
14843
14916
  onClick: () => {
14844
14917
  this.setState({
14845
14918
  selectedDonationAmount: +value,
@@ -14847,7 +14920,11 @@ class DonationModal extends React.Component {
14847
14920
  disabled: false
14848
14921
  });
14849
14922
  }
14850
- }, getFormattedPriceByLocal(value, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()))))), /*#__PURE__*/React__default['default'].createElement("div", {
14923
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
14924
+ className: "plc-font-bold plc-mr-1"
14925
+ }, value), /*#__PURE__*/React__default['default'].createElement("span", {
14926
+ className: "plc-uppercase"
14927
+ }, plan === null || plan === void 0 ? void 0 : plan.currency))))), /*#__PURE__*/React__default['default'].createElement("div", {
14851
14928
  className: "plc-relative plc-py-3 plc-mt-3"
14852
14929
  }, /*#__PURE__*/React__default['default'].createElement("hr", null), " ", /*#__PURE__*/React__default['default'].createElement("span", {
14853
14930
  className: "plc-absolute plc-top-1/2 plc-left-1/2 plc-transform plc--translate-x-1/2 plc--translate-y-1/2 plc-leading-none plc-bg-white plc-px-2"
@@ -14872,8 +14949,9 @@ class DonationModal extends React.Component {
14872
14949
  });
14873
14950
  }
14874
14951
  },
14875
- placeholder: "Donate a custome amount ...",
14876
- className: "plc-pr-14"
14952
+ placeholder: "Donate a custom amount ...",
14953
+ className: "plc-pr-14",
14954
+ wrapperClassName: "plc-mb-0"
14877
14955
  }), /*#__PURE__*/React__default['default'].createElement("span", {
14878
14956
  className: "plc-absolute plc-top-1/2 plc-transform plc--translate-y-1/2 plc-right-3 plc-pl-3 plc-border-l plc-border-gray-200 plc-uppercase plc-text-sm"
14879
14957
  }, plan.currency)));
@@ -15023,7 +15101,7 @@ class DonationModal extends React.Component {
15023
15101
  }, this.product && this.product.paywall.select_title || ((_window$Pelcro$produc2 = window.Pelcro.product.list()[0]) === null || _window$Pelcro$produc2 === void 0 ? void 0 : _window$Pelcro$produc2.paywall.select_title)), /*#__PURE__*/React__default['default'].createElement("p", null, this.product && this.product.paywall.select_subtitle || ((_window$Pelcro$produc3 = window.Pelcro.product.list()[0]) === null || _window$Pelcro$produc3 === void 0 ? void 0 : _window$Pelcro$produc3.paywall.select_subtitle))), /*#__PURE__*/React__default['default'].createElement("div", {
15024
15102
  className: "pelcro-select-products-wrapper"
15025
15103
  }, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
15026
- className: "plc-overflow-y-scroll plc-max-h-72 pelcro-select-plans-wrapper"
15104
+ className: "plc-overflow-y-scroll pelcro-select-plans-wrapper"
15027
15105
  }, this.renderPlans()), !window.Pelcro.user.isAuthenticated() && (_this$state$product = this.state.product) !== null && _this$state$product !== void 0 && _this$state$product.address_required ? /*#__PURE__*/React__default['default'].createElement(Button, {
15028
15106
  disabled: this.state.disabled,
15029
15107
  onClick: () => this.submitOption(true),
@@ -18798,18 +18876,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18798
18876
  const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
18799
18877
  const PaymentMethodContainer = props => {
18800
18878
  const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
18801
- const {
18802
- whenUserReady
18803
- } = usePelcro.getStore();
18879
+ usePelcro.getStore();
18804
18880
  const cardProcessor = getSiteCardProcessor();
18805
18881
  React.useEffect(() => {
18806
- whenUserReady(() => {
18807
- if (!window.Stripe && cardProcessor === "stripe") {
18808
- document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
18809
- setIsStripeLoaded(true);
18810
- });
18811
- }
18812
- });
18882
+ if (!window.Stripe && cardProcessor === "stripe") {
18883
+ document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
18884
+ setIsStripeLoaded(true);
18885
+ });
18886
+ }
18813
18887
  }, []);
18814
18888
  if (isStripeLoaded) {
18815
18889
  return /*#__PURE__*/React__default['default'].createElement(es_13, {
@@ -18976,13 +19050,15 @@ const DiscountedPrice = props => {
18976
19050
  };
18977
19051
 
18978
19052
  const SubmitPaymentMethod = _ref => {
18979
- var _plan$quantity, _window$Pelcro$site$r;
19053
+ var _plan$quantity, _plan$quantity2, _plan$quantity3, _window$Pelcro$site$r;
18980
19054
  let {
18981
19055
  onClick,
18982
19056
  ...otherProps
18983
19057
  } = _ref;
18984
19058
  const {
18985
- plan
19059
+ plan,
19060
+ selectedDonationAmount,
19061
+ customDonationAmount
18986
19062
  } = usePelcro();
18987
19063
  const {
18988
19064
  t
@@ -19004,7 +19080,13 @@ const SubmitPaymentMethod = _ref => {
19004
19080
  } = React.useContext(store$k);
19005
19081
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
19006
19082
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
19007
- const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19083
+ // const priceFormatted = getFormattedPriceByLocal(
19084
+ // price * planQuantity,
19085
+ // plan?.currency,
19086
+ // getPageOrDefaultLanguage()
19087
+ // );
19088
+
19089
+ const priceFormatted = plan.type === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19008
19090
  const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
19009
19091
  const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
19010
19092
  const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
@@ -20054,7 +20136,7 @@ const SubscriptionCancelNowButton = _ref => {
20054
20136
  switchView(null);
20055
20137
 
20056
20138
  //Show confirmation alert after closing the modal
20057
- notify$1.confirm((onSuccess, onFailure) => {
20139
+ notify.confirm((onSuccess, onFailure) => {
20058
20140
  cancelSubscription(payload, onSuccess, onFailure);
20059
20141
  }, {
20060
20142
  confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
@@ -20124,7 +20206,7 @@ const SubscriptionCancelLaterButton = _ref => {
20124
20206
  switchView(null);
20125
20207
 
20126
20208
  //Show confirmation alert after closing the modal
20127
- notify$1.confirm((onSuccess, onFailure) => {
20209
+ notify.confirm((onSuccess, onFailure) => {
20128
20210
  cancelSubscription(payload, onSuccess, onFailure);
20129
20211
  }, {
20130
20212
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -20359,7 +20441,7 @@ const SubscriptionSuspendButton = _ref => {
20359
20441
  switchView(null);
20360
20442
 
20361
20443
  //Show confirmation alert after closing the modal
20362
- notify$1.confirm((onSuccess, onFailure) => {
20444
+ notify.confirm((onSuccess, onFailure) => {
20363
20445
  suspendSubscription(payload, onSuccess, onFailure);
20364
20446
  }, {
20365
20447
  confirmMessage: t("messages.subCancellation.isSureToSuspendNow"),
@@ -22419,7 +22501,7 @@ const AddressCreateContainer = _ref => {
22419
22501
  });
22420
22502
  return onFailure(err);
22421
22503
  }
22422
- notify$1.success(t("messages.addressUpdated"));
22504
+ notify.success(t("messages.addressUpdated"));
22423
22505
  return onMembershipAdressUpdateSuccess(res);
22424
22506
  });
22425
22507
  }
@@ -25930,7 +26012,7 @@ const AddressSelectContainer = _ref => {
25930
26012
  });
25931
26013
  return onFailure(err);
25932
26014
  }
25933
- notify$1.success(t("messages.addressUpdated"));
26015
+ notify.success(t("messages.addressUpdated"));
25934
26016
  return onMembershipAdressUpdateSuccess(res);
25935
26017
  });
25936
26018
  }
@@ -27889,7 +27971,7 @@ const SubscriptionsItems = _ref => {
27889
27971
  return switchView("email-verify");
27890
27972
  }
27891
27973
  onClose === null || onClose === void 0 ? void 0 : onClose();
27892
- notify$1.confirm((onSuccess, onFailure) => {
27974
+ notify.confirm((onSuccess, onFailure) => {
27893
27975
  cancelSubscription(sub.id, onSuccess, onFailure);
27894
27976
  }, {
27895
27977
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -27906,7 +27988,7 @@ const SubscriptionsItems = _ref => {
27906
27988
  if (userMustVerifyEmail()) {
27907
27989
  return switchView("email-verify");
27908
27990
  }
27909
- reactivateSubscription(sub.id);
27991
+ reactivateSubscription(sub.id, false);
27910
27992
  };
27911
27993
 
27912
27994
  // Renew click
@@ -27944,7 +28026,7 @@ const SubscriptionsItems = _ref => {
27944
28026
  return switchView("email-verify");
27945
28027
  }
27946
28028
  onClose === null || onClose === void 0 ? void 0 : onClose();
27947
- notify$1.confirm((onSuccess, onFailure) => {
28029
+ notify.confirm((onSuccess, onFailure) => {
27948
28030
  unSuspendSubscription(sub.id, onSuccess, onFailure);
27949
28031
  }, {
27950
28032
  confirmMessage: t("messages.subUnSuspend.isSureToUnSuspend"),
@@ -28026,7 +28108,7 @@ const SubscriptionsItems = _ref => {
28026
28108
  onClick: onCancelClick,
28027
28109
  disabled: disableSubmit,
28028
28110
  "data-key": sub.id
28029
- }, t("labels.unsubscribe")) : "", (sub === null || sub === void 0 ? void 0 : (_sub$plan = sub.plan) === null || _sub$plan === void 0 ? void 0 : _sub$plan.type) === 'membership' && /*#__PURE__*/React__default['default'].createElement(Button, {
28111
+ }, t("labels.unsubscribe")) : "", (sub === null || sub === void 0 ? void 0 : (_sub$plan = sub.plan) === null || _sub$plan === void 0 ? void 0 : _sub$plan.type) === "membership" && /*#__PURE__*/React__default['default'].createElement(Button, {
28030
28112
  variant: "ghost",
28031
28113
  className: "plc-text-blue-400 pelcro-dashboard-sub-manage-members-button",
28032
28114
  icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
@@ -28073,7 +28155,10 @@ const SubscriptionsItems = _ref => {
28073
28155
  };
28074
28156
  function getNonDonationSubs() {
28075
28157
  var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3;
28076
- return (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => !sub.plan.is_donation)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
28158
+ return (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => {
28159
+ var _sub$plan2;
28160
+ return ((_sub$plan2 = sub.plan) === null || _sub$plan2 === void 0 ? void 0 : _sub$plan2.type) !== "donation";
28161
+ })) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
28077
28162
  }
28078
28163
  function isDateAfterToday(date) {
28079
28164
  const today = new Date().setHours(0, 0, 0, 0);
@@ -28361,6 +28446,7 @@ function SvgQrcode(props) {
28361
28446
 
28362
28447
  const DonationsMenu = _ref => {
28363
28448
  let {
28449
+ onClose,
28364
28450
  reactivateSubscription,
28365
28451
  disableSubmit,
28366
28452
  cancelSubscription
@@ -28372,10 +28458,9 @@ const DonationsMenu = _ref => {
28372
28458
  switchView,
28373
28459
  setSubscriptionToCancel
28374
28460
  } = usePelcro();
28375
- const subscriptions = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
28461
+ const donations = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
28376
28462
  // Cancel button click handlers
28377
28463
  const onCancelClick = () => {
28378
- var _onClose;
28379
28464
  const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
28380
28465
  if (isImmediateCancelationEnabled) {
28381
28466
  setSubscriptionToCancel(sub.id);
@@ -28384,16 +28469,16 @@ const DonationsMenu = _ref => {
28384
28469
  if (userMustVerifyEmail()) {
28385
28470
  return switchView("email-verify");
28386
28471
  }
28387
- (_onClose = onClose) === null || _onClose === void 0 ? void 0 : _onClose();
28472
+ onClose === null || onClose === void 0 ? void 0 : onClose();
28388
28473
  notify.confirm((onSuccess, onFailure) => {
28389
28474
  cancelSubscription(sub.id, onSuccess, onFailure);
28390
28475
  }, {
28391
- confirmMessage: t("messages.subCancellation.isSureToCancel"),
28392
- loadingMessage: t("messages.subCancellation.loading"),
28393
- successMessage: t("messages.subCancellation.success"),
28394
- errorMessage: t("messages.subCancellation.error")
28476
+ confirmMessage: t("messages.donationCancellation.isSureToCancel"),
28477
+ loadingMessage: t("messages.donationCancellation.loading"),
28478
+ successMessage: t("messages.donationCancellation.success"),
28479
+ errorMessage: t("messages.donationCancellation.error")
28395
28480
  }, {
28396
- closeButtonLabel: t("labels.subCancellation.goBack")
28481
+ closeButtonLabel: t("labels.donationCancellation.goBack")
28397
28482
  });
28398
28483
  };
28399
28484
 
@@ -28402,7 +28487,7 @@ const DonationsMenu = _ref => {
28402
28487
  if (userMustVerifyEmail()) {
28403
28488
  return switchView("email-verify");
28404
28489
  }
28405
- reactivateSubscription(sub.id);
28490
+ reactivateSubscription(sub.id, true);
28406
28491
  };
28407
28492
  return /*#__PURE__*/React__default['default'].createElement("tr", {
28408
28493
  key: sub.id,
@@ -28443,12 +28528,18 @@ const DonationsMenu = _ref => {
28443
28528
  className: "plc-w-3/12 "
28444
28529
  }, t("labels.actions")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
28445
28530
  className: "plc-h-4"
28446
- }), subscriptions));
28531
+ }), donations));
28447
28532
  };
28448
28533
  function getDonationSubs() {
28449
28534
  var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r, _window$Pelcro$user$r2;
28450
- const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
28451
- const canceledDonations = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
28535
+ const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => {
28536
+ var _sub$plan;
28537
+ return ((_sub$plan = sub.plan) === null || _sub$plan === void 0 ? void 0 : _sub$plan.type) === "donation";
28538
+ })) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
28539
+ const canceledDonations = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.filter(sub => {
28540
+ var _sub$plan2;
28541
+ return ((_sub$plan2 = sub.plan) === null || _sub$plan2 === void 0 ? void 0 : _sub$plan2.type) === "donation";
28542
+ })) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
28452
28543
  return [...donations, ...canceledDonations];
28453
28544
  }
28454
28545
  function formatStartDate(date) {
@@ -28837,7 +28928,7 @@ class Dashboard extends React.Component {
28837
28928
  const formattedRenewDate = new Intl.DateTimeFormat("en-CA").format(renewDate);
28838
28929
  return `${this.locale("labels.renewsOn")} ${formattedRenewDate}`;
28839
28930
  });
28840
- _defineProperty$3(this, "reactivateSubscription", subscription_id => {
28931
+ _defineProperty$3(this, "reactivateSubscription", (subscription_id, isDonation) => {
28841
28932
  // disable the Login button to prevent repeated clicks
28842
28933
  this.setState({
28843
28934
  disableSubmit: true
@@ -28851,9 +28942,17 @@ class Dashboard extends React.Component {
28851
28942
  });
28852
28943
  this.props.onClose();
28853
28944
  if (err) {
28854
- return notify$1.error(this.locale("messages.subReactivation.error"));
28945
+ if (isDonation) {
28946
+ return notify.error(this.locale("messages.donationReactivation.error"));
28947
+ } else {
28948
+ return notify.error(this.locale("messages.subReactivation.error"));
28949
+ }
28950
+ }
28951
+ if (isDonation) {
28952
+ return notify.success(this.locale("messages.donationReactivation.success"));
28953
+ } else {
28954
+ return notify.success(this.locale("messages.subReactivation.success"));
28855
28955
  }
28856
- return notify$1.success(this.locale("messages.subReactivation.success"));
28857
28956
  });
28858
28957
  });
28859
28958
  _defineProperty$3(this, "getSubscriptionStatus", sub => {
@@ -29215,6 +29314,7 @@ class Dashboard extends React.Component {
29215
29314
  }),
29216
29315
  title: this.locale("labels.donations"),
29217
29316
  content: /*#__PURE__*/React__default['default'].createElement(DonationsMenu, {
29317
+ onClose: this.props.onClose,
29218
29318
  reactivateSubscription: this.reactivateSubscription,
29219
29319
  disableSubmit: this.state.disableSubmit,
29220
29320
  cancelSubscription: this.cancelSubscription
@@ -29256,8 +29356,14 @@ function hasInvoices() {
29256
29356
  }
29257
29357
  function hasDonationSubs() {
29258
29358
  var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
29259
- const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
29260
- const canceledDonations = (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : [];
29359
+ const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => {
29360
+ var _sub$plan;
29361
+ return ((_sub$plan = sub.plan) === null || _sub$plan === void 0 ? void 0 : _sub$plan.type) === "donation";
29362
+ })) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
29363
+ const canceledDonations = (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.filter(sub => {
29364
+ var _sub$plan2;
29365
+ return ((_sub$plan2 = sub.plan) === null || _sub$plan2 === void 0 ? void 0 : _sub$plan2.type) === "donation";
29366
+ })) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : [];
29261
29367
  return donations.length > 0 || canceledDonations.length > 0;
29262
29368
  }
29263
29369
  function hasActiveMemberships() {
@@ -31422,7 +31528,7 @@ function VerifyLinkTokenModal(_ref) {
31422
31528
  var _props$onSuccess;
31423
31529
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
31424
31530
  resetView();
31425
- notify$1.success(t("messages.success"));
31531
+ notify.success(t("messages.success"));
31426
31532
  };
31427
31533
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
31428
31534
  id: "pelcro-login-modal",
@@ -33314,6 +33420,6 @@ exports.i18n = i18next;
33314
33420
  exports.initButtons = init$1;
33315
33421
  exports.initContentEntitlement = init;
33316
33422
  exports.invoicePaymentSubmitButton = invoicePaymentSubmitButton;
33317
- exports.notify = notify$1;
33423
+ exports.notify = notify;
33318
33424
  exports.unauthenticatedButtons = unauthenticatedButtons;
33319
33425
  exports.usePelcro = usePelcro;
package/dist/index.esm.js CHANGED
@@ -3915,6 +3915,9 @@ var labels$Y = {
3915
3915
  },
3916
3916
  subCancellation: {
3917
3917
  goBack: "Go back"
3918
+ },
3919
+ donationCancellation: {
3920
+ goBack: "Go back"
3918
3921
  }
3919
3922
  };
3920
3923
  var messages$_ = {
@@ -3934,6 +3937,22 @@ var messages$_ = {
3934
3937
  loading: "Unsuspending your subscription",
3935
3938
  success: "Subscription is successfully unsuspended",
3936
3939
  error: "Error while unsuspending your subscription"
3940
+ },
3941
+ donationCancellation: {
3942
+ isSureToCancel: "Are you sure you want to cancel your donation?",
3943
+ loading: "Cancelling your donation",
3944
+ success: "Donation is successfully cancelled",
3945
+ error: "Error while cancelling your donation"
3946
+ },
3947
+ donationReactivation: {
3948
+ success: "Donation is successfully reactivated",
3949
+ error: "Error while reactivating your donation"
3950
+ },
3951
+ donationUnSuspend: {
3952
+ isSureToUnSuspend: "Are you sure you want to unsuspend your donation?",
3953
+ loading: "Unsuspending your donation",
3954
+ success: "Donation is successfully unsuspended",
3955
+ error: "Error while unsuspending your donation"
3937
3956
  }
3938
3957
  };
3939
3958
  var dashboard_en = {
@@ -4893,6 +4912,9 @@ var labels$C = {
4893
4912
  },
4894
4913
  subCancellation: {
4895
4914
  goBack: "Retourner"
4915
+ },
4916
+ donationCancellation: {
4917
+ goBack: "Go back"
4896
4918
  }
4897
4919
  };
4898
4920
  var messages$F = {
@@ -4912,6 +4934,22 @@ var messages$F = {
4912
4934
  loading: "Annulation de la suspension de votre abonnement",
4913
4935
  success: "L'abonnement a été suspendu avec succès",
4914
4936
  error: "Erreur lors de l'annulation de la suspension de votre abonnement"
4937
+ },
4938
+ donationCancellation: {
4939
+ isSureToCancel: "Êtes-vous certain de vouloir annuler votre don?",
4940
+ loading: "Annulation de l'don",
4941
+ success: "L'don a été annulé avec succès",
4942
+ error: "Une erreur s'est produite lors de l'annulation de l'don"
4943
+ },
4944
+ donationReactivation: {
4945
+ success: "L'don a été réactivé avec succès",
4946
+ error: "Erreur lors de la réactivation de votre don"
4947
+ },
4948
+ donationUnSuspend: {
4949
+ isSureToUnSuspend: "Êtes-vous sûr de vouloir annuler la suspension de votre don ?",
4950
+ loading: "Annulation de la suspension de votre don",
4951
+ success: "L'don a été suspendu avec succès",
4952
+ error: "Erreur lors de l'annulation de la suspension de votre don"
4915
4953
  }
4916
4954
  };
4917
4955
  var dashboard_fr = {
@@ -5816,6 +5854,9 @@ var savedItems = {
5816
5854
  var subCancellation = {
5817
5855
  goBack: "뒤로 가기"
5818
5856
  };
5857
+ var donationCancellation = {
5858
+ goBack: "뒤로 가기"
5859
+ };
5819
5860
  var messages$n = {
5820
5861
  noCard: "등록된 카드가 없습니다.",
5821
5862
  subCancellation: {
@@ -5833,6 +5874,22 @@ var messages$n = {
5833
5874
  loading: "구독 일시 중단 해제",
5834
5875
  success: "구독이 성공적으로 일시 중단 해제되었습니다",
5835
5876
  error: "구독 일시 중단을 해제하는 동안 오류가 발생했습니다."
5877
+ },
5878
+ donationCancellation: {
5879
+ isSureToCancel: "정말로 유료 멤버십을 취소하시겠습니까?",
5880
+ loading: "귀하의 유료 멤버십을 취소합니다.",
5881
+ success: "유료 멤버십이 성공적으로 취소되었습니다.",
5882
+ error: "유료 멤버십 취소 과정에서 오류가 발생했습니다."
5883
+ },
5884
+ donationReactivation: {
5885
+ success: "구독이 성공적으로 재활성화되었습니다.",
5886
+ error: "구독을 재활성화하는 동안 오류가 발생했습니다."
5887
+ },
5888
+ donationUnSuspend: {
5889
+ isSureToUnSuspend: "구독 일시 중단을 해제하시겠습니까?",
5890
+ loading: "구독 일시 중단 해제",
5891
+ success: "구독이 성공적으로 일시 중단 해제되었습니다",
5892
+ error: "구독 일시 중단을 해제하는 동안 오류가 발생했습니다."
5836
5893
  }
5837
5894
  };
5838
5895
  var dashboard_ko = {
@@ -5885,6 +5942,7 @@ var dashboard_ko = {
5885
5942
  orders: orders,
5886
5943
  savedItems: savedItems,
5887
5944
  subCancellation: subCancellation,
5945
+ donationCancellation: donationCancellation,
5888
5946
  messages: messages$n
5889
5947
  };
5890
5948
 
@@ -6716,6 +6774,9 @@ var labels$6 = {
6716
6774
  },
6717
6775
  subCancellation: {
6718
6776
  goBack: "Volver"
6777
+ },
6778
+ donationCancellation: {
6779
+ goBack: "Go back"
6719
6780
  }
6720
6781
  };
6721
6782
  var messages$5 = {
@@ -6735,6 +6796,22 @@ var messages$5 = {
6735
6796
  loading: "Reanudando tu suscripción",
6736
6797
  success: "La suscripción se reanudó con éxito",
6737
6798
  error: "Error al reanudar tu suscripción"
6799
+ },
6800
+ donationCancellation: {
6801
+ isSureToCancel: "¿Estás seguro de que quieres cancelar tu donación?",
6802
+ loading: "Cancelando tu donación",
6803
+ success: "La donación se canceló con éxito",
6804
+ error: "Error al cancelar tu donación"
6805
+ },
6806
+ donationReactivation: {
6807
+ success: "La donación se reactivó con éxito",
6808
+ error: "Error al reactivar su donación"
6809
+ },
6810
+ donationUnSuspend: {
6811
+ isSureToUnSuspend: "¿Estás seguro de que quieres reanudar tu donación?",
6812
+ loading: "Reanudando tu donación",
6813
+ success: "La donación se reanudó con éxito",
6814
+ error: "Error al reanudar tu donación"
6738
6815
  }
6739
6816
  };
6740
6817
  var dashboard_es = {
@@ -10544,7 +10621,7 @@ toast.confirm = function (onConfirm, _ref3) {
10544
10621
  ...options
10545
10622
  });
10546
10623
  setTimeout(() => {
10547
- notify$1.dismiss(id);
10624
+ notify.dismiss(id);
10548
10625
  }, 3000);
10549
10626
  };
10550
10627
  const onFailure = errorValue => {
@@ -10553,11 +10630,11 @@ toast.confirm = function (onConfirm, _ref3) {
10553
10630
  ...options
10554
10631
  });
10555
10632
  setTimeout(() => {
10556
- notify$1.dismiss(id);
10633
+ notify.dismiss(id);
10557
10634
  }, 3000);
10558
10635
  };
10559
10636
  };
10560
- const notify$1 = toast;
10637
+ const notify = toast;
10561
10638
 
10562
10639
  const translations = i18next.t("common:buttons", {
10563
10640
  returnObjects: true
@@ -10618,7 +10695,7 @@ const init$1 = () => {
10618
10695
  const errorMessage = i18next.t("messages:invalidSubscription", {
10619
10696
  returnObjects: true
10620
10697
  });
10621
- return notify$1.error(errorMessage);
10698
+ return notify.error(errorMessage);
10622
10699
  }
10623
10700
  switchView("manage-members");
10624
10701
  });
@@ -10626,7 +10703,7 @@ const init$1 = () => {
10626
10703
  const errorMessage = i18next.t("messages:invalidSubscription", {
10627
10704
  returnObjects: true
10628
10705
  });
10629
- return notify$1.error(errorMessage);
10706
+ return notify.error(errorMessage);
10630
10707
  }
10631
10708
  }
10632
10709
  }
@@ -10814,7 +10891,7 @@ const init$1 = () => {
10814
10891
  const errorMsg = i18next.t("shop:messages.currencyMismatch", {
10815
10892
  currency: userCurrency
10816
10893
  });
10817
- notify$1.error(errorMsg);
10894
+ notify.error(errorMsg);
10818
10895
  }
10819
10896
  });
10820
10897
  }
@@ -10907,7 +10984,7 @@ const init = () => {
10907
10984
  unblurElemWhenUserLogsIn(elemDeepClone, entitlements);
10908
10985
  unblurElemWhenUserLogsOut(elemDeepClone, entitlements);
10909
10986
  const NOTIFICATION_ID = "entitlement";
10910
- notify$1( /*#__PURE__*/React__default.createElement("p", null, /*#__PURE__*/React__default.createElement(Trans, {
10987
+ notify( /*#__PURE__*/React__default.createElement("p", null, /*#__PURE__*/React__default.createElement(Trans, {
10911
10988
  i18nKey: "messages:entitlement"
10912
10989
  }, "Some of the content on this page is available with one or more of our plans.", /*#__PURE__*/React__default.createElement(Link, {
10913
10990
  onClick: () => {
@@ -10922,7 +10999,7 @@ const init = () => {
10922
10999
  plan: selectedPlan
10923
11000
  });
10924
11001
  }
10925
- notify$1.dismiss(NOTIFICATION_ID);
11002
+ notify.dismiss(NOTIFICATION_ID);
10926
11003
  switchView("_plan-select-entitlements");
10927
11004
  }
10928
11005
  }, "Subscribe"), "now to get full page access.")), {
@@ -11134,16 +11211,12 @@ const initPaywalls = () => {
11134
11211
  };
11135
11212
  const loadPaymentSDKs = () => {
11136
11213
  // Lazy load stripe's SDK
11137
- const {
11138
- whenUserReady
11139
- } = usePelcro.getStore();
11214
+ usePelcro.getStore();
11140
11215
  const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
11141
11216
  const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
11142
- whenUserReady(() => {
11143
- if (!window.Stripe && !supportsVantiv && !supportsTap) {
11144
- pure_1(window.Pelcro.environment.stripe);
11145
- }
11146
- });
11217
+ if (!window.Stripe && !supportsVantiv && !supportsTap) {
11218
+ pure_1(window.Pelcro.environment.stripe);
11219
+ }
11147
11220
 
11148
11221
  // Load PayPal SDKs
11149
11222
  const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
@@ -11533,9 +11606,9 @@ const verifyEmailTokenFromUrl = () => {
11533
11606
  token: emailToken
11534
11607
  }, (err, res) => {
11535
11608
  if (err) {
11536
- return notify$1.error(getErrorMessages(err));
11609
+ return notify.error(getErrorMessages(err));
11537
11610
  }
11538
- return notify$1.success(translations.success);
11611
+ return notify.success(translations.success);
11539
11612
  });
11540
11613
  }, {
11541
11614
  once: true
@@ -11559,7 +11632,7 @@ const verifyLinkTokenFromUrl = () => {
11559
11632
  token: loginToken
11560
11633
  }, (err, res) => {
11561
11634
  if (err) {
11562
- return notify$1.error(getErrorMessages(err));
11635
+ return notify.error(getErrorMessages(err));
11563
11636
  }
11564
11637
  const {
11565
11638
  auth_token
@@ -11568,10 +11641,10 @@ const verifyLinkTokenFromUrl = () => {
11568
11641
  auth_token
11569
11642
  }, (err, res) => {
11570
11643
  if (err) {
11571
- return notify$1.error(getErrorMessages(err));
11644
+ return notify.error(getErrorMessages(err));
11572
11645
  }
11573
11646
  resetView();
11574
- return notify$1.success(translations.success);
11647
+ return notify.success(translations.success);
11575
11648
  });
11576
11649
  });
11577
11650
  }, {
@@ -11646,7 +11719,7 @@ const showInvoiceDetailsFromUrl = () => {
11646
11719
  const errorMessage = i18next.t("messages:invalidInvoice", {
11647
11720
  returnObjects: true
11648
11721
  });
11649
- return notify$1.error(errorMessage);
11722
+ return notify.error(errorMessage);
11650
11723
  }
11651
11724
  const {
11652
11725
  invoice
@@ -11655,7 +11728,7 @@ const showInvoiceDetailsFromUrl = () => {
11655
11728
  const errorMessage = i18next.t("messages:zeroTotalInvoice", {
11656
11729
  returnObjects: true
11657
11730
  });
11658
- return notify$1.error(errorMessage);
11731
+ return notify.error(errorMessage);
11659
11732
  }
11660
11733
  return switchView("invoice-details");
11661
11734
  });
@@ -11680,7 +11753,7 @@ const showSubscriptionManageMembersFromUrl = () => {
11680
11753
  const errorMessage = i18next.t("messages:invalidSubscription", {
11681
11754
  returnObjects: true
11682
11755
  });
11683
- return notify$1.error(errorMessage);
11756
+ return notify.error(errorMessage);
11684
11757
  }
11685
11758
  return switchView("manage-members");
11686
11759
  });
@@ -14790,7 +14863,7 @@ class DonationModal extends Component {
14790
14863
  className: "plc-bg-gray-100 plc-rounded-md plc-p-3 plc-mt-3 plc-text-sm plc-flex plc-items-center"
14791
14864
  }, /*#__PURE__*/React__default.createElement("div", {
14792
14865
  className: "plc-flex plc-items-center plc-flex-1"
14793
- }, "Auto renewed:", " ", /*#__PURE__*/React__default.createElement("span", {
14866
+ }, "Auto renew:", " ", /*#__PURE__*/React__default.createElement("span", {
14794
14867
  className: "plc-inline-flex plc-w-6 plc-ml-1"
14795
14868
  }, plan.auto_renew ? /*#__PURE__*/React__default.createElement(SvgCheck, {
14796
14869
  className: "plc-text-green-500"
@@ -14809,7 +14882,7 @@ class DonationModal extends Component {
14809
14882
  }, plan.preset_donation_values.map(value => /*#__PURE__*/React__default.createElement("li", {
14810
14883
  key: value
14811
14884
  }, /*#__PURE__*/React__default.createElement("button", {
14812
- className: `plc-bg-white plc-rounded-md plc-flex plc-items-center plc-justify-center plc-text-lg plc-w-full plc-min-h-20 focus:plc-outline-none ${isChecked && +this.state.selectedDonationAmount === +value ? "plc-border-primary-500 plc-text-primary-900 plc-border-2" : "plc-border-gray-200 plc-text-gray-900 plc-border"}`,
14885
+ className: `plc-bg-white plc-rounded-md plc-flex plc-items-center plc-justify-center plc-text-lg plc-w-full plc-min-h-16 focus:plc-outline-none ${isChecked && +this.state.selectedDonationAmount === +value ? "plc-border-primary-500 plc-text-primary-900 plc-border-2" : "plc-border-gray-200 plc-text-gray-900 plc-border"}`,
14813
14886
  onClick: () => {
14814
14887
  this.setState({
14815
14888
  selectedDonationAmount: +value,
@@ -14817,7 +14890,11 @@ class DonationModal extends Component {
14817
14890
  disabled: false
14818
14891
  });
14819
14892
  }
14820
- }, getFormattedPriceByLocal(value, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()))))), /*#__PURE__*/React__default.createElement("div", {
14893
+ }, /*#__PURE__*/React__default.createElement("span", {
14894
+ className: "plc-font-bold plc-mr-1"
14895
+ }, value), /*#__PURE__*/React__default.createElement("span", {
14896
+ className: "plc-uppercase"
14897
+ }, plan === null || plan === void 0 ? void 0 : plan.currency))))), /*#__PURE__*/React__default.createElement("div", {
14821
14898
  className: "plc-relative plc-py-3 plc-mt-3"
14822
14899
  }, /*#__PURE__*/React__default.createElement("hr", null), " ", /*#__PURE__*/React__default.createElement("span", {
14823
14900
  className: "plc-absolute plc-top-1/2 plc-left-1/2 plc-transform plc--translate-x-1/2 plc--translate-y-1/2 plc-leading-none plc-bg-white plc-px-2"
@@ -14842,8 +14919,9 @@ class DonationModal extends Component {
14842
14919
  });
14843
14920
  }
14844
14921
  },
14845
- placeholder: "Donate a custome amount ...",
14846
- className: "plc-pr-14"
14922
+ placeholder: "Donate a custom amount ...",
14923
+ className: "plc-pr-14",
14924
+ wrapperClassName: "plc-mb-0"
14847
14925
  }), /*#__PURE__*/React__default.createElement("span", {
14848
14926
  className: "plc-absolute plc-top-1/2 plc-transform plc--translate-y-1/2 plc-right-3 plc-pl-3 plc-border-l plc-border-gray-200 plc-uppercase plc-text-sm"
14849
14927
  }, plan.currency)));
@@ -14993,7 +15071,7 @@ class DonationModal extends Component {
14993
15071
  }, this.product && this.product.paywall.select_title || ((_window$Pelcro$produc2 = window.Pelcro.product.list()[0]) === null || _window$Pelcro$produc2 === void 0 ? void 0 : _window$Pelcro$produc2.paywall.select_title)), /*#__PURE__*/React__default.createElement("p", null, this.product && this.product.paywall.select_subtitle || ((_window$Pelcro$produc3 = window.Pelcro.product.list()[0]) === null || _window$Pelcro$produc3 === void 0 ? void 0 : _window$Pelcro$produc3.paywall.select_subtitle))), /*#__PURE__*/React__default.createElement("div", {
14994
15072
  className: "pelcro-select-products-wrapper"
14995
15073
  }, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
14996
- className: "plc-overflow-y-scroll plc-max-h-72 pelcro-select-plans-wrapper"
15074
+ className: "plc-overflow-y-scroll pelcro-select-plans-wrapper"
14997
15075
  }, this.renderPlans()), !window.Pelcro.user.isAuthenticated() && (_this$state$product = this.state.product) !== null && _this$state$product !== void 0 && _this$state$product.address_required ? /*#__PURE__*/React__default.createElement(Button, {
14998
15076
  disabled: this.state.disabled,
14999
15077
  onClick: () => this.submitOption(true),
@@ -18768,18 +18846,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18768
18846
  const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
18769
18847
  const PaymentMethodContainer = props => {
18770
18848
  const [isStripeLoaded, setIsStripeLoaded] = useState(Boolean(window.Stripe));
18771
- const {
18772
- whenUserReady
18773
- } = usePelcro.getStore();
18849
+ usePelcro.getStore();
18774
18850
  const cardProcessor = getSiteCardProcessor();
18775
18851
  useEffect(() => {
18776
- whenUserReady(() => {
18777
- if (!window.Stripe && cardProcessor === "stripe") {
18778
- document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
18779
- setIsStripeLoaded(true);
18780
- });
18781
- }
18782
- });
18852
+ if (!window.Stripe && cardProcessor === "stripe") {
18853
+ document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
18854
+ setIsStripeLoaded(true);
18855
+ });
18856
+ }
18783
18857
  }, []);
18784
18858
  if (isStripeLoaded) {
18785
18859
  return /*#__PURE__*/React__default.createElement(es_13, {
@@ -18946,13 +19020,15 @@ const DiscountedPrice = props => {
18946
19020
  };
18947
19021
 
18948
19022
  const SubmitPaymentMethod = _ref => {
18949
- var _plan$quantity, _window$Pelcro$site$r;
19023
+ var _plan$quantity, _plan$quantity2, _plan$quantity3, _window$Pelcro$site$r;
18950
19024
  let {
18951
19025
  onClick,
18952
19026
  ...otherProps
18953
19027
  } = _ref;
18954
19028
  const {
18955
- plan
19029
+ plan,
19030
+ selectedDonationAmount,
19031
+ customDonationAmount
18956
19032
  } = usePelcro();
18957
19033
  const {
18958
19034
  t
@@ -18974,7 +19050,13 @@ const SubmitPaymentMethod = _ref => {
18974
19050
  } = useContext(store$k);
18975
19051
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
18976
19052
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
18977
- const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19053
+ // const priceFormatted = getFormattedPriceByLocal(
19054
+ // price * planQuantity,
19055
+ // plan?.currency,
19056
+ // getPageOrDefaultLanguage()
19057
+ // );
19058
+
19059
+ const priceFormatted = plan.type === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
18978
19060
  const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
18979
19061
  const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
18980
19062
  const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
@@ -20024,7 +20106,7 @@ const SubscriptionCancelNowButton = _ref => {
20024
20106
  switchView(null);
20025
20107
 
20026
20108
  //Show confirmation alert after closing the modal
20027
- notify$1.confirm((onSuccess, onFailure) => {
20109
+ notify.confirm((onSuccess, onFailure) => {
20028
20110
  cancelSubscription(payload, onSuccess, onFailure);
20029
20111
  }, {
20030
20112
  confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
@@ -20094,7 +20176,7 @@ const SubscriptionCancelLaterButton = _ref => {
20094
20176
  switchView(null);
20095
20177
 
20096
20178
  //Show confirmation alert after closing the modal
20097
- notify$1.confirm((onSuccess, onFailure) => {
20179
+ notify.confirm((onSuccess, onFailure) => {
20098
20180
  cancelSubscription(payload, onSuccess, onFailure);
20099
20181
  }, {
20100
20182
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -20329,7 +20411,7 @@ const SubscriptionSuspendButton = _ref => {
20329
20411
  switchView(null);
20330
20412
 
20331
20413
  //Show confirmation alert after closing the modal
20332
- notify$1.confirm((onSuccess, onFailure) => {
20414
+ notify.confirm((onSuccess, onFailure) => {
20333
20415
  suspendSubscription(payload, onSuccess, onFailure);
20334
20416
  }, {
20335
20417
  confirmMessage: t("messages.subCancellation.isSureToSuspendNow"),
@@ -22389,7 +22471,7 @@ const AddressCreateContainer = _ref => {
22389
22471
  });
22390
22472
  return onFailure(err);
22391
22473
  }
22392
- notify$1.success(t("messages.addressUpdated"));
22474
+ notify.success(t("messages.addressUpdated"));
22393
22475
  return onMembershipAdressUpdateSuccess(res);
22394
22476
  });
22395
22477
  }
@@ -25900,7 +25982,7 @@ const AddressSelectContainer = _ref => {
25900
25982
  });
25901
25983
  return onFailure(err);
25902
25984
  }
25903
- notify$1.success(t("messages.addressUpdated"));
25985
+ notify.success(t("messages.addressUpdated"));
25904
25986
  return onMembershipAdressUpdateSuccess(res);
25905
25987
  });
25906
25988
  }
@@ -27859,7 +27941,7 @@ const SubscriptionsItems = _ref => {
27859
27941
  return switchView("email-verify");
27860
27942
  }
27861
27943
  onClose === null || onClose === void 0 ? void 0 : onClose();
27862
- notify$1.confirm((onSuccess, onFailure) => {
27944
+ notify.confirm((onSuccess, onFailure) => {
27863
27945
  cancelSubscription(sub.id, onSuccess, onFailure);
27864
27946
  }, {
27865
27947
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -27876,7 +27958,7 @@ const SubscriptionsItems = _ref => {
27876
27958
  if (userMustVerifyEmail()) {
27877
27959
  return switchView("email-verify");
27878
27960
  }
27879
- reactivateSubscription(sub.id);
27961
+ reactivateSubscription(sub.id, false);
27880
27962
  };
27881
27963
 
27882
27964
  // Renew click
@@ -27914,7 +27996,7 @@ const SubscriptionsItems = _ref => {
27914
27996
  return switchView("email-verify");
27915
27997
  }
27916
27998
  onClose === null || onClose === void 0 ? void 0 : onClose();
27917
- notify$1.confirm((onSuccess, onFailure) => {
27999
+ notify.confirm((onSuccess, onFailure) => {
27918
28000
  unSuspendSubscription(sub.id, onSuccess, onFailure);
27919
28001
  }, {
27920
28002
  confirmMessage: t("messages.subUnSuspend.isSureToUnSuspend"),
@@ -27996,7 +28078,7 @@ const SubscriptionsItems = _ref => {
27996
28078
  onClick: onCancelClick,
27997
28079
  disabled: disableSubmit,
27998
28080
  "data-key": sub.id
27999
- }, t("labels.unsubscribe")) : "", (sub === null || sub === void 0 ? void 0 : (_sub$plan = sub.plan) === null || _sub$plan === void 0 ? void 0 : _sub$plan.type) === 'membership' && /*#__PURE__*/React__default.createElement(Button, {
28081
+ }, t("labels.unsubscribe")) : "", (sub === null || sub === void 0 ? void 0 : (_sub$plan = sub.plan) === null || _sub$plan === void 0 ? void 0 : _sub$plan.type) === "membership" && /*#__PURE__*/React__default.createElement(Button, {
28000
28082
  variant: "ghost",
28001
28083
  className: "plc-text-blue-400 pelcro-dashboard-sub-manage-members-button",
28002
28084
  icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
@@ -28043,7 +28125,10 @@ const SubscriptionsItems = _ref => {
28043
28125
  };
28044
28126
  function getNonDonationSubs() {
28045
28127
  var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3;
28046
- return (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => !sub.plan.is_donation)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
28128
+ return (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => {
28129
+ var _sub$plan2;
28130
+ return ((_sub$plan2 = sub.plan) === null || _sub$plan2 === void 0 ? void 0 : _sub$plan2.type) !== "donation";
28131
+ })) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
28047
28132
  }
28048
28133
  function isDateAfterToday(date) {
28049
28134
  const today = new Date().setHours(0, 0, 0, 0);
@@ -28331,6 +28416,7 @@ function SvgQrcode(props) {
28331
28416
 
28332
28417
  const DonationsMenu = _ref => {
28333
28418
  let {
28419
+ onClose,
28334
28420
  reactivateSubscription,
28335
28421
  disableSubmit,
28336
28422
  cancelSubscription
@@ -28342,10 +28428,9 @@ const DonationsMenu = _ref => {
28342
28428
  switchView,
28343
28429
  setSubscriptionToCancel
28344
28430
  } = usePelcro();
28345
- const subscriptions = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
28431
+ const donations = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
28346
28432
  // Cancel button click handlers
28347
28433
  const onCancelClick = () => {
28348
- var _onClose;
28349
28434
  const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
28350
28435
  if (isImmediateCancelationEnabled) {
28351
28436
  setSubscriptionToCancel(sub.id);
@@ -28354,16 +28439,16 @@ const DonationsMenu = _ref => {
28354
28439
  if (userMustVerifyEmail()) {
28355
28440
  return switchView("email-verify");
28356
28441
  }
28357
- (_onClose = onClose) === null || _onClose === void 0 ? void 0 : _onClose();
28442
+ onClose === null || onClose === void 0 ? void 0 : onClose();
28358
28443
  notify.confirm((onSuccess, onFailure) => {
28359
28444
  cancelSubscription(sub.id, onSuccess, onFailure);
28360
28445
  }, {
28361
- confirmMessage: t("messages.subCancellation.isSureToCancel"),
28362
- loadingMessage: t("messages.subCancellation.loading"),
28363
- successMessage: t("messages.subCancellation.success"),
28364
- errorMessage: t("messages.subCancellation.error")
28446
+ confirmMessage: t("messages.donationCancellation.isSureToCancel"),
28447
+ loadingMessage: t("messages.donationCancellation.loading"),
28448
+ successMessage: t("messages.donationCancellation.success"),
28449
+ errorMessage: t("messages.donationCancellation.error")
28365
28450
  }, {
28366
- closeButtonLabel: t("labels.subCancellation.goBack")
28451
+ closeButtonLabel: t("labels.donationCancellation.goBack")
28367
28452
  });
28368
28453
  };
28369
28454
 
@@ -28372,7 +28457,7 @@ const DonationsMenu = _ref => {
28372
28457
  if (userMustVerifyEmail()) {
28373
28458
  return switchView("email-verify");
28374
28459
  }
28375
- reactivateSubscription(sub.id);
28460
+ reactivateSubscription(sub.id, true);
28376
28461
  };
28377
28462
  return /*#__PURE__*/React__default.createElement("tr", {
28378
28463
  key: sub.id,
@@ -28413,12 +28498,18 @@ const DonationsMenu = _ref => {
28413
28498
  className: "plc-w-3/12 "
28414
28499
  }, t("labels.actions")))), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
28415
28500
  className: "plc-h-4"
28416
- }), subscriptions));
28501
+ }), donations));
28417
28502
  };
28418
28503
  function getDonationSubs() {
28419
28504
  var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r, _window$Pelcro$user$r2;
28420
- const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
28421
- const canceledDonations = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
28505
+ const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => {
28506
+ var _sub$plan;
28507
+ return ((_sub$plan = sub.plan) === null || _sub$plan === void 0 ? void 0 : _sub$plan.type) === "donation";
28508
+ })) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
28509
+ const canceledDonations = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.filter(sub => {
28510
+ var _sub$plan2;
28511
+ return ((_sub$plan2 = sub.plan) === null || _sub$plan2 === void 0 ? void 0 : _sub$plan2.type) === "donation";
28512
+ })) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
28422
28513
  return [...donations, ...canceledDonations];
28423
28514
  }
28424
28515
  function formatStartDate(date) {
@@ -28807,7 +28898,7 @@ class Dashboard extends Component {
28807
28898
  const formattedRenewDate = new Intl.DateTimeFormat("en-CA").format(renewDate);
28808
28899
  return `${this.locale("labels.renewsOn")} ${formattedRenewDate}`;
28809
28900
  });
28810
- _defineProperty$3(this, "reactivateSubscription", subscription_id => {
28901
+ _defineProperty$3(this, "reactivateSubscription", (subscription_id, isDonation) => {
28811
28902
  // disable the Login button to prevent repeated clicks
28812
28903
  this.setState({
28813
28904
  disableSubmit: true
@@ -28821,9 +28912,17 @@ class Dashboard extends Component {
28821
28912
  });
28822
28913
  this.props.onClose();
28823
28914
  if (err) {
28824
- return notify$1.error(this.locale("messages.subReactivation.error"));
28915
+ if (isDonation) {
28916
+ return notify.error(this.locale("messages.donationReactivation.error"));
28917
+ } else {
28918
+ return notify.error(this.locale("messages.subReactivation.error"));
28919
+ }
28920
+ }
28921
+ if (isDonation) {
28922
+ return notify.success(this.locale("messages.donationReactivation.success"));
28923
+ } else {
28924
+ return notify.success(this.locale("messages.subReactivation.success"));
28825
28925
  }
28826
- return notify$1.success(this.locale("messages.subReactivation.success"));
28827
28926
  });
28828
28927
  });
28829
28928
  _defineProperty$3(this, "getSubscriptionStatus", sub => {
@@ -29185,6 +29284,7 @@ class Dashboard extends Component {
29185
29284
  }),
29186
29285
  title: this.locale("labels.donations"),
29187
29286
  content: /*#__PURE__*/React__default.createElement(DonationsMenu, {
29287
+ onClose: this.props.onClose,
29188
29288
  reactivateSubscription: this.reactivateSubscription,
29189
29289
  disableSubmit: this.state.disableSubmit,
29190
29290
  cancelSubscription: this.cancelSubscription
@@ -29226,8 +29326,14 @@ function hasInvoices() {
29226
29326
  }
29227
29327
  function hasDonationSubs() {
29228
29328
  var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
29229
- const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
29230
- const canceledDonations = (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : [];
29329
+ const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => {
29330
+ var _sub$plan;
29331
+ return ((_sub$plan = sub.plan) === null || _sub$plan === void 0 ? void 0 : _sub$plan.type) === "donation";
29332
+ })) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
29333
+ const canceledDonations = (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.filter(sub => {
29334
+ var _sub$plan2;
29335
+ return ((_sub$plan2 = sub.plan) === null || _sub$plan2 === void 0 ? void 0 : _sub$plan2.type) === "donation";
29336
+ })) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : [];
29231
29337
  return donations.length > 0 || canceledDonations.length > 0;
29232
29338
  }
29233
29339
  function hasActiveMemberships() {
@@ -31392,7 +31498,7 @@ function VerifyLinkTokenModal(_ref) {
31392
31498
  var _props$onSuccess;
31393
31499
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
31394
31500
  resetView();
31395
- notify$1.success(t("messages.success"));
31501
+ notify.success(t("messages.success"));
31396
31502
  };
31397
31503
  return /*#__PURE__*/React__default.createElement(Modal, {
31398
31504
  id: "pelcro-login-modal",
@@ -33050,4 +33156,4 @@ const QrCodeModal = _ref => {
33050
33156
  };
33051
33157
  QrCodeModal.viewId = "qrcode";
33052
33158
 
33053
- 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, DonationModalWithHook as DonationModal, 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, OrderCreateFreeButton, 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 };
33159
+ 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, DonationModalWithHook as DonationModal, 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, OrderCreateFreeButton, 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 };
package/dist/pelcro.css CHANGED
@@ -2270,6 +2270,10 @@ layer components {
2270
2270
  margin-right: auto;
2271
2271
  }
2272
2272
 
2273
+ .pelcro-root .plc-mb-0 {
2274
+ margin-bottom: 0px;
2275
+ }
2276
+
2273
2277
  .pelcro-root .plc-ml-0 {
2274
2278
  margin-left: 0px;
2275
2279
  }
@@ -2390,8 +2394,8 @@ layer components {
2390
2394
  min-height: 3rem;
2391
2395
  }
2392
2396
 
2393
- .pelcro-root .plc-min-h-20 {
2394
- min-height: 6rem;
2397
+ .pelcro-root .plc-min-h-16 {
2398
+ min-height: 4rem;
2395
2399
  }
2396
2400
 
2397
2401
  .pelcro-root .plc-min-h-40 {
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.22.0-beta.17",
4
+ "version": "3.22.0-beta.19",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",