@orderingstack/front-components-product-configurator 1.5.1-beta.2 → 1.5.1-beta.4

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
  };
@@ -11195,14 +11187,15 @@ function ProductConfigurator(props) {
11195
11187
  const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected"), encodedProduct)).toFixed(2));
11196
11188
  const onSubmit = () => {
11197
11189
  var _a;
11198
- console.log("onSubmit");
11199
11190
  setIsOnSubmittedOnTrue();
11200
- const invalidContextNames = getInvalidSelCtxArray();
11201
- if (invalidContextNames.length) {
11202
- scrollToId(getOptionsKindId(invalidContextNames[0]));
11203
- console.log({
11204
- invalidContextNames
11205
- });
11191
+ const validationMap = getValidationMap2(product, getValues("selected"), getValues("filter"));
11192
+ console.log("onSubmit product-configurator", validationMap);
11193
+ const isInvalid = Object.keys(validationMap).some(function(key) {
11194
+ const el = validationMap[key];
11195
+ return el.isValid === false;
11196
+ });
11197
+ if (isInvalid) {
11198
+ console.warn("INVALID VALIDATION MAP product-configurator", validationMap);
11206
11199
  } else {
11207
11200
  console.log("selected", getValues("selected"));
11208
11201
  const decodedCleanedSelected = decodeSelected(cleanSelected(getValues("selected")));
@@ -11216,7 +11209,7 @@ function ProductConfigurator(props) {
11216
11209
  }
11217
11210
  }
11218
11211
  });
11219
- console.log("decodedCleanedSelected: ", decodedCleanedSelected);
11212
+ console.log("decodedCleanedSelected product-configurator: ", decodedCleanedSelected);
11220
11213
  handleAddToCart({
11221
11214
  price: countedProductPrice,
11222
11215
  quantity: productQuantity,