@open-tender/utils 0.4.69 → 0.4.71

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.
@@ -54,4 +54,6 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
54
54
  tags_list?: import("@open-tender/types").MenuItemTags | undefined;
55
55
  totalCals: number | null;
56
56
  totalPrice: number | null;
57
+ itemShape: import("@open-tender/types").PizzaShape | null;
58
+ excludeFromBuilder: boolean;
57
59
  };
@@ -50,4 +50,6 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
50
50
  totalCals: number | null;
51
51
  totalPoints: number | null;
52
52
  totalPrice: number | null;
53
+ itemShape: import("@open-tender/types").PizzaShape | null;
54
+ excludeFromBuilder: boolean;
53
55
  };
@@ -12,4 +12,6 @@ export declare const useModifierGroup: (group: CartItemGroup, displaySettings?:
12
12
  name: string;
13
13
  options: import("@open-tender/types").CartItemOptions;
14
14
  quantity: number;
15
+ itemShape: import("@open-tender/types").PizzaShape | null;
16
+ excludeFromBuilder: boolean;
15
17
  };
@@ -45,4 +45,6 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
45
45
  totalCals: number | null;
46
46
  totalPoints: number | null;
47
47
  totalPrice: number | null;
48
+ itemShape: import("@open-tender/types").PizzaShape | null;
49
+ excludeFromBuilder: boolean;
48
50
  };
@@ -51,6 +51,8 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
51
51
  totalCals: number | null;
52
52
  totalPoints: number | null;
53
53
  totalPrice: number | null;
54
+ itemShape: import("@open-tender/types").PizzaShape | null;
55
+ excludeFromBuilder: boolean;
54
56
  }[];
55
57
  cartCounts: Record<string, number>;
56
58
  };
@@ -141,6 +143,8 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
141
143
  totalCals: number | null;
142
144
  totalPoints: number | null;
143
145
  totalPrice: number | null;
146
+ itemShape: import("@open-tender/types").PizzaShape | null;
147
+ excludeFromBuilder: boolean;
144
148
  }[];
145
149
  export declare const makeItemImageUrl: (images: Images) => any;
146
150
  export declare const makeDisplayItemGroups: (optionGroups: OrderItemGroups) => {
@@ -199,8 +199,9 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
199
199
  if (!optionGroups)
200
200
  return [];
201
201
  const groups = optionGroups.map(g => {
202
+ var _a, _b;
202
203
  const options = g.option_items.map(o => {
203
- var _a;
204
+ var _a, _b, _c;
204
205
  const isSoldOut = (0, exports.checkSoldOut)(o.id, o.suspend_until, soldOut);
205
206
  const quantity = isSoldOut
206
207
  ? 0
@@ -239,7 +240,9 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
239
240
  totalAllergens: [],
240
241
  totalCals: null,
241
242
  totalPoints: null,
242
- totalPrice: null
243
+ totalPrice: null,
244
+ itemShape: (_b = o.item_shape) !== null && _b !== void 0 ? _b : null,
245
+ excludeFromBuilder: (_c = o.exclude_from_builder) !== null && _c !== void 0 ? _c : false
243
246
  };
244
247
  return option;
245
248
  });
@@ -254,14 +257,16 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
254
257
  min: g.min_options,
255
258
  name: g.name,
256
259
  options: options,
257
- quantity: options.reduce((t, o) => t + o.quantity, 0)
260
+ quantity: options.reduce((t, o) => t + o.quantity, 0),
261
+ itemShape: (_a = g.item_shape) !== null && _a !== void 0 ? _a : null,
262
+ excludeFromBuilder: (_b = g.exclude_from_builder) !== null && _b !== void 0 ? _b : false
258
263
  };
259
264
  return group;
260
265
  });
261
266
  return groups;
262
267
  };
263
268
  const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints = false) => {
264
- var _a;
269
+ var _a, _b, _c;
265
270
  const groups = makeOrderItemGroups(item.option_groups, isEdit, soldOut);
266
271
  const cals = ((_a = item.nutritional_info) === null || _a === void 0 ? void 0 : _a.calories)
267
272
  ? parseInt(item.nutritional_info.calories.toString())
@@ -301,7 +306,9 @@ const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints = false
301
306
  totalCals: null,
302
307
  totalPoints: null,
303
308
  totalPrice: null,
304
- upsellItems: item.upsell_items
309
+ upsellItems: item.upsell_items,
310
+ itemShape: (_b = item.item_shape) !== null && _b !== void 0 ? _b : null,
311
+ excludeFromBuilder: (_c = item.exclude_from_builder) !== null && _c !== void 0 ? _c : false
305
312
  };
