@managesome/eposmatic-toolkit 0.2.709 → 0.2.712

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.
Files changed (35) hide show
  1. package/lib/constants/ENUMS.d.ts +1 -0
  2. package/lib/constants/ENUMS.js +1 -0
  3. package/lib/helpers/types/catalog.d.ts +3 -1
  4. package/lib/helpers/utils/catalog-conversion.d.ts +1 -1
  5. package/lib/helpers/utils/catalog-conversion.js +4 -2
  6. package/lib/helpers/utils/halfhalf-setup-helpers.js +2 -0
  7. package/lib/helpers/utils/minified-catalog.js +4 -0
  8. package/lib/helpers/utils/order-engine.d.ts +13 -0
  9. package/lib/helpers/utils/order-engine.js +59 -5
  10. package/lib/helpers/utils/platform-num.d.ts +1 -1
  11. package/lib/helpers/utils/platform-num.js +40 -22
  12. package/lib/helpers/utils/receipt-engine.js +69 -11
  13. package/lib/helpers/utils/selection-model.d.ts +3 -0
  14. package/lib/helpers/utils/selection-model.js +1 -0
  15. package/lib/helpers/utils/specials-helpers.d.ts +3 -3
  16. package/lib/helpers/utils/specials-helpers.js +44 -7
  17. package/lib/schemas/models/halfhalf_setup.d.ts +3 -3
  18. package/lib/schemas/models/items.d.ts +54 -0
  19. package/lib/schemas/models/items.js +11 -0
  20. package/lib/schemas/models/modifier_extras.d.ts +9 -9
  21. package/lib/schemas/models/orders.d.ts +981 -0
  22. package/lib/schemas/models/orders.js +5 -0
  23. package/lib/schemas/models/rewards_usage.d.ts +3 -3
  24. package/lib/schemas/models/tenant_cash_in_out.d.ts +3 -3
  25. package/lib/schemas/models/warehouse_internal_movements.d.ts +3 -3
  26. package/lib/schemas/models/warehouse_inventory_lot_serial_numbers.d.ts +3 -3
  27. package/lib/schemas/types/items.d.ts +3 -1
  28. package/lib/schemas/types/orders.d.ts +2 -1
  29. package/lib/tests/nested-halfhalf-segment-price.test.d.ts +1 -0
  30. package/lib/tests/nested-halfhalf-segment-price.test.js +224 -0
  31. package/lib/tests/receipt-engine.test.d.ts +1 -0
  32. package/lib/tests/receipt-engine.test.js +204 -0
  33. package/lib/tests/specials-halfhalf-options.test.d.ts +1 -0
  34. package/lib/tests/specials-halfhalf-options.test.js +328 -0
  35. package/package.json +1 -1
@@ -1130,6 +1130,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
1130
1130
  BASE_PRICE: number;
1131
1131
  } | null | undefined;
1132
1132
  }> | null | undefined;
1133
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
1134
+ choose_expensive_segment_price?: boolean | null | undefined;
1133
1135
  }, import("mongoose").Types.Subdocument<string, any, {
1134
1136
  _id: string;
1135
1137
  name: string;
@@ -1482,6 +1484,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
1482
1484
  BASE_PRICE: number;
1483
1485
  } | null | undefined;
1484
1486
  }> | null | undefined;
1487
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
1488
+ choose_expensive_segment_price?: boolean | null | undefined;
1485
1489
  }> & {
1486
1490
  _id: string;
1487
1491
  name: string;
@@ -1834,6 +1838,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
1834
1838
  BASE_PRICE: number;
1835
1839
  } | null | undefined;
1836
1840
  }> | null | undefined;
1841
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
1842
+ choose_expensive_segment_price?: boolean | null | undefined;
1837
1843
  }>;
1838
1844
  min_num_options?: number | null | undefined;
1839
1845
  max_num_options?: number | null | undefined;
@@ -2204,6 +2210,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
2204
2210
  BASE_PRICE: number;
2205
2211
  } | null | undefined;
2206
2212
  }> | null | undefined;
2213
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
2214
+ choose_expensive_segment_price?: boolean | null | undefined;
2207
2215
  }, import("mongoose").Types.Subdocument<string, any, {
2208
2216
  _id: string;
2209
2217
  name: string;
@@ -2556,6 +2564,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
2556
2564
  BASE_PRICE: number;
2557
2565
  } | null | undefined;
2558
2566
  }> | null | undefined;
