@pelcro/react-pelcro-js 3.21.1 → 3.22.0-beta.2

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
@@ -11141,6 +11141,9 @@ const initViewFromURL = () => {
11141
11141
  if (view === "manage-members") {
11142
11142
  return showSubscriptionManageMembersFromUrl();
11143
11143
  }
11144
+ if (view === "payment-method-update") {
11145
+ return showPaymentMethodUpdateFromUrl();
11146
+ }
11144
11147
  switchView(view);
11145
11148
  });
11146
11149
  }
@@ -11349,6 +11352,43 @@ const showPasswordlessRequestFromUrl = () => {
11349
11352
  } = usePelcro.getStore();
11350
11353
  return switchView("passwordless-request");
11351
11354
  };
11355
+ const showPaymentMethodUpdateFromUrl = () => {
11356
+ const {
11357
+ isAuthenticated,
11358
+ whenSiteReady,
11359
+ whenUserReady,
11360
+ switchView
11361
+ } = usePelcro.getStore();
11362
+ whenSiteReady(() => {
11363
+ if (!isAuthenticated()) {
11364
+ return switchView("login");
11365
+ }
11366
+ whenUserReady(() => {
11367
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
11368
+ const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
11369
+ if (!window.Stripe && !supportsVantiv && !supportsTap) {
11370
+ document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
11371
+ return switchView("payment-method-update");
11372
+ });
11373
+ return;
11374
+ }
11375
+
11376
+ //vantiv
11377
+ if (supportsVantiv) {
11378
+ document.querySelector("#vantiv-eprotect-sdk").addEventListener("load", () => {
11379
+ return switchView("payment-method-update");
11380
+ });
11381
+ return;
11382
+ }
11383
+
11384
+ //Tap
11385
+ if (supportsTap && document.querySelector("#tap-sdk")) {
11386
+ return switchView("payment-method-update");
11387
+ }
11388
+ return switchView("payment-method-update");
11389
+ });
11390
+ });
11391
+ };
11352
11392
  const showInvoiceDetailsFromUrl = () => {
11353
11393
  const {
11354
11394
  isAuthenticated,
@@ -13261,7 +13301,7 @@ function LoginModal(_ref) {
13261
13301
  }
13262
13302
  resetView();
13263
13303
  const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
13264
- const viewsURLs = ["invoice-details", "gift-redeem", "plan-select"];
13304
+ const viewsURLs = ["invoice-details", "gift-redeem", "plan-select", "payment-method-update"];
13265
13305
  if (viewsURLs.includes(viewFromURL)) {
13266
13306
  initViewFromURL();
13267
13307
  }
@@ -14002,12 +14042,9 @@ class SelectModal extends React.Component {
14002
14042
  const userCurrency = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : _window$Pelcro$user.read().currency;
14003
14043
  const userCountry = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : _window$Pelcro2$user.location.countryCode;
14004
14044
  const userLanguage = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.read().language;
14005
- const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.map(product => {
14045
+ const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.filter(product => {
14006
14046
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
14007
- return {
14008
- ...product,
14009
- plans: filteredPlans
14010
- };
14047
+ if (filteredPlans.length) return filteredPlans;
14011
14048
  });
14012
14049
  const productsMatchingUserCountry = productsMatchingUserCurrency.filter(product => {
14013
14050
  const filteredPlans = product.plans.filter(plan => {
@@ -14018,7 +14055,7 @@ class SelectModal extends React.Component {
14018
14055
  });
14019
14056
  notifyBugsnag(() => {
14020
14057
  Bugsnag.notify("SelectModal - No data viewed", event => {
14021
- var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe;
14058
+ var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe, _window$Pelcro10, _window$Pelcro10$site;
14022
14059
  event.addMetadata("MetaData", {
14023
14060
  site: (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read(),
14024
14061
  user: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$user = _window$Pelcro6.user) === null || _window$Pelcro6$user === void 0 ? void 0 : _window$Pelcro6$user.read(),
@@ -14035,9 +14072,10 @@ class SelectModal extends React.Component {
14035
14072
  userCountry: userCountry,
14036
14073
  userLanguage: userLanguage,
14037
14074
  siteLanguage: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : (_window$Pelcro9$helpe = _window$Pelcro9.helpers) === null || _window$Pelcro9$helpe === void 0 ? void 0 : _window$Pelcro9$helpe.getHtmlLanguageAttribute(),
14038
- currency_mismatch: productsMatchingUserCurrency.length === 0,
14039
- country_restrictions: productsMatchingUserCountry.length === 0,
14040
- language_mismatch: productsMatchingUserCountry.filter(product => product.plans.length).filter(productMatchPageLanguage).length === 0
14075
+ products: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$site = _window$Pelcro10.site) === null || _window$Pelcro10$site === void 0 ? void 0 : _window$Pelcro10$site.read().products.length,
14076
+ currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
14077
+ country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
14078
+ language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
14041
14079
  });
14042
14080
  });
14043
14081
  });
@@ -16803,7 +16841,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16803
16841
  const tapInstanceRef = React__default['default'].useRef(null);
16804
16842
  const tapInstanceCard = React__default['default'].useRef(null);
16805
16843
  React.useEffect(() => {
16806
- if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16844
+ if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) return;
16807
16845
  if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
16808
16846
  var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
16809
16847
  const payPageId = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.pay_page_id;
@@ -16832,7 +16870,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16832
16870
  }, [selectedPaymentMethodId]);
16833
16871
  React.useEffect(() => {
16834
16872
  whenUserReady(() => {
16835
- if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16873
+ if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) return;
16836
16874
  if (cardProcessor === "tap" && !window.Tapjsli) {
16837
16875
  window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
16838
16876
  window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
@@ -16846,7 +16884,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16846
16884
  });
16847
16885
  }, [selectedPaymentMethodId]);
16848
16886
  const initPaymentRequest = (state, dispatch) => {
16849
- if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16887
+ if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) return;
16850
16888
  try {
16851
16889
  const paymentRequest = stripe.paymentRequest({
16852
16890
  country: window.Pelcro.user.location.countryCode || "US",
@@ -16915,7 +16953,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16915
16953
  */
16916
16954
  const updateTotalAmountWithTax = () => {
16917
16955
  var _window$Pelcro$site$r4;
16918
- if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16956
+ if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) return;
16919
16957
  const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
16920
16958
  if (taxesEnabled && type === "createPayment") {
16921
16959
  dispatch({
@@ -17510,6 +17548,29 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17510
17548
  });
17511
17549
  };
17512
17550
  const submitPayment = (state, dispatch) => {
17551
+ if (skipPayment && (order === null || order === void 0 ? void 0 : order.price) === 0) {
17552
+ const isQuickPurchase = !Array.isArray(order);
17553
+ const mappedOrderItems = isQuickPurchase ? [{
17554
+ sku_id: order.id,
17555
+ quantity: order.quantity
17556
+ }] : order.map(item => ({
17557
+ sku_id: item.id,
17558
+ quantity: item.quantity
17559
+ }));
17560
+ window.Pelcro.ecommerce.order.create({
17561
+ items: mappedOrderItems,
17562
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
17563
+ ...(selectedAddressId && {
17564
+ address_id: selectedAddressId
17565
+ })
17566
+ }, (err, res) => {
17567
+ if (err) {
17568
+ return handlePaymentError(err);
17569
+ }
17570
+ return onSuccess(res);
17571
+ });
17572
+ return;
17573
+ }
17513
17574
  stripe.createSource({
17514
17575
  type: "card"
17515
17576
  }).then(_ref8 => {
@@ -17871,10 +17932,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17871
17932
  state,
17872
17933
  dispatch
17873
17934
  }
17874
- }, children.length ? children.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
17875
- store: store$k,
17876
- key: i
17877
- })) : /*#__PURE__*/React__default['default'].cloneElement(children, {
17935
+ }, children.length ? children.map((child, i) => {
17936
+ if (child) {
17937
+ return /*#__PURE__*/React__default['default'].cloneElement(child, {
17938
+ store: store$k,
17939
+ key: i
17940
+ });
17941
+ }
17942
+ }) : /*#__PURE__*/React__default['default'].cloneElement(children, {
17878
17943
  store: store$k
17879
17944
  })));
17880
17945
  };
@@ -18696,6 +18761,42 @@ const SubscriptionCreateFreePlanButton = _ref => {
18696
18761
  }, otherProps), t("buttons.subscribe"));
18697
18762
  };
18698
18763
 
18764
+ const OrderCreateFreeButton = _ref => {
18765
+ let {
18766
+ name,
18767
+ onClick,
18768
+ ...otherProps
18769
+ } = _ref;
18770
+ const {
18771
+ state: {
18772
+ disableSubmit
18773
+ },
18774
+ dispatch
18775
+ } = React.useContext(store$k);
18776
+ const {
18777
+ t
18778
+ } = useTranslation("checkoutForm");
18779
+ const [isDisabled, setDisabled] = React.useState(true);
18780
+ React.useEffect(() => {
18781
+ setDisabled(disableSubmit);
18782
+ }, [disableSubmit]);
18783
+ return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
18784
+ className: "plc-w-full",
18785
+ onClick: () => {
18786
+ dispatch({
18787
+ type: DISABLE_SUBMIT,
18788
+ payload: true
18789
+ });
18790
+ dispatch({
18791
+ type: SUBMIT_PAYMENT
18792
+ });
18793
+ onClick === null || onClick === void 0 ? void 0 : onClick();
18794
+ },
18795
+ disabled: isDisabled,
18796
+ isLoading: disableSubmit
18797
+ }, otherProps), t("labels.submit"));
18798
+ };
18799
+
18699
18800
  /**
18700
18801
  *
18701
18802
  */
