@imposium-hub/components 1.40.0 → 1.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.
@@ -0,0 +1,36 @@
1
+ import actions from '../actions/publish';
2
+
3
+ export interface IChanges {
4
+ date_created? : number;
5
+ id? : string;
6
+ job_id? : string;
7
+ message? : string;
8
+ publishing : boolean;
9
+ story_id? : string;
10
+ version ? : number;
11
+ }
12
+
13
+ const initialState : IChanges = {
14
+ publishing: false
15
+ };
16
+
17
+ const publish = (state = initialState, action) : any => {
18
+
19
+ let newState : IChanges;
20
+
21
+ switch (action.type) {
22
+
23
+ case actions.UPDATE_PUBLISH_STATUS:
24
+
25
+ newState = {...state, ...action.data};
26
+ return newState;
27
+
28
+ case actions.CLEAR_PUBLISH_STATUS:
29
+ return initialState;
30
+
31
+ default:
32
+ return state;
33
+ }
34
+ };
35
+
36
+ export default publish;
package/services/API.ts CHANGED
@@ -32,7 +32,7 @@ export interface IImposiumAPI {
32
32
  getExperience(experienceId : string, poll : boolean);
33
33
  blockByExperience(experienceId : string);
34
34
  triggerEvent(experienceId : string, compositionId ? : string, useWorkingCopy ? : boolean);
35
- getBatches(storyId : string);
35
+ getBatches(storyId : string, params ? : any);
36
36
  getBatch(batchId : string, page : number);
37
37
  getBatchProgress(batchId : string);
38
38
  createFreshBatch(storyId : string, batchName : string);
@@ -61,6 +61,8 @@ export interface IImposiumAPI {
61
61
  runReRenderCuts(storyId : string, actId : string, sceneId : string);
62
62
  runProcessBaseVideo(storyId : string, fileKey : string);
63
63
  runPublish(storyId : string, message : string);
64
+ cancelPublish(storyId : string);
65
+ cancelJobPolling();
64
66
  getAccssCredentials();
65
67
  createAccessCredentials(name : string);
66
68
  deleteAccessCrednetials(access_key_id : string);
@@ -496,7 +498,7 @@ export default class API {
496
498
  });
497
499
  }
498
500
 
499
- public getBatches = (storyId : string, params : any) : Promise<any | Error> => {
501
+ public getBatches = (storyId : string, params ? : any) : Promise<any | Error> => {
500
502
  return this.doRequest({
501
503
  method: 'GET',
502
504
  url: `/story/${storyId}/batches`,
@@ -0,0 +1,12 @@
1
+ export const getDemoURL = () : string => {
2
+
3
+ const {location: {href}} = window;
4
+
5
+ if (href.indexOf('localhost') !== -1) {
6
+ return 'http://localhost:3044';
7
+ } else if (href.indexOf('staging') !== -1) {
8
+ return 'https://demo.staging.imposium.com';
9
+ } else {
10
+ return 'https://demo.imposium.com';
11
+ }
12
+ };
@@ -0,0 +1,32 @@
1
+ import axios, { AxiosRequestConfig } from 'axios';
2
+ import { saveAs } from 'file-saver';
3
+
4
+ export interface ISDKArchiveBody {
5
+ storyId : string;
6
+ compositionId : string;
7
+ accessToken : string;
8
+ storyName : string;
9
+ inventory : any;
10
+ }
11
+
12
+ const DEFAULT_GENERATOR_REQ_CONFIG : any = {
13
+ method: 'POST',
14
+ responseType: 'blob',
15
+ headers: {'Content-Type': 'application/json'}
16
+ };
17
+
18
+ export const downloadSDKArchive = (archiveName : string, config : ISDKArchiveBody) : void => {
19
+ const request : AxiosRequestConfig = {
20
+ ...DEFAULT_GENERATOR_REQ_CONFIG,
21
+ url: 'https://template-generator.imposium.com/sdk-archive',
22
+ data: JSON.stringify(config)
23
+ };
24
+
25
+ axios(request)
26
+ .then((res) => {
27
+ saveAs(res.data, archiveName);
28
+ })
29
+ .catch((e) => {
30
+ console.error('Failed to download sdk archive:', e);
31
+ });
32
+ };