@orderingstack/front-components-product-configurator 1.4.2-beta.9 → 1.5.2-beta.28

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
@@ -6275,6 +6275,160 @@ const cleanSelected = (selected) => {
6275
6275
  const decodeSelected = (selected) => {
6276
6276
  return decodeValue("selected", selected);
6277
6277
  };
6278
+ var EPaymentStatus;
6279
+ (function(EPaymentStatus2) {
6280
+ EPaymentStatus2["UNINITIALIZED"] = "UNINITIALIZED";
6281
+ EPaymentStatus2["PROCESSING"] = "PROCESSING";
6282
+ EPaymentStatus2["PAID"] = "PAID";
6283
+ EPaymentStatus2["FAILED"] = "FAILED";
6284
+ EPaymentStatus2["PRINTING_RECEIPT"] = "PRINTING_RECEIPT";
6285
+ EPaymentStatus2["PRINTING_RECEIPT_SUCCESS"] = "PRINTING_RECEIPT_SUCCESS";
6286
+ EPaymentStatus2["SENDING_RECEIPT"] = "SENDING_RECEIPT";
6287
+ EPaymentStatus2["SENDING_RECEIPT_SUCCESS"] = "SENDING_RECEIPT_SUCCESS";
6288
+ EPaymentStatus2["ERROR"] = "ERROR";
6289
+ })(EPaymentStatus || (EPaymentStatus = {}));
6290
+ var ECouponViewType;
6291
+ (function(ECouponViewType2) {
6292
+ ECouponViewType2["CAROUSEL"] = "carousel";
6293
+ ECouponViewType2["NORMAL"] = "normal";
6294
+ ECouponViewType2["IMAGE"] = "image";
6295
+ })(ECouponViewType || (ECouponViewType = {}));
6296
+ var EProductKind;
6297
+ (function(EProductKind2) {
6298
+ EProductKind2["GROUP"] = "3e/group";
6299
+ EProductKind2["PRODUCT"] = "3e/product";
6300
+ EProductKind2["CATEGORY"] = "3e/group/category";
6301
+ EProductKind2["OPTIONS"] = "3e/group/options";
6302
+ EProductKind2["CONFIG"] = "3e/group/config";
6303
+ EProductKind2["STATIC"] = "3e/static";
6304
+ EProductKind2["REF"] = "3e/ref";
6305
+ EProductKind2["QUERY"] = "3e/query";
6306
+ EProductKind2["CMS"] = "3e/cms";
6307
+ })(EProductKind || (EProductKind = {}));
6308
+ var EProductKindBucket;
6309
+ (function(EProductKindBucket2) {
6310
+ EProductKindBucket2["GROUP"] = "group";
6311
+ EProductKindBucket2["PRODUCT"] = "product";
6312
+ })(EProductKindBucket || (EProductKindBucket = {}));
6313
+ var EOrderUserRole;
6314
+ (function(EOrderUserRole2) {
6315
+ EOrderUserRole2["CREATOR"] = "CREATOR";
6316
+ EOrderUserRole2["CUSTOMER"] = "CUSTOMER";
6317
+ EOrderUserRole2["COUPONS"] = "COUPON";
6318
+ EOrderUserRole2["KIOSK"] = "KIOSK";
6319
+ EOrderUserRole2["WAITER"] = "WAITER";
6320
+ EOrderUserRole2["MANAGER"] = "MANAGER";
6321
+ EOrderUserRole2["VIEWER"] = "VIEWER";
6322
+ EOrderUserRole2["DRIVER"] = "DRIVER";
6323
+ EOrderUserRole2["STAFF"] = "STAFF";
6324
+ })(EOrderUserRole || (EOrderUserRole = {}));
6325
+ var EOrderType;
6326
+ (function(EOrderType2) {
6327
+ EOrderType2["TAKE_AWAY"] = "TAKE_AWAY";
6328
+ EOrderType2["DELIVERY"] = "DELIVERY";
6329
+ EOrderType2["DINE_IN"] = "DINE_IN";
6330
+ EOrderType2["DINE_IN_OPEN"] = "DINE_IN_OPEN";
6331
+ EOrderType2["GLOVO_DELIVERY"] = "GLOVO_DELIVERY";
6332
+ EOrderType2["GLOVO_TAKE_AWAY"] = "GLOVO_TAKE_AWAY";
6333
+ EOrderType2["JUSTEAT_DELIVERY"] = "JUSTEAT_DELIVERY";
6334
+ EOrderType2["JUSTEAT_TAKE_AWAY"] = "JUSTEAT_TAKE_AWAY";
6335
+ EOrderType2["UBER_DELIVERY"] = "UBER_DELIVERY";
6336
+ EOrderType2["UBER_TAKE_AWAY"] = "UBER_TAKE_AWAY";
6337
+ EOrderType2["UBER_DINE_IN"] = "UBER_DINE_IN";
6338
+ EOrderType2["WOLT_DELIVERY"] = "WOLT_DELIVERY";
6339
+ EOrderType2["WOLT_TAKE_AWAY"] = "WOLT_TAKE_AWAY";
6340
+ EOrderType2["WOLT_DINE_IN"] = "WOLT_DINE_IN";
6341
+ EOrderType2["BOLT_DELIVERY"] = "BOLT_DELIVERY";
6342
+ EOrderType2["BOLT_TAKE_AWAY"] = "BOLT_TAKE_AWAY";
6343
+ EOrderType2["BOLT_DINE_IN"] = "BOLT_DINE_IN";
6344
+ EOrderType2["TAZZ_DELIVERY"] = "TAZZ_DELIVERY";
6345
+ EOrderType2["TAZZ_TAKE_AWAY"] = "TAZZ_TAKE_AWAY";
6346
+ EOrderType2["UPMENU_DELIVERY"] = "UPMENU_DELIVERY";
6347
+ EOrderType2["UPMENU_TAKE_AWAY"] = "UPMENU_TAKE_AWAY";
6348
+ EOrderType2["UPMENU_DINE_IN"] = "UPMENU_DINE_IN";
6349
+ })(EOrderType || (EOrderType = {}));
6350
+ var EOrderSource;
6351
+ (function(EOrderSource2) {
6352
+ EOrderSource2["KIOSK"] = "KIOSK";
6353
+ EOrderSource2["WEB"] = "WEB";
6354
+ EOrderSource2["JUST_EAT_TAKE_AWAY"] = "JUSTEATTAKEAWAY";
6355
+ EOrderSource2["GLOVO"] = "GLOVO";
6356
+ EOrderSource2["PYSZNE"] = "PYSZNE";
6357
+ EOrderSource2["WOLT"] = "WOLT";
6358
+ EOrderSource2["UBER"] = "UBER";
6359
+ EOrderSource2["BOLT"] = "BOLT";
6360
+ EOrderSource2["TAZZ"] = "TAZZ";
6361
+ EOrderSource2["POS"] = "POS";
6362
+ EOrderSource2["UPMENU"] = "UPMENU";
6363
+ })(EOrderSource || (EOrderSource = {}));
6364
+ var EChannelName;
6365
+ (function(EChannelName2) {
6366
+ EChannelName2["DINE_IN"] = "DINE_IN";
6367
+ EChannelName2["TAKE_AWAY"] = "TAKE_AWAY";
6368
+ EChannelName2["DELIVERY"] = "DELIVERY";
6369
+ EChannelName2["GLOVO"] = "GLOVO";
6370
+ EChannelName2["JUSTEAT"] = "JUSTEAT";
6371
+ EChannelName2["UBER"] = "UBER";
6372
+ EChannelName2["BOLT"] = "BOLT";
6373
+ EChannelName2["WOLT"] = "WOLT";
6374
+ EChannelName2["TAZZ"] = "TAZZ";
6375
+ EChannelName2["UPMENU"] = "UPMENU";
6376
+ })(EChannelName || (EChannelName = {}));
6377
+ var EOrderStatus;
6378
+ (function(EOrderStatus2) {
6379
+ EOrderStatus2["NEW"] = "NEW";
6380
+ EOrderStatus2["COMPLETED"] = "COMPLETED";
6381
+ EOrderStatus2["VERIFIED"] = "VERIFIED";
6382
+ EOrderStatus2["DELIVER"] = "DELIVER";
6383
+ EOrderStatus2["DELIVERED"] = "DELIVERED";
6384
+ EOrderStatus2["CLOSED"] = "CLOSED";
6385
+ EOrderStatus2["ABANDONED"] = "ABANDONED";
6386
+ EOrderStatus2["CANCELLED"] = "CANCELLED";
6387
+ EOrderStatus2["PICKED"] = "PICKED";
6388
+ })(EOrderStatus || (EOrderStatus = {}));
6389
+ var EOrderPaymentType;
6390
+ (function(EOrderPaymentType2) {
6391
+ EOrderPaymentType2["CASH"] = "CASH";
6392
+ EOrderPaymentType2["CARD"] = "CARD";
6393
+ EOrderPaymentType2["COD"] = "COD";
6394
+ EOrderPaymentType2["TERMINAL"] = "TERMINAL";
6395
+ EOrderPaymentType2["EPAYMENT"] = "EPAYMENT";
6396
+ EOrderPaymentType2["COUPON"] = "COUPON";
6397
+ EOrderPaymentType2["WALLET"] = "WALLET";
6398
+ EOrderPaymentType2["PREAUTHORIZED"] = "PREAUTHORIZED";
6399
+ EOrderPaymentType2["RETURN"] = "RETURN";
6400
+ EOrderPaymentType2["EXTERNAL"] = "EXTERNAL";
6401
+ })(EOrderPaymentType || (EOrderPaymentType = {}));
6402
+ var ERbiOrderExtra;
6403
+ (function(ERbiOrderExtra2) {
6404
+ ERbiOrderExtra2["POINTS_TOTAL"] = "x-rbi-loyalty-points";
6405
+ ERbiOrderExtra2["POINTS_EARNED"] = "x-rbi-points-earned";
6406
+ ERbiOrderExtra2["REWARDS"] = "x-rbi-rewards";
6407
+ ERbiOrderExtra2["OFFERS"] = "x-rbi-offers";
6408
+ ERbiOrderExtra2["CUSTOMER_NAME"] = "x-customer-name";
6409
+ })(ERbiOrderExtra || (ERbiOrderExtra = {}));
6410
+ var EOrderLineStatus;
6411
+ (function(EOrderLineStatus2) {
6412
+ EOrderLineStatus2["NEW"] = "NEW";
6413
+ EOrderLineStatus2["TECHNICAL"] = "TECHNICAL";
6414
+ EOrderLineStatus2["CONFIRMED"] = "CONFIRMED";
6415
+ EOrderLineStatus2["PROCESSING"] = "PROCESSING";
6416
+ EOrderLineStatus2["PROCESSED"] = "PROCESSED";
6417
+ EOrderLineStatus2["VOID"] = "VOID";
6418
+ EOrderLineStatus2["WASTE"] = "WASTE";
6419
+ })(EOrderLineStatus || (EOrderLineStatus = {}));
6420
+ var EOrderProductKind;
6421
+ (function(EOrderProductKind2) {
6422
+ EOrderProductKind2["GROUP"] = "group";
6423
+ EOrderProductKind2["PRODUCT"] = "product";
6424
+ })(EOrderProductKind || (EOrderProductKind = {}));
6425
+ var ENotificationType;
6426
+ (function(ENotificationType2) {
6427
+ ENotificationType2["ORDER_EVENT_ERROR"] = "OrderEventError";
6428
+ ENotificationType2["ORDER_APPLIED_EVENTS"] = "OrderAppliedEvents";
6429
+ ENotificationType2["ORDER_EVENT_FISCAL"] = "OrderEventFiscal";
6430
+ ENotificationType2["ORDER_UPSELL"] = "OrderUpsell";
6431
+ })(ENotificationType || (ENotificationType = {}));
6278
6432
  const isApiBooleanTrue = (value) => {
6279
6433
  if (value === "true" || value === true) {
6280
6434
  return true;
@@ -6302,6 +6456,25 @@ const isVisible = (item) => {
6302
6456
  const isHidden = ((_a = item == null ? void 0 : item.attrs) == null ? void 0 : _a.hidden) === true || ((_b = item == null ? void 0 : item["_"]) == null ? void 0 : _b.hidden) === "true";
6303
6457
  return !isHidden;
6304
6458
  };
6459
+ function findGroupInProductItemsBySelCtx(selCtx, parent) {
6460
+ var _a;
6461
+ if (!parent.items) {
6462
+ return null;
6463
+ }
6464
+ for (let i2 = 0; i2 < ((_a = parent.items) == null ? void 0 : _a.length); i2++) {
6465
+ const prod = parent.items[i2];
6466
+ if (prod.selCtx === selCtx && prod.kind === EProductKind.OPTIONS) {
6467
+ return prod;
6468
+ }
6469
+ if (prod.items && prod.items.length > 0) {
6470
+ const found = findGroupInProductItemsBySelCtx(selCtx, prod);
6471
+ if (found) {
6472
+ return found;
6473
+ }
6474
+ }
6475
+ }
6476
+ return null;
6477
+ }
6305
6478
  function createStore(createState) {
6306
6479
  let state;
6307
6480
  const listeners = /* @__PURE__ */ new Set();
@@ -6697,164 +6870,10 @@ function useProductConfigurator(product) {
6697
6870
  decreaseProductQuantity
6698
6871
  };
6699
6872
  }
6700
- var EPaymentStatus;
6701
- (function(EPaymentStatus2) {
6702
- EPaymentStatus2["UNINITIALIZED"] = "UNINITIALIZED";
6703
- EPaymentStatus2["PROCESSING"] = "PROCESSING";
6704
- EPaymentStatus2["PAID"] = "PAID";
6705
- EPaymentStatus2["FAILED"] = "FAILED";
6706
- EPaymentStatus2["PRINTING_RECEIPT"] = "PRINTING_RECEIPT";
6707
- EPaymentStatus2["PRINTING_RECEIPT_SUCCESS"] = "PRINTING_RECEIPT_SUCCESS";
6708
- EPaymentStatus2["SENDING_RECEIPT"] = "SENDING_RECEIPT";
6709
- EPaymentStatus2["SENDING_RECEIPT_SUCCESS"] = "SENDING_RECEIPT_SUCCESS";
6710
- EPaymentStatus2["ERROR"] = "ERROR";
6711
- })(EPaymentStatus || (EPaymentStatus = {}));
6712
- var ECouponViewType;
6713
- (function(ECouponViewType2) {
6714
- ECouponViewType2["CAROUSEL"] = "carousel";
6715
- ECouponViewType2["NORMAL"] = "normal";
6716
- ECouponViewType2["IMAGE"] = "image";
6717
- })(ECouponViewType || (ECouponViewType = {}));
6718
- var EProductKind;
6719
- (function(EProductKind2) {
6720
- EProductKind2["GROUP"] = "3e/group";
6721
- EProductKind2["PRODUCT"] = "3e/product";
6722
- EProductKind2["CATEGORY"] = "3e/group/category";
6723
- EProductKind2["OPTIONS"] = "3e/group/options";
6724
- EProductKind2["CONFIG"] = "3e/group/config";
6725
- EProductKind2["STATIC"] = "3e/static";
6726
- EProductKind2["REF"] = "3e/ref";
6727
- EProductKind2["QUERY"] = "3e/query";
6728
- EProductKind2["CMS"] = "3e/cms";
6729
- })(EProductKind || (EProductKind = {}));
6730
- var EProductKindBucket;
6731
- (function(EProductKindBucket2) {
6732
- EProductKindBucket2["GROUP"] = "group";
6733
- EProductKindBucket2["PRODUCT"] = "product";
6734
- })(EProductKindBucket || (EProductKindBucket = {}));
6735
- var EOrderUserRole;
6736
- (function(EOrderUserRole2) {
6737
- EOrderUserRole2["CREATOR"] = "CREATOR";
6738
- EOrderUserRole2["CUSTOMER"] = "CUSTOMER";
6739
- EOrderUserRole2["COUPONS"] = "COUPON";
6740
- EOrderUserRole2["KIOSK"] = "KIOSK";
6741
- EOrderUserRole2["WAITER"] = "WAITER";
6742
- EOrderUserRole2["MANAGER"] = "MANAGER";
6743
- EOrderUserRole2["VIEWER"] = "VIEWER";
6744
- EOrderUserRole2["DRIVER"] = "DRIVER";
6745
- EOrderUserRole2["STAFF"] = "STAFF";
6746
- })(EOrderUserRole || (EOrderUserRole = {}));
6747
- var EOrderType;
6748
- (function(EOrderType2) {
6749
- EOrderType2["TAKE_AWAY"] = "TAKE_AWAY";
6750
- EOrderType2["DELIVERY"] = "DELIVERY";
6751
- EOrderType2["DINE_IN"] = "DINE_IN";
6752
- EOrderType2["DINE_IN_OPEN"] = "DINE_IN_OPEN";
6753
- EOrderType2["GLOVO_DELIVERY"] = "GLOVO_DELIVERY";
6754
- EOrderType2["GLOVO_TAKE_AWAY"] = "GLOVO_TAKE_AWAY";
6755
- EOrderType2["JUSTEAT_DELIVERY"] = "JUSTEAT_DELIVERY";
6756
- EOrderType2["JUSTEAT_TAKE_AWAY"] = "JUSTEAT_TAKE_AWAY";
6757
- EOrderType2["UBER_DELIVERY"] = "UBER_DELIVERY";
6758
- EOrderType2["UBER_TAKE_AWAY"] = "UBER_TAKE_AWAY";
6759
- EOrderType2["UBER_DINE_IN"] = "UBER_DINE_IN";
6760
- EOrderType2["WOLT_DELIVERY"] = "WOLT_DELIVERY";
6761
- EOrderType2["WOLT_TAKE_AWAY"] = "WOLT_TAKE_AWAY";
6762
- EOrderType2["WOLT_DINE_IN"] = "WOLT_DINE_IN";
6763
- EOrderType2["BOLT_DELIVERY"] = "BOLT_DELIVERY";
6764
- EOrderType2["BOLT_TAKE_AWAY"] = "BOLT_TAKE_AWAY";
6765
- EOrderType2["BOLT_DINE_IN"] = "BOLT_DINE_IN";
6766
- EOrderType2["TAZZ_DELIVERY"] = "TAZZ_DELIVERY";
6767
- EOrderType2["TAZZ_TAKE_AWAY"] = "TAZZ_TAKE_AWAY";
6768
- EOrderType2["UPMENU_DELIVERY"] = "UPMENU_DELIVERY";
6769
- EOrderType2["UPMENU_TAKE_AWAY"] = "UPMENU_TAKE_AWAY";
6770
- EOrderType2["UPMENU_DINE_IN"] = "UPMENU_DINE_IN";
6771
- })(EOrderType || (EOrderType = {}));
6772
- var EOrderSource;
6773
- (function(EOrderSource2) {
6774
- EOrderSource2["KIOSK"] = "KIOSK";
6775
- EOrderSource2["WEB"] = "WEB";
6776
- EOrderSource2["JUST_EAT_TAKE_AWAY"] = "JUSTEATTAKEAWAY";
6777
- EOrderSource2["GLOVO"] = "GLOVO";
6778
- EOrderSource2["PYSZNE"] = "PYSZNE";
6779
- EOrderSource2["WOLT"] = "WOLT";
6780
- EOrderSource2["UBER"] = "UBER";
6781
- EOrderSource2["BOLT"] = "BOLT";
6782
- EOrderSource2["TAZZ"] = "TAZZ";
6783
- EOrderSource2["POS"] = "POS";
6784
- EOrderSource2["UPMENU"] = "UPMENU";
6785
- })(EOrderSource || (EOrderSource = {}));
6786
- var EChannelName;
6787
- (function(EChannelName2) {
6788
- EChannelName2["DINE_IN"] = "DINE_IN";
6789
- EChannelName2["TAKE_AWAY"] = "TAKE_AWAY";
6790
- EChannelName2["DELIVERY"] = "DELIVERY";
6791
- EChannelName2["GLOVO"] = "GLOVO";
6792
- EChannelName2["JUSTEAT"] = "JUSTEAT";
6793
- EChannelName2["UBER"] = "UBER";
6794
- EChannelName2["BOLT"] = "BOLT";
6795
- EChannelName2["WOLT"] = "WOLT";
6796
- EChannelName2["TAZZ"] = "TAZZ";
6797
- EChannelName2["UPMENU"] = "UPMENU";
6798
- })(EChannelName || (EChannelName = {}));
6799
- var EOrderStatus;
6800
- (function(EOrderStatus2) {
6801
- EOrderStatus2["NEW"] = "NEW";
6802
- EOrderStatus2["COMPLETED"] = "COMPLETED";
6803
- EOrderStatus2["VERIFIED"] = "VERIFIED";
6804
- EOrderStatus2["DELIVER"] = "DELIVER";
6805
- EOrderStatus2["DELIVERED"] = "DELIVERED";
6806
- EOrderStatus2["CLOSED"] = "CLOSED";
6807
- EOrderStatus2["ABANDONED"] = "ABANDONED";
6808
- EOrderStatus2["CANCELLED"] = "CANCELLED";
6809
- EOrderStatus2["PICKED"] = "PICKED";
6810
- })(EOrderStatus || (EOrderStatus = {}));
6811
- var EOrderPaymentType;
6812
- (function(EOrderPaymentType2) {
6813
- EOrderPaymentType2["CASH"] = "CASH";
6814
- EOrderPaymentType2["CARD"] = "CARD";
6815
- EOrderPaymentType2["COD"] = "COD";
6816
- EOrderPaymentType2["TERMINAL"] = "TERMINAL";
6817
- EOrderPaymentType2["EPAYMENT"] = "EPAYMENT";
6818
- EOrderPaymentType2["COUPON"] = "COUPON";
6819
- EOrderPaymentType2["WALLET"] = "WALLET";
6820
- EOrderPaymentType2["PREAUTHORIZED"] = "PREAUTHORIZED";
6821
- EOrderPaymentType2["RETURN"] = "RETURN";
6822
- EOrderPaymentType2["EXTERNAL"] = "EXTERNAL";
6823
- })(EOrderPaymentType || (EOrderPaymentType = {}));
6824
- var ERbiOrderExtra;
6825
- (function(ERbiOrderExtra2) {
6826
- ERbiOrderExtra2["POINTS_TOTAL"] = "x-rbi-loyalty-points";
6827
- ERbiOrderExtra2["POINTS_EARNED"] = "x-rbi-points-earned";
6828
- ERbiOrderExtra2["REWARDS"] = "x-rbi-rewards";
6829
- ERbiOrderExtra2["OFFERS"] = "x-rbi-offers";
6830
- ERbiOrderExtra2["CUSTOMER_NAME"] = "x-customer-name";
6831
- })(ERbiOrderExtra || (ERbiOrderExtra = {}));
6832
- var EOrderLineStatus;
6833
- (function(EOrderLineStatus2) {
6834
- EOrderLineStatus2["NEW"] = "NEW";
6835
- EOrderLineStatus2["TECHNICAL"] = "TECHNICAL";
6836
- EOrderLineStatus2["CONFIRMED"] = "CONFIRMED";
6837
- EOrderLineStatus2["PROCESSING"] = "PROCESSING";
6838
- EOrderLineStatus2["PROCESSED"] = "PROCESSED";
6839
- EOrderLineStatus2["VOID"] = "VOID";
6840
- EOrderLineStatus2["WASTE"] = "WASTE";
6841
- })(EOrderLineStatus || (EOrderLineStatus = {}));
6842
- var EOrderProductKind;
6843
- (function(EOrderProductKind2) {
6844
- EOrderProductKind2["GROUP"] = "group";
6845
- EOrderProductKind2["PRODUCT"] = "product";
6846
- })(EOrderProductKind || (EOrderProductKind = {}));
6847
- var ENotificationType;
6848
- (function(ENotificationType2) {
6849
- ENotificationType2["ORDER_EVENT_ERROR"] = "OrderEventError";
6850
- ENotificationType2["ORDER_APPLIED_EVENTS"] = "OrderAppliedEvents";
6851
- ENotificationType2["ORDER_EVENT_FISCAL"] = "OrderEventFiscal";
6852
- ENotificationType2["ORDER_UPSELL"] = "OrderUpsell";
6853
- })(ENotificationType || (ENotificationType = {}));
6854
6873
  const validateProductFilter = (product, stateFilter) => {
6855
6874
  var _a;
6856
6875
  const { filter: productFilters = {}, fltCtx = "" } = product;
6857
- const stateFiltersWithFltCtx = stateFilter[fltCtx];
6876
+ const stateFiltersWithFltCtx = (stateFilter == null ? void 0 : stateFilter[fltCtx]) || {};
6858
6877
  if (!productFilters || !Object.keys(productFilters).length || !stateFiltersWithFltCtx) {
6859
6878
  return true;
6860
6879
  }
@@ -6895,12 +6914,14 @@ const getProductToChangeInForm = (product, isFilterValidated) => {
6895
6914
  return { productsToSelect, productsToUnselect };
6896
6915
  };
6897
6916
  const unselectProductsInForm = (productsToUnselect, setValueInForm) => {
6917
+ console.log("LOG1 productsToUnselect", productsToUnselect);
6898
6918
  productsToUnselect.map(({ selCtx, id }) => {
6899
6919
  setValueInForm(`selected.${selCtx}.${id}`, false);
6900
6920
  });
6901
6921
  };
6902
- const selectProductsInForm = (productToUnselect, setValueInForm, initialSelectedState) => {
6903
- productToUnselect.map(({ selCtx, id }) => {
6922
+ const selectProductsInForm = (productToSelect, setValueInForm, initialSelectedState) => {
6923
+ console.log("LOG1 productToSelect", productToSelect);
6924
+ productToSelect.map(({ selCtx, id }) => {
6904
6925
  var _a;
6905
6926
  const productInInitialState = (_a = initialSelectedState[selCtx]) == null ? void 0 : _a[id];
6906
6927
  if (productInInitialState) {
@@ -6913,7 +6934,6 @@ const selectProductsInForm = (productToUnselect, setValueInForm, initialSelected
6913
6934
  };
6914
6935
  function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
6915
6936
  const { selCtx, attrs = {} } = product;
6916
- const stateFilter = useStore((state) => state.filter);
6917
6937
  const initialSelected = useStore((state) => state.initialSelected);
6918
6938
  const currency = useStore((state) => state.currency);
6919
6939
  const { setValue, getValues } = useFormContext();
@@ -6941,9 +6961,8 @@ function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
6941
6961
  product,
6942
6962
  isFilterValidated
6943
6963
  );
6944
- unselectProductsInForm(productsToUnselect, setValue);
6945
6964
  selectProductsInForm(productsToSelect, setValue, initialSelected);
6946
- }, [stateFilter]);
6965
+ }, [isFilterValidated]);
6947
6966
  return {
6948
6967
  isFilterValidated,
6949
6968
  selected,
@@ -8936,20 +8955,20 @@ const selectUnselectProduct = (setValue, getValues, product, isChecked, unregist
8936
8955
  });
8937
8956
  };
8938
8957
  checkSubProducts(items);
8939
- (_a = Object.keys(emit)) == null ? void 0 : _a.forEach((x2) => {
8940
- const formPath = `filterWithCnt.${fltCtx}.${x2}.${emit[x2]}`;
8941
- const cnt = getValues(formPath) || 0;
8942
- if (cnt < 2) {
8943
- unregister(formPath);
8944
- } else {
8945
- setValue(formPath, cnt - 1);
8946
- }
8947
- });
8948
8958
  if (nestedLvl && nestedLvl < 2 && !isEmpty(emit)) {
8959
+ (_a = Object.keys(emit)) == null ? void 0 : _a.forEach((x2) => {
8960
+ const formPath = `filterWithCnt.${fltCtx}.${x2}.${emit[x2]}`;
8961
+ const cnt = getValues(formPath) || 0;
8962
+ if (cnt < 2) {
8963
+ unregister(formPath);
8964
+ } else {
8965
+ setValue(formPath, cnt - 1);
8966
+ }
8967
+ });
8949
8968
  const groupsPath = `filterWithCnt.${fltCtx}`;
8950
8969
  const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
8951
8970
  const fltCtxPath = `filter.${fltCtx}`;
8952
- (_b = Object.keys(product.emit)) == null ? void 0 : _b.forEach((emitKey) => {
8971
+ (_b = Object.keys(emit)) == null ? void 0 : _b.forEach((emitKey) => {
8953
8972
  var _a2, _b2, _c;
8954
8973
  const groupValue = getValues(`${groupCntPath}.${emitKey}`) || 0;
8955
8974
  if (groupValue) {
@@ -11025,7 +11044,6 @@ function ProductConfigurator(props) {
11025
11044
  encodedProduct,
11026
11045
  initSelected,
11027
11046
  initFilter,
11028
- filter,
11029
11047
  productQuantity,
11030
11048
  setIsOnSubmittedOnTrue,
11031
11049
  getInvalidSelCtxArray,
@@ -11049,8 +11067,7 @@ function ProductConfigurator(props) {
11049
11067
  });
11050
11068
  const methods = useForm({
11051
11069
  defaultValues: {
11052
- selected: initSelected,
11053
- filter: initFilter
11070
+ selected: initSelected
11054
11071
  }
11055
11072
  });
11056
11073
  const {
@@ -11058,6 +11075,7 @@ function ProductConfigurator(props) {
11058
11075
  } = methods;
11059
11076
  const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected"), encodedProduct)).toFixed(2));
11060
11077
  const onSubmit = () => {
11078
+ var _a;
11061
11079
  console.log("onSubmit");
11062
11080
  setIsOnSubmittedOnTrue();
11063
11081
  const invalidContextNames = getInvalidSelCtxArray();
@@ -11069,6 +11087,16 @@ function ProductConfigurator(props) {
11069
11087
  } else {
11070
11088
  console.log("selected", getValues("selected"));
11071
11089
  const decodedCleanedSelected = decodeSelected(cleanSelected(getValues("selected")));
11090
+ const filter = getValues("filter");
11091
+ (_a = Object.keys(decodedCleanedSelected || {})) == null ? void 0 : _a.forEach((x2) => {
11092
+ const group = findGroupInProductItemsBySelCtx(x2, product);
11093
+ if (group) {
11094
+ const isFilterValidated = validateProductFilter(group, filter);
11095
+ if (!isFilterValidated) {
11096
+ delete decodedCleanedSelected[x2];
11097
+ }
11098
+ }
11099
+ });
11072
11100
  console.log("decodedCleanedSelected: ", decodedCleanedSelected);
11073
11101
  handleAddToCart({
11074
11102
  price: countedProductPrice,
@@ -11110,5 +11138,5 @@ function ProductConfigurator(props) {
11110
11138
  })
11111
11139
  });
11112
11140
  }
11113
- export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, getProductToChangeInForm, index_esm as hookForm, selectProductsInForm, unselectProductsInForm, useProductData, validateProductFilter };
11141
+ export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, getProductToChangeInForm, index_esm as hookForm, selectProductsInForm, unselectProductsInForm, useMenuOptions, useProductData, validateProductFilter };
11114
11142
  //# sourceMappingURL=index.es.js.map