@tap-payments/auth-jsconnect 1.0.60 → 1.0.63

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 (61) hide show
  1. package/build/@types/redux.d.ts +1 -0
  2. package/build/api/lead.d.ts +4 -1
  3. package/build/assets/locales/ar.json +5 -4
  4. package/build/assets/locales/en.json +5 -4
  5. package/build/constants/app.js +1 -1
  6. package/build/constants/assets.d.ts +17 -7
  7. package/build/constants/assets.js +17 -7
  8. package/build/features/Landing/Landing.js +5 -8
  9. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +6 -20
  10. package/build/features/app/bank/bankStore.js +4 -0
  11. package/build/features/app/business/businessStore.d.ts +6 -2
  12. package/build/features/app/business/businessStore.js +87 -60
  13. package/build/features/app/connect/connectStore.js +44 -23
  14. package/build/features/app/individual/individualStore.js +4 -0
  15. package/build/features/app/password/passwordStore.js +6 -0
  16. package/build/features/app/tax/taxStore.js +6 -0
  17. package/build/features/business/Business.js +3 -2
  18. package/build/features/business/screens/Activities/Activities.js +4 -0
  19. package/build/features/business/screens/Activities/ActivitiesList.js +5 -6
  20. package/build/features/business/screens/Activities/SalesChannels.js +4 -5
  21. package/build/features/business/screens/BusinessType/BusinessType.js +1 -6
  22. package/build/features/business/screens/BusinessType/LicenseList.js +18 -13
  23. package/build/features/business/screens/BusinessType/LicenseNumber.js +3 -3
  24. package/build/features/business/screens/Customers/Customers.js +0 -1
  25. package/build/features/business/screens/Success/Success.js +3 -2
  26. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +20 -20
  27. package/build/features/business/screens/Verify/Verify.js +1 -1
  28. package/build/features/password/screens/CreatePassword/CreatePassword.js +0 -1
  29. package/build/features/shared/Button/AbsherButton.js +1 -0
  30. package/build/features/shared/Button/Button.js +1 -1
  31. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  32. package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
  33. package/build/features/shared/Button/FlowsButtons.js +12 -7
  34. package/build/features/shared/Button/MobileButton.js +1 -0
  35. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +2 -1
  36. package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
  37. package/build/utils/string.d.ts +1 -0
  38. package/build/utils/string.js +4 -0
  39. package/package.json +1 -1
  40. package/build/features/business/screens/BusinessType/CRNumber.d.ts +0 -7
  41. package/build/features/business/screens/BusinessType/CRNumber.js +0 -41
  42. package/build/features/business/screens/BusinessType/CompanyLicense.d.ts +0 -11
  43. package/build/features/business/screens/BusinessType/CompanyLicense.js +0 -127
  44. package/build/features/business/screens/BusinessType/FLNumber.d.ts +0 -7
  45. package/build/features/business/screens/BusinessType/FLNumber.js +0 -41
  46. package/build/features/business/screens/BusinessType/FreelanceLicense.d.ts +0 -11
  47. package/build/features/business/screens/BusinessType/FreelanceLicense.js +0 -127
  48. package/build/features/business/screens/Confirm/Confirm.d.ts +0 -5
  49. package/build/features/business/screens/Confirm/Confirm.js +0 -56
  50. package/build/features/business/screens/Confirm/index.d.ts +0 -3
  51. package/build/features/business/screens/Confirm/index.js +0 -2
  52. package/build/features/connect/screens/Mobile/BusinessCountry.d.ts +0 -8
  53. package/build/features/connect/screens/Mobile/BusinessCountry.js +0 -40
  54. package/build/features/connect/screens/Password/Password.d.ts +0 -5
  55. package/build/features/connect/screens/Password/Password.js +0 -60
  56. package/build/features/connect/screens/Password/PasswordInput.d.ts +0 -5
  57. package/build/features/connect/screens/Password/PasswordInput.js +0 -39
  58. package/build/features/connect/screens/Password/index.d.ts +0 -3
  59. package/build/features/connect/screens/Password/index.js +0 -2
  60. package/build/features/connect/screens/Password/validation.d.ts +0 -8
  61. package/build/features/connect/screens/Password/validation.js +0 -4
