zmp-sdk 2.15.4 → 2.16.2
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.git.md +37 -0
- package/dist/browser.min.js +461 -333
- package/dist/index.es.js +462 -334
- package/dist/index.js +2 -2
- package/dist/index.umd.js +2 -2
- package/dist/types/src/bridgeProvider.d.ts +1 -0
- package/dist/types/src/config.d.ts +2 -0
- package/dist/types/src/constants.d.ts +3 -0
- package/dist/types/src/controller/index.d.ts +3 -0
- package/dist/types/src/controller/interface.d.ts +6 -0
- package/dist/types/src/controller/mock-mp-manager.d.ts +6 -0
- package/dist/types/src/controller/zalo-mp-manager.d.ts +3 -0
- package/dist/types/src/middleware/validate.middleware.d.ts +5 -2
- package/dist/types/src/services/device.d.ts +8 -0
- package/dist/types/src/services/zalo.d.ts +13 -0
- package/dist/types/src/types/callbackData.d.ts +7 -0
- package/dist/types/src/types/enum.d.ts +9 -1
- package/dist/types/src/types/inputData.d.ts +17 -9
- package/dist/types/src/utils/common.d.ts +15 -4
- package/dist/types/src/zaloJsBridge.d.ts +1 -0
- package/package.json +1 -1
|
@@ -93,6 +93,7 @@ export declare abstract class SDKCreator {
|
|
|
93
93
|
openSMS(object: InputDataType.OpenSMS): Promise<void>;
|
|
94
94
|
viewOAQr(object: InputDataType.ViewOAQr): Promise<void>;
|
|
95
95
|
keepScreen(object: InputDataType.KeepScreen): Promise<void>;
|
|
96
|
+
saveImageToGallery(object: InputDataType.SaveImageToPhotosAlbumType): Promise<void>;
|
|
96
97
|
saveImageToPhotosAlbum(object: InputDataType.SaveImageToPhotosAlbumType): Promise<void>;
|
|
97
98
|
openMiniApp(object: InputDataType.OpenMiniApp): Promise<void>;
|
|
98
99
|
vibrate(object: InputDataType.VibrateInput): Promise<void>;
|
|
@@ -105,6 +106,8 @@ export declare abstract class SDKCreator {
|
|
|
105
106
|
onCallbackData(callback: (res: InputDataType.OnCallbackData) => void): Promise<void>;
|
|
106
107
|
getPhoneNumber(object?: InputDataType.CallbackType<CallbackDataType.GetPhoneNumberSuccessCallBack>): Promise<CallbackDataType.GetPhoneNumberSuccessCallBack>;
|
|
107
108
|
openProfilePicker(object: InputDataType.OpenProfilePicker<CallbackDataType.OpenProfilePickerSuccessCallBack>): Promise<CallbackDataType.OpenProfilePickerSuccessCallBack>;
|
|
109
|
+
connectWifi(object: InputDataType.ConnectWifi): Promise<void>;
|
|
110
|
+
openMediaPicker(object: InputDataType.OpenMediaPicker<CallbackDataType.OpenMediaPickerSuccessCallBack>): Promise<CallbackDataType.OpenMediaPickerSuccessCallBack>;
|
|
108
111
|
getShareableLink(object: InputDataType.GetShareableLink<string>): Promise<string>;
|
|
109
112
|
}
|
|
110
113
|
export declare class ZaloMiniAppSDKCreator extends SDKCreator {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as InputDataType from '../types/inputData';
|
|
2
2
|
import * as CallbackDataType from '../types/callbackData';
|
|
3
3
|
import { systemInfo } from '../types/entity';
|
|
4
|
+
import { MediaPickerType } from '../types/enum';
|
|
4
5
|
export interface SDKInterface {
|
|
5
6
|
getAppId: () => string;
|
|
6
7
|
login: (object?: InputDataType.CallbackType) => Promise<string>;
|
|
@@ -71,4 +72,9 @@ export interface SDKInterface {
|
|
|
71
72
|
onCallbackData: (callback: (res: InputDataType.OnCallbackData) => void) => Promise<void>;
|
|
72
73
|
getPhoneNumber: (object?: InputDataType.CallbackType<CallbackDataType.GetPhoneNumberSuccessCallBack>) => Promise<CallbackDataType.GetPhoneNumberSuccessCallBack>;
|
|
73
74
|
openProfilePicker: (object?: InputDataType.OpenProfilePicker<CallbackDataType.OpenProfilePickerSuccessCallBack>) => Promise<CallbackDataType.OpenProfilePickerSuccessCallBack>;
|
|
75
|
+
connectWifi: (object: InputDataType.ConnectWifi) => Promise<void>;
|
|
76
|
+
openMediaPicker: (type: keyof typeof MediaPickerType, editView?: {
|
|
77
|
+
enable?: 0 | 1;
|
|
78
|
+
aspect_ratio?: string;
|
|
79
|
+
}, silentRequest?: 0 | 1, maxSelectItem?: number) => Promise<CallbackDataType.OpenMediaPickerSuccessCallBack>;
|
|
74
80
|
}
|
|
@@ -2,6 +2,7 @@ import * as InputDataType from '../types/inputData';
|
|
|
2
2
|
import * as CallbackDataType from '../types/callbackData';
|
|
3
3
|
import { Basics } from '../services/basic';
|
|
4
4
|
import { Routing } from '../services/routing';
|
|
5
|
+
import * as Enum from '../types/enum';
|
|
5
6
|
import { SDKInterface } from './interface';
|
|
6
7
|
export default class MockSDK implements SDKInterface {
|
|
7
8
|
#private;
|
|
@@ -75,4 +76,9 @@ export default class MockSDK implements SDKInterface {
|
|
|
75
76
|
off<T extends string>(event: T, fn?: (...args: any[]) => void, context?: any, once?: boolean): void;
|
|
76
77
|
removeAllListeners(event?: string): void;
|
|
77
78
|
openProfilePicker: (object?: InputDataType.CallbackType) => Promise<CallbackDataType.OpenProfilePickerSuccessCallBack>;
|
|
79
|
+
connectWifi: (object?: InputDataType.ConnectWifi) => Promise<void>;
|
|
80
|
+
openMediaPicker(type: keyof typeof Enum.MediaPickerType, editView?: {
|
|
81
|
+
enable?: 0 | 1;
|
|
82
|
+
aspect_ratio?: string;
|
|
83
|
+
}, silentRequest?: 0 | 1, maxSelectItem?: number): Promise<CallbackDataType.OpenMediaPickerSuccessCallBack>;
|
|
78
84
|
}
|
|
@@ -17,6 +17,7 @@ export default class ZaloMiniProgramSDK extends ZJSBridgeProvider implements SDK
|
|
|
17
17
|
#private;
|
|
18
18
|
events: ZMPEEmitter;
|
|
19
19
|
isShowNavBar: boolean;
|
|
20
|
+
isIOS: boolean;
|
|
20
21
|
private static instance;
|
|
21
22
|
static getInstance(): ZaloMiniProgramSDK;
|
|
22
23
|
constructor();
|
|
@@ -86,4 +87,6 @@ export default class ZaloMiniProgramSDK extends ZJSBridgeProvider implements SDK
|
|
|
86
87
|
onCallbackData: typeof Routing.onCallbackData;
|
|
87
88
|
getPhoneNumber: typeof OpenApi.getPhoneNumber;
|
|
88
89
|
openProfilePicker: typeof Zalo.openProfilePicker;
|
|
90
|
+
connectWifi: typeof Device.connectWifi;
|
|
91
|
+
openMediaPicker: typeof Zalo.openMediaPicker;
|
|
89
92
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
export declare const required: (
|
|
2
|
+
export declare const required: (fields: string[], option?: {
|
|
3
|
+
if?: Object | undefined;
|
|
4
|
+
defaultValue?: Object | undefined;
|
|
5
|
+
} | undefined) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
3
6
|
export declare const checkType: (type: string, properties?: {
|
|
4
7
|
[key: string]: any;
|
|
5
|
-
} | undefined,
|
|
8
|
+
} | undefined, defaultValue?: any) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
6
9
|
export declare const validate: (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<any>) => TypedPropertyDescriptor<any>;
|
|
@@ -310,4 +310,12 @@ export declare class Device {
|
|
|
310
310
|
*
|
|
311
311
|
*/
|
|
312
312
|
static vibrate(this: ZaloMiniProgramSDK, object: InputDataType.VibrateInput): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Connect Wifi.
|
|
315
|
+
* @async
|
|
316
|
+
* @function connectWifi
|
|
317
|
+
* @category Device
|
|
318
|
+
*
|
|
319
|
+
*/
|
|
320
|
+
static connectWifi(this: ZaloMiniProgramSDK, object: InputDataType.ConnectWifi): Promise<void>;
|
|
313
321
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as InputDataType from '../types/inputData';
|
|
2
2
|
import * as CallbackDataType from '../types/callbackData';
|
|
3
|
+
import { MediaPickerType } from '../types/enum';
|
|
3
4
|
import ZaloMiniProgramSDK from '../controller/zalo-mp-manager';
|
|
4
5
|
export declare class Zalo {
|
|
5
6
|
/**
|
|
@@ -89,4 +90,16 @@ export declare class Zalo {
|
|
|
89
90
|
*
|
|
90
91
|
*/
|
|
91
92
|
static getActionsSupported(this: ZaloMiniProgramSDK, object?: InputDataType.CallbackType<CallbackDataType.GetActionsSupportedSuccessCallBack>): Promise<CallbackDataType.GetActionsSupportedSuccessCallBack>;
|
|
93
|
+
/**
|
|
94
|
+
* Cho phép ứng dụng mở giao diện chọn media và get về list media url
|
|
95
|
+
*
|
|
96
|
+
* @async
|
|
97
|
+
* @function openMediaPicker
|
|
98
|
+
* @category Zalo
|
|
99
|
+
*
|
|
100
|
+
*/
|
|
101
|
+
static openMediaPicker(this: ZaloMiniProgramSDK, type: keyof typeof MediaPickerType, editView?: {
|
|
102
|
+
enable?: 0 | 1;
|
|
103
|
+
aspect_ratio?: string;
|
|
104
|
+
}, silentRequest?: 0 | 1, maxSelectItem?: number): Promise<CallbackDataType.OpenMediaPickerSuccessCallBack>;
|
|
92
105
|
}
|
|
@@ -137,3 +137,10 @@ export declare type OpenProfilePickerSuccessCallBack = {
|
|
|
137
137
|
export declare type GetActionsSupportedSuccessCallBack = {
|
|
138
138
|
actions: Array<string>;
|
|
139
139
|
};
|
|
140
|
+
/**
|
|
141
|
+
* open media picker success callback
|
|
142
|
+
* @typedef OpenMediaPickerSuccessCallBack
|
|
143
|
+
*/
|
|
144
|
+
export declare type OpenMediaPickerSuccessCallBack = {
|
|
145
|
+
urls: Array<string>;
|
|
146
|
+
};
|
|
@@ -60,5 +60,13 @@ export declare enum Events {
|
|
|
60
60
|
AppPaused = "h5.event.paused",
|
|
61
61
|
AppResumed = "h5.event.resumed",
|
|
62
62
|
NetworkChanged = "h5.event.connection.changed",
|
|
63
|
-
OnDataCallback = "h5.event.webview.result"
|
|
63
|
+
OnDataCallback = "h5.event.webview.result",
|
|
64
|
+
OpenApp = "h5.event.open.mp"
|
|
65
|
+
}
|
|
66
|
+
export declare enum MediaPickerType {
|
|
67
|
+
photo = 4,
|
|
68
|
+
video = 5,
|
|
69
|
+
file = 6,
|
|
70
|
+
multi_photo = 7,
|
|
71
|
+
multi_video = 8
|
|
64
72
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NetworkType, ProfileType, ChatType, PostFeedType, ShareSheetType, OrientationType, VibrateType } from './enum';
|
|
1
|
+
import { NetworkType, ProfileType, ChatType, PostFeedType, ShareSheetType, OrientationType, VibrateType, MediaPickerType } from './enum';
|
|
2
2
|
export declare type CallbackType<SuccessCallBackRes = any> = {
|
|
3
3
|
success?: (res: SuccessCallBackRes) => void;
|
|
4
4
|
fail?: (res: any) => void;
|
|
@@ -282,10 +282,7 @@ export declare type OpenShareSheet<T> = CallbackType<T> & {
|
|
|
282
282
|
chatOnly: boolean;
|
|
283
283
|
id: string;
|
|
284
284
|
title: string;
|
|
285
|
-
description: string
|
|
286
|
-
vi?: string;
|
|
287
|
-
en?: string;
|
|
288
|
-
};
|
|
285
|
+
description: string;
|
|
289
286
|
thumbnail: string;
|
|
290
287
|
path: string;
|
|
291
288
|
};
|
|
@@ -411,6 +408,20 @@ export declare type GetUserInfoDataType<T> = CallbackType<T> & {
|
|
|
411
408
|
export declare type OpenProfilePicker<T> = CallbackType<T> & {
|
|
412
409
|
maxProfile?: number;
|
|
413
410
|
};
|
|
411
|
+
export declare type ConnectWifi = CallbackType & {
|
|
412
|
+
SSID: string;
|
|
413
|
+
password?: string;
|
|
414
|
+
hiddenSSID?: boolean;
|
|
415
|
+
};
|
|
416
|
+
export declare type OpenMediaPicker<T> = CallbackType<T> & {
|
|
417
|
+
type: keyof typeof MediaPickerType;
|
|
418
|
+
editView: {
|
|
419
|
+
enable: boolean;
|
|
420
|
+
aspectRatio: string;
|
|
421
|
+
};
|
|
422
|
+
silentRequest: boolean;
|
|
423
|
+
maxSelectItem: number;
|
|
424
|
+
};
|
|
414
425
|
export declare type ActionBarConfig = {
|
|
415
426
|
actionbarType: number;
|
|
416
427
|
buttonType: number;
|
|
@@ -430,10 +441,7 @@ export declare type ActionBarConfig = {
|
|
|
430
441
|
*/
|
|
431
442
|
export declare type GetShareableLink<T> = CallbackType<T> & {
|
|
432
443
|
title: string;
|
|
433
|
-
description: string
|
|
434
|
-
vi?: string;
|
|
435
|
-
en?: string;
|
|
436
|
-
};
|
|
444
|
+
description: string;
|
|
437
445
|
thumbnail: string;
|
|
438
446
|
path: string;
|
|
439
447
|
};
|
|
@@ -62,11 +62,22 @@ export declare const isSupportNativeStorage: () => boolean;
|
|
|
62
62
|
export declare const stringifyData: (data: any) => string;
|
|
63
63
|
export declare const stringToData: (data: string | null) => any;
|
|
64
64
|
export declare const checkIOSSupportAction: (action: string) => boolean;
|
|
65
|
-
export declare const getZMPShareInfo: (appID: string, accessToken: string, shareTitle: string, shareDescription: string | {
|
|
66
|
-
vi?: string;
|
|
67
|
-
en?: string;
|
|
68
|
-
}, shareThumbnail: string, sharePath?: string | undefined) => Promise<{
|
|
65
|
+
export declare const getZMPShareInfo: (appID: string, accessToken: string, shareTitle: string, shareDescription: string, shareThumbnail: string, sharePath?: string | undefined) => Promise<{
|
|
69
66
|
zinstantApi: string;
|
|
70
67
|
shareId: string;
|
|
71
68
|
shareableLink: string;
|
|
72
69
|
}>;
|
|
70
|
+
export declare const checkData: (types: string | Array<string>, option?: {
|
|
71
|
+
min?: number | undefined;
|
|
72
|
+
max?: number | undefined;
|
|
73
|
+
maxLength?: number | undefined;
|
|
74
|
+
values?: any[] | undefined;
|
|
75
|
+
default?: any;
|
|
76
|
+
regex?: RegExp | undefined;
|
|
77
|
+
} | undefined) => (data: any) => {
|
|
78
|
+
error: boolean;
|
|
79
|
+
errorMessage: string | string[];
|
|
80
|
+
} | {
|
|
81
|
+
error: boolean;
|
|
82
|
+
errorMessage?: undefined;
|
|
83
|
+
};
|
|
@@ -18,6 +18,7 @@ export default class ZaloJSBridge extends EventEmitter {
|
|
|
18
18
|
onJSCall(key: string, data: any): void;
|
|
19
19
|
onMultiJSCall(key: string, data: any): void;
|
|
20
20
|
nativeEventHandler(eventId: string, eventName: string, eventData: string): void;
|
|
21
|
+
handleEventData(eventName: string, data: any): any;
|
|
21
22
|
defaultCallback(data: any): void;
|
|
22
23
|
jsCall(action: string, options: object, callback: any, isMultiCallback?: boolean, nRetry?: number, haveTimeout?: boolean): any;
|
|
23
24
|
}
|