@tap-payments/auth-jsconnect 2.0.6 → 2.0.8
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/form.d.ts +1 -0
- package/build/api/entity.d.ts +3 -3
- package/build/api/index.d.ts +1 -0
- package/build/api/individual.d.ts +1 -0
- package/build/api/individual.js +9 -2
- package/build/components/FileInput/DragAndDrop.js +0 -1
- package/build/constants/app.js +2 -0
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/bank/bankStore.d.ts +0 -1
- package/build/features/app/bank/bankStore.js +23 -42
- package/build/features/app/business/businessStore.js +24 -13
- package/build/features/app/connect/connectStore.js +9 -9
- package/build/features/app/individual/individualStore.d.ts +8 -2
- package/build/features/app/individual/individualStore.js +80 -41
- package/build/features/app/password/passwordStore.js +3 -7
- package/build/features/bank/screens/BankDetails/BankStatement.js +6 -17
- package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
- package/build/features/bank/screens/BankDetails/validation.js +11 -1
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
- package/build/features/connect/screens/Merchant/Merchant.js +3 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +19 -5
- package/build/features/password/screens/OTP/OTP.js +1 -1
- package/build/features/shared/UploadFile/UploadFile.d.ts +2 -2
- package/build/features/shared/UploadFile/UploadFile.js +6 -7
- package/package.json +1 -1
package/build/@types/form.d.ts
CHANGED
package/build/api/entity.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare type EntityInfoBody = {
|
|
|
6
6
|
business_operation_start_at?: string;
|
|
7
7
|
channel_services?: Array<string>;
|
|
8
8
|
physical_store_available?: boolean;
|
|
9
|
-
|
|
9
|
+
monthly_sales_range?: string;
|
|
10
10
|
customers_served_monthly?: number;
|
|
11
11
|
customers_base?: Array<string>;
|
|
12
12
|
vat_id?: string;
|
|
@@ -32,14 +32,14 @@ export declare type EntityBankUpdateBody = {
|
|
|
32
32
|
iban: string;
|
|
33
33
|
swift_code?: string;
|
|
34
34
|
account_number?: string;
|
|
35
|
+
is_acknowledged: boolean;
|
|
35
36
|
};
|
|
36
|
-
is_acknowledged: boolean;
|
|
37
37
|
step_name: string;
|
|
38
38
|
encryption_contract?: Array<string>;
|
|
39
39
|
};
|
|
40
40
|
export declare type UploadFileBody = {
|
|
41
41
|
file_link_create: boolean;
|
|
42
|
-
file
|
|
42
|
+
file?: File;
|
|
43
43
|
title: string | undefined;
|
|
44
44
|
purpose: string;
|
|
45
45
|
};
|
package/build/api/index.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ declare const API: {
|
|
|
60
60
|
};
|
|
61
61
|
individualService: {
|
|
62
62
|
getBrandList: (data: BrandListBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
63
|
+
retrieveIndividualInfo: (id: string) => Promise<any>;
|
|
63
64
|
};
|
|
64
65
|
};
|
|
65
66
|
export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody };
|
|
@@ -4,5 +4,6 @@ export declare type BrandListBody = {
|
|
|
4
4
|
};
|
|
5
5
|
declare const individualService: {
|
|
6
6
|
getBrandList: (data: BrandListBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
|
+
retrieveIndividualInfo: (id: string) => Promise<any>;
|
|
7
8
|
};
|
|
8
9
|
export { individualService };
|
package/build/api/individual.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { ENDPOINT_PATHS } from '../constants';
|
|
2
|
-
import instance from './axios';
|
|
2
|
+
import instance, { httpClient } from './axios';
|
|
3
3
|
var getBrandList = function (data, config) {
|
|
4
4
|
return instance.post("".concat(ENDPOINT_PATHS.BRAND_LIST), data, config);
|
|
5
5
|
};
|
|
6
|
+
var retrieveIndividualInfo = function (id) {
|
|
7
|
+
return httpClient({
|
|
8
|
+
method: 'get',
|
|
9
|
+
url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(id, "/info")
|
|
10
|
+
});
|
|
11
|
+
};
|
|
6
12
|
var individualService = {
|
|
7
|
-
getBrandList: getBrandList
|
|
13
|
+
getBrandList: getBrandList,
|
|
14
|
+
retrieveIndividualInfo: retrieveIndividualInfo
|
|
8
15
|
};
|
|
9
16
|
export { individualService };
|
|
@@ -29,7 +29,6 @@ var DragAndDrop = function (_a) {
|
|
|
29
29
|
noKeyboard: true,
|
|
30
30
|
noClick: true,
|
|
31
31
|
multiple: false,
|
|
32
|
-
accept: { 'image/jpeg': ['.jpeg'], 'image/png': ['.png'], 'image/jpg': ['.jpg'], 'application/pdf': ['.pdf'] },
|
|
33
32
|
onDrop: function (files) {
|
|
34
33
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(files === null || files === void 0 ? void 0 : files[0]);
|
|
35
34
|
}
|
package/build/constants/app.js
CHANGED
|
@@ -6,6 +6,7 @@ export declare const FL_NUMBER_LENGTH = 8;
|
|
|
6
6
|
export declare const CR_NUMBER_LENGTH = 10;
|
|
7
7
|
export declare const SAUDI_NUMBER_LENGTH = 9;
|
|
8
8
|
export declare const MAX_FILE_SIZE = 1000000;
|
|
9
|
+
export declare const VALID_FILE_FORMATS: string[];
|
|
9
10
|
export declare const REGEX_FULL_NAME: RegExp;
|
|
10
11
|
export declare const REGEX_WEBSITE: RegExp;
|
|
11
12
|
export declare const REGEX_BENEFICIARY_NAME: RegExp;
|
|
@@ -6,6 +6,7 @@ export var FL_NUMBER_LENGTH = 8;
|
|
|
6
6
|
export var CR_NUMBER_LENGTH = 10;
|
|
7
7
|
export var SAUDI_NUMBER_LENGTH = 9;
|
|
8
8
|
export var MAX_FILE_SIZE = 1000000;
|
|
9
|
+
export var VALID_FILE_FORMATS = ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf'];
|
|
9
10
|
export var REGEX_FULL_NAME = /^([a-zA-Z]{2,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,})$/g;
|
|
10
11
|
export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
|
|
11
12
|
export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z\s])*$/g;
|
|
@@ -20,7 +20,6 @@ export declare const createBankAccount: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
20
20
|
data: any;
|
|
21
21
|
formData: BankFormValues;
|
|
22
22
|
}, BankFormValues, {}>;
|
|
23
|
-
export declare const uploadBankStatement: import("@reduxjs/toolkit").AsyncThunk<any, File, {}>;
|
|
24
23
|
export declare const checkIbanBank: import("@reduxjs/toolkit").AsyncThunk<{
|
|
25
24
|
data: any;
|
|
26
25
|
}, {
|
|
@@ -154,56 +154,51 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveBankEntityInfo', funct
|
|
|
154
154
|
});
|
|
155
155
|
}); });
|
|
156
156
|
export var createBankAccount = createAsyncThunk('createBankAccount', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
157
|
-
var _a, settings, bank, iban, beneficiaryName, bank_name, requestBody, data;
|
|
158
|
-
var _b, _c, _d, _e;
|
|
159
|
-
return __generator(this, function (
|
|
160
|
-
switch (
|
|
157
|
+
var _a, settings, bank, iban, beneficiaryName, bank_name, fileResponse, uploadPayload, requestBody, data;
|
|
158
|
+
var _b, _c, _d, _e, _f;
|
|
159
|
+
return __generator(this, function (_g) {
|
|
160
|
+
switch (_g.label) {
|
|
161
161
|
case 0:
|
|
162
162
|
_a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
|
|
163
163
|
iban = params.iban;
|
|
164
164
|
beneficiaryName = params.beneficiaryName;
|
|
165
165
|
bank_name = params.bankName;
|
|
166
|
+
fileResponse = undefined;
|
|
167
|
+
uploadPayload = {
|
|
168
|
+
file_link_create: true,
|
|
169
|
+
title: (_b = params.bankStatementFile) === null || _b === void 0 ? void 0 : _b.name,
|
|
170
|
+
purpose: 'identity_document',
|
|
171
|
+
file: params.bankStatementFile
|
|
172
|
+
};
|
|
173
|
+
if (!params.bankStatementFile) return [3, 2];
|
|
174
|
+
return [4, API.entityService.uploadFileInfo(uploadPayload)];
|
|
175
|
+
case 1:
|
|
176
|
+
fileResponse = _g.sent();
|
|
177
|
+
_g.label = 2;
|
|
178
|
+
case 2:
|
|
166
179
|
requestBody = {
|
|
167
|
-
wallet_id: (
|
|
168
|
-
is_acknowledged: params.confirmPolicy,
|
|
180
|
+
wallet_id: (_d = (_c = bank.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.merchant) === null || _d === void 0 ? void 0 : _d.wallet_id,
|
|
169
181
|
bank_account: {
|
|
170
182
|
iban: iban,
|
|
171
183
|
beneficiary_name: beneficiaryName,
|
|
172
184
|
bank_name: bank_name,
|
|
173
|
-
bank_statement_file_id:
|
|
185
|
+
bank_statement_file_id: fileResponse === null || fileResponse === void 0 ? void 0 : fileResponse.id,
|
|
186
|
+
is_acknowledged: params.confirmPolicy
|
|
174
187
|
},
|
|
175
188
|
step_name: BANK_STEP_NAMES.BANK_INFO,
|
|
176
189
|
encryption_contract: ['bank_account.iban', 'bank_account.beneficiary_name', 'bank_account.bank_name']
|
|
177
190
|
};
|
|
178
191
|
return [4, API.entityService.createBankAccount(requestBody)];
|
|
179
|
-
case
|
|
180
|
-
data = (
|
|
192
|
+
case 3:
|
|
193
|
+
data = (_g.sent()).data;
|
|
181
194
|
if (!data.errors) {
|
|
182
195
|
thunkApi.dispatch(handleNextScreenStep());
|
|
183
|
-
(
|
|
196
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
|
|
184
197
|
}
|
|
185
198
|
return [2, { data: data, formData: params }];
|
|
186
199
|
}
|
|
187
200
|
});
|
|
188
201
|
}); });
|
|
189
|
-
export var uploadBankStatement = createAsyncThunk('uploadBankStatement', function (file, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
190
|
-
var requestBody, data;
|
|
191
|
-
return __generator(this, function (_a) {
|
|
192
|
-
switch (_a.label) {
|
|
193
|
-
case 0:
|
|
194
|
-
requestBody = {
|
|
195
|
-
file_link_create: true,
|
|
196
|
-
title: file === null || file === void 0 ? void 0 : file.name,
|
|
197
|
-
purpose: 'identity_document',
|
|
198
|
-
file: file
|
|
199
|
-
};
|
|
200
|
-
return [4, API.entityService.uploadFileInfo(requestBody)];
|
|
201
|
-
case 1:
|
|
202
|
-
data = _a.sent();
|
|
203
|
-
return [2, data];
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}); });
|
|
207
202
|
export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
|
|
208
203
|
var iban = _a.iban, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
|
|
209
204
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -424,20 +419,6 @@ export var bankSlice = createSlice({
|
|
|
424
419
|
if (action.error.message === 'Aborted')
|
|
425
420
|
return;
|
|
426
421
|
state.error = action.error.message;
|
|
427
|
-
})
|
|
428
|
-
.addCase(uploadBankStatement.pending, function (state) {
|
|
429
|
-
state.data.bankData.uploading = true;
|
|
430
|
-
state.error = null;
|
|
431
|
-
})
|
|
432
|
-
.addCase(uploadBankStatement.fulfilled, function (state, action) {
|
|
433
|
-
state.data.bankData.uploading = false;
|
|
434
|
-
state.error = null;
|
|
435
|
-
var id = action.payload.id;
|
|
436
|
-
state.data.bankData.responseBody = { fileId: id };
|
|
437
|
-
})
|
|
438
|
-
.addCase(uploadBankStatement.rejected, function (state, action) {
|
|
439
|
-
state.data.bankData.uploading = false;
|
|
440
|
-
state.error = action.error.message;
|
|
441
422
|
});
|
|
442
423
|
}
|
|
443
424
|
});
|
|
@@ -108,7 +108,7 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
108
108
|
});
|
|
109
109
|
}); });
|
|
110
110
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
111
|
-
var _a, business, settings, isNID, responseBody, verifyResponse, stepName, payload, data, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted;
|
|
111
|
+
var _a, business, settings, isNID, responseBody, verifyResponse, stepName, payload, data, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
|
|
112
112
|
var _b, _c, _d, _e;
|
|
113
113
|
return __generator(this, function (_f) {
|
|
114
114
|
switch (_f.label) {
|
|
@@ -128,7 +128,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
128
128
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
129
129
|
case 1:
|
|
130
130
|
data = (_f.sent()).data;
|
|
131
|
-
if (!!data.errors) return [3,
|
|
131
|
+
if (!!data.errors) return [3, 11];
|
|
132
132
|
thunkApi.dispatch(updateStepName(stepName));
|
|
133
133
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
134
134
|
case 2:
|
|
@@ -137,31 +137,42 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
137
137
|
steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
|
|
138
138
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
139
139
|
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO);
|
|
140
|
+
hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
|
|
141
|
+
hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
|
|
140
142
|
if (!isNID) return [3, 3];
|
|
141
143
|
thunkApi.dispatch(handleNextScreenStep());
|
|
142
|
-
return [3,
|
|
144
|
+
return [3, 11];
|
|
143
145
|
case 3:
|
|
144
146
|
if (!hasBusinessCompleted) return [3, 5];
|
|
145
147
|
return [4, thunkApi.dispatch(retrieveEntityInfo((_e = verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.entity) === null || _e === void 0 ? void 0 : _e.id))];
|
|
146
148
|
case 4:
|
|
147
149
|
_f.sent();
|
|
148
150
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
149
|
-
return [3,
|
|
151
|
+
return [3, 11];
|
|
150
152
|
case 5:
|
|
151
153
|
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 6];
|
|
152
154
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
153
|
-
return [3,
|
|
155
|
+
return [3, 11];
|
|
154
156
|
case 6:
|
|
155
|
-
if (!
|
|
156
|
-
|
|
157
|
+
if (!hasBusinessCustomersCompleted) return [3, 7];
|
|
158
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
|
|
159
|
+
return [3, 11];
|
|
157
160
|
case 7:
|
|
161
|
+
if (!hasBusinessCRActivitiesCompleted) return [3, 8];
|
|
162
|
+
thunkApi.dispatch(retrieveDataList());
|
|
163
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
164
|
+
return [3, 11];
|
|
165
|
+
case 8:
|
|
166
|
+
if (!hasBusinessCRInfoCompleted) return [3, 10];
|
|
167
|
+
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
168
|
+
case 9:
|
|
158
169
|
_f.sent();
|
|
159
170
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
160
|
-
return [3,
|
|
161
|
-
case
|
|
171
|
+
return [3, 11];
|
|
172
|
+
case 10:
|
|
162
173
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
163
|
-
_f.label =
|
|
164
|
-
case
|
|
174
|
+
_f.label = 11;
|
|
175
|
+
case 11: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }) }];
|
|
165
176
|
}
|
|
166
177
|
});
|
|
167
178
|
}); });
|
|
@@ -389,11 +400,11 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
|
|
|
389
400
|
customers_base: customerBase,
|
|
390
401
|
id: id,
|
|
391
402
|
customers_served_monthly: parseInt(((_c = params.expectedCustomer) === null || _c === void 0 ? void 0 : _c.id) || '0'),
|
|
392
|
-
|
|
403
|
+
monthly_sales_range: ((_d = params.expectedSale) === null || _d === void 0 ? void 0 : _d.id) || '',
|
|
393
404
|
agree_refund: params.refundPolicy,
|
|
394
405
|
agree_chargeback: params.transactionPolicy,
|
|
395
406
|
step_name: stepName,
|
|
396
|
-
encryption_contract: ['customers_served_monthly', '
|
|
407
|
+
encryption_contract: ['customers_served_monthly', 'monthly_sales_range']
|
|
397
408
|
};
|
|
398
409
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
399
410
|
case 1:
|
|
@@ -310,9 +310,9 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
310
310
|
}); });
|
|
311
311
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
312
312
|
var _a, settings, connect, instagram, twitter, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, isOther, brand, payload, data;
|
|
313
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
314
|
-
return __generator(this, function (
|
|
315
|
-
switch (
|
|
313
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
314
|
+
return __generator(this, function (_q) {
|
|
315
|
+
switch (_q.label) {
|
|
316
316
|
case 0:
|
|
317
317
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
318
318
|
instagram = !!((_c = params.links) === null || _c === void 0 ? void 0 : _c.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_d = params.links) === null || _d === void 0 ? void 0 : _d.instagram) : '';
|
|
@@ -321,19 +321,19 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
321
321
|
isAbsher = otpData.isAbsher;
|
|
322
322
|
responseBody = (isAbsher ? nidData : mobileData).responseBody;
|
|
323
323
|
isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
|
|
324
|
-
isOther = ((_g = params.selectedBrandItem) === null || _g === void 0 ? void 0 : _g.id) === 'other';
|
|
324
|
+
isOther = !!((_g = params.selectedBrandItem) === null || _g === void 0 ? void 0 : _g.id) ? ((_h = params.selectedBrandItem) === null || _h === void 0 ? void 0 : _h.id) === 'other' : true;
|
|
325
325
|
brand = __assign({ name: {
|
|
326
326
|
en: params.brandName,
|
|
327
327
|
ar: params.brandName,
|
|
328
328
|
zh: params.brandName
|
|
329
|
-
}, website: (
|
|
329
|
+
}, website: (_j = params.links) === null || _j === void 0 ? void 0 : _j.website, social: [twitter, instagram] }, (isExistingUser &&
|
|
330
330
|
!isOther && {
|
|
331
|
-
id: (
|
|
331
|
+
id: (_k = params.selectedBrandItem) === null || _k === void 0 ? void 0 : _k.id,
|
|
332
332
|
name: undefined
|
|
333
333
|
}));
|
|
334
334
|
payload = {
|
|
335
335
|
brand: brand,
|
|
336
|
-
id: (isExistingUser ? (
|
|
336
|
+
id: (isExistingUser ? (_l = brandData.responseBody) === null || _l === void 0 ? void 0 : _l.lead_id : (_m = otpData.responseBody) === null || _m === void 0 ? void 0 : _m.lead_id) || '',
|
|
337
337
|
terms_conditions_accepted: params.termAndConditionChecked,
|
|
338
338
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
|
|
339
339
|
encryption_contract: [
|
|
@@ -347,10 +347,10 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
347
347
|
};
|
|
348
348
|
return [4, API.leadService.updateLead(payload)];
|
|
349
349
|
case 1:
|
|
350
|
-
data = (
|
|
350
|
+
data = (_q.sent()).data;
|
|
351
351
|
if (!data.errors) {
|
|
352
352
|
thunkApi.dispatch(handleNextScreenStep());
|
|
353
|
-
(
|
|
353
|
+
(_p = (_o = settings.data.appConfig).onStepCompleted) === null || _p === void 0 ? void 0 : _p.call(_o, settings.data.activeScreen.name, params);
|
|
354
354
|
}
|
|
355
355
|
return [2, { response: data, formData: params }];
|
|
356
356
|
}
|
|
@@ -11,10 +11,16 @@ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
11
11
|
export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
12
12
|
sourceIncome: any;
|
|
13
13
|
monthlyIncome: any;
|
|
14
|
-
countryCode: string;
|
|
15
14
|
occupation: any;
|
|
16
|
-
countries: import("../../../@types").CountryCode[];
|
|
17
15
|
}, string, {}>;
|
|
16
|
+
export declare const retrieveIndividualInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
17
|
+
data: any;
|
|
18
|
+
countries: import("../../../@types").CountryCode[];
|
|
19
|
+
countryCode: string;
|
|
20
|
+
}, {
|
|
21
|
+
id: string;
|
|
22
|
+
countryCode: string;
|
|
23
|
+
}, {}>;
|
|
18
24
|
export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
19
25
|
data: any;
|
|
20
26
|
}, string, {}>;
|
|
@@ -53,10 +53,9 @@ import { hasKey } from '../../../utils';
|
|
|
53
53
|
import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
|
|
54
54
|
import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var payload, data, leadResponse, _a, steps, entity, hasTaxCompleted;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
switch (_d.label) {
|
|
56
|
+
var payload, data, leadResponse, _a, steps, entity, individual_id, hasTaxCompleted;
|
|
57
|
+
return __generator(this, function (_b) {
|
|
58
|
+
switch (_b.label) {
|
|
60
59
|
case 0:
|
|
61
60
|
payload = {
|
|
62
61
|
service_name: 'tap_email',
|
|
@@ -64,32 +63,35 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
64
63
|
};
|
|
65
64
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
66
65
|
case 1:
|
|
67
|
-
data = (
|
|
66
|
+
data = (_b.sent()).data;
|
|
68
67
|
leadResponse = undefined;
|
|
69
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
68
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
|
|
70
69
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
71
70
|
case 2:
|
|
72
|
-
leadResponse =
|
|
73
|
-
_a = leadResponse.data, steps = _a.steps, entity = _a.entity;
|
|
71
|
+
leadResponse = _b.sent();
|
|
72
|
+
_a = leadResponse.data, steps = _a.steps, entity = _a.entity, individual_id = _a.individual_id;
|
|
74
73
|
hasTaxCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
|
|
75
74
|
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 3];
|
|
76
75
|
thunkApi.dispatch(handleCurrentActiveScreen('INDIVIDUAL_VERIFY_STEP'));
|
|
77
|
-
return [3,
|
|
76
|
+
return [3, 8];
|
|
78
77
|
case 3:
|
|
79
78
|
if (!hasTaxCompleted) return [3, 5];
|
|
80
79
|
return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
|
|
81
80
|
case 4:
|
|
82
|
-
|
|
81
|
+
_b.sent();
|
|
83
82
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
84
|
-
return [3,
|
|
83
|
+
return [3, 8];
|
|
85
84
|
case 5:
|
|
86
|
-
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO)) return [3,
|
|
87
|
-
return [4, thunkApi.dispatch(retrieveDataList(
|
|
85
|
+
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO)) return [3, 8];
|
|
86
|
+
return [4, thunkApi.dispatch(retrieveDataList(entity === null || entity === void 0 ? void 0 : entity.country))];
|
|
88
87
|
case 6:
|
|
89
|
-
|
|
88
|
+
_b.sent();
|
|
89
|
+
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: individual_id, countryCode: entity === null || entity === void 0 ? void 0 : entity.country }))];
|
|
90
|
+
case 7:
|
|
91
|
+
_b.sent();
|
|
90
92
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
91
|
-
|
|
92
|
-
case
|
|
93
|
+
_b.label = 8;
|
|
94
|
+
case 8: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
|
|
93
95
|
}
|
|
94
96
|
});
|
|
95
97
|
}); });
|
|
@@ -110,8 +112,8 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
|
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
}); });
|
|
113
|
-
export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode
|
|
114
|
-
var _a, sourceIncome, monthlyIncome, occupation
|
|
115
|
+
export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
116
|
+
var _a, sourceIncome, monthlyIncome, occupation;
|
|
115
117
|
return __generator(this, function (_b) {
|
|
116
118
|
switch (_b.label) {
|
|
117
119
|
case 0: return [4, Promise.all([
|
|
@@ -121,18 +123,34 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
|
|
|
121
123
|
])];
|
|
122
124
|
case 1:
|
|
123
125
|
_a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data, occupation = _a[2];
|
|
124
|
-
settings = thunkApi.getState().settings;
|
|
125
|
-
countries = settings.data.countries;
|
|
126
126
|
return [2, {
|
|
127
127
|
sourceIncome: sourceIncome,
|
|
128
128
|
monthlyIncome: monthlyIncome,
|
|
129
|
-
|
|
130
|
-
occupation: occupation,
|
|
131
|
-
countries: countries
|
|
129
|
+
occupation: occupation
|
|
132
130
|
}];
|
|
133
131
|
}
|
|
134
132
|
});
|
|
135
133
|
}); });
|
|
134
|
+
export var retrieveIndividualInfo = createAsyncThunk('individualRetrieveIndividualInfo', function (_a, thunkApi) {
|
|
135
|
+
var id = _a.id, countryCode = _a.countryCode;
|
|
136
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
137
|
+
var data, settings, countries;
|
|
138
|
+
return __generator(this, function (_b) {
|
|
139
|
+
switch (_b.label) {
|
|
140
|
+
case 0: return [4, API.individualService.retrieveIndividualInfo(id)];
|
|
141
|
+
case 1:
|
|
142
|
+
data = _b.sent();
|
|
143
|
+
settings = thunkApi.getState().settings;
|
|
144
|
+
countries = settings.data.countries;
|
|
145
|
+
return [2, {
|
|
146
|
+
data: data,
|
|
147
|
+
countries: countries,
|
|
148
|
+
countryCode: countryCode
|
|
149
|
+
}];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
});
|
|
136
154
|
export var retrieveEntityInfo = createAsyncThunk('retrieveIndividualEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
137
155
|
var data;
|
|
138
156
|
return __generator(this, function (_a) {
|
|
@@ -145,8 +163,8 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveIndividualEntityInfo',
|
|
|
145
163
|
});
|
|
146
164
|
}); });
|
|
147
165
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
148
|
-
var _a, individual, settings, responseBody, payload, data, steps, hasIndividualCompleted;
|
|
149
|
-
var
|
|
166
|
+
var _a, individual, settings, responseBody, payload, data, _b, steps, individual_id, entity, hasIndividualCompleted;
|
|
167
|
+
var _c, _d, _e, _f;
|
|
150
168
|
return __generator(this, function (_g) {
|
|
151
169
|
switch (_g.label) {
|
|
152
170
|
case 0:
|
|
@@ -154,7 +172,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
154
172
|
responseBody = individual.data.verify.responseBody;
|
|
155
173
|
payload = {
|
|
156
174
|
data: params.otp,
|
|
157
|
-
service_name: (
|
|
175
|
+
service_name: (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _c === void 0 ? void 0 : _c.service_name,
|
|
158
176
|
verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
|
|
159
177
|
step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
|
|
160
178
|
encryption_contract: ['data']
|
|
@@ -162,22 +180,25 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
162
180
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
163
181
|
case 1:
|
|
164
182
|
data = (_g.sent()).data;
|
|
165
|
-
if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3,
|
|
166
|
-
(
|
|
167
|
-
|
|
183
|
+
if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 6];
|
|
184
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
|
|
185
|
+
_b = responseBody || {}, steps = _b.steps, individual_id = _b.individual_id, entity = _b.entity;
|
|
168
186
|
hasIndividualCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
|
|
169
187
|
if (!hasIndividualCompleted) return [3, 3];
|
|
170
|
-
return [4, thunkApi.dispatch(retrieveEntityInfo((
|
|
188
|
+
return [4, thunkApi.dispatch(retrieveEntityInfo((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _f === void 0 ? void 0 : _f.id))];
|
|
171
189
|
case 2:
|
|
172
190
|
_g.sent();
|
|
173
191
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
174
|
-
return [3,
|
|
175
|
-
case 3: return [4, thunkApi.dispatch(retrieveDataList(
|
|
192
|
+
return [3, 6];
|
|
193
|
+
case 3: return [4, thunkApi.dispatch(retrieveDataList(entity === null || entity === void 0 ? void 0 : entity.country))];
|
|
176
194
|
case 4:
|
|
195
|
+
_g.sent();
|
|
196
|
+
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: individual_id, countryCode: entity === null || entity === void 0 ? void 0 : entity.country }))];
|
|
197
|
+
case 5:
|
|
177
198
|
_g.sent();
|
|
178
199
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
179
|
-
_g.label =
|
|
180
|
-
case
|
|
200
|
+
_g.label = 6;
|
|
201
|
+
case 6: return [2, { data: data, formData: __assign({}, params) }];
|
|
181
202
|
}
|
|
182
203
|
});
|
|
183
204
|
}); });
|
|
@@ -347,24 +368,42 @@ export var individualSlice = createSlice({
|
|
|
347
368
|
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
348
369
|
state.loading = false;
|
|
349
370
|
state.error = null;
|
|
350
|
-
var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome,
|
|
371
|
+
var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, occupation = _a.occupation;
|
|
351
372
|
var data = state.data.individualData.responseBody;
|
|
352
373
|
state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [], occupationList: occupation || [] });
|
|
353
|
-
|
|
374
|
+
})
|
|
375
|
+
.addCase(retrieveDataList.rejected, function (state, action) {
|
|
376
|
+
state.loading = false;
|
|
377
|
+
state.error = action.error.message;
|
|
378
|
+
})
|
|
379
|
+
.addCase(retrieveIndividualInfo.pending, function (state) {
|
|
380
|
+
state.loading = true;
|
|
381
|
+
state.error = null;
|
|
382
|
+
})
|
|
383
|
+
.addCase(retrieveIndividualInfo.fulfilled, function (state, action) {
|
|
384
|
+
state.loading = false;
|
|
385
|
+
state.error = null;
|
|
386
|
+
var _a = action.payload, data = _a.data, countries = _a.countries, countryCode = _a.countryCode;
|
|
387
|
+
var info = (data || {}).info;
|
|
388
|
+
var _b = state.data.individualData.responseBody || {}, sourceIncomeList = _b.sourceIncomeList, monthlyIncomeList = _b.monthlyIncomeList, occupationList = _b.occupationList;
|
|
389
|
+
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a, _b, _c, _d; return ((_a = source === null || source === void 0 ? void 0 : source.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_d = (_c = (_b = info === null || info === void 0 ? void 0 : info.source_income) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.name_en) === null || _d === void 0 ? void 0 : _d.toLocaleLowerCase()); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
354
390
|
if (!!selectedSourceIncome)
|
|
355
391
|
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
356
|
-
var selectedMonthlyIncome =
|
|
392
|
+
var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { var _a, _b; return ((_a = income === null || income === void 0 ? void 0 : income.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_b = info === null || info === void 0 ? void 0 : info.actual_income) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()); })) || (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
|
|
357
393
|
if (!!selectedMonthlyIncome)
|
|
358
394
|
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
359
|
-
|
|
360
|
-
|
|
395
|
+
var code = (info === null || info === void 0 ? void 0 : info.employer_country) || countryCode;
|
|
396
|
+
if (!!code) {
|
|
397
|
+
var employerLocation = countries.find(function (country) { return country.iso2 === code; });
|
|
361
398
|
state.data.individualData.employerLocation = employerLocation;
|
|
362
399
|
}
|
|
363
|
-
var selectedOccupation = occupation === null || occupation === void 0 ? void 0 : occupation[0];
|
|
400
|
+
var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occupation) { var _a, _b; return ((_a = occupation === null || occupation === void 0 ? void 0 : occupation.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_b = info === null || info === void 0 ? void 0 : info.occupation) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
|
|
364
401
|
if (!!selectedOccupation)
|
|
365
402
|
state.data.individualData.occupation = selectedOccupation;
|
|
403
|
+
state.data.individualData.isPEP = info === null || info === void 0 ? void 0 : info.is_relative_PEP;
|
|
404
|
+
state.data.individualData.isInfluencer = info === null || info === void 0 ? void 0 : info.is_influencer;
|
|
366
405
|
})
|
|
367
|
-
.addCase(
|
|
406
|
+
.addCase(retrieveIndividualInfo.rejected, function (state, action) {
|
|
368
407
|
state.loading = false;
|
|
369
408
|
state.error = action.error.message;
|
|
370
409
|
})
|
|
@@ -210,9 +210,8 @@ export var updateLeadSuccess = createAsyncThunk('passwordUpdateLeadSuccess', fun
|
|
|
210
210
|
}); });
|
|
211
211
|
export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
212
212
|
var token, leadId, payload, data;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
switch (_c.label) {
|
|
213
|
+
return __generator(this, function (_a) {
|
|
214
|
+
switch (_a.label) {
|
|
216
215
|
case 0:
|
|
217
216
|
token = params.token, leadId = params.leadId;
|
|
218
217
|
payload = {
|
|
@@ -221,11 +220,8 @@ export var verifyOperationToken = createAsyncThunk('verifyOperationToken', funct
|
|
|
221
220
|
};
|
|
222
221
|
return [4, API.authService.verifyAuth(payload)];
|
|
223
222
|
case 1:
|
|
224
|
-
data = (
|
|
223
|
+
data = (_a.sent()).data;
|
|
225
224
|
thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
|
|
226
|
-
if ((data === null || data === void 0 ? void 0 : data.errors) || (data === null || data === void 0 ? void 0 : data.mw_error)) {
|
|
227
|
-
alert((_b = (_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.description);
|
|
228
|
-
}
|
|
229
225
|
return [2, { data: data, token: token, leadId: leadId }];
|
|
230
226
|
}
|
|
231
227
|
});
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import { styled } from '@mui/material/styles';
|
|
4
3
|
import { ScreenContainer } from '../../../../features/shared/Containers';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { useController, useFormContext } from 'react-hook-form';
|
|
7
6
|
import UploadFile from '../../../../features/shared/UploadFile';
|
|
8
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
9
|
-
import { bankSelector, uploadBankStatement } from '../../../../features/app/bank/bankStore';
|
|
10
7
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
11
8
|
var theme = _a.theme;
|
|
12
9
|
return ({
|
|
@@ -14,25 +11,17 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
14
11
|
});
|
|
15
12
|
});
|
|
16
13
|
var BankStatement = function () {
|
|
17
|
-
var _a
|
|
18
|
-
var dispatch = useAppDispatch();
|
|
19
|
-
var data = useAppSelector(bankSelector).data;
|
|
14
|
+
var _a;
|
|
20
15
|
var t = useTranslation().t;
|
|
21
16
|
var control = useFormContext().control;
|
|
22
|
-
var
|
|
23
|
-
var error = (_a =
|
|
24
|
-
var uploading = data.bankData.uploading;
|
|
17
|
+
var bankStatementFileControl = useController({ name: 'bankStatementFile', control: control });
|
|
18
|
+
var error = (_a = bankStatementFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
25
19
|
var handleBankStatementChange = function (file) {
|
|
26
|
-
|
|
20
|
+
bankStatementFileControl.field.onChange(file);
|
|
27
21
|
};
|
|
28
22
|
var handleReset = function () {
|
|
29
|
-
|
|
23
|
+
bankStatementFileControl.field.onChange(null);
|
|
30
24
|
};
|
|
31
|
-
|
|
32
|
-
var _a, _b;
|
|
33
|
-
if ((_a = data.bankData.responseBody) === null || _a === void 0 ? void 0 : _a.fileId)
|
|
34
|
-
bankStatementControl.field.onChange((_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.fileId);
|
|
35
|
-
}, [(_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.fileId]);
|
|
36
|
-
return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), dragTitle: t('drag_and_drop'), uploadTitle: t('title_upload_file'), onFileUploaded: handleBankStatementChange, loading: uploading, onReset: handleReset, error: error && t(error) }) }));
|
|
25
|
+
return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), dragTitle: t('drag_and_drop'), uploadTitle: t('title_upload_file'), onFileUploaded: handleBankStatementChange, isSubmitting: bankStatementFileControl.formState.isSubmitted, onReset: handleReset, error: error && t(error) }) }));
|
|
37
26
|
};
|
|
38
27
|
export default BankStatement;
|
|
@@ -4,17 +4,20 @@ export declare const BankValidation: yup.ObjectSchema<import("yup/lib/object").A
|
|
|
4
4
|
bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
5
5
|
beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
6
|
bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
7
|
+
bankStatementFile: any;
|
|
7
8
|
confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
8
9
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
9
10
|
iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
10
11
|
bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
11
12
|
beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
12
13
|
bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
14
|
+
bankStatementFile: any;
|
|
13
15
|
confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
14
16
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
15
17
|
iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
16
18
|
bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
17
19
|
beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
18
20
|
bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
21
|
+
bankStatementFile: any;
|
|
19
22
|
confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
20
23
|
}>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { REGEX_BENEFICIARY_NAME } from '../../../../constants';
|
|
1
|
+
import { REGEX_BENEFICIARY_NAME, VALID_FILE_FORMATS } from '../../../../constants';
|
|
2
2
|
import * as yup from 'yup';
|
|
3
3
|
export var BankValidation = yup.object().shape({
|
|
4
4
|
iban: yup
|
|
@@ -13,5 +13,15 @@ export var BankValidation = yup.object().shape({
|
|
|
13
13
|
.matches(REGEX_BENEFICIARY_NAME, 'beneficiary_name_invalid')
|
|
14
14
|
.required('beneficiary_name_required'),
|
|
15
15
|
bankStatementId: yup.string().optional(),
|
|
16
|
+
bankStatementFile: yup
|
|
17
|
+
.mixed()
|
|
18
|
+
.test({
|
|
19
|
+
test: function (value) {
|
|
20
|
+
if (!!value)
|
|
21
|
+
return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) ? true : this.createError({ message: 'alert_file_upload' });
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
.optional(),
|
|
16
26
|
confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
|
|
17
27
|
});
|
|
@@ -20,7 +20,7 @@ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick
|
|
|
20
20
|
export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
|
|
21
21
|
children?: React.ReactNode;
|
|
22
22
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
23
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
23
|
+
color?: "inherit" | "disabled" | "error" | "info" | "primary" | "secondary" | "action" | "success" | "warning" | undefined;
|
|
24
24
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
25
25
|
htmlColor?: string | undefined;
|
|
26
26
|
inheritViewBox?: boolean | undefined;
|
|
@@ -35,7 +35,7 @@ export declare const NameContainer: import("@emotion/styled").StyledComponent<im
|
|
|
35
35
|
export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
|
|
36
36
|
children?: React.ReactNode;
|
|
37
37
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
38
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
38
|
+
color?: "inherit" | "disabled" | "error" | "info" | "primary" | "secondary" | "action" | "success" | "warning" | undefined;
|
|
39
39
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
40
40
|
htmlColor?: string | undefined;
|
|
41
41
|
inheritViewBox?: boolean | undefined;
|
|
@@ -49,7 +49,7 @@ export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<
|
|
|
49
49
|
export declare const RemainingCheck: import("@emotion/styled").StyledComponent<{
|
|
50
50
|
children?: React.ReactNode;
|
|
51
51
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
52
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
52
|
+
color?: "inherit" | "disabled" | "error" | "info" | "primary" | "secondary" | "action" | "success" | "warning" | undefined;
|
|
53
53
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
54
54
|
htmlColor?: string | undefined;
|
|
55
55
|
inheritViewBox?: boolean | undefined;
|
|
@@ -71,7 +71,7 @@ var Merchant = function (_a) {
|
|
|
71
71
|
methods.setError('brandName', { message: 'Profile Name already exists' });
|
|
72
72
|
}, [responseBody]);
|
|
73
73
|
React.useEffect(function () {
|
|
74
|
-
var _a, _b, _c, _d;
|
|
74
|
+
var _a, _b, _c, _d, _e;
|
|
75
75
|
if (isNewUser === true) {
|
|
76
76
|
setUserType(ValidationOptions.NEW_USER);
|
|
77
77
|
}
|
|
@@ -89,7 +89,8 @@ var Merchant = function (_a) {
|
|
|
89
89
|
methods.clearErrors();
|
|
90
90
|
var twitter = ((_b = (_a = formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.social) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.includes('twitter.com'); })) === null || _b === void 0 ? void 0 : _b.replaceAll("".concat(TWITTER_URL, "/"), '')) || '';
|
|
91
91
|
var instagram = ((_d = (_c = formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.social) === null || _c === void 0 ? void 0 : _c.find(function (item) { return item.includes('instagram.com'); })) === null || _d === void 0 ? void 0 : _d.replaceAll("".concat(INSTAGRAM_URL, "/"), '')) || '';
|
|
92
|
-
var
|
|
92
|
+
var website = (_e = formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.website) === null || _e === void 0 ? void 0 : _e.replaceAll(/(https|http):\/\//g, '');
|
|
93
|
+
var sites_1 = __assign(__assign({}, links), { website: website, twitter: twitter, instagram: instagram });
|
|
93
94
|
setTimeout(function () { return methods.setValue('links', sites_1, { shouldValidate: true }); }, 100);
|
|
94
95
|
}
|
|
95
96
|
}, [formDataSelectedBrand, isNewUser]);
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -45,13 +45,14 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
45
45
|
var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
46
46
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
47
47
|
var countries = settingsData.countries;
|
|
48
|
+
var _c = data.individualData || {}, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome, employerLocation = _c.employerLocation, occupation = _c.occupation, isPEP = _c.isPEP, isInfluencer = _c.isInfluencer;
|
|
48
49
|
var methods = useForm({
|
|
49
50
|
resolver: yupResolver(IndividualInfoValidationSchema),
|
|
50
51
|
defaultValues: data.individualData,
|
|
51
52
|
mode: 'onChange'
|
|
52
53
|
});
|
|
53
|
-
var
|
|
54
|
-
var
|
|
54
|
+
var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
|
|
55
|
+
var _e = React.useState(false), employerFieldsActive = _e[0], setEmployerFieldsActive = _e[1];
|
|
55
56
|
React.useEffect(function () {
|
|
56
57
|
var _a, _b;
|
|
57
58
|
if (((_b = (_a = methods.getValues('sourceIncome')) === null || _a === void 0 ? void 0 : _a.name_en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'salary')
|
|
@@ -61,10 +62,23 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
61
62
|
}
|
|
62
63
|
}, [methods.watch('sourceIncome')]);
|
|
63
64
|
React.useEffect(function () {
|
|
64
|
-
if (
|
|
65
|
-
methods.setValue('
|
|
65
|
+
if (!!sourceIncome) {
|
|
66
|
+
methods.setValue('sourceIncome', sourceIncome);
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
if (!!monthlyIncome) {
|
|
69
|
+
methods.setValue('monthlyIncome', monthlyIncome);
|
|
70
|
+
}
|
|
71
|
+
if (!!employerLocation) {
|
|
72
|
+
methods.setValue('employerLocation', employerLocation);
|
|
73
|
+
}
|
|
74
|
+
if (!!occupation) {
|
|
75
|
+
methods.setValue('occupation', occupation);
|
|
76
|
+
}
|
|
77
|
+
if (isPEP !== undefined)
|
|
78
|
+
methods.setValue('isPEP', isPEP);
|
|
79
|
+
if (isInfluencer !== undefined)
|
|
80
|
+
methods.setValue('isInfluencer', isInfluencer);
|
|
81
|
+
}, [data.individualData]);
|
|
68
82
|
var onSubmit = function (data) {
|
|
69
83
|
dispatch(updateIndividualInfo(data));
|
|
70
84
|
};
|
|
@@ -72,7 +72,7 @@ var OTP = function (_a) {
|
|
|
72
72
|
};
|
|
73
73
|
var disabled = !methods.formState.isValid || !!error;
|
|
74
74
|
var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.auth_info) === null || _c === void 0 ? void 0 : _c.phone;
|
|
75
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('
|
|
75
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
76
76
|
};
|
|
77
77
|
OTP.defaultProps = {};
|
|
78
78
|
export default React.memo(OTP);
|
|
@@ -13,9 +13,9 @@ interface UploadFileProps {
|
|
|
13
13
|
dragTitle: string;
|
|
14
14
|
uploadTitle: string;
|
|
15
15
|
error?: string;
|
|
16
|
-
|
|
16
|
+
isSubmitting?: boolean;
|
|
17
17
|
onFileUploaded: (file: File) => void;
|
|
18
18
|
onReset: () => void;
|
|
19
19
|
}
|
|
20
|
-
declare const UploadFile: ({ label, required, dragTitle, uploadTitle,
|
|
20
|
+
declare const UploadFile: ({ label, required, dragTitle, uploadTitle, isSubmitting, error, onFileUploaded, onReset }: UploadFileProps) => JSX.Element;
|
|
21
21
|
export default UploadFile;
|
|
@@ -21,8 +21,6 @@ import Collapse from '../../../components/Collapse';
|
|
|
21
21
|
import Warning from '../../../components/Warning';
|
|
22
22
|
import Icon from '../../../components/Icon';
|
|
23
23
|
import { ICONS_NAMES } from '../../../constants';
|
|
24
|
-
import { useTranslation } from 'react-i18next';
|
|
25
|
-
import Loader from '../../../components/Loader';
|
|
26
24
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
27
25
|
var theme = _a.theme;
|
|
28
26
|
return ({
|
|
@@ -61,17 +59,18 @@ export var InputContainerStyled = styled(Box)(function (_a) {
|
|
|
61
59
|
});
|
|
62
60
|
});
|
|
63
61
|
var UploadFile = function (_a) {
|
|
64
|
-
var label = _a.label, required = _a.required, dragTitle = _a.dragTitle, uploadTitle = _a.uploadTitle,
|
|
62
|
+
var label = _a.label, required = _a.required, dragTitle = _a.dragTitle, uploadTitle = _a.uploadTitle, isSubmitting = _a.isSubmitting, error = _a.error, onFileUploaded = _a.onFileUploaded, onReset = _a.onReset;
|
|
65
63
|
var _b = React.useState(''), fileName = _b[0], setFileName = _b[1];
|
|
66
|
-
var t = useTranslation().t;
|
|
67
64
|
var handleFileChange = function (file) {
|
|
68
65
|
setFileName(file === null || file === void 0 ? void 0 : file.name);
|
|
69
66
|
onFileUploaded === null || onFileUploaded === void 0 ? void 0 : onFileUploaded(file);
|
|
70
67
|
};
|
|
71
68
|
var handleReset = function () {
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
if (!isSubmitting) {
|
|
70
|
+
setFileName('');
|
|
71
|
+
onReset === null || onReset === void 0 ? void 0 : onReset();
|
|
72
|
+
}
|
|
74
73
|
};
|
|
75
|
-
return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(DragAndDrop, { title: dragTitle, onSuccess: handleFileChange }), _jsx(UploadInput, { title: uploadTitle, onChange: handleFileChange })] }) })), _jsx(Collapse, __assign({ in: !!fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(BoxStyled, { children:
|
|
74
|
+
return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(DragAndDrop, { title: dragTitle, onSuccess: handleFileChange }), _jsx(UploadInput, { title: uploadTitle, onChange: handleFileChange })] }) })), _jsx(Collapse, __assign({ in: !!fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(BoxStyled, { children: fileName }), _jsx(UploadBoxStyled, __assign({ onClick: handleReset }, { children: _jsx(IconStyled, { src: ICONS_NAMES.DELETE_ICON }) }))] }) })), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: error })) }))] }));
|
|
76
75
|
};
|
|
77
76
|
export default UploadFile;
|