@open-tender/utils 0.4.87 → 0.4.89

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.
@@ -7,8 +7,8 @@ export declare const useBuilder: (orderItem: CartItem) => {
7
7
  setMadeFor: (madeFor: string) => void;
8
8
  setNotes: (notes: string) => void;
9
9
  setMadeForNotes: (madeFor: string, notes: string) => void;
10
- toggleOption: (levels: CartLevels) => void;
11
- incrementOption: (levels: CartLevels) => void;
12
- decrementOption: (levels: CartLevels) => void;
13
- setOptionQuantity: (levels: CartLevels, quantity: number) => void;
10
+ toggleOption: (levels: CartLevels) => CartItem;
11
+ incrementOption: (levels: CartLevels) => CartItem;
12
+ decrementOption: (levels: CartLevels) => CartItem;
13
+ setOptionQuantity: (levels: CartLevels, quantity: number) => CartItem;
14
14
  };
@@ -111,21 +111,25 @@ const useBuilder = (orderItem) => {
111
111
  const groups = updateGroups(item.groups, levels, toggleGroupOption);
112
112
  const pricedItem = (0, utils_1.calcPrices)(Object.assign(Object.assign({}, item), { groups: groups }));
113
113
  setItem(pricedItem);
114
+ return pricedItem;
114
115
  };
115
116
  const incrementOption = (levels) => {
116
117
  const groups = updateGroups(item.groups, levels, incrementGroupOption);
117
118
  const pricedItem = (0, utils_1.calcPrices)(Object.assign(Object.assign({}, item), { groups: groups }));
118
119
  setItem(pricedItem);
120
+ return pricedItem;
119
121
  };
120
122
  const decrementOption = (levels) => {
121
123
  const groups = updateGroups(item.groups, levels, decrementGroupOption);
122
124
  const pricedItem = (0, utils_1.calcPrices)(Object.assign(Object.assign({}, item), { groups: groups }));
123
125
  setItem(pricedItem);
126
+ return pricedItem;
124
127
  };
125
128
  const setOptionQuantity = (levels, quantity) => {
126
129
  const groups = updateGroups(item.groups, levels, setGroupOptionQuantity, quantity);
127
130
  const pricedItem = (0, utils_1.calcPrices)(Object.assign(Object.assign({}, item), { groups: groups }));
128
131
  setItem(pricedItem);
132
+ return pricedItem;
129
133
  };
