@orderingstack/front-components-product-configurator 1.5.3-beta.6 → 1.6.0-beta.0

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
@@ -6124,6 +6124,7 @@ var EProductKind;
6124
6124
  EProductKind2["CATEGORY"] = "3e/group/category";
6125
6125
  EProductKind2["OPTIONS"] = "3e/group/options";
6126
6126
  EProductKind2["CONFIG"] = "3e/group/config";
6127
+ EProductKind2["GROUP_UPSELL"] = "3e/group/upsell";
6127
6128
  EProductKind2["STATIC"] = "3e/static";
6128
6129
  EProductKind2["REF"] = "3e/ref";
6129
6130
  EProductKind2["QUERY"] = "3e/query";
@@ -6281,7 +6282,7 @@ function findGroupInProductItemsBySelCtx(selCtx, parent) {
6281
6282
  }
6282
6283
  for (let i2 = 0; i2 < ((_a = parent.items) == null ? void 0 : _a.length); i2++) {
6283
6284
  const prod = parent.items[i2];
6284
- if (prod.selCtx === selCtx && prod.kind === EProductKind.OPTIONS) {
6285
+ if (prod.selCtx === selCtx && (prod.kind === EProductKind.OPTIONS || prod.kind === EProductKind.GROUP || prod.kind === EProductKind.GROUP_UPSELL)) {
6285
6286
  return prod;
6286
6287
  }
6287
6288
  if (prod.items && prod.items.length > 0) {
@@ -6293,6 +6294,7 @@ function findGroupInProductItemsBySelCtx(selCtx, parent) {
6293
6294
  }
6294
6295
  return null;
6295
6296
  }
6297
+ const isGroupOption = (prod) => prod.kind === EProductKind.OPTIONS || prod.kind === EProductKind.GROUP || prod.kind === EProductKind.GROUP_UPSELL;
6296
6298
  function createStore(createState) {
6297
6299
  let state;
6298
6300
  const listeners = /* @__PURE__ */ new Set();
@@ -8795,7 +8797,6 @@ const addProductToState = (selected, setValue) => {
8795
8797
  };
8796
8798
  const removeProductFromState = (selCtx, getValues, setValue) => {
8797
8799
  const changedSelCtx = getValues(`selected.${selCtx}`);
8798
- console.log("changedSelCtx", changedSelCtx);
8799
8800
  setValue(
8800
8801
  `selected.${selCtx}`,
8801
8802
  Object.keys(changedSelCtx).reduce((acc, key) => {
@@ -8903,7 +8904,7 @@ const findProductInParentProductBySelCtx = (parent, selCtx) => {
8903
8904
  return prod;
8904
8905
  }
8905
8906
  }
8906
- if (prod.kind === EProductKind.OPTIONS && prod.items && prod.items.length > 0) {
8907
+ if (isGroupOption(prod) && prod.items && prod.items.length > 0) {
8907
8908
  const found = findProductInParentProductBySelCtx(prod, selCtx);
8908
8909
  if (found) {
8909
8910
  return found;
@@ -9200,7 +9201,7 @@ function useMenuItemsDispatcher() {
9200
9201
  return item.kind === EProductKind.PRODUCT && isVisible(item);
9201
9202
  };
9202
9203
  const isMenuOptionsToShow = (item) => {
9203
- return [EProductKind.OPTIONS, EProductKind.CONFIG].includes(item.kind) && isVisible(item);
9204
+ return isGroupOption(item) && isVisible(item);
9204
9205
  };
9205
9206
  return { isMenuProductToShow, isMenuOptionsToShow };
9206
9207
  }
@@ -10649,7 +10650,7 @@ const getValidationMap2 = (product, selected = {}, filter, map, nestedLvl = 0) =
10649
10650
  if (nestedLvl === 0 || ((_a = selected[product.selCtx]) == null ? void 0 : _a[product.id])) {
10650
10651
  (_b = product == null ? void 0 : product.items) == null ? void 0 : _b.forEach((x2) => {
10651
10652
  var _a2, _b2, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n;
10652
- if (x2.kind === EProductKind.OPTIONS && (((_a2 = x2 == null ? void 0 : x2.attrs) == null ? void 0 : _a2.selMin) || ((_b2 = x2.attrs) == null ? void 0 : _b2.selMax) || ((_c = x2.attrs) == null ? void 0 : _c.qtyMin) || ((_d = x2.attrs) == null ? void 0 : _d.qtyMax) || ((_e2 = x2.attrs) == null ? void 0 : _e2.allowMultiple))) {
10653
+ if (isGroupOption(x2) && (((_a2 = x2 == null ? void 0 : x2.attrs) == null ? void 0 : _a2.selMin) || ((_b2 = x2.attrs) == null ? void 0 : _b2.selMax) || ((_c = x2.attrs) == null ? void 0 : _c.qtyMin) || ((_d = x2.attrs) == null ? void 0 : _d.qtyMax) || ((_e2 = x2.attrs) == null ? void 0 : _e2.allowMultiple))) {
10653
10654
  const [selCnt, qtyCnt] = getSelCtxCntFromSelectedState(
10654
10655
  x2.selCtx,
10655
10656
  selected,