@pelcro/react-pelcro-js 4.0.0-alpha.25 → 4.0.0-alpha.27

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
@@ -3450,7 +3450,10 @@ var labels$10 = {
3450
3450
  interval: "{{count}} {{interval}}",
3451
3451
  interval_plural: "{{count}} {{interval}}s",
3452
3452
  tax: "+ Tax",
3453
- removeCoupon: "REMOVE"
3453
+ removeCoupon: "REMOVE",
3454
+ firstName: "First name",
3455
+ lastName: "Last name",
3456
+ phone: "Phone"
3454
3457
  };
3455
3458
  var checkoutForm_en = {
3456
3459
  messages: messages$14,
@@ -3950,6 +3953,10 @@ var messages$W = {
3950
3953
  success: "Subscription is successfully cancelled",
3951
3954
  error: "Error while cancelling your subscription"
3952
3955
  },
3956
+ subReactivation: {
3957
+ success: "Subscription is successfully reactivated",
3958
+ error: "Error while reactivating your subscription"
3959
+ },
3953
3960
  subUnSuspend: {
3954
3961
  isSureToUnSuspend: "Are you sure you want to unsuspend your subscription?",
3955
3962
  loading: "Unsuspending your subscription",
@@ -4384,7 +4391,10 @@ var labels$H = {
4384
4391
  interval: "{{count}} {{interval}}",
4385
4392
  interval_plural: "{{count}} {{interval}}s",
4386
4393
  tax: "+ Taxe",
4387
- removeCoupon: "RETIRER"
4394
+ removeCoupon: "RETIRER",
4395
+ firstName: "Prénom",
4396
+ lastName: "Nom de famille",
4397
+ phone: "Téléphoner"
4388
4398
  };
4389
4399
  var checkoutForm_fr = {
4390
4400
  messages: messages$M,
@@ -4885,6 +4895,10 @@ var messages$C = {
4885
4895
  success: "L'abonnement a été annulé avec succès",
4886
4896
  error: "Une erreur s'est produite lors de l'annulation de l'abonnement"
4887
4897
  },
4898
+ subReactivation: {
4899
+ success: "L'abonnement a été réactivé avec succès",
4900
+ error: "Erreur lors de la réactivation de votre abonnement"
4901
+ },
4888
4902
  subUnSuspend: {
4889
4903
  isSureToUnSuspend: "Êtes-vous sûr de vouloir annuler la suspension de votre abonnement ?",
4890
4904
  loading: "Annulation de la suspension de votre abonnement",
@@ -5265,7 +5279,10 @@ var labels$s = {
5265
5279
  interval: "{{count}} {{interval}}",
5266
5280
  interval_plural: "{{count}} {{interval}}",
5267
5281
  tax: "+ 세금",
5268
- removeCoupon: "제거"
5282
+ removeCoupon: "제거",
5283
+ firstName: "이름",
5284
+ lastName: "성",
5285
+ phone: "핸드폰"
5269
5286
  };
5270
5287
  var checkoutForm_ko = {
5271
5288
  messages: messages$v,
@@ -5826,6 +5843,10 @@ var messages$l = {
5826
5843
  success: "유료 멤버십이 성공적으로 취소되었습니다.",
5827
5844
  error: "유료 멤버십 취소 과정에서 오류가 발생했습니다."
5828
5845
  },
5846
+ subReactivation: {
5847
+ success: "구독이 성공적으로 재활성화되었습니다.",
5848
+ error: "구독을 재활성화하는 동안 오류가 발생했습니다."
5849
+ },
5829
5850
  subUnSuspend: {
5830
5851
  isSureToUnSuspend: "구독 일시 중단을 해제하시겠습니까?",
5831
5852
  loading: "구독 일시 중단 해제",
@@ -6689,6 +6710,10 @@ var messages$4 = {
6689
6710
  success: "La suscripción se canceló con éxito",
6690
6711
  error: "Error al cancelar tu suscripción"
6691
6712
  },
6713
+ subReactivation: {
6714
+ success: "La suscripción se reactivó con éxito",
6715
+ error: "Error al reactivar su suscripción"
6716
+ },
6692
6717
  subUnSuspend: {
6693
6718
  isSureToUnSuspend: "¿Estás seguro de que quieres reanudar tu suscripción?",
6694
6719
  loading: "Reanudando tu suscripción",
@@ -11266,7 +11291,7 @@ const initSecuritySdk = () => {
11266
11291
 
11267
11292
  const securityKey = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.security_key;
11268
11293
  if (!securityKey) return;
11269
- window.Pelcro.helpers.loadSDK(`https://www.google.com/recaptcha/enterprise.js?render=${securityKey}`, "pelcro-security-enteprise");
11294
+ window.Pelcro.helpers.loadSDK(`https://www.recaptcha.net/recaptcha/enterprise.js?render=${securityKey}`, "pelcro-security-enteprise");
11270
11295
  });
11271
11296
  };
11272
11297
  const initGATracking = () => {
@@ -13582,6 +13607,7 @@ function LoginModal({
13582
13607
  switchView,
13583
13608
  resetView,
13584
13609
  product,
13610
+ plan,
13585
13611
  order,
13586
13612
  switchToAddressView,
13587
13613
  switchToPaymentView
@@ -13591,13 +13617,12 @@ function LoginModal({
13591
13617
  var _props$onSuccess;
13592
13618
 
13593
13619
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
13594
- resetView();
13595
13620
 
13596
13621
  if (window.Pelcro.paywall.isArticleRestricted()) {
13597
13622
  initPaywalls();
13598
13623
  }
13599
13624
 
13600
- if (product) {
13625
+ if (product && plan) {
13601
13626
  if (product.address_required) {
13602
13627
  return switchToAddressView();
13603
13628
  } else {
@@ -13605,6 +13630,10 @@ function LoginModal({
13605
13630
  }
13606
13631
  }
13607
13632
 
13633
+ if (product && !plan) {
13634
+ return switchView("plan-select");
13635
+ }
13636
+
13608
13637
  if (order) {
13609
13638
  return switchToAddressView();
13610
13639
  }
@@ -14006,6 +14035,7 @@ function RegisterModal(props) {
14006
14035
  switchToAddressView,
14007
14036
  switchToPaymentView,
14008
14037
  product,
14038
+ plan,
14009
14039
  order,
14010
14040
  giftCode,
14011
14041
  isGift
@@ -14051,7 +14081,7 @@ function RegisterModal(props) {
14051
14081
  return switchToAddressView();
14052
14082
  }
14053
14083
 
14054
- if (product) {
14084
+ if (product && plan) {
14055
14085
  if (product.address_required) {
14056
14086
  return switchToAddressView();
14057
14087
  } else {
@@ -14059,6 +14089,10 @@ function RegisterModal(props) {
14059
14089
  }
14060
14090
  }
14061
14091
 
14092
+ if (product && !plan) {
14093
+ return switchView("plan-select");
14094
+ }
14095
+
14062
14096
  return resetView();
14063
14097
  };
14064
14098
 
@@ -24817,8 +24851,15 @@ const PaymentSuccessView = ({
24817
24851
 
24818
24852
  if (successTitle && successContent) {
24819
24853
  return /*#__PURE__*/React__default['default'].createElement("div", {
24820
- className: "plc-flex plc-flex-col plc-items-center"
24821
- }, successIcon, /*#__PURE__*/React__default['default'].createElement("div", {
24854
+ className: "plc-flex plc-flex-col plc-items-center plc-relative"
24855
+ }, /*#__PURE__*/React__default['default'].createElement("button", {
24856
+ type: "button",
24857
+ className: "pelcro-modal-close plc-absolute plc-top-6 plc-right-0",
24858
+ "aria-label": "close modal",
24859
+ onClick: onClose
24860
+ }, /*#__PURE__*/React__default['default'].createElement(SvgXIcon, {
24861
+ className: "plc-fill-current"
24862
+ })), successIcon, /*#__PURE__*/React__default['default'].createElement("div", {
24822
24863
  className: "plc-text-center plc-text-gray-900"
24823
24864
  }, /*#__PURE__*/React__default['default'].createElement("h4", {
24824
24865
  className: "plc-mb-4 plc-text-3xl"
@@ -33441,7 +33482,9 @@ const AddressesMenu = props => {
33441
33482
  const AddressesItems = props => {
33442
33483
  var _window$Pelcro$user$r;
33443
33484
 
33444
- useTranslation("dashboard");
33485
+ const {
33486
+ t
33487
+ } = useTranslation("dashboard");
33445
33488
  const {
33446
33489
  switchView
33447
33490
  } = usePelcro();
@@ -33472,7 +33515,9 @@ const AddressesItems = props => {
33472
33515
  return addresses.map((address, index) => address.type === "shipping" && /*#__PURE__*/React__default['default'].createElement("div", {
33473
33516
  key: address.id,
33474
33517
  className: `plc-py-2 plc-px-4 plc-mt-5 plc-flex plc-items-center plc-justify-between last:plc-mb-0 plc-rounded plc-text-gray-900 pelcro-address-wrapper plc-bg-white plc-shadow-md_dark ${selectedAddressId === String(address.id) && `plc-border-primary-400 plc-border-2`}`
33475
- }, /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("p", {
33518
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
33519
+ className: "plc-flex-1 plc-relative"
33520
+ }, /*#__PURE__*/React__default['default'].createElement("p", {
33476
33521
  className: "pelcro-address-name plc-font-semibold"
33477
33522
  }, address.first_name, " ", address.last_name), /*#__PURE__*/React__default['default'].createElement("p", {
33478
33523
  className: "pelcro-address-company"
@@ -33480,7 +33525,9 @@ const AddressesItems = props => {
33480
33525
  className: "pelcro-address-line1 plc-text-sm plc-mt-2"
33481
33526
  }, address.line1), /*#__PURE__*/React__default['default'].createElement("p", {
33482
33527
  className: "pelcro-address-country plc-text-sm"
33483
- }, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name)), /*#__PURE__*/React__default['default'].createElement(Button, {
33528
+ }, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name), address.is_default && /*#__PURE__*/React__default['default'].createElement("span", {
33529
+ className: "plc-rounded-full plc-bg-gray-800 plc-text-white plc-inline-flex plc-items-start plc-py-1 plc-px-4 plc-text-sm plc-mt-4"
33530
+ }, t("labels.default"))), /*#__PURE__*/React__default['default'].createElement(Button, {
33484
33531
  variant: "icon",
33485
33532
  className: "plc-text-gray-500",
33486
33533
  icon: /*#__PURE__*/React__default['default'].createElement(SvgEdit, null),
@@ -35403,6 +35450,12 @@ class Dashboard extends React.Component {
35403
35450
  disableSubmit: false
35404
35451
  });
35405
35452
  this.props.onClose();
35453
+
35454
+ if (err) {
35455
+ return notify.error(this.locale("messages.subReactivation.error"));
35456
+ }
35457
+
35458
+ return notify.success(this.locale("messages.subReactivation.success"));
35406
35459
  });
35407
35460
  });
35408
35461
 
@@ -35560,7 +35613,7 @@ class Dashboard extends React.Component {
35560
35613
  }, /*#__PURE__*/React__default['default'].createElement("div", {
35561
35614
  className: "plc-flex plc-items-center"
35562
35615
  }, /*#__PURE__*/React__default['default'].createElement("div", {
35563
- className: "plc-flex plc-justify-center plc-ml-3 sm:plc-ml-6 "
35616
+ className: "plc-flex plc-justify-center plc-ml-3 sm:plc-ml-6 plc-flex-shrink-0"
35564
35617
  }, /*#__PURE__*/React__default['default'].createElement("div", {
35565
35618
  className: "plc-relative plc-flex-shrink-0"
35566
35619
  }, /*#__PURE__*/React__default['default'].createElement("img", {
@@ -35571,9 +35624,9 @@ class Dashboard extends React.Component {
35571
35624
  }))), /*#__PURE__*/React__default['default'].createElement("div", {
35572
35625
  className: "plc-flex plc-flex-col plc-justify-between plc-flex-grow plc-w-56 plc-ml-4 plc-break-words sm:plc-w-auto"
35573
35626
  }, userHasName && /*#__PURE__*/React__default['default'].createElement("p", {
35574
- className: "plc-font-bold"
35627
+ className: "plc-font-bold plc-break-all"
35575
35628
  }, this.user.first_name, " ", this.user.last_name), /*#__PURE__*/React__default['default'].createElement("p", {
35576
- className: `plc-m-0 plc-text-sm ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
35629
+ className: `plc-m-0 plc-text-sm plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
35577
35630
  }, this.user.email)), /*#__PURE__*/React__default['default'].createElement("div", {
35578
35631
  className: "lg:plc-hidden"
35579
35632
  }, /*#__PURE__*/React__default['default'].createElement(Button, {
@@ -35657,6 +35710,7 @@ class Dashboard extends React.Component {
35657
35710
  setActiveDashboardLink: this.setActiveDashboardLink,
35658
35711
  activeDashboardLink: this.state.activeDashboardLink
35659
35712
  }), /*#__PURE__*/React__default['default'].createElement(DashboardLink, {
35713
+ show: hasActiveMemberships(),
35660
35714
  name: SUB_MENUS.MEMBERSHIPS,
35661
35715
  icon: /*#__PURE__*/React__default['default'].createElement(SvgMemberships, {
35662
35716
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
@@ -35665,6 +35719,7 @@ class Dashboard extends React.Component {
35665
35719
  setActiveDashboardLink: this.setActiveDashboardLink,
35666
35720
  activeDashboardLink: this.state.activeDashboardLink
35667
35721
  }), /*#__PURE__*/React__default['default'].createElement(DashboardLink, {
35722
+ show: hasDonationSubs(),
35668
35723
  name: SUB_MENUS.DONATIONS,
35669
35724
  icon: /*#__PURE__*/React__default['default'].createElement(SvgDonate, {
35670
35725
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
@@ -35679,6 +35734,7 @@ class Dashboard extends React.Component {
35679
35734
  setActiveDashboardLink: this.setActiveDashboardLink,
35680
35735
  activeDashboardLink: this.state.activeDashboardLink
35681
35736
  }), /*#__PURE__*/React__default['default'].createElement(DashboardLink, {
35737
+ show: window.Pelcro.site.read().ecommerce_enabled,
35682
35738
  name: SUB_MENUS.ORDERS,
35683
35739
  icon: /*#__PURE__*/React__default['default'].createElement(SvgShopping, null),
35684
35740
  title: this.locale("labels.orders.label"),
@@ -35755,6 +35811,20 @@ function showNewsletters() {
35755
35811
  return showNewslettersUiSettings;
35756
35812
  }
35757
35813
 
35814
+ function hasDonationSubs() {
35815
+ var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
35816
+
35817
+ 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 : [];
35818
+ 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 : [];
35819
+ return donations.length > 0 || canceledDonations.length > 0;
35820
+ }
35821
+
35822
+ function hasActiveMemberships() {
35823
+ var _window$Pelcro$user$r6, _window$Pelcro$user$r7;
35824
+
35825
+ return (_window$Pelcro$user$r6 = (_window$Pelcro$user$r7 = window.Pelcro.user.read().memberships) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.some(membership => membership.status === "active" && membership.subscription.ended_at === null)) !== null && _window$Pelcro$user$r6 !== void 0 ? _window$Pelcro$user$r6 : false;
35826
+ }
35827
+
35758
35828
  const DashboardWithTrans = withTranslation("dashboard")(Dashboard);
35759
35829
 
35760
35830
  // The button in the lower left that shows the dashboard.
@@ -37752,19 +37822,24 @@ const EmailVerifyModal = ({
37752
37822
  switchToAddressView,
37753
37823
  switchToPaymentView
37754
37824
  } = usePelcro();
37825
+ console.log("verify email");
37755
37826
 
37756
37827
  const onSuccess = res => {
37757
37828
  var _otherProps$onSuccess;
37758
37829
 
37759
- otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
37830
+ (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
37760
37831
 
37761
- if (product) {
37832
+ if (product && plan) {
37762
37833
  if (product.address_required) {
37763
37834
  return switchToAddressView();
37764
37835
  } else {
37765
37836
  return switchToPaymentView();
37766
37837
  }
37767
37838
  }
37839
+
37840
+ if (product && !plan) {
37841
+ return switchView("plan-select");
37842
+ }
37768
37843
  };
37769
37844
 
37770
37845
  const {
package/dist/index.esm.js CHANGED
@@ -3420,7 +3420,10 @@ var labels$10 = {
3420
3420
  interval: "{{count}} {{interval}}",
3421
3421
  interval_plural: "{{count}} {{interval}}s",
3422
3422
  tax: "+ Tax",
3423
- removeCoupon: "REMOVE"
3423
+ removeCoupon: "REMOVE",
3424
+ firstName: "First name",
3425
+ lastName: "Last name",
3426
+ phone: "Phone"
3424
3427
  };
3425
3428
  var checkoutForm_en = {
3426
3429
  messages: messages$14,
@@ -3920,6 +3923,10 @@ var messages$W = {
3920
3923
  success: "Subscription is successfully cancelled",
3921
3924
  error: "Error while cancelling your subscription"
3922
3925
  },
3926
+ subReactivation: {
3927
+ success: "Subscription is successfully reactivated",
3928
+ error: "Error while reactivating your subscription"
3929
+ },
3923
3930
  subUnSuspend: {
3924
3931
  isSureToUnSuspend: "Are you sure you want to unsuspend your subscription?",
3925
3932
  loading: "Unsuspending your subscription",
@@ -4354,7 +4361,10 @@ var labels$H = {
4354
4361
  interval: "{{count}} {{interval}}",
4355
4362
  interval_plural: "{{count}} {{interval}}s",
4356
4363
  tax: "+ Taxe",
4357
- removeCoupon: "RETIRER"
4364
+ removeCoupon: "RETIRER",
4365
+ firstName: "Prénom",
4366
+ lastName: "Nom de famille",
4367
+ phone: "Téléphoner"
4358
4368
  };
4359
4369
  var checkoutForm_fr = {
4360
4370
  messages: messages$M,
@@ -4855,6 +4865,10 @@ var messages$C = {
4855
4865
  success: "L'abonnement a été annulé avec succès",
4856
4866
  error: "Une erreur s'est produite lors de l'annulation de l'abonnement"
4857
4867
  },
4868
+ subReactivation: {
4869
+ success: "L'abonnement a été réactivé avec succès",
4870
+ error: "Erreur lors de la réactivation de votre abonnement"
4871
+ },
4858
4872
  subUnSuspend: {
4859
4873
  isSureToUnSuspend: "Êtes-vous sûr de vouloir annuler la suspension de votre abonnement ?",
4860
4874
  loading: "Annulation de la suspension de votre abonnement",
@@ -5235,7 +5249,10 @@ var labels$s = {
5235
5249
  interval: "{{count}} {{interval}}",
5236
5250
  interval_plural: "{{count}} {{interval}}",
5237
5251
  tax: "+ 세금",
5238
- removeCoupon: "제거"
5252
+ removeCoupon: "제거",
5253
+ firstName: "이름",
5254
+ lastName: "성",
5255
+ phone: "핸드폰"
5239
5256
  };
5240
5257
  var checkoutForm_ko = {
5241
5258
  messages: messages$v,
@@ -5796,6 +5813,10 @@ var messages$l = {
5796
5813
  success: "유료 멤버십이 성공적으로 취소되었습니다.",
5797
5814
  error: "유료 멤버십 취소 과정에서 오류가 발생했습니다."
5798
5815
  },
5816
+ subReactivation: {
5817
+ success: "구독이 성공적으로 재활성화되었습니다.",
5818
+ error: "구독을 재활성화하는 동안 오류가 발생했습니다."
5819
+ },
5799
5820
  subUnSuspend: {
5800
5821
  isSureToUnSuspend: "구독 일시 중단을 해제하시겠습니까?",
5801
5822
  loading: "구독 일시 중단 해제",
@@ -6659,6 +6680,10 @@ var messages$4 = {
6659
6680
  success: "La suscripción se canceló con éxito",
6660
6681
  error: "Error al cancelar tu suscripción"
6661
6682
  },
6683
+ subReactivation: {
6684
+ success: "La suscripción se reactivó con éxito",
6685
+ error: "Error al reactivar su suscripción"
6686
+ },
6662
6687
  subUnSuspend: {
6663
6688
  isSureToUnSuspend: "¿Estás seguro de que quieres reanudar tu suscripción?",
6664
6689
  loading: "Reanudando tu suscripción",
@@ -11236,7 +11261,7 @@ const initSecuritySdk = () => {
11236
11261
 
11237
11262
  const securityKey = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.security_key;
11238
11263
  if (!securityKey) return;
11239
- window.Pelcro.helpers.loadSDK(`https://www.google.com/recaptcha/enterprise.js?render=${securityKey}`, "pelcro-security-enteprise");
11264
+ window.Pelcro.helpers.loadSDK(`https://www.recaptcha.net/recaptcha/enterprise.js?render=${securityKey}`, "pelcro-security-enteprise");
11240
11265
  });
11241
11266
  };
11242
11267
  const initGATracking = () => {
@@ -13552,6 +13577,7 @@ function LoginModal({
13552
13577
  switchView,
13553
13578
  resetView,
13554
13579
  product,
13580
+ plan,
13555
13581
  order,
13556
13582
  switchToAddressView,
13557
13583
  switchToPaymentView
@@ -13561,13 +13587,12 @@ function LoginModal({
13561
13587
  var _props$onSuccess;
13562
13588
 
13563
13589
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
13564
- resetView();
13565
13590
 
13566
13591
  if (window.Pelcro.paywall.isArticleRestricted()) {
13567
13592
  initPaywalls();
13568
13593
  }
13569
13594
 
13570
- if (product) {
13595
+ if (product && plan) {
13571
13596
  if (product.address_required) {
13572
13597
  return switchToAddressView();
13573
13598
  } else {
@@ -13575,6 +13600,10 @@ function LoginModal({
13575
13600
  }
13576
13601
  }
13577
13602
 
13603
+ if (product && !plan) {
13604
+ return switchView("plan-select");
13605
+ }
13606
+
13578
13607
  if (order) {
13579
13608
  return switchToAddressView();
13580
13609
  }
@@ -13976,6 +14005,7 @@ function RegisterModal(props) {
13976
14005
  switchToAddressView,
13977
14006
  switchToPaymentView,
13978
14007
  product,
14008
+ plan,
13979
14009
  order,
13980
14010
  giftCode,
13981
14011
  isGift
@@ -14021,7 +14051,7 @@ function RegisterModal(props) {
14021
14051
  return switchToAddressView();
14022
14052
  }
14023
14053
 
14024
- if (product) {
14054
+ if (product && plan) {
14025
14055
  if (product.address_required) {
14026
14056
  return switchToAddressView();
14027
14057
  } else {
@@ -14029,6 +14059,10 @@ function RegisterModal(props) {
14029
14059
  }
14030
14060
  }
14031
14061
 
14062
+ if (product && !plan) {
14063
+ return switchView("plan-select");
14064
+ }
14065
+
14032
14066
  return resetView();
14033
14067
  };
14034
14068
 
@@ -24787,8 +24821,15 @@ const PaymentSuccessView = ({
24787
24821
 
24788
24822
  if (successTitle && successContent) {
24789
24823
  return /*#__PURE__*/React__default.createElement("div", {
24790
- className: "plc-flex plc-flex-col plc-items-center"
24791
- }, successIcon, /*#__PURE__*/React__default.createElement("div", {
24824
+ className: "plc-flex plc-flex-col plc-items-center plc-relative"
24825
+ }, /*#__PURE__*/React__default.createElement("button", {
24826
+ type: "button",
24827
+ className: "pelcro-modal-close plc-absolute plc-top-6 plc-right-0",
24828
+ "aria-label": "close modal",
24829
+ onClick: onClose
24830
+ }, /*#__PURE__*/React__default.createElement(SvgXIcon, {
24831
+ className: "plc-fill-current"
24832
+ })), successIcon, /*#__PURE__*/React__default.createElement("div", {
24792
24833
  className: "plc-text-center plc-text-gray-900"
24793
24834
  }, /*#__PURE__*/React__default.createElement("h4", {
24794
24835
  className: "plc-mb-4 plc-text-3xl"
@@ -33411,7 +33452,9 @@ const AddressesMenu = props => {
33411
33452
  const AddressesItems = props => {
33412
33453
  var _window$Pelcro$user$r;
33413
33454
 
33414
- useTranslation("dashboard");
33455
+ const {
33456
+ t
33457
+ } = useTranslation("dashboard");
33415
33458
  const {
33416
33459
  switchView
33417
33460
  } = usePelcro();
@@ -33442,7 +33485,9 @@ const AddressesItems = props => {
33442
33485
  return addresses.map((address, index) => address.type === "shipping" && /*#__PURE__*/React__default.createElement("div", {
33443
33486
  key: address.id,
33444
33487
  className: `plc-py-2 plc-px-4 plc-mt-5 plc-flex plc-items-center plc-justify-between last:plc-mb-0 plc-rounded plc-text-gray-900 pelcro-address-wrapper plc-bg-white plc-shadow-md_dark ${selectedAddressId === String(address.id) && `plc-border-primary-400 plc-border-2`}`
33445
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", {
33488
+ }, /*#__PURE__*/React__default.createElement("div", {
33489
+ className: "plc-flex-1 plc-relative"
33490
+ }, /*#__PURE__*/React__default.createElement("p", {
33446
33491
  className: "pelcro-address-name plc-font-semibold"
33447
33492
  }, address.first_name, " ", address.last_name), /*#__PURE__*/React__default.createElement("p", {
33448
33493
  className: "pelcro-address-company"
@@ -33450,7 +33495,9 @@ const AddressesItems = props => {
33450
33495
  className: "pelcro-address-line1 plc-text-sm plc-mt-2"
33451
33496
  }, address.line1), /*#__PURE__*/React__default.createElement("p", {
33452
33497
  className: "pelcro-address-country plc-text-sm"
33453
- }, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name)), /*#__PURE__*/React__default.createElement(Button, {
33498
+ }, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name), address.is_default && /*#__PURE__*/React__default.createElement("span", {
33499
+ className: "plc-rounded-full plc-bg-gray-800 plc-text-white plc-inline-flex plc-items-start plc-py-1 plc-px-4 plc-text-sm plc-mt-4"
33500
+ }, t("labels.default"))), /*#__PURE__*/React__default.createElement(Button, {
33454
33501
  variant: "icon",
33455
33502
  className: "plc-text-gray-500",
33456
33503
  icon: /*#__PURE__*/React__default.createElement(SvgEdit, null),
@@ -35373,6 +35420,12 @@ class Dashboard extends Component {
35373
35420
  disableSubmit: false
35374
35421
  });
35375
35422
  this.props.onClose();
35423
+
35424
+ if (err) {
35425
+ return notify.error(this.locale("messages.subReactivation.error"));
35426
+ }
35427
+
35428
+ return notify.success(this.locale("messages.subReactivation.success"));
35376
35429
  });
35377
35430
  });
35378
35431
 
@@ -35530,7 +35583,7 @@ class Dashboard extends Component {
35530
35583
  }, /*#__PURE__*/React__default.createElement("div", {
35531
35584
  className: "plc-flex plc-items-center"
35532
35585
  }, /*#__PURE__*/React__default.createElement("div", {
35533
- className: "plc-flex plc-justify-center plc-ml-3 sm:plc-ml-6 "
35586
+ className: "plc-flex plc-justify-center plc-ml-3 sm:plc-ml-6 plc-flex-shrink-0"
35534
35587
  }, /*#__PURE__*/React__default.createElement("div", {
35535
35588
  className: "plc-relative plc-flex-shrink-0"
35536
35589
  }, /*#__PURE__*/React__default.createElement("img", {
@@ -35541,9 +35594,9 @@ class Dashboard extends Component {
35541
35594
  }))), /*#__PURE__*/React__default.createElement("div", {
35542
35595
  className: "plc-flex plc-flex-col plc-justify-between plc-flex-grow plc-w-56 plc-ml-4 plc-break-words sm:plc-w-auto"
35543
35596
  }, userHasName && /*#__PURE__*/React__default.createElement("p", {
35544
- className: "plc-font-bold"
35597
+ className: "plc-font-bold plc-break-all"
35545
35598
  }, this.user.first_name, " ", this.user.last_name), /*#__PURE__*/React__default.createElement("p", {
35546
- className: `plc-m-0 plc-text-sm ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
35599
+ className: `plc-m-0 plc-text-sm plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
35547
35600
  }, this.user.email)), /*#__PURE__*/React__default.createElement("div", {
35548
35601
  className: "lg:plc-hidden"
35549
35602
  }, /*#__PURE__*/React__default.createElement(Button, {
@@ -35627,6 +35680,7 @@ class Dashboard extends Component {
35627
35680
  setActiveDashboardLink: this.setActiveDashboardLink,
35628
35681
  activeDashboardLink: this.state.activeDashboardLink
35629
35682
  }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35683
+ show: hasActiveMemberships(),
35630
35684
  name: SUB_MENUS.MEMBERSHIPS,
35631
35685
  icon: /*#__PURE__*/React__default.createElement(SvgMemberships, {
35632
35686
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
@@ -35635,6 +35689,7 @@ class Dashboard extends Component {
35635
35689
  setActiveDashboardLink: this.setActiveDashboardLink,
35636
35690
  activeDashboardLink: this.state.activeDashboardLink
35637
35691
  }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35692
+ show: hasDonationSubs(),
35638
35693
  name: SUB_MENUS.DONATIONS,
35639
35694
  icon: /*#__PURE__*/React__default.createElement(SvgDonate, {
35640
35695
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
@@ -35649,6 +35704,7 @@ class Dashboard extends Component {
35649
35704
  setActiveDashboardLink: this.setActiveDashboardLink,
35650
35705
  activeDashboardLink: this.state.activeDashboardLink
35651
35706
  }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35707
+ show: window.Pelcro.site.read().ecommerce_enabled,
35652
35708
  name: SUB_MENUS.ORDERS,
35653
35709
  icon: /*#__PURE__*/React__default.createElement(SvgShopping, null),
35654
35710
  title: this.locale("labels.orders.label"),
@@ -35725,6 +35781,20 @@ function showNewsletters() {
35725
35781
  return showNewslettersUiSettings;
35726
35782
  }
35727
35783
 
35784
+ function hasDonationSubs() {
35785
+ var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
35786
+
35787
+ 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 : [];
35788
+ 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 : [];
35789
+ return donations.length > 0 || canceledDonations.length > 0;
35790
+ }
35791
+
35792
+ function hasActiveMemberships() {
35793
+ var _window$Pelcro$user$r6, _window$Pelcro$user$r7;
35794
+
35795
+ return (_window$Pelcro$user$r6 = (_window$Pelcro$user$r7 = window.Pelcro.user.read().memberships) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.some(membership => membership.status === "active" && membership.subscription.ended_at === null)) !== null && _window$Pelcro$user$r6 !== void 0 ? _window$Pelcro$user$r6 : false;
35796
+ }
35797
+
35728
35798
  const DashboardWithTrans = withTranslation("dashboard")(Dashboard);
35729
35799
 
35730
35800
  // The button in the lower left that shows the dashboard.
@@ -37722,19 +37792,24 @@ const EmailVerifyModal = ({
37722
37792
  switchToAddressView,
37723
37793
  switchToPaymentView
37724
37794
  } = usePelcro();
37795
+ console.log("verify email");
37725
37796
 
37726
37797
  const onSuccess = res => {
37727
37798
  var _otherProps$onSuccess;
37728
37799
 
37729
- otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
37800
+ (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
37730
37801
 
37731
- if (product) {
37802
+ if (product && plan) {
37732
37803
  if (product.address_required) {
37733
37804
  return switchToAddressView();
37734
37805
  } else {
37735
37806
  return switchToPaymentView();
37736
37807
  }
37737
37808
  }
37809
+
37810
+ if (product && !plan) {
37811
+ return switchView("plan-select");
37812
+ }
37738
37813
  };
37739
37814
 
37740
37815
  const {
package/dist/pelcro.css CHANGED
@@ -1833,6 +1833,7 @@ Add the correct display in Chrome and Safari.
1833
1833
  display: flex !important;
1834
1834
  align-items: center;
1835
1835
  justify-content: center;
1836
+ flex-wrap: wrap;
1836
1837
  }
1837
1838
 
1838
1839
  .pelcro-root .slick-dots li {
@@ -1975,6 +1976,10 @@ in order to scope selectors under pelcro-root
1975
1976
  top: 1.25rem;
1976
1977
  }
1977
1978
 
1979
+ .pelcro-root .plc-top-6 {
1980
+ top: 1.5rem;
1981
+ }
1982
+
1978
1983
  .pelcro-root .plc-top-7 {
1979
1984
  top: 1.75rem;
1980
1985
  }
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": "4.0.0-alpha.25",
4
+ "version": "4.0.0-alpha.27",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",
@@ -120,6 +120,9 @@
120
120
  "react": "^16.6.1",
121
121
  "react-dom": "^16.6.1"
122
122
  },
123
+ "optionalDependencies": {
124
+ "fsevents": "2.1.2"
125
+ },
123
126
  "babel": {
124
127
  "presets": [
125
128
  "@babel/preset-env",