@@ -18708,7 +18809,8 @@ function PaymentMethodView(_ref) {
18708
18809
  type,
18709
18810
  showCoupon,
18710
18811
  showExternalPaymentMethods,
18711
- showSubscriptionButton
18812
+ showSubscriptionButton,
18813
+ showOrderButton
18712
18814
  } = _ref;
18713
18815
  const {
18714
18816
  t
@@ -18721,7 +18823,7 @@ function PaymentMethodView(_ref) {
18721
18823
  const isUserPhone = Boolean(window.Pelcro.user.read().phone);
18722
18824
  return /*#__PURE__*/React__default['default'].createElement("div", {
18723
18825
  className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
18724
- }, cardProcessor === "stripe" && !showSubscriptionButton && /*#__PURE__*/React__default['default'].createElement("div", {
18826
+ }, cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", {
18725
18827
  className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50"
18726
18828
  }, /*#__PURE__*/React__default['default'].createElement(SvgLock, {
18727
18829
  className: "plc-w-5 plc-h-5 plc-mr-1"
@@ -18740,7 +18842,7 @@ function PaymentMethodView(_ref) {
18740
18842
  onFailure: onFailure
18741
18843
  }, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
18742
18844
  className: "plc-mb-2"
18743
- }), showSubscriptionButton ? /*#__PURE__*/React__default['default'].createElement(SubscriptionCreateFreePlanButton, null) : /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
18845
+ }), showSubscriptionButton && /*#__PURE__*/React__default['default'].createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default['default'].createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
18744
18846
  className: "plc-flex plc-items-start"
18745
18847
  }, /*#__PURE__*/React__default['default'].createElement(IncludeFirstName, {
18746
18848
  id: "pelcro-input-first-name",
@@ -20531,27 +20633,32 @@ function SubscriptionManageMembersList(props) {
20531
20633
  type: HANDLE_REMOVE_MEMBER
20532
20634
  });
20533
20635
  };
