@orderingstack/front-components-product-configurator 1.4.2-beta.2 → 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;
@@ -8932,11 +8941,6 @@ function useMenuProduct(product, parentAttrs) {
8932
8941
  const {
8933
8942
  target: { checked, name: selCtx2, defaultValue: productId }
8934
8943
  } = e2;
8935
- for (const key of Object.keys(selected || {})) {
8936
- if (key !== (product == null ? void 0 : product.selCtx) && (key == null ? void 0 : key.includes(product.selCtx)) && isRadio) {
8937
- setValue(`selected.${key}`, false);
8938
- }
8939
- }
8940
8944
  selectUnselectProduct(setValue, getValues, product.items, checked, product.state);
8941
8945
  if (isRadio) {
8942
8946
  console.log("handleOnInputChange radio", selCtx2, productId);