@jolibox/types 1.1.4-beta.1 → 1.1.4-beta.10

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.
@@ -5,7 +5,9 @@ import { RumtimeCommandParams } from './runtime';
5
5
  import { LifeCycleCommandParams } from './lifecycle';
6
6
  import { HttpCommandParams } from './http';
7
7
  import { StorageCommandParams } from './storage';
8
+ import { TaskTrackCommandParams } from './task-track';
8
9
  import { KeyboardCommandParams } from './native/keyboard';
10
+ import { LoginCommandParams } from './native/login';
9
11
  export * from './runtime';
10
12
  export * from './report';
11
13
  export * from './api';
@@ -14,6 +16,8 @@ export * from './response';
14
16
  export * from './lifecycle';
15
17
  export * from './http';
16
18
  export * from './storage';
19
+ export * from './task-track';
17
20
  export * from './native/keyboard';
18
- export type CommandParamsMap = RumtimeCommandParams & ReportCommandParams & APICommandParams & AdsCommandParams & LifeCycleCommandParams & HttpCommandParams & StorageCommandParams & KeyboardCommandParams;
21
+ export * from './native/login';
22
+ export type CommandParamsMap = RumtimeCommandParams & ReportCommandParams & APICommandParams & AdsCommandParams & LifeCycleCommandParams & HttpCommandParams & StorageCommandParams & KeyboardCommandParams & TaskTrackCommandParams & LoginCommandParams;
19
23
  export type CommandType = keyof CommandParamsMap;
@@ -1,12 +1,12 @@
1
1
  import { Env } from '../env';
2
- export declare const LIFECYCLE_EXITGAME = "LifecycleSDK.exitGame";
2
+ export declare const LIFECYCLE_EXITGAME = "LifecycleSDK.exit";
3
3
  export declare const LIFECYCLE_ONREADYEVENT = "LifecycleSDK.onReady";
4
- export declare const LIFECYCLE_ONGAMESHOW_EVENT = "LifecycleSDK.onGameShow";
5
- export declare const LIFECYCLE_ONGAMEHIDE_EVENT = "LifecycleSDK.onGameHide";
4
+ export declare const LIFECYCLE_ONGSHOW_EVENT = "LifecycleSDK.onJoliboxShow";
5
+ export declare const LIFECYCLE_ONGHIDE_EVENT = "LifecycleSDK.onJoliboxHide";
6
6
  export interface LifeCycleCommandParams {
7
7
  [LIFECYCLE_EXITGAME]: (onBeforeExit: () => void) => void;
8
8
  [LIFECYCLE_ONREADYEVENT]: (onReady: (info?: Env['hostUserInfo']) => void) => void;
9
- [LIFECYCLE_ONGAMESHOW_EVENT]: (onShow: () => void) => void;
10
- [LIFECYCLE_ONGAMEHIDE_EVENT]: (onHide: () => void) => void;
9
+ [LIFECYCLE_ONGSHOW_EVENT]: (onShow: () => void) => void;
10
+ [LIFECYCLE_ONGHIDE_EVENT]: (onHide: () => void) => void;
11
11
  }
12
12
  export type LifeCycleCommandType = keyof LifeCycleCommandParams;
@@ -9,7 +9,9 @@ export interface KeyboardCommandParams {
9
9
  /** 是否是多行 */
10
10
  multiple?: boolean;
11
11
  }) => void;
12
- [UPDATE_KEYBOARD]: (value: string) => void;
12
+ [UPDATE_KEYBOARD]: (params: {
13
+ value: string;
14
+ }) => void;
13
15
  [HIDE_KEYBOARD]: () => void;
14
16
  }
15
17
  export type KeyboardCommandType = keyof KeyboardCommandParams;
