@tap-payments/auth-jsconnect 1.0.66 → 1.0.67
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/api/availabilityServices.d.ts +5 -0
- package/build/api/availabilityServices.js +5 -1
- package/build/api/entity.d.ts +1 -0
- package/build/api/index.d.ts +1 -0
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +3 -1
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/bank/bankStore.d.ts +8 -0
- package/build/features/app/bank/bankStore.js +36 -3
- package/build/features/bank/screens/BankDetails/BankDetails.js +6 -4
- package/build/features/bank/screens/BankDetails/BankName.js +17 -3
- package/build/features/bank/screens/BankDetails/Beneficiary.js +12 -3
- package/build/features/bank/screens/BankDetails/IBAN.d.ts +3 -1
- package/build/features/bank/screens/BankDetails/IBAN.js +67 -4
- package/build/features/bank/screens/BankDetails/validation.js +2 -2
- package/build/features/bank/screens/Success/Success.js +2 -4
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -2
- package/build/features/individual/screens/Success/Success.js +2 -4
- package/build/features/password/screens/Success/Success.js +2 -4
- package/build/features/tax/screens/Success/Success.js +2 -4
- package/package.json +1 -1
|
@@ -5,8 +5,13 @@ export declare type CheckEmailBody = {
|
|
|
5
5
|
export declare type CheckBrandBody = {
|
|
6
6
|
profile_name: string;
|
|
7
7
|
};
|
|
8
|
+
export declare type CheckIBanBody = {
|
|
9
|
+
iban_number: string;
|
|
10
|
+
encryption_contract?: Array<string>;
|
|
11
|
+
};
|
|
8
12
|
declare const availabilityServices: {
|
|
9
13
|
checkEmail: (data: CheckEmailBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
10
14
|
checkBrand: (data: CheckBrandBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
15
|
+
checkIbanBank: (data: CheckIBanBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
11
16
|
};
|
|
12
17
|
export default availabilityServices;
|
|
@@ -6,8 +6,12 @@ var checkEmail = function (data, config) {
|
|
|
6
6
|
var checkBrand = function (data, config) {
|
|
7
7
|
return instance.post("".concat(ENDPOINT_PATHS.CHECK_BRAND), data, config);
|
|
8
8
|
};
|
|
9
|
+
var checkIbanBank = function (data, config) {
|
|
10
|
+
return instance.post("".concat(ENDPOINT_PATHS.IBAN_BANK), data, config);
|
|
11
|
+
};
|
|
9
12
|
var availabilityServices = {
|
|
10
13
|
checkEmail: checkEmail,
|
|
11
|
-
checkBrand: checkBrand
|
|
14
|
+
checkBrand: checkBrand,
|
|
15
|
+
checkIbanBank: checkIbanBank
|
|
12
16
|
};
|
|
13
17
|
export default availabilityServices;
|
package/build/api/entity.d.ts
CHANGED
package/build/api/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ declare const API: {
|
|
|
37
37
|
availabilityServices: {
|
|
38
38
|
checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
39
39
|
checkBrand: (data: CheckBrandBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
40
|
+
checkIbanBank: (data: import("./availabilityServices").CheckIBanBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
40
41
|
};
|
|
41
42
|
firebaseService: {
|
|
42
43
|
getLocale: () => Promise<import("axios").AxiosResponse<any, any>>;
|
package/build/constants/api.d.ts
CHANGED
package/build/constants/api.js
CHANGED
|
@@ -10,6 +10,7 @@ var LEAD_IDENTITY_VERIFY_PATH = 'lead/identity/verify';
|
|
|
10
10
|
var RETRIEVE_ENTITY_LIST_PATH = '/lead/entity/list';
|
|
11
11
|
var ENTITY_PATH = '/entity';
|
|
12
12
|
var BANK_PATH = '/entity/bankaccount';
|
|
13
|
+
var IBAN_PATH = '/iban';
|
|
13
14
|
var CHECK_EMAIL = '/lead/identity/emailcheck';
|
|
14
15
|
var CHECK_BRAND = 'lead/profile/profile_name';
|
|
15
16
|
var CREATE_ACCOUNT_PATH = '/account/create';
|
|
@@ -38,5 +39,6 @@ export var ENDPOINT_PATHS = {
|
|
|
38
39
|
CUSTOMER_BASES: CUSTOMER_BASES_PATH,
|
|
39
40
|
SALES: SALES_PATH,
|
|
40
41
|
EXPECTED_CUSTOMERS: EXPECTED_CUSTOMERS_PATH,
|
|
41
|
-
BANK: BANK_PATH
|
|
42
|
+
BANK: BANK_PATH,
|
|
43
|
+
IBAN_BANK: IBAN_PATH
|
|
42
44
|
};
|
|
@@ -7,3 +7,4 @@ export var CR_NUMBER_LENGTH = 10;
|
|
|
7
7
|
export var SAUDI_NUMBER_LENGTH = 9;
|
|
8
8
|
export var REGEX_FULL_NAME = /^([a-zA-Z]{2,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,})$/g;
|
|
9
9
|
export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
|
|
10
|
+
export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z\s])*$/g;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
2
|
import { BankFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
|
+
import { CancelToken } from 'axios';
|
|
3
4
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
5
|
data: any;
|
|
5
6
|
leadData: any;
|
|
@@ -13,6 +14,13 @@ export declare const createBankAccount: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
13
14
|
data: any;
|
|
14
15
|
formData: BankFormValues;
|
|
15
16
|
}, BankFormValues, {}>;
|
|
17
|
+
export declare const checkIbanBank: import("@reduxjs/toolkit").AsyncThunk<{
|
|
18
|
+
data: any;
|
|
19
|
+
}, {
|
|
20
|
+
iban: string;
|
|
21
|
+
cancelToken: CancelToken;
|
|
22
|
+
onSuccess?: (() => void) | undefined;
|
|
23
|
+
}, {}>;
|
|
16
24
|
export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
17
25
|
response: any;
|
|
18
26
|
formData: void;
|
|
@@ -126,7 +126,8 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
|
|
|
126
126
|
beneficiary_name: beneficiaryName,
|
|
127
127
|
bank_name: bank_name
|
|
128
128
|
},
|
|
129
|
-
step_name: BANK_STEP_NAMES.BANK_INFO
|
|
129
|
+
step_name: BANK_STEP_NAMES.BANK_INFO,
|
|
130
|
+
encryption_contract: ['bank_account.iban', 'bank_account.beneficiary_name', 'bank_account.bank_name']
|
|
130
131
|
};
|
|
131
132
|
return [4, API.entityService.createBankAccount(requestBody)];
|
|
132
133
|
case 1:
|
|
@@ -139,6 +140,26 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
|
|
|
139
140
|
}
|
|
140
141
|
});
|
|
141
142
|
}); });
|
|
143
|
+
export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
|
|
144
|
+
var iban = _a.iban, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
|
|
145
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
146
|
+
var payload, data;
|
|
147
|
+
return __generator(this, function (_b) {
|
|
148
|
+
switch (_b.label) {
|
|
149
|
+
case 0:
|
|
150
|
+
payload = {
|
|
151
|
+
iban_number: iban,
|
|
152
|
+
encryption_contract: ['iban_number']
|
|
153
|
+
};
|
|
154
|
+
return [4, API.availabilityServices.checkIbanBank(payload, { cancelToken: cancelToken })];
|
|
155
|
+
case 1:
|
|
156
|
+
data = (_b.sent()).data;
|
|
157
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
158
|
+
return [2, { data: data }];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
});
|
|
142
163
|
export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
143
164
|
var _a, settings, bank, response, payload;
|
|
144
165
|
var _b, _c, _d, _e, _f, _g;
|
|
@@ -177,7 +198,7 @@ var initialState = {
|
|
|
177
198
|
bankData: {
|
|
178
199
|
iban: '',
|
|
179
200
|
beneficiaryName: '',
|
|
180
|
-
bankName: '
|
|
201
|
+
bankName: ''
|
|
181
202
|
}
|
|
182
203
|
}
|
|
183
204
|
};
|
|
@@ -277,7 +298,19 @@ export var bankSlice = createSlice({
|
|
|
277
298
|
state.data.bankData.responseBody = data;
|
|
278
299
|
})
|
|
279
300
|
.addCase(createBankAccount.rejected, function (state, action) {
|
|
280
|
-
state.
|
|
301
|
+
state.error = action.error.message;
|
|
302
|
+
})
|
|
303
|
+
.addCase(checkIbanBank.pending, function (state) {
|
|
304
|
+
state.error = null;
|
|
305
|
+
})
|
|
306
|
+
.addCase(checkIbanBank.fulfilled, function (state, action) {
|
|
307
|
+
state.error = null;
|
|
308
|
+
var data = action.payload.data;
|
|
309
|
+
state.data.bankData.responseBody = data;
|
|
310
|
+
})
|
|
311
|
+
.addCase(checkIbanBank.rejected, function (state, action) {
|
|
312
|
+
if (action.error.message === 'Aborted')
|
|
313
|
+
return;
|
|
281
314
|
state.error = action.error.message;
|
|
282
315
|
});
|
|
283
316
|
}
|
|
@@ -10,12 +10,13 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
13
14
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
14
15
|
import Beneficiary from './Beneficiary';
|
|
15
16
|
import IBAN from './IBAN';
|
|
16
17
|
import BankName from './BankName';
|
|
17
18
|
import Button from '../../../shared/Button';
|
|
18
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
20
|
import { BankValidation } from './validation';
|
|
20
21
|
import { useTranslation } from 'react-i18next';
|
|
21
22
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -24,7 +25,6 @@ import { useLanguage } from '../../../../hooks';
|
|
|
24
25
|
import { styled } from '@mui/material/styles';
|
|
25
26
|
import { bankSelector, createBankAccount } from '../../../app/bank/bankStore';
|
|
26
27
|
import Form from '../../../../components/Form';
|
|
27
|
-
import { useSelector } from 'react-redux';
|
|
28
28
|
var FormStyled = styled(Form)(function () { return ({
|
|
29
29
|
display: 'flex',
|
|
30
30
|
flexDirection: 'column',
|
|
@@ -37,8 +37,9 @@ var ButtonStyled = styled(Button)(function (_a) {
|
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
var BankDetails = function () {
|
|
40
|
+
var _a = React.useState(false), ibanChecking = _a[0], setIbanChecking = _a[1];
|
|
40
41
|
var dispatch = useAppDispatch();
|
|
41
|
-
var
|
|
42
|
+
var _b = useAppSelector(bankSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
42
43
|
var methods = useForm({
|
|
43
44
|
resolver: yupResolver(BankValidation),
|
|
44
45
|
defaultValues: data.bankData,
|
|
@@ -49,6 +50,7 @@ var BankDetails = function () {
|
|
|
49
50
|
};
|
|
50
51
|
var t = useTranslation().t;
|
|
51
52
|
var isAr = useLanguage().isAr;
|
|
52
|
-
|
|
53
|
+
var disabled = ibanChecking || !methods.formState.isValid;
|
|
54
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(ButtonStyled, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
|
|
53
55
|
};
|
|
54
56
|
export default BankDetails;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
3
4
|
import Input from '../../../shared/Input';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
@@ -6,6 +7,9 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
6
7
|
import { styled } from '@mui/material/styles';
|
|
7
8
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
8
9
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
10
|
+
import { bankSelector } from '../../../app/bank/bankStore';
|
|
11
|
+
import { useAppSelector } from '../../../../hooks';
|
|
12
|
+
import { removeAllOtherThanAlphabetAndSpace } from '../../../../utils';
|
|
9
13
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
10
14
|
var theme = _a.theme;
|
|
11
15
|
return ({
|
|
@@ -18,15 +22,25 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
18
22
|
}
|
|
19
23
|
}); });
|
|
20
24
|
var BankName = function () {
|
|
21
|
-
var _a;
|
|
25
|
+
var _a, _b;
|
|
22
26
|
var t = useTranslation().t;
|
|
23
|
-
var
|
|
27
|
+
var _c = useFormContext(), setValue = _c.setValue, control = _c.control;
|
|
28
|
+
var _d = useAppSelector(bankSelector), data = _d.data, loading = _d.loading;
|
|
24
29
|
var bankNameControl = useController({ name: 'bankName', control: control });
|
|
25
30
|
var bankNameValue = bankNameControl.field.value;
|
|
26
31
|
var hasError = !!((_a = bankNameControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message);
|
|
32
|
+
var bankName = (_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.bank_name;
|
|
27
33
|
var clearValue = function () {
|
|
28
34
|
bankNameControl.field.onChange('');
|
|
29
35
|
};
|
|
30
|
-
|
|
36
|
+
React.useEffect(function () {
|
|
37
|
+
setValue('bankName', bankName);
|
|
38
|
+
}, []);
|
|
39
|
+
var handleBankChange = function (_a) {
|
|
40
|
+
var target = _a.target;
|
|
41
|
+
var value = removeAllOtherThanAlphabetAndSpace(target.value);
|
|
42
|
+
bankNameControl.field.onChange(value);
|
|
43
|
+
};
|
|
44
|
+
return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), onChange: handleBankChange, value: bankNameValue, required: true, disabled: !!bankName, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
|
|
31
45
|
};
|
|
32
46
|
export default BankName;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import Input from '../../../shared/Input';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import { useController, useFormContext } from 'react-hook-form';
|
|
5
6
|
import { styled } from '@mui/material';
|
|
6
7
|
import { removeOnlyNumbers } from '../../../../utils';
|
|
7
8
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
9
|
+
import { bankSelector } from '../../../app/bank/bankStore';
|
|
10
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
8
11
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
9
12
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
10
13
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
@@ -22,13 +25,19 @@ var InputStyled = styled(Input)(function (_a) {
|
|
|
22
25
|
});
|
|
23
26
|
});
|
|
24
27
|
var Beneficiary = function () {
|
|
25
|
-
var _a, _b;
|
|
28
|
+
var _a, _b, _c, _d;
|
|
26
29
|
var t = useTranslation().t;
|
|
27
|
-
var
|
|
30
|
+
var _e = useFormContext(), setValue = _e.setValue, control = _e.control;
|
|
31
|
+
var isAr = useLanguage().isAr;
|
|
32
|
+
var data = useAppSelector(bankSelector).data;
|
|
28
33
|
var beneficiaryControl = useController({ name: 'beneficiaryName', control: control });
|
|
29
34
|
var beneficiaryValue = beneficiaryControl.field.value;
|
|
30
35
|
var hasError = (_a = beneficiaryControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
31
36
|
var error = (_b = beneficiaryControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
37
|
+
var legalName = (_d = (_c = data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.legal_name;
|
|
38
|
+
React.useEffect(function () {
|
|
39
|
+
setValue('beneficiaryName', isAr ? legalName === null || legalName === void 0 ? void 0 : legalName.ar : legalName === null || legalName === void 0 ? void 0 : legalName.en);
|
|
40
|
+
}, []);
|
|
32
41
|
var handleBeneficiaryChange = function (_a) {
|
|
33
42
|
var target = _a.target;
|
|
34
43
|
var value = removeOnlyNumbers(target.value);
|
|
@@ -37,6 +46,6 @@ var Beneficiary = function () {
|
|
|
37
46
|
var clearValue = function () {
|
|
38
47
|
beneficiaryControl.field.onChange('');
|
|
39
48
|
};
|
|
40
|
-
return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('beneficiary_name'), onChange: handleBeneficiaryChange, value: beneficiaryValue, placeholder: t('beneficiary_name'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: !hasError && beneficiaryValue ? _jsx(CheckIcon, {}) : beneficiaryValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
|
|
49
|
+
return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('beneficiary_name'), onChange: handleBeneficiaryChange, disabled: !!legalName, value: beneficiaryValue, placeholder: t('beneficiary_name'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: !hasError && beneficiaryValue ? _jsx(CheckIcon, {}) : beneficiaryValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
|
|
41
50
|
};
|
|
42
51
|
export default Beneficiary;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface IBANProps {
|
|
3
|
+
fetchingIban: (flag: boolean) => void;
|
|
4
|
+
ibanChecking: boolean;
|
|
3
5
|
}
|
|
4
|
-
declare const IBAN: () => JSX.Element;
|
|
6
|
+
declare const IBAN: ({ fetchingIban, ibanChecking }: IBANProps) => JSX.Element;
|
|
5
7
|
export default IBAN;
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
1
37
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
38
|
+
import * as React from 'react';
|
|
2
39
|
import Input from '../../../shared/Input';
|
|
3
40
|
import { useTranslation } from 'react-i18next';
|
|
4
41
|
import { useController, useFormContext } from 'react-hook-form';
|
|
@@ -6,22 +43,48 @@ import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
|
|
|
6
43
|
import { styled } from '@mui/material';
|
|
7
44
|
import { MAX_IBAN_VALUE } from '../../../../constants';
|
|
8
45
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
46
|
+
import { debounce } from 'lodash-es';
|
|
47
|
+
import { checkIbanBank } from '../../../app/bank/bankStore';
|
|
48
|
+
import { useAppDispatch } from '../../../../hooks';
|
|
49
|
+
import axios from 'axios';
|
|
9
50
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
10
51
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
52
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
11
53
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
12
54
|
var theme = _a.theme;
|
|
13
55
|
return ({
|
|
14
56
|
marginBlockEnd: theme.spacing(3)
|
|
15
57
|
});
|
|
16
58
|
});
|
|
17
|
-
var
|
|
18
|
-
|
|
59
|
+
var cancelToken = null;
|
|
60
|
+
var IBAN = function (_a) {
|
|
61
|
+
var _b;
|
|
62
|
+
var fetchingIban = _a.fetchingIban, ibanChecking = _a.ibanChecking;
|
|
63
|
+
var dispatch = useAppDispatch();
|
|
19
64
|
var t = useTranslation().t;
|
|
20
65
|
var control = useFormContext().control;
|
|
21
66
|
var ibanControl = useController({ name: 'iban', control: control });
|
|
22
67
|
var ibanValue = ibanControl.field.value;
|
|
23
|
-
var hasError = !!((_a = ibanControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message);
|
|
24
68
|
var error = (_b = ibanControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
69
|
+
var checkBank = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
+
var onSuccess;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
if (cancelToken) {
|
|
73
|
+
cancelToken.cancel('Aborted');
|
|
74
|
+
}
|
|
75
|
+
cancelToken = axios.CancelToken.source();
|
|
76
|
+
onSuccess = function () { return fetchingIban(false); };
|
|
77
|
+
dispatch(checkIbanBank({ iban: value, cancelToken: cancelToken.token, onSuccess: onSuccess }));
|
|
78
|
+
return [2];
|
|
79
|
+
});
|
|
80
|
+
}); }, 500);
|
|
81
|
+
React.useEffect(function () {
|
|
82
|
+
var isValid = ibanValue && !error && ibanValue.length > 14;
|
|
83
|
+
if (isValid) {
|
|
84
|
+
fetchingIban(true);
|
|
85
|
+
checkBank(ibanValue);
|
|
86
|
+
}
|
|
87
|
+
}, [ibanValue, error]);
|
|
25
88
|
var handleIbanChange = function (_a) {
|
|
26
89
|
var target = _a.target;
|
|
27
90
|
var value = removeAllOtherThanCharsAndNumber(target.value);
|
|
@@ -30,6 +93,6 @@ var IBAN = function () {
|
|
|
30
93
|
var clearValue = function () {
|
|
31
94
|
ibanControl.field.onChange('');
|
|
32
95
|
};
|
|
33
|
-
return (_jsx(FeatureStyled, { children: _jsx(Input, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('enter_iban_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: !
|
|
96
|
+
return (_jsx(FeatureStyled, { children: _jsx(Input, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('enter_iban_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: ibanChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && ibanValue ? (_jsx(CheckIcon, {})) : (ibanValue && _jsx(ClearIcon, { onClick: clearValue })) }) }));
|
|
34
97
|
};
|
|
35
98
|
export default IBAN;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { REGEX_BENEFICIARY_NAME } from '../../../../constants';
|
|
2
2
|
import * as yup from 'yup';
|
|
3
3
|
export var BankValidation = yup.object().shape({
|
|
4
4
|
iban: yup
|
|
@@ -10,6 +10,6 @@ export var BankValidation = yup.object().shape({
|
|
|
10
10
|
bankName: yup.string().required('bank_name_required'),
|
|
11
11
|
beneficiaryName: yup
|
|
12
12
|
.string()
|
|
13
|
-
.matches(
|
|
13
|
+
.matches(REGEX_BENEFICIARY_NAME, 'beneficiary_name_invalid')
|
|
14
14
|
.required('beneficiary_name_required')
|
|
15
15
|
});
|
|
@@ -10,9 +10,7 @@ var Success = function (_a) {
|
|
|
10
10
|
React.useEffect(function () {
|
|
11
11
|
dispatch(updateLeadSuccess());
|
|
12
12
|
}, []);
|
|
13
|
-
var onSuccess = function () {
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess });
|
|
13
|
+
var onSuccess = function () { };
|
|
14
|
+
return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess, successTitle: 'continue' });
|
|
17
15
|
};
|
|
18
16
|
export default React.memo(Success);
|
|
@@ -18,7 +18,7 @@ import Text from '../../../../components/Text';
|
|
|
18
18
|
import Container from '../../../shared/Containers/ScreenContainer';
|
|
19
19
|
import { FlowsButtons } from '../../../shared/Button';
|
|
20
20
|
import { ICONS_NAMES } from '../../../../constants';
|
|
21
|
-
import { useAppSelector } from '../../../../hooks';
|
|
21
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
22
22
|
import { businessSelector } from '../../../app/business/businessStore';
|
|
23
23
|
var TextContainerStyled = styled(Box)(function (_a) {
|
|
24
24
|
var theme = _a.theme;
|
|
@@ -51,6 +51,7 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
|
|
|
51
51
|
});
|
|
52
52
|
var SuccessWithFlowButtons = function () {
|
|
53
53
|
var t = useTranslation().t;
|
|
54
|
+
var isAr = useLanguage().isAr;
|
|
54
55
|
var data = useAppSelector(businessSelector).data;
|
|
55
56
|
var _a = data.verify.responseBody || {}, flows = _a.flows, nameObj = _a.name;
|
|
56
57
|
var _b = useState([]), buttons = _b[0], setButtons = _b[1];
|
|
@@ -78,7 +79,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
78
79
|
useEffect(function () {
|
|
79
80
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
|
|
80
81
|
reMapFlowData(flows);
|
|
81
|
-
}, [flows]);
|
|
82
|
+
}, [flows, isAr]);
|
|
82
83
|
return (_jsxs(ContainerStyled, { children: [_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [t('ide_successfully_verified_message'), " "] }) }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
|
|
83
84
|
};
|
|
84
85
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -10,9 +10,7 @@ var Success = function (_a) {
|
|
|
10
10
|
React.useEffect(function () {
|
|
11
11
|
dispatch(updateLeadSuccess());
|
|
12
12
|
}, []);
|
|
13
|
-
var onSuccess = function () {
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess });
|
|
13
|
+
var onSuccess = function () { };
|
|
14
|
+
return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess, successTitle: 'continue' });
|
|
17
15
|
};
|
|
18
16
|
export default React.memo(Success);
|
|
@@ -4,9 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
5
5
|
var Success = function (_a) {
|
|
6
6
|
var t = useTranslation().t;
|
|
7
|
-
var onSuccess = function () {
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess });
|
|
7
|
+
var onSuccess = function () { };
|
|
8
|
+
return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess, successTitle: 'continue' });
|
|
11
9
|
};
|
|
12
10
|
export default React.memo(Success);
|
|
@@ -10,9 +10,7 @@ var Success = function (_a) {
|
|
|
10
10
|
React.useEffect(function () {
|
|
11
11
|
dispatch(updateLeadSuccess());
|
|
12
12
|
}, []);
|
|
13
|
-
var onSuccess = function () {
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess });
|
|
13
|
+
var onSuccess = function () { };
|
|
14
|
+
return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess, successTitle: 'continue' });
|
|
17
15
|
};
|
|
18
16
|
export default React.memo(Success);
|