@imposium-hub/components 2.2.44 → 2.2.45-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/dist/cjs/Util.js +2 -0
- package/dist/cjs/Util.js.map +1 -1
- package/dist/cjs/components/app-wrapper/AppWrapper.d.ts +1 -2
- package/dist/cjs/components/app-wrapper/AppWrapper.js +70 -82
- package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.d.ts +27 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.js +243 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BACKUP_73190.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.d.ts +28 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.js +255 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_BASE_73190.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.d.ts +27 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.js +243 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_LOCAL_73190.js.map +1 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.d.ts +28 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.js +251 -0
- package/dist/cjs/components/app-wrapper/AppWrapper_REMOTE_73190.js.map +1 -0
- package/dist/cjs/components/assets/AssetsTableDurationCell.js +18 -2
- package/dist/cjs/components/assets/AssetsTableDurationCell.js.map +1 -1
- package/dist/cjs/components/assets/AssetsTableGlobalCell.d.ts +6 -0
- package/dist/cjs/components/assets/AssetsTableGlobalCell.js +33 -0
- package/dist/cjs/components/assets/AssetsTableGlobalCell.js.map +1 -0
- package/dist/cjs/components/assets/AssetsTableNameCell.js +2 -2
- package/dist/cjs/components/assets/AssetsTableNameCell.js.map +1 -1
- package/dist/cjs/components/assets/AssetsUploadMenu.js +3 -2
- package/dist/cjs/components/assets/AssetsUploadMenu.js.map +1 -1
- package/dist/cjs/components/auth-gate/AuthGate.js +8 -5
- package/dist/cjs/components/auth-gate/AuthGate.js.map +1 -1
- package/dist/cjs/components/header/Header.d.ts +5 -0
- package/dist/cjs/components/header/Header.js +40 -22
- package/dist/cjs/components/header/Header.js.map +1 -1
- package/dist/cjs/components/header/Header_BACKUP_73021.d.ts +33 -0
- package/dist/cjs/components/header/Header_BACKUP_73021.js +393 -0
- package/dist/cjs/components/header/Header_BACKUP_73021.js.map +1 -0
- package/dist/cjs/components/header/Header_BASE_73021.d.ts +29 -0
- package/dist/cjs/components/header/Header_BASE_73021.js +376 -0
- package/dist/cjs/components/header/Header_BASE_73021.js.map +1 -0
- package/dist/cjs/components/header/Header_LOCAL_73021.d.ts +33 -0
- package/dist/cjs/components/header/Header_LOCAL_73021.js +382 -0
- package/dist/cjs/components/header/Header_LOCAL_73021.js.map +1 -0
- package/dist/cjs/components/header/Header_REMOTE_73021.d.ts +30 -0
- package/dist/cjs/components/header/Header_REMOTE_73021.js +386 -0
- package/dist/cjs/components/header/Header_REMOTE_73021.js.map +1 -0
- package/dist/cjs/components/publish-wizard/PublishWizard.js +119 -59
- package/dist/cjs/components/publish-wizard/PublishWizard.js.map +1 -1
- package/dist/cjs/components/story-previewer/StoryPreviewer.js +15 -10
- package/dist/cjs/components/story-previewer/StoryPreviewer.js.map +1 -1
- package/dist/cjs/constants/copy.d.ts +6 -0
- package/dist/cjs/constants/copy.js +7 -1
- package/dist/cjs/constants/copy.js.map +1 -1
- package/dist/cjs/constants/icons.d.ts +1 -0
- package/dist/cjs/constants/icons.js +3 -1
- package/dist/cjs/constants/icons.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +2 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/redux/actions/access.d.ts +1 -3
- package/dist/cjs/redux/actions/access.js +10 -43
- package/dist/cjs/redux/actions/access.js.map +1 -1
- package/dist/cjs/redux/actions/publish.js +4 -3
- package/dist/cjs/redux/actions/publish.js.map +1 -1
- package/dist/cjs/redux/reducers/access.js +7 -30
- package/dist/cjs/redux/reducers/access.js.map +1 -1
- package/dist/cjs/services/Session.d.ts +9 -8
- package/dist/cjs/services/Session.js +31 -127
- package/dist/cjs/services/Session.js.map +1 -1
- package/dist/esm/Util.js +2 -0
- package/dist/esm/Util.js.map +1 -1
- package/dist/esm/components/app-wrapper/AppWrapper.d.ts +1 -2
- package/dist/esm/components/app-wrapper/AppWrapper.js +68 -82
- package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.d.ts +27 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.js +194 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BACKUP_73190.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.d.ts +28 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.js +208 -0
- package/dist/esm/components/app-wrapper/AppWrapper_BASE_73190.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.d.ts +27 -0
- package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.js +194 -0
- package/dist/esm/components/app-wrapper/AppWrapper_LOCAL_73190.js.map +1 -0
- package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.d.ts +28 -0
- package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.js +204 -0
- package/dist/esm/components/app-wrapper/AppWrapper_REMOTE_73190.js.map +1 -0
- package/dist/esm/components/assets/AssetsTableDurationCell.js +18 -2
- package/dist/esm/components/assets/AssetsTableDurationCell.js.map +1 -1
- package/dist/esm/components/assets/AssetsTableGlobalCell.d.ts +6 -0
- package/dist/esm/components/assets/AssetsTableGlobalCell.js +8 -0
- package/dist/esm/components/assets/AssetsTableGlobalCell.js.map +1 -0
- package/dist/esm/components/assets/AssetsTableNameCell.js +2 -2
- package/dist/esm/components/assets/AssetsTableNameCell.js.map +1 -1
- package/dist/esm/components/assets/AssetsUploadMenu.js +3 -2
- package/dist/esm/components/assets/AssetsUploadMenu.js.map +1 -1
- package/dist/esm/components/auth-gate/AuthGate.js +9 -6
- package/dist/esm/components/auth-gate/AuthGate.js.map +1 -1
- package/dist/esm/components/header/Header.d.ts +5 -0
- package/dist/esm/components/header/Header.js +37 -22
- package/dist/esm/components/header/Header.js.map +1 -1
- package/dist/esm/components/header/Header_BACKUP_73021.d.ts +33 -0
- package/dist/esm/components/header/Header_BACKUP_73021.js +336 -0
- package/dist/esm/components/header/Header_BACKUP_73021.js.map +1 -0
- package/dist/esm/components/header/Header_BASE_73021.d.ts +29 -0
- package/dist/esm/components/header/Header_BASE_73021.js +322 -0
- package/dist/esm/components/header/Header_BASE_73021.js.map +1 -0
- package/dist/esm/components/header/Header_LOCAL_73021.d.ts +33 -0
- package/dist/esm/components/header/Header_LOCAL_73021.js +328 -0
- package/dist/esm/components/header/Header_LOCAL_73021.js.map +1 -0
- package/dist/esm/components/header/Header_REMOTE_73021.d.ts +30 -0
- package/dist/esm/components/header/Header_REMOTE_73021.js +329 -0
- package/dist/esm/components/header/Header_REMOTE_73021.js.map +1 -0
- package/dist/esm/components/publish-wizard/PublishWizard.js +119 -60
- package/dist/esm/components/publish-wizard/PublishWizard.js.map +1 -1
- package/dist/esm/components/story-previewer/StoryPreviewer.js +15 -10
- package/dist/esm/components/story-previewer/StoryPreviewer.js.map +1 -1
- package/dist/esm/constants/copy.d.ts +6 -0
- package/dist/esm/constants/copy.js +7 -1
- package/dist/esm/constants/copy.js.map +1 -1
- package/dist/esm/constants/icons.d.ts +1 -0
- package/dist/esm/constants/icons.js +2 -0
- package/dist/esm/constants/icons.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/redux/actions/access.d.ts +1 -3
- package/dist/esm/redux/actions/access.js +8 -37
- package/dist/esm/redux/actions/access.js.map +1 -1
- package/dist/esm/redux/actions/publish.js +4 -3
- package/dist/esm/redux/actions/publish.js.map +1 -1
- package/dist/esm/redux/reducers/access.js +5 -8
- package/dist/esm/redux/reducers/access.js.map +1 -1
- package/dist/esm/services/Session.d.ts +9 -8
- package/dist/esm/services/Session.js +29 -102
- package/dist/esm/services/Session.js.map +1 -1
- package/dist/styles.css +24 -0
- package/dist/styles.less +27 -0
- package/less/components/context-menu.less +1 -0
- package/less/components/header.less +13 -0
- package/less/components/publish-wizard.less +13 -0
- package/package.json +1 -1
- package/src/Util.ts +3 -0
- package/src/components/app-wrapper/AppWrapper.tsx +77 -123
- package/src/components/assets/AssetsTableDurationCell.tsx +23 -2
- package/src/components/assets/AssetsTableNameCell.tsx +4 -1
- package/src/components/assets/AssetsUploadMenu.tsx +13 -8
- package/src/components/auth-gate/AuthGate.tsx +14 -8
- package/src/components/header/Header.tsx +88 -42
- package/src/components/publish-wizard/PublishWizard.tsx +172 -87
- package/src/components/story-previewer/StoryPreviewer.tsx +17 -10
- package/src/constants/copy.ts +8 -1
- package/src/constants/icons.tsx +3 -0
- package/src/index.ts +1 -10
- package/src/redux/actions/access.ts +5 -67
- package/src/redux/actions/publish.ts +6 -3
- package/src/redux/reducers/access.ts +5 -8
- package/src/services/Session.ts +34 -120
|
@@ -57,6 +57,7 @@ interface IStoryPreviewerState {
|
|
|
57
57
|
isTimeOut: boolean;
|
|
58
58
|
error: boolean;
|
|
59
59
|
jobLogLoading: boolean;
|
|
60
|
+
errorMsg: string;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPreviewerState> {
|
|
@@ -86,7 +87,8 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
86
87
|
isTimeOut: false,
|
|
87
88
|
compositionOverride: null,
|
|
88
89
|
error: false,
|
|
89
|
-
jobLogLoading: false
|
|
90
|
+
jobLogLoading: false,
|
|
91
|
+
errorMsg: ''
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
this.timer = new Timer({
|
|
@@ -191,7 +193,8 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
191
193
|
public componentDidUpdate(prevProps, prevState) {
|
|
192
194
|
if (!prevProps.editor?.autoRender && this.props.editor?.autoRender) {
|
|
193
195
|
this.props.updateEditorConfig({ autoRender: false });
|
|
194
|
-
this.
|
|
196
|
+
this.evtHandlers.gotExperience = null;
|
|
197
|
+
this.props.api.cancelExperiencePolling().then(() => this.createExperience());
|
|
195
198
|
}
|
|
196
199
|
|
|
197
200
|
if (
|
|
@@ -225,7 +228,7 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
225
228
|
const { experienceId } = this.state;
|
|
226
229
|
|
|
227
230
|
api.cancelExperiencePolling().then(() => {
|
|
228
|
-
onError(copy.
|
|
231
|
+
onError(copy.runExpIdError.replace('[expId]', experienceId));
|
|
229
232
|
|
|
230
233
|
this.resetState(
|
|
231
234
|
true,
|
|
@@ -507,8 +510,8 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
507
510
|
() => {
|
|
508
511
|
onError(
|
|
509
512
|
copy.runExpError.replace(
|
|
510
|
-
'[
|
|
511
|
-
|
|
513
|
+
'[error]',
|
|
514
|
+
e.error
|
|
512
515
|
)
|
|
513
516
|
);
|
|
514
517
|
|
|
@@ -516,7 +519,8 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
516
519
|
true,
|
|
517
520
|
() => {
|
|
518
521
|
this.setState({
|
|
519
|
-
isTimeOut: true
|
|
522
|
+
isTimeOut: true,
|
|
523
|
+
errorMsg: e.error
|
|
520
524
|
});
|
|
521
525
|
},
|
|
522
526
|
experienceId
|
|
@@ -525,7 +529,7 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
525
529
|
);
|
|
526
530
|
} else {
|
|
527
531
|
onError(
|
|
528
|
-
copy.
|
|
532
|
+
copy.runExpIdError.replace(
|
|
529
533
|
'[expId]',
|
|
530
534
|
experienceId
|
|
531
535
|
)
|
|
@@ -569,10 +573,10 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
569
573
|
this.resetState();
|
|
570
574
|
if (onError) {
|
|
571
575
|
if (e.error) {
|
|
572
|
-
onError(e.error);
|
|
576
|
+
onError(copy.runExpError.replace('[error]', e.error));
|
|
573
577
|
} else {
|
|
574
578
|
onError(
|
|
575
|
-
copy.
|
|
579
|
+
copy.runExpIdError.replace('[expId]', experienceId)
|
|
576
580
|
);
|
|
577
581
|
}
|
|
578
582
|
}
|
|
@@ -652,7 +656,8 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
652
656
|
}
|
|
653
657
|
|
|
654
658
|
private renderViewerContent() {
|
|
655
|
-
const { rendering, experience, timeElapsed, activeOutput, isTimeOut } =
|
|
659
|
+
const { rendering, experience, timeElapsed, activeOutput, isTimeOut, errorMsg } =
|
|
660
|
+
this.state;
|
|
656
661
|
|
|
657
662
|
const { api, onError } = this.props;
|
|
658
663
|
|
|
@@ -676,6 +681,8 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
676
681
|
<p>
|
|
677
682
|
{copy.time} {formattedTime(timeElapsed)}
|
|
678
683
|
</p>
|
|
684
|
+
<br />
|
|
685
|
+
<p>{`${copy.runExpError.replace('[error]', errorMsg)}`}</p>
|
|
679
686
|
</div>
|
|
680
687
|
);
|
|
681
688
|
} else if (experience && activeOutput) {
|
package/src/constants/copy.ts
CHANGED
|
@@ -58,7 +58,8 @@ export const previewer = {
|
|
|
58
58
|
time: 'Time Elapsed:',
|
|
59
59
|
expRunning: 'Rendering Experience',
|
|
60
60
|
runExpStart: 'Creating Experience',
|
|
61
|
-
|
|
61
|
+
runExpIdError: 'Error running experience - ID: [expId]',
|
|
62
|
+
runExpError: 'Error running experience: [error]',
|
|
62
63
|
triggerExpError: 'Error triggering experience - ID: [expId]',
|
|
63
64
|
expId: 'Running Experience - ID: [expId]',
|
|
64
65
|
createExpError: 'Error creating experience',
|
|
@@ -114,6 +115,9 @@ export const compositions = {
|
|
|
114
115
|
};
|
|
115
116
|
|
|
116
117
|
export const publish = {
|
|
118
|
+
publishInProgress: 'Publish to Creative Manager in progress',
|
|
119
|
+
btnRunTestBatch: 'Run Test Batch',
|
|
120
|
+
btnCrM: 'Creative Manager',
|
|
117
121
|
creativeLibraryId: 'Creative Library ID',
|
|
118
122
|
creativeId: 'Creative ID',
|
|
119
123
|
email: 'Notification Email',
|
|
@@ -134,8 +138,11 @@ export const publish = {
|
|
|
134
138
|
|
|
135
139
|
// distribute
|
|
136
140
|
distributeStepTitle: 'STEP 2: How do you want your users to view their video?',
|
|
141
|
+
distributeStepTitleFromCrM: 'STEP 2: Run a test batch or return to Creative Manager?',
|
|
137
142
|
distributeStepDesc:
|
|
138
143
|
'Select which Composition you want to deliver, access credentials you want to use, and distribution channel.',
|
|
144
|
+
distributeStepDescFromCrM:
|
|
145
|
+
'You can run a test batch to preview a sample data set, or return to Creative Manager where you can publish the final version set.',
|
|
139
146
|
compositionError: 'Please Select Composition',
|
|
140
147
|
|
|
141
148
|
// webpage
|
package/src/constants/icons.tsx
CHANGED
|
@@ -37,6 +37,7 @@ import { faFont } from '@fortawesome/free-solid-svg-icons/faFont';
|
|
|
37
37
|
import { faAlignLeft } from '@fortawesome/free-solid-svg-icons/faAlignLeft';
|
|
38
38
|
import { faAlignRight } from '@fortawesome/free-solid-svg-icons/faAlignRight';
|
|
39
39
|
import { faAlignCenter } from '@fortawesome/free-solid-svg-icons/faAlignCenter';
|
|
40
|
+
import { faUpRightFromSquare } from '@fortawesome/free-solid-svg-icons/faUpRightFromSquare';
|
|
40
41
|
import { faBars } from '@fortawesome/free-solid-svg-icons/faBars';
|
|
41
42
|
import { faArrowToTop } from '@fortawesome/pro-light-svg-icons/faArrowToTop';
|
|
42
43
|
import { faArrowToBottom } from '@fortawesome/pro-light-svg-icons/faArrowToBottom';
|
|
@@ -212,3 +213,5 @@ export const ICON_CENTER_ANCHOR = <FontAwesomeIcon icon={faCircleSmall} />;
|
|
|
212
213
|
export const ICON_CLAPPERBOARD_PLAY = <FontAwesomeIcon icon={faClapperboardPlay} />;
|
|
213
214
|
|
|
214
215
|
export const ICON_CODE = <FontAwesomeIcon icon={faCode} />;
|
|
216
|
+
|
|
217
|
+
export const ICON_UP_RIGHT_FROM_SQUARE = <FontAwesomeIcon icon={faUpRightFromSquare} />;
|
package/src/index.ts
CHANGED
|
@@ -80,14 +80,7 @@ import {
|
|
|
80
80
|
clearStoryPublishStatus,
|
|
81
81
|
getStoryPublishStatus
|
|
82
82
|
} from './redux/actions/publish';
|
|
83
|
-
import {
|
|
84
|
-
cacheAccessData,
|
|
85
|
-
clearCachedAccessList,
|
|
86
|
-
storyAdded,
|
|
87
|
-
storyNameMutated,
|
|
88
|
-
orgNameMutated,
|
|
89
|
-
storyDeleted
|
|
90
|
-
} from './redux/actions/access';
|
|
83
|
+
import { storyAdded, storyNameMutated, orgNameMutated, storyDeleted } from './redux/actions/access';
|
|
91
84
|
import { resetFilters, updateFilters } from './redux/actions/asset-filters';
|
|
92
85
|
import {
|
|
93
86
|
getAssets,
|
|
@@ -235,8 +228,6 @@ export {
|
|
|
235
228
|
login,
|
|
236
229
|
clearCachedAuth,
|
|
237
230
|
access,
|
|
238
|
-
cacheAccessData,
|
|
239
|
-
clearCachedAccessList,
|
|
240
231
|
storyAdded,
|
|
241
232
|
storyNameMutated,
|
|
242
233
|
orgNameMutated,
|
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
import SessionService from '../../services/Session';
|
|
2
|
-
|
|
3
|
-
export const ACCESS_CACHE_KEY: string = 'imposium_access_list';
|
|
4
|
-
|
|
5
|
-
export const cacheAccessData = (accessData: any): any => {
|
|
6
|
-
doCacheAccessData(accessData);
|
|
7
|
-
return { type: actions.SET, accessData };
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const clearCachedAccessList = (): any => {
|
|
11
|
-
try {
|
|
12
|
-
localStorage.removeItem(ACCESS_CACHE_KEY);
|
|
13
|
-
} catch (e) {
|
|
14
|
-
console.warn('Failed to clear access list cache from local storage.');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return { type: actions.CLEAR };
|
|
18
|
-
};
|
|
19
|
-
|
|
20
1
|
export const storyAdded = (storyId: string, storyName: string): any => {
|
|
21
2
|
return (dispatch, getStore) => {
|
|
22
3
|
const {
|
|
23
4
|
access,
|
|
24
|
-
auth: {
|
|
25
|
-
idTokenPayload: { exp }
|
|
26
|
-
},
|
|
27
5
|
routing: {
|
|
28
6
|
locationBeforeTransitions: { query }
|
|
29
7
|
}
|
|
@@ -49,24 +27,13 @@ export const storyAdded = (storyId: string, storyName: string): any => {
|
|
|
49
27
|
return o;
|
|
50
28
|
})
|
|
51
29
|
};
|
|
52
|
-
|
|
53
|
-
SessionService.updateSession(
|
|
54
|
-
{ stories_hash: SessionService.generateStoriesHash(accessData) },
|
|
55
|
-
exp
|
|
56
|
-
);
|
|
57
|
-
doCacheAccessData(accessData);
|
|
58
30
|
dispatch({ type: actions.STORY_ADDED, accessData });
|
|
59
31
|
};
|
|
60
32
|
};
|
|
61
33
|
|
|
62
34
|
export const orgNameMutated = (orgId: string, newOrgName: string): any => {
|
|
63
35
|
return (dispatch, getStore) => {
|
|
64
|
-
const {
|
|
65
|
-
access,
|
|
66
|
-
auth: {
|
|
67
|
-
idTokenPayload: { exp }
|
|
68
|
-
}
|
|
69
|
-
} = getStore();
|
|
36
|
+
const { access } = getStore();
|
|
70
37
|
|
|
71
38
|
const accessData: any = {
|
|
72
39
|
...access,
|
|
@@ -81,12 +48,6 @@ export const orgNameMutated = (orgId: string, newOrgName: string): any => {
|
|
|
81
48
|
return o;
|
|
82
49
|
})
|
|
83
50
|
};
|
|
84
|
-
|
|
85
|
-
SessionService.updateSession(
|
|
86
|
-
{ stories_hash: SessionService.generateOrgsHash(accessData) },
|
|
87
|
-
exp
|
|
88
|
-
);
|
|
89
|
-
doCacheAccessData(accessData);
|
|
90
51
|
dispatch({ type: actions.ORG_NAME_MUTATION, accessData });
|
|
91
52
|
};
|
|
92
53
|
};
|
|
@@ -95,9 +56,6 @@ export const storyNameMutated = (storyId: string, newStoryName: string): any =>
|
|
|
95
56
|
return (dispatch, getStore) => {
|
|
96
57
|
const {
|
|
97
58
|
access,
|
|
98
|
-
auth: {
|
|
99
|
-
idTokenPayload: { exp }
|
|
100
|
-
},
|
|
101
59
|
routing: {
|
|
102
60
|
locationBeforeTransitions: { query }
|
|
103
61
|
}
|
|
@@ -123,12 +81,6 @@ export const storyNameMutated = (storyId: string, newStoryName: string): any =>
|
|
|
123
81
|
return o;
|
|
124
82
|
})
|
|
125
83
|
};
|
|
126
|
-
|
|
127
|
-
SessionService.updateSession(
|
|
128
|
-
{ stories_hash: SessionService.generateOrgsHash(accessData) },
|
|
129
|
-
exp
|
|
130
|
-
);
|
|
131
|
-
doCacheAccessData(accessData);
|
|
132
84
|
dispatch({ type: actions.STORY_NAME_MUTATION, accessData });
|
|
133
85
|
};
|
|
134
86
|
};
|
|
@@ -137,9 +89,6 @@ export const storyDeleted = (storyId: string): any => {
|
|
|
137
89
|
return (dispatch, getStore) => {
|
|
138
90
|
const {
|
|
139
91
|
access,
|
|
140
|
-
auth: {
|
|
141
|
-
idTokenPayload: { exp }
|
|
142
|
-
},
|
|
143
92
|
routing: {
|
|
144
93
|
locationBeforeTransitions: { query }
|
|
145
94
|
}
|
|
@@ -159,25 +108,14 @@ export const storyDeleted = (storyId: string): any => {
|
|
|
159
108
|
return o;
|
|
160
109
|
})
|
|
161
110
|
};
|
|
162
|
-
|
|
163
|
-
SessionService.updateSession(
|
|
164
|
-
{
|
|
165
|
-
story_id: '',
|
|
166
|
-
stories_hash: SessionService.generateStoriesHash(accessData)
|
|
167
|
-
},
|
|
168
|
-
exp
|
|
169
|
-
);
|
|
170
|
-
doCacheAccessData(accessData);
|
|
171
111
|
dispatch({ type: actions.STORY_DELETED, accessData });
|
|
172
112
|
};
|
|
173
113
|
};
|
|
174
114
|
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
console.warn('Failed to cache access list in local storage.');
|
|
180
|
-
}
|
|
115
|
+
export const setAccessData = (accessData: any): any => {
|
|
116
|
+
return (dispatch) => {
|
|
117
|
+
dispatch({ type: actions.SET, accessData });
|
|
118
|
+
};
|
|
181
119
|
};
|
|
182
120
|
|
|
183
121
|
const actions = {
|
|
@@ -12,13 +12,17 @@ export const getStoryPublishStatus = (api: IImposiumAPI, storyId: string): any =
|
|
|
12
12
|
api.getStoryStatus(storyId)
|
|
13
13
|
.then((resStatus) => {
|
|
14
14
|
if (resStatus) {
|
|
15
|
+
if (resStatus.status === 'failed') {
|
|
16
|
+
reject(resStatus.message);
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
dispatch({ type: publish.UPDATE_PUBLISH_STATUS, data: resStatus });
|
|
20
|
+
|
|
16
21
|
if (resStatus.publishing) {
|
|
17
22
|
const jobId = resStatus.job_id;
|
|
18
23
|
api.pollJob(jobId)
|
|
19
24
|
.then(() => {
|
|
20
25
|
return dispatch(getStoryPublishStatus(api, storyId));
|
|
21
|
-
// Error polling job
|
|
22
26
|
})
|
|
23
27
|
.catch((e) => {
|
|
24
28
|
api.cancelJobPolling()
|
|
@@ -29,7 +33,6 @@ export const getStoryPublishStatus = (api: IImposiumAPI, storyId: string): any =
|
|
|
29
33
|
reject(f);
|
|
30
34
|
throw f;
|
|
31
35
|
});
|
|
32
|
-
console.error(e);
|
|
33
36
|
reject(copy.header.publishPollError);
|
|
34
37
|
});
|
|
35
38
|
}
|
|
@@ -73,7 +76,7 @@ export const publishVersion = (api: IImposiumAPI, storyId: string) => {
|
|
|
73
76
|
return new Promise((resolve, reject) => {
|
|
74
77
|
api.runPublish(storyId, '')
|
|
75
78
|
.then((d) => {
|
|
76
|
-
dispatch(getStoryPublishStatus(api, storyId));
|
|
79
|
+
return dispatch(getStoryPublishStatus(api, storyId));
|
|
77
80
|
})
|
|
78
81
|
.catch(() => {
|
|
79
82
|
reject(copy.header.publishJobError);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import actions
|
|
1
|
+
import actions from '../actions/access';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} catch (e) {
|
|
8
|
-
console.warn('Cached access data was malformed or missing, redirected to login.');
|
|
9
|
-
}
|
|
3
|
+
const initialState: any = {
|
|
4
|
+
organizations: [],
|
|
5
|
+
services: []
|
|
6
|
+
};
|
|
10
7
|
|
|
11
8
|
const access = (state = initialState, action) => {
|
|
12
9
|
switch (action.type) {
|
package/src/services/Session.ts
CHANGED
|
@@ -6,23 +6,19 @@ export interface IHubSession {
|
|
|
6
6
|
sub: string;
|
|
7
7
|
organization_id: string;
|
|
8
8
|
story_id: string;
|
|
9
|
-
stories_hash: number;
|
|
10
|
-
orgs_hash: number;
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
export default class SessionService {
|
|
14
|
-
private static readonly
|
|
12
|
+
private static readonly LOGIN_STORY_ID_CACHE: string = 'imp_hub_last_story_id';
|
|
15
13
|
|
|
16
|
-
private static readonly
|
|
14
|
+
private static readonly LOGIN_ORG_ID_CACHE: string = 'imp_hub_last_org_id';
|
|
17
15
|
|
|
18
16
|
private static readonly SESSION_COOKIE_NAME: string = 'auth_state';
|
|
19
17
|
|
|
20
18
|
private static readonly FRESH_COOKIE: IHubSession = {
|
|
21
19
|
sub: '',
|
|
22
20
|
organization_id: '',
|
|
23
|
-
story_id: ''
|
|
24
|
-
stories_hash: 0,
|
|
25
|
-
orgs_hash: 0
|
|
21
|
+
story_id: ''
|
|
26
22
|
};
|
|
27
23
|
|
|
28
24
|
/*
|
|
@@ -65,75 +61,27 @@ export default class SessionService {
|
|
|
65
61
|
Cookies.remove(SessionService.SESSION_COOKIE_NAME, { domain });
|
|
66
62
|
};
|
|
67
63
|
|
|
68
|
-
public static buildFreshSession = (
|
|
64
|
+
public static buildFreshSession = (
|
|
65
|
+
freshIdentity: IIdentity,
|
|
66
|
+
orgId: string = null,
|
|
67
|
+
storyId: string = null
|
|
68
|
+
): void => {
|
|
69
69
|
const {
|
|
70
70
|
idTokenPayload: { sub, exp }
|
|
71
71
|
} = freshIdentity;
|
|
72
|
-
const { organizations } = freshAccess;
|
|
73
|
-
|
|
74
|
-
let cachedOrganizationId: string;
|
|
75
|
-
let cachedStoryId: string;
|
|
76
|
-
let organizationId: string = '';
|
|
77
|
-
let activeStoryId: string = '';
|
|
78
|
-
let activeOrg: any;
|
|
79
|
-
|
|
80
|
-
try {
|
|
81
|
-
cachedOrganizationId = localStorage.getItem(SessionService.LAST_ORG_ID_CACHE);
|
|
82
|
-
cachedStoryId = localStorage.getItem(SessionService.LAST_STORY_ID_CACHE);
|
|
83
|
-
} catch (e) {
|
|
84
|
-
console.warn('Failed to look up cached hub settings', e);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Check if org exists in access data fetched from imposium
|
|
88
|
-
if (cachedOrganizationId) {
|
|
89
|
-
activeOrg = freshAccess.organizations.find((o: any) => o.id === cachedOrganizationId);
|
|
90
|
-
|
|
91
|
-
if (typeof activeOrg === 'object' && activeOrg.hasOwnProperty('id')) {
|
|
92
|
-
organizationId = cachedOrganizationId;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
72
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
cachedStoryId &&
|
|
100
|
-
organizationId &&
|
|
101
|
-
activeOrg.stories &&
|
|
102
|
-
activeOrg.stories.find((s: any) => s.id === cachedStoryId)
|
|
103
|
-
) {
|
|
104
|
-
activeStoryId = cachedStoryId;
|
|
105
|
-
}
|
|
73
|
+
const freshSession: any = {
|
|
74
|
+
sub
|
|
75
|
+
};
|
|
106
76
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
!organizationId &&
|
|
110
|
-
organizations.length > 0 &&
|
|
111
|
-
typeof organizations[0] === 'object' &&
|
|
112
|
-
organizations[0].hasOwnProperty('id')
|
|
113
|
-
) {
|
|
114
|
-
organizationId = organizations[0].id;
|
|
77
|
+
if (orgId) {
|
|
78
|
+
freshSession.organization_id = orgId;
|
|
115
79
|
}
|
|
116
80
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
!activeStoryId &&
|
|
120
|
-
organizations &&
|
|
121
|
-
organizations[0] &&
|
|
122
|
-
organizations[0].stories.length > 0 &&
|
|
123
|
-
typeof organizations[0].stories[0] === 'object' &&
|
|
124
|
-
organizations[0].stories[0].hasOwnProperty('id')
|
|
125
|
-
) {
|
|
126
|
-
activeStoryId = organizations[0].stories[0].id;
|
|
81
|
+
if (storyId) {
|
|
82
|
+
freshSession.story_id = storyId;
|
|
127
83
|
}
|
|
128
84
|
|
|
129
|
-
const freshSession: IHubSession = {
|
|
130
|
-
sub,
|
|
131
|
-
organization_id: organizationId,
|
|
132
|
-
story_id: activeStoryId,
|
|
133
|
-
stories_hash: SessionService.generateStoriesHash(freshAccess),
|
|
134
|
-
orgs_hash: SessionService.generateOrgsHash(freshAccess)
|
|
135
|
-
};
|
|
136
|
-
|
|
137
85
|
SessionService.storeSession(freshSession, exp);
|
|
138
86
|
};
|
|
139
87
|
|
|
@@ -145,69 +93,35 @@ export default class SessionService {
|
|
|
145
93
|
Cookies.set(SessionService.SESSION_COOKIE_NAME, cookieData, { domain, expires: expiry });
|
|
146
94
|
};
|
|
147
95
|
|
|
148
|
-
public static
|
|
149
|
-
|
|
150
|
-
const nextCookieData: IHubSession = { ...prevCookieData, ...values };
|
|
151
|
-
|
|
152
|
-
if (values.hasOwnProperty('organization_id')) {
|
|
153
|
-
try {
|
|
154
|
-
localStorage.setItem(SessionService.LAST_ORG_ID_CACHE, values.organization_id);
|
|
155
|
-
} catch (e) {
|
|
156
|
-
console.warn('Failed to cache last organization id selected', e);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (values.hasOwnProperty('story_id')) {
|
|
161
|
-
try {
|
|
162
|
-
localStorage.setItem(SessionService.LAST_STORY_ID_CACHE, values.story_id);
|
|
163
|
-
} catch (e) {
|
|
164
|
-
console.warn('Failed to cache last story id selected', e);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
SessionService.storeSession(nextCookieData, auth0Expiry);
|
|
96
|
+
public static cacheOrgId = (organizationId: string): void => {
|
|
97
|
+
localStorage.setItem(SessionService.LOGIN_ORG_ID_CACHE, organizationId);
|
|
169
98
|
};
|
|
170
99
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
public static generateOrgsHash = (accessData: any): number => {
|
|
175
|
-
const allOrgIdsStringified: string = accessData.organizations.map((o) => o.id).join('');
|
|
100
|
+
public static clearCachedOrgId = () => {
|
|
101
|
+
localStorage.removeItem(SessionService.LOGIN_ORG_ID_CACHE);
|
|
102
|
+
};
|
|
176
103
|
|
|
177
|
-
|
|
104
|
+
public static getCachedOrgId = (): string => {
|
|
105
|
+
return localStorage.getItem(SessionService.LOGIN_ORG_ID_CACHE);
|
|
178
106
|
};
|
|
179
107
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
*/
|
|
183
|
-
public static generateStoriesHash = (accessData: any): number => {
|
|
184
|
-
const allStories: any[] = accessData.organizations.reduce(
|
|
185
|
-
(p, c) => [...p, ...c.stories],
|
|
186
|
-
[]
|
|
187
|
-
);
|
|
188
|
-
const allStoriesStringified: string = allStories
|
|
189
|
-
.map((story) => `${story.id}${story.name}`)
|
|
190
|
-
.join('');
|
|
191
|
-
|
|
192
|
-
return SessionService.string2Hash(allStoriesStringified);
|
|
108
|
+
public static cacheStoryId = (storyId: string): void => {
|
|
109
|
+
localStorage.setItem(SessionService.LOGIN_STORY_ID_CACHE, storyId);
|
|
193
110
|
};
|
|
194
111
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
private static string2Hash = (s: string): number => {
|
|
199
|
-
let hash: number = 0;
|
|
112
|
+
public static clearCachedStoryId = (): void => {
|
|
113
|
+
localStorage.removeItem(SessionService.LOGIN_STORY_ID_CACHE);
|
|
114
|
+
};
|
|
200
115
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
116
|
+
public static getCachedStoryId = (): string => {
|
|
117
|
+
return localStorage.getItem(SessionService.LOGIN_STORY_ID_CACHE);
|
|
118
|
+
};
|
|
204
119
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
120
|
+
public static updateSession = (values: any, auth0Expiry: number): void => {
|
|
121
|
+
const prevCookieData: IHubSession = SessionService.getSession();
|
|
122
|
+
const nextCookieData: IHubSession = { ...prevCookieData, ...values };
|
|
209
123
|
|
|
210
|
-
|
|
124
|
+
SessionService.storeSession(nextCookieData, auth0Expiry);
|
|
211
125
|
};
|
|
212
126
|
|
|
213
127
|
/*
|