@@ -1,6 +1,7 @@
1
1
  export interface SharedState<T> {
2
2
  error: string | null;
3
3
  loading: boolean;
4
+ customLoading?: boolean;
4
5
  data: T;
5
6
  }
6
7
  export interface ActionState<T> {
@@ -56,7 +56,10 @@ export declare type UpdateLeadBody = {
56
56
  license_type?: string;
57
57
  is_acknowledged?: boolean;
58
58
  terms_conditions_accepted?: boolean;
59
- email_url?: string;
59
+ flows?: {
60
+ name: string;
61
+ url: string;
62
+ }[];
60
63
  };
61
64
  export declare type LeadVerifyBody = {
62
65
  verify_token: string;
@@ -215,9 +215,9 @@
215
215
  "select_brand_label": "Brand List",
216
216
  "choose_brand": "Choose Brand",
217
217
  "confirm_enter_iban": "الايبان",
218
- "open_gmail": "Gmail",
219
- "open_outlook": "Outlook",
220
- "open_apple": "Apple",
218
+ "gmail_btn_open_title": "Gmail",
219
+ "outlook_btn_open_title": "Outlook",
220
+ "apple_btn_open_title": "Apple",
221
221
  "choose_any_license": "Choose Licene",
222
222
  "future_work": "Future Work",
223
223
  "add_other_fl": "Add Freelance",
@@ -231,5 +231,6 @@
231
231
  "tax_flow_pending": "Tax",
232
232
  "individual_flow_pending": "Individual",
233
233
  "bank_flow_pending": "Bank",
234
- "password_flow_pending": "Password"
234
+ "password_flow_pending": "Password",
235
+ "continue": "Continue"
235
236
  }
@@ -229,9 +229,9 @@
229
229
  "select_brand_label": "Brand List",
230
230
  "choose_brand": "Choose Brand",
231
231
  "confirm_enter_iban": "IBAN",
232
- "open_gmail": "Gmail",
233
- "open_outlook": "Outlook",
234
- "open_apple": "Apple",
232
+ "gmail_btn_open_title": "Gmail",
233
+ "outlook_btn_open_title": "Outlook",
234
+ "apple_btn_open_title": "Apple",
235
235
  "choose_any_license": "Choose Licene",
236
236
  "future_work": "Future Work",
237
237
  "add_other_fl": "Add Freelance",
@@ -245,5 +245,6 @@
245
245
  "tax_flow_pending": "Tax",
246
246
  "individual_flow_pending": "Individual",
247
247
  "bank_flow_pending": "Bank",
248
- "password_flow_pending": "Password"
248
+ "password_flow_pending": "Password",
249
+ "continue": "Continue"
249
250
  }
@@ -95,7 +95,7 @@ export var BUSINESS_SCREENS_NAVIGATION = [
95
95
  },
96
96
  {
97
97
  name: 'BUSINESS_SUCCESS_STEP',
98
- next: '',
98
+ next: 'BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
99
99
  prev: 'BUSINESS_CUSTOMERS_STEP',
100
100
  order: 6
101
101
  },
