@tap-payments/auth-jsconnect 2.1.35-test → 2.1.37-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 (125) hide show
  1. package/build/@types/app.d.ts +1 -0
  2. package/build/@types/app.js +1 -0
  3. package/build/api/brand.d.ts +1 -0
  4. package/build/api/brand.js +9 -1
  5. package/build/api/index.d.ts +2 -0
  6. package/build/api/lead.d.ts +1 -0
  7. package/build/api/lead.js +7 -0
  8. package/build/app/rootReducer.d.ts +1 -0
  9. package/build/app/rootReducer.js +3 -1
  10. package/build/app/settings.d.ts +7 -5
  11. package/build/app/settings.js +15 -6
  12. package/build/app/store.d.ts +2 -0
  13. package/build/components/Button/Button.js +1 -5
  14. package/build/components/Radio/Radio.js +1 -1
  15. package/build/components/Tooltip/Tooltip.js +1 -1
  16. package/build/constants/app.d.ts +14 -0
  17. package/build/constants/app.js +45 -0
  18. package/build/features/app/auth/authStore.js +2 -10
  19. package/build/features/app/bank/bankStore.d.ts +1 -5
  20. package/build/features/app/bank/bankStore.js +3 -3
  21. package/build/features/app/brand/brandStore.js +3 -3
  22. package/build/features/app/business/businessStore.js +6 -16
  23. package/build/features/app/connect/connectStore.js +1 -8
  24. package/build/features/app/connectExpress/connectExpressStore.d.ts +39 -0
  25. package/build/features/app/connectExpress/connectExpressStore.js +171 -0
  26. package/build/features/app/entity/entityStore.js +3 -3
  27. package/build/features/app/individual/individualStore.d.ts +2 -10
  28. package/build/features/app/individual/individualStore.js +6 -8
  29. package/build/features/app/password/passwordStore.d.ts +2 -10
  30. package/build/features/app/password/passwordStore.js +5 -5
  31. package/build/features/app/tax/taxStore.js +3 -3
  32. package/build/features/auth/screens/NID/TAC.js +1 -3
  33. package/build/features/bank/screens/BankDetails/validation.js +6 -26
  34. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -3
  35. package/build/features/brand/screens/BrandActivities/ActivitiesList.js +9 -15
  36. package/build/features/brand/screens/BrandActivities/CustomerBase.js +1 -2
  37. package/build/features/brand/screens/BrandActivities/ExpectedCustomers.js +1 -2
  38. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +1 -3
  39. package/build/features/brand/screens/BrandActivities/RefundPolicy.js +1 -3
  40. package/build/features/brand/screens/BrandActivities/TAC.js +1 -3
  41. package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +1 -3
  42. package/build/features/brand/screens/BrandInfo/Segments.js +6 -15
  43. package/build/features/brand/screens/BrandInfo/TeamSize.js +6 -15
  44. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -3
  45. package/build/features/business/screens/Activities/ActivitiesList.js +1 -1
  46. package/build/features/business/screens/BusinessType/LicenseType.js +1 -5
  47. package/build/features/business/screens/BusinessType/validation.js +2 -6
  48. package/build/features/business/screens/Customers/CustomerLocations.js +1 -2
  49. package/build/features/business/screens/Customers/ExpectedCustomers.js +1 -2
  50. package/build/features/business/screens/Customers/ExpectedSalesRange.js +1 -3
  51. package/build/features/business/screens/Customers/RefundPolicy.js +1 -3
  52. package/build/features/business/screens/Customers/TransactionPolicy.js +1 -3
  53. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -3
  54. package/build/features/connect/screens/Individual/validation.js +2 -8
  55. package/build/features/connect/screens/Merchant/TAC.js +1 -3
  56. package/build/features/connectExpress/ConnectExpress.d.ts +10 -0
  57. package/build/features/connectExpress/ConnectExpress.js +134 -0
  58. package/build/features/connectExpress/index.d.ts +1 -0
  59. package/build/features/connectExpress/index.js +1 -0
  60. package/build/features/connectExpress/screens/CivilID/CivilID.d.ts +5 -0
  61. package/build/features/connectExpress/screens/CivilID/CivilID.js +102 -0
  62. package/build/features/connectExpress/screens/CivilID/IDNumber.d.ts +7 -0
  63. package/build/features/connectExpress/screens/CivilID/IDNumber.js +59 -0
  64. package/build/features/connectExpress/screens/CivilID/index.d.ts +3 -0
  65. package/build/features/connectExpress/screens/CivilID/index.js +2 -0
  66. package/build/features/connectExpress/screens/CivilID/validation.d.ts +8 -0
  67. package/build/features/connectExpress/screens/CivilID/validation.js +4 -0
  68. package/build/features/connectExpress/screens/Mobile/Mobile.d.ts +5 -0
  69. package/build/features/connectExpress/screens/Mobile/Mobile.js +133 -0
  70. package/build/features/connectExpress/screens/Mobile/MobileNumber.d.ts +12 -0
  71. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +154 -0
  72. package/build/features/connectExpress/screens/Mobile/Title.d.ts +8 -0
  73. package/build/features/connectExpress/screens/Mobile/Title.js +29 -0
  74. package/build/features/connectExpress/screens/Mobile/index.d.ts +3 -0
  75. package/build/features/connectExpress/screens/Mobile/index.js +2 -0
  76. package/build/features/connectExpress/screens/Mobile/validation.d.ts +8 -0
  77. package/build/features/connectExpress/screens/Mobile/validation.js +28 -0
  78. package/build/features/connectExpress/screens/NID/DOB.d.ts +6 -0
  79. package/build/features/connectExpress/screens/NID/DOB.js +47 -0
  80. package/build/features/connectExpress/screens/NID/IDNumber.d.ts +6 -0
  81. package/build/features/connectExpress/screens/NID/IDNumber.js +60 -0
  82. package/build/features/connectExpress/screens/NID/NID.d.ts +5 -0
  83. package/build/features/connectExpress/screens/NID/NID.js +94 -0
  84. package/build/features/connectExpress/screens/NID/index.d.ts +3 -0
  85. package/build/features/connectExpress/screens/NID/index.js +2 -0
  86. package/build/features/connectExpress/screens/NID/validation.d.ts +11 -0
  87. package/build/features/connectExpress/screens/NID/validation.js +9 -0
  88. package/build/features/connectExpress/screens/OTP/OTP.d.ts +5 -0
  89. package/build/features/connectExpress/screens/OTP/OTP.js +94 -0
  90. package/build/features/connectExpress/screens/OTP/OTPInput.d.ts +5 -0
  91. package/build/features/connectExpress/screens/OTP/OTPInput.js +54 -0
  92. package/build/features/connectExpress/screens/OTP/index.d.ts +3 -0
  93. package/build/features/connectExpress/screens/OTP/index.js +2 -0
  94. package/build/features/connectExpress/screens/OTP/validation.d.ts +8 -0
  95. package/build/features/connectExpress/screens/OTP/validation.js +4 -0
  96. package/build/features/connectExpress/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  97. package/build/features/connectExpress/screens/VerifyPACI/VerifyPACI.js +95 -0
  98. package/build/features/connectExpress/screens/VerifyPACI/index.d.ts +3 -0
  99. package/build/features/connectExpress/screens/VerifyPACI/index.js +2 -0
  100. package/build/features/entity/screens/EntityCapital/ActivityList.js +1 -1
  101. package/build/features/entity/screens/EntityCapital/validation.js +2 -6
  102. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -3
  103. package/build/features/featuresScreens.d.ts +1 -0
  104. package/build/features/featuresScreens.js +27 -0
  105. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -4
  106. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +1 -2
  107. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -6
  108. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -3
  109. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -3
  110. package/build/features/shared/Background/Background.js +1 -5
  111. package/build/features/shared/Button/Button.js +1 -3
  112. package/build/features/shared/Footer/Footer.js +1 -1
  113. package/build/features/shared/UploadMultipleFile/index.d.ts +0 -0
  114. package/build/features/shared/UploadMultipleFile/index.js +1 -0
  115. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -3
  116. package/build/hooks/useAppConfig.d.ts +2 -1
  117. package/build/hooks/useAppConfig.js +2 -2
  118. package/build/hooks/useAppDispatch.d.ts +1 -0
  119. package/build/hooks/useSetFromDefaultValues.js +2 -2
  120. package/build/index.d.ts +3 -2
  121. package/build/index.js +4 -1
  122. package/build/utils/array.js +1 -3
  123. package/build/utils/common.d.ts +1 -1
  124. package/build/utils/common.js +1 -0
  125. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import * as yup from 'yup';
