@tap-payments/auth-jsconnect 2.1.31-test → 2.1.33-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.
Files changed (28) hide show
  1. package/build/@types/app.d.ts +4 -0
  2. package/build/@types/form.d.ts +4 -4
  3. package/build/api/entity.d.ts +3 -1
  4. package/build/api/individual.d.ts +2 -1
  5. package/build/components/Lottie/Lottie.d.ts +209 -0
  6. package/build/components/Lottie/Lottie.js +3 -1
  7. package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
  8. package/build/features/app/brand/brandStore.js +3 -3
  9. package/build/features/app/business/businessStore.js +2 -3
  10. package/build/features/app/connect/connectStore.js +2 -2
  11. package/build/features/app/individual/individualStore.d.ts +2 -0
  12. package/build/features/app/individual/individualStore.js +50 -28
  13. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +1 -1
  14. package/build/features/business/screens/BusinessType/BusinessType.js +2 -2
  15. package/build/features/business/screens/BusinessType/LicenseCertificate.js +18 -20
  16. package/build/features/business/screens/BusinessType/validation.d.ts +6 -0
  17. package/build/features/business/screens/BusinessType/validation.js +13 -0
  18. package/build/features/business/screens/Customers/ExpectedSalesRange.js +1 -1
  19. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +1 -1
  20. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +1 -1
  21. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +18 -4
  22. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +1 -1
  23. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +2 -1
  24. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +15 -3
  25. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -3
  26. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -1
  27. package/build/features/shared/PaciVerification/VerifyPACILoading.js +17 -3
  28. package/package.json +129 -129
@@ -275,38 +275,48 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
275
275
  });
276
276
  }); });
277
277
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
278
- var _a, settings, individual, _b, id, type, _c, civilID, signatureFileId, documentBody, requestBody, data;
279
- var _d, _e, _f, _g, _h, _j, _k, _l;
280
- return __generator(this, function (_m) {
281
- switch (_m.label) {
278
+ var _a, settings, individual, _b, id, type, civilID, signatureFileId, businessCountry, documentsList, requestBody, documentBody, data;
279
+ var _c, _d, _e, _f, _g, _h, _j, _k;
280
+ return __generator(this, function (_l) {
281
+ switch (_l.label) {
282
282
  case 0:
283
283
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
284
- _b = ((_e = (_d = individual.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.notification) === null || _e === void 0 ? void 0 : _e.recipient) || {}, id = _b.id, type = _b.type;
285
- _c = individual.data.attachmentsData, civilID = _c.civilID, signatureFileId = _c.signatureFileId;
286
- documentBody = [];
284
+ _b = ((_d = (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id = _b.id, type = _b.type;
285
+ civilID = params.civilID, signatureFileId = params.signatureFileId;
286
+ businessCountry = settings.data.businessCountry;
287
+ documentsList = [];
287
288
  if (!!civilID)
288
- documentBody.push(civilID);
289
+ documentsList.push({ type: 'Civil ID File', images: [civilID] });
289
290
  if (!!signatureFileId)
290
- documentBody.push(signatureFileId);
291
+ documentsList.push({ type: 'Signature File', images: [signatureFileId] });
291
292
  requestBody = {
292
293
  id: id,
293
294
  type: type,
294
- occupation: { id: (_f = params.occupation) === null || _f === void 0 ? void 0 : _f.id },
295
+ occupation: { id: (_e = params.occupation) === null || _e === void 0 ? void 0 : _e.id },
295
296
  employer_name: params.employerName,
296
- employer_country: (_g = params.employerLocation) === null || _g === void 0 ? void 0 : _g.iso2,
297
- source_income: [{ id: (_h = params.sourceIncome) === null || _h === void 0 ? void 0 : _h.id }],
298
- monthly_income: { id: (_j = params.monthlyIncome) === null || _j === void 0 ? void 0 : _j.id },
297
+ employer_country: (_f = params.employerLocation) === null || _f === void 0 ? void 0 : _f.iso2,
298
+ source_income: [{ id: (_g = params.sourceIncome) === null || _g === void 0 ? void 0 : _g.id }],
299
+ monthly_income: { id: (_h = params.monthlyIncome) === null || _h === void 0 ? void 0 : _h.id },
299
300
  is_relative_PEP: params.isPEP,
300
301
  is_influencer: params.isInfluencer,
301
- documents: documentBody,
302
302
  encryption_contract: ['employer_name', 'employer_country'],
303
303
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
304
304
  };
305
- return [4, API.individualService.updateIndividual(requestBody)];
305
+ documentBody = {
306
+ individual_type_id: id || '',
307
+ country: businessCountry.iso2,
308
+ documents: documentsList
309
+ };
310
+ if (!(documentsList.length > 0)) return [3, 2];
311
+ return [4, API.entityService.updateDocumentInfo(documentBody)];
306
312
  case 1:
307
- data = (_m.sent()).data;
313
+ _l.sent();
314
+ _l.label = 2;
315
+ case 2: return [4, API.individualService.updateIndividual(requestBody)];
316
+ case 3:
317
+ data = (_l.sent()).data;
308
318
  thunkApi.dispatch(handleNextScreenStep());
309
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, requestBody);
319
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
310
320
  return [2, { data: data, formData: params }];
311
321
  }
312
322
  });
@@ -331,7 +341,7 @@ export var uploadCivilIdFile = createAsyncThunk('uploadCivilIdFile', function (_
331
341
  return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
332
342
  case 1:
333
343
  data = _b.sent();
334
- return [2, { data: data }];
344
+ return [2, { data: data, file: file }];
335
345
  }
336
346
  });
337
347
  });
@@ -356,7 +366,7 @@ export var uploadSignatureFile = createAsyncThunk('uploadSignatureFile', functio
356
366
  return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
357
367
  case 1:
358
368
  data = _b.sent();
359
- return [2, { data: data }];
369
+ return [2, { data: data, file: file }];
360
370
  }
361
371
  });
362
372
  });