20534
- return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, members === null || members === void 0 ? void 0 : members.map(member => /*#__PURE__*/React__default['default'].createElement("tr", {
20535
- key: member.id,
20536
- className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
20537
- }, /*#__PURE__*/React__default['default'].createElement("td", {
20538
- className: "plc-truncate plc-text-left",
20539
- title: member === null || member === void 0 ? void 0 : member.invitation_email
20540
- }, /*#__PURE__*/React__default['default'].createElement("span", {
20541
- className: "plc-font-semibold plc-text-gray-500"
20542
- }, member === null || member === void 0 ? void 0 : member.invitation_email)), /*#__PURE__*/React__default['default'].createElement("td", {
20543
- className: "plc-py-2"
20544
- }, /*#__PURE__*/React__default['default'].createElement("span", {
20545
- className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getMemberStatus(member).bgColor} plc-uppercase ${getMemberStatus(member).textColor} plc-rounded-lg`
20546
- }, getMemberStatus(member).icon, getMemberStatus(member).title)), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement(Button, {
20547
- variant: "ghost",
20548
- className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
20549
- icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
20550
- onClick: () => onRemoveClick(member.id),
20551
- disabled: member.id === removeMemberId,
20552
- isLoading: member.id === removeMemberId,
20553
- "data-key": member.id
20554
- }, t("labels.remove"))))));
20636
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, members === null || members === void 0 ? void 0 : members.map(member => {
20637
+ var _member$customer;
20638
+ return /*#__PURE__*/React__default['default'].createElement("tr", {
20639
+ key: member.id,
20640
+ className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
20641
+ }, /*#__PURE__*/React__default['default'].createElement("td", {
20642
+ className: "plc-truncate plc-text-left",
20643
+ title: member === null || member === void 0 ? void 0 : member.invitation_email
20644
+ }, member.status === "active" ? /*#__PURE__*/React__default['default'].createElement("span", {
20645
+ className: "plc-font-semibold plc-text-gray-500"
20646
+ }, member === null || member === void 0 ? void 0 : (_member$customer = member.customer) === null || _member$customer === void 0 ? void 0 : _member$customer.email) : /*#__PURE__*/React__default['default'].createElement("span", {
20647
+ className: "plc-font-semibold plc-text-gray-500"
20648
+ }, member === null || member === void 0 ? void 0 : member.invitation_email)), /*#__PURE__*/React__default['default'].createElement("td", {
20649
+ className: "plc-py-2"
20650
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
20651
+ className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getMemberStatus(member).bgColor} plc-uppercase ${getMemberStatus(member).textColor} plc-rounded-lg`
20652
+ }, getMemberStatus(member).icon, getMemberStatus(member).title)), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement(Button, {
20653
+ variant: "ghost",
20654
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
20655
+ icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
20656
+ onClick: () => onRemoveClick(member.id),
20657
+ disabled: member.id === removeMemberId,
20658
+ isLoading: member.id === removeMemberId,
20659
+ "data-key": member.id
20660
+ }, t("labels.remove"))));
20661
+ }));
20555
20662
  }