2567
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
2568
+ choose_expensive_segment_price?: boolean | null | undefined;
2559
2569
  }> & {
2560
2570
  _id: string;
2561
2571
  name: string;
@@ -2908,6 +2918,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
2908
2918
  BASE_PRICE: number;
2909
2919
  } | null | undefined;
2910
2920
  }> | null | undefined;
2921
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
2922
+ choose_expensive_segment_price?: boolean | null | undefined;
2911
2923
  }>;
2912
2924
  min_num_options?: number | null | undefined;
2913
2925
  max_num_options?: number | null | undefined;
@@ -3278,6 +3290,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
3278
3290
  BASE_PRICE: number;
3279
3291
  } | null | undefined;
3280
3292
  }> | null | undefined;
3293
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
3294
+ choose_expensive_segment_price?: boolean | null | undefined;
3281
3295
  }, import("mongoose").Types.Subdocument<string, any, {
3282
3296
  _id: string;
3283
3297
  name: string;
@@ -3630,6 +3644,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
3630
3644
  BASE_PRICE: number;
3631
3645
  } | null | undefined;
3632
3646
  }> | null | undefined;
3647
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
3648
+ choose_expensive_segment_price?: boolean | null | undefined;
3633
3649
  }> & {
3634
3650
  _id: string;
3635
3651
  name: string;
@@ -3982,6 +3998,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
3982
3998
  BASE_PRICE: number;
3983
3999
  } | null | undefined;
3984
4000
  }> | null | undefined;
4001
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
4002
+ choose_expensive_segment_price?: boolean | null | undefined;
3985
4003
  }>;
3986
4004
  min_num_options?: number | null | undefined;
3987
4005
  max_num_options?: number | null | undefined;
@@ -4808,6 +4826,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
4808
4826
  BASE_PRICE: number;
4809
4827
  } | null | undefined;
4810
4828
  }> | null | undefined;
4829
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
4830
+ choose_expensive_segment_price?: boolean | null | undefined;
4811
4831
  }, import("mongoose").Types.Subdocument<string, any, {
4812
4832
  _id: string;
4813
4833
  name: string;
@@ -5160,6 +5180,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
5160
5180
  BASE_PRICE: number;
5161
5181
  } | null | undefined;
5162
5182
  }> | null | undefined;
5183
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
5184
+ choose_expensive_segment_price?: boolean | null | undefined;
5163
5185
  }> & {
5164
5186
  _id: string;
5165
5187
  name: string;
@@ -5512,6 +5534,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
5512
5534
  BASE_PRICE: number;
5513
5535
  } | null | undefined;
5514
5536
  }> | null | undefined;
5537
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
5538
+ choose_expensive_segment_price?: boolean | null | undefined;
5515
5539
  }>;
5516
5540
  min_num_options?: number | null | undefined;
5517
5541
  max_num_options?: number | null | undefined;
@@ -5882,6 +5906,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
5882
5906
  BASE_PRICE: number;
5883
5907
  } | null | undefined;
5884
5908
  }> | null | undefined;
5909
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
5910
+ choose_expensive_segment_price?: boolean | null | undefined;
5885
5911
  }, import("mongoose").Types.Subdocument<string, any, {
5886
5912
  _id: string;
5887
5913
  name: string;
@@ -6234,6 +6260,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
6234
6260
  BASE_PRICE: number;
6235
6261
  } | null | undefined;
6236
6262
  }> | null | undefined;
6263
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
6264
+ choose_expensive_segment_price?: boolean | null | undefined;
6237
6265
  }> & {
6238
6266
  _id: string;
6239
6267
  name: string;
@@ -6586,6 +6614,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
6586
6614
  BASE_PRICE: number;
6587
6615
  } | null | undefined;
6588
6616
  }> | null | undefined;
6617
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
6618
+ choose_expensive_segment_price?: boolean | null | undefined;
6589
6619
  }>;
6590
6620
  min_num_options?: number | null | undefined;
6591
6621
  max_num_options?: number | null | undefined;
@@ -6956,6 +6986,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
6956
6986
  BASE_PRICE: number;
6957
6987
  } | null | undefined;
6958
6988
  }> | null | undefined;
6989
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
6990
+ choose_expensive_segment_price?: boolean | null | undefined;
6959
6991
  }, import("mongoose").Types.Subdocument<string, any, {
6960
6992
  _id: string;
6961
6993
  name: string;
@@ -7308,6 +7340,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
7308
7340
  BASE_PRICE: number;
7309
7341
  } | null | undefined;