@@ -462,6 +472,14 @@ export var individualSlice = createSlice({
462
472
  var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
463
473
  state.data.individualData.employerLocation = employerLocation;
464
474
  }
475
+ var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
476
+ return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
477
+ });
478
+ var selectedOccupation = occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occup) {
479
+ return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
480
+ });
481
+ state.data.individualData.monthlyIncome = selectedMonthlyIncome;
482
+ state.data.individualData.occupation = selectedOccupation;
465
483
  state.data.individualData.isPEP = is_relative_PEP;
466
484
  state.data.individualData.isInfluencer = is_influencer;
467
485
  })
@@ -515,6 +533,14 @@ export var individualSlice = createSlice({
515
533
  var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
516
534
  state.data.individualData.employerLocation = employerLocation;
517
535
  }
536
+ var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
537
+ return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
538
+ });
539
+ var selectedOccupation = occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occup) {
540
+ return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
541
+ });
542
+ state.data.individualData.monthlyIncome = selectedMonthlyIncome;
543
+ state.data.individualData.occupation = selectedOccupation;
518
544
  state.data.individualData.isPEP = is_relative_PEP;
519
545
  state.data.individualData.isInfluencer = is_influencer;
520
546
  })
@@ -542,15 +568,9 @@ export var individualSlice = createSlice({
542
568
  state.error = null;
543
569
  })
544
570
  .addCase(updateIndividualInfo.fulfilled, function (state, action) {
545
- var _a;
546
571
  state.loading = false;
547
572
  state.error = null;
548
- var _b = action.payload, data = _b.data, formData = _b.formData;
549
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
550
- if (description) {
551
- state.error = description;
552
- return;
553
- }
573
+ var _a = action.payload, data = _a.data, formData = _a.formData;
554
574
  state.data.individualData = formData;
555
575
  state.data.individualData.responseBody = data;
556
576
  })
