UNPKG

zmp-sdk

Version:

Zalo Mini App SDK

1,777 lines (1,760 loc) 212 kB
import { StreamType as StreamType$1, MediaConstraints as MediaConstraints$1, PhotoConstraint as PhotoConstraint$1, PhotoFrame as PhotoFrame$1, MediaDevice as MediaDevice$1, CameraEvents as CameraEvents$1, AsyncVoidCallback as AsyncVoidCallback$1 } from '@mp-types'; /** * @typedef {"none" | "wifi" | "cellular" | "unknown"} NetworkType */ declare enum NetworkType { /** No Network */ none = "none", /** Wi-Fi Network */ wifi = "wifi", /** Cellular Network (2g/3g/4g) */ cellular = "cellular", /** Uncommon network types for Android */ unknown = "unknown" } declare enum Events { AppPaused = "h5.event.paused", AppResumed = "h5.event.resumed", NetworkChanged = "h5.event.connection.changed", OnDataCallback = "h5.event.webview.result", WebviewClosed = "h5.event.webview.close", OpenApp = "h5.event.open.mp", AppClose = "h5.event.action.close", PaymentCallback = "payment.callback", PaymentResult = "action.payment.result", /** Người dùng đã hoàn thành quy trình thanh toán ở CheckoutSDK * * Lưu ý: Event sẽ được gửi khi người dùng hoàn tất hoặc hủy quy trình thanh toán. * * Đối tác cần sử dụng API checkTransaction để kiểm tra trạng thái thanh toán mới nhất. * * @link https://mini.zalo.me/documents/checkout-sdk/integration-process/overview/receive-transaction-ma/ * */ PaymentDone = "action.payment.done", PaymentClose = "action.payment.close", DownloadProgress = "h5.event.webview.download.progress" } declare enum OpenProfilePickerType { "TOOL_DEL_FRIEND" = "tool_del_friend" } declare const ACTION: { GET_DOWNLOADED_STICKER: { haveCallback: boolean; }; OPEN_SHARE_STICKER: {}; OPEN_PROFILE: { requireAccessToken: boolean; }; OPEN_FEED_DETAIL: {}; OPEN_FRIEND_RADA: {}; OPEN_INAPP: {}; OPEN_OUTAPP: { requireAccessToken: boolean; }; OPEN_PAGE: {}; OPEN_PHOTODETAIL: {}; OPEN_GALARY: {}; OPEN_GAMECENTER: {}; OPEN_GAMENEWS: {}; OPEN_TAB_CONTACT: {}; OPEN_TAB_SOCIAL: {}; OPEN_FRIENDSUGGEST: {}; OPEN_GROUPLIST: {}; OPEN_NEARBY: {}; OPEN_ROOM: {}; OPEN_STICKERSTORE: {}; OPEN_CREATECHAT: {}; COPY_LINK_CATESTICKER: {}; REQUEST_BUY_STICKER: {}; OPEN_CHAT: { requireAccessToken: boolean; }; OPEN_TAB_CHAT: {}; OPEN_CHATGROUP: {}; OPEN_ADDFRIEND: {}; OPEN_TAB_MORE: {}; OPEN_POSTFEED: { requireAccessToken: boolean; }; OPEN_LOGINDEVICES: {}; OPEN_SENDSTICKER: {}; REPORT_ABUSE: { haveCallback: boolean; }; FOLLOW_OA: { haveCallback: boolean; requireAccessToken: boolean; errorList: { android: { "-400": { mapTo: { code: number; message: string; }; }; }; iOS: { "-400": { mapTo: { code: number; message: string; }; }; }; }; }; UNFOLLOW_OA: { haveCallback: boolean; requireAccessToken: boolean; errorList: { android: { "-400": { mapTo: { code: number; message: string; }; }; }; iOS: { "-400": { mapTo: { code: number; message: string; }; }; }; }; }; OPEN_GAMEDETAIL: {}; OPEN_SHARESHEET: { haveCallback: boolean; requireAccessToken: boolean; errorList: { android: { "-101": { mapTo: { code: number; message: string; }; }; }; iOS: { "-101": { mapTo: { code: number; message: string; }; }; }; }; }; REQUEST_PERMISSION_CAMERA: { errorList: { android: { "-2": { mapTo: { code: number; message: string; }; }; }; iOS: { "-2": { mapTo: { code: number; message: string; }; }; }; }; }; CHANGE_TITLE_HEADER: { skipJump: boolean; }; WEBVIEW_CLEARCACHE: {}; WEBVIEW_CONFIRMCACHE: {}; WEBVIEW_ISVISIBLE: {}; WEBVIEW_NETWORKTYPE: { skipJump: boolean; }; CHANGE_BUTTON_HEADER: {}; CREATE_OPTIONS_MENU: { skipJump: boolean; haveCallback: boolean; }; CREATE_SHORTCUT: { requireAccessToken: boolean; }; CHANGE_ACTIONBAR_LEFTBUTTON_TYPE: { skipJump: boolean; haveCallback: boolean; }; WINDOW_CLOSE: { skipJump: boolean; haveCallback: boolean; }; WEBVIEW_CHECKRESERROR: {}; IAP_REQUESTPAYMENT: { haveCallback: boolean; }; ZBROWSER_GETSTATS: {}; ZBROWSER_JSBRIDGE: { skipJump: boolean; haveCallback: boolean; }; PROMPT_AUTHENTICATION: {}; CHANGE_ACTIONBAR_COLOR: { skipJump: boolean; }; PROMPT_AUTHENTICATION_CHECK_STATE: {}; OPEN_APPSTORE: {}; GET_LOCATION: { haveCallback: boolean; errorList: { android: { "-1": { mapTo: { code: number; message: string; }; }; "-400": { mapTo: { code: number; message: string; }; }; }; iOS: { "-1": { mapTo: { code: number; message: string; }; }; "-400": { mapTo: { code: number; message: string; }; }; }; }; }; QUERY_LOCATION_HIDE: { haveCallback: boolean; }; SHOW_TOAST: { haveCallback: boolean; timeout: number; }; OPEN_APP: {}; HIDE_KEYBOARD: {}; OPEN_PHONE: {}; OPEN_QR: {}; OPEN_SMS: { errorList: { iOS: { "-9": { mapTo: { code: number; message: string; }; }; "-10": { mapTo: { code: number; message: string; }; }; }; }; }; VIEW_MYQR: { haveCallback: boolean; timeout: boolean; requireAccessToken: boolean; }; KEEP_SCREEN: { haveCallback: boolean; timeout: number; }; CHANGE_AUTOROTATE: { skipJump: boolean; }; CHECK_APP_INSTALLED: {}; QUERY_SHOW: {}; QUERY_HIDE: {}; OPEN_INAPPRW: {}; ZALORUN_GETTRACKINGSTATUS: { haveCallback: boolean; }; ZALORUN_SETTRACKINGSTATUS: { haveCallback: boolean; }; ZALORUN_GETDAYSTEP: { haveCallback: boolean; }; ZALORUN_FORCESUBMITDATA: { haveCallback: boolean; }; ZALORUN_SETWEIGHT: { haveCallback: boolean; }; OPEN_PROFILE_EXT: {}; DOWNLOAD_CATE: { haveCallback: boolean; }; JUMP_LOGIN: { skipJump: boolean; whiteList: boolean; }; OPEN_ADTIMA_ADS_INTERSTITIAL: {}; OPEN_ADTIMA_ADS: {}; GET_ADIDCLIENT: {}; SCAN_IBEACON: {}; SAVE_VIDEO_GALLERY: { versionLive: { iOS: number; }; errorList: { android: { "-101": { mapTo: { code: number; message: string; }; needMoreDetail: boolean; }; "-102": { mapTo: { code: number; message: string; }; needMoreDetail: boolean; }; }; iOS: { "-10": { mapTo: { code: number; message: string; }; needMoreDetail: boolean; }; }; }; }; INTERACTIVE_VIBRATION: {}; SAVE_IMAGE_GALLERY: { versionLive: { iOS: number; }; errorList: { android: { "-101": { mapTo: { code: number; message: string; }; needMoreDetail: boolean; }; "-102": { mapTo: { code: number; message: string; }; needMoreDetail: boolean; }; }; iOS: { "-10": { mapTo: { code: number; message: string; }; needMoreDetail: boolean; }; }; }; }; OPEN_MP: { versionLive: { iOS: number; }; }; CHANGE_ACTIONBAR: { haveCallback: boolean; timeout: number; versionLive: { iOS: number; }; skipJump: boolean; }; ZBROWSER_MPDS: { haveCallback: boolean; timeout: number; versionLive: { iOS: number; }; errorList: { android: { "-100": { mapTo: { code: number; message: string; }; }; "-101": { mapTo: { code: number; message: string; }; }; "-105": { mapTo: { code: number; message: string; }; }; "-106": { mapTo: { code: number; message: string; }; }; }; iOS: { "-10": { mapTo: { code: number; message: string; }; }; "-101": { mapTo: { code: number; message: string; }; }; "-102": { mapTo: { code: number; message: string; }; }; }; }; }; ZBROWSER_MPDS_SYNC: { versionLive: { iOS: number; }; errorList: { android: { "-100": { mapTo: { code: number; message: string; }; }; "-101": { mapTo: { code: number; message: string; }; }; "-105": { mapTo: { code: number; message: string; }; }; "-106": { mapTo: { code: number; message: string; }; }; }; iOS: { "-10": { mapTo: { code: number; message: string; }; }; "-101": { mapTo: { code: number; message: string; }; }; "-102": { mapTo: { code: number; message: string; }; }; }; }; }; WEBVIEW_SET_RESULT: { versionLive: { iOS: number; }; }; MP_GET_NUMBER: { versionLive: { iOS: number; }; errorList: { android: { "-1": { mapTo: { code: number; message: string; }; }; "-101": { mapTo: { code: number; message: string; }; }; "-400": { mapTo: { code: number; message: string; }; }; }; iOS: { "-1": { mapTo: { code: number; message: string; }; }; "-10": { mapTo: { code: number; message: string; }; }; "-400": { mapTo: { code: number; message: string; }; }; }; }; }; MP_OPEN_PROFILE_PICKER: { requireAccessToken: boolean; versionLive: { iOS: number; }; errorList: { android: { "-101": { mapTo: { code: number; message: string; }; }; }; iOS: { "-101": { mapTo: { code: number; message: string; }; }; }; }; }; GET_SUPPORTED_ACTIONS: { whiteList: boolean; }; MP_JOIN_WIFI: { haveCallback: boolean; timeout: boolean; versionLive: { android: number; iOS: number; }; havePermission: boolean; whiteList: boolean; }; PICK_MEDIA: { requireAccessToken: boolean; versionLive: { iOS: number; }; errorList: { android: { "-101": { mapTo: { code: number; message: string; }; }; "999": { mapTo: { code: number; message: string; }; needMoreDetail: boolean; }; }; iOS: { "-10": { mapTo: { code: number; message: string; }; }; "-101": { mapTo: { code: number; message: string; }; }; }; }; }; MP_CLOSE_LOADINGVIEW: { skipJump: boolean; }; CHANGE_BOTTOMBAR: { haveCallback: boolean; timeout: number; skipJump: boolean; }; MA_MENU_MINIMIZE: { skipJump: boolean; versionLive: { iOS: number; }; }; MA_MENU_PERMISSION: { skipJump: boolean; versionLive: { iOS: number; }; }; MA_MENU_FAVORITES: { skipJump: boolean; versionLive: { iOS: number; }; }; MP_SEND_NOTIFICATION: { skipJump: boolean; versionLive: { iOS: number; }; errorList: { android: { "-1": { mapTo: { code: number; message: string; }; }; "-400": { mapTo: { code: number; message: string; }; }; }; iOS: { "-1": { mapTo: { code: number; message: string; }; }; "-400": { mapTo: { code: number; message: string; }; }; }; }; }; MP_ADD_RATING: { skipJump: boolean; }; MP_ADD_MYFAVORITES: { skipJump: boolean; }; MP_INTERACT_OA: { skipJump: boolean; errorList: { android: { "-400": { mapTo: { code: number; message: string; }; }; }; iOS: { "-400": { mapTo: { code: number; message: string; }; }; }; }; }; MP_USER_AUTHORIZE: { skipJump: boolean; errorList: { android: { "-400": { mapTo: { code: number; message: string; }; }; }; iOS: { "-400": { mapTo: { code: number; message: string; }; }; }; }; }; MP_SELECT_PAYMENT_METHOD: { skipJump: boolean; }; CHECK_NFC: { skipJump: boolean; versionLive: { iOS: number; }; errorList: { all: { "-1": { mapTo: { code: number; message: string; }; }; "-600": { mapTo: { code: number; message: string; }; }; "-602": { mapTo: { code: number; message: string; }; }; }; }; }; SCAN_NFC: { skipJump: boolean; haveCallback: boolean; timeout: number; errorList: { all: { "-1": { mapTo: { code: number; message: string; }; }; "-600": { mapTo: { code: number; message: string; }; }; "-601": { mapTo: { code: number; message: string; }; }; "-602": { mapTo: { code: number; message: string; }; }; "-603": { mapTo: { code: number; message: string; }; }; "-604": { mapTo: { code: number; message: string; }; }; "-605": { mapTo: { code: number; message: string; }; }; "-606": { mapTo: { code: number; message: string; }; }; }; }; }; MP_CONFIRM_REQUEST_PAYMENT: { skipJump: boolean; }; SAVE_FILE: { versionLive: { iOS: number; }; skipJump: boolean; errorList: { android: { "-101": { mapTo: { code: number; message: string; }; needMoreDetail: boolean; }; "-102": { mapTo: { code: number; message: string; }; needMoreDetail: boolean; }; }; iOS: { "-10": { mapTo: { code: number; message: string; }; needMoreDetail: boolean; }; }; }; }; LFS_FILE_INFO: { skipJump: boolean; }; LFS_LIST: { skipJump: boolean; }; LFS_FILE_SAVE: { skipJump: boolean; }; LFS_FILE_REMOVE: { skipJump: boolean; }; MP_APP_LIFECYCLE_TRACKING: { skipJump: boolean; }; OPEN_DOCUMENT: { skipJump: boolean; errorList: { all: { "-10": { mapTo: { code: number; message: string; }; }; "-700": { mapTo: { code: number; message: string; }; }; "-701": { mapTo: { code: number; message: string; }; }; "-702": { mapTo: { code: number; message: string; }; }; "-703": { mapTo: { code: number; message: string; }; }; }; }; }; GET_DEVICE_INFO: { skipJump: boolean; }; MP_OPEN_ZINSTANTVIEW: { skipJump: boolean; timeout: boolean; versionLive: { android: number; iOS: number; }; }; OPEN_SETTING: { skipJump: boolean; }; }; declare const AUTHEN_SCOPE_VALUES: readonly ["scope.userInfo", "scope.userLocation", "scope.userPhonenumber"]; declare const GET_SETTINGS_SCOPE_VALUES: readonly ["scope.userInfo", "scope.userLocation", "scope.userPhonenumber", "scope.camera", "scope.micro"]; type AsyncCallbackFailObject = { code: number; message?: string | undefined; api?: string | undefined; [key: string]: any; }; type AsyncCallback<T = any> = { action?: keyof typeof ACTION; success?: ((res: T) => void) | undefined; fail?: ((err: AsyncCallbackFailObject) => void) | undefined; }; type AsyncVoidCallback = { action?: keyof typeof ACTION; success?: () => void; fail?: ((err: AsyncCallbackFailObject) => void) | undefined; }; type AsyncProgressCallback<T = any> = { action?: keyof typeof ACTION; onProgress?: (progress: number) => void; success?: ((res: T) => void) | undefined; fail?: ((err: AsyncCallbackFailObject) => void) | undefined; }; type GetDeviceInfoReturn = { jailbroken?: boolean; device_id?: string; }; type GetLocationReturns = { /** * @deprecated */ latitude?: string; /** * @deprecated */ longitude?: string; /** * @deprecated */ timestamp?: string; /** * @deprecated */ provider?: string; /** * Là một chuỗi ký tự dùng để truy xuất thông tin vị trí thông qua server. Mỗi Token được cung cấp, bạn sẽ có thể truy xuất thông tin được 1 lần với thời gian hết hạn sau 2 phút. * * @minimumVersion Zalo App: 23.02.01 * @minimumVersion ZMP SDK: 2.29.0 */ token?: string; }; type CameraParams = { mediaConstraints?: MediaConstraints; canvasElement?: HTMLCanvasElement; videoElement: HTMLVideoElement; }; interface SystemInfo { /** * Phiên bản đang được sử dụng của Zalo Mini App này. */ version: string; /** * Phiên bản đang sử dụng của ZMP SDK. */ apiVersion: string; /** * Phiên bản của ứng dụng Zalo trên thiết bị. */ zaloVersion: string; /** * Thông tin hệ điều hành của thiết bị. */ platform: "android" | "iOS" | "wp" | "unknown" | ""; /** * Ngôn ngữ hiển thị của thiết bị. */ language: string; /** * Ngôn ngữ hiển thị của ứng dụng Zalo trên thiết bị. * @minimumVersion Zalo iOS: 22.03.01.r2 * @minimumVersion Zalo Android: 21.09.01 * @minimumVersion ZMP SDK: 2.17.3 */ zaloLanguage: string; /** * Theme hiện tại của ứng dụng Zalo trên thiết bị. * @minimumVersion Zalo iOS: 22.03.01.r2 * @minimumVersion Zalo Android: 21.09.01 * @minimumVersion ZMP SDK: 2.17.3 */ zaloTheme: string; } type SetStorageReturns = { errorKeys: string[]; }; type GetStorageReturns = { [key: string]: any; }; type StorageInfo = { /** * Không gian hiện tại bị chiếm (tính bằng KB) * @minimumVersion 2.43.0 */ currentSize: number; /** * Giới hạn kích thước không gian (tính bằng KB) * @minimumVersion 2.43.0 */ limitSize: number; }; type RemoveStorageReturns = { errorKeys: string[]; }; type UserInfo = { /** * Chuỗi định danh người dùng theo Zalo App. Chuỗi này là duy nhất cho mỗi người dùng trên mỗi Zalo App. Các Mini App cùng chung một Zalo App ID sẽ có thể dùng chuỗi này để định danh người dùng. Có thể sử dụng ID này để gửi thông báo tới người dùng qua OA chung của Zalo Mini App, tham khảo tại [đây](https://mini.zalo.me/documents/open-apis/notifications/send/). */ id: string; /** * Tên hiển thị của người dùng. */ name: string; /** * Ảnh đại diện người dùng. */ avatar: string; /** * Chuỗi định danh người dùng theo Official Account. Có thể sử dụng ID này để gửi tin nhắn cho người dùng (xem [cách gửi tin nhắn với idByOA](https://mini.zalo.me/documents/intro/send-message-oa-to-user/)). Chuỗi có giá trị nếu thỏa 1 trong các điều kiện dưới đây: * - Mini App đã được xác thực bởi Official Account, chi tiết xem [tại đây](https://mini.zalo.me/blog/thong-bao-huong-dan-xac-thuc-mini-app-qua-zalo-oa/#3.b). * - Zalo App phải được liên kết với Official Account và người dùng đã follow Official Account đó. * * @minimumVersion 2.23.3 */ idByOA?: string; /** * Trạng thái theo dõi Official Account đã được liên kết với Zalo App. * * @minimumVersion 2.23.3 */ followedOA?: boolean; /** * Trả về 1 trong 2 giá trị: * - `true`: tài khoản này thuộc nhóm người dùng cần nhà phát triển Mini App xác minh và áp dụng các cơ chế xử lý dữ liệu phù hợp theo quy định Pháp luật, có thể bao gồm nhưng không giới hạn người đã chết hoặc mất tích, người không biết chữ, người khuyết tật, trẻ em,… * - `false`: tài khoản này thuộc nhóm người dùng bình thường. * * @minimumVersion 2.28.0 */ isSensitive?: boolean; }; type GetUserInfoReturns = { /** * Thông tin người dùng. */ userInfo: UserInfo; }; type GetNetworkTypeReturns = { /** * Kiểu kết nối mạng hiện tại với các giá trị: * - `none`: Không có mạng. * - `wifi`: Mạng Wi-Fi. * - `cellular`: Mạng di động (2g/3g/4g). * - `unknown`: Mạng không xác định (Android). */ networkType: NetworkType; }; type iBeaconInfo = { /** The iBeacon device broadcast UUID. */ uuid: string; /** The iBeacon device primary ID. */ major: string; /** The iBeacon device secondary ID. */ minor: string; /** The iBeacon device distance. */ distance: number; /** The signal strength of the device. */ rssi: number; }; type GetBeaconDiscoveryReturns = { beacons: Array<iBeaconInfo>; }; type ScanQRCodeReturns = { content: string; }; type OpenPostFeedReturns = { /** * Trạng thái chia sẻ: * - `0`: User nhấn hủy/cancel bài viết. * - `1`: Đăng bài viết thành công. */ status: 0 | 1; /** * Trạng thái bài chia sẻ: * - `0`: Công khai. * - `1`: Chỉ mình tôi. * - `2`: Chia sẻ cho danh sách bạn. */ shareType: 0 | 1 | 2; /** * Số lượng user nhận được bài chia sẻ trong trường hợp `shareType=2`. */ numberOfUser: number; }; type OpenShareSheetReturns = { /** * Trạng thái chia sẻ: * - `0`: User nhấn hủy/cancel bài viết. * - `1`: Đăng bài viết thành công lên nhật ký. * - `2`: Đăng bài viết thành công qua cửa sổ chat. */ status: 0 | 2 | 1; /** * Trạng thái bài chia sẻ: * - `0`: Công khai. * - `1`: Chỉ mình tôi. * - `2`: Chia sẻ cho danh sách bạn. */ shareType: 0 | 2 | 1; /** * Số lượng user nhận được bài chia sẻ trong trường hợp `shareType=2`. */ numberOfUser: number; }; type RequestCameraPermissionReturns = { userAllow: boolean; message: string; }; type CheckZaloCameraPermissionReturns = { userAllow: boolean; }; type OpenBioAuthenticationReturns = { code: number; message: string; data: { domain: string; code: number; message: string; payToken: string; }; }; type CheckStateBioAuthenticationReturns = { bioState: string; }; type KeepScreenReturns = { success: boolean; }; type OpenWebviewReturns = { success: boolean; }; type GetAppInfoReturns = { /** * Tên Zalo Mini App. */ name: string; /** * Mô tả Zalo Mini App. */ description: string; /** * Phiên bản live hiện tại. */ version: string; /** * Link chia sẻ Zalo Mini App. */ appUrl: string; /** * Link QR của Zalo Mini App. */ qrCodeUrl: string; /** * Đường dẫn đến hình ảnh logo của Zalo Mini App. */ logoUrl?: string; /** * Mã danh mục của Zalo Mini App. */ cateID?: string; /** * Mã định danh của Zalo Mini App. */ appId?: string; /** * Mã định danh của Zalo Mini App theo Zalo App. */ zaloAppId?: string; }; type GetPhoneNumberReturns = { /** * @deprecated */ number?: string; /** * Là một chuỗi ký tự dùng để truy xuất thông tin số điện thoại thông qua server. Mỗi token được cung cấp chỉ có thể truy xuất thông tin được 1 lần với thời gian hết hạn sau 2 phút. */ token?: string; }; type ProfileInfo = { /** * Tên hiển thị của người dùng. */ name: string; /** * Ảnh đại diện người dùng. */ avatar: string; }; type PickedProfile = { /** * Mã người dùng. Chuỗi này là duy nhất cho mỗi người dùng trên mỗi ứng dụng Zalo App. Các Zalo Mini App cùng chung một Zalo App sẽ dùng được mã người dùng của nhau. */ id: string; /** * Thông tin của người dùng. */ profile: ProfileInfo; /** * Mã lỗi: * - 0: Lấy thông tin của người dùng thành công. * - 1: Lấy thông tin người dùng thất bại. */ code: number; /** * Thông báo lỗi. */ message: string; }; type OpenProfilePickerReturns = { /** * Danh sách những bạn bè được chọn. */ users: PickedProfile[]; }; type OpenMediaPickerReturns = { /** * Mảng đường dẫn file tạm trên thiết bị hoặc toàn bộ nội dung trả về của server upload media. */ data: string[] | string; }; type ContextInfo = { /** * Ngữ cảnh hiện tại là người dùng hoặc nhóm chat. */ type?: "USER_CHAT" | "GROUP_CHAT" | ""; /** * ID của người dùng hoặc nhóm chat tương ứng. */ id?: string; }; type GetAuthCodeReturns = { authCode: string; authCodeVerify: string; }; type GetZPITokenReturns = { utoken: string; gtoken: string; zpp: string; zpt: string; }; type TempFile = { /** * Đường dẫn các temp file đã chọn. */ path: string; /** * Kích thước các temp file đã chọn. */ size: number; }; type ChooseImageReturns = { /** * Đường dẫn các file đã chọn. */ filePaths: string[]; /** * Thông tin các temp files. */ tempFiles: TempFile[]; }; type CreateOrderReturns = { orderId: string; messageToken?: string; transId?: string; }; type SelectPaymentMethodReturns = { method: string; isCustom?: boolean; displayName?: string; subMethod?: string; logo?: string; }; type CheckTransactionReturns = { err: number; msg: string; orderId: string; transId: string; resultCode: number; transTime: string; createdAt: string; path?: string; method: string; isCustom: boolean; }; type CreateOrderIAPReturns = { orderId: string; }; type ScopeValues = (typeof AUTHEN_SCOPE_VALUES)[number] | (typeof GET_SETTINGS_SCOPE_VALUES)[number]; type AuthorizeType<T extends ScopeValues> = Partial<{ [key in T]: boolean; }>; type GetSettingReturn = { /** * Thông tin cấp quyền, tham khảo bảng Scopes. * * | Scope | Corresponding APIs | Description | * | --------------------- | --------------------- | ------------------------------- | * | scope.userInfo | `getUserInfo` | Thông tin user (tên, avatar...) | * | scope.userLocation | `getLocation` | Thông tin vị trí user | * | scope.userPhonenumber | `getPhoneNumber` | Số điện thoại | * | scope.camera | `createCameraContext` | Camera | * | scope.micro | `createCameraContext` | Micro | * * Với các scope có giá trị trả về là `true`, tương ứng với việc người dùng đã cấp quyền sử dụng API trước đó, Mini Apps có thể truy xuất thông tin một cách trực tiếp. */ authSetting: AuthorizeType<(typeof GET_SETTINGS_SCOPE_VALUES)[number]>; }; type GetFileInfoReturns = { size: number; digest: string; type: string; }; type ListFile = { list: FileInfo[]; }; type FileInfo = { filePath: string; size: number; createTime: number; type: string; }; type SaveFileReturns = { savedPath: string; }; type IsSupportReturns = { support: boolean; }; type CheckoutPopupOpenParams = { qrContent: string; merchantLogo: string; merchantName: string; amount: number; orderDesscription: string; }; type CheckoutPopupResponseData = { status: string; }; declare enum CameraEvents { OnFrameCallback = "h5.event.camera.frame", OnStartCallback = "h5.event.camera.start", OnStopCallback = "h5.event.camera.stop" } declare enum FacingMode { FRONT = "user", BACK = "environment" } declare enum PhotoFormat { WEBP = "image/webp", PNG = "image/png", JPEG = "image/jpeg" } declare enum PhotoQuality { HIGH = "high", NORMAL = "normal", LOW = "low" } declare enum StreamType { VIDEO = "video", AUDIO = "audio" } type PhotoFrame = { data: string; width: number; height: number; }; type MediaDevice = { kind: string; label: string; deviceId: string; }; type MediaConstraints = { width?: number; height?: number; facingMode?: FacingMode; deviceId?: string; audio?: boolean; video?: boolean; mirrored?: boolean; }; type PhotoConstraint = { width?: number; height?: number; format?: PhotoFormat; quality?: PhotoQuality; mirrored?: boolean; useVideoSourceSize?: boolean; minScreenshotWidth?: number; minScreenshotHeight?: number; }; declare function login(args?: AsyncCallback<string>): Promise<string>; /** * API dùng để lấy thông tin xác thực người dùng. * * @important Cập nhật * Từ phiên bản SDK 2.35.0, ứng dụng mặc định có quyền truy xuất access tokens mà không cần người dùng xác nhận đồng ý. Thông qua access tokens này, ứng dụng chỉ có thể xuất ID người sử dụng. Nếu ứng dụng có nhu cầu sử dụng Tên và Ảnh đại diện, vui lòng sử dụng API authorize để yêu cầu người dùng cho phép truy cập scope.userInfo trước khi sử dụng API này. Lưu ý: Với các Zalo App có nhiều hơn 1 Mini App, hệ thống vẫn yêu cầu người dùng xác nhận khi truy xuất access tokens cho từng Mini App. * * @returns {string} `accessToken`. * @example * ```ts * const accessToken = await getAccessToken(); * ``` */ declare function getAccessToken(args?: AsyncCallback<string>): Promise<string>; declare function getVersion(): string; /** * API truy xuất thông tin hệ thống, thiết bị đang sử dụng. * @minimumVersion 2.4.0 * @returns {SystemInfo} các thông tin về phiên bản, ngôn ngữ, theme của hệ thống. * @example Lấy các thông tin phiên bản: * ```ts * const { version, apiVersion, zaloVersion } = getSystemInfo(); * ``` */ declare function getSystemInfo(): SystemInfo; declare type Primitive = string | number | symbol | bigint | boolean | null | undefined; declare namespace util { type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false; export const assertEqual: <A, B>(val: AssertEqual<A, B>) => AssertEqual<A, B>; export function assertIs<T>(_arg: T): void; export function assertNever(_x: never): never; export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>; export type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>; export const arrayToEnum: <T extends string, U extends [T, ...T[]]>(items: U) => { [k in U[number]]: k; }; export const getValidEnumValues: (obj: any) => any[]; export const objectValues: (obj: any) => any[]; export const objectKeys: ObjectConstructor["keys"]; export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined; export type identity<T> = T; export type flatten<T> = identity<{ [k in keyof T]: T[k]; }>; export type noUndefined<T> = T extends undefined ? never : T; export const isInteger: NumberConstructor["isInteger"]; export function joinValues<T extends any[]>(array: T, separator?: string): string; export const jsonStringifyReplacer: (_: string, value: any) => any; export {}; } declare const ZodParsedType: { function: "function"; number: "number"; string: "string"; nan: "nan"; integer: "integer"; float: "float"; boolean: "boolean"; date: "date"; bigint: "bigint"; symbol: "symbol"; undefined: "undefined"; null: "null"; array: "array"; object: "object"; unknown: "unknown"; promise: "promise"; void: "void"; never: "never"; map: "map"; set: "set"; }; declare type ZodParsedType = keyof typeof ZodParsedType; declare type allKeys<T> = T extends any ? keyof T : never; declare type typeToFlattenedError<T, U = string> = { formErrors: U[]; fieldErrors: { [P in allKeys<T>]?: U[]; }; }; declare const ZodIssueCode: { invalid_type: "invalid_type"; invalid_literal: "invalid_literal"; custom: "custom"; invalid_union: "invalid_union"; invalid_union_discriminator: "invalid_union_discriminator"; invalid_enum_value: "invalid_enum_value"; unrecognized_keys: "unrecognized_keys"; invalid_arguments: "invalid_arguments"; invalid_return_type: "invalid_return_type"; invalid_date: "invalid_date"; invalid_string: "invalid_string"; too_small: "too_small"; too_big: "too_big"; invalid_intersection_types: "invalid_intersection_types"; not_multiple_of: "not_multiple_of"; not_finite: "not_finite"; }; declare type ZodIssueCode = keyof typeof ZodIssueCode; declare type ZodIssueBase = { path: (string | number)[]; message?: string; }; interface ZodInvalidTypeIssue extends ZodIssueBase { code: typeof ZodIssueCode.invalid_type; expected: ZodParsedType; received: ZodParsedType; } interface ZodInvalidLiteralIssue extends ZodIssueBase { code: typeof ZodIssueCode.invalid_literal; expected: unknown; received: unknown; } interface ZodUnrecognizedKeysIssue extends ZodIssueBase { code: typeof ZodIssueCode.unrecognized_keys; keys: string[]; } interface ZodInvalidUnionIssue extends ZodIssueBase { code: typeof ZodIssueCode.invalid_union; unionErrors: ZodError[]; } interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase { code: typeof ZodIssueCode.invalid_union_discriminator; options: Primitive[]; } interface ZodInvalidEnumValueIssue extends ZodIssueBase { received: string | number; code: typeof ZodIssueCode.invalid_enum_value; options: (string | number)[]; } interface ZodInvalidArgumentsIssue extends ZodIssueBase { code: typeof ZodIssueCode.invalid_arguments; argumentsError: ZodError; } interface ZodInvalidReturnTypeIssue extends ZodIssueBase { code: typeof ZodIssueCode.invalid_return_type; returnTypeError: ZodError; } interface ZodInvalidDateIssue extends ZodIssueBase { code: typeof ZodIssueCode.invalid_date; } declare type StringValidation = "email" | "url" | "uuid" | "regex" | "cuid" | "cuid2" | "datetime" | { startsWith: string; } | { endsWith: string; }; interface ZodInvalidStringIssue extends ZodIssueBase { code: typeof ZodIssueCode.invalid_string; validation: StringValidation; } interface ZodTooSmallIssue extends ZodIssueBase { code: typeof ZodIssueCode.too_small; minimum: number; inclusive: boolean; exact?: boolean; type: "array" | "string" | "number" | "set" | "date"; } interface ZodTooBigIssue extends ZodIssueBase { code: typeof ZodIssueCode.too_big; maximum: number; inclusive: boolean; exact?: boolean; type: "array" | "string" | "number" | "set" | "date"; } interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase { code: typeof ZodIssueCode.invalid_intersection_types; } interface ZodNotMultipleOfIssue extends ZodIssueBase { code: typeof ZodIssueCode.not_multiple_of; multipleOf: number; } interface ZodNotFiniteIssue extends ZodIssueBase { code: typeof ZodIssueCode.not_finite; } interface ZodCustomIssue extends ZodIssueBase { code: typeof ZodIssueCode.custom; params?: { [k: string]: any; }; } declare type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue; declare type ZodIssue = ZodIssueOptionalMessage & { fatal?: boolean; message: string; }; declare type ZodFormattedError<T, U = string> = { _errors: U[]; } & (NonNullable<T> extends [any, ...any[]] ? { [K in keyof NonNullable<T>]?: ZodFormattedError<NonNullable<T>[K], U>; } : NonNullable<T> extends any[] ? { [k: number]: ZodFormattedError<NonNullable<T>[number], U>; } : NonNullable<T> extends object ? { [K in keyof NonNullable<T>]?: ZodFormattedError<NonNullable<T>[K], U>; } : unknown); declare class ZodError<T = any> extends Error { issues: ZodIssue[]; get errors(): ZodIssue[]; constructor(issues: ZodIssue[]); format(): ZodFormattedError<T>; format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>; static create: (issues: ZodIssue[]) => ZodError<any>; toString(): string; get message(): string; get isEmpty(): boolean; addIssue: (sub: ZodIssue) => void; addIssues: (subs?: ZodIssue[]) => void; flatten(): typeToFlattenedError<T>; flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>; get formErrors(): typeToFlattenedError<T, string>; } declare type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never; declare type IssueData = stripPath<ZodIssueOptionalMessage> & { path?: (string | number)[]; fatal?: boolean; }; declare type ErrorMapCtx = { defaultError: string; data: any; }; declare type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => { message: string; }; declare type ParseParams = { path: (string | number)[]; errorMap: ZodErrorMap; async: boolean; }; declare type ParsePathComponent = string | number; declare type ParsePath = ParsePathComponent[]; interface ParseContext { readonly common: { readonly issues: ZodIssue[]; readonly contextualErrorMap?: ZodErrorMap; readonly async: boolean; }; readonly path: ParsePath; readonly schemaErrorMap?: ZodErrorMap; readonly parent: ParseContext | null; readonly data: any; readonly parsedType: ZodParsedType; } declare type ParseInput = { data: any; path: (string | number)[]; parent: ParseContext; }; declare class ParseStatus { value: "aborted" | "dirty" | "valid"; dirty(): void; abort(): void; static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType; static mergeObjectAsync(status: ParseStatus, pairs: { key: ParseReturnType<any>; value: ParseReturnType<any>; }[]): Promise<SyncParseReturnType<any>>; static mergeObjectSync(status: ParseStatus, pairs: { key: SyncParseReturnType<any>; value: SyncParseReturnType<any>; alwaysSet?: boolean; }[]): SyncParseReturnType; } declare type INVALID = { status: "aborted"; }; declare const INVALID: INVALID; declare type DIRTY<T> = { status: "dirty"; value: T; }; declare const DIRTY: <T>(value: T) => DIRTY<T>; declare type OK<T> = { status: "valid"; value: T; }; declare const OK: <T>(value: T) => OK<T>; declare type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID; declare type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>; declare type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>; declare namespace enumUtil { type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never; type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never; type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>; type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never; export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>; export {}; } declare namespace errorUtil { type ErrMessage = string | { message?: string; }; const errToObj: (message?: ErrMessage | undefined) => { message?: string | undefined; }; const toString: (message?: ErrMessage | undefined) => string | undefined; } declare namespace partialUtil { type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<infer Shape, infer Params, infer Catchall> ? ZodObject<{ [k in keyof Shape]: ZodOptional<DeepPartial<Shape[k]>>; }, Params, Catchall> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? { [k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never; } extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T; } declare type RefinementCtx = { addIssue: (arg: IssueData) => void; path: (string | number)[]; }; declare type ZodRawShape = { [k: string]: ZodTypeAny; }; declare type ZodTypeAny = ZodType<any, any, any>; declare type TypeOf<T extends ZodType<any, any, any>> = T["_output"]; declare type input<T extends ZodType<any, any, any>> = T["_input"]; declare type output<T extends ZodType<any, any, any>> = T["_output"]; declare type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>; interface ZodTypeDef { errorMap?: ZodErrorMap; description?: string; } declare type RawCreateParams = { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; description?: string; } | undefined; declare type SafeParseSuccess<Output> = { suc