1 | import { compose, Middleware as ReduxMiddleware, MiddlewareAPI, ReducersMapObject, Reducer, Store as ReduxStore, AnyAction } from 'redux';
|
2 | import { Context } from '@shopify/app-bridge';
|
3 | import { MetaAction, Group } from '@shopify/app-bridge/actions';
|
4 | import { FeaturesState } from './reducers/embeddedApp/features';
|
5 | import { ToastStore } from './reducers/embeddedApp/toast';
|
6 | import { LoadingStore } from './reducers/embeddedApp/loading';
|
7 | import { ModalStore } from './reducers/embeddedApp/modal';
|
8 | import { TitleBarStore } from './reducers/embeddedApp/titleBar';
|
9 | import { ResourcePickerStore } from './reducers/embeddedApp/resourcePicker';
|
10 | import { NavigationStore } from './reducers/embeddedApp/navigation';
|
11 | import { POSStore } from './reducers/embeddedApp/pos';
|
12 | import { StaffMemberStore } from './reducers/embeddedApp/staffMember';
|
13 | import { ContextualSaveBarStore } from './reducers/embeddedApp/contextualSaveBar';
|
14 | import { MenuStore } from './reducers/embeddedApp/menu';
|
15 | import { buildMiddleware } from '../Middleware';
|
16 | import { HostFeatures } from '../types';
|
17 | interface DevToolsOptions {
|
18 | name?: string;
|
19 | shouldHotReload?: boolean;
|
20 | }
|
21 | declare global {
|
22 | interface Window {
|
23 | __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: (options: DevToolsOptions) => typeof compose;
|
24 | }
|
25 | }
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | export interface Store {
|
31 | features: FeaturesState;
|
32 | pos?: POSStore;
|
33 | staffMember?: StaffMemberStore;
|
34 | isLegacy?: boolean;
|
35 | contextualSaveBar?: ContextualSaveBarStore;
|
36 | fullscreen?: boolean;
|
37 | loading?: LoadingStore;
|
38 | modal?: ModalStore;
|
39 | navigation?: NavigationStore;
|
40 | resourcePicker?: ResourcePickerStore | null;
|
41 | titleBar?: TitleBarStore | null;
|
42 | toast?: ToastStore;
|
43 | menu?: MenuStore;
|
44 | scanner?: {};
|
45 | print?: {};
|
46 | share?: {};
|
47 | cart?: {};
|
48 | sessionToken?: {};
|
49 | authCode?: {};
|
50 | }
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | export interface AppBridgeStore {
|
56 | appBridge: Store;
|
57 | }
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | export interface ReducerMap<State> {
|
63 |
|
64 | key: keyof Store;
|
65 |
|
66 | reducer: Reducer<State>;
|
67 |
|
68 | initialState?: Partial<State>;
|
69 | }
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | export declare const APP_BRIDGE_KEY = "appBridge";
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | export declare function createReducers(stateReducers?: ReducersMapObject, initialState?: Partial<Store>): (state: {
|
83 | [APP_BRIDGE_KEY]: {
|
84 | features: {};
|
85 | };
|
86 | } | undefined, action: AnyAction) => AppBridgeStore;
|
87 |
|
88 |
|
89 |
|
90 |
|
91 | export declare function createStore(middleware?: Array<ReturnType<typeof buildMiddleware> | ReduxMiddleware>, initialState?: Partial<Store>, debug?: boolean): ReduxStore<AppBridgeStore, AnyAction> & {
|
92 | dispatch: {};
|
93 | };
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | export declare function createAddReducer(store: ReduxStore, globalInitialState?: Partial<Store>): <State>({ key, reducer, initialState }: ReducerMap<State>) => void;
|
102 | declare type QueuedClientAction = MetaAction & {
|
103 | group: Group;
|
104 | };
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | export interface ActionsQueue {
|
110 |
|
111 | add(context: Context, action: QueuedClientAction): void;
|
112 |
|
113 | clear(context: Context): void;
|
114 |
|
115 | resolve(key: HostFeatures): void;
|
116 | }
|
117 |
|
118 |
|
119 |
|
120 |
|
121 | export declare function createActionsQueue(store: MiddlewareAPI<any>): ActionsQueue;
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | export declare function isReducerLoaded(state: any, action: any): any;
|
127 | export {};
|