@arkadiuminc/sdk 2.1.0 → 2.3.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.
- package/README.md +0 -18
- package/dist/pkg/api/features/analytics/analytics.api.d.ts +17 -13
- package/dist/pkg/api/features/analytics/defs.d.ts +4 -3
- package/dist/pkg/api/features/analytics/providers/AnalyticsProvider.d.ts +4 -2
- package/dist/pkg/api/features/backend/backend.api.d.ts +3 -2
- package/dist/pkg/arkadium-game-sdk.d.ts +2 -0
- package/dist/pkg/arkadium-sdk.mjs +11 -7
- package/dist/pkg/arkadium-sdk.umd.js +1 -1
- package/dist/pkg/loader.d.ts +2 -1
- package/package.json +14 -5
package/README.md
CHANGED
|
@@ -29,24 +29,6 @@ async function main() {
|
|
|
29
29
|
main();
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
## using the sandbox with a local game sdk
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
cd arkadium-sdk
|
|
36
|
-
http-server . -p 8080 -c-1 --cors
|
|
37
|
-
npm run build-fast
|
|
38
|
-
|
|
39
|
-
cd arkadium-dev-portal
|
|
40
|
-
# in the sandbox.tsx file, change SDK_PATH to 'http://localhost:8080/dist/arena/arena-sdk.umd.js'
|
|
41
|
-
npm run start
|
|
42
|
-
# visit the dev portal sandbox page: http://localhost:3511/sandbox
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
set the following fields:
|
|
46
|
-
- gameId: arkadium-sdk-test-game
|
|
47
|
-
- gameURL: http://localhost:8080/example/simple/analytics.html
|
|
48
|
-
|
|
49
|
-
|
|
50
32
|
## Reference documents
|
|
51
33
|
|
|
52
34
|
- Analytics
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RpcProvider } from '../../core/rpc';
|
|
2
|
-
import {
|
|
2
|
+
import { AnalyticsProviderType, IAnalyticConfig } from './defs';
|
|
3
3
|
import { DimensionsObject, Dimension } from './dimensions';
|
|
4
4
|
import { IHost } from '../host';
|
|
5
5
|
interface EnvironmentVersion {
|
|
@@ -25,8 +25,10 @@ export declare class AnalyticsApi implements AnalyticsApiContract {
|
|
|
25
25
|
private host;
|
|
26
26
|
private rpcProvider;
|
|
27
27
|
private providers;
|
|
28
|
-
private
|
|
28
|
+
private configuredProviders;
|
|
29
|
+
private disabledProviders;
|
|
29
30
|
private info;
|
|
31
|
+
providersTypes: typeof AnalyticsProviderType;
|
|
30
32
|
constructor(host: IHost, rpcProvider: RpcProvider);
|
|
31
33
|
getEnvVersion(): Promise<EnvironmentVersion>;
|
|
32
34
|
setGameVersion(v: string): Promise<void>;
|
|
@@ -36,12 +38,14 @@ export declare class AnalyticsApi implements AnalyticsApiContract {
|
|
|
36
38
|
sendPageView(pageName: string, dimensions: DimensionsObject): Promise<void>;
|
|
37
39
|
trackException(exception: Error): Promise<void>;
|
|
38
40
|
setFingerprintData(fingerprintData: FingerprintData): Promise<any>;
|
|
41
|
+
enableProvider(providerType: AnalyticsProviderType): void;
|
|
42
|
+
disableProvider(providerType: AnalyticsProviderType): void;
|
|
39
43
|
}
|
|
40
44
|
export declare class AnalyticsApiProxy implements AnalyticsApiContract {
|
|
41
45
|
private rpcProvider;
|
|
42
|
-
CONSOLE:
|
|
43
|
-
APP_INSIGHTS:
|
|
44
|
-
GOOGLE:
|
|
46
|
+
CONSOLE: AnalyticsProviderType;
|
|
47
|
+
APP_INSIGHTS: AnalyticsProviderType;
|
|
48
|
+
GOOGLE: AnalyticsProviderType;
|
|
45
49
|
private dimensionValues;
|
|
46
50
|
private fingerprintData;
|
|
47
51
|
constructor(rpcProvider: RpcProvider);
|
|
@@ -54,7 +58,7 @@ export declare class AnalyticsApiProxy implements AnalyticsApiContract {
|
|
|
54
58
|
* Low level method to report an analytics event
|
|
55
59
|
* Likely you can use the helper methods for common events instead.
|
|
56
60
|
* @param eventCategory {Event}
|
|
57
|
-
* @param eventAction
|
|
61
|
+
* @param eventAction optional action. values depend on the event category
|
|
58
62
|
* @param dimensions record with dimensions to report
|
|
59
63
|
*/
|
|
60
64
|
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): Promise<void>;
|
|
@@ -111,7 +115,7 @@ export declare class AnalyticsApiProxy implements AnalyticsApiContract {
|
|
|
111
115
|
/**
|
|
112
116
|
* actions:
|
|
113
117
|
* - Finished - User successfully finished the Round (Level). First round is Round 1 (not 0) (applicable for games with evergreen logic, not infinite games - before Nest changes to gameplay)
|
|
114
|
-
* - Not_Finished - User didn't finish the Round (Level) successfully OR leaves the game OR skips the round OR Quit (applicable for games with evergreen logic, not infinite games - before Nest changes to gameplay
|
|
118
|
+
* - Not_Finished - User didn't finish the Round (Level) successfully OR leaves the game OR skips the round OR Quit (applicable for games with evergreen logic, not infinite games - before Nest changes to gameplay. If possible several lose scenarios, add reason dimension)
|
|
115
119
|
*
|
|
116
120
|
* dimensions:
|
|
117
121
|
* - reason: No_Moves | Time_Out
|
|
@@ -120,12 +124,12 @@ export declare class AnalyticsApiProxy implements AnalyticsApiContract {
|
|
|
120
124
|
/**
|
|
121
125
|
* actions:
|
|
122
126
|
*
|
|
123
|
-
* Win - User ended game because he wins (
|
|
124
|
-
* Lose -User ended game because he loses or faces "No More Moves' situation (
|
|
125
|
-
* Time_Out - User ended game because he runs of time (
|
|
126
|
-
* New_Game - User ends game because he starts a new game: click on 'New Game', then click on 'Yes' (
|
|
127
|
-
* Quit - User ends game because he quits a new game: click on 'Quit', then click on 'Yes' (
|
|
128
|
-
* Restart - User starts the same game from the beginning again (mostly for Solitaire games): click on 'Restart', then click on 'Yes' (
|
|
127
|
+
* Win - User ended game because he wins (Round in Label only if game has it) (applicable for games with evergreen logic, not infinite games - before Nest changes to gameplay)
|
|
128
|
+
* Lose -User ended game because he loses or faces "No More Moves' situation (Round in Label only if game has it) (applicable for games with evergreen logic, not infinite games - before Nest changes to gameplay)
|
|
129
|
+
* Time_Out - User ended game because he runs of time (Round in Label only if game has it) (applicable for games with evergreen logic, not infinite games - before Nest changes to gameplay)
|
|
130
|
+
* New_Game - User ends game because he starts a new game: click on 'New Game', then click on 'Yes' (Round in Label only if game has it) (applicable for games with evergreen logic, not infinite games - before Nest changes to gameplay)
|
|
131
|
+
* Quit - User ends game because he quits a new game: click on 'Quit', then click on 'Yes' (Round in Label only if game has it) (applicable for games with evergreen logic, not infinite games - before Nest changes to gameplay)
|
|
132
|
+
* Restart - User starts the same game from the beginning again (mostly for Solitaire games): click on 'Restart', then click on 'Yes' (Round in Label only if game has it) (applicable for games with evergreen logic, not infinite games - before Nest changes to gameplay)
|
|
129
133
|
*/
|
|
130
134
|
sendGameEndEvent(action: 'Win' | 'Lose' | 'Time_Out' | 'New_Game' | 'Quit' | 'Restart', dimensions?: DimensionsObject): void;
|
|
131
135
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export declare enum
|
|
1
|
+
export declare enum AnalyticsProviderType {
|
|
2
2
|
CONSOLE = 1,
|
|
3
3
|
GOOGLE = 2,
|
|
4
|
-
APP_INSIGHTS = 3
|
|
4
|
+
APP_INSIGHTS = 3,
|
|
5
|
+
ALL = 1000
|
|
5
6
|
}
|
|
6
7
|
export interface IAnalyticConfig {
|
|
7
8
|
appId: string;
|
|
8
|
-
provider:
|
|
9
|
+
provider: AnalyticsProviderType;
|
|
9
10
|
providerConfig?: any;
|
|
10
11
|
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { DimensionsObject } from "../dimensions";
|
|
2
|
+
import { IAnalyticConfig } from '../defs';
|
|
2
3
|
declare type EventArr = [string, string, DimensionsObject];
|
|
3
4
|
declare type PageViewArr = [string, DimensionsObject];
|
|
4
5
|
export declare abstract class AnalyticsProvider {
|
|
5
|
-
protected config:
|
|
6
|
+
protected config: IAnalyticConfig;
|
|
6
7
|
protected isReady: boolean;
|
|
7
8
|
protected unsentEvents: EventArr[];
|
|
8
9
|
protected unsentPageViews: PageViewArr[];
|
|
9
10
|
protected unsentExceptions: Error[];
|
|
10
|
-
constructor(config:
|
|
11
|
+
constructor(config: IAnalyticConfig);
|
|
11
12
|
protected setup(): Promise<void>;
|
|
12
13
|
protected handleUnsent(): void;
|
|
13
14
|
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): void;
|
|
14
15
|
sendPageView(pageName: string, dimensions: DimensionsObject): void;
|
|
15
16
|
trackException(exception: Error): void;
|
|
17
|
+
getProviderType(): import("../defs").AnalyticsProviderType;
|
|
16
18
|
}
|
|
17
19
|
export {};
|
|
@@ -2,7 +2,8 @@ import { ApiGateway as UserApiGateway } from '@arkadium/eagle-user-client';
|
|
|
2
2
|
import { UserGameDataApi } from '@arkadium/eagle-user-client/dist/types/api/v1/user-game-data.api';
|
|
3
3
|
export declare enum ApiEnv {
|
|
4
4
|
DEV = "DEV",
|
|
5
|
-
PROD = "PROD"
|
|
5
|
+
PROD = "PROD",
|
|
6
|
+
STAGING = "STAGING"
|
|
6
7
|
}
|
|
7
8
|
export declare enum PaymentsApiEnv {
|
|
8
9
|
DEV = "https://arenacloud.cdn.arkadiumhosted.com/eagle-payment-api-dev/",
|
|
@@ -16,7 +17,7 @@ export declare class Backend {
|
|
|
16
17
|
uiOpenRequest: import("../../utils/observable").Observable<boolean>;
|
|
17
18
|
authStatus: import("../../utils/observable").Observable<boolean>;
|
|
18
19
|
addEventListener(event: number, cb: () => void): void;
|
|
19
|
-
init(
|
|
20
|
+
init(env: ApiEnv, isGameSide: boolean, sessionStorage?: SessionStorageType | null): Promise<void>;
|
|
20
21
|
getSessionStorage(): import("@arkadium/eagle-user-client/dist/types/session-storage").SessionStorage | undefined;
|
|
21
22
|
checkAuth(): void;
|
|
22
23
|
isUserAuthorized(): boolean;
|
|
@@ -18,10 +18,12 @@ export declare class ArkadiumGameSdk {
|
|
|
18
18
|
private timeoutTester;
|
|
19
19
|
persistence: PersistenceGame;
|
|
20
20
|
version: string;
|
|
21
|
+
private currentEnv;
|
|
21
22
|
private arenaPingSender;
|
|
22
23
|
private arenaPingListener;
|
|
23
24
|
constructor(rpcProvider: RpcProvider, backendApi: Backend, host: HostGame, lifecycle: GameLifecycleContract, ads: GameAdsContract, auth: Auth, analytics: AnalyticsApiContract, timeoutTester: TimeoutTesterContract, persistence: PersistenceGame);
|
|
24
25
|
initialize(env: ApiEnv, isGameSide: boolean, sessionStorage?: SessionStorageType | null): Promise<void>;
|
|
26
|
+
getEnv(): ApiEnv;
|
|
25
27
|
updateWinReference(target: any): void;
|
|
26
28
|
debugMode(enabled: boolean): void;
|
|
27
29
|
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
const
|
|
2
|
-
var
|
|
1
|
+
const r = "https://developers.arkadium.com/cdn/sdk/v2/sdk.js", i = "https://developers.arkadium.com/cdn/sdk/dev/v2/sdk.js";
|
|
2
|
+
var a = /* @__PURE__ */ ((e) => (e.DEV = "DEV", e.PROD = "PROD", e.STAGING = "STAGING", e))(a || {});
|
|
3
3
|
let n, t;
|
|
4
4
|
function m(e) {
|
|
5
5
|
return t ? Promise.resolve(t) : (n || (n = new Promise((o) => {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const c = [
|
|
7
|
+
"STAGING",
|
|
8
|
+
"PROD"
|
|
9
|
+
/* PROD */
|
|
10
|
+
].includes(e) ? r : i, s = document.createElement("script");
|
|
11
|
+
s.src = c, s.onload = () => {
|
|
12
|
+
globalThis.__GameApi__.getInstance(e).then((d) => {
|
|
13
|
+
t = d, o(t);
|
|
10
14
|
});
|
|
11
15
|
}, (document.head || document.body).appendChild(s);
|
|
12
16
|
})), n);
|
|
13
17
|
}
|
|
14
18
|
export {
|
|
15
|
-
|
|
19
|
+
a as Env,
|
|
16
20
|
m as getInstance
|
|
17
21
|
};
|
|
@@ -1 +1 @@
|
|
|
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://developers.arkadium.com/cdn/sdk/v2/sdk.js",c="https://developers.arkadium.com/cdn/sdk/dev/v2/sdk.js";var i=(t=>(t.DEV="DEV",t.PROD="PROD",t))(i||{});let d,s;function r(t){return s?Promise.resolve(s):(d||(d=new Promise(u=>{const
|
|
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://developers.arkadium.com/cdn/sdk/v2/sdk.js",c="https://developers.arkadium.com/cdn/sdk/dev/v2/sdk.js";var i=(t=>(t.DEV="DEV",t.PROD="PROD",t.STAGING="STAGING",t))(i||{});let d,s;function r(t){return s?Promise.resolve(s):(d||(d=new Promise(u=>{const a=["STAGING","PROD"].includes(t)?n:c,o=document.createElement("script");o.src=a,o.onload=()=>{globalThis.__GameApi__.getInstance(t).then(l=>{s=l,u(s)})},(document.head||document.body).appendChild(o)})),d)}e.Env=i,e.getInstance=r,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
package/dist/pkg/loader.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { ArkadiumGameSdk } from './arkadium-game-sdk';
|
|
|
2
2
|
declare type API = ArkadiumGameSdk;
|
|
3
3
|
export declare enum Env {
|
|
4
4
|
DEV = "DEV",
|
|
5
|
-
PROD = "PROD"
|
|
5
|
+
PROD = "PROD",
|
|
6
|
+
STAGING = "STAGING"
|
|
6
7
|
}
|
|
7
8
|
export declare function getInstance(env: Env): Promise<API>;
|
|
8
9
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkadiuminc/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "dist/pkg/arkadium-sdk.umd.js",
|
|
@@ -35,7 +35,10 @@
|
|
|
35
35
|
"commit": "git-cz",
|
|
36
36
|
"semantic-release": "semantic-release",
|
|
37
37
|
"semantic-release-prepare": "ts-node tools/semantic-release-prepare",
|
|
38
|
-
"precommit": "lint-staged"
|
|
38
|
+
"precommit": "lint-staged",
|
|
39
|
+
"release": "standard-version --skip.tag",
|
|
40
|
+
"ci-release": "standard-version && git push origin && git push origin $(git tag --sort=creatordate | tail -n 1)",
|
|
41
|
+
"prepare": "husky"
|
|
39
42
|
},
|
|
40
43
|
"lint-staged": {
|
|
41
44
|
"{src,test}/**/*.ts": [
|
|
@@ -59,8 +62,8 @@
|
|
|
59
62
|
"devDependencies": {
|
|
60
63
|
"@arkadium/eagle-payments-api-client": "^0.0.35",
|
|
61
64
|
"@arkadium/eagle-user-client": "^0.0.90",
|
|
62
|
-
"@commitlint/cli": "^17.
|
|
63
|
-
"@commitlint/config-conventional": "^17.
|
|
65
|
+
"@commitlint/cli": "^17.8.1",
|
|
66
|
+
"@commitlint/config-conventional": "^17.8.1",
|
|
64
67
|
"@types/jest": "^28.1.6",
|
|
65
68
|
"@types/node": "^18.0.6",
|
|
66
69
|
"colors": "^1.4.0",
|
|
@@ -68,7 +71,7 @@
|
|
|
68
71
|
"cross-env": "^7.0.3",
|
|
69
72
|
"cz-conventional-changelog": "^3.3.0",
|
|
70
73
|
"happy-dom": "^14.0.0",
|
|
71
|
-
"husky": "^
|
|
74
|
+
"husky": "^9.0.11",
|
|
72
75
|
"lint-staged": "^13.0.3",
|
|
73
76
|
"lodash.camelcase": "^4.3.0",
|
|
74
77
|
"prettier": "^2.7.1",
|
|
@@ -78,6 +81,7 @@
|
|
|
78
81
|
"semantic-release": "^19.0.3",
|
|
79
82
|
"semantic-release-ado": "^1.4.0",
|
|
80
83
|
"shelljs": "^0.8.5",
|
|
84
|
+
"standard-version": "^9.5.0",
|
|
81
85
|
"ts-node": "^10.9.1",
|
|
82
86
|
"tslint": "^5.20.1",
|
|
83
87
|
"tslint-config-prettier": "^1.18.0",
|
|
@@ -93,5 +97,10 @@
|
|
|
93
97
|
"jsonpack": "^1.1.5",
|
|
94
98
|
"nanoid": "^5.0.4",
|
|
95
99
|
"vite-plugin-string-replace": "^1.1.2"
|
|
100
|
+
},
|
|
101
|
+
"standard-version": {
|
|
102
|
+
"commitUrlFormat": "https://arkadiumarena.visualstudio.com/Tech%20Services/_git/arkadium-sdk/commit/{{hash}}",
|
|
103
|
+
"compareUrlFormat": "https://arkadiumarena.visualstudio.com/Tech%20Services/_git/arkadium-sdk/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}&_a=files",
|
|
104
|
+
"releaseCommitMessageFormat": "chore(release): {{currentTag}} [skip ci]"
|
|
96
105
|
}
|
|
97
106
|
}
|