@tap-payments/auth-jsconnect 2.11.0-development → 2.11.0

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.
Files changed (105) hide show
  1. package/build/@types/form.d.ts +2 -2
  2. package/build/@types/terminal.d.ts +32 -44
  3. package/build/api/account.d.ts +2 -2
  4. package/build/api/account.js +7 -4
  5. package/build/api/auth.d.ts +8 -2
  6. package/build/api/auth.js +7 -3
  7. package/build/api/axios.d.ts +1 -1
  8. package/build/api/headers.d.ts +5 -0
  9. package/build/api/headers.js +3 -0
  10. package/build/api/index.d.ts +6 -6
  11. package/build/api/operator.d.ts +1 -1
  12. package/build/api/operator.js +5 -2
  13. package/build/api/terminal.d.ts +3 -6
  14. package/build/api/terminal.js +22 -12
  15. package/build/assets/currencies/AEDSymbol.js +1 -1
  16. package/build/assets/currencies/SARSymbol.js +1 -1
  17. package/build/assets/locales/ar.json +5 -0
  18. package/build/assets/locales/en.json +8 -2
  19. package/build/components/DeviceCard/DeviceCard.d.ts +3 -2
  20. package/build/components/DeviceCard/DeviceCard.js +9 -10
  21. package/build/components/Tooltip/Tooltip.js +1 -1
  22. package/build/components/TruncatedTooltipText/TruncatedTooltipText.d.ts +7 -0
  23. package/build/components/TruncatedTooltipText/TruncatedTooltipText.js +33 -0
  24. package/build/components/TruncatedTooltipText/index.d.ts +2 -0
  25. package/build/components/TruncatedTooltipText/index.js +2 -0
  26. package/build/constants/api.d.ts +2 -0
  27. package/build/constants/api.js +4 -0
  28. package/build/constants/app.d.ts +4 -2
  29. package/build/constants/app.js +137 -38
  30. package/build/constants/flows.d.ts +2 -1
  31. package/build/constants/flows.js +2 -1
  32. package/build/features/app/auth/authStore.js +64 -54
  33. package/build/features/app/bank/bankStore.js +24 -20
  34. package/build/features/app/board/boardStore.js +11 -7
  35. package/build/features/app/brand/brandStore.js +22 -18
  36. package/build/features/app/business/businessStore.js +30 -26
  37. package/build/features/app/connect/connectStore.d.ts +6 -5
  38. package/build/features/app/connect/connectStore.js +48 -31
  39. package/build/features/app/connectExpress/connectExpressStore.d.ts +6 -5
  40. package/build/features/app/connectExpress/connectExpressStore.js +42 -16
  41. package/build/features/app/entity/entityStore.js +21 -17
  42. package/build/features/app/individual/individualStore.js +34 -28
  43. package/build/features/app/password/passwordStore.js +44 -46
  44. package/build/features/app/signIn/signInStore.js +12 -16
  45. package/build/features/app/tax/taxStore.js +20 -16
  46. package/build/features/app/terminal/terminalStore.d.ts +7 -7
  47. package/build/features/app/terminal/terminalStore.js +89 -62
  48. package/build/features/auth/Auth.d.ts +1 -1
  49. package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +10 -7
  50. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
  51. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +6 -4
  52. package/build/features/auth/screens/AuthenticationList/EntityList.js +9 -1
  53. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +1 -1
  54. package/build/features/business/screens/BusinessType/BusinessType.js +2 -3
  55. package/build/features/business/screens/BusinessType/LicenseList.js +5 -5
  56. package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
  57. package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +10 -10
  58. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
  59. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +6 -4
  60. package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +9 -1
  61. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +6 -11
  62. package/build/features/connectExpress/screens/Mobile/Mobile.js +7 -6
  63. package/build/features/entity/screens/EntityName/EntityName.js +14 -14
  64. package/build/features/entity/screens/EntityName/validation.d.ts +47 -45
  65. package/build/features/entity/screens/EntityName/validation.js +99 -95
  66. package/build/features/featuresScreens.js +63 -3
  67. package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.js +9 -0
  68. package/build/features/shared/OTPVerifySecurityError/index.d.ts +2 -0
  69. package/build/features/shared/OTPVerifySecurityError/index.js +2 -0
  70. package/build/features/terminal/Terminal.js +2 -2
  71. package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +8 -9
  72. package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +5 -6
  73. package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +9 -9
  74. package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +59 -14
  75. package/build/features/terminal/screens/POSDeviceListPage/POSDeviceListPage.d.ts +3 -0
  76. package/build/features/terminal/screens/{TerminalListPage/TerminalListPage.js → POSDeviceListPage/POSDeviceListPage.js} +13 -10
  77. package/build/features/terminal/screens/POSDeviceListPage/index.d.ts +2 -0
  78. package/build/features/terminal/screens/POSDeviceListPage/index.js +2 -0
  79. package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  80. package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +3 -3
  81. package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +2 -2
  82. package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +15 -15
  83. package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +5 -7
  84. package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +12 -11
  85. package/build/features/terminal/screens/Verify/Verify.js +6 -2
  86. package/build/features/terminal/screens/shared/POSDeviceList.d.ts +11 -0
  87. package/build/features/terminal/screens/shared/POSDeviceList.js +30 -0
  88. package/build/features/terminal/screens/shared/index.d.ts +2 -2
  89. package/build/features/terminal/screens/shared/index.js +2 -2
  90. package/build/features/terminal/screens/shared/styles.d.ts +1 -1
  91. package/build/features/terminal/screens/shared/styles.js +1 -1
  92. package/build/features/terminal/screens/shared/utils.d.ts +4 -4
  93. package/build/features/terminal/screens/shared/utils.js +9 -9
  94. package/build/utils/common.js +13 -6
  95. package/build/utils/error.d.ts +3 -0
  96. package/build/utils/error.js +9 -0
  97. package/build/utils/string.d.ts +1 -0
  98. package/build/utils/string.js +1 -0
  99. package/build/utils/validation.js +1 -1
  100. package/package.json +3 -3
  101. package/build/features/terminal/screens/TerminalListPage/index.d.ts +0 -2
  102. package/build/features/terminal/screens/TerminalListPage/index.js +0 -2
  103. package/build/features/terminal/screens/shared/TerminalList.d.ts +0 -11
  104. package/build/features/terminal/screens/shared/TerminalList.js +0 -25
  105. /package/build/features/{terminal/screens/TerminalListPage/TerminalListPage.d.ts → shared/OTPVerifySecurityError/OTPVerifySecurityError.d.ts} +0 -0
