native-fn
Version:
85 lines (84 loc) • 2.8 kB
TypeScript
import { AppOpenState, MessengerType, SettingType } from "../constants";
import { OS } from "../../platform/constants";
import { URLOpenError } from "../errors/url-open-error";
export declare interface AppInfo {
scheme?: URLCandidate;
fallback?: URLCandidateOrFallback;
timeout?: number;
allowAppStore?: boolean;
allowWebStore?: boolean;
}
export declare interface PackageName {
packageName?: string;
}
export declare interface ProductId {
productId?: string;
}
export declare interface BundleId {
bundleId?: string;
}
export declare interface TrackId {
trackId?: string;
}
export declare interface AndroidAppInfo extends AppInfo, PackageName {
intent?: URLCandidate;
}
export declare interface IOSAppInfo extends AppInfo, BundleId, TrackId {
universal?: URLCandidate;
}
export declare interface WindowsAppInfo extends AppInfo, PackageName, ProductId {
}
export declare interface MacOSAppInfo extends AppInfo, BundleId, TrackId {
}
export declare interface StoreInfo {
appStore?: string;
webStore?: string;
}
export declare interface AppOpenOptions {
[OS.Android]?: AndroidAppInfo;
['android']?: AndroidAppInfo;
[OS.iOS]?: IOSAppInfo;
['ios']?: IOSAppInfo;
[OS.Windows]?: WindowsAppInfo;
['windows']?: WindowsAppInfo;
[OS.MacOS]?: MacOSAppInfo;
['macos']?: MacOSAppInfo;
}
export interface Contact {
name?: string;
email?: string;
tel?: string;
address?: string;
icon?: string;
}
export interface ContactOpenOptions {
multiple: boolean;
}
export declare type URLCandidate = URL | string;
export declare type URLCandidateOrFallback = URLCandidate | (() => any);
export declare type URLStringOrFallback = string | (() => any);
export declare type Stringifiable = string | number | boolean | HTMLElement | null | undefined;
export declare type StringifiableSequence = Stringifiable[] | NodeList | NodeListOf<Node> | HTMLCollectionBase;
export declare type MessengerOpenOptions = {
to?: Stringifiable | StringifiableSequence;
cc?: Stringifiable | StringifiableSequence;
bcc?: Stringifiable | StringifiableSequence;
subject?: Stringifiable;
body?: Stringifiable;
} | HTMLFormElement | FormData;
export declare type Messenger = Record<MessengerType, (options: MessengerOpenOptions) => Promise<void>>;
export declare interface App {
open(options: AppOpenOptions): Promise<AppOpenState>;
setting(type: SettingType): Promise<void>;
file(): Promise<File[]>;
contact(options?: ContactOpenOptions): Promise<Contact[]>;
messenger: Messenger;
Constants: {
AppOpenState: typeof AppOpenState;
MessengerType: typeof MessengerType;
SettingType: typeof SettingType;
};
Errors: {
URLOpenError: typeof URLOpenError;
};
}