@selfcommunity/react-ui 0.8.0-alpha.1 → 0.8.0-alpha.3

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.
@@ -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;
@@ -2,20 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const styles_1 = require("@mui/material/styles");
7
5
  const material_1 = require("@mui/material");
8
6
  const Icon_1 = tslib_1.__importDefault(require("@mui/material/Icon"));
9
- const classnames_1 = tslib_1.__importDefault(require("classnames"));
7
+ const styles_1 = require("@mui/material/styles");
10
8
  const system_1 = require("@mui/system");
11
- const constants_1 = require("./constants");
12
- const react_intl_1 = require("react-intl");
13
- const UrlTextField_1 = tslib_1.__importDefault(require("../../shared/UrlTextField"));
14
- const axios_1 = tslib_1.__importDefault(require("axios"));
9
+ const api_1 = require("@react-google-maps/api");
15
10
  const react_core_1 = require("@selfcommunity/react-core");
16
- const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
17
11
  const types_1 = require("@selfcommunity/types");
18
- const api_1 = require("@react-google-maps/api");
12
+ const axios_1 = tslib_1.__importDefault(require("axios"));
13
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
14
+ const react_1 = require("react");
15
+ const react_intl_1 = require("react-intl");
16
+ const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
17
+ const UrlTextField_1 = tslib_1.__importDefault(require("../../shared/UrlTextField"));
18
+ const constants_1 = require("./constants");
19
19
  const messages = (0, react_intl_1.defineMessages)({
20
20
  virtualPlaceholder: {
21
21
  id: 'ui.eventForm.address.online.placeholder',
@@ -43,8 +43,8 @@ function EventAddress(inProps) {
43
43
  // PROPS
44
44
  const { className, forwardGeolocationData, event } = props;
45
45
  // STATE
46
- const [location, setLocation] = (0, react_1.useState)(event ? event.location : types_1.SCEventLocationType.PERSON);
47
- const [geolocation, setGeoLocation] = (0, react_1.useState)(event ? event.geolocation : null);
46
+ const [location, setLocation] = (0, react_1.useState)((event === null || event === void 0 ? void 0 : event.location) || types_1.SCEventLocationType.PERSON);
47
+ const [geolocation, setGeoLocation] = (0, react_1.useState)(event ? { description: event.geolocation } : null);
48
48
  const [inputValue, setInputValue] = (0, react_1.useState)('');
49
49
  const [suggestions, setSuggestions] = (0, react_1.useState)([]);
50
50
  const [timeoutId, setTimeoutId] = (0, react_1.useState)(null);
@@ -56,22 +56,22 @@ function EventAddress(inProps) {
56
56
  libraries: ['places', 'geocoding']
57
57
  });
58
58
  // HANDLERS
59
- const handleChange = (event, newValue) => {
59
+ const handleChange = (_event, newValue) => {
60
60
  setLocation(newValue);
61
61
  };
62
- const handleSelection = (event, newValue) => tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ const handleSelection = (_event, newValue) => tslib_1.__awaiter(this, void 0, void 0, function* () {
63
63
  if (newValue) {
64
64
  try {
65
65
  const response = yield axios_1.default.get(`https://maps.googleapis.com/maps/api/geocode/json`, {
66
66
  params: {
67
- place_id: newValue.place_id,
67
+ place_id: newValue.id,
68
68
  key: geocodingApiKey
69
69
  }
70
70
  });
71
71
  const place = response.data.results[0];
72
72
  setGeoLocation(newValue);
73
73
  forwardGeolocationData({
74
- location: location,
74
+ location,
75
75
  geolocation: place.formatted_address,
76
76
  lat: place.geometry.location.lat,
77
77
  lng: place.geometry.location.lng
@@ -82,11 +82,11 @@ function EventAddress(inProps) {
82
82
  }
83
83
  }
84
84
  });
85
- const handleLocationChange = (event, newInputValue) => {
85
+ const handleLocationChange = (_event, newInputValue) => {
86
86
  setInputValue(newInputValue);
87
87
  };
88
88
  const handleLinkChange = (event) => {
89
- forwardGeolocationData({ location: location, link: event.target.value });
89
+ forwardGeolocationData({ location, link: event.target.value });
90
90
  };
91
91
  (0, react_1.useEffect)(() => {
92
92
  if (timeoutId) {
@@ -97,13 +97,13 @@ function EventAddress(inProps) {
97
97
  return;
98
98
  }
99
99
  if (inputValue.length >= 3) {
100
- const newTimeoutId = window.setTimeout(() => {
100
+ const newTimeoutId = setTimeout(() => {
101
101
  const autocompleteService = new window.google.maps.places.AutocompleteService();
102
102
  autocompleteService.getPlacePredictions({ input: inputValue }, (predictions, status) => {
103
103
  if (status === window.google.maps.places.PlacesServiceStatus.OK && predictions) {
104
104
  setSuggestions(predictions.map((prediction) => ({
105
105
  description: prediction.description,
106
- place_id: prediction.place_id
106
+ id: prediction.place_id
107
107
  })));
108
108
  }
109
109
  });
@@ -114,7 +114,7 @@ function EventAddress(inProps) {
114
114
  if (!geocodingApiKey && !isLoaded) {
115
115
  return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
116
116
  }
117
- return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "add_location_alt" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "play_circle_outline" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.tabContent }, { children: [location === types_1.SCEventLocationType.PERSON && ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, { freeSolo: true, size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation, noOptionsText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { label: (0, jsx_runtime_1.jsx)(react_intl_1.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: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), location === types_1.SCEventLocationType.ONLINE && ((0, jsx_runtime_1.jsx)(UrlTextField_1.default, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
117
+ return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ className: classes.tabs, value: location, onChange: handleChange, indicatorColor: "secondary", textColor: "secondary", variant: "fullWidth" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.PERSON, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "add_location_alt" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.label", defaultMessage: "ui.eventForm.address.live.label" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { value: types_1.SCEventLocationType.ONLINE, classes: { root: classes.tab }, icon: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "play_circle_outline" }), iconPosition: "start", label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.label", defaultMessage: "ui.eventForm.address.online.label" }) })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.tabContent }, { children: [location === types_1.SCEventLocationType.PERSON && ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, { size: "small", value: geolocation, onChange: handleSelection, inputValue: inputValue, onInputChange: handleLocationChange, options: suggestions, getOptionLabel: (option) => option.description || geolocation.description, noOptionsText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.live.noResults", defaultMessage: "ui.eventForm.address.live.noResults" }), isOptionEqualToValue: (option, value) => option.description === value.description, renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { label: (0, jsx_runtime_1.jsx)(react_intl_1.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: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "add_location_alt" }) })), params.InputProps.endAdornment] })) }) }))) })), location === types_1.SCEventLocationType.ONLINE && ((0, jsx_runtime_1.jsx)(UrlTextField_1.default, { size: "small", fullWidth: true, type: "url", placeholder: `${intl.formatMessage(messages.virtualPlaceholder)}`, helperText: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.address.online.help", defaultMessage: "ui.eventForm.address.online.help" }), InputProps: {
118
118
  endAdornment: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "play_circle_outline" })
119
119
  }, onChange: handleLinkChange }))] }))] })));
120
120
  }
@@ -125,23 +125,23 @@ function EventForm(inProps) {
125
125
  // INTL
126
126
  const intl = (0, react_intl_1.useIntl)();
127
127
  const initialFieldState = {
128
- imageOriginal: event ? event.image_bigger : '',
129
- imageOriginalFile: '',
128
+ imageOriginal: (event === null || event === void 0 ? void 0 : event.image_bigger) || '',
129
+ imageOriginalFile: new Blob(),
130
130
  startDate: event ? new Date(event.start_date) : null,
131
131
  startTime: event ? new Date(event.start_date) : null,
132
- endDate: event && event.end_date ? new Date(event.end_date) : null,
133
- endTime: event && event.end_date ? new Date(event.end_date) : null,
134
- location: event ? event.location : types_1.SCEventLocationType.PERSON,
135
- geolocation: event ? event.geolocation : '',
136
- lat: event ? event.geolocation_lat : null,
137
- lng: event ? event.geolocation_lng : null,
138
- link: event ? event.link : '',
139
- recurring: event ? event.recurring : types_1.SCEventRecurrenceType.NEVER,
140
- name: event ? event.name : '',
132
+ endDate: (event === null || event === void 0 ? void 0 : event.end_date) ? new Date(event.end_date) : null,
133
+ endTime: (event === null || event === void 0 ? void 0 : event.end_date) ? new Date(event.end_date) : null,
134
+ location: (event === null || event === void 0 ? void 0 : event.location) || types_1.SCEventLocationType.PERSON,
135
+ geolocation: (event === null || event === void 0 ? void 0 : event.geolocation) || '',
136
+ lat: (event === null || event === void 0 ? void 0 : event.geolocation_lat) || null,
137
+ lng: (event === null || event === void 0 ? void 0 : event.geolocation_lng) || null,
138
+ link: (event === null || event === void 0 ? void 0 : event.link) || '',
139
+ recurring: (event === null || event === void 0 ? void 0 : event.recurring) || types_1.SCEventRecurrenceType.NEVER,
140
+ name: (event === null || event === void 0 ? void 0 : event.name) || '',
141
141
  description: event ? event.description : '',
142
- isPublic: (_a = (event && event.privacy === types_1.SCEventPrivacyType.PUBLIC)) !== null && _a !== void 0 ? _a : true,
142
+ isPublic: (_a = (event === null || event === void 0 ? void 0 : event.privacy) === types_1.SCEventPrivacyType.PUBLIC) !== null && _a !== void 0 ? _a : true,
143
143
  isSubmitting: false,
144
- showEndDateTime: (_b = (event && event.end_date)) !== null && _b !== void 0 ? _b : false
144
+ showEndDateTime: (_b = !!(event === null || event === void 0 ? void 0 : event.end_date)) !== null && _b !== void 0 ? _b : false
145
145
  };
146
146
  // STATE
147
147
  const [field, setField] = (0, react_1.useState)(initialFieldState);
@@ -215,14 +215,14 @@ function EventForm(inProps) {
215
215
  }
216
216
  if (field.location === types_1.SCEventLocationType.PERSON) {
217
217
  formData.append('geolocation', field.geolocation);
218
- formData.append('geolocation_lat', field.lat);
219
- formData.append('geolocation_lng', field.lng);
218
+ formData.append('geolocation_lat', field.lat.toString());
219
+ formData.append('geolocation_lng', field.lng.toString());
220
220
  }
221
221
  if (privateEnabled) {
222
222
  formData.append('privacy', field.isPublic ? types_1.SCEventPrivacyType.PUBLIC : types_1.SCEventPrivacyType.PRIVATE);
223
223
  }
224
224
  if (visibilityEnabled) {
225
- formData.append('visible', true);
225
+ formData.append('visible', 'true');
226
226
  }
227
227
  formData.append('description', field.description);
228
228
  let eventService;
@@ -234,9 +234,9 @@ function EventForm(inProps) {
234
234
  }
235
235
  eventService
236
236
  .then((data) => {
237
- onSuccess && onSuccess(data);
237
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data);
238
238
  notifyChanges(data);
239
- onClose && onClose();
239
+ onClose === null || onClose === void 0 ? void 0 : onClose();
240
240
  setField((prev) => (Object.assign(Object.assign({}, prev), { ['isSubmitting']: false })));
241
241
  })
242
242
  .catch((e) => {
@@ -310,15 +310,11 @@ function EventForm(inProps) {
310
310
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
311
311
  // @ts-ignore
312
312
  b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
313
- } })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: field.privacy === true ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private.info.edit", defaultMessage: "ui.eventForm.private.public.info.edit", values: {
314
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
315
- // @ts-ignore
316
- b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
317
- } })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private.info", defaultMessage: "ui.eventForm.private.public.info", values: {
318
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
319
- // @ts-ignore
320
- b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
321
- } })) })) }))] }))), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
313
+ } })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.privacy.private.info", defaultMessage: "ui.eventForm.private.public.info", values: {
314
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
315
+ // @ts-ignore
316
+ b: (chunks) => (0, jsx_runtime_1.jsx)("strong", { children: chunks })
317
+ } })) }))] }))), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, className: classes.description, placeholder: `${intl.formatMessage(messages.description)}`, margin: "normal", value: field.description, name: "description", onChange: handleChange, InputProps: {
322
318
  endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_e = field.description) === null || _e === void 0 ? void 0 : _e.length) ? Event_1.EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : Event_1.EVENT_DESCRIPTION_MAX_LENGTH })))
