@tap-payments/auth-jsconnect 1.0.69 → 1.0.70

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.
@@ -234,5 +234,6 @@
234
234
  "password_flow_pending": "Password",
235
235
  "business_flow_pending": "Business",
236
236
  "business_flow_completed": "Business",
237
- "continue": "Continue"
237
+ "continue": "Continue",
238
+ "search_placeholder": "البحث..."
238
239
  }
@@ -248,5 +248,6 @@
248
248
  "password_flow_pending": "Password",
249
249
  "business_flow_pending": "Business",
250
250
  "business_flow_completed": "Business",
251
- "continue": "Continue"
251
+ "continue": "Continue",
252
+ "search_placeholder": "search.."
252
253
  }
@@ -69,6 +69,9 @@ var ListItemStyled = styled(ListItem)(function (_a) {
69
69
  function SimpleList(_a) {
70
70
  var list = _a.list, listItemProps = _a.listItemProps, onSelectItem = _a.onSelectItem, renderItem = _a.renderItem, children = _a.children, searchKeyPath = _a.searchKeyPath, rest = __rest(_a, ["list", "listItemProps", "onSelectItem", "renderItem", "children", "searchKeyPath"]);
71
71
  var _b = React.useState(list), items = _b[0], setItems = _b[1];
72
+ React.useEffect(function () {
73
+ setItems(list);
74
+ }, [list]);
72
75
  var filterItems = function (arr, searchKey) {
73
76
  return arr.filter(function (item) {
74
77
  var searchValue = get(item, searchKeyPath || '') || '';
@@ -35,6 +35,7 @@ export declare const ICONS_NAMES: {
35
35
  ABSHER_LOGO: string;
36
36
  EMAIL_ICON: string;
37
37
  MOBILE_ICON: string;
38
+ SEARCH_ICON: string;
38
39
  GMAIL_Filled_ICON: string;
39
40
  GMAIL_White_ICON: string;
40
41
  outlook_Filled_ICON: string;
@@ -35,6 +35,7 @@ export var ICONS_NAMES = {
35
35
  ABSHER_LOGO: 'https://dash.b-cdn.net/icons/menu/Absher.svg',
36
36
  EMAIL_ICON: 'https://dash.b-cdn.net/icons/menu/email.png',
37
37
  MOBILE_ICON: 'https://dash.b-cdn.net/icons/menu/mobile.svg',
38
+ SEARCH_ICON: 'https://dash.b-cdn.net/icons/menu/search-icon.svg',
38
39
  GMAIL_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-filled.svg',
39
40
  GMAIL_White_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-white.svg',
40
41
  outlook_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Outlook-filled.svg',
@@ -469,7 +469,9 @@ export var businessSlice = createSlice({
469
469
  state.error = null;
470
470
  state.customLoading = false;
471
471
  var _a = action.payload, businessCountry = _a.businessCountry, countries = _a.countries;
472
- state.data.countries = countries;
472
+ state.data.countries = countries
473
+ .slice()
474
+ .sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
473
475
  state.data.businessCountry = businessCountry || defaultCountry;
474
476
  })
475
477
  .addCase(getCountries.pending, function (state) {
@@ -440,7 +440,9 @@ export var connectSlice = createSlice({
440
440
  state.error = null;
441
441
  state.customLoading = false;
442
442
  var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
443
- state.data.countries = countries;
443
+ state.data.countries = countries
444
+ .slice()
445
+ .sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
444
446
  state.data.businessCountry = businessCountry || defaultCountry;
445
447
  state.data.mobileData.countryCode = businessCountry || defaultCountry;
446
448
  })
@@ -1,3 +1,14 @@
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
+ };
1
12
  import { jsx as _jsx } from "react/jsx-runtime";
2
13
  import * as React from 'react';
3
14
  import { ScreenContainer } from '../../../shared/Containers';
@@ -10,10 +21,11 @@ import CheckIcon from '../../../shared/CheckIcon';
10
21
  import { bankSelector } from '../../../app/bank/bankStore';
11
22
  import { useAppSelector } from '../../../../hooks';
12
23
  import { removeAllOtherThanAlphabetAndSpace } from '../../../../utils';
24
+ import Collapse from '../../../../components/Collapse';
13
25
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
14
26
  var theme = _a.theme;
15
27
  return ({
16
- marginBlockEnd: theme.spacing(3)
28
+ marginBlockStart: theme.spacing(3)
17
29
  });
18
30
  });
19
31
  var InputStyled = styled(Input)(function () { return ({
@@ -25,22 +37,23 @@ var BankName = function () {
25
37
  var _a, _b;
26
38
  var t = useTranslation().t;
27
39
  var _c = useFormContext(), setValue = _c.setValue, control = _c.control;
28
- var _d = useAppSelector(bankSelector), data = _d.data, loading = _d.loading;
40
+ var data = useAppSelector(bankSelector).data;
29
41
  var bankNameControl = useController({ name: 'bankName', control: control });
30
42
  var bankNameValue = bankNameControl.field.value;
31
43
  var hasError = !!((_a = bankNameControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message);
32
- var bankName = (_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.bank_name;
33
44
  var clearValue = function () {
34
45
  bankNameControl.field.onChange('');
35
46
  };
36
47
  React.useEffect(function () {
48
+ var _a;
49
+ var bankName = (_a = data.bankData.responseBody) === null || _a === void 0 ? void 0 : _a.bank_name;
37
50
  setValue('bankName', bankName);
38
- }, []);
51
+ }, [(_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.bank_name]);
39
52
  var handleBankChange = function (_a) {
40
53
  var target = _a.target;
41
54
  var value = removeAllOtherThanAlphabetAndSpace(target.value);
42
55
  bankNameControl.field.onChange(value);
43
56
  };
44
- return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), onChange: handleBankChange, value: bankNameValue, required: true, disabled: !!bankName, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
57
+ return (_jsx(Collapse, __assign({ in: !!bankNameValue }, { children: _jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), onChange: handleBankChange, value: bankNameValue, required: true, readOnly: true, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }) })));
45
58
  };
46
59
  export default BankName;
@@ -40,7 +40,6 @@ import Input from '../../../shared/Input';
40
40
  import { useTranslation } from 'react-i18next';
41
41
  import { useController, useFormContext } from 'react-hook-form';
42
42
  import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
43
- import { styled } from '@mui/material';
44
43
  import { MAX_IBAN_VALUE } from '../../../../constants';
45
44
  import { ScreenContainer } from '../../../shared/Containers';
46
45
  import { debounce } from 'lodash-es';
@@ -50,12 +49,6 @@ import axios from 'axios';
50
49
  import ClearIcon from '../../../shared/ClearIcon';
51
50
  import CheckIcon from '../../../shared/CheckIcon';
52
51
  import CircularProgress from '@mui/material/CircularProgress';
53
- var FeatureStyled = styled(ScreenContainer)(function (_a) {
54
- var theme = _a.theme;
55
- return ({
56
- marginBlockEnd: theme.spacing(3)
57
- });
58
- });
59
52
  var cancelToken = null;
60
53
  var IBAN = function (_a) {
61
54
  var _b;
@@ -93,6 +86,6 @@ var IBAN = function (_a) {
93
86
  var clearValue = function () {
94
87
  ibanControl.field.onChange('');
95
88
  };
96
- return (_jsx(FeatureStyled, { children: _jsx(Input, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('enter_iban_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: ibanChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && ibanValue ? (_jsx(CheckIcon, {})) : (ibanValue && _jsx(ClearIcon, { onClick: clearValue })) }) }));
89
+ return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('enter_iban_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: ibanChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && ibanValue ? (_jsx(CheckIcon, {})) : (ibanValue && _jsx(ClearIcon, { onClick: clearValue })) }) }));
97
90
  };
98
91
  export default IBAN;
@@ -1,14 +1,14 @@
1
1
  import * as yup from 'yup';
2
2
  export declare const BankValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
3
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
- bankName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
5
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
6
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
7
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
- bankName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
9
9
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
10
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
11
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
- bankName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
+ bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
13
13
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
14
  }>>>;
@@ -7,7 +7,7 @@ export var BankValidation = yup.object().shape({
7
7
  .min(16, 'invalid_iban_format')
8
8
  .max(34, 'invalid_iban_format')
9
9
  .required('alert_iban'),
10
- bankName: yup.string().required('bank_name_required'),
10
+ bankName: yup.string().optional(),
11
11
  beneficiaryName: yup
12
12
  .string()
13
13
  .matches(REGEX_BENEFICIARY_NAME, 'beneficiary_name_invalid')
@@ -36,6 +36,7 @@ import Input from '../../../shared/Input';
36
36
  import SimpleList from '../../../../components/SimpleList';
37
37
  import { removeAllCharsFromNumber } from '../../../../utils';
38
38
  import { useLanguage } from '../../../../hooks';
39
+ import Search from '../../../shared/Search';
39
40
  var LabelContainerStyled = styled(Box)(function (_a) {
40
41
  var theme = _a.theme;
41
42
  return ({
@@ -74,11 +75,11 @@ var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
74
75
  var MobileNumber = React.forwardRef(function (_a, ref) {
75
76
  var _b, _c, _d;
76
77
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
77
- var countriesCode = React.useState(countries || [])[0];
78
- var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
78
+ var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
79
+ var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
79
80
  var t = useTranslation().t;
80
81
  var isAr = useLanguage().isAr;
81
- var _f = useFormContext(), control = _f.control, setValue = _f.setValue;
82
+ var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
82
83
  var phoneControl = useController({ name: 'mobile', control: control });
83
84
  var countryCodeControl = useController({ name: 'countryCode', control: control });
84
85
  var countryCodeValue = countryCodeControl.field.value;
@@ -108,16 +109,29 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
108
109
  };
109
110
  var toggleCountryList = function () {
110
111
  var _a, _b;
111
- anchorEl ? setAnchorEl(null) : setAnchorEl(true);
112
- anchorEl ? (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest) : (_b = rest.onListOpen) === null || _b === void 0 ? void 0 : _b.call(rest);
112
+ if (anchorEl) {
113
+ setAnchorEl(null);
114
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
115
+ }
116
+ else {
117
+ (_b = rest.onListOpen) === null || _b === void 0 ? void 0 : _b.call(rest);
118
+ setAnchorEl(true);
119
+ }
113
120
  };
114
121
  var onSelectItem = function (country) {
115
122
  onCloseCountryList();
116
123
  setValue('mobile', '');
117
124
  countryCodeControl.field.onChange(country);
118
125
  };
119
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', onChange: onPhoneNumberChange, 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: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
120
- 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, {})] }));
121
- } }) }))] })) })));
126
+ var handleSearch = function (value) {
127
+ var filteredCountries = countries.filter(function (country) {
128
+ return country.name.arabic.toLowerCase().startsWith(value.toLowerCase()) ||
129
+ country.name.english.toLowerCase().startsWith(value.toLowerCase());
130
+ });
131
+ setCountries(filteredCountries);
132
+ };
133
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', onChange: onPhoneNumberChange, 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: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
134
+ 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, {})] }));
135
+ } })] }))] })) })));
122
136
  });
