@tap-payments/auth-jsconnect 2.3.22-test → 2.3.25-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.
@@ -48,7 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
- import { FlowsTypes } from '../../../@types';
51
+ import { DocumentPurpose, FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BANK_STEP_NAMES } from '../../../constants';
54
54
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
@@ -180,10 +180,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBankEntityInfo', fun
180
180
  });
181
181
  }); });
182
182
  export var createBankAccount = createAsyncThunk('createBankAccount', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
183
- var _a, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, bank_account, isIBANEditable, isBeneficiaryNameEditable, isBankNameEditable, isBankStatementIdEditable, documentResponse, hasDocument, documentId, documentBody, requestBody, data;
184
- var _b, _c, _d, _e, _f, _g, _h, _j;
185
- return __generator(this, function (_k) {
186
- switch (_k.label) {
183
+ var _a, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, bank_account, isIBANEditable, isBeneficiaryNameEditable, isBankNameEditable, isBankStatementIdEditable, documentResponse, hasDocument, documentId, requestBody, data, documentBody;
184
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
185
+ return __generator(this, function (_l) {
186
+ switch (_l.label) {
187
187
  case 0:
188
188
  _a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
189
189
  iban = params.iban, beneficiaryName = params.beneficiaryName, bankName = params.bankName, bankStatementId = params.bankStatementId, confirmPolicy = params.confirmPolicy;
@@ -195,16 +195,6 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
195
195
  documentResponse = undefined;
196
196
  hasDocument = isBankStatementIdEditable && (bankStatementId || []).length > 0;
197
197
  documentId = (_b = bank_account === null || bank_account === void 0 ? void 0 : bank_account.document) === null || _b === void 0 ? void 0 : _b.id;
198
- if (!(documentId && hasDocument)) return [3, 2];
199
- documentBody = {
200
- id: documentId,
201
- files: bankStatementId || []
202
- };
203
- return [4, API.documentService.addFilesToExistingDocument(documentBody)];
204
- case 1:
205
- documentResponse = _k.sent();
206
- _k.label = 2;
207
- case 2:
208
198
  requestBody = {
209
199
  wallet_id: (_g = (_f = (_e = (_d = (_c = bank.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.business) === null || _d === void 0 ? void 0 : _d.entity) === null || _e === void 0 ? void 0 : _e.merchant) === null || _f === void 0 ? void 0 : _f.wallet) === null || _g === void 0 ? void 0 : _g.id,
210
200
  bank_account: {
@@ -214,7 +204,7 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
214
204
  is_acknowledged: confirmPolicy,
215
205
  document: !documentId && hasDocument
216
206
  ? {
217
- type: 'bank_statement',
207
+ type: DocumentPurpose.BANK_STATEMENT,
218
208
  files: bankStatementId || []
219
209
  }
220
210
  : undefined
@@ -223,13 +213,23 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
223
213
  encryption_contract: ['bank_account.iban', 'bank_account.beneficiary_name', 'bank_account.bank_name']
224
214
  };
225
215
  return [4, API.entityService.createBankAccount(requestBody)];
216
+ case 1:
217
+ data = (_l.sent()).data;
218
+ if ((_h = data.errors) === null || _h === void 0 ? void 0 : _h.length)
219
+ throw new Error(data.errors[0].description);
220
+ if (!(documentId && hasDocument)) return [3, 3];
221
+ documentBody = {
222
+ id: documentId,
223
+ files: bankStatementId || []
224
+ };
225
+ return [4, API.documentService.addFilesToExistingDocument(documentBody)];
226
+ case 2:
227
+ documentResponse = _l.sent();
228
+ _l.label = 3;
226
229
  case 3:
227
- data = (_k.sent()).data;
228
- if (!data.errors) {
229
- data.documentData = documentResponse;
230
- thunkApi.dispatch(handleNextScreenStep());
231
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
232
- }
230
+ data.documentData = documentResponse;
231
+ thunkApi.dispatch(handleNextScreenStep());
232
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
233
233
  return [2, { data: data, formData: params }];
234
234
  }
235
235
  });
@@ -427,15 +427,9 @@ export var bankSlice = createSlice({
427
427
  state.error = null;
428
428
  })
429
429
  .addCase(createBankAccount.fulfilled, function (state, action) {
430
- var _a;
431
430
  state.loading = false;
432
431
  state.error = null;
433
- var _b = action.payload, data = _b.data, formData = _b.formData;
434
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
435
- if (description) {
436
- state.error = description;
437
- return;
438
- }
432
+ var _a = action.payload, data = _a.data, formData = _a.formData;
439
433
  state.data.bankData = formData;
440
434
  state.data.bankData.responseBody = data;
441
435
  })
@@ -490,6 +490,7 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
490
490
  entity_id: entityId || '',
491
491
  documents: [
492
492
  {
493
+ type: DocumentPurpose.CR,
493
494
  images: params.certificateId
494
495
  }
495
496
  ]
@@ -242,7 +242,7 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
242
242
  });
243
243
  }); });
