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

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
  }
@@ -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
  */
@@ -113,7 +113,7 @@ const Root = (0, styles_1.styled)(BaseDialog_1.default, {
113
113
  * @param inProps
114
114
  */
115
115
  function EventForm(inProps) {
116
- var _a, _b, _c, _d, _e, _f, _g;
116
+ var _a, _b, _c, _d, _e;
117
117
  //PROPS
118
118
  const props = (0, system_1.useThemeProps)({
119
119
  props: inProps,
@@ -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 : '',
128
+ imageOriginal: (event === null || event === void 0 ? void 0 : event.image_bigger) || '',
129
129
  imageOriginalFile: '',
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) => {
@@ -281,7 +281,7 @@ function EventForm(inProps) {
281
281
  field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH ||
282
282
  field.description.length > Event_1.EVENT_DESCRIPTION_MAX_LENGTH, variant: "contained", onClick: handleSubmit, color: "secondary" }, { children: event ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.edit", defaultMessage: "ui.eventForm.button.edit" })) : ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.button.create", defaultMessage: "ui.eventForm.button.create" })) })) }, rest, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Paper, Object.assign({ style: _backgroundCover, classes: { root: classes.cover } }, { children: (0, jsx_runtime_1.jsx)(UploadEventCover_1.default, { isCreationMode: true, onChange: handleChangeCover }) })), (0, jsx_runtime_1.jsxs)(material_1.FormGroup, Object.assign({ className: classes.form }, { children: [(0, jsx_runtime_1.jsx)(material_1.TextField, { required: true, className: classes.name, placeholder: `${intl.formatMessage(messages.name)}`, margin: "normal", value: field.name, name: "name", onChange: handleChange, InputProps: {
283
283
  endAdornment: (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: Event_1.EVENT_TITLE_MAX_LENGTH - field.name.length }))
284
- }, error: Boolean(((_c = field === null || field === void 0 ? void 0 : field.name) === null || _c === void 0 ? void 0 : _c.length) > Event_1.EVENT_TITLE_MAX_LENGTH) || Boolean(error[`nameError`]), helperText: ((_d = field === null || field === void 0 ? void 0 : field.name) === null || _d === void 0 ? void 0 : _d.length) > Event_1.EVENT_TITLE_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error[`nameError`] ? (error[`nameError`]) : null }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.dateTime }, { children: (0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default }, { children: [(0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileDatePicker, { className: classes.picker, disablePast: true, label: field.startDate && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, slots: {
284
+ }, error: Boolean(field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH) || Boolean(error['nameError']), helperText: field.name.length > Event_1.EVENT_TITLE_MAX_LENGTH ? ((0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.name.error.maxLength", defaultMessage: "ui.eventForm.name.error.maxLength" })) : error['nameError'] ? (error['nameError']) : null }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ className: classes.dateTime }, { children: (0, jsx_runtime_1.jsxs)(x_date_pickers_1.LocalizationProvider, Object.assign({ dateAdapter: AdapterDateFns_1.AdapterDateFns, adapterLocale: scContext.settings.locale.default === 'it' ? it_1.default : en_US_1.default }, { children: [(0, jsx_runtime_1.jsx)(x_date_pickers_1.MobileDatePicker, { className: classes.picker, disablePast: true, label: field.startDate && (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.eventForm.date.placeholder", defaultMessage: "ui.eventForm.date.placeholder" }), value: field.startDate, slots: {
285
285
  textField: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, Object.assign({}, params, { InputProps: Object.assign(Object.assign({}, params.InputProps), { placeholder: `${intl.formatMessage(messages.startDate)}`, startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "start" }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "CalendarIcon" }) }) }))) }) })))
286
286
  }, slotProps: {
287
287
  toolbar: {
@@ -310,16 +310,12 @@ 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: {
322
- 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
- }, 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 })] }))] }) })));
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: {
318
+ endAdornment: ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2" }, { children: ((_c = field.description) === null || _c === void 0 ? void 0 : _c.length) ? Event_1.EVENT_DESCRIPTION_MAX_LENGTH - field.description.length : Event_1.EVENT_DESCRIPTION_MAX_LENGTH })))
319
+ }, error: Boolean(((_d = field.description) === null || _d === void 0 ? void 0 : _d.length) > Event_1.EVENT_DESCRIPTION_MAX_LENGTH), helperText: ((_e = field.description) === null || _e === void 0 ? void 0 : _e.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
  }
325
321
  exports.default = EventForm;
@@ -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: string | 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;
@@ -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
  }
@@ -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
  */