@tap-payments/auth-jsconnect 2.0.61-test → 2.0.63-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,6 +52,6 @@ declare const entityService: {
52
52
  retrieveBankAccount: (id: string) => Promise<any>;
53
53
  retrieveEntityInfo: (entity_id: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
54
54
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
55
- uploadFileInfo: (data: UploadFileBody) => Promise<any>;
55
+ uploadFileInfo: (data: UploadFileBody, config?: AxiosRequestConfig) => Promise<any>;
56
56
  };
57
57
  export { entityService };
@@ -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)
@@ -31,13 +42,8 @@ var retrieveBankAccount = function (id) {
31
42
  url: "".concat(ENDPOINT_PATHS.BANK, "/").concat(id)
32
43
  });
33
44
  };
34
- var uploadFileInfo = function (data) {
35
- return httpClient({
36
- method: 'post',
37
- url: "".concat(ENDPOINT_PATHS.FILES_PATH),
38
- data: data,
39
- headers: { 'Content-Type': 'multipart/form-data' }
40
- });
45
+ var uploadFileInfo = function (data, config) {
46
+ return httpClient(__assign({ method: 'post', url: "".concat(ENDPOINT_PATHS.FILES_PATH), data: data, headers: { 'Content-Type': 'multipart/form-data' } }, config));
41
47
  };
42
48
  var updateIndividualInfo = function (_a) {
43
49
  var id = _a.id, data = __rest(_a, ["id"]);
@@ -40,7 +40,7 @@ declare const API: {
40
40
  retrieveBankAccount: (id: string) => Promise<any>;
41
41
  retrieveEntityInfo: (entity_id: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
42
42
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
43
- uploadFileInfo: (data: import("./entity").UploadFileBody) => Promise<any>;
43
+ uploadFileInfo: (data: import("./entity").UploadFileBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<any>;
44
44
  };
45
45
  availabilityServices: {
46
46
  checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -77,8 +77,8 @@ export declare type LeadIdentityUpdateBody = {
77
77
  id: string;
78
78
  country_code: string;
79
79
  identification_id: string;
80
- identification_id_type: string;
81
- date_of_birth: string;
80
+ identification_id_type?: string;
81
+ date_of_birth?: string;
82
82
  step_name: string;
83
83
  encryption_contract: Array<string>;
84
84
  };
@@ -30,8 +30,9 @@ export declare const settingsSlice: import("@reduxjs/toolkit").Slice<SettingsSta
30
30
  handlePrevScreenStep: (state: SettingsState, action: ActionState<string | undefined>) => void;
31
31
  handleActiveFlowScreens: (state: SettingsState, action: ActionState<Array<ScreenStepNavigation>>) => void;
32
32
  handleSetAppConfig: (state: SettingsState, action: ActionState<LibConfig>) => void;
33
+ handleSetCountryByIso2: (state: SettingsState, action: ActionState<string>) => void;
33
34
  }, "settings">;
34
- export declare const handleSkin: import("@reduxjs/toolkit").ActionCreatorWithPayload<ThemeMode, string>, handleLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<LanguageMode, string>, handleActiveFlowScreens: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScreenStepNavigation[], string>, handleNextScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handlePrevScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handleCurrentActiveScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, handleSetAppConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<LibConfig, string>, handleOpen: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, handleIsTapOrigin: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
35
+ export declare const handleSkin: import("@reduxjs/toolkit").ActionCreatorWithPayload<ThemeMode, string>, handleLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<LanguageMode, string>, handleActiveFlowScreens: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScreenStepNavigation[], string>, handleNextScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handlePrevScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handleCurrentActiveScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, handleSetAppConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<LibConfig, string>, handleOpen: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, handleSetCountryByIso2: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, handleIsTapOrigin: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
35
36
  declare const _default: import("redux").Reducer<SettingsState, import("redux").AnyAction>;
36
37
  export default _default;
37
38
  export declare const settingsSelector: (state: RootState) => SettingsState;
@@ -220,6 +220,10 @@ export var settingsSlice = createSlice({
220
220
  if (typeof open !== 'boolean')
221
221
  throw new Error('Open is required');
222
222
  state.data.appConfig = action.payload;
223
+ },
224
+ handleSetCountryByIso2: function (state, action) {
225
+ var country = findCountryByIso2(state.data.countries, action.payload);
226
+ state.data.businessCountry = country || defaultCountry;
223
227
  }
224
228
  },
225
229
  extraReducers: function (builder) {
@@ -241,6 +245,6 @@ export var settingsSlice = createSlice({
241
245
  });
242
246
  }
243
247
  });
244
- export var handleSkin = (_a = settingsSlice.actions, _a.handleSkin), handleLanguage = _a.handleLanguage, handleActiveFlowScreens = _a.handleActiveFlowScreens, handleNextScreenStep = _a.handleNextScreenStep, handlePrevScreenStep = _a.handlePrevScreenStep, handleCurrentActiveScreen = _a.handleCurrentActiveScreen, handleSetAppConfig = _a.handleSetAppConfig, handleOpen = _a.handleOpen, handleIsTapOrigin = _a.handleIsTapOrigin;
248
+ export var handleSkin = (_a = settingsSlice.actions, _a.handleSkin), handleLanguage = _a.handleLanguage, handleActiveFlowScreens = _a.handleActiveFlowScreens, handleNextScreenStep = _a.handleNextScreenStep, handlePrevScreenStep = _a.handlePrevScreenStep, handleCurrentActiveScreen = _a.handleCurrentActiveScreen, handleSetAppConfig = _a.handleSetAppConfig, handleOpen = _a.handleOpen, handleSetCountryByIso2 = _a.handleSetCountryByIso2, handleIsTapOrigin = _a.handleIsTapOrigin;
245
249
  export default settingsSlice.reducer;
246
250
  export var settingsSelector = function (state) { return state.settings; };
@@ -6,10 +6,11 @@ interface DragAndDropProps {
6
6
  uploadingTitle: string;
7
7
  successTitle: string;
8
8
  error?: string;
9
+ progress?: number;
9
10
  uploading?: boolean;
10
11
  uploadSuccess?: boolean;
11
12
  fileExists: boolean;
12
13
  onSuccess?: (files: File) => void;
13
14
  }
14
- declare const DragAndDrop: ({ title, subTitle, description, error, uploadingTitle, successTitle, uploading, fileExists, uploadSuccess, onSuccess }: DragAndDropProps) => JSX.Element;
15
+ declare const DragAndDrop: ({ title, subTitle, description, error, uploadingTitle, successTitle, progress, uploading, fileExists, uploadSuccess, onSuccess }: DragAndDropProps) => JSX.Element;
15
16
  export default DragAndDrop;
@@ -91,16 +91,22 @@ var DropFileIcon = styled(Icon)(function (_a) {
91
91
  marginInline: theme.spacing(-1.25)
92
92
  });
93
93
  });