244
244
  export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
245
- var _a, settings, entity, entityData, _b, id, data_status, data_verification, issuingDate, expiryDate, isFL, isLegalNameEditable, isLicenseTypeEditable, isEntityTypeEditable, isLicenseNumberEditable, isUnifiedNumberEditable, isIssuingDateEditable, isExpiryDateEditable, isEntityTypeVerified, documentResponse, document, documentBody, documentBody, payload, data, list;
245
+ var _a, settings, entity, entityData, _b, id, data_status, data_verification, issuingDate, expiryDate, isFL, isLegalNameEditable, isLicenseTypeEditable, isEntityTypeEditable, isLicenseNumberEditable, isUnifiedNumberEditable, isIssuingDateEditable, isExpiryDateEditable, isEntityTypeVerified, payload, data, documentResponse, document, documentBody, documentBody, list;
246
246
  var _c, _d;
247
247
  return __generator(this, function (_e) {
248
248
  switch (_e.label) {
@@ -261,32 +261,6 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
261
261
  isIssuingDateEditable = true;
262
262
  isExpiryDateEditable = true;
263
263
  isEntityTypeVerified = hasVerifiedValue(data_verification, 'type');
264
- documentResponse = undefined;
265
- document = getRecentDocumentBasedOnPurpose(entityData === null || entityData === void 0 ? void 0 : entityData.documents, DocumentPurpose.CR);
266
- if (!((params.certificateId || []).length > 0)) return [3, 4];
267
- if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 2];
268
- documentBody = {
269
- id: document.id,
270
- images: params.certificateId
271
- };
272
- return [4, API.documentService.addFilesToExistingDocument(documentBody)];
273
- case 1:
274
- documentResponse = _e.sent();
275
- return [3, 4];
276
- case 2:
277
- documentBody = {
278
- entity_id: id || '',
279
- documents: [
280
- {
281
- images: params.certificateId
282
- }
283
- ]
284
- };
285
- return [4, API.documentService.updateDocumentInfo(documentBody)];
286
- case 3:
287
- documentResponse = _e.sent();
288
- _e.label = 4;
289
- case 4:
290
264
  payload = {
291
265
  id: id,
292
266
  AOA_file_id: params.articleId,
@@ -320,11 +294,41 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
320
294
  ]
321
295
  };
322
296
  return [4, API.entityService.updateEntity(payload)];
323
- case 5:
297
+ case 1:
324
298
  data = _e.sent();
325
- data.documentData = documentResponse;
326
- return [4, API.dataService.getActivities()];
299
+ documentResponse = undefined;
300
+ document = getRecentDocumentBasedOnPurpose(entityData === null || entityData === void 0 ? void 0 : entityData.documents, DocumentPurpose.CR);
301
+ if (!((params.certificateId || []).length > 0)) return [3, 7];
302
+ if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
303
+ documentBody = {
304
+ id: document.id,
305
+ images: params.certificateId
306
+ };
307
+ return [4, API.documentService.addFilesToExistingDocument(documentBody)];
308
+ case 2:
309
+ documentResponse = _e.sent();
310
+ return [3, 5];
311
+ case 3:
312
+ documentBody = {
313
+ entity_id: id || '',
314
+ documents: [
315
+ {
316
+ type: DocumentPurpose.CR,
317
+ images: params.certificateId
318
+ }
319
+ ]
320
+ };
321
+ return [4, API.documentService.updateDocumentInfo(documentBody)];
322
+ case 4:
323
+ documentResponse = _e.sent();
324
+ _e.label = 5;
325
+ case 5: return [4, API.entityService.retrieveEntity(id)];
327
326
  case 6:
327
+ data = _e.sent();
328
+ data.documentData = documentResponse;
329
+ _e.label = 7;
330
+ case 7: return [4, API.dataService.getActivities()];
331
+ case 8:
328
332
  list = (_e.sent()).list;
329
333
  data.activityList = list;
330
334
  thunkApi.dispatch(handleNextScreenStep());
@@ -619,7 +619,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
619
619
  };
