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 } from './store/async';
|
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 |
|
44 |
|
45 | getState(): any;
|
46 | |
47 |
|
48 |
|
49 | subscribe(listener: (message: TransportDispatch) => void): () => void;
|
50 | |
51 |
|
52 |
|
53 | isTransportSubscribed(context: Context, type: string, id?: string): boolean;
|
54 | }
|
55 | export interface LoadData {
|
56 | type: typeof MessageTransportType;
|
57 | config: ApiClientConfig;
|
58 | }
|
59 | export interface MiddlewareAPI<S> {
|
60 | dispatch: Dispatch<S>;
|
61 | getState(): S;
|
62 | }
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | export interface Middleware {
|
68 | load(data: LoadData): Application;
|
69 | <S>(api: MiddlewareAPI<S>): (next: Dispatch<S>) => Dispatch<S>;
|
70 | }
|
71 | export declare type Reducer<S> = (state: S, action: AnyAction) => S;
|
72 | export interface Store<S> {
|
73 | dispatch: Dispatch<S>;
|
74 | getState(): S;
|
75 | subscribe(listener: () => void): Unsubscribe;
|
76 | replaceReducer(nextReducer: Reducer<S>): void;
|
77 | }
|
78 | export interface Subscription {
|
79 | [key: string]: TransportSubscription[] | undefined;
|
80 | }
|
81 | export declare type Subscriptions = {
|
82 | [key in Context]: Subscription;
|
83 | };
|
84 | export { AnyAction, Dispatch };
|
85 | export interface TrackingEventPayload {
|
86 | action: AnyAction;
|
87 | appId: string;
|
88 | shopId: string;
|
89 | }
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | export declare type HostFeatures = keyof Store;
|
95 |
|
96 |
|
97 |
|
98 |
|
99 | export interface ComponentProps {
|
100 | globalStore: Store;
|
101 | }
|