@imposium-hub/components 2.9.0-2 → 2.9.0-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.
- package/dist/cjs/components/app-wrapper/AppWrapper.js +8 -1
- package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/cjs/components/edit-guide-modal/EditGuideModal.d.ts +8 -0
- package/dist/cjs/components/edit-guide-modal/EditGuideModal.js +122 -0
- package/dist/cjs/components/edit-guide-modal/EditGuideModal.js.map +1 -0
- package/dist/cjs/components/header/Header.js +9 -7
- package/dist/cjs/components/header/Header.js.map +1 -1
- package/dist/cjs/components/number-field/NumberField.d.ts +1 -0
- package/dist/cjs/components/number-field/NumberField.js +3 -0
- package/dist/cjs/components/number-field/NumberField.js.map +1 -1
- package/dist/cjs/components/publish-wizard/publish/EmailWorkflow.js +52 -23
- package/dist/cjs/components/publish-wizard/publish/EmailWorkflow.js.map +1 -1
- package/dist/cjs/components/replace-files-modal/ReplaceFilesModal.d.ts +1 -0
- package/dist/cjs/components/replace-files-modal/ReplaceFilesModal.js +11 -1
- package/dist/cjs/components/replace-files-modal/ReplaceFilesModal.js.map +1 -1
- package/dist/cjs/components/story-previewer/StoryPreviewer.js +17 -3
- package/dist/cjs/components/story-previewer/StoryPreviewer.js.map +1 -1
- package/dist/cjs/components/tabs/Tabs.js +2 -1
- package/dist/cjs/components/tabs/Tabs.js.map +1 -1
- package/dist/cjs/constants/copy.d.ts +1 -1
- package/dist/cjs/constants/copy.js +1 -1
- package/dist/cjs/constants/copy.js.map +1 -1
- package/dist/cjs/constants/publish.d.ts +3 -0
- package/dist/cjs/constants/publish.js +5 -3
- package/dist/cjs/constants/publish.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/API.d.ts +3 -8
- package/dist/cjs/services/API.js +29 -101
- package/dist/cjs/services/API.js.map +1 -1
- package/dist/esm/components/app-wrapper/AppWrapper.js +8 -1
- package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
- package/dist/esm/components/edit-guide-modal/EditGuideModal.d.ts +8 -0
- package/dist/esm/components/edit-guide-modal/EditGuideModal.js +65 -0
- package/dist/esm/components/edit-guide-modal/EditGuideModal.js.map +1 -0
- package/dist/esm/components/header/Header.js +7 -5
- package/dist/esm/components/header/Header.js.map +1 -1
- package/dist/esm/components/number-field/NumberField.d.ts +1 -0
- package/dist/esm/components/number-field/NumberField.js +3 -0
- package/dist/esm/components/number-field/NumberField.js.map +1 -1
- package/dist/esm/components/publish-wizard/publish/EmailWorkflow.js +43 -14
- package/dist/esm/components/publish-wizard/publish/EmailWorkflow.js.map +1 -1
- package/dist/esm/components/replace-files-modal/ReplaceFilesModal.d.ts +1 -0
- package/dist/esm/components/replace-files-modal/ReplaceFilesModal.js +11 -1
- package/dist/esm/components/replace-files-modal/ReplaceFilesModal.js.map +1 -1
- package/dist/esm/components/story-previewer/StoryPreviewer.js +13 -4
- package/dist/esm/components/story-previewer/StoryPreviewer.js.map +1 -1
- package/dist/esm/components/tabs/Tabs.js +2 -1
- package/dist/esm/components/tabs/Tabs.js.map +1 -1
- package/dist/esm/constants/copy.d.ts +1 -1
- package/dist/esm/constants/copy.js +1 -1
- package/dist/esm/constants/copy.js.map +1 -1
- package/dist/esm/constants/publish.d.ts +3 -0
- package/dist/esm/constants/publish.js +4 -2
- package/dist/esm/constants/publish.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/API.d.ts +3 -8
- package/dist/esm/services/API.js +9 -46
- package/dist/esm/services/API.js.map +1 -1
- package/package.json +5 -5
- package/src/components/app-wrapper/AppWrapper.tsx +8 -0
- package/src/components/edit-guide-modal/EditGuideModal.tsx +110 -0
- package/src/components/header/Header.tsx +7 -5
- package/src/components/number-field/NumberField.tsx +4 -0
- package/src/components/publish-wizard/publish/EmailWorkflow.tsx +66 -24
- package/src/components/story-previewer/StoryPreviewer.tsx +24 -8
- package/src/components/tabs/Tabs.tsx +2 -1
- package/src/constants/copy.ts +1 -1
- package/src/constants/publish.ts +7 -2
- package/src/index.ts +3 -0
- package/src/services/API.ts +13 -76
- package/dist/cjs/components/auth-gate/AuthGate.d.ts +0 -2
- package/dist/cjs/components/auth-gate/AuthGate.js +0 -105
- package/dist/cjs/components/auth-gate/AuthGate.js.map +0 -1
- package/dist/cjs/redux/actions/auth.d.ts +0 -9
- package/dist/cjs/redux/actions/auth.js +0 -30
- package/dist/cjs/redux/actions/auth.js.map +0 -1
- package/dist/cjs/redux/reducers/auth.d.ts +0 -3
- package/dist/cjs/redux/reducers/auth.js +0 -67
- package/dist/cjs/redux/reducers/auth.js.map +0 -1
- package/dist/cjs/services/Auth0.d.ts +0 -18
- package/dist/cjs/services/Auth0.js +0 -102
- package/dist/cjs/services/Auth0.js.map +0 -1
- package/dist/cjs/services/Session.d.ts +0 -26
- package/dist/cjs/services/Session.js +0 -155
- package/dist/cjs/services/Session.js.map +0 -1
- package/dist/esm/components/auth-gate/AuthGate.d.ts +0 -2
- package/dist/esm/components/auth-gate/AuthGate.js +0 -59
- package/dist/esm/components/auth-gate/AuthGate.js.map +0 -1
- package/dist/esm/redux/actions/auth.d.ts +0 -9
- package/dist/esm/redux/actions/auth.js +0 -25
- package/dist/esm/redux/actions/auth.js.map +0 -1
- package/dist/esm/redux/reducers/auth.d.ts +0 -3
- package/dist/esm/redux/reducers/auth.js +0 -27
- package/dist/esm/redux/reducers/auth.js.map +0 -1
- package/dist/esm/services/Auth0.d.ts +0 -18
- package/dist/esm/services/Auth0.js +0 -68
- package/dist/esm/services/Auth0.js.map +0 -1
- package/dist/esm/services/Session.d.ts +0 -26
- package/dist/esm/services/Session.js +0 -107
- package/dist/esm/services/Session.js.map +0 -1
|
@@ -17,6 +17,7 @@ interface INumberFieldProps {
|
|
|
17
17
|
min?: number;
|
|
18
18
|
max?: number;
|
|
19
19
|
onBlur?(e): void;
|
|
20
|
+
focusOnMount?: boolean;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
interface INumberFieldState {
|
|
@@ -37,6 +38,9 @@ class NumberField extends React.PureComponent<INumberFieldProps, INumberFieldSta
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
public componentDidMount(): void {
|
|
41
|
+
if (this.props.focusOnMount && this.inputRef.current) {
|
|
42
|
+
this.inputRef.current.focus();
|
|
43
|
+
}
|
|
40
44
|
this.setState({
|
|
41
45
|
error: false,
|
|
42
46
|
value: this.props.value
|
|
@@ -12,7 +12,13 @@ import { connect } from 'react-redux';
|
|
|
12
12
|
import SelectField from '../../select-field/SelectField';
|
|
13
13
|
import { updateAssociation, getBatch, setPage } from '../../../redux/actions/active-batch';
|
|
14
14
|
import TextField from '../../text-field/TextField';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
ADSTUDIO_POST_RENDER_ACTION,
|
|
17
|
+
ASSET_NAME_VAR,
|
|
18
|
+
ASSETS_POST_RENDER_ACTION,
|
|
19
|
+
CRM_PLACEMENT_VARS
|
|
20
|
+
} from '../../../constants/publish';
|
|
21
|
+
import CheckboxField from '../../checkbox-field/CheckboxField';
|
|
16
22
|
|
|
17
23
|
interface IEmailWorkflowProps {
|
|
18
24
|
story: any;
|
|
@@ -69,12 +75,12 @@ interface IEmailWorkflowProps {
|
|
|
69
75
|
onNext: (val: boolean) => void;
|
|
70
76
|
next: boolean;
|
|
71
77
|
isCrM: boolean;
|
|
78
|
+
isCrMAsset?: boolean;
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
interface CrMOverrides {
|
|
75
82
|
creative_id: string;
|
|
76
83
|
creative_library_id: string;
|
|
77
|
-
notification_email: string;
|
|
78
84
|
placement_type: string;
|
|
79
85
|
}
|
|
80
86
|
|
|
@@ -124,7 +130,6 @@ class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkf
|
|
|
124
130
|
creativeManagerOverrides: {
|
|
125
131
|
creative_id: '',
|
|
126
132
|
creative_library_id: '',
|
|
127
|
-
notification_email: '',
|
|
128
133
|
placement_type: 'crm-adstudio'
|
|
129
134
|
},
|
|
130
135
|
waitingForPublish: false,
|
|
@@ -266,6 +271,8 @@ class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkf
|
|
|
266
271
|
const { name } = this.props.story;
|
|
267
272
|
const { isCrM } = this.props;
|
|
268
273
|
const { inventory, inventoryKeys } = this.state;
|
|
274
|
+
const uploadAsAssets =
|
|
275
|
+
this.state.creativeManagerOverrides.placement_type === ASSETS_POST_RENDER_ACTION;
|
|
269
276
|
|
|
270
277
|
const maskConfig: any[] = inventoryKeys.map((currKey: string) => {
|
|
271
278
|
let value = '';
|
|
@@ -288,12 +295,27 @@ class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkf
|
|
|
288
295
|
});
|
|
289
296
|
|
|
290
297
|
if (isCrM) {
|
|
291
|
-
|
|
292
|
-
maskConfig.push(
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
298
|
+
if (uploadAsAssets) {
|
|
299
|
+
maskConfig.push(
|
|
300
|
+
{
|
|
301
|
+
id: ASSET_NAME_VAR,
|
|
302
|
+
name: ASSET_NAME_VAR,
|
|
303
|
+
show: true
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
id: 'creative_library_id',
|
|
307
|
+
name: 'creative_library_id',
|
|
308
|
+
show: true
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
} else {
|
|
312
|
+
for (const id of CRM_PLACEMENT_VARS) {
|
|
313
|
+
maskConfig.push({
|
|
314
|
+
id,
|
|
315
|
+
name: id,
|
|
316
|
+
show: true
|
|
317
|
+
});
|
|
318
|
+
}
|
|
297
319
|
}
|
|
298
320
|
}
|
|
299
321
|
|
|
@@ -436,12 +458,7 @@ class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkf
|
|
|
436
458
|
private getPostRenderActions() {
|
|
437
459
|
const CrMUploadAction = { data: {} };
|
|
438
460
|
const {
|
|
439
|
-
creativeManagerOverrides: {
|
|
440
|
-
placement_type,
|
|
441
|
-
creative_id,
|
|
442
|
-
creative_library_id,
|
|
443
|
-
notification_email
|
|
444
|
-
}
|
|
461
|
+
creativeManagerOverrides: { placement_type, creative_id, creative_library_id }
|
|
445
462
|
} = this.state;
|
|
446
463
|
|
|
447
464
|
CrMUploadAction['type'] = placement_type;
|
|
@@ -451,9 +468,6 @@ class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkf
|
|
|
451
468
|
if (creative_library_id) {
|
|
452
469
|
CrMUploadAction.data['creative_library_id'] = creative_library_id;
|
|
453
470
|
}
|
|
454
|
-
if (notification_email) {
|
|
455
|
-
CrMUploadAction.data['notification_email'] = notification_email;
|
|
456
|
-
}
|
|
457
471
|
|
|
458
472
|
return [CrMUploadAction];
|
|
459
473
|
}
|
|
@@ -911,10 +925,8 @@ const CrMOptions: React.FC<ICrMOptionsProps> = ({ options, onChange, errorCopy =
|
|
|
911
925
|
</div>
|
|
912
926
|
) : null;
|
|
913
927
|
|
|
914
|
-
|
|
928
|
+
const standardInterface = (
|
|
915
929
|
<>
|
|
916
|
-
<HRule />
|
|
917
|
-
<br />
|
|
918
930
|
<h2>{copy.publish.crmPlacement}</h2>
|
|
919
931
|
<p>{copy.publish.crmData}</p>
|
|
920
932
|
{e}
|
|
@@ -933,14 +945,44 @@ const CrMOptions: React.FC<ICrMOptionsProps> = ({ options, onChange, errorCopy =
|
|
|
933
945
|
value={options.creative_id}
|
|
934
946
|
onChange={(v) => onInputChange('creative_id', v)}
|
|
935
947
|
/>
|
|
948
|
+
</>
|
|
949
|
+
);
|
|
950
|
+
|
|
951
|
+
const assetInterface = (
|
|
952
|
+
<>
|
|
953
|
+
<h2>{copy.publish.crmPlacement}</h2>
|
|
954
|
+
<p>{copy.publish.crmData}</p>
|
|
955
|
+
{e}
|
|
956
|
+
<br />
|
|
936
957
|
<TextField
|
|
937
958
|
width={'33%'}
|
|
938
959
|
labelPosition='top'
|
|
939
|
-
label={copy.publish.
|
|
940
|
-
value={options.
|
|
941
|
-
onChange={(v) => onInputChange('
|
|
960
|
+
label={copy.publish.creativeLibraryId}
|
|
961
|
+
value={options.creative_library_id}
|
|
962
|
+
onChange={(v) => onInputChange('creative_library_id', v)}
|
|
942
963
|
/>
|
|
964
|
+
</>
|
|
965
|
+
);
|
|
966
|
+
return (
|
|
967
|
+
<>
|
|
968
|
+
<HRule />
|
|
943
969
|
<br />
|
|
970
|
+
{options['placement_type'] === ASSETS_POST_RENDER_ACTION
|
|
971
|
+
? assetInterface
|
|
972
|
+
: standardInterface}
|
|
973
|
+
<br />
|
|
974
|
+
<HRule />
|
|
975
|
+
<CheckboxField
|
|
976
|
+
value={options['placement_type'] === ASSETS_POST_RENDER_ACTION ? true : false}
|
|
977
|
+
label={copy.publish.uploadAsAssets}
|
|
978
|
+
onChange={(v) => {
|
|
979
|
+
if (v === false) {
|
|
980
|
+
onInputChange('placement_type', ADSTUDIO_POST_RENDER_ACTION);
|
|
981
|
+
} else {
|
|
982
|
+
onInputChange('placement_type', ASSETS_POST_RENDER_ACTION);
|
|
983
|
+
}
|
|
984
|
+
}}
|
|
985
|
+
/>
|
|
944
986
|
<HRule />
|
|
945
987
|
</>
|
|
946
988
|
);
|
|
@@ -48,6 +48,7 @@ interface IStoryPreviewerProps {
|
|
|
48
48
|
compositionOptions?: any[];
|
|
49
49
|
editor: any;
|
|
50
50
|
updateEditorConfig(c): void;
|
|
51
|
+
reRender: boolean;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
interface IStoryPreviewerState {
|
|
@@ -199,7 +200,15 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
199
200
|
if (!prevProps.editor?.autoRender && this.props.editor?.autoRender) {
|
|
200
201
|
this.props.updateEditorConfig({ autoRender: false });
|
|
201
202
|
this.evtHandlers.gotExperience = null;
|
|
202
|
-
this.props.api.cancelExperiencePolling().then(() =>
|
|
203
|
+
this.props.api.cancelExperiencePolling().then(() => {
|
|
204
|
+
if (this.props.editor?.reRender) {
|
|
205
|
+
this.setState({ compositionOverride: null }, () =>
|
|
206
|
+
this.createExperience(this.props.compositionId)
|
|
207
|
+
);
|
|
208
|
+
} else {
|
|
209
|
+
this.createExperience();
|
|
210
|
+
}
|
|
211
|
+
});
|
|
203
212
|
}
|
|
204
213
|
|
|
205
214
|
if (
|
|
@@ -502,11 +511,17 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
502
511
|
onExperenceLoaded(resVideo);
|
|
503
512
|
}
|
|
504
513
|
|
|
505
|
-
this.setState(
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
514
|
+
this.setState(
|
|
515
|
+
{
|
|
516
|
+
rendering: false,
|
|
517
|
+
activeOutput: this.getFirstOutput(resVideo),
|
|
518
|
+
experience: resVideo
|
|
519
|
+
},
|
|
520
|
+
() =>
|
|
521
|
+
this.props.updateEditorConfig({
|
|
522
|
+
reRender: false
|
|
523
|
+
})
|
|
524
|
+
);
|
|
510
525
|
};
|
|
511
526
|
|
|
512
527
|
api.getExperience(experienceId, true)
|
|
@@ -609,12 +624,12 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
609
624
|
);
|
|
610
625
|
}
|
|
611
626
|
|
|
612
|
-
private createExperience() {
|
|
627
|
+
private createExperience(compositionId?) {
|
|
613
628
|
const { storyId, onNotification, onError, api, onExperienceCreated, useWorkingCopy } =
|
|
614
629
|
this.props;
|
|
615
630
|
|
|
616
631
|
const fastRender = this.props.editor?.fastRender || false;
|
|
617
|
-
const compId = this.getCompId();
|
|
632
|
+
const compId = compositionId ? compositionId : this.getCompId();
|
|
618
633
|
|
|
619
634
|
this.resetState(false, () => {
|
|
620
635
|
this.setState(
|
|
@@ -879,6 +894,7 @@ class StoryPreviewer extends React.PureComponent<IStoryPreviewerProps, IStoryPre
|
|
|
879
894
|
const { storyId } = this.props;
|
|
880
895
|
const renderCopy = experience ? copy.btnReRender : copy.btnRender;
|
|
881
896
|
const compId = this.getCompId();
|
|
897
|
+
|
|
882
898
|
const btnRender = !rendering ? (
|
|
883
899
|
<Button
|
|
884
900
|
disabled={!compId}
|
package/src/constants/copy.ts
CHANGED
|
@@ -123,6 +123,7 @@ export const compositions = {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
export const publish = {
|
|
126
|
+
uploadAsAssets: 'Upload as Assets',
|
|
126
127
|
noVariablesError:
|
|
127
128
|
'No variables found on the project. Cannot proceed with publishing to Creative Manager until at least one variable is added to the project.',
|
|
128
129
|
publishInProgress: 'Publish to Creative Manager in progress',
|
|
@@ -130,7 +131,6 @@ export const publish = {
|
|
|
130
131
|
btnCrM: 'Creative Manager',
|
|
131
132
|
creativeLibraryId: 'Creative Library ID',
|
|
132
133
|
creativeId: 'Creative ID',
|
|
133
|
-
email: 'Notification Email',
|
|
134
134
|
missingFields: 'Please provide the missing fields and try again!',
|
|
135
135
|
crmPlacement: 'Creative Manager Placement Variables',
|
|
136
136
|
crmData: `If your CSV batch data doesn't contain the required Creative Manager placement variables, or you would like to override them, enter the values below before you upload the batch data.`,
|
package/src/constants/publish.ts
CHANGED
|
@@ -14,11 +14,16 @@ export const CRM_PLACEMENT_OPTIONS = [
|
|
|
14
14
|
}
|
|
15
15
|
];
|
|
16
16
|
|
|
17
|
+
export const ASSET_NAME_VAR = 'asset-name';
|
|
18
|
+
|
|
17
19
|
export const CRM_PLACEMENT_VARS = [
|
|
18
20
|
'creative_library_id',
|
|
19
21
|
'creative_id',
|
|
20
22
|
'version-name',
|
|
21
23
|
'version-id',
|
|
22
|
-
'clickTag1'
|
|
23
|
-
'notificiaton_email'
|
|
24
|
+
'clickTag1'
|
|
24
25
|
];
|
|
26
|
+
|
|
27
|
+
export const ADSTUDIO_POST_RENDER_ACTION = 'crm-adstudio';
|
|
28
|
+
|
|
29
|
+
export const ASSETS_POST_RENDER_ACTION = 'crm-asset';
|
package/src/index.ts
CHANGED
|
@@ -162,6 +162,7 @@ import StoryTableNameFilter from './components/assets/StoryTableNameFilter';
|
|
|
162
162
|
import { AppWrapper } from './components/app-wrapper/AppWrapper';
|
|
163
163
|
import { pushRoute, replaceRoute } from './utils/routing';
|
|
164
164
|
import { ProjectDropdown } from './components/header/ProjectDropdown';
|
|
165
|
+
import { EditGuideModal, IEditGuideModalProps } from './components/edit-guide-modal/EditGuideModal';
|
|
165
166
|
import { openConfirmModal } from './utils/modal';
|
|
166
167
|
|
|
167
168
|
export {
|
|
@@ -321,5 +322,7 @@ export {
|
|
|
321
322
|
CopyPropIdButton,
|
|
322
323
|
ConfirmModal,
|
|
323
324
|
IConfirmModalProps,
|
|
325
|
+
EditGuideModal,
|
|
326
|
+
IEditGuideModalProps,
|
|
324
327
|
openConfirmModal
|
|
325
328
|
};
|
package/src/services/API.ts
CHANGED
|
@@ -120,8 +120,6 @@ export interface IImposiumAPI {
|
|
|
120
120
|
addUser(organizationId: string, email: string, roleId: number);
|
|
121
121
|
updateRole(organizationId: string, userId: string, roleId: number);
|
|
122
122
|
deleteUser(organizationId: string, userId: string);
|
|
123
|
-
getPlayerMetrics(storyId: string, start: number, end: number, alias: string);
|
|
124
|
-
getSystemMetrics(storyId: string, start: number, end: number, step: number, alias: string);
|
|
125
123
|
getOrganizations(page: number, itemsPerPage: number): Promise<any[]>;
|
|
126
124
|
addOrganization(orgName: string, enableCloudfront: boolean, defaultStory?: string);
|
|
127
125
|
cancelExperiencePolling();
|
|
@@ -159,6 +157,7 @@ export interface IImposiumAPI {
|
|
|
159
157
|
removeAllQueueAssocs(queueId: string);
|
|
160
158
|
removeQueueAssoc(queueId: string, storyId: string);
|
|
161
159
|
getQueueStories(config: any, itemsPerPage: number);
|
|
160
|
+
cancelAllPendingRequests();
|
|
162
161
|
getToken: any;
|
|
163
162
|
}
|
|
164
163
|
|
|
@@ -172,11 +171,6 @@ interface ITTSOptions {
|
|
|
172
171
|
minimum_silence_length?: number;
|
|
173
172
|
}
|
|
174
173
|
|
|
175
|
-
interface ICancelTokenCache {
|
|
176
|
-
player: CancelTokenSource | undefined;
|
|
177
|
-
system: CancelTokenSource | undefined;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
174
|
export default class API {
|
|
181
175
|
private http: AxiosInstance;
|
|
182
176
|
|
|
@@ -188,17 +182,14 @@ export default class API {
|
|
|
188
182
|
|
|
189
183
|
private jobPollTimer: any;
|
|
190
184
|
|
|
191
|
-
private cancelTokenCache: ICancelTokenCache = {
|
|
192
|
-
player: undefined,
|
|
193
|
-
system: undefined
|
|
194
|
-
};
|
|
195
|
-
|
|
196
185
|
private cancelTokens: object = {};
|
|
197
186
|
|
|
198
187
|
public getToken;
|
|
199
188
|
|
|
200
189
|
private authType;
|
|
201
190
|
|
|
191
|
+
private abortController;
|
|
192
|
+
|
|
202
193
|
public init(baseURL: string, credentials: any, organizationId?: string): void {
|
|
203
194
|
// JWT
|
|
204
195
|
const headers = {
|
|
@@ -229,12 +220,17 @@ export default class API {
|
|
|
229
220
|
|
|
230
221
|
this.getToken = credentials;
|
|
231
222
|
this.awsHttp = axios.create();
|
|
223
|
+
this.abortController = new AbortController();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
public cancelAllPendingRequests() {
|
|
227
|
+
this.abortController.abort();
|
|
228
|
+
this.abortController = new AbortController();
|
|
232
229
|
}
|
|
233
230
|
|
|
234
231
|
private doRequest = async (
|
|
235
232
|
config: AxiosRequestConfig,
|
|
236
|
-
organizationId?: string
|
|
237
|
-
reqAlias: string = ''
|
|
233
|
+
organizationId?: string
|
|
238
234
|
): Promise<any> => {
|
|
239
235
|
if (this.authType === API_AUTH_TYPES.TOKEN) {
|
|
240
236
|
const token = await this.getToken();
|
|
@@ -249,19 +245,14 @@ export default class API {
|
|
|
249
245
|
config.headers = headers;
|
|
250
246
|
}
|
|
251
247
|
|
|
248
|
+
config.signal = this.abortController.signal;
|
|
249
|
+
|
|
252
250
|
return new Promise((resolve, reject) => {
|
|
253
251
|
this.http(config)
|
|
254
252
|
.then((res: AxiosResponse) => {
|
|
255
|
-
if (reqAlias) {
|
|
256
|
-
this.clearCache(reqAlias);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
253
|
resolve(res.data);
|
|
260
254
|
})
|
|
261
255
|
.catch((e: AxiosError) => {
|
|
262
|
-
if (!axios.isCancel(e) && reqAlias) {
|
|
263
|
-
this.clearCache(reqAlias);
|
|
264
|
-
}
|
|
265
256
|
reject(e);
|
|
266
257
|
});
|
|
267
258
|
});
|
|
@@ -286,22 +277,7 @@ export default class API {
|
|
|
286
277
|
});
|
|
287
278
|
};
|
|
288
279
|
|
|
289
|
-
private
|
|
290
|
-
const source: CancelTokenSource = axios.CancelToken.source();
|
|
291
|
-
|
|
292
|
-
if (this.cancelTokenCache[reqAlias]) {
|
|
293
|
-
this.cancelTokenCache[reqAlias].cancel();
|
|
294
|
-
}
|
|
295
|
-
this.cancelTokenCache[reqAlias] = source;
|
|
296
|
-
|
|
297
|
-
return source.token;
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
private clearCache = (reqAlias: string): void => {
|
|
301
|
-
this.cancelTokenCache[reqAlias] = undefined;
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
private doAWSRequest = (config: AxiosRequestConfig, reqAlias: string = ''): Promise<any> => {
|
|
280
|
+
private doAWSRequest = (config: AxiosRequestConfig): Promise<any> => {
|
|
305
281
|
return new Promise((resolve, reject) => {
|
|
306
282
|
this.awsHttp(config)
|
|
307
283
|
.then((res: AxiosResponse) => {
|
|
@@ -514,10 +490,6 @@ export default class API {
|
|
|
514
490
|
return source.token;
|
|
515
491
|
};
|
|
516
492
|
|
|
517
|
-
private clearCancelTokes = () => {
|
|
518
|
-
this.cancelTokens = {};
|
|
519
|
-
};
|
|
520
|
-
|
|
521
493
|
public uploadAsset = (
|
|
522
494
|
storyId: string,
|
|
523
495
|
tags: string,
|
|
@@ -1454,41 +1426,6 @@ export default class API {
|
|
|
1454
1426
|
});
|
|
1455
1427
|
};
|
|
1456
1428
|
|
|
1457
|
-
public getPlayerMetrics = (
|
|
1458
|
-
storyId: string,
|
|
1459
|
-
start: number,
|
|
1460
|
-
end: number,
|
|
1461
|
-
alias: string = 'player'
|
|
1462
|
-
): Promise<any> => {
|
|
1463
|
-
const token = this.cancelPrevious(alias);
|
|
1464
|
-
const config: AxiosRequestConfig = {
|
|
1465
|
-
method: 'GET',
|
|
1466
|
-
url: `/metrics/player/${storyId}`,
|
|
1467
|
-
params: { start, end },
|
|
1468
|
-
cancelToken: token
|
|
1469
|
-
};
|
|
1470
|
-
|
|
1471
|
-
return this.doRequest(config, alias);
|
|
1472
|
-
};
|
|
1473
|
-
|
|
1474
|
-
public getSystemMetrics = (
|
|
1475
|
-
storyId: string,
|
|
1476
|
-
start: number,
|
|
1477
|
-
end: number,
|
|
1478
|
-
step: number,
|
|
1479
|
-
alias: string = 'system'
|
|
1480
|
-
): Promise<any> => {
|
|
1481
|
-
const token = this.cancelPrevious(alias);
|
|
1482
|
-
const config: AxiosRequestConfig = {
|
|
1483
|
-
method: 'GET',
|
|
1484
|
-
url: `/metrics/system/${storyId}`,
|
|
1485
|
-
params: { start, end, step },
|
|
1486
|
-
cancelToken: token
|
|
1487
|
-
};
|
|
1488
|
-
|
|
1489
|
-
return this.doRequest(config, alias);
|
|
1490
|
-
};
|
|
1491
|
-
|
|
1492
1429
|
public getOrganizations = (page: number, itemsPerPage: number): Promise<any[]> => {
|
|
1493
1430
|
return this.doRequest({
|
|
1494
1431
|
url: '/account',
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
-
};
|
|
43
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
var React = __importStar(require("react"));
|
|
45
|
-
var ScaleLoader_1 = __importDefault(require("react-spinners/ScaleLoader"));
|
|
46
|
-
var Session_1 = __importDefault(require("../../services/Session"));
|
|
47
|
-
var Auth0_1 = __importDefault(require("../../services/Auth0"));
|
|
48
|
-
var react_redux_1 = require("react-redux");
|
|
49
|
-
var redux_1 = require("redux");
|
|
50
|
-
var auth_1 = require("../../redux/actions/auth");
|
|
51
|
-
var access_1 = require("../../redux/actions/access");
|
|
52
|
-
var AuthGate = /** @class */ (function (_super) {
|
|
53
|
-
__extends(AuthGate, _super);
|
|
54
|
-
function AuthGate(p) {
|
|
55
|
-
var _this = _super.call(this, p) || this;
|
|
56
|
-
_this.componentDidMount = function () {
|
|
57
|
-
var _a = _this.props, auth0ClientId = _a.auth0ClientId, auth0Hash = _a.auth0Hash, auth0Domain = _a.auth0Domain, onAuthenticated = _a.onAuthenticated, baseUrl = _a.baseUrl;
|
|
58
|
-
Auth0_1.default.bindToClient(auth0ClientId, auth0Domain);
|
|
59
|
-
if (!auth0Hash) {
|
|
60
|
-
console.info('No hash found, redirecting to login');
|
|
61
|
-
Auth0_1.default.login();
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
Auth0_1.default.parseIdFromHash(auth0Hash)
|
|
65
|
-
.then(function (freshIdentity) {
|
|
66
|
-
// Use the cached org ID and story ID if it exists
|
|
67
|
-
var orgId = Session_1.default.getCachedOrgId() || null;
|
|
68
|
-
var storyId = Session_1.default.getCachedStoryId() || null;
|
|
69
|
-
Session_1.default.getAccessData(freshIdentity.accessToken, baseUrl, false, orgId)
|
|
70
|
-
.then(function (freshAccess) {
|
|
71
|
-
_this.props.login(freshIdentity);
|
|
72
|
-
_this.props.setAccessData(freshAccess);
|
|
73
|
-
Session_1.default.buildFreshSession(freshIdentity, orgId, storyId);
|
|
74
|
-
onAuthenticated(storyId, orgId);
|
|
75
|
-
})
|
|
76
|
-
.catch(function (e) {
|
|
77
|
-
console.error('Error getting access data, redirecting to root');
|
|
78
|
-
console.error(e);
|
|
79
|
-
onAuthenticated(null, null);
|
|
80
|
-
});
|
|
81
|
-
})
|
|
82
|
-
.catch(function (e) {
|
|
83
|
-
console.error('Error parsing ID from hash, redirecting to login');
|
|
84
|
-
console.error(e);
|
|
85
|
-
Auth0_1.default.login();
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
_this.render = function () {
|
|
90
|
-
return (React.createElement("div", { className: 'auth-gate' },
|
|
91
|
-
React.createElement(ScaleLoader_1.default, { color: AuthGate.LOADER_COLOR })));
|
|
92
|
-
};
|
|
93
|
-
return _this;
|
|
94
|
-
}
|
|
95
|
-
AuthGate.LOADER_COLOR = '#2d8ceb';
|
|
96
|
-
return AuthGate;
|
|
97
|
-
}(React.PureComponent));
|
|
98
|
-
var mapDispatchToProps = function (dispatch) {
|
|
99
|
-
return (0, redux_1.bindActionCreators)({
|
|
100
|
-
login: auth_1.login,
|
|
101
|
-
setAccessData: access_1.setAccessData
|
|
102
|
-
}, dispatch);
|
|
103
|
-
};
|
|
104
|
-
exports.default = (0, react_redux_1.connect)(null, mapDispatchToProps)(AuthGate);
|
|
105
|
-
//# sourceMappingURL=AuthGate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthGate.js","sourceRoot":"","sources":["../../../../src/components/auth-gate/AuthGate.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+B;AAC/B,2EAAqD;AACrD,mEAAoD;AACpD,+DAA8D;AAC9D,2CAAsC;AACtC,+BAA2C;AAC3C,iDAAiD;AACjD,qDAA2D;AAc3D;IAAuB,4BAAmC;IAGtD,kBAAY,CAAiB;QACzB,YAAA,MAAK,YAAC,CAAC,CAAC,SAAC;QAGN,uBAAiB,GAAG;YACjB,IAAA,KAAsE,KAAI,CAAC,KAAK,EAA9E,aAAa,mBAAA,EAAE,SAAS,eAAA,EAAE,WAAW,iBAAA,EAAE,eAAe,qBAAA,EAAE,OAAO,aAAe,CAAC;YAEvF,eAAW,CAAC,YAAY,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;YAErD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACb,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;gBACpD,eAAW,CAAC,KAAK,EAAE,CAAC;YACxB,CAAC;iBAAM,CAAC;gBACJ,eAAW,CAAC,eAAe,CAAC,SAAS,CAAC;qBACjC,IAAI,CAAC,UAAC,aAAwB;oBAC3B,kDAAkD;oBAClD,IAAM,KAAK,GAAG,iBAAc,CAAC,cAAc,EAAE,IAAI,IAAI,CAAC;oBACtD,IAAM,OAAO,GAAG,iBAAc,CAAC,gBAAgB,EAAE,IAAI,IAAI,CAAC;oBAE1D,iBAAc,CAAC,aAAa,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC;yBACzE,IAAI,CAAC,UAAC,WAAgB;wBACnB,KAAI,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;wBAChC,KAAI,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;wBACtC,iBAAc,CAAC,iBAAiB,CAAC,aAAa,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;wBAChE,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;oBACpC,CAAC,CAAC;yBACD,KAAK,CAAC,UAAC,CAAC;wBACL,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;wBAChE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;wBACjB,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBAChC,CAAC,CAAC,CAAC;gBACX,CAAC,CAAC;qBACD,KAAK,CAAC,UAAC,CAAC;oBACL,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;oBAClE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBACjB,eAAW,CAAC,KAAK,EAAE,CAAC;gBACxB,CAAC,CAAC,CAAC;YACX,CAAC;QACL,CAAC,CAAC;QAEK,YAAM,GAAG;YACZ,OAAO,CACH,6BAAK,SAAS,EAAC,WAAW;gBACtB,oBAAC,qBAAW,IAAC,KAAK,EAAE,QAAQ,CAAC,YAAY,GAAI,CAC3C,CACT,CAAC;QACN,CAAC,CAAC;;IA5CF,CAAC;IAJuB,qBAAY,GAAW,SAAS,AAApB,CAAqB;IAiD7D,eAAC;CAAA,AAlDD,CAAuB,KAAK,CAAC,aAAa,GAkDzC;AAED,IAAM,kBAAkB,GAAG,UAAC,QAAQ;IAChC,OAAO,IAAA,0BAAkB,EACrB;QACI,KAAK,cAAA;QACL,aAAa,wBAAA;KAChB,EACD,QAAQ,CACX,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,IAAA,qBAAO,EAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IIdentity } from '../../services/Auth0';
|
|
2
|
-
export declare const AUTH_CACHE_KEY: string;
|
|
3
|
-
export declare const login: (auth: IIdentity) => any;
|
|
4
|
-
export declare const clearCachedAuth: () => any;
|
|
5
|
-
declare const actions: {
|
|
6
|
-
LOGIN: string;
|
|
7
|
-
CLEAR: string;
|
|
8
|
-
};
|
|
9
|
-
export default actions;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clearCachedAuth = exports.login = exports.AUTH_CACHE_KEY = void 0;
|
|
4
|
-
exports.AUTH_CACHE_KEY = 'imposium_hub_creds';
|
|
5
|
-
var login = function (auth) {
|
|
6
|
-
try {
|
|
7
|
-
localStorage.setItem(exports.AUTH_CACHE_KEY, JSON.stringify(auth));
|
|
8
|
-
}
|
|
9
|
-
catch (e) {
|
|
10
|
-
console.warn('Failed to cache auth creds...');
|
|
11
|
-
}
|
|
12
|
-
return { type: actions.LOGIN, auth: auth };
|
|
13
|
-
};
|
|
14
|
-
exports.login = login;
|
|
15
|
-
var clearCachedAuth = function () {
|
|
16
|
-
try {
|
|
17
|
-
localStorage.removeItem(exports.AUTH_CACHE_KEY);
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
console.warn('Failed to remove cached creds');
|
|
21
|
-
}
|
|
22
|
-
return { type: actions.CLEAR };
|
|
23
|
-
};
|
|
24
|
-
exports.clearCachedAuth = clearCachedAuth;
|
|
25
|
-
var actions = {
|
|
26
|
-
LOGIN: 'auth/LOGIN',
|
|
27
|
-
CLEAR: 'auth/CLEAR'
|
|
28
|
-
};
|
|
29
|
-
exports.default = actions;
|
|
30
|
-
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/redux/actions/auth.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAW,oBAAoB,CAAC;AAEpD,IAAM,KAAK,GAAG,UAAC,IAAe;IACjC,IAAI,CAAC;QACD,YAAY,CAAC,OAAO,CAAC,sBAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,MAAA,EAAE,CAAC;AACzC,CAAC,CAAC;AARW,QAAA,KAAK,SAQhB;AAEK,IAAM,eAAe,GAAG;IAC3B,IAAI,CAAC;QACD,YAAY,CAAC,UAAU,CAAC,sBAAc,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;AACnC,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAEF,IAAM,OAAO,GAAG;IACZ,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,YAAY;CACtB,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|