@@ -9,32 +9,77 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
12
48
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
49
  import * as React from 'react';
14
50
  import { useTranslation } from 'react-i18next';
15
51
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
16
52
  import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
17
- import Button from '../../../../components/Button';
18
- import Loader from '../../../../components/Loader';
19
53
  import { ICONS_NAMES } from '../../../../constants';
20
54
  import { ScreenContainer } from '../../../shared/Containers';
21
- import { linkNewTerminal, retrieveBoardDetails, retrieveBoardStatus, terminalSelector } from '../../../app/terminal/terminalStore';
55
+ import { retrieveBoardDetails, retrieveBoardStatus, retrievePOSDevices, terminalSelector } from '../../../app/terminal/terminalStore';
22
56
  import { DescriptionTypography, DeviceImage, NoTerminalDeviceLinkedContainer, TitleTypography } from './styles';
57
+ import Button from '../../../../features/shared/Button';
23
58
  var NoTerminalDeviceLinked = function () {
24
59
  var t = useTranslation().t;
25
60
  var isAr = useLanguage().isAr;
26
61
  var dispatch = useAppDispatch();
27
- var _a = useAppSelector(terminalSelector), loading = _a.loading, data = _a.data;
62
+ var _a = useAppSelector(terminalSelector), posDevicesLoading = _a.posDevicesLoading, data = _a.data, loading = _a.loading, error = _a.error;
28
63
  var _b = data.responseData || {}, boardFlows = _b.boardFlows, authData = _b.authData, boardData = _b.boardData;
29
- var handleOnClickNewTerminalLink = function () {
30
- dispatch(linkNewTerminal())
31
- .unwrap()
32
- .then(function (_a) {
33
- var nextScreen = _a.nextScreen;
34
- dispatch(handleNextScreenStep(nextScreen));
35
- })
36
- .catch(function () { });
37
- };
64
+ var handleOnClickNewTerminalLink = function () { return __awaiter(void 0, void 0, void 0, function () {
65
+ var err_1;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ _a.trys.push([0, 2, , 3]);
70
+ return [4, dispatch(retrievePOSDevices()).unwrap()];
71
+ case 1:
72
+ _a.sent();
73
+ dispatch(handleNextScreenStep());
74
+ return [3, 3];
75
+ case 2:
76
+ err_1 = _a.sent();
77
+ console.log('Error while retrieving pos devices list error', err_1);
78
+ return [3, 3];
79
+ case 3: return [2];
80
+ }
81
+ });
82
+ }); };
38
83
  var handleOnBack = function () {
39
84
  if ((boardFlows === null || boardFlows === void 0 ? void 0 : boardFlows.length) > 0) {
40
85
  dispatch(handlePrevScreenStep());
@@ -53,6 +98,6 @@ var NoTerminalDeviceLinked = function () {
53
98
  })
54
99
  .catch(function () { });
55
100
  };
56
- return (_jsxs(ScreenContainer, __assign({ sx: { ml: 2.5, mr: 2.5 }, minHeight: 280, justifyContent: 'space-between' }, { children: [_jsxs(NoTerminalDeviceLinkedContainer, { children: [_jsx(DeviceImage, { src: ICONS_NAMES.terminal_device }), _jsx(TitleTypography, { children: t('terminal_no_terminal_linked') }), _jsx(DescriptionTypography, { children: t('terminal_no_terminal_linked_description') })] }), _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') }))] })));
101
+ return (_jsxs(ScreenContainer, __assign({ sx: { ml: 2.5, mr: 2.5 }, minHeight: 280, justifyContent: 'space-between' }, { children: [_jsxs(NoTerminalDeviceLinkedContainer, { children: [_jsx(DeviceImage, { src: ICONS_NAMES.terminal_device }), _jsx(TitleTypography, { children: t('terminal_no_terminal_linked') }), _jsx(DescriptionTypography, { children: t('terminal_no_terminal_linked_description') })] }), _jsx(Button, __assign({ error: error !== null && error !== void 0 ? error : '', sx: { mt: 0, ml: 0, mr: 0 }, loading: posDevicesLoading || loading, onBackClicked: handleOnBack, onClick: handleOnClickNewTerminalLink, isAr: isAr }, { children: t('terminal_link_terminal') }))] })));
57
102
  };
58
103
  export default React.memo(NoTerminalDeviceLinked);
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
3
+ export default _default;
@@ -18,19 +18,20 @@ import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/sett
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
19
  import Button from '../../../../components/Button';
20
20
  import Warning from '../../../../components/Warning';
21
- import { clearError, linkNewTerminal, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
22
- import { Header, Container, TerminalList } from '../shared';
23
- var TerminalListPage = function () {
21
+ import { CONNECT_FLOWS } from '../../../../constants';
22
+ import { clearError, linkNewTerminal, storeSelectedPOS, terminalSelector } from '../../../app/terminal/terminalStore';
23
+ import { Header, Container, POSDeviceList } from '../shared';
24
+ var POSDeviceListPage = function () {
24
25
  var t = useTranslation().t;
25
26
  var dispatch = useAppDispatch();
26
- var _a = useAppSelector(terminalSelector), _b = _a.data, selectedTerminal = _b.terminalInfo.selectedTerminal, responseData = _b.responseData, loading = _a.loading, error = _a.error;
27
- var terminalList = (responseData || {}).terminalList;
27
+ var _a = useAppSelector(terminalSelector), _b = _a.data, selectedPOS = _b.terminalInfo.selectedPOS, responseData = _b.responseData, loading = _a.loading, error = _a.error;
28
+ var _c = responseData || {}, posDevices = _c.posDevices, terminalData = _c.terminalData;
28
29
  React.useEffect(function () {
29
30
  if (error)
30
31
  dispatch(clearError());
31
32
  }, []);
32
- var handleOnSelectTerminal = function (terminal) {
33
- dispatch(storeSelectedTerminal(terminal));
33
+ var handleOnSelectPOS = function (pos) {
34
+ dispatch(storeSelectedPOS(pos));
34
35
  dispatch(linkNewTerminal())
35
36
  .unwrap()
36
37
  .then(function (_a) {
@@ -40,8 +41,10 @@ var TerminalListPage = function () {
40
41
  .catch(function () { });
41
42
  };
42
43
  var handleOnBack = function () {
43
- dispatch(handlePrevScreenStep());
44
+ var _a;
45
+ var screen = ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _a === void 0 ? void 0 : _a.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked;
46
+ dispatch(handlePrevScreenStep(screen));
44
47
  };
45
- return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(Header, { title: 'terminal_select_device', sx: { pb: 0 } }), _jsx(TerminalList, { select: false, loading: loading, selectedTerminal: selectedTerminal, list: terminalList, onClick: handleOnSelectTerminal })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Box, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: t('back') })) }))] })));
48
+ return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(Header, { title: 'terminal_select_device', sx: { pb: 0 } }), _jsx(POSDeviceList, { select: false, loading: loading, selectedPOS: selectedPOS, posDevices: posDevices, onClick: handleOnSelectPOS })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Box, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: t('back') })) }))] })));
46
49
  };
