UNPKG

@shopify/app-bridge

Version:

**Shopify is doubling our engineering staff in 2021! [Join our team and work on libraries like this one.](https://smrtr.io/5GGrc)**

43 lines (42 loc) 1.42 kB
import { ClientApplication } from '../../client'; import { ActionSet } from '../helper'; import { ActionSetProps, Group, MetaAction } from '../types'; export declare enum Action { SHOW = "APP::TOAST::SHOW", CLEAR = "APP::TOAST::CLEAR" } export interface Options { duration: number; isError?: boolean; message: string; } export interface ClearPayload { readonly id?: string; } export interface Payload extends Options { readonly id?: string; } export interface ActionBase extends MetaAction { readonly group: typeof Group.Toast; } export interface ShowAction extends ActionBase { readonly type: typeof Action.SHOW; readonly payload: Payload; } export interface ClearAction extends ActionBase { readonly type: typeof Action.CLEAR; } export declare type ToastAction = ShowAction | ClearAction | MetaAction; export declare function show(toastMessage: Payload): ShowAction; export declare function clear(payload: ClearPayload): ClearAction; export declare class Toast extends ActionSet implements ActionSetProps<Options, Payload> { message: string; duration: number; isError?: boolean; constructor(app: ClientApplication<any>, options: Options); get options(): Options; get payload(): Payload; set(options: Partial<Options>): this; dispatch(action: Action): this; } export declare function create(app: ClientApplication<any>, options: Options): Toast;