94
+ var TextDoneStyled = styled(Text)(function (_a) {
95
+ var theme = _a.theme;
96
+ return ({
97
+ marginBlockStart: theme.spacing(1),
98
+ color: theme.palette.text.primary
99
+ });
100
+ });
94
101
  var WarningContainer = styled(Box)(function (_a) {
95
102
  var theme = _a.theme;
96
103
  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));
97
104
  });
98
105
  var DragAndDrop = function (_a) {
99
- var title = _a.title, subTitle = _a.subTitle, description = _a.description, error = _a.error, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, uploading = _a.uploading, fileExists = _a.fileExists, uploadSuccess = _a.uploadSuccess, onSuccess = _a.onSuccess;
100
- var _b = React.useState(1), progress = _b[0], setProgress = _b[1];
101
- var _c = React.useState(false), dragActive = _c[0], setDragActive = _c[1];
102
- var _d = React.useState(false), showDone = _d[0], setShowDone = _d[1];
103
- var _e = useDropzone({
106
+ 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;
107
+ var _b = React.useState(false), dragActive = _b[0], setDragActive = _b[1];
108
+ var _c = React.useState(false), showDone = _c[0], setShowDone = _c[1];
109
+ var _d = useDropzone({
104
110
  maxFiles: 1,
105
111
  noKeyboard: true,
106
112
  noClick: false,
@@ -116,29 +122,16 @@ var DragAndDrop = function (_a) {
116
122
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(files === null || files === void 0 ? void 0 : files[0]);
117
123
  setDragActive(false);
118
124
  }
119
- }), getRootProps = _e.getRootProps, getInputProps = _e.getInputProps;
125
+ }), getRootProps = _d.getRootProps, getInputProps = _d.getInputProps;
120
126
  React.useEffect(function () {
121
127
  setDragActive(false);
122
128
  if (uploadSuccess) {
123
129
  setShowDone(true);
124
130
  setTimeout(function () {
125
- setProgress(100);
126
131
  setShowDone(false);
127
- }, 500);
128
- }
129
- else if (uploading) {
130
- var timer_1 = setInterval(function () {
131
- setProgress(function (prevProgress) { return (prevProgress >= 75 ? 1 : prevProgress + 25); });
132
- }, 800);
133
- return function () {
134
- clearInterval(timer_1);
135
- };
132
+ }, 400);
136
133
  }
137
134
  }, [uploading]);
