@tap-payments/auth-jsconnect 2.1.41-test → 2.1.42-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 (52) hide show
  1. package/build/@types/app.d.ts +0 -4
  2. package/build/@types/form.d.ts +6 -3
  3. package/build/api/entity.d.ts +8 -0
  4. package/build/api/entity.js +15 -0
  5. package/build/api/index.d.ts +2 -6
  6. package/build/api/index.js +1 -3
  7. package/build/api/lead.d.ts +0 -4
  8. package/build/assets/locales/ar.json +1 -5
  9. package/build/assets/locales/en.json +1 -7
  10. package/build/components/FileInput/DragAndDrop.js +1 -1
  11. package/build/components/ProgressBar/CircularProgressBar.d.ts +1 -3
  12. package/build/components/ProgressBar/CircularProgressBar.js +2 -2
  13. package/build/constants/assets.d.ts +0 -1
  14. package/build/constants/assets.js +0 -1
  15. package/build/constants/validation.d.ts +0 -1
  16. package/build/constants/validation.js +0 -1
  17. package/build/features/app/bank/bankStore.js +1 -1
  18. package/build/features/app/business/businessStore.d.ts +9 -7
  19. package/build/features/app/business/businessStore.js +67 -29
  20. package/build/features/app/connect/connectStore.d.ts +1 -1
  21. package/build/features/app/connect/connectStore.js +29 -66
  22. package/build/features/app/individual/individualStore.d.ts +16 -4
  23. package/build/features/app/individual/individualStore.js +89 -11
  24. package/build/features/business/screens/BusinessType/Article.js +13 -10
  25. package/build/features/business/screens/BusinessType/BusinessType.js +4 -2
  26. package/build/features/business/screens/BusinessType/LicenseCertificate.js +50 -12
  27. package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
  28. package/build/features/business/screens/BusinessType/validation.js +11 -1
  29. package/build/features/connect/screens/Merchant/BrandList.js +2 -15
  30. package/build/features/connect/screens/Merchant/Merchant.js +5 -24
  31. package/build/features/connect/screens/Merchant/validation.d.ts +0 -6
  32. package/build/features/connect/screens/Merchant/validation.js +1 -5
  33. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -18
  34. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +62 -11
  35. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +59 -11
  36. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +12 -6
  37. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +23 -2
  38. package/build/features/shared/UploadFile/UploadFile.js +1 -1
  39. package/build/theme/typography.js +1 -1
  40. package/package.json +1 -1
  41. package/build/api/file.d.ts +0 -13
  42. package/build/api/file.js +0 -24
  43. package/build/features/connect/screens/Merchant/Segments.d.ts +0 -8
  44. package/build/features/connect/screens/Merchant/Segments.js +0 -79
  45. package/build/features/connect/screens/Merchant/TeamSize.d.ts +0 -8
  46. package/build/features/connect/screens/Merchant/TeamSize.js +0 -79
  47. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +0 -38
  48. package/build/features/shared/UploadMultipleFile/UploadFile.js +0 -184
  49. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +0 -27
  50. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +0 -147
  51. package/build/features/shared/UploadMultipleFile/index.d.ts +0 -2
  52. package/build/features/shared/UploadMultipleFile/index.js +0 -2
@@ -225,10 +225,6 @@ export interface LocalProps {
225
225
  };
226
226
  }