306
313
  const pricedItem = (0, exports.calcPrices)(orderItem);
307
314
  return pricedItem;
@@ -2,54 +2,7 @@ import { CheckoutTender, CheckoutTenders, ConfirmationSections, CreditCard, Mone
2
2
  export declare const adjustTenders: (tenders: CheckoutTenders, isPaid: boolean, amountRemaining: number, updateForm: (form: {
3
3
  tenders: any;
4
4
  }) => void) => void;
5
- export declare const updateTenders: (tenders: CheckoutTenders, total: Money) => ({
6
- amount: string;
7
- acct: string;
8
- addr?: string | undefined;
9
- card_type_name: import("@open-tender/types").CardTypeName;
10
- cvv: string;
11
- exp: string;
12
- is_default: boolean;
13
- last4: string;
14
- masked: string;
15
- tender_status?: import("@open-tender/types").TenderStatus | undefined;
16
- tender_type: import("@open-tender/types").TenderType;
17
- zip: string;
18
- } | {
19
- amount: string;
20
- card_type?: import("@open-tender/types").CardType | undefined;
21
- card_type_name?: import("@open-tender/types").CardTypeName | undefined;
22
- customer_card_id: number;
23
- is_default?: boolean | undefined;
24
- last4?: string | undefined;
25
- masked?: string | undefined;
26
- tender_status?: import("@open-tender/types").TenderStatus | undefined;
27
- tender_type: import("@open-tender/types").TenderType;
28
- } | {
29
- amount: string;
30
- balance?: `${number}.${number}` | undefined;
31
- card_number: string;
32
- pin?: string | undefined;
33
- tender_status?: import("@open-tender/types").TenderStatus | undefined;
34
- tender_type: import("@open-tender/types").TenderType;
35
- } | {
36
- amount: string;
37
- approved_contact?: boolean | undefined;
38
- domain?: string | null | undefined;
39
- house_account_id: number;
40
- name: string;
41
- order_type?: import("@open-tender/types").OrderType | null | undefined;
42
- pin?: string | undefined;
43
- revenue_centers?: number[] | undefined;
44
- service_type?: import("@open-tender/types").ServiceType | null | undefined;
45
- tender_status?: import("@open-tender/types").TenderStatus | undefined;
46
- tender_type?: import("@open-tender/types").TenderType | undefined;
47
- } | {
48
- amount: string;
49
- tender_status?: import("@open-tender/types").TenderStatus | undefined;
50
- tender_type: import("@open-tender/types").TenderType;
51
- token: any;
52
- })[] | null;
5
+ export declare const updateTenders: (tenders: CheckoutTenders, total: Money) => CheckoutTenders | null;
53
6
  export declare const makeCreditCardName: (creditCard: CreditCard) => string;
54
7
  export declare const makeTenderName: (tender: OrderTender) => string;
55
8
  export declare const makeCheckoutTenderName: (tender: CheckoutTender) => string | undefined;
@@ -49,6 +49,8 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
49
49
  taxes: import("@open-tender/types").MenuItemTaxes;
50
50
  temperature: import("@open-tender/types").Temperature;
51
51
  upsell_items: number[];
52
+ item_shape: import("@open-tender/types").PizzaShape | null;
53
+ exclude_from_builder: boolean;
52
54
  }[];
53
55
  }[];
54
56
  export declare const makeFlatCategories: (categories: MenuCategories) => {
@@ -92,6 +94,8 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
92
94
  taxes: import("@open-tender/types").MenuItemTaxes;
93
95
  temperature: import("@open-tender/types").Temperature;
94
96
  upsell_items: number[];
97
+ item_shape: import("@open-tender/types").PizzaShape | null;
98
+ exclude_from_builder: boolean;
95
99
  }[];
96
100
  app_image_url: string | null;
97
101
  appearance: import("@open-tender/types").MenuCategoryAppearance;
@@ -54,4 +54,6 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
54
54
  tags_list?: import("@open-tender/types").MenuItemTags | undefined;
55
55
  totalCals: number | null;
56
56
  totalPrice: number | null;
57
+ itemShape: import("@open-tender/types").PizzaShape | null;
58
+ excludeFromBuilder: boolean;
57
59
  };
