@open-tender/cloud 0.0.121 → 0.0.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app/hooks.d.ts +6 -0
- package/dist/cjs/app/store.d.ts +18 -0
- package/dist/cjs/app/store.js +6 -0
- package/dist/cjs/slices/config.d.ts +2 -0
- package/dist/cjs/slices/config.js +15 -1
- package/dist/cjs/slices/index.d.ts +6 -0
- package/dist/cjs/slices/index.js +6 -0
- package/dist/cjs/slices/misc.d.ts +9 -1
- package/dist/cjs/slices/misc.js +26 -2
- package/dist/cjs/slices/modalSlice.d.ts +9 -0
- package/dist/cjs/slices/modalSlice.js +30 -0
- package/dist/cjs/slices/navSiteSlice.d.ts +7 -0
- package/dist/cjs/slices/navSiteSlice.js +23 -0
- package/dist/cjs/slices/navSlice.d.ts +7 -0
- package/dist/cjs/slices/navSlice.js +23 -0
- package/dist/cjs/slices/postsSlice.d.ts +18 -0
- package/dist/cjs/slices/postsSlice.js +55 -0
- package/dist/cjs/slices/sidebarModalSlice.d.ts +7 -0
- package/dist/cjs/slices/sidebarModalSlice.js +23 -0
- package/dist/cjs/slices/sidebarSlice.d.ts +7 -0
- package/dist/cjs/slices/sidebarSlice.js +23 -0
- package/dist/cjs/slices/types.d.ts +7 -1
- package/dist/cjs/slices/types.js +6 -0
- package/dist/esm/app/hooks.d.ts +6 -0
- package/dist/esm/app/store.d.ts +18 -0
- package/dist/esm/app/store.js +7 -1
- package/dist/esm/slices/config.d.ts +2 -0
- package/dist/esm/slices/config.js +12 -0
- package/dist/esm/slices/index.d.ts +6 -0
- package/dist/esm/slices/index.js +6 -0
- package/dist/esm/slices/misc.d.ts +9 -1
- package/dist/esm/slices/misc.js +21 -1
- package/dist/esm/slices/modalSlice.d.ts +9 -0
- package/dist/esm/slices/modalSlice.js +25 -0
- package/dist/esm/slices/navSiteSlice.d.ts +7 -0
- package/dist/esm/slices/navSiteSlice.js +19 -0
- package/dist/esm/slices/navSlice.d.ts +7 -0
- package/dist/esm/slices/navSlice.js +19 -0
- package/dist/esm/slices/postsSlice.d.ts +18 -0
- package/dist/esm/slices/postsSlice.js +51 -0
- package/dist/esm/slices/sidebarModalSlice.d.ts +7 -0
- package/dist/esm/slices/sidebarModalSlice.js +19 -0
- package/dist/esm/slices/sidebarSlice.d.ts +7 -0
- package/dist/esm/slices/sidebarSlice.js +19 -0
- package/dist/esm/slices/types.d.ts +7 -1
- package/dist/esm/slices/types.js +6 -0
- package/package.json +1 -1
package/dist/cjs/app/hooks.d.ts
CHANGED
|
@@ -50,5 +50,11 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
50
50
|
loader: import("..").LoaderState;
|
|
51
51
|
qr: import("..").QrState;
|
|
52
52
|
misc: import("..").MiscState;
|
|
53
|
+
modal: import("..").ModalState;
|
|
54
|
+
navSite: import("..").NavSiteState;
|
|
55
|
+
nav: import("..").NavState;
|
|
56
|
+
posts: import("..").PostsSlice;
|
|
57
|
+
sidebarModal: import("..").SidebarModalState;
|
|
58
|
+
sidebar: import("..").SidebarState;
|
|
53
59
|
}>, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").Action<any>>;
|
|
54
60
|
export declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -49,6 +49,12 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
49
49
|
loader: import("../slices").LoaderState;
|
|
50
50
|
qr: import("../slices").QrState;
|
|
51
51
|
misc: import("../slices").MiscState;
|
|
52
|
+
modal: import("../slices").ModalState;
|
|
53
|
+
navSite: import("../slices").NavSiteState;
|
|
54
|
+
nav: import("../slices").NavState;
|
|
55
|
+
posts: import("../slices").PostsSlice;
|
|
56
|
+
sidebarModal: import("../slices").SidebarModalState;
|
|
57
|
+
sidebar: import("../slices").SidebarState;
|
|
52
58
|
}>, import("redux").AnyAction>;
|
|
53
59
|
export declare type AppState = ReturnType<typeof appReducer>;
|
|
54
60
|
declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").CombinedState<{
|
|
@@ -101,6 +107,12 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
101
107
|
loader: import("../slices").LoaderState;
|
|
102
108
|
qr: import("../slices").QrState;
|
|
103
109
|
misc: import("../slices").MiscState;
|
|
110
|
+
modal: import("../slices").ModalState;
|
|
111
|
+
navSite: import("../slices").NavSiteState;
|
|
112
|
+
nav: import("../slices").NavState;
|
|
113
|
+
posts: import("../slices").PostsSlice;
|
|
114
|
+
sidebarModal: import("../slices").SidebarModalState;
|
|
115
|
+
sidebar: import("../slices").SidebarState;
|
|
104
116
|
}>, Action<any>, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<import("redux").CombinedState<{
|
|
105
117
|
alerts: import("@open-tender/types").Alerts;
|
|
106
118
|
notifications: import("@open-tender/types").Notifications;
|
|
@@ -151,6 +163,12 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
151
163
|
loader: import("../slices").LoaderState;
|
|
152
164
|
qr: import("../slices").QrState;
|
|
153
165
|
misc: import("../slices").MiscState;
|
|
166
|
+
modal: import("../slices").ModalState;
|
|
167
|
+
navSite: import("../slices").NavSiteState;
|
|
168
|
+
nav: import("../slices").NavState;
|
|
169
|
+
posts: import("../slices").PostsSlice;
|
|
170
|
+
sidebarModal: import("../slices").SidebarModalState;
|
|
171
|
+
sidebar: import("../slices").SidebarState;
|
|
154
172
|
}>, import("redux").AnyAction, undefined>]>>;
|
|
155
173
|
export declare type AppDispatch = typeof store.dispatch;
|
|
156
174
|
export declare type RootState = ReturnType<typeof store.getState>;
|
package/dist/cjs/app/store.js
CHANGED
|
@@ -36,6 +36,12 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
|
|
|
36
36
|
[types_1.ReducerType.Loader]: slices_1.loaderReducer,
|
|
37
37
|
[types_1.ReducerType.Qr]: slices_1.qrReducer,
|
|
38
38
|
[types_1.ReducerType.Misc]: slices_1.miscReducer,
|
|
39
|
+
[types_1.ReducerType.Modal]: slices_1.modalReducer,
|
|
40
|
+
[types_1.ReducerType.NavSite]: slices_1.navSiteReducer,
|
|
41
|
+
[types_1.ReducerType.Nav]: slices_1.navReducer,
|
|
42
|
+
[types_1.ReducerType.Posts]: slices_1.postsReducer,
|
|
43
|
+
[types_1.ReducerType.SidebarModal]: slices_1.sidebarModalReducer,
|
|
44
|
+
[types_1.ReducerType.Sidebar]: slices_1.sidebarReducer,
|
|
39
45
|
});
|
|
40
46
|
const rootReducer = (state, action) => {
|
|
41
47
|
if (action.type === 'clearState') {
|
|
@@ -85,5 +85,7 @@ export declare const selectRecaptcha: (state: AppState) => {
|
|
|
85
85
|
} | undefined;
|
|
86
86
|
export declare const selectContentSection: <T extends keyof ConfigContent>(page: T) => (state: AppState) => ConfigContent[T] | undefined;
|
|
87
87
|
export declare const selectSoldOutMsg: (state: AppState) => string;
|
|
88
|
+
export declare const selectHeaderHeight: (state: AppState) => (isBrowser: boolean) => number;
|
|
88
89
|
export declare const selectOutpostName: (state: AppState) => string | undefined;
|
|
90
|
+
export declare const selectHasCatering: (state: AppState) => boolean;
|
|
89
91
|
export declare const configReducer: import("redux").Reducer<ConfigState, import("redux").AnyAction>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.configReducer = exports.selectOutpostName = exports.selectSoldOutMsg = exports.selectContentSection = exports.selectRecaptcha = exports.selectFulfillment = exports.selectOptIns = exports.selectLightColor = exports.selectConfigRetries = exports.selectDisplaySettings = exports.selectAccountConfig = exports.selectApi = exports.selectSettings = exports.selectContent = exports.selectTheme = exports.selectBrand = exports.selectConfig = exports.selectCateringOnly = exports.incrementRetries = exports.resetRetries = exports.resetConfig = exports.fetchConfig = exports.ConfigActionType = void 0;
|
|
4
|
+
exports.configReducer = exports.selectHasCatering = exports.selectOutpostName = exports.selectHeaderHeight = exports.selectSoldOutMsg = exports.selectContentSection = exports.selectRecaptcha = exports.selectFulfillment = exports.selectOptIns = exports.selectLightColor = exports.selectConfigRetries = exports.selectDisplaySettings = exports.selectAccountConfig = exports.selectApi = exports.selectSettings = exports.selectContent = exports.selectTheme = exports.selectBrand = exports.selectConfig = exports.selectCateringOnly = exports.incrementRetries = exports.resetRetries = exports.resetConfig = exports.fetchConfig = exports.ConfigActionType = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
7
|
const utils_1 = require("@open-tender/utils");
|
|
@@ -120,6 +120,20 @@ const selectSoldOutMsg = (state) => {
|
|
|
120
120
|
return soldOutMessage || 'Sold out for day';
|
|
121
121
|
};
|
|
122
122
|
exports.selectSoldOutMsg = selectSoldOutMsg;
|
|
123
|
+
const selectHeaderHeight = (state) => (isBrowser) => {
|
|
124
|
+
if (!state.config.theme)
|
|
125
|
+
return 0;
|
|
126
|
+
const { navHeight, navHeightMobile } = state.config.theme.layout;
|
|
127
|
+
const height = isBrowser ? navHeight : navHeightMobile;
|
|
128
|
+
return parseInt(height.replace('rem', '')) * 10;
|
|
129
|
+
};
|
|
130
|
+
exports.selectHeaderHeight = selectHeaderHeight;
|
|
123
131
|
const selectOutpostName = (state) => { var _a, _b, _c; return ((_a = state.config.settings) === null || _a === void 0 ? void 0 : _a.locationName.OUTPOST) ? (0, utils_1.capitalize)((_c = (_b = state.config.settings) === null || _b === void 0 ? void 0 : _b.locationName.OUTPOST[0]) !== null && _c !== void 0 ? _c : '') : undefined; };
|
|
124
132
|
exports.selectOutpostName = selectOutpostName;
|
|
133
|
+
const selectHasCatering = (state) => {
|
|
134
|
+
var _a;
|
|
135
|
+
const { orderTypes } = state.config.settings || {};
|
|
136
|
+
return (_a = orderTypes === null || orderTypes === void 0 ? void 0 : orderTypes.includes('CATERING')) !== null && _a !== void 0 ? _a : false;
|
|
137
|
+
};
|
|
138
|
+
exports.selectHasCatering = selectHasCatering;
|
|
125
139
|
exports.configReducer = configSlice.reducer;
|
|
@@ -29,3 +29,9 @@ export * from './geolocation';
|
|
|
29
29
|
export * from './loader';
|
|
30
30
|
export * from './qr';
|
|
31
31
|
export * from './misc';
|
|
32
|
+
export * from './modalSlice';
|
|
33
|
+
export * from './navSiteSlice';
|
|
34
|
+
export * from './navSlice';
|
|
35
|
+
export * from './postsSlice';
|
|
36
|
+
export * from './sidebarModalSlice';
|
|
37
|
+
export * from './sidebarSlice';
|
package/dist/cjs/slices/index.js
CHANGED
|
@@ -32,3 +32,9 @@ tslib_1.__exportStar(require("./geolocation"), exports);
|
|
|
32
32
|
tslib_1.__exportStar(require("./loader"), exports);
|
|
33
33
|
tslib_1.__exportStar(require("./qr"), exports);
|
|
34
34
|
tslib_1.__exportStar(require("./misc"), exports);
|
|
35
|
+
tslib_1.__exportStar(require("./modalSlice"), exports);
|
|
36
|
+
tslib_1.__exportStar(require("./navSiteSlice"), exports);
|
|
37
|
+
tslib_1.__exportStar(require("./navSlice"), exports);
|
|
38
|
+
tslib_1.__exportStar(require("./postsSlice"), exports);
|
|
39
|
+
tslib_1.__exportStar(require("./sidebarModalSlice"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./sidebarSlice"), exports);
|
|
@@ -2,8 +2,16 @@ import { AppState } from '../app';
|
|
|
2
2
|
export interface MiscState {
|
|
3
3
|
isGroupOrder: boolean;
|
|
4
4
|
thanxCode: any;
|
|
5
|
+
topOffset: number | null;
|
|
6
|
+
menuBrowse: boolean;
|
|
7
|
+
menuSection: string | null;
|
|
8
|
+
menuPath: string | null;
|
|
5
9
|
}
|
|
6
|
-
export declare const setIsGroupOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setThanxCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
10
|
+
export declare const setIsGroupOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setThanxCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setMenuBrowse: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setMenuPath: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setMenuSection: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setTopOffset: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
7
11
|
export declare const selectIsGroupOrder: (state: AppState) => boolean;
|
|
8
12
|
export declare const selectThanxCode: (state: AppState) => any;
|
|
13
|
+
export declare const selectTopOffset: (state: AppState) => number | null;
|
|
14
|
+
export declare const selectMenuBrowse: (state: AppState) => boolean;
|
|
15
|
+
export declare const selectMenuSection: (state: AppState) => string | null;
|
|
16
|
+
export declare const selectMenuPath: (state: AppState) => string | null;
|
|
9
17
|
export declare const miscReducer: import("redux").Reducer<MiscState, import("redux").AnyAction>;
|
package/dist/cjs/slices/misc.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.miscReducer = exports.selectThanxCode = exports.selectIsGroupOrder = exports.setThanxCode = exports.setIsGroupOrder = void 0;
|
|
4
|
+
exports.miscReducer = exports.selectMenuPath = exports.selectMenuSection = exports.selectMenuBrowse = exports.selectTopOffset = exports.selectThanxCode = exports.selectIsGroupOrder = exports.setTopOffset = exports.setMenuSection = exports.setMenuPath = exports.setMenuBrowse = exports.setThanxCode = exports.setIsGroupOrder = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const initialState = {
|
|
7
7
|
isGroupOrder: false,
|
|
8
8
|
thanxCode: null,
|
|
9
|
+
menuBrowse: false,
|
|
10
|
+
menuPath: null,
|
|
11
|
+
menuSection: null,
|
|
12
|
+
topOffset: null
|
|
9
13
|
};
|
|
10
14
|
const miscSlice = (0, toolkit_1.createSlice)({
|
|
11
15
|
name: 'misc',
|
|
@@ -17,11 +21,31 @@ const miscSlice = (0, toolkit_1.createSlice)({
|
|
|
17
21
|
setThanxCode: (state, action) => {
|
|
18
22
|
state.thanxCode = action.payload;
|
|
19
23
|
},
|
|
24
|
+
setTopOffset: (state, action) => {
|
|
25
|
+
state.topOffset = action.payload;
|
|
26
|
+
},
|
|
27
|
+
setMenuSection: (state, action) => {
|
|
28
|
+
state.menuSection = action.payload;
|
|
29
|
+
},
|
|
30
|
+
setMenuPath: (state, action) => {
|
|
31
|
+
state.menuPath = action.payload;
|
|
32
|
+
},
|
|
33
|
+
setMenuBrowse: (state, action) => {
|
|
34
|
+
state.menuBrowse = action.payload;
|
|
35
|
+
},
|
|
20
36
|
},
|
|
21
37
|
});
|
|
22
|
-
_a = miscSlice.actions, exports.setIsGroupOrder = _a.setIsGroupOrder, exports.setThanxCode = _a.setThanxCode;
|
|
38
|
+
_a = miscSlice.actions, exports.setIsGroupOrder = _a.setIsGroupOrder, exports.setThanxCode = _a.setThanxCode, exports.setMenuBrowse = _a.setMenuBrowse, exports.setMenuPath = _a.setMenuPath, exports.setMenuSection = _a.setMenuSection, exports.setTopOffset = _a.setTopOffset;
|
|
23
39
|
const selectIsGroupOrder = (state) => state.misc.isGroupOrder;
|
|
24
40
|
exports.selectIsGroupOrder = selectIsGroupOrder;
|
|
25
41
|
const selectThanxCode = (state) => state.misc.thanxCode;
|
|
26
42
|
exports.selectThanxCode = selectThanxCode;
|
|
43
|
+
const selectTopOffset = (state) => state.misc.topOffset;
|
|
44
|
+
exports.selectTopOffset = selectTopOffset;
|
|
45
|
+
const selectMenuBrowse = (state) => state.misc.menuBrowse;
|
|
46
|
+
exports.selectMenuBrowse = selectMenuBrowse;
|
|
47
|
+
const selectMenuSection = (state) => state.misc.menuSection;
|
|
48
|
+
exports.selectMenuSection = selectMenuSection;
|
|
49
|
+
const selectMenuPath = (state) => state.misc.menuPath;
|
|
50
|
+
exports.selectMenuPath = selectMenuPath;
|
|
27
51
|
exports.miscReducer = miscSlice.reducer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface ModalState {
|
|
3
|
+
loading: string | null;
|
|
4
|
+
type: string | null;
|
|
5
|
+
args: any;
|
|
6
|
+
}
|
|
7
|
+
export declare const openModal: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, closeModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
8
|
+
export declare const selectModal: (state: AppState) => ModalState;
|
|
9
|
+
export declare const modalReducer: import("redux").Reducer<ModalState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.modalReducer = exports.selectModal = exports.closeModal = exports.openModal = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const initialState = {
|
|
7
|
+
loading: null,
|
|
8
|
+
type: null,
|
|
9
|
+
args: null,
|
|
10
|
+
};
|
|
11
|
+
const modalSlice = (0, toolkit_1.createSlice)({
|
|
12
|
+
name: 'modal',
|
|
13
|
+
initialState,
|
|
14
|
+
reducers: {
|
|
15
|
+
openModal: (state, action) => {
|
|
16
|
+
document.body.classList.add('has-modal');
|
|
17
|
+
const { type, args = null } = action.payload;
|
|
18
|
+
state.type = type;
|
|
19
|
+
state.args = args;
|
|
20
|
+
},
|
|
21
|
+
closeModal: (state) => {
|
|
22
|
+
document.body.classList.remove('has-modal');
|
|
23
|
+
state.type = null;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
_a = modalSlice.actions, exports.openModal = _a.openModal, exports.closeModal = _a.closeModal;
|
|
28
|
+
const selectModal = (state) => state.modal;
|
|
29
|
+
exports.selectModal = selectModal;
|
|
30
|
+
exports.modalReducer = modalSlice.reducer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface NavSiteState {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const toggleNavSite: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
6
|
+
export declare const selectNavSite: (state: AppState) => NavSiteState;
|
|
7
|
+
export declare const navSiteReducer: import("redux").Reducer<NavSiteState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.navSiteReducer = exports.selectNavSite = exports.toggleNavSite = void 0;
|
|
4
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
const initialState = {
|
|
6
|
+
isOpen: false,
|
|
7
|
+
};
|
|
8
|
+
const navSiteSlice = (0, toolkit_1.createSlice)({
|
|
9
|
+
name: 'navSite',
|
|
10
|
+
initialState,
|
|
11
|
+
reducers: {
|
|
12
|
+
toggleNavSite: (state) => {
|
|
13
|
+
state.isOpen = !state.isOpen;
|
|
14
|
+
state.isOpen
|
|
15
|
+
? document.body.classList.add('has-modal')
|
|
16
|
+
: document.body.classList.remove('has-modal');
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
exports.toggleNavSite = navSiteSlice.actions.toggleNavSite;
|
|
21
|
+
const selectNavSite = (state) => state.navSite;
|
|
22
|
+
exports.selectNavSite = selectNavSite;
|
|
23
|
+
exports.navSiteReducer = navSiteSlice.reducer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface NavState {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const toggleNav: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
6
|
+
export declare const selectNav: (state: AppState) => NavState;
|
|
7
|
+
export declare const navReducer: import("redux").Reducer<NavState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.navReducer = exports.selectNav = exports.toggleNav = void 0;
|
|
4
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
const initialState = {
|
|
6
|
+
isOpen: false,
|
|
7
|
+
};
|
|
8
|
+
const navSlice = (0, toolkit_1.createSlice)({
|
|
9
|
+
name: 'nav',
|
|
10
|
+
initialState,
|
|
11
|
+
reducers: {
|
|
12
|
+
toggleNav: (state) => {
|
|
13
|
+
state.isOpen = !state.isOpen;
|
|
14
|
+
state.isOpen
|
|
15
|
+
? document.body.classList.add('has-modal')
|
|
16
|
+
: document.body.classList.remove('has-modal');
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
exports.toggleNav = navSlice.actions.toggleNav;
|
|
21
|
+
const selectNav = (state) => state.nav;
|
|
22
|
+
exports.selectNav = selectNav;
|
|
23
|
+
exports.navReducer = navSlice.reducer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RequestError, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface PostsSlice {
|
|
4
|
+
posts: any[];
|
|
5
|
+
loading: RequestStatus;
|
|
6
|
+
error: RequestError;
|
|
7
|
+
}
|
|
8
|
+
export declare const fetchPosts: import("@reduxjs/toolkit").AsyncThunk<any, string, {
|
|
9
|
+
state: AppState;
|
|
10
|
+
rejectValue: RequestError;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const resetPosts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
13
|
+
export declare const selectPosts: (state: AppState) => {
|
|
14
|
+
posts: any[];
|
|
15
|
+
loading: RequestStatus;
|
|
16
|
+
error: RequestError;
|
|
17
|
+
};
|
|
18
|
+
export declare const postsReducer: import("redux").Reducer<PostsSlice, import("redux").AnyAction>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postsReducer = exports.selectPosts = exports.resetPosts = exports.fetchPosts = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const initialState = {
|
|
7
|
+
posts: [],
|
|
8
|
+
loading: 'idle',
|
|
9
|
+
error: null,
|
|
10
|
+
};
|
|
11
|
+
exports.fetchPosts = (0, toolkit_1.createAsyncThunk)('posts/getPosts', (slug, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
const { api } = getState().config;
|
|
13
|
+
if (!api)
|
|
14
|
+
return;
|
|
15
|
+
try {
|
|
16
|
+
const api = getState().config.api;
|
|
17
|
+
if (!api)
|
|
18
|
+
return null;
|
|
19
|
+
const { data } = yield api.getPosts(slug);
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
const error = err;
|
|
24
|
+
return rejectWithValue(error);
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
const postsSlice = (0, toolkit_1.createSlice)({
|
|
28
|
+
name: 'posts',
|
|
29
|
+
initialState: initialState,
|
|
30
|
+
reducers: {
|
|
31
|
+
resetPosts: () => initialState,
|
|
32
|
+
},
|
|
33
|
+
extraReducers: builder => {
|
|
34
|
+
builder
|
|
35
|
+
.addCase(exports.fetchPosts.fulfilled, (state, action) => {
|
|
36
|
+
state.posts = action.payload || [];
|
|
37
|
+
state.loading = 'idle';
|
|
38
|
+
state.error = null;
|
|
39
|
+
})
|
|
40
|
+
.addCase(exports.fetchPosts.pending, (state) => {
|
|
41
|
+
state.loading = 'pending';
|
|
42
|
+
})
|
|
43
|
+
.addCase(exports.fetchPosts.rejected, (state, action) => {
|
|
44
|
+
state.loading = 'idle';
|
|
45
|
+
state.error = action.payload;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
exports.resetPosts = postsSlice.actions.resetPosts;
|
|
50
|
+
const selectPosts = (state) => {
|
|
51
|
+
const { posts, loading, error } = state.posts;
|
|
52
|
+
return { posts, loading, error };
|
|
53
|
+
};
|
|
54
|
+
exports.selectPosts = selectPosts;
|
|
55
|
+
exports.postsReducer = postsSlice.reducer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface SidebarModalState {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const toggleSidebarModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
6
|
+
export declare const selectSidebarModal: (state: AppState) => SidebarModalState;
|
|
7
|
+
export declare const sidebarModalReducer: import("redux").Reducer<SidebarModalState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sidebarModalReducer = exports.selectSidebarModal = exports.toggleSidebarModal = void 0;
|
|
4
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
const initialState = {
|
|
6
|
+
isOpen: false,
|
|
7
|
+
};
|
|
8
|
+
const sidebarModalSlice = (0, toolkit_1.createSlice)({
|
|
9
|
+
name: 'sidebarModal',
|
|
10
|
+
initialState,
|
|
11
|
+
reducers: {
|
|
12
|
+
toggleSidebarModal: (state) => {
|
|
13
|
+
state.isOpen = !state.isOpen;
|
|
14
|
+
state.isOpen
|
|
15
|
+
? document.body.classList.add('has-modal')
|
|
16
|
+
: document.body.classList.remove('has-modal');
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
exports.toggleSidebarModal = sidebarModalSlice.actions.toggleSidebarModal;
|
|
21
|
+
const selectSidebarModal = (state) => state.sidebarModal;
|
|
22
|
+
exports.selectSidebarModal = selectSidebarModal;
|
|
23
|
+
exports.sidebarModalReducer = sidebarModalSlice.reducer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface SidebarState {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const toggleSidebar: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
6
|
+
export declare const selectSidebar: (state: AppState) => SidebarState;
|
|
7
|
+
export declare const sidebarReducer: import("redux").Reducer<SidebarState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sidebarReducer = exports.selectSidebar = exports.toggleSidebar = void 0;
|
|
4
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
const initialState = {
|
|
6
|
+
isOpen: false,
|
|
7
|
+
};
|
|
8
|
+
const sidebarSlice = (0, toolkit_1.createSlice)({
|
|
9
|
+
name: 'sidebar',
|
|
10
|
+
initialState,
|
|
11
|
+
reducers: {
|
|
12
|
+
toggleSidebar: (state) => {
|
|
13
|
+
state.isOpen = !state.isOpen;
|
|
14
|
+
state.isOpen
|
|
15
|
+
? document.body.classList.add('has-modal')
|
|
16
|
+
: document.body.classList.remove('has-modal');
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
exports.toggleSidebar = sidebarSlice.actions.toggleSidebar;
|
|
21
|
+
const selectSidebar = (state) => state.sidebar;
|
|
22
|
+
exports.selectSidebar = selectSidebar;
|
|
23
|
+
exports.sidebarReducer = sidebarSlice.reducer;
|
|
@@ -43,5 +43,11 @@ export declare enum ReducerType {
|
|
|
43
43
|
Geolocation = "geolocation",
|
|
44
44
|
Loader = "loader",
|
|
45
45
|
Misc = "misc",
|
|
46
|
-
Qr = "qr"
|
|
46
|
+
Qr = "qr",
|
|
47
|
+
Modal = "modal",
|
|
48
|
+
NavSite = "navSite",
|
|
49
|
+
Nav = "nav",
|
|
50
|
+
Posts = "posts",
|
|
51
|
+
SidebarModal = "sidebarModal",
|
|
52
|
+
Sidebar = "sidebar"
|
|
47
53
|
}
|
package/dist/cjs/slices/types.js
CHANGED
|
@@ -48,4 +48,10 @@ var ReducerType;
|
|
|
48
48
|
ReducerType["Loader"] = "loader";
|
|
49
49
|
ReducerType["Misc"] = "misc";
|
|
50
50
|
ReducerType["Qr"] = "qr";
|
|
51
|
+
ReducerType["Modal"] = "modal";
|
|
52
|
+
ReducerType["NavSite"] = "navSite";
|
|
53
|
+
ReducerType["Nav"] = "nav";
|
|
54
|
+
ReducerType["Posts"] = "posts";
|
|
55
|
+
ReducerType["SidebarModal"] = "sidebarModal";
|
|
56
|
+
ReducerType["Sidebar"] = "sidebar";
|
|
51
57
|
})(ReducerType = exports.ReducerType || (exports.ReducerType = {}));
|
package/dist/esm/app/hooks.d.ts
CHANGED
|
@@ -50,5 +50,11 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
50
50
|
loader: import("..").LoaderState;
|
|
51
51
|
qr: import("..").QrState;
|
|
52
52
|
misc: import("..").MiscState;
|
|
53
|
+
modal: import("..").ModalState;
|
|
54
|
+
navSite: import("..").NavSiteState;
|
|
55
|
+
nav: import("..").NavState;
|
|
56
|
+
posts: import("..").PostsSlice;
|
|
57
|
+
sidebarModal: import("..").SidebarModalState;
|
|
58
|
+
sidebar: import("..").SidebarState;
|
|
53
59
|
}>, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").Action<any>>;
|
|
54
60
|
export declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
package/dist/esm/app/store.d.ts
CHANGED
|
@@ -49,6 +49,12 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
49
49
|
loader: import("../slices").LoaderState;
|
|
50
50
|
qr: import("../slices").QrState;
|
|
51
51
|
misc: import("../slices").MiscState;
|
|
52
|
+
modal: import("../slices").ModalState;
|
|
53
|
+
navSite: import("../slices").NavSiteState;
|
|
54
|
+
nav: import("../slices").NavState;
|
|
55
|
+
posts: import("../slices").PostsSlice;
|
|
56
|
+
sidebarModal: import("../slices").SidebarModalState;
|
|
57
|
+
sidebar: import("../slices").SidebarState;
|
|
52
58
|
}>, import("redux").AnyAction>;
|
|
53
59
|
export declare type AppState = ReturnType<typeof appReducer>;
|
|
54
60
|
declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").CombinedState<{
|
|
@@ -101,6 +107,12 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
101
107
|
loader: import("../slices").LoaderState;
|
|
102
108
|
qr: import("../slices").QrState;
|
|
103
109
|
misc: import("../slices").MiscState;
|
|
110
|
+
modal: import("../slices").ModalState;
|
|
111
|
+
navSite: import("../slices").NavSiteState;
|
|
112
|
+
nav: import("../slices").NavState;
|
|
113
|
+
posts: import("../slices").PostsSlice;
|
|
114
|
+
sidebarModal: import("../slices").SidebarModalState;
|
|
115
|
+
sidebar: import("../slices").SidebarState;
|
|
104
116
|
}>, Action<any>, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<import("redux").CombinedState<{
|
|
105
117
|
alerts: import("@open-tender/types").Alerts;
|
|
106
118
|
notifications: import("@open-tender/types").Notifications;
|
|
@@ -151,6 +163,12 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
151
163
|
loader: import("../slices").LoaderState;
|
|
152
164
|
qr: import("../slices").QrState;
|
|
153
165
|
misc: import("../slices").MiscState;
|
|
166
|
+
modal: import("../slices").ModalState;
|
|
167
|
+
navSite: import("../slices").NavSiteState;
|
|
168
|
+
nav: import("../slices").NavState;
|
|
169
|
+
posts: import("../slices").PostsSlice;
|
|
170
|
+
sidebarModal: import("../slices").SidebarModalState;
|
|
171
|
+
sidebar: import("../slices").SidebarState;
|
|
154
172
|
}>, import("redux").AnyAction, undefined>]>>;
|
|
155
173
|
export declare type AppDispatch = typeof store.dispatch;
|
|
156
174
|
export declare type RootState = ReturnType<typeof store.getState>;
|
package/dist/esm/app/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import { alertsReducer, notificationsReducer, allergensReducer, announcementsReducer, customerReducer, signUpReducer, revenueCentersReducer, checkoutReducer, completedOrdersReducer, orderReducer, orderFulfillmentReducer, orderRatingReducer, ordersReducer, dealsReducer, confirmationReducer, donationsReducer, guestReducer, verifyAccountReducer, menuReducer, resetPasswordReducer, validTimesReducer, menuItemsReducer, menuDisplayReducer, giftCardsReducer, groupOrderReducer, levelupReducer, configReducer, geolocationReducer, loaderReducer, qrReducer, miscReducer } from '../slices';
|
|
2
|
+
import { alertsReducer, notificationsReducer, allergensReducer, announcementsReducer, customerReducer, signUpReducer, revenueCentersReducer, checkoutReducer, completedOrdersReducer, orderReducer, orderFulfillmentReducer, orderRatingReducer, ordersReducer, dealsReducer, confirmationReducer, donationsReducer, guestReducer, verifyAccountReducer, menuReducer, resetPasswordReducer, validTimesReducer, menuItemsReducer, menuDisplayReducer, giftCardsReducer, groupOrderReducer, levelupReducer, configReducer, geolocationReducer, loaderReducer, qrReducer, miscReducer, modalReducer, navSiteReducer, navReducer, postsReducer, sidebarModalReducer, sidebarReducer, } from '../slices';
|
|
3
3
|
import { ReducerType } from '../slices/types';
|
|
4
4
|
export const appReducer = combineReducers({
|
|
5
5
|
[ReducerType.Alerts]: alertsReducer,
|
|
@@ -33,6 +33,12 @@ export const appReducer = combineReducers({
|
|
|
33
33
|
[ReducerType.Loader]: loaderReducer,
|
|
34
34
|
[ReducerType.Qr]: qrReducer,
|
|
35
35
|
[ReducerType.Misc]: miscReducer,
|
|
36
|
+
[ReducerType.Modal]: modalReducer,
|
|
37
|
+
[ReducerType.NavSite]: navSiteReducer,
|
|
38
|
+
[ReducerType.Nav]: navReducer,
|
|
39
|
+
[ReducerType.Posts]: postsReducer,
|
|
40
|
+
[ReducerType.SidebarModal]: sidebarModalReducer,
|
|
41
|
+
[ReducerType.Sidebar]: sidebarReducer,
|
|
36
42
|
});
|
|
37
43
|
const rootReducer = (state, action) => {
|
|
38
44
|
if (action.type === 'clearState') {
|
|
@@ -85,5 +85,7 @@ export declare const selectRecaptcha: (state: AppState) => {
|
|
|
85
85
|
} | undefined;
|
|
86
86
|
export declare const selectContentSection: <T extends keyof ConfigContent>(page: T) => (state: AppState) => ConfigContent[T] | undefined;
|
|
87
87
|
export declare const selectSoldOutMsg: (state: AppState) => string;
|
|
88
|
+
export declare const selectHeaderHeight: (state: AppState) => (isBrowser: boolean) => number;
|
|
88
89
|
export declare const selectOutpostName: (state: AppState) => string | undefined;
|
|
90
|
+
export declare const selectHasCatering: (state: AppState) => boolean;
|
|
89
91
|
export declare const configReducer: import("redux").Reducer<ConfigState, import("redux").AnyAction>;
|
|
@@ -100,5 +100,17 @@ export const selectSoldOutMsg = (state) => {
|
|
|
100
100
|
const { soldOutMessage } = ((_a = state.config.content) === null || _a === void 0 ? void 0 : _a.menu) || {};
|
|
101
101
|
return soldOutMessage || 'Sold out for day';
|
|
102
102
|
};
|
|
103
|
+
export const selectHeaderHeight = (state) => (isBrowser) => {
|
|
104
|
+
if (!state.config.theme)
|
|
105
|
+
return 0;
|
|
106
|
+
const { navHeight, navHeightMobile } = state.config.theme.layout;
|
|
107
|
+
const height = isBrowser ? navHeight : navHeightMobile;
|
|
108
|
+
return parseInt(height.replace('rem', '')) * 10;
|
|
109
|
+
};
|
|
103
110
|
export const selectOutpostName = (state) => { var _a, _b, _c; return ((_a = state.config.settings) === null || _a === void 0 ? void 0 : _a.locationName.OUTPOST) ? capitalize((_c = (_b = state.config.settings) === null || _b === void 0 ? void 0 : _b.locationName.OUTPOST[0]) !== null && _c !== void 0 ? _c : '') : undefined; };
|
|
111
|
+
export const selectHasCatering = (state) => {
|
|
112
|
+
var _a;
|
|
113
|
+
const { orderTypes } = state.config.settings || {};
|
|
114
|
+
return (_a = orderTypes === null || orderTypes === void 0 ? void 0 : orderTypes.includes('CATERING')) !== null && _a !== void 0 ? _a : false;
|
|
115
|
+
};
|
|
104
116
|
export const configReducer = configSlice.reducer;
|
|
@@ -29,3 +29,9 @@ export * from './geolocation';
|
|
|
29
29
|
export * from './loader';
|
|
30
30
|
export * from './qr';
|
|
31
31
|
export * from './misc';
|
|
32
|
+
export * from './modalSlice';
|
|
33
|
+
export * from './navSiteSlice';
|
|
34
|
+
export * from './navSlice';
|
|
35
|
+
export * from './postsSlice';
|
|
36
|
+
export * from './sidebarModalSlice';
|
|
37
|
+
export * from './sidebarSlice';
|
package/dist/esm/slices/index.js
CHANGED
|
@@ -29,3 +29,9 @@ export * from './geolocation';
|
|
|
29
29
|
export * from './loader';
|
|
30
30
|
export * from './qr';
|
|
31
31
|
export * from './misc';
|
|
32
|
+
export * from './modalSlice';
|
|
33
|
+
export * from './navSiteSlice';
|
|
34
|
+
export * from './navSlice';
|
|
35
|
+
export * from './postsSlice';
|
|
36
|
+
export * from './sidebarModalSlice';
|
|
37
|
+
export * from './sidebarSlice';
|
|
@@ -2,8 +2,16 @@ import { AppState } from '../app';
|
|
|
2
2
|
export interface MiscState {
|
|
3
3
|
isGroupOrder: boolean;
|
|
4
4
|
thanxCode: any;
|
|
5
|
+
topOffset: number | null;
|
|
6
|
+
menuBrowse: boolean;
|
|
7
|
+
menuSection: string | null;
|
|
8
|
+
menuPath: string | null;
|
|
5
9
|
}
|
|
6
|
-
export declare const setIsGroupOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setThanxCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
10
|
+
export declare const setIsGroupOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setThanxCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setMenuBrowse: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setMenuPath: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setMenuSection: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setTopOffset: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
7
11
|
export declare const selectIsGroupOrder: (state: AppState) => boolean;
|
|
8
12
|
export declare const selectThanxCode: (state: AppState) => any;
|
|
13
|
+
export declare const selectTopOffset: (state: AppState) => number | null;
|
|
14
|
+
export declare const selectMenuBrowse: (state: AppState) => boolean;
|
|
15
|
+
export declare const selectMenuSection: (state: AppState) => string | null;
|
|
16
|
+
export declare const selectMenuPath: (state: AppState) => string | null;
|
|
9
17
|
export declare const miscReducer: import("redux").Reducer<MiscState, import("redux").AnyAction>;
|
package/dist/esm/slices/misc.js
CHANGED
|
@@ -2,6 +2,10 @@ import { createSlice } from '@reduxjs/toolkit';
|
|
|
2
2
|
const initialState = {
|
|
3
3
|
isGroupOrder: false,
|
|
4
4
|
thanxCode: null,
|
|
5
|
+
menuBrowse: false,
|
|
6
|
+
menuPath: null,
|
|
7
|
+
menuSection: null,
|
|
8
|
+
topOffset: null
|
|
5
9
|
};
|
|
6
10
|
const miscSlice = createSlice({
|
|
7
11
|
name: 'misc',
|
|
@@ -13,9 +17,25 @@ const miscSlice = createSlice({
|
|
|
13
17
|
setThanxCode: (state, action) => {
|
|
14
18
|
state.thanxCode = action.payload;
|
|
15
19
|
},
|
|
20
|
+
setTopOffset: (state, action) => {
|
|
21
|
+
state.topOffset = action.payload;
|
|
22
|
+
},
|
|
23
|
+
setMenuSection: (state, action) => {
|
|
24
|
+
state.menuSection = action.payload;
|
|
25
|
+
},
|
|
26
|
+
setMenuPath: (state, action) => {
|
|
27
|
+
state.menuPath = action.payload;
|
|
28
|
+
},
|
|
29
|
+
setMenuBrowse: (state, action) => {
|
|
30
|
+
state.menuBrowse = action.payload;
|
|
31
|
+
},
|
|
16
32
|
},
|
|
17
33
|
});
|
|
18
|
-
export const { setIsGroupOrder, setThanxCode } = miscSlice.actions;
|
|
34
|
+
export const { setIsGroupOrder, setThanxCode, setMenuBrowse, setMenuPath, setMenuSection, setTopOffset, } = miscSlice.actions;
|
|
19
35
|
export const selectIsGroupOrder = (state) => state.misc.isGroupOrder;
|
|
20
36
|
export const selectThanxCode = (state) => state.misc.thanxCode;
|
|
37
|
+
export const selectTopOffset = (state) => state.misc.topOffset;
|
|
38
|
+
export const selectMenuBrowse = (state) => state.misc.menuBrowse;
|
|
39
|
+
export const selectMenuSection = (state) => state.misc.menuSection;
|
|
40
|
+
export const selectMenuPath = (state) => state.misc.menuPath;
|
|
21
41
|
export const miscReducer = miscSlice.reducer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface ModalState {
|
|
3
|
+
loading: string | null;
|
|
4
|
+
type: string | null;
|
|
5
|
+
args: any;
|
|
6
|
+
}
|
|
7
|
+
export declare const openModal: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, closeModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
8
|
+
export declare const selectModal: (state: AppState) => ModalState;
|
|
9
|
+
export declare const modalReducer: import("redux").Reducer<ModalState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {
|
|
3
|
+
loading: null,
|
|
4
|
+
type: null,
|
|
5
|
+
args: null,
|
|
6
|
+
};
|
|
7
|
+
const modalSlice = createSlice({
|
|
8
|
+
name: 'modal',
|
|
9
|
+
initialState,
|
|
10
|
+
reducers: {
|
|
11
|
+
openModal: (state, action) => {
|
|
12
|
+
document.body.classList.add('has-modal');
|
|
13
|
+
const { type, args = null } = action.payload;
|
|
14
|
+
state.type = type;
|
|
15
|
+
state.args = args;
|
|
16
|
+
},
|
|
17
|
+
closeModal: (state) => {
|
|
18
|
+
document.body.classList.remove('has-modal');
|
|
19
|
+
state.type = null;
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export const { openModal, closeModal } = modalSlice.actions;
|
|
24
|
+
export const selectModal = (state) => state.modal;
|
|
25
|
+
export const modalReducer = modalSlice.reducer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface NavSiteState {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const toggleNavSite: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
6
|
+
export declare const selectNavSite: (state: AppState) => NavSiteState;
|
|
7
|
+
export declare const navSiteReducer: import("redux").Reducer<NavSiteState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {
|
|
3
|
+
isOpen: false,
|
|
4
|
+
};
|
|
5
|
+
const navSiteSlice = createSlice({
|
|
6
|
+
name: 'navSite',
|
|
7
|
+
initialState,
|
|
8
|
+
reducers: {
|
|
9
|
+
toggleNavSite: (state) => {
|
|
10
|
+
state.isOpen = !state.isOpen;
|
|
11
|
+
state.isOpen
|
|
12
|
+
? document.body.classList.add('has-modal')
|
|
13
|
+
: document.body.classList.remove('has-modal');
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export const { toggleNavSite } = navSiteSlice.actions;
|
|
18
|
+
export const selectNavSite = (state) => state.navSite;
|
|
19
|
+
export const navSiteReducer = navSiteSlice.reducer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface NavState {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const toggleNav: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
6
|
+
export declare const selectNav: (state: AppState) => NavState;
|
|
7
|
+
export declare const navReducer: import("redux").Reducer<NavState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {
|
|
3
|
+
isOpen: false,
|
|
4
|
+
};
|
|
5
|
+
const navSlice = createSlice({
|
|
6
|
+
name: 'nav',
|
|
7
|
+
initialState,
|
|
8
|
+
reducers: {
|
|
9
|
+
toggleNav: (state) => {
|
|
10
|
+
state.isOpen = !state.isOpen;
|
|
11
|
+
state.isOpen
|
|
12
|
+
? document.body.classList.add('has-modal')
|
|
13
|
+
: document.body.classList.remove('has-modal');
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export const { toggleNav } = navSlice.actions;
|
|
18
|
+
export const selectNav = (state) => state.nav;
|
|
19
|
+
export const navReducer = navSlice.reducer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RequestError, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface PostsSlice {
|
|
4
|
+
posts: any[];
|
|
5
|
+
loading: RequestStatus;
|
|
6
|
+
error: RequestError;
|
|
7
|
+
}
|
|
8
|
+
export declare const fetchPosts: import("@reduxjs/toolkit").AsyncThunk<any, string, {
|
|
9
|
+
state: AppState;
|
|
10
|
+
rejectValue: RequestError;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const resetPosts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
13
|
+
export declare const selectPosts: (state: AppState) => {
|
|
14
|
+
posts: any[];
|
|
15
|
+
loading: RequestStatus;
|
|
16
|
+
error: RequestError;
|
|
17
|
+
};
|
|
18
|
+
export declare const postsReducer: import("redux").Reducer<PostsSlice, import("redux").AnyAction>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
const initialState = {
|
|
4
|
+
posts: [],
|
|
5
|
+
loading: 'idle',
|
|
6
|
+
error: null,
|
|
7
|
+
};
|
|
8
|
+
export const fetchPosts = createAsyncThunk('posts/getPosts', (slug, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const { api } = getState().config;
|
|
10
|
+
if (!api)
|
|
11
|
+
return;
|
|
12
|
+
try {
|
|
13
|
+
const api = getState().config.api;
|
|
14
|
+
if (!api)
|
|
15
|
+
return null;
|
|
16
|
+
const { data } = yield api.getPosts(slug);
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
const error = err;
|
|
21
|
+
return rejectWithValue(error);
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
const postsSlice = createSlice({
|
|
25
|
+
name: 'posts',
|
|
26
|
+
initialState: initialState,
|
|
27
|
+
reducers: {
|
|
28
|
+
resetPosts: () => initialState,
|
|
29
|
+
},
|
|
30
|
+
extraReducers: builder => {
|
|
31
|
+
builder
|
|
32
|
+
.addCase(fetchPosts.fulfilled, (state, action) => {
|
|
33
|
+
state.posts = action.payload || [];
|
|
34
|
+
state.loading = 'idle';
|
|
35
|
+
state.error = null;
|
|
36
|
+
})
|
|
37
|
+
.addCase(fetchPosts.pending, (state) => {
|
|
38
|
+
state.loading = 'pending';
|
|
39
|
+
})
|
|
40
|
+
.addCase(fetchPosts.rejected, (state, action) => {
|
|
41
|
+
state.loading = 'idle';
|
|
42
|
+
state.error = action.payload;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export const { resetPosts } = postsSlice.actions;
|
|
47
|
+
export const selectPosts = (state) => {
|
|
48
|
+
const { posts, loading, error } = state.posts;
|
|
49
|
+
return { posts, loading, error };
|
|
50
|
+
};
|
|
51
|
+
export const postsReducer = postsSlice.reducer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface SidebarModalState {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const toggleSidebarModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
6
|
+
export declare const selectSidebarModal: (state: AppState) => SidebarModalState;
|
|
7
|
+
export declare const sidebarModalReducer: import("redux").Reducer<SidebarModalState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {
|
|
3
|
+
isOpen: false,
|
|
4
|
+
};
|
|
5
|
+
const sidebarModalSlice = createSlice({
|
|
6
|
+
name: 'sidebarModal',
|
|
7
|
+
initialState,
|
|
8
|
+
reducers: {
|
|
9
|
+
toggleSidebarModal: (state) => {
|
|
10
|
+
state.isOpen = !state.isOpen;
|
|
11
|
+
state.isOpen
|
|
12
|
+
? document.body.classList.add('has-modal')
|
|
13
|
+
: document.body.classList.remove('has-modal');
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export const { toggleSidebarModal } = sidebarModalSlice.actions;
|
|
18
|
+
export const selectSidebarModal = (state) => state.sidebarModal;
|
|
19
|
+
export const sidebarModalReducer = sidebarModalSlice.reducer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface SidebarState {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const toggleSidebar: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
6
|
+
export declare const selectSidebar: (state: AppState) => SidebarState;
|
|
7
|
+
export declare const sidebarReducer: import("redux").Reducer<SidebarState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {
|
|
3
|
+
isOpen: false,
|
|
4
|
+
};
|
|
5
|
+
const sidebarSlice = createSlice({
|
|
6
|
+
name: 'sidebar',
|
|
7
|
+
initialState,
|
|
8
|
+
reducers: {
|
|
9
|
+
toggleSidebar: (state) => {
|
|
10
|
+
state.isOpen = !state.isOpen;
|
|
11
|
+
state.isOpen
|
|
12
|
+
? document.body.classList.add('has-modal')
|
|
13
|
+
: document.body.classList.remove('has-modal');
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export const { toggleSidebar } = sidebarSlice.actions;
|
|
18
|
+
export const selectSidebar = (state) => state.sidebar;
|
|
19
|
+
export const sidebarReducer = sidebarSlice.reducer;
|
|
@@ -43,5 +43,11 @@ export declare enum ReducerType {
|
|
|
43
43
|
Geolocation = "geolocation",
|
|
44
44
|
Loader = "loader",
|
|
45
45
|
Misc = "misc",
|
|
46
|
-
Qr = "qr"
|
|
46
|
+
Qr = "qr",
|
|
47
|
+
Modal = "modal",
|
|
48
|
+
NavSite = "navSite",
|
|
49
|
+
Nav = "nav",
|
|
50
|
+
Posts = "posts",
|
|
51
|
+
SidebarModal = "sidebarModal",
|
|
52
|
+
Sidebar = "sidebar"
|
|
47
53
|
}
|
package/dist/esm/slices/types.js
CHANGED
|
@@ -45,4 +45,10 @@ export var ReducerType;
|
|
|
45
45
|
ReducerType["Loader"] = "loader";
|
|
46
46
|
ReducerType["Misc"] = "misc";
|
|
47
47
|
ReducerType["Qr"] = "qr";
|
|
48
|
+
ReducerType["Modal"] = "modal";
|
|
49
|
+
ReducerType["NavSite"] = "navSite";
|
|
50
|
+
ReducerType["Nav"] = "nav";
|
|
51
|
+
ReducerType["Posts"] = "posts";
|
|
52
|
+
ReducerType["SidebarModal"] = "sidebarModal";
|
|
53
|
+
ReducerType["Sidebar"] = "sidebar";
|
|
48
54
|
})(ReducerType || (ReducerType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.123",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|