@onylab/common-api 2.1.0 → 2.1.2

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.
@@ -15,6 +15,7 @@ declare module "api/hubrise/model/order/HubriseOrderStatus" {
15
15
  }
16
16
  declare module "api/hubrise/model/customer/HubriseCustomerContract" {
17
17
  export interface HubriseCustomerContract {
18
+ id?: string;
18
19
  first_name?: string;
19
20
  last_name?: string;
20
21
  gender?: string;
@@ -38,9 +39,11 @@ declare module "api/hubrise/model/customer/HubriseCustomerContract" {
38
39
  }
39
40
  declare module "api/hubrise/model/order/HubriseOrderOptionContract" {
40
41
  export interface HubriseOrderOptionContract {
42
+ id?: string;
43
+ ref?: string;
41
44
  option_list_name: string;
42
45
  name: string;
43
- ref?: string;
46
+ quantity: number;
44
47
  price?: string;
45
48
  removed?: boolean;
46
49
  }
@@ -48,12 +51,13 @@ declare module "api/hubrise/model/order/HubriseOrderOptionContract" {
48
51
  declare module "api/hubrise/model/order/HubriseOrderItemContract" {
49
52
  import { HubriseOrderOptionContract } from "api/hubrise/model/order/HubriseOrderOptionContract";
50
53
  export interface HubriseOrderItemContract {
54
+ id?: string;
51
55
  private_ref?: string;
52
- product_name: string;
53
- sku_name?: string;
54
56
  sku_ref?: string;
57
+ sku_name?: string;
58
+ product_name: string;
59
+ quantity: number;
55
60
  price?: string;
56
- quantity?: string;
57
61
  subtotal?: string;
58
62
  tax_rate?: string;
59
63
  customer_notes?: string;
@@ -109,6 +113,13 @@ declare module "api/hubrise/model/order/HubriseOrderDealContract" {
109
113
  ref?: string;
110
114
  }
111
115
  }
116
+ declare module "api/hubrise/model/order/HubriseServiceType" {
117
+ export enum HubriseServiceType {
118
+ DELIVERY = "delivery",
119
+ COLLECTION = "collection",// = pickup
120
+ EAT_IN = "eat_in"
121
+ }
122
+ }
112
123
  declare module "api/hubrise/model/order/HubriseOrderContract" {
113
124
  import { HubriseOrderStatus } from "api/hubrise/model/order/HubriseOrderStatus";
114
125
  import { HubriseCustomerContract } from "api/hubrise/model/customer/HubriseCustomerContract";
@@ -118,12 +129,13 @@ declare module "api/hubrise/model/order/HubriseOrderContract" {
118
129
  import { HubriseOrderPaymentContract } from "api/hubrise/model/order/HubriseOrderPaymentContract";
119
130
  import { HubriseOrderDiscountContract } from "api/hubrise/model/order/HubriseOrderDiscountContract";
120
131
  import { HubriseOrderDealContract } from "api/hubrise/model/order/HubriseOrderDealContract";
132
+ import { HubriseServiceType } from "api/hubrise/model/order/HubriseServiceType";
121
133
  export interface HubriseOrderContract {
122
134
  id?: string;
123
135
  location_id?: string;
124
136
  private_ref?: string;
125
137
  status: HubriseOrderStatus;
126
- service_type?: 'delivery' | 'collection' | 'eat_in';
138
+ service_type?: HubriseServiceType;
127
139
  service_type_ref?: string;
128
140
  channel?: string;
129
141
  expected_time?: string;
@@ -150,6 +162,7 @@ declare module "api/hubrise/model/order/HubriseOrderContract" {
150
162
  }
151
163
  declare module "api/hubrise/model/menu/HubriseMenuCategoryContract" {
152
164
  export interface HubriseMenuCategoryContract {
165
+ id: string;
153
166
  ref: string;
154
167
  parent_ref?: string;
155
168
  name: string;
@@ -172,13 +185,14 @@ declare module "api/hubrise/model/menu/HubriseMenuRestrictionsContract" {
172
185
  }
173
186
  }
174
187
  declare module "api/hubrise/model/menu/HubriseMenuPriceOverrideContract" {
188
+ import { HubriseServiceType } from "api/hubrise/model/order/HubriseServiceType";
175
189
  export interface HubriseMenuPriceOverrideContract {
176
190
  dow?: string;
177
191
  start_time?: string;
178
192
  end_time?: string;
179
193
  start_date?: string;
180
194
  end_date?: string;
181
- service_types?: ('delivery' | 'collection' | 'eat_in')[];
195
+ service_types?: HubriseServiceType[];
182
196
  price: string;
183
197
  }
184
198
  }
@@ -186,30 +200,38 @@ declare module "api/hubrise/model/menu/HubriseMenuSkuContract" {
186
200
  import { HubriseMenuRestrictionsContract } from "api/hubrise/model/menu/HubriseMenuRestrictionsContract";
187
201
  import { HubriseMenuPriceOverrideContract } from "api/hubrise/model/menu/HubriseMenuPriceOverrideContract";
188
202
  export interface HubriseMenuSkuContract {
203
+ id: string;
189
204
  ref?: string;
190
205
  name?: string;
191
206
  restrictions?: HubriseMenuRestrictionsContract;
192
207
  price: string;
193
208
  price_overrides: HubriseMenuPriceOverrideContract[];
194
- option_list_refs?: string[];
209
+ option_list_ids?: string[];
195
210
  tags?: string[];
196
211
  }
197
212
  }
198
213
  declare module "api/hubrise/model/menu/HubriseMenuProductContract" {
199
214
  import { HubriseMenuSkuContract } from "api/hubrise/model/menu/HubriseMenuSkuContract";
200
215
  export interface HubriseMenuProductContract {
216
+ id: string;
201
217
  ref?: string;
202
- category_ref: string;
218
+ category_id: string;
203
219
  name: string;
204
220
  description?: string;
205
221
  tags?: string[];
206
222
  image_ids: string[];
207
223
  skus: HubriseMenuSkuContract[];
224
+ tax_rate: {
225
+ delivery?: string;
226
+ collection?: string;
227
+ eat_in?: string;
228
+ };
208
229
  }
209
230
  }
210
231
  declare module "api/hubrise/model/menu/HubriseMenuProductOptionContract" {
211
232
  import { HubriseMenuPriceOverrideContract } from "api/hubrise/model/menu/HubriseMenuPriceOverrideContract";
212
233
  export interface HubriseMenuProductOptionContract {
234
+ id: string;
213
235
  ref?: string;
214
236
  name: string;
215
237
  price: string;
@@ -221,6 +243,7 @@ declare module "api/hubrise/model/menu/HubriseMenuProductOptionContract" {
221
243
  declare module "api/hubrise/model/menu/HubriseMenuProductOptionListContract" {
222
244
  import { HubriseMenuProductOptionContract } from "api/hubrise/model/menu/HubriseMenuProductOptionContract";
223
245
  export interface HubriseMenuProductOptionListContract {
246
+ id: string;
224
247
  ref: string;
225
248
  name: string;
226
249
  min_selections?: number;
@@ -284,7 +307,7 @@ declare module "api/hubrise/model/menu/HubriseMenuCatalogContract" {
284
307
  import { HubriseMenuDiscountContract } from "api/hubrise/model/menu/HubriseMenuDiscountContract";
285
308
  import { HubriseMenuChargeContract } from "api/hubrise/model/menu/HubriseMenuChargeContract";
286
309
  export interface HubriseMenuCatalogContract {
287
- id?: string;
310
+ id: string;
288
311
  location_id?: string;
289
312
  name: string;
290
313
  created_at?: string;
@@ -1187,6 +1210,142 @@ declare module "api/hubrise/model/menu/HubriseMenuImageContract" {
1187
1210
  seconds_before_removal: number;
1188
1211
  }
1189
1212
  }
1213
+ declare module "api/hubrise/model/order/HubriseOrderEditableOptionContract" {
1214
+ export interface HubriseOrderEditableOptionContract {
1215
+ id: string;
1216
+ ref?: string;
1217
+ option_list_name: string;
1218
+ name: string;
1219
+ quantity: number;
1220
+ price: string;
1221
+ }
1222
+ }
1223
+ declare module "api/hubrise/model/order/HubriseOrderEditableItemContract" {
1224
+ import { HubriseOrderEditableOptionContract } from "api/hubrise/model/order/HubriseOrderEditableOptionContract";
1225
+ export interface HubriseOrderEditableItemContract {
1226
+ id: string;
1227
+ sku_ref?: string;
1228
+ sku_name?: string;
1229
+ category_name?: string;
1230
+ product_name: string;
1231
+ quantity: number;
1232
+ price: string;
1233
+ tax_rate?: {
1234
+ delivery?: string;
1235
+ collection?: string;
1236
+ eat_in?: string;
1237
+ };
1238
+ customer_notes?: string;
1239
+ options?: HubriseOrderEditableOptionContract[];
1240
+ }
1241
+ }
1242
+ declare module "api/hubrise/service/HubriseCatalogConverterContract" {
1243
+ import { HubriseMenuCatalogContract } from "api/hubrise/model/menu/HubriseMenuCatalogContract";
1244
+ import { HubriseOrderEditableItemContract } from "api/hubrise/model/order/HubriseOrderEditableItemContract";
1245
+ import { HubriseOrderEditableOptionContract } from "api/hubrise/model/order/HubriseOrderEditableOptionContract";
1246
+ export interface HubriseCatalogConverterContract {
1247
+ editableItems(catalog: HubriseMenuCatalogContract): {
1248
+ withRef: HubriseOrderEditableItemContract[];
1249
+ withName: HubriseOrderEditableItemContract[];
1250
+ };
1251
+ editableItemOptions(catalog: HubriseMenuCatalogContract): {
1252
+ withRef: Record<string, HubriseOrderEditableOptionContract[]>;
1253
+ withName: Record<string, HubriseOrderEditableOptionContract[]>;
1254
+ };
1255
+ }
1256
+ }
1257
+ declare module "util/MathUtil" {
1258
+ export class MathUtil {
1259
+ static sum(values: number[]): number;
1260
+ static avg(values: number[]): number;
1261
+ static applyVariation(value: number, variation: number): number;
1262
+ static median(values: number[]): number;
1263
+ static percentage(part: number, total: number): number;
1264
+ static round(value: number, decimals: number): number;
1265
+ static variation(originalValue: number, newValue: number): number;
1266
+ }
1267
+ }
1268
+ declare module "api/hubrise/util/HubrisePriceUtil" {
1269
+ import { HubriseCurrencyCode } from "api/hubrise/model/common/HubriseCurrencyCode";
1270
+ export class HubrisePriceUtil {
1271
+ static sum(prices: string[], defaultCurrency?: HubriseCurrencyCode): string;
1272
+ static multiply(price: string, multiplier: number): string;
1273
+ static priceToAmount(price: string): {
1274
+ amount: number;
1275
+ currency: HubriseCurrencyCode;
1276
+ };
1277
+ static amountToPrice(amount: number, currency: HubriseCurrencyCode): string;
1278
+ }
1279
+ }
1280
+ declare module "api/hubrise/service/HubriseCatalogConverter" {
1281
+ import { HubriseCatalogConverterContract } from "api/hubrise/service/HubriseCatalogConverterContract";
1282
+ import { HubriseMenuCatalogContract } from "api/hubrise/model/menu/HubriseMenuCatalogContract";
1283
+ import { HubriseOrderEditableItemContract } from "api/hubrise/model/order/HubriseOrderEditableItemContract";
1284
+ import { HubriseOrderEditableOptionContract } from "api/hubrise/model/order/HubriseOrderEditableOptionContract";
1285
+ export class HubriseCatalogConverter implements HubriseCatalogConverterContract {
1286
+ editableItems(catalog: HubriseMenuCatalogContract): {
1287
+ withRef: HubriseOrderEditableItemContract[];
1288
+ withName: HubriseOrderEditableItemContract[];
1289
+ };
1290
+ editableItemOptions(catalog: HubriseMenuCatalogContract): {
1291
+ withRef: Record<string, HubriseOrderEditableOptionContract[]>;
1292
+ withName: Record<string, HubriseOrderEditableOptionContract[]>;
1293
+ };
1294
+ }
1295
+ }
1296
+ declare module "api/hubrise/service/HubriseOrderConverterContract" {
1297
+ import { HubriseOrderEditableItemContract } from "api/hubrise/model/order/HubriseOrderEditableItemContract";
1298
+ import { HubriseOrderItemContract } from "api/hubrise/model/order/HubriseOrderItemContract";
1299
+ import { HubriseServiceType } from "api/hubrise/model/order/HubriseServiceType";
1300
+ export interface HubriseOrderConverterContract {
1301
+ items(editableItems: HubriseOrderEditableItemContract[], serviceType: HubriseServiceType): HubriseOrderItemContract[];
1302
+ }
1303
+ }
1304
+ declare module "util/ObjectUtil" {
1305
+ export class ObjectUtil {
1306
+ static compact(obj: any, options?: {
1307
+ removeEmptyString?: boolean;
1308
+ }): any;
1309
+ static update(source: Record<string, unknown>, target: Record<string, unknown>): void;
1310
+ }
1311
+ }
1312
+ declare module "api/hubrise/service/HubriseOrderConverter" {
1313
+ import { HubriseOrderConverterContract } from "api/hubrise/service/HubriseOrderConverterContract";
1314
+ import { HubriseOrderItemContract } from "api/hubrise/model/order/HubriseOrderItemContract";
1315
+ import { HubriseOrderEditableItemContract } from "api/hubrise/model/order/HubriseOrderEditableItemContract";
1316
+ import { HubriseServiceType } from "api/hubrise/model/order/HubriseServiceType";
1317
+ export class HubriseOrderConverter implements HubriseOrderConverterContract {
1318
+ items(editableItems: HubriseOrderEditableItemContract[], serviceType: HubriseServiceType): HubriseOrderItemContract[];
1319
+ }
1320
+ }
1321
+ declare module "api/hubrise/service/TotalHubriseCalculatorContract" {
1322
+ import { HubriseCurrencyCode } from "api/hubrise/model/common/HubriseCurrencyCode";
1323
+ import { HubriseOrderContract } from "api/hubrise/model/order/HubriseOrderContract";
1324
+ export interface TotalHubriseCalculatorContract {
1325
+ calculateTotals(order: HubriseOrderContract, defaultCurrency: HubriseCurrencyCode): {
1326
+ subtotal: string;
1327
+ minimumOrderFee: string;
1328
+ deliveryFee: string;
1329
+ totalDiscount: string;
1330
+ total: string;
1331
+ };
1332
+ }
1333
+ }
1334
+ declare module "api/hubrise/service/TotalHubriseCalculator" {
1335
+ import { TotalHubriseCalculatorContract } from "api/hubrise/service/TotalHubriseCalculatorContract";
1336
+ import { HubriseCurrencyCode } from "api/hubrise/model/common/HubriseCurrencyCode";
1337
+ import { HubriseOrderContract } from "api/hubrise/model/order/HubriseOrderContract";
1338
+ export class TotalHubriseCalculator implements TotalHubriseCalculatorContract {
1339
+ calculateTotals(order: HubriseOrderContract, defaultCurrency: HubriseCurrencyCode): {
1340
+ subtotal: string;
1341
+ minimumOrderFee: string;
1342
+ deliveryFee: string;
1343
+ totalDiscount: string;
1344
+ total: string;
1345
+ };
1346
+ private findCurrency;
1347
+ }
1348
+ }
1190
1349
  declare module "api/web" {
1191
1350
  export * from "api/hubrise/model/account/HubriseAccountContract";
1192
1351
  export * from "api/hubrise/model/account/HubriseAuthContract";
@@ -1226,7 +1385,17 @@ declare module "api/web" {
1226
1385
  export * from "api/hubrise/model/order/HubriseOrderOptionContract";
1227
1386
  export * from "api/hubrise/model/order/HubriseOrderPaymentContract";
1228
1387
  export * from "api/hubrise/model/order/HubriseOrderStatus";
1388
+ export * from "api/hubrise/model/order/HubriseServiceType";
1229
1389
  export * from "api/hubrise/model/user/HubriseUserContract";
1390
+ export * from "api/hubrise/model/order/HubriseOrderEditableItemContract";
1391
+ export * from "api/hubrise/model/order/HubriseOrderEditableOptionContract";
1392
+ export * from "api/hubrise/service/HubriseCatalogConverter";
1393
+ export * from "api/hubrise/service/HubriseCatalogConverterContract";
1394
+ export * from "api/hubrise/service/HubriseOrderConverter";
1395
+ export * from "api/hubrise/service/HubriseOrderConverterContract";
1396
+ export * from "api/hubrise/service/TotalHubriseCalculator";
1397
+ export * from "api/hubrise/service/TotalHubriseCalculatorContract";
1398
+ export * from "api/hubrise/util/HubrisePriceUtil";
1230
1399
  }
1231
1400
  declare module "api/index" {
1232
1401
  export * from "api/hubrise/service/HubriseApiContract";
@@ -1933,24 +2102,6 @@ declare module "util/ExtractorUtil" {
1933
2102
  static phone(raw: string, locale: 'fr'): string;
1934
2103
  }
1935
2104
  }
1936
- declare module "util/MathUtil" {
1937
- export class MathUtil {
1938
- static sum(values: number[]): number;
1939
- static avg(values: number[]): number;
1940
- static applyVariation(value: number, variation: number): number;
1941
- static median(values: number[]): number;
1942
- static percentage(part: number, total: number): number;
1943
- static round(value: number, decimals: number): number;
1944
- static variation(originalValue: number, newValue: number): number;
1945
- }
1946
- }
1947
- declare module "util/ObjectUtil" {
1948
- export class ObjectUtil {
1949
- static compact(obj: any, options?: {
1950
- removeEmptyString?: boolean;
1951
- }): any;
1952
- }
1953
- }
1954
2105
  declare module "util/PriceUtil" {
1955
2106
  export class PriceUtil {
1956
2107
  private static readonly currencies;
@@ -1988,8 +2139,7 @@ declare module "@onylab/common-api" {
1988
2139
  import * as Util from "util/index";
1989
2140
  export { Api, Constant, Exception, Http, Mockup, Service, Template, Tool, Util };
1990
2141
  }
1991
- /// <amd-module name="@onylab/common-api" />
1992
- declare module "@onylab/common-api" {
2142
+ declare module "web" {
1993
2143
  import * as Api from "api/web";
1994
2144
  import * as Exception from "exception/index";
1995
2145
  import * as Util from "util/index";