@omni-co/embed 0.3.19 → 0.3.20

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 CHANGED
@@ -31,7 +31,7 @@ const validateProps = (props) => {
31
31
  };
32
32
  const embedSsoContent = async (props) => {
33
33
  validateProps(props);
34
- let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, domain, externalId, filterSearchParam, linkAccess, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, } = props;
34
+ let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, domain, externalId, filterSearchParam, linkAccess, mode, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, } = props;
35
35
  // Handle defaults
36
36
  nonce = nonce !== null && nonce !== void 0 ? nonce : (await (0, random_str_1.random32ByteString)());
37
37
  domain = domain !== null && domain !== void 0 ? domain : defaultEmbedDomain;
@@ -57,6 +57,7 @@ const embedSsoContent = async (props) => {
57
57
  customTheme,
58
58
  connectionRoles,
59
59
  accessBoost,
60
+ mode,
60
61
  });
61
62
  // Build and return the signed url
62
63
  url.searchParams.append("contentPath", contentPath);
@@ -75,6 +76,7 @@ const embedSsoContent = async (props) => {
75
76
  customTheme && url.searchParams.append("customTheme", customTheme);
76
77
  connectionRoles &&
77
78
  url.searchParams.append("connectionRoles", connectionRoles);
79
+ mode && url.searchParams.append("mode", mode);
78
80
  return url.toString();
79
81
  };
80
82
  const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
@@ -55,6 +55,10 @@ type SignatureProps = {
55
55
  * String denoting level of link access.
56
56
  */
57
57
  linkAccess?: string;
58
+ /**
59
+ * The mode of the embedded content.
60
+ */
61
+ mode?: string;
58
62
  /**
59
63
  * Whether the user prefers light, dark, or system theme.
60
64
  */
@@ -72,6 +76,6 @@ type SignatureProps = {
72
76
  };
73
77
  export declare const getSignature: ({ secret, ...props }: SignatureProps) => string;
74
78
  export declare const TEST_ONLY: {
75
- generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, connectionRoles, customTheme, entity, filterSearchParam, linkAccess, prefersDark, theme, userAttributes, accessBoost, }: Omit<SignatureProps, "secret">) => string;
79
+ generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, entity, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
76
80
  };
77
81
  export {};
