@tap-payments/auth-jsconnect 2.11.14-development → 2.11.14-sandbox

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 (54) hide show
  1. package/build/@types/form.d.ts +2 -2
  2. package/build/api/account.d.ts +2 -2
  3. package/build/api/account.js +7 -4
  4. package/build/api/auth.d.ts +1 -1
  5. package/build/api/auth.js +7 -3
  6. package/build/api/headers.d.ts +5 -0
  7. package/build/api/headers.js +3 -0
  8. package/build/api/index.d.ts +4 -4
  9. package/build/api/operator.d.ts +1 -1
  10. package/build/api/operator.js +5 -2
  11. package/build/assets/locales/ar.json +5 -0
  12. package/build/assets/locales/en.json +7 -2
  13. package/build/components/Tooltip/Tooltip.js +1 -1
  14. package/build/constants/app.d.ts +1 -0
  15. package/build/constants/app.js +105 -18
  16. package/build/constants/flows.d.ts +1 -0
  17. package/build/constants/flows.js +2 -1
  18. package/build/features/app/auth/authStore.js +64 -54
  19. package/build/features/app/bank/bankStore.js +24 -20
  20. package/build/features/app/board/boardStore.js +11 -7
  21. package/build/features/app/brand/brandStore.js +22 -18
  22. package/build/features/app/business/businessStore.js +30 -26
  23. package/build/features/app/connect/connectStore.js +26 -22
  24. package/build/features/app/connectExpress/connectExpressStore.js +20 -7
  25. package/build/features/app/entity/entityStore.js +21 -17
  26. package/build/features/app/individual/individualStore.js +33 -28
  27. package/build/features/app/password/passwordStore.js +44 -46
  28. package/build/features/app/signIn/signInStore.js +12 -16
  29. package/build/features/app/tax/taxStore.js +20 -16
  30. package/build/features/app/terminal/terminalStore.js +5 -3
  31. package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +10 -7
  32. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
  33. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +6 -4
  34. package/build/features/auth/screens/AuthenticationList/EntityList.js +9 -1
  35. package/build/features/business/screens/BusinessType/BusinessType.js +2 -3
  36. package/build/features/business/screens/BusinessType/LicenseList.js +5 -5
  37. package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +10 -10
  38. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
  39. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +6 -4
  40. package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +9 -1
  41. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +6 -11
  42. package/build/features/connectExpress/screens/Mobile/Mobile.js +7 -6
  43. package/build/features/featuresScreens.js +60 -0
  44. package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.d.ts +3 -0
  45. package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.js +9 -0
  46. package/build/features/shared/OTPVerifySecurityError/index.d.ts +2 -0
  47. package/build/features/shared/OTPVerifySecurityError/index.js +2 -0
  48. package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +59 -14
  49. package/build/features/terminal/screens/POSDeviceListPage/POSDeviceListPage.js +5 -2
  50. package/build/features/terminal/screens/Verify/Verify.js +6 -2
  51. package/build/utils/common.js +3 -3
  52. package/build/utils/error.d.ts +1 -0
  53. package/build/utils/error.js +3 -0
  54. package/package.json +2 -2
@@ -18,13 +18,14 @@ import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/sett
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
19
  import Button from '../../../../components/Button';
20
20
  import Warning from '../../../../components/Warning';
21
+ import { CONNECT_FLOWS } from '../../../../constants';
21
22
  import { clearError, linkNewTerminal, storeSelectedPOS, terminalSelector } from '../../../app/terminal/terminalStore';
22
23
  import { Header, Container, POSDeviceList } from '../shared';
23
24
  var POSDeviceListPage = function () {
24
25
  var t = useTranslation().t;
25
26
  var dispatch = useAppDispatch();
26
27
  var _a = useAppSelector(terminalSelector), _b = _a.data, selectedPOS = _b.terminalInfo.selectedPOS, responseData = _b.responseData, loading = _a.loading, error = _a.error;
27
- var posDevices = (responseData || {}).posDevices;
28
+ var _c = responseData || {}, posDevices = _c.posDevices, terminalData = _c.terminalData;
28
29
  React.useEffect(function () {
29
30
  if (error)
30
31
  dispatch(clearError());
@@ -40,7 +41,9 @@ var POSDeviceListPage = function () {
40
41
  .catch(function () { });
41
42
  };
42
43
  var handleOnBack = function () {
43
- dispatch(handlePrevScreenStep());
44
+ var _a;
45
+ var screen = ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _a === void 0 ? void 0 : _a.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked;
46
+ dispatch(handlePrevScreenStep(screen));
44
47
  };
45
48
  return (_jsxs(ScreenContainer, __assign({ minHeight: 200, justifyContent: 'space-between' }, { children: [_jsxs(Container, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: [_jsx(Header, { title: 'terminal_select_device', sx: { pb: 0 } }), _jsx(POSDeviceList, { select: false, loading: loading, selectedPOS: selectedPOS, posDevices: posDevices, onClick: handleOnSelectPOS })] })), error && _jsx(Warning, __assign({ sx: { mt: 2 } }, { children: t(error) })), _jsx(Box, __assign({ sx: { pl: 2.5, pr: 2.5 } }, { children: _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: t('back') })) }))] })));
46
49
  };
@@ -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') }))] })) })) }));
@@ -1,5 +1,5 @@
1
1
  import { axiosInstance } from '../api';
2
- import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
2
+ import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
3
3
  import { objectHasValues } from './object';
4
4
  import { isDisasterRecoveryEnv, isSA } from './string';
5
5
  export var sleep = function (milliseconds) {
@@ -17,7 +17,7 @@ export var setBaseUrl = function (publicKey, region) {
17
17
  var isProd = publicKey.includes('pk_live');
18
18
  var _a = region.split('-'), country = _a[0], envType = _a[1];
19
19
  if (!isProd) {
20
- axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
20
+ axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
21
21
  return;
22
22
  }
23
23
  if (isSA(country)) {
@@ -44,7 +44,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
44
44
  window.history.replaceState({}, '', newUrl);
45
45
  };
46
46
  export var openConnect = function (pk, countryCode) {
47
- var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_DEV_URL);
47
+ var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_SANDBOX_URL);
48
48
  if (countryCode) {
49
49
  newUrl.pathname = "/".concat(countryCode.toLowerCase());
50
50
  }
@@ -2,3 +2,4 @@ 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
4
  export declare const isInternalServerError: (error: string | null) => boolean;
5
+ export declare const isAuthenticationVerificationFailed: (error: string | null) => boolean;
@@ -10,3 +10,6 @@ export var isTimeoutError = function (error) {
10
10
  export var isInternalServerError = function (error) {
11
11
  return ['internal_server_error'].includes((error || '').trim().toLowerCase());
12
12
  };
13
+ export var isAuthenticationVerificationFailed = function (error) {
14
+ return ['failed to verify the auth'].includes((error || '').trim().toLowerCase());
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.11.14-development",
3
+ "version": "2.11.14-sandbox",
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 --tag development"
24
+ "push": "npm publish --access public --tag sandbox"
25
25
  },
26
26
  "keywords": [],
27
27
  "author": {