@arkadiuminc/sdk 0.0.2 → 0.0.4
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.
|
@@ -16,11 +16,26 @@ interface CookieStorageContract {
|
|
|
16
16
|
interface UrlParamsReaderContract {
|
|
17
17
|
GetParam(key: string): Promise<string | null>;
|
|
18
18
|
}
|
|
19
|
+
export interface GameIdReaderContract {
|
|
20
|
+
readGameId(): Promise<string>;
|
|
21
|
+
setGameId(id: string): any;
|
|
22
|
+
}
|
|
23
|
+
export declare class GameIdReader implements GameIdReaderContract {
|
|
24
|
+
private gameIdOverride;
|
|
25
|
+
constructor();
|
|
26
|
+
readGameId(): Promise<string>;
|
|
27
|
+
setGameId(id: string): void;
|
|
28
|
+
}
|
|
29
|
+
export declare class GameIdReaderProxy implements GameIdReaderContract {
|
|
30
|
+
readGameId(): Promise<string>;
|
|
31
|
+
setGameId(id: string): Promise<any>;
|
|
32
|
+
}
|
|
19
33
|
export declare class EnvironmentApi {
|
|
20
34
|
localStorage: LocalStorageContract;
|
|
21
35
|
cookieStorage: CookieStorageContract;
|
|
22
36
|
urlParamsReader: UrlParamsReaderContract;
|
|
23
|
-
|
|
37
|
+
gameIdReader: GameIdReaderContract;
|
|
38
|
+
constructor(localStorage: LocalStorageContract, cookieStorage: CookieStorageContract, urlParamsReader: UrlParamsReaderContract, gameIdReader: GameIdReaderContract);
|
|
24
39
|
static getArenaApi(): EnvironmentApi;
|
|
25
40
|
static getGameApi(): EnvironmentApi;
|
|
26
41
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GameIdReaderContract } from '../environment/environment.api';
|
|
2
2
|
import { BackendApi } from '../backend/backend.api';
|
|
3
3
|
export interface GameStateContract {
|
|
4
4
|
loadGameState(key: string): Promise<any>;
|
|
5
5
|
saveGameState(key: string, state: any): Promise<void>;
|
|
6
6
|
}
|
|
7
7
|
export declare class GameStateApi {
|
|
8
|
-
ls
|
|
9
|
-
backendApi
|
|
10
|
-
|
|
8
|
+
private ls;
|
|
9
|
+
private backendApi;
|
|
10
|
+
private gameIdReader;
|
|
11
|
+
constructor(backendApi: BackendApi, gameIdReader: GameIdReaderContract);
|
|
12
|
+
private getGameId;
|
|
11
13
|
private packData;
|
|
12
14
|
private unpackData;
|
|
13
15
|
private isUserAuthorized;
|
|
14
|
-
loadGameState(key: string): Promise<any>;
|
|
16
|
+
loadGameState(key: string): Promise<Record<any, any> | null>;
|
|
17
|
+
private getStorageKey;
|
|
15
18
|
private loadData;
|
|
16
|
-
saveGameState(key: string, state: any): Promise<void>;
|
|
19
|
+
saveGameState(key: string, state: Record<any, any>): Promise<void>;
|
|
20
|
+
private saveData;
|
|
17
21
|
}
|
|
18
22
|
export declare class GameStateApiProxy {
|
|
19
23
|
loadGameState(): Promise<any>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const
|
|
2
|
-
var
|
|
3
|
-
let
|
|
1
|
+
const c = "https://arkadiumsdk.z19.web.core.windows.net/sdk.js";
|
|
2
|
+
var i = /* @__PURE__ */ ((e) => (e.DEV = "DEV", e.PROD = "PROD", e))(i || {});
|
|
3
|
+
let r, t;
|
|
4
4
|
function a(e) {
|
|
5
|
-
return t ? Promise.resolve(t) : (
|
|
6
|
-
const
|
|
7
|
-
|
|
5
|
+
return t ? Promise.resolve(t) : (r || (r = new Promise((s) => {
|
|
6
|
+
const n = document.createElement("script");
|
|
7
|
+
n.src = c, n.onload = () => {
|
|
8
8
|
globalThis.__GameApi__.getInstance(e).then((o) => {
|
|
9
9
|
t = o, s(t);
|
|
10
10
|
});
|
|
11
|
-
};
|
|
12
|
-
})),
|
|
11
|
+
}, (document.head || document.body).appendChild(n);
|
|
12
|
+
})), r);
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
i as Env,
|
|
16
16
|
a as getInstance
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e.ArkadiumSdk={}))})(this,function(e){"use strict";const n="https://arkadiumsdk.z19.web.core.windows.net/sdk.js";var d=(t=>(t.DEV="DEV",t.PROD="PROD",t))(d||{});let o,i;function r(t){return i?Promise.resolve(i):(o||(o=new Promise(c=>{const s=document.createElement("script");s.src=n,s.onload=()=>{globalThis.__GameApi__.getInstance(t).then(u=>{i=u,c(i)})},(document.head||document.body).appendChild(s)})),o)}e.Env=d,e.getInstance=r,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|