@omni-co/embed 0.7.0 → 0.8.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/lib/cjs/embed.js +7 -2
- package/lib/cjs/signature.d.ts +7 -3
- package/lib/cjs/signature.js +2 -1
- package/lib/cjs/types.d.ts +11 -0
- package/lib/cjs/types.js +12 -1
- package/lib/esm/embed.js +7 -2
- package/lib/esm/signature.d.ts +7 -3
- package/lib/esm/signature.js +2 -1
- package/lib/esm/types.d.ts +11 -0
- package/lib/esm/types.js +11 -0
- package/package.json +1 -1
package/lib/cjs/embed.js
CHANGED
|
@@ -23,7 +23,7 @@ const createEmbedRequestUrl = (props) => {
|
|
|
23
23
|
return url;
|
|
24
24
|
};
|
|
25
25
|
const validateProps = (props) => {
|
|
26
|
-
const { externalId, name, nonce, secret, userAttributes, customTheme, customThemeId, } = props;
|
|
26
|
+
const { externalId, name, nonce, secret, uiSettings, userAttributes, customTheme, customThemeId, } = props;
|
|
27
27
|
let host, domain, organizationName;
|
|
28
28
|
if ("host" in props)
|
|
29
29
|
host = props.host;
|
|
@@ -47,14 +47,17 @@ const validateProps = (props) => {
|
|
|
47
47
|
console.warn("`domain` is deprecated and will be removed in a future v1.0.0 release. Use `host` to specify your vanity domain instead (eg `host: 'omni.my-company.com'`).");
|
|
48
48
|
if (nonce && nonce.length !== 32)
|
|
49
49
|
throw new Error("nonce must be 32 characters");
|
|
50
|
+
if (typeof uiSettings !== "object" && uiSettings)
|
|
51
|
+
throw new Error("uiSettings must be an object");
|
|
50
52
|
if (typeof userAttributes !== "object" && userAttributes)
|
|
51
53
|
throw new Error("userAttributes must be an object");
|
|
52
54
|
};
|
|
53
55
|
const embedSsoContent = async (props) => {
|
|
54
56
|
validateProps(props);
|
|
55
|
-
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, externalId, filterSearchParam, host, linkAccess, mode, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, entityFolderContentRole, groups: rawGroups, } = props;
|
|
57
|
+
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, externalId, filterSearchParam, host, linkAccess, mode, name, nonce, organizationName, port, secret, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, entity, prefersDark, theme, entityFolderContentRole, groups: rawGroups, } = props;
|
|
56
58
|
// Handle defaults
|
|
57
59
|
nonce = nonce !== null && nonce !== void 0 ? nonce : (await (0, random_str_1.random32ByteString)());
|
|
60
|
+
const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
|
|
58
61
|
const userAttributes = rawUserAttributes && JSON.stringify(rawUserAttributes);
|
|
59
62
|
const customTheme = rawCustomTheme && JSON.stringify(rawCustomTheme);
|
|
60
63
|
const connectionRoles = rawConnectionRoles && JSON.stringify(rawConnectionRoles);
|
|
@@ -89,6 +92,7 @@ const embedSsoContent = async (props) => {
|
|
|
89
92
|
mode,
|
|
90
93
|
prefersDark,
|
|
91
94
|
theme,
|
|
95
|
+
uiSettings,
|
|
92
96
|
userAttributes,
|
|
93
97
|
});
|
|
94
98
|
// Build and return the signed url
|
|
@@ -115,6 +119,7 @@ const embedSsoContent = async (props) => {
|
|
|
115
119
|
url.searchParams.append("entityFolderContentRole", entityFolderContentRole);
|
|
116
120
|
groups && url.searchParams.append("groups", groups);
|
|
117
121
|
email && url.searchParams.append("email", email);
|
|
122
|
+
uiSettings && url.searchParams.append("uiSettings", uiSettings);
|
|
118
123
|
return url.toString();
|
|
119
124
|
};
|
|
120
125
|
const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
|
package/lib/cjs/signature.d.ts
CHANGED
|
@@ -82,6 +82,10 @@ type SignatureProps = {
|
|
|
82
82
|
* The theme of the embed.
|
|
83
83
|
*/
|
|
84
84
|
theme?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The UI settings for the embedded content.
|
|
87
|
+
*/
|
|
88
|
+
uiSettings?: string;
|
|
85
89
|
/**
|
|
86
90
|
* The user attributes to be sent with the request. Expected to be a stringified JSON object.
|
|
87
91
|
*
|
|
@@ -106,7 +110,7 @@ type GenerateSessionSignatureProps = Omit<SignatureProps, "loginUrl" | "prefersD
|
|
|
106
110
|
* validated by the Omni app server to ensure the request is authentic.
|
|
107
111
|
*/
|
|
108
112
|
export declare const signSessionRequest: ({ requestUrl, secret, ...props }: GenerateSessionSignatureProps) => string;
|
|
109
|
-
type
|
|
113
|
+
type SignSessionRedemptionProps = Pick<SignatureProps, "nonce" | "prefersDark" | "theme" | "secret"> & RequestUrl & {
|
|
110
114
|
sessionId: string;
|
|
111
115
|
};
|
|
112
116
|
/**
|
|
@@ -117,8 +121,8 @@ type UseSessionSignatureProps = Pick<SignatureProps, "nonce" | "prefersDark" | "
|
|
|
117
121
|
* that is generated based on all other request parameters. That signature is
|
|
118
122
|
* validated by the Omni app server to ensure the request is authentic.
|
|
119
123
|
*/
|
|
120
|
-
export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }:
|
|
124
|
+
export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }: SignSessionRedemptionProps) => string;
|
|
121
125
|
export declare const TEST_ONLY: {
|
|
122
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
126
|
+
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
123
127
|
};
|
|
124
128
|
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, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, userAttributes, }) => {
|
|
20
|
+
accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, 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 = {
|
|
@@ -34,6 +34,7 @@ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityF
|
|
|
34
34
|
...(mode && { mode }),
|
|
35
35
|
...(prefersDark && { prefersDark }),
|
|
36
36
|
...(theme && { theme }),
|
|
37
|
+
...(uiSettings && { uiSettings }),
|
|
37
38
|
...(userAttributes && { userAttributes }),
|
|
38
39
|
};
|
|
39
40
|
const optionalParams = Object.keys(optionalParamsMap)
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ type EmbedSsoBaseProps = {
|
|
|
72
72
|
email?: string;
|
|
73
73
|
filterSearchParam?: string;
|
|
74
74
|
linkAccess?: string;
|
|
75
|
+
uiSettings?: Record<EmbedUiSettings, boolean>;
|
|
75
76
|
nonce?: string;
|
|
76
77
|
port?: number;
|
|
77
78
|
} & HostProps;
|
|
@@ -202,6 +203,16 @@ export declare enum EmbedEntityFolderContentRoles {
|
|
|
202
203
|
EDITOR = "EDITOR",
|
|
203
204
|
VIEWER = "VIEWER"
|
|
204
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* UI settings used as keys of the uiSettings sso embed parameter.
|
|
208
|
+
*/
|
|
209
|
+
export declare enum EmbedUiSettings {
|
|
210
|
+
/**
|
|
211
|
+
* When false, hides all in-app navigation elements. Note that in-app navigation
|
|
212
|
+
* is only visible when the embed session is in APPLICATION mode.
|
|
213
|
+
*/
|
|
214
|
+
SHOW_NAVIGATION = "showNavigation"
|
|
215
|
+
}
|
|
205
216
|
export type EmbedSsoContentProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProps & EmbedContentPathProp;
|
|
206
217
|
/**
|
|
207
218
|
* Consumers of this SDK will rely on these three types to embed workbooks and dashboards.
|
package/lib/cjs/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmbedEntityFolderContentRoles = exports.EmbedConnectionRoles = exports.EmbeddedContent = exports.CustomThemeProperty = exports.EmbedSessionMode = void 0;
|
|
3
|
+
exports.EmbedUiSettings = exports.EmbedEntityFolderContentRoles = exports.EmbedConnectionRoles = exports.EmbeddedContent = exports.CustomThemeProperty = exports.EmbedSessionMode = void 0;
|
|
4
4
|
var EmbedSessionMode;
|
|
5
5
|
(function (EmbedSessionMode) {
|
|
6
6
|
EmbedSessionMode["Application"] = "APPLICATION";
|
|
@@ -83,3 +83,14 @@ var EmbedEntityFolderContentRoles;
|
|
|
83
83
|
EmbedEntityFolderContentRoles["EDITOR"] = "EDITOR";
|
|
84
84
|
EmbedEntityFolderContentRoles["VIEWER"] = "VIEWER";
|
|
85
85
|
})(EmbedEntityFolderContentRoles || (exports.EmbedEntityFolderContentRoles = EmbedEntityFolderContentRoles = {}));
|
|
86
|
+
/**
|
|
87
|
+
* UI settings used as keys of the uiSettings sso embed parameter.
|
|
88
|
+
*/
|
|
89
|
+
var EmbedUiSettings;
|
|
90
|
+
(function (EmbedUiSettings) {
|
|
91
|
+
/**
|
|
92
|
+
* When false, hides all in-app navigation elements. Note that in-app navigation
|
|
93
|
+
* is only visible when the embed session is in APPLICATION mode.
|
|
94
|
+
*/
|
|
95
|
+
EmbedUiSettings["SHOW_NAVIGATION"] = "showNavigation";
|
|
96
|
+
})(EmbedUiSettings || (exports.EmbedUiSettings = EmbedUiSettings = {}));
|
package/lib/esm/embed.js
CHANGED
|
@@ -20,7 +20,7 @@ const createEmbedRequestUrl = (props) => {
|
|
|
20
20
|
return url;
|
|
21
21
|
};
|
|
22
22
|
const validateProps = (props) => {
|
|
23
|
-
const { externalId, name, nonce, secret, userAttributes, customTheme, customThemeId, } = props;
|
|
23
|
+
const { externalId, name, nonce, secret, uiSettings, userAttributes, customTheme, customThemeId, } = props;
|
|
24
24
|
let host, domain, organizationName;
|
|
25
25
|
if ("host" in props)
|
|
26
26
|
host = props.host;
|
|
@@ -44,14 +44,17 @@ const validateProps = (props) => {
|
|
|
44
44
|
console.warn("`domain` is deprecated and will be removed in a future v1.0.0 release. Use `host` to specify your vanity domain instead (eg `host: 'omni.my-company.com'`).");
|
|
45
45
|
if (nonce && nonce.length !== 32)
|
|
46
46
|
throw new Error("nonce must be 32 characters");
|
|
47
|
+
if (typeof uiSettings !== "object" && uiSettings)
|
|
48
|
+
throw new Error("uiSettings must be an object");
|
|
47
49
|
if (typeof userAttributes !== "object" && userAttributes)
|
|
48
50
|
throw new Error("userAttributes must be an object");
|
|
49
51
|
};
|
|
50
52
|
const embedSsoContent = async (props) => {
|
|
51
53
|
validateProps(props);
|
|
52
|
-
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, externalId, filterSearchParam, host, linkAccess, mode, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, entityFolderContentRole, groups: rawGroups, } = props;
|
|
54
|
+
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, externalId, filterSearchParam, host, linkAccess, mode, name, nonce, organizationName, port, secret, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, entity, prefersDark, theme, entityFolderContentRole, groups: rawGroups, } = props;
|
|
53
55
|
// Handle defaults
|
|
54
56
|
nonce = nonce !== null && nonce !== void 0 ? nonce : (await random32ByteString());
|
|
57
|
+
const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
|
|
55
58
|
const userAttributes = rawUserAttributes && JSON.stringify(rawUserAttributes);
|
|
56
59
|
const customTheme = rawCustomTheme && JSON.stringify(rawCustomTheme);
|
|
57
60
|
const connectionRoles = rawConnectionRoles && JSON.stringify(rawConnectionRoles);
|
|
@@ -86,6 +89,7 @@ const embedSsoContent = async (props) => {
|
|
|
86
89
|
mode,
|
|
87
90
|
prefersDark,
|
|
88
91
|
theme,
|
|
92
|
+
uiSettings,
|
|
89
93
|
userAttributes,
|
|
90
94
|
});
|
|
91
95
|
// Build and return the signed url
|
|
@@ -112,6 +116,7 @@ const embedSsoContent = async (props) => {
|
|
|
112
116
|
url.searchParams.append("entityFolderContentRole", entityFolderContentRole);
|
|
113
117
|
groups && url.searchParams.append("groups", groups);
|
|
114
118
|
email && url.searchParams.append("email", email);
|
|
119
|
+
uiSettings && url.searchParams.append("uiSettings", uiSettings);
|
|
115
120
|
return url.toString();
|
|
116
121
|
};
|
|
117
122
|
const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
|
package/lib/esm/signature.d.ts
CHANGED
|
@@ -82,6 +82,10 @@ type SignatureProps = {
|
|
|
82
82
|
* The theme of the embed.
|
|
83
83
|
*/
|
|
84
84
|
theme?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The UI settings for the embedded content.
|
|
87
|
+
*/
|
|
88
|
+
uiSettings?: string;
|
|
85
89
|
/**
|
|
86
90
|
* The user attributes to be sent with the request. Expected to be a stringified JSON object.
|
|
87
91
|
*
|
|
@@ -106,7 +110,7 @@ type GenerateSessionSignatureProps = Omit<SignatureProps, "loginUrl" | "prefersD
|
|
|
106
110
|
* validated by the Omni app server to ensure the request is authentic.
|
|
107
111
|
*/
|
|
108
112
|
export declare const signSessionRequest: ({ requestUrl, secret, ...props }: GenerateSessionSignatureProps) => string;
|
|
109
|
-
type
|
|
113
|
+
type SignSessionRedemptionProps = Pick<SignatureProps, "nonce" | "prefersDark" | "theme" | "secret"> & RequestUrl & {
|
|
110
114
|
sessionId: string;
|
|
111
115
|
};
|
|
112
116
|
/**
|
|
@@ -117,8 +121,8 @@ type UseSessionSignatureProps = Pick<SignatureProps, "nonce" | "prefersDark" | "
|
|
|
117
121
|
* that is generated based on all other request parameters. That signature is
|
|
118
122
|
* validated by the Omni app server to ensure the request is authentic.
|
|
119
123
|
*/
|
|
120
|
-
export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }:
|
|
124
|
+
export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }: SignSessionRedemptionProps) => string;
|
|
121
125
|
export declare const TEST_ONLY: {
|
|
122
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
126
|
+
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
123
127
|
};
|
|
124
128
|
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, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, userAttributes, }) => {
|
|
13
|
+
accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, 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 = {
|
|
@@ -27,6 +27,7 @@ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityF
|
|
|
27
27
|
...(mode && { mode }),
|
|
28
28
|
...(prefersDark && { prefersDark }),
|
|
29
29
|
...(theme && { theme }),
|
|
30
|
+
...(uiSettings && { uiSettings }),
|
|
30
31
|
...(userAttributes && { userAttributes }),
|
|
31
32
|
};
|
|
32
33
|
const optionalParams = Object.keys(optionalParamsMap)
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ type EmbedSsoBaseProps = {
|
|
|
72
72
|
email?: string;
|
|
73
73
|
filterSearchParam?: string;
|
|
74
74
|
linkAccess?: string;
|
|
75
|
+
uiSettings?: Record<EmbedUiSettings, boolean>;
|
|
75
76
|
nonce?: string;
|
|
76
77
|
port?: number;
|
|
77
78
|
} & HostProps;
|
|
@@ -202,6 +203,16 @@ export declare enum EmbedEntityFolderContentRoles {
|
|
|
202
203
|
EDITOR = "EDITOR",
|
|
203
204
|
VIEWER = "VIEWER"
|
|
204
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* UI settings used as keys of the uiSettings sso embed parameter.
|
|
208
|
+
*/
|
|
209
|
+
export declare enum EmbedUiSettings {
|
|
210
|
+
/**
|
|
211
|
+
* When false, hides all in-app navigation elements. Note that in-app navigation
|
|
212
|
+
* is only visible when the embed session is in APPLICATION mode.
|
|
213
|
+
*/
|
|
214
|
+
SHOW_NAVIGATION = "showNavigation"
|
|
215
|
+
}
|
|
205
216
|
export type EmbedSsoContentProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProps & EmbedContentPathProp;
|
|
206
217
|
/**
|
|
207
218
|
* Consumers of this SDK will rely on these three types to embed workbooks and dashboards.
|
package/lib/esm/types.js
CHANGED
|
@@ -80,3 +80,14 @@ export var EmbedEntityFolderContentRoles;
|
|
|
80
80
|
EmbedEntityFolderContentRoles["EDITOR"] = "EDITOR";
|
|
81
81
|
EmbedEntityFolderContentRoles["VIEWER"] = "VIEWER";
|
|
82
82
|
})(EmbedEntityFolderContentRoles || (EmbedEntityFolderContentRoles = {}));
|
|
83
|
+
/**
|
|
84
|
+
* UI settings used as keys of the uiSettings sso embed parameter.
|
|
85
|
+
*/
|
|
86
|
+
export var EmbedUiSettings;
|
|
87
|
+
(function (EmbedUiSettings) {
|
|
88
|
+
/**
|
|
89
|
+
* When false, hides all in-app navigation elements. Note that in-app navigation
|
|
90
|
+
* is only visible when the embed session is in APPLICATION mode.
|
|
91
|
+
*/
|
|
92
|
+
EmbedUiSettings["SHOW_NAVIGATION"] = "showNavigation";
|
|
93
|
+
})(EmbedUiSettings || (EmbedUiSettings = {}));
|
package/package.json
CHANGED