@tap-payments/auth-jsconnect 2.1.66-test → 2.1.68-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/build/@types/form.d.ts +4 -2
  2. package/build/api/entity.d.ts +9 -0
  3. package/build/api/index.d.ts +2 -2
  4. package/build/assets/locales/ar.json +2 -1
  5. package/build/assets/locales/en.json +2 -1
  6. package/build/features/app/bank/bankStore.d.ts +3 -10
  7. package/build/features/app/bank/bankStore.js +14 -48
  8. package/build/features/app/connectExpress/connectExpressStore.js +11 -7
  9. package/build/features/app/entity/entityStore.d.ts +15 -2
  10. package/build/features/app/entity/entityStore.js +81 -14
  11. package/build/features/bank/screens/BankDetails/BankDetails.js +18 -21
  12. package/build/features/bank/screens/BankDetails/BankStatement.js +9 -46
  13. package/build/features/bank/screens/BankDetails/validation.d.ts +6 -12
  14. package/build/features/bank/screens/BankDetails/validation.js +3 -23
  15. package/build/features/business/screens/Customers/CustomerLocations.js +1 -1
  16. package/build/features/business/screens/Customers/ExpectedCustomers.js +1 -1
  17. package/build/features/connectExpress/screens/Brand/Brand.d.ts +5 -0
  18. package/build/features/connectExpress/screens/Brand/Brand.js +71 -0
  19. package/build/features/connectExpress/screens/Brand/index.d.ts +2 -0
  20. package/build/features/connectExpress/screens/Brand/index.js +2 -0
  21. package/build/features/entity/screens/EntityName/Article.d.ts +6 -0
  22. package/build/features/entity/screens/EntityName/Article.js +87 -0
  23. package/build/features/entity/screens/EntityName/EntityName.js +12 -6
  24. package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +6 -0
  25. package/build/features/entity/screens/EntityName/LicenseCertificate.js +42 -0
  26. package/build/features/entity/screens/EntityName/validation.d.ts +12 -0
  27. package/build/features/entity/screens/EntityName/validation.js +6 -2
  28. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +4 -2
  29. package/package.json +1 -1
@@ -68,8 +68,7 @@ export declare type BankFormValues = {
68
68
  iban: string;
69
69
  beneficiaryName: string;
70
70
  bankName: string;
71
- bankStatementId?: string;
72
- bankStatementFile?: File;
71
+ bankStatementId?: Array<string>;
73
72
  uploading?: boolean;
74
73
  confirmPolicy: boolean;
75
74
  };
@@ -104,6 +103,9 @@ export declare type EntityNameFormValues = {
104
103
  issuingDate: string;
105
104
  expiryDate: string;
106
105
  unifiedNumber: string;
106
+ certificateId?: Array<string>;
107
+ articleId?: string;
108
+ articleFile?: File;
107
109
  };
108
110
  export declare type EntityCapitalFormValues = {
109
111
  activities: Array<Activity>;
@@ -33,6 +33,14 @@ export declare type EntityInfoBody = {
33
33
  step_name: string;
34
34
  encryption_contract?: Array<string>;
35
35
  };
36
+ export declare type BankDocumentInfo = {
37
+ type?: string;
38
+ number?: string;
39
+ issuing_country?: string;
40
+ issuing_date?: string;
41
+ expiry_date?: string;
42
+ files: Array<string>;
43
+ };
36
44
  export declare type EntityBankUpdateBody = {
37
45
  wallet_id: string;
38
46
  bank_account: {
@@ -43,6 +51,7 @@ export declare type EntityBankUpdateBody = {
43
51
  swift_code?: string;
44
52
  account_number?: string;
45
53
  is_acknowledged: boolean;
54
+ document?: BankDocumentInfo;
46
55
  };
47
56
  step_name: string;
48
57
  encryption_contract?: Array<string>;
@@ -3,7 +3,7 @@ import { ValidateOperatorBody } from './operator';
3
3
  import { CreateAuthBody, VerifyAuthBody, CreatePasswordBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, VerifyAuthExpressOTPBody } from './auth';
4
4
  import { UpdateLeadBody, LeadVerifyBody, CreateLeadBody, LeadOTPVerifyBody, LeadIdentityUpdateBody } from './lead';
5
5
  import { CheckEmailBody, CheckBrandBody } from './availabilityServices';
6
- import { EntityInfoBody, EntityBankUpdateBody, UpdateEntityBody, DocumentUpdateBody, DocumentInfo, UpdateEntityActivityBody, UpdateEntityCapitalBody } from './entity';
6
+ import { EntityInfoBody, EntityBankUpdateBody, BankDocumentInfo, UpdateEntityBody, DocumentUpdateBody, DocumentInfo, UpdateEntityActivityBody, UpdateEntityCapitalBody } from './entity';
7
7
  import { CreateAccountBody, ExpressCreateAccountBody } from './account';
8
8
  import { DataElementBody } from './data';
9
9
  import { BrandListBody, UpdateBrandBody, UpdateIndividualBody } from './individual';
@@ -130,6 +130,6 @@ declare const API: {
130
130
  uploadFileInfo: (data: UploadFileBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<any>;
131
131
  };
132
132
  };
133
- 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 };
133
+ 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 };
134
134
  export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
135
135
  export default API;
@@ -361,5 +361,6 @@
361
361
  "uploaded_file": "file",
362
362
  "prepare_data_title": "Preparing your data",
363
363
  "prepare_data_description": "This might take a moment...",
364
- "oops": "Oops"
364
+ "oops": "Oops",
365
+ "file_upload_at_least_one": "عذرا,مطلوب رفع ملف واحد على الأقل"
365
366
  }
@@ -390,5 +390,6 @@
390
390
  "uploaded_file": "file",
391
391
  "prepare_data_title": "Preparing your data",
392
392
  "prepare_data_description": "This might take a moment...",
393
- "oops": "Oops"
393
+ "oops": "Oops",
394
+ "file_upload_at_least_one": "please upload at least one file"
394
395
  }
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { BankFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { ActionState, BankFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  interface VerifyLeadTokenProps {
5
5
  token: string;
@@ -41,13 +41,6 @@ export declare const checkIbanBank: import("@reduxjs/toolkit").AsyncThunk<{
41
41
  cancelToken: CancelToken;
42
42
  onSuccess?: (() => void) | undefined;
43
43
  }, {}>;
44
- interface UploadBankStatementParams {
45
- file: File;
46
- onProgress?: (value: number) => void;
47
- }
48
- export declare const uploadBankStatement: import("@reduxjs/toolkit").AsyncThunk<{
49
- data: any;
50
- }, UploadBankStatementParams, {}>;
51
44
  export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
52
45
  response: any;
53
46
  formData: void;
@@ -63,14 +56,14 @@ export interface BankData {
63
56
  }
64
57
  export interface BankState extends SharedState<BankData> {
65
58
  customLoading?: boolean;
66
- uploading?: boolean;
67
59
  }
68
60
  export declare const bankSlice: import("@reduxjs/toolkit").Slice<BankState, {
69
61
  clearError: (state: BankState) => void;
70
62
  stopLoader: (state: BankState) => void;
71
63
  resetOTPScreen: (state: BankState) => void;
64
+ bankStatementUploadingStatus: (state: BankState, action: ActionState<boolean>) => void;
72
65
  }, "bank/store">;
73
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
66
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, bankStatementUploadingStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
74
67
  declare const _default: import("redux").Reducer<BankState, import("redux").AnyAction>;
75
68
  export default _default;
76
69
  export declare const bankSelector: (state: RootState) => BankState;
@@ -179,23 +179,26 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBankEntityInfo', fun
179
179
  });
180
180
  }); });
