import { compose, Middleware as ReduxMiddleware, MiddlewareAPI, ReducersMapObject, Reducer, Store as ReduxStore, AnyAction } from 'redux'; import { Context } from '@shopify/app-bridge'; import { MetaAction, Group } from '@shopify/app-bridge/actions'; import { buildMiddleware } from '../Middleware'; import { HostFeatures } from '../types'; import { PerformanceStore } from '../features/performance'; import { FeaturesState } from './reducers/embeddedApp/features'; import { ToastStore } from './reducers/embeddedApp/toast'; import { LoadingStore } from './reducers/embeddedApp/loading'; import { ModalStore } from './reducers/embeddedApp/modal'; import { TitleBarStore } from './reducers/embeddedApp/titleBar'; import { ResourcePickerStore } from './reducers/embeddedApp/resourcePicker'; import { NavigationStore } from './reducers/embeddedApp/navigation'; import { POSStore } from './reducers/embeddedApp/pos'; import { StaffMemberStore } from './reducers/embeddedApp/staffMember'; import { ContextualSaveBarStore } from './reducers/embeddedApp/contextualSaveBar'; import { MenuStore } from './reducers/embeddedApp/menu'; import { Store as FeedbackModalStore } from './reducers/feedbackModal'; import { Store as LeaveConfirmationStore } from './reducers/leaveConfirmation'; interface DevToolsOptions { name?: string; shouldHotReload?: boolean; } declare global { interface Window { __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: (options: DevToolsOptions) => typeof compose; } } /** * The interface for the app state * @public */ export interface Store { features: FeaturesState; performance?: PerformanceStore; pos?: POSStore; staffMember?: StaffMemberStore; isLegacy?: boolean; contextualSaveBar?: ContextualSaveBarStore; fullscreen?: boolean; loading?: LoadingStore; modal?: ModalStore; navigation?: NavigationStore; resourcePicker?: ResourcePickerStore | null; titleBar?: TitleBarStore | null; toast?: ToastStore; menu?: MenuStore; scanner?: {}; print?: {}; share?: {}; cart?: {}; sessionToken?: {}; authCode?: {}; marketingExternalActivityTopBar?: {}; feedbackModal?: FeedbackModalStore; leaveConfirmation?: LeaveConfirmationStore; } /** * The app state keyed with `appBridge` * @internal */ export interface AppBridgeStore { appBridge: Store; } /** * The interface for an injected reducer's options * @public * */ export interface ReducerMap { /** A key matching a property in the app state */ key: keyof Store; /** Reducer to add to a store */ reducer: Reducer; /** Optional default state for the injected reducer*/ initialState?: Partial; } /** * The constant key `appBridge` * @public */ export declare const APP_BRIDGE_KEY = "appBridge"; /** * Returns a combined reducer for the `appBridge` key * Always includes the `features` reducer * @public * @param stateReducers - a reducer map for the dynamic app state * @param initialState - an optional default value for the store */ export declare function createReducers(stateReducers?: ReducersMapObject, initialState?: Partial): (state: { appBridge: { features: {}; }; } | undefined, action: AnyAction) => AppBridgeStore | { appBridge: { features: {}; }; }; /** * Creates a store containing only the default `features` reducer * @public */ export declare function createStore(middleware?: Array | ReduxMiddleware>, initialState?: Partial, debug?: boolean): ReduxStore & { dispatch: unknown; }; /** * Creates a method that when called, dynamically adds a reducer to * the provided store * @internal * @param store - a Redux store * @param globalInitialState - custom overrides for resolving the app state when adding a new reducer * */ export declare function createAddReducer(store: ReduxStore, globalInitialState?: Partial): ({ key, reducer, initialState }: ReducerMap) => void; declare type QueuedClientAction = MetaAction & { group: Group; }; /** * The inteface for a queue with methods to add to the queue, clear the queue and also resolve the queue * @internal * */ export interface ActionsQueue { /** Add the action to the queue for the provided `context` */ add(context: Context, action: QueuedClientAction): void; /** Removes all actions in the queue for the provided `context` */ clear(context: Context): void; /** Dispatch all actions related to the feature in the queue for all contexts */ resolve(key: HostFeatures): void; } /** * Creates an action queue for the provided store * @internal * */ export declare function createActionsQueue(store: MiddlewareAPI): ActionsQueue; /** * Predicate to determine if a reducer for the associated action is already loaded * @internal */ export declare function isReducerLoaded(state: any, action: any): boolean; export {};