130
134
  return {
131
135
  item,
@@ -14,6 +14,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
14
14
  hasTags: boolean;
15
15
  hasAllergens: boolean;
16
16
  hasGroups: boolean;
17
+ pos_ext_id: string | null;
17
18
  sizeGroup: import("@open-tender/types").CartItemGroup | null | undefined;
18
19
  sizeSelected: boolean;
19
20
  nonSizeGroups: import("@open-tender/types").CartItemGroup[] | null;
@@ -6,7 +6,7 @@ const useMenuItem = (builtItem, auth, lookup, cartId, displaySettings) => {
6
6
  const signature = (0, utils_1.makeItemSignature)(builtItem);
7
7
  const favoriteId = lookup && signature ? lookup[signature] : null;
8
8
  const { calories: showCals = false, tags: showTags = false, allergens: showAllergens = false, madeFor: showMadeFor = true, notes: showNotes = true } = displaySettings || {};
9
- const { description, quantity, price, totalPrice, cals, totalCals, totalPoints, tags, allergens, groups, ingredients, totalAllergens } = builtItem;
9
+ const { description, quantity, price, totalPrice, cals, totalCals, totalPoints, tags, allergens, groups, ingredients, totalAllergens, pos_ext_id } = builtItem;
10
10
  const hasTags = showTags && Array.isArray(tags) && tags.length ? true : false;
11
11
  const hasAllergens = showAllergens && Array.isArray(allergens) && allergens.length ? true : false;
12
12
  const hasTagsAllergens = hasTags || hasAllergens ? true : false;
@@ -53,6 +53,7 @@ const useMenuItem = (builtItem, auth, lookup, cartId, displaySettings) => {
53
53
  hasTags,
54
54
  hasAllergens,
55
55
  hasGroups,
56
+ pos_ext_id,
56
57
  sizeGroup,
57
58
  sizeSelected,
58
59
  nonSizeGroups,
@@ -40,6 +40,7 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
40
40
  name: string;
41
41
  nutritionalInfo: import("@open-tender/types").NutritionalInfo | null;
42
42
  points: number | null;
43
+ pos_ext_id: string | null;
43
44
  quantity: number;
44
45
  shorthand: string | null;
45
46
  shortDescription: string | null;
@@ -37,6 +37,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
37
37
  name: string;
38
38
  nutritionalInfo: import("@open-tender/types").NutritionalInfo | null;
39
39
  points: number | null;
40
+ pos_ext_id: string | null;
40
41
  price: number;
41
42
  quantity: number;
42
43
  shorthand: string | null;
@@ -42,6 +42,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
42
42
  name: string;
43
43
  nutritionalInfo: NutritionalInfo | null;
44
44
  points: number | null;
45
+ pos_ext_id: string | null;
45
46
  price: number;
46
47
  quantity: number;
47
48
  shorthand: string | null;
@@ -137,6 +138,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
137
138
  name: string;
138
139
  nutritionalInfo: NutritionalInfo | null;
139
140
  points: number | null;
141
+ pos_ext_id: string | null;
140
142
  price: number;
141
143
  quantity: number;
142
144
  shorthand: string | null;
@@ -35,6 +35,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
35
35
  plu: string | null;
36
36
  points: number | null;
37
37
  pos_display_color: string | null;
38
+ pos_ext_id: string | null;
38
39
  price: string;
39
40
  sales_tax_override: `${number}.${number}` | null;
40
41
  short_description: string | null;
@@ -83,6 +84,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
83
84
  plu: string | null;
84
85
  points: number | null;
85
86
  pos_display_color: string | null;
87
+ pos_ext_id: string | null;
86
88
  price: string;
87
89
  sales_tax_override: `${number}.${number}` | null;
88
90
  short_description: string | null;
@@ -7,8 +7,8 @@ export declare const useBuilder: (orderItem: CartItem) => {
7
7
  setMadeFor: (madeFor: string) => void;
8
8
  setNotes: (notes: string) => void;
9
9
  setMadeForNotes: (madeFor: string, notes: string) => void;
10
- toggleOption: (levels: CartLevels) => void;
11
- incrementOption: (levels: CartLevels) => void;
12
- decrementOption: (levels: CartLevels) => void;
13
- setOptionQuantity: (levels: CartLevels, quantity: number) => void;
10
+ toggleOption: (levels: CartLevels) => CartItem;
11
+ incrementOption: (levels: CartLevels) => CartItem;
12
+ decrementOption: (levels: CartLevels) => CartItem;
13
+ setOptionQuantity: (levels: CartLevels, quantity: number) => CartItem;
14
14
  };
@@ -108,21 +108,25 @@ export const useBuilder = (orderItem) => {
108
108
  const groups = updateGroups(item.groups, levels, toggleGroupOption);
109
109
  const pricedItem = calcPrices(Object.assign(Object.assign({}, item), { groups: groups }));
110
110
  setItem(pricedItem);
111
+ return pricedItem;
111
112
  };
112
113
  const incrementOption = (levels) => {
113
114
  const groups = updateGroups(item.groups, levels, incrementGroupOption);
114
115
  const pricedItem = calcPrices(Object.assign(Object.assign({}, item), { groups: groups }));
115
116
  setItem(pricedItem);
117
+ return pricedItem;
116
118
  };
117
119
  const decrementOption = (levels) => {
118
120
  const groups = updateGroups(item.groups, levels, decrementGroupOption);
119
121
  const pricedItem = calcPrices(Object.assign(Object.assign({}, item), { groups: groups }));
120
122
  setItem(pricedItem);
123
+ return pricedItem;
121
124
  };
122
125
  const setOptionQuantity = (levels, quantity) => {
123
126
  const groups = updateGroups(item.groups, levels, setGroupOptionQuantity, quantity);
124
127
  const pricedItem = calcPrices(Object.assign(Object.assign({}, item), { groups: groups }));
125
128
  setItem(pricedItem);
129
+ return pricedItem;
126
130
  };
127
131
  return {
128
132
  item,
@@ -14,6 +14,7 @@ export declare const useMenuItem: (builtItem: CartItem, auth: Auth | null, looku
14
14
  hasTags: boolean;
15
15
  hasAllergens: boolean;
16
16
  hasGroups: boolean;
17
+ pos_ext_id: string | null;
17
18
  sizeGroup: import("@open-tender/types").CartItemGroup | null | undefined;
18
19
  sizeSelected: boolean;
19
20
  nonSizeGroups: import("@open-tender/types").CartItemGroup[] | null;
@@ -3,7 +3,7 @@ export const useMenuItem = (builtItem, auth, lookup, cartId, displaySettings) =>
3
3
  const signature = makeItemSignature(builtItem);
4
4
  const favoriteId = lookup && signature ? lookup[signature] : null;
5
5
  const { calories: showCals = false, tags: showTags = false, allergens: showAllergens = false, madeFor: showMadeFor = true, notes: showNotes = true } = displaySettings || {};
6
- const { description, quantity, price, totalPrice, cals, totalCals, totalPoints, tags, allergens, groups, ingredients, totalAllergens } = builtItem;
6
+ const { description, quantity, price, totalPrice, cals, totalCals, totalPoints, tags, allergens, groups, ingredients, totalAllergens, pos_ext_id } = builtItem;
7
7
  const hasTags = showTags && Array.isArray(tags) && tags.length ? true : false;
8
8
  const hasAllergens = showAllergens && Array.isArray(allergens) && allergens.length ? true : false;
9
9
  const hasTagsAllergens = hasTags || hasAllergens ? true : false;
@@ -50,6 +50,7 @@ export const useMenuItem = (builtItem, auth, lookup, cartId, displaySettings) =>
50
50
  hasTags,
51
51
  hasAllergens,
52
52
  hasGroups,
53
+ pos_ext_id,
53
54
  sizeGroup,
54
55
  sizeSelected,
55
56
  nonSizeGroups,
@@ -40,6 +40,7 @@ export declare const useModifier: (group: CartItemGroup, option: CartItemOption,
40
40
  name: string;
41
41
  nutritionalInfo: import("@open-tender/types").NutritionalInfo | null;
42
42
  points: number | null;
43
+ pos_ext_id: string | null;
43
44
  quantity: number;
44
45
  shorthand: string | null;
45
46
  shortDescription: string | null;
@@ -37,6 +37,7 @@ export declare const useOrderItem: (orderItem: CartItem, favorite?: MenuItemFavo
37
37
  name: string;
38
38
  nutritionalInfo: import("@open-tender/types").NutritionalInfo | null;
39
39
  points: number | null;
40
+ pos_ext_id: string | null;
40
41
  price: number;
41
42
  quantity: number;
42
43
  shorthand: string | null;
@@ -42,6 +42,7 @@ export declare const rehydrateCart: (menuItems: MenuItems, simpleCartItems: Simp
42
42
  name: string;
43
43
  nutritionalInfo: NutritionalInfo | null;
44
44
  points: number | null;
45
+ pos_ext_id: string | null;
45
46
  price: number;
46
47
  quantity: number;
47
48
  shorthand: string | null;
@@ -137,6 +138,7 @@ export declare const combineCarts: (cart: Cart, guestCart: Cart, cartOwner: Cart
137
138
  name: string;
138
139
  nutritionalInfo: NutritionalInfo | null;
139
140
  points: number | null;
141
+ pos_ext_id: string | null;
140
142
  price: number;
141
143
  quantity: number;
142
144
  shorthand: string | null;
@@ -35,6 +35,7 @@ export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSec
35
35
  plu: string | null;
36
36
  points: number | null;
37
37
  pos_display_color: string | null;
38
+ pos_ext_id: string | null;
38
39
  price: string;
39
40
  sales_tax_override: `${number}.${number}` | null;
40
41
  short_description: string | null;
@@ -83,6 +84,7 @@ export declare const makeFlatCategories: (categories: MenuCategories) => {
83
84
  plu: string | null;
84
85
  points: number | null;
85
86
  pos_display_color: string | null;
87
+ pos_ext_id: string | null;
86
88
  price: string;
87
89
  sales_tax_override: `${number}.${number}` | null;
88
90
  short_description: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.4.87",
3
+ "version": "0.4.89",
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.126",
39
+ "@open-tender/types": "^0.4.127",
40
40
  "@reduxjs/toolkit": "^1.8.5",
41
41
  "@types/google.maps": "^3.53.5",
42
42
  "@types/jest": "^29.5.11",