181
181
  export var createBankAccount = createAsyncThunk('createBankAccount', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
182
- var _a, settings, bank, iban, beneficiaryName, bank_name, requestBody, data;
182
+ var _a, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, requestBody, data;
183
183
  var _b, _c, _d, _e, _f, _g, _h;
184
184
  return __generator(this, function (_j) {
185
185
  switch (_j.label) {
186
186
  case 0:
187
187
  _a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
188
- iban = params.iban;
189
- beneficiaryName = params.beneficiaryName;
190
- bank_name = params.bankName;
188
+ iban = params.iban, beneficiaryName = params.beneficiaryName, bankName = params.bankName, bankStatementId = params.bankStatementId, confirmPolicy = params.confirmPolicy;
191
189
  requestBody = {
192
190
  wallet_id: (_f = (_e = (_d = (_c = (_b = bank.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.merchant) === null || _e === void 0 ? void 0 : _e.wallet) === null || _f === void 0 ? void 0 : _f.id,
193
191
  bank_account: {
194
192
  iban: iban,
195
193
  beneficiary_name: beneficiaryName,
196
- bank_name: bank_name,
197
- bank_statement_file_id: params.bankStatementFile ? bank.data.bankData.bankStatementId : undefined,
198
- is_acknowledged: params.confirmPolicy
194
+ bank_name: bankName,
195
+ is_acknowledged: confirmPolicy,
196
+ document: (bankStatementId || []).length > 0
197
+ ? {
198
+ type: 'bank_statement',
199
+ files: bankStatementId || []
200
+ }
201
+ : undefined
199
202
  },
200
203
  step_name: BANK_STEP_NAMES.BANK_INFO,
201
204
  encryption_contract: ['bank_account.iban', 'bank_account.beneficiary_name', 'bank_account.bank_name']
@@ -231,31 +234,6 @@ export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
231
234
  });
232
235
  });
233
236
  });
234
- export var uploadBankStatement = createAsyncThunk('uploadBankStatement', function (_a) {
235
- var file = _a.file, onProgress = _a.onProgress;
236
- return __awaiter(void 0, void 0, void 0, function () {
237
- var uploadPayload, onUploadProgress, data;
238
- return __generator(this, function (_b) {
239
- switch (_b.label) {
240
- case 0:
241
- uploadPayload = {
242
- file_link_create: true,
243
- title: file === null || file === void 0 ? void 0 : file.name,
244
- purpose: 'bank_statement',
245
- file: file
246
- };
247
- onUploadProgress = function (progressEvent) {
248
- var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
249
- onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
250
- };
251
- return [4, API.fileService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
252
- case 1:
253
- data = _b.sent();
254
- return [2, { data: data }];
255
- }
256
- });
257
- });
258
- });
259
237
  export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
260
238
  var _a, settings, bank, _b, id, infoId, payload, data, boardInfoData;
261
239
  var _c, _d, _e, _f;
@@ -291,7 +269,6 @@ var initialState = {
291
269
  error: null,
292
270
  loading: false,
293
271
  customLoading: false,
294
- uploading: false,
295
272
  data: {
296
273
  flowName: FlowsTypes.BANK,
297
274
  verify: {
@@ -321,6 +298,9 @@ export var bankSlice = createSlice({
321
298
  },
322
299
  resetOTPScreen: function (state) {
323
300
  state.data.otpData.otp = '';
301
+ },
302
+ bankStatementUploadingStatus: function (state, action) {
303
+ state.data.bankData.uploading = action.payload;
324
304
  }
325
305
  },
326
306
  extraReducers: function (builder) {
@@ -455,23 +435,9 @@ export var bankSlice = createSlice({
455
435
  if (action.error.message === 'Aborted')
456
436
  return;
457
437
  state.error = action.error.message;
458
- })
459
- .addCase(uploadBankStatement.pending, function (state) {
460
- state.error = null;
461
- state.uploading = true;
462
- })
463
- .addCase(uploadBankStatement.fulfilled, function (state, action) {
464
- state.error = null;
465
- state.uploading = false;
466
- var data = action.payload.data;
467
- state.data.bankData.bankStatementId = data === null || data === void 0 ? void 0 : data.id;
468
- })
469
- .addCase(uploadBankStatement.rejected, function (state) {
470
- state.uploading = false;
471
- state.error = 'file_upload_error';
472
438
  });
473
439
  }
474
440
  });
475
- export var clearError = (_a = bankSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
441
+ export var clearError = (_a = bankSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, bankStatementUploadingStatus = _a.bankStatementUploadingStatus;
476
442
  export default bankSlice.reducer;
477
443
  export var bankSelector = function (state) { return state.bank; };
@@ -63,13 +63,14 @@ import { CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHE
63
63
  import { defaultCountry } from '../../../constants';
64
64
  import { getIndividualName, capitalizeTheFirstLetterOfEachWord, getEighteenYearsAgo, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA } from '../../../utils';
65
65
  export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retrieveLeadIdentityByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
- var _a, settings, connectExpress, countryCode, data, phone, status, board_id, board_info_id, _b, boardInfo, boardData, leadData;
66
+ var _a, settings, connectExpress, countryCode, showBoard, data, phone, status, board_id, board_info_id, isRegistered, _b, boardInfo, boardData, leadData;
67
67
  var _c, _d;
68
68
  return __generator(this, function (_e) {
69
69
  switch (_e.label) {
70
70
  case 0:
71
71
  _a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
72
72
  countryCode = settings.data.businessCountry;
73
+ showBoard = connectExpress.data.showBoard;
73
74
  return [4, API.leadService.retrieveLeadIdentity(leadId)];
74
75
  case 1:
75
76
  data = _e.sent();
@@ -77,19 +78,21 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
77
78
  if (phone === null || phone === void 0 ? void 0 : phone.country_code)
78
79
  countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
79
80
  status = data.status, board_id = data.board_id, board_info_id = data.board_info_id;
80
- if ((status === null || status === void 0 ? void 0 : status.toLowerCase()) === 'registered' && !connectExpress.data.showBoard) {
81
- (_d = (_c = settings.data.appConfig).onFlowCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, data);
82
- thunkApi.dispatch(handleOpen(false));
81
+ isRegistered = (status === null || status === void 0 ? void 0 : status.toLowerCase()) === 'registered';
82
+ if (!isRegistered && !(data === null || data === void 0 ? void 0 : data.identification) && (data === null || data === void 0 ? void 0 : data.phone)) {
83
+ thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_MOBILE_STEP'));
83
84
  return [2, { data: data, countryCode: countryCode }];
84
85
  }
85
- if ((status === null || status === void 0 ? void 0 : status.toLowerCase()) !== 'registered') {
86
- thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_MOBILE_STEP'));
86
+ if (isRegistered && !showBoard) {
87
+ (_d = (_c = settings.data.appConfig).onFlowCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, data);
88
+ thunkApi.dispatch(handleOpen(false));
87
89
  return [2, { data: data, countryCode: countryCode }];
88
90
  }
89
- if (!(board_id && board_info_id)) {
91
+ if (isRegistered && !(board_id && board_info_id)) {
90
92
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP'));
91
93
  return [2, { data: data, countryCode: countryCode }];
92
94
  }
95
+ if (!(isRegistered && board_id && board_info_id)) return [3, 3];
93
96
  return [4, Promise.all([
94
97
  API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id }),
95
98
  API.boardService.retrieveBoardDetails(board_id),
@@ -99,6 +102,7 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
99
102
  _b = _e.sent(), boardInfo = _b[0], boardData = _b[1], leadData = _b[2];
100
103
  thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP'));
101
104
  return [2, { data: __assign(__assign({}, data), leadData.data), countryCode: countryCode, boardInfo: boardInfo, boardData: boardData }];
105
+ case 3: return [2, { data: data, countryCode: countryCode }];
102
106
  }
103
107
  });
104
108
  }); });
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { EntityCapitalFormValues, EntityNameFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { ActionState, EntityCapitalFormValues, EntityNameFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  interface VerifyLeadTokenProps {
4
4
  token: string;
5
5
  isInternally?: boolean;
@@ -44,6 +44,15 @@ export declare const updateEntityName: import("@reduxjs/toolkit").AsyncThunk<{
44
44
  data: any;
45
45
  formData: EntityNameFormValues;
46
46
  }, EntityNameFormValues, {}>;
47
+ interface UploadArticleParams {
48
+ file: File;
49
+ onProgress?: (value: number) => void;
50
+ onSuccess?: (fileId: string) => void;
51
+ onFailure?: (error: string) => void;
52
+ }
53
+ export declare const uploadArticle: import("@reduxjs/toolkit").AsyncThunk<{
54
+ data: any;
55
+ }, UploadArticleParams, {}>;
47
56
  export declare const updateEntityCapital: import("@reduxjs/toolkit").AsyncThunk<{
48
57
  data: any;
49
58
  formData: EntityCapitalFormValues;
@@ -65,13 +74,17 @@ export interface EntityData {
65
74
  export interface EntityState extends SharedState<EntityData> {
66
75
  customLoading?: boolean;
67
76
  uploading?: boolean;
77
+ uploadingArticle?: boolean;
78
+ uploadingArticleError?: string | null;
68
79
  }
69
80
  export declare const entitySlice: import("@reduxjs/toolkit").Slice<EntityState, {
70
81
  clearError: (state: EntityState) => void;
71
82
  stopLoader: (state: EntityState) => void;
72
83
  resetOTPScreen: (state: EntityState) => void;
84
+ uploadingStatus: (state: EntityState, action: ActionState<boolean>) => void;
85
+ clearArticleId: (state: EntityState) => void;
73
86
  }, "entity/store">;
74
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
87
+ 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>, clearArticleId: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
75
88
  declare const _default: import("redux").Reducer<EntityState, import("redux").AnyAction>;
76
89
  export default _default;
77
90
  export declare const entitySelector: (state: RootState) => EntityState;
@@ -238,26 +238,28 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
238
238
  });
239
239
  }); });
240
240
  export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
241
- var _a, settings, entity, entityData, _b, id, data_status, issuingDate, expiryDate, isFL, isLegalNameEditable, isLicenseTypeEditable, isEntityTypeEditable, isLicenseNumberEditable, isUnifiedNumberEditable, isIssuingDateEditable, isExpiryDateEditable, payload, data, list;
242
- var _c, _d, _e, _f, _g, _h, _j;
243
- return __generator(this, function (_k) {
244
- switch (_k.label) {
241
+ var _a, settings, entity, entityData, _b, id, data_status, articleId, issuingDate, expiryDate, isFL, isLegalNameEditable, isLicenseTypeEditable, isEntityTypeEditable, isLicenseNumberEditable, isUnifiedNumberEditable, isIssuingDateEditable, isExpiryDateEditable, payload, data, documentBody, _c, list;
242
+ var _d, _e, _f, _g, _h, _j, _k;
243
+ return __generator(this, function (_l) {
244
+ switch (_l.label) {
245
245
  case 0:
246
246
  _a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
247
247
  entityData = (entity.data.verify.responseBody || {}).entity;
248
248
  _b = entityData || {}, id = _b.id, data_status = _b.data_status;
249
+ articleId = entity.data.entityNameData.articleId;
249
250
  issuingDate = new Date(params.issuingDate).getTime();
250
251
  expiryDate = new Date(params.expiryDate).getTime();
251
252
  isFL = params.licenseType === BusinessType.FL;
252
253
  isLegalNameEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.legal_name) === FieldType.EDITABLE;
253
- isLicenseTypeEditable = ((_c = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _c === void 0 ? void 0 : _c.type) === FieldType.EDITABLE;
254
+ isLicenseTypeEditable = ((_d = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _d === void 0 ? void 0 : _d.type) === FieldType.EDITABLE;
254
255
  isEntityTypeEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.type) === FieldType.EDITABLE;
255
- isLicenseNumberEditable = ((_d = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _d === void 0 ? void 0 : _d.number) === FieldType.EDITABLE;
256
- isUnifiedNumberEditable = ((_e = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _e === void 0 ? void 0 : _e.additional_info) === FieldType.EDITABLE;
257
- isIssuingDateEditable = ((_f = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _f === void 0 ? void 0 : _f.issuing_date) === FieldType.EDITABLE;
258
- isExpiryDateEditable = ((_g = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _g === void 0 ? void 0 : _g.expiry_date) === FieldType.EDITABLE;
256
+ isLicenseNumberEditable = ((_e = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _e === void 0 ? void 0 : _e.number) === FieldType.EDITABLE;
257
+ isUnifiedNumberEditable = ((_f = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _f === void 0 ? void 0 : _f.additional_info) === FieldType.EDITABLE;
258
+ isIssuingDateEditable = ((_g = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _g === void 0 ? void 0 : _g.issuing_date) === FieldType.EDITABLE;
259
+ isExpiryDateEditable = ((_h = data_status === null || data_status === void 0 ? void 0 : data_status.license) === null || _h === void 0 ? void 0 : _h.expiry_date) === FieldType.EDITABLE;
259
260
  payload = {
260
261
  id: id,
262
+ AOA_file_id: articleId,
261
263
  license: {
262
264
  number: isLicenseNumberEditable && params.licenseNumber ? params.licenseNumber : undefined,
263
265
  type: isLicenseTypeEditable ? (isFL ? 'freelance' : 'commercial_registration') : undefined,
@@ -289,17 +291,60 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
289
291
  };
290
292
  return [4, API.entityService.updateEntity(payload)];
291
293
  case 1:
292
- data = _k.sent();
293
- return [4, API.dataService.getActivities()];
294
+ data = _l.sent();
295
+ if (!((params.certificateId || []).length > 0)) return [3, 3];
296
+ documentBody = {
297
+ entity_id: id || '',
298
+ documents: [
299
+ {
300
+ images: params.certificateId
301
+ }
302
+ ]
303
+ };
304
+ _c = data;
305
+ return [4, API.entityService.updateDocumentInfo(documentBody)];
294
306
  case 2:
295
- list = (_k.sent()).list;
307
+ _c.documentData = _l.sent();
308
+ _l.label = 3;
309
+ case 3: return [4, API.dataService.getActivities()];
310
+ case 4:
311
+ list = (_l.sent()).list;
296
312
  data.activityList = list;
297
313
  thunkApi.dispatch(handleNextScreenStep());
298
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, id);
314
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, id);
299
315
  return [2, { data: data, formData: params }];
300
316
  }
301
317
  });
302
318
  }); });
319
+ export var uploadArticle = createAsyncThunk('entityUploadArticle', function (_a) {
320
+ var file = _a.file, onProgress = _a.onProgress;
321
+ return __awaiter(void 0, void 0, void 0, function () {
322
+ var typeArray, type, uploadPayload, onUploadProgress, data;
323
+ var _b;
324
+ return __generator(this, function (_c) {
325
+ switch (_c.label) {
326
+ case 0:
327
+ typeArray = ((_b = file === null || file === void 0 ? void 0 : file.type) === null || _b === void 0 ? void 0 : _b.split('/')) || [];
328
+ type = typeArray[1] || '';
329
+ uploadPayload = {
330
+ file_link_create: true,
331
+ title: file === null || file === void 0 ? void 0 : file.name,
332
+ purpose: 'article_of_association',
333
+ type: type,
334
+ file: file
335
+ };
336
+ onUploadProgress = function (progressEvent) {
337
+ var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
338
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
339
+ };
340
+ return [4, API.fileService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
341
+ case 1:
342
+ data = _c.sent();
343
+ return [2, { data: data }];
344
+ }
345
+ });
346
+ });
347
+ });
303
348
  export var updateEntityCapital = createAsyncThunk('entityUpdateEntityCapital', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
304
349
  var _a, settings, entity, entityData, _b, id, data_status, isCapitalPaidEditable, isCapitalShareEditable, activities, payload, data;
305
350
  var _c, _d, _e, _f, _g;
@@ -373,6 +418,8 @@ var initialState = {
373
418
  loading: false,
374
419
  customLoading: false,
375
420
  uploading: false,
421
+ uploadingArticle: false,
422
+ uploadingArticleError: null,
376
423
  data: {
377
424
  flowName: FlowsTypes.ENTITY,
378
425
  verify: {
@@ -410,6 +457,12 @@ export var entitySlice = createSlice({
410
457
  },
411
458
  resetOTPScreen: function (state) {
412
459
  state.data.otpData.otp = '';
460
+ },
461
+ uploadingStatus: function (state, action) {
462
+ state.uploading = action.payload;
463
+ },
464
+ clearArticleId: function (state) {
465
+ state.data.entityNameData.articleId = '';
413
466
  }
414
467
  },
415
468
  extraReducers: function (builder) {
@@ -576,6 +629,20 @@ export var entitySlice = createSlice({
576
629
  .addCase(updateEntityName.rejected, function (state, action) {
577
630
  state.loading = false;
578
631
  state.error = action.error.message;
632
+ })
633
+ .addCase(uploadArticle.pending, function (state) {
634
+ state.uploadingArticleError = null;
635
+ state.uploadingArticle = true;
636
+ })
637
+ .addCase(uploadArticle.fulfilled, function (state, action) {
638
+ state.uploadingArticleError = null;
639
+ state.uploadingArticle = false;
640
+ var data = action.payload.data;
641
+ state.data.entityNameData.articleId = data === null || data === void 0 ? void 0 : data.id;
642
+ })
643
+ .addCase(uploadArticle.rejected, function (state) {
644
+ state.uploadingArticle = false;
645
+ state.uploadingArticleError = 'file_upload_article_error';
579
646
  })
580
647
  .addCase(updateEntityCapital.pending, function (state) {
581
648
  state.loading = true;
@@ -629,6 +696,6 @@ export var entitySlice = createSlice({
629
696
  });
630
697
  }
631
698
  });
632
- export var clearError = (_a = entitySlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
699
+ export var clearError = (_a = entitySlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, uploadingStatus = _a.uploadingStatus, clearArticleId = _a.clearArticleId;
633
700
  export default entitySlice.reducer;
634
701
  export var entitySelector = function (state) { return state.entity; };
@@ -9,17 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import * as React from 'react';
25
14
  import { ScreenContainer } from '../../../shared/Containers';
@@ -53,21 +42,29 @@ var ButtonStyled = styled(Button)(function (_a) {
53
42
  });
54
43
  });
55
44
  var BankDetails = function () {
56
- var _a, _b, _c;
57
- var _d = React.useState(false), ibanChecking = _d[0], setIbanChecking = _d[1];
45
+ var _a, _b, _c, _d, _e, _f, _g;
46
+ var _h = React.useState(false), ibanChecking = _h[0], setIbanChecking = _h[1];
58
47
  var dispatch = useAppDispatch();
59
- var _e = useAppSelector(bankSelector), data = _e.data, loading = _e.loading, error = _e.error, uploading = _e.uploading;
48
+ var _j = useAppSelector(bankSelector), data = _j.data, loading = _j.loading, error = _j.error;
60
49
  var settingsData = useAppSelector(settingsSelector).data;
61
- var _f = data.bankData, responseBody = _f.responseBody, defaultValues = __rest(_f, ["responseBody"]);
50
+ var _k = data.bankData, iban = _k.iban, beneficiaryName = _k.beneficiaryName, bankName = _k.bankName, bankStatementId = _k.bankStatementId, bankStatementUploading = _k.uploading, confirmPolicy = _k.confirmPolicy;
62
51
  var verify = data.verify;
63
52
  var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
64
53
  var isFL = ((_c = (_b = (_a = verify.responseBody) === null || _a === void 0 ? void 0 : _a.entity) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === BusinessType.FL ? true : false;
54
+ var bankHasDocument = ((_g = (_f = (_e = (_d = verify.responseBody) === null || _d === void 0 ? void 0 : _d.bank_account) === null || _e === void 0 ? void 0 : _e.document) === null || _f === void 0 ? void 0 : _f.files) === null || _g === void 0 ? void 0 : _g.length) > 0;
65
55
  var methods = useForm({
66
- resolver: yupResolver(isKWCountry && isFL ? BankKWFLValidation : BankValidation),
67
- defaultValues: defaultValues,
56
+ resolver: yupResolver(isKWCountry && isFL && !bankHasDocument ? BankKWFLValidation : BankValidation),
57
+ defaultValues: {
58
+ iban: iban,
59
+ beneficiaryName: beneficiaryName,
60
+ bankName: bankName,
61
+ bankStatementId: bankStatementId,
62
+ uploading: bankStatementUploading,
63
+ confirmPolicy: confirmPolicy
64
+ },
68
65
  mode: 'onChange'
69
66
  });
70
- useSetFromDefaultValues(methods, defaultValues);
67
+ useSetFromDefaultValues(methods, data.bankData);
71
68
  var onSubmit = function (data) {
72
69
  dispatch(createBankAccount(data));
73
70
  };
@@ -76,11 +73,11 @@ var BankDetails = function () {
76
73
  var onBack = function () {
77
74
  dispatch(handleCurrentActiveScreen('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
78
75
  };
79
- var disabled = ibanChecking || !methods.formState.isValid || !!error || uploading;
76
+ var disabled = ibanChecking || !methods.formState.isValid || !!error || bankStatementUploading;
80
77
  React.useEffect(function () {
81
78
  if (error)
82
79
  dispatch(clearError());
83
- }, [methods.formState.isValid, methods.watch('bankStatementFile')]);
84
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(BankStatement, { required: isKWCountry && isFL }), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, disableBack: true, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
80
+ }, [methods.formState.isValid, methods.watch('bankStatementId')]);
81
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(BankStatement, { required: isKWCountry && isFL && !bankHasDocument }), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, disableBack: true, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
85
82
  };
86
83
  export default BankDetails;
@@ -1,13 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from 'react';
3
2
  import { styled } from '@mui/material/styles';
4
3
  import { ScreenContainer } from '../../../shared/Containers';
5
4
  import { useTranslation } from 'react-i18next';
6
5
  import { useController, useFormContext } from 'react-hook-form';
7
6
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
- import { bankSelector, uploadBankStatement } from '../../../app/bank/bankStore';
9
- import UploadFile from '../../../shared/UploadFile';
10
- import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
7
+ import { bankSelector, bankStatementUploadingStatus } from '../../../app/bank/bankStore';
8
+ import UploadMultipleFile from '../../../shared/UploadMultipleFile';
11
9
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
12
10
  var theme = _a.theme;
13
11
  return ({
@@ -15,53 +13,18 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
15
13
  });
16
14
  });
17
15
  var BankStatement = function (_a) {
18
- var _b, _c;
19
16
  var required = _a.required;
20
- var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
21
17
  var t = useTranslation().t;
22
- var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors;
23
- var bankStatementFileControl = useController({ name: 'bankStatementFile', control: control });
18
+ var control = useFormContext().control;
24
19
  var bankStatementIdControl = useController({ name: 'bankStatementId', control: control });
25
- var _f = useAppSelector(bankSelector), loading = _f.loading, uploading = _f.uploading, sysError = _f.error;
20
+ var loading = useAppSelector(bankSelector).loading;
26
21
  var dispatch = useAppDispatch();
27
- var bankStatementValue = bankStatementFileControl.field.value;
28
- var error = ((_b = bankStatementFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = bankStatementIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
29
- var handleBankStatementChange = function (files) {
30
- var file = files === null || files === void 0 ? void 0 : files[0];
31
- if (!file)
32
- return;
33
- if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
34
- setError('bankStatementFile', { message: 'file_not_supported_alert' });
35
- return;
36
- }
37
- if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
38
- setError('bankStatementFile', { message: 'file_size_alert' });
39
- return;
40
- }
41
- bankStatementFileControl.field.onChange(file);
42
- dispatch(uploadBankStatement({
43
- file: file,
44
- onProgress: function (value) {
45
- setProgress(value);
46
- }
47
- }));
22
+ var handleBankStatementChange = function (ids) {
23
+ bankStatementIdControl.field.onChange(ids);
48
24
  };
49
- var handleReset = function () {
50
- bankStatementFileControl.field.onChange(null);
51
- bankStatementIdControl.field.onChange('');
52
- setProgress(0);
25
+ var handleReset = function (ids) {
26
+ bankStatementIdControl.field.onChange(ids);
53
27
  };
54
- React.useEffect(function () {
55
- if (sysError === 'file_upload_error') {
56
- setError('bankStatementId', { message: sysError });
57
- bankStatementFileControl.field.onChange(null);
58
- setProgress(0);
59
- }
60
- }, [sysError]);
61
- React.useEffect(function () {
62
- if ((bankStatementFileControl.formState.isValid || !!bankStatementValue) && error != 'file_upload_error')
63
- clearErrors();
64
- }, [bankStatementFileControl.formState.isValid, bankStatementValue]);
65
- return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isFileUploaded: !uploading && !!bankStatementValue, isSubmitting: loading, isUploading: uploading, progress: progress, required: required, onReset: handleReset, error: error && t(error) }) }));
28
+ return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_bank_statement'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBankStatementChange, isSubmitting: loading, required: required, onDeleteFile: handleReset, purpose: 'bank_statement', maxLimit: 4, fileUploadingStatus: function (uploading) { return dispatch(bankStatementUploadingStatus(uploading)); } }) }));
66
29
  };
67
30
  export default BankStatement;
@@ -3,43 +3,37 @@ export declare const BankValidation: yup.ObjectSchema<import("yup/lib/object").A
3
3
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
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
- bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
7
- bankStatementFile: any;
6
+ bankStatementId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
8
7
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
9
8
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
10
9
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
10
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
11
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
13
- bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
14
- bankStatementFile: any;
12
+ bankStatementId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
15
13
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
16
14
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
17
15
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
16
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
19
17
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
20
- bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
21
- bankStatementFile: any;
18
+ bankStatementId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
22
19
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
23
20
  }>>>;
24
21
  export declare const BankKWFLValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
25
22
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
26
23
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
27
24
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
28
- bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
29
- bankStatementFile: import("yup/lib/mixed").MixedSchema<any, import("yup/lib/types").AnyObject, any>;
25
+ bankStatementId: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
30
26
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
31
27
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
32
28
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
33
29
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
34
30
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
35
- bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
36
- bankStatementFile: import("yup/lib/mixed").MixedSchema<any, import("yup/lib/types").AnyObject, any>;
31
+ bankStatementId: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
37
32
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
38
33
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
39
34
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
40
35
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
41
36
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
42
- bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
43
- bankStatementFile: import("yup/lib/mixed").MixedSchema<any, import("yup/lib/types").AnyObject, any>;
37
+ bankStatementId: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
44
38
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
45
39
  }>>>;
@@ -1,36 +1,16 @@
1
- import { MAX_FILE_SIZE, VALID_FILE_FORMATS, REGEX_ALPHANUMERIC, REGEX_IBAN } from '../../../../constants';
1
+ import { REGEX_ALPHANUMERIC, REGEX_IBAN } from '../../../../constants';
2
2
  import * as yup from 'yup';
3
3
  export var BankValidation = yup.object().shape({
4
4
  iban: yup.string().matches(REGEX_IBAN, 'invalid_iban_format').min(15, 'invalid_iban_format').max(34, 'invalid_iban_format').required('alert_iban'),
5
5
  bankName: yup.string().optional(),
6
6
  beneficiaryName: yup.string().matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid').required('beneficiary_name_required'),
7
- bankStatementId: yup.string().optional(),
8
- bankStatementFile: yup
9
- .mixed()
10
- .test({
11
- test: function (value) {
12
- if (!!value)
13
- return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE ? true : this.createError({ message: 'alert_file_upload' });
14
- return true;
15
- }
16
- })
17
- .optional(),
7
+ bankStatementId: yup.array().optional(),
18
8
  confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
19
9
  });
20
10
  export var BankKWFLValidation = yup.object().shape({
21
11
  iban: yup.string().matches(REGEX_IBAN, 'invalid_iban_format').min(15, 'invalid_iban_format').max(34, 'invalid_iban_format').required('alert_iban'),
22
12
  bankName: yup.string().optional(),
23
13
  beneficiaryName: yup.string().matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid').required('beneficiary_name_required'),
24
- bankStatementId: yup.string().optional(),
25
- bankStatementFile: yup
26
- .mixed()
27
- .test({
28
- test: function (value) {
29
- if (!!value)
30
- return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE ? true : this.createError({ message: 'alert_file_upload' });
31
- return true;
32
- }
33
- })
34
- .required('bank_statement_required'),
14
+ bankStatementId: yup.array().min(1, 'bank_statement_required').required('bank_statement_required'),
35
15
  confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
36
16
  });
@@ -136,7 +136,7 @@ var customerLocations = function (_a) {
136
136
  };
137
137
  var customerLocationsValue = customerLocationsControl.field.value;
138
138
  var customerLocationSelected = customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue[0];
139
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(BaseLabelStyled, { children: t('select_customer_base') }), _jsx(Tooltip, __assign({ title: t('customer_base_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(InputStyled, { readOnly: true, placeholder: t('choose_expected_sales'), value: isAr ? customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.ar : customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.en, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { searchKeyPath: 'name.en', list: customerLocationsList, placeholder: 'choose_customer_base', onSelectItem: onSelectItem, renderItem: function (item) {
139
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(BaseLabelStyled, { children: t('select_customer_base') }), _jsx(Tooltip, __assign({ title: t('customer_base_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(InputStyled, { readOnly: true, placeholder: t('choose_expected_sales'), value: (isAr ? customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.ar : customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.en) || '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { searchKeyPath: 'name.en', list: customerLocationsList, placeholder: 'choose_customer_base', onSelectItem: onSelectItem, renderItem: function (item) {
140
140
  return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue.id) }, { children: isAr ? item.name.ar : item.name.en })) })), item.id === (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(CheckIconStyled, {}), checkRemainingCondition(item) && item.id != (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(RemainingCheck, {})] }));
141
141
  } })] }))] }) })));
142
142
  };
