@tap-payments/auth-jsconnect 2.4.10-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/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/package.json +1 -1
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
|
});
|