227
227
  export declare type BrandInfo = {
228
- segment?: {
229
- type: string;
230
- team: string;
231
- };
232
228
  id: string;
233
229
  name: {
234
230
  ar: string;
@@ -51,7 +51,8 @@ export declare type BusinessTypeFormValues = {
51
51
  licenseNumber: string;
52
52
  entityLegalName?: string;
53
53
  selectedLicense?: License;
54
- certificateId?: Array<string>;
54
+ certificateId?: string;
55
+ certificateFile?: File;
55
56
  articleId?: string;
56
57
  articleFile?: File;
57
58
  };
@@ -89,8 +90,10 @@ export interface IndividualExtraFormValues extends IndividualAttachmentsFormValu
89
90
  isInfluencer: boolean | null;
90
91
  }
91
92
  export declare type IndividualAttachmentsFormValues = {
92
- civilID?: Array<string>;
93
- signatureFileId?: Array<string>;
93
+ civilID?: string;
94
+ civilIDFile?: File;
95
+ signatureFileId?: string;
96
+ signatureFile?: File;
94
97
  civilIDUploading?: boolean;
95
98
  signatureFileUploading?: boolean;
96
99
  };
@@ -47,6 +47,13 @@ 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
+ };
50
57
  export declare type UpdateEntityBody = {
51
58
  id: string;
52
59
  license?: {
@@ -114,6 +121,7 @@ declare const entityService: {
114
121
  retrieveBankAccount: (id: string) => Promise<any>;
115
122
  retrieveEntityInfo: (entity_id: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
116
123
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
124
+ uploadFileInfo: (data: UploadFileBody, config?: AxiosRequestConfig) => Promise<any>;
117
125
  updateDocumentInfo: (data: DocumentUpdateBody) => Promise<any>;
118
126
  retrieveEntity: (entity_id: string) => Promise<any>;
119
127
  updateEntity: ({ id, ...data }: UpdateEntityBody) => Promise<any>;
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  var __rest = (this && this.__rest) || function (s, e) {
2
13
  var t = {};
3
14
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -61,6 +72,9 @@ var retrieveBankAccount = function (id) {
61
72
  url: "".concat(ENDPOINT_PATHS.BANK, "/").concat(id)
62
73
  });
63
74
  };
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
+ };
64
78
  var updateIndividualInfo = function (_a) {
65
79
  var id = _a.id, data = __rest(_a, ["id"]);
66
80
  return httpClient({
@@ -89,6 +103,7 @@ var entityService = {
89
103
  retrieveBankAccount: retrieveBankAccount,
90
104
  retrieveEntityInfo: retrieveEntityInfo,
91
105
  updateIndividualInfo: updateIndividualInfo,
106
+ uploadFileInfo: uploadFileInfo,
92
107
  updateDocumentInfo: updateDocumentInfo,
93
108
  retrieveEntity: retrieveEntity,
94
109
  updateEntity: updateEntity,
@@ -3,12 +3,11 @@ 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, UploadFileBody, 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';
12
11
  declare const API: {
13
12
  locationService: {
14
13
  getIP: () => Promise<any>;
@@ -49,6 +48,7 @@ declare const API: {
49
48
  retrieveBankAccount: (id: string) => Promise<any>;
50
49
  retrieveEntityInfo: (entity_id: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
51
50
  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,10 +121,6 @@ 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
- };
128
124
  };
129
125
  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 };
130
126
  export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
@@ -13,7 +13,6 @@ 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';
17
16
  var API = {
18
17
  locationService: locationService,
19
18
  operatorService: operatorService,
@@ -28,8 +27,7 @@ var API = {
28
27
  individualService: individualService,
29
28
  boardService: boardService,
30
29
  userService: userService,
31
- brandService: brandService,
32
- fileService: fileService
30
+ brandService: brandService
33
31
  };
34
32
  export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
35
33
  export default API;
@@ -59,10 +59,6 @@ export declare type UpdateLeadBody = {
59
59
  is_acknowledged?: boolean;
60
60
  terms_conditions_accepted?: boolean;
61
61
  lang?: LanguageMode;
62
- segment?: {
63
- type: string;
64
- team: string;
65
- };
66
62
  };
67
63
  export declare type LeadVerifyBody = {
68
64
  verify_token: string;
@@ -141,7 +141,6 @@
141
141
  "file_not_supported_alert": "نوع الملف غير مدعوم",
142
142
  "file_size_alert": "حجم الملف اكبر من المطلوب",
143
143
  "file_upload_error": "هناك مشكلة في رفع الملف, يرجى المحاولة لاحقاً.",
144
- "file_upload_article_error": "هناك مشكلة في رفع الملف, يرجى المحاولة لاحقاً.",
145
144
  "file_upload_failed": "أنت تواجه بعض التحديات في تحميل الملف. يرجى المحاولة مرة أخرى.",
146
145
  "file_uploading_title": "جاري الرفع.....",
147
146
  "fl_kw_max_length": "May you please verify the entered freelancer registration reference. (Note - the freelancer registration may contains characters and digits).",
@@ -334,8 +333,6 @@
334
333
  "paci_verification_redirection_message": "You will be redirected now",
335
334
  "commercial_reg_hint": "Commercial Registration",
336
335
  "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",
339
336
  "unified_number_label": "Unified Number",
340
337
  "unified_number_hint": "00000",
341
338
  "business_expiry_date": "Expiry Date",
@@ -355,6 +352,5 @@
355
352
  "capital_paid_required": "Please Enter paid amount",
356
353
  "capital_share_count_required": "Please Enter share count",
357
354
  "capital_share_value_required": "Please Enter share value",
358
- "unified_number_required": "Unified Number Required",
359
- "uploaded_file": "file"
355
+ "unified_number_required": "Unified Number Required"
360
356
  }
@@ -74,8 +74,6 @@
74
74
  "choose_any_source_of_income": "- Please select -",
75
75
  "choose_atleast_one_activity": "- Please select -",
76
76
  "choose_atleast_one_channel": "Please select at least a channel.",
77
- "alert_choose_segment": "Please select business segment.",
78
- "alert_choose_teamSize": "Please select team size.",
79
77
  "choose_brand": "Please select a brand",
80
78
  "choose_channel": "- Please select -",
81
79
  "choose_customer_base": "- Please select -",
@@ -150,7 +148,6 @@
150
148
  "file_not_supported_alert": "File not supported, please try again",
151
149
  "file_size_alert": "Your file is too big, please upload another",
152
150
  "file_upload_error": "Something went wrong, please try again",
153
- "file_upload_article_error": "Something went wrong, please try again",
154
151
  "file_upload_failed": "You are experiencing some challenges uploading the file. Please give it another try.",
155
152
  "file_uploading_title": "Uploading....",
156
153
  "fl_kw_max_length": "May you please verify the entered freelancer registration reference. (Note - the freelancer registration may contains characters and digits).",
@@ -363,8 +360,6 @@
363
360
  "paci_verification_redirection_message": "You will be redirected now",
364
361
  "commercial_reg_hint": "Commercial Registration",
365
362
  "homemaker_reg_hint": "Home Business",
366
- "file_already_exist": "file is already uploaded",
367
- "file_exceed_max_limit": "You can able to upload maximum {{length}} files",
368
363
  "unified_number_label": "Unified Number",
369
364
  "unified_number_hint": "00000",
370
365
  "business_expiry_date": "Expiry Date",
@@ -384,6 +379,5 @@
384
379
  "capital_paid_required": "Please Enter paid amount",
385
380
  "capital_share_count_required": "Please Enter share count",
386
381
  "capital_share_value_required": "Please Enter share value",
387
- "unified_number_required": "Unified Number Required",
388
- "uploaded_file": "file"
382
+ "unified_number_required": "Unified Number Required"
389
383
  }
@@ -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), alignItems: 'center' }, 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) }, 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,12 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { CircularProgressProps } from '@mui/material/CircularProgress';
3
- import { SxProps, Theme } from '@mui/material/styles';
4
3
  export interface CircularProps extends CircularProgressProps {
5
4
  size: number;
6
5
  value: number;
7
- textSx?: SxProps<Theme>;
8
6
  }
9
- declare function CircularProgressWithLabel({ size, value, textSx, ...props }: CircularProps): JSX.Element;
7
+ declare function CircularProgressWithLabel({ size, value, ...props }: CircularProps): JSX.Element;
10
8
  declare namespace CircularProgressWithLabel {
11
9
  var defaultProps: {
12
10
  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, 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), "%") })) })] })));
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), "%") })) })] })));
44
44
  }