@@ -90,7 +90,7 @@ var ExpectedCustomers = function (_a) {
90
90
  };
91
91
  var expectedCustomersValue = expectedCustomerControl.field.value;
92
92
  var expectedCustomersSelected = expectedCustomersValue;
93
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: true, placeholder: t('choose_expected_sales'), value: isAr ? expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name.ar : expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name.en, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
93
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: true, placeholder: t('choose_expected_sales'), value: (isAr ? expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name.ar : expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name.en) || '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
94
94
  return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedCustomersValue === null || expectedCustomersValue === void 0 ? void 0 : expectedCustomersValue.id) }, { children: isAr ? item.name.ar : item.name.en })) }), item.id === (expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.id) && _jsx(CheckIconStyled, {})] }));
95
95
  } })] }))] }) })));
96
96
  };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ interface BrandProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: BrandProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,71 @@
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
+ };
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { connectSelector } from '../../../app/connect/connectStore';
14
+ import * as React from 'react';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { useFormContext, useController } from 'react-hook-form';
17
+ import Box from '@mui/material/Box';
18
+ import { styled } from '@mui/material/styles';
19
+ import { useAppSelector, useLanguage } from '../../../../hooks';
20
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
21
+ import Input from '../../../shared/Input';
22
+ import CheckIcon from '../../../shared/CheckIcon';
23
+ import SimpleList from '../../../../components/SimpleList';
24
+ import Text from '../../../../components/Text';
25
+ import ExpandIcon from '../../../../components/ExpandIcon';
26
+ import Collapse from '../../../../components/Collapse';
27
+ var InputStyled = styled(Input)(function () { return ({
28
+ '& .MuiInputBase-input': {
29
+ cursor: 'pointer'
30
+ }
31
+ }); });
32
+ var BrandContainer = styled(Box)(function () { return ({
33
+ display: 'flex'
34
+ }); });
35
+ var BrandNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
36
+ var theme = _a.theme, isSelected = _a.isSelected;
37
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
38
+ });
39
+ var Brand = function (_a) {
40
+ var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
41
+ var t = useTranslation().t;
42
+ var isAr = useLanguage().isAr;
43
+ var data = useAppSelector(connectSelector).data;
44
+ var _c = data.individualData.responseBody || {}, segments_list = _c.segments_list, team_size_list = _c.team_size_list;
45
+ var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
46
+ var selectedBrandControl = useController({ control: control, name: 'selectedBrand' });
47
+ var selectedBrand = selectedBrandControl.field.value;
48
+ var onOpenBrandList = function (event) {
49
+ setAnchorEl(event.currentTarget);
50
+ };
51
+ var onCloseBrandList = function () {
52
+ setAnchorEl(null);
53
+ };
54
+ var getBrandName = function (_a) {
55
+ var name = _a.name;
56
+ return (isAr ? name === null || name === void 0 ? void 0 : name.ar : name === null || name === void 0 ? void 0 : name.en) || '';
57
+ };
58
+ var getBrandId = function (item) {
59
+ return item.id || '';
60
+ };
61
+ var isOtherBrand = function (item) {
62
+ return getBrandId(item) === 'other';
63
+ };
64
+ var onSelectItem = function (brand) {
65
+ selectedBrandControl.field.onChange(brand);
66
+ };
67
+ return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('select_brand_label'), readOnly: true, onClick: !!anchorEl ? onCloseBrandList : onOpenBrandList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_brand'), value: t(getBrandName(selectedBrand)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', list: [], onSelectItem: onSelectItem, renderItem: function (item) {
68
+ return (_jsxs(_Fragment, { children: [_jsx(BrandContainer, { children: _jsx(BrandNameText, __assign({ isSelected: getBrandId(item) === getBrandId(selectedBrand) }, { children: isOtherBrand(item) ? t(getBrandName(item)) : getBrandName(item) })) }), getBrandId(item) === getBrandId(selectedBrand) && _jsx(CheckIcon, {})] }));
69
+ } }) }))] }));
70
+ };
71
+ export default React.memo(Brand);
@@ -0,0 +1,2 @@
1
+ import Brand from './Brand';
2
+ export default Brand;
@@ -0,0 +1,2 @@
1
+ import Brand from './Brand';
2
+ export default Brand;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare type ArticleProps = {
3
+ show: boolean;
4
+ };
5
+ declare const Article: ({ show }: ArticleProps) => JSX.Element;
6
+ export default Article;
@@ -0,0 +1,87 @@
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
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { useController, useFormContext } from 'react-hook-form';
16
+ import { styled } from '@mui/material/styles';
17
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
18
+ import { maskFileName } from '../../../../utils';
19
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
20
+ import Collapse from '../../../../components/Collapse';
21
+ import { ScreenContainer } from '../../../shared/Containers';
22
+ import { entitySelector, clearArticleId, uploadArticle } from '../../../app/entity/entityStore';
23
+ import UploadFile from '../../../shared/UploadFile';
24
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
25
+ var theme = _a.theme;
26
+ return ({
27
+ marginBlockStart: theme.spacing(3)
28
+ });
29
+ });
30
+ 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];
34
+ var t = useTranslation().t;
35
+ var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
36
+ var articleFileControl = useController({ name: 'articleFile', control: control });
37
+ var articleIdControl = useController({ name: 'articleId', control: control });
38
+ var _e = useAppSelector(entitySelector), loading = _e.loading, uploadingArticle = _e.uploadingArticle, sysError = _e.uploadingArticleError, data = _e.data;
39
+ var dispatch = useAppDispatch();
40
+ var articleValue = articleFileControl.field.value;
41
+ var entityNameData = data.entityNameData;
42
+ var articleFile = entityNameData.articleFile, articleId = entityNameData.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
+ }));
69
+ };
70
+ var handleReset = function () {
71
+ articleFileControl.field.onChange(undefined);
72
+ articleIdControl.field.onChange('');
73
+ dispatch(clearArticleId());
74
+ setProgress(0);
75
+ };
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 }) }) })));
86
+ };
87
+ export default Article;
@@ -17,7 +17,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues } from '../../../../hooks';
19
19
  import { settingsSelector } from '../../../../app/settings';