@@ -17,7 +17,7 @@ const generateStringForSignature = ({
17
17
  // Required parameters
18
18
  loginUrl, contentPath, externalId, name, nonce,
19
19
  // Optional parameters
20
- connectionRoles, customTheme, entity, filterSearchParam, linkAccess, prefersDark, theme, userAttributes, accessBoost, }) => {
20
+ accessBoost, connectionRoles, customTheme, entity, filterSearchParam, 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 = {
@@ -27,6 +27,7 @@ connectionRoles, customTheme, entity, filterSearchParam, linkAccess, prefersDark
27
27
  ...(entity && { entity }),
28
28
  ...(filterSearchParam && { filterSearchParam }),
29
29
  ...(linkAccess && { linkAccess }),
30
+ ...(mode && { mode }),
30
31
  ...(prefersDark && { prefersDark }),
31
32
  ...(theme && { theme }),
32
33
  ...(userAttributes && { userAttributes }),
@@ -1,4 +1,8 @@
1
1
  type UserAttributeValue = string | string[] | number | number[];
2
+ export declare enum EmbedSessionMode {
3
+ Application = "APPLICATION",
4
+ SingleContent = "SINGLE_CONTENT"
5
+ }
2
6
  type EmbedSsoBaseProps = {
3
7
  externalId: string;
4
8
  name: string;
@@ -8,6 +12,17 @@ type EmbedSsoBaseProps = {
8
12
  userAttributes?: Record<string, UserAttributeValue>;
9
13
  prefersDark?: string;
10
14
  theme?: string;
15
+ /**
16
+ * Optional connection roles setting. Object keys should be connection IDs from the embedded Omni instance.
17
+ * Object values should be connection roles. At the moment, the only valid role string is "RESTRICTED_QUERIER".
18
+ */
19
+ connectionRoles?: Record<string, EmbedConnectionRoles>;
20
+ /**
21
+ * Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
22
+ * If EmbedSessionMode.Application is selected, the entire application will be embedded. If EmbedSessionMode.SingleContent is selected,
23
+ * only the content specified in the contentId will be embedded.
24
+ */
25
+ mode?: EmbedSessionMode;
11
26
  domain?: string;
12
27
  nonce?: string;
13
28
  port?: number;
@@ -24,9 +39,6 @@ type EmbedContentIdProp = {
24
39
  type EmbedContentPathProp = {
25
40
  contentPath: string;
26
41
  };
27
- type EmbedConnectionRolesProp = {
28
- connectionRoles: Record<string, EmbedConnectionRoles>;
29
- };
30
42
  export declare enum CustomThemeProperty {
31
43
  DASHBOARD_BACKGROUND = "dashboard-background",
32
44
  DASHBOARD_TILE_BACKGROUND = "dashboard-tile-background",
@@ -76,13 +88,18 @@ export type EmbedSsoContentDiscoveryPath = (typeof EmbedSsoContentDiscoveryPaths
76
88
  export declare enum EmbedConnectionRoles {
77
89
  RESTRICTED_QUERIER = "RESTRICTED_QUERIER"
78
90
  }
79
- export type EmbedSsoContentProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProps & EmbedContentPathProp & Partial<EmbedConnectionRolesProp>;
91
+ export type EmbedSsoContentProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProps & EmbedContentPathProp;
80
92
  /**
81
93
  * Consumers of this SDK will rely on these three types to embed workbooks and dashboards.
82
94
  */
83
95
  export type EmbedSsoDashboardProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProps & EmbedContentIdProp;
84
96
  export type EmbedSsoWorkbookProps = EmbedSsoBaseProps & EmbedContentIdProp;
85
- export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & EmbedConnectionRolesProp & {
97
+ export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
98
+ /**
99
+ * Required connection roles object. Object keys should be connection IDs from the embedded Omni instance.
100
+ * Object values should be connection roles. At the moment, the only valid role string is "RESTRICTED_QUERIER".
101
+ */
102
+ connectionRoles: Record<string, EmbedConnectionRoles>;
86
103
  /**
87
104
  * Path name of the content discovery page to embed.
88
105
  */
package/lib/cjs/types.js CHANGED
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmbedConnectionRoles = exports.EmbedSsoContentDiscoveryPaths = exports.EmbeddedContent = exports.CustomThemeProperty = void 0;
3
+ exports.EmbedConnectionRoles = exports.EmbedSsoContentDiscoveryPaths = exports.EmbeddedContent = exports.CustomThemeProperty = exports.EmbedSessionMode = void 0;
4
+ var EmbedSessionMode;
5
+ (function (EmbedSessionMode) {
6
+ EmbedSessionMode["Application"] = "APPLICATION";
7
+ EmbedSessionMode["SingleContent"] = "SINGLE_CONTENT";
8
+ })(EmbedSessionMode || (exports.EmbedSessionMode = EmbedSessionMode = {}));
4
9
  var CustomThemeProperty;
5
10
  (function (CustomThemeProperty) {
6
11
  CustomThemeProperty["DASHBOARD_BACKGROUND"] = "dashboard-background";
package/lib/esm/embed.js CHANGED
@@ -28,7 +28,7 @@ const validateProps = (props) => {
28
28
  };
29
29
  const embedSsoContent = async (props) => {
30
30
  validateProps(props);
31
- let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, domain, externalId, filterSearchParam, linkAccess, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, } = props;
31
+ let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, domain, externalId, filterSearchParam, linkAccess, mode, name, nonce, organizationName, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, } = props;
32
32
  // Handle defaults
33
33
  nonce = nonce !== null && nonce !== void 0 ? nonce : (await random32ByteString());
34
34
  domain = domain !== null && domain !== void 0 ? domain : defaultEmbedDomain;
@@ -54,6 +54,7 @@ const embedSsoContent = async (props) => {
54
54
  customTheme,
55
55
  connectionRoles,
56
56
  accessBoost,
57
+ mode,
57
58
  });
58
59
  // Build and return the signed url
59
60
  url.searchParams.append("contentPath", contentPath);
@@ -72,6 +73,7 @@ const embedSsoContent = async (props) => {
72
73
  customTheme && url.searchParams.append("customTheme", customTheme);
73
74
  connectionRoles &&
74
75
  url.searchParams.append("connectionRoles", connectionRoles);
76
+ mode && url.searchParams.append("mode", mode);
75
77
  return url.toString();
76
78
  };
77
79
  const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
@@ -55,6 +55,10 @@ type SignatureProps = {
55
55
  * String denoting level of link access.
56
56
  */
57
57
  linkAccess?: string;
58
+ /**
59
+ * The mode of the embedded content.
60
+ */
61
+ mode?: string;
58
62
  /**
59
63
  * Whether the user prefers light, dark, or system theme.
60
64
  */
@@ -72,6 +76,6 @@ type SignatureProps = {
72
76
  };
73
77
  export declare const getSignature: ({ secret, ...props }: SignatureProps) => string;
74
78
  export declare const TEST_ONLY: {
75
- generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, connectionRoles, customTheme, entity, filterSearchParam, linkAccess, prefersDark, theme, userAttributes, accessBoost, }: Omit<SignatureProps, "secret">) => string;
79
+ generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, entity, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
76
80
  };
77
81
  export {};
@@ -10,7 +10,7 @@ const generateStringForSignature = ({
10
10
  // Required parameters
11
11
  loginUrl, contentPath, externalId, name, nonce,
12
12
  // Optional parameters
13
- connectionRoles, customTheme, entity, filterSearchParam, linkAccess, prefersDark, theme, userAttributes, accessBoost, }) => {
13
+ accessBoost, connectionRoles, customTheme, entity, filterSearchParam, 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 = {
@@ -20,6 +20,7 @@ connectionRoles, customTheme, entity, filterSearchParam, linkAccess, prefersDark
20
20
  ...(entity && { entity }),
21
21
  ...(filterSearchParam && { filterSearchParam }),
22
22
  ...(linkAccess && { linkAccess }),
23
+ ...(mode && { mode }),
23
24
  ...(prefersDark && { prefersDark }),
24
25
  ...(theme && { theme }),
25
26
  ...(userAttributes && { userAttributes }),
@@ -1,4 +1,8 @@
1
1
  type UserAttributeValue = string | string[] | number | number[];
2
+ export declare enum EmbedSessionMode {
3
+ Application = "APPLICATION",
4
+ SingleContent = "SINGLE_CONTENT"
5
+ }
2
6
  type EmbedSsoBaseProps = {
3
7
  externalId: string;
4
8
  name: string;
@@ -8,6 +12,17 @@ type EmbedSsoBaseProps = {
8
12
  userAttributes?: Record<string, UserAttributeValue>;
9
13
  prefersDark?: string;
10
14
  theme?: string;
15
+ /**
16
+ * Optional connection roles setting. Object keys should be connection IDs from the embedded Omni instance.
17
+ * Object values should be connection roles. At the moment, the only valid role string is "RESTRICTED_QUERIER".
18
+ */
19
+ connectionRoles?: Record<string, EmbedConnectionRoles>;
20
+ /**
21
+ * Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
22
+ * If EmbedSessionMode.Application is selected, the entire application will be embedded. If EmbedSessionMode.SingleContent is selected,
23
+ * only the content specified in the contentId will be embedded.
24
+ */
25
+ mode?: EmbedSessionMode;
11
26
  domain?: string;
12
27
  nonce?: string;
13
28
  port?: number;
@@ -24,9 +39,6 @@ type EmbedContentIdProp = {
24
39
  type EmbedContentPathProp = {
25
40
  contentPath: string;
26
41
  };
27
- type EmbedConnectionRolesProp = {
28
- connectionRoles: Record<string, EmbedConnectionRoles>;
29
- };
30
42
  export declare enum CustomThemeProperty {
31
43
  DASHBOARD_BACKGROUND = "dashboard-background",
32
44
  DASHBOARD_TILE_BACKGROUND = "dashboard-tile-background",
@@ -76,13 +88,18 @@ export type EmbedSsoContentDiscoveryPath = (typeof EmbedSsoContentDiscoveryPaths
76
88
  export declare enum EmbedConnectionRoles {
77
89
  RESTRICTED_QUERIER = "RESTRICTED_QUERIER"
78
90
  }
79
- export type EmbedSsoContentProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProps & EmbedContentPathProp & Partial<EmbedConnectionRolesProp>;
91
+ export type EmbedSsoContentProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProps & EmbedContentPathProp;
80
92
  /**
81
93
  * Consumers of this SDK will rely on these three types to embed workbooks and dashboards.
82
94
  */
83
95
  export type EmbedSsoDashboardProps = EmbedSsoBaseProps & EmbedSsoDashboardOnlyProps & EmbedContentIdProp;
84
96
  export type EmbedSsoWorkbookProps = EmbedSsoBaseProps & EmbedContentIdProp;
85
- export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & EmbedConnectionRolesProp & {
97
+ export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
98
+ /**
99
+ * Required connection roles object. Object keys should be connection IDs from the embedded Omni instance.
100
+ * Object values should be connection roles. At the moment, the only valid role string is "RESTRICTED_QUERIER".
101
+ */
102
+ connectionRoles: Record<string, EmbedConnectionRoles>;
86
103
  /**
87
104
  * Path name of the content discovery page to embed.
88
105
  */
package/lib/esm/types.js CHANGED
@@ -1,3 +1,8 @@
1
+ export var EmbedSessionMode;
2
+ (function (EmbedSessionMode) {
3
+ EmbedSessionMode["Application"] = "APPLICATION";
4
+ EmbedSessionMode["SingleContent"] = "SINGLE_CONTENT";
5
+ })(EmbedSessionMode || (EmbedSessionMode = {}));
1
6
  export var CustomThemeProperty;
2
7
  (function (CustomThemeProperty) {
3
8
  CustomThemeProperty["DASHBOARD_BACKGROUND"] = "dashboard-background";
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.19",
2
+ "version": "0.3.20",
3
3
  "license": "MIT",
4
4
  "name": "@omni-co/embed",
5
5
  "author": "Nate Agrin <nate@exploreomni.com>",