@@ -30,15 +30,25 @@ export declare const ICONS_NAMES: {
30
30
  ID_IMAGE: string;
31
31
  MOBILE_IMAGE: string;
32
32
  WHITE_ARROW: string;
33
+ BLACK_ARROW: string;
33
34
  SUCCESS: string;
34
35
  ABSHER_LOGO: string;
35
36
  EMAIL_ICON: string;
36
37
  MOBILE_ICON: string;
37
- GMAIL_ICON: string;
38
- OUTLOOK_ICON: string;
39
- APPLE_MAIL_ICON: string;
40
- TAX_ICON: string;
41
- BANK_ICON: string;
42
- INDIVIDUAL_ICON: string;
43
- PASSWORD_ICON: string;
38
+ GMAIL_Filled_ICON: string;
39
+ GMAIL_White_ICON: string;
40
+ outlook_Filled_ICON: string;
41
+ outlook_White_ICON: string;
42
+ Apple_Filled_ICON: string;
43
+ apple_white_icon: string;
44
+ Tax_filled_icon: string;
45
+ Tax_white_icon: string;
46
+ Bank_filled_icon: string;
47
+ Bank_white_icon: string;
48
+ User_filled_icon: string;
49
+ User_white_icon: string;
50
+ Password_filled_icon: string;
51
+ Password_white_icon: string;
52
+ Arrow_filled_right_icon: string;
53
+ Arrow_white_right_icon: string;
44
54
  };
@@ -30,15 +30,25 @@ export var ICONS_NAMES = {
30
30
  ID_IMAGE: 'https://villageofwarwick.org/wp-content/uploads/2020/02/ICON99-512-1.png',
31
31
  MOBILE_IMAGE: 'https://image.shutterstock.com/image-vector/smartphone-icon-logo-260nw-767440327.jpg',
32
32
  WHITE_ARROW: 'https://tap-connecet.b-cdn.net/imgs/whiteArrow.svg',
33
+ BLACK_ARROW: 'https://dash.b-cdn.net/icons/menu/arrow_right_icon.svg',
33
34
  SUCCESS: 'https://tap-connecet.b-cdn.net/imgs/success.svg',
34
35
  ABSHER_LOGO: 'https://dash.b-cdn.net/icons/menu/Absher.svg',
35
36
  EMAIL_ICON: 'https://dash.b-cdn.net/icons/menu/email.png',
36
37
  MOBILE_ICON: 'https://dash.b-cdn.net/icons/menu/mobile.svg',
37
- GMAIL_ICON: 'https://dash.b-cdn.net/icons/menu/gmail-icon.svg',
38
- OUTLOOK_ICON: 'https://dash.b-cdn.net/icons/menu/outlook-icon.svg',
39
- APPLE_MAIL_ICON: 'https://dash.b-cdn.net/icons/menu/apple-icon.svg',
40
- TAX_ICON: 'https://email-templates.b-cdn.net/file.png',
41
- BANK_ICON: 'https://email-templates.b-cdn.net/dollar_square.png',
42
- INDIVIDUAL_ICON: 'https://email-templates.b-cdn.net/user.png',
43
- PASSWORD_ICON: 'https://email-templates.b-cdn.net/lock_square.png'
38
+ GMAIL_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-filled.svg',
39
+ GMAIL_White_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-white.svg',
40
+ outlook_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Outlook-filled.svg',
41
+ outlook_White_ICON: 'https://dash.b-cdn.net/icons/menu/Outlook-white.svg',
42
+ Apple_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Apple-filled.svg',
43
+ apple_white_icon: 'https://dash.b-cdn.net/icons/menu/Apple-white.svg',
44
+ Tax_filled_icon: 'https://dash.b-cdn.net/icons/menu/tax-filled.svg',
45
+ Tax_white_icon: 'https://dash.b-cdn.net/icons/menu/tax-white.svg',
46
+ Bank_filled_icon: 'https://dash.b-cdn.net/icons/menu/bank-filled.svg',
47
+ Bank_white_icon: 'https://dash.b-cdn.net/icons/menu/bank-white.svg',
48
+ User_filled_icon: 'https://dash.b-cdn.net/icons/menu/user-filled.svg',
49
+ User_white_icon: 'https://dash.b-cdn.net/icons/menu/user-white.svg',
50
+ Password_filled_icon: 'https://dash.b-cdn.net/icons/menu/password-filled.svg',
51
+ Password_white_icon: 'https://dash.b-cdn.net/icons/menu/password-white.svg',
52
+ Arrow_filled_right_icon: 'https://dash.b-cdn.net/icons/menu/right-arrow-filled.svg',
53
+ Arrow_white_right_icon: 'https://dash.b-cdn.net/icons/menu/right-arrow-white.svg'
44
54
  };
