@arkadiuminc/sdk 0.0.4 → 0.0.6
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/pkg/api/features/backend/backend.api.d.ts +7 -0
- package/dist/pkg/api/features/game-state/game-state.api.d.ts +21 -5
- package/dist/pkg/api/features/user-state/user-state.api.d.ts +29 -0
- package/dist/pkg/arkadium-arena-sdk.d.ts +3 -1
- package/dist/pkg/arkadium-game-sdk.d.ts +3 -1
- package/package.json +4 -1
|
@@ -12,6 +12,13 @@ export declare class BackendApi {
|
|
|
12
12
|
virtualItemApiGateway: Awaited<ReturnType<typeof VirtualItemApiGateway.prototype.getApi>> | null;
|
|
13
13
|
private userGateway;
|
|
14
14
|
userGameData: UserGameDataApi | null;
|
|
15
|
+
uiOpenRequest: {
|
|
16
|
+
observers: import("../../utils/observable").ObserverFn<boolean>[];
|
|
17
|
+
value: boolean;
|
|
18
|
+
subscribe: (observer: import("../../utils/observable").ObserverFn<boolean>) => void;
|
|
19
|
+
update(newValue: boolean): void;
|
|
20
|
+
};
|
|
15
21
|
init(e: ApiEnv, isGameSide: boolean): Promise<void>;
|
|
16
22
|
isUserAuthorized(): boolean;
|
|
23
|
+
openAuthForm(): void;
|
|
17
24
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { GameIdReaderContract } from '../environment/environment.api';
|
|
2
2
|
import { BackendApi } from '../backend/backend.api';
|
|
3
|
+
declare class SaveDataContract<T> {
|
|
4
|
+
__cloudMeta__: {
|
|
5
|
+
__version: number;
|
|
6
|
+
};
|
|
7
|
+
data: T | null;
|
|
8
|
+
clone<T>(p: Partial<SaveDataContract<T>>): SaveDataContract<T>;
|
|
9
|
+
}
|
|
3
10
|
export interface GameStateContract {
|
|
4
11
|
loadGameState(key: string): Promise<any>;
|
|
5
12
|
saveGameState(key: string, state: any): Promise<void>;
|
|
@@ -8,18 +15,27 @@ export declare class GameStateApi {
|
|
|
8
15
|
private ls;
|
|
9
16
|
private backendApi;
|
|
10
17
|
private gameIdReader;
|
|
18
|
+
private knownStates;
|
|
11
19
|
constructor(backendApi: BackendApi, gameIdReader: GameIdReaderContract);
|
|
12
20
|
private getGameId;
|
|
13
21
|
private packData;
|
|
14
22
|
private unpackData;
|
|
15
23
|
private isUserAuthorized;
|
|
16
|
-
loadGameState(key: string): Promise<Record<any, any> | null>;
|
|
17
24
|
private getStorageKey;
|
|
25
|
+
loadGameState<T>(key: string): Promise<{
|
|
26
|
+
cloud: SaveDataContract<T>;
|
|
27
|
+
local: SaveDataContract<T>;
|
|
28
|
+
}>;
|
|
18
29
|
private loadData;
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
private isStateOutdated;
|
|
31
|
+
saveGameState<T>(key: string, state: SaveDataContract<T>): Promise<void>;
|
|
32
|
+
private saveDataToStorage;
|
|
21
33
|
}
|
|
22
34
|
export declare class GameStateApiProxy {
|
|
23
|
-
loadGameState(): Promise<
|
|
24
|
-
|
|
35
|
+
loadGameState<T>(key: string): Promise<{
|
|
36
|
+
cloud: SaveDataContract<T>;
|
|
37
|
+
local: SaveDataContract<T>;
|
|
38
|
+
}>;
|
|
39
|
+
saveGameState<T>(key: string, state: SaveDataContract<T>): Promise<void>;
|
|
25
40
|
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BackendApi } from '../backend/backend.api';
|
|
2
|
+
import { createStore } from '../../utils/observable';
|
|
3
|
+
interface Image {
|
|
4
|
+
png: string;
|
|
5
|
+
webp: string;
|
|
6
|
+
}
|
|
7
|
+
interface UserProfile {
|
|
8
|
+
uid: string;
|
|
9
|
+
username: string;
|
|
10
|
+
avatar: Image;
|
|
11
|
+
avatarFrame: Image;
|
|
12
|
+
avatarBackground: string;
|
|
13
|
+
}
|
|
14
|
+
interface UserProfileReaderContract {
|
|
15
|
+
isUserAuthorized(): Promise<boolean>;
|
|
16
|
+
getUserProfile(): Promise<UserProfile | null>;
|
|
17
|
+
}
|
|
18
|
+
interface AuthUIManagerContract {
|
|
19
|
+
openAuthRequest: ReturnType<typeof createStore<boolean>>;
|
|
20
|
+
openAuthForm(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare class UserStateApi {
|
|
23
|
+
userProfileReader: UserProfileReaderContract;
|
|
24
|
+
authUIManager: AuthUIManagerContract;
|
|
25
|
+
constructor(userProfileReader: UserProfileReaderContract, authUIManager: AuthUIManagerContract);
|
|
26
|
+
static getArenaApi(backendApi: BackendApi): UserStateApi;
|
|
27
|
+
static getGameApi(backendApi: BackendApi): UserStateApi;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -3,13 +3,15 @@ import { GameStateContract } from './api/features/game-state/game-state.api';
|
|
|
3
3
|
import { GameLifecycleContract } from './api/features/game-lifecycle/game-lifecycle.api';
|
|
4
4
|
import { EnvironmentApi } from './api/features/environment/environment.api';
|
|
5
5
|
import { AdsApi } from './api/features/ads/';
|
|
6
|
+
import { UserStateApi } from './api/features/user-state/user-state.api';
|
|
6
7
|
export declare class ArkadiumGameSdk {
|
|
7
8
|
backendApi: BackendApi;
|
|
8
9
|
environment: EnvironmentApi;
|
|
9
10
|
gameState: GameStateContract;
|
|
10
11
|
lifecycle: GameLifecycleContract;
|
|
11
12
|
ads: AdsApi;
|
|
12
|
-
|
|
13
|
+
userStateApi: UserStateApi;
|
|
14
|
+
constructor(backendApi: BackendApi, environment: EnvironmentApi, gameState: GameStateContract, lifecycle: GameLifecycleContract, ads: AdsApi, userStateApi: UserStateApi);
|
|
13
15
|
initialize(env: ApiEnv, isGameSide: boolean): Promise<void>;
|
|
14
16
|
updateWinReference(target: any): void;
|
|
15
17
|
}
|
|
@@ -3,13 +3,15 @@ import { GameStateContract } from './api/features/game-state/game-state.api';
|
|
|
3
3
|
import { GameLifecycleContract } from './api/features/game-lifecycle/game-lifecycle.api';
|
|
4
4
|
import { EnvironmentApi } from './api/features/environment/environment.api';
|
|
5
5
|
import { AdsApi } from './api/features/ads/';
|
|
6
|
+
import { UserStateApi } from './api/features/user-state/user-state.api';
|
|
6
7
|
export declare class ArkadiumGameSdk {
|
|
7
8
|
backendApi: BackendApi;
|
|
8
9
|
environment: EnvironmentApi;
|
|
9
10
|
gameState: GameStateContract;
|
|
10
11
|
lifecycle: GameLifecycleContract;
|
|
11
12
|
ads: AdsApi;
|
|
12
|
-
|
|
13
|
+
userStateApi: UserStateApi;
|
|
14
|
+
constructor(backendApi: BackendApi, environment: EnvironmentApi, gameState: GameStateContract, lifecycle: GameLifecycleContract, ads: AdsApi, userStateApi: UserStateApi);
|
|
13
15
|
initialize(env: ApiEnv, isGameSide: boolean): Promise<void>;
|
|
14
16
|
updateWinReference(target: any): void;
|
|
15
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkadiuminc/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "dist/pkg/arkadium-sdk.umd.js",
|
|
@@ -125,5 +125,8 @@
|
|
|
125
125
|
"typescript": "~4.7.4",
|
|
126
126
|
"vite": "^4.4.11",
|
|
127
127
|
"vite-plugin-dts": "^3.6.3"
|
|
128
|
+
},
|
|
129
|
+
"dependencies": {
|
|
130
|
+
"jsonpack": "^1.1.5"
|
|
128
131
|
}
|
|
129
132
|
}
|