@orderingstack/front-components-product-configurator 1.4.2-beta.17 → 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
@@ -11050,15 +11050,18 @@ function ProductConfigurator(props) {
11050
11050
  }
11051
11051
  });
11052
11052
  console.log("ProductConfigurator initSelected", initSelected);
11053
- const methods = useForm({
11054
- defaultValues: {
11055
- selected: initSelected
11056
- }
11057
- });
11053
+ const methods = useForm();
11058
11054
  const {
11059
- getValues
11055
+ getValues,
11056
+ setValue
11060
11057
  } = methods;
11061
- 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));
11062
11065
  const onSubmit = () => {
11063
11066
  console.log("onSubmit");
11064
11067
  setIsOnSubmittedOnTrue();