47
- export default React.memo(TerminalListPage);
50
+ export default React.memo(POSDeviceListPage);
@@ -0,0 +1,2 @@
1
+ import TerminalListPage from './POSDeviceListPage';
2
+ export default TerminalListPage;
@@ -0,0 +1,2 @@
1
+ import TerminalListPage from './POSDeviceListPage';
2
+ export default TerminalListPage;
@@ -27,6 +27,6 @@ var SuccessWithFlowButtons = function () {
27
27
  var onClose = function () {
28
28
  dispatch(onCloseCompleteTerminal());
29
29
  };
30
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: boardFlows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient, status: board_status, terminalStepName: ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.terminal_devices) === null || _a === void 0 ? void 0 : _a.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked }));
30
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: boardFlows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient, status: board_status, terminalStepName: ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _a === void 0 ? void 0 : _a.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked }));
31
31
  };
32
32
  export default memo(SuccessWithFlowButtons);
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { TerminalDeviceInfo } from '../../../../@types';
2
+ import { TerminalInfo } from '../../../../@types';
3
3
  interface DeviceListProps {
4
- devices: TerminalDeviceInfo[];
4
+ devices: TerminalInfo[];
5
5
  loading?: boolean;
6
- onClick: (device: TerminalDeviceInfo) => void;
6
+ onClick: (device: TerminalInfo) => void;
7
7
  }
8
8
  declare const _default: React.MemoExoticComponent<({ devices, onClick, loading }: DeviceListProps) => JSX.Element>;
9
9
  export default _default;
@@ -13,8 +13,8 @@ var DeviceList = function (_a) {
13
13
  onClick(device);
14
14
  };
15
15
  return (_jsx(DeviceListContainer, { children: devices.map(function (device, index) {
16
- var _a;
17
- return (_jsx(DeviceCard, { onClick: function () { return handleOnClick(device); }, loading: device.id === (selected === null || selected === void 0 ? void 0 : selected.id) && loading, image: (_a = device.model.image_url) !== null && _a !== void 0 ? _a : defaultImage, name: device.display_name, deviceId: getId(device), pairedWith: getPairedWith(device), deviceIdLabel: getIdLabel(device), isLinked: device.linked, arrow: true, badge: true }, index));
16
+ var _a, _b, _c, _d, _e;
17
+ return (_jsx(DeviceCard, { onClick: function () { return handleOnClick(device); }, loading: device.id === (selected === null || selected === void 0 ? void 0 : selected.id) && loading, image: (_c = (_b = (_a = device.terminal_device) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.image_url) !== null && _c !== void 0 ? _c : defaultImage, name: (_e = (_d = device.terminal_device) === null || _d === void 0 ? void 0 : _d.display_name) !== null && _e !== void 0 ? _e : '', deviceId: getId(device), pairedWith: getPairedWith(device), deviceIdLabel: getIdLabel(device), isLinked: device.linked, arrow: true, badge: true }, index));
18
18
  }) }));
19
19
  };
20
20
  export default memo(DeviceList);
@@ -56,27 +56,27 @@ import Button from '../../../../components/Button';
56
56
  import Loader from '../../../../components/Loader';
57
57
  import Warning from '../../../../components/Warning';
58
58
  import Box from '@mui/material/Box';
