@imposium-hub/components 1.43.2 → 1.43.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imposium-hub/components",
3
- "version": "1.43.2",
3
+ "version": "1.43.3",
4
4
  "description": "React & Typescript component / asset library for Imposium front-ends",
5
5
  "main": "dist/components.js",
6
6
  "scripts": {
@@ -49,21 +49,25 @@ export const getBatch = (api : IImposiumAPI) : any => {
49
49
  dispatch({type: batchActions.SET_BATCH, batch});
50
50
 
51
51
  const doResolve = () => {
52
-
53
- const { acts } = story;
54
- const actsKeys : string[] = Object.keys(acts);
55
- let inventory : any = {};
56
-
57
- actsKeys.forEach((actKey : string) => {
58
- inventory = {...inventory, ...acts[actKey].inventory};
59
- });
60
-
52
+ const acts = (story.data) ? story.data.acts : story.acts;
53
+ const inventory : any = parseInventory(acts);
54
+ const EGC : any[] = parseEGCOptions(acts);
61
55
  const UGC : any[] = Object.keys(inventory).map((key : string) => ({
62
56
  label: inventory[key].name,
63
57
  value: inventory[key].id
64
58
  }));
65
59
 
66
- dispatch({type: batchActions.REPLACE_ASSOCIATION_OPTIONS, associationOptions: UGC});
60
+ UGC.push({
61
+ label: 'composition_id',
62
+ value: 'composition_id'
63
+ });
64
+
65
+ UGC.push({
66
+ label: 'composition_tag',
67
+ value: 'composition_tag'
68
+ });
69
+
70
+ dispatch({type: batchActions.REPLACE_ASSOCIATION_OPTIONS, associationOptions: {UGC, EGC} });
67
71
  dispatch({type: batchActions.TOGGlE_LOADING, toggle: false});
68
72
  };
69
73
 
@@ -107,4 +111,97 @@ const onSyncError = (api : IImposiumAPI, e : Error) : any => {
107
111
  };
108
112
  };
109
113
 
114
+ const parseInventory = (acts : any) : any => {
115
+
116
+ const actsKeys : string[] = Object.keys(acts);
117
+ let inventory : any = {};
118
+
119
+ actsKeys.forEach((actKey : string) => {
120
+ inventory = {...inventory, ...acts[actKey].inventory};
121
+ });
122
+
123
+ return inventory;
124
+ };
125
+
126
+ const parseEGCOptions = (acts : any) : any[] => {
127
+ const EGCOptions : any[] = [];
128
+ const duplicateFormatKeys : string[] = [];
129
+ const actsKeys : string[] = Object.keys(acts);
130
+ const firstAct : any = acts[actsKeys[0]];
131
+
132
+ let sceneKeys : string[];
133
+ let firstVideoScene : any;
134
+
135
+ if (typeof firstAct === 'undefined') {
136
+ return [];
137
+ }
138
+
139
+ sceneKeys = Object.keys(firstAct.scenes);
140
+ firstVideoScene = firstAct.scenes[sceneKeys[0]];
141
+
142
+ if (typeof firstVideoScene === 'undefined') {
143
+ return [];
144
+ }
145
+
146
+ EGCOptions.push(
147
+ {
148
+ label: 'Experience Id',
149
+ value: 'id'
150
+ },
151
+ {
152
+ label: 'Story Id',
153
+ value: 'story_id'
154
+ }
155
+ );
156
+
157
+ firstVideoScene.sceneData.encodingSettings.forEach((encodingSetting : any) => {
158
+ if (encodingSetting.extension && encodingSetting.height) {
159
+ const formatName : string = encodingSetting.name;
160
+ const formatKey : string = `${encodingSetting.extension}_${encodingSetting.height}`;
161
+
162
+ if (typeof duplicateFormatKeys[formatKey] === 'undefined') {
163
+ duplicateFormatKeys[formatKey] = 0;
164
+ }
165
+ duplicateFormatKeys[formatKey]++;
166
+
167
+ EGCOptions.push({
168
+ label: formatName,
169
+ value: (duplicateFormatKeys[formatKey] === 1)
170
+ ? `video_url_${formatKey}`
171
+ : `video_url_${formatKey}_${duplicateFormatKeys[formatKey].toString()}`
172
+ });
173
+ }
174
+ });
175
+
176
+ if (firstVideoScene.exportAsPlaylist) {
177
+ EGCOptions.push({
178
+ label: 'M3U8',
179
+ value: 'video_url_m3u8'
180
+ });
181
+ }
182
+
183
+ if (firstVideoScene.sceneData.savePosterFrame) {
184
+ EGCOptions.push({
185
+ label: 'Poster Frame',
186
+ value: 'poster'
187
+ });
188
+ }
189
+
190
+ if (firstVideoScene.sceneData.saveSnapshotFrame) {
191
+ EGCOptions.push({
192
+ label: 'Snapshot Frame',
193
+ value: 'snapshot'
194
+ });
195
+ }
196
+
197
+ if (firstVideoScene.sceneData.saveSocialFrame) {
198
+ EGCOptions.push({
199
+ label: 'Social Frame',
200
+ value: 'social'
201
+ });
202
+ }
203
+
204
+ return EGCOptions;
205
+ };
206
+
110
207
  export default batchActions;