@tap-payments/auth-jsconnect 2.1.37-test → 2.1.39-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/form.d.ts +4 -7
- package/build/api/auth.d.ts +4 -3
- package/build/api/auth.js +8 -4
- package/build/api/entity.d.ts +0 -8
- package/build/api/entity.js +0 -15
- package/build/api/file.d.ts +13 -0
- package/build/api/file.js +24 -0
- package/build/api/index.d.ts +11 -6
- package/build/api/index.js +3 -1
- package/build/assets/locales/ar.json +5 -1
- package/build/assets/locales/en.json +5 -1
- package/build/components/FileInput/DragAndDrop.js +1 -1
- package/build/components/ProgressBar/CircularProgressBar.d.ts +3 -1
- package/build/components/ProgressBar/CircularProgressBar.js +2 -2
- package/build/components/SimpleList/SimpleList.d.ts +1 -1
- package/build/components/SimpleList/SimpleList.js +3 -3
- package/build/constants/api.d.ts +2 -0
- package/build/constants/api.js +4 -0
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/auth/authStore.js +1 -1
- package/build/features/app/bank/bankStore.js +1 -1
- package/build/features/app/business/businessStore.d.ts +7 -9
- package/build/features/app/business/businessStore.js +29 -67
- package/build/features/app/connect/connectStore.js +21 -33
- package/build/features/app/connectExpress/connectExpressStore.d.ts +18 -5
- package/build/features/app/connectExpress/connectExpressStore.js +197 -6
- package/build/features/app/individual/individualStore.d.ts +4 -16
- package/build/features/app/individual/individualStore.js +11 -89
- package/build/features/app/signIn/signInStore.js +13 -41
- package/build/features/brand/screens/BrandActivities/ActivitiesList.js +1 -1
- package/build/features/brand/screens/BrandInfo/SalesChannels.js +6 -6
- package/build/features/brand/screens/BrandInfo/Segments.js +1 -1
- package/build/features/brand/screens/BrandInfo/TeamSize.js +1 -1
- package/build/features/business/screens/Activities/ActivitiesList.js +1 -1
- package/build/features/business/screens/BusinessType/Article.js +10 -13
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -4
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +12 -50
- package/build/features/business/screens/BusinessType/validation.d.ts +3 -6
- package/build/features/business/screens/BusinessType/validation.js +1 -11
- package/build/features/connect/screens/Merchant/SalesChannels.js +4 -3
- package/build/features/connectExpress/ConnectExpress.d.ts +3 -2
- package/build/features/connectExpress/ConnectExpress.js +7 -14
- package/build/features/connectExpress/screens/CivilID/CivilID.js +13 -31
- package/build/features/connectExpress/screens/CivilID/IDNumber.js +0 -4
- package/build/features/connectExpress/screens/Mobile/Mobile.js +25 -49
- package/build/features/connectExpress/screens/NID/DOB.js +2 -2
- package/build/features/connectExpress/screens/NID/IDNumber.js +1 -5
- package/build/features/connectExpress/screens/NID/NID.js +11 -16
- package/build/features/connectExpress/screens/OTP/OTP.js +13 -23
- package/build/features/entity/screens/EntityCapital/ActivityList.js +1 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +11 -62
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +11 -59
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +6 -12
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -23
- package/build/features/shared/Address/CountryList.js +1 -1
- package/build/features/shared/Address/InputSelect.js +1 -1
- package/build/features/shared/SalesChannels/SalesChannel.d.ts +3 -2
- package/build/features/shared/SalesChannels/SalesChannel.js +25 -11
- package/build/features/shared/UploadFile/UploadFile.js +1 -1
- package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +38 -0
- package/build/features/shared/UploadMultipleFile/UploadFile.js +184 -1
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +27 -0
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +147 -1
- package/build/features/shared/UploadMultipleFile/index.d.ts +2 -0
- package/build/features/shared/UploadMultipleFile/index.js +2 -1
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useCountry.d.ts +4 -0
- package/build/hooks/useCountry.js +7 -0
- package/build/index.d.ts +2 -2
- package/build/index.js +2 -3
- package/build/theme/typography.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { CountryCode, FlowsTypes,
|
|
2
|
+
import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState } from '../../../@types';
|
|
3
3
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
4
|
data: any;
|
|
5
5
|
boardResponse: {
|
|
@@ -53,19 +53,6 @@ export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk
|
|
|
53
53
|
data: any;
|
|
54
54
|
formData: IndividualExtraFormValues;
|
|
55
55
|
}, IndividualExtraFormValues, {}>;
|
|
56
|
-
interface UploadFileParams {
|
|
57
|
-
file: File;
|
|
58
|
-
onProgress?: (value: number) => void;
|
|
59
|
-
title?: string;
|
|
60
|
-
}
|
|
61
|
-
export declare const uploadCivilIdFile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
62
|
-
data: any;
|
|
63
|
-
file: File;
|
|
64
|
-
}, UploadFileParams, {}>;
|
|
65
|
-
export declare const uploadSignatureFile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
66
|
-
data: any;
|
|
67
|
-
file: File;
|
|
68
|
-
}, UploadFileParams, {}>;
|
|
69
56
|
export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
70
57
|
response: any;
|
|
71
58
|
formData: void;
|
|
@@ -77,7 +64,6 @@ export interface IndividualData {
|
|
|
77
64
|
verify: ResponseData & VerifyData;
|
|
78
65
|
otpData: OTPFormValues & ResponseData;
|
|
79
66
|
individualData: IndividualExtraFormValues & ResponseData;
|
|
80
|
-
attachmentsData: IndividualAttachmentsFormValues & ResponseData;
|
|
81
67
|
flowName: FlowsTypes;
|
|
82
68
|
}
|
|
83
69
|
export interface IndividualState extends SharedState<IndividualData> {
|
|
@@ -87,8 +73,10 @@ export declare const individualSlice: import("@reduxjs/toolkit").Slice<Individua
|
|
|
87
73
|
clearError: (state: IndividualState) => void;
|
|
88
74
|
stopLoader: (state: IndividualState) => void;
|
|
89
75
|
resetOTPScreen: (state: IndividualState) => void;
|
|
76
|
+
civilIDUploadingStatus: (state: IndividualState, action: ActionState<boolean>) => void;
|
|
77
|
+
signatureFileUploadingStatus: (state: IndividualState, action: ActionState<boolean>) => void;
|
|
90
78
|
}, "individual/store">;
|
|
91
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
79
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, civilIDUploadingStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, signatureFileUploadingStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
|
|
92
80
|
declare const _default: import("redux").Reducer<IndividualState, import("redux").AnyAction>;
|
|
93
81
|
export default _default;
|
|
94
82
|
export declare const individualSelector: (state: RootState) => IndividualState;
|
|
@@ -285,10 +285,10 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
285
285
|
civilID = params.civilID, signatureFileId = params.signatureFileId;
|
|
286
286
|
businessCountry = settings.data.businessCountry;
|
|
287
287
|
documentsList = [];
|
|
288
|
-
if (
|
|
289
|
-
documentsList.push({ type: 'Civil ID File', images:
|
|
290
|
-
if (
|
|
291
|
-
documentsList.push({ type: 'Signature File', images:
|
|
288
|
+
if ((civilID || []).length > 0)
|
|
289
|
+
documentsList.push({ type: 'Civil ID File', images: civilID });
|
|
290
|
+
if ((signatureFileId || []).length > 0)
|
|
291
|
+
documentsList.push({ type: 'Signature File', images: signatureFileId });
|
|
292
292
|
requestBody = {
|
|
293
293
|
id: id,
|
|
294
294
|
type: type,
|
|
@@ -321,56 +321,6 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
321
321
|
}
|
|
322
322
|
});
|
|
323
323
|
}); });
|
|
324
|
-
export var uploadCivilIdFile = createAsyncThunk('uploadCivilIdFile', function (_a) {
|
|
325
|
-
var file = _a.file, onProgress = _a.onProgress, title = _a.title;
|
|
326
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
327
|
-
var uploadPayload, onUploadProgress, data;
|
|
328
|
-
return __generator(this, function (_b) {
|
|
329
|
-
switch (_b.label) {
|
|
330
|
-
case 0:
|
|
331
|
-
uploadPayload = {
|
|
332
|
-
file_link_create: false,
|
|
333
|
-
title: title,
|
|
334
|
-
purpose: 'identity_document',
|
|
335
|
-
file: file
|
|
336
|
-
};
|
|
337
|
-
onUploadProgress = function (progressEvent) {
|
|
338
|
-
var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
|
|
339
|
-
onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
|
|
340
|
-
};
|
|
341
|
-
return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
342
|
-
case 1:
|
|
343
|
-
data = _b.sent();
|
|
344
|
-
return [2, { data: data, file: file }];
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
export var uploadSignatureFile = createAsyncThunk('uploadSignatureFile', function (_a) {
|
|
350
|
-
var file = _a.file, onProgress = _a.onProgress;
|
|
351
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
352
|
-
var uploadPayload, onUploadProgress, data;
|
|
353
|
-
return __generator(this, function (_b) {
|
|
354
|
-
switch (_b.label) {
|
|
355
|
-
case 0:
|
|
356
|
-
uploadPayload = {
|
|
357
|
-
file_link_create: false,
|
|
358
|
-
title: 'Merchant Signature',
|
|
359
|
-
purpose: 'customer_signature',
|
|
360
|
-
file: file
|
|
361
|
-
};
|
|
362
|
-
onUploadProgress = function (progressEvent) {
|
|
363
|
-
var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
|
|
364
|
-
onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
|
|
365
|
-
};
|
|
366
|
-
return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
|
|
367
|
-
case 1:
|
|
368
|
-
data = _b.sent();
|
|
369
|
-
return [2, { data: data, file: file }];
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
324
|
export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
375
325
|
var _a, settings, individual, _b, id, infoId, payload, data, boardInfoStatus;
|
|
376
326
|
var _c, _d, _e, _f;
|
|
@@ -421,10 +371,6 @@ var initialState = {
|
|
|
421
371
|
employerLocation: undefined,
|
|
422
372
|
isPEP: null,
|
|
423
373
|
isInfluencer: null
|
|
424
|
-
},
|
|
425
|
-
attachmentsData: {
|
|
426
|
-
civilIDUploading: false,
|
|
427
|
-
signatureFileUploading: false
|
|
428
374
|
}
|
|
429
375
|
}
|
|
430
376
|
};
|
|
@@ -440,6 +386,12 @@ export var individualSlice = createSlice({
|
|
|
440
386
|
},
|
|
441
387
|
resetOTPScreen: function (state) {
|
|
442
388
|
state.data.otpData.otp = '';
|
|
389
|
+
},
|
|
390
|
+
civilIDUploadingStatus: function (state, action) {
|
|
391
|
+
state.data.individualData.civilIDUploading = action.payload;
|
|
392
|
+
},
|
|
393
|
+
signatureFileUploadingStatus: function (state, action) {
|
|
394
|
+
state.data.individualData.signatureFileUploading = action.payload;
|
|
443
395
|
}
|
|
444
396
|
},
|
|
445
397
|
extraReducers: function (builder) {
|
|
@@ -590,36 +542,6 @@ export var individualSlice = createSlice({
|
|
|
590
542
|
.addCase(retrieveBoardDetails.rejected, function (state, action) {
|
|
591
543
|
state.error = action.error.message;
|
|
592
544
|
state.loading = false;
|
|
593
|
-
})
|
|
594
|
-
.addCase(uploadCivilIdFile.pending, function (state) {
|
|
595
|
-
state.error = null;
|
|
596
|
-
state.data.attachmentsData.civilIDUploading = true;
|
|
597
|
-
})
|
|
598
|
-
.addCase(uploadCivilIdFile.fulfilled, function (state, action) {
|
|
599
|
-
state.error = null;
|
|
600
|
-
state.data.attachmentsData.civilIDUploading = false;
|
|
601
|
-
var _a = action.payload, data = _a.data, file = _a.file;
|
|
602
|
-
state.data.attachmentsData.civilID = data === null || data === void 0 ? void 0 : data.id;
|
|
603
|
-
state.data.attachmentsData.civilIDFile = file;
|
|
604
|
-
})
|
|
605
|
-
.addCase(uploadCivilIdFile.rejected, function (state) {
|
|
606
|
-
state.data.attachmentsData.civilIDUploading = false;
|
|
607
|
-
state.error = 'file_upload_error';
|
|
608
|
-
})
|
|
609
|
-
.addCase(uploadSignatureFile.pending, function (state) {
|
|
610
|
-
state.error = null;
|
|
611
|
-
state.data.attachmentsData.signatureFileUploading = true;
|
|
612
|
-
})
|
|
613
|
-
.addCase(uploadSignatureFile.fulfilled, function (state, action) {
|
|
614
|
-
state.error = null;
|
|
615
|
-
state.data.attachmentsData.signatureFileUploading = false;
|
|
616
|
-
var _a = action.payload, data = _a.data, file = _a.file;
|
|
617
|
-
state.data.attachmentsData.signatureFileId = data === null || data === void 0 ? void 0 : data.id;
|
|
618
|
-
state.data.attachmentsData.signatureFile = file;
|
|
619
|
-
})
|
|
620
|
-
.addCase(uploadSignatureFile.rejected, function (state) {
|
|
621
|
-
state.data.attachmentsData.signatureFileUploading = false;
|
|
622
|
-
state.error = 'file_upload_error';
|
|
623
545
|
})
|
|
624
546
|
.addCase(updateBoardSuccess.fulfilled, function (state, action) {
|
|
625
547
|
var _a;
|
|
@@ -644,6 +566,6 @@ export var individualSlice = createSlice({
|
|
|
644
566
|
});
|
|
645
567
|
}
|
|
646
568
|
});
|
|
647
|
-
export var clearError = (_a = individualSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
|
|
569
|
+
export var clearError = (_a = individualSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, civilIDUploadingStatus = _a.civilIDUploadingStatus, signatureFileUploadingStatus = _a.signatureFileUploadingStatus;
|
|
648
570
|
export default individualSlice.reducer;
|
|
649
571
|
export var individualSelector = function (state) { return state.individual; };
|
|
@@ -77,11 +77,9 @@ export var createMobileAuth = createAsyncThunk('signIn/createMobileAuth', functi
|
|
|
77
77
|
};
|
|
78
78
|
return [4, API.authService.createAuth(requestBody)];
|
|
79
79
|
case 1:
|
|
80
|
-
data =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
84
|
-
}
|
|
80
|
+
data = _e.sent();
|
|
81
|
+
thunkApi.dispatch(redirection(data === null || data === void 0 ? void 0 : data.auth_type));
|
|
82
|
+
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
85
83
|
return [2, { data: data, formData: params }];
|
|
86
84
|
}
|
|
87
85
|
});
|
|
@@ -108,7 +106,7 @@ export var resendOTPMobile = createAsyncThunk('signIn/resendOTPMobile', function
|
|
|
108
106
|
};
|
|
109
107
|
return [4, API.authService.createAuth(requestBody)];
|
|
110
108
|
case 1:
|
|
111
|
-
data =
|
|
109
|
+
data = _d.sent();
|
|
112
110
|
return [2, data];
|
|
113
111
|
}
|
|
114
112
|
});
|
|
@@ -133,11 +131,9 @@ export var createEmailAuth = createAsyncThunk('signIn/createEmailAuth', function
|
|
|
133
131
|
};
|
|
134
132
|
return [4, API.authService.createAuth(requestBody)];
|
|
135
133
|
case 1:
|
|
136
|
-
data =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
140
|
-
}
|
|
134
|
+
data = _c.sent();
|
|
135
|
+
thunkApi.dispatch(redirection(data === null || data === void 0 ? void 0 : data.auth_type));
|
|
136
|
+
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
141
137
|
return [2, { data: data, formData: params }];
|
|
142
138
|
}
|
|
143
139
|
});
|
|
@@ -162,7 +158,7 @@ export var resendOTPEmail = createAsyncThunk('signIn/resendOTPEmail', function (
|
|
|
162
158
|
};
|
|
163
159
|
return [4, API.authService.createAuth(requestBody)];
|
|
164
160
|
case 1:
|
|
165
|
-
data =
|
|
161
|
+
data = _b.sent();
|
|
166
162
|
return [2, data];
|
|
167
163
|
}
|
|
168
164
|
});
|
|
@@ -243,8 +239,8 @@ var initialState = {
|
|
|
243
239
|
data: {
|
|
244
240
|
auth: {
|
|
245
241
|
countryCode: defaultCountry,
|
|
246
|
-
mobile:
|
|
247
|
-
email:
|
|
242
|
+
mobile: '',
|
|
243
|
+
email: ''
|
|
248
244
|
},
|
|
249
245
|
otpData: {
|
|
250
246
|
otp: ''
|
|
@@ -275,15 +271,9 @@ export var signInSlice = createSlice({
|
|
|
275
271
|
state.error = null;
|
|
276
272
|
})
|
|
277
273
|
.addCase(createMobileAuth.fulfilled, function (state, action) {
|
|
278
|
-
var _a;
|
|
279
274
|
state.loading = false;
|
|
280
275
|
state.error = null;
|
|
281
|
-
var
|
|
282
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
283
|
-
if (description) {
|
|
284
|
-
state.error = description;
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
276
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
287
277
|
state.data.auth = __assign(__assign({}, formData), { email: null, responseBody: data });
|
|
288
278
|
})
|
|
289
279
|
.addCase(createMobileAuth.rejected, function (state, action) {
|
|
@@ -295,15 +285,9 @@ export var signInSlice = createSlice({
|
|
|
295
285
|
state.error = null;
|
|
296
286
|
})
|
|
297
287
|
.addCase(resendOTPMobile.fulfilled, function (state, action) {
|
|
298
|
-
var _a;
|
|
299
288
|
state.loading = false;
|
|
300
289
|
state.error = null;
|
|
301
290
|
var data = action.payload;
|
|
302
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
303
|
-
if (description) {
|
|
304
|
-
state.error = description;
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
291
|
state.data.auth.responseBody = data;
|
|
308
292
|
})
|
|
309
293
|
.addCase(resendOTPMobile.rejected, function (state, action) {
|
|
@@ -315,16 +299,10 @@ export var signInSlice = createSlice({
|
|
|
315
299
|
state.error = null;
|
|
316
300
|
})
|
|
317
301
|
.addCase(createEmailAuth.fulfilled, function (state, action) {
|
|
318
|
-
var _a;
|
|
319
302
|
state.loading = false;
|
|
320
303
|
state.error = null;
|
|
321
|
-
var
|
|
322
|
-
|
|
323
|
-
if (description) {
|
|
324
|
-
state.error = description;
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
state.data.auth = __assign(__assign(__assign({}, state.data.auth), formData), { mobile: null, responseBody: data });
|
|
304
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
305
|
+
state.data.auth = __assign(__assign(__assign({}, state.data.auth), formData), { mobile: '', responseBody: data });
|
|
328
306
|
})
|
|
329
307
|
.addCase(createEmailAuth.rejected, function (state, action) {
|
|
330
308
|
state.loading = false;
|
|
@@ -335,15 +313,9 @@ export var signInSlice = createSlice({
|
|
|
335
313
|
state.error = null;
|
|
336
314
|
})
|
|
337
315
|
.addCase(resendOTPEmail.fulfilled, function (state, action) {
|
|
338
|
-
var _a;
|
|
339
316
|
state.loading = false;
|
|
340
317
|
state.error = null;
|
|
341
318
|
var data = action.payload;
|
|
342
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
343
|
-
if (description) {
|
|
344
|
-
state.error = description;
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
319
|
state.data.auth.responseBody = data;
|
|
348
320
|
})
|
|
349
321
|
.addCase(resendOTPEmail.rejected, function (state, action) {
|
|
@@ -154,7 +154,7 @@ var ActivitiesList = function (_a) {
|
|
|
154
154
|
var getSelectedActivityFlag = function (item) {
|
|
155
155
|
return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === item.id; });
|
|
156
156
|
};
|
|
157
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsxs(InputLabelStyled, { children: [t(isCR ? 'activities' : 'category'), " ", _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Tooltip, __assign({ title: t('activities_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, value: getSelectedActivities(), placeholder: isCR ? t('choose_activities') : t('category_name'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name.en', searchValuePath:
|
|
157
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsxs(InputLabelStyled, { children: [t(isCR ? 'activities' : 'category'), " ", _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Tooltip, __assign({ title: t('activities_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, value: getSelectedActivities(), placeholder: isCR ? t('choose_activities') : t('category_name'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: activitiesMenuList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
158
158
|
var _a, _b, _c;
|
|
159
159
|
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: item.id === ((_a = getSelectedActivityFlag(item)) === null || _a === void 0 ? void 0 : _a.id) }, { children: isAr ? (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = item === null || item === void 0 ? void 0 : item.name) === null || _c === void 0 ? void 0 : _c.en })) })), getSelectedActivityFlag(item) && _jsx(CheckIconStyled, {})] }));
|
|
160
160
|
} }) }))] })] }) })));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useController, useFormContext } from 'react-hook-form';
|
|
4
4
|
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
@@ -7,12 +7,12 @@ import { mapSalesChannel } from '../../../../utils';
|
|
|
7
7
|
import SalesChannel from '../../../shared/SalesChannels';
|
|
8
8
|
var SalesChannels = function (_a) {
|
|
9
9
|
var _b;
|
|
10
|
-
var
|
|
10
|
+
var control = useFormContext().control;
|
|
11
11
|
var dispatch = useAppDispatch();
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var _c = useController({ control: control, name: 'salesChannels' }), fieldState = _c.fieldState, field = _c.field;
|
|
13
|
+
var _d = useAppSelector(brandSelector), data = _d.data, error = _d.error;
|
|
14
14
|
var responseBody = data.verify.responseBody;
|
|
15
|
-
var
|
|
15
|
+
var _e = responseBody || {}, channelList = _e.channel_list, defaultSalesChannels = _e.salesChannels;
|
|
16
16
|
React.useEffect(function () {
|
|
17
17
|
if ((defaultSalesChannels === null || defaultSalesChannels === void 0 ? void 0 : defaultSalesChannels.length) > 0) {
|
|
18
18
|
var sales = mapSalesChannel(defaultSalesChannels);
|
|
@@ -25,6 +25,6 @@ var SalesChannels = function (_a) {
|
|
|
25
25
|
dispatch(clearError());
|
|
26
26
|
field.onChange(channels);
|
|
27
27
|
};
|
|
28
|
-
return
|
|
28
|
+
return _jsx(SalesChannel, { error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels });
|
|
29
29
|
};
|
|
30
30
|
export default SalesChannels;
|
|
@@ -66,7 +66,7 @@ var Segments = function (_a) {
|
|
|
66
66
|
onCloseList();
|
|
67
67
|
segmentControl.field.onChange(segment);
|
|
68
68
|
};
|
|
69
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(Input, { required: true, label: t('segment_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_segment'), value: (isAr ? (_d = segment === null || segment === void 0 ? void 0 : segment.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = segment === null || segment === void 0 ? void 0 : segment.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath:
|
|
69
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(Input, { required: true, label: t('segment_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_segment'), value: (isAr ? (_d = segment === null || segment === void 0 ? void 0 : segment.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = segment === null || segment === void 0 ? void 0 : segment.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: segmentList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
70
70
|
var _a, _b;
|
|
71
71
|
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(CheckIconStyled, {})] }));
|
|
72
72
|
} }) }))] })) })));
|
|
@@ -66,7 +66,7 @@ var TeamSize = function (_a) {
|
|
|
66
66
|
onCloseList();
|
|
67
67
|
teamSizeControl.field.onChange(teamSize);
|
|
68
68
|
};
|
|
69
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(Input, { required: true, label: t('team_size_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_team_size'), value: (isAr ? (_d = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath:
|
|
69
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(Input, { required: true, label: t('team_size_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_team_size'), value: (isAr ? (_d = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: teamSizeList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
70
70
|
var _a, _b;
|
|
71
71
|
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) && _jsx(CheckIconStyled, {})] }));
|
|
72
72
|
} }) }))] })) })));
|
|
@@ -156,7 +156,7 @@ var ActivitiesList = function (_a) {
|
|
|
156
156
|
var getSelectedActivityFlag = function (item) {
|
|
157
157
|
return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === item.id; });
|
|
158
158
|
};
|
|
159
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsxs(InputLabelStyled, { children: [t(isCR ? 'activities' : 'category'), " ", _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Tooltip, __assign({ title: t('activities_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, value: getSelectedActivities() || '', placeholder: isCR ? t('choose_activities') : t('category_name'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name.en', searchValuePath:
|
|
159
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsxs(InputLabelStyled, { children: [t(isCR ? 'activities' : 'category'), " ", _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Tooltip, __assign({ title: t('activities_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, value: getSelectedActivities() || '', placeholder: isCR ? t('choose_activities') : t('category_name'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: activitiesMenuList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
160
160
|
var _a, _b, _c;
|
|
161
161
|
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: item.id === ((_a = getSelectedActivityFlag(item)) === null || _a === void 0 ? void 0 : _a.id) }, { children: isAr ? (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = item === null || item === void 0 ? void 0 : item.name) === null || _c === void 0 ? void 0 : _c.en })) })), getSelectedActivityFlag(item) && _jsx(CheckIconStyled, {})] }));
|
|
162
162
|
} }) }))] })] }));
|
|
@@ -28,17 +28,16 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
var Article = function (_a) {
|
|
31
|
-
var _b, _c;
|
|
32
31
|
var show = _a.show;
|
|
33
|
-
var
|
|
32
|
+
var _b = React.useState(), error = _b[0], setError = _b[1];
|
|
33
|
+
var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
|
|
34
34
|
var t = useTranslation().t;
|
|
35
|
-
var
|
|
35
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
36
36
|
var articleFileControl = useController({ name: 'articleFile', control: control });
|
|
37
37
|
var articleIdControl = useController({ name: 'articleId', control: control });
|
|
38
|
-
var
|
|
38
|
+
var _e = useAppSelector(businessSelector), loading = _e.loading, uploadingArticle = _e.uploadingArticle, sysError = _e.uploadingArticleError, data = _e.data;
|
|
39
39
|
var dispatch = useAppDispatch();
|
|
40
40
|
var articleValue = articleFileControl.field.value;
|
|
41
|
-
var error = ((_b = articleFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = articleIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
|
|
42
41
|
var businessTypeData = data.businessTypeData;
|
|
43
42
|
var articleFile = businessTypeData.articleFile, articleId = businessTypeData.articleId;
|
|
44
43
|
React.useEffect(function () {
|
|
@@ -48,15 +47,16 @@ var Article = function (_a) {
|
|
|
48
47
|
}
|
|
49
48
|
}, [articleFile, articleId]);
|
|
50
49
|
var handleArticleChange = function (files) {
|
|
50
|
+
setError('');
|
|
51
51
|
var file = files === null || files === void 0 ? void 0 : files[0];
|
|
52
52
|
if (!file)
|
|
53
53
|
return;
|
|
54
54
|
if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
55
|
-
setError('
|
|
55
|
+
setError('file_not_supported_alert');
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
|
|
59
|
-
setError('
|
|
59
|
+
setError('file_size_alert');
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
articleFileControl.field.onChange(file);
|
|
@@ -75,16 +75,13 @@ var Article = function (_a) {
|
|
|
75
75
|
};
|
|
76
76
|
React.useEffect(function () {
|
|
77
77
|
if (sysError === 'file_upload_error') {
|
|
78
|
-
setError(
|
|
78
|
+
setError(sysError);
|
|
79
79
|
articleFileControl.field.onChange(undefined);
|
|
80
80
|
setProgress(0);
|
|
81
81
|
}
|
|
82
82
|
}, [sysError]);
|
|
83
|
-
React.useEffect(function () {
|
|
84
|
-
if ((articleFileControl.formState.isValid || !!articleValue) && error != 'file_upload_error')
|
|
85
|
-
clearErrors();
|
|
86
|
-
}, [articleFileControl.formState.isValid, articleValue]);
|
|
87
83
|
var fileName = articleValue ? maskFileName(articleValue === null || articleValue === void 0 ? void 0 : articleValue.name) : '';
|
|
88
|
-
|
|
84
|
+
var errorValue = error || sysError || '';
|
|
85
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_article'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('article_of_association'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleArticleChange, isFileUploaded: !uploadingArticle && !!articleValue, isSubmitting: loading, isUploading: uploadingArticle, progress: progress, onReset: handleReset, error: errorValue && t(errorValue), initialFileName: fileName }) }) })));
|
|
89
86
|
};
|
|
90
87
|
export default Article;
|
|
@@ -28,7 +28,7 @@ import LicenseList from './LicenseList';
|
|
|
28
28
|
var BusinessType = function (_a) {
|
|
29
29
|
var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading, uploadingArticle = _b.uploadingArticle;
|
|
30
30
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
31
|
-
var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId,
|
|
31
|
+
var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId, articleId = _c.articleId, articleFile = _c.articleFile;
|
|
32
32
|
var t = useTranslation().t;
|
|
33
33
|
var isAr = useLanguage().isAr;
|
|
34
34
|
var dispatch = useAppDispatch();
|
|
@@ -41,7 +41,6 @@ var BusinessType = function (_a) {
|
|
|
41
41
|
licenseNumber: licenseNumber,
|
|
42
42
|
entityLegalName: entityLegalName,
|
|
43
43
|
certificateId: certificateId,
|
|
44
|
-
certificateFile: certificateFile,
|
|
45
44
|
articleId: articleId,
|
|
46
45
|
articleFile: articleFile
|
|
47
46
|
},
|
|
@@ -57,8 +56,7 @@ var BusinessType = function (_a) {
|
|
|
57
56
|
selectedLicense: data.selectedLicense,
|
|
58
57
|
licenseNumber: data.licenseNumber,
|
|
59
58
|
entityLegalName: data.entityLegalName,
|
|
60
|
-
certificateId: data.certificateId
|
|
61
|
-
certificateFile: data.certificateFile
|
|
59
|
+
certificateId: data.certificateId
|
|
62
60
|
};
|
|
63
61
|
dispatch(updateLeadBusinessType(dataValues));
|
|
64
62
|
};
|
|
@@ -10,16 +10,14 @@ 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';
|
|
14
|
-
import { styled } from '@mui/material/styles';
|
|
15
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
16
13
|
import { useTranslation } from 'react-i18next';
|
|
17
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
18
15
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
-
import {
|
|
20
|
-
import UploadFile from '../../../shared/UploadFile';
|
|
21
|
-
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
22
17
|
import Collapse from '../../../../components/Collapse';
|
|
18
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
19
|
+
import { businessSelector, uploadingStatus } from '../../../app/business/businessStore';
|
|
20
|
+
import UploadMultipleFile from '../../../shared/UploadMultipleFile';
|
|
23
21
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
24
22
|
var theme = _a.theme;
|
|
25
23
|
return ({
|
|
@@ -27,54 +25,18 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
27
25
|
});
|
|
28
26
|
});
|
|
29
27
|
var LicenseCertificate = function (_a) {
|
|
30
|
-
var _b, _c;
|
|
31
28
|
var show = _a.show;
|
|
32
|
-
var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
|
|
33
29
|
var t = useTranslation().t;
|
|
34
|
-
var
|
|
35
|
-
var certificateFileControl = useController({ name: 'certificateFile', control: control });
|
|
36
|
-
var certificateIdControl = useController({ name: 'certificateId', control: control });
|
|
37
|
-
var _f = useAppSelector(businessSelector), loading = _f.loading, uploading = _f.uploading, sysError = _f.error;
|
|
30
|
+
var control = useFormContext().control;
|
|
38
31
|
var dispatch = useAppDispatch();
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var handleLicenseCertificateChange = function (
|
|
42
|
-
|
|
43
|
-
if (!file)
|
|
44
|
-
return;
|
|
45
|
-
if (!VALID_FILE_FORMATS.includes(file.type)) {
|
|
46
|
-
setError('certificateFile', { message: 'file_not_supported_alert' });
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (file.size > MAX_FILE_SIZE) {
|
|
50
|
-
setError('certificateFile', { message: 'file_size_alert' });
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
certificateFileControl.field.onChange(file);
|
|
54
|
-
dispatch(uploadLicenseCertificate({
|
|
55
|
-
file: file,
|
|
56
|
-
onProgress: function (value) {
|
|
57
|
-
setProgress(value);
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
32
|
+
var certificateIdControl = useController({ name: 'certificateId', control: control });
|
|
33
|
+
var loading = useAppSelector(businessSelector).loading;
|
|
34
|
+
var handleLicenseCertificateChange = function (ids) {
|
|
35
|
+
certificateIdControl.field.onChange(ids);
|
|
60
36
|
};
|
|
61
|
-
var handleReset = function () {
|
|
62
|
-
|
|
63
|
-
certificateIdControl.field.onChange('');
|
|
64
|
-
dispatch(clearCertificateId());
|
|
65
|
-
setProgress(0);
|
|
37
|
+
var handleReset = function (ids) {
|
|
38
|
+
certificateIdControl.field.onChange(ids);
|
|
66
39
|
};
|
|
67
|
-
|
|
68
|
-
if (sysError === 'file_upload_error') {
|
|
69
|
-
setError('certificateId', { message: sysError });
|
|
70
|
-
certificateFileControl.field.onChange(undefined);
|
|
71
|
-
setProgress(0);
|
|
72
|
-
}
|
|
73
|
-
}, [sysError]);
|
|
74
|
-
React.useEffect(function () {
|
|
75
|
-
if ((certificateFileControl.formState.isValid || !!certificateValue) && error != 'file_upload_error')
|
|
76
|
-
clearErrors();
|
|
77
|
-
}, [certificateFileControl.formState.isValid, certificateValue]);
|
|
78
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_license_certificate'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_certificate'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleLicenseCertificateChange, isFileUploaded: !uploading && !!certificateValue, isSubmitting: loading, isUploading: uploading, progress: progress, onReset: handleReset, error: error && t(error) }) }) })));
|
|
40
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_license_certificate'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_certificate'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleLicenseCertificateChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, purpose: 'commercial_registration', fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); } }) }) })));
|
|
79
41
|
};
|
|
80
42
|
export default LicenseCertificate;
|
|
@@ -13,24 +13,21 @@ export declare const KWLicenseValidationSchema: yup.ObjectSchema<import("yup/lib
|
|
|
13
13
|
selectedLicense: any;
|
|
14
14
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
15
15
|
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
16
|
-
certificateId: yup.
|
|
17
|
-
certificateFile: any;
|
|
16
|
+
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
18
17
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
19
18
|
articleFile: any;
|
|
20
19
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
21
20
|
selectedLicense: any;
|
|
22
21
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
22
|
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
24
|
-
certificateId: yup.
|
|
25
|
-
certificateFile: any;
|
|
23
|
+
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
26
24
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
27
25
|
articleFile: any;
|
|
28
26
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
29
27
|
selectedLicense: any;
|
|
30
28
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
31
29
|
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
32
|
-
certificateId: yup.
|
|
33
|
-
certificateFile: any;
|
|
30
|
+
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
34
31
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
35
32
|
articleFile: any;
|
|
36
33
|
}>>>;
|
|
@@ -74,17 +74,7 @@ export var KWLicenseValidationSchema = yup.object().shape({
|
|
|
74
74
|
});
|
|
75
75
|
})
|
|
76
76
|
.required(''),
|
|
77
|
-
certificateId: yup.
|
|
78
|
-
certificateFile: yup
|
|
79
|
-
.mixed()
|
|
80
|
-
.test({
|
|
81
|
-
test: function (value) {
|
|
82
|
-
if (!!value)
|
|
83
|
-
return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE ? true : this.createError({ message: 'alert_file_upload' });
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
.optional(),
|
|
77
|
+
certificateId: yup.array().optional(),
|
|
88
78
|
articleId: yup.string().optional(),
|
|
89
79
|
articleFile: yup
|
|
90
80
|
.mixed()
|