@selfcommunity/react-ui 0.8.0-alpha.2 → 0.8.0-alpha.20

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 (90) hide show
  1. package/lib/cjs/components/BottomNavigation/BottomNavigation.js +11 -2
  2. package/lib/cjs/components/Composer/Composer.js +10 -2
  3. package/lib/cjs/components/Composer/Layer/AudienceLayer/AudienceLayer.js +12 -3
  4. package/lib/cjs/components/CreateEventButton/CreateEventButton.js +5 -1
  5. package/lib/cjs/components/CreateEventWidget/CreateEventWidget.js +5 -1
  6. package/lib/cjs/components/EventForm/EventAddress.d.ts +3 -8
  7. package/lib/cjs/components/EventForm/EventAddress.js +20 -20
  8. package/lib/cjs/components/EventForm/EventForm.d.ts +1 -1
  9. package/lib/cjs/components/EventForm/EventForm.js +90 -76
  10. package/lib/cjs/components/EventForm/constants.d.ts +4 -0
  11. package/lib/cjs/components/EventForm/constants.js +5 -1
  12. package/lib/cjs/components/EventForm/types.d.ts +27 -0
  13. package/lib/cjs/components/EventForm/types.js +2 -0
  14. package/lib/cjs/components/EventForm/utils.d.ts +4 -0
  15. package/lib/cjs/components/EventForm/utils.js +28 -0
  16. package/lib/cjs/components/EventHeader/EventHeader.js +1 -1
  17. package/lib/cjs/components/EventInfoWidget/EventInfoWidget.js +24 -1
  18. package/lib/cjs/components/Events/Events.js +4 -4
  19. package/lib/cjs/components/Feed/Feed.js +10 -2
  20. package/lib/cjs/components/GroupActionsMenu/index.d.ts +57 -0
  21. package/lib/cjs/components/GroupActionsMenu/index.js +157 -0
  22. package/lib/cjs/components/GroupHeader/GroupHeader.d.ts +6 -0
  23. package/lib/cjs/components/GroupHeader/GroupHeader.js +8 -4
  24. package/lib/cjs/components/Groups/Groups.js +26 -0
  25. package/lib/cjs/components/MyEventsWidget/MyEventsWidget.js +6 -2
  26. package/lib/cjs/components/NavigationToolbar/NavigationToolbar.js +12 -3
  27. package/lib/cjs/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -2
  28. package/lib/cjs/components/Notification/Event/Event.js +4 -0
  29. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.d.ts +10 -1
  30. package/lib/cjs/components/OnBoardingWidget/OnBoardingWidget.js +69 -26
  31. package/lib/cjs/components/OnBoardingWidget/Steps/Invite/Invite.js +26 -3
  32. package/lib/cjs/components/PlatformWidget/constants.d.ts +0 -4
  33. package/lib/cjs/components/PlatformWidget/constants.js +1 -5
  34. package/lib/cjs/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +7 -2
  35. package/lib/cjs/constants/GroupActionsMenu.d.ts +5 -0
  36. package/lib/cjs/constants/GroupActionsMenu.js +8 -0
  37. package/lib/cjs/index.d.ts +2 -1
  38. package/lib/cjs/index.js +6 -4
  39. package/lib/cjs/shared/ContributionActionsMenu/index.js +6 -6
  40. package/lib/cjs/shared/EventActionsMenu/index.d.ts +4 -0
  41. package/lib/cjs/shared/EventActionsMenu/index.js +13 -3
  42. package/lib/cjs/shared/InfiniteScroll/index.js +3 -3
  43. package/lib/cjs/shared/Media/Link/DisplayComponent.js +21 -5
  44. package/lib/cjs/utils/formatRelativeTime.js +2 -2
  45. package/lib/esm/components/BottomNavigation/BottomNavigation.js +11 -2
  46. package/lib/esm/components/Composer/Composer.js +10 -2
  47. package/lib/esm/components/Composer/Layer/AudienceLayer/AudienceLayer.js +13 -4
  48. package/lib/esm/components/CreateEventButton/CreateEventButton.js +5 -1
  49. package/lib/esm/components/CreateEventWidget/CreateEventWidget.js +5 -1
  50. package/lib/esm/components/EventForm/EventAddress.d.ts +3 -8
  51. package/lib/esm/components/EventForm/EventAddress.js +20 -20
  52. package/lib/esm/components/EventForm/EventForm.d.ts +1 -1
  53. package/lib/esm/components/EventForm/EventForm.js +92 -78
  54. package/lib/esm/components/EventForm/constants.d.ts +4 -0
  55. package/lib/esm/components/EventForm/constants.js +4 -0
  56. package/lib/esm/components/EventForm/types.d.ts +27 -0
  57. package/lib/esm/components/EventForm/types.js +1 -0
  58. package/lib/esm/components/EventForm/utils.d.ts +4 -0
  59. package/lib/esm/components/EventForm/utils.js +21 -0
  60. package/lib/esm/components/EventHeader/EventHeader.js +1 -1
  61. package/lib/esm/components/EventInfoWidget/EventInfoWidget.js +25 -2
  62. package/lib/esm/components/Events/Events.js +4 -4
  63. package/lib/esm/components/Feed/Feed.js +12 -4
  64. package/lib/esm/components/GroupActionsMenu/index.d.ts +57 -0
  65. package/lib/esm/components/GroupActionsMenu/index.js +154 -0
  66. package/lib/esm/components/GroupHeader/GroupHeader.d.ts +6 -0
  67. package/lib/esm/components/GroupHeader/GroupHeader.js +9 -5
  68. package/lib/esm/components/Groups/Groups.js +27 -1
  69. package/lib/esm/components/MyEventsWidget/MyEventsWidget.js +7 -3
  70. package/lib/esm/components/NavigationToolbar/NavigationToolbar.js +12 -3
  71. package/lib/esm/components/NavigationToolbarMobile/NavigationToolbarMobile.js +11 -2
  72. package/lib/esm/components/Notification/Event/Event.js +4 -0
  73. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.d.ts +10 -1
  74. package/lib/esm/components/OnBoardingWidget/OnBoardingWidget.js +71 -28
  75. package/lib/esm/components/OnBoardingWidget/Steps/Invite/Invite.js +27 -4
  76. package/lib/esm/components/PlatformWidget/constants.d.ts +0 -4
  77. package/lib/esm/components/PlatformWidget/constants.js +0 -4
  78. package/lib/esm/components/UserSubscribedGroupsWidget/UserSubscribedGroupsWidget.js +8 -3
  79. package/lib/esm/constants/GroupActionsMenu.d.ts +5 -0
  80. package/lib/esm/constants/GroupActionsMenu.js +5 -0
  81. package/lib/esm/index.d.ts +2 -1
  82. package/lib/esm/index.js +2 -1
  83. package/lib/esm/shared/ContributionActionsMenu/index.js +6 -6
  84. package/lib/esm/shared/EventActionsMenu/index.d.ts +4 -0
  85. package/lib/esm/shared/EventActionsMenu/index.js +13 -3
  86. package/lib/esm/shared/InfiniteScroll/index.js +3 -3
  87. package/lib/esm/shared/Media/Link/DisplayComponent.js +21 -5
  88. package/lib/esm/utils/formatRelativeTime.js +2 -2
  89. package/lib/umd/react-ui.js +1 -1
  90. package/package.json +6 -6