@@ -13,15 +13,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import React, { memo, useEffect } from 'react';
14
14
  import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig } from '../../hooks';
15
15
  import { settingsSelector } from '../../app/settings';
16
- import AnimationFlow from '../../components/AnimationFlow';
17
16
  import { store } from '../../app/store';
18
17
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
18
  import Collapse from '../../components/Collapse';
20
19
  import { getParameterByName, reactElement } from '../../utils';
21
- import { FeatureContainer } from '../shared/Containers';
22
20
  import { LANDING_SCREENS_NAVIGATION } from '../../constants';
23
21
  import { landingFeatureScreens } from '../featuresScreens';
24
- import CustomFooter from '../shared/Footer';
25
22
  import { verifyAuthToken } from '../app/landing/landingStore';
26
23
  var Landing = memo(function (props) {
27
24
  var open = React.useState(true)[0];
@@ -41,11 +38,11 @@ var Landing = memo(function (props) {
41
38
  if (!loading)
42
39
  verifyToken();
43
40
  }, [loading]);
44
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: landingFeatureScreens.map(function (_a, index) {
45
- var Element = _a.element, name = _a.name;
46
- var isActive = activeScreen.name === name;
47
- return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
48
- }) }) })) })));
41
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: landingFeatureScreens.map(function (_a, index) {
42
+ var Element = _a.element, name = _a.name;
43
+ var isActive = activeScreen.name === name;
44
+ return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
45
+ }) })));
49
46
  });
50
47
  export function LandingLib(props) {
51
48
  return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Landing, __assign({}, props)) })));
@@ -4,32 +4,18 @@ import Box from '@mui/material/Box/Box';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { settingsSelector } from '../../../../app/settings';
6
6
  import { landingSelector } from '../../../app/landing/landingStore';
7
- import BouncingDotsLoader from '../../../shared/BouncingDotsLoader';
8
7
  import { useAppSelector } from '../../../../hooks';
9
- import Text from '../../../../components/Text';
8
+ import Loader from '../../../../components/AnimationFlow/Loader';
9
+ import Error from '../../../../components/AnimationFlow/Error';
10
10
  import { getParameterByName } from '../../../../utils';
11
- var TextStyledWithThreeDots = styled(Text)(function (_a) {
12
- var theme = _a.theme;
13
- return ({
14
- fontWeight: theme.typography.fontWeightBold,
15
- fontSize: theme.spacing(3),
16
- color: theme.palette.text.primary,
17
- marginBottom: '5px'
18
- });
19
- });
20
11
  var ScreenContainerStyled = styled(Box)(function (_a) {
21
12
  var theme = _a.theme;
22
13
  return ({
23
14
  display: 'flex',
24
- height: theme.spacing(23),
25
15
  justifyContent: 'center',
26
- alignItems: 'center'
27
- });
28
- });
29
- var ContainerStyled = styled(Box)(function (_a) {
30
- var theme = _a.theme;
31
- return ({
32
- display: 'flex'
16
+ alignItems: 'center',
17
+ width: '100vw',
18
+ height: '100vh'
33
19
  });
34
20
  });
35
21
  var VerifyAndRedirect = function (_a) {
@@ -50,6 +36,6 @@ var VerifyAndRedirect = function (_a) {
50
36
  }, 300);
51
37
  }
52
38
  }, [data.verify.responseBody]);
53
- return (_jsxs(ScreenContainerStyled, { children: [isLoading && (_jsxs(ContainerStyled, { children: [_jsx(TextStyledWithThreeDots, { children: "Verifying" }), _jsx(BouncingDotsLoader, {})] })), errorMessage && _jsx(TextStyledWithThreeDots, { children: errorMessage }), !isLoading && !errorMessage && _jsx(TextStyledWithThreeDots, { children: "Verified" })] }));
39
+ return (_jsxs(ScreenContainerStyled, { children: [isLoading && _jsx(Loader, {}), errorMessage && _jsx(Error, { error: errorMessage })] }));
54
40
  };
