@imposium-hub/components 2.2.40-6 → 2.2.41-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.
Files changed (80) hide show
  1. package/dist/cjs/Util.d.ts +0 -1
  2. package/dist/cjs/Util.js +9 -48
  3. package/dist/cjs/Util.js.map +1 -1
  4. package/dist/cjs/components/app-wrapper/AppWrapper.d.ts +0 -1
  5. package/dist/cjs/components/app-wrapper/AppWrapper.js +6 -27
  6. package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
  7. package/dist/cjs/components/assets/AssetsTableDateCell.js +0 -3
  8. package/dist/cjs/components/assets/AssetsTableDateCell.js.map +1 -1
  9. package/dist/cjs/components/auth-gate/AuthGate.js +2 -2
  10. package/dist/cjs/components/auth-gate/AuthGate.js.map +1 -1
  11. package/dist/cjs/components/button-menu/ButtonMenu.d.ts +0 -2
  12. package/dist/cjs/components/button-menu/ButtonMenu.js +5 -33
  13. package/dist/cjs/components/button-menu/ButtonMenu.js.map +1 -1
  14. package/dist/cjs/components/dropdown/dropdown.stories.js +1 -1
  15. package/dist/cjs/components/dropdown/dropdown.stories.js.map +1 -1
  16. package/dist/cjs/components/header/Header.js +0 -3
  17. package/dist/cjs/components/header/Header.js.map +1 -1
  18. package/dist/cjs/components/no-access/NoAccess.d.ts +1 -1
  19. package/dist/cjs/components/no-access/NoAccess.js +2 -11
  20. package/dist/cjs/components/no-access/NoAccess.js.map +1 -1
  21. package/dist/cjs/components/story-previewer/StoryPreviewer.js +6 -15
  22. package/dist/cjs/components/story-previewer/StoryPreviewer.js.map +1 -1
  23. package/dist/cjs/index.d.ts +2 -2
  24. package/dist/cjs/index.js +1 -3
  25. package/dist/cjs/index.js.map +1 -1
  26. package/dist/cjs/services/API.d.ts +2 -2
  27. package/dist/cjs/services/API.js +2 -3
  28. package/dist/cjs/services/API.js.map +1 -1
  29. package/dist/cjs/services/Auth0.d.ts +1 -1
  30. package/dist/cjs/services/Auth0.js +3 -2
  31. package/dist/cjs/services/Auth0.js.map +1 -1
  32. package/dist/cjs/services/Session.js +0 -3
  33. package/dist/cjs/services/Session.js.map +1 -1
  34. package/dist/esm/Util.d.ts +0 -1
  35. package/dist/esm/Util.js +8 -51
  36. package/dist/esm/Util.js.map +1 -1
  37. package/dist/esm/components/app-wrapper/AppWrapper.d.ts +0 -1
  38. package/dist/esm/components/app-wrapper/AppWrapper.js +7 -28
  39. package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
  40. package/dist/esm/components/assets/AssetsTableDateCell.js +0 -3
  41. package/dist/esm/components/assets/AssetsTableDateCell.js.map +1 -1
  42. package/dist/esm/components/auth-gate/AuthGate.js +2 -2
  43. package/dist/esm/components/auth-gate/AuthGate.js.map +1 -1
  44. package/dist/esm/components/button-menu/ButtonMenu.d.ts +0 -2
  45. package/dist/esm/components/button-menu/ButtonMenu.js +5 -28
  46. package/dist/esm/components/button-menu/ButtonMenu.js.map +1 -1
  47. package/dist/esm/components/dropdown/dropdown.stories.js +1 -1
  48. package/dist/esm/components/dropdown/dropdown.stories.js.map +1 -1
  49. package/dist/esm/components/header/Header.js +0 -3
  50. package/dist/esm/components/header/Header.js.map +1 -1
  51. package/dist/esm/components/no-access/NoAccess.d.ts +1 -1
  52. package/dist/esm/components/no-access/NoAccess.js +2 -11
  53. package/dist/esm/components/no-access/NoAccess.js.map +1 -1
  54. package/dist/esm/components/story-previewer/StoryPreviewer.js +5 -10
  55. package/dist/esm/components/story-previewer/StoryPreviewer.js.map +1 -1
  56. package/dist/esm/index.d.ts +2 -2
  57. package/dist/esm/index.js +2 -2
  58. package/dist/esm/index.js.map +1 -1
  59. package/dist/esm/services/API.d.ts +2 -2
  60. package/dist/esm/services/API.js +2 -2
  61. package/dist/esm/services/API.js.map +1 -1
  62. package/dist/esm/services/Auth0.d.ts +1 -1
  63. package/dist/esm/services/Auth0.js +2 -2
  64. package/dist/esm/services/Auth0.js.map +1 -1
  65. package/dist/esm/services/Session.js +0 -3
  66. package/dist/esm/services/Session.js.map +1 -1
  67. package/package.json +6 -4
  68. package/src/Util.ts +10 -47
  69. package/src/components/app-wrapper/AppWrapper.tsx +7 -45
  70. package/src/components/assets/AssetsTableDateCell.tsx +0 -2
  71. package/src/components/auth-gate/AuthGate.tsx +2 -3
  72. package/src/components/button-menu/ButtonMenu.tsx +5 -40
  73. package/src/components/header/Header.tsx +0 -4
  74. package/src/components/no-access/NoAccess.tsx +3 -14
  75. package/src/components/story-previewer/StoryPreviewer.tsx +22 -12
  76. package/src/index.ts +1 -5
  77. package/src/services/API.ts +3 -7
  78. package/src/services/Auth0.ts +2 -2
  79. package/src/services/Session.ts +0 -3
  80. /package/src/components/dropdown/{dropdown.stories.tsx → Dropdown.stories.tsx} +0 -0
