@tap-payments/auth-jsconnect 2.1.38-test → 2.1.39-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/build/@types/form.d.ts +3 -6
  2. package/build/api/entity.d.ts +0 -8
  3. package/build/api/entity.js +0 -15
  4. package/build/api/file.d.ts +13 -0
  5. package/build/api/file.js +24 -0
  6. package/build/api/index.d.ts +6 -2
  7. package/build/api/index.js +3 -1
  8. package/build/assets/locales/ar.json +5 -1
  9. package/build/assets/locales/en.json +5 -1
  10. package/build/components/FileInput/DragAndDrop.js +1 -1
  11. package/build/components/ProgressBar/CircularProgressBar.d.ts +3 -1
  12. package/build/components/ProgressBar/CircularProgressBar.js +2 -2
  13. package/build/constants/assets.d.ts +1 -0
  14. package/build/constants/assets.js +1 -0
  15. package/build/constants/validation.d.ts +1 -0
  16. package/build/constants/validation.js +1 -0
  17. package/build/features/app/bank/bankStore.js +1 -1
  18. package/build/features/app/business/businessStore.d.ts +7 -9
  19. package/build/features/app/business/businessStore.js +29 -67
  20. package/build/features/app/individual/individualStore.d.ts +4 -16
  21. package/build/features/app/individual/individualStore.js +11 -89
  22. package/build/features/business/screens/BusinessType/Article.js +10 -13
  23. package/build/features/business/screens/BusinessType/BusinessType.js +2 -4
  24. package/build/features/business/screens/BusinessType/LicenseCertificate.js +12 -50
  25. package/build/features/business/screens/BusinessType/validation.d.ts +3 -6
  26. package/build/features/business/screens/BusinessType/validation.js +1 -11
  27. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -4
  28. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +11 -62
  29. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +11 -59
  30. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +6 -12
  31. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -23
  32. package/build/features/shared/UploadFile/UploadFile.js +1 -1
  33. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +38 -0
  34. package/build/features/shared/UploadMultipleFile/UploadFile.js +184 -0
  35. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +27 -0
  36. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +147 -0
  37. package/build/features/shared/UploadMultipleFile/index.d.ts +2 -0
  38. package/build/features/shared/UploadMultipleFile/index.js +2 -0
  39. package/build/theme/typography.js +1 -1
  40. package/package.json +1 -1
@@ -51,8 +51,7 @@ export declare type BusinessTypeFormValues = {
51
51
  licenseNumber: string;
52
52
  entityLegalName?: string;
53
53
  selectedLicense?: License;
54
- certificateId?: string;
55
- certificateFile?: File;
54
+ certificateId?: Array<string>;
56
55
  articleId?: string;
57
56
  articleFile?: File;
58
57
  };
@@ -90,10 +89,8 @@ export interface IndividualExtraFormValues extends IndividualAttachmentsFormValu
90
89
  isInfluencer: boolean | null;
91
90
  }
92
91
  export declare type IndividualAttachmentsFormValues = {
93
- civilID?: string;
94
- civilIDFile?: File;
95
- signatureFileId?: string;
96
- signatureFile?: File;
92
+ civilID?: Array<string>;
93
+ signatureFileId?: Array<string>;
97
94
  civilIDUploading?: boolean;
98
95
  signatureFileUploading?: boolean;
99
96
  };
@@ -47,13 +47,6 @@ export declare type EntityBankUpdateBody = {
47
47
  step_name: string;
48
48
  encryption_contract?: Array<string>;
49
49
  };
