@arkadiuminc/sdk 0.0.38 → 0.0.40
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 +9 -0
- package/dist/pkg/api/features/ads/index.d.ts +6 -2
- package/dist/pkg/api/features/ads/index.test.d.ts +0 -4
- package/dist/pkg/api/features/ads/video-ad.d.ts +9 -3
- package/dist/pkg/api/features/analytics/analytics.api.d.ts +169 -5
- package/dist/pkg/api/features/analytics/analytics.api.test.d.ts +1 -0
- package/dist/pkg/api/features/analytics/defs.d.ts +10 -0
- package/dist/pkg/api/features/analytics/dimensions.d.ts +74 -0
- package/dist/pkg/api/features/analytics/events.d.ts +33 -0
- package/dist/pkg/api/features/analytics/providers/AnalyticsProvider.d.ts +17 -0
- package/dist/pkg/api/features/analytics/providers/AppInsightsProvider.d.ts +26 -0
- package/dist/pkg/api/features/analytics/providers/AppInsightsProvider.test.d.ts +1 -0
- package/dist/pkg/api/features/analytics/providers/ConsoleProvider.d.ts +11 -0
- package/dist/pkg/api/features/analytics/providers/ConsoleProvider.test.d.ts +1 -0
- package/dist/pkg/api/features/analytics/providers/GoogleTagManagerProvider.d.ts +20 -0
- package/dist/pkg/api/features/analytics/providers/GoogleTagManagerProvider.test.d.ts +1 -0
- package/dist/pkg/arkadium-game-sdk.d.ts +2 -0
- package/package.json +5 -3
- package/dist/pkg/game/index.html +0 -0
- package/dist/pkg/index.html +0 -14
package/README.md
CHANGED
|
@@ -29,3 +29,12 @@ async function main() {
|
|
|
29
29
|
main();
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
|
|
33
|
+
## Reference documents
|
|
34
|
+
|
|
35
|
+
- Analytics
|
|
36
|
+
- [App Insights](TODO)
|
|
37
|
+
- [Google Tag manager](TODO)
|
|
38
|
+
- [Standardized Spec for every game](https://arkadium.atlassian.net/wiki/spaces/DepartmentBusinessOperations/pages/23675756/Standardized+Spec+for+every+game+-+GA+AppInsights)
|
|
39
|
+
- [AppInsight stamper](https://arkadium.atlassian.net/wiki/spaces/PhoenixGames/pages/23993424/AppInsight+stamper)
|
|
40
|
+
- [Adaptive Sampling Implementation](https://arkadium.atlassian.net/wiki/spaces/PhoenixGames/pages/23897949/Adaptive+Sampling+Implementation)
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { RpcProvider } from '../../core/rpc';
|
|
2
2
|
declare type InterstitialAdContract = {
|
|
3
|
-
show(
|
|
3
|
+
show(options: {
|
|
4
|
+
duration?: number;
|
|
5
|
+
}): Promise<void>;
|
|
4
6
|
};
|
|
5
7
|
declare type RewardAdContract = {
|
|
6
|
-
show(
|
|
8
|
+
show(options: {
|
|
9
|
+
duration?: number;
|
|
10
|
+
}): Promise<{
|
|
7
11
|
value: number;
|
|
8
12
|
}>;
|
|
9
13
|
};
|
|
@@ -2,7 +2,13 @@ export declare class VideoAd {
|
|
|
2
2
|
static getInstance(): VideoAd;
|
|
3
3
|
protected _scriptLoaded: Promise<void>;
|
|
4
4
|
constructor();
|
|
5
|
-
interstitial(
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
interstitial({ duration }: {
|
|
6
|
+
duration?: number | undefined;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
rewarded({ duration }: {
|
|
9
|
+
duration?: number | undefined;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
protected triggerRender({ duration }: {
|
|
12
|
+
duration: any;
|
|
13
|
+
}): Promise<void>;
|
|
8
14
|
}
|
|
@@ -1,30 +1,194 @@
|
|
|
1
1
|
import { RpcProvider } from '../../core/rpc';
|
|
2
2
|
import { GameIdReaderContract } from '../environment/environment.api';
|
|
3
|
+
import { AnalyticProviderEnum, IAnalyticConfig } from './defs';
|
|
4
|
+
import { DimensionsObject } from './dimensions';
|
|
3
5
|
interface EnvironmentVersion {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
gameKey: string;
|
|
7
|
+
gameVersion: string;
|
|
8
|
+
nestVersion: string;
|
|
9
|
+
sdkVersion: string;
|
|
8
10
|
}
|
|
9
11
|
export interface AnalyticsApiContract {
|
|
10
12
|
setGameVersion(v: string): Promise<void>;
|
|
11
13
|
setNestVersion(v: string): Promise<void>;
|
|
12
14
|
getEnvVersion(): Promise<EnvironmentVersion>;
|
|
15
|
+
configureProvider(config: IAnalyticConfig): Promise<void>;
|
|
16
|
+
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): Promise<void>;
|
|
17
|
+
sendPageView(pageName: string, dimensions: DimensionsObject): Promise<void>;
|
|
18
|
+
trackException(exception: Error): Promise<void>;
|
|
13
19
|
}
|
|
14
20
|
export declare class AnalyticsApi implements AnalyticsApiContract {
|
|
15
21
|
private gameReader;
|
|
16
22
|
private rpcProvider;
|
|
23
|
+
private providers;
|
|
24
|
+
private activeProvidersTypes;
|
|
25
|
+
private info;
|
|
17
26
|
constructor(gameReader: GameIdReaderContract, rpcProvider: RpcProvider);
|
|
18
27
|
getEnvVersion(): Promise<EnvironmentVersion>;
|
|
19
|
-
private info;
|
|
20
28
|
setGameVersion(v: string): Promise<void>;
|
|
21
29
|
setNestVersion(v: string): Promise<void>;
|
|
30
|
+
configureProvider(config: IAnalyticConfig): Promise<void>;
|
|
31
|
+
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): Promise<void>;
|
|
32
|
+
sendPageView(pageName: string, dimensions: DimensionsObject): Promise<void>;
|
|
33
|
+
trackException(exception: Error): Promise<void>;
|
|
22
34
|
}
|
|
23
35
|
export declare class AnalyticsApiProxy implements AnalyticsApiContract {
|
|
24
36
|
private rpcProvider;
|
|
37
|
+
CONSOLE: AnalyticProviderEnum;
|
|
38
|
+
APP_INSIGHTS: AnalyticProviderEnum;
|
|
39
|
+
GOOGLE: AnalyticProviderEnum;
|
|
40
|
+
private dimensionValues;
|
|
25
41
|
constructor(rpcProvider: RpcProvider);
|
|
26
42
|
setGameVersion(v: string): Promise<void>;
|
|
27
43
|
setNestVersion(v: string): Promise<void>;
|
|
28
44
|
getEnvVersion(): Promise<EnvironmentVersion>;
|
|
45
|
+
configureProvider(config: IAnalyticConfig): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Low level method to report an analytics event
|
|
48
|
+
* Likely you can use the helper methods for common events instead.
|
|
49
|
+
* @param eventCategory {Event}
|
|
50
|
+
* @param eventAction {string} optional action. values depend on the event category
|
|
51
|
+
* @param dimensions record with dimensions to report
|
|
52
|
+
*/
|
|
53
|
+
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Low level method to report a page view
|
|
56
|
+
* Likely you can use the helper methods for common page views instead.
|
|
57
|
+
* @param pageName the page name to report
|
|
58
|
+
* @param dimensions record with dimensions to report
|
|
59
|
+
*/
|
|
60
|
+
sendPageView(pageName: string, dimensions: DimensionsObject): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Use this method to report an exception back to analytics
|
|
63
|
+
* @param exception {Error} error to capture
|
|
64
|
+
*/
|
|
65
|
+
trackException(exception: Error): Promise<void>;
|
|
66
|
+
setDimensions(dimensions: DimensionsObject): void;
|
|
67
|
+
/**
|
|
68
|
+
* Start of the Game (after preroll ends)
|
|
69
|
+
*/
|
|
70
|
+
sendAppStartedEvent(dimensions?: DimensionsObject): void;
|
|
71
|
+
/**
|
|
72
|
+
* Loading ended, user can see Start button (after preroll ends)
|
|
73
|
+
*/
|
|
74
|
+
sendMainScreenReadyEvent(dimensions?: DimensionsObject): void;
|
|
75
|
+
/**
|
|
76
|
+
* actions:
|
|
77
|
+
* User clicked on Start Button [action 'Loaded' if user continued previous game, otherwise New]
|
|
78
|
+
*/
|
|
79
|
+
sendStartButtonClickedEvent(action: 'New' | 'Loaded', dimensions?: DimensionsObject): void;
|
|
80
|
+
/**
|
|
81
|
+
* User sees gameplay and are ready to make action
|
|
82
|
+
*/
|
|
83
|
+
sendGameplayReadyEvent(dimensions?: DimensionsObject): void;
|
|
84
|
+
/**
|
|
85
|
+
* User made first move (any click on the page)
|
|
86
|
+
*/
|
|
87
|
+
sendFirstMoveEvent(dimensions?: DimensionsObject): void;
|
|
88
|
+
/**
|
|
89
|
+
* User entered the first right answer (for word games or trivia games and other applicable games)
|
|
90
|
+
*/
|
|
91
|
+
sendFirstRightAnswerEvent(dimensions?: DimensionsObject): void;
|
|
92
|
+
/**
|
|
93
|
+
* User made first match (for match-3, mahjongg and other applicable games)
|
|
94
|
+
*/
|
|
95
|
+
sendFirsMatchEvent(dimensions?: DimensionsObject): void;
|
|
96
|
+
/**
|
|
97
|
+
* User made first shot (for shooters and other applicable games)
|
|
98
|
+
*/
|
|
99
|
+
sendFirsShotEvent(dimensions?: DimensionsObject): void;
|
|
100
|
+
/**
|
|
101
|
+
* Users started new Round (Level). First round is Round 1 (not 0) (applicable for games with evergreen logic, not infinite games - before Nest changes to gameplay)
|
|
102
|
+
*/
|
|
103
|
+
sendRoundEvent(dimensions?: DimensionsObject): void;
|
|
104
|
+
/**
|
|
105
|
+
* actions:
|
|
106
|
+
* - 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) {if possible several lose scenarios, add reason dimension}
|
|
108
|
+
*
|
|
109
|
+
* dimensions:
|
|
110
|
+
* - reason: No_Moves | Time_Out
|
|
111
|
+
*/
|
|
112
|
+
sendRoundEndEvent(action: 'Finished' | 'Not_Finished', dimensions?: DimensionsObject): void;
|
|
113
|
+
/**
|
|
114
|
+
* actions:
|
|
115
|
+
*
|
|
116
|
+
* 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)
|
|
117
|
+
* 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)
|
|
118
|
+
* 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)
|
|
119
|
+
* 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)
|
|
120
|
+
* 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)
|
|
121
|
+
* 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
|
+
*/
|
|
123
|
+
sendGameEndEvent(action: 'Win' | 'Lose' | 'Time_Out' | 'New_Game' | 'Quit' | 'Restart', dimensions?: DimensionsObject): void;
|
|
124
|
+
/**
|
|
125
|
+
* User clicked on Reshuffle (for mahjonggs and other applicable games)
|
|
126
|
+
*/
|
|
127
|
+
sendReshuffleEvent(dimensions?: DimensionsObject): void;
|
|
128
|
+
/**
|
|
129
|
+
* User meet any type of errors
|
|
130
|
+
*
|
|
131
|
+
* expected dimensions:
|
|
132
|
+
* - reason
|
|
133
|
+
*/
|
|
134
|
+
sendErrorEvent(dimensions?: DimensionsObject): void;
|
|
135
|
+
/**
|
|
136
|
+
* Users comes back from menu and sees the same game session [in games with limited gameplay time only]
|
|
137
|
+
*/
|
|
138
|
+
sendGameScreenActionsEvent(dimensions?: DimensionsObject): void;
|
|
139
|
+
/**
|
|
140
|
+
* User turned sound on/off [for games where sound is a bar, and can be customized (e.g. 1/3 of max) - before Nest]
|
|
141
|
+
* User turned music on/off [for games where music is a bar, and can be customized to specific position (e.g. 1/3 of max)- before Nest]
|
|
142
|
+
*/
|
|
143
|
+
sendMenuActionsEvent(action: 'Sound_On' | 'Sound_Off' | 'Music_On' | 'Music_Off', dimensions?: DimensionsObject): void;
|
|
144
|
+
/**
|
|
145
|
+
* User turned sound on/off [for games where only on/off option is available - after Nest]
|
|
146
|
+
*/
|
|
147
|
+
sendSettingsEvent(dimensions?: DimensionsObject): void;
|
|
148
|
+
/**
|
|
149
|
+
* Clicks on Help button on Game_Screen or in the menu
|
|
150
|
+
*/
|
|
151
|
+
sendHelpEvent(dimensions?: DimensionsObject): void;
|
|
152
|
+
/**
|
|
153
|
+
* User saw the help pop up [if it appeared once per gameplay]
|
|
154
|
+
*/
|
|
155
|
+
sendHelpShownEvent(dimensions?: DimensionsObject): void;
|
|
156
|
+
/**
|
|
157
|
+
* User clicks on different button in help menu [if it appeared once per gameplay]
|
|
158
|
+
*/
|
|
159
|
+
sendHelpPageEvent(action: 'Next' | 'Prev', dimensions?: DimensionsObject): void;
|
|
160
|
+
/**
|
|
161
|
+
* Impression of FUE - tutorial [aplicable for multiple stages tutorial which appear in different places]
|
|
162
|
+
*/
|
|
163
|
+
sendFUEEvent(dimensions?: DimensionsObject): void;
|
|
164
|
+
/**
|
|
165
|
+
* User saw a sign in pop up (before Nest, sent by game. Should be missed if Nest implemented.)
|
|
166
|
+
* User logged in successfully (before Nest, sent by game. Should be missed if Nest implemented.)
|
|
167
|
+
*/
|
|
168
|
+
sendSignInPopUpEvent(action: 'Proposed' | 'Success', dimensions?: DimensionsObject): void;
|
|
169
|
+
/**
|
|
170
|
+
* User saw a sign in pop up (after Nest, sent by Nest. Should be missed if Nest not implemented.)
|
|
171
|
+
*/
|
|
172
|
+
sendSignInClickedEvent(dimensions?: DimensionsObject): void;
|
|
173
|
+
/**
|
|
174
|
+
* User logged in successfully (returns with eagle id) (after Nest, sent by Nest. Should be missed if Nest not implemented.)
|
|
175
|
+
*/
|
|
176
|
+
sendSignInSucceededEvent(dimensions?: DimensionsObject): void;
|
|
177
|
+
/**
|
|
178
|
+
* 1st page = page with start button
|
|
179
|
+
*/
|
|
180
|
+
sendIntroScreenPageView(dimensions?: DimensionsObject): void;
|
|
181
|
+
/**
|
|
182
|
+
* Next page after user clicks on Start
|
|
183
|
+
*/
|
|
184
|
+
sendGameScreenPageView(dimensions?: DimensionsObject): void;
|
|
185
|
+
/**
|
|
186
|
+
* Game over page == every game end, except Quit
|
|
187
|
+
*/
|
|
188
|
+
sendGameOverPageView(dimensions?: DimensionsObject): void;
|
|
189
|
+
/**
|
|
190
|
+
* When player manually quits the game
|
|
191
|
+
*/
|
|
192
|
+
sendQuitConfirmedPageView(dimensions?: DimensionsObject): void;
|
|
29
193
|
}
|
|
30
194
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference page:
|
|
3
|
+
* https://arkadium.atlassian.net/wiki/spaces/DepartmentBusinessOperations/pages/23675756/Standardized+Spec+for+every+game+-+GA+AppInsights
|
|
4
|
+
*/
|
|
5
|
+
export declare type DimensionsObject = Partial<Record<Dimension, string | number>>;
|
|
6
|
+
export declare enum Dimension {
|
|
7
|
+
action = "action",
|
|
8
|
+
/**
|
|
9
|
+
* If game has infinite process, use Level dimensions
|
|
10
|
+
*/
|
|
11
|
+
round = "round",
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
score = "score",
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
reason = "reason",
|
|
20
|
+
/**
|
|
21
|
+
* Domain, can be affected by iframe
|
|
22
|
+
*/
|
|
23
|
+
domain = "domain",
|
|
24
|
+
/**
|
|
25
|
+
* getArenaName()
|
|
26
|
+
*/
|
|
27
|
+
trafficSource = "trafficSource",
|
|
28
|
+
/**
|
|
29
|
+
* in seconds
|
|
30
|
+
* where 0 is Level Start|Round Start - should show at that moment from start each event happened
|
|
31
|
+
*/
|
|
32
|
+
timespent = "timespent",
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
gameVersion = "gameVersion",
|
|
37
|
+
/**
|
|
38
|
+
* If applicable, when test is running
|
|
39
|
+
*/
|
|
40
|
+
abtestVersion = "abtestVersion",
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
deviceType = "deviceType",
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
frameRate = "frameRate",
|
|
49
|
+
/**
|
|
50
|
+
* If applicable
|
|
51
|
+
*/
|
|
52
|
+
difficulty = "difficulty",
|
|
53
|
+
/**
|
|
54
|
+
* New - is first session
|
|
55
|
+
* Returning - otherwise
|
|
56
|
+
*/
|
|
57
|
+
userType = "userType",
|
|
58
|
+
/**
|
|
59
|
+
* Should be sent with every event if possible. if user comes already logged in for ex. if user logs in in the game - start sending after login.
|
|
60
|
+
*/
|
|
61
|
+
userID = "userID",
|
|
62
|
+
/**
|
|
63
|
+
* Should be sent with every event if possible. if user comes already logged in for ex. if user logs in in the game - start sending after login.
|
|
64
|
+
*/
|
|
65
|
+
userSubscriptionId = "userSubscriptionId",
|
|
66
|
+
/**
|
|
67
|
+
* Should be sent with every event if possible. if user comes already logged in for ex. if user logs in in the game - start sending after login.
|
|
68
|
+
*/
|
|
69
|
+
userSubscriptionPlan = "userSubscriptionPlan",
|
|
70
|
+
CD1 = "CD1",
|
|
71
|
+
CD2 = "CD2",
|
|
72
|
+
CD3 = "CD3",
|
|
73
|
+
CD4 = "CD4"
|
|
74
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference page:
|
|
3
|
+
* https://arkadium.atlassian.net/wiki/spaces/DepartmentBusinessOperations/pages/23675756/Standardized+Spec+for+every+game+-+GA+AppInsights
|
|
4
|
+
*/
|
|
5
|
+
export declare enum Event {
|
|
6
|
+
App_Started = "App_Started",
|
|
7
|
+
MainScreen_Ready = "MainScreen_Ready",
|
|
8
|
+
Start_Button_Clicked = "Start_Button_Clicked",
|
|
9
|
+
Gameplay_Ready = "Gameplay_Ready",
|
|
10
|
+
First_Move = "First_Move",
|
|
11
|
+
First_Right_Answer = "First_Right_Answer",
|
|
12
|
+
First_Match = "First_Match",
|
|
13
|
+
First_Shot = "First_Shot",
|
|
14
|
+
Round = "Round",
|
|
15
|
+
Round_End = "Round_End",
|
|
16
|
+
Game_End = "Game_End",
|
|
17
|
+
Reshuffle = "Reshuffle",
|
|
18
|
+
Error = "Error",
|
|
19
|
+
Game_Screen_Actions = "Game_Screen_Actions",
|
|
20
|
+
Menu_Actions = "Menu_Actions",
|
|
21
|
+
Settings = "Settings",
|
|
22
|
+
Help = "Help",
|
|
23
|
+
Help_Shown = "Help_Shown",
|
|
24
|
+
Help_Page = "Help_Page",
|
|
25
|
+
FUE = "FUE",
|
|
26
|
+
SignInPopUp = "SignInPopUp",
|
|
27
|
+
Sign_In_Clicked = "Sign_In_Clicked",
|
|
28
|
+
Sign_In_Successed = "Sign_In_Successed",
|
|
29
|
+
Reward = "Reward",
|
|
30
|
+
Boost = "Boost",
|
|
31
|
+
subscriptionBonus = "subscriptionBonus",
|
|
32
|
+
Gem_Purchase = "Gem_Purchase"
|
|
33
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DimensionsObject } from "../dimensions";
|
|
2
|
+
declare type EventArr = [string, string, DimensionsObject];
|
|
3
|
+
declare type PageViewArr = [string, DimensionsObject];
|
|
4
|
+
export declare abstract class AnalyticsProvider {
|
|
5
|
+
protected config: any;
|
|
6
|
+
protected isReady: boolean;
|
|
7
|
+
protected unsentEvents: EventArr[];
|
|
8
|
+
protected unsentPageViews: PageViewArr[];
|
|
9
|
+
protected unsentExceptions: Error[];
|
|
10
|
+
constructor(config: any);
|
|
11
|
+
protected setup(): Promise<void>;
|
|
12
|
+
protected handleUnsent(): void;
|
|
13
|
+
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): void;
|
|
14
|
+
sendPageView(pageName: string, dimensions: DimensionsObject): void;
|
|
15
|
+
trackException(exception: Error): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DimensionsObject } from "../dimensions";
|
|
2
|
+
import { AnalyticsProvider } from "./AnalyticsProvider";
|
|
3
|
+
/**
|
|
4
|
+
* based on game-core-monorepo/packages/engine/src/Analytics/Provider/AppInsightsAnalytic.ts
|
|
5
|
+
* https://github.com/microsoft/ApplicationInsights-JS
|
|
6
|
+
*/
|
|
7
|
+
export interface IAppInsightConfig {
|
|
8
|
+
configUrl?: string;
|
|
9
|
+
defaultSamplingPercentage?: number;
|
|
10
|
+
selectedDomainsSamplingPercentage?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ICloudAppInsightConfig {
|
|
13
|
+
description: string;
|
|
14
|
+
instrumentationKey: string;
|
|
15
|
+
defaultSamplingPercentage: number;
|
|
16
|
+
selectedDomains: string[];
|
|
17
|
+
selectedDomainsSamplingPercentage: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class AppInsightsProvider extends AnalyticsProvider {
|
|
20
|
+
private _aiTracker;
|
|
21
|
+
protected setup(): Promise<void>;
|
|
22
|
+
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): void;
|
|
23
|
+
sendPageView(pageName: string, dimensions: DimensionsObject): void;
|
|
24
|
+
trackException(exception: Error): void;
|
|
25
|
+
private getDefaultConfig;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DimensionsObject } from "../dimensions";
|
|
2
|
+
import { AnalyticsProvider } from "./AnalyticsProvider";
|
|
3
|
+
/**
|
|
4
|
+
* based on game-core-monorepo/packages/engine/src/Analytics/Provider/ConsoleAnalytic.ts
|
|
5
|
+
*/
|
|
6
|
+
export declare class ConsoleProvider extends AnalyticsProvider {
|
|
7
|
+
protected setup(): Promise<void>;
|
|
8
|
+
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): void;
|
|
9
|
+
sendPageView(pageName: string, dimensions: DimensionsObject): void;
|
|
10
|
+
trackException(exception: Error): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DimensionsObject, Dimension } from "../dimensions";
|
|
2
|
+
import { AnalyticsProvider } from "./AnalyticsProvider";
|
|
3
|
+
/**
|
|
4
|
+
* based on game-core-monorepo/packages/engine/src/Analytics/Provider/GoogleAnalytic.ts
|
|
5
|
+
*/
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
dataLayer?: any[];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare class GoogleTagManagerProvider extends AnalyticsProvider {
|
|
12
|
+
protected setup(): Promise<void>;
|
|
13
|
+
sendEvent(eventCategory: string, eventAction: string, dimensions: DimensionsObject): void;
|
|
14
|
+
mapDimensions(_dimensions: DimensionsObject): Partial<Record<Dimension, string | number>>;
|
|
15
|
+
computeLabel(eventCategory: string, eventAction: string, dimensions: DimensionsObject): string;
|
|
16
|
+
sendPageView(pageName: string, dimensions: DimensionsObject): void;
|
|
17
|
+
trackException(exception: Error): void;
|
|
18
|
+
private getDataLayer;
|
|
19
|
+
private gtag;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -23,6 +23,8 @@ export declare class ArkadiumGameSdk {
|
|
|
23
23
|
debugMode(enabled: boolean): void;
|
|
24
24
|
}
|
|
25
25
|
export { ApiEnv };
|
|
26
|
+
export { Dimension } from './api/features/analytics/dimensions';
|
|
27
|
+
export { Event } from './api/features/analytics/events';
|
|
26
28
|
export declare class GameApi {
|
|
27
29
|
version: string;
|
|
28
30
|
private static sdk;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkadiuminc/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "dist/pkg/arkadium-sdk.umd.js",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"build:game": "vite build --config vite.game.config.js",
|
|
28
28
|
"build:arena": "vite build --config vite.arena.config.js",
|
|
29
29
|
"build:docs": "typedoc --out docs --theme default src/arkadium-game-sdk.ts",
|
|
30
|
+
"build-fast": "npm run build:game && npm run build:arena",
|
|
30
31
|
"build": "npm run build:pkg && npm run build:game && npm run build:arena && npm run build:docs",
|
|
31
32
|
"start": "rollup -c rollup.config.ts -w",
|
|
32
33
|
"test": "jest --coverage",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"transform": {
|
|
55
56
|
".(ts|tsx)": "ts-jest"
|
|
56
57
|
},
|
|
57
|
-
"testEnvironment": "
|
|
58
|
+
"testEnvironment": "jsdom",
|
|
58
59
|
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
|
59
60
|
"moduleFileExtensions": [
|
|
60
61
|
"ts",
|
|
@@ -128,6 +129,7 @@
|
|
|
128
129
|
},
|
|
129
130
|
"dependencies": {
|
|
130
131
|
"jsonpack": "^1.1.5",
|
|
131
|
-
"nanoid": "^5.0.4"
|
|
132
|
+
"nanoid": "^5.0.4",
|
|
133
|
+
"@microsoft/applicationinsights-web": "^3.0.4"
|
|
132
134
|
}
|
|
133
135
|
}
|
package/dist/pkg/game/index.html
DELETED
|
File without changes
|
package/dist/pkg/index.html
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<title></title>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
-
<link href="css/style.css" rel="stylesheet">
|
|
8
|
-
|
|
9
|
-
<script src=""
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|