zmp-sdk 2.16.2 → 2.16.5
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/dist/browser.min.js +498 -455
- package/dist/index.es.js +498 -455
- package/dist/index.js +2 -2
- package/dist/index.umd.js +2 -2
- package/dist/types/src/{controller → apis}/index.d.ts +5 -5
- package/dist/types/src/bridgeProvider.d.ts +2 -1
- package/dist/types/src/constants.d.ts +25 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/services/background.d.ts +1 -1
- package/dist/types/src/services/basic.d.ts +1 -1
- package/dist/types/src/services/dataCaching.d.ts +1 -1
- package/dist/types/src/services/device.d.ts +1 -1
- package/dist/types/src/services/location.d.ts +1 -1
- package/dist/types/src/services/media.d.ts +1 -1
- package/dist/types/src/{controller/mock-mp-manager.d.ts → services/mock-mp-service.d.ts} +6 -5
- package/dist/types/src/services/navigationBar.d.ts +1 -1
- package/dist/types/src/services/openApi.d.ts +1 -1
- package/dist/types/src/services/routing.d.ts +1 -1
- package/dist/types/src/services/window.d.ts +1 -1
- package/dist/types/src/{controller/zalo-mp-manager.d.ts → services/zalo-mp-service.d.ts} +15 -14
- package/dist/types/src/services/zalo.d.ts +11 -2
- package/dist/types/src/types/inputData.d.ts +2 -5
- package/dist/types/src/{controller → types}/interface.d.ts +7 -6
- package/dist/types/src/utils/common.d.ts +10 -1
- package/dist/types/src/zaloJsBridge.d.ts +2 -1
- package/package.json +1 -1
- package/dist/types/src/config.d.ts +0 -27
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SDKServiceInterface } from '../types/interface';
|
|
2
2
|
import { ZMPEEmitter } from '../event-emitter';
|
|
3
3
|
import * as InputDataType from '../types/inputData';
|
|
4
4
|
import * as CallbackDataType from '../types/callbackData';
|
|
@@ -6,7 +6,7 @@ export declare abstract class SDKCreator {
|
|
|
6
6
|
#private;
|
|
7
7
|
events: ZMPEEmitter;
|
|
8
8
|
constructor();
|
|
9
|
-
protected abstract
|
|
9
|
+
protected abstract getServiceInstance(): SDKServiceInterface;
|
|
10
10
|
/**
|
|
11
11
|
* Login to call more action.
|
|
12
12
|
*
|
|
@@ -83,7 +83,7 @@ export declare abstract class SDKCreator {
|
|
|
83
83
|
unfollowOA(object: InputDataType.OAInput): Promise<void>;
|
|
84
84
|
openShareSheet(object: InputDataType.OpenShareSheet<CallbackDataType.ShareSheetSuccessCallback>): Promise<CallbackDataType.ShareSheetSuccessCallback>;
|
|
85
85
|
requestCameraPermission(object: InputDataType.CallbackType<CallbackDataType.RequestCameraPermissionSuccessCallback>): Promise<CallbackDataType.RequestCameraPermissionSuccessCallback>;
|
|
86
|
-
createShortcut(object: InputDataType.
|
|
86
|
+
createShortcut(object: InputDataType.CreateShortcut): Promise<void>;
|
|
87
87
|
openBioAuthentication(object: InputDataType.OpenBioAuthentication<CallbackDataType.RequestBioAuthenticationSuccessCallback>): Promise<CallbackDataType.RequestBioAuthenticationSuccessCallback>;
|
|
88
88
|
checkStateBioAuthentication(object: InputDataType.CallbackType<CallbackDataType.CheckStateBioAuthenticationSuccessCallback>): Promise<CallbackDataType.CheckStateBioAuthenticationSuccessCallback>;
|
|
89
89
|
sendLocation(object: InputDataType.QueryLocationHide): Promise<void>;
|
|
@@ -111,8 +111,8 @@ export declare abstract class SDKCreator {
|
|
|
111
111
|
getShareableLink(object: InputDataType.GetShareableLink<string>): Promise<string>;
|
|
112
112
|
}
|
|
113
113
|
export declare class ZaloMiniAppSDKCreator extends SDKCreator {
|
|
114
|
-
protected
|
|
114
|
+
protected getServiceInstance(): SDKServiceInterface;
|
|
115
115
|
}
|
|
116
116
|
export declare class MockSDKCreator extends SDKCreator {
|
|
117
|
-
protected
|
|
117
|
+
protected getServiceInstance(): SDKServiceInterface;
|
|
118
118
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NativeCallBackData } from './types/callbackData';
|
|
2
2
|
import { NativeError } from './middleware/error.middleware';
|
|
3
|
+
import { ACTION } from './constants';
|
|
3
4
|
/** @ignore */
|
|
4
5
|
export declare abstract class ZJSBridgeProvider {
|
|
5
6
|
#private;
|
|
@@ -8,7 +9,7 @@ export declare abstract class ZJSBridgeProvider {
|
|
|
8
9
|
constructor();
|
|
9
10
|
protected setZAccSession(value: string): void;
|
|
10
11
|
protected setJSToken(value: string): void;
|
|
11
|
-
protected callNative(action:
|
|
12
|
+
protected callNative(action: typeof ACTION[keyof typeof ACTION], data: object, option?: {
|
|
12
13
|
isMultiCallback?: boolean;
|
|
13
14
|
nRetry?: number;
|
|
14
15
|
haveTimeout?: boolean;
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
export declare const ZAPP_ID: string;
|
|
2
2
|
export declare const APP_ID: string;
|
|
3
3
|
export declare const APP_CONFIG: import(".").SDKConfig;
|
|
4
|
+
export declare const MINI_APP_LINK = "https://zalo.me/app/link/zapps";
|
|
5
|
+
export declare const MINI_APP_INTERNAL_LINK = "https://h5.zdn.vn/zapps";
|
|
6
|
+
export declare const COOKIE_NAME: {
|
|
7
|
+
ZOAUTH: string;
|
|
8
|
+
ZACC_SESSiON: string;
|
|
9
|
+
JS_TOKEN: string;
|
|
10
|
+
ZOAUTH_VRF: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const APIS: {
|
|
13
|
+
GET_USER_INFO: string;
|
|
14
|
+
GET_ACCESS_TOKEN: string;
|
|
15
|
+
GET_ACCESS_TOKEN_V3: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const STORAGE_DATA_LIMIT: number;
|
|
18
|
+
export declare const STORAGE_LIMIT: number;
|
|
19
|
+
export declare const NETWORK_TYPE: (isAndroid: boolean) => {
|
|
20
|
+
NONE: number;
|
|
21
|
+
WIFI: number;
|
|
22
|
+
'2G': number;
|
|
23
|
+
'3G': number;
|
|
24
|
+
'4G': number;
|
|
25
|
+
};
|
|
26
|
+
export declare const MEDIA_PICKER_LIMIT: number;
|
|
27
|
+
export declare const MEDIA_PICKER_UPLOAD_SERVER = "https://zapi-server.tungnt.xyz/upload/photos";
|
|
4
28
|
export declare const ACTION: {
|
|
5
29
|
[key: string]: {
|
|
6
30
|
name: string;
|
|
@@ -12,9 +36,9 @@ export declare const ACTION: {
|
|
|
12
36
|
have_permission?: boolean;
|
|
13
37
|
skip_jump?: boolean;
|
|
14
38
|
white_list?: boolean;
|
|
39
|
+
have_callback?: boolean;
|
|
15
40
|
};
|
|
16
41
|
};
|
|
17
|
-
export declare const ACTION_HAVE_CALLBACK: string[];
|
|
18
42
|
export declare const RESPONSE_CODE: {
|
|
19
43
|
BAD_REQUEST: number;
|
|
20
44
|
INTERNAL_SERVER_ERROR: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as InputDataType from '../types/inputData';
|
|
2
|
-
import ZaloMiniProgramSDK from '
|
|
2
|
+
import ZaloMiniProgramSDK from './zalo-mp-service';
|
|
3
3
|
export declare class DataCaching {
|
|
4
4
|
/**
|
|
5
5
|
* Stores data in the specified key in the local cache.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as InputDataType from '../types/inputData';
|
|
2
2
|
import * as CallbackDataType from '../types/callbackData';
|
|
3
|
-
import ZaloMiniProgramSDK from '
|
|
3
|
+
import ZaloMiniProgramSDK from './zalo-mp-service';
|
|
4
4
|
export declare class Device {
|
|
5
5
|
/**
|
|
6
6
|
* Sets the device orientation.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as InputDataType from '../types/inputData';
|
|
2
2
|
import * as CallbackDataType from '../types/callbackData';
|
|
3
|
-
import ZaloMiniProgramSDK from '
|
|
3
|
+
import ZaloMiniProgramSDK from './zalo-mp-service';
|
|
4
4
|
export declare class Media {
|
|
5
5
|
/**
|
|
6
6
|
* Yêu cầu quyền camera
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as InputDataType from '../types/inputData';
|
|
2
2
|
import * as CallbackDataType from '../types/callbackData';
|
|
3
|
-
import { Basics } from '
|
|
4
|
-
import { Routing } from '
|
|
3
|
+
import { Basics } from './basic';
|
|
4
|
+
import { Routing } from './routing';
|
|
5
5
|
import * as Enum from '../types/enum';
|
|
6
|
-
import {
|
|
7
|
-
export default class
|
|
6
|
+
import { SDKServiceInterface } from '../types/interface';
|
|
7
|
+
export default class MockSDKService implements SDKServiceInterface {
|
|
8
8
|
#private;
|
|
9
9
|
getLoginStatus: () => boolean;
|
|
10
10
|
getAppId: () => string;
|
|
@@ -52,7 +52,7 @@ export default class MockSDK implements SDKInterface {
|
|
|
52
52
|
unFollowOA: (object: InputDataType.OAInput) => Promise<void>;
|
|
53
53
|
openShareSheet: (object: InputDataType.OpenShareSheet<CallbackDataType.ShareSheetSuccessCallback>) => Promise<CallbackDataType.ShareSheetSuccessCallback>;
|
|
54
54
|
requestCameraPermission: (object: InputDataType.CallbackType<CallbackDataType.RequestCameraPermissionSuccessCallback>) => Promise<CallbackDataType.RequestCameraPermissionSuccessCallback>;
|
|
55
|
-
createShortcut: (
|
|
55
|
+
createShortcut: (url: string, title: string, icon: string) => Promise<void>;
|
|
56
56
|
openBioAuthentication: (object: InputDataType.OpenBioAuthentication<CallbackDataType.RequestBioAuthenticationSuccessCallback>) => Promise<CallbackDataType.RequestBioAuthenticationSuccessCallback>;
|
|
57
57
|
checkStateBioAuthentication: (object: InputDataType.CallbackType<CallbackDataType.CheckStateBioAuthenticationSuccessCallback>) => Promise<CallbackDataType.CheckStateBioAuthenticationSuccessCallback>;
|
|
58
58
|
sendLocation: (object: InputDataType.QueryLocationHide) => Promise<void>;
|
|
@@ -81,4 +81,5 @@ export default class MockSDK implements SDKInterface {
|
|
|
81
81
|
enable?: 0 | 1;
|
|
82
82
|
aspect_ratio?: string;
|
|
83
83
|
}, silentRequest?: 0 | 1, maxSelectItem?: number): Promise<CallbackDataType.OpenMediaPickerSuccessCallBack>;
|
|
84
|
+
openOutApp: (url: string) => Promise<void>;
|
|
84
85
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { ZJSBridgeProvider } from '../bridgeProvider';
|
|
2
2
|
import * as InputDataType from '../types/inputData';
|
|
3
|
-
import { Basics } from '
|
|
4
|
-
import { NavigationBar } from '
|
|
5
|
-
import { Background } from '
|
|
6
|
-
import { Device } from '
|
|
7
|
-
import { DataCaching } from '
|
|
8
|
-
import { OpenApi } from '
|
|
9
|
-
import { Window } from '
|
|
10
|
-
import { Location } from '
|
|
11
|
-
import { Media } from '
|
|
12
|
-
import { Zalo } from '
|
|
13
|
-
import { Routing } from '
|
|
14
|
-
import {
|
|
3
|
+
import { Basics } from './basic';
|
|
4
|
+
import { NavigationBar } from './navigationBar';
|
|
5
|
+
import { Background } from './background';
|
|
6
|
+
import { Device } from './device';
|
|
7
|
+
import { DataCaching } from './dataCaching';
|
|
8
|
+
import { OpenApi } from './openApi';
|
|
9
|
+
import { Window } from './window';
|
|
10
|
+
import { Location } from './location';
|
|
11
|
+
import { Media } from './media';
|
|
12
|
+
import { Zalo } from './zalo';
|
|
13
|
+
import { Routing } from './routing';
|
|
14
|
+
import { SDKServiceInterface } from '../types/interface';
|
|
15
15
|
import { ZMPEEmitter } from '../event-emitter';
|
|
16
|
-
export default class
|
|
16
|
+
export default class ZaloMiniProgramSDKService extends ZJSBridgeProvider implements SDKServiceInterface {
|
|
17
17
|
#private;
|
|
18
18
|
events: ZMPEEmitter;
|
|
19
19
|
isShowNavBar: boolean;
|
|
20
20
|
isIOS: boolean;
|
|
21
21
|
private static instance;
|
|
22
|
-
static getInstance():
|
|
22
|
+
static getInstance(): ZaloMiniProgramSDKService;
|
|
23
23
|
constructor();
|
|
24
24
|
getActionBarConfig: () => InputDataType.ActionBarConfig;
|
|
25
25
|
setActionBarConfig: (setState: (state: InputDataType.ActionBarConfig) => InputDataType.ActionBarConfig) => void;
|
|
@@ -89,4 +89,5 @@ export default class ZaloMiniProgramSDK extends ZJSBridgeProvider implements SDK
|
|
|
89
89
|
openProfilePicker: typeof Zalo.openProfilePicker;
|
|
90
90
|
connectWifi: typeof Device.connectWifi;
|
|
91
91
|
openMediaPicker: typeof Zalo.openMediaPicker;
|
|
92
|
+
openOutApp: typeof Zalo.openOutApp;
|
|
92
93
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as InputDataType from '../types/inputData';
|
|
2
2
|
import * as CallbackDataType from '../types/callbackData';
|
|
3
3
|
import { MediaPickerType } from '../types/enum';
|
|
4
|
-
import ZaloMiniProgramSDK from '
|
|
4
|
+
import ZaloMiniProgramSDK from './zalo-mp-service';
|
|
5
5
|
export declare class Zalo {
|
|
6
6
|
/**
|
|
7
7
|
* View QR.
|
|
@@ -71,7 +71,7 @@ export declare class Zalo {
|
|
|
71
71
|
* @category Zalo
|
|
72
72
|
*
|
|
73
73
|
*/
|
|
74
|
-
static createShortcut(this: ZaloMiniProgramSDK,
|
|
74
|
+
static createShortcut(this: ZaloMiniProgramSDK, url: string, title: string, icon: string): Promise<void>;
|
|
75
75
|
/**
|
|
76
76
|
* Cho phép ứng dụng mở giao diện chọn user và get về list noise id
|
|
77
77
|
*
|
|
@@ -102,4 +102,13 @@ export declare class Zalo {
|
|
|
102
102
|
enable?: 0 | 1;
|
|
103
103
|
aspect_ratio?: string;
|
|
104
104
|
}, silentRequest?: 0 | 1, maxSelectItem?: number): Promise<CallbackDataType.OpenMediaPickerSuccessCallBack>;
|
|
105
|
+
/**
|
|
106
|
+
* Mở url out app zalo
|
|
107
|
+
*
|
|
108
|
+
* @async
|
|
109
|
+
* @function openOutApp
|
|
110
|
+
* @category Zalo
|
|
111
|
+
*
|
|
112
|
+
*/
|
|
113
|
+
static openOutApp(this: ZaloMiniProgramSDK, url: string): Promise<void>;
|
|
105
114
|
}
|
|
@@ -291,11 +291,8 @@ export declare type OpenShareSheet<T> = CallbackType<T> & {
|
|
|
291
291
|
* Create Shortcut Input data
|
|
292
292
|
*/
|
|
293
293
|
export declare type CreateShortcut = CallbackType & {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
featureId: number;
|
|
297
|
-
title: string;
|
|
298
|
-
iconUrl: string;
|
|
294
|
+
params?: {
|
|
295
|
+
[key: string]: string;
|
|
299
296
|
};
|
|
300
297
|
};
|
|
301
298
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as InputDataType from '
|
|
2
|
-
import * as CallbackDataType from '
|
|
3
|
-
import { systemInfo } from '
|
|
4
|
-
import { MediaPickerType } from '
|
|
5
|
-
export interface
|
|
1
|
+
import * as InputDataType from './inputData';
|
|
2
|
+
import * as CallbackDataType from './callbackData';
|
|
3
|
+
import { systemInfo } from './entity';
|
|
4
|
+
import { MediaPickerType } from './enum';
|
|
5
|
+
export interface SDKServiceInterface {
|
|
6
6
|
getAppId: () => string;
|
|
7
7
|
login: (object?: InputDataType.CallbackType) => Promise<string>;
|
|
8
8
|
getLoginStatus: () => boolean;
|
|
@@ -41,7 +41,7 @@ export interface SDKInterface {
|
|
|
41
41
|
unFollowOA: (object: InputDataType.OAInput) => Promise<void>;
|
|
42
42
|
openShareSheet: (object: InputDataType.OpenShareSheet<CallbackDataType.ShareSheetSuccessCallback>) => Promise<CallbackDataType.ShareSheetSuccessCallback>;
|
|
43
43
|
requestCameraPermission: (object: InputDataType.CallbackType<CallbackDataType.RequestCameraPermissionSuccessCallback>) => Promise<CallbackDataType.RequestCameraPermissionSuccessCallback>;
|
|
44
|
-
createShortcut: (
|
|
44
|
+
createShortcut: (url: string, title: string, icon: string) => Promise<void>;
|
|
45
45
|
openBioAuthentication: (object: InputDataType.OpenBioAuthentication<CallbackDataType.RequestBioAuthenticationSuccessCallback>) => Promise<CallbackDataType.RequestBioAuthenticationSuccessCallback>;
|
|
46
46
|
checkStateBioAuthentication: (object: InputDataType.CallbackType<CallbackDataType.CheckStateBioAuthenticationSuccessCallback>) => Promise<CallbackDataType.CheckStateBioAuthenticationSuccessCallback>;
|
|
47
47
|
sendLocation: (object: InputDataType.QueryLocationHide) => Promise<void>;
|
|
@@ -77,4 +77,5 @@ export interface SDKInterface {
|
|
|
77
77
|
enable?: 0 | 1;
|
|
78
78
|
aspect_ratio?: string;
|
|
79
79
|
}, silentRequest?: 0 | 1, maxSelectItem?: number) => Promise<CallbackDataType.OpenMediaPickerSuccessCallBack>;
|
|
80
|
+
openOutApp: (url: string) => Promise<void>;
|
|
80
81
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PlatformType } from '../types/enum';
|
|
2
|
+
import { ACTION } from '../constants';
|
|
2
3
|
/**
|
|
3
4
|
* Checks if a url is valid
|
|
4
5
|
* @param {string} string URL
|
|
@@ -61,7 +62,7 @@ export declare const getAppUrl: (appId: string) => string;
|
|
|
61
62
|
export declare const isSupportNativeStorage: () => boolean;
|
|
62
63
|
export declare const stringifyData: (data: any) => string;
|
|
63
64
|
export declare const stringToData: (data: string | null) => any;
|
|
64
|
-
export declare const checkIOSSupportAction: (action:
|
|
65
|
+
export declare const checkIOSSupportAction: (action: typeof ACTION[keyof typeof ACTION]) => boolean;
|
|
65
66
|
export declare const getZMPShareInfo: (appID: string, accessToken: string, shareTitle: string, shareDescription: string, shareThumbnail: string, sharePath?: string | undefined) => Promise<{
|
|
66
67
|
zinstantApi: string;
|
|
67
68
|
shareId: string;
|
|
@@ -81,3 +82,11 @@ export declare const checkData: (types: string | Array<string>, option?: {
|
|
|
81
82
|
error: boolean;
|
|
82
83
|
errorMessage?: undefined;
|
|
83
84
|
};
|
|
85
|
+
export declare const getAppInfo: (appId: string, versionStatus: number, currentVersion?: string | undefined) => Promise<{
|
|
86
|
+
description: string;
|
|
87
|
+
version: string;
|
|
88
|
+
name: string;
|
|
89
|
+
appUrl: string;
|
|
90
|
+
qrCodeUrl: string;
|
|
91
|
+
logoUrl?: string;
|
|
92
|
+
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ACTION } from './constants';
|
|
1
2
|
import EventEmitter from 'eventemitter3';
|
|
2
3
|
export default class ZaloJSBridge extends EventEmitter {
|
|
3
4
|
private static instance;
|
|
@@ -20,5 +21,5 @@ export default class ZaloJSBridge extends EventEmitter {
|
|
|
20
21
|
nativeEventHandler(eventId: string, eventName: string, eventData: string): void;
|
|
21
22
|
handleEventData(eventName: string, data: any): any;
|
|
22
23
|
defaultCallback(data: any): void;
|
|
23
|
-
jsCall(action:
|
|
24
|
+
jsCall(action: typeof ACTION[keyof typeof ACTION], options: object, callback: any, isMultiCallback?: boolean, nRetry?: number, haveTimeout?: boolean): any;
|
|
24
25
|
}
|
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
MINI_APP_LINK: string;
|
|
3
|
-
MINI_APP_INTERNAL_LINK: string;
|
|
4
|
-
COOKIE_NAME: {
|
|
5
|
-
ZOAUTH: string;
|
|
6
|
-
ZACC_SESSiON: string;
|
|
7
|
-
JS_TOKEN: string;
|
|
8
|
-
ZOAUTH_VRF: string;
|
|
9
|
-
};
|
|
10
|
-
APIS: {
|
|
11
|
-
GET_USER_INFO: string;
|
|
12
|
-
GET_ACCESS_TOKEN: string;
|
|
13
|
-
GET_ACCESS_TOKEN_V3: string;
|
|
14
|
-
};
|
|
15
|
-
STORAGE_DATA_LIMIT: number;
|
|
16
|
-
STORAGE_LIMIT: number;
|
|
17
|
-
NETWORK_TYPE: {
|
|
18
|
-
NONE: number;
|
|
19
|
-
WIFI: number;
|
|
20
|
-
'2G': number;
|
|
21
|
-
'3G': number;
|
|
22
|
-
'4G': number;
|
|
23
|
-
};
|
|
24
|
-
MEDIA_PICKER_LIMIT: number;
|
|
25
|
-
MEDIA_PICKER_UPLOAD_SERVER: string;
|
|
26
|
-
};
|
|
27
|
-
export default _default;
|