@open-tender/store 0.1.304 → 0.1.305

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.
@@ -43,7 +43,7 @@ var getError = function (kiosk, store, devices) {
43
43
  : errors_1.errorsApi.internalServerError;
44
44
  };
45
45
  exports.fetchKioskConfig = (0, toolkit_1.createAsyncThunk)(KioskActionType.FetchKiosk, function (_a, _b) { return tslib_1.__awaiter(void 0, [_a, _b], void 0, function (_c, _d) {
46
- var posTerminalId, app, api, _e, kiosk, _f, devicesList, _g, stores, paymentConfigs, store, devices, err, brand, content, settings, theme, ratio, displaySettings, err_1;
46
+ var posTerminalId, app, api, promises, _e, kiosk, _f, devicesList, _g, stores, paymentConfigs, store, devices, err, brand, content, settings, theme, ratio, displaySettings, err_1;
47
47
  var apiUrl = _c.apiUrl;
48
48
  var dispatch = _d.dispatch, getState = _d.getState, rejectWithValue = _d.rejectWithValue;
49
49
  return tslib_1.__generator(this, function (_h) {
@@ -53,12 +53,15 @@ exports.fetchKioskConfig = (0, toolkit_1.createAsyncThunk)(KioskActionType.Fetch
53
53
  posTerminalId = getState().pos.terminalId;
54
54
  app = posTerminalId ? { apiUrl: apiUrl, posTerminalId: posTerminalId } : { apiUrl: apiUrl };
55
55
  api = new services_1.PosAPI(app);
56
- return [4 /*yield*/, Promise.all([
57
- api.getKioskConfig(),
58
- api.getSettings('DEVICES'),
59
- api.getSettings('STORE'),
60
- api.fetchPaymentConfigs()
61
- ])];
56
+ promises = [
57
+ api.getKioskConfig(),
58
+ api.getSettings('DEVICES'),
59
+ api.getSettings('STORE')
60
+ ];
61
+ if (posTerminalId) {
62
+ promises.push(api.fetchPaymentConfigs());
63
+ }
64
+ return [4 /*yield*/, Promise.all(promises)];
62
65
  case 1:
63
66
  _e = _h.sent(), kiosk = _e[0], _f = _e[1], devicesList = _f === void 0 ? [] : _f, _g = _e[2], stores = _g === void 0 ? [] : _g, paymentConfigs = _e[3];
64
67
  store = stores[0] || null;
@@ -40,7 +40,7 @@ var getError = function (kiosk, store, devices) {
40
40
  : errorsApi.internalServerError;
41
41
  };
42
42
  export var fetchKioskConfig = createAsyncThunk(KioskActionType.FetchKiosk, function (_a, _b) { return __awaiter(void 0, [_a, _b], void 0, function (_c, _d) {
43
- var posTerminalId, app, api, _e, kiosk, _f, devicesList, _g, stores, paymentConfigs, store, devices, err, brand, content, settings, theme, ratio, displaySettings, err_1;
43
+ var posTerminalId, app, api, promises, _e, kiosk, _f, devicesList, _g, stores, paymentConfigs, store, devices, err, brand, content, settings, theme, ratio, displaySettings, err_1;
44
44
  var apiUrl = _c.apiUrl;
45
45
  var dispatch = _d.dispatch, getState = _d.getState, rejectWithValue = _d.rejectWithValue;
46
46
  return __generator(this, function (_h) {
@@ -50,12 +50,15 @@ export var fetchKioskConfig = createAsyncThunk(KioskActionType.FetchKiosk, funct
50
50
  posTerminalId = getState().pos.terminalId;
51
51
  app = posTerminalId ? { apiUrl: apiUrl, posTerminalId: posTerminalId } : { apiUrl: apiUrl };
52
52
  api = new PosAPI(app);
53
- return [4 /*yield*/, Promise.all([
54
- api.getKioskConfig(),
55
- api.getSettings('DEVICES'),
56
- api.getSettings('STORE'),
57
- api.fetchPaymentConfigs()
58
- ])];
53
+ promises = [
54
+ api.getKioskConfig(),
55
+ api.getSettings('DEVICES'),
56
+ api.getSettings('STORE')
57
+ ];
58
+ if (posTerminalId) {
59
+ promises.push(api.fetchPaymentConfigs());
60
+ }
61
+ return [4 /*yield*/, Promise.all(promises)];
59
62
  case 1:
60
63
  _e = _h.sent(), kiosk = _e[0], _f = _e[1], devicesList = _f === void 0 ? [] : _f, _g = _e[2], stores = _g === void 0 ? [] : _g, paymentConfigs = _e[3];
61
64
  store = stores[0] || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "0.1.304",
3
+ "version": "0.1.305",
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",