@orderingstack/front-components-product-configurator 1.4.2-beta.3 → 1.4.2-beta.31
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/useMenuProduct.d.ts +1 -1
- 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 -0
- package/dist/components/ProductConfigurator/useProductConfigurator.d.ts.map +1 -1
- 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 +412 -200
- package/dist/index.es.js.map +1 -1
- package/dist/utils/filter.d.ts +1 -1
- package/dist/utils/filter.d.ts.map +1 -1
- 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 +1 -1
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();
|
|
@@ -6686,6 +6859,7 @@ function useProductConfigurator(product) {
|
|
|
6686
6859
|
return {
|
|
6687
6860
|
encodedProduct,
|
|
6688
6861
|
initSelected,
|
|
6862
|
+
initFilter,
|
|
6689
6863
|
filter,
|
|
6690
6864
|
setCurrency,
|
|
6691
6865
|
setIsOnSubmittedOnTrue,
|
|
@@ -6696,171 +6870,26 @@ function useProductConfigurator(product) {
|
|
|
6696
6870
|
decreaseProductQuantity
|
|
6697
6871
|
};
|
|
6698
6872
|
}
|
|
6699
|
-
var EPaymentStatus;
|
|
6700
|
-
(function(EPaymentStatus2) {
|
|
6701
|
-
EPaymentStatus2["UNINITIALIZED"] = "UNINITIALIZED";
|
|
6702
|
-
EPaymentStatus2["PROCESSING"] = "PROCESSING";
|
|
6703
|
-
EPaymentStatus2["PAID"] = "PAID";
|
|
6704
|
-
EPaymentStatus2["FAILED"] = "FAILED";
|
|
6705
|
-
EPaymentStatus2["PRINTING_RECEIPT"] = "PRINTING_RECEIPT";
|
|
6706
|
-
EPaymentStatus2["PRINTING_RECEIPT_SUCCESS"] = "PRINTING_RECEIPT_SUCCESS";
|
|
6707
|
-
EPaymentStatus2["SENDING_RECEIPT"] = "SENDING_RECEIPT";
|
|
6708
|
-
EPaymentStatus2["SENDING_RECEIPT_SUCCESS"] = "SENDING_RECEIPT_SUCCESS";
|
|
6709
|
-
EPaymentStatus2["ERROR"] = "ERROR";
|
|
6710
|
-
})(EPaymentStatus || (EPaymentStatus = {}));
|
|
6711
|
-
var ECouponViewType;
|
|
6712
|
-
(function(ECouponViewType2) {
|
|
6713
|
-
ECouponViewType2["CAROUSEL"] = "carousel";
|
|
6714
|
-
ECouponViewType2["NORMAL"] = "normal";
|
|
6715
|
-
ECouponViewType2["IMAGE"] = "image";
|
|
6716
|
-
})(ECouponViewType || (ECouponViewType = {}));
|
|
6717
|
-
var EProductKind;
|
|
6718
|
-
(function(EProductKind2) {
|
|
6719
|
-
EProductKind2["GROUP"] = "3e/group";
|
|
6720
|
-
EProductKind2["PRODUCT"] = "3e/product";
|
|
6721
|
-
EProductKind2["CATEGORY"] = "3e/group/category";
|
|
6722
|
-
EProductKind2["OPTIONS"] = "3e/group/options";
|
|
6723
|
-
EProductKind2["CONFIG"] = "3e/group/config";
|
|
6724
|
-
EProductKind2["STATIC"] = "3e/static";
|
|
6725
|
-
EProductKind2["REF"] = "3e/ref";
|
|
6726
|
-
EProductKind2["QUERY"] = "3e/query";
|
|
6727
|
-
EProductKind2["CMS"] = "3e/cms";
|
|
6728
|
-
})(EProductKind || (EProductKind = {}));
|
|
6729
|
-
var EProductKindBucket;
|
|
6730
|
-
(function(EProductKindBucket2) {
|
|
6731
|
-
EProductKindBucket2["GROUP"] = "group";
|
|
6732
|
-
EProductKindBucket2["PRODUCT"] = "product";
|
|
6733
|
-
})(EProductKindBucket || (EProductKindBucket = {}));
|
|
6734
|
-
var EOrderUserRole;
|
|
6735
|
-
(function(EOrderUserRole2) {
|
|
6736
|
-
EOrderUserRole2["CREATOR"] = "CREATOR";
|
|
6737
|
-
EOrderUserRole2["CUSTOMER"] = "CUSTOMER";
|
|
6738
|
-
EOrderUserRole2["COUPONS"] = "COUPON";
|
|
6739
|
-
EOrderUserRole2["KIOSK"] = "KIOSK";
|
|
6740
|
-
EOrderUserRole2["WAITER"] = "WAITER";
|
|
6741
|
-
EOrderUserRole2["MANAGER"] = "MANAGER";
|
|
6742
|
-
EOrderUserRole2["VIEWER"] = "VIEWER";
|
|
6743
|
-
EOrderUserRole2["DRIVER"] = "DRIVER";
|
|
6744
|
-
EOrderUserRole2["STAFF"] = "STAFF";
|
|
6745
|
-
})(EOrderUserRole || (EOrderUserRole = {}));
|
|
6746
|
-
var EOrderType;
|
|
6747
|
-
(function(EOrderType2) {
|
|
6748
|
-
EOrderType2["TAKE_AWAY"] = "TAKE_AWAY";
|
|
6749
|
-
EOrderType2["DELIVERY"] = "DELIVERY";
|
|
6750
|
-
EOrderType2["DINE_IN"] = "DINE_IN";
|
|
6751
|
-
EOrderType2["DINE_IN_OPEN"] = "DINE_IN_OPEN";
|
|
6752
|
-
EOrderType2["GLOVO_DELIVERY"] = "GLOVO_DELIVERY";
|
|
6753
|
-
EOrderType2["GLOVO_TAKE_AWAY"] = "GLOVO_TAKE_AWAY";
|
|
6754
|
-
EOrderType2["JUSTEAT_DELIVERY"] = "JUSTEAT_DELIVERY";
|
|
6755
|
-
EOrderType2["JUSTEAT_TAKE_AWAY"] = "JUSTEAT_TAKE_AWAY";
|
|
6756
|
-
EOrderType2["UBER_DELIVERY"] = "UBER_DELIVERY";
|
|
6757
|
-
EOrderType2["UBER_TAKE_AWAY"] = "UBER_TAKE_AWAY";
|
|
6758
|
-
EOrderType2["UBER_DINE_IN"] = "UBER_DINE_IN";
|
|
6759
|
-
EOrderType2["WOLT_DELIVERY"] = "WOLT_DELIVERY";
|
|
6760
|
-
EOrderType2["WOLT_TAKE_AWAY"] = "WOLT_TAKE_AWAY";
|
|
6761
|
-
EOrderType2["WOLT_DINE_IN"] = "WOLT_DINE_IN";
|
|
6762
|
-
EOrderType2["BOLT_DELIVERY"] = "BOLT_DELIVERY";
|
|
6763
|
-
EOrderType2["BOLT_TAKE_AWAY"] = "BOLT_TAKE_AWAY";
|
|
6764
|
-
EOrderType2["BOLT_DINE_IN"] = "BOLT_DINE_IN";
|
|
6765
|
-
EOrderType2["TAZZ_DELIVERY"] = "TAZZ_DELIVERY";
|
|
6766
|
-
EOrderType2["TAZZ_TAKE_AWAY"] = "TAZZ_TAKE_AWAY";
|
|
6767
|
-
EOrderType2["UPMENU_DELIVERY"] = "UPMENU_DELIVERY";
|
|
6768
|
-
EOrderType2["UPMENU_TAKE_AWAY"] = "UPMENU_TAKE_AWAY";
|
|
6769
|
-
EOrderType2["UPMENU_DINE_IN"] = "UPMENU_DINE_IN";
|
|
6770
|
-
})(EOrderType || (EOrderType = {}));
|
|
6771
|
-
var EOrderSource;
|
|
6772
|
-
(function(EOrderSource2) {
|
|
6773
|
-
EOrderSource2["KIOSK"] = "KIOSK";
|
|
6774
|
-
EOrderSource2["WEB"] = "WEB";
|
|
6775
|
-
EOrderSource2["JUST_EAT_TAKE_AWAY"] = "JUSTEATTAKEAWAY";
|
|
6776
|
-
EOrderSource2["GLOVO"] = "GLOVO";
|
|
6777
|
-
EOrderSource2["PYSZNE"] = "PYSZNE";
|
|
6778
|
-
EOrderSource2["WOLT"] = "WOLT";
|
|
6779
|
-
EOrderSource2["UBER"] = "UBER";
|
|
6780
|
-
EOrderSource2["BOLT"] = "BOLT";
|
|
6781
|
-
EOrderSource2["TAZZ"] = "TAZZ";
|
|
6782
|
-
EOrderSource2["POS"] = "POS";
|
|
6783
|
-
EOrderSource2["UPMENU"] = "UPMENU";
|
|
6784
|
-
})(EOrderSource || (EOrderSource = {}));
|
|
6785
|
-
var EChannelName;
|
|
6786
|
-
(function(EChannelName2) {
|
|
6787
|
-
EChannelName2["DINE_IN"] = "DINE_IN";
|
|
6788
|
-
EChannelName2["TAKE_AWAY"] = "TAKE_AWAY";
|
|
6789
|
-
EChannelName2["DELIVERY"] = "DELIVERY";
|
|
6790
|
-
EChannelName2["GLOVO"] = "GLOVO";
|
|
6791
|
-
EChannelName2["JUSTEAT"] = "JUSTEAT";
|
|
6792
|
-
EChannelName2["UBER"] = "UBER";
|
|
6793
|
-
EChannelName2["BOLT"] = "BOLT";
|
|
6794
|
-
EChannelName2["WOLT"] = "WOLT";
|
|
6795
|
-
EChannelName2["TAZZ"] = "TAZZ";
|
|
6796
|
-
EChannelName2["UPMENU"] = "UPMENU";
|
|
6797
|
-
})(EChannelName || (EChannelName = {}));
|
|
6798
|
-
var EOrderStatus;
|
|
6799
|
-
(function(EOrderStatus2) {
|
|
6800
|
-
EOrderStatus2["NEW"] = "NEW";
|
|
6801
|
-
EOrderStatus2["COMPLETED"] = "COMPLETED";
|
|
6802
|
-
EOrderStatus2["VERIFIED"] = "VERIFIED";
|
|
6803
|
-
EOrderStatus2["DELIVER"] = "DELIVER";
|
|
6804
|
-
EOrderStatus2["DELIVERED"] = "DELIVERED";
|
|
6805
|
-
EOrderStatus2["CLOSED"] = "CLOSED";
|
|
6806
|
-
EOrderStatus2["ABANDONED"] = "ABANDONED";
|
|
6807
|
-
EOrderStatus2["CANCELLED"] = "CANCELLED";
|
|
6808
|
-
EOrderStatus2["PICKED"] = "PICKED";
|
|
6809
|
-
})(EOrderStatus || (EOrderStatus = {}));
|
|
6810
|
-
var EOrderPaymentType;
|
|
6811
|
-
(function(EOrderPaymentType2) {
|
|
6812
|
-
EOrderPaymentType2["CASH"] = "CASH";
|
|
6813
|
-
EOrderPaymentType2["CARD"] = "CARD";
|
|
6814
|
-
EOrderPaymentType2["COD"] = "COD";
|
|
6815
|
-
EOrderPaymentType2["TERMINAL"] = "TERMINAL";
|
|
6816
|
-
EOrderPaymentType2["EPAYMENT"] = "EPAYMENT";
|
|
6817
|
-
EOrderPaymentType2["COUPON"] = "COUPON";
|
|
6818
|
-
EOrderPaymentType2["WALLET"] = "WALLET";
|
|
6819
|
-
EOrderPaymentType2["PREAUTHORIZED"] = "PREAUTHORIZED";
|
|
6820
|
-
EOrderPaymentType2["RETURN"] = "RETURN";
|
|
6821
|
-
EOrderPaymentType2["EXTERNAL"] = "EXTERNAL";
|
|
6822
|
-
})(EOrderPaymentType || (EOrderPaymentType = {}));
|
|
6823
|
-
var ERbiOrderExtra;
|
|
6824
|
-
(function(ERbiOrderExtra2) {
|
|
6825
|
-
ERbiOrderExtra2["POINTS_TOTAL"] = "x-rbi-loyalty-points";
|
|
6826
|
-
ERbiOrderExtra2["POINTS_EARNED"] = "x-rbi-points-earned";
|
|
6827
|
-
ERbiOrderExtra2["REWARDS"] = "x-rbi-rewards";
|
|
6828
|
-
ERbiOrderExtra2["OFFERS"] = "x-rbi-offers";
|
|
6829
|
-
ERbiOrderExtra2["CUSTOMER_NAME"] = "x-customer-name";
|
|
6830
|
-
})(ERbiOrderExtra || (ERbiOrderExtra = {}));
|
|
6831
|
-
var EOrderLineStatus;
|
|
6832
|
-
(function(EOrderLineStatus2) {
|
|
6833
|
-
EOrderLineStatus2["NEW"] = "NEW";
|
|
6834
|
-
EOrderLineStatus2["TECHNICAL"] = "TECHNICAL";
|
|
6835
|
-
EOrderLineStatus2["CONFIRMED"] = "CONFIRMED";
|
|
6836
|
-
EOrderLineStatus2["PROCESSING"] = "PROCESSING";
|
|
6837
|
-
EOrderLineStatus2["PROCESSED"] = "PROCESSED";
|
|
6838
|
-
EOrderLineStatus2["VOID"] = "VOID";
|
|
6839
|
-
EOrderLineStatus2["WASTE"] = "WASTE";
|
|
6840
|
-
})(EOrderLineStatus || (EOrderLineStatus = {}));
|
|
6841
|
-
var EOrderProductKind;
|
|
6842
|
-
(function(EOrderProductKind2) {
|
|
6843
|
-
EOrderProductKind2["GROUP"] = "group";
|
|
6844
|
-
EOrderProductKind2["PRODUCT"] = "product";
|
|
6845
|
-
})(EOrderProductKind || (EOrderProductKind = {}));
|
|
6846
|
-
var ENotificationType;
|
|
6847
|
-
(function(ENotificationType2) {
|
|
6848
|
-
ENotificationType2["ORDER_EVENT_ERROR"] = "OrderEventError";
|
|
6849
|
-
ENotificationType2["ORDER_APPLIED_EVENTS"] = "OrderAppliedEvents";
|
|
6850
|
-
ENotificationType2["ORDER_EVENT_FISCAL"] = "OrderEventFiscal";
|
|
6851
|
-
ENotificationType2["ORDER_UPSELL"] = "OrderUpsell";
|
|
6852
|
-
})(ENotificationType || (ENotificationType = {}));
|
|
6853
6873
|
const validateProductFilter = (product, stateFilter) => {
|
|
6874
|
+
var _a;
|
|
6854
6875
|
const { filter: productFilters = {}, fltCtx = "" } = product;
|
|
6855
|
-
const stateFiltersWithFltCtx = stateFilter[fltCtx];
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
const commonFilters = Object.keys(stateFiltersWithFltCtx).filter(
|
|
6859
|
-
(filterName) => Object.keys(productFilters).includes(filterName) && productFilters[filterName].includes(stateFiltersWithFltCtx[filterName])
|
|
6860
|
-
);
|
|
6861
|
-
return commonFilters.length > 0;
|
|
6876
|
+
const stateFiltersWithFltCtx = (stateFilter == null ? void 0 : stateFilter[fltCtx]) || {};
|
|
6877
|
+
if (!productFilters || !Object.keys(productFilters).length || !stateFiltersWithFltCtx) {
|
|
6878
|
+
return true;
|
|
6862
6879
|
}
|
|
6863
|
-
|
|
6880
|
+
const commonFilters = (_a = Object.keys(stateFiltersWithFltCtx)) == null ? void 0 : _a.filter(
|
|
6881
|
+
(filterName) => {
|
|
6882
|
+
var _a2;
|
|
6883
|
+
const matchingFilters = (_a2 = Object.keys((productFilters == null ? void 0 : productFilters[filterName]) || {})) == null ? void 0 : _a2.filter((x2) => {
|
|
6884
|
+
var _a3;
|
|
6885
|
+
if (((_a3 = productFilters == null ? void 0 : productFilters[filterName]) == null ? void 0 : _a3[x2]) === (stateFiltersWithFltCtx == null ? void 0 : stateFiltersWithFltCtx[filterName])) {
|
|
6886
|
+
return true;
|
|
6887
|
+
}
|
|
6888
|
+
});
|
|
6889
|
+
return (matchingFilters == null ? void 0 : matchingFilters.length) > 0;
|
|
6890
|
+
}
|
|
6891
|
+
);
|
|
6892
|
+
return (commonFilters == null ? void 0 : commonFilters.length) > 0;
|
|
6864
6893
|
};
|
|
6865
6894
|
const getProductToChangeInForm = (product, isFilterValidated) => {
|
|
6866
6895
|
const { items, filter } = product;
|
|
@@ -6885,12 +6914,14 @@ const getProductToChangeInForm = (product, isFilterValidated) => {
|
|
|
6885
6914
|
return { productsToSelect, productsToUnselect };
|
|
6886
6915
|
};
|
|
6887
6916
|
const unselectProductsInForm = (productsToUnselect, setValueInForm) => {
|
|
6917
|
+
console.log("LOG1 productsToUnselect", productsToUnselect);
|
|
6888
6918
|
productsToUnselect.map(({ selCtx, id }) => {
|
|
6889
6919
|
setValueInForm(`selected.${selCtx}.${id}`, false);
|
|
6890
6920
|
});
|
|
6891
6921
|
};
|
|
6892
|
-
const selectProductsInForm = (
|
|
6893
|
-
|
|
6922
|
+
const selectProductsInForm = (productToSelect, setValueInForm, initialSelectedState) => {
|
|
6923
|
+
console.log("LOG1 productToSelect", productToSelect);
|
|
6924
|
+
productToSelect.map(({ selCtx, id }) => {
|
|
6894
6925
|
var _a;
|
|
6895
6926
|
const productInInitialState = (_a = initialSelectedState[selCtx]) == null ? void 0 : _a[id];
|
|
6896
6927
|
if (productInInitialState) {
|
|
@@ -6903,12 +6934,11 @@ const selectProductsInForm = (productToUnselect, setValueInForm, initialSelected
|
|
|
6903
6934
|
};
|
|
6904
6935
|
function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
|
|
6905
6936
|
const { selCtx, attrs = {} } = product;
|
|
6906
|
-
const stateFilter = useStore((state) => state.filter);
|
|
6907
6937
|
const initialSelected = useStore((state) => state.initialSelected);
|
|
6908
6938
|
const currency = useStore((state) => state.currency);
|
|
6909
6939
|
const { setValue, getValues } = useFormContext();
|
|
6910
|
-
const { selected = {} } = getValues();
|
|
6911
|
-
const isFilterValidated = validateProductFilter(product,
|
|
6940
|
+
const { selected = {}, filter = {} } = getValues();
|
|
6941
|
+
const isFilterValidated = validateProductFilter(product, filter);
|
|
6912
6942
|
const isOnSubmitted = useStore((state) => state.isOnSubmitted);
|
|
6913
6943
|
const setValidationMap = useStore((state) => state.setValidationMap);
|
|
6914
6944
|
const [selCnt, qtyCnt] = getSelCtxCntFromSelectedState(
|
|
@@ -6931,9 +6961,8 @@ function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
|
|
|
6931
6961
|
product,
|
|
6932
6962
|
isFilterValidated
|
|
6933
6963
|
);
|
|
6934
|
-
unselectProductsInForm(productsToUnselect, setValue);
|
|
6935
6964
|
selectProductsInForm(productsToSelect, setValue, initialSelected);
|
|
6936
|
-
}, [
|
|
6965
|
+
}, [isFilterValidated]);
|
|
6937
6966
|
return {
|
|
6938
6967
|
isFilterValidated,
|
|
6939
6968
|
selected,
|
|
@@ -8794,14 +8823,63 @@ function Counter(props) {
|
|
|
8794
8823
|
})]
|
|
8795
8824
|
});
|
|
8796
8825
|
}
|
|
8797
|
-
function useEmitFilter(product) {
|
|
8798
|
-
const { watch } = useFormContext();
|
|
8799
|
-
const setFilter = useStore((state) => state.setFilter);
|
|
8826
|
+
function useEmitFilter(product, isRadio, nestedLvl) {
|
|
8827
|
+
const { watch, setValue, getValues, unregister } = useFormContext();
|
|
8800
8828
|
const { id, selCtx, emit = {}, fltCtx } = product;
|
|
8801
8829
|
const value = watch(`selected.${selCtx}.${id}`);
|
|
8802
8830
|
useEffect(() => {
|
|
8831
|
+
var _a, _b, _c;
|
|
8832
|
+
if (!nestedLvl || nestedLvl > 1) {
|
|
8833
|
+
return;
|
|
8834
|
+
}
|
|
8835
|
+
const groupsPath = `filterWithCnt.${fltCtx}`;
|
|
8836
|
+
const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
|
|
8837
|
+
const fltCtxPath = `filter.${fltCtx}`;
|
|
8838
|
+
if (isRadio && value && fltCtx) {
|
|
8839
|
+
if (isEmpty(emit)) {
|
|
8840
|
+
const groupValues = getValues(groupCntPath);
|
|
8841
|
+
(_a = Object.keys(groupValues || {})) == null ? void 0 : _a.forEach((x2) => {
|
|
8842
|
+
unregister(`${groupCntPath}.${x2}`);
|
|
8843
|
+
const groupsKeys = Object.keys(getValues(groupsPath) || {});
|
|
8844
|
+
if (isEmpty(groupsKeys)) {
|
|
8845
|
+
unregister(`${fltCtxPath}.${x2}`);
|
|
8846
|
+
} else {
|
|
8847
|
+
groupsKeys.forEach((groupSelCtx) => {
|
|
8848
|
+
if (groupSelCtx !== selCtx && !getValues(`${groupsPath}.${groupSelCtx}.${x2}`)) {
|
|
8849
|
+
unregister(`${fltCtxPath}.${x2}`);
|
|
8850
|
+
}
|
|
8851
|
+
});
|
|
8852
|
+
}
|
|
8853
|
+
});
|
|
8854
|
+
return;
|
|
8855
|
+
} else {
|
|
8856
|
+
const productGroupCntKeys = getValues(groupCntPath);
|
|
8857
|
+
const groupsCntKeys = getValues(groupsPath);
|
|
8858
|
+
(_b = Object.keys(emit)) == null ? void 0 : _b.forEach((x2) => {
|
|
8859
|
+
var _a2;
|
|
8860
|
+
(_a2 = Object.keys(productGroupCntKeys || {})) == null ? void 0 : _a2.forEach((productGroupCntKey) => {
|
|
8861
|
+
if (!emit[productGroupCntKey]) {
|
|
8862
|
+
unregister(`${fltCtxPath}.${productGroupCntKey}`);
|
|
8863
|
+
unregister(`${groupCntPath}.${productGroupCntKey}`);
|
|
8864
|
+
}
|
|
8865
|
+
});
|
|
8866
|
+
Object.keys(groupsCntKeys || {}).forEach((groupSelCtx) => {
|
|
8867
|
+
if (groupSelCtx !== selCtx && x2 in getValues(groupsPath == null ? void 0 : groupsPath[groupSelCtx])) {
|
|
8868
|
+
unregister(`${groupsPath}.${groupSelCtx}.${x2}`);
|
|
8869
|
+
}
|
|
8870
|
+
});
|
|
8871
|
+
setValue(`${fltCtxPath}.${x2}`, emit[x2]);
|
|
8872
|
+
setValue(`${groupCntPath}.${x2}`, { cnt: 1, value: emit[x2] });
|
|
8873
|
+
});
|
|
8874
|
+
return;
|
|
8875
|
+
}
|
|
8876
|
+
}
|
|
8803
8877
|
if (value && fltCtx && !isEmpty(emit)) {
|
|
8804
|
-
|
|
8878
|
+
(_c = Object.keys(emit)) == null ? void 0 : _c.forEach((x2) => {
|
|
8879
|
+
setValue(`filter.${fltCtx}.${x2}`, emit[x2]);
|
|
8880
|
+
const groupKeyCnt = getValues(`${groupCntPath}.${x2}.cnt`) || 0;
|
|
8881
|
+
setValue(`${groupCntPath}.${x2}`, { cnt: groupKeyCnt + 1, value: emit[x2] });
|
|
8882
|
+
});
|
|
8805
8883
|
}
|
|
8806
8884
|
}, [value]);
|
|
8807
8885
|
return {};
|
|
@@ -8825,6 +8903,7 @@ const addProductToState = (selected, setValue) => {
|
|
|
8825
8903
|
};
|
|
8826
8904
|
const removeProductFromState = (selCtx, getValues, setValue) => {
|
|
8827
8905
|
const changedSelCtx = getValues(`selected.${selCtx}`);
|
|
8906
|
+
console.log("changedSelCtx", changedSelCtx);
|
|
8828
8907
|
setValue(
|
|
8829
8908
|
`selected.${selCtx}`,
|
|
8830
8909
|
Object.keys(changedSelCtx).reduce((acc, key) => {
|
|
@@ -8833,66 +8912,131 @@ const removeProductFromState = (selCtx, getValues, setValue) => {
|
|
|
8833
8912
|
}, {})
|
|
8834
8913
|
);
|
|
8835
8914
|
};
|
|
8836
|
-
const selectUnselectProduct = (setValue, getValues,
|
|
8915
|
+
const selectUnselectProduct = (setValue, getValues, product, isChecked, unregister, nestedLvl) => {
|
|
8916
|
+
var _a, _b;
|
|
8917
|
+
const { items, state, emit, fltCtx, selCtx } = product;
|
|
8837
8918
|
const { selected = {} } = state || {};
|
|
8919
|
+
console.log("selected/unselected product", product, isChecked);
|
|
8838
8920
|
if (isChecked) {
|
|
8839
8921
|
addProductToState(selected, setValue);
|
|
8840
8922
|
const checkSubProducts = (items2) => {
|
|
8841
|
-
var
|
|
8923
|
+
var _a2;
|
|
8842
8924
|
if (!Array.isArray(items2) || isEmpty(state == null ? void 0 : state.selected))
|
|
8843
8925
|
return;
|
|
8844
|
-
(
|
|
8845
|
-
var
|
|
8846
|
-
return !!((
|
|
8847
|
-
})) == null ? void 0 :
|
|
8848
|
-
if (
|
|
8926
|
+
(_a2 = items2 == null ? void 0 : items2.filter((x2) => {
|
|
8927
|
+
var _a3, _b2;
|
|
8928
|
+
return !!((_b2 = (_a3 = state.selected) == null ? void 0 : _a3[`${x2.selCtx}`]) == null ? void 0 : _b2[`${x2.id}`]);
|
|
8929
|
+
})) == null ? void 0 : _a2.map((product2) => {
|
|
8930
|
+
if (product2.state && "selected" in product2.state) {
|
|
8849
8931
|
const {
|
|
8850
8932
|
state: { selected: selected2 }
|
|
8851
|
-
} =
|
|
8933
|
+
} = product2;
|
|
8852
8934
|
addProductToState(selected2, setValue);
|
|
8853
8935
|
}
|
|
8854
|
-
if (Array.isArray(
|
|
8855
|
-
checkSubProducts(
|
|
8936
|
+
if (Array.isArray(product2.items)) {
|
|
8937
|
+
checkSubProducts(product2.items);
|
|
8856
8938
|
}
|
|
8857
8939
|
});
|
|
8858
8940
|
};
|
|
8859
8941
|
checkSubProducts(items);
|
|
8860
8942
|
} else {
|
|
8861
|
-
Object.keys(selected).forEach((
|
|
8862
|
-
removeProductFromState(
|
|
8943
|
+
Object.keys(selected).forEach((selCtx2) => {
|
|
8944
|
+
removeProductFromState(selCtx2, getValues, setValue);
|
|
8863
8945
|
});
|
|
8864
8946
|
const checkSubProducts = (items2) => {
|
|
8865
8947
|
if (!Array.isArray(items2))
|
|
8866
8948
|
return;
|
|
8867
|
-
items2.map((
|
|
8868
|
-
const { selCtx } =
|
|
8869
|
-
const changedSelCtx = getValues(`selected.${
|
|
8949
|
+
items2.map((product2) => {
|
|
8950
|
+
const { selCtx: selCtx2 } = product2;
|
|
8951
|
+
const changedSelCtx = getValues(`selected.${selCtx2}`);
|
|
8870
8952
|
if (changedSelCtx) {
|
|
8871
|
-
removeProductFromState(
|
|
8953
|
+
removeProductFromState(selCtx2, getValues, setValue);
|
|
8872
8954
|
}
|
|
8873
|
-
checkSubProducts(
|
|
8955
|
+
checkSubProducts(product2.items);
|
|
8874
8956
|
});
|
|
8875
8957
|
};
|
|
8876
8958
|
checkSubProducts(items);
|
|
8959
|
+
if (nestedLvl && nestedLvl < 2 && !isEmpty(emit)) {
|
|
8960
|
+
(_a = Object.keys(emit)) == null ? void 0 : _a.forEach((x2) => {
|
|
8961
|
+
const formPath = `filterWithCnt.${fltCtx}.${x2}.${emit[x2]}`;
|
|
8962
|
+
const cnt = getValues(formPath) || 0;
|
|
8963
|
+
if (cnt < 2) {
|
|
8964
|
+
unregister(formPath);
|
|
8965
|
+
} else {
|
|
8966
|
+
setValue(formPath, cnt - 1);
|
|
8967
|
+
}
|
|
8968
|
+
});
|
|
8969
|
+
const groupsPath = `filterWithCnt.${fltCtx}`;
|
|
8970
|
+
const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
|
|
8971
|
+
const fltCtxPath = `filter.${fltCtx}`;
|
|
8972
|
+
(_b = Object.keys(emit)) == null ? void 0 : _b.forEach((emitKey) => {
|
|
8973
|
+
var _a2, _b2, _c;
|
|
8974
|
+
const groupValue = getValues(`${groupCntPath}.${emitKey}`) || 0;
|
|
8975
|
+
if (groupValue) {
|
|
8976
|
+
if (groupValue > 1) {
|
|
8977
|
+
setValue(`${groupCntPath}.${emitKey}`, groupValue - 1);
|
|
8978
|
+
} else {
|
|
8979
|
+
unregister(`${groupCntPath}.${emitKey}`);
|
|
8980
|
+
const groupKeysObj = getValues(groupsPath) || {};
|
|
8981
|
+
const otherGroupsCntKeys = (_a2 = Object.keys(groupKeysObj)) == null ? void 0 : _a2.filter((x2) => x2 !== selCtx);
|
|
8982
|
+
if (!otherGroupsCntKeys) {
|
|
8983
|
+
unregister(`${fltCtxPath}.${emitKey}`);
|
|
8984
|
+
} else {
|
|
8985
|
+
const sameKeyOtherGroup = otherGroupsCntKeys == null ? void 0 : otherGroupsCntKeys.find((groupSelCtx) => {
|
|
8986
|
+
var _a3;
|
|
8987
|
+
return !!((_a3 = groupKeysObj == null ? void 0 : groupKeysObj[`${groupSelCtx}`]) == null ? void 0 : _a3[`${emitKey}`]);
|
|
8988
|
+
});
|
|
8989
|
+
if (!sameKeyOtherGroup) {
|
|
8990
|
+
unregister(`${fltCtxPath}.${emitKey}`);
|
|
8991
|
+
} else {
|
|
8992
|
+
const newValue = (_c = (_b2 = groupKeysObj == null ? void 0 : groupKeysObj[`${sameKeyOtherGroup}`]) == null ? void 0 : _b2[`${emitKey}`]) == null ? void 0 : _c.value;
|
|
8993
|
+
setValue(`${fltCtxPath}.${emitKey}`, newValue);
|
|
8994
|
+
}
|
|
8995
|
+
}
|
|
8996
|
+
}
|
|
8997
|
+
}
|
|
8998
|
+
});
|
|
8999
|
+
}
|
|
8877
9000
|
}
|
|
8878
9001
|
};
|
|
8879
|
-
|
|
9002
|
+
const findProductInParentProductBySelCtx = (parent, selCtx) => {
|
|
8880
9003
|
var _a;
|
|
8881
|
-
|
|
9004
|
+
if (!parent.items || isEmpty(parent.items)) {
|
|
9005
|
+
return null;
|
|
9006
|
+
}
|
|
9007
|
+
for (let i2 = 0; i2 < ((_a = parent.items) == null ? void 0 : _a.length); i2++) {
|
|
9008
|
+
const prod = parent.items[i2];
|
|
9009
|
+
if (prod.selCtx) {
|
|
9010
|
+
if (prod.selCtx === selCtx && prod.kind === EProductKind.PRODUCT) {
|
|
9011
|
+
return prod;
|
|
9012
|
+
}
|
|
9013
|
+
}
|
|
9014
|
+
if (prod.kind === EProductKind.OPTIONS && prod.items && prod.items.length > 0) {
|
|
9015
|
+
const found = findProductInParentProductBySelCtx(prod, selCtx);
|
|
9016
|
+
if (found) {
|
|
9017
|
+
return found;
|
|
9018
|
+
}
|
|
9019
|
+
}
|
|
9020
|
+
}
|
|
9021
|
+
return null;
|
|
9022
|
+
};
|
|
9023
|
+
function useMenuProduct(product, parentAttrs, nestedLvl, parentPriduct) {
|
|
9024
|
+
var _a;
|
|
9025
|
+
const { id, selCtx, emit = {}, fltCtx } = product;
|
|
8882
9026
|
const {
|
|
8883
9027
|
allowMultiple: parentAllowMultiple,
|
|
8884
9028
|
selMin: parentSelMin,
|
|
8885
9029
|
selMax: parentSelMax
|
|
8886
9030
|
} = parentAttrs;
|
|
8887
|
-
useEmitFilter(product);
|
|
8888
9031
|
const { isInputEnabled: isInputEnabled2, isInputCounterIncrementEnabled: isInputCounterIncrementEnabled2 } = useValidate();
|
|
8889
9032
|
const refreshForm = useStore((state) => state.refreshForm);
|
|
8890
9033
|
const currency = useStore((state) => state.currency);
|
|
8891
|
-
const { watch, getValues, setValue, register } = useFormContext();
|
|
9034
|
+
const { watch, getValues, setValue, register, unregister } = useFormContext();
|
|
8892
9035
|
const value = watch(`selected.${selCtx}.${id}`);
|
|
8893
9036
|
const { selected = {} } = getValues();
|
|
8894
9037
|
const valueNumber = Number(value || 0);
|
|
8895
9038
|
const isRadio = parentSelMin === "1" && parentSelMax === "1";
|
|
9039
|
+
useEmitFilter(product, isRadio, nestedLvl);
|
|
8896
9040
|
const isCheckbox = !isRadio;
|
|
8897
9041
|
const isCounter = isApiBooleanTrue(parentAllowMultiple);
|
|
8898
9042
|
const isDecrementEnabled = valueNumber > (isRadio ? 1 : 0);
|
|
@@ -8909,10 +9053,20 @@ function useMenuProduct(product, parentAttrs) {
|
|
|
8909
9053
|
setValue(`selected.${selCtx}.${id}`, `${valueNumber + 1}`);
|
|
8910
9054
|
};
|
|
8911
9055
|
const handleCounterDecrementQty = () => {
|
|
9056
|
+
var _a2, _b;
|
|
8912
9057
|
const decrementedValue = valueNumber - 1;
|
|
8913
9058
|
setValue(`selected.${selCtx}.${id}`, `${decrementedValue}`);
|
|
8914
9059
|
if (isCheckbox && decrementedValue === 0) {
|
|
8915
9060
|
setValue(`selected.${selCtx}.${id}`, false);
|
|
9061
|
+
(_a2 = Object.keys(emit)) == null ? void 0 : _a2.forEach((x2) => {
|
|
9062
|
+
const formPath = `filterWithCnt.${fltCtx}.${x2}.${emit[x2]}`;
|
|
9063
|
+
const cnt = getValues(formPath) || 0;
|
|
9064
|
+
if (cnt < 2) {
|
|
9065
|
+
unregister(formPath);
|
|
9066
|
+
} else {
|
|
9067
|
+
setValue(formPath, cnt - 1);
|
|
9068
|
+
}
|
|
9069
|
+
});
|
|
8916
9070
|
const checkSubProducts = (items) => {
|
|
8917
9071
|
if (!Array.isArray(items))
|
|
8918
9072
|
return;
|
|
@@ -8926,13 +9080,54 @@ function useMenuProduct(product, parentAttrs) {
|
|
|
8926
9080
|
});
|
|
8927
9081
|
};
|
|
8928
9082
|
checkSubProducts(product.items);
|
|
9083
|
+
if (nestedLvl && nestedLvl < 2 && !isEmpty(emit)) {
|
|
9084
|
+
const groupsPath = `filterWithCnt.${fltCtx}`;
|
|
9085
|
+
const groupCntPath = `filterWithCnt.${fltCtx}.${selCtx}`;
|
|
9086
|
+
const fltCtxPath = `filter.${fltCtx}`;
|
|
9087
|
+
(_b = Object.keys(emit)) == null ? void 0 : _b.forEach((emitKey) => {
|
|
9088
|
+
var _a3, _b2, _c;
|
|
9089
|
+
const groupValue = getValues(`${groupCntPath}.${emitKey}`) || 0;
|
|
9090
|
+
if (groupValue) {
|
|
9091
|
+
if (groupValue > 1) {
|
|
9092
|
+
setValue(`${groupCntPath}.${emitKey}`, groupValue - 1);
|
|
9093
|
+
} else {
|
|
9094
|
+
unregister(`${groupCntPath}.${emitKey}`);
|
|
9095
|
+
const groupKeysObj = getValues(groupsPath) || {};
|
|
9096
|
+
const otherGroupsCntKeys = (_a3 = Object.keys(groupKeysObj)) == null ? void 0 : _a3.filter((x2) => x2 !== selCtx);
|
|
9097
|
+
if (!otherGroupsCntKeys) {
|
|
9098
|
+
unregister(`${fltCtxPath}.${emitKey}`);
|
|
9099
|
+
} else {
|
|
9100
|
+
const sameKeyOtherGroup = otherGroupsCntKeys == null ? void 0 : otherGroupsCntKeys.find((groupSelCtx) => {
|
|
9101
|
+
var _a4;
|
|
9102
|
+
return !!((_a4 = groupKeysObj == null ? void 0 : groupKeysObj[`${groupSelCtx}`]) == null ? void 0 : _a4[`${emitKey}`]);
|
|
9103
|
+
});
|
|
9104
|
+
if (!sameKeyOtherGroup) {
|
|
9105
|
+
unregister(`${fltCtxPath}.${emitKey}`);
|
|
9106
|
+
} else {
|
|
9107
|
+
const newValue = (_c = (_b2 = groupKeysObj == null ? void 0 : groupKeysObj[`${sameKeyOtherGroup}`]) == null ? void 0 : _b2[`${emitKey}`]) == null ? void 0 : _c.value;
|
|
9108
|
+
setValue(`${fltCtxPath}.${emitKey}`, newValue);
|
|
9109
|
+
}
|
|
9110
|
+
}
|
|
9111
|
+
}
|
|
9112
|
+
}
|
|
9113
|
+
});
|
|
9114
|
+
}
|
|
8929
9115
|
}
|
|
8930
9116
|
};
|
|
8931
9117
|
const handleOnInputChange = (e2) => {
|
|
9118
|
+
var _a2;
|
|
8932
9119
|
const {
|
|
8933
9120
|
target: { checked, name: selCtx2, defaultValue: productId }
|
|
8934
9121
|
} = e2;
|
|
8935
|
-
|
|
9122
|
+
const otherGroupItems = (_a2 = parentPriduct == null ? void 0 : parentPriduct.items) == null ? void 0 : _a2.filter((x2) => x2.id !== product.id);
|
|
9123
|
+
for (const key of Object.keys(selected || {})) {
|
|
9124
|
+
const isItemToClear = (otherGroupItems == null ? void 0 : otherGroupItems.some((x2) => !!findProductInParentProductBySelCtx(x2, key))) ? key : false;
|
|
9125
|
+
console.log("isImportantItem", isItemToClear);
|
|
9126
|
+
if (isItemToClear) {
|
|
9127
|
+
setValue(`selected.${key}`, false);
|
|
9128
|
+
}
|
|
9129
|
+
}
|
|
9130
|
+
selectUnselectProduct(setValue, getValues, product, checked, unregister, nestedLvl);
|
|
8936
9131
|
if (isRadio) {
|
|
8937
9132
|
console.log("handleOnInputChange radio", selCtx2, productId);
|
|
8938
9133
|
const selectedContextName = "selected." + selCtx2.replace("radio.", "").split(".")[0];
|
|
@@ -8981,7 +9176,7 @@ const MenuProduct = (props) => {
|
|
|
8981
9176
|
handleCounterIncrementQty,
|
|
8982
9177
|
handleCounterDecrementQty,
|
|
8983
9178
|
currency
|
|
8984
|
-
} = useMenuProduct(product, parentAttrs);
|
|
9179
|
+
} = useMenuProduct(product, parentAttrs, nestedLvl, parentProduct);
|
|
8985
9180
|
const {
|
|
8986
9181
|
MenuProductUI
|
|
8987
9182
|
} = useComponents();
|
|
@@ -9217,10 +9412,14 @@ const DisplayState = () => {
|
|
|
9217
9412
|
watch
|
|
9218
9413
|
} = useFormContext();
|
|
9219
9414
|
const selected = watch("selected");
|
|
9415
|
+
const filter = watch("filter");
|
|
9416
|
+
const filterWithCnt = watch("filterWithCnt");
|
|
9220
9417
|
const validationMap = useStore((state) => state.validationMap);
|
|
9221
9418
|
console.log({
|
|
9222
9419
|
selected,
|
|
9223
|
-
validationMap
|
|
9420
|
+
validationMap,
|
|
9421
|
+
filter,
|
|
9422
|
+
filterWithCnt
|
|
9224
9423
|
});
|
|
9225
9424
|
return /* @__PURE__ */ jsxs("div", {
|
|
9226
9425
|
className: "flex flex-col items-center py-4",
|
|
@@ -10827,6 +11026,7 @@ const MenuProductRoot = (props) => {
|
|
|
10827
11026
|
parentProduct: product,
|
|
10828
11027
|
rootProduct: product
|
|
10829
11028
|
}) : /* @__PURE__ */ jsx(Fragment, {});
|
|
11029
|
+
console.log("MenuProductRootUI CHECK", MenuProductRootUI);
|
|
10830
11030
|
if (MenuProductRootUI) {
|
|
10831
11031
|
return /* @__PURE__ */ jsx(MenuProductRootUI, {
|
|
10832
11032
|
...props,
|
|
@@ -10875,7 +11075,7 @@ function ProductConfigurator(props) {
|
|
|
10875
11075
|
const {
|
|
10876
11076
|
encodedProduct,
|
|
10877
11077
|
initSelected,
|
|
10878
|
-
|
|
11078
|
+
initFilter,
|
|
10879
11079
|
productQuantity,
|
|
10880
11080
|
setIsOnSubmittedOnTrue,
|
|
10881
11081
|
getInvalidSelCtxArray,
|
|
@@ -10899,7 +11099,8 @@ function ProductConfigurator(props) {
|
|
|
10899
11099
|
});
|
|
10900
11100
|
const methods = useForm({
|
|
10901
11101
|
defaultValues: {
|
|
10902
|
-
selected: initSelected
|
|
11102
|
+
selected: initSelected,
|
|
11103
|
+
filter: initFilter
|
|
10903
11104
|
}
|
|
10904
11105
|
});
|
|
10905
11106
|
const {
|
|
@@ -10907,6 +11108,7 @@ function ProductConfigurator(props) {
|
|
|
10907
11108
|
} = methods;
|
|
10908
11109
|
const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected"), encodedProduct)).toFixed(2));
|
|
10909
11110
|
const onSubmit = () => {
|
|
11111
|
+
var _a;
|
|
10910
11112
|
console.log("onSubmit");
|
|
10911
11113
|
setIsOnSubmittedOnTrue();
|
|
10912
11114
|
const invalidContextNames = getInvalidSelCtxArray();
|
|
@@ -10918,6 +11120,16 @@ function ProductConfigurator(props) {
|
|
|
10918
11120
|
} else {
|
|
10919
11121
|
console.log("selected", getValues("selected"));
|
|
10920
11122
|
const decodedCleanedSelected = decodeSelected(cleanSelected(getValues("selected")));
|
|
11123
|
+
const filter = getValues("filter");
|
|
11124
|
+
(_a = Object.keys(decodedCleanedSelected || {})) == null ? void 0 : _a.forEach((x2) => {
|
|
11125
|
+
const group = findGroupInProductItemsBySelCtx(x2, product);
|
|
11126
|
+
if (group) {
|
|
11127
|
+
const isFilterValidated = validateProductFilter(group, filter);
|
|
11128
|
+
if (!isFilterValidated) {
|
|
11129
|
+
delete decodedCleanedSelected[x2];
|
|
11130
|
+
}
|
|
11131
|
+
}
|
|
11132
|
+
});
|
|
10921
11133
|
console.log("decodedCleanedSelected: ", decodedCleanedSelected);
|
|
10922
11134
|
handleAddToCart({
|
|
10923
11135
|
price: countedProductPrice,
|
|
@@ -10959,5 +11171,5 @@ function ProductConfigurator(props) {
|
|
|
10959
11171
|
})
|
|
10960
11172
|
});
|
|
10961
11173
|
}
|
|
10962
|
-
export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, index_esm as hookForm, useProductData };
|
|
11174
|
+
export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, getProductToChangeInForm, index_esm as hookForm, selectProductsInForm, unselectProductsInForm, useMenuOptions, useProductData, validateProductFilter };
|
|
10963
11175
|
//# sourceMappingURL=index.es.js.map
|