@@ -580,8 +600,9 @@ export var individualSlice = createSlice({
580
600
  .addCase(uploadCivilIdFile.fulfilled, function (state, action) {
581
601
  state.error = null;
582
602
  state.data.attachmentsData.civilIDUploading = false;
583
- var data = action.payload.data;
603
+ var _a = action.payload, data = _a.data, file = _a.file;
584
604
  state.data.attachmentsData.civilID = data === null || data === void 0 ? void 0 : data.id;
605
+ state.data.attachmentsData.civilIDFile = file;
585
606
  })
586
607
  .addCase(uploadCivilIdFile.rejected, function (state) {
587
608
  state.data.attachmentsData.civilIDUploading = false;
@@ -594,8 +615,9 @@ export var individualSlice = createSlice({
594
615
  .addCase(uploadSignatureFile.fulfilled, function (state, action) {
595
616
  state.error = null;
596
617
  state.data.attachmentsData.signatureFileUploading = false;
597
- var data = action.payload.data;
618
+ var _a = action.payload, data = _a.data, file = _a.file;
598
619
  state.data.attachmentsData.signatureFileId = data === null || data === void 0 ? void 0 : data.id;
620
+ state.data.attachmentsData.signatureFile = file;
599
621
  })
600
622
  .addCase(uploadSignatureFile.rejected, function (state) {
601
623
  state.data.attachmentsData.signatureFileUploading = false;
@@ -113,7 +113,7 @@ var ExpectedSalesRange = function (_a) {
113
113
  setSubIndex(item.id);
114
114
  }, [anchorEl, expectedSalesRangeValue]);
115
115
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
116
- currency: findCurrencyByIso2(countryCode.iso2)
116
+ currency: t(findCurrencyByIso2(countryCode.iso2))
117
117
  }) }), _jsx(InputStyled, { readOnly: true, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
118
118
  var isOnlyOneItem = !item.sub || item.sub.length === 1;
119
119
  if (isOnlyOneItem)
@@ -26,7 +26,7 @@ import { isSA } from '../../../../utils';
26
26
  import { KWLicenseValidationSchema, LicenseValidationSchema } from './validation';
27
27
  import LicenseList from './LicenseList';
28
28
  var BusinessType = function (_a) {
29
- var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading;
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
31
  var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId, certificateFile = _c.certificateFile, articleId = _c.articleId, articleFile = _c.articleFile;
32
32
  var t = useTranslation().t;
@@ -65,7 +65,7 @@ var BusinessType = function (_a) {
65
65
  var onBack = function () {
66
66
  dispatch(handlePrevScreenStep());
67
67
  };
68
- var disabled = !methods.formState.isValid || !!error || uploading;
68
+ var disabled = !methods.formState.isValid || !!error || uploading || uploadingArticle;
69
69
  var disableBack = !data.otpData.isNID;
70
70
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(LicenseList, { onListOpen: function () {
71
71
  setListActive(true);
@@ -39,26 +39,24 @@ var LicenseCertificate = function (_a) {
39
39
  var certificateValue = certificateFileControl.field.value;
40
40
  var error = ((_b = certificateFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = certificateIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
41
41
  var handleLicenseCertificateChange = function (files) {
42
- for (var index = 0; index < files.length; index++) {
43
- var file = files === null || files === void 0 ? void 0 : files[index];
44
- if (!file)
45
- continue;
46
- if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
47
- setError('certificateFile', { message: 'file_not_supported_alert' });
48
- continue;
49
- }
50
- if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
51
- setError('certificateFile', { message: 'file_size_alert' });
52
- continue;
53
- }
54
- certificateFileControl.field.onChange(file);
55
- dispatch(uploadLicenseCertificate({
56
- file: file,
57
- onProgress: function (value) {
58
- setProgress(value);
59
- }
60
- }));
42
+ var file = (files || [])[0];
43
+ if (!file)
44
+ return;
45
+ if (!VALID_FILE_FORMATS.includes(file.type)) {
46
+ setError('certificateFile', { message: 'file_not_supported_alert' });
47
+ return;
61
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
+ }));
62
60
  };
63
61
  var handleReset = function () {
64
62
  certificateFileControl.field.onChange(null);
@@ -76,6 +74,6 @@ var LicenseCertificate = function (_a) {
76
74
  if ((certificateFileControl.formState.isValid || !!certificateValue) && error != 'file_upload_error')
77
75
  clearErrors();
78
76
  }, [certificateFileControl.formState.isValid, certificateValue]);
79
- 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), multiple: true }) }) })));
77
+ 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) }) }) })));
80
78
  };
81
79
  export default LicenseCertificate;
@@ -15,16 +15,22 @@ export declare const KWLicenseValidationSchema: yup.ObjectSchema<import("yup/lib
15
15
  entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
16
16
  certificateId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
17
  certificateFile: any;
18
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
19
+ articleFile: any;
18
20
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
19
21
  selectedLicense: any;
20
22
  licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
23
  entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
22
24
  certificateId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
25
  certificateFile: any;
26
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
27
+ articleFile: any;
24
28
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
25
29
  selectedLicense: any;
26
30
  licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
27
31
  entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
28
32
  certificateId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
29
33
  certificateFile: any;
34
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
35
+ articleFile: any;
30
36
  }>>>;
