@tap-payments/auth-jsconnect 1.0.54 → 1.0.57

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 (42) hide show
  1. package/build/@types/app.d.ts +1 -0
  2. package/build/@types/form.d.ts +2 -8
  3. package/build/app/rootReducer.d.ts +1 -0
  4. package/build/app/rootReducer.js +3 -1
  5. package/build/app/store.d.ts +2 -0
  6. package/build/assets/locales/ar.json +7 -1
  7. package/build/assets/locales/en.json +7 -1
  8. package/build/constants/app.d.ts +22 -1
  9. package/build/constants/app.js +29 -0
  10. package/build/constants/dummy.d.ts +0 -9
  11. package/build/constants/dummy.js +0 -9
  12. package/build/features/Landing/Landing.d.ts +7 -0
  13. package/build/features/Landing/Landing.js +58 -0
  14. package/build/features/Landing/index.d.ts +1 -0
  15. package/build/features/Landing/index.js +1 -0
  16. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +5 -0
  17. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +55 -0
  18. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +2 -0
  19. package/build/features/Landing/screens/VerifyAndRedirect/index.js +2 -0
  20. package/build/features/app/business/businessStore.d.ts +2 -10
  21. package/build/features/app/business/businessStore.js +41 -25
  22. package/build/features/app/landing/landingStore.d.ts +22 -0
  23. package/build/features/app/landing/landingStore.js +103 -0
  24. package/build/features/business/screens/Activities/ActivitiesList.js +4 -3
  25. package/build/features/business/screens/BusinessType/BusinessType.js +12 -24
  26. package/build/features/business/screens/BusinessType/LicenseList.d.ts +8 -0
  27. package/build/features/business/screens/BusinessType/LicenseList.js +124 -0
  28. package/build/features/business/screens/BusinessType/LicenseNumber.d.ts +7 -0
  29. package/build/features/business/screens/BusinessType/LicenseNumber.js +46 -0
  30. package/build/features/business/screens/BusinessType/validation.d.ts +7 -11
  31. package/build/features/business/screens/BusinessType/validation.js +22 -5
  32. package/build/features/featuresScreens.d.ts +1 -0
  33. package/build/features/featuresScreens.js +7 -0
  34. package/build/features/shared/BouncingDotsLoader/BouncingDotsLoader.d.ts +3 -0
  35. package/build/features/shared/BouncingDotsLoader/BouncingDotsLoader.js +31 -0
  36. package/build/features/shared/BouncingDotsLoader/index.d.ts +2 -0
  37. package/build/features/shared/BouncingDotsLoader/index.js +2 -0
  38. package/build/hooks/useAppDispatch.d.ts +1 -0
  39. package/build/index.d.ts +3 -2
  40. package/build/index.js +5 -2
  41. package/build/utils/string.js +1 -4
  42. package/package.json +1 -1
@@ -67,6 +67,7 @@ export interface License {
67
67
  license: {
68
68
  number: string;
69
69
  };
70
+ type: string;
70
71
  }
71
72
  export interface Activity {
72
73
  ar: string;
@@ -1,4 +1,4 @@
1
- import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, SalesChannel, SourceOfIncome } from './app';
1
+ import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, SalesChannel, SourceOfIncome } from './app';
2
2
  export declare type MobileFormValues = {
3
3
  mobile: string | null;
4
4
  countryCode: CountryCode;
@@ -30,14 +30,8 @@ export declare type BrandFormValues = {
30
30
  selectedBrandItem: BrandInfo;
31
31
  };
32
32
  export declare type BusinessTypeFormValues = {
33
- businessType: string;
34
- flNumber: string;
35
- crNumber: string;
36
- };
37
- export declare type BusinessInfoFormValues = {
38
33
  licenseNumber: string;
39
- brandName: string;
40
- legalName: string;
34
+ selectedLicense?: License;
41
35
  };
42
36
  export declare type ActivitiesFormValues = {
43
37
  activities: Array<Activity> | undefined;
@@ -6,5 +6,6 @@ declare const rootReducer: {
6
6
  tax: import("redux").Reducer<import("../features/app/tax/taxStore").TaxState, import("redux").AnyAction>;
7
7
  individual: import("redux").Reducer<import("../features/app/individual/individualStore").IndividualState, import("redux").AnyAction>;
8
8
  password: import("redux").Reducer<import("../features/app/password/passwordStore").PasswordState, import("redux").AnyAction>;
9
+ landing: import("redux").Reducer<import("../features/app/landing/landingStore").LandingState, import("redux").AnyAction>;
9
10
  };
10
11
  export default rootReducer;
@@ -5,6 +5,7 @@ import bank from '../features/app/bank/bankStore';
5
5
  import tax from '../features/app/tax/taxStore';
6
6
  import individual from '../features/app/individual/individualStore';
7
7
  import password from '../features/app/password/passwordStore';
8
+ import landing from '../features/app/landing/landingStore';
8
9
  var rootReducer = {
9
10
  settings: settings,
10
11
  connect: connect,
@@ -12,6 +13,7 @@ var rootReducer = {
12
13
  bank: bank,
13
14
  tax: tax,
14
15
  individual: individual,
15
- password: password
16
+ password: password,
17
+ landing: landing
16
18
  };
17
19
  export default rootReducer;
@@ -7,6 +7,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
7
7
  tax: import("../features/app/tax/taxStore").TaxState;
8
8
  individual: import("../features/app/individual/individualStore").IndividualState;
9
9
  password: import("../features/app/password/passwordStore").PasswordState;
10
+ landing: import("../features/app/landing/landingStore").LandingState;
10
11
  }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<{
11
12
  settings: import("./settings").SettingsState;
12
13
  connect: import("../features/app/connect/connectStore").ConnectState;
@@ -15,6 +16,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
15
16
  tax: import("../features/app/tax/taxStore").TaxState;
16
17
  individual: import("../features/app/individual/individualStore").IndividualState;
17
18
  password: import("../features/app/password/passwordStore").PasswordState;
19
+ landing: import("../features/app/landing/landingStore").LandingState;
18
20
  }, import("redux").AnyAction, undefined>]>>;
19
21
  export declare type AppDispatch = typeof store.dispatch;
20
22
  export declare type RootState = ReturnType<typeof store.getState>;
@@ -214,5 +214,11 @@
214
214
  "mobile_button_label": "المتابعة عن طريق رقم الجوال",
215
215
  "select_brand_label": "Brand List",
216
216
  "choose_brand": "Choose Brand",
217
- "confirm_enter_iban": "الايبان"
217
+ "confirm_enter_iban": "الايبان",
218
+ "choose_any_license": "Choose Licene",
219
+ "future_work": "Future Work",
220
+ "add_other_fl": "Add Freelance",
221
+ "add_other_cr": "Add CR",
222
+ "cr_number": "CR Number",
223
+ "fl_number": "FL Number"
218
224
  }
