@tap-payments/auth-jsconnect 2.3.46-test → 2.3.50-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.
@@ -52,7 +52,6 @@ export declare type BusinessTypeFormValues = {
52
52
  selectedLicense?: License;
53
53
  certificateId?: Array<string>;
54
54
  articleId?: string;
55
- articleFile?: File;
56
55
  };
57
56
  export declare type ActivitiesFormValues = {
58
57
  activities: Array<Activity> | undefined;
@@ -1,9 +1,16 @@
1
1
  import { BrandListBody, UpdateBrandBody, UpdateSalesChannels } from '../api/individual';
2
+ export declare type RemoveBrandActivity = {
3
+ id: string;
4
+ activities?: Array<{
5
+ id: string;
6
+ }>;
7
+ };
2
8
  declare const brandService: {
3
9
  retrieveBrand: (id: string) => Promise<any>;
4
10
  getBrandList: (data: BrandListBody) => Promise<any>;
5
11
  updateBrandInfo: ({ id, ...data }: UpdateBrandBody) => Promise<any>;
6
12
  updateBrandSales: ({ id, ...data }: UpdateSalesChannels) => void;
7
13
  getBrandListByIndividualId: (id: string) => Promise<any>;
14
+ removeBrandActivity: ({ id, ...data }: RemoveBrandActivity) => Promise<any>;
8
15
  };
9
16
  export { brandService };
@@ -47,11 +47,20 @@ var updateBrandSales = function (_a) {
47
47
  data: data
48
48
  });
49
49
  };
50
+ var removeBrandActivity = function (_a) {
51
+ var id = _a.id, data = __rest(_a, ["id"]);
52
+ return httpClient({
53
+ method: 'put',
54
+ url: "".concat(ENDPOINT_PATHS.BRAND, "/").concat(id, "/activities/remove"),
55
+ data: data
56
+ });
57
+ };
50
58
  var brandService = {
51
59
  retrieveBrand: retrieveBrand,
52
60
  getBrandList: getBrandList,
53
61
  updateBrandInfo: updateBrandInfo,
54
62
  updateBrandSales: updateBrandSales,
55
- getBrandListByIndividualId: getBrandListByIndividualId
63
+ getBrandListByIndividualId: getBrandListByIndividualId,
64
+ removeBrandActivity: removeBrandActivity
56
65
  };
57
66
  export { brandService };
@@ -9,6 +9,7 @@ import { DataElementBody } from './data';
9
9
  import { BrandListBody, UpdateBrandBody, UpdateIndividualBody, GetIndividualListBody } from './individual';
10
10
  import { UpdateBoardBody, RequestEmailBody } from './board';
11
11
  import { GetUserListBody } from './user';
12
+ import { RemoveBrandActivity } from './brand';
12
13
  import { UploadFileBody } from './file';
13
14
  import { DocumentUpdateBody, DocumentInfo, DocumentBody } from './document';
14
15
  declare const API: {
@@ -130,6 +131,7 @@ declare const API: {
130
131
  updateBrandInfo: ({ id, ...data }: UpdateBrandBody) => Promise<any>;
131
132
  updateBrandSales: ({ id, ...data }: import("./individual").UpdateSalesChannels) => void;
132
133
  getBrandListByIndividualId: (id: string) => Promise<any>;
134
+ removeBrandActivity: ({ id, ...data }: RemoveBrandActivity) => Promise<any>;
133
135
  };
134
136
  fileService: {
135
137
  uploadFile: (data: UploadFileBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -142,6 +144,6 @@ declare const API: {
142
144
  removeFilesFromDocument: ({ id, ...data }: DocumentBody) => Promise<import("axios").AxiosResponse<any, any>>;
143
145
  };
144
146
  };
145
- export type { ValidateOperatorBody, CreateAuthBody, ExpressCreateAccountBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, UpdateEntityBody, DocumentUpdateBody, DocumentInfo, VerifyAuthExpressOTPBody, UpdateIndividualBody, UpdateEntityActivityBody, UpdateEntityCapitalBody, BankDocumentInfo, GetUserListBody, GetIndividualListBody, RequestEmailBody, DocumentBody, UpdateEntityAOAFileBody };
147
+ export type { ValidateOperatorBody, CreateAuthBody, ExpressCreateAccountBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, UpdateEntityBody, DocumentUpdateBody, DocumentInfo, VerifyAuthExpressOTPBody, UpdateIndividualBody, UpdateEntityActivityBody, UpdateEntityCapitalBody, BankDocumentInfo, GetUserListBody, GetIndividualListBody, RequestEmailBody, DocumentBody, UpdateEntityAOAFileBody, RemoveBrandActivity };
146
148
  export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
147
149
  export default API;
@@ -51,7 +51,7 @@ import API from '../../../api';
51
51
  import { DocumentPurpose, FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BANK_STEP_NAMES } from '../../../constants';
54
- import { hasNoneEditableValue, sleep } from '../../../utils';
54
+ import { hasNoneEditableValue, isStringMasked, sleep } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
@@ -165,7 +165,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBankEntityInfo', fun
165
165
  });
