@tap-payments/auth-jsconnect 2.6.12-test → 2.6.16-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/build/@types/app.d.ts +2 -1
  2. package/build/@types/app.js +1 -0
  3. package/build/app/settings.js +2 -5
  4. package/build/constants/app.js +11 -5
  5. package/build/constants/dummy.d.ts +45 -0
  6. package/build/constants/dummy.js +330 -0
  7. package/build/features/app/brand/brandStore.js +2 -2
  8. package/build/features/app/business/businessStore.d.ts +9 -2
  9. package/build/features/app/business/businessStore.js +42 -23
  10. package/build/features/app/connectExpress/connectExpressStore.d.ts +2 -1
  11. package/build/features/app/connectExpress/connectExpressStore.js +38 -14
  12. package/build/features/app/individual/individualStore.js +5 -5
  13. package/build/features/business/screens/BusinessType/BusinessType.js +13 -5
  14. package/build/features/business/screens/BusinessType/EntityName.js +3 -3
  15. package/build/features/business/screens/BusinessType/LicenseList.js +3 -3
  16. package/build/features/business/screens/BusinessType/LicenseNumber.js +9 -8
  17. package/build/features/business/screens/BusinessType/validation.d.ts +10 -0
  18. package/build/features/business/screens/BusinessType/validation.js +16 -0
  19. package/build/features/business/screens/IDBOD/ID.js +6 -2
  20. package/build/features/business/screens/IDBOD/IDBOD.js +8 -17
  21. package/build/features/business/screens/IDBOD/validation.d.ts +10 -0
  22. package/build/features/business/screens/IDBOD/validation.js +4 -0
  23. package/build/features/connect/Connect.js +14 -18
  24. package/build/features/connect/screens/Mobile/Mobile.js +7 -6
  25. package/build/features/connect/screens/Mobile/MobileNumber.js +9 -6
  26. package/build/features/connectExpress/ConnectExpress.js +10 -4
  27. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +12 -4
  28. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +6 -6
  29. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +8 -7
  30. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +13 -0
  31. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +67 -0
  32. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +4 -0
  33. package/build/features/connectExpress/screens/IdentityOTP/OTP.js +1 -1
  34. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +1 -1
  35. package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -2
  36. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +9 -6
  37. package/build/features/connectExpress/screens/NIDMissed/IDNumber.js +6 -2
  38. package/build/features/connectExpress/screens/NIDMissed/NID.js +6 -4
  39. package/build/features/connectExpress/screens/NIDMissed/validation.d.ts +10 -0
  40. package/build/features/connectExpress/screens/NIDMissed/validation.js +4 -0
  41. package/build/features/entity/screens/EntityName/EntityName.js +11 -4
  42. package/build/features/entity/screens/EntityName/LicenseNumber.js +5 -4
  43. package/build/features/entity/screens/EntityName/validation.d.ts +28 -0
  44. package/build/features/entity/screens/EntityName/validation.js +38 -0
  45. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -4
  46. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +1 -1
  47. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -2
  48. package/build/features/shared/SuccessScreen/SuccessScreen.js +1 -1
  49. package/build/hooks/useCountry.d.ts +1 -0
  50. package/build/hooks/useCountry.js +4 -3
  51. package/build/utils/string.d.ts +1 -0
  52. package/build/utils/string.js +3 -0
  53. package/package.json +1 -1
@@ -2,16 +2,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useController, useFormContext } from 'react-hook-form';
5
+ import { settingsSelector } from '../../../../app/settings';
5
6
  import { ScreenContainer } from '../../../shared/Containers';
6
7
  import Input from '../../../shared/Input';
7
- import { removeAllCharsFromNumber } from '../../../../utils';
8
+ import { isOtherThanKWOrSA, removeAllCharsFromNumber } from '../../../../utils';
8
9
  import { ID_NUMBER_LENGTH } from '../../../../constants';
10
+ import { useAppSelector } from '../../../../hooks';
9
11
  import { EndAdornment } from '../../../shared/EndAdornment';