138
- React.useEffect(function () {
139
- if (!fileExists)
140
- setProgress(25);
141
- }, [fileExists]);
142
- return (_jsx(Box, __assign({ id: 'upload-container' }, { children: _jsxs(BoxStyled, __assign({ active: dragActive }, getRootProps({ className: 'dropzone' }), { children: [_jsx(Fade, __assign({ in: (!uploading && !uploadSuccess) || !fileExists, unmountOnExit: true, timeout: 100 }, { children: _jsxs(Box, { children: [_jsx(CenterBoxStyled, { children: _jsx(IconStyled, { src: dragActive ? ICONS_NAMES.ACTIVE_UPLOAD_ICON : ICONS_NAMES.UPLOAD_ICON }) }), _jsxs(VerticalCenterBox, __assign({ sx: { marginBlockEnd: '20px' } }, { children: [_jsxs(CenterBoxStyled, { children: [_jsx(Text, __assign({ sx: { fontSize: '16px' } }, { children: title })), _jsx(SubTitleStyled, { children: subTitle })] }), _jsx(DescTextStyled, { children: description }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsxs(WarningContainer, { children: [_jsx(WarningIconStyled, { src: ICONS_NAMES.WARNING_ICON }), _jsx(Text, { children: error })] }) }))] })), _jsx(UploadInputStyled, { inputProps: __assign({}, getInputProps()) })] }) })), _jsx(CenterBoxStyled, { children: showDone ? (_jsxs(VerticalCenterBox, { children: [_jsx(DoneIconStyled, { src: ICONS_NAMES.DONE_ICON }), _jsx(Text, { children: successTitle })] })) : uploading ? (_jsxs(VerticalCenterBox, { children: [_jsx(CircularProgress, { value: progress, size: 54 }), _jsx(Text, { children: uploadingTitle })] })) : (_jsx(_Fragment, {})) }), _jsx(Fade, __assign({ unmountOnExit: true, timeout: 100, in: dragActive }, { children: _jsx(DropFileIcon, { src: ICONS_NAMES.DROP_FILE_ICON }) }))] })) })));
135
+ return (_jsx(Box, __assign({ id: 'upload-container' }, { children: _jsxs(BoxStyled, __assign({ active: dragActive }, getRootProps({ className: 'dropzone' }), { children: [_jsx(Fade, __assign({ in: (!uploading && !uploadSuccess) || !fileExists, unmountOnExit: true, timeout: 100 }, { children: _jsxs(Box, { children: [_jsx(CenterBoxStyled, { children: _jsx(IconStyled, { src: dragActive ? ICONS_NAMES.ACTIVE_UPLOAD_ICON : ICONS_NAMES.UPLOAD_ICON }) }), _jsxs(VerticalCenterBox, __assign({ sx: { marginBlockEnd: '20px' } }, { children: [_jsxs(CenterBoxStyled, { children: [_jsx(Text, __assign({ sx: { fontSize: '16px' } }, { children: title })), _jsx(SubTitleStyled, { children: subTitle })] }), _jsx(DescTextStyled, { children: description }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsxs(WarningContainer, { children: [_jsx(WarningIconStyled, { src: ICONS_NAMES.WARNING_ICON }), _jsx(Text, { children: error })] }) }))] })), _jsx(UploadInputStyled, { inputProps: __assign({}, getInputProps()) })] }) })), _jsx(CenterBoxStyled, { children: showDone ? (_jsxs(VerticalCenterBox, { children: [_jsx(DoneIconStyled, { src: ICONS_NAMES.DONE_ICON }), _jsx(TextDoneStyled, { children: successTitle })] })) : uploading ? (_jsxs(VerticalCenterBox, { children: [_jsx(CircularProgress, { value: progress, size: 54 }), _jsx(Text, { children: uploadingTitle })] })) : (_jsx(_Fragment, {})) })] })) })));
143
136
  };
144
137
  export default DragAndDrop;
@@ -37,7 +37,7 @@ export var CONNECT_SCREENS_NAVIGATION = [
37
37
  name: 'CONNECT_VERIFY_PACI_STEP',
38
38
  next: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_MERCHANT_INFO_STEP'],
39
39
  prev: 'CONNECT_CIVIL_ID_STEP',
40
- order: 1
40
+ order: 2
41
41
  },
42
42
  {
43
43
  name: 'CONNECT_OTP_STEP',
@@ -73,22 +73,29 @@ export var BUSINESS_SCREENS_NAVIGATION = [
73
73
  'BUSINESS_CUSTOMERS_STEP',
74
74
  'BUSINESS_SUCCESS_STEP',
75
75
  'BUSINESS_ACTIVITIES_STEP',
76
- 'BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'
76
+ 'BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
77
+ 'BUSINESS_CIVIL_ID_STEP'
77
78
  ],
78
79
  prev: '',
79
80
  order: 1
80
81
  },
82
+ {
83
+ name: 'BUSINESS_CIVIL_ID_STEP',
84
+ next: 'BUSINESS_VERIFY_PACI_STEP',
85
+ prev: '',
86
+ order: 2
87
+ },
81
88
  {
82
89
  name: 'BUSINESS_IDBOD_STEP',
83
90
  next: 'BUSINESS_OTP_STEP',
84
- prev: 'BUSINESS_VERIFY_NUMBER_STEP',
91
+ prev: '',
85
92
  order: 2
86
93
  },
87
94
  {
88
- name: 'BUSINESS_BUSINESS_TYPE_STEP',
89
- next: 'BUSINESS_ACTIVITIES_STEP',
90
- prev: 'BUSINESS_IDBOD_STEP',
91
- order: 2
95
+ name: 'BUSINESS_VERIFY_PACI_STEP',
96
+ next: 'BUSINESS_BUSINESS_TYPE_STEP',
97
+ prev: 'BUSINESS_CIVIL_ID_STEP',
98
+ order: 3
92
99
  },
93
100
  {
94
101
  name: 'BUSINESS_OTP_STEP',
@@ -96,6 +103,12 @@ export var BUSINESS_SCREENS_NAVIGATION = [
96
103
  prev: 'BUSINESS_IDBOD_STEP',
97
104
  order: 3
98
105
  },
106
+ {
107
+ name: 'BUSINESS_BUSINESS_TYPE_STEP',
108
+ next: 'BUSINESS_ACTIVITIES_STEP',
109
+ prev: 'BUSINESS_IDBOD_STEP',
110
+ order: 2
111
+ },
99
112
  {
100
113
  name: 'BUSINESS_CONFIRM_STEP',
101
114
  next: 'BUSINESS_ACTIVITIES_STEP',
@@ -10,6 +10,6 @@ export var MAX_FILE_SIZE = 5000000;
10
10
  export var VALID_FILE_FORMATS = ['image/jpeg', 'image/png', 'image/jpg', 'application/pdf'];
11
11
  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;
12
12
  export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
13
- export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z\s])*$/g;
13
+ export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z()\s])*$/g;
14
14
  export var REGEX_BRAND_NAME = /^(([a-zA-Z0-9])+\s)*[a-zA-Z0-9]+$/;
