@open-tender/store 0.8.9 → 0.8.10
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/services/api.js +1 -1
- package/dist/cjs/slices/kiosk.d.ts +11 -7
- package/dist/cjs/slices/kiosk.js +33 -21
- package/dist/cjs/types/api/kiosk.d.ts +19 -4
- package/dist/esm/services/api.js +1 -1
- package/dist/esm/slices/kiosk.d.ts +11 -7
- package/dist/esm/slices/kiosk.js +33 -21
- package/dist/esm/types/api/kiosk.d.ts +19 -4
- package/package.json +3 -2
- package/dist/.DS_Store +0 -0
package/dist/cjs/services/api.js
CHANGED
|
@@ -113,7 +113,7 @@ var PosAPI = /** @class */ (function () {
|
|
|
113
113
|
return this.request("/".concat(endpoint), 'POST', data);
|
|
114
114
|
};
|
|
115
115
|
PosAPI.prototype.getKioskConfig = function () {
|
|
116
|
-
return this.request("/
|
|
116
|
+
return this.request("/kiosk");
|
|
117
117
|
};
|
|
118
118
|
PosAPI.prototype.getStore = function () {
|
|
119
119
|
return this.request("/store");
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { AppConfig } from '@open-tender/ui';
|
|
2
|
-
import { KioskBrand, RequestError, RequestStatus, Store, Devices, KioskStyles } from '../types';
|
|
2
|
+
import { KioskBrand, RequestError, RequestStatus, Store, Devices, KioskStyles, KioskContent, KioskDisplaySettings } from '../types';
|
|
3
3
|
import { AppState } from '../app';
|
|
4
|
+
import { AppTheme } from '@open-tender/types';
|
|
4
5
|
export interface KioskApp {
|
|
5
6
|
apiUrl: string;
|
|
6
7
|
}
|
|
7
8
|
export interface KioskState {
|
|
8
9
|
app: KioskApp | null;
|
|
9
|
-
version?: string | null;
|
|
10
|
-
devices: Devices | null;
|
|
11
|
-
store: Store | null;
|
|
12
10
|
brand: KioskBrand | null;
|
|
13
11
|
config: AppConfig | null;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
loading: RequestStatus;
|
|
12
|
+
content: KioskContent | null;
|
|
13
|
+
devices: Devices | null;
|
|
17
14
|
error: RequestError | null;
|
|
15
|
+
loading: RequestStatus;
|
|
16
|
+
ratio: number;
|
|
18
17
|
retries: number;
|
|
18
|
+
settings: KioskDisplaySettings | null;
|
|
19
|
+
store: Store | null;
|
|
20
|
+
styles: KioskStyles | null;
|
|
21
|
+
theme: AppTheme | null;
|
|
22
|
+
version?: string | null;
|
|
19
23
|
}
|
|
20
24
|
export declare enum KioskActionType {
|
|
21
25
|
FetchKiosk = "kiosk/getKiosk"
|
package/dist/cjs/slices/kiosk.js
CHANGED
|
@@ -11,16 +11,19 @@ var config_1 = require("./config");
|
|
|
11
11
|
var order_1 = require("./order");
|
|
12
12
|
var initialState = {
|
|
13
13
|
app: null,
|
|
14
|
-
version: null,
|
|
15
|
-
devices: null,
|
|
16
|
-
store: null,
|
|
17
14
|
brand: null,
|
|
18
15
|
config: null,
|
|
16
|
+
content: null,
|
|
17
|
+
devices: null,
|
|
18
|
+
error: null,
|
|
19
|
+
loading: 'idle',
|
|
20
|
+
store: null,
|
|
19
21
|
styles: null,
|
|
20
22
|
ratio: 1,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
retries: 0,
|
|
24
|
+
settings: null,
|
|
25
|
+
theme: null,
|
|
26
|
+
version: null
|
|
24
27
|
};
|
|
25
28
|
var KioskActionType;
|
|
26
29
|
(function (KioskActionType) {
|
|
@@ -30,7 +33,7 @@ exports.fetchKioskConfig = (0, toolkit_1.createAsyncThunk)(KioskActionType.Fetch
|
|
|
30
33
|
var apiUrl = _a.apiUrl;
|
|
31
34
|
var dispatch = _b.dispatch, rejectWithValue = _b.rejectWithValue;
|
|
32
35
|
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
33
|
-
var app, api, _c, _d, devicesList, _e, stores, store, devices, err, err_1;
|
|
36
|
+
var app, api, _c, kiosk, _d, devicesList, _e, stores, store, devices, err, brand, content, settings, theme, ratio, displaySettings, err_1;
|
|
34
37
|
return tslib_1.__generator(this, function (_f) {
|
|
35
38
|
switch (_f.label) {
|
|
36
39
|
case 0:
|
|
@@ -38,30 +41,36 @@ exports.fetchKioskConfig = (0, toolkit_1.createAsyncThunk)(KioskActionType.Fetch
|
|
|
38
41
|
app = { apiUrl: apiUrl };
|
|
39
42
|
api = new services_1.PosAPI(app);
|
|
40
43
|
return [4 /*yield*/, Promise.all([
|
|
44
|
+
api.getKioskConfig(),
|
|
41
45
|
api.getSettings('DEVICES'),
|
|
42
46
|
api.getSettings('STORE')
|
|
43
47
|
])];
|
|
44
48
|
case 1:
|
|
45
|
-
_c = _f.sent(),
|
|
49
|
+
_c = _f.sent(), kiosk = _c[0], _d = _c[1], devicesList = _d === void 0 ? [] : _d, _e = _c[2], stores = _e === void 0 ? [] : _e;
|
|
46
50
|
store = stores[0] || null;
|
|
47
51
|
devices = devicesList[0] || null;
|
|
48
|
-
if (!store || !devices) {
|
|
52
|
+
if (!kiosk || !store || !devices) {
|
|
49
53
|
err = errors_1.errorsApi.internalServerError;
|
|
50
54
|
return [2 /*return*/, rejectWithValue(err)];
|
|
51
55
|
}
|
|
52
56
|
dispatch((0, config_1.setApi)(api));
|
|
53
57
|
dispatch((0, order_1.setRevenueCenterId)(store.revenue_center_id));
|
|
58
|
+
brand = kiosk.brand, content = kiosk.content, settings = kiosk.settings, theme = kiosk.theme;
|
|
59
|
+
ratio = settings.ratio, displaySettings = settings.displaySettings;
|
|
54
60
|
return [2 /*return*/, {
|
|
55
61
|
app: app,
|
|
56
|
-
|
|
57
|
-
store: store,
|
|
58
|
-
brand: null,
|
|
62
|
+
brand: brand,
|
|
59
63
|
config: null,
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
content: content,
|
|
65
|
+
devices: devices,
|
|
62
66
|
error: null,
|
|
63
67
|
loading: 'idle',
|
|
64
|
-
|
|
68
|
+
ratio: ratio,
|
|
69
|
+
retries: 0,
|
|
70
|
+
settings: displaySettings,
|
|
71
|
+
store: store,
|
|
72
|
+
styles: null,
|
|
73
|
+
theme: theme
|
|
65
74
|
}];
|
|
66
75
|
case 2:
|
|
67
76
|
err_1 = _f.sent();
|
|
@@ -98,17 +107,20 @@ var kioskSlice = (0, toolkit_1.createSlice)({
|
|
|
98
107
|
extraReducers: function (builder) {
|
|
99
108
|
builder
|
|
100
109
|
.addCase(exports.fetchKioskConfig.fulfilled, function (state, action) {
|
|
101
|
-
var _a = action.payload, app = _a.app, devices = _a.devices,
|
|
110
|
+
var _a = action.payload, app = _a.app, brand = _a.brand, config = _a.config, content = _a.content, devices = _a.devices, ratio = _a.ratio, settings = _a.settings, store = _a.store, styles = _a.styles, theme = _a.theme;
|
|
102
111
|
state.app = app;
|
|
103
|
-
state.devices = devices;
|
|
104
|
-
state.store = store;
|
|
105
112
|
state.brand = brand;
|
|
106
113
|
state.config = config;
|
|
107
|
-
state.
|
|
108
|
-
state.
|
|
114
|
+
state.content = content;
|
|
115
|
+
state.devices = devices;
|
|
116
|
+
state.error = null;
|
|
109
117
|
state.loading = 'idle';
|
|
118
|
+
state.ratio = ratio;
|
|
110
119
|
state.retries = 0;
|
|
111
|
-
state.
|
|
120
|
+
state.settings = settings;
|
|
121
|
+
state.store = store;
|
|
122
|
+
state.styles = styles;
|
|
123
|
+
state.theme = theme;
|
|
112
124
|
})
|
|
113
125
|
.addCase(exports.fetchKioskConfig.pending, function (state) {
|
|
114
126
|
state.loading = 'pending';
|
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppTheme } from '@open-tender/types';
|
|
2
2
|
export interface Dimensions {
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
}
|
|
6
|
-
export type KioskBrand = Record<string, unknown>;
|
|
7
6
|
export type KioskContent = Record<string, unknown>;
|
|
8
7
|
export type KioskStyles = Record<string, Record<string, string | number>>;
|
|
8
|
+
export interface KioskBrand {
|
|
9
|
+
email: string;
|
|
10
|
+
logo: string;
|
|
11
|
+
logoLight: string;
|
|
12
|
+
}
|
|
13
|
+
export interface KioskDisplaySettings {
|
|
14
|
+
hasCustomize: boolean;
|
|
15
|
+
showAllergens: boolean;
|
|
16
|
+
showCals: boolean;
|
|
17
|
+
showDesc: boolean;
|
|
18
|
+
showMadeFor: boolean;
|
|
19
|
+
showNotes: boolean;
|
|
20
|
+
showQuickAdd: boolean;
|
|
21
|
+
showTags: boolean;
|
|
22
|
+
skipToCustomize: boolean;
|
|
23
|
+
}
|
|
9
24
|
export interface KioskSettings {
|
|
10
25
|
ratio: number;
|
|
11
|
-
displaySettings:
|
|
26
|
+
displaySettings: KioskDisplaySettings;
|
|
12
27
|
}
|
|
13
28
|
export interface KioskConfig {
|
|
14
29
|
brand: KioskBrand;
|
|
15
30
|
content: KioskContent;
|
|
16
|
-
theme: ThemeCloud;
|
|
17
31
|
settings: KioskSettings;
|
|
32
|
+
theme: AppTheme;
|
|
18
33
|
}
|
package/dist/esm/services/api.js
CHANGED
|
@@ -111,7 +111,7 @@ var PosAPI = /** @class */ (function () {
|
|
|
111
111
|
return this.request("/".concat(endpoint), 'POST', data);
|
|
112
112
|
};
|
|
113
113
|
PosAPI.prototype.getKioskConfig = function () {
|
|
114
|
-
return this.request("/
|
|
114
|
+
return this.request("/kiosk");
|
|
115
115
|
};
|
|
116
116
|
PosAPI.prototype.getStore = function () {
|
|
117
117
|
return this.request("/store");
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { AppConfig } from '@open-tender/ui';
|
|
2
|
-
import { KioskBrand, RequestError, RequestStatus, Store, Devices, KioskStyles } from '../types';
|
|
2
|
+
import { KioskBrand, RequestError, RequestStatus, Store, Devices, KioskStyles, KioskContent, KioskDisplaySettings } from '../types';
|
|
3
3
|
import { AppState } from '../app';
|
|
4
|
+
import { AppTheme } from '@open-tender/types';
|
|
4
5
|
export interface KioskApp {
|
|
5
6
|
apiUrl: string;
|
|
6
7
|
}
|
|
7
8
|
export interface KioskState {
|
|
8
9
|
app: KioskApp | null;
|
|
9
|
-
version?: string | null;
|
|
10
|
-
devices: Devices | null;
|
|
11
|
-
store: Store | null;
|
|
12
10
|
brand: KioskBrand | null;
|
|
13
11
|
config: AppConfig | null;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
loading: RequestStatus;
|
|
12
|
+
content: KioskContent | null;
|
|
13
|
+
devices: Devices | null;
|
|
17
14
|
error: RequestError | null;
|
|
15
|
+
loading: RequestStatus;
|
|
16
|
+
ratio: number;
|
|
18
17
|
retries: number;
|
|
18
|
+
settings: KioskDisplaySettings | null;
|
|
19
|
+
store: Store | null;
|
|
20
|
+
styles: KioskStyles | null;
|
|
21
|
+
theme: AppTheme | null;
|
|
22
|
+
version?: string | null;
|
|
19
23
|
}
|
|
20
24
|
export declare enum KioskActionType {
|
|
21
25
|
FetchKiosk = "kiosk/getKiosk"
|
package/dist/esm/slices/kiosk.js
CHANGED
|
@@ -8,16 +8,19 @@ import { setApi } from './config';
|
|
|
8
8
|
import { setRevenueCenterId } from './order';
|
|
9
9
|
var initialState = {
|
|
10
10
|
app: null,
|
|
11
|
-
version: null,
|
|
12
|
-
devices: null,
|
|
13
|
-
store: null,
|
|
14
11
|
brand: null,
|
|
15
12
|
config: null,
|
|
13
|
+
content: null,
|
|
14
|
+
devices: null,
|
|
15
|
+
error: null,
|
|
16
|
+
loading: 'idle',
|
|
17
|
+
store: null,
|
|
16
18
|
styles: null,
|
|
17
19
|
ratio: 1,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
retries: 0,
|
|
21
|
+
settings: null,
|
|
22
|
+
theme: null,
|
|
23
|
+
version: null
|
|
21
24
|
};
|
|
22
25
|
export var KioskActionType;
|
|
23
26
|
(function (KioskActionType) {
|
|
@@ -27,7 +30,7 @@ export var fetchKioskConfig = createAsyncThunk(KioskActionType.FetchKiosk, funct
|
|
|
27
30
|
var apiUrl = _a.apiUrl;
|
|
28
31
|
var dispatch = _b.dispatch, rejectWithValue = _b.rejectWithValue;
|
|
29
32
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
30
|
-
var app, api, _c, _d, devicesList, _e, stores, store, devices, err, err_1;
|
|
33
|
+
var app, api, _c, kiosk, _d, devicesList, _e, stores, store, devices, err, brand, content, settings, theme, ratio, displaySettings, err_1;
|
|
31
34
|
return __generator(this, function (_f) {
|
|
32
35
|
switch (_f.label) {
|
|
33
36
|
case 0:
|
|
@@ -35,30 +38,36 @@ export var fetchKioskConfig = createAsyncThunk(KioskActionType.FetchKiosk, funct
|
|
|
35
38
|
app = { apiUrl: apiUrl };
|
|
36
39
|
api = new PosAPI(app);
|
|
37
40
|
return [4 /*yield*/, Promise.all([
|
|
41
|
+
api.getKioskConfig(),
|
|
38
42
|
api.getSettings('DEVICES'),
|
|
39
43
|
api.getSettings('STORE')
|
|
40
44
|
])];
|
|
41
45
|
case 1:
|
|
42
|
-
_c = _f.sent(),
|
|
46
|
+
_c = _f.sent(), kiosk = _c[0], _d = _c[1], devicesList = _d === void 0 ? [] : _d, _e = _c[2], stores = _e === void 0 ? [] : _e;
|
|
43
47
|
store = stores[0] || null;
|
|
44
48
|
devices = devicesList[0] || null;
|
|
45
|
-
if (!store || !devices) {
|
|
49
|
+
if (!kiosk || !store || !devices) {
|
|
46
50
|
err = errorsApi.internalServerError;
|
|
47
51
|
return [2 /*return*/, rejectWithValue(err)];
|
|
48
52
|
}
|
|
49
53
|
dispatch(setApi(api));
|
|
50
54
|
dispatch(setRevenueCenterId(store.revenue_center_id));
|
|
55
|
+
brand = kiosk.brand, content = kiosk.content, settings = kiosk.settings, theme = kiosk.theme;
|
|
56
|
+
ratio = settings.ratio, displaySettings = settings.displaySettings;
|
|
51
57
|
return [2 /*return*/, {
|
|
52
58
|
app: app,
|
|
53
|
-
|
|
54
|
-
store: store,
|
|
55
|
-
brand: null,
|
|
59
|
+
brand: brand,
|
|
56
60
|
config: null,
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
content: content,
|
|
62
|
+
devices: devices,
|
|
59
63
|
error: null,
|
|
60
64
|
loading: 'idle',
|
|
61
|
-
|
|
65
|
+
ratio: ratio,
|
|
66
|
+
retries: 0,
|
|
67
|
+
settings: displaySettings,
|
|
68
|
+
store: store,
|
|
69
|
+
styles: null,
|
|
70
|
+
theme: theme
|
|
62
71
|
}];
|
|
63
72
|
case 2:
|
|
64
73
|
err_1 = _f.sent();
|
|
@@ -95,17 +104,20 @@ var kioskSlice = createSlice({
|
|
|
95
104
|
extraReducers: function (builder) {
|
|
96
105
|
builder
|
|
97
106
|
.addCase(fetchKioskConfig.fulfilled, function (state, action) {
|
|
98
|
-
var _a = action.payload, app = _a.app, devices = _a.devices,
|
|
107
|
+
var _a = action.payload, app = _a.app, brand = _a.brand, config = _a.config, content = _a.content, devices = _a.devices, ratio = _a.ratio, settings = _a.settings, store = _a.store, styles = _a.styles, theme = _a.theme;
|
|
99
108
|
state.app = app;
|
|
100
|
-
state.devices = devices;
|
|
101
|
-
state.store = store;
|
|
102
109
|
state.brand = brand;
|
|
103
110
|
state.config = config;
|
|
104
|
-
state.
|
|
105
|
-
state.
|
|
111
|
+
state.content = content;
|
|
112
|
+
state.devices = devices;
|
|
113
|
+
state.error = null;
|
|
106
114
|
state.loading = 'idle';
|
|
115
|
+
state.ratio = ratio;
|
|
107
116
|
state.retries = 0;
|
|
108
|
-
state.
|
|
117
|
+
state.settings = settings;
|
|
118
|
+
state.store = store;
|
|
119
|
+
state.styles = styles;
|
|
120
|
+
state.theme = theme;
|
|
109
121
|
})
|
|
110
122
|
.addCase(fetchKioskConfig.pending, function (state) {
|
|
111
123
|
state.loading = 'pending';
|
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppTheme } from '@open-tender/types';
|
|
2
2
|
export interface Dimensions {
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
}
|
|
6
|
-
export type KioskBrand = Record<string, unknown>;
|
|
7
6
|
export type KioskContent = Record<string, unknown>;
|
|
8
7
|
export type KioskStyles = Record<string, Record<string, string | number>>;
|
|
8
|
+
export interface KioskBrand {
|
|
9
|
+
email: string;
|
|
10
|
+
logo: string;
|
|
11
|
+
logoLight: string;
|
|
12
|
+
}
|
|
13
|
+
export interface KioskDisplaySettings {
|
|
14
|
+
hasCustomize: boolean;
|
|
15
|
+
showAllergens: boolean;
|
|
16
|
+
showCals: boolean;
|
|
17
|
+
showDesc: boolean;
|
|
18
|
+
showMadeFor: boolean;
|
|
19
|
+
showNotes: boolean;
|
|
20
|
+
showQuickAdd: boolean;
|
|
21
|
+
showTags: boolean;
|
|
22
|
+
skipToCustomize: boolean;
|
|
23
|
+
}
|
|
9
24
|
export interface KioskSettings {
|
|
10
25
|
ratio: number;
|
|
11
|
-
displaySettings:
|
|
26
|
+
displaySettings: KioskDisplaySettings;
|
|
12
27
|
}
|
|
13
28
|
export interface KioskConfig {
|
|
14
29
|
brand: KioskBrand;
|
|
15
30
|
content: KioskContent;
|
|
16
|
-
theme: ThemeCloud;
|
|
17
31
|
settings: KioskSettings;
|
|
32
|
+
theme: AppTheme;
|
|
18
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@emotion/react": "^11.11.1",
|
|
61
|
-
"@open-tender/
|
|
61
|
+
"@open-tender/types": "^0.4.1",
|
|
62
|
+
"@open-tender/ui": "^0.1.15",
|
|
62
63
|
"@reduxjs/toolkit": "^2.0.1",
|
|
63
64
|
"date-fns": "2.30.0",
|
|
64
65
|
"date-fns-tz": "^2.0.0",
|
package/dist/.DS_Store
DELETED
|
Binary file
|