@open-tender/cloud 0.0.1 → 0.0.2
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 +4 -0
- package/dist/cjs/app/store.d.ts +12 -0
- package/dist/cjs/app/store.js +4 -0
- package/dist/cjs/slices/geolocation.d.ts +17 -0
- package/dist/cjs/slices/geolocation.js +36 -0
- package/dist/cjs/slices/index.d.ts +4 -0
- package/dist/cjs/slices/index.js +4 -0
- package/dist/cjs/slices/loader.d.ts +9 -0
- package/dist/cjs/slices/loader.js +25 -0
- package/dist/cjs/slices/misc.d.ts +9 -0
- package/dist/cjs/slices/misc.js +27 -0
- package/dist/cjs/slices/qr.d.ts +11 -0
- package/dist/cjs/slices/qr.js +34 -0
- package/dist/cjs/slices/types.d.ts +5 -1
- package/dist/cjs/slices/types.js +4 -0
- package/dist/esm/app/hooks.d.ts +4 -0
- package/dist/esm/app/store.d.ts +12 -0
- package/dist/esm/app/store.js +5 -1
- package/dist/esm/slices/geolocation.d.ts +17 -0
- package/dist/esm/slices/geolocation.js +30 -0
- package/dist/esm/slices/index.d.ts +4 -0
- package/dist/esm/slices/index.js +4 -0
- package/dist/esm/slices/loader.d.ts +9 -0
- package/dist/esm/slices/loader.js +21 -0
- package/dist/esm/slices/misc.d.ts +9 -0
- package/dist/esm/slices/misc.js +21 -0
- package/dist/esm/slices/qr.d.ts +11 -0
- package/dist/esm/slices/qr.js +29 -0
- package/dist/esm/slices/types.d.ts +5 -1
- package/dist/esm/slices/types.js +4 -0
- package/package.json +1 -1
package/dist/cjs/app/hooks.d.ts
CHANGED
|
@@ -46,5 +46,9 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
46
46
|
groupOrder: import("..").GroupOrderState;
|
|
47
47
|
levelup: import("..").LevelupState;
|
|
48
48
|
config: import("..").ConfigState;
|
|
49
|
+
geolocation: import("..").GeoLocationState;
|
|
50
|
+
loader: import("..").LoaderState;
|
|
51
|
+
qr: import("..").QrState;
|
|
52
|
+
misc: import("..").MiscState;
|
|
49
53
|
}>, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").Action<any>>;
|
|
50
54
|
export declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
package/dist/cjs/app/store.d.ts
CHANGED
|
@@ -45,6 +45,10 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
45
45
|
groupOrder: import("../slices").GroupOrderState;
|
|
46
46
|
levelup: import("../slices").LevelupState;
|
|
47
47
|
config: import("../slices").ConfigState;
|
|
48
|
+
geolocation: import("../slices").GeoLocationState;
|
|
49
|
+
loader: import("../slices").LoaderState;
|
|
50
|
+
qr: import("../slices").QrState;
|
|
51
|
+
misc: import("../slices").MiscState;
|
|
48
52
|
}>, import("redux").AnyAction>;
|
|
49
53
|
export declare type AppState = ReturnType<typeof appReducer>;
|
|
50
54
|
declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").CombinedState<{
|
|
@@ -93,6 +97,10 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
93
97
|
groupOrder: import("../slices").GroupOrderState;
|
|
94
98
|
levelup: import("../slices").LevelupState;
|
|
95
99
|
config: import("../slices").ConfigState;
|
|
100
|
+
geolocation: import("../slices").GeoLocationState;
|
|
101
|
+
loader: import("../slices").LoaderState;
|
|
102
|
+
qr: import("../slices").QrState;
|
|
103
|
+
misc: import("../slices").MiscState;
|
|
96
104
|
}>, Action<any>, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<import("redux").CombinedState<{
|
|
97
105
|
alerts: import("@open-tender/types").Alerts;
|
|
98
106
|
notifications: import("@open-tender/types").Notifications;
|
|
@@ -139,6 +147,10 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
139
147
|
groupOrder: import("../slices").GroupOrderState;
|
|
140
148
|
levelup: import("../slices").LevelupState;
|
|
141
149
|
config: import("../slices").ConfigState;
|
|
150
|
+
geolocation: import("../slices").GeoLocationState;
|
|
151
|
+
loader: import("../slices").LoaderState;
|
|
152
|
+
qr: import("../slices").QrState;
|
|
153
|
+
misc: import("../slices").MiscState;
|
|
142
154
|
}>, import("redux").AnyAction, undefined>]>>;
|
|
143
155
|
export declare type AppDispatch = typeof store.dispatch;
|
|
144
156
|
export declare type RootState = ReturnType<typeof store.getState>;
|
package/dist/cjs/app/store.js
CHANGED
|
@@ -32,6 +32,10 @@ exports.appReducer = (0, toolkit_1.combineReducers)({
|
|
|
32
32
|
[types_1.ReducerType.GroupOrder]: slices_1.groupOrderReducer,
|
|
33
33
|
[types_1.ReducerType.Levelup]: slices_1.levelupReducer,
|
|
34
34
|
[types_1.ReducerType.Config]: slices_1.configReducer,
|
|
35
|
+
[types_1.ReducerType.Geolocation]: slices_1.geolocationReducer,
|
|
36
|
+
[types_1.ReducerType.Loader]: slices_1.loaderReducer,
|
|
37
|
+
[types_1.ReducerType.Qr]: slices_1.qrReducer,
|
|
38
|
+
[types_1.ReducerType.Misc]: slices_1.miscReducer,
|
|
35
39
|
});
|
|
36
40
|
const rootReducer = (state, action) => {
|
|
37
41
|
if (action.type === 'clearState') {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RequestError } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface GeoLocationState {
|
|
4
|
+
latLng: {
|
|
5
|
+
lat: number;
|
|
6
|
+
lng: number;
|
|
7
|
+
} | null;
|
|
8
|
+
error: RequestError;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const resetGeolocation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setGeoLatLng: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setGeoError: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setGeoLoading: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
12
|
+
export declare const selectGeo: (state: AppState) => GeoLocationState;
|
|
13
|
+
export declare const selectGeoLatLng: (state: AppState) => {
|
|
14
|
+
lat: number;
|
|
15
|
+
lng: number;
|
|
16
|
+
} | null;
|
|
17
|
+
export declare const geolocationReducer: import("redux").Reducer<GeoLocationState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.geolocationReducer = exports.selectGeoLatLng = exports.selectGeo = exports.setGeoLoading = exports.setGeoError = exports.setGeoLatLng = exports.resetGeolocation = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const initialState = {
|
|
7
|
+
latLng: null,
|
|
8
|
+
error: null,
|
|
9
|
+
loading: false,
|
|
10
|
+
};
|
|
11
|
+
const geolocationSlice = (0, toolkit_1.createSlice)({
|
|
12
|
+
name: 'geolocation',
|
|
13
|
+
initialState,
|
|
14
|
+
reducers: {
|
|
15
|
+
resetGeolocation: () => initialState,
|
|
16
|
+
setGeoLatLng: (state, action) => {
|
|
17
|
+
state.latLng = action.payload;
|
|
18
|
+
state.error = null;
|
|
19
|
+
state.loading = false;
|
|
20
|
+
},
|
|
21
|
+
setGeoError: (state, action) => {
|
|
22
|
+
state.latLng = null;
|
|
23
|
+
state.error = action.payload;
|
|
24
|
+
state.loading = false;
|
|
25
|
+
},
|
|
26
|
+
setGeoLoading: state => {
|
|
27
|
+
state.loading = true;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
_a = geolocationSlice.actions, exports.resetGeolocation = _a.resetGeolocation, exports.setGeoLatLng = _a.setGeoLatLng, exports.setGeoError = _a.setGeoError, exports.setGeoLoading = _a.setGeoLoading;
|
|
32
|
+
const selectGeo = (state) => state.geolocation;
|
|
33
|
+
exports.selectGeo = selectGeo;
|
|
34
|
+
const selectGeoLatLng = (state) => state.geolocation.latLng;
|
|
35
|
+
exports.selectGeoLatLng = selectGeoLatLng;
|
|
36
|
+
exports.geolocationReducer = geolocationSlice.reducer;
|
package/dist/cjs/slices/index.js
CHANGED
|
@@ -28,3 +28,7 @@ tslib_1.__exportStar(require("./giftCards"), exports);
|
|
|
28
28
|
tslib_1.__exportStar(require("./groupOrder"), exports);
|
|
29
29
|
tslib_1.__exportStar(require("./levelup"), exports);
|
|
30
30
|
tslib_1.__exportStar(require("./config"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./geolocation"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./loader"), exports);
|
|
33
|
+
tslib_1.__exportStar(require("./qr"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./misc"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface LoaderState {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
title: string;
|
|
5
|
+
subtitle: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const setLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
8
|
+
export declare const selectLoader: (state: AppState) => LoaderState;
|
|
9
|
+
export declare const loaderReducer: import("redux").Reducer<LoaderState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loaderReducer = exports.selectLoader = exports.setLoading = void 0;
|
|
4
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
const initialState = {
|
|
6
|
+
loading: false,
|
|
7
|
+
title: '',
|
|
8
|
+
subtitle: '',
|
|
9
|
+
};
|
|
10
|
+
const loaderSlice = (0, toolkit_1.createSlice)({
|
|
11
|
+
name: 'loader',
|
|
12
|
+
initialState: initialState,
|
|
13
|
+
reducers: {
|
|
14
|
+
setLoading(state, action) {
|
|
15
|
+
const { title, subtitle, loading } = action.payload;
|
|
16
|
+
state.loading = loading;
|
|
17
|
+
state.title = title !== null && title !== void 0 ? title : 'Submitting...';
|
|
18
|
+
state.subtitle = subtitle !== null && subtitle !== void 0 ? subtitle : 'Please hang tight for a sec';
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
exports.setLoading = loaderSlice.actions.setLoading;
|
|
23
|
+
const selectLoader = (state) => state.loader;
|
|
24
|
+
exports.selectLoader = selectLoader;
|
|
25
|
+
exports.loaderReducer = loaderSlice.reducer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface MiscState {
|
|
3
|
+
isGroupOrder: boolean;
|
|
4
|
+
thanxCode: any;
|
|
5
|
+
}
|
|
6
|
+
export declare const setIsGroupOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setThanxCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
7
|
+
export declare const selectIsGroupOrder: (state: AppState) => boolean;
|
|
8
|
+
export declare const selectThanxCode: (state: AppState) => any;
|
|
9
|
+
export declare const miscReducer: import("redux").Reducer<MiscState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.miscReducer = exports.selectThanxCode = exports.selectIsGroupOrder = exports.setThanxCode = exports.setIsGroupOrder = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const initialState = {
|
|
7
|
+
isGroupOrder: false,
|
|
8
|
+
thanxCode: null,
|
|
9
|
+
};
|
|
10
|
+
const miscSlice = (0, toolkit_1.createSlice)({
|
|
11
|
+
name: 'misc',
|
|
12
|
+
initialState,
|
|
13
|
+
reducers: {
|
|
14
|
+
setIsGroupOrder: (state, action) => {
|
|
15
|
+
state.isGroupOrder = action.payload;
|
|
16
|
+
},
|
|
17
|
+
setThanxCode: (state, action) => {
|
|
18
|
+
state.thanxCode = action.payload;
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
_a = miscSlice.actions, exports.setIsGroupOrder = _a.setIsGroupOrder, exports.setThanxCode = _a.setThanxCode;
|
|
23
|
+
const selectIsGroupOrder = (state) => state.misc.isGroupOrder;
|
|
24
|
+
exports.selectIsGroupOrder = selectIsGroupOrder;
|
|
25
|
+
const selectThanxCode = (state) => state.misc.thanxCode;
|
|
26
|
+
exports.selectThanxCode = selectThanxCode;
|
|
27
|
+
exports.miscReducer = miscSlice.reducer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ServiceType } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface QrState {
|
|
4
|
+
locationId: number | null;
|
|
5
|
+
prep_type: string | null;
|
|
6
|
+
table: number | null;
|
|
7
|
+
service_type: ServiceType | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const setQrParams: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, resetQrParams: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
10
|
+
export declare const selectQrParams: (state: AppState) => QrState;
|
|
11
|
+
export declare const qrReducer: import("redux").Reducer<QrState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.qrReducer = exports.selectQrParams = exports.resetQrParams = exports.setQrParams = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const initialState = {
|
|
7
|
+
locationId: null,
|
|
8
|
+
prep_type: null,
|
|
9
|
+
table: null,
|
|
10
|
+
service_type: null,
|
|
11
|
+
};
|
|
12
|
+
const qrSlice = (0, toolkit_1.createSlice)({
|
|
13
|
+
name: 'qr',
|
|
14
|
+
initialState: initialState,
|
|
15
|
+
reducers: {
|
|
16
|
+
setQrParams(state, action) {
|
|
17
|
+
const { locationId, prep_type, table, service_type } = action.payload;
|
|
18
|
+
state.locationId = locationId;
|
|
19
|
+
state.prep_type = prep_type;
|
|
20
|
+
state.table = table;
|
|
21
|
+
state.service_type = service_type;
|
|
22
|
+
},
|
|
23
|
+
resetQrParams(state) {
|
|
24
|
+
state.locationId = null;
|
|
25
|
+
state.prep_type = null;
|
|
26
|
+
state.table = null;
|
|
27
|
+
state.service_type = null;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
_a = qrSlice.actions, exports.setQrParams = _a.setQrParams, exports.resetQrParams = _a.resetQrParams;
|
|
32
|
+
const selectQrParams = (state) => state.qr;
|
|
33
|
+
exports.selectQrParams = selectQrParams;
|
|
34
|
+
exports.qrReducer = qrSlice.reducer;
|
package/dist/cjs/slices/types.js
CHANGED
|
@@ -44,4 +44,8 @@ var ReducerType;
|
|
|
44
44
|
ReducerType["MenuDisplay"] = "menuDisplay";
|
|
45
45
|
ReducerType["GroupOrder"] = "groupOrder";
|
|
46
46
|
ReducerType["Config"] = "config";
|
|
47
|
+
ReducerType["Geolocation"] = "geolocation";
|
|
48
|
+
ReducerType["Loader"] = "loader";
|
|
49
|
+
ReducerType["Misc"] = "misc";
|
|
50
|
+
ReducerType["Qr"] = "qr";
|
|
47
51
|
})(ReducerType = exports.ReducerType || (exports.ReducerType = {}));
|
package/dist/esm/app/hooks.d.ts
CHANGED
|
@@ -46,5 +46,9 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<i
|
|
|
46
46
|
groupOrder: import("..").GroupOrderState;
|
|
47
47
|
levelup: import("..").LevelupState;
|
|
48
48
|
config: import("..").ConfigState;
|
|
49
|
+
geolocation: import("..").GeoLocationState;
|
|
50
|
+
loader: import("..").LoaderState;
|
|
51
|
+
qr: import("..").QrState;
|
|
52
|
+
misc: import("..").MiscState;
|
|
49
53
|
}>, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").Action<any>>;
|
|
50
54
|
export declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
package/dist/esm/app/store.d.ts
CHANGED
|
@@ -45,6 +45,10 @@ export declare const appReducer: import("redux").Reducer<import("redux").Combine
|
|
|
45
45
|
groupOrder: import("../slices").GroupOrderState;
|
|
46
46
|
levelup: import("../slices").LevelupState;
|
|
47
47
|
config: import("../slices").ConfigState;
|
|
48
|
+
geolocation: import("../slices").GeoLocationState;
|
|
49
|
+
loader: import("../slices").LoaderState;
|
|
50
|
+
qr: import("../slices").QrState;
|
|
51
|
+
misc: import("../slices").MiscState;
|
|
48
52
|
}>, import("redux").AnyAction>;
|
|
49
53
|
export declare type AppState = ReturnType<typeof appReducer>;
|
|
50
54
|
declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").CombinedState<{
|
|
@@ -93,6 +97,10 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
93
97
|
groupOrder: import("../slices").GroupOrderState;
|
|
94
98
|
levelup: import("../slices").LevelupState;
|
|
95
99
|
config: import("../slices").ConfigState;
|
|
100
|
+
geolocation: import("../slices").GeoLocationState;
|
|
101
|
+
loader: import("../slices").LoaderState;
|
|
102
|
+
qr: import("../slices").QrState;
|
|
103
|
+
misc: import("../slices").MiscState;
|
|
96
104
|
}>, Action<any>, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<import("redux").CombinedState<{
|
|
97
105
|
alerts: import("@open-tender/types").Alerts;
|
|
98
106
|
notifications: import("@open-tender/types").Notifications;
|
|
@@ -139,6 +147,10 @@ declare const store: import("@reduxjs/toolkit").EnhancedStore<import("redux").Co
|
|
|
139
147
|
groupOrder: import("../slices").GroupOrderState;
|
|
140
148
|
levelup: import("../slices").LevelupState;
|
|
141
149
|
config: import("../slices").ConfigState;
|
|
150
|
+
geolocation: import("../slices").GeoLocationState;
|
|
151
|
+
loader: import("../slices").LoaderState;
|
|
152
|
+
qr: import("../slices").QrState;
|
|
153
|
+
misc: import("../slices").MiscState;
|
|
142
154
|
}>, import("redux").AnyAction, undefined>]>>;
|
|
143
155
|
export declare type AppDispatch = typeof store.dispatch;
|
|
144
156
|
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 } 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 } from '../slices';
|
|
3
3
|
import { ReducerType } from '../slices/types';
|
|
4
4
|
export const appReducer = combineReducers({
|
|
5
5
|
[ReducerType.Alerts]: alertsReducer,
|
|
@@ -29,6 +29,10 @@ export const appReducer = combineReducers({
|
|
|
29
29
|
[ReducerType.GroupOrder]: groupOrderReducer,
|
|
30
30
|
[ReducerType.Levelup]: levelupReducer,
|
|
31
31
|
[ReducerType.Config]: configReducer,
|
|
32
|
+
[ReducerType.Geolocation]: geolocationReducer,
|
|
33
|
+
[ReducerType.Loader]: loaderReducer,
|
|
34
|
+
[ReducerType.Qr]: qrReducer,
|
|
35
|
+
[ReducerType.Misc]: miscReducer,
|
|
32
36
|
});
|
|
33
37
|
const rootReducer = (state, action) => {
|
|
34
38
|
if (action.type === 'clearState') {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RequestError } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface GeoLocationState {
|
|
4
|
+
latLng: {
|
|
5
|
+
lat: number;
|
|
6
|
+
lng: number;
|
|
7
|
+
} | null;
|
|
8
|
+
error: RequestError;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const resetGeolocation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setGeoLatLng: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setGeoError: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setGeoLoading: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
12
|
+
export declare const selectGeo: (state: AppState) => GeoLocationState;
|
|
13
|
+
export declare const selectGeoLatLng: (state: AppState) => {
|
|
14
|
+
lat: number;
|
|
15
|
+
lng: number;
|
|
16
|
+
} | null;
|
|
17
|
+
export declare const geolocationReducer: import("redux").Reducer<GeoLocationState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {
|
|
3
|
+
latLng: null,
|
|
4
|
+
error: null,
|
|
5
|
+
loading: false,
|
|
6
|
+
};
|
|
7
|
+
const geolocationSlice = createSlice({
|
|
8
|
+
name: 'geolocation',
|
|
9
|
+
initialState,
|
|
10
|
+
reducers: {
|
|
11
|
+
resetGeolocation: () => initialState,
|
|
12
|
+
setGeoLatLng: (state, action) => {
|
|
13
|
+
state.latLng = action.payload;
|
|
14
|
+
state.error = null;
|
|
15
|
+
state.loading = false;
|
|
16
|
+
},
|
|
17
|
+
setGeoError: (state, action) => {
|
|
18
|
+
state.latLng = null;
|
|
19
|
+
state.error = action.payload;
|
|
20
|
+
state.loading = false;
|
|
21
|
+
},
|
|
22
|
+
setGeoLoading: state => {
|
|
23
|
+
state.loading = true;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export const { resetGeolocation, setGeoLatLng, setGeoError, setGeoLoading } = geolocationSlice.actions;
|
|
28
|
+
export const selectGeo = (state) => state.geolocation;
|
|
29
|
+
export const selectGeoLatLng = (state) => state.geolocation.latLng;
|
|
30
|
+
export const geolocationReducer = geolocationSlice.reducer;
|
package/dist/esm/slices/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface LoaderState {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
title: string;
|
|
5
|
+
subtitle: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const setLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
8
|
+
export declare const selectLoader: (state: AppState) => LoaderState;
|
|
9
|
+
export declare const loaderReducer: import("redux").Reducer<LoaderState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {
|
|
3
|
+
loading: false,
|
|
4
|
+
title: '',
|
|
5
|
+
subtitle: '',
|
|
6
|
+
};
|
|
7
|
+
const loaderSlice = createSlice({
|
|
8
|
+
name: 'loader',
|
|
9
|
+
initialState: initialState,
|
|
10
|
+
reducers: {
|
|
11
|
+
setLoading(state, action) {
|
|
12
|
+
const { title, subtitle, loading } = action.payload;
|
|
13
|
+
state.loading = loading;
|
|
14
|
+
state.title = title !== null && title !== void 0 ? title : 'Submitting...';
|
|
15
|
+
state.subtitle = subtitle !== null && subtitle !== void 0 ? subtitle : 'Please hang tight for a sec';
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
export const { setLoading } = loaderSlice.actions;
|
|
20
|
+
export const selectLoader = (state) => state.loader;
|
|
21
|
+
export const loaderReducer = loaderSlice.reducer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppState } from '../app';
|
|
2
|
+
export interface MiscState {
|
|
3
|
+
isGroupOrder: boolean;
|
|
4
|
+
thanxCode: any;
|
|
5
|
+
}
|
|
6
|
+
export declare const setIsGroupOrder: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setThanxCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
7
|
+
export declare const selectIsGroupOrder: (state: AppState) => boolean;
|
|
8
|
+
export declare const selectThanxCode: (state: AppState) => any;
|
|
9
|
+
export declare const miscReducer: import("redux").Reducer<MiscState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {
|
|
3
|
+
isGroupOrder: false,
|
|
4
|
+
thanxCode: null,
|
|
5
|
+
};
|
|
6
|
+
const miscSlice = createSlice({
|
|
7
|
+
name: 'misc',
|
|
8
|
+
initialState,
|
|
9
|
+
reducers: {
|
|
10
|
+
setIsGroupOrder: (state, action) => {
|
|
11
|
+
state.isGroupOrder = action.payload;
|
|
12
|
+
},
|
|
13
|
+
setThanxCode: (state, action) => {
|
|
14
|
+
state.thanxCode = action.payload;
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
export const { setIsGroupOrder, setThanxCode } = miscSlice.actions;
|
|
19
|
+
export const selectIsGroupOrder = (state) => state.misc.isGroupOrder;
|
|
20
|
+
export const selectThanxCode = (state) => state.misc.thanxCode;
|
|
21
|
+
export const miscReducer = miscSlice.reducer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ServiceType } from '@open-tender/types';
|
|
2
|
+
import { AppState } from '../app';
|
|
3
|
+
export interface QrState {
|
|
4
|
+
locationId: number | null;
|
|
5
|
+
prep_type: string | null;
|
|
6
|
+
table: number | null;
|
|
7
|
+
service_type: ServiceType | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const setQrParams: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, resetQrParams: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
10
|
+
export declare const selectQrParams: (state: AppState) => QrState;
|
|
11
|
+
export declare const qrReducer: import("redux").Reducer<QrState, import("redux").AnyAction>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
const initialState = {
|
|
3
|
+
locationId: null,
|
|
4
|
+
prep_type: null,
|
|
5
|
+
table: null,
|
|
6
|
+
service_type: null,
|
|
7
|
+
};
|
|
8
|
+
const qrSlice = createSlice({
|
|
9
|
+
name: 'qr',
|
|
10
|
+
initialState: initialState,
|
|
11
|
+
reducers: {
|
|
12
|
+
setQrParams(state, action) {
|
|
13
|
+
const { locationId, prep_type, table, service_type } = action.payload;
|
|
14
|
+
state.locationId = locationId;
|
|
15
|
+
state.prep_type = prep_type;
|
|
16
|
+
state.table = table;
|
|
17
|
+
state.service_type = service_type;
|
|
18
|
+
},
|
|
19
|
+
resetQrParams(state) {
|
|
20
|
+
state.locationId = null;
|
|
21
|
+
state.prep_type = null;
|
|
22
|
+
state.table = null;
|
|
23
|
+
state.service_type = null;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export const { setQrParams, resetQrParams } = qrSlice.actions;
|
|
28
|
+
export const selectQrParams = (state) => state.qr;
|
|
29
|
+
export const qrReducer = qrSlice.reducer;
|
package/dist/esm/slices/types.js
CHANGED
|
@@ -41,4 +41,8 @@ export var ReducerType;
|
|
|
41
41
|
ReducerType["MenuDisplay"] = "menuDisplay";
|
|
42
42
|
ReducerType["GroupOrder"] = "groupOrder";
|
|
43
43
|
ReducerType["Config"] = "config";
|
|
44
|
+
ReducerType["Geolocation"] = "geolocation";
|
|
45
|
+
ReducerType["Loader"] = "loader";
|
|
46
|
+
ReducerType["Misc"] = "misc";
|
|
47
|
+
ReducerType["Qr"] = "qr";
|
|
44
48
|
})(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.2",
|
|
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",
|