123
137
  export default React.memo(MobileNumber);
@@ -36,6 +36,7 @@ import Input from '../../../shared/Input';
36
36
  import SimpleList from '../../../../components/SimpleList';
37
37
  import { removeAllCharsFromNumber } from '../../../../utils';
38
38
  import { useLanguage } from '../../../../hooks';
39
+ import Search from '../../../shared/Search';
39
40
  var LabelContainerStyled = styled(Box)(function (_a) {
40
41
  var theme = _a.theme;
41
42
  return ({
@@ -74,11 +75,11 @@ var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
74
75
  var MobileNumber = React.forwardRef(function (_a, ref) {
75
76
  var _b, _c, _d;
76
77
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
77
- var countriesCode = React.useState(countries || [])[0];
78
- var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
78
+ var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
79
+ var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
79
80
  var t = useTranslation().t;
80
81
  var isAr = useLanguage().isAr;
81
- var _f = useFormContext(), control = _f.control, setValue = _f.setValue;
82
+ var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
82
83
  var phoneControl = useController({ name: 'mobile', control: control });
83
84
  var countryCodeControl = useController({ name: 'countryCode', control: control });
84
85
  var countryCodeValue = countryCodeControl.field.value;
@@ -108,16 +109,29 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
108
109
  };
109
110
  var toggleCountryList = function () {
110
111
  var _a, _b;
111
- anchorEl ? setAnchorEl(null) : setAnchorEl(true);
112
- anchorEl ? (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest) : (_b = rest.onListOpen) === null || _b === void 0 ? void 0 : _b.call(rest);
112
+ if (anchorEl) {
113
+ setAnchorEl(null);
114
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
115
+ }
116
+ else {
117
+ (_b = rest.onListOpen) === null || _b === void 0 ? void 0 : _b.call(rest);
118
+ setAnchorEl(true);
119
+ }
113
120
  };
114
121
  var onSelectItem = function (country) {
115
122
  onCloseCountryList();
116
123
  setValue('mobile', '');
117
124
  countryCodeControl.field.onChange(country);
118
125
  };
119
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', onChange: onPhoneNumberChange, 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 }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
120
- 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, {})] }));
121
- } }) }))] })) })));
126
+ var handleSearch = function (value) {
127
+ var filteredCountries = countries.filter(function (country) {
128
+ return country.name.arabic.toLowerCase().startsWith(value.toLowerCase()) ||
129
+ country.name.english.toLowerCase().startsWith(value.toLowerCase());
130
+ });
131
+ setCountries(filteredCountries);
132
+ };
133
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', onChange: onPhoneNumberChange, 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, { list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
134
+ 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, {})] }));
135
+ } })] }))] })) })));
122
136
  });