166
166
  }); });
167
167
  export var createBankAccount = createAsyncThunk('createBankAccount', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
168
- var _a, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, _b, data_status, document, isIBANNonEditable, isBeneficiaryNameNonEditable, isBankNameNonEditable, isBankStatementIdNonEditable, isConfirmPolicyNonEditable, documentResponse, hasDocument, documentId, requestBody, data, documentBody;
168
+ var _a, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, _b, data_status, document, isIBANMasked, isIBANNonEditable, isBeneficiaryNameNonEditable, isBankNameNonEditable, isBankStatementIdNonEditable, isConfirmPolicyNonEditable, documentResponse, hasDocument, documentId, requestBody, data, documentBody;
169
169
  var _c, _d, _e, _f, _g, _h, _j, _k, _l;
170
170
  return __generator(this, function (_m) {
171
171
  switch (_m.label) {
@@ -173,6 +173,7 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
173
173
  _a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
174
174
  iban = params.iban, beneficiaryName = params.beneficiaryName, bankName = params.bankName, bankStatementId = params.bankStatementId, confirmPolicy = params.confirmPolicy;
175
175
  _b = ((_c = bank.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.bank_account) || {}, data_status = _b.data_status, document = _b.document;
176
+ isIBANMasked = isStringMasked(iban);
176
177
  isIBANNonEditable = hasNoneEditableValue(data_status, 'iban');
177
178
  isBeneficiaryNameNonEditable = hasNoneEditableValue(data_status, 'beneficiary_name');
178
179
  isBankNameNonEditable = hasNoneEditableValue(data_status, 'bank_name');
@@ -183,7 +184,7 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
183
184
  documentId = document === null || document === void 0 ? void 0 : document.id;
184
185
  requestBody = {
185
186
  wallet_id: (_h = (_g = (_f = (_e = (_d = bank.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.business) === null || _e === void 0 ? void 0 : _e.entity) === null || _f === void 0 ? void 0 : _f.merchant) === null || _g === void 0 ? void 0 : _g.wallet) === null || _h === void 0 ? void 0 : _h.id,
186
- bank_account: __assign({ iban: isIBANNonEditable ? undefined : iban, beneficiary_name: isBeneficiaryNameNonEditable ? undefined : beneficiaryName, bank_name: isBankNameNonEditable ? undefined : bankName, is_acknowledged: isConfirmPolicyNonEditable ? undefined : confirmPolicy }, (!(isBankStatementIdNonEditable || documentId || !hasDocument) && {
187
+ bank_account: __assign({ iban: isIBANNonEditable || isIBANMasked ? undefined : iban, beneficiary_name: isBeneficiaryNameNonEditable ? undefined : beneficiaryName, bank_name: isBankNameNonEditable ? undefined : bankName, is_acknowledged: isConfirmPolicyNonEditable ? undefined : confirmPolicy }, (!(isBankStatementIdNonEditable || documentId || !hasDocument) && {
187
188
  document: {
188
189
  type: DocumentPurpose.BANK_STATEMENT,
189
190
  files: bankStatementId || []
@@ -332,19 +332,30 @@ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function
332
332
  });
333
333
  }); });
334
334
  export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
335
- var _a, settings, brand, _b, data_status, id, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, requestBody, customerLocation, customerBaseId, salesId, customerBase, brandData;
335
+ var _a, settings, brand, _b, data_status, id, brandActivities, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, removedActivities, payload, requestBody, customerLocation, customerBaseId, salesId, customerBase, brandData;
336
336
  var _c, _d, _e;
337
337
  return __generator(this, function (_f) {
338
338
  switch (_f.label) {
339
339
  case 0:
340
340
  _a = thunkApi.getState(), settings = _a.settings, brand = _a.brand;
341
- _b = ((_c = brand.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) || {}, data_status = _b.data_status, id = _b.id;
341
+ _b = ((_c = brand.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) || {}, data_status = _b.data_status, id = _b.id, brandActivities = _b.activities;
342
342
  isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
343
343
  isCustomerBaseLocationNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base_location');
344
344
  isCustomerBaseNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base');
345
345
  isTermsNonEditable = hasNoneEditableValue(data_status, 'terms');
346
346
  isSalesRangeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'sales_range');
347
347
  activities = params.activities, customerLocations = params.customerLocations, expectedCustomer = params.expectedCustomer, expectedSale = params.expectedSale;
348
+ removedActivities = (brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
349
+ if (!(!isActivitiesNonEditable && (removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length) > 0)) return [3, 2];
350
+ payload = {
351
+ id: id,
352
+ activities: removedActivities
353
+ };
354
+ return [4, API.brandService.removeBrandActivity(payload)];
355
+ case 1:
356
+ _f.sent();
357
+ _f.label = 2;
358
+ case 2:
348
359
  requestBody = {
349
360
  id: id,
350
361
  activities: isActivitiesNonEditable ? undefined : activities,
@@ -363,7 +374,7 @@ export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities'
363
374
  requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { sales: salesId }) });
364
375
  }
365
376
  return [4, API.brandService.updateBrandInfo(requestBody)];
366
- case 1:
377
+ case 3:
367
378
  brandData = (_f.sent()).data;
368
379
  thunkApi.dispatch(handleNextScreenStep());
369
380
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, id);
@@ -60,15 +60,6 @@ export declare const updateLeadBusinessType: import("@reduxjs/toolkit").AsyncThu
60
60
  documentData: any;
61
61
  entityData: any;
62
62
  }, BusinessTypeFormValues, {}>;
63
- interface UploadArticleParams {
64
- file: File;
65
- onProgress?: (value: number) => void;
66
- onSuccess?: (fileId: string) => void;
67
- onFailure?: (error: string) => void;
68
- }
69
- export declare const uploadArticle: import("@reduxjs/toolkit").AsyncThunk<{
70
- data: any;
71
- }, UploadArticleParams, {}>;
72
63
  export declare const updateActivitiesInfo: import("@reduxjs/toolkit").AsyncThunk<{
73
64
  data: any;
74
65
  formData: {
@@ -114,16 +105,16 @@ export interface BusinessState extends SharedState<BusinessData> {
114
105
  customLoading?: boolean;
115
106
  uploading?: boolean;
116
107
  uploadingArticle?: boolean;
117
- uploadingArticleError?: string | null;
118
108
  }
119
109
  export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessState, {
120
110
  clearError: (state: BusinessState) => void;
121
111
  stopLoader: (state: BusinessState) => void;
122
112
  resetOTPScreen: (state: BusinessState) => void;
123
- clearArticleId: (state: BusinessState) => void;
124
113
  uploadingStatus: (state: BusinessState, action: ActionState<boolean>) => void;
114
+ uploadingArticleStatus: (state: BusinessState, action: ActionState<boolean>) => void;
115
+ clearAOAFile: (state: BusinessState) => void;
125
116
  }, "business/store">;
126
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, clearArticleId: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, uploadingStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
117
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, uploadingStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, uploadingArticleStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, clearAOAFile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
127
118
  declare const _default: import("redux").Reducer<BusinessState, import("redux").AnyAction>;
128
119
  export default _default;
129
120
  export declare const businessSelector: (state: RootState) => BusinessState;
@@ -441,36 +441,37 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
441
441
  });
442
442
  }); });
443
443
  export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
444
- var _a, settings, business, isNonSA, isFL, payload, data, entity_activities, list, accountBody, accountData, documentData, entityData, entityId, articleId, documentBody, payload_1;
445
- var _b, _c, _d, _e, _f, _g;
446
- return __generator(this, function (_h) {
447
- switch (_h.label) {
444
+ var _a, settings, business, isNonSA, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, isFL, payload, data, entity_activities, list, accountBody, accountData, documentData, entityData, entityId, documentBody, payload_1;
445
+ var _b, _c, _d, _e;
446
+ return __generator(this, function (_f) {
447
+ switch (_f.label) {
448
448
  case 0:
449
449
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
450
450
  isNonSA = !isSA(settings.data.businessCountry.iso2);
451
- isFL = ((_b = params.selectedLicense) === null || _b === void 0 ? void 0 : _b.type) === BusinessType.FL;
451
+ selectedLicense = params.selectedLicense, licenseNumber = params.licenseNumber, entityLegalName = params.entityLegalName, certificateId = params.certificateId, articleId = params.articleId;
452
+ isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
452
453
  payload = {
453
- id: ((_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id) || '',
454
- license_number: isNonSA && isFL ? '' : params.licenseNumber,
454
+ id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
455
+ license_number: isNonSA && isFL ? '' : licenseNumber,
455
456
  license_type: isFL ? 'freelance' : 'commercial_registration',
456
- business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
457
+ business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type,
457
458
  step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO,
458
- business: isNonSA && isFL ? undefined : { ar: params.entityLegalName, en: params.entityLegalName },
459
+ business: isNonSA && isFL ? undefined : { ar: entityLegalName, en: entityLegalName },
459
460
  encryption_contract: ['license_number', 'business_type', 'license_type']
460
461
  };
461
462
  return [4, API.leadService.updateLead(payload)];
462
463
  case 1:
463
- data = _h.sent();
464
+ data = _f.sent();
464
465
  entity_activities = data.entity_activities;
465
466
  if (!!entity_activities) return [3, 3];
466
467
  return [4, API.dataService.getActivities()];
467
468
  case 2:
468
- list = (_h.sent()).list;
469
+ list = (_f.sent()).list;
469
470
  data.entity_activities = list;
470
- _h.label = 3;
471
+ _f.label = 3;
471
472
  case 3:
472
473
  accountBody = {
473
- lead_id: (_e = business.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.lead_id,
474
+ lead_id: (_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id,
474
475
  notify: {
475
476
  email: false,
476
477
  phone: false
@@ -481,24 +482,23 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
481
482
  };
482
483
  return [4, API.accountService.createAccount(accountBody)];
483
484
  case 4:
484
- accountData = _h.sent();
485
+ accountData = _f.sent();
485
486
  entityData = undefined;
486
487
  entityId = accountData === null || accountData === void 0 ? void 0 : accountData.entity_id;
487
- articleId = business.data.businessTypeData.articleId;
488
- if (!((params.certificateId || []).length > 0)) return [3, 6];
488
+ if (!((certificateId || []).length > 0)) return [3, 6];
489
489
  documentBody = {
490
490
  entity_id: entityId || '',
491
491
  documents: [
492
492
  {
493
493
  type: DocumentPurpose.CR,
494
- images: params.certificateId
494
+ images: certificateId
495
495
  }
496
496
  ]
497
497
  };
498
498
  return [4, API.documentService.updateDocumentInfo(documentBody)];
499
499
  case 5:
500
- documentData = _h.sent();
501
- _h.label = 6;
500
+ documentData = _f.sent();
501
+ _f.label = 6;
502
502
  case 6:
503
503
  if (!(articleId && entityId)) return [3, 8];
504
504
  payload_1 = {
@@ -507,44 +507,15 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
507
507
  };
508
508
  return [4, API.entityService.updateEntity(payload_1)];
509
509
  case 7:
510
- entityData = _h.sent();
511
- _h.label = 8;
510
+ entityData = _f.sent();
511
+ _f.label = 8;
512
512
  case 8:
513
513
  thunkApi.dispatch(handleNextScreenStep());
514
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
514
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
515
515
  return [2, { data: data, formData: params, accountData: accountData, documentData: documentData, entityData: entityData }];
516
516
  }
517
517
  });
518
518
  }); });
519
- export var uploadArticle = createAsyncThunk('businessUploadArticle', function (_a) {
520
- var file = _a.file, onProgress = _a.onProgress;
521
- return __awaiter(void 0, void 0, void 0, function () {
522
- var typeArray, type, uploadPayload, onUploadProgress, data;
523
- var _b;
524
- return __generator(this, function (_c) {
525
- switch (_c.label) {
526
- case 0:
527
- typeArray = ((_b = file === null || file === void 0 ? void 0 : file.type) === null || _b === void 0 ? void 0 : _b.split('/')) || [];
528
- type = typeArray[1] || '';
529
- uploadPayload = {
530
- file_link_create: true,
531
- title: file === null || file === void 0 ? void 0 : file.name,
532
- purpose: DocumentPurpose.ARTICLE_ASSOCIATION,
533
- type: type,
534
- file: file
535
- };
536
- onUploadProgress = function (progressEvent) {
537
- var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
538
- onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
539
- };
540
- return [4, API.fileService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
541
- case 1:
542
- data = _c.sent();
543
- return [2, { data: data }];
544
- }
545
- });
546
- });
547
- });
548
519
  export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
549
520
  var _a, settings, business, activities, stepName, id, requestBody, data;
550
521
  var _b, _c, _d, _e, _f;
@@ -708,7 +679,6 @@ var initialState = {
708
679
  customLoading: false,
709
680
  uploading: false,
710
681
  uploadingArticle: false,
711
- uploadingArticleError: null,
712
682
  data: {
713
683
  flowName: FlowsTypes.BUSINESS,
714
684
  verify: {
@@ -756,11 +726,15 @@ export var businessSlice = createSlice({
756
726
  resetOTPScreen: function (state) {
757
727
  state.data.otpData.otp = '';
758
728
  },
759
- clearArticleId: function (state) {
760
- state.data.businessTypeData.articleId = '';
761
- },
762
729
  uploadingStatus: function (state, action) {
763
730
  state.uploading = action.payload;
731
+ },
732
+ uploadingArticleStatus: function (state, action) {
733
+ state.uploadingArticle = action.payload;
734
+ },
735
+ clearAOAFile: function (state) {
736
+ var entity = (state.data.verify.responseBody || {}).entity;
737
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: __assign(__assign({}, entity), { AOA_file: undefined, AOA_file_id: undefined }) });
764
738
  }
765
739
  },
766
740
  extraReducers: function (builder) {
@@ -770,10 +744,10 @@ export var businessSlice = createSlice({
770
744
  state.customLoading = true;
771
745
  })
772
746
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
773
- var _a, _b, _c;
747
+ var _a, _b;
774
748
  state.error = null;
775
749
  state.customLoading = false;
776
- var _d = action.payload, data = _d.data, boardId = _d.boardId, brandData = _d.brandData, leadData = _d.leadData, token = _d.token, isRequireOTP = _d.isRequireOTP;
750
+ var _c = action.payload, data = _c.data, boardId = _c.boardId, brandData = _c.brandData, leadData = _c.leadData, token = _c.token, isRequireOTP = _c.isRequireOTP;
777
751
  var responseBody = state.data.verify.responseBody;
778
752
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id });
779
753
  if (token)
@@ -781,7 +755,7 @@ export var businessSlice = createSlice({
781
755
  state.data.otpData.isNID = false;
782
756
  if (isRequireOTP)
783
757
  return;
784
- var _e = state.data.verify.responseBody || {}, entity = _e.entity, entity_activities = _e.entity_activities, business_type = _e.business_type;
758
+ var _d = state.data.verify.responseBody || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type;
785
759
  var issuingDate = ((_a = brandData === null || brandData === void 0 ? void 0 : brandData.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
786
760
  if (issuingDate)
787
761
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
@@ -795,21 +769,30 @@ export var businessSlice = createSlice({
795
769
  var license = (entity || {}).license;
796
770
  if (license) {
797
771
  var number_1 = license.number;
798
- var _f = state.data.businessTypeData || {}, busResData = _f.responseBody, selectedLicense = _f.selectedLicense;
799
- var licenseList = (busResData || {}).licenseList;
772
+ var _e = state.data.businessTypeData || {}, busResData = _e.responseBody, selectedLicense = _e.selectedLicense;
773
+ var licenseList = (busResData || { licenseList: [] }).licenseList;
800
774
  var selectedLicenseData = selectedLicense;
801
775
  if (number_1) {
802
- var findLicense = (_c = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _c === void 0 ? void 0 : _c.call(licenseList, function (_a) {
776
+ var findLicense = licenseList.find(function (_a) {
803
777
  var license = _a.license;
804
- return (license === null || license === void 0 ? void 0 : license.number) === number_1;
778
+ return license.number === number_1;
805
779
  });
806
780
  if (findLicense)
807
781
  selectedLicenseData = findLicense;
808
782
  else if (!findLicense && business_type === BusinessType.FL) {
809
- selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: number_1 } });
783
+ selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { legal_name: {
784
+ ar: number_1,
785
+ en: number_1
786
+ }, license: { number: number_1 } });
787
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: __spreadArray([selectedLicenseData], licenseList, true) });
788
+ }
789
+ else {
790
+ selectedLicenseData = __assign(__assign({}, OTHER_CR_LICENSE), { legal_name: {
791
+ ar: number_1,
792
+ en: number_1
793
+ }, license: { number: number_1 } });
794
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: __spreadArray([selectedLicenseData], licenseList, true) });
810
795
  }
811
- else
812
- selectedLicenseData = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: number_1 } });
813
796
  state.data.businessTypeData.licenseNumber = number_1;
814
797
  }
815
798
  state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
@@ -841,14 +824,14 @@ export var businessSlice = createSlice({
841
824
  state.error = null;
842
825
  })
843
826
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
844
- var _a, _b, _c;
827
+ var _a, _b;
845
828
  state.loading = false;
846
829
  state.error = null;
847
- var _d = action.payload, data = _d.data, formData = _d.formData, brand = _d.brand, leadData = _d.leadData;
830
+ var _c = action.payload, data = _c.data, formData = _c.formData, brand = _c.brand, leadData = _c.leadData;
848
831
  state.data.otpData = formData;
849
832
  state.data.otpData.responseBody = data;
850
833
  state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
851
- var _e = leadData || {}, entity = _e.entity, entity_activities = _e.entity_activities, business_type = _e.business_type;
834
+ var _d = leadData || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type;
852
835
  var issuingDate = ((_a = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
853
836
  if (issuingDate)
854
837
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
@@ -862,21 +845,30 @@ export var businessSlice = createSlice({
862
845
  var license = (entity || {}).license;
863
846
  if (license) {
864
847
  var number_2 = license.number;
865
- var _f = state.data.businessTypeData || {}, busResData = _f.responseBody, selectedLicense = _f.selectedLicense;
866
- var licenseList = (busResData || {}).licenseList;
848
+ var _e = state.data.businessTypeData || {}, busResData = _e.responseBody, selectedLicense = _e.selectedLicense;
849
+ var licenseList = (busResData || { licenseList: [] }).licenseList;
867
850
  var selectedLicenseData = selectedLicense;
868
851
  if (number_2) {
869
- var findLicense = (_c = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _c === void 0 ? void 0 : _c.call(licenseList, function (_a) {
852
+ var findLicense = licenseList.find(function (_a) {
870
853
  var license = _a.license;
871
- return (license === null || license === void 0 ? void 0 : license.number) === number_2;
854
+ return license.number === number_2;
872
855
  });
873
856
  if (findLicense)
874
857
  selectedLicenseData = findLicense;
875
858
  else if (!findLicense && business_type === BusinessType.FL) {
876
- selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: number_2 } });
859
+ selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { legal_name: {
860
+ ar: number_2,
861
+ en: number_2
862
+ }, license: { number: number_2 } });
863
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: __spreadArray([selectedLicenseData], licenseList, true) });
864
+ }
865
+ else {
866
+ selectedLicenseData = __assign(__assign({}, OTHER_CR_LICENSE), { legal_name: {
867
+ ar: number_2,
868
+ en: number_2
869
+ }, license: { number: number_2 } });
870
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: __spreadArray([selectedLicenseData], licenseList, true) });
877
871
  }
878
- else
879
- selectedLicenseData = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: number_2 } });
880
872
  state.data.businessTypeData.licenseNumber = number_2;
881
873
  }
882
874
  state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
@@ -1041,20 +1033,6 @@ export var businessSlice = createSlice({
1041
1033
  .addCase(updateLeadBusinessType.rejected, function (state, action) {
1042
1034
  state.loading = false;
1043
1035
  state.error = action.error.message;
1044
- })
1045
- .addCase(uploadArticle.pending, function (state) {
1046
- state.uploadingArticleError = null;
1047
- state.uploadingArticle = true;
1048
- })
1049
- .addCase(uploadArticle.fulfilled, function (state, action) {
1050
- state.uploadingArticleError = null;
1051
- state.uploadingArticle = false;
1052
- var data = action.payload.data;
1053
- state.data.businessTypeData.articleId = data === null || data === void 0 ? void 0 : data.id;
1054
- })
1055
- .addCase(uploadArticle.rejected, function (state) {
1056
- state.uploadingArticle = false;
1057
- state.uploadingArticleError = 'file_upload_article_error';
1058
1036
  })
1059
1037
  .addCase(updateActivitiesInfo.pending, function (state) {
1060
1038
  state.loading = true;
@@ -1138,6 +1116,6 @@ export var businessSlice = createSlice({
1138
1116
  });
1139
1117
  }
1140
1118
  });
1141
- export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, clearArticleId = _a.clearArticleId, uploadingStatus = _a.uploadingStatus;
1119
+ export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, uploadingStatus = _a.uploadingStatus, uploadingArticleStatus = _a.uploadingArticleStatus, clearAOAFile = _a.clearAOAFile;
1142
1120
  export default businessSlice.reducer;
1143
1121
  export var businessSelector = function (state) { return state.business; };
@@ -29,7 +29,7 @@ import Form from '../../../../components/Form';
29
29
  import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
30
30
  import ConfirmPolicy from './ConfirmPolicy';
31
31
  import BankStatement from './BankStatement';
32
- import { getFileDetailsFromDocument, isKW } from '../../../../utils';
32
+ import { getFileDetailsFromDocument, isKW, isStringMasked } from '../../../../utils';
33
33
  var FormStyled = styled(Form)(function () { return ({
34
34
  display: 'flex',
35
35
  flexDirection: 'column',
@@ -53,8 +53,9 @@ var BankDetails = function () {
53
53
  var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
54
54
  var isFL = ((_a = entity === null || entity === void 0 ? void 0 : entity.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === BusinessType.FL ? true : false;
55
55
  var bankHasDocument = ((_c = (_b = bank_account === null || bank_account === void 0 ? void 0 : bank_account.document) === null || _b === void 0 ? void 0 : _b.file_details) === null || _c === void 0 ? void 0 : _c.length) > 0;
56
+ var isIBANMasked = isStringMasked(iban);
56
57
  var methods = useForm({
57
- resolver: yupResolver(isKWCountry && isFL && !bankHasDocument ? BankKWFLValidation() : BankValidation()),
58
+ resolver: yupResolver(isKWCountry && isFL && !bankHasDocument ? BankKWFLValidation(isIBANMasked) : BankValidation(isIBANMasked)),
58
59
  defaultValues: {
59
60
  iban: iban,
60
61
  beneficiaryName: beneficiaryName,
@@ -1,37 +1,37 @@
1
1
  import * as yup from 'yup';
2
- export declare const BankValidation: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
2
+ export declare const BankValidation: (isIBANMasked: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
4
4
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
5
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
6
  bankStatementId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
7
7
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
8
8
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
9
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
9
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
10
10
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
11
11
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
12
  bankStatementId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
13
13
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
14
14
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
15
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
15
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
16
16
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
17
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
18
  bankStatementId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
19
19
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
20
20
  }>>>;
21
- export declare const BankKWFLValidation: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
22
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
+ export declare const BankKWFLValidation: (isIBANMasked: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
22
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
23
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
24
24
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
25
25
  bankStatementId: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
26
26
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
27
27
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
28
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
28
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
29
29
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
30
30
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
31
31
  bankStatementId: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
32
32
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
33
33
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
34
- iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
34
+ iban: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
35
35
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
36
36
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
37
37
  bankStatementId: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
@@ -1,27 +1,21 @@
1
1
  import * as yup from 'yup';
2
2
  import { REGEX_ALPHANUMERIC, REGEX_IBAN } from '../../../../constants';
3
- export var BankValidation = function () {
3
+ export var BankValidation = function (isIBANMasked) {
4
4
  return yup.object().shape({
5
- iban: yup
6
- .string()
7
- .matches(REGEX_IBAN, 'invalid_iban_format')
8
- .min(15, 'invalid_iban_format')
9
- .max(34, 'invalid_iban_format')
10
- .required('alert_iban'),
5
+ iban: isIBANMasked
6
+ ? yup.string().optional()
7
+ : yup.string().matches(REGEX_IBAN, 'invalid_iban_format').min(15, 'invalid_iban_format').max(34, 'invalid_iban_format').required('alert_iban'),
11
8
  bankName: yup.string().optional(),
12
9
  beneficiaryName: yup.string().matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid').required('beneficiary_name_required'),
13
10
  bankStatementId: yup.array().optional(),
14
11
  confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
15
12
  });
16
13
  };
17
- export var BankKWFLValidation = function () {
14
+ export var BankKWFLValidation = function (isIBANMasked) {
18
15
  return yup.object().shape({
19
- iban: yup
20
- .string()
21
- .matches(REGEX_IBAN, 'invalid_iban_format')
22
- .min(15, 'invalid_iban_format')
23
- .max(34, 'invalid_iban_format')
24
- .required('alert_iban'),
16
+ iban: isIBANMasked
17
+ ? yup.string().optional()
18
+ : yup.string().matches(REGEX_IBAN, 'invalid_iban_format').min(15, 'invalid_iban_format').max(34, 'invalid_iban_format').required('alert_iban'),
25
19
  bankName: yup.string().optional(),
26
20
  beneficiaryName: yup.string().matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid').required('beneficiary_name_required'),
27
21
  bankStatementId: yup.array().min(1, 'bank_statement_required').required('bank_statement_required'),
@@ -1,6 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import { FileDetails } from '../../../../@types';
2
3
  declare type ArticleProps = {
3
4
  show: boolean;
5
+ defaultFile?: FileDetails;
4
6
  };
5
- declare const Article: ({ show }: ArticleProps) => JSX.Element;
7
+ declare const Article: ({ show, defaultFile }: ArticleProps) => JSX.Element;
6
8
  export default Article;
@@ -10,17 +10,16 @@ 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
13
  import { styled } from '@mui/material/styles';
15
14
  import { ScreenContainer } from '../../../shared/Containers';
16
15
  import { useTranslation } from 'react-i18next';
17
16
  import { useController, useFormContext } from 'react-hook-form';
18
17
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
- import { businessSelector, clearArticleId, uploadArticle } from '../../../app/business/businessStore';
20
- import { UploadFile } from '../../../shared/UploadFile';
21
- import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
22
- import { maskFileName } from '../../../../utils';
18
+ import { businessSelector, clearAOAFile, clearError, uploadingArticleStatus } from '../../../app/business/businessStore';
19
+ import { UploadWrapper } from '../../../shared/UploadFile';
20
+ import { FileRemoveType } from '../../../../constants';
23
21
  import Collapse from '../../../../components/Collapse';
22
+ import { DocumentPurpose } from '../../../../@types';
24
23
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
25
24
  var theme = _a.theme;
26
25
  return ({
@@ -28,60 +27,26 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
28
27
  });
29
28
  });
30
29
  var Article = function (_a) {
31
- var show = _a.show;
32
- var _b = React.useState(), error = _b[0], setError = _b[1];
33
- var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
30
+ var _b;
31
+ var show = _a.show, defaultFile = _a.defaultFile;
34
32
  var t = useTranslation().t;
35
- var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
36
- var articleFileControl = useController({ name: 'articleFile', control: control });
33
+ var control = useFormContext().control;
37
34
  var articleIdControl = useController({ name: 'articleId', control: control });
38
- var _e = useAppSelector(businessSelector), loading = _e.loading, uploadingArticle = _e.uploadingArticle, sysError = _e.uploadingArticleError, data = _e.data;
35
+ var _c = useAppSelector(businessSelector), loading = _c.loading, error = _c.error, data = _c.data;
39
36
  var dispatch = useAppDispatch();
40
- var articleValue = articleFileControl.field.value;
41
- var businessTypeData = data.businessTypeData;
42
- var articleFile = businessTypeData.articleFile, articleId = businessTypeData.articleId;
43
- React.useEffect(function () {
44
- if (!articleValue) {
45
- setValue('articleFile', articleFile);
46
- setValue('articleId', articleId);
47
- }
48
- }, [articleFile, articleId]);
49
- var handleArticleChange = function (files) {
50
- setError('');
51
- var file = files === null || files === void 0 ? void 0 : files[0];
52
- if (!file)
53
- return;
54
- if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
55
- setError('file_not_supported_alert');
56
- return;
57
- }
58
- if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
59
- setError('file_size_alert');
60
- return;
61
- }
62
- articleFileControl.field.onChange(file);
63
- dispatch(uploadArticle({
64
- file: file,
65
- onProgress: function (value) {
66
- setProgress(value);
67
- }
68
- }));
37
+ var AOA_file = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) || {}).AOA_file;
38
+ var handleArticleChange = function (id) {
39
+ if (error)
40
+ dispatch(clearError());
41
+ articleIdControl.field.onChange(id);
69
42
  };
70
43
  var handleReset = function () {
71
- articleFileControl.field.onChange(undefined);
72
- articleIdControl.field.onChange('');
73
- dispatch(clearArticleId());
74
- setProgress(0);
44
+ if (error)
45
+ dispatch(clearError());
46
+ if (AOA_file)
47
+ dispatch(clearAOAFile());
48
+ articleIdControl.field.onChange(undefined);
75
49
  };
76
- React.useEffect(function () {
77
- if (sysError === 'file_upload_error') {
78
- setError(sysError);
79
- articleFileControl.field.onChange(undefined);
80
- setProgress(0);
81
- }
82
- }, [sysError]);
83
- var fileName = articleValue ? maskFileName(articleValue === null || articleValue === void 0 ? void 0 : articleValue.name) : '';
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 }) }) })));
50
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadWrapper, { id: 'articleId', fileRemoveType: FileRemoveType.AOA_FILE_ID, control: control, 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, isSubmitting: loading, onDeleteFile: handleReset, defaultFile: defaultFile, purpose: DocumentPurpose.ARTICLE_ASSOCIATION, fileUploadingStatus: function (uploading) { return dispatch(uploadingArticleStatus(uploading)); } }) }) })));
86
51
  };
87
52
  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, articleId = _c.articleId, articleFile = _c.articleFile;
31
+ var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId, articleId = _c.articleId;
32
32
  var t = useTranslation().t;
33
33
  var isAr = useLanguage().isAr;
34
34
  var dispatch = useAppDispatch();
@@ -41,8 +41,7 @@ var BusinessType = function (_a) {
41
41
  licenseNumber: licenseNumber,
42
42
  entityLegalName: entityLegalName,
43
43
  certificateId: certificateId,
44
- articleId: articleId,
45
- articleFile: articleFile
44
+ articleId: articleId
46
45
  },
47
46
  mode: 'onChange'
48
47
  });
