@imposium-hub/components 1.31.1 → 1.32.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imposium-hub/components",
3
- "version": "1.31.1",
3
+ "version": "1.32.0",
4
4
  "description": "React & Typescript component / asset library for Imposium front-ends",
5
5
  "main": "dist/components.js",
6
6
  "scripts": {
@@ -46,6 +46,7 @@
46
46
  "imposium-js-sdk": "^2.3.1",
47
47
  "js-cookie": "^2.2.1",
48
48
  "react-color": "^2.18.0",
49
+ "react-merge-refs": "^1.1.0",
49
50
  "react-moveable": "^0.26.1",
50
51
  "react-table": "^7.0.4",
51
52
  "react-tooltip": "^3.11.1",
@@ -9,7 +9,7 @@ const selectedAssets = (state = initialState, action) : string[] => {
9
9
  case selectedAssetsActions.SELECT_ASSET:
10
10
  return [...state, action.id];
11
11
  case selectedAssetsActions.SELECT_MULTIPLE:
12
- return [...state, ...action.assets];
12
+ return [...new Set([...state, ...action.assets])];
13
13
  case selectedAssetsActions.DESELECT_ASSET:
14
14
  return state.filter((id : string) => (id !== action.id));
15
15
  case selectedAssetsActions.RESET_SELECTION:
package/services/API.ts CHANGED
@@ -14,6 +14,7 @@ export interface IImposiumAPI {
14
14
  deleteAssetTag(assetId : string, tag : string);
15
15
  updateAsset(assetId : string, data : any);
16
16
  getAssetTags(storyId : string);
17
+ duplicateAsset(assetId : string, assetName : string);
17
18
  getStory(storyId : string);
18
19
  saveStory(storyId, story : any);
19
20
  newStory(story : any);
@@ -286,6 +287,16 @@ export default class API {
286
287
  });
287
288
  }
288
289
 
290
+ public duplicateAsset = (assetId : string, assetName : string) : Promise<any | Error> => {
291
+ return this.doRequest({
292
+ method: 'POST',
293
+ url: `/assets/${assetId}/copy`,
294
+ data: {
295
+ name: assetName
296
+ }
297
+ });
298
+ }
299
+
289
300
  public uploadAsset = (storyId : string, tags : string, file : File, onUploadProgress : (e : any) => void) : Promise<any | Error> => {
290
301
  const formData = new FormData();
291
302