123
137
  export default React.memo(MobileNumber);
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ interface SearchProps {
3
+ showSearch?: boolean;
4
+ onSearchValue?: (value: string) => void;
5
+ }
6
+ declare const Search: ({ onSearchValue, showSearch }: SearchProps) => JSX.Element;
7
+ export default Search;
@@ -0,0 +1,25 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import Input from '../../shared/Input';
16
+ import Collapse from '../../../components/Collapse';
17
+ var Search = function (_a) {
18
+ var onSearchValue = _a.onSearchValue, showSearch = _a.showSearch;
19
+ var t = useTranslation().t;
20
+ var handleOnChange = function (event) {
21
+ onSearchValue === null || onSearchValue === void 0 ? void 0 : onSearchValue(event.target.value);
22
+ };
23
+ return (_jsx(React.Fragment, { children: _jsx(Collapse, __assign({ in: showSearch }, { children: _jsx(Input, { placeholder: t('search_placeholder'), onChange: handleOnChange }) })) }));
24
+ };
25
+ export default Search;
@@ -0,0 +1,2 @@
1
+ import Search from './Search';
2
+ export default Search;
@@ -0,0 +1,2 @@
1
+ import Search from './Search';
2
+ export default Search;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface CustomSearchIconProps {
3
+ onClick: () => void;
4
+ }
5
+ export default function CustomSearchIcon(props: CustomSearchIconProps): JSX.Element;
6
+ export {};
@@ -0,0 +1,26 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import Icon from '../../../components/Icon';
14
+ import { styled } from '@mui/material/styles';
15
+ import { ICONS_NAMES } from '../../../constants';
16
+ var SearchIcon = styled(Icon)(function (_a) {
17
+ var theme = _a.theme;
18
+ return ({
19
+ width: theme.spacing(2),
20
+ height: theme.spacing(2),
21
+ cursor: 'pointer'
22
+ });
23
+ });
24
+ export default function CustomSearchIcon(props) {
25
+ return _jsx(SearchIcon, __assign({ src: ICONS_NAMES.SEARCH_ICON }, props));
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",