@omni-co/embed 0.12.2 → 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 +28 -0
- package/lib/cjs/embed.js +4 -1
- package/lib/cjs/signature.d.ts +7 -1
- package/lib/cjs/signature.js +4 -1
- package/lib/cjs/types.d.ts +6 -0
- package/lib/esm/embed.js +4 -1
- package/lib/esm/signature.d.ts +7 -1
- package/lib/esm/signature.js +4 -1
- package/lib/esm/types.d.ts +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -227,6 +227,13 @@ type EmbedSsoDashboardProps = {
|
|
|
227
227
|
// Optional dark mode setting. Can be one of "true", "false", or "system".
|
|
228
228
|
prefersDark?: string;
|
|
229
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
|
+
|
|
230
237
|
// Signing secret available to Omni admins.
|
|
231
238
|
secret: string;
|
|
232
239
|
|
|
@@ -363,6 +370,13 @@ type EmbedSsoWorkbookProps = {
|
|
|
363
370
|
// Optional dark mode setting. Can be one of "true", "false", or "system".
|
|
364
371
|
prefersDark?: string;
|
|
365
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
|
+
|
|
366
380
|
// Signing secret available to Omni admins.
|
|
367
381
|
secret: string;
|
|
368
382
|
|
|
@@ -501,6 +515,13 @@ type EmbedSsoContentDiscoveryProps = {
|
|
|
501
515
|
// Optional dark mode setting. Can be one of "true", "false", or "system".
|
|
502
516
|
prefersDark?: string;
|
|
503
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
|
+
|
|
504
525
|
// Signing secret available to Omni admins.
|
|
505
526
|
secret: string;
|
|
506
527
|
|
|
@@ -648,6 +669,13 @@ type CreateSessionTokenProps = {
|
|
|
648
669
|
// Port of host.
|
|
649
670
|
port?: number;
|
|
650
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
|
+
|
|
651
679
|
// Optional UI settings object to control appearance of embed experience.
|
|
652
680
|
uiSettings?: Record<EmbedUiSettings, boolean>;
|
|
653
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}`;
|
package/lib/cjs/signature.d.ts
CHANGED
|
@@ -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 {};
|
package/lib/cjs/signature.js
CHANGED
|
@@ -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 }),
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -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}`;
|
package/lib/esm/signature.d.ts
CHANGED
|
@@ -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 {};
|
package/lib/esm/signature.js
CHANGED
|
@@ -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 }),
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -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