@orderingstack/front-components-product-configurator 1.4.2-beta.21 → 1.4.2-beta.23

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
@@ -6918,8 +6918,9 @@ function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
6918
6918
  useStore((state) => state.filter);
6919
6919
  const initialSelected = useStore((state) => state.initialSelected);
6920
6920
  const currency = useStore((state) => state.currency);
6921
- const { setValue, getValues } = useFormContext();
6922
- const { selected = {}, filter = {} } = getValues();
6921
+ const { setValue, getValues, watch } = useFormContext();
6922
+ const selected = watch("selected");
6923
+ const filter = watch("filter");
6923
6924
  const isFilterValidated = validateProductFilter(product, filter);
6924
6925
  const isOnSubmitted = useStore((state) => state.isOnSubmitted);
6925
6926
  const setValidationMap = useStore((state) => state.setValidationMap);
@@ -6943,11 +6944,12 @@ function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
6943
6944
  product,
6944
6945
  isFilterValidated
6945
6946
  );
6947
+ console.log("LOG1 useMenuOptions useEffect isFilterValidated", isFilterValidated, product);
6946
6948
  console.log("LOG1 useMenuOptions useEffect productsToUnselect", productsToUnselect);
6947
6949
  console.log("LOG1 useMenuOptions useEffect productsToSelect", productsToSelect);
6948
- unselectProductsInForm(productsToUnselect, setValue);
6949
6950
  selectProductsInForm(productsToSelect, setValue, initialSelected);
6950
- }, [isFilterValidated, selected]);
6951
+ unselectProductsInForm(productsToUnselect, setValue);
6952
+ }, [isFilterValidated]);
6951
6953
  return {
6952
6954
  isFilterValidated,
6953
6955
  selected,
@@ -8953,7 +8955,7 @@ const selectUnselectProduct = (setValue, getValues, product, isChecked, unregist
8953
8955
  const groupsPath = `filterWithCnt.${fltCtx}`;
8954
8956
  const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
8955
8957
  const fltCtxPath = `filter.${fltCtx}`;
8956
- (_b = Object.keys(product.emit)) == null ? void 0 : _b.forEach((emitKey) => {
8958
+ (_b = Object.keys(emit)) == null ? void 0 : _b.forEach((emitKey) => {
8957
8959
  var _a2, _b2, _c;
8958
8960
  const groupValue = getValues(`${groupCntPath}.${emitKey}`) || 0;
8959
8961
  if (groupValue) {
@@ -11028,7 +11030,6 @@ function ProductConfigurator(props) {
11028
11030
  const {
11029
11031
  encodedProduct,
11030
11032
  initSelected,
11031
- filter,
11032
11033
  productQuantity,
11033
11034
  setIsOnSubmittedOnTrue,
11034
11035
  getInvalidSelCtxArray,
@@ -11071,6 +11072,8 @@ function ProductConfigurator(props) {
11071
11072
  } else {
11072
11073
  console.log("selected", getValues("selected"));
11073
11074
  const decodedCleanedSelected = decodeSelected(cleanSelected(getValues("selected")));
11075
+ const filter = getValues("filter");
11076
+ console.log("filter", filter);
11074
11077
  console.log("decodedCleanedSelected: ", decodedCleanedSelected);
11075
11078
  handleAddToCart({
11076
11079
  price: countedProductPrice,