@orderingstack/front-components-product-configurator 1.4.2-beta.3 → 1.4.2-beta.4

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.es.js CHANGED
@@ -6851,16 +6851,25 @@ var ENotificationType;
6851
6851
  ENotificationType2["ORDER_UPSELL"] = "OrderUpsell";
6852
6852
  })(ENotificationType || (ENotificationType = {}));
6853
6853
  const validateProductFilter = (product, stateFilter) => {
6854
+ var _a;
6854
6855
  const { filter: productFilters = {}, fltCtx = "" } = product;
6855
6856
  const stateFiltersWithFltCtx = stateFilter[fltCtx];
6856
- const hasProductFilters = !!Object.keys(productFilters).length;
6857
- if (hasProductFilters && stateFiltersWithFltCtx) {
6858
- const commonFilters = Object.keys(stateFiltersWithFltCtx).filter(
6859
- (filterName) => Object.keys(productFilters).includes(filterName) && productFilters[filterName].includes(stateFiltersWithFltCtx[filterName])
6860
- );
6861
- return commonFilters.length > 0;
6857
+ if (!productFilters || !Object.keys(productFilters).length || !stateFiltersWithFltCtx) {
6858
+ return true;
6862
6859
  }
6863
- return true;
6860
+ const commonFilters = (_a = Object.keys(stateFiltersWithFltCtx)) == null ? void 0 : _a.filter(
6861
+ (filterName) => {
6862
+ var _a2;
6863
+ const matchingFilters = (_a2 = Object.keys(productFilters == null ? void 0 : productFilters[filterName])) == null ? void 0 : _a2.filter((x2) => {
6864
+ var _a3;
6865
+ if (((_a3 = productFilters == null ? void 0 : productFilters[filterName]) == null ? void 0 : _a3[x2]) === (stateFiltersWithFltCtx == null ? void 0 : stateFiltersWithFltCtx[filterName])) {
6866
+ return true;
6867
+ }
6868
+ });
6869
+ return (matchingFilters == null ? void 0 : matchingFilters.length) > 0;
6870
+ }
6871
+ );
6872
+ return (commonFilters == null ? void 0 : commonFilters.length) > 0;
6864
6873
  };
6865
6874
  const getProductToChangeInForm = (product, isFilterValidated) => {
6866
6875
  const { items, filter } = product;