1 | import { AnyAction, Dispatch, Unsubscribe } from '@shopify/app-bridge/actions/types';
|
2 | import { Context, ContextualMessageTransport } from '@shopify/app-bridge/MessageTransport';
|
3 | import { TransportSubscription, TransportDispatch } from '@shopify/app-bridge';
|
4 | import { Store as GlobalStore } from './store';
|
5 | export declare const MessageTransportType = "application";
|
6 |
|
7 |
|
8 |
|
9 | export interface AppConfig {
|
10 | apiKey: string;
|
11 | }
|
12 |
|
13 |
|
14 |
|
15 | export interface PrivilegedAppConfig extends AppConfig {
|
16 | apiClientId?: string;
|
17 | appId: string;
|
18 | name: string;
|
19 | shopId: string;
|
20 | url: string;
|
21 | handle: string;
|
22 | }
|
23 | export declare type ApiClientConfig = PrivilegedAppConfig;
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | export interface Application {
|
29 | |
30 |
|
31 |
|
32 |
|
33 | attach(to: ContextualMessageTransport): (unload?: boolean) => void;
|
34 | |
35 |
|
36 |
|
37 |
|
38 |
|
39 | dispatch(action: AnyAction): void;
|
40 | |
41 |
|
42 |
|
43 | getState(): GlobalStore;
|
44 | |
45 |
|
46 |
|
47 | subscribe(callback: (message: TransportDispatch) => void): Unsubscribe;
|
48 | |
49 |
|
50 |
|
51 | subscribe(eventNameSpace: string, callback: (payload: any) => void, id?: string): Unsubscribe;
|
52 | |
53 |
|
54 |
|
55 | isTransportSubscribed(context: Context, type: string, id?: string): boolean;
|
56 | }
|
57 | export interface LoadData {
|
58 | type: typeof MessageTransportType;
|
59 | config: ApiClientConfig;
|
60 | }
|
61 | export interface MiddlewareAPI<S> {
|
62 | dispatch: Dispatch<S>;
|
63 | getState(): S;
|
64 | }
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | export interface Middleware {
|
70 | load(data: LoadData): Application;
|
71 | <S>(api: MiddlewareAPI<S>): (next: Dispatch<S>) => Dispatch<S>;
|
72 | }
|
73 | export declare type Reducer<S> = (state: S, action: AnyAction) => S;
|
74 | export interface Store<S> {
|
75 | dispatch: Dispatch<S>;
|
76 | getState(): S;
|
77 | subscribe(listener: () => void): Unsubscribe;
|
78 | replaceReducer(nextReducer: Reducer<S>): void;
|
79 | }
|
80 | export interface Subscription {
|
81 | [key: string]: TransportSubscription[] | undefined;
|
82 | }
|
83 | export declare type Subscriptions = {
|
84 | [key in Context]: Subscription;
|
85 | };
|
86 | export { AnyAction, Dispatch };
|
87 | export interface TrackingEventPayload {
|
88 | action: AnyAction;
|
89 | appId: string;
|
90 | shopId: string;
|
91 | }
|
92 |
|
93 |
|
94 |
|
95 |
|
96 | export declare type HostFeatures = keyof GlobalStore;
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | export interface ComponentProps {
|
102 | globalStore: GlobalStore;
|
103 | }
|