@arkadiuminc/sdk 2.0.1 → 2.2.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 +25 -14
- package/dist/pkg/api/features/analytics/defs.d.ts +4 -3
- package/dist/pkg/api/features/analytics/dimensions.d.ts +3 -1
- package/dist/pkg/api/features/analytics/providers/AnalyticsProvider.d.ts +4 -2
- package/package.json +9 -2
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,6 +1,6 @@
|
|
|
1
1
|
import { RpcProvider } from '../../core/rpc';
|
|
2
|
-
import {
|
|
3
|
-
import { DimensionsObject } from './dimensions';
|
|
2
|
+
import { AnalyticsProviderType, IAnalyticConfig } from './defs';
|
|
3
|
+
import { DimensionsObject, Dimension } from './dimensions';
|
|
4
4
|
import { IHost } from '../host';
|
|
5
5
|
interface EnvironmentVersion {
|
|
6
6
|
GameKey: string;
|
|
@@ -8,6 +8,10 @@ interface EnvironmentVersion {
|
|
|
8
8
|
NestVersion: string;
|
|
9
9
|
SdkVersion: string;
|
|
10
10
|
}
|
|
11
|
+
declare type FingerprintData = {
|
|
12
|
+
[Dimension.fpVisitorId]: string;
|
|
13
|
+
[Dimension.fpIncognito]: string;
|
|
14
|
+
};
|
|
11
15
|
export interface AnalyticsApiContract {
|
|
12
16
|
setGameVersion(v: string): Promise<void>;
|
|
13
17
|
setNestVersion(v: string): Promise<void>;
|
|
@@ -21,8 +25,10 @@ export declare class AnalyticsApi implements AnalyticsApiContract {
|
|
|
21
25
|
private host;
|
|
22
26
|
private rpcProvider;
|
|
23
27
|
private providers;
|
|
24
|
-
private
|
|
28
|
+
private configuredProviders;
|
|
29
|
+
private disabledProviders;
|
|
25
30
|
private info;
|
|
31
|
+
providersTypes: typeof AnalyticsProviderType;
|
|
26
32
|
constructor(host: IHost, rpcProvider: RpcProvider);
|
|
27
33
|
getEnvVersion(): Promise<EnvironmentVersion>;
|
|
28
34
|
setGameVersion(v: string): Promise<void>;
|
|
@@ -31,14 +37,19 @@ export declare class AnalyticsApi implements AnalyticsApiContract {
|
|
|
31
37
|
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): Promise<void>;
|
|
32
38
|
sendPageView(pageName: string, dimensions: DimensionsObject): Promise<void>;
|
|
33
39
|
trackException(exception: Error): Promise<void>;
|
|
40
|
+
setFingerprintData(fingerprintData: FingerprintData): Promise<any>;
|
|
41
|
+
enableProvider(providerType: AnalyticsProviderType): void;
|
|
42
|
+
disableProvider(providerType: AnalyticsProviderType): void;
|
|
34
43
|
}
|
|
35
44
|
export declare class AnalyticsApiProxy implements AnalyticsApiContract {
|
|
36
45
|
private rpcProvider;
|
|
37
|
-
CONSOLE:
|
|
38
|
-
APP_INSIGHTS:
|
|
39
|
-
GOOGLE:
|
|
46
|
+
CONSOLE: AnalyticsProviderType;
|
|
47
|
+
APP_INSIGHTS: AnalyticsProviderType;
|
|
48
|
+
GOOGLE: AnalyticsProviderType;
|
|
40
49
|
private dimensionValues;
|
|
50
|
+
private fingerprintData;
|
|
41
51
|
constructor(rpcProvider: RpcProvider);
|
|
52
|
+
private setFingerprintData;
|
|
42
53
|
setGameVersion(v: string): Promise<void>;
|
|
43
54
|
setNestVersion(v: string): Promise<void>;
|
|
44
55
|
getEnvVersion(): Promise<EnvironmentVersion>;
|
|
@@ -47,7 +58,7 @@ export declare class AnalyticsApiProxy implements AnalyticsApiContract {
|
|
|
47
58
|
* Low level method to report an analytics event
|
|
48
59
|
* Likely you can use the helper methods for common events instead.
|
|
49
60
|
* @param eventCategory {Event}
|
|
50
|
-
* @param eventAction
|
|
61
|
+
* @param eventAction optional action. values depend on the event category
|
|
51
62
|
* @param dimensions record with dimensions to report
|
|
52
63
|
*/
|
|
53
64
|
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): Promise<void>;
|
|
@@ -104,7 +115,7 @@ export declare class AnalyticsApiProxy implements AnalyticsApiContract {
|
|
|
104
115
|
/**
|
|
105
116
|
* actions:
|
|
106
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)
|
|
107
|
-
* - 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)
|
|
108
119
|
*
|
|
109
120
|
* dimensions:
|
|
110
121
|
* - reason: No_Moves | Time_Out
|
|
@@ -113,12 +124,12 @@ export declare class AnalyticsApiProxy implements AnalyticsApiContract {
|
|
|
113
124
|
/**
|
|
114
125
|
* actions:
|
|
115
126
|
*
|
|
116
|
-
* Win - User ended game because he wins (
|
|
117
|
-
* Lose -User ended game because he loses or faces "No More Moves' situation (
|
|
118
|
-
* Time_Out - User ended game because he runs of time (
|
|
119
|
-
* New_Game - User ends game because he starts a new game: click on 'New Game', then click on 'Yes' (
|
|
120
|
-
* Quit - User ends game because he quits a new game: click on 'Quit', then click on 'Yes' (
|
|
121
|
-
* 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)
|
|
122
133
|
*/
|
|
123
134
|
sendGameEndEvent(action: 'Win' | 'Lose' | 'Time_Out' | 'New_Game' | 'Quit' | 'Restart', dimensions?: DimensionsObject): void;
|
|
124
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 {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkadiuminc/sdk",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "dist/pkg/arkadium-sdk.umd.js",
|
|
@@ -35,7 +35,9 @@
|
|
|
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 --follow-tags origin $(git branch)"
|
|
39
41
|
},
|
|
40
42
|
"lint-staged": {
|
|
41
43
|
"{src,test}/**/*.ts": [
|
|
@@ -78,6 +80,7 @@
|
|
|
78
80
|
"semantic-release": "^19.0.3",
|
|
79
81
|
"semantic-release-ado": "^1.4.0",
|
|
80
82
|
"shelljs": "^0.8.5",
|
|
83
|
+
"standard-version": "^9.5.0",
|
|
81
84
|
"ts-node": "^10.9.1",
|
|
82
85
|
"tslint": "^5.20.1",
|
|
83
86
|
"tslint-config-prettier": "^1.18.0",
|
|
@@ -93,5 +96,9 @@
|
|
|
93
96
|
"jsonpack": "^1.1.5",
|
|
94
97
|
"nanoid": "^5.0.4",
|
|
95
98
|
"vite-plugin-string-replace": "^1.1.2"
|
|
99
|
+
},
|
|
100
|
+
"standard-version": {
|
|
101
|
+
"commitUrlFormat": "https://arkadiumarena.visualstudio.com/Tech%20Services/_git/arkadium-sdk/commit/{{hash}}",
|
|
102
|
+
"compareUrlFormat": "https://arkadiumarena.visualstudio.com/Tech%20Services/_git/arkadium-sdk/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}&_a=files"
|
|
96
103
|
}
|
|
97
104
|
}
|