@smartico/public-api 0.0.217 → 0.0.218

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.
@@ -726,6 +726,7 @@ The "onUpdate" callback will be triggered when the user receives a new message.
726
726
  | `params.from?` | `number` |
727
727
  | `params.to?` | `number` |
728
728
  | `params.onlyFavorite?` | `boolean` |
729
+ | `params.category_id?` | `InboxCategories` |
729
730
  | `params.onUpdate?` | (`data`: [`TInboxMessage`](../interfaces/TInboxMessage.md)[]) => `void` |
730
731
 
731
732
  #### Returns
@@ -31,3 +31,11 @@ ___
31
31
  • **favorite**: `boolean`
32
32
 
33
33
  Indicator if a message is added to favorites
34
+
35
+ ___
36
+
37
+ ### category_id
38
+
39
+ • **category_id**: `InboxCategories`
40
+
41
+ Category id per inbox message, can be part of System inboxes, Personal inboxes or General inbox messages
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.217",
3
+ "version": "0.0.218",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,7 +1,9 @@
1
+ import { InboxCategories } from './InboxCategories';
1
2
  import { ProtocolMessage } from '../Base/ProtocolMessage';
2
3
 
3
4
  export interface GetInboxMessagesRequest extends ProtocolMessage {
4
5
  limit?: number;
5
6
  offset?: number;
6
7
  starred_only?: boolean;
8
+ category_id?: InboxCategories;
7
9
  }
@@ -13,6 +13,7 @@ export const InboxMessagesTransform = (items: InboxMessage[]): TInboxMessage[] =
13
13
  message_guid: item.engagement_uid,
14
14
  read: item.is_read,
15
15
  favorite: item.is_starred,
16
+ category_id: item.category_id
16
17
  };
17
18
  return x;
18
19
  });
@@ -0,0 +1,5 @@
1
+ export enum InboxCategories {
2
+ General = 0,
3
+ Platform = 1,
4
+ Personal = 2,
5
+ }
@@ -1,4 +1,5 @@
1
1
  import { TInboxMessageBody } from '../WSAPI/WSAPITypes';
2
+ import { InboxCategories } from './InboxCategories';
2
3
  import { InboxMessageType } from './InboxMessageType';
3
4
  import { OpenLinksType } from './OpenLinksType';
4
5
 
@@ -42,6 +43,8 @@ export interface InboxMessage {
42
43
  is_starred: boolean;
43
44
  // flag that indicates if the message was deleted by the user. Such messages are not returned in the response and property is used only internaly in Smartico
44
45
  is_deleted?: boolean;
46
+ // category id of the inbox message, could be categorized as System/Personal/General messages in mentioned tabs
47
+ category_id?: InboxCategories;
45
48
  }
46
49
 
47
50
  export const InboxMessageBodyTransform = (item: InboxMessageBody): TInboxMessageBody => {
@@ -9,3 +9,4 @@ export * from './MarkInboxMessageStarredResponse';
9
9
  export * from './MarkInboxMessageDeletedRequest';
10
10
  export * from './MarkInboxMessageDeletedResponse';
11
11
  export * from './OpenLinksType';
12
+ export * from './InboxCategories';
@@ -123,6 +123,7 @@ import { GetRelatedAchTourRequest } from './Missions/GetRelatedAchTourRequest';
123
123
  import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse';
124
124
  import { GetRafflesResponse } from './Raffle/GetRafflesResponse';
125
125
  import { GetRafflesRequest } from './Raffle/GetRafflesRequest';
126
+ import { InboxCategories } from './Inbox/InboxCategories';
126
127
 
127
128
  const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
128
129
  const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
@@ -971,6 +972,7 @@ class SmarticoAPI {
971
972
  limit: number = 20,
972
973
  offset: number = 0,
973
974
  starred_only: boolean,
975
+ category_id?: InboxCategories,
974
976
  ): Promise<GetInboxMessagesResponse> {
975
977
  const message = this.buildMessage<GetInboxMessagesRequest, GetInboxMessagesResponse>(
976
978
  user_ext_id,
@@ -979,6 +981,7 @@ class SmarticoAPI {
979
981
  limit,
980
982
  offset,
981
983
  starred_only,
984
+ category_id,
982
985
  },
983
986
  );
984
987
  return await this.send<GetInboxMessagesResponse>(message, ClassId.GET_INBOX_MESSAGES_RESPONSE);
@@ -989,11 +992,12 @@ class SmarticoAPI {
989
992
  from: number = 0,
990
993
  to: number = 20,
991
994
  favoriteOnly: boolean = false,
995
+ categoryId?: InboxCategories,
992
996
  ): Promise<TInboxMessage[]> {
993
997
  const limit = to - from > 20 ? 20 : to - from;
994
998
  const offset = from;
995
999
 
996
- return InboxMessagesTransform((await this.getInboxMessages(user_ext_id, limit, offset, favoriteOnly)).log);
1000
+ return InboxMessagesTransform((await this.getInboxMessages(user_ext_id, limit, offset, favoriteOnly, categoryId)).log);
997
1001
  }
998
1002
 
999
1003
  public async getInboxMessageBody(messageGuid: string): Promise<InboxMessageBody> {
@@ -52,6 +52,7 @@ import { GetTournamentsResponse } from '../Tournaments';
52
52
  import { GetAchievementMapResponse } from '../Missions';
53
53
  import { GetRelatedAchTourResponse } from 'src/Missions/GetRelatedAchTourResponse';
54
54
  import { GetRafflesResponse } from '../Raffle/GetRafflesResponse';
55
+ import { InboxCategories } from '../Inbox/InboxCategories';
55
56
 
56
57
  /** @hidden */
57
58
  const CACHE_DATA_SEC = 30;
@@ -758,15 +759,15 @@ export class WSAPI {
758
759
  from,
759
760
  to,
760
761
  onlyFavorite,
762
+ categoryId,
761
763
  onUpdate,
762
- }: { from?: number; to?: number; onlyFavorite?: boolean; onUpdate?: (data: TInboxMessage[]) => void } = {}): Promise<
764
+ }: { from?: number; to?: number; onlyFavorite?: boolean; categoryId?: InboxCategories, onUpdate?: (data: TInboxMessage[]) => void } = {}): Promise<
763
765
  TInboxMessage[]
764
766
  > {
765
767
  if (onUpdate) {
766
768
  this.onUpdateCallback.set(onUpdateContextKey.InboxMessages, onUpdate);
767
769
  }
768
-
769
- return await this.api.getInboxMessagesT(null, from, to, onlyFavorite);
770
+ return await this.api.getInboxMessagesT(null, from, to, onlyFavorite, categoryId);
770
771
  }
771
772
 
772
773
  /**
@@ -6,6 +6,7 @@ import { LeaderBoardPeriodType } from '../Leaderboard';
6
6
  import { AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter } from '../CustomSections';
7
7
  import { BonusStatus , BonusTemplateMetaMap, BonusMetaMap} from '../Bonuses';
8
8
  import { PrizeModifiers } from '../MiniGames/PrizeModifiers';
9
+ import { InboxCategories } from '../Inbox/InboxCategories';
9
10
 
10
11
 
11
12
  type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string;
@@ -686,6 +687,8 @@ export interface TInboxMessage {
686
687
  read: boolean;
687
688
  /** Indicator if a message is added to favorites */
688
689
  favorite: boolean;
690
+ /** Category id per inbox message, can be part of System inboxes, Personal inboxes or General inbox messages */
691
+ category_id?: InboxCategories;
689
692
  }
690
693
 
691
694
  export interface TInboxMessageBody {