@pelcro/react-pelcro-js 3.13.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,19 @@ const init$1 = () => {
10365
10373
  addToCart,
10366
10374
  purchaseItem,
10367
10375
  setSubscriptionToManageMembers
10368
- } = usePelcro.getStore();
10376
+ } = usePelcro$1.getStore();
10377
+ const pelcroDashboardButtonsByClass = document.getElementsByClassName("pelcro-dashboard-button");
10378
+
10379
+ if (pelcroDashboardButtonsByClass.length !== 0) {
10380
+ for (let i = 0; i < pelcroDashboardButtonsByClass.length; i++) {
10381
+ pelcroDashboardButtonsByClass[i].addEventListener("click", () => {
10382
+ if (isAuthenticated()) {
10383
+ switchView("dashboard");
10384
+ }
10385
+ });
10386
+ }
10387
+ }
10388
+
10369
10389
  const pelcroLoginButtonsByClass = document.getElementsByClassName("pelcro-login-button");
10370
10390
 
10371
10391
  if (pelcroLoginButtonsByClass.length !== 0) {
@@ -10407,7 +10427,7 @@ const init$1 = () => {
10407
10427
  const errorMessage = i18next.t("messages:invalidSubscription", {
10408
10428
  returnObjects: true
10409
10429
  });
10410
- return notify.error(errorMessage);
10430
+ return notify$1.error(errorMessage);
10411
10431
  }
10412
10432
 
10413
10433
  switchView("manage-members");
@@ -10416,7 +10436,7 @@ const init$1 = () => {
10416
10436
  const errorMessage = i18next.t("messages:invalidSubscription", {
10417
10437
  returnObjects: true
10418
10438
  });
10419
- return notify.error(errorMessage);
10439
+ return notify$1.error(errorMessage);
10420
10440
  }
10421
10441
  }
10422
10442
  }
@@ -10586,7 +10606,7 @@ const init$1 = () => {
10586
10606
  const errorMsg = i18next.t("shop:messages.currencyMismatch", {
10587
10607
  currency: userCurrency
10588
10608
  });
10589
- notify.error(errorMsg);
10609
+ notify$1.error(errorMsg);
10590
10610
  }
10591
10611
  });
10592
10612
  }
@@ -10656,7 +10676,7 @@ const init = () => {
10656
10676
  const {
10657
10677
  switchView,
10658
10678
  set
10659
- } = usePelcro.getStore();
10679
+ } = usePelcro$1.getStore();
10660
10680
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
10661
10681
 
