@pelcro/react-pelcro-js 4.0.0-alpha.33 → 4.0.0-alpha.35

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.esm.js CHANGED
@@ -8242,7 +8242,7 @@ class PelcroActions {
8242
8242
  view,
8243
8243
  cartItems,
8244
8244
  ...otherStateFields
8245
- } = initialState$n;
8245
+ } = initialState$o;
8246
8246
  this.set(otherStateFields);
8247
8247
  });
8248
8248
 
@@ -8648,7 +8648,7 @@ class PelcroCallbacks {
8648
8648
 
8649
8649
  }
8650
8650
 
8651
- const initialState$n = {
8651
+ const initialState$o = {
8652
8652
  // View
8653
8653
  view: null,
8654
8654
  // Plans
@@ -8683,7 +8683,7 @@ const createPelcroStore = () => createStore(middleware_3((set, get) => {
8683
8683
  return {
8684
8684
  // Store setter
8685
8685
  set,
8686
- ...initialState$n,
8686
+ ...initialState$o,
8687
8687
  // State actions
8688
8688
  ...actions,
8689
8689
  // Callbacks
@@ -12104,9 +12104,18 @@ const HANDLE_INVITE_MEMBERS = "HANDLE_INVITE_MEMBERS";
12104
12104
  const HANDLE_REMOVE_MEMBER = "HANDLE_REMOVE_MEMBER";
12105
12105
  const UPDATE_INVITE_BUTTON = "UPDATE_INVITE_BUTTON";
12106
12106
  const UPDATE_MEMBERS = "UPDATE_MEMBERS";
12107
- const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
12107
+ const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID"; //Dashboard
12108
12108
 
12109
- const initialState$m = {
12109
+ const SET_IS_OPEN = "SET_IS_OPEN";
12110
+ const SET_ADDRESSES = "SET_ADDRESSES";
12111
+ const CLOSE_DASHBOARD = "CLOSE_DASHBOARD";
12112
+ const SET_ACTIVE_DASHBOARD_LINK = "SET_ACTIVE_DASHBOARD_LINK";
12113
+ const SET_DISABLESUBMIT = "SET_DISABLESUBMIT";
12114
+ const CANCEL_SUBSCRIPTION = "CANCEL_SUBSCRIPTION";
12115
+ const UNSUSPEND_SUBSCRIPTION = "UNSUSPEND_SUBSCRIPTION";
12116
+ const REACTIVATE_SUBSCRIPTION = "REACTIVATE_SUBSCRIPTION"; //========
12117
+
12118
+ const initialState$n = {
12110
12119
  email: "",
12111
12120
  username: "",
12112
12121
  password: "",
@@ -12119,10 +12128,10 @@ const initialState$m = {
12119
12128
  content: ""
12120
12129
  }
12121
12130
  };
12122
- const store$m = /*#__PURE__*/createContext(initialState$m);
12131
+ const store$n = /*#__PURE__*/createContext(initialState$n);
12123
12132
  const {
12124
- Provider: Provider$m
12125
- } = store$m;
12133
+ Provider: Provider$n
12134
+ } = store$n;
12126
12135
 
12127
12136
  const LoginContainer = ({
12128
12137
  style,
@@ -12246,7 +12255,7 @@ const LoginContainer = ({
12246
12255
  });
12247
12256
 
12248
12257
  case RESET_LOGIN_FORM:
12249
- return initialState$m;
12258
+ return initialState$n;
12250
12259
 
12251
12260
  case DISABLE_LOGIN_BUTTON:
12252
12261
  return lib_7({ ...state,
@@ -12264,12 +12273,12 @@ const LoginContainer = ({
12264
12273
  default:
12265
12274
  return state;
12266
12275
  }
12267
- }, initialState$m);
12276
+ }, initialState$n);
12268
12277
  return /*#__PURE__*/React__default.createElement("div", {
12269
12278
  style: { ...style
12270
12279
  },
12271
12280
  className: `pelcro-container pelcro-login-container ${className}`
12272
- }, /*#__PURE__*/React__default.createElement(Provider$m, {
12281
+ }, /*#__PURE__*/React__default.createElement(Provider$n, {
12273
12282
  value: {
12274
12283
  state,
12275
12284
  dispatch
@@ -12277,12 +12286,12 @@ const LoginContainer = ({
12277
12286
  }, children.length ? children.map((child, i) => {
12278
12287
  if (child) {
12279
12288
  return /*#__PURE__*/React__default.cloneElement(child, {
12280
- store: store$m,
12289
+ store: store$n,
12281
12290
  key: i
12282
12291
  });
12283
12292
  }
12284
12293
  }) : /*#__PURE__*/React__default.cloneElement(children, {
12285
- store: store$m
12294
+ store: store$n
12286
12295
  })));
12287
12296
  };
12288
12297
 
@@ -12590,7 +12599,7 @@ const LoginButton = ({
12590
12599
  buttonDisabled
12591
12600
  },
12592
12601
  dispatch
12593
- } = useContext(store$m);
12602
+ } = useContext(store$n);
12594
12603
  const {
12595
12604
  t
12596
12605
  } = useTranslation("login");
@@ -12649,15 +12658,15 @@ const LoginRequestLoginToken = ({
12649
12658
  };
12650
12659
 
12651
12660
  const LoginEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
12652
- store: store$m
12661
+ store: store$n
12653
12662
  }, props));
12654
12663
 
12655
12664
  const LoginUsername = props => /*#__PURE__*/React__default.createElement(UserNameInput, Object.assign({
12656
- store: store$m
12665
+ store: store$n
12657
12666
  }, props));
12658
12667
 
12659
12668
  const LoginPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
12660
- store: store$m
12669
+ store: store$n
12661
12670
  }, props));
12662
12671
 
12663
12672
  var _path$t;
@@ -12734,7 +12743,7 @@ var facebookLoginRenderProps = createCommonjsModule(function (module, exports) {
12734
12743
  var FacebookLogin = unwrapExports(facebookLoginRenderProps);
12735
12744
  facebookLoginRenderProps.FacebookLogin;
12736
12745
 
12737
- const initialState$l = {
12746
+ const initialState$m = {
12738
12747
  email: "",
12739
12748
  password: "",
12740
12749
  emailError: null,
@@ -12751,10 +12760,10 @@ const initialState$l = {
12751
12760
  content: ""
12752
12761
  }
12753
12762
  };
12754
- const store$l = /*#__PURE__*/createContext(initialState$l);
12763
+ const store$m = /*#__PURE__*/createContext(initialState$m);
12755
12764
  const {
12756
- Provider: Provider$l
12757
- } = store$l;
12765
+ Provider: Provider$m
12766
+ } = store$m;
12758
12767
 
12759
12768
  const RegisterContainer = ({
12760
12769
  style,
@@ -12945,7 +12954,7 @@ const RegisterContainer = ({
12945
12954
  });
12946
12955
 
12947
12956
  case RESET_LOGIN_FORM:
12948
- return initialState$l;
12957
+ return initialState$m;
12949
12958
 
12950
12959
  case DISABLE_REGISTRATION_BUTTON:
12951
12960
  return lib_7({ ...state,
@@ -12963,12 +12972,12 @@ const RegisterContainer = ({
12963
12972
  default:
12964
12973
  return state;
12965
12974
  }
12966
- }, initialState$l);
12975
+ }, initialState$m);
12967
12976
  return /*#__PURE__*/React__default.createElement("div", {
12968
12977
  style: { ...style
12969
12978
  },
12970
12979
  className: `pelcro-container pelcro-register-container ${className}`
12971
- }, /*#__PURE__*/React__default.createElement(Provider$l, {
12980
+ }, /*#__PURE__*/React__default.createElement(Provider$m, {
12972
12981
  value: {
12973
12982
  state,
12974
12983
  dispatch
@@ -12976,12 +12985,12 @@ const RegisterContainer = ({
12976
12985
  }, children.length ? children.map((child, i) => {
12977
12986
  if (child) {
12978
12987
  return /*#__PURE__*/React__default.cloneElement(child, {
12979
- store: store$l,
12988
+ store: store$m,
12980
12989
  key: i
12981
12990
  });
12982
12991
  }
12983
12992
  }) : /*#__PURE__*/React__default.cloneElement(children, {
12984
- store: store$l
12993
+ store: store$m
12985
12994
  })));
12986
12995
  };
12987
12996
  /**
@@ -13021,10 +13030,10 @@ const FacebookLoginButton = ({
13021
13030
  const facebookLoginEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id;
13022
13031
  const {
13023
13032
  dispatch: loginDispatch
13024
- } = useContext(store$m);
13033
+ } = useContext(store$n);
13025
13034
  const {
13026
13035
  dispatch: registerDispatch
13027
- } = useContext(store$l);
13036
+ } = useContext(store$m);
13028
13037
 
13029
13038
  const onSuccess = facebookUser => {
13030
13039
  loginDispatch === null || loginDispatch === void 0 ? void 0 : loginDispatch({
@@ -13190,10 +13199,10 @@ const GoogleLoginButton = ({
13190
13199
  const googleClientId = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.google_app_id;
13191
13200
  const {
13192
13201
  dispatch: loginDispatch
13193
- } = useContext(store$m);
13202
+ } = useContext(store$n);
13194
13203
  const {
13195
13204
  dispatch: registerDispatch
13196
- } = useContext(store$l);
13205
+ } = useContext(store$m);
13197
13206
  useEffect(() => {
13198
13207
  gapi.load("client:auth2", () => {
13199
13208
  gapi.auth2.init({
@@ -13297,10 +13306,10 @@ const Auth0LoginButton = ({
13297
13306
  }, [auth0Enabled, auth0Loaded]);
13298
13307
  const {
13299
13308
  dispatch: loginDispatch
13300
- } = useContext(store$m);
13309
+ } = useContext(store$n);
13301
13310
  const {
13302
13311
  dispatch: registerDispatch
13303
- } = useContext(store$l);
13312
+ } = useContext(store$m);
13304
13313
 
13305
13314
  function handleClick() {
13306
13315
  var _auth0InstanceRef$cur, _auth0InstanceRef$cur2, _auth0InstanceRef$cur3;
@@ -13675,11 +13684,11 @@ function LoginModal({
13675
13684
  LoginModal.viewId = "login";
13676
13685
 
13677
13686
  const RegisterEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
13678
- store: store$l
13687
+ store: store$m
13679
13688
  }, props));
13680
13689
 
13681
13690
  const RegisterPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
13682
- store: store$l
13691
+ store: store$m
13683
13692
  }, props));
13684
13693
 
13685
13694
  const RegisterButton = ({
@@ -13699,7 +13708,7 @@ const RegisterButton = ({
13699
13708
  buttonDisabled
13700
13709
  },
13701
13710
  dispatch
13702
- } = useContext(store$l);
13711
+ } = useContext(store$m);
13703
13712
  const {
13704
13713
  t
13705
13714
  } = useTranslation("register");
@@ -13837,7 +13846,7 @@ function FirstName({
13837
13846
  }
13838
13847
 
13839
13848
  const RegisterFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
13840
- store: store$l
13849
+ store: store$m
13841
13850
  }, props));
13842
13851
 
13843
13852
  function LastName({
@@ -13868,7 +13877,7 @@ function LastName({
13868
13877
  }
13869
13878
 
13870
13879
  const RegisterLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
13871
- store: store$l
13880
+ store: store$m
13872
13881
  }, props));
13873
13882
 
13874
13883
  /**
@@ -13991,7 +14000,7 @@ function TextInput({
13991
14000
 
13992
14001
  const RegisterTextInput = props => {
13993
14002
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
13994
- store: store$l
14003
+ store: store$m
13995
14004
  }));
13996
14005
  };
13997
14006
 
@@ -21459,7 +21468,7 @@ class TapGateway {
21459
21468
 
21460
21469
  /** @type {PaymentStateType} */
21461
21470
 
21462
- const initialState$k = {
21471
+ const initialState$l = {
21463
21472
  disableSubmit: false,
21464
21473
  isLoading: false,
21465
21474
  disableCouponButton: false,
@@ -21484,10 +21493,10 @@ const initialState$k = {
21484
21493
  content: ""
21485
21494
  }
21486
21495
  };
21487
- const store$k = /*#__PURE__*/createContext(initialState$k);
21496
+ const store$l = /*#__PURE__*/createContext(initialState$l);
21488
21497
  const {
21489
- Provider: Provider$k
21490
- } = store$k;
21498
+ Provider: Provider$l
21499
+ } = store$l;
21491
21500
 
21492
21501
  const PaymentMethodContainerWithoutStripe = ({
21493
21502
  style,
@@ -23170,21 +23179,21 @@ const PaymentMethodContainerWithoutStripe = ({
23170
23179
  default:
23171
23180
  return state;
23172
23181
  }
23173
- }, initialState$k);
23182
+ }, initialState$l);
23174
23183
  return /*#__PURE__*/React__default.createElement("div", {
23175
23184
  style: { ...style
23176
23185
  },
23177
23186
  className: `pelcro-container pelcro-payment-container ${className}`
23178
- }, /*#__PURE__*/React__default.createElement(Provider$k, {
23187
+ }, /*#__PURE__*/React__default.createElement(Provider$l, {
23179
23188
  value: {
23180
23189
  state,
23181
23190
  dispatch
23182
23191
  }
23183
23192
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
23184
- store: store$k,
23193
+ store: store$l,
23185
23194
  key: i
23186
23195
  })) : /*#__PURE__*/React__default.cloneElement(children, {
23187
- store: store$k
23196
+ store: store$l
23188
23197
  })));
23189
23198
  };
23190
23199
 
@@ -23212,11 +23221,11 @@ const PaymentMethodContainer = props => {
23212
23221
  stripeAccount: window.Pelcro.site.read().account_id,
23213
23222
  locale: getPageOrDefaultLanguage()
23214
23223
  }, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
23215
- store: store$k
23224
+ store: store$l
23216
23225
  }, props))));
23217
23226
  } else {
23218
23227
  return /*#__PURE__*/React__default.createElement(PaymentMethodContainerWithoutStripe, Object.assign({
23219
- store: store$k
23228
+ store: store$l
23220
23229
  }, props));
23221
23230
  }
23222
23231
  };
@@ -23267,7 +23276,7 @@ const PelcroPaymentRequestButton = props => {
23267
23276
  currentPlan,
23268
23277
  updatedPrice
23269
23278
  }
23270
- } = useContext(store$k);
23279
+ } = useContext(store$l);
23271
23280
 
23272
23281
  const updatePaymentRequest = () => {
23273
23282
  // Make sure payment request is up to date, eg. user added a coupon code.
@@ -23349,7 +23358,7 @@ const DiscountedPrice = props => {
23349
23358
  taxAmount,
23350
23359
  percentOff
23351
23360
  }
23352
- } = useContext(store$k);
23361
+ } = useContext(store$l);
23353
23362
  const {
23354
23363
  order,
23355
23364
  plan
@@ -23399,7 +23408,7 @@ const SubmitPaymentMethod = ({
23399
23408
  isLoading,
23400
23409
  updatedPrice
23401
23410
  }
23402
- } = useContext(store$k);
23411
+ } = useContext(store$l);
23403
23412
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
23404
23413
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
23405
23414
  const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
@@ -23431,7 +23440,7 @@ const ApplyCouponButton = ({
23431
23440
  disableCouponButton
23432
23441
  },
23433
23442
  dispatch
23434
- } = useContext(store$k);
23443
+ } = useContext(store$l);
23435
23444
  const {
23436
23445
  t
23437
23446
  } = useTranslation("checkoutForm");
@@ -23465,7 +23474,7 @@ const CouponCodeField = props => {
23465
23474
  couponCode,
23466
23475
  couponError
23467
23476
  }
23468
- } = useContext(store$k);
23477
+ } = useContext(store$l);
23469
23478
 
23470
23479
  const onCouponCodeChange = e => {
23471
23480
  dispatch({
@@ -23521,7 +23530,7 @@ const CouponCode = ({
23521
23530
  state: {
23522
23531
  enableCouponField
23523
23532
  }
23524
- } = useContext(store$k);
23533
+ } = useContext(store$l);
23525
23534
  const {
23526
23535
  t
23527
23536
  } = useTranslation("checkoutForm");
@@ -23778,7 +23787,7 @@ const PaypalSubscribeButton = props => {
23778
23787
  const {
23779
23788
  dispatch,
23780
23789
  state
23781
- } = useContext(store$k);
23790
+ } = useContext(store$l);
23782
23791
  const {
23783
23792
  product,
23784
23793
  plan,
@@ -23911,7 +23920,7 @@ const SelectedPaymentMethod = () => {
23911
23920
  state: {
23912
23921
  isLoading
23913
23922
  }
23914
- } = useContext(store$k);
23923
+ } = useContext(store$l);
23915
23924
  const {
23916
23925
  switchView,
23917
23926
  selectedPaymentMethodId
@@ -23953,7 +23962,7 @@ const TaxAmount = () => {
23953
23962
  state: {
23954
23963
  taxAmount
23955
23964
  }
23956
- } = useContext(store$k);
23965
+ } = useContext(store$l);
23957
23966
  const {
23958
23967
  plan
23959
23968
  } = usePelcro();
@@ -23972,11 +23981,11 @@ const TaxAmount = () => {
23972
23981
  };
23973
23982
 
23974
23983
  const IncludeFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
23975
- store: store$k
23984
+ store: store$l
23976
23985
  }, props));
23977
23986
 
23978
23987
  const IncludeLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
23979
- store: store$k
23988
+ store: store$l
23980
23989
  }, props));
23981
23990
 
23982
23991
  function Phone({
@@ -24005,7 +24014,7 @@ function Phone({
24005
24014
  }
24006
24015
 
24007
24016
  const IncludePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
24008
- store: store$k
24017
+ store: store$l
24009
24018
  }, props));
24010
24019
 
24011
24020
  const SubscriptionCreateFreePlanButton = ({
@@ -24018,7 +24027,7 @@ const SubscriptionCreateFreePlanButton = ({
24018
24027
  disableSubmit
24019
24028
  },
24020
24029
  dispatch
24021
- } = useContext(store$k);
24030
+ } = useContext(store$l);
24022
24031
  const {
24023
24032
  t
24024
24033
  } = useTranslation("common");
@@ -24234,13 +24243,13 @@ function SubscriptionRenewModal({
24234
24243
  }
24235
24244
  SubscriptionRenewModal.viewId = "subscription-renew";
24236
24245
 
24237
- const initialState$j = {
24246
+ const initialState$k = {
24238
24247
  cancelationReason: ""
24239
24248
  };
24240
- const store$j = /*#__PURE__*/createContext(initialState$j);
24249
+ const store$k = /*#__PURE__*/createContext(initialState$k);
24241
24250
  const {
24242
- Provider: Provider$j
24243
- } = store$j;
24251
+ Provider: Provider$k
24252
+ } = store$k;
24244
24253
 
24245
24254
  const SubscriptionCancelContainer = ({
24246
24255
  style,
@@ -24261,21 +24270,21 @@ const SubscriptionCancelContainer = ({
24261
24270
  default:
24262
24271
  return state;
24263
24272
  }
24264
- }, initialState$j);
24273
+ }, initialState$k);
24265
24274
  return /*#__PURE__*/React__default.createElement("div", {
24266
24275
  style: { ...style
24267
24276
  },
24268
24277
  className: `pelcro-container pelcro-subscription-cancel-container ${className}`
24269
- }, /*#__PURE__*/React__default.createElement(Provider$j, {
24278
+ }, /*#__PURE__*/React__default.createElement(Provider$k, {
24270
24279
  value: {
24271
24280
  state,
24272
24281
  dispatch
24273
24282
  }
24274
24283
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
24275
- store: store$j,
24284
+ store: store$k,
24276
24285
  key: i
24277
24286
  })) : /*#__PURE__*/React__default.cloneElement(children, {
24278
- store: store$j
24287
+ store: store$k
24279
24288
  })));
24280
24289
  };
24281
24290
 
@@ -24360,7 +24369,7 @@ const SubscriptionCancelReason = props => {
24360
24369
  const {
24361
24370
  dispatch,
24362
24371
  state
24363
- } = useContext(store$j);
24372
+ } = useContext(store$k);
24364
24373
 
24365
24374
  const handleOnTextAreaBlur = e => {
24366
24375
  dispatch({
@@ -24408,7 +24417,7 @@ const SubscriptionCancelNowButton = ({
24408
24417
  cancelationReason
24409
24418
  },
24410
24419
  dispatch
24411
- } = useContext(store$j);
24420
+ } = useContext(store$k);
24412
24421
  const {
24413
24422
  t
24414
24423
  } = useTranslation("subscriptionCancel");
@@ -24480,7 +24489,7 @@ const SubscriptionCancelLaterButton = ({
24480
24489
  cancelationReason
24481
24490
  },
24482
24491
  dispatch
24483
- } = useContext(store$j);
24492
+ } = useContext(store$k);
24484
24493
  const {
24485
24494
  t
24486
24495
  } = useTranslation("subscriptionCancel");
@@ -24591,14 +24600,14 @@ const SubscriptionCancelModal = ({
24591
24600
  };
24592
24601
  SubscriptionCancelModal.viewId = "subscription-cancel";
24593
24602
 
24594
- const initialState$i = {
24603
+ const initialState$j = {
24595
24604
  suspendDate: null,
24596
24605
  buttonDisabled: false
24597
24606
  };
24598
- const store$i = /*#__PURE__*/createContext(initialState$i);
24607
+ const store$j = /*#__PURE__*/createContext(initialState$j);
24599
24608
  const {
24600
- Provider: Provider$i
24601
- } = store$i;
24609
+ Provider: Provider$j
24610
+ } = store$j;
24602
24611
 
24603
24612
  const SubscriptionSuspendContainer = ({
24604
24613
  style,
@@ -24624,21 +24633,21 @@ const SubscriptionSuspendContainer = ({
24624
24633
  default:
24625
24634
  return state;
24626
24635
  }
24627
- }, initialState$i);
24636
+ }, initialState$j);
24628
24637
  return /*#__PURE__*/React__default.createElement("div", {
24629
24638
  style: { ...style
24630
24639
  },
24631
24640
  className: `pelcro-container pelcro-subscription-suspend-container ${className}`
24632
- }, /*#__PURE__*/React__default.createElement(Provider$i, {
24641
+ }, /*#__PURE__*/React__default.createElement(Provider$j, {
24633
24642
  value: {
24634
24643
  state,
24635
24644
  dispatch
24636
24645
  }
24637
24646
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
24638
- store: store$i,
24647
+ store: store$j,
24639
24648
  key: i
24640
24649
  })) : /*#__PURE__*/React__default.cloneElement(children, {
24641
- store: store$i
24650
+ store: store$j
24642
24651
  })));
24643
24652
  };
24644
24653
 
@@ -24687,7 +24696,7 @@ const SubscriptionSuspendDate = props => {
24687
24696
  const {
24688
24697
  dispatch,
24689
24698
  state
24690
- } = useContext(store$i);
24699
+ } = useContext(store$j);
24691
24700
 