@@ -85,6 +85,19 @@ export var KWLicenseValidationSchema = yup.object().shape({
85
85
  : this.createError({ message: 'alert_file_upload' });
86
86
  return true;
87
87
  }
88
+ })
89
+ .optional(),
90
+ articleId: yup.string().optional(),
91
+ articleFile: yup
92
+ .mixed()
93
+ .test({
94
+ test: function (value) {
95
+ if (!!value)
96
+ 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
97
+ ? true
98
+ : this.createError({ message: 'alert_file_upload' });
99
+ return true;
100
+ }
88
101
  })
89
102
  .optional()
90
103
  });
@@ -113,7 +113,7 @@ var ExpectedSalesRange = function (_a) {
113
113
  setSubIndex(item.id);
114
114
  }, [anchorEl, expectedSalesRangeValue]);
115
115
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
116
- currency: findCurrencyByIso2(countryCode.iso2)
116
+ currency: t(findCurrencyByIso2(countryCode.iso2))
117
117
  }) }), _jsx(InputStyled, { readOnly: true, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
118
118
  var isOnlyOneItem = !item.sub || item.sub.length === 1;
119
119
  if (isOnlyOneItem)
@@ -41,7 +41,7 @@ var CapitalPaid = function (_a) {
41
41
  var error = (_e = capitalPaidControl.fieldState.error) === null || _e === void 0 ? void 0 : _e.message;
42
42
  var hide = !paid && disabled;
43
43
  return (_jsx(Collapse, __assign({ in: !hide }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('capital_paid_label', {
44
- currency: findCurrencyByIso2(countryCode)
44
+ currency: t(findCurrencyByIso2(countryCode))
45
45
  }), onChange: handleChange, disabled: disabled, value: capitalPaidValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_paid_hint'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
46
46
  };
47
47
  export default React.memo(CapitalPaid);
@@ -41,7 +41,7 @@ var CapitalShareValue = function (_a) {
41
41
  var capitalShareValueValue = capitalShareValueControl.field.value;
42
42
  var error = (_f = capitalShareValueControl.fieldState.error) === null || _f === void 0 ? void 0 : _f.message;
43
43
  return (_jsx(Collapse, __assign({ in: !hide }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('capital_share_value_label', {
44
- currency: findCurrencyByIso2(countryCode)
44
+ currency: t(findCurrencyByIso2(countryCode))
45
45
  }), onChange: handleChange, disabled: disabled, value: capitalShareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_share_value_hint'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
46
46
  };
47
47
  export default React.memo(CapitalShareValue);
@@ -8,6 +8,7 @@ import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
8
  import { individualSelector, uploadCivilIdFile } from '../../../../features/app/individual/individualStore';
9
9
  import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
10
10
  import UploadFile from '../../../../features/shared/UploadFile';
11
+ import { maskFileName } from '../../../../utils';
11
12
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
12
13
  var theme = _a.theme;
13
14
  return ({
@@ -18,11 +19,11 @@ var CivilIDFile = function () {
18
19
  var _a, _b;
19
20
  var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
20
21
  var t = useTranslation().t;
21
- var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors;
22
+ var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors, setValue = _d.setValue;
22
23
  var civilIDFileControl = useController({ name: 'civilIDFile', control: control });
23
- var civilIDFileIdControl = useController({ name: 'civilIDFileId', control: control });
24
+ var civilIDFileIdControl = useController({ name: 'civilID', control: control });
24
25
  var _e = useAppSelector(individualSelector), data = _e.data, loading = _e.loading, sysError = _e.error;
25
- var civilIDUploading = data.attachmentsData.civilIDUploading;
26
+ var _f = data.attachmentsData, civilIDUploading = _f.civilIDUploading, civilIDFile = _f.civilIDFile, civilID = _f.civilID;
26
27
  var dispatch = useAppDispatch();
27
28
  var civilIDValue = civilIDFileControl.field.value;
28
29
  var error = ((_a = civilIDFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = civilIDFileIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
@@ -51,6 +52,12 @@ var CivilIDFile = function () {
51
52
  civilIDFileIdControl.field.onChange('');
52
53
  setProgress(0);
53
54
  };
55
+ React.useEffect(function () {
56
+ if (!!civilIDFile) {
57
+ setValue('civilIDFile', civilIDFile);
58
+ setValue('civilID', civilID);
59
+ }
60
+ }, [civilIDFile, civilID]);
54
61
  React.useEffect(function () {
55
62
  if (sysError === 'file_upload_error') {
56
63
  setError('civilIDFileId', { message: sysError });
@@ -62,6 +69,13 @@ var CivilIDFile = function () {
62
69
  if ((civilIDFileControl.formState.isValid || !!civilIDValue) && error != 'file_upload_error')
63
70
  clearErrors();
64
71
  }, [civilIDFileControl.formState.isValid, civilIDValue]);
65
- return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isFileUploaded: !civilIDUploading && !!civilIDValue, isSubmitting: loading, isUploading: civilIDUploading, progress: progress, onReset: handleReset, error: error && t(error) }) }));
72
+ React.useEffect(function () {
73
+ if (!!civilIDFile) {
74
+ civilIDFileControl.field.onChange(civilIDFile);
75
+ civilIDFileIdControl.field.onChange(civilID);
76
+ }
77
+ }, []);
78
+ var fileName = civilIDValue ? maskFileName(civilIDValue === null || civilIDValue === void 0 ? void 0 : civilIDValue.name) : '';
79
+ return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isFileUploaded: !civilIDUploading && !!civilIDValue, isSubmitting: loading, isUploading: civilIDUploading, progress: progress, onReset: handleReset, initialFileName: fileName, error: error && t(error) }) }));
66
80
  };
67
81
  export default CivilIDFile;
@@ -99,7 +99,7 @@ var MonthlyIncome = function (_a) {
99
99
  var income = monthlyIncomeControl.field.value;
100
100
  var error = (_b = monthlyIncomeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
101
101
  return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(Input, { label: t('please_enter_actual_income', {
102
- currency: findCurrencyByIso2(countryCode.iso2)
102
+ currency: t(findCurrencyByIso2(countryCode.iso2))
103
103
  }), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'range.en', list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
104
104
  return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (income === null || income === void 0 ? void 0 : income.id) }, { children: isAr ? item.range.ar : item === null || item === void 0 ? void 0 : item.range.en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIconStyled, {})] }));
105
105
  } })] }))] })) })));