55
41
  export default React.memo(VerifyAndRedirect);
@@ -166,6 +166,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
166
166
  var initialState = {
167
167
  error: null,
168
168
  loading: false,
169
+ customLoading: false,
169
170
  data: {
170
171
  verify: {
171
172
  token: ''
@@ -198,10 +199,12 @@ export var bankSlice = createSlice({
198
199
  builder
199
200
  .addCase(verifyLeadToken.pending, function (state) {
200
201
  state.error = null;
202
+ state.customLoading = true;
201
203
  })
202
204
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
203
205
  var _a;
204
206
  state.error = null;
207
+ state.customLoading = false;
205
208
  var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
206
209
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
207
210
  if (description) {
@@ -213,6 +216,7 @@ export var bankSlice = createSlice({
213
216
  })
214
217
  .addCase(verifyLeadToken.rejected, function (state, action) {
215
218
  state.error = action.error.message;
219
+ state.customLoading = false;
216
220
  })
217
221
  .addCase(verifyBankLeadOTP.pending, function (state) {
218
222
  state.loading = true;
@@ -29,7 +29,11 @@ export declare const updateLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<{
29
29
  }, {}>;
30
30
  export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<{
31
31
  data: any;
32
- }, void, {}>;
32
+ licenseNumber: string;
33
+ }, {
34
+ leadId: string;
35
+ licenseNumber: string;
36
+ }, {}>;
33
37
  export declare const updateLeadBusinessType: import("@reduxjs/toolkit").AsyncThunk<{
34
38
  data: any;
35
39
  formData: BusinessTypeFormValues;
@@ -58,7 +62,7 @@ export declare const updateCustomersInfo: import("@reduxjs/toolkit").AsyncThunk<
58
62
  export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
59
63
  response: any;
60
64
  formData: void;
61
- }, void, {}>;
65
+ } | undefined, void, {}>;
62
66
  declare type VerifyData = {
63
67
  token: string;
64
68
  };
@@ -60,7 +60,7 @@ import moment from 'moment';
60
60
  import API from '../../../api';
61
61
  import { BusinessType } from '../../../@types';
62
62
  import { BUSINESS_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
- import { convertNumbers2English, getClientEmailUrl, removeRequestHeaders } from '../../../utils';
63
+ import { convertNumbers2English, getFlowUrl, removeRequestHeaders } from '../../../utils';
64
64
  import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
65
65
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var settings, countriesBody, businessCountry;
@@ -80,8 +80,9 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
80
80
  }); });
81
81
  export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
82
82
  var payload, data, leadResponse;
83
- return __generator(this, function (_a) {
84
- switch (_a.label) {
83
+ var _a, _b, _c;
84
+ return __generator(this, function (_d) {
85
+ switch (_d.label) {
85
86
  case 0:
86
87
  payload = {
87
88
  service_name: 'tap_email',
@@ -89,20 +90,23 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
89
90
  };
90
91
  return [4, API.leadService.verifyLeadToken(payload)];
91
92
  case 1:
92
- data = (_a.sent()).data;
93
+ data = (_d.sent()).data;
93
94
  leadResponse = undefined;
94
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 3];
95
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 4];
95
96
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
96
97
  case 2:
97
- leadResponse = _a.sent();
98
+ leadResponse = _d.sent();
99
+ return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id, licenseNumber: (_c = (_b = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.entity) === null || _b === void 0 ? void 0 : _b.license) === null || _c === void 0 ? void 0 : _c.number }))];
100
+ case 3:
101
+ _d.sent();
98
102
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
99
103
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
100
104
  }
101
105
  if (data.step_name === 'business_info') {
102
106
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
103
107
  }
104
- _a.label = 3;
105
- case 3: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
108
+ _d.label = 4;
109
+ case 4: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
106
110
  }
107
111
  });