620
620
  return [4, API.individualService.updateIndividual(requestBody)];
621
621
  case 1:
622
- data = (_h.sent()).data;
622
+ data = _h.sent();
623
623
  if (!(type === IndividualType.USER || type === IndividualType.BUYER)) return [3, 3];
624
624
  return [4, thunkApi.dispatch(retrieveDataList(code))];
625
625
  case 2:
@@ -633,7 +633,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
633
633
  });
634
634
  }); });
635
635
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
636
- var _a, settings, individual, _b, notification, user, _c, id, type, civilID, signatureFileId, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, isOccupationEditable, isSourceIncomeEditable, isPEPEditable, isInfluencerEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, payload, requestBody, data;
636
+ var _a, settings, individual, _b, notification, user, _c, id, type, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, isOccupationEditable, isSourceIncomeEditable, isPEPEditable, isInfluencerEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, payload, requestBody, data, civilID, signatureFileId, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody;
637
637
  var _d, _e;
638
638
  return __generator(this, function (_f) {
639
639
  switch (_f.label) {
@@ -641,49 +641,6 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
641
641
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
642
642
  _b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user;
643
643
  _c = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
644
- civilID = params.civilID, signatureFileId = params.signatureFileId;
645
- businessCountry = settings.data.businessCountry;
646
- hasCivilIdDocument = (civilID || []).length > 0;
647
- hasSignatureDocument = (signatureFileId || []).length > 0;
648
- isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && (type === IndividualType.USER || type === IndividualType.BUYER);
649
- civilIdDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT);
650
- signatureDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE);
651
- if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 2];
652
- documentBody = {
653
- id: civilIdDocument.id,
654
- images: civilID
655
- };
656
- return [4, API.documentService.addFilesToExistingDocument(documentBody)];
657
- case 1:
658
- _f.sent();
659
- _f.label = 2;
660
- case 2:
661
- if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 4];
662
- documentBody = {
663
- id: signatureDocument.id,
664
- images: signatureFileId
665
- };
666
- return [4, API.documentService.addFilesToExistingDocument(documentBody)];
667
- case 3:
668
- _f.sent();
669
- _f.label = 4;
670
- case 4:
671
- documentsList = [];
672
- if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
673
- documentsList.push({ type: 'Civil ID File', images: civilID });
674
- if (isSendSignatureFile && hasSignatureDocument && !(signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id))
675
- documentsList.push({ type: 'Signature File', images: signatureFileId });
676
- if (!(documentsList.length > 0)) return [3, 6];
677
- documentBody = {
678
- individual_type_id: id || '',
679
- country: businessCountry.iso2,
680
- documents: documentsList
681
- };
682
- return [4, API.documentService.updateDocumentInfo(documentBody)];
683
- case 5:
684
- _f.sent();
685
- _f.label = 6;
686
- case 6:
687
644
  occupation = params.occupation, sourceIncome = params.sourceIncome, monthlyIncome = params.monthlyIncome, isPEP = params.isPEP, isInfluencer = params.isInfluencer, shareCount = params.shareCount, shareValue = params.shareValue;
688
645
  isOccupationEditable = true;
689
646
  isSourceIncomeEditable = true;
