@smartico/public-api 0.0.237 → 0.0.239

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/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)
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.237",
3
+ "version": "0.0.239",
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,7 +2,7 @@ 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
  */
@@ -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 { }
@@ -10,3 +10,5 @@ export * from './RafflePrizeWinner';
10
10
  export * from './RaffleTicket';
11
11
  export * from './GetRaffleDrawRunsHistoryRequest';
12
12
  export * from './GetRaffleDrawRunsHistoryResponse';
13
+ export * from './RaffleClaimPrizeRequest';
14
+ export * from './RaffleClaimPrizeResponse';
@@ -244,8 +244,8 @@ class SmarticoAPI {
244
244
  public static getAvatarUrl(label_api_key: string): string {
245
245
  const envId = SmarticoAPI.getEnvDnsSuffix(label_api_key);
246
246
  const avatarUrl = AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
247
-
248
- if (envId === '4') {
247
+ const envs = ['4', '5', '6', '7'];
248
+ if (envs.includes(envId)) {
249
249
  return SmarticoAPI.replaceSmrDomainsWithCloudfront(avatarUrl);
250
250
  } else {
251
251
  return avatarUrl;
@@ -267,8 +267,9 @@ class SmarticoAPI {
267
267
  const timeStart = new Date().getTime();
268
268
  result = await this.messageSender(message, this.publicUrl, expectCID);
269
269
  const timeEnd = new Date().getTime();
270
+ const envs = ['4', '5', '6', '7'];
270
271
 
271
- if (SmarticoAPI.getEnvDnsSuffix(this.label_api_key) === '4' && result) {
272
+ if (envs.includes(SmarticoAPI.getEnvDnsSuffix(this.label_api_key)) && result) {
272
273
  result = SmarticoAPI.replaceSmrDomainsWithCloudfront(result);
273
274
  }
274
275
 
@@ -1001,7 +1002,7 @@ class SmarticoAPI {
1001
1002
  }
1002
1003
 
1003
1004
  public async getCustomSectionsT(user_ext_id: string): Promise<TUICustomSection[]> {
1004
- return UICustomSectionTransform(Object.values((await this.getCustomSections(user_ext_id)).customSections));
1005
+ return UICustomSectionTransform(await this.getCustomSections(user_ext_id));
1005
1006
  }
1006
1007
 
1007
1008
  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 */