@orderingstack/front-components-product-configurator 1.5.1-beta.2 → 1.5.1-beta.3
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
|
@@ -6435,14 +6435,6 @@ const isApiBooleanTrue = (value) => {
|
|
|
6435
6435
|
}
|
|
6436
6436
|
return false;
|
|
6437
6437
|
};
|
|
6438
|
-
const scrollToId = (id) => {
|
|
6439
|
-
const element = document.getElementById(id);
|
|
6440
|
-
if (element) {
|
|
6441
|
-
element.scrollIntoView({ behavior: "smooth" });
|
|
6442
|
-
} else {
|
|
6443
|
-
console.warn(`Error: scrollToId: id: ${id} not found in html structure`);
|
|
6444
|
-
}
|
|
6445
|
-
};
|
|
6446
6438
|
const getOptionsKindId = (contextName) => {
|
|
6447
6439
|
return `options--${contextName}`;
|
|
6448
6440
|
};
|
|
@@ -6934,29 +6926,18 @@ const selectProductsInForm = (productToSelect, setValueInForm, initialSelectedSt
|
|
|
6934
6926
|
});
|
|
6935
6927
|
};
|
|
6936
6928
|
function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
|
|
6937
|
-
const { selCtx, attrs = {} } = product;
|
|
6938
6929
|
const initialSelected = useStore((state) => state.initialSelected);
|
|
6939
6930
|
const currency = useStore((state) => state.currency);
|
|
6940
6931
|
const { setValue, getValues } = useFormContext();
|
|
6941
6932
|
const { selected = {}, filter = {} } = getValues();
|
|
6942
6933
|
const isFilterValidated = validateProductFilter(product, filter);
|
|
6943
6934
|
const isOnSubmitted = useStore((state) => state.isOnSubmitted);
|
|
6944
|
-
|
|
6935
|
+
useStore((state) => state.setValidationMap);
|
|
6945
6936
|
const [selCnt, qtyCnt] = getSelCtxCntFromSelectedState(
|
|
6946
6937
|
product.selCtx,
|
|
6947
6938
|
selected,
|
|
6948
6939
|
product.items
|
|
6949
6940
|
);
|
|
6950
|
-
setValidationMap({
|
|
6951
|
-
productSelCtx: selCtx,
|
|
6952
|
-
attrs,
|
|
6953
|
-
actualQtyCnt: qtyCnt,
|
|
6954
|
-
actualSelCnt: selCnt,
|
|
6955
|
-
nestedLvl,
|
|
6956
|
-
isPassedFiltering: isFilterValidated,
|
|
6957
|
-
parentSelCtx,
|
|
6958
|
-
parentKind
|
|
6959
|
-
});
|
|
6960
6941
|
useEffect(() => {
|
|
6961
6942
|
const { productsToSelect, productsToUnselect } = getProductToChangeInForm(
|
|
6962
6943
|
product,
|
|
@@ -8593,7 +8574,7 @@ const MenuOptions = (props) => {
|
|
|
8593
8574
|
selCnt,
|
|
8594
8575
|
qtyCnt,
|
|
8595
8576
|
currency
|
|
8596
|
-
} = useMenuOptions(optionsItem
|
|
8577
|
+
} = useMenuOptions(optionsItem);
|
|
8597
8578
|
const {
|
|
8598
8579
|
MenuOptionsUI
|
|
8599
8580
|
} = useComponents();
|
|
@@ -11195,14 +11176,15 @@ function ProductConfigurator(props) {
|
|
|
11195
11176
|
const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected"), encodedProduct)).toFixed(2));
|
|
11196
11177
|
const onSubmit = () => {
|
|
11197
11178
|
var _a;
|
|
11198
|
-
console.log("onSubmit");
|
|
11199
11179
|
setIsOnSubmittedOnTrue();
|
|
11200
|
-
const
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11180
|
+
const validationMap = getValidationMap2(product, getValues("selected"), getValues("filter"));
|
|
11181
|
+
console.log("onSubmit product-configurator", validationMap);
|
|
11182
|
+
const isInvalid = Object.keys(validationMap).some(function(key) {
|
|
11183
|
+
const el = validationMap[key];
|
|
11184
|
+
return el.isValid === false;
|
|
11185
|
+
});
|
|
11186
|
+
if (isInvalid) {
|
|
11187
|
+
console.warn("INVALID VALIDATION MAP product-configurator", validationMap);
|
|
11206
11188
|
} else {
|
|
11207
11189
|
console.log("selected", getValues("selected"));
|
|
11208
11190
|
const decodedCleanedSelected = decodeSelected(cleanSelected(getValues("selected")));
|
|
@@ -11216,7 +11198,7 @@ function ProductConfigurator(props) {
|
|
|
11216
11198
|
}
|
|
11217
11199
|
}
|
|
11218
11200
|
});
|
|
11219
|
-
console.log("decodedCleanedSelected: ", decodedCleanedSelected);
|
|
11201
|
+
console.log("decodedCleanedSelected product-configurator: ", decodedCleanedSelected);
|
|
11220
11202
|
handleAddToCart({
|
|
11221
11203
|
price: countedProductPrice,
|
|
11222
11204
|
quantity: productQuantity,
|