10
12
  var IDNumber = function (_a) {
11
13
  var _b;
12
14
  var t = useTranslation().t;
13
15
  var control = useFormContext().control;
14
16
  var nidControl = useController({ control: control, name: 'nid' });
17
+ var settingsData = useAppSelector(settingsSelector).data;
18
+ var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
15
19
  var handleIdChange = function (_a) {
16
20
  var target = _a.target;
17
21
  var value = removeAllCharsFromNumber(target.value);
@@ -22,6 +26,6 @@ var IDNumber = function (_a) {
22
26
  };
23
27
  var nidValue = nidControl.field.value;
24
28
  var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
25
- return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t('enter_national_id'), inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: error && t(error, { number: '1' }) }) }));
29
+ return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t('enter_national_id'), inputProps: isOtherCountry ? {} : { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: error && t(error, { number: '1' }) }) }));
26
30
  };
27
31
  export default React.memo(IDNumber);
@@ -9,31 +9,21 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
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
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import * as React from 'react';
25
14
  import { useTranslation } from 'react-i18next';
26
15
  import { useForm, FormProvider } from 'react-hook-form';
27
16
  import { styled } from '@mui/material/styles';
28
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
+ import { settingsSelector } from '../../../../app/settings';
29
19
  import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
30
20
  import Form from '../../../../components/Form';
31
21
  import Button from '../../../shared/Button';
32
22
  import { ScreenContainer } from '../../../shared/Containers';
33
23
  import { businessSelector, clearError, updateLeadIdentity } from '../../../app/business/businessStore';
34
24
  import Collapse from '../../../../components/Collapse';
35
- import { deepCopy } from '../../../../utils';
36
- import { NIDValidationSchema } from './validation';
25
+ import { deepCopy, isOtherThanKWOrSA } from '../../../../utils';
26
+ import { NIDOtherCountryValidationSchema, NIDValidationSchema } from './validation';
37
27
  import ID from './ID';
38
28
  import DOB from './DOB';
