@tap-payments/auth-jsconnect 2.4.8-test → 2.4.11-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/api/entity.d.ts +2 -0
- package/build/api/individual.d.ts +1 -0
- package/build/features/app/bank/bankStore.d.ts +1 -0
- package/build/features/app/bank/bankStore.js +48 -40
- package/build/features/app/brand/brandStore.d.ts +2 -0
- package/build/features/app/brand/brandStore.js +68 -54
- package/build/features/app/tax/taxStore.js +27 -20
- 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 {};
|
package/build/api/entity.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare type EntityInfoBody = {
|
|
|
32
32
|
};
|
|
33
33
|
step_name: string;
|
|
34
34
|
encryption_contract?: Array<string>;
|
|
35
|
+
vat_acknowledged_by?: string;
|
|
35
36
|
};
|
|
36
37
|
export declare type BankDocumentInfo = {
|
|
37
38
|
type?: string;
|
|
@@ -43,6 +44,7 @@ export declare type BankDocumentInfo = {
|
|
|
43
44
|
};
|
|
44
45
|
export declare type EntityBankUpdateBody = {
|
|
45
46
|
wallet_id: string;
|
|
47
|
+
acknowledged_by: string;
|
|
46
48
|
bank_account: {
|
|
47
49
|
bank_name?: string;
|
|
48
50
|
beneficiary_name?: string;
|
|
@@ -55,10 +55,10 @@ import { hasNoneEditableValue, isStringHasOneAsterisk, sleep } from '../../../ut
|
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
|
|
56
56
|
var token = _a.token, isInternally = _a.isInternally;
|
|
57
57
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var payload, data, boardData, board_id, countryIso2;
|
|
59
|
-
var
|
|
60
|
-
return __generator(this, function (
|
|
61
|
-
switch (
|
|
58
|
+
var payload, data, boardData, boardInfoData, _b, board_id, board_info_id, countryIso2;
|
|
59
|
+
var _c, _d, _e, _f;
|
|
60
|
+
return __generator(this, function (_g) {
|
|
61
|
+
switch (_g.label) {
|
|
62
62
|
case 0:
|
|
63
63
|
payload = {
|
|
64
64
|
service_name: 'tap_email',
|
|
@@ -66,17 +66,23 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
|
|
|
66
66
|
};
|
|
67
67
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
68
68
|
case 1:
|
|
69
|
-
data = (
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return [
|
|
69
|
+
data = (_g.sent()).data;
|
|
70
|
+
boardInfoData = undefined;
|
|
71
|
+
if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
|
|
72
|
+
throw new Error(data.errors[0].description);
|
|
73
|
+
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
74
|
+
if (!board_id) return [3, 5];
|
|
75
|
+
if (!board_info_id) return [3, 3];
|
|
76
|
+
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
75
77
|
case 2:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
case 3:
|
|
79
|
-
|
|
78
|
+
boardInfoData = _g.sent();
|
|
79
|
+
_g.label = 3;
|
|
80
|
+
case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
81
|
+
case 4:
|
|
82
|
+
boardData = _g.sent();
|
|
83
|
+
_g.label = 5;
|
|
84
|
+
case 5:
|
|
85
|
+
countryIso2 = (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.country;
|
|
80
86
|
if (countryIso2)
|
|
81
87
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
82
88
|
if (isInternally)
|
|
@@ -87,22 +93,22 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
|
|
|
87
93
|
else if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
|
|
88
94
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
89
95
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
return [2, {
|
|
97
|
+
data: data,
|
|
98
|
+
boardResponse: {
|
|
99
|
+
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
100
|
+
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
101
|
+
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
102
|
+
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
103
|
+
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
104
|
+
name: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.names,
|
|
105
|
+
contact: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.contact,
|
|
106
|
+
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
107
|
+
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
108
|
+
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
|
|
109
|
+
},
|
|
110
|
+
token: token
|
|
111
|
+
}];
|
|
106
112
|
}
|
|
107
113
|
});
|
|
108
114
|
});
|
|
@@ -182,14 +188,15 @@ export var retrieveBoardDetails = createAsyncThunk('bank/retrieveBoardDetails',
|
|
|
182
188
|
export var createBankAccount = createAsyncThunk('createBankAccount', function (_a, thunkApi) {
|
|
183
189
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
184
190
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
185
|
-
var _b, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, _c, data_status, document, isIBANMasked, isIBANNonEditable, isBeneficiaryNameNonEditable, isBankNameNonEditable, isBankStatementIdNonEditable, isConfirmPolicyNonEditable, documentResponse, hasDocument, documentId, requestBody, data, documentBody;
|
|
186
|
-
var
|
|
187
|
-
return __generator(this, function (
|
|
188
|
-
switch (
|
|
191
|
+
var _b, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, _c, bank_account, notification, _d, data_status, document, isIBANMasked, isIBANNonEditable, isBeneficiaryNameNonEditable, isBankNameNonEditable, isBankStatementIdNonEditable, isConfirmPolicyNonEditable, documentResponse, hasDocument, documentId, requestBody, data, documentBody;
|
|
192
|
+
var _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
193
|
+
return __generator(this, function (_p) {
|
|
194
|
+
switch (_p.label) {
|
|
189
195
|
case 0:
|
|
190
196
|
_b = thunkApi.getState(), settings = _b.settings, bank = _b.bank;
|
|
191
197
|
iban = formData.iban, beneficiaryName = formData.beneficiaryName, bankName = formData.bankName, bankStatementId = formData.bankStatementId, confirmPolicy = formData.confirmPolicy;
|
|
192
|
-
_c =
|
|
198
|
+
_c = bank.data.verify.responseBody || {}, bank_account = _c.bank_account, notification = _c.notification;
|
|
199
|
+
_d = bank_account || {}, data_status = _d.data_status, document = _d.document;
|
|
193
200
|
isIBANMasked = isStringHasOneAsterisk(iban);
|
|
194
201
|
isIBANNonEditable = hasNoneEditableValue(data_status, 'iban');
|
|
195
202
|
isBeneficiaryNameNonEditable = hasNoneEditableValue(data_status, 'beneficiary_name');
|
|
@@ -201,6 +208,7 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (_
|
|
|
201
208
|
documentId = document === null || document === void 0 ? void 0 : document.id;
|
|
202
209
|
requestBody = {
|
|
203
210
|
wallet_id: (_j = (_h = (_g = (_f = (_e = bank.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.business) === null || _f === void 0 ? void 0 : _f.entity) === null || _g === void 0 ? void 0 : _g.merchant) === null || _h === void 0 ? void 0 : _h.wallet) === null || _j === void 0 ? void 0 : _j.id,
|
|
211
|
+
acknowledged_by: (_k = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _k === void 0 ? void 0 : _k.id,
|
|
204
212
|
bank_account: __assign({ iban: isIBANNonEditable || isIBANMasked ? undefined : iban, beneficiary_name: isBeneficiaryNameNonEditable ? undefined : beneficiaryName, bank_name: isBankNameNonEditable ? undefined : bankName, is_acknowledged: isConfirmPolicyNonEditable ? undefined : confirmPolicy }, (!(isBankStatementIdNonEditable || documentId || !hasDocument) && {
|
|
205
213
|
document: {
|
|
206
214
|
type: DocumentPurpose.BANK_STATEMENT,
|
|
@@ -212,8 +220,8 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (_
|
|
|
212
220
|
};
|
|
213
221
|
return [4, API.entityService.createBankAccount(requestBody)];
|
|
214
222
|
case 1:
|
|
215
|
-
data = (
|
|
216
|
-
if ((
|
|
223
|
+
data = (_p.sent()).data;
|
|
224
|
+
if ((_l = data.errors) === null || _l === void 0 ? void 0 : _l.length)
|
|
217
225
|
throw new Error(data.errors[0].description);
|
|
218
226
|
if (!(!isBankStatementIdNonEditable && documentId && hasDocument)) return [3, 3];
|
|
219
227
|
documentBody = {
|
|
@@ -222,12 +230,12 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (_
|
|
|
222
230
|
};
|
|
223
231
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
224
232
|
case 2:
|
|
225
|
-
documentResponse =
|
|
226
|
-
|
|
233
|
+
documentResponse = _p.sent();
|
|
234
|
+
_p.label = 3;
|
|
227
235
|
case 3:
|
|
228
236
|
data.documentData = documentResponse;
|
|
229
237
|
thunkApi.dispatch(handleNextScreenStep());
|
|
230
|
-
(
|
|
238
|
+
(_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, requestBody);
|
|
231
239
|
return [2, { data: data, formData: originalFormData }];
|
|
232
240
|
}
|
|
233
241
|
});
|
|
@@ -17,6 +17,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
17
17
|
contact: any;
|
|
18
18
|
individuals: any;
|
|
19
19
|
business: any;
|
|
20
|
+
notification: any;
|
|
20
21
|
};
|
|
21
22
|
salesChannels: any;
|
|
22
23
|
segmentsList: any;
|
|
@@ -38,6 +39,7 @@ export declare const verifyBrandLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
38
39
|
contact: any;
|
|
39
40
|
individuals: any;
|
|
40
41
|
business: any;
|
|
42
|
+
notification: any;
|
|
41
43
|
};
|
|
42
44
|
salesChannels: any;
|
|
43
45
|
segmentsList: any;
|
|
@@ -66,10 +66,10 @@ import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, slee
|
|
|
66
66
|
export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
|
|
67
67
|
var token = _a.token, isInternally = _a.isInternally;
|
|
68
68
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
-
var payload, data, countryIso2, board_id, segmentsList, salesChannels, teamSizeList, boardData;
|
|
70
|
-
var
|
|
71
|
-
return __generator(this, function (
|
|
72
|
-
switch (
|
|
69
|
+
var payload, data, countryIso2, _b, board_id, board_info_id, segmentsList, salesChannels, teamSizeList, boardData, boardInfoData;
|
|
70
|
+
var _c, _d, _e;
|
|
71
|
+
return __generator(this, function (_f) {
|
|
72
|
+
switch (_f.label) {
|
|
73
73
|
case 0:
|
|
74
74
|
payload = {
|
|
75
75
|
service_name: 'tap_email',
|
|
@@ -77,41 +77,46 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
|
|
|
77
77
|
};
|
|
78
78
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
79
79
|
case 1:
|
|
80
|
-
data = (
|
|
80
|
+
data = (_f.sent()).data;
|
|
81
81
|
if ((data === null || data === void 0 ? void 0 : data.errors) && (data === null || data === void 0 ? void 0 : data.mw_error)) {
|
|
82
82
|
throw new Error(data.errors[0].description);
|
|
83
83
|
}
|
|
84
84
|
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
85
85
|
if (countryIso2)
|
|
86
86
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
87
|
-
|
|
87
|
+
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
88
88
|
if (!board_id) {
|
|
89
89
|
throw new Error('Internal server error');
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
boardInfoData = undefined;
|
|
92
92
|
if (isInternally)
|
|
93
93
|
data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
|
|
94
|
-
if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3,
|
|
95
|
-
return [
|
|
94
|
+
if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 8];
|
|
95
|
+
if (!board_info_id) return [3, 3];
|
|
96
|
+
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
96
97
|
case 2:
|
|
97
|
-
|
|
98
|
+
boardInfoData = _f.sent();
|
|
99
|
+
_f.label = 3;
|
|
100
|
+
case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
101
|
+
case 4:
|
|
102
|
+
boardData = _f.sent();
|
|
98
103
|
if (!countryIso2) {
|
|
99
|
-
countryIso2 = (
|
|
104
|
+
countryIso2 = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country;
|
|
100
105
|
if (countryIso2)
|
|
101
106
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
102
107
|
}
|
|
103
108
|
return [4, API.dataService.getSegments({ page: 0 })];
|
|
104
|
-
case
|
|
105
|
-
segmentsList =
|
|
109
|
+
case 5:
|
|
110
|
+
segmentsList = _f.sent();
|
|
106
111
|
return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
107
|
-
case
|
|
108
|
-
salesChannels =
|
|
112
|
+
case 6:
|
|
113
|
+
salesChannels = _f.sent();
|
|
109
114
|
return [4, API.dataService.getTeamSize({ page: 0 })];
|
|
110
|
-
case
|
|
111
|
-
teamSizeList =
|
|
115
|
+
case 7:
|
|
116
|
+
teamSizeList = _f.sent();
|
|
112
117
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
|
|
113
|
-
|
|
114
|
-
case
|
|
118
|
+
_f.label = 8;
|
|
119
|
+
case 8: return [2, {
|
|
115
120
|
data: data,
|
|
116
121
|
boardResponse: {
|
|
117
122
|
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
@@ -119,10 +124,11 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
|
|
|
119
124
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
120
125
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
121
126
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
122
|
-
name: (
|
|
123
|
-
contact: (
|
|
127
|
+
name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
|
|
128
|
+
contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
|
|
124
129
|
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
125
|
-
business: boardData === null || boardData === void 0 ? void 0 : boardData.business
|
|
130
|
+
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
131
|
+
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
|
|
126
132
|
},
|
|
127
133
|
salesChannels: salesChannels,
|
|
128
134
|
segmentsList: segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.list,
|
|
@@ -151,42 +157,48 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
|
|
|
151
157
|
});
|
|
152
158
|
}); });
|
|
153
159
|
export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
-
var _a, brand, settings, responseBody, payload, data, board_id, boardData, segmentsList, salesChannels, teamSizeList;
|
|
155
|
-
var
|
|
156
|
-
return __generator(this, function (
|
|
157
|
-
switch (
|
|
160
|
+
var _a, brand, settings, responseBody, payload, data, _b, board_id, board_info_id, boardInfoData, boardData, segmentsList, salesChannels, teamSizeList;
|
|
161
|
+
var _c, _d, _e, _f, _g, _h;
|
|
162
|
+
return __generator(this, function (_j) {
|
|
163
|
+
switch (_j.label) {
|
|
158
164
|
case 0:
|
|
159
165
|
_a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
|
|
160
166
|
responseBody = brand.data.verify.responseBody;
|
|
161
167
|
payload = {
|
|
162
168
|
data: params.otp,
|
|
163
|
-
service_name: (
|
|
169
|
+
service_name: (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _c === void 0 ? void 0 : _c.service_name,
|
|
164
170
|
verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
|
|
165
171
|
step_name: BRAND_STEP_NAMES.PHONE_AUTH,
|
|
166
172
|
encryption_contract: ['data']
|
|
167
173
|
};
|
|
168
174
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
169
175
|
case 1:
|
|
170
|
-
data = (
|
|
171
|
-
if ((
|
|
176
|
+
data = (_j.sent()).data;
|
|
177
|
+
if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
|
|
172
178
|
throw new Error(data.errors[0].description);
|
|
173
|
-
|
|
179
|
+
_b = responseBody || {}, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
174
180
|
if (!board_id) {
|
|
175
181
|
throw new Error('Internal server error');
|
|
176
182
|
}
|
|
177
|
-
|
|
183
|
+
boardInfoData = undefined;
|
|
184
|
+
if (!board_info_id) return [3, 3];
|
|
185
|
+
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
178
186
|
case 2:
|
|
179
|
-
|
|
180
|
-
|
|
187
|
+
boardInfoData = _j.sent();
|
|
188
|
+
_j.label = 3;
|
|
189
|
+
case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
190
|
+
case 4:
|
|
191
|
+
boardData = _j.sent();
|
|
192
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
|
|
181
193
|
return [4, API.dataService.getSegments({ page: 0 })];
|
|
182
|
-
case
|
|
183
|
-
segmentsList =
|
|
194
|
+
case 5:
|
|
195
|
+
segmentsList = _j.sent();
|
|
184
196
|
return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
185
|
-
case
|
|
186
|
-
salesChannels =
|
|
197
|
+
case 6:
|
|
198
|
+
salesChannels = _j.sent();
|
|
187
199
|
return [4, API.dataService.getTeamSize({ page: 0 })];
|
|
188
|
-
case
|
|
189
|
-
teamSizeList =
|
|
200
|
+
case 7:
|
|
201
|
+
teamSizeList = _j.sent();
|
|
190
202
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
|
|
191
203
|
return [2, {
|
|
192
204
|
data: data,
|
|
@@ -196,10 +208,11 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
|
|
|
196
208
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
197
209
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
198
210
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
199
|
-
name: (
|
|
200
|
-
contact: (
|
|
211
|
+
name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
|
|
212
|
+
contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
|
|
201
213
|
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
202
|
-
business: boardData === null || boardData === void 0 ? void 0 : boardData.business
|
|
214
|
+
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
215
|
+
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
|
|
203
216
|
},
|
|
204
217
|
salesChannels: salesChannels,
|
|
205
218
|
segmentsList: segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.list,
|
|
@@ -266,13 +279,14 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
|
|
|
266
279
|
export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thunkApi) {
|
|
267
280
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
268
281
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
-
var _b, settings, brand, _c, id, data_status, isNameENNonEditable, isNameARNonEditable, isChannelServicesNonEditable, isSegmentTypeNonEditable, isSegmentTeamsNonEditable, salesChannels, brandName, segment, teamSize, brandLogoId, segmentId, teamSizeId, getAddress, channel_services, brandNameIsEditable, requestBody, brandData, activities, activityList;
|
|
270
|
-
var
|
|
271
|
-
return __generator(this, function (
|
|
272
|
-
switch (
|
|
282
|
+
var _b, settings, brand, _c, brandRes, notification, _d, id, data_status, isNameENNonEditable, isNameARNonEditable, isChannelServicesNonEditable, isSegmentTypeNonEditable, isSegmentTeamsNonEditable, salesChannels, brandName, segment, teamSize, brandLogoId, segmentId, teamSizeId, getAddress, channel_services, brandNameIsEditable, requestBody, brandData, activities, activityList;
|
|
283
|
+
var _e, _f, _g, _h;
|
|
284
|
+
return __generator(this, function (_j) {
|
|
285
|
+
switch (_j.label) {
|
|
273
286
|
case 0:
|
|
274
287
|
_b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
|
|
275
|
-
_c =
|
|
288
|
+
_c = brand.data.verify.responseBody || {}, brandRes = _c.brand, notification = _c.notification;
|
|
289
|
+
_d = brandRes || {}, id = _d.id, data_status = _d.data_status;
|
|
276
290
|
isNameENNonEditable = hasNoneEditableValue(data_status, 'name.en');
|
|
277
291
|
isNameARNonEditable = hasNoneEditableValue(data_status, 'name.ar');
|
|
278
292
|
isChannelServicesNonEditable = hasNoneEditableValue(data_status, 'channel_services');
|
|
@@ -306,26 +320,26 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thun
|
|
|
306
320
|
en: !isNameENNonEditable ? brandName : undefined,
|
|
307
321
|
ar: !isNameARNonEditable ? brandName : undefined
|
|
308
322
|
}
|
|
309
|
-
})), { logo: brandLogoId, segment: !segmentId && !teamSizeId ? undefined : { type: segmentId, team: teamSizeId }, channel_services: channel_services });
|
|
323
|
+
})), { logo: brandLogoId, term_by: (_e = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _e === void 0 ? void 0 : _e.id, segment: !segmentId && !teamSizeId ? undefined : { type: segmentId, team: teamSizeId }, channel_services: channel_services });
|
|
310
324
|
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
311
325
|
case 1:
|
|
312
|
-
brandData = (
|
|
313
|
-
activities = (((
|
|
326
|
+
brandData = (_j.sent()).brand;
|
|
327
|
+
activities = (((_f = brand.data.verify.responseBody) === null || _f === void 0 ? void 0 : _f.entity) || {}).activities;
|
|
314
328
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
315
329
|
case 2:
|
|
316
|
-
|
|
330
|
+
_j.sent();
|
|
317
331
|
if (activities) {
|
|
318
332
|
brandData = __assign(__assign({}, brandData), { entity_activities: activities || {} });
|
|
319
333
|
}
|
|
320
334
|
if (!!activities) return [3, 4];
|
|
321
335
|
return [4, API.dataService.getActivities()];
|
|
322
336
|
case 3:
|
|
323
|
-
activityList = (
|
|
337
|
+
activityList = (_j.sent()).list;
|
|
324
338
|
brandData = __assign(__assign({}, brandData), { entity_activities: activityList || {} });
|
|
325
|
-
|
|
339
|
+
_j.label = 4;
|
|
326
340
|
case 4:
|
|
327
341
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
328
|
-
(
|
|
342
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
|
|
329
343
|
return [2, { data: __assign({}, brandData), formData: originalFormData }];
|
|
330
344
|
}
|
|
331
345
|
});
|
|
@@ -55,7 +55,7 @@ import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, sleep } from '..
|
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
|
|
56
56
|
var token = _a.token, isInternally = _a.isInternally;
|
|
57
57
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var payload, data, boardData, countryIso2;
|
|
58
|
+
var payload, data, boardData, boardInfoData, countryIso2;
|
|
59
59
|
var _b, _c, _d;
|
|
60
60
|
return __generator(this, function (_e) {
|
|
61
61
|
switch (_e.label) {
|
|
@@ -67,17 +67,22 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
|
|
|
67
67
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
68
68
|
case 1:
|
|
69
69
|
data = (_e.sent()).data;
|
|
70
|
-
|
|
70
|
+
boardInfoData = undefined;
|
|
71
71
|
if (((_b = data === null || data === void 0 ? void 0 : data.errors) === null || _b === void 0 ? void 0 : _b.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
72
72
|
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
73
73
|
if (isInternally)
|
|
74
74
|
data.step_name = TAX_STEP_NAMES.TAX_INFO;
|
|
75
|
-
if (!(data === null || data === void 0 ? void 0 : data.id)) return [3,
|
|
76
|
-
return [
|
|
75
|
+
if (!(data === null || data === void 0 ? void 0 : data.id)) return [3, 5];
|
|
76
|
+
if (!data.board_info_id) return [3, 3];
|
|
77
|
+
return [4, API.boardService.retrieveBoardInfo({ id: data.id, infoId: data.board_info_id })];
|
|
77
78
|
case 2:
|
|
78
|
-
|
|
79
|
+
boardInfoData = _e.sent();
|
|
79
80
|
_e.label = 3;
|
|
80
|
-
case 3:
|
|
81
|
+
case 3: return [4, API.boardService.retrieveBoardDetails(data.id)];
|
|
82
|
+
case 4:
|
|
83
|
+
boardData = _e.sent();
|
|
84
|
+
_e.label = 5;
|
|
85
|
+
case 5:
|
|
81
86
|
countryIso2 = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country;
|
|
82
87
|
if (countryIso2)
|
|
83
88
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
@@ -89,7 +94,7 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
|
|
|
89
94
|
}
|
|
90
95
|
return [2, {
|
|
91
96
|
data: data,
|
|
92
|
-
boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
|
|
97
|
+
boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
|
|
93
98
|
token: token
|
|
94
99
|
}];
|
|
95
100
|
}
|
|
@@ -168,13 +173,14 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
|
|
|
168
173
|
export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunkApi) {
|
|
169
174
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
170
175
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
171
|
-
var _b, settings, tax, _c, id, data_status, documents, isTaxNumberNonEditable, isConfirmPolicyNonEditable, isDocumentsNonEditable, document, vatId, confirmPolicy, documentId, requestBody, data, documentBody,
|
|
172
|
-
var
|
|
173
|
-
return __generator(this, function (
|
|
174
|
-
switch (
|
|
176
|
+
var _b, settings, tax, _c, entity, notification, _d, id, data_status, documents, isTaxNumberNonEditable, isConfirmPolicyNonEditable, isDocumentsNonEditable, document, vatId, confirmPolicy, documentId, requestBody, data, documentBody, _e, documentBody, _f;
|
|
177
|
+
var _g, _h, _j, _k;
|
|
178
|
+
return __generator(this, function (_l) {
|
|
179
|
+
switch (_l.label) {
|
|
175
180
|
case 0:
|
|
176
181
|
_b = thunkApi.getState(), settings = _b.settings, tax = _b.tax;
|
|
177
|
-
_c =
|
|
182
|
+
_c = tax.data.verify.responseBody || {}, entity = _c.entity, notification = _c.notification;
|
|
183
|
+
_d = entity || {}, id = _d.id, data_status = _d.data_status, documents = _d.documents;
|
|
178
184
|
isTaxNumberNonEditable = hasNoneEditableValue(data_status, 'tax_number');
|
|
179
185
|
isConfirmPolicyNonEditable = hasNoneEditableValue(data_status, 'is_vat_acknowledged');
|
|
180
186
|
isDocumentsNonEditable = hasNoneEditableValue(data_status, 'documents');
|
|
@@ -183,13 +189,14 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunk
|
|
|
183
189
|
requestBody = {
|
|
184
190
|
id: id,
|
|
185
191
|
vat_id: isTaxNumberNonEditable ? undefined : vatId,
|
|
192
|
+
vat_acknowledged_by: (_g = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _g === void 0 ? void 0 : _g.id,
|
|
186
193
|
step_name: TAX_STEP_NAMES.TAX_INFO,
|
|
187
194
|
is_vat_acknowledged: isConfirmPolicyNonEditable ? undefined : confirmPolicy
|
|
188
195
|
};
|
|
189
196
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
190
197
|
case 1:
|
|
191
|
-
data = (
|
|
192
|
-
if ((
|
|
198
|
+
data = (_l.sent()).data;
|
|
199
|
+
if ((_h = data.errors) === null || _h === void 0 ? void 0 : _h.length)
|
|
193
200
|
throw new Error(data.errors[0].description);
|
|
194
201
|
if (!(!isDocumentsNonEditable && (documentId || []).length > 0)) return [3, 5];
|
|
195
202
|
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
|
|
@@ -197,10 +204,10 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunk
|
|
|
197
204
|
id: document === null || document === void 0 ? void 0 : document.id,
|
|
198
205
|
images: documentId
|
|
199
206
|
};
|
|
200
|
-
|
|
207
|
+
_e = data;
|
|
201
208
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
202
209
|
case 2:
|
|
203
|
-
|
|
210
|
+
_e.documentData = _l.sent();
|
|
204
211
|
return [3, 5];
|
|
205
212
|
case 3:
|
|
206
213
|
documentBody = {
|
|
@@ -212,14 +219,14 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunk
|
|
|
212
219
|
}
|
|
213
220
|
]
|
|
214
221
|
};
|
|
215
|
-
|
|
222
|
+
_f = data;
|
|
216
223
|
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
217
224
|
case 4:
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
_f.documentData = _l.sent();
|
|
226
|
+
_l.label = 5;
|
|
220
227
|
case 5:
|
|
221
228
|
thunkApi.dispatch(handleNextScreenStep());
|
|
222
|
-
(
|
|
229
|
+
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
|
|
223
230
|
return [2, { data: data, formData: originalFormData }];
|
|
224
231
|
}
|
|
225
232
|
});
|
|
@@ -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
|
};
|