@omni-co/embed 0.4.4 → 0.4.5
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/lib/cjs/embed.js +14 -9
- package/lib/cjs/signature.d.ts +5 -1
- package/lib/cjs/signature.js +2 -1
- package/lib/cjs/types.d.ts +6 -1
- package/lib/cjs/types.js +1 -3
- package/lib/esm/embed.js +14 -9
- package/lib/esm/signature.d.ts +5 -1
- package/lib/esm/signature.js +2 -1
- package/lib/esm/types.d.ts +6 -1
- package/lib/esm/types.js +1 -3
- package/package.json +1 -1
package/lib/cjs/embed.js
CHANGED
|
@@ -36,7 +36,7 @@ const validateProps = (props) => {
|
|
|
36
36
|
};
|
|
37
37
|
const embedSsoContent = async (props) => {
|
|
38
38
|
validateProps(props);
|
|
39
|
-
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, externalId, filterSearchParam, linkAccess, mode, name, nonce, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, entityFolderContentRole, } = props;
|
|
39
|
+
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, externalId, filterSearchParam, linkAccess, mode, name, nonce, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, entityFolderContentRole, groups: rawGroups, } = props;
|
|
40
40
|
let host, domain, organizationName;
|
|
41
41
|
if ("host" in props)
|
|
42
42
|
host = props.host;
|
|
@@ -49,30 +49,34 @@ const embedSsoContent = async (props) => {
|
|
|
49
49
|
const userAttributes = rawUserAttributes && JSON.stringify(rawUserAttributes);
|
|
50
50
|
const customTheme = rawCustomTheme && JSON.stringify(rawCustomTheme);
|
|
51
51
|
const connectionRoles = rawConnectionRoles && JSON.stringify(rawConnectionRoles);
|
|
52
|
+
const groups = rawGroups && JSON.stringify(rawGroups);
|
|
52
53
|
// Generate the url for the embed login route
|
|
53
54
|
if (!host)
|
|
54
55
|
host = `${organizationName}.${domain !== null && domain !== void 0 ? domain : defaultEmbedDomain}`;
|
|
55
56
|
const url = new URL(embedLoginPath, `https://${host}${port ? `:${port}` : ""}`);
|
|
56
57
|
// Get a signature for the request
|
|
57
58
|
const signature = (0, signature_1.getSignature)({
|
|
59
|
+
// Required parameters
|
|
58
60
|
loginUrl: url.toString(),
|
|
59
61
|
contentPath,
|
|
60
62
|
externalId,
|
|
61
63
|
name,
|
|
62
64
|
nonce,
|
|
63
65
|
secret,
|
|
64
|
-
|
|
66
|
+
// Optional parameters
|
|
67
|
+
accessBoost,
|
|
68
|
+
connectionRoles,
|
|
69
|
+
customTheme,
|
|
70
|
+
customThemeId,
|
|
65
71
|
entity,
|
|
66
|
-
|
|
67
|
-
theme,
|
|
72
|
+
entityFolderContentRole,
|
|
68
73
|
filterSearchParam,
|
|
74
|
+
groups,
|
|
69
75
|
linkAccess,
|
|
70
|
-
customTheme,
|
|
71
|
-
customThemeId,
|
|
72
|
-
connectionRoles,
|
|
73
|
-
accessBoost,
|
|
74
76
|
mode,
|
|
75
|
-
|
|
77
|
+
prefersDark,
|
|
78
|
+
theme,
|
|
79
|
+
userAttributes,
|
|
76
80
|
});
|
|
77
81
|
// Build and return the signed url
|
|
78
82
|
url.searchParams.append("contentPath", contentPath);
|
|
@@ -95,6 +99,7 @@ const embedSsoContent = async (props) => {
|
|
|
95
99
|
mode && url.searchParams.append("mode", mode);
|
|
96
100
|
entityFolderContentRole &&
|
|
97
101
|
url.searchParams.append("entityFolderContentRole", entityFolderContentRole);
|
|
102
|
+
groups && url.searchParams.append("groups", groups);
|
|
98
103
|
return url.toString();
|
|
99
104
|
};
|
|
100
105
|
const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
|
package/lib/cjs/signature.d.ts
CHANGED
|
@@ -58,6 +58,10 @@ type SignatureProps = {
|
|
|
58
58
|
* Filter search parameter.
|
|
59
59
|
*/
|
|
60
60
|
filterSearchParam?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Stringified string array of group names.
|
|
63
|
+
*/
|
|
64
|
+
groups?: string;
|
|
61
65
|
/**
|
|
62
66
|
* String denoting level of link access.
|
|
63
67
|
*/
|
|
@@ -83,6 +87,6 @@ type SignatureProps = {
|
|
|
83
87
|
};
|
|
84
88
|
export declare const getSignature: ({ secret, ...props }: SignatureProps) => string;
|
|
85
89
|
export declare const TEST_ONLY: {
|
|
86
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, entity, entityFolderContentRole, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
90
|
+
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
87
91
|
};
|
|
88
92
|
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, entity, entityFolderContentRole, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }) => {
|
|
20
|
+
accessBoost, connectionRoles, customTheme, customThemeId, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, 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 = {
|
|
@@ -28,6 +28,7 @@ accessBoost, connectionRoles, customTheme, customThemeId, entity, entityFolderCo
|
|
|
28
28
|
...(entity && { entity }),
|
|
29
29
|
...(entityFolderContentRole && { entityFolderContentRole }),
|
|
30
30
|
...(filterSearchParam && { filterSearchParam }),
|
|
31
|
+
...(groups && { groups }),
|
|
31
32
|
...(linkAccess && { linkAccess }),
|
|
32
33
|
...(mode && { mode }),
|
|
33
34
|
...(prefersDark && { prefersDark }),
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -28,6 +28,10 @@ type EmbedSsoBaseProps = {
|
|
|
28
28
|
* their associated embed entity folder.
|
|
29
29
|
*/
|
|
30
30
|
entityFolderContentRole?: EmbedEntityFolderContentRoles;
|
|
31
|
+
/**
|
|
32
|
+
* Optional groups setting. An array of group names that the user will be added to.
|
|
33
|
+
*/
|
|
34
|
+
groups?: string[];
|
|
31
35
|
nonce?: string;
|
|
32
36
|
port?: number;
|
|
33
37
|
} & ({
|
|
@@ -119,7 +123,8 @@ export declare enum EmbeddedContent {
|
|
|
119
123
|
export declare const EmbedSsoContentDiscoveryPaths: readonly ["my", "entity-folder", "root"];
|
|
120
124
|
export type EmbedSsoContentDiscoveryPath = (typeof EmbedSsoContentDiscoveryPaths)[number];
|
|
121
125
|
export declare enum EmbedConnectionRoles {
|
|
122
|
-
RESTRICTED_QUERIER = "RESTRICTED_QUERIER"
|
|
126
|
+
RESTRICTED_QUERIER = "RESTRICTED_QUERIER",
|
|
127
|
+
VIEWER = "VIEWER"
|
|
123
128
|
}
|
|
124
129
|
/**
|
|
125
130
|
* Levels of access a user can have to their associated embed entity folder.
|
package/lib/cjs/types.js
CHANGED
|
@@ -39,10 +39,8 @@ exports.EmbedSsoContentDiscoveryPaths = [
|
|
|
39
39
|
];
|
|
40
40
|
var EmbedConnectionRoles;
|
|
41
41
|
(function (EmbedConnectionRoles) {
|
|
42
|
-
// TODO: Eventually we'll want to add VIEWER. Currently though, since the sole use case of the
|
|
43
|
-
// connectionRoles parameter is personal content creation, I'm refraining from adding "VIEWER" to
|
|
44
|
-
// keep scope as limited as possible.
|
|
45
42
|
EmbedConnectionRoles["RESTRICTED_QUERIER"] = "RESTRICTED_QUERIER";
|
|
43
|
+
EmbedConnectionRoles["VIEWER"] = "VIEWER";
|
|
46
44
|
})(EmbedConnectionRoles || (exports.EmbedConnectionRoles = EmbedConnectionRoles = {}));
|
|
47
45
|
/**
|
|
48
46
|
* Levels of access a user can have to their associated embed entity folder.
|
package/lib/esm/embed.js
CHANGED
|
@@ -33,7 +33,7 @@ const validateProps = (props) => {
|
|
|
33
33
|
};
|
|
34
34
|
const embedSsoContent = async (props) => {
|
|
35
35
|
validateProps(props);
|
|
36
|
-
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, externalId, filterSearchParam, linkAccess, mode, name, nonce, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, entityFolderContentRole, } = props;
|
|
36
|
+
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, externalId, filterSearchParam, linkAccess, mode, name, nonce, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, entityFolderContentRole, groups: rawGroups, } = props;
|
|
37
37
|
let host, domain, organizationName;
|
|
38
38
|
if ("host" in props)
|
|
39
39
|
host = props.host;
|
|
@@ -46,30 +46,34 @@ const embedSsoContent = async (props) => {
|
|
|
46
46
|
const userAttributes = rawUserAttributes && JSON.stringify(rawUserAttributes);
|
|
47
47
|
const customTheme = rawCustomTheme && JSON.stringify(rawCustomTheme);
|
|
48
48
|
const connectionRoles = rawConnectionRoles && JSON.stringify(rawConnectionRoles);
|
|
49
|
+
const groups = rawGroups && JSON.stringify(rawGroups);
|
|
49
50
|
// Generate the url for the embed login route
|
|
50
51
|
if (!host)
|
|
51
52
|
host = `${organizationName}.${domain !== null && domain !== void 0 ? domain : defaultEmbedDomain}`;
|
|
52
53
|
const url = new URL(embedLoginPath, `https://${host}${port ? `:${port}` : ""}`);
|
|
53
54
|
// Get a signature for the request
|
|
54
55
|
const signature = getSignature({
|
|
56
|
+
// Required parameters
|
|
55
57
|
loginUrl: url.toString(),
|
|
56
58
|
contentPath,
|
|
57
59
|
externalId,
|
|
58
60
|
name,
|
|
59
61
|
nonce,
|
|
60
62
|
secret,
|
|
61
|
-
|
|
63
|
+
// Optional parameters
|
|
64
|
+
accessBoost,
|
|
65
|
+
connectionRoles,
|
|
66
|
+
customTheme,
|
|
67
|
+
customThemeId,
|
|
62
68
|
entity,
|
|
63
|
-
|
|
64
|
-
theme,
|
|
69
|
+
entityFolderContentRole,
|
|
65
70
|
filterSearchParam,
|
|
71
|
+
groups,
|
|
66
72
|
linkAccess,
|
|
67
|
-
customTheme,
|
|
68
|
-
customThemeId,
|
|
69
|
-
connectionRoles,
|
|
70
|
-
accessBoost,
|
|
71
73
|
mode,
|
|
72
|
-
|
|
74
|
+
prefersDark,
|
|
75
|
+
theme,
|
|
76
|
+
userAttributes,
|
|
73
77
|
});
|
|
74
78
|
// Build and return the signed url
|
|
75
79
|
url.searchParams.append("contentPath", contentPath);
|
|
@@ -92,6 +96,7 @@ const embedSsoContent = async (props) => {
|
|
|
92
96
|
mode && url.searchParams.append("mode", mode);
|
|
93
97
|
entityFolderContentRole &&
|
|
94
98
|
url.searchParams.append("entityFolderContentRole", entityFolderContentRole);
|
|
99
|
+
groups && url.searchParams.append("groups", groups);
|
|
95
100
|
return url.toString();
|
|
96
101
|
};
|
|
97
102
|
const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
|
package/lib/esm/signature.d.ts
CHANGED
|
@@ -58,6 +58,10 @@ type SignatureProps = {
|
|
|
58
58
|
* Filter search parameter.
|
|
59
59
|
*/
|
|
60
60
|
filterSearchParam?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Stringified string array of group names.
|
|
63
|
+
*/
|
|
64
|
+
groups?: string;
|
|
61
65
|
/**
|
|
62
66
|
* String denoting level of link access.
|
|
63
67
|
*/
|
|
@@ -83,6 +87,6 @@ type SignatureProps = {
|
|
|
83
87
|
};
|
|
84
88
|
export declare const getSignature: ({ secret, ...props }: SignatureProps) => string;
|
|
85
89
|
export declare const TEST_ONLY: {
|
|
86
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, entity, entityFolderContentRole, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
90
|
+
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
87
91
|
};
|
|
88
92
|
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, entity, entityFolderContentRole, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }) => {
|
|
13
|
+
accessBoost, connectionRoles, customTheme, customThemeId, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, 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 = {
|
|
@@ -21,6 +21,7 @@ accessBoost, connectionRoles, customTheme, customThemeId, entity, entityFolderCo
|
|
|
21
21
|
...(entity && { entity }),
|
|
22
22
|
...(entityFolderContentRole && { entityFolderContentRole }),
|
|
23
23
|
...(filterSearchParam && { filterSearchParam }),
|
|
24
|
+
...(groups && { groups }),
|
|
24
25
|
...(linkAccess && { linkAccess }),
|
|
25
26
|
...(mode && { mode }),
|
|
26
27
|
...(prefersDark && { prefersDark }),
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -28,6 +28,10 @@ type EmbedSsoBaseProps = {
|
|
|
28
28
|
* their associated embed entity folder.
|
|
29
29
|
*/
|
|
30
30
|
entityFolderContentRole?: EmbedEntityFolderContentRoles;
|
|
31
|
+
/**
|
|
32
|
+
* Optional groups setting. An array of group names that the user will be added to.
|
|
33
|
+
*/
|
|
34
|
+
groups?: string[];
|
|
31
35
|
nonce?: string;
|
|
32
36
|
port?: number;
|
|
33
37
|
} & ({
|
|
@@ -119,7 +123,8 @@ export declare enum EmbeddedContent {
|
|
|
119
123
|
export declare const EmbedSsoContentDiscoveryPaths: readonly ["my", "entity-folder", "root"];
|
|
120
124
|
export type EmbedSsoContentDiscoveryPath = (typeof EmbedSsoContentDiscoveryPaths)[number];
|
|
121
125
|
export declare enum EmbedConnectionRoles {
|
|
122
|
-
RESTRICTED_QUERIER = "RESTRICTED_QUERIER"
|
|
126
|
+
RESTRICTED_QUERIER = "RESTRICTED_QUERIER",
|
|
127
|
+
VIEWER = "VIEWER"
|
|
123
128
|
}
|
|
124
129
|
/**
|
|
125
130
|
* Levels of access a user can have to their associated embed entity folder.
|
package/lib/esm/types.js
CHANGED
|
@@ -36,10 +36,8 @@ export const EmbedSsoContentDiscoveryPaths = [
|
|
|
36
36
|
];
|
|
37
37
|
export var EmbedConnectionRoles;
|
|
38
38
|
(function (EmbedConnectionRoles) {
|
|
39
|
-
// TODO: Eventually we'll want to add VIEWER. Currently though, since the sole use case of the
|
|
40
|
-
// connectionRoles parameter is personal content creation, I'm refraining from adding "VIEWER" to
|
|
41
|
-
// keep scope as limited as possible.
|
|
42
39
|
EmbedConnectionRoles["RESTRICTED_QUERIER"] = "RESTRICTED_QUERIER";
|
|
40
|
+
EmbedConnectionRoles["VIEWER"] = "VIEWER";
|
|
43
41
|
})(EmbedConnectionRoles || (EmbedConnectionRoles = {}));
|
|
44
42
|
/**
|
|
45
43
|
* Levels of access a user can have to their associated embed entity folder.
|
package/package.json
CHANGED