@managesome/eposmatic-toolkit 0.2.709 → 0.2.710
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/lib/constants/ENUMS.d.ts +1 -0
- package/lib/constants/ENUMS.js +1 -0
- package/lib/helpers/types/catalog.d.ts +2 -1
- package/lib/helpers/utils/halfhalf-setup-helpers.js +2 -0
- package/lib/helpers/utils/minified-catalog.js +2 -0
- package/lib/helpers/utils/order-engine.js +3 -0
- package/lib/helpers/utils/receipt-engine.js +62 -11
- package/lib/helpers/utils/selection-model.d.ts +3 -0
- package/lib/helpers/utils/selection-model.js +1 -0
- package/lib/helpers/utils/specials-helpers.d.ts +3 -3
- package/lib/helpers/utils/specials-helpers.js +39 -7
- package/lib/schemas/models/items.d.ts +27 -0
- package/lib/schemas/models/items.js +7 -0
- package/lib/schemas/models/modifier_extras.d.ts +9 -9
- package/lib/schemas/models/orders.d.ts +981 -0
- package/lib/schemas/models/orders.js +5 -0
- package/lib/schemas/models/rewards_usage.d.ts +3 -3
- package/lib/schemas/models/tenant_cash_in_out.d.ts +3 -3
- package/lib/schemas/models/warehouse_internal_movements.d.ts +3 -3
- package/lib/schemas/models/warehouse_inventory_lot_serial_numbers.d.ts +3 -3
- package/lib/schemas/types/items.d.ts +2 -1
- package/lib/schemas/types/orders.d.ts +2 -1
- package/lib/tests/receipt-engine.test.d.ts +1 -0
- package/lib/tests/receipt-engine.test.js +204 -0
- package/lib/tests/specials-halfhalf-options.test.d.ts +1 -0
- package/lib/tests/specials-halfhalf-options.test.js +327 -0
- package/package.json +1 -1
package/lib/constants/ENUMS.d.ts
CHANGED
|
@@ -1011,6 +1011,7 @@ export declare enum ONLINE_ORDERING_DESIGN_TYPE_ENUM {
|
|
|
1011
1011
|
export declare const ALL_ONLINE_ORDERING_DESIGN_TYPES: ONLINE_ORDERING_DESIGN_TYPE_ENUM[];
|
|
1012
1012
|
export declare enum MODIFIER_OPTION_REF_TYPE_ENUM {
|
|
1013
1013
|
ITEM = "ITEM",
|
|
1014
|
+
HALF_HALF = "HALF_HALF",
|
|
1014
1015
|
OPTION = "OPTION"
|
|
1015
1016
|
}
|
|
1016
1017
|
export declare const ALL_MODIFIER_OPTION_REF_TYPES: MODIFIER_OPTION_REF_TYPE_ENUM[];
|
package/lib/constants/ENUMS.js
CHANGED
|
@@ -1662,6 +1662,7 @@ exports.ALL_ONLINE_ORDERING_DESIGN_TYPES = Object.values(ONLINE_ORDERING_DESIGN_
|
|
|
1662
1662
|
var MODIFIER_OPTION_REF_TYPE_ENUM;
|
|
1663
1663
|
(function (MODIFIER_OPTION_REF_TYPE_ENUM) {
|
|
1664
1664
|
MODIFIER_OPTION_REF_TYPE_ENUM["ITEM"] = "ITEM";
|
|
1665
|
+
MODIFIER_OPTION_REF_TYPE_ENUM["HALF_HALF"] = "HALF_HALF";
|
|
1665
1666
|
MODIFIER_OPTION_REF_TYPE_ENUM["OPTION"] = "OPTION";
|
|
1666
1667
|
})(MODIFIER_OPTION_REF_TYPE_ENUM || (exports.MODIFIER_OPTION_REF_TYPE_ENUM = MODIFIER_OPTION_REF_TYPE_ENUM = {}));
|
|
1667
1668
|
exports.ALL_MODIFIER_OPTION_REF_TYPES = Object.values(MODIFIER_OPTION_REF_TYPE_ENUM);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CATEGORY_DISPLAY_TYPE_ENUM, DAY_INDEX_ENUM, ITEM_CAVEATS_ENUM, ITEM_DIETARY_PREFERENCE_ENUM, PLATFORMS_ENUM } from '../../constants';
|
|
1
|
+
import { CATEGORY_DISPLAY_TYPE_ENUM, DAY_INDEX_ENUM, ITEM_CAVEATS_ENUM, ITEM_DIETARY_PREFERENCE_ENUM, MODIFIER_OPTION_REF_TYPE_ENUM, PLATFORMS_ENUM } from '../../constants';
|
|
2
2
|
import { ICategory, IItem, IItemSpecialHour } from '../../schemas';
|
|
3
3
|
import { IPrice } from '../../schemas/types/common';
|
|
4
4
|
export interface ICatalog extends ICategory {
|
|
@@ -33,6 +33,7 @@ export interface IMinifiedModifierOption {
|
|
|
33
33
|
price?: IMinifiedPrice;
|
|
34
34
|
item_modifier_option_special_hours?: IMinifiedItemSpecialHour[] | null;
|
|
35
35
|
modifiers?: IMinifiedModifier[] | null;
|
|
36
|
+
ref_type?: MODIFIER_OPTION_REF_TYPE_ENUM;
|
|
36
37
|
_id: string;
|
|
37
38
|
ref: string;
|
|
38
39
|
name: string;
|
|
@@ -393,6 +393,8 @@ function convertHalfHalfToItem(halfhalfSetup, itemsMap) {
|
|
|
393
393
|
active: catalogItem.active,
|
|
394
394
|
sold_out: catalogItem.sold_out,
|
|
395
395
|
sort_id: sortId,
|
|
396
|
+
// Each segment choice IS a menu item.
|
|
397
|
+
ref_type: constants_1.MODIFIER_OPTION_REF_TYPE_ENUM.ITEM,
|
|
396
398
|
// Derived from the source item's included platforms (pure mapping),
|
|
397
399
|
// so platform availability can be applied by the filter layer downstream.
|
|
398
400
|
excluded_platforms: (0, platform_catalog_1.getExcludedPlatformsFromIncludedPlatforms)(catalogItem.included_platforms),
|
|
@@ -87,6 +87,7 @@ function convertMinifiedModifierOptionsToOriginalModifierOptions(options, tenant
|
|
|
87
87
|
modifiers,
|
|
88
88
|
ingredients,
|
|
89
89
|
item_modifier_option_special_hours,
|
|
90
|
+
ref_type: option.ref_type,
|
|
90
91
|
// required properties
|
|
91
92
|
_id,
|
|
92
93
|
ref,
|
|
@@ -278,6 +279,7 @@ function convertOriginalModifierOptionsToMinifiedModifierOptions(options, tenant
|
|
|
278
279
|
price,
|
|
279
280
|
item_modifier_option_special_hours,
|
|
280
281
|
modifiers,
|
|
282
|
+
ref_type: option.ref_type,
|
|
281
283
|
// required properties
|
|
282
284
|
_id: option._id,
|
|
283
285
|
ref: option.ref,
|
|
@@ -584,6 +584,9 @@ function convertOrderEngineOptionsToOrderItemOptions(options, tenantId) {
|
|
|
584
584
|
price: option.price,
|
|
585
585
|
quantity: option.quantity,
|
|
586
586
|
is_free: option.is_free,
|
|
587
|
+
// Item / half-half options carry their ref_type; normal modifier
|
|
588
|
+
// options omit it.
|
|
589
|
+
...(option.ref_type != null ? { ref_type: option.ref_type } : {}),
|
|
587
590
|
modifiers: convertOrderEngineModifiersToOrderItemModifiers(option.modifiers, tenantId),
|
|
588
591
|
});
|
|
589
592
|
}
|
|
@@ -461,25 +461,72 @@ function getReceiptBody({ orderItems, currency_symbol, show_modifiers, display_m
|
|
|
461
461
|
// =========================><=========================
|
|
462
462
|
/**
|
|
463
463
|
* For a SPECIAL / HALF_HALF order item (a deal or half-half pizza), the
|
|
464
|
-
* top-level modifiers hold the real constituent items as options
|
|
465
|
-
*
|
|
464
|
+
* top-level modifiers hold the real constituent items as options. Each option
|
|
465
|
+
* carries a `ref_type` (MODIFIER_OPTION_REF_TYPE_ENUM):
|
|
466
|
+
* - ITEM -> the option `ref` is a real menu product id. It can NEVER contain
|
|
467
|
+
* nested ITEM / HALF_HALF options - it is filtered by partial-menu membership
|
|
468
|
+
* only, never recursed;
|
|
469
|
+
* - HALF_HALF -> the option `ref` is a real menu product id, and its OWN
|
|
470
|
+
* top-level modifiers (segment groups) hold options with ref_type ITEM - so
|
|
471
|
+
* filtering IS applied recursively there;
|
|
472
|
+
* - OPTION (or unset) -> a regular modifier option (size, topping, ...). It is
|
|
473
|
+
* a terminal leaf: it never contains nested ITEM / HALF_HALF options, so it
|
|
474
|
+
* passes through fully (never partialed).
|
|
466
475
|
*
|
|
467
|
-
*
|
|
468
|
-
* -
|
|
476
|
+
* Only options whose ref_type is ITEM or HALF_HALF qualify for partial
|
|
477
|
+
* printing - including at the top level. In partial printing these composite
|
|
478
|
+
* products must not be printed blindly:
|
|
479
|
+
* - ITEM / HALF_HALF options whose product is not selected in ANY included
|
|
480
|
+
* category are dropped (they belong to another partial menu / KOT);
|
|
481
|
+
* - a HALF_HALF option whose nested constituent parts are all dropped is
|
|
482
|
+
* dropped as well (nothing printable remains);
|
|
469
483
|
* - a modifier left with no options is dropped;
|
|
470
484
|
* - if every modifier is dropped the whole item is dropped as well.
|
|
471
485
|
*
|
|
472
486
|
* Returns a shallow-cloned item with the trimmed modifiers, or null when
|
|
473
487
|
* nothing survives the filter.
|
|
474
488
|
*/
|
|
475
|
-
function
|
|
489
|
+
function getTrimmedCompositeModifiers(modifiers, includedItemIds) {
|
|
476
490
|
const trimmedModifiers = [];
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
491
|
+
for (let i = 0; i < modifiers.length; i++) {
|
|
492
|
+
const modifier = modifiers[i];
|
|
493
|
+
const keptOptions = [];
|
|
494
|
+
for (let j = 0; j < modifier.options.length; j++) {
|
|
495
|
+
const option = modifier.options[j];
|
|
496
|
+
const isItemLike = option.ref_type === constants_1.MODIFIER_OPTION_REF_TYPE_ENUM.ITEM ||
|
|
497
|
+
option.ref_type === constants_1.MODIFIER_OPTION_REF_TYPE_ENUM.HALF_HALF;
|
|
498
|
+
// A normal modifier option (OPTION / unset) is a terminal leaf: it
|
|
499
|
+
// passes through fully, never filtered and never recursed.
|
|
500
|
+
if (!isItemLike) {
|
|
501
|
+
keptOptions.push(option);
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
// ITEM / HALF_HALF options are real menu products: keep them only when
|
|
505
|
+
// the product is part of the partial menu.
|
|
506
|
+
if (!includedItemIds.has(option.ref))
|
|
507
|
+
continue;
|
|
508
|
+
// An ITEM option can never contain nested item-like options, so it is
|
|
509
|
+
// kept as-is (no recursion).
|
|
510
|
+
if (option.ref_type === constants_1.MODIFIER_OPTION_REF_TYPE_ENUM.ITEM) {
|
|
511
|
+
keptOptions.push(option);
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
// A HALF_HALF option holds its own segment modifier groups, whose
|
|
515
|
+
// options are ITEM refs - recurse into them for filtering.
|
|
516
|
+
const nestedModifiers = option.modifiers != null ? getTrimmedCompositeModifiers(option.modifiers, includedItemIds) : null;
|
|
517
|
+
// A HALF_HALF option that had constituent parts but none survived the
|
|
518
|
+
// filter has nothing printable left -> drop it as well.
|
|
519
|
+
if (option.modifiers != null &&
|
|
520
|
+
option.modifiers.length > 0 &&
|
|
521
|
+
nestedModifiers != null &&
|
|
522
|
+
nestedModifiers.length === 0) {
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
keptOptions.push({
|
|
526
|
+
...option,
|
|
527
|
+
modifiers: nestedModifiers,
|
|
528
|
+
});
|
|
529
|
+
}
|
|
483
530
|
if (keptOptions.length === 0)
|
|
484
531
|
continue;
|
|
485
532
|
trimmedModifiers.push({
|
|
@@ -487,6 +534,10 @@ function getPartiallyIncludedCompositeItem(item, includedItemIds) {
|
|
|
487
534
|
options: keptOptions,
|
|
488
535
|
});
|
|
489
536
|
}
|
|
537
|
+
return trimmedModifiers;
|
|
538
|
+
}
|
|
539
|
+
function getPartiallyIncludedCompositeItem(item, includedItemIds) {
|
|
540
|
+
const trimmedModifiers = getTrimmedCompositeModifiers(item.modifiers ?? [], includedItemIds);
|
|
490
541
|
if (trimmedModifiers.length === 0)
|
|
491
542
|
return null;
|
|
492
543
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MODIFIER_OPTION_REF_TYPE_ENUM } from '../../constants';
|
|
1
2
|
import { IOrderModifier } from '../../schemas';
|
|
2
3
|
export interface ISelectionOption {
|
|
3
4
|
/** Deterministic semantic identity — the catalog item `_id`. */
|
|
@@ -8,6 +9,8 @@ export interface ISelectionOption {
|
|
|
8
9
|
price: number;
|
|
9
10
|
quantity: number;
|
|
10
11
|
is_free: boolean;
|
|
12
|
+
/** Only set when the option IS an item / half-half. */
|
|
13
|
+
ref_type?: MODIFIER_OPTION_REF_TYPE_ENUM;
|
|
11
14
|
modifiers: IOrderModifier[] | null;
|
|
12
15
|
}
|
|
13
16
|
export interface ISelectionGroup {
|
|
@@ -23,6 +23,7 @@ function buildStoredFromSelection(groups) {
|
|
|
23
23
|
price: option.price,
|
|
24
24
|
quantity: option.quantity,
|
|
25
25
|
is_free: option.is_free,
|
|
26
|
+
...(option.ref_type != null ? { ref_type: option.ref_type } : {}),
|
|
26
27
|
modifiers: option.modifiers ?? null,
|
|
27
28
|
}));
|
|
28
29
|
modifiers.push({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PLATFORMS_ENUM } from '../../constants';
|
|
2
|
-
import { IItem, IModifier, IOrderItem, ISpecial } from '../../schemas';
|
|
2
|
+
import { IHalfHalfSetup, IItem, IModifier, IOrderItem, ISpecial } from '../../schemas';
|
|
3
3
|
import { ISimplifiedCatalogItem } from '../types';
|
|
4
4
|
export declare function getSpecialsPostedData(data: ISpecial[], payload: ISpecial): ISpecial[];
|
|
5
5
|
export declare function renderBulkSpecialsUpdate(data: ISpecial[], payload: Partial<ISpecial>[]): ISpecial[];
|
|
@@ -39,7 +39,7 @@ export type IWorkableSpecialMenu<T extends IItem | ISimplifiedCatalogItem> = {
|
|
|
39
39
|
* Returns null when nothing is left after exclusion.
|
|
40
40
|
*/
|
|
41
41
|
export declare function applyModifierSpecialRefRules(modifiers: IModifier[] | null | undefined, exclusiveRefs: string[], excludedRefs: string[]): IModifier[] | null;
|
|
42
|
-
export declare function convertSpecialsToWorkableSpecials<T extends IItem | ISimplifiedCatalogItem>(specials: ISpecial[], itemsMap: Record<string, T>, platform: PLATFORMS_ENUM | undefined, tenant_id: string | undefined): IWorkableSpecialMenu<T>[];
|
|
42
|
+
export declare function convertSpecialsToWorkableSpecials<T extends IItem | ISimplifiedCatalogItem>(specials: ISpecial[], itemsMap: Record<string, T>, platform: PLATFORMS_ENUM | undefined, tenant_id: string | undefined, halfhalfSetups?: Record<string, IHalfHalfSetup>): IWorkableSpecialMenu<T>[];
|
|
43
43
|
export interface IModifierSpecials {
|
|
44
44
|
_id: string;
|
|
45
45
|
selectedItems: (IOrderItem | null)[];
|
|
@@ -94,5 +94,5 @@ export declare function deStructureSpecialOrderItem(orderItem: IOrderItem, speci
|
|
|
94
94
|
*
|
|
95
95
|
* Returns null only when no option can be resolved from the items map.
|
|
96
96
|
*/
|
|
97
|
-
export declare function convertSpecialToItem(special: ISpecial, itemsMap: Record<string, IItem>): IItem | null;
|
|
97
|
+
export declare function convertSpecialToItem(special: ISpecial, itemsMap: Record<string, IItem>, halfhalfSetups?: Record<string, IHalfHalfSetup>): IItem | null;
|
|
98
98
|
export {};
|
|
@@ -16,6 +16,7 @@ exports.convertSpecialToItem = convertSpecialToItem;
|
|
|
16
16
|
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
17
17
|
const constants_1 = require("../../constants");
|
|
18
18
|
const store_1 = require("../store");
|
|
19
|
+
const halfhalf_setup_helpers_1 = require("./halfhalf-setup-helpers");
|
|
19
20
|
const order_engine_1 = require("./order-engine");
|
|
20
21
|
const platform_catalog_1 = require("./platform-catalog");
|
|
21
22
|
const platform_num_1 = require("./platform-num");
|
|
@@ -116,7 +117,7 @@ function applyModifierSpecialRefRules(modifiers, exclusiveRefs, excludedRefs) {
|
|
|
116
117
|
const withOptions = result.filter((modifier) => modifier.options.length > 0);
|
|
117
118
|
return withOptions.length > 0 ? withOptions : null;
|
|
118
119
|
}
|
|
119
|
-
function convertSpecialsToWorkableSpecials(specials, itemsMap, platform, tenant_id) {
|
|
120
|
+
function convertSpecialsToWorkableSpecials(specials, itemsMap, platform, tenant_id, halfhalfSetups) {
|
|
120
121
|
if (!platform || !tenant_id)
|
|
121
122
|
return [];
|
|
122
123
|
const isSimple = typeof itemsMap[Object.keys(itemsMap)[0]]?.sold_out === 'boolean';
|
|
@@ -155,11 +156,19 @@ function convertSpecialsToWorkableSpecials(specials, itemsMap, platform, tenant_
|
|
|
155
156
|
const modifierSpecialItems = [...modifierSpecial.items];
|
|
156
157
|
modifierSpecialItems.sort((a, b) => a.sort_id - b.sort_id);
|
|
157
158
|
const items = [];
|
|
159
|
+
// A modifier group can list half-half setups instead of catalog items;
|
|
160
|
+
// they are rendered/selected through the classic preview separately, but
|
|
161
|
+
// they keep the group non-empty so the special stays selectable.
|
|
162
|
+
let hasHalfHalfRef = false;
|
|
158
163
|
for (let k = 0; k < modifierSpecialItems.length; k++) {
|
|
159
164
|
const item = modifierSpecial.items[k];
|
|
160
165
|
const catalogItem = itemsMap[item.item_id];
|
|
161
|
-
if (!catalogItem)
|
|
166
|
+
if (!catalogItem) {
|
|
167
|
+
if (halfhalfSetups != null && halfhalfSetups[item.item_id] != null) {
|
|
168
|
+
hasHalfHalfRef = true;
|
|
169
|
+
}
|
|
162
170
|
continue;
|
|
171
|
+
}
|
|
163
172
|
const workableItem = (0, platform_catalog_1.convertItemToWorkableItem)(catalogItem, platform, tenant_id, omitItemLevelSchedule, true);
|
|
164
173
|
if (!workableItem)
|
|
165
174
|
continue;
|
|
@@ -175,9 +184,10 @@ function convertSpecialsToWorkableSpecials(specials, itemsMap, platform, tenant_
|
|
|
175
184
|
workableItem.modifiers = applyModifierSpecialRefRules(workableItem.modifiers, modifierSpecial.exclusive_refs, modifierSpecial.excluded_refs);
|
|
176
185
|
items.push(workableItem);
|
|
177
186
|
}
|
|
178
|
-
// A modifier group with zero items makes the special invalid
|
|
179
|
-
// completed) —
|
|
180
|
-
|
|
187
|
+
// A modifier group with zero resolvable items makes the special invalid
|
|
188
|
+
// (cannot be completed) — unless it only references half-half setups
|
|
189
|
+
// (selectable via the classic preview, kept as a selectable group).
|
|
190
|
+
if (items.length === 0 && !hasHalfHalfRef) {
|
|
181
191
|
hasEmptyGroup = true;
|
|
182
192
|
continue;
|
|
183
193
|
}
|
|
@@ -241,6 +251,10 @@ function convertSpecialItemToOrderItem({ specialItem, modifierSpecials, quantity
|
|
|
241
251
|
quantity: selectedItem.quantity,
|
|
242
252
|
modifiers: selectedItem.modifiers,
|
|
243
253
|
is_free: false,
|
|
254
|
+
// The option IS an item or a half-half — carry its kind.
|
|
255
|
+
ref_type: selectedItem.item_type === constants_1.ORDER_ITEM_TYPE_ENUM.HALF_HALF
|
|
256
|
+
? constants_1.MODIFIER_OPTION_REF_TYPE_ENUM.HALF_HALF
|
|
257
|
+
: constants_1.MODIFIER_OPTION_REF_TYPE_ENUM.ITEM,
|
|
244
258
|
});
|
|
245
259
|
}
|
|
246
260
|
// Mark the cheapest N selected items as free (num_free_items), same as the
|
|
@@ -273,6 +287,7 @@ function convertSpecialItemToOrderItem({ specialItem, modifierSpecials, quantity
|
|
|
273
287
|
price: option.price,
|
|
274
288
|
quantity: option.quantity,
|
|
275
289
|
is_free: option.is_free,
|
|
290
|
+
...(option.ref_type != null ? { ref_type: option.ref_type } : {}),
|
|
276
291
|
modifiers: option.modifiers ?? null,
|
|
277
292
|
})),
|
|
278
293
|
});
|
|
@@ -406,7 +421,7 @@ function deStructureSpecialOrderItem(orderItem, specialItem) {
|
|
|
406
421
|
*
|
|
407
422
|
* Returns null only when no option can be resolved from the items map.
|
|
408
423
|
*/
|
|
409
|
-
function convertSpecialToItem(special, itemsMap) {
|
|
424
|
+
function convertSpecialToItem(special, itemsMap, halfhalfSetups) {
|
|
410
425
|
// Fields are carried through as-is (no schedule resolution here).
|
|
411
426
|
const price = special.price;
|
|
412
427
|
const discount_amount = special.discount_amount;
|
|
@@ -423,7 +438,21 @@ function convertSpecialToItem(special, itemsMap) {
|
|
|
423
438
|
const options = [];
|
|
424
439
|
for (let k = 0; k < modifierSpecialItems.length; k++) {
|
|
425
440
|
const specialItem = modifierSpecialItems[k];
|
|
426
|
-
|
|
441
|
+
let catalogItem = itemsMap[specialItem.item_id];
|
|
442
|
+
// A modifier_special item can reference a half-half setup instead of a
|
|
443
|
+
// regular catalog item: convert it to an IItem (each segment becomes a
|
|
444
|
+
// nested single-select modifier) so it flows like any other option.
|
|
445
|
+
let isHalfHalfOption = false;
|
|
446
|
+
if (catalogItem == null && halfhalfSetups != null) {
|
|
447
|
+
const halfhalfSetup = halfhalfSetups[specialItem.item_id];
|
|
448
|
+
if (halfhalfSetup != null) {
|
|
449
|
+
const halfhalfItem = (0, halfhalf_setup_helpers_1.convertHalfHalfToItem)(halfhalfSetup, itemsMap);
|
|
450
|
+
if (halfhalfItem != null) {
|
|
451
|
+
catalogItem = halfhalfItem;
|
|
452
|
+
isHalfHalfOption = true;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
427
456
|
if (!catalogItem)
|
|
428
457
|
continue;
|
|
429
458
|
allKeywords.push(...(catalogItem.keywords ?? []));
|
|
@@ -451,6 +480,9 @@ function convertSpecialToItem(special, itemsMap) {
|
|
|
451
480
|
active: catalogItem.active,
|
|
452
481
|
sold_out: catalogItem.sold_out,
|
|
453
482
|
sort_id: specialItem.sort_id,
|
|
483
|
+
// This option IS a menu item (or a half-half) — carry its kind so
|
|
484
|
+
// downstream order items can tell item/half-half options apart.
|
|
485
|
+
ref_type: isHalfHalfOption ? constants_1.MODIFIER_OPTION_REF_TYPE_ENUM.HALF_HALF : constants_1.MODIFIER_OPTION_REF_TYPE_ENUM.ITEM,
|
|
454
486
|
// Derived from the source item's included platforms (pure mapping),
|
|
455
487
|
// so platform availability can be applied by the filter layer downstream.
|
|
456
488
|
excluded_platforms: (0, platform_catalog_1.getExcludedPlatformsFromIncludedPlatforms)(catalogItem.included_platforms),
|
|
@@ -1130,6 +1130,7 @@ 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;
|
|
1133
1134
|
}, import("mongoose").Types.Subdocument<string, any, {
|
|
1134
1135
|
_id: string;
|
|
1135
1136
|
name: string;
|
|
@@ -1482,6 +1483,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
1482
1483
|
BASE_PRICE: number;
|
|
1483
1484
|
} | null | undefined;
|
|
1484
1485
|
}> | null | undefined;
|
|
1486
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
1485
1487
|
}> & {
|
|
1486
1488
|
_id: string;
|
|
1487
1489
|
name: string;
|
|
@@ -1834,6 +1836,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
1834
1836
|
BASE_PRICE: number;
|
|
1835
1837
|
} | null | undefined;
|
|
1836
1838
|
}> | null | undefined;
|
|
1839
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
1837
1840
|
}>;
|
|
1838
1841
|
min_num_options?: number | null | undefined;
|
|
1839
1842
|
max_num_options?: number | null | undefined;
|
|
@@ -2204,6 +2207,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
2204
2207
|
BASE_PRICE: number;
|
|
2205
2208
|
} | null | undefined;
|
|
2206
2209
|
}> | null | undefined;
|
|
2210
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
2207
2211
|
}, import("mongoose").Types.Subdocument<string, any, {
|
|
2208
2212
|
_id: string;
|
|
2209
2213
|
name: string;
|
|
@@ -2556,6 +2560,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
2556
2560
|
BASE_PRICE: number;
|
|
2557
2561
|
} | null | undefined;
|
|
2558
2562
|
}> | null | undefined;
|
|
2563
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
2559
2564
|
}> & {
|
|
2560
2565
|
_id: string;
|
|
2561
2566
|
name: string;
|
|
@@ -2908,6 +2913,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
2908
2913
|
BASE_PRICE: number;
|
|
2909
2914
|
} | null | undefined;
|
|
2910
2915
|
}> | null | undefined;
|
|
2916
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
2911
2917
|
}>;
|
|
2912
2918
|
min_num_options?: number | null | undefined;
|
|
2913
2919
|
max_num_options?: number | null | undefined;
|
|
@@ -3278,6 +3284,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
3278
3284
|
BASE_PRICE: number;
|
|
3279
3285
|
} | null | undefined;
|
|
3280
3286
|
}> | null | undefined;
|
|
3287
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
3281
3288
|
}, import("mongoose").Types.Subdocument<string, any, {
|
|
3282
3289
|
_id: string;
|
|
3283
3290
|
name: string;
|
|
@@ -3630,6 +3637,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
3630
3637
|
BASE_PRICE: number;
|
|
3631
3638
|
} | null | undefined;
|
|
3632
3639
|
}> | null | undefined;
|
|
3640
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
3633
3641
|
}> & {
|
|
3634
3642
|
_id: string;
|
|
3635
3643
|
name: string;
|
|
@@ -3982,6 +3990,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
3982
3990
|
BASE_PRICE: number;
|
|
3983
3991
|
} | null | undefined;
|
|
3984
3992
|
}> | null | undefined;
|
|
3993
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
3985
3994
|
}>;
|
|
3986
3995
|
min_num_options?: number | null | undefined;
|
|
3987
3996
|
max_num_options?: number | null | undefined;
|
|
@@ -4808,6 +4817,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
4808
4817
|
BASE_PRICE: number;
|
|
4809
4818
|
} | null | undefined;
|
|
4810
4819
|
}> | null | undefined;
|
|
4820
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
4811
4821
|
}, import("mongoose").Types.Subdocument<string, any, {
|
|
4812
4822
|
_id: string;
|
|
4813
4823
|
name: string;
|
|
@@ -5160,6 +5170,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
5160
5170
|
BASE_PRICE: number;
|
|
5161
5171
|
} | null | undefined;
|
|
5162
5172
|
}> | null | undefined;
|
|
5173
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
5163
5174
|
}> & {
|
|
5164
5175
|
_id: string;
|
|
5165
5176
|
name: string;
|
|
@@ -5512,6 +5523,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
5512
5523
|
BASE_PRICE: number;
|
|
5513
5524
|
} | null | undefined;
|
|
5514
5525
|
}> | null | undefined;
|
|
5526
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
5515
5527
|
}>;
|
|
5516
5528
|
min_num_options?: number | null | undefined;
|
|
5517
5529
|
max_num_options?: number | null | undefined;
|
|
@@ -5882,6 +5894,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
5882
5894
|
BASE_PRICE: number;
|
|
5883
5895
|
} | null | undefined;
|
|
5884
5896
|
}> | null | undefined;
|
|
5897
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
5885
5898
|
}, import("mongoose").Types.Subdocument<string, any, {
|
|
5886
5899
|
_id: string;
|
|
5887
5900
|
name: string;
|
|
@@ -6234,6 +6247,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
6234
6247
|
BASE_PRICE: number;
|
|
6235
6248
|
} | null | undefined;
|
|
6236
6249
|
}> | null | undefined;
|
|
6250
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
6237
6251
|
}> & {
|
|
6238
6252
|
_id: string;
|
|
6239
6253
|
name: string;
|
|
@@ -6586,6 +6600,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
6586
6600
|
BASE_PRICE: number;
|
|
6587
6601
|
} | null | undefined;
|
|
6588
6602
|
}> | null | undefined;
|
|
6603
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
6589
6604
|
}>;
|
|
6590
6605
|
min_num_options?: number | null | undefined;
|
|
6591
6606
|
max_num_options?: number | null | undefined;
|
|
@@ -6956,6 +6971,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
6956
6971
|
BASE_PRICE: number;
|
|
6957
6972
|
} | null | undefined;
|
|
6958
6973
|
}> | null | undefined;
|
|
6974
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
6959
6975
|
}, import("mongoose").Types.Subdocument<string, any, {
|
|
6960
6976
|
_id: string;
|
|
6961
6977
|
name: string;
|
|
@@ -7308,6 +7324,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
7308
7324
|
BASE_PRICE: number;
|
|
7309
7325
|
} | null | undefined;
|
|
7310
7326
|
}> | null | undefined;
|
|
7327
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
7311
7328
|
}> & {
|
|
7312
7329
|
_id: string;
|
|
7313
7330
|
name: string;
|
|
@@ -7660,6 +7677,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
7660
7677
|
BASE_PRICE: number;
|
|
7661
7678
|
} | null | undefined;
|
|
7662
7679
|
}> | null | undefined;
|
|
7680
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
7663
7681
|
}>;
|
|
7664
7682
|
min_num_options?: number | null | undefined;
|
|
7665
7683
|
max_num_options?: number | null | undefined;
|
|
@@ -8486,6 +8504,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
8486
8504
|
BASE_PRICE: number;
|
|
8487
8505
|
} | null | undefined;
|
|
8488
8506
|
}> | null | undefined;
|
|
8507
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
8489
8508
|
}, import("mongoose").Types.Subdocument<string, any, {
|
|
8490
8509
|
_id: string;
|
|
8491
8510
|
name: string;
|
|
@@ -8838,6 +8857,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
8838
8857
|
BASE_PRICE: number;
|
|
8839
8858
|
} | null | undefined;
|
|
8840
8859
|
}> | null | undefined;
|
|
8860
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
8841
8861
|
}> & {
|
|
8842
8862
|
_id: string;
|
|
8843
8863
|
name: string;
|
|
@@ -9190,6 +9210,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
9190
9210
|
BASE_PRICE: number;
|
|
9191
9211
|
} | null | undefined;
|
|
9192
9212
|
}> | null | undefined;
|
|
9213
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
9193
9214
|
}>;
|
|
9194
9215
|
min_num_options?: number | null | undefined;
|
|
9195
9216
|
max_num_options?: number | null | undefined;
|
|
@@ -9560,6 +9581,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
9560
9581
|
BASE_PRICE: number;
|
|
9561
9582
|
} | null | undefined;
|
|
9562
9583
|
}> | null | undefined;
|
|
9584
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
9563
9585
|
}, import("mongoose").Types.Subdocument<string, any, {
|
|
9564
9586
|
_id: string;
|
|
9565
9587
|
name: string;
|
|
@@ -9912,6 +9934,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
9912
9934
|
BASE_PRICE: number;
|
|
9913
9935
|
} | null | undefined;
|
|
9914
9936
|
}> | null | undefined;
|
|
9937
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
9915
9938
|
}> & {
|
|
9916
9939
|
_id: string;
|
|
9917
9940
|
name: string;
|
|
@@ -10264,6 +10287,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
10264
10287
|
BASE_PRICE: number;
|
|
10265
10288
|
} | null | undefined;
|
|
10266
10289
|
}> | null | undefined;
|
|
10290
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
10267
10291
|
}>;
|
|
10268
10292
|
min_num_options?: number | null | undefined;
|
|
10269
10293
|
max_num_options?: number | null | undefined;
|
|
@@ -10634,6 +10658,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
10634
10658
|
BASE_PRICE: number;
|
|
10635
10659
|
} | null | undefined;
|
|
10636
10660
|
}> | null | undefined;
|
|
10661
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
10637
10662
|
}, import("mongoose").Types.Subdocument<string, any, {
|
|
10638
10663
|
_id: string;
|
|
10639
10664
|
name: string;
|
|
@@ -10986,6 +11011,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
10986
11011
|
BASE_PRICE: number;
|
|
10987
11012
|
} | null | undefined;
|
|
10988
11013
|
}> | null | undefined;
|
|
11014
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
10989
11015
|
}> & {
|
|
10990
11016
|
_id: string;
|
|
10991
11017
|
name: string;
|
|
@@ -11338,6 +11364,7 @@ export declare const ItemSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
11338
11364
|
BASE_PRICE: number;
|
|
11339
11365
|
} | null | undefined;
|
|
11340
11366
|
}> | null | undefined;
|
|
11367
|
+
ref_type?: import("../../constants").MODIFIER_OPTION_REF_TYPE_ENUM | null | undefined;
|
|
11341
11368
|
}>;
|
|
11342
11369
|
min_num_options?: number | null | undefined;
|
|
11343
11370
|
max_num_options?: number | null | undefined;
|
|
@@ -123,6 +123,13 @@ 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
|
+
},
|
|
126
133
|
});
|
|
127
134
|
const ModifiersSchema = new mongoose_1.Schema({
|
|
128
135
|
_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;
|