@open-tender/store 0.3.64 → 0.3.65

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.
@@ -6,7 +6,7 @@ export interface ConfigApp {
6
6
  export interface ConfigState {
7
7
  api: any;
8
8
  app: ConfigApp | null;
9
- version: string | null;
9
+ version?: string | null;
10
10
  name: string | null;
11
11
  ipAddress: IpAddress | null;
12
12
  hasPinpad: boolean;
@@ -25,15 +25,14 @@ export declare enum ConfigActionType {
25
25
  }
26
26
  export declare const fetchConfig: import("@reduxjs/toolkit").AsyncThunk<ConfigState, {
27
27
  apiUrl: string;
28
- version: string | null;
29
28
  }, {
30
29
  state: AppState;
31
30
  rejectValue: RequestError;
32
31
  }>;
33
- export declare const resetConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, incrementRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
32
+ export declare const resetConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, incrementRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setVersion: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
34
33
  export declare const selectConfig: (state: AppState) => ConfigState;
35
34
  export declare const selectApi: (state: AppState) => any;
36
- export declare const selectVersion: (state: AppState) => string | null;
35
+ export declare const selectVersion: (state: AppState) => string | null | undefined;
37
36
  export declare const selectPinpad: (state: AppState) => boolean;
38
37
  export declare const selectCashDrawer: (state: AppState) => boolean;
39
38
  export declare const selectRevenueCenterId: (state: AppState) => number | null;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.configReducer = exports.selectLoyalty = exports.selectTimezone = exports.selectMenuColors = exports.selectSelectOptions = exports.selectStore = exports.selectRevenueCenterId = exports.selectCashDrawer = exports.selectPinpad = exports.selectVersion = exports.selectApi = exports.selectConfig = exports.incrementRetries = exports.resetRetries = exports.resetConfig = exports.fetchConfig = exports.ConfigActionType = void 0;
4
+ exports.configReducer = exports.selectLoyalty = exports.selectTimezone = exports.selectMenuColors = exports.selectSelectOptions = exports.selectStore = exports.selectRevenueCenterId = exports.selectCashDrawer = exports.selectPinpad = exports.selectVersion = exports.selectApi = exports.selectConfig = exports.setVersion = exports.incrementRetries = exports.resetRetries = exports.resetConfig = exports.fetchConfig = exports.ConfigActionType = void 0;
5
5
  var tslib_1 = require("tslib");
6
6
  var toolkit_1 = require("@reduxjs/toolkit");
7
7
  var services_1 = require("../services");
@@ -32,7 +32,7 @@ var ConfigActionType;
32
32
  ConfigActionType["FetchConfig"] = "config/getConfig";
33
33
  })(ConfigActionType = exports.ConfigActionType || (exports.ConfigActionType = {}));
