@tap-payments/auth-jsconnect 2.10.0-beta → 2.10.0-development

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 (192) hide show
  1. package/build/@types/app.d.ts +7 -1
  2. package/build/@types/app.js +7 -0
  3. package/build/@types/form.d.ts +3 -0
  4. package/build/@types/index.d.ts +1 -0
  5. package/build/@types/index.js +1 -0
  6. package/build/@types/terminal.d.ts +116 -0
  7. package/build/@types/terminal.js +1 -0
  8. package/build/api/account.d.ts +1 -0
  9. package/build/api/account.js +7 -0
  10. package/build/api/auth.d.ts +10 -1
  11. package/build/api/index.d.ts +9 -1
  12. package/build/api/index.js +3 -1
  13. package/build/api/terminal.d.ts +23 -0
  14. package/build/api/terminal.js +60 -0
  15. package/build/app/rootReducer.d.ts +1 -0
  16. package/build/app/rootReducer.js +3 -1
  17. package/build/app/settings.d.ts +1 -0
  18. package/build/app/settings.js +9 -4
  19. package/build/app/store.d.ts +2 -0
  20. package/build/assets/currencies/SARSymbol.d.ts +7 -0
  21. package/build/assets/currencies/SARSymbol.js +28 -0
  22. package/build/assets/currencies/index.d.ts +2 -0
  23. package/build/assets/currencies/index.js +2 -0
  24. package/build/assets/currencies/utils.d.ts +4 -0
  25. package/build/assets/currencies/utils.js +4 -0
  26. package/build/assets/locales/ar.json +10 -1
  27. package/build/assets/locales/en.json +36 -1
  28. package/build/components/DeviceCard/DeviceCard.d.ts +18 -0
  29. package/build/components/DeviceCard/DeviceCard.js +103 -0
  30. package/build/components/DeviceCard/index.d.ts +3 -0
  31. package/build/components/DeviceCard/index.js +2 -0
  32. package/build/components/TextWithCurrency/TextWithCurrency.d.ts +7 -0
  33. package/build/components/TextWithCurrency/TextWithCurrency.js +14 -0
  34. package/build/components/TextWithCurrency/index.d.ts +2 -0
  35. package/build/components/TextWithCurrency/index.js +2 -0
  36. package/build/components/Tooltip/Tooltip.js +1 -1
  37. package/build/constants/api.d.ts +1 -1
  38. package/build/constants/api.js +2 -2
  39. package/build/constants/app.d.ts +14 -3
  40. package/build/constants/app.js +151 -14
  41. package/build/constants/assets.d.ts +8 -0
  42. package/build/constants/assets.js +14 -3
  43. package/build/constants/flows.d.ts +14 -0
  44. package/build/constants/flows.js +14 -0
  45. package/build/constants/validation.d.ts +2 -0
  46. package/build/constants/validation.js +2 -0
  47. package/build/features/app/auth/authStore.d.ts +24 -5
  48. package/build/features/app/auth/authStore.js +186 -89
  49. package/build/features/app/business/businessStore.js +53 -29
  50. package/build/features/app/connect/connectStore.js +47 -35
  51. package/build/features/app/connectExpress/connectExpressStore.d.ts +14 -3
  52. package/build/features/app/connectExpress/connectExpressStore.js +301 -109
  53. package/build/features/app/individual/individualStore.js +0 -1
  54. package/build/features/app/kyc/kycStore.js +49 -25
  55. package/build/features/app/tax/taxStore.js +1 -1
  56. package/build/features/app/terminal/terminalStore.d.ts +106 -0
  57. package/build/features/app/terminal/terminalStore.js +635 -0
  58. package/build/features/auth/screens/OTP/OTP.d.ts +13 -2
  59. package/build/features/auth/screens/OTP/OTP.js +15 -3
  60. package/build/features/auth/screens/OTP/index.d.ts +1 -2
  61. package/build/features/auth/screens/Passcode/Passcode.d.ts +16 -0
  62. package/build/features/auth/screens/Passcode/Passcode.js +82 -0
  63. package/build/features/auth/screens/Passcode/PasscodeInput.d.ts +6 -0
  64. package/build/features/auth/screens/Passcode/PasscodeInput.js +42 -0
  65. package/build/features/auth/screens/Passcode/index.d.ts +2 -0
  66. package/build/features/auth/screens/Passcode/index.js +2 -0
  67. package/build/features/auth/screens/Passcode/validation.d.ts +8 -0
  68. package/build/features/auth/screens/Passcode/validation.js +4 -0
  69. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -8
  70. package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -8
  71. package/build/features/business/screens/MobileOwnership/CollectMobileOwnership.js +4 -6
  72. package/build/features/connect/screens/MobileOwnership/CollectMobileOwnership.js +4 -6
  73. package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.d.ts +3 -0
  74. package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.js +9 -0
  75. package/build/features/connectExpress/screens/GenericPrepareDataLoading/index.d.ts +2 -0
  76. package/build/features/connectExpress/screens/GenericPrepareDataLoading/index.js +2 -0
  77. package/build/features/connectExpress/screens/MobileOwnership/CollectMobileOwnership.js +4 -6
  78. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.d.ts +5 -0
  79. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.js +49 -0
  80. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.d.ts +5 -0
  81. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.js +88 -0
  82. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.d.ts +3 -0
  83. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.js +2 -0
  84. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.d.ts +8 -0
  85. package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.js +4 -0
  86. package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +9 -3
  87. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +3 -7
  88. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +3 -7
  89. package/build/features/featuresScreens.d.ts +1 -0
  90. package/build/features/featuresScreens.js +72 -0
  91. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +3 -8
  92. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
  93. package/build/features/kyc/screens/Terms/Terms.js +8 -2
  94. package/build/features/kyc/screens/Users/Users.js +1 -1
  95. package/build/features/shared/Background/LogoBackground.js +5 -17
  96. package/build/features/shared/Button/Button.js +2 -3
  97. package/build/features/shared/Button/FlowsButtons.js +2 -1
  98. package/build/features/shared/Input/Input.d.ts +1 -1
  99. package/build/features/shared/PushNotification/PushNotification.d.ts +11 -0
  100. package/build/features/shared/PushNotification/PushNotification.js +34 -0
  101. package/build/features/shared/PushNotification/index.d.ts +2 -0
  102. package/build/features/shared/PushNotification/index.js +2 -0
  103. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +3 -1
  104. package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
  105. package/build/features/terminal/Terminal.d.ts +14 -0
  106. package/build/features/terminal/Terminal.js +95 -0
  107. package/build/features/terminal/index.d.ts +1 -0
  108. package/build/features/terminal/index.js +1 -0
  109. package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.d.ts +3 -0
  110. package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +68 -0
  111. package/build/features/terminal/screens/LinkNewTerminal/index.d.ts +2 -0
  112. package/build/features/terminal/screens/LinkNewTerminal/index.js +2 -0
  113. package/build/features/terminal/screens/LinkNewTerminal/styles.d.ts +10 -0
  114. package/build/features/terminal/screens/LinkNewTerminal/styles.js +28 -0
  115. package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.d.ts +3 -0
  116. package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +50 -0
  117. package/build/features/terminal/screens/LinkedSuccess/index.d.ts +2 -0
  118. package/build/features/terminal/screens/LinkedSuccess/index.js +2 -0
  119. package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.d.ts +3 -0
  120. package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +50 -0
  121. package/build/features/terminal/screens/LinkedTerminalInfo/index.d.ts +2 -0
  122. package/build/features/terminal/screens/LinkedTerminalInfo/index.js +2 -0
  123. package/build/features/terminal/screens/Loading/Loading.d.ts +4 -0
  124. package/build/features/terminal/screens/Loading/Loading.js +10 -0
  125. package/build/features/terminal/screens/Loading/index.d.ts +2 -0
  126. package/build/features/terminal/screens/Loading/index.js +2 -0
  127. package/build/features/terminal/screens/NoTerminalLinked/NoTerminalLinked.d.ts +3 -0
  128. package/build/features/terminal/screens/NoTerminalLinked/NoTerminalLinked.js +57 -0
  129. package/build/features/terminal/screens/NoTerminalLinked/index.d.ts +2 -0
  130. package/build/features/terminal/screens/NoTerminalLinked/index.js +2 -0
  131. package/build/features/terminal/screens/NoTerminalLinked/styles.d.ts +36 -0
  132. package/build/features/terminal/screens/NoTerminalLinked/styles.js +34 -0
  133. package/build/features/terminal/screens/OperatorError/OperatorError.d.ts +5 -0
  134. package/build/features/terminal/screens/OperatorError/OperatorError.js +9 -0
  135. package/build/features/terminal/screens/OperatorError/index.d.ts +2 -0
  136. package/build/features/terminal/screens/OperatorError/index.js +2 -0
  137. package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +3 -0
  138. package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +21 -0
  139. package/build/features/terminal/screens/ResetPasswordSuccess/index.d.ts +2 -0
  140. package/build/features/terminal/screens/ResetPasswordSuccess/index.js +2 -0
  141. package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  142. package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +31 -0
  143. package/build/features/terminal/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  144. package/build/features/terminal/screens/SuccessWithFlowButtons/index.js +2 -0
  145. package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +9 -0
  146. package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +20 -0
  147. package/build/features/terminal/screens/TerminalDeviceList/Header.d.ts +6 -0
  148. package/build/features/terminal/screens/TerminalDeviceList/Header.js +23 -0
  149. package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.d.ts +3 -0
  150. package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +129 -0
  151. package/build/features/terminal/screens/TerminalDeviceList/index.d.ts +2 -0
  152. package/build/features/terminal/screens/TerminalDeviceList/index.js +2 -0
  153. package/build/features/terminal/screens/TerminalDeviceList/styles.d.ts +71 -0
  154. package/build/features/terminal/screens/TerminalDeviceList/styles.js +56 -0
  155. package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.d.ts +3 -0
  156. package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +52 -0
  157. package/build/features/terminal/screens/UnlinkedSuccess/index.d.ts +2 -0
  158. package/build/features/terminal/screens/UnlinkedSuccess/index.js +2 -0
  159. package/build/features/terminal/screens/UnlinkedTerminalInfo/TerminalList.d.ts +9 -0
  160. package/build/features/terminal/screens/UnlinkedTerminalInfo/TerminalList.js +16 -0
  161. package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.d.ts +3 -0
  162. package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +94 -0
  163. package/build/features/terminal/screens/UnlinkedTerminalInfo/index.d.ts +2 -0
  164. package/build/features/terminal/screens/UnlinkedTerminalInfo/index.js +2 -0
  165. package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.d.ts +74 -0
  166. package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.js +98 -0
  167. package/build/features/terminal/screens/Verify/OTPInput.d.ts +7 -0
  168. package/build/features/terminal/screens/Verify/OTPInput.js +51 -0
  169. package/build/features/terminal/screens/Verify/Verify.d.ts +5 -0
  170. package/build/features/terminal/screens/Verify/Verify.js +85 -0
  171. package/build/features/terminal/screens/Verify/index.d.ts +2 -0
  172. package/build/features/terminal/screens/Verify/index.js +2 -0
  173. package/build/features/terminal/screens/Verify/validation.d.ts +8 -0
  174. package/build/features/terminal/screens/Verify/validation.js +4 -0
  175. package/build/features/terminal/screens/shared/index.d.ts +2 -0
  176. package/build/features/terminal/screens/shared/index.js +2 -0
  177. package/build/features/terminal/screens/shared/styles.d.ts +72 -0
  178. package/build/features/terminal/screens/shared/styles.js +50 -0
  179. package/build/features/terminal/screens/shared/utils.d.ts +7 -0
  180. package/build/features/terminal/screens/shared/utils.js +24 -0
  181. package/build/hooks/useAppConfig.js +1 -1
  182. package/build/hooks/useAppDispatch.d.ts +1 -0
  183. package/build/index.d.ts +3 -2
  184. package/build/index.js +4 -2
  185. package/build/theme/palette.js +12 -0
  186. package/build/theme/typography.js +4 -0
  187. package/build/utils/common.d.ts +1 -1
  188. package/build/utils/common.js +7 -5
  189. package/build/utils/error.d.ts +1 -0
  190. package/build/utils/error.js +3 -0
  191. package/build/utils/string.d.ts +1 -1
  192. package/package.json +3 -4
