@openeventkit/event-site 2.0.60 → 2.0.61

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openeventkit/event-site",
3
3
  "description": "Event Site",
4
- "version": "2.0.60",
4
+ "version": "2.0.61",
5
5
  "author": "Tipit LLC",
6
6
  "dependencies": {
7
7
  "@mui/base": "^5.0.0-alpha.114",
@@ -34,20 +34,10 @@ export const setEventLastUpdate = (lastUpdate) => (dispatch) => {
34
34
  */
35
35
  export const getEventById = (
36
36
  eventId
37
- ) => async (dispatch, getState) => {
37
+ ) => async (dispatch) => {
38
38
 
39
39
  dispatch(startLoading());
40
40
 
41
- // if we have it on the reducer , provide that first
42
- let {allSchedulesState: {allEvents}} = getState();
43
- const event = allEvents.find(ev => ev.id === parseInt(eventId));
44
-
45
- if (event) {
46
- dispatch(createAction(GET_EVENT_DATA)({event}));
47
- }
48
-
49
- // then refresh from api
50
-
51
41
  let accessToken;
52
42
  try {
53
43
  accessToken = await getAccessToken();
@@ -88,9 +78,7 @@ export const getEventById = (
88
78
  */
89
79
  export const getEventTokensById = (
90
80
  eventId
91
- ) => async (dispatch, getState) => {
92
-
93
- // then refresh from api
81
+ ) => async (dispatch) => {
94
82
 
95
83
  let accessToken;
96
84
  try {
@@ -1,13 +1,25 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
-
4
3
  import VideoJSPlayer from './VideoJSPlayer';
5
4
  import VimeoPlayer from "./VimeoPlayer";
6
5
  import VideoMUXPlayer from './VideoMUXPlayer';
7
6
  import styles from '../styles/video.module.scss';
8
7
  import { isMuxVideo, isVimeoVideo, isYouTubeVideo } from '../utils/videoUtils';
9
8
 
10
- const VideoComponent = ({ url, title, namespace, isLive, firstHalf, autoPlay, start, tokens }) => {
9
+ /**
10
+ * @param url
11
+ * @param title
12
+ * @param namespace
13
+ * @param isLive
14
+ * @param firstHalf
15
+ * @param autoPlay
16
+ * @param start
17
+ * @param tokens
18
+ * @param onError
19
+ * @returns {JSX.Element}
20
+ * @constructor
21
+ */
22
+ const VideoComponent = ({ url, title, namespace, isLive, firstHalf, autoPlay, start, tokens, onError = () => {} }) => {
11
23
 
12
24
  if (url) {
13
25
  // using mux player
@@ -17,8 +29,12 @@ const VideoComponent = ({ url, title, namespace, isLive, firstHalf, autoPlay, st
17
29
  startTime: start,
18
30
  };
19
31
  return (
20
- <VideoMUXPlayer isLive={isLive ? "live" : "on-demand"} autoPlay={autoPlay}
21
- title={title} namespace={namespace} videoSrc={url} tokens={tokens} {...muxOptions} />
32
+ <VideoMUXPlayer isLive={isLive ? "live" : "on-demand"}
33
+ autoPlay={autoPlay}
34
+ title={title}
35
+ namespace={namespace}
36
+ onError={onError}
37
+ videoSrc={url} tokens={tokens} {...muxOptions} />
22
38
  );
23
39
  }
24
40
  // vimeo player
@@ -84,7 +100,8 @@ VideoComponent.propTypes = {
84
100
  firstHalf: PropTypes.bool,
85
101
  autoPlay: PropTypes.bool,
86
102
  start: PropTypes.number,
87
- tokens: PropTypes.object
103
+ tokens: PropTypes.object,
104
+ onError: PropTypes.func,
88
105
  };
89
106
 
90
107
  VideoComponent.defaultProps = {
@@ -2,12 +2,11 @@ import React, { useState, useRef } from 'react'
2
2
  import PropTypes from 'prop-types';
3
3
  import { getEnvVariable, MUX_ENV_KEY } from '../utils/envVariables'
4
4
  import { getMUXPlaybackId } from '../utils/videoUtils';
5
- import Swal from 'sweetalert2';
6
5
  // lazy load bc otherwise SSR breaks
7
6
  // @see https://www.gatsbyjs.com/docs/using-client-side-only-packages/
8
7
  const MuxPlayer = React.lazy(() => import('@mux/mux-player-react'));
9
8
 
10
- const VideoMUXPlayer = ({ title, namespace, videoSrc, streamType, tokens, autoPlay, ...muxOptions }) => {
9
+ const VideoMUXPlayer = ({ title, namespace, videoSrc, streamType, tokens, autoPlay, onError = () => {}, ...muxOptions }) => {
11
10
 
12
11
  const playerRef = useRef(null);
13
12
  const [isPlaying, setIsPlaying] = useState(autoPlay);
@@ -35,7 +34,7 @@ const VideoMUXPlayer = ({ title, namespace, videoSrc, streamType, tokens, autoPl
35
34
  envKey={getEnvVariable(MUX_ENV_KEY)}
36
35
  playbackId={getMUXPlaybackId(videoSrc)}
37
36
  onError={(err) => {
38
- Swal.fire('Error', 'This video stream will begin momentarily. Please standby.', "warning");
37
+ if(onError) onError(err);
39
38
  console.log(err);
40
39
  }}
41
40
  onEnded={handleVideoEnded}
@@ -61,7 +60,8 @@ VideoMUXPlayer.propTypes = {
61
60
  namespace: PropTypes.string,
62
61
  streamType: PropTypes.oneOfType(["live", "on-demand"]),
63
62
  autoPlay: PropTypes.bool,
64
- tokens: PropTypes.object
63
+ tokens: PropTypes.object,
64
+ onError:PropTypes.func,
65
65
  };
66
66
 
67
67
  export default VideoMUXPlayer;
@@ -1 +1 @@
1
- {"widgets":{"chat":{"enabled":true,"showQA":false,"showHelp":false,"defaultScope":"page"},"schedule":{"allowClick":true}},"favicons":{"favicon180":"/img/favicon.png","favicon32":"/img/favicon.png","favicon16":"/img/favicon.png"},"staticJsonFilesBuildTime":[{"file":"src/data/summit.json","build_time":1694051984256},{"file":"src/data/events.json","build_time":1694051986915},{"file":"src/data/events.idx.json","build_time":1694051986920},{"file":"src/data/speakers.json","build_time":1694051987917},{"file":"src/data/speakers.idx.json","build_time":1694051987917},{"file":"src/content/sponsors.json","build_time":1694051991031},{"file":"src/data/voteable-presentations.json","build_time":1694051992928}],"lastBuild":1694051992929}
1
+ {"widgets":{"chat":{"enabled": true, "showQA":false,"showHelp":false,"defaultScope":"page"},"schedule":{"allowClick":true}},"favicons":{"favicon180":"/img/favicon.png","favicon32":"/img/favicon.png","favicon16":"/img/favicon.png"},"staticJsonFilesBuildTime":[{"file":"src/data/summit.json","build_time":1692386447666},{"file":"src/data/events.json","build_time":1692386451064},{"file":"src/data/events.idx.json","build_time":1692386451066},{"file":"src/data/speakers.json","build_time":1692386451884},{"file":"src/data/speakers.idx.json","build_time":1692386451884},{"file":"src/content/sponsors.json","build_time":1692386455106},{"file":"src/data/voteable-presentations.json","build_time":1692386457214}],"lastBuild":1692386457215}
@@ -1 +1 @@
1
- [{"id":228,"created":1691602669,"last_edited":1691602669,"order":1,"summit_id":49,"is_published":true,"side_image":null,"header_image":null,"header_image_mobile":null,"carousel_advertise_image":null,"marquee":"","intro":"","external_link":"","video_link":"","chat_link":"","featured_event_id":0,"header_image_alt_text":"","side_image_alt_text":"","header_image_mobile_alt_text":"","carousel_advertise_image_alt_text":"","show_logo_in_event_page":true,"members":[90654,90670],"company":{"id":3,"created":1580138376,"last_edited":1580138376,"name":"Tipit , LLC","url":null,"display_on_site":false,"featured":false,"city":null,"state":null,"country":null,"description":null,"industry":null,"contributions":null,"contact_email":null,"member_level":"None","admin_email":null,"overview":null,"products":null,"commitment":null,"commitment_author":null,"logo":null,"big_logo":null,"color":"#f0f0ee","sponsorships":[616],"project_sponsorships":[]},"sponsorship":{"id":2048,"widget_title":"","lobby_template":null,"expo_hall_template":null,"sponsor_page_template":null,"event_page_template":null,"sponsor_page_use_disqus_widget":false,"sponsor_page_use_live_event_widget":false,"sponsor_page_use_schedule_widget":false,"sponsor_page_use_banner_widget":false,"badge_image":null,"badge_image_alt_text":"","summit_id":49,"order":1,"should_display_on_expo_hall_page":false,"should_display_on_lobby_page":false,"type":{"id":3,"created":1579890943,"last_edited":1579890943,"name":"Gold","label":"not sure??","order":3,"size":"Medium"}},"ads":[],"materials":[],"social_networks":[{"id":2,"created":1694011600,"last_edited":1694011600,"sponsor_id":228,"link":"https://twhitter.com","icon_css_class":"new-icon","is_enabled":true}]}]
1
+ [{"id":228,"created":1691602669,"last_edited":1691602669,"order":1,"summit_id":49,"is_published":false,"side_image":null,"header_image":null,"header_image_mobile":null,"carousel_advertise_image":null,"marquee":"","intro":"","external_link":"","video_link":"","chat_link":"","featured_event_id":0,"header_image_alt_text":"","side_image_alt_text":"","header_image_mobile_alt_text":"","carousel_advertise_image_alt_text":"","show_logo_in_event_page":true,"members":[90654],"company":{"id":3,"created":1580138376,"last_edited":1580138376,"name":"Tipit , LLC","url":null,"display_on_site":false,"featured":false,"city":null,"state":null,"country":null,"description":null,"industry":null,"contributions":null,"contact_email":null,"member_level":"None","admin_email":null,"overview":null,"products":null,"commitment":null,"commitment_author":null,"logo":null,"big_logo":null,"color":"#f0f0ee","sponsorships":[616],"project_sponsorships":[]},"sponsorship":{"id":2048,"widget_title":"","lobby_template":null,"expo_hall_template":null,"sponsor_page_template":null,"event_page_template":null,"sponsor_page_use_disqus_widget":false,"sponsor_page_use_live_event_widget":false,"sponsor_page_use_schedule_widget":false,"sponsor_page_use_banner_widget":false,"badge_image":null,"badge_image_alt_text":"","summit_id":49,"order":1,"should_display_on_expo_hall_page":false,"should_display_on_lobby_page":false,"type":{"id":3,"created":1579890943,"last_edited":1579890943,"name":"Gold","label":"not sure??","order":3,"size":"Medium"}},"ads":[],"materials":[],"social_networks":[]}]
@@ -30,10 +30,10 @@ const eventReducer = (state = DEFAULT_STATE, action) => {
30
30
  const event = payload?.response ?? payload.event;
31
31
  // check if we need to update the current event or do we need to just use the new one
32
32
  const updatedEvent = event.id === state?.event?.id ? {...state, ...event} : event;
33
- return { ...state, loading: false, event: updatedEvent };
33
+ return { ...state, loading: false, event: updatedEvent, tokens: null };
34
34
  }
35
35
  case GET_EVENT_DATA_ERROR: {
36
- return { ...state, loading: false, event: null }
36
+ return { ...state, loading: false, event: null, tokens: null }
37
37
  }
38
38
  // reload event state
39
39
  case RELOAD_EVENT_STATE:{
@@ -23,6 +23,7 @@ import { getEventById, getEventTokensById } from "../actions/event-actions";
23
23
  import URI from "urijs";
24
24
  import useMarketingSettings, { MARKETING_SETTINGS_KEYS } from "@utils/useMarketingSettings";
25
25
  import { checkMuxTokens, isMuxVideo } from "../utils/videoUtils";
26
+
26
27
  /**
27
28
  * @type {EventPageTemplate}
28
29
  */
@@ -31,6 +32,7 @@ export const EventPageTemplate = class extends React.Component {
31
32
  constructor(props) {
32
33
  super(props);
33
34
  this.canRenderVideo = this.canRenderVideo.bind(this);
35
+ this.onError = this.onError.bind(this);
34
36
  }
35
37
 
36
38
  shouldComponentUpdate(nextProps, nextState) {
@@ -72,12 +74,19 @@ export const EventPageTemplate = class extends React.Component {
72
74
  if (parseInt(event?.id) !== parseInt(eventId)) {
73
75
  this.props.getEventById(eventId).then((res) => {
74
76
  const { response } = res;
75
- if(response && response?.stream_is_secure && isMuxVideo(response?.streaming_url)) // todo check stream url is mux
77
+ if(response && response?.stream_is_secure && isMuxVideo(response?.streaming_url))
76
78
  this.props.getEventTokensById(eventId)
77
79
  });
78
80
  }
79
81
  }
80
82
 
83
+ onError(err){
84
+ const { event, getEventTokensById } = this.props;
85
+ if(event?.stream_is_secure && isMuxVideo(event?.streaming_url) ){
86
+ getEventTokensById(event.id)
87
+ }
88
+ }
89
+
81
90
  render() {
82
91
 
83
92
  const {event, eventTokens, user, loading, nowUtc, summit, eventsPhases, eventId, lastDataSync, activityCtaText} = this.props;
@@ -119,6 +128,7 @@ export const EventPageTemplate = class extends React.Component {
119
128
  firstHalf={firstHalf}
120
129
  autoPlay={autoPlay}
121
130
  start={startTime}
131
+ onError={this.onError}
122
132
  />
123
133
  {event.meeting_url && <VideoBanner event={event} ctaText={activityCtaText} />}
124
134
  </div>