10662
10682
  if (entitlementsProtectedElements.length === 0) {
@@ -10688,7 +10708,7 @@ const init = () => {
10688
10708
  elemDeepClone.setAttribute("style", "filter:blur(3px) !important; pointer-events:none !important; user-select:none !important");
10689
10709
  unblurElemWhenUserSubscribes(elemDeepClone, entitlements);
10690
10710
  const NOTIFICATION_ID = "entitlement";
10691
- 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, {
10692
10712
  i18nKey: "messages:entitlement"
10693
10713
  }, "Some of the content on this page is available with one or more of our plans.", /*#__PURE__*/React__default['default'].createElement(Link, {
10694
10714
  onClick: () => {
@@ -10705,7 +10725,7 @@ const init = () => {
10705
10725
  });
10706
10726
  }
10707
10727
 
10708
- notify.dismiss(NOTIFICATION_ID);
10728
+ notify$1.dismiss(NOTIFICATION_ID);
10709
10729
  switchView("_plan-select-entitlements");
10710
10730
  }
10711
10731
  }, "Subscribe"), "now to get full page access.")), {
@@ -10745,7 +10765,7 @@ function unblurElemWhenUserSubscribes(elem, entitlements) {
10745
10765
  document.addEventListener("PelcroSubscriptionCreate", event => {
10746
10766
  const {
10747
10767
  isGift
10748
- } = usePelcro.getStore();
10768
+ } = usePelcro$1.getStore();
10749
10769
  if (isGift) return;
10750
10770
  const latestSub = event.detail.data.subscriptions[event.detail.data.subscriptions.length - 1];
10751
10771
  const shouldUnblurContent = entitlements.some(ent => {
@@ -11067,7 +11087,7 @@ const initPaywalls = () => {
11067
11087
 
11068
11088
  const {
11069
11089
  switchView
11070
- } = usePelcro.getStore();
11090
+ } = usePelcro$1.getStore();
11071
11091
 
11072
11092
  if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11073
11093
  /*
@@ -11089,7 +11109,7 @@ const loadPaymentSDKs = () => {
11089
11109
  // Lazy load stripe's SDK
11090
11110
  const {
11091
11111
  whenUserReady
11092
- } = usePelcro.getStore();
11112
+ } = usePelcro$1.getStore();
11093
11113
  whenUserReady(() => {
11094
11114
  if (!window.Stripe) {
11095
11115
  pure_1(window.Pelcro.environment.stripe);
@@ -11137,7 +11157,7 @@ const loadAuth0SDK = () => {
11137
11157
  const initSecuritySdk = () => {
11138
11158
  const {
11139
11159
  whenSiteReady
11140
- } = usePelcro.getStore();
11160
+ } = usePelcro$1.getStore();
11141
11161
  whenSiteReady(() => {
11142
11162
  var _window$Pelcro$site$r2;
11143
11163
 
@@ -11173,7 +11193,7 @@ const dispatchModalDisplayEvents = modalName => {
11173
11193
  const {
11174
11194
  whenSiteReady,
11175
11195
  whenEcommerceLoaded
11176
- } = usePelcro.getStore();
11196
+ } = usePelcro$1.getStore();
11177
11197
  const renderShopView = shopComponent => {
11178
11198
  whenEcommerceLoaded(() => {
11179
11199
  const shopElement = document.getElementById("pelcro-shop");
@@ -11255,7 +11275,7 @@ const initViewFromURL = () => {
11255
11275
  const {
11256
11276
  switchView,
11257
11277
  whenSiteReady
11258
- } = usePelcro.getStore();
11278
+ } = usePelcro$1.getStore();
11259
11279
 
11260
11280
  if (isValidViewFromURL(view)) {
11261
11281
  whenSiteReady(() => {
@@ -11313,7 +11333,7 @@ const initSubscriptionFromURL = () => {
11313
11333
  switchView,
11314
11334
  whenSiteReady,
11315
11335
  set
11316
- } = usePelcro.getStore();
11336
+ } = usePelcro$1.getStore();
11317
11337
  whenSiteReady(() => {
11318
11338
  var _selectedProduct$plan;
11319
11339
 
@@ -11337,7 +11357,7 @@ const initSubscriptionFromURL = () => {
11337
11357
  isAuthenticated,
11338
11358
  switchToAddressView,
11339
11359
  switchToPaymentView
11340
- } = usePelcro.getStore();
11360
+ } = usePelcro$1.getStore();
11341
11361
 
11342
11362
  if (!isAuthenticated()) {
11343
11363
  return switchView("register");
@@ -11369,7 +11389,7 @@ const initOfflineSubscriptionFromURL = offlinePlanId => {
11369
11389
  switchToPaymentView,
11370
11390
  switchToAddressView,
11371
11391
  set
11372
- } = usePelcro.getStore();
11392
+ } = usePelcro$1.getStore();
11373
11393
  whenSiteReady(() => {
11374
11394
  window.Pelcro.plan.getPlan({
11375
11395
  plan_id: offlinePlanId
@@ -11416,7 +11436,7 @@ const initPurchaseFromUrl = () => {
11416
11436
  const {
11417
11437
  whenEcommerceLoaded,
11418
11438
  purchaseItem
11419
- } = usePelcro.getStore();
11439
+ } = usePelcro$1.getStore();
11420
11440
  whenEcommerceLoaded(() => {
11421
11441
  const skuId = window.Pelcro.helpers.getURLParameter("sku_id");
11422
11442
  purchaseItem(skuId);
@@ -11432,7 +11452,7 @@ const initCartFromUrl = () => {
11432
11452
  whenEcommerceLoaded,
11433
11453
  addToCart,
11434
11454
  switchView
11435
- } = usePelcro.getStore();
11455
+ } = usePelcro$1.getStore();
11436
11456
  whenEcommerceLoaded(() => {
11437
11457
  const skusIdsParam = window.Pelcro.helpers.getURLParameter("sku_id");
11438
11458
  const skusIds = skusIdsParam === null || skusIdsParam === void 0 ? void 0 : skusIdsParam.split(",");
@@ -11453,7 +11473,7 @@ const verifyEmailTokenFromUrl = () => {
11453
11473
 
11454
11474
  const {
11455
11475
  whenSiteReady
11456
- } = usePelcro.getStore();
11476
+ } = usePelcro$1.getStore();
11457
11477
  const translations = i18next.t("verifyEmail:messages", {
11458
11478
  returnObjects: true
11459
11479
  });
@@ -11465,10 +11485,10 @@ const verifyEmailTokenFromUrl = () => {
11465
11485
  token: emailToken
11466
11486
  }, (err, res) => {
11467
11487
  if (err) {
11468
- return notify.error(getErrorMessages(err));
11488
+ return notify$1.error(getErrorMessages(err));
11469
11489
  }
11470
11490
 
11471
- return notify.success(translations.success);
11491
+ return notify$1.success(translations.success);
11472
11492
  });
11473
11493
  }, {
11474
11494
  once: true
@@ -11482,7 +11502,7 @@ const verifyLinkTokenFromUrl = () => {
11482
11502
  whenSiteReady,
11483
11503
  resetView,
11484
11504
  isAuthenticated
11485
- } = usePelcro.getStore();
11505
+ } = usePelcro$1.getStore();
11486
11506
  const translations = i18next.t("verifyLinkToken:messages", {
11487
11507
  returnObjects: true
11488
11508
  });
@@ -11494,7 +11514,7 @@ const verifyLinkTokenFromUrl = () => {
11494
11514
  token: loginToken
11495
11515
  }, (err, res) => {
11496
11516
  if (err) {
11497
- return notify.error(getErrorMessages(err));
11517
+ return notify$1.error(getErrorMessages(err));
11498
11518
  }
11499
11519
 
11500
11520
  const {
@@ -11504,11 +11524,11 @@ const verifyLinkTokenFromUrl = () => {
11504
11524
  auth_token
11505
11525
  }, (err, res) => {
11506
11526
  if (err) {
11507
- return notify.error(getErrorMessages(err));
11527
+ return notify$1.error(getErrorMessages(err));
11508
11528
  }
11509
11529
 
11510
11530
  resetView();
11511
- return notify.success(translations.success);
11531
+ return notify$1.success(translations.success);
11512
11532
  });
11513
11533
  });
11514
11534
  }, {
@@ -11521,12 +11541,12 @@ const showPasswordlessRequestFromUrl = () => {
11521
11541
 
11522
11542
  const {
11523
11543
  isAuthenticated
11524
- } = usePelcro.getStore();
11544
+ } = usePelcro$1.getStore();
11525
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;
11526
11546
  if (!passwordlessEnabled || isAuthenticated()) return;
11527
11547
  const {
11528
11548
  switchView
11529
- } = usePelcro.getStore();
11549
+ } = usePelcro$1.getStore();
11530
11550
  return switchView("passwordless-request");
11531
11551
  };
11532
11552
 
@@ -11537,7 +11557,7 @@ const showInvoiceDetailsFromUrl = () => {
11537
11557
  whenUserReady,
11538
11558
  whenSiteReady,
11539
11559
  switchView
11540
- } = usePelcro.getStore();
11560
+ } = usePelcro$1.getStore();
11541
11561
  whenSiteReady(() => {
11542
11562
  if (!isAuthenticated()) {
11543
11563
  return switchView("login");
@@ -11551,18 +11571,18 @@ const showInvoiceDetailsFromUrl = () => {
11551
11571
  const errorMessage = i18next.t("messages:invalidInvoice", {
11552
11572
  returnObjects: true
11553
11573
  });
11554
- return notify.error(errorMessage);
11574
+ return notify$1.error(errorMessage);
11555
11575
  }
11556
11576
 
11557
11577
  const {
11558
11578
  invoice
11559
- } = usePelcro.getStore();
11579
+ } = usePelcro$1.getStore();
11560
11580
 
11561
11581
  if (invoice.total === 0) {
11562
11582
  const errorMessage = i18next.t("messages:zeroTotalInvoice", {
11563
11583
  returnObjects: true
11564
11584
  });
11565
- return notify.error(errorMessage);
11585
+ return notify$1.error(errorMessage);
11566
11586
  }
11567
11587
 
11568
11588
  return switchView("invoice-details");
@@ -11577,7 +11597,7 @@ const showSubscriptionManageMembersFromUrl = () => {
11577
11597
  whenUserReady,
11578
11598
  whenSiteReady,
11579
11599
  switchView
11580
- } = usePelcro.getStore();
11600
+ } = usePelcro$1.getStore();
11581
11601
  whenSiteReady(() => {
11582
11602
  if (!isAuthenticated()) {
11583
11603
  return switchView("login");
@@ -11591,7 +11611,7 @@ const showSubscriptionManageMembersFromUrl = () => {
11591
11611
  const errorMessage = i18next.t("messages:invalidSubscription", {
11592
11612
  returnObjects: true
11593
11613
  });
11594
- return notify.error(errorMessage);
11614
+ return notify$1.error(errorMessage);
11595
11615
  }
11596
11616
 
11597
11617
  return switchView("manage-members");
@@ -11617,7 +11637,7 @@ const PelcroModalController = ({
11617
11637
  view,
11618
11638
  isAuthenticated,
11619
11639
  whenSiteReady
11620
- } = usePelcro();
11640
+ } = usePelcro$1();
11621
11641
  React__default['default'].useEffect(() => {
11622
11642
  init$1();
11623
11643
  renderShopView(React__default['default'].Children.map(children, child => child).find(({
@@ -13378,7 +13398,7 @@ function Modal({
13378
13398
  }) {
13379
13399
  var _window$Pelcro, _window$Pelcro$site$r;
13380
13400
 
13381
- const resetView = usePelcro(state => state.resetView);
13401
+ const resetView = usePelcro$1(state => state.resetView);
13382
13402
  React.useEffect(() => {
13383
13403
  onDisplay === null || onDisplay === void 0 ? void 0 : onDisplay();
13384
13404
  dispatchModalDisplayEvents(id);
@@ -13451,8 +13471,11 @@ function LoginModal({
13451
13471
  const {
13452
13472
  switchView,
13453
13473
  resetView,
13454
- invoice
13455
- } = usePelcro();
13474
+ product,
13475
+ order,
13476
+ switchToAddressView,
13477
+ switchToPaymentView
13478
+ } = usePelcro$1();
13456
13479
 
13457
13480
  const onSuccess = res => {
13458
13481
  var _props$onSuccess;
@@ -13463,10 +13486,23 @@ function LoginModal({
13463
13486
  initPaywalls();
13464
13487
  }
13465
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
+
13466
13501
  resetView();
13467
13502
  const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
13503
+ const viewsURLs = ["invoice-details", "gift-redeem", "plan-select"];
13468
13504
 
13469
- if (viewFromURL === "invoice-details") {
13505
+ if (viewsURLs.includes(viewFromURL)) {
13470
13506
  initViewFromURL();
13471
13507
  }
13472
13508
  };
@@ -13789,7 +13825,7 @@ function RegisterView(props) {
13789
13825
  } = useTranslation("register");
13790
13826
  const {
13791
13827
  product
13792
- } = usePelcro();
13828
+ } = usePelcro$1();
13793
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");
13794
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");
13795
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);
@@ -14020,7 +14056,7 @@ function RegisterModal(props) {
14020
14056
  order,
14021
14057
  giftCode,
14022
14058
  isGift
14023
- } = usePelcro();
14059
+ } = usePelcro$1();
14024
14060
 
14025
14061
  const onSuccess = res => {
14026
14062
  var _props$onSuccess;
@@ -14050,7 +14086,7 @@ function RegisterModal(props) {
14050
14086
 
14051
14087
 
14052
14088
  if (giftCode) {
14053
- return switchToAddressView();
14089
+ return switchView("gift-redeem"); // return switchToAddressView();
14054
14090
  } // Check if the subscription is meant as a gift (if so, gather recipients info)
14055
14091
 
14056
14092
 
@@ -14142,7 +14178,7 @@ function SelectModalWithHook(props) {
14142
14178
  resetView,
14143
14179
  view,
14144
14180
  set
14145
- } = usePelcro();
14181
+ } = usePelcro$1();
14146
14182
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
14147
14183
  const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
14148
14184
  return /*#__PURE__*/React__default['default'].createElement(SelectModalWithTrans, {
@@ -14414,7 +14450,7 @@ class SelectModal extends React.Component {
14414
14450
  const {
14415
14451
  switchToAddressView,
14416
14452
  switchToPaymentView
14417
- } = usePelcro.getStore();
14453
+ } = usePelcro$1.getStore();
14418
14454
 
14419
14455
  if (!isAuthenticated) {
14420
14456
  return setView("register");
@@ -16617,16 +16653,16 @@ const PaymentMethodContainerWithoutStripe = ({
16617
16653
  const {
16618
16654
  t
16619
16655
  } = useTranslation("payment");
16620
- const pelcroStore = usePelcro();
16656
+ const pelcroStore = usePelcro$1();
16621
16657
  const {
16622
16658
  set,
16623
16659
  order,
16624
16660
  selectedPaymentMethodId,
16625
16661
  couponCode
16626
- } = usePelcro();
16662
+ } = usePelcro$1();
16627
16663
  const {
16628
16664
  whenUserReady
16629
- } = usePelcro.getStore();
16665
+ } = usePelcro$1.getStore();
16630
16666
  const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
16631
16667
  const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
16632
16668
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
@@ -18090,11 +18126,11 @@ const PaymentMethodContainerWithoutStripe = ({
18090
18126
 
18091
18127
  if (show) {
18092
18128
  injectCardAuthenticationIframe(source);
18093
- cardAuthContainer.classList.remove("plc-hidden");
18094
- 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");
18095
18131
  } else {
18096
- cardAuthContainer.classList.add("plc-hidden");
18097
- 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");
18098
18134
  }
18099
18135
  };
18100
18136
 
@@ -18102,11 +18138,11 @@ const PaymentMethodContainerWithoutStripe = ({
18102
18138
  const cardAuthContainer = document.querySelector(".card-authentication-success-container");
18103
18139
 
18104
18140
  if (show) {
18105
- cardAuthContainer.classList.remove("plc-hidden");
18106
- 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");
18107
18143
  } else {
18108
- cardAuthContainer.classList.add("plc-hidden");
18109
- 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");
18110
18146
  }
18111
18147
  };
18112
18148
 
@@ -18117,7 +18153,7 @@ const PaymentMethodContainerWithoutStripe = ({
18117
18153
  const iframe = document.createElement("iframe");
18118
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;
18119
18155
  iframe.style = "position: absolute; width: 100%; height: 100%; left: 0; top: 0; bottom: 0; z-index: 10;";
18120
- cardAuthContainer.appendChild(iframe);
18156
+ cardAuthContainer === null || cardAuthContainer === void 0 ? void 0 : cardAuthContainer.appendChild(iframe);
18121
18157
  };
18122
18158
 
18123
18159
  const [state, dispatch] = useReducerWithSideEffects((state, action) => {
@@ -18306,7 +18342,7 @@ const PaymentMethodContainer = props => {
18306
18342
  const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
18307
18343
  const {
18308
18344
  whenUserReady
18309
- } = usePelcro.getStore();
18345
+ } = usePelcro$1.getStore();
18310
18346
  React.useEffect(() => {
18311
18347
  whenUserReady(() => {
18312
18348
  if (!window.Stripe) {
@@ -18407,7 +18443,7 @@ const PelcroPaymentRequestButton = props => {
18407
18443
  const CheckoutForm = () => {
18408
18444
  const {
18409
18445
  selectedPaymentMethodId
18410
- } = usePelcro();
18446
+ } = usePelcro$1();
18411
18447
  const cardProcessor = getSiteCardProcessor();
18412
18448
 
18413
18449
  if (selectedPaymentMethodId) {
@@ -18462,7 +18498,7 @@ const DiscountedPrice = props => {
18462
18498
  const {
18463
18499
  order,
18464
18500
  plan
18465
- } = usePelcro();
18501
+ } = usePelcro$1();
18466
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;
18467
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;
18468
18504
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
@@ -18498,7 +18534,7 @@ const SubmitPaymentMethod = ({
18498
18534
 
18499
18535
  const {
18500
18536
  plan
18501
- } = usePelcro();
18537
+ } = usePelcro$1();
18502
18538
  const {
18503
18539
  t
18504
18540
  } = useTranslation("checkoutForm");
@@ -18930,7 +18966,7 @@ const PaypalSubscribeButton = props => {
18930
18966
  plan,
18931
18967
  invoice,
18932
18968
  selectedAddressId
18933
- } = usePelcro();
18969
+ } = usePelcro$1();
18934
18970
  React.useEffect(() => {
18935
18971
  var _ref, _ref2, _state$updatedPrice, _props$plan, _props$selectedAddres;
18936
18972
 
@@ -19072,7 +19108,7 @@ const SelectedPaymentMethod = () => {
19072
19108
  const {
19073
19109
  switchView,
19074
19110
  selectedPaymentMethodId
19075
- } = usePelcro();
19111
+ } = usePelcro$1();
19076
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 => {
19077
19113
  return source.id == selectedPaymentMethodId;
19078
19114
  });
@@ -19113,7 +19149,7 @@ const TaxAmount = () => {
19113
19149
  } = React.useContext(store$k);
19114
19150
  const {
19115
19151
  plan
19116
- } = usePelcro();
19152
+ } = usePelcro$1();
19117
19153
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
19118
19154
  const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19119
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;
@@ -19259,7 +19295,7 @@ const SubscriptionRenewView = ({
19259
19295
  const {
19260
19296
  product,
19261
19297
  plan
19262
- } = usePelcro();
19298
+ } = usePelcro$1();
19263
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;
19264
19300
  const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
19265
19301
 
@@ -19314,7 +19350,7 @@ function SubscriptionRenewModal({
19314
19350
  }) {
19315
19351
  const {
19316
19352
  switchView
19317
- } = usePelcro();
19353
+ } = usePelcro$1();
19318
19354
 
19319
19355
  const onSuccess = res => {
19320
19356
  var _otherProps$onSuccess, _ReactGA$event;
@@ -19519,7 +19555,7 @@ const SubscriptionCancelNowButton = ({
19519
19555
  }) => {
19520
19556
  const {
19521
19557
  switchView
19522
- } = usePelcro();
19558
+ } = usePelcro$1();
19523
19559
  const {
19524
19560
  state: {
19525
19561
  cancelationReason
@@ -19566,7 +19602,7 @@ const SubscriptionCancelNowButton = ({
19566
19602
 
19567
19603
  switchView(null); //Show confirmation alert after closing the modal
19568
19604
 
19569
- notify.confirm((onSuccess, onFailure) => {
19605
+ notify$1.confirm((onSuccess, onFailure) => {
19570
19606
  cancelSubscription(payload, onSuccess, onFailure);
19571
19607
  }, {
19572
19608
  confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
@@ -19591,7 +19627,7 @@ const SubscriptionCancelLaterButton = ({
19591
19627
  }) => {
19592
19628
  const {
19593
19629
  switchView
19594
- } = usePelcro();
19630
+ } = usePelcro$1();
19595
19631
  const {
19596
19632
  state: {
19597
19633
  cancelationReason
@@ -19638,7 +19674,7 @@ const SubscriptionCancelLaterButton = ({
19638
19674
 
19639
19675
  switchView(null); //Show confirmation alert after closing the modal
19640
19676
 
19641
- notify.confirm((onSuccess, onFailure) => {
19677
+ notify$1.confirm((onSuccess, onFailure) => {
19642
19678
  cancelSubscription(payload, onSuccess, onFailure);
19643
19679
  }, {
19644
19680
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -19659,7 +19695,7 @@ const SubscriptionCancelLaterButton = ({
19659
19695
  const SubscriptionCancelView = props => {
19660
19696
  const {
19661
19697
  subscriptionToCancel
19662
- } = usePelcro();
19698
+ } = usePelcro$1();
19663
19699
  const {
19664
19700
  t
19665
19701
  } = useTranslation("subscriptionCancel");
@@ -19833,7 +19869,7 @@ const SubscriptionSuspendButton = ({
19833
19869
  }) => {
19834
19870
  const {
19835
19871
  switchView
19836
- } = usePelcro();
19872
+ } = usePelcro$1();
19837
19873
  const {
19838
19874
  state: {
19839
19875
  suspendDate,
@@ -19875,7 +19911,7 @@ const SubscriptionSuspendButton = ({
19875
19911
 
19876
19912
  switchView(null); //Show confirmation alert after closing the modal
19877
19913
 
19878
- notify.confirm((onSuccess, onFailure) => {
19914
+ notify$1.confirm((onSuccess, onFailure) => {
19879
19915
  suspendSubscription(payload, onSuccess, onFailure);
19880
19916
  }, {
19881
19917
  confirmMessage: t("messages.subCancellation.isSureToSuspendNow"),
@@ -19897,7 +19933,7 @@ const SubscriptionSuspendButton = ({
19897
19933
  const SubscriptionSuspendView = props => {
19898
19934
  const {
19899
19935
  subscriptionToSuspend
19900
- } = usePelcro();
19936
+ } = usePelcro$1();
19901
19937
  const {
19902
19938
  t
19903
19939
  } = useTranslation("subscriptionSuspend");
@@ -19990,7 +20026,7 @@ const getCurrentFlow = () => {
19990
20026
  giftRecipient,
19991
20027
  giftCode,
19992
20028
  invoice
19993
- } = usePelcro.getStore();
20029
+ } = usePelcro$1.getStore();
19994
20030
 
19995
20031
  if (invoice) {
19996
20032
  return "invoicePayment";
@@ -20009,7 +20045,7 @@ const getSuccessContent = i18n => {
20009
20045
  const flow = getCurrentFlow();
20010
20046
  const {
20011
20047
  product
20012
- } = usePelcro.getStore();
20048
+ } = usePelcro$1.getStore();
20013
20049
  const wordingDictionary = {
20014
20050
  subscriptionSuccess: {
20015
20051
  successIcon: /*#__PURE__*/React__default['default'].createElement(SvgCheckSolid, {
@@ -20053,7 +20089,7 @@ function PaymentSuccessModal({
20053
20089
  }) {
20054
20090
  const {
20055
20091
  resetView
20056
- } = usePelcro();
20092
+ } = usePelcro$1();
20057
20093
 
20058
20094
  const onClose = () => {
20059
20095
  var _props$onClose;
@@ -20086,7 +20122,7 @@ function NewsletterWithHook(props) {
20086
20122
  switchView,
20087
20123
  resetView,
20088
20124
  product
20089
- } = usePelcro();
20125
+ } = usePelcro$1();
20090
20126
  return /*#__PURE__*/React__default['default'].createElement(NewsLetter, {
20091
20127
  onClose: () => {
20092
20128
  var _props$onClose;
@@ -20585,7 +20621,7 @@ const MeterView = () => {
20585
20621
  switchView,
20586
20622
  product,
20587
20623
  isAuthenticated
20588
- } = usePelcro();
20624
+ } = usePelcro$1();
20589
20625
  const paywallProduct = product !== null && product !== void 0 ? product : window.Pelcro.paywall.getProduct();
20590
20626
  const visitsLeft = window.Pelcro.paywall.freeVisitsLeft();
20591
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}`;
@@ -20607,7 +20643,7 @@ const MeterView = () => {
20607
20643
  const MeterModal = props => {
20608
20644
  const {
20609
20645
  resetView
20610
- } = usePelcro();
20646
+ } = usePelcro$1();
20611
20647
  React.useEffect(() => {
20612
20648
  var _props$onDisplay;
20613
20649
 
@@ -20645,7 +20681,7 @@ const SubscriptionCreateView = ({
20645
20681
  const {
20646
20682
  product,
20647
20683
  plan
20648
- } = usePelcro();
20684
+ } = usePelcro$1();
20649
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;
20650
20686
  const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
20651
20687
 
@@ -20703,7 +20739,7 @@ function SubscriptionCreateModal({
20703
20739
  useTranslation("common");
20704
20740
  const {
20705
20741
  switchView
20706
- } = usePelcro();
20742
+ } = usePelcro$1();
20707
20743
 
20708
20744
  const onSuccess = res => {
20709
20745
  var _otherProps$onSuccess;
@@ -20749,7 +20785,7 @@ const SubscriptionManageMembersContainer = ({
20749
20785
  }) => {
20750
20786
  const {
20751
20787
  subscriptionToManageMembers
20752
- } = usePelcro();
20788
+ } = usePelcro$1();
20753
20789
  const subscription_id = subscriptionToManageMembers === null || subscriptionToManageMembers === void 0 ? void 0 : subscriptionToManageMembers.id;
20754
20790
 
20755
20791
  const handleListMembers = ({}, dispatch) => {
@@ -21044,8 +21080,8 @@ function SubscriptionManageMembersList(props) {
21044
21080
  return {
21045
21081
  title: sub.status,
21046
21082
  content: sub.status,
21047
- textColor: "plc-text-orange-700",
21048
- bgColor: "plc-bg-orange-100",
21083
+ textColor: "plc-text-yellow-500",
21084
+ bgColor: "plc-bg-yellow-100",
21049
21085
  icon: /*#__PURE__*/React__default['default'].createElement(SvgExclamation, null)
21050
21086
  };
21051
21087
  }
@@ -21101,7 +21137,8 @@ function SubscriptionManageMembersList(props) {
21101
21137
  key: member.id,
21102
21138
  className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
21103
21139
  }, /*#__PURE__*/React__default['default'].createElement("td", {
21104
- className: "plc-truncate"
21140
+ className: "plc-truncate plc-text-left",
21141
+ title: member === null || member === void 0 ? void 0 : member.invitation_email
21105
21142
  }, /*#__PURE__*/React__default['default'].createElement("span", {
21106
21143
  className: "plc-font-semibold plc-text-gray-500"
21107
21144
  }, member === null || member === void 0 ? void 0 : member.invitation_email)), /*#__PURE__*/React__default['default'].createElement("td", {
@@ -21155,8 +21192,10 @@ function SubscriptionManageMembersView(props) {
21155
21192
  className: "plc-flex-shrink-0 plc-p-2 plc-text-xs plc-text-gray-400 plc-uppercase"
21156
21193
  }, t("labels.listOfMembers")), /*#__PURE__*/React__default['default'].createElement("hr", {
21157
21194
  className: "plc-w-full plc-border-gray-300"
21158
- })), /*#__PURE__*/React__default['default'].createElement("table", {
21159
- 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"
21160
21199
  }, /*#__PURE__*/React__default['default'].createElement("thead", {
21161
21200
  className: "plc-text-xs plc-font-semibold plc-tracking-wider plc-text-gray-400 plc-uppercase "
21162
21201
  }, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("th", {
@@ -21165,7 +21204,7 @@ function SubscriptionManageMembersView(props) {
21165
21204
  className: "plc-w-3/12 "
21166
21205
  }, t("labels.status")), /*#__PURE__*/React__default['default'].createElement("th", {
21167
21206
  className: "plc-w-3/12 "
21168
- }, 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))))))));
21169
21208
  }
21170
21209
 
21171
21210
  /**
@@ -21194,7 +21233,7 @@ function SubscriptionManageMembersModal({
21194
21233
  }
21195
21234
  SubscriptionManageMembersModal.viewId = "manage-members";
21196
21235
 
21197
- 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;
21198
21237
  const initialState$f = {
21199
21238
  email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
21200
21239
  emailError: null,
@@ -21202,10 +21241,12 @@ const initialState$f = {
21202
21241
  firstNameError: null,
21203
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,
21204
21243
  lastNameError: null,
21205
- displayName: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.display_name,
21206
- 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,
21207
21248
  phoneError: null,
21208
- 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,
21209
21250
  buttonDisabled: false,
21210
21251
  textFields: {},
21211
21252
  alert: {
@@ -21236,26 +21277,29 @@ const UserUpdateContainer = ({
21236
21277
  }, []);
21237
21278
 
21238
21279
  const loadUserDataIntoFields = () => {
21239
- 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;
21240
21281
 
21241
21282
  const fields = [{
21242
21283
  type: SET_EMAIL,
21243
- 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
21244
21285
  }, {
21245
21286
  type: SET_FIRST_NAME,
21246
- 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
21247
21288
  }, {
21248
21289
  type: SET_LAST_NAME,
21249
- 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
21250
21294
  }, {
21251
21295
  type: SET_DISPLAY_NAME,
21252
- 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
21253
21297
  }, {
21254
21298
  type: SET_PHONE,
21255
- 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
21256
21300
  }, {
21257
21301
  type: SET_TIN,
21258
- 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
21259
21303
  }];
21260
21304
  fields.filter(field => Boolean(field.payload)).forEach(field => {
21261
21305
  dispatch(field);
@@ -21266,6 +21310,7 @@ const UserUpdateContainer = ({
21266
21310
  email,
21267
21311
  firstName,
21268
21312
  lastName,
21313
+ username,
21269
21314
  phone,
21270
21315
  tin,
21271
21316
  textFields,
@@ -21276,6 +21321,9 @@ const UserUpdateContainer = ({
21276
21321
  email: email,
21277
21322
  first_name: firstName,
21278
21323
  last_name: lastName,
21324
+ ...(username && {
21325
+ username
21326
+ }),
21279
21327
  display_name: displayName,
21280
21328
  phone: phone,
21281
21329
  tin: tin,
@@ -21361,6 +21409,18 @@ const UserUpdateContainer = ({
21361
21409
  lastName: ""
21362
21410
  });
21363
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
+
21364
21424
  case SET_PHONE:
21365
21425
  return lib_7({ ...state,
21366
21426
  phone: action.payload,
@@ -21406,10 +21466,14 @@ const UserUpdateContainer = ({
21406
21466
  state,
21407
21467
  dispatch
21408
21468
  }
21409
- }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
21410
- store: store$f,
21411
- key: i
21412
- })) : /*#__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, {
21413
21477
  store: store$f
21414
21478
  })));
21415
21479
  };
@@ -21517,6 +21581,84 @@ const UserUpdateButton = ({
21517
21581
  }, otherProps), name !== null && name !== void 0 ? name : t("labels.submit"));
21518
21582
  };
21519
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
+
21520
21662
  const UserUpdateFirstName = props => /*#__PURE__*/React__default['default'].createElement(FirstName, Object.assign({
21521
21663
  store: store$f
21522
21664
  }, props));
@@ -21616,13 +21758,45 @@ const UserUpdateTin = props => /*#__PURE__*/React__default['default'].createElem
21616
21758
  store: store$f
21617
21759
  }, props));
21618
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
+
21619
21792
  const UserUpdateView = props => {
21620
- var _window$Pelcro$site$r;
21793
+ var _window$Pelcro$site$r, _window$Pelcro, _window$Pelcro$uiSett;
21621
21794
 
21622
21795
  const {
21623
21796
  t
21624
21797
  } = useTranslation("userEdit");
21625
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;
21626
21800
  return /*#__PURE__*/React__default['default'].createElement("div", {
21627
21801
  id: "pelcro-user-update-view"
21628
21802
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -21650,7 +21824,17 @@ const UserUpdateView = props => {
21650
21824
  errorId: "pelcro-input-last-name-error",
21651
21825
  label: t("labels.lastName"),
21652
21826
  required: supportsTap ? true : false
21653
- })), /*#__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", {
21654
21838
  className: "plc-flex plc-items-start"
21655
21839
  }, /*#__PURE__*/React__default['default'].createElement(UserUpdatePhone, {
21656
21840
  id: "pelcro-input-phone",
@@ -21681,7 +21865,7 @@ function UserUpdateModal({
21681
21865
  }) {
21682
21866
  const {
21683
21867
  switchView
21684
- } = usePelcro();
21868
+ } = usePelcro$1();
21685
21869
 
21686
21870
  const onPictureClick = () => {
21687
21871
  switchView("profile-picture");
@@ -21697,37 +21881,6 @@ function UserUpdateModal({
21697
21881
  }
21698
21882
  UserUpdateModal.viewId = "user-edit";
21699
21883
 
21700
- function DisplayName({
21701
- store,
21702
- ...otherProps
21703
- }) {
21704
- const {
21705
- dispatch,
21706
- state
21707
- } = React.useContext(store);
21708
-
21709
- const handleInputChange = value => {
21710
- dispatch({
21711
- type: SET_DISPLAY_NAME,
21712
- payload: value
21713
- });
21714
- };
21715
-
21716
- if (state.loading) {
21717
- return /*#__PURE__*/React__default['default'].createElement(Loader, null);
21718
- }
21719
-
21720
- return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
21721
- type: "text",
21722
- value: state.displayName || null,
21723
- onChange: e => handleInputChange(e.target.value)
21724
- }, otherProps));
21725
- }
21726
-
21727
- const UserUpdateDisplayName = props => /*#__PURE__*/React__default['default'].createElement(DisplayName, Object.assign({
21728
- store: store$f
21729
- }, props));
21730
-
21731
21884
  const UserUpdateTextInput = props => {
21732
21885
  return /*#__PURE__*/React__default['default'].createElement(TextInput, Object.assign({}, props, {
21733
21886
  store: store$f
@@ -21790,7 +21943,7 @@ const AddressCreateContainer = ({
21790
21943
  order,
21791
21944
  set,
21792
21945
  selectedMembership
21793
- } = usePelcro();
21946
+ } = usePelcro$1();
21794
21947
  const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
21795
21948
  const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
21796
21949
  React.useEffect(() => {
@@ -21895,7 +22048,7 @@ const AddressCreateContainer = ({
21895
22048
  return onFailure(err);
21896
22049
  }
21897
22050
 
21898
- notify.success(t("messages.addressUpdated"));
22051
+ notify$1.success(t("messages.addressUpdated"));
21899
22052
  return onMembershipAdressUpdateSuccess(res);
21900
22053
  });
21901
22054
  }
@@ -22547,7 +22700,7 @@ const AddressCreateModal = ({
22547
22700
  switchView,
22548
22701
  switchToPaymentView,
22549
22702
  resetView
22550
- } = usePelcro();
22703
+ } = usePelcro$1();
22551
22704
 
22552
22705
  const onSuccess = newAddressId => {
22553
22706
  var _otherProps$onSuccess;
@@ -22640,7 +22793,7 @@ const AddressUpdateContainer = ({
22640
22793
 
22641
22794
  const {
22642
22795
  addressIdToEdit
22643
- } = usePelcro();
22796
+ } = usePelcro$1();
22644
22797
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
22645
22798
  const [t] = useTranslation("address");
22646
22799
  React.useEffect(() => {
@@ -23731,7 +23884,7 @@ const PasswordForgotModal = ({
23731
23884
  } = useTranslation("passwordForgot");
23732
23885
  const {
23733
23886
  switchView
23734
- } = usePelcro();
23887
+ } = usePelcro$1();
23735
23888
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
23736
23889
  id: "pelcro-password-forgot-modal",
23737
23890
  onDisplay: onDisplay,
@@ -24316,7 +24469,7 @@ const CartContainer = ({
24316
24469
  const {
24317
24470
  cartItems,
24318
24471
  set
24319
- } = usePelcro();
24472
+ } = usePelcro$1();
24320
24473
  const {
24321
24474
  t
24322
24475
  } = useTranslation("shop");
@@ -24421,7 +24574,7 @@ const CartRemoveItemButton = ({
24421
24574
  }) => {
24422
24575
  const {
24423
24576
  removeFromCart
24424
- } = usePelcro();
24577
+ } = usePelcro$1();
24425
24578
  return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
24426
24579
  variant: "icon",
24427
24580
  "data-key": itemId,
@@ -24484,7 +24637,7 @@ const CartTotalPrice = () => {
24484
24637
  } = React.useContext(store$8);
24485
24638
  const {
24486
24639
  cartItems
24487
- } = usePelcro();
24640
+ } = usePelcro$1();
24488
24641
  const totalPriceCurrency = cartItems[0].currency;
24489
24642
  const {
24490
24643
  t
@@ -24504,7 +24657,7 @@ const CartTotalPrice = () => {
24504
24657
  const CartView = props => {
24505
24658
  const {
24506
24659
  cartItems
24507
- } = usePelcro();
24660
+ } = usePelcro$1();
24508
24661
  const {
24509
24662
  t
24510
24663
  } = useTranslation("cart");
@@ -24565,7 +24718,7 @@ const CartModal = ({
24565
24718
  switchView,
24566
24719
  switchToAddressView,
24567
24720
  isAuthenticated
24568
- } = usePelcro();
24721
+ } = usePelcro$1();
24569
24722
 
24570
24723
  const onSuccess = items => {
24571
24724
  var _otherProps$onSuccess;
@@ -24597,7 +24750,7 @@ const ShopSelectProductButton = ({
24597
24750
  }) => {
24598
24751
  const {
24599
24752
  addToCart
24600
- } = usePelcro();
24753
+ } = usePelcro$1();
24601
24754
  const {
24602
24755
  t
24603
24756
  } = useTranslation("shop");
@@ -24629,7 +24782,7 @@ const ShopPurchaseButton = ({
24629
24782
  }) => {
24630
24783
  const {
24631
24784
  purchaseItem
24632
- } = usePelcro();
24785
+ } = usePelcro$1();
24633
24786
  const {
24634
24787
  t
24635
24788
  } = useTranslation("shop");
@@ -24665,7 +24818,7 @@ const ShopView = () => {
24665
24818
  className: "plc-mt-2"
24666
24819
  }), /*#__PURE__*/React__default['default'].createElement(ShopPurchaseButton, {
24667
24820
  itemId: item.id,
24668
- className: "plc-mt-2"
24821
+ className: "plc-mt-2 pelcro-purchase-button"
24669
24822
  })));
24670
24823
  })));
24671
24824
  };
@@ -24705,7 +24858,7 @@ const OrderCreateModal = ({
24705
24858
  }) => {
24706
24859
  const {
24707
24860
  switchView
24708
- } = usePelcro();
24861
+ } = usePelcro$1();
24709
24862
 
24710
24863
  const onSuccess = () => {
24711
24864
  var _otherProps$onSuccess;
@@ -24735,7 +24888,7 @@ const OrderConfirmModal = props => {
24735
24888
  } = useTranslation("shop");
24736
24889
  const {
24737
24890
  resetView
24738
- } = usePelcro();
24891
+ } = usePelcro$1();
24739
24892
 
24740
24893
  const onClose = () => {
24741
24894
  var _props$onClose;
@@ -24827,7 +24980,7 @@ const GiftCreateContainer = ({
24827
24980
  } = useTranslation("register");
24828
24981
  const {
24829
24982
  set
24830
- } = usePelcro();
24983
+ } = usePelcro$1();
24831
24984
 
24832
24985
  const handleSubmit = (state, dispatch) => {
24833
24986
  const giftRecipient = {
@@ -25119,7 +25272,7 @@ const GiftCreateModal = ({
25119
25272
  switchToAddressView,
25120
25273
  switchToPaymentView,
25121
25274
  product
25122
- } = usePelcro();
25275
+ } = usePelcro$1();
25123
25276
 
25124
25277
  const onSuccess = giftRecipient => {
25125
25278
  var _otherProps$onSuccess;
@@ -25147,6 +25300,7 @@ const GiftCreateModal = ({
25147
25300
  GiftCreateModal.viewId = "gift-create";
25148
25301
 
25149
25302
  const initialState$6 = {
25303
+ isSubmitting: false,
25150
25304
  giftCode: "",
25151
25305
  buttonDisabled: true,
25152
25306
  alert: {
@@ -25165,14 +25319,24 @@ const GiftRedeemContainer = ({
25165
25319
  onSuccess = () => {},
25166
25320
  onFailure = () => {},
25167
25321
  onDisplay = () => {},
25168
- children
25322
+ children,
25323
+ ...props
25169
25324
  }) => {
25325
+ var _ref, _props$subscriptionId;
25326
+
25170
25327
  const {
25171
25328
  t
25172
25329
  } = useTranslation("register");
25173
25330
  const {
25174
25331
  set
25175
- } = 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;
25176
25340
  React.useEffect(() => {
25177
25341
  onDisplay();
25178
25342
  }, []);
@@ -25193,7 +25357,41 @@ const GiftRedeemContainer = ({
25193
25357
  set({
25194
25358
  giftCode
25195
25359
  });
25196
- 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
+ }
25197
25395
  }
25198
25396
  };
25199
25397
 
@@ -25214,8 +25412,14 @@ const GiftRedeemContainer = ({
25214
25412
  buttonDisabled: action.payload
25215
25413
  });
25216
25414
 
25415
+ case LOADING:
25416
+ return lib_7({ ...state,
25417
+ isSubmitting: action.payload
25418
+ });
25419
+
25217
25420
  case HANDLE_SUBMIT:
25218
25421
  return lib_5({ ...state,
25422
+ isSubmitting: true,
25219
25423
  buttonDisabled: true
25220
25424
  }, (state, dispatch) => handleRedeem(state, dispatch));
25221
25425
 
@@ -25284,7 +25488,8 @@ const GiftRedeemSubmitButton = ({
25284
25488
  const {
25285
25489
  dispatch,
25286
25490
  state: {
25287
- disableSubmit
25491
+ disableSubmit,
25492
+ isSubmitting
25288
25493
  }
25289
25494
  } = React.useContext(store$6);
25290
25495
  const {
@@ -25297,7 +25502,8 @@ const GiftRedeemSubmitButton = ({
25297
25502
  });
25298
25503
  onClick === null || onClick === void 0 ? void 0 : onClick();
25299
25504
  },
25300
- disabled: disableSubmit
25505
+ disabled: disableSubmit,
25506
+ isLoading: isSubmitting
25301
25507
  }, otherProps), name !== null && name !== void 0 ? name : t("redeem.buttons.redeem"));
25302
25508
  };
25303
25509
 
@@ -25342,18 +25548,13 @@ const GiftRedeemModal = ({
25342
25548
  switchView,
25343
25549
  switchToAddressView,
25344
25550
  isAuthenticated
25345
- } = usePelcro();
25551
+ } = usePelcro$1();
25346
25552
 
25347
25553
  const onSuccess = giftCode => {
25348
25554
  var _otherProps$onSuccess;
25349
25555
 
25350
25556
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, giftCode);
25351
-
25352
- if (isAuthenticated()) {
25353
- switchToAddressView();
25354
- } else {
25355
- switchView("register");
25356
- }
25557
+ switchView("subscription-success");
25357
25558
  };
25358
25559
 
25359
25560
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -25414,7 +25615,7 @@ const AddressSelectContainer = ({
25414
25615
  subscriptionIdToRenew: subscriptionIdToRenewFromStore,
25415
25616
  set,
25416
25617
  selectedMembership
25417
- } = usePelcro();
25618
+ } = usePelcro$1();
25418
25619
  const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
25419
25620
  const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
25420
25621
 
@@ -25451,7 +25652,7 @@ const AddressSelectContainer = ({
25451
25652
  return onFailure(err);
25452
25653
  }
25453
25654
 
25454
- notify.success(t("messages.addressUpdated"));
25655
+ notify$1.success(t("messages.addressUpdated"));
25455
25656
  return onMembershipAdressUpdateSuccess(res);
25456
25657
  });
25457
25658
  }
@@ -25656,7 +25857,7 @@ const AddressSelectModal = ({
25656
25857
  switchView,
25657
25858
  switchToPaymentView,
25658
25859
  resetView
25659
- } = usePelcro();
25860
+ } = usePelcro$1();
25660
25861
 
25661
25862
  const onSuccess = selectedAddressId => {
25662
25863
  var _otherProps$onSuccess;
@@ -25734,7 +25935,7 @@ const PaymentMethodSelectContainer = ({
25734
25935
  const {
25735
25936
  set,
25736
25937
  selectedPaymentMethodId: selectedPaymentMethodIdFromStore
25737
- } = usePelcro();
25938
+ } = usePelcro$1();
25738
25939
 
25739
25940
  const submitPaymentMethod = ({
25740
25941
  selectedPaymentMethodId
@@ -25917,7 +26118,7 @@ const PaymentMethodSelectModal = ({
25917
26118
  switchToCheckoutForm,
25918
26119
  set,
25919
26120
  plan
25920
- } = usePelcro();
26121
+ } = usePelcro$1();
25921
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;
25922
26123
  React.useEffect(() => {
25923
26124
  if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
@@ -27225,7 +27426,7 @@ const SavedItems = ({
27225
27426
  const [isLoading, setLoading] = React.useState(false);
27226
27427
  const {
27227
27428
  isAuthenticated
27228
- } = usePelcro();
27429
+ } = usePelcro$1();
27229
27430
 
27230
27431
  const removeItemFromMetadata = (category, title) => {
27231
27432
  const user = window.Pelcro.user.read();
@@ -27424,7 +27625,7 @@ const SubscriptionsItems = ({
27424
27625
  setSubscriptionToCancel,
27425
27626
  setSubscriptionToSuspend,
27426
27627
  set
27427
- } = usePelcro();
27628
+ } = usePelcro$1();
27428
27629
  const subs = getNonDonationSubs();
27429
27630
  if (subs.length === 0) return null;
27430
27631
  return subs.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
@@ -27445,7 +27646,7 @@ const SubscriptionsItems = ({
27445
27646
  }
27446
27647
 
27447
27648
  onClose === null || onClose === void 0 ? void 0 : onClose();
27448
- notify.confirm((onSuccess, onFailure) => {
27649
+ notify$1.confirm((onSuccess, onFailure) => {
27449
27650
  cancelSubscription(sub.id, onSuccess, onFailure);
27450
27651
  }, {
27451
27652
  confirmMessage: t("messages.subCancellation.isSureToCancel"),
@@ -27503,7 +27704,7 @@ const SubscriptionsItems = ({
27503
27704
  }
27504
27705
 
27505
27706
  onClose === null || onClose === void 0 ? void 0 : onClose();
27506
- notify.confirm((onSuccess, onFailure) => {
27707
+ notify$1.confirm((onSuccess, onFailure) => {
27507
27708
  unSuspendSubscription(sub.id, onSuccess, onFailure);
27508
27709
  }, {
27509
27710
  confirmMessage: t("messages.subUnSuspend.isSureToUnSuspend"),
@@ -27949,11 +28150,56 @@ function SvgQrcode(props) {
27949
28150
  })));
27950
28151
  }
27951
28152
 
27952
- const DonationsMenu = () => {
28153
+ const DonationsMenu = ({
28154
+ reactivateSubscription,
28155
+ disableSubmit,
28156
+ cancelSubscription
28157
+ }) => {
27953
28158
  const {
27954
28159
  t
27955
28160
  } = useTranslation("dashboard");
28161
+ const {
28162
+ switchView,
28163
+ setSubscriptionToCancel
28164
+ } = usePelcro$1();
27956
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
+
27957
28203
  return /*#__PURE__*/React__default['default'].createElement("tr", {
27958
28204
  key: sub.id,
27959
28205
  className: "plc-w-full plc-align-top pelcro-donation-row"
@@ -27965,7 +28211,21 @@ const DonationsMenu = () => {
27965
28211
  className: "plc-text-xs plc-text-gray-400 pelcro-donation-price"
27966
28212
  }, getFormattedPriceByLocal(sub.plan.amount * sub.quantity, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("div", {
27967
28213
  className: "plc-mb-4 plc-text-gray-500 pelcro-donation-date"
27968
- }, 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")) : ""));
27969
28229
  });
27970
28230
  return /*#__PURE__*/React__default['default'].createElement("table", {
27971
28231
  className: "plc-w-full plc-table-fixed pelcro-donations-table"
@@ -27975,7 +28235,9 @@ const DonationsMenu = () => {
27975
28235
  className: "plc-w-6/12 "
27976
28236
  }, t("labels.plan")), /*#__PURE__*/React__default['default'].createElement("th", {
27977
28237
  className: "plc-w-6/12 "
27978
- }, 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", {
27979
28241
  className: "plc-h-4"
27980
28242
  }), subscriptions));
27981
28243
  };
@@ -28021,7 +28283,7 @@ const InvoicesItems = () => {
28021
28283
  const {
28022
28284
  setInvoice,
28023
28285
  switchView
28024
- } = usePelcro();
28286
+ } = usePelcro$1();
28025
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 : [];
28026
28288
 
28027
28289
  const showInvoiceDetails = event => {
@@ -28152,7 +28414,7 @@ const MembershipsItems = () => {
28152
28414
  switchView,
28153
28415
  setSelectedMembership,
28154
28416
  switchToAddressView
28155
- } = usePelcro();
28417
+ } = usePelcro$1();
28156
28418
  const memberships = getActiveMemberships();
28157
28419
 
28158
28420
  const onChangeAddressClick = membershipId => {
@@ -28232,7 +28494,7 @@ function DashboardWithHook(props) {
28232
28494
  resetView,
28233
28495
  logout,
28234
28496
  set
28235
- } = usePelcro();
28497
+ } = usePelcro$1();
28236
28498
  return /*#__PURE__*/React__default['default'].createElement(DashboardWithTrans, {
28237
28499
  setAddress: addressIdToEdit => set({
28238
28500
  addressIdToEdit
@@ -28808,7 +29070,11 @@ class Dashboard extends React.Component {
28808
29070
  className: "plc-transform plc-scale-120 plc-w-7 plc-h-8 plc-mr-1 plc-pt-1"
28809
29071
  }),
28810
29072
  title: this.locale("labels.donations"),
28811
- 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
+ })
28812
29078
  }), /*#__PURE__*/React__default['default'].createElement(Accordion.item, {
28813
29079
  name: SUB_MENUS.GIFTS,
28814
29080
  icon: /*#__PURE__*/React__default['default'].createElement(SvgGift, null),
@@ -28868,7 +29134,7 @@ const DashboardWithTrans = withTranslation("dashboard")(Dashboard);
28868
29134
  const DashboardOpenButton = () => {
28869
29135
  const {
28870
29136
  switchView
28871
- } = usePelcro();
29137
+ } = usePelcro$1();
28872
29138
  return /*#__PURE__*/React__default['default'].createElement("div", {
28873
29139
  className: "plc-fixed plc-right-4 plc-bottom-4 pelcro-open-dashboard-btn"
28874
29140
  }, /*#__PURE__*/React__default['default'].createElement("button", {
@@ -30857,11 +31123,34 @@ const EmailVerifyModal = ({
30857
31123
  onClose,
30858
31124
  ...otherProps
30859
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
+
30860
31147
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
30861
31148
  onDisplay: onDisplay,
30862
31149
  onClose: onClose,
30863
31150
  id: "pelcro-email-verify-modal"
30864
- }, /*#__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)));
30865
31154
  };
30866
31155
  EmailVerifyModal.viewId = "email-verify";
30867
31156
 
@@ -31009,14 +31298,14 @@ function VerifyLinkTokenModal({
31009
31298
  } = useTranslation("verifyLinkToken");
31010
31299
  const {
31011
31300
  resetView
31012
- } = usePelcro();
31301
+ } = usePelcro$1();
31013
31302
 
31014
31303
  const onSuccess = res => {
31015
31304
  var _props$onSuccess;
31016
31305
 
31017
31306
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
31018
31307
  resetView();
31019
- notify.success(t("messages.success"));
31308
+ notify$1.success(t("messages.success"));
31020
31309
  };
31021
31310
 
31022
31311
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
@@ -31059,7 +31348,7 @@ const InvoicePaymentModal = ({
31059
31348
  }) => {
31060
31349
  const {
31061
31350
  switchView
31062
- } = usePelcro();
31351
+ } = usePelcro$1();
31063
31352
 
31064
31353
  const onSuccess = () => {
31065
31354
  var _otherProps$onSuccess;
@@ -31136,7 +31425,7 @@ const InvoiceDetailsDownloadButton = ({
31136
31425
  } = useTranslation("invoiceDetails");
31137
31426
  const {
31138
31427
  invoice
31139
- } = usePelcro();
31428
+ } = usePelcro$1();
31140
31429
  return /*#__PURE__*/React__default['default'].createElement(Link, Object.assign({
31141
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}`,
31142
31431
  id: "pelcro-download-invoice-link",
@@ -31173,7 +31462,7 @@ const InvoiceDetailsView = props => {
31173
31462
  } = useTranslation("invoiceDetails");
31174
31463
  const {
31175
31464
  invoice
31176
- } = usePelcro();
31465
+ } = usePelcro$1();
31177
31466
  const showPayButton = canPayInvoice(invoice);
31178
31467
  const showDownloadButton = Boolean(invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf);
31179
31468
  const hasPlanDetails = Boolean(invoice.plan);
@@ -31241,7 +31530,7 @@ const InvoiceDetailsModal = ({
31241
31530
  }) => {
31242
31531
  const {
31243
31532
  switchToPaymentView
31244
- } = usePelcro();
31533
+ } = usePelcro$1();
31245
31534
 
31246
31535
  const onSuccess = () => {
31247
31536
  var _otherProps$onSuccess;
@@ -32899,6 +33188,7 @@ exports.UserUpdatePhone = UserUpdatePhone;
32899
33188
  exports.UserUpdateProfilePic = UserUpdateProfilePic;
32900
33189
  exports.UserUpdateTextInput = UserUpdateTextInput;
32901
33190
  exports.UserUpdateTin = UserUpdateTin;
33191
+ exports.UserUpdateUsername = UserUpdateUsername;
32902
33192
  exports.UserUpdateView = UserUpdateView;
32903
33193
  exports.VerifyLinkTokenContainer = VerifyLinkTokenContainer;
32904
33194
  exports.VerifyLinkTokenLoader = VerifyLinkTokenLoader;
@@ -32909,6 +33199,6 @@ exports.i18n = i18next;
32909
33199
  exports.initButtons = init$1;
32910
33200
  exports.initContentEntitlement = init;
32911
33201
  exports.invoicePaymentSubmitButton = invoicePaymentSubmitButton;
32912
- exports.notify = notify;
33202
+ exports.notify = notify$1;
32913
33203
  exports.unauthenticatedButtons = unauthenticatedButtons;
32914
- exports.usePelcro = usePelcro;
33204
+ exports.usePelcro = usePelcro$1;