@tap-payments/auth-jsconnect 2.8.23-test → 2.8.24-test
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/constants/app.js +7 -1
- package/build/features/app/auth/authStore.js +14 -13
- package/build/features/auth/screens/EmailSent/EmailSent.d.ts +5 -0
- package/build/features/auth/screens/EmailSent/EmailSent.js +79 -0
- package/build/features/auth/screens/EmailSent/index.d.ts +2 -0
- package/build/features/auth/screens/EmailSent/index.js +2 -0
- package/build/features/auth/screens/OTP/OTP.js +5 -1
- package/build/features/featuresScreens.js +5 -0
- package/package.json +1 -1
package/build/constants/app.js
CHANGED
|
@@ -252,7 +252,7 @@ export var AUTH_SCREENS_NAVIGATION = [
|
|
|
252
252
|
},
|
|
253
253
|
{
|
|
254
254
|
name: 'AUTH_OTP_STEP',
|
|
255
|
-
next: 'AUTH_PREPARING_DATA_STEP',
|
|
255
|
+
next: ['AUTH_PREPARING_DATA_STEP', 'AUTH_EMAIL_SENT_STEP'],
|
|
256
256
|
prev: ['AUTH_MOBILE_STEP', 'AUTH_NID_STEP', 'AUTH_EMAIL_STEP', 'AUTH_PASSWORD_STEP'],
|
|
257
257
|
order: 2
|
|
258
258
|
},
|
|
@@ -280,6 +280,12 @@ export var AUTH_SCREENS_NAVIGATION = [
|
|
|
280
280
|
prev: ['AUTH_MOBILE_STEP', 'AUTH_NID_STEP', 'AUTH_CIVIL_ID_STEP', 'AUTH_EMAIL_STEP'],
|
|
281
281
|
order: 3
|
|
282
282
|
},
|
|
283
|
+
{
|
|
284
|
+
name: 'AUTH_EMAIL_SENT_STEP',
|
|
285
|
+
next: '',
|
|
286
|
+
prev: 'AUTH_SWITCH_STEP',
|
|
287
|
+
order: 3
|
|
288
|
+
},
|
|
283
289
|
{
|
|
284
290
|
name: 'AUTH_ACCOUNT_NOT_FOUND_STEP',
|
|
285
291
|
next: '',
|
|
@@ -314,7 +314,7 @@ export var resendEmailAuthOTP = createAsyncThunk('auth/resendEmailAuthOTP', func
|
|
|
314
314
|
});
|
|
315
315
|
}); });
|
|
316
316
|
export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
317
|
-
var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data;
|
|
317
|
+
var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data, stepName;
|
|
318
318
|
var _d, _e, _f, _g;
|
|
319
319
|
return __generator(this, function (_h) {
|
|
320
320
|
switch (_h.label) {
|
|
@@ -346,8 +346,11 @@ export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (pa
|
|
|
346
346
|
openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
|
|
347
347
|
return [2, data];
|
|
348
348
|
}
|
|
349
|
+
stepName = 'AUTH_PREPARING_DATA_STEP';
|
|
350
|
+
if ((data === null || data === void 0 ? void 0 : data.auth_type) === AuthTypeNumber.MIGRATION)
|
|
351
|
+
stepName = 'AUTH_EMAIL_SENT_STEP';
|
|
349
352
|
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
|
|
350
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep(
|
|
353
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep(stepName)); });
|
|
351
354
|
return [2, data];
|
|
352
355
|
}
|
|
353
356
|
});
|
|
@@ -541,30 +544,28 @@ export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, th
|
|
|
541
544
|
});
|
|
542
545
|
}); });
|
|
543
546
|
export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailability', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
544
|
-
var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data,
|
|
545
|
-
var
|
|
546
|
-
return __generator(this, function (
|
|
547
|
-
switch (
|
|
547
|
+
var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, authId, accountData, _b, step_name, brands, entities, brandList, entityList, isExistingUser;
|
|
548
|
+
var _c;
|
|
549
|
+
return __generator(this, function (_d) {
|
|
550
|
+
switch (_d.label) {
|
|
548
551
|
case 0:
|
|
549
552
|
_a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
|
|
550
553
|
authConfigData = settings.data.appConfig.data;
|
|
551
554
|
authDataHasValue = authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length;
|
|
552
555
|
isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
|
|
553
|
-
data = (
|
|
554
|
-
|
|
555
|
-
if (auth_type === AuthTypeNumber.MIGRATION) {
|
|
556
|
-
}
|
|
556
|
+
data = (_c = auth.data.responseData) === null || _c === void 0 ? void 0 : _c.authResponse;
|
|
557
|
+
authId = (data || {}).id;
|
|
557
558
|
return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id)];
|
|
558
559
|
case 1:
|
|
559
|
-
accountData =
|
|
560
|
-
|
|
560
|
+
accountData = _d.sent();
|
|
561
|
+
_b = accountData || {}, step_name = _b.step_name, brands = _b.brands, entities = _b.entities;
|
|
561
562
|
brandList = brands || [];
|
|
562
563
|
entityList = entities || [];
|
|
563
564
|
isExistingUser = step_name === 'select_account';
|
|
564
565
|
if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 3];
|
|
565
566
|
return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
|
|
566
567
|
case 2:
|
|
567
|
-
|
|
568
|
+
_d.sent();
|
|
568
569
|
return [2, { brandList: brandList, entityList: entityList }];
|
|
569
570
|
case 3:
|
|
570
571
|
if (isExistingUser && authDataHasValue && brandList.length && entityList.length) {
|
|
@@ -0,0 +1,79 @@
|
|
|
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 Box from '@mui/material/Box/Box';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
17
|
+
import Text from '../../../../components/Text';
|
|
18
|
+
import Icon from '../../../../components/Icon';
|
|
19
|
+
import Collapse from '../../../../components/Collapse';
|
|
20
|
+
import { ICONS_NAMES } from '../../../../constants';
|
|
21
|
+
import Button from '../../../shared/Button';
|
|
22
|
+
import FlatButton from '../../../../components/Button';
|
|
23
|
+
import Warning from '../../../../components/Warning';
|
|
24
|
+
import { handleCurrentActiveScreen } from '../../../../app/settings';
|
|
25
|
+
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
26
|
+
import { authSelector, onSignUp } from '../../../app/auth/authStore';
|
|
27
|
+
import { maskEmail } from '../../../../utils';
|
|
28
|
+
var Container = styled(Box)(function (_a) {
|
|
29
|
+
var theme = _a.theme;
|
|
30
|
+
return ({
|
|
31
|
+
paddingBottom: theme.spacing(2.5),
|
|
32
|
+
paddingTop: theme.spacing(0)
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
var SubContainer = styled(Box)(function (_a) {
|
|
36
|
+
var theme = _a.theme;
|
|
37
|
+
return ({
|
|
38
|
+
display: 'flex',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
width: '100%',
|
|
42
|
+
flexDirection: 'column',
|
|
43
|
+
padding: theme.spacing(0, 3.75),
|
|
44
|
+
paddingTop: theme.spacing(0)
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
var TitleStyled = styled(Text)(function (_a) {
|
|
48
|
+
var theme = _a.theme;
|
|
49
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.info.dark, fontWeight: 700, marginTop: theme.spacing(2.5), marginBottom: theme.spacing(2), textAlign: 'center' }));
|
|
50
|
+
});
|
|
51
|
+
var SubTitleStyled = styled(Text)(function (_a) {
|
|
52
|
+
var theme = _a.theme;
|
|
53
|
+
return (__assign(__assign({}, theme.typography.body2), { color: 'rgba(63, 66, 77, 0.60)', fontWeight: 500, textAlign: 'center' }));
|
|
54
|
+
});
|
|
55
|
+
var IconStyled = styled(Icon)(function () { return ({
|
|
56
|
+
width: 66,
|
|
57
|
+
height: 66
|
|
58
|
+
}); });
|
|
59
|
+
var EmailSent = function (_a) {
|
|
60
|
+
var _b;
|
|
61
|
+
var t = useTranslation().t;
|
|
62
|
+
var dispatch = useAppDispatch();
|
|
63
|
+
var isAr = useLanguage().isAr;
|
|
64
|
+
var _c = useAppSelector(authSelector), loading = _c.loading, error = _c.error, data = _c.data;
|
|
65
|
+
var email = (((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authResponse) || {}).email;
|
|
66
|
+
var onSignIn = function () {
|
|
67
|
+
dispatch(handleCurrentActiveScreen('AUTH_SWITCH_STEP'));
|
|
68
|
+
};
|
|
69
|
+
var handleOnSignUp = function () {
|
|
70
|
+
dispatch(onSignUp());
|
|
71
|
+
};
|
|
72
|
+
var getEmail = function () {
|
|
73
|
+
if (email)
|
|
74
|
+
return email;
|
|
75
|
+
return maskEmail(data.emailData.email);
|
|
76
|
+
};
|
|
77
|
+
return (_jsxs(Container, __assign({ dir: isAr ? 'rtl' : 'ltr' }, { children: [_jsxs(SubContainer, { children: [_jsx(IconStyled, { src: ICONS_NAMES.account_not_found }), _jsx(TitleStyled, { children: t('migration_email_sent_title') }), _jsx(SubTitleStyled, { children: _jsx(Trans, { i18nKey: 'migration_email_sent_des', values: { email: getEmail() } }) })] }), _jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1, mt: 7.4 }, warningType: 'error' }, { children: t(error || '') })) })), _jsxs(SubContainer, { children: [_jsx(FlatButton, __assign({ sx: { mb: 1.5, mt: !!error ? 0 : 7.4 }, onClick: onSignIn, variant: 'text' }, { children: t('try_sign_in') })), _jsx(Button, __assign({ loading: loading, sx: { margin: 0, width: '100%' }, disableBack: true, onClick: handleOnSignUp, isAr: isAr }, { children: t('sign_up') }))] })] })));
|
|
78
|
+
};
|
|
79
|
+
export default React.memo(EmailSent);
|
|
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
16
16
|
import Box from '@mui/material/Box/Box';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import Text from '../../../../components/Text';
|
|
19
|
-
import { clearError, authSelector, verifyMobileOtp, verifyNIDOtp, resetOTPValue } from '../../../app/auth/authStore';
|
|
19
|
+
import { clearError, authSelector, verifyMobileOtp, verifyNIDOtp, resetOTPValue, verifyEmailOtp } from '../../../app/auth/authStore';
|
|
20
20
|
import Button from '../../../shared/Button';
|
|
21
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
22
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
@@ -98,6 +98,10 @@ var OTP = function () {
|
|
|
98
98
|
dispatch(verifyNIDOtp(deepCopy(formData)));
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
+
if (isEmailAuth) {
|
|
102
|
+
dispatch(verifyEmailOtp(deepCopy(formData)));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
101
105
|
dispatch(verifyMobileOtp(deepCopy(formData)));
|
|
102
106
|
};
|
|
103
107
|
var onBack = function () {
|
|
@@ -42,6 +42,7 @@ import AccountNotFoundScreen from './auth/screens/AccountNotFound';
|
|
|
42
42
|
import AuthAuthenticationListScreen from './auth/screens/AuthenticationList';
|
|
43
43
|
import AuthMerchantScreen from './auth/screens/AuthMerchant';
|
|
44
44
|
import AuthAccountCreatedLoaderScreen from './auth/screens/AccountCreatedLoader';
|
|
45
|
+
import AuthEmailSentScreen from './auth/screens/EmailSent';
|
|
45
46
|
import CustomersPage from './business/screens/Customers';
|
|
46
47
|
import IDBODPage from './business/screens/IDBOD';
|
|
47
48
|
import BusinessVerifyPage from './business/screens/Verify';
|
|
@@ -283,6 +284,10 @@ export var authFeatureScreens = [
|
|
|
283
284
|
{
|
|
284
285
|
name: 'AUTH_ACCOUNT_CREATED_STEP',
|
|
285
286
|
element: AuthAccountCreatedLoaderScreen
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: 'AUTH_EMAIL_SENT_STEP',
|
|
290
|
+
element: AuthEmailSentScreen
|
|
286
291
|
}
|
|
287
292
|
];
|
|
288
293
|
export var businessFeatureScreens = [
|