@smartico/public-api 0.0.107 → 0.0.108
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/Inbox/GetInboxMessagesResponse.d.ts +2 -0
- package/dist/Inbox/InboxMessage.d.ts +15 -12
- package/dist/Inbox/MarkInboxMessageDeletedResponse.d.ts +1 -0
- package/dist/Inbox/MarkInboxMessageReadResponse.d.ts +1 -0
- package/dist/Inbox/MarkInboxMessageStarredResponse.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +14 -3
- package/dist/WSAPI/WSAPI.d.ts +31 -2
- package/dist/WSAPI/WSAPITypes.d.ts +39 -1
- package/dist/index.js +322 -39
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +190 -16
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +3 -0
- package/docs/classes/WSAPI.md +144 -27
- package/docs/interfaces/InboxMarkMessageAction.md +17 -0
- package/docs/interfaces/TInboxMessage.md +33 -0
- package/docs/interfaces/TInboxMessageBody.md +52 -0
- package/docs/interfaces/TMissionOrBadge.md +1 -1
- package/docs/interfaces/TTournament.md +1 -1
- package/docs/interfaces/TTournamentDetailed.md +2 -2
- package/package.json +1 -1
- package/src/Inbox/GetInboxMessagesResponse.ts +14 -0
- package/src/Inbox/InboxMessage.ts +35 -9
- package/src/Inbox/MarkInboxMessageDeletedResponse.ts +1 -0
- package/src/Inbox/MarkInboxMessageReadResponse.ts +1 -0
- package/src/Inbox/MarkInboxMessageStarredResponse.ts +1 -0
- package/src/SmarticoAPI.ts +94 -3
- package/src/WSAPI/WSAPI.ts +82 -2
- package/src/WSAPI/WSAPITypes.ts +42 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { TInboxMessage } from "src/WSAPI/WSAPITypes";
|
|
1
2
|
import { ProtocolResponse } from "../Base/ProtocolResponse";
|
|
2
3
|
import { InboxMessage } from "./InboxMessage";
|
|
3
4
|
export interface GetInboxMessagesResponse extends ProtocolResponse {
|
|
4
5
|
log: InboxMessage[];
|
|
5
6
|
}
|
|
7
|
+
export declare const InboxMessagesTransform: (items: InboxMessage[]) => TInboxMessage[];
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
+
import { TInboxMessageBody } from "src/WSAPI/WSAPITypes";
|
|
1
2
|
import { InboxMessageType } from "./InboxMessageType";
|
|
3
|
+
export interface InboxMessageBody {
|
|
4
|
+
action: string;
|
|
5
|
+
body: string;
|
|
6
|
+
type: InboxMessageType;
|
|
7
|
+
image: string;
|
|
8
|
+
title: string;
|
|
9
|
+
html_body: string;
|
|
10
|
+
additional_buttons?: {
|
|
11
|
+
inbox_cta_text: string;
|
|
12
|
+
action: string;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
2
15
|
export interface InboxMessage {
|
|
3
16
|
createDate: string;
|
|
4
|
-
body:
|
|
5
|
-
action: string;
|
|
6
|
-
body: string;
|
|
7
|
-
type: InboxMessageType;
|
|
8
|
-
image: string;
|
|
9
|
-
title: string;
|
|
10
|
-
html_body: string;
|
|
11
|
-
additional_buttons?: {
|
|
12
|
-
inbox_cta_text: string;
|
|
13
|
-
action: string;
|
|
14
|
-
}[];
|
|
15
|
-
};
|
|
17
|
+
body: InboxMessageBody;
|
|
16
18
|
engagement_uid: string;
|
|
17
19
|
is_read: boolean;
|
|
18
20
|
is_starred: boolean;
|
|
19
21
|
is_deleted: boolean;
|
|
20
22
|
}
|
|
23
|
+
export declare const InboxMessageBodyTransform: (item: InboxMessageBody) => TInboxMessageBody;
|
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -2,20 +2,21 @@ import { ClassId } from "./Base/ClassId";
|
|
|
2
2
|
import { SAWGetTemplatesResponse } from './MiniGames/SAWGetTemplatesResponse';
|
|
3
3
|
import { ILogger } from './ILogger';
|
|
4
4
|
import { SAWDoAknowledgeResponse, SAWDoSpinResponse } from './MiniGames';
|
|
5
|
-
import { GetTranslationsResponse, ResponseIdentify, TranslationArea } from './Core';
|
|
5
|
+
import { GetTranslationsResponse, PublicLabelSettings, ResponseIdentify, TranslationArea } from './Core';
|
|
6
6
|
import { GetLabelInfoResponse } from './Core/GetLabelInfoResponse';
|
|
7
|
-
import { GetInboxMessagesResponse } from './Inbox';
|
|
7
|
+
import { GetInboxMessagesResponse, InboxMessageBody, MarkInboxMessageDeletedResponse, MarkInboxMessageReadResponse, MarkInboxMessageStarredResponse } from './Inbox';
|
|
8
8
|
import { BuyStoreItemResponse, GetCategoriesStoreResponse, GetStoreItemsResponse } from './Store';
|
|
9
9
|
import { AchievementOptinResponse, GetAchievementMapResponse } from './Missions';
|
|
10
10
|
import { GetTournamentInfoResponse, GetTournamentsResponse, TournamentRegisterResponse } from './Tournaments';
|
|
11
11
|
import { LeaderBoardDetails, LeaderBoardPeriodType } from "./Leaderboard";
|
|
12
12
|
import { GetLevelMapResponse } from "./Level";
|
|
13
13
|
import { WSAPI } from "./WSAPI/WSAPI";
|
|
14
|
-
import { TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed } from "./WSAPI/WSAPITypes";
|
|
14
|
+
import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed } from "./WSAPI/WSAPITypes";
|
|
15
15
|
interface Tracker {
|
|
16
16
|
label_api_key: string;
|
|
17
17
|
userPublicProps: any;
|
|
18
18
|
on: (callBackKey: ClassId, func: (data: any) => void) => void;
|
|
19
|
+
getLabelSetting: (key: PublicLabelSettings) => any;
|
|
19
20
|
}
|
|
20
21
|
interface IOptions {
|
|
21
22
|
logger?: ILogger;
|
|
@@ -30,6 +31,7 @@ declare class SmarticoAPI {
|
|
|
30
31
|
private messageSender;
|
|
31
32
|
private publicUrl;
|
|
32
33
|
private wsUrl;
|
|
34
|
+
private inboxCdnUrl;
|
|
33
35
|
private partnerUrl;
|
|
34
36
|
avatarDomain: string;
|
|
35
37
|
private logger;
|
|
@@ -76,6 +78,15 @@ declare class SmarticoAPI {
|
|
|
76
78
|
levelsGet(user_ext_id: string): Promise<GetLevelMapResponse>;
|
|
77
79
|
levelsGetT(user_ext_id: string): Promise<TLevel[]>;
|
|
78
80
|
getTranslationsT(user_ext_id: string, lang_code: string, areas: TranslationArea[], cacheSec?: number): Promise<GetTranslationsResponse>;
|
|
81
|
+
getInboxMessages(user_ext_id: string, limit: number, offset: number, starred_only: boolean): Promise<GetInboxMessagesResponse>;
|
|
82
|
+
getInboxMessagesT(user_ext_id: string, from?: number, to?: number, favoriteOnly?: boolean): Promise<TInboxMessage[]>;
|
|
83
|
+
getInboxMessageBody(messageGuid: string): Promise<InboxMessageBody>;
|
|
84
|
+
getInboxMessageBodyT(messageGuid: string): Promise<TInboxMessageBody>;
|
|
85
|
+
markInboxMessageRead(user_ext_id: string, messageGuid: string): Promise<MarkInboxMessageReadResponse>;
|
|
86
|
+
markAllInboxMessageRead(user_ext_id: string): Promise<MarkInboxMessageReadResponse>;
|
|
87
|
+
markUnmarkInboxMessageAsFavorite(user_ext_id: string, messageGuid: string, mark: boolean): Promise<MarkInboxMessageStarredResponse>;
|
|
88
|
+
deleteInboxMessage(user_ext_id: string, messageGuid: string): Promise<MarkInboxMessageDeletedResponse>;
|
|
89
|
+
deleteAllInboxMessages(user_ext_id: string): Promise<MarkInboxMessageDeletedResponse>;
|
|
79
90
|
getWSCalls(): WSAPI;
|
|
80
91
|
}
|
|
81
92
|
export { SmarticoAPI, MessageSender };
|
package/dist/WSAPI/WSAPI.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SmarticoAPI } from "../SmarticoAPI";
|
|
2
|
-
import { TBuyStoreItemResult, TGetTranslations, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionOptInResult, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile } from "./WSAPITypes";
|
|
2
|
+
import { InboxMarkMessageAction, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionOptInResult, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile } from "./WSAPITypes";
|
|
3
3
|
/** @group General API */
|
|
4
4
|
export declare class WSAPI {
|
|
5
5
|
private api;
|
|
@@ -50,10 +50,38 @@ export declare class WSAPI {
|
|
|
50
50
|
getTournamentsList({ onUpdate }?: {
|
|
51
51
|
onUpdate?: (data: TTournament[]) => void;
|
|
52
52
|
}): Promise<TTournament[]>;
|
|
53
|
-
/** Returns details information of specific tournament instance, the response will
|
|
53
|
+
/** Returns details information of specific tournament instance, the response will include tournament info and the leaderboard of players */
|
|
54
54
|
getTournamentInstanceInfo(tournamentInstanceId: number): Promise<TTournamentDetailed>;
|
|
55
55
|
/** Requests registration for the specified tournament instance. Returns the err_code. */
|
|
56
56
|
registerInTournament(tournamentInstanceId: number): Promise<TTournamentRegistrationResult>;
|
|
57
|
+
/** Returns inbox messages based on the provided parameters. "From" and "to" indicate the range of messages to be fetched.
|
|
58
|
+
* The maximum number of messages per request is limited to 20. An indicator "onlyFavorite" can be passed to get only messages marked as favorites.
|
|
59
|
+
* You can leave this params empty and by default it will return list of messages ranging from 0 to 20.
|
|
60
|
+
* This functions return list of messages without the body of the message.
|
|
61
|
+
* To get the body of the message you need to call getInboxMessageBody function and pass the message guid contained in each message of this request.
|
|
62
|
+
* All other action like mark as read, favorite, delete, etc. can be done using this message GUID.
|
|
63
|
+
* The "onUpdate" callback will be triggered when the user receives a new message. It will provide an updated list of messages, ranging from 0 to 20, to the onUpdate callback function. */
|
|
64
|
+
/**
|
|
65
|
+
* @param params
|
|
66
|
+
*/
|
|
67
|
+
getInboxMessages({ from, to, onlyFavorite, onUpdate }?: {
|
|
68
|
+
from?: number;
|
|
69
|
+
to?: number;
|
|
70
|
+
onlyFavorite?: boolean;
|
|
71
|
+
onUpdate?: (data: TInboxMessage[]) => void;
|
|
72
|
+
}): Promise<TInboxMessage[]>;
|
|
73
|
+
/** Returns the message body of the specified message guid. */
|
|
74
|
+
getInboxMessageBody(messageGuid: string): Promise<TInboxMessageBody>;
|
|
75
|
+
/** Requests to mark inbox message with specified guid as read */
|
|
76
|
+
markInboxMessageAsRead(messageGuid: string): Promise<InboxMarkMessageAction>;
|
|
77
|
+
/** Requests to mark all inbox messages as read */
|
|
78
|
+
markAllInboxMessagesAsRead(): Promise<InboxMarkMessageAction>;
|
|
79
|
+
/** Requests to mark inbox message with specified guid as favorite. Pass mark true to add message to favorite and false to remove. */
|
|
80
|
+
markUnmarkInboxMessageAsFavorite(messageGuid: string, mark: boolean): Promise<InboxMarkMessageAction>;
|
|
81
|
+
/** Requests to delete inbox message */
|
|
82
|
+
deleteInboxMessage(messageGuid: string): Promise<InboxMarkMessageAction>;
|
|
83
|
+
/** Requests to delete all inbox messages */
|
|
84
|
+
deleteAllInboxMessages(): Promise<InboxMarkMessageAction>;
|
|
57
85
|
/** Requests translations for the given language. Returns the object including translation key/translation value pairs. All possible translation keys defined in the back office. */
|
|
58
86
|
getTranslations(lang_code: string): Promise<TGetTranslations>;
|
|
59
87
|
private updateOnSpin;
|
|
@@ -61,5 +89,6 @@ export declare class WSAPI {
|
|
|
61
89
|
private updateOnPrizeWin;
|
|
62
90
|
private updateMissionsOnOptIn;
|
|
63
91
|
private updateTournamentsOnRegistration;
|
|
92
|
+
private updateInboxMessages;
|
|
64
93
|
private updateEntity;
|
|
65
94
|
}
|
|
@@ -358,7 +358,7 @@ export interface TMissionOrBadge {
|
|
|
358
358
|
progress: number;
|
|
359
359
|
/**
|
|
360
360
|
* The action that should be performed when user clicks on the mission or badge
|
|
361
|
-
* Can be URL or deep link, e.g. 'dp:deposit'. The most safe to execute CTA is to pass it to _smartico.
|
|
361
|
+
* Can be URL or deep link, e.g. 'dp:deposit'. The most safe to execute CTA is to pass it to _smartico.dp(cta_action);
|
|
362
362
|
* The 'dp' function will handle the CTA and will execute it in the most safe way
|
|
363
363
|
*/
|
|
364
364
|
cta_action: string;
|
|
@@ -438,4 +438,42 @@ export interface TGetTranslations {
|
|
|
438
438
|
[key: string]: string;
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
|
+
export interface TInboxMessage {
|
|
442
|
+
/** Uniq identifier of the message. It is needed to request the message body, mark the message as read/deleted/favorite. */
|
|
443
|
+
message_guid: string;
|
|
444
|
+
/** Date when the message was sent */
|
|
445
|
+
sent_date: string;
|
|
446
|
+
/** Indicator if a message is read */
|
|
447
|
+
read: boolean;
|
|
448
|
+
/** Indicator if a message is added to favorites */
|
|
449
|
+
favorite: boolean;
|
|
450
|
+
}
|
|
451
|
+
export interface TInboxMessageBody {
|
|
452
|
+
/** Message title */
|
|
453
|
+
title: string;
|
|
454
|
+
/** Short preview body of the message */
|
|
455
|
+
preview_body: string;
|
|
456
|
+
/** Message icon */
|
|
457
|
+
icon: string;
|
|
458
|
+
/** The action that should be performed when user clicks on the message.
|
|
459
|
+
* Can be URL or deep link, e.g. 'dp:deposit'. The most safe to execute CTA is to pass it to _smartico.dp(cta_action);
|
|
460
|
+
* The 'dp' function will handle the CTA and will execute it in the most safe way.
|
|
461
|
+
* If the message has a rich html body - the action will always be 'dp:inbox' which will open the inbox widget when triggered. */
|
|
462
|
+
action: string;
|
|
463
|
+
/** Rich HTML body of the message. */
|
|
464
|
+
html_body?: string;
|
|
465
|
+
/** Optional additional buttons to show in the message, available only if message has rich HTML body. Max count - 2. */
|
|
466
|
+
buttons?: {
|
|
467
|
+
/** The action that should be performed when user clicks on the button. The logic is the same as for message actions */
|
|
468
|
+
action: string;
|
|
469
|
+
/** Button text */
|
|
470
|
+
text: string;
|
|
471
|
+
}[];
|
|
472
|
+
}
|
|
473
|
+
export interface InboxMarkMessageAction {
|
|
474
|
+
/** An error code representing the result of marking a message as deleted, favorite or read. Successful marking action if err_code is 0 */
|
|
475
|
+
err_code: number;
|
|
476
|
+
/** Optional error message */
|
|
477
|
+
err_message: string;
|
|
478
|
+
}
|
|
441
479
|
export {};
|