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 } from '@mp-types'; declare type Primitive = string | number | symbol | bigint | boolean | null | undefined; declare namespace util { type AssertEqual = (() => V extends T ? 1 : 2) extends () => V extends U ? 1 : 2 ? true : false; export const assertEqual: (val: AssertEqual) => AssertEqual; export function assertIs(_arg: T): void; export function assertNever(_x: never): never; export type Omit = Pick>; export type OmitKeys = Pick>; export type MakePartial = Omit & Partial>; export const arrayToEnum: (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: (arr: T[], checker: (arg: T) => any) => T | undefined; export type identity = T; export type flatten = identity<{ [k in keyof T]: T[k]; }>; export type noUndefined = T extends undefined ? never : T; export const isInteger: NumberConstructor["isInteger"]; export function joinValues(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 extends any ? keyof T : never; declare type typeToFlattenedError = { formErrors: U[]; fieldErrors: { [P in allKeys]?: 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 = { _errors: U[]; } & (NonNullable extends [any, ...any[]] ? { [K in keyof NonNullable]?: ZodFormattedError[K], U>; } : NonNullable extends any[] ? { [k: number]: ZodFormattedError[number], U>; } : NonNullable extends object ? { [K in keyof NonNullable]?: ZodFormattedError[K], U>; } : unknown); declare class ZodError extends Error { issues: ZodIssue[]; get errors(): ZodIssue[]; constructor(issues: ZodIssue[]); format(): ZodFormattedError; format(mapper: (issue: ZodIssue) => U): ZodFormattedError; static create: (issues: ZodIssue[]) => ZodError; toString(): string; get message(): string; get isEmpty(): boolean; addIssue: (sub: ZodIssue) => void; addIssues: (subs?: ZodIssue[]) => void; flatten(): typeToFlattenedError; flatten(mapper?: (issue: ZodIssue) => U): typeToFlattenedError; get formErrors(): typeToFlattenedError; } declare type stripPath = T extends any ? util.OmitKeys : never; declare type IssueData = stripPath & { 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[]): SyncParseReturnType; static mergeObjectAsync(status: ParseStatus, pairs: { key: ParseReturnType; value: ParseReturnType; }[]): Promise>; static mergeObjectSync(status: ParseStatus, pairs: { key: SyncParseReturnType; value: SyncParseReturnType; alwaysSet?: boolean; }[]): SyncParseReturnType; } declare type INVALID = { status: "aborted"; }; declare const INVALID: INVALID; declare type DIRTY = { status: "dirty"; value: T; }; declare const DIRTY: (value: T) => DIRTY; declare type OK = { status: "valid"; value: T; }; declare const OK: (value: T) => OK; declare type SyncParseReturnType = OK | DIRTY | INVALID; declare type AsyncParseReturnType = Promise>; declare type ParseReturnType = SyncParseReturnType | AsyncParseReturnType; declare namespace enumUtil { type UnionToIntersectionFn = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never; type GetUnionLast = UnionToIntersectionFn extends () => infer Last ? Last : never; type UnionToTuple = [T] extends [never] ? Tuple : UnionToTuple>, [GetUnionLast, ...Tuple]>; type CastToStringTuple = T extends [string, ...string[]] ? T : never; export type UnionToTupleString = CastToStringTuple>; 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 ZodObject ? ZodObject<{ [k in keyof Shape]: ZodOptional>; }, Params, Catchall> : T extends ZodArray ? ZodArray, Card> : T extends ZodOptional ? ZodOptional> : T extends ZodNullable ? ZodNullable> : T extends ZodTuple ? { [k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial : never; } extends infer PI ? PI extends ZodTupleItems ? ZodTuple : never : never : T; } declare type RefinementCtx = { addIssue: (arg: IssueData) => void; path: (string | number)[]; }; declare type ZodRawShape = { [k: string]: ZodTypeAny; }; declare type ZodTypeAny = ZodType; declare type TypeOf> = T["_output"]; declare type input> = T["_input"]; declare type output> = T["_output"]; declare type CustomErrorParams = Partial>; interface ZodTypeDef { errorMap?: ZodErrorMap; description?: string; } declare type RawCreateParams = { errorMap?: ZodErrorMap; invalid_type_error?: string; required_error?: string; description?: string; } | undefined; declare type SafeParseSuccess = { success: true; data: Output; }; declare type SafeParseError = { success: false; error: ZodError; }; declare type SafeParseReturnType = SafeParseSuccess | SafeParseError; declare abstract class ZodType { readonly _type: Output; readonly _output: Output; readonly _input: Input; readonly _def: Def; get description(): string | undefined; abstract _parse(input: ParseInput): ParseReturnType; _getType(input: ParseInput): string; _getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext; _processInputParams(input: ParseInput): { status: ParseStatus; ctx: ParseContext; }; _parseSync(input: ParseInput): SyncParseReturnType; _parseAsync(input: ParseInput): AsyncParseReturnType; parse(data: unknown, params?: Partial): Output; safeParse(data: unknown, params?: Partial): SafeParseReturnType; parseAsync(data: unknown, params?: Partial): Promise; safeParseAsync(data: unknown, params?: Partial): Promise>; /** Alias of safeParseAsync */ spa: (data: unknown, params?: Partial | undefined) => Promise>; refine(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects; refine(check: (arg: Output) => unknown | Promise, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects; refinement(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects; refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects; _refinement(refinement: RefinementEffect["refinement"]): ZodEffects; superRefine(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects; superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects; constructor(def: Def); optional(): ZodOptional; nullable(): ZodNullable; nullish(): ZodOptional>; array(): ZodArray; promise(): ZodPromise; or(option: T): ZodUnion<[this, T]>; and(incoming: T): ZodIntersection; transform(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise): ZodEffects; default(def: util.noUndefined): ZodDefault; default(def: () => util.noUndefined): ZodDefault; brand(brand?: B): ZodBranded; catch(def: Output): ZodCatch; catch(def: () => Output): ZodCatch; describe(description: string): this; pipe(target: T): ZodPipeline; isOptional(): boolean; isNullable(): boolean; } declare type ZodStringCheck = { kind: "min"; value: number; message?: string; } | { kind: "max"; value: number; message?: string; } | { kind: "length"; value: number; message?: string; } | { kind: "email"; message?: string; } | { kind: "url"; message?: string; } | { kind: "uuid"; message?: string; } | { kind: "cuid"; message?: string; } | { kind: "cuid2"; message?: string; } | { kind: "startsWith"; value: string; message?: string; } | { kind: "endsWith"; value: string; message?: string; } | { kind: "regex"; regex: RegExp; message?: string; } | { kind: "trim"; message?: string; } | { kind: "datetime"; offset: boolean; precision: number | null; message?: string; }; interface ZodStringDef extends ZodTypeDef { checks: ZodStringCheck[]; typeName: ZodFirstPartyTypeKind.ZodString; coerce: boolean; } declare class ZodString extends ZodType { _parse(input: ParseInput): ParseReturnType; protected _regex: (regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage | undefined) => ZodEffects; _addCheck(check: ZodStringCheck): ZodString; email(message?: errorUtil.ErrMessage): ZodString; url(message?: errorUtil.ErrMessage): ZodString; uuid(message?: errorUtil.ErrMessage): ZodString; cuid(message?: errorUtil.ErrMessage): ZodString; cuid2(message?: errorUtil.ErrMessage): ZodString; datetime(options?: string | { message?: string | undefined; precision?: number | null; offset?: boolean; }): ZodString; regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString; startsWith(value: string, message?: errorUtil.ErrMessage): ZodString; endsWith(value: string, message?: errorUtil.ErrMessage): ZodString; min(minLength: number, message?: errorUtil.ErrMessage): ZodString; max(maxLength: number, message?: errorUtil.ErrMessage): ZodString; length(len: number, message?: errorUtil.ErrMessage): ZodString; /** * @deprecated Use z.string().min(1) instead. * @see {@link ZodString.min} */ nonempty: (message?: errorUtil.ErrMessage | undefined) => ZodString; trim: () => ZodString; get isDatetime(): boolean; get isEmail(): boolean; get isURL(): boolean; get isUUID(): boolean; get isCUID(): boolean; get isCUID2(): boolean; get minLength(): number | null; get maxLength(): number | null; static create: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: true | undefined; }) | undefined) => ZodString; } declare type ZodNumberCheck = { kind: "min"; value: number; inclusive: boolean; message?: string; } | { kind: "max"; value: number; inclusive: boolean; message?: string; } | { kind: "int"; message?: string; } | { kind: "multipleOf"; value: number; message?: string; } | { kind: "finite"; message?: string; }; interface ZodNumberDef extends ZodTypeDef { checks: ZodNumberCheck[]; typeName: ZodFirstPartyTypeKind.ZodNumber; coerce: boolean; } declare class ZodNumber extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodNumber; gte(value: number, message?: errorUtil.ErrMessage): ZodNumber; min: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber; gt(value: number, message?: errorUtil.ErrMessage): ZodNumber; lte(value: number, message?: errorUtil.ErrMessage): ZodNumber; max: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber; lt(value: number, message?: errorUtil.ErrMessage): ZodNumber; protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber; _addCheck(check: ZodNumberCheck): ZodNumber; int(message?: errorUtil.ErrMessage): ZodNumber; positive(message?: errorUtil.ErrMessage): ZodNumber; negative(message?: errorUtil.ErrMessage): ZodNumber; nonpositive(message?: errorUtil.ErrMessage): ZodNumber; nonnegative(message?: errorUtil.ErrMessage): ZodNumber; multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber; finite(message?: errorUtil.ErrMessage): ZodNumber; step: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber; get minValue(): number | null; get maxValue(): number | null; get isInt(): boolean; get isFinite(): boolean; } interface ZodBooleanDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodBoolean; coerce: boolean; } declare class ZodBoolean extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: ({ errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { coerce?: boolean | undefined; }) | undefined) => ZodBoolean; } interface ZodAnyDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodAny; } declare class ZodAny extends ZodType { _any: true; _parse(input: ParseInput): ParseReturnType; static create: (params?: RawCreateParams) => ZodAny; } interface ZodUnknownDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodUnknown; } declare class ZodUnknown extends ZodType { _unknown: true; _parse(input: ParseInput): ParseReturnType; static create: (params?: RawCreateParams) => ZodUnknown; } interface ZodVoidDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodVoid; } declare class ZodVoid extends ZodType { _parse(input: ParseInput): ParseReturnType; static create: (params?: RawCreateParams) => ZodVoid; } interface ZodArrayDef extends ZodTypeDef { type: T; typeName: ZodFirstPartyTypeKind.ZodArray; exactLength: { value: number; message?: string; } | null; minLength: { value: number; message?: string; } | null; maxLength: { value: number; message?: string; } | null; } declare type ArrayCardinality = "many" | "atleastone"; declare type arrayOutputType = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][]; declare class ZodArray extends ZodType, ZodArrayDef, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> { _parse(input: ParseInput): ParseReturnType; get element(): T; min(minLength: number, message?: errorUtil.ErrMessage): this; max(maxLength: number, message?: errorUtil.ErrMessage): this; length(len: number, message?: errorUtil.ErrMessage): this; nonempty(message?: errorUtil.ErrMessage): ZodArray; static create: (schema: T_1, params?: RawCreateParams) => ZodArray; } declare namespace objectUtil { export type MergeShapes = { [k in Exclude]: U[k]; } & V; type optionalKeys = { [k in keyof T]: undefined extends T[k] ? k : never; }[keyof T]; type requiredKeys = { [k in keyof T]: undefined extends T[k] ? never : k; }[keyof T]; export type addQuestionMarks = Partial>> & Pick>; export type identity = T; export type flatten = identity<{ [k in keyof T]: T[k]; }>; export type noNeverKeys = { [k in keyof T]: [T[k]] extends [never] ? never : k; }[keyof T]; export type noNever = identity<{ [k in noNeverKeys]: k extends keyof T ? T[k] : never; }>; export const mergeShapes: (first: U, second: T) => T & U; export {}; } declare type extendShape = util.flatten & B>; declare type UnknownKeysParam = "passthrough" | "strict" | "strip"; interface ZodObjectDef extends ZodTypeDef { typeName: ZodFirstPartyTypeKind.ZodObject; shape: () => T; catchall: Catchall; unknownKeys: UnknownKeys; } declare type baseObjectOutputType = objectUtil.addQuestionMarks<{ [k in keyof Shape]: Shape[k]["_output"]; }>; declare type objectOutputType = ZodTypeAny extends Catchall ? objectUtil.flatten> : objectUtil.flatten & { [k: string]: Catchall["_output"]; }>; declare type baseObjectInputType = objectUtil.flatten>; declare type objectInputType = ZodTypeAny extends Catchall ? baseObjectInputType : objectUtil.flatten & { [k: string]: Catchall["_input"]; }>; declare type deoptional = T extends ZodOptional ? deoptional : T extends ZodNullable ? ZodNullable> : T; declare type objectKeyMask = { [k in keyof Obj]?: true; }; declare type noUnrecognized = { [k in keyof Obj]: k extends keyof Shape ? Obj[k] : never; }; declare class ZodObject, Input = objectInputType> extends ZodType, Input> { private _cached; _getCached(): { shape: T; keys: string[]; }; _parse(input: ParseInput): ParseReturnType; get shape(): T; strict(message?: errorUtil.ErrMessage): ZodObject; strip(): ZodObject; passthrough(): ZodObject; /** * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped. * If you want to pass through unknown properties, use `.passthrough()` instead. */ nonstrict: () => ZodObject; extend(augmentation: Augmentation): ZodObject, UnknownKeys, Catchall>; /** * @deprecated Use `.extend` instead * */ augment: (augmentation: Augmentation) => ZodObject<{ [k in keyof (Omit & Augmentation)]: (Omit & Augmentation)[k]; }, UnknownKeys, Catchall, objectOutputType<{ [k in keyof (Omit & Augmentation)]: (Omit & Augmentation)[k]; }, Catchall>, objectInputType<{ [k in keyof (Omit & Augmentation)]: (Omit & Augmentation)[k]; }, Catchall>>; /** * Prior to zod@1.0.12 there was a bug in the * inferred type of merged objects. Please * upgrade if you are experiencing issues. */ merge(merging: Incoming): ZodObject, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>; setKey(key: Key, schema: Schema): ZodObject; catchall(index: Index): ZodObject; pick>(mask: noUnrecognized): ZodObject>, UnknownKeys, Catchall>; omit>(mask: noUnrecognized>): ZodObject, UnknownKeys, Catchall>; deepPartial(): partialUtil.DeepPartial; partial(): ZodObject<{ [k in keyof T]: ZodOptional; }, UnknownKeys, Catchall>; partial>(mask: noUnrecognized>): ZodObject : T[k]; }>, UnknownKeys, Catchall>; required(): ZodObject<{ [k in keyof T]: deoptional; }, UnknownKeys, Catchall>; required>(mask: noUnrecognized>): ZodObject : T[k]; }>, UnknownKeys, Catchall>; keyof(): ZodEnum>; static create: (shape: T_1, params?: RawCreateParams) => ZodObject]: baseObjectOutputType[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>; static strictCreate: (shape: T_1, params?: RawCreateParams) => ZodObject]: baseObjectOutputType[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>; static lazycreate: (shape: () => T_1, params?: RawCreateParams) => ZodObject]: baseObjectOutputType[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>; } declare type AnyZodObject = ZodObject; declare type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>; interface ZodUnionDef> extends ZodTypeDef { options: T; typeName: ZodFirstPartyTypeKind.ZodUnion; } declare class ZodUnion extends ZodType, T[number]["_input"]> { _parse(input: ParseInput): ParseReturnType; get options(): T; static create: (types: T_1, params?: RawCreateParams) => ZodUnion; } interface ZodIntersectionDef extends ZodTypeDef { left: T; right: U; typeName: ZodFirstPartyTypeKind.ZodIntersection; } declare class ZodIntersection extends ZodType, T["_input"] & U["_input"]> { _parse(input: ParseInput): ParseReturnType; static create: (left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection; } declare type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]]; declare type AssertArray = T extends any[] ? T : never; declare type OutputTypeOfTuple = AssertArray<{ [k in keyof T]: T[k] extends ZodType ? T[k]["_output"] : never; }>; declare type OutputTypeOfTupleWithRest = Rest extends ZodTypeAny ? [...OutputTypeOfTuple, ...Rest["_output"][]] : OutputTypeOfTuple; declare type InputTypeOfTuple = AssertArray<{ [k in keyof T]: T[k] extends ZodType ? T[k]["_input"] : never; }>; declare type InputTypeOfTupleWithRest = Rest extends ZodTypeAny ? [...InputTypeOfTuple, ...Rest["_input"][]] : InputTypeOfTuple; interface ZodTupleDef extends ZodTypeDef { items: T; rest: Rest; typeName: ZodFirstPartyTypeKind.ZodTuple; } declare type AnyZodTuple = ZodTuple<[ ZodTypeAny, ...ZodTypeAny[] ] | [], ZodTypeAny | null>; declare class ZodTuple extends ZodType, ZodTupleDef, InputTypeOfTupleWithRest> { _parse(input: ParseInput): ParseReturnType; get items(): T; rest(rest: Rest): ZodTuple; static create: (schemas: T_1, params?: RawCreateParams) => ZodTuple; } interface ZodRecordDef extends ZodTypeDef { valueType: Value; keyType: Key; typeName: ZodFirstPartyTypeKind.ZodRecord; } declare type KeySchema = ZodType; declare type RecordType = [ string ] extends [K] ? Record : [number] extends [K] ? Record : [symbol] extends [K] ? Record : Partial>; declare class ZodRecord extends ZodType, ZodRecordDef, RecordType> { get keySchema(): Key; get valueSchema(): Value; _parse(input: ParseInput): ParseReturnType; get element(): Value; static create(valueType: Value, params?: RawCreateParams): ZodRecord; static create(keySchema: Keys, valueType: Value, params?: RawCreateParams): ZodRecord; } interface ZodFunctionDef = ZodTuple, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef { args: Args; returns: Returns; typeName: ZodFirstPartyTypeKind.ZodFunction; } declare type OuterTypeOfFunction, Returns extends ZodTypeAny> = Args["_input"] extends Array ? (...args: Args["_input"]) => Returns["_output"] : never; declare type InnerTypeOfFunction, Returns extends ZodTypeAny> = Args["_output"] extends Array ? (...args: Args["_output"]) => Returns["_input"] : never; declare class ZodFunction, Returns extends ZodTypeAny> extends ZodType, ZodFunctionDef, InnerTypeOfFunction> { _parse(input: ParseInput): ParseReturnType; parameters(): Args; returnType(): Returns; args[0]>(...items: Items): ZodFunction, Returns>; returns>(returnType: NewReturnType): ZodFunction; implement>(func: F): ReturnType extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType : OuterTypeOfFunction; strictImplement(func: InnerTypeOfFunction): InnerTypeOfFunction; validate: >(func: F) => ReturnType extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType : OuterTypeOfFunction; static create(): ZodFunction, ZodUnknown>; static create>(args: T): ZodFunction; static create(args: T, returns: U): ZodFunction; static create, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: RawCreateParams): ZodFunction; } declare type EnumValues = [string, ...string[]]; declare type Values = { [k in T[number]]: k; }; interface ZodEnumDef extends ZodTypeDef { values: T; typeName: ZodFirstPartyTypeKind.ZodEnum; } declare type Writeable = { -readonly [P in keyof T]: T[P]; }; declare type FilterEnum = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum : [Head, ...FilterEnum] : never; declare type typecast = A extends T ? A : never; declare function createZodEnum>(values: T, params?: RawCreateParams): ZodEnum>; declare function createZodEnum(values: T, params?: RawCreateParams): ZodEnum; declare class ZodEnum extends ZodType> { _parse(input: ParseInput): ParseReturnType; get options(): T; get enum(): Values; get Values(): Values; get Enum(): Values; extract(values: ToExtract): ZodEnum>; exclude(values: ToExclude): ZodEnum>, [string, ...string[]]>>; static create: typeof createZodEnum; } interface ZodPromiseDef extends ZodTypeDef { type: T; typeName: ZodFirstPartyTypeKind.ZodPromise; } declare class ZodPromise extends ZodType, ZodPromiseDef, Promise> { unwrap(): T; _parse(input: ParseInput): ParseReturnType; static create: (schema: T_1, params?: RawCreateParams) => ZodPromise; } declare type RefinementEffect = { type: "refinement"; refinement: (arg: T, ctx: RefinementCtx) => any; }; declare type TransformEffect = { type: "transform"; transform: (arg: T, ctx: RefinementCtx) => any; }; declare type PreprocessEffect = { type: "preprocess"; transform: (arg: T) => any; }; declare type Effect = RefinementEffect | TransformEffect | PreprocessEffect; interface ZodEffectsDef extends ZodTypeDef { schema: T; typeName: ZodFirstPartyTypeKind.ZodEffects; effect: Effect; } declare class ZodEffects, Input = input> extends ZodType, Input> { innerType(): T; sourceType(): T; _parse(input: ParseInput): ParseReturnType; static create: (schema: I, effect: Effect, params?: RawCreateParams) => ZodEffects>; static createWithPreprocess: (preprocess: (arg: unknown) => unknown, schema: I, params?: RawCreateParams) => ZodEffects; } interface ZodOptionalDef extends ZodTypeDef { innerType: T; typeName: ZodFirstPartyTypeKind.ZodOptional; } declare class ZodOptional extends ZodType, T["_input"] | undefined> { _parse(input: ParseInput): ParseReturnType; unwrap(): T; static create: (type: T_1, params?: RawCreateParams) => ZodOptional; } interface ZodNullableDef extends ZodTypeDef { innerType: T; typeName: ZodFirstPartyTypeKind.ZodNullable; } declare class ZodNullable extends ZodType, T["_input"] | null> { _parse(input: ParseInput): ParseReturnType; unwrap(): T; static create: (type: T_1, params?: RawCreateParams) => ZodNullable; } interface ZodDefaultDef extends ZodTypeDef { innerType: T; defaultValue: () => util.noUndefined; typeName: ZodFirstPartyTypeKind.ZodDefault; } declare class ZodDefault extends ZodType, ZodDefaultDef, T["_input"] | undefined> { _parse(input: ParseInput): ParseReturnType; removeDefault(): T; static create: (type: T_1, params: { errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { default: T_1["_input"] | (() => util.noUndefined); }) => ZodDefault; } interface ZodCatchDef extends ZodTypeDef { innerType: T; catchValue: () => C; typeName: ZodFirstPartyTypeKind.ZodCatch; } declare class ZodCatch extends ZodType, unknown> { _parse(input: ParseInput): ParseReturnType; removeCatch(): T; static create: (type: T_1, params: { errorMap?: ZodErrorMap | undefined; invalid_type_error?: string | undefined; required_error?: string | undefined; description?: string | undefined; } & { catch: T_1["_output"] | (() => T_1["_output"]); }) => ZodCatch; } interface ZodBrandedDef extends ZodTypeDef { type: T; typeName: ZodFirstPartyTypeKind.ZodBranded; } declare const BRAND: unique symbol; declare type BRAND = { [BRAND]: { [k in T]: true; }; }; declare class ZodBranded extends ZodType, ZodBrandedDef, T["_input"]> { _parse(input: ParseInput): ParseReturnType; unwrap(): T; } interface ZodPipelineDef extends ZodTypeDef { in: A; out: B; typeName: ZodFirstPartyTypeKind.ZodPipeline; } declare class ZodPipeline extends ZodType, A["_input"]> { _parse(input: ParseInput): ParseReturnType; static create(a: A, b: B): ZodPipeline; } declare enum ZodFirstPartyTypeKind { ZodString = "ZodString", ZodNumber = "ZodNumber", ZodNaN = "ZodNaN", ZodBigInt = "ZodBigInt", ZodBoolean = "ZodBoolean", ZodDate = "ZodDate", ZodSymbol = "ZodSymbol", ZodUndefined = "ZodUndefined", ZodNull = "ZodNull", ZodAny = "ZodAny", ZodUnknown = "ZodUnknown", ZodNever = "ZodNever", ZodVoid = "ZodVoid", ZodArray = "ZodArray", ZodObject = "ZodObject", ZodUnion = "ZodUnion", ZodDiscriminatedUnion = "ZodDiscriminatedUnion", ZodIntersection = "ZodIntersection", ZodTuple = "ZodTuple", ZodRecord = "ZodRecord", ZodMap = "ZodMap", ZodSet = "ZodSet", ZodFunction = "ZodFunction", ZodLazy = "ZodLazy", ZodLiteral = "ZodLiteral", ZodEnum = "ZodEnum", ZodEffects = "ZodEffects", ZodNativeEnum = "ZodNativeEnum", ZodOptional = "ZodOptional", ZodNullable = "ZodNullable", ZodDefault = "ZodDefault", ZodCatch = "ZodCatch", ZodPromise = "ZodPromise", ZodBranded = "ZodBranded", ZodPipeline = "ZodPipeline" } declare const eventTypeType: ZodEnum<["APP_INITIALIZING", "APP_READY"]>; declare const payloadType: ZodAny; declare function logEvent(eventType: TypeOf, payload: TypeOf): void; /** * @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 PlatformType { /** Windows phone */ wp = "wp", /** Android */ android = "android", /** iOS */ iOS = "iOS", 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 JumpStatus { DOING = "doing", DONE = "done" } declare enum ProfileType { user = 1, oa = 0, aliasOA = 2 } declare enum ChatType { user = 1, oa = 0 } declare enum PostFeedType { image = 1, multi_image = 2, link = 4, profile = 5 } declare enum ScanNFCType { cccd = 1 } declare enum ShareSheetType { image = 1, gif = 11, video = 12, link = 4, oa = 5, zmp = 20, multi_image = 21, zmp_deep_link = 4, text = 22 } declare enum OrientationType { auto = 1, portrait = 2, landscape = 3 } declare enum VibrateType { oneShot = 0 } declare enum MediaPickerType { zcamera = 3, zcamera_photo = 1, zcamera_video = 2, zcamera_scan = 7, photo = 4, video = 5, file = 6 } declare enum IAPPayType { "SUBSCRIPTION" = "SUBSCRIPTION", "ONETIME" = "ONETIME" } declare enum ProrationMode { "UNKNOW" = 0, "DEFERRED" = 1, "IMMEDIATE_AND_CHARGE_FULL_PRICE" = 2 } declare enum StatusBarType { normal = 1, hidden = 0, transparent = 2 } declare enum AndroidBottomNavigationBarType { show = 1, hide = 0 } declare enum IOSSafeAreaBottomType { show = 1, hide = 0 } declare enum TextAlignType { left = 0, center = 1 } type PickAttr = { [P in keyof T]: T[Attr]; }[keyof T]; type Common = Record; type FunctionProps = { [key: string]: { lastCall?: number; retry?: number; limit?: number; }; }; type Action = { [K in keyof T]: { versionLive?: { android?: number; iOS?: number; }; appSupport?: boolean; havePermission?: boolean; skipJump?: boolean; requireAccessToken?: boolean; whiteList?: boolean; haveCallback?: boolean; errorList?: { [L in PlatformType]?: { [code: string]: { mapTo: { code: number; message: string; }; message?: string; needMoreDetail?: boolean; }; }; }; }; }; type NativeCallBackData = { error_code: number; error_message: string; action: string; data: any; }; type LogData = { action: string; error: number; message: string; data: any; }; 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; }; }; }; }; }; 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; }; }; }; }; MP_APP_LIFECYCLE_TRACKING: { 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 IAPPayTypeType = "SUBSCRIPTION" | "ONETIME"; type IAPMethodType = "IAP" | "IAP_SANDBOX"; type ProrationModeType = "UNKNOW" | "DEFERRED" | "IMMEDIATE_AND_CHARGE_FULL_PRICE"; type AsyncCallback = { 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 = { action?: keyof typeof ACTION; onProgress?: (progress: number) => void; success?: () => void; fail?: ((err: AsyncCallbackFailObject) => void) | undefined; }; 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; }; 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; }; 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 = { /** * Toàn bộ nội dung trả về của server upload media. */ data: 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 = 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 SaveFileReturns = { savedPath: 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; }; /** * Lấy thông tin của cache theo cơ chế đồng bộ. * * @minimumVersion 2.43.0 * @behavior Ở môi trường phát triển, nhóm API Native Storage sẽ fallback về Local Storage để lưu trữ dữ liệu. Khi chạy bên trong ứng dụng Zalo mobile, Native Storage lưu trữ dữ liệu trong bộ nhớ của ứng dụng Zalo. * @returns {StorageInfo} thông tin của cache. * * @example * ```ts * const { currentSize, limitSize } = nativeStorage.getStorageInfo(); * ``` */ declare function getStorageInfoSync(): StorageInfo; declare const removeItemArgs: ZodString[]; /** * Xoá dữ liệu trong cache theo cơ chế đồng bộ. * * @minimumVersion 2.43.0 * @behavior Ở môi trường phát triển, nhóm API Native Storage sẽ fallback về Local Storage để lưu trữ dữ liệu. Khi chạy bên trong ứng dụng Zalo mobile, Native Storage lưu trữ dữ liệu trong bộ nhớ của ứng dụng Zalo. * * @param {string} key Tên khóa của dữ liệu cần xoá * * @example Xoá từ khoá tìm kiếm cũ khỏi bộ nhớ: * ```ts * nativeStorage.removeItem("recentSearch"); * ``` */ declare function removeItem(key: TypeOf<(typeof removeItemArgs)[0]>): void; /** * Xoá toàn bộ dữ liệu trong cache theo cơ chế đồng bộ. * * @minimumVersion 2.43.0 * @behavior Ở môi trường phát triển, nhóm API Native Storage sẽ fallback về Local Storage để lưu trữ dữ liệu. Khi chạy bên trong ứng dụng Zalo mobile, Native Storage lưu trữ dữ liệu trong bộ nhớ của ứng dụng Zalo. * * @example Xoá toàn bộ dữ liệu trong cache: * ```ts * nativeStorage.clear(); * ``` */ declare function clear(): void; declare const setItemArgs: ZodString[]; /** * Lưu trữ dữ liệu xuống bộ đệm theo cơ chế đồng bộ. Dữ liệu sẽ được lưu ở thiết bị của người dùng. Dữ liệu cũ nhất sẽ bị xoá nếu bộ nhớ đạt giới hạn (5MB). * * @minimumVersion 2.43.0 * @behavior Ở môi trường phát triển, nhóm API Native Storage sẽ fallback về Local Storage để lưu trữ dữ liệu. Khi chạy bên trong ứng dụng Zalo mobile, Native Storage lưu trữ dữ liệu trong bộ nhớ của ứng dụng Zalo. * * @param {string} key Tên khóa mà bạn muốn tạo/cập nhật. * @param {string} value Giá trị mà bạn muốn cung cấp cho khóa mà bạn đang tạo/cập nhật. * @example Lưu từ khoá tìm kiếm vào bộ nhớ: * ```ts * nativeStorage.setItem("recentSearch", keyword); * ``` */ declare function setItem(key: TypeOf<(typeof setItemArgs)[0]>, value: TypeOf<(typeof setItemArgs)[1]>): void; declare const getItemArgs: ZodString[]; /** * Lấy dữ liệu đã lưu ở cache theo cơ chế đồng bộ. * * @minimumVersion 2.43.0 * @behavior Ở môi trường phát triển, nhóm API Native Storage sẽ fallback về Local Storage để lưu trữ dữ liệu. Khi chạy bên trong ứng dụng Zalo mobile, Native Storage lưu trữ dữ liệu trong bộ nhớ của ứng dụng Zalo. * * @param {string} key Tên khóa của dữ liệu cần lấy * @returns {string} Giá trị của khóa cần lấy, hoặc `null` nếu khóa không tồn tại. * @example Lấy giá trị tìm kiếm gần đây * ```ts * const keyword = getItem("recentSearch"); * ``` * * @example Lấy danh sách sản phẩm từ cache. Đảm bảo luôn sử dụng `try/catch` khi parse JSON để tránh lỗi có thể dẫn đến crash app. * ```ts * try { * const data: Product[] = JSON.parse(getItem("cache.productList")); * } catch (error) { * // Không tìm thấy dữ liệu trong cache, hoặc dữ liệu không phải chuỗi JSON hợp lệ * } * ``` */ declare function getItem(key: TypeOf<(typeof getItemArgs)[0]>): string; /** * Minimal `EventEmitter` interface that is molded against the Node.js * `EventEmitter` interface. */ declare class EventEmitter< EventTypes extends EventEmitter.ValidEventTypes = string | symbol, Context extends any = any > { static prefixed: string | boolean; /** * Return an array listing the events for which the emitter has registered * listeners. */ eventNames(): Array>; /** * Return the listeners registered for a given event. */ listeners>( event: T ): Array>; /** * Return the number of listeners listening to a given event. */ listenerCount(event: EventEmitter.EventNames): number; /** * Calls each of the listeners registered for a given event. */ emit>( event: T, ...args: EventEmitter.EventArgs ): boolean; /** * Add a listener for a given event. */ on>( event: T, fn: EventEmitter.EventListener, context?: Context ): this; addListener>( event: T, fn: EventEmitter.EventListener, context?: Context ): this; /** * Add a one-time listener for a given event. */ once>( event: T, fn: EventEmitter.EventListener, context?: Context ): this; /** * Remove the listeners of a given event. */ removeListener>( event: T, fn?: EventEmitter.EventListener, context?: Context, once?: boolean ): this; off>( event: T, fn?: EventEmitter.EventListener, context?: Context, once?: boolean ): this; /** * Remove all listeners, or those of the specified event. */ removeAllListeners(event?: EventEmitter.EventNames): this; } declare namespace EventEmitter { export interface ListenerFn { (...args: Args): void; } export interface EventEmitterStatic { new < EventTypes extends ValidEventTypes = string | symbol, Context = any >(): EventEmitter; } /** * `object` should be in either of the following forms: * ``` * interface EventTypes { * 'event-with-parameters': any[] * 'event-with-example-handler': (...args: any[]) => void * } * ``` */ export type ValidEventTypes = string | symbol | object; export type EventNames = T extends string | symbol ? T : keyof T; export type ArgumentMap = { [K in keyof T]: T[K] extends (...args: any[]) => void ? Parameters : T[K] extends any[] ? T[K] : any[]; }; export type EventListener< T extends ValidEventTypes, K extends EventNames > = T extends string | symbol ? (...args: any[]) => void : ( ...args: ArgumentMap>[Extract] ) => void; export type EventArgs< T extends ValidEventTypes, K extends EventNames > = Parameters>; export const EventEmitter: EventEmitterStatic; } declare namespace eventemitter3 { export { EventEmitter as default, }; } declare function login(args?: AsyncCallback): Promise; /** * 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): Promise; 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 const setNavigationBarTitleArgs: ZodOptional>[]; /** * API đặt lại tiêu đề trên thanh điều hướng của trang hiện tại. * * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} title Tiêu đề mới cần đặt cho trang. * @example Khi người dùng truy cập trang Giỏ hàng: * ```ts * function CartPage() { * useEffect(() => { * setNavigationBarTitle({ title: "Giỏ hàng" }); * }, []); * ``` */ declare function setNavigationBarTitle(args: AsyncVoidCallback & TypeOf<(typeof setNavigationBarTitleArgs)[0]>): Promise; declare const setNavigationBarColorArgs: ZodOptional>; statusBarColor: ZodOptional; }, "strip", ZodTypeAny, { textColor?: "black" | "white" | undefined; statusBarColor?: string | undefined; color: string; }, { textColor?: "black" | "white" | undefined; statusBarColor?: string | undefined; color: string; }>>[]; /** * API đặt lại màu thanh điều hướng của trang hiện tại. * * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} color Giá trị màu, có giá trị hợp lệ là màu thập lục phân, ví dụ `#000000`. Nếu giá trị này rỗng thì thanh điều hướng sẽ bị ẩn. * @param {"black" | "white"} [textColor] Màu của text và icon trên thanh action bar và status bar. Trên thiết bị iOS, chỉ có thể thay đổi màu icon ở thanh action bar. * @param {string} [statusBarColor] Màu của thanh status bar khi thanh điều hướng bị ẩn, có giá trị hợp lệ là màu thập lục phân, ví dụ `#000000`. * @example Đổi màu thanh điều hướng thành màu đen: * ```ts * setNavigationBarColor({ * color: "#000000", * }); * ``` */ declare function setNavigationBarColor(args: AsyncVoidCallback & TypeOf<(typeof setNavigationBarColorArgs)[0]>): Promise; declare const setNavigationBarLeftButtonArgs: ZodOptional; }, "strip", ZodTypeAny, { type: "none" | "home" | "both" | "back"; }, { type: "none" | "home" | "both" | "back"; }>>[]; /** * API đặt lại nút bên trái trên thanh điều hướng của trang hiện tại. * * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {"none" | "back" | "home" | "both"} [type="back"] Loại nút bên trái. * * @example Hiển thị mũi tên quay lại: * ```ts * await setNavigationBarLeftButton({ * type: "back" * }); * ``` * * @example Hiển thị nút trở về trang chủ: * ```ts * await setNavigationBarLeftButton({ * type: "home" * }); * ``` * * @example Hiển thị cả nút quay lại và nút trở về trang chủ: * ```ts * await setNavigationBarLeftButton({ * type: "both" * }); * ``` * * @example Không hiển thị nút bên trái: * ```ts * await setNavigationBarLeftButton({ * type: "none" * }); * ``` */ declare function setNavigationBarLeftButton(args: AsyncVoidCallback & TypeOf<(typeof setNavigationBarLeftButtonArgs)[0]>): Promise; declare const setStorageArgs: ZodOptional; }, "strip", ZodTypeAny, { data: Record; }, { data: Record; }>>[]; /** * @deprecated Use `nativeStorage.setItem(key, value)` instead */ declare function setStorage(args: AsyncCallback & TypeOf<(typeof setStorageArgs)[0]>): Promise; declare const getStorageArgs: ZodOptional; }, "strip", ZodTypeAny, { keys: string[]; }, { keys: string[]; }>>[]; /** * @deprecated Use `nativeStorage.getItem(key)` instead */ declare function getStorage(args: AsyncCallback & TypeOf<(typeof getStorageArgs)[0]>): Promise; /** * @deprecated Use `nativeStorage.getStorageInfo()` instead */ declare function getStorageInfo(args?: AsyncCallback): Promise; declare const removeStorageArgs: ZodOptional; }, "strip", ZodTypeAny, { keys: string[]; }, { keys: string[]; }>>[]; /** * @deprecated Use `nativeStorage.removeItem(key)` instead */ declare function removeStorage(args: AsyncCallback & TypeOf<(typeof removeStorageArgs)[0]>): Promise; declare const clearStorageArgs: ZodOptional; }, "strip", ZodTypeAny, { prefix?: string | undefined; }, { prefix?: string | undefined; }>>[]; /** * @deprecated Use `nativeStorage.clear()` instead */ declare function clearStorage(args: AsyncVoidCallback & TypeOf<(typeof clearStorageArgs)[0]>): Promise; declare const getUserInfoArgs: ZodOptional>; autoRequestPermission: ZodOptional>; }, "strip", ZodTypeAny, { avatarType?: "small" | "normal" | "large" | undefined; autoRequestPermission?: boolean | undefined; }, { avatarType?: "small" | "normal" | "large" | undefined; autoRequestPermission?: boolean | undefined; }>>[]; /** * API truy xuất thông tin của người dùng bao gồm: * - ID: chuỗi định danh người dùng theo Zalo App, được cấp mặc định. * - Tên và Ảnh đại diện: nhằm tuân thủ Nghị Định số 13/2023/NĐ-CP về chính sách bảo vệ dữ liệu cá nhân, thông tin này sẽ yêu cầu người dùng xác nhận cho phép trước khi truy xuất. Nếu ứng dụng cần sử dụng thông tin này, vui lòng truyền param `autoRequestPermission` với giá trị `true`, hoặc sử dụng API [authorize](https://mini.zalo.me/documents/api/authorize/) để yêu cầu người dùng cho phép truy cập trước khi sử dụng API này. * @param {"small" | "normal" | "large"} [avatarType] Kích thước ảnh avatar trả về. Mặc định là ảnh nhỏ nhất. * @param {boolean} [autoRequestPermission=false] Nếu `true`, ứng dụng sẽ tự động hiển thị form yêu cầu người dùng cho phép truy cập thông tin. * @returns {GetUserInfoReturns} Thông tin người dùng bao gồm ID, Tên, và Ảnh đại diện. * @example Tự động yêu cầu quyền truy cập thông tin người dùng: * ```ts * const { userInfo } = await getUserInfo({ * autoRequestPermission: true, * }); * ``` * * @example Xử lý sự kiện người dùng từ chối truy cập thông tin: * ```ts * try { * const { userInfo } = await getUserInfo(); * } catch (error) { * if (error instanceof AppError) { * if (error.code === -1401) { * // Người dùng từ chối cung cấp tên và ảnh đại diện * } * } * } * ``` */ declare function getUserInfo(args?: AsyncCallback & TypeOf<(typeof getUserInfoArgs)[0]>): Promise; /** * API truy xuất kiểu kết nối mạng hiện tại. * * @returns {GetNetworkTypeReturns} kiểu kết nối mạng hiện tại. * * @example Lấy kiểu kết nối mạng hiện tại: * ```ts * const { networkType } = await getNetworkType(); * ``` */ declare function getNetworkType(args?: AsyncCallback): Promise; declare const onNetworkStatusChangeArgs: ZodFunction; }, "strip", ZodTypeAny, { isConnected: boolean; networkType: "unknown" | "none" | "wifi" | "cellular"; }, { isConnected: boolean; networkType: "unknown" | "none" | "wifi" | "cellular"; }>], ZodUnknown>, ZodVoid>[]; /** * Callback để lắng nghe sự kiện thay đổi mạng. * * @param {function} callback - Callback function được gọi khi mạng thay đổi. * @param {Object} callback.data - Dữ liệu trả về khi mạng thay đổi. * @param {boolean} callback.data.isConnected - Trạng thái kết nối mạng. * @param {string} callback.data.networkType - 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). * * @example Lắng nghe sự kiện thay đổi mạng: * ```ts * onNetworkStatusChange(function (data) { * const { isConnected, networkType } = data; * console.log(`Kết nối mạng: ${isConnected}, Loại mạng: ${networkType}`); * }); * ``` */ declare function onNetworkStatusChange(args: TypeOf<(typeof onNetworkStatusChangeArgs)[0]>): void; declare const startBeaconDiscoveryArgs: ZodOptional>>; expire: ZodOptional; monitorInterval: ZodOptional; domain: ZodOptional; scanConfig: ZodOptional; timeBetweenScan: ZodOptional; beaconTimeout: ZodOptional; delayCheckConnectedTimeout: ZodOptional; beaconConnectedTimeout: ZodOptional; }, "strip", ZodTypeAny, { scanTime?: number | undefined; timeBetweenScan?: number | undefined; beaconTimeout?: number | undefined; delayCheckConnectedTimeout?: number | undefined; beaconConnectedTimeout?: number | undefined; }, { scanTime?: number | undefined; timeBetweenScan?: number | undefined; beaconTimeout?: number | undefined; delayCheckConnectedTimeout?: number | undefined; beaconConnectedTimeout?: number | undefined; }>>; items: ZodOptional; distance: ZodOptional; monitor: ZodOptional; movingRange: ZodOptional; }, "strip", ZodTypeAny, { enable?: boolean | undefined; movingRange?: number | undefined; }, { enable?: boolean | undefined; movingRange?: number | undefined; }>>; }, "strip", ZodTypeAny, { id?: string | undefined; distance?: number | undefined; monitor?: { enable?: boolean | undefined; movingRange?: number | undefined; } | undefined; }, { id?: string | undefined; distance?: number | undefined; monitor?: { enable?: boolean | undefined; movingRange?: number | undefined; } | undefined; }>, "many">>; scanFromSource: ZodOptional; }, "strip", ZodTypeAny, { scanningType?: number | undefined; expire?: number | undefined; monitorInterval?: number | undefined; domain?: string | undefined; scanConfig?: { scanTime?: number | undefined; timeBetweenScan?: number | undefined; beaconTimeout?: number | undefined; delayCheckConnectedTimeout?: number | undefined; beaconConnectedTimeout?: number | undefined; } | undefined; items?: { id?: string | undefined; distance?: number | undefined; monitor?: { enable?: boolean | undefined; movingRange?: number | undefined; } | undefined; }[] | undefined; scanFromSource?: string | undefined; }, { scanningType?: number | undefined; expire?: number | undefined; monitorInterval?: number | undefined; domain?: string | undefined; scanConfig?: { scanTime?: number | undefined; timeBetweenScan?: number | undefined; beaconTimeout?: number | undefined; delayCheckConnectedTimeout?: number | undefined; beaconConnectedTimeout?: number | undefined; } | undefined; items?: { id?: string | undefined; distance?: number | undefined; monitor?: { enable?: boolean | undefined; movingRange?: number | undefined; } | undefined; }[] | undefined; scanFromSource?: string | undefined; }>>[]; declare function startBeaconDiscovery(args: AsyncCallback & TypeOf<(typeof startBeaconDiscoveryArgs)[0]>): Promise; declare function stopBeaconDiscovery(args: AsyncCallback): Promise; declare function getBeacons(args?: AsyncCallback): Promise; /** * API yêu cầu đóng Zalo Mini App. * * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * @example Đóng Zalo Mini App: * ```ts * closeApp(); * ``` */ declare function closeApp(args?: AsyncVoidCallback): Promise; declare function scanQRCode(args?: AsyncCallback): Promise; declare const openProfileArgs: ZodOptional; sourceId: ZodOptional; sourceIndex: ZodOptional; }, "strip", ZodTypeAny, { sourceId?: any; sourceIndex?: any; type: "user" | "oa" | "aliasOA"; id: string; }, { sourceId?: any; sourceIndex?: any; type: "user" | "oa" | "aliasOA"; id: string; }>>[]; /** * API cho phép ứng dụng mở profile của User hoặc Official Account. * * @minimumVersion 2.5.3 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {"user" | "oa" | "aliasOA"} type Nhận các giá trị sau: * - `user`: Mở profile User. * - `oa`: Mở profile OA. * - `aliasOA`: Mở profile OA bằng Alias (field id truyền lên là alias của OA). * @param {string} id Id của User hoặc OA. * * @example Mở cửa sổ chat với người dùng: * ```ts * await openProfile({ * type: "user", * id: "user-id", * }); * ``` * * @example Mở profile của Official Account: * ```tsx * await openProfile({ * type: "oa", * id: "oa-id", * }); * ``` */ declare function openProfile(args: AsyncVoidCallback & TypeOf<(typeof openProfileArgs)[0]>): Promise; declare const openChatArgs: ZodOptional; sourceId: ZodOptional; sourceIndex: ZodOptional; message: ZodOptional; }, "strip", ZodTypeAny, { message?: string | undefined; sourceId?: any; sourceIndex?: any; type: "user" | "oa"; id: string; }, { message?: string | undefined; sourceId?: any; sourceIndex?: any; type: "user" | "oa"; id: string; }>>[]; /** * API cho phép ứng dụng mở cửa sổ chat với User hoặc Official Account. Có thể tự động điền nội dung tin nhắn, tuy nhiên việc gửi tin nhắn hay không phụ thuộc vào quyết định của người dùng. * * @minimumVersion 2.5.3 * @minimumVersion 2.20.0: hỗ trợ tự điền nội dung tin nhắn với `message`. * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {"user" | "oa"} type Đối tượng mở cửa sổ chat. * @param {string} id Id của User hoặc Official Account tương ứng. * @param {string} [message] Nội dung sẽ được tự động điền vào ô tin nhắn. Người dùng có thể thay đổi nội dung này trước khi gửi. * * @example Mở cửa sổ chat với người dùng: * ```ts * await openChat({ * type: "user", * id: "xxx", * }); * ``` * * @example Mở cửa sổ chat với Official Account: * ```ts * await openChat({ * type: "oa", * id: "xxx", * }); * ``` * * @example Tự động điền nội dung tin nhắn: * ```ts * await openChat({ * type: "oa", * id: "xxx", * message: `Xin chào, tôi muốn mua sản phẩm này: ${productName}`, * }); * ``` */ declare function openChat(args: AsyncVoidCallback & TypeOf<(typeof openChatArgs)[0]>): Promise; declare const openPostFeedArgs: ZodUnion<[ZodObject<{ type: ZodEnum<["image"]>; data: ZodObject<{ imageUrl: ZodOptional; imageUrls: ZodOptional>; }, "strip", ZodTypeAny, { imageUrl?: string | undefined; imageUrls?: string[] | undefined; }, { imageUrl?: string | undefined; imageUrls?: string[] | undefined; }>; }, "strip", ZodTypeAny, { data: { imageUrl?: string | undefined; imageUrls?: string[] | undefined; }; type: "image"; }, { data: { imageUrl?: string | undefined; imageUrls?: string[] | undefined; }; type: "image"; }>, ZodObject<{ type: ZodEnum<["link"]>; data: ZodObject<{ link: ZodString; title: ZodOptional; thumb: ZodOptional; description: ZodOptional>; }, "strip", ZodTypeAny, { description?: string | undefined; title?: string | undefined; thumb?: string | undefined; link: string; }, { description?: string | undefined; title?: string | undefined; thumb?: string | undefined; link: string; }>; }, "strip", ZodTypeAny, { data: { description?: string | undefined; title?: string | undefined; thumb?: string | undefined; link: string; }; type: "link"; }, { data: { description?: string | undefined; title?: string | undefined; thumb?: string | undefined; link: string; }; type: "link"; }>, ZodObject<{ type: ZodEnum<["profile"]>; data: ZodObject<{ id: ZodOptional; }, "strip", ZodTypeAny, { id?: string | undefined; }, { id?: string | undefined; }>; }, "strip", ZodTypeAny, { data: { id?: string | undefined; }; type: "profile"; }, { data: { id?: string | undefined; }; type: "profile"; }>]>[]; /** * API cho phép ứng dụng mở giao diện chia sẻ để người dùng chia sẻ thông tin lên nhật ký Zalo. * * @minimumVersion 2.5.3 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {"image" | "link" | "profile"} type Nhận các giá trị sau: * - `image`: Chia sẻ hình ảnh. * - `link`: Chia sẻ liên kết. * - `profile`: Chia sẻ profile OA. * @param {Object} data Nội dung cần chia sẻ, tùy thuộc vào `type`. * * @returns {OpenPostFeedReturns} thông tin kết quả chia sẻ. * * @example Chia sẻ hình ảnh: * ```ts * const { status, shareType, numberOfUser } = await openPostFeed({ * type: "image", * data: { * imageUrls: ["link-to-image"], * }, * }); * ``` * * @example Chia sẻ liên kết: * ```ts * const { status, shareType, numberOfUser } = await openPostFeed({ * type: "link", * data: { * link: "http://news.zing.vn/Trung-uong-quyet-dinh-phuong-an-nhan-su-cap-cao-post632739.html", * title: "Trung ương quyết định phương án nhân sự cấp cao", * thumb: "link-to-thumb", * description: "description", * }, * }); * ``` * * @example Chia sẻ profile: * ```ts * const { status, shareType, numberOfUser } = await openPostFeed({ * type: "profile", * data: { * id: "765465772305886642", * }, * }); * ``` */ declare function openPostFeed(args: AsyncCallback & TypeOf<(typeof openPostFeedArgs)[0]>): Promise; declare const followOAArgs: ZodOptional; }, "strip", ZodTypeAny, { showDialogConfirm?: boolean | undefined; id: string; }, { showDialogConfirm?: boolean | undefined; id: string; }>>[]; /** * API yêu cầu theo dõi Official Account. Khi gọi API, một thông báo sẽ được hiển thị. * * @minimumVersion 2.5.3 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} id Id của Official Account cần theo dõi. * * @example Theo dõi Official Account: * ```ts * await followOA({ * id: "xxxx", * }); * ``` * * @example Xử lý lỗi: * ```ts * try { * await followOA({ * id: "xxxx", * }); * console.log("Theo dõi thành công"); * } catch (error) { * const code = (error as AppError).code; * if (code === -201) { * console.log("Người dùng đã từ chối theo dõi"); * } else { * console.log("Lỗi khác"); * } * } * ``` */ declare function followOA(args: AsyncVoidCallback & TypeOf<(typeof followOAArgs)[0]>): Promise; declare const unfollowOAArgs: ZodOptional>[]; /** * API cho phép ứng dụng hiển thị giao diện yêu cầu bỏ theo dõi Official Account để người dùng xác nhận. * * @minimumVersion 2.5.3 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} id Id của Official Account. * * @example Hiển thị giao diện yêu cầu bỏ theo dõi Official Account: * ```ts * await unfollowOA({ * id: "xxxx", * }); * ``` */ declare function unfollowOA(args: AsyncVoidCallback & TypeOf<(typeof unfollowOAArgs)[0]>): Promise; declare const openShareSheetArgs: ZodUnion<[ZodObject<{ type: ZodEnum<["text"]>; data: ZodObject<{ text: ZodString; description: ZodOptional>; autoParseLink: ZodOptional>; }, "strip", ZodTypeAny, { description?: string | undefined; autoParseLink?: boolean | undefined; text: string; }, { description?: string | undefined; autoParseLink?: boolean | undefined; text: string; }>; }, "strip", ZodTypeAny, { data: { description?: string | undefined; autoParseLink?: boolean | undefined; text: string; }; type: "text"; }, { data: { description?: string | undefined; autoParseLink?: boolean | undefined; text: string; }; type: "text"; }>, ZodObject<{ type: ZodEnum<["image"]>; data: ZodObject<{ imageUrl: ZodOptional; imageUrls: ZodOptional>; }, "strip", ZodTypeAny, { imageUrl?: string | undefined; imageUrls?: string[] | undefined; }, { imageUrl?: string | undefined; imageUrls?: string[] | undefined; }>; }, "strip", ZodTypeAny, { data: { imageUrl?: string | undefined; imageUrls?: string[] | undefined; }; type: "image"; }, { data: { imageUrl?: string | undefined; imageUrls?: string[] | undefined; }; type: "image"; }>, ZodObject<{ type: ZodEnum<["link"]>; data: ZodObject<{ link: ZodString; chatOnly: ZodOptional; }, "strip", ZodTypeAny, { chatOnly?: boolean | undefined; link: string; }, { chatOnly?: boolean | undefined; link: string; }>; }, "strip", ZodTypeAny, { data: { chatOnly?: boolean | undefined; link: string; }; type: "link"; }, { data: { chatOnly?: boolean | undefined; link: string; }; type: "link"; }>, ZodObject<{ type: ZodEnum<["oa"]>; data: ZodObject<{ id: ZodString; }, "strip", ZodTypeAny, { id: string; }, { id: string; }>; }, "strip", ZodTypeAny, { data: { id: string; }; type: "oa"; }, { data: { id: string; }; type: "oa"; }>, ZodObject<{ type: ZodEnum<["gif"]>; data: ZodObject<{ gifUrl: ZodString; imageUrl: ZodOptional; width: ZodOptional; height: ZodOptional; }, "strip", ZodTypeAny, { height?: number | undefined; width?: number | undefined; imageUrl?: string | undefined; gifUrl: string; }, { height?: number | undefined; width?: number | undefined; imageUrl?: string | undefined; gifUrl: string; }>; }, "strip", ZodTypeAny, { data: { height?: number | undefined; width?: number | undefined; imageUrl?: string | undefined; gifUrl: string; }; type: "gif"; }, { data: { height?: number | undefined; width?: number | undefined; imageUrl?: string | undefined; gifUrl: string; }; type: "gif"; }>, ZodObject<{ type: ZodEnum<["video"]>; data: ZodObject<{ videoThumb: ZodString; videoUrl: ZodString; width: ZodOptional; height: ZodOptional; }, "strip", ZodTypeAny, { height?: number | undefined; width?: number | undefined; videoThumb: string; videoUrl: string; }, { height?: number | undefined; width?: number | undefined; videoThumb: string; videoUrl: string; }>; }, "strip", ZodTypeAny, { data: { height?: number | undefined; width?: number | undefined; videoThumb: string; videoUrl: string; }; type: "video"; }, { data: { height?: number | undefined; width?: number | undefined; videoThumb: string; videoUrl: string; }; type: "video"; }>, ZodObject<{ type: ZodEnum<["zmp", "zmp_deep_link"]>; data: ZodObject<{ title: ZodString; thumbnail: ZodString; path: ZodOptional; description: ZodOptional>; }, "strip", ZodTypeAny, { path?: string | undefined; description?: string | undefined; title: string; thumbnail: string; }, { path?: string | undefined; description?: string | undefined; title: string; thumbnail: string; }>; }, "strip", ZodTypeAny, { data: { path?: string | undefined; description?: string | undefined; title: string; thumbnail: string; }; type: "zmp" | "zmp_deep_link"; }, { data: { path?: string | undefined; description?: string | undefined; title: string; thumbnail: string; }; type: "zmp" | "zmp_deep_link"; }>]>[]; /** * API cho phép ứng dụng mở giao diện chia sẻ để người dùng chia sẻ thông tin với bạn bè Zalo. * * @minimumVersion 2.5.3 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {"text" | "image" | "link" | "oa" | "gif" | "video" | "zmp" | "zmp_deep_link"} type Nhận các giá trị sau: * - `text`: Chia sẻ văn bản. * - `image`: Chia sẻ hình ảnh. * - `link`: Chia sẻ liên kết. * - `oa`: Chia sẻ Official Account. * - `gif`: Chia sẻ ảnh động. * - `video`: Chia sẻ video. * - `zmp`: Chia sẻ page hiện tại của Zalo Mini App. * - `zmp_deep_link`: Chia sẻ page hiện tại của Zalo Mini App thông qua deep link (hỗ trợ từ API 2.25.7). * @param {object} data Nội dung cần chia sẻ, tùy thuộc vào `type`. * * @returns {OpenShareSheetReturns} thông tin kết quả chia sẻ. * * @example Chia sẻ văn bản: * ```ts * const data = await openShareSheet({ * type: "text", * data: { * text: "My Zalo Mini App - HomePage", * }, * }); * console.log(data); * ``` * * @example Chia sẻ hình ảnh: * ```ts * const data = await openShareSheet({ * type: "image", * data: { * imageUrls: ["http://dev.org.zads.zdn.vn/2a16c7fefbbb12e54baa"], * }, * }); * console.log(data); * ``` * * @example Chia sẻ liên kết: * ```ts * const data = await openShareSheet({ * type: "link", * data: { * link: "http://news.zing.vn/Trung-uong-quyet-dinh-phuong-an-nhan-su-cap-cao-post632739.html", * chatOnly: false, * }, * }); * console.log(data); * ``` * * @example Chia sẻ Official Account: * ```ts * const data = await openShareSheet({ * type: "oa", * data: { * id: "765465772305886642", * }, * }); * console.log(data); * ``` * * @example Chia sẻ GIF: * ```ts * const data = await openShareSheet({ * type: "gif", * data: { * imageUrl: "http://dev.org.zads.zdn.vn/2a16c7fefbbb12e54baa", * gifUrl: "http://dev.org.zads.zdn.vn/fc88fe60c2252b7b7234", * width: 480, * height: 270, * }, * }); * console.log(data); * ``` * * @example Chia sẻ video: * ```ts * const data = await openShareSheet({ * type: "video", * data: { * videoThumb: "http://dev.org.zads.zdn.vn/fc88fe60c2252b7b7234", * videoUrl: "http://dev.org.zads.zdn.vn/fc88fe60c2252b7b7234", * width: 480, * height: 270, * }, * }); * console.log(data); * ``` * * @example Chia sẻ page hiện tại của Zalo Mini App: * ```ts * const data = await openShareSheet({ * type: "zmp", * data: { * title: "My Zalo Mini App - HomePage", * description: "Home page", * thumbnail: "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg", * }, * }); * console.log(data); * ``` * * @example Chia sẻ page hiện tại của Zalo Mini App thông qua deep link: * ```ts * const data = await openShareSheet({ * type: "zmp_deep_link", * data: { * title: "My Zalo Mini App - HomePage", * description: "Home page", * thumbnail: "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg", * }, * }); * console.log(data); * ``` */ declare function openShareSheet(args: AsyncCallback & TypeOf<(typeof openShareSheetArgs)[0]>): Promise; declare function requestCameraPermission(args?: AsyncCallback): Promise; declare const createShortcutArgs: ZodOptional>; }, "strip", ZodTypeAny, { params?: Record | undefined; }, { params?: Record | undefined; }>>[]; /** * API cho phép ứng dụng tạo shortcut trên màn hình chờ. * * Chi tiết về giao diện tạo shortcut trên cả hai nền tảng vui lòng tham khảo tại [đây](https://mini.zalo.me/documents/api/createShortcut/). * * @minimumVersion 2.5.3: chỉ hỗ trợ tạo shortcut trên Android. * @minimumVersion 2.16.1: hỗ trợ tạo shortcut trên cả iOS và Android. * @minimumVersion 2.16.3: hỗ trợ thêm params vào shortcut. * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {Record} [params] Params cần thêm vào Zalo Mini App khi mở.. * * @example Tạo shortcut đơn giản: * ```ts * await createShortcut(); * ``` * * @example Tạo shortcut với params: * ```ts * await createShortcut({ * params: { * utm_source: "shortcut", * }, * }); * ``` */ declare function createShortcut(args?: AsyncCallback & TypeOf<(typeof createShortcutArgs)[0]>): Promise; declare const openBioAuthenticationArgs: ZodOptional>; subTitle: ZodOptional>; negativeButtonText: ZodOptional>; }, "strip", ZodTypeAny, { title?: string | undefined; subTitle?: string | undefined; negativeButtonText?: string | undefined; }, { title?: string | undefined; subTitle?: string | undefined; negativeButtonText?: string | undefined; }>>; requireFingerprint: ZodOptional>; }, "strip", ZodTypeAny, { ui?: { title?: string | undefined; subTitle?: string | undefined; negativeButtonText?: string | undefined; } | undefined; requireFingerprint?: boolean | undefined; secretData: string; }, { ui?: { title?: string | undefined; subTitle?: string | undefined; negativeButtonText?: string | undefined; } | undefined; requireFingerprint?: boolean | undefined; secretData: string; }>>[]; declare function openBioAuthentication(args: AsyncCallback & TypeOf<(typeof openBioAuthenticationArgs)[0]>): Promise; declare function checkStateBioAuthentication(args?: AsyncCallback): Promise; declare const showToastArgs: ZodOptional>[]; /** * API hiển thị một thông báo ngắn trên màn hình. * * @minimumVersion 2.5.3 * * @param {string} message Nội dung thông báo cần hiển thị. * * @example Hiện thông báo đặt hàng thành công: * ```ts * showToast({ * message: "Đặt hàng thành công!" * }); * ``` */ declare function showToast(args: AsyncVoidCallback & TypeOf<(typeof showToastArgs)[0]>): Promise; /** * API để ẩn bàn phím ảo. * * @minimumVersion 2.5.3 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @example Chủ động ẩn bàn phím ảo: * ```ts * hideKeyboard(); * ``` */ declare function hideKeyboard(args?: AsyncVoidCallback): Promise; declare const openPhoneArgs: ZodObject<{ phoneNumber: ZodString; }, "strip", ZodTypeAny, { phoneNumber: string; }, { phoneNumber: string; }>[]; /** * API cho phép mở màn hình cuộc gọi với một số điện thoại cụ thể. * * @minimumVersion 2.5.3 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} phoneNumber Số điện thoại cần gọi. * * @example Mở màn hình cuộc gọi với số điện thoại cụ thể: * ```ts * await openPhone({ * phoneNumber: "0123456789", * }); * ``` * * @example Số điện thoại có thể bắt đầu bằng mã quốc tế: * ```ts * await openPhone({ * phoneNumber: "+84123456789", * }); * ``` */ declare function openPhone(args: AsyncVoidCallback & TypeOf<(typeof openPhoneArgs)[0]>): Promise; declare const openSMSArgs: ZodObject<{ content: ZodString; phoneNumber: ZodString; }, "strip", ZodTypeAny, { content: string; phoneNumber: string; }, { content: string; phoneNumber: string; }>[]; /** * API mở ứng dụng tin nhắn với nội dung và số điện thoại cụ thể. * * @minimumVersion 2.5.3 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} content Nội dung tin nhắn. * @param {string} phoneNumber Số điện thoại nhận tin nhắn. * * @example Mở ứng dụng tin nhắn với nội dung và số điện thoại cụ thể: * ```ts * await openSMS({ * content: "text", * phoneNumber: "+84123456789", * }); * ``` */ declare function openSMS(args: AsyncVoidCallback & TypeOf<(typeof openSMSArgs)[0]>): Promise; declare const viewOAQrArgs: ZodObject<{ id: ZodString; displayName: ZodOptional>; }, "strip", ZodTypeAny, { displayName?: string | undefined; id: string; }, { displayName?: string | undefined; id: string; }>[]; /** * API cho phép ứng dụng hiển thị QR code của OA. * * @minimumVersion 2.5.3 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} id Id của OA. * @param {string} [displayName] Tên hiển thị của QR code. * * @example Hiển thị QR code của OA: * ```ts * await viewOAQr({ * id: "765465772305886642", * displayName: "Galaxy Cinema", * }); * ``` */ declare function viewOAQr(args: AsyncVoidCallback & TypeOf<(typeof viewOAQrArgs)[0]>): Promise; declare const keepScreenArgs: ZodObject<{ keepScreenOn: ZodBoolean; }, "strip", ZodTypeAny, { keepScreenOn: boolean; }, { keepScreenOn: boolean; }>[]; /** * API cho phép ứng dụng giữ cho màn hình luôn bật. Ví dụ: trường hợp play video. Khi thoát khỏi ứng dụng, cài đặt này sẽ quay về mặc định để tránh màn hình luôn bật. * * @minimumVersion 2.5.3 * @requirePermission Cần xin Cấp quyền sử dụng các API này cho Mini App ID tại trang Quản lý ứng dụng. Nếu không, sẽ bị [lỗi với người dùng bình thường, mặc dù Developer/Admin thì không bị](https://mini.zalo.me/community/8746968970844796879/loi-chi-xay-ra-voi-nguoi-dung-binh-thuong-con-developer-admin-thi-khong-bi). * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {boolean} keepScreenOn Truyền `true` để giữ màn hình luôn bật. Truyền `false` để tắt chế độ này. * * @example Giữ màn hình luôn bật: * ```ts * await keepScreen({ * keepScreenOn: true, * }); * ``` * * @example Tắt chế độ giữ màn hình: * ```ts * await keepScreen({ * keepScreenOn: false, * }); * ``` */ declare function keepScreen(args: AsyncCallback & TypeOf<(typeof keepScreenArgs)[0]>): Promise; declare function onKeepScreen(args?: AsyncVoidCallback): Promise; declare function offKeepScreen(args?: AsyncVoidCallback): Promise; declare const saveImageToGalleryArgs: ZodOptional; imageUrl: ZodOptional; }, "strip", ZodTypeAny, { imageUrl?: string | undefined; imageBase64Data?: string | undefined; }, { imageUrl?: string | undefined; imageBase64Data?: string | undefined; }>>[]; /** * Lưu ảnh vào thư viện media của thiết bị. * * @minimumVersion 2.16.0 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} [imageBase64Data] Giá trị base64 của ảnh cần lưu. * @param {string} [imageUrl] Đường dẫn của ảnh cần lưu. * @param {(progress: number) => void} [onProgress] Callback function tiến độ tải file. Với `progress` là số từ 0 đến 100%. * * @example Thông báo một lần sau khi lưu ảnh xong: * ```ts * await saveImageToGallery({ * imageUrl: "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg", * }); * console.log("Lưu ảnh thành công!"); * ``` * * @example Xử lý lỗi khi lưu ảnh: * ```ts * try { * await saveImageToGallery({ * imageUrl: "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg", * }); * } catch (error) { * console.error(error); * } * ``` * * @example Báo cáo tiến độ lưu ảnh: * ```ts * await saveImageToGallery({ * imageUrl: "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg", * onProgress: (progress) => { * console.log(`Đã lưu được ${progress}%...`); * }, * }); * console.log("Lưu ảnh thành công!"); * ``` */ declare function saveImageToGallery(args: AsyncProgressCallback & TypeOf<(typeof saveImageToGalleryArgs)[0]>): Promise; declare const saveVideoToGalleryArgs: ZodOptional>[]; /** * Lưu video vào thư viện media của thiết bị. * * @minimumVersion 2.44.0 * @requirePermission Cần xin Cấp quyền sử dụng các API này cho Mini App ID tại trang Quản lý ứng dụng. Nếu không, sẽ bị [lỗi với người dùng bình thường, mặc dù Developer/Admin thì không bị](https://mini.zalo.me/community/8746968970844796879/loi-chi-xay-ra-voi-nguoi-dung-binh-thuong-con-developer-admin-thi-khong-bi). * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} videoUrl Đường dẫn của video cần lưu. * @param {(progress: number) => void} [onProgress] Callback function tiến độ tải file. Với `progress` là số từ 0 đến 100%. * * @example Thông báo một lần sau khi lưu video xong: * ```ts * await saveVideoToGallery({ * videoUrl: "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4", * }); * console.log("Lưu video thành công!"); * ``` * * @example Xử lý lỗi khi lưu video: * ```ts * try { * await saveVideoToGallery({ * videoUrl: "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4", * }); * } catch (error) { * console.error(error); * } * ``` * * @example Báo cáo tiến độ lưu video: * ```ts * await saveVideoToGallery({ * videoUrl: "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4", * onProgress: (progress) => { * console.log(`Đã lưu được ${progress}%...`); * }, * }); * console.log("Lưu video thành công!"); * ``` */ declare function saveVideoToGallery(args: AsyncProgressCallback & TypeOf<(typeof saveVideoToGalleryArgs)[0]>): Promise; declare const openMiniAppArgs: ZodObject<{ appId: ZodString; path: ZodOptional; params: ZodOptional>; }, "strip", ZodTypeAny, { path?: string | undefined; params?: Record | undefined; appId: string; }, { path?: string | undefined; params?: Record | undefined; appId: string; }>[]; /** * API dùng để mở một Zalo Mini App khác. Có thể mở với một đường dẫn cụ thể bên trong Mini App đó, hoặc đính kèm các tham số bổ sung. * * @minimumVersion 2.7.0 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} appId ID của Zalo Mini App cần mở. * @param {string} [path] Đường dẫn đến một trang cụ thể bên trong Zalo Mini App cần mở. * @param {Record} [params] Object chứa các tham số bổ sung cần đính kèm với đường dẫn. * * * @example Mở Mini App "ZaUI Coffee": * ```ts * openMiniApp({ * appId: "194839900003483517", * }); * ``` * * @example Mở tab "Cá nhân" bên trong "ZaUI Coffee": * ```ts * openMiniApp({ * appId: "194839900003483517", * path: "/profile", * }); * ``` * * @example Mở "ZaUI Coffee" với `utm_campaign` tracking: * ```ts * openMiniApp({ * appId: "194839900003483517", * params: { * utm_campaign: "spring_promo", * }, * }); * ``` */ declare function openMiniApp(args: AsyncVoidCallback & TypeOf<(typeof openMiniAppArgs)[0]>): Promise; declare const vibrateArgs: ZodObject<{ type: ZodOptional>>; milliseconds: ZodOptional; }, "strip", ZodTypeAny, { type?: "oneShot" | undefined; milliseconds?: number | undefined; }, { type?: "oneShot" | undefined; milliseconds?: number | undefined; }>[]; /** * API rung thiết bị. * * @minimumVersion 2.9.8 * @requirePermission Cần xin Cấp quyền sử dụng các API này cho Mini App ID tại trang Quản lý ứng dụng. Nếu không, sẽ bị [lỗi với người dùng bình thường, mặc dù Developer/Admin thì không bị](https://mini.zalo.me/community/8746968970844796879/loi-chi-xay-ra-voi-nguoi-dung-binh-thuong-con-developer-admin-thi-khong-bi). * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} [type="oneShot"] Loại rung, hiện tại chỉ hỗ trợ `oneShot`. * @param {number} [milliseconds=500] Thời gian rung (tính bằng mili giây). Chỉ có thể thiết lập trên thiết bị Android. * * @example Rung thiết bị trong 500 mili giây: * ```ts * await vibrate(); * ``` * * @example Rung thiết bị trong 1 giây: * ```ts * await vibrate({ * type: "oneShot", * milliseconds: 1000 * }) * ``` */ declare function vibrate(args?: AsyncVoidCallback & TypeOf<(typeof vibrateArgs)[0]>): Promise; declare const openWebviewArgs: ZodObject<{ url: ZodString; config: ZodOptional>>; leftButton: ZodOptional>>; }, "strip", ZodTypeAny, { style?: "normal" | "bottomSheet" | undefined; leftButton?: "none" | "back" | undefined; }, { style?: "normal" | "bottomSheet" | undefined; leftButton?: "none" | "back" | undefined; }>>; }, "strip", ZodTypeAny, { config?: { style?: "normal" | "bottomSheet" | undefined; leftButton?: "none" | "back" | undefined; } | undefined; url: string; }, { config?: { style?: "normal" | "bottomSheet" | undefined; leftButton?: "none" | "back" | undefined; } | undefined; url: string; }>[]; /** * Tải một trang web bằng Webview. * Để biết khi nào Webview được đóng, vui lòng lắng nghe sự kiện [WebviewClosed](https://mini.zalo.me/documents/api/events/#webviewclosed). * * @minimumVersion 2.11.0 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} url Đường dẫn của trang web cần tải. * @param {"bottomSheet" | "normal"} [config.style="bottomSheet"] Kiểu hiển thị của Webview: * - `bottomSheet`: Cửa sổ hiển thị từ dưới đáy của màn hình. * - `normal`: Cửa sổ hiển thị toàn màn hình. * @param {"back" | "none"} [config.leftButton="back"] Nút bên trái thanh header: (chỉ hỗ trợ cho style 'bottomSheet') * - `back`: Nút quay về trang trước. * - `none`: không hiển thị nút. * * @example Mở trang chủ của Zalo Mini App: * ```ts * openWebview({ * url: "https://mini.zalo.me", * }); * ``` * @example Mở trang chủ của Zalo Mini App toàn màn hình: * ```ts * openWebview({ * url: "https://mini.zalo.me", * config: { * style: "normal", * } * }); * ``` */ declare function openWebview(args: AsyncCallback & TypeOf<(typeof openWebviewArgs)[0]>): Promise; /** * API truy xuất các tham số được gửi đến trang hiện tại. * * @minimumVersion 2.11.0 * @returns {Record} tất cả tham số dưới dạng key-value. * * @example Lấy ID của sản phẩm được truyền vào trong URL: * ```ts * const { id } = getRouteParams(); * ``` */ declare function getRouteParams(): Record; /** * API truy xuất thông tin Zalo Mini App hiện tại. * @returns {GetAppInfoReturns} các thông tin Zalo Mini App hiện tại. * @example Lấy tên và phiên bản live hiện tại: * ```ts * const { name, version } = await getAppInfo({}); * ``` */ declare function getAppInfo(args?: AsyncCallback): Promise; declare const sendDataToPreviousMiniAppArgs: ZodObject<{ data: ZodAny; }, "strip", ZodTypeAny, { data?: any; }, { data?: any; }>[]; /** * Gửi dữ liệu cho Zalo Mini App trước đó. * Zalo Mini App trước đó cần lắng nghe sự kiện [OnDataCallback](https://mini.zalo.me/documents/api/events/#ondatacallback) để nhận dữ liệu. * Nếu API được gọi nhiều lần thì dữ liệu cuối cùng sẽ được gửi đi. * * @minimumVersion 2.13.0 * * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {any} data Dữ liệu cần gửi. * * @example Ví dụ có 2 Zalo Mini App A với id là `2953132499190403100` và B với id là `2953132499190403200`. Để B có thể gửi dữ liệu cho A, chúng ta cần thực hiện những bước sau: * * 1. Lắng nghe sự kiện [OnDataCallback](https://mini.zalo.me/documents/api/events/#ondatacallback) ở app A: * ```ts * import { events, EventName } from "zmp-sdk/apis"; * * const callback = (data) => { * console.log(data); * }; * * events.on(EventName.OnDataCallback, callback); * ``` * * 2. Gọi API [openMiniApp](https://mini.zalo.me/documents/api/openMiniApp/) để chuyển đến app B: * ```ts * import { openMiniApp } from "zmp-sdk/apis"; * * openMiniApp({ * appId: "2953132499190403200", * success: (res) => { * // xử lý khi gọi API thành công * }, * fail: (error) => { * // xử lý khi gọi API thất bại * console.log(error); * }, * }); * ``` * * 3. Ở app B, gửi dữ liệu cho app A: * ```ts * import { sendDataToPreviousMiniApp } from "zmp-sdk/apis"; * * sendDataToPreviousMiniApp({ * data: "Success", * success: (res) => { * // xử lý khi gọi API thành công * }, * fail: (err) => { * // xử lý khi gọi API thất bại * console.log(err); * }, * }); * ``` * * 4. Tắt app B bằng API [closeApp](https://mini.zalo.me/documents/api/closeApp/) hoặc nhấn nút tắt Mini App trên header: * ```ts * import { closeApp } from "zmp-sdk/apis"; * * closeApp(); * ``` * * 5. Sau khi app B đóng hoàn toàn, app A sẽ nhận được dữ liệu đã gửi. */ declare function sendDataToPreviousMiniApp(args: AsyncVoidCallback & TypeOf<(typeof sendDataToPreviousMiniAppArgs)[0]>): Promise; /** * Lấy thông tin số điện thoại của người dùng. Khi gọi API, một thông báo xin cấp quyền sẽ được hiển thị. Mini App chỉ lấy được thông tin số điện thoại nếu người dùng đồng ý cấp quyền chia sẻ số điện thoại. * * Lưu ý, để giúp các nhà phát triển Mini App sử dụng flow xin quyền một cách hiệu quả, cũng như phù hợp với [chính sách của Zalo Mini App điều 3.3.4](https://mini.zalo.me/documents/zalo-mini-app-developer-program-agreement/#33-api-quy%E1%BB%81n-truy-c%E1%BA%ADp), Mini App Team đã đưa ra một số gợi ý thiết kế trải nghiệm như thông tin bên dưới. Nhà phát triển cần giải thích rõ ràng và trực quan mục đích xin quyền để người dùng dễ dàng hiểu và đồng ý cung cấp thông tin. * * - **Trường hợp chỉ cần số điện thoại cho một số tính năng nhất định**: Chỉ nên yêu cầu người dùng chia sẻ số điện thoại khi người dùng bắt đầu sử dụng các tính năng đó như khi tiến hành đặt hàng, đăng ký tham dự sự kiện... * - **Trường hợp bắt buộc phải cung cấp số điện thoại để sử dụng ứng dụng**: Cần hiển thị UI Onboarding giải thích cụ thể lý do người dùng cần phải cung cấp số điện thoại. * * Nhằm đảm bảo trải nghiệm thoải mái của người dùng Mini App, chúng tôi sẽ từ chối xét duyệt cho những Mini App có luồng xin cấp quyền chưa rõ ràng, không nêu được mục đích xin quyền đến người dùng. * * @minimumVersion 2.13.0 * @requirePermission Cần xin Cấp quyền sử dụng các API này cho Mini App ID tại trang Quản lý ứng dụng. Nếu không, sẽ bị [lỗi với người dùng bình thường, mặc dù Developer/Admin thì không bị](https://mini.zalo.me/community/8746968970844796879/loi-chi-xay-ra-voi-nguoi-dung-binh-thuong-con-developer-admin-thi-khong-bi). * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @returns {GetPhoneNumberReturns} token để truy xuất thông tin số điện thoại. * * @example * 1. Ở Zalo Mini App, gọi API này để lấy token số điện thoại: * ```ts * const { token } = await getPhoneNumber(); * ``` * 2. Dùng fetch hoặc axios để gửi token này lên server. Nếu không, bạn sẽ bị [lỗi khi gọi các API Server-Server từ Mini App](https://mini.zalo.me/community/9107262438710014159/loi-khi-goi-cac-api-server-server-tu-mini-app). * 3. Server chuyển đổi token thành thông tin số điện thoại và trả về cho Mini App theo [hướng dẫn sau](https://mini.zalo.me/documents/api/getPhoneNumber/#hướng-dẫn-chuyển-đổi-token-thành-số-điện-thoại-người-dùng). */ declare function getPhoneNumber(args?: AsyncCallback): Promise; declare const openProfilePickerArgs: ZodObject<{ maxProfile: ZodDefault>; }, "strip", ZodTypeAny, { maxProfile: number; }, { maxProfile?: number | undefined; }>[]; /** * API mở cửa sổ chọn bạn bè trong Zalo, API sẽ trả về danh sách những người được chọn. * * @minimumVersion 2.16.1 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {number} [maxProfile=1] Số lượng bạn bè tối đa được chọn. Giới hạn trong khoảng 1 đến 10. * * @returns {OpenProfilePickerReturns} danh sách những bạn bè được chọn. * * @example Chọn tối đa 2 bạn bè trong danh sách bạn bè của người dùng: * ```ts * const { users } = await openProfilePicker({ * maxProfile: 2, * }); * console.log(users); * ``` */ declare function openProfilePicker(args?: AsyncCallback & TypeOf<(typeof openProfilePickerArgs)[0]>): Promise; declare const connectWifiArgs: ZodObject<{ SSID: ZodString; password: ZodOptional; hiddenSSID: ZodOptional; }, "strip", ZodTypeAny, { password?: string | undefined; hiddenSSID?: boolean | undefined; SSID: string; }, { password?: string | undefined; hiddenSSID?: boolean | undefined; SSID: string; }>[]; declare function connectWifi(args: AsyncVoidCallback & TypeOf<(typeof connectWifiArgs)[0]>): Promise; declare const openMediaPickerArgs: ZodObject<{ type: ZodEnum<["video", "photo", "file", "zcamera", "zcamera_photo", "zcamera_video", "zcamera_scan"]>; serverUploadUrl: ZodString; maxItemSize: ZodOptional; editView: ZodOptional; aspectRatio: ZodOptional; }, "strip", ZodTypeAny, { enable?: boolean | undefined; aspectRatio?: string | undefined; }, { enable?: boolean | undefined; aspectRatio?: string | undefined; }>>; silentRequest: ZodOptional; maxSelectItem: ZodOptional; }, "strip", ZodTypeAny, { maxItemSize?: number | undefined; editView?: { enable?: boolean | undefined; aspectRatio?: string | undefined; } | undefined; silentRequest?: boolean | undefined; maxSelectItem?: number | undefined; type: "video" | "zcamera" | "zcamera_photo" | "zcamera_video" | "zcamera_scan" | "photo" | "file"; serverUploadUrl: string; }, { maxItemSize?: number | undefined; editView?: { enable?: boolean | undefined; aspectRatio?: string | undefined; } | undefined; silentRequest?: boolean | undefined; maxSelectItem?: number | undefined; type: "video" | "zcamera" | "zcamera_photo" | "zcamera_video" | "zcamera_scan" | "photo" | "file"; serverUploadUrl: string; }>[]; /** * Mở cửa sổ chọn media (camera, ảnh, file, video) từ thiết bị. * * Media sau khi chọn sẽ được tải lên server của bạn dưới dạng dữ liệu `multipart/form-data`, `fieldname=file`. * * @minimumVersion 2.18.11 * @minimumVersion 2.23.2: hỗ trợ các type `zcamera`, `zcamera_photo`, `zcamera_video`, `zcamera_scan`. * @requirePermission Cần xin Cấp quyền sử dụng các API này cho Mini App ID tại trang Quản lý ứng dụng. Nếu không, sẽ bị [lỗi với người dùng bình thường, mặc dù Developer/Admin thì không bị](https://mini.zalo.me/community/8746968970844796879/loi-chi-xay-ra-voi-nguoi-dung-binh-thuong-con-developer-admin-thi-khong-bi). * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} serverUploadUrl Đường dẫn upload media. Server phải hỗ trợ upload media qua POST và trả về kết quả dạng JSON. Xem ví dụ về server tại [đây](https://mini.zalo.me/documents/api/openMediaPicker/#server). * @param {"photo" | "file" | "video" | "zcamera" | "zcamera_photo" | "zcamera_video" | "zcamera_scan"} type Loại media cần chọn. Các giá trị: * - 'photo': Mở cửa sổ chọn ảnh. * - 'file': Mở cửa sổ chọn file. * - 'video': Mở cửa sổ chọn video. * - 'zcamera': Mở camera Zalo. * - 'zcamera_photo': Mở camera Zalo để chụp ảnh. * - 'zcamera_video': Mở camera Zalo để quay phim. * - 'zcamera_scan': Mở camera Zalo để chụp tài liệu. * Các type `zcamera`, `zcamera_photo`, `zcamera_video`, `zcamera_scan` hỗ trợ từ phiên bản API 2.23.2. * @param {number} [maxItemSize] Giới hạn kích thước (byte) tối đa của media được phép chọn. * @param {number} [maxSelectItem=1] Giới hạn số lượng tối đa media được chọn. * @param {boolean} [silentRequest=false] Hiển thị hoặc ẩn dialog xử lý các tác vụ ngầm: * - `false`: Hiện dialog xử lý các tác vụ ngầm như render video, upload media, và có nút hủy tác vụ. * - `true`: Không hiện dialog xử lý các tác vụ ngầm. * @param {Object} [editView] Hiển thị view chỉnh sửa ảnh. * @param {boolean} [editView.enable=true] Hiển thị view chỉnh sửa ảnh. * @param {string} [editView.aspectRatio="1:1"] Cắt ảnh theo tỉ lệ đã chỉ định. Tỉ lệ truyền vào theo format `width:height` (phân số tối giản quy định tỉ lệ width/height). * * @returns {OpenMediaPickerReturns} kết quả trả về. * * @example Mở cửa sổ chọn ảnh nhận kết quả trả về dạng JSON: * ```ts * const { data } = await openMediaPicker({ * serverUploadUrl: "https:///upload/media", * type: "photo", * }); * const result = JSON.parse(data); * console.log(result); * ``` * * @example Chọn nhiều ảnh: * ```ts * const { data } = await openMediaPicker({ * serverUploadUrl: "https:///upload/media", * type: "photo", * maxSelectItem: 5, * }); * ``` * * @example Chọn video: * ```ts * const { data } = await openMediaPicker({ * serverUploadUrl: "https:///upload/media", * type: "video", * }); * ``` * * @example Chọn ảnh từ camera Zalo: * ```ts * const { data } = await openMediaPicker({ * serverUploadUrl: "https:///upload/media", * type: "zcamera_photo", * }); * ``` */ declare function openMediaPicker(args: AsyncCallback & TypeOf<(typeof openMediaPickerArgs)[0]>): Promise; declare const getShareableLinkArgs: ZodObject<{ title: ZodString; description: ZodDefault; thumbnail: ZodOptional; path: ZodOptional; }, "strip", ZodTypeAny, { path?: string | undefined; thumbnail?: string | undefined; description: string; title: string; }, { path?: string | undefined; description?: string | undefined; thumbnail?: string | undefined; title: string; }>[]; declare function getShareableLink(args: AsyncCallback & TypeOf<(typeof getShareableLinkArgs)[0]>): Promise; /** * Khi người dùng mở Zalo Mini App, một màn hình loading sẽ được hiển thị trong lúc chờ Mini App được tải. Màn hình này gọi là Splash Loading. * Mặc định Splash Loading sẽ tự động đóng khi Mini App được tải xong. Tuy nhiên, phía tích hợp có thể chọn thời điểm phù hợp để đóng loading bằng cách: * - Thêm thiết lập `selfControlLoading: true` trong `app-config.json`. Xem [Cấu Hình Zalo Mini App](https://mini.zalo.me/documents/intro/getting-started/app-config/#app). * - Gọi `closeLoading` ở thời điểm thích hợp để đóng Splash Loading. * * Lưu ý: * - Nếu thiết lập `selfControlLoading: true` mà API này không được gọi, **Mini App sẽ stuck ở màn hình Splash Loading**. * - Do code gọi API này chỉ được thực thi sau khi Mini App đã được tải xong, nên Splash Loading sẽ được đóng trễ hơn so với bình thường. Chỉ sử dụng cơ chế này khi cần thiết (để giảm layout shift hoặc không muốn người dùng thấy nội dung chưa hoàn chỉnh). * @minimumVersion 2.17.0 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * @example Đóng loading sau khi HomePage đã render xong: * ```ts * function HomePage() { * useEffect(() => { * closeLoading(); * }, []); * ``` */ declare function closeLoading(args?: AsyncVoidCallback): Promise; /** * API chủ động điều hướng người dùng tới AppStore/CH Play để cập nhật phiên bản Zalo mới nhất. * * @minimumVersion 2.19.3 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @example * ```ts * await requestUpdateZalo(); * ``` */ declare function requestUpdateZalo(args?: AsyncVoidCallback): Promise; declare const onConfirmToExitArgs: ZodFunction, ZodUnknown>[]; declare function onConfirmToExit(args: TypeOf<(typeof onConfirmToExitArgs)[0]>): void; declare function offConfirmToExit(): void; declare function getDeviceId(): string; /** * API trả về chuỗi Device ID của thiết bị đã được hash. Các tài khoản người dùng khác nhau đăng nhập trên cùng 1 thiết bị và sử dụng cùng 1 Mini App (hoặc các Mini App có chung Zalo App ID) sẽ có giá trị Device ID giống nhau. Nếu không lấy được Device ID thì giá trị trả về là `unknown`. * @minimumVersion 2.20.0 * @returns {string} chuỗi Device ID của thiết bị đã được hash. * @example Sử dụng kết hợp với `await`: * ```ts * const deviceId = await getDeviceIdAsync(); * ``` */ declare function getDeviceIdAsync(args?: AsyncCallback): Promise; declare function getContext(): ContextInfo | null; /** * API trả về thông tin ngữ cảnh của người dùng hoặc nhóm khi Mini App được mở từ Menu mở rộng trong cửa sổ chat Zalo. * Nếu ngữ cảnh không hợp lệ hoặc phiên bản Zalo không hỗ trợ, giá trị trả về sẽ rỗng. * * @minimumVersion Zalo Android: 22.06.02 * @minimumVersion ZMP SDK: 2.22.0 * @returns {ContextInfo} ngữ cảnh hiện tại. * @example Kiểm tra ngữ cảnh hợp lệ và trả về thông tin ngữ cảnh: * ```ts * const contextInfo = await getContextAsync(); * if (contextInfo) { // Ngữ cảnh hợp lệ * const { id, type } = contextInfo; * } * ``` */ declare function getContextAsync(args?: AsyncCallback): Promise; declare function getAuthCode(args?: AsyncCallback): Promise; declare function getZPIToken(args?: AsyncCallback): Promise; declare const setAccessTokenArgs: ZodString[]; declare function setAccessToken(args: TypeOf<(typeof setAccessTokenArgs)[0]>): void; declare const openOutAppArgs: ZodObject<{ url: ZodString; }, "strip", ZodTypeAny, { url: string; }, { url: string; }>[]; declare function openOutApp(args: TypeOf<(typeof openOutAppArgs)[0]>): Promise; declare const chooseImageArgs: ZodObject<{ count: ZodDefault>; sourceType: ZodOptional, "many">>>; cameraType: ZodOptional>>; }, "strip", ZodTypeAny, { sourceType?: ("album" | "camera")[] | undefined; cameraType?: "back" | "front" | undefined; count: number; }, { count?: number | undefined; sourceType?: ("album" | "camera")[] | undefined; cameraType?: "back" | "front" | undefined; }>[]; /** * API chọn hình ảnh từ album hoặc camera. * * @minimumVersion 2.23.4 * * @param {("album" | "camera")[]} [sourceType] Nguồn chọn hình ảnh. Có thể chọn từ album/tệp (`album`), chụp ảnh mới từ camera (`camera`), hoặc cả hai. * @param {"back" | "front"} [cameraType] Xác định camera cần mở là camera trước hay sau. * @param {number} [count] Số lượng hình ảnh tối đa có thể chọn. * @returns {ChooseImageReturns} đường dẫn tới hình ảnh đã chọn. * @example Chụp hình ảnh từ camera trước: * ```ts * const { filePaths } = await chooseImage({ * sourceType: ["camera"], * cameraType: "front", * }); * ``` * @example Chụp hình ảnh từ camera sau: * ```ts * const { filePaths } = await chooseImage({ * sourceType: ["camera"], * cameraType: "back", * }); * ``` * @example Chọn nhiều hình ảnh để viết đánh giá sản phẩm: * ```ts * const { filePaths } = await chooseImage({ * sourceType: ["album", "camera"], * count: 5, * }); * ``` */ declare function chooseImage(args: AsyncCallback & TypeOf<(typeof chooseImageArgs)[0]>): Promise; /** * API truy xuất vị trí hiện tại của người dùng. Khi gọi API, một thông báo xin cấp quyền sẽ được hiển thị. Mini App chỉ lấy được thông tin vị trí nếu người dùng đồng ý cấp quyền chia sẻ vị trí. * * Lưu ý, để giúp các nhà phát triển Mini App sử dụng flow xin quyền một cách hiệu quả, cũng như phù hợp với [chính sách của Zalo Mini App điều 3.3.4](https://mini.zalo.me/documents/zalo-mini-app-developer-program-agreement/#33-api-quy%E1%BB%81n-truy-c%E1%BA%ADp), Mini App Team đã đưa ra một số gợi ý thiết kế trải nghiệm như thông tin bên dưới. Nhà phát triển cần giải thích rõ ràng và trực quan mục đích xin quyền để người dùng dễ dàng hiểu và đồng ý cung cấp thông tin. * * Nhằm đảm bảo trải nghiệm thoải mái của người dùng Mini App, chúng tôi sẽ từ chối xét duyệt cho những Mini App có luồng xin cấp quyền chưa rõ ràng, không nêu được mục đích xin quyền đến người dùng. * * @requirePermission Cần xin Cấp quyền sử dụng các API này cho Mini App ID tại trang Quản lý ứng dụng. Nếu không, sẽ bị [lỗi với người dùng bình thường, mặc dù Developer/Admin thì không bị](https://mini.zalo.me/community/8746968970844796879/loi-chi-xay-ra-voi-nguoi-dung-binh-thuong-con-developer-admin-thi-khong-bi). * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * @behavior Ở môi trường phát triển, API này sẽ luôn thành công và trả về token rỗng (`""`). Khi chạy bên trong ứng dụng Zalo mobile, API này sẽ hiển thị thông báo xin cấp quyền, và trả về token hợp lệ nếu người dùng đồng ý hoặc lỗi nếu người dùng từ chối. * * @returns {GetLocationReturns} token vị trí. * @example * 1. Ở Zalo Mini App, gọi API này để lấy token vị trí: * ```ts * const { token } = await getLocation(); * ``` * 2. Dùng fetch hoặc axios để gửi token này lên server. Nếu không, bạn sẽ bị [lỗi khi gọi các API Server-Server từ Mini App](https://mini.zalo.me/community/9107262438710014159/loi-khi-goi-cac-api-server-server-tu-mini-app). * 3. Server chuyển đổi token thành thông tin vị trí và trả về cho Mini App theo [hướng dẫn sau](https://mini.zalo.me/documents/api/getLocation/#hướng-dẫn-chuyển-đổi-token-thành-thông-tin-vị-trí-người-dùng). */ declare function getLocation(args?: AsyncCallback): Promise; declare const onCallbackDataArgs: ZodFunction], ZodUnknown>, ZodVoid>[]; declare function onCallbackData(args: TypeOf<(typeof onCallbackDataArgs)[0]>): void; declare const createOrderArgs: ZodObject<{ amount: ZodUnion<[ZodString, ZodNumber]>; item: ZodArray, "many">; desc: ZodString; mac: ZodString; extradata: ZodOptional; payload: ZodOptional; method: ZodOptional]>>; }, "strip", ZodTypeAny, { method?: string | { id: string; isCustom: boolean; } | undefined; extradata?: any; payload?: any; desc: string; amount: string | number; item: Record[]; mac: string; }, { method?: string | { id: string; isCustom: boolean; } | undefined; extradata?: any; payload?: any; desc: string; amount: string | number; item: Record[]; mac: string; }>[]; /** * Tạo yêu cầu thanh toán, mở giao diện chọn phương thức thanh toán * @link https://mini.zalo.me/documents/checkout-sdk/createOrder/ * @param args */ declare function createOrder(args: AsyncCallback & TypeOf<(typeof createOrderArgs)[0]>): Promise; declare const purchaseArgs: ZodObject<{ amount: ZodUnion<[ZodString, ZodNumber]>; desc: ZodString; method: ZodString; transId: ZodOptional; mac: ZodOptional; }, "strip", ZodTypeAny, { transId?: string | undefined; mac?: string | undefined; method: string; desc: string; amount: string | number; }, { transId?: string | undefined; mac?: string | undefined; method: string; desc: string; amount: string | number; }>[]; /** * Gửi thông tin thanh toán đến CheckoutSDK * @link https://mini.zalo.me/documents/checkout-sdk/purchase/ * @param args */ declare function purchase(args: AsyncCallback & TypeOf<(typeof purchaseArgs)[0]>): Promise; declare const selectPaymentMethodArgs: ZodOptional; subInfo: ZodOptional; }, "strip", ZodTypeAny, { subMethod?: string | undefined; subInfo?: string | undefined; method: string; }, { subMethod?: string | undefined; subInfo?: string | undefined; method: string; }>, "many">>; selectedMethod: ZodOptional; }, "strip", ZodTypeAny, { subMethod?: string | undefined; method: string; }, { subMethod?: string | undefined; method: string; }>>; }, "strip", ZodTypeAny, { channels?: { subMethod?: string | undefined; subInfo?: string | undefined; method: string; }[] | undefined; selectedMethod?: { subMethod?: string | undefined; method: string; } | undefined; }, { channels?: { subMethod?: string | undefined; subInfo?: string | undefined; method: string; }[] | undefined; selectedMethod?: { subMethod?: string | undefined; method: string; } | undefined; }>>[]; declare function selectPaymentMethod(args: AsyncCallback & TypeOf<(typeof selectPaymentMethodArgs)[0]>): Promise; declare const checkTransactionArgs: ZodObject<{ data: ZodUnion<[ZodString, ZodRecord>>]>; }, "strip", ZodTypeAny, { data: string | Record; }, { data: string | Record; }>[]; /** * Kiểm tra trạng thái giao dịch * @link https://mini.zalo.me/documents/checkout-sdk/checkTransaction/ * @param args * @example * ```ts * import { CheckoutSDK } from "zmp-sdk/apis"; * // Kiểm tra bằng `orderId` tạo bởi Checkout SDK * const result = await CheckoutSDK.checkTransaction({ * data: { orderId: "123456"} * }); * * // Kiểm tra bằng `transId` tạo bởi đối tác thanh toán * const result = await CheckoutSDK.checkTransaction({ * data: { transId: "123456"} * }); * */ declare function checkTransaction(args: AsyncCallback & TypeOf<(typeof checkTransactionArgs)[0]>): Promise; declare const createOrderIAPArgs: ZodObject<{ productId: ZodString; payType: ZodOptional>; prorationMode: ZodOptional>>; utm: ZodOptional; method: ZodOptional>; merchantTransId: ZodOptional; }, "strip", ZodTypeAny, { method?: "IAP" | "IAP_SANDBOX" | undefined; payType?: "SUBSCRIPTION" | "ONETIME" | undefined; utm?: string | undefined; merchantTransId?: string | undefined; prorationMode?: "DEFERRED" | "IMMEDIATE_AND_CHARGE_FULL_PRICE" | undefined; productId: string; }, { method?: "IAP" | "IAP_SANDBOX" | undefined; payType?: "SUBSCRIPTION" | "ONETIME" | undefined; utm?: string | undefined; merchantTransId?: string | undefined; prorationMode?: "DEFERRED" | "IMMEDIATE_AND_CHARGE_FULL_PRICE" | undefined; productId: string; }>[]; declare function createOrderIAP(args: AsyncCallback & TypeOf<(typeof createOrderIAPArgs)[0]>): Promise; declare const events: EventEmitter; declare const setAndroidBottomNavigationBarArgs: ZodOptional>; }, "strip", ZodTypeAny, { hide?: boolean | undefined; }, { hide?: boolean | undefined; }>>[]; declare function setAndroidBottomNavigationBar(args: AsyncVoidCallback & TypeOf<(typeof setAndroidBottomNavigationBarArgs)[0]>): Promise; declare const setIOSBottomSafeAreaArgs: ZodOptional>; }, "strip", ZodTypeAny, { hide?: boolean | undefined; }, { hide?: boolean | undefined; }>>[]; declare function setIOSBottomSafeArea(args: AsyncVoidCallback & TypeOf<(typeof setIOSBottomSafeAreaArgs)[0]>): Promise; declare const setStatusBarArgs: ZodOptional>>; color: ZodOptional; }, "strip", ZodTypeAny, { type?: "hidden" | "transparent" | "normal" | undefined; color?: string | undefined; }, { type?: "hidden" | "transparent" | "normal" | undefined; color?: string | undefined; }>>[]; declare function setStatusBar(args: AsyncVoidCallback & TypeOf<(typeof setStatusBarArgs)[0]>): Promise; declare const configAppViewArgs: ZodObject<{ headerTextColor: ZodOptional>; headerColor: ZodOptional; actionBar: ZodOptional; title: ZodOptional; leftButton: ZodOptional>; textAlign: ZodOptional>>; }, "strip", ZodTypeAny, { title?: string | undefined; leftButton?: "none" | "back" | undefined; hide?: boolean | undefined; textAlign?: "left" | "center" | undefined; }, { title?: string | undefined; leftButton?: "none" | "back" | undefined; hide?: boolean | undefined; textAlign?: "left" | "center" | undefined; }>>; statusBarType: ZodOptional>; hideAndroidBottomNavigationBar: ZodOptional; hideIOSSafeAreaBottom: ZodOptional; }, "strip", ZodTypeAny, { headerTextColor?: "black" | "white" | undefined; headerColor?: string | undefined; actionBar?: { title?: string | undefined; leftButton?: "none" | "back" | undefined; hide?: boolean | undefined; textAlign?: "left" | "center" | undefined; } | undefined; statusBarType?: "hidden" | "transparent" | "normal" | undefined; hideAndroidBottomNavigationBar?: boolean | undefined; hideIOSSafeAreaBottom?: boolean | undefined; }, { headerTextColor?: "black" | "white" | undefined; headerColor?: string | undefined; actionBar?: { title?: string | undefined; leftButton?: "none" | "back" | undefined; hide?: boolean | undefined; textAlign?: "left" | "center" | undefined; } | undefined; statusBarType?: "hidden" | "transparent" | "normal" | undefined; hideAndroidBottomNavigationBar?: boolean | undefined; hideIOSSafeAreaBottom?: boolean | undefined; }>[]; /** * API tuỳ chỉnh các thành phần giao diện chính trên Mini App, bao gồm: * - Status bar * - Action bar * - Bottom Navigation (Android) / Safe Area Inset Bottom (iOS) * * Với api `configAppView`, bạn có thể ẩn/ hiện, tuỳ chỉnh màu sắc, kiểu hiển thị của các thành phần mặc định trên Mini App. Xem hình ảnh mô tả bên dưới để hiểu rõ các thành phần có thể tuỳ chỉnh trên Mini App của bạn. * * @minimumVersion Zalo iOS: 23.02.01.r2 * @minimumVersion Zalo Android: 23.02.01.r2 * @minimumVersion ZMP SDK: 2.25.0 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} headerColor Mã màu, có giá trị hợp lệ là màu thập lục phân, ví dụ `#000000`. * @param {"white" | "black"} [headerTextColor] Màu của text và icon trên thanh action bar và status bar. * @param {"normal" | "hidden" | "transparent"} [statusBarType="normal"] Kiểu hiển thị của status bar. * @param {boolean} [hideAndroidBottomNavigationBar=false] Ẩn thanh navigation bar trên Android. * @param {boolean} [hideIOSSafeAreaBottom=false] Ẩn thanh safe area inset bottom trên iOS. * @param {boolean} [actionBar.hide] Ẩn action bar. * @param {string} [actionBar.title] Tiêu đề hiển thị trên action bar. * @param {"back" | "none"} [actionBar.leftButton="back"] Tuỳ chỉnh nút điều hướng bên trái action bar. Mặc định hiển thị nút back. Truyền `none` để ẩn nút. * @param {"left" | "center"} [actionBar.textAlign="left"] Tuỳ chỉnh vị trí tiêu đề hiển thị trên action bar. * * @example Thay đổi tiêu đề action bar: * ```ts * configAppView({ * actionBar: { * title: "Giỏ hàng", * }, * }); * ``` * * @example Để có được giao diện toàn màn hình: * ```ts * configAppView({ * hideAndroidBottomNavigationBar: true, * hideIOSSafeAreaBottom: true, * statusBarType: "transparent", // hoặc "hidden" * actionBar: { * hide: true, * }, * }); * ``` */ declare function configAppView(args: AsyncVoidCallback & TypeOf<(typeof configAppViewArgs)[0]>): Promise; /** * API chủ động thu nhỏ ứng dụng. Khi gọi API, Mini App sẽ được thu nhỏ vào một floating icon ở góc màn hình, giúp người sử dụng có thể tạm thời sử dụng các chức năng khác của Zalo, và quay trở lại Mini App của bạn mà không cần phải tải lại từ đầu. * * ![Thu nhỏ ứng dụng](https://mini.zalo.me/documents/img/ZMA-Floating.png) * * @minimumVersion 2.26.1 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @example Thu nhỏ ứng dụng: * ```ts * await minimizeApp(); * ``` */ declare function minimizeApp(args?: AsyncVoidCallback): Promise; /** * API mở cửa sổ Quản lý quyền mà người dùng đã cấp cho Mini App. Người dùng có thể thay đổi các thiết lập quyền (cấp thêm hoặc thu hồi) tại đây. * * @minimumVersion 2.27.1 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @example Mở cửa sổ cài đặt quyền: * ```ts * await openPermissionSetting(); * ``` */ declare function openPermissionSetting(args?: AsyncVoidCallback): Promise; /** * API thêm ứng dụng vào danh sách ưa thích của người dùng ở Zalo Mini Apps Store. * ![Danh sách ưa thích ở Zalo Mini Apps Store](https://mini.zalo.me/documents/img/api/favoriteApp/favorite_screen.jpeg) * * @minimumVersion 2.27.1 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @example Thêm ứng dụng vào danh sách ưa thích: * ```ts * await favoriteApp(); * ``` */ declare function favoriteApp(args?: AsyncVoidCallback): Promise; declare function openGroupList(args?: AsyncVoidCallback): Promise; /** * API yêu cầu người dùng cho phép nhận thông báo qua OA Mini App. Khi gọi API, một thông báo sẽ được hiển thị. * * @minimumVersion 2.27.1 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @example Yêu cầu người dùng cho phép nhận thông báo: * ```ts * await requestSendNotification(); * ``` */ declare function requestSendNotification(args?: AsyncVoidCallback): Promise; /** * API mở cửa sổ đánh giá ứng dụng, hỗ trợ ghi nhận đánh giá phản hồi của người dùng về chất lượng của Mini App. * * @minimumVersion 2.28.0 * @important Chỉ có thể hiển thị cửa sổ đánh giá 1 lần/tuần đối với mỗi người dùng. Quá giới hạn trên sẽ trả về [lỗi](https://mini.zalo.me/documents/api/errorCode/). * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @example Mở cửa sổ đánh giá ứng dụng: * ```ts * await addRating(); * ``` */ declare function addRating(args?: AsyncVoidCallback): Promise; declare const interactOAArgs$1: ZodObject<{ oaId: ZodString; }, "strip", ZodTypeAny, { oaId: string; }, { oaId: string; }>[]; /** * API yêu cầu người dùng cho phép gửi thông báo thông qua Official Account. Khi gọi API, một thông báo sẽ được hiển thị. * * @minimumVersion 2.28.8 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} oaId Id của Official Account. * * @example Yêu cầu người dùng cho phép gửi thông báo thông qua Official Account: * ```ts * await interactOA({ * oaId: "xxxx", * }); * ``` * * @example Xử lý lỗi: * ```ts * try { * await interactOA({ * oaId: "xxxx", * }); * console.log("Người dùng đã cho phép"); * } catch (error) { * const code = (error as AppError).code; * if (code === -201) { * console.log("Người dùng đã từ chối"); * } else { * console.log("Lỗi khác"); * } * } * ``` */ declare function interactOA(args: AsyncVoidCallback & TypeOf<(typeof interactOAArgs$1)[0]>): Promise; declare const interactOAArgs: ZodObject<{ oaId: ZodString; }, "strip", ZodTypeAny, { oaId: string; }, { oaId: string; }>[]; declare function checkIsAllowedInteractWithOA(args: AsyncVoidCallback & TypeOf<(typeof interactOAArgs)[0]>): Promise; /** * API lấy thông tin cài đặt hiện tại của người dùng. * * @minimumVersion 2.31.0 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @returns {GetSettingReturn} thông tin cài đặt hiện tại của người dùng. * * @example Lấy thông tin cài đặt hiện tại của người dùng: * ```ts * const { authSetting } = await getSetting(); * ``` */ declare function getSetting(args?: AsyncCallback): Promise; declare const authorizeArgs: ZodOptional, "many">>; }, "strip", ZodTypeAny, { scopes?: ("scope.userInfo" | "scope.userLocation" | "scope.userPhonenumber")[] | undefined; }, { scopes?: ("scope.userInfo" | "scope.userLocation" | "scope.userPhonenumber")[] | undefined; }>>[]; /** * ### Cấp quyền sử dụng API * * Một số API cần sự cho phép của người dùng trước khi có thể được gọi. Các API này được chia thành nhiều phạm vi (Scope) tương ứng với từng mục đích sử dụng, mô tả chi tiết 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 | * * Khi một API như vậy được gọi: * - Nếu người dùng chưa chấp nhận hoặc từ chối, một cửa sổ pop-up sẽ xuất hiện để hỏi người dùng có muốn chấp nhận không. API chỉ có thể được gọi sau khi người dùng bấm chấp nhận. * - Nếu người dùng đã chấp nhận cho phép, API có thể được gọi trực tiếp. * - Nếu người dùng từ chối cho phép, callback lỗi sẽ được trả về. * - Developer có thể sử dụng api `authorize` để chủ động khởi tạo yêu cầu cấp quyền đối với người dùng khi cần, hỗ trợ xin tối đa 3 quyền (đã bao gồm quyền User Authen). * * ### Lấy trạng thái của scope * * Developer có thể sử dụng API `getSetting` để lấy trạng thái cho phép hiện tại của người dùng. * * ### Quản lý cấp/thu hồi quyền cho người dùng * * Developer có thể gọi API `openPermissionSetting` để mở cài đặt và hướng dẫn người dùng bật/tắt cho phép API. * * ### Thời gian hiệu lực * * Sau khi user đồng ý hoặc từ chối cấp quyền, trạng thái cấp quyền sẽ được ghi nhận và đồng bộ cho những lần sử dụng sau này. * * ### Best Practices * * - Chỉ khởi tạo yêu cầu cấp quyền khi cần thiết, giải thích rõ ràng lý do tại sao bạn muốn sử dụng nó trong yêu cầu cấp quyền. * - Sử dụng API `getSetting` trước để lấy trạng thái cho phép hiện tại của người dùng, sau đó yêu cầu xin cấp thêm các quyền còn thiếu. * * @minimumVersion Zalo iOS: 23.12.02 (573) * @minimumVersion Zalo Android: 23.12.02 (724) * @minimumVersion ZMP SDK: 2.34.0 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string[]} scopes Danh sách các quyền cần được cấp, tham khảo bảng Scopes. * @returns {Scopes} các trạng thái của các quyền được cấp. * @property {boolean} scope.userInfo Trạng thái quyền thông tin user. * @property {boolean} scope.userLocation Trạng thái quyền vị trí user. * @property {boolean} scope.userPhonenumber Trạng thái quyền số điện thoại. * * @example Khởi tạo cấp quyền * ```ts * try { * const data = await authorize({ * scopes: ["scope.userLocation", "scope.userPhonenumber"], * }); * console.log(data["scope.userLocation"]); // `true` nếu người dùng đồng ý cấp vị trí * console.log(data["scope.userPhonenumber"]); // `true` nếu người dùng đồng ý cấp số điện thoại * } catch (error) { * const code = (error as AppError).code; * if (code === -201) { * console.log("Người dùng đã từ chối cấp quyền"); * } else { * console.log("Lỗi khác"); * } * } * ``` */ declare function authorize(args?: AsyncVoidCallback & TypeOf<(typeof authorizeArgs)[0]>): Promise>; declare function checkZaloCameraPermission(args?: AsyncCallback): Promise; /** * API cho phép truy xuất ID người dùng. Với ID là 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 ID Zalo App. Các Mini App cùng chung một ID Zalo App sẽ có thể dùng chuỗi này để định danh người dùng. (API này sẽ không cần yêu cầu người dùng xác nhận). * * @minimumVersion 2.32.2 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @returns {string} ID người dùng. * * @example Truy xuất ID người dùng: * ```ts * const userID = await getUserID({}); * ``` */ declare function getUserID(args?: AsyncCallback): Promise; declare function getIDToken(args?: AsyncCallback): Promise; interface ZMACamera { start: () => Promise; stop: () => void; pause: (type: StreamType$1) => Promise; resume: (type: StreamType$1) => Promise; isUsing: () => boolean; updateMediaConstraints: (mediaConstraints: MediaConstraints$1) => Promise; takePhoto: (cameraFrameProps?: PhotoConstraint$1) => PhotoFrame$1 | null; flip: () => Promise; setMirror: (mirrored: boolean) => void; getCameraList: () => MediaDevice$1[]; getSelectedDeviceId: () => string; setDeviceId: (deviceId: string) => Promise; on: (event: CameraEvents$1, callback: (data: any) => void) => void; off: (event: CameraEvents$1) => void; } declare class ZMACameraImp implements ZMACamera { private readonly _videoElement; private _facingMode; private _mirror; private _cameraList; private _stream; private _mediaConstraints; private _selectedDeviceId; private _canvasElement; private _ctx; private _hasUserMedia; private _userRequestFrameCallback; private _videoEnabled; private _audioEnabled; constructor(videoElement: HTMLVideoElement, mediaConstraints?: MediaConstraints$1 | null); on(event: CameraEvents$1, callback: (data: any) => void): void; off(event: CameraEvents$1): void; private getQualityNumber; private tick; private getFacingMode; getCameraList(): MediaDevice$1[]; private getCameraCount; getSelectedDeviceId(): string; setDeviceId(deviceId: string): Promise; private getVideoInputs; updateMediaConstraints(mediaConstraints: MediaConstraints$1): Promise; private getCurrentMediaConstraints; private selectCamera; flip(): Promise; start(): Promise; private info; private stream; private handleUserMedia; private updateTrackEnable; private static stopMediaStream; pause(type: StreamType$1): Promise; resume(type: StreamType$1): Promise; isUsing(): boolean; stop(): void; private _stop; private setFacingMode; setMirror(mirrored: boolean): void; takePhoto(cameraFrameProps?: PhotoConstraint$1): PhotoFrame$1 | null; private haveVideoStream; private getCanvas; private drawFrame; } declare const cameraArgs: ZodOptional, ZodUnknown>; pause: ZodFunction, ZodUnknown>; }, "strip", ZodTypeAny, { pause: (...args: unknown[]) => unknown; play: (...args: unknown[]) => unknown; }, { pause: (...args: unknown[]) => unknown; play: (...args: unknown[]) => unknown; }>, { pause: (...args: unknown[]) => unknown; play: (...args: unknown[]) => unknown; }, { pause: (...args: unknown[]) => unknown; play: (...args: unknown[]) => unknown; }>; mediaConstraints: ZodOptional; height: ZodOptional; facingMode: ZodOptional; audio: ZodOptional; video: ZodOptional; deviceId: ZodOptional; mirrored: ZodOptional; }, "strip", ZodTypeAny, { audio?: boolean | undefined; video?: boolean | undefined; height?: number | undefined; width?: number | undefined; facingMode?: string | undefined; deviceId?: string | undefined; mirrored?: boolean | undefined; }, { audio?: boolean | undefined; video?: boolean | undefined; height?: number | undefined; width?: number | undefined; facingMode?: string | undefined; deviceId?: string | undefined; mirrored?: boolean | undefined; }>>>; }, "strip", ZodTypeAny, { mediaConstraints?: { audio?: boolean | undefined; video?: boolean | undefined; height?: number | undefined; width?: number | undefined; facingMode?: string | undefined; deviceId?: string | undefined; mirrored?: boolean | undefined; } | null | undefined; videoElement: { pause: (...args: unknown[]) => unknown; play: (...args: unknown[]) => unknown; }; }, { mediaConstraints?: { audio?: boolean | undefined; video?: boolean | undefined; height?: number | undefined; width?: number | undefined; facingMode?: string | undefined; deviceId?: string | undefined; mirrored?: boolean | undefined; } | null | undefined; videoElement: { pause: (...args: unknown[]) => unknown; play: (...args: unknown[]) => unknown; }; }>>[]; declare function createCameraContext(args: CameraParams & TypeOf<(typeof cameraArgs)[0]>): ZMACamera; /** * API cấu hình các thông tin dùng để chạy quảng cáo. API cần được gọi khi khởi tạo ứng dụng. * * @minimumVersion 2.37.0 * @info Tính năng đang trong giai đoạn thử nghiệm và chỉ được mở cho một số đối tác nhất định. * * @example Bên trong `app.ts`: * ```ts * import React from "react"; * import { createRoot } from "react-dom/client"; * import { setupAd } from "zmp-sdk/apis"; * * import "zmp-ui/zaui.css"; * import "./css/app.scss"; * * import App from "./components/app"; * * // Setup advertising * setupAd(); * * const root = createRoot(document.getElementById("app")); * root.render(React.createElement(App)); * ``` */ declare function setupAd(args?: AsyncCallback): Promise; declare const loadAdArgs: ZodObject<{ ids: ZodUnion<[ZodString, ZodArray]>; config: ZodOptional; onClose: ZodOptional, ZodUnknown>>; }, "strip", ZodTypeAny, { display?: boolean | undefined; onClose?: ((...args: unknown[]) => unknown) | undefined; }, { display?: boolean | undefined; onClose?: ((...args: unknown[]) => unknown) | undefined; }>>; }, "strip", ZodTypeAny, { config?: { display?: boolean | undefined; onClose?: ((...args: unknown[]) => unknown) | undefined; } | undefined; ids: string | string[]; }, { config?: { display?: boolean | undefined; onClose?: ((...args: unknown[]) => unknown) | undefined; } | undefined; ids: string | string[]; }>[]; /** * API dùng để tải quảng cáo. Có các loại quảng cáo sau đây: * * | ID | Size | * | -------------- | ------------- | * | ZMA_Masthead | 480x270 | * | ZMA_Middle | 300x250 | * | ZMA_Fullscreen | Toàn màn hình | * | ZMA_Reward | Toàn màn hình | * | ZMA_Bottom | Tùy chỉnh | * * Mặc định quảng cáo sẽ được hiển thị sau khi tải xong. Vị trí hiển thị quảng cáo sẽ được xác định theo ID của từng loại. * * @minimumVersion 2.37.0 * * @param {string | string[]} ids ID của loại quảng cáo cần tải trong trang. * @param {Object} [config] Cấu hình thêm. * @param {boolean} [config.display=true] Hiển thị quảng cáo sau khi tải (true) hoặc không hiển thị (false). * @param {function} [config.onClose] Callback được gọi sau khi quảng cáo ZMA_Reward đóng, trả về reward token. * * @example Tải quảng cáo ZMA_Middle: * ```ts * import React, { useEffect } from "react"; * import { loadAd } from "zmp-sdk/apis"; * * function HomePage() { * useEffect(() => { * loadAd({ ids: ["ZMA_Middle"] }); * }, []); * * return ( * <> * ... *
* * ); * } * * export default HomePage; * ``` */ declare function loadAd(args: AsyncCallback & TypeOf<(typeof loadAdArgs)[0]>): Promise; declare const displayAdArgs: ZodObject<{ id: ZodString; }, "strip", ZodTypeAny, { id: string; }, { id: string; }>[]; /** * API dùng để hiển thị quảng cáo sau khi tải xong. Vị trí hiển thị quảng cáo sẽ được xác định theo ID của từng loại. * * @minimumVersion 2.37.0 * * @param {string} id ID của loại quảng cáo cần hiển thị trong trang. * * @example Hiển thị quảng cáo ZMA_Middle: * ```ts * import React from "react"; * import { createRoot } from "react-dom/client"; * import { setupAd, loadAd, displayAd } from "zmp-sdk/apis"; * * function App() { * useEffect(() => { * displayAd({ id: "ZMA_Middle" }); * }, []); * * return ( * <> * ... *
* ... * * ); * } * * setupAd(); * loadAd({ * ids: ["ZMA_Middle"], * config: { * display: false * } * }); * * const root = createRoot(document.getElementById("app")); * root.render(React.createElement(App)); * ``` */ declare function displayAd(args: AsyncCallback & TypeOf<(typeof displayAdArgs)[0]>): Promise; declare const refreshAdArgs: ZodOptional; }, "strip", ZodTypeAny, { id?: string | undefined; }, { id?: string | undefined; }>>[]; /** * API dùng để xóa quảng cáo ở phiên hiện tại. * * @minimumVersion 2.37.0 * * @param {string} [id] ID của loại quảng cáo cần xóa. * * @example Xóa quảng cáo ZMA_Middle: * ```ts * refreshAd({ id: "ZMA_Middle" }); * ``` */ declare function refreshAd(args: AsyncCallback & TypeOf<(typeof refreshAdArgs)[0]>): Promise; declare const showOAWidgetArgs: ZodObject<{ id: ZodString; guidingText: ZodOptional; color: ZodOptional; onStatusChange: ZodOptional, ZodUnknown>>; onError: ZodOptional, ZodUnknown>>; }, "strip", ZodAny, { [x: string]: any; color?: string | undefined; guidingText?: string | undefined; onStatusChange?: ((...args: unknown[]) => unknown) | undefined; onError?: ((...args: unknown[]) => unknown) | undefined; id: string; }, { [x: string]: any; color?: string | undefined; guidingText?: string | undefined; onStatusChange?: ((...args: unknown[]) => unknown) | undefined; onError?: ((...args: unknown[]) => unknown) | undefined; id: string; }>[]; /** * Widget Quan tâm OA: Người dùng bấm nút "Quan tâm" trên widget sẽ thực hiện quan tâm ngay mà không cần hiển thị bottom sheet xin quyền. Thông tin OA được lấy từ OA đã xác thực Mini App. * * @minimumVersion 2.38.0 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} id ID của element, nơi cần hiển thị widget. * @param {string} [guidingText="Nhận thông báo khuyến mãi mới nhất từ cửa hàng"] Chuỗi dùng để thông báo cho người dùng. * @param {string} [color="#0068FF"] Màu chủ đạo của widget. Giá trị phải là chuỗi hex. * @param {(status: boolean) => void} [onStatusChange] Callback được gọi khi người dùng nhấn theo dõi OA. Trạng thái theo dõi mới được truyền vào tham số của callback. * * @example Hiển thị Widget Quan tâm OA: * ```ts * import React, { useEffect } from "react"; * import { showOAWidget } from "zmp-sdk/apis"; * * function HomePage() { * useEffect(() => { * showOAWidget({ * id: "oaWidget", * guidingText: "Nhận thông báo khuyến mãi mới nhất từ cửa hàng", * color: "#0068FF", * onStatusChange: (status) => { * console.log(status); * }, * }); * }, []); * * return ( * <> * ... *
* ... * * ); * } * * export default HomePage; * ``` */ declare function showOAWidget(args: AsyncVoidCallback & TypeOf<(typeof showOAWidgetArgs)[0]>): Promise; declare const showFunctionButtonWidgetArgs: ZodObject<{ id: ZodString; type: ZodString; text: ZodString; color: ZodOptional; disabled: ZodOptional; onDataReceived: ZodOptional, ZodUnknown>>; onError: ZodOptional, ZodUnknown>>; }, "strip", ZodAny, { [x: string]: any; color?: string | undefined; onError?: ((...args: unknown[]) => unknown) | undefined; disabled?: boolean | undefined; onDataReceived?: ((...args: unknown[]) => unknown) | undefined; text: string; type: string; id: string; }, { [x: string]: any; color?: string | undefined; onError?: ((...args: unknown[]) => unknown) | undefined; disabled?: boolean | undefined; onDataReceived?: ((...args: unknown[]) => unknown) | undefined; text: string; type: string; id: string; }>[]; /** * Widget Function Button: Khi người dùng nhấn vào button này, Mini App sẽ nhận được 1 message token (có giá trị trong 7 ngày) để gửi tin nhắn tới người dùng. Chi tiết hướng dẫn gửi tin nhắn thông qua message token tham khảo [tại đây](https://developers.zalo.me/docs/official-account/tin-nhan/cac-loai-tin-khac/gui-tin-nhan-miniapp-den-nguoi-dung). * * @minimumVersion 2.39.0 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} id ID của element, nơi cần hiển thị widget. * @param {"ORDER"} type Loại nút, hiện tại chỉ hỗ trợ giá trị: `ORDER`. * @param {"Thanh toán" |"Đặt món" |"Đặt xe" |"Đặt hàng" |"Mua vé" |"Booking" |"Đặt chỗ" |"Tạo đơn hàng" |"Đặt trước" |"Mua hàng" |"Đặt lịch" |"Tra cứu" |"Kiểm tra"} text Chuỗi hiển thị trong button. Phải là một trong các giá trị được cho phép: * - Thanh toán * - Đặt món * - Đặt xe * - Đặt hàng * - Mua vé * - Booking * - Đặt chỗ * - Tạo đơn hàng * - Đặt trước * - Mua hàng * - Đặt lịch * - Tra cứu * - Kiểm tra * @param {string} [fontSize="16px"] Kích thước font chữ. Giá trị nhỏ nhất là 14px. * @param {string} [color="#0068FF"] Màu chủ đạo của widget. Giá trị phải là chuỗi hex. * @param {string} [textColor="#FFFFFF"] Màu chữ trong button. Giá trị phải là chuỗi hex. * @param {string} [borderRadius="48px"] Bo góc (bo tròn các góc của button). * @param {(messageToken: string) => void} [onDataReceived] Callback được gọi khi người dùng nhấn vào widget. Callback này chứa `messageToken` là một token được dùng để gửi tin nhắn tới người dùng. Có giá trị trong 7 ngày. * @param {(error: string) => void} [onError] Callback được gọi khi có lỗi xảy ra khi người dùng nhấn vào widget. Callback này chứa `error` là thông tin về lỗi. * * @example Hiển thị Widget Function Button: * ```ts * import React, { useEffect } from "react"; * import { showFunctionButtonWidget } from "zmp-sdk/apis"; * * function HomePage() { * useEffect(() => { * showFunctionButtonWidget({ * id: "orderButton", * type: "ORDER", * text: "Đặt hàng", * color: "#0068FF", * textColor: "#FFFFFF", * borderRadius: "48px", * onDataReceived: (messageToken) => { * console.log(messageToken); * }, * onError: (error) => { * console.error("onError:", error); * }, * }); * }, []); * * return ( * <> * ... *
* ... * * ); * } * * export default HomePage; * ``` */ declare function showFunctionButtonWidget(args: AsyncVoidCallback & TypeOf<(typeof showFunctionButtonWidgetArgs)[0]>): Promise; declare const scanNFCArgs: ZodObject<{ type: ZodEnum<["cccd"]>; data: ZodObject<{ mrz: ZodString; }, "strip", ZodTypeAny, { mrz: string; }, { mrz: string; }>; }, "strip", ZodTypeAny, { data: { mrz: string; }; type: "cccd"; }, { data: { mrz: string; }; type: "cccd"; }>[]; declare function scanNFC(args: AsyncCallback & TypeOf<(typeof scanNFCArgs)[0]>): Promise; declare function checkNFC(args: AsyncVoidCallback): Promise; declare const nativeStorage: { getItem: typeof getItem; setItem: typeof setItem; clear: typeof clear; removeItem: typeof removeItem; getStorageInfo: typeof getStorageInfoSync; }; declare const Payment: { purchase: typeof purchase; createOrder: typeof createOrder; checkTransaction: typeof checkTransaction; createOrderIAP: typeof createOrderIAP; selectPaymentMethod: typeof selectPaymentMethod; }; declare const CheckoutSDK: { purchase: typeof purchase; createOrder: typeof createOrder; checkTransaction: typeof checkTransaction; createOrderIAP: typeof createOrderIAP; selectPaymentMethod: typeof selectPaymentMethod; }; declare const downloadFileArgs: ZodOptional>[]; /** * API hỗ trợ tải file về thiết bị. Hỗ trợ giao thức tải file `https://` với các định dạng được liệt kê bên dưới. * * | Định dạng | Đuôi file | * | -------- | -------------------------------------------------------- | * | Văn bản | pdf, doc, docx, odt, xls, xlsx, ppt, pptx, txt, rtf, csv | * | Hình ảnh | jpg, jpeg, png, gif, bmp | * | Video | mp4, avi, mkv, mov, wmv | * * @minimumVersion 2.44.0 * @requirePermission Cần xin Cấp quyền sử dụng các API này cho Mini App ID tại trang Quản lý ứng dụng. Nếu không, sẽ bị [lỗi với người dùng bình thường, mặc dù Developer/Admin thì không bị](https://mini.zalo.me/community/8746968970844796879/loi-chi-xay-ra-voi-nguoi-dung-binh-thuong-con-developer-admin-thi-khong-bi). * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} url Đường dẫn của file muốn download. * @param {(progress: number) => void} [onProgress] Callback function tiến độ tải file. Với `progress` là số từ 0 đến 100%. * * @example Thông báo một lần sau khi tải file xong: * ```ts * await downloadFile({ * url: "https://stc-zmp.zadn.vn/mini-app/landingpage-banner-new.png", * }); * console.log("Tải file thành công!"); * ``` * * @example Xử lý lỗi khi tải file (tham khảo bảng mã lỗi tại [đây](https://mini.zalo.me/documents/api/downloadFile/#errors)): * ```ts * try { * await downloadFile({ * url: "https://stc-zmp.zadn.vn/mini-app/landingpage-banner-new.png", * }); * } catch (error) { * // Đã có lỗi xảy ra * console.error(error); * } * ``` * * @example Báo cáo tiến độ tải file: * ```ts * await downloadFile({ * url: "https://stc-zmp.zadn.vn/mini-app/landingpage-banner-new.png", * onProgress: (progress) => { * console.log(`Đã tải được ${progress}%...`); * }, * }); * console.log("Tải file thành công!"); * ``` */ declare function downloadFile(args: AsyncProgressCallback & TypeOf<(typeof downloadFileArgs)[0]>): Promise; declare const trackingManager: { logEvent: typeof logEvent; }; declare const showCustomOAWidgetArgs: ZodObject<{ id: ZodString; textColor: ZodOptional; fontSize: ZodOptional; buttonHeight: ZodOptional; buttonColor: ZodOptional; buttonTextColor: ZodOptional; buttonRadius: ZodOptional; buttonText: ZodOptional; checkboxBGColor: ZodOptional; checkboxCheckmarkColor: ZodOptional; onClick: ZodOptional, ZodUnknown>>; onStatusChange: ZodOptional, ZodUnknown>>; onError: ZodOptional, ZodUnknown>>; }, "strip", ZodAny, { [x: string]: any; textColor?: string | undefined; onStatusChange?: ((...args: unknown[]) => unknown) | undefined; onError?: ((...args: unknown[]) => unknown) | undefined; fontSize?: string | undefined; buttonHeight?: string | undefined; buttonColor?: string | undefined; buttonTextColor?: string | undefined; buttonRadius?: string | undefined; buttonText?: string | undefined; checkboxBGColor?: string | undefined; checkboxCheckmarkColor?: string | undefined; onClick?: ((...args: unknown[]) => unknown) | undefined; id: string; }, { [x: string]: any; textColor?: string | undefined; onStatusChange?: ((...args: unknown[]) => unknown) | undefined; onError?: ((...args: unknown[]) => unknown) | undefined; fontSize?: string | undefined; buttonHeight?: string | undefined; buttonColor?: string | undefined; buttonTextColor?: string | undefined; buttonRadius?: string | undefined; buttonText?: string | undefined; checkboxBGColor?: string | undefined; checkboxCheckmarkColor?: string | undefined; onClick?: ((...args: unknown[]) => unknown) | undefined; id: string; }>[]; /** * Nhằm tối ưu hiệu quả tăng follower của OA cho nhóm đối tác nội bộ, đồng thời đảm bảo trải nghiệm của User, không cảm thấy confuse, spam, Platform đã hỗ trợ cho nhóm đối tác nội bộ tool Widget "Quan tâm OA custom". * Đối tác có thể chỉnh sửa và gắn widget vào Mini App. * * @minimumVersion 2.46.0 * @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile. * * @param {string} id - ID của element, nơi cần hiển thị widget. * @param {string} [textColor='#6F7071'] - Màu chữ của checkbox ("Đồng ý theo dõi OA"). * @param {string} [fontSize='12px'] - Kích thước chữ cho checkbox * @param {string} [buttonHeight='48px'] - Chiều cao của nút CTA. * @param {string} [buttonColor='#0068FF'] - Màu nền của nút CTA. * @param {string} [buttonTextColor='#FFFFFF'] - Màu chữ của nút CTA. * @param {string} [buttonRadius='9999px'] - Border radius của nút CTA. * @param {string} [buttonText='Đồng ý'] - Nội dung hiển thị trên nút CTA. * @param {string} [checkboxBGColor='#0068FF'] - Màu nền của ô checkbox. * @param {string} [checkboxCheckmarkColor='#FFFFFF'] - Màu của dấu check (checkmark) trong checkbox. * @param {(status: boolean) => void} [onClick] - Callback được gọi khi người dùng nhấn nút CTA. Trả về `true` nếu checkbox được tick, ngược lại `false`. * @param {(error: string) => void} [onError] - Callback được gọi khi có lỗi xảy ra trong quá trình tương tác với widget. * * @example Hiển thị Widget Quan tâm OA Custom: * ```ts * import React, { useEffect } from "react"; * import { showCustomOAWidget } from "zmp-sdk/apis"; * * function HomePage() { * useEffect(() => { * showCustomOAWidget({ * id: "oaCustomWidget", * onClick: (status) => { * console.log(status); * }, * }); * }, []); * * return ( * <> * ... *
* ... * * ); * } * * export default HomePage; * ``` */ declare function showCustomOAWidget(args: AsyncVoidCallback & TypeOf<(typeof showCustomOAWidgetArgs)[0]>): Promise; declare class AppError { code: number; message: string | string[]; api?: string | symbol; detail?: any; constructor(code: number, message: string | string[], api?: string | symbol, detail?: any); toString(): string; toJSON(): object; } declare const otherApis: { Events: typeof Events; EventName: typeof Events; CameraEvents: typeof CameraEvents; AppError: typeof AppError; login: typeof login; getAccessToken: typeof getAccessToken; getVersion: typeof getVersion; getSystemInfo: typeof getSystemInfo; setNavigationBarTitle: typeof setNavigationBarTitle; setNavigationBarColor: typeof setNavigationBarColor; setNavigationBarLeftButton: typeof setNavigationBarLeftButton; setStorage: typeof setStorage; getStorage: typeof getStorage; getStorageInfo: typeof getStorageInfo; removeStorage: typeof removeStorage; clearStorage: typeof clearStorage; getUserInfo: typeof getUserInfo; getNetworkType: typeof getNetworkType; onNetworkStatusChange: typeof onNetworkStatusChange; startBeaconDiscovery: typeof startBeaconDiscovery; stopBeaconDiscovery: typeof stopBeaconDiscovery; getBeacons: typeof getBeacons; closeApp: typeof closeApp; scanQRCode: typeof scanQRCode; openProfile: typeof openProfile; openChat: typeof openChat; openPostFeed: typeof openPostFeed; followOA: typeof followOA; unfollowOA: typeof unfollowOA; openShareSheet: typeof openShareSheet; requestCameraPermission: typeof requestCameraPermission; createShortcut: typeof createShortcut; openBioAuthentication: typeof openBioAuthentication; checkStateBioAuthentication: typeof checkStateBioAuthentication; showToast: typeof showToast; hideKeyboard: typeof hideKeyboard; openPhone: typeof openPhone; openSMS: typeof openSMS; viewOAQr: typeof viewOAQr; keepScreen: typeof keepScreen; onKeepScreen: typeof onKeepScreen; offKeepScreen: typeof offKeepScreen; saveImageToGallery: typeof saveImageToGallery; saveVideoToGallery: typeof saveVideoToGallery; openMiniApp: typeof openMiniApp; vibrate: typeof vibrate; openWebview: typeof openWebview; getRouteParams: typeof getRouteParams; getAppInfo: typeof getAppInfo; sendDataToPreviousMiniApp: typeof sendDataToPreviousMiniApp; getPhoneNumber: typeof getPhoneNumber; openProfilePicker: typeof openProfilePicker; connectWifi: typeof connectWifi; openMediaPicker: typeof openMediaPicker; getShareableLink: typeof getShareableLink; closeLoading: typeof closeLoading; requestUpdateZalo: typeof requestUpdateZalo; onConfirmToExit: typeof onConfirmToExit; offConfirmToExit: typeof offConfirmToExit; getDeviceId: typeof getDeviceId; getDeviceIdAsync: typeof getDeviceIdAsync; getContext: typeof getContext; getContextAsync: typeof getContextAsync; getAuthCode: typeof getAuthCode; getZPIToken: typeof getZPIToken; setAccessToken: typeof setAccessToken; openOutApp: typeof openOutApp; chooseImage: typeof chooseImage; getLocation: typeof getLocation; onCallbackData: typeof onCallbackData; events: eventemitter3; setAndroidBottomNavigationBar: typeof setAndroidBottomNavigationBar; setIOSBottomSafeArea: typeof setIOSBottomSafeArea; setStatusBar: typeof setStatusBar; configAppView: typeof configAppView; minimizeApp: typeof minimizeApp; openPermissionSetting: typeof openPermissionSetting; favoriteApp: typeof favoriteApp; openGroupList: typeof openGroupList; requestSendNotification: typeof requestSendNotification; addRating: typeof addRating; interactOA: typeof interactOA; interactOa: typeof interactOA; isAllowedInteractWithOA: typeof checkIsAllowedInteractWithOA; getSetting: typeof getSetting; authorize: typeof authorize; checkZaloCameraPermission: typeof checkZaloCameraPermission; getUserID: typeof getUserID; getIDToken: typeof getIDToken; createCameraContext: typeof createCameraContext; setupAd: typeof setupAd; loadAd: typeof loadAd; displayAd: typeof displayAd; refreshAd: typeof refreshAd; showOAWidget: typeof showOAWidget; showFunctionButtonWidget: typeof showFunctionButtonWidget; scanNFC: typeof scanNFC; checkNFC: typeof checkNFC; nativeStorage: { getItem: typeof getItem; setItem: typeof setItem; clear: typeof clear; removeItem: typeof removeItem; getStorageInfo: typeof getStorageInfoSync; }; Payment: { purchase: typeof purchase; createOrder: typeof createOrder; checkTransaction: typeof checkTransaction; createOrderIAP: typeof createOrderIAP; selectPaymentMethod: typeof selectPaymentMethod; }; CheckoutSDK: { purchase: typeof purchase; createOrder: typeof createOrder; checkTransaction: typeof checkTransaction; createOrderIAP: typeof createOrderIAP; selectPaymentMethod: typeof selectPaymentMethod; }; downloadFile: typeof downloadFile; trackingManager: { logEvent: typeof logEvent; }; showCustomOAWidget: typeof showCustomOAWidget; FacingMode: typeof FacingMode; PhotoFormat: typeof PhotoFormat; PhotoQuality: typeof PhotoQuality; StreamType: typeof StreamType; ZMACameraImp: typeof ZMACameraImp; }; export { Action, AndroidBottomNavigationBarType, AppError, AsyncCallback, AsyncCallbackFailObject, AsyncProgressCallback, AsyncVoidCallback, AuthorizeType, CameraEvents, CameraParams, ChatType, CheckStateBioAuthenticationReturns, CheckTransactionReturns, CheckZaloCameraPermissionReturns, CheckoutSDK, ChooseImageReturns, Common, ContextInfo, CreateOrderIAPReturns, CreateOrderReturns, Events as EventName, Events, FacingMode, FunctionProps, GetAppInfoReturns, GetAuthCodeReturns, GetBeaconDiscoveryReturns, GetLocationReturns, GetNetworkTypeReturns, GetPhoneNumberReturns, GetSettingReturn, GetStorageReturns, GetUserInfoReturns, GetZPITokenReturns, IAPMethodType, IAPPayType, IAPPayTypeType, IOSSafeAreaBottomType, JumpStatus, KeepScreenReturns, LogData, MediaConstraints, MediaDevice, MediaPickerType, NativeCallBackData, NetworkType, OpenBioAuthenticationReturns, OpenMediaPickerReturns, OpenPostFeedReturns, OpenProfilePickerReturns, OpenShareSheetReturns, OpenWebviewReturns, OrientationType, Payment, PhotoConstraint, PhotoFormat, PhotoFrame, PhotoQuality, PickAttr, PickedProfile, PlatformType, PostFeedType, ProfileInfo, ProfileType, ProrationMode, ProrationModeType, RemoveStorageReturns, RequestCameraPermissionReturns, SaveFileReturns, ScanNFCType, ScanQRCodeReturns, SelectPaymentMethodReturns, SetStorageReturns, ShareSheetType, StatusBarType, StorageInfo, StreamType, SystemInfo, TempFile, TextAlignType, UserInfo, VibrateType, ZMACamera, ZMACameraImp, addRating, authorize, checkNFC, checkStateBioAuthentication, checkTransaction, checkZaloCameraPermission, chooseImage, clearStorage, closeApp, closeLoading, configAppView, connectWifi, createCameraContext, createOrder, createOrderIAP, createShortcut, otherApis as default, displayAd, downloadFile, events, favoriteApp, followOA, getAccessToken, getAppInfo, getAuthCode, getBeacons, getContext, getContextAsync, getDeviceId, getDeviceIdAsync, getIDToken, getLocation, getNetworkType, getPhoneNumber, getRouteParams, getSetting, getShareableLink, getStorage, getStorageInfo, getSystemInfo, getUserID, getUserInfo, getVersion, getZPIToken, hideKeyboard, iBeaconInfo, interactOA, interactOA as interactOa, checkIsAllowedInteractWithOA as isAllowedInteractWithOA, keepScreen, loadAd, login, minimizeApp, nativeStorage, offConfirmToExit, offKeepScreen, onCallbackData, onConfirmToExit, onKeepScreen, onNetworkStatusChange, openBioAuthentication, openChat, openGroupList, openMediaPicker, openMiniApp, openOutApp, openPermissionSetting, openPhone, openPostFeed, openProfile, openProfilePicker, openSMS, openShareSheet, openWebview, purchase, refreshAd, removeStorage, requestCameraPermission, requestSendNotification, requestUpdateZalo, saveImageToGallery, saveVideoToGallery, scanNFC, scanQRCode, selectPaymentMethod, sendDataToPreviousMiniApp, setAccessToken, setAndroidBottomNavigationBar, setIOSBottomSafeArea, setNavigationBarColor, setNavigationBarLeftButton, setNavigationBarTitle, setStatusBar, setStorage, setupAd, showCustomOAWidget, showFunctionButtonWidget, showOAWidget, showToast, startBeaconDiscovery, stopBeaconDiscovery, trackingManager, unfollowOA, vibrate, viewOAQr };