@open-tender/store 0.3.72 → 0.3.74

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.
@@ -6,27 +6,28 @@ export interface GuestItem {
6
6
  notes: string | null;
7
7
  }
8
8
  export interface CartItemOption {
9
- id: number;
10
- name: string;
11
- shortName: string;
9
+ allergens: string[];
10
+ cals: number | null;
11
+ color?: string | null;
12
12
  description: string | null;
13
+ id: number;
13
14
  imageUrl: string | null;
14
- allergens: string[];
15
- tags: string[];
15
+ increment: number;
16
16
  ingredients: string | null;
17
- nutritionalInfo: NutritionalInfo | null;
18
- cals: number | null;
19
- price: number;
20
- quantity: number;
21
17
  isDefault: boolean;
22
- increment: number;
18
+ isSoldOut: boolean;
23
19
  max: number;
24
20
  min: number;
25
- isSoldOut: boolean;
21
+ name: string;
22
+ nutritionalInfo: NutritionalInfo | null;
26
23
  points: number;
27
- totalPrice: number;
28
- totalPoints: number | null;
24
+ price: number;
25
+ quantity: number;
26
+ shortName: string;
27
+ tags: string[];
29
28
  totalCals: number | null;
29
+ totalPoints: number | null;
30
+ totalPrice: number;
30
31
  }
31
32
  export declare type CartItemOptions = Array<CartItemOption>;
