@tap-payments/auth-jsconnect 2.6.57-test → 2.6.59-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 (113) hide show
  1. package/build/@types/app.d.ts +3 -1
  2. package/build/@types/app.js +1 -1
  3. package/build/api/account.d.ts +1 -0
  4. package/build/api/account.js +8 -1
  5. package/build/api/auth.d.ts +2 -0
  6. package/build/api/index.d.ts +4 -3
  7. package/build/api/lead.d.ts +3 -0
  8. package/build/api/operator.d.ts +3 -2
  9. package/build/api/operator.js +2 -2
  10. package/build/app/rootReducer.d.ts +1 -0
  11. package/build/app/rootReducer.js +2 -0
  12. package/build/app/settings.js +3 -2
  13. package/build/app/store.d.ts +2 -0
  14. package/build/constants/app.d.ts +10 -0
  15. package/build/constants/app.js +53 -0
  16. package/build/features/app/auth/authStore.d.ts +189 -0
  17. package/build/features/app/auth/authStore.js +729 -0
  18. package/build/features/app/bank/bankStore.js +5 -4
  19. package/build/features/app/brand/brandStore.js +5 -4
  20. package/build/features/app/business/businessStore.js +37 -28
  21. package/build/features/app/connectExpress/connectExpressStore.js +3 -2
  22. package/build/features/app/entity/entityStore.js +5 -4
  23. package/build/features/app/individual/individualStore.js +5 -4
  24. package/build/features/app/tax/taxStore.js +5 -4
  25. package/build/features/auth/Auth.d.ts +8 -0
  26. package/build/features/auth/Auth.js +93 -0
  27. package/build/features/auth/index.d.ts +1 -0
  28. package/build/features/auth/index.js +1 -0
  29. package/build/features/auth/screens/AuthenticationList/AuthenticationList.d.ts +5 -0
  30. package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +91 -0
  31. package/build/features/auth/screens/AuthenticationList/BrandList.d.ts +10 -0
  32. package/build/features/auth/screens/AuthenticationList/BrandList.js +81 -0
  33. package/build/features/auth/screens/AuthenticationList/EntityList.d.ts +11 -0
  34. package/build/features/auth/screens/AuthenticationList/EntityList.js +96 -0
  35. package/build/features/auth/screens/AuthenticationList/MerchantList.d.ts +10 -0
  36. package/build/features/auth/screens/AuthenticationList/MerchantList.js +107 -0
  37. package/build/features/auth/screens/AuthenticationList/index.d.ts +3 -0
  38. package/build/features/auth/screens/AuthenticationList/index.js +2 -0
  39. package/build/features/auth/screens/AuthenticationList/validation.d.ts +14 -0
  40. package/build/features/auth/screens/AuthenticationList/validation.js +8 -0
  41. package/build/features/auth/screens/BusinessCountry/BusinessCountry.d.ts +5 -0
  42. package/build/features/auth/screens/BusinessCountry/BusinessCountry.js +105 -0
  43. package/build/features/auth/screens/BusinessCountry/index.d.ts +3 -0
  44. package/build/features/auth/screens/BusinessCountry/index.js +2 -0
  45. package/build/features/auth/screens/CivilID/CivilID.d.ts +5 -0
  46. package/build/features/auth/screens/CivilID/CivilID.js +88 -0
  47. package/build/features/auth/screens/CivilID/IDNumber.d.ts +8 -0
  48. package/build/features/auth/screens/CivilID/IDNumber.js +54 -0
  49. package/build/features/auth/screens/CivilID/index.d.ts +3 -0
  50. package/build/features/auth/screens/CivilID/index.js +2 -0
  51. package/build/features/auth/screens/CivilID/validation.d.ts +8 -0
  52. package/build/features/auth/screens/CivilID/validation.js +4 -0
  53. package/build/features/auth/screens/Mobile/Mobile.d.ts +5 -0
  54. package/build/features/auth/screens/Mobile/Mobile.js +108 -0
  55. package/build/features/auth/screens/Mobile/MobileNumber.d.ts +13 -0
  56. package/build/features/auth/screens/Mobile/MobileNumber.js +158 -0
  57. package/build/features/auth/screens/Mobile/index.d.ts +3 -0
  58. package/build/features/auth/screens/Mobile/index.js +2 -0
  59. package/build/features/auth/screens/Mobile/validation.d.ts +8 -0
  60. package/build/features/auth/screens/Mobile/validation.js +30 -0
  61. package/build/features/auth/screens/NID/DOB.d.ts +6 -0
  62. package/build/features/auth/screens/NID/DOB.js +47 -0
  63. package/build/features/auth/screens/NID/IDNumber.d.ts +7 -0
  64. package/build/features/auth/screens/NID/IDNumber.js +55 -0
  65. package/build/features/auth/screens/NID/NID.d.ts +5 -0
  66. package/build/features/auth/screens/NID/NID.js +92 -0
  67. package/build/features/auth/screens/NID/index.d.ts +3 -0
  68. package/build/features/auth/screens/NID/index.js +2 -0
  69. package/build/features/auth/screens/NID/validation.d.ts +11 -0
  70. package/build/features/auth/screens/NID/validation.js +11 -0
  71. package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
  72. package/build/features/auth/screens/OTP/OTP.js +87 -0
  73. package/build/features/auth/screens/OTP/OTPInput.d.ts +5 -0
  74. package/build/features/auth/screens/OTP/OTPInput.js +57 -0
  75. package/build/features/auth/screens/OTP/index.d.ts +3 -0
  76. package/build/features/auth/screens/OTP/index.js +2 -0
  77. package/build/features/auth/screens/OTP/validation.d.ts +8 -0
  78. package/build/features/auth/screens/OTP/validation.js +4 -0
  79. package/build/features/auth/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
  80. package/build/features/auth/screens/VerifyPACI/VerifyPACI.js +34 -0
  81. package/build/features/auth/screens/VerifyPACI/index.d.ts +3 -0
  82. package/build/features/auth/screens/VerifyPACI/index.js +2 -0
  83. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +6 -33
  84. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +4 -17
  85. package/build/features/brand/screens/BrandActivities/TAC.d.ts +2 -7
  86. package/build/features/business/screens/BusinessType/LicenseType.d.ts +4 -26
  87. package/build/features/business/screens/Customers/CustomerLocations.d.ts +6 -33
  88. package/build/features/business/screens/Customers/RefundPolicy.d.ts +4 -17
  89. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +4 -26
  90. package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.d.ts +2 -7
  91. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +2 -2
  92. package/build/features/connectExpress/screens/NID/TAC.d.ts +2 -7
  93. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +6 -33
  94. package/build/features/featuresScreens.d.ts +1 -0
  95. package/build/features/featuresScreens.js +40 -3
  96. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +4 -26
  97. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +4 -26
  98. package/build/features/shared/Address/CountryList.d.ts +5 -21
  99. package/build/features/shared/Address/InputSelect.d.ts +5 -21
  100. package/build/features/shared/Input/Input.d.ts +1 -1
  101. package/build/features/shared/UploadFile/FileUpload.d.ts +2 -7
  102. package/build/features/shared/UploadFile/UploadFile.d.ts +2 -7
  103. package/build/features/shared/UploadFile/UploadWrapper.d.ts +2 -7
  104. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +2 -7
  105. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +2 -7
  106. package/build/hooks/useAppDispatch.d.ts +1 -0
  107. package/build/index.d.ts +3 -2
  108. package/build/index.js +3 -1
  109. package/build/utils/common.d.ts +1 -0
  110. package/build/utils/common.js +8 -1
  111. package/build/utils/string.d.ts +1 -0
  112. package/build/utils/string.js +3 -0
  113. package/package.json +1 -1
