@v-miniapp/apis 1.0.11

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.
Files changed (64) hide show
  1. package/README.md +60 -0
  2. package/dist/api/index.d.ts +101 -0
  3. package/dist/api/index.js +130 -0
  4. package/dist/async.d.ts +2 -0
  5. package/dist/async.js +4 -0
  6. package/dist/global.d.ts +7 -0
  7. package/dist/index.d.ts +5 -0
  8. package/dist/index.js +8 -0
  9. package/dist/types/api/alert.d.ts +15 -0
  10. package/dist/types/api/bio-metrics/create-key.d.ts +15 -0
  11. package/dist/types/api/bio-metrics/create-signature.d.ts +20 -0
  12. package/dist/types/api/bio-metrics/delete-key.d.ts +12 -0
  13. package/dist/types/api/bio-metrics/index.d.ts +6 -0
  14. package/dist/types/api/bio-metrics/is-supported.d.ts +19 -0
  15. package/dist/types/api/bio-metrics/key-exists.d.ts +12 -0
  16. package/dist/types/api/bio-metrics/local-auth.d.ts +15 -0
  17. package/dist/types/api/choose-image.d.ts +42 -0
  18. package/dist/types/api/clear-storage.d.ts +8 -0
  19. package/dist/types/api/cloud/upload-file.d.ts +19 -0
  20. package/dist/types/api/compress-image.d.ts +29 -0
  21. package/dist/types/api/confirm.d.ts +24 -0
  22. package/dist/types/api/download-file.d.ts +20 -0
  23. package/dist/types/api/exit-miniapp.d.ts +8 -0
  24. package/dist/types/api/get-auth-code.d.ts +26 -0
  25. package/dist/types/api/get-beacon-discovery-status.d.ts +13 -0
  26. package/dist/types/api/get-clipboard.d.ts +15 -0
  27. package/dist/types/api/get-default-payment-method.d.ts +16 -0
  28. package/dist/types/api/get-image-info.d.ts +30 -0
  29. package/dist/types/api/get-location.d.ts +32 -0
  30. package/dist/types/api/get-setting.d.ts +15 -0
  31. package/dist/types/api/get-storage-info.d.ts +19 -0
  32. package/dist/types/api/get-storage.d.ts +19 -0
  33. package/dist/types/api/get-system-info.d.ts +52 -0
  34. package/dist/types/api/get-user-info.d.ts +21 -0
  35. package/dist/types/api/hide-loading.d.ts +8 -0
  36. package/dist/types/api/index.d.ts +43 -0
  37. package/dist/types/api/init-payment.d.ts +88 -0
  38. package/dist/types/api/make-phone-call.d.ts +11 -0
  39. package/dist/types/api/off-beacon-discovery.d.ts +2 -0
  40. package/dist/types/api/on-beacon-discovery.d.ts +15 -0
  41. package/dist/types/api/open-app-setting.d.ts +8 -0
  42. package/dist/types/api/open-native-app-store.d.ts +20 -0
  43. package/dist/types/api/open-setting.d.ts +15 -0
  44. package/dist/types/api/preview-image.d.ts +17 -0
  45. package/dist/types/api/prompt.d.ts +31 -0
  46. package/dist/types/api/remove-storage.d.ts +11 -0
  47. package/dist/types/api/request.d.ts +29 -0
  48. package/dist/types/api/save-image.d.ts +11 -0
  49. package/dist/types/api/scan.d.ts +14 -0
  50. package/dist/types/api/set-clipboard.d.ts +11 -0
  51. package/dist/types/api/set-storage.d.ts +17 -0
  52. package/dist/types/api/share-app.d.ts +18 -0
  53. package/dist/types/api/show-action-sheet.d.ts +22 -0
  54. package/dist/types/api/show-loading.d.ts +11 -0
  55. package/dist/types/api/show-payment-method.d.ts +40 -0
  56. package/dist/types/api/show-toast.d.ts +21 -0
  57. package/dist/types/api/start-beacon-discovery.d.ts +11 -0
  58. package/dist/types/api/stop-beacon-discovery.d.ts +8 -0
  59. package/dist/types/api/upload-file.d.ts +29 -0
  60. package/dist/types/common.d.ts +12 -0
  61. package/dist/types/vsf.d.ts +664 -0
  62. package/dist/utils/api.d.ts +4 -0
  63. package/dist/utils/api.js +10 -0
  64. package/package.json +45 -0
