@orderingstack/front-components-product-configurator 1.4.2-beta.36 → 1.4.2-beta.37

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
@@ -9051,15 +9051,30 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
9051
9051
  }
9052
9052
  });
9053
9053
  const handleCounterIncrementQty = () => {
9054
+ var _a2, _b;
9054
9055
  setValue(`selected.${selCtx}.${id}`, `${valueNumber + 1}`);
9056
+ const importantSubProductsInState = (_b = (_a2 = Object.keys(selected)) == null ? void 0 : _a2.map((y2) => {
9057
+ var _a3;
9058
+ return { key: y2, subProductId: (_a3 = findProductInParentProductBySelCtx(product, y2)) == null ? void 0 : _a3.id };
9059
+ })) == null ? void 0 : _b.filter((x2) => !!x2.subProductId);
9060
+ importantSubProductsInState == null ? void 0 : importantSubProductsInState.forEach((x2) => {
9061
+ setValue(`selected.${x2.key}.${x2.subProductId}`, `${valueNumber + 1}`);
9062
+ });
9055
9063
  };
9056
9064
  const handleCounterDecrementQty = () => {
9057
- var _a2, _b;
9065
+ var _a2, _b, _c, _d;
9058
9066
  const decrementedValue = valueNumber - 1;
9059
9067
  setValue(`selected.${selCtx}.${id}`, `${decrementedValue}`);
9068
+ const importantSubProductsInState = (_b = (_a2 = Object.keys(selected)) == null ? void 0 : _a2.map((y2) => {
9069
+ var _a3;
9070
+ return { key: y2, subProductId: (_a3 = findProductInParentProductBySelCtx(product, y2)) == null ? void 0 : _a3.id };
9071
+ })) == null ? void 0 : _b.filter((x2) => !!x2.subProductId);
9072
+ importantSubProductsInState == null ? void 0 : importantSubProductsInState.forEach((x2) => {
9073
+ setValue(`selected.${x2.key}.${x2.subProductId}`, `${decrementedValue}`);
9074
+ });
9060
9075
  if (isCheckbox && decrementedValue === 0) {
9061
9076
  setValue(`selected.${selCtx}.${id}`, false);
9062
- (_a2 = Object.keys(emit)) == null ? void 0 : _a2.forEach((x2) => {
9077
+ (_c = Object.keys(emit)) == null ? void 0 : _c.forEach((x2) => {
9063
9078
  const formPath = `filterWithCnt.${fltCtx}.${x2}.${emit[x2]}`;
9064
9079
  const cnt = getValues(formPath) || 0;
9065
9080
  if (cnt < 2) {
@@ -9085,8 +9100,8 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
9085
9100
  const groupsPath = `filterWithCnt.${fltCtx}`;
9086
9101
  const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
9087
9102
  const fltCtxPath = `filter.${fltCtx}`;
9088
- (_b = Object.keys(emit)) == null ? void 0 : _b.forEach((emitKey) => {
9089
- var _a3, _b2, _c;
9103
+ (_d = Object.keys(emit)) == null ? void 0 : _d.forEach((emitKey) => {
9104
+ var _a3, _b2, _c2;
9090
9105
  const groupValue = getValues(`${groupCntPath}.${emitKey}`) || 0;
9091
9106
  if (groupValue) {
9092
9107
  if (groupValue > 1) {
@@ -9105,7 +9120,7 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
9105
9120
  if (!sameKeyOtherGroup) {
9106
9121
  unregister(`${fltCtxPath}.${emitKey}`);
9107
9122
  } else {
9108
- const newValue = (_c = (_b2 = groupKeysObj == null ? void 0 : groupKeysObj[`${sameKeyOtherGroup}`]) == null ? void 0 : _b2[`${emitKey}`]) == null ? void 0 : _c.value;
9123
+ const newValue = (_c2 = (_b2 = groupKeysObj == null ? void 0 : groupKeysObj[`${sameKeyOtherGroup}`]) == null ? void 0 : _b2[`${emitKey}`]) == null ? void 0 : _c2.value;
9109
9124
  setValue(`${fltCtxPath}.${emitKey}`, newValue);
9110
9125
  }
9111
9126
  }
@@ -9126,7 +9141,6 @@ function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
9126
9141
  const otherGroupItems = (_a2 = parentPriduct == null ? void 0 : parentPriduct.items) == null ? void 0 : _a2.filter((x2) => x2.id !== product.id);
9127
9142
  for (const key of Object.keys(selected || {})) {
9128
9143
  const isItemToClear = (otherGroupItems == null ? void 0 : otherGroupItems.some((x2) => !!findProductInParentProductBySelCtx(x2, key))) ? key : false;
9129
- console.log("isImportantItem", isItemToClear);
9130
9144
  if (isItemToClear) {
9131
9145
  setValue(`selected.${key}`, false);
9132
9146
  }
@@ -11027,7 +11041,6 @@ const MenuProductRoot = (props) => {
11027
11041
  parentProduct: product,
11028
11042
  rootProduct: product
11029
11043
  }) : /* @__PURE__ */ jsx(Fragment, {});
11030
- console.log("MenuProductRootUI CHECK", MenuProductRootUI);
11031
11044
  if (MenuProductRootUI) {
11032
11045
  return /* @__PURE__ */ jsx(MenuProductRootUI, {
11033
11046
  ...props,
@@ -11102,8 +11115,7 @@ function ProductConfigurator(props) {
11102
11115
  defaultValues: {
11103
11116
  selected: initSelected,
11104
11117
  filter: initFilter
11105
- },
11106
- shouldUnregister: false
11118
+ }
11107
11119
  });
11108
11120
  const {
11109
11121
  getValues