323
319
  }, error: Boolean(((_f = field.description) === null || _f === void 0 ? void 0 : _f.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_g = field.description) === null || _g === void 0 ? void 0 : _g.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.description.error.maxLength", defaultMessage: "ui.eventForm.description.error.maxLength" })) : null })] }))] }) })));
324
320
  }
@@ -0,0 +1,28 @@
1
+ import { SCEventLocationType, SCEventRecurrenceType } from '@selfcommunity/types';
2
+ export declare type Place = {
3
+ description: string;
4
+ id?: string;
5
+ };
6
+ export declare type Geolocation = {
7
+ location: SCEventLocationType;
8
+ geolocation?: string;
9
+ lat?: number;
10
+ lng?: number;
11
+ link?: string;
12
+ };
13
+ export declare type InitialFieldState = Geolocation & {
14
+ imageOriginal: string | ArrayBuffer;
15
+ imageOriginalFile: Blob;
16
+ startDate: Date | null;
17
+ startTime: Date | null;
18
+ endDate: Date | null;
19
+ endTime: Date | null;
20
+ recurring: SCEventRecurrenceType;
21
+ name: string;
22
+ description: string;
23
+ isPublic: boolean;
24
+ isSubmitting: boolean;
25
+ showEndDateTime: boolean;
26
+ };
27
+ export declare type FieldStateKeys = keyof InitialFieldState;
28
+ export declare type FieldStateValues = InitialFieldState[FieldStateKeys];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -176,6 +176,6 @@ function EventHeader(inProps) {
176
176
  month: 'long'
177
177
  }),
