@omni-co/embed 0.3.2 → 0.3.4

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 CHANGED
@@ -86,5 +86,12 @@ 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;
93
+
94
+ // Optional link access setting. Should either be undefined for closed link access or "__omni_link_access_open" for open link access.
95
+ linkAccess?: string;
89
96
  };
90
97
  ```
@@ -10,6 +10,7 @@ type EmbedSsoProps = {
10
10
  prefersDark?: string;
11
11
  theme?: string;
12
12
  filterSearchParam?: string;
13
+ linkAccess?: string;
13
14
  domain?: string;
14
15
  nonce?: string;
15
16
  port?: number;
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;
@@ -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 {};
@@ -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);
@@ -10,6 +10,7 @@ type EmbedSsoProps = {
10
10
  prefersDark?: string;
11
11
  theme?: string;
12
12
  filterSearchParam?: string;
13
+ linkAccess?: string;
13
14
  domain?: string;
14
15
  nonce?: string;
15
16
  port?: number;
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
  };
@@ -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 {};
@@ -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
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.2",
2
+ "version": "0.3.4",
3
3
  "license": "MIT",
4
4
  "name": "@omni-co/embed",
5
5
  "author": "Nate Agrin <nate@exploreomni.com>",