59
- import { clearError, resetTerminalLinkResponse, retrieveBoardDetails, retrieveBoardStatus, retrieveTerminalList, storeSelectedTerminalDevice, terminalSelector } from '../../../app/terminal/terminalStore';
59
+ import { clearError, resetTerminalLinkResponse, retrieveBoardDetails, retrieveBoardStatus, retrievePOSDevices, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
60
60
  import { Header, Container, TextTypography } from '../shared';
61
61
  import DeviceList from './DeviceList';
62
62
  var TerminalDeviceList = function () {
63
63
  var t = useTranslation().t;
64
64
  var dispatch = useAppDispatch();
65
- var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading, terminalListLoading = _a.terminalListLoading, error = _a.error;
65
+ var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading, posDevicesLoading = _a.posDevicesLoading, error = _a.error;
66
66
  var _b = React.useState(false), newLinkClicked = _b[0], setNewLinkClicked = _b[1];
67
- var _c = data.responseData || {}, boardFlows = _c.boardFlows, authData = _c.authData, boardData = _c.boardData, terminalData = _c.terminalData, terminalList = _c.terminalList;
68
- var terminal_devices = (terminalData || {}).terminal_devices;
67
+ var _c = data.responseData || {}, boardFlows = _c.boardFlows, authData = _c.authData, boardData = _c.boardData, terminalData = _c.terminalData, posDevices = _c.posDevices;
68
+ var list = (terminalData || {}).list;
69
69
  var _d = React.useMemo(function () {
70
- var linked = terminal_devices === null || terminal_devices === void 0 ? void 0 : terminal_devices.filter(function (d) { return d.linked; });
71
- var unLinked = terminal_devices === null || terminal_devices === void 0 ? void 0 : terminal_devices.filter(function (d) { return !d.linked; });
70
+ var linked = list === null || list === void 0 ? void 0 : list.filter(function (d) { return d.linked; });
71
+ var unLinked = list === null || list === void 0 ? void 0 : list.filter(function (d) { return !d.linked; });
72
72
  return { linkedDevices: linked, unLinkedDevices: unLinked };
73
- }, [terminal_devices]), linkedDevices = _d.linkedDevices, unLinkedDevices = _d.unLinkedDevices;
73
+ }, [list]), linkedDevices = _d.linkedDevices, unLinkedDevices = _d.unLinkedDevices;
74
74
  var handleOnClickNewTerminalLink = function () { return __awaiter(void 0, void 0, void 0, function () {
75
75
  return __generator(this, function (_a) {
76
76
  switch (_a.label) {
77
77
  case 0:
78
78
  setNewLinkClicked(true);
79
- return [4, retrieveTerminalListAsync(CONNECT_FLOWS.terminal.terminalList)];
79
+ return [4, retrievePOSDevicesAsync(CONNECT_FLOWS.terminal.posDeviceList)];
80
80
  case 1:
81
81
  _a.sent();
82
82
  return [2];
@@ -88,19 +88,19 @@ var TerminalDeviceList = function () {
88
88
  dispatch(clearError());
89
89
  dispatch(resetTerminalLinkResponse());
90
90
  }, []);
91
- var retrieveTerminalListAsync = function (nextScreen) { return __awaiter(void 0, void 0, void 0, function () {
91
+ var retrievePOSDevicesAsync = function (nextScreen) { return __awaiter(void 0, void 0, void 0, function () {
92
92
  var err_1;
93
93
  return __generator(this, function (_a) {
94
94
  switch (_a.label) {
95
95
  case 0:
96
- if (terminalList === null || terminalList === void 0 ? void 0 : terminalList.length) {
96
+ if (posDevices === null || posDevices === void 0 ? void 0 : posDevices.length) {
97
97
  dispatch(handleNextScreenStep(nextScreen));
98
98
  return [2];
99
99
  }
100
100
  _a.label = 1;
101
101
  case 1:
102
102
  _a.trys.push([1, 3, , 4]);
103
- return [4, dispatch(retrieveTerminalList()).unwrap()];
103
+ return [4, dispatch(retrievePOSDevices()).unwrap()];
104
104
  case 2:
105
105
  _a.sent();
106
106
  dispatch(handleNextScreenStep(nextScreen));
@@ -114,7 +114,7 @@ var TerminalDeviceList = function () {
114
114
  });
115
115
  }); };
116
116
  var handleOnClickLinkedTerminal = function (terminal) {
117
- dispatch(storeSelectedTerminalDevice(terminal));
117
+ dispatch(storeSelectedTerminal(terminal));
118
118
  dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.linkedTerminalInfo));
119
119
  };
120
120
  var handleOnClickUnlinkedTerminal = function (terminal) { return __awaiter(void 0, void 0, void 0, function () {
@@ -122,8 +122,8 @@ var TerminalDeviceList = function () {
122
122
  switch (_a.label) {
123
123
  case 0:
124
124
  setNewLinkClicked(false);
125
- dispatch(storeSelectedTerminalDevice(terminal));
126
- return [4, retrieveTerminalListAsync(CONNECT_FLOWS.terminal.unlinkedTerminalInfo)];
125
+ dispatch(storeSelectedTerminal(terminal));
126
+ return [4, retrievePOSDevicesAsync(CONNECT_FLOWS.terminal.unlinkedTerminalInfo)];
127
127
  case 1:
128
128
  _a.sent();
129
129
  return [2];
@@ -148,6 +148,6 @@ var TerminalDeviceList = function () {
148
148
  })
149
149
  .catch(function () { });
150
150
  };
151
- return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(Header, { onLinkClick: handleOnClickNewTerminalLink, loading: terminalListLoading && newLinkClicked }), _jsx(DeviceList, { devices: linkedDevices, onClick: handleOnClickLinkedTerminal }), !!(unLinkedDevices === null || unLinkedDevices === void 0 ? void 0 : unLinkedDevices.length) && !!(linkedDevices === null || linkedDevices === void 0 ? void 0 : linkedDevices.length) && _jsx(TextTypography, __assign({ sx: { pt: 1, pb: 1 } }, { children: t('terminal_unlinked') })), _jsx(DeviceList, { loading: terminalListLoading && !newLinkClicked, devices: unLinkedDevices, onClick: handleOnClickUnlinkedTerminal })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Box, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') })) }))] })));
151
+ return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(Header, { onLinkClick: handleOnClickNewTerminalLink, loading: posDevicesLoading && newLinkClicked }), _jsx(DeviceList, { devices: linkedDevices, onClick: handleOnClickLinkedTerminal }), !!(unLinkedDevices === null || unLinkedDevices === void 0 ? void 0 : unLinkedDevices.length) && !!(linkedDevices === null || linkedDevices === void 0 ? void 0 : linkedDevices.length) && _jsx(TextTypography, __assign({ sx: { pt: 1, pb: 1 } }, { children: t('terminal_unlinked') })), _jsx(DeviceList, { loading: posDevicesLoading && !newLinkClicked, devices: unLinkedDevices, onClick: handleOnClickUnlinkedTerminal })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Box, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') })) }))] })));
152
152
  };
153
153
  export default React.memo(TerminalDeviceList);
@@ -16,23 +16,21 @@ import Box from '@mui/material/Box';
16
16
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
17
17
  import { CONNECT_FLOWS } from '../../../../constants';
18
18
  import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
19
- import { retrieveBoardDetails, retrieveBoardStatus, retrieveTerminalDeviceList, terminalSelector } from '../../../app/terminal/terminalStore';
19
+ import { retrieveBoardDetails, retrieveBoardStatus, retrieveTerminalList, terminalSelector } from '../../../app/terminal/terminalStore';
20
20
  import SuccessScreen from '../../../shared/SuccessScreen';
21
21
  import Button from '../../../shared/Button';
22
22
  import { SuccessContainerStyled } from '../shared';
23
23
  var UnlinkedSuccess = function () {
24
- var _a, _b, _c;
25
24
  var t = useTranslation().t;
26
25
  var isAr = useLanguage().isAr;
27
26
  var dispatch = useAppDispatch();
28
- var _d = useAppSelector(terminalSelector), error = _d.error, loading = _d.loading, _e = _d.data, selectedTerminalDevice = _e.terminalInfo.selectedTerminalDevice, responseData = _e.responseData;
29
- var _f = responseData || {}, boardData = _f.boardData, authData = _f.authData;
30
- var terminal = (selectedTerminalDevice || {}).terminal;
31
- var deviceName = (_b = (_a = terminal === null || terminal === void 0 ? void 0 : terminal.device) === null || _a === void 0 ? void 0 : _a.display_name) !== null && _b !== void 0 ? _b : (_c = terminal === null || terminal === void 0 ? void 0 : terminal.name) === null || _c === void 0 ? void 0 : _c.en;
27
+ var _a = useAppSelector(terminalSelector), error = _a.error, loading = _a.loading, _b = _a.data, device = _b.terminalInfo.selectedTerminal.device, responseData = _b.responseData;
28
+ var _c = responseData || {}, boardData = _c.boardData, authData = _c.authData;
29
+ var deviceName = device === null || device === void 0 ? void 0 : device.display_name;
32
30
  var handleGoToBoard = function () {
33
31
  var board_id = (boardData || {}).id;
34
32
  var _a = (authData === null || authData === void 0 ? void 0 : authData.recipient) || {}, id = _a.id, type = _a.type;
35
- dispatch(retrieveTerminalDeviceList());
33
+ dispatch(retrieveTerminalList());
36
34
  dispatch(retrieveBoardStatus({ boardId: board_id }))
37
35
  .unwrap()
38
36
  .then(function () {
@@ -21,12 +21,12 @@ import { ScreenContainer } from '../../../shared/Containers';
21
21
  import DeviceCard from '../../../../components/DeviceCard';
22
22
  import OTPTimer from '../../../../components/OTPTimer';
23
23
  import Collapse from '../../../../components/Collapse';
24
- import { clearError, linkTerminalDevice, pushNotificationLinkNewTerminal, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
24
+ import { clearError, linkTerminalDevice, pushNotificationLinkNewTerminal, storeSelectedPOS, terminalSelector } from '../../../app/terminal/terminalStore';
25
25
  import PushNotification from '../../../shared/PushNotification';
26
26
  import Button from '../../../shared/Button';
27
27
  import { Container, getId, getIdLabel, LinkWithText } from '../shared';
28
28
  import { SendRequestContainer } from './styles';
29
- import { TerminalList } from '../shared';
29
+ import { POSDeviceList } from '../shared';
30
30
  var UnlinkedTerminalInfo = function () {
31
31
  var t = useTranslation().t;
32
32
  var typography = useTheme().typography;
@@ -37,10 +37,11 @@ var UnlinkedTerminalInfo = function () {
37
37
  var _c = React.useState(false), success = _c[0], setSuccess = _c[1];
38
38
  var _d = React.useState(false), failed = _d[0], setFailed = _d[1];
39
39
  var _e = useAppSelector(terminalSelector), data = _e.data, error = _e.error;
40
- var _f = data.terminalInfo, selectedTerminalDevice = _f.selectedTerminalDevice, selectedTerminal = _f.selectedTerminal, responseData = data.responseData;
41
- var _g = responseData || {}, linkTerminalDeviceData = _g.linkTerminalDeviceData, terminalList = _g.terminalList;
42
- var model = selectedTerminalDevice.model, linked = selectedTerminalDevice.linked, display_name = selectedTerminalDevice.display_name;
43
- var _h = (model || {}).image_url, image_url = _h === void 0 ? ICONS_NAMES.device_image : _h;
40
+ var _f = data.terminalInfo, selectedTerminal = _f.selectedTerminal, selectedPOS = _f.selectedPOS, responseData = data.responseData;
41
+ var _g = responseData || {}, linkTerminalDeviceData = _g.linkTerminalDeviceData, posDevices = _g.posDevices;
42
+ var terminal_device = selectedTerminal.terminal_device, linked = selectedTerminal.linked;
43
+ var _h = ((terminal_device === null || terminal_device === void 0 ? void 0 : terminal_device.model) || {}).image_url, image_url = _h === void 0 ? ICONS_NAMES.device_image : _h;
44
+ var displayName = (terminal_device === null || terminal_device === void 0 ? void 0 : terminal_device.display_name) || '';
44
45
  var expiry = TERMINAL_PUSH_NOTIFICATION_DURATION;
45
46
  var newTerminal = false;
46
47
  React.useEffect(function () {
@@ -66,7 +67,7 @@ var UnlinkedTerminalInfo = function () {
66
67
  }, [isReady]);
67
68
  var getRequestSendDescription = function () {
68
69
  if (error)
69
- return t('terminal_request_denied', { device: display_name });
70
+ return t('terminal_request_denied', { device: displayName });
70
71
  if (isRequestSent)
71
72
  return t('terminal_new_request_will_send');
72
73
  return t('terminal_request_will_send');
@@ -80,10 +81,10 @@ var UnlinkedTerminalInfo = function () {
80
81
  dispatch(clearError());
81
82
  dispatch(handlePrevScreenStep(CONNECT_FLOWS.terminal.terminalDeviceList));
82
83
  };
83
- var handleOnSelectTerminal = function (terminal) {
84
+ var handleOnSelectPOS = function (pos) {
84
85
  if (error)
85
86
  dispatch(clearError());
86
- dispatch(storeSelectedTerminal(terminal));
87
+ dispatch(storeSelectedPOS(pos));
87
88
  };
88
89
  var handleOnResendClick = function () {
89
90
  if (isReady)
@@ -92,7 +93,7 @@ var UnlinkedTerminalInfo = function () {
92
93
  setFailed(false);
93
94
  dispatch(linkTerminalDevice());
94
95
  };
95
- var disabled = !(selectedTerminal === null || selectedTerminal === void 0 ? void 0 : selectedTerminal.id) || isRequestSent;
96
- return (_jsxs(ScreenContainer, __assign({ minHeight: 224, justifyContent: 'space-between' }, { children: [_jsx(PushNotification, __assign({ error: t('terminal_request_denied', { device: display_name }), failed: failed, success: success, expiryInSeconds: expiry }, { children: _jsxs(Container, { children: [_jsxs(Box, __assign({ sx: { ml: 2.5, mr: 2.5 } }, { children: [_jsx(LinkWithText, { children: "".concat(t('terminal_link'), " ").concat(display_name) }), _jsx(DeviceCard, { image: image_url, name: display_name, deviceId: getId(selectedTerminalDevice), deviceIdLabel: getIdLabel(selectedTerminalDevice), isLinked: linked }), _jsx(LinkWithText, { children: t('terminal_with') }), _jsx(TerminalList, { selectedTerminal: selectedTerminal, list: terminalList, onClick: handleOnSelectTerminal })] })), _jsxs(SendRequestContainer, __assign({ hasError: !!error, sx: __assign(__assign({}, typography.button_small), { fontWeight: typography.fontWeightRegular, mt: 2 }) }, { children: [getRequestSendDescription(), _jsx(Collapse, __assign({ in: isRequestSent && !error }, { children: _jsx(OTPTimer, { timeEndLabel: t('terminal_resend_request'), failed: failed, timeInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendClick }) }))] }))] }) })), _jsx(Button, __assign({ sx: { ml: 2.5, mr: 2.5, mt: 2 }, disabled: disabled, onBackClicked: handleOnBack, onClick: handleOnSendRequest, isAr: isAr }, { children: t('terminal_send_link_request') }))] })));
96
+ var disabled = !(selectedPOS === null || selectedPOS === void 0 ? void 0 : selectedPOS.id) || isRequestSent;
97
+ return (_jsxs(ScreenContainer, __assign({ minHeight: 224, justifyContent: 'space-between' }, { children: [_jsx(PushNotification, __assign({ error: t('terminal_request_denied', { device: displayName }), failed: failed, success: success, expiryInSeconds: expiry }, { children: _jsxs(Container, { children: [_jsxs(Box, __assign({ sx: { ml: 2.5, mr: 2.5 } }, { children: [_jsx(LinkWithText, { children: "".concat(t('terminal_link'), " ").concat(displayName) }), _jsx(DeviceCard, { image: image_url, name: displayName, deviceId: getId(selectedTerminal), deviceIdLabel: getIdLabel(selectedTerminal), isLinked: linked }), _jsx(LinkWithText, { children: t('terminal_with') }), _jsx(POSDeviceList, { selectedPOS: selectedPOS, posDevices: posDevices, onClick: handleOnSelectPOS })] })), _jsxs(SendRequestContainer, __assign({ hasError: !!error, sx: __assign(__assign({}, typography.button_small), { fontWeight: typography.fontWeightRegular, mt: 2 }) }, { children: [getRequestSendDescription(), _jsx(Collapse, __assign({ in: isRequestSent && !error }, { children: _jsx(OTPTimer, { timeEndLabel: t('terminal_resend_request'), failed: failed, timeInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendClick }) }))] }))] }) })), _jsx(Button, __assign({ sx: { ml: 2.5, mr: 2.5, mt: 2 }, disabled: disabled, onBackClicked: handleOnBack, onClick: handleOnSendRequest, isAr: isAr }, { children: t('terminal_send_link_request') }))] })));
97
98
  };
98
99
  export default React.memo(UnlinkedTerminalInfo);
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import Box from '@mui/material/Box/Box';
19
19
  import { styled } from '@mui/material/styles';
20
20
  import { handleNextScreenStep } from '../../../../app/settings';
21
- import { deepCopy, maskPhone } from '../../../../utils';
21
+ import { deepCopy, isAuthenticationVerificationFailed, maskPhone } from '../../../../utils';
22
22
  import Form from '../../../../components/Form';
23
23
  import Text from '../../../../components/Text';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
@@ -26,6 +26,7 @@ import { terminalSelector, clearError, resetOTPScreen, verifyTokenOTP } from '..
26
26
  import Button from '../../../shared/Button';
27
27
  import { OTPValidation } from './validation';
28
28
  import OTPInput from './OTPInput';
29
+ import { CONNECT_FLOWS } from '../../../../constants';
29
30
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
30
31
  var theme = _a.theme;
31
32
  return ({
@@ -77,7 +78,10 @@ var VerifyNumber = function (_a) {
77
78
  var nextScreen = _a.nextScreen;
78
79
  dispatch(handleNextScreenStep(nextScreen));
79
80
  })
80
- .catch(function () { });
81
+ .catch(function (err) {
82
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
83
+ dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.otpVerifySecurityError));
84
+ });
81
85
  };
82
86
  var disabled = !methods.formState.isValid || !phone || resendLoading;
83
87
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { POSInfo } from '../../../../@types';
3
+ interface POSDeviceListProps {
4
+ selectedPOS: POSInfo;
5
+ posDevices: POSInfo[];
6
+ select?: boolean;
7
+ loading?: boolean;
8
+ onClick: (pos: POSInfo) => void;
9
+ }
10
+ declare const _default: React.MemoExoticComponent<({ posDevices, onClick, selectedPOS, select, loading }: POSDeviceListProps) => JSX.Element>;
11
+ export default _default;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { ICONS_NAMES } from '../../../../constants';
5
+ import Icon from '../../../../components/Icon';
6
+ import Loader from '../../../../components/Loader';
7
+ import { ListContainer, POSListContainer, TitleContainer, Image, Title, ScrollContainer, ListItem, StyledRadio, ArrowIcon } from './styles';
8
+ import { useAppSelector } from '../../../../hooks';
9
+ import { terminalSelector } from '../../../../features/app/terminal/terminalStore';
10
+ import { useTheme } from '@mui/material/styles';
11
+ var POSDeviceList = function (_a) {
12
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
13
+ var posDevices = _a.posDevices, onClick = _a.onClick, selectedPOS = _a.selectedPOS, _m = _a.select, select = _m === void 0 ? true : _m, loading = _a.loading;
14
+ var t = useTranslation().t;
15
+ var typography = useTheme().typography;
16
+ var responseData = useAppSelector(terminalSelector).data.responseData;
17
+ var terminalData = (responseData || {}).terminalData;
18
+ var platformImage = ((_e = (_d = (_c = (_b = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.platform) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.logo) || ICONS_NAMES.platform_image;
19
+ var platformName = (_l = (_k = (_j = (_h = (_g = (_f = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.platform) === null || _h === void 0 ? void 0 : _h.brand) === null || _j === void 0 ? void 0 : _j.name) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.text;
20
+ var getEndComponent = function (pos) {
21
+ if (loading && (selectedPOS === null || selectedPOS === void 0 ? void 0 : selectedPOS.id) === (pos === null || pos === void 0 ? void 0 : pos.id))
22
+ return _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 10, style: { height: 24, width: 24 }, toggleAnimation: !!loading });
23
+ if (select)
24
+ return (_jsx(StyledRadio, { sx: { paddingInlineEnd: 0 }, disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, onChange: function () { return onClick(pos); }, checkedIcon: _jsx(Icon, { src: ICONS_NAMES.radio_checked }), checked: (selectedPOS === null || selectedPOS === void 0 ? void 0 : selectedPOS.id) === pos.id }));
25
+ if (!select)
26
+ return _jsx(ArrowIcon, {});
27
+ };
28
+ return (_jsxs(ListContainer, { children: [_jsxs(TitleContainer, { children: [_jsx(Image, { src: platformImage, alt: 'Device' }), _jsx(Title, { children: t('terminal_devices', { name: platformName }) })] }), _jsx(ScrollContainer, { children: _jsx(POSListContainer, { children: (posDevices || []).map(function (device, index) { return (_jsx(ListItem, { sx: { minHeight: 'unset' }, titleSx: { fontSize: typography.subtitle2.fontSize }, onClick: function () { return onClick(device); }, name: device.display_name, deviceId: device.reference, deviceIdLabel: 'terminal_device_id', endAdornment: getEndComponent(device) }, index)); }) }) })] }));
29
+ };
30
+ export default memo(POSDeviceList);
@@ -1,5 +1,5 @@
1
1
  import Header from './Header';
2
- import TerminalList from './TerminalList';
2
+ import POSDeviceList from './POSDeviceList';
3
3
  export * from './styles';
4
4
  export * from './utils';
5
- export { Header, TerminalList };
5
+ export { Header, POSDeviceList };
@@ -1,5 +1,5 @@
1
1
  import Header from './Header';
2
- import TerminalList from './TerminalList';
2
+ import POSDeviceList from './POSDeviceList';
3
3
  export * from './styles';
4
4
  export * from './utils';
5
- export { Header, TerminalList };
5
+ export { Header, POSDeviceList };
@@ -78,7 +78,7 @@ export declare const ScrollContainer: import("@emotion/styled").StyledComponent<
78
78
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
79
79
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
80
80
  }, keyof import("@mui/material/OverridableComponent").CommonProps | ("left" | "right" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "component" | "ref" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
81
- export declare const TerminalListContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
81
+ export declare const POSListContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
82
82
  children?: import("react").ReactNode;
83
83
  component?: import("react").ElementType<any> | undefined;
84
84
  ref?: import("react").Ref<unknown> | undefined;
@@ -60,7 +60,7 @@ export var ScrollContainer = styled(Box)(function (_a) {
60
60
  overflow: 'scroll'
61
61
  });
62
62
  });
63
- export var TerminalListContainer = styled(Box)(function (_a) {
63
+ export var POSListContainer = styled(Box)(function (_a) {
64
64
  var spacing = _a.theme.spacing;
65
65
  return ({
66
66
  display: 'flex',
@@ -1,7 +1,7 @@
1
- import { TerminalDeviceInfo, TerminalInfo } from '../../../../@types';
2
- export declare const getPairedWith: (device: TerminalDeviceInfo) => string | undefined;
3
- export declare const getId: (device: TerminalDeviceInfo) => string;
4
- export declare const getIdLabel: (device: TerminalDeviceInfo) => "terminal_device_id" | "terminal_serial_number";
1
+ import { TerminalInfo } from '../../../../@types';
2
+ export declare const getPairedWith: (terminal: TerminalInfo | undefined) => string | undefined;
3
+ export declare const getId: (terminal: TerminalInfo | undefined) => string;
4
+ export declare const getIdLabel: (terminal: TerminalInfo | undefined) => "terminal_device_id" | "terminal_serial_number";
5
5
  export declare const getTerminalId: (terminal: TerminalInfo) => string;
6
6
  export declare const getTerminalName: (terminal: TerminalInfo) => string;
7
7
  export declare const getTerminalIdLabel: (terminal: TerminalInfo) => "terminal_device_id" | "terminal_id";
@@ -1,14 +1,14 @@
1
- export var getPairedWith = function (device) {
2
- var _a, _b, _c, _d;
3
- return (_c = (_b = (_a = device === null || device === void 0 ? void 0 : device.terminal) === null || _a === void 0 ? void 0 : _a.device) === null || _b === void 0 ? void 0 : _b.display_name) !== null && _c !== void 0 ? _c : (_d = device === null || device === void 0 ? void 0 : device.terminal) === null || _d === void 0 ? void 0 : _d.name.en;
1
+ export var getPairedWith = function (terminal) {
2
+ var _a;
3
+ return (_a = terminal === null || terminal === void 0 ? void 0 : terminal.device) === null || _a === void 0 ? void 0 : _a.display_name;
4
4
  };
5
- export var getId = function (device) {
6
- var _a, _b, _c;
7
- return (_c = (_b = (_a = device === null || device === void 0 ? void 0 : device.terminal) === null || _a === void 0 ? void 0 : _a.device) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : device.serial_number;
5
+ export var getId = function (terminal) {
6
+ var _a;
7
+ return ((terminal === null || terminal === void 0 ? void 0 : terminal.device) ? terminal.device.reference || terminal.device.id : (_a = terminal === null || terminal === void 0 ? void 0 : terminal.terminal_device) === null || _a === void 0 ? void 0 : _a.serial_number) || '';
8
8
  };
9
- export var getIdLabel = function (device) {
10
- var _a, _b;
11
- return ((_b = (_a = device === null || device === void 0 ? void 0 : device.terminal) === null || _a === void 0 ? void 0 : _a.device) === null || _b === void 0 ? void 0 : _b.id) ? 'terminal_device_id' : 'terminal_serial_number';
9
+ export var getIdLabel = function (terminal) {
10
+ var _a;
11
+ return ((_a = terminal === null || terminal === void 0 ? void 0 : terminal.device) === null || _a === void 0 ? void 0 : _a.id) ? 'terminal_device_id' : 'terminal_serial_number';
12
12
  };
13
13
  export var getTerminalId = function (terminal) {
14
14
  var _a, _b;
@@ -1,7 +1,7 @@
1
1
  import { axiosInstance } from '../api';
2
- import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
2
+ import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
3
3
  import { objectHasValues } from './object';
4
- import { isSA } from './string';
4
+ import { isDisasterRecoveryEnv, isSA } from './string';
5
5
  export var sleep = function (milliseconds) {
6
6
  if (milliseconds === void 0) { milliseconds = 1000; }
7
7
  return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
@@ -13,12 +13,19 @@ export var dangerousMessage = function (message, callBack) {
13
13
  callBack === null || callBack === void 0 ? void 0 : callBack({ message: message });
14
14
  };
15
15
  export var setBaseUrl = function (publicKey, region) {
16
+ if (region === void 0) { region = ''; }
16
17
  var isProd = publicKey.includes('pk_live');
17
- if (isProd) {
18
- axiosInstance.defaults.baseURL = isSA(region) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA : ENDPOINT_PATHS.PRODUCTION_BASE_URL;
18
+ var _a = region.split('-'), country = _a[0], envType = _a[1];
19
+ if (!isProd) {
20
+ axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
19
21
  return;
20
22
  }
21
- axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
23
+ if (isSA(country)) {
24
+ axiosInstance.defaults.baseURL = isDisasterRecoveryEnv(envType) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA_DR : ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA;
25
+ }
26
+ else {
27
+ axiosInstance.defaults.baseURL = ENDPOINT_PATHS.PRODUCTION_BASE_URL;
28
+ }
22
29
  };
23
30
  export var updateLocationUrlWithCountry = function (countryIso2) {
24
31
  var country = countryIso2.toLowerCase();
@@ -37,7 +44,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
37
44
  window.history.replaceState({}, '', newUrl);
38
45
  };
39
46
  export var openConnect = function (pk, countryCode) {
40
- var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_DEV_URL);
47
+ var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_SANDBOX_URL);
41
48
  if (countryCode) {
42
49
  newUrl.pathname = "/".concat(countryCode.toLowerCase());
43
50
  }
@@ -1,3 +1,6 @@
1
1
  export declare const isNetworkError: (error: string | null) => boolean;
2
2
  export declare const isTokenExpired: (error: string | null) => boolean;
3
3
  export declare const isTimeoutError: (error: string | null) => boolean;
4
+ export declare const isInternalServerError: (error: string | null) => boolean;
5
+ export declare const isAuthenticationVerificationFailed: (error: string | null) => boolean;
6
+ export declare const isNoDataFoundError: (error: string | null) => boolean;