@orderingstack/front-components-product-configurator 1.4.2-beta.30 → 1.4.2-beta.32
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/components/MenuProduct/useMenuProduct.d.ts +1 -1
- package/dist/components/MenuProduct/useMenuProduct.d.ts.map +1 -1
- package/dist/components/MenuProductRoot/MenuProductRoot.d.ts.map +1 -1
- package/dist/components/ProductConfigurator/useProductConfigurator.d.ts +1 -0
- package/dist/components/ProductConfigurator/useProductConfigurator.d.ts.map +1 -1
- package/dist/index.cjs.js +6 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +16 -7
- package/dist/index.es.js.map +1 -1
- package/dist/utils/setSelected.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -6839,7 +6839,7 @@ function useProductConfigurator(product) {
|
|
|
6839
6839
|
const setIsOnSubmittedOnTrue = useStore(
|
|
6840
6840
|
(state) => state.setIsOnSubmittedOnTrue
|
|
6841
6841
|
);
|
|
6842
|
-
useStore((state) => state.refreshFormDt);
|
|
6842
|
+
const refreshFormDt = useStore((state) => state.refreshFormDt);
|
|
6843
6843
|
const getInvalidSelCtxArray = useStore((state) => state.getInvalidSelCtxArray);
|
|
6844
6844
|
const getValidationMap = useStore((state) => state.getValidationMap);
|
|
6845
6845
|
const increaseProductQuantity = () => {
|
|
@@ -6867,7 +6867,8 @@ function useProductConfigurator(product) {
|
|
|
6867
6867
|
productQuantity,
|
|
6868
6868
|
getValidationMap,
|
|
6869
6869
|
increaseProductQuantity,
|
|
6870
|
-
decreaseProductQuantity
|
|
6870
|
+
decreaseProductQuantity,
|
|
6871
|
+
refreshFormDt
|
|
6871
6872
|
};
|
|
6872
6873
|
}
|
|
6873
6874
|
const validateProductFilter = (product, stateFilter) => {
|
|
@@ -8903,6 +8904,7 @@ const addProductToState = (selected, setValue) => {
|
|
|
8903
8904
|
};
|
|
8904
8905
|
const removeProductFromState = (selCtx, getValues, setValue) => {
|
|
8905
8906
|
const changedSelCtx = getValues(`selected.${selCtx}`);
|
|
8907
|
+
console.log("changedSelCtx", changedSelCtx);
|
|
8906
8908
|
setValue(
|
|
8907
8909
|
`selected.${selCtx}`,
|
|
8908
8910
|
Object.keys(changedSelCtx).reduce((acc, key) => {
|
|
@@ -9005,8 +9007,10 @@ const findProductInParentProductBySelCtx = (parent, selCtx) => {
|
|
|
9005
9007
|
}
|
|
9006
9008
|
for (let i2 = 0; i2 < ((_a = parent.items) == null ? void 0 : _a.length); i2++) {
|
|
9007
9009
|
const prod = parent.items[i2];
|
|
9008
|
-
if (prod.selCtx
|
|
9009
|
-
|
|
9010
|
+
if (prod.selCtx) {
|
|
9011
|
+
if (prod.selCtx === selCtx && prod.kind === EProductKind.PRODUCT) {
|
|
9012
|
+
return prod;
|
|
9013
|
+
}
|
|
9010
9014
|
}
|
|
9011
9015
|
if (prod.kind === EProductKind.OPTIONS && prod.items && prod.items.length > 0) {
|
|
9012
9016
|
const found = findProductInParentProductBySelCtx(prod, selCtx);
|
|
@@ -9017,7 +9021,7 @@ const findProductInParentProductBySelCtx = (parent, selCtx) => {
|
|
|
9017
9021
|
}
|
|
9018
9022
|
return null;
|
|
9019
9023
|
};
|
|
9020
|
-
function useMenuProduct(product, parentAttrs, nestedLvl) {
|
|
9024
|
+
function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
9021
9025
|
var _a;
|
|
9022
9026
|
const { id, selCtx, emit = {}, fltCtx } = product;
|
|
9023
9027
|
const {
|
|
@@ -9112,11 +9116,15 @@ function useMenuProduct(product, parentAttrs, nestedLvl) {
|
|
|
9112
9116
|
}
|
|
9113
9117
|
};
|
|
9114
9118
|
const handleOnInputChange = (e2) => {
|
|
9119
|
+
var _a2;
|
|
9115
9120
|
const {
|
|
9116
9121
|
target: { checked, name: selCtx2, defaultValue: productId }
|
|
9117
9122
|
} = e2;
|
|
9123
|
+
const otherGroupItems = (_a2 = parentPriduct == null ? void 0 : parentPriduct.items) == null ? void 0 : _a2.filter((x2) => x2.id !== product.id);
|
|
9118
9124
|
for (const key of Object.keys(selected || {})) {
|
|
9119
|
-
|
|
9125
|
+
const isItemToClear = (otherGroupItems == null ? void 0 : otherGroupItems.some((x2) => !!findProductInParentProductBySelCtx(x2, key))) ? key : false;
|
|
9126
|
+
console.log("isImportantItem", isItemToClear);
|
|
9127
|
+
if (isItemToClear) {
|
|
9120
9128
|
setValue(`selected.${key}`, false);
|
|
9121
9129
|
}
|
|
9122
9130
|
}
|
|
@@ -9169,7 +9177,7 @@ const MenuProduct = (props) => {
|
|
|
9169
9177
|
handleCounterIncrementQty,
|
|
9170
9178
|
handleCounterDecrementQty,
|
|
9171
9179
|
currency
|
|
9172
|
-
} = useMenuProduct(product, parentAttrs, nestedLvl);
|
|
9180
|
+
} = useMenuProduct(product, parentAttrs, nestedLvl, parentProduct);
|
|
9173
9181
|
const {
|
|
9174
9182
|
MenuProductUI
|
|
9175
9183
|
} = useComponents();
|
|
@@ -11019,6 +11027,7 @@ const MenuProductRoot = (props) => {
|
|
|
11019
11027
|
parentProduct: product,
|
|
11020
11028
|
rootProduct: product
|
|
11021
11029
|
}) : /* @__PURE__ */ jsx(Fragment, {});
|
|
11030
|
+
console.log("MenuProductRootUI CHECK", MenuProductRootUI);
|
|
11022
11031
|
if (MenuProductRootUI) {
|
|
11023
11032
|
return /* @__PURE__ */ jsx(MenuProductRootUI, {
|
|
11024
11033
|
...props,
|