@pelcro/react-pelcro-js 3.20.0 → 3.20.1-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
@@ -13981,14 +13981,41 @@ class SelectModal extends React.Component {
13981
13981
  }
13982
13982
  document.addEventListener("keydown", this.handleSubmit);
13983
13983
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
13984
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
13985
+ 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;
13986
+ 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;
13987
+ 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;
13988
+ const productsWithPlansCountries = (_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 => {
13989
+ const filteredPlans = product.plans.filter(plan => plan.countries && plan.countries.length > 0);
13990
+ if (filteredPlans.length) {
13991
+ return product;
13992
+ }
13993
+ });
13994
+ const currencyMismatch = productsWithPlansCountries.length ? productsWithPlansCountries.filter(product => {
13995
+ const filteredPlans = product.plans.filter(plan => {
13996
+ var _plan$countries;
13997
+ return (_plan$countries = plan.countries) === null || _plan$countries === void 0 ? void 0 : _plan$countries.includes(userCountry);
13998
+ });
13999
+ if (filteredPlans.length) return filteredPlans;
14000
+ }).length === 0 : false;
13984
14001
  notifyBugsnag(() => {
13985
14002
  Bugsnag.notify("SelectModal - No data viewed", event => {
13986
- var _window$Pelcro, _window$Pelcro$site, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro4;
14003
+ var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _window$Pelcro9, _window$Pelcro9$helpe, _window$Pelcro10, _window$Pelcro10$site, _window$Pelcro11, _window$Pelcro11$site;
13987
14004
  event.addMetadata("MetaData", {
13988
- site: (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : _window$Pelcro$site.read(),
13989
- user: (_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.read(),
13990
- uiVersion: (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.uiVersion,
13991
- environment: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : _window$Pelcro4.environment
14005
+ 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(),
14006
+ 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(),
14007
+ uiVersion: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : (_window$Pelcro7$uiSet = _window$Pelcro7.uiSettings) === null || _window$Pelcro7$uiSet === void 0 ? void 0 : _window$Pelcro7$uiSet.uiVersion,
14008
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
14009
+ userCurrency: userCurrency,
14010
+ userCountry: userCountry,
14011
+ userLanguage: userLanguage,
14012
+ 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(),
14013
+ currency_mismatch: ((_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.filter(product => {
14014
+ const filteredPlans = product.plans.find(plan => plan.currency === userCurrency);
14015
+ if (filteredPlans) return filteredPlans;
14016
+ }).length) === 0,
14017
+ country_restrictions: currencyMismatch,
14018
+ language_mismatch: ((_window$Pelcro11 = window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$site = _window$Pelcro11.site) === null || _window$Pelcro11$site === void 0 ? void 0 : _window$Pelcro11$site.read().products.filter(product => product.language === userLanguage).length) === 0
13992
14019
  });
13993
14020
  });
13994
14021
  });
@@ -16759,6 +16786,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16759
16786
  const tapInstanceRef = React__default['default'].useRef(null);
16760
16787
  const tapInstanceCard = React__default['default'].useRef(null);
16761
16788
  React.useEffect(() => {
16789
+ if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16762
16790
  if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
16763
16791
  var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
16764
16792
  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;
@@ -16787,6 +16815,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16787
16815
  }, [selectedPaymentMethodId]);
16788
16816
  React.useEffect(() => {
16789
16817
  whenUserReady(() => {
16818
+ if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16790
16819
  if (cardProcessor === "tap" && !window.Tapjsli) {
16791
16820
  window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
16792
16821
  window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
package/dist/index.esm.js CHANGED
@@ -13951,14 +13951,41 @@ class SelectModal extends Component {
13951
13951
  }
13952
13952
  document.addEventListener("keydown", this.handleSubmit);
13953
13953
  if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
13954
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
13955
+ 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;
13956
+ 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;
13957
+ 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;
13958
+ const productsWithPlansCountries = (_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 => {
13959
+ const filteredPlans = product.plans.filter(plan => plan.countries && plan.countries.length > 0);
13960
+ if (filteredPlans.length) {
13961
+ return product;
13962
+ }
13963
+ });
13964
+ const currencyMismatch = productsWithPlansCountries.length ? productsWithPlansCountries.filter(product => {
13965
+ const filteredPlans = product.plans.filter(plan => {
13966
+ var _plan$countries;
13967
+ return (_plan$countries = plan.countries) === null || _plan$countries === void 0 ? void 0 : _plan$countries.includes(userCountry);
13968
+ });
13969
+ if (filteredPlans.length) return filteredPlans;
13970
+ }).length === 0 : false;
13954
13971
  notifyBugsnag(() => {
13955
13972
  Bugsnag.notify("SelectModal - No data viewed", event => {
13956
- var _window$Pelcro, _window$Pelcro$site, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro4;
13973
+ var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _window$Pelcro9, _window$Pelcro9$helpe, _window$Pelcro10, _window$Pelcro10$site, _window$Pelcro11, _window$Pelcro11$site;
13957
13974
  event.addMetadata("MetaData", {
13958
- site: (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : _window$Pelcro$site.read(),
13959
- user: (_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.read(),
13960
- uiVersion: (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.uiVersion,
13961
- environment: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : _window$Pelcro4.environment
13975
+ 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(),
13976
+ 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(),
13977
+ uiVersion: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : (_window$Pelcro7$uiSet = _window$Pelcro7.uiSettings) === null || _window$Pelcro7$uiSet === void 0 ? void 0 : _window$Pelcro7$uiSet.uiVersion,
13978
+ environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
13979
+ userCurrency: userCurrency,
13980
+ userCountry: userCountry,
13981
+ userLanguage: userLanguage,
13982
+ 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(),
13983
+ currency_mismatch: ((_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.filter(product => {
13984
+ const filteredPlans = product.plans.find(plan => plan.currency === userCurrency);
13985
+ if (filteredPlans) return filteredPlans;
13986
+ }).length) === 0,
13987
+ country_restrictions: currencyMismatch,
13988
+ language_mismatch: ((_window$Pelcro11 = window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$site = _window$Pelcro11.site) === null || _window$Pelcro11$site === void 0 ? void 0 : _window$Pelcro11$site.read().products.filter(product => product.language === userLanguage).length) === 0
13962
13989
  });
13963
13990
  });
13964
13991
  });
@@ -16729,6 +16756,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16729
16756
  const tapInstanceRef = React__default.useRef(null);
16730
16757
  const tapInstanceCard = React__default.useRef(null);
16731
16758
  useEffect(() => {
16759
+ if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16732
16760
  if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
16733
16761
  var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
16734
16762
  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;
@@ -16757,6 +16785,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16757
16785
  }, [selectedPaymentMethodId]);
16758
16786
  useEffect(() => {
16759
16787
  whenUserReady(() => {
16788
+ if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
16760
16789
  if (cardProcessor === "tap" && !window.Tapjsli) {
16761
16790
  window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
16762
16791
  window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
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.20.0",
4
+ "version": "3.20.1-beta.2",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",