@pelcro/react-pelcro-js 3.6.0-beta.13 → 3.6.0-beta.14

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
@@ -5047,7 +5047,7 @@ var labels$h = {
5047
5047
  reactivate: "Reactivate",
5048
5048
  renew: "Renew",
5049
5049
  suspend: "Suspend",
5050
- unsuspend: "UnSuspend",
5050
+ unsuspend: "Unsuspend",
5051
5051
  support: "Support",
5052
5052
  account: "Account",
5053
5053
  purchases: "Purchases",
@@ -7225,9 +7225,8 @@ class PelcroActions {
7225
7225
  return this.set({
7226
7226
  view: "login"
7227
7227
  });
7228
- }
7228
+ } // console.log(this.get().isAuthenticated(), );
7229
7229
 
7230
- console.log(this.get().isAuthenticated());
7231
7230
 
7232
7231
  if (["passwordless-request"].includes(view) && (this.get().isAuthenticated() || !((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.passwordless_enabled))) {
7233
7232
  return this.set({
@@ -9335,6 +9334,9 @@ toast.confirm = (onConfirm, {
9335
9334
  id,
9336
9335
  ...options
9337
9336
  });
9337
+ setTimeout(() => {
9338
+ notify.dismiss(id);
9339
+ }, 3000);
9338
9340
  };
9339
9341
 
9340
9342
  const onFailure = errorValue => {
@@ -9342,6 +9344,9 @@ toast.confirm = (onConfirm, {
9342
9344
  id,
9343
9345
  ...options
9344
9346
  });
9347
+ setTimeout(() => {
9348
+ notify.dismiss(id);
9349
+ }, 3000);
9345
9350
  };
9346
9351
  };
9347
9352
 
@@ -17529,10 +17534,9 @@ function DatePicker({
17529
17534
  }
17530
17535
 
17531
17536
  const nowDate$1 = new Date();
17532
- nowDate$1.toISOString().substr(0, 10);
17533
17537
  const dayFromNowDateISO = new Date(new Date().setDate(nowDate$1.getDate() + 1)).toISOString().substr(0, 10);
17534
17538
  const SubscriptionSuspendDate = props => {
17535
- var _state$suspendDate;
17539
+ var _props$subscription, _state$suspendDate;
17536
17540
 
17537
17541
  const {
17538
17542
  t
@@ -17561,8 +17565,10 @@ const SubscriptionSuspendDate = props => {
17561
17565
  return /*#__PURE__*/React__default['default'].createElement(DatePicker, Object.assign({
17562
17566
  label: t("labels.suspensionDate"),
17563
17567
  min: dayFromNowDateISO,
17568
+ max: new Date(props === null || props === void 0 ? void 0 : (_props$subscription = props.subscription) === null || _props$subscription === void 0 ? void 0 : _props$subscription.current_period_end).toISOString().substr(0, 10),
17564
17569
  value: (_state$suspendDate = state.suspendDate) !== null && _state$suspendDate !== void 0 ? _state$suspendDate : dayFromNowDateISO,
17565
- onChange: e => handleInputChange(e.target.value)
17570
+ onChange: e => handleInputChange(e.target.value),
17571
+ onKeyDown: e => e.preventDefault()
17566
17572
  }, props));
17567
17573
  };
17568
17574
 
@@ -17655,7 +17661,9 @@ const SubscriptionSuspendView = props => {
17655
17661
  className: "plc-w-32 plc-h-32"
17656
17662
  }), /*#__PURE__*/React__default['default'].createElement("p", {
17657
17663
  className: "plc-mb-3 plc-text-gray-900 plc-text-center plc-whitespace-pre-line"
17658
- }, t("messages.suspensionEnd"), "."), /*#__PURE__*/React__default['default'].createElement(SubscriptionSuspendDate, null), /*#__PURE__*/React__default['default'].createElement(SubscriptionSuspendButton, {
17664
+ }, t("messages.suspensionEnd"), "."), /*#__PURE__*/React__default['default'].createElement(SubscriptionSuspendDate, {
17665
+ subscription: subscriptionToSuspend
17666
+ }), /*#__PURE__*/React__default['default'].createElement(SubscriptionSuspendButton, {
17659
17667
  className: "plc-mb-2",
17660
17668
  subscription: subscriptionToSuspend
17661
17669
  }))));
@@ -24706,6 +24714,7 @@ const SubscriptionsItems = ({
24706
24714
  return switchView("email-verify");
24707
24715
  }
24708
24716
 
24717
+ onClose === null || onClose === void 0 ? void 0 : onClose();
24709
24718
  notify.confirm((onSuccess, onFailure) => {
24710
24719
  unSuspendSubscription(sub.id, onSuccess, onFailure);
24711
24720
  }, {
@@ -24769,16 +24778,16 @@ const SubscriptionsItems = ({
24769
24778
  onClick: onRenewClick,
24770
24779
  disabled: disableSubmit,
24771
24780
  "data-key": sub.id
24772
- }, t("labels.renew")), sub.shipments_suspended_until ? /*#__PURE__*/React__default['default'].createElement(Button, {
24781
+ }, t("labels.renew")), sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
24773
24782
  variant: "ghost",
24774
- className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
24783
+ className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
24775
24784
  icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
24776
24785
  onClick: onUnSuspendClick,
24777
24786
  disabled: disableSubmit,
24778
24787
  "data-key": sub.id
24779
- }, t("labels.unsuspend")) : /*#__PURE__*/React__default['default'].createElement(Button, {
24788
+ }, t("labels.unsuspend")), !sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
24780
24789
  variant: "ghost",
24781
- className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
24790
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
24782
24791
  icon: /*#__PURE__*/React__default['default'].createElement(SvgCalendar, null),
24783
24792
  onClick: onSuspendClick,
24784
24793
  disabled: disableSubmit,
package/dist/index.esm.js CHANGED
@@ -5017,7 +5017,7 @@ var labels$h = {
5017
5017
  reactivate: "Reactivate",
5018
5018
  renew: "Renew",
5019
5019
  suspend: "Suspend",
5020
- unsuspend: "UnSuspend",
5020
+ unsuspend: "Unsuspend",
5021
5021
  support: "Support",
5022
5022
  account: "Account",
5023
5023
  purchases: "Purchases",
@@ -7195,9 +7195,8 @@ class PelcroActions {
7195
7195
  return this.set({
7196
7196
  view: "login"
7197
7197
  });
7198
- }
7198
+ } // console.log(this.get().isAuthenticated(), );
7199
7199
 
7200
- console.log(this.get().isAuthenticated());
7201
7200
 
7202
7201
  if (["passwordless-request"].includes(view) && (this.get().isAuthenticated() || !((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.passwordless_enabled))) {
7203
7202
  return this.set({
@@ -9305,6 +9304,9 @@ toast.confirm = (onConfirm, {
9305
9304
  id,
9306
9305
  ...options
9307
9306
  });
9307
+ setTimeout(() => {
9308
+ notify.dismiss(id);
9309
+ }, 3000);
9308
9310
  };
9309
9311
 
9310
9312
  const onFailure = errorValue => {
@@ -9312,6 +9314,9 @@ toast.confirm = (onConfirm, {
9312
9314
  id,
9313
9315
  ...options
9314
9316
  });
9317
+ setTimeout(() => {
9318
+ notify.dismiss(id);
9319
+ }, 3000);
9315
9320
  };
9316
9321
  };
9317
9322
 
@@ -17499,10 +17504,9 @@ function DatePicker({
17499
17504
  }
17500
17505
 
17501
17506
  const nowDate$1 = new Date();
17502
- nowDate$1.toISOString().substr(0, 10);
17503
17507
  const dayFromNowDateISO = new Date(new Date().setDate(nowDate$1.getDate() + 1)).toISOString().substr(0, 10);
17504
17508
  const SubscriptionSuspendDate = props => {
17505
- var _state$suspendDate;
17509
+ var _props$subscription, _state$suspendDate;
17506
17510
 
17507
17511
  const {
17508
17512
  t
@@ -17531,8 +17535,10 @@ const SubscriptionSuspendDate = props => {
17531
17535
  return /*#__PURE__*/React__default.createElement(DatePicker, Object.assign({
17532
17536
  label: t("labels.suspensionDate"),
17533
17537
  min: dayFromNowDateISO,
17538
+ max: new Date(props === null || props === void 0 ? void 0 : (_props$subscription = props.subscription) === null || _props$subscription === void 0 ? void 0 : _props$subscription.current_period_end).toISOString().substr(0, 10),
17534
17539
  value: (_state$suspendDate = state.suspendDate) !== null && _state$suspendDate !== void 0 ? _state$suspendDate : dayFromNowDateISO,
17535
- onChange: e => handleInputChange(e.target.value)
17540
+ onChange: e => handleInputChange(e.target.value),
17541
+ onKeyDown: e => e.preventDefault()
17536
17542
  }, props));
17537
17543
  };
17538
17544
 
@@ -17625,7 +17631,9 @@ const SubscriptionSuspendView = props => {
17625
17631
  className: "plc-w-32 plc-h-32"
17626
17632
  }), /*#__PURE__*/React__default.createElement("p", {
17627
17633
  className: "plc-mb-3 plc-text-gray-900 plc-text-center plc-whitespace-pre-line"
17628
- }, t("messages.suspensionEnd"), "."), /*#__PURE__*/React__default.createElement(SubscriptionSuspendDate, null), /*#__PURE__*/React__default.createElement(SubscriptionSuspendButton, {
17634
+ }, t("messages.suspensionEnd"), "."), /*#__PURE__*/React__default.createElement(SubscriptionSuspendDate, {
17635
+ subscription: subscriptionToSuspend
17636
+ }), /*#__PURE__*/React__default.createElement(SubscriptionSuspendButton, {
17629
17637
  className: "plc-mb-2",
17630
17638
  subscription: subscriptionToSuspend
17631
17639
  }))));
@@ -24676,6 +24684,7 @@ const SubscriptionsItems = ({
24676
24684
  return switchView("email-verify");
24677
24685
  }
24678
24686
 
24687
+ onClose === null || onClose === void 0 ? void 0 : onClose();
24679
24688
  notify.confirm((onSuccess, onFailure) => {
24680
24689
  unSuspendSubscription(sub.id, onSuccess, onFailure);
24681
24690
  }, {
@@ -24739,16 +24748,16 @@ const SubscriptionsItems = ({
24739
24748
  onClick: onRenewClick,
24740
24749
  disabled: disableSubmit,
24741
24750
  "data-key": sub.id
24742
- }, t("labels.renew")), sub.shipments_suspended_until ? /*#__PURE__*/React__default.createElement(Button, {
24751
+ }, t("labels.renew")), sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default.createElement(Button, {
24743
24752
  variant: "ghost",
24744
- className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
24753
+ className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
24745
24754
  icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
24746
24755
  onClick: onUnSuspendClick,
24747
24756
  disabled: disableSubmit,
24748
24757
  "data-key": sub.id
24749
- }, t("labels.unsuspend")) : /*#__PURE__*/React__default.createElement(Button, {
24758
+ }, t("labels.unsuspend")), !sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default.createElement(Button, {
24750
24759
  variant: "ghost",
24751
- className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
24760
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
24752
24761
  icon: /*#__PURE__*/React__default.createElement(SvgCalendar, null),
24753
24762
  onClick: onSuspendClick,
24754
24763
  disabled: disableSubmit,
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.6.0-beta.13",
4
+ "version": "3.6.0-beta.14",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",