@pelcro/react-pelcro-js 3.14.0 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -3634,6 +3634,8 @@ var labels$Y = {
3634
3634
  email: "Email",
3635
3635
  firstName: "First name",
3636
3636
  lastName: "Last name",
3637
+ username: "Username",
3638
+ displayname: "Display name",
3637
3639
  phone: "Phone",
3638
3640
  submit: "Submit",
3639
3641
  required: "Required",
@@ -4567,6 +4569,8 @@ var labels$D = {
4567
4569
  email: "Address courriel",
4568
4570
  firstName: "Prénom",
4569
4571
  lastName: "Nom de famille",
4572
+ username: "Nom d'utilisateur",
4573
+ displayname: "Afficher un nom",
4570
4574
  phone: "Numéro de téléphone",
4571
4575
  submit: "Soumettre",
4572
4576
  required: "Champs obligatoires",
@@ -5384,6 +5388,8 @@ var labels$o = {
5384
5388
  email: "이메일",
5385
5389
  firstName: "이름",
5386
5390
  lastName: "성",
5391
+ username: "사용자 이름",
5392
+ displayname: "이름 표시하기",
5387
5393
  phone: "전화번호",
5388
5394
  submit: "제출",
5389
5395
  required: "필수 항목",
@@ -6303,6 +6309,8 @@ var labels$9 = {
6303
6309
  email: "Correo",
6304
6310
  firstName: "Nombre",
6305
6311
  lastName: "Apellido",
6312
+ username: "Nombre de usuario",
6313
+ displayname: "Nombre para mostrar",
6306
6314
  phone: "Teléfono",
6307
6315
  submit: "Enviar",
6308
6316
  required: "Obligatorio",
@@ -8309,7 +8317,7 @@ class PelcroActions {
8309
8317
  return console.error("invalid subscription id");
8310
8318
  }
8311
8319
 
8312
- if ((subscriptionToManageMembers === null || subscriptionToManageMembers === void 0 ? void 0 : (_subscriptionToManage = subscriptionToManageMembers.plan) === null || _subscriptionToManage === void 0 ? void 0 : _subscriptionToManage.type) !== 'membership') {
8320
+ if ((subscriptionToManageMembers === null || subscriptionToManageMembers === void 0 ? void 0 : (_subscriptionToManage = subscriptionToManageMembers.plan) === null || _subscriptionToManage === void 0 ? void 0 : _subscriptionToManage.type) !== "membership") {
8313
8321
  return console.error("subscription is not from type membership");
8314
8322
  }
8315
8323
 
@@ -8609,7 +8617,7 @@ const createPelcroHook = store => {
8609
8617
 
8610
8618
  pelcroHook.override = fn => {
8611
8619
  const partialState = fn(store.setState, store.getState);
8612
- usePelcro.setState(partialState);
8620
+ usePelcro$1.setState(partialState);
8613
8621
  };
8614
8622
 
8615
8623
  pelcroHook.getStore = pelcroHook.getState;
@@ -8617,11 +8625,11 @@ const createPelcroHook = store => {
8617
8625
  };
8618
8626
 
8619
8627
  const pelcroStore = createPelcroStore();
8620
- const usePelcro = createPelcroHook(pelcroStore);
8628
+ const usePelcro$1 = createPelcroHook(pelcroStore);
8621
8629
  /* istanbul ignore next */
8622
8630
 
8623
8631
  if (process.env.NODE_ENV === "development") {
8624
- c$1("Pelcro Store", usePelcro);
8632
+ c$1("Pelcro Store", usePelcro$1);
8625
8633
  }
8626
8634
 
8627
8635
  /**
@@ -8826,7 +8834,7 @@ const trackSubscriptionOnGA = () => {
8826
8834
  product,
8827
8835
  plan,
8828
8836
  couponCode
8829
- } = usePelcro.getStore();
8837
+ } = usePelcro$1.getStore();
8830
8838
  /*
8831
8839
  getting the latest subscription id from invoices instead of subscriptions
8832
8840
  to handle gifted subs which are not added to subs list
@@ -9146,7 +9154,7 @@ class SaveToMetadataButtonClass {
9146
9154
  _defineProperty$3(this, "unauthenticated", () => {
9147
9155
  const {
9148
9156
  switchView
9149
- } = usePelcro.getStore();
9157
+ } = usePelcro$1.getStore();
9150
9158
 
9151
9159
  _classPrivateFieldGet(this, _onClick).call(this, () => switchView("login"));
9152
9160
 
@@ -9229,7 +9237,7 @@ class SaveToMetadataButtonClass {
9229
9237
  const user = window.Pelcro.user.read();
9230
9238
  const {
9231
9239
  switchView
9232
- } = usePelcro.getStore();
9240
+ } = usePelcro$1.getStore();
9233
9241
  const {
9234
9242
  key,
9235
9243
  ...buttonMetadata
@@ -10333,7 +10341,7 @@ toast.confirm = (onConfirm, {
10333
10341
  ...options
10334
10342
  });
10335
10343
  setTimeout(() => {
10336
- notify.dismiss(id);
10344
+ notify$1.dismiss(id);
10337
10345
  }, 3000);
10338
10346
  };
10339
10347
 
@@ -10343,12 +10351,12 @@ toast.confirm = (onConfirm, {
10343
10351
  ...options
10344
10352
  });
10345
10353
  setTimeout(() => {
10346
- notify.dismiss(id);
10354
+ notify$1.dismiss(id);
10347
10355
  }, 3000);
10348
10356
  };
10349
10357
  };
10350
10358
 
10351
- const notify = toast;
10359
+ const notify$1 = toast;
10352
10360
 
10353
10361
  const translations = i18next.t("common:buttons", {
10354
10362
  returnObjects: true
@@ -10365,7 +10373,7 @@ const init$1 = () => {
10365
10373
  addToCart,
10366
10374
  purchaseItem,
10367
10375
  setSubscriptionToManageMembers
10368
- } = usePelcro.getStore();
10376
+ } = usePelcro$1.getStore();
10369
10377
  const pelcroDashboardButtonsByClass = document.getElementsByClassName("pelcro-dashboard-button");
10370
10378
 
10371
10379
  if (pelcroDashboardButtonsByClass.length !== 0) {
@@ -10419,7 +10427,7 @@ const init$1 = () => {
10419
10427
  const errorMessage = i18next.t("messages:invalidSubscription", {
10420
10428
  returnObjects: true
10421
10429
  });
10422
- return notify.error(errorMessage);
10430
+ return notify$1.error(errorMessage);
10423
10431
  }
10424
10432
 
10425
10433
  switchView("manage-members");
@@ -10428,7 +10436,7 @@ const init$1 = () => {
10428
10436
  const errorMessage = i18next.t("messages:invalidSubscription", {
10429
10437
  returnObjects: true
10430
10438
  });
10431
- return notify.error(errorMessage);
10439
+ return notify$1.error(errorMessage);
10432
10440
  }
10433
10441
  }
10434
10442
  }
@@ -10598,7 +10606,7 @@ const init$1 = () => {
10598
10606
  const errorMsg = i18next.t("shop:messages.currencyMismatch", {
10599
10607
  currency: userCurrency
10600
10608
  });
10601
- notify.error(errorMsg);
10609
+ notify$1.error(errorMsg);
10602
10610
  }
10603
10611
  });
10604
10612
  }
@@ -10668,7 +10676,7 @@ const init = () => {
10668
10676
  const {
10669
10677
  switchView,
10670
10678
  set
10671
- } = usePelcro.getStore();
10679
+ } = usePelcro$1.getStore();
10672
10680
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
10673
10681
 
10674
10682
  if (entitlementsProtectedElements.length === 0) {
@@ -10700,7 +10708,7 @@ const init = () => {
10700
10708
  elemDeepClone.setAttribute("style", "filter:blur(3px) !important; pointer-events:none !important; user-select:none !important");
10701
10709
  unblurElemWhenUserSubscribes(elemDeepClone, entitlements);
10702
10710
  const NOTIFICATION_ID = "entitlement";
10703
- notify( /*#__PURE__*/React__default['default'].createElement("p", null, /*#__PURE__*/React__default['default'].createElement(Trans, {
10711
+ notify$1( /*#__PURE__*/React__default['default'].createElement("p", null, /*#__PURE__*/React__default['default'].createElement(Trans, {
10704
10712
  i18nKey: "messages:entitlement"
10705
10713
  }, "Some of the content on this page is available with one or more of our plans.", /*#__PURE__*/React__default['default'].createElement(Link, {
10706
10714
  onClick: () => {
@@ -10717,7 +10725,7 @@ const init = () => {
10717
10725
  });
10718
10726
  }
10719
10727
 
10720
- notify.dismiss(NOTIFICATION_ID);
10728
+ notify$1.dismiss(NOTIFICATION_ID);
10721
10729
  switchView("_plan-select-entitlements");
10722
10730
  }
10723
10731
  }, "Subscribe"), "now to get full page access.")), {
@@ -10757,7 +10765,7 @@ function unblurElemWhenUserSubscribes(elem, entitlements) {
10757
10765
  document.addEventListener("PelcroSubscriptionCreate", event => {
10758
10766
  const {
10759
10767
  isGift
10760
- } = usePelcro.getStore();
10768
+ } = usePelcro$1.getStore();
10761
10769
  if (isGift) return;
10762
10770
  const latestSub = event.detail.data.subscriptions[event.detail.data.subscriptions.length - 1];
10763
10771
  const shouldUnblurContent = entitlements.some(ent => {
@@ -11079,7 +11087,7 @@ const initPaywalls = () => {
11079
11087
 
11080
11088
  const {
11081
11089
  switchView
11082
- } = usePelcro.getStore();
11090
+ } = usePelcro$1.getStore();
11083
11091
 
11084
11092
  if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11085
11093
  /*
@@ -11101,7 +11109,7 @@ const loadPaymentSDKs = () => {
11101
11109
  // Lazy load stripe's SDK
11102
11110
  const {
11103
11111
  whenUserReady
11104
- } = usePelcro.getStore();
11112
+ } = usePelcro$1.getStore();
11105
11113
  whenUserReady(() => {
11106
11114
  if (!window.Stripe) {
11107
11115
  pure_1(window.Pelcro.environment.stripe);
@@ -11149,7 +11157,7 @@ const loadAuth0SDK = () => {
11149
11157
  const initSecuritySdk = () => {
11150
11158
  const {
11151
11159
  whenSiteReady
11152
- } = usePelcro.getStore();
11160
+ } = usePelcro$1.getStore();
11153
11161
  whenSiteReady(() => {
11154
11162
  var _window$Pelcro$site$r2;
11155
11163
 
@@ -11185,7 +11193,7 @@ const dispatchModalDisplayEvents = modalName => {
11185
11193
  const {
11186
11194
  whenSiteReady,
11187
11195
  whenEcommerceLoaded
11188
- } = usePelcro.getStore();
11196
+ } = usePelcro$1.getStore();
11189
11197
  const renderShopView = shopComponent => {
11190
11198
  whenEcommerceLoaded(() => {
11191
11199
  const shopElement = document.getElementById("pelcro-shop");
@@ -11267,7 +11275,7 @@ const initViewFromURL = () => {
11267
11275
  const {
11268
11276
  switchView,
11269
11277
  whenSiteReady
11270
- } = usePelcro.getStore();
11278
+ } = usePelcro$1.getStore();
11271
11279
 
11272
11280
  if (isValidViewFromURL(view)) {
11273
11281
  whenSiteReady(() => {
@@ -11325,7 +11333,7 @@ const initSubscriptionFromURL = () => {
11325
11333
  switchView,
11326
11334
  whenSiteReady,
11327
11335
  set
11328
- } = usePelcro.getStore();
11336
+ } = usePelcro$1.getStore();
11329
11337
  whenSiteReady(() => {
11330
11338
  var _selectedProduct$plan;
11331
11339
 
@@ -11349,7 +11357,7 @@ const initSubscriptionFromURL = () => {
11349
11357
  isAuthenticated,
11350
11358
  switchToAddressView,
11351
11359
  switchToPaymentView
11352
- } = usePelcro.getStore();
11360
+ } = usePelcro$1.getStore();
11353
11361
 
11354
11362
  if (!isAuthenticated()) {
11355
11363
  return switchView("register");
@@ -11381,7 +11389,7 @@ const initOfflineSubscriptionFromURL = offlinePlanId => {
11381
11389
  switchToPaymentView,
11382
11390
  switchToAddressView,
11383
11391
  set
11384
- } = usePelcro.getStore();
11392
+ } = usePelcro$1.getStore();
11385
11393
  whenSiteReady(() => {
11386
11394
  window.Pelcro.plan.getPlan({
11387
11395
  plan_id: offlinePlanId
@@ -11428,7 +11436,7 @@ const initPurchaseFromUrl = () => {
11428
11436
  const {
11429
11437
  whenEcommerceLoaded,
11430
11438
  purchaseItem
11431
- } = usePelcro.getStore();
11439
+ } = usePelcro$1.getStore();
11432
11440
  whenEcommerceLoaded(() => {
11433
11441
  const skuId = window.Pelcro.helpers.getURLParameter("sku_id");
11434
11442
  purchaseItem(skuId);
@@ -11444,7 +11452,7 @@ const initCartFromUrl = () => {
11444
11452
  whenEcommerceLoaded,
11445
11453
  addToCart,
11446
11454
  switchView
11447
- } = usePelcro.getStore();
11455
+ } = usePelcro$1.getStore();
11448
11456
  whenEcommerceLoaded(() => {
11449
11457
  const skusIdsParam = window.Pelcro.helpers.getURLParameter("sku_id");
11450
11458
  const skusIds = skusIdsParam === null || skusIdsParam === void 0 ? void 0 : skusIdsParam.split(",");
@@ -11465,7 +11473,7 @@ const verifyEmailTokenFromUrl = () => {
11465
11473
 
11466
11474
  const {
11467
11475
  whenSiteReady
11468
- } = usePelcro.getStore();
11476
+ } = usePelcro$1.getStore();
11469
11477
  const translations = i18next.t("verifyEmail:messages", {
11470
11478
  returnObjects: true
11471
11479
  });
@@ -11477,10 +11485,10 @@ const verifyEmailTokenFromUrl = () => {
11477
11485
  token: emailToken
11478
11486
  }, (err, res) => {
11479
11487
  if (err) {
11480
- return notify.error(getErrorMessages(err));
11488
+ return notify$1.error(getErrorMessages(err));
11481
11489
  }
11482
11490
 
11483
- return notify.success(translations.success);
11491
+ return notify$1.success(translations.success);
11484
11492
  });
11485
11493
  }, {
11486
11494
  once: true
@@ -11494,7 +11502,7 @@ const verifyLinkTokenFromUrl = () => {
11494
11502
  whenSiteReady,
11495
11503
  resetView,
11496
11504
  isAuthenticated
11497
- } = usePelcro.getStore();
11505
+ } = usePelcro$1.getStore();
11498
11506
  const translations = i18next.t("verifyLinkToken:messages", {
11499
11507
  returnObjects: true
11500
11508
  });
@@ -11506,7 +11514,7 @@ const verifyLinkTokenFromUrl = () => {
11506
11514
  token: loginToken
11507
11515
  }, (err, res) => {
11508
11516
  if (err) {
11509
- return notify.error(getErrorMessages(err));
11517
+ return notify$1.error(getErrorMessages(err));
11510
11518
  }
11511
11519
 
11512
11520
  const {
@@ -11516,11 +11524,11 @@ const verifyLinkTokenFromUrl = () => {
11516
11524
  auth_token
11517
11525
  }, (err, res) => {
11518
11526
  if (err) {
11519
- return notify.error(getErrorMessages(err));
11527
+ return notify$1.error(getErrorMessages(err));
11520
11528
  }
11521
11529
 
11522
11530
  resetView();
11523
- return notify.success(translations.success);
11531
+ return notify$1.success(translations.success);
11524
11532
  });
11525
11533
  });
11526
11534
  }, {
@@ -11533,12 +11541,12 @@ const showPasswordlessRequestFromUrl = () => {
11533
11541
 
11534
11542
  const {
11535
11543
  isAuthenticated
11536
- } = usePelcro.getStore();
11544
+ } = usePelcro$1.getStore();
11537
11545
  const passwordlessEnabled = (_window$Pelcro$site$r8 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r8 === void 0 ? void 0 : _window$Pelcro$site$r8.passwordless_enabled;
11538
11546
  if (!passwordlessEnabled || isAuthenticated()) return;
11539
11547
  const {
11540
11548
  switchView
11541
- } = usePelcro.getStore();
11549
+ } = usePelcro$1.getStore();
11542
11550
  return switchView("passwordless-request");
11543
11551
  };
11544
11552
 
@@ -11549,7 +11557,7 @@ const showInvoiceDetailsFromUrl = () => {
11549
11557
  whenUserReady,
11550
11558
  whenSiteReady,
11551
11559
  switchView
11552
- } = usePelcro.getStore();
11560
+ } = usePelcro$1.getStore();
11553
11561
  whenSiteReady(() => {
11554
11562
  if (!isAuthenticated()) {
11555
11563
  return switchView("login");
@@ -11563,18 +11571,18 @@ const showInvoiceDetailsFromUrl = () => {
11563
11571
  const errorMessage = i18next.t("messages:invalidInvoice", {
11564
11572
  returnObjects: true
11565
11573
  });
11566
- return notify.error(errorMessage);
11574
+ return notify$1.error(errorMessage);
11567
11575
  }
11568
11576
 
11569
11577
  const {
11570
11578
  invoice
11571
- } = usePelcro.getStore();
11579
+ } = usePelcro$1.getStore();
11572
11580
 
11573
11581
  if (invoice.total === 0) {
11574
11582
  const errorMessage = i18next.t("messages:zeroTotalInvoice", {
11575
11583
  returnObjects: true
11576
11584
  });
11577
- return notify.error(errorMessage);
11585
+ return notify$1.error(errorMessage);
11578
11586
  }
11579
11587
 
11580
11588
  return switchView("invoice-details");
@@ -11589,7 +11597,7 @@ const showSubscriptionManageMembersFromUrl = () => {
11589
11597
  whenUserReady,
11590
11598
  whenSiteReady,
11591
11599
  switchView
11592
- } = usePelcro.getStore();
11600
+ } = usePelcro$1.getStore();
11593
11601
  whenSiteReady(() => {
11594
11602
  if (!isAuthenticated()) {
11595
11603
  return switchView("login");
@@ -11603,7 +11611,7 @@ const showSubscriptionManageMembersFromUrl = () => {
11603
11611
  const errorMessage = i18next.t("messages:invalidSubscription", {
11604
11612
  returnObjects: true
11605
11613
  });
11606
- return notify.error(errorMessage);
11614
+ return notify$1.error(errorMessage);
11607
11615
  }
11608
11616
 
11609
11617
  return switchView("manage-members");
@@ -11629,7 +11637,7 @@ const PelcroModalController = ({
11629
11637
  view,
11630
11638
  isAuthenticated,
11631
11639
  whenSiteReady
11632
- } = usePelcro();
11640
+ } = usePelcro$1();
11633
11641
  React__default['default'].useEffect(() => {
11634
11642
  init$1();
11635
11643
  renderShopView(React__default['default'].Children.map(children, child => child).find(({
@@ -13390,7 +13398,7 @@ function Modal({
13390
13398
  }) {
13391
13399
  var _window$Pelcro, _window$Pelcro$site$r;
13392
13400
 
13393
- const resetView = usePelcro(state => state.resetView);
13401
+ const resetView = usePelcro$1(state => state.resetView);
13394
13402
  React.useEffect(() => {
13395
13403
  onDisplay === null || onDisplay === void 0 ? void 0 : onDisplay();
13396
13404
  dispatchModalDisplayEvents(id);
@@ -13463,8 +13471,11 @@ function LoginModal({
13463
13471
  const {
13464
13472
  switchView,
13465
13473
  resetView,
13466
- invoice
13467
- } = usePelcro();
13474
+ product,
13475
+ order,
13476
+ switchToAddressView,
13477
+ switchToPaymentView
13478
+ } = usePelcro$1();
13468
13479
 
13469
13480
  const onSuccess = res => {
13470
13481
  var _props$onSuccess;
@@ -13475,10 +13486,23 @@ function LoginModal({
13475
13486
  initPaywalls();
13476
13487
  }
13477
13488
 
13489
+ if (product) {
13490
+ if (product.address_required) {
13491
+ return switchToAddressView();
13492
+ } else {
13493
+ return switchToPaymentView();
13494
+ }
13495
+ }
13496
+
13497
+ if (order) {
13498
+ return switchToAddressView();
13499
+ }
13500
+
13478
13501
  resetView();
13479
13502
  const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
13503
+ const viewsURLs = ["invoice-details", "gift-redeem", "plan-select"];
13480
13504
 
13481
- if (viewFromURL === "invoice-details") {
13505
+ if (viewsURLs.includes(viewFromURL)) {
13482
13506
  initViewFromURL();
13483
13507
  }
13484
13508
  };
@@ -13801,7 +13825,7 @@ function RegisterView(props) {
13801
13825
  } = useTranslation("register");
13802
13826
  const {
13803
13827
  product
13804
- } = usePelcro();
13828
+ } = usePelcro$1();
13805
13829
  const title = (_product$paywall$regi = product === null || product === void 0 ? void 0 : (_product$paywall = product.paywall) === null || _product$paywall === void 0 ? void 0 : _product$paywall.register_title) !== null && _product$paywall$regi !== void 0 ? _product$paywall$regi : t("title");
13806
13830
  const subtitle = (_product$paywall$regi2 = product === null || product === void 0 ? void 0 : (_product$paywall2 = product.paywall) === null || _product$paywall2 === void 0 ? void 0 : _product$paywall2.register_subtitle) !== null && _product$paywall$regi2 !== void 0 ? _product$paywall$regi2 : t("subtitle");
13807
13831
  const socialLoginEnabled = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id) || ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.google_app_id) || ((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.auth0_client_id);
@@ -14032,7 +14056,7 @@ function RegisterModal(props) {
14032
14056
  order,
14033
14057
  giftCode,
14034
14058
  isGift
14035
- } = usePelcro();
14059
+ } = usePelcro$1();
14036
14060
 
14037
14061
  const onSuccess = res => {
14038
14062
  var _props$onSuccess;
@@ -14062,7 +14086,7 @@ function RegisterModal(props) {
14062
14086
 
14063
14087
 
14064
14088
  if (giftCode) {
14065
- return switchToAddressView();
14089
+ return switchView("gift-redeem"); // return switchToAddressView();
14066
14090
  } // Check if the subscription is meant as a gift (if so, gather recipients info)
14067
14091
 
14068
14092
 
@@ -14154,7 +14178,7 @@ function SelectModalWithHook(props) {
14154
14178
  resetView,
14155
14179
  view,
14156
14180
  set
14157
- } = usePelcro();
14181
+ } = usePelcro$1();
14158
14182
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
14159
14183
  const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
14160
14184
  return /*#__PURE__*/React__default['default'].createElement(SelectModalWithTrans, {
@@ -14426,7 +14450,7 @@ class SelectModal extends React.Component {
14426
14450
  const {
14427
14451
  switchToAddressView,
14428
14452
  switchToPaymentView
14429
- } = usePelcro.getStore();
14453
+ } = usePelcro$1.getStore();
14430
14454
 
14431
14455
  if (!isAuthenticated) {
14432
14456
  return setView("register");
@@ -16629,16 +16653,16 @@ const PaymentMethodContainerWithoutStripe = ({
16629
16653
  const {
16630
16654
  t
16631
16655
  } = useTranslation("payment");
16632
- const pelcroStore = usePelcro();
16656
+ const pelcroStore = usePelcro$1();
16633
16657
  const {
16634
16658
  set,
16635
16659
  order,
16636
16660
  selectedPaymentMethodId,
16637
16661
  couponCode
16638
- } = usePelcro();
16662
+ } = usePelcro$1();
16639
16663
  const {
16640
16664
  whenUserReady
16641
- } = usePelcro.getStore();
16665
+ } = usePelcro$1.getStore();
16642
16666
  const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
16643
16667
  const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
16644
16668
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
@@ -18102,11 +18126,11 @@ const PaymentMethodContainerWithoutStripe = ({
18102
18126
 
18103
18127
  if (show) {
18104
18128
  injectCardAuthenticationIframe(source);
18105
- cardAuthContainer.classList.remove("plc-hidden");
18106
- cardAuthContainer.classList.add("plc-flex");
18129
+ cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.classList.remove("plc-hidden");
18130
+ cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.classList.add("plc-flex");
18107
18131
  } else {
18108
- cardAuthContainer.classList.add("plc-hidden");
18109
- cardAuthContainer.classList.remove("plc-flex");
18132
+ cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.classList.add("plc-hidden");
18133
+ cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.classList.remove("plc-flex");
18110
18134
  }
18111
18135
  };
18112
18136
 
@@ -18114,11 +18138,11 @@ const PaymentMethodContainerWithoutStripe = ({
18114
18138
  const cardAuthContainer = document.querySelector(".card-authentication-success-container");
18115
18139
 
18116
18140
  if (show) {
18117
- cardAuthContainer.classList.remove("plc-hidden");
18118
- cardAuthContainer.classList.add("plc-flex");
18141
+ cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.classList.remove("plc-hidden");
18142
+ cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.classList.add("plc-flex");
18119
18143
  } else {
18120
- cardAuthContainer.classList.add("plc-hidden");
18121
- cardAuthContainer.classList.remove("plc-flex");
18144
+ cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.classList.add("plc-hidden");
18145
+ cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.classList.remove("plc-flex");
18122
18146
  }
18123
18147
  };
18124
18148
 
@@ -18129,7 +18153,7 @@ const PaymentMethodContainerWithoutStripe = ({
18129
18153
  const iframe = document.createElement("iframe");
18130
18154
  iframe.src = source !== null && source !== void 0 && (_source$redirect = source.redirect) !== null && _source$redirect !== void 0 && _source$redirect.url ? source.redirect.url : source.threeDSecure_url;
18131
18155
  iframe.style = "position: absolute; width: 100%; height: 100%; left: 0; top: 0; bottom: 0; z-index: 10;";
18132
- cardAuthContainer.appendChild(iframe);
18156
+ cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.appendChild(iframe);
18133
18157
  };
18134
18158
 
18135
18159
  const [state, dispatch] = useReducerWithSideEffects((state, action) => {
@@ -18318,7 +18342,7 @@ const PaymentMethodContainer = props => {
18318
18342
  const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
18319
18343
  const {
18320
18344
  whenUserReady
18321
- } = usePelcro.getStore();
18345
+ } = usePelcro$1.getStore();
18322
18346
  React.useEffect(() => {
18323
18347
  whenUserReady(() => {
18324
18348
  if (!window.Stripe) {
@@ -18419,7 +18443,7 @@ const PelcroPaymentRequestButton = props => {
18419
18443
  const CheckoutForm = () => {
18420
18444
  const {
18421
18445
  selectedPaymentMethodId
18422
- } = usePelcro();
18446
+ } = usePelcro$1();
18423
18447
  const cardProcessor = getSiteCardProcessor();
18424
18448
 
18425
18449
  if (selectedPaymentMethodId) {
@@ -18474,7 +18498,7 @@ const DiscountedPrice = props => {
18474
18498
  const {
18475
18499
  order,
18476
18500
  plan
18477
- } = usePelcro();
18501
+ } = usePelcro$1();
18478
18502
  const isTaxInclusive = (_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tax_inclusive;
18479
18503
  const ecommOrderCurrency = (_order$currency = order === null || order === void 0 ? void 0 : order.currency) !== null && _order$currency !== void 0 ? _order$currency : order === null || order === void 0 ? void 0 : (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency;
18480
18504
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
@@ -18510,7 +18534,7 @@ const SubmitPaymentMethod = ({
18510
18534
 
18511
18535
  const {
18512
18536
  plan
18513
- } = usePelcro();
18537
+ } = usePelcro$1();
18514
18538
  const {
18515
18539
  t
18516
18540
  } = useTranslation("checkoutForm");
@@ -18942,7 +18966,7 @@ const PaypalSubscribeButton = props => {
18942
18966
  plan,
18943
18967
  invoice,
18944
18968
  selectedAddressId
18945
- } = usePelcro();
18969
+ } = usePelcro$1();
18946
18970
  React.useEffect(() => {
18947
18971
  var _ref, _ref2, _state$updatedPrice, _props$plan, _props$selectedAddres;
18948
18972
 
@@ -19084,7 +19108,7 @@ const SelectedPaymentMethod = () => {
19084
19108
  const {
19085
19109
  switchView,
19086
19110
  selectedPaymentMethodId
19087
- } = usePelcro();
19111
+ } = usePelcro$1();
19088
19112
  const paymentMethod = (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : (_window$Pelcro$user$r2 = _window$Pelcro$user$r.sources) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : (_window$Pelcro$user$r3 = _window$Pelcro$user$r2.find) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.call(_window$Pelcro$user$r2, source => {
19089
19113
  return source.id == selectedPaymentMethodId;
19090
19114
  });
@@ -19125,7 +19149,7 @@ const TaxAmount = () => {
19125
19149
  } = React.useContext(store$k);
19126
19150
  const {
19127
19151
  plan
19128
- } = usePelcro();
19152
+ } = usePelcro$1();
19129
19153
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
19130
19154
  const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19131
19155
  const isTaxInclusive = (_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tax_inclusive;
@@ -19271,7 +19295,7 @@ const SubscriptionRenewView = ({
19271
19295
  const {
19272
19296
  product,
19273
19297
  plan
19274
- } = usePelcro();
19298
+ } = usePelcro$1();
19275
19299
  const skipPayment = (_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.skipPaymentForFreePlans;
19276
19300
  const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
19277
19301
 
@@ -19326,7 +19350,7 @@ function SubscriptionRenewModal({
19326
19350
  }) {
19327
19351
  const {
19328
19352
  switchView
19329
- } = usePelcro();
19353
+ } = usePelcro$1();
19330
19354
 
19331
19355
  const onSuccess = res => {
19332
19356
  var _otherProps$onSuccess, _ReactGA$event;
@@ -19531,7 +19555,7 @@ const SubscriptionCancelNowButton = ({
19531
19555
  }) => {
19532
19556
  const {
19533
19557
  switchView
19534
- } = usePelcro();
19558
+ } = usePelcro$1();
19535
19559
  const {
19536
19560
  state: {
19537
19561
  cancelationReason
@@ -19578,7 +19602,7 @@ const SubscriptionCancelNowButton = ({
19578
19602
 
19579
19603
  switchView(null); //Show confirmation alert after closing the modal
19580
19604
 
19581
- notify.confirm((onSuccess, onFailure) => {
19605
+ notify$1.confirm((onSuccess, onFailure) => {
19582
19606
  cancelSubscription(payload, onSuccess, onFailure);
19583
19607
  }, {
19584
19608
  confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
@@ -19603,7 +19627,7 @@ const SubscriptionCancelLaterButton = ({
19603
19627
  }) => {
19604
19628
  const {
19605
19629
  switchView
19606
- } = usePelcro();
19630
+ } = usePelcro$1();
19607
19631
  const {
19608
19632
  state: {
19609
19633
  cancelationReason
@@ -19650,7 +19674,7 @@ const SubscriptionCancelLaterButton = ({
19650
19674
 
19651
19675
  switchView(null); //Show confirmation alert after closing the modal
19652
19676
 
19653
- notify.confirm((onSuccess, onFailure) => {
19677
+ notify$1.confirm((onSuccess, onFailure) => {
19654
19678
  cancelSubscription(payload, onSuccess, onFailure);
19655
19679
  }, {
19656
19680
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -19671,7 +19695,7 @@ const SubscriptionCancelLaterButton = ({
19671
19695
  const SubscriptionCancelView = props => {
19672
19696
  const {
19673
19697
  subscriptionToCancel
19674
- } = usePelcro();
19698
+ } = usePelcro$1();
19675
19699
  const {
19676
19700
  t
19677
19701
  } = useTranslation("subscriptionCancel");
@@ -19845,7 +19869,7 @@ const SubscriptionSuspendButton = ({
19845
19869
  }) => {
19846
19870
  const {
19847
19871
  switchView
19848
- } = usePelcro();
19872
+ } = usePelcro$1();
19849
19873
  const {
19850
19874
  state: {
19851
19875
  suspendDate,
@@ -19887,7 +19911,7 @@ const SubscriptionSuspendButton = ({
19887
19911
 
19888
19912
  switchView(null); //Show confirmation alert after closing the modal
19889
19913
 
19890
- notify.confirm((onSuccess, onFailure) => {
19914
+ notify$1.confirm((onSuccess, onFailure) => {
19891
19915
  suspendSubscription(payload, onSuccess, onFailure);
19892
19916
  }, {
19893
19917
  confirmMessage: t("messages.subCancellation.isSureToSuspendNow"),
@@ -19909,7 +19933,7 @@ const SubscriptionSuspendButton = ({
19909
19933
  const SubscriptionSuspendView = props => {
19910
19934
  const {
19911
19935
  subscriptionToSuspend
19912
- } = usePelcro();
19936
+ } = usePelcro$1();
19913
19937
  const {
19914
19938
  t
19915
19939
  } = useTranslation("subscriptionSuspend");
@@ -20002,7 +20026,7 @@ const getCurrentFlow = () => {
20002
20026
  giftRecipient,
20003
20027
  giftCode,
20004
20028
  invoice
20005
- } = usePelcro.getStore();
20029
+ } = usePelcro$1.getStore();
20006
20030
 
20007
20031
  if (invoice) {
20008
20032
  return "invoicePayment";
@@ -20021,7 +20045,7 @@ const getSuccessContent = i18n => {
20021
20045
  const flow = getCurrentFlow();
20022
20046
  const {
20023
20047
  product
20024
- } = usePelcro.getStore();
20048
+ } = usePelcro$1.getStore();
20025
20049
  const wordingDictionary = {
20026
20050
  subscriptionSuccess: {
20027
20051
  successIcon: /*#__PURE__*/React__default['default'].createElement(SvgCheckSolid, {
@@ -20065,7 +20089,7 @@ function PaymentSuccessModal({
20065
20089
  }) {
20066
20090
  const {
20067
20091
  resetView
20068
- } = usePelcro();
20092
+ } = usePelcro$1();
20069
20093
 
20070
20094
  const onClose = () => {
20071
20095
  var _props$onClose;
@@ -20098,7 +20122,7 @@ function NewsletterWithHook(props) {
20098
20122
  switchView,
20099
20123
  resetView,
20100
20124
  product
20101
- } = usePelcro();
20125
+ } = usePelcro$1();
20102
20126
  return /*#__PURE__*/React__default['default'].createElement(NewsLetter, {
20103
20127
  onClose: () => {
20104
20128
  var _props$onClose;
@@ -20597,7 +20621,7 @@ const MeterView = () => {
20597
20621
  switchView,
20598
20622
  product,
20599
20623
  isAuthenticated
20600
- } = usePelcro();
20624
+ } = usePelcro$1();
20601
20625
  const paywallProduct = product !== null && product !== void 0 ? product : window.Pelcro.paywall.getProduct();
20602
20626
  const visitsLeft = window.Pelcro.paywall.freeVisitsLeft();
20603
20627
  const title = `${paywallProduct === null || paywallProduct === void 0 ? void 0 : (_paywallProduct$paywa = paywallProduct.paywall) === null || _paywallProduct$paywa === void 0 ? void 0 : _paywallProduct$paywa.meter_title}: ${visitsLeft}`;
@@ -20619,7 +20643,7 @@ const MeterView = () => {
20619
20643
  const MeterModal = props => {
20620
20644
  const {
20621
20645
  resetView
20622
- } = usePelcro();
20646
+ } = usePelcro$1();
20623
20647
  React.useEffect(() => {
20624
20648
  var _props$onDisplay;
20625
20649
 
@@ -20657,7 +20681,7 @@ const SubscriptionCreateView = ({
20657
20681
  const {
20658
20682
  product,
20659
20683
  plan
20660
- } = usePelcro();
20684
+ } = usePelcro$1();
20661
20685
  const skipPayment = (_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.skipPaymentForFreePlans;
20662
20686
  const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
20663
20687
 
@@ -20715,7 +20739,7 @@ function SubscriptionCreateModal({
20715
20739
  useTranslation("common");
20716
20740
  const {
20717
20741
  switchView
20718
- } = usePelcro();
20742
+ } = usePelcro$1();
20719
20743
 
20720
20744
  const onSuccess = res => {
20721
20745
  var _otherProps$onSuccess;
@@ -20761,7 +20785,7 @@ const SubscriptionManageMembersContainer = ({
20761
20785
  }) => {
20762
20786
  const {
20763
20787
  subscriptionToManageMembers
20764
- } = usePelcro();
20788
+ } = usePelcro$1();
20765
20789
  const subscription_id = subscriptionToManageMembers === null || subscriptionToManageMembers === void 0 ? void 0 : subscriptionToManageMembers.id;
20766
20790
 
20767
20791
  const handleListMembers = ({}, dispatch) => {
@@ -21056,8 +21080,8 @@ function SubscriptionManageMembersList(props) {
21056
21080
  return {
21057
21081
  title: sub.status,
21058
21082
  content: sub.status,
21059
- textColor: "plc-text-orange-700",
21060
- bgColor: "plc-bg-orange-100",
21083
+ textColor: "plc-text-yellow-500",
21084
+ bgColor: "plc-bg-yellow-100",
21061
21085
  icon: /*#__PURE__*/React__default['default'].createElement(SvgExclamation, null)
21062
21086
  };
21063
21087
  }
@@ -21113,7 +21137,8 @@ function SubscriptionManageMembersList(props) {
21113
21137
  key: member.id,
21114
21138
  className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
21115
21139
  }, /*#__PURE__*/React__default['default'].createElement("td", {
21116
- className: "plc-truncate"
21140
+ className: "plc-truncate plc-text-left",
21141
+ title: member === null || member === void 0 ? void 0 : member.invitation_email
21117
21142
  }, /*#__PURE__*/React__default['default'].createElement("span", {
21118
21143
  className: "plc-font-semibold plc-text-gray-500"
21119
21144
  }, member === null || member === void 0 ? void 0 : member.invitation_email)), /*#__PURE__*/React__default['default'].createElement("td", {
@@ -21167,8 +21192,10 @@ function SubscriptionManageMembersView(props) {
21167
21192
  className: "plc-flex-shrink-0 plc-p-2 plc-text-xs plc-text-gray-400 plc-uppercase"
21168
21193
  }, t("labels.listOfMembers")), /*#__PURE__*/React__default['default'].createElement("hr", {
21169
21194
  className: "plc-w-full plc-border-gray-300"
21170
- })), /*#__PURE__*/React__default['default'].createElement("table", {
21171
- className: "plc-w-full plc-table-fixed"
21195
+ })), /*#__PURE__*/React__default['default'].createElement("div", {
21196
+ className: "plc-max-h-48 plc-overflow-x-hidden plc-overflow-y-auto"
21197
+ }, /*#__PURE__*/React__default['default'].createElement("table", {
21198
+ className: "plc-w-full plc-table-fixed plc-text-center plc-p-2 plc-m-1"
21172
21199
  }, /*#__PURE__*/React__default['default'].createElement("thead", {
21173
21200
  className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
21174
21201
  }, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
@@ -21177,7 +21204,7 @@ function SubscriptionManageMembersView(props) {
21177
21204
  className: "plc-w-3/12 "
21178
21205
  }, t("labels.status")), /*#__PURE__*/React__default['default'].createElement("th", {
21179
21206
  className: "plc-w-3/12 "
21180
- }, t("labels.actions")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement(SubscriptionManageMembersList, null)))))));
21207
+ }, t("labels.actions")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement(SubscriptionManageMembersList, null))))))));
21181
21208
  }
21182
21209
 
21183
21210
  /**
@@ -21206,7 +21233,7 @@ function SubscriptionManageMembersModal({
21206
21233
  }
21207
21234
  SubscriptionManageMembersModal.viewId = "manage-members";
21208
21235
 
21209
- 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;
21236
+ 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, _window$Pelcro$user$r7;
21210
21237
  const initialState$f = {
21211
21238
  email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
21212
21239
  emailError: null,
@@ -21214,10 +21241,12 @@ const initialState$f = {
21214
21241
  firstNameError: null,
21215
21242
  lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
21216
21243
  lastNameError: null,
21217
- displayName: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.display_name,
21218
- phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
21244
+ username: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.username,
21245
+ usernameError: null,
21246
+ displayName: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.display_name,
21247
+ phone: (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.phone,
21219
21248
  phoneError: null,
21220
- tin: (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.tin,
21249
+ tin: (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.tin,
21221
21250
  buttonDisabled: false,
21222
21251
  textFields: {},
21223
21252
  alert: {
@@ -21248,26 +21277,29 @@ const UserUpdateContainer = ({
21248
21277
  }, []);
21249
21278
 
21250
21279
  const loadUserDataIntoFields = () => {
21251
- var _window$Pelcro$user$r7, _window$Pelcro$user$r8, _window$Pelcro$user$r9, _window$Pelcro$user$r10, _window$Pelcro$user$r11, _window$Pelcro$user$r12;
21280
+ var _window$Pelcro$user$r8, _window$Pelcro$user$r9, _window$Pelcro$user$r10, _window$Pelcro$user$r11, _window$Pelcro$user$r12, _window$Pelcro$user$r13, _window$Pelcro$user$r14;
21252
21281
 
21253
21282
  const fields = [{
21254
21283
  type: SET_EMAIL,
21255
- payload: (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.email
21284
+ payload: (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.email
21256
21285
  }, {
21257
21286
  type: SET_FIRST_NAME,
21258
- payload: (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.first_name
21287
+ payload: (_window$Pelcro$user$r9 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r9 === void 0 ? void 0 : _window$Pelcro$user$r9.first_name
21259
21288
  }, {
21260
21289
  type: SET_LAST_NAME,
21261
- payload: (_window$Pelcro$user$r9 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r9 === void 0 ? void 0 : _window$Pelcro$user$r9.last_name
21290
+ payload: (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.last_name
21291
+ }, {
21292
+ type: SET_USERNAME,
21293
+ payload: (_window$Pelcro$user$r11 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r11 === void 0 ? void 0 : _window$Pelcro$user$r11.username
21262
21294
  }, {
21263
21295
  type: SET_DISPLAY_NAME,
21264
- payload: (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.display_name
21296
+ payload: (_window$Pelcro$user$r12 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r12 === void 0 ? void 0 : _window$Pelcro$user$r12.display_name
21265
21297
  }, {
21266
21298
  type: SET_PHONE,
21267
- payload: (_window$Pelcro$user$r11 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r11 === void 0 ? void 0 : _window$Pelcro$user$r11.phone
21299
+ payload: (_window$Pelcro$user$r13 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r13 === void 0 ? void 0 : _window$Pelcro$user$r13.phone
21268
21300
  }, {
21269
21301
  type: SET_TIN,
21270
- payload: (_window$Pelcro$user$r12 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r12 === void 0 ? void 0 : _window$Pelcro$user$r12.tin
21302
+ payload: (_window$Pelcro$user$r14 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r14 === void 0 ? void 0 : _window$Pelcro$user$r14.tin
21271
21303
  }];
21272
21304
  fields.filter(field => Boolean(field.payload)).forEach(field => {
21273
21305
  dispatch(field);
@@ -21278,6 +21310,7 @@ const UserUpdateContainer = ({
21278
21310
  email,
21279
21311
  firstName,
21280
21312
  lastName,
21313
+ username,
21281
21314
  phone,
21282
21315
  tin,
21283
21316
  textFields,
@@ -21288,6 +21321,9 @@ const UserUpdateContainer = ({
21288
21321
  email: email,
21289
21322
  first_name: firstName,
21290
21323
  last_name: lastName,
21324
+ ...(username && {
21325
+ username
21326
+ }),
21291
21327
  display_name: displayName,
21292
21328
  phone: phone,
21293
21329
  tin: tin,
@@ -21373,6 +21409,18 @@ const UserUpdateContainer = ({
21373
21409
  lastName: ""
21374
21410
  });
21375
21411
 
21412
+ case SET_USERNAME:
21413
+ return lib_7({ ...state,
21414
+ username: action.payload,
21415
+ usernameError: null
21416
+ });
21417
+
21418
+ case SET_USERNAME_ERROR:
21419
+ return lib_7({ ...state,
21420
+ usernameError: action.payload,
21421
+ username: ""
21422
+ });
21423
+
21376
21424
  case SET_PHONE:
21377
21425
  return lib_7({ ...state,
21378
21426
  phone: action.payload,
@@ -21418,10 +21466,14 @@ const UserUpdateContainer = ({
21418
21466
  state,
21419
21467
  dispatch
21420
21468
  }
21421
- }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
21422
- store: store$f,
21423
- key: i
21424
- })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
21469
+ }, children.length ? children.map((child, i) => {
21470
+ if (child) {
21471
+ return /*#__PURE__*/React__default['default'].cloneElement(child, {
21472
+ store: store$f,
21473
+ key: i
21474
+ });
21475
+ }
21476
+ }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
21425
21477
  store: store$f
21426
21478
  })));
21427
21479
  };
@@ -21529,6 +21581,84 @@ const UserUpdateButton = ({
21529
21581
  }, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
21530
21582
  };
21531
21583
 
21584
+ function UpdateUserNameInput({
21585
+ initWithUserName = true,
21586
+ store,
21587
+ ...otherProps
21588
+ }) {
21589
+ const {
21590
+ t
21591
+ } = useTranslation("common");
21592
+ const {
21593
+ dispatch,
21594
+ state: {
21595
+ username: stateUsername,
21596
+ usernameError
21597
+ }
21598
+ } = React.useContext(store);
21599
+ const [username, setUsername] = React.useState(stateUsername);
21600
+ const [finishedTyping, setFinishedTyping] = React.useState(false);
21601
+ const handleInputChange = React.useCallback(value => {
21602
+ setUsername(value);
21603
+
21604
+ if (finishedTyping) {
21605
+ if (username !== null && username !== void 0 && username.length) {
21606
+ dispatch({
21607
+ type: SET_USERNAME,
21608
+ payload: username
21609
+ });
21610
+ } else {
21611
+ if (otherProps.required) {
21612
+ dispatch({
21613
+ type: SET_USERNAME_ERROR,
21614
+ payload: t("validation.enterUsername")
21615
+ });
21616
+ } else {
21617
+ dispatch({
21618
+ type: SET_USERNAME,
21619
+ payload: username
21620
+ });
21621
+ }
21622
+ }
21623
+ }
21624
+ }, [dispatch, username, finishedTyping]);
21625
+ React.useEffect(() => {
21626
+ handleInputChange(username);
21627
+ }, [finishedTyping, username, handleInputChange]); // Initialize username field with user's username
21628
+
21629
+ const loadFirstNameIntoField = () => {
21630
+ handleInputChange(window.Pelcro.user.read().username);
21631
+ dispatch({
21632
+ type: SET_USERNAME,
21633
+ payload: window.Pelcro.user.read().username
21634
+ });
21635
+ };
21636
+
21637
+ React.useEffect(() => {
21638
+ if (initWithUserName) {
21639
+ document.addEventListener("PelcroUserLoaded", () => {
21640
+ loadFirstNameIntoField();
21641
+ });
21642
+ loadFirstNameIntoField();
21643
+ return () => {
21644
+ document.removeEventListener("PelcroUserLoaded", handleInputChange);
21645
+ };
21646
+ }
21647
+ }, []);
21648
+ return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
21649
+ type: "text",
21650
+ error: usernameError,
21651
+ value: username,
21652
+ onChange: e => handleInputChange(e.target.value),
21653
+ onBlur: () => setFinishedTyping(true),
21654
+ onFocus: () => setFinishedTyping(false)
21655
+ }, otherProps));
21656
+ }
21657
+
21658
+ const UserUpdateUsername = props => /*#__PURE__*/React__default['default'].createElement(UpdateUserNameInput, Object.assign({
21659
+ store: store$f
21660
+ }, props));
21661
+
21532
21662
  const UserUpdateFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
21533
21663
  store: store$f
21534
21664
  }, props));
@@ -21628,13 +21758,45 @@ const UserUpdateTin = props => /*#__PURE__*/React__default['default'].createElem
21628
21758
  store: store$f
21629
21759
  }, props));
21630
21760
 
21761
+ function DisplayName({
21762
+ store,
21763
+ ...otherProps
21764
+ }) {
21765
+ const {
21766
+ dispatch,
21767
+ state
21768
+ } = React.useContext(store);
21769
+
21770
+ const handleInputChange = value => {
21771
+ dispatch({
21772
+ type: SET_DISPLAY_NAME,
21773
+ payload: value
21774
+ });
21775
+ };
21776
+
21777
+ if (state.loading) {
21778
+ return /*#__PURE__*/React__default['default'].createElement(Loader, null);
21779
+ }
21780
+
21781
+ return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
21782
+ type: "text",
21783
+ value: state.displayName || null,
21784
+ onChange: e => handleInputChange(e.target.value)
21785
+ }, otherProps));
21786
+ }
21787
+
21788
+ const UserUpdateDisplayName = props => /*#__PURE__*/React__default['default'].createElement(DisplayName, Object.assign({
21789
+ store: store$f
21790
+ }, props));
21791
+
21631
21792
  const UserUpdateView = props => {
21632
- var _window$Pelcro$site$r;
21793
+ var _window$Pelcro$site$r, _window$Pelcro, _window$Pelcro$uiSett;
21633
21794
 
21634
21795
  const {
21635
21796
  t
21636
21797
  } = useTranslation("userEdit");
21637
21798
  const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
21799
+ const showUsernameInput = (_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.enableLoginWithUsername;
21638
21800
  return /*#__PURE__*/React__default['default'].createElement("div", {
21639
21801
  id: "pelcro-user-update-view"
21640
21802
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -21662,7 +21824,17 @@ const UserUpdateView = props => {
21662
21824
  errorId: "pelcro-input-last-name-error",
21663
21825
  label: t("labels.lastName"),
21664
21826
  required: supportsTap ? true : false
21665
- })), /*#__PURE__*/React__default['default'].createElement("div", {
21827
+ })), /*#__PURE__*/React__default['default'].createElement(UserUpdateDisplayName, {
21828
+ id: "pelcro-input-display-name",
21829
+ autoComplete: "display-name",
21830
+ errorId: "pelcro-input-display-name-error",
21831
+ label: t("labels.displayname")
21832
+ }), showUsernameInput && /*#__PURE__*/React__default['default'].createElement(UserUpdateUsername, {
21833
+ id: "pelcro-input-user-name",
21834
+ autoComplete: "user-name",
21835
+ errorId: "pelcro-input-user-name-error",
21836
+ label: t("labels.username")
21837
+ }), /*#__PURE__*/React__default['default'].createElement("div", {
21666
21838
  className: "plc-flex plc-items-start"
21667
21839
  }, /*#__PURE__*/React__default['default'].createElement(UserUpdatePhone, {
21668
21840
  id: "pelcro-input-phone",
@@ -21693,7 +21865,7 @@ function UserUpdateModal({
21693
21865
  }) {
21694
21866
  const {
21695
21867
  switchView
21696
- } = usePelcro();
21868
+ } = usePelcro$1();
21697
21869
 
21698
21870
  const onPictureClick = () => {
21699
21871
  switchView("profile-picture");
@@ -21709,37 +21881,6 @@ function UserUpdateModal({
21709
21881
  }
21710
21882
  UserUpdateModal.viewId = "user-edit";
21711
21883
 
21712
- function DisplayName({
21713
- store,
21714
- ...otherProps
21715
- }) {
21716
- const {
21717
- dispatch,
21718
- state
21719
- } = React.useContext(store);
21720
-
21721
- const handleInputChange = value => {
21722
- dispatch({
21723
- type: SET_DISPLAY_NAME,
21724
- payload: value
21725
- });
21726
- };
21727
-
21728
- if (state.loading) {
21729
- return /*#__PURE__*/React__default['default'].createElement(Loader, null);
21730
- }
21731
-
21732
- return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
21733
- type: "text",
21734
- value: state.displayName || null,
21735
- onChange: e => handleInputChange(e.target.value)
21736
- }, otherProps));
21737
- }
21738
-
21739
- const UserUpdateDisplayName = props => /*#__PURE__*/React__default['default'].createElement(DisplayName, Object.assign({
21740
- store: store$f
21741
- }, props));
21742
-
21743
21884
  const UserUpdateTextInput = props => {
21744
21885
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
21745
21886
  store: store$f
@@ -21802,7 +21943,7 @@ const AddressCreateContainer = ({
21802
21943
  order,
21803
21944
  set,
21804
21945
  selectedMembership
21805
- } = usePelcro();
21946
+ } = usePelcro$1();
21806
21947
  const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
21807
21948
  const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
21808
21949
  React.useEffect(() => {
@@ -21907,7 +22048,7 @@ const AddressCreateContainer = ({
21907
22048
  return onFailure(err);
21908
22049
  }
21909
22050
 
21910
- notify.success(t("messages.addressUpdated"));
22051
+ notify$1.success(t("messages.addressUpdated"));
21911
22052
  return onMembershipAdressUpdateSuccess(res);
21912
22053
  });
21913
22054
  }
@@ -22559,7 +22700,7 @@ const AddressCreateModal = ({
22559
22700
  switchView,
22560
22701
  switchToPaymentView,
22561
22702
  resetView
22562
- } = usePelcro();
22703
+ } = usePelcro$1();
22563
22704
 
22564
22705
  const onSuccess = newAddressId => {
22565
22706
  var _otherProps$onSuccess;
@@ -22652,7 +22793,7 @@ const AddressUpdateContainer = ({
22652
22793
 
22653
22794
  const {
22654
22795
  addressIdToEdit
22655
- } = usePelcro();
22796
+ } = usePelcro$1();
22656
22797
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
22657
22798
  const [t] = useTranslation("address");
22658
22799
  React.useEffect(() => {
@@ -23743,7 +23884,7 @@ const PasswordForgotModal = ({
23743
23884
  } = useTranslation("passwordForgot");
23744
23885
  const {
23745
23886
  switchView
23746
- } = usePelcro();
23887
+ } = usePelcro$1();
23747
23888
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
23748
23889
  id: "pelcro-password-forgot-modal",
23749
23890
  onDisplay: onDisplay,
@@ -24328,7 +24469,7 @@ const CartContainer = ({
24328
24469
  const {
24329
24470
  cartItems,
24330
24471
  set
24331
- } = usePelcro();
24472
+ } = usePelcro$1();
24332
24473
  const {
24333
24474
  t
24334
24475
  } = useTranslation("shop");
@@ -24433,7 +24574,7 @@ const CartRemoveItemButton = ({
24433
24574
  }) => {
24434
24575
  const {
24435
24576
  removeFromCart
24436
- } = usePelcro();
24577
+ } = usePelcro$1();
24437
24578
  return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
24438
24579
  variant: "icon",
24439
24580
  "data-key": itemId,
@@ -24496,7 +24637,7 @@ const CartTotalPrice = () => {
24496
24637
  } = React.useContext(store$8);
24497
24638
  const {
24498
24639
  cartItems
24499
- } = usePelcro();
24640
+ } = usePelcro$1();
24500
24641
  const totalPriceCurrency = cartItems[0].currency;
24501
24642
  const {
24502
24643
  t
@@ -24516,7 +24657,7 @@ const CartTotalPrice = () => {
24516
24657
  const CartView = props => {
24517
24658
  const {
24518
24659
  cartItems
24519
- } = usePelcro();
24660
+ } = usePelcro$1();
24520
24661
  const {
24521
24662
  t
24522
24663
  } = useTranslation("cart");
@@ -24577,7 +24718,7 @@ const CartModal = ({
24577
24718
  switchView,
24578
24719
  switchToAddressView,
24579
24720
  isAuthenticated
24580
- } = usePelcro();
24721
+ } = usePelcro$1();
24581
24722
 
24582
24723
  const onSuccess = items => {
24583
24724
  var _otherProps$onSuccess;
@@ -24609,7 +24750,7 @@ const ShopSelectProductButton = ({
24609
24750
  }) => {
24610
24751
  const {
24611
24752
  addToCart
24612
- } = usePelcro();
24753
+ } = usePelcro$1();
24613
24754
  const {
24614
24755
  t
24615
24756
  } = useTranslation("shop");
@@ -24641,7 +24782,7 @@ const ShopPurchaseButton = ({
24641
24782
  }) => {
24642
24783
  const {
24643
24784
  purchaseItem
24644
- } = usePelcro();
24785
+ } = usePelcro$1();
24645
24786
  const {
24646
24787
  t
24647
24788
  } = useTranslation("shop");
@@ -24677,7 +24818,7 @@ const ShopView = () => {
24677
24818
  className: "plc-mt-2"
24678
24819
  }), /*#__PURE__*/React__default['default'].createElement(ShopPurchaseButton, {
24679
24820
  itemId: item.id,
24680
- className: "plc-mt-2"
24821
+ className: "plc-mt-2 pelcro-purchase-button"
24681
24822
  })));
24682
24823
  })));
24683
24824
  };
@@ -24717,7 +24858,7 @@ const OrderCreateModal = ({
24717
24858
  }) => {
24718
24859
  const {
24719
24860
  switchView
24720
- } = usePelcro();
24861
+ } = usePelcro$1();
24721
24862
 
24722
24863
  const onSuccess = () => {
24723
24864
  var _otherProps$onSuccess;
@@ -24747,7 +24888,7 @@ const OrderConfirmModal = props => {
24747
24888
  } = useTranslation("shop");
24748
24889
  const {
24749
24890
  resetView
24750
- } = usePelcro();
24891
+ } = usePelcro$1();
24751
24892
 
24752
24893
  const onClose = () => {
24753
24894
  var _props$onClose;
@@ -24839,7 +24980,7 @@ const GiftCreateContainer = ({
24839
24980
  } = useTranslation("register");
24840
24981
  const {
24841
24982
  set
24842
- } = usePelcro();
24983
+ } = usePelcro$1();
24843
24984
 
24844
24985
  const handleSubmit = (state, dispatch) => {
24845
24986
  const giftRecipient = {
@@ -25131,7 +25272,7 @@ const GiftCreateModal = ({
25131
25272
  switchToAddressView,
25132
25273
  switchToPaymentView,
25133
25274
  product
25134
- } = usePelcro();
25275
+ } = usePelcro$1();
25135
25276
 
25136
25277
  const onSuccess = giftRecipient => {
25137
25278
  var _otherProps$onSuccess;
@@ -25159,6 +25300,7 @@ const GiftCreateModal = ({
25159
25300
  GiftCreateModal.viewId = "gift-create";
25160
25301
 
25161
25302
  const initialState$6 = {
25303
+ isSubmitting: false,
25162
25304
  giftCode: "",
25163
25305
  buttonDisabled: true,
25164
25306
  alert: {
@@ -25177,14 +25319,24 @@ const GiftRedeemContainer = ({
25177
25319
  onSuccess = () => {},
25178
25320
  onFailure = () => {},
25179
25321
  onDisplay = () => {},
25180
- children
25322
+ children,
25323
+ ...props
25181
25324
  }) => {
25325
+ var _ref, _props$subscriptionId;
25326
+
25182
25327
  const {
25183
25328
  t
25184
25329
  } = useTranslation("register");
25185
25330
  const {
25186
25331
  set
25187
- } = usePelcro();
25332
+ } = usePelcro$1();
25333
+ const {
25334
+ switchView,
25335
+ switchToAddressView,
25336
+ isAuthenticated,
25337
+ subscriptionIdToRenew: subscriptionIdToRenewFromStore
25338
+ } = usePelcro$1();
25339
+ const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
25188
25340
  React.useEffect(() => {
25189
25341
  onDisplay();
25190
25342
  }, []);
@@ -25205,7 +25357,41 @@ const GiftRedeemContainer = ({
25205
25357
  set({
25206
25358
  giftCode
25207
25359
  });
25208
- onSuccess(giftCode);
25360
+
25361
+ if (!isAuthenticated()) {
25362
+ switchView("register");
25363
+ } else {
25364
+ console.log("Shaker");
25365
+ window.Pelcro.subscription.redeemGift({
25366
+ auth_token: window.Pelcro.user.read().auth_token,
25367
+ gift_code: giftCode,
25368
+ // redeem gift as a future phase of an existing subscription
25369
+ subscription_id: subscriptionIdToRenew
25370
+ }, (err, res) => {
25371
+ dispatch({
25372
+ type: LOADING,
25373
+ payload: false
25374
+ });
25375
+
25376
+ if (err) {
25377
+ dispatch({
25378
+ type: SHOW_ALERT,
25379
+ payload: {
25380
+ type: "error",
25381
+ content: getErrorMessages(err)
25382
+ }
25383
+ });
25384
+
25385
+ if (getErrorMessages(err) === "Address ID is required") {
25386
+ switchToAddressView();
25387
+ } else {
25388
+ return onFailure(err);
25389
+ }
25390
+ } else {
25391
+ return onSuccess(giftCode);
25392
+ }
25393
+ });
25394
+ }
25209
25395
  }
25210
25396
  };
25211
25397
 
@@ -25226,8 +25412,14 @@ const GiftRedeemContainer = ({
25226
25412
  buttonDisabled: action.payload
25227
25413
  });
25228
25414
 
25415
+ case LOADING:
25416
+ return lib_7({ ...state,
25417
+ isSubmitting: action.payload
25418
+ });
25419
+
25229
25420
  case HANDLE_SUBMIT:
25230
25421
  return lib_5({ ...state,
25422
+ isSubmitting: true,
25231
25423
  buttonDisabled: true
25232
25424
  }, (state, dispatch) => handleRedeem(state, dispatch));
25233
25425
 
@@ -25296,7 +25488,8 @@ const GiftRedeemSubmitButton = ({
25296
25488
  const {
25297
25489
  dispatch,
25298
25490
  state: {
25299
- disableSubmit
25491
+ disableSubmit,
25492
+ isSubmitting
25300
25493
  }
25301
25494
  } = React.useContext(store$6);
25302
25495
  const {
@@ -25309,7 +25502,8 @@ const GiftRedeemSubmitButton = ({
25309
25502
  });
25310
25503
  onClick === null || onClick === void 0 ? void 0 : onClick();
25311
25504
  },
25312
- disabled: disableSubmit
25505
+ disabled: disableSubmit,
25506
+ isLoading: isSubmitting
25313
25507
  }, otherProps), name !== null && name !== void 0 ? name : t("redeem.buttons.redeem"));
25314
25508
  };
25315
25509
 
@@ -25354,18 +25548,13 @@ const GiftRedeemModal = ({
25354
25548
  switchView,
25355
25549
  switchToAddressView,
25356
25550
  isAuthenticated
25357
- } = usePelcro();
25551
+ } = usePelcro$1();
25358
25552
 
25359
25553
  const onSuccess = giftCode => {
25360
25554
  var _otherProps$onSuccess;
25361
25555
 
25362
25556
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, giftCode);
25363
-
25364
- if (isAuthenticated()) {
25365
- switchToAddressView();
25366
- } else {
25367
- switchView("register");
25368
- }
25557
+ switchView("subscription-success");
25369
25558
  };
25370
25559
 
25371
25560
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -25426,7 +25615,7 @@ const AddressSelectContainer = ({
25426
25615
  subscriptionIdToRenew: subscriptionIdToRenewFromStore,
25427
25616
  set,
25428
25617
  selectedMembership
25429
- } = usePelcro();
25618
+ } = usePelcro$1();
25430
25619
  const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
25431
25620
  const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
25432
25621
 
@@ -25463,7 +25652,7 @@ const AddressSelectContainer = ({
25463
25652
  return onFailure(err);
25464
25653
  }
25465
25654
 
25466
- notify.success(t("messages.addressUpdated"));
25655
+ notify$1.success(t("messages.addressUpdated"));
25467
25656
  return onMembershipAdressUpdateSuccess(res);
25468
25657
  });
25469
25658
  }
@@ -25668,7 +25857,7 @@ const AddressSelectModal = ({
25668
25857
  switchView,
25669
25858
  switchToPaymentView,
25670
25859
  resetView
25671
- } = usePelcro();
25860
+ } = usePelcro$1();
25672
25861
 
25673
25862
  const onSuccess = selectedAddressId => {
25674
25863
  var _otherProps$onSuccess;
@@ -25746,7 +25935,7 @@ const PaymentMethodSelectContainer = ({
25746
25935
  const {
25747
25936
  set,
25748
25937
  selectedPaymentMethodId: selectedPaymentMethodIdFromStore
25749
- } = usePelcro();
25938
+ } = usePelcro$1();
25750
25939
 
25751
25940
  const submitPaymentMethod = ({
25752
25941
  selectedPaymentMethodId
@@ -25929,7 +26118,7 @@ const PaymentMethodSelectModal = ({
25929
26118
  switchToCheckoutForm,
25930
26119
  set,
25931
26120
  plan
25932
- } = usePelcro();
26121
+ } = usePelcro$1();
25933
26122
  const skipPayment = (_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.skipPaymentForFreePlans;
25934
26123
  React.useEffect(() => {
25935
26124
  if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
@@ -27237,7 +27426,7 @@ const SavedItems = ({
27237
27426
  const [isLoading, setLoading] = React.useState(false);
27238
27427
  const {
27239
27428
  isAuthenticated
27240
- } = usePelcro();
27429
+ } = usePelcro$1();
27241
27430
 
27242
27431
  const removeItemFromMetadata = (category, title) => {
27243
27432
  const user = window.Pelcro.user.read();
@@ -27436,7 +27625,7 @@ const SubscriptionsItems = ({
27436
27625
  setSubscriptionToCancel,
27437
27626
  setSubscriptionToSuspend,
27438
27627
  set
27439
- } = usePelcro();
27628
+ } = usePelcro$1();
27440
27629
  const subs = getNonDonationSubs();
27441
27630
  if (subs.length === 0) return null;
27442
27631
  return subs.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
@@ -27457,7 +27646,7 @@ const SubscriptionsItems = ({
27457
27646
  }
27458
27647
 
27459
27648
  onClose === null || onClose === void 0 ? void 0 : onClose();
27460
- notify.confirm((onSuccess, onFailure) => {
27649
+ notify$1.confirm((onSuccess, onFailure) => {
27461
27650
  cancelSubscription(sub.id, onSuccess, onFailure);
27462
27651
  }, {
27463
27652
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -27515,7 +27704,7 @@ const SubscriptionsItems = ({
27515
27704
  }
27516
27705
 
27517
27706
  onClose === null || onClose === void 0 ? void 0 : onClose();
27518
- notify.confirm((onSuccess, onFailure) => {
27707
+ notify$1.confirm((onSuccess, onFailure) => {
27519
27708
  unSuspendSubscription(sub.id, onSuccess, onFailure);
27520
27709
  }, {
27521
27710
  confirmMessage: t("messages.subUnSuspend.isSureToUnSuspend"),
@@ -27961,11 +28150,56 @@ function SvgQrcode(props) {
27961
28150
  })));
27962
28151
  }
27963
28152
 
27964
- const DonationsMenu = () => {
28153
+ const DonationsMenu = ({
28154
+ reactivateSubscription,
28155
+ disableSubmit,
28156
+ cancelSubscription
28157
+ }) => {
27965
28158
  const {
27966
28159
  t
27967
28160
  } = useTranslation("dashboard");
28161
+ const {
28162
+ switchView,
28163
+ setSubscriptionToCancel
28164
+ } = usePelcro$1();
27968
28165
  const subscriptions = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
28166
+ // Cancel button click handlers
28167
+ const onCancelClick = () => {
28168
+ var _onClose;
28169
+
28170
+ const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
28171
+
28172
+ if (isImmediateCancelationEnabled) {
28173
+ setSubscriptionToCancel(sub.id);
28174
+ return switchView("subscription-cancel");
28175
+ }
28176
+
28177
+ if (userMustVerifyEmail()) {
28178
+ return switchView("email-verify");
28179
+ }
28180
+
28181
+ (_onClose = onClose) === null || _onClose === void 0 ? void 0 : _onClose();
28182
+ notify.confirm((onSuccess, onFailure) => {
28183
+ cancelSubscription(sub.id, onSuccess, onFailure);
28184
+ }, {
28185
+ confirmMessage: t("messages.subCancellation.isSureToCancel"),
28186
+ loadingMessage: t("messages.subCancellation.loading"),
28187
+ successMessage: t("messages.subCancellation.success"),
28188
+ errorMessage: t("messages.subCancellation.error")
28189
+ }, {
28190
+ closeButtonLabel: t("labels.subCancellation.goBack")
28191
+ });
28192
+ }; // Reactivate button click handlers
28193
+
28194
+
28195
+ const onReactivateClick = () => {
28196
+ if (userMustVerifyEmail()) {
28197
+ return switchView("email-verify");
28198
+ }
28199
+
28200
+ reactivateSubscription(sub.id);
28201
+ };
28202
+
27969
28203
  return /*#__PURE__*/React__default['default'].createElement("tr", {
27970
28204
  key: sub.id,
27971
28205
  className: "plc-w-full plc-align-top pelcro-donation-row"
@@ -27977,7 +28211,21 @@ const DonationsMenu = () => {
27977
28211
  className: "plc-text-xs plc-text-gray-400 pelcro-donation-price"
27978
28212
  }, getFormattedPriceByLocal(sub.plan.amount * sub.quantity, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("div", {
27979
28213
  className: "plc-mb-4 plc-text-gray-500 pelcro-donation-date"
27980
- }, sub.status && /*#__PURE__*/React__default['default'].createElement("span", null, formatStartDate(sub.start)))));
28214
+ }, sub.status && /*#__PURE__*/React__default['default'].createElement("span", null, formatStartDate(sub.start)))), /*#__PURE__*/React__default['default'].createElement("td", null, sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
28215
+ variant: "ghost",
28216
+ className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
28217
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
28218
+ onClick: onReactivateClick,
28219
+ disabled: disableSubmit,
28220
+ "data-key": sub.id
28221
+ }, t("labels.reactivate")), !sub.plan.auto_renew || sub.plan.auto_renew && sub.cancel_at_period_end === 0 ? /*#__PURE__*/React__default['default'].createElement(Button, {
28222
+ variant: "ghost",
28223
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
28224
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
28225
+ onClick: onCancelClick,
28226
+ disabled: disableSubmit,
28227
+ "data-key": sub.id
28228
+ }, t("labels.unsubscribe")) : ""));
27981
28229
  });
27982
28230
  return /*#__PURE__*/React__default['default'].createElement("table", {
27983
28231
  className: "plc-w-full plc-table-fixed pelcro-donations-table"
@@ -27987,7 +28235,9 @@ const DonationsMenu = () => {
27987
28235
  className: "plc-w-6/12 "
27988
28236
  }, t("labels.plan")), /*#__PURE__*/React__default['default'].createElement("th", {
27989
28237
  className: "plc-w-6/12 "
27990
- }, t("labels.startDate")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
28238
+ }, t("labels.startDate")), /*#__PURE__*/React__default['default'].createElement("th", {
28239
+ className: "plc-w-3/12 "
28240
+ }, t("labels.actions")))), /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", {
27991
28241
  className: "plc-h-4"
27992
28242
  }), subscriptions));
27993
28243
  };
@@ -28033,7 +28283,7 @@ const InvoicesItems = () => {
28033
28283
  const {
28034
28284
  setInvoice,
28035
28285
  switchView
28036
- } = usePelcro();
28286
+ } = usePelcro$1();
28037
28287
  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 : [];
28038
28288
 
28039
28289
  const showInvoiceDetails = event => {
@@ -28164,7 +28414,7 @@ const MembershipsItems = () => {
28164
28414
  switchView,
28165
28415
  setSelectedMembership,
28166
28416
  switchToAddressView
28167
- } = usePelcro();
28417
+ } = usePelcro$1();
28168
28418
  const memberships = getActiveMemberships();
28169
28419
 
28170
28420
  const onChangeAddressClick = membershipId => {
@@ -28244,7 +28494,7 @@ function DashboardWithHook(props) {
28244
28494
  resetView,
28245
28495
  logout,
28246
28496
  set
28247
- } = usePelcro();
28497
+ } = usePelcro$1();
28248
28498
  return /*#__PURE__*/React__default['default'].createElement(DashboardWithTrans, {
28249
28499
  setAddress: addressIdToEdit => set({
28250
28500
  addressIdToEdit
@@ -28820,7 +29070,11 @@ class Dashboard extends React.Component {
28820
29070
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
28821
29071
  }),
28822
29072
  title: this.locale("labels.donations"),
28823
- content: /*#__PURE__*/React__default['default'].createElement(DonationsMenu, null)
29073
+ content: /*#__PURE__*/React__default['default'].createElement(DonationsMenu, {
29074
+ reactivateSubscription: this.reactivateSubscription,
29075
+ disableSubmit: this.state.disableSubmit,
29076
+ cancelSubscription: this.cancelSubscription
29077
+ })
28824
29078
  }), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
28825
29079
  name: SUB_MENUS.GIFTS,
28826
29080
  icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, null),
@@ -28880,7 +29134,7 @@ const DashboardWithTrans = withTranslation("dashboard")(Dashboard);
28880
29134
  const DashboardOpenButton = () => {
28881
29135
  const {
28882
29136
  switchView
28883
- } = usePelcro();
29137
+ } = usePelcro$1();
28884
29138
  return /*#__PURE__*/React__default['default'].createElement("div", {
28885
29139
  className: "plc-fixed plc-right-4 plc-bottom-4 pelcro-open-dashboard-btn"
28886
29140
  }, /*#__PURE__*/React__default['default'].createElement("button", {
@@ -30869,11 +31123,34 @@ const EmailVerifyModal = ({
30869
31123
  onClose,
30870
31124
  ...otherProps
30871
31125
  }) => {
31126
+ const {
31127
+ product,
31128
+ plan,
31129
+ switchToAddressView,
31130
+ switchToPaymentView
31131
+ } = usePelcro();
31132
+
31133
+ const onSuccess = res => {
31134
+ var _props$onSuccess, _props;
31135
+
31136
+ (_props$onSuccess = (_props = props).onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(_props, res);
31137
+
31138
+ if (product) {
31139
+ if (product.address_required) {
31140
+ return switchToAddressView();
31141
+ } else {
31142
+ return switchToPaymentView();
31143
+ }
31144
+ }
31145
+ };
31146
+
30872
31147
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
30873
31148
  onDisplay: onDisplay,
30874
31149
  onClose: onClose,
30875
31150
  id: "pelcro-email-verify-modal"
30876
- }, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(EmailVerifyView, otherProps)), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
31151
+ }, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(EmailVerifyView, Object.assign({
31152
+ onSuccess: onSuccess
31153
+ }, otherProps))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
30877
31154
  };
30878
31155
  EmailVerifyModal.viewId = "email-verify";
30879
31156
 
@@ -31021,14 +31298,14 @@ function VerifyLinkTokenModal({
31021
31298
  } = useTranslation("verifyLinkToken");
31022
31299
  const {
31023
31300
  resetView
31024
- } = usePelcro();
31301
+ } = usePelcro$1();
31025
31302
 
31026
31303
  const onSuccess = res => {
31027
31304
  var _props$onSuccess;
31028
31305
 
31029
31306
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
31030
31307
  resetView();
31031
- notify.success(t("messages.success"));
31308
+ notify$1.success(t("messages.success"));
31032
31309
  };
31033
31310
 
31034
31311
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -31071,7 +31348,7 @@ const InvoicePaymentModal = ({
31071
31348
  }) => {
31072
31349
  const {
31073
31350
  switchView
31074
- } = usePelcro();
31351
+ } = usePelcro$1();
31075
31352
 
31076
31353
  const onSuccess = () => {
31077
31354
  var _otherProps$onSuccess;
@@ -31148,7 +31425,7 @@ const InvoiceDetailsDownloadButton = ({
31148
31425
  } = useTranslation("invoiceDetails");
31149
31426
  const {
31150
31427
  invoice
31151
- } = usePelcro();
31428
+ } = usePelcro$1();
31152
31429
  return /*#__PURE__*/React__default['default'].createElement(Link, Object.assign({
31153
31430
  className: `plc-px-6 plc-py-2 plc-uppercase plc-bg-transparent plc-text-primary-500 plc-border plc-border-primary-500 plc-rounded focus:plc-outline-none focus:plc-ring-2 focus:plc-ring-primary-300 plc-tracking-wider hover:plc-bg-primary-600 focus:plc-bg-primary-600 hover:plc-text-white focus:plc-text-white hover:plc-shadow-none plc-no-underline ${className}`,
31154
31431
  id: "pelcro-download-invoice-link",
@@ -31185,7 +31462,7 @@ const InvoiceDetailsView = props => {
31185
31462
  } = useTranslation("invoiceDetails");
31186
31463
  const {
31187
31464
  invoice
31188
- } = usePelcro();
31465
+ } = usePelcro$1();
31189
31466
  const showPayButton = canPayInvoice(invoice);
31190
31467
  const showDownloadButton = Boolean(invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf);
31191
31468
  const hasPlanDetails = Boolean(invoice.plan);
@@ -31253,7 +31530,7 @@ const InvoiceDetailsModal = ({
31253
31530
  }) => {
31254
31531
  const {
31255
31532
  switchToPaymentView
31256
- } = usePelcro();
31533
+ } = usePelcro$1();
31257
31534
 
31258
31535
  const onSuccess = () => {
31259
31536
  var _otherProps$onSuccess;
@@ -32911,6 +33188,7 @@ exports.UserUpdatePhone = UserUpdatePhone;
32911
33188
  exports.UserUpdateProfilePic = UserUpdateProfilePic;
32912
33189
  exports.UserUpdateTextInput = UserUpdateTextInput;
32913
33190
  exports.UserUpdateTin = UserUpdateTin;
33191
+ exports.UserUpdateUsername = UserUpdateUsername;
32914
33192
  exports.UserUpdateView = UserUpdateView;
32915
33193
  exports.VerifyLinkTokenContainer = VerifyLinkTokenContainer;
32916
33194
  exports.VerifyLinkTokenLoader = VerifyLinkTokenLoader;
@@ -32921,6 +33199,6 @@ exports.i18n = i18next;
32921
33199
  exports.initButtons = init$1;
32922
33200
  exports.initContentEntitlement = init;
32923
33201
  exports.invoicePaymentSubmitButton = invoicePaymentSubmitButton;
32924
- exports.notify = notify;
33202
+ exports.notify = notify$1;
32925
33203
  exports.unauthenticatedButtons = unauthenticatedButtons;
32926
- exports.usePelcro = usePelcro;
33204
+ exports.usePelcro = usePelcro$1;