32
33
  export interface CartItemGroup {
@@ -39,6 +39,7 @@ export interface MenuItemGroup {
39
39
  min_options: number;
40
40
  name: string;
41
41
  option_items: Array<OptionItem>;
42
+ pos_display_color: string | null;
42
43
  short_name: string;
43
44
  slug: string;
44
45
  small_image_url: string | null;
@@ -1,5 +1,6 @@
1
- import { MenuCategories, MenuSections } from '../types';
1
+ import { MenuCategories, MenuItemGroups, MenuSections } from '../types';
2
2
  export declare const flattenCategories: (categories: MenuCategories) => import("../types").MenuCategory[];
3
+ export declare const makeOptionGroups: (groups: MenuItemGroups) => import("../types").MenuItemGroup[];
3
4
  export declare const flattenItems: (categories: MenuCategories) => import("../types").MenuItem[];
4
5
  export declare const makeMenuSections: (sections: MenuSections, categories: MenuCategories) => {
5
6
  items: import("../types").MenuItem[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeMenuSections = exports.flattenItems = exports.flattenCategories = void 0;
3
+ exports.makeMenuSections = exports.flattenItems = exports.makeOptionGroups = exports.flattenCategories = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var flattenCategories = function (categories) {
6
6
  return categories.reduce(function (arr, i) {
@@ -9,9 +9,17 @@ var flattenCategories = function (categories) {
9
9
  }, []);
10
10
  };
11
11
  exports.flattenCategories = flattenCategories;
12
+ var makeOptionGroups = function (groups) {
13
+ return groups.reduce(function (arr, i) {
14
+ var option_items = i.option_items.map(function (option) { return (tslib_1.__assign(tslib_1.__assign({}, option), { color: option.pos_display_color || i.pos_display_color })); });
15
+ var group = tslib_1.__assign(tslib_1.__assign({}, i), { option_items: option_items });
16
+ return tslib_1.__spreadArray(tslib_1.__spreadArray([], arr, true), [group], false);
17
+ }, []);
18
+ };
19
+ exports.makeOptionGroups = makeOptionGroups;
12
20
  var flattenItems = function (categories) {
13
21
  return categories.reduce(function (arr, i) {
14
- var items = i.items.map(function (item) { return (tslib_1.__assign(tslib_1.__assign({}, item), { color: item.pos_display_color || i.pos_display_color })); });
22
+ var items = i.items.map(function (item) { return (tslib_1.__assign(tslib_1.__assign({}, item), { color: item.pos_display_color || i.pos_display_color, option_groups: (0, exports.makeOptionGroups)(item.option_groups) })); });
15
23
  return tslib_1.__spreadArray(tslib_1.__spreadArray([], arr, true), items, true);
16
24
  }, []);
17
25
  };
@@ -14,24 +14,25 @@ export declare const calcPrices: (item: CartItem) => {
14
14
  totalPrice: number;
15
15
  totalPoints: number;
16
16
  totalCals: number;
17
- id: number;
18
- name: string;
19
- shortName: string;
17
+ allergens: string[];
18
+ cals: number | null;
19
+ color?: string | null | undefined;
20
20
  description: string | null;
21
+ id: number;
21
22
  imageUrl: string | null;
22
- allergens: string[];
23
- tags: string[];
23
+ increment: number;
24
24
  ingredients: string | null;
25
- nutritionalInfo: NutritionalInfo | null;
26
- cals: number | null;
27
- price: number;
28
- quantity: number;
29
25
  isDefault: boolean;
30
- increment: number;
26
+ isSoldOut: boolean;
31
27
  max: number;
32
28
  min: number;
33
- isSoldOut: boolean;
29
+ name: string;
30
+ nutritionalInfo: NutritionalInfo | null;
34
31
  points: number;
32
+ price: number;
33
+ quantity: number;
34
+ shortName: string;
35
+ tags: string[];
35
36
  }[];
36
37
  id: number;
37
38
  name: string;
@@ -79,24 +80,25 @@ export declare const makeCartItem: (item: MenuItem, isEdit?: boolean, soldOut?:
79
80
  totalPrice: number;
80
81
  totalPoints: number;
81
82
  totalCals: number;
82
- id: number;
83
- name: string;
84
- shortName: string;
83
+ allergens: string[];
84
+ cals: number | null;
85
+ color?: string | null | undefined;
85
86
  description: string | null;
87
+ id: number;
86
88
  imageUrl: string | null;
87
- allergens: string[];
88
- tags: string[];
89
+ increment: number;
89
90
  ingredients: string | null;
90
- nutritionalInfo: NutritionalInfo | null;
91
- cals: number | null;
92
- price: number;
93
- quantity: number;
94
91
  isDefault: boolean;
95
- increment: number;
92
+ isSoldOut: boolean;
96
93
  max: number;
97
94
  min: number;
98
- isSoldOut: boolean;
95
+ name: string;
96
+ nutritionalInfo: NutritionalInfo | null;
99
97
  points: number;
98
+ price: number;
99
+ quantity: number;
100
+ shortName: string;
101
+ tags: string[];
100
102
  }[];
101
103
  id: number;
102
104
  name: string;
@@ -87,6 +87,7 @@ var makeCartItemGroups = function (optionGroups, isEdit, soldOut) {
87
87
  id: o.id,
88
88
  name: o.name,
89
89
  shortName: o.short_name,
90
+ color: o.color || null,
90
91
  description: o.description,
91
92
  imageUrl: o.small_image_url,
92
93
  allergens: (0, helpers_1.convertStringToArray)(o.allergens),
@@ -6,27 +6,28 @@ export interface GuestItem {
6
6
  notes: string | null;
7
7
  }
8
8
  export interface CartItemOption {
9
- id: number;
10
- name: string;
11
- shortName: string;
9
+ allergens: string[];
10
+ cals: number | null;
11
+ color?: string | null;
12
12
  description: string | null;
13
+ id: number;
13
14
  imageUrl: string | null;
14
- allergens: string[];
15
- tags: string[];
15
+ increment: number;
16
16
  ingredients: string | null;
17
- nutritionalInfo: NutritionalInfo | null;
18
- cals: number | null;
19
- price: number;
20
- quantity: number;
21
17
  isDefault: boolean;
22
- increment: number;
18
+ isSoldOut: boolean;
23
19
  max: number;
24
20
  min: number;
25
- isSoldOut: boolean;
21
+ name: string;
22
+ nutritionalInfo: NutritionalInfo | null;
26
23
  points: number;
27
- totalPrice: number;
28
- totalPoints: number | null;
24
+ price: number;
25
+ quantity: number;
26
+ shortName: string;
27
+ tags: string[];
29
28
  totalCals: number | null;
29
+ totalPoints: number | null;
30
+ totalPrice: number;
30
31
  }
31
32
  export declare type CartItemOptions = Array<CartItemOption>;
32
33
  export interface CartItemGroup {
@@ -39,6 +39,7 @@ export interface MenuItemGroup {
39
39
  min_options: number;
40
40
  name: string;
41
41
  option_items: Array<OptionItem>;
42
+ pos_display_color: string | null;
42
43
  short_name: string;
43
44
  slug: string;
44
45
  small_image_url: string | null;
@@ -1,5 +1,6 @@
1
- import { MenuCategories, MenuSections } from '../types';
1
+ import { MenuCategories, MenuItemGroups, MenuSections } from '../types';
2
2
  export declare const flattenCategories: (categories: MenuCategories) => import("../types").MenuCategory[];
3
+ export declare const makeOptionGroups: (groups: MenuItemGroups) => import("../types").MenuItemGroup[];
3
4
  export declare const flattenItems: (categories: MenuCategories) => import("../types").MenuItem[];
4
5
  export declare const makeMenuSections: (sections: MenuSections, categories: MenuCategories) => {
5
6
  items: import("../types").MenuItem[];
@@ -5,9 +5,16 @@ export var flattenCategories = function (categories) {
5
5
  return __spreadArray(__spreadArray([], arr, true), cats, true);
6
6
  }, []);
7
7
  };
8
+ export var makeOptionGroups = function (groups) {
9
+ return groups.reduce(function (arr, i) {
10
+ var option_items = i.option_items.map(function (option) { return (__assign(__assign({}, option), { color: option.pos_display_color || i.pos_display_color })); });
11
+ var group = __assign(__assign({}, i), { option_items: option_items });
12
+ return __spreadArray(__spreadArray([], arr, true), [group], false);
13
+ }, []);
14
+ };
8
15
  export var flattenItems = function (categories) {
9
16
  return categories.reduce(function (arr, i) {
10
- var items = i.items.map(function (item) { return (__assign(__assign({}, item), { color: item.pos_display_color || i.pos_display_color })); });
17
+ var items = i.items.map(function (item) { return (__assign(__assign({}, item), { color: item.pos_display_color || i.pos_display_color, option_groups: makeOptionGroups(item.option_groups) })); });
11
18
  return __spreadArray(__spreadArray([], arr, true), items, true);
12
19
  }, []);
13
20
  };
@@ -14,24 +14,25 @@ export declare const calcPrices: (item: CartItem) => {
14
14
  totalPrice: number;
15
15
  totalPoints: number;
16
16
  totalCals: number;
17
- id: number;
18
- name: string;
19
- shortName: string;
17
+ allergens: string[];
18
+ cals: number | null;
19
+ color?: string | null | undefined;
20
20
  description: string | null;
21
+ id: number;
21
22
  imageUrl: string | null;
22
- allergens: string[];
23
- tags: string[];
23
+ increment: number;
24
24
  ingredients: string | null;
25
- nutritionalInfo: NutritionalInfo | null;
26
- cals: number | null;
27
- price: number;
28
- quantity: number;
29
25
  isDefault: boolean;
30
- increment: number;
26
+ isSoldOut: boolean;
31
27
  max: number;
32
28
  min: number;
33
- isSoldOut: boolean;
29
+ name: string;
30
+ nutritionalInfo: NutritionalInfo | null;
34
31
  points: number;
32
+ price: number;
33
+ quantity: number;
34
+ shortName: string;
35
+ tags: string[];
35
36
  }[];
36
37
  id: number;
37
38
  name: string;
@@ -79,24 +80,25 @@ export declare const makeCartItem: (item: MenuItem, isEdit?: boolean, soldOut?:
79
80
  totalPrice: number;
80
81
  totalPoints: number;
81
82
  totalCals: number;
82
- id: number;
83
- name: string;
84
- shortName: string;
83
+ allergens: string[];
84
+ cals: number | null;
85
+ color?: string | null | undefined;
85
86
  description: string | null;
87
+ id: number;
86
88
  imageUrl: string | null;
87
- allergens: string[];
88
- tags: string[];
89
+ increment: number;
89
90
  ingredients: string | null;
90
- nutritionalInfo: NutritionalInfo | null;
91
- cals: number | null;
92
- price: number;
93
- quantity: number;
94
91
  isDefault: boolean;
95
- increment: number;
92
+ isSoldOut: boolean;
96
93
  max: number;
97
94
  min: number;
98
- isSoldOut: boolean;
95
+ name: string;
96
+ nutritionalInfo: NutritionalInfo | null;
99
97
  points: number;
98
+ price: number;
99
+ quantity: number;
100
+ shortName: string;
101
+ tags: string[];
100
102
  }[];
101
103
  id: number;
102
104
  name: string;
@@ -79,6 +79,7 @@ var makeCartItemGroups = function (optionGroups, isEdit, soldOut) {
79
79
  id: o.id,
80
80
  name: o.name,
81
81
  shortName: o.short_name,
82
+ color: o.color || null,
82
83
  description: o.description,
83
84
  imageUrl: o.small_image_url,
84
85
  allergens: convertStringToArray(o.allergens),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "0.3.72",
3
+ "version": "0.3.74",
4
4
  "description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",