@tap-payments/auth-jsconnect 2.10.9-development → 2.10.10-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.
@@ -16,6 +16,7 @@ import Box from '@mui/material/Box';
16
16
  import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
17
17
  import Button from '../../../../components/Button';
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
+ import { formatCode } from '../../../../utils';
19
20
  import { CONNECT_FLOWS, TERMINAL_PUSH_NOTIFICATION_DURATION } from '../../../../constants';
20
21
  import { ScreenContainer } from '../../../shared/Containers';
21
22
  import PushNotification from '../../../shared/PushNotification';
@@ -63,6 +64,6 @@ var LinkNewTerminal = function () {
63
64
  var previousScreen = (terminal_devices === null || terminal_devices === void 0 ? void 0 : terminal_devices.length) ? CONNECT_FLOWS.terminal.terminalList : CONNECT_FLOWS.terminal.noTerminalLinked;
64
65
  dispatch(handlePrevScreenStep(previousScreen));
65
66
  };
66
- return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsx(PushNotification, __assign({ error: t('terminal_request_denied', { device: deviceName }), failed: failed, success: success, expiryInSeconds: expiry }, { children: _jsxs(LinkNewTerminalContainer, { children: [_jsx(LinkTerminalText, { children: t('terminal_link_terminal') }), _jsx(QRCodeDescription, { children: t('terminal_qr_code_description') }), _jsx(QRCodeImage, { src: qrCode }), code && (_jsxs(_Fragment, { children: [_jsx(LinkTerminalText, { children: t('terminal_or_use_code') }), _jsx(CodeDescription, { children: code })] }))] }) })), _jsx(Box, __assign({ sx: { ml: 2.5, mr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: handleOnBack, variant: 'text' }, { children: t('back') })) }))] })));
67
+ return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsx(PushNotification, __assign({ error: t('terminal_request_denied', { device: deviceName }), failed: failed, success: success, expiryInSeconds: expiry }, { children: _jsxs(LinkNewTerminalContainer, { children: [_jsx(LinkTerminalText, { children: t('terminal_link_terminal') }), _jsx(QRCodeDescription, { children: t('terminal_qr_code_description') }), _jsx(QRCodeImage, { src: qrCode }), code && (_jsxs(_Fragment, { children: [_jsx(LinkTerminalText, { children: t('terminal_or_use_code') }), _jsx(CodeDescription, { children: formatCode(code) })] }))] }) })), _jsx(Box, __assign({ sx: { ml: 2.5, mr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: handleOnBack, variant: 'text' }, { children: t('back') })) }))] })));
67
68
  };
68
69
  export default React.memo(LinkNewTerminal);
@@ -78,3 +78,4 @@ export declare const formatNumberAsCurrency: (number: string) => string;
78
78
  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
+ export declare function formatCode(code: string, chunkSize?: number, delimiter?: string): string;
@@ -347,3 +347,9 @@ export var getWebsiteLink = function (isAr, countryCode, path) {
347
347
  var language = isAr ? LANGUAGE_ABBREVIATIONS.ARABIC : LANGUAGE_ABBREVIATIONS.ENGLISH;
348
348
  return TAP_WEBSITE + language + '-' + countryCode + path;
349
349
  };
350
+ export function formatCode(code, chunkSize, delimiter) {
351
+ var _a;
352
+ if (chunkSize === void 0) { chunkSize = 3; }
353
+ if (delimiter === void 0) { delimiter = ' - '; }
354
+ return ((_a = code.match(new RegExp(".{1,".concat(chunkSize, "}"), 'g'))) === null || _a === void 0 ? void 0 : _a.join(delimiter)) || code;
355
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.10.9-development",
3
+ "version": "2.10.10-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",