@pelcro/react-pelcro-js 3.13.0-beta.15 → 3.13.0-beta.16

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
@@ -8613,7 +8613,7 @@ const createPelcroHook = store => {
8613
8613
 
8614
8614
  pelcroHook.override = fn => {
8615
8615
  const partialState = fn(store.setState, store.getState);
8616
- usePelcro.setState(partialState);
8616
+ usePelcro$1.setState(partialState);
8617
8617
  };
8618
8618
 
8619
8619
  pelcroHook.getStore = pelcroHook.getState;
@@ -8621,11 +8621,11 @@ const createPelcroHook = store => {
8621
8621
  };
8622
8622
 
8623
8623
  const pelcroStore = createPelcroStore();
8624
- const usePelcro = createPelcroHook(pelcroStore);
8624
+ const usePelcro$1 = createPelcroHook(pelcroStore);
8625
8625
  /* istanbul ignore next */
8626
8626
 
8627
8627
  if (process.env.NODE_ENV === "development") {
8628
- c$1("Pelcro Store", usePelcro);
8628
+ c$1("Pelcro Store", usePelcro$1);
8629
8629
  }
8630
8630
 
8631
8631
  /**
@@ -8830,7 +8830,7 @@ const trackSubscriptionOnGA = () => {
8830
8830
  product,
8831
8831
  plan,
8832
8832
  couponCode
8833
- } = usePelcro.getStore();
8833
+ } = usePelcro$1.getStore();
8834
8834
  /*
8835
8835
  getting the latest subscription id from invoices instead of subscriptions
8836
8836
  to handle gifted subs which are not added to subs list
@@ -9150,7 +9150,7 @@ class SaveToMetadataButtonClass {
9150
9150
  _defineProperty$3(this, "unauthenticated", () => {
9151
9151
  const {
9152
9152
  switchView
9153
- } = usePelcro.getStore();
9153
+ } = usePelcro$1.getStore();
9154
9154
 
9155
9155
  _classPrivateFieldGet(this, _onClick).call(this, () => switchView("login"));
9156
9156
 
@@ -9233,7 +9233,7 @@ class SaveToMetadataButtonClass {
9233
9233
  const user = window.Pelcro.user.read();
9234
9234
  const {
9235
9235
  switchView
9236
- } = usePelcro.getStore();
9236
+ } = usePelcro$1.getStore();
9237
9237
  const {
9238
9238
  key,
9239
9239
  ...buttonMetadata
@@ -10369,7 +10369,7 @@ const init$1 = () => {
10369
10369
  addToCart,
10370
10370
  purchaseItem,
10371
10371
  setSubscriptionToManageMembers
10372
- } = usePelcro.getStore();
10372
+ } = usePelcro$1.getStore();
10373
10373
  const pelcroDashboardButtonsByClass = document.getElementsByClassName("pelcro-dashboard-button");
10374
10374
 
10375
10375
  if (pelcroDashboardButtonsByClass.length !== 0) {
@@ -10672,7 +10672,7 @@ const init = () => {
10672
10672
  const {
10673
10673
  switchView,
10674
10674
  set
10675
- } = usePelcro.getStore();
10675
+ } = usePelcro$1.getStore();
10676
10676
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
10677
10677
 
10678
10678
  if (entitlementsProtectedElements.length === 0) {
@@ -10761,7 +10761,7 @@ function unblurElemWhenUserSubscribes(elem, entitlements) {
10761
10761
  document.addEventListener("PelcroSubscriptionCreate", event => {
10762
10762
  const {
10763
10763
  isGift
10764
- } = usePelcro.getStore();
10764
+ } = usePelcro$1.getStore();
10765
10765
  if (isGift) return;
10766
10766
  const latestSub = event.detail.data.subscriptions[event.detail.data.subscriptions.length - 1];
10767
10767
  const shouldUnblurContent = entitlements.some(ent => {
@@ -11083,7 +11083,7 @@ const initPaywalls = () => {
11083
11083
 
11084
11084
  const {
11085
11085
  switchView
11086
- } = usePelcro.getStore();
11086
+ } = usePelcro$1.getStore();
11087
11087
 
11088
11088
  if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
11089
11089
  /*
@@ -11105,7 +11105,7 @@ const loadPaymentSDKs = () => {
11105
11105
  // Lazy load stripe's SDK
11106
11106
  const {
11107
11107
  whenUserReady
11108
- } = usePelcro.getStore();
11108
+ } = usePelcro$1.getStore();
11109
11109
  whenUserReady(() => {
11110
11110
  if (!window.Stripe) {
11111
11111
  pure_1(window.Pelcro.environment.stripe);
@@ -11153,7 +11153,7 @@ const loadAuth0SDK = () => {
11153
11153
  const initSecuritySdk = () => {
11154
11154
  const {
11155
11155
  whenSiteReady
11156
- } = usePelcro.getStore();
11156
+ } = usePelcro$1.getStore();
11157
11157
  whenSiteReady(() => {
11158
11158
  var _window$Pelcro$site$r2;
11159
11159
 
@@ -11189,7 +11189,7 @@ const dispatchModalDisplayEvents = modalName => {
11189
11189
  const {
11190
11190
  whenSiteReady,
11191
11191
  whenEcommerceLoaded
11192
- } = usePelcro.getStore();
11192
+ } = usePelcro$1.getStore();
11193
11193
  const renderShopView = shopComponent => {
11194
11194
  whenEcommerceLoaded(() => {
11195
11195
  const shopElement = document.getElementById("pelcro-shop");
@@ -11271,7 +11271,7 @@ const initViewFromURL = () => {
11271
11271
  const {
11272
11272
  switchView,
11273
11273
  whenSiteReady
11274
- } = usePelcro.getStore();
11274
+ } = usePelcro$1.getStore();
11275
11275
 
11276
11276
  if (isValidViewFromURL(view)) {
11277
11277
  whenSiteReady(() => {
@@ -11329,7 +11329,7 @@ const initSubscriptionFromURL = () => {
11329
11329
  switchView,
11330
11330
  whenSiteReady,
11331
11331
  set
11332
- } = usePelcro.getStore();
11332
+ } = usePelcro$1.getStore();
11333
11333
  whenSiteReady(() => {
11334
11334
  var _selectedProduct$plan;
11335
11335
 
@@ -11353,7 +11353,7 @@ const initSubscriptionFromURL = () => {
11353
11353
  isAuthenticated,
11354
11354
  switchToAddressView,
11355
11355
  switchToPaymentView
11356
- } = usePelcro.getStore();
11356
+ } = usePelcro$1.getStore();
11357
11357
 
11358
11358
  if (!isAuthenticated()) {
11359
11359
  return switchView("register");
@@ -11385,7 +11385,7 @@ const initOfflineSubscriptionFromURL = offlinePlanId => {
11385
11385
  switchToPaymentView,
11386
11386
  switchToAddressView,
11387
11387
  set
11388
- } = usePelcro.getStore();
11388
+ } = usePelcro$1.getStore();
11389
11389
  whenSiteReady(() => {
11390
11390
  window.Pelcro.plan.getPlan({
11391
11391
  plan_id: offlinePlanId
@@ -11432,7 +11432,7 @@ const initPurchaseFromUrl = () => {
11432
11432
  const {
11433
11433
  whenEcommerceLoaded,
11434
11434
  purchaseItem
11435
- } = usePelcro.getStore();
11435
+ } = usePelcro$1.getStore();
11436
11436
  whenEcommerceLoaded(() => {
11437
11437
  const skuId = window.Pelcro.helpers.getURLParameter("sku_id");
11438
11438
  purchaseItem(skuId);
@@ -11448,7 +11448,7 @@ const initCartFromUrl = () => {
11448
11448
  whenEcommerceLoaded,
11449
11449
  addToCart,
11450
11450
  switchView
11451
- } = usePelcro.getStore();
11451
+ } = usePelcro$1.getStore();
11452
11452
  whenEcommerceLoaded(() => {
11453
11453
  const skusIdsParam = window.Pelcro.helpers.getURLParameter("sku_id");
11454
11454
  const skusIds = skusIdsParam === null || skusIdsParam === void 0 ? void 0 : skusIdsParam.split(",");
@@ -11469,7 +11469,7 @@ const verifyEmailTokenFromUrl = () => {
11469
11469
 
11470
11470
  const {
11471
11471
  whenSiteReady
11472
- } = usePelcro.getStore();
11472
+ } = usePelcro$1.getStore();
11473
11473
  const translations = i18next.t("verifyEmail:messages", {
11474
11474
  returnObjects: true
11475
11475
  });
@@ -11498,7 +11498,7 @@ const verifyLinkTokenFromUrl = () => {
11498
11498
  whenSiteReady,
11499
11499
  resetView,
11500
11500
  isAuthenticated
11501
- } = usePelcro.getStore();
11501
+ } = usePelcro$1.getStore();
11502
11502
  const translations = i18next.t("verifyLinkToken:messages", {
11503
11503
  returnObjects: true
11504
11504
  });
@@ -11537,12 +11537,12 @@ const showPasswordlessRequestFromUrl = () => {
11537
11537
 
11538
11538
  const {
11539
11539
  isAuthenticated
11540
- } = usePelcro.getStore();
11540
+ } = usePelcro$1.getStore();
11541
11541
  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;
11542
11542
  if (!passwordlessEnabled || isAuthenticated()) return;
11543
11543
  const {
11544
11544
  switchView
11545
- } = usePelcro.getStore();
11545
+ } = usePelcro$1.getStore();
11546
11546
  return switchView("passwordless-request");
11547
11547
  };
11548
11548
 
@@ -11553,7 +11553,7 @@ const showInvoiceDetailsFromUrl = () => {
11553
11553
  whenUserReady,
11554
11554
  whenSiteReady,
11555
11555
  switchView
11556
- } = usePelcro.getStore();
11556
+ } = usePelcro$1.getStore();
11557
11557
  whenSiteReady(() => {
11558
11558
  if (!isAuthenticated()) {
11559
11559
  return switchView("login");
@@ -11572,7 +11572,7 @@ const showInvoiceDetailsFromUrl = () => {
11572
11572
 
11573
11573
  const {
11574
11574
  invoice
11575
- } = usePelcro.getStore();
11575
+ } = usePelcro$1.getStore();
11576
11576
 
11577
11577
  if (invoice.total === 0) {
11578
11578
  const errorMessage = i18next.t("messages:zeroTotalInvoice", {
@@ -11593,7 +11593,7 @@ const showSubscriptionManageMembersFromUrl = () => {
11593
11593
  whenUserReady,
11594
11594
  whenSiteReady,
11595
11595
  switchView
11596
- } = usePelcro.getStore();
11596
+ } = usePelcro$1.getStore();
11597
11597
  whenSiteReady(() => {
11598
11598
  if (!isAuthenticated()) {
11599
11599
  return switchView("login");
@@ -11633,7 +11633,7 @@ const PelcroModalController = ({
11633
11633
  view,
11634
11634
  isAuthenticated,
11635
11635
  whenSiteReady
11636
- } = usePelcro();
11636
+ } = usePelcro$1();
11637
11637
  React__default['default'].useEffect(() => {
11638
11638
  init$1();
11639
11639
  renderShopView(React__default['default'].Children.map(children, child => child).find(({
@@ -13394,7 +13394,7 @@ function Modal({
13394
13394
  }) {
13395
13395
  var _window$Pelcro, _window$Pelcro$site$r;
13396
13396
 
13397
- const resetView = usePelcro(state => state.resetView);
13397
+ const resetView = usePelcro$1(state => state.resetView);
13398
13398
  React.useEffect(() => {
13399
13399
  onDisplay === null || onDisplay === void 0 ? void 0 : onDisplay();
13400
13400
  dispatchModalDisplayEvents(id);
@@ -13467,8 +13467,11 @@ function LoginModal({
13467
13467
  const {
13468
13468
  switchView,
13469
13469
  resetView,
13470
- invoice
13471
- } = usePelcro();
13470
+ product,
13471
+ plan,
13472
+ switchToAddressView,
13473
+ switchToPaymentView
13474
+ } = usePelcro$1();
13472
13475
 
13473
13476
  const onSuccess = res => {
13474
13477
  var _props$onSuccess;
@@ -13479,6 +13482,14 @@ function LoginModal({
13479
13482
  initPaywalls();
13480
13483
  }
13481
13484
 
13485
+ if (product && plan) {
13486
+ if (product.address_required) {
13487
+ return switchToAddressView();
13488
+ } else {
13489
+ return switchToPaymentView();
13490
+ }
13491
+ }
13492
+
13482
13493
  resetView();
13483
13494
  const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
13484
13495
 
@@ -13805,7 +13816,7 @@ function RegisterView(props) {
13805
13816
  } = useTranslation("register");
13806
13817
  const {
13807
13818
  product
13808
- } = usePelcro();
13819
+ } = usePelcro$1();
13809
13820
  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");
13810
13821
  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");
13811
13822
  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);
@@ -14036,7 +14047,7 @@ function RegisterModal(props) {
14036
14047
  order,
14037
14048
  giftCode,
14038
14049
  isGift
14039
- } = usePelcro();
14050
+ } = usePelcro$1();
14040
14051
 
14041
14052
  const onSuccess = res => {
14042
14053
  var _props$onSuccess;
@@ -14158,7 +14169,7 @@ function SelectModalWithHook(props) {
14158
14169
  resetView,
14159
14170
  view,
14160
14171
  set
14161
- } = usePelcro();
14172
+ } = usePelcro$1();
14162
14173
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
14163
14174
  const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
14164
14175
  return /*#__PURE__*/React__default['default'].createElement(SelectModalWithTrans, {
@@ -14430,7 +14441,7 @@ class SelectModal extends React.Component {
14430
14441
  const {
14431
14442
  switchToAddressView,
14432
14443
  switchToPaymentView
14433
- } = usePelcro.getStore();
14444
+ } = usePelcro$1.getStore();
14434
14445
 
14435
14446
  if (!isAuthenticated) {
14436
14447
  return setView("register");
@@ -16633,16 +16644,16 @@ const PaymentMethodContainerWithoutStripe = ({
16633
16644
  const {
16634
16645
  t
16635
16646
  } = useTranslation("payment");
16636
- const pelcroStore = usePelcro();
16647
+ const pelcroStore = usePelcro$1();
16637
16648
  const {
16638
16649
  set,
16639
16650
  order,
16640
16651
  selectedPaymentMethodId,
16641
16652
  couponCode
16642
- } = usePelcro();
16653
+ } = usePelcro$1();
16643
16654
  const {
16644
16655
  whenUserReady
16645
- } = usePelcro.getStore();
16656
+ } = usePelcro$1.getStore();
16646
16657
  const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
16647
16658
  const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
16648
16659
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
@@ -18322,7 +18333,7 @@ const PaymentMethodContainer = props => {
18322
18333
  const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
18323
18334
  const {
18324
18335
  whenUserReady
18325
- } = usePelcro.getStore();
18336
+ } = usePelcro$1.getStore();
18326
18337
  React.useEffect(() => {
18327
18338
  whenUserReady(() => {
18328
18339
  if (!window.Stripe) {
@@ -18423,7 +18434,7 @@ const PelcroPaymentRequestButton = props => {
18423
18434
  const CheckoutForm = () => {
18424
18435
  const {
18425
18436
  selectedPaymentMethodId
18426
- } = usePelcro();
18437
+ } = usePelcro$1();
18427
18438
  const cardProcessor = getSiteCardProcessor();
18428
18439
 
18429
18440
  if (selectedPaymentMethodId) {
@@ -18478,7 +18489,7 @@ const DiscountedPrice = props => {
18478
18489
  const {
18479
18490
  order,
18480
18491
  plan
18481
- } = usePelcro();
18492
+ } = usePelcro$1();
18482
18493
  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;
18483
18494
  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;
18484
18495
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
@@ -18514,7 +18525,7 @@ const SubmitPaymentMethod = ({
18514
18525
 
18515
18526
  const {
18516
18527
  plan
18517
- } = usePelcro();
18528
+ } = usePelcro$1();
18518
18529
  const {
18519
18530
  t
18520
18531
  } = useTranslation("checkoutForm");
@@ -18946,7 +18957,7 @@ const PaypalSubscribeButton = props => {
18946
18957
  plan,
18947
18958
  invoice,
18948
18959
  selectedAddressId
18949
- } = usePelcro();
18960
+ } = usePelcro$1();
18950
18961
  React.useEffect(() => {
18951
18962
  var _ref, _ref2, _state$updatedPrice, _props$plan, _props$selectedAddres;
18952
18963
 
@@ -19088,7 +19099,7 @@ const SelectedPaymentMethod = () => {
19088
19099
  const {
19089
19100
  switchView,
19090
19101
  selectedPaymentMethodId
19091
- } = usePelcro();
19102
+ } = usePelcro$1();
19092
19103
  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 => {
19093
19104
  return source.id == selectedPaymentMethodId;
19094
19105
  });
@@ -19129,7 +19140,7 @@ const TaxAmount = () => {
19129
19140
  } = React.useContext(store$k);
19130
19141
  const {
19131
19142
  plan
19132
- } = usePelcro();
19143
+ } = usePelcro$1();
19133
19144
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
19134
19145
  const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19135
19146
  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;
@@ -19275,7 +19286,7 @@ const SubscriptionRenewView = ({
19275
19286
  const {
19276
19287
  product,
19277
19288
  plan
19278
- } = usePelcro();
19289
+ } = usePelcro$1();
19279
19290
  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;
19280
19291
  const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
19281
19292
 
@@ -19330,7 +19341,7 @@ function SubscriptionRenewModal({
19330
19341
  }) {
19331
19342
  const {
19332
19343
  switchView
19333
- } = usePelcro();
19344
+ } = usePelcro$1();
19334
19345
 
19335
19346
  const onSuccess = res => {
19336
19347
  var _otherProps$onSuccess, _ReactGA$event;
@@ -19535,7 +19546,7 @@ const SubscriptionCancelNowButton = ({
19535
19546
  }) => {
19536
19547
  const {
19537
19548
  switchView
19538
- } = usePelcro();
19549
+ } = usePelcro$1();
19539
19550
  const {
19540
19551
  state: {
19541
19552
  cancelationReason
@@ -19607,7 +19618,7 @@ const SubscriptionCancelLaterButton = ({
19607
19618
  }) => {
19608
19619
  const {
19609
19620
  switchView
19610
- } = usePelcro();
19621
+ } = usePelcro$1();
19611
19622
  const {
19612
19623
  state: {
19613
19624
  cancelationReason
@@ -19675,7 +19686,7 @@ const SubscriptionCancelLaterButton = ({
19675
19686
  const SubscriptionCancelView = props => {
19676
19687
  const {
19677
19688
  subscriptionToCancel
19678
- } = usePelcro();
19689
+ } = usePelcro$1();
19679
19690
  const {
19680
19691
  t
19681
19692
  } = useTranslation("subscriptionCancel");
@@ -19849,7 +19860,7 @@ const SubscriptionSuspendButton = ({
19849
19860
  }) => {
19850
19861
  const {
19851
19862
  switchView
19852
- } = usePelcro();
19863
+ } = usePelcro$1();
19853
19864
  const {
19854
19865
  state: {
19855
19866
  suspendDate,
@@ -19913,7 +19924,7 @@ const SubscriptionSuspendButton = ({
19913
19924
  const SubscriptionSuspendView = props => {
19914
19925
  const {
19915
19926
  subscriptionToSuspend
19916
- } = usePelcro();
19927
+ } = usePelcro$1();
19917
19928
  const {
19918
19929
  t
19919
19930
  } = useTranslation("subscriptionSuspend");
@@ -20006,7 +20017,7 @@ const getCurrentFlow = () => {
20006
20017
  giftRecipient,
20007
20018
  giftCode,
20008
20019
  invoice
20009
- } = usePelcro.getStore();
20020
+ } = usePelcro$1.getStore();
20010
20021
 
20011
20022
  if (invoice) {
20012
20023
  return "invoicePayment";
@@ -20025,7 +20036,7 @@ const getSuccessContent = i18n => {
20025
20036
  const flow = getCurrentFlow();
20026
20037
  const {
20027
20038
  product
20028
- } = usePelcro.getStore();
20039
+ } = usePelcro$1.getStore();
20029
20040
  const wordingDictionary = {
20030
20041
  subscriptionSuccess: {
20031
20042
  successIcon: /*#__PURE__*/React__default['default'].createElement(SvgCheckSolid, {
@@ -20069,7 +20080,7 @@ function PaymentSuccessModal({
20069
20080
  }) {
20070
20081
  const {
20071
20082
  resetView
20072
- } = usePelcro();
20083
+ } = usePelcro$1();
20073
20084
 
20074
20085
  const onClose = () => {
20075
20086
  var _props$onClose;
@@ -20102,7 +20113,7 @@ function NewsletterWithHook(props) {
20102
20113
  switchView,
20103
20114
  resetView,
20104
20115
  product
20105
- } = usePelcro();
20116
+ } = usePelcro$1();
20106
20117
  return /*#__PURE__*/React__default['default'].createElement(NewsLetter, {
20107
20118
  onClose: () => {
20108
20119
  var _props$onClose;
@@ -20601,7 +20612,7 @@ const MeterView = () => {
20601
20612
  switchView,
20602
20613
  product,
20603
20614
  isAuthenticated
20604
- } = usePelcro();
20615
+ } = usePelcro$1();
20605
20616
  const paywallProduct = product !== null && product !== void 0 ? product : window.Pelcro.paywall.getProduct();
20606
20617
  const visitsLeft = window.Pelcro.paywall.freeVisitsLeft();
20607
20618
  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}`;
@@ -20623,7 +20634,7 @@ const MeterView = () => {
20623
20634
  const MeterModal = props => {
20624
20635
  const {
20625
20636
  resetView
20626
- } = usePelcro();
20637
+ } = usePelcro$1();
20627
20638
  React.useEffect(() => {
20628
20639
  var _props$onDisplay;
20629
20640
 
@@ -20661,7 +20672,7 @@ const SubscriptionCreateView = ({
20661
20672
  const {
20662
20673
  product,
20663
20674
  plan
20664
- } = usePelcro();
20675
+ } = usePelcro$1();
20665
20676
  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;
20666
20677
  const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
20667
20678
 
@@ -20719,7 +20730,7 @@ function SubscriptionCreateModal({
20719
20730
  useTranslation("common");
20720
20731
  const {
20721
20732
  switchView
20722
- } = usePelcro();
20733
+ } = usePelcro$1();
20723
20734
 
20724
20735
  const onSuccess = res => {
20725
20736
  var _otherProps$onSuccess;
@@ -20765,7 +20776,7 @@ const SubscriptionManageMembersContainer = ({
20765
20776
  }) => {
20766
20777
  const {
20767
20778
  subscriptionToManageMembers
20768
- } = usePelcro();
20779
+ } = usePelcro$1();
20769
20780
  const subscription_id = subscriptionToManageMembers === null || subscriptionToManageMembers === void 0 ? void 0 : subscriptionToManageMembers.id;
20770
20781
 
20771
20782
  const handleListMembers = ({}, dispatch) => {
@@ -21809,7 +21820,7 @@ function UserUpdateModal({
21809
21820
  }) {
21810
21821
  const {
21811
21822
  switchView
21812
- } = usePelcro();
21823
+ } = usePelcro$1();
21813
21824
 
21814
21825
  const onPictureClick = () => {
21815
21826
  switchView("profile-picture");
@@ -21918,7 +21929,7 @@ const AddressCreateContainer = ({
21918
21929
  order,
21919
21930
  set,
21920
21931
  selectedMembership
21921
- } = usePelcro();
21932
+ } = usePelcro$1();
21922
21933
  const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
21923
21934
  const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
21924
21935
  React.useEffect(() => {
@@ -22675,7 +22686,7 @@ const AddressCreateModal = ({
22675
22686
  switchView,
22676
22687
  switchToPaymentView,
22677
22688
  resetView
22678
- } = usePelcro();
22689
+ } = usePelcro$1();
22679
22690
 
22680
22691
  const onSuccess = newAddressId => {
22681
22692
  var _otherProps$onSuccess;
@@ -22768,7 +22779,7 @@ const AddressUpdateContainer = ({
22768
22779
 
22769
22780
  const {
22770
22781
  addressIdToEdit
22771
- } = usePelcro();
22782
+ } = usePelcro$1();
22772
22783
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
22773
22784
  const [t] = useTranslation("address");
22774
22785
  React.useEffect(() => {
@@ -23859,7 +23870,7 @@ const PasswordForgotModal = ({
23859
23870
  } = useTranslation("passwordForgot");
23860
23871
  const {
23861
23872
  switchView
23862
- } = usePelcro();
23873
+ } = usePelcro$1();
23863
23874
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
23864
23875
  id: "pelcro-password-forgot-modal",
23865
23876
  onDisplay: onDisplay,
@@ -24444,7 +24455,7 @@ const CartContainer = ({
24444
24455
  const {
24445
24456
  cartItems,
24446
24457
  set
24447
- } = usePelcro();
24458
+ } = usePelcro$1();
24448
24459
  const {
24449
24460
  t
24450
24461
  } = useTranslation("shop");
@@ -24549,7 +24560,7 @@ const CartRemoveItemButton = ({
24549
24560
  }) => {
24550
24561
  const {
24551
24562
  removeFromCart
24552
- } = usePelcro();
24563
+ } = usePelcro$1();
24553
24564
  return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
24554
24565
  variant: "icon",
24555
24566
  "data-key": itemId,
@@ -24612,7 +24623,7 @@ const CartTotalPrice = () => {
24612
24623
  } = React.useContext(store$8);
24613
24624
  const {
24614
24625
  cartItems
24615
- } = usePelcro();
24626
+ } = usePelcro$1();
24616
24627
  const totalPriceCurrency = cartItems[0].currency;
24617
24628
  const {
24618
24629
  t
@@ -24632,7 +24643,7 @@ const CartTotalPrice = () => {
24632
24643
  const CartView = props => {
24633
24644
  const {
24634
24645
  cartItems
24635
- } = usePelcro();
24646
+ } = usePelcro$1();
24636
24647
  const {
24637
24648
  t
24638
24649
  } = useTranslation("cart");
@@ -24693,7 +24704,7 @@ const CartModal = ({
24693
24704
  switchView,
24694
24705
  switchToAddressView,
24695
24706
  isAuthenticated
24696
- } = usePelcro();
24707
+ } = usePelcro$1();
24697
24708
 
24698
24709
  const onSuccess = items => {
24699
24710
  var _otherProps$onSuccess;
@@ -24725,7 +24736,7 @@ const ShopSelectProductButton = ({
24725
24736
  }) => {
24726
24737
  const {
24727
24738
  addToCart
24728
- } = usePelcro();
24739
+ } = usePelcro$1();
24729
24740
  const {
24730
24741
  t
24731
24742
  } = useTranslation("shop");
@@ -24757,7 +24768,7 @@ const ShopPurchaseButton = ({
24757
24768
  }) => {
24758
24769
  const {
24759
24770
  purchaseItem
24760
- } = usePelcro();
24771
+ } = usePelcro$1();
24761
24772
  const {
24762
24773
  t
24763
24774
  } = useTranslation("shop");
@@ -24833,7 +24844,7 @@ const OrderCreateModal = ({
24833
24844
  }) => {
24834
24845
  const {
24835
24846
  switchView
24836
- } = usePelcro();
24847
+ } = usePelcro$1();
24837
24848
 
24838
24849
  const onSuccess = () => {
24839
24850
  var _otherProps$onSuccess;
@@ -24863,7 +24874,7 @@ const OrderConfirmModal = props => {
24863
24874
  } = useTranslation("shop");
24864
24875
  const {
24865
24876
  resetView
24866
- } = usePelcro();
24877
+ } = usePelcro$1();
24867
24878
 
24868
24879
  const onClose = () => {
24869
24880
  var _props$onClose;
@@ -24955,7 +24966,7 @@ const GiftCreateContainer = ({
24955
24966
  } = useTranslation("register");
24956
24967
  const {
24957
24968
  set
24958
- } = usePelcro();
24969
+ } = usePelcro$1();
24959
24970
 
24960
24971
  const handleSubmit = (state, dispatch) => {
24961
24972
  const giftRecipient = {
@@ -25247,7 +25258,7 @@ const GiftCreateModal = ({
25247
25258
  switchToAddressView,
25248
25259
  switchToPaymentView,
25249
25260
  product
25250
- } = usePelcro();
25261
+ } = usePelcro$1();
25251
25262
 
25252
25263
  const onSuccess = giftRecipient => {
25253
25264
  var _otherProps$onSuccess;
@@ -25304,13 +25315,13 @@ const GiftRedeemContainer = ({
25304
25315
  } = useTranslation("register");
25305
25316
  const {
25306
25317
  set
25307
- } = usePelcro();
25318
+ } = usePelcro$1();
25308
25319
  const {
25309
25320
  switchView,
25310
25321
  switchToAddressView,
25311
25322
  isAuthenticated,
25312
25323
  subscriptionIdToRenew: subscriptionIdToRenewFromStore
25313
- } = usePelcro();
25324
+ } = usePelcro$1();
25314
25325
  const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
25315
25326
  React.useEffect(() => {
25316
25327
  onDisplay();
@@ -25523,7 +25534,7 @@ const GiftRedeemModal = ({
25523
25534
  switchView,
25524
25535
  switchToAddressView,
25525
25536
  isAuthenticated
25526
- } = usePelcro();
25537
+ } = usePelcro$1();
25527
25538
 
25528
25539
  const onSuccess = giftCode => {
25529
25540
  var _otherProps$onSuccess;
@@ -25590,7 +25601,7 @@ const AddressSelectContainer = ({
25590
25601
  subscriptionIdToRenew: subscriptionIdToRenewFromStore,
25591
25602
  set,
25592
25603
  selectedMembership
25593
- } = usePelcro();
25604
+ } = usePelcro$1();
25594
25605
  const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
25595
25606
  const subscriptionIdToRenew = (_ref = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref !== void 0 ? _ref : undefined;
25596
25607
 
@@ -25832,7 +25843,7 @@ const AddressSelectModal = ({
25832
25843
  switchView,
25833
25844
  switchToPaymentView,
25834
25845
  resetView
25835
- } = usePelcro();
25846
+ } = usePelcro$1();
25836
25847
 
25837
25848
  const onSuccess = selectedAddressId => {
25838
25849
  var _otherProps$onSuccess;
@@ -25910,7 +25921,7 @@ const PaymentMethodSelectContainer = ({
25910
25921
  const {
25911
25922
  set,
25912
25923
  selectedPaymentMethodId: selectedPaymentMethodIdFromStore
25913
- } = usePelcro();
25924
+ } = usePelcro$1();
25914
25925
 
25915
25926
  const submitPaymentMethod = ({
25916
25927
  selectedPaymentMethodId
@@ -26093,7 +26104,7 @@ const PaymentMethodSelectModal = ({
26093
26104
  switchToCheckoutForm,
26094
26105
  set,
26095
26106
  plan
26096
- } = usePelcro();
26107
+ } = usePelcro$1();
26097
26108
  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;
26098
26109
  React.useEffect(() => {
26099
26110
  if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
@@ -27401,7 +27412,7 @@ const SavedItems = ({
27401
27412
  const [isLoading, setLoading] = React.useState(false);
27402
27413
  const {
27403
27414
  isAuthenticated
27404
- } = usePelcro();
27415
+ } = usePelcro$1();
27405
27416
 
27406
27417
  const removeItemFromMetadata = (category, title) => {
27407
27418
  const user = window.Pelcro.user.read();
@@ -27600,7 +27611,7 @@ const SubscriptionsItems = ({
27600
27611
  setSubscriptionToCancel,
27601
27612
  setSubscriptionToSuspend,
27602
27613
  set
27603
- } = usePelcro();
27614
+ } = usePelcro$1();
27604
27615
  const subs = getNonDonationSubs();
27605
27616
  if (subs.length === 0) return null;
27606
27617
  return subs.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
@@ -28197,7 +28208,7 @@ const InvoicesItems = () => {
28197
28208
  const {
28198
28209
  setInvoice,
28199
28210
  switchView
28200
- } = usePelcro();
28211
+ } = usePelcro$1();
28201
28212
  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 : [];
28202
28213
 
28203
28214
  const showInvoiceDetails = event => {
@@ -28328,7 +28339,7 @@ const MembershipsItems = () => {
28328
28339
  switchView,
28329
28340
  setSelectedMembership,
28330
28341
  switchToAddressView
28331
- } = usePelcro();
28342
+ } = usePelcro$1();
28332
28343
  const memberships = getActiveMemberships();
28333
28344
 
28334
28345
  const onChangeAddressClick = membershipId => {
@@ -28408,7 +28419,7 @@ function DashboardWithHook(props) {
28408
28419
  resetView,
28409
28420
  logout,
28410
28421
  set
28411
- } = usePelcro();
28422
+ } = usePelcro$1();
28412
28423
  return /*#__PURE__*/React__default['default'].createElement(DashboardWithTrans, {
28413
28424
  setAddress: addressIdToEdit => set({
28414
28425
  addressIdToEdit
@@ -29044,7 +29055,7 @@ const DashboardWithTrans = withTranslation("dashboard")(Dashboard);
29044
29055
  const DashboardOpenButton = () => {
29045
29056
  const {
29046
29057
  switchView
29047
- } = usePelcro();
29058
+ } = usePelcro$1();
29048
29059
  return /*#__PURE__*/React__default['default'].createElement("div", {
29049
29060
  className: "plc-fixed plc-right-4 plc-bottom-4 pelcro-open-dashboard-btn"
29050
29061
  }, /*#__PURE__*/React__default['default'].createElement("button", {
@@ -31033,11 +31044,34 @@ const EmailVerifyModal = ({
31033
31044
  onClose,
31034
31045
  ...otherProps
31035
31046
  }) => {
31047
+ const {
31048
+ product,
31049
+ plan,
31050
+ switchToAddressView,
31051
+ switchToPaymentView
31052
+ } = usePelcro();
31053
+
31054
+ const onSuccess = res => {
31055
+ var _props$onSuccess, _props;
31056
+
31057
+ (_props$onSuccess = (_props = props).onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(_props, res);
31058
+
31059
+ if (product && plan) {
31060
+ if (product.address_required) {
31061
+ return switchToAddressView();
31062
+ } else {
31063
+ return switchToPaymentView();
31064
+ }
31065
+ }
31066
+ };
31067
+
31036
31068
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
31037
31069
  onDisplay: onDisplay,
31038
31070
  onClose: onClose,
31039
31071
  id: "pelcro-email-verify-modal"
31040
- }, /*#__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)));
31072
+ }, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(EmailVerifyView, Object.assign({
31073
+ onSuccess: onSuccess
31074
+ }, otherProps))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
31041
31075
  };
31042
31076
  EmailVerifyModal.viewId = "email-verify";
31043
31077
 
@@ -31185,7 +31219,7 @@ function VerifyLinkTokenModal({
31185
31219
  } = useTranslation("verifyLinkToken");
31186
31220
  const {
31187
31221
  resetView
31188
- } = usePelcro();
31222
+ } = usePelcro$1();
31189
31223
 
31190
31224
  const onSuccess = res => {
31191
31225
  var _props$onSuccess;
@@ -31235,7 +31269,7 @@ const InvoicePaymentModal = ({
31235
31269
  }) => {
31236
31270
  const {
31237
31271
  switchView
31238
- } = usePelcro();
31272
+ } = usePelcro$1();
31239
31273
 
31240
31274
  const onSuccess = () => {
31241
31275
  var _otherProps$onSuccess;
@@ -31312,7 +31346,7 @@ const InvoiceDetailsDownloadButton = ({
31312
31346
  } = useTranslation("invoiceDetails");
31313
31347
  const {
31314
31348
  invoice
31315
- } = usePelcro();
31349
+ } = usePelcro$1();
31316
31350
  return /*#__PURE__*/React__default['default'].createElement(Link, Object.assign({
31317
31351
  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}`,
31318
31352
  id: "pelcro-download-invoice-link",
@@ -31349,7 +31383,7 @@ const InvoiceDetailsView = props => {
31349
31383
  } = useTranslation("invoiceDetails");
31350
31384
  const {
31351
31385
  invoice
31352
- } = usePelcro();
31386
+ } = usePelcro$1();
31353
31387
  const showPayButton = canPayInvoice(invoice);
31354
31388
  const showDownloadButton = Boolean(invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf);
31355
31389
  const hasPlanDetails = Boolean(invoice.plan);
@@ -31417,7 +31451,7 @@ const InvoiceDetailsModal = ({
31417
31451
  }) => {
31418
31452
  const {
31419
31453
  switchToPaymentView
31420
- } = usePelcro();
31454
+ } = usePelcro$1();
31421
31455
 
31422
31456
  const onSuccess = () => {
31423
31457
  var _otherProps$onSuccess;
@@ -33088,4 +33122,4 @@ exports.initContentEntitlement = init;
33088
33122
  exports.invoicePaymentSubmitButton = invoicePaymentSubmitButton;
33089
33123
  exports.notify = notify;
33090
33124
  exports.unauthenticatedButtons = unauthenticatedButtons;
33091
- exports.usePelcro = usePelcro;
33125
+ exports.usePelcro = usePelcro$1;