@@ -0,0 +1,31 @@
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 } from "react/jsx-runtime";
13
+ import { memo } from 'react';
14
+ import { settingsSelector } from '../../../../app/settings';
15
+ import { useAppSelector, useAppDispatch } from '../../../../hooks';
16
+ import { SCOPE_AUTH } from '../../../../constants';
17
+ import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
18
+ import { onCloseCompleteTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
19
+ var SuccessWithFlowButtons = function () {
20
+ var dispatch = useAppDispatch();
21
+ var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading;
22
+ var settingsData = useAppSelector(settingsSelector).data;
23
+ var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
24
+ var _b = data.responseData || {}, boardFlows = _b.boardFlows, boardData = _b.boardData;
25
+ var _c = boardData || {}, entity = _c.entity, brand = _c.brand, bank = _c.bank_account, merchant = _c.merchant, user = _c.user, business = _c.business, board_id = _c.board_id, board_info_id = _c.board_info_id, name = _c.name, individuals = _c.individuals, recipient = _c.recipient, board_status = _c.board_status;
26
+ var onClose = function () {
27
+ dispatch(onCloseCompleteTerminal());
28
+ };
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
+ };
31
+ export default memo(SuccessWithFlowButtons);
@@ -0,0 +1,2 @@
1
+ import SuccessWithFlowButtons from './SuccessWithFlowButtons';
2
+ export default SuccessWithFlowButtons;
@@ -0,0 +1,2 @@
1
+ import SuccessWithFlowButtons from './SuccessWithFlowButtons';
2
+ export default SuccessWithFlowButtons;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { TerminalDeviceInfo } from '../../../../@types';
3
+ interface DeviceListProps {
4
+ devices: TerminalDeviceInfo[];
5
+ loading?: boolean;
6
+ onClick: (device: TerminalDeviceInfo) => void;
7
+ }
8
+ declare const _default: React.MemoExoticComponent<({ devices, onClick, loading }: DeviceListProps) => JSX.Element>;
9
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo, useState } from 'react';
3
+ import DeviceCard from '../../../../components/DeviceCard';
4
+ import { ICONS_NAMES } from '../../../../constants';
5
+ import { DeviceListContainer } from './styles';
6
+ import { getId, getIdLabel, getPairedWith } from '../shared';
7
+ var DeviceList = function (_a) {
8
+ var devices = _a.devices, onClick = _a.onClick, loading = _a.loading;
9
+ var defaultImage = ICONS_NAMES.device_image;
10
+ var _b = useState(), selected = _b[0], setSelected = _b[1];
11
+ var handleOnClick = function (device) {
12
+ setSelected(device);
13
+ onClick(device);
14
+ };
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));
18
+ }) }));
19
+ };
20
+ export default memo(DeviceList);
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface HeaderProps {
3
+ onLinkClick: () => void;
4
+ }
5
+ declare const _default: React.MemoExoticComponent<({ onLinkClick }: HeaderProps) => JSX.Element>;
6
+ export default _default;
@@ -0,0 +1,23 @@
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 { memo } from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import AddIcon from '@mui/icons-material/Add';
16
+ import { AddIconContainer, Container, LinkButton, LinkText } from './styles';
17
+ import { TextTypography } from '../shared';
18
+ var Header = function (_a) {
19
+ var onLinkClick = _a.onLinkClick;
20
+ var t = useTranslation().t;
21
+ return (_jsxs(Container, { children: [_jsx(TextTypography, { children: t('terminal_manage_terminals') }), _jsxs(LinkButton, __assign({ onClick: onLinkClick }, { children: [_jsx(AddIconContainer, { children: _jsx(AddIcon, { fontSize: 'small' }) }), _jsx(LinkText, { children: t('terminal_link_terminal') })] }))] }));
22
+ };
23
+ export default memo(Header);
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,129 @@
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
+ 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
+ };
48
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
+ import * as React from 'react';
50
+ import { useTranslation } from 'react-i18next';
51
+ import { ScreenContainer } from '../../../shared/Containers';
52
+ import { CONNECT_FLOWS } from '../../../../constants';
53
+ import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
54
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
55
+ import Button from '../../../../components/Button';
56
+ import Loader from '../../../../components/Loader';
57
+ import { linkNewTerminal, retrieveBoardDetails, retrieveBoardStatus, retrieveTerminalList, storeSelectedTerminalDevice, terminalSelector } from '../../../app/terminal/terminalStore';
58
+ import Header from './Header';
59
+ import DeviceList from './DeviceList';
60
+ import { Container, TextTypography } from '../shared';
61
+ var TerminalDeviceList = function () {
62
+ var t = useTranslation().t;
63
+ var dispatch = useAppDispatch();
64
+ var _a = useAppSelector(terminalSelector), data = _a.data, loading = _a.loading, terminalListLoading = _a.terminalListLoading;
65
+ var _b = data.responseData || {}, boardFlows = _b.boardFlows, authData = _b.authData, boardData = _b.boardData, terminalData = _b.terminalData, terminalList = _b.terminalList;
66
+ var terminal_devices = (terminalData || {}).terminal_devices;
67
+ var _c = React.useMemo(function () {
68
+ var linked = terminal_devices === null || terminal_devices === void 0 ? void 0 : terminal_devices.filter(function (d) { return d.linked; });
69
+ var unLinked = terminal_devices === null || terminal_devices === void 0 ? void 0 : terminal_devices.filter(function (d) { return !d.linked; });
70
+ return { linkedDevices: linked, unLinkedDevices: unLinked };
71
+ }, [terminal_devices]), linkedDevices = _c.linkedDevices, unLinkedDevices = _c.unLinkedDevices;
72
+ var handleOnClickNewTerminalLink = function () {
73
+ dispatch(linkNewTerminal())
74
+ .unwrap()
75
+ .then(function (_a) {
76
+ var nextScreen = _a.nextScreen;
77
+ dispatch(handleNextScreenStep(nextScreen));
78
+ })
79
+ .catch(function () { });
80
+ };
81
+ var handleOnClickLinkedTerminal = function (terminal) {
82
+ dispatch(storeSelectedTerminalDevice(terminal));
83
+ dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.linkedTerminalInfo));
84
+ };
85
+ var handleOnClickUnlinkedTerminal = function (terminal) { return __awaiter(void 0, void 0, void 0, function () {
86
+ var err_1;
87
+ return __generator(this, function (_a) {
88
+ switch (_a.label) {
89
+ case 0:
90
+ dispatch(storeSelectedTerminalDevice(terminal));
91
+ if (!!(terminalList === null || terminalList === void 0 ? void 0 : terminalList.length)) return [3, 4];
92
+ _a.label = 1;
93
+ case 1:
94
+ _a.trys.push([1, 3, , 4]);
95
+ return [4, dispatch(retrieveTerminalList())];
96
+ case 2:
97
+ _a.sent();
98
+ return [3, 4];
99
+ case 3:
100
+ err_1 = _a.sent();
101
+ console.log('Error while retrieving terminal list error', err_1);
102
+ return [3, 4];
103
+ case 4:
104
+ dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.unlinkedTerminalInfo));
105
+ return [2];
106
+ }
107
+ });
108
+ }); };
109
+ var handleOnBack = function () {
110
+ if ((boardFlows === null || boardFlows === void 0 ? void 0 : boardFlows.length) > 0) {
111
+ dispatch(handlePrevScreenStep());
112
+ return;
113
+ }
114
+ var _a = (authData === null || authData === void 0 ? void 0 : authData.recipient) || {}, id = _a.id, type = _a.type;
115
+ var board_id = (boardData || {}).id;
116
+ dispatch(retrieveBoardStatus({ boardId: board_id }))
117
+ .unwrap()
118
+ .then(function () {
119
+ dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type }))
120
+ .unwrap()
121
+ .then(function () {
122
+ dispatch(handlePrevScreenStep());
123
+ });
124
+ })
125
+ .catch(function () { });
126
+ };
127
+ return (_jsxs(ScreenContainer, __assign({ minHeight: 200, sx: { pl: 2.5, pr: 2.5 }, justifyContent: 'space-between' }, { children: [_jsxs(Container, { children: [_jsx(Header, { onLinkClick: handleOnClickNewTerminalLink }), _jsx(DeviceList, { devices: linkedDevices, onClick: handleOnClickLinkedTerminal }), _jsx(TextTypography, __assign({ sx: { pt: 1, pb: 1 } }, { children: t('terminal_unlinked') })), _jsx(DeviceList, { loading: terminalListLoading, devices: unLinkedDevices, onClick: handleOnClickUnlinkedTerminal })] }), _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') }))] })));
128
+ };
129
+ export default React.memo(TerminalDeviceList);
@@ -0,0 +1,2 @@
1
+ import TerminalDeviceList from './TerminalDeviceList';
2
+ export default TerminalDeviceList;
@@ -0,0 +1,2 @@
1
+ import TerminalDeviceList from './TerminalDeviceList';
2
+ export default TerminalDeviceList;
@@ -0,0 +1,71 @@
1
+ /// <reference types="react" />
2
+ export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
3
+ children?: import("react").ReactNode;
4
+ component?: import("react").ElementType<any> | undefined;
5
+ ref?: import("react").Ref<unknown> | undefined;
6
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
7
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
8
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
9
+ }, 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>, {}, {}>;
10
+ export declare const LinkButton: import("@emotion/styled").StyledComponent<{
11
+ children?: import("react").ReactNode;
12
+ classes?: Partial<import("@mui/material/Button").ButtonClasses> | undefined;
13
+ color?: "inherit" | "error" | "info" | "success" | "primary" | "secondary" | "warning" | undefined;
14
+ disabled?: boolean | undefined;
15
+ disableElevation?: boolean | undefined;
16
+ disableFocusRipple?: boolean | undefined;
17
+ endIcon?: import("react").ReactNode;
18
+ fullWidth?: boolean | undefined;
19
+ href?: string | undefined;
20
+ size?: "small" | "medium" | "large" | undefined;
21
+ startIcon?: import("react").ReactNode;
22
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
23
+ variant?: "text" | "outlined" | "contained" | undefined;
24
+ } & Omit<{
25
+ action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
26
+ centerRipple?: boolean | undefined;
27
+ children?: import("react").ReactNode;
28
+ classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
29
+ disabled?: boolean | undefined;
30
+ disableRipple?: boolean | undefined;
31
+ disableTouchRipple?: boolean | undefined;
32
+ focusRipple?: boolean | undefined;
33
+ focusVisibleClassName?: string | undefined;
34
+ LinkComponent?: import("react").ElementType<any> | undefined;
35
+ onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
36
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
37
+ tabIndex?: number | undefined;
38
+ TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
39
+ touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
40
+ }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
41
+ ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
42
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "children" | "sx" | "tabIndex" | "size" | "disabled" | "action" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "href" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
43
+ export declare const AddIconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
44
+ children?: import("react").ReactNode;
45
+ component?: import("react").ElementType<any> | undefined;
46
+ ref?: import("react").Ref<unknown> | undefined;
47
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
48
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
49
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
50
+ }, 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>, {}, {}>;
51
+ export declare const LinkText: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
52
+ align?: "left" | "right" | "inherit" | "center" | "justify" | undefined;
53
+ children?: import("react").ReactNode;
54
+ classes?: Partial<import("@mui/material/Typography").TypographyClasses> | undefined;
55
+ gutterBottom?: boolean | undefined;
56
+ noWrap?: boolean | undefined;
57
+ paragraph?: boolean | undefined;
58
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
59
+ variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | undefined;
60
+ variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline", string>> | undefined;
61
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
62
+ ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
63
+ }, 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" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
64
+ export declare const DeviceListContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
65
+ children?: import("react").ReactNode;
66
+ component?: import("react").ElementType<any> | undefined;
67
+ ref?: import("react").Ref<unknown> | undefined;
68
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
69
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
70
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
71
+ }, 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>, {}, {}>;
@@ -0,0 +1,56 @@
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 Button from '@mui/material/Button';
13
+ import Box from '@mui/material/Box';
14
+ import { alpha, styled } from '@mui/material/styles';
15
+ import Typography from '@mui/material/Typography';
16
+ export var Container = styled(Box)(function (_a) {
17
+ var spacing = _a.theme.spacing;
18
+ return ({
19
+ display: 'flex',
20
+ justifyContent: 'space-between',
21
+ alignItems: 'center',
22
+ width: '100%',
23
+ paddingBottom: spacing(2)
24
+ });
25
+ });
26
+ export var LinkButton = styled(Button)(function (_a) {
27
+ var _b = _a.theme, spacing = _b.spacing, palette = _b.palette, typography = _b.typography;
28
+ return (__assign(__assign({}, typography.button_small), { fontWeight: typography.fontWeightRegular, textTransform: 'none', color: palette.primary.main, display: 'flex', alignItems: 'center', gap: spacing(0.5) }));
29
+ });
30
+ export var AddIconContainer = styled(Box)(function (_a) {
31
+ var _b = _a.theme, spacing = _b.spacing, palette = _b.palette;
32
+ return ({
33
+ background: alpha(palette.primary.main, 0.1),
34
+ height: spacing(2.25),
35
+ width: spacing(2.25),
36
+ display: 'flex',
37
+ justifyContent: 'center',
38
+ borderRadius: spacing(11.25),
39
+ alignItems: 'center'
40
+ });
41
+ });
42
+ export var LinkText = styled(Typography)(function (_a) {
43
+ var typography = _a.theme.typography;
44
+ return (__assign({}, typography.button_small));
45
+ });
46
+ export var DeviceListContainer = styled(Box)(function (_a) {
47
+ var spacing = _a.theme.spacing;
48
+ return ({
49
+ display: 'flex',
50
+ justifyContent: 'space-between',
51
+ flexDirection: 'column',
52
+ alignItems: 'center',
53
+ width: '100%',
54
+ gap: spacing(0.75)
55
+ });
56
+ });
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,52 @@
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 Box from '@mui/material/Box';
16
+ import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
17
+ import { CONNECT_FLOWS } from '../../../../constants';
18
+ import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
19
+ import { retrieveBoardDetails, retrieveBoardStatus, terminalSelector } from '../../../app/terminal/terminalStore';
20
+ import SuccessScreen from '../../../shared/SuccessScreen';
21
+ import Button from '../../../shared/Button';
22
+ import { SuccessContainerStyled } from '../shared';
23
+ var UnlinkedSuccess = function () {
24
+ var _a, _b, _c;
25
+ var t = useTranslation().t;
26
+ var isAr = useLanguage().isAr;
27
+ 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;
32
+ var handleGoToBoard = function () {
33
+ var board_id = (boardData || {}).id;
34
+ var _a = (authData === null || authData === void 0 ? void 0 : authData.recipient) || {}, id = _a.id, type = _a.type;
35
+ dispatch(retrieveBoardStatus({ boardId: board_id }))
36
+ .unwrap()
37
+ .then(function () {
38
+ dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type }))
39
+ .unwrap()
40
+ .then(function () {
41
+ dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.board));
42
+ })
43
+ .catch(function () { });
44
+ })
45
+ .catch(function () { });
46
+ };
47
+ var handleOnBack = function () {
48
+ dispatch(handlePrevScreenStep());
49
+ };
50
+ return (_jsxs(SuccessContainerStyled, { children: [_jsx(SuccessScreen, { sx: { minHeight: 'unset', ml: 2.5, mr: 2.5 }, title: t('terminal_unlinked_success', { device: deviceName }), successTitle: t('terminal_go_to_board'), loading: loading, error: error || '' }), _jsx(Box, __assign({ sx: { width: '100%' } }, { children: _jsx(Button, __assign({ loading: loading, disableBack: true, onBackClicked: handleOnBack, onClick: handleGoToBoard, isAr: isAr }, { children: t('terminal_go_to_board') })) }))] }));
51
+ };
52
+ export default React.memo(UnlinkedSuccess);
@@ -0,0 +1,2 @@
1
+ import UnlinkedSuccess from './UnlinkedSuccess';
2
+ export default UnlinkedSuccess;
@@ -0,0 +1,2 @@
1
+ import UnlinkedSuccess from './UnlinkedSuccess';
2
+ export default UnlinkedSuccess;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { TerminalInfo } from '../../../../@types';
3
+ interface TerminalListProps {
4
+ selectedTerminal: TerminalInfo;
5
+ list: TerminalInfo[];
6
+ onClick: (device: TerminalInfo) => void;
7
+ }
8
+ declare const _default: React.MemoExoticComponent<({ list, onClick, selectedTerminal }: TerminalListProps) => JSX.Element>;
9
+ export default _default;
@@ -0,0 +1,16 @@
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 { Container, TerminalListContainer, TitleContainer, Image, Title, ScrollContainer, ListItem, StyledRadio } from './styles';
6
+ import { getTerminalId, getTerminalIdLabel, getTerminalName } from '../shared';
7
+ import Icon from '../../../../components/Icon';
8
+ var TerminalList = function (_a) {
9
+ var _b, _c, _d, _e, _f, _g, _h, _j;
10
+ var list = _a.list, onClick = _a.onClick, selectedTerminal = _a.selectedTerminal;
11
+ var t = useTranslation().t;
12
+ var platformImage = ((_d = (_c = (_b = list[0]) === null || _b === void 0 ? void 0 : _b.platform) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.logo) || ICONS_NAMES.platform_image;
13
+ var platformName = (_j = (_h = (_g = (_f = (_e = list[0]) === null || _e === void 0 ? void 0 : _e.platform) === null || _f === void 0 ? void 0 : _f.brand) === null || _g === void 0 ? void 0 : _g.name) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.text;
14
+ return (_jsxs(Container, { children: [_jsxs(TitleContainer, { children: [_jsx(Image, { src: platformImage, alt: 'Device' }), _jsx(Title, { children: t('terminal_devices', { name: platformName }) })] }), _jsx(ScrollContainer, { children: _jsx(TerminalListContainer, { children: list.map(function (terminal, index) { return (_jsx(ListItem, { sx: { minHeight: 'unset' }, onClick: function () { return onClick(terminal); }, name: getTerminalName(terminal), deviceId: getTerminalId(terminal), deviceIdLabel: getTerminalIdLabel(terminal), endAdornment: _jsx(StyledRadio, { sx: { paddingInlineEnd: 0 }, disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, onChange: function () { return onClick(terminal); }, checkedIcon: _jsx(Icon, { src: ICONS_NAMES.radio_checked }), checked: (selectedTerminal === null || selectedTerminal === void 0 ? void 0 : selectedTerminal.id) === terminal.id }) }, index)); }) }) })] }));
15
+ };
16
+ export default memo(TerminalList);
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,94 @@
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 { useTheme } from '@mui/material/styles';
16
+ import Box from '@mui/material/Box';
17
+ import { CONNECT_FLOWS, DEFAULT_TIMER_VALUE, ICONS_NAMES, TERMINAL_PUSH_NOTIFICATION_DURATION } from '../../../../constants';
18
+ import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
19
+ import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
20
+ import { ScreenContainer } from '../../../shared/Containers';
21
+ import DeviceCard from '../../../../components/DeviceCard';
22
+ import OTPTimer from '../../../../components/OTPTimer';
23
+ import Collapse from '../../../../components/Collapse';
24
+ import { clearError, linkTerminalDevice, pushNotificationLinkNewTerminal, storeSelectedTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
25
+ import PushNotification from '../../../shared/PushNotification';
26
+ import Button from '../../../shared/Button';
27
+ import { Container, getId, getIdLabel, LinkWithText } from '../shared';
28
+ import { SendRequestContainer } from './styles';
29
+ import TerminalList from './TerminalList';
30
+ var UnlinkedTerminalInfo = function () {
31
+ var t = useTranslation().t;
32
+ var typography = useTheme().typography;
33
+ var dispatch = useAppDispatch();
34
+ var isAr = useLanguage().isAr;
35
+ var _a = React.useState(false), isRequestSent = _a[0], setIsRequestSent = _a[1];
36
+ var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
37
+ var _c = React.useState(false), success = _c[0], setSuccess = _c[1];
38
+ var _d = React.useState(false), failed = _d[0], setFailed = _d[1];
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;
44
+ var expiry = TERMINAL_PUSH_NOTIFICATION_DURATION;
45
+ var newTerminal = false;
46
+ React.useEffect(function () {
47
+ if (linkTerminalDeviceData && !isReady) {
48
+ setIsReady(true);
49
+ }
50
+ }, [linkTerminalDeviceData]);
51
+ React.useEffect(function () {
52
+ if (!isReady)
53
+ return;
54
+ var promise = dispatch(pushNotificationLinkNewTerminal({ newTerminal: newTerminal, onSuccess: function () { return setSuccess(true); }, onFailure: function () { return setFailed(true); } }));
55
+ promise
56
+ .unwrap()
57
+ .then(function (_a) {
58
+ var nextScreen = _a.nextScreen;
59
+ if (nextScreen)
60
+ dispatch(handleNextScreenStep(nextScreen));
61
+ })
62
+ .catch(function () { });
63
+ return function () {
64
+ promise === null || promise === void 0 ? void 0 : promise.abort();
65
+ };
66
+ }, [isReady]);
67
+ var getRequestSendDescription = function () {
68
+ if (error)
69
+ return t('terminal_request_denied', { device: display_name });
70
+ if (isRequestSent)
71
+ return t('terminal_new_request_will_send');
72
+ return t('terminal_request_will_send');
73
+ };
74
+ var handleOnSendRequest = function () {
75
+ setIsRequestSent(true);
76
+ handleOnResendClick();
77
+ };
78
+ var handleOnBack = function () {
79
+ if (error)
80
+ dispatch(clearError());
81
+ dispatch(handlePrevScreenStep(CONNECT_FLOWS.terminal.terminalList));
82
+ };
83
+ var handleOnSelectTerminal = function (terminal) {
84
+ if (error)
85
+ dispatch(clearError());
86
+ dispatch(storeSelectedTerminal(terminal));
87
+ };
88
+ var handleOnResendClick = function () {
89
+ dispatch(linkTerminalDevice());
90
+ };
91
+ var disabled = !(selectedTerminal === null || selectedTerminal === void 0 ? void 0 : selectedTerminal.id) || isRequestSent;
92
+ 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'), 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') }))] })));
93
+ };
94
+ export default React.memo(UnlinkedTerminalInfo);
@@ -0,0 +1,2 @@
1
+ import UnlinkedTerminalInfo from './UnlinkedTerminalInfo';
2
+ export default UnlinkedTerminalInfo;
@@ -0,0 +1,2 @@
1
+ import UnlinkedTerminalInfo from './UnlinkedTerminalInfo';
2
+ export default UnlinkedTerminalInfo;