@tap-payments/auth-jsconnect 2.6.18-test → 2.6.19-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 (40) hide show
  1. package/build/@types/app.d.ts +18 -1
  2. package/build/app/settings.d.ts +3 -1
  3. package/build/app/settings.js +18 -13
  4. package/build/assets/locales/ar.json +3 -1
  5. package/build/assets/locales/en.json +3 -1
  6. package/build/components/ExpandIcon/ExpandIcon.d.ts +2 -0
  7. package/build/components/Slide/Slide.d.ts +1 -1
  8. package/build/constants/app.js +12 -0
  9. package/build/constants/dummy.d.ts +17 -0
  10. package/build/constants/dummy.js +292 -0
  11. package/build/features/app/connect/connectStore.d.ts +8 -2
  12. package/build/features/app/connect/connectStore.js +57 -9
  13. package/build/features/app/connectExpress/connectExpressStore.d.ts +1 -0
  14. package/build/features/app/connectExpress/connectExpressStore.js +55 -11
  15. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +2 -2
  16. package/build/features/business/screens/BusinessType/LicenseType.d.ts +2 -2
  17. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  18. package/build/features/connect/Connect.js +24 -14
  19. package/build/features/connect/screens/BusinessCountry/BusinessCountry.d.ts +5 -0
  20. package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +79 -0
  21. package/build/features/connect/screens/BusinessCountry/index.d.ts +3 -0
  22. package/build/features/connect/screens/BusinessCountry/index.js +2 -0
  23. package/build/features/connectExpress/ConnectExpress.js +12 -6
  24. package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.d.ts +5 -0
  25. package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +79 -0
  26. package/build/features/connectExpress/screens/BusinessCountry/index.d.ts +3 -0
  27. package/build/features/connectExpress/screens/BusinessCountry/index.js +2 -0
  28. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +2 -2
  29. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +2 -2
  30. package/build/features/featuresScreens.js +10 -0
  31. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -2
  32. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +2 -2
  33. package/build/features/shared/Address/CountryList.d.ts +1 -1
  34. package/build/features/shared/Address/InputSelect.d.ts +1 -1
  35. package/build/features/shared/BusinessCountry/BusinessCountry.d.ts +10 -0
  36. package/build/features/shared/BusinessCountry/BusinessCountry.js +170 -0
  37. package/build/features/shared/BusinessCountry/index.d.ts +2 -0
  38. package/build/features/shared/BusinessCountry/index.js +2 -0
  39. package/build/features/shared/Footer/Footer.js +2 -1
  40. package/package.json +1 -1
