@open-tender/utils 0.1.151 → 0.1.152
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/utils/cart.d.ts +3 -13
- package/dist/cjs/utils/cart.js +5 -4
- package/dist/esm/utils/cart.d.ts +3 -13
- package/dist/esm/utils/cart.js +5 -4
- package/package.json +1 -1
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
|
};
|
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
|
};
|
package/package.json
CHANGED