@@ -12,10 +12,15 @@ const LazyLoad_1 = require("../../../constants/LazyLoad");
12
12
  const Skeleton_1 = tslib_1.__importDefault(require("@mui/material/Skeleton"));
13
13
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
14
14
  const constants_1 = require("./constants");
15
+ const material_1 = require("@mui/material");
15
16
  const filter_1 = tslib_1.__importDefault(require("./filter"));
16
17
  const classes = {
17
18
  displayRoot: `${constants_1.PREFIX}-display-root`,
18
19
  displayLink: `${constants_1.PREFIX}-link`,
20
+ displayHtmlWrap: `${constants_1.PREFIX}-html-wrap`,
21
+ displayHtml: `${constants_1.PREFIX}-html`,
22
+ displayHtmlPlaceholder: `${constants_1.PREFIX}-html-placeholder`,
23
+ displayHtmlLoading: `${constants_1.PREFIX}-html-loading`,
19
24
  displayVideo: `${constants_1.PREFIX}-video`,
20
25
  thumbnail: `${constants_1.PREFIX}-thumbnail`,
21
26
  thumbnailFullWidth: `${constants_1.PREFIX}-thumbnail`,
@@ -40,12 +45,23 @@ exports.default = (props) => {
40
45
  // RENDER
41
46
  /**
42
47
  * Renders link display
43
- * @param (link)
44
- * @param(key)
48
+ * @param media
49
+ * @param key
45
50
  */
46
- const renderPreview = (link, key) => {
47
- const domain = new URL(link.embed.metadata.url).hostname.replace('www.', '');
48
- return ((0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.displayLink }, { children: [link.embed.metadata.images && link.embed.metadata.images.length > 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: fullWidth ? ((0, jsx_runtime_1.jsx)(Box_1.default, { className: (0, classnames_1.default)(classes.thumbnailFullWidth, classes.image), style: { background: `url(${link.image})`, paddingBottom: `${100 / link.image_width / link.image_height}%` } })) : ((0, jsx_runtime_1.jsx)(Box_1.default, { className: (0, classnames_1.default)(classes.thumbnail, classes.image), style: { background: `url(${link.image})` } })) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.snippet }, { children: [(0, jsx_runtime_1.jsx)("b", Object.assign({ className: classes.snippetTitle }, { children: link.embed.metadata.title })), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("p", Object.assign({ className: classes.snippetDescription }, { children: link.embed.metadata.description })), (0, jsx_runtime_1.jsx)("a", Object.assign({ href: link.embed.metadata.url, target: '_blank', onClick: () => handleLinkClick(link) }, { children: domain }))] })), (0, jsx_runtime_1.jsx)("div", { style: { clear: 'both' } })] }), key));
51
+ const renderPreview = (media, key) => {
52
+ // if (media.embed.metadata.html) {
53
+ // return renderHtml(media, key);
54
+ // }
55
+ const domain = new URL(media.embed.metadata.url).hostname.replace('www.', '');
56
+ return ((0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.displayLink }, { children: [media.embed.metadata.images && media.embed.metadata.images.length > 0 && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: fullWidth ? ((0, jsx_runtime_1.jsx)(Box_1.default, { className: (0, classnames_1.default)(classes.thumbnailFullWidth, classes.image), style: { background: `url(${media.image})`, paddingBottom: `${100 / media.image_width / media.image_height}%` } })) : ((0, jsx_runtime_1.jsx)(Box_1.default, { className: (0, classnames_1.default)(classes.thumbnail, classes.image), style: { background: `url(${media.image})` } })) })), (0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.snippet }, { children: [(0, jsx_runtime_1.jsx)("b", Object.assign({ className: classes.snippetTitle }, { children: media.embed.metadata.title })), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("p", Object.assign({ className: classes.snippetDescription }, { children: media.embed.metadata.description })), (0, jsx_runtime_1.jsx)("a", Object.assign({ href: media.embed.metadata.url, target: '_blank', onClick: () => handleLinkClick(media) }, { children: domain }))] })), (0, jsx_runtime_1.jsx)("div", { style: { clear: 'both' } })] }), key));
57
+ };
58
+ /**
59
+ * Render html embed
60
+ * @param media
61
+ * @param key
62
+ */
63
+ const renderHtml = (media, key) => {
64
+ return ((0, jsx_runtime_1.jsxs)(Box_1.default, Object.assign({ className: classes.displayHtmlWrap }, { children: [(0, jsx_runtime_1.jsx)("div", { dangerouslySetInnerHTML: { __html: media.embed.metadata.html }, className: classes.displayHtml }), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes.displayHtmlPlaceholder, style: { paddingTop: `${(100 * media.embed.metadata.height) / media.embed.metadata.width}%`, maxHeight: media.embed.metadata.height } }, { children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 20, className: classes.displayHtmlLoading }) }))] }), key));
49
65
  };