20556
20663
 
20557
20664
  /**
@@ -24145,9 +24252,15 @@ const OrderCreateContainer = props => /*#__PURE__*/React__default['default'].cre
24145
24252
  }, props));
24146
24253
 
24147
24254
  const OrderCreateView = props => {
24255
+ var _window$Pelcro, _window$Pelcro$uiSett;
24148
24256
  const {
24149
24257
  t
24150
24258
  } = useTranslation("payment");
24259
+ const {
24260
+ order
24261
+ } = usePelcro();
24262
+ 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;
24263
+ const showOrderButton = skipPayment && (order === null || order === void 0 ? void 0 : order.price) === 0;
24151
24264
  return /*#__PURE__*/React__default['default'].createElement("div", {
24152
24265
  id: "pelcro-order-create-view"
24153
24266
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -24158,7 +24271,8 @@ const OrderCreateView = props => {
24158
24271
  }, /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
24159
24272
  type: "orderCreate",
24160
24273
  showCoupon: true,
24161
- showExternalPaymentMethods: false
24274
+ showExternalPaymentMethods: false,
24275
+ showOrderButton: showOrderButton
24162
24276
  }, props))));
24163
24277
  };
24164
24278
 
@@ -25366,11 +25480,12 @@ const PaymentMethodSelectModal = _ref => {
25366
25480
  const {
25367
25481
  switchToCheckoutForm,
25368
25482
  set,
25369
- plan
25483
+ plan,
25484
+ order
25370
25485
  } = usePelcro();
25371
25486
  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;
25372
25487
  React.useEffect(() => {
25373
- if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
25488
+ if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) {
25374
25489
  switchToCheckoutForm();
25375
25490
  }
25376
25491
  }, []);
@@ -32188,6 +32303,7 @@ exports.NewsletterUpdateView = NewsletterUpdateView;
32188
32303
  exports.Notification = Notification;
32189
32304
  exports.OrderConfirmModal = OrderConfirmModal;
32190
32305
  exports.OrderCreateContainer = OrderCreateContainer;
32306
+ exports.OrderCreateFreeButton = OrderCreateFreeButton;
32191
32307
  exports.OrderCreateModal = OrderCreateModal;
32192
32308
  exports.OrderCreateSubmitButton = OrderCreateSubmitButton;
