@open-tender/cloud 0.1.112 → 0.1.114

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.
@@ -1,4 +1,4 @@
1
- import { AppTheme, ConfigApp, ConfigBrand, ConfigContent, ConfigSettings, RequestError, RequestStatus, Theme } from '@open-tender/types';
1
+ import { AppTheme, ConfigApp, ConfigBrand, ConfigContent, ConfigPage, ConfigPageType, ConfigPages, ConfigSettings, RequestError, RequestStatus, Theme } from '@open-tender/types';
2
2
  import { AppState } from '../app';
3
3
  export interface ConfigState {
4
4
  api: any;
@@ -6,13 +6,14 @@ export interface ConfigState {
6
6
  appTheme: AppTheme | null;
7
7
  brand: ConfigBrand | null;
8
8
  content: ConfigContent | null;
9
- stylesheet: string | null;
10
9
  error: any;
11
10
  isApp: boolean | undefined;
12
11
  isBackgroundFetch: boolean;
13
12
  loading: RequestStatus;
13
+ pages: ConfigPages | null;
14
14
  retries: number;
15
15
  settings: ConfigSettings | null;
16
+ stylesheet: string | null;
16
17
  theme: Theme | null;
17
18
  }
18
19
  export declare enum ConfigActionType {
@@ -36,13 +37,13 @@ export declare const fetchConfig: import("@reduxjs/toolkit").AsyncThunk<ConfigSt
36
37
  rejectedMeta?: unknown;
37
38
  }>;
38
39
  export declare const resetConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"config/resetConfig">, resetRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"config/resetRetries">, incrementRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"config/incrementRetries">;
39
- export declare const selectCateringOnly: (state: AppState) => boolean;
40
40
  export declare const selectConfig: (state: AppState) => ConfigState;
41
41
  export declare const selectBrand: (state: AppState) => ConfigBrand | null;
42
42
  export declare const selectTheme: (state: AppState) => Theme | null;
43
43
  export declare const selectContent: (state: AppState) => ConfigContent | null;
44
44
  export declare const selectSettings: (state: AppState) => ConfigSettings | null;
45
45
  export declare const selectStylesheet: (state: AppState) => string | null;
46
+ export declare const selectPages: (state: AppState) => ConfigPages | null;
46
47
  export declare const selectApi: (state: AppState) => any;
47
48
  export declare const selectAccountConfig: (state: AppState) => {
48
49
  addresses: import("@open-tender/types").ConfigContentField;
@@ -82,6 +83,7 @@ export declare const selectAccountConfig: (state: AppState) => {
82
83
  videoUrl: string;
83
84
  videoUrlMobile: string;
84
85
  } | undefined;
86
+ export declare const selectCateringOnly: (state: AppState) => boolean;
85
87
  export declare const selectDisplaySettings: (state: AppState) => import("@open-tender/types").ConfigDisplaySetting | undefined;
86
88
  export declare const selectConfigRetries: (state: AppState) => number;
87
89
  export declare const selectLightColor: (state: AppState) => string;
@@ -162,6 +164,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
162
164
  export declare const selectFulfillment: (state: AppState) => import("@open-tender/types").ConfigFulfillment | undefined;
163
165
  export declare const selectRecaptcha: (state: AppState) => import("@open-tender/types").ConfigRecaptcha | undefined;
164
166
  export declare const selectContentSection: <T extends keyof ConfigContent>(page: T) => (state: AppState) => ConfigContent[T] | undefined;
167
+ export declare const selectPage: (page: ConfigPageType) => (state: AppState) => ConfigPage | undefined;
165
168
  export declare const selectSoldOutMsg: (state: AppState) => string;
166
169
  export declare const selectHeaderHeight: (state: AppState) => (isBrowser: boolean) => number;
167
170
  export declare const selectOutpostName: (state: AppState) => string | undefined;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.configReducer = exports.selectCategoryType = 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.selectStylesheet = 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.selectCategoryType = exports.selectHasCatering = exports.selectOutpostName = exports.selectHeaderHeight = exports.selectSoldOutMsg = exports.selectPage = exports.selectContentSection = exports.selectRecaptcha = exports.selectFulfillment = exports.selectOptIns = exports.selectLightColor = exports.selectConfigRetries = exports.selectDisplaySettings = exports.selectCateringOnly = exports.selectAccountConfig = exports.selectApi = exports.selectPages = exports.selectStylesheet = exports.selectSettings = exports.selectContent = exports.selectTheme = exports.selectBrand = exports.selectConfig = 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");
@@ -13,14 +13,15 @@ const initialState = {
13
13
  appTheme: null,
14
14
  brand: null,
15
15
  content: null,
16
- stylesheet: null,
17
- theme: null,
16
+ error: null,
18
17
  isApp: false,
19
18
  isBackgroundFetch: false,
20
19
  loading: 'idle',
21
- error: null,
20
+ pages: null,
22
21
  retries: 0,
23
- settings: null
22
+ settings: null,
23
+ stylesheet: null,
24
+ theme: null
24
25
  };
25
26
  var ConfigActionType;
26
27
  (function (ConfigActionType) {
@@ -59,7 +60,7 @@ const configSlice = (0, toolkit_1.createSlice)({
59
60
  extraReducers: builder => {
60
61
  builder
61
62
  .addCase(exports.fetchConfig.fulfilled, (state, action) => {
62
- const { app, isApp, brand, content, theme, settings, stylesheet } = action.payload;
63
+ const { app, isApp, brand, content, theme, settings, stylesheet, pages } = action.payload;
63
64
  state.app = app;
64
65
  state.brand = brand;
65
66
  state.content = content;
@@ -67,6 +68,7 @@ const configSlice = (0, toolkit_1.createSlice)({
67
68
  state.appTheme = isApp && theme ? (0, utils_1.decorateTheme)(theme) : null;
68
69
  state.settings = settings;
69
70
  state.stylesheet = stylesheet;
71
+ state.pages = pages;
70
72
  state.loading = 'idle';
71
73
  state.api = new api_1.default(app);
72
74
  state.error = null;
@@ -84,11 +86,6 @@ const configSlice = (0, toolkit_1.createSlice)({
84
86
  }
85
87
  });
86
88
  _a = configSlice.actions, exports.resetConfig = _a.resetConfig, exports.resetRetries = _a.resetRetries, exports.incrementRetries = _a.incrementRetries;
87
- const selectCateringOnly = (state) => {
88
- const { orderTypes } = state.config.settings || {};
89
- return !!((orderTypes === null || orderTypes === void 0 ? void 0 : orderTypes.includes('CATERING')) && orderTypes.length === 1);
90
- };
91
- exports.selectCateringOnly = selectCateringOnly;
92
89
  const selectConfig = (state) => state.config;
93
90
  exports.selectConfig = selectConfig;
94
91
  const selectBrand = (state) => state.config.brand;
@@ -101,10 +98,17 @@ const selectSettings = (state) => state.config.settings;
101
98
  exports.selectSettings = selectSettings;
102
99
  const selectStylesheet = (state) => state.config.stylesheet;
103
100
  exports.selectStylesheet = selectStylesheet;
101
+ const selectPages = (state) => state.config.pages;
102
+ exports.selectPages = selectPages;
104
103
  const selectApi = (state) => state.config.api;
105
104
  exports.selectApi = selectApi;
106
105
  const selectAccountConfig = (state) => { var _a; return (_a = state.config.content) === null || _a === void 0 ? void 0 : _a.account; };
107
106
  exports.selectAccountConfig = selectAccountConfig;
107
+ const selectCateringOnly = (state) => {
108
+ const { orderTypes } = state.config.settings || {};
109
+ return !!((orderTypes === null || orderTypes === void 0 ? void 0 : orderTypes.includes('CATERING')) && orderTypes.length === 1);
110
+ };
111
+ exports.selectCateringOnly = selectCateringOnly;
108
112
  const selectDisplaySettings = (state) => {
109
113
  var _a;
110
114
  const orderType = state.order.orderType || 'OLO';
@@ -127,6 +131,8 @@ const selectRecaptcha = (state) => { var _a; return (_a = state.config.settings)
127
131
  exports.selectRecaptcha = selectRecaptcha;
128
132
  const selectContentSection = (page) => (state) => state.config.content ? state.config.content[page] : undefined;
129
133
  exports.selectContentSection = selectContentSection;
134
+ const selectPage = (page) => (state) => state.config.pages ? state.config.pages[page] : undefined;
135
+ exports.selectPage = selectPage;
130
136
  const selectSoldOutMsg = (state) => {
131
137
  var _a;
132
138
  const { soldOutMessage } = ((_a = state.config.content) === null || _a === void 0 ? void 0 : _a.menu) || {};
@@ -1,4 +1,4 @@
1
- import { AppTheme, ConfigApp, ConfigBrand, ConfigContent, ConfigSettings, RequestError, RequestStatus, Theme } from '@open-tender/types';
1
+ import { AppTheme, ConfigApp, ConfigBrand, ConfigContent, ConfigPage, ConfigPageType, ConfigPages, ConfigSettings, RequestError, RequestStatus, Theme } from '@open-tender/types';
2
2
  import { AppState } from '../app';
3
3
  export interface ConfigState {
4
4
  api: any;
@@ -6,13 +6,14 @@ export interface ConfigState {
6
6
  appTheme: AppTheme | null;
7
7
  brand: ConfigBrand | null;
8
8
  content: ConfigContent | null;
9
- stylesheet: string | null;
10
9
  error: any;
11
10
  isApp: boolean | undefined;
12
11
  isBackgroundFetch: boolean;
13
12
  loading: RequestStatus;
13
+ pages: ConfigPages | null;
14
14
  retries: number;
15
15
  settings: ConfigSettings | null;
16
+ stylesheet: string | null;
16
17
  theme: Theme | null;
17
18
  }
18
19
  export declare enum ConfigActionType {
@@ -36,13 +37,13 @@ export declare const fetchConfig: import("@reduxjs/toolkit").AsyncThunk<ConfigSt
36
37
  rejectedMeta?: unknown;
37
38
  }>;
38
39
  export declare const resetConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"config/resetConfig">, resetRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"config/resetRetries">, incrementRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"config/incrementRetries">;
39
- export declare const selectCateringOnly: (state: AppState) => boolean;
40
40
  export declare const selectConfig: (state: AppState) => ConfigState;
41
41
  export declare const selectBrand: (state: AppState) => ConfigBrand | null;
42
42
  export declare const selectTheme: (state: AppState) => Theme | null;
43
43
  export declare const selectContent: (state: AppState) => ConfigContent | null;
44
44
  export declare const selectSettings: (state: AppState) => ConfigSettings | null;
45
45
  export declare const selectStylesheet: (state: AppState) => string | null;
46
+ export declare const selectPages: (state: AppState) => ConfigPages | null;
46
47
  export declare const selectApi: (state: AppState) => any;
47
48
  export declare const selectAccountConfig: (state: AppState) => {
48
49
  addresses: import("@open-tender/types").ConfigContentField;
@@ -82,6 +83,7 @@ export declare const selectAccountConfig: (state: AppState) => {
82
83
  videoUrl: string;
83
84
  videoUrlMobile: string;
84
85
  } | undefined;
86
+ export declare const selectCateringOnly: (state: AppState) => boolean;
85
87
  export declare const selectDisplaySettings: (state: AppState) => import("@open-tender/types").ConfigDisplaySetting | undefined;
86
88
  export declare const selectConfigRetries: (state: AppState) => number;
87
89
  export declare const selectLightColor: (state: AppState) => string;
@@ -162,6 +164,7 @@ export declare const selectOptIns: ((state: import("redux").EmptyObject & {
162
164
  export declare const selectFulfillment: (state: AppState) => import("@open-tender/types").ConfigFulfillment | undefined;
163
165
  export declare const selectRecaptcha: (state: AppState) => import("@open-tender/types").ConfigRecaptcha | undefined;
164
166
  export declare const selectContentSection: <T extends keyof ConfigContent>(page: T) => (state: AppState) => ConfigContent[T] | undefined;
167
+ export declare const selectPage: (page: ConfigPageType) => (state: AppState) => ConfigPage | undefined;
165
168
  export declare const selectSoldOutMsg: (state: AppState) => string;
166
169
  export declare const selectHeaderHeight: (state: AppState) => (isBrowser: boolean) => number;
167
170
  export declare const selectOutpostName: (state: AppState) => string | undefined;
@@ -9,14 +9,15 @@ const initialState = {
9
9
  appTheme: null,
10
10
  brand: null,
11
11
  content: null,
12
- stylesheet: null,
13
- theme: null,
12
+ error: null,
14
13
  isApp: false,
15
14
  isBackgroundFetch: false,
16
15
  loading: 'idle',
17
- error: null,
16
+ pages: null,
18
17
  retries: 0,
19
- settings: null
18
+ settings: null,
19
+ stylesheet: null,
20
+ theme: null
20
21
  };
21
22
  export var ConfigActionType;
22
23
  (function (ConfigActionType) {
@@ -55,7 +56,7 @@ const configSlice = createSlice({
55
56
  extraReducers: builder => {
56
57
  builder
57
58
  .addCase(fetchConfig.fulfilled, (state, action) => {
58
- const { app, isApp, brand, content, theme, settings, stylesheet } = action.payload;
59
+ const { app, isApp, brand, content, theme, settings, stylesheet, pages } = action.payload;
59
60
  state.app = app;
60
61
  state.brand = brand;
61
62
  state.content = content;
@@ -63,6 +64,7 @@ const configSlice = createSlice({
63
64
  state.appTheme = isApp && theme ? decorateTheme(theme) : null;
64
65
  state.settings = settings;
65
66
  state.stylesheet = stylesheet;
67
+ state.pages = pages;
66
68
  state.loading = 'idle';
67
69
  state.api = new OpenTenderAPI(app);
68
70
  state.error = null;
@@ -80,18 +82,19 @@ const configSlice = createSlice({
80
82
  }
81
83
  });
82
84
  export const { resetConfig, resetRetries, incrementRetries } = configSlice.actions;
83
- export const selectCateringOnly = (state) => {
84
- const { orderTypes } = state.config.settings || {};
85
- return !!((orderTypes === null || orderTypes === void 0 ? void 0 : orderTypes.includes('CATERING')) && orderTypes.length === 1);
86
- };
87
85
  export const selectConfig = (state) => state.config;
88
86
  export const selectBrand = (state) => state.config.brand;
89
87
  export const selectTheme = (state) => state.config.theme;
90
88
  export const selectContent = (state) => state.config.content;
91
89
  export const selectSettings = (state) => state.config.settings;
92
90
  export const selectStylesheet = (state) => state.config.stylesheet;
91
+ export const selectPages = (state) => state.config.pages;
93
92
  export const selectApi = (state) => state.config.api;
94
93
  export const selectAccountConfig = (state) => { var _a; return (_a = state.config.content) === null || _a === void 0 ? void 0 : _a.account; };
94
+ export const selectCateringOnly = (state) => {
95
+ const { orderTypes } = state.config.settings || {};
96
+ return !!((orderTypes === null || orderTypes === void 0 ? void 0 : orderTypes.includes('CATERING')) && orderTypes.length === 1);
97
+ };
95
98
  export const selectDisplaySettings = (state) => {
96
99
  var _a;
97
100
  const orderType = state.order.orderType || 'OLO';
@@ -108,6 +111,7 @@ export const selectOptIns = createSelector((state) => {
108
111
  export const selectFulfillment = (state) => { var _a; return (_a = state.config.brand) === null || _a === void 0 ? void 0 : _a.fulfillment; };
109
112
  export const selectRecaptcha = (state) => { var _a; return (_a = state.config.settings) === null || _a === void 0 ? void 0 : _a.recaptcha; };
110
113
  export const selectContentSection = (page) => (state) => state.config.content ? state.config.content[page] : undefined;
114
+ export const selectPage = (page) => (state) => state.config.pages ? state.config.pages[page] : undefined;
111
115
  export const selectSoldOutMsg = (state) => {
112
116
  var _a;
113
117
  const { soldOutMessage } = ((_a = state.config.content) === null || _a === void 0 ? void 0 : _a.menu) || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/cloud",
3
- "version": "0.1.112",
3
+ "version": "0.1.114",
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",
@@ -49,8 +49,8 @@
49
49
  "typescript": "^4.8.2"
50
50
  },
51
51
  "peerDependencies": {
52
- "@open-tender/types": "^0.2.102",
53
- "@open-tender/utils": "^0.1.171",
52
+ "@open-tender/types": "^0.2.105",
53
+ "@open-tender/utils": "^0.1.173",
54
54
  "@reduxjs/toolkit": "^1.8.5",
55
55
  "react": "^18.2.0"
56
56
  }