45
45
  CircularProgressWithLabel.defaultProps = {
46
46
  size: 54,
@@ -54,7 +54,6 @@ 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;
58
57
  DONE_ICON: string;
59
58
  DOC_ICON: string;
60
59
  DROP_FILE_ICON: string;
@@ -54,7 +54,6 @@ 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',
58
57
  DONE_ICON: 'https://dash.b-cdn.net/icons/menu/done.svg',
59
58
  DOC_ICON: 'https://dash.b-cdn.net/icons/menu/document-icon.svg',
60
59
  DROP_FILE_ICON: 'https://dash.b-cdn.net/icons/menu/upload-file-sample.svg',
@@ -12,7 +12,6 @@ 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;
16
15
  export declare const VALID_FILE_FORMATS: string[];
17
16
  export declare const REGEX_FULL_NAME: RegExp;
18
17
  export declare const REGEX_WEBSITE: RegExp;
@@ -12,7 +12,6 @@ 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;
16
15
  export var VALID_FILE_FORMATS = ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf'];
17
16
  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;
18
17
  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.fileService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
246
+ return [4, API.entityService.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, ActionState } from '../../../@types';
2
+ import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, CivilFormValues } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  leadData: any;
@@ -59,11 +59,14 @@ export declare const updateLeadBusinessType: import("@reduxjs/toolkit").AsyncThu
59
59
  documentData: any;