@@ -50,4 +50,6 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
50
50
  totalCals: number | null;
51
51
  totalPoints: number | null;
52
52
  totalPrice: number | null;
53
+ itemShape: import("@open-tender/types").PizzaShape | null;
54
+ excludeFromBuilder: boolean;
53
55
  };
@@ -12,4 +12,6 @@ export declare const useModifierGroup: (group: CartItemGroup, displaySettings?:
12
12
  name: string;
13
13
  options: import("@open-tender/types").CartItemOptions;
14
14
  quantity: number;
15
+ itemShape: import("@open-tender/types").PizzaShape | null;
16
+ excludeFromBuilder: boolean;
15
17
  };
@@ -45,4 +45,6 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
45
45
  totalCals: number | null;
46
46
  totalPoints: number | null;
47
47
  totalPrice: number | null;
48
+ itemShape: import("@open-tender/types").PizzaShape | null;
49
+ excludeFromBuilder: boolean;
48
50
  };
@@ -51,6 +51,8 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
51
51
  totalCals: number | null;
52
52
  totalPoints: number | null;
53
53
  totalPrice: number | null;
54
+ itemShape: import("@open-tender/types").PizzaShape | null;
55
+ excludeFromBuilder: boolean;
54
56
  }[];
55
57
  cartCounts: Record<string, number>;
56
58
  };
@@ -141,6 +143,8 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
141
143
  totalCals: number | null;
142
144
  totalPoints: number | null;
143
145
  totalPrice: number | null;
146
+ itemShape: import("@open-tender/types").PizzaShape | null;
147
+ excludeFromBuilder: boolean;
144
148
  }[];
145
149
  export declare const makeItemImageUrl: (images: Images) => any;
146
150
  export declare const makeDisplayItemGroups: (optionGroups: OrderItemGroups) => {
@@ -184,8 +184,9 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
184
184
  if (!optionGroups)
185
185
  return [];
186
186
  const groups = optionGroups.map(g => {
187
+ var _a, _b;
187
188
  const options = g.option_items.map(o => {
188
- var _a;
189
+ var _a, _b, _c;
189
190
  const isSoldOut = checkSoldOut(o.id, o.suspend_until, soldOut);
190
191
  const quantity = isSoldOut
191
192
  ? 0
@@ -224,7 +225,9 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
224
225
  totalAllergens: [],
225
226
  totalCals: null,
226
227
  totalPoints: null,
227
- totalPrice: null
228
+ totalPrice: null,
229
+ itemShape: (_b = o.item_shape) !== null && _b !== void 0 ? _b : null,
230
+ excludeFromBuilder: (_c = o.exclude_from_builder) !== null && _c !== void 0 ? _c : false
228
231
  };
229
232
  return option;
230
233
  });
@@ -239,14 +242,16 @@ const makeOrderItemGroups = (optionGroups, isEdit, soldOut = []) => {
239
242
  min: g.min_options,
240
243
  name: g.name,
241
244
  options: options,
242
- quantity: options.reduce((t, o) => t + o.quantity, 0)
245
+ quantity: options.reduce((t, o) => t + o.quantity, 0),
246
+ itemShape: (_a = g.item_shape) !== null && _a !== void 0 ? _a : null,
247
+ excludeFromBuilder: (_b = g.exclude_from_builder) !== null && _b !== void 0 ? _b : false
243
248
  };
244
249
  return group;
245
250
  });
246
251
  return groups;
247
252
  };
