2022-02-17 23:06:04 -06:00
|
|
|
import { CombinedState, combineReducers, Reducer } from 'redux';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2022-02-17 23:06:04 -06:00
|
|
|
import { initialVariableEditorState, variableEditorReducer, VariableEditorState } from '../editor/reducer';
|
|
|
|
import { initialVariableInspectState, variableInspectReducer, VariableInspectState } from '../inspect/reducer';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { initialOptionPickerState, optionsPickerReducer, OptionsPickerState } from '../pickers/OptionsPicker/reducer';
|
|
|
|
|
|
|
|
import { initialTransactionState, transactionReducer, TransactionState } from './transactionReducer';
|
2022-02-17 23:06:04 -06:00
|
|
|
import { initialVariablesState, VariablesState } from './types';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { variablesReducer } from './variablesReducer';
|
2020-03-10 02:53:41 -05:00
|
|
|
|
2022-02-17 23:06:04 -06:00
|
|
|
export interface TemplatingState {
|
|
|
|
editor: VariableEditorState;
|
|
|
|
variables: VariablesState;
|
|
|
|
optionsPicker: OptionsPickerState;
|
|
|
|
transaction: TransactionState;
|
|
|
|
inspect: VariableInspectState;
|
|
|
|
}
|
2020-06-04 01:59:57 -05:00
|
|
|
|
2022-02-17 23:06:04 -06:00
|
|
|
let templatingReducers: Reducer<CombinedState<TemplatingState>>;
|
2021-09-13 08:00:41 -05:00
|
|
|
|
2022-02-17 23:06:04 -06:00
|
|
|
export function getTemplatingReducers() {
|
|
|
|
if (!templatingReducers) {
|
|
|
|
templatingReducers = combineReducers({
|
|
|
|
editor: variableEditorReducer,
|
|
|
|
variables: variablesReducer,
|
|
|
|
optionsPicker: optionsPickerReducer,
|
|
|
|
transaction: transactionReducer,
|
|
|
|
inspect: variableInspectReducer,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return templatingReducers;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getInitialTemplatingState() {
|
|
|
|
return {
|
|
|
|
editor: initialVariableEditorState,
|
|
|
|
variables: initialVariablesState,
|
|
|
|
optionsPicker: initialOptionPickerState,
|
|
|
|
transaction: initialTransactionState,
|
|
|
|
inspect: initialVariableInspectState,
|
|
|
|
};
|
|
|
|
}
|