@orderingstack/ordering-types 1.18.0 → 1.18.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.
package/dist/cjs/api.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { EOrderPaymentType, EOrderStatus, EOrderType, IProductState, IStringKeyRecord } from "./index";
2
2
  export declare const aggregators: readonly ["GLOVO", "JUSTEAT", "UBER", "WOLT", "BOLT", "TAZZ", "_ANY_"];
3
- export declare type TAggregator = typeof aggregators[number];
4
- declare type TOrderDir = "DESC" | "ASC";
3
+ export type TAggregator = typeof aggregators[number];
4
+ type TOrderDir = "DESC" | "ASC";
5
5
  interface ApiParams {
6
6
  query?: any;
7
7
  headers?: IStringKeyRecord<string>;
@@ -39,7 +39,7 @@ export interface ILanguage {
39
39
  key: string;
40
40
  icon: any;
41
41
  }
42
- export declare type TStringBoolean = "true" | "false";
42
+ export type TStringBoolean = "true" | "false";
43
43
  export declare enum EProductKind {
44
44
  GROUP = "3e/group",
45
45
  PRODUCT = "3e/product",
@@ -54,14 +54,14 @@ export declare enum EProductKindBucket {
54
54
  GROUP = "group",
55
55
  PRODUCT = "product"
56
56
  }
57
- export declare type TLiterals = {
57
+ export type TLiterals = {
58
58
  name: string;
59
59
  upsizeName?: string;
60
60
  fiscal?: string;
61
61
  "target-product-id"?: string;
62
62
  description?: string;
63
63
  } & IStringKeyRecord<string | undefined>;
64
- export declare type TMedia = {
64
+ export type TMedia = {
65
65
  url: string;
66
66
  name: string;
67
67
  };
@@ -448,7 +448,7 @@ export interface ISubTotalDiscount {
448
448
  discount: number;
449
449
  vat: string;
450
450
  }
451
- export declare type IOrderGroupProduct = Pick<IOrderProduct, "kind" | "id" | "literals" | "items" | "extra">;
451
+ export type IOrderGroupProduct = Pick<IOrderProduct, "kind" | "id" | "literals" | "items" | "extra">;
452
452
  export interface IOrderProduct {
453
453
  id: string;
454
454
  kind: EOrderProductKind;
@@ -472,11 +472,11 @@ export declare enum EOrderLineStatus {
472
472
  export interface IDiscount {
473
473
  layer: string;
474
474
  name?: string;
475
- discountPrice: number;
475
+ discountPrice: number | string;
476
476
  type: string;
477
- product: string;
477
+ product?: string;
478
478
  path?: string;
479
- price: number;
479
+ price?: number | string;
480
480
  }
481
481
  export declare enum EOrderProductKind {
482
482
  GROUP = "group",
@@ -485,8 +485,8 @@ export declare enum EOrderProductKind {
485
485
  export interface IProductLiterals {
486
486
  [propName: string]: any;
487
487
  }
488
- declare type TWeekDay = "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT" | "SUN";
489
- export declare type TSaleChannelWeek = Partial<Record<TWeekDay, {
488
+ type TWeekDay = "MON" | "TUE" | "WED" | "THU" | "FRI" | "SAT" | "SUN";
489
+ export type TSaleChannelWeek = Partial<Record<TWeekDay, {
490
490
  from: string;
491
491
  to: string;
492
492
  }[]>>;
@@ -560,14 +560,14 @@ export interface IFiscalizeData {
560
560
  };
561
561
  }
562
562
  declare const sizes: readonly [48, 57, 70, 100, 160, 250, 300, 500, 600, 900, 1000, 1920, 1080, 900];
563
- export declare type TMediaSize = (typeof sizes)[number];
563
+ export type TMediaSize = (typeof sizes)[number];
564
564
  export declare enum ENotificationType {
565
565
  ORDER_EVENT_ERROR = "OrderEventError",
566
566
  ORDER_APPLIED_EVENTS = "OrderAppliedEvents",
567
567
  ORDER_EVENT_FISCAL = "OrderEventFiscal",
568
568
  ORDER_UPSELL = "OrderUpsell"
569
569
  }
570
- export declare type TUpsellKind = "ANY" | "POPUP" | "SIDE" | "BASKET";
570
+ export type TUpsellKind = "ANY" | "POPUP" | "SIDE" | "BASKET";
571
571
  export interface IUpsellNotification {
572
572
  details: {
573
573
  literals?: IStringKeyRecord<string>;
@@ -138,7 +138,7 @@ export declare const KioskErrors: {
138
138
  x500: string;
139
139
  x501: string;
140
140
  };
141
- export declare type TErrorCode = keyof typeof KioskErrors;
141
+ export type TErrorCode = keyof typeof KioskErrors;
142
142
  export interface IKioskError {
143
143
  errorType: string;
144
144
  errorCode: TErrorCode;
@@ -1,4 +1,42 @@
1
1
  import { IOrder } from "./index";
2
+ /** States define flow of campaign */
3
+ interface CampaignStateDefinition {
4
+ /**
5
+ * @minLength 1
6
+ * @maxLength 32
7
+ * @pattern [a-zA-Z0-9_-]+
8
+ */
9
+ id: string;
10
+ /**
11
+ * @minLength 1
12
+ * @maxLength 32
13
+ * @pattern [a-zA-Z0-9_-]+
14
+ */
15
+ transitionTo?: string;
16
+ /** @format int64 */
17
+ stats?: number;
18
+ type: string;
19
+ }
20
+ /** Define push notification templates */
21
+ export interface CampaignNotification {
22
+ /**
23
+ * @minLength 0
24
+ * @maxLength 256
25
+ */
26
+ title: string;
27
+ /**
28
+ * @minLength 0
29
+ * @maxLength 256
30
+ */
31
+ message: string;
32
+ /**
33
+ * @minLength 0
34
+ * @maxLength 256
35
+ */
36
+ image?: string;
37
+ payload?: Record<string, string>;
38
+ type: string;
39
+ }
2
40
  export interface Campaign {
3
41
  /**
4
42
  * @minLength 0
@@ -6,24 +44,58 @@ export interface Campaign {
6
44
  * @pattern [a-zA-Z0-9_-]+
7
45
  */
8
46
  id: string;
9
- initialized?: boolean;
10
47
  /**
11
- * @minLength 0
48
+ * Name of a campaign
49
+ * @minLength 3
12
50
  * @maxLength 128
13
51
  */
14
52
  name: string;
53
+ /** @format date-time */
54
+ activeFrom?: string;
55
+ /** @format date-time */
56
+ activeTo?: string;
15
57
  /**
58
+ * Constraints are rules that specify which accounts fall info the campaign.
16
59
  * @maxItems 16
17
60
  * @minItems 1
18
61
  */
19
62
  constraints: Constraint[];
20
- /** @format date-time */
63
+ /**
64
+ * States define flow of campaign
65
+ * @maxItems 10
66
+ * @minItems 1
67
+ */
68
+ states: CampaignStateDefinition[];
69
+ /** Flag that determine if campaign can be dynamically joined upon account change or only initially assigned accounts take part in campaign. */
70
+ dynamic?: boolean;
71
+ /**
72
+ * Define push notification templates
73
+ * @maxItems 3
74
+ * @minItems 0
75
+ */
76
+ notifications?: CampaignNotification[];
77
+ /**
78
+ * When campaign was initialized
79
+ * @format date-time
80
+ */
21
81
  initializedAt?: string;
82
+ /** Who initialized the campaign */
22
83
  initializedBy?: string;
23
- /** @format int64 */
84
+ /** Whether campaign is initialized and running. There is a limit of simultaneously running campaigns. */
85
+ initialized?: boolean;
86
+ /**
87
+ * Number of accounts that fall info the campaign. Before initialization this is a predicted value, after initialization it is current value updated upon dynamic joins etc.
88
+ * @format int64
89
+ */
24
90
  cnt?: number;
25
- /** @format date-time */
91
+ /** How many accounts finished each campaign state */
92
+ stateStats?: Record<string, number>;
93
+ /**
94
+ * Preview generated at
95
+ * @format date-time
96
+ */
26
97
  previewedAt?: string;
98
+ /** Sample account ids for preview */
27
99
  samples?: string[];
28
100
  }
29
101
  interface Constraint {
@@ -0,0 +1,97 @@
1
+ import { EOrderPaymentType, EOrderStatus, EOrderType, IProductState, IStringKeyRecord } from "./index";
2
+ export declare const aggregators: readonly ["GLOVO", "JUSTEAT", "UBER", "WOLT", "BOLT", "TAZZ", "_ANY_"];
3
+ export type TAggregator = typeof aggregators[number];
4
+ type TOrderDir = "DESC" | "ASC";
5
+ interface ApiParams {
6
+ query?: any;
7
+ headers?: IStringKeyRecord<string>;
8
+ data?: any;
9
+ }
10
+ export interface IOrderApiGetListParams extends ApiParams {
11
+ query: {
12
+ _sort?: string;
13
+ _order?: TOrderDir;
14
+ _start?: number;
15
+ _end?: number;
16
+ id?: string;
17
+ extId?: string;
18
+ status?: EOrderStatus;
19
+ type?: EOrderType;
20
+ completed?: boolean;
21
+ closed?: boolean;
22
+ phone?: string;
23
+ mail?: string;
24
+ createdFrom?: string;
25
+ createdTo?: string;
26
+ completedFrom?: string;
27
+ completedTo?: string;
28
+ venue?: string;
29
+ aggregator?: TAggregator;
30
+ payment?: EOrderPaymentType;
31
+ };
32
+ headers: {
33
+ "x-tenant"?: string;
34
+ };
35
+ }
36
+ interface IDiscount {
37
+ /**
38
+ * Discount layer. It is used to distinguish discounts from loyalty, manual discounts, etc.
39
+ * @pattern [a-zA-Z0-9_.-]+
40
+ */
41
+ layer: string;
42
+ /**
43
+ * Name that describes this discount
44
+ * @minLength 0
45
+ * @maxLength 128
46
+ */
47
+ name?: string;
48
+ /** Discount price (subtracted from line total) */
49
+ discountPrice: number;
50
+ /** Extra params */
51
+ extra?: IStringKeyRecord<string>;
52
+ type: string;
53
+ }
54
+ interface ILineDiscount {
55
+ /** Applied discounts */
56
+ discount: IDiscount;
57
+ /** @format date-time */
58
+ expires?: string;
59
+ /**
60
+ * @minLength 0
61
+ * @maxLength 128
62
+ * @pattern [a-zA-Z0-9_. -]+
63
+ */
64
+ sign: string;
65
+ }
66
+ export interface IAppendedLine {
67
+ /**
68
+ * @format int32
69
+ * @min 1
70
+ * @max 100000
71
+ */
72
+ quantity: number;
73
+ /**
74
+ * One should not provide price - it will be automatically calculated. If user is privileged (internal system user or has role 'SU' or 'ALTERPRICE') OrderingStack will use provided price and override one from menu. Please be careful when providing value '0' as privileged user here! If you do not want to override price - do not provide 'price' attribute at all (null).
75
+ * @min 0
76
+ * @exclusiveMin false
77
+ */
78
+ price?: number;
79
+ /** @pattern [a-zA-Z0-9_.-]+ */
80
+ productId: string;
81
+ /** Configuration of product */
82
+ productConfig?: IProductState;
83
+ /** @default "NEW" */
84
+ status: "NEW" | "CONFIRMED";
85
+ /**
86
+ * @minLength 0
87
+ * @maxLength 255
88
+ */
89
+ comment?: string;
90
+ /**
91
+ * @maxItems 10
92
+ * @minItems 0
93
+ */
94
+ discounts?: ILineDiscount[];
95
+ extra?: IStringKeyRecord<string>;
96
+ }
97
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aggregators = void 0;
4
+ exports.aggregators = [
5
+ "GLOVO",
6
+ "JUSTEAT",
7
+ "UBER",
8
+ "WOLT",
9
+ "BOLT",
10
+ "TAZZ",
11
+ "_ANY_",
12
+ ];