@smartico/public-api 0.0.236 → 0.0.238

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.
Files changed (36) hide show
  1. package/dist/Base/ClassId.d.ts +2 -0
  2. package/dist/CustomSections/UICustomSection.d.ts +2 -1
  3. package/dist/Raffle/GetRaffleDrawRunsHistoryRequest.d.ts +1 -1
  4. package/dist/Raffle/GetRaffleDrawRunsHistoryResponse.d.ts +1 -1
  5. package/dist/Raffle/RaffleClaimPrizeRequest.d.ts +4 -0
  6. package/dist/Raffle/RaffleClaimPrizeResponse.d.ts +3 -0
  7. package/dist/Raffle/RaffleDraw.d.ts +2 -47
  8. package/dist/Raffle/RaffleDrawPublicMeta.d.ts +14 -0
  9. package/dist/Raffle/RaffleDrawRun.d.ts +34 -0
  10. package/dist/Raffle/index.d.ts +3 -0
  11. package/dist/WSAPI/WSAPITypes.d.ts +2 -0
  12. package/dist/index.js +25 -20
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.modern.mjs +25 -16
  15. package/dist/index.modern.mjs.map +1 -1
  16. package/docs/README.md +2 -0
  17. package/docs/interfaces/GetRaffleDrawRunsHistoryRequest.md +3 -1
  18. package/docs/interfaces/RaffleClaimPrizeRequest.md +43 -0
  19. package/docs/interfaces/RaffleClaimPrizeResponse.md +57 -0
  20. package/docs/interfaces/RaffleDraw.md +2 -2
  21. package/docs/interfaces/RaffleDrawRun.md +10 -2
  22. package/docs/interfaces/RafflePrize.md +2 -2
  23. package/docs/interfaces/RafflePrizeWinner.md +2 -2
  24. package/package.json +1 -1
  25. package/src/Base/ClassId.ts +2 -0
  26. package/src/CustomSections/UICustomSection.ts +16 -6
  27. package/src/Raffle/GetRaffleDrawRunsHistoryRequest.ts +2 -2
  28. package/src/Raffle/GetRaffleDrawRunsHistoryResponse.ts +1 -1
  29. package/src/Raffle/RaffleClaimPrizeRequest.ts +5 -0
  30. package/src/Raffle/RaffleClaimPrizeResponse.ts +3 -0
  31. package/src/Raffle/RaffleDraw.ts +2 -58
  32. package/src/Raffle/RaffleDrawPublicMeta.ts +14 -0
  33. package/src/Raffle/RaffleDrawRun.ts +44 -0
  34. package/src/Raffle/index.ts +3 -0
  35. package/src/SmarticoAPI.ts +1 -1
  36. package/src/WSAPI/WSAPITypes.ts +2 -0
package/docs/README.md CHANGED
@@ -38,6 +38,8 @@
38
38
  - [GetRafflesRequest](interfaces/GetRafflesRequest.md)
39
39
  - [GetRafflesResponse](interfaces/GetRafflesResponse.md)
40
40
  - [Raffle](interfaces/Raffle.md)
41
+ - [RaffleClaimPrizeRequest](interfaces/RaffleClaimPrizeRequest.md)
42
+ - [RaffleClaimPrizeResponse](interfaces/RaffleClaimPrizeResponse.md)
41
43
  - [RaffleDraw](interfaces/RaffleDraw.md)
42
44
  - [RaffleDrawRun](interfaces/RaffleDrawRun.md)
43
45
  - [RafflePrize](interfaces/RafflePrize.md)
@@ -46,4 +46,6 @@ ___
46
46
 
47
47
  ### draw\_id
48
48
 