50
- export declare type UploadFileBody = {
51
- file_link_create: boolean;
52
- file?: File;
53
- title: string | undefined;
54
- purpose: string;
55
- type?: string;
56
- };
57
50
  export declare type UpdateEntityBody = {
58
51
  id: string;
59
52
  license?: {
@@ -121,7 +114,6 @@ declare const entityService: {
121
114
  retrieveBankAccount: (id: string) => Promise<any>;
122
115
  retrieveEntityInfo: (entity_id: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
123
116
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
124
- uploadFileInfo: (data: UploadFileBody, config?: AxiosRequestConfig) => Promise<any>;
125
117
  updateDocumentInfo: (data: DocumentUpdateBody) => Promise<any>;
126
118
  retrieveEntity: (entity_id: string) => Promise<any>;
127
119
  updateEntity: ({ id, ...data }: UpdateEntityBody) => Promise<any>;
@@ -1,14 +1,3 @@
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
1
  var __rest = (this && this.__rest) || function (s, e) {
13
2
  var t = {};
14
3
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -72,9 +61,6 @@ var retrieveBankAccount = function (id) {
72
61
  url: "".concat(ENDPOINT_PATHS.BANK, "/").concat(id)
73
62
  });
74
63
  };
75
- var uploadFileInfo = function (data, config) {
76
- return httpClient(__assign({ method: 'post', url: "".concat(ENDPOINT_PATHS.FILES_PATH), data: data, headers: { 'Content-Type': 'multipart/form-data' } }, config));
77
- };
78
64
  var updateIndividualInfo = function (_a) {
79
65
  var id = _a.id, data = __rest(_a, ["id"]);
80
66
  return httpClient({
@@ -103,7 +89,6 @@ var entityService = {
103
89
  retrieveBankAccount: retrieveBankAccount,
104
90
  retrieveEntityInfo: retrieveEntityInfo,
105
91
  updateIndividualInfo: updateIndividualInfo,
106
- uploadFileInfo: uploadFileInfo,
107
92
  updateDocumentInfo: updateDocumentInfo,
108
93
  retrieveEntity: retrieveEntity,
109
94
  updateEntity: updateEntity,
@@ -0,0 +1,13 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ export declare type UploadFileBody = {
3
+ file_link_create: boolean;
4
+ file?: File;
5
+ title: string | undefined;
6
+ purpose: string;
7
+ type?: string;
8
+ };
9
+ declare const fileService: {
10
+ uploadFile: (data: UploadFileBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
11
+ uploadFileInfo: (data: UploadFileBody, config?: AxiosRequestConfig) => Promise<any>;
12
+ };
13
+ export { fileService };
@@ -0,0 +1,24 @@
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 { ENDPOINT_PATHS } from '../constants';
13
+ import instance, { httpClient } from './axios';
14
+ var uploadFileInfo = function (data, config) {
15
+ return httpClient(__assign({ method: 'post', url: "".concat(ENDPOINT_PATHS.FILES_PATH), data: data, headers: { 'Content-Type': 'multipart/form-data' } }, config));
16
+ };
17
+ var uploadFile = function (data, config) {
18
+ return instance.post("".concat(ENDPOINT_PATHS.FILES_PATH), data, __assign({ headers: { 'Content-Type': 'multipart/form-data' } }, config));
19
+ };
20
+ var fileService = {
21
+ uploadFile: uploadFile,
22
+ uploadFileInfo: uploadFileInfo
23
+ };
24
+ export { fileService };
@@ -3,11 +3,12 @@ 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, UploadFileBody, UpdateEntityBody, DocumentUpdateBody, DocumentInfo, UpdateEntityActivityBody, UpdateEntityCapitalBody } from './entity';
6
+ import { EntityInfoBody, EntityBankUpdateBody, UpdateEntityBody, DocumentUpdateBody, DocumentInfo, UpdateEntityActivityBody, UpdateEntityCapitalBody } from './entity';
7
7
  import { CreateAccountBody } from './account';
8
8
  import { DataElementBody } from './data';
9
9
  import { BrandListBody, UpdateBrandBody, UpdateIndividualBody } from './individual';
10
10
  import { UpdateBoardBody } from './board';
11
+ import { UploadFileBody } from './file';
11
12
  declare const API: {
12
13
  locationService: {
13
14
  getIP: () => Promise<any>;
@@ -48,7 +49,6 @@ declare const API: {
48
49
  retrieveBankAccount: (id: string) => Promise<any>;
49
50
  retrieveEntityInfo: (entity_id: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
50
51
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
51
- uploadFileInfo: (data: UploadFileBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<any>;
52
52
  updateDocumentInfo: (data: DocumentUpdateBody) => Promise<any>;
53
53
  retrieveEntity: (entity_id: string) => Promise<any>;
54
54
  updateEntity: ({ id, ...data }: UpdateEntityBody) => Promise<any>;
@@ -121,6 +121,10 @@ declare const API: {
121
121
  updateBrandSales: ({ id, ...data }: import("./individual").UpdateSalesChannels) => void;
122
122
  getBrandListByIndividualId: (id: string) => Promise<any>;
123
123
  };
124
+ fileService: {
125
+ uploadFile: (data: UploadFileBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
126
+ uploadFileInfo: (data: UploadFileBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<any>;
127
+ };
124
128
  };
125
129
  export type { ValidateOperatorBody, CreateAuthBody, 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 };
126
130
  export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
@@ -13,6 +13,7 @@ import { individualService } from './individual';
13
13
  import { boardService } from './board';
14
14
  import { userService } from './user';
15
15
  import { brandService } from './brand';
16
+ import { fileService } from './file';
16
17
  var API = {
17
18
  locationService: locationService,
18
19
  operatorService: operatorService,
@@ -27,7 +28,8 @@ var API = {
27
28
  individualService: individualService,
28
29
  boardService: boardService,
29
30
  userService: userService,
30
- brandService: brandService
31
+ brandService: brandService,
32
+ fileService: fileService
31
33
  };
32
34
  export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
33
35
  export default API;
@@ -141,6 +141,7 @@
141
141
  "file_not_supported_alert": "نوع الملف غير مدعوم",
142
142
  "file_size_alert": "حجم الملف اكبر من المطلوب",
143
143
  "file_upload_error": "هناك مشكلة في رفع الملف, يرجى المحاولة لاحقاً.",
144
+ "file_upload_article_error": "هناك مشكلة في رفع الملف, يرجى المحاولة لاحقاً.",
144
145
  "file_upload_failed": "أنت تواجه بعض التحديات في تحميل الملف. يرجى المحاولة مرة أخرى.",
145
146
  "file_uploading_title": "جاري الرفع.....",
146
147
  "fl_kw_max_length": "May you please verify the entered freelancer registration reference. (Note - the freelancer registration may contains characters and digits).",
@@ -333,6 +334,8 @@
333
334
  "paci_verification_redirection_message": "You will be redirected now",
334
335
  "commercial_reg_hint": "Commercial Registration",
335
336
  "homemaker_reg_hint": "Home Business",
337
+ "file_already_exist": "File is already uploaded",
338
+ "file_exceed_max_limit": "You can able to upload maximum {{length}} files",
336
339
  "unified_number_label": "Unified Number",
337
340
  "unified_number_hint": "00000",
338
341
  "business_expiry_date": "Expiry Date",
@@ -352,5 +355,6 @@
352
355
  "capital_paid_required": "Please Enter paid amount",
353
356
  "capital_share_count_required": "Please Enter share count",
354
357
  "capital_share_value_required": "Please Enter share value",
355
- "unified_number_required": "Unified Number Required"
358
+ "unified_number_required": "Unified Number Required",
359
+ "uploaded_file": "file"
356
360
  }
@@ -148,6 +148,7 @@
148
148
  "file_not_supported_alert": "File not supported, please try again",
149
149
  "file_size_alert": "Your file is too big, please upload another",
150
150
  "file_upload_error": "Something went wrong, please try again",
151
+ "file_upload_article_error": "Something went wrong, please try again",
151
152
  "file_upload_failed": "You are experiencing some challenges uploading the file. Please give it another try.",
152
153
  "file_uploading_title": "Uploading....",
153
154
  "fl_kw_max_length": "May you please verify the entered freelancer registration reference. (Note - the freelancer registration may contains characters and digits).",
@@ -360,6 +361,8 @@
360
361
  "paci_verification_redirection_message": "You will be redirected now",
361
362
  "commercial_reg_hint": "Commercial Registration",
362
363
  "homemaker_reg_hint": "Home Business",
364
+ "file_already_exist": "file is already uploaded",
365
+ "file_exceed_max_limit": "You can able to upload maximum {{length}} files",
363
366
  "unified_number_label": "Unified Number",
364
367
  "unified_number_hint": "00000",
365
368
  "business_expiry_date": "Expiry Date",
@@ -379,5 +382,6 @@
379
382
  "capital_paid_required": "Please Enter paid amount",
380
383
  "capital_share_count_required": "Please Enter share count",
381
384
  "capital_share_value_required": "Please Enter share value",
382
- "unified_number_required": "Unified Number Required"
385
+ "unified_number_required": "Unified Number Required",
386
+ "uploaded_file": "file"
383
387
  }
@@ -99,7 +99,7 @@ var TextDoneStyled = styled(Text)(function (_a) {
99
99
  });
100
100
  var WarningContainer = styled(Box)(function (_a) {
101
101
  var theme = _a.theme;
102
- return (__assign({ background: theme.palette.warning.dark, paddingBlock: theme.spacing(1.5), paddingInlineStart: theme.spacing(2.5), border: '0.5px solid', display: 'flex', justifyContent: 'space-around', borderColor: theme.palette.warning.main, color: theme.palette.warning.light, padding: theme.spacing(0.5, 1), borderRadius: theme.spacing(12.5) }, theme.typography.caption));
102
+ return (__assign({ background: theme.palette.warning.dark, paddingBlock: theme.spacing(1.5), paddingInlineStart: theme.spacing(2.5), border: '0.5px solid', display: 'flex', justifyContent: 'space-around', borderColor: theme.palette.warning.main, color: theme.palette.warning.light, padding: theme.spacing(0.5, 1), borderRadius: theme.spacing(12.5), alignItems: 'center' }, theme.typography.caption));
103
103
  });
104
104
  var DragAndDrop = function (_a) {
105
105
  var title = _a.title, subTitle = _a.subTitle, description = _a.description, error = _a.error, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, progress = _a.progress, uploading = _a.uploading, fileExists = _a.fileExists, uploadSuccess = _a.uploadSuccess, onSuccess = _a.onSuccess, multiple = _a.multiple;
@@ -1,10 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { CircularProgressProps } from '@mui/material/CircularProgress';
3
+ import { SxProps, Theme } from '@mui/material/styles';
3
4
  export interface CircularProps extends CircularProgressProps {
4
5
  size: number;
5
6
  value: number;
7
+ textSx?: SxProps<Theme>;
6
8
  }
7
- declare function CircularProgressWithLabel({ size, value, ...props }: CircularProps): JSX.Element;
9
+ declare function CircularProgressWithLabel({ size, value, textSx, ...props }: CircularProps): JSX.Element;
8
10
  declare namespace CircularProgressWithLabel {
9
11
  var defaultProps: {
10
12
  size: number;
@@ -39,8 +39,8 @@ var BoxStyled = styled(Box)(function (_a) {
39
39
  });
40
40
  });
41
41
  export default function CircularProgressWithLabel(_a) {
42
- var size = _a.size, value = _a.value, props = __rest(_a, ["size", "value"]);
43
- return (_jsxs(Box, __assign({ sx: { position: 'relative', display: 'inline-flex' } }, { children: [_jsx(CircularProgress, __assign({ variant: 'determinate', size: size, value: value }, props)), _jsx(BoxStyled, { children: _jsx(Typography, __assign({ variant: 'caption', component: 'div', color: 'text.primary' }, { children: "".concat(Math.round(value), "%") })) })] })));
42
+ var size = _a.size, value = _a.value, textSx = _a.textSx, props = __rest(_a, ["size", "value", "textSx"]);
43
+ return (_jsxs(Box, __assign({ sx: { position: 'relative', display: 'inline-flex' } }, { children: [_jsx(CircularProgress, __assign({ variant: 'determinate', size: size, value: value }, props)), _jsx(BoxStyled, { children: _jsx(Typography, __assign({ variant: 'caption', sx: textSx, component: 'div', color: 'text.primary' }, { children: "".concat(Math.round(value), "%") })) })] })));
44
44
  }
45
45
  CircularProgressWithLabel.defaultProps = {
46
46
  size: 54,
@@ -54,6 +54,7 @@ export declare const ICONS_NAMES: {
54
54
  UPLOAD_ICON: string;
55
55
  ACTIVE_UPLOAD_ICON: string;
56
56
  WARNING_ICON: string;
57
+ ERROR_ICON: string;
57
58
  DONE_ICON: string;
58
59
  DOC_ICON: string;
59
60
  DROP_FILE_ICON: string;
@@ -54,6 +54,7 @@ export var ICONS_NAMES = {
54
54
  UPLOAD_ICON: 'https://dash.b-cdn.net/icons/menu/upload-file.svg',
55
55
  ACTIVE_UPLOAD_ICON: 'https://dash.b-cdn.net/icons/menu/active-upload-icon.png',
56
56
  WARNING_ICON: 'https://dash.b-cdn.net/icons/menu/warning-icon.svg',
57
+ ERROR_ICON: 'https://dash.b-cdn.net/icons/menu/upload_error_icon.svg',
57
58
  DONE_ICON: 'https://dash.b-cdn.net/icons/menu/done.svg',
58
59
  DOC_ICON: 'https://dash.b-cdn.net/icons/menu/document-icon.svg',
59
60
  DROP_FILE_ICON: 'https://dash.b-cdn.net/icons/menu/upload-file-sample.svg',
@@ -12,6 +12,7 @@ export declare const KW_MIN_LICENSE_LENGTH = 3;
12
12
  export declare const KW_MAX_LICENSE_LENGTH = 50;
13
13
  export declare const SAUDI_NUMBER_LENGTH = 9;
14
14
  export declare const MAX_FILE_SIZE = 5000000;
15
+ export declare const MAX_FILE_SIZE_FOUR_MB = 4000000;
15
16
  export declare const VALID_FILE_FORMATS: string[];
16
17
  export declare const REGEX_FULL_NAME: RegExp;
17
18
  export declare const REGEX_WEBSITE: RegExp;
@@ -12,6 +12,7 @@ export var KW_MIN_LICENSE_LENGTH = 3;
12
12
  export var KW_MAX_LICENSE_LENGTH = 50;
13
13
  export var SAUDI_NUMBER_LENGTH = 9;
14
14
  export var MAX_FILE_SIZE = 5000000;
15
+ export var MAX_FILE_SIZE_FOUR_MB = 4000000;
15
16
  export var VALID_FILE_FORMATS = ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf'];
16
17
  export var REGEX_FULL_NAME = /^([a-zA-Z]{2,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,})$/g;
17
18
  export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
@@ -243,7 +243,7 @@ export var uploadBankStatement = createAsyncThunk('uploadBankStatement', functio
243
243
  var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
244
244
  onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
245
245
  };
246
- return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
246
+ return [4, API.fileService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
247
247
  case 1:
248
248
  data = _b.sent();
249
249
  return [2, { data: data }];
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, CivilFormValues } from '../../../@types';
2
+ import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, CivilFormValues, ActionState } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  leadData: any;
@@ -59,14 +59,11 @@ export declare const updateLeadBusinessType: import("@reduxjs/toolkit").AsyncThu
59
59
  documentData: any;
60
60
  entityData: any;
61
61
  }, BusinessTypeFormValues, {}>;
62
- interface UploadLicenseCertificateParams {
62
+ interface UploadArticleParams {
63
63
  file: File;
64
64
  onProgress?: (value: number) => void;
65
- }
66
- export declare const uploadLicenseCertificate: import("@reduxjs/toolkit").AsyncThunk<{
67
- data: any;
68
- }, UploadLicenseCertificateParams, {}>;
69
- interface UploadArticleParams extends UploadLicenseCertificateParams {
65
+ onSuccess?: (fileId: string) => void;
66
+ onFailure?: (error: string) => void;
70
67
  }
71
68
  export declare const uploadArticle: import("@reduxjs/toolkit").AsyncThunk<{
72
69
  data: any;
@@ -116,15 +113,16 @@ export interface BusinessState extends SharedState<BusinessData> {
116
113
  customLoading?: boolean;
117
114
  uploading?: boolean;
118
115
  uploadingArticle?: boolean;
116
+ uploadingArticleError?: string | null;
119
117
  }
120
118
  export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessState, {
121
119
  clearError: (state: BusinessState) => void;
122
120
  stopLoader: (state: BusinessState) => void;
123
121
  resetOTPScreen: (state: BusinessState) => void;
124
- clearCertificateId: (state: BusinessState) => void;
125
122
  clearArticleId: (state: BusinessState) => void;
123
+ uploadingStatus: (state: BusinessState, action: ActionState<boolean>) => void;
126
124
  }, "business/store">;
127
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, clearCertificateId: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, clearArticleId: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
125
+ 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>;
128
126
  declare const _default: import("redux").Reducer<BusinessState, import("redux").AnyAction>;
129
127
  export default _default;
130
128
  export declare const businessSelector: (state: RootState) => BusinessState;
@@ -441,36 +441,36 @@ 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, _b, articleId, certificateId, documentBody, payload_1;
445
- var _c, _d, _e, _f, _g, _h;
446
- return __generator(this, function (_j) {
447
- switch (_j.label) {
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) {
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 = ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL;
451
+ isFL = ((_b = params.selectedLicense) === null || _b === void 0 ? void 0 : _b.type) === BusinessType.FL;
452
452
  payload = {
453
- id: ((_d = business.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id) || '',
453
+ id: ((_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id) || '',
454
454
  license_number: isNonSA && isFL ? '' : params.licenseNumber,
455
455
  license_type: isFL ? 'freelance' : 'commercial_registration',
456
- business_type: (_e = params.selectedLicense) === null || _e === void 0 ? void 0 : _e.type,
456
+ business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
457
457
  step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO,
458
458
  business: isNonSA && isFL ? undefined : { ar: params.entityLegalName, en: params.entityLegalName },
459
459
  encryption_contract: ['license_number', 'business_type', 'license_type']
460
460
  };
461
461
  return [4, API.leadService.updateLead(payload)];
462
462
  case 1:
463
- data = _j.sent();
463
+ data = _h.sent();
464
464
  entity_activities = data.entity_activities;
465
465
  if (!!entity_activities) return [3, 3];
466
466
  return [4, API.dataService.getActivities()];
467
467
  case 2:
468
- list = (_j.sent()).list;
468
+ list = (_h.sent()).list;
469
469
  data.entity_activities = list;
470
- _j.label = 3;
470
+ _h.label = 3;
471
471
  case 3:
472
472
  accountBody = {
473
- lead_id: (_f = business.data.verify.responseBody) === null || _f === void 0 ? void 0 : _f.lead_id,
473
+ lead_id: (_e = business.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.lead_id,
474
474
  notify: {
475
475
  email: false,
476
476
  phone: false
@@ -481,23 +481,23 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
481
481
  };
482
482
  return [4, API.accountService.createAccount(accountBody)];
483
483
  case 4:
484
- accountData = _j.sent();
484
+ accountData = _h.sent();
485
485
  entityData = undefined;
486
486
  entityId = accountData === null || accountData === void 0 ? void 0 : accountData.entity_id;
487
- _b = business.data.businessTypeData, articleId = _b.articleId, certificateId = _b.certificateId;
488
- if (!certificateId) return [3, 6];
487
+ articleId = business.data.businessTypeData.articleId;
488
+ if (!((params.certificateId || []).length > 0)) return [3, 6];
489
489
  documentBody = {
490
490
  entity_id: entityId || '',
491
491
  documents: [
492
492
  {
493
- images: [certificateId]
493
+ images: params.certificateId
494
494
  }
495
495
  ]
496
496
  };
497
497
  return [4, API.entityService.updateDocumentInfo(documentBody)];
498
498
  case 5:
499
- documentData = _j.sent();
500
- _j.label = 6;
499
+ documentData = _h.sent();
500
+ _h.label = 6;
501
501
  case 6:
502
502
  if (!(articleId && entityId)) return [3, 8];
503
503
  payload_1 = {
@@ -506,40 +506,15 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
506
506
  };
507
507
  return [4, API.entityService.updateEntity(payload_1)];
508
508
  case 7:
509
- entityData = _j.sent();
510
- _j.label = 8;
509
+ entityData = _h.sent();
510
+ _h.label = 8;
511
511
  case 8:
512
512
  thunkApi.dispatch(handleNextScreenStep());
513
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, params);
513
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
514
514
  return [2, { data: data, formData: params, accountData: accountData, documentData: documentData, entityData: entityData }];
515
515
  }
516
516
  });
517
517
  }); });
518
- export var uploadLicenseCertificate = createAsyncThunk('uploadLicenseCertificate', function (_a) {
519
- var file = _a.file, onProgress = _a.onProgress;
520
- return __awaiter(void 0, void 0, void 0, function () {
521
- var uploadPayload, onUploadProgress, data;
522
- return __generator(this, function (_b) {
523
- switch (_b.label) {
524
- case 0:
525
- uploadPayload = {
526
- file_link_create: true,
527
- title: file === null || file === void 0 ? void 0 : file.name,
528
- purpose: 'commercial_registration',
529
- file: file
530
- };
531
- onUploadProgress = function (progressEvent) {
532
- var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
533
- onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
534
- };
535
- return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
536
- case 1:
537
- data = _b.sent();
538
- return [2, { data: data }];
539
- }
540
- });
541
- });
542
- });
543
518
  export var uploadArticle = createAsyncThunk('businessUploadArticle', function (_a) {
544
519
  var file = _a.file, onProgress = _a.onProgress;
545
520
  return __awaiter(void 0, void 0, void 0, function () {
@@ -561,7 +536,7 @@ export var uploadArticle = createAsyncThunk('businessUploadArticle', function (_
561
536
  var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
562
537
  onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
563
538
  };
564
- return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
539
+ return [4, API.fileService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
565
540
  case 1:
566
541
  data = _c.sent();
567
542
  return [2, { data: data }];
@@ -732,6 +707,7 @@ var initialState = {
732
707
  customLoading: false,
733
708
  uploading: false,
734
709
  uploadingArticle: false,
710
+ uploadingArticleError: null,
735
711
  data: {
736
712
  flowName: FlowsTypes.BUSINESS,
737
713
  verify: {
@@ -779,11 +755,11 @@ export var businessSlice = createSlice({
779
755
  resetOTPScreen: function (state) {
780
756
  state.data.otpData.otp = '';
781
757
  },
782
- clearCertificateId: function (state) {
783
- state.data.businessTypeData.certificateId = '';
784
- },
785
758
  clearArticleId: function (state) {
786
759
  state.data.businessTypeData.articleId = '';
760
+ },
761
+ uploadingStatus: function (state, action) {
762
+ state.uploading = action.payload;
787
763
  }
788
764
  },
789
765
  extraReducers: function (builder) {
@@ -1064,34 +1040,20 @@ export var businessSlice = createSlice({
1064
1040
  .addCase(updateLeadBusinessType.rejected, function (state, action) {
1065
1041
  state.loading = false;
1066
1042
  state.error = action.error.message;
1067
- })
1068
- .addCase(uploadLicenseCertificate.pending, function (state) {
1069
- state.error = null;
1070
- state.uploading = true;
1071
- })
1072
- .addCase(uploadLicenseCertificate.fulfilled, function (state, action) {
1073
- state.error = null;
1074
- state.uploading = false;
1075
- var data = action.payload.data;
1076
- state.data.businessTypeData.certificateId = data === null || data === void 0 ? void 0 : data.id;
1077
- })
1078
- .addCase(uploadLicenseCertificate.rejected, function (state) {
1079
- state.uploading = false;
1080
- state.error = 'file_upload_error';
1081
1043
  })
1082
1044
  .addCase(uploadArticle.pending, function (state) {
1083
- state.error = null;
1045
+ state.uploadingArticleError = null;
1084
1046
  state.uploadingArticle = true;
1085
1047
  })
1086
1048
  .addCase(uploadArticle.fulfilled, function (state, action) {
1087
- state.error = null;
1049
+ state.uploadingArticleError = null;
1088
1050
  state.uploadingArticle = false;
1089
1051
  var data = action.payload.data;
1090
1052
  state.data.businessTypeData.articleId = data === null || data === void 0 ? void 0 : data.id;
1091
1053
  })
1092
1054
  .addCase(uploadArticle.rejected, function (state) {
1093
1055
  state.uploadingArticle = false;
1094
- state.error = 'file_upload_error';
1056
+ state.uploadingArticleError = 'file_upload_article_error';
1095
1057
  })
1096
1058
  .addCase(updateActivitiesInfo.pending, function (state) {
1097
1059
  state.loading = true;
@@ -1175,6 +1137,6 @@ export var businessSlice = createSlice({
1175
1137
  });
1176
1138
  }
1177
1139
  });
1178
- export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, clearCertificateId = _a.clearCertificateId, clearArticleId = _a.clearArticleId;
1140
+ export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, clearArticleId = _a.clearArticleId, uploadingStatus = _a.uploadingStatus;
1179
1141
  export default businessSlice.reducer;
1180
1142
  export var businessSelector = function (state) { return state.business; };
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { CountryCode, FlowsTypes, IndividualAttachmentsFormValues, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  boardResponse: {
@@ -53,19 +53,6 @@ export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk
53
53
  data: any;
54
54
  formData: IndividualExtraFormValues;
55
55
  }, IndividualExtraFormValues, {}>;
56
- interface UploadFileParams {
57
- file: File;
58
- onProgress?: (value: number) => void;
59
- title?: string;
60
- }
61
- export declare const uploadCivilIdFile: import("@reduxjs/toolkit").AsyncThunk<{
62
- data: any;
63
- file: File;
64
- }, UploadFileParams, {}>;
65
- export declare const uploadSignatureFile: import("@reduxjs/toolkit").AsyncThunk<{
66
- data: any;
67
- file: File;
68
- }, UploadFileParams, {}>;
69
56
  export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
70
57
  response: any;
71
58
  formData: void;
@@ -77,7 +64,6 @@ export interface IndividualData {
77
64
  verify: ResponseData & VerifyData;
78
65
  otpData: OTPFormValues & ResponseData;
79
66
  individualData: IndividualExtraFormValues & ResponseData;
80
- attachmentsData: IndividualAttachmentsFormValues & ResponseData;
81
67
  flowName: FlowsTypes;
82
68
  }
83
69
  export interface IndividualState extends SharedState<IndividualData> {
@@ -87,8 +73,10 @@ export declare const individualSlice: import("@reduxjs/toolkit").Slice<Individua
87
73
  clearError: (state: IndividualState) => void;
88
74
  stopLoader: (state: IndividualState) => void;
89
75
  resetOTPScreen: (state: IndividualState) => void;
76
+ civilIDUploadingStatus: (state: IndividualState, action: ActionState<boolean>) => void;
77
+ signatureFileUploadingStatus: (state: IndividualState, action: ActionState<boolean>) => void;
90
78
  }, "individual/store">;
91
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
79
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, civilIDUploadingStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, signatureFileUploadingStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
92
80
  declare const _default: import("redux").Reducer<IndividualState, import("redux").AnyAction>;
93
81
  export default _default;
94
82
  export declare const individualSelector: (state: RootState) => IndividualState;