@@ -0,0 +1,170 @@
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 (_) 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 Box from '@mui/material/Box';
52
+ import CircularProgress from '@mui/material/CircularProgress';
53
+ import { styled } from '@mui/material/styles';
54
+ import { useLanguage } from '../../../hooks';
55
+ import SimpleList from '../../../components/SimpleList';
56
+ import Text from '../../../components/Text';
57
+ import Collapse from '../../../components/Collapse';
58
+ import ExpandIcon from '../../../components/ExpandIcon';
59
+ import Icon from '../../../components/Icon';
60
+ import { ScreenContainer } from '../../shared/Containers';
61
+ import Search from '../../shared/Search';
62
+ import InputSelect from '../../shared/InputSelect';
63
+ var NameContainer = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
64
+ var theme = _a.theme, isSelected = _a.isSelected;
65
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.caption), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), display: 'flex' }));
66
+ });
67
+ var ListItem = styled(Box)(function (_a) {
68
+ var theme = _a.theme;
69
+ return ({
70
+ display: 'flex',
71
+ justifyContent: 'space-between',
72
+ width: '100%',
73
+ paddingInlineStart: theme.spacing(2.5),
74
+ paddingInlineEnd: theme.spacing(2.5),
75
+ paddingTop: theme.spacing(1.5),
76
+ paddingBottom: theme.spacing(1.5)
77
+ });
78
+ });
79
+ var CountryListItem = styled(ListItem, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
80
+ var theme = _a.theme, isSelected = _a.isSelected;
81
+ return (__assign({ marginLeft: theme.spacing(2), marginRight: theme.spacing(2), paddingInlineStart: theme.spacing(1), paddingInlineEnd: theme.spacing(1) }, (isSelected && {
82
+ backgroundColor: '#EDF6FF',
83
+ borderRadius: theme.spacing(0.5)
84
+ })));
85
+ });
86
+ var ListItemContainer = styled(Box)(function () { return ({
87
+ display: 'flex',
88
+ flexDirection: 'column',
89
+ width: '100%'
90
+ }); });
91
+ var SimpleListStyled = styled((SimpleList))(function () { return ({
92
+ height: 'fit-content'
93
+ }); });
94
+ var CountryListStyled = styled((SimpleList))(function () { return ({
95
+ height: 'fit-content'
96
+ }); });
97
+ var BusinessCountry = function (_a) {
98
+ var _b, _c;
99
+ var countries = _a.countries, loading = _a.loading, defaultCountryIso2 = _a.defaultCountryIso2, onSelectCountry = _a.onSelectCountry;
100
+ var _d = React.useState(countries || []), countryList = _d[0], setCountryList = _d[1];
101
+ var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
102
+ var _f = React.useState(''), subIndex = _f[0], setSubIndex = _f[1];
103
+ var _g = React.useState(), selectedCountry = _g[0], setSelectedCountry = _g[1];
104
+ var t = useTranslation().t;
105
+ var isAr = useLanguage().isAr;
106
+ var countryValue = selectedCountry;
107
+ var onSelectItem = function (item) { return __awaiter(void 0, void 0, void 0, function () {
108
+ return __generator(this, function (_a) {
109
+ setSelectedCountry(item);
110
+ onSelectCountry(item);
111
+ return [2];
112
+ });
113
+ }); };
114
+ var handleCloseMainMenu = function () {
115
+ setAnchorEl(null);
116
+ handleSearch('');
117
+ };
118
+ var handleOpenMainMenu = function (event) {
119
+ setAnchorEl(event.currentTarget);
120
+ };
121
+ var handleOpenSubMenu = function (index) {
122
+ if (subIndex === index)
123
+ setSubIndex('');
124
+ else
125
+ setSubIndex(index);
126
+ };
127
+ React.useEffect(function () {
128
+ if (!defaultCountryIso2)
129
+ return;
130
+ countryList.forEach(function (r) {
131
+ return (r.countries || []).find(function (c) {
132
+ if (c.country.iso2 === defaultCountryIso2) {
133
+ setSelectedCountry(c);
134
+ return;
135
+ }
136
+ });
137
+ });
138
+ }, [defaultCountryIso2]);
139
+ var handleSearch = function (value) {
140
+ var filteredList = countryList === null || countryList === void 0 ? void 0 : countryList.filter(function (country) {
141
+ var _a, _b;
142
+ return ((_a = country.countries) === null || _a === void 0 ? void 0 : _a.find(function (obj) { return obj.country.name_en.toLowerCase().includes(value.toLowerCase()); })) ||
143
+ ((_b = country.countries) === null || _b === void 0 ? void 0 : _b.find(function (obj) { return obj.country.name_ar.toLowerCase().includes(value.toLowerCase()); }));
144
+ });
145
+ setCountryList(filteredList);
146
+ };
147
+ React.useEffect(function () {
148
+ var item = countryList === null || countryList === void 0 ? void 0 : countryList.find(function (r) { var _a; return (_a = r.countries) === null || _a === void 0 ? void 0 : _a.find(function (c) { var _a; return c.country.iso2 === ((_a = countryValue === null || countryValue === void 0 ? void 0 : countryValue.country) === null || _a === void 0 ? void 0 : _a.iso2); }); });
149
+ if (item)
150
+ setSubIndex(item.id.toString());
151
+ }, [anchorEl]);
152
+ return (_jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(InputSelect, { required: true, label: t('country_list_title'), value: (isAr ? (_b = countryValue === null || countryValue === void 0 ? void 0 : countryValue.country) === null || _b === void 0 ? void 0 : _b.name_ar : (_c = countryValue === null || countryValue === void 0 ? void 0 : countryValue.country) === null || _c === void 0 ? void 0 : _c.name_en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_any_country'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: countryList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item, e) {
153
+ e.stopPropagation();
154
+ handleOpenSubMenu(item.id.toString());
155
+ }, renderItem: function (item) {
156
+ var isSelected = !!item.countries.find(function (c) { var _a; return c.country.iso2.toLocaleLowerCase() === ((_a = countryValue === null || countryValue === void 0 ? void 0 : countryValue.country) === null || _a === void 0 ? void 0 : _a.iso2.toLocaleLowerCase()); });
157
+ return (_jsxs(ListItemContainer, { children: [_jsxs(ListItem, { children: [_jsx(NameContainer, __assign({ sx: { padding: 0 }, isSelected: isSelected }, { children: item.title })), _jsx(ExpandIcon, { anchorEl: subIndex === item.id.toString() })] }), _jsx(Collapse, __assign({ in: item.id.toString() === subIndex }, { children: _jsx(CountryListStyled, { sx: { pt: 0, pb: 0 }, list: item.countries || [], onSelectItem: function (i, e) {
158
+ e.stopPropagation();
159
+ onSelectItem(i);
160
+ }, listItemProps: { sx: { padding: 0, '&:last-child': { paddingBottom: 0 } } }, renderItem: function (item, idx) {
161
+ var _a;
162
+ var isSelected = item.country.iso2.toLocaleLowerCase() === ((_a = countryValue === null || countryValue === void 0 ? void 0 : countryValue.country) === null || _a === void 0 ? void 0 : _a.iso2.toLocaleLowerCase());
163
+ return (_jsxs(CountryListItem, __assign({ isSelected: isSelected, sx: { mt: idx === 0 ? 1 : 0 } }, { children: [_jsxs(NameContainer, __assign({ sx: { display: 'flex', alignItems: 'center', padding: 0 }, isSelected: isSelected }, { children: [_jsx(Icon, { sx: { marginInlineEnd: 1 }, src: item.country.logo }), isAr ? item.country.name_ar : item.country.name_en] })), loading && isSelected ? (_jsx(CircularProgress, { size: 20, thickness: 3, sx: { height: 'auto !important' } })) : (_jsx(ExpandIcon, { sx: {
164
+ color: isSelected ? 'rgba(31, 136, 208, 1)' : 'rgba(58, 65, 84, 0.7)',
165
+ transform: isAr ? 'rotate(90deg)' : 'rotate(270deg)'
166
+ } }))] })));
167
+ } }) }))] }));
168
+ } })] }))] })));
169
+ };
170
+ export default BusinessCountry;
@@ -0,0 +1,2 @@
1
+ import BusinessCountry from './BusinessCountry';
2
+ export default BusinessCountry;
@@ -0,0 +1,2 @@
1
+ import BusinessCountry from './BusinessCountry';
2
+ export default BusinessCountry;
@@ -6,6 +6,7 @@ import Footer from '../../../components/Footer';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { sendCustomEventToGTM } from '../../../utils';
8
8
  export default function CustomFooter() {
9
+ var _a;
9
10
  var isEn = useLanguage().isEn;
10
11
  var t = useTranslation().t;
11
12
  var dispatch = useAppDispatch();
@@ -21,7 +22,7 @@ export default function CustomFooter() {
21
22
  });
22
23
  dispatch(handleLanguage(language));
23
24
  };
24
- var country = data.businessCountry;
25
+ var country = ((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2) ? data.businessCountry : data.ipCountry;
25
26
  var countryName = isEn ? country.name.english : country.name.arabic;
26
27
  var countryFlag = country.logo;
27
28
  return _jsx(Footer, { onSwitchLanguage: handleChangeLanguage, language: t('language'), countryName: countryName, countryFlag: countryFlag });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.6.18-test",
3
+ "version": "2.6.19-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",