108
112
  }); });
@@ -180,17 +184,13 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
180
184
  });
181
185
  }); });
182
186
  export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
183
- var business, leadId, data;
184
- var _a;
185
- return __generator(this, function (_b) {
186
- switch (_b.label) {
187
- case 0:
188
- business = thunkApi.getState().business;
189
- leadId = (_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id;
190
- return [4, API.leadService.retrieveEntityList(leadId)];
187
+ var data;
188
+ return __generator(this, function (_a) {
189
+ switch (_a.label) {
190
+ case 0: return [4, API.leadService.retrieveEntityList(params.leadId)];
191
191
  case 1:
192
- data = (_b.sent()).data;
193
- return [2, { data: data }];
192
+ data = (_a.sent()).data;
193
+ return [2, { data: data, licenseNumber: params.licenseNumber }];
194
194
  }
195
195
  });
196
196
  }); });
@@ -212,11 +212,13 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
212
212
  return [4, API.leadService.updateLead(payload)];
213
213
  case 1:
214
214
  data = (_g.sent()).data;
215
- if (!data.errors) {
216
- thunkApi.dispatch(createAccount());
217
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
218
- }
219
- return [2, { data: data, formData: params }];
215
+ if (!!data.errors) return [3, 3];
216
+ return [4, thunkApi.dispatch(createAccount())];
217
+ case 2:
218
+ _g.sent();
219
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
220
+ _g.label = 3;
221
+ case 3: return [2, { data: data, formData: params }];
220
222
  }
221
223
  });
222
224
  }); });
@@ -339,33 +341,51 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
339
341
  });
340
342
  }); });
