@tap-payments/auth-jsconnect 2.8.37-test → 2.8.39-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/api/entity.d.ts +1 -1
- package/build/api/entity.js +6 -2
- package/build/api/index.d.ts +1 -1
- package/build/features/app/bank/bankStore.js +16 -14
- package/build/features/app/tax/taxStore.js +12 -12
- package/build/features/bank/screens/BankDetails/BankDetails.js +11 -3
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +0 -1
- package/build/hooks/useFormDirtyCheck.js +4 -2
- package/package.json +1 -1
package/build/api/entity.d.ts
CHANGED
|
@@ -140,7 +140,7 @@ export declare type CreateEntityBody = {
|
|
|
140
140
|
declare const entityService: {
|
|
141
141
|
createEntityInfo: ({ id, ...data }: EntityInfoBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
142
142
|
updateEntityInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
|
|
143
|
-
createBankAccount: (data: EntityBankUpdateBody
|
|
143
|
+
createBankAccount: (data: EntityBankUpdateBody) => Promise<any>;
|
|
144
144
|
retrieveBankAccount: (id: string) => Promise<any>;
|
|
145
145
|
retrieveEntityInfo: (entity_id: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
146
146
|
updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
|
package/build/api/entity.js
CHANGED
|
@@ -56,8 +56,12 @@ var updateEntityCapital = function (_a) {
|
|
|
56
56
|
data: data
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
|
-
var createBankAccount = function (data
|
|
60
|
-
return
|
|
59
|
+
var createBankAccount = function (data) {
|
|
60
|
+
return httpClient({
|
|
61
|
+
method: 'put',
|
|
62
|
+
url: "".concat(ENDPOINT_PATHS.BANK),
|
|
63
|
+
data: data
|
|
64
|
+
});
|
|
61
65
|
};
|
|
62
66
|
var retrieveBankAccount = function (id) {
|
|
63
67
|
return httpClient({
|
package/build/api/index.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ declare const API: {
|
|
|
60
60
|
entityService: {
|
|
61
61
|
createEntityInfo: ({ id, ...data }: EntityInfoBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
62
62
|
updateEntityInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
|
|
63
|
-
createBankAccount: (data: EntityBankUpdateBody
|
|
63
|
+
createBankAccount: (data: EntityBankUpdateBody) => Promise<any>;
|
|
64
64
|
retrieveBankAccount: (id: string) => Promise<any>;
|
|
65
65
|
retrieveEntityInfo: (entity_id: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
66
66
|
updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
|
|
@@ -236,12 +236,12 @@ export var retrieveBoardDetails = createAsyncThunk('bank/retrieveBoardDetails',
|
|
|
236
236
|
});
|
|
237
237
|
});
|
|
238
238
|
export var createBankAccount = createAsyncThunk('createBankAccount', function (_a, thunkApi) {
|
|
239
|
-
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
239
|
+
var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
|
|
240
240
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
241
|
-
var _b, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, _c, bank_account, wallet_id, recipient, _d, data_status, document, isIBANMasked, isIBANNonEditable, isBeneficiaryNameNonEditable, isBankNameNonEditable, isBankStatementIdNonEditable, isConfirmPolicyNonEditable, documentResponse, hasDocument, documentId, requestBody,
|
|
242
|
-
var _e, _f
|
|
243
|
-
return __generator(this, function (
|
|
244
|
-
switch (
|
|
241
|
+
var _b, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, _c, bank_account, wallet_id, recipient, _d, data_status, document, isIBANMasked, isIBANNonEditable, isBeneficiaryNameNonEditable, isBankNameNonEditable, isBankStatementIdNonEditable, isConfirmPolicyNonEditable, documentResponse, data, hasDocument, documentId, requestBody, documentBody;
|
|
242
|
+
var _e, _f;
|
|
243
|
+
return __generator(this, function (_g) {
|
|
244
|
+
switch (_g.label) {
|
|
245
245
|
case 0:
|
|
246
246
|
_b = thunkApi.getState(), settings = _b.settings, bank = _b.bank;
|
|
247
247
|
iban = formData.iban, beneficiaryName = formData.beneficiaryName, bankName = formData.bankName, bankStatementId = formData.bankStatementId, confirmPolicy = formData.confirmPolicy;
|
|
@@ -254,6 +254,7 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (_
|
|
|
254
254
|
isBankStatementIdNonEditable = hasNoneEditableValue(data_status, 'bank_statement_file_id');
|
|
255
255
|
isConfirmPolicyNonEditable = hasNoneEditableValue(data_status, 'is_acknowledged');
|
|
256
256
|
documentResponse = undefined;
|
|
257
|
+
data = bank_account || {};
|
|
257
258
|
hasDocument = (bankStatementId || []).length > 0;
|
|
258
259
|
documentId = document === null || document === void 0 ? void 0 : document.id;
|
|
259
260
|
requestBody = {
|
|
@@ -270,24 +271,25 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (_
|
|
|
270
271
|
step_name: BANK_STEP_NAMES.BANK_INFO,
|
|
271
272
|
encryption_contract: ['bank_account.iban', 'bank_account.beneficiary_name', 'bank_account.bank_name']
|
|
272
273
|
};
|
|
274
|
+
if (!isDirty) return [3, 2];
|
|
273
275
|
return [4, API.entityService.createBankAccount(requestBody)];
|
|
274
276
|
case 1:
|
|
275
|
-
data =
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (!(!isBankStatementIdNonEditable && documentId && hasDocument)) return [3,
|
|
277
|
+
data = _g.sent();
|
|
278
|
+
_g.label = 2;
|
|
279
|
+
case 2:
|
|
280
|
+
if (!(!isBankStatementIdNonEditable && documentId && hasDocument)) return [3, 4];
|
|
279
281
|
documentBody = {
|
|
280
282
|
id: documentId,
|
|
281
283
|
files: bankStatementId || []
|
|
282
284
|
};
|
|
283
285
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
284
|
-
case 2:
|
|
285
|
-
documentResponse = _h.sent();
|
|
286
|
-
_h.label = 3;
|
|
287
286
|
case 3:
|
|
288
|
-
|
|
287
|
+
documentResponse = _g.sent();
|
|
288
|
+
_g.label = 4;
|
|
289
|
+
case 4:
|
|
290
|
+
data = __assign(__assign({}, data), { documentResponse: documentResponse });
|
|
289
291
|
thunkApi.dispatch(handleNextScreenStep());
|
|
290
|
-
(
|
|
292
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
|
|
291
293
|
return [2, { data: data, formData: originalFormData }];
|
|
292
294
|
}
|
|
293
295
|
});
|
|
@@ -228,10 +228,10 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
|
|
|
228
228
|
export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunkApi) {
|
|
229
229
|
var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
|
|
230
230
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
231
|
-
var _b, settings, tax, _c, entity, recipient, _d, id, data_status, documents, isTaxNumberNonEditable, isConfirmPolicyNonEditable, isDocumentsNonEditable, document, vatId, confirmPolicy, documentId, data, requestBody, documentBody,
|
|
232
|
-
var
|
|
233
|
-
return __generator(this, function (
|
|
234
|
-
switch (
|
|
231
|
+
var _b, settings, tax, _c, entity, recipient, _d, id, data_status, documents, isTaxNumberNonEditable, isConfirmPolicyNonEditable, isDocumentsNonEditable, document, vatId, confirmPolicy, documentId, data, requestBody, documentBody, documentData, documentBody, documentData;
|
|
232
|
+
var _e, _f;
|
|
233
|
+
return __generator(this, function (_g) {
|
|
234
|
+
switch (_g.label) {
|
|
235
235
|
case 0:
|
|
236
236
|
_b = thunkApi.getState(), settings = _b.settings, tax = _b.tax;
|
|
237
237
|
_c = tax.data.verify.responseBody || {}, entity = _c.entity, recipient = _c.recipient;
|
|
@@ -249,8 +249,8 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunk
|
|
|
249
249
|
if (!isDirty) return [3, 2];
|
|
250
250
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
251
251
|
case 1:
|
|
252
|
-
data =
|
|
253
|
-
|
|
252
|
+
data = _g.sent();
|
|
253
|
+
_g.label = 2;
|
|
254
254
|
case 2:
|
|
255
255
|
if (!(!isDocumentsNonEditable && (documentId || []).length > 0)) return [3, 6];
|
|
256
256
|
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 4];
|
|
@@ -258,10 +258,10 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunk
|
|
|
258
258
|
id: document === null || document === void 0 ? void 0 : document.id,
|
|
259
259
|
images: documentId
|
|
260
260
|
};
|
|
261
|
-
_e = data;
|
|
262
261
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
263
262
|
case 3:
|
|
264
|
-
|
|
263
|
+
documentData = _g.sent();
|
|
264
|
+
data = __assign(__assign({}, data), { documentData: documentData });
|
|
265
265
|
return [3, 6];
|
|
266
266
|
case 4:
|
|
267
267
|
documentBody = {
|
|
@@ -273,14 +273,14 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunk
|
|
|
273
273
|
}
|
|
274
274
|
]
|
|
275
275
|
};
|
|
276
|
-
_f = data;
|
|
277
276
|
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
278
277
|
case 5:
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
documentData = _g.sent();
|
|
279
|
+
data = __assign(__assign({}, data), { documentData: documentData });
|
|
280
|
+
_g.label = 6;
|
|
281
281
|
case 6:
|
|
282
282
|
thunkApi.dispatch(handleNextScreenStep());
|
|
283
|
-
(
|
|
283
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
|
|
284
284
|
return [2, { data: data, formData: originalFormData }];
|
|
285
285
|
}
|
|
286
286
|
});
|
|
@@ -16,7 +16,7 @@ import Beneficiary from './Beneficiary';
|
|
|
16
16
|
import IBAN from './IBAN';
|
|
17
17
|
import BankName from './BankName';
|
|
18
18
|
import Button from '../../../shared/Button';
|
|
19
|
-
import { useAppDispatch, useAppSelector, useFormReadOnly, useSetFromDefaultValues, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useAppSelector, useFormReadOnly, useSetFromDefaultValues, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
|
|
20
20
|
import { BankKWFLValidation, BankValidation } from './validation';
|
|
21
21
|
import { useTranslation } from 'react-i18next';
|
|
22
22
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -50,7 +50,7 @@ var BankDetails = function () {
|
|
|
50
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
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
|
+
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, is_acknowledged = _g.is_acknowledged;
|
|
54
54
|
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
55
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;
|
|
56
56
|
var bankHasDocument = ((_b = document === null || document === void 0 ? void 0 : document.file_details) === null || _b === void 0 ? void 0 : _b.length) > 0;
|
|
@@ -101,9 +101,17 @@ var BankDetails = function () {
|
|
|
101
101
|
var isBeneficiaryNameVerified = dataVerified['beneficiary_name'] && beneficiary_name === methods.watch('beneficiaryName');
|
|
102
102
|
var isIBANVerified = dataVerified['iban'] && resIban === methods.watch('iban');
|
|
103
103
|
var isBankNameVerified = dataVerified['bank_name'] && bank_name === methods.watch('bankName');
|
|
104
|
+
var isDirty = useFormDirtyCheck(methods, {
|
|
105
|
+
iban: resIban,
|
|
106
|
+
beneficiaryName: beneficiary_name,
|
|
107
|
+
bankName: bank_name,
|
|
108
|
+
confirmPolicy: is_acknowledged
|
|
109
|
+
}).isDirty;
|
|
110
|
+
console.log('isDirty', isDirty);
|
|
104
111
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
105
112
|
var onSubmit = function (data) {
|
|
106
|
-
|
|
113
|
+
var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
|
|
114
|
+
dispatch(createBankAccount(formData));
|
|
107
115
|
};
|
|
108
116
|
var disableBack = settingsData.appConfig.mode === 'content';
|
|
109
117
|
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({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
|
|
@@ -59,7 +59,6 @@ var TaxDetails = function () {
|
|
|
59
59
|
vatId: entity === null || entity === void 0 ? void 0 : entity.vat_id,
|
|
60
60
|
confirmPolicy: entity === null || entity === void 0 ? void 0 : entity.is_vat_acknowledged
|
|
61
61
|
}).isDirty;
|
|
62
|
-
console.log('isDirty', isDirty);
|
|
63
62
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
64
63
|
var isVatIdVerified = dataVerified['tax_number'] && vat_id === methods.watch('vatId');
|
|
65
64
|
var t = useTranslation().t;
|
|
@@ -3,18 +3,20 @@ import _ from 'lodash';
|
|
|
3
3
|
export var useFormDirtyCheck = function (method, backendData) {
|
|
4
4
|
var _a = React.useState(false), isDirty = _a[0], setIsDirty = _a[1];
|
|
5
5
|
var data = method.watch();
|
|
6
|
-
var isValidData = function (data) {
|
|
6
|
+
var isValidData = function (data, backendData) {
|
|
7
7
|
if (data === undefined)
|
|
8
8
|
return false;
|
|
9
9
|
if (Array.isArray(data) && !data.length)
|
|
10
10
|
return false;
|
|
11
|
+
if (data === '' && !backendData)
|
|
12
|
+
return false;
|
|
11
13
|
return true;
|
|
12
14
|
};
|
|
13
15
|
var deepComparison = function (data, backendData) {
|
|
14
16
|
for (var key in backendData) {
|
|
15
17
|
var formValue = data === null || data === void 0 ? void 0 : data[key];
|
|
16
18
|
var backEndValue = backendData === null || backendData === void 0 ? void 0 : backendData[key];
|
|
17
|
-
if (isValidData(formValue) && !_.isEqual(formValue, backEndValue))
|
|
19
|
+
if (isValidData(formValue, backEndValue) && !_.isEqual(formValue, backEndValue))
|
|
18
20
|
return true;
|
|
19
21
|
}
|
|
20
22
|
return false;
|