20
- import { isSA } from '../../../../utils';
20
+ import { isKW, isSA } from '../../../../utils';
21
21
  import { BusinessType } from '../../../../@types';
22
22
  import Form from '../../../../components/Form';
23
23
  import Collapse from '../../../../components/Collapse';
@@ -31,6 +31,8 @@ import IssuingDate from './IssuingDate';
31
31
  import ExpiryDate from './ExpiryDate';
32
32
  import EntityTypeList from './EntityTypeList';
33
33
  import UnifiedNumber from './UnifiedNumber';
34
+ import LicenseCertificate from './LicenseCertificate';
35
+ import Article from './Article';
34
36
  var FormStyled = styled(Form)(function () { return ({
35
37
  display: 'flex',
36
38
  flexDirection: 'column'
@@ -39,14 +41,15 @@ var EntityName = function (_a) {
39
41
  var _b = React.useState(false), issueAnchorEl = _b[0], setIssueAnchorEl = _b[1];
40
42
  var _c = React.useState(false), expiryAnchorEl = _c[0], setExpiryAnchorEl = _c[1];
41
43
  var _d = React.useState(false), entityTypeAnchorEl = _d[0], setEntityTypeAnchorEl = _d[1];
42
- var _e = useAppSelector(entitySelector), data = _e.data, loading = _e.loading, error = _e.error;
44
+ var _e = useAppSelector(entitySelector), data = _e.data, loading = _e.loading, error = _e.error, uploading = _e.uploading, uploadingArticle = _e.uploadingArticle;
43
45
  var settingsData = useAppSelector(settingsSelector).data;
44
46
  var isAr = useLanguage().isAr;
45
47
  var t = useTranslation().t;
46
48
  var dispatch = useAppDispatch();
47
- var _f = data.entityNameData, legalName = _f.legalName, licenseNumber = _f.licenseNumber, licenseType = _f.licenseType, entityType = _f.entityType, issuingDate = _f.issuingDate, expiryDate = _f.expiryDate, unifiedNumber = _f.unifiedNumber;
49
+ var _f = data.entityNameData, legalName = _f.legalName, licenseNumber = _f.licenseNumber, licenseType = _f.licenseType, entityType = _f.entityType, issuingDate = _f.issuingDate, expiryDate = _f.expiryDate, unifiedNumber = _f.unifiedNumber, certificateId = _f.certificateId, articleId = _f.articleId, articleFile = _f.articleFile;
48
50
  var country_code = settingsData.businessCountry.iso2;
49
51
  var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
52
+ var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
50
53
  var isCR = licenseType === BusinessType.CR;
51
54
  var entity = (data.verify.responseBody || {}).entity;
52
55
  var methods = useForm({
@@ -58,7 +61,10 @@ var EntityName = function (_a) {
58
61
  entityType: entityType,
59
62
  issuingDate: issuingDate,
60
63
  expiryDate: expiryDate,
61
- unifiedNumber: unifiedNumber
64
+ unifiedNumber: unifiedNumber,
65
+ certificateId: certificateId,
66
+ articleId: articleId,
67
+ articleFile: articleFile
62
68
  },
63
69
  mode: 'onChange'
64
70
  });
@@ -79,9 +85,9 @@ var EntityName = function (_a) {
79
85
  if (error)
80
86
  dispatch(clearError());
81
87
  }, [methods.formState.isValid]);
82
- var disabled = !methods.formState.isValid || !!error;
88
+ var disabled = !methods.formState.isValid || !!error || uploading || uploadingArticle;
83
89
  var showLicenseNumber = !isSACountry ? isCR : true;
84
90
  var showUnifiedNumber = isSACountry ? isCR : false;
85
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, {}) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); } }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseNumber, { show: showLicenseNumber }), _jsx(UnifiedNumber, { show: showUnifiedNumber })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
91
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, {}) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); } }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseNumber, { show: showLicenseNumber }), _jsx(UnifiedNumber, { show: showUnifiedNumber })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { show: !(isKWCountry && !isCR) }), _jsx(Article, { show: true })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
86
92
  };