7310
7342
  }> | null | undefined;
7343
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
7344
+ choose_expensive_segment_price?: boolean | null | undefined;
7311
7345
  }> & {
7312
7346
  _id: string;
7313
7347
  name: string;
@@ -7660,6 +7694,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
7660
7694
  BASE_PRICE: number;
7661
7695
  } | null | undefined;
7662
7696
  }> | null | undefined;
7697
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
7698
+ choose_expensive_segment_price?: boolean | null | undefined;
7663
7699
  }>;
7664
7700
  min_num_options?: number | null | undefined;
7665
7701
  max_num_options?: number | null | undefined;
@@ -8486,6 +8522,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
8486
8522
  BASE_PRICE: number;
8487
8523
  } | null | undefined;
8488
8524
  }> | null | undefined;
8525
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
8526
+ choose_expensive_segment_price?: boolean | null | undefined;
8489
8527
  }, import("mongoose").Types.Subdocument<string, any, {
8490
8528
  _id: string;
8491
8529
  name: string;
@@ -8838,6 +8876,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
8838
8876
  BASE_PRICE: number;
8839
8877
  } | null | undefined;
8840
8878
  }> | null | undefined;
8879
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
8880
+ choose_expensive_segment_price?: boolean | null | undefined;
8841
8881
  }> & {
8842
8882
  _id: string;
8843
8883
  name: string;
@@ -9190,6 +9230,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
9190
9230
  BASE_PRICE: number;
9191
9231
  } | null | undefined;
9192
9232
  }> | null | undefined;
9233
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
9234
+ choose_expensive_segment_price?: boolean | null | undefined;
9193
9235
  }>;
9194
9236
  min_num_options?: number | null | undefined;
9195
9237
  max_num_options?: number | null | undefined;
@@ -9560,6 +9602,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
9560
9602
  BASE_PRICE: number;
9561
9603
  } | null | undefined;
9562
9604
  }> | null | undefined;
9605
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
9606
+ choose_expensive_segment_price?: boolean | null | undefined;
9563
9607
  }, import("mongoose").Types.Subdocument<string, any, {
9564
9608
  _id: string;
9565
9609
  name: string;
@@ -9912,6 +9956,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
9912
9956
  BASE_PRICE: number;
9913
9957
  } | null | undefined;
9914
9958
  }> | null | undefined;
9959
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
9960
+ choose_expensive_segment_price?: boolean | null | undefined;
9915
9961
  }> & {
9916
9962
  _id: string;
9917
9963
  name: string;
@@ -10264,6 +10310,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
10264
10310
  BASE_PRICE: number;
10265
10311
  } | null | undefined;
10266
10312
  }> | null | undefined;
10313
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
10314
+ choose_expensive_segment_price?: boolean | null | undefined;
10267
10315
  }>;
10268
10316
  min_num_options?: number | null | undefined;
10269
10317
  max_num_options?: number | null | undefined;
@@ -10634,6 +10682,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
10634
10682
  BASE_PRICE: number;
10635
10683
  } | null | undefined;
10636
10684
  }> | null | undefined;
10685
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
10686
+ choose_expensive_segment_price?: boolean | null | undefined;
10637
10687
  }, import("mongoose").Types.Subdocument<string, any, {
10638
10688
  _id: string;
10639
10689
  name: string;
@@ -10986,6 +11036,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
10986
11036
  BASE_PRICE: number;
10987
11037
  } | null | undefined;
10988
11038
  }> | null | undefined;
11039
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
11040
+ choose_expensive_segment_price?: boolean | null | undefined;
10989
11041
  }> & {
10990
11042
  _id: string;
10991
11043
  name: string;
@@ -11338,6 +11390,8 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
11338
11390
  BASE_PRICE: number;
11339
11391
  } | null | undefined;
11340
11392
  }> | null | undefined;
11393
+ ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
11394
+ choose_expensive_segment_price?: boolean | null | undefined;
11341
11395
  }>;
11342
11396
  min_num_options?: number | null | undefined;
11343
11397
  max_num_options?: number | null | undefined;