@@ -228,5 +228,11 @@
228
228
  "open_mail_box": "Open Mailbox",
229
229
  "select_brand_label": "Brand List",
230
230
  "choose_brand": "Choose Brand",
231
- "confirm_enter_iban": "IBAN"
231
+ "confirm_enter_iban": "IBAN",
232
+ "choose_any_license": "Choose Licene",
233
+ "future_work": "Future Work",
234
+ "add_other_fl": "Add Freelance",
235
+ "add_other_cr": "Add CR",
236
+ "cr_number": "CR Number",
237
+ "fl_number": "FL Number"
232
238
  }
@@ -1,4 +1,4 @@
1
- import { ScreenStepNavigation } from '../@types';
1
+ import { ScreenStepNavigation, BusinessType } from '../@types';
2
2
  export declare const CLIENT_ORIGIN: string;
3
3
  export declare const LOCAL_STORAGE_KEYS: {
4
4
  themeMode: string;
@@ -18,6 +18,7 @@ export declare const INDIVIDUAL_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
18
18
  export declare const PASSWORD_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
19
19
  export declare const BANK_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
20
20
  export declare const TAX_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
21
+ export declare const LANDING_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
21
22
  export declare const DefaultDeviceInfo: {
22
23
  source: string;
23
24
  device: {
@@ -118,3 +119,23 @@ export declare const ENCRYPTION_FLAG = "encryption_contract";
118
119
  export declare const BACKEND_ENCRYPTION_FLAG = "backend_encryption_contract";
119
120
  export declare const INSTAGRAM_URL = "https://www.instagram.com";
120
121
  export declare const TWITTER_URL = "https://twitter.com";
122
+ export declare const OTHER_FL_LICENSE: {
123
+ legal_name: {
124
+ ar: string;
125
+ en: string;
126
+ };
127
+ license: {
128
+ number: string;
129
+ };
130
+ type: BusinessType;
131
+ };
132
+ export declare const OTHER_CR_LICENSE: {
133
+ legal_name: {
134
+ ar: string;
135
+ en: string;
136
+ };
137
+ license: {
138
+ number: string;
139
+ };
140
+ type: BusinessType;
141
+ };
@@ -1,3 +1,4 @@
1
+ import { BusinessType } from '../@types';
1
2
  export var CLIENT_ORIGIN = window.location.origin;
2
3
  export var LOCAL_STORAGE_KEYS = {
3
4
  themeMode: 'themeMode',
@@ -185,6 +186,14 @@ export var TAX_SCREENS_NAVIGATION = [
185
186
  order: 3
186
187
  }
187
188
  ];
189
+ export var LANDING_SCREENS_NAVIGATION = [
190
+ {
191
+ name: 'LANDING_VERIFY_AND_REDIRECT_STEP',
192
+ next: '',
193
+ prev: '',
194
+ order: 1
195
+ }
196
+ ];
188
197
  export var DefaultDeviceInfo = {
189
198
  source: 'browser',
190
199
  device: {
@@ -285,3 +294,23 @@ export var ENCRYPTION_FLAG = 'encryption_contract';
285
294
  export var BACKEND_ENCRYPTION_FLAG = 'backend_encryption_contract';
286
295
  export var INSTAGRAM_URL = 'https://www.instagram.com';
287
296
  export var TWITTER_URL = 'https://twitter.com';
297
+ export var OTHER_FL_LICENSE = {
298
+ legal_name: {
299
+ ar: 'add_other_fl',
300
+ en: 'add_other_fl'
301
+ },
302
+ license: {
303
+ number: 'other_fl'
304
+ },
305
+ type: BusinessType.FL
306
+ };
307
+ export var OTHER_CR_LICENSE = {
308
+ legal_name: {
309
+ ar: 'add_other_cr',
310
+ en: 'add_other_cr'
311
+ },
312
+ license: {
313
+ number: 'other_cr'
314
+ },
315
+ type: BusinessType.CR
316
+ };
@@ -1,12 +1,3 @@
1
- export declare const OTHER_LICENSE: {
2
- legal_name: {
3
- ar: string;
4
- en: string;
5
- };
6
- license: {
7
- number: string;
8
- };
9
- };
10
1
  export declare const OTHER_BRAND: {
11
2
  id: string;
12
3
  name: {
@@ -1,12 +1,3 @@
1
- export var OTHER_LICENSE = {
2
- legal_name: {
3
- ar: 'other',
4
- en: 'other'
5
- },
6
- license: {
7
- number: 'other'
8
- }
9
- };
10
1
  export var OTHER_BRAND = {
11
2
  id: 'other',
12
3
  name: {
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { LibConfig } from '../../@types';
3
+ export interface LandingProps extends LibConfig {
4
+ }
5
+ export declare function LandingLib(props: LandingProps): JSX.Element;
6
+ export declare function renderLandingLib(config: LandingProps, elementId: string): void;
7
+ export declare function unmountLandingLib(elementId: string): void;
@@ -0,0 +1,58 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import React, { memo, useEffect } from 'react';
14
+ import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig } from '../../hooks';
15
+ import { settingsSelector } from '../../app/settings';
16
+ import AnimationFlow from '../../components/AnimationFlow';
17
+ import { store } from '../../app/store';
18
+ import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
+ import Collapse from '../../components/Collapse';
20
+ import { getParameterByName, reactElement } from '../../utils';
21
+ import { FeatureContainer } from '../shared/Containers';
22
+ import { LANDING_SCREENS_NAVIGATION } from '../../constants';
23
+ import { landingFeatureScreens } from '../featuresScreens';
24
+ import CustomFooter from '../shared/Footer';
25
+ import { verifyAuthToken } from '../app/landing/landingStore';
26
+ var Landing = memo(function (props) {
27
+ var open = React.useState(true)[0];
28
+ var theme = useAppTheme().theme;
29
+ var dispatch = useAppDispatch();
30
+ var data = useAppSelector(settingsSelector).data;
31
+ var loading = useAppConfig(__assign({ navigation: LANDING_SCREENS_NAVIGATION }, props)).loading;
32
+ useErrorListener();
33
+ var activeScreen = data.activeScreen;
34
+ var verifyToken = function () {
35
+ var token = getParameterByName('token');
36
+ if (!token)
37
+ throw new Error('Auth token is not found!');
38
+ dispatch(verifyAuthToken(token));
39
+ };
40
+ useEffect(function () {
41
+ if (!loading)
42
+ verifyToken();
43
+ }, [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
+ }) }) })) })));
49
+ });
50
+ export function LandingLib(props) {
51
+ return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Landing, __assign({}, props)) })));
52
+ }
53
+ export function renderLandingLib(config, elementId) {
54
+ reactElement(elementId).render(_jsx(LandingLib, __assign({}, config)));
55
+ }
56
+ export function unmountLandingLib(elementId) {
57
+ reactElement(elementId).unmount();
58
+ }
@@ -0,0 +1 @@
1
+ export * from './Landing';
@@ -0,0 +1 @@
1
+ export * from './Landing';
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface VerifyAndRedirectProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: VerifyAndRedirectProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import Box from '@mui/material/Box/Box';
4
+ import { styled } from '@mui/material/styles';
5
+ import { settingsSelector } from '../../../../app/settings';
6
+ import { landingSelector } from '../../../app/landing/landingStore';
7
+ import BouncingDotsLoader from '../../../shared/BouncingDotsLoader';
8
+ import { useAppSelector } from '../../../../hooks';
9
+ import Text from '../../../../components/Text';
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
+ var ScreenContainerStyled = styled(Box)(function (_a) {
21
+ var theme = _a.theme;
22
+ return ({
23
+ display: 'flex',
24
+ height: theme.spacing(23),
25
+ justifyContent: 'center',
26
+ alignItems: 'center'
27
+ });
28
+ });
29
+ var ContainerStyled = styled(Box)(function (_a) {
30
+ var theme = _a.theme;
31
+ return ({
32
+ display: 'flex'
33
+ });
34
+ });
35
+ var VerifyAndRedirect = function (_a) {
36
+ var _b = useAppSelector(settingsSelector), sLoading = _b.loading, sError = _b.error;
37
+ var _c = useAppSelector(landingSelector), data = _c.data, error = _c.error, loading = _c.loading;
38
+ var isLoading = sLoading || loading;
39
+ var errorMessage = sError || error;
40
+ var token = getParameterByName('token');
41
+ var getFlowName = function (stepName) {
42
+ return stepName.split('_')[0];
43
+ };
44
+ React.useEffect(function () {
45
+ var step_name = (data.verify.responseBody || {}).step_name;
46
+ if (step_name) {
47
+ var flowName_1 = getFlowName(step_name);
48
+ setTimeout(function () {
49
+ window.location.href = "".concat(window.location.origin, "/").concat(flowName_1, "?token=").concat(token);
50
+ }, 300);
51
+ }
52
+ }, [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" })] }));
54
+ };
55
+ export default React.memo(VerifyAndRedirect);
@@ -0,0 +1,2 @@
1
+ import VerifyAndRedirect from './VerifyAndRedirect';
2
+ export default VerifyAndRedirect;
@@ -0,0 +1,2 @@
1
+ import VerifyAndRedirect from './VerifyAndRedirect';
2
+ export default VerifyAndRedirect;
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, CountryCode, License, NIDFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, CountryCode, NIDFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  businessCountry: any;
5
5
  countries: any;
@@ -53,13 +53,7 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
53
53
  }, void, {}>;
54
54
  export declare const updateCustomersInfo: import("@reduxjs/toolkit").AsyncThunk<{
55
55
  data: any;
56
- formData: {
57
- customerLocations: import("../../../@types").CustomerLocation[];
58
- expectedCustomer: import("../../../@types").ExpectedCustomer | undefined;
59
- expectedSalesRange: import("../../../@types").ExpectedSaleRange | undefined;
60
- refundPolicy: boolean;
61
- transactionPolicy: boolean;
62
- };
56
+ formData: CustomersFormValues;
63
57
  }, CustomersFormValues, {}>;
64
58
  export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
65
59
  response: any;
@@ -79,8 +73,6 @@ export interface BusinessData {
79
73
  type: string;
80
74
  };
81
75
  businessTypeData: BusinessTypeFormValues & ResponseData;
82
- crInfos: Array<License>;
83
- flInfos: Array<License>;
84
76
  activitiesData: ActivitiesFormValues & ResponseData;
85
77
  customersData: CustomersFormValues & ResponseData;
86
78
  }