87
93
  export default EntityName;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface LicenseCertificateProps {
3
+ show: boolean;
4
+ }
5
+ declare const LicenseCertificate: ({ show }: LicenseCertificateProps) => JSX.Element;
6
+ export default LicenseCertificate;
@@ -0,0 +1,42 @@
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
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { useTranslation } from 'react-i18next';
14
+ import { useController, useFormContext } from 'react-hook-form';
15
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
16
+ import { styled } from '@mui/material/styles';
17
+ import Collapse from '../../../../components/Collapse';
18
+ import { ScreenContainer } from '../../../shared/Containers';
19
+ import { entitySelector, uploadingStatus } from '../../../app/entity/entityStore';
20
+ import UploadMultipleFile from '../../../shared/UploadMultipleFile';
21
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
22
+ var theme = _a.theme;
23
+ return ({
24
+ marginBlockStart: theme.spacing(3)
25
+ });
26
+ });
27
+ var LicenseCertificate = function (_a) {
28
+ var show = _a.show;
29
+ var t = useTranslation().t;
30
+ var control = useFormContext().control;
31
+ var dispatch = useAppDispatch();
32
+ var certificateIdControl = useController({ name: 'certificateId', control: control });
33
+ var loading = useAppSelector(entitySelector).loading;
34
+ var handleLicenseCertificateChange = function (ids) {
35
+ certificateIdControl.field.onChange(ids);
36
+ };
37
+ var handleReset = function (ids) {
38
+ certificateIdControl.field.onChange(ids);
39
+ };
40
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_license_certificate'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_certificate'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleLicenseCertificateChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, purpose: 'commercial_registration', fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); } }) }) })));
41
+ };
42
+ export default LicenseCertificate;
@@ -7,6 +7,8 @@ export declare const EntityNameValidationSchema: (entity: any) => yup.ObjectSche
7
7
  unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