248
253
  export const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints = false) => {
249
- var _a;
254
+ var _a, _b, _c;
250
255
  const groups = makeOrderItemGroups(item.option_groups, isEdit, soldOut);
251
256
  const cals = ((_a = item.nutritional_info) === null || _a === void 0 ? void 0 : _a.calories)
252
257
  ? parseInt(item.nutritional_info.calories.toString())
@@ -286,7 +291,9 @@ export const makeOrderItem = (item, isEdit, soldOut = [], simpleItem, hasPoints
286
291
  totalCals: null,
287
292
  totalPoints: null,
288
293
  totalPrice: null,
289
- upsellItems: item.upsell_items
294
+ upsellItems: item.upsell_items,
295
+ itemShape: (_b = item.item_shape) !== null && _b !== void 0 ? _b : null,
296
+ excludeFromBuilder: (_c = item.exclude_from_builder) !== null && _c !== void 0 ? _c : false
290
297
  };
291
298
  const pricedItem = calcPrices(orderItem);
292
299
  return pricedItem;
@@ -2,54 +2,7 @@ import { CheckoutTender, CheckoutTenders, ConfirmationSections, CreditCard, Mone
2
2
  export declare const adjustTenders: (tenders: CheckoutTenders, isPaid: boolean, amountRemaining: number, updateForm: (form: {
3
3
  tenders: any;
4
4
  }) => void) => void;
5
- export declare const updateTenders: (tenders: CheckoutTenders, total: Money) => ({
6
- amount: string;
7
- acct: string;
8
- addr?: string | undefined;
9
- card_type_name: import("@open-tender/types").CardTypeName;
10
- cvv: string;
11
- exp: string;
12
- is_default: boolean;
13
- last4: string;
14
- masked: string;
15
- tender_status?: import("@open-tender/types").TenderStatus | undefined;
16
- tender_type: import("@open-tender/types").TenderType;
17
- zip: string;
18
- } | {
19
- amount: string;
20
- card_type?: import("@open-tender/types").CardType | undefined;
21
- card_type_name?: import("@open-tender/types").CardTypeName | undefined;
22
- customer_card_id: number;
23
- is_default?: boolean | undefined;
24
- last4?: string | undefined;
25
- masked?: string | undefined;
26
- tender_status?: import("@open-tender/types").TenderStatus | undefined;
27
- tender_type: import("@open-tender/types").TenderType;
28
- } | {
29
- amount: string;
30
- balance?: `${number}.${number}` | undefined;
31
- card_number: string;
32
- pin?: string | undefined;
33
- tender_status?: import("@open-tender/types").TenderStatus | undefined;
34
- tender_type: import("@open-tender/types").TenderType;
35
- } | {
36
- amount: string;
37
- approved_contact?: boolean | undefined;
38
- domain?: string | null | undefined;
39
- house_account_id: number;
40
- name: string;
41
- order_type?: import("@open-tender/types").OrderType | null | undefined;
42
- pin?: string | undefined;
43
- revenue_centers?: number[] | undefined;
44
- service_type?: import("@open-tender/types").ServiceType | null | undefined;
45
- tender_status?: import("@open-tender/types").TenderStatus | undefined;
46
- tender_type?: import("@open-tender/types").TenderType | undefined;
47
- } | {
48
- amount: string;
49
- tender_status?: import("@open-tender/types").TenderStatus | undefined;
50
- tender_type: import("@open-tender/types").TenderType;
51
- token: any;
52
- })[] | null;
5
+ export declare const updateTenders: (tenders: CheckoutTenders, total: Money) => CheckoutTenders | null;
53
6
  export declare const makeCreditCardName: (creditCard: CreditCard) => string;
54
7
  export declare const makeTenderName: (tender: OrderTender) => string;
55
8
  export declare const makeCheckoutTenderName: (tender: CheckoutTender) => string | undefined;
@@ -49,6 +49,8 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
49
49
  taxes: import("@open-tender/types").MenuItemTaxes;
50
50
  temperature: import("@open-tender/types").Temperature;
51
51
  upsell_items: number[];
52
+ item_shape: import("@open-tender/types").PizzaShape | null;
53
+ exclude_from_builder: boolean;
52
54
  }[];
53
55
  }[];
54
56
  export declare const makeFlatCategories: (categories: MenuCategories) => {
@@ -92,6 +94,8 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
92
94
  taxes: import("@open-tender/types").MenuItemTaxes;
93
95
  temperature: import("@open-tender/types").Temperature;
94
96
  upsell_items: number[];
97
+ item_shape: import("@open-tender/types").PizzaShape | null;
98
+ exclude_from_builder: boolean;
95
99
  }[];
96
100
  app_image_url: string | null;
97
101
  appearance: import("@open-tender/types").MenuCategoryAppearance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.4.69",
3
+ "version": "0.4.71",
4
4
  "description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -36,7 +36,7 @@
36
36
  "private": false,
37
37
  "devDependencies": {
38
38
  "@emotion/react": "^11.10.4",
39
- "@open-tender/types": "^0.4.94",
39
+ "@open-tender/types": "^0.4.98",
40
40
  "@reduxjs/toolkit": "^1.8.5",
41
41
  "@types/google.maps": "^3.53.5",
42
42
  "@types/jest": "^29.5.11",