178
178
  hour: intl.formatDate(scEvent.start_date, { hour: 'numeric', minute: 'numeric' })
179
- } })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.online", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { className: classes.planner, userId: scEvent.managed_by.id, secondary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isEventAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EventInviteButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, disabled: isEventFinished }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(EditEventButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data), disabled: isEventFinished }), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent }, EventActionsProps))] })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EventSubscribeButton_1.default, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps, { disabled: isEventFinished })), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent }, EventActionsProps))] })) }) })] }))] })));
179
+ } })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "h5", className: classes.name }, { children: scEvent.name })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.visibility }, { children: [(0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: scEvent.privacy === types_1.SCEventPrivacyType.PUBLIC ? ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "public" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.public", defaultMessage: "ui.eventHeader.visibility.public" })] }))) : ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: [(0, jsx_runtime_1.jsx)(material_1.Icon, { children: "private" }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.visibility.private", defaultMessage: "ui.eventHeader.visibility.private" })] }))) }), (0, jsx_runtime_1.jsx)(Bullet_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ className: classes.visibilityItem }, { children: scEvent.location === types_1.SCEventLocationType.PERSON ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.live", defaultMessage: "ui.eventHeader.location.live" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.location.online", defaultMessage: "ui.eventHeader.location.online" })) }))] })), (0, jsx_runtime_1.jsx)(User_1.default, { className: classes.planner, userId: scEvent.managed_by.id, secondary: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventHeader.user.manager", defaultMessage: "ui.eventHeader.user.manager" }), elevation: 0, actions: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isEventAdmin ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.multiActions }, { children: [(0, jsx_runtime_1.jsx)(EventInviteButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, disabled: isEventFinished }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [!isMobile && ((0, jsx_runtime_1.jsx)(EditEventButton_1.default, { size: isMobile ? 'small' : 'medium', event: scEvent, eventId: scEvent.id, onEditSuccess: (data) => setSCEvent(data), disabled: isEventFinished })), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent, onEditSuccess: (data) => setSCEvent(data) }, EventActionsProps))] })] }))) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(EventSubscribeButton_1.default, Object.assign({ event: scEvent, onSubscribe: handleSubscribe }, EventSubscribeButtonProps, { disabled: isEventFinished })), (0, jsx_runtime_1.jsx)(EventActionsMenu_1.default, Object.assign({ event: scEvent, onEditSuccess: (data) => setSCEvent(data) }, EventActionsProps))] })) }) })] }))] })));
180
180
  }
181
181
  exports.default = EventHeader;
@@ -154,7 +154,12 @@ function Events(inProps) {
154
154
  * Subscriber for pubsub callback
155
155
  */
156
156
  const onDeleteEventHandler = (0, react_1.useCallback)((_msg, deleted) => {
157
- setEvents((prev) => prev.filter((e) => e.id !== deleted));
157
+ setEvents((prev) => {
158
+ if (prev.some((e) => e.id === deleted)) {
159
+ return prev.filter((e) => e.id !== deleted);
160
+ }
161
+ return prev;
162
+ });
158
163
  }, [events]);
159
164
  /**
160
165
  * On mount, subscribe to receive event updates (only delete)
@@ -20,6 +20,8 @@ const Event_1 = tslib_1.__importDefault(require("../Event"));
20
20
  const Widget_1 = tslib_1.__importDefault(require("../Widget"));
21
21
  const constants_1 = require("./constants");
22
22
  const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
23
+ const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
24
+ const PubSub_1 = require("../../constants/PubSub");
23
25
  const classes = {
24
26
  root: `${constants_1.PREFIX}-root`,
25
27
  titleWrapper: `${constants_1.PREFIX}-title-wrapper`,
@@ -66,6 +68,8 @@ function MyEventsWidget(inProps) {
66
68
  const scRoutingContext = (0, react_core_1.useSCRouting)();
67
69
  const { features } = (0, react_core_1.useSCPreferences)();
68
70
  const eventsEnabled = (0, react_1.useMemo)(() => features && features.includes(types_1.SCFeatureName.EVENT) && features.includes(types_1.SCFeatureName.TAGGING), [features]);
71
+ // REFS
72
+ const updatesSubscription = (0, react_1.useRef)(null);
69
73
  /**
70
74
  * Initialize component
71
75
  * Fetch data only if the component is not initialized and it is not loading data
@@ -120,6 +124,30 @@ function MyEventsWidget(inProps) {
120
124
  _fetchNext();
121
125
  }
122
126
  }, [eventIndex, state.results]);
127
+ /**
128
+ * Subscriber for pubsub callback
129
+ */
130
+ const onDeleteEventHandler = (0, react_1.useCallback)((_msg, deleted) => {
131
+ const _events = [...state.results];
132
+ if (_events.some((e) => e.id === deleted)) {
133
+ const updatedEvents = _events.filter((e) => e.id !== deleted);
134
+ dispatch({
135
+ type: widget_1.actionWidgetTypes.SET_RESULTS,
136
+ payload: { results: updatedEvents }
137
+ });
138
+ }
139
+ }, [state.results]);
140
+ /**
141
+ * On mount, subscribe to receive event updates (only delete)
142
+ */
143
+ (0, react_1.useEffect)(() => {
144
+ if (state.results) {
145
+ updatesSubscription.current = pubsub_js_1.default.subscribe(`${PubSub_1.SCTopicType.EVENT}.${PubSub_1.SCGroupEventType.DELETE}`, onDeleteEventHandler);
146
+ }
147
+ return () => {
148
+ updatesSubscription.current && pubsub_js_1.default.unsubscribe(updatesSubscription.current);
149
+ };
150
+ }, [state.results]);
123
151
  // RENDER
124
152
  if (!eventsEnabled || (state.initialized && state.count === 0)) {
125
153
  return (0, jsx_runtime_1.jsx)(HiddenPlaceholder_1.default, {});
@@ -20,6 +20,8 @@ const Widget_1 = tslib_1.__importDefault(require("../Widget"));
20
20
  const Arrow_1 = tslib_1.__importDefault(require("./Arrow"));
21
21
  const constants_1 = require("./constants");
22
22
  const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
23
+ const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
24
+ const PubSub_1 = require("../../constants/PubSub");
23
25
  const classes = {
24
26
  root: `${constants_1.PREFIX}-root`,
25
27
  content: `${constants_1.PREFIX}-content`,
@@ -58,6 +60,8 @@ function SuggestedEventsWidget(inProps) {
58
60
  const scRoutingContext = (0, react_core_1.useSCRouting)();
59
61
  //HOOKS
60
62
  const theme = (0, material_1.useTheme)();
63
+ // REFS
64
+ const updatesSubscription = (0, react_1.useRef)(null);
61
65
  (0, react_1.useEffect)(() => {
62
66
  api_services_1.SuggestionService.getEventSuggestion(Object.assign({}, endpointQueryParams))
63
67
  .then((payload) => {
@@ -106,6 +110,28 @@ function SuggestedEventsWidget(inProps) {
106
110
  }
107
111
  }
108
112
  }, [count, hideMarginLeft, hideMarginRight]);
113
+ /**
114
+ * Subscriber for pubsub callback
115
+ */
116
+ const onDeleteEventHandler = (0, react_1.useCallback)((_msg, deleted) => {
117
+ setEvents((prev) => {
118
+ if (prev.some((e) => e.id === deleted)) {
119
+ return prev.filter((e) => e.id !== deleted);
120
+ }
121
+ return prev;
122
+ });
123
+ }, [events]);
124
+ /**
125
+ * On mount, subscribe to receive event updates (only delete)
126
+ */
127
+ (0, react_1.useEffect)(() => {
128
+ if (events) {
129
+ updatesSubscription.current = pubsub_js_1.default.subscribe(`${PubSub_1.SCTopicType.EVENT}.${PubSub_1.SCGroupEventType.DELETE}`, onDeleteEventHandler);
130
+ }
131
+ return () => {
132
+ updatesSubscription.current && pubsub_js_1.default.unsubscribe(updatesSubscription.current);
133
+ };
134
+ }, [events]);
109
135
  // RENDER
110
136
  if (!events && loading) {
111
137
  return (0, jsx_runtime_1.jsx)(Skeleton_1.default, {});
@@ -18,6 +18,10 @@ export interface EventActionsMenuProps extends IconButtonProps {
18
18
  * Handles callback on delete confirm
19
19
  */
20
20
  onDeleteConfirm?: () => void;
21
+ /**
22
+ * Handles on edit success
23
+ */
24
+ onEditSuccess?: (data: SCEventType) => any;
21
25
  /**
22
26
  * Any other properties
23
27
  */
@@ -17,6 +17,7 @@ const utils_1 = require("@selfcommunity/utils");
17
17
  const notistack_1 = require("notistack");
18
18
  const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
19
19
  const PubSub_1 = require("../../constants/PubSub");
20
+ const EventForm_1 = tslib_1.__importDefault(require("../../components/EventForm"));
20
21
  const PREFIX = 'SCEventActionsMenu';
21
22
  const classes = {
22
23
  root: `${PREFIX}-root`,
@@ -71,16 +72,17 @@ function EventActionsMenu(inProps) {
71
72
  props: inProps,
72
73
  name: PREFIX
73
74
  });
74
- const { className, event, eventId, onDeleteConfirm } = props, rest = tslib_1.__rest(props, ["className", "event", "eventId", "onDeleteConfirm"]);
75
+ const { className, event, eventId, onDeleteConfirm, onEditSuccess } = props, rest = tslib_1.__rest(props, ["className", "event", "eventId", "onDeleteConfirm", "onEditSuccess"]);
75
76
  // STATE
76
77
  const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
77
78
  const [openConfirmDialog, setOpenConfirmDialog] = (0, react_1.useState)(false);
79
+ const [openEdit, setOpenEdit] = (0, react_1.useState)(false);
78
80
  // HOOKS
79
81
  const theme = (0, material_1.useTheme)();
80
82
  const isMobile = (0, material_1.useMediaQuery)(theme.breakpoints.down('md'));
81
83
  const scRoutingContext = (0, react_core_1.useSCRouting)();
82
84
  const scUserContext = (0, react_core_1.useSCUser)();
83
- const { scEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
85
+ const { scEvent, setSCEvent } = (0, react_core_1.useSCFetchEvent)({ id: eventId, event });
84
86
  const isEventAdmin = (0, react_1.useMemo)(() => { var _a; return scUserContext.user && ((_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id) === scUserContext.user.id; }, [scUserContext.user, (_a = scEvent === null || scEvent === void 0 ? void 0 : scEvent.managed_by) === null || _a === void 0 ? void 0 : _a.id]);
85
87
  const isEventFinished = (0, react_1.useMemo)(() => {
86
88
  if (scEvent && !scEvent.running) {
@@ -95,10 +97,17 @@ function EventActionsMenu(inProps) {
95
97
  const handleClose = () => {
96
98
  setAnchorEl(null);
97
99
  };
100
+ const handleEditClick = () => {
101
+ setOpenEdit((o) => !o);
102
+ };
98
103
  const handleCloseDialog = () => {
99
104
  setOpenConfirmDialog(false);
100
105
  setAnchorEl(null);
101
106
  };
107
+ const handleEditSuccess = (data) => {
108
+ setSCEvent(data);
109
+ onEditSuccess && onEditSuccess(data);
110
+ };
102
111
  /**
103
112
  * Handles thread deletion
104
113
  */
@@ -150,6 +159,7 @@ function EventActionsMenu(inProps) {
150
159
  isEventAdmin &&
151
160
  !isEventFinished && [
152
161
  (0, jsx_runtime_1.jsx)(material_1.Divider, {}, "divider"),
162
+ isMobile && ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: handleEditClick }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "edit" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.item.edit", defaultMessage: "ui.shared.eventActionsMenu.item.edit" })] }), "edit")),
153
163
  (0, jsx_runtime_1.jsxs)(material_1.MenuItem, Object.assign({ className: classes.item, onClick: () => handleAction(EventActionsMenu_1.CANCEL_EVENT) }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "close" }) }), (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.item.cancel", defaultMessage: "ui.shared.eventActionsMenu.item.cancel" })] }), "cancel")
154
164
  ]
155
165
  ];
@@ -157,6 +167,6 @@ function EventActionsMenu(inProps) {
157
167
  if (!scEvent) {
158
168
  return null;
159
169
  }
160
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "more_vert" }) })), isMobile ? ((0, jsx_runtime_1.jsx)(SwipeableDrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "bottom", open: Boolean(anchorEl), onClose: handleClose, onOpen: handleOpen, PaperProps: { className: classes.paper }, disableSwipeToOpen: true }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: renderList() }) }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ className: classes.menuRoot, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, PaperProps: { className: classes.paper } }, { children: renderList() }))), openConfirmDialog && ((0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, { open: openConfirmDialog, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.dialog.msg", defaultMessage: "ui.shared.eventActionsMenu.dialog.msg" }), btnConfirm: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.dialog.confirm", defaultMessage: "ui.shared.eventActionsMenu.dialog.confirm" }), onConfirm: handleDeleteThread, onClose: handleCloseDialog }))] }));
170
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { onClick: handleOpen }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { children: "more_vert" }) })), isMobile ? ((0, jsx_runtime_1.jsx)(SwipeableDrawerRoot, Object.assign({ className: classes.drawerRoot, anchor: "bottom", open: Boolean(anchorEl), onClose: handleClose, onOpen: handleOpen, PaperProps: { className: classes.paper }, disableSwipeToOpen: true }, { children: (0, jsx_runtime_1.jsx)(material_1.List, { children: renderList() }) }))) : ((0, jsx_runtime_1.jsx)(MenuRoot, Object.assign({ className: classes.menuRoot, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, PaperProps: { className: classes.paper } }, { children: renderList() }))), openConfirmDialog && ((0, jsx_runtime_1.jsx)(ConfirmDialog_1.default, { open: openConfirmDialog, title: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.dialog.msg", defaultMessage: "ui.shared.eventActionsMenu.dialog.msg" }), btnConfirm: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.shared.eventActionsMenu.dialog.confirm", defaultMessage: "ui.shared.eventActionsMenu.dialog.confirm" }), onConfirm: handleDeleteThread, onClose: handleCloseDialog })), openEdit && (0, jsx_runtime_1.jsx)(EventForm_1.default, { onClose: handleEditClick, event: scEvent, onSuccess: handleEditSuccess })] }));
161
171
  }
162
172
  exports.default = EventActionsMenu;
@@ -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
  }