15
15
  export var EMAIL_MAX_LENGTH = 50;
@@ -33,9 +33,13 @@ export declare const checkIbanBank: import("@reduxjs/toolkit").AsyncThunk<{
33
33
  cancelToken: CancelToken;
34
34
  onSuccess?: (() => void) | undefined;
35
35
  }, {}>;
36
+ interface UploadBankStatementParams {
37
+ file: File;
38
+ onProgress?: (value: number) => void;
39
+ }
36
40
  export declare const uploadBankStatement: import("@reduxjs/toolkit").AsyncThunk<{
37
41
  data: any;
38
- }, File, {}>;
42
+ }, UploadBankStatementParams, {}>;
39
43
  export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
40
44
  response: any;
41
45
  formData: void;
@@ -209,24 +209,31 @@ export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
209
209
  });
210
210
  });
211
211
  });
212
- export var uploadBankStatement = createAsyncThunk('uploadBankStatement', function (file) { return __awaiter(void 0, void 0, void 0, function () {
213
- var uploadPayload, data;
214
- return __generator(this, function (_a) {
215
- switch (_a.label) {
216
- case 0:
217
- uploadPayload = {
218
- file_link_create: true,
219
- title: file === null || file === void 0 ? void 0 : file.name,
220
- purpose: 'identity_document',
221
- file: file
222
- };
223
- return [4, API.entityService.uploadFileInfo(uploadPayload)];
224
- case 1:
225
- data = _a.sent();
226
- return [2, { data: data }];
227
- }
212
+ export var uploadBankStatement = createAsyncThunk('uploadBankStatement', function (_a) {
213
+ var file = _a.file, onProgress = _a.onProgress;
214
+ return __awaiter(void 0, void 0, void 0, function () {
215
+ var uploadPayload, onUploadProgress, data;
216
+ return __generator(this, function (_b) {
217
+ switch (_b.label) {
218
+ case 0:
219
+ uploadPayload = {
220
+ file_link_create: true,
221
+ title: file === null || file === void 0 ? void 0 : file.name,
222
+ purpose: 'identity_document',
223
+ file: file
224
+ };
225
+ onUploadProgress = function (progressEvent) {
226
+ var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
227
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
228
+ };
229
+ return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
230
+ case 1:
231
+ data = _b.sent();
232
+ return [2, { data: data }];
233
+ }
234
+ });
228
235
  });
229
- }); });
236
+ });
230
237
  export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
231
238
  var _a, settings, bank, _b, id, infoId, payload, data;
232
239
  var _c, _d, _e, _f;
@@ -431,7 +438,7 @@ export var bankSlice = createSlice({
431
438
  var data = action.payload.data;
432
439
  state.data.bankData.bankStatementId = data === null || data === void 0 ? void 0 : data.id;
433
440
  })
434
- .addCase(uploadBankStatement.rejected, function (state, action) {
441
+ .addCase(uploadBankStatement.rejected, function (state) {
435
442
  state.uploading = false;
436
443
  state.error = 'file_upload_error';
437
444
  });
@@ -60,13 +60,13 @@ import moment from 'moment';
60
60
  import API from '../../../api';
61
61
  import { BusinessType, FlowsTypes } from '../../../@types';
62
62
  import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
- import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep } from '../../../utils';
64
- import { handleNextScreenStep } from '../../../app/settings';
63
+ import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW } from '../../../utils';
64
+ import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
65
65
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
- var payload, data, leadResponse, brandInfo, boardResponse, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
67
- var _a, _b, _c, _d, _e, _f;
68
- return __generator(this, function (_g) {
69
- switch (_g.label) {
66
+ var payload, data, leadResponse, brandInfo, boardResponse, countryIso2, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
67
+ var _a, _b, _c, _d, _e, _f, _g;
68
+ return __generator(this, function (_h) {
69
+ switch (_h.label) {
70
70
  case 0:
71
71
  payload = {
72
72
  service_name: 'tap_email',
@@ -74,28 +74,33 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
74
74
  };
75
75
  return [4, API.leadService.verifyLeadToken(payload)];
76
76
  case 1:
77
- data = (_g.sent()).data;
77
+ data = (_h.sent()).data;
78
78
  leadResponse = undefined;
79
79
  brandInfo = undefined;
80
80
  boardResponse = undefined;
81
81
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 17];
82
82
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
83
83
  case 2:
84
- leadResponse = _g.sent();
85
- board_id = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.board_id;
86
- board_info_id = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.board_info_id;
84
+ leadResponse = _h.sent();
85
+ countryIso2 = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.country_code;
86
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
87
+ board_id = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.board_id;
88
+ board_info_id = (_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _c === void 0 ? void 0 : _c.board_info_id;
87
89
  if (!(!!board_id && !!board_info_id)) return [3, 4];
88
90
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
89
91
  case 3:
90
- boardResponse = _g.sent();
91
- _g.label = 4;
92
+ boardResponse = _h.sent();
93
+ _h.label = 4;
92
94
  case 4:
93
- if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
95
+ if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && isKW(countryIso2)) {
96
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
97
+ }
98
+ if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && !isKW(countryIso2)) {
94
99
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
95
100
  }
96
101
  if (!(data.step_name === 'business_info')) return [3, 17];
97
- steps = (_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _c === void 0 ? void 0 : _c.steps;
98
- brandID = (_e = (_d = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.id;
102
+ steps = (_d = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _d === void 0 ? void 0 : _d.steps;
103
+ brandID = (_f = (_e = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _e === void 0 ? void 0 : _e.brand) === null || _f === void 0 ? void 0 : _f.id;
99
104
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
100
105
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
101
106
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
@@ -103,7 +108,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
103
108
  if (!hasBusinessCompleted) return [3, 6];
104
109
  return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
105
110
  case 5:
106
- _g.sent();
111
+ _h.sent();
107
112
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
108
113
  return [3, 17];
109
114
  case 6:
@@ -118,36 +123,36 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
118
123
  if (!hasBusinessCRActivitiesCompleted) return [3, 12];
119
124
  return [4, thunkApi.dispatch(retrieveChannels())];
120
125
  case 9:
121
- _g.sent();
126
+ _h.sent();
122
127
  return [4, thunkApi.dispatch(retrieveDataList())];
123
128
  case 10:
124
- _g.sent();
129
+ _h.sent();
125
130
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
126
131
  return [4, API.brandService.retrieveBrand(brandID)];
127
132
  case 11:
128
- brandInfo = _g.sent();
133
+ brandInfo = _h.sent();
129
134
  return [3, 17];
130
135
  case 12:
131
136
  if (!hasBusinessCRInfoCompleted) return [3, 15];
132
137
  return [4, thunkApi.dispatch(retrieveChannels())];
133
138
  case 13:
134
- _g.sent();
139
+ _h.sent();
135
140
  return [4, API.brandService.retrieveBrand(brandID)];
136
141
  case 14:
137
- brandInfo = _g.sent();
142
+ brandInfo = _h.sent();
138
143
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
139
144
  return [3, 17];
140
145
  case 15: return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
141
146
  case 16:
142
- _g.sent();
147
+ _h.sent();
143
148
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
144
- _g.label = 17;
149
+ _h.label = 17;
145
150
  case 17: return [2, {
146
151
  data: data,
147
152
  leadData: __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: BUSINESS_FLOW_SUCCESS.concat(boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) }),
148
153
  token: token,
149
154
  brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand,
150
- boardId: (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.board_id
155
+ boardId: (_g = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _g === void 0 ? void 0 : _g.board_id
151
156
  }];
152
157
  }
153
158
  });
@@ -170,93 +175,99 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
170
175
  });
171
176
  }); });
172
177
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
173
- var _a, business, settings, isNID, responseBody, verifyResponse, stepName, brandID, payload, data, brandInfo, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
174
- var _b, _c, _d, _e, _f, _g, _h, _j;
175
- return __generator(this, function (_k) {
176
- switch (_k.label) {
178
+ var _a, business, settings, isNID, responseBody, verifyResponse, stepName, brandID, countryIso2, payload, data, brandInfo, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep;
179
+ var _b, _c, _d, _e, _f, _g, _h;
180
+ return __generator(this, function (_j) {
181
+ switch (_j.label) {
177
182
  case 0:
178
183
  _a = thunkApi.getState(), business = _a.business, settings = _a.settings;
179
184
  isNID = business.data.otpData.isNID;
180
185
  responseBody = (isNID ? business.data.nidData : business.data.verify).responseBody;
181
186
  verifyResponse = business.data.verify.responseBody;
182
187
  stepName = isNID ? BUSINESS_STEP_NAMES.IDENTITY_VERIFY_AUTH : BUSINESS_STEP_NAMES.PHONE_AUTH;
183
- brandID = (_c = (_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.id;
188
+ brandID = (_b = verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.brand) === null || _b === void 0 ? void 0 : _b.id;
189
+ countryIso2 = verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.country_code;
184
190
  payload = {
185
191
  data: params.otp,
186
- service_name: ((_e = (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _d === void 0 ? void 0 : _d.verification_by) === null || _e === void 0 ? void 0 : _e.service_name) || ((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _f === void 0 ? void 0 : _f.service_name),
187
- verify_token: ((_g = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _g === void 0 ? void 0 : _g.verify_token) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token),
192
+ service_name: ((_d = (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _c === void 0 ? void 0 : _c.verification_by) === null || _d === void 0 ? void 0 : _d.service_name) || ((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _e === void 0 ? void 0 : _e.service_name),
193
+ verify_token: ((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _f === void 0 ? void 0 : _f.verify_token) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token),
188
194
  step_name: stepName,
189
195
  encryption_contract: ['data']
190
196
  };
191
197
  return [4, API.leadService.verifyLeadOTP(payload)];
192
198
  case 1:
193
- data = (_k.sent()).data;
199
+ data = (_j.sent()).data;
194
200
  brandInfo = undefined;
195
- if (!!data.errors) return [3, 14];
201
+ if (!!data.errors) return [3, 15];
196
202
  thunkApi.dispatch(updateStepName(stepName));
197
203
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
198
204
  case 2:
199
- _k.sent();
200
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
205
+ _j.sent();
206
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
201
207
  steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
202
208
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
203
209
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
204
210
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
205
211
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
212
+ isIdentityAuthStep = data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH;
206
213
  if (!isNID) return [3, 3];
207
214
  thunkApi.dispatch(handleNextScreenStep());
208
- return [3, 14];
215
+ return [3, 15];
209
216
  case 3:
210
- if (!hasBusinessCompleted) return [3, 5];
211
- return [4, thunkApi.dispatch(retrieveBoardDetails(verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.board_id))];
217
+ if (!(isIdentityAuthStep && isKW(countryIso2))) return [3, 4];
218
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
219
+ return [3, 15];
212
220
  case 4:
213
- _k.sent();
214
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
215
- return [3, 14];
221
+ if (!hasBusinessCompleted) return [3, 6];
222
+ return [4, thunkApi.dispatch(retrieveBoardDetails(verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.board_id))];
216
223
  case 5:
217
- if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 6];
218
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
219
- return [3, 14];
224
+ _j.sent();
225
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
226
+ return [3, 15];
220
227
  case 6:
221
- if (!hasBusinessCustomersCompleted) return [3, 7];
222
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
223
- return [3, 14];
228
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 7];
229
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
230
+ return [3, 15];
224
231
  case 7:
225
- if (!hasBusinessCRActivitiesCompleted) return [3, 10];
232
+ if (!hasBusinessCustomersCompleted) return [3, 8];
233
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
234
+ return [3, 15];
235
+ case 8:
236
+ if (!hasBusinessCRActivitiesCompleted) return [3, 11];
226
237
  thunkApi.dispatch(retrieveChannels());
227
238
  return [4, thunkApi.dispatch(retrieveDataList())];
228
- case 8:
229
- _k.sent();
239
+ case 9:
240
+ _j.sent();
230
241
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
231
242
  return [4, API.brandService.retrieveBrand(brandID)];
232
- case 9:
233
- brandInfo = _k.sent();
234
- return [3, 14];
235
243
  case 10:
236
- if (!hasBusinessCRInfoCompleted) return [3, 13];
237
- return [4, thunkApi.dispatch(retrieveChannels())];
244
+ brandInfo = _j.sent();
245
+ return [3, 15];
238
246
  case 11:
239
- _k.sent();
240
- return [4, API.brandService.retrieveBrand(brandID)];
247
+ if (!hasBusinessCRInfoCompleted) return [3, 14];
248
+ return [4, thunkApi.dispatch(retrieveChannels())];
241
249
  case 12:
242
- brandInfo = _k.sent();
243
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
244
- return [3, 14];
250
+ _j.sent();
251
+ return [4, API.brandService.retrieveBrand(brandID)];
245
252
  case 13:
253
+ brandInfo = _j.sent();
254
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
255
+ return [3, 15];
256
+ case 14:
246
257
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
247
- _k.label = 14;
248
- case 14: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand }];
258
+ _j.label = 15;
259
+ case 15: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand }];
249
260
  }
250
261
  });
251
262
  }); });
252
263
  export var verifyPACI = createAsyncThunk('verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
253
- var _a, settings, connect, responseBody, expiry, interval, maxCalls, response, count, data, isSuccess;
264
+ var _a, settings, business, responseBody, expiry, interval, maxCalls, response, count, data, isSuccess;
254
265
  var _b, _c;
255
266
  return __generator(this, function (_d) {
256
267
  switch (_d.label) {
257
268
  case 0:
258
- _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
259
- responseBody = connect.data.civilIdData.responseBody;
269
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
270
+ responseBody = business.data.civilIdData.responseBody;
260
271
  expiry = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120;
261
272
  interval = 5;
262
273
  maxCalls = Math.floor(expiry / interval);
@@ -292,29 +303,26 @@ export var verifyPACI = createAsyncThunk('verifyPACI', function (params, thunkAp
292
303
  });
293
304
  }); });
294
305
  export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
295
- var settings, requestBody, data;
296
- var _a, _b;
297
- return __generator(this, function (_c) {
298
- switch (_c.label) {
306
+ var _a, settings, business, stepName, requestBody, data;
307
+ var _b, _c, _d;
308
+ return __generator(this, function (_e) {
309
+ switch (_e.label) {
299
310
  case 0:
300
- settings = thunkApi.getState().settings;
311
+ _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
312
+ stepName = BUSINESS_STEP_NAMES.CREATE_AUTH_CIVIL_ID;
301
313
  requestBody = {
302
- lang: settings.data.language,
303
- user_credentail: {
304
- identification_id: params.civilId,
305
- country_code: 'KW'
306
- },
307
- sign_in: false,
308
- step_name: BUSINESS_STEP_NAMES.CREATE_AUTH_CIVIL_ID,
309
- encryption_contract: ['user_credentail.identification_id']
314
+ id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
315
+ identification_id: params.civilId,
316
+ country_code: settings.data.businessCountry.iso2,
317
+ step_name: stepName,
318
+ identification_id_type: 'civil_id',
319
+ encryption_contract: ['identification_id']
310
320
  };
311
- return [4, API.authService.createAuth(requestBody)];
321
+ return [4, API.leadService.updateLead(requestBody)];
312
322
  case 1:
313
- data = (_c.sent()).data;
314
- if (!data.errors) {
315
- thunkApi.dispatch(handleNextScreenStep());
316
- (_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
317
- }
323
+ data = _e.sent();
324
+ thunkApi.dispatch(handleNextScreenStep());
325
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
318
326
  return [2, { response: data, formData: params }];
319
327
  }
320
328
  });
@@ -841,6 +849,7 @@ export var businessSlice = createSlice({
841
849
  state.error = description;
842
850
  return;
843
851
  }
852
+ state.data.civilIdData = __assign(__assign({}, formData), { responseBody: response });
844
853
  })
845
854
  .addCase(createCivilIdAuth.rejected, function (state, action) {
846
855
  state.loading = false;
@@ -16,11 +16,12 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
16
16
  });
17
17
  var BankStatement = function () {
18
18
  var _a, _b;
19
+ var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
19
20
  var t = useTranslation().t;
20
- var _c = useFormContext(), control = _c.control, setError = _c.setError, clearErrors = _c.clearErrors;
21
+ var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors;
21
22
  var bankStatementFileControl = useController({ name: 'bankStatementFile', control: control });
22
23
  var bankStatementIdControl = useController({ name: 'bankStatementId', control: control });
23
- var _d = useAppSelector(bankSelector), loading = _d.loading, uploading = _d.uploading, sysError = _d.error;
24
+ var _e = useAppSelector(bankSelector), loading = _e.loading, uploading = _e.uploading, sysError = _e.error;
24
25
  var dispatch = useAppDispatch();
25
26
  var bankStatementValue = bankStatementFileControl.field.value;
26
27
  var error = ((_a = bankStatementFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = bankStatementIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
@@ -33,23 +34,30 @@ var BankStatement = function () {
33
34
  }
34
35
  else {
35
36
  bankStatementFileControl.field.onChange(file);
36
- dispatch(uploadBankStatement(file));
37
+ dispatch(uploadBankStatement({
38
+ file: file,
39
+ onProgress: function (value) {
40
+ setProgress(value);
41
+ }
42
+ }));
37
43
  }
38
44
  };
39
45
  var handleReset = function () {
40
46
  bankStatementFileControl.field.onChange(null);
41
47
  bankStatementIdControl.field.onChange('');
48
+ setProgress(0);
42
49
  };
43
50
  React.useEffect(function () {
44
51
  if (sysError === 'file_upload_error') {
45
52
  setError('bankStatementId', { message: sysError });
46
53
  bankStatementFileControl.field.onChange(null);
54
+ setProgress(0);
47
55
  }
48
56
  }, [sysError]);
49
57
  React.useEffect(function () {
50
58
  if ((bankStatementFileControl.formState.isValid || !!bankStatementValue) && error != 'file_upload_error')
51
59
  clearErrors();
52
60
  }, [bankStatementFileControl.formState.isValid, bankStatementValue]);
53
- 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, onReset: handleReset, error: error && t(error) }) }));
61
+ 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, onReset: handleReset, error: error && t(error) }) }));
54
62
  };
