@open-tender/utils 0.1.151 → 0.1.153
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/cjs/hooks/useMenuItem.js +1 -1
- package/dist/cjs/hooks/useOrderItem.js +1 -1
- package/dist/cjs/utils/cart.d.ts +3 -13
- package/dist/cjs/utils/cart.js +5 -4
- package/dist/cjs/utils/datetimes.js +0 -1
- package/dist/esm/hooks/useMenuItem.js +1 -1
- package/dist/esm/hooks/useOrderItem.js +1 -1
- package/dist/esm/utils/cart.d.ts +3 -13
- package/dist/esm/utils/cart.js +5 -4
- package/dist/esm/utils/datetimes.js +0 -1
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@ const useMenuItem = (builtItem, auth, lookup, cartId, displaySettings) => {
|
|
|
27
27
|
: false;
|
|
28
28
|
const hasGroups = groups ? groups.filter(g => !g.isSize).length > 0 : false;
|
|
29
29
|
const groupsBelowMin = (0, utils_1.hasGroupsBelowMin)(null, groups);
|
|
30
|
-
const isIncomplete =
|
|
30
|
+
const isIncomplete = quantity === 0 || groupsBelowMin;
|
|
31
31
|
const requiresCustomization = isIncomplete && !missingSize;
|
|
32
32
|
const nonSizeGroups = groups ? groups.filter(i => !i.isSize) : null;
|
|
33
33
|
const currentOptions = nonSizeGroups
|
|
@@ -23,7 +23,7 @@ const useOrderItem = (orderItem, favorite = null, allergenAlerts = [], cartCount
|
|
|
23
23
|
const itemCals = showCals ? (totalPrice ? totalCals : cals) : null;
|
|
24
24
|
const displayCals = itemCals ? `${itemCals.toFixed(0)}` : null;
|
|
25
25
|
const groupsBelowMin = (0, utils_1.hasGroupsBelowMin)(null, groups);
|
|
26
|
-
const isIncomplete =
|
|
26
|
+
const isIncomplete = quantity === 0 || groupsBelowMin;
|
|
27
27
|
const nonSizeGroups = groups.filter(i => !i.isSize);
|
|
28
28
|
const currentOptions = (0, utils_1.getItemOptions)(Object.assign(Object.assign({}, orderItem), { groups: nonSizeGroups }));
|
|
29
29
|
const hasSelections = currentOptions.length > 0;
|
package/dist/cjs/utils/cart.d.ts
CHANGED
|
@@ -85,9 +85,8 @@ export declare const rehydrateCheckoutForm: (order: Order) => {
|
|
|
85
85
|
tip: `${number}.${number}`;
|
|
86
86
|
};
|
|
87
87
|
export declare const makeGuestLookup: (cartGuests: GroupOrderGuests) => Record<string, GroupOrderGuest>;
|
|
88
|
-
export declare const combineCarts: (cart: Cart, guestCart:
|
|
89
|
-
|
|
90
|
-
madeFor: string;
|
|
88
|
+
export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: CartOwner, cartGuests: GroupOrderGuests) => {
|
|
89
|
+
madeFor: string | null;
|
|
91
90
|
cartGuestId: number | null;
|
|
92
91
|
customerId: number | null;
|
|
93
92
|
index?: number | undefined;
|
|
@@ -118,16 +117,7 @@ export declare const combineCarts: (cart: Cart, guestCart: SimpleCart, cartOwner
|
|
|
118
117
|
totalCals: number | null;
|
|
119
118
|
totalPoints: number | null;
|
|
120
119
|
totalPrice: number | null;
|
|
121
|
-
}
|
|
122
|
-
madeFor: string;
|
|
123
|
-
id: number;
|
|
124
|
-
quantity: number;
|
|
125
|
-
groups: SimpleCartGroups;
|
|
126
|
-
made_for?: string | null | undefined;
|
|
127
|
-
notes?: string | null | undefined;
|
|
128
|
-
cart_guest_id?: number | undefined;
|
|
129
|
-
customer_id?: number | undefined;
|
|
130
|
-
})[];
|
|
120
|
+
}[];
|
|
131
121
|
export declare const makeItemImageUrl: (images: Images) => any;
|
|
132
122
|
export declare const makeDisplayItemGroups: (optionGroups: OrderItemGroups) => {
|
|
133
123
|
options: DisplayItem[];
|
package/dist/cjs/utils/cart.js
CHANGED
|
@@ -399,13 +399,14 @@ exports.makeGuestLookup = makeGuestLookup;
|
|
|
399
399
|
const combineCarts = (cart, guestCart, cartOwner, cartGuests) => {
|
|
400
400
|
const guestLookup = (0, exports.makeGuestLookup)(cartGuests);
|
|
401
401
|
const withGuestNames = guestCart
|
|
402
|
-
.filter(i => guestLookup[i.
|
|
402
|
+
.filter(i => i.cartGuestId && guestLookup[i.cartGuestId])
|
|
403
403
|
.map(i => {
|
|
404
|
-
const guest = guestLookup[i.
|
|
405
|
-
|
|
404
|
+
const guest = i.cartGuestId ? guestLookup[i.cartGuestId] : null;
|
|
405
|
+
const madeFor = guest ? `${guest === null || guest === void 0 ? void 0 : guest.first_name} ${guest === null || guest === void 0 ? void 0 : guest.last_name}` : null;
|
|
406
|
+
return Object.assign(Object.assign({}, i), { madeFor });
|
|
406
407
|
});
|
|
407
408
|
const withOwnerName = cart.map(i => {
|
|
408
|
-
return Object.assign(Object.assign({}, i), {
|
|
409
|
+
return Object.assign(Object.assign({}, i), { customerId: cartOwner.customer_id, madeFor: `${cartOwner.first_name} ${cartOwner.last_name}` });
|
|
409
410
|
});
|
|
410
411
|
return [...withOwnerName, ...withGuestNames];
|
|
411
412
|
};
|
|
@@ -410,7 +410,6 @@ const makeFirstTime = (revenueCenter, tz, serviceType, requestedAt) => {
|
|
|
410
410
|
exports.makeFirstTime = makeFirstTime;
|
|
411
411
|
const makeFirstRequestedAt = (revenueCenter, serviceType, requestedAt) => {
|
|
412
412
|
const { timezone, revenue_center_type } = revenueCenter;
|
|
413
|
-
// if (revenue_center_type === 'POS') return 'asap'
|
|
414
413
|
const tz = exports.timezoneMap[timezone];
|
|
415
414
|
const newRequestedAt = requestedAt || (revenue_center_type === 'OLO' ? 'asap' : null);
|
|
416
415
|
return (0, exports.makeFirstTime)(revenueCenter, tz, serviceType, newRequestedAt);
|
|
@@ -24,7 +24,7 @@ export const useMenuItem = (builtItem, auth, lookup, cartId, displaySettings) =>
|
|
|
24
24
|
: false;
|
|
25
25
|
const hasGroups = groups ? groups.filter(g => !g.isSize).length > 0 : false;
|
|
26
26
|
const groupsBelowMin = hasGroupsBelowMin(null, groups);
|
|
27
|
-
const isIncomplete =
|
|
27
|
+
const isIncomplete = quantity === 0 || groupsBelowMin;
|
|
28
28
|
const requiresCustomization = isIncomplete && !missingSize;
|
|
29
29
|
const nonSizeGroups = groups ? groups.filter(i => !i.isSize) : null;
|
|
30
30
|
const currentOptions = nonSizeGroups
|
|
@@ -20,7 +20,7 @@ export const useOrderItem = (orderItem, favorite = null, allergenAlerts = [], ca
|
|
|
20
20
|
const itemCals = showCals ? (totalPrice ? totalCals : cals) : null;
|
|
21
21
|
const displayCals = itemCals ? `${itemCals.toFixed(0)}` : null;
|
|
22
22
|
const groupsBelowMin = hasGroupsBelowMin(null, groups);
|
|
23
|
-
const isIncomplete =
|
|
23
|
+
const isIncomplete = quantity === 0 || groupsBelowMin;
|
|
24
24
|
const nonSizeGroups = groups.filter(i => !i.isSize);
|
|
25
25
|
const currentOptions = getItemOptions(Object.assign(Object.assign({}, orderItem), { groups: nonSizeGroups }));
|
|
26
26
|
const hasSelections = currentOptions.length > 0;
|
package/dist/esm/utils/cart.d.ts
CHANGED
|
@@ -85,9 +85,8 @@ export declare const rehydrateCheckoutForm: (order: Order) => {
|
|
|
85
85
|
tip: `${number}.${number}`;
|
|
86
86
|
};
|
|
87
87
|
export declare const makeGuestLookup: (cartGuests: GroupOrderGuests) => Record<string, GroupOrderGuest>;
|
|
88
|
-
export declare const combineCarts: (cart: Cart, guestCart:
|
|
89
|
-
|
|
90
|
-
madeFor: string;
|
|
88
|
+
export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: CartOwner, cartGuests: GroupOrderGuests) => {
|
|
89
|
+
madeFor: string | null;
|
|
91
90
|
cartGuestId: number | null;
|
|
92
91
|
customerId: number | null;
|
|
93
92
|
index?: number | undefined;
|
|
@@ -118,16 +117,7 @@ export declare const combineCarts: (cart: Cart, guestCart: SimpleCart, cartOwner
|
|
|
118
117
|
totalCals: number | null;
|
|
119
118
|
totalPoints: number | null;
|
|
120
119
|
totalPrice: number | null;
|
|
121
|
-
}
|
|
122
|
-
madeFor: string;
|
|
123
|
-
id: number;
|
|
124
|
-
quantity: number;
|
|
125
|
-
groups: SimpleCartGroups;
|
|
126
|
-
made_for?: string | null | undefined;
|
|
127
|
-
notes?: string | null | undefined;
|
|
128
|
-
cart_guest_id?: number | undefined;
|
|
129
|
-
customer_id?: number | undefined;
|
|
130
|
-
})[];
|
|
120
|
+
}[];
|
|
131
121
|
export declare const makeItemImageUrl: (images: Images) => any;
|
|
132
122
|
export declare const makeDisplayItemGroups: (optionGroups: OrderItemGroups) => {
|
|
133
123
|
options: DisplayItem[];
|
package/dist/esm/utils/cart.js
CHANGED
|
@@ -381,13 +381,14 @@ export const makeGuestLookup = (cartGuests) => {
|
|
|
381
381
|
export const combineCarts = (cart, guestCart, cartOwner, cartGuests) => {
|
|
382
382
|
const guestLookup = makeGuestLookup(cartGuests);
|
|
383
383
|
const withGuestNames = guestCart
|
|
384
|
-
.filter(i => guestLookup[i.
|
|
384
|
+
.filter(i => i.cartGuestId && guestLookup[i.cartGuestId])
|
|
385
385
|
.map(i => {
|
|
386
|
-
const guest = guestLookup[i.
|
|
387
|
-
|
|
386
|
+
const guest = i.cartGuestId ? guestLookup[i.cartGuestId] : null;
|
|
387
|
+
const madeFor = guest ? `${guest === null || guest === void 0 ? void 0 : guest.first_name} ${guest === null || guest === void 0 ? void 0 : guest.last_name}` : null;
|
|
388
|
+
return Object.assign(Object.assign({}, i), { madeFor });
|
|
388
389
|
});
|
|
389
390
|
const withOwnerName = cart.map(i => {
|
|
390
|
-
return Object.assign(Object.assign({}, i), {
|
|
391
|
+
return Object.assign(Object.assign({}, i), { customerId: cartOwner.customer_id, madeFor: `${cartOwner.first_name} ${cartOwner.last_name}` });
|
|
391
392
|
});
|
|
392
393
|
return [...withOwnerName, ...withGuestNames];
|
|
393
394
|
};
|
|
@@ -355,7 +355,6 @@ export const makeFirstTime = (revenueCenter, tz, serviceType, requestedAt) => {
|
|
|
355
355
|
};
|
|
356
356
|
export const makeFirstRequestedAt = (revenueCenter, serviceType, requestedAt) => {
|
|
357
357
|
const { timezone, revenue_center_type } = revenueCenter;
|
|
358
|
-
// if (revenue_center_type === 'POS') return 'asap'
|
|
359
358
|
const tz = timezoneMap[timezone];
|
|
360
359
|
const newRequestedAt = requestedAt || (revenue_center_type === 'OLO' ? 'asap' : null);
|
|
361
360
|
return makeFirstTime(revenueCenter, tz, serviceType, newRequestedAt);
|
package/package.json
CHANGED