@jolibox/types 1.1.25 → 1.1.27
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TrackEvent = 'jsSdkBegin' | 'onBeforeExit' | 'bootstrapModuleBeginToLoad' | 'bootstrapModuleLoaded' | 'implModuleBeginToLoad' | 'implModuleLoaded' | 'onDocumentReady' | 'joliboxServiceReady' | 'apiInvoked' | 'joliboxSpeedAnalysis' | 'joliboxNetRequestResult' | 'globalJsError' | 'CallRuntimeLoadFinished' | 'AdBreakJumpOut' | 'AdBreakHide' | 'CallAdsInit' | 'LoadAdsenseCompleted' | 'CallAdConfig' | 'PreventAdsCheating' | 'CallShowAdFn' | 'CallAdBreak' | 'CallAdUnit' | 'CallAdBreakDone' | 'CallBeforeAd' | 'CallAfterAd' | 'CallAdBreakTimeout' | 'CallAFVRequest' | 'CallAFVLoad' | 'CallAFVPlaying' | 'CallAFVCompleted' | 'CallAFVError' | 'AdSenseUnitStatusChanged' | 'OpenGame' | 'PlayGame' | 'CloseGame' | 'LevelFinished' | '
|
|
1
|
+
export type TrackEvent = 'jsSdkBegin' | 'onBeforeExit' | 'bootstrapModuleBeginToLoad' | 'bootstrapModuleLoaded' | 'implModuleBeginToLoad' | 'implModuleLoaded' | 'onDocumentReady' | 'joliboxServiceReady' | 'apiInvoked' | 'joliboxSpeedAnalysis' | 'joliboxNetRequestResult' | 'globalJsError' | 'CallRuntimeLoadFinished' | 'AdBreakJumpOut' | 'AdBreakHide' | 'CallAdsInit' | 'LoadAdsenseCompleted' | 'CallAdConfig' | 'PreventAdsCheating' | 'CallShowAdFn' | 'CallAdBreak' | 'CallAdUnit' | 'CallAdBreakDone' | 'CallBeforeAd' | 'CallAfterAd' | 'CallAdBreakTimeout' | 'CallAFVRequest' | 'CallAFVLoad' | 'CallAFVPlaying' | 'CallAFVCompleted' | 'CallAFVError' | 'AdSenseUnitStatusChanged' | 'OpenGame' | 'PlayGame' | 'CloseGame' | 'LevelFinished' | 'LevelUpgrade' | 'GamePlayEnded' | 'GameFCP' | 'GameLCP' | 'GameTTFB';
|
|
2
2
|
export type PerformanceType = 'bootstrapModuleLoaded' | 'implementModuleLoaded' | 'joliboxGameServiceReady';
|
|
3
3
|
export declare const REPORT_SYSTEM_TIMELINE = "ReportSDK.traceSystemTimeline";
|
|
4
4
|
export declare const REPORT_SYSTEM_LOG = "ReportSDK.traceSystem";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export type StorageAPICode = 'NOT_FOUND' | 'PARAMETER_ERROR' | 'UNAUTHORIZED';
|
|
2
2
|
export type CommonAPICode = 'SUCCESS' | 'FAILURE';
|
|
3
3
|
export type ResponseType = StorageAPICode | CommonAPICode;
|
|
4
|
-
export interface StandardResponse<R> {
|
|
4
|
+
export interface StandardResponse<R, E = unknown> {
|
|
5
5
|
code: ResponseType;
|
|
6
6
|
message: string;
|
|
7
7
|
data?: R;
|
|
8
|
+
extra?: E;
|
|
8
9
|
}
|
|
@@ -1,37 +1,23 @@
|
|
|
1
1
|
import { StandardResponse } from './response';
|
|
2
2
|
export declare const LEVEL_FINISHED = "TaskTrackerSDK.levelFinished";
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const TASK_EVENT = "TaskTrackerSDK.taskEvent";
|
|
3
|
+
export declare const GAME_PLAY_ENDED = "TaskTrackerSDK.gamePlayEnded";
|
|
5
4
|
export declare const LEVEL_UPGRADE = "TaskTrackerSDK.levelUpgrade";
|
|
6
|
-
export declare const HISTORY_USER_SCORE = "TaskTrackerSDK.historyUserScore";
|
|
7
|
-
export declare const HISTORY_USER_LEVEL = "TaskTrackerSDK.historyUserLevel";
|
|
8
5
|
export type TaskResponse = Promise<StandardResponse<void>>;
|
|
9
6
|
export interface TaskTrackCommandParams {
|
|
10
|
-
[LEVEL_FINISHED]: (
|
|
11
|
-
|
|
12
|
-
duration
|
|
7
|
+
[LEVEL_FINISHED]: (params: {
|
|
8
|
+
levelId: string | number;
|
|
9
|
+
duration?: number;
|
|
10
|
+
rating?: number;
|
|
11
|
+
score?: number;
|
|
13
12
|
}) => TaskResponse;
|
|
14
|
-
[
|
|
15
|
-
duration
|
|
13
|
+
[GAME_PLAY_ENDED]: (params: {
|
|
14
|
+
duration?: number;
|
|
15
|
+
rating?: number;
|
|
16
|
+
score: number;
|
|
16
17
|
}) => TaskResponse;
|
|
17
|
-
[
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
name: string;
|
|
21
|
-
count?: number;
|
|
22
|
-
description?: string;
|
|
23
|
-
price?: {
|
|
24
|
-
amount: number;
|
|
25
|
-
unit: string;
|
|
26
|
-
};
|
|
27
|
-
}[];
|
|
28
|
-
awards?: {
|
|
29
|
-
id: string | number;
|
|
30
|
-
name: string;
|
|
31
|
-
}[];
|
|
18
|
+
[LEVEL_UPGRADE]: (params: {
|
|
19
|
+
levelId: string | number;
|
|
20
|
+
name?: string;
|
|
32
21
|
}) => TaskResponse;
|
|
33
|
-
[LEVEL_UPGRADE]: (levelId: string | number, name: string) => TaskResponse;
|
|
34
|
-
[HISTORY_USER_LEVEL]: (level: number) => TaskResponse;
|
|
35
|
-
[HISTORY_USER_SCORE]: (score: number) => TaskResponse;
|
|
36
22
|
}
|
|
37
23
|
export type TaskTrackCommandType = keyof TaskTrackCommandParams;
|
|
@@ -1,24 +1,48 @@
|
|
|
1
1
|
import { TaskResponse } from '../commands/task-track';
|
|
2
2
|
export interface TaskTracker {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Handles completion of a game level by sending analytics data to the backend
|
|
5
|
+
*
|
|
6
|
+
* @param params - Object containing level completion details:
|
|
7
|
+
* @param params.levelId - Unique identifier for the completed level (string or number)
|
|
8
|
+
* @param params.duration - Optional time spent in the level (milliseconds)
|
|
9
|
+
* @param params.rating - Optional user rating for the level
|
|
10
|
+
* @param params.score - Optional final score achieved in the level
|
|
11
|
+
* @returns Promise resolving to TaskResponse or error message if validation fails
|
|
12
|
+
* @throws {Promise} Rejects with error if params is not an object
|
|
13
|
+
*/
|
|
14
|
+
onLevelFinished(params: {
|
|
15
|
+
levelId: string | number;
|
|
16
|
+
duration?: number;
|
|
17
|
+
rating?: number;
|
|
18
|
+
score?: number;
|
|
19
|
+
}): Promise<TaskResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Records completion of a gameplay session with final metrics
|
|
22
|
+
*
|
|
23
|
+
* @param params - Object containing gameplay session details:
|
|
24
|
+
* @param params.duration - Optional total time spent in gameplay (milliseconds)
|
|
25
|
+
* @param params.rating - Optional user rating for the gameplay session
|
|
26
|
+
* @param params.score - Mandatory final score achieved during gameplay
|
|
27
|
+
* @returns Promise resolving to TaskResponse or error message if validation fails
|
|
28
|
+
* @throws {Promise} Rejects with error if params is not an object
|
|
29
|
+
*/
|
|
30
|
+
onGamePlayEnded(params: {
|
|
31
|
+
duration?: number;
|
|
32
|
+
rating?: number;
|
|
33
|
+
score: number;
|
|
34
|
+
}): Promise<TaskResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Tracks player progression when they upgrade to a new level
|
|
37
|
+
*
|
|
38
|
+
* @param params - Object containing level upgrade details:
|
|
39
|
+
* @param params.levelId - Unique identifier for the new level (string or number)
|
|
40
|
+
* @param params.name - Optional display name for the upgraded level
|
|
41
|
+
* @returns Promise resolving to TaskResponse or error message if validation fails
|
|
42
|
+
* @throws {Promise} Rejects with error if params is not an object
|
|
43
|
+
*/
|
|
44
|
+
onLevelUpgrade(params: {
|
|
45
|
+
levelId: string | number;
|
|
46
|
+
name?: string;
|
|
20
47
|
}): Promise<TaskResponse>;
|
|
21
|
-
onLevelUpgrade(levelId: string | number, name: string): Promise<TaskResponse>;
|
|
22
|
-
onHistoryUserLevel(level: number): Promise<TaskResponse>;
|
|
23
|
-
onHistoryUserScore(score: number): Promise<TaskResponse>;
|
|
24
48
|
}
|