@v-miniapp/apis 1.0.14 → 1.0.17
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/api/index.d.ts +10 -0
- package/dist/api/index.js +68 -53
- package/dist/types/api/add-calendar-event.d.ts +23 -0
- package/dist/types/api/choose-phone-contact.d.ts +17 -0
- package/dist/types/api/confirm-before-exit.d.ts +13 -0
- package/dist/types/api/index.d.ts +5 -0
- package/dist/types/api/report-analytics.d.ts +8 -0
- package/dist/types/api/set-navigation-bar.d.ts +21 -0
- package/dist/types/api/show-payment-method.d.ts +1 -1
- package/dist/types/vsf.d.ts +67 -0
- package/dist/utils/api.d.ts +2 -0
- package/dist/utils/api.js +11 -4
- package/package.json +1 -1
package/dist/api/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { IVsfAddCalendarEventAsync } from '../types/api/add-calendar-event';
|
|
1
2
|
import { IVsfGetSystemInfoAsync } from '../types/api/get-system-info';
|
|
2
3
|
import { IVsfClearStorageAsync } from '../types/api/clear-storage';
|
|
3
4
|
import { IVsfGetClipboardAsync } from '../types/api/get-clipboard';
|
|
4
5
|
import { IVsfSetClipboardAsync } from '../types/api/set-clipboard';
|
|
6
|
+
import { IVsfSetNavigationBarAsync } from '../types/api/set-navigation-bar';
|
|
5
7
|
import { IVsfExitMiniAppAsync } from '../types/api/exit-miniapp';
|
|
6
8
|
import { IVsfGetSettingAsync } from '../types/api/get-setting';
|
|
7
9
|
import { IVsfOpenSettingAsync } from '../types/api/open-setting';
|
|
@@ -13,14 +15,17 @@ import { IVsfShareAppAsync } from '../types/api/share-app';
|
|
|
13
15
|
import { IVsfSetStorageAsync } from '../types/api/set-storage';
|
|
14
16
|
import { IVsfGetStorageAsync } from '../types/api/get-storage';
|
|
15
17
|
import { IVsfRemoveStorageAsync } from '../types/api/remove-storage';
|
|
18
|
+
import { IVsfReportAnalyticsAsync } from '../types/api/report-analytics';
|
|
16
19
|
import { IVsfGetStorageInfoAsync } from '../types/api/get-storage-info';
|
|
17
20
|
import { IVsfAlertAsync } from '../types/api/alert';
|
|
18
21
|
import { IVsfConfirmAsync } from '../types/api/confirm';
|
|
22
|
+
import { IVsfConfirmBeforeExitAsync } from '../types/api/confirm-before-exit';
|
|
19
23
|
import { IVsfPromptAsync } from '../types/api/prompt';
|
|
20
24
|
import { IVsfShowToastAsync } from '../types/api/show-toast';
|
|
21
25
|
import { IVsfShowLoadingAsync } from '../types/api/show-loading';
|
|
22
26
|
import { IVsfShowActionSheetAsync } from '../types/api/show-action-sheet';
|
|
23
27
|
import { IVsfChooseImageAsync } from '../types/api/choose-image';
|
|
28
|
+
import { IVsfChoosePhoneContactAsync } from '../types/api/choose-phone-contact';
|
|
24
29
|
import { IVsfGetImageInfoAsync } from '../types/api/get-image-info';
|
|
25
30
|
import { IVsfCompressImageAsync } from '../types/api/compress-image';
|
|
26
31
|
import { IVsfRequestAsync } from '../types/api/request';
|
|
@@ -49,11 +54,14 @@ import { IVsfHideLoadingAsync } from '../types/api';
|
|
|
49
54
|
import { IVsf } from '../types/vsf';
|
|
50
55
|
export declare const apisSync: IVsf;
|
|
51
56
|
export declare const apisAsync: {
|
|
57
|
+
addCalendarEvent: IVsfAddCalendarEventAsync;
|
|
52
58
|
getSystemInfo: IVsfGetSystemInfoAsync;
|
|
53
59
|
clearStorage: IVsfClearStorageAsync;
|
|
54
60
|
getClipboard: IVsfGetClipboardAsync;
|
|
55
61
|
setClipboard: IVsfSetClipboardAsync;
|
|
62
|
+
setNavigationBar: IVsfSetNavigationBarAsync;
|
|
56
63
|
exitMiniApp: IVsfExitMiniAppAsync;
|
|
64
|
+
confirmBeforeExit: IVsfConfirmBeforeExitAsync;
|
|
57
65
|
getSetting: IVsfGetSettingAsync;
|
|
58
66
|
openSetting: IVsfOpenSettingAsync;
|
|
59
67
|
openAppSetting: IVsfOpenAppSettingAsync;
|
|
@@ -64,6 +72,7 @@ export declare const apisAsync: {
|
|
|
64
72
|
setStorage: IVsfSetStorageAsync;
|
|
65
73
|
getStorage: IVsfGetStorageAsync;
|
|
66
74
|
removeStorage: IVsfRemoveStorageAsync;
|
|
75
|
+
reportAnalytics: IVsfReportAnalyticsAsync;
|
|
67
76
|
getStorageInfo: IVsfGetStorageInfoAsync;
|
|
68
77
|
alert: IVsfAlertAsync;
|
|
69
78
|
confirm: IVsfConfirmAsync;
|
|
@@ -73,6 +82,7 @@ export declare const apisAsync: {
|
|
|
73
82
|
hideLoading: IVsfHideLoadingAsync;
|
|
74
83
|
showActionSheet: IVsfShowActionSheetAsync;
|
|
75
84
|
chooseImage: IVsfChooseImageAsync;
|
|
85
|
+
choosePhoneContact: IVsfChoosePhoneContactAsync;
|
|
76
86
|
getImageInfo: IVsfGetImageInfoAsync;
|
|
77
87
|
compressImage: IVsfCompressImageAsync;
|
|
78
88
|
request: IVsfRequestAsync;
|
package/dist/api/index.js
CHANGED
|
@@ -1,136 +1,151 @@
|
|
|
1
|
-
import { getVsfPromiseFunction as
|
|
1
|
+
import { getVsfPromiseFunction as t, getVsfPromiseFunctionWithName as i } from "../utils/api.js";
|
|
2
2
|
const e = new Proxy({}, {
|
|
3
|
-
get(
|
|
4
|
-
return typeof window.vsf[
|
|
3
|
+
get(n, o) {
|
|
4
|
+
return typeof window.vsf[o] == "function" ? (...a) => window.vsf[o](...a) : window.vsf[o];
|
|
5
5
|
}
|
|
6
6
|
}), s = {
|
|
7
|
-
|
|
7
|
+
addCalendarEvent: t(
|
|
8
|
+
e.addCalendarEvent
|
|
9
|
+
),
|
|
10
|
+
getSystemInfo: t(
|
|
8
11
|
e.getSystemInfo
|
|
9
12
|
),
|
|
10
|
-
clearStorage:
|
|
13
|
+
clearStorage: t(
|
|
11
14
|
e.clearStorage
|
|
12
15
|
),
|
|
13
|
-
getClipboard:
|
|
16
|
+
getClipboard: t(
|
|
14
17
|
e.getClipboard
|
|
15
18
|
),
|
|
16
|
-
setClipboard:
|
|
19
|
+
setClipboard: t(
|
|
17
20
|
e.setClipboard
|
|
18
21
|
),
|
|
19
|
-
|
|
22
|
+
setNavigationBar: t(
|
|
23
|
+
e.setNavigationBar
|
|
24
|
+
),
|
|
25
|
+
exitMiniApp: t(
|
|
20
26
|
e.exitMiniApp
|
|
21
27
|
),
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
confirmBeforeExit: t(
|
|
29
|
+
e.confirmBeforeExit
|
|
30
|
+
),
|
|
31
|
+
getSetting: t(e.getSetting),
|
|
32
|
+
openSetting: t(
|
|
24
33
|
e.openSetting
|
|
25
34
|
),
|
|
26
|
-
openAppSetting:
|
|
35
|
+
openAppSetting: t(
|
|
27
36
|
e.openAppSetting
|
|
28
37
|
),
|
|
29
|
-
openNativeStore:
|
|
38
|
+
openNativeStore: t(
|
|
30
39
|
e.openNativeAppStore
|
|
31
40
|
),
|
|
32
|
-
openDeeplink:
|
|
41
|
+
openDeeplink: t(
|
|
33
42
|
e.openDeeplink
|
|
34
43
|
),
|
|
35
|
-
openPublicDeepLink:
|
|
44
|
+
openPublicDeepLink: t(
|
|
36
45
|
e.openPublicDeepLink
|
|
37
46
|
),
|
|
38
|
-
shareApp:
|
|
39
|
-
setStorage:
|
|
40
|
-
getStorage:
|
|
41
|
-
removeStorage:
|
|
47
|
+
shareApp: t(e.shareApp),
|
|
48
|
+
setStorage: t(e.setStorage),
|
|
49
|
+
getStorage: t(e.getStorage),
|
|
50
|
+
removeStorage: t(
|
|
42
51
|
e.removeStorage
|
|
43
52
|
),
|
|
44
|
-
|
|
53
|
+
reportAnalytics: i(
|
|
54
|
+
e.reportAnalytics
|
|
55
|
+
),
|
|
56
|
+
getStorageInfo: t(
|
|
45
57
|
e.getStorageInfo
|
|
46
58
|
),
|
|
47
|
-
alert:
|
|
48
|
-
confirm:
|
|
49
|
-
prompt:
|
|
50
|
-
showToast:
|
|
51
|
-
showLoading:
|
|
59
|
+
alert: t(e.alert),
|
|
60
|
+
confirm: t(e.confirm),
|
|
61
|
+
prompt: t(e.prompt),
|
|
62
|
+
showToast: t(e.showToast),
|
|
63
|
+
showLoading: t(
|
|
52
64
|
e.showLoading
|
|
53
65
|
),
|
|
54
|
-
hideLoading:
|
|
66
|
+
hideLoading: t(
|
|
55
67
|
e.hideLoading
|
|
56
68
|
),
|
|
57
|
-
showActionSheet:
|
|
69
|
+
showActionSheet: t(
|
|
58
70
|
e.showActionSheet
|
|
59
71
|
),
|
|
60
|
-
chooseImage:
|
|
72
|
+
chooseImage: t(
|
|
61
73
|
e.chooseImage
|
|
62
74
|
),
|
|
63
|
-
|
|
75
|
+
choosePhoneContact: t(
|
|
76
|
+
e.choosePhoneContact
|
|
77
|
+
),
|
|
78
|
+
getImageInfo: t(
|
|
64
79
|
e.getImageInfo
|
|
65
80
|
),
|
|
66
|
-
compressImage:
|
|
81
|
+
compressImage: t(
|
|
67
82
|
e.compressImage
|
|
68
83
|
),
|
|
69
|
-
request:
|
|
70
|
-
downloadFile:
|
|
84
|
+
request: t(e.request),
|
|
85
|
+
downloadFile: t(
|
|
71
86
|
e.downloadFile
|
|
72
87
|
),
|
|
73
|
-
uploadFile:
|
|
74
|
-
getLocation:
|
|
88
|
+
uploadFile: t(e.uploadFile),
|
|
89
|
+
getLocation: t(
|
|
75
90
|
e.getLocation
|
|
76
91
|
),
|
|
77
|
-
scan:
|
|
78
|
-
makePhoneCall:
|
|
92
|
+
scan: t(e.scan),
|
|
93
|
+
makePhoneCall: t(
|
|
79
94
|
e.makePhoneCall
|
|
80
95
|
),
|
|
81
|
-
previewImage:
|
|
96
|
+
previewImage: t(
|
|
82
97
|
e.previewImage
|
|
83
98
|
),
|
|
84
|
-
saveImage:
|
|
85
|
-
getAuthCode:
|
|
99
|
+
saveImage: t(e.saveImage),
|
|
100
|
+
getAuthCode: t(
|
|
86
101
|
e.getAuthCode
|
|
87
102
|
),
|
|
88
|
-
getUserInfo:
|
|
103
|
+
getUserInfo: t(
|
|
89
104
|
e.getUserInfo
|
|
90
105
|
),
|
|
91
|
-
initPayment:
|
|
106
|
+
initPayment: t(
|
|
92
107
|
e.initPayment
|
|
93
108
|
),
|
|
94
|
-
showPaymentMethod:
|
|
109
|
+
showPaymentMethod: t(
|
|
95
110
|
e.showPaymentMethod
|
|
96
111
|
),
|
|
97
|
-
getDefaultPaymentMethod:
|
|
112
|
+
getDefaultPaymentMethod: t(
|
|
98
113
|
e.getDefaultPaymentMethod
|
|
99
114
|
),
|
|
100
|
-
startBeaconDiscovery:
|
|
115
|
+
startBeaconDiscovery: t(
|
|
101
116
|
e.startBeaconDiscovery
|
|
102
117
|
),
|
|
103
|
-
stopBeaconDiscovery:
|
|
118
|
+
stopBeaconDiscovery: t(
|
|
104
119
|
e.stopBeaconDiscovery
|
|
105
120
|
),
|
|
106
|
-
getBeaconDiscoveryStatus:
|
|
121
|
+
getBeaconDiscoveryStatus: t(
|
|
107
122
|
e.getBeaconDiscoveryStatus
|
|
108
123
|
),
|
|
109
124
|
onBeaconDiscovery: e.onBeaconDiscovery,
|
|
110
125
|
offBeaconDiscovery: e.offBeaconDiscovery,
|
|
111
126
|
bioMetrics: {
|
|
112
|
-
localAuth:
|
|
127
|
+
localAuth: t(
|
|
113
128
|
e.bioMetrics.localAuth
|
|
114
129
|
),
|
|
115
|
-
isSupported:
|
|
130
|
+
isSupported: t(
|
|
116
131
|
e.bioMetrics.isSupported
|
|
117
132
|
),
|
|
118
|
-
keyExists:
|
|
133
|
+
keyExists: t(
|
|
119
134
|
e.bioMetrics.keyExists
|
|
120
135
|
),
|
|
121
|
-
createKey:
|
|
136
|
+
createKey: t(
|
|
122
137
|
e.bioMetrics.createKey
|
|
123
138
|
),
|
|
124
|
-
createSignature:
|
|
139
|
+
createSignature: t(
|
|
125
140
|
e.bioMetrics.createSignature
|
|
126
141
|
),
|
|
127
|
-
deleteKey:
|
|
142
|
+
deleteKey: t(
|
|
128
143
|
e.bioMetrics.deleteKey
|
|
129
144
|
)
|
|
130
145
|
}
|
|
131
|
-
},
|
|
146
|
+
}, c = e;
|
|
132
147
|
export {
|
|
133
|
-
|
|
148
|
+
c as apis,
|
|
134
149
|
s as apisAsync,
|
|
135
150
|
e as apisSync
|
|
136
151
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IVsfOptionsWithCallback } from '../common';
|
|
2
|
+
/**
|
|
3
|
+
* Tham số cho API addCalendarEvent
|
|
4
|
+
*/
|
|
5
|
+
export type IVsfAddCalendarEventOptions = {
|
|
6
|
+
/** Tiêu đề của sự kiện */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Thời gian bắt đầu (UTC), định dạng: YYYY-MM-DDTHH:mm:ss.SSSZ */
|
|
9
|
+
startDate: string;
|
|
10
|
+
/** Thời gian kết thúc (UTC), định dạng: YYYY-MM-DDTHH:mm:ss.SSSZ */
|
|
11
|
+
endDate: string;
|
|
12
|
+
/** Địa điểm tổ chức sự kiện */
|
|
13
|
+
location?: string;
|
|
14
|
+
/** Sự kiện có diễn ra cả ngày hay không */
|
|
15
|
+
allDay?: boolean;
|
|
16
|
+
/** URL liên quan đến sự kiện (chỉ hỗ trợ trên iOS) */
|
|
17
|
+
url?: string;
|
|
18
|
+
/** Ghi chú (notes trên iOS) hoặc mô tả (description trên Android) liên quan đến sự kiện */
|
|
19
|
+
notes?: string;
|
|
20
|
+
};
|
|
21
|
+
export type IVsfAddCalendarEventOptionsWithCallback = IVsfOptionsWithCallback<IVsfAddCalendarEventOptions, void>;
|
|
22
|
+
export type IVsfAddCalendarEvent = (options: IVsfAddCalendarEventOptionsWithCallback) => void;
|
|
23
|
+
export type IVsfAddCalendarEventAsync = (options: IVsfAddCalendarEventOptions) => Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IVsfOptionsWithCallback } from '../common';
|
|
2
|
+
/**
|
|
3
|
+
* Kết quả trả về khi chọn liên hệ điện thoại
|
|
4
|
+
*/
|
|
5
|
+
export type IVsfChoosePhoneContactData = {
|
|
6
|
+
/** Tên hiển thị của liên hệ */
|
|
7
|
+
full_name: string;
|
|
8
|
+
/** Số điện thoại được chọn */
|
|
9
|
+
phone_number: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Tham số cho API choosePhoneContact (không có tham số)
|
|
13
|
+
*/
|
|
14
|
+
export type IVsfChoosePhoneContactOptions = void;
|
|
15
|
+
export type IVsfChoosePhoneContactOptionsWithCallback = IVsfOptionsWithCallback<IVsfChoosePhoneContactOptions, IVsfChoosePhoneContactData>;
|
|
16
|
+
export type IVsfChoosePhoneContact = (options?: IVsfChoosePhoneContactOptionsWithCallback) => void;
|
|
17
|
+
export type IVsfChoosePhoneContactAsync = (options?: IVsfChoosePhoneContactOptions) => Promise<IVsfChoosePhoneContactData>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IVsfOptionsWithCallback } from '../common';
|
|
2
|
+
/**
|
|
3
|
+
* Params for confirmBeforeExit API
|
|
4
|
+
*/
|
|
5
|
+
export type IVsfConfirmBeforeExitOptions = {
|
|
6
|
+
/** Enable or disable exit confirmation */
|
|
7
|
+
enable: boolean;
|
|
8
|
+
/** Message to show in the confirmation popup */
|
|
9
|
+
message?: string;
|
|
10
|
+
};
|
|
11
|
+
export type IVsfConfirmBeforeExitOptionsWithCallback = IVsfOptionsWithCallback<IVsfConfirmBeforeExitOptions, void>;
|
|
12
|
+
export type IVsfConfirmBeforeExit = (options: IVsfConfirmBeforeExitOptionsWithCallback) => void;
|
|
13
|
+
export type IVsfConfirmBeforeExitAsync = (options: IVsfConfirmBeforeExitOptions) => Promise<void>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
export * from './add-calendar-event';
|
|
1
2
|
export * from './alert';
|
|
2
3
|
export * from './choose-image';
|
|
4
|
+
export * from './choose-phone-contact';
|
|
3
5
|
export * from './clear-storage';
|
|
4
6
|
export * from './compress-image';
|
|
5
7
|
export * from './confirm';
|
|
8
|
+
export * from './confirm-before-exit';
|
|
6
9
|
export * from './get-default-payment-method';
|
|
7
10
|
export * from './download-file';
|
|
8
11
|
export * from './exit-miniapp';
|
|
@@ -25,10 +28,12 @@ export * from './open-setting';
|
|
|
25
28
|
export * from './preview-image';
|
|
26
29
|
export * from './prompt';
|
|
27
30
|
export * from './remove-storage';
|
|
31
|
+
export * from './report-analytics';
|
|
28
32
|
export * from './request';
|
|
29
33
|
export * from './save-image';
|
|
30
34
|
export * from './scan';
|
|
31
35
|
export * from './set-clipboard';
|
|
36
|
+
export * from './set-navigation-bar';
|
|
32
37
|
export * from './set-storage';
|
|
33
38
|
export * from './share-app';
|
|
34
39
|
export * from './show-action-sheet';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IVsfOptionsWithCallback } from '../common';
|
|
2
|
+
/**
|
|
3
|
+
* Tham số cho API reportAnalytics (dữ liệu analytics tùy ý)
|
|
4
|
+
*/
|
|
5
|
+
export type IVsfReportAnalyticsOptions = Record<string, any>;
|
|
6
|
+
export type IVsfReportAnalyticsOptionsWithCallback = IVsfOptionsWithCallback<IVsfReportAnalyticsOptions, void>;
|
|
7
|
+
export type IVsfReportAnalytics = (name: string, options?: IVsfReportAnalyticsOptionsWithCallback) => void;
|
|
8
|
+
export type IVsfReportAnalyticsAsync = (name: string, options?: IVsfReportAnalyticsOptions) => Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IVsfOptionsWithCallback } from '../common';
|
|
2
|
+
/**
|
|
3
|
+
* Tham số cho API setNavigationBar
|
|
4
|
+
*/
|
|
5
|
+
export type IVsfSetNavigationBarOptions = {
|
|
6
|
+
/** Tiêu đề thanh điều hướng */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** URL hoặc đường dẫn ảnh cho thanh điều hướng */
|
|
9
|
+
image?: string;
|
|
10
|
+
/** Màu nền thanh tiêu đề */
|
|
11
|
+
titleBarColor?: string;
|
|
12
|
+
/** Màu viền dưới thanh điều hướng */
|
|
13
|
+
borderBottomColor?: string;
|
|
14
|
+
/** Đặt lại thanh điều hướng về mặc định hay không */
|
|
15
|
+
reset?: boolean;
|
|
16
|
+
/** Giao diện thanh điều hướng: dark hoặc light */
|
|
17
|
+
theme?: 'dark' | 'light';
|
|
18
|
+
};
|
|
19
|
+
export type IVsfSetNavigationBarOptionsWithCallback = IVsfOptionsWithCallback<IVsfSetNavigationBarOptions, void>;
|
|
20
|
+
export type IVsfSetNavigationBar = (options?: IVsfSetNavigationBarOptionsWithCallback) => void;
|
|
21
|
+
export type IVsfSetNavigationBarAsync = (options?: IVsfSetNavigationBarOptions) => Promise<void>;
|
|
@@ -25,7 +25,7 @@ export type IVsfPaymentMethod = {
|
|
|
25
25
|
/**
|
|
26
26
|
* Kết quả trả về khi người dùng chọn phương thức thanh toán (mảng các phương thức)
|
|
27
27
|
*/
|
|
28
|
-
export type IVsfShowPaymentMethodData = IVsfPaymentMethod
|
|
28
|
+
export type IVsfShowPaymentMethodData = IVsfPaymentMethod;
|
|
29
29
|
/**
|
|
30
30
|
* Tham số để hiển thị danh sách phương thức thanh toán
|
|
31
31
|
*/
|
package/dist/types/vsf.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { IVsfAddCalendarEvent } from './api/add-calendar-event';
|
|
1
2
|
import { IVsfGetSystemInfo } from './api/get-system-info';
|
|
2
3
|
import { IVsfClearStorage } from './api/clear-storage';
|
|
3
4
|
import { IVsfGetClipboard } from './api/get-clipboard';
|
|
4
5
|
import { IVsfSetClipboard } from './api/set-clipboard';
|
|
6
|
+
import { IVsfSetNavigationBar } from './api/set-navigation-bar';
|
|
5
7
|
import { IVsfExitMiniApp } from './api/exit-miniapp';
|
|
6
8
|
import { IVsfGetSetting } from './api/get-setting';
|
|
7
9
|
import { IVsfOpenSetting } from './api/open-setting';
|
|
@@ -13,14 +15,17 @@ import { IVsfShareApp } from './api/share-app';
|
|
|
13
15
|
import { IVsfSetStorage } from './api/set-storage';
|
|
14
16
|
import { IVsfGetStorage } from './api/get-storage';
|
|
15
17
|
import { IVsfRemoveStorage } from './api/remove-storage';
|
|
18
|
+
import { IVsfReportAnalytics } from './api/report-analytics';
|
|
16
19
|
import { IVsfGetStorageInfo } from './api/get-storage-info';
|
|
17
20
|
import { IVsfAlert } from './api/alert';
|
|
18
21
|
import { IVsfConfirm } from './api/confirm';
|
|
22
|
+
import { IVsfConfirmBeforeExit } from './api/confirm-before-exit';
|
|
19
23
|
import { IVsfPrompt } from './api/prompt';
|
|
20
24
|
import { IVsfShowToast } from './api/show-toast';
|
|
21
25
|
import { IVsfShowLoading } from './api/show-loading';
|
|
22
26
|
import { IVsfShowActionSheet } from './api/show-action-sheet';
|
|
23
27
|
import { IVsfChooseImage } from './api/choose-image';
|
|
28
|
+
import { IVsfChoosePhoneContact } from './api/choose-phone-contact';
|
|
24
29
|
import { IVsfGetImageInfo } from './api/get-image-info';
|
|
25
30
|
import { IVsfCompressImage } from './api/compress-image';
|
|
26
31
|
import { IVsfRequest } from './api/request';
|
|
@@ -55,6 +60,22 @@ import { IVsfHideLoading } from './api';
|
|
|
55
60
|
* Tất cả API sử dụng callback pattern với `success`, `fail`, và `complete`.
|
|
56
61
|
*/
|
|
57
62
|
export type IVsf = {
|
|
63
|
+
/**
|
|
64
|
+
* Thêm sự kiện vào lịch (calendar) của thiết bị.
|
|
65
|
+
*
|
|
66
|
+
* @param options - Tham số cấu hình
|
|
67
|
+
* @param options.title - `string` (bắt buộc) - Tiêu đề của sự kiện
|
|
68
|
+
* @param options.startDate - `string` (bắt buộc) - Thời gian bắt đầu (UTC), định dạng: YYYY-MM-DDTHH:mm:ss.SSSZ
|
|
69
|
+
* @param options.endDate - `string` (bắt buộc) - Thời gian kết thúc (UTC), định dạng: YYYY-MM-DDTHH:mm:ss.SSSZ
|
|
70
|
+
* @param options.location - `string` (tùy chọn) - Địa điểm tổ chức sự kiện
|
|
71
|
+
* @param options.allDay - `boolean` (tùy chọn) - Sự kiện có diễn ra cả ngày hay không
|
|
72
|
+
* @param options.url - `string` (tùy chọn) - URL liên quan đến sự kiện (chỉ hỗ trợ trên iOS)
|
|
73
|
+
* @param options.notes - `string` (tùy chọn) - Ghi chú (notes trên iOS) hoặc mô tả (description trên Android) liên quan đến sự kiện
|
|
74
|
+
* @param options.success - `() => void` - Callback khi thành công
|
|
75
|
+
* @param options.fail - `(error) => void` - Callback khi thất bại
|
|
76
|
+
* @param options.complete - `() => void` - Callback khi hoàn tất
|
|
77
|
+
*/
|
|
78
|
+
addCalendarEvent: IVsfAddCalendarEvent;
|
|
58
79
|
/**
|
|
59
80
|
* Lấy thông tin hệ thống và thiết bị.
|
|
60
81
|
*
|
|
@@ -109,6 +130,21 @@ export type IVsf = {
|
|
|
109
130
|
* @param options.complete - `() => void` - Callback khi hoàn tất
|
|
110
131
|
*/
|
|
111
132
|
setClipboard: IVsfSetClipboard;
|
|
133
|
+
/**
|
|
134
|
+
* Cấu hình thanh điều hướng (navigation bar).
|
|
135
|
+
*
|
|
136
|
+
* @param options - Tham số cấu hình
|
|
137
|
+
* @param options.title - `string` (tùy chọn) - Tiêu đề thanh điều hướng
|
|
138
|
+
* @param options.image - `string` (tùy chọn) - URL hoặc đường dẫn ảnh cho thanh điều hướng
|
|
139
|
+
* @param options.titleBarColor - `string` (tùy chọn) - Màu nền thanh tiêu đề
|
|
140
|
+
* @param options.borderBottomColor - `string` (tùy chọn) - Màu viền dưới thanh điều hướng
|
|
141
|
+
* @param options.reset - `boolean` (tùy chọn) - Đặt lại thanh điều hướng về mặc định
|
|
142
|
+
* @param options.theme - `'dark' | 'light'` (tùy chọn) - Giao diện: dark hoặc light
|
|
143
|
+
* @param options.success - `() => void` - Callback khi thành công
|
|
144
|
+
* @param options.fail - `(error) => void` - Callback khi thất bại
|
|
145
|
+
* @param options.complete - `() => void` - Callback khi hoàn tất
|
|
146
|
+
*/
|
|
147
|
+
setNavigationBar: IVsfSetNavigationBar;
|
|
112
148
|
/**
|
|
113
149
|
* Thoát mini app hiện tại và quay về host app.
|
|
114
150
|
*
|
|
@@ -118,6 +154,17 @@ export type IVsf = {
|
|
|
118
154
|
* @param options.complete - `() => void` - Callback khi hoàn tất
|
|
119
155
|
*/
|
|
120
156
|
exitMiniApp: IVsfExitMiniApp;
|
|
157
|
+
/**
|
|
158
|
+
* Bật hoặc tắt xác nhận trước khi thoát mini app.
|
|
159
|
+
*
|
|
160
|
+
* @param options - Tham số cấu hình
|
|
161
|
+
* @param options.enable - `boolean` (bắt buộc) - Kích hoạt hay không việc xác nhận trước khi thoát
|
|
162
|
+
* @param options.message - `string` (tùy chọn) - Nội dung hiển thị trong popup xác nhận
|
|
163
|
+
* @param options.success - `() => void` - Callback khi thành công
|
|
164
|
+
* @param options.fail - `(error) => void` - Callback khi thất bại
|
|
165
|
+
* @param options.complete - `() => void` - Callback khi hoàn tất
|
|
166
|
+
*/
|
|
167
|
+
confirmBeforeExit: IVsfConfirmBeforeExit;
|
|
121
168
|
/**
|
|
122
169
|
* Lấy cài đặt quyền hiện tại của mini app.
|
|
123
170
|
*
|
|
@@ -233,6 +280,15 @@ export type IVsf = {
|
|
|
233
280
|
* @param options.complete - `() => void` - Callback khi hoàn tất
|
|
234
281
|
*/
|
|
235
282
|
removeStorage: IVsfRemoveStorage;
|
|
283
|
+
/**
|
|
284
|
+
* Gửi dữ liệu analytics (báo cáo sự kiện/tùy chỉnh).
|
|
285
|
+
*
|
|
286
|
+
* @param options - Tham số: object key-value tùy ý (Record<string, any>)
|
|
287
|
+
* @param options.success - `() => void` - Callback khi thành công
|
|
288
|
+
* @param options.fail - `(error) => void` - Callback khi thất bại
|
|
289
|
+
* @param options.complete - `() => void` - Callback khi hoàn tất
|
|
290
|
+
*/
|
|
291
|
+
reportAnalytics: IVsfReportAnalytics;
|
|
236
292
|
/**
|
|
237
293
|
* Lấy thông tin về dung lượng local storage đang sử dụng.
|
|
238
294
|
*
|
|
@@ -337,6 +393,17 @@ export type IVsf = {
|
|
|
337
393
|
* @param options.complete - `() => void` - Callback khi hoàn tất (dù thành công hay thất bại)
|
|
338
394
|
*/
|
|
339
395
|
chooseImage: IVsfChooseImage;
|
|
396
|
+
/**
|
|
397
|
+
* Mở danh bạ để người dùng chọn một liên hệ điện thoại.
|
|
398
|
+
*
|
|
399
|
+
* @param options - Tham số cấu hình (không có tham số)
|
|
400
|
+
* @param options.success - `(res) => void` - Callback khi thành công
|
|
401
|
+
* - `res.full_name`: `string` - Tên hiển thị của liên hệ
|
|
402
|
+
* - `res.phone_number`: `string` - Số điện thoại được chọn
|
|
403
|
+
* @param options.fail - `(error) => void` - Callback khi thất bại/hủy
|
|
404
|
+
* @param options.complete - `() => void` - Callback khi hoàn tất
|
|
405
|
+
*/
|
|
406
|
+
choosePhoneContact: IVsfChoosePhoneContact;
|
|
340
407
|
/**
|
|
341
408
|
* Lấy thông tin của file ảnh.
|
|
342
409
|
*
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IVsfOptionsWithCallback } from '../types/common';
|
|
2
2
|
type IVsfFunction = (options: IVsfOptionsWithCallback<any>) => void;
|
|
3
3
|
export declare const getVsfPromiseFunction: <IVsfFunctionSync>(func: IVsfFunction) => IVsfFunctionSync;
|
|
4
|
+
type IVsfFunctionWithName = (name: string, options: IVsfOptionsWithCallback<any>) => void;
|
|
5
|
+
export declare const getVsfPromiseFunctionWithName: <IVsfFunctionSync>(func: IVsfFunctionWithName) => IVsfFunctionSync;
|
|
4
6
|
export {};
|
package/dist/utils/api.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
const
|
|
1
|
+
const i = (e) => ((s) => new Promise((r, n) => {
|
|
2
2
|
e({
|
|
3
|
-
...
|
|
3
|
+
...s,
|
|
4
4
|
fail: n,
|
|
5
|
-
success:
|
|
5
|
+
success: r
|
|
6
|
+
});
|
|
7
|
+
})), o = (e) => ((s, r) => new Promise((n, t) => {
|
|
8
|
+
e(s, {
|
|
9
|
+
...r,
|
|
10
|
+
fail: t,
|
|
11
|
+
success: n
|
|
6
12
|
});
|
|
7
13
|
}));
|
|
8
14
|
export {
|
|
9
|
-
|
|
15
|
+
i as getVsfPromiseFunction,
|
|
16
|
+
o as getVsfPromiseFunctionWithName
|
|
10
17
|
};
|