60
60
  entityData: any;
61
61
  }, BusinessTypeFormValues, {}>;
62
- interface UploadArticleParams {
62
+ interface UploadLicenseCertificateParams {
63
63
  file: File;
64
64
  onProgress?: (value: number) => void;
65
- onSuccess?: (fileId: string) => void;
66
- onFailure?: (error: string) => void;
65
+ }
66
+ export declare const uploadLicenseCertificate: import("@reduxjs/toolkit").AsyncThunk<{
67
+ data: any;
68
+ }, UploadLicenseCertificateParams, {}>;
69
+ interface UploadArticleParams extends UploadLicenseCertificateParams {
67
70
  }
68
71
  export declare const uploadArticle: import("@reduxjs/toolkit").AsyncThunk<{
69
72
  data: any;
@@ -113,16 +116,15 @@ export interface BusinessState extends SharedState<BusinessData> {
113
116
  customLoading?: boolean;
114
117
  uploading?: boolean;
115
118
  uploadingArticle?: boolean;
116
- uploadingArticleError?: string | null;
117
119
  }
118
120
  export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessState, {
119
121
  clearError: (state: BusinessState) => void;
120
122
  stopLoader: (state: BusinessState) => void;
121
123
  resetOTPScreen: (state: BusinessState) => void;
124
+ clearCertificateId: (state: BusinessState) => void;
122
125
  clearArticleId: (state: BusinessState) => void;
123
- uploadingStatus: (state: BusinessState, action: ActionState<boolean>) => void;
124
126
  }, "business/store">;
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>;
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>;
126
128
  declare const _default: import("redux").Reducer<BusinessState, import("redux").AnyAction>;
127
129
  export default _default;
128
130
  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, articleId, documentBody, payload_1;
445
- var _b, _c, _d, _e, _f, _g;
446
- return __generator(this, function (_h) {
447
- switch (_h.label) {
444
+ var _a, settings, business, isNonSA, 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) {
448
448
  case 0:
449
449
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
450
450
  isNonSA = !isSA(settings.data.businessCountry.iso2);
451
- isFL = ((_b = params.selectedLicense) === null || _b === void 0 ? void 0 : _b.type) === BusinessType.FL;
451
+ isFL = ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL;
452
452
  payload = {
453
- id: ((_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id) || '',
453
+ id: ((_d = business.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id) || '',
454
454
  license_number: isNonSA && isFL ? '' : params.licenseNumber,
455
455
  license_type: isFL ? 'freelance' : 'commercial_registration',
456
- business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
456
+ business_type: (_e = params.selectedLicense) === null || _e === void 0 ? void 0 : _e.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 = _h.sent();
463
+ data = _j.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 = (_h.sent()).list;
468
+ list = (_j.sent()).list;
469
469
  data.entity_activities = list;
470
- _h.label = 3;
470
+ _j.label = 3;
471
471
  case 3:
472
472
  accountBody = {
473
- lead_id: (_e = business.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.lead_id,
473
+ lead_id: (_f = business.data.verify.responseBody) === null || _f === void 0 ? void 0 : _f.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 = _h.sent();
484
+ accountData = _j.sent();
485
485
  entityData = undefined;
486
486
  entityId = accountData === null || accountData === void 0 ? void 0 : accountData.entity_id;
487
- articleId = business.data.businessTypeData.articleId;
488
- if (!((params.certificateId || []).length > 0)) return [3, 6];
487
+ _b = business.data.businessTypeData, articleId = _b.articleId, certificateId = _b.certificateId;
488
+ if (!certificateId) return [3, 6];
489
489
  documentBody = {
490
490
  entity_id: entityId || '',
491
491
  documents: [
492
492
  {
493
- images: params.certificateId
493
+ images: [certificateId]
494
494
  }
495
495
  ]
496
496
  };
497
497
  return [4, API.entityService.updateDocumentInfo(documentBody)];
498
498
  case 5:
499
- documentData = _h.sent();
500
- _h.label = 6;
499
+ documentData = _j.sent();
500
+ _j.label = 6;
501
501
  case 6:
502
502
  if (!(articleId && entityId)) return [3, 8];
503
503
  payload_1 = {
@@ -506,15 +506,40 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
506
506
  };
507
507
  return [4, API.entityService.updateEntity(payload_1)];
508
508
  case 7:
509
- entityData = _h.sent();
510
- _h.label = 8;
509
+ entityData = _j.sent();
510
+ _j.label = 8;
511
511
  case 8:
512
512
  thunkApi.dispatch(handleNextScreenStep());
513
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
513
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, 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
+ });
518
543
  export var uploadArticle = createAsyncThunk('businessUploadArticle', function (_a) {
519
544
  var file = _a.file, onProgress = _a.onProgress;
520
545
  return __awaiter(void 0, void 0, void 0, function () {
@@ -536,7 +561,7 @@ export var uploadArticle = createAsyncThunk('businessUploadArticle', function (_
536
561
  var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
537
562
  onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
538
563
  };
539
- return [4, API.fileService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
564
+ return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
540
565
  case 1:
541
566
  data = _c.sent();
542
567
  return [2, { data: data }];
@@ -707,7 +732,6 @@ var initialState = {
707
732
  customLoading: false,
708
733
  uploading: false,
709
734
  uploadingArticle: false,
710
- uploadingArticleError: null,
711
735
  data: {
712
736
  flowName: FlowsTypes.BUSINESS,
713
737
  verify: {
@@ -755,11 +779,11 @@ export var businessSlice = createSlice({
755
779
  resetOTPScreen: function (state) {
756
780
  state.data.otpData.otp = '';
757
781
  },
782
+ clearCertificateId: function (state) {
783
+ state.data.businessTypeData.certificateId = '';
784
+ },
758
785
  clearArticleId: function (state) {
759
786
  state.data.businessTypeData.articleId = '';
760
- },
761
- uploadingStatus: function (state, action) {
762
- state.uploading = action.payload;
763
787
  }
764
788
  },
765
789
  extraReducers: function (builder) {
@@ -1040,20 +1064,34 @@ export var businessSlice = createSlice({
1040
1064
  .addCase(updateLeadBusinessType.rejected, function (state, action) {
1041
1065
  state.loading = false;
1042
1066
  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';
1043
1081
  })
1044
1082
  .addCase(uploadArticle.pending, function (state) {
1045
- state.uploadingArticleError = null;
1083
+ state.error = null;
1046
1084
  state.uploadingArticle = true;
1047
1085
  })
1048
1086
  .addCase(uploadArticle.fulfilled, function (state, action) {
1049
- state.uploadingArticleError = null;
1087
+ state.error = null;
1050
1088
  state.uploadingArticle = false;
1051
1089
  var data = action.payload.data;
1052
1090
  state.data.businessTypeData.articleId = data === null || data === void 0 ? void 0 : data.id;
1053
1091
  })
1054
1092
  .addCase(uploadArticle.rejected, function (state) {
1055
1093
  state.uploadingArticle = false;
1056
- state.uploadingArticleError = 'file_upload_article_error';
1094
+ state.error = 'file_upload_error';
1057
1095
  })
1058
1096
  .addCase(updateActivitiesInfo.pending, function (state) {
1059
1097
  state.loading = true;
@@ -1137,6 +1175,6 @@ export var businessSlice = createSlice({
1137
1175
  });
1138
1176
  }
1139
1177
  });
1140
- export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, clearArticleId = _a.clearArticleId, uploadingStatus = _a.uploadingStatus;
1178
+ export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, clearCertificateId = _a.clearCertificateId, clearArticleId = _a.clearArticleId;
1141
1179
  export default businessSlice.reducer;
1142
1180
  export var businessSelector = function (state) { return state.business; };
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActionState, AuthForType, BrandFormValues, CivilFormValues, CountryCode, FlowsTypes, IndividualFormValues, MobileFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { ResponseData, MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues, FlowsTypes, ActionState, CountryCode, AuthForType } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  response: any;