39
29
  var FormStyled = styled(Form)(function () { return ({
@@ -46,13 +36,14 @@ var IDBOD = function (_a) {
46
36
  var dispatch = useAppDispatch();
47
37
  var t = useTranslation().t;
48
38
  var _c = useAppSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
49
- var _d = data.nidData, responseBody = _d.responseBody, defaultValues = __rest(_d, ["responseBody"]);
39
+ var settingsData = useAppSelector(settingsSelector).data;
40
+ var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
50
41
  var methods = useForm({
51
- resolver: yupResolver(NIDValidationSchema),
52
- defaultValues: defaultValues,
42
+ resolver: yupResolver(isOtherCountry ? NIDOtherCountryValidationSchema : NIDValidationSchema),
43
+ defaultValues: data.nidData,
53
44
  mode: 'onChange'
54
45
  });
55
- useSetFromDefaultValues(methods, defaultValues);
46
+ useSetFromDefaultValues(methods, data.nidData);
56
47
  React.useEffect(function () {
57
48
  if (error)
58
49
  dispatch(clearError());
@@ -9,3 +9,13 @@ export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/objec
9
9
  dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
10
  nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
11
  }>>>;
12
+ export declare const NIDOtherCountryValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
15
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
16
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
17
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
19
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
20
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
+ }>>>;
@@ -7,3 +7,7 @@ export var NIDValidationSchema = yup.object().shape({
7
7
  .min(10, 'signup_invalid_national_id')
8
8
  .required('signup_invalid_national_id')
9
9
  });
10
+ export var NIDOtherCountryValidationSchema = yup.object().shape({
11
+ dob: yup.string().min(5).required('enter_valid_birth_date'),
12
+ nid: yup.string().min(3, 'signup_invalid_national_id').required('signup_invalid_national_id')
13
+ });
@@ -46,7 +46,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
46
  }
47
47
  };
48
48
  import { jsx as _jsx } from "react/jsx-runtime";
49
- import React, { memo } from 'react';
49
+ import React, { memo, useState } from 'react';
50
50
  import { createRoot } from 'react-dom/client';
51
51
  import { FeatureContainer } from '../shared/Containers';
52
52
  import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
@@ -56,29 +56,25 @@ import { store } from '../../app/store';
56
56
  import { connectSelector, retrieveLead, setDefaultCountryCode } from '../app/connect/connectStore';
57
57
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
58
58
  import Collapse from '../../components/Collapse';
59
- import { isKW, findOrCreateElementAndInject, initializeGTM, sendCustomEventToGTM, sendCustomDimension, sendPageView } from '../../utils';
59
+ import { isKW, findOrCreateElementAndInject, initializeGTM, sendCustomEventToGTM, sendCustomDimension, sendPageView, isOtherThanKWOrSA } from '../../utils';
60
60
  import { CONNECT_SCREENS_NAVIGATION } from '../../constants';
61
61
  import { connectFeatureScreens } from '../featuresScreens';
62
62
  import Background from '../shared/Background';
63
63
  var Connect = memo(function (props) {
64
64
  var theme = useAppTheme().theme;
65
65
  var dispatch = useAppDispatch();
66
- var leadId = props.leadId, configToken = props.configToken;
67
- var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
68
- var _b = useAppSelector(connectSelector), connectError = _b.error, loading = _b.loading, customLoading = _b.customLoading;
66
+ var configToken = props.configToken;
67
+ var _a = useState(props.leadId), leadId = _a[0], setLeadId = _a[1];
68
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
69
+ var _c = useAppSelector(connectSelector), connectError = _c.error, loading = _c.loading, customLoading = _c.customLoading;
69
70
  var onVerifyConfigTokenSuccess = function (data) { return __awaiter(void 0, void 0, void 0, function () {
70
71
  var id;
71
72
  return __generator(this, function (_a) {
72
- switch (_a.label) {
73
- case 0:
74
- id = (data === null || data === void 0 ? void 0 : data.lead_id) || leadId;
75
- if (!id) return [3, 2];
76
- return [4, dispatch(retrieveLead(id))];
77
- case 1:
78
- _a.sent();
79
- _a.label = 2;
80
- case 2: return [2];
73
+ id = (data === null || data === void 0 ? void 0 : data.lead_id) || leadId;
74
+ if (id) {
75
+ setLeadId(id);
81
76
  }
77
+ return [2];
82
78
  });
83
79
  }); };
84
80
  useAppConfig(__assign(__assign(__assign({ navigation: CONNECT_SCREENS_NAVIGATION, maturity: 'full' }, props), { configToken: configToken }), (configToken && { onVerifyConfigTokenSuccess: onVerifyConfigTokenSuccess })));
@@ -93,15 +89,15 @@ var Connect = memo(function (props) {
93
89
  initializeGTM();
94
90
  }, []);
95
91
  React.useEffect(function () {
96
- var _a;
92
+ var _a, _b;
97
93
  if (!settingLoading) {
98
- if (isKW((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2))
94
+ if (isOtherThanKWOrSA((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2) || isKW((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2))
99
95
  dispatch(handleCurrentActiveScreen('CONNECT_MOBILE_STEP'));
100
- if (leadId && !configToken) {
96
+ if (leadId) {
101
97
  dispatch(retrieveLead(leadId));
102
98
  }
103
99
  }
104
- }, [settingLoading]);
100
+ }, [settingLoading, leadId]);
105
101
  React.useEffect(function () {
106
102
  var _a, _b, _c;
107
103
  if (!!((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2)) {
@@ -25,7 +25,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
25
25
  import { clearError, connectSelector, createMobileAuth, resetNIDScreen, resetCivilScreen, resetOTPScreen, resetStore } from '../../../app/connect/connectStore';
26
26
  import { useLanguage } from '../../../../hooks';
27
27
  import Divider from '@mui/material/Divider';
28
- import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
28
+ import { deepCopy, isKW, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
29
29
  import Text from '../../../../components/Text';
30
30
  import MIDTitle from './Title';
31
31
  import MobileNumber from './MobileNumber';
@@ -74,12 +74,12 @@ var ListType;
74
74
  ListType["CountryCodeList"] = "CountryCodeList";
75
75
  })(ListType || (ListType = {}));
76
76
  var Mobile = function (_a) {
77
- var _b;
77
+ var _b, _c;
78
78
  var settingsStore = useAppSelector(settingsSelector);
79
- var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
80
- var _d = React.useState(), listType = _d[0], setListType = _d[1];
79
+ var _d = useAppSelector(connectSelector), data = _d.data, loading = _d.loading, error = _d.error;
80
+ var _e = React.useState(), listType = _e[0], setListType = _e[1];
81
81
  var dispatch = useAppDispatch();
82
- var _e = data.mobileData, mobile = _e.mobile, countryCode = _e.countryCode, termAndConditionChecked = _e.termAndConditionChecked;
82
+ var _f = data.mobileData, mobile = _f.mobile, countryCode = _f.countryCode, termAndConditionChecked = _f.termAndConditionChecked;
83
83
  var methods = useForm({
84
84
  resolver: yupResolver(PhoneValidationSchema),
85
85
  defaultValues: {
@@ -108,6 +108,7 @@ var Mobile = function (_a) {
108
108
  dispatch(resetCivilScreen());
109
109
  };
110
110
  var isKWCountry = React.useMemo(function () { var _a; return isKW((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_b = settingsStore.data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2]);
111
+ var isOtherThanKWOrSACountry = React.useMemo(function () { var _a; return isOtherThanKWOrSA((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_c = settingsStore.data.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2]);
111
112
  var onBack = function () {
112
113
  sendCustomEventToGTM({
113
114
  event: 'Send Event',
@@ -125,6 +126,6 @@ var Mobile = function (_a) {
125
126
  var disabled = !methods.formState.isValid || !!error;
126
127
  var title = t('join_our_community');
127
128
  var subTitle = t('ide_terms_and_conditions_description');
128
- return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKWCountry ? (_jsx(MobileButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) }))] }));
129
+ return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid && !isOtherThanKWOrSACountry }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKWCountry ? (_jsx(MobileButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) }))] }));
129
130
  };
130
131
  export default React.memo(Mobile);
@@ -26,6 +26,7 @@ import Box from '@mui/material/Box';
26
26
  import { useTranslation } from 'react-i18next';
27
27
  import { useController, useFormContext } from 'react-hook-form';
28
28
  import { styled, alpha } from '@mui/material/styles';
29
+ import { settingsSelector } from '../../../../app/settings';
29
30
  import Text from '../../../../components/Text';
30
31
  import Collapse from '../../../../components/Collapse';
31
32
  import ClearIcon from '../../../shared/ClearIcon';
@@ -35,7 +36,7 @@ import { connectSelector } from '../../../app/connect/connectStore';
35
36
  import ExpandIcon from '../../../../components/ExpandIcon';
36
37
  import Input from '../../../shared/Input';
37
38
  import SimpleList from '../../../../components/SimpleList';
38
- import { removeAllCharsFromNumber, sendCustomEventToGTM } from '../../../../utils';
39
+ import { isOtherThanKWOrSA, removeAllCharsFromNumber, sendCustomEventToGTM } from '../../../../utils';
39
40
  import { useLanguage, useAppSelector } from '../../../../hooks';
40
41
  import Search from '../../../shared/Search';
41
42
  var LabelContainerStyled = styled(Box)(function (_a) {
@@ -80,14 +81,15 @@ var InputStyled = styled(Input)(function () { return ({
80
81
  }
81
82
  }); });
82
83
  var MobileNumber = React.forwardRef(function (_a, ref) {
83
- var _b, _c, _d;
84
+ var _b, _c, _d, _e;
84
85
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
85
- var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
86
- var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
86
+ var _f = React.useState(countries || []), countriesCode = _f[0], setCountries = _f[1];
87
+ var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
87
88
  var t = useTranslation().t;
88
89
  var isAr = useLanguage().isAr;
89
- var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
90
+ var _h = useFormContext(), control = _h.control, setValue = _h.setValue;
90
91
  var loading = useAppSelector(connectSelector).loading;
92
+ var settingsStore = useAppSelector(settingsSelector);
91
93
  var phoneControl = useController({ name: 'mobile', control: control });
92
94
  var countryCodeControl = useController({ name: 'countryCode', control: control });
93
95
  var countryCodeValue = countryCodeControl.field.value;
@@ -98,6 +100,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
98
100
  var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
99
101
  var isStartsWith5 = mobileValue.startsWith('5');
100
102
  var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
103
+ var isOtherThanKWOrSACountry = React.useMemo(function () { var _a; return isOtherThanKWOrSA((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_e = settingsStore.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2]);
101
104
  React.useEffect(function () {
102
105
  if (mobileValue)
103
106
  setValue('mobile', mobileValue, { shouldValidate: true });
@@ -151,7 +154,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
151
154
  });
152
155
  setCountries(filteredCountries);
153
156
  };
154
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
157
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : isOtherThanKWOrSACountry ? '117px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
155
158
  return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
156
159
  } })] }))] })) })));