32193
32309
  exports.OrderCreateView = OrderCreateView;
package/dist/index.esm.js CHANGED
@@ -11111,6 +11111,9 @@ const initViewFromURL = () => {
11111
11111
  if (view === "manage-members") {
11112
11112
  return showSubscriptionManageMembersFromUrl();
11113
11113
  }
11114
+ if (view === "payment-method-update") {
11115
+ return showPaymentMethodUpdateFromUrl();
11116
+ }
11114
11117
  switchView(view);
11115
11118
  });
11116
11119
  }
@@ -11319,6 +11322,43 @@ const showPasswordlessRequestFromUrl = () => {
11319
11322
  } = usePelcro.getStore();
11320
11323
  return switchView("passwordless-request");
11321
11324
  };
11325
+ const showPaymentMethodUpdateFromUrl = () => {
11326
+ const {
11327
+ isAuthenticated,
11328
+ whenSiteReady,
11329
+ whenUserReady,
11330
+ switchView
11331
+ } = usePelcro.getStore();
11332
+ whenSiteReady(() => {
11333
+ if (!isAuthenticated()) {
11334
+ return switchView("login");
11335
+ }
11336
+ whenUserReady(() => {
11337
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
11338
+ const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
11339
+ if (!window.Stripe && !supportsVantiv && !supportsTap) {
11340
+ document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
11341
+ return switchView("payment-method-update");
11342
+ });
11343
+ return;
11344
+ }
11345
+
11346
+ //vantiv
11347
+ if (supportsVantiv) {
11348
+ document.querySelector("#vantiv-eprotect-sdk").addEventListener("load", () => {
11349
+ return switchView("payment-method-update");
11350
+ });
11351
+ return;
11352
+ }
11353
+
11354
+ //Tap
11355
+ if (supportsTap && document.querySelector("#tap-sdk")) {
11356
+ return switchView("payment-method-update");
11357
+ }
11358
+ return switchView("payment-method-update");
11359
+ });
11360
+ });
11361
+ };
11322
11362
  const showInvoiceDetailsFromUrl = () => {
11323
11363
  const {
11324
11364
  isAuthenticated,
@@ -13231,7 +13271,7 @@ function LoginModal(_ref) {
13231
13271
  }
13232
13272
  resetView();
13233
13273
  const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
13234
- const viewsURLs = ["invoice-details", "gift-redeem", "plan-select"];
13274
+ const viewsURLs = ["invoice-details", "gift-redeem", "plan-select", "payment-method-update"];
13235
13275
  if (viewsURLs.includes(viewFromURL)) {
13236
13276
  initViewFromURL();
13237
13277
  }
@@ -13972,12 +14012,9 @@ class SelectModal extends Component {
13972
14012
  const userCurrency = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : _window$Pelcro$user.read().currency;
13973
14013
  const userCountry = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : _window$Pelcro2$user.location.countryCode;
13974
14014
  const userLanguage = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.read().language;
13975
- const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.map(product => {
14015
+ const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.filter(product => {
13976
14016
  const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
13977
- return {
13978
- ...product,
13979
- plans: filteredPlans
13980
- };
14017
+ if (filteredPlans.length) return filteredPlans;
13981
14018
  });
13982
14019
  const productsMatchingUserCountry = productsMatchingUserCurrency.filter(product => {
13983
14020
  const filteredPlans = product.plans.filter(plan => {
@@ -13988,7 +14025,7 @@ class SelectModal extends Component {
13988
14025
  });
13989
14026
  notifyBugsnag(() => {
13990
14027
  Bugsnag.notify("SelectModal - No data viewed", event => {
13991
- var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe;
14028
+ var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe, _window$Pelcro10, _window$Pelcro10$site;
13992
14029
  event.addMetadata("MetaData", {
13993
14030
  site: (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read(),
13994
14031
  user: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$user = _window$Pelcro6.user) === null || _window$Pelcro6$user === void 0 ? void 0 : _window$Pelcro6$user.read(),
@@ -14005,9 +14042,10 @@ class SelectModal extends Component {
14005
14042
  userCountry: userCountry,
14006
14043
  userLanguage: userLanguage,
14007
14044
  siteLanguage: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : (_window$Pelcro9$helpe = _window$Pelcro9.helpers) === null || _window$Pelcro9$helpe === void 0 ? void 0 : _window$Pelcro9$helpe.getHtmlLanguageAttribute(),
14008
- currency_mismatch: productsMatchingUserCurrency.length === 0,
14009
- country_restrictions: productsMatchingUserCountry.length === 0,
14010
- language_mismatch: productsMatchingUserCountry.filter(product => product.plans.length).filter(productMatchPageLanguage).length === 0
14045
+ products: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$site = _window$Pelcro10.site) === null || _window$Pelcro10$site === void 0 ? void 0 : _window$Pelcro10$site.read().products.length,
14046
+ currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
14047
+ country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
14048
+ language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
14011
14049
  });
14012
14050
  });
14013
14051
  });
@@ -16773,7 +16811,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16773
16811
  const tapInstanceRef = React__default.useRef(null);
16774
16812
  const tapInstanceCard = React__default.useRef(null);
16775
16813
  useEffect(() => {
16776
- if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16814
+ if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) return;
16777
16815
  if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
16778
16816
  var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
16779
16817
  const payPageId = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.pay_page_id;
@@ -16802,7 +16840,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16802
16840
  }, [selectedPaymentMethodId]);
16803
16841
  useEffect(() => {
16804
16842
  whenUserReady(() => {
16805
- if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16843
+ if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) return;
16806
16844
  if (cardProcessor === "tap" && !window.Tapjsli) {
16807
16845
  window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
16808
16846
  window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
@@ -16816,7 +16854,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16816
16854
  });
16817
16855
  }, [selectedPaymentMethodId]);
16818
16856
  const initPaymentRequest = (state, dispatch) => {
16819
- if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16857
+ if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) return;
16820
16858
  try {
16821
16859
  const paymentRequest = stripe.paymentRequest({
16822
16860
  country: window.Pelcro.user.location.countryCode || "US",
@@ -16885,7 +16923,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16885
16923
  */
16886
16924
  const updateTotalAmountWithTax = () => {
16887
16925
  var _window$Pelcro$site$r4;
16888
- if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16926
+ if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) return;
16889
16927
  const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
16890
16928
  if (taxesEnabled && type === "createPayment") {
16891
16929
  dispatch({
@@ -17480,6 +17518,29 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17480
17518
  });
17481
17519
  };
17482
17520
  const submitPayment = (state, dispatch) => {
17521
+ if (skipPayment && (order === null || order === void 0 ? void 0 : order.price) === 0) {
17522
+ const isQuickPurchase = !Array.isArray(order);
17523
+ const mappedOrderItems = isQuickPurchase ? [{
17524
+ sku_id: order.id,
17525
+ quantity: order.quantity
17526
+ }] : order.map(item => ({
17527
+ sku_id: item.id,
17528
+ quantity: item.quantity
17529
+ }));
17530
+ window.Pelcro.ecommerce.order.create({
17531
+ items: mappedOrderItems,
17532
+ campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
17533
+ ...(selectedAddressId && {
17534
+ address_id: selectedAddressId
17535
+ })
17536
+ }, (err, res) => {
17537
+ if (err) {
17538
+ return handlePaymentError(err);
17539
+ }
17540
+ return onSuccess(res);
17541
+ });
17542
+ return;
17543
+ }
17483
17544
  stripe.createSource({
17484
17545
  type: "card"
17485
17546
  }).then(_ref8 => {
@@ -17841,10 +17902,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17841
17902
  state,
17842
17903
  dispatch
17843
17904
  }
17844
- }, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
17845
- store: store$k,
17846
- key: i
17847
- })) : /*#__PURE__*/React__default.cloneElement(children, {
17905
+ }, children.length ? children.map((child, i) => {
17906
+ if (child) {
17907
+ return /*#__PURE__*/React__default.cloneElement(child, {
17908
+ store: store$k,
17909
+ key: i
17910
+ });
17911
+ }
17912
+ }) : /*#__PURE__*/React__default.cloneElement(children, {
17848
17913
  store: store$k
17849
17914
  })));
17850
17915
  };
@@ -18666,6 +18731,42 @@ const SubscriptionCreateFreePlanButton = _ref => {
18666
18731
  }, otherProps), t("buttons.subscribe"));
18667
18732
  };
18668
18733
 
18734
+ const OrderCreateFreeButton = _ref => {
18735
+ let {
18736
+ name,
18737
+ onClick,
18738
+ ...otherProps
18739
+ } = _ref;
18740
+ const {
18741
+ state: {
18742
+ disableSubmit
18743
+ },
18744
+ dispatch
18745
+ } = useContext(store$k);
18746
+ const {
18747
+ t
18748
+ } = useTranslation("checkoutForm");
18749
+ const [isDisabled, setDisabled] = useState(true);
18750
+ useEffect(() => {
18751
+ setDisabled(disableSubmit);
18752
+ }, [disableSubmit]);
18753
+ return /*#__PURE__*/React__default.createElement(Button, Object.assign({
18754
+ className: "plc-w-full",
18755
+ onClick: () => {
18756
+ dispatch({
18757
+ type: DISABLE_SUBMIT,
18758
+ payload: true
18759
+ });
18760
+ dispatch({
18761
+ type: SUBMIT_PAYMENT
18762
+ });
18763
+ onClick === null || onClick === void 0 ? void 0 : onClick();
18764
+ },
18765
+ disabled: isDisabled,
18766
+ isLoading: disableSubmit
18767
+ }, otherProps), t("labels.submit"));
18768
+ };
18769
+
18669
18770
  /**
18670
18771
  *
18671
18772
  */
@@ -18678,7 +18779,8 @@ function PaymentMethodView(_ref) {
18678
18779
  type,
18679
18780
  showCoupon,
18680
18781
  showExternalPaymentMethods,
18681
- showSubscriptionButton
18782
+ showSubscriptionButton,
18783
+ showOrderButton
18682
18784
  } = _ref;
18683
18785
  const {
18684
18786
  t
@@ -18691,7 +18793,7 @@ function PaymentMethodView(_ref) {
18691
18793
  const isUserPhone = Boolean(window.Pelcro.user.read().phone);
18692
18794
  return /*#__PURE__*/React__default.createElement("div", {
18693
18795
  className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
18694
- }, cardProcessor === "stripe" && !showSubscriptionButton && /*#__PURE__*/React__default.createElement("div", {
18796
+ }, cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", {
18695
18797
  className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50"
18696
18798
  }, /*#__PURE__*/React__default.createElement(SvgLock, {
18697
18799
  className: "plc-w-5 plc-h-5 plc-mr-1"
@@ -18710,7 +18812,7 @@ function PaymentMethodView(_ref) {
18710
18812
  onFailure: onFailure
18711
18813
  }, /*#__PURE__*/React__default.createElement(AlertWithContext, {
18712
18814
  className: "plc-mb-2"
18713
- }), showSubscriptionButton ? /*#__PURE__*/React__default.createElement(SubscriptionCreateFreePlanButton, null) : /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
18815
+ }), showSubscriptionButton && /*#__PURE__*/React__default.createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default.createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
18714
18816
  className: "plc-flex plc-items-start"
18715
18817
  }, /*#__PURE__*/React__default.createElement(IncludeFirstName, {
18716
18818
  id: "pelcro-input-first-name",
@@ -20501,27 +20603,32 @@ function SubscriptionManageMembersList(props) {
20501
20603
  type: HANDLE_REMOVE_MEMBER
20502
20604
  });
20503
20605
  };
20504
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, members === null || members === void 0 ? void 0 : members.map(member => /*#__PURE__*/React__default.createElement("tr", {
20505
- key: member.id,
20506
- className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
20507
- }, /*#__PURE__*/React__default.createElement("td", {
20508
- className: "plc-truncate plc-text-left",
20509
- title: member === null || member === void 0 ? void 0 : member.invitation_email
20510
- }, /*#__PURE__*/React__default.createElement("span", {
20511
- className: "plc-font-semibold plc-text-gray-500"
20512
- }, member === null || member === void 0 ? void 0 : member.invitation_email)), /*#__PURE__*/React__default.createElement("td", {
20513
- className: "plc-py-2"
20514
- }, /*#__PURE__*/React__default.createElement("span", {
20515
- className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getMemberStatus(member).bgColor} plc-uppercase ${getMemberStatus(member).textColor} plc-rounded-lg`
20516
- }, getMemberStatus(member).icon, getMemberStatus(member).title)), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement(Button, {
20517
- variant: "ghost",
20518
- className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
20519
- icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
20520
- onClick: () => onRemoveClick(member.id),
20521
- disabled: member.id === removeMemberId,
20522
- isLoading: member.id === removeMemberId,
20523
- "data-key": member.id
20524
- }, t("labels.remove"))))));
20606
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, members === null || members === void 0 ? void 0 : members.map(member => {
20607
+ var _member$customer;
20608
+ return /*#__PURE__*/React__default.createElement("tr", {
20609
+ key: member.id,
20610
+ className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
20611
+ }, /*#__PURE__*/React__default.createElement("td", {
20612
+ className: "plc-truncate plc-text-left",
20613
+ title: member === null || member === void 0 ? void 0 : member.invitation_email
20614
+ }, member.status === "active" ? /*#__PURE__*/React__default.createElement("span", {
20615
+ className: "plc-font-semibold plc-text-gray-500"
20616
+ }, member === null || member === void 0 ? void 0 : (_member$customer = member.customer) === null || _member$customer === void 0 ? void 0 : _member$customer.email) : /*#__PURE__*/React__default.createElement("span", {
20617
+ className: "plc-font-semibold plc-text-gray-500"
20618
+ }, member === null || member === void 0 ? void 0 : member.invitation_email)), /*#__PURE__*/React__default.createElement("td", {
20619
+ className: "plc-py-2"
20620
+ }, /*#__PURE__*/React__default.createElement("span", {
20621
+ className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getMemberStatus(member).bgColor} plc-uppercase ${getMemberStatus(member).textColor} plc-rounded-lg`
20622
+ }, getMemberStatus(member).icon, getMemberStatus(member).title)), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement(Button, {
20623
+ variant: "ghost",
20624
+ className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
20625
+ icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
20626
+ onClick: () => onRemoveClick(member.id),
20627
+ disabled: member.id === removeMemberId,
20628
+ isLoading: member.id === removeMemberId,
20629
+ "data-key": member.id
20630
+ }, t("labels.remove"))));
20631
+ }));
20525
20632
  }
