@tap-payments/auth-jsconnect 2.11.0-sandbox → 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.
- package/build/@types/form.d.ts +4 -2
- package/build/@types/terminal.d.ts +32 -44
- package/build/api/account.d.ts +2 -2
- package/build/api/account.js +7 -4
- package/build/api/auth.d.ts +8 -2
- package/build/api/auth.js +7 -3
- package/build/api/axios.d.ts +1 -1
- package/build/api/entity.d.ts +3 -0
- package/build/api/headers.d.ts +5 -0
- package/build/api/headers.js +3 -0
- package/build/api/index.d.ts +6 -6
- package/build/api/lead.d.ts +1 -0
- package/build/api/operator.d.ts +1 -1
- package/build/api/operator.js +5 -2
- package/build/api/terminal.d.ts +3 -6
- package/build/api/terminal.js +22 -12
- package/build/assets/currencies/AEDSymbol.js +1 -1
- package/build/assets/currencies/SARSymbol.js +1 -1
- package/build/assets/locales/ar.json +10 -6
- package/build/assets/locales/en.json +13 -8
- package/build/components/DeviceCard/DeviceCard.d.ts +3 -2
- package/build/components/DeviceCard/DeviceCard.js +9 -10
- package/build/components/TruncatedTooltipText/TruncatedTooltipText.d.ts +7 -0
- package/build/components/TruncatedTooltipText/TruncatedTooltipText.js +33 -0
- package/build/components/TruncatedTooltipText/index.d.ts +2 -0
- package/build/components/TruncatedTooltipText/index.js +2 -0
- package/build/constants/api.d.ts +2 -0
- package/build/constants/api.js +4 -0
- package/build/constants/app.d.ts +12 -2
- package/build/constants/app.js +142 -41
- package/build/constants/flows.d.ts +2 -1
- package/build/constants/flows.js +2 -1
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/auth/authStore.js +64 -54
- package/build/features/app/bank/bankStore.js +24 -20
- package/build/features/app/board/boardStore.js +11 -7
- package/build/features/app/brand/brandStore.js +22 -18
- package/build/features/app/business/businessStore.js +45 -36
- package/build/features/app/connect/connectStore.d.ts +6 -5
- package/build/features/app/connect/connectStore.js +48 -31
- package/build/features/app/connectExpress/connectExpressStore.d.ts +6 -5
- package/build/features/app/connectExpress/connectExpressStore.js +61 -20
- package/build/features/app/entity/entityStore.js +21 -17
- package/build/features/app/individual/individualStore.js +34 -28
- package/build/features/app/password/passwordStore.js +44 -46
- package/build/features/app/signIn/signInStore.js +12 -16
- package/build/features/app/tax/taxStore.js +20 -16
- package/build/features/app/terminal/terminalStore.d.ts +8 -7
- package/build/features/app/terminal/terminalStore.js +93 -63
- package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +10 -7
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +6 -4
- package/build/features/auth/screens/AuthenticationList/EntityList.js +11 -3
- package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +1 -1
- package/build/features/business/screens/BusinessType/BusinessType.js +15 -5
- package/build/features/business/screens/BusinessType/EntityLicenseList.js +11 -5
- package/build/features/business/screens/BusinessType/LicenseList.js +20 -12
- package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +35 -0
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +84 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
- package/build/features/business/screens/BusinessType/validation.js +31 -10
- package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +10 -10
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +6 -4
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +11 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +27 -16
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +36 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +81 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +6 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +57 -21
- package/build/features/connectExpress/screens/Mobile/Mobile.js +7 -6
- package/build/features/entity/screens/EntityName/EntityName.js +16 -15
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +50 -48
- package/build/features/entity/screens/EntityName/validation.js +100 -85
- package/build/features/featuresScreens.js +63 -3
- package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
- package/build/features/shared/Button/FlowsButtons.js +1 -1
- package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.js +9 -0
- package/build/features/shared/OTPVerifySecurityError/index.d.ts +2 -0
- package/build/features/shared/OTPVerifySecurityError/index.js +2 -0
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +2 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +3 -2
- package/build/features/terminal/Terminal.js +2 -2
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +8 -9
- package/build/features/terminal/screens/LinkNewTerminal/styles.js +2 -2
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +5 -6
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +15 -10
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +59 -12
- package/build/features/terminal/screens/POSDeviceListPage/POSDeviceListPage.d.ts +3 -0
- package/build/features/terminal/screens/POSDeviceListPage/POSDeviceListPage.js +50 -0
- package/build/features/terminal/screens/POSDeviceListPage/index.d.ts +2 -0
- package/build/features/terminal/screens/POSDeviceListPage/index.js +2 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +3 -3
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +2 -2
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +26 -17
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +5 -7
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +12 -11
- package/build/features/terminal/screens/Verify/Verify.js +6 -2
- package/build/features/terminal/screens/shared/POSDeviceList.d.ts +11 -0
- package/build/features/terminal/screens/shared/POSDeviceList.js +30 -0
- package/build/features/terminal/screens/shared/index.d.ts +2 -2
- package/build/features/terminal/screens/shared/index.js +2 -2
- package/build/features/terminal/screens/shared/styles.d.ts +1 -1
- package/build/features/terminal/screens/shared/styles.js +1 -1
- package/build/features/terminal/screens/shared/utils.d.ts +4 -4
- package/build/features/terminal/screens/shared/utils.js +9 -9
- package/build/utils/common.js +11 -4
- package/build/utils/error.d.ts +3 -0
- package/build/utils/error.js +9 -0
- package/build/utils/string.d.ts +2 -1
- package/build/utils/string.js +3 -2
- package/build/utils/validation.js +1 -1
- package/package.json +3 -3
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +0 -42
- package/build/features/terminal/screens/TerminalListPage/index.d.ts +0 -2
- package/build/features/terminal/screens/TerminalListPage/index.js +0 -2
- package/build/features/terminal/screens/shared/TerminalList.d.ts +0 -11
- package/build/features/terminal/screens/shared/TerminalList.js +0 -25
- /package/build/features/{terminal/screens/TerminalListPage/TerminalListPage.d.ts → shared/OTPVerifySecurityError/OTPVerifySecurityError.d.ts} +0 -0
|
@@ -13,19 +13,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { memo } from 'react';
|
|
14
14
|
import { settingsSelector } from '../../../../app/settings';
|
|
15
15
|
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
16
|
-
import { SCOPE_AUTH } from '../../../../constants';
|
|
16
|
+
import { CONNECT_FLOWS, SCOPE_AUTH } from '../../../../constants';
|
|
17
17
|
import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
|
|
18
18
|
import { onCloseCompleteTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
19
19
|
var SuccessWithFlowButtons = function () {
|
|
20
|
+
var _a;
|
|
20
21
|
var dispatch = useAppDispatch();
|
|
21
|
-
var
|
|
22
|
+
var _b = useAppSelector(terminalSelector), data = _b.data, loading = _b.loading;
|
|
22
23
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
23
24
|
var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
|
|
24
|
-
var
|
|
25
|
-
var
|
|
25
|
+
var _c = data.responseData || {}, boardFlows = _c.boardFlows, boardData = _c.boardData, terminalData = _c.terminalData;
|
|
26
|
+
var _d = boardData || {}, entity = _d.entity, brand = _d.brand, bank = _d.bank_account, merchant = _d.merchant, user = _d.user, business = _d.business, board_id = _d.board_id, board_info_id = _d.board_info_id, name = _d.name, individuals = _d.individuals, recipient = _d.recipient, board_status = _d.board_status;
|
|
26
27
|
var onClose = function () {
|
|
27
28
|
dispatch(onCloseCompleteTerminal());
|
|
28
29
|
};
|
|
29
|
-
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 }));
|
|
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 }));
|
|
30
31
|
};
|
|
31
32
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TerminalInfo } from '../../../../@types';
|
|
3
3
|
interface DeviceListProps {
|
|
4
|
-
devices:
|
|
4
|
+
devices: TerminalInfo[];
|
|
5
5
|
loading?: boolean;
|
|
6
|
-
onClick: (device:
|
|
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 &&
|
|
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);
|
|
@@ -54,46 +54,56 @@ import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/sett
|
|
|
54
54
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
55
55
|
import Button from '../../../../components/Button';
|
|
56
56
|
import Loader from '../../../../components/Loader';
|
|
57
|
-
import
|
|
57
|
+
import Warning from '../../../../components/Warning';
|
|
58
|
+
import Box from '@mui/material/Box';
|
|
59
|
+
import { clearError, resetTerminalLinkResponse, retrieveBoardDetails, retrieveBoardStatus, retrievePOSDevices, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
58
60
|
import { Header, Container, TextTypography } from '../shared';
|
|
59
61
|
import DeviceList from './DeviceList';
|
|
60
62
|
var TerminalDeviceList = function () {
|
|
61
63
|
var t = useTranslation().t;
|
|
62
64
|
var dispatch = useAppDispatch();
|
|
63
|
-
var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading,
|
|
65
|
+
var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading, posDevicesLoading = _a.posDevicesLoading, error = _a.error;
|
|
64
66
|
var _b = React.useState(false), newLinkClicked = _b[0], setNewLinkClicked = _b[1];
|
|
65
|
-
var _c = data.responseData || {}, boardFlows = _c.boardFlows, authData = _c.authData, boardData = _c.boardData, terminalData = _c.terminalData,
|
|
66
|
-
var
|
|
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;
|
|
67
69
|
var _d = React.useMemo(function () {
|
|
68
|
-
var linked =
|
|
69
|
-
var unLinked =
|
|
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; });
|
|
70
72
|
return { linkedDevices: linked, unLinkedDevices: unLinked };
|
|
71
|
-
}, [
|
|
73
|
+
}, [list]), linkedDevices = _d.linkedDevices, unLinkedDevices = _d.unLinkedDevices;
|
|
72
74
|
var handleOnClickNewTerminalLink = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
75
|
return __generator(this, function (_a) {
|
|
74
76
|
switch (_a.label) {
|
|
75
77
|
case 0:
|
|
76
78
|
setNewLinkClicked(true);
|
|
77
|
-
return [4,
|
|
79
|
+
return [4, retrievePOSDevicesAsync(CONNECT_FLOWS.terminal.posDeviceList)];
|
|
78
80
|
case 1:
|
|
79
81
|
_a.sent();
|
|
80
|
-
dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.terminalList));
|
|
81
82
|
return [2];
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
}); };
|
|
85
|
-
|
|
86
|
+
React.useEffect(function () {
|
|
87
|
+
if (error)
|
|
88
|
+
dispatch(clearError());
|
|
89
|
+
dispatch(resetTerminalLinkResponse());
|
|
90
|
+
}, []);
|
|
91
|
+
var retrievePOSDevicesAsync = function (nextScreen) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
92
|
var err_1;
|
|
87
93
|
return __generator(this, function (_a) {
|
|
88
94
|
switch (_a.label) {
|
|
89
95
|
case 0:
|
|
90
|
-
if (
|
|
96
|
+
if (posDevices === null || posDevices === void 0 ? void 0 : posDevices.length) {
|
|
97
|
+
dispatch(handleNextScreenStep(nextScreen));
|
|
98
|
+
return [2];
|
|
99
|
+
}
|
|
91
100
|
_a.label = 1;
|
|
92
101
|
case 1:
|
|
93
102
|
_a.trys.push([1, 3, , 4]);
|
|
94
|
-
return [4, dispatch(
|
|
103
|
+
return [4, dispatch(retrievePOSDevices()).unwrap()];
|
|
95
104
|
case 2:
|
|
96
105
|
_a.sent();
|
|
106
|
+
dispatch(handleNextScreenStep(nextScreen));
|
|
97
107
|
return [3, 4];
|
|
98
108
|
case 3:
|
|
99
109
|
err_1 = _a.sent();
|
|
@@ -104,7 +114,7 @@ var TerminalDeviceList = function () {
|
|
|
104
114
|
});
|
|
105
115
|
}); };
|
|
106
116
|
var handleOnClickLinkedTerminal = function (terminal) {
|
|
107
|
-
dispatch(
|
|
117
|
+
dispatch(storeSelectedTerminal(terminal));
|
|
108
118
|
dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.linkedTerminalInfo));
|
|
109
119
|
};
|
|
110
120
|
var handleOnClickUnlinkedTerminal = function (terminal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -112,11 +122,10 @@ var TerminalDeviceList = function () {
|
|
|
112
122
|
switch (_a.label) {
|
|
113
123
|
case 0:
|
|
114
124
|
setNewLinkClicked(false);
|
|
115
|
-
dispatch(
|
|
116
|
-
return [4,
|
|
125
|
+
dispatch(storeSelectedTerminal(terminal));
|
|
126
|
+
return [4, retrievePOSDevicesAsync(CONNECT_FLOWS.terminal.unlinkedTerminalInfo)];
|
|
117
127
|
case 1:
|
|
118
128
|
_a.sent();
|
|
119
|
-
dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.unlinkedTerminalInfo));
|
|
120
129
|
return [2];
|
|
121
130
|
}
|
|
122
131
|
});
|
|
@@ -139,6 +148,6 @@ var TerminalDeviceList = function () {
|
|
|
139
148
|
})
|
|
140
149
|
.catch(function () { });
|
|
141
150
|
};
|
|
142
|
-
return (_jsxs(ScreenContainer, __assign({ minHeight: 200, sx: { pl: 2.5, pr: 2.5 }
|
|
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') })) }))] })));
|
|
143
152
|
};
|
|
144
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,
|
|
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
|
|
29
|
-
var
|
|
30
|
-
var
|
|
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(
|
|
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,
|
|
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 {
|
|
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,
|
|
41
|
-
var _g = responseData || {}, linkTerminalDeviceData = _g.linkTerminalDeviceData,
|
|
42
|
-
var
|
|
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:
|
|
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
|
|
84
|
+
var handleOnSelectPOS = function (pos) {
|
|
84
85
|
if (error)
|
|
85
86
|
dispatch(clearError());
|
|
86
|
-
dispatch(
|
|
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 = !(
|
|
96
|
-
return (_jsxs(ScreenContainer, __assign({ minHeight: 224, justifyContent: 'space-between' }, { children: [_jsx(PushNotification, __assign({ error: t('terminal_request_denied', { device:
|
|
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);
|
|
@@ -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
|
|
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
|
|
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 {
|
|
2
|
-
export declare const getPairedWith: (
|
|
3
|
-
export declare const getId: (
|
|
4
|
-
export declare const getIdLabel: (
|
|
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 (
|
|
2
|
-
var _a
|
|
3
|
-
return (
|
|
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 (
|
|
6
|
-
var _a
|
|
7
|
-
return (
|
|
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 (
|
|
10
|
-
var _a
|
|
11
|
-
return ((
|
|
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;
|
package/build/utils/common.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { axiosInstance } from '../api';
|
|
2
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
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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();
|
package/build/utils/error.d.ts
CHANGED
|
@@ -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;
|
package/build/utils/error.js
CHANGED
|
@@ -7,3 +7,12 @@ export var isTokenExpired = function (error) {
|
|
|
7
7
|
export var isTimeoutError = function (error) {
|
|
8
8
|
return (error || '').trim().toLowerCase().includes('timeout');
|
|
9
9
|
};
|
|
10
|
+
export var isInternalServerError = function (error) {
|
|
11
|
+
return ['internal_server_error'].includes((error || '').trim().toLowerCase());
|
|
12
|
+
};
|
|
13
|
+
export var isAuthenticationVerificationFailed = function (error) {
|
|
14
|
+
return ['failed to verify the auth'].includes((error || '').trim().toLowerCase());
|
|
15
|
+
};
|
|
16
|
+
export var isNoDataFoundError = function (error) {
|
|
17
|
+
return ['no data found'].includes((error || '').trim().toLowerCase());
|
|
18
|
+
};
|
package/build/utils/string.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
|
|
|
43
43
|
};
|
|
44
44
|
export declare const removeRequestHeaders: () => void;
|
|
45
45
|
export declare const getBaseUrl: () => string;
|
|
46
|
-
export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean) => string;
|
|
46
|
+
export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean, terminalStepName?: string) => string;
|
|
47
47
|
export declare const getEighteenYearsAgo: () => string;
|
|
48
48
|
export declare const isKW: (flag: string) => boolean;
|
|
49
49
|
export declare const isSA: (flag: string | undefined) => boolean;
|
|
@@ -79,3 +79,4 @@ export declare const getCurrencyByCountryIso2: (countryCode?: string) => string;
|
|
|
79
79
|
export declare const getMobileNumberLen: (initialLen: number, number: string) => number;
|
|
80
80
|
export declare const getWebsiteLink: (isAr: boolean, countryCode: string, path: string) => string;
|
|
81
81
|
export declare function formatCode(code: string, chunkSize?: number, delimiter?: string): string;
|
|
82
|
+
export declare const isDisasterRecoveryEnv: (type?: string) => boolean;
|
package/build/utils/string.js
CHANGED
|
@@ -179,7 +179,7 @@ export var getBaseUrl = function () {
|
|
|
179
179
|
}
|
|
180
180
|
return ENDPOINT_PATHS.PRODUCTION_BASE_URL;
|
|
181
181
|
};
|
|
182
|
-
export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherThanSAOrKWCountry) {
|
|
182
|
+
export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherThanSAOrKWCountry, terminalStepName) {
|
|
183
183
|
if (flow === FlowsTypes.BANK) {
|
|
184
184
|
return 'BANK_BANK_DETAILS_STEP';
|
|
185
185
|
}
|
|
@@ -205,7 +205,7 @@ export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherT
|
|
|
205
205
|
return 'PASSWORD_CREATE_PASSWORD_STEP';
|
|
206
206
|
}
|
|
207
207
|
if (flow === FlowsTypes.TERMINAL) {
|
|
208
|
-
return CONNECT_FLOWS.terminal.terminalDeviceList;
|
|
208
|
+
return terminalStepName !== null && terminalStepName !== void 0 ? terminalStepName : CONNECT_FLOWS.terminal.terminalDeviceList;
|
|
209
209
|
}
|
|
210
210
|
return '';
|
|
211
211
|
};
|
|
@@ -355,3 +355,4 @@ export function formatCode(code, chunkSize, delimiter) {
|
|
|
355
355
|
if (delimiter === void 0) { delimiter = ' - '; }
|
|
356
356
|
return ((_a = code.match(new RegExp(".{1,".concat(chunkSize, "}"), 'g'))) === null || _a === void 0 ? void 0 : _a.join(delimiter)) || code;
|
|
357
357
|
}
|
|
358
|
+
export var isDisasterRecoveryEnv = function (type) { return type === 'dr'; };
|
|
@@ -53,7 +53,7 @@ export var keepLettersAndSpace = function (str) {
|
|
|
53
53
|
return str.replace(/[^a-zA-Z] /g, '');
|
|
54
54
|
};
|
|
55
55
|
export var isConnectTapDomain = function (domain) {
|
|
56
|
-
var regex = /^(https:\/\/)?connect(
|
|
56
|
+
var regex = /^(https:\/\/)?connect((\.|-)\w+)?\.tap\.(company|com\.\w{2})$/;
|
|
57
57
|
return regex.test(domain);
|
|
58
58
|
};
|
|
59
59
|
export var isTapDomain = function (domain) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/auth-jsconnect",
|
|
3
|
-
"version": "2.11.0
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "connect library, auth",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"copy:files": "copyfiles -u 1 src/**/*.css build/",
|
|
22
22
|
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
23
23
|
"ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
|
|
24
|
-
"push": "npm publish --access public
|
|
24
|
+
"push": "npm publish --access public"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [],
|
|
27
27
|
"author": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@mui/icons-material": "^5.8.4",
|
|
83
83
|
"@mui/material": "^5.8.7",
|
|
84
84
|
"@reduxjs/toolkit": "^1.8.3",
|
|
85
|
-
"axios": "^
|
|
85
|
+
"axios": "^1.11.0",
|
|
86
86
|
"device-detector-js": "^3.0.3",
|
|
87
87
|
"i18next": "^21.8.14",
|
|
88
88
|
"i18next-browser-languagedetector": "^6.1.4",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from 'react';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
16
|
-
import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
|
|
17
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
|
-
import Button from '../../../../components/Button';
|
|
19
|
-
import Warning from '../../../../components/Warning';
|
|
20
|
-
import { linkNewTerminal, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
21
|
-
import { Header, Container, TerminalList } from '../shared';
|
|
22
|
-
var TerminalListPage = function () {
|
|
23
|
-
var t = useTranslation().t;
|
|
24
|
-
var dispatch = useAppDispatch();
|
|
25
|
-
var _a = useAppSelector(terminalSelector), _b = _a.data, selectedTerminal = _b.terminalInfo.selectedTerminal, responseData = _b.responseData, loading = _a.loading, error = _a.error;
|
|
26
|
-
var terminalList = (responseData || {}).terminalList;
|
|
27
|
-
var handleOnSelectTerminal = function (terminal) {
|
|
28
|
-
dispatch(storeSelectedTerminal(terminal));
|
|
29
|
-
dispatch(linkNewTerminal())
|
|
30
|
-
.unwrap()
|
|
31
|
-
.then(function (_a) {
|
|
32
|
-
var nextScreen = _a.nextScreen;
|
|
33
|
-
dispatch(handleNextScreenStep(nextScreen));
|
|
34
|
-
})
|
|
35
|
-
.catch(function () { });
|
|
36
|
-
};
|
|
37
|
-
var handleOnBack = function () {
|
|
38
|
-
dispatch(handlePrevScreenStep());
|
|
39
|
-
};
|
|
40
|
-
return (_jsxs(ScreenContainer, __assign({ sx: { pl: 2.5, pr: 2.5 }, minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, { 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(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: t('back') }))] })));
|
|
41
|
-
};
|
|
42
|
-
export default React.memo(TerminalListPage);
|