2
+ export declare const civilIDValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ civilId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
+ civilId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ civilId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ }>>>;
@@ -0,0 +1,4 @@
1
+ import * as yup from 'yup';
2
+ export var civilIDValidationSchema = yup.object().shape({
3
+ civilId: yup.string().matches(/^\d+$/, 'invalid_civil_id').min(12, 'invalid_civil_id').required('invalid_civil_id')
4
+ });
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface MobileProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: MobileProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,133 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import * as React from 'react';
25
+ import Box from '@mui/material/Box';
26
+ import { useForm, FormProvider } from 'react-hook-form';
27
+ import { yupResolver } from '@hookform/resolvers/yup';
28
+ import { useTranslation } from 'react-i18next';
29
+ import { styled, alpha } from '@mui/material/styles';
30
+ import Collapse from '../../../../components/Collapse';
31
+ import Form from '../../../../components/Form';
32
+ import Button, { AbsherButton, MobileButton } from '../../../shared/Button';
33
+ import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
34
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
35
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
36
+ import { clearError, connectSelector, createMobileAuth, resetNIDScreen, resetCivilScreen, resetOTPScreen, resetStore } from '../../../app/connect/connectStore';
37
+ import { useLanguage } from '../../../../hooks';
38
+ import Divider from '@mui/material/Divider';
39
+ import { isKW } from '../../../../utils';
40
+ import Text from '../../../../components/Text';
41
+ import MIDTitle from './Title';
42
+ import MobileNumber from './MobileNumber';
43
+ import { PhoneValidationSchema } from './validation';
44
+ import { ICONS_NAMES } from '../../../../constants';
45
+ var FormStyled = styled(Form)(function () { return ({
46
+ display: 'flex',
47
+ flexDirection: 'column'
48
+ }); });
49
+ var InputsContainerStyled = styled(Box)(function (_a) {
50
+ var _b;
51
+ var theme = _a.theme;
52
+ return (_b = {},
53
+ _b[theme.transitions.create(['padding-bottom'])] = {
54
+ duration: theme.transitions.duration.standard
55
+ },
56
+ _b);
57
+ });
58
+ var TextStyled = styled(Text)(function (_a) {
59
+ var theme = _a.theme;
60
+ return ({
61
+ color: alpha(theme.palette.primary.dark, 0.4)
62
+ });
63
+ });
64
+ var DividerStyled = styled(Divider)(function (_a) {
65
+ var theme = _a.theme;
66
+ return ({
67
+ width: '45%',
68
+ borderColor: alpha(theme.palette.primary.dark, 0.4),
69
+ marginBlockEnd: theme.spacing(0.62)
70
+ });
71
+ });
72
+ var OrBoxStyled = styled(Box)(function (_a) {
73
+ var theme = _a.theme;
74
+ return ({
75
+ display: 'flex',
76
+ justifyContent: 'space-between',
77
+ marginBlockEnd: theme.spacing(1.62),
78
+ marginBlockStart: theme.spacing(-1.25),
79
+ marginInline: theme.spacing(2.5)
80
+ });
81
+ });
82
+ var ListType;
83
+ (function (ListType) {
84
+ ListType["BusinessList"] = "BusinessList";
85
+ ListType["CountryCodeList"] = "CountryCodeList";
86
+ })(ListType || (ListType = {}));
87
+ var Mobile = function (_a) {
88
+ var _b;
89
+ var settingsStore = useAppSelector(settingsSelector);
90
+ var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
91
+ var _d = React.useState(), listType = _d[0], setListType = _d[1];
92
+ var _e = data.mobileData, countryCode = _e.countryCode, mobile = _e.mobile;
93
+ var dispatch = useAppDispatch();
94
+ var _f = data.mobileData, responseBody = _f.responseBody, defaultValues = __rest(_f, ["responseBody"]);
95
+ var methods = useForm({
96
+ resolver: yupResolver(PhoneValidationSchema),
97
+ defaultValues: defaultValues,
98
+ mode: 'onChange'
99
+ });
100
+ useSetFromDefaultValues(methods, defaultValues);
101
+ var t = useTranslation().t;
102
+ var isAr = useLanguage().isAr;
103
+ var handleMenuListClick = function (flag) {
104
+ setListType(flag);
105
+ };
106
+ React.useEffect(function () {
107
+ dispatch(resetOTPScreen());
108
+ }, []);
109
+ React.useEffect(function () {
110
+ if (error)
111
+ dispatch(clearError());
112
+ }, [methods.formState.isValid]);
113
+ var onSubmit = function (formData) {
114
+ dispatch(createMobileAuth(formData));
115
+ dispatch(resetNIDScreen());
116
+ dispatch(resetCivilScreen());
117
+ };
118
+ 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]);
119
+ var onBack = function () {
120
+ dispatch(handlePrevScreenStep(isKWCountry ? 'CONNECT_CIVIL_ID_STEP' : 'CONNECT_NID_STEP'));
121
+ };
122
+ React.useEffect(function () {
123
+ dispatch(resetStore());
124
+ }, []);
125
+ var isBusinessListActive = listType === ListType.BusinessList;
126
+ var isCountryListActive = listType === ListType.CountryCodeList;
127
+ var listActive = isBusinessListActive || isCountryListActive;
128
+ var disabled = !methods.formState.isValid || !!error;
129
+ var title = t('join_our_community');
130
+ var subTitle = t('ide_terms_and_conditions_description');
131
+ 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') })))] }))] }))] })) }))] }));
132
+ };
133
+ export default React.memo(Mobile);
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { CountryCode } from '../../../../@types';
3
+ interface MobileNumberProps {
4
+ countries: Array<CountryCode>;
5
+ show: boolean;
6
+ setMobileLength?: (length: number) => void;
7
+ onSwitchToIdNumber?: () => void;
8
+ onListOpen?: () => void;
9
+ onListClose?: () => void;
10
+ }
11
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
12
+ export default _default;
@@ -0,0 +1,154 @@
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, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
24
+ import * as React from 'react';
25
+ import Box from '@mui/material/Box';
26
+ import { useTranslation } from 'react-i18next';
27
+ import { useController, useFormContext } from 'react-hook-form';
28
+ import { styled, alpha } from '@mui/material/styles';
29
+ import Text from '../../../../components/Text';
30
+ import Collapse from '../../../../components/Collapse';
31
+ import ClearIcon from '../../../shared/ClearIcon';
32
+ import CheckIcon from '../../../shared/CheckIcon';
33
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
34
+ import { connectSelector } from '../../../app/connect/connectStore';
35
+ import ExpandIcon from '../../../../components/ExpandIcon';
36
+ import Input from '../../../shared/Input';
37
+ import SimpleList from '../../../../components/SimpleList';
38
+ import { removeAllCharsFromNumber } from '../../../../utils';
39
+ import { useLanguage, useAppSelector } from '../../../../hooks';
40
+ import Search from '../../../shared/Search';
41
+ var LabelContainerStyled = styled(Box)(function (_a) {
42
+ var theme = _a.theme;
43
+ return ({
44
+ display: 'flex',
45
+ justifyContent: 'space-between',
46
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
47
+ });
48
+ });
49
+ var CountryItemContainer = styled(Box)(function () { return ({
50
+ display: 'flex'
51
+ }); });
52
+ var CountryCodeText = styled(Text, {
53
+ shouldForwardProp: function (prop) { return prop !== 'isSelected'; }
54
+ })(function (_a) {
55
+ var theme = _a.theme, isSelected = _a.isSelected;
56
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { width: theme.spacing(10), textAlign: 'start', fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
57
+ });
58
+ var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
59
+ var theme = _a.theme, isSelected = _a.isSelected;
60
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
61
+ });
62
+ var CountryCodeStyled = styled(Text)(function (_a) {
63
+ var theme = _a.theme;
64
+ return (__assign(__assign({ cursor: 'pointer' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightRegular, display: 'flex', alignItems: 'center', minWidth: theme.spacing(8.75) }));
65
+ });
66
+ var InputLabelStyled = styled(Text)(function (_a) {
67
+ var theme = _a.theme;
68
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
69
+ });
70
+ var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
71
+ var theme = _a.theme;
72
+ return ({
73
+ marginInlineStart: theme.spacing(1)
74
+ });
75
+ });
76
+ var InputStyled = styled(Input)(function (_a) {
77
+ var theme = _a.theme;
78
+ return ({
79
+ direction: 'ltr',
80
+ '& .MuiInputBase-input': {
81
+ cursor: 'auto'
82
+ }
83
+ });
84
+ });
85
+ var MobileNumber = React.forwardRef(function (_a, ref) {
86
+ var _b, _c, _d;
87
+ var countries = _a.countries, rest = __rest(_a, ["countries"]);
88
+ var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
89
+ var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
90
+ var t = useTranslation().t;
91
+ var isAr = useLanguage().isAr;
92
+ var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
93
+ var loading = useAppSelector(connectSelector).loading;
94
+ var phoneControl = useController({ name: 'mobile', control: control });
95
+ var countryCodeControl = useController({ name: 'countryCode', control: control });
96
+ var countryCodeValue = countryCodeControl.field.value;
97
+ var mobileValue = phoneControl.field.value || '';
98
+ var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
99
+ var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
100
+ var isSA = countryCodeValue.iso2 === 'SA';
101
+ var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
102
+ var isStartsWith5 = mobileValue.startsWith('5');
103
+ var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
104
+ React.useEffect(function () {
105
+ if (mobileValue)
106
+ setValue('mobile', mobileValue, { shouldValidate: true });
107
+ }, []);
108
+ var onPhoneNumberChange = function (_a) {
109
+ var target = _a.target;
110
+ var value = removeAllCharsFromNumber(target.value);
111
+ phoneControl.field.onChange(value);
112
+ };
113
+ var clearMobileNumber = function () {
114
+ phoneControl.field.onChange('');
115
+ };
116
+ var onCloseCountryList = function () {
117
+ var _a;
118
+ if (anchorEl) {
119
+ setAnchorEl(null);
120
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
121
+ }
122
+ setCountries(countries);
123
+ };
124
+ var toggleCountryList = function () {
125
+ var _a, _b;
126
+ if (anchorEl) {
127
+ setAnchorEl(null);
128
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
129
+ setCountries(countries);
130
+ }
131
+ else {
132
+ (_b = rest.onListOpen) === null || _b === void 0 ? void 0 : _b.call(rest);
133
+ setAnchorEl(true);
134
+ }
135
+ };
136
+ var onSelectItem = function (country) {
137
+ onCloseCountryList();
138
+ setValue('mobile', '');
139
+ countryCodeControl.field.onChange(country);
140
+ };
141
+ var handleSearch = function (value) {
142
+ var filteredCountries = countries.filter(function (country) {
143
+ return country.idd_prefix.toString().toLowerCase().startsWith(value.replace('+', '').toLowerCase()) ||
144
+ country.capital.toLowerCase().startsWith(value.toLowerCase()) ||
145
+ country.name.arabic.toLowerCase().startsWith(value.toLowerCase()) ||
146
+ country.name.english.toLowerCase().startsWith(value.toLowerCase());
147
+ });
148
+ setCountries(filteredCountries);
149
+ };
150
+ 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) {
151
+ 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, {})] }));
152
+ } })] }))] })) })));
153
+ });
154
+ export default React.memo(MobileNumber);
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ interface MIDTitleProps {
3
+ show: boolean;
4
+ title: string;
5
+ description: string;
6
+ }
7
+ declare const _default: React.MemoExoticComponent<({ description, show, title }: MIDTitleProps) => JSX.Element>;
8
+ export default _default;
@@ -0,0 +1,29 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { styled, alpha } from '@mui/material/styles';
15
+ import Collapse from '../../../../components/Collapse';
16
+ import Text from '../../../../components/Text';
17
+ var TitleStyled = styled(Text)(function (_a) {
18
+ var theme = _a.theme;
19
+ return (__assign(__assign({ color: theme.palette.text.primary, textAlign: 'center' }, theme.typography.body1), { fontWeight: theme.typography.fontWeightMedium, lineHeight: 1.21, padding: theme.spacing(0, 3, 0, 3) }));
20
+ });
21
+ var DescriptionStyled = styled(Text)(function (_a) {
22
+ var theme = _a.theme;
23
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption), { fontWeight: theme.typography.fontWeightRegular, lineHeight: 1.6, padding: theme.spacing(2, 3, 3, 3) }));
24
+ });
25
+ var MIDTitle = function (_a) {
26
+ var description = _a.description, show = _a.show, title = _a.title;
27
+ return (_jsxs(Collapse, __assign({ in: show }, { children: [_jsx(TitleStyled, { children: title }), _jsx(DescriptionStyled, { children: description })] })));
28
+ };
29
+ export default React.memo(MIDTitle);
@@ -0,0 +1,3 @@
1
+ import Mobile, { MobileProps } from './Mobile';
2
+ export type { MobileProps };
3
+ export default Mobile;
@@ -0,0 +1,2 @@
1
+ import Mobile from './Mobile';
2
+ export default Mobile;
@@ -0,0 +1,8 @@
1
+ import * as yup from 'yup';
2
+ export declare const PhoneValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
+ mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ }>>>;
@@ -0,0 +1,28 @@
1
+ import * as yup from 'yup';
2
+ export var PhoneValidationSchema = yup.object().shape({
3
+ mobile: yup
4
+ .string()
5
+ .test({
6
+ test: function (value) {
7
+ var countryCode = this.parent.countryCode;
8
+ var isSA = countryCode.iso2 === 'SA';
9
+ var digits = countryCode.digits;
10
+ var mobileValue = value || '';
11
+ var valueLen = mobileValue.length;
12
+ var isNumber = mobileValue.match(/^[0-9]/g);
13
+ if (!isNumber)
14
+ return this.createError({ message: 'enter_valid_mobile_number' });
15
+ var isStartWithZero = mobileValue.startsWith('05');
16
+ var isStartWith5 = mobileValue.startsWith('5');
17
+ var isSaudiNumber = isStartWith5 || isStartWithZero;
18
+ if (isSA) {
19
+ if (!isSaudiNumber)
20
+ return this.createError({ message: 'start_with_number' });
21
+ var requiredLen = isStartWith5 ? digits - 1 : digits;
22
+ return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
23
+ }
24
+ return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
25
+ }
26
+ })
27
+ .required('mobile_number_error')
28
+ });
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface DOBProps {
3
+ onDateClicked?: (flag: boolean) => void;
4
+ }
5
+ declare const DOB: ({ onDateClicked }: DOBProps) => JSX.Element;
6
+ export default DOB;
@@ -0,0 +1,47 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useTranslation } from 'react-i18next';
14
+ import { useController, useFormContext } from 'react-hook-form';
15
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
16
+ import { ScreenContainer } from '../../../shared/Containers';
17
+ import DatePicker from '../../../../components/DatePicker';
18
+ import { alpha, styled } from '@mui/material/styles';
19
+ import { clearError, connectSelector } from '../../../app/connect/connectStore';
20
+ import Text from '../../../../components/Text';
21
+ var InputLabelStyled = styled(Text)(function (_a) {
22
+ var theme = _a.theme;
23
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
24
+ });
25
+ var DOB = function (_a) {
26
+ var _b;
27
+ var onDateClicked = _a.onDateClicked;
28
+ var t = useTranslation().t;
29
+ var control = useFormContext().control;
30
+ var dispatch = useAppDispatch();
31
+ var dobControl = useController({ control: control, name: 'dob' });
32
+ var error = useAppSelector(connectSelector).error;
33
+ var handleBirthDateChange = function (data) {
34
+ dobControl.field.onChange(data);
35
+ handleClearError();
36
+ };
37
+ var handleClearError = function () {
38
+ if (error)
39
+ dispatch(clearError());
40
+ };
41
+ var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
42
+ return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
43
+ var spacing = _a.spacing;
44
+ return spacing(2.5, 2.5, 1.5, 2.5);
45
+ } } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { defaultValue: dateValue ? new Date(dateValue) : new Date(), readOnly: true, dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange, onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); } })] }));
46
+ };
47
+ export default DOB;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ interface IDNumberProps {
3
+ show: boolean;
4
+ }
5
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
6
+ export default _default;
@@ -0,0 +1,60 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import Box from '@mui/material/Box';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { useController, useFormContext } from 'react-hook-form';
17
+ import { styled, alpha } from '@mui/material/styles';
18
+ import Text from '../../../../components/Text';
19
+ import Input from '../../../shared/Input';
20
+ import ClearIcon from '../../../shared/ClearIcon';
21
+ import CheckIcon from '../../../shared/CheckIcon';
22
+ import Collapse from '../../../../components/Collapse';
23
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
24
+ import { removeAllCharsFromNumber } from '../../../../utils';
25
+ import { ID_NUMBER_LENGTH } from '../../../../constants';
26
+ var LabelContainerStyled = styled(Box)(function (_a) {
27
+ var theme = _a.theme;
28
+ return ({
29
+ display: 'flex',
30
+ justifyContent: 'space-between',
31
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
32
+ });
33
+ });
34
+ var InputLabelStyled = styled(Text)(function (_a) {
35
+ var theme = _a.theme;
36
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
37
+ });
38
+ var IDNumber = React.forwardRef(function (_a, ref) {
39
+ var _b;
40
+ var show = _a.show;
41
+ var t = useTranslation().t;
42
+ var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
43
+ var nidControl = useController({ control: control, name: 'nid' });
44
+ React.useEffect(function () {
45
+ if (nidControl.field.value)
46
+ setValue('nid', nidControl.field.value, { shouldValidate: true });
47
+ }, [show]);
48
+ var handleIdChange = function (_a) {
49
+ var target = _a.target;
50
+ var value = removeAllCharsFromNumber(target.value);
51
+ nidControl.field.onChange(value);
52
+ };
53
+ var clearIdNumber = function () {
54
+ nidControl.field.onChange('');
55
+ };
56
+ var nidValue = nidControl.field.value;
57
+ var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
58
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
59
+ });
60
+ export default React.memo(IDNumber);
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface NIDProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: NIDProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,94 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { alpha, styled } from '@mui/material/styles';
16
+ import { useForm, FormProvider } from 'react-hook-form';
17
+ import { yupResolver } from '@hookform/resolvers/yup';
18
+ import { NIDValidationSchema } from './validation';
19
+ import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
20
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
+ import { clearError, connectSelector, createNIDAuth, resetMobileScreen, resetStore } from '../../../app/connect/connectStore';
22
+ import Form from '../../../../components/Form';
23
+ import Button, { MobileButton } from '../../../shared/Button';
24
+ import { ScreenContainer } from '../../../shared/Containers';
25
+ import Collapse from '../../../../components/Collapse';
26
+ import Box from '@mui/material/Box';
27
+ import Divider from '@mui/material/Divider';
28
+ import Text from '../../../../components/Text';
29
+ import IDNumber from './IDNumber';
30
+ import DOB from './DOB';
31
+ var FormStyled = styled(Form)(function () { return ({
32
+ display: 'flex',
33
+ flexDirection: 'column'
34
+ }); });
35
+ var TextStyled = styled(Text)(function (_a) {
36
+ var theme = _a.theme;
37
+ return ({
38
+ color: alpha(theme.palette.primary.dark, 0.4)
39
+ });
40
+ });
41
+ var DividerStyled = styled(Divider)(function (_a) {
42
+ var theme = _a.theme;
43
+ return ({
44
+ width: '45%',
45
+ borderColor: alpha(theme.palette.primary.dark, 0.4),
46
+ marginBlockEnd: theme.spacing(0.62)
47
+ });
48
+ });
49
+ var OrBoxStyled = styled(Box)(function (_a) {
50
+ var theme = _a.theme;
51
+ return ({
52
+ display: 'flex',
53
+ justifyContent: 'space-between',
54
+ marginBlockEnd: theme.spacing(1.62),
55
+ marginBlockStart: theme.spacing(-1.25),
56
+ marginInline: theme.spacing(2.5)
57
+ });
58
+ });
59
+ var NID = function (_a) {
60
+ var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
61
+ var isAr = useLanguage().isAr;
62
+ var dispatch = useAppDispatch();
63
+ var t = useTranslation().t;
64
+ var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
65
+ var settingsStore = useAppSelector(settingsSelector);
66
+ var methods = useForm({
67
+ resolver: yupResolver(NIDValidationSchema),
68
+ defaultValues: data.nidData,
69
+ mode: 'onChange'
70
+ });
71
+ React.useEffect(function () {
72
+ handleClearError();
73
+ }, [methods.formState.isValid]);
74
+ var onSubmit = function (data) {
75
+ dispatch(createNIDAuth(data));
76
+ dispatch(resetMobileScreen(settingsStore.data.businessCountry));
77
+ };
78
+ var handleCollapseOpenClose = function (flag) {
79
+ setCollapse(flag);
80
+ };
81
+ var handleClearError = function () {
82
+ if (error)
83
+ dispatch(clearError());
84
+ };
85
+ var onBack = function () {
86
+ dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
87
+ };
88
+ React.useEffect(function () {
89
+ dispatch(resetStore());
90
+ }, []);
91
+ var disabled = !methods.formState.isValid || !!error;
92
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.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, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading || settingsStore.loading }, { children: t('mobile_button_label') }))] }))] }))] })) })) }));
93
+ };
94
+ export default React.memo(NID);
@@ -0,0 +1,3 @@
1
+ import NID, { NIDProps } from './NID';
2
+ export type { NIDProps };
3
+ export default NID;