@tap-payments/auth-jsconnect 2.4.8-test → 2.4.10-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/@types/app.d.ts +27 -0
- package/build/features/bank/screens/BankDetails/BankDetails.js +16 -12
- package/build/features/bank/screens/BankDetails/BankStatement.js +2 -1
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +8 -5
- package/build/features/tax/screens/TaxDetails/TaxDocument.js +8 -2
- package/build/features/tax/screens/TaxDetails/VATId.d.ts +2 -1
- package/build/features/tax/screens/TaxDetails/VATId.js +3 -5
- package/build/utils/array.js +1 -1
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
|
@@ -523,4 +523,31 @@ export declare type BrandDataVerification = {
|
|
|
523
523
|
'segment.type': string;
|
|
524
524
|
terms: string;
|
|
525
525
|
};
|
|
526
|
+
export declare type EntityDataVerification = {
|
|
527
|
+
AOA_file_id: string;
|
|
528
|
+
billing_address: string;
|
|
529
|
+
'capital.announced': string;
|
|
530
|
+
'capital.paid': string;
|
|
531
|
+
'capital.shares.count': string;
|
|
532
|
+
'capital.shares.value': string;
|
|
533
|
+
'capital.subscribed': string;
|
|
534
|
+
country: string;
|
|
535
|
+
is_licensed: string;
|
|
536
|
+
is_vat_acknowledged: string;
|
|
537
|
+
'legal_name.ar': string;
|
|
538
|
+
'legal_name.en': string;
|
|
539
|
+
'license.additional_info': string;
|
|
540
|
+
'license.expiry_date': string;
|
|
541
|
+
'license.issuing_date': string;
|
|
542
|
+
'license.number': string;
|
|
543
|
+
'license.provider': string;
|
|
544
|
+
'license.status': string;
|
|
545
|
+
'license.type': string;
|
|
546
|
+
location: string;
|
|
547
|
+
not_for_profit: string;
|
|
548
|
+
settlement_by: string;
|
|
549
|
+
tax_number: string;
|
|
550
|
+
taxable: string;
|
|
551
|
+
type: string;
|
|
552
|
+
};
|
|
526
553
|
export {};
|
|
@@ -42,17 +42,18 @@ var ButtonStyled = styled(Button)(function (_a) {
|
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
var BankDetails = function () {
|
|
45
|
-
var _a, _b
|
|
46
|
-
var
|
|
45
|
+
var _a, _b;
|
|
46
|
+
var _c = React.useState(false), ibanChecking = _c[0], setIbanChecking = _c[1];
|
|
47
47
|
var dispatch = useAppDispatch();
|
|
48
|
-
var
|
|
48
|
+
var _d = useAppSelector(bankSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
49
49
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
50
|
-
var
|
|
50
|
+
var _e = data.bankData, iban = _e.iban, beneficiaryName = _e.beneficiaryName, bankName = _e.bankName, bankStatementId = _e.bankStatementId, bankStatementUploading = _e.uploading, confirmPolicy = _e.confirmPolicy;
|
|
51
51
|
var verify = data.verify;
|
|
52
|
-
var
|
|
52
|
+
var _f = verify.responseBody || {}, bank_account = _f.bank_account, entity = _f.entity, flows = _f.flows;
|
|
53
|
+
var _g = bank_account || {}, document = _g.document, data_status = _g.data_status, data_verification = _g.data_verification, beneficiary_name = _g.beneficiary_name, resIban = _g.iban, bank_name = _g.bank_name;
|
|
53
54
|
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
54
55
|
var isFL = ((_a = entity === null || entity === void 0 ? void 0 : entity.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === BusinessType.FL ? true : false;
|
|
55
|
-
var bankHasDocument = ((
|
|
56
|
+
var bankHasDocument = ((_b = document === null || document === void 0 ? void 0 : document.file_details) === null || _b === void 0 ? void 0 : _b.length) > 0;
|
|
56
57
|
var isIBANMasked = isStringHasOneAsterisk(iban);
|
|
57
58
|
var methods = useForm({
|
|
58
59
|
resolver: yupResolver(isKWCountry && isFL && !bankHasDocument ? BankKWFLValidation(isIBANMasked) : BankValidation(isIBANMasked)),
|
|
@@ -82,12 +83,12 @@ var BankDetails = function () {
|
|
|
82
83
|
dispatch(clearError());
|
|
83
84
|
}, [methods.formState.isValid, methods.watch('bankStatementId')]);
|
|
84
85
|
var defaultBankFiles = React.useMemo(function () {
|
|
85
|
-
if (!
|
|
86
|
+
if (!document)
|
|
86
87
|
return [];
|
|
87
|
-
return getFileDetailsFromDocument([
|
|
88
|
-
}, [
|
|
88
|
+
return getFileDetailsFromDocument([document], DocumentPurpose.BANK_STATEMENT);
|
|
89
|
+
}, [document]);
|
|
89
90
|
var originalReadOnly = useFormReadOnly(methods, { bankStatementId: defaultBankFiles });
|
|
90
|
-
var noneEditable = useDataNoneEditable(
|
|
91
|
+
var noneEditable = useDataNoneEditable(data_status, [
|
|
91
92
|
'beneficiary_name',
|
|
92
93
|
'bank_name',
|
|
93
94
|
'iban',
|
|
@@ -95,12 +96,15 @@ var BankDetails = function () {
|
|
|
95
96
|
'bank_statement_file_id',
|
|
96
97
|
'is_acknowledged'
|
|
97
98
|
]);
|
|
98
|
-
var dataVerified = useDataVerified(
|
|
99
|
+
var dataVerified = useDataVerified(data_verification, ['bank_name', 'beneficiary_name', 'document', 'iban']);
|
|
99
100
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
101
|
+
var isBeneficiaryNameVerified = dataVerified['beneficiary_name'] && beneficiary_name === methods.watch('beneficiaryName');
|
|
102
|
+
var isIBANVerified = dataVerified['iban'] && resIban === methods.watch('iban');
|
|
103
|
+
var isBankNameVerified = dataVerified['bank_name'] && bank_name === methods.watch('bankName');
|
|
100
104
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
101
105
|
var onSubmit = function (data) {
|
|
102
106
|
dispatch(createBankAccount(getFelids(data)));
|
|
103
107
|
};
|
|
104
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, { readOnly: readOnly['beneficiaryName'] || noneEditable['beneficiary_name'], isVerified:
|
|
108
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, { readOnly: readOnly['beneficiaryName'] || noneEditable['beneficiary_name'], isVerified: isBeneficiaryNameVerified }), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking, readOnly: readOnly['iban'] || noneEditable['iban'], isVerified: isIBANVerified }), _jsx(BankName, { readOnly: readOnly['bankName'] || noneEditable['bank_name'], isVerified: isBankNameVerified }), _jsx(BankStatement, { isVerified: dataVerified['document'], required: isKWCountry && isFL && !bankHasDocument, defaultFiles: defaultBankFiles, readOnly: readOnly['bankStatementId'] || noneEditable['bank_statement_file_id'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['confirmPolicy'] || noneEditable['is_acknowledged'] }), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
|
|
105
109
|
};
|
|
106
110
|
export default BankDetails;
|
|
@@ -21,12 +21,13 @@ var BankStatement = function (_a) {
|
|
|
21
21
|
var bankStatementIdControl = useController({ name: 'bankStatementId', control: control });
|
|
22
22
|
var loading = useAppSelector(bankSelector).loading;
|
|
23
23
|
var dispatch = useAppDispatch();
|
|
24
|
+
var uploadedIds = bankStatementIdControl.field.value;
|
|
24
25
|
var handleBankStatementChange = function (ids) {
|
|
25
26
|
bankStatementIdControl.field.onChange(ids);
|
|
26
27
|
};
|
|
27
28
|
var handleReset = function (ids) {
|
|
28
29
|
bankStatementIdControl.field.onChange(ids);
|
|
29
30
|
};
|
|
30
|
-
return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'bankStatementId', control: control, label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isSubmitting: loading, required: required, onDeleteFile: handleReset, purpose: DocumentPurpose.BANK_STATEMENT, defaultFiles: defaultFiles, maxLimit: 4, fileUploadingStatus: function (uploading) { return dispatch(bankStatementUploadingStatus(uploading)); }, fileType: FileType.FILES, isVerified: isVerified }) }));
|
|
31
|
+
return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'bankStatementId', control: control, label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isSubmitting: loading, required: required, onDeleteFile: handleReset, purpose: DocumentPurpose.BANK_STATEMENT, defaultFiles: defaultFiles, maxLimit: 4, fileUploadingStatus: function (uploading) { return dispatch(bankStatementUploadingStatus(uploading)); }, fileType: FileType.FILES, isVerified: !(uploadedIds === null || uploadedIds === void 0 ? void 0 : uploadedIds.length) && isVerified }) }));
|
|
31
32
|
};
|
|
32
33
|
export default BankStatement;
|
|
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import Form from '../../../../components/Form';
|
|
19
|
-
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
20
20
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
21
|
import { DocumentPurpose } from '../../../../@types';
|
|
22
22
|
import { getFileDetailsFromDocument, isSA } from '../../../../utils';
|
|
@@ -37,8 +37,9 @@ var TaxDetails = function () {
|
|
|
37
37
|
var dispatch = useAppDispatch();
|
|
38
38
|
var _a = useAppSelector(taxSelector), data = _a.data, loading = _a.loading, error = _a.error, uploading = _a.uploading;
|
|
39
39
|
var _b = data.verify.responseBody || {}, entity = _b.entity, flows = _b.flows;
|
|
40
|
+
var _c = entity || {}, documents = _c.documents, data_status = _c.data_status, data_verification = _c.data_verification, vat_id = _c.vat_id;
|
|
40
41
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
41
|
-
var
|
|
42
|
+
var _d = data.taxData, vatId = _d.vatId, confirmPolicy = _d.confirmPolicy, documentId = _d.documentId;
|
|
42
43
|
var methods = useForm({
|
|
43
44
|
resolver: yupResolver(Validation()),
|
|
44
45
|
defaultValues: {
|
|
@@ -49,11 +50,13 @@ var TaxDetails = function () {
|
|
|
49
50
|
mode: 'onChange'
|
|
50
51
|
});
|
|
51
52
|
useSetFromDefaultValues(methods, data.taxData);
|
|
52
|
-
var defaultTaxFiles = React.useMemo(function () { return getFileDetailsFromDocument(
|
|
53
|
+
var defaultTaxFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.TAX_DOCUMENT); }, [documents]);
|
|
53
54
|
var originalReadOnly = useFormReadOnly(methods, { documentId: defaultTaxFiles });
|
|
54
|
-
var noneEditable = useDataNoneEditable(
|
|
55
|
+
var noneEditable = useDataNoneEditable(data_status, ['tax_number', 'documents', 'is_vat_acknowledged']);
|
|
55
56
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
57
|
+
var dataVerified = useDataVerified(data_verification, ['tax_number']);
|
|
56
58
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
59
|
+
var isVatIdVerified = dataVerified['tax_number'] && vat_id === methods.watch('vatId');
|
|
57
60
|
var t = useTranslation().t;
|
|
58
61
|
var isAr = useLanguage().isAr;
|
|
59
62
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
@@ -67,6 +70,6 @@ var TaxDetails = function () {
|
|
|
67
70
|
}
|
|
68
71
|
dispatch(retrieveBoardStatus());
|
|
69
72
|
};
|
|
70
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, { readOnly: readOnly['vatId'] || noneEditable['tax_number'] }), _jsx(TaxDocument, { show: isSACountry, defaultFiles: defaultTaxFiles, readOnly: readOnly['documentId'] || noneEditable['documents'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['confirmPolicy'] || noneEditable['is_vat_acknowledged'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid || uploading, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
73
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, { readOnly: readOnly['vatId'] || noneEditable['tax_number'], isVerified: isVatIdVerified }), _jsx(TaxDocument, { show: isSACountry, defaultFiles: defaultTaxFiles, readOnly: readOnly['documentId'] || noneEditable['documents'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['confirmPolicy'] || noneEditable['is_vat_acknowledged'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid || uploading, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
71
74
|
};
|
|
72
75
|
export default TaxDetails;
|
|
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
13
14
|
import { useTranslation } from 'react-i18next';
|
|
14
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
@@ -20,6 +21,7 @@ import { FileType } from '../../../../constants';
|
|
|
20
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
22
|
import { taxSelector, uploadingStatus } from '../../../app/tax/taxStore';
|
|
22
23
|
import UploadMultipleFile from '../../../shared/UploadMultipleFile';
|
|
24
|
+
import { hasVerifiedValue } from '../../../../utils';
|
|
23
25
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
24
26
|
var theme = _a.theme;
|
|
25
27
|
return ({
|
|
@@ -27,18 +29,22 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
27
29
|
});
|
|
28
30
|
});
|
|
29
31
|
var TaxDocument = function (_a) {
|
|
32
|
+
var _b;
|
|
30
33
|
var show = _a.show, readOnly = _a.readOnly, defaultFiles = _a.defaultFiles;
|
|
31
34
|
var t = useTranslation().t;
|
|
32
35
|
var control = useFormContext().control;
|
|
33
36
|
var dispatch = useAppDispatch();
|
|
34
37
|
var documentIdControl = useController({ name: 'documentId', control: control });
|
|
35
|
-
var
|
|
38
|
+
var _c = useAppSelector(taxSelector), loading = _c.loading, data = _c.data;
|
|
39
|
+
var data_verification = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) || {}).data_verification;
|
|
40
|
+
var uploadedIds = documentIdControl.field.value;
|
|
36
41
|
var handleTaxDocumentChange = function (ids) {
|
|
37
42
|
documentIdControl.field.onChange(ids);
|
|
38
43
|
};
|
|
39
44
|
var handleReset = function (ids) {
|
|
40
45
|
documentIdControl.field.onChange(ids);
|
|
41
46
|
};
|
|
42
|
-
|
|
47
|
+
var isDocumentVerified = React.useMemo(function () { var _a; return !!((_a = defaultFiles === null || defaultFiles === void 0 ? void 0 : defaultFiles[0]) === null || _a === void 0 ? void 0 : _a.docId) && hasVerifiedValue(data_verification, "documents.".concat(defaultFiles[0].docId)); }, [data_verification]);
|
|
48
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, __assign({ sx: { mb: 2.5 } }, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'documentId', control: control, label: t('title_tax_document'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_tax_document'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleTaxDocumentChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.TAX_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES, isVerified: !(uploadedIds === null || uploadedIds === void 0 ? void 0 : uploadedIds.length) && isDocumentVerified }) })) })));
|
|
43
49
|
};
|
|
44
50
|
export default TaxDocument;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare type VATIdProps = {
|
|
3
3
|
readOnly?: boolean;
|
|
4
|
+
isVerified?: boolean;
|
|
4
5
|
};
|
|
5
|
-
declare const VATId: ({ readOnly }: VATIdProps) => JSX.Element;
|
|
6
|
+
declare const VATId: ({ readOnly, isVerified }: VATIdProps) => JSX.Element;
|
|
6
7
|
export default VATId;
|
|
@@ -19,17 +19,15 @@ import { VAT_ID_LENGTH } from '../../../../constants';
|
|
|
19
19
|
import { useAppSelector } from '../../../../hooks';
|
|
20
20
|
import { isSA, removeAllCharsFromNumber } from '../../../../utils';
|
|
21
21
|
import { settingsSelector } from '../../../../app/settings';
|
|
22
|
-
import
|
|
23
|
-
import CheckIcon from '../../../shared/CheckIcon';
|
|
22
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
24
23
|
var VATId = function (_a) {
|
|
25
24
|
var _b;
|
|
26
|
-
var readOnly = _a.readOnly;
|
|
25
|
+
var readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
27
26
|
var t = useTranslation().t;
|
|
28
27
|
var control = useFormContext().control;
|
|
29
28
|
var vatControl = useController({ name: 'vatId', control: control });
|
|
30
29
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
31
30
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
32
|
-
var disabled = false;
|
|
33
31
|
var handleOnChange = function (vat) {
|
|
34
32
|
var value = removeAllCharsFromNumber(vat);
|
|
35
33
|
vatControl.field.onChange(value);
|
|
@@ -39,6 +37,6 @@ var VATId = function (_a) {
|
|
|
39
37
|
var clearValue = function () {
|
|
40
38
|
vatControl.field.onChange('');
|
|
41
39
|
};
|
|
42
|
-
return (_jsx(Box, __assign({ sx: isSACountry ? {} : { height: '200px' } }, { children: _jsx(Input, { readOnly: readOnly, label: t('vat_id'),
|
|
40
|
+
return (_jsx(Box, __assign({ sx: isSACountry ? {} : { height: '200px' } }, { children: _jsx(Input, { readOnly: readOnly, label: t('vat_id'), inputProps: { maxLength: VAT_ID_LENGTH }, value: vatValue || '', onChange: function (event) { return handleOnChange(event.target.value); }, placeholder: t('vat_id_placeholder'), warningType: 'alert', warningMessage: vatError && t(vatError), required: true, endAdornment: _jsx(EndAdornment, { value: vatValue, isVerified: isVerified, error: vatError, onClear: clearValue }) }) })));
|
|
43
41
|
};
|
|
44
42
|
export default VATId;
|
package/build/utils/array.js
CHANGED
|
@@ -170,7 +170,7 @@ export var getRecentDocumentBasedOnPurpose = function (documents, purpose) {
|
|
|
170
170
|
}
|
|
171
171
|
else {
|
|
172
172
|
return documents
|
|
173
|
-
.filter(function (doc) { var _a; return ((_a = doc.file_details) === null || _a === void 0 ? void 0 : _a.length) ===
|
|
173
|
+
.filter(function (doc) { var _a; return !((_a = doc.file_details) === null || _a === void 0 ? void 0 : _a.length) && (doc.type === purpose || doc.id); })
|
|
174
174
|
.sort(function (a, b) { return b.created - a.created; })[0];
|
|
175
175
|
}
|
|
176
176
|
};
|