zmp-sdk 2.16.1 → 2.16.4

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,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,10 +9,11 @@ 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: string, data: object, option?: {
12
+ protected callNative(action: typeof ACTION[keyof typeof ACTION], data: object, option?: {
12
13
  isMultiCallback?: boolean;
13
14
  nRetry?: number;
14
15
  haveTimeout?: boolean;
15
16
  callback?: (data: NativeCallBackData, error: NativeError | null) => void;
17
+ delay?: number;
16
18
  }): Promise<any>;
17
19
  }
@@ -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,4 +1,4 @@
1
- import { SDKInterface } from './interface';
1
+ import { SDKInterface } 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';
@@ -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.CallbackType): Promise<void>;
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>;
@@ -3,7 +3,7 @@ import * as CallbackDataType from '../types/callbackData';
3
3
  import { Basics } from '../services/basic';
4
4
  import { Routing } from '../services/routing';
5
5
  import * as Enum from '../types/enum';
6
- import { SDKInterface } from './interface';
6
+ import { SDKInterface } from '../types/interface';
7
7
  export default class MockSDK implements SDKInterface {
8
8
  #private;
9
9
  getLoginStatus: () => boolean;
@@ -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: (object: InputDataType.CallbackType) => Promise<void>;
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
  }
@@ -11,12 +11,13 @@ import { Location } from '../services/location';
11
11
  import { Media } from '../services/media';
12
12
  import { Zalo } from '../services/zalo';
13
13
  import { Routing } from '../services/routing';
14
- import { SDKInterface } from './interface';
14
+ import { SDKInterface } from '../types/interface';
15
15
  import { ZMPEEmitter } from '../event-emitter';
16
16
  export default class ZaloMiniProgramSDK extends ZJSBridgeProvider implements SDKInterface {
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();
@@ -88,4 +89,5 @@ export default class ZaloMiniProgramSDK extends ZJSBridgeProvider implements SDK
88
89
  openProfilePicker: typeof Zalo.openProfilePicker;
89
90
  connectWifi: typeof Device.connectWifi;
90
91
  openMediaPicker: typeof Zalo.openMediaPicker;
92
+ openOutApp: typeof Zalo.openOutApp;
91
93
  }
@@ -71,7 +71,7 @@ export declare class Zalo {
71
71
  * @category Zalo
72
72
  *
73
73
  */
74
- static createShortcut(this: ZaloMiniProgramSDK, object: InputDataType.CallbackType): Promise<void>;
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
- data: {
295
- url: string;
296
- featureId: number;
297
- title: string;
298
- iconUrl: string;
294
+ params?: {
295
+ [key: string]: string;
299
296
  };
300
297
  };
301
298
  /**
@@ -1,7 +1,7 @@
1
- import * as InputDataType from '../types/inputData';
2
- import * as CallbackDataType from '../types/callbackData';
3
- import { systemInfo } from '../types/entity';
4
- import { MediaPickerType } from '../types/enum';
1
+ import * as InputDataType from './inputData';
2
+ import * as CallbackDataType from './callbackData';
3
+ import { systemInfo } from './entity';
4
+ import { MediaPickerType } from './enum';
5
5
  export interface SDKInterface {
6
6
  getAppId: () => string;
7
7
  login: (object?: InputDataType.CallbackType) => Promise<string>;
@@ -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: (object: InputDataType.CallbackType) => Promise<void>;
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: string) => boolean;
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: string, options: object, callback: any, isMultiCallback?: boolean, nRetry?: number, haveTimeout?: boolean): any;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "zmp-sdk",
3
- "version": "2.16.1",
3
+ "version": "2.16.4",
4
4
  "description": "Zalo Mini App SDK",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -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;