@arkadiuminc/sdk 2.43.0 → 2.45.0
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.
|
@@ -30,15 +30,35 @@ export declare type ChatPresence = {
|
|
|
30
30
|
sessionId: string;
|
|
31
31
|
username: string;
|
|
32
32
|
};
|
|
33
|
+
export declare type MessageContent = {
|
|
34
|
+
type?: string;
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
};
|
|
37
|
+
declare const MESSAGE_STATE_UPDATE_TYPE = "message_state_update";
|
|
38
|
+
export { MESSAGE_STATE_UPDATE_TYPE };
|
|
39
|
+
export declare enum MessageStateValue {
|
|
40
|
+
Sent = "sent",
|
|
41
|
+
Delivered = "delivered",
|
|
42
|
+
Read = "read"
|
|
43
|
+
}
|
|
44
|
+
export declare type MessageState = {
|
|
45
|
+
chatId: string;
|
|
46
|
+
state: MessageStateValue;
|
|
47
|
+
timestamp: string;
|
|
48
|
+
userId: string;
|
|
49
|
+
username: string;
|
|
50
|
+
};
|
|
33
51
|
export declare type ChatMessage = {
|
|
34
52
|
id?: string;
|
|
35
53
|
chatId?: string;
|
|
36
|
-
content?:
|
|
54
|
+
content?: MessageContent;
|
|
37
55
|
senderId?: string;
|
|
38
56
|
username?: string;
|
|
39
57
|
createTime?: string;
|
|
40
58
|
updateTime?: string;
|
|
59
|
+
states: Map<string, MessageState>;
|
|
41
60
|
};
|
|
61
|
+
export declare type MessageStateListener = (state: MessageState) => void;
|
|
42
62
|
export declare type GetChatMessagesParams = {
|
|
43
63
|
chatId: string;
|
|
44
64
|
fromCache?: boolean;
|
|
@@ -55,6 +75,7 @@ export declare class ChatArena extends NakamaService {
|
|
|
55
75
|
private _chatList;
|
|
56
76
|
private _autoJoinChat;
|
|
57
77
|
private _chatMessagesCursor?;
|
|
78
|
+
private _messageStatesCache;
|
|
58
79
|
private readonly _delayBeforeProcessing;
|
|
59
80
|
private _notificationListenerRemover;
|
|
60
81
|
private _chatPresencesListener?;
|
|
@@ -62,6 +83,7 @@ export declare class ChatArena extends NakamaService {
|
|
|
62
83
|
private _chatInviteListener?;
|
|
63
84
|
private _chatJoinerListener?;
|
|
64
85
|
private _chatLeaverListener?;
|
|
86
|
+
private _messageStateListener?;
|
|
65
87
|
constructor(nakamaProvider: NakamaProvider, _notificationsService: NotificationsArena, _friendsService: FriendsArena);
|
|
66
88
|
setAutoJoinChat(isEnabled: boolean): void;
|
|
67
89
|
getJoinedChats(): ChatChannel[];
|
|
@@ -81,6 +103,11 @@ export declare class ChatArena extends NakamaService {
|
|
|
81
103
|
private onChannelPresenceChanged;
|
|
82
104
|
subscribeChatPresenceListener(listener: ChatPresencesListener): void;
|
|
83
105
|
removeChatPresenceListener(): void;
|
|
106
|
+
private getStatePriority;
|
|
107
|
+
private getHighestPriorityState;
|
|
108
|
+
private updateMessageStates;
|
|
109
|
+
private cacheMessageState;
|
|
110
|
+
private applyCachedStateUpdates;
|
|
84
111
|
private onChannelMessageChanged;
|
|
85
112
|
subscribeChatMessageListener(listener: ChatMessageListener): void;
|
|
86
113
|
removeChatMessageListener(): void;
|
|
@@ -91,6 +118,10 @@ export declare class ChatArena extends NakamaService {
|
|
|
91
118
|
removeChatJoinerListener(): void;
|
|
92
119
|
subscribeChatLeaverListener(listener: ChatLeaverListener): void;
|
|
93
120
|
removeChatLeaverListener(): void;
|
|
121
|
+
private sendMessageState;
|
|
122
|
+
markMessageAsDelivered(chatId: string): Promise<void>;
|
|
123
|
+
markMessageAsRead(chatId: string): Promise<void>;
|
|
124
|
+
subscribeMessageStateListener(listener: MessageStateListener): void;
|
|
125
|
+
removeMessageStateListener(): void;
|
|
94
126
|
protected onSocketConnectionChanged(isConnected: boolean): void;
|
|
95
127
|
}
|
|
96
|
-
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ApiEnv } from '../backend/backend.api';
|
|
2
|
+
import { IHost } from '../host';
|
|
3
|
+
import { Auth } from '../auth';
|
|
4
|
+
import { PersistenceArena } from '../persistence';
|
|
5
|
+
|
|
6
|
+
export declare type UserRating = {
|
|
7
|
+
vote: number;
|
|
8
|
+
gameId: string;
|
|
9
|
+
};
|
|
10
|
+
export declare type GameRating = {
|
|
11
|
+
upVotes: number;
|
|
12
|
+
downVotes: number;
|
|
13
|
+
totalVotes: number;
|
|
14
|
+
};
|
|
15
|
+
export declare class RatingsArena {
|
|
16
|
+
private host;
|
|
17
|
+
private auth;
|
|
18
|
+
private persistence;
|
|
19
|
+
private isInited;
|
|
20
|
+
private ratingsEndpoint;
|
|
21
|
+
private arenaDomain;
|
|
22
|
+
private _isSupported;
|
|
23
|
+
constructor(host: IHost, auth: Auth, persistence: PersistenceArena);
|
|
24
|
+
init(env: ApiEnv): Promise<void>;
|
|
25
|
+
isSupported(): Promise<boolean>;
|
|
26
|
+
upvoteGame(gameId?: string, captchaToken?: string, captchaMode?: string): Promise<void>;
|
|
27
|
+
downvoteGame(gameId?: string, captchaToken?: string, captchaMode?: string): Promise<void>;
|
|
28
|
+
removeGameVote(gameId?: string, captchaToken?: string, captchaMode?: string): Promise<void>;
|
|
29
|
+
private getUserInfo;
|
|
30
|
+
private postUserRating;
|
|
31
|
+
getUserRating(gameId?: string): Promise<UserRating>;
|
|
32
|
+
getGameRating(gameId?: string): Promise<GameRating>;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,6 +14,7 @@ import { LeaderboardArena } from './api/features/leaderboard';
|
|
|
14
14
|
import { FriendsArena } from './api/features/friends';
|
|
15
15
|
import { NotificationsArena } from './api/features/notifications';
|
|
16
16
|
import { ChatArena } from './api/features/chat';
|
|
17
|
+
import { RatingsArena } from './api/features/ratings';
|
|
17
18
|
|
|
18
19
|
import * as MockUserUtils from './api/utils/mockUser';
|
|
19
20
|
/** @hidden */
|
|
@@ -33,13 +34,14 @@ export declare class ArkadiumArenaSdk {
|
|
|
33
34
|
friends: FriendsArena;
|
|
34
35
|
notifications: NotificationsArena;
|
|
35
36
|
chats: ChatArena;
|
|
37
|
+
ratings: RatingsArena;
|
|
36
38
|
private currentEnv;
|
|
37
39
|
private currentTarget;
|
|
38
40
|
private gamePingSender;
|
|
39
41
|
private gamePingListener;
|
|
40
42
|
$pingNotification: Observable<number>;
|
|
41
43
|
version: string;
|
|
42
|
-
constructor(backendApi: Backend, host: HostArena, lifecycle: GameLifecycleArena, ads: AdsArena, auth: AuthArena, analytics: AnalyticsApiContract, timeoutTester: TimeoutTesterContract, persistence: PersistenceArena, wallet: WalletArena, debug: DebugProviderArena, supportV1: SupportV1, leaderboard: LeaderboardArena, friends: FriendsArena, notifications: NotificationsArena, chats: ChatArena);
|
|
44
|
+
constructor(backendApi: Backend, host: HostArena, lifecycle: GameLifecycleArena, ads: AdsArena, auth: AuthArena, analytics: AnalyticsApiContract, timeoutTester: TimeoutTesterContract, persistence: PersistenceArena, wallet: WalletArena, debug: DebugProviderArena, supportV1: SupportV1, leaderboard: LeaderboardArena, friends: FriendsArena, notifications: NotificationsArena, chats: ChatArena, ratings: RatingsArena);
|
|
43
45
|
setEnv(e: ApiEnv): void;
|
|
44
46
|
initialize(env: ApiEnv, isGameSide: boolean, sessionStorage?: SessionStorageType | null): Promise<void>;
|
|
45
47
|
private envDiscoverListener;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkadiuminc/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.45.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "dist/pkg/arkadium-sdk.umd.js",
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
"ajv-formats": "^3.0.1",
|
|
103
103
|
"jsonpack": "^1.1.5",
|
|
104
104
|
"nanoid": "^5.0.4",
|
|
105
|
+
"uuid": "^11.1.0",
|
|
105
106
|
"vite-plugin-string-replace": "^1.1.2"
|
|
106
107
|
},
|
|
107
108
|
"standard-version": {
|