157
160
  });
@@ -64,10 +64,10 @@ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepSta
64
64
  import { handleCurrentActiveScreen, settingsSelector } from '../../app/settings';
65
65
  import AnimationFlow from '../../components/AnimationFlow';
66
66
  import { store } from '../../app/store';
67
- import { connectExpressSelector, setIsLeadIdPassed, setLeadId, retrieveLeadIdentityByIdAsync, setShowBoard } from '../app/connectExpress/connectExpressStore';
67
+ import { connectExpressSelector, setIsLeadIdPassed, setLeadId, retrieveLeadIdentityByIdAsync, setShowBoard, setDefaultCountryCode } from '../app/connectExpress/connectExpressStore';
68
68
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
69
69
  import Collapse from '../../components/Collapse';
70
- import { isKW, findOrCreateElementAndInject, sendPageView } from '../../utils';
70
+ import { isKW, findOrCreateElementAndInject, sendPageView, isOtherThanKWOrSA } from '../../utils';
71
71
  import { CONNECT_EXPRESS_SCREENS_NAVIGATION } from '../../constants';
72
72
  import { connectExpressFeatureScreens } from '../featuresScreens';
73
73
  import Background from '../shared/Background';
@@ -103,6 +103,12 @@ var ConnectExpress = memo(function (_a) {
103
103
  title: 'Connect Express'
104
104
  });
