@orderingstack/front-components-product-configurator 1.4.2-beta.15 → 1.4.2-beta.18

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
@@ -11049,15 +11049,19 @@ function ProductConfigurator(props) {
11049
11049
  setValidationMap(validationMapNew);
11050
11050
  }
11051
11051
  });
11052
- const methods = useForm({
11053
- defaultValues: {
11054
- selected: initSelected
11055
- }
11056
- });
11052
+ console.log("ProductConfigurator initSelected", initSelected);
11053
+ const methods = useForm();
11057
11054
  const {
11058
- getValues
11055
+ getValues,
11056
+ setValue
11059
11057
  } = methods;
11060
- const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected"), encodedProduct)).toFixed(2));
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
11065
  const onSubmit = () => {
11062
11066
  console.log("onSubmit");
11063
11067
  setIsOnSubmittedOnTrue();