@tap-payments/auth-jsconnect 2.8.10-test → 2.8.13-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 +2 -2
- package/build/features/app/auth/authStore.js +19 -10
- package/build/features/auth/screens/OTP/OTP.js +20 -5
- package/build/features/brand/screens/BrandActivities/RefundPolicy.js +1 -1
- package/build/features/brand/screens/BrandActivities/TAC.js +1 -1
- package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +1 -1
- package/build/features/connect/screens/OTP/OTP.js +1 -1
- package/build/features/connectExpress/screens/IdentityOTP/OTP.js +1 -1
- package/build/features/connectExpress/screens/OTP/OTP.js +1 -1
- package/build/features/signIn/screens/OTP/OTP.js +1 -1
- package/package.json +1 -1
package/build/constants/app.js
CHANGED
|
@@ -253,12 +253,12 @@ export var AUTH_SCREENS_NAVIGATION = [
|
|
|
253
253
|
{
|
|
254
254
|
name: 'AUTH_OTP_STEP',
|
|
255
255
|
next: 'AUTH_PREPARING_DATA_STEP',
|
|
256
|
-
prev: ['AUTH_MOBILE_STEP', 'AUTH_NID_STEP', 'AUTH_EMAIL_STEP'],
|
|
256
|
+
prev: ['AUTH_MOBILE_STEP', 'AUTH_NID_STEP', 'AUTH_EMAIL_STEP', 'AUTH_PASSWORD_STEP'],
|
|
257
257
|
order: 2
|
|
258
258
|
},
|
|
259
259
|
{
|
|
260
260
|
name: 'AUTH_PASSWORD_STEP',
|
|
261
|
-
next: 'AUTH_PREPARING_DATA_STEP',
|
|
261
|
+
next: ['AUTH_PREPARING_DATA_STEP', 'AUTH_OTP_STEP'],
|
|
262
262
|
prev: 'AUTH_EMAIL_STEP',
|
|
263
263
|
order: 2
|
|
264
264
|
},
|
|
@@ -59,7 +59,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
59
59
|
import { AuthForType, FlowsTypes } from '../../../@types';
|
|
60
60
|
import { ADD_NEW_ENTITY, AUTH_STEP_NAMES, IDENTIFICATION_TYPE, defaultCountry } from '../../../constants';
|
|
61
61
|
import API from '../../../api';
|
|
62
|
-
import { handleCurrentActiveScreen, handleNextScreenStep, handleOpen, handleSetCountryByIso2 } from '../../../app/settings';
|
|
62
|
+
import { handleCurrentActiveScreen, handleNextScreenStep, handleOpen, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
63
63
|
import { findCountryByIddPrefix, openConnect, sleep } from '../../../utils';
|
|
64
64
|
export var updateBusinessCountry = createAsyncThunk('auth/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
65
|
var auth, payload, data;
|
|
@@ -271,6 +271,10 @@ export var verifyEmailPassword = createAsyncThunk('auth/verifyEmailPassword', fu
|
|
|
271
271
|
data = (_h.sent()).data;
|
|
272
272
|
if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
|
|
273
273
|
throw new Error(data.errors[0].description);
|
|
274
|
+
if ((data === null || data === void 0 ? void 0 : data.auth_type) === 2) {
|
|
275
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_OTP_STEP')); });
|
|
276
|
+
return [2, data];
|
|
277
|
+
}
|
|
274
278
|
if (scope === 'merchant') {
|
|
275
279
|
openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
|
|
276
280
|
return [2, data];
|
|
@@ -303,6 +307,8 @@ export var resendEmailAuthOTP = createAsyncThunk('auth/resendEmailAuthOTP', func
|
|
|
303
307
|
return [4, API.authService.createAuth(requestBody)];
|
|
304
308
|
case 1:
|
|
305
309
|
data = _b.sent();
|
|
310
|
+
if ((data === null || data === void 0 ? void 0 : data.auth_type) === 1)
|
|
311
|
+
thunkApi.dispatch(handlePrevScreenStep('AUTH_PASSWORD_STEP'));
|
|
306
312
|
return [2, { response: data, formData: params }];
|
|
307
313
|
}
|
|
308
314
|
});
|
|
@@ -327,6 +333,7 @@ export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (pa
|
|
|
327
333
|
device_token: device_token,
|
|
328
334
|
service_name: service_name,
|
|
329
335
|
sign_in: sign_in,
|
|
336
|
+
is_lead: false,
|
|
330
337
|
step_name: AUTH_STEP_NAMES.VERIFY_AUTH_MOBILE,
|
|
331
338
|
encryption_contract: ['data']
|
|
332
339
|
};
|
|
@@ -534,28 +541,30 @@ export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, th
|
|
|
534
541
|
});
|
|
535
542
|
}); });
|
|
536
543
|
export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailability', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
537
|
-
var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, authId, accountData,
|
|
538
|
-
var
|
|
539
|
-
return __generator(this, function (
|
|
540
|
-
switch (
|
|
544
|
+
var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, _b, authId, auth_type, accountData, _c, step_name, brands, entities, brandList, entityList, isExistingUser;
|
|
545
|
+
var _d;
|
|
546
|
+
return __generator(this, function (_e) {
|
|
547
|
+
switch (_e.label) {
|
|
541
548
|
case 0:
|
|
542
549
|
_a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
|
|
543
550
|
authConfigData = settings.data.appConfig.data;
|
|
544
551
|
authDataHasValue = authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length;
|
|
545
552
|
isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
|
|
546
|
-
data = (
|
|
547
|
-
|
|
553
|
+
data = (_d = auth.data.responseData) === null || _d === void 0 ? void 0 : _d.authResponse;
|
|
554
|
+
_b = data || {}, authId = _b.id, auth_type = _b.auth_type;
|
|
555
|
+
if (auth_type === 10) {
|
|
556
|
+
}
|
|
548
557
|
return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id)];
|
|
549
558
|
case 1:
|
|
550
|
-
accountData =
|
|
551
|
-
|
|
559
|
+
accountData = _e.sent();
|
|
560
|
+
_c = accountData || {}, step_name = _c.step_name, brands = _c.brands, entities = _c.entities;
|
|
552
561
|
brandList = brands || [];
|
|
553
562
|
entityList = entities || [];
|
|
554
563
|
isExistingUser = step_name === 'select_account';
|
|
555
564
|
if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 3];
|
|
556
565
|
return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
|
|
557
566
|
case 2:
|
|
558
|
-
|
|
567
|
+
_e.sent();
|
|
559
568
|
return [2, { brandList: brandList, entityList: entityList }];
|
|
560
569
|
case 3:
|
|
561
570
|
if (isExistingUser && authDataHasValue && brandList.length && entityList.length) {
|
|
@@ -24,7 +24,7 @@ import { handlePrevScreenStep } from '../../../../app/settings';
|
|
|
24
24
|
import { AuthForType } from '../../../../@types';
|
|
25
25
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
26
26
|
import Form from '../../../../components/Form';
|
|
27
|
-
import { maskPhone, maskID, deepCopy } from '../../../../utils';
|
|
27
|
+
import { maskPhone, maskID, deepCopy, maskEmail } from '../../../../utils';
|
|
28
28
|
import { OTPValidation } from './validation';
|
|
29
29
|
import OTPInput from './OTPInput';
|
|
30
30
|
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
@@ -59,6 +59,24 @@ var OTP = function () {
|
|
|
59
59
|
});
|
|
60
60
|
var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
61
61
|
var isEmailAuth = data.otpData.authFor === AuthForType.EMAIL;
|
|
62
|
+
var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
|
|
63
|
+
var idNumber = data.nidData.nid;
|
|
64
|
+
var email = data.emailData.email;
|
|
65
|
+
var getNumber = function () {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
if (isNidAuth)
|
|
68
|
+
return maskID(idNumber);
|
|
69
|
+
if (isEmailAuth)
|
|
70
|
+
return ((_b = (_a = data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse) === null || _b === void 0 ? void 0 : _b.email) || maskEmail(email);
|
|
71
|
+
maskPhone(phone);
|
|
72
|
+
};
|
|
73
|
+
var getTitle = function () {
|
|
74
|
+
if (isNidAuth)
|
|
75
|
+
return t('opt_nid_sent_title', { provider: 'ABSHER' });
|
|
76
|
+
if (isEmailAuth)
|
|
77
|
+
return t('otp_email_sent_title');
|
|
78
|
+
return t('ide_opt_sent_title');
|
|
79
|
+
};
|
|
62
80
|
React.useEffect(function () {
|
|
63
81
|
if (error)
|
|
64
82
|
dispatch(clearError());
|
|
@@ -82,9 +100,6 @@ var OTP = function () {
|
|
|
82
100
|
dispatch(handlePrevScreenStep(screen));
|
|
83
101
|
};
|
|
84
102
|
var disabled = !methods.formState.isValid;
|
|
85
|
-
|
|
86
|
-
var idNumber = data.nidData.nid;
|
|
87
|
-
var title = isNidAuth ? t('opt_nid_sent_title', { provider: 'ABSHER' }) : t('ide_opt_sent_title');
|
|
88
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: isNidAuth ? maskID(idNumber) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
103
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : getTitle(), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: getNumber() }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
89
104
|
};
|
|
90
105
|
export default React.memo(OTP);
|
|
@@ -88,6 +88,6 @@ var RefundPolicy = function (_a) {
|
|
|
88
88
|
return;
|
|
89
89
|
refundControl.field.onChange(checked);
|
|
90
90
|
};
|
|
91
|
-
return (
|
|
91
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, __assign({ readOnly: readOnly || isChecked }, { children: [_jsx(CheckboxStyled, { disabled: isChecked, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: refundChecked, onChange: handleRefundCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_refund_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_EN, target: '_blank', underline: 'always' }, { children: t('refund_policy_compliance') }))] })] })), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
92
92
|
};
|
|
93
93
|
export default RefundPolicy;
|
|
@@ -88,6 +88,6 @@ var TAC = function (_a) {
|
|
|
88
88
|
return;
|
|
89
89
|
tacControl.field.onChange(checked);
|
|
90
90
|
};
|
|
91
|
-
return (
|
|
91
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.75 } }, { children: [_jsxs(TACContainerStyled, __assign({ readOnly: readOnly || isChecked }, { children: [_jsx(CheckboxStyled, { disabled: isChecked, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] })), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })));
|
|
92
92
|
};
|
|
93
93
|
export default React.memo(TAC);
|
|
@@ -51,6 +51,6 @@ var TransactionPolicy = function (_a) {
|
|
|
51
51
|
return;
|
|
52
52
|
transactionControl.field.onChange(checked);
|
|
53
53
|
};
|
|
54
|
-
return (
|
|
54
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, __assign({ readOnly: readOnly || isChecked }, { children: [_jsx(CheckboxStyled, { disabled: isChecked, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: transactionChecked, onChange: handleTransactionCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_chargeback_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_EN, target: '_blank', underline: 'always' }, { children: t('chargeback_policy') }))] })] })), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
55
55
|
};
|
|
56
56
|
export default TransactionPolicy;
|
|
@@ -84,7 +84,7 @@ var OTP = function () {
|
|
|
84
84
|
dispatch(handlePrevScreenStep(startWithNID ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
|
|
85
85
|
};
|
|
86
86
|
var disabled = !methods.formState.isValid;
|
|
87
|
-
var phone = ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) +
|
|
87
|
+
var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
|
|
88
88
|
var idNumber = data.nidData.nid;
|
|
89
89
|
var title = startWithNID ? t('opt_nid_sent_title', { provider: 'ABSHER' }) : t('ide_opt_sent_title');
|
|
90
90
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: startWithNID ? maskID(idNumber) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
@@ -79,7 +79,7 @@ var OTP = function () {
|
|
|
79
79
|
dispatch(handlePrevScreenStep());
|
|
80
80
|
};
|
|
81
81
|
var disabled = !methods.formState.isValid;
|
|
82
|
-
var phone = ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) +
|
|
82
|
+
var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
|
|
83
83
|
var idNumber = data.nidData.nid;
|
|
84
84
|
var title = isNidAuth ? t('opt_nid_sent_title', { provider: 'ABSHER' }) : t('ide_opt_sent_title');
|
|
85
85
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: isNidAuth ? maskID(idNumber) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
@@ -80,7 +80,7 @@ var OTP = function () {
|
|
|
80
80
|
dispatch(handlePrevScreenStep(screen));
|
|
81
81
|
};
|
|
82
82
|
var disabled = !methods.formState.isValid;
|
|
83
|
-
var phone = ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) +
|
|
83
|
+
var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
|
|
84
84
|
var idNumber = data.nidData.nid;
|
|
85
85
|
var title = isNidAuth ? t('opt_nid_sent_title', { provider: 'ABSHER' }) : t('ide_opt_sent_title');
|
|
86
86
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: isNidAuth ? maskID(idNumber) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
@@ -85,7 +85,7 @@ var OTP = function () {
|
|
|
85
85
|
dispatch(handlePrevScreenStep(isEmail ? 'SIGIN_EMAIL_STEP' : 'SIGIN_MOBILE_STEP'));
|
|
86
86
|
};
|
|
87
87
|
var disabled = !methods.formState.isValid || !!error;
|
|
88
|
-
var phone = ((_a = data.auth.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) +
|
|
88
|
+
var phone = data.auth.mobile ? ((_a = data.auth.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.auth.mobile : '';
|
|
89
89
|
var email = data.auth.email || '';
|
|
90
90
|
var title = t('ide_opt_sent_title');
|
|
91
91
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: isEmail ? maskEmail(email) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|