UNPKG

@shopify/app-bridge

Version:

[![Build Status](https://travis-ci.com/Shopify/app-bridge.svg?token=RBRyvqQyN525bnfz7J8p&branch=master)](https://travis-ci.com/Shopify/app-bridge) [![codecov](https://codecov.io/gh/Shopify/app-bridge/branch/master/graph/badge.svg?token=nZ21m39Dr6)](https:

41 lines (40 loc) 2.66 kB
import { ClientApplication } from '../client'; import { Indexable } from './merge'; import { ActionCallback, ActionSetInterface, ActionSubscription, Component, ErrorCallback, Unsubscribe } from './types'; export declare function actionWrapper(action: any): any; export declare function getVersion(): any; export declare function getEventNameSpace(group: string, eventName: string, component?: Component): string; export declare function isValidOptionalNumber(value?: number): boolean; export declare function isValidOptionalString(value?: string): boolean; export declare abstract class ActionSet implements ActionSetInterface { readonly id: string; readonly type: string; readonly app: ClientApplication<any>; readonly defaultGroup: string; group: string; subgroups: string[]; subscriptions: ActionSubscription[]; constructor(app: ClientApplication<any>, type: string, group: string, id?: string); readonly component: Component; updateSubscription(subscriptionToRemove: ActionSubscription, group: string, subgroups: string[]): Unsubscribe; error(callback: ErrorCallback): Unsubscribe; subscribe(eventName: string, callback: ActionCallback, component?: Component, currentIndex?: number): Unsubscribe; unsubscribe(resetOnly?: boolean): this; } export declare abstract class ActionSetWithChildren extends ActionSet { children: ActionSetChildAction[]; unsubscribe(unsubscribeChildren?: boolean, resetParentOnly?: boolean): this; getChild(id: string): ActionSetChildAction | undefined; getChildIndex(id: string): number; getChildSubscriptions(id: string, eventType?: string): ActionSubscription[]; addChild(child: ActionSetChildAction, group: string, subgroups: string[]): this; removeChild(id: string): this; subscribeToChild(child: ActionSetChildAction, eventName: string | string[], callback: (childData: any) => void): this; getUpdatedChildActions<A extends ActionSetChildAction>(newActions: A[], currentActions: A[]): A[] | undefined; } export declare type ActionSetChildAction = ActionSet | ActionSetWithChildren; export declare function sanitizeProps<Prop, Key extends keyof Prop>(obj: Prop, keys: Key[]): Pick<Prop, Key>; export declare function updateActionFromPayload<A extends Partial<ActionSetInterface>>(action: A, newProps: A): boolean; export declare function getMergedProps<Prop extends Indexable>(props: Prop, newProps: Partial<Prop>): Prop; export declare function forEachInEnum<E extends Indexable>(types: E, callback: (prop: string) => void): void; export declare function findMatchInEnum<E extends Indexable>(types: E, lookup: string): string | undefined;