@@ -730,8 +687,51 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
730
687
  payload = {};
731
688
  requestBody = __assign(__assign({ id: id, type: type }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
732
689
  return [4, API.individualService.updateIndividual(requestBody)];
690
+ case 1:
691
+ data = _f.sent();
692
+ civilID = params.civilID, signatureFileId = params.signatureFileId;
693
+ businessCountry = settings.data.businessCountry;
694
+ hasCivilIdDocument = (civilID || []).length > 0;
695
+ hasSignatureDocument = (signatureFileId || []).length > 0;
696
+ isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && (type === IndividualType.USER || type === IndividualType.BUYER);
697
+ civilIdDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT);
698
+ signatureDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE);
699
+ if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 3];
700
+ documentBody = {
701
+ id: civilIdDocument.id,
702
+ images: civilID
703
+ };
704
+ return [4, API.documentService.addFilesToExistingDocument(documentBody)];
705
+ case 2:
706
+ _f.sent();
707
+ _f.label = 3;
708
+ case 3:
709
+ if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 5];
710
+ documentBody = {
711
+ id: signatureDocument.id,
712
+ images: signatureFileId
713
+ };
714
+ return [4, API.documentService.addFilesToExistingDocument(documentBody)];
715
+ case 4:
716
+ _f.sent();
717
+ _f.label = 5;
718
+ case 5:
719
+ documentsList = [];
720
+ if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
721
+ documentsList.push({ type: DocumentPurpose.IDENTITY_DOCUMENT, images: civilID });
722
+ if (isSendSignatureFile && hasSignatureDocument && !(signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id))
723
+ documentsList.push({ type: DocumentPurpose.CUSTOMER_SIGNATURE, images: signatureFileId });
724
+ if (!(documentsList.length > 0)) return [3, 7];
725
+ documentBody = {
726
+ individual_type_id: id || '',
727
+ country: businessCountry.iso2,
728
+ documents: documentsList
729
+ };
730
+ return [4, API.documentService.updateDocumentInfo(documentBody)];
731
+ case 6:
732
+ _f.sent();
733
+ _f.label = 7;
733
734
  case 7:
734
- data = (_f.sent()).data;
735
735
  thunkApi.dispatch(handleNextScreenStep());
736
736
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
737
737
  return [2, { data: data, formData: params }];
@@ -206,6 +206,7 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, t
206
206
  entity_id: entityId || '',
207
207
  documents: [
208
208
  {
209
+ type: DocumentPurpose.TAX_DOCUMENT,
209
210
  images: params.documentId
210
211
  }
211
212
  ]
@@ -14,11 +14,12 @@ import * as React from 'react';
14
14
  import { yupResolver } from '@hookform/resolvers/yup';
15
15
  import { useForm, FormProvider } from 'react-hook-form';
16
16
  import { useTranslation } from 'react-i18next';
17
- import { handleCurrentActiveScreen } from '../../../../app/settings';
17
+ import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
18
18
  import Box from '@mui/material/Box';
19
19
  import { alpha, styled } from '@mui/material/styles';
20
20
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage } from '../../../../hooks';
21
21
  import { IndividualType } from '../../../../@types';
22
+ import { isSA } from '../../../../utils';
22
23
  import Form from '../../../../components/Form';
23
24
  import Collapse from '../../../../components/Collapse';
24
25
  import Text from '../../../../components/Text';
@@ -54,6 +55,7 @@ var AdditionalIndividualInfo = function (_a) {
54
55
  var isAr = useLanguage().isAr;
55
56
  var dispatch = useAppDispatch();
56
57
  var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
58
+ var settingsData = useAppSelector(settingsSelector).data;
57
59
  var verify = data.verify;
58
60
  var user = (verify.responseBody || {}).user;
59
61
  var isAuthorizedUser = user === null || user === void 0 ? void 0 : user.is_authorized;
@@ -79,6 +81,7 @@ var AdditionalIndividualInfo = function (_a) {
79
81
  });
80
82
  useSetFromDefaultValues(methods, data.individualData, true);
81
83
  var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
