@imposium-hub/components 1.34.3 → 1.36.0

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/Entry.ts CHANGED
@@ -54,6 +54,8 @@ import DroppableAssetRenderer from './components/assets/DroppableAssetRenderer';
54
54
  import ImagePlayer from './components/players/ImagePlayer';
55
55
  import VideoPlayer from './components/players/VideoPlayer';
56
56
  import AudioPlayer from './components/players/AudioPlayer';
57
+ import VideoPreview from './components/players/VideoPreview';
58
+ import ImagePreview from './components/players/ImagePreview';
57
59
  import ImageSequencePlayer from './components/players/ImageSequencePlayer';
58
60
  import LogViewer from './components/log-viewer/LogViewer';
59
61
  import StoryPreviewer from './components/story-previewer/StoryPreviewer';
@@ -74,19 +76,19 @@ import auth from './redux/reducers/auth';
74
76
  import {login, clearCachedAuth} from './redux/actions/auth';
75
77
  import access from './redux/reducers/access';
76
78
  import {
77
- cacheAccessData, clearCachedAccessList, storyAdded,
79
+ cacheAccessData, clearCachedAccessList, storyAdded,
78
80
  storyNameMutated, orgNameMutated, storyDeleted
79
81
  } from './redux/actions/access';
80
82
  import { updateFilters } from './redux/actions/asset-filters';
81
- import {
83
+ import {
82
84
  getAssets, deleteAssets, addAssetTag,
83
85
  deleteAssetTag, updateAssetName, updateAssetData, doAssetTableHydration
84
86
  } from './redux/actions/asset-list';
85
- import {
87
+ import {
86
88
  getAssetTagList, addAssetTagToList
87
89
  } from './redux/actions/asset-tags';
88
90
  import { toggleAutoTag, uploadAssets } from './redux/actions/asset-uploads';
89
- import {
91
+ import {
90
92
  selectAsset, deselectAsset, resetSelection
91
93
  } from './redux/actions/selected-assets';
92
94
  import assetFilters from './redux/reducers/asset-filters';
@@ -152,6 +154,8 @@ export {
152
154
  ImagePlayer,
153
155
  VideoPlayer,
154
156
  AudioPlayer,
157
+ VideoPreview,
158
+ ImagePreview,
155
159
  ImageSequencePlayer,
156
160
 
157
161
  AssetsTypeIcon,
@@ -231,7 +235,7 @@ export {
231
235
  filterHotkeys,
232
236
  mimetypeConformsToOverlay,
233
237
  validateAssetMimetype,
234
- toFixed,
238
+ toFixed,
235
239
  padStart,
236
240
  formatDateDefault,
237
241
 
@@ -13,6 +13,7 @@ export interface IAppWrapperProps {
13
13
  children : React.ReactChildren;
14
14
  auth0ClientId : string;
15
15
  organizationId : string;
16
+ baseUrl : string;
16
17
  storyId? : string;
17
18
  serviceId : number;
18
19
  access : any;
@@ -145,7 +146,7 @@ class AppWrapper extends React.Component<IAppWrapperProps, IAppWrapperState> {
145
146
  Check auth0 session, pull Imposium access creds on success and initialize app-wrapper
146
147
  */
147
148
  private doCheckSession = (blockRender : boolean = false) : void => {
148
- const {onAuthenticationFailure} = this.props;
149
+ const {onAuthenticationFailure, baseUrl} = this.props;
149
150
 
150
151
  if (blockRender) {
151
152
  this.setState({blockRender: true});
@@ -153,7 +154,7 @@ class AppWrapper extends React.Component<IAppWrapperProps, IAppWrapperState> {
153
154
 
154
155
  AuthService.checkSession()
155
156
  .then((freshIdentity : IIdentity) => {
156
- SessionService.getAccessData(freshIdentity.idToken)
157
+ SessionService.getAccessData(freshIdentity.idToken, baseUrl)
157
158
  .then((freshAccess : any) => {
158
159
  this.props.login(freshIdentity);
159
160
  this.props.cacheAccessData(freshAccess);
@@ -11,6 +11,7 @@ interface IAuthGateProps {
11
11
  auth0ClientId : string;
12
12
  auth0Hash : string;
13
13
  onAuthenticated : () => any;
14
+ baseUrl? : string;
14
15
  login : (id : IIdentity) => any;
15
16
  cacheAccessData : (accessData : any) => any;
16
17
  }
@@ -23,7 +24,7 @@ class AuthGate extends React.PureComponent<IAuthGateProps, {}> {
23
24
  }
24
25
 
25
26
  public componentDidMount = () : void => {
26
- const {auth0ClientId, auth0Hash, onAuthenticated} = this.props;
27
+ const {auth0ClientId, auth0Hash, onAuthenticated, baseUrl} = this.props;
27
28
 
28
29
  AuthService.bindToClient(auth0ClientId);
29
30
 
@@ -32,7 +33,7 @@ class AuthGate extends React.PureComponent<IAuthGateProps, {}> {
32
33
  } else {
33
34
  AuthService.parseIdFromHash(auth0Hash)
34
35
  .then((freshIdentity : IIdentity) => {
35
- SessionService.getAccessData(freshIdentity.idToken)
36
+ SessionService.getAccessData(freshIdentity.idToken, baseUrl)
36
37
  .then((freshAccess : any) => {
37
38
  this.props.login(freshIdentity);
38
39
  this.props.cacheAccessData(freshAccess);
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ import Portal from '../portal/Portal';
3
+
4
+ interface IVideoPreviewProps {
5
+ showMedia : boolean;
6
+ url : string;
7
+ playbackSettings? : any;
8
+ style? : React.CSSProperties | any;
9
+ }
10
+
11
+ class ImagePreview extends React.PureComponent<IVideoPreviewProps> {
12
+ private imageNode : any = null;
13
+ constructor(props) {
14
+ super(props);
15
+ this.imageNode = React.createRef();
16
+ }
17
+ public render() {
18
+ const {showMedia, url, style} = this.props;
19
+ if (showMedia) {
20
+ return (
21
+ <Portal id='portal-root'>
22
+ <img
23
+ src={url}
24
+ ref={this.imageNode}
25
+ className='media-preview'
26
+ style={style}/>
27
+ </Portal>
28
+ );
29
+ } else {
30
+ return null;
31
+ }
32
+ }
33
+ }
34
+
35
+ export default ImagePreview;
@@ -0,0 +1,40 @@
1
+ import * as React from 'react';
2
+ import Portal from '../portal/Portal';
3
+
4
+ interface IVideoPreviewProps {
5
+ showMedia : boolean;
6
+ url : string;
7
+ playbackSettings? : any;
8
+ style? : React.CSSProperties | {};
9
+ }
10
+
11
+ class VideoPreview extends React.PureComponent<IVideoPreviewProps> {
12
+ private videoNode : any = null;
13
+ constructor(props) {
14
+ super(props);
15
+ this.videoNode = React.createRef();
16
+ }
17
+ public render() {
18
+ const {showMedia, url, playbackSettings, style} = this.props;
19
+ if (showMedia) {
20
+ return (
21
+ <Portal id='portal-root'>
22
+ <video
23
+ style = {style}
24
+ muted
25
+ ref = {this.videoNode}
26
+ autoPlay = {playbackSettings.autoPlay}
27
+ loop = {playbackSettings.loop}
28
+ controls
29
+ preload = 'preload'
30
+ src={url}
31
+ className='media-preview' />
32
+ </Portal>
33
+ );
34
+ } else {
35
+ return null;
36
+ }
37
+ }
38
+ }
39
+
40
+ export default VideoPreview;