@pelcro/react-pelcro-js 3.21.0 → 3.21.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
@@ -13951,6 +13951,16 @@ function productsWithMatchedTaggedFirst() {
13951
13951
  const allProductsMinusMatched = allProducts.filter(product => !productsThatMatchArticleTag.some(matchedProduct => matchedProduct.id === product.id));
13952
13952
  return [productsThatMatchArticleTag, allProductsMinusMatched];
13953
13953
  }
13954
+ function productMatchPageLanguage(product) {
13955
+ if (!product) {
13956
+ return false;
13957
+ }
13958
+ if (product.language === null) {
13959
+ return true;
13960
+ }
13961
+ const siteLanguage = window.Pelcro.helpers.getHtmlLanguageAttribute();
13962
+ return product.language === siteLanguage;
13963
+ }
13954
13964
  SelectModalWithHook.viewId = "plan-select";
13955
13965
  class SelectModal extends React.Component {
13956
13966
  constructor(props) {
@@ -13992,22 +14002,20 @@ class SelectModal extends React.Component {
13992
14002
  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;
13993
14003
  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;
13994
14004
  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;
13995
- 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 => {
13996
- const filteredPlans = product.plans.filter(plan => plan.countries && plan.countries.length > 0);
13997
- if (filteredPlans.length) {
13998
- return product;
13999
- }
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.filter(product => {
14006
+ const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
14007
+ if (filteredPlans.length) return filteredPlans;
14000
14008
  });
14001
- const currencyMismatch = productsWithPlansCountries.length ? productsWithPlansCountries.filter(product => {
14009
+ const productsMatchingUserCountry = productsMatchingUserCurrency.filter(product => {
14002
14010
  const filteredPlans = product.plans.filter(plan => {
14003
14011
  var _plan$countries;
14004
- return (_plan$countries = plan.countries) === null || _plan$countries === void 0 ? void 0 : _plan$countries.includes(userCountry);
14012
+ return plan.countries && ((_plan$countries = plan.countries) === null || _plan$countries === void 0 ? void 0 : _plan$countries.includes(userCountry)) || !plan.countries || !plan.countries.length;
14005
14013
  });
14006
14014
  if (filteredPlans.length) return filteredPlans;
14007
- }).length === 0 : false;
14015
+ });
14008
14016
  notifyBugsnag(() => {
14009
14017
  Bugsnag.notify("SelectModal - No data viewed", event => {
14010
- 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, _window$Pelcro11, _window$Pelcro11$site;
14018
+ 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;
14011
14019
  event.addMetadata("MetaData", {
14012
14020
  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(),
14013
14021
  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(),
@@ -14024,12 +14032,10 @@ class SelectModal extends React.Component {
14024
14032
  userCountry: userCountry,
14025
14033
  userLanguage: userLanguage,
14026
14034
  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(),
14027
- 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 => {
14028
- const filteredPlans = product.plans.find(plan => plan.currency === userCurrency);
14029
- if (filteredPlans) return filteredPlans;
14030
- }).length) === 0,
14031
- country_restrictions: currencyMismatch,
14032
- 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
14035
+ 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,
14036
+ currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
14037
+ country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
14038
+ language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
14033
14039
  });
14034
14040
  });
14035
14041
  });
package/dist/index.esm.js CHANGED
@@ -13921,6 +13921,16 @@ function productsWithMatchedTaggedFirst() {
13921
13921
  const allProductsMinusMatched = allProducts.filter(product => !productsThatMatchArticleTag.some(matchedProduct => matchedProduct.id === product.id));
13922
13922
  return [productsThatMatchArticleTag, allProductsMinusMatched];
13923
13923
  }
13924
+ function productMatchPageLanguage(product) {
13925
+ if (!product) {
13926
+ return false;
13927
+ }
13928
+ if (product.language === null) {
13929
+ return true;
13930
+ }
13931
+ const siteLanguage = window.Pelcro.helpers.getHtmlLanguageAttribute();
13932
+ return product.language === siteLanguage;
13933
+ }
13924
13934
  SelectModalWithHook.viewId = "plan-select";
13925
13935
  class SelectModal extends Component {
13926
13936
  constructor(props) {
@@ -13962,22 +13972,20 @@ class SelectModal extends Component {
13962
13972
  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;
13963
13973
  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;
13964
13974
  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;
13965
- 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 => {
13966
- const filteredPlans = product.plans.filter(plan => plan.countries && plan.countries.length > 0);
13967
- if (filteredPlans.length) {
13968
- return product;
13969
- }
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.filter(product => {
13976
+ const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
13977
+ if (filteredPlans.length) return filteredPlans;
13970
13978
  });
13971
- const currencyMismatch = productsWithPlansCountries.length ? productsWithPlansCountries.filter(product => {
13979
+ const productsMatchingUserCountry = productsMatchingUserCurrency.filter(product => {
13972
13980
  const filteredPlans = product.plans.filter(plan => {
13973
13981
  var _plan$countries;
13974
- return (_plan$countries = plan.countries) === null || _plan$countries === void 0 ? void 0 : _plan$countries.includes(userCountry);
13982
+ return plan.countries && ((_plan$countries = plan.countries) === null || _plan$countries === void 0 ? void 0 : _plan$countries.includes(userCountry)) || !plan.countries || !plan.countries.length;
13975
13983
  });
13976
13984
  if (filteredPlans.length) return filteredPlans;
13977
- }).length === 0 : false;
13985
+ });
13978
13986
  notifyBugsnag(() => {
13979
13987
  Bugsnag.notify("SelectModal - No data viewed", event => {
13980
- 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, _window$Pelcro11, _window$Pelcro11$site;
13988
+ 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;
13981
13989
  event.addMetadata("MetaData", {
13982
13990
  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(),
13983
13991
  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(),
@@ -13994,12 +14002,10 @@ class SelectModal extends Component {
13994
14002
  userCountry: userCountry,
13995
14003
  userLanguage: userLanguage,
13996
14004
  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(),
13997
- 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 => {
13998
- const filteredPlans = product.plans.find(plan => plan.currency === userCurrency);
13999
- if (filteredPlans) return filteredPlans;
14000
- }).length) === 0,
14001
- country_restrictions: currencyMismatch,
14002
- 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
14005
+ 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,
14006
+ currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
14007
+ country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
14008
+ language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
14003
14009
  });
14004
14010
  });
14005
14011
  });
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.0",
4
+ "version": "3.21.2",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",