105
105
  }, []);
106
+ React.useEffect(function () {
107
+ var _a;
108
+ if (!!((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2)) {
109
+ dispatch(setDefaultCountryCode(data.businessCountry));
110
+ }
111
+ }, [data.businessCountry]);
106
112
  React.useEffect(function () {
107
113
  if (data.isValidOperator && props.open && !settingLoading) {
108
114
  if (configToken) {
@@ -118,8 +124,8 @@ var ConnectExpress = memo(function (_a) {
118
124
  }
119
125
  }, [data.isValidOperator, settingLoading]);
120
126
  React.useEffect(function () {
121
- var _a;
122
- if (!settingLoading && isKW((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2)) {
127
+ var _a, _b;
128
+ if (!settingLoading && (isKW((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2) || isOtherThanKWOrSA((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2))) {
123
129
  dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_MOBILE_STEP'));
124
130
  }
125
131
  }, [settingLoading]);
@@ -15,14 +15,14 @@ import { useForm, FormProvider } from 'react-hook-form';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
18
- import { deepCopy, isSA } from '../../../../utils';
18
+ import { deepCopy, isKW, isSA } from '../../../../utils';
19
19
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
20
  import Form from '../../../../components/Form';
21
21
  import Collapse from '../../../../components/Collapse';
22
22
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
23
  import { connectExpressSelector, clearError, updateLeadBusinessDataAsync } from '../../../app/connectExpress/connectExpressStore';
24
24
  import Button from '../../../shared/Button';
25
- import { KWBusinessDataSchema, BusinessDataSchema } from './validation';
25
+ import { KWBusinessDataSchema, BusinessDataSchema, OtherThanKWOrSABusinessDataSchema } from './validation';
26
26
  import LicenseList from './LicenseList';
27
27
  import BrandName from './BrandName';
28
28
  import TAC from './TAC';
@@ -37,9 +37,17 @@ var CollectBusinessInfo = function (_a) {
37
37
  var dispatch = useAppDispatch();
38
38
  var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
39
39
  var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
40
+ var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
40
41
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
42
+ var getSchema = React.useMemo(function () {
43
+ if (isKWCountry)
44
+ return KWBusinessDataSchema(isLeadIdPassed);
45
+ if (isSACountry)
46
+ return BusinessDataSchema(isLeadIdPassed);
47
+ return OtherThanKWOrSABusinessDataSchema(isLeadIdPassed);
48
+ }, [isLeadIdPassed]);
41
49
  var methods = useForm({
42
- resolver: yupResolver(!isSACountry ? KWBusinessDataSchema(isLeadIdPassed) : BusinessDataSchema(isLeadIdPassed)),
50
+ resolver: yupResolver(getSchema),
43
51
  defaultValues: {
44
52
  brandName: brandName,
45
53
  selectedLicense: selectedLicense,
@@ -78,6 +86,6 @@ var CollectBusinessInfo = function (_a) {
78
86
  setListActive(true);
79
87
  }, onListClose: function () {
80
88
  setListActive(false);
81
- } }), _jsx(TAC, { show: !isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
89
+ } }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(TAC, { show: !isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') }))] }))] })) })) }));
82
90
  };
83
91
  export default React.memo(CollectBusinessInfo);
@@ -28,7 +28,7 @@ import Box from '@mui/material/Box';
28
28
  import { styled } from '@mui/material/styles';
29
29
  import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
30
30
  import { BusinessType } from '../../../../@types';
31
- import { isOtherLicense, isSA } from '../../../../utils';
31
+ import { isKW, isOtherLicense, isSA } from '../../../../utils';
32
32
  import { settingsSelector } from '../../../../app/settings';
33
33
  import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
34
34
  import SimpleList from '../../../../components/SimpleList';
@@ -81,6 +81,7 @@ var LicenseList = function (_a) {
81
81
  (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
82
82
  };
83
83
  var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
84
+ var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
84
85
  React.useEffect(function () {
85
86
  if ((licenseList || []).length > 0)
86
87
  setValue('licenseList', licenseList);
@@ -95,8 +96,7 @@ var LicenseList = function (_a) {
95
96
  }, [licenseList, selectedLicense]);
96
97
  React.useEffect(function () {
97
98
  if (!!country_code) {
98
- var isNonSA = !isSA(country_code);
99
- if (isNonSA) {
99
+ if (isKWCountry) {
100
100
  var license = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR ? OTHER_CR_LICENSE : OTHER_FL_LICENSE;
101
101
  setValue('selectedLicense', license, { shouldValidate: true });
102
102
  }
@@ -132,8 +132,8 @@ var LicenseList = function (_a) {
132
132
  var licenseReadonly = !isOtherLicense(selected);
133
133
  var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
134
134
  var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
135
- return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry }, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: readOnly, 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) {
136
- return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
137
- } }) }))] })), _jsx(LicenseType, { show: show && !isSACountry, readOnly: readOnly }), _jsx(LicenseNumber, { show: !isSACountry ? isCR : show, readOnly: licenseReadonly })] }));
135
+ return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: readOnly, 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) {
136
+ return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
137
+ } }) })), _jsx(LicenseType, { show: show && isKWCountry, readOnly: readOnly }), _jsx(LicenseNumber, { show: isKWCountry ? isCR : show, readOnly: licenseReadonly })] }));
138
138
  };