24692
24701
  const handleInputChange = value => {
24693
24702
  if (value) {
@@ -24729,7 +24738,7 @@ const SubscriptionSuspendButton = ({
24729
24738
  buttonDisabled
24730
24739
  },
24731
24740
  dispatch
24732
- } = useContext(store$i);
24741
+ } = useContext(store$j);
24733
24742
  const {
24734
24743
  t
24735
24744
  } = useTranslation("subscriptionSuspend");
@@ -25199,7 +25208,7 @@ class DefaultNewsLetter extends Component {
25199
25208
 
25200
25209
  const NewsLetter = withTranslation("newsletter")(DefaultNewsLetter);
25201
25210
 
25202
- const initialState$h = {
25211
+ const initialState$i = {
25203
25212
  didSubToNewslettersBefore: false,
25204
25213
  newsletters: [],
25205
25214
  isListLoading: true,
@@ -25209,10 +25218,10 @@ const initialState$h = {
25209
25218
  content: ""
25210
25219
  }
25211
25220
  };
25212
- const store$h = /*#__PURE__*/createContext(initialState$h);
25221
+ const store$i = /*#__PURE__*/createContext(initialState$i);
25213
25222
  const {
25214
- Provider: Provider$h
25215
- } = store$h;
25223
+ Provider: Provider$i
25224
+ } = store$i;
25216
25225
 
25217
25226
  const NewsletterUpdateContainer = ({
25218
25227
  style,
@@ -25325,7 +25334,7 @@ const NewsletterUpdateContainer = ({
25325
25334
  default:
25326
25335
  return state;
25327
25336
  }
25328
- }, initialState$h);
25337
+ }, initialState$i);
25329
25338
  useEffect(() => {
25330
25339
  const getUserNewsletters = () => {
25331
25340
  var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
@@ -25369,7 +25378,7 @@ const NewsletterUpdateContainer = ({
25369
25378
  style: { ...style
25370
25379
  },
25371
25380
  className: `pelcro-container pelcro-newsletter-update-container ${className}`
25372
- }, /*#__PURE__*/React__default.createElement(Provider$h, {
25381
+ }, /*#__PURE__*/React__default.createElement(Provider$i, {
25373
25382
  value: {
25374
25383
  state,
25375
25384
  dispatch
@@ -25377,12 +25386,12 @@ const NewsletterUpdateContainer = ({
25377
25386
  }, children.length ? children.map((child, i) => {
25378
25387
  if (child) {
25379
25388
  return /*#__PURE__*/React__default.cloneElement(child, {
25380
- store: store$h,
25389
+ store: store$i,
25381
25390
  key: i
25382
25391
  });
25383
25392
  }
25384
25393
  }) : /*#__PURE__*/React__default.cloneElement(children, {
25385
- store: store$h
25394
+ store: store$i
25386
25395
  })));
25387
25396
  };
25388
25397
 
@@ -25397,7 +25406,7 @@ const NewsletterUpdateButton = ({
25397
25406
  isSubmitting,
25398
25407
  isListLoading
25399
25408
  }
25400
- } = useContext(store$h);
25409
+ } = useContext(store$i);
25401
25410
  const {
25402
25411
  t
25403
25412
  } = useTranslation("newsletter");
@@ -25427,7 +25436,7 @@ const NewsletterUpdateList = () => {
25427
25436
  newsletters,
25428
25437
  isListLoading
25429
25438
  }
25430
- } = useContext(store$h);
25439
+ } = useContext(store$i);
25431
25440
 
25432
25441
  if (isListLoading) {
25433
25442
  return /*#__PURE__*/React__default.createElement(Loader, {
@@ -25640,7 +25649,7 @@ function SubscriptionCreateModal({
25640
25649
  }
25641
25650
  SubscriptionCreateModal.viewId = "subscription-create";
25642
25651
 
25643
- const initialState$g = {
25652
+ const initialState$h = {
25644
25653
  emails: "",
25645
25654
  emailsError: null,
25646
25655
  buttonDisabled: false,
@@ -25652,10 +25661,10 @@ const initialState$g = {
25652
25661
  content: ""
25653
25662
  }
25654
25663
  };
25655
- const store$g = /*#__PURE__*/createContext(initialState$g);
25664
+ const store$h = /*#__PURE__*/createContext(initialState$h);
25656
25665
  const {
25657
- Provider: Provider$g
25658
- } = store$g;
25666
+ Provider: Provider$h
25667
+ } = store$h;
25659
25668
 
25660
25669
  const SubscriptionManageMembersContainer = ({
25661
25670
  style,
@@ -25827,7 +25836,7 @@ const SubscriptionManageMembersContainer = ({
25827
25836
  default:
25828
25837
  return state;
25829
25838
  }
25830
- }, initialState$g);
25839
+ }, initialState$h);
25831
25840
  useEffect(() => {
25832
25841
  dispatch({
25833
25842
  type: HANDLE_LIST_MEMBERS
@@ -25837,7 +25846,7 @@ const SubscriptionManageMembersContainer = ({
25837
25846
  style: { ...style
25838
25847
  },
25839
25848
  className: `pelcro-container pelcro-manage-members-container ${className}`
25840
- }, /*#__PURE__*/React__default.createElement(Provider$g, {
25849
+ }, /*#__PURE__*/React__default.createElement(Provider$h, {
25841
25850
  value: {
25842
25851
  state,
25843
25852
  dispatch
@@ -25845,12 +25854,12 @@ const SubscriptionManageMembersContainer = ({
25845
25854
  }, children.length ? children.map((child, i) => {
25846
25855
  if (child) {
25847
25856
  return /*#__PURE__*/React__default.cloneElement(child, {
25848
- store: store$g,
25857
+ store: store$h,
25849
25858
  key: i
25850
25859
  });
25851
25860
  }
25852
25861
  }) : /*#__PURE__*/React__default.cloneElement(children, {
25853
- store: store$g
25862
+ store: store$h
25854
25863
  })));
25855
25864
  };
25856
25865
 
@@ -25866,7 +25875,7 @@ const SubscriptionManageMembersButton = ({
25866
25875
  buttonDisabled
25867
25876
  },
25868
25877
  dispatch
25869
- } = useContext(store$g);
25878
+ } = useContext(store$h);
25870
25879
  const {
25871
25880
  t
25872
25881
  } = useTranslation("subscriptionManageMembers");
@@ -25896,7 +25905,7 @@ function SubscriptionManageMembersEmails(props) {
25896
25905
  emails: stateEmails,
25897
25906
  emailsError
25898
25907
  }
25899
- } = useContext(store$g);
25908
+ } = useContext(store$h);
25900
25909
  const [emails, setEmails] = useState(stateEmails);
25901
25910
  const [finishedTyping, setFinishedTyping] = useState(false);
25902
25911
  const handleInputChange = useCallback(value => {
@@ -25955,7 +25964,7 @@ function SubscriptionManageMembersList(props) {
25955
25964
  removeMemberId,
25956
25965
  loading
25957
25966
  }
25958
- } = useContext(store$g);
25967
+ } = useContext(store$h);
25959
25968
  const getMemberStatus = useCallback(sub => {
25960
25969
  if (sub.status === "pending") {
25961
25970
  return {
@@ -26118,11 +26127,11 @@ function SubscriptionManageMembersModal({
26118
26127
  }
26119
26128
  SubscriptionManageMembersModal.viewId = "manage-members";
26120
26129
 
26121
- var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
26122
- const initialState$f = {
26123
- email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
26130
+ var _window$Pelcro$user$r$1, _window$Pelcro$user$r2$1, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
26131
+ const initialState$g = {
26132
+ email: (_window$Pelcro$user$r$1 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r$1 === void 0 ? void 0 : _window$Pelcro$user$r$1.email,
26124
26133
  emailError: null,
26125
- firstName: (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.first_name,
26134
+ firstName: (_window$Pelcro$user$r2$1 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2$1 === void 0 ? void 0 : _window$Pelcro$user$r2$1.first_name,
26126
26135
  lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
26127
26136
  lastNameError: null,
26128
26137
  username: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.username,
@@ -26136,10 +26145,10 @@ const initialState$f = {
26136
26145
  content: ""
26137
26146
  }
26138
26147
  };
26139
- const store$f = /*#__PURE__*/createContext(initialState$f);
26148
+ const store$g = /*#__PURE__*/createContext(initialState$g);
26140
26149
  const {
26141
- Provider: Provider$f
26142
- } = store$f;
26150
+ Provider: Provider$g
26151
+ } = store$g;
26143
26152
 
26144
26153
  const UserUpdateContainer = ({
26145
26154
  style,
@@ -26306,12 +26315,12 @@ const UserUpdateContainer = ({
26306
26315
  default:
26307
26316
  return state;
26308
26317
  }
26309
- }, initialState$f);
26318
+ }, initialState$g);
26310
26319
  return /*#__PURE__*/React__default.createElement("div", {
26311
26320
  style: { ...style
26312
26321
  },
26313
26322
  className: `pelcro-container pelcro-user-update-container ${className}`
26314
- }, /*#__PURE__*/React__default.createElement(Provider$f, {
26323
+ }, /*#__PURE__*/React__default.createElement(Provider$g, {
26315
26324
  value: {
26316
26325
  state,
26317
26326
  dispatch
@@ -26319,12 +26328,12 @@ const UserUpdateContainer = ({
26319
26328
  }, children.length ? children.map((child, i) => {
26320
26329
  if (child) {
26321
26330
  return /*#__PURE__*/React__default.cloneElement(child, {
26322
- store: store$f,
26331
+ store: store$g,
26323
26332
  key: i
26324
26333
  });
26325
26334
  }
26326
26335
  }) : /*#__PURE__*/React__default.cloneElement(children, {
26327
- store: store$f
26336
+ store: store$g
26328
26337
  })));
26329
26338
  };
26330
26339
 
@@ -26350,7 +26359,7 @@ const UserUpdateEmail = props => {
26350
26359
  email,
26351
26360
  emailError
26352
26361
  }
26353
- } = useContext(store$f);
26362
+ } = useContext(store$g);
26354
26363
  const [enableEmailEdit, setEnableEmailEdit] = useState(false);
26355
26364
  const {
26356
26365
  t
@@ -26376,7 +26385,7 @@ const UserUpdateEmail = props => {
26376
26385
  className: "plc-flex plc-items-start plc-relative"
26377
26386
  }, /*#__PURE__*/React__default.createElement(Email, Object.assign({
26378
26387
  disabled: !enableEmailEdit,
26379
- store: store$f,
26388
+ store: store$g,
26380
26389
  label: t("labels.email"),
26381
26390
  enableEmailEdit: enableEmailEdit
26382
26391
  }, props)), /*#__PURE__*/React__default.createElement(Button, {
@@ -26401,7 +26410,7 @@ const UserUpdateButton = ({
26401
26410
  emailError
26402
26411
  },
26403
26412
  dispatch
26404
- } = useContext(store$f);
26413
+ } = useContext(store$g);
26405
26414
  const {
26406
26415
  t
26407
26416
  } = useTranslation("userEdit");
@@ -26492,19 +26501,19 @@ function UpdateUserNameInput({
26492
26501
  }
26493
26502
 
26494
26503
  const UserUpdateUsername = props => /*#__PURE__*/React__default.createElement(UpdateUserNameInput, Object.assign({
26495
- store: store$f
26504
+ store: store$g
26496
26505
  }, props));
26497
26506
 
26498
26507
  const UserUpdateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
26499
- store: store$f
26508
+ store: store$g
26500
26509
  }, props));
26501
26510
 
26502
26511
  const UserUpdateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
26503
- store: store$f
26512
+ store: store$g
26504
26513
  }, props));
26505
26514
 
26506
26515
  const UserUpdatePhone = props => /*#__PURE__*/React__default.createElement(Phone, Object.assign({
26507
- store: store$f
26516
+ store: store$g
26508
26517
  }, props));
26509
26518
 
26510
26519
  var userSolidIcon = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20class%3D%22plc-h-5%20plc-w-5%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22white%22%3E%20%20%3Cpath%20transform%3D%22translate%280%2C2%29%22%20fill-rule%3D%22evenodd%22%20d%3D%22M10%209a3%203%200%20100-6%203%203%200%20000%206zm-7%209a7%207%200%201114%200H3z%22%20clip-rule%3D%22evenodd%22%20%2F%3E%3C%2Fsvg%3E";
@@ -26591,7 +26600,7 @@ function Tin({
26591
26600
  }
26592
26601
 
26593
26602
  const UserUpdateTin = props => /*#__PURE__*/React__default.createElement(Tin, Object.assign({
26594
- store: store$f
26603
+ store: store$g
26595
26604
  }, props));
26596
26605
 
26597
26606
  function DisplayName({
@@ -26622,7 +26631,7 @@ function DisplayName({
26622
26631
  }
26623
26632
 
26624
26633
  const UserUpdateDisplayName = props => /*#__PURE__*/React__default.createElement(DisplayName, Object.assign({
26625
- store: store$f
26634
+ store: store$g
26626
26635
  }, props));
26627
26636
 
26628
26637
  const UserUpdateView = props => {
@@ -26717,11 +26726,11 @@ UserUpdateModal.viewId = "user-edit";
26717
26726
 
26718
26727
  const UserUpdateTextInput = props => {
26719
26728
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
26720
- store: store$f
26729
+ store: store$g
26721
26730
  }));
26722
26731
  };
26723
26732
 
26724
- const initialState$e = {
26733
+ const initialState$f = {
26725
26734
  isSubmitting: false,
26726
26735
  firstName: "",
26727
26736
  firstNameError: "",
@@ -26747,10 +26756,10 @@ const initialState$e = {
26747
26756
  content: ""
26748
26757
  }
26749
26758
  };
26750
- const store$e = /*#__PURE__*/createContext(initialState$e);
26759
+ const store$f = /*#__PURE__*/createContext(initialState$f);
26751
26760
  const {
26752
- Provider: Provider$e
26753
- } = store$e;
26761
+ Provider: Provider$f
26762
+ } = store$f;
26754
26763
 
26755
26764
  const getNewlyCreatedAddress = addresses => addresses[addresses.length - 1];
26756
26765
 
@@ -26997,7 +27006,7 @@ const AddressCreateContainer = ({
26997
27006
  default:
26998
27007
  return state;
26999
27008
  }
27000
- }, initialState$e);
27009
+ }, initialState$f);
27001
27010
  useEffect(() => {
27002
27011
  const getStates = () => {
27003
27012
  dispatch({
@@ -27029,16 +27038,16 @@ const AddressCreateContainer = ({
27029
27038
  style: { ...style
27030
27039
  },
27031
27040
  className: `pelcro-container pelcro-address-create-container ${className}`
27032
- }, /*#__PURE__*/React__default.createElement(Provider$e, {
27041
+ }, /*#__PURE__*/React__default.createElement(Provider$f, {
27033
27042
  value: {
27034
27043
  state,
27035
27044
  dispatch
27036
27045
  }
27037
27046
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
27038
- store: store$e,
27047
+ store: store$f,
27039
27048
  key: i
27040
27049
  })) : /*#__PURE__*/React__default.cloneElement(children, {
27041
- store: store$e
27050
+ store: store$f
27042
27051
  })));
27043
27052
  };
27044
27053
 
@@ -27049,7 +27058,7 @@ function AddressCreateFirstName(props) {
27049
27058
  firstName,
27050
27059
  firstNameError
27051
27060
  }
27052
- } = useContext(store$e);
27061
+ } = useContext(store$f);
27053
27062
 
27054
27063
  const handleInputChange = value => {
27055
27064
  dispatch({
@@ -27085,7 +27094,7 @@ function AddressCreateLastName(props) {
27085
27094
  lastName,
27086
27095
  lastNameError
27087
27096
  }
27088
- } = useContext(store$e);
27097
+ } = useContext(store$f);
27089
27098
 
27090
27099
  const handleInputChange = value => {
27091
27100
  dispatch({
@@ -27120,7 +27129,7 @@ function AddressCreateLine1(props) {
27120
27129
  line1,
27121
27130
  line1Error
27122
27131
  }
27123
- } = useContext(store$e);
27132
+ } = useContext(store$f);
27124
27133
 
27125
27134
  const handleBlur = () => {
27126
27135
  return dispatch({
@@ -27163,7 +27172,7 @@ function AddressCreateCity(props) {
27163
27172
  city,
27164
27173
  cityError
27165
27174
  }
27166
- } = useContext(store$e);
27175
+ } = useContext(store$f);
27167
27176
 
27168
27177
  const handleInputChange = value => {
27169
27178
  dispatch({
@@ -27198,7 +27207,7 @@ function AddressCreatePostalCode(props) {
27198
27207
  postalCode,
27199
27208
  postalCodeError
27200
27209
  }
27201
- } = useContext(store$e);
27210
+ } = useContext(store$f);
27202
27211
 
27203
27212
  const handleInputChange = value => {
27204
27213
  dispatch({
@@ -27236,7 +27245,7 @@ const AddressCreateSubmit = ({
27236
27245
  state: {
27237
27246
  isSubmitting
27238
27247
  }
27239
- } = useContext(store$e);
27248
+ } = useContext(store$f);
27240
27249
  const {
27241
27250
  t
27242
27251
  } = useTranslation("address");
@@ -27349,7 +27358,7 @@ function CountrySelect({
27349
27358
  }
27350
27359
 
27351
27360
  const AddressCreateCountrySelect = props => /*#__PURE__*/React__default.createElement(CountrySelect, Object.assign({
27352
- store: store$e
27361
+ store: store$f
27353
27362
  }, props));
27354
27363
 
27355
27364
  function StateSelect({
@@ -27438,14 +27447,14 @@ function StateSelect({
27438
27447
  }
27439
27448
 
27440
27449
  const AddressCreateStateSelect = props => /*#__PURE__*/React__default.createElement(StateSelect, Object.assign({
27441
- store: store$e
27450
+ store: store$f
27442
27451
  }, props));
27443
27452
 
27444
27453
  const AddressCreateSetDefault = props => {
27445
27454
  const {
27446
27455
  dispatch,
27447
27456
  state
27448
- } = useContext(store$e);
27457
+ } = useContext(store$f);
27449
27458
 
27450
27459
  const handleCheckboxChange = e => {
27451
27460
  dispatch({
@@ -27580,18 +27589,18 @@ AddressCreateModal.viewId = "address-create";
27580
27589
 
27581
27590
  const AddressCreateTextInput = props => {
27582
27591
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
27583
- store: store$e
27592
+ store: store$f
27584
27593
  }));
27585
27594
  };
27586
27595
 
27587
27596
  const AddressCreateLine2 = props => {
27588
27597
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({
27589
27598
  fieldName: "line2",
27590
- store: store$e
27599
+ store: store$f
27591
27600
  }, props));
27592
27601
  };
27593
27602
 
27594
- const initialState$d = {
27603
+ const initialState$e = {
27595
27604
  isSubmitting: false,
27596
27605
  firstName: "",
27597
27606
  firstNameError: "",
@@ -27617,10 +27626,10 @@ const initialState$d = {
27617
27626
  content: ""
27618
27627
  }
27619
27628
  };
27620
- const store$d = /*#__PURE__*/createContext(initialState$d);
27629
+ const store$e = /*#__PURE__*/createContext(initialState$e);
27621
27630
  const {
27622
- Provider: Provider$d
27623
- } = store$d;
27631
+ Provider: Provider$e
27632
+ } = store$e;
27624
27633
 
27625
27634
  const AddressUpdateContainer = ({
27626
27635
  style,
@@ -27672,7 +27681,7 @@ const AddressUpdateContainer = ({
27672
27681
  const thisAddress = addresses[address];
27673
27682
 
27674
27683
  if (+thisAddress.id === +addressId) {
27675
- const newState = { ...initialState$d,
27684
+ const newState = { ...initialState$e,
27676
27685
  firstName: thisAddress.first_name,
27677
27686
  lastName: thisAddress.last_name,
27678
27687
  line1: thisAddress.line1,
@@ -27813,7 +27822,7 @@ const AddressUpdateContainer = ({
27813
27822
  default:
27814
27823
  return state;
27815
27824
  }
27816
- }, initialState$d);
27825
+ }, initialState$e);
27817
27826
  useEffect(() => {
27818
27827
  const getStates = () => {
27819
27828
  dispatch({
@@ -27845,21 +27854,21 @@ const AddressUpdateContainer = ({
27845
27854
  style: { ...style
27846
27855
  },
27847
27856
  className: `pelcro-container pelcro-address-update-container ${className}`
27848
- }, /*#__PURE__*/React__default.createElement(Provider$d, {
27857
+ }, /*#__PURE__*/React__default.createElement(Provider$e, {
27849
27858
  value: {
27850
27859
  state,
27851
27860
  dispatch
27852
27861
  }
27853
27862
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
27854
- store: store$d,
27863
+ store: store$e,
27855
27864
  key: i
27856
27865
  })) : /*#__PURE__*/React__default.cloneElement(children, {
27857
- store: store$d
27866
+ store: store$e
27858
27867
  })));
27859
27868
  };
27860
27869
 
27861
27870
  const AddressUpdateCountrySelect = props => /*#__PURE__*/React__default.createElement(CountrySelect, Object.assign({
27862
- store: store$d
27871
+ store: store$e
27863
27872
  }, props));
27864
27873
 
27865
27874
  function AddressUpdateFirstName(props) {
@@ -27869,7 +27878,7 @@ function AddressUpdateFirstName(props) {
27869
27878
  firstName,
27870
27879
  firstNameError
27871
27880
  }
27872
- } = useContext(store$d);
27881
+ } = useContext(store$e);
27873
27882
 
27874
27883
  const handleBlur = () => {
27875
27884
  return dispatch({
@@ -27912,7 +27921,7 @@ function AddressUpdateLastName(props) {
27912
27921
  lastName,
27913
27922
  lastNameError
27914
27923
  }
27915
- } = useContext(store$d);
27924
+ } = useContext(store$e);
27916
27925
 
27917
27926
  const handleBlur = () => {
27918
27927
  return dispatch({
@@ -27955,7 +27964,7 @@ function AddressUpdateLine1(props) {
27955
27964
  line1,
27956
27965
  line1Error
27957
27966
  }
27958
- } = useContext(store$d);
27967
+ } = useContext(store$e);
27959
27968
 
27960
27969
  const handleBlur = () => {
27961
27970
  return dispatch({
@@ -27995,7 +28004,7 @@ const AddressUpdateLine2 = props => {
27995
28004
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({
27996
28005
  fieldName: "line2"
27997
28006
  }, props, {
27998
- store: store$d
28007
+ store: store$e
27999
28008
  }));
28000
28009
  };
28001
28010
 
@@ -28006,7 +28015,7 @@ function AddressUpdateCity(props) {
28006
28015
  city,
28007
28016
  cityError
28008
28017
  }
28009
- } = useContext(store$d);
28018
+ } = useContext(store$e);
28010
28019
 
28011
28020
  const handleBlur = () => {
28012
28021
  return dispatch({
@@ -28049,7 +28058,7 @@ function AddressUpdatePostalCode(props) {
28049
28058
  postalCode,
28050
28059
  postalCodeError
28051
28060
  }
28052
- } = useContext(store$d);
28061
+ } = useContext(store$e);
28053
28062
 
28054
28063
  const handleBlur = () => {
28055
28064
  return dispatch({
@@ -28095,7 +28104,7 @@ const AddressUpdateSubmit = ({
28095
28104
  state: {
28096
28105
  isSubmitting
28097
28106
  }
28098
- } = useContext(store$d);
28107
+ } = useContext(store$e);
28099
28108
  const {
28100
28109
  t
28101
28110
  } = useTranslation("address");
@@ -28111,7 +28120,7 @@ const AddressUpdateSubmit = ({
28111
28120
  };
28112
28121
 
28113
28122
  const AddressUpdateStateSelect = props => /*#__PURE__*/React__default.createElement(StateSelect, Object.assign({
28114
- store: store$d
28123
+ store: store$e
28115
28124
  }, props));
28116
28125
 
28117
28126
  function AddressUpdateSetDefault(props) {
@@ -28120,7 +28129,7 @@ function AddressUpdateSetDefault(props) {
28120
28129
  state: {
28121
28130
  isDefault
28122
28131
  }
28123
- } = useContext(store$d);
28132
+ } = useContext(store$e);
28124
28133
 
28125
28134
  const handleCheckboxChange = e => {
28126
28135
  dispatch({
@@ -28228,7 +28237,7 @@ AddressUpdateModal.viewId = "address-edit";
28228
28237
 
28229
28238
  const AddressUpdateTextInput = props => {
28230
28239
  return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
28231
- store: store$d
28240
+ store: store$e
28232
28241
  }));
28233
28242
  };
28234
28243
 
@@ -28310,7 +28319,7 @@ const PaymentMethodUpdateModal = props => {
28310
28319
  };
28311
28320
  PaymentMethodUpdateModal.viewId = "payment-method-update";
28312
28321
 
28313
- const initialState$c = {
28322
+ const initialState$d = {
28314
28323
  email: "",
28315
28324
  password: "",
28316
28325
  passwordError: null,
@@ -28323,10 +28332,10 @@ const initialState$c = {
28323
28332
  content: ""
28324
28333
  }
28325
28334
  };
28326
- const store$c = /*#__PURE__*/createContext(initialState$c);
28335
+ const store$d = /*#__PURE__*/createContext(initialState$d);
28327
28336
  const {
28328
- Provider: Provider$c
28329
- } = store$c;
28337
+ Provider: Provider$d
28338
+ } = store$d;
28330
28339
 
28331
28340
  const PasswordResetContainer = ({
28332
28341
  style,
@@ -28383,7 +28392,7 @@ const PasswordResetContainer = ({
28383
28392
  type: SET_EMAIL,
28384
28393
  payload: window.Pelcro.helpers.getURLParameter("email")
28385
28394
  });
28386
- initialState$c.email = window.Pelcro.helpers.getURLParameter("email");
28395
+ initialState$d.email = window.Pelcro.helpers.getURLParameter("email");
28387
28396
  dispatch({
28388
28397
  type: SET_TOKEN,
28389
28398
  payload: window.Pelcro.helpers.getURLParameter("token")
@@ -28443,26 +28452,26 @@ const PasswordResetContainer = ({
28443
28452
  default:
28444
28453
  return state;
28445
28454
  }
28446
- }, initialState$c);
28455
+ }, initialState$d);
28447
28456
  return /*#__PURE__*/React__default.createElement("div", {
28448
28457
  style: { ...style
28449
28458
  },
28450
28459
  className: `pelcro-container pelcro-password-reset-container ${className}`
28451
- }, /*#__PURE__*/React__default.createElement(Provider$c, {
28460
+ }, /*#__PURE__*/React__default.createElement(Provider$d, {
28452
28461
  value: {
28453
28462
  state,
28454
28463
  dispatch
28455
28464
  }
28456
28465
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
28457
- store: store$c,
28466
+ store: store$d,
28458
28467
  key: i
28459
28468
  })) : /*#__PURE__*/React__default.cloneElement(children, {
28460
- store: store$c
28469
+ store: store$d
28461
28470
  })));
28462
28471
  };
28463
28472
 
28464
28473
  const PasswordResetPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
28465
- store: store$c
28474
+ store: store$d
28466
28475
  }, props));
28467
28476
 
28468
28477
  const PasswordResetButton = ({
@@ -28475,7 +28484,7 @@ const PasswordResetButton = ({
28475
28484
  buttonDisabled
28476
28485
  },
28477
28486
  dispatch
28478
- } = useContext(store$c);
28487
+ } = useContext(store$d);
28479
28488
  const {
28480
28489
  t
28481
28490
  } = useTranslation("passwordReset");
@@ -28492,14 +28501,14 @@ const PasswordResetButton = ({
28492
28501
  };
28493
28502
 
28494
28503
  const PasswordResetEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
28495
- store: store$c
28504
+ store: store$d
28496
28505
  }, props, {
28497
28506
  value: window.Pelcro.helpers.getURLParameter("email"),
28498
28507
  disabled: true
28499
28508
  }));
28500
28509
 
28501
28510
  const PasswordResetConfirmPassword = props => /*#__PURE__*/React__default.createElement(ConfirmPassword, Object.assign({
28502
- store: store$c
28511
+ store: store$d
28503
28512
  }, props));
28504
28513
 
28505
28514
  const PasswordResetView = props => {
@@ -28554,7 +28563,7 @@ const PasswordResetModal = ({
28554
28563
  };
28555
28564
  PasswordResetModal.viewId = "password-reset";
28556
28565
 
28557
- const initialState$b = {
28566
+ const initialState$c = {
28558
28567
  email: "",
28559
28568
  emailError: null,
28560
28569
  buttonDisabled: false,
@@ -28563,10 +28572,10 @@ const initialState$b = {
28563
28572
  content: ""
28564
28573
  }
28565
28574
  };
28566
- const store$b = /*#__PURE__*/createContext(initialState$b);
28575
+ const store$c = /*#__PURE__*/createContext(initialState$c);
28567
28576
  const {
28568
- Provider: Provider$b
28569
- } = store$b;
28577
+ Provider: Provider$c
28578
+ } = store$c;
28570
28579
 
28571
28580
  const PasswordForgotContainer = ({
28572
28581
  style,
@@ -28644,21 +28653,21 @@ const PasswordForgotContainer = ({
28644
28653
  default:
28645
28654
  return state;
28646
28655
  }
28647
- }, initialState$b);
28656
+ }, initialState$c);
28648
28657
  return /*#__PURE__*/React__default.createElement("div", {
28649
28658
  style: { ...style
28650
28659
  },
28651
28660
  className: `pelcro-container pelcro-password-forgot-container ${className}`
28652
- }, /*#__PURE__*/React__default.createElement(Provider$b, {
28661
+ }, /*#__PURE__*/React__default.createElement(Provider$c, {
28653
28662
  value: {
28654
28663
  state,
28655
28664
  dispatch
28656
28665
  }
28657
28666
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
28658
- store: store$b,
28667
+ store: store$c,
28659
28668
  key: i
28660
28669
  })) : /*#__PURE__*/React__default.cloneElement(children, {
28661
- store: store$b
28670
+ store: store$c
28662
28671
  })));
28663
28672
  };
28664
28673
 
@@ -28674,7 +28683,7 @@ const PasswordForgotButton = ({
28674
28683
  emailError
28675
28684
  },
28676
28685
  dispatch
28677
- } = useContext(store$b);
28686
+ } = useContext(store$c);
28678
28687
  const {
28679
28688
  t
28680
28689
  } = useTranslation("passwordForgot");
@@ -28695,7 +28704,7 @@ const PasswordForgotButton = ({
28695
28704
  };
28696
28705
 
28697
28706
  const PasswordForgotEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
28698
- store: store$b
28707
+ store: store$c
28699
28708
  }, props));
28700
28709
 
28701
28710
  const PasswordForgotView = props => {
@@ -28749,7 +28758,7 @@ const PasswordForgotModal = ({
28749
28758
  };
28750
28759
  PasswordForgotModal.viewId = "password-forgot";
28751
28760
 
28752
- const initialState$a = {
28761
+ const initialState$b = {
28753
28762
  email: "",
28754
28763
  emailError: null,
28755
28764
  buttonDisabled: false,
@@ -28758,10 +28767,10 @@ const initialState$a = {
28758
28767
  content: ""
28759
28768
  }
28760
28769
  };
28761
- const store$a = /*#__PURE__*/createContext(initialState$a);
28770
+ const store$b = /*#__PURE__*/createContext(initialState$b);
28762
28771
  const {
28763
- Provider: Provider$a
28764
- } = store$a;
28772
+ Provider: Provider$b
28773
+ } = store$b;
28765
28774
 
28766
28775
  const PasswordlessRequestContainer = ({
28767
28776
  style,
@@ -28839,21 +28848,21 @@ const PasswordlessRequestContainer = ({
28839
28848
  default:
28840
28849
  return state;
28841
28850
  }
28842
- }, initialState$a);
28851
+ }, initialState$b);
28843
28852
  return /*#__PURE__*/React__default.createElement("div", {
28844
28853
  style: { ...style
28845
28854
  },
28846
28855
  className: `pelcro-container pelcro-password-forgot-container ${className}`
28847
- }, /*#__PURE__*/React__default.createElement(Provider$a, {
28856
+ }, /*#__PURE__*/React__default.createElement(Provider$b, {
28848
28857
  value: {
28849
28858
  state,
28850
28859
  dispatch
28851
28860
  }
28852
28861
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
28853
- store: store$a,
28862
+ store: store$b,
28854
28863
  key: i
28855
28864
  })) : /*#__PURE__*/React__default.cloneElement(children, {
28856
- store: store$a
28865
+ store: store$b
28857
28866
  })));
28858
28867
  };
28859
28868
 
@@ -28869,7 +28878,7 @@ const PasswordlessRequestViewButton = ({
28869
28878
  emailError
28870
28879
  },
28871
28880
  dispatch
28872
- } = useContext(store$a);
28881
+ } = useContext(store$b);
28873
28882
  const {
28874
28883
  t
28875
28884
  } = useTranslation("passwordlessRequest");
@@ -28890,7 +28899,7 @@ const PasswordlessRequestViewButton = ({
28890
28899
  };
28891
28900
 
28892
28901
  const PasswordlessRequestEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
28893
- store: store$a
28902
+ store: store$b
28894
28903
  }, props));
28895
28904
 
28896
28905
  const PasswordlessRequestView = props => {
@@ -28934,7 +28943,7 @@ const PasswordlessRequestModal = ({
28934
28943
  };
28935
28944
  PasswordlessRequestModal.viewId = "passwordless-request";
28936
28945
 
28937
- const initialState$9 = {
28946
+ const initialState$a = {
28938
28947
  currentPassword: "",
28939
28948
  newPassword: "",
28940
28949
  confirmNewPassword: "",
@@ -28948,10 +28957,10 @@ const initialState$9 = {
28948
28957
  content: ""
28949
28958
  }
28950
28959
  };
28951
- const store$9 = /*#__PURE__*/createContext(initialState$9);
28960
+ const store$a = /*#__PURE__*/createContext(initialState$a);
28952
28961
  const {
28953
- Provider: Provider$9
28954
- } = store$9;
28962
+ Provider: Provider$a
28963
+ } = store$a;
28955
28964
  const PasswordChangeContainer = ({
28956
28965
  style,
28957
28966
  className = "",
@@ -29103,21 +29112,21 @@ const PasswordChangeContainer = ({
29103
29112
  default:
29104
29113
  return state;
29105
29114
  }
29106
- }, initialState$9);
29115
+ }, initialState$a);
29107
29116
  return /*#__PURE__*/React__default.createElement("div", {
29108
29117
  style: { ...style
29109
29118
  },
29110
29119
  className: `pelcro-container pelcro-password-change-container ${className}`
29111
- }, /*#__PURE__*/React__default.createElement(Provider$9, {
29120
+ }, /*#__PURE__*/React__default.createElement(Provider$a, {
29112
29121
  value: {
29113
29122
  state,
29114
29123
  dispatch
29115
29124
  }
29116
29125
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
29117
- store: store$9,
29126
+ store: store$a,
29118
29127
  key: i
29119
29128
  })) : /*#__PURE__*/React__default.cloneElement(children, {
29120
- store: store$9
29129
+ store: store$a
29121
29130
  })));
29122
29131
  };
29123
29132
 
@@ -29128,7 +29137,7 @@ function PasswordChangeCurrentPassword(props) {
29128
29137
  currentPassword,
29129
29138
  currentPasswordError
29130
29139
  }
29131
- } = useContext(store$9);
29140
+ } = useContext(store$a);
29132
29141
  const handleBlur = useCallback(() => {
29133
29142
  return dispatch({
29134
29143
  type: VALIDATE_PASSWORD
@@ -29162,7 +29171,7 @@ function PasswordChangeNewPassword(props) {
29162
29171
  newPassword,
29163
29172
  newPasswordError
29164
29173
  }
29165
- } = useContext(store$9);
29174
+ } = useContext(store$a);
29166
29175
  const handleBlur = useCallback(() => {
29167
29176
  return dispatch({
29168
29177
  type: VALIDATE_NEW_PASSWORD
@@ -29196,7 +29205,7 @@ function PasswordChangeConfirmNewPassword(props) {
29196
29205
  confirmNewPassword,
29197
29206
  confirmNewPasswordError
29198
29207
  }
29199
- } = useContext(store$9);
29208
+ } = useContext(store$a);
29200
29209
  const handleBlur = useCallback(() => {
29201
29210
  return dispatch({
29202
29211
  type: VALIDATE_CONFIRM_NEW_PASSWORD
@@ -29237,7 +29246,7 @@ const PasswordChangeButton = ({
29237
29246
  confirmNewPasswordError
29238
29247
  },
29239
29248
  dispatch
29240
- } = useContext(store$9);
29249
+ } = useContext(store$a);
29241
29250
  const {
29242
29251
  t
29243
29252
  } = useTranslation("passwordChange");
@@ -29306,17 +29315,17 @@ const PasswordChangeModal = ({
29306
29315
  };
29307
29316
  PasswordChangeModal.viewId = "password-change";
29308
29317
 
29309
- const initialState$8 = {
29318
+ const initialState$9 = {
29310
29319
  buttonDisabled: false,
29311
29320
  alert: {
29312
29321
  type: "error",
29313
29322
  content: ""
29314
29323
  }
29315
29324
  };
29316
- const store$8 = /*#__PURE__*/createContext(initialState$8);
29325
+ const store$9 = /*#__PURE__*/createContext(initialState$9);
29317
29326
  const {
29318
- Provider: Provider$8
29319
- } = store$8;
29327
+ Provider: Provider$9
29328
+ } = store$9;
29320
29329
 
29321
29330
  const CartContainer = ({
29322
29331
  style,
@@ -29407,21 +29416,21 @@ const CartContainer = ({
29407
29416
  default:
29408
29417
  return state;
29409
29418
  }
29410
- }, initialState$8);
29419
+ }, initialState$9);
29411
29420
  return /*#__PURE__*/React__default.createElement("div", {
29412
29421
  style: { ...style
29413
29422
  },
29414
29423
  className: `pelcro-container pelcro-cart-container ${className}`
29415
- }, /*#__PURE__*/React__default.createElement(Provider$8, {
29424
+ }, /*#__PURE__*/React__default.createElement(Provider$9, {
29416
29425
  value: {
29417
29426
  state,
29418
29427
  dispatch
29419
29428
  }
29420
29429
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
29421
- store: store$8,
29430
+ store: store$9,
29422
29431
  key: i
29423
29432
  })) : /*#__PURE__*/React__default.cloneElement(children, {
29424
- store: store$8
29433
+ store: store$9
29425
29434
  })));
29426
29435
  };
29427
29436
 
@@ -29460,7 +29469,7 @@ const CartSubmit = ({
29460
29469
  buttonDisabled
29461
29470
  },
29462
29471
  dispatch
29463
- } = useContext(store$8);
29472
+ } = useContext(store$9);
29464
29473
  const {
29465
29474
  t
29466
29475
  } = useTranslation("cart");
@@ -29494,7 +29503,7 @@ const CartTotalPrice = () => {
29494
29503
  state: {
29495
29504
  alert
29496
29505
  }
29497
- } = useContext(store$8);
29506
+ } = useContext(store$9);
29498
29507
  const {
29499
29508
  cartItems
29500
29509
  } = usePelcro();
@@ -29818,7 +29827,7 @@ const OrderConfirmModal = props => {
29818
29827
  };
29819
29828
  OrderConfirmModal.viewId = "order-confirm";
29820
29829
 
29821
- const initialState$7 = {
29830
+ const initialState$8 = {
29822
29831
  email: "",
29823
29832
  firstName: "",
29824
29833
  lastName: "",
@@ -29830,10 +29839,10 @@ const initialState$7 = {
29830
29839
  content: ""
29831
29840
  }
29832
29841
  };
29833
- const store$7 = /*#__PURE__*/createContext(initialState$7);
29842
+ const store$8 = /*#__PURE__*/createContext(initialState$8);
29834
29843
  const {
29835
- Provider: Provider$7
29836
- } = store$7;
29844
+ Provider: Provider$8
29845
+ } = store$8;
29837
29846
 
29838
29847
  const GiftCreateContainer = ({
29839
29848
  style,
@@ -29937,21 +29946,21 @@ const GiftCreateContainer = ({
29937
29946
  default:
29938
29947
  return state;
29939
29948
  }
29940
- }, initialState$7);
29949
+ }, initialState$8);
29941
29950
  return /*#__PURE__*/React__default.createElement("div", {
29942
29951
  style: { ...style
29943
29952
  },
29944
29953
  className: `pelcro-container pelcro-gift-create-container ${className}`
29945
- }, /*#__PURE__*/React__default.createElement(Provider$7, {
29954
+ }, /*#__PURE__*/React__default.createElement(Provider$8, {
29946
29955
  value: {
29947
29956
  state,
29948
29957
  dispatch
29949
29958
  }
29950
29959
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
29951
- store: store$7,
29960
+ store: store$8,
29952
29961
  key: i
29953
29962
  })) : /*#__PURE__*/React__default.cloneElement(children, {
29954
- store: store$7
29963
+ store: store$8
29955
29964
  })));
29956
29965
  };
29957
29966
 
@@ -29965,7 +29974,7 @@ const GiftCreateSubmitButton = ({
29965
29974
  state: {
29966
29975
  disableSubmit
29967
29976
  }
29968
- } = useContext(store$7);
29977
+ } = useContext(store$8);
29969
29978
  const {
29970
29979
  t
29971
29980
  } = useTranslation("register");
@@ -29982,15 +29991,15 @@ const GiftCreateSubmitButton = ({
29982
29991
 
29983
29992
  const GiftCreateEmail = props => /*#__PURE__*/React__default.createElement(Email, Object.assign({
29984
29993
  initWithUserEmail: false,
29985
- store: store$7
29994
+ store: store$8
29986
29995
  }, props));
29987
29996
 
29988
29997
  const GiftCreateFirstName = props => /*#__PURE__*/React__default.createElement(FirstName, Object.assign({
29989
- store: store$7
29998
+ store: store$8
29990
29999
  }, props));
29991
30000
 
29992
30001
  const GiftCreateLastName = props => /*#__PURE__*/React__default.createElement(LastName, Object.assign({
29993
- store: store$7
30002
+ store: store$8
29994
30003
  }, props));
29995
30004
 
29996
30005
  const nowDate = new Date();
@@ -30005,7 +30014,7 @@ const GiftCreateStartDate = props => {
30005
30014
  const {
30006
30015
  dispatch,
30007
30016
  state
30008
- } = useContext(store$7);
30017
+ } = useContext(store$8);
30009
30018
 
30010
30019
  const handleInputChange = value => {
30011
30020
  dispatch({
@@ -30040,7 +30049,7 @@ function GiftCreateMessage(props) {
30040
30049
  const {
30041
30050
  dispatch,
30042
30051
  state
30043
- } = useContext(store$7);
30052
+ } = useContext(store$8);
30044
30053
  const MAX_CHARS_COUNT = 200;
30045
30054
  const remainingCharsCount = (_ref = MAX_CHARS_COUNT - ((_state$giftMessage = state.giftMessage) === null || _state$giftMessage === void 0 ? void 0 : _state$giftMessage.length)) !== null && _ref !== void 0 ? _ref : 0;
30046
30055
 
@@ -30170,7 +30179,7 @@ const GiftCreateModal = ({
30170
30179
  };
30171
30180
  GiftCreateModal.viewId = "gift-create";
30172
30181
 
30173
- const initialState$6 = {
30182
+ const initialState$7 = {
30174
30183
  isSubmitting: false,
30175
30184
  giftCode: "",
30176
30185
  buttonDisabled: true,
@@ -30179,10 +30188,10 @@ const initialState$6 = {
30179
30188
  content: ""
30180
30189
  }
30181
30190
  };
30182
- const store$6 = /*#__PURE__*/createContext(initialState$6);
30191
+ const store$7 = /*#__PURE__*/createContext(initialState$7);
30183
30192
  const {
30184
- Provider: Provider$6
30185
- } = store$6;
30193
+ Provider: Provider$7
30194
+ } = store$7;
30186
30195
 
30187
30196
  const GiftRedeemContainer = ({
30188
30197
  style,
@@ -30296,21 +30305,21 @@ const GiftRedeemContainer = ({
30296
30305
  default:
30297
30306
  return state;
30298
30307
  }
30299
- }, initialState$6);
30308
+ }, initialState$7);
30300
30309
  return /*#__PURE__*/React__default.createElement("div", {
30301
30310
  style: { ...style
30302
30311
  },
30303
30312
  className: `pelcro-container pelcro-gift-redeem-container ${className}`
30304
- }, /*#__PURE__*/React__default.createElement(Provider$6, {
30313
+ }, /*#__PURE__*/React__default.createElement(Provider$7, {
30305
30314
  value: {
30306
30315
  state,
30307
30316
  dispatch
30308
30317
  }
30309
30318
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
30310
- store: store$6,
30319
+ store: store$7,
30311
30320
  key: i
30312
30321
  })) : /*#__PURE__*/React__default.cloneElement(children, {
30313
- store: store$6
30322
+ store: store$7
30314
30323
  })));
30315
30324
  };
30316
30325
 
@@ -30347,7 +30356,7 @@ function GiftCode({
30347
30356
  }
30348
30357
 
30349
30358
  const GiftRedeemCode = props => /*#__PURE__*/React__default.createElement(GiftCode, Object.assign({
30350
- store: store$6
30359
+ store: store$7
30351
30360
  }, props));
30352
30361
 
30353
30362
  const GiftRedeemSubmitButton = ({
@@ -30361,7 +30370,7 @@ const GiftRedeemSubmitButton = ({
30361
30370
  disableSubmit,
30362
30371
  isSubmitting
30363
30372
  }
30364
- } = useContext(store$6);
30373
+ } = useContext(store$7);
30365
30374
  const {
30366
30375
  t
30367
30376
  } = useTranslation("register");
@@ -30456,7 +30465,7 @@ const moveDefaultAddressToStart = addresses => {
30456
30465
  return [defaultAddress, ...addressesWithoutDefault];
30457
30466
  };
30458
30467
 
30459
- const initialState$5 = {
30468
+ const initialState$6 = {
30460
30469
  addresses: [],
30461
30470
  selectedAddressId: null,
30462
30471
  isSubmitting: false,
@@ -30465,10 +30474,10 @@ const initialState$5 = {
30465
30474
  content: ""
30466
30475
  }
30467
30476
  };
30468
- const store$5 = /*#__PURE__*/createContext(initialState$5);
30477
+ const store$6 = /*#__PURE__*/createContext(initialState$6);
30469
30478
  const {
30470
- Provider: Provider$5
30471
- } = store$5;
30479
+ Provider: Provider$6
30480
+ } = store$6;
30472
30481
 
30473
30482
  const AddressSelectContainer = ({
30474
30483
  style,
@@ -30605,7 +30614,7 @@ const AddressSelectContainer = ({
30605
30614
  default:
30606
30615
  return state;
30607
30616
  }
30608
- }, initialState$5);
30617
+ }, initialState$6);
30609
30618
  useEffect(() => {
30610
30619
  var _window$Pelcro$user$r;
30611
30620
 
@@ -30618,16 +30627,16 @@ const AddressSelectContainer = ({
30618
30627
  style: { ...style
30619
30628
  },
30620
30629
  className: `pelcro-container pelcro-address-select-container ${className}`
30621
- }, /*#__PURE__*/React__default.createElement(Provider$5, {
30630
+ }, /*#__PURE__*/React__default.createElement(Provider$6, {
30622
30631
  value: {
30623
30632
  state,
30624
30633
  dispatch
30625
30634
  }
30626
30635
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
30627
- store: store$5,
30636
+ store: store$6,
30628
30637
  key: i
30629
30638
  })) : /*#__PURE__*/React__default.cloneElement(children, {
30630
- store: store$5
30639
+ store: store$6
30631
30640
  })));
30632
30641
  };
30633
30642
 
@@ -30638,7 +30647,7 @@ const AddressSelectList = () => {
30638
30647
  addresses,
30639
30648
  selectedAddressId
30640
30649
  }
30641
- } = useContext(store$5);
30650
+ } = useContext(store$6);
30642
30651
 
30643
30652
  const handleAddressSelect = event => {
30644
30653
  dispatch({
@@ -30682,7 +30691,7 @@ const AddressSelectSubmit = ({
30682
30691
  selectedAddressId,
30683
30692
  isSubmitting
30684
30693
  }
30685
- } = useContext(store$5);
30694
+ } = useContext(store$6);
30686
30695
  const {
30687
30696
  t
30688
30697
  } = useTranslation("address");
@@ -30792,7 +30801,7 @@ const moveDefaultPaymentMethodToStart = paymentMethods => {
30792
30801
  return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
30793
30802
  };
30794
30803
 
30795
- const initialState$4 = {
30804
+ const initialState$5 = {
30796
30805
  paymentMethods: [],
30797
30806
  selectedPaymentMethodId: null,
30798
30807
  isSubmitting: false,
@@ -30801,10 +30810,10 @@ const initialState$4 = {
30801
30810
  content: ""
30802
30811
  }
30803
30812
  };
30804
- const store$4 = /*#__PURE__*/createContext(initialState$4);
30813
+ const store$5 = /*#__PURE__*/createContext(initialState$5);
30805
30814
  const {
30806
- Provider: Provider$4
30807
- } = store$4;
30815
+ Provider: Provider$5
30816
+ } = store$5;
30808
30817
 
30809
30818
  const PaymentMethodSelectContainer = ({
30810
30819
  style,
@@ -30863,7 +30872,7 @@ const PaymentMethodSelectContainer = ({
30863
30872
  default:
30864
30873
  return state;
30865
30874
  }
30866
- }, initialState$4);
30875
+ }, initialState$5);
30867
30876
  useEffect(() => {
30868
30877
  var _window$Pelcro$user$r3;
30869
30878
 
@@ -30876,16 +30885,16 @@ const PaymentMethodSelectContainer = ({
30876
30885
  style: { ...style
30877
30886
  },
30878
30887
  className: `pelcro-container pelcro-payment-select-container ${className}`
30879
- }, /*#__PURE__*/React__default.createElement(Provider$4, {
30888
+ }, /*#__PURE__*/React__default.createElement(Provider$5, {
30880
30889
  value: {
30881
30890
  state,
30882
30891
  dispatch
30883
30892
  }
30884
30893
  }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
30885
- store: store$4,
30894
+ store: store$5,
30886
30895
  key: i
30887
30896
  })) : /*#__PURE__*/React__default.cloneElement(children, {
30888
- store: store$4
30897
+ store: store$5
30889
30898
  })));
30890
30899
  };
30891
30900
 
@@ -30899,7 +30908,7 @@ const PaymentMethodSelectList = () => {
30899
30908
  paymentMethods,
30900
30909
  selectedPaymentMethodId
30901
30910
  }
30902
- } = useContext(store$4);
30911
+ } = useContext(store$5);
30903
30912
 
30904
30913
  const handlePaymentMethodSelect = event => {
30905
30914
  dispatch({
@@ -30949,7 +30958,7 @@ const PaymentMethodSelectSubmit = ({
30949
30958
  selectedPaymentMethodId,
30950
30959
  isSubmitting
30951
30960
  }
30952
- } = useContext(store$4);
30961
+ } = useContext(store$5);
30953
30962
  return /*#__PURE__*/React__default.createElement(Button, Object.assign({
30954
30963
  onClick: () => {
30955
30964
  dispatch({
@@ -31035,23 +31044,234 @@ const PaymentMethodSelectModal = ({
31035
31044
  };
31036
31045
  PaymentMethodSelectModal.viewId = "payment-method-select";
31037
31046
 
31038
- function _extends$h() {
31039
- _extends$h = Object.assign || function (target) {
31040
- for (var i = 1; i < arguments.length; i++) {
31041
- var source = arguments[i];
31047
+ var _window$Pelcro$user$r, _window$Pelcro$user$r2;
31048
+ const initialState$4 = {
31049
+ isOpen: false,
31050
+ activeDashboardLink: null,
31051
+ subscriptions: window.Pelcro.subscription.list(),
31052
+ giftRecipients: (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.gift_recipients) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [],
31053
+ disableSubmit: false,
31054
+ addresses: []
31055
+ };
31056
+ const store$4 = /*#__PURE__*/createContext(initialState$4);
31057
+ const {
31058
+ Provider: Provider$4
31059
+ } = store$4;
31042
31060
 
31043
- for (var key in source) {
31044
- if (Object.prototype.hasOwnProperty.call(source, key)) {
31045
- target[key] = source[key];
31046
- }
31047
- }
31048
- }
31061
+ const DashboardContainer = ({
31062
+ onClose,
31063
+ style,
31064
+ className = "",
31065
+ children,
31066
+ ...props
31067
+ }) => {
31068
+ const {
31069
+ t
31070
+ } = useTranslation("dashboard");
31071
+ useEffect(() => {
31072
+ var _ReactGA$event;
31049
31073
 
31050
- return target;
31051
- };
31074
+ dispatch({
31075
+ type: SET_IS_OPEN,
31076
+ payload: true
31077
+ });
31078
+ window.Pelcro.insight.track("Modal Displayed", {
31079
+ name: "dashboard"
31080
+ });
31081
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
31082
+ category: "VIEWS",
31083
+ action: "Dashboard Modal Viewed",
31084
+ nonInteraction: true
31085
+ });
31086
+ const {
31087
+ addresses
31088
+ } = window.Pelcro.user.read();
31089
+ if (addresses) dispatch({
31090
+ type: SET_ADDRESSES,
31091
+ payload: addresses
31092
+ });
31093
+ return () => {};
31094
+ }, []);
31095
+ /**
31096
+ *
31097
+ * @param {*} payload
31098
+ * @param {*} dispatch
31099
+ */
31052
31100
 
31053
- return _extends$h.apply(this, arguments);
31054
- }
31101
+ const cancelSubscription = ({
31102
+ subscription_id,
31103
+ onSuccess,
31104
+ onFailure
31105
+ }, dispatch) => {
31106
+ window.Pelcro.subscription.cancel({
31107
+ auth_token: window.Pelcro.user.read().auth_token,
31108
+ subscription_id: subscription_id
31109
+ }, (err, res) => {
31110
+ var _ReactGA$event2;
31111
+
31112
+ dispatch({
31113
+ type: SET_DISABLESUBMIT,
31114
+ payload: false
31115
+ });
31116
+
31117
+ if (err) {
31118
+ return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
31119
+ }
31120
+
31121
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
31122
+ category: "ACTIONS",
31123
+ action: "Canceled",
31124
+ nonInteraction: true
31125
+ });
31126
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
31127
+ });
31128
+ };
31129
+ /**
31130
+ *
31131
+ * @param {*} payload
31132
+ * @param {*} dispatch
31133
+ */
31134
+
31135
+
31136
+ const unSuspendSubscription = ({
31137
+ subscription_id,
31138
+ onSuccess,
31139
+ onFailure
31140
+ }, dispatch) => {
31141
+ window.Pelcro.subscription.update({
31142
+ auth_token: window.Pelcro.user.read().auth_token,
31143
+ subscription_id: subscription_id,
31144
+ suspend: 0
31145
+ }, (err, res) => {
31146
+ var _ReactGA$event3;
31147
+
31148
+ dispatch({
31149
+ type: SET_DISABLESUBMIT,
31150
+ payload: false
31151
+ });
31152
+
31153
+ if (err) {
31154
+ return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
31155
+ }
31156
+
31157
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
31158
+ category: "ACTIONS",
31159
+ action: "UnSuspended",
31160
+ nonInteraction: true
31161
+ });
31162
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
31163
+ });
31164
+ };
31165
+ /**
31166
+ *
31167
+ * @param {*} payload
31168
+ * @param {*} dispatch
31169
+ */
31170
+
31171
+
31172
+ const reactivateSubscription = ({
31173
+ subscription_id,
31174
+ onSuccess,
31175
+ onFailure
31176
+ }, dispatch) => {
31177
+ window.Pelcro.subscription.reactivate({
31178
+ auth_token: window.Pelcro.user.read().auth_token,
31179
+ subscription_id: subscription_id
31180
+ }, (err, res) => {
31181
+ dispatch({
31182
+ type: SET_DISABLESUBMIT,
31183
+ payload: false
31184
+ });
31185
+ onClose();
31186
+
31187
+ if (err) {
31188
+ onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
31189
+ return notify.error(t("messages.subReactivation.error"));
31190
+ }
31191
+
31192
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
31193
+ return notify.success(t("messages.subReactivation.success"));
31194
+ });
31195
+ };
31196
+
31197
+ const [state, dispatch] = useReducerWithSideEffects((state, action) => {
31198
+ switch (action.type) {
31199
+ case SET_IS_OPEN:
31200
+ return lib_7({ ...state,
31201
+ isOpen: action.payload
31202
+ });
31203
+
31204
+ case CLOSE_DASHBOARD:
31205
+ return lib_7({ ...state,
31206
+ isOpen: false,
31207
+ activeDashboardLink: null
31208
+ });
31209
+
31210
+ case SET_ACTIVE_DASHBOARD_LINK:
31211
+ return lib_7({ ...state,
31212
+ activeDashboardLink: action.payload
31213
+ });
31214
+
31215
+ case SET_DISABLESUBMIT:
31216
+ {
31217
+ return lib_7({ ...state,
31218
+ disableSubmit: action.payload
31219
+ });
31220
+ }
31221
+
31222
+ case CANCEL_SUBSCRIPTION:
31223
+ return lib_5({ ...state,
31224
+ disableSubmit: true
31225
+ }, (state, dispatch) => cancelSubscription(action.payload, dispatch));
31226
+
31227
+ case UNSUSPEND_SUBSCRIPTION:
31228
+ return lib_5({ ...state,
31229
+ disableSubmit: true
31230
+ }, (state, dispatch) => unSuspendSubscription(action.payload, dispatch));
31231
+
31232
+ case REACTIVATE_SUBSCRIPTION:
31233
+ return lib_5({ ...state,
31234
+ disableSubmit: true
31235
+ }, (state, dispatch) => reactivateSubscription(action.payload, dispatch));
31236
+
31237
+ default:
31238
+ return state;
31239
+ }
31240
+ }, initialState$4);
31241
+ return /*#__PURE__*/React__default.createElement("div", {
31242
+ style: { ...style
31243
+ },
31244
+ className: `pelcro-container pelcro-dashboard-container ${className}`
31245
+ }, /*#__PURE__*/React__default.createElement(Provider$4, {
31246
+ value: {
31247
+ state,
31248
+ dispatch
31249
+ }
31250
+ }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
31251
+ store: store$4,
31252
+ key: i
31253
+ })) : /*#__PURE__*/React__default.cloneElement(children, {
31254
+ store: store$4
31255
+ })));
31256
+ };
31257
+
31258
+ function _extends$h() {
31259
+ _extends$h = Object.assign || function (target) {
31260
+ for (var i = 1; i < arguments.length; i++) {
31261
+ var source = arguments[i];
31262
+
31263
+ for (var key in source) {
31264
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
31265
+ target[key] = source[key];
31266
+ }
31267
+ }
31268
+ }
31269
+
31270
+ return target;
31271
+ };
31272
+
31273
+ return _extends$h.apply(this, arguments);
31274
+ }
31055
31275
 
31056
31276
  function _objectWithoutPropertiesLoose(source, excluded) {
31057
31277
  if (source == null) return {};
@@ -32147,8 +32367,9 @@ var _path$f;
32147
32367
 
32148
32368
  function _extends$f() { _extends$f = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
32149
32369
 
32150
- function SvgUser(props) {
32370
+ function SvgChevronRight(props) {
32151
32371
  return /*#__PURE__*/React.createElement("svg", _extends$f({
32372
+ className: "plc-w-6 plc-h-6",
32152
32373
  xmlns: "http://www.w3.org/2000/svg",
32153
32374
  fill: "none",
32154
32375
  viewBox: "0 0 24 24",
@@ -32157,18 +32378,139 @@ function SvgUser(props) {
32157
32378
  strokeLinecap: "round",
32158
32379
  strokeLinejoin: "round",
32159
32380
  strokeWidth: 2,
32160
- d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zm-4 7a7 7 0 00-7 7h14a7 7 0 00-7-7z"
32381
+ d: "M9 5l7 7-7 7"
32161
32382
  })));
32162
32383
  }
32163
32384
 
32385
+ const Card = ({
32386
+ children,
32387
+ className = "",
32388
+ title,
32389
+ requestStates,
32390
+ ...restProps
32391
+ }) => {
32392
+ useTranslation("dashboard");
32393
+ return /*#__PURE__*/React__default.createElement("div", {
32394
+ className: `plc-bg-white plc-border-2 plc-p-6 plc-rounded plc-my-11 md:plc-my-20 ${className}`,
32395
+ id: "plc-dashboard-card"
32396
+ }, title && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
32397
+ className: "plc-flex plc-items-end plc-justify-between"
32398
+ }, /*#__PURE__*/React__default.createElement("h3", {
32399
+ className: "plc-font-medium plc-text-xl"
32400
+ }, title), (requestStates === null || requestStates === void 0 ? void 0 : requestStates.loading) && /*#__PURE__*/React__default.createElement("span", {
32401
+ className: "plc-text-blue-500"
32402
+ }, "Loading..."), (requestStates === null || requestStates === void 0 ? void 0 : requestStates.success) && /*#__PURE__*/React__default.createElement("span", {
32403
+ className: "plc-text-green-500"
32404
+ }, "Saved"), (requestStates === null || requestStates === void 0 ? void 0 : requestStates.failed) && /*#__PURE__*/React__default.createElement("span", {
32405
+ className: "plc-text-red-500"
32406
+ }, "Failed")), /*#__PURE__*/React__default.createElement("hr", {
32407
+ className: "plc-border-t-2 plc-my-4"
32408
+ })), children);
32409
+ };
32410
+
32411
+ const SavedItemsMenu = () => {
32412
+ const {
32413
+ t
32414
+ } = useTranslation("dashboard");
32415
+ const [userMetadata, setUserMetadata] = useState(window.Pelcro.user.read().metadata);
32416
+ const userSavedItems = userMetadata ? Object.entries(userMetadata) // only get metadata related to saved items
32417
+ .filter(([categoryTitle, value]) => categoryTitle.startsWith("metadata_saved_") && (value === null || value === void 0 ? void 0 : value.length)) // drop the "metadata_saved_" from the category title
32418
+ .map(([categoryTitle, value]) => [categoryTitle.replace("metadata_saved_", ""), value]) : null;
32419
+ return /*#__PURE__*/React__default.createElement(Card, {
32420
+ id: "pelcro-dashboard-saved-menu",
32421
+ className: "plc-max-w-100% md:plc-max-w-80% plc-m-auto",
32422
+ title: t("labels.savedItems.label")
32423
+ }, /*#__PURE__*/React__default.createElement(SavedItems, {
32424
+ items: userSavedItems,
32425
+ setItems: setUserMetadata
32426
+ }));
32427
+ };
32428
+ const SavedItems = ({
32429
+ items,
32430
+ setItems
32431
+ }) => {
32432
+ const {
32433
+ t
32434
+ } = useTranslation("dashboard");
32435
+ const [isLoading, setLoading] = useState(false);
32436
+ const {
32437
+ isAuthenticated
32438
+ } = usePelcro();
32439
+
32440
+ const removeItemFromMetadata = (category, title) => {
32441
+ const user = window.Pelcro.user.read();
32442
+ const oldValue = user.metadata[`metadata_saved_${category}`];
32443
+ const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
32444
+
32445
+ if (isAuthenticated()) {
32446
+ setLoading(true);
32447
+ window.Pelcro.user.saveToMetaData({
32448
+ key: `saved_${category}`,
32449
+ value: newMetadataValue,
32450
+ auth_token: window.Pelcro.user.read().auth_token
32451
+ }, (error, response) => {
32452
+ var _response$data, _ReactGA$event;
32453
+
32454
+ setLoading(false);
32455
+
32456
+ if (error) {
32457
+ return;
32458
+ }
32459
+
32460
+ setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
32461
+ ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
32462
+ category: "ACTIONS",
32463
+ action: "Unsave/Unfollow",
32464
+ label: title
32465
+ });
32466
+ });
32467
+ }
32468
+ };
32469
+
32470
+ return !(items !== null && items !== void 0 && items.length) ? /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
32471
+ colSpan: "2",
32472
+ className: "plc-text-center plc-text-gray-500"
32473
+ }, t("labels.savedItems.noSavedItems")))) : items.map(([categoryTitle, item]) => {
32474
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
32475
+ key: categoryTitle
32476
+ }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, item.map(item => {
32477
+ return /*#__PURE__*/React__default.createElement("div", {
32478
+ key: item.title,
32479
+ className: `plc-py-2 plc-px-4 plc-mt-5 plc-flex plc-items-center plc-justify-between last:plc-mb-0 plc-text-gray-900 plc-bg-white plc-border-b-2`
32480
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Link, {
32481
+ className: "plc-text-gray-700 plc-no-underline",
32482
+ href: item.link,
32483
+ isButton: true,
32484
+ target: "_blank",
32485
+ rel: "noopener noreferrer"
32486
+ }, /*#__PURE__*/React__default.createElement("div", {
32487
+ className: "plc-flex plc-items-center plc-py-2 plc-space-x-2 sm:plc-p-2"
32488
+ }, (item === null || item === void 0 ? void 0 : item.image) && /*#__PURE__*/React__default.createElement("img", {
32489
+ className: "plc-w-12 plc-h-12 pelcro-saved-item-image",
32490
+ alt: `image of ${item.title}`,
32491
+ src: item === null || item === void 0 ? void 0 : item.image
32492
+ }), /*#__PURE__*/React__default.createElement("span", {
32493
+ className: "plc-font-semibold"
32494
+ }, item.title)))), /*#__PURE__*/React__default.createElement(Button, {
32495
+ variant: "ghost",
32496
+ type: "button",
32497
+ className: "plc-text-gray-500 plc-rounded-2xl",
32498
+ onClick: () => removeItemFromMetadata(categoryTitle, item.title)
32499
+ }, /*#__PURE__*/React__default.createElement(SvgXIcon, {
32500
+ className: "plc-fill-current"
32501
+ })));
32502
+ })));
32503
+ });
32504
+ };
32505
+
32164
32506
  var _path$e;
32165
32507
 
32166
32508
  function _extends$e() { _extends$e = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
32167
32509
 
32168
- function SvgNewsletter(props) {
32510
+ function SvgRefresh(props) {
32169
32511
  return /*#__PURE__*/React.createElement("svg", _extends$e({
32512
+ className: "plc-w-4 plc-h-4 plc-mr-1",
32170
32513
  xmlns: "http://www.w3.org/2000/svg",
32171
- className: "plc-h-5 plc-w-5",
32172
32514
  fill: "none",
32173
32515
  viewBox: "0 0 24 24",
32174
32516
  stroke: "currentColor"
@@ -32176,7 +32518,7 @@ function SvgNewsletter(props) {
32176
32518
  strokeLinecap: "round",
32177
32519
  strokeLinejoin: "round",
32178
32520
  strokeWidth: 2,
32179
- d: "M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"
32521
+ d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
32180
32522
  })));
32181
32523
  }
32182
32524
 
@@ -32184,18 +32526,16 @@ var _path$d;
32184
32526
 
32185
32527
  function _extends$d() { _extends$d = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
32186
32528
 
32187
- function SvgRefresh(props) {
32529
+ function SvgCalendar(props) {
32188
32530
  return /*#__PURE__*/React.createElement("svg", _extends$d({
32189
- className: "plc-w-4 plc-h-4 plc-mr-1",
32190
32531
  xmlns: "http://www.w3.org/2000/svg",
32191
- fill: "none",
32192
- viewBox: "0 0 24 24",
32193
- stroke: "currentColor"
32532
+ className: "plc-h-4 plc-w-4 plc-mr-1",
32533
+ viewBox: "0 0 20 20",
32534
+ fill: "currentColor"
32194
32535
  }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
32195
- strokeLinecap: "round",
32196
- strokeLinejoin: "round",
32197
- strokeWidth: 2,
32198
- d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
32536
+ fillRule: "evenodd",
32537
+ d: "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",
32538
+ clipRule: "evenodd"
32199
32539
  })));
32200
32540
  }
32201
32541
 
@@ -32203,10 +32543,10 @@ var _path$c;
32203
32543
 
32204
32544
  function _extends$c() { _extends$c = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
32205
32545
 
32206
- function SvgDocument(props) {
32546
+ function SvgPlus(props) {
32207
32547
  return /*#__PURE__*/React.createElement("svg", _extends$c({
32548
+ className: "plc-w-5 plc-h-5",
32208
32549
  xmlns: "http://www.w3.org/2000/svg",
32209
- className: "plc-h-6 plc-w-6 plc-mr-2",
32210
32550
  fill: "none",
32211
32551
  viewBox: "0 0 24 24",
32212
32552
  stroke: "currentColor"
@@ -32214,480 +32554,179 @@ function SvgDocument(props) {
32214
32554
  strokeLinecap: "round",
32215
32555
  strokeLinejoin: "round",
32216
32556
  strokeWidth: 2,
32217
- d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
32557
+ d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
32218
32558
  })));
32219
32559
  }
32220
32560
 
32221
- var _path$b;
32561
+ const AddNew = ({
32562
+ title,
32563
+ onClick
32564
+ }) => {
32565
+ const handleClick = () => {
32566
+ onClick === null || onClick === void 0 ? void 0 : onClick();
32567
+ };
32222
32568
 
32223
- function _extends$b() { _extends$b = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
32569
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title && /*#__PURE__*/React__default.createElement("div", {
32570
+ className: "plc-mt-5 plc-relative plc-text-primary-500"
32571
+ }, /*#__PURE__*/React__default.createElement("hr", {
32572
+ className: "plc-absolute plc-border-t-2 plc-my-4 plc-top-1.5 plc-w-full"
32573
+ }), /*#__PURE__*/React__default.createElement("button", {
32574
+ onClick: handleClick,
32575
+ className: "plc-bg-white plc-flex plc-items-center plc-mx-auto plc-p-2 plc-relative focus-within:plc-outline-none"
32576
+ }, /*#__PURE__*/React__default.createElement(SvgPlus, {
32577
+ className: "plc-w-4 plc-h-4 plc-mr-1"
32578
+ }), /*#__PURE__*/React__default.createElement("span", null, title))));
32579
+ };
32224
32580
 
32225
- function SvgPaymentCard(props) {
32226
- return /*#__PURE__*/React.createElement("svg", _extends$b({
32227
- className: "plc-w-6 plc-h-6 plc-mr-2",
32228
- xmlns: "http://www.w3.org/2000/svg",
32229
- fill: "none",
32230
- viewBox: "0 0 24 24",
32231
- stroke: "currentColor"
32232
- }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
32233
- strokeLinecap: "round",
32234
- strokeLinejoin: "round",
32235
- strokeWidth: 2,
32236
- d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"
32237
- })));
32238
- }
32581
+ const SubscriptionsMenu = props => {
32582
+ const {
32583
+ t
32584
+ } = useTranslation("dashboard");
32585
+ const {
32586
+ switchView
32587
+ } = usePelcro();
32239
32588
 
32240
- var _path$a, _path2;
32589
+ const displayRedeem = () => {
32590
+ return switchView("gift-redeem");
32591
+ };
32241
32592
 
32242
- function _extends$a() { _extends$a = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
32593
+ return /*#__PURE__*/React__default.createElement(Card, {
32594
+ id: "pelcro-dashboard-subscriptions-menu",
32595
+ className: "plc-max-w-100% md:plc-max-w-80% plc-m-auto",
32596
+ title: t("labels.subscriptions")
32597
+ }, /*#__PURE__*/React__default.createElement("table", {
32598
+ className: "plc-w-full plc-table-fixed pelcro-subscriptions-table plc-text-left"
32599
+ }, /*#__PURE__*/React__default.createElement("thead", {
32600
+ className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
32601
+ }, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
32602
+ className: "plc-hidden md:plc-table-cell plc-w-2/12"
32603
+ }, t("labels.product")), /*#__PURE__*/React__default.createElement("th", {
32604
+ className: "plc-w-1/3 md:plc-w-3/12"
32605
+ }, t("labels.plan")), /*#__PURE__*/React__default.createElement("th", {
32606
+ className: "plc-hidden md:plc-table-cell plc-w-2/12"
32607
+ }, t("labels.price")), /*#__PURE__*/React__default.createElement("th", {
32608
+ className: "plc-w-1/3 md:plc-w-2/12"
32609
+ }, t("labels.status.title")), /*#__PURE__*/React__default.createElement("th", {
32610
+ className: "plc-w-1/3 md:plc-w-2/12"
32611
+ }, t("labels.actions")), /*#__PURE__*/React__default.createElement("th", {
32612
+ className: "plc-w-1/3 md:plc-w-1/12"
32613
+ }))), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
32614
+ className: "plc-h-4"
32615
+ })), /*#__PURE__*/React__default.createElement(Accordion, null, /*#__PURE__*/React__default.createElement(SubscriptionsItems, props))), /*#__PURE__*/React__default.createElement(AddNew, {
32616
+ title: t("labels.addSubscription"),
32617
+ onClick: () => props === null || props === void 0 ? void 0 : props.displayProductSelect({
32618
+ isGift: false
32619
+ })
32620
+ }), /*#__PURE__*/React__default.createElement("table", {
32621
+ className: "plc-w-full plc-table-fixed pelcro-subscriptions-table plc-text-left"
32622
+ }, /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
32623
+ colSpan: "5",
32624
+ className: "plc-p-1"
32625
+ }, /*#__PURE__*/React__default.createElement(Button, {
32626
+ variant: "ghost",
32627
+ icon: /*#__PURE__*/React__default.createElement(SvgGift, {
32628
+ className: "plc-w-4 plc-h-4 plc-mr-1"
32629
+ }),
32630
+ className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
32631
+ onClick: displayRedeem
32632
+ }, t("labels.redeemGift")))))));
32633
+ };
32634
+ const SubscriptionsItems = ({
32635
+ onClose,
32636
+ setProductAndPlan,
32637
+ setSubscriptionIdToRenew,
32638
+ getSubscriptionStatus,
32639
+ activeMenu,
32640
+ toggleActiveMenu
32641
+ }) => {
32642
+ const {
32643
+ state: {
32644
+ disableSubmit
32645
+ },
32646
+ dispatch
32647
+ } = useContext(store$4);
32648
+ const {
32649
+ t
32650
+ } = useTranslation("dashboard");
32651
+ const {
32652
+ switchView,
32653
+ setSubscriptionToCancel,
32654
+ setSubscriptionToSuspend,
32655
+ set
32656
+ } = usePelcro();
32657
+ const subs = getNonDonationSubs();
32658
+ if (subs.length === 0) return null;
32659
+ return subs.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
32660
+ var _sub$plan;
32243
32661
 
32244
- function SvgLocationPin(props) {
32245
- return /*#__PURE__*/React.createElement("svg", _extends$a({
32246
- className: "plc-w-6 plc-h-6 plc-mr-2",
32247
- xmlns: "http://www.w3.org/2000/svg",
32248
- fill: "none",
32249
- viewBox: "0 0 24 24",
32250
- stroke: "currentColor"
32251
- }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
32252
- strokeLinecap: "round",
32253
- strokeLinejoin: "round",
32254
- strokeWidth: 2,
32255
- d: "M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"
32256
- })), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
32257
- strokeLinecap: "round",
32258
- strokeLinejoin: "round",
32259
- strokeWidth: 2,
32260
- d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z"
32261
- })));
32262
- }
32662
+ const isActive = activeMenu === sub.id; // Cancel button click handlers
32263
32663
 
32264
- var _path$9;
32664
+ const onCancelClick = () => {
32665
+ const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
32265
32666
 
32266
- function _extends$9() { _extends$9 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
32667
+ if (isImmediateCancelationEnabled) {
32668
+ setSubscriptionToCancel(sub.id);
32669
+ return switchView("subscription-cancel");
32670
+ }
32267
32671
 
32268
- function SvgShopping(props) {
32269
- return /*#__PURE__*/React.createElement("svg", _extends$9({
32270
- className: "plc-w-6 plc-h-6 plc-mr-2",
32271
- xmlns: "http://www.w3.org/2000/svg",
32272
- fill: "none",
32273
- viewBox: "0 0 24 24",
32274
- stroke: "currentColor"
32275
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
32276
- strokeLinecap: "round",
32277
- strokeLinejoin: "round",
32278
- strokeWidth: 2,
32279
- d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
32280
- })));
32281
- }
32672
+ if (userMustVerifyEmail()) {
32673
+ return switchView("email-verify");
32674
+ }
32282
32675
 
32283
- var _path$8;
32676
+ switchView(null);
32677
+ onClose === null || onClose === void 0 ? void 0 : onClose();
32678
+ notify.confirm((onSuccess, onFailure) => {
32679
+ dispatch({
32680
+ type: CANCEL_SUBSCRIPTION,
32681
+ payload: {
32682
+ subscription_id: sub.id,
32683
+ onSuccess,
32684
+ onFailure
32685
+ }
32686
+ });
32687
+ }, {
32688
+ confirmMessage: t("messages.subCancellation.isSureToCancel"),
32689
+ loadingMessage: t("messages.subCancellation.loading"),
32690
+ successMessage: t("messages.subCancellation.success"),
32691
+ errorMessage: t("messages.subCancellation.error")
32692
+ }, {
32693
+ closeButtonLabel: t("labels.subCancellation.goBack")
32694
+ });
32695
+ }; // Reactivate button click handlers
32284
32696
 
32285
- function _extends$8() { _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
32286
32697
 
32287
- function SvgBookmark(props) {
32288
- return /*#__PURE__*/React.createElement("svg", _extends$8({
32289
- className: "plc-w-6 plc-h-6 plc-mr-2",
32290
- xmlns: "http://www.w3.org/2000/svg",
32291
- fill: "none",
32292
- viewBox: "0 0 24 24",
32293
- stroke: "currentColor"
32294
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
32295
- strokeLinecap: "round",
32296
- strokeLinejoin: "round",
32297
- strokeWidth: 2,
32298
- d: "M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"
32299
- })));
32300
- }
32698
+ const onReactivateClick = () => {
32699
+ if (userMustVerifyEmail()) {
32700
+ return switchView("email-verify");
32701
+ }
32301
32702
 
32302
- var _path$7;
32703
+ dispatch({
32704
+ type: REACTIVATE_SUBSCRIPTION,
32705
+ payload: {
32706
+ subscription_id: sub.id
32707
+ }
32708
+ });
32709
+ }; // Renew click
32303
32710
 
32304
- function _extends$7() { _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
32305
32711
 
32306
- function SvgPlus(props) {
32307
- return /*#__PURE__*/React.createElement("svg", _extends$7({
32308
- className: "plc-w-5 plc-h-5",
32309
- xmlns: "http://www.w3.org/2000/svg",
32310
- fill: "none",
32311
- viewBox: "0 0 24 24",
32312
- stroke: "currentColor"
32313
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
32314
- strokeLinecap: "round",
32315
- strokeLinejoin: "round",
32316
- strokeWidth: 2,
32317
- d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
32318
- })));
32319
- }
32712
+ const onRenewClick = () => {
32713
+ const product_id = sub.plan.product.id;
32714
+ const plan_id = sub.plan.id;
32715
+ const product = window.Pelcro.product.getById(product_id);
32716
+ const plan = window.Pelcro.plan.getById(plan_id);
32717
+ setProductAndPlan(product, plan);
32718
+ setSubscriptionIdToRenew(sub.id);
32719
+ switchView("plan-select");
32720
+ }; // Manage members click
32320
32721
 
32321
- var _path$6;
32322
32722
 
32323
- function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
32324
-
32325
- function SvgKey(props) {
32326
- return /*#__PURE__*/React.createElement("svg", _extends$6({
32327
- xmlns: "http://www.w3.org/2000/svg",
32328
- viewBox: "0 0 20 20",
32329
- fill: "currentColor"
32330
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
32331
- fillRule: "evenodd",
32332
- d: "M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z",
32333
- clipRule: "evenodd"
32334
- })));
32335
- }
32336
-
32337
- var _path$5;
32338
-
32339
- function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
32340
-
32341
- function SvgDonate(props) {
32342
- return /*#__PURE__*/React.createElement("svg", _extends$5({
32343
- width: 24,
32344
- height: 24,
32345
- fill: "currentColor",
32346
- xmlns: "http://www.w3.org/2000/svg"
32347
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
32348
- d: "M4 21h9.62a3.995 3.995 0 003.037-1.397l5.102-5.952a1 1 0 00-.442-1.6l-1.968-.656a3.043 3.043 0 00-2.823.503l-3.185 2.547-.617-1.235A3.98 3.98 0 009.146 11H4c-1.103 0-2 .897-2 2v6c0 1.103.897 2 2 2zm0-8h5.146c.763 0 1.448.423 1.789 1.105l.447.895H7v2h6.014a.996.996 0 00.442-.11l.003-.001.004-.002h.003l.002-.001h.004l.001-.001c.009.003.003-.001.003-.001.01 0 .002-.001.002-.001h.001l.002-.001.003-.001.002-.001.002-.001.003-.001.002-.001c.003 0 .001-.001.002-.001l.003-.002.002-.001.002-.001.003-.001.002-.001h.001l.002-.001h.001l.002-.001.002-.001c.009-.001.003-.001.003-.001l.002-.001a.915.915 0 00.11-.078l4.146-3.317c.262-.208.623-.273.94-.167l.557.186-4.133 4.823a2.029 2.029 0 01-1.52.688H4v-6zM16 2h-.017c-.163.002-1.006.039-1.983.705-.951-.648-1.774-.7-1.968-.704L12.002 2h-.004c-.801 0-1.555.313-2.119.878C9.313 3.445 9 4.198 9 5s.313 1.555.861 2.104l3.414 3.586a1.006 1.006 0 001.45-.001l3.396-3.568C18.688 6.555 19 5.802 19 5s-.313-1.555-.878-2.121A2.978 2.978 0 0016.002 2H16zm1 3c0 .267-.104.518-.311.725L14 8.55l-2.707-2.843C11.104 5.518 11 5.267 11 5s.104-.518.294-.708A.977.977 0 0111.979 4c.025.001.502.032 1.067.485.081.065.163.139.247.222l.707.707.707-.707c.084-.083.166-.157.247-.222.529-.425.976-.478 1.052-.484a.987.987 0 01.701.292c.189.189.293.44.293.707z"
32349
- })));
32350
- }
32351
-
32352
- var _path$4;
32353
-
32354
- function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
32355
-
32356
- function SvgMemberships(props) {
32357
- return /*#__PURE__*/React.createElement("svg", _extends$4({
32358
- xmlns: "http://www.w3.org/2000/svg",
32359
- fill: "none",
32360
- strokeWidth: 1.5,
32361
- stroke: "currentColor",
32362
- width: 24,
32363
- height: 24
32364
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
32365
- strokeLinecap: "round",
32366
- strokeLinejoin: "round",
32367
- d: "M15 9h3.75M15 12h3.75M15 15h3.75M4.5 19.5h15a2.25 2.25 0 002.25-2.25V6.75A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25v10.5A2.25 2.25 0 004.5 19.5zm6-10.125a1.875 1.875 0 11-3.75 0 1.875 1.875 0 013.75 0zm1.294 6.336a6.721 6.721 0 01-3.17.789 6.721 6.721 0 01-3.168-.789 3.376 3.376 0 016.338 0z"
32368
- })));
32369
- }
32370
-
32371
- var _path$3;
32372
-
32373
- function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
32374
-
32375
- function SvgQrcode(props) {
32376
- return /*#__PURE__*/React.createElement("svg", _extends$3({
32377
- xmlns: "http://www.w3.org/2000/svg",
32378
- width: 682.667,
32379
- height: 682.667,
32380
- viewBox: "0 0 512 512"
32381
- }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
32382
- d: "M93.5 62.4c-15.7 3.9-28 16.6-31.4 32.4-.7 3.3-1.1 17.2-1.1 36.4 0 29.1.1 31.4 2 35.3 5.3 11 21.2 11.1 26.4.1 1.4-2.9 1.6-7.9 1.6-34.6 0-34.4.1-35.3 6.3-39 3-1.9 5.2-2 34.5-2 26.9 0 31.9-.2 34.8-1.6 11-5.2 10.9-21.1-.1-26.4-3.9-1.9-6.1-2-36.1-1.9-21.8 0-33.5.5-36.9 1.3zM345.4 63c-10.9 5.4-10.9 21.2 0 26.4 2.9 1.4 7.9 1.6 34.8 1.6 29.3 0 31.5.1 34.5 2 6.2 3.7 6.3 4.6 6.3 39 0 26.7.2 31.7 1.6 34.6 5.2 11 21.1 10.9 26.4-.1 1.9-3.9 2-6.2 2-35.3 0-19.2-.4-33.1-1.1-36.4-3.5-16.2-16.5-29.2-32.7-32.7-3.3-.7-17.2-1.1-36.5-1.1-29.3 0-31.5.1-35.3 2zM146 128.9c-6.9 2.1-12.1 6.5-15.6 13.1-1.8 3.2-1.9 6.3-1.9 38.5 0 34.2 0 35.1 2.2 39.1 2.8 5.3 9.1 10.7 14.2 12.2 2.5.8 14.4 1.2 35.8 1.2 36.3 0 38.3-.3 45.2-7.2 6.8-6.9 7.1-8.9 7.1-45.1 0-22.2-.4-33.2-1.2-36.1-1.8-6-10-13.9-16-15.4-5.3-1.3-65.5-1.6-69.8-.3zm57 51.6V203h-45v-45h45v22.5zM297 128.9c-8 2.5-14.9 9.2-16.9 16.4-.9 2.9-1.1 14.3-.9 37.7.3 37.2.2 36.2 7.4 43.3 6.6 6.4 8.8 6.7 45 6.7 35.6 0 38-.3 44.2-6.3 1.9-1.8 4.3-5 5.5-7.2 2.1-3.9 2.2-5 2.2-39s-.1-35.1-2.2-39c-2.5-4.7-6.4-8.5-11.3-11.1-3.2-1.7-6.4-1.9-37-2.1-18.4-.1-34.6.2-36 .6zm57 51.6V203h-45v-45h45v22.5zM144.1 280.3c-4.8 1.8-10.8 7.2-13.4 12-2.2 4.1-2.2 4.9-2.2 39.2 0 34 .1 35.1 2.2 39 2.5 4.7 6.4 8.5 11.3 11.1 3.2 1.7 6.6 1.9 35.5 2.2 38.9.4 40.7.2 48-7.2 3.2-3.2 5.5-6.6 6.3-9.2.8-2.9 1.2-13.9 1.2-36.1 0-35.8-.4-38.3-6.6-44.7-7-7.2-6-7.1-44.4-7.3-25.4-.1-35.4.1-37.9 1zm58.9 51.2V354h-45v-45h45v22.5zM294.8 280.4c-6.8 2.4-12.9 8.9-14.8 15.7-1.5 5-1.3 66.2.2 71 1.5 5.1 6.9 11.4 12.2 14.2 4 2.2 4.9 2.2 39.1 2.2 32.2 0 35.3-.1 38.5-1.9 4.9-2.6 8.8-6.4 11.3-11.1 2.1-3.9 2.2-5 2.2-39s-.1-35.1-2.2-39c-3-5.6-8-10.1-13.2-12-5.9-2-67.5-2.2-73.3-.1zm59.2 51.1V354h-45v-45h45v22.5zM68.7 339.2c-2.2 1.3-4.5 3.8-5.7 6.3-1.9 3.9-2 6.2-2 35.3 0 19.2.4 33.1 1.1 36.4 3.4 16.1 16.6 29.3 32.7 32.7 3.3.7 17.2 1.1 36.4 1.1 29.1 0 31.4-.1 35.3-2 11-5.3 11.1-21.2.1-26.4-2.9-1.4-7.9-1.6-34.6-1.6-34.4 0-35.3-.1-39-6.3-1.9-3-2-5.2-2-34.5 0-26.9-.2-31.9-1.6-34.8-3.6-7.5-13.5-10.5-20.7-6.2zM429.2 338.7c-1.8.9-4.3 3-5.5 4.7-2.1 3-2.2 4-2.7 36.1-.5 35.8-.6 36.1-6.3 39.5-3 1.9-5.3 2-34.5 2-34.5 0-36.1.2-40.2 6-5.4 7.5-2.8 18 5.5 22 3.9 1.9 6.2 2 35.3 2 19.2 0 33.1-.4 36.4-1.1 16.2-3.5 29.2-16.5 32.7-32.7.7-3.3 1.1-17.2 1.1-36.4 0-29.1-.1-31.4-2-35.3-3.6-7.4-12.5-10.4-19.8-6.8z"
32383
- })));
32384
- }
32385
-
32386
- var _path$2;
32387
-
32388
- function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
32389
-
32390
- function SvgChevronRight(props) {
32391
- return /*#__PURE__*/React.createElement("svg", _extends$2({
32392
- className: "plc-w-6 plc-h-6",
32393
- xmlns: "http://www.w3.org/2000/svg",
32394
- fill: "none",
32395
- viewBox: "0 0 24 24",
32396
- stroke: "currentColor"
32397
- }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
32398
- strokeLinecap: "round",
32399
- strokeLinejoin: "round",
32400
- strokeWidth: 2,
32401
- d: "M9 5l7 7-7 7"
32402
- })));
32403
- }
32404
-
32405
- const Card = ({
32406
- children,
32407
- className = "",
32408
- title,
32409
- requestStates,
32410
- ...restProps
32411
- }) => {
32412
- useTranslation("dashboard");
32413
- return /*#__PURE__*/React__default.createElement("div", {
32414
- className: `plc-bg-white plc-border-2 plc-p-6 plc-rounded plc-my-11 md:plc-my-20 ${className}`,
32415
- id: "plc-dashboard-card"
32416
- }, title && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
32417
- className: "plc-flex plc-items-end plc-justify-between"
32418
- }, /*#__PURE__*/React__default.createElement("h3", {
32419
- className: "plc-font-medium plc-text-xl"
32420
- }, title), (requestStates === null || requestStates === void 0 ? void 0 : requestStates.loading) && /*#__PURE__*/React__default.createElement("span", {
32421
- className: "plc-text-blue-500"
32422
- }, "Loading..."), (requestStates === null || requestStates === void 0 ? void 0 : requestStates.success) && /*#__PURE__*/React__default.createElement("span", {
32423
- className: "plc-text-green-500"
32424
- }, "Saved"), (requestStates === null || requestStates === void 0 ? void 0 : requestStates.failed) && /*#__PURE__*/React__default.createElement("span", {
32425
- className: "plc-text-red-500"
32426
- }, "Failed")), /*#__PURE__*/React__default.createElement("hr", {
32427
- className: "plc-border-t-2 plc-my-4"
32428
- })), children);
32429
- };
32430
-
32431
- const SavedItemsMenu = () => {
32432
- const {
32433
- t
32434
- } = useTranslation("dashboard");
32435
- const [userMetadata, setUserMetadata] = useState(window.Pelcro.user.read().metadata);
32436
- const userSavedItems = userMetadata ? Object.entries(userMetadata) // only get metadata related to saved items
32437
- .filter(([categoryTitle, value]) => categoryTitle.startsWith("metadata_saved_") && (value === null || value === void 0 ? void 0 : value.length)) // drop the "metadata_saved_" from the category title
32438
- .map(([categoryTitle, value]) => [categoryTitle.replace("metadata_saved_", ""), value]) : null;
32439
- return /*#__PURE__*/React__default.createElement(Card, {
32440
- id: "pelcro-dashboard-saved-menu",
32441
- className: "plc-max-w-100% md:plc-max-w-80% plc-m-auto",
32442
- title: t("labels.savedItems.label")
32443
- }, /*#__PURE__*/React__default.createElement(SavedItems, {
32444
- items: userSavedItems,
32445
- setItems: setUserMetadata
32446
- }));
32447
- };
32448
- const SavedItems = ({
32449
- items,
32450
- setItems
32451
- }) => {
32452
- const {
32453
- t
32454
- } = useTranslation("dashboard");
32455
- const [isLoading, setLoading] = useState(false);
32456
- const {
32457
- isAuthenticated
32458
- } = usePelcro();
32459
-
32460
- const removeItemFromMetadata = (category, title) => {
32461
- const user = window.Pelcro.user.read();
32462
- const oldValue = user.metadata[`metadata_saved_${category}`];
32463
- const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
32464
-
32465
- if (isAuthenticated()) {
32466
- setLoading(true);
32467
- window.Pelcro.user.saveToMetaData({
32468
- key: `saved_${category}`,
32469
- value: newMetadataValue,
32470
- auth_token: window.Pelcro.user.read().auth_token
32471
- }, (error, response) => {
32472
- var _response$data, _ReactGA$event;
32473
-
32474
- setLoading(false);
32475
-
32476
- if (error) {
32477
- return;
32478
- }
32479
-
32480
- setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
32481
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
32482
- category: "ACTIONS",
32483
- action: "Unsave/Unfollow",
32484
- label: title
32485
- });
32486
- });
32487
- }
32488
- };
32489
-
32490
- return !(items !== null && items !== void 0 && items.length) ? /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
32491
- colSpan: "2",
32492
- className: "plc-text-center plc-text-gray-500"
32493
- }, t("labels.savedItems.noSavedItems")))) : items.map(([categoryTitle, item]) => {
32494
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
32495
- key: categoryTitle
32496
- }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, item.map(item => {
32497
- return /*#__PURE__*/React__default.createElement("div", {
32498
- key: item.title,
32499
- className: `plc-py-2 plc-px-4 plc-mt-5 plc-flex plc-items-center plc-justify-between last:plc-mb-0 plc-text-gray-900 plc-bg-white plc-border-b-2`
32500
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Link, {
32501
- className: "plc-text-gray-700 plc-no-underline",
32502
- href: item.link,
32503
- isButton: true,
32504
- target: "_blank",
32505
- rel: "noopener noreferrer"
32506
- }, /*#__PURE__*/React__default.createElement("div", {
32507
- className: "plc-flex plc-items-center plc-py-2 plc-space-x-2 sm:plc-p-2"
32508
- }, (item === null || item === void 0 ? void 0 : item.image) && /*#__PURE__*/React__default.createElement("img", {
32509
- className: "plc-w-12 plc-h-12 pelcro-saved-item-image",
32510
- alt: `image of ${item.title}`,
32511
- src: item === null || item === void 0 ? void 0 : item.image
32512
- }), /*#__PURE__*/React__default.createElement("span", {
32513
- className: "plc-font-semibold"
32514
- }, item.title)))), /*#__PURE__*/React__default.createElement(Button, {
32515
- variant: "ghost",
32516
- type: "button",
32517
- className: "plc-text-gray-500 plc-rounded-2xl",
32518
- onClick: () => removeItemFromMetadata(categoryTitle, item.title)
32519
- }, /*#__PURE__*/React__default.createElement(SvgXIcon, {
32520
- className: "plc-fill-current"
32521
- })));
32522
- })));
32523
- });
32524
- };
32525
-
32526
- var _path$1;
32527
-
32528
- function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
32529
-
32530
- function SvgCalendar(props) {
32531
- return /*#__PURE__*/React.createElement("svg", _extends$1({
32532
- xmlns: "http://www.w3.org/2000/svg",
32533
- className: "plc-h-4 plc-w-4 plc-mr-1",
32534
- viewBox: "0 0 20 20",
32535
- fill: "currentColor"
32536
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
32537
- fillRule: "evenodd",
32538
- d: "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",
32539
- clipRule: "evenodd"
32540
- })));
32541
- }
32542
-
32543
- const AddNew = ({
32544
- title,
32545
- onClick
32546
- }) => {
32547
- const handleClick = () => {
32548
- onClick === null || onClick === void 0 ? void 0 : onClick();
32549
- };
32550
-
32551
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title && /*#__PURE__*/React__default.createElement("div", {
32552
- className: "plc-mt-5 plc-relative plc-text-primary-500"
32553
- }, /*#__PURE__*/React__default.createElement("hr", {
32554
- className: "plc-absolute plc-border-t-2 plc-my-4 plc-top-1.5 plc-w-full"
32555
- }), /*#__PURE__*/React__default.createElement("button", {
32556
- onClick: handleClick,
32557
- className: "plc-bg-white plc-flex plc-items-center plc-mx-auto plc-p-2 plc-relative focus-within:plc-outline-none"
32558
- }, /*#__PURE__*/React__default.createElement(SvgPlus, {
32559
- className: "plc-w-4 plc-h-4 plc-mr-1"
32560
- }), /*#__PURE__*/React__default.createElement("span", null, title))));
32561
- };
32562
-
32563
- const SubscriptionsMenu = props => {
32564
- const {
32565
- t
32566
- } = useTranslation("dashboard");
32567
- return /*#__PURE__*/React__default.createElement(Card, {
32568
- id: "pelcro-dashboard-subscriptions-menu",
32569
- className: "plc-max-w-100% md:plc-max-w-80% plc-m-auto",
32570
- title: t("labels.subscriptions")
32571
- }, /*#__PURE__*/React__default.createElement("table", {
32572
- className: "plc-w-full plc-table-fixed pelcro-subscriptions-table plc-text-left"
32573
- }, /*#__PURE__*/React__default.createElement("thead", {
32574
- className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
32575
- }, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
32576
- className: "plc-hidden md:plc-table-cell plc-w-2/12"
32577
- }, t("labels.product")), /*#__PURE__*/React__default.createElement("th", {
32578
- className: "plc-w-1/3 md:plc-w-3/12"
32579
- }, t("labels.plan")), /*#__PURE__*/React__default.createElement("th", {
32580
- className: "plc-hidden md:plc-table-cell plc-w-2/12"
32581
- }, t("labels.price")), /*#__PURE__*/React__default.createElement("th", {
32582
- className: "plc-w-1/3 md:plc-w-2/12"
32583
- }, t("labels.status.title")), /*#__PURE__*/React__default.createElement("th", {
32584
- className: "plc-w-1/3 md:plc-w-2/12"
32585
- }, t("labels.actions")), /*#__PURE__*/React__default.createElement("th", {
32586
- className: "plc-w-1/3 md:plc-w-1/12"
32587
- }))), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
32588
- className: "plc-h-4"
32589
- })), /*#__PURE__*/React__default.createElement(Accordion, null, /*#__PURE__*/React__default.createElement(SubscriptionsItems, props))), /*#__PURE__*/React__default.createElement(AddNew, {
32590
- title: t("labels.addSubscription"),
32591
- onClick: () => props === null || props === void 0 ? void 0 : props.displayProductSelect({
32592
- isGift: false
32593
- })
32594
- }), /*#__PURE__*/React__default.createElement("table", {
32595
- className: "plc-w-full plc-table-fixed pelcro-subscriptions-table plc-text-left"
32596
- }, /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
32597
- colSpan: "5",
32598
- className: "plc-p-1"
32599
- }, /*#__PURE__*/React__default.createElement(Button, {
32600
- variant: "ghost",
32601
- icon: /*#__PURE__*/React__default.createElement(SvgGift, {
32602
- className: "plc-w-4 plc-h-4 plc-mr-1"
32603
- }),
32604
- className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase plc-rounded-none hover:plc-bg-gray-100",
32605
- onClick: props.displayRedeem
32606
- }, t("labels.redeemGift")))))));
32607
- };
32608
- const SubscriptionsItems = ({
32609
- onClose,
32610
- cancelSubscription,
32611
- unSuspendSubscription,
32612
- reactivateSubscription,
32613
- setProductAndPlan,
32614
- setSubscriptionIdToRenew,
32615
- setView,
32616
- getSubscriptionStatus,
32617
- disableSubmit,
32618
- activeMenu,
32619
- toggleActiveMenu
32620
- }) => {
32621
- const {
32622
- t
32623
- } = useTranslation("dashboard");
32624
- const {
32625
- switchView,
32626
- setSubscriptionToCancel,
32627
- setSubscriptionToSuspend,
32628
- set
32629
- } = usePelcro();
32630
- const subs = getNonDonationSubs();
32631
- if (subs.length === 0) return null;
32632
- return subs.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
32633
- var _sub$plan;
32634
-
32635
- const isActive = activeMenu === sub.id; // Cancel button click handlers
32636
-
32637
- const onCancelClick = () => {
32638
- const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
32639
-
32640
- if (isImmediateCancelationEnabled) {
32641
- setSubscriptionToCancel(sub.id);
32642
- return switchView("subscription-cancel");
32643
- }
32644
-
32645
- if (userMustVerifyEmail()) {
32646
- return switchView("email-verify");
32647
- }
32648
-
32649
- switchView(null);
32650
- onClose === null || onClose === void 0 ? void 0 : onClose();
32651
- notify.confirm((onSuccess, onFailure) => {
32652
- cancelSubscription(sub.id, onSuccess, onFailure);
32653
- }, {
32654
- confirmMessage: t("messages.subCancellation.isSureToCancel"),
32655
- loadingMessage: t("messages.subCancellation.loading"),
32656
- successMessage: t("messages.subCancellation.success"),
32657
- errorMessage: t("messages.subCancellation.error")
32658
- }, {
32659
- closeButtonLabel: t("labels.subCancellation.goBack")
32660
- });
32661
- }; // Reactivate button click handlers
32662
-
32663
-
32664
- const onReactivateClick = () => {
32665
- if (userMustVerifyEmail()) {
32666
- return switchView("email-verify");
32667
- }
32668
-
32669
- reactivateSubscription(sub.id);
32670
- }; // Renew click
32671
-
32672
-
32673
- const onRenewClick = () => {
32674
- const product_id = sub.plan.product.id;
32675
- const plan_id = sub.plan.id;
32676
- const product = window.Pelcro.product.getById(product_id);
32677
- const plan = window.Pelcro.plan.getById(plan_id);
32678
- setProductAndPlan(product, plan);
32679
- setSubscriptionIdToRenew(sub.id);
32680
- setView("plan-select");
32681
- }; // Manage members click
32682
-
32683
-
32684
- const onManageMembersClick = () => {
32685
- const subscriptionToManageMembers = sub;
32686
- set({
32687
- subscriptionToManageMembers
32688
- });
32689
- setView("manage-members");
32690
- }; // Suspend click
32723
+ const onManageMembersClick = () => {
32724
+ const subscriptionToManageMembers = sub;
32725
+ set({
32726
+ subscriptionToManageMembers
32727
+ });
32728
+ switchView("manage-members");
32729
+ }; // Suspend click
32691
32730
 
32692
32731
 
32693
32732
  const onSuspendClick = () => {
@@ -32696,7 +32735,7 @@ const SubscriptionsItems = ({
32696
32735
  }
32697
32736
 
32698
32737
  setSubscriptionToSuspend(sub.id);
32699
- return setView("subscription-suspend");
32738
+ return switchView("subscription-suspend");
32700
32739
  }; // UnSuspend click
32701
32740
 
32702
32741
 
@@ -32707,7 +32746,14 @@ const SubscriptionsItems = ({
32707
32746
 
32708
32747
  onClose === null || onClose === void 0 ? void 0 : onClose();
32709
32748
  notify.confirm((onSuccess, onFailure) => {
32710
- unSuspendSubscription(sub.id, onSuccess, onFailure);
32749
+ dispatch({
32750
+ type: UNSUSPEND_SUBSCRIPTION,
32751
+ payload: {
32752
+ subscription_id: sub.id,
32753
+ onSuccess,
32754
+ onFailure
32755
+ }
32756
+ });
32711
32757
  }, {
32712
32758
  confirmMessage: t("messages.subUnSuspend.isSureToUnSuspend"),
32713
32759
  loadingMessage: t("messages.subUnSuspend.loading"),
@@ -33038,9 +33084,6 @@ const OrderItems = ({
33038
33084
  };
33039
33085
 
33040
33086
  const DonationsMenu = ({
33041
- reactivateSubscription,
33042
- disableSubmit,
33043
- cancelSubscription,
33044
33087
  getSubscriptionStatus,
33045
33088
  onClose
33046
33089
  }) => {
@@ -33051,6 +33094,12 @@ const DonationsMenu = ({
33051
33094
  switchView,
33052
33095
  setSubscriptionToCancel
33053
33096
  } = usePelcro();
33097
+ const {
33098
+ state: {
33099
+ disableSubmit
33100
+ },
33101
+ dispatch
33102
+ } = useContext(store$4);
33054
33103
  const subscriptions = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
33055
33104
  // Cancel button click handlers
33056
33105
  const onCancelClick = () => {
@@ -33068,7 +33117,14 @@ const DonationsMenu = ({
33068
33117
  switchView(null);
33069
33118
  onClose === null || onClose === void 0 ? void 0 : onClose();
33070
33119
  notify.confirm((onSuccess, onFailure) => {
33071
- cancelSubscription(sub.id, onSuccess, onFailure);
33120
+ dispatch({
33121
+ type: CANCEL_SUBSCRIPTION,
33122
+ payload: {
33123
+ subscription_id: sub.id,
33124
+ onSuccess,
33125
+ onFailure
33126
+ }
33127
+ });
33072
33128
  }, {
33073
33129
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
33074
33130
  loadingMessage: t("messages.subCancellation.loading"),
@@ -33085,7 +33141,12 @@ const DonationsMenu = ({
33085
33141
  return switchView("email-verify");
33086
33142
  }
33087
33143
 
33088
- reactivateSubscription(sub.id);
33144
+ dispatch({
33145
+ type: REACTIVATE_SUBSCRIPTION,
33146
+ payload: {
33147
+ subscription_id: sub.id
33148
+ }
33149
+ });
33089
33150
  };
33090
33151
 
33091
33152
  return /*#__PURE__*/React__default.createElement("tr", {
@@ -33155,6 +33216,25 @@ function formatStartDate(date) {
33155
33216
  return new Intl.DateTimeFormat("en-CA").format(startDate);
33156
33217
  }
33157
33218
 
33219
+ var _path$b;
33220
+
33221
+ function _extends$b() { _extends$b = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
33222
+
33223
+ function SvgDocument(props) {
33224
+ return /*#__PURE__*/React.createElement("svg", _extends$b({
33225
+ xmlns: "http://www.w3.org/2000/svg",
33226
+ className: "plc-h-6 plc-w-6 plc-mr-2",
33227
+ fill: "none",
33228
+ viewBox: "0 0 24 24",
33229
+ stroke: "currentColor"
33230
+ }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
33231
+ strokeLinecap: "round",
33232
+ strokeLinejoin: "round",
33233
+ strokeWidth: 2,
33234
+ d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
33235
+ })));
33236
+ }
33237
+
33158
33238
  const InvoicesMenu = props => {
33159
33239
  const {
33160
33240
  t
@@ -33452,8 +33532,16 @@ const GiftsMenu = props => {
33452
33532
  const {
33453
33533
  t
33454
33534
  } = useTranslation("dashboard");
33535
+ const {
33536
+ switchView,
33537
+ set
33538
+ } = usePelcro();
33455
33539
  const giftRecipients = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.gift_recipients) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
33456
33540
 
33541
+ const setIsRenewingGift = isRenewingGift => set({
33542
+ isRenewingGift
33543
+ });
33544
+
33457
33545
  const renderGiftRecipients = ({
33458
33546
  disableSubmit
33459
33547
  }) => {
@@ -33470,8 +33558,8 @@ const GiftsMenu = props => {
33470
33558
  const plan = window.Pelcro.plan.getById(planId);
33471
33559
  props === null || props === void 0 ? void 0 : props.setProductAndPlan(product, plan);
33472
33560
  props === null || props === void 0 ? void 0 : props.setSubscriptionIdToRenew(recipient.id);
33473
- props === null || props === void 0 ? void 0 : props.setIsRenewingGift(true);
33474
- props === null || props === void 0 ? void 0 : props.setView("plan-select");
33561
+ setIsRenewingGift(true);
33562
+ switchView("plan-select");
33475
33563
  };
33476
33564
 
33477
33565
  return /*#__PURE__*/React__default.createElement("tr", {
@@ -33540,11 +33628,28 @@ const AddressesMenu = props => {
33540
33628
  const {
33541
33629
  t
33542
33630
  } = useTranslation("dashboard");
33631
+ const {
33632
+ switchView,
33633
+ set
33634
+ } = usePelcro();
33543
33635
  const [requestStates, setRequestStates] = useState({
33544
33636
  loading: false,
33545
33637
  success: false,
33546
33638
  failed: false
33547
33639
  });
33640
+
33641
+ const displayAddressCreate = () => {
33642
+ return switchView("address-create");
33643
+ };
33644
+
33645
+ const displayAddressEdit = e => {
33646
+ const address = e.currentTarget.dataset.key;
33647
+ set({
33648
+ addressIdToEdit: address
33649
+ });
33650
+ return switchView("address-edit");
33651
+ };
33652
+
33548
33653
  return /*#__PURE__*/React__default.createElement(Card, {
33549
33654
  id: "pelcro-dashboard-addresses-menu",
33550
33655
  className: "plc-max-w-100% md:plc-max-w-80% plc-m-auto",
@@ -33553,10 +33658,10 @@ const AddressesMenu = props => {
33553
33658
  }, /*#__PURE__*/React__default.createElement(AddressesItems, {
33554
33659
  requestStates: requestStates,
33555
33660
  setRequestStates: setRequestStates,
33556
- displayAddressEdit: props === null || props === void 0 ? void 0 : props.displayAddressEdit
33661
+ displayAddressEdit: displayAddressEdit
33557
33662
  }), /*#__PURE__*/React__default.createElement(AddNew, {
33558
33663
  title: t("labels.addAddress"),
33559
- onClick: () => props === null || props === void 0 ? void 0 : props.displayAddressCreate()
33664
+ onClick: displayAddressCreate
33560
33665
  }));
33561
33666
  };
33562
33667
 
@@ -33610,7 +33715,23 @@ const AddressesItems = props => {
33610
33715
  onClick: props === null || props === void 0 ? void 0 : props.displayAddressEdit
33611
33716
  })));
33612
33717
  };
33613
-
33718
+
33719
+ const SUB_MENUS = {
33720
+ PROFILE: "profile",
33721
+ QRCODE: "qr-code",
33722
+ PASSWORDCHANGE: "passwordChange",
33723
+ SUBSCRIPTIONS: "subscriptions",
33724
+ DONATIONS: "donations",
33725
+ MEMBERSHIPS: "memberships",
33726
+ NEWSLETTERS: "Newsletters",
33727
+ PAYMENT_CARDS: "payment-cards",
33728
+ ADDRESSES: "addresses",
33729
+ GIFTS: "gifts",
33730
+ ORDERS: "orders",
33731
+ INVOICES: "invoices",
33732
+ LOGOUT: "logout",
33733
+ SAVED_ITEMS: "saved-items"
33734
+ };
33614
33735
  const getPaymentCardIcon = name => {
33615
33736
  var _icons$name$toLowerCa;
33616
33737
 
@@ -33653,22 +33774,54 @@ const getPaymentCardIcon = name => {
33653
33774
  d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"
33654
33775
  }));
33655
33776
  };
33777
+ const hasInvoices = () => {
33778
+ var _window$Pelcro$invoic, _window$Pelcro$invoic2;
33779
+
33780
+ const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
33781
+ return invoices.length > 0;
33782
+ };
33783
+ const showNewsletters = () => {
33784
+ var _ref, _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro$uiSett2;
33785
+
33786
+ const showNewslettersUiSettings = (_ref = ((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : (_window$Pelcro$uiSett2 = _window$Pelcro$uiSett.newsletters) === null || _window$Pelcro$uiSett2 === void 0 ? void 0 : _window$Pelcro$uiSett2.length) > 0) !== null && _ref !== void 0 ? _ref : false;
33787
+ return showNewslettersUiSettings;
33788
+ };
33789
+ const hasDonationSubs = () => {
33790
+ var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r, _window$Pelcro$user$r2;
33791
+
33792
+ 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 : [];
33793
+ 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 : [];
33794
+ return donations.length > 0 || canceledDonations.length > 0;
33795
+ };
33796
+ const hasActiveMemberships = () => {
33797
+ var _window$Pelcro$user$r3, _window$Pelcro$user$r4;
33798
+
33799
+ return (_window$Pelcro$user$r3 = (_window$Pelcro$user$r4 = window.Pelcro.user.read().memberships) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.some(membership => membership.status === "active" && membership.subscription.ended_at === null)) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : false;
33800
+ };
33656
33801
 
33657
33802
  const PaymentCardsMenu = props => {
33658
33803
  const {
33659
33804
  t
33660
33805
  } = useTranslation("dashboard");
33806
+ const {
33807
+ switchView
33808
+ } = usePelcro();
33661
33809
  const source = window.Pelcro.user.read().source;
33810
+
33811
+ const displaySourceCreate = () => {
33812
+ return switchView("payment-method-update");
33813
+ };
33814
+
33662
33815
  return /*#__PURE__*/React__default.createElement(Card, {
33663
33816
  id: "pelcro-dashboard-payment-menu",
33664
33817
  className: "plc-max-w-100% md:plc-max-w-80% plc-m-auto",
33665
33818
  title: t("labels.paymentSource")
33666
33819
  }, source ? /*#__PURE__*/React__default.createElement(PaymentCardsItems, {
33667
- displaySourceCreate: props === null || props === void 0 ? void 0 : props.displaySourceCreate,
33820
+ displaySourceCreate: displaySourceCreate,
33668
33821
  source: source
33669
33822
  }) : /*#__PURE__*/React__default.createElement(AddNew, {
33670
33823
  title: t("labels.addCard"),
33671
- onClick: () => props === null || props === void 0 ? void 0 : props.displaySourceCreate()
33824
+ onClick: displaySourceCreate
33672
33825
  }));
33673
33826
  };
33674
33827
 
@@ -35274,652 +35427,928 @@ const NewsLettersItems = ({
35274
35427
  });
35275
35428
  };
35276
35429
 
35277
- const PasswordChangeMenu = () => {
35430
+ const PasswordChangeMenu = () => {
35431
+ const {
35432
+ t
35433
+ } = useTranslation("dashboard");
35434
+ return /*#__PURE__*/React__default.createElement(Card, {
35435
+ id: "pelcro-dashboard-profile-menu",
35436
+ className: "plc-max-w-100% md:plc-max-w-80% plc-m-auto",
35437
+ title: t("labels.changePassword")
35438
+ }, /*#__PURE__*/React__default.createElement(PasswordChangeView, null));
35439
+ };
35440
+
35441
+ const DashboardContent = props => {
35442
+ var _window$Pelcro$user$r, _window$Pelcro, _window$Pelcro$uiSett, _props$children;
35443
+
35444
+ const {
35445
+ state: {
35446
+ isOpen,
35447
+ activeDashboardLink,
35448
+ disableSubmit
35449
+ },
35450
+ dispatch
35451
+ } = useContext(store$4);
35452
+ const {
35453
+ switchView,
35454
+ set,
35455
+ logout
35456
+ } = usePelcro();
35457
+ const {
35458
+ t
35459
+ } = useTranslation("dashboard");
35460
+ const menuRef = useRef(null);
35461
+ const user = window.Pelcro.user.read();
35462
+ const userHasName = user.first_name || user.last_name;
35463
+ const profilePicture = (_window$Pelcro$user$r = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : userSolidIcon;
35464
+ const newsletters = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.newsletters;
35465
+ Array.isArray(newsletters) && newsletters.length > 0;
35466
+
35467
+ const initializeHideMenuHandler = () => {
35468
+ document.addEventListener("click", hideMenuIfClickedOutside);
35469
+ };
35470
+
35471
+ const hideMenuIfClickedOutside = event => {
35472
+ const dashboardSubmenus = document.getElementById("pelcro-view-dashboard-submenus");
35473
+ const didClickOutsideMenu = isOpen && menuRef.current && !menuRef.current.contains(event.target) && !(dashboardSubmenus !== null && dashboardSubmenus !== void 0 && dashboardSubmenus.contains(event.target));
35474
+
35475
+ if (didClickOutsideMenu) {
35476
+ dispatch({
35477
+ type: CLOSE_DASHBOARD
35478
+ });
35479
+ }
35480
+ };
35481
+
35482
+ const setActiveDashboardLink = submenuName => {
35483
+ dispatch({
35484
+ type: SET_ACTIVE_DASHBOARD_LINK,
35485
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35486
+ });
35487
+ };
35488
+
35489
+ const displayProfilePicChange = () => {
35490
+ return switchView("profile-picture");
35491
+ };
35492
+
35493
+ const setProductAndPlan = (product, plan, isGift) => {
35494
+ set({
35495
+ product,
35496
+ plan,
35497
+ isGift
35498
+ });
35499
+ };
35500
+
35501
+ const displayProductSelect = ({
35502
+ isGift
35503
+ }) => {
35504
+ if (isGift) {
35505
+ setProductAndPlan(null, null, true);
35506
+ }
35507
+
35508
+ return switchView("plan-select");
35509
+ };
35510
+
35511
+ const getSubscriptionStatusText = subscription => {
35512
+ if (subscription.status === "canceled") {
35513
+ const cancelDate = new Date(subscription.canceled_at);
35514
+ const formattedCancelDate = new Intl.DateTimeFormat("en-CA").format(cancelDate);
35515
+ return `${t("labels.canceledOn")} ${formattedCancelDate}`;
35516
+ }
35517
+
35518
+ if (subscription.status === "incomplete") {
35519
+ return `${t("labels.status.incomplete")}`;
35520
+ }
35521
+
35522
+ if (subscription.status === "extended") {
35523
+ // DateTime from BE is missing 3 zeros so we add them before instancing a date
35524
+ const expiryDate = new Date(Number(`${subscription.end_date}000`));
35525
+ const formattedExpiryDate = new Intl.DateTimeFormat("en-CA").format(expiryDate);
35526
+ return `${t("labels.until")} ${formattedExpiryDate}`;
35527
+ }
35528
+
35529
+ if (subscription.cancel_at_period_end) {
35530
+ // DateTime from BE is missing 3 zeros so we add them before instancing a date
35531
+ const expiryDate = new Date(Number(`${subscription.expires_at}000`));
35532
+ const formattedExpiryDate = new Intl.DateTimeFormat("en-CA").format(expiryDate);
35533
+ return `${t("labels.expiresOn")} ${formattedExpiryDate}`;
35534
+ }
35535
+
35536
+ const renewDate = new Date(Number(`${subscription.renews_at}000`));
35537
+ const formattedRenewDate = new Intl.DateTimeFormat("en-CA").format(renewDate);
35538
+ return `${t("labels.renewsOn")} ${formattedRenewDate}`;
35539
+ };
35540
+
35541
+ const getSubscriptionStatus = sub => {
35542
+ const isSubscriptionEndingSoon = sub => {
35543
+ const weekFromNow = new Date().getTime() + 7 * 24 * 60 * 60 * 1000;
35544
+ const endingAt = new Date(sub.expires_at * 1000).getTime();
35545
+ return weekFromNow > endingAt && sub.cancel_at_period_end;
35546
+ };
35547
+
35548
+ const isSubscriptionInTrial = sub => {
35549
+ if (!sub.trial_end) {
35550
+ return;
35551
+ }
35552
+
35553
+ const now = new Date().getTime();
35554
+ const trialEndDate = new Date(sub.trial_end).getTime();
35555
+ return now < trialEndDate;
35556
+ };
35557
+
35558
+ if (isSubscriptionEndingSoon(sub)) {
35559
+ return {
35560
+ title: t("labels.status.endingSoon"),
35561
+ content: getSubscriptionStatusText(sub),
35562
+ textColor: "plc-text-orange-700",
35563
+ bgColor: "plc-bg-orange-100",
35564
+ icon: /*#__PURE__*/React__default.createElement(SvgExclamation, null)
35565
+ };
35566
+ }
35567
+
35568
+ if (isSubscriptionInTrial(sub)) {
35569
+ return {
35570
+ title: t("labels.status.inTrial"),
35571
+ content: getSubscriptionStatusText(sub),
35572
+ textColor: "plc-text-yellow-700",
35573
+ bgColor: "plc-bg-yellow-100",
35574
+ icon: /*#__PURE__*/React__default.createElement(SvgCheckMark, null)
35575
+ };
35576
+ }
35577
+
35578
+ if (sub.status === "incomplete") {
35579
+ return {
35580
+ title: t("labels.status.incomplete"),
35581
+ content: getSubscriptionStatusText(sub),
35582
+ textColor: "plc-text-orange-700",
35583
+ bgColor: "plc-bg-orange-100",
35584
+ icon: /*#__PURE__*/React__default.createElement(SvgExclamation, null)
35585
+ };
35586
+ }
35587
+
35588
+ if (sub.status === "canceled") {
35589
+ return {
35590
+ title: t("labels.status.canceled"),
35591
+ content: getSubscriptionStatusText(sub),
35592
+ textColor: "plc-text-red-700",
35593
+ bgColor: "plc-bg-red-100",
35594
+ icon: /*#__PURE__*/React__default.createElement(SvgExclamation, null)
35595
+ };
35596
+ }
35597
+
35598
+ return {
35599
+ title: t("labels.status.active"),
35600
+ content: getSubscriptionStatusText(sub),
35601
+ textColor: "plc-text-green-700",
35602
+ bgColor: "plc-bg-green-100",
35603
+ icon: /*#__PURE__*/React__default.createElement(SvgCheckMark, null)
35604
+ };
35605
+ };
35606
+
35607
+ const setSubscriptionIdToRenew = subscriptionIdToRenew => {
35608
+ set({
35609
+ subscriptionIdToRenew
35610
+ });
35611
+ };
35612
+
35613
+ const closeDashboard = () => {
35614
+ dispatch({
35615
+ type: CLOSE_DASHBOARD
35616
+ });
35617
+ };
35618
+
35619
+ useEffect(() => {
35620
+ return () => {
35621
+ document.removeEventListener("click", hideMenuIfClickedOutside);
35622
+ };
35623
+ }, []);
35624
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Transition, {
35625
+ className: "plc-fixed plc-inset-y-0 plc-left-0 plc-h-full lg:plc-w-3/12 plc-w-full plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max",
35626
+ show: isOpen,
35627
+ enter: "plc-transform plc-transition plc-duration-500",
35628
+ enterFrom: "plc--translate-x-full",
35629
+ enterTo: "plc-translate-x-0",
35630
+ afterEnter: initializeHideMenuHandler,
35631
+ leave: "plc-transform plc-transition plc-duration-500",
35632
+ leaveFrom: "plc-translate-x-0",
35633
+ leaveTo: "plc--translate-x-full",
35634
+ afterLeave: props === null || props === void 0 ? void 0 : props.onClose
35635
+ }, /*#__PURE__*/React__default.createElement("div", {
35636
+ id: "pelcro-view-dashboard",
35637
+ ref: menuRef
35638
+ }, /*#__PURE__*/React__default.createElement("header", {
35639
+ className: "plc-bg-gray-200 plc-flex plc-py-5"
35640
+ }, /*#__PURE__*/React__default.createElement("div", {
35641
+ className: "plc-flex plc-items-center"
35642
+ }, /*#__PURE__*/React__default.createElement("div", {
35643
+ className: "plc-flex plc-justify-center plc-ml-3 sm:plc-ml-6 plc-flex-shrink-0"
35644
+ }, /*#__PURE__*/React__default.createElement("div", {
35645
+ className: "plc-relative plc-flex-shrink-0"
35646
+ }, /*#__PURE__*/React__default.createElement("img", {
35647
+ className: "pelcro-user-profile-picture plc-bg-gray-300 plc-cursor-pointer plc-h-10 plc-rounded-md plc-w-10",
35648
+ src: profilePicture,
35649
+ alt: "profile picture",
35650
+ onClick: displayProfilePicChange
35651
+ }))), /*#__PURE__*/React__default.createElement("div", {
35652
+ 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"
35653
+ }, userHasName && /*#__PURE__*/React__default.createElement("p", {
35654
+ className: "plc-font-bold plc-break-all"
35655
+ }, user.first_name, " ", user.last_name), /*#__PURE__*/React__default.createElement("p", {
35656
+ className: `plc-m-0 plc-text-sm plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
35657
+ }, user.email)), /*#__PURE__*/React__default.createElement("div", {
35658
+ className: "lg:plc-hidden"
35659
+ }, /*#__PURE__*/React__default.createElement(Button, {
35660
+ variant: "ghost",
35661
+ type: "button",
35662
+ className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-5 plc-right-10",
35663
+ onClick: closeDashboard
35664
+ }, /*#__PURE__*/React__default.createElement(SvgXIcon, {
35665
+ className: "plc-fill-current"
35666
+ }))))), /*#__PURE__*/React__default.createElement("section", {
35667
+ className: "plc-mt-6 plc-shadow-sm"
35668
+ }, props !== null && props !== void 0 && (_props$children = props.children) !== null && _props$children !== void 0 && _props$children.length ? props === null || props === void 0 ? void 0 : props.children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
35669
+ store: store$4,
35670
+ key: i
35671
+ })) : /*#__PURE__*/React__default.cloneElement(props === null || props === void 0 ? void 0 : props.children, {
35672
+ store: store$4
35673
+ })), /*#__PURE__*/React__default.createElement(DashboardLink, {
35674
+ name: SUB_MENUS.LOGOUT,
35675
+ icon: /*#__PURE__*/React__default.createElement(SvgExit, null),
35676
+ title: t("labels.logout"),
35677
+ setActiveDashboardLink: setActiveDashboardLink,
35678
+ activeDashboardLink: activeDashboardLink
35679
+ }))), activeDashboardLink && isOpen && /*#__PURE__*/React__default.createElement("div", {
35680
+ id: "pelcro-view-dashboard-submenus",
35681
+ className: "plc-fixed plc-inset-y-0 plc-right-0 plc-h-full lg:plc-w-9/12 plc-w-full plc-bg-gray-100 plc-z-max plc-overflow-auto"
35682
+ }, activeDashboardLink === SUB_MENUS.PROFILE && /*#__PURE__*/React__default.createElement(ProfileMenu, null), activeDashboardLink === SUB_MENUS.QRCODE && /*#__PURE__*/React__default.createElement(QRCodeMenu, null), activeDashboardLink === SUB_MENUS.PASSWORDCHANGE && /*#__PURE__*/React__default.createElement(PasswordChangeMenu, null), activeDashboardLink === SUB_MENUS.SAVED_ITEMS && /*#__PURE__*/React__default.createElement(SavedItemsMenu, null), activeDashboardLink === SUB_MENUS.PAYMENT_CARDS && /*#__PURE__*/React__default.createElement(PaymentCardsMenu, null), activeDashboardLink === SUB_MENUS.ADDRESSES && /*#__PURE__*/React__default.createElement(AddressesMenu, null), activeDashboardLink === SUB_MENUS.SUBSCRIPTIONS && /*#__PURE__*/React__default.createElement(SubscriptionsMenu, {
35683
+ displayProductSelect: displayProductSelect,
35684
+ setProductAndPlan: setProductAndPlan,
35685
+ setSubscriptionIdToRenew: setSubscriptionIdToRenew,
35686
+ getSubscriptionStatus: getSubscriptionStatus
35687
+ }), activeDashboardLink === SUB_MENUS.MEMBERSHIPS && /*#__PURE__*/React__default.createElement(MembershipsMenu, {
35688
+ getSubscriptionStatus: getSubscriptionStatus
35689
+ }), activeDashboardLink === SUB_MENUS.NEWSLETTERS && /*#__PURE__*/React__default.createElement(NewslettersMenu, null), activeDashboardLink === SUB_MENUS.DONATIONS && /*#__PURE__*/React__default.createElement(DonationsMenu, {
35690
+ getSubscriptionStatus: getSubscriptionStatus
35691
+ }), activeDashboardLink === SUB_MENUS.GIFTS && /*#__PURE__*/React__default.createElement(GiftsMenu, {
35692
+ getSubscriptionStatus: getSubscriptionStatus,
35693
+ displayProductSelect: displayProductSelect,
35694
+ setProductAndPlan: setProductAndPlan,
35695
+ setSubscriptionIdToRenew: setSubscriptionIdToRenew,
35696
+ disableSubmit: disableSubmit
35697
+ }), activeDashboardLink === SUB_MENUS.ORDERS && /*#__PURE__*/React__default.createElement(OrdersMenu, null), activeDashboardLink === SUB_MENUS.INVOICES && /*#__PURE__*/React__default.createElement(InvoicesMenu, null), activeDashboardLink === SUB_MENUS.LOGOUT && logout(), /*#__PURE__*/React__default.createElement(Button, {
35698
+ variant: "ghost",
35699
+ type: "button",
35700
+ className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-2 plc-right-2 md:plc-top-5 md:plc-right-10",
35701
+ onClick: closeDashboard
35702
+ }, /*#__PURE__*/React__default.createElement(SvgXIcon, {
35703
+ className: "plc-fill-current"
35704
+ }))));
35705
+ };
35706
+
35707
+ const DashboardHeading = ({
35708
+ title
35709
+ }) => {
35710
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title && /*#__PURE__*/React__default.createElement("header", {
35711
+ className: "plc-pl-4 plc-my-2 sm:plc-pl-8"
35712
+ }, /*#__PURE__*/React__default.createElement("p", {
35713
+ className: "plc-font-bold plc-tracking-widest plc-text-gray-500"
35714
+ }, title)));
35715
+ };
35716
+
35717
+ var _path$a;
35718
+
35719
+ function _extends$a() { _extends$a = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
35720
+
35721
+ function SvgUser(props) {
35722
+ return /*#__PURE__*/React.createElement("svg", _extends$a({
35723
+ xmlns: "http://www.w3.org/2000/svg",
35724
+ fill: "none",
35725
+ viewBox: "0 0 24 24",
35726
+ stroke: "currentColor"
35727
+ }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
35728
+ strokeLinecap: "round",
35729
+ strokeLinejoin: "round",
35730
+ strokeWidth: 2,
35731
+ d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zm-4 7a7 7 0 00-7 7h14a7 7 0 00-7-7z"
35732
+ })));
35733
+ }
35734
+
35735
+ const DashboardProfile = ({
35736
+ title,
35737
+ icon,
35738
+ store
35739
+ }) => {
35740
+ const {
35741
+ state: {
35742
+ activeDashboardLink
35743
+ },
35744
+ dispatch
35745
+ } = useContext(store);
35746
+ const {
35747
+ t
35748
+ } = useTranslation("dashboard");
35749
+
35750
+ const setActiveDashboardLink = submenuName => {
35751
+ dispatch({
35752
+ type: SET_ACTIVE_DASHBOARD_LINK,
35753
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35754
+ });
35755
+ };
35756
+
35757
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
35758
+ name: SUB_MENUS.PROFILE,
35759
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgUser, {
35760
+ className: "plc-w-6 plc-h-6 plc-mr-2"
35761
+ }),
35762
+ title: title !== null && title !== void 0 ? title : t("labels.profile"),
35763
+ setActiveDashboardLink: setActiveDashboardLink,
35764
+ activeDashboardLink: activeDashboardLink
35765
+ });
35766
+ };
35767
+
35768
+ var _path$9;
35769
+
35770
+ function _extends$9() { _extends$9 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
35771
+
35772
+ function SvgQrcode(props) {
35773
+ return /*#__PURE__*/React.createElement("svg", _extends$9({
35774
+ xmlns: "http://www.w3.org/2000/svg",
35775
+ width: 682.667,
35776
+ height: 682.667,
35777
+ viewBox: "0 0 512 512"
35778
+ }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
35779
+ d: "M93.5 62.4c-15.7 3.9-28 16.6-31.4 32.4-.7 3.3-1.1 17.2-1.1 36.4 0 29.1.1 31.4 2 35.3 5.3 11 21.2 11.1 26.4.1 1.4-2.9 1.6-7.9 1.6-34.6 0-34.4.1-35.3 6.3-39 3-1.9 5.2-2 34.5-2 26.9 0 31.9-.2 34.8-1.6 11-5.2 10.9-21.1-.1-26.4-3.9-1.9-6.1-2-36.1-1.9-21.8 0-33.5.5-36.9 1.3zM345.4 63c-10.9 5.4-10.9 21.2 0 26.4 2.9 1.4 7.9 1.6 34.8 1.6 29.3 0 31.5.1 34.5 2 6.2 3.7 6.3 4.6 6.3 39 0 26.7.2 31.7 1.6 34.6 5.2 11 21.1 10.9 26.4-.1 1.9-3.9 2-6.2 2-35.3 0-19.2-.4-33.1-1.1-36.4-3.5-16.2-16.5-29.2-32.7-32.7-3.3-.7-17.2-1.1-36.5-1.1-29.3 0-31.5.1-35.3 2zM146 128.9c-6.9 2.1-12.1 6.5-15.6 13.1-1.8 3.2-1.9 6.3-1.9 38.5 0 34.2 0 35.1 2.2 39.1 2.8 5.3 9.1 10.7 14.2 12.2 2.5.8 14.4 1.2 35.8 1.2 36.3 0 38.3-.3 45.2-7.2 6.8-6.9 7.1-8.9 7.1-45.1 0-22.2-.4-33.2-1.2-36.1-1.8-6-10-13.9-16-15.4-5.3-1.3-65.5-1.6-69.8-.3zm57 51.6V203h-45v-45h45v22.5zM297 128.9c-8 2.5-14.9 9.2-16.9 16.4-.9 2.9-1.1 14.3-.9 37.7.3 37.2.2 36.2 7.4 43.3 6.6 6.4 8.8 6.7 45 6.7 35.6 0 38-.3 44.2-6.3 1.9-1.8 4.3-5 5.5-7.2 2.1-3.9 2.2-5 2.2-39s-.1-35.1-2.2-39c-2.5-4.7-6.4-8.5-11.3-11.1-3.2-1.7-6.4-1.9-37-2.1-18.4-.1-34.6.2-36 .6zm57 51.6V203h-45v-45h45v22.5zM144.1 280.3c-4.8 1.8-10.8 7.2-13.4 12-2.2 4.1-2.2 4.9-2.2 39.2 0 34 .1 35.1 2.2 39 2.5 4.7 6.4 8.5 11.3 11.1 3.2 1.7 6.6 1.9 35.5 2.2 38.9.4 40.7.2 48-7.2 3.2-3.2 5.5-6.6 6.3-9.2.8-2.9 1.2-13.9 1.2-36.1 0-35.8-.4-38.3-6.6-44.7-7-7.2-6-7.1-44.4-7.3-25.4-.1-35.4.1-37.9 1zm58.9 51.2V354h-45v-45h45v22.5zM294.8 280.4c-6.8 2.4-12.9 8.9-14.8 15.7-1.5 5-1.3 66.2.2 71 1.5 5.1 6.9 11.4 12.2 14.2 4 2.2 4.9 2.2 39.1 2.2 32.2 0 35.3-.1 38.5-1.9 4.9-2.6 8.8-6.4 11.3-11.1 2.1-3.9 2.2-5 2.2-39s-.1-35.1-2.2-39c-3-5.6-8-10.1-13.2-12-5.9-2-67.5-2.2-73.3-.1zm59.2 51.1V354h-45v-45h45v22.5zM68.7 339.2c-2.2 1.3-4.5 3.8-5.7 6.3-1.9 3.9-2 6.2-2 35.3 0 19.2.4 33.1 1.1 36.4 3.4 16.1 16.6 29.3 32.7 32.7 3.3.7 17.2 1.1 36.4 1.1 29.1 0 31.4-.1 35.3-2 11-5.3 11.1-21.2.1-26.4-2.9-1.4-7.9-1.6-34.6-1.6-34.4 0-35.3-.1-39-6.3-1.9-3-2-5.2-2-34.5 0-26.9-.2-31.9-1.6-34.8-3.6-7.5-13.5-10.5-20.7-6.2zM429.2 338.7c-1.8.9-4.3 3-5.5 4.7-2.1 3-2.2 4-2.7 36.1-.5 35.8-.6 36.1-6.3 39.5-3 1.9-5.3 2-34.5 2-34.5 0-36.1.2-40.2 6-5.4 7.5-2.8 18 5.5 22 3.9 1.9 6.2 2 35.3 2 19.2 0 33.1-.4 36.4-1.1 16.2-3.5 29.2-16.5 32.7-32.7.7-3.3 1.1-17.2 1.1-36.4 0-29.1-.1-31.4-2-35.3-3.6-7.4-12.5-10.4-19.8-6.8z"
35780
+ })));
35781
+ }
35782
+
35783
+ const DashboardQRCode = ({
35784
+ title,
35785
+ icon,
35786
+ store
35787
+ }) => {
35788
+ const {
35789
+ state: {
35790
+ activeDashboardLink
35791
+ },
35792
+ dispatch
35793
+ } = useContext(store);
35794
+ useTranslation("dashboard");
35795
+
35796
+ const setActiveDashboardLink = submenuName => {
35797
+ dispatch({
35798
+ type: SET_ACTIVE_DASHBOARD_LINK,
35799
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35800
+ });
35801
+ };
35802
+
35803
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
35804
+ name: SUB_MENUS.QRCODE,
35805
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgQrcode, {
35806
+ className: "plc-w-6 plc-h-6 plc-mr-2"
35807
+ }),
35808
+ title: title !== null && title !== void 0 ? title : "My QR code",
35809
+ setActiveDashboardLink: setActiveDashboardLink,
35810
+ activeDashboardLink: activeDashboardLink
35811
+ });
35812
+ };
35813
+
35814
+ var _path$8;
35815
+
35816
+ function _extends$8() { _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
35817
+
35818
+ function SvgKey(props) {
35819
+ return /*#__PURE__*/React.createElement("svg", _extends$8({
35820
+ xmlns: "http://www.w3.org/2000/svg",
35821
+ viewBox: "0 0 20 20",
35822
+ fill: "currentColor"
35823
+ }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
35824
+ fillRule: "evenodd",
35825
+ d: "M18 8a6 6 0 01-7.743 5.743L10 14l-1 1-1 1H6v2H2v-4l4.257-4.257A6 6 0 1118 8zm-6-4a1 1 0 100 2 2 2 0 012 2 1 1 0 102 0 4 4 0 00-4-4z",
35826
+ clipRule: "evenodd"
35827
+ })));
35828
+ }
35829
+
35830
+ const DashboardPasswordChange = ({
35831
+ title,
35832
+ icon,
35833
+ store
35834
+ }) => {
35835
+ const {
35836
+ state: {
35837
+ activeDashboardLink
35838
+ },
35839
+ dispatch
35840
+ } = useContext(store);
35278
35841
  const {
35279
35842
  t
35280
35843
  } = useTranslation("dashboard");
35281
- return /*#__PURE__*/React__default.createElement(Card, {
35282
- id: "pelcro-dashboard-profile-menu",
35283
- className: "plc-max-w-100% md:plc-max-w-80% plc-m-auto",
35284
- title: t("labels.changePassword")
35285
- }, /*#__PURE__*/React__default.createElement(PasswordChangeView, null));
35286
- };
35287
35844
 
35288
- const SUB_MENUS = {
35289
- PROFILE: "profile",
35290
- QRCODE: "qr-code",
35291
- PASSWORDCHANGE: "passwordChange",
35292
- SUBSCRIPTIONS: "subscriptions",
35293
- DONATIONS: "donations",
35294
- MEMBERSHIPS: "memberships",
35295
- NEWSLETTERS: "Newsletters",
35296
- PAYMENT_CARDS: "payment-cards",
35297
- ADDRESSES: "addresses",
35298
- GIFTS: "gifts",
35299
- ORDERS: "orders",
35300
- INVOICES: "invoices",
35301
- LOGOUT: "logout",
35302
- SAVED_ITEMS: "saved-items"
35845
+ const setActiveDashboardLink = submenuName => {
35846
+ dispatch({
35847
+ type: SET_ACTIVE_DASHBOARD_LINK,
35848
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35849
+ });
35850
+ };
35851
+
35852
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
35853
+ name: SUB_MENUS.PASSWORDCHANGE,
35854
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgKey, {
35855
+ className: "plc-w-6 plc-h-6 plc-mr-2"
35856
+ }),
35857
+ title: title !== null && title !== void 0 ? title : t("labels.changePassword"),
35858
+ setActiveDashboardLink: setActiveDashboardLink,
35859
+ activeDashboardLink: activeDashboardLink
35860
+ });
35303
35861
  };
35304
- /**
35305
- *
35306
- */
35307
35862
 
35308
- function DashboardWithHook(props) {
35309
- React__default.useEffect(() => {
35310
- var _props$onDisplay;
35863
+ var _path$7;
35311
35864
 
35312
- (_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
35313
- }, []);
35314
- const {
35315
- switchView,
35316
- resetView,
35317
- logout,
35318
- set
35319
- } = usePelcro();
35320
- return /*#__PURE__*/React__default.createElement(DashboardWithTrans, {
35321
- setAddress: addressIdToEdit => set({
35322
- addressIdToEdit
35323
- }),
35324
- setSubscriptionIdToRenew: subscriptionIdToRenew => set({
35325
- subscriptionIdToRenew
35326
- }),
35327
- setIsRenewingGift: isRenewingGift => set({
35328
- isRenewingGift
35329
- }),
35330
- onClose: () => {
35331
- var _props$onClose;
35865
+ function _extends$7() { _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
35332
35866
 
35333
- (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
35334
- resetView();
35335
- },
35336
- logout: logout,
35337
- setView: switchView,
35338
- setProductAndPlan: (product, plan, isGift) => set({
35339
- product,
35340
- plan,
35341
- isGift
35342
- })
35343
- });
35867
+ function SvgBookmark(props) {
35868
+ return /*#__PURE__*/React.createElement("svg", _extends$7({
35869
+ className: "plc-w-6 plc-h-6 plc-mr-2",
35870
+ xmlns: "http://www.w3.org/2000/svg",
35871
+ fill: "none",
35872
+ viewBox: "0 0 24 24",
35873
+ stroke: "currentColor"
35874
+ }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
35875
+ strokeLinecap: "round",
35876
+ strokeLinejoin: "round",
35877
+ strokeWidth: 2,
35878
+ d: "M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"
35879
+ })));
35344
35880
  }
35345
- DashboardWithHook.viewId = "dashboard";
35346
35881
 
35347
- class Dashboard extends Component {
35348
- constructor(props) {
35349
- var _window$Pelcro$user$r, _window$Pelcro$user$r2;
35882
+ const DashboardSavedItems = ({
35883
+ title,
35884
+ icon,
35885
+ store
35886
+ }) => {
35887
+ const {
35888
+ state: {
35889
+ activeDashboardLink
35890
+ },
35891
+ dispatch
35892
+ } = useContext(store);
35893
+ const {
35894
+ t
35895
+ } = useTranslation("dashboard");
35350
35896
 
35351
- super(props);
35897
+ const setActiveDashboardLink = submenuName => {
35898
+ dispatch({
35899
+ type: SET_ACTIVE_DASHBOARD_LINK,
35900
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35901
+ });
35902
+ };
35352
35903
 
35353
- _defineProperty$3(this, "componentDidMount", () => {
35354
- var _ReactGA$event;
35904
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
35905
+ name: SUB_MENUS.SAVED_ITEMS,
35906
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgBookmark, null),
35907
+ title: title !== null && title !== void 0 ? title : t("labels.savedItems.label"),
35908
+ setActiveDashboardLink: setActiveDashboardLink,
35909
+ activeDashboardLink: activeDashboardLink
35910
+ });
35911
+ };
35355
35912
 
35356
- this.setState({
35357
- isOpen: true
35358
- });
35359
- window.Pelcro.insight.track("Modal Displayed", {
35360
- name: "dashboard"
35361
- });
35362
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
35363
- category: "VIEWS",
35364
- action: "Dashboard Modal Viewed",
35365
- nonInteraction: true
35366
- });
35367
- const {
35368
- addresses
35369
- } = window.Pelcro.user.read();
35370
- if (addresses) this.setState({
35371
- addresses: addresses
35372
- });
35373
- });
35913
+ var _path$6;
35374
35914
 
35375
- _defineProperty$3(this, "componentWillUnmount", () => {
35376
- document.removeEventListener("click", this.hideMenuIfClickedOutside);
35377
- });
35915
+ function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
35378
35916
 
35379
- _defineProperty$3(this, "initializeHideMenuHandler", () => {
35380
- document.addEventListener("click", this.hideMenuIfClickedOutside);
35381
- });
35917
+ function SvgPaymentCard(props) {
35918
+ return /*#__PURE__*/React.createElement("svg", _extends$6({
35919
+ className: "plc-w-6 plc-h-6 plc-mr-2",
35920
+ xmlns: "http://www.w3.org/2000/svg",
35921
+ fill: "none",
35922
+ viewBox: "0 0 24 24",
35923
+ stroke: "currentColor"
35924
+ }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
35925
+ strokeLinecap: "round",
35926
+ strokeLinejoin: "round",
35927
+ strokeWidth: 2,
35928
+ d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"
35929
+ })));
35930
+ }
35382
35931
 
35383
- _defineProperty$3(this, "hideMenuIfClickedOutside", event => {
35384
- const dashboardSubmenus = document.getElementById("pelcro-view-dashboard-submenus");
35385
- const didClickOutsideMenu = this.state.isOpen && this.menuRef.current && !this.menuRef.current.contains(event.target) && !(dashboardSubmenus !== null && dashboardSubmenus !== void 0 && dashboardSubmenus.contains(event.target));
35932
+ const DashboardPaymentCards = ({
35933
+ title,
35934
+ icon,
35935
+ store
35936
+ }) => {
35937
+ const {
35938
+ state: {
35939
+ activeDashboardLink
35940
+ },
35941
+ dispatch
35942
+ } = useContext(store);
35943
+ const {
35944
+ t
35945
+ } = useTranslation("dashboard");
35386
35946
 
35387
- if (didClickOutsideMenu) {
35388
- this.setState({
35389
- isOpen: false,
35390
- activeDashboardLink: null
35391
- });
35392
- }
35947
+ const setActiveDashboardLink = submenuName => {
35948
+ dispatch({
35949
+ type: SET_ACTIVE_DASHBOARD_LINK,
35950
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35393
35951
  });
35952
+ };
35394
35953
 
35395
- _defineProperty$3(this, "setActiveDashboardLink", submenuName => {
35396
- this.setState({
35397
- activeDashboardLink: submenuName !== null && submenuName !== void 0 ? submenuName : null
35398
- });
35399
- });
35954
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
35955
+ name: SUB_MENUS.PAYMENT_CARDS,
35956
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgPaymentCard, null),
35957
+ title: title !== null && title !== void 0 ? title : t("labels.paymentSource"),
35958
+ setActiveDashboardLink: setActiveDashboardLink,
35959
+ activeDashboardLink: activeDashboardLink
35960
+ });
35961
+ };
35400
35962
 
35401
- _defineProperty$3(this, "cancelSubscription", (subscription_id, onSuccess, onFailure) => {
35402
- // disable the Login button to prevent repeated clicks
35403
- window.Pelcro.subscription.cancel({
35404
- auth_token: window.Pelcro.user.read().auth_token,
35405
- subscription_id: subscription_id
35406
- }, (err, res) => {
35407
- var _ReactGA$event2;
35963
+ var _path$5, _path2;
35408
35964
 
35409
- if (err) {
35410
- return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
35411
- }
35965
+ function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
35412
35966
 
35413
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
35414
- category: "ACTIONS",
35415
- action: "Canceled",
35416
- nonInteraction: true
35417
- });
35418
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
35419
- });
35967
+ function SvgLocationPin(props) {
35968
+ return /*#__PURE__*/React.createElement("svg", _extends$5({
35969
+ className: "plc-w-6 plc-h-6 plc-mr-2",
35970
+ xmlns: "http://www.w3.org/2000/svg",
35971
+ fill: "none",
35972
+ viewBox: "0 0 24 24",
35973
+ stroke: "currentColor"
35974
+ }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
35975
+ strokeLinecap: "round",
35976
+ strokeLinejoin: "round",
35977
+ strokeWidth: 2,
35978
+ d: "M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"
35979
+ })), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
35980
+ strokeLinecap: "round",
35981
+ strokeLinejoin: "round",
35982
+ strokeWidth: 2,
35983
+ d: "M15 11a3 3 0 11-6 0 3 3 0 016 0z"
35984
+ })));
35985
+ }
35986
+
35987
+ const DashboardAddresses = ({
35988
+ title,
35989
+ icon,
35990
+ store
35991
+ }) => {
35992
+ const {
35993
+ state: {
35994
+ activeDashboardLink
35995
+ },
35996
+ dispatch
35997
+ } = useContext(store);
35998
+ const {
35999
+ t
36000
+ } = useTranslation("dashboard");
36001
+
36002
+ const setActiveDashboardLink = submenuName => {
36003
+ dispatch({
36004
+ type: SET_ACTIVE_DASHBOARD_LINK,
36005
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35420
36006
  });
36007
+ };
35421
36008
 
35422
- _defineProperty$3(this, "unSuspendSubscription", (subscription_id, onSuccess, onFailure) => {
35423
- window.Pelcro.subscription.update({
35424
- auth_token: window.Pelcro.user.read().auth_token,
35425
- subscription_id: subscription_id,
35426
- suspend: 0
35427
- }, (err, res) => {
35428
- var _ReactGA$event3;
36009
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
36010
+ name: SUB_MENUS.ADDRESSES,
36011
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgLocationPin, null),
36012
+ title: title !== null && title !== void 0 ? title : t("labels.addresses"),
36013
+ setActiveDashboardLink: setActiveDashboardLink,
36014
+ activeDashboardLink: activeDashboardLink
36015
+ });
36016
+ };
35429
36017
 
35430
- if (err) {
35431
- return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
35432
- }
36018
+ const DashboardSubscriptions = ({
36019
+ title,
36020
+ icon,
36021
+ store
36022
+ }) => {
36023
+ const {
36024
+ state: {
36025
+ activeDashboardLink
36026
+ },
36027
+ dispatch
36028
+ } = useContext(store);
36029
+ const {
36030
+ t
36031
+ } = useTranslation("dashboard");
35433
36032
 
35434
- ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
35435
- category: "ACTIONS",
35436
- action: "UnSuspended",
35437
- nonInteraction: true
35438
- });
35439
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
35440
- });
36033
+ const setActiveDashboardLink = submenuName => {
36034
+ dispatch({
36035
+ type: SET_ACTIVE_DASHBOARD_LINK,
36036
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35441
36037
  });
36038
+ };
35442
36039
 
35443
- _defineProperty$3(this, "displayRedeem", () => {
35444
- return this.props.setView("gift-redeem");
35445
- });
36040
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
36041
+ name: SUB_MENUS.SUBSCRIPTIONS,
36042
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgSubscription, {
36043
+ className: "plc-w-10 plc-h-10 plc-pt-2 plc-pr-1 plc--ml-2"
36044
+ }),
36045
+ title: title !== null && title !== void 0 ? title : t("labels.subscriptions"),
36046
+ setActiveDashboardLink: setActiveDashboardLink,
36047
+ activeDashboardLink: activeDashboardLink
36048
+ });
36049
+ };
35446
36050
 
35447
- _defineProperty$3(this, "displaySourceCreate", () => {
35448
- return this.props.setView("payment-method-update");
35449
- });
36051
+ var _path$4;
35450
36052
 
35451
- _defineProperty$3(this, "displayUserEdit", () => {
35452
- return this.props.setView("user-edit");
35453
- });
36053
+ function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
36054
+
36055
+ function SvgNewsletter(props) {
36056
+ return /*#__PURE__*/React.createElement("svg", _extends$4({
36057
+ xmlns: "http://www.w3.org/2000/svg",
36058
+ className: "plc-h-5 plc-w-5",
36059
+ fill: "none",
36060
+ viewBox: "0 0 24 24",
36061
+ stroke: "currentColor"
36062
+ }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
36063
+ strokeLinecap: "round",
36064
+ strokeLinejoin: "round",
36065
+ strokeWidth: 2,
36066
+ d: "M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"
36067
+ })));
36068
+ }
36069
+
36070
+ const DashboardNewsletters = ({
36071
+ title,
36072
+ icon,
36073
+ store
36074
+ }) => {
36075
+ const {
36076
+ state: {
36077
+ activeDashboardLink
36078
+ },
36079
+ dispatch
36080
+ } = useContext(store);
36081
+ const {
36082
+ t
36083
+ } = useTranslation("dashboard");
35454
36084
 
35455
- _defineProperty$3(this, "displayChangePassword", () => {
35456
- return this.props.setView("password-change");
36085
+ const setActiveDashboardLink = submenuName => {
36086
+ dispatch({
36087
+ type: SET_ACTIVE_DASHBOARD_LINK,
36088
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35457
36089
  });
36090
+ };
35458
36091
 
35459
- _defineProperty$3(this, "displayNewsletterUpdate", () => {
35460
- return this.props.setView("newsletter-update");
35461
- });
36092
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
36093
+ show: showNewsletters(),
36094
+ name: SUB_MENUS.NEWSLETTERS,
36095
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgNewsletter, {
36096
+ className: "plc-transform plc--translate-x-1 plc-scale-105 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
36097
+ }),
36098
+ title: title !== null && title !== void 0 ? title : t("labels.Newsletters"),
36099
+ setActiveDashboardLink: setActiveDashboardLink,
36100
+ activeDashboardLink: activeDashboardLink
36101
+ });
36102
+ };
35462
36103
 
35463
- _defineProperty$3(this, "displayQRCode", () => {
35464
- return this.props.setView("qrcode");
35465
- });
36104
+ var _path$3;
35466
36105
 
35467
- _defineProperty$3(this, "displayProductSelect", ({
35468
- isGift
35469
- }) => {
35470
- if (isGift) {
35471
- this.props.setProductAndPlan(null, null, true);
35472
- }
36106
+ function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
35473
36107
 
35474
- return this.props.setView("plan-select");
35475
- });
36108
+ function SvgMemberships(props) {
36109
+ return /*#__PURE__*/React.createElement("svg", _extends$3({
36110
+ xmlns: "http://www.w3.org/2000/svg",
36111
+ fill: "none",
36112
+ strokeWidth: 1.5,
36113
+ stroke: "currentColor",
36114
+ width: 24,
36115
+ height: 24
36116
+ }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
36117
+ strokeLinecap: "round",
36118
+ strokeLinejoin: "round",
36119
+ d: "M15 9h3.75M15 12h3.75M15 15h3.75M4.5 19.5h15a2.25 2.25 0 002.25-2.25V6.75A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25v10.5A2.25 2.25 0 004.5 19.5zm6-10.125a1.875 1.875 0 11-3.75 0 1.875 1.875 0 013.75 0zm1.294 6.336a6.721 6.721 0 01-3.17.789 6.721 6.721 0 01-3.168-.789 3.376 3.376 0 016.338 0z"
36120
+ })));
36121
+ }
35476
36122
 
35477
- _defineProperty$3(this, "displayAddressCreate", () => {
35478
- return this.props.setView("address-create");
35479
- });
36123
+ const DashboardMemberships = ({
36124
+ title,
36125
+ icon,
36126
+ store
36127
+ }) => {
36128
+ const {
36129
+ state: {
36130
+ activeDashboardLink
36131
+ },
36132
+ dispatch
36133
+ } = useContext(store);
36134
+ const {
36135
+ t
36136
+ } = useTranslation("dashboard");
35480
36137
 
35481
- _defineProperty$3(this, "displayAddressEdit", e => {
35482
- const address = e.currentTarget.dataset.key;
35483
- this.props.setAddress(address);
35484
- return this.props.setView("address-edit");
36138
+ const setActiveDashboardLink = submenuName => {
36139
+ dispatch({
36140
+ type: SET_ACTIVE_DASHBOARD_LINK,
36141
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35485
36142
  });
36143
+ };
35486
36144
 
35487
- _defineProperty$3(this, "displayProfilePicChange", () => {
35488
- return this.props.setView("profile-picture");
35489
- });
36145
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
36146
+ show: hasActiveMemberships(),
36147
+ name: SUB_MENUS.MEMBERSHIPS,
36148
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgMemberships, {
36149
+ className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
36150
+ }),
36151
+ title: title !== null && title !== void 0 ? title : t("labels.memberships"),
36152
+ setActiveDashboardLink: setActiveDashboardLink,
36153
+ activeDashboardLink: activeDashboardLink
36154
+ });
36155
+ };
35490
36156
 
35491
- _defineProperty$3(this, "getSubscriptionStatusText", subscription => {
35492
- if (subscription.status === "canceled") {
35493
- const cancelDate = new Date(subscription.canceled_at);
35494
- const formattedCancelDate = new Intl.DateTimeFormat("en-CA").format(cancelDate);
35495
- return `${this.locale("labels.canceledOn")} ${formattedCancelDate}`;
35496
- }
36157
+ var _path$2;
35497
36158
 
35498
- if (subscription.status === "incomplete") {
35499
- return `${this.locale("labels.status.incomplete")}`;
35500
- }
36159
+ function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
35501
36160
 
35502
- if (subscription.status === "extended") {
35503
- // DateTime from BE is missing 3 zeros so we add them before instancing a date
35504
- const expiryDate = new Date(Number(`${subscription.end_date}000`));
35505
- const formattedExpiryDate = new Intl.DateTimeFormat("en-CA").format(expiryDate);
35506
- return `${this.locale("labels.until")} ${formattedExpiryDate}`;
35507
- }
36161
+ function SvgDonate(props) {
36162
+ return /*#__PURE__*/React.createElement("svg", _extends$2({
36163
+ width: 24,
36164
+ height: 24,
36165
+ fill: "currentColor",
36166
+ xmlns: "http://www.w3.org/2000/svg"
36167
+ }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
36168
+ d: "M4 21h9.62a3.995 3.995 0 003.037-1.397l5.102-5.952a1 1 0 00-.442-1.6l-1.968-.656a3.043 3.043 0 00-2.823.503l-3.185 2.547-.617-1.235A3.98 3.98 0 009.146 11H4c-1.103 0-2 .897-2 2v6c0 1.103.897 2 2 2zm0-8h5.146c.763 0 1.448.423 1.789 1.105l.447.895H7v2h6.014a.996.996 0 00.442-.11l.003-.001.004-.002h.003l.002-.001h.004l.001-.001c.009.003.003-.001.003-.001.01 0 .002-.001.002-.001h.001l.002-.001.003-.001.002-.001.002-.001.003-.001.002-.001c.003 0 .001-.001.002-.001l.003-.002.002-.001.002-.001.003-.001.002-.001h.001l.002-.001h.001l.002-.001.002-.001c.009-.001.003-.001.003-.001l.002-.001a.915.915 0 00.11-.078l4.146-3.317c.262-.208.623-.273.94-.167l.557.186-4.133 4.823a2.029 2.029 0 01-1.52.688H4v-6zM16 2h-.017c-.163.002-1.006.039-1.983.705-.951-.648-1.774-.7-1.968-.704L12.002 2h-.004c-.801 0-1.555.313-2.119.878C9.313 3.445 9 4.198 9 5s.313 1.555.861 2.104l3.414 3.586a1.006 1.006 0 001.45-.001l3.396-3.568C18.688 6.555 19 5.802 19 5s-.313-1.555-.878-2.121A2.978 2.978 0 0016.002 2H16zm1 3c0 .267-.104.518-.311.725L14 8.55l-2.707-2.843C11.104 5.518 11 5.267 11 5s.104-.518.294-.708A.977.977 0 0111.979 4c.025.001.502.032 1.067.485.081.065.163.139.247.222l.707.707.707-.707c.084-.083.166-.157.247-.222.529-.425.976-.478 1.052-.484a.987.987 0 01.701.292c.189.189.293.44.293.707z"
36169
+ })));
36170
+ }
35508
36171
 
35509
- if (subscription.cancel_at_period_end) {
35510
- // DateTime from BE is missing 3 zeros so we add them before instancing a date
35511
- const expiryDate = new Date(Number(`${subscription.expires_at}000`));
35512
- const formattedExpiryDate = new Intl.DateTimeFormat("en-CA").format(expiryDate);
35513
- return `${this.locale("labels.expiresOn")} ${formattedExpiryDate}`;
35514
- }
36172
+ const DashboardDonations = ({
36173
+ title,
36174
+ icon,
36175
+ store
36176
+ }) => {
36177
+ const {
36178
+ state: {
36179
+ activeDashboardLink
36180
+ },
36181
+ dispatch
36182
+ } = useContext(store);
36183
+ const {
36184
+ t
36185
+ } = useTranslation("dashboard");
35515
36186
 
35516
- const renewDate = new Date(Number(`${subscription.renews_at}000`));
35517
- const formattedRenewDate = new Intl.DateTimeFormat("en-CA").format(renewDate);
35518
- return `${this.locale("labels.renewsOn")} ${formattedRenewDate}`;
36187
+ const setActiveDashboardLink = submenuName => {
36188
+ dispatch({
36189
+ type: SET_ACTIVE_DASHBOARD_LINK,
36190
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35519
36191
  });
36192
+ };
35520
36193
 
35521
- _defineProperty$3(this, "reactivateSubscription", subscription_id => {
35522
- // disable the Login button to prevent repeated clicks
35523
- this.setState({
35524
- disableSubmit: true
35525
- });
35526
- window.Pelcro.subscription.reactivate({
35527
- auth_token: window.Pelcro.user.read().auth_token,
35528
- subscription_id: subscription_id
35529
- }, (err, res) => {
35530
- this.setState({
35531
- disableSubmit: false
35532
- });
35533
- this.props.onClose();
36194
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
36195
+ show: hasDonationSubs(),
36196
+ name: SUB_MENUS.DONATIONS,
36197
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgDonate, {
36198
+ className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
36199
+ }),
36200
+ title: title !== null && title !== void 0 ? title : t("labels.donations"),
36201
+ setActiveDashboardLink: setActiveDashboardLink,
36202
+ activeDashboardLink: activeDashboardLink
36203
+ });
36204
+ };
35534
36205
 
35535
- if (err) {
35536
- return notify.error(this.locale("messages.subReactivation.error"));
35537
- }
36206
+ const DashboardGifts = ({
36207
+ title,
36208
+ icon,
36209
+ store
36210
+ }) => {
36211
+ const {
36212
+ state: {
36213
+ activeDashboardLink
36214
+ },
36215
+ dispatch
36216
+ } = useContext(store);
36217
+ const {
36218
+ t
36219
+ } = useTranslation("dashboard");
35538
36220
 
35539
- return notify.success(this.locale("messages.subReactivation.success"));
35540
- });
36221
+ const setActiveDashboardLink = submenuName => {
36222
+ dispatch({
36223
+ type: SET_ACTIVE_DASHBOARD_LINK,
36224
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35541
36225
  });
36226
+ };
35542
36227
 
35543
- _defineProperty$3(this, "getSubscriptionStatus", sub => {
35544
- const isSubscriptionEndingSoon = sub => {
35545
- const weekFromNow = new Date().getTime() + 7 * 24 * 60 * 60 * 1000;
35546
- const endingAt = new Date(sub.expires_at * 1000).getTime();
35547
- return weekFromNow > endingAt && sub.cancel_at_period_end;
35548
- };
35549
-
35550
- const isSubscriptionInTrial = sub => {
35551
- if (!sub.trial_end) {
35552
- return;
35553
- }
35554
-
35555
- const now = new Date().getTime();
35556
- const trialEndDate = new Date(sub.trial_end).getTime();
35557
- return now < trialEndDate;
35558
- };
35559
-
35560
- if (isSubscriptionEndingSoon(sub)) {
35561
- return {
35562
- title: this.locale("labels.status.endingSoon"),
35563
- content: this.getSubscriptionStatusText(sub),
35564
- textColor: "plc-text-orange-700",
35565
- bgColor: "plc-bg-orange-100",
35566
- icon: /*#__PURE__*/React__default.createElement(SvgExclamation, null)
35567
- };
35568
- }
35569
-
35570
- if (isSubscriptionInTrial(sub)) {
35571
- return {
35572
- title: this.locale("labels.status.inTrial"),
35573
- content: this.getSubscriptionStatusText(sub),
35574
- textColor: "plc-text-yellow-700",
35575
- bgColor: "plc-bg-yellow-100",
35576
- icon: /*#__PURE__*/React__default.createElement(SvgCheckMark, null)
35577
- };
35578
- }
36228
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
36229
+ name: SUB_MENUS.GIFTS,
36230
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgGift, null),
36231
+ title: title !== null && title !== void 0 ? title : t("labels.gifts"),
36232
+ setActiveDashboardLink: setActiveDashboardLink,
36233
+ activeDashboardLink: activeDashboardLink
36234
+ });
36235
+ };
35579
36236
 
35580
- if (sub.status === "incomplete") {
35581
- return {
35582
- title: this.locale("labels.status.incomplete"),
35583
- content: this.getSubscriptionStatusText(sub),
35584
- textColor: "plc-text-orange-700",
35585
- bgColor: "plc-bg-orange-100",
35586
- icon: /*#__PURE__*/React__default.createElement(SvgExclamation, null)
35587
- };
35588
- }
36237
+ var _path$1;
35589
36238
 
35590
- if (sub.status === "canceled") {
35591
- return {
35592
- title: this.locale("labels.status.canceled"),
35593
- content: this.getSubscriptionStatusText(sub),
35594
- textColor: "plc-text-red-700",
35595
- bgColor: "plc-bg-red-100",
35596
- icon: /*#__PURE__*/React__default.createElement(SvgExclamation, null)
35597
- };
35598
- }
36239
+ function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
35599
36240
 
35600
- return {
35601
- title: this.locale("labels.status.active"),
35602
- content: this.getSubscriptionStatusText(sub),
35603
- textColor: "plc-text-green-700",
35604
- bgColor: "plc-bg-green-100",
35605
- icon: /*#__PURE__*/React__default.createElement(SvgCheckMark, null)
35606
- };
35607
- });
36241
+ function SvgShopping(props) {
36242
+ return /*#__PURE__*/React.createElement("svg", _extends$1({
36243
+ className: "plc-w-6 plc-h-6 plc-mr-2",
36244
+ xmlns: "http://www.w3.org/2000/svg",
36245
+ fill: "none",
36246
+ viewBox: "0 0 24 24",
36247
+ stroke: "currentColor"
36248
+ }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
36249
+ strokeLinecap: "round",
36250
+ strokeLinejoin: "round",
36251
+ strokeWidth: 2,
36252
+ d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
36253
+ })));
36254
+ }
35608
36255
 
35609
- _defineProperty$3(this, "renderAddresses", () => {
35610
- const addresses = this.state.addresses && this.state.addresses.map((address, index) => {
35611
- return /*#__PURE__*/React__default.createElement("tr", {
35612
- key: "dashboard-address-" + address.id
35613
- }, /*#__PURE__*/React__default.createElement("td", {
35614
- className: "plc-pr-2 plc-text-gray-400 plc-truncate"
35615
- }, /*#__PURE__*/React__default.createElement("span", {
35616
- className: "plc-font-semibold plc-text-gray-600"
35617
- }, address.city ? `${address.city},` : null, " ", address.country), " ", /*#__PURE__*/React__default.createElement("span", {
35618
- title: address.line1
35619
- }, address.line1), /*#__PURE__*/React__default.createElement("div", {
35620
- className: "plc-flex plc-mb-2 plc-mt-1"
35621
- }, /*#__PURE__*/React__default.createElement("span", {
35622
- className: "plc-rounded-full plc-bg-gray-200 plc-text-black plc-inline-flex plc-items-start plc-py-1 plc-px-4 plc-text-sm plc-capitalize"
35623
- }, address.type === "shipping" ? this.locale("labels.shipping") : this.locale("labels.billing")), address.is_default && /*#__PURE__*/React__default.createElement("span", {
35624
- 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-ml-2"
35625
- }, this.locale("labels.default")))), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement(Button, {
35626
- variant: "icon",
35627
- className: "plc-text-gray-500",
35628
- icon: /*#__PURE__*/React__default.createElement(SvgEdit, null),
35629
- id: "pelcro-button-update-address-" + index,
35630
- "data-key": address.id,
35631
- onClick: this.displayAddressEdit
35632
- })));
35633
- });
35634
- return /*#__PURE__*/React__default.createElement("table", {
35635
- className: "plc-w-full plc-table-fixed"
35636
- }, /*#__PURE__*/React__default.createElement("thead", {
35637
- className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
35638
- }, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
35639
- className: "plc-w-10/12"
35640
- }, this.locale("labels.address")), /*#__PURE__*/React__default.createElement("th", {
35641
- className: "plc-w-2/12"
35642
- }, this.locale("labels.edit")))), /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", {
35643
- className: "plc-h-4"
35644
- }), addresses, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
35645
- colSpan: "2",
35646
- className: "plc-p-1"
35647
- }, /*#__PURE__*/React__default.createElement(Button, {
35648
- variant: "ghost",
35649
- icon: /*#__PURE__*/React__default.createElement(SvgPlus, {
35650
- className: "plc-w-4 plc-mr-1"
35651
- }),
35652
- className: "plc-w-full plc-h-8 plc-font-semibold plc-tracking-wider plc-text-gray-900 plc-uppercase hover:plc-bg-gray-100",
35653
- onClick: this.displayAddressCreate
35654
- }, this.locale("labels.addAddress"))))));
35655
- });
36256
+ const DashboardOrders = ({
36257
+ title,
36258
+ icon,
36259
+ store
36260
+ }) => {
36261
+ const {
36262
+ state: {
36263
+ activeDashboardLink
36264
+ },
36265
+ dispatch
36266
+ } = useContext(store);
36267
+ const {
36268
+ t
36269
+ } = useTranslation("dashboard");
35656
36270
 
35657
- _defineProperty$3(this, "closeDashboard", () => {
35658
- this.setState({
35659
- isOpen: false,
35660
- activeDashboardLink: null
35661
- });
36271
+ const setActiveDashboardLink = submenuName => {
36272
+ dispatch({
36273
+ type: SET_ACTIVE_DASHBOARD_LINK,
36274
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
35662
36275
  });
36276
+ };
35663
36277
 
35664
- this.state = {
35665
- isOpen: false,
35666
- activeDashboardLink: null,
35667
- subscriptions: window.Pelcro.subscription.list(),
35668
- giftRecipients: (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.gift_recipients) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [],
35669
- disableSubmit: false,
35670
- addresses: []
35671
- };
35672
- this.site = window.Pelcro.site.read();
35673
- this.locale = this.props.t;
35674
- this.user = window.Pelcro.user.read();
35675
- this.menuRef = /*#__PURE__*/React__default.createRef();
35676
- }
35677
-
35678
- render() {
35679
- var _window$Pelcro$user$r3, _window$Pelcro, _window$Pelcro$uiSett;
35680
-
35681
- const {
35682
- isOpen
35683
- } = this.state;
35684
- const userHasName = this.user.first_name || this.user.last_name;
35685
- const profilePicture = (_window$Pelcro$user$r3 = window.Pelcro.user.read().profile_photo) !== null && _window$Pelcro$user$r3 !== void 0 ? _window$Pelcro$user$r3 : userSolidIcon;
35686
- const newsletters = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.newsletters;
35687
- Array.isArray(newsletters) && newsletters.length > 0;
35688
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Transition, {
35689
- className: "plc-fixed plc-inset-y-0 plc-left-0 plc-h-full lg:plc-w-3/12 plc-w-full plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max",
35690
- show: isOpen,
35691
- enter: "plc-transform plc-transition plc-duration-500",
35692
- enterFrom: "plc--translate-x-full",
35693
- enterTo: "plc-translate-x-0",
35694
- afterEnter: this.initializeHideMenuHandler,
35695
- leave: "plc-transform plc-transition plc-duration-500",
35696
- leaveFrom: "plc-translate-x-0",
35697
- leaveTo: "plc--translate-x-full",
35698
- afterLeave: this.props.onClose
35699
- }, /*#__PURE__*/React__default.createElement("div", {
35700
- id: "pelcro-view-dashboard",
35701
- ref: this.menuRef
35702
- }, /*#__PURE__*/React__default.createElement("header", {
35703
- className: "plc-bg-gray-200 plc-flex plc-py-5"
35704
- }, /*#__PURE__*/React__default.createElement("div", {
35705
- className: "plc-flex plc-items-center"
35706
- }, /*#__PURE__*/React__default.createElement("div", {
35707
- className: "plc-flex plc-justify-center plc-ml-3 sm:plc-ml-6 plc-flex-shrink-0"
35708
- }, /*#__PURE__*/React__default.createElement("div", {
35709
- className: "plc-relative plc-flex-shrink-0"
35710
- }, /*#__PURE__*/React__default.createElement("img", {
35711
- className: "pelcro-user-profile-picture plc-bg-gray-300 plc-cursor-pointer plc-h-10 plc-rounded-md plc-w-10",
35712
- src: profilePicture,
35713
- alt: "profile picture",
35714
- onClick: this.displayProfilePicChange
35715
- }))), /*#__PURE__*/React__default.createElement("div", {
35716
- 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"
35717
- }, userHasName && /*#__PURE__*/React__default.createElement("p", {
35718
- className: "plc-font-bold plc-break-all"
35719
- }, this.user.first_name, " ", this.user.last_name), /*#__PURE__*/React__default.createElement("p", {
35720
- className: `plc-m-0 plc-text-sm plc-break-all ${userHasName ? "plc-text-sm" : "plc-text-lg plc-font-bold plc-mt-auto"}`
35721
- }, this.user.email)), /*#__PURE__*/React__default.createElement("div", {
35722
- className: "lg:plc-hidden"
35723
- }, /*#__PURE__*/React__default.createElement(Button, {
35724
- variant: "ghost",
35725
- type: "button",
35726
- className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-5 plc-right-10",
35727
- onClick: this.closeDashboard
35728
- }, /*#__PURE__*/React__default.createElement(SvgXIcon, {
35729
- className: "plc-fill-current"
35730
- }))))), /*#__PURE__*/React__default.createElement("section", {
35731
- className: "plc-mt-6 plc-shadow-sm"
35732
- }, /*#__PURE__*/React__default.createElement("header", {
35733
- className: "plc-pl-4 plc-mb-2 sm:plc-pl-8"
35734
- }, /*#__PURE__*/React__default.createElement("p", {
35735
- className: "plc-font-bold plc-tracking-widest plc-text-gray-500"
35736
- }, this.locale("labels.mySettings"))), /*#__PURE__*/React__default.createElement(DashboardLink, {
35737
- name: SUB_MENUS.PROFILE,
35738
- icon: /*#__PURE__*/React__default.createElement(SvgUser, {
35739
- className: "plc-w-6 plc-h-6 plc-mr-2"
35740
- }),
35741
- title: this.locale("labels.profile"),
35742
- setActiveDashboardLink: this.setActiveDashboardLink,
35743
- activeDashboardLink: this.state.activeDashboardLink
35744
- }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35745
- name: SUB_MENUS.QRCODE,
35746
- icon: /*#__PURE__*/React__default.createElement(SvgQrcode, {
35747
- className: "plc-w-6 plc-h-6 plc-mr-2"
35748
- }),
35749
- title: this.locale("labels.myQRCode"),
35750
- setActiveDashboardLink: this.setActiveDashboardLink,
35751
- activeDashboardLink: this.state.activeDashboardLink
35752
- }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35753
- name: SUB_MENUS.PASSWORDCHANGE,
35754
- icon: /*#__PURE__*/React__default.createElement(SvgKey, {
35755
- className: "plc-w-6 plc-h-6 plc-mr-2"
35756
- }),
35757
- title: this.locale("labels.changePassword"),
35758
- setActiveDashboardLink: this.setActiveDashboardLink,
35759
- activeDashboardLink: this.state.activeDashboardLink
35760
- }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35761
- name: SUB_MENUS.SAVED_ITEMS,
35762
- icon: /*#__PURE__*/React__default.createElement(SvgBookmark, null),
35763
- title: this.locale("labels.savedItems.label"),
35764
- setActiveDashboardLink: this.setActiveDashboardLink,
35765
- activeDashboardLink: this.state.activeDashboardLink
35766
- }), /*#__PURE__*/React__default.createElement("header", {
35767
- className: "plc-pl-4 plc-mb-2 sm:plc-pl-8"
35768
- }, /*#__PURE__*/React__default.createElement("p", {
35769
- className: "plc-font-bold plc-tracking-widest plc-text-gray-500"
35770
- }, this.locale("labels.accountSettings"))), /*#__PURE__*/React__default.createElement(DashboardLink, {
35771
- name: SUB_MENUS.PAYMENT_CARDS,
35772
- icon: /*#__PURE__*/React__default.createElement(SvgPaymentCard, null),
35773
- title: this.locale("labels.paymentSource"),
35774
- setActiveDashboardLink: this.setActiveDashboardLink,
35775
- activeDashboardLink: this.state.activeDashboardLink
35776
- }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35777
- name: SUB_MENUS.ADDRESSES,
35778
- icon: /*#__PURE__*/React__default.createElement(SvgLocationPin, null),
35779
- title: this.locale("labels.addresses"),
35780
- setActiveDashboardLink: this.setActiveDashboardLink,
35781
- activeDashboardLink: this.state.activeDashboardLink
35782
- }), /*#__PURE__*/React__default.createElement("header", {
35783
- className: "plc-pl-4 plc-my-2 sm:plc-pl-8"
35784
- }, /*#__PURE__*/React__default.createElement("p", {
35785
- className: "plc-font-bold plc-tracking-widest plc-text-gray-500"
35786
- }, this.locale("labels.purchases"))), /*#__PURE__*/React__default.createElement(DashboardLink, {
35787
- name: SUB_MENUS.SUBSCRIPTIONS,
35788
- icon: /*#__PURE__*/React__default.createElement(SvgSubscription, {
35789
- className: "plc-w-10 plc-h-10 plc-pt-2 plc-pr-1 plc--ml-2"
35790
- }),
35791
- title: this.locale("labels.subscriptions"),
35792
- setActiveDashboardLink: this.setActiveDashboardLink,
35793
- activeDashboardLink: this.state.activeDashboardLink
35794
- }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35795
- show: showNewsletters(),
35796
- name: SUB_MENUS.NEWSLETTERS,
35797
- icon: /*#__PURE__*/React__default.createElement(SvgNewsletter, {
35798
- className: "plc-transform plc--translate-x-1 plc-scale-105 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
35799
- }),
35800
- title: this.locale("labels.Newsletters"),
35801
- setActiveDashboardLink: this.setActiveDashboardLink,
35802
- activeDashboardLink: this.state.activeDashboardLink
35803
- }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35804
- show: hasActiveMemberships(),
35805
- name: SUB_MENUS.MEMBERSHIPS,
35806
- icon: /*#__PURE__*/React__default.createElement(SvgMemberships, {
35807
- className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
35808
- }),
35809
- title: this.locale("labels.memberships"),
35810
- setActiveDashboardLink: this.setActiveDashboardLink,
35811
- activeDashboardLink: this.state.activeDashboardLink
35812
- }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35813
- show: hasDonationSubs(),
35814
- name: SUB_MENUS.DONATIONS,
35815
- icon: /*#__PURE__*/React__default.createElement(SvgDonate, {
35816
- className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
35817
- }),
35818
- title: this.locale("labels.donations"),
35819
- setActiveDashboardLink: this.setActiveDashboardLink,
35820
- activeDashboardLink: this.state.activeDashboardLink
35821
- }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35822
- name: SUB_MENUS.GIFTS,
35823
- icon: /*#__PURE__*/React__default.createElement(SvgGift, null),
35824
- title: this.locale("labels.gifts"),
35825
- setActiveDashboardLink: this.setActiveDashboardLink,
35826
- activeDashboardLink: this.state.activeDashboardLink
35827
- }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35828
- show: window.Pelcro.site.read().ecommerce_enabled,
35829
- name: SUB_MENUS.ORDERS,
35830
- icon: /*#__PURE__*/React__default.createElement(SvgShopping, null),
35831
- title: this.locale("labels.orders.label"),
35832
- setActiveDashboardLink: this.setActiveDashboardLink,
35833
- activeDashboardLink: this.state.activeDashboardLink
35834
- }), /*#__PURE__*/React__default.createElement(DashboardLink, {
35835
- show: hasInvoices(),
35836
- name: SUB_MENUS.INVOICES,
35837
- icon: /*#__PURE__*/React__default.createElement(SvgDocument, null),
35838
- title: this.locale("labels.invoices"),
35839
- setActiveDashboardLink: this.setActiveDashboardLink,
35840
- activeDashboardLink: this.state.activeDashboardLink
35841
- })), /*#__PURE__*/React__default.createElement(DashboardLink, {
35842
- name: SUB_MENUS.LOGOUT,
35843
- icon: /*#__PURE__*/React__default.createElement(SvgExit, null),
35844
- title: this.locale("labels.logout"),
35845
- setActiveDashboardLink: this.setActiveDashboardLink,
35846
- activeDashboardLink: this.state.activeDashboardLink
35847
- }))), this.state.activeDashboardLink && isOpen && /*#__PURE__*/React__default.createElement("div", {
35848
- id: "pelcro-view-dashboard-submenus",
35849
- className: "plc-fixed plc-inset-y-0 plc-right-0 plc-h-full lg:plc-w-9/12 plc-w-full plc-bg-gray-100 plc-z-max plc-overflow-auto"
35850
- }, this.state.activeDashboardLink === SUB_MENUS.PROFILE && /*#__PURE__*/React__default.createElement(ProfileMenu, null), this.state.activeDashboardLink === SUB_MENUS.QRCODE && /*#__PURE__*/React__default.createElement(QRCodeMenu, null), this.state.activeDashboardLink === SUB_MENUS.PASSWORDCHANGE && /*#__PURE__*/React__default.createElement(PasswordChangeMenu, null), this.state.activeDashboardLink === SUB_MENUS.SAVED_ITEMS && /*#__PURE__*/React__default.createElement(SavedItemsMenu, null), this.state.activeDashboardLink === SUB_MENUS.PAYMENT_CARDS && /*#__PURE__*/React__default.createElement(PaymentCardsMenu, {
35851
- displaySourceCreate: this.displaySourceCreate
35852
- }), this.state.activeDashboardLink === SUB_MENUS.ADDRESSES && /*#__PURE__*/React__default.createElement(AddressesMenu, {
35853
- displayAddressCreate: this.displayAddressCreate,
35854
- displayAddressEdit: this.displayAddressEdit
35855
- }), this.state.activeDashboardLink === SUB_MENUS.SUBSCRIPTIONS && /*#__PURE__*/React__default.createElement(SubscriptionsMenu // getSubscriptionStatus={this.getSubscriptionStatus}
35856
- , {
35857
- displayProductSelect: this.displayProductSelect,
35858
- displayRedeem: this.displayRedeem,
35859
- cancelSubscription: this.cancelSubscription,
35860
- unSuspendSubscription: this.unSuspendSubscription,
35861
- reactivateSubscription: this.reactivateSubscription,
35862
- setProductAndPlan: this.props.setProductAndPlan,
35863
- setSubscriptionIdToRenew: this.props.setSubscriptionIdToRenew,
35864
- setView: this.props.setView,
35865
- getSubscriptionStatus: this.getSubscriptionStatus,
35866
- disableSubmit: this.state.disableSubmit
35867
- }), this.state.activeDashboardLink === SUB_MENUS.MEMBERSHIPS && /*#__PURE__*/React__default.createElement(MembershipsMenu, {
35868
- getSubscriptionStatus: this.getSubscriptionStatus
35869
- }), this.state.activeDashboardLink === SUB_MENUS.NEWSLETTERS && /*#__PURE__*/React__default.createElement(NewslettersMenu, null), this.state.activeDashboardLink === SUB_MENUS.DONATIONS && /*#__PURE__*/React__default.createElement(DonationsMenu, {
35870
- cancelSubscription: this.cancelSubscription,
35871
- reactivateSubscription: this.reactivateSubscription,
35872
- disableSubmit: this.state.disableSubmit,
35873
- getSubscriptionStatus: this.getSubscriptionStatus
35874
- }), this.state.activeDashboardLink === SUB_MENUS.GIFTS && /*#__PURE__*/React__default.createElement(GiftsMenu, {
35875
- getSubscriptionStatus: this.getSubscriptionStatus,
35876
- displayProductSelect: this.displayProductSelect,
35877
- setProductAndPlan: this.props.setProductAndPlan,
35878
- setSubscriptionIdToRenew: this.props.setSubscriptionIdToRenew,
35879
- setIsRenewingGift: this.props.setIsRenewingGift,
35880
- setView: this.props.setView,
35881
- disableSubmit: this.state.disableSubmit
35882
- }), this.state.activeDashboardLink === SUB_MENUS.ORDERS && /*#__PURE__*/React__default.createElement(OrdersMenu, null), this.state.activeDashboardLink === SUB_MENUS.INVOICES && /*#__PURE__*/React__default.createElement(InvoicesMenu, null), this.state.activeDashboardLink === SUB_MENUS.LOGOUT && this.props.logout(), /*#__PURE__*/React__default.createElement(Button, {
35883
- variant: "ghost",
35884
- type: "button",
35885
- className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-2 plc-right-2 md:plc-top-5 md:plc-right-10",
35886
- onClick: this.closeDashboard
35887
- }, /*#__PURE__*/React__default.createElement(SvgXIcon, {
35888
- className: "plc-fill-current"
35889
- }))));
35890
- }
35891
-
35892
- }
35893
-
35894
- function hasInvoices() {
35895
- var _window$Pelcro$invoic, _window$Pelcro$invoic2;
36278
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
36279
+ show: window.Pelcro.site.read().ecommerce_enabled,
36280
+ name: SUB_MENUS.ORDERS,
36281
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgShopping, null),
36282
+ title: title !== null && title !== void 0 ? title : t("labels.orders.label"),
36283
+ setActiveDashboardLink: setActiveDashboardLink,
36284
+ activeDashboardLink: activeDashboardLink
36285
+ });
36286
+ };
35896
36287
 
35897
- const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
35898
- return invoices.length > 0;
35899
- }
36288
+ const DashboardInvoices = ({
36289
+ title,
36290
+ icon,
36291
+ store
36292
+ }) => {
36293
+ const {
36294
+ state: {
36295
+ activeDashboardLink
36296
+ },
36297
+ dispatch
36298
+ } = useContext(store);
36299
+ const {
36300
+ t
36301
+ } = useTranslation("dashboard");
35900
36302
 
35901
- function showNewsletters() {
35902
- var _ref, _window$Pelcro2, _window$Pelcro2$uiSet, _window$Pelcro2$uiSet2;
36303
+ const setActiveDashboardLink = submenuName => {
36304
+ dispatch({
36305
+ type: SET_ACTIVE_DASHBOARD_LINK,
36306
+ payload: submenuName !== null && submenuName !== void 0 ? submenuName : null
36307
+ });
36308
+ };
35903
36309
 
35904
- const showNewslettersUiSettings = (_ref = ((_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : (_window$Pelcro2$uiSet2 = _window$Pelcro2$uiSet.newsletters) === null || _window$Pelcro2$uiSet2 === void 0 ? void 0 : _window$Pelcro2$uiSet2.length) > 0) !== null && _ref !== void 0 ? _ref : false;
35905
- return showNewslettersUiSettings;
35906
- }
36310
+ return /*#__PURE__*/React__default.createElement(DashboardLink, {
36311
+ show: hasInvoices(),
36312
+ name: SUB_MENUS.INVOICES,
36313
+ icon: icon !== null && icon !== void 0 ? icon : /*#__PURE__*/React__default.createElement(SvgDocument, null),
36314
+ title: title !== null && title !== void 0 ? title : t("labels.invoices"),
36315
+ setActiveDashboardLink: setActiveDashboardLink,
36316
+ activeDashboardLink: activeDashboardLink
36317
+ });
36318
+ };
35907
36319
 
35908
- function hasDonationSubs() {
35909
- var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
36320
+ /**
36321
+ *
36322
+ */
35910
36323
 
35911
- 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 : [];
35912
- 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 : [];
35913
- return donations.length > 0 || canceledDonations.length > 0;
35914
- }
36324
+ function Dashboard(props) {
36325
+ React__default.useEffect(() => {
36326
+ var _props$onDisplay;
35915
36327
 
35916
- function hasActiveMemberships() {
35917
- var _window$Pelcro$user$r6, _window$Pelcro$user$r7;
36328
+ (_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
36329
+ }, []);
36330
+ const {
36331
+ resetView
36332
+ } = usePelcro();
36333
+ const {
36334
+ t
36335
+ } = useTranslation("dashboard");
36336
+ return /*#__PURE__*/React__default.createElement(DashboardContainer, props, /*#__PURE__*/React__default.createElement(DashboardContent, Object.assign({
36337
+ onClose: () => {
36338
+ var _props$onClose;
35918
36339
 
35919
- 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;
36340
+ (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
36341
+ resetView();
36342
+ }
36343
+ }, props), /*#__PURE__*/React__default.createElement(DashboardHeading, {
36344
+ title: t("labels.mySettings")
36345
+ }), /*#__PURE__*/React__default.createElement(DashboardProfile, null), /*#__PURE__*/React__default.createElement(DashboardQRCode, null), /*#__PURE__*/React__default.createElement(DashboardPasswordChange, null), /*#__PURE__*/React__default.createElement(DashboardSavedItems, null), /*#__PURE__*/React__default.createElement(DashboardHeading, {
36346
+ title: t("labels.accountSettings")
36347
+ }), /*#__PURE__*/React__default.createElement(DashboardPaymentCards, null), /*#__PURE__*/React__default.createElement(DashboardAddresses, null), /*#__PURE__*/React__default.createElement(DashboardHeading, {
36348
+ title: t("labels.purchases")
36349
+ }), /*#__PURE__*/React__default.createElement(DashboardSubscriptions, null), /*#__PURE__*/React__default.createElement(DashboardNewsletters, null), /*#__PURE__*/React__default.createElement(DashboardMemberships, null), /*#__PURE__*/React__default.createElement(DashboardDonations, null), /*#__PURE__*/React__default.createElement(DashboardGifts, null), /*#__PURE__*/React__default.createElement(DashboardOrders, null), /*#__PURE__*/React__default.createElement(DashboardInvoices, null)));
35920
36350
  }
35921
-
35922
- const DashboardWithTrans = withTranslation("dashboard")(Dashboard);
36351
+ Dashboard.viewId = "dashboard";
35923
36352
 
35924
36353
  // The button in the lower left that shows the dashboard.
35925
36354
  const DashboardOpenButton = () => {
@@ -38376,4 +38805,4 @@ const QrCodeModal = ({
38376
38805
  };
38377
38806
  QrCodeModal.viewId = "qrcode";
38378
38807
 
38379
- 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, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, ModalHeader, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
38808
+ export { AddNew, 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, BankRedirection, Button, Card, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, Dashboard, DashboardAddresses, DashboardContainer, DashboardContent, DashboardDonations, DashboardGifts, DashboardHeading, DashboardInvoices, DashboardLink, DashboardMemberships, DashboardNewsletters, DashboardOpenButton, DashboardOrders, DashboardPasswordChange, DashboardPaymentCards, DashboardProfile, DashboardQRCode, DashboardSavedItems, DashboardSubscriptions, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, ModalHeader, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };