@open-tender/store 0.1.303 → 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.
@@ -19,6 +19,22 @@ export interface KioskState {
19
19
  styles: KioskStyles | null;
20
20
  theme: AppTheme | null;
21
21
  version?: string | null;
22
+ paymentConfigs: {
23
+ integration: string;
24
+ is_testing: boolean;
25
+ merchant_api_key: string;
26
+ merchant_id: string;
27
+ merchant_password: string;
28
+ merchant_username: string;
29
+ offline_limit: string;
30
+ saved_cards: boolean;
31
+ signature_threshold: string | null;
32
+ freedompay_store_id: string;
33
+ card_stor_service_url: string;
34
+ client_selling_system: string;
35
+ client_selling_system_version: string;
36
+ freedompay_terminal_id: string;
37
+ } | null;
22
38
  }
23
39
  export declare enum KioskActionType {
24
40
  FetchKiosk = "kiosk/getKiosk",
@@ -8,8 +8,8 @@ var services_1 = require("../services");
8
8
  var errors_1 = require("../services/errors");
9
9
  var config_1 = require("./config");
10
10
  var order_1 = require("./order");
11
- var types_1 = require("./types");
12
11
  var revenueCenter_1 = require("./revenueCenter");
12
+ var types_1 = require("./types");
13
13
  var initialState = {
14
14
  app: null,
15
15
  brand: null,
@@ -24,7 +24,8 @@ var initialState = {
24
24
  retries: 0,
25
25
  settings: null,
26
26
  theme: null,
27
- version: null
27
+ version: null,
28
+ paymentConfigs: null
28
29
  };
29
30
  var KioskActionType;
30
31
  (function (KioskActionType) {
@@ -42,7 +43,7 @@ var getError = function (kiosk, store, devices) {
42
43
  : errors_1.errorsApi.internalServerError;
43
44
  };
44
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) {
45
- var posTerminalId, app, api, _e, kiosk, _f, devicesList, _g, stores, 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;
46
47
  var apiUrl = _c.apiUrl;
47
48
  var dispatch = _d.dispatch, getState = _d.getState, rejectWithValue = _d.rejectWithValue;
48
49
  return tslib_1.__generator(this, function (_h) {
@@ -52,13 +53,17 @@ exports.fetchKioskConfig = (0, toolkit_1.createAsyncThunk)(KioskActionType.Fetch
52
53
  posTerminalId = getState().pos.terminalId;
53
54
  app = posTerminalId ? { apiUrl: apiUrl, posTerminalId: posTerminalId } : { apiUrl: apiUrl };
54
55
  api = new services_1.PosAPI(app);
55
- return [4 /*yield*/, Promise.all([
56
- api.getKioskConfig(),
57
- api.getSettings('DEVICES'),
58
- api.getSettings('STORE')
59
- ])];
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)];
60
65
  case 1:
61
- _e = _h.sent(), kiosk = _e[0], _f = _e[1], devicesList = _f === void 0 ? [] : _f, _g = _e[2], stores = _g === void 0 ? [] : _g;
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];
62
67
  store = stores[0] || null;
63
68
  devices = devicesList[0] || null;
64
69
  if (!kiosk || !store || !devices) {
@@ -83,7 +88,8 @@ exports.fetchKioskConfig = (0, toolkit_1.createAsyncThunk)(KioskActionType.Fetch
83
88
  settings: displaySettings,
84
89
  store: store,
85
90
  styles: null,
86
- theme: theme
91
+ theme: theme,
92
+ paymentConfigs: paymentConfigs
87
93
  }];
88
94
  case 2:
89
95
  err_1 = _h.sent();
@@ -141,7 +147,7 @@ var kioskSlice = (0, toolkit_1.createSlice)({
141
147
  extraReducers: function (builder) {
142
148
  builder
143
149
  .addCase(exports.fetchKioskConfig.fulfilled, function (state, action) {
144
- 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;
150
+ 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, paymentConfigs = _a.paymentConfigs;
145
151
  state.app = app;
146
152
  state.brand = brand;
147
153
  state.config = config;
@@ -155,6 +161,7 @@ var kioskSlice = (0, toolkit_1.createSlice)({
155
161
  state.store = store;
156
162
  state.styles = styles;
157
163
  state.theme = theme;
164
+ state.paymentConfigs = paymentConfigs;
158
165
  })
159
166
  .addCase(exports.fetchKioskConfig.pending, function (state) {
160
167
  state.loading = 'pending';
@@ -19,6 +19,22 @@ export interface KioskState {
19
19
  styles: KioskStyles | null;
20
20
  theme: AppTheme | null;
21
21
  version?: string | null;
22
+ paymentConfigs: {
23
+ integration: string;
24
+ is_testing: boolean;
25
+ merchant_api_key: string;
26
+ merchant_id: string;
27
+ merchant_password: string;
28
+ merchant_username: string;
29
+ offline_limit: string;
30
+ saved_cards: boolean;
31
+ signature_threshold: string | null;
32
+ freedompay_store_id: string;
33
+ card_stor_service_url: string;
34
+ client_selling_system: string;
35
+ client_selling_system_version: string;
36
+ freedompay_terminal_id: string;
37
+ } | null;
22
38
  }
23
39
  export declare enum KioskActionType {
24
40
  FetchKiosk = "kiosk/getKiosk",
@@ -5,8 +5,8 @@ import { PosAPI } from '../services';
5
5
  import { errorsApi } from '../services/errors';
6
6
  import { setApi } from './config';
7
7
  import { setRevenueCenterId } from './order';
8
- import { ReducerType } from './types';
9
8
  import { fetchRevenueCenter } from './revenueCenter';
9
+ import { ReducerType } from './types';
10
10
  var initialState = {
11
11
  app: null,
12
12
  brand: null,
@@ -21,7 +21,8 @@ var initialState = {
21
21
  retries: 0,
22
22
  settings: null,
23
23
  theme: null,
24
- version: null
24
+ version: null,
25
+ paymentConfigs: null
25
26
  };
26
27
  export var KioskActionType;
27
28
  (function (KioskActionType) {
@@ -39,7 +40,7 @@ var getError = function (kiosk, store, devices) {
39
40
  : errorsApi.internalServerError;
40
41
  };
41
42
  export var fetchKioskConfig = createAsyncThunk(KioskActionType.FetchKiosk, function (_a, _b) { return __awaiter(void 0, [_a, _b], void 0, function (_c, _d) {
42
- var posTerminalId, app, api, _e, kiosk, _f, devicesList, _g, stores, 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;
43
44
  var apiUrl = _c.apiUrl;
44
45
  var dispatch = _d.dispatch, getState = _d.getState, rejectWithValue = _d.rejectWithValue;
45
46
  return __generator(this, function (_h) {
@@ -49,13 +50,17 @@ export var fetchKioskConfig = createAsyncThunk(KioskActionType.FetchKiosk, funct
49
50
  posTerminalId = getState().pos.terminalId;
50
51
  app = posTerminalId ? { apiUrl: apiUrl, posTerminalId: posTerminalId } : { apiUrl: apiUrl };
51
52
  api = new PosAPI(app);
52
- return [4 /*yield*/, Promise.all([
53
- api.getKioskConfig(),
54
- api.getSettings('DEVICES'),
55
- api.getSettings('STORE')
56
- ])];
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)];
57
62
  case 1:
58
- _e = _h.sent(), kiosk = _e[0], _f = _e[1], devicesList = _f === void 0 ? [] : _f, _g = _e[2], stores = _g === void 0 ? [] : _g;
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];
59
64
  store = stores[0] || null;
60
65
  devices = devicesList[0] || null;
61
66
  if (!kiosk || !store || !devices) {
@@ -80,7 +85,8 @@ export var fetchKioskConfig = createAsyncThunk(KioskActionType.FetchKiosk, funct
80
85
  settings: displaySettings,
81
86
  store: store,
82
87
  styles: null,
83
- theme: theme
88
+ theme: theme,
89
+ paymentConfigs: paymentConfigs
84
90
  }];
85
91
  case 2:
86
92
  err_1 = _h.sent();
@@ -138,7 +144,7 @@ var kioskSlice = createSlice({
138
144
  extraReducers: function (builder) {
139
145
  builder
140
146
  .addCase(fetchKioskConfig.fulfilled, function (state, action) {
141
- 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;
147
+ 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, paymentConfigs = _a.paymentConfigs;
142
148
  state.app = app;
143
149
  state.brand = brand;
144
150
  state.config = config;
@@ -152,6 +158,7 @@ var kioskSlice = createSlice({
152
158
  state.store = store;
153
159
  state.styles = styles;
154
160
  state.theme = theme;
161
+ state.paymentConfigs = paymentConfigs;
155
162
  })
156
163
  .addCase(fetchKioskConfig.pending, function (state) {
157
164
  state.loading = 'pending';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/store",
3
- "version": "0.1.303",
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",