8
8
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
9
9
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
10
+ certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
11
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
10
12
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
13
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
14
  licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -15,6 +17,8 @@ export declare const EntityNameValidationSchema: (entity: any) => yup.ObjectSche
15
17
  unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
16
18
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
19
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
20
+ certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
21
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
18
22
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
19
23
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
20
24
  licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -23,6 +27,8 @@ export declare const EntityNameValidationSchema: (entity: any) => yup.ObjectSche
23
27
  unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
24
28
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
25
29
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
30
+ certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
31
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
26
32
  }>>>;
27
33
  export declare const EntityNameKWValidationSchema: (entity: any) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
28
34
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -31,6 +37,8 @@ export declare const EntityNameKWValidationSchema: (entity: any) => yup.ObjectSc
31
37
  licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
32
38
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
33
39
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
40
+ certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
41
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
34
42
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
35
43
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
36
44
  licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -38,6 +46,8 @@ export declare const EntityNameKWValidationSchema: (entity: any) => yup.ObjectSc
38
46
  licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
39
47
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
40
48
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
49
+ certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
50
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
41
51
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
42
52
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
43
53
  licenseType: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -45,4 +55,6 @@ export declare const EntityNameKWValidationSchema: (entity: any) => yup.ObjectSc