50
66
  /**
51
67
  * Renders component
@@ -5,8 +5,8 @@ const getRelativeTime = (date) => {
5
5
  const diffInMilliseconds = new Date().getTime() - new Date(date).getTime();
6
6
  const seconds = Math.floor(diffInMilliseconds / 1000);
7
7
  const minutes = Math.floor(seconds / 60);
8
- const hours = Math.ceil(minutes / 60);
9
- const days = Math.floor(hours / 24);
8
+ const hours = Math.floor(minutes / 60);
9
+ const days = Math.round(hours / 24);
10
10
  const weeks = Math.floor(days / 7);
11
11
  const months = Math.floor(days / 30);
12
12
  const years = Math.floor(months / 12);
@@ -61,8 +61,17 @@ export default function BottomNavigation(inProps) {
61
61
  const { preferences, features } = useSCPreferences();
62
62
  // MEMO
63
63
  const privateMessagingEnabled = useMemo(() => features.includes(SCFeatureName.PRIVATE_MESSAGING), [features]);
64
- const groupsEnabled = useMemo(() => features.includes(SCFeatureName.GROUPING) && features.includes(SCFeatureName.TAGGING), [features]);
65
- const eventsEnabled = useMemo(() => features && features.includes(SCFeatureName.EVENT) && features.includes(SCFeatureName.TAGGING), [features]);
64
+ const groupsEnabled = useMemo(() => preferences &&
65
+ features &&
66
+ features.includes(SCFeatureName.TAGGING) &&
67
+ features.includes(SCFeatureName.GROUPING) &&
68
+ SCPreferences.CONFIGURATIONS_GROUPS_ENABLED in preferences &&
69
+ preferences[SCPreferences.CONFIGURATIONS_GROUPS_ENABLED].value, [preferences, features]);
70
+ const eventsEnabled = useMemo(() => preferences &&
71
+ features &&
72
+ features.includes(SCFeatureName.TAGGING) &&
73
+ SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
74
+ preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
66
75
  const exploreStreamEnabled = preferences[SCPreferences.CONFIGURATIONS_EXPLORE_STREAM_ENABLED].value;
67
76
  const postOnlyStaffEnabled = preferences[SCPreferences.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED].value;
68
77
  const contentAvailable = preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value;
@@ -428,10 +428,16 @@ export default function Composer(inProps) {
428
428
  if (features.includes(SCFeatureName.TAGGING) && addressing !== null) {
429
429
  data.addressing = addressing.map((t) => t.id);
430
430
  }
431
- if (features.includes(SCFeatureName.GROUPING) && group !== null) {
431
+ if (features.includes(SCFeatureName.TAGGING) &&
432
+ features.includes(SCFeatureName.GROUPING) &&
433
+ preferences[SCPreferences.CONFIGURATIONS_GROUPS_ENABLED].value &&
434
+ group !== null) {
432
435
  data.group = group.id;
433
436
  }
434
- if (features.includes(SCFeatureName.EVENT) && event !== null) {
437
+ if (features.includes(SCFeatureName.TAGGING) &&
438
+ features.includes(SCFeatureName.EVENT) &&
439
+ preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value &&
440
+ event !== null) {
435
441
  data.event = event.id;
436
442
  }
437
443
  setIsSubmitting(true);
@@ -495,6 +501,8 @@ export default function Composer(inProps) {
495
501
  }
496
502
  else {
497
503
  onClose && onClose(e);
504
+ setLayer(null);
505
+ dispatch({ type: 'reset' });
498
506
  /*setLayer(null);
499
507
  feedType && feedType === SCFeedTypologyType.CATEGORY
500
508
  ? dispatch({type: 'resetCategoryFeed'})
@@ -11,7 +11,7 @@ import TagChip from '../../../../shared/TagChip';
11
11
  import classNames from 'classnames';
12
12
  import Icon from '@mui/material/Icon';
13
13
  import DialogContent from '@mui/material/DialogContent';
14
- import { useSCFetchAddressingTagList, useSCPreferences } from '@selfcommunity/react-core';
14
+ import { SCPreferences, useSCFetchAddressingTagList, useSCPreferences } from '@selfcommunity/react-core';
15
15
  import { PREFIX } from '../../constants';
16
16
  import GroupAutocomplete from '../../../GroupAutocomplete';
17
17
  import { SCFeatureName } from '@selfcommunity/types';
@@ -57,10 +57,19 @@ const AudienceLayer = React.forwardRef((props, ref) => {
57
57
  const [value, setValue] = useState(defaultValue || undefined);
58
58
  // HOOKS
59
59
  const { scAddressingTags } = useSCFetchAddressingTagList({ fetch: autocompleteOpen });
60
- const { features } = useSCPreferences();
60
+ const { preferences, features } = useSCPreferences();
61
61
  // MEMO
62
- const eventsEnabled = useMemo(() => features && features.includes(SCFeatureName.EVENT) && features.includes(SCFeatureName.TAGGING), [features]);
63
- const groupsEnabled = useMemo(() => features && features.includes(SCFeatureName.GROUPING) && features.includes(SCFeatureName.TAGGING), [features]);
62
+ const groupsEnabled = useMemo(() => preferences &&
63
+ features &&
64
+ features.includes(SCFeatureName.TAGGING) &&
65
+ features.includes(SCFeatureName.GROUPING) &&
66
+ SCPreferences.CONFIGURATIONS_GROUPS_ENABLED in preferences &&
67
+ preferences[SCPreferences.CONFIGURATIONS_GROUPS_ENABLED].value, [preferences, features]);
68
+ const eventsEnabled = useMemo(() => preferences &&
69
+ features &&
70
+ features.includes(SCFeatureName.TAGGING) &&
71
+ SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
72
+ preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
64
73
  // HANDLERS
65
74
  const handleSave = useCallback(() => {
66
75
  audience === AudienceTypes.AUDIENCE_GROUP || audience === AudienceTypes.AUDIENCE_EVENT
@@ -52,7 +52,11 @@ export default function CreateEventButton(inProps) {
52
52
  // CONST
53
53
  const authUserId = scUserContext.user ? scUserContext.user.id : null;
54
54
  const { preferences, features } = useSCPreferences();
55
- const eventsEnabled = useMemo(() => features && features.includes(SCFeatureName.EVENT) && features.includes(SCFeatureName.TAGGING), [features]);
55
+ const eventsEnabled = useMemo(() => preferences &&
56
+ features &&
57
+ features.includes(SCFeatureName.TAGGING) &&
58
+ SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
59
+ preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
56
60
  const onlyStaffEnabled = useMemo(() => preferences[SCPreferences.CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED].value, [preferences]);
57
61
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
58
62
  // @ts-ignore
@@ -38,7 +38,11 @@ export default function CreateEventWidget(inProps) {
38
38
  const scUserContext = useContext(SCUserContext);
39
39
  // HOOK
40
40
  const { preferences, features } = useSCPreferences();
41
- const eventsEnabled = useMemo(() => features && features.includes(SCFeatureName.EVENT) && features.includes(SCFeatureName.TAGGING), [features]);
41
+ const eventsEnabled = useMemo(() => preferences &&
42
+ features &&
43
+ features.includes(SCFeatureName.TAGGING) &&
44
+ SCPreferences.CONFIGURATIONS_EVENTS_ENABLED in preferences &&
45
+ preferences[SCPreferences.CONFIGURATIONS_EVENTS_ENABLED].value, [preferences, features]);
42
46
  const authUserId = scUserContext.user ? scUserContext.user.id : null;
43
47
  const onlyStaffEnabled = useMemo(() => preferences[SCPreferences.CONFIGURATIONS_GROUPS_ONLY_STAFF_ENABLED].value, [preferences]);
44
48
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
@@ -1,13 +1,8 @@
1
- import { SCEventLocationType, SCEventType } from '@selfcommunity/types';
1
+ import { SCEventType } from '@selfcommunity/types';
2
+ import { Geolocation } from './types';
2
3
  export interface EventAddressProps {
3
4
  event?: SCEventType;
4
- forwardGeolocationData: (data: {
5
- location: SCEventLocationType;
6
- geolocation?: string;
7
- lat?: number;
8
- lng?: number;
9
- link?: string;
10
- }) => void;
5
+ forwardGeolocationData: (data: Geolocation) => void;
11
6
  className?: string;
12
7
  }
13
8
  export default function EventAddress(inProps: EventAddressProps): JSX.Element;
@@ -1,19 +1,19 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useEffect, useMemo, useState } from 'react';
4
- import { styled } from '@mui/material/styles';
5
3
  import { Autocomplete, Box, InputAdornment, Tab, Tabs, TextField } from '@mui/material';
6
4
  import Icon from '@mui/material/Icon';
7
- import classNames from 'classnames';
5
+ import { styled } from '@mui/material/styles';
8
6
  import { useThemeProps } from '@mui/system';
9
- import { PREFIX } from './constants';
10
- import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
11
- import UrlTextField from '../../shared/UrlTextField';
12
- import axios from 'axios';
7
+ import { useLoadScript } from '@react-google-maps/api';
13
8
  import { useSCContext } from '@selfcommunity/react-core';
14
- import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
15
9
  import { SCEventLocationType } from '@selfcommunity/types';
16
- import { useLoadScript } from '@react-google-maps/api';
10
+ import axios from 'axios';
11
+ import classNames from 'classnames';
12
+ import { useEffect, useMemo, useState } from 'react';
13
+ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
14
+ import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
15
+ import UrlTextField from '../../shared/UrlTextField';
16
+ import { PREFIX } from './constants';
17
17
  const messages = defineMessages({
18
18
  virtualPlaceholder: {
19
19
  id: 'ui.eventForm.address.online.placeholder',
@@ -41,8 +41,8 @@ export default function EventAddress(inProps) {
41
41
  // PROPS
42
42
  const { className, forwardGeolocationData, event } = props;
43
43
  // STATE
44
- const [location, setLocation] = useState(event ? event.location : SCEventLocationType.PERSON);
45
- const [geolocation, setGeoLocation] = useState(event ? event.geolocation : null);
44
+ const [location, setLocation] = useState((event === null || event === void 0 ? void 0 : event.location) || SCEventLocationType.PERSON);
45
+ const [geolocation, setGeoLocation] = useState(event ? { description: event.geolocation } : null);
46
46
  const [inputValue, setInputValue] = useState('');
47
47
  const [suggestions, setSuggestions] = useState([]);
48
48
  const [timeoutId, setTimeoutId] = useState(null);
@@ -54,22 +54,22 @@ export default function EventAddress(inProps) {
54
54
  libraries: ['places', 'geocoding']
55
55
  });
56
56
  // HANDLERS
57
- const handleChange = (event, newValue) => {
57
+ const handleChange = (_event, newValue) => {
58
58
  setLocation(newValue);
59
59
  };
60
- const handleSelection = (event, newValue) => __awaiter(this, void 0, void 0, function* () {
60
+ const handleSelection = (_event, newValue) => __awaiter(this, void 0, void 0, function* () {
61
61
  if (newValue) {
62
62
  try {
63
63
  const response = yield axios.get(`https://maps.googleapis.com/maps/api/geocode/json`, {
64
64
  params: {
65
- place_id: newValue.place_id,
65
+ place_id: newValue.id,
66
66
  key: geocodingApiKey
67
67
  }
68
68
  });
69
69
  const place = response.data.results[0];
70
70
  setGeoLocation(newValue);
71
71
  forwardGeolocationData({
72
- location: location,
72
+ location,
73
73
  geolocation: place.formatted_address,
74
74
  lat: place.geometry.location.lat,
75
75
  lng: place.geometry.location.lng
@@ -80,11 +80,11 @@ export default function EventAddress(inProps) {
80
80
  }
81
81
  }
82
82
  });
83
- const handleLocationChange = (event, newInputValue) => {
83
+ const handleLocationChange = (_event, newInputValue) => {
84
84
  setInputValue(newInputValue);
85
85
  };
86
86
  const handleLinkChange = (event) => {
87
- forwardGeolocationData({ location: location, link: event.target.value });
87
+ forwardGeolocationData({ location, link: event.target.value });
88
88
  };
89
89
  useEffect(() => {
90
90
  if (timeoutId) {
@@ -95,13 +95,13 @@ export default function EventAddress(inProps) {
95
95
  return;
96
96
  }
97
97
  if (inputValue.length >= 3) {
98
- const newTimeoutId = window.setTimeout(() => {
98
+ const newTimeoutId = setTimeout(() => {
99
99
  const autocompleteService = new window.google.maps.places.AutocompleteService();
100
100
  autocompleteService.getPlacePredictions({ input: inputValue }, (predictions, status) => {
101
101
  if (status === window.google.maps.places.PlacesServiceStatus.OK && predictions) {
102
102
  setSuggestions(predictions.map((prediction) => ({
103
103
  description: prediction.description,
104
- place_id: prediction.place_id
104
+ id: prediction.place_id
105
105
  })));
106
106
  }
107
107
  });
@@ -112,7 +112,7 @@ export default function EventAddress(inProps) {
112
112
  if (!geocodingApiKey && !isLoaded) {
113
113
  return _jsx(HiddenPlaceholder, {});
114
114
  }
115
- return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsxs(Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [_jsx(Tab, { value: SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "add_location_alt" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }), _jsx(Tab, { value: SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "play_circle_outline" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) })] })), _jsxs(Box, Object.assign({ className: classes.tabContent }, { children: [location === SCEventLocationType.PERSON && (_jsx(Autocomplete, { freeSolo: true, size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation, noOptionsText: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.placeholder", defaultMessage: "ui.eventForm.address.live.placeholder" }), variant: "outlined", fullWidth: true, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: (_jsxs(_Fragment, { children: [_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(Icon, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), location === SCEventLocationType.ONLINE && (_jsx(UrlTextField, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
115
+ return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className) }, { children: [_jsxs(Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [_jsx(Tab, { value: SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "add_location_alt" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }), _jsx(Tab, { value: SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: _jsx(Icon, { children: "play_circle_outline" }), iconPosition: "start", label: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) })] })), _jsxs(Box, Object.assign({ className: classes.tabContent }, { children: [location === SCEventLocationType.PERSON && (_jsx(Autocomplete, { size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation.description, noOptionsText: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), isOptionEqualToValue: (option, value) => option.description === value.description, renderInput: (params) => (_jsx(TextField, Object.assign({}, params, { label: _jsx(FormattedMessage, { id: "ui.eventForm.address.live.placeholder", defaultMessage: "ui.eventForm.address.live.placeholder" }), variant: "outlined", fullWidth: true, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: (_jsxs(_Fragment, { children: [_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(Icon, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), location === SCEventLocationType.ONLINE && (_jsx(UrlTextField, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: _jsx(FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
116
116
  endAdornment: _jsx(Icon, { children: "play_circle_outline" })
117
117
  }, onChange: handleLinkChange }))] }))] })));
118
118
  }
@@ -25,7 +25,7 @@ export interface EventFormProps extends BaseDialogProps {
25
25
  * On success callback function
26
26
  * @default null
27
27
  */
28
- onSuccess?: (data: any) => void;
28
+ onSuccess?: (data: SCEventType) => void;
29
29
  /**
30
30
  * Any other properties
31
31
  */