@@ -45,13 +45,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
48
57
  var _a;
49
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
59
  import moment from 'moment';
51
60
  import API from '../../../api';
52
61
  import { BusinessType } from '../../../@types';
53
- import { BUSINESS_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE } from '../../../constants';
54
- import { convertNumbers2English, removeRequestHeaders } from '../../../utils';
62
+ import { BUSINESS_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
+ import { convertNumbers2English, getClientEmailUrl, removeRequestHeaders } from '../../../utils';
55
64
  import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
56
65
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
57
66
  var settings, countriesBody, businessCountry;
@@ -189,25 +198,25 @@ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function
189
198
  }); });
190
199
  export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
191
200
  var _a, settings, business, payload, data;
192
- var _b, _c, _d;
193
- return __generator(this, function (_e) {
194
- switch (_e.label) {
201
+ var _b, _c, _d, _e, _f;
202
+ return __generator(this, function (_g) {
203
+ switch (_g.label) {
195
204
  case 0:
196
205
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
197
206
  payload = {
198
207
  id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
199
- license_number: params.businessType === BusinessType.FL ? params.flNumber : params.crNumber,
200
- license_type: params.businessType === BusinessType.FL ? 'freelance' : 'commercial_registration',
201
- business_type: params.businessType,
208
+ license_number: params.licenseNumber,
209
+ license_type: ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL ? 'freelance' : 'commercial_registration',
210
+ business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
202
211
  step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO,
203
212
  encryption_contract: ['license_number', 'business_type', 'license_type']
204
213
  };
205
214
  return [4, API.leadService.updateLead(payload)];
206
215
  case 1:
207
- data = (_e.sent()).data;
216
+ data = (_g.sent()).data;
208
217
  if (!data.errors) {
209
218
  thunkApi.dispatch(createAccount());
210
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
219
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
211
220
  }
212
221
  return [2, { data: data, formData: params }];
213
222
  }
@@ -327,7 +336,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
327
336
  thunkApi.dispatch(handleNextScreenStep());
328
337
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
329
338
  }
330
- return [2, { data: data, formData: __assign({}, params) }];
339
+ return [2, { data: data, formData: params }];
331
340
  }
332
341
  });
333
342
  }); });
