@omni-co/embed 0.3.3 → 0.3.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/README.md +7 -0
- package/lib/cjs/embed.d.ts +1 -0
- package/lib/cjs/embed.js +3 -1
- package/lib/cjs/signature.d.ts +5 -1
- package/lib/cjs/signature.js +2 -1
- package/lib/esm/embed.d.ts +1 -0
- package/lib/esm/embed.js +3 -1
- package/lib/esm/signature.d.ts +5 -1
- package/lib/esm/signature.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,5 +90,12 @@ type EmbedSsoDashboardProps = {
|
|
|
90
90
|
// Optional url filter search parameter. Should be the same as the filter search parameters on a dashboard url.
|
|
91
91
|
// 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
|
|
92
92
|
filterSearchParam?: string;
|
|
93
|
+
|
|
94
|
+
// Optional link access setting to control which Omni dashboard links are shown. Note that regardless of the linkAccess value,
|
|
95
|
+
// all non-Omni dashboard links will be shown and allowed in drill menus. Acceptable values include:
|
|
96
|
+
// "__omni_link_access_open": Special string keyword that permisses and shows all Omni dashboard links on the embedded dashboard.
|
|
97
|
+
// "abcd1234,efgh5678,ijkl9999": An allowlist of dashboard IDs that permisses and shows links to the specified dashboards.
|
|
98
|
+
// undefined: If left undefined, the default behavior is to hide and disallow all links to other Omni dashboards on the embedded dashboard.
|
|
99
|
+
linkAccess?: string;
|
|
93
100
|
};
|
|
94
101
|
```
|
package/lib/cjs/embed.d.ts
CHANGED
package/lib/cjs/embed.js
CHANGED
|
@@ -34,7 +34,7 @@ const validateProps = (props) => {
|
|
|
34
34
|
};
|
|
35
35
|
const embedSsoDashboard = async (props) => {
|
|
36
36
|
validateProps(props);
|
|
37
|
-
let { contentId, domain, externalId, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, filterSearchParam, } = props;
|
|
37
|
+
let { contentId, domain, externalId, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, filterSearchParam, linkAccess, } = props;
|
|
38
38
|
// Handle defaults
|
|
39
39
|
nonce = nonce !== null && nonce !== void 0 ? nonce : (await (0, random_str_1.random32ByteString)());
|
|
40
40
|
domain = domain !== null && domain !== void 0 ? domain : defaultEmbedDomain;
|
|
@@ -56,6 +56,7 @@ const embedSsoDashboard = async (props) => {
|
|
|
56
56
|
prefersDark,
|
|
57
57
|
theme,
|
|
58
58
|
filterSearchParam,
|
|
59
|
+
linkAccess,
|
|
59
60
|
});
|
|
60
61
|
// Build and return the signed url
|
|
61
62
|
url.searchParams.append("contentPath", contentPath);
|
|
@@ -69,6 +70,7 @@ const embedSsoDashboard = async (props) => {
|
|
|
69
70
|
theme && url.searchParams.append("theme", theme);
|
|
70
71
|
filterSearchParam &&
|
|
71
72
|
url.searchParams.append("filterSearchParam", filterSearchParam);
|
|
73
|
+
linkAccess && url.searchParams.append("linkAccess", linkAccess);
|
|
72
74
|
return url.toString();
|
|
73
75
|
};
|
|
74
76
|
exports.embedSsoDashboard = embedSsoDashboard;
|
package/lib/cjs/signature.d.ts
CHANGED
|
@@ -51,9 +51,13 @@ type SignatureProps = {
|
|
|
51
51
|
* Filter search parameter.
|
|
52
52
|
*/
|
|
53
53
|
filterSearchParam?: string;
|
|
54
|
+
/**
|
|
55
|
+
* String denoting level of link access.
|
|
56
|
+
*/
|
|
57
|
+
linkAccess?: string;
|
|
54
58
|
};
|
|
55
59
|
export declare const getSignature: ({ secret, ...props }: SignatureProps) => string;
|
|
56
60
|
export declare const TEST_ONLY: {
|
|
57
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, }: Omit<SignatureProps, "secret">) => string;
|
|
61
|
+
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, linkAccess, }: Omit<SignatureProps, "secret">) => string;
|
|
58
62
|
};
|
|
59
63
|
export {};
|
package/lib/cjs/signature.js
CHANGED
|
@@ -13,10 +13,11 @@ const hmacSign = (data, secret) => {
|
|
|
13
13
|
return base64url_1.default.fromBase64(b64);
|
|
14
14
|
};
|
|
15
15
|
exports.hmacSign = hmacSign;
|
|
16
|
-
const generateStringForSignature = ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, }) => {
|
|
16
|
+
const generateStringForSignature = ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, linkAccess, }) => {
|
|
17
17
|
const optionalParams = [];
|
|
18
18
|
entity && optionalParams.push(entity);
|
|
19
19
|
filterSearchParam && optionalParams.push(filterSearchParam);
|
|
20
|
+
linkAccess && optionalParams.push(linkAccess);
|
|
20
21
|
prefersDark && optionalParams.push(prefersDark);
|
|
21
22
|
theme && optionalParams.push(theme);
|
|
22
23
|
userAttributes && optionalParams.push(userAttributes);
|
package/lib/esm/embed.d.ts
CHANGED
package/lib/esm/embed.js
CHANGED
|
@@ -31,7 +31,7 @@ const validateProps = (props) => {
|
|
|
31
31
|
};
|
|
32
32
|
export const embedSsoDashboard = async (props) => {
|
|
33
33
|
validateProps(props);
|
|
34
|
-
let { contentId, domain, externalId, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, filterSearchParam, } = props;
|
|
34
|
+
let { contentId, domain, externalId, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, filterSearchParam, linkAccess, } = props;
|
|
35
35
|
// Handle defaults
|
|
36
36
|
nonce = nonce !== null && nonce !== void 0 ? nonce : (await random32ByteString());
|
|
37
37
|
domain = domain !== null && domain !== void 0 ? domain : defaultEmbedDomain;
|
|
@@ -53,6 +53,7 @@ export const embedSsoDashboard = async (props) => {
|
|
|
53
53
|
prefersDark,
|
|
54
54
|
theme,
|
|
55
55
|
filterSearchParam,
|
|
56
|
+
linkAccess,
|
|
56
57
|
});
|
|
57
58
|
// Build and return the signed url
|
|
58
59
|
url.searchParams.append("contentPath", contentPath);
|
|
@@ -66,5 +67,6 @@ export const embedSsoDashboard = async (props) => {
|
|
|
66
67
|
theme && url.searchParams.append("theme", theme);
|
|
67
68
|
filterSearchParam &&
|
|
68
69
|
url.searchParams.append("filterSearchParam", filterSearchParam);
|
|
70
|
+
linkAccess && url.searchParams.append("linkAccess", linkAccess);
|
|
69
71
|
return url.toString();
|
|
70
72
|
};
|
package/lib/esm/signature.d.ts
CHANGED
|
@@ -51,9 +51,13 @@ type SignatureProps = {
|
|
|
51
51
|
* Filter search parameter.
|
|
52
52
|
*/
|
|
53
53
|
filterSearchParam?: string;
|
|
54
|
+
/**
|
|
55
|
+
* String denoting level of link access.
|
|
56
|
+
*/
|
|
57
|
+
linkAccess?: string;
|
|
54
58
|
};
|
|
55
59
|
export declare const getSignature: ({ secret, ...props }: SignatureProps) => string;
|
|
56
60
|
export declare const TEST_ONLY: {
|
|
57
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, }: Omit<SignatureProps, "secret">) => string;
|
|
61
|
+
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, linkAccess, }: Omit<SignatureProps, "secret">) => string;
|
|
58
62
|
};
|
|
59
63
|
export {};
|
package/lib/esm/signature.js
CHANGED
|
@@ -6,10 +6,11 @@ export const hmacSign = (data, secret) => {
|
|
|
6
6
|
const b64 = hmac.digest("base64");
|
|
7
7
|
return base64url.fromBase64(b64);
|
|
8
8
|
};
|
|
9
|
-
const generateStringForSignature = ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, }) => {
|
|
9
|
+
const generateStringForSignature = ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, linkAccess, }) => {
|
|
10
10
|
const optionalParams = [];
|
|
11
11
|
entity && optionalParams.push(entity);
|
|
12
12
|
filterSearchParam && optionalParams.push(filterSearchParam);
|
|
13
|
+
linkAccess && optionalParams.push(linkAccess);
|
|
13
14
|
prefersDark && optionalParams.push(prefersDark);
|
|
14
15
|
theme && optionalParams.push(theme);
|
|
15
16
|
userAttributes && optionalParams.push(userAttributes);
|
package/package.json
CHANGED