49
- • **draw\_id**: `number`
49
+ `Optional` **draw\_id**: `number`
50
+
51
+ If draw_id is not passed all draw runs that belong to raffle with passed raffle_id will be returned.
@@ -0,0 +1,43 @@
1
+ # Interface: RaffleClaimPrizeRequest
2
+
3
+ ## Hierarchy
4
+
5
+ - `ProtocolMessage`
6
+
7
+ ↳ **`RaffleClaimPrizeRequest`**
8
+
9
+ ## Properties
10
+
11
+ ### cid
12
+
13
+ • **cid**: `number`
14
+
15
+ #### Inherited from
16
+
17
+ ProtocolMessage.cid
18
+
19
+ ___
20
+
21
+ ### ts
22
+
23
+ • `Optional` **ts**: `number`
24
+
25
+ #### Inherited from
26
+
27
+ ProtocolMessage.ts
28
+
29
+ ___
30
+
31
+ ### uuid
32
+
33
+ • `Optional` **uuid**: `string`
34
+
35
+ #### Inherited from
36
+
37
+ ProtocolMessage.uuid
38
+
39
+ ___
40
+
41
+ ### won\_id
42
+
43
+ • **won\_id**: `number`
@@ -0,0 +1,57 @@
1
+ # Interface: RaffleClaimPrizeResponse
2
+
3
+ ## Hierarchy
4
+
5
+ - `ProtocolResponse`
6
+
7
+ ↳ **`RaffleClaimPrizeResponse`**
8
+
9
+ ## Properties
10
+
11
+ ### cid
12
+
13
+ • **cid**: `number`
14
+
15
+ #### Inherited from
16
+
17
+ ProtocolResponse.cid
18
+
19
+ ___
20
+
21
+ ### ts
22
+
23
+ • `Optional` **ts**: `number`
24
+
25
+ #### Inherited from
26
+
27
+ ProtocolResponse.ts
28
+
29
+ ___
30
+
31
+ ### uuid
32
+
33
+ • `Optional` **uuid**: `string`
34
+
35
+ #### Inherited from
36
+
37
+ ProtocolResponse.uuid
38
+
39
+ ___
40
+
41
+ ### errCode
42
+
43
+ • `Optional` **errCode**: `number`
44
+
45
+ #### Inherited from
46
+
47
+ ProtocolResponse.errCode
48
+
49
+ ___
50
+
51
+ ### errMsg
52
+
53
+ • `Optional` **errMsg**: `string`
54
+
55
+ #### Inherited from
56
+
57
+ ProtocolResponse.errMsg
@@ -78,9 +78,9 @@ Unique ID of the previusly executed draw (if there is such)
78
78
 
79
79
  ___
80
80
 
81
- ### ticket\_start\_date
81
+ ### ticket\_start\_ts
82
82
 
83
- • **ticket\_start\_date**: `number`
83
+ • **ticket\_start\_ts**: `number`
84
84
 
85
85
  Date/time starting from which the tickets will participate in the upcoming draw
86
86
  This value need to be taken into account with next_execute_ts field value, for example
@@ -35,9 +35,17 @@ Date/time of the draw execution
35
35
 
36
36
  ___
37
37
 
38
- ### ticket\_start\_date
38
+ ### actual\_execution\_ts
39
39
 
40
- • **ticket\_start\_date**: `number`
40
+ • **actual\_execution\_ts**: `number`
41
+
42
+ Actual Date/time of the draw execution
43
+
44
+ ___
45
+
46
+ ### ticket\_start\_ts
47
+
48
+ • **ticket\_start\_ts**: `number`
41
49
 
42
50
  Date/time starting from which the tickets will participate in the upcoming draw
43
51
  This value need to be taken into account with next_execute_ts field value, for example
