@orderingstack/front-components-product-configurator 1.4.2-beta.18 → 1.4.2-beta.19
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/MenuOptions/useMenuOptions.d.ts.map +1 -1
- package/dist/components/ProductConfigurator/ProductConfigurator.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 +10 -13
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -6913,11 +6913,11 @@ const selectProductsInForm = (productToUnselect, setValueInForm, initialSelected
|
|
|
6913
6913
|
};
|
|
6914
6914
|
function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
|
|
6915
6915
|
const { selCtx, attrs = {} } = product;
|
|
6916
|
-
useStore((state) => state.filter);
|
|
6917
6916
|
const initialSelected = useStore((state) => state.initialSelected);
|
|
6918
6917
|
const currency = useStore((state) => state.currency);
|
|
6919
|
-
const { setValue, getValues } = useFormContext();
|
|
6920
|
-
const
|
|
6918
|
+
const { setValue, getValues, watch } = useFormContext();
|
|
6919
|
+
const selected = watch("selected");
|
|
6920
|
+
const filter = watch("filter") || {};
|
|
6921
6921
|
const isFilterValidated = validateProductFilter(product, filter);
|
|
6922
6922
|
const isOnSubmitted = useStore((state) => state.isOnSubmitted);
|
|
6923
6923
|
const setValidationMap = useStore((state) => state.setValidationMap);
|
|
@@ -11050,18 +11050,15 @@ function ProductConfigurator(props) {
|
|
|
11050
11050
|
}
|
|
11051
11051
|
});
|
|
11052
11052
|
console.log("ProductConfigurator initSelected", initSelected);
|
|
11053
|
-
const methods = useForm(
|
|
11053
|
+
const methods = useForm({
|
|
11054
|
+
defaultValues: {
|
|
11055
|
+
selected: initSelected
|
|
11056
|
+
}
|
|
11057
|
+
});
|
|
11054
11058
|
const {
|
|
11055
|
-
getValues
|
|
11056
|
-
setValue
|
|
11059
|
+
getValues
|
|
11057
11060
|
} = methods;
|
|
11058
|
-
const
|
|
11059
|
-
selected
|
|
11060
|
-
} = getValues();
|
|
11061
|
-
if (!selected && initSelected) {
|
|
11062
|
-
setValue("selected", initSelected);
|
|
11063
|
-
}
|
|
11064
|
-
const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected") || {}, encodedProduct)).toFixed(2));
|
|
11061
|
+
const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected"), encodedProduct)).toFixed(2));
|
|
11065
11062
|
const onSubmit = () => {
|
|
11066
11063
|
console.log("onSubmit");
|
|
11067
11064
|
setIsOnSubmittedOnTrue();
|