@@ -123,6 +123,17 @@ const OptionSchema = new mongoose_1.Schema({
123
123
  type: [exports.SpecialHoursSchema],
124
124
  required: false,
125
125
  },
126
+ // Only set when the option IS a menu item / half-half (e.g. options of a
127
+ // special's modifier group or half-half segment choices).
128
+ ref_type: {
129
+ type: String,
130
+ enum: constants_1.ALL_MODIFIER_OPTION_REF_TYPES,
131
+ required: false,
132
+ }, // Only set on a HALF_HALF option nested in a special (its setup flag).
133
+ choose_expensive_segment_price: {
134
+ type: Boolean,
135
+ required: false,
136
+ },
126
137
  });
127
138
  const ModifiersSchema = new mongoose_1.Schema({
128
139
  _id: {
@@ -70,8 +70,8 @@ export declare const ModifierExtraSchema: Schema<any, import("mongoose").Model<a
70
70
  BASE_PRICE: number;
71
71
  };
72
72
  sold_out: string[];
73
- ref_id: string;
74
73
  ref_type: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM;
74
+ ref_id: string;
75
75
  multiplier?: number | null | undefined;
76
76
  }, import("mongoose").Types.Subdocument<string, any, {
77
77
  _id: string;
@@ -121,8 +121,8 @@ export declare const ModifierExtraSchema: Schema<any, import("mongoose").Model<a
121
121
  BASE_PRICE: number;
122
122
  };
123
123
  sold_out: string[];
124
- ref_id: string;
125
124
  ref_type: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM;
125
+ ref_id: string;
126
126
  multiplier?: number | null | undefined;
127
127
  }> & {
128
128
  _id: string;
@@ -172,8 +172,8 @@ export declare const ModifierExtraSchema: Schema<any, import("mongoose").Model<a
172
172
  BASE_PRICE: number;
173
173
  };
174
174
  sold_out: string[];
175
- ref_id: string;
176
175
  ref_type: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM;
176
+ ref_id: string;
177
177
  multiplier?: number | null | undefined;
178
178
  }>;
179
179
  min_num_options?: number | null | undefined;
@@ -244,8 +244,8 @@ export declare const ModifierExtraSchema: Schema<any, import("mongoose").Model<a
244
244
  BASE_PRICE: number;
245
245
  };
246
246
  sold_out: string[];
247
- ref_id: string;
248
247
  ref_type: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM;
248
+ ref_id: string;
249
249
  multiplier?: number | null | undefined;
250
250
  }, import("mongoose").Types.Subdocument<string, any, {
251
251
  _id: string;
@@ -295,8 +295,8 @@ export declare const ModifierExtraSchema: Schema<any, import("mongoose").Model<a
295
295
  BASE_PRICE: number;
296
296
  };
297
297
  sold_out: string[];
298
- ref_id: string;
299
298
  ref_type: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM;
299
+ ref_id: string;
300
300
  multiplier?: number | null | undefined;
301
301
  }> & {
302
302
  _id: string;
@@ -346,8 +346,8 @@ export declare const ModifierExtraSchema: Schema<any, import("mongoose").Model<a
346
346
  BASE_PRICE: number;
347
347
  };
348
348
  sold_out: string[];
349
- ref_id: string;
350
349
  ref_type: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM;
350
+ ref_id: string;
351
351
  multiplier?: number | null | undefined;
352
352
  }>;
353
353
  min_num_options?: number | null | undefined;
@@ -418,8 +418,8 @@ export declare const ModifierExtraSchema: Schema<any, import("mongoose").Model<a
418
418
  BASE_PRICE: number;
419
419
  };
420
420
  sold_out: string[];
421
- ref_id: string;
422
421
  ref_type: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM;
422
+ ref_id: string;
423
423
  multiplier?: number | null | undefined;
424
424
  }, import("mongoose").Types.Subdocument<string, any, {
425
425
  _id: string;
@@ -469,8 +469,8 @@ export declare const ModifierExtraSchema: Schema<any, import("mongoose").Model<a
469
469
  BASE_PRICE: number;
470
470
  };
471
471
  sold_out: string[];
472
- ref_id: string;
473
472
  ref_type: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM;
473
+ ref_id: string;
474
474
  multiplier?: number | null | undefined;
475
475
  }> & {
476
476
  _id: string;
@@ -520,8 +520,8 @@ export declare const ModifierExtraSchema: Schema<any, import("mongoose").Model<a
520
520
  BASE_PRICE: number;
521
521
  };
522
522
  sold_out: string[];
523
- ref_id: string;
524
523
  ref_type: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM;
524
+ ref_id: string;
525
525
  multiplier?: number | null | undefined;
526
526
  }>;
527
527
  min_num_options?: number | null | undefined;