@orderingstack/front-components-product-configurator 1.4.2-beta.30 → 1.4.2-beta.31

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
@@ -8903,6 +8903,7 @@ const addProductToState = (selected, setValue) => {
8903
8903
  };
8904
8904
  const removeProductFromState = (selCtx, getValues, setValue) => {
8905
8905
  const changedSelCtx = getValues(`selected.${selCtx}`);
8906
+ console.log("changedSelCtx", changedSelCtx);
8906
8907
  setValue(
8907
8908
  `selected.${selCtx}`,
8908
8909
  Object.keys(changedSelCtx).reduce((acc, key) => {
@@ -9005,8 +9006,10 @@ const findProductInParentProductBySelCtx = (parent, selCtx) => {
9005
9006
  }
9006
9007
  for (let i2 = 0; i2 < ((_a = parent.items) == null ? void 0 : _a.length); i2++) {
9007
9008
  const prod = parent.items[i2];
9008
- if (prod.selCtx === selCtx && prod.kind === EProductKind.PRODUCT) {
9009
- return prod;
9009
+ if (prod.selCtx) {
9010
+ if (prod.selCtx === selCtx && prod.kind === EProductKind.PRODUCT) {
9011
+ return prod;
9012
+ }
9010
9013
  }
9011
9014
  if (prod.kind === EProductKind.OPTIONS && prod.items && prod.items.length > 0) {
9012
9015
  const found = findProductInParentProductBySelCtx(prod, selCtx);
@@ -9017,7 +9020,7 @@ const findProductInParentProductBySelCtx = (parent, selCtx) => {
9017
9020
  }
9018
9021
  return null;
9019
9022
  };
9020
- function useMenuProduct(product, parentAttrs, nestedLvl) {
9023
+ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
9021
9024
  var _a;
9022
9025
  const { id, selCtx, emit = {}, fltCtx } = product;
9023
9026
  const {
@@ -9112,11 +9115,15 @@ function useMenuProduct(product, parentAttrs, nestedLvl) {
9112
9115
  }
9113
9116
  };
9114
9117
  const handleOnInputChange = (e2) => {
9118
+ var _a2;
9115
9119
  const {
9116
9120
  target: { checked, name: selCtx2, defaultValue: productId }
9117
9121
  } = e2;
9122
+ const otherGroupItems = (_a2 = parentPriduct == null ? void 0 : parentPriduct.items) == null ? void 0 : _a2.filter((x2) => x2.id !== product.id);
9118
9123
  for (const key of Object.keys(selected || {})) {
9119
- if (isRadio && key !== (product == null ? void 0 : product.selCtx) && (key == null ? void 0 : key.includes(product.selCtx)) && findProductInParentProductBySelCtx(product, key)) {
9124
+ const isItemToClear = (otherGroupItems == null ? void 0 : otherGroupItems.some((x2) => !!findProductInParentProductBySelCtx(x2, key))) ? key : false;
9125
+ console.log("isImportantItem", isItemToClear);
9126
+ if (isItemToClear) {
9120
9127
  setValue(`selected.${key}`, false);
9121
9128
  }
9122
9129
  }
@@ -9169,7 +9176,7 @@ const MenuProduct = (props) => {
9169
9176
  handleCounterIncrementQty,
9170
9177
  handleCounterDecrementQty,
9171
9178
  currency
9172
- } = useMenuProduct(product, parentAttrs, nestedLvl);
9179
+ } = useMenuProduct(product, parentAttrs, nestedLvl, parentProduct);
9173
9180
  const {
9174
9181
  MenuProductUI
9175
9182
  } = useComponents();
@@ -11019,6 +11026,7 @@ const MenuProductRoot = (props) => {
11019
11026
  parentProduct: product,
11020
11027
  rootProduct: product
11021
11028
  }) : /* @__PURE__ */ jsx(Fragment, {});
11029
+ console.log("MenuProductRootUI CHECK", MenuProductRootUI);
11022
11030
  if (MenuProductRootUI) {
11023
11031
  return /* @__PURE__ */ jsx(MenuProductRootUI, {
11024
11032
  ...props,