@pelcro/react-pelcro-js 3.11.0-beta.1 → 3.11.0-beta.2

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
@@ -25751,14 +25751,14 @@ const SubscriptionsItems = ({
25751
25751
  onClick: onRenewClick,
25752
25752
  disabled: disableSubmit,
25753
25753
  "data-key": sub.id
25754
- }, t("labels.renew")), sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
25754
+ }, t("labels.renew")), sub.shipments_suspended_until && isDateBeforeToday(shipments_suspended_until) && sub.shipments_remaining > 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
25755
25755
  variant: "ghost",
25756
25756
  className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
25757
25757
  icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
25758
25758
  onClick: onUnSuspendClick,
25759
25759
  disabled: disableSubmit,
25760
25760
  "data-key": sub.id
25761
- }, t("labels.unsuspend")), !sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
25761
+ }, t("labels.unsuspend")), (!sub.shipments_suspended_until && sub.shipments_remaining > 0 || shipments_suspended_until && !isDateBeforeToday(shipments_suspended_until)) && /*#__PURE__*/React__default['default'].createElement(Button, {
25762
25762
  variant: "ghost",
25763
25763
  className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
25764
25764
  icon: /*#__PURE__*/React__default['default'].createElement(SvgCalendar, null),
@@ -25818,6 +25818,10 @@ function getNonDonationSubs() {
25818
25818
  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 : [];
25819
25819
  }
25820
25820
 
25821
+ function isDateBeforeToday(date) {
25822
+ return new Date(date).getTime() < new Date().getTime();
25823
+ }
25824
+
25821
25825
  /**
25822
25826
  * @typedef {Object} AccordionPropsType
25823
25827
  * @property {string} initialActiveMenu the initial active menu
package/dist/index.esm.js CHANGED
@@ -25721,14 +25721,14 @@ const SubscriptionsItems = ({
25721
25721
  onClick: onRenewClick,
25722
25722
  disabled: disableSubmit,
25723
25723
  "data-key": sub.id
25724
- }, t("labels.renew")), sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default.createElement(Button, {
25724
+ }, t("labels.renew")), sub.shipments_suspended_until && isDateBeforeToday(shipments_suspended_until) && sub.shipments_remaining > 0 && /*#__PURE__*/React__default.createElement(Button, {
25725
25725
  variant: "ghost",
25726
25726
  className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
25727
25727
  icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
25728
25728
  onClick: onUnSuspendClick,
25729
25729
  disabled: disableSubmit,
25730
25730
  "data-key": sub.id
25731
- }, t("labels.unsuspend")), !sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default.createElement(Button, {
25731
+ }, t("labels.unsuspend")), (!sub.shipments_suspended_until && sub.shipments_remaining > 0 || shipments_suspended_until && !isDateBeforeToday(shipments_suspended_until)) && /*#__PURE__*/React__default.createElement(Button, {
25732
25732
  variant: "ghost",
25733
25733
  className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
25734
25734
  icon: /*#__PURE__*/React__default.createElement(SvgCalendar, null),
@@ -25788,6 +25788,10 @@ function getNonDonationSubs() {
25788
25788
  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 : [];
25789
25789
  }
25790
25790
 
25791
+ function isDateBeforeToday(date) {
25792
+ return new Date(date).getTime() < new Date().getTime();
25793
+ }
25794
+
25791
25795
  /**
25792
25796
  * @typedef {Object} AccordionPropsType
25793
25797
  * @property {string} initialActiveMenu the initial active menu
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.11.0-beta.1",
4
+ "version": "3.11.0-beta.2",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",