@omni-co/embed 0.12.0 → 0.13.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/README.md CHANGED
@@ -143,14 +143,29 @@ type EmbedSsoDashboardProps = {
143
143
  entity?: string;
144
144
 
145
145
  /**
146
- * Optional content role setting for the entity folder. Can be one of "MANAGER", "EDITOR", or "VIEWER".
146
+ * Sets embed user content permission on the entity folder. Can be one of "MANAGER", "EDITOR", "VIEWER",
147
+ * or "NO_ACCESS".
147
148
  *
148
149
  * MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
149
150
  * EDITOR: the user will have the ability to manage content in the entity folder.
150
151
  * VIEWER: the user will only be able to view content in the entity folder.
152
+ * NO_ACCESS: the user will have no access to content in the top-level entity folder. Note that the
153
+ * entityFolderGroupContentRole should also be set to NO_ACCESS in order to completely restrict access
154
+ * to the top-level entity folder.
151
155
  */
152
156
  entityFolderContentRole?: EmbedEntityFolderContentRoles;
153
157
 
158
+ /**
159
+ * Sets embed entity group content permission on the entity folder. Can be one of "MANAGER", "EDITOR", "VIEWER",
160
+ * or "NO_ACCESS".
161
+ *
162
+ * MANAGER: all users in the group will have the ability to manage content and content permissions of the entity folder.
163
+ * EDITOR: all users in the group have the ability to manage content in the entity folder.
164
+ * VIEWER: all users in the group are restricted to just view content in the entity folder.
165
+ * NO_ACCESS: all users in the group will have no access to content in the top-level entity folder.
166
+ */
167
+ entityFolderGroupContentRole?: EmbedEntityFolderContentRoles;
168
+
154
169
  // Required identifier to associate the external user with an automatically generated internal Omni user.
155
170
  externalId: string;
156
171
 
@@ -212,6 +227,13 @@ type EmbedSsoDashboardProps = {
212
227
  // Optional dark mode setting. Can be one of "true", "false", or "system".
213
228
  prefersDark?: string;
214
229
 
230
+ /**
231
+ * When true, an existing content role for the embed user on the entity folder will not be overwritten
232
+ * by the `entityFolderContentRole` value. If a content role does not exist on the entity folder for the embed user,
233
+ * the `entityFolderContentRole` value will be applied.
234
+ */
235
+ preserveEntityFolderContentRole?: boolean;
236
+
215
237
  // Signing secret available to Omni admins.
216
238
  secret: string;
217
239
 
@@ -280,14 +302,29 @@ type EmbedSsoWorkbookProps = {
280
302
  entity?: string;
281
303
 
282
304
  /**
283
- * Optional content role setting for the entity folder. Can be one of "MANAGER", "EDITOR", or "VIEWER".
305
+ * Sets embed user content permission on the entity folder. Can be one of "MANAGER", "EDITOR", "VIEWER",
306
+ * or "NO_ACCESS".
284
307
  *
285
308
  * MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
286
309
  * EDITOR: the user will have the ability to manage content in the entity folder.
287
310
  * VIEWER: the user will only be able to view content in the entity folder.
311
+ * NO_ACCESS: the user will have no access to content in the top-level entity folder. Note that the
312
+ * entityFolderGroupContentRole should also be set to NO_ACCESS in order to completely restrict access
313
+ * to the top-level entity folder.
288
314
  */
289
315
  entityFolderContentRole?: EmbedEntityFolderContentRoles;
290
316
 
317
+ /**
318
+ * Sets embed entity group content permission on the entity folder. Can be one of "MANAGER", "EDITOR", "VIEWER",
319
+ * or "NO_ACCESS".
320
+ *
321
+ * MANAGER: all users in the group will have the ability to manage content and content permissions of the entity folder.
322
+ * EDITOR: all users in the group have the ability to manage content in the entity folder.
323
+ * VIEWER: all users in the group are restricted to just view content in the entity folder.
324
+ * NO_ACCESS: all users in the group will have no access to content in the top-level entity folder.
325
+ */
326
+ entityFolderGroupContentRole?: EmbedEntityFolderContentRoles;
327
+
291
328
  // Required identifier to associate the external user with an
292
329
  // automatically generated internal Omni user.
293
330
  externalId: string;
@@ -333,6 +370,13 @@ type EmbedSsoWorkbookProps = {
333
370
  // Optional dark mode setting. Can be one of "true", "false", or "system".
334
371
  prefersDark?: string;
335
372
 
373
+ /**
374
+ * When true, an existing content role for the embed user on the entity folder will not be overwritten
375
+ * by the `entityFolderContentRole` value. If a content role does not exist on the entity folder for the embed user,
376
+ * the `entityFolderContentRole` value will be applied.
377
+ */
378
+ preserveEntityFolderContentRole?: boolean;
379
+
336
380
  // Signing secret available to Omni admins.
337
381
  secret: string;
338
382
 
@@ -393,14 +437,29 @@ type EmbedSsoContentDiscoveryProps = {
393
437
  entity?: string;
394
438
 
395
439
  /**
396
- * Optional content role setting for the entity folder. Can be one of "MANAGER", "EDITOR", or "VIEWER".
440
+ * Sets embed user content permission on the entity folder. Can be one of "MANAGER", "EDITOR", "VIEWER",
441
+ * or "NO_ACCESS".
397
442
  *
398
443
  * MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
399
444
  * EDITOR: the user will have the ability to manage content in the entity folder.
400
445
  * VIEWER: the user will only be able to view content in the entity folder.
446
+ * NO_ACCESS: the user will have no access to content in the top-level entity folder. Note that the
447
+ * entityFolderGroupContentRole should also be set to NO_ACCESS in order to completely restrict access
448
+ * to the top-level entity folder.
401
449
  */
402
450
  entityFolderContentRole?: EmbedEntityFolderContentRoles;
403
451
 
452
+ /**
453
+ * Sets embed entity group content permission on the entity folder. Can be one of "MANAGER", "EDITOR", "VIEWER",
454
+ * or "NO_ACCESS".
455
+ *
456
+ * MANAGER: all users in the group will have the ability to manage content and content permissions of the entity folder.
457
+ * EDITOR: all users in the group have the ability to manage content in the entity folder.
458
+ * VIEWER: all users in the group are restricted to just view content in the entity folder.
459
+ * NO_ACCESS: all users in the group will have no access to content in the top-level entity folder.
460
+ */
461
+ entityFolderGroupContentRole?: EmbedEntityFolderContentRoles;
462
+
404
463
  // Required identifier to associate the external user with an
405
464
  // automatically generated internal Omni user.
406
465
  externalId: string;
@@ -456,6 +515,13 @@ type EmbedSsoContentDiscoveryProps = {
456
515
  // Optional dark mode setting. Can be one of "true", "false", or "system".
457
516
  prefersDark?: string;
458
517
 
518
+ /**
519
+ * When true, an existing content role for the embed user on the entity folder will not be overwritten
520
+ * by the `entityFolderContentRole` value. If a content role does not exist on the entity folder for the embed user,
521
+ * the `entityFolderContentRole` value will be applied.
522
+ */
523
+ preserveEntityFolderContentRole?: boolean;
524
+
459
525
  // Signing secret available to Omni admins.
460
526
  secret: string;
461
527
 
@@ -522,14 +588,29 @@ type CreateSessionTokenProps = {
522
588
  entity?: string;
523
589
 
524
590
  /**
525
- * Optional content role setting for the entity folder. Can be one of "MANAGER", "EDITOR", or "VIEWER".
591
+ * Sets embed user content permission on the entity folder. Can be one of "MANAGER", "EDITOR", "VIEWER",
592
+ * or "NO_ACCESS".
526
593
  *
527
594
  * MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
528
595
  * EDITOR: the user will have the ability to manage content in the entity folder.
529
596
  * VIEWER: the user will only be able to view content in the entity folder.
597
+ * NO_ACCESS: the user will have no access to content in the top-level entity folder. Note that the
598
+ * entityFolderGroupContentRole should also be set to NO_ACCESS in order to completely restrict access
599
+ * to the top-level entity folder.
530
600
  */
531
601
  entityFolderContentRole?: EmbedEntityFolderContentRoles;
532
602
 
603
+ /**
604
+ * Sets embed entity group content permission on the entity folder. Can be one of "MANAGER", "EDITOR", "VIEWER",
605
+ * or "NO_ACCESS".
606
+ *
607
+ * MANAGER: all users in the group will have the ability to manage content and content permissions of the entity folder.
608
+ * EDITOR: all users in the group have the ability to manage content in the entity folder.
609
+ * VIEWER: all users in the group are restricted to just view content in the entity folder.
610
+ * NO_ACCESS: all users in the group will have no access to content in the top-level entity folder.
611
+ */
612
+ entityFolderGroupContentRole?: EmbedEntityFolderContentRoles;
613
+
533
614
  // Required identifier to associate the external user with an automatically generated internal Omni user.
534
615
  externalId: string;
535
616
 
@@ -588,6 +669,13 @@ type CreateSessionTokenProps = {
588
669
  // Port of host.
589
670
  port?: number;
590
671
 
672
+ /**
673
+ * When true, an existing content role for the embed user on the entity folder will not be overwritten
674
+ * by the `entityFolderContentRole` value. If a content role does not exist on the entity folder for the embed user,
675
+ * the `entityFolderContentRole` value will be applied.
676
+ */
677
+ preserveEntityFolderContentRole?: boolean;
678
+
591
679
  // Optional UI settings object to control appearance of embed experience.
592
680
  uiSettings?: Record<EmbedUiSettings, boolean>;
593
681
 
package/lib/cjs/embed.js CHANGED
@@ -54,7 +54,7 @@ const validateProps = (props) => {
54
54
  };
55
55
  const embedSsoContent = async (props) => {
56
56
  validateProps(props);
57
- let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, name, nonce, organizationName, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
57
+ let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, name, nonce, organizationName, preserveEntityFolderContentRole, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
58
58
  // Handle defaults
59
59
  nonce = nonce !== null && nonce !== void 0 ? nonce : (await (0, random_str_1.random32ByteString)());
60
60
  const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
@@ -94,6 +94,7 @@ const embedSsoContent = async (props) => {
94
94
  linkAccess,
95
95
  mode,
96
96
  prefersDark,
97
+ preserveEntityFolderContentRole,
97
98
  theme,
98
99
  uiSettings,
99
100
  userAttributes,
@@ -129,6 +130,8 @@ const embedSsoContent = async (props) => {
129
130
  url.searchParams.append("entityGroupLabel", entityGroupLabel);
130
131
  entityFolderLabel &&
131
132
  url.searchParams.append("entityFolderLabel", entityFolderLabel);
133
+ preserveEntityFolderContentRole !== undefined &&
134
+ url.searchParams.append("preserveEntityFolderContentRole", preserveEntityFolderContentRole.toString());
132
135
  return url.toString();
133
136
  };
134
137
  const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
@@ -90,6 +90,12 @@ type SignatureProps = {
90
90
  * Whether the user prefers light, dark, or system theme.
91
91
  */
92
92
  prefersDark?: string;
93
+ /**
94
+ * When true, the embed will not apply a custom theme to the embedded content.
95
+ * This is useful when the embed is used in a context where the custom theme
96
+ * is already applied, such as in an Omni app.
97
+ */
98
+ preserveEntityFolderContentRole?: boolean;
93
99
  /**
94
100
  * The theme of the embed.
95
101
  */
@@ -125,6 +131,6 @@ type SignSessionRedemptionProps = Pick<SignatureProps, "nonce" | "prefersDark" |
125
131
  */
126
132
  export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }: SignSessionRedemptionProps) => string;
127
133
  export declare const TEST_ONLY: {
128
- generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
134
+ generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
129
135
  };
130
136
  export {};
@@ -17,7 +17,7 @@ const generateStringForSignature = ({
17
17
  // Required parameters
18
18
  loginUrl, contentPath, externalId, name, nonce,
19
19
  // Optional parameters
20
- accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }) => {
20
+ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }) => {
21
21
  // We create a map of optional params and convert it to an array
22
22
  // to ensure that the order of the optional params is alphabetical and consistent.
23
23
  const optionalParamsMap = {
@@ -36,6 +36,9 @@ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityF
36
36
  ...(linkAccess && { linkAccess }),
37
37
  ...(mode && { mode }),
38
38
  ...(prefersDark && { prefersDark }),
39
+ ...(preserveEntityFolderContentRole !== undefined && {
40
+ preserveEntityFolderContentRole: preserveEntityFolderContentRole.toString(),
41
+ }),
39
42
  ...(theme && { theme }),
40
43
  ...(uiSettings && { uiSettings }),
41
44
  ...(userAttributes && { userAttributes }),
@@ -79,6 +79,12 @@ type EmbedSsoBaseProps = {
79
79
  * NO_ACCESS: all entity group embed users will not have access to the entity folder.
80
80
  */
81
81
  entityFolderGroupContentRole?: EmbedEntityFolderContentRoles;
82
+ /**
83
+ * When true, an existing content role for the embed user on the entity folder will not be overwritten
84
+ * by the `entityFolderContentRole` value. If a content role does not exist on the entity folder for the embed user,
85
+ * the `entityFolderContentRole` value will be applied.
86
+ */
87
+ preserveEntityFolderContentRole?: boolean;
82
88
  /**
83
89
  * Optional setting that customizes the generated entity folder label. This only affects the entity folder
84
90
  * corresponding to the `entity` parameter value in the relevant generated SSO embed URL.
package/lib/esm/embed.js CHANGED
@@ -51,7 +51,7 @@ const validateProps = (props) => {
51
51
  };
52
52
  const embedSsoContent = async (props) => {
53
53
  validateProps(props);
54
- let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, name, nonce, organizationName, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
54
+ let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, name, nonce, organizationName, preserveEntityFolderContentRole, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
55
55
  // Handle defaults
56
56
  nonce = nonce !== null && nonce !== void 0 ? nonce : (await random32ByteString());
57
57
  const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
@@ -91,6 +91,7 @@ const embedSsoContent = async (props) => {
91
91
  linkAccess,
92
92
  mode,
93
93
  prefersDark,
94
+ preserveEntityFolderContentRole,
94
95
  theme,
95
96
  uiSettings,
96
97
  userAttributes,
@@ -126,6 +127,8 @@ const embedSsoContent = async (props) => {
126
127
  url.searchParams.append("entityGroupLabel", entityGroupLabel);
127
128
  entityFolderLabel &&
128
129
  url.searchParams.append("entityFolderLabel", entityFolderLabel);
130
+ preserveEntityFolderContentRole !== undefined &&
131
+ url.searchParams.append("preserveEntityFolderContentRole", preserveEntityFolderContentRole.toString());
129
132
  return url.toString();
130
133
  };
131
134
  const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
@@ -90,6 +90,12 @@ type SignatureProps = {
90
90
  * Whether the user prefers light, dark, or system theme.
91
91
  */
92
92
  prefersDark?: string;
93
+ /**
94
+ * When true, the embed will not apply a custom theme to the embedded content.
95
+ * This is useful when the embed is used in a context where the custom theme
96
+ * is already applied, such as in an Omni app.
97
+ */
98
+ preserveEntityFolderContentRole?: boolean;
93
99
  /**
94
100
  * The theme of the embed.
95
101
  */
@@ -125,6 +131,6 @@ type SignSessionRedemptionProps = Pick<SignatureProps, "nonce" | "prefersDark" |
125
131
  */
126
132
  export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }: SignSessionRedemptionProps) => string;
127
133
  export declare const TEST_ONLY: {
128
- generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
134
+ generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
129
135
  };
130
136
  export {};
@@ -10,7 +10,7 @@ const generateStringForSignature = ({
10
10
  // Required parameters
11
11
  loginUrl, contentPath, externalId, name, nonce,
12
12
  // Optional parameters
13
- accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }) => {
13
+ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }) => {
14
14
  // We create a map of optional params and convert it to an array
15
15
  // to ensure that the order of the optional params is alphabetical and consistent.
16
16
  const optionalParamsMap = {
@@ -29,6 +29,9 @@ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityF
29
29
  ...(linkAccess && { linkAccess }),
30
30
  ...(mode && { mode }),
31
31
  ...(prefersDark && { prefersDark }),
32
+ ...(preserveEntityFolderContentRole !== undefined && {
33
+ preserveEntityFolderContentRole: preserveEntityFolderContentRole.toString(),
34
+ }),
32
35
  ...(theme && { theme }),
33
36
  ...(uiSettings && { uiSettings }),
34
37
  ...(userAttributes && { userAttributes }),
@@ -79,6 +79,12 @@ type EmbedSsoBaseProps = {
79
79
  * NO_ACCESS: all entity group embed users will not have access to the entity folder.
80
80
  */
81
81
  entityFolderGroupContentRole?: EmbedEntityFolderContentRoles;
82
+ /**
83
+ * When true, an existing content role for the embed user on the entity folder will not be overwritten
84
+ * by the `entityFolderContentRole` value. If a content role does not exist on the entity folder for the embed user,
85
+ * the `entityFolderContentRole` value will be applied.
86
+ */
87
+ preserveEntityFolderContentRole?: boolean;
82
88
  /**
83
89
  * Optional setting that customizes the generated entity folder label. This only affects the entity folder
84
90
  * corresponding to the `entity` parameter value in the relevant generated SSO embed URL.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.12.0",
2
+ "version": "0.13.0",
3
3
  "license": "MIT",
4
4
  "name": "@omni-co/embed",
5
5
  "author": "Nate Agrin <nate@exploreomni.com>",