@orderingstack/front-components-product-configurator 1.4.2-beta.0 → 1.4.2-beta.1
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/DisplayState/DisplayState.d.ts.map +1 -1
- package/dist/components/ProductConfigurator/ProductConfigurator.d.ts.map +1 -1
- package/dist/hooks/useEmitFilter.d.ts.map +1 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +6 -10
- package/dist/index.es.js.map +1 -1
- package/dist/utils/filter.d.ts.map +1 -1
- package/dist/utils/setSelected.d.ts.map +1 -1
- package/package.json +89 -89
package/dist/index.es.js
CHANGED
|
@@ -6855,7 +6855,6 @@ const validateProductFilter = (product, stateFilter) => {
|
|
|
6855
6855
|
const stateFiltersWithFltCtx = stateFilter[fltCtx];
|
|
6856
6856
|
const hasProductFilters = !!Object.keys(productFilters).length;
|
|
6857
6857
|
if (hasProductFilters && stateFiltersWithFltCtx) {
|
|
6858
|
-
console.log("12345", productFilters);
|
|
6859
6858
|
const commonFilters = Object.keys(stateFiltersWithFltCtx).filter(
|
|
6860
6859
|
(filterName) => Object.keys(productFilters).includes(filterName) && productFilters[filterName].includes(stateFiltersWithFltCtx[filterName])
|
|
6861
6860
|
);
|
|
@@ -8800,9 +8799,6 @@ function useEmitFilter(product) {
|
|
|
8800
8799
|
const setFilter = useStore((state) => state.setFilter);
|
|
8801
8800
|
const { id, selCtx, emit = {}, fltCtx } = product;
|
|
8802
8801
|
const value = watch(`selected.${selCtx}.${id}`);
|
|
8803
|
-
if (id === "MI1001001") {
|
|
8804
|
-
console.log("use emit filter", value, fltCtx, emit);
|
|
8805
|
-
}
|
|
8806
8802
|
useEffect(() => {
|
|
8807
8803
|
if (value && fltCtx && !isEmpty(emit)) {
|
|
8808
8804
|
setFilter(fltCtx, emit);
|
|
@@ -8842,9 +8838,13 @@ const selectUnselectProduct = (setValue, getValues, items, isChecked, state) =>
|
|
|
8842
8838
|
if (isChecked) {
|
|
8843
8839
|
addProductToState(selected, setValue);
|
|
8844
8840
|
const checkSubProducts = (items2) => {
|
|
8841
|
+
var _a;
|
|
8845
8842
|
if (!Array.isArray(items2) || isEmpty(state == null ? void 0 : state.selected))
|
|
8846
8843
|
return;
|
|
8847
|
-
items2.
|
|
8844
|
+
(_a = items2 == null ? void 0 : items2.filter((x2) => {
|
|
8845
|
+
var _a2, _b;
|
|
8846
|
+
return !!((_b = (_a2 = state.selected) == null ? void 0 : _a2[`${x2.selCtx}`]) == null ? void 0 : _b[`${x2.id}`]);
|
|
8847
|
+
})) == null ? void 0 : _a.map((product) => {
|
|
8848
8848
|
if (product.state && "selected" in product.state) {
|
|
8849
8849
|
const {
|
|
8850
8850
|
state: { selected: selected2 }
|
|
@@ -9208,14 +9208,11 @@ const DisplayState = () => {
|
|
|
9208
9208
|
const {
|
|
9209
9209
|
watch
|
|
9210
9210
|
} = useFormContext();
|
|
9211
|
-
const form = useFormContext();
|
|
9212
9211
|
const selected = watch("selected");
|
|
9213
|
-
const filter = form.getValues("filter");
|
|
9214
9212
|
const validationMap = useStore((state) => state.validationMap);
|
|
9215
9213
|
console.log({
|
|
9216
9214
|
selected,
|
|
9217
|
-
validationMap
|
|
9218
|
-
filter
|
|
9215
|
+
validationMap
|
|
9219
9216
|
});
|
|
9220
9217
|
return /* @__PURE__ */ jsxs("div", {
|
|
9221
9218
|
className: "flex flex-col items-center py-4",
|
|
@@ -10912,7 +10909,6 @@ function ProductConfigurator(props) {
|
|
|
10912
10909
|
});
|
|
10913
10910
|
} else {
|
|
10914
10911
|
console.log("selected", getValues("selected"));
|
|
10915
|
-
console.log("filter", getValues("filter"));
|
|
10916
10912
|
const decodedCleanedSelected = decodeSelected(cleanSelected(getValues("selected")));
|
|
10917
10913
|
console.log("decodedCleanedSelected: ", decodedCleanedSelected);
|
|
10918
10914
|
handleAddToCart({
|