@@ -343,6 +352,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
343
352
  payload = {
344
353
  step_name: BUSINESS_STEP_NAMES.BUSINESS_SUCCESS,
345
354
  id: ((_c = business.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
355
+ email_url: getClientEmailUrl(),
346
356
  encryption_contract: []
347
357
  };
348
358
  return [4, API.leadService.updateLead(payload)];
@@ -374,12 +384,8 @@ var initialState = {
374
384
  type: ''
375
385
  },
376
386
  businessTypeData: {
377
- businessType: BusinessType.FL,
378
- flNumber: '',
379
- crNumber: ''
387
+ licenseNumber: ''
380
388
  },
381
- crInfos: [],
382
- flInfos: [],
383
389
  activitiesData: {
384
390
  activities: [],
385
391
  salesChannels: [],
@@ -497,22 +503,30 @@ export var businessSlice = createSlice({
497
503
  state.error = null;
498
504
  })
499
505
  .addCase(retrieveEntityList.fulfilled, function (state, action) {
500
- var _a;
506
+ var _a, _b;
501
507
  state.error = null;
502
508
  var data = action.payload.data;
503
509
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
510
+ var licenseList = [];
504
511
  if (!description) {
505
512
  var fl = data.fl, cr = data.cr;
506
513
  if (Array.isArray(cr) && cr.length > 0) {
507
- state.data.crInfos = cr;
508
- state.data.businessTypeData.businessType = BusinessType.CR;
509
- return;
514
+ licenseList = cr.map(function (item) {
515
+ return __assign(__assign({}, item), { type: BusinessType.CR });
516
+ });
510
517
  }
511
518
  if (Array.isArray(fl) && fl.length > 0) {
512
- state.data.flInfos = fl;
513
- state.data.businessTypeData.businessType = BusinessType.FL;
519
+ var mappedFL = fl.map(function (item) {
520
+ return __assign(__assign({}, item), { type: BusinessType.FL });
521
+ });
522
+ licenseList = __spreadArray(__spreadArray([], licenseList, true), mappedFL, true);
514
523
  }
515
524
  }
525
+ licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
526
+ state.data.businessTypeData.responseBody = { licenseList: licenseList };
527
+ var selectedLicense = licenseList === null || licenseList === void 0 ? void 0 : licenseList[0];
528
+ state.data.businessTypeData.selectedLicense = selectedLicense;
529
+ state.data.businessTypeData.licenseNumber = (_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.number;
516
530
  })
517
531
  .addCase(retrieveEntityList.rejected, function (state, action) {
518
532
  state.error = action.error.message;
@@ -531,7 +545,7 @@ export var businessSlice = createSlice({
531
545
  state.error = description;
532
546
  return;
533
547
  }
534
- state.data.businessTypeData = formData;
548
+ state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
535
549
  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)) {
536
550
  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'));
537
551
  }
@@ -539,7 +553,8 @@ export var businessSlice = createSlice({
539
553
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
540
554
  if (!!selectedActivity)
541
555
  state.data.activitiesData.activities = [selectedActivity];
542
- state.data.businessTypeData.responseBody = __assign(__assign({}, data), { activities: activities });
556
+ var licenseList = (state.data.businessTypeData.responseBody || { licenseList: [] }).licenseList;
557
+ state.data.businessTypeData.responseBody = __assign(__assign({ licenseList: licenseList }, data), { activities: activities });
543
558
  })
544
559
  .addCase(updateLeadBusinessType.rejected, function (state, action) {
545
560
  state.loading = false;
@@ -563,7 +578,8 @@ export var businessSlice = createSlice({
563
578
  state.error = 'signup_user_exists_error';
564
579
  return;
565
580
  }
566
- state.data.businessTypeData.responseBody = __assign(__assign({}, data), { channelList: channelsData || [] });
581
+ var licenseList = (state.data.businessTypeData.responseBody || { licenseList: [] }).licenseList;
582
+ state.data.businessTypeData.responseBody = __assign(__assign({ licenseList: licenseList }, data), { channelList: channelsData || [] });
567
583
  var selectedChannel = channelsData === null || channelsData === void 0 ? void 0 : channelsData[0];
568
584
  if (!!selectedChannel)
569
585
  state.data.activitiesData.salesChannels = [selectedChannel];
@@ -0,0 +1,22 @@
1
+ import { RootState } from '../../../app/store';
2
+ import { ResponseData, SharedState } from '../../../@types';
3
+ export declare const verifyAuthToken: import("@reduxjs/toolkit").AsyncThunk<{
4
+ data: any;
5
+ token: string;
6
+ }, string, {}>;
7
+ declare type VerifyData = {
8
+ token: string;
9
+ };
10
+ export interface LandingData {
11
+ verify: ResponseData & VerifyData;
12
+ }
13
+ export interface LandingState extends SharedState<LandingData> {
14
+ }
15
+ export declare const landingSlice: import("@reduxjs/toolkit").Slice<LandingState, {
16
+ clearError: (state: LandingState) => void;
17
+ stopLoader: (state: LandingState) => void;
18
+ }, "landing/store">;
19
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
20
+ declare const _default: import("redux").Reducer<LandingState, import("redux").AnyAction>;
21
+ export default _default;
22
+ export declare const landingSelector: (state: RootState) => LandingState;
@@ -0,0 +1,103 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ var _a;
38
+ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
39
+ import API from '../../../api';
40
+ export var verifyAuthToken = createAsyncThunk('verifyAuthToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
41
+ var payload, data;
42
+ return __generator(this, function (_a) {
43
+ switch (_a.label) {
44
+ case 0:
45
+ payload = {
46
+ service_name: 'tap_email',
47
+ verify_token: token
48
+ };
49
+ return [4, API.leadService.verifyLeadToken(payload)];
50
+ case 1:
51
+ data = (_a.sent()).data;
52
+ return [2, { data: data, token: token }];
53
+ }
54
+ });
55
+ }); });
56
+ var initialState = {
57
+ error: null,
58
+ loading: false,
59
+ data: {
60
+ verify: {
61
+ token: ''
62
+ }
63
+ }
64
+ };
65
+ export var landingSlice = createSlice({
66
+ name: 'landing/store',
67
+ initialState: initialState,
68
+ reducers: {
69
+ clearError: function (state) {
70
+ state.error = null;
71
+ },
72
+ stopLoader: function (state) {
73
+ state.loading = false;
74
+ }
75
+ },
76
+ extraReducers: function (builder) {
77
+ builder
78
+ .addCase(verifyAuthToken.fulfilled, function (state, action) {
79
+ var _a;
80
+ state.loading = false;
81
+ state.error = null;
82
+ var _b = action.payload, data = _b.data, token = _b.token;
83
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
84
+ if (description) {
85
+ state.error = description;
86
+ return;
87
+ }
88
+ state.data.verify.responseBody = data;
89
+ state.data.verify.token = token;
90
+ })
91
+ .addCase(verifyAuthToken.rejected, function (state, action) {
92
+ state.error = action.error.message;
93
+ state.loading = false;
94
+ })
95
+ .addCase(verifyAuthToken.pending, function (state) {
96
+ state.loading = true;
97
+ state.error = null;
98
+ });
99
+ }
100
+ });
101
+ export var clearError = (_a = landingSlice.actions, _a.clearError), stopLoader = _a.stopLoader;
102
+ export default landingSlice.reducer;
103
+ export var landingSelector = function (state) { return state.landing; };
@@ -76,9 +76,10 @@ export var NameContainer = styled(Text, { shouldForwardProp: function (prop) { r
76
76
  return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
77
77
  });
78
78
  var ActivitiesList = function (_a) {
79
+ var _b;
79
80
  var rest = __rest(_a, []);
80
- var _b = React.useState([]), activitiesMenuList = _b[0], setActivitiesMenuList = _b[1];
81
- var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
81
+ var _c = React.useState([]), activitiesMenuList = _c[0], setActivitiesMenuList = _c[1];
82
+ var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
82
83
  var t = useTranslation().t;
83
84
  var isAr = useLanguage().isAr;
84
85
  var control = useFormContext().control;
@@ -87,7 +88,7 @@ var ActivitiesList = function (_a) {
87
88
  var data = useSelector(businessSelector).data;
88
89
  var businessTypeData = data.businessTypeData;
89
90
  var response = businessTypeData.responseBody;
90
- var businessType = businessTypeData.businessType;
91
+ var businessType = (_b = businessTypeData.selectedLicense) === null || _b === void 0 ? void 0 : _b.type;
91
92
  var isCR = businessType === BusinessType.CR;
92
93
  React.useEffect(function () {
93
94
  var _a;
@@ -22,42 +22,34 @@ import Collapse from '../../../../components/Collapse';
22
22
  import { useLanguage } from '../../../../hooks';
23
23
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
24
24
  import { businessSelector, clearError, retrieveEntityList, updateLeadBusinessType } from '../../../app/business/businessStore';
25
- import { BusinessType as BusinessTypeEnum } from '../../../../@types';
26
25
  import Button from '../../../shared/Button';
27
- import { CRValidationSchema, FLValidationSchema } from './validation';
28
- import SelectType from './SelectType';
29
- import FreelanceLicense from './FreelanceLicense';
30
- import CompanyLicense from './CompanyLicense';
26
+ import { LicenseValidationSchema } from './validation';
27
+ import LicenseList from './LicenseList';
31
28
  var BusinessType = function (_a) {
32
- var _b = React.useState(false), isCR = _b[0], setIsCR = _b[1];
33
- var _c = useSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
29
+ var _b = useSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
34
30
  var businessTypeData = data.businessTypeData;
35
31
  var t = useTranslation().t;
36
32
  var isAr = useLanguage().isAr;
37
33
  var dispatch = useAppDispatch();
38
- var _d = React.useState(false), listActive = _d[0], setListActive = _d[1];
34
+ var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
39
35
  var methods = useForm({
40
- resolver: yupResolver(isCR ? CRValidationSchema : FLValidationSchema),
36
+ resolver: yupResolver(LicenseValidationSchema),
41
37
  defaultValues: data.businessTypeData,
42
38
  mode: 'onChange'
43
39
  });
44
40
  React.useEffect(function () {
45
- dispatch(retrieveEntityList());
41
+ if (!(businessTypeData === null || businessTypeData === void 0 ? void 0 : businessTypeData.responseBody))
42
+ dispatch(retrieveEntityList());
46
43
  }, []);
47
- React.useEffect(function () {
48
- var businessType = businessTypeData.businessType;
49
- methods.setValue('businessType', businessType);
50
- if (businessType === BusinessTypeEnum.CR)
51
- setIsCR(true);
52
- }, [businessTypeData.businessType]);
53
44
  React.useEffect(function () {
54
45
  if (error)
55
46
  dispatch(clearError());
56
47
  }, [methods.formState.isValid]);
57
48
  var onSubmit = function (data) {
58
- var dataValues = { businessType: data.businessType, flNumber: data.flNumber, crNumber: '' };
59
- if (isCR)
60
- dataValues = { businessType: data.businessType, crNumber: data.crNumber, flNumber: '' };
49
+ var dataValues = {
50
+ selectedLicense: data.selectedLicense,
51
+ licenseNumber: data.licenseNumber
52
+ };
61
53
  dispatch(updateLeadBusinessType(dataValues));
62
54
  };
63
55
  var onBack = function () {
@@ -65,11 +57,7 @@ var BusinessType = function (_a) {
65
57
  };
66
58
  var disabled = !methods.formState.isValid || !!error;
67
59
  var disableBack = !data.otpData.isNID;
68
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(SelectType, { show: !listActive, onSwitchToCR: function () { return setIsCR(true); }, onSwitchToFL: function () { return setIsCR(false); } }), _jsx(CompanyLicense, { show: isCR, list: data.crInfos, onListOpen: function () {
69
- setListActive(true);
70
- }, onListClose: function () {
71
- setListActive(false);
72
- } }), _jsx(FreelanceLicense, { show: !isCR, list: data.flInfos, onListOpen: function () {
60
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(LicenseList, { onListOpen: function () {
73
61
  setListActive(true);
74
62
  }, onListClose: function () {
75
63
  setListActive(false);
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ interface LicenseListProps {
3
+ onSelectLicense?: (number: string) => void;
4
+ onListOpen?: () => void;
5
+ onListClose?: () => void;
6
+ }
7
+ declare const _default: React.MemoExoticComponent<({ ...rest }: LicenseListProps) => JSX.Element>;
8
+ export default _default;
@@ -0,0 +1,124 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import * as React from 'react';
25
+ import { useSelector } from 'react-redux';
26
+ import { useTranslation } from 'react-i18next';
27
+ import { useController, useFormContext } from 'react-hook-form';
28
+ import Box from '@mui/material/Box';
29
+ import { styled } from '@mui/material/styles';
30
+ import { useAppDispatch, useLanguage } from '../../../../hooks';
31
+ import { BusinessType } from '../../../../@types';
32
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
33
+ import Input from '../../../shared/Input';
34
+ import CheckIcon from '../../../shared/CheckIcon';
35
+ import SimpleList from '../../../../components/SimpleList';
36
+ import { businessSelector, clearError } from '../../../app/business/businessStore';
37
+ import Text from '../../../../components/Text';
38
+ import ExpandIcon from '../../../../components/ExpandIcon';
39
+ import Collapse from '../../../../components/Collapse';
40
+ import LicenseNumber from './LicenseNumber';
41
+ var InputStyled = styled(Input)(function (_a) {
42
+ var theme = _a.theme;
43
+ return ({
44
+ marginBottom: theme.spacing(2.5),
45
+ '& .MuiInputBase-input': {
46
+ cursor: 'pointer'
47
+ }
48
+ });
49
+ });
50
+ var LicenseContainer = styled(Box)(function () { return ({
51
+ display: 'flex'
52
+ }); });
53
+ var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
54
+ var theme = _a.theme, isSelected = _a.isSelected;
55
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
56
+ });
57
+ var LicenseList = function (_a) {
58
+ var rest = __rest(_a, []);
59
+ var _b = useSelector(businessSelector), data = _b.data, error = _b.error;
60
+ var businessTypeData = data.businessTypeData;
61
+ var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
62
+ var t = useTranslation().t;
63
+ var isAr = useLanguage().isAr;
64
+ var dispatch = useAppDispatch();
65
+ var _d = useFormContext(), setValue = _d.setValue, control = _d.control;
66
+ var selectedLicenseControl = useController({ control: control, name: 'selectedLicense' });
67
+ var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense;
68
+ var licenseList = (responseBody || { licenseList: [] }).licenseList;
69
+ var onOpenLicenseList = function (event) {
70
+ var _a;
71
+ setAnchorEl(event.currentTarget);
72
+ (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
73
+ };
74
+ var onCloseLicenseList = function () {
75
+ var _a;
76
+ setAnchorEl(null);
77
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
78
+ };
79
+ React.useEffect(function () {
80
+ var list = licenseList || [];
81
+ if (list.length > 0) {
82
+ setValue('licenseList', list);
83
+ if (!!selectedLicense) {
84
+ setValue('selectedLicense', selectedLicense, { shouldValidate: true });
85
+ setValue('licenseNumber', getLicenseNumber(selectedLicense), { shouldValidate: true });
86
+ }
87
+ }
88
+ }, [licenseList, selectedLicense]);
89
+ var getLicenseNumber = function (item) {
90
+ var _a;
91
+ return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
92
+ };
93
+ var getLicenseName = function (item) {
94
+ var _a, _b;
95
+ if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.FL && !isOtherLicense(item))
96
+ return 'future_work';
97
+ return (isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
98
+ };
99
+ var isOtherLicense = function (item) {
100
+ var _a, _b;
101
+ return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) === 'other_fl' || ((_b = item === null || item === void 0 ? void 0 : item.license) === null || _b === void 0 ? void 0 : _b.number) === 'other_cr';
102
+ };
103
+ var onSelectItem = function (license) {
104
+ if (error)
105
+ dispatch(clearError());
106
+ selectedLicenseControl.field.onChange(license);
107
+ if (isOtherLicense(license))
108
+ setValue('licenseNumber', '', { shouldValidate: true });
109
+ else
110
+ setValue('licenseNumber', getLicenseNumber(license), { shouldValidate: true });
111
+ onCloseLicenseList();
112
+ };
113
+ var showLicenseNumber = !anchorEl;
114
+ var selected = selectedLicenseControl.field.value;
115
+ var licenseReadonly = !isOtherLicense(selected);
116
+ var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
117
+ var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : t(getLicenseNumber(selected));
118
+ return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
119
+ return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item)
120
+ ? t(getLicenseName(item))
121
+ : getLicenseNumber(item) + ' - ' + getLicenseName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
122
+ } }) })), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: licenseReadonly })] }));
123
+ };
124
+ export default React.memo(LicenseList);
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ interface LicenseNumberProps {
3
+ show: boolean;
4
+ readOnly: boolean;
5
+ }
6
+ declare const _default: React.MemoExoticComponent<({ show, readOnly }: LicenseNumberProps) => JSX.Element>;
7
+ export default _default;
@@ -0,0 +1,46 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { useController, useFormContext } from 'react-hook-form';
16
+ import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH } from '../../../../constants';
17
+ import { removeAllCharsFromNumber, removeAllOtherThanCharsAndNumber } from '../../../../utils';
18
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
+ import ClearIcon from '../../../shared/ClearIcon';
20
+ import CheckIcon from '../../../shared/CheckIcon';
21
+ import Input from '../../../shared/Input';
22
+ import Collapse from '../../../../components/Collapse';
23
+ import { BusinessType } from '../../../../@types';
24
+ var LicenseNumber = function (_a) {
25
+ var _b;
26
+ var show = _a.show, readOnly = _a.readOnly;
27
+ var t = useTranslation().t;
28
+ var _c = useFormContext(), control = _c.control, getValues = _c.getValues;
29
+ var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
30
+ var selectedLicense = getValues('selectedLicense');
31
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
32
+ var handleFLNumberChange = function (_a) {
33
+ var target = _a.target;
34
+ var value = isCR ? removeAllCharsFromNumber(target.value) : removeAllOtherThanCharsAndNumber(target.value);
35
+ licenseNumberControl.field.onChange(value);
36
+ };
37
+ var clearLicenseNumber = function () {
38
+ licenseNumberControl.field.onChange('');
39
+ };
40
+ var licenseNumberValue = licenseNumberControl.field.value;
41
+ var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
42
+ var length = isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
43
+ var label = isCR ? 'cr_number' : 'fl_number';
44
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? '0123456789' : '12345678', warningType: 'alert', warningMessage: error && t(error, { length: length }) }) }) })));
45
+ };
46
+ export default React.memo(LicenseNumber);
@@ -1,15 +1,11 @@
1
1
  import * as yup from 'yup';
