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