45
55
  licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
46
56
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
47
57
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
58
+ certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
59
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
48
60
  }>>>;
@@ -57,7 +57,9 @@ export var EntityNameValidationSchema = function (entity) {
57
57
  })
58
58
  .required(''),
59
59
  issuingDate: isIssuingDateOptional ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
60
- expiryDate: isExpiryDateOptional ? yup.string().optional() : yup.string().required('choose_any_expiry_date')
60
+ expiryDate: isExpiryDateOptional ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
61
+ certificateId: yup.array().optional(),
62
+ articleId: yup.string().optional()
61
63
  });
62
64
  };
63
65
  export var EntityNameKWValidationSchema = function (entity) {
@@ -107,6 +109,8 @@ export var EntityNameKWValidationSchema = function (entity) {
107
109
  })
108
110
  .required(''),
109
111
  issuingDate: isIssuingDateOptional ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
110
- expiryDate: isExpiryDateOptional ? yup.string().optional() : yup.string().required('choose_any_expiry_date')
112
+ expiryDate: isExpiryDateOptional ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
113
+ certificateId: yup.array().optional(),
114
+ articleId: yup.string().optional()
111
115
  });
112
116
  };
@@ -18,7 +18,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
18
  }
19
19
  return to.concat(ar || Array.prototype.slice.call(from));