139
139
  export default React.memo(LicenseList);
@@ -14,7 +14,7 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { CR_MIN_LICENSE_LENGTH, CR_NUMBER_MAX_LENGTH, FL_MIN_LICENSE_LENGTH, FL_NUMBER_MAX_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
17
- import { removeAllOtherThanCharsAndNumber, isSA } from '../../../../utils';
17
+ import { removeAllOtherThanCharsAndNumber, isKW, isOtherThanKWOrSA } from '../../../../utils';
18
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
19
  import ClearIcon from '../../../shared/ClearIcon';
20
20
  import CheckIcon from '../../../shared/CheckIcon';
@@ -30,8 +30,9 @@ var LicenseNumber = function (_a) {
30
30
  var _c = useFormContext(), control = _c.control, watch = _c.watch, getValues = _c.getValues;
31
31
  var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
32
32
  var settingsData = useAppSelector(settingsSelector).data;
33
- var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
34
- var selectedLicense = !isSACountry ? watch('selectedLicense') : getValues('selectedLicense');
33
+ var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
34
+ var isOtherThanKWOrSACountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
35
+ var selectedLicense = isKWCountry ? watch('selectedLicense') : getValues('selectedLicense');
35
36
  var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
36
37
  var handleFLNumberChange = function (_a) {
37
38
  var target = _a.target;
@@ -43,10 +44,10 @@ var LicenseNumber = function (_a) {
43
44
  };
44
45
  var licenseNumberValue = licenseNumberControl.field.value;
45
46
  var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
46
- var length = !isSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_MAX_LENGTH;
47
- var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
47
+ var length = isKWCountry || isOtherThanKWOrSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_MAX_LENGTH;
48
+ var minLength = isKWCountry || isOtherThanKWOrSACountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
48
49
  var label = isCR ? 'cr_number' : 'fl_number';
49
- var showCheckIcon = !isSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
50
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: !isSACountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon || (readOnly && licenseNumberValue) ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
50
+ var showCheckIcon = isKWCountry || isOtherThanKWOrSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
51
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: isKWCountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon || (readOnly && licenseNumberValue) ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
51
52
  };
52
53
  export default React.memo(LicenseNumber);
@@ -1,4 +1,17 @@
1
1
  import * as yup from 'yup';
2
+ export declare const OtherThanKWOrSABusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ selectedLicense: any;
5
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ selectedLicense: any;
9
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
+ selectedLicense: any;
13
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
+ }>>>;
2
15
  export declare const BusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
16
  brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
17
  selectedLicense: any;
@@ -11,6 +11,73 @@ var objectElements = {
11
11
  }),
