@orderingstack/front-components-product-configurator 1.4.2-beta.7 → 1.5.1-beta.1
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/components/DisplayState/DisplayState.d.ts.map +1 -1
- package/dist/components/MenuOptions/useMenuOptions.d.ts.map +1 -1
- package/dist/components/MenuProduct/MenuProduct.d.ts.map +1 -1
- package/dist/components/MenuProduct/useMenuProduct.d.ts +1 -2
- package/dist/components/MenuProduct/useMenuProduct.d.ts.map +1 -1
- package/dist/components/MenuProductRoot/MenuProductRoot.d.ts.map +1 -1
- package/dist/components/ProductConfigurator/ProductConfigurator.d.ts.map +1 -1
- package/dist/components/ProductConfigurator/useProductConfigurator.d.ts +1 -1
- package/dist/components/ProductConfigurator/useProductConfigurator.d.ts.map +1 -1
- package/dist/context/GroupsValidation.d.ts +15 -0
- package/dist/context/GroupsValidation.d.ts.map +1 -0
- package/dist/hooks/useEmitFilter.d.ts +1 -1
- package/dist/hooks/useEmitFilter.d.ts.map +1 -1
- package/dist/index.cjs.js +6 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +508 -228
- package/dist/index.es.js.map +1 -1
- package/dist/state/validate.d.ts.map +1 -1
- package/dist/utils/filter.d.ts +1 -1
- package/dist/utils/filter.d.ts.map +1 -1
- package/dist/utils/groupsValidation.d.ts +4 -0
- package/dist/utils/groupsValidation.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/setSelected.d.ts +3 -1
- package/dist/utils/setSelected.d.ts.map +1 -1
- package/package.json +3 -2
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();
|
|
@@ -6650,7 +6823,9 @@ function getValidSelectedState(product, selected) {
|
|
|
6650
6823
|
}
|
|
6651
6824
|
function useProductConfigurator(product) {
|
|
6652
6825
|
var _a;
|
|
6653
|
-
const [productQuantity, setProductQuantity] = useState(
|
|
6826
|
+
const [productQuantity, setProductQuantity] = useState(
|
|
6827
|
+
Number(product.quantity) || 1
|
|
6828
|
+
);
|
|
6654
6829
|
const encodedProduct = encodeProduct(product);
|
|
6655
6830
|
const { state: { filter: initFilter = {} } = {} } = encodedProduct;
|
|
6656
6831
|
const initSelected = getValidSelectedState(
|
|
@@ -6666,9 +6841,8 @@ function useProductConfigurator(product) {
|
|
|
6666
6841
|
const setIsOnSubmittedOnTrue = useStore(
|
|
6667
6842
|
(state) => state.setIsOnSubmittedOnTrue
|
|
6668
6843
|
);
|
|
6669
|
-
useStore((state) => state.refreshFormDt);
|
|
6844
|
+
const refreshFormDt = useStore((state) => state.refreshFormDt);
|
|
6670
6845
|
const getInvalidSelCtxArray = useStore((state) => state.getInvalidSelCtxArray);
|
|
6671
|
-
const getValidationMap = useStore((state) => state.getValidationMap);
|
|
6672
6846
|
const increaseProductQuantity = () => {
|
|
6673
6847
|
setProductQuantity((productQuantity2) => productQuantity2 + 1);
|
|
6674
6848
|
};
|
|
@@ -6692,176 +6866,22 @@ function useProductConfigurator(product) {
|
|
|
6692
6866
|
setIsOnSubmittedOnTrue,
|
|
6693
6867
|
getInvalidSelCtxArray,
|
|
6694
6868
|
productQuantity,
|
|
6695
|
-
getValidationMap,
|
|
6696
6869
|
increaseProductQuantity,
|
|
6697
|
-
decreaseProductQuantity
|
|
6870
|
+
decreaseProductQuantity,
|
|
6871
|
+
refreshFormDt
|
|
6698
6872
|
};
|
|
6699
6873
|
}
|
|
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
6874
|
const validateProductFilter = (product, stateFilter) => {
|
|
6855
6875
|
var _a;
|
|
6856
6876
|
const { filter: productFilters = {}, fltCtx = "" } = product;
|
|
6857
|
-
const stateFiltersWithFltCtx = stateFilter[fltCtx];
|
|
6877
|
+
const stateFiltersWithFltCtx = (stateFilter == null ? void 0 : stateFilter[fltCtx]) || {};
|
|
6858
6878
|
if (!productFilters || !Object.keys(productFilters).length || !stateFiltersWithFltCtx) {
|
|
6859
6879
|
return true;
|
|
6860
6880
|
}
|
|
6861
6881
|
const commonFilters = (_a = Object.keys(stateFiltersWithFltCtx)) == null ? void 0 : _a.filter(
|
|
6862
6882
|
(filterName) => {
|
|
6863
6883
|
var _a2;
|
|
6864
|
-
const matchingFilters = (_a2 = Object.keys(productFilters == null ? void 0 : productFilters[filterName])) == null ? void 0 : _a2.filter((x2) => {
|
|
6884
|
+
const matchingFilters = (_a2 = Object.keys((productFilters == null ? void 0 : productFilters[filterName]) || {})) == null ? void 0 : _a2.filter((x2) => {
|
|
6865
6885
|
var _a3;
|
|
6866
6886
|
if (((_a3 = productFilters == null ? void 0 : productFilters[filterName]) == null ? void 0 : _a3[x2]) === (stateFiltersWithFltCtx == null ? void 0 : stateFiltersWithFltCtx[filterName])) {
|
|
6867
6887
|
return true;
|
|
@@ -6895,12 +6915,14 @@ const getProductToChangeInForm = (product, isFilterValidated) => {
|
|
|
6895
6915
|
return { productsToSelect, productsToUnselect };
|
|
6896
6916
|
};
|
|
6897
6917
|
const unselectProductsInForm = (productsToUnselect, setValueInForm) => {
|
|
6918
|
+
console.log("LOG1 productsToUnselect", productsToUnselect);
|
|
6898
6919
|
productsToUnselect.map(({ selCtx, id }) => {
|
|
6899
6920
|
setValueInForm(`selected.${selCtx}.${id}`, false);
|
|
6900
6921
|
});
|
|
6901
6922
|
};
|
|
6902
|
-
const selectProductsInForm = (
|
|
6903
|
-
|
|
6923
|
+
const selectProductsInForm = (productToSelect, setValueInForm, initialSelectedState) => {
|
|
6924
|
+
console.log("LOG1 productToSelect", productToSelect);
|
|
6925
|
+
productToSelect.map(({ selCtx, id }) => {
|
|
6904
6926
|
var _a;
|
|
6905
6927
|
const productInInitialState = (_a = initialSelectedState[selCtx]) == null ? void 0 : _a[id];
|
|
6906
6928
|
if (productInInitialState) {
|
|
@@ -6913,12 +6935,11 @@ const selectProductsInForm = (productToUnselect, setValueInForm, initialSelected
|
|
|
6913
6935
|
};
|
|
6914
6936
|
function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
|
|
6915
6937
|
const { selCtx, attrs = {} } = product;
|
|
6916
|
-
const stateFilter = useStore((state) => state.filter);
|
|
6917
6938
|
const initialSelected = useStore((state) => state.initialSelected);
|
|
6918
6939
|
const currency = useStore((state) => state.currency);
|
|
6919
6940
|
const { setValue, getValues } = useFormContext();
|
|
6920
|
-
const { selected = {} } = getValues();
|
|
6921
|
-
const isFilterValidated = validateProductFilter(product,
|
|
6941
|
+
const { selected = {}, filter = {} } = getValues();
|
|
6942
|
+
const isFilterValidated = validateProductFilter(product, filter);
|
|
6922
6943
|
const isOnSubmitted = useStore((state) => state.isOnSubmitted);
|
|
6923
6944
|
const setValidationMap = useStore((state) => state.setValidationMap);
|
|
6924
6945
|
const [selCnt, qtyCnt] = getSelCtxCntFromSelectedState(
|
|
@@ -6941,9 +6962,8 @@ function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
|
|
|
6941
6962
|
product,
|
|
6942
6963
|
isFilterValidated
|
|
6943
6964
|
);
|
|
6944
|
-
unselectProductsInForm(productsToUnselect, setValue);
|
|
6945
6965
|
selectProductsInForm(productsToSelect, setValue, initialSelected);
|
|
6946
|
-
}, [
|
|
6966
|
+
}, [isFilterValidated]);
|
|
6947
6967
|
return {
|
|
6948
6968
|
isFilterValidated,
|
|
6949
6969
|
selected,
|
|
@@ -8804,15 +8824,63 @@ function Counter(props) {
|
|
|
8804
8824
|
})]
|
|
8805
8825
|
});
|
|
8806
8826
|
}
|
|
8807
|
-
function useEmitFilter(product) {
|
|
8808
|
-
const { watch, setValue } = useFormContext();
|
|
8809
|
-
const setFilter = useStore((state) => state.setFilter);
|
|
8827
|
+
function useEmitFilter(product, isRadio, nestedLvl) {
|
|
8828
|
+
const { watch, setValue, getValues, unregister } = useFormContext();
|
|
8810
8829
|
const { id, selCtx, emit = {}, fltCtx } = product;
|
|
8811
8830
|
const value = watch(`selected.${selCtx}.${id}`);
|
|
8812
8831
|
useEffect(() => {
|
|
8832
|
+
var _a, _b, _c;
|
|
8833
|
+
if (!nestedLvl || nestedLvl > 1) {
|
|
8834
|
+
return;
|
|
8835
|
+
}
|
|
8836
|
+
const groupsPath = `filterWithCnt.${fltCtx}`;
|
|
8837
|
+
const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
|
|
8838
|
+
const fltCtxPath = `filter.${fltCtx}`;
|
|
8839
|
+
if (isRadio && value && fltCtx) {
|
|
8840
|
+
if (isEmpty(emit)) {
|
|
8841
|
+
const groupValues = getValues(groupCntPath);
|
|
8842
|
+
(_a = Object.keys(groupValues || {})) == null ? void 0 : _a.forEach((x2) => {
|
|
8843
|
+
unregister(`${groupCntPath}.${x2}`);
|
|
8844
|
+
const groupsKeys = Object.keys(getValues(groupsPath) || {});
|
|
8845
|
+
if (isEmpty(groupsKeys)) {
|
|
8846
|
+
unregister(`${fltCtxPath}.${x2}`);
|
|
8847
|
+
} else {
|
|
8848
|
+
groupsKeys.forEach((groupSelCtx) => {
|
|
8849
|
+
if (groupSelCtx !== selCtx && !getValues(`${groupsPath}.${groupSelCtx}.${x2}`)) {
|
|
8850
|
+
unregister(`${fltCtxPath}.${x2}`);
|
|
8851
|
+
}
|
|
8852
|
+
});
|
|
8853
|
+
}
|
|
8854
|
+
});
|
|
8855
|
+
return;
|
|
8856
|
+
} else {
|
|
8857
|
+
const productGroupCntKeys = getValues(groupCntPath);
|
|
8858
|
+
const groupsCntKeys = getValues(groupsPath);
|
|
8859
|
+
(_b = Object.keys(emit)) == null ? void 0 : _b.forEach((x2) => {
|
|
8860
|
+
var _a2;
|
|
8861
|
+
(_a2 = Object.keys(productGroupCntKeys || {})) == null ? void 0 : _a2.forEach((productGroupCntKey) => {
|
|
8862
|
+
if (!emit[productGroupCntKey]) {
|
|
8863
|
+
unregister(`${fltCtxPath}.${productGroupCntKey}`);
|
|
8864
|
+
unregister(`${groupCntPath}.${productGroupCntKey}`);
|
|
8865
|
+
}
|
|
8866
|
+
});
|
|
8867
|
+
Object.keys(groupsCntKeys || {}).forEach((groupSelCtx) => {
|
|
8868
|
+
if (groupSelCtx !== selCtx && x2 in getValues(groupsPath == null ? void 0 : groupsPath[groupSelCtx])) {
|
|
8869
|
+
unregister(`${groupsPath}.${groupSelCtx}.${x2}`);
|
|
8870
|
+
}
|
|
8871
|
+
});
|
|
8872
|
+
setValue(`${fltCtxPath}.${x2}`, emit[x2]);
|
|
8873
|
+
setValue(`${groupCntPath}.${x2}`, { cnt: 1, value: emit[x2] });
|
|
8874
|
+
});
|
|
8875
|
+
return;
|
|
8876
|
+
}
|
|
8877
|
+
}
|
|
8813
8878
|
if (value && fltCtx && !isEmpty(emit)) {
|
|
8814
|
-
|
|
8815
|
-
|
|
8879
|
+
(_c = Object.keys(emit)) == null ? void 0 : _c.forEach((x2) => {
|
|
8880
|
+
setValue(`filter.${fltCtx}.${x2}`, emit[x2]);
|
|
8881
|
+
const groupKeyCnt = getValues(`${groupCntPath}.${x2}.cnt`) || 0;
|
|
8882
|
+
setValue(`${groupCntPath}.${x2}`, { cnt: groupKeyCnt + 1, value: emit[x2] });
|
|
8883
|
+
});
|
|
8816
8884
|
}
|
|
8817
8885
|
}, [value]);
|
|
8818
8886
|
return {};
|
|
@@ -8836,6 +8904,7 @@ const addProductToState = (selected, setValue) => {
|
|
|
8836
8904
|
};
|
|
8837
8905
|
const removeProductFromState = (selCtx, getValues, setValue) => {
|
|
8838
8906
|
const changedSelCtx = getValues(`selected.${selCtx}`);
|
|
8907
|
+
console.log("changedSelCtx", changedSelCtx);
|
|
8839
8908
|
setValue(
|
|
8840
8909
|
`selected.${selCtx}`,
|
|
8841
8910
|
Object.keys(changedSelCtx).reduce((acc, key) => {
|
|
@@ -8844,70 +8913,133 @@ const removeProductFromState = (selCtx, getValues, setValue) => {
|
|
|
8844
8913
|
}, {})
|
|
8845
8914
|
);
|
|
8846
8915
|
};
|
|
8847
|
-
const selectUnselectProduct = (setValue, getValues,
|
|
8916
|
+
const selectUnselectProduct = (setValue, getValues, product, isChecked, unregister, nestedLvl) => {
|
|
8917
|
+
var _a, _b;
|
|
8918
|
+
const { items, state, emit, fltCtx, selCtx } = product;
|
|
8848
8919
|
const { selected = {} } = state || {};
|
|
8920
|
+
console.log("selected/unselected product", product, isChecked);
|
|
8849
8921
|
if (isChecked) {
|
|
8850
8922
|
addProductToState(selected, setValue);
|
|
8851
8923
|
const checkSubProducts = (items2) => {
|
|
8852
|
-
var
|
|
8924
|
+
var _a2;
|
|
8853
8925
|
if (!Array.isArray(items2) || isEmpty(state == null ? void 0 : state.selected))
|
|
8854
8926
|
return;
|
|
8855
|
-
(
|
|
8856
|
-
var
|
|
8857
|
-
return !!((
|
|
8858
|
-
})) == null ? void 0 :
|
|
8859
|
-
if (
|
|
8927
|
+
(_a2 = items2 == null ? void 0 : items2.filter((x2) => {
|
|
8928
|
+
var _a3, _b2;
|
|
8929
|
+
return !!((_b2 = (_a3 = state.selected) == null ? void 0 : _a3[`${x2.selCtx}`]) == null ? void 0 : _b2[`${x2.id}`]);
|
|
8930
|
+
})) == null ? void 0 : _a2.map((product2) => {
|
|
8931
|
+
if (product2.state && "selected" in product2.state) {
|
|
8860
8932
|
const {
|
|
8861
8933
|
state: { selected: selected2 }
|
|
8862
|
-
} =
|
|
8934
|
+
} = product2;
|
|
8863
8935
|
addProductToState(selected2, setValue);
|
|
8864
8936
|
}
|
|
8865
|
-
if (Array.isArray(
|
|
8866
|
-
checkSubProducts(
|
|
8937
|
+
if (Array.isArray(product2.items)) {
|
|
8938
|
+
checkSubProducts(product2.items);
|
|
8867
8939
|
}
|
|
8868
8940
|
});
|
|
8869
8941
|
};
|
|
8870
8942
|
checkSubProducts(items);
|
|
8871
8943
|
} else {
|
|
8872
|
-
Object.keys(selected).forEach((
|
|
8873
|
-
removeProductFromState(
|
|
8944
|
+
Object.keys(selected).forEach((selCtx2) => {
|
|
8945
|
+
removeProductFromState(selCtx2, getValues, setValue);
|
|
8874
8946
|
});
|
|
8875
8947
|
const checkSubProducts = (items2) => {
|
|
8876
8948
|
if (!Array.isArray(items2))
|
|
8877
8949
|
return;
|
|
8878
|
-
items2.map((
|
|
8879
|
-
const { selCtx } =
|
|
8880
|
-
const changedSelCtx = getValues(`selected.${
|
|
8950
|
+
items2.map((product2) => {
|
|
8951
|
+
const { selCtx: selCtx2 } = product2;
|
|
8952
|
+
const changedSelCtx = getValues(`selected.${selCtx2}`);
|
|
8881
8953
|
if (changedSelCtx) {
|
|
8882
|
-
removeProductFromState(
|
|
8954
|
+
removeProductFromState(selCtx2, getValues, setValue);
|
|
8883
8955
|
}
|
|
8884
|
-
checkSubProducts(
|
|
8956
|
+
checkSubProducts(product2.items);
|
|
8885
8957
|
});
|
|
8886
8958
|
};
|
|
8887
8959
|
checkSubProducts(items);
|
|
8960
|
+
if (nestedLvl && nestedLvl < 2 && !isEmpty(emit)) {
|
|
8961
|
+
(_a = Object.keys(emit)) == null ? void 0 : _a.forEach((x2) => {
|
|
8962
|
+
const formPath = `filterWithCnt.${fltCtx}.${x2}.${emit[x2]}`;
|
|
8963
|
+
const cnt = getValues(formPath) || 0;
|
|
8964
|
+
if (cnt < 2) {
|
|
8965
|
+
unregister(formPath);
|
|
8966
|
+
} else {
|
|
8967
|
+
setValue(formPath, cnt - 1);
|
|
8968
|
+
}
|
|
8969
|
+
});
|
|
8970
|
+
const groupsPath = `filterWithCnt.${fltCtx}`;
|
|
8971
|
+
const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
|
|
8972
|
+
const fltCtxPath = `filter.${fltCtx}`;
|
|
8973
|
+
(_b = Object.keys(emit)) == null ? void 0 : _b.forEach((emitKey) => {
|
|
8974
|
+
var _a2, _b2, _c;
|
|
8975
|
+
const groupValue = getValues(`${groupCntPath}.${emitKey}`) || 0;
|
|
8976
|
+
if (groupValue) {
|
|
8977
|
+
if (groupValue > 1) {
|
|
8978
|
+
setValue(`${groupCntPath}.${emitKey}`, groupValue - 1);
|
|
8979
|
+
} else {
|
|
8980
|
+
unregister(`${groupCntPath}.${emitKey}`);
|
|
8981
|
+
const groupKeysObj = getValues(groupsPath) || {};
|
|
8982
|
+
const otherGroupsCntKeys = (_a2 = Object.keys(groupKeysObj)) == null ? void 0 : _a2.filter((x2) => x2 !== selCtx);
|
|
8983
|
+
if (!otherGroupsCntKeys) {
|
|
8984
|
+
unregister(`${fltCtxPath}.${emitKey}`);
|
|
8985
|
+
} else {
|
|
8986
|
+
const sameKeyOtherGroup = otherGroupsCntKeys == null ? void 0 : otherGroupsCntKeys.find((groupSelCtx) => {
|
|
8987
|
+
var _a3;
|
|
8988
|
+
return !!((_a3 = groupKeysObj == null ? void 0 : groupKeysObj[`${groupSelCtx}`]) == null ? void 0 : _a3[`${emitKey}`]);
|
|
8989
|
+
});
|
|
8990
|
+
if (!sameKeyOtherGroup) {
|
|
8991
|
+
unregister(`${fltCtxPath}.${emitKey}`);
|
|
8992
|
+
} else {
|
|
8993
|
+
const newValue = (_c = (_b2 = groupKeysObj == null ? void 0 : groupKeysObj[`${sameKeyOtherGroup}`]) == null ? void 0 : _b2[`${emitKey}`]) == null ? void 0 : _c.value;
|
|
8994
|
+
setValue(`${fltCtxPath}.${emitKey}`, newValue);
|
|
8995
|
+
}
|
|
8996
|
+
}
|
|
8997
|
+
}
|
|
8998
|
+
}
|
|
8999
|
+
});
|
|
9000
|
+
}
|
|
9001
|
+
}
|
|
9002
|
+
};
|
|
9003
|
+
const findProductInParentProductBySelCtx = (parent, selCtx) => {
|
|
9004
|
+
var _a;
|
|
9005
|
+
if (!parent.items || isEmpty(parent.items)) {
|
|
9006
|
+
return null;
|
|
9007
|
+
}
|
|
9008
|
+
for (let i2 = 0; i2 < ((_a = parent.items) == null ? void 0 : _a.length); i2++) {
|
|
9009
|
+
const prod = parent.items[i2];
|
|
9010
|
+
if (prod.selCtx) {
|
|
9011
|
+
if (prod.selCtx === selCtx && prod.kind === EProductKind.PRODUCT) {
|
|
9012
|
+
return prod;
|
|
9013
|
+
}
|
|
9014
|
+
}
|
|
9015
|
+
if (prod.kind === EProductKind.OPTIONS && prod.items && prod.items.length > 0) {
|
|
9016
|
+
const found = findProductInParentProductBySelCtx(prod, selCtx);
|
|
9017
|
+
if (found) {
|
|
9018
|
+
return found;
|
|
9019
|
+
}
|
|
9020
|
+
}
|
|
8888
9021
|
}
|
|
9022
|
+
return null;
|
|
8889
9023
|
};
|
|
8890
|
-
function useMenuProduct(product, parentAttrs) {
|
|
9024
|
+
function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
8891
9025
|
var _a;
|
|
8892
|
-
const { id, selCtx } = product;
|
|
9026
|
+
const { id, selCtx, emit = {}, fltCtx } = product;
|
|
8893
9027
|
const {
|
|
8894
9028
|
allowMultiple: parentAllowMultiple,
|
|
8895
9029
|
selMin: parentSelMin,
|
|
8896
9030
|
selMax: parentSelMax
|
|
8897
9031
|
} = parentAttrs;
|
|
8898
|
-
useEmitFilter(product);
|
|
8899
9032
|
const { isInputEnabled: isInputEnabled2, isInputCounterIncrementEnabled: isInputCounterIncrementEnabled2 } = useValidate();
|
|
8900
9033
|
const refreshForm = useStore((state) => state.refreshForm);
|
|
8901
9034
|
const currency = useStore((state) => state.currency);
|
|
8902
|
-
const { watch, getValues, setValue, register } = useFormContext();
|
|
9035
|
+
const { watch, getValues, setValue, register, unregister } = useFormContext();
|
|
8903
9036
|
const value = watch(`selected.${selCtx}.${id}`);
|
|
8904
9037
|
const { selected = {} } = getValues();
|
|
8905
9038
|
const valueNumber = Number(value || 0);
|
|
8906
|
-
const stateFilter = useStore((state) => state.filter);
|
|
8907
9039
|
const isRadio = parentSelMin === "1" && parentSelMax === "1";
|
|
9040
|
+
useEmitFilter(product, isRadio, nestedLvl);
|
|
8908
9041
|
const isCheckbox = !isRadio;
|
|
8909
9042
|
const isCounter = isApiBooleanTrue(parentAllowMultiple);
|
|
8910
|
-
const isFilterValidated = validateProductFilter(product, stateFilter);
|
|
8911
9043
|
const isDecrementEnabled = valueNumber > (isRadio ? 1 : 0);
|
|
8912
9044
|
const isIncrementEnabled = isInputCounterIncrementEnabled2(product, selected) && (isInputEnabled2(product) || valueNumber);
|
|
8913
9045
|
const isChecked = Number(((_a = selected == null ? void 0 : selected[selCtx]) == null ? void 0 : _a[id]) || 0) > 0;
|
|
@@ -8919,13 +9051,38 @@ function useMenuProduct(product, parentAttrs) {
|
|
|
8919
9051
|
}
|
|
8920
9052
|
});
|
|
8921
9053
|
const handleCounterIncrementQty = () => {
|
|
9054
|
+
var _a2, _b;
|
|
8922
9055
|
setValue(`selected.${selCtx}.${id}`, `${valueNumber + 1}`);
|
|
9056
|
+
const importantSubProductsInState = (_b = (_a2 = Object.keys(selected)) == null ? void 0 : _a2.map((y2) => {
|
|
9057
|
+
var _a3;
|
|
9058
|
+
return { key: y2, subProductId: (_a3 = findProductInParentProductBySelCtx(product, y2)) == null ? void 0 : _a3.id };
|
|
9059
|
+
})) == null ? void 0 : _b.filter((x2) => !!x2.subProductId);
|
|
9060
|
+
importantSubProductsInState == null ? void 0 : importantSubProductsInState.forEach((x2) => {
|
|
9061
|
+
setValue(`selected.${x2.key}.${x2.subProductId}`, `${valueNumber + 1}`);
|
|
9062
|
+
});
|
|
8923
9063
|
};
|
|
8924
9064
|
const handleCounterDecrementQty = () => {
|
|
9065
|
+
var _a2, _b, _c, _d;
|
|
8925
9066
|
const decrementedValue = valueNumber - 1;
|
|
8926
9067
|
setValue(`selected.${selCtx}.${id}`, `${decrementedValue}`);
|
|
9068
|
+
const importantSubProductsInState = (_b = (_a2 = Object.keys(selected)) == null ? void 0 : _a2.map((y2) => {
|
|
9069
|
+
var _a3;
|
|
9070
|
+
return { key: y2, subProductId: (_a3 = findProductInParentProductBySelCtx(product, y2)) == null ? void 0 : _a3.id };
|
|
9071
|
+
})) == null ? void 0 : _b.filter((x2) => !!x2.subProductId);
|
|
9072
|
+
importantSubProductsInState == null ? void 0 : importantSubProductsInState.forEach((x2) => {
|
|
9073
|
+
setValue(`selected.${x2.key}.${x2.subProductId}`, `${decrementedValue}`);
|
|
9074
|
+
});
|
|
8927
9075
|
if (isCheckbox && decrementedValue === 0) {
|
|
8928
9076
|
setValue(`selected.${selCtx}.${id}`, false);
|
|
9077
|
+
(_c = Object.keys(emit)) == null ? void 0 : _c.forEach((x2) => {
|
|
9078
|
+
const formPath = `filterWithCnt.${fltCtx}.${x2}.${emit[x2]}`;
|
|
9079
|
+
const cnt = getValues(formPath) || 0;
|
|
9080
|
+
if (cnt < 2) {
|
|
9081
|
+
unregister(formPath);
|
|
9082
|
+
} else {
|
|
9083
|
+
setValue(formPath, cnt - 1);
|
|
9084
|
+
}
|
|
9085
|
+
});
|
|
8929
9086
|
const checkSubProducts = (items) => {
|
|
8930
9087
|
if (!Array.isArray(items))
|
|
8931
9088
|
return;
|
|
@@ -8939,15 +9096,55 @@ function useMenuProduct(product, parentAttrs) {
|
|
|
8939
9096
|
});
|
|
8940
9097
|
};
|
|
8941
9098
|
checkSubProducts(product.items);
|
|
9099
|
+
if (nestedLvl && nestedLvl < 2 && !isEmpty(emit)) {
|
|
9100
|
+
const groupsPath = `filterWithCnt.${fltCtx}`;
|
|
9101
|
+
const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
|
|
9102
|
+
const fltCtxPath = `filter.${fltCtx}`;
|
|
9103
|
+
(_d = Object.keys(emit)) == null ? void 0 : _d.forEach((emitKey) => {
|
|
9104
|
+
var _a3, _b2, _c2;
|
|
9105
|
+
const groupValue = getValues(`${groupCntPath}.${emitKey}`) || 0;
|
|
9106
|
+
if (groupValue) {
|
|
9107
|
+
if (groupValue > 1) {
|
|
9108
|
+
setValue(`${groupCntPath}.${emitKey}`, groupValue - 1);
|
|
9109
|
+
} else {
|
|
9110
|
+
unregister(`${groupCntPath}.${emitKey}`);
|
|
9111
|
+
const groupKeysObj = getValues(groupsPath) || {};
|
|
9112
|
+
const otherGroupsCntKeys = (_a3 = Object.keys(groupKeysObj)) == null ? void 0 : _a3.filter((x2) => x2 !== selCtx);
|
|
9113
|
+
if (!otherGroupsCntKeys) {
|
|
9114
|
+
unregister(`${fltCtxPath}.${emitKey}`);
|
|
9115
|
+
} else {
|
|
9116
|
+
const sameKeyOtherGroup = otherGroupsCntKeys == null ? void 0 : otherGroupsCntKeys.find((groupSelCtx) => {
|
|
9117
|
+
var _a4;
|
|
9118
|
+
return !!((_a4 = groupKeysObj == null ? void 0 : groupKeysObj[`${groupSelCtx}`]) == null ? void 0 : _a4[`${emitKey}`]);
|
|
9119
|
+
});
|
|
9120
|
+
if (!sameKeyOtherGroup) {
|
|
9121
|
+
unregister(`${fltCtxPath}.${emitKey}`);
|
|
9122
|
+
} else {
|
|
9123
|
+
const newValue = (_c2 = (_b2 = groupKeysObj == null ? void 0 : groupKeysObj[`${sameKeyOtherGroup}`]) == null ? void 0 : _b2[`${emitKey}`]) == null ? void 0 : _c2.value;
|
|
9124
|
+
setValue(`${fltCtxPath}.${emitKey}`, newValue);
|
|
9125
|
+
}
|
|
9126
|
+
}
|
|
9127
|
+
}
|
|
9128
|
+
}
|
|
9129
|
+
});
|
|
9130
|
+
}
|
|
8942
9131
|
}
|
|
8943
9132
|
};
|
|
8944
9133
|
const handleOnInputChange = (e2) => {
|
|
9134
|
+
var _a2;
|
|
8945
9135
|
const {
|
|
8946
9136
|
target: { checked, name: selCtx2, defaultValue: productId }
|
|
8947
9137
|
} = e2;
|
|
8948
|
-
selectUnselectProduct(setValue, getValues, product
|
|
9138
|
+
selectUnselectProduct(setValue, getValues, product, checked, unregister, nestedLvl);
|
|
8949
9139
|
if (isRadio) {
|
|
8950
9140
|
console.log("handleOnInputChange radio", selCtx2, productId);
|
|
9141
|
+
const otherGroupItems = (_a2 = parentPriduct == null ? void 0 : parentPriduct.items) == null ? void 0 : _a2.filter((x2) => x2.id !== product.id);
|
|
9142
|
+
for (const key of Object.keys(selected || {})) {
|
|
9143
|
+
const isItemToClear = (otherGroupItems == null ? void 0 : otherGroupItems.some((x2) => !!findProductInParentProductBySelCtx(x2, key))) ? key : false;
|
|
9144
|
+
if (isItemToClear) {
|
|
9145
|
+
setValue(`selected.${key}`, false);
|
|
9146
|
+
}
|
|
9147
|
+
}
|
|
8951
9148
|
const selectedContextName = "selected." + selCtx2.replace("radio.", "").split(".")[0];
|
|
8952
9149
|
setValue(selectedContextName, { [productId]: "1" });
|
|
8953
9150
|
refreshForm();
|
|
@@ -8968,8 +9165,7 @@ function useMenuProduct(product, parentAttrs) {
|
|
|
8968
9165
|
handleOnInputChange,
|
|
8969
9166
|
inputId: `${selCtx}.${id}`,
|
|
8970
9167
|
radioInputValue: id,
|
|
8971
|
-
currency
|
|
8972
|
-
isFilterValidated
|
|
9168
|
+
currency
|
|
8973
9169
|
};
|
|
8974
9170
|
}
|
|
8975
9171
|
const MenuProduct = (props) => {
|
|
@@ -8994,9 +9190,8 @@ const MenuProduct = (props) => {
|
|
|
8994
9190
|
counterValue,
|
|
8995
9191
|
handleCounterIncrementQty,
|
|
8996
9192
|
handleCounterDecrementQty,
|
|
8997
|
-
currency
|
|
8998
|
-
|
|
8999
|
-
} = useMenuProduct(product, parentAttrs);
|
|
9193
|
+
currency
|
|
9194
|
+
} = useMenuProduct(product, parentAttrs, nestedLvl, parentProduct);
|
|
9000
9195
|
const {
|
|
9001
9196
|
MenuProductUI
|
|
9002
9197
|
} = useComponents();
|
|
@@ -9017,8 +9212,7 @@ const MenuProduct = (props) => {
|
|
|
9017
9212
|
handleCounterIncrementQty,
|
|
9018
9213
|
handleCounterDecrementQty,
|
|
9019
9214
|
currency,
|
|
9020
|
-
parentProduct
|
|
9021
|
-
isFilterValidated
|
|
9215
|
+
parentProduct
|
|
9022
9216
|
};
|
|
9023
9217
|
const MenuItemsDispatcherWrapper = /* @__PURE__ */ jsx(MenuItemsDispatcher, {
|
|
9024
9218
|
productItems: product.items,
|
|
@@ -9234,11 +9428,13 @@ const DisplayState = () => {
|
|
|
9234
9428
|
} = useFormContext();
|
|
9235
9429
|
const selected = watch("selected");
|
|
9236
9430
|
const filter = watch("filter");
|
|
9431
|
+
const filterWithCnt = watch("filterWithCnt");
|
|
9237
9432
|
const validationMap = useStore((state) => state.validationMap);
|
|
9238
9433
|
console.log({
|
|
9239
9434
|
selected,
|
|
9240
9435
|
validationMap,
|
|
9241
|
-
filter
|
|
9436
|
+
filter,
|
|
9437
|
+
filterWithCnt
|
|
9242
9438
|
});
|
|
9243
9439
|
return /* @__PURE__ */ jsxs("div", {
|
|
9244
9440
|
className: "flex flex-col items-center py-4",
|
|
@@ -10833,6 +11029,81 @@ function MenuProductRootDefaultUI(props) {
|
|
|
10833
11029
|
})
|
|
10834
11030
|
});
|
|
10835
11031
|
}
|
|
11032
|
+
const getValidationMap2 = (product, selected = {}, filter, map, nestedLvl = 0) => {
|
|
11033
|
+
var _a, _b;
|
|
11034
|
+
const res = map || {};
|
|
11035
|
+
if (nestedLvl === 0 || ((_a = selected[product.selCtx]) == null ? void 0 : _a[product.id])) {
|
|
11036
|
+
(_b = product == null ? void 0 : product.items) == null ? void 0 : _b.forEach((x2) => {
|
|
11037
|
+
var _a2, _b2, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
11038
|
+
if (x2.kind === EProductKind.OPTIONS && (((_a2 = x2.attrs) == null ? void 0 : _a2.vital) || ((_b2 = x2 == null ? void 0 : x2.attrs) == null ? void 0 : _b2.selMin) || ((_c = x2.attrs) == null ? void 0 : _c.selMax) || ((_d = x2.attrs) == null ? void 0 : _d.qtyMin) || ((_e2 = x2.attrs) == null ? void 0 : _e2.qtyMax) || ((_f = x2.attrs) == null ? void 0 : _f.allowMultiple))) {
|
|
11039
|
+
const [selCnt, qtyCnt] = getSelCtxCntFromSelectedState(
|
|
11040
|
+
x2.selCtx,
|
|
11041
|
+
selected,
|
|
11042
|
+
x2.items
|
|
11043
|
+
);
|
|
11044
|
+
const isFilterValidated = validateProductFilter(product, filter);
|
|
11045
|
+
res[x2.selCtx] = {
|
|
11046
|
+
isSelCntAllowedToIncrement: selCnt < Number(((_g = x2 == null ? void 0 : x2.attrs) == null ? void 0 : _g.selMax) || Number.MAX_SAFE_INTEGER),
|
|
11047
|
+
isQtyCntAllowedToIncrement: qtyCnt < Number(((_h = x2 == null ? void 0 : x2.attrs) == null ? void 0 : _h.qtyMax) || Number.MAX_SAFE_INTEGER),
|
|
11048
|
+
nestedLvl,
|
|
11049
|
+
isPassedFiltering: isFilterValidated,
|
|
11050
|
+
isValid: inRange(
|
|
11051
|
+
selCnt,
|
|
11052
|
+
Number(((_i = x2.attrs) == null ? void 0 : _i.selMin) || 0),
|
|
11053
|
+
Number(((_j = x2.attrs) == null ? void 0 : _j.selMax) || Number.MAX_SAFE_INTEGER) + 1
|
|
11054
|
+
) && inRange(
|
|
11055
|
+
qtyCnt,
|
|
11056
|
+
Number(((_k = x2.attrs) == null ? void 0 : _k.qtyMin) || 0),
|
|
11057
|
+
Number(((_l = x2.attrs) == null ? void 0 : _l.qtyMax) || Number.MAX_SAFE_INTEGER) + 1
|
|
11058
|
+
) && (((_m = x2.attrs) == null ? void 0 : _m.vital) !== true || ((_n = x2.attrs) == null ? void 0 : _n.vital) === true && selCnt > 0) && (((_o = x2.attrs) == null ? void 0 : _o.allowMultiple) === true || !((_p = x2.attrs) == null ? void 0 : _p.allowMultiple) && selCnt <= 1)
|
|
11059
|
+
};
|
|
11060
|
+
}
|
|
11061
|
+
if ((x2 == null ? void 0 : x2.items) && ((_q = x2.items) == null ? void 0 : _q.length) > 0) {
|
|
11062
|
+
(_r = x2.items) == null ? void 0 : _r.forEach((item) => {
|
|
11063
|
+
getValidationMap2(item, selected, filter, res, nestedLvl + 1);
|
|
11064
|
+
});
|
|
11065
|
+
}
|
|
11066
|
+
});
|
|
11067
|
+
}
|
|
11068
|
+
return res;
|
|
11069
|
+
};
|
|
11070
|
+
const GroupsValidationContext = React__default.createContext(null);
|
|
11071
|
+
function GroupsValidationProvivider({
|
|
11072
|
+
rootProduct,
|
|
11073
|
+
children
|
|
11074
|
+
}) {
|
|
11075
|
+
return /* @__PURE__ */ jsx(GroupsValidationContext.Provider, {
|
|
11076
|
+
value: {
|
|
11077
|
+
rootProduct
|
|
11078
|
+
},
|
|
11079
|
+
children
|
|
11080
|
+
});
|
|
11081
|
+
}
|
|
11082
|
+
function useGroupsValidation(product) {
|
|
11083
|
+
const context = useContext(GroupsValidationContext);
|
|
11084
|
+
const selected = useWatch({
|
|
11085
|
+
name: "selected"
|
|
11086
|
+
});
|
|
11087
|
+
const filter = useWatch({
|
|
11088
|
+
name: "filter"
|
|
11089
|
+
});
|
|
11090
|
+
const [validationMap2, setValidationMap2] = useState(void 0);
|
|
11091
|
+
if (!context) {
|
|
11092
|
+
throw new Error("Missing ComponentsContext");
|
|
11093
|
+
}
|
|
11094
|
+
useEffect(() => {
|
|
11095
|
+
console.log("useGroupsValidation validationMap2 change");
|
|
11096
|
+
}, [validationMap2]);
|
|
11097
|
+
useEffect(() => {
|
|
11098
|
+
const newMap = getValidationMap2(product, selected, filter);
|
|
11099
|
+
if (!isEqual(newMap, validationMap2)) {
|
|
11100
|
+
setValidationMap2(newMap);
|
|
11101
|
+
}
|
|
11102
|
+
}, [selected, filter]);
|
|
11103
|
+
return {
|
|
11104
|
+
validationMap2
|
|
11105
|
+
};
|
|
11106
|
+
}
|
|
10836
11107
|
const MenuProductRoot = (props) => {
|
|
10837
11108
|
const {
|
|
10838
11109
|
product
|
|
@@ -10840,6 +11111,9 @@ const MenuProductRoot = (props) => {
|
|
|
10840
11111
|
const {
|
|
10841
11112
|
MenuProductRootUI
|
|
10842
11113
|
} = useComponents();
|
|
11114
|
+
const {
|
|
11115
|
+
validationMap2
|
|
11116
|
+
} = useGroupsValidation(product);
|
|
10843
11117
|
const MenuItemsDispatcherWrapper = !isEmpty(product.items) ? /* @__PURE__ */ jsx(MenuItemsDispatcher, {
|
|
10844
11118
|
productItems: product.items,
|
|
10845
11119
|
parentProduct: product,
|
|
@@ -10848,11 +11122,13 @@ const MenuProductRoot = (props) => {
|
|
|
10848
11122
|
if (MenuProductRootUI) {
|
|
10849
11123
|
return /* @__PURE__ */ jsx(MenuProductRootUI, {
|
|
10850
11124
|
...props,
|
|
11125
|
+
validationMap: validationMap2 || {},
|
|
10851
11126
|
children: MenuItemsDispatcherWrapper
|
|
10852
11127
|
});
|
|
10853
11128
|
}
|
|
10854
11129
|
return /* @__PURE__ */ jsx(MenuProductRootDefaultUI, {
|
|
10855
11130
|
...props,
|
|
11131
|
+
validationMap: validationMap2 || {},
|
|
10856
11132
|
children: MenuItemsDispatcherWrapper
|
|
10857
11133
|
});
|
|
10858
11134
|
};
|
|
@@ -10894,28 +11170,19 @@ function ProductConfigurator(props) {
|
|
|
10894
11170
|
encodedProduct,
|
|
10895
11171
|
initSelected,
|
|
10896
11172
|
initFilter,
|
|
10897
|
-
filter,
|
|
10898
11173
|
productQuantity,
|
|
10899
11174
|
setIsOnSubmittedOnTrue,
|
|
10900
11175
|
getInvalidSelCtxArray,
|
|
10901
|
-
getValidationMap,
|
|
10902
11176
|
increaseProductQuantity,
|
|
10903
11177
|
decreaseProductQuantity,
|
|
10904
11178
|
setCurrency
|
|
10905
11179
|
} = useProductConfigurator(product);
|
|
10906
|
-
const [validationMap, setValidationMap] = useState(getValidationMap());
|
|
10907
11180
|
useEffect(() => {
|
|
10908
11181
|
instance.changeLanguage(lang);
|
|
10909
11182
|
}, [lang]);
|
|
10910
11183
|
useEffect(() => {
|
|
10911
11184
|
setCurrency(currency);
|
|
10912
11185
|
}, [currency]);
|
|
10913
|
-
useEffect(() => {
|
|
10914
|
-
const validationMapNew = getValidationMap();
|
|
10915
|
-
if (!isEqual(validationMapNew, validationMap)) {
|
|
10916
|
-
setValidationMap(validationMapNew);
|
|
10917
|
-
}
|
|
10918
|
-
});
|
|
10919
11186
|
const methods = useForm({
|
|
10920
11187
|
defaultValues: {
|
|
10921
11188
|
selected: initSelected,
|
|
@@ -10927,6 +11194,7 @@ function ProductConfigurator(props) {
|
|
|
10927
11194
|
} = methods;
|
|
10928
11195
|
const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected"), encodedProduct)).toFixed(2));
|
|
10929
11196
|
const onSubmit = () => {
|
|
11197
|
+
var _a;
|
|
10930
11198
|
console.log("onSubmit");
|
|
10931
11199
|
setIsOnSubmittedOnTrue();
|
|
10932
11200
|
const invalidContextNames = getInvalidSelCtxArray();
|
|
@@ -10938,6 +11206,16 @@ function ProductConfigurator(props) {
|
|
|
10938
11206
|
} else {
|
|
10939
11207
|
console.log("selected", getValues("selected"));
|
|
10940
11208
|
const decodedCleanedSelected = decodeSelected(cleanSelected(getValues("selected")));
|
|
11209
|
+
const filter = getValues("filter");
|
|
11210
|
+
(_a = Object.keys(decodedCleanedSelected || {})) == null ? void 0 : _a.forEach((x2) => {
|
|
11211
|
+
const group = findGroupInProductItemsBySelCtx(x2, product);
|
|
11212
|
+
if (group) {
|
|
11213
|
+
const isFilterValidated = validateProductFilter(group, filter);
|
|
11214
|
+
if (!isFilterValidated) {
|
|
11215
|
+
delete decodedCleanedSelected[x2];
|
|
11216
|
+
}
|
|
11217
|
+
}
|
|
11218
|
+
});
|
|
10941
11219
|
console.log("decodedCleanedSelected: ", decodedCleanedSelected);
|
|
10942
11220
|
handleAddToCart({
|
|
10943
11221
|
price: countedProductPrice,
|
|
@@ -10959,19 +11237,21 @@ function ProductConfigurator(props) {
|
|
|
10959
11237
|
children: [showDebugState && /* @__PURE__ */ jsx("div", {
|
|
10960
11238
|
className: "hidden",
|
|
10961
11239
|
children: /* @__PURE__ */ jsx(DisplayState, {})
|
|
10962
|
-
}), /* @__PURE__ */ jsx(
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
11240
|
+
}), /* @__PURE__ */ jsx(GroupsValidationProvivider, {
|
|
11241
|
+
rootProduct: encodedProduct,
|
|
11242
|
+
children: /* @__PURE__ */ jsx(MenuProductRoot, {
|
|
11243
|
+
product: encodedProduct,
|
|
11244
|
+
productQuantity,
|
|
11245
|
+
isOpen,
|
|
11246
|
+
handleClose,
|
|
11247
|
+
handleGoBack,
|
|
11248
|
+
handleOnSubmit,
|
|
11249
|
+
countedProductPrice,
|
|
11250
|
+
countedProductTotalPrice: countedProductPrice * productQuantity,
|
|
11251
|
+
increaseProductQuantity,
|
|
11252
|
+
decreaseProductQuantity,
|
|
11253
|
+
currency
|
|
11254
|
+
})
|
|
10975
11255
|
})]
|
|
10976
11256
|
})
|
|
10977
11257
|
})
|
|
@@ -10979,5 +11259,5 @@ function ProductConfigurator(props) {
|
|
|
10979
11259
|
})
|
|
10980
11260
|
});
|
|
10981
11261
|
}
|
|
10982
|
-
export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, getProductToChangeInForm, index_esm as hookForm, selectProductsInForm, unselectProductsInForm, useProductData, validateProductFilter };
|
|
11262
|
+
export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, getProductToChangeInForm, index_esm as hookForm, selectProductsInForm, unselectProductsInForm, useMenuOptions, useProductData, useStore, validateProductFilter };
|
|
10983
11263
|
//# sourceMappingURL=index.es.js.map
|