@v-miniapp/apis 1.0.12 → 1.0.14

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.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @v-miniapp/apis
2
2
 
3
- **@v-miniapp/apis** là bộ thư viện JavaScript API được thiết kế đặc biệt cho việc phát triển V-App. SDK này cung cấp đầy đủ các API để tương tác với nền tảng V-App, bao gồm các nhóm API cơ bản (thoát MiniApp, chia sẻ, thông tin hệ thống), giao diện (dialog, toast, loading, action sheet), media (ảnh, video, âm thanh), lưu trữ (local storage), network & cloud (HTTP request, upload/download), thanh toán (payment flow), và các API phần cứng (Bluetooth, Biometrics, Geo location). Thư viện hỗ trợ cả hai cách gọi API: dạng sync (callback-based) và async (Promise-based) để phù hợp với mọi phong cách lập trình.
3
+ **@v-miniapp/apis** là bộ thư viện JavaScript API được thiết kế đặc biệt cho việc phát triển V-App.
4
4
 
5
5
  📚 **Tài liệu chính thức**: [Tổng quan về API | V-MiniApp](https://developer.v-app.vn/api/overview)
6
6
 
@@ -7,6 +7,8 @@ import { IVsfGetSettingAsync } from '../types/api/get-setting';
7
7
  import { IVsfOpenSettingAsync } from '../types/api/open-setting';
8
8
  import { IVsfOpenAppSettingAsync } from '../types/api/open-app-setting';
9
9
  import { IVsfOpenNativeAppStoreAsync } from '../types/api/open-native-app-store';
10
+ import { IVsfOpenDeeplinkAsync } from '../types/api/open-deeplink';
11
+ import { IVsfOpenPublicDeepLinkAsync } from '../types/api/open-public-deep-link';
10
12
  import { IVsfShareAppAsync } from '../types/api/share-app';
11
13
  import { IVsfSetStorageAsync } from '../types/api/set-storage';
12
14
  import { IVsfGetStorageAsync } from '../types/api/get-storage';
@@ -56,6 +58,8 @@ export declare const apisAsync: {
56
58
  openSetting: IVsfOpenSettingAsync;
57
59
  openAppSetting: IVsfOpenAppSettingAsync;
58
60
  openNativeStore: IVsfOpenNativeAppStoreAsync;
61
+ openDeeplink: IVsfOpenDeeplinkAsync;
62
+ openPublicDeepLink: IVsfOpenPublicDeepLinkAsync;
59
63
  shareApp: IVsfShareAppAsync;
60
64
  setStorage: IVsfSetStorageAsync;
61
65
  getStorage: IVsfGetStorageAsync;
package/dist/api/index.js CHANGED
@@ -1,124 +1,130 @@
1
- import { getVsfPromiseFunction as t } from "../utils/api.js";
1
+ import { getVsfPromiseFunction as o } from "../utils/api.js";
2
2
  const e = new Proxy({}, {
3
- get(i, o) {
4
- return typeof window.vsf[o] == "function" ? (...a) => window.vsf[o](...a) : window.vsf[o];
3
+ get(a, t) {
4
+ return typeof window.vsf[t] == "function" ? (...i) => window.vsf[t](...i) : window.vsf[t];
5
5
  }
6
6
  }), s = {
7
- getSystemInfo: t(
7
+ getSystemInfo: o(
8
8
  e.getSystemInfo
9
9
  ),
10
- clearStorage: t(
10
+ clearStorage: o(
11
11
  e.clearStorage
12
12
  ),
13
- getClipboard: t(
13
+ getClipboard: o(
14
14
  e.getClipboard
15
15
  ),
16
- setClipboard: t(
16
+ setClipboard: o(
17
17
  e.setClipboard
18
18
  ),
19
- exitMiniApp: t(
19
+ exitMiniApp: o(
20
20
  e.exitMiniApp
21
21
  ),
22
- getSetting: t(e.getSetting),
23
- openSetting: t(
22
+ getSetting: o(e.getSetting),
23
+ openSetting: o(
24
24
  e.openSetting
25
25
  ),
26
- openAppSetting: t(
26
+ openAppSetting: o(
27
27
  e.openAppSetting
28
28
  ),
29
- openNativeStore: t(
29
+ openNativeStore: o(
30
30
  e.openNativeAppStore
31
31
  ),
32
- shareApp: t(e.shareApp),
33
- setStorage: t(e.setStorage),
34
- getStorage: t(e.getStorage),
35
- removeStorage: t(
32
+ openDeeplink: o(
33
+ e.openDeeplink
34
+ ),
35
+ openPublicDeepLink: o(
36
+ e.openPublicDeepLink
37
+ ),
38
+ shareApp: o(e.shareApp),
39
+ setStorage: o(e.setStorage),
40
+ getStorage: o(e.getStorage),
41
+ removeStorage: o(
36
42
  e.removeStorage
37
43
  ),
38
- getStorageInfo: t(
44
+ getStorageInfo: o(
39
45
  e.getStorageInfo
40
46
  ),
41
- alert: t(e.alert),
42
- confirm: t(e.confirm),
43
- prompt: t(e.prompt),
44
- showToast: t(e.showToast),
45
- showLoading: t(
47
+ alert: o(e.alert),
48
+ confirm: o(e.confirm),
49
+ prompt: o(e.prompt),
50
+ showToast: o(e.showToast),
51
+ showLoading: o(
46
52
  e.showLoading
47
53
  ),
48
- hideLoading: t(
54
+ hideLoading: o(
49
55
  e.hideLoading
50
56
  ),
51
- showActionSheet: t(
57
+ showActionSheet: o(
52
58
  e.showActionSheet
53
59
  ),
54
- chooseImage: t(
60
+ chooseImage: o(
55
61
  e.chooseImage
56
62
  ),
57
- getImageInfo: t(
63
+ getImageInfo: o(
58
64
  e.getImageInfo
59
65
  ),
60
- compressImage: t(
66
+ compressImage: o(
61
67
  e.compressImage
62
68
  ),
63
- request: t(e.request),
64
- downloadFile: t(
69
+ request: o(e.request),
70
+ downloadFile: o(
65
71
  e.downloadFile
66
72
  ),
67
- uploadFile: t(e.uploadFile),
68
- getLocation: t(
73
+ uploadFile: o(e.uploadFile),
74
+ getLocation: o(
69
75
  e.getLocation
70
76
  ),
71
- scan: t(e.scan),
72
- makePhoneCall: t(
77
+ scan: o(e.scan),
78
+ makePhoneCall: o(
73
79
  e.makePhoneCall
74
80
  ),
75
- previewImage: t(
81
+ previewImage: o(
76
82
  e.previewImage
77
83
  ),
78
- saveImage: t(e.saveImage),
79
- getAuthCode: t(
84
+ saveImage: o(e.saveImage),
85
+ getAuthCode: o(
80
86
  e.getAuthCode
81
87
  ),
82
- getUserInfo: t(
88
+ getUserInfo: o(
83
89
  e.getUserInfo
84
90
  ),
85
- initPayment: t(
91
+ initPayment: o(
86
92
  e.initPayment
87
93
  ),
88
- showPaymentMethod: t(
94
+ showPaymentMethod: o(
89
95
  e.showPaymentMethod
90
96
  ),
91
- getDefaultPaymentMethod: t(
97
+ getDefaultPaymentMethod: o(
92
98
  e.getDefaultPaymentMethod
93
99
  ),
94
- startBeaconDiscovery: t(
100
+ startBeaconDiscovery: o(
95
101
  e.startBeaconDiscovery
96
102
  ),
97
- stopBeaconDiscovery: t(
103
+ stopBeaconDiscovery: o(
98
104
  e.stopBeaconDiscovery
99
105
  ),
100
- getBeaconDiscoveryStatus: t(
106
+ getBeaconDiscoveryStatus: o(
101
107
  e.getBeaconDiscoveryStatus
102
108
  ),
103
109
  onBeaconDiscovery: e.onBeaconDiscovery,
104
110
  offBeaconDiscovery: e.offBeaconDiscovery,
105
111
  bioMetrics: {
106
- localAuth: t(
112
+ localAuth: o(
107
113
  e.bioMetrics.localAuth
108
114
  ),
109
- isSupported: t(
115
+ isSupported: o(
110
116
  e.bioMetrics.isSupported
111
117
  ),
112
- keyExists: t(
118
+ keyExists: o(
113
119
  e.bioMetrics.keyExists
114
120
  ),
115
- createKey: t(
121
+ createKey: o(
116
122
  e.bioMetrics.createKey
117
123
  ),
118
- createSignature: t(
124
+ createSignature: o(
119
125
  e.bioMetrics.createSignature
120
126
  ),
121
- deleteKey: t(
127
+ deleteKey: o(
122
128
  e.bioMetrics.deleteKey
123
129
  )
124
130
  }
@@ -18,7 +18,9 @@ export * from './get-user-info';
18
18
  export * from './init-payment';
19
19
  export * from './make-phone-call';
20
20
  export * from './open-app-setting';
21
+ export * from './open-deeplink';
21
22
  export * from './open-native-app-store';
23
+ export * from './open-public-deep-link';
22
24
  export * from './open-setting';
23
25
  export * from './preview-image';
24
26
  export * from './prompt';
@@ -0,0 +1,15 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về sau khi mở deep link
4
+ */
5
+ export type IVsfOpenDeeplinkData = boolean;
6
+ /**
7
+ * Tham số để mở deep link
8
+ */
9
+ export type IVsfOpenDeeplinkOptions = {
10
+ /** URL của deep link cần mở */
11
+ url: string;
12
+ };
13
+ export type IVsfOpenDeeplinkOptionsWithCallback = IVsfOptionsWithCallback<IVsfOpenDeeplinkOptions, IVsfOpenDeeplinkData>;
14
+ export type IVsfOpenDeeplink = (options: IVsfOpenDeeplinkOptionsWithCallback) => void;
15
+ export type IVsfOpenDeeplinkAsync = (options: IVsfOpenDeeplinkOptions) => Promise<IVsfOpenDeeplinkData>;
@@ -0,0 +1,17 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về sau khi mở public deep link
4
+ */
5
+ export type IVsfOpenPublicDeepLinkData = boolean;
6
+ /**
7
+ * Tham số để mở public deep link
8
+ */
9
+ export type IVsfOpenPublicDeepLinkOptions = {
10
+ /** URL của deep link cần mở */
11
+ url: string;
12
+ /** Mở trong in-app browser hay không. Mặc định là false */
13
+ inAppBrowser?: boolean;
14
+ };
15
+ export type IVsfOpenPublicDeepLinkOptionsWithCallback = IVsfOptionsWithCallback<IVsfOpenPublicDeepLinkOptions, IVsfOpenPublicDeepLinkData>;
16
+ export type IVsfOpenPublicDeepLink = (options: IVsfOpenPublicDeepLinkOptionsWithCallback) => void;
17
+ export type IVsfOpenPublicDeepLinkAsync = (options: IVsfOpenPublicDeepLinkOptions) => Promise<IVsfOpenPublicDeepLinkData>;
@@ -7,6 +7,8 @@ import { IVsfGetSetting } from './api/get-setting';
7
7
  import { IVsfOpenSetting } from './api/open-setting';
8
8
  import { IVsfOpenAppSetting } from './api/open-app-setting';
9
9
  import { IVsfOpenNativeAppStore } from './api/open-native-app-store';
10
+ import { IVsfOpenDeeplink } from './api/open-deeplink';
11
+ import { IVsfOpenPublicDeepLink } from './api/open-public-deep-link';
10
12
  import { IVsfShareApp } from './api/share-app';
11
13
  import { IVsfSetStorage } from './api/set-storage';
12
14
  import { IVsfGetStorage } from './api/get-storage';
@@ -165,6 +167,27 @@ export type IVsf = {
165
167
  * @param options.complete - `() => void` - Callback khi hoàn tất
166
168
  */
167
169
  openNativeAppStore: IVsfOpenNativeAppStore;
170
+ /**
171
+ * Mở deep link.
172
+ *
173
+ * @param options - Tham số cấu hình
174
+ * @param options.url - `string` (bắt buộc) - URL của deep link cần mở
175
+ * @param options.success - `(res: boolean) => void` - Callback khi thành công
176
+ * @param options.fail - `(error) => void` - Callback khi thất bại
177
+ * @param options.complete - `() => void` - Callback khi hoàn tất
178
+ */
179
+ openDeeplink: IVsfOpenDeeplink;
180
+ /**
181
+ * Mở public deep link.
182
+ *
183
+ * @param options - Tham số cấu hình
184
+ * @param options.url - `string` (bắt buộc) - URL của deep link cần mở
185
+ * @param options.inAppBrowser - `boolean` (tùy chọn) - Mở trong in-app browser hay không. Mặc định: `false`
186
+ * @param options.success - `(res: boolean) => void` - Callback khi thành công
187
+ * @param options.fail - `(error) => void` - Callback khi thất bại
188
+ * @param options.complete - `() => void` - Callback khi hoàn tất
189
+ */
190
+ openPublicDeepLink: IVsfOpenPublicDeepLink;
168
191
  /**
169
192
  * Chia sẻ mini app với người khác sử dụng chức năng share native.
170
193
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-miniapp/apis",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",