84
+ var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
82
85
  var onSubmit = function (data) {
83
86
  dispatch(updateIndividualInfo(data));
84
87
  };
@@ -113,7 +116,7 @@ var AdditionalIndividualInfo = function (_a) {
113
116
  var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
114
117
  var isOccupationListActive = listActive === ListType.OccupationList;
115
118
  var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
116
- return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserRole() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares }), _jsx(ShareValue, { show: !listActive && showShares }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, {}), _jsx(SignatureFile, { show: (user === null || user === void 0 ? void 0 : user.is_authorized) && showSignatureFile })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive }), _jsx(InfluencerSwitch, { show: showIsInfluencer && !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
119
+ return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserRole() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares }), _jsx(ShareValue, { show: !listActive && showShares }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, { show: !isSACountry }), _jsx(SignatureFile, { show: (user === null || user === void 0 ? void 0 : user.is_authorized) && showSignatureFile })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive }), _jsx(InfluencerSwitch, { show: showIsInfluencer && !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
117
120
  };
118
121
  export default React.memo(AdditionalIndividualInfo);
119
122
  AdditionalIndividualInfo.defaultProps = {};
@@ -1,3 +1,6 @@
1
1
  /// <reference types="react" />
2
- declare const CivilIDFile: () => JSX.Element;
2
+ interface CivilIDFileProps {
3
+ show: boolean;
4
+ }
5
+ declare const CivilIDFile: ({ show }: CivilIDFileProps) => JSX.Element;
3
6
  export default CivilIDFile;
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { jsx as _jsx } from "react/jsx-runtime";
2
13
  import React from 'react';
3
14
  import { ScreenContainer } from '../../../../features/shared/Containers';
@@ -7,8 +18,9 @@ import { useController, useFormContext } from 'react-hook-form';
7
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
19
  import { DocumentPurpose } from '../../../../@types';
9
20
  import { FileType } from '../../../../constants';
21
+ import Collapse from '../../../../components/Collapse';
10
22
  import { getFileDetailsFromDocument } from '../../../../utils';
11
- import { civilIDUploadingStatus, individualSelector } from '../../../app/individual/individualStore';
23
+ import { civilIDUploadingStatus, clearError, individualSelector } from '../../../app/individual/individualStore';
12
24
  import UploadMultipleFile from '../../../shared/UploadMultipleFile';
13
25
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
14
26
  var theme = _a.theme;
@@ -16,21 +28,26 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
16
28
  marginBlockStart: theme.spacing(3)
17
29
  });
18
30
  });
19
- var CivilIDFile = function () {
20
- var _a;
31
+ var CivilIDFile = function (_a) {
32
+ var _b;
33
+ var show = _a.show;
21
34
  var t = useTranslation().t;
22
35
  var dispatch = useAppDispatch();
23
36
  var control = useFormContext().control;
24
37
  var civilIDFileIdControl = useController({ name: 'civilID', control: control });
25
- var _b = useAppSelector(individualSelector), loading = _b.loading, data = _b.data;
26
- var documents = (((_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.user) || {}).documents;
38
+ var _c = useAppSelector(individualSelector), loading = _c.loading, data = _c.data, error = _c.error;
39
+ var documents = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.user) || {}).documents;
27
40
  var handleCivilIDChange = function (ids) {
41
+ if (error)
42
+ dispatch(clearError());
28
43
  civilIDFileIdControl.field.onChange(ids);
29
44
  };
30
45
  var handleReset = function (ids) {
46
+ if (error)
47
+ dispatch(clearError());
31
48
  civilIDFileIdControl.field.onChange(ids);
32
49
  };
33
50
  var defaultFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.IDENTITY_DOCUMENT); }, [documents]);
34
- return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'civilID', control: control, 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, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.IDENTITY_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }));
51
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'civilID', control: control, 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, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.IDENTITY_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }) })));
35
52
  };
36
53
  export default CivilIDFile;
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
15
15
  import { useFormContext, useController } from 'react-hook-form';
16
16
  import { ScreenContainer } from '../../../shared/Containers';
17
17
  import Collapse from '../../../../components/Collapse';
