zmp-sdk 2.11.6 → 2.12.0-1

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.
@@ -85,6 +85,7 @@ export declare const ACTION: {
85
85
  CHANGE_ACTIONBAR: string;
86
86
  INTERACTIVE_VIBRATION: string;
87
87
  ZBROWSER_MPDS: string;
88
+ WEBVIEW_SET_RESULT: string;
88
89
  };
89
90
  export declare const ACTION_HAVE_CALLBACK: string[];
90
91
  export declare const RESPONSE_CODE: {
@@ -99,6 +99,8 @@ export declare abstract class SDKCreator {
99
99
  [key: string]: string;
100
100
  };
101
101
  getAppInfo(object?: InputDataType.CallbackType<CallbackDataType.AppInfoSuccessCallBack>): Promise<CallbackDataType.AppInfoSuccessCallBack>;
102
+ redirectToPreviousMiniApp(object: InputDataType.RedirectCallbackData): Promise<void>;
103
+ onCallbackData(callback: (res: InputDataType.OnCallbackData) => void): Promise<void>;
102
104
  }
103
105
  export declare class ZaloMiniAppSDKCreator extends SDKCreator {
104
106
  protected getInstance(): SDK;
@@ -67,4 +67,6 @@ export interface SDK {
67
67
  [key: string]: string;
68
68
  };
69
69
  getAppInfo: (object?: InputDataType.CallbackType<CallbackDataType.AppInfoSuccessCallBack>) => Promise<CallbackDataType.AppInfoSuccessCallBack>;
70
+ redirectToPreviousMiniApp: (object: InputDataType.RedirectCallbackData) => Promise<void>;
71
+ onCallbackData: (callback: (res: InputDataType.OnCallbackData) => void) => Promise<void>;
70
72
  }
@@ -78,6 +78,8 @@ export declare class ZaloMiniProgramSDK extends ZJSBridgeProvider implements SDK
78
78
  openWebview: typeof Window.openWebview;
79
79
  getRouteParams: typeof Routing.getRouteParams;
80
80
  getAppInfo: typeof Basics.getAppInfo;
81
+ redirectToPreviousMiniApp: typeof Routing.redirectToPreviousMiniApp;
82
+ onCallbackData: typeof Routing.onCallbackData;
81
83
  }
82
84
  export declare class MockSDK implements SDK {
83
85
  #private;
@@ -142,4 +144,6 @@ export declare class MockSDK implements SDK {
142
144
  openWebview: (object: InputDataType.OpenWebview) => Promise<void>;
143
145
  getRouteParams: typeof Routing.getRouteParams;
144
146
  getAppInfo: () => Promise<CallbackDataType.AppInfoSuccessCallBack>;
147
+ redirectToPreviousMiniApp: (object: InputDataType.RedirectCallbackData) => Promise<void>;
148
+ onCallbackData: (callback: (res: InputDataType.OnCallbackData) => void) => Promise<void>;
145
149
  }
@@ -1,14 +1,32 @@
1
1
  import { ZaloMiniProgramSDK } from '../controller/sdk';
2
+ import * as InputDataType from '../types/inputData';
2
3
  export declare class Routing {
3
4
  /**
4
- * Lấy query params từ url
5
- *
6
- * @function getRouteParams
7
- * @category Routing
8
- * @param {string} url cần lấy query params
9
- * @return {SearchParams | null} Object chứa params hoặc null nếu không tìm thấy
10
- */
5
+ * Lấy query params từ url
6
+ *
7
+ * @function getRouteParams
8
+ * @category Routing
9
+ * @param {string} url cần lấy query params
10
+ * @return {SearchParams | null} Object chứa params hoặc null nếu không tìm thấy
11
+ */
11
12
  static getRouteParams(this: ZaloMiniProgramSDK): {
12
13
  [key: string]: string;
13
14
  };
15
+ /**
16
+ * Redirect to previous mini app
17
+ * @async
18
+ * @function redirectToPreviousMiniApp
19
+ * @category Routing
20
+ *
21
+ */
22
+ static redirectToPreviousMiniApp(this: ZaloMiniProgramSDK, object: InputDataType.RedirectCallbackData): Promise<void>;
23
+ /**
24
+ * Listens on the callback data event.
25
+ *
26
+ * @function onCallbackData
27
+ * @category Routing
28
+ *
29
+ * @param {Function} callback - The callback function for the callback data event.
30
+ */
31
+ static onCallbackData(this: ZaloMiniProgramSDK, callback: (res: InputDataType.OnCallbackData) => void): Promise<void>;
14
32
  }
@@ -379,4 +379,16 @@ export declare type VibrateInput = CallbackType & {
379
379
  export declare type OpenWebview = CallbackType & {
380
380
  url: string;
381
381
  };
382
+ /**
383
+ * Redirect callback data
384
+ */
385
+ export declare type RedirectCallbackData = CallbackType & {
386
+ data: string;
387
+ };
388
+ /**
389
+ * On callback data from other webview or mini app
390
+ */
391
+ export declare type OnCallbackData = {
392
+ data: string;
393
+ };
382
394
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmp-sdk",
3
- "version": "2.11.6",
3
+ "version": "2.12.0-1",
4
4
  "description": "Zalo Mini App SDK",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",