@pelcro/react-pelcro-js 3.17.0-beta.11 → 3.17.0-beta.12

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
@@ -8558,17 +8558,17 @@ const createPelcroHook = store => {
8558
8558
  */
8559
8559
  pelcroHook.override = fn => {
8560
8560
  const partialState = fn(store.setState, store.getState);
8561
- usePelcro$1.setState(partialState);
8561
+ usePelcro.setState(partialState);
8562
8562
  };
8563
8563
  pelcroHook.getStore = pelcroHook.getState;
8564
8564
  return pelcroHook;
8565
8565
  };
8566
8566
  const pelcroStore = createPelcroStore();
8567
- const usePelcro$1 = createPelcroHook(pelcroStore);
8567
+ const usePelcro = createPelcroHook(pelcroStore);
8568
8568
 
8569
8569
  /* istanbul ignore next */
8570
8570
  if (process.env.NODE_ENV === "development") {
8571
- c$1("Pelcro Store", usePelcro$1);
8571
+ c$1("Pelcro Store", usePelcro);
8572
8572
  }
8573
8573
 
8574
8574
  /**
@@ -8760,7 +8760,7 @@ const trackSubscriptionOnGA = () => {
8760
8760
  product,
8761
8761
  plan,
8762
8762
  couponCode
8763
- } = usePelcro$1.getStore();
8763
+ } = usePelcro.getStore();
8764
8764
 
8765
8765
  /*
8766
8766
  getting the latest subscription id from invoices instead of subscriptions
@@ -9067,7 +9067,7 @@ class SaveToMetadataButtonClass {
9067
9067
  _defineProperty$3(this, "unauthenticated", () => {
9068
9068
  const {
9069
9069
  switchView
9070
- } = usePelcro$1.getStore();
9070
+ } = usePelcro.getStore();
9071
9071
  _classPrivateFieldGet(this, _onClick).call(this, () => switchView("login"));
9072
9072
  _classPrivateFieldGet(this, _unmarkAllSavedButtons).call(this);
9073
9073
  });
@@ -9136,7 +9136,7 @@ class SaveToMetadataButtonClass {
9136
9136
  const user = window.Pelcro.user.read();
9137
9137
  const {
9138
9138
  switchView
9139
- } = usePelcro$1.getStore();
9139
+ } = usePelcro.getStore();
9140
9140
  const {
9141
9141
  key,
9142
9142
  ...buttonMetadata
@@ -10237,7 +10237,7 @@ const init$1 = () => {
10237
10237
  addToCart,
10238
10238
  purchaseItem,
10239
10239
  setSubscriptionToManageMembers
10240
- } = usePelcro$1.getStore();
10240
+ } = usePelcro.getStore();
10241
10241
  const pelcroDashboardButtonsByClass = document.getElementsByClassName("pelcro-dashboard-button");
10242
10242
  if (pelcroDashboardButtonsByClass.length !== 0) {
10243
10243
  for (let i = 0; i < pelcroDashboardButtonsByClass.length; i++) {
@@ -10491,7 +10491,7 @@ const init = () => {
10491
10491
  const {
10492
10492
  switchView,
10493
10493
  set
10494
- } = usePelcro$1.getStore();
10494
+ } = usePelcro.getStore();
10495
10495
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
10496
10496
  if (entitlementsProtectedElements.length === 0) {
10497
10497
  return false;
@@ -10569,7 +10569,7 @@ function unblurElemWhenUserSubscribes(elem, entitlements) {
10569
10569
  document.addEventListener("PelcroSubscriptionCreate", event => {
10570
10570
  const {
10571
10571
  isGift
10572
- } = usePelcro$1.getStore();
10572
+ } = usePelcro.getStore();
10573
10573
  if (isGift) return;
10574
10574
  const latestSub = event.detail.data.subscriptions[event.detail.data.subscriptions.length - 1];
10575
10575
  const shouldUnblurContent = entitlements.some(ent => {
@@ -10896,7 +10896,7 @@ const initPaywalls = () => {
10896
10896
  }
10897
10897
  const {
10898
10898
  switchView
10899
- } = usePelcro$1.getStore();
10899
+ } = usePelcro.getStore();
10900
10900
  if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
10901
10901
  /*
10902
10902
  showing both the meter and the entitlements notification doesn't make sense from
@@ -10917,7 +10917,7 @@ const loadPaymentSDKs = () => {
10917
10917
  // Lazy load stripe's SDK
10918
10918
  const {
10919
10919
  whenUserReady
10920
- } = usePelcro$1.getStore();
10920
+ } = usePelcro.getStore();
10921
10921
  whenUserReady(() => {
10922
10922
  if (!window.Stripe) {
10923
10923
  pure_1(window.Pelcro.environment.stripe);
@@ -10961,7 +10961,7 @@ const loadAuth0SDK = () => {
10961
10961
  const initSecuritySdk = () => {
10962
10962
  const {
10963
10963
  whenSiteReady
10964
- } = usePelcro$1.getStore();
10964
+ } = usePelcro.getStore();
10965
10965
  whenSiteReady(() => {
10966
10966
  var _window$Pelcro$site$r2;
10967
10967
  const securityKey = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.security_key;
@@ -10994,7 +10994,7 @@ const dispatchModalDisplayEvents = modalName => {
10994
10994
  const {
10995
10995
  whenSiteReady,
10996
10996
  whenEcommerceLoaded
10997
- } = usePelcro$1.getStore();
10997
+ } = usePelcro.getStore();
10998
10998
  const renderShopView = shopComponent => {
10999
10999
  whenEcommerceLoaded(() => {
11000
11000
  const shopElement = document.getElementById("pelcro-shop");
@@ -11069,7 +11069,7 @@ const initViewFromURL = () => {
11069
11069
  const {
11070
11070
  switchView,
11071
11071
  whenSiteReady
11072
- } = usePelcro$1.getStore();
11072
+ } = usePelcro.getStore();
11073
11073
  if (isValidViewFromURL(view)) {
11074
11074
  whenSiteReady(() => {
11075
11075
  if (view === "plan-select") {
@@ -11116,7 +11116,7 @@ const initSubscriptionFromURL = () => {
11116
11116
  switchView,
11117
11117
  whenSiteReady,
11118
11118
  set
11119
- } = usePelcro$1.getStore();
11119
+ } = usePelcro.getStore();
11120
11120
  whenSiteReady(() => {
11121
11121
  var _selectedProduct$plan;
11122
11122
  const productsList = window.Pelcro.product.list();
@@ -11137,7 +11137,7 @@ const initSubscriptionFromURL = () => {
11137
11137
  isAuthenticated,
11138
11138
  switchToAddressView,
11139
11139
  switchToPaymentView
11140
- } = usePelcro$1.getStore();
11140
+ } = usePelcro.getStore();
11141
11141
  if (!isAuthenticated()) {
11142
11142
  return switchView("register");
11143
11143
  }
@@ -11164,7 +11164,7 @@ const initOfflineSubscriptionFromURL = offlinePlanId => {
11164
11164
  switchToPaymentView,
11165
11165
  switchToAddressView,
11166
11166
  set
11167
- } = usePelcro$1.getStore();
11167
+ } = usePelcro.getStore();
11168
11168
  whenSiteReady(() => {
11169
11169
  window.Pelcro.plan.getPlan({
11170
11170
  plan_id: offlinePlanId
@@ -11205,7 +11205,7 @@ const initPurchaseFromUrl = () => {
11205
11205
  const {
11206
11206
  whenEcommerceLoaded,
11207
11207
  purchaseItem
11208
- } = usePelcro$1.getStore();
11208
+ } = usePelcro.getStore();
11209
11209
  whenEcommerceLoaded(() => {
11210
11210
  const skuId = window.Pelcro.helpers.getURLParameter("sku_id");
11211
11211
  purchaseItem(skuId);
@@ -11221,7 +11221,7 @@ const initCartFromUrl = () => {
11221
11221
  whenEcommerceLoaded,
11222
11222
  addToCart,
11223
11223
  switchView
11224
- } = usePelcro$1.getStore();
11224
+ } = usePelcro.getStore();
11225
11225
  whenEcommerceLoaded(() => {
11226
11226
  const skusIdsParam = window.Pelcro.helpers.getURLParameter("sku_id");
11227
11227
  const skusIds = skusIdsParam === null || skusIdsParam === void 0 ? void 0 : skusIdsParam.split(",");
@@ -11239,7 +11239,7 @@ const verifyEmailTokenFromUrl = () => {
11239
11239
  var _window$Pelcro$site$r5, _window$Pelcro$site$r6;
11240
11240
  const {
11241
11241
  whenSiteReady
11242
- } = usePelcro$1.getStore();
11242
+ } = usePelcro.getStore();
11243
11243
  const translations = i18next.t("verifyEmail:messages", {
11244
11244
  returnObjects: true
11245
11245
  });
@@ -11265,7 +11265,7 @@ const verifyLinkTokenFromUrl = () => {
11265
11265
  whenSiteReady,
11266
11266
  resetView,
11267
11267
  isAuthenticated
11268
- } = usePelcro$1.getStore();
11268
+ } = usePelcro.getStore();
11269
11269
  const translations = i18next.t("verifyLinkToken:messages", {
11270
11270
  returnObjects: true
11271
11271
  });
@@ -11300,12 +11300,12 @@ const showPasswordlessRequestFromUrl = () => {
11300
11300
  var _window$Pelcro$site$r8;
11301
11301
  const {
11302
11302
  isAuthenticated
11303
- } = usePelcro$1.getStore();
11303
+ } = usePelcro.getStore();
11304
11304
  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;
11305
11305
  if (!passwordlessEnabled || isAuthenticated()) return;
11306
11306
  const {
11307
11307
  switchView
11308
- } = usePelcro$1.getStore();
11308
+ } = usePelcro.getStore();
11309
11309
  return switchView("passwordless-request");
11310
11310
  };
11311
11311
  const showInvoiceDetailsFromUrl = () => {
@@ -11315,7 +11315,7 @@ const showInvoiceDetailsFromUrl = () => {
11315
11315
  whenUserReady,
11316
11316
  whenSiteReady,
11317
11317
  switchView
11318
- } = usePelcro$1.getStore();
11318
+ } = usePelcro.getStore();
11319
11319
  whenSiteReady(() => {
11320
11320
  if (!isAuthenticated()) {
11321
11321
  return switchView("login");
@@ -11331,7 +11331,7 @@ const showInvoiceDetailsFromUrl = () => {
11331
11331
  }
11332
11332
  const {
11333
11333
  invoice
11334
- } = usePelcro$1.getStore();
11334
+ } = usePelcro.getStore();
11335
11335
  if (invoice.total === 0) {
11336
11336
  const errorMessage = i18next.t("messages:zeroTotalInvoice", {
11337
11337
  returnObjects: true
@@ -11349,7 +11349,7 @@ const showSubscriptionManageMembersFromUrl = () => {
11349
11349
  whenUserReady,
11350
11350
  whenSiteReady,
11351
11351
  switchView
11352
- } = usePelcro$1.getStore();
11352
+ } = usePelcro.getStore();
11353
11353
  whenSiteReady(() => {
11354
11354
  if (!isAuthenticated()) {
11355
11355
  return switchView("login");
@@ -11387,7 +11387,7 @@ const PelcroModalController = _ref => {
11387
11387
  view,
11388
11388
  isAuthenticated,
11389
11389
  whenSiteReady
11390
- } = usePelcro$1();
11390
+ } = usePelcro();
11391
11391
  React__default['default'].useEffect(() => {
11392
11392
  init$1();
11393
11393
  renderShopView(React__default['default'].Children.map(children, child => child).find(_ref2 => {
@@ -13115,7 +13115,7 @@ function Modal(_ref) {
13115
13115
  children,
13116
13116
  ...props
13117
13117
  } = _ref;
13118
- const resetView = usePelcro$1(state => state.resetView);
13118
+ const resetView = usePelcro(state => state.resetView);
13119
13119
  React.useEffect(() => {
13120
13120
  onDisplay === null || onDisplay === void 0 ? void 0 : onDisplay();
13121
13121
  dispatchModalDisplayEvents(id);
@@ -13197,7 +13197,7 @@ function LoginModal(_ref) {
13197
13197
  order,
13198
13198
  switchToAddressView,
13199
13199
  switchToPaymentView
13200
- } = usePelcro$1();
13200
+ } = usePelcro();
13201
13201
  const onSuccess = res => {
13202
13202
  var _props$onSuccess;
13203
13203
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
@@ -13534,7 +13534,7 @@ function RegisterView(props) {
13534
13534
  } = useTranslation("register");
13535
13535
  const {
13536
13536
  product
13537
- } = usePelcro$1();
13537
+ } = usePelcro();
13538
13538
  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");
13539
13539
  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");
13540
13540
  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);
@@ -13760,7 +13760,7 @@ function RegisterModal(props) {
13760
13760
  order,
13761
13761
  giftCode,
13762
13762
  isGift
13763
- } = usePelcro$1();
13763
+ } = usePelcro();
13764
13764
  const onSuccess = res => {
13765
13765
  var _props$onSuccess;
13766
13766
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
@@ -13873,7 +13873,7 @@ function SelectModalWithHook(props) {
13873
13873
  resetView,
13874
13874
  view,
13875
13875
  set
13876
- } = usePelcro$1();
13876
+ } = usePelcro();
13877
13877
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
13878
13878
  const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
13879
13879
  return /*#__PURE__*/React__default['default'].createElement(SelectModalWithTrans, {
@@ -14114,7 +14114,7 @@ class SelectModal extends React.Component {
14114
14114
  const {
14115
14115
  switchToAddressView,
14116
14116
  switchToPaymentView
14117
- } = usePelcro$1.getStore();
14117
+ } = usePelcro.getStore();
14118
14118
  if (!isAuthenticated) {
14119
14119
  return setView("register");
14120
14120
  }
@@ -16215,16 +16215,16 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16215
16215
  const {
16216
16216
  t
16217
16217
  } = useTranslation("payment");
16218
- const pelcroStore = usePelcro$1();
16218
+ const pelcroStore = usePelcro();
16219
16219
  const {
16220
16220
  set,
16221
16221
  order,
16222
16222
  selectedPaymentMethodId,
16223
16223
  couponCode
16224
- } = usePelcro$1();
16224
+ } = usePelcro();
16225
16225
  const {
16226
16226
  whenUserReady
16227
- } = usePelcro$1.getStore();
16227
+ } = usePelcro.getStore();
16228
16228
  const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