2
- export declare const FLValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
- flNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
2
+ export declare const LicenseValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ selectedLicense: any;
4
+ licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
4
5
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
- flNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ selectedLicense: any;
7
+ licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
6
8
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
- flNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
- }>>>;
9
- export declare const CRValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
10
- crNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
12
- crNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
13
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
14
- crNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
9
+ selectedLicense: any;
10
+ licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
15
11
  }>>>;
@@ -1,8 +1,25 @@
1
1
  import * as yup from 'yup';
2
2
  import { FL_NUMBER_LENGTH, CR_NUMBER_LENGTH } from '../../../../constants';
3
- export var FLValidationSchema = yup.object().shape({
4
- flNumber: yup.string().min(FL_NUMBER_LENGTH, "fl_max_length").required('fl_required')
5
- });
6
- export var CRValidationSchema = yup.object().shape({
7
- crNumber: yup.string().min(CR_NUMBER_LENGTH, "cr_max_length").required('cr_required')
3
+ import { BusinessType } from '../../../../@types';
4
+ var objectElements = {
5
+ legal_name: yup.object().shape({
6
+ ar: yup.string(),
7
+ en: yup.string()
8
+ }),
9
+ license: yup.object().shape({
10
+ number: yup.string()
11
+ }),
12
+ type: yup.string()
13
+ };
14
+ export var LicenseValidationSchema = yup.object().shape({
15
+ selectedLicense: yup.object().shape(objectElements).required(''),
16
+ licenseNumber: yup.string().when('selectedLicense', function (selectedLicenseValue) {
17
+ var _a, _b;
18
+ if (((_b = (_a = selectedLicenseValue === null || selectedLicenseValue === void 0 ? void 0 : selectedLicenseValue.license) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === BusinessType.CR) {
19
+ return yup.string().min(CR_NUMBER_LENGTH, "cr_max_length").required('cr_required');
20
+ }
21
+ else {
22
+ return yup.string().min(FL_NUMBER_LENGTH, "fl_max_length").required('fl_required');
23
+ }
24
+ })
8
25
  });
@@ -5,3 +5,4 @@ export declare const passwordFeatureScreens: Array<FeatureScreenStep>;
5
5
  export declare const individualFeatureScreens: Array<FeatureScreenStep>;
6
6
  export declare const bankFeatureScreens: Array<FeatureScreenStep>;
7
7
  export declare const taxFeatureScreens: Array<FeatureScreenStep>;
8
+ export declare const landingFeatureScreens: Array<FeatureScreenStep>;
@@ -24,6 +24,7 @@ import BankSuccessPage from './bank/screens/Success';
24
24
  import TaxVerifyPage from './tax/screens/Verify';
25
25
  import TaxDetailsPage from './tax/screens/TaxDetails';
26
26
  import TaxSuccessPage from './tax/screens/Success';
27
+ import VerifyAndRedirectPage from './Landing/screens/VerifyAndRedirect';
27
28
  export var connectFeatureScreens = [
28
29
  {
29
30
  name: 'CONNECT_NID_STEP',
@@ -137,3 +138,9 @@ export var taxFeatureScreens = [
137
138
  element: TaxSuccessPage
138
139
  }
139
140
  ];
141
+ export var landingFeatureScreens = [
142
+ {
143
+ name: 'LANDING_VERIFY_AND_REDIRECT_STEP',
144
+ element: VerifyAndRedirectPage
145
+ }
146
+ ];
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const BouncingDotsLoader: () => JSX.Element;
3
+ export default BouncingDotsLoader;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { styled } from '@mui/material/styles';
3
+ import Box from '@mui/material/Box';
4
+ var BoxStyled = styled(Box)(function () { return ({
5
+ display: 'flex',
6
+ alignItems: 'center',
7
+ '@keyframes bouncing-loader': {
8
+ to: {
9
+ opacity: 0.1
10
+ }
11
+ }
12
+ }); });
13
+ var DotStyled = styled(Box)(function () { return ({
14
+ width: 16,
15
+ height: 16,
16
+ margin: '0 6px 0 6px',
17
+ borderRadius: '50%',
18
+ backgroundColor: '#a3a1a1',
19
+ opacity: 1,
20
+ animation: 'bouncing-loader 0.6s infinite alternate',
21
+ '&:nth-of-type(2)': {
22
+ animationDelay: '0.2s'
23
+ },
24
+ '&:nth-of-type(3)': {
25
+ animationDelay: '0.4s'
26
+ }
27
+ }); });
28
+ var BouncingDotsLoader = function () {
29
+ return (_jsxs(BoxStyled, { children: [_jsx(DotStyled, {}), _jsx(DotStyled, {}), _jsx(DotStyled, {})] }));
30
+ };
31
+ export default BouncingDotsLoader;
@@ -0,0 +1,2 @@
1
+ import BouncingDotsLoader from './BouncingDotsLoader';
2
+ export default BouncingDotsLoader;
@@ -0,0 +1,2 @@
1
+ import BouncingDotsLoader from './BouncingDotsLoader';
2
+ export default BouncingDotsLoader;
@@ -6,4 +6,5 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
6
6
  tax: import("../features/app/tax/taxStore").TaxState;
7
7
  individual: import("../features/app/individual/individualStore").IndividualState;
8
8
  password: import("../features/app/password/passwordStore").PasswordState;
9
+ landing: import("../features/app/landing/landingStore").LandingState;
9
10
  }, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").AnyAction>;
package/build/index.d.ts CHANGED
@@ -6,5 +6,6 @@ import { PasswordLib, renderPasswordLib, PasswordLibProps, unmountPasswordLib }
6
6
  import { IndividualLib, renderIndividualLib, IndividualLibProps, unmountIndividualLib } from './features/individual';
7
7
  import { BankLib, renderBankLib, BankLibProps, unmountBankLib } from './features/bank';
8
8
  import { TaxLib, renderTaxLib, TaxLibProps, unmountTaxLib } from './features/tax';
9
- export type { ConnectLibProps, BusinessLibProps, PasswordLibProps, IndividualLibProps, BankLibProps, TaxLibProps };
10
- export { ConnectLib, renderConnectLib, unmountConnectLib, BusinessLib, renderBusinessLib, unmountBusinessLib, PasswordLib, renderPasswordLib, unmountPasswordLib, IndividualLib, renderIndividualLib, unmountIndividualLib, BankLib, renderBankLib, unmountBankLib, TaxLib, renderTaxLib, unmountTaxLib };
9
+ import { LandingLib, LandingProps, renderLandingLib, unmountLandingLib } from './features/Landing';
10
+ export type { ConnectLibProps, BusinessLibProps, PasswordLibProps, IndividualLibProps, BankLibProps, TaxLibProps, LandingProps };
11
+ export { ConnectLib, renderConnectLib, unmountConnectLib, BusinessLib, renderBusinessLib, unmountBusinessLib, PasswordLib, renderPasswordLib, unmountPasswordLib, IndividualLib, renderIndividualLib, unmountIndividualLib, BankLib, renderBankLib, unmountBankLib, TaxLib, renderTaxLib, unmountTaxLib, LandingLib, renderLandingLib, unmountLandingLib };
package/build/index.js CHANGED
@@ -6,7 +6,8 @@ import { PasswordLib, renderPasswordLib, unmountPasswordLib } from './features/p
6
6
  import { IndividualLib, renderIndividualLib, unmountIndividualLib } from './features/individual';
7
7
  import { BankLib, renderBankLib, unmountBankLib } from './features/bank';
8
8
  import { TaxLib, renderTaxLib, unmountTaxLib } from './features/tax';
9
- export { ConnectLib, renderConnectLib, unmountConnectLib, BusinessLib, renderBusinessLib, unmountBusinessLib, PasswordLib, renderPasswordLib, unmountPasswordLib, IndividualLib, renderIndividualLib, unmountIndividualLib, BankLib, renderBankLib, unmountBankLib, TaxLib, renderTaxLib, unmountTaxLib };
9
+ import { LandingLib, renderLandingLib, unmountLandingLib } from './features/Landing';
10
+ export { ConnectLib, renderConnectLib, unmountConnectLib, BusinessLib, renderBusinessLib, unmountBusinessLib, PasswordLib, renderPasswordLib, unmountPasswordLib, IndividualLib, renderIndividualLib, unmountIndividualLib, BankLib, renderBankLib, unmountBankLib, TaxLib, renderTaxLib, unmountTaxLib, LandingLib, renderLandingLib, unmountLandingLib };
10
11
  window['TapAuth'] = {
11
12
  renderConnectLib: renderConnectLib,
12
13
  unmountConnectLib: unmountConnectLib,
@@ -19,5 +20,7 @@ window['TapAuth'] = {
19
20
  renderBankLib: renderBankLib,
20
21
  unmountBankLib: unmountBankLib,
21
22
  renderTaxLib: renderTaxLib,
22
- unmountTaxLib: unmountTaxLib
23
+ unmountTaxLib: unmountTaxLib,
24
+ renderLandingLib: renderLandingLib,
25
+ unmountLandingLib: unmountLandingLib
23
26
  };
@@ -47,10 +47,7 @@ export var getParameterByName = function (name) {
47
47
  };
48
48
  export var getClientEmailUrl = function () {
49
49
  var origin = window.location.origin;
50
- if (origin.includes('localhost')) {
51
- return origin + '/business?token=';
52
- }
53
- return origin + '/auth/business?token=';
50
+ return origin + '/?token=';
54
51
  };
55
52
  export var capitalizeTheFirstLetterOfEachWord = function (words) {
56
53
  var separateWord = words.toLowerCase().split(' ');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.54",
3
+ "version": "1.0.57",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",