@@ -56,7 +55,8 @@ var BusinessType = function (_a) {
56
55
  selectedLicense: data.selectedLicense,
57
56
  licenseNumber: data.licenseNumber,
58
57
  entityLegalName: data.entityLegalName,
59
- certificateId: data.certificateId
58
+ certificateId: data.certificateId,
59
+ articleId: data.articleId
60
60
  };
61
61
  dispatch(updateLeadBusinessType(dataValues));
62
62
  };
@@ -32,9 +32,8 @@ var Article = function (_a) {
32
32
  var t = useTranslation().t;
33
33
  var control = useFormContext().control;
34
34
  var articleIdControl = useController({ name: 'articleId', control: control });
35
- var loading = useAppSelector(entitySelector).loading;
36
35
  var dispatch = useAppDispatch();
37
- var _c = useAppSelector(entitySelector), data = _c.data, error = _c.error;
36
+ var _c = useAppSelector(entitySelector), data = _c.data, error = _c.error, loading = _c.loading;
38
37
  var AOA_file = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) || {}).AOA_file;
39
38
  var handleArticleChange = function (id) {
40
39
  if (error)
@@ -74,7 +74,7 @@ var SuccessFlowButtons = function (_a) {
74
74
  var name = _a.name, url = _a.url, status = _a.status, token = _a.token;
75
75
  var type = status === 'completed' ? 'completed' : 'pending';
76
76
  var title = t("".concat(name, "_flow_").concat(type), {
77
- individual_name: is_authorized && count > 1 ? t('company_individuals_details', { count: count }) : username.toLowerCase() + maskedId,
77
+ individual_name: (is_authorized && count > 1 ? t('company_individuals_details', { count: count }) : username.toLowerCase() + maskedId) || t('individual'),
78
78
  brand: brandName,
79
79
  business_type: entityLegalName,
80
80
  license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
@@ -69,3 +69,4 @@ export declare const getUserNameObject: (name: string) => {
69
69
  last: string;
70
70
  };
71
71
  export declare const getFileType: (type: string) => "" | "image/jpeg" | "image/png" | "image/jpg" | "application/pdf";
72
+ export declare const isStringMasked: (value: string) => boolean;
@@ -298,3 +298,6 @@ export var getFileType = function (type) {
298
298
  return '';
299
299
  }
300
300
  };
301
+ export var isStringMasked = function (value) {
302
+ return value.includes('*') ? true : false;
303
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.46-test",
3
+ "version": "2.3.50-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",