@contrail/extensions-sdk 1.0.29 → 1.0.31

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.
@@ -20,9 +20,20 @@ export interface ClipboardItemsPayload {
20
20
  }
21
21
  /** One image in a composition, placed in fractions of the output box. */
22
22
  export interface ComposeContentLayer {
23
- /** The content to draw. The host resolves it to an image, so no URL is needed - and none can
24
- * expire between planning the layout and composing it. */
25
- contentId: string;
23
+ /**
24
+ * The content to draw. The host resolves it to an image, so no URL is needed - and none can
25
+ * expire between planning the layout and composing it.
26
+ *
27
+ * Supply this or {@link fileId}, not both.
28
+ */
29
+ contentId?: string;
30
+ /**
31
+ * A file to draw, for images that exist as files without a content wrapper - the output of a
32
+ * background-removal operation, for instance, which returns a file id.
33
+ *
34
+ * Supply this or {@link contentId}, not both.
35
+ */
36
+ fileId?: string;
26
37
  /**
27
38
  * Top-left corner as a fraction of the composition box, so `{x: 0.5, y: 0}` is the top middle.
28
39
  *
@@ -61,6 +72,15 @@ export interface ComposeContentRequest {
61
72
  /** Defaults to transparent, which is usually what a composed pack shot wants. */
62
73
  backgroundColor?: string;
63
74
  fileName?: string;
75
+ /**
76
+ * Also make the composition the holder's primary viewable, so it is the image the entity shows
77
+ * everywhere - grids, cards, choosers.
78
+ *
79
+ * Off by default: composing an image and deciding it is the entity's main picture are separate
80
+ * intentions, and a caller adding one image among several should not silently repoint the item.
81
+ * A newly created set item, by contrast, has no image at all and wants this.
82
+ */
83
+ assignAsPrimaryViewable?: boolean;
64
84
  }
65
85
  export interface ComposeContentResult {
66
86
  contentId: string;
@@ -70,6 +90,8 @@ export interface ComposeContentResult {
70
90
  width: number;
71
91
  height: number;
72
92
  };
93
+ /** Whether the holder was repointed at this content, when it was asked for. */
94
+ assignedAsPrimaryViewable?: boolean;
73
95
  }
74
96
  export interface BoardDocumentElement extends DocumentElement {
75
97
  [key: string]: any;
@@ -124,6 +124,10 @@ class BoardsApp {
124
124
  if (!(request === null || request === void 0 ? void 0 : request.contentHolderReference)) {
125
125
  throw new Error('composeContent requires a contentHolderReference, e.g. `item:<id>`.');
126
126
  }
127
+ const unsourced = request.layers.findIndex((layer) => !(layer === null || layer === void 0 ? void 0 : layer.contentId) && !(layer === null || layer === void 0 ? void 0 : layer.fileId));
128
+ if (unsourced >= 0) {
129
+ throw new Error(`composeContent layer ${unsourced} needs either a contentId or a fileId.`);
130
+ }
127
131
  const results = yield (0, actions_1.getExtensionActions)().sendMessageToHost({
128
132
  command: BoardCommand.COMPOSE_CONTENT,
129
133
  data: request,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/extensions-sdk",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "Client library for interfacing with VibeIQ's services and apps from an extension.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",