@orderingstack/ordering-types 1.24.2 → 1.25.0-beta.1

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.
@@ -66,6 +66,10 @@ export type TMedia = {
66
66
  url: string;
67
67
  name: string;
68
68
  };
69
+ type TDetails = {
70
+ literals?: TLiterals;
71
+ media?: TMedia[];
72
+ };
69
73
  export interface IProductAvailability {
70
74
  MON?: string[];
71
75
  TUE?: string[];
@@ -115,13 +119,68 @@ export interface IProductExtra extends IStringKeyRecord<string | undefined> {
115
119
  */
116
120
  "row-start"?: string;
117
121
  }
122
+ interface IMenuItem {
123
+ id: string;
124
+ _?: IProductExtra;
125
+ kind: EProductKind | EProductKindBucket;
126
+ details?: TDetails;
127
+ state?: IProductState;
128
+ emit?: IProductEmit;
129
+ items?: IMenuProduct[];
130
+ price?: string;
131
+ vat?: string;
132
+ minPrice?: string;
133
+ selCtx?: string;
134
+ fltCtx?: string;
135
+ weighted?: boolean;
136
+ qtyMin?: string;
137
+ qtyMax?: string;
138
+ availability?: IProductAvailability;
139
+ bom?: IStringKeyRecord<{
140
+ unit: string;
141
+ qty: string;
142
+ }>;
143
+ outsideAvailabilitySlot?: boolean;
144
+ __?: IProductFrontAttributes;
145
+ }
146
+ export interface ICmsReference extends Pick<IMenuItem, "id" | "_" | "__"> {
147
+ kind: EProductKind.CMS;
148
+ reference: string;
149
+ }
150
+ export interface IStatic extends Pick<IMenuItem, "id" | "kind" | "_" | "__"> {
151
+ kind: EProductKind.STATIC;
152
+ details: TDetails;
153
+ }
154
+ export interface IGroupConfig extends IMenuItem {
155
+ kind: EProductKind.CONFIG;
156
+ details?: TDetails;
157
+ selCtx?: string;
158
+ fltCtx?: string;
159
+ attrs?: IGroupAttributes;
160
+ filter?: IProductFilter;
161
+ }
162
+ export interface IGroupOptions extends IMenuItem {
163
+ kind: EProductKind.OPTIONS;
164
+ details?: TDetails;
165
+ selCtx?: string;
166
+ fltCtx?: string;
167
+ attrs?: IGroupAttributes;
168
+ filter?: IProductFilter;
169
+ }
170
+ export interface IMenuCategory extends Pick<IMenuItem, "id" | "kind" | "_" | "__" | "details"> {
171
+ kind: EProductKind.CATEGORY;
172
+ }
173
+ export interface IMenuProduct extends IMenuItem {
174
+ kind: EProductKind.PRODUCT;
175
+ }
176
+ export type MenuProduct = IMenuCategory | ICmsReference | IStatic | IGroupConfig | IGroupOptions | IMenuProduct;
118
177
  /**
119
178
  * IProductFrontAttributes
120
179
  *
121
180
  * @interface IProductFrontAttributes attributes are added by useMenu hook
122
181
  * @isHiddenByEnableKey {boolean} product has not been enabled by one of its enableKeys
123
182
  */
124
- export interface IProductFrontAttributes {
183
+ export interface IProductFrontAttributes extends IStringKeyRecord<any> {
125
184
  isHiddenByEnableKey?: boolean;
126
185
  lineExtra?: IStringKeyRecord<string>;
127
186
  cmsData?: any;
@@ -130,7 +189,7 @@ export interface IProduct {
130
189
  availability?: IProductAvailability;
131
190
  id: string;
132
191
  img?: string;
133
- cmsId?: string;
192
+ reference?: string;
134
193
  items?: IProduct[];
135
194
  kind: EProductKind | EProductKindBucket;
136
195
  literals?: TLiterals;
package/dist/cjs/index.js CHANGED
@@ -42,6 +42,7 @@ var EProductKindBucket;
42
42
  EProductKindBucket["GROUP"] = "group";
43
43
  EProductKindBucket["PRODUCT"] = "product";
44
44
  })(EProductKindBucket = exports.EProductKindBucket || (exports.EProductKindBucket = {}));
45
+ ;
45
46
  var EOrderUserRole;
46
47
  (function (EOrderUserRole) {
47
48
  EOrderUserRole["CREATOR"] = "CREATOR";
@@ -66,6 +66,10 @@ export type TMedia = {
66
66
  url: string;
67
67
  name: string;
68
68
  };
69
+ type TDetails = {
70
+ literals?: TLiterals;
71
+ media?: TMedia[];
72
+ };
69
73
  export interface IProductAvailability {
70
74
  MON?: string[];
71
75
  TUE?: string[];
@@ -115,13 +119,68 @@ export interface IProductExtra extends IStringKeyRecord<string | undefined> {
115
119
  */
116
120
  "row-start"?: string;
117
121
  }
122
+ interface IMenuItem {
123
+ id: string;
124
+ _?: IProductExtra;
125
+ kind: EProductKind | EProductKindBucket;
126
+ details?: TDetails;
127
+ state?: IProductState;
128
+ emit?: IProductEmit;
129
+ items?: IMenuProduct[];
130
+ price?: string;
131
+ vat?: string;
132
+ minPrice?: string;
133
+ selCtx?: string;
134
+ fltCtx?: string;
135
+ weighted?: boolean;
136
+ qtyMin?: string;
137
+ qtyMax?: string;
138
+ availability?: IProductAvailability;
139
+ bom?: IStringKeyRecord<{
140
+ unit: string;
141
+ qty: string;
142
+ }>;
143
+ outsideAvailabilitySlot?: boolean;
144
+ __?: IProductFrontAttributes;
145
+ }
146
+ export interface ICmsReference extends Pick<IMenuItem, "id" | "_" | "__"> {
147
+ kind: EProductKind.CMS;
148
+ reference: string;
149
+ }
150
+ export interface IStatic extends Pick<IMenuItem, "id" | "kind" | "_" | "__"> {
151
+ kind: EProductKind.STATIC;
152
+ details: TDetails;
153
+ }
154
+ export interface IGroupConfig extends IMenuItem {
155
+ kind: EProductKind.CONFIG;
156
+ details?: TDetails;
157
+ selCtx?: string;
158
+ fltCtx?: string;
159
+ attrs?: IGroupAttributes;
160
+ filter?: IProductFilter;
161
+ }
162
+ export interface IGroupOptions extends IMenuItem {
163
+ kind: EProductKind.OPTIONS;
164
+ details?: TDetails;
165
+ selCtx?: string;
166
+ fltCtx?: string;
167
+ attrs?: IGroupAttributes;
168
+ filter?: IProductFilter;
169
+ }
170
+ export interface IMenuCategory extends Pick<IMenuItem, "id" | "kind" | "_" | "__" | "details"> {
171
+ kind: EProductKind.CATEGORY;
172
+ }
173
+ export interface IMenuProduct extends IMenuItem {
174
+ kind: EProductKind.PRODUCT;
175
+ }
176
+ export type MenuProduct = IMenuCategory | ICmsReference | IStatic | IGroupConfig | IGroupOptions | IMenuProduct;
118
177
  /**
119
178
  * IProductFrontAttributes
120
179
  *
121
180
  * @interface IProductFrontAttributes attributes are added by useMenu hook
122
181
  * @isHiddenByEnableKey {boolean} product has not been enabled by one of its enableKeys
123
182
  */
124
- export interface IProductFrontAttributes {
183
+ export interface IProductFrontAttributes extends IStringKeyRecord<any> {
125
184
  isHiddenByEnableKey?: boolean;
126
185
  lineExtra?: IStringKeyRecord<string>;
127
186
  cmsData?: any;
@@ -130,7 +189,7 @@ export interface IProduct {
130
189
  availability?: IProductAvailability;
131
190
  id: string;
132
191
  img?: string;
133
- cmsId?: string;
192
+ reference?: string;
134
193
  items?: IProduct[];
135
194
  kind: EProductKind | EProductKindBucket;
136
195
  literals?: TLiterals;
package/dist/esm/index.js CHANGED
@@ -25,6 +25,7 @@ export var EProductKindBucket;
25
25
  EProductKindBucket["GROUP"] = "group";
26
26
  EProductKindBucket["PRODUCT"] = "product";
27
27
  })(EProductKindBucket || (EProductKindBucket = {}));
28
+ ;
28
29
  export var EOrderUserRole;
29
30
  (function (EOrderUserRole) {
30
31
  EOrderUserRole["CREATOR"] = "CREATOR";
package/package.json CHANGED
@@ -1,22 +1,23 @@
1
- {
2
- "name": "@orderingstack/ordering-types",
3
- "version": "1.24.2",
4
- "description": "Typescript types for @orderingstack",
5
- "types": "dist/esm/index.d.ts",
6
- "main": "dist/cjs/index.js",
7
- "module": "dist/esm/index.js",
8
- "files": [
9
- "dist/"
10
- ],
11
- "author": "Tomasz Rojek <tomasz.rojek@e3.pl>",
12
- "devDependencies": {
13
- "@types/react": "^18.0.26",
14
- "react": "^18.2.0",
15
- "react-hook-form": "^7.42.0",
16
- "react-spring": "^9.6.1",
17
- "typescript": "next"
18
- },
19
- "scripts": {
20
- "build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json"
21
- }
1
+ {
2
+ "name": "@orderingstack/ordering-types",
3
+ "version": "1.25.0-beta.1",
4
+ "description": "Typescript types for @orderingstack",
5
+ "types": "dist/esm/index.d.ts",
6
+ "main": "dist/cjs/index.js",
7
+ "module": "dist/esm/index.js",
8
+ "files": [
9
+ "dist/"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
13
+ "prepublishOnly": "npm run build"
14
+ },
15
+ "author": "Tomasz Rojek <tomasz.rojek@e3.pl>",
16
+ "devDependencies": {
17
+ "@types/react": "^18.0.26",
18
+ "react": "^18.2.0",
19
+ "react-hook-form": "^7.42.0",
20
+ "react-spring": "^9.6.1",
21
+ "typescript": "next"
22
+ }
22
23
  }