341
343
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
342
- var _a, settings, business, response, payload;
343
- var _b, _c, _d, _e, _f, _g;
344
- return __generator(this, function (_h) {
345
- switch (_h.label) {
344
+ var _a, settings, business, id, payload, data;
345
+ var _b, _c, _d, _e;
346
+ return __generator(this, function (_f) {
347
+ switch (_f.label) {
346
348
  case 0:
347
349
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
348
- response = undefined;
349
- if (!!!((_b = business.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 2];
350
+ id = (business.data.otpData.responseBody || {}).id;
351
+ if (!id)
352
+ return [2];
350
353
  payload = {
351
354
  step_name: BUSINESS_STEP_NAMES.BUSINESS_SUCCESS,
352
- id: ((_c = business.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
353
- email_url: getClientEmailUrl(),
355
+ id: id,
356
+ flows: [
357
+ {
358
+ name: 'tax',
359
+ url: getFlowUrl('/tax')
360
+ },
361
+ {
362
+ name: 'bank',
363
+ url: getFlowUrl('/bank')
364
+ },
365
+ {
366
+ name: 'individual',
367
+ url: getFlowUrl('/individual')
368
+ },
369
+ {
370
+ name: 'password',
371
+ url: getFlowUrl('/password')
372
+ }
373
+ ],
354
374
  encryption_contract: []
355
375
  };
356
376
  return [4, API.leadService.updateLead(payload)];
357
377
  case 1:
358
- response = _h.sent();
359
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
360
- (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: response === null || response === void 0 ? void 0 : response.data });
361
- _h.label = 2;
362
- case 2: return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
378
+ data = (_f.sent()).data;
379
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, params);
380
+ (_e = (_d = settings.data.appConfig).onFlowCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, { data: data });
381
+ return [2, { response: data, formData: params }];
363
382
  }
364
383
  });
365
384
  }); });
366
385
  var initialState = {
367
386
  error: null,
368
387
  loading: false,
388
+ customLoading: false,
369
389
  data: {
370
390
  businessCountry: defaultCountry,
371
391
  countries: [],
@@ -416,23 +436,28 @@ export var businessSlice = createSlice({
416
436
  builder
417
437
  .addCase(getCountries.fulfilled, function (state, action) {
418
438
  state.error = null;
439
+ state.customLoading = false;
419
440
  var _a = action.payload, businessCountry = _a.businessCountry, countries = _a.countries;
420
441
  state.data.countries = countries;
421
442
  state.data.businessCountry = businessCountry || defaultCountry;
422
443
  })
423
444
  .addCase(getCountries.pending, function (state) {
424
445
  state.error = null;
446
+ state.customLoading = true;
425
447
  })
426
448
  .addCase(getCountries.rejected, function (state, action) {
427
449
  state.error = action.error.message;
450
+ state.customLoading = false;
428
451
  })
429
452
  .addCase(verifyLeadToken.pending, function (state) {
430
453
  state.error = null;
454
+ state.customLoading = true;
431
455
  })
432
456
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
433
- var _a, _b, _c, _d, _e;
457
+ var _a;
434
458
  state.error = null;
435
- var _f = action.payload, data = _f.data, token = _f.token, leadData = _f.leadData;
459
+ state.customLoading = false;
460
+ var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
436
461
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
437
462
  if (description) {
438
463
  state.error = description;
@@ -441,16 +466,10 @@ export var businessSlice = createSlice({
441
466
  state.data.verify.responseBody = __assign(__assign({}, data), leadData);
442
467
  state.data.verify.token = token;
443
468
  state.data.otpData.isNID = false;
444
- if (!!((_c = (_b = leadData === null || leadData === void 0 ? void 0 : leadData.entity) === null || _b === void 0 ? void 0 : _b.license) === null || _c === void 0 ? void 0 : _c.issuing_date)) {
445
- state.data.activitiesData.operationStartDate = convertNumbers2English(moment((_e = (_d = leadData === null || leadData === void 0 ? void 0 : leadData.entity) === null || _d === void 0 ? void 0 : _d.license) === null || _e === void 0 ? void 0 : _e.issuing_date).format('YYYY-MM-DD'));
446
- }
447
- var activities = (leadData === null || leadData === void 0 ? void 0 : leadData.entity_activities) || [];
448
- var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
449
- if (!!selectedActivity)
450
- state.data.activitiesData.activities = [selectedActivity];
451
469
  })
452
470
  .addCase(verifyLeadToken.rejected, function (state, action) {
453
471
  state.error = action.error.message;
472
+ state.customLoading = false;
454
473
  })
455
474
  .addCase(verifyLeadOTP.pending, function (state) {
456
475
  state.loading = true;
@@ -474,13 +493,17 @@ export var businessSlice = createSlice({
474
493
  state.error = action.error.message;
475
494
  })
476
495
  .addCase(updateLeadIdentity.pending, function (state, action) {
477
- var _a;
478
- state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
496
+ var _a, _b;
497
+ if ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend)
498
+ state.customLoading = true;
499
+ if ((_b = action.meta.arg) === null || _b === void 0 ? void 0 : _b.isResend)
500
+ state.loading = true;
479
501
  state.error = null;
480
502
  })
481
503
  .addCase(updateLeadIdentity.fulfilled, function (state, action) {
482
504
  var _a;
483
505
  state.loading = false;
506
+ state.customLoading = false;
484
507
  state.error = null;
485
508
  var _b = action.payload, data = _b.data, formData = _b.formData;
486
509
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
@@ -495,15 +518,18 @@ export var businessSlice = createSlice({
495
518
  })
496
519
  .addCase(updateLeadIdentity.rejected, function (state, action) {
497
520
  state.loading = false;
521
+ state.customLoading = false;
498
522
  state.error = action.error.message;
499
523
  })
500
524
  .addCase(retrieveEntityList.pending, function (state) {
501
525
  state.error = null;
526
+ state.customLoading = true;
502
527
  })
503
528
  .addCase(retrieveEntityList.fulfilled, function (state, action) {
504
- var _a, _b;
529
+ var _a, _b, _c;
505
530
  state.error = null;
506
- var data = action.payload.data;
531
+ state.customLoading = false;
532
+ var _d = action.payload, data = _d.data, licenseNumber = _d.licenseNumber;
507
533
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
508
534
  var licenseList = [];
509
535
  if (!description) {
@@ -522,37 +548,38 @@ export var businessSlice = createSlice({
522
548
  }
523
549
  licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
524
550
  state.data.businessTypeData.responseBody = { licenseList: licenseList };
525
- var selectedLicense = licenseList === null || licenseList === void 0 ? void 0 : licenseList[0];
551
+ var selectedLicense = ((_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (item) { var _a; return ((_a = item.license) === null || _a === void 0 ? void 0 : _a.number) === licenseNumber; })) || (licenseList === null || licenseList === void 0 ? void 0 : licenseList[0]);
526
552
  state.data.businessTypeData.selectedLicense = selectedLicense;
527
- state.data.businessTypeData.licenseNumber = (_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.number;
553
+ state.data.businessTypeData.licenseNumber = (_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number;
528
554
  })
529
555
  .addCase(retrieveEntityList.rejected, function (state, action) {
530
556
  state.error = action.error.message;
557
+ state.customLoading = false;
531
558
  })
532
559
  .addCase(updateLeadBusinessType.pending, function (state) {
533
560
  state.loading = true;
534
561
  state.error = null;
535
562
  })
536
563
  .addCase(updateLeadBusinessType.fulfilled, function (state, action) {
537
- var _a, _b, _c, _d, _e;
538
- state.loading = true;
564
+ var _a, _b, _c, _d;
565
+ state.loading = false;
539
566
  state.error = null;
540
- var _f = action.payload, data = _f.data, formData = _f.formData;
567
+ var _e = action.payload, data = _e.data, formData = _e.formData;
541
568
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
542
569
  if (description) {
543
570
  state.error = description;
544
571
  return;
545
572
  }
546
573
  state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
547
- if (!!((_c = (_b = data === null || data === void 0 ? void 0 : data.entity) === null || _b === void 0 ? void 0 : _b.license) === null || _c === void 0 ? void 0 : _c.issuing_date)) {
548
- state.data.activitiesData.operationStartDate = convertNumbers2English(moment((_e = (_d = data === null || data === void 0 ? void 0 : data.entity) === null || _d === void 0 ? void 0 : _d.license) === null || _e === void 0 ? void 0 : _e.issuing_date).format('YYYY-MM-DD'));
574
+ var entity = data.entity, entity_activities = data.entity_activities;
575
+ if (!!((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date)) {
576
+ state.data.activitiesData.operationStartDate = convertNumbers2English(moment((_d = (_c = data === null || data === void 0 ? void 0 : data.entity) === null || _c === void 0 ? void 0 : _c.license) === null || _d === void 0 ? void 0 : _d.issuing_date).format('YYYY-MM-DD'));
549
577
  }
550
- var activities = (data === null || data === void 0 ? void 0 : data.entity_activities) || [];
578
+ var activities = entity_activities || [];
551
579
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
552
580
  if (!!selectedActivity)
553
581
  state.data.activitiesData.activities = [selectedActivity];
554
- var licenseList = (state.data.businessTypeData.responseBody || { licenseList: [] }).licenseList;
555
- state.data.businessTypeData.responseBody = __assign(__assign({ licenseList: licenseList }, data), { activities: activities });
582
+ state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { activities: activities });
556
583
  })
557
584
  .addCase(updateLeadBusinessType.rejected, function (state, action) {
558
585
  state.loading = false;
@@ -656,7 +683,7 @@ export var businessSlice = createSlice({
656
683
  var _a;
657
684
  state.loading = false;
658
685
  state.error = null;
659
- var response = action.payload.response;
686
+ var response = (action.payload || {}).response;
660
687
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
661
688
  if (description) {
662
689
  state.error = description;