@@ -91,7 +91,8 @@ var Occupation = function (_a) {
91
91
  var occupation = occupationControl.field.value;
92
92
  var error = (_c = occupationControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
93
93
  return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('occupation_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_occupation'), value: (isAr ? occupation === null || occupation === void 0 ? void 0 : occupation.name.ar : occupation === null || occupation === void 0 ? void 0 : occupation.name.en) || '', warningMessage: error && t(error) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.en', list: occupationList, onSelectItem: onSelectItem, renderItem: function (item) {
94
- return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id) }, { children: isAr ? item.name.ar : item === null || item === void 0 ? void 0 : item.name.en })) }), item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id) && _jsx(CheckIconStyled, {})] }));
94
+ var _a, _b;
95
+ return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.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 === (occupation === null || occupation === void 0 ? void 0 : occupation.id) && _jsx(CheckIconStyled, {})] }));
95
96
  } })] }))] })) })));
96
97
  };
97
98
  export default Occupation;
@@ -20,6 +20,7 @@ import { individualSelector, uploadSignatureFile } from '../../../../features/ap
20
20
  import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
21
21
  import UploadFile from '../../../../features/shared/UploadFile';
22
22
  import Collapse from '../../../../components/Collapse';
23
+ import { maskFileName } from '../../../../utils';
23
24
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
24
25
  var theme = _a.theme;