55
63
  export default BankStatement;
@@ -63,7 +63,7 @@ var CivilID = function (_a) {
63
63
  var settingsStore = useAppSelector(settingsSelector);
64
64
  var methods = useForm({
65
65
  resolver: yupResolver(civilIDValidationSchema),
66
- defaultValues: {},
66
+ defaultValues: data.civilIdData,
67
67
  mode: 'onChange'
68
68
  });
69
69
  React.useEffect(function () {
@@ -1,7 +1,7 @@
1
1
  import MobileScreen from './connect/screens/Mobile';
2
2
  import NIDScreen from './connect/screens/NID';
3
- import CivilIDScreen from '../features/connect/screens/CivilID';
4
- import VerifyPACIScreen from './connect/screens/VerifyPACI';
3
+ import ConnectCivilIDScreen from '../features/connect/screens/CivilID';
4
+ import ConnectVerifyPACIScreen from './connect/screens/VerifyPACI';
5
5
  import IndividualScreen from './connect/screens/Individual';
6
6
  import MerchantInfoScreen from './connect/screens/Merchant';
7
7
  import ConnectOTPScreen from './connect/screens/OTP';
@@ -15,6 +15,8 @@ import ActivitiesPage from './business/screens/Activities';
15
15
  import SuccessPage from './business/screens/Success';
16
16
  import SuccessWithFlowButtonsPage from './business/screens/SuccessWithFlowButtons';
17
17
  import ResetPasswordSuccessPage from './business/screens/ResetPasswordSuccess';
18
+ import BusCivilIDscreen from './business/screens/CivilID';
19
+ import BusVerifyPACIScreen from './business/screens/VerifyPACI';
18
20
  import PasswordVerifyPage from './password/screens/Verify';
19
21
  import CreatePasswordPage from './password/screens/CreatePassword';
20
22
  import PasswordOTPPage from './password/screens/OTP';
@@ -54,7 +56,7 @@ export var connectFeatureScreens = [
54
56
  },
55
57
  {
56
58
  name: 'CONNECT_CIVIL_ID_STEP',
57
- element: CivilIDScreen
59
+ element: ConnectCivilIDScreen
58
60
  },
59
61
  {
60
62
  name: 'CONNECT_MOBILE_STEP',
@@ -66,7 +68,7 @@ export var connectFeatureScreens = [
66
68
  },
67
69
  {
68
70
  name: 'CONNECT_VERIFY_PACI_STEP',
69
- element: VerifyPACIScreen
71
+ element: ConnectVerifyPACIScreen
70
72
  },
71
73
  {
72
74
  name: 'CONNECT_INDIVIDUAL_STEP',
@@ -90,6 +92,14 @@ export var businessFeatureScreens = [
90
92
  name: 'BUSINESS_IDBOD_STEP',
91
93
  element: IDBODPage
92
94
  },
95
+ {
96
+ name: 'BUSINESS_CIVIL_ID_STEP',
97
+ element: BusCivilIDscreen
98
+ },
99
+ {
100
+ name: 'BUSINESS_VERIFY_PACI_STEP',
101
+ element: BusVerifyPACIScreen
102
+ },
93
103
  {
94
104
  name: 'BUSINESS_OTP_STEP',
95
105
  element: BusinessOTPPage
@@ -16,11 +16,12 @@ interface UploadFileProps {
16
16
  uploadingTitle: string;
17
17
  successTitle: string;
18
18
  error?: string;
19
+ progress?: number;
19
20
  isSubmitting?: boolean;
20
21
  isUploading?: boolean;
21
22
  isFileUploaded?: boolean;
22
23
  onFileUploaded: (file: File) => void;
23
24
  onReset: () => void;
24
25
  }
25
- declare const UploadFile: ({ label, required, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, isUploading, isFileUploaded, error, onFileUploaded, onReset }: UploadFileProps) => JSX.Element;
26
+ declare const UploadFile: ({ label, required, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, isUploading, isFileUploaded, error, progress, onFileUploaded, onReset }: UploadFileProps) => JSX.Element;
26
27
  export default UploadFile;
@@ -64,7 +64,7 @@ export var InputContainerStyled = styled(Box)(function (_a) {
64
64
  });
65
65
  });
66
66
  var UploadFile = function (_a) {
67
- var label = _a.label, required = _a.required, title = _a.title, subTitle = _a.subTitle, dragDescription = _a.dragDescription, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, isSubmitting = _a.isSubmitting, isUploading = _a.isUploading, isFileUploaded = _a.isFileUploaded, error = _a.error, onFileUploaded = _a.onFileUploaded, onReset = _a.onReset;
67
+ var label = _a.label, required = _a.required, title = _a.title, subTitle = _a.subTitle, dragDescription = _a.dragDescription, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, isSubmitting = _a.isSubmitting, isUploading = _a.isUploading, isFileUploaded = _a.isFileUploaded, error = _a.error, progress = _a.progress, onFileUploaded = _a.onFileUploaded, onReset = _a.onReset;
68
68
  var _b = React.useState(''), fileName = _b[0], setFileName = _b[1];
69
69
  var _c = React.useState(false), showFile = _c[0], setShowFile = _c[1];
70
70
  var handleFileChange = function (file) {
@@ -86,6 +86,6 @@ var UploadFile = function (_a) {
86
86
  else
87
87
  setShowFile(false);
88
88
  }, [isFileUploaded]);
89
- return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !showFile }, { children: _jsx(InputContainerStyled, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: !!fileName, uploadingTitle: uploadingTitle, successTitle: successTitle, uploading: isUploading, uploadSuccess: isFileUploaded, onSuccess: handleFileChange, error: error }) }) })), _jsx(Collapse, __assign({ in: showFile, timeout: 300 }, { children: _jsxs(InputContainerStyled, { children: [_jsxs(BoxStyled, { children: [_jsxs(Box, __assign({ sx: { display: 'flex' } }, { children: [_jsx(Icon, { src: ICONS_NAMES.DOC_ICON }), _jsx(Text, { children: fileName })] })), _jsx(Box, { children: _jsx(CheckIcon, {}) })] }), _jsx(UploadBoxStyled, __assign({ onClick: handleReset }, { children: _jsx(ClearIconStyled, {}) }))] }) }))] }));
89
+ return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !showFile }, { children: _jsx(InputContainerStyled, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: !!fileName, uploadingTitle: uploadingTitle, successTitle: successTitle, progress: progress, uploading: isUploading, uploadSuccess: isFileUploaded, onSuccess: handleFileChange, error: error }) }) })), _jsx(Collapse, __assign({ in: showFile, timeout: 300 }, { children: _jsxs(InputContainerStyled, { children: [_jsxs(BoxStyled, { children: [_jsxs(Box, __assign({ sx: { display: 'flex' } }, { children: [_jsx(Icon, { src: ICONS_NAMES.DOC_ICON }), _jsx(Text, { children: fileName })] })), _jsx(Box, { children: _jsx(CheckIcon, {}) })] }), _jsx(UploadBoxStyled, __assign({ onClick: handleReset }, { children: _jsx(ClearIconStyled, {}) }))] }) }))] }));
90
90
  };
91
91
  export default UploadFile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.61-test",
3
+ "version": "2.0.63-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",