@open-tender/store 0.1.304 → 0.1.306

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,6 +1,6 @@
1
1
  import { HeaderProps, SignInButtonProps, TagsButtonProps, CartButtonProps, CancelButtonProps, ScreenConfig, Handlers } from '@open-tender/ui';
2
2
  import React, { ReactNode } from 'react';
3
- declare const Header: ({ to, backText, showImage, backAction, pathname, navigate, children, SignInButtonView, TagsButtonView, CartButton, CancelButton, AccessibilityButton, startOverCallback }: {
3
+ declare const Header: ({ to, backText, showImage, backAction, pathname, navigate, children, SignInButtonView, TagsButtonView, CartButton, CancelButton, AccessibilityButton, startOverCallback, BackButton }: {
4
4
  to?: string;
5
5
  backText?: string;
6
6
  showImage?: boolean;
@@ -13,6 +13,7 @@ declare const Header: ({ to, backText, showImage, backAction, pathname, navigate
13
13
  renderCartButton?: () => ReactNode;
14
14
  renderCancelButton?: () => ReactNode;
15
15
  renderAccessibilityButton?: () => ReactNode;
16
+ BackButton?: () => ReactNode;
16
17
  }) => ReactNode;
17
18
  SignInButtonView: (props: SignInButtonProps) => ReactNode;
18
19
  TagsButtonView?: (props: TagsButtonProps) => ReactNode;
@@ -23,5 +24,6 @@ declare const Header: ({ to, backText, showImage, backAction, pathname, navigate
23
24
  isAccessibilityOn?: boolean;
24
25
  handlers: Handlers;
25
26
  }) => ReactNode;
27
+ BackButton?: () => ReactNode;
26
28
  }) => React.ReactNode;
27
29
  export default Header;
@@ -10,7 +10,7 @@ var CartButton_1 = tslib_1.__importDefault(require("./CartButton"));
10
10
  var SignInButton_1 = tslib_1.__importDefault(require("./SignInButton"));
11
11
  var TagsButton_1 = tslib_1.__importDefault(require("./TagsButton"));
12
12
  var Header = function (_a) {
13
- var to = _a.to, _b = _a.backText, backText = _b === void 0 ? 'Back' : _b, _c = _a.showImage, showImage = _c === void 0 ? true : _c, backAction = _a.backAction, pathname = _a.pathname, navigate = _a.navigate, children = _a.children, SignInButtonView = _a.SignInButtonView, TagsButtonView = _a.TagsButtonView, CartButton = _a.CartButton, CancelButton = _a.CancelButton, AccessibilityButton = _a.AccessibilityButton, startOverCallback = _a.startOverCallback;
13
+ var to = _a.to, _b = _a.backText, backText = _b === void 0 ? 'Back' : _b, _c = _a.showImage, showImage = _c === void 0 ? true : _c, backAction = _a.backAction, pathname = _a.pathname, navigate = _a.navigate, children = _a.children, SignInButtonView = _a.SignInButtonView, TagsButtonView = _a.TagsButtonView, CartButton = _a.CartButton, CancelButton = _a.CancelButton, AccessibilityButton = _a.AccessibilityButton, startOverCallback = _a.startOverCallback, BackButton = _a.BackButton;
14
14
  var dispatch = (0, hooks_1.useAppDispatch)();
15
15
  var config = ((0, hooks_1.useAppSelector)(slices_1.selectKioskConfig) || {}).header;
16
16
  var showButtons = !!(backAction || to);
@@ -60,7 +60,8 @@ var Header = function (_a) {
60
60
  renderCancelButton: CancelButton ? renderCancelButton : undefined,
61
61
  renderAccessibilityButton: AccessibilityButton
62
62
  ? renderAccessibilityButton
63
- : undefined
63
+ : undefined,
64
+ BackButton: BackButton
64
65
  });
65
66
  };
66
67
  exports.default = Header;
@@ -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;
@@ -1,6 +1,6 @@
1
1
  import { HeaderProps, SignInButtonProps, TagsButtonProps, CartButtonProps, CancelButtonProps, ScreenConfig, Handlers } from '@open-tender/ui';
2
2
  import React, { ReactNode } from 'react';
3
- declare const Header: ({ to, backText, showImage, backAction, pathname, navigate, children, SignInButtonView, TagsButtonView, CartButton, CancelButton, AccessibilityButton, startOverCallback }: {
3
+ declare const Header: ({ to, backText, showImage, backAction, pathname, navigate, children, SignInButtonView, TagsButtonView, CartButton, CancelButton, AccessibilityButton, startOverCallback, BackButton }: {
4
4
  to?: string;
5
5
  backText?: string;
6
6
  showImage?: boolean;
@@ -13,6 +13,7 @@ declare const Header: ({ to, backText, showImage, backAction, pathname, navigate
13
13
  renderCartButton?: () => ReactNode;
14
14
  renderCancelButton?: () => ReactNode;
15
15
  renderAccessibilityButton?: () => ReactNode;
16
+ BackButton?: () => ReactNode;
16
17
  }) => ReactNode;
17
18
  SignInButtonView: (props: SignInButtonProps) => ReactNode;
18
19
  TagsButtonView?: (props: TagsButtonProps) => ReactNode;
@@ -23,5 +24,6 @@ declare const Header: ({ to, backText, showImage, backAction, pathname, navigate
23
24
  isAccessibilityOn?: boolean;
24
25
  handlers: Handlers;
25
26
  }) => ReactNode;
27
+ BackButton?: () => ReactNode;
26
28
  }) => React.ReactNode;
27
29
  export default Header;
@@ -7,7 +7,7 @@ import { default as CartButtonContainer } from './CartButton';
7
7
  import { default as SignInButtonContainer } from './SignInButton';
8
8
  import { default as TagsButtonContainer } from './TagsButton';
9
9
  var Header = function (_a) {
10
- var to = _a.to, _b = _a.backText, backText = _b === void 0 ? 'Back' : _b, _c = _a.showImage, showImage = _c === void 0 ? true : _c, backAction = _a.backAction, pathname = _a.pathname, navigate = _a.navigate, children = _a.children, SignInButtonView = _a.SignInButtonView, TagsButtonView = _a.TagsButtonView, CartButton = _a.CartButton, CancelButton = _a.CancelButton, AccessibilityButton = _a.AccessibilityButton, startOverCallback = _a.startOverCallback;
10
+ var to = _a.to, _b = _a.backText, backText = _b === void 0 ? 'Back' : _b, _c = _a.showImage, showImage = _c === void 0 ? true : _c, backAction = _a.backAction, pathname = _a.pathname, navigate = _a.navigate, children = _a.children, SignInButtonView = _a.SignInButtonView, TagsButtonView = _a.TagsButtonView, CartButton = _a.CartButton, CancelButton = _a.CancelButton, AccessibilityButton = _a.AccessibilityButton, startOverCallback = _a.startOverCallback, BackButton = _a.BackButton;
11
11
  var dispatch = useAppDispatch();
12
12
  var config = (useAppSelector(selectKioskConfig) || {}).header;
13
13
  var showButtons = !!(backAction || to);
@@ -57,7 +57,8 @@ var Header = function (_a) {
57
57
  renderCancelButton: CancelButton ? renderCancelButton : undefined,
58
58
  renderAccessibilityButton: AccessibilityButton
59
59
  ? renderAccessibilityButton
60
- : undefined
60
+ : undefined,
61
+ BackButton: BackButton
61
62
  });
62
63
  };
63
64
  export default Header;
@@ -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.306",
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",