@@ -7,11 +7,10 @@ import { connect } from 'react-redux';
7
7
  import { bindActionCreators } from 'redux';
8
8
  import { login, clearCachedAuth } from '../../redux/actions/auth';
9
9
  import { cacheAccessData, clearCachedAccessList } from '../../redux/actions/access';
10
- import { validateAccessLevel } from '../../Util';
10
+ import { checkStoryId, getLastModifiedStoryInOrg, validateAccessLevel } from '../../Util';
11
11
 
12
12
  export interface IAppWrapperProps {
13
13
  children: React.ReactChildren;
14
- auth0Domain: string;
15
14
  auth0ClientId: string;
16
15
  organizationId: string;
17
16
  baseUrl: string;
@@ -50,13 +49,6 @@ class AppWrapper extends React.Component<IAppWrapperProps, IAppWrapperState> {
50
49
  />
51
50
  );
52
51
 
53
- private static readonly NO_ORGS: JSX.Element = (
54
- <NoAccess
55
- key='restriction-msg'
56
- type='no-orgs'
57
- />
58
- );
59
-
60
52
  constructor(p: IAppWrapperProps) {
61
53
  super(p);
62
54
 
@@ -67,24 +59,10 @@ class AppWrapper extends React.Component<IAppWrapperProps, IAppWrapperState> {
67
59
  }
68
60
 
69
61
  public componentDidMount = (): void => {
70
- const { auth, access, auth0ClientId, auth0Domain, isFreshUser } = this.props;
62
+ const { auth, access, auth0ClientId, isFreshUser } = this.props;
71
63
  const session: IHubSession = SessionService.getSession();
72
64
 
73
- AuthService.bindToClient(auth0ClientId, auth0Domain);
74
-
75
- const validAccessLevel = validateAccessLevel(
76
- this.props.organizationId,
77
- this.props.serviceId,
78
- this.props.access
79
- );
80
-
81
- if (!this.state.restrictAccess && !validAccessLevel) {
82
- this.setState({ restrictAccess: true });
83
- }
84
-
85
- if (this.state.restrictAccess && validAccessLevel) {
86
- this.setState({ restrictAccess: false });
87
- }
65
+ AuthService.bindToClient(auth0ClientId);
88
66
 
89
67
  // If cookie, auth or access data is missing / mismatched,
90
68
  // silently check auth0 session and refresh flow on success
@@ -150,16 +128,9 @@ class AppWrapper extends React.Component<IAppWrapperProps, IAppWrapperState> {
150
128
  private propagateCreds = (): void => {
151
129
  const { auth, access, storyId, onAuthenticated } = this.props;
152
130
  const activeOrgId: string = this.determineActiveOrganization(auth, access);
153
- let activeStoryId: string = SessionService.getSession().story_id;
154
- let activeOrg: any;
155
-
156
- if (this.props.storyId) {
157
- activeOrg = access.organizations.find((o: any) => o.id === activeOrgId);
158
-
159
- if (activeOrg && activeOrg.stories.find((s: any) => s.id === storyId)) {
160
- activeStoryId = storyId;
161
- }
162
- }
131
+ const activeStoryId: string = checkStoryId(storyId, activeOrgId, access)
132
+ ? storyId
133
+ : getLastModifiedStoryInOrg(activeOrgId, access);
163
134
 
164
135
  onAuthenticated(activeOrgId, activeStoryId);
165
136
 
@@ -294,18 +265,9 @@ class AppWrapper extends React.Component<IAppWrapperProps, IAppWrapperState> {
294
265
  let innerContent: any;
295
266
 
296
267
  if (!blockRender && restrictAccess) {
297
- const showNoOrgs =
298
- this.props.access &&
299
- this.props.access.organizations &&
300
- this.props.access.organizations.length === 0;
301
- const errorIndicator = showNoOrgs
302
- ? AppWrapper.NO_ORGS
303
- : showRequestAccess
304
- ? AppWrapper.RESTRICTED_REQUEST
305
- : AppWrapper.RESTRICTED_BLOCK;
306
268
  innerContent = [
307
269
  typeof children[0] === 'object' && children[0].type === Header && children[0],
308
- errorIndicator
270
+ showRequestAccess ? AppWrapper.RESTRICTED_REQUEST : AppWrapper.RESTRICTED_BLOCK
309
271
  ];
310
272
  }
311
273
 
@@ -18,8 +18,6 @@ const AssetsTableDateCell: React.FC<IAssetsTableDateCell> = (p: IAssetsTableDate
18
18
  return <div>{formatDateDefault(values.date_created)}</div>;
19
19
  } else if (values.date_modified) {
20
20
  return <div>{formatDateDefault(values.date_modified)}</div>;
21
- } else if (values.date_updated) {
22
- return <div>{formatDateDefault(values.date_updated)}</div>;
23
21
  } else {
24
22
  return null;
25
23
  }
@@ -9,7 +9,6 @@ import { cacheAccessData } from '../../redux/actions/access';
9
9
 
10
10
  interface IAuthGateProps {
11
11
  auth0ClientId: string;
12
- auth0Domain: string;
13
12
  auth0Hash: string;
14
13
  onAuthenticated: () => any;
15
14
  baseUrl?: string;
@@ -25,9 +24,9 @@ class AuthGate extends React.PureComponent<IAuthGateProps> {
25
24
  }
26
25
 
27
26
  public componentDidMount = (): void => {
28
- const { auth0ClientId, auth0Hash, auth0Domain, onAuthenticated, baseUrl } = this.props;
27
+ const { auth0ClientId, auth0Hash, onAuthenticated, baseUrl } = this.props;
29
28
 
30
- AuthService.bindToClient(auth0ClientId, auth0Domain);
29
+ AuthService.bindToClient(auth0ClientId);
31
30
 
32
31
  if (!auth0Hash) {
33
32
  AuthService.login();
@@ -1,18 +1,15 @@
1
1
  import * as React from 'react';
2
- import ReactDOM from 'react-dom';
3
2
 
4
3
  interface IButtonMenuProps {
5
4
  button: any;
6
5
  items: any;
7
6
  position: string;
8
7
  isOpen?: boolean;
9
- isPortal?: boolean;
10
8
  onClick?: (e) => string | void;
11
9
  }
12
10
 
13
11
  interface IButtonMenuState {
14
12
  open: boolean;
15
- rect: any;
16
13
  }
17
14
 
18
15
  class ButtonMenu extends React.PureComponent<IButtonMenuProps, IButtonMenuState> {
@@ -25,8 +22,7 @@ class ButtonMenu extends React.PureComponent<IButtonMenuProps, IButtonMenuState>
25
22
  constructor(props) {
26
23
  super(props);
27
24
  this.state = {
28
- open: false,
29
- rect: null
25
+ open: false
30
26
  };
31
27
 
32
28
  this.evtHandlers = {
@@ -69,15 +65,13 @@ class ButtonMenu extends React.PureComponent<IButtonMenuProps, IButtonMenuState>
69
65
 
70
66
  public toggleMenu(e) {
71
67
  const { onClick } = this.props;
72
- const rect = this.toggleRef.current.getBoundingClientRect();
73
68
  const newState = !this.state.open;
74
69
  if (onClick) {
75
70
  onClick(newState);
76
71
  }
77
72
  this.setState(
78
73
  {
79
- open: newState,
80
- rect
74
+ open: newState
81
75
  },
82
76
  () => {
83
77
  if (this.state.open) {
@@ -116,40 +110,11 @@ class ButtonMenu extends React.PureComponent<IButtonMenuProps, IButtonMenuState>
116
110
  }
117
111
 
118
112
  public renderMenu() {
119
- const { position, isPortal } = this.props;
120
- const { open, rect } = this.state;
121
-
122
- const top = rect?.top + rect?.height;
123
- const left = rect?.left + rect?.width - 20;
113
+ const { position } = this.props;
114
+ const { open } = this.state;
124
115
 
125
116
  if (open) {
126
- const menuStyle: React.CSSProperties = {
127
- background: '#161616',
128
- position: 'absolute',
129
- top: `${top}px`,
130
- minWidth: '125px',
131
- padding: '3px',
132
- zIndex: 1000,
133
- left: `${left}px`,
134
- fontSize: '12px'
135
- };
136
-
137
- const menu = (
138
- <div
139
- className={`menu ${position}`}
140
- style={isPortal ? menuStyle : null}>
141
- {this.renderItems()}
142
- </div>
143
- );
144
-
145
- const PortalContextComponent = () =>
146
- ReactDOM.createPortal(menu, document.querySelector('.imposium-header'));
147
-
148
- if (isPortal) {
149
- return <PortalContextComponent />;
150
- } else {
151
- return menu;
152
- }
117
+ return <div className={`menu ${position}`}>{this.renderItems()}</div>;
153
118
  }
154
119
  }
155
120
 
@@ -457,10 +457,6 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
457
457
  );
458
458
  }
459
459
 
460
- if (accessData && accessData.organizations && accessData.organizations.length === 0) {
461
- storyToggle = null;
462
- }
463
-
464
460
  if (accessData && activeOrganizationBlob && !hideStoryPicker) {
465
461
  currentStory = activeOrganizationBlob.stories.find((s: any) => s.id === activeStory);
466
462
  storyToggle = (
@@ -4,22 +4,20 @@ import { faUserLock } from '@fortawesome/free-solid-svg-icons/faUserLock';
4
4
  import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons/faExclamationTriangle';
5
5
 
6
6
  interface INoAccessProps {
7
- type: 'request' | 'restrict' | 'no-orgs';
7
+ type: 'request' | 'restrict';
8
8
  }
9
9
 
10
10
  const MAIL_TO: string = 'mailto:info@imposium.com?subject=My access to Imposium is restricted';
11
11
  const REQUEST_ACCESS_TITLE: string = "You don't have access to Imposium yet";
12
12
  const REQUEST_HREF_COPY: string = 'Request Access';
13
13
  const RESTRICTED_ACCESS_TITLE: string = 'Service not found';
14
- const NO_ORGS_TITLE = 'No organizations found';
15
14
 
16
15
  const NoAccess: React.FC<INoAccessProps> = (p: INoAccessProps) => {
17
16
  if (!p.type) {
18
- throw new Error('NoAccess requires a type of either: request or restrict or no-orgs');
17
+ throw new Error('NoAccess requires a type of either: request or restrict');
19
18
  }
20
19
 
21
20
  const isRequest: boolean = p.type === 'request';
22
- const isNoOrgs: boolean = p.type === 'no-orgs';
23
21
 
24
22
  return (
25
23
  <div className='no-access'>
@@ -37,17 +35,8 @@ const NoAccess: React.FC<INoAccessProps> = (p: INoAccessProps) => {
37
35
 
38
36
  <div className='no-access-copy'>
39
37
  <h1 className='no-access-heading'>
40
- {isRequest
41
- ? REQUEST_ACCESS_TITLE
42
- : isNoOrgs
43
- ? NO_ORGS_TITLE
44
- : RESTRICTED_ACCESS_TITLE}
38
+ {isRequest ? REQUEST_ACCESS_TITLE : RESTRICTED_ACCESS_TITLE}
45
39
  </h1>
46
- <p>
47
- {isNoOrgs
48
- ? 'Please request access from an admin already on the organization'
49
- : null}
50
- </p>
51
40
  {isRequest && <a href={MAIL_TO}>{REQUEST_HREF_COPY}</a>}
52
41
  </div>
53
42
  </div>
@@ -585,10 +585,16 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
585
585
  }
586
586
 
587
587
  private createExperience() {
588
- const { storyId, onNotification, onError, api, onExperienceCreated, useWorkingCopy } =
589
- this.props;
588
+ const {
589
+ storyId,
590
+ onNotification,
591
+ onError,
592
+ api,
593
+ onExperienceCreated,
594
+ useWorkingCopy,
595
+ editor: { fastRender }
596
+ } = this.props;
590
597
 
591
- const fastRender = this.props.editor?.fastRender || false;
592
598
  const compId = this.getCompId();
593
599
 
594
600
  this.resetState(false, () => {
@@ -654,9 +660,11 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
654
660
  private renderViewerContent() {
655
661
  const { rendering, experience, timeElapsed, activeOutput, isTimeOut } = this.state;
656
662
 
657
- const { api, onError } = this.props;
658
-
659
- const playbackRate = this.props.editor?.playbackRate || 1;
663
+ const {
664
+ api,
665
+ onError,
666
+ editor: { playbackRate }
667
+ } = this.props;
660
668
 
661
669
  if (rendering) {
662
670
  return (
@@ -832,21 +840,23 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
832
840
  }
833
841
 
834
842
  private changePlaybackRate() {
835
- const playbackRate = this.props.editor?.playbackRate || 1;
843
+ const {
844
+ editor: { playbackRate }
845
+ } = this.props;
836
846
  let newRate = playbackRate + 0.5;
837
847
 
838
848
  if (newRate > this.maxPlaybackRate) {
839
849
  newRate = 1;
840
850
  }
841
851
 
842
- if (this.props.updateEditorConfig) {
843
- this.props.updateEditorConfig({ playbackRate: newRate });
844
- }
852
+ this.props.updateEditorConfig({ playbackRate: newRate });
845
853
  }
846
854
 
847
855
  public render() {
848
- const { allowCompOverride } = this.props;
849
- const playbackRate = this.props.editor?.playbackRate || 1;
856
+ const {
857
+ allowCompOverride,
858
+ editor: { playbackRate }
859
+ } = this.props;
850
860
  const { rendering, experience, activeOutput, experienceId, error } = this.state;
851
861
  const { storyId } = this.props;
852
862
  const renderCopy = experience ? copy.btnReRender : copy.btnRender;
package/src/index.ts CHANGED
@@ -146,9 +146,7 @@ import {
146
146
  formatDateDefault,
147
147
  validateAccessLevel,
148
148
  formattedTime,
149
- getSMPTE,
150
- checkStoryId,
151
- IMAGE_EXTENSIONS
149
+ getSMPTE
152
150
  } from './Util';
153
151
  import PublishStatusIndicator from './components/publish-wizard/publish/PublishStatusIndicator';
154
152
  import { getMediaPreviewStyle } from './utils/assets';
@@ -286,7 +284,6 @@ export {
286
284
  filterHotkeys,
287
285
  mimetypeConformsToOverlay,
288
286
  validateAssetMimetype,
289
- IMAGE_EXTENSIONS,
290
287
  toFixed,
291
288
  getSMPTE,
292
289
  padStart,
@@ -307,7 +304,6 @@ export {
307
304
  FontPicker,
308
305
  cancelAssetUpload,
309
306
  getLastModifiedStoryInOrg,
310
- checkStoryId,
311
307
  renderTooltipProps,
312
308
  renderTooltip,
313
309
  ContextMenu,
@@ -130,7 +130,7 @@ export interface IImposiumAPI {
130
130
  compositionData: any,
131
131
  name?: string
132
132
  ): Promise<any | Error>;
133
- createHTMLAsset(storyId: string, htmlData: any, name?: string): Promise<any | Error>;
133
+ createHTMLAsset(storyId: string, htmlData: any): Promise<any | Error>;
134
134
  getAccountInfo(orgId: string): Promise<any | Error>;
135
135
  saveQueueAssoc(queueId: string, storyId: string, distributed: boolean);
136
136
  createDataset(storyId: string, data: File, name: string);
@@ -540,11 +540,7 @@ export default class API {
540
540
  });
541
541
  };
542
542
 
543
- public createHTMLAsset = (
544
- storyId: string,
545
- htmlData: any,
546
- name: string = 'New HTML Asset'
547
- ): Promise<any | Error> => {
543
+ public createHTMLAsset = (storyId: string, htmlData: any): Promise<any | Error> => {
548
544
  const formData = new FormData();
549
545
 
550
546
  formData.append('story_id', storyId);
@@ -553,7 +549,7 @@ export default class API {
553
549
 
554
550
  formData.append('type', 'html');
555
551
 
556
- formData.append('name', name);
552
+ formData.append('name', 'New HTML Asset');
557
553
 
558
554
  return this.doRequest({
559
555
  method: 'POST',
@@ -11,6 +11,7 @@ export interface IIdentity {
11
11
 
12
12
  export default class AuthService {
13
13
  private static readonly IMPOSIUM_APP_DEFAULTS: any = {
14
+ domain: 'imposium.auth0.com',
14
15
  scope: 'openid',
15
16
  responseType: 'token id_token',
16
17
  redirectUri: `${window.location.origin}/auth`
@@ -22,10 +23,9 @@ export default class AuthService {
22
23
  /*
23
24
  Initialize the auth0 web client with client ID for a given app-wrapper
24
25
  */
25
- public static bindToClient = (clientID: string, domain: string): void => {
26
+ public static bindToClient = (clientID: string): void => {
26
27
  AuthService.auth0Client = new auth0.WebAuth({
27
28
  clientID,
28
- domain,
29
29
  ...AuthService.IMPOSIUM_APP_DEFAULTS
30
30
  });
31
31
  };
@@ -98,7 +98,6 @@ export default class SessionService {
98
98
  if (
99
99
  cachedStoryId &&
100
100
  organizationId &&
101
- activeOrg.stories &&
102
101
  activeOrg.stories.find((s: any) => s.id === cachedStoryId)
103
102
  ) {
104
103
  activeStoryId = cachedStoryId;
@@ -117,8 +116,6 @@ export default class SessionService {
117
116
  // Same for story id if the cache was missing / belonging to a different org
118
117
  if (
119
118
  !activeStoryId &&
120
- organizations &&
121
- organizations[0] &&
122
119
  organizations[0].stories.length > 0 &&
123
120
  typeof organizations[0].stories[0] === 'object' &&
124
121
  organizations[0].stories[0].hasOwnProperty('id')