@omni-co/embed 0.4.9 → 0.4.10

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/README.md CHANGED
@@ -24,10 +24,14 @@ yarn:
24
24
  yarn add @omni-co/embed
25
25
  ```
26
26
 
27
- ## Basic Example
27
+ ## Basic Examples
28
28
 
29
29
  ```ts
30
- import { embedSsoDashboard, embedSsoWorkbook } from "@omni-co/embed";
30
+ import {
31
+ embedSsoDashboard,
32
+ embedSsoWorkbook,
33
+ embedSsoContentDiscovery,
34
+ } from "@omni-co/embed";
31
35
 
32
36
  // This creates a signed embed sso link for a dashboard
33
37
  // in the omni account named Acme.
@@ -39,7 +43,7 @@ const iframeUrl = await embedSsoDashboard({
39
43
  secret: "abcdefghijklmnopqrstuvwxyz123456",
40
44
  });
41
45
 
42
- // Alternatively you can create a signed embed sso link for a workbook
46
+ // Alternatively, you can create a signed embed sso link for a workbook.
43
47
  const iframeUrl = await embedSsoWorkbook({
44
48
  contentId: "miU0hL6z",
45
49
  externalId: "wile.e@coyote.co",
@@ -47,39 +51,28 @@ const iframeUrl = await embedSsoWorkbook({
47
51
  organizationName: "acme",
48
52
  secret: "abcdefghijklmnopqrstuvwxyz123456",
49
53
  });
50
- ```
51
-
52
- ## Using Vanity Domains
53
54
 
54
- ```ts
55
- // Use `host` to create a link to a vanity domain.
56
- // Note: `organizationName` and `domain` are incompatible with `host`
57
- const iframeUrl = await embedSsoDashboard({
58
- contentId: "miU0hL6z",
55
+ // You can also create a signed embed sso link for a content discovery page.
56
+ const iframeUrl = await embedSsoContentDiscovery({
59
57
  externalId: "wile.e@coyote.co",
60
- host: "omni.example.com",
61
58
  name: "Wile E",
59
+ path: "root",
60
+ organizationName: "acme",
62
61
  secret: "abcdefghijklmnopqrstuvwxyz123456",
63
62
  });
64
63
  ```
65
64
 
66
- ## Kitchen Sink Example
65
+ ## Using Vanity Domains
67
66
 
68
67
  ```ts
69
- import { embedSsoDashboard, embedSsoWorkbook } from "@omni-co/embed";
70
-
71
- // This creates a signed embed sso link for a dashboard
72
- // in the omni account named Acme.
68
+ // Use `host` to create a link to a vanity domain.
69
+ // Note: `organizationName` and `domain` are incompatible with `host`
73
70
  const iframeUrl = await embedSsoDashboard({
74
71
  contentId: "miU0hL6z",
75
72
  externalId: "wile.e@coyote.co",
76
- entity: "cartoon",
73
+ host: "omni.example.com",
77
74
  name: "Wile E",
78
- organizationName: "acme",
79
75
  secret: "abcdefghijklmnopqrstuvwxyz123456",
80
- prefersDark: "system",
81
- theme: "vibes",
82
- userAttributes: { tool: "anvil" },
83
76
  });
84
77
  ```
85
78
 
@@ -88,25 +81,59 @@ const iframeUrl = await embedSsoDashboard({
88
81
  This is the type signature for the `embedSsoDashboard` function:
89
82
 
90
83
  ```ts
91
- type EmbedSsoProps = {
84
+ type EmbedSsoDashboardProps = {
85
+ // Optional boolean property that toggles the dashboard's Access Boost setting.
86
+ accessBoost?: boolean;
87
+
88
+ // Optional object that determines the connection permissions for the embed user.
89
+ connectionRoles?: Record<string, EmbedConnectionRoles>;
90
+
92
91
  // Short GUID of the dashboard. Can be obtained via the dashboard's url.
93
92
  contentId: string;
94
93
 
95
- // Optional custom theme property that styles the embedded dashboard.
94
+ // Optional custom theme object that styles the embedded dashboard.
96
95
  customTheme?: CustomThemeProperties;
97
96
 
98
- // Optional identifier to associate the user with an external
99
- // organization or system.
97
+ /**
98
+ * Optional custom theme ID setting that styles the embedded dashboard.
99
+ * This ID should be from a theme created within the Omni application.
100
+ */
101
+ customThemeId?: string;
102
+
103
+ // Optional email parameter that sets the default scheduling email for the embed user.
104
+ email?: string;
105
+
106
+ /**
107
+ * Optional identifier to associate the user with an external organization or system.
108
+ * Note that each distinct entity will generate its own folder and group. These can be used by
109
+ * an embed user to share content with other members in the same entity.
110
+ */
100
111
  entity?: string;
101
112
 
102
- // Required identifier to associate the external user with an
103
- // automatically generated internal Omni user.
113
+ /**
114
+ * Optional content role setting for the entity folder. Can be one of "MANAGER", "EDITOR", or "VIEWER".
115
+ *
116
+ * MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
117
+ * EDITOR: the user will have the ability to manage content in the entity folder.
118
+ * VIEWER: the user will only be able to view content in the entity folder.
119
+ */
120
+ entityFolderContentRole?: EmbedEntityFolderContentRoles;
121
+
122
+ // Required identifier to associate the external user with an automatically generated internal Omni user.
104
123
  externalId: string;
105
124
 
106
- // Optional url filter search parameter. Should be the same as the filter search parameters on a dashboard url.
107
- // Example: f--inventory_items.cost=%7B"kind"%3A"EQUALS"%2C"type"%3A"number"%2C"values"%3A%5B%5D%2C"is_negative"%3Afalse%2C"is_inclusive"%3Afalse%7D&f--users.state=%7B"kind"%3A"EQUALS"%2C"type"%3A"string"%2C"values"%3A%5B"Aberdeen"%2C"Alabama"%5D%2C"is_negative"%3Afalse%7D&f--users.country=%7B"kind"%3A"EQUALS"%2C"type"%3A"string"%2C"values"%3A%5B"UK"%5D%2C"is_negative"%3Afalse%7D
125
+ /**
126
+ * Optional url filter search parameter. Should be the same as the filter search parameters on a dashboard url.
127
+ * Example: f--inventory_items.cost=%7B"kind"%3A"EQUALS"%2C"type"%3A"number"%2C"values"%3A%5B%5D%2C"is_negative"%3Afalse%2C"is_inclusive"%3Afalse%7D&f--users.state=%7B"kind"%3A"EQUALS"%2C"type"%3A"string"%2C"values"%3A%5B"Aberdeen"%2C"Alabama"%5D%2C"is_negative"%3Afalse%7D&f--users.country=%7B"kind"%3A"EQUALS"%2C"type"%3A"string"%2C"values"%3A%5B"UK"%5D%2C"is_negative"%3Afalse%7D
128
+ *
129
+ */
108
130
  filterSearchParam?: string;
109
131
 
132
+ /*
133
+ * Optional groups array property. The array should be a list of group names from the Omni application, which the embed user will be added to.
134
+ */
135
+ groups?: string[];
136
+
110
137
  /**
111
138
  * Used to set the host of signed embed URL, required when using vanity domains.
112
139
  * Protocol is not required, as https is assumed.
@@ -118,13 +145,24 @@ type EmbedSsoProps = {
118
145
  */
119
146
  host?: string;
120
147
 
121
- // Optional link access setting to control which Omni dashboard links are shown. Note that regardless of the linkAccess value,
122
- // all non-Omni dashboard links will be shown and allowed in drill menus. Acceptable values include:
123
- // "__omni_link_access_open": Special string keyword that permisses and shows all Omni dashboard links on the embedded dashboard.
124
- // "abcd1234,efgh5678,ijkl9999": An allowlist of dashboard IDs that permisses and shows links to the specified dashboards.
125
- // undefined: If left undefined, the default behavior is to hide and disallow all links to other Omni dashboards on the embedded dashboard.
148
+ /**
149
+ * Optional link access setting to control which Omni dashboard links are shown. Note that regardless of the linkAccess value,
150
+ * all non-Omni dashboard links will be shown and allowed in drill menus. Acceptable values include:
151
+ *
152
+ * "__omni_link_access_open": Special string keyword that permisses and shows all Omni dashboard links on the embedded dashboard.
153
+ * "abcd1234,efgh5678,ijkl9999": An allowlist of dashboard IDs that permisses and shows links to the specified dashboards.
154
+ * undefined: If left undefined, the default behavior is to hide and disallow all links to other Omni dashboards on the embedded dashboard.
155
+ */
126
156
  linkAccess?: string;
127
157
 
158
+ /**
159
+ * Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
160
+ *
161
+ * APPLICATION: the entire application will be embedded, meaning in-app navigation and document header options will be available.
162
+ * SINGLE_CONTENT: only the content specified in the contentId will be embedded and application mode features will be hidden.
163
+ */
164
+ mode?: EmbedSessionMode;
165
+
128
166
  // Required name of the external user.
129
167
  name: string;
130
168
 
@@ -136,7 +174,7 @@ type EmbedSsoProps = {
136
174
  */
137
175
  organizationName?: string;
138
176
 
139
- // Port of host
177
+ // Port of host.
140
178
  port?: number;
141
179
 
142
180
  // Optional dark mode setting. Can be one of "true", "false", or "system".
@@ -145,14 +183,16 @@ type EmbedSsoProps = {
145
183
  // Signing secret available to Omni admins.
146
184
  secret: string;
147
185
 
148
- // Optional user attributes to be passed to user associated with the
149
- // externalId. User attributes must be created in Omni before being
150
- // defined and given a value here.
151
- userAttributes?: Record<string, string | string[] | number | number[]>;
152
-
153
186
  // Optional theme setting. Can be one of "dawn", "vibes", "breeze" or "blank".
154
187
  theme?: string;
155
188
 
189
+ /**
190
+ * Optional user attributes to be passed to user associated with the
191
+ * externalId. User attributes must be created in Omni before being
192
+ * defined and given a value here.
193
+ */
194
+ userAttributes?: Record<string, string | string[] | number | number[]>;
195
+
156
196
  // DEPRECATED
157
197
 
158
198
  /**
@@ -170,18 +210,58 @@ type EmbedSsoProps = {
170
210
  This is the type signature for the `embedSsoWorkbook` function:
171
211
 
172
212
  ```ts
173
- type EmbedSsoProps = {
174
- // Short GUID of the workbook. Can be obtained via the workbook's share -> embed -> iframe url or via the dashboard url (will embed the workbook associated with the dashboard id)
213
+ type EmbedSsoWorkbookProps = {
214
+ // Optional object that determines the connection permissions for the embed user.
215
+ connectionRoles?: Record<string, EmbedConnectionRoles>;
216
+
217
+ /**
218
+ * Short GUID of the workbook.
219
+ *
220
+ * Can be obtained via the workbook's share -> embed -> iframe url or via the dashboard url.
221
+ * This will embed the workbook associated with the dashboard id.
222
+ */
175
223
  contentId: string;
176
224
 
177
- // Optional identifier to associate the user with an external
178
- // organization or system.
225
+ /**
226
+ * Optional custom theme object. Note that this theme will only apply to dashboards viewed
227
+ * during the generated embed session.
228
+ */
229
+ customTheme?: CustomThemeProperties;
230
+
231
+ /**
232
+ * Optional custom theme ID setting. Note that this theme will only apply to dashboards viewed
233
+ * during the generated embed session.
234
+ */
235
+ customThemeId?: string;
236
+
237
+ // Optional email parameter that sets the default scheduling email for the embed user.
238
+ email?: string;
239
+
240
+ /**
241
+ * Optional identifier to associate the user with an external organization or system.
242
+ * Note that each distinct entity will generate its own folder and group. These can be used by
243
+ * an embed user to share content with other members in the same entity.
244
+ */
179
245
  entity?: string;
180
246
 
247
+ /**
248
+ * Optional content role setting for the entity folder. Can be one of "MANAGER", "EDITOR", or "VIEWER".
249
+ *
250
+ * MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
251
+ * EDITOR: the user will have the ability to manage content in the entity folder.
252
+ * VIEWER: the user will only be able to view content in the entity folder.
253
+ */
254
+ entityFolderContentRole?: EmbedEntityFolderContentRoles;
255
+
181
256
  // Required identifier to associate the external user with an
182
257
  // automatically generated internal Omni user.
183
258
  externalId: string;
184
259
 
260
+ /*
261
+ * Optional groups array property. The array should be a list of group names from the Omni application, which the embed user will be added to.
262
+ */
263
+ groups?: string[];
264
+
185
265
  /**
186
266
  * Used to set the host of signed embed URL, required when using vanity domains.
187
267
  * Protocol is not required, as https is assumed.
@@ -193,6 +273,14 @@ type EmbedSsoProps = {
193
273
  */
194
274
  host?: string;
195
275
 
276
+ /**
277
+ * Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
278
+ *
279
+ * APPLICATION: the entire application will be embedded, meaning in-app navigation and document header options will be available.
280
+ * SINGLE_CONTENT: only the content specified in the contentId will be embedded and application mode features will be hidden.
281
+ */
282
+ mode?: EmbedSessionMode;
283
+
196
284
  // Required name of the external user.
197
285
  name: string;
198
286
 
@@ -204,7 +292,7 @@ type EmbedSsoProps = {
204
292
  */
205
293
  organizationName?: string;
206
294
 
207
- // Port of host
295
+ // Port of host.
208
296
  port?: number;
209
297
 
210
298
  // Optional dark mode setting. Can be one of "true", "false", or "system".
@@ -213,14 +301,136 @@ type EmbedSsoProps = {
213
301
  // Signing secret available to Omni admins.
214
302
  secret: string;
215
303
 
216
- // Optional user attributes to be passed to user associated with the
217
- // externalId. User attributes must be created in Omni before being
218
- // defined and given a value here.
304
+ // Optional theme setting. Can be one of "dawn", "vibes", "breeze" or "blank".
305
+ theme?: string;
306
+
307
+ /**
308
+ * Optional user attributes to be passed to user associated with the
309
+ * externalId. User attributes must be created in Omni before being
310
+ * defined and given a value here.
311
+ */
219
312
  userAttributes?: Record<string, string | string[] | number | number[]>;
220
313
 
314
+ // DEPRECATED
315
+
316
+ /**
317
+ * @deprecated Introduced for internal testing only. For vanity domains, use the `host`
318
+ * prop instead. Will be dropped in a v1.0.0 release.
319
+ *
320
+ * @throws Error if `host` is provided.
321
+ */
322
+ domain?: string;
323
+ };
324
+ ```
325
+
326
+ ## embedSsoContentDiscovery
327
+
328
+ This is the type signature for the `embedSsoContentDiscovery` function:
329
+
330
+ ```ts
331
+ type EmbedSsoContentDiscoveryProps = {
332
+ // Optional object that determines the connection permissions for the embed user.
333
+ connectionRoles?: Record<string, EmbedConnectionRoles>;
334
+
335
+ /**
336
+ * Optional custom theme object. Note that this theme will only apply to dashboards viewed
337
+ * during the generated embed session.
338
+ */
339
+ customTheme?: CustomThemeProperties;
340
+
341
+ /**
342
+ * Optional custom theme ID setting. Note that this theme will only apply to dashboards viewed
343
+ * during the generated embed session.
344
+ */
345
+ customThemeId?: string;
346
+
347
+ // Optional email parameter that sets the default scheduling email for the embed user.
348
+ email?: string;
349
+
350
+ /**
351
+ * Optional identifier to associate the user with an external organization or system.
352
+ * Note that each distinct entity will generate its own folder and group. These can be used by
353
+ * an embed user to share content with other members in the same entity.
354
+ */
355
+ entity?: string;
356
+
357
+ /**
358
+ * Optional content role setting for the entity folder. Can be one of "MANAGER", "EDITOR", or "VIEWER".
359
+ *
360
+ * MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
361
+ * EDITOR: the user will have the ability to manage content in the entity folder.
362
+ * VIEWER: the user will only be able to view content in the entity folder.
363
+ */
364
+ entityFolderContentRole?: EmbedEntityFolderContentRoles;
365
+
366
+ // Required identifier to associate the external user with an
367
+ // automatically generated internal Omni user.
368
+ externalId: string;
369
+
370
+ /*
371
+ * Optional groups array property. The array should be a list of group names from the Omni application, which the embed user will be added to.
372
+ */
373
+ groups?: string[];
374
+
375
+ /**
376
+ * Used to set the host of signed embed URL, required when using vanity domains.
377
+ * Protocol is not required, as https is assumed.
378
+ * Port is not accepted. If required, use the `port` prop.
379
+ *
380
+ * @throws Error if `domain` or `organizationName` are provided.
381
+ * @example "omni.example.com"
382
+ * @example "omni.another-example.app"
383
+ */
384
+ host?: string;
385
+
386
+ /**
387
+ * Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
388
+ *
389
+ * APPLICATION: the entire application will be embedded, meaning in-app navigation and document header options will be available.
390
+ * SINGLE_CONTENT: only the content specified in the contentId will be embedded and application mode features will be hidden.
391
+ */
392
+ mode?: EmbedSessionMode;
393
+
394
+ // Required name of the external user.
395
+ name: string;
396
+
397
+ /**
398
+ * Name of the organization the content belongs to. If provided, generates a default embed host
399
+ * URL in the form of `https://<organizationName>.embed-omniapp.co`.
400
+ *
401
+ * @throws Error if `host` is provided.
402
+ */
403
+ organizationName?: string;
404
+
405
+ /**
406
+ * Required path property. The path value determines the starting content discovery page
407
+ * for the generated embed session. Can be one of "my", "entity-folder", or "root".
408
+ *
409
+ * my: "My Content" page
410
+ * entity-folder: embed entity folder
411
+ * root: "Hub" page
412
+ */
413
+ path: EmbedSsoContentDiscoveryPath;
414
+
415
+ // Port of host.
416
+ port?: number;
417
+
418
+ // Optional dark mode setting. Can be one of "true", "false", or "system".
419
+ prefersDark?: string;
420
+
421
+ // Signing secret available to Omni admins.
422
+ secret: string;
423
+
221
424
  // Optional theme setting. Can be one of "dawn", "vibes", "breeze" or "blank".
222
425
  theme?: string;
223
426
 
427
+ /**
428
+ * Optional user attributes to be passed to user associated with the
429
+ * externalId. User attributes must be created in Omni before being
430
+ * defined and given a value here.
431
+ */
432
+ userAttributes?: Record<string, string | string[] | number | number[]>;
433
+
224
434
  // DEPRECATED
225
435
 
226
436
  /**
@@ -15,19 +15,22 @@ type EmbedSsoBaseProps = {
15
15
  customThemeId?: string;
16
16
  /**
17
17
  * Optional connection roles setting. Object keys should be connection IDs from the embedded Omni instance.
18
- * Object values should be connection roles. At the moment, the only valid role string is "RESTRICTED_QUERIER".
18
+ * Object values should be connection roles.
19
19
  */
20
20
  connectionRoles?: Record<string, EmbedConnectionRoles>;
21
21
  /**
22
22
  * Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
23
- * If EmbedSessionMode.Application is selected, the entire application will be embedded. If EmbedSessionMode.SingleContent is selected,
24
- * only the content specified in the contentId will be embedded.
23
+ *
24
+ * APPLICATION: the entire application will be embedded, meaning in-app navigation and document header options will be available.
25
+ * SINGLE_CONTENT: only the content specified in the contentId will be embedded and application mode features will be hidden.
25
26
  */
26
27
  mode?: EmbedSessionMode;
27
28
  /**
28
- * Optional content role setting. Can be one of "EDITOR" or "VIEWER". If set to "EDITOR", the user will have the ability to manage
29
- * content in their associated embed entity folder. If set to "VIEWER", the user will only be able to view content in
30
- * their associated embed entity folder.
29
+ * Optional content role setting. Can be one of "MANAGER", "EDITOR", or "VIEWER".
30
+ *
31
+ * MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
32
+ * EDITOR: the user will have the ability to manage content in the entity folder.
33
+ * VIEWER: the user will only be able to view content in the entity folder.
31
34
  */
32
35
  entityFolderContentRole?: EmbedEntityFolderContentRoles;
33
36
  /**
@@ -209,7 +212,7 @@ export type EmbedSsoWorkbookProps = EmbedSsoBaseProps & EmbedContentIdProp;
209
212
  export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
210
213
  /**
211
214
  * Required connection roles object. Object keys should be connection IDs from the embedded Omni instance.
212
- * Object values should be connection roles. At the moment, the only valid role string is "RESTRICTED_QUERIER".
215
+ * Object values should be connection roles.
213
216
  */
214
217
  connectionRoles: Record<string, EmbedConnectionRoles>;
215
218
  /**
@@ -15,19 +15,22 @@ type EmbedSsoBaseProps = {
15
15
  customThemeId?: string;
16
16
  /**
17
17
  * Optional connection roles setting. Object keys should be connection IDs from the embedded Omni instance.
18
- * Object values should be connection roles. At the moment, the only valid role string is "RESTRICTED_QUERIER".
18
+ * Object values should be connection roles.
19
19
  */
20
20
  connectionRoles?: Record<string, EmbedConnectionRoles>;
21
21
  /**
22
22
  * Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
23
- * If EmbedSessionMode.Application is selected, the entire application will be embedded. If EmbedSessionMode.SingleContent is selected,
24
- * only the content specified in the contentId will be embedded.
23
+ *
24
+ * APPLICATION: the entire application will be embedded, meaning in-app navigation and document header options will be available.
25
+ * SINGLE_CONTENT: only the content specified in the contentId will be embedded and application mode features will be hidden.
25
26
  */
26
27
  mode?: EmbedSessionMode;
27
28
  /**
28
- * Optional content role setting. Can be one of "EDITOR" or "VIEWER". If set to "EDITOR", the user will have the ability to manage
29
- * content in their associated embed entity folder. If set to "VIEWER", the user will only be able to view content in
30
- * their associated embed entity folder.
29
+ * Optional content role setting. Can be one of "MANAGER", "EDITOR", or "VIEWER".
30
+ *
31
+ * MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
32
+ * EDITOR: the user will have the ability to manage content in the entity folder.
33
+ * VIEWER: the user will only be able to view content in the entity folder.
31
34
  */
32
35
  entityFolderContentRole?: EmbedEntityFolderContentRoles;
33
36
  /**
@@ -209,7 +212,7 @@ export type EmbedSsoWorkbookProps = EmbedSsoBaseProps & EmbedContentIdProp;
209
212
  export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
210
213
  /**
211
214
  * Required connection roles object. Object keys should be connection IDs from the embedded Omni instance.
212
- * Object values should be connection roles. At the moment, the only valid role string is "RESTRICTED_QUERIER".
215
+ * Object values should be connection roles.
213
216
  */
214
217
  connectionRoles: Record<string, EmbedConnectionRoles>;
215
218
  /**
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.4.9",
2
+ "version": "0.4.10",
3
3
  "license": "MIT",
4
4
  "name": "@omni-co/embed",
5
5
  "author": "Nate Agrin <nate@exploreomni.com>",