25
26
  return ({
@@ -31,11 +32,11 @@ var SignatureFile = function (_a) {
31
32
  var show = _a.show;
32
33
  var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
33
34
  var t = useTranslation().t;
34
- var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors;
35
+ var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors, setValue = _e.setValue;
35
36
  var signatureFileControl = useController({ name: 'signatureFile', control: control });
36
37
  var signatureFileIdControl = useController({ name: 'signatureFileId', control: control });
37
38
  var _f = useAppSelector(individualSelector), data = _f.data, loading = _f.loading, sysError = _f.error;
38
- var signatureFileUploading = data.attachmentsData.signatureFileUploading;
39
+ var _g = data.attachmentsData, signatureFileUploading = _g.signatureFileUploading, signatureFile = _g.signatureFile, signatureFileId = _g.signatureFileId;
39
40
  var dispatch = useAppDispatch();
40
41
  var signatureValue = signatureFileControl.field.value;
41
42
  var error = ((_b = signatureFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = signatureFileIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
@@ -73,6 +74,17 @@ var SignatureFile = function (_a) {
73
74
  if ((signatureFileControl.formState.isValid || !!signatureValue) && error != 'file_upload_error')
74
75
  clearErrors();
75
76
  }, [signatureFileControl.formState.isValid, signatureValue]);
76
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isFileUploaded: !signatureFileUploading && !!signatureValue, isSubmitting: loading, isUploading: signatureFileUploading, progress: progress, onReset: handleReset, error: error && t(error) }) }) })));
77
+ React.useEffect(function () {
78
+ if (!!signatureFile) {
79
+ setValue('signatureFile', signatureFile);
80
+ setValue('signatureFileId', signatureFileId);
81
+ }
82
+ }, [signatureFile, signatureFileId]);
83
+ React.useEffect(function () {
84
+ if (!!signatureValue)
85
+ signatureFileControl.field.onChange(signatureFile);
86
+ }, []);
87
+ var fileName = signatureValue ? maskFileName(signatureValue === null || signatureValue === void 0 ? void 0 : signatureValue.name) : '';
88
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isFileUploaded: !signatureFileUploading && !!signatureValue, isSubmitting: loading, initialFileName: fileName, isUploading: signatureFileUploading, progress: progress, onReset: handleReset, error: error && t(error) }) }) })));
77
89
  };
78
90
  export default SignatureFile;
@@ -6,7 +6,7 @@ export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yu
6
6
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
7
7
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
8
8
  employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
9
- civilIDFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
9
+ civilID: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
10
10
  civilIDFile: any;
11
11
  signatureFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
12
  signatureFile: any;
@@ -17,7 +17,7 @@ export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yu
17
17
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
18
18
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
19
19
  employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
20
- civilIDFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
20
+ civilID: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
21
21
  civilIDFile: any;
22
22
  signatureFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
23
  signatureFile: any;
@@ -28,7 +28,7 @@ export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yu
28
28
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
29
29
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
30
30
  employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
31
- civilIDFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
31
+ civilID: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
32
32
  civilIDFile: any;
33
33
  signatureFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
34
34
  signatureFile: any;
@@ -20,7 +20,7 @@ export var IndividualInfoValidationSchema = yup.object().shape({
20
20
  return yup.object().optional();
21
21
  }
22
22
  }),
23
- civilIDFileId: yup.string().optional(),
23
+ civilID: yup.string().optional(),
24
24
  civilIDFile: yup
25
25
  .mixed()
26
26
  .test({
@@ -1,12 +1,26 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
+ import { styled } from '@mui/material/styles';
3
4
  import LottieFile, { LottieAnimationFiles } from '../../../components/Lottie';
5
+ import Icon from '../../../components/Icon';
6
+ import { ICONS_NAMES } from '../../../constants';
7
+ var IconStyled = styled(Icon)(function (_a) {
8
+ var theme = _a.theme;
9
+ return ({
10
+ position: 'absolute',
11
+ top: '50%',
12
+ left: '50%',
13
+ transform: 'translate(-50%, -50%)',
14
+ width: 64,
15
+ height: 64
16
+ });
17
+ });
4
18
  var VerifyPACILoading = function (_a) {
5
19
  var _b = _a.loop, loop = _b === void 0 ? true : _b, type = _a.type;
6
20
  if (type === 1)
7
- return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.start_loading, loop: loop, width: '60%' }) }));
21
+ return (_jsxs(_Fragment, { children: [_jsx(LottieFile, { file: LottieAnimationFiles.pulsating_circle_waves, loop: loop, width: '90%' }), _jsx(IconStyled, { src: ICONS_NAMES.PACI_VERIFY_ICON })] }));
8
22
  if (type === 2)
9
- return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.still_loading, loop: loop, width: '60%' }) }));
23
+ return (_jsxs(_Fragment, { children: [_jsx(LottieFile, { file: LottieAnimationFiles.pulsating_circle_waves, loop: loop, width: '90%' }), _jsx(IconStyled, { src: ICONS_NAMES.PACI_VERIFY_ICON })] }));
10
24
  return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.error, loop: false, width: '60%' }) }));
11
25
  };
12
26
  VerifyPACILoading.defaultProps = {};