12
12
  type: yup.string()
13
13
  };
14
+ export var OtherThanKWOrSABusinessDataSchema = function (isLeadIdPassed) {
15
+ if (!isLeadIdPassed) {
16
+ return yup.object().shape({
17
+ brandName: yup
18
+ .string()
19
+ .test({
20
+ test: function (value) {
21
+ if ((value === null || value === void 0 ? void 0 : value.length) === 0)
22
+ return true;
23
+ if (value && value.length >= 3)
24
+ return true;
25
+ return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
26
+ }
27
+ })
28
+ .required('enter_brand_name_english_chars_numbers_space'),
29
+ selectedLicense: yup.object().shape(objectElements).required(''),
30
+ licenseNumber: yup
31
+ .string()
32
+ .test({
33
+ test: function (value) {
34
+ var selectedLicense = this.parent.selectedLicense;
35
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
36
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
37
+ if (length === 0)
38
+ return true;
39
+ if (isCR) {
40
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
41
+ }
42
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
43
+ }
44
+ })
45
+ .required(''),
46
+ termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond')
47
+ });
48
+ }
49
+ return yup.object().shape({
50
+ brandName: yup
51
+ .string()
52
+ .test({
53
+ test: function (value) {
54
+ if ((value === null || value === void 0 ? void 0 : value.length) === 0)
55
+ return true;
56
+ if (value && value.length >= 3)
57
+ return true;
58
+ return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
59
+ }
60
+ })
61
+ .required('enter_brand_name_english_chars_numbers_space'),
62
+ selectedLicense: yup.object().shape(objectElements).required(''),
63
+ licenseNumber: yup
64
+ .string()
65
+ .test({
66
+ test: function (value) {
67
+ var selectedLicense = this.parent.selectedLicense;
68
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
69
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
70
+ if (length === 0)
71
+ return true;
72
+ if (isCR) {
73
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
74
+ }
75
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
76
+ }
77
+ })
78
+ .required('')
79
+ });
80
+ };
14
81
  export var BusinessDataSchema = function (isLeadIdPassed) {
15
82
  if (!isLeadIdPassed) {
16
83
  return yup.object().shape({
@@ -47,6 +47,7 @@ var CollectIndividualInfo = function (_a) {
47
47
  var isAr = useLanguage().isAr;
48
48
  var individualData = data.individualData, otpData = data.otpData, responseData = data.responseData;
49
49
  var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
50
+ var startWithNIDMissed = otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
50
51
  var contact = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).contact;
51
52
  var countryCode = individualData.countryCode;
52
53
  var isEmailAvailable = (responseData || {}).isEmailAvailable;
@@ -71,6 +72,9 @@ var CollectIndividualInfo = function (_a) {
71
72
  dispatch(resetIndividualScreen());
72
73
  var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
73
74
  var screen = startWithNID ? (isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP') : 'CONNECT_EXPRESS_MOBILE_STEP';
75
+ if (startWithNIDMissed) {
76
+ screen = isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP' : 'CONNECT_EXPRESS_NID_MISSED_STEP';
77
+ }
74
78
  dispatch(handlePrevScreenStep(screen));
75
79
  };
76
80
  React.useEffect(function () {
@@ -58,7 +58,7 @@ var OTP = function () {
58
58
  defaultValues: data.otpData,
59
59
  mode: 'onChange'
60
60
  });
61
- var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
61
+ var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
62
62
  React.useEffect(function () {
63
63
  if (error)
64
64
  dispatch(clearError());
@@ -35,7 +35,7 @@ var OTPInput = function (_a) {
35
35
  var otpControl = useController({ name: 'otp', control: control });
36
36
  var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
37
37
  var nidData = data.nidData;
38
- var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
38
+ var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
39
39
  var handleOnOTPChange = function (otp) {
40
40
  if (error)
41
41
  dispatch(clearError());
@@ -76,7 +76,7 @@ var Mobile = function (_a) {
76
76
  var t = useTranslation().t;
77
77
  var isAr = useLanguage().isAr;
78
78
  var dispatch = useAppDispatch();
79
- var isKuwait = useCountry(settingData.businessCountry.iso2).isKuwait;
79
+ var _f = useCountry(settingData.businessCountry.iso2), isKuwait = _f.isKuwait, isOther = _f.isOther;
80
80
  var responseData = data.responseData, isLeadIdPassed = data.isLeadIdPassed;
81
81
  var isLeadIdentityIdAvailable = !((_c = (_b = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _b === void 0 ? void 0 : _b.identification) === null || _c === void 0 ? void 0 : _c.id);
82
82
  var methods = useForm({
@@ -107,6 +107,6 @@ var Mobile = function (_a) {
107
107
  var originalReadOnly = useFormReadOnly(methods);
108
108
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
109
109
  var disabled = !methods.formState.isValid || !!error;
110
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(TAC, { show: isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: isLeadIdPassed ? !isLeadIdentityIdAvailable : !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKuwait ? (_jsx(MobileButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) })) }));
110
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(TAC, { show: isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: (isLeadIdPassed ? !isLeadIdentityIdAvailable : !methods.formState.isValid) && !isOther }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKuwait ? (_jsx(MobileButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) })) }));
111
111
  };
112
112
  export default React.memo(Mobile);