@@ -0,0 +1,15 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về khi lấy nội dung từ clipboard
4
+ */
5
+ export type IVsfGetClipboardData = {
6
+ /** Nội dung text trong clipboard */
7
+ text: string;
8
+ };
9
+ /**
10
+ * Tham số để lấy nội dung từ clipboard
11
+ */
12
+ export type IVsfGetClipboardOptions = void;
13
+ export type IVsfGetClipboardOptionsWithCallback = IVsfOptionsWithCallback<IVsfGetClipboardOptions, IVsfGetClipboardData>;
14
+ export type IVsfGetClipboard = (options: IVsfGetClipboardOptionsWithCallback) => void;
15
+ export type IVsfGetClipboardAsync = (options: IVsfGetClipboardOptions) => Promise<IVsfGetClipboardData>;
@@ -0,0 +1,16 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ import { IVsfPaymentMethod } from './show-payment-method';
3
+ /**
4
+ * Kết quả trả về phương thức thanh toán mặc định
5
+ */
6
+ export type IVsfGetDefaultPaymentMethodData = IVsfPaymentMethod;
7
+ /**
8
+ * Tham số để lấy phương thức thanh toán mặc định
9
+ */
10
+ export type IVsfGetDefaultPaymentMethodOptions = {
11
+ /** API key thanh toán */
12
+ paymentApiKey: string;
13
+ };
14
+ export type IVsfGetDefaultPaymentMethodOptionsWithCallback = IVsfOptionsWithCallback<IVsfGetDefaultPaymentMethodOptions, IVsfGetDefaultPaymentMethodData>;
15
+ export type IVsfGetDefaultPaymentMethod = (options: IVsfGetDefaultPaymentMethodOptionsWithCallback) => void;
16
+ export type IVsfGetDefaultPaymentMethodAsync = (options: IVsfGetDefaultPaymentMethodOptions) => Promise<IVsfGetDefaultPaymentMethodData>;
@@ -0,0 +1,30 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Hướng xoay của ảnh
4
+ */
5
+ export type IVsfGetImageInfoOrientation = 'up' | 'down' | 'left' | 'right' | 'up-mirrored' | 'down-mirrored' | 'left-mirrored' | 'right-mirrored';
6
+ /**
7
+ * Kết quả trả về thông tin ảnh
8
+ */
9
+ export type IVsfGetImageInfoData = {
10
+ /** Chiều rộng ảnh (pixel) */
11
+ width: number;
12
+ /** Chiều cao ảnh (pixel) */
13
+ height: number;
14
+ /** Hướng xoay của ảnh */
15
+ orientation: IVsfGetImageInfoOrientation;
16
+ /** Đường dẫn ảnh */
17
+ path: string;
18
+ /** Loại ảnh (mime type) */
19
+ type: string;
20
+ };
21
+ /**
22
+ * Tham số để lấy thông tin ảnh
23
+ */
24
+ export type IVsfGetImageInfoOptions = {
25
+ /** Đường dẫn hoặc URL của ảnh */
26
+ src: string;
27
+ };
28
+ export type IVsfGetImageInfoOptionsWithCallback = IVsfOptionsWithCallback<IVsfGetImageInfoOptions, IVsfGetImageInfoData>;
29
+ export type IVsfGetImageInfo = (options: IVsfGetImageInfoOptionsWithCallback) => void;
30
+ export type IVsfGetImageInfoAsync = (options: IVsfGetImageInfoOptions) => Promise<IVsfGetImageInfoData>;
@@ -0,0 +1,32 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về thông tin vị trí
4
+ */
5
+ export type IVsfGetLocationData = {
6
+ /** Vĩ độ */
7
+ latitude: number;
8
+ /** Kinh độ */
9
+ longitude: number;
10
+ /** Độ cao (mét) */
11
+ altitude: number;
12
+ /** Độ chính xác của vị trí (mét) */
13
+ accuracy: number;
14
+ /** Độ chính xác của độ cao (mét) */
15
+ altitudeAccuracy: number;
16
+ /** Hướng di chuyển (độ) */
17
+ heading: number;
18
+ /** Tốc độ di chuyển (m/s) */
19
+ speed: number;
20
+ };
21
+ /**
22
+ * Tham số để lấy thông tin vị trí
23
+ */
24
+ export type IVsfGetLocationOptions = {
25
+ /** Thời gian cache vị trí (giây), mặc định 30 giây */
26
+ cacheTimeout?: number;
27
+ /** Loại vị trí cần lấy, giá trị 1 nếu muốn độ chính xác cao */
28
+ type?: number;
29
+ };
30
+ export type IVsfGetLocationOptionsWithCallback = IVsfOptionsWithCallback<IVsfGetLocationOptions, IVsfGetLocationData>;
31
+ export type IVsfGetLocation = (options?: IVsfGetLocationOptionsWithCallback) => void;
32
+ export type IVsfGetLocationAsync = (options?: IVsfGetLocationOptions) => Promise<IVsfGetLocationData>;
@@ -0,0 +1,15 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về cài đặt quyền
4
+ */
5
+ export type IVsfGetSettingData = {
6
+ /** Trạng thái các quyền đã được cấp */
7
+ authSetting: Record<string, boolean>;
8
+ };
9
+ /**
10
+ * Tham số để lấy cài đặt quyền
11
+ */
12
+ export type IVsfGetSettingOptions = void;
13
+ export type IVsfGetSettingOptionsWithCallback = IVsfOptionsWithCallback<IVsfGetSettingOptions, IVsfGetSettingData>;
14
+ export type IVsfGetSetting = (options: IVsfGetSettingOptionsWithCallback) => void;
15
+ export type IVsfGetSettingAsync = (options: IVsfGetSettingOptions) => Promise<IVsfGetSettingData>;
@@ -0,0 +1,19 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về thông tin storage
4
+ */
5
+ export type IVsfGetStorageInfoData = {
6
+ /** Danh sách các key đang được lưu trong storage */
7
+ keys: Array<string>;
8
+ /** Dung lượng hiện tại đang sử dụng (bytes) */
9
+ currentSize: number;
10
+ /** Dung lượng tối đa có thể sử dụng (bytes) */
11
+ limitSize: number;
12
+ };
13
+ /**
14
+ * Tham số để lấy thông tin storage
15
+ */
16
+ export type IVsfGetStorageInfoOptions = void;
17
+ export type IVsfGetStorageInfoOptionsWithCallback = IVsfOptionsWithCallback<IVsfGetStorageInfoOptions, IVsfGetStorageInfoData>;
18
+ export type IVsfGetStorageInfo = (options: IVsfGetStorageInfoOptionsWithCallback) => void;
19
+ export type IVsfGetStorageInfoAsync = (options: IVsfGetStorageInfoOptions) => Promise<IVsfGetStorageInfoData>;
@@ -0,0 +1,19 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ import { IVsfStorageData } from './set-storage';
3
+ /**
4
+ * Kết quả trả về khi lấy dữ liệu từ storage
5
+ */
6
+ export type IVsfGetStorageData = {
7
+ /** Dữ liệu được lưu trữ */
8
+ data: IVsfStorageData;
9
+ };
10
+ /**
11
+ * Tham số để lấy dữ liệu từ storage
12
+ */
13
+ export type IVsfGetStorageOptions = {
14
+ /** Key của dữ liệu cần lấy */
15
+ key: string;
16
+ };
17
+ export type IVsfGetStorageOptionsWithCallback = IVsfOptionsWithCallback<IVsfGetStorageOptions, IVsfGetStorageData>;
18
+ export type IVsfGetStorage = (options: IVsfGetStorageOptionsWithCallback) => void;
19
+ export type IVsfGetStorageAsync = (options: IVsfGetStorageOptions) => Promise<IVsfGetStorageData>;
@@ -0,0 +1,52 @@
1
+ import { IVsfLocale, IVsfOptionsWithCallback, IVsfPlatform, IVsfSystem } from '../common';
2
+ /**
3
+ * Kết quả trả về thông tin hệ thống
4
+ */
5
+ export type IVsfGetSystemInfoData = {
6
+ /** Tên ứng dụng */
7
+ app: string;
8
+ /** Thương hiệu thiết bị */
9
+ brand: string;
10
+ /** Mức pin hiện tại, có giá trị từ 0 - 1 */
11
+ currentBattery: number;
12
+ /** Model thiết bị */
13
+ model: string;
14
+ /** Nền tảng (iOS/Android) */
15
+ platform: IVsfPlatform;
16
+ /** Thông tin hệ điều hành */
17
+ system: IVsfSystem;
18
+ /** Phiên bản ứng dụng */
19
+ version: string;
20
+ /** Phiên bản host app */
21
+ hostVersion: string;
22
+ /** Phiên bản runtime */
23
+ runtimeVersion: string;
24
+ /** Dung lượng trống còn lại (bytes) */
25
+ freeStorage: number;
26
+ /** Chiều rộng màn hình (pixel) */
27
+ screenWidth: number;
28
+ /** Chiều cao màn hình (pixel) */
29
+ screenHeight: number;
30
+ /** Chiều rộng cửa sổ (pixel) */
31
+ windowWidth: number;
32
+ /** Chiều cao cửa sổ (pixel) */
33
+ windowHeight: number;
34
+ /** Chiều cao title bar (pixel) */
35
+ titleBarHeight: number;
36
+ /** Chiều cao status bar (pixel) */
37
+ statusBarHeight: number;
38
+ /** Ngôn ngữ hiện tại */
39
+ locale: IVsfLocale;
40
+ /** ID thiết bị */
41
+ deviceId: string;
42
+ };
43
+ /**
44
+ * Tham số để lấy thông tin hệ thống
45
+ */
46
+ export type IVsfGetSystemInfoOptions = {
47
+ /** Danh sách các key thông tin cần lấy. Nếu không truyền sẽ lấy tất cả */
48
+ keys?: Array<keyof IVsfGetSystemInfoData>;
49
+ };
50
+ export type IVsfGetSystemInfoOptionsWithCallback = IVsfOptionsWithCallback<IVsfGetSystemInfoOptions, IVsfGetSystemInfoData>;
51
+ export type IVsfGetSystemInfo = (options?: IVsfGetSystemInfoOptionsWithCallback) => void;
52
+ export type IVsfGetSystemInfoAsync = (options?: IVsfGetSystemInfoOptions) => Promise<IVsfGetSystemInfoData>;
@@ -0,0 +1,21 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về thông tin người dùng
4
+ */
5
+ export type IVsfGetUserInfoData = {
6
+ /** URL ảnh đại diện */
7
+ avatar?: string;
8
+ /** Tên người dùng */
9
+ name: string;
10
+ /** Giới tính */
11
+ gender?: string;
12
+ /** Ngày sinh */
13
+ dateOfBirth?: string;
14
+ };
15
+ /**
16
+ * Tham số để lấy thông tin người dùng
17
+ */
18
+ export type IVsfGetUserInfoOptions = void;
19
+ export type IVsfGetUserInfoOptionsWithCallback = IVsfOptionsWithCallback<IVsfGetUserInfoOptions, IVsfGetUserInfoData>;
20
+ export type IVsfGetUserInfo = (options: IVsfGetUserInfoOptionsWithCallback) => void;
21
+ export type IVsfGetUserInfoAsync = (options: IVsfGetUserInfoOptions) => Promise<IVsfGetUserInfoData>;
@@ -0,0 +1,8 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Tham số để ẩn loading
4
+ */
5
+ export type IVsfHideLoadingOptions = void;
6
+ export type IVsfHideLoadingOptionsWithCallback = IVsfOptionsWithCallback<IVsfHideLoadingOptions, void>;
7
+ export type IVsfHideLoading = (options: IVsfHideLoadingOptionsWithCallback) => void;
8
+ export type IVsfHideLoadingAsync = (options: IVsfHideLoadingOptions) => Promise<void>;
@@ -0,0 +1,43 @@
1
+ export * from './alert';
2
+ export * from './choose-image';
3
+ export * from './clear-storage';
4
+ export * from './compress-image';
5
+ export * from './confirm';
6
+ export * from './get-default-payment-method';
7
+ export * from './download-file';
8
+ export * from './exit-miniapp';
9
+ export * from './get-auth-code';
10
+ export * from './get-clipboard';
11
+ export * from './get-image-info';
12
+ export * from './get-location';
13
+ export * from './get-setting';
14
+ export * from './get-storage-info';
15
+ export * from './get-storage';
16
+ export * from './get-system-info';
17
+ export * from './get-user-info';
18
+ export * from './init-payment';
19
+ export * from './make-phone-call';
20
+ export * from './open-app-setting';
21
+ export * from './open-native-app-store';
22
+ export * from './open-setting';
23
+ export * from './preview-image';
24
+ export * from './prompt';
25
+ export * from './remove-storage';
26
+ export * from './request';
27
+ export * from './save-image';
28
+ export * from './scan';
29
+ export * from './set-clipboard';
30
+ export * from './set-storage';
31
+ export * from './share-app';
32
+ export * from './show-action-sheet';
33
+ export * from './show-loading';
34
+ export * from './hide-loading';
35
+ export * from './show-payment-method';
36
+ export * from './show-toast';
37
+ export * from './upload-file';
38
+ export * from './on-beacon-discovery';
39
+ export * from './start-beacon-discovery';
40
+ export * from './stop-beacon-discovery';
41
+ export * from './off-beacon-discovery';
42
+ export * from './get-beacon-discovery-status';
43
+ export * from './bio-metrics';
@@ -0,0 +1,88 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Thông tin một sản phẩm trong đơn hàng
4
+ */
5
+ export type IVsfOrderInfoItem = {
6
+ /** Tên sản phẩm */
7
+ name: string;
8
+ /** Mã SKU sản phẩm */
9
+ sku: string;
10
+ /** Số lượng */
11
+ quantity: number;
12
+ /** Mô tả sản phẩm */
13
+ description: string;
14
+ /** Đơn giá */
15
+ unitPrice: number;
16
+ };
17
+ /**
18
+ * Thông tin khách hàng và đơn hàng
19
+ */
20
+ export type IVsfCustomerOrderInfo = {
21
+ /** Tên khách hàng */
22
+ customerName?: string;
23
+ /** Email khách hàng */
24
+ customerEmail?: string;
25
+ /** Số điện thoại khách hàng */
26
+ customerPhone?: string;
27
+ /** Thời gian tạo đơn hàng (timestamp) */
28
+ orderCreatedAt: number;
29
+ /** Ghi chú đơn hàng */
30
+ notes?: string;
31
+ /** Danh sách sản phẩm */
32
+ items?: Array<IVsfOrderInfoItem>;
33
+ };
34
+ /**
35
+ * Thông tin đơn hàng thanh toán
36
+ */
37
+ export type IVsfOrderInfo = {
38
+ /** Tổng số tiền */
39
+ amount: number;
40
+ /** Loại tiền tệ */
41
+ currency: string;
42
+ /** Mô tả đơn hàng */
43
+ description: string;
44
+ /** ID đơn hàng */
45
+ orderId: string;
46
+ /** ID tham chiếu */
47
+ referenceId: string;
48
+ /** Thông tin chi tiết đơn hàng */
49
+ orderInfo: IVsfCustomerOrderInfo;
50
+ /** Mã bảo mật */
51
+ secureHash: string;
52
+ /** Mã phương thức thanh toán */
53
+ paymentMethodCode?: string;
54
+ /** ID nhà cung cấp */
55
+ providerId?: string;
56
+ /** ID phương thức thanh toán của người dùng */
57
+ userPaymentMethodId?: string;
58
+ /** ID phương thức thanh toán */
59
+ paymentMethodId?: string;
60
+ /** Loại thanh toán: 2D hoặc 3D */
61
+ paymentType?: '2D' | '3D';
62
+ /** ID đơn vị kinh doanh */
63
+ businessUnitId?: string;
64
+ /** ID chi nhánh */
65
+ branchId?: string;
66
+ /** Mã nền tảng */
67
+ platformCode?: string;
68
+ /** URL trả về sau thanh toán */
69
+ returnURL?: string;
70
+ /** Dữ liệu từ nhà cung cấp */
71
+ providerData?: string;
72
+ };
73
+ /**
74
+ * Kết quả trả về sau khi khởi tạo thanh toán
75
+ */
76
+ export type IVsfInitPaymentData = string;
77
+ /**
78
+ * Tham số để khởi tạo thanh toán
79
+ */
80
+ export type IVsfInitPaymentOptions = {
81
+ /** API key thanh toán */
82
+ paymentApiKey: string;
83
+ /** Thông tin đơn hàng */
84
+ orderInfo: IVsfOrderInfo;
85
+ };
86
+ export type IVsfInitPaymentOptionsWithCallback = IVsfOptionsWithCallback<IVsfInitPaymentOptions, IVsfInitPaymentData>;
87
+ export type IVsfInitPayment = (options: IVsfInitPaymentOptionsWithCallback) => void;
88
+ export type IVsfInitPaymentAsync = (options: IVsfInitPaymentOptions) => Promise<IVsfInitPaymentData>;
@@ -0,0 +1,11 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Tham số để thực hiện cuộc gọi điện thoại
4
+ */
5
+ export type IVsfMakePhoneCallOptions = {
6
+ /** Số điện thoại cần gọi */
7
+ number: string;
8
+ };
9
+ export type IVsfMakePhoneCallOptionsWithCallback = IVsfOptionsWithCallback<IVsfMakePhoneCallOptions, void>;
10
+ export type IVsfMakePhoneCall = (options: IVsfMakePhoneCallOptionsWithCallback) => void;
11
+ export type IVsfMakePhoneCallAsync = (options: IVsfMakePhoneCallOptions) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { IVsfOnBeaconBiscoveryCallback } from './on-beacon-discovery';
2
+ export type IVsfOffBeaconDiscovery = (callback: IVsfOnBeaconBiscoveryCallback) => void;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Thông tin của beacon được tìm thấy
3
+ */
4
+ export type IVsfBeaconInfo = {
5
+ /** Loại beacon: iBeacon hoặc Eddystone */
6
+ type: 'iBeacon' | 'Eddystone' | ({} & string);
7
+ /** Dữ liệu của beacon (BeaconData) */
8
+ data: any;
9
+ };
10
+ /**
11
+ * Callback được gọi mỗi khi tìm được beacon
12
+ * Listener để lắng nghe mỗi khi tìm được beacon. Cũng được dùng để định danh khi gọi apis.offBeaconDiscovery
13
+ */
14
+ export type IVsfOnBeaconBiscoveryCallback = (data: IVsfBeaconInfo) => void;
15
+ export type IVsfOnBeaconBiscovery = (callback: IVsfOnBeaconBiscoveryCallback) => void;
@@ -0,0 +1,8 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Tham số để mở trang cài đặt của ứng dụng trên hệ thống
4
+ */
5
+ export type IVsfOpenAppSettingOptions = void;
6
+ export type IVsfOpenAppSettingOptionsWithCallback = IVsfOptionsWithCallback<IVsfOpenAppSettingOptions, void>;
7
+ export type IVsfOpenAppSetting = (options: IVsfOpenAppSettingOptionsWithCallback) => void;
8
+ export type IVsfOpenAppSettingAsync = (options: IVsfOpenAppSettingOptions) => Promise<void>;
@@ -0,0 +1,20 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Tham số để mở cửa hàng ứng dụng native (App Store/Google Play)
4
+ */
5
+ export type IVsfOpenNativeAppStoreOptions = {
6
+ /**
7
+ * ID ứng dụng trên Apple App Store
8
+ */
9
+ appleStoreId: string;
10
+ /**
11
+ * ID ứng dụng trên Google Play Store
12
+ */
13
+ googlePlayId: string;
14
+ };
15
+ /**
16
+ * Tham số mở cửa hàng ứng dụng native với callback
17
+ */
18
+ export type IVsfOpenNativeAppStoreOptionsWithCallback = IVsfOptionsWithCallback<IVsfOpenNativeAppStoreOptions, boolean>;
19
+ export type IVsfOpenNativeAppStore = (options: IVsfOpenNativeAppStoreOptionsWithCallback) => void;
20
+ export type IVsfOpenNativeAppStoreAsync = (options: IVsfOpenNativeAppStoreOptions) => Promise<boolean>;
@@ -0,0 +1,15 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về sau khi mở cài đặt quyền
4
+ */
5
+ export type IVsfOpenSettingData = {
6
+ /** Trạng thái các quyền sau khi người dùng thay đổi */
7
+ authSetting: Record<string, boolean>;
8
+ };
9
+ /**
10
+ * Tham số để mở trang cài đặt quyền của miniapp
11
+ */
12
+ export type IVsfOpenSettingOptions = void;
13
+ export type IVsfOpenSettingOptionsWithCallback = IVsfOptionsWithCallback<IVsfOpenSettingOptions, IVsfOpenSettingData>;
14
+ export type IVsfOpenSetting = (options: IVsfOpenSettingOptionsWithCallback) => void;
15
+ export type IVsfOpenSettingAsync = (options: IVsfOpenSettingOptions) => Promise<IVsfOpenSettingData>;
@@ -0,0 +1,17 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Tham số để xem trước ảnh
4
+ */
5
+ export type IVsfPreviewImageOptions = {
6
+ /** Danh sách URL các ảnh cần xem */
7
+ urls: Array<string>;
8
+ /** Vị trí ảnh hiện tại (0-indexed) */
9
+ current?: number;
10
+ /** Cho phép lưu ảnh */
11
+ enablesavephoto?: boolean;
12
+ /** Hiển thị nút tải ảnh */
13
+ enableShowPhotoDownload?: boolean;
14
+ };
15
+ export type IVsfPreviewImageOptionsWithCallback = IVsfOptionsWithCallback<IVsfPreviewImageOptions, void>;
16
+ export type IVsfPreviewImage = (options: IVsfPreviewImageOptionsWithCallback) => void;
17
+ export type IVsfPreviewImageAsync = (options: IVsfPreviewImageOptions) => Promise<void>;
@@ -0,0 +1,31 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về khi người dùng tương tác với hộp thoại prompt
4
+ */
5
+ export type IVsfPromptData = {
6
+ /** true nếu người dùng bấm OK, false nếu bấm Cancel */
7
+ ok: false;
8
+ } | {
9
+ /** true nếu người dùng bấm OK, false nếu bấm Cancel */
10
+ ok: true;
11
+ /** Giá trị người dùng đã nhập */
12
+ inputValue: string;
13
+ };
14
+ /**
15
+ * Tham số để hiển thị hộp thoại prompt
16
+ */
17
+ export type IVsfPromptOptions = {
18
+ /** Tiêu đề của hộp thoại */
19
+ title?: string;
20
+ /** Thông điệp hiển thị */
21
+ message?: string;
22
+ /** Placeholder cho ô nhập liệu */
23
+ placeholder?: string;
24
+ /** Text hiển thị trên nút OK */
25
+ okButtonText?: string;
26
+ /** Text hiển thị trên nút Cancel */
27
+ cancelButtonText?: string;
28
+ };
29
+ export type IVsfPromptOptionsWithCallback = IVsfOptionsWithCallback<IVsfPromptOptions, IVsfPromptData>;
30
+ export type IVsfPrompt = (options?: IVsfPromptOptionsWithCallback) => void;
31
+ export type IVsfPromptAsync = (options?: IVsfPromptOptions) => Promise<IVsfPromptData>;
@@ -0,0 +1,11 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Tham số để xóa dữ liệu từ storage
4
+ */
5
+ export type IVsfRemoveStorageOptions = {
6
+ /** Key của dữ liệu cần xóa */
7
+ key: string;
8
+ };
9
+ export type IVsfRemoveStorageOptionsWithCallback = IVsfOptionsWithCallback<IVsfRemoveStorageOptions, void>;
10
+ export type IVsfRemoveStorage = (options: IVsfRemoveStorageOptionsWithCallback) => void;
11
+ export type IVsfRemoveStorageAsync = (options: IVsfRemoveStorageOptions) => Promise<void>;
@@ -0,0 +1,29 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về khi gọi network thành công
4
+ */
5
+ export type IVsfRequestData = any;
6
+ /**
7
+ * Tham số để cấu hình việc gọi network
8
+ */
9
+ export type IVsfRequestOptions = {
10
+ /** Đường dẫn muốn gọi tới */
11
+ url: string;
12
+ /** Cấu hình headers khi thực hiện gọi network */
13
+ headers?: Record<string, string>;
14
+ /** Phương thức gọi network. Mặc định sẽ là GET */
15
+ method?: string;
16
+ /** Kích hoạt chức năng StepUp authentication */
17
+ stepup?: boolean;
18
+ /** Data kèm theo trong request */
19
+ data?: any;
20
+ /** Request sẽ bị cancel sau khoảng thời gian timeout. Đơn vị là mili giây (ms); mặc định là 30,000 (30s) */
21
+ timeout?: number;
22
+ /** Quy định định dạng dữ liệu (data format) trả về sau request. Hỗ trợ JSON, text, base64 và arraybuffer; mặc định là JSON */
23
+ dataType?: string;
24
+ /** Quy định dữ liệu trả về trường hợp thành công có bao gồm headers hay không */
25
+ includeHeader?: boolean;
26
+ };
27
+ export type IVsfRequestOptionsWithCallback = IVsfOptionsWithCallback<IVsfRequestOptions, IVsfRequestData>;
28
+ export type IVsfRequest = (options: IVsfRequestOptionsWithCallback) => void;
29
+ export type IVsfRequestAsync = (options: IVsfRequestOptions) => Promise<IVsfRequestData>;
@@ -0,0 +1,11 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Tham số để lưu ảnh vào thư viện
4
+ */
5
+ export type IVsfSaveImageOptions = {
6
+ /** Đường dẫn hoặc URL của ảnh cần lưu */
7
+ url: string;
8
+ };
9
+ export type IVsfSaveImageOptionsWithCallback = IVsfOptionsWithCallback<IVsfSaveImageOptions, void>;
10
+ export type IVsfSaveImage = (options: IVsfSaveImageOptionsWithCallback) => void;
11
+ export type IVsfSaveImageAsync = (options: IVsfSaveImageOptions) => Promise<void>;
@@ -0,0 +1,14 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về khi quét mã (QR/Barcode)
4
+ */
5
+ export type IVsfScanData = string;
6
+ /**
7
+ * Tham số để mở camera quét mã
8
+ */
9
+ export type IVsfScanOptions = {
10
+ hideAlbum?: boolean;
11
+ };
12
+ export type IVsfScanOptionsWithCallback = IVsfOptionsWithCallback<IVsfScanOptions, IVsfScanData>;
13
+ export type IVsfScan = (options?: IVsfScanOptionsWithCallback) => void;
14
+ export type IVsfScanAsync = (options?: IVsfScanOptions) => Promise<IVsfScanData>;
@@ -0,0 +1,11 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Tham số để sao chép nội dung vào clipboard
4
+ */
5
+ export type IVsfSetClipboardOptions = {
6
+ /** Nội dung text cần sao chép */
7
+ text: string;
8
+ };
9
+ export type IVsfSetClipboardOptionsWithCallback = IVsfOptionsWithCallback<IVsfSetClipboardOptions, void>;
10
+ export type IVsfSetClipboard = (options: IVsfSetClipboardOptionsWithCallback) => void;
11
+ export type IVsfSetClipboardAsync = (options: IVsfSetClipboardOptions) => Promise<void>;
@@ -0,0 +1,17 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kiểu dữ liệu có thể lưu trữ trong storage
4
+ */
5
+ export type IVsfStorageData = string | Record<string, any>;
6
+ /**
7
+ * Tham số để lưu dữ liệu vào storage
8
+ */
9
+ export type IVsfSetStorageOptions = {
10
+ /** Key để lưu dữ liệu */
11
+ key: string;
12
+ /** Dữ liệu cần lưu */
13
+ data: IVsfStorageData;
14
+ };
15
+ export type IVsfSetStorageOptionsWithCallback = IVsfOptionsWithCallback<IVsfSetStorageOptions, void>;
16
+ export type IVsfSetStorage = (options: IVsfSetStorageOptionsWithCallback) => void;
17
+ export type IVsfSetStorageAsync = (options: IVsfSetStorageOptions) => Promise<void>;
@@ -0,0 +1,18 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Tham số để chia sẻ ứng dụng
4
+ */
5
+ export type IVsfShareAppOptions = {
6
+ /** Tiêu đề chia sẻ */
7
+ title?: string;
8
+ /** Mô tả chia sẻ */
9
+ desc?: string;
10
+ /** Đường dẫn trong miniapp */
11
+ path?: string;
12
+ /** URL chia sẻ */
13
+ url?: string;
14
+ };
15
+ export type IVsfShareAppData = IVsfShareAppOptions;
16
+ export type IVsfShareAppOptionsWithCallback = IVsfOptionsWithCallback<IVsfShareAppOptions, IVsfShareAppData>;
17
+ export type IVsfShareApp = (options?: IVsfShareAppOptionsWithCallback) => void;
18
+ export type IVsfShareAppAsync = (options?: IVsfShareAppOptions) => Promise<IVsfShareAppData>;
@@ -0,0 +1,22 @@
1
+ import { IVsfOptionsWithCallback } from '../common';
2
+ /**
3
+ * Kết quả trả về khi người dùng chọn một mục trong action sheet
4
+ */
5
+ export type IVsfShowActionSheetData = {
6
+ /** Vị trí của mục được chọn (0-indexed) */
7
+ index: number;
8
+ };
9
+ /**
10
+ * Tham số để hiển thị action sheet
11
+ */
12
+ export type IVsfShowActionSheetOptions = {
13
+ /** Tiêu đề của action sheet */
14
+ title?: string;
15
+ /** Danh sách các mục để chọn */
16
+ items: Array<string>;
17
+ /** Text hiển thị trên nút hủy */
18
+ destructiveBtnIndex?: number;
19
+ };
20
+ export type IVsfShowActionSheetOptionsWithCallback = IVsfOptionsWithCallback<IVsfShowActionSheetOptions, IVsfShowActionSheetData>;
21
+ export type IVsfShowActionSheet = (options: IVsfShowActionSheetOptionsWithCallback) => void;
22
+ export type IVsfShowActionSheetAsync = (options: IVsfShowActionSheetOptions) => Promise<IVsfShowActionSheetData>;