18
- import { useAppSelector } from '../../../../hooks';
18
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
19
  import { styled, alpha } from '@mui/material/styles';
20
20
  import Mandatory from '../../../shared/Mandatory';
21
21
  import Text from '../../../../components/Text';
@@ -24,7 +24,7 @@ import RadioLabel from '../../../../components/RadioLabel';
24
24
  import { InfoIconStyled, InfoOutlinedIconStyled } from './PEPSwitch';
25
25
  import Box from '@mui/material/Box';
26
26
  import Tooltip from '../../../../components/Tooltip';
27
- import { individualSelector } from '../../../app/individual/individualStore';
27
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
28
28
  var LabelTextStyled = styled(Text)(function (_a) {
29
29
  var theme = _a.theme;
30
30
  return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
@@ -40,12 +40,15 @@ var InfluencerSwitch = function (_a) {
40
40
  var _b = React.useState(false), isHovered = _b[0], setIsHovered = _b[1];
41
41
  var control = useFormContext().control;
42
42
  var t = useTranslation().t;
43
+ var dispatch = useAppDispatch();
43
44
  var influencerControl = useController({ name: 'isInfluencer', control: control });
44
- var data = useAppSelector(individualSelector).data;
45
+ var _c = useAppSelector(individualSelector), data = _c.data, error = _c.error;
45
46
  var user = (data.verify.responseBody || {}).user;
46
47
  var disabled = false;
47
48
  var handleOnChange = function (_a) {
48
49
  var target = _a.target;
50
+ if (error)
51
+ dispatch(clearError());
49
52
  influencerControl.field.onChange(target.value === 'yes');
50
53
  };
51
54
  var influencerValue = influencerControl.field.value;
@@ -30,8 +30,8 @@ import { ScreenContainer } from '../../../shared/Containers';
30
30
  import Input from '../../../shared/Input';
31
31
  import CheckIcon from '../../../shared/CheckIcon';
32
32
  import Collapse from '../../../../components/Collapse';
33
- import { useAppSelector, useLanguage } from '../../../../hooks';
34
- import { individualSelector } from '../../../app/individual/individualStore';
33
+ import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
34
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
35
35
  import Text from '../../../../components/Text';
36
36
  import ExpandIcon from '../../../../components/ExpandIcon';
37
37
  import SimpleList from '../../../../components/SimpleList';
@@ -59,7 +59,8 @@ var MonthlyIncome = function (_a) {
59
59
  var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
60
60
  var t = useTranslation().t;
61
61
  var isAr = useLanguage().isAr;
62
- var data = useAppSelector(individualSelector).data;
62
+ var dispatch = useAppDispatch();
63
+ var _e = useAppSelector(individualSelector), data = _e.data, bckError = _e.error;
63
64
  var control = useFormContext().control;
64
65
  var settingsData = useAppSelector(settingsSelector).data;
65
66
  var monthlyIncomeList = (data.individualData.responseBody || {}).monthlyIncomeList;
@@ -86,6 +87,8 @@ var MonthlyIncome = function (_a) {
86
87
  }
87
88
  };
88
89
  var onSelectItem = function (source) {
90
+ if (bckError)
91
+ dispatch(clearError());
89
92
  onCloseList();
90
93
  monthlyIncomeControl.field.onChange(source);
91
94
  };
@@ -26,8 +26,8 @@ import Box from '@mui/material/Box';
26
26
  import { styled } from '@mui/material/styles';
27
27
  import { useTranslation } from 'react-i18next';
28
28
  import { useController, useFormContext } from 'react-hook-form';
29
- import { useAppSelector, useLanguage } from '../../../../hooks';
30
- import { individualSelector } from '../../../app/individual/individualStore';
29
+ import { useAppSelector, useLanguage, useAppDispatch } from '../../../../hooks';
30
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
31
31
  import Text from '../../../../components/Text';
32
32
  import Collapse from '../../../../components/Collapse';
33
33
  import CheckIcon from '@mui/icons-material/Check';
@@ -57,7 +57,8 @@ var Occupation = function (_a) {
57
57
  var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
58
58
  var t = useTranslation().t;
59
59
  var isAr = useLanguage().isAr;
60
- var data = useAppSelector(individualSelector).data;
60
+ var dispatch = useAppDispatch();
61
+ var _f = useAppSelector(individualSelector), data = _f.data, bckError = _f.error;
61
62
  var control = useFormContext().control;
62
63
  var occupationsList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.occupationList) || [];
63
64
  var occupationControl = useController({ control: control, name: 'occupation' });
@@ -79,6 +80,8 @@ var Occupation = function (_a) {
79
80
  (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
80
81
  };
81
82
  var onSelectItem = function (occupation) {
83
+ if (bckError)
84
+ dispatch(clearError());
82
85
  onCloseList();
83
86
  occupationControl.field.onChange(occupation);
84
87
  };
@@ -18,14 +18,14 @@ import { ScreenContainer } from '../../../shared/Containers';
18
18
  import Collapse from '../../../../components/Collapse';
19
19
  import Mandatory from '../../../shared/Mandatory';
20
20
  import Text from '../../../../components/Text';
21
- import { useAppSelector } from '../../../../hooks';
21
+ import { useAppSelector, useAppDispatch } from '../../../../hooks';
22
22
  import RadioGroup from '../../../../components/RadioGroup';
23
23
  import RadioLabel from '../../../../components/RadioLabel';
24
24
  import Tooltip from '../../../../components/Tooltip';
25
25
  import InfoIcon from '@mui/icons-material/Info';
26
26
  import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
27
27
  import Box from '@mui/material/Box';
28
- import { individualSelector } from '../../../app/individual/individualStore';
28
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
29
29
  var LabelTextStyled = styled(Text)(function (_a) {
30
30
  var theme = _a.theme;
31
31
  return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
@@ -60,11 +60,14 @@ var PEPSwitch = function (_a) {
60
60
  var control = useFormContext().control;
61
61
  var t = useTranslation().t;
62
62
  var pepControl = useController({ name: 'isPEP', control: control });
63
- var data = useAppSelector(individualSelector).data;
63
+ var _c = useAppSelector(individualSelector), data = _c.data, error = _c.error;
64
+ var dispatch = useAppDispatch();
64
65
  var user = (data.verify.responseBody || {}).user;
65
66
  var disabled = false;
66
67
  var handleOnChange = function (_a) {
67
68
  var target = _a.target;
69
+ if (error)
70
+ dispatch(clearError());
68
71
  pepControl.field.onChange(target.value === 'yes');
69
72
  };
70
73
  var pepValue = pepControl.field.value;
@@ -15,15 +15,21 @@ import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import Collapse from '@mui/material/Collapse';
17
17
  import { removeAllCharsFromNumber } from '../../../../utils';
18
+ import { useAppSelector, useAppDispatch } from '../../../../hooks';
18
19
  import { ScreenContainer } from '../../../shared/Containers';
19
20
  import Input from '../../../shared/Input';
21
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
20
22
  var ShareCount = function (_a) {
21
23
  var _b;
22
24
  var show = _a.show;
23
25
  var t = useTranslation().t;
24
26
  var control = useFormContext().control;
27
+ var dispatch = useAppDispatch();
28
+ var bckError = useAppSelector(individualSelector).error;
25
29
  var handleChange = function (_a) {
26
30
  var target = _a.target;
31
+ if (bckError)
32
+ dispatch(clearError());
27
33
  var value = removeAllCharsFromNumber(target.value);
28
34
  shareCountControl.field.onChange(value);
29
35
  };
@@ -16,18 +16,23 @@ import { useController, useFormContext } from 'react-hook-form';
16
16
  import Collapse from '@mui/material/Collapse';
17
17
  import { findCurrencyByIso2, removeAllCharsFromNumber } from '../../../../utils';
18
18
  import { settingsSelector } from '../../../../app/settings';
19
- import { useAppSelector } from '../../../../hooks';
19
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
20
20
  import { ScreenContainer } from '../../../shared/Containers';
21
21
  import Input from '../../../shared/Input';
22
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
22
23
  var ShareValue = function (_a) {
23
24
  var _b;
24
25
  var show = _a.show;
25
26
  var t = useTranslation().t;
26
27
  var settingsData = useAppSelector(settingsSelector).data;
27
28
  var control = useFormContext().control;
29
+ var bckError = useAppSelector(individualSelector).error;
30
+ var dispatch = useAppDispatch();
28
31
  var countryCode = settingsData.businessCountry.iso2;
29
32
  var handleChange = function (_a) {
30
33
  var target = _a.target;
34
+ if (bckError)
35
+ dispatch(clearError());
31
36
  var value = removeAllCharsFromNumber(target.value);
32
37
  shareValueControl.field.onChange(value);
33
38
  };
@@ -20,7 +20,7 @@ import { FileType } from '../../../../constants';
20
20
  import { getFileDetailsFromDocument } from '../../../../utils';
21
21
  import UploadMultipleFile from '../../../shared/UploadMultipleFile';
22
22
  import { ScreenContainer } from '../../../shared/Containers';
23
- import { individualSelector, signatureFileUploadingStatus } from '../../../app/individual/individualStore';
23
+ import { individualSelector, signatureFileUploadingStatus, clearError } from '../../../app/individual/individualStore';
24
24
  import Collapse from '../../../../components/Collapse';
25
25
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
26
26
  var theme = _a.theme;
@@ -34,13 +34,17 @@ var SignatureFile = function (_a) {
34
34
  var t = useTranslation().t;
35
35
  var control = useFormContext().control;
36
36
  var signatureFileIdControl = useController({ name: 'signatureFileId', control: control });
37
- var _c = useAppSelector(individualSelector), loading = _c.loading, data = _c.data;
37
+ var _c = useAppSelector(individualSelector), loading = _c.loading, data = _c.data, error = _c.error;
38
38
  var documents = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.user) || {}).documents;
39
39
  var dispatch = useAppDispatch();
40
40
  var handleSignatureChange = function (ids) {
41
+ if (error)
42
+ dispatch(clearError());
41
43
  signatureFileIdControl.field.onChange(ids);
42
44
  };
43
45
  var handleReset = function (ids) {
46
+ if (error)
47
+ dispatch(clearError());
44
48
  signatureFileIdControl.field.onChange(ids);
45
49
  };
46
50
  var defaultFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.CUSTOMER_SIGNATURE); }, [documents]);
@@ -26,8 +26,8 @@ import Box from '@mui/material/Box';
26
26
  import { styled } from '@mui/material/styles';
27
27
  import { useTranslation } from 'react-i18next';
28
28
  import { useController, useFormContext } from 'react-hook-form';
29
- import { useAppSelector, useLanguage } from '../../../../hooks';
30
- import { individualSelector } from '../../../app/individual/individualStore';
29
+ import { useAppSelector, useLanguage, useAppDispatch } from '../../../../hooks';
30
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
31
31
  import Text from '../../../../components/Text';
32
32
  import Collapse from '../../../../components/Collapse';
33
33
  import CheckIcon from '@mui/icons-material/Check';
@@ -57,7 +57,8 @@ var SourceOfIncome = function (_a) {
57
57
  var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
58
58
  var t = useTranslation().t;
59
59
  var isAr = useLanguage().isAr;
60
- var data = useAppSelector(individualSelector).data;
60
+ var _f = useAppSelector(individualSelector), data = _f.data, bckError = _f.error;
61
+ var dispatch = useAppDispatch();
61
62
  var control = useFormContext().control;
62
63
  var sourceIncomeList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.sourceIncomeList) || [];
63
64
  var sourceIncomeControl = useController({ control: control, name: 'sourceIncome' });
@@ -79,6 +80,8 @@ var SourceOfIncome = function (_a) {
79
80
  (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
80
81
  };
81
82
  var onSelectItem = function (source) {
83
+ if (bckError)
84
+ dispatch(clearError());
82
85
  onCloseList();
83
86
  sourceIncomeControl.field.onChange(source);
84
87
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.22-test",
3
+ "version": "2.3.25-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",