@@ -0,0 +1,13 @@
1
+ import { StandardResponse } from '../response';
2
+ export declare const LOGIN = "API.login";
3
+ export declare const CHECK_SESSION = "API.checkSession";
4
+ export interface LoginCommandParams {
5
+ [LOGIN]: () => Promise<StandardResponse<{
6
+ isLogin: boolean;
7
+ token?: string;
8
+ }>>;
9
+ [CHECK_SESSION]: () => Promise<StandardResponse<{
10
+ isLogin: boolean;
11
+ }>>;
12
+ }
13
+ export type LoginParamsType = keyof LoginCommandParams;
@@ -1,4 +1,4 @@
1
- export type TrackEvent = 'js_sdk_begin' | 'bootstrap_module_begin_to_load' | 'bootstrap_module_loaded' | 'impl_module_begin_to_load' | 'impl_module_loaded' | 'onDocumentReady' | 'jolibox_game_service_ready' | 'api_begin_to_invoke' | 'api_invoked' | 'jolibox_speed_analysis' | 'jolibox_net_request_result' | 'global_js_error' | 'CallRuntimeLoadFinished' | 'AdBreakJumpOut' | 'AdBreakHide' | 'CallAdsInit' | 'LoadAdsenseCompleted' | 'CallAdConfig' | 'PreventAdsCheating' | 'CallShowAdFn' | 'CallAdBreak' | 'CallAdUnit' | 'CallAdBreakDone' | 'AdSenseUnitStatusChanged';
1
+ export type TrackEvent = 'jsSdkBegin' | 'onBeforeExit' | 'bootstrapModuleBeginToLoad' | 'bootstrapModuleLoaded' | 'implModuleBeginToLoad' | 'implModuleLoaded' | 'onDocumentReady' | 'joliboxServiceReady' | 'apiBeginToInvoke' | 'apiInvoked' | 'joliboxSpeedAnalysis' | 'joliboxNetRequestResult' | 'globalJsError' | 'CallRuntimeLoadFinished' | 'AdBreakJumpOut' | 'AdBreakHide' | 'CallAdsInit' | 'LoadAdsenseCompleted' | 'CallAdConfig' | 'PreventAdsCheating' | 'CallShowAdFn' | 'CallAdBreak' | 'CallAdUnit' | 'CallAdBreakDone' | 'AdSenseUnitStatusChanged' | 'OpenGame' | 'PlayGame' | 'CloseGame' | 'LevelFinished' | 'TaskFinished' | 'UseGameItem' | 'LevelUpgrade' | 'HistoryUserLevel' | 'HistoryUserScore';
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";
@@ -0,0 +1,37 @@
1
+ import { StandardResponse } from './response';
2
+ export declare const LEVEL_FINISHED = "TaskTrackerSDK.levelFinished";
3
+ export declare const TASK_FINISHED = "TaskTrackerSDK.taskFinished";
4
+ export declare const TASK_EVENT = "TaskTrackerSDK.taskEvent";
5
+ 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
+ export type TaskResponse = Promise<StandardResponse<void>>;
9
+ export interface TaskTrackCommandParams {
10
+ [LEVEL_FINISHED]: (levelId: string | number, params: {
11
+ result: boolean;
12
+ duration: number;
13
+ }) => TaskResponse;
14
+ [TASK_FINISHED]: (taskId: string | number, params: {
15
+ duration: number;
16
+ }) => TaskResponse;
17
+ [TASK_EVENT]: (taskId: string | number, params: {
18
+ tools?: {
19
+ id: string | number;
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
+ }[];
32
+ }) => 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
+ }
37
+ export type TaskTrackCommandType = keyof TaskTrackCommandParams;
package/dist/env.d.ts CHANGED
@@ -14,15 +14,16 @@ export interface Env {
14
14
  aid: string;
15
15
  channel: string;
16
16
  };
17
- sdkInfo?: {
18
- nativeSDKVersion: string;
19
- sdkVersion: string;
17
+ sdkInfo: {
18
+ nativeSDKVersion?: string;
19
+ jssdkVersion: string;
20
20
  };
21
21
  hostUserInfo?: {
22
22
  uid?: string;
23
23
  isLogin: boolean;
24
- hostSession?: string;
24
+ token?: string;
25
25
  };
26
26
  schema: string;
27
27
  platform: 'iOS' | 'android' | 'h5';
28
+ clientSessionId?: string;
28
29
  }
@@ -1,4 +1,9 @@
1
1
  export declare const DOCUMENT_READY = "onDocumentReady";
2
+ export declare const ON_LOGIN_COMPLETE = "onLoginComplete";
2
3
  export interface RumtimeEventParams {
3
- [DOCUMENT_READY]: () => void;
4
+ [DOCUMENT_READY]: (startTime: number) => void;
5
+ [ON_LOGIN_COMPLETE]: (params: {
6
+ isLogin: boolean;
7
+ token?: string;
8
+ }) => void;
4
9
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './sdks/runtime';
2
2
  export * from './sdks/lifecycle';
3
3
  export * from './sdks/storage';
4
+ export * from './sdks/task-tracker';
4
5
  export * from './sdks/native/keyboard';
5
6
  export * from './events';
6
7
  export * from './commands';
@@ -1,9 +1,9 @@
1
1
  import { Env } from '../env';
2
2
  export interface Lifecycle {
3
3
  onReady: (params: (info: Env['hostUserInfo']) => void) => void;
4
- onGameShow: (params: () => void) => void;
5
- onGameHide: (params: () => void) => void;
6
- exitGame: (param: {
4
+ onJoliboxShow: (params: () => void) => void;
5
+ onJoliboxHide: (params: () => void) => void;
6
+ exit: (param: {
7
7
  onBeforeExit: () => void;
8
8
  }) => void;
9
9
  }
@@ -0,0 +1,24 @@
1
+ import { TaskResponse } from '../commands/task-track';
2
+ export interface TaskTracker {
3
+ onLevelFinished(levelId: string | number, result: boolean, duration: number): Promise<TaskResponse>;
4
+ onTaskFinished(taskId: string | number, duration: number): Promise<TaskResponse>;
5
+ onTaskEvent(taskId: string | number, params: {
6
+ tools?: {
7
+ id: string | number;
8
+ name: string;
9
+ count?: number;
10
+ description?: string;
11
+ price?: {
12
+ amount: number;
13
+ unit: string;
14
+ };
15
+ }[];
16
+ awards?: {
17
+ id: string | number;
18
+ name: string;
19
+ }[];
20
+ }): Promise<TaskResponse>;
21
+ onLevelUpgrade(levelId: string | number, name: string): Promise<TaskResponse>;
22
+ onHistoryUserLevel(level: number): Promise<TaskResponse>;
23
+ onHistoryUserScore(score: number): Promise<TaskResponse>;
24
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jolibox/types",
3
- "description": "This project is common types used for JS-SDk interfere & implementation",
4
- "version": "1.1.4-beta.1",
3
+ "description": "This project is common types used for JS-SDk interfere & implement",
4
+ "version": "1.1.4-beta.10",
5
5
  "typings": "dist/index.d.ts",
6
6
  "license": "MIT",
7
7
  "files": [