@@ -132,9 +132,9 @@ the stock_items_per_draw will be decreasing by 1 each day (assuming there is eno
132
132
 
133
133
  ___
134
134
 
135
- ### is\_claimed
135
+ ### should\_claim
136
136
 
137
- • **is\_claimed**: `boolean`
137
+ • **should\_claim**: `boolean`
138
138
 
139
139
  Shows if the prize has been claimed
140
140
 
@@ -32,6 +32,6 @@ ___
32
32
 
33
33
  ___
34
34
 
35
- ### won\_ids
35
+ ### won\_id
36
36
 
37
- • **won\_ids**: `number`[]
37
+ • **won\_id**: `number`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.236",
3
+ "version": "0.0.238",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -155,6 +155,8 @@ export enum ClassId {
155
155
  RAF_GET_DRAW_RUN_RESPONSE = 905,
156
156
  RAF_GET_DRAW_HISTORY_REQUEST = 906,
157
157
  RAF_GET_DRAW_HISTORY_RESPONSE = 907,
158
+ RAF_CLAIM_PRIZE_REQUEST = 908,
159
+ RAF_CLAIM_PRIZE_RESPONSE = 909,
158
160
  /*
159
161
  RAF_GET_TICKETS_REQUEST = 902,
160
162
  RAF_GET_TICKETS_RESPONSE = 903,
@@ -5,6 +5,7 @@ import {
5
5
  AchMissionsTabsOptions,
6
6
  AchOverviewMissionsFilter,
7
7
  } from './AchCustomSection';
8
+ import { GetCustomSectionsResponse } from './GetCustomSectionsResponse';
8
9
 
9
10
  export interface UICustomSection {
10
11
  body?: string;
@@ -19,11 +20,16 @@ export interface UICustomSection {
19
20
  overview_missions_count?: number;
20
21
  }
21
22
 
22
- export const UICustomSectionTransform = (items: UICustomSection[]): TUICustomSection[] => {
23
- return items
24
- .filter((r) => r.section_type_id !== undefined && r.section_type_id >= 1)
25
- .map((r) => {
23
+ export const UICustomSectionTransform = (response: GetCustomSectionsResponse): TUICustomSection[] => {
24
+
25
+ const items: TUICustomSection[] = [];
26
+
27
+ Object.keys(response.customSections).forEach((key: string) => {
28
+ const r = response.customSections[key];
29
+ const id = parseInt(key);
30
+ if (r.section_type_id !== undefined && r.section_type_id >= 1) {
26
31
  const x: TUICustomSection = {
32
+ id: id,
27
33
  body: r.body,
28
34
  menu_img: r.menu_img,
29
35
  menu_name: r.menu_name,
@@ -35,6 +41,10 @@ export const UICustomSectionTransform = (items: UICustomSection[]): TUICustomSec
35
41
  overview_missions_filter: r.overview_missions_filter,
36
42
  theme: r.theme,
37
43
  };
38
- return x;
39
- });
44
+
45
+ items.push(x);
46
+ }
47
+ });
48
+
49
+ return items;
40
50
  };
@@ -2,9 +2,9 @@ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
2
 
3
3
  export interface GetRaffleDrawRunsHistoryRequest extends ProtocolMessage {
4
4
  raffle_id: number;
5
-
5
+
6
6
  /**
7
7
  * If draw_id is not passed all draw runs that belong to raffle with passed raffle_id will be returned.
8
8
  */
9
- draw_id: number;
9
+ draw_id?: number;
10
10
  }
@@ -1,5 +1,5 @@
1
1
  import { ProtocolResponse } from '../Base/ProtocolResponse';
2
- import { RaffleDrawRun } from './RaffleDraw';
2
+ import { RaffleDrawRun } from './RaffleDrawRun';
3
3
 
4
4
  export interface GetRaffleDrawRunsHistoryResponse extends ProtocolResponse {
5
5
  draw_runs: RaffleDrawRun[];
@@ -0,0 +1,5 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+
3
+ export interface RaffleClaimPrizeRequest extends ProtocolMessage {
4
+ won_id: number;
5
+ }
@@ -0,0 +1,3 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+
3
+ export interface RaffleClaimPrizeResponse extends ProtocolResponse { }
@@ -1,21 +1,7 @@
1
+ import { RaffleDrawPublicMeta } from "./RaffleDrawPublicMeta";
1
2
  import { RafflePrize } from "./RafflePrize";
2
3
  import { RaffleTicket } from "./RaffleTicket";
3
4
 
4
- interface RaffleDrawPublicMeta {
5
- /** Name of the draw, e.g. 'Daily draw' */
6
- name: string;
7
- /** Description of the draw */
8
- description: string;
9
- /** URL of the image that represents the draw */
10
- image_url: string;
11
- /** URL of the icon that represents the draw */
12
- icon_url: string;
13
- /** URL of the background image that will be used in the draw list item */
14
- background_image_url: string;
15
- /** Show if the draw is grand and is marked as special */
16
- is_grand: boolean;
17
- }
18
-
19
5
  enum RaffleDrawInstanceState {
20
6
  /** Draw is open for the tickets collection */
21
7
  Open = 1,
@@ -113,48 +99,6 @@ interface RaffleDraw {
113
99
  * List of last 5 tickets are collected by current user for this instance of draw.
114
100
  */
115
101
  my_last_tickets: RaffleTicket[];
116
-
117
- }
118
-
119
- interface RaffleDrawRun {
120
- /**
121
- * Id of the Draw definition, for the repetative draws (e.g. daily), this number will be the same for all draws that are repeating daily
122
- * (internal name: schedule_id)
123
- */
124
- draw_id: number;
125
-
126
- /**
127
- * Field indicates the ID of the latest instance/run of draw
128
- */
129
- run_id: number;
130
-
131
- /** Meta information of the Draw for the presentaiton in UI */
132
- public_meta: RaffleDrawPublicMeta;
133
-
134
-
135
- /** Date/time of the draw execution */
136
- execution_ts: number;
137
-
138
- /** Actual Date/time of the draw execution */
139
- actual_execution_ts: number;
140
-
141
- /**
142
- * Date/time starting from which the tickets will participate in the upcoming draw
143
- * This value need to be taken into account with next_execute_ts field value, for example
144
- * Next draw is at 10:00, ticket_start_date is 9:00, so all tickets that are collected after 9:00 will participate in the draw at 10:00
145
- * (internally this value is calculated as next_execute_ts - ticket_start_date)
146
- */
147
- ticket_start_ts: number;
148
-
149
- /**
150
- * Shows if user has won a prize in a current run
151
- */
152
- is_winner: boolean;
153
-
154
- /**
155
- * Shows if user has unclaimed prize
156
- */
157
- has_unclaimed_prize: boolean;
158
102
  }
159
103
 
160
- export { RaffleDraw, RaffleDrawRun };
104
+ export { RaffleDraw };
@@ -0,0 +1,14 @@
1
+ export interface RaffleDrawPublicMeta {
2
+ /** Name of the draw, e.g. 'Daily draw' */
3
+ name: string;
4
+ /** Description of the draw */
5
+ description: string;
6
+ /** URL of the image that represents the draw */
7
+ image_url: string;
8
+ /** URL of the icon that represents the draw */
9
+ icon_url: string;
10
+ /** URL of the background image that will be used in the draw list item */
11
+ background_image_url: string;
12
+ /** Show if the draw is grand and is marked as special */
13
+ is_grand: boolean;
14
+ }
@@ -0,0 +1,44 @@
1
+ import { RaffleDrawPublicMeta } from "./RaffleDrawPublicMeta";
2
+
3
+ interface RaffleDrawRun {
4
+ /**
5
+ * Id of the Draw definition, for the repetative draws (e.g. daily), this number will be the same for all draws that are repeating daily
6
+ * (internal name: schedule_id)
7
+ */
8
+ draw_id: number;
9
+
10
+ /**
11
+ * Field indicates the ID of the latest instance/run of draw
12
+ */
13
+ run_id: number;
14
+
15
+ /** Meta information of the Draw for the presentaiton in UI */
16
+ public_meta: RaffleDrawPublicMeta;
17
+
18
+
19
+ /** Date/time of the draw execution */
20
+ execution_ts: number;
21
+
22
+ /** Actual Date/time of the draw execution */
23
+ actual_execution_ts: number;
24
+
25
+ /**
26
+ * Date/time starting from which the tickets will participate in the upcoming draw
27
+ * This value need to be taken into account with next_execute_ts field value, for example
28
+ * Next draw is at 10:00, ticket_start_date is 9:00, so all tickets that are collected after 9:00 will participate in the draw at 10:00
29
+ * (internally this value is calculated as next_execute_ts - ticket_start_date)
30
+ */
31
+ ticket_start_ts: number;
32
+
33
+ /**
34
+ * Shows if user has won a prize in a current run
35
+ */
36
+ is_winner: boolean;
37
+
38
+ /**
39
+ * Shows if user has unclaimed prize
40
+ */
41
+ has_unclaimed_prize: boolean;
42
+ }
43
+
44
+ export { RaffleDrawRun };
@@ -4,8 +4,11 @@ export * from './GetRafflesRequest';
4
4
  export * from './GetRafflesResponse';
5
5
  export * from './Raffle';
6
6
  export * from './RaffleDraw';
7
+ export * from './RaffleDrawRun';
7
8
  export * from './RafflePrize';
8
9
  export * from './RafflePrizeWinner';
9
10
  export * from './RaffleTicket';
10
11
  export * from './GetRaffleDrawRunsHistoryRequest';
11
12
  export * from './GetRaffleDrawRunsHistoryResponse';
13
+ export * from './RaffleClaimPrizeRequest';
14
+ export * from './RaffleClaimPrizeResponse';
@@ -1001,7 +1001,7 @@ class SmarticoAPI {
1001
1001
  }
1002
1002
 
1003
1003
  public async getCustomSectionsT(user_ext_id: string): Promise<TUICustomSection[]> {
1004
- return UICustomSectionTransform(Object.values((await this.getCustomSections(user_ext_id)).customSections));
1004
+ return UICustomSectionTransform(await this.getCustomSections(user_ext_id));
1005
1005
  }
1006
1006
 
1007
1007
  public async getTranslationsT(
@@ -774,6 +774,8 @@ export interface TSegmentCheckResult {
774
774
  }
775
775
 
776
776
  export interface TUICustomSection {
777
+ /** The ID of the custom section */
778
+ id: number;
777
779
  /** The body of the custom section */
778
780
  body?: string;
779
781
  /** The image of the custom section */