@omni-co/embed 0.3.1 → 0.3.3
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 +4 -0
- package/lib/cjs/embed.d.ts +1 -0
- package/lib/cjs/embed.js +4 -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 +4 -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
|
@@ -86,5 +86,9 @@ type EmbedSsoDashboardProps = {
|
|
|
86
86
|
|
|
87
87
|
// Optional theme setting. Can be one of "dawn", "vibes", "breeze" or "blank".
|
|
88
88
|
theme?: string;
|
|
89
|
+
|
|
90
|
+
// Optional url filter search parameter. Should be the same as the filter search parameters on a dashboard url.
|
|
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
|
+
filterSearchParam?: string;
|
|
89
93
|
};
|
|
90
94
|
```
|
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, } = props;
|
|
37
|
+
let { contentId, domain, externalId, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, filterSearchParam, } = 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;
|
|
@@ -55,6 +55,7 @@ const embedSsoDashboard = async (props) => {
|
|
|
55
55
|
entity,
|
|
56
56
|
prefersDark,
|
|
57
57
|
theme,
|
|
58
|
+
filterSearchParam,
|
|
58
59
|
});
|
|
59
60
|
// Build and return the signed url
|
|
60
61
|
url.searchParams.append("contentPath", contentPath);
|
|
@@ -66,6 +67,8 @@ const embedSsoDashboard = async (props) => {
|
|
|
66
67
|
entity && url.searchParams.append("entity", entity);
|
|
67
68
|
prefersDark && url.searchParams.append("prefersDark", prefersDark);
|
|
68
69
|
theme && url.searchParams.append("theme", theme);
|
|
70
|
+
filterSearchParam &&
|
|
71
|
+
url.searchParams.append("filterSearchParam", filterSearchParam);
|
|
69
72
|
return url.toString();
|
|
70
73
|
};
|
|
71
74
|
exports.embedSsoDashboard = embedSsoDashboard;
|
package/lib/cjs/signature.d.ts
CHANGED
|
@@ -47,9 +47,13 @@ type SignatureProps = {
|
|
|
47
47
|
* The theme of the embed.
|
|
48
48
|
*/
|
|
49
49
|
theme?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Filter search parameter.
|
|
52
|
+
*/
|
|
53
|
+
filterSearchParam?: string;
|
|
50
54
|
};
|
|
51
55
|
export declare const getSignature: ({ secret, ...props }: SignatureProps) => string;
|
|
52
56
|
export declare const TEST_ONLY: {
|
|
53
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, }: Omit<SignatureProps, "secret">) => string;
|
|
57
|
+
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, }: Omit<SignatureProps, "secret">) => string;
|
|
54
58
|
};
|
|
55
59
|
export {};
|
package/lib/cjs/signature.js
CHANGED
|
@@ -13,9 +13,10 @@ 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, }) => {
|
|
16
|
+
const generateStringForSignature = ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, }) => {
|
|
17
17
|
const optionalParams = [];
|
|
18
18
|
entity && optionalParams.push(entity);
|
|
19
|
+
filterSearchParam && optionalParams.push(filterSearchParam);
|
|
19
20
|
prefersDark && optionalParams.push(prefersDark);
|
|
20
21
|
theme && optionalParams.push(theme);
|
|
21
22
|
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, } = props;
|
|
34
|
+
let { contentId, domain, externalId, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, filterSearchParam, } = 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;
|
|
@@ -52,6 +52,7 @@ export const embedSsoDashboard = async (props) => {
|
|
|
52
52
|
entity,
|
|
53
53
|
prefersDark,
|
|
54
54
|
theme,
|
|
55
|
+
filterSearchParam,
|
|
55
56
|
});
|
|
56
57
|
// Build and return the signed url
|
|
57
58
|
url.searchParams.append("contentPath", contentPath);
|
|
@@ -63,5 +64,7 @@ export const embedSsoDashboard = async (props) => {
|
|
|
63
64
|
entity && url.searchParams.append("entity", entity);
|
|
64
65
|
prefersDark && url.searchParams.append("prefersDark", prefersDark);
|
|
65
66
|
theme && url.searchParams.append("theme", theme);
|
|
67
|
+
filterSearchParam &&
|
|
68
|
+
url.searchParams.append("filterSearchParam", filterSearchParam);
|
|
66
69
|
return url.toString();
|
|
67
70
|
};
|
package/lib/esm/signature.d.ts
CHANGED
|
@@ -47,9 +47,13 @@ type SignatureProps = {
|
|
|
47
47
|
* The theme of the embed.
|
|
48
48
|
*/
|
|
49
49
|
theme?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Filter search parameter.
|
|
52
|
+
*/
|
|
53
|
+
filterSearchParam?: string;
|
|
50
54
|
};
|
|
51
55
|
export declare const getSignature: ({ secret, ...props }: SignatureProps) => string;
|
|
52
56
|
export declare const TEST_ONLY: {
|
|
53
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, }: Omit<SignatureProps, "secret">) => string;
|
|
57
|
+
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, }: Omit<SignatureProps, "secret">) => string;
|
|
54
58
|
};
|
|
55
59
|
export {};
|
package/lib/esm/signature.js
CHANGED
|
@@ -6,9 +6,10 @@ 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, }) => {
|
|
9
|
+
const generateStringForSignature = ({ loginUrl, contentPath, externalId, name, nonce, userAttributes, entity, prefersDark, theme, filterSearchParam, }) => {
|
|
10
10
|
const optionalParams = [];
|
|
11
11
|
entity && optionalParams.push(entity);
|
|
12
|
+
filterSearchParam && optionalParams.push(filterSearchParam);
|
|
12
13
|
prefersDark && optionalParams.push(prefersDark);
|
|
13
14
|
theme && optionalParams.push(theme);
|
|
14
15
|
userAttributes && optionalParams.push(userAttributes);
|
package/package.json
CHANGED