@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)**
46 lines (45 loc) • 2.73 kB
TypeScript
import { ClientApplication } from '../client/types';
import { Indexable } from './merge';
import { ActionCallback, ActionSetInterface, ActionSubscription, Component, ErrorCallback, Group, Unsubscribe } from './types';
export declare function actionWrapper(action: any): any;
export declare function getVersion(): any;
/**
* Returns full event name with prefix, group, subgroups and type formatted with separators
* @internal
* */
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 {
app: ClientApplication<any>;
type: string;
group: string;
readonly id: string;
readonly defaultGroup: string;
subgroups: string[];
subscriptions: ActionSubscription[];
constructor(app: ClientApplication<any>, type: string, group: string, id?: string);
set(..._: any[]): void;
get 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 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;
export declare const NonSnakeCaseGroup: Group[];