20
20
  };
21
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
22
22
  import React from 'react';
23
23
  import { useTranslation } from 'react-i18next';
24
24
  import { alpha, styled, useTheme } from '@mui/material/styles';
@@ -105,6 +105,8 @@ var UploadMultipleFile = function (_a) {
105
105
  if (!isSubmitting) {
106
106
  if (fileInfoArray.length > 0) {
107
107
  setError('');
108
+ if (required && fileInfoArray.length === 1)
109
+ setError(t('file_upload_at_least_one'));
108
110
  fileArray.splice(index, 1);
109
111
  setFileArray(__spreadArray([], fileArray, true));
110
112
  fileInfoArray.splice(index, 1);
@@ -138,7 +140,7 @@ var UploadMultipleFile = function (_a) {
138
140
  }
139
141
  };
140
142
  var fileExists = fileInfoArray.length > 0;
141
- return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {}), _jsx(Collapse, __assign({ in: !!uploadedFileCount, timeout: 100, unmountOnExit: true }, { children: _jsx(UploadCountBox, { children: "".concat(uploadedFileCount, " ").concat(t('uploaded_file')) }) }))] }), _jsx(InputContainerStyled, __assign({ sx: { mb: 2.5 } }, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: fileExists, uploadingTitle: uploadingTitle, successTitle: successTitle, onSuccess: handleFileChange, multiple: true, error: error }) })), _jsx(Collapse, __assign({ in: fileExists, timeout: 300 }, { children: (fileArray || []).map(function (file, index) {
143
+ return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: _jsxs(_Fragment, { children: [label, required && _jsx(Mandatory, {})] }) }), _jsx(Collapse, __assign({ in: !!uploadedFileCount, timeout: 100, unmountOnExit: true }, { children: _jsx(UploadCountBox, { children: "".concat(uploadedFileCount, " ").concat(t('uploaded_file')) }) }))] }), _jsx(InputContainerStyled, __assign({ sx: { mb: 2.5 } }, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: fileExists, uploadingTitle: uploadingTitle, successTitle: successTitle, onSuccess: handleFileChange, multiple: true, error: error }) })), _jsx(Collapse, __assign({ in: fileExists, timeout: 300 }, { children: (fileArray || []).map(function (file, index) {
142
144
  return (_jsx(UploadFile, { purpose: purpose, title: fileTitle, uploadedFiles: fileInfoArray, index: index, file: file, sx: {
143
145
  borderBottom: index === fileArray.length - 1 ? "1px solid ".concat(alpha(theme.palette.divider, 0.8)) : ''
144
146
  }, onSuccess: handleSuccess, onDelete: handleDelete, onFailure: handleFailure, onProgress: handleProgress }, index));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.66-test",
3
+ "version": "2.1.68-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",