16229
16229
  const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
16230
16230
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
@@ -17774,7 +17774,7 @@ const PaymentMethodContainer = props => {
17774
17774
  const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
17775
17775
  const {
17776
17776
  whenUserReady
17777
- } = usePelcro$1.getStore();
17777
+ } = usePelcro.getStore();
17778
17778
  React.useEffect(() => {
17779
17779
  whenUserReady(() => {
17780
17780
  if (!window.Stripe) {
@@ -17870,7 +17870,7 @@ const PelcroPaymentRequestButton = props => {
17870
17870
  const CheckoutForm = () => {
17871
17871
  const {
17872
17872
  selectedPaymentMethodId
17873
- } = usePelcro$1();
17873
+ } = usePelcro();
17874
17874
  const cardProcessor = getSiteCardProcessor();
17875
17875
  if (selectedPaymentMethodId) {
17876
17876
  return null;
@@ -17919,7 +17919,7 @@ const DiscountedPrice = props => {
17919
17919
  const {
17920
17920
  order,
17921
17921
  plan
17922
- } = usePelcro$1();
17922
+ } = usePelcro();
17923
17923
  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;
17924
17924
  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;
17925
17925
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
@@ -17952,7 +17952,7 @@ const SubmitPaymentMethod = _ref => {
17952
17952
  } = _ref;
17953
17953
  const {
17954
17954
  plan
17955
- } = usePelcro$1();
17955
+ } = usePelcro();
17956
17956
  const {
17957
17957
  t
17958
17958
  } = useTranslation("checkoutForm");
@@ -18344,7 +18344,7 @@ const PaypalSubscribeButton = props => {
18344
18344
  plan,
18345
18345
  invoice,
18346
18346
  selectedAddressId
18347
- } = usePelcro$1();
18347
+ } = usePelcro();
18348
18348
  React.useEffect(() => {
18349
18349
  var _ref, _ref2, _state$updatedPrice, _props$plan, _props$selectedAddres;
18350
18350
  // sometimes, price is updated. eg. Coupon codes.
@@ -18481,7 +18481,7 @@ const SelectedPaymentMethod = () => {
18481
18481
  const {
18482
18482
  switchView,
18483
18483
  selectedPaymentMethodId
18484
- } = usePelcro$1();
18484
+ } = usePelcro();
18485
18485
  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 => {
18486
18486
  return source.id == selectedPaymentMethodId;
18487
18487
  });
@@ -18521,7 +18521,7 @@ const TaxAmount = () => {
18521
18521
  } = React.useContext(store$k);
18522
18522
  const {
18523
18523
  plan
18524
- } = usePelcro$1();
18524
+ } = usePelcro();
18525
18525
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
18526
18526
  const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
18527
18527
  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;
@@ -18665,7 +18665,7 @@ const SubscriptionRenewView = _ref => {
18665
18665
  const {
18666
18666
  product,
18667
18667
  plan
18668
- } = usePelcro$1();
18668
+ } = usePelcro();
18669
18669
  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;
18670
18670
  const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
18671
18671
  const getPricingText = plan => {
@@ -18718,7 +18718,7 @@ function SubscriptionRenewModal(_ref) {
18718
18718
  } = _ref;
18719
18719
  const {
18720
18720
  switchView
18721
- } = usePelcro$1();
18721
+ } = usePelcro();
18722
18722
  const onSuccess = res => {
18723
18723
  var _otherProps$onSuccess, _ReactGA$event;
18724
18724
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
@@ -18914,7 +18914,7 @@ const SubscriptionCancelNowButton = _ref => {
18914
18914
  } = _ref;
18915
18915
  const {
18916
18916
  switchView
18917
- } = usePelcro$1();
18917
+ } = usePelcro();
18918
18918
  const {
18919
18919
  state: {
18920
18920
  cancelationReason
@@ -18984,7 +18984,7 @@ const SubscriptionCancelLaterButton = _ref => {
18984
18984
  } = _ref;
18985
18985
  const {
18986
18986
  switchView
18987
- } = usePelcro$1();
18987
+ } = usePelcro();
18988
18988
  const {
18989
18989
  state: {
18990
18990
  cancelationReason
@@ -19049,7 +19049,7 @@ const SubscriptionCancelLaterButton = _ref => {
19049
19049
  const SubscriptionCancelView = props => {
19050
19050
  const {
19051
19051
  subscriptionToCancel
19052
- } = usePelcro$1();
19052
+ } = usePelcro();
19053
19053
  const {
19054
19054
  t
19055
19055
  } = useTranslation("subscriptionCancel");
@@ -19224,7 +19224,7 @@ const SubscriptionSuspendButton = _ref => {
19224
19224
  } = _ref;
19225
19225
  const {
19226
19226
  switchView
19227
- } = usePelcro$1();
19227
+ } = usePelcro();
19228
19228
  const {
19229
19229
  state: {
19230
19230
  suspendDate,
@@ -19285,7 +19285,7 @@ const SubscriptionSuspendButton = _ref => {
19285
19285
  const SubscriptionSuspendView = props => {
19286
19286
  const {
19287
19287
  subscriptionToSuspend
19288
- } = usePelcro$1();
19288
+ } = usePelcro();
19289
19289
  const {
19290
19290
  t
19291
19291
  } = useTranslation("subscriptionSuspend");
@@ -19375,7 +19375,7 @@ const getCurrentFlow = () => {
19375
19375
  giftRecipient,
19376
19376
  giftCode,
19377
19377
  invoice
19378
- } = usePelcro$1.getStore();
19378
+ } = usePelcro.getStore();
19379
19379
  if (invoice) {
19380
19380
  return "invoicePayment";
19381
19381
  } else if (giftRecipient) {
@@ -19391,7 +19391,7 @@ const getSuccessContent = i18n => {
19391
19391
  const flow = getCurrentFlow();
19392
19392
  const {
19393
19393
  product
19394
- } = usePelcro$1.getStore();
19394
+ } = usePelcro.getStore();
19395
19395
  const wordingDictionary = {
19396
19396
  subscriptionSuccess: {
19397
19397
  successIcon: /*#__PURE__*/React__default['default'].createElement(SvgCheckSolid, {
@@ -19435,7 +19435,7 @@ function PaymentSuccessModal(_ref) {
19435
19435
  } = _ref;
19436
19436
  const {
19437
19437
  resetView
19438
- } = usePelcro$1();
19438
+ } = usePelcro();
19439
19439
  const onClose = () => {
19440
19440
  var _props$onClose;
19441
19441
  (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
@@ -19463,7 +19463,7 @@ function NewsletterWithHook(props) {
19463
19463
  switchView,
19464
19464
  resetView,
19465
19465
  product
19466
- } = usePelcro$1();
19466
+ } = usePelcro();
19467
19467
  return /*#__PURE__*/React__default['default'].createElement(NewsLetter, {
19468
19468
  onClose: () => {
19469
19469
  var _props$onClose;
@@ -19929,7 +19929,7 @@ const MeterView = () => {
19929
19929
  switchView,
19930
19930
  product,
19931
19931
  isAuthenticated
19932
- } = usePelcro$1();
19932
+ } = usePelcro();
19933
19933
  const paywallProduct = product !== null && product !== void 0 ? product : window.Pelcro.paywall.getProduct();
19934
19934
  const visitsLeft = window.Pelcro.paywall.freeVisitsLeft();
19935
19935
  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}`;
@@ -19951,7 +19951,7 @@ const MeterView = () => {
19951
19951
  const MeterModal = props => {
19952
19952
  const {
19953
19953
  resetView
19954
- } = usePelcro$1();
19954
+ } = usePelcro();
19955
19955
  React.useEffect(() => {
19956
19956
  var _props$onDisplay;
19957
19957
  (_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
@@ -19985,7 +19985,7 @@ const SubscriptionCreateView = _ref => {
19985
19985
  const {
19986
19986
  product,
19987
19987
  plan
19988
- } = usePelcro$1();
19988
+ } = usePelcro();
19989
19989
  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;
19990
19990
  const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
19991
19991
  const getPricingText = plan => {
@@ -20040,7 +20040,7 @@ function SubscriptionCreateModal(_ref) {
20040
20040
  useTranslation("common");
20041
20041
  const {
20042
20042
  switchView
20043
- } = usePelcro$1();
20043
+ } = usePelcro();
20044
20044
  const onSuccess = res => {
20045
20045
  var _otherProps$onSuccess;
20046
20046
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
@@ -20083,7 +20083,7 @@ const SubscriptionManageMembersContainer = _ref => {
20083
20083
  } = _ref;
20084
20084
  const {
20085
20085
  subscriptionToManageMembers
20086
- } = usePelcro$1();
20086
+ } = usePelcro();
20087
20087
  const subscription_id = subscriptionToManageMembers === null || subscriptionToManageMembers === void 0 ? void 0 : subscriptionToManageMembers.id;
20088
20088
  const handleListMembers = (_ref2, dispatch) => {
20089
20089
  var _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r;
@@ -21138,7 +21138,7 @@ function UserUpdateModal(_ref) {
21138
21138
  } = _ref;
21139
21139
  const {
21140
21140
  switchView
21141
- } = usePelcro$1();
21141
+ } = usePelcro();
21142
21142
  const onPictureClick = () => {
21143
21143
  switchView("profile-picture");
21144
21144
  };
@@ -21212,7 +21212,7 @@ const AddressCreateContainer = _ref => {
21212
21212
  order,
21213
21213
  set,
21214
21214
  selectedMembership
21215
- } = usePelcro$1();
21215
+ } = usePelcro();
21216
21216
  const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
21217
21217
  const subscriptionIdToRenew = (_ref2 = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref2 !== void 0 ? _ref2 : undefined;
21218
21218
  React.useEffect(() => {
@@ -21864,7 +21864,7 @@ const AddressCreateView = props => {
21864
21864
  } = useTranslation("address");
21865
21865
  const {
21866
21866
  giftRecipient
21867
- } = usePelcro$1();
21867
+ } = usePelcro();
21868
21868
  return /*#__PURE__*/React__default['default'].createElement("div", {
21869
21869
  id: "pelcro-address-create-view"
21870
21870
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -21936,7 +21936,7 @@ const AddressCreateModal = _ref => {
21936
21936
  switchView,
21937
21937
  switchToPaymentView,
21938
21938
  resetView
21939
- } = usePelcro$1();
21939
+ } = usePelcro();
21940
21940
  const onSuccess = newAddressId => {
21941
21941
  var _otherProps$onSuccess;
21942
21942
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, newAddressId);
@@ -22022,7 +22022,7 @@ const AddressUpdateContainer = _ref => {
22022
22022
  } = _ref;
22023
22023
  const {
22024
22024
  addressIdToEdit
22025
- } = usePelcro$1();
22025
+ } = usePelcro();
22026
22026
  const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
22027
22027
  const [t] = useTranslation("address");
22028
22028
  React.useEffect(() => {
@@ -23086,7 +23086,7 @@ const PasswordForgotModal = _ref => {
23086
23086
  } = useTranslation("passwordForgot");
23087
23087
  const {
23088
23088
  switchView
23089
- } = usePelcro$1();
23089
+ } = usePelcro();
23090
23090
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
23091
23091
  id: "pelcro-password-forgot-modal",
23092
23092
  onDisplay: onDisplay,
@@ -23674,7 +23674,7 @@ const CartContainer = _ref => {
23674
23674
  const {
23675
23675
  cartItems,
23676
23676
  set
23677
- } = usePelcro$1();
23677
+ } = usePelcro();
23678
23678
  const {
23679
23679
  t
23680
23680
  } = useTranslation("shop");
@@ -23776,7 +23776,7 @@ const CartRemoveItemButton = _ref => {
23776
23776
  } = _ref;
23777
23777
  const {
23778
23778
  removeFromCart
23779
- } = usePelcro$1();
23779
+ } = usePelcro();
23780
23780
  return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
23781
23781
  variant: "icon",
23782
23782
  "data-key": itemId,
@@ -23841,7 +23841,7 @@ const CartTotalPrice = () => {
23841
23841
  } = React.useContext(store$8);
23842
23842
  const {
23843
23843
  cartItems
23844
- } = usePelcro$1();
23844
+ } = usePelcro();
23845
23845
  const totalPriceCurrency = cartItems[0].currency;
23846
23846
  const {
23847
23847
  t
@@ -23859,7 +23859,7 @@ const CartTotalPrice = () => {
23859
23859
  const CartView = props => {
23860
23860
  const {
23861
23861
  cartItems
23862
- } = usePelcro$1();
23862
+ } = usePelcro();
23863
23863
  const {
23864
23864
  t
23865
23865
  } = useTranslation("cart");
@@ -23921,7 +23921,7 @@ const CartModal = _ref => {
23921
23921
  switchView,
23922
23922
  switchToAddressView,
23923
23923
  isAuthenticated
23924
- } = usePelcro$1();
23924
+ } = usePelcro();
23925
23925
  const onSuccess = items => {
23926
23926
  var _otherProps$onSuccess;
23927
23927
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, items);
@@ -23949,7 +23949,7 @@ const ShopSelectProductButton = _ref => {
23949
23949
  } = _ref;
23950
23950
  const {
23951
23951
  addToCart
23952
- } = usePelcro$1();
23952
+ } = usePelcro();
23953
23953
  const {
23954
23954
  t
23955
23955
  } = useTranslation("shop");
@@ -23980,7 +23980,7 @@ const ShopPurchaseButton = _ref => {
23980
23980
  } = _ref;
23981
23981
  const {
23982
23982
  purchaseItem
23983
- } = usePelcro$1();
23983
+ } = usePelcro();
23984
23984
  const {
23985
23985
  t
23986
23986
  } = useTranslation("shop");
@@ -24057,7 +24057,7 @@ const OrderCreateModal = _ref => {
24057
24057
  } = _ref;
24058
24058
  const {
24059
24059
  switchView
24060
- } = usePelcro$1();
24060
+ } = usePelcro();
24061
24061
  const onSuccess = () => {
24062
24062
  var _otherProps$onSuccess;
24063
24063
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps);
@@ -24083,7 +24083,7 @@ const OrderConfirmModal = props => {
24083
24083
  } = useTranslation("shop");
24084
24084
  const {
24085
24085
  resetView
24086
- } = usePelcro$1();
24086
+ } = usePelcro();
24087
24087
  const onClose = () => {
24088
24088
  var _props$onClose;
24089
24089
  props === null || props === void 0 ? void 0 : (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
@@ -24172,7 +24172,7 @@ const GiftCreateContainer = _ref => {
24172
24172
  } = useTranslation("register");
24173
24173
  const {
24174
24174
  set
24175
- } = usePelcro$1();
24175
+ } = usePelcro();
24176
24176
  const handleSubmit = (state, dispatch) => {
24177
24177
  const giftRecipient = {
24178
24178
  email: state.email,
@@ -24452,7 +24452,7 @@ const GiftCreateModal = _ref => {
24452
24452
  switchToAddressView,
24453
24453
  switchToPaymentView,
24454
24454
  product
24455
- } = usePelcro$1();
24455
+ } = usePelcro();
24456
24456
  const onSuccess = giftRecipient => {
24457
24457
  var _otherProps$onSuccess;
24458
24458
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, giftRecipient);
@@ -24504,13 +24504,13 @@ const GiftRedeemContainer = _ref => {
24504
24504
  } = useTranslation("register");
24505
24505
  const {
24506
24506
  set
24507
- } = usePelcro$1();
24507
+ } = usePelcro();
24508
24508
  const {
24509
24509
  switchView,
24510
24510
  switchToAddressView,
24511
24511
  isAuthenticated,
24512
24512
  subscriptionIdToRenew: subscriptionIdToRenewFromStore
24513
- } = usePelcro$1();
24513
+ } = usePelcro();
24514
24514
  const subscriptionIdToRenew = (_ref2 = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref2 !== void 0 ? _ref2 : undefined;
24515
24515
  React.useEffect(() => {
24516
24516
  onDisplay();
@@ -24718,7 +24718,7 @@ const GiftRedeemModal = _ref => {
24718
24718
  switchView,
24719
24719
  switchToAddressView,
24720
24720
  isAuthenticated
24721
- } = usePelcro$1();
24721
+ } = usePelcro();
24722
24722
  const onSuccess = giftCode => {
24723
24723
  var _otherProps$onSuccess;
24724
24724
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, giftCode);
@@ -24779,7 +24779,7 @@ const AddressSelectContainer = _ref => {
24779
24779
  subscriptionIdToRenew: subscriptionIdToRenewFromStore,
24780
24780
  set,
24781
24781
  selectedMembership
24782
- } = usePelcro$1();
24782
+ } = usePelcro();
24783
24783
  const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
24784
24784
  const subscriptionIdToRenew = (_ref2 = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref2 !== void 0 ? _ref2 : undefined;
24785
24785
  const submitAddress = (_ref3, dispatch) => {
@@ -25012,7 +25012,7 @@ const AddressSelectModal = _ref => {
25012
25012
  switchView,
25013
25013
  switchToPaymentView,
25014
25014
  resetView
25015
- } = usePelcro$1();
25015
+ } = usePelcro();
25016
25016
  const onSuccess = selectedAddressId => {
25017
25017
  var _otherProps$onSuccess;
25018
25018
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, selectedAddressId);
@@ -25079,7 +25079,7 @@ const PaymentMethodSelectContainer = _ref => {
25079
25079
  const {
25080
25080
  set,
25081
25081
  selectedPaymentMethodId: selectedPaymentMethodIdFromStore
25082
- } = usePelcro$1();
25082
+ } = usePelcro();
25083
25083
  const submitPaymentMethod = _ref2 => {
25084
25084
  let {
25085
25085
  selectedPaymentMethodId
@@ -25254,7 +25254,7 @@ const PaymentMethodSelectModal = _ref => {
25254
25254
  switchToCheckoutForm,
25255
25255
  set,
25256
25256
  plan
25257
- } = usePelcro$1();
25257
+ } = usePelcro();
25258
25258
  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;
25259
25259
  React.useEffect(() => {
25260
25260
  if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
@@ -26565,7 +26565,7 @@ const SavedItems = _ref3 => {
26565
26565
  const [isLoading, setLoading] = React.useState(false);
26566
26566
  const {
26567
26567
  isAuthenticated
26568
- } = usePelcro$1();
26568
+ } = usePelcro();
26569
26569
  const removeItemFromMetadata = (category, title) => {
26570
26570
  const user = window.Pelcro.user.read();
26571
26571
  const oldValue = user.metadata[`metadata_saved_${category}`];
@@ -26754,7 +26754,7 @@ const SubscriptionsItems = _ref => {
26754
26754
  setSubscriptionToCancel,
26755
26755
  setSubscriptionToSuspend,
26756
26756
  set
26757
- } = usePelcro$1();
26757
+ } = usePelcro();
26758
26758
  const subs = getNonDonationSubs();
26759
26759
  if (subs.length === 0) return null;
26760
26760
  return subs.sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
@@ -27253,7 +27253,7 @@ const DonationsMenu = _ref => {
27253
27253
  const {
27254
27254
  switchView,
27255
27255
  setSubscriptionToCancel
27256
- } = usePelcro$1();
27256
+ } = usePelcro();
27257
27257
  const subscriptions = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
27258
27258
  // Cancel button click handlers
27259
27259
  const onCancelClick = () => {
@@ -27364,7 +27364,7 @@ const InvoicesItems = () => {
27364
27364
  const {
27365
27365
  setInvoice,
27366
27366
  switchView
27367
- } = usePelcro$1();
27367
+ } = usePelcro();
27368
27368
  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 : [];
27369
27369
  const showInvoiceDetails = event => {
27370
27370
  if (setInvoice(event.target.dataset.id)) {
@@ -27484,7 +27484,7 @@ const MembershipsItems = () => {
27484
27484
  switchView,
27485
27485
  setSelectedMembership,
27486
27486
  switchToAddressView
27487
- } = usePelcro$1();
27487
+ } = usePelcro();
27488
27488
  const memberships = getActiveMemberships();
27489
27489
  const onChangeAddressClick = membershipId => {
27490
27490
  if (userMustVerifyEmail()) {
@@ -27556,7 +27556,7 @@ function DashboardWithHook(props) {
27556
27556
  resetView,
27557
27557
  logout,
27558
27558
  set
27559
- } = usePelcro$1();
27559
+ } = usePelcro();
27560
27560
  return /*#__PURE__*/React__default['default'].createElement(DashboardWithTrans, {
27561
27561
  setAddress: addressIdToEdit => set({
27562
27562
  addressIdToEdit
@@ -28142,7 +28142,7 @@ const DashboardWithTrans = withTranslation("dashboard")(Dashboard);
28142
28142
  const DashboardOpenButton = () => {
28143
28143
  const {
28144
28144
  switchView
28145
- } = usePelcro$1();
28145
+ } = usePelcro();
28146
28146
  return /*#__PURE__*/React__default['default'].createElement("div", {
28147
28147
  className: "plc-fixed plc-right-4 plc-bottom-4 pelcro-open-dashboard-btn"
28148
28148
  }, /*#__PURE__*/React__default['default'].createElement("button", {
@@ -30121,13 +30121,12 @@ const EmailVerifyModal = _ref => {
30121
30121
  } = _ref;
30122
30122
  const {
30123
30123
  product,
30124
- plan,
30125
30124
  switchToAddressView,
30126
30125
  switchToPaymentView
30127
30126
  } = usePelcro();
30128
30127
  const onSuccess = res => {
30129
- var _props$onSuccess, _props;
30130
- (_props$onSuccess = (_props = props).onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(_props, res);
30128
+ var _otherProps$onSuccess;
30129
+ (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
30131
30130
  if (product) {
30132
30131
  if (product.address_required) {
30133
30132
  return switchToAddressView();
@@ -30286,7 +30285,7 @@ function VerifyLinkTokenModal(_ref) {
30286
30285
  } = useTranslation("verifyLinkToken");
30287
30286
  const {
30288
30287
  resetView
30289
- } = usePelcro$1();
30288
+ } = usePelcro();
30290
30289
  const onSuccess = res => {
30291
30290
  var _props$onSuccess;
30292
30291
  (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
@@ -30334,7 +30333,7 @@ const InvoicePaymentModal = _ref => {
30334
30333
  } = _ref;
30335
30334
  const {
30336
30335
  switchView
30337
- } = usePelcro$1();
30336
+ } = usePelcro();
30338
30337
  const onSuccess = () => {
30339
30338
  var _otherProps$onSuccess;
30340
30339
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps);
@@ -30408,7 +30407,7 @@ const InvoiceDetailsDownloadButton = _ref => {
30408
30407
  } = useTranslation("invoiceDetails");
30409
30408
  const {
30410
30409
  invoice
30411
- } = usePelcro$1();
30410
+ } = usePelcro();
30412
30411
  return /*#__PURE__*/React__default['default'].createElement(Link, Object.assign({
30413
30412
  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}`,
30414
30413
  id: "pelcro-download-invoice-link",
@@ -30446,7 +30445,7 @@ const InvoiceDetailsView = props => {
30446
30445
  } = useTranslation("invoiceDetails");
30447
30446
  const {
30448
30447
  invoice
30449
- } = usePelcro$1();
30448
+ } = usePelcro();
30450
30449
  const showPayButton = canPayInvoice(invoice);
30451
30450
  const showDownloadButton = Boolean(invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf);
30452
30451
  const hasPlanDetails = Boolean(invoice.plan);
@@ -30514,7 +30513,7 @@ const InvoiceDetailsModal = _ref => {
30514
30513
  } = _ref;
30515
30514
  const {
30516
30515
  switchToPaymentView
30517
- } = usePelcro$1();
30516
+ } = usePelcro();
30518
30517
  const onSuccess = () => {
30519
30518
  var _otherProps$onSuccess;
30520
30519
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps);
@@ -32183,4 +32182,4 @@ exports.initContentEntitlement = init;
32183
32182
  exports.invoicePaymentSubmitButton = invoicePaymentSubmitButton;
32184
32183
  exports.notify = notify$1;
32185
32184
  exports.unauthenticatedButtons = unauthenticatedButtons;
32186
- exports.usePelcro = usePelcro$1;
32185
+ exports.usePelcro = usePelcro;