@@ -0,0 +1,107 @@
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
22
+ import * as React from 'react';
23
+ import { useTranslation } from 'react-i18next';
24
+ import { useController, useFormContext } from 'react-hook-form';
25
+ import { styled } from '@mui/material/styles';
26
+ import Box from '@mui/material/Box';
27
+ import CircularProgress from '@mui/material/CircularProgress';
28
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
29
+ import Collapse from '../../../../components/Collapse';
30
+ import Text from '../../../../components/Text';
31
+ import SimpleList from '../../../../components/SimpleList';
32
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
33
+ import InputSelect from '../../../shared/InputSelect';
34
+ import { getMerchantList, authSelector } from '../../../app/auth/authStore';
35
+ import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
36
+ import CheckIcon from '../../../shared/CheckIcon';
37
+ var MerchantContainer = styled(Box)(function () { return ({
38
+ display: 'flex'
39
+ }); });
40
+ var MerchantNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
41
+ var theme = _a.theme, isSelected = _a.isSelected;
42
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
43
+ });
44
+ var MerchantList = React.forwardRef(function (_a, ref) {
45
+ var _b;
46
+ var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly, isVerified = _a.isVerified;
47
+ var _c = React.useState([]), list = _c[0], setList = _c[1];
48
+ var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
49
+ var t = useTranslation().t;
50
+ var dispatch = useAppDispatch();
51
+ var _e = useFormContext(), control = _e.control, watch = _e.watch, setValue = _e.setValue;
52
+ var _f = useAppSelector(authSelector), data = _f.data, merchantLoading = _f.merchantLoading;
53
+ var merchantList = (data.responseData || {}).merchantList;
54
+ var merchantInfoControl = useController({ control: control, name: 'merchantInfo' });
55
+ var entityInfo = watch('entityInfo');
56
+ var merchantValue = merchantInfoControl.field.value;
57
+ var error = (_b = merchantInfoControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
58
+ React.useEffect(function () {
59
+ if ((merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 0) {
60
+ var list_1 = __spreadArray([], merchantList, true);
61
+ setList(list_1);
62
+ }
63
+ }, [merchantList]);
64
+ React.useEffect(function () {
65
+ var _a;
66
+ if (!entityInfo)
67
+ return;
68
+ if (merchantLoading)
69
+ return;
70
+ var entityId = (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 0 ? (_a = merchantList[0]) === null || _a === void 0 ? void 0 : _a.business_entity_id : '';
71
+ var id = (entityInfo || {}).id;
72
+ if (!id)
73
+ return;
74
+ if (entityId && id && entityId !== id) {
75
+ setValue('merchantInfo', undefined);
76
+ dispatch(getMerchantList(id));
77
+ return;
78
+ }
79
+ if (!(merchantList === null || merchantList === void 0 ? void 0 : merchantList.length)) {
80
+ dispatch(getMerchantList(id));
81
+ }
82
+ }, [entityInfo, merchantList]);
83
+ var onOpenMerchantSelect = function (event) {
84
+ if (readOnly)
85
+ return;
86
+ setAnchorEl(event.currentTarget);
87
+ onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
88
+ };
89
+ var onCloseMerchantSelect = function () {
90
+ setAnchorEl(null);
91
+ onListClose === null || onListClose === void 0 ? void 0 : onListClose();
92
+ setList(merchantList);
93
+ };
94
+ var onSelectItem = function (merchant) {
95
+ onCloseMerchantSelect();
96
+ merchantInfoControl.field.onChange(merchant);
97
+ };
98
+ var getName = function (merchant) {
99
+ if (!merchant)
100
+ return '';
101
+ return merchant.display_name;
102
+ };
103
+ return (_jsx(Collapse, __assign({ in: show && (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 1 }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_merchant_label'), readOnly: readOnly, placeholder: t('select_merchant_placeholder'), value: getName(merchantValue) || '', warningMessage: error && t(error), onClick: merchantLoading ? undefined : !!anchorEl ? function () { return onCloseMerchantSelect(); } : onOpenMerchantSelect, endAdornment: merchantLoading ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : (_jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified })) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { list: list || [], onSelectItem: onSelectItem, renderItem: function (item) {
104
+ return (_jsxs(_Fragment, { children: [_jsx(MerchantContainer, { children: _jsx(MerchantNameText, __assign({ isSelected: item.id === (merchantValue === null || merchantValue === void 0 ? void 0 : merchantValue.id) }, { children: getName(item) })) }), item.id === (merchantValue === null || merchantValue === void 0 ? void 0 : merchantValue.id) && _jsx(CheckIcon, { isVerified: isVerified })] }));
105
+ } }) }))] })) })));
106
+ });
107
+ export default React.memo(MerchantList);
@@ -0,0 +1,3 @@
1
+ import AuthenticationList, { AuthenticationListProps } from './AuthenticationList';
2
+ export type { AuthenticationListProps };
3
+ export default AuthenticationList;
@@ -0,0 +1,2 @@
1
+ import AuthenticationList from './AuthenticationList';
2
+ export default AuthenticationList;
@@ -0,0 +1,14 @@
1
+ import * as yup from 'yup';
2
+ export declare const AuthenticationListValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
4
+ entityInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
5
+ merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
6
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
8
+ entityInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
9
+ merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
10
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
+ brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
12
+ entityInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
13
+ merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
14
+ }>>>;
@@ -0,0 +1,8 @@
1
+ import * as yup from 'yup';
2
+ export var AuthenticationListValidationSchema = function () {
3
+ return yup.object().shape({
4
+ brandInfo: yup.object().required('auth_brand_required'),
5
+ entityInfo: yup.object().required('auth_entity_required'),
6
+ merchantInfo: yup.object().required('auth_merchant_required')
7
+ });
8
+ };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface BusinessCountryScreenProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: BusinessCountryScreenProps) => import("react/jsx-runtime").JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,105 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
+ import * as React from 'react';
50
+ import { useTranslation } from 'react-i18next';
51
+ import { useAppSelector, useAppDispatch, useLanguage } from '../../../../hooks';
52
+ import { ScreenContainer } from '../../../shared/Containers';
53
+ import BusinessCountry from '../../../shared/BusinessCountry';
54
+ import Button from '../../../shared/Button';
55
+ import { findCountryByIso2, isKW, isOtherThanKWOrSA } from '../../../../utils';
56
+ import Collapse from '../../../../components/Collapse';
57
+ import { handleNextScreenStep, handleSetCountryByIso2, settingsSelector } from '../../../../app/settings';
58
+ import { authSelector, updateBusinessCountry, storeIsStartFromBusinessCountry, clearError, resetStore, setMobileCountryCode } from '../../../app/auth/authStore';
59
+ var BusinessCountryScreen = function (_a) {
60
+ var dispatch = useAppDispatch();
61
+ var isAr = useLanguage().isAr;
62
+ var t = useTranslation().t;
63
+ var _b = React.useState(false), isListOpen = _b[0], setListOpen = _b[1];
64
+ var settingsData = useAppSelector(settingsSelector).data;
65
+ var _c = useAppSelector(authSelector), data = _c.data, loading = _c.loading, error = _c.error;
66
+ React.useEffect(function () {
67
+ dispatch(resetStore());
68
+ dispatch(clearError());
69
+ dispatch(storeIsStartFromBusinessCountry(true));
70
+ }, []);
71
+ var defaultValue = React.useMemo(function () {
72
+ var _a, _b, _c;
73
+ return (_b = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2) !== null && _b !== void 0 ? _b : (_c = settingsData.ipCountry) === null || _c === void 0 ? void 0 : _c.iso2;
74
+ }, [settingsData.businessCountry, settingsData.ipCountry]);
75
+ var onSelectCountry = function (iso2) { return __awaiter(void 0, void 0, void 0, function () {
76
+ var countryCode;
77
+ return __generator(this, function (_a) {
78
+ switch (_a.label) {
79
+ case 0:
80
+ if (!iso2)
81
+ return [2];
82
+ countryCode = findCountryByIso2(settingsData.countries, iso2);
83
+ dispatch(handleSetCountryByIso2(iso2));
84
+ if (!data.leadId) return [3, 2];
85
+ return [4, dispatch(updateBusinessCountry(iso2)).unwrap()];
86
+ case 1:
87
+ _a.sent();
88
+ _a.label = 2;
89
+ case 2:
90
+ if (countryCode)
91
+ dispatch(setMobileCountryCode(countryCode));
92
+ if (isOtherThanKWOrSA(iso2) || isKW(iso2)) {
93
+ dispatch(handleNextScreenStep('AUTH_MOBILE_STEP'));
94
+ return [2];
95
+ }
96
+ dispatch(handleNextScreenStep('AUTH_NID_STEP'));
97
+ return [2];
98
+ }
99
+ });
100
+ }); };
101
+ return (_jsxs(ScreenContainer, { children: [_jsx(BusinessCountry, { sx: { mb: 2.5 }, countries: settingsData.businessCountries, loading: loading, defaultCountryIso2: defaultValue, onSelectCountry: onSelectCountry, onListOpen: function () { return setListOpen(true); }, onListClose: function () { return setListOpen(false); } }), _jsx(Collapse, __assign({ in: !isListOpen }, { children: _jsx(Button, __assign({ onClick: function () {
102
+ onSelectCountry(defaultValue);
103
+ }, loading: loading, isAr: isAr, disableBack: true, disabled: !defaultValue, error: t(error || '') }, { children: t('next') })) }))] }));
104
+ };
105
+ export default React.memo(BusinessCountryScreen);
@@ -0,0 +1,3 @@
1
+ import BusinessCountryScreen, { BusinessCountryScreenProps } from './BusinessCountry';
2
+ export type { BusinessCountryScreenProps };
3
+ export default BusinessCountryScreen;
@@ -0,0 +1,2 @@
1
+ import BusinessCountryScreen from './BusinessCountry';
2
+ export default BusinessCountryScreen;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface CivilIDProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: CivilIDProps) => import("react/jsx-runtime").JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,88 @@
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 { useForm, FormProvider } from 'react-hook-form';
16
+ import { alpha, styled } from '@mui/material/styles';
17
+ import Box from '@mui/material/Box';
18
+ import { yupResolver } from '@hookform/resolvers/yup';
19
+ import { civilIDValidationSchema } from './validation';
20
+ import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
21
+ import { handleCurrentActiveScreen, handlePrevScreenStep } from '../../../../app/settings';
22
+ import { clearError, authSelector, resetStore, createCivilIdAuth } from '../../../app/auth/authStore';
23
+ import Form from '../../../../components/Form';
24
+ import Button, { MobileButton } from '../../../shared/Button';
25
+ import { ScreenContainer } from '../../../shared/Containers';
26
+ import Collapse from '../../../../components/Collapse';
27
+ import Divider from '@mui/material/Divider';
28
+ import Text from '../../../../components/Text';
29
+ import { deepCopy } from '../../../../utils';
30
+ import IDNumber from './IDNumber';
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 CivilID = function (_a) {
60
+ var isAr = useLanguage().isAr;
61
+ var dispatch = useAppDispatch();
62
+ var t = useTranslation().t;
63
+ var _b = useAppSelector(authSelector), data = _b.data, loading = _b.loading, error = _b.error;
64
+ var methods = useForm({
65
+ resolver: yupResolver(civilIDValidationSchema),
66
+ defaultValues: data.civilIdData,
67
+ mode: 'onChange'
68
+ });
69
+ React.useEffect(function () {
70
+ if (error)
71
+ dispatch(clearError());
72
+ }, [methods.formState.isValid]);
73
+ React.useEffect(function () {
74
+ dispatch(resetStore());
75
+ }, []);
76
+ var onSubmit = function (data) {
77
+ dispatch(createCivilIdAuth(deepCopy(data)));
78
+ };
79
+ var onBack = function () {
80
+ dispatch(handlePrevScreenStep());
81
+ };
82
+ var onBackToCountryList = function () {
83
+ dispatch(handleCurrentActiveScreen('AUTH_BUSINESS_COUNTRY_STEP'));
84
+ };
85
+ var disabled = !methods.formState.isValid;
86
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(IDNumber, { sx: { mb: methods.formState.isValid ? 7.5 : 0, transition: 'mb 0.3s' } }), _jsx(Button, __assign({ loading: loading, isAr: isAr, onBackClicked: onBackToCountryList, disableBack: !data.isStartFromBusinessCountry, disabled: disabled, 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 }, { children: t('mobile_button_label') }))] }))] })) })) }));
87
+ };
88
+ export default React.memo(CivilID);
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { SxProps, Theme } from '@mui/material/styles';
3
+ interface IDNumberProps {
4
+ sx: SxProps<Theme> | undefined;
5
+ readOnly?: boolean;
6
+ }
7
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
8
+ export default _default;
@@ -0,0 +1,54 @@
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 { useController, useFormContext } from 'react-hook-form';
16
+ import Box from '@mui/material/Box';
17
+ import { styled, alpha } from '@mui/material/styles';
18
+ import Text from '../../../../components/Text';
19
+ import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
20
+ import { CIVIL_ID_NUMBER_LENGTH } from '../../../../constants';
21
+ import Input from '../../../shared/Input';
22
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
+ import { EndAdornment } from '../../../shared/EndAdornment';
24
+ var LabelContainerStyled = styled(Box)(function (_a) {
25
+ var theme = _a.theme;
26
+ return ({
27
+ display: 'flex',
28
+ justifyContent: 'space-between',
29
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
30
+ });
31
+ });
32
+ var InputLabelStyled = styled(Text)(function (_a) {
33
+ var theme = _a.theme;
34
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
35
+ });
36
+ var IDNumber = React.forwardRef(function (_a, ref) {
37
+ var _b;
38
+ var sx = _a.sx, readOnly = _a.readOnly;
39
+ var t = useTranslation().t;
40
+ var control = useFormContext().control;
41
+ var civilIdControl = useController({ control: control, name: 'civilId' });
42
+ var handleIdChange = function (_a) {
43
+ var target = _a.target;
44
+ var value = removeAllOtherThanCharsAndNumber(target.value);
45
+ civilIdControl.field.onChange(value);
46
+ };
47
+ var clearIdNumber = function () {
48
+ civilIdControl.field.onChange('');
49
+ };
50
+ var idValue = civilIdControl.field.value;
51
+ var error = (_b = civilIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
52
+ return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_civil_id') }) }), _jsx(Input, { dir: 'ltr', type: 'text', readOnly: readOnly, inputProps: { maxLength: CIVIL_ID_NUMBER_LENGTH }, onChange: handleIdChange, value: idValue, endAdornment: _jsx(EndAdornment, { value: idValue, error: error, onClear: clearIdNumber }), placeholder: t('civil_id_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true })] })));
53
+ });
54
+ export default React.memo(IDNumber);
@@ -0,0 +1,3 @@
1
+ import CivilID, { CivilIDProps } from './CivilID';
2
+ export type { CivilIDProps };
3
+ export default CivilID;
@@ -0,0 +1,2 @@
1
+ import CivilID from './CivilID';
2
+ export default CivilID;
@@ -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) => import("react/jsx-runtime").JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,108 @@
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 { useForm, FormProvider } from 'react-hook-form';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { yupResolver } from '@hookform/resolvers/yup';
17
+ import { styled, alpha } from '@mui/material/styles';
18
+ import Box from '@mui/material/Box';
19
+ import Divider from '@mui/material/Divider';
20
+ import Collapse from '../../../../components/Collapse';
21
+ import Form from '../../../../components/Form';
22
+ import Button, { AbsherButton, MobileButton } from '../../../shared/Button';
23
+ import { useAppDispatch, useAppSelector, useCountry, useLanguage } from '../../../../hooks';
24
+ import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
25
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
26
+ import { clearError, resetStore, authSelector, createMobileAuth } from '../../../app/auth/authStore';
27
+ import { deepCopy } from '../../../../utils';
28
+ import { ICONS_NAMES } from '../../../../constants';
29
+ import Text from '../../../../components/Text';
30
+ import MobileNumber from './MobileNumber';
31
+ import { PhoneValidationSchema } from './validation';
32
+ var FormStyled = styled(Form)(function () { return ({
33
+ display: 'flex',
34
+ flexDirection: 'column'
35
+ }); });
36
+ var InputsContainerStyled = styled(Box)(function (_a) {
37
+ var _b;
38
+ var theme = _a.theme;
39
+ return (_b = {},
40
+ _b[theme.transitions.create(['padding-bottom'])] = {
41
+ duration: theme.transitions.duration.standard
42
+ },
43
+ _b);
44
+ });
45
+ var TextStyled = styled(Text)(function (_a) {
46
+ var theme = _a.theme;
47
+ return ({
48
+ color: alpha(theme.palette.primary.dark, 0.4)
49
+ });
50
+ });
51
+ var DividerStyled = styled(Divider)(function (_a) {
52
+ var theme = _a.theme;
53
+ return ({
54
+ width: '45%',
55
+ borderColor: alpha(theme.palette.primary.dark, 0.4),
56
+ marginBlockEnd: theme.spacing(0.62)
57
+ });
58
+ });
59
+ var OrBoxStyled = styled(Box)(function (_a) {
60
+ var theme = _a.theme;
61
+ return ({
62
+ display: 'flex',
63
+ justifyContent: 'space-between',
64
+ marginBlockEnd: theme.spacing(1.62),
65
+ marginBlockStart: theme.spacing(-1.25),
66
+ marginInline: theme.spacing(2.5)
67
+ });
68
+ });
69
+ var Mobile = function (_a) {
70
+ var settingData = useAppSelector(settingsSelector).data;
71
+ var _b = useAppSelector(authSelector), data = _b.data, loading = _b.loading, error = _b.error;
72
+ var _c = React.useState(false), anchor = _c[0], setAnchor = _c[1];
73
+ var t = useTranslation().t;
74
+ var isAr = useLanguage().isAr;
75
+ var dispatch = useAppDispatch();
76
+ var _d = useCountry(settingData.businessCountry.iso2), isKuwait = _d.isKuwait, isOther = _d.isOther;
77
+ var methods = useForm({
78
+ resolver: yupResolver(PhoneValidationSchema()),
79
+ defaultValues: data.mobileData,
80
+ mode: 'onChange'
81
+ });
82
+ React.useEffect(function () {
83
+ if (error)
84
+ dispatch(clearError());
85
+ }, [methods.formState.isValid]);
86
+ React.useEffect(function () {
87
+ dispatch(resetStore());
88
+ }, []);
89
+ var onSubmit = function (formData) {
90
+ dispatch(createMobileAuth(deepCopy(formData)));
91
+ };
92
+ var onBack = function () {
93
+ var screen = isKuwait ? 'AUTH_CIVIL_ID_STEP' : 'AUTH_NID_STEP';
94
+ dispatch(handlePrevScreenStep(screen));
95
+ };
96
+ var onBackToCountryList = function () {
97
+ dispatch(handleCurrentActiveScreen('AUTH_BUSINESS_COUNTRY_STEP'));
98
+ };
99
+ var handleCountryOpen = function () {
100
+ setAnchor(true);
101
+ };
102
+ var handleCountryClose = function () {
103
+ setAnchor(false);
104
+ };
105
+ var disabled = !methods.formState.isValid;
106
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: true, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(Button, __assign({ isAr: isAr, onBackClicked: onBackToCountryList, disableBack: !data.isStartFromBusinessCountry, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !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') })))] }))] }))] })) })) }));
107
+ };
108
+ export default React.memo(Mobile);
@@ -0,0 +1,13 @@
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
+ readOnly?: boolean;
11
+ }
12
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
13
+ export default _default;