20526
20633
 
20527
20634
  /**
@@ -24115,9 +24222,15 @@ const OrderCreateContainer = props => /*#__PURE__*/React__default.createElement(
24115
24222
  }, props));
24116
24223
 
24117
24224
  const OrderCreateView = props => {
24225
+ var _window$Pelcro, _window$Pelcro$uiSett;
24118
24226
  const {
24119
24227
  t
24120
24228
  } = useTranslation("payment");
24229
+ const {
24230
+ order
24231
+ } = usePelcro();
24232
+ 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;
24233
+ const showOrderButton = skipPayment && (order === null || order === void 0 ? void 0 : order.price) === 0;
24121
24234
  return /*#__PURE__*/React__default.createElement("div", {
24122
24235
  id: "pelcro-order-create-view"
24123
24236
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -24128,7 +24241,8 @@ const OrderCreateView = props => {
24128
24241
  }, /*#__PURE__*/React__default.createElement(PaymentMethodView, Object.assign({
24129
24242
  type: "orderCreate",
24130
24243
  showCoupon: true,
24131
- showExternalPaymentMethods: false
24244
+ showExternalPaymentMethods: false,
24245
+ showOrderButton: showOrderButton
24132
24246
  }, props))));
24133
24247
  };
24134
24248
 
@@ -25336,11 +25450,12 @@ const PaymentMethodSelectModal = _ref => {
25336
25450
  const {
25337
25451
  switchToCheckoutForm,
25338
25452
  set,
25339
- plan
25453
+ plan,
25454
+ order
25340
25455
  } = usePelcro();
25341
25456
  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;
25342
25457
  useEffect(() => {
25343
- if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
25458
+ if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) {
25344
25459
  switchToCheckoutForm();
25345
25460
  }
25346
25461
  }, []);
@@ -32045,4 +32160,4 @@ const QrCodeModal = _ref => {
32045
32160
  };
32046
32161
  QrCodeModal.viewId = "qrcode";
32047
32162
 
32048
- export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify$1 as notify, unauthenticatedButtons, usePelcro };
32163
+ export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify$1 as notify, unauthenticatedButtons, usePelcro };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.21.1",
4
+ "version": "3.22.0-beta.2",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",