34
34
  exports.fetchConfig = (0, toolkit_1.createAsyncThunk)(ConfigActionType.FetchConfig, function (_a, _b) {
35
- var apiUrl = _a.apiUrl, version = _a.version;
35
+ var apiUrl = _a.apiUrl;
36
36
  var dispatch = _b.dispatch, getState = _b.getState, rejectWithValue = _b.rejectWithValue;
37
37
  return tslib_1.__awaiter(void 0, void 0, void 0, function () {
38
38
  var app, api, _c, config, store, _d, selectOptions, _e, menuColors, _f, itemTypes, _g, levelup, err, cashier, employee, tz, businessDate, err_1, revenueCenterId, name_1, ipAddress, hasPinpad, hasCashDrawer, prep_stations, err_2;
@@ -79,7 +79,6 @@ exports.fetchConfig = (0, toolkit_1.createAsyncThunk)(ConfigActionType.FetchConf
79
79
  return [2 /*return*/, {
80
80
  api: api,
81
81
  app: app,
82
- version: version || null,
83
82
  store: store,
84
83
  revenueCenterId: revenueCenterId,
85
84
  name: name_1,
@@ -111,15 +110,17 @@ var configSlice = (0, toolkit_1.createSlice)({
111
110
  },
112
111
  incrementRetries: function (state) {
113
112
  state.retries = state.retries + 1;
113
+ },
114
+ setVersion: function (state, action) {
115
+ state.version = action.payload;
114
116
  }
115
117
  },
116
118
  extraReducers: function (builder) {
117
119
  builder
118
120
  .addCase(exports.fetchConfig.fulfilled, function (state, action) {
119
- var _a = action.payload, api = _a.api, app = _a.app, version = _a.version, store = _a.store, revenueCenterId = _a.revenueCenterId, name = _a.name, ipAddress = _a.ipAddress, hasPinpad = _a.hasPinpad, hasCashDrawer = _a.hasCashDrawer, selectOptions = _a.selectOptions, menuColors = _a.menuColors, levelup = _a.levelup;
121
+ var _a = action.payload, api = _a.api, app = _a.app, store = _a.store, revenueCenterId = _a.revenueCenterId, name = _a.name, ipAddress = _a.ipAddress, hasPinpad = _a.hasPinpad, hasCashDrawer = _a.hasCashDrawer, selectOptions = _a.selectOptions, menuColors = _a.menuColors, levelup = _a.levelup;
120
122
  state.api = api;
121
123
  state.app = app;
122
- state.version = version;
123
124
  state.name = name;
124
125
  state.ipAddress = ipAddress;
125
126
  state.hasPinpad = hasPinpad;
@@ -142,7 +143,7 @@ var configSlice = (0, toolkit_1.createSlice)({
142
143
  });
143
144
  }
144
145
  });
145
- exports.resetConfig = (_a = configSlice.actions, _a.resetConfig), exports.resetRetries = _a.resetRetries, exports.incrementRetries = _a.incrementRetries;
146
+ exports.resetConfig = (_a = configSlice.actions, _a.resetConfig), exports.resetRetries = _a.resetRetries, exports.incrementRetries = _a.incrementRetries, exports.setVersion = _a.setVersion;
146
147
  var selectConfig = function (state) { return state.config; };
147
148
  exports.selectConfig = selectConfig;
148
149
  var selectApi = function (state) { return state.config.api; };
@@ -68,6 +68,7 @@ export interface Item {
68
68
  nutritional_info: NutritionalInfo | null;
69
69
  plu: string | null;
70
70
  points: number | null;
71
+ pos_display_color: string | null;
71
72
  price: Money;
72
73
  sales_tax_override: Decimal | null;
73
74
  service_restrictions: number[];
@@ -11,7 +11,7 @@ var flattenCategories = function (categories) {
11
11
  exports.flattenCategories = flattenCategories;
12
12
  var flattenItems = function (categories) {
13
13
  return categories.reduce(function (arr, i) {
14
- var items = i.items.map(function (item) { return (tslib_1.__assign(tslib_1.__assign({}, item), { color: i.pos_display_color })); });
14
+ var items = i.items.map(function (item) { return (tslib_1.__assign(tslib_1.__assign({}, item), { color: item.pos_display_color || i.pos_display_color })); });
15
15
  return tslib_1.__spreadArray(tslib_1.__spreadArray([], arr, true), items, true);
16
16
  }, []);
17
17
  };
@@ -6,7 +6,7 @@ export interface ConfigApp {
6
6
  export interface ConfigState {
7
7
  api: any;
8
8
  app: ConfigApp | null;
9
- version: string | null;
9
+ version?: string | null;
10
10
  name: string | null;
11
11
  ipAddress: IpAddress | null;
12
12
  hasPinpad: boolean;
@@ -25,15 +25,14 @@ export declare enum ConfigActionType {
25
25
  }
26
26
  export declare const fetchConfig: import("@reduxjs/toolkit").AsyncThunk<ConfigState, {
27
27
  apiUrl: string;
28
- version: string | null;
29
28
  }, {
30
29
  state: AppState;
31
30
  rejectValue: RequestError;
32
31
  }>;
33
- export declare const resetConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, incrementRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
32
+ export declare const resetConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, incrementRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setVersion: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
34
33
  export declare const selectConfig: (state: AppState) => ConfigState;
35
34
  export declare const selectApi: (state: AppState) => any;
36
- export declare const selectVersion: (state: AppState) => string | null;
35
+ export declare const selectVersion: (state: AppState) => string | null | undefined;
37
36
  export declare const selectPinpad: (state: AppState) => boolean;
38
37
  export declare const selectCashDrawer: (state: AppState) => boolean;
39
38
  export declare const selectRevenueCenterId: (state: AppState) => number | null;
@@ -29,7 +29,7 @@ export var ConfigActionType;
29
29
  ConfigActionType["FetchConfig"] = "config/getConfig";
30
30
  })(ConfigActionType || (ConfigActionType = {}));
31
31
  export var fetchConfig = createAsyncThunk(ConfigActionType.FetchConfig, function (_a, _b) {
32
- var apiUrl = _a.apiUrl, version = _a.version;
32
+ var apiUrl = _a.apiUrl;
33
33
  var dispatch = _b.dispatch, getState = _b.getState, rejectWithValue = _b.rejectWithValue;
34
34
  return __awaiter(void 0, void 0, void 0, function () {
35
35
  var app, api, _c, config, store, _d, selectOptions, _e, menuColors, _f, itemTypes, _g, levelup, err, cashier, employee, tz, businessDate, err_1, revenueCenterId, name_1, ipAddress, hasPinpad, hasCashDrawer, prep_stations, err_2;
@@ -76,7 +76,6 @@ export var fetchConfig = createAsyncThunk(ConfigActionType.FetchConfig, function
76
76
  return [2 /*return*/, {
77
77
  api: api,
78
78
  app: app,
79
- version: version || null,
80
79
  store: store,
81
80
  revenueCenterId: revenueCenterId,
82
81
  name: name_1,
@@ -108,15 +107,17 @@ var configSlice = createSlice({
108
107
  },
109
108
  incrementRetries: function (state) {
110
109
  state.retries = state.retries + 1;
110
+ },
111
+ setVersion: function (state, action) {
112
+ state.version = action.payload;
111
113
  }
112
114
  },
113
115
  extraReducers: function (builder) {
114
116
  builder
115
117
  .addCase(fetchConfig.fulfilled, function (state, action) {
116
- var _a = action.payload, api = _a.api, app = _a.app, version = _a.version, store = _a.store, revenueCenterId = _a.revenueCenterId, name = _a.name, ipAddress = _a.ipAddress, hasPinpad = _a.hasPinpad, hasCashDrawer = _a.hasCashDrawer, selectOptions = _a.selectOptions, menuColors = _a.menuColors, levelup = _a.levelup;
118
+ var _a = action.payload, api = _a.api, app = _a.app, store = _a.store, revenueCenterId = _a.revenueCenterId, name = _a.name, ipAddress = _a.ipAddress, hasPinpad = _a.hasPinpad, hasCashDrawer = _a.hasCashDrawer, selectOptions = _a.selectOptions, menuColors = _a.menuColors, levelup = _a.levelup;
117
119
  state.api = api;
118
120
  state.app = app;
119
- state.version = version;
120
121
  state.name = name;
121
122
  state.ipAddress = ipAddress;
122
123
  state.hasPinpad = hasPinpad;
@@ -139,7 +140,7 @@ var configSlice = createSlice({
139
140
  });
140
141
  }
141
142
  });
142
- export var resetConfig = (_a = configSlice.actions, _a.resetConfig), resetRetries = _a.resetRetries, incrementRetries = _a.incrementRetries;
143
+ export var resetConfig = (_a = configSlice.actions, _a.resetConfig), resetRetries = _a.resetRetries, incrementRetries = _a.incrementRetries, setVersion = _a.setVersion;
143
144
  export var selectConfig = function (state) { return state.config; };
144
145
  export var selectApi = function (state) { return state.config.api; };
145
146
  export var selectVersion = function (state) { return state.config.version; };
@@ -68,6 +68,7 @@ export interface Item {
68
68
  nutritional_info: NutritionalInfo | null;
69
69
  plu: string | null;
70
70
  points: number | null;
71
+ pos_display_color: string | null;
71
72
  price: Money;
72
73
  sales_tax_override: Decimal | null;
73
74
  service_restrictions: number[];
@@ -7,7 +7,7 @@ export var flattenCategories = function (categories) {
7
7
  };
8
8
  export var flattenItems = function (categories) {
9
9
  return categories.reduce(function (arr, i) {
10
- var items = i.items.map(function (item) { return (__assign(__assign({}, item), { color: i.pos_display_color })); });
10
+ var items = i.items.map(function (item) { return (__assign(__assign({}, item), { color: item.pos_display_color || i.pos_display_color })); });
11
11
  return __spreadArray(__spreadArray([], arr, true), items, true);
12
12
  }, []);
13
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "0.3.64",
3
+ "version": "0.3.65",
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",