@omni-co/embed 0.18.0 → 0.20.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/esm/embed.js CHANGED
@@ -1,59 +1,59 @@
1
- import { random32ByteString } from "./random-str.server.js";
2
- import { getSignature, signSessionRedemption } from "./signature.js";
3
- import { EmbeddedContent } from "./constants.js";
4
- const defaultEmbedDomain = "embed-omniapp.co";
5
- const embedLoginPath = "/embed/login";
6
- const generateSsoEmbedSessionPath = "/api/unstable/embed/sso/generate-session";
7
- const redeemSsoEmbedSessionPath = "/embed/sso/redeem-session";
1
+ import { random32ByteString } from './random-str.server.js';
2
+ import { getSignature, signSessionRedemption } from './signature.js';
3
+ import { EmbeddedContent } from './constants.js';
4
+ const defaultEmbedDomain = 'embed-omniapp.co';
5
+ const embedLoginPath = '/embed/login';
6
+ const generateSsoEmbedSessionPath = '/api/unstable/embed/sso/generate-session';
7
+ const redeemSsoEmbedSessionPath = '/embed/sso/redeem-session';
8
8
  const createEmbedRequestUrl = (props) => {
9
9
  let host, domain, organizationName;
10
- if ("host" in props)
10
+ if ('host' in props)
11
11
  host = props.host;
12
- if ("organizationName" in props) {
12
+ if ('organizationName' in props) {
13
13
  domain = props.domain;
14
14
  organizationName = props.organizationName;
15
15
  }
16
16
  // Generate the url for the embed login route
17
17
  if (!host)
18
18
  host = `${organizationName}.${domain ?? defaultEmbedDomain}`;
19
- const url = new URL(props.requestPath, `https://${host}${props.port ? `:${props.port}` : ""}`);
19
+ const url = new URL(props.requestPath, `https://${host}${props.port ? `:${props.port}` : ''}`);
20
20
  return url;
21
21
  };
22
22
  const validateProps = (props) => {
23
23
  const { externalId, name, nonce, secret, uiSettings, userAttributes, customTheme, customThemeId, } = props;
24
24
  let host, domain, organizationName;
25
- if ("host" in props)
25
+ if ('host' in props)
26
26
  host = props.host;
27
- if ("organizationName" in props)
27
+ if ('organizationName' in props)
28
28
  organizationName = props.organizationName;
29
- if ("domain" in props)
29
+ if ('domain' in props)
30
30
  domain = props.domain;
31
31
  if (!externalId)
32
- throw new Error("externalId is required");
32
+ throw new Error('externalId is required');
33
33
  if (!name)
34
- throw new Error("name is required");
34
+ throw new Error('name is required');
35
35
  if (!secret)
36
- throw new Error("secret is required");
36
+ throw new Error('secret is required');
37
37
  if (!host && !organizationName)
38
- throw new Error("Must specify either `host` or `organizationName`");
38
+ throw new Error('Must specify either `host` or `organizationName`');
39
39
  if (host && (organizationName || domain))
40
- throw new Error("`host` must be used exclusively and cannot be combined with `organizationName` or `domain` (domain is deprecated)");
40
+ throw new Error('`host` must be used exclusively and cannot be combined with `organizationName` or `domain` (domain is deprecated)');
41
41
  if (customThemeId && customTheme)
42
- console.warn("If you use a `customThemeId` any theme styles passed in via `customTheme` will be ignored.");
42
+ console.warn('If you use a `customThemeId` any theme styles passed in via `customTheme` will be ignored.');
43
43
  if (domain)
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
- throw new Error("nonce must be 32 characters");
47
- if (typeof uiSettings !== "object" && uiSettings)
48
- throw new Error("uiSettings must be an object");
49
- if (typeof userAttributes !== "object" && userAttributes)
50
- throw new Error("userAttributes must be an object");
46
+ throw new Error('nonce must be 32 characters');
47
+ if (typeof uiSettings !== 'object' && uiSettings)
48
+ throw new Error('uiSettings must be an object');
49
+ if (typeof userAttributes !== 'object' && userAttributes)
50
+ throw new Error('userAttributes must be an object');
51
51
  };
52
52
  const embedSsoContent = async (props) => {
53
53
  validateProps(props);
54
- let { accessBoost, branch, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, modelRoles: rawModelRoles, name, nonce, organizationName, preserveEntityFolderContentRole, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
54
+ const { accessBoost, branch, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, modelRoles: rawModelRoles, name, organizationName, preserveEntityFolderContentRole, prefersDark, port, secret, theme, timezone, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
55
55
  // Handle defaults
56
- nonce = nonce ?? (await random32ByteString());
56
+ const nonce = props.nonce ?? (await random32ByteString());
57
57
  const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
58
58
  const userAttributes = rawUserAttributes && JSON.stringify(rawUserAttributes);
59
59
  const customTheme = rawCustomTheme && JSON.stringify(rawCustomTheme);
@@ -96,44 +96,45 @@ const embedSsoContent = async (props) => {
96
96
  prefersDark,
97
97
  preserveEntityFolderContentRole,
98
98
  theme,
99
+ timezone,
99
100
  uiSettings,
100
101
  userAttributes,
101
102
  });
102
103
  // Build and return the signed url
103
- url.searchParams.append("contentPath", contentPath);
104
- url.searchParams.append("externalId", externalId);
105
- url.searchParams.append("name", name);
106
- url.searchParams.append("nonce", nonce);
107
- url.searchParams.append("signature", signature);
108
- userAttributes && url.searchParams.append("userAttributes", userAttributes);
104
+ url.searchParams.append('contentPath', contentPath);
105
+ url.searchParams.append('externalId', externalId);
106
+ url.searchParams.append('name', name);
107
+ url.searchParams.append('nonce', nonce);
108
+ url.searchParams.append('signature', signature);
109
+ userAttributes && url.searchParams.append('userAttributes', userAttributes);
109
110
  accessBoost !== undefined &&
110
- url.searchParams.append("accessBoost", accessBoost.toString());
111
- entity && url.searchParams.append("entity", entity);
112
- prefersDark && url.searchParams.append("prefersDark", prefersDark);
113
- theme && url.searchParams.append("theme", theme);
111
+ url.searchParams.append('accessBoost', accessBoost.toString());
112
+ entity && url.searchParams.append('entity', entity);
113
+ prefersDark && url.searchParams.append('prefersDark', prefersDark);
114
+ theme && url.searchParams.append('theme', theme);
115
+ timezone && url.searchParams.append('timezone', timezone);
114
116
  filterSearchParam &&
115
- url.searchParams.append("filterSearchParam", filterSearchParam);
116
- linkAccess && url.searchParams.append("linkAccess", linkAccess);
117
- customTheme && url.searchParams.append("customTheme", customTheme);
118
- customThemeId && url.searchParams.append("customThemeId", customThemeId);
119
- connectionRoles &&
120
- url.searchParams.append("connectionRoles", connectionRoles);
121
- mode && url.searchParams.append("mode", mode);
122
- modelRoles && url.searchParams.append("modelRoles", modelRoles);
117
+ url.searchParams.append('filterSearchParam', filterSearchParam);
118
+ linkAccess && url.searchParams.append('linkAccess', linkAccess);
119
+ customTheme && url.searchParams.append('customTheme', customTheme);
120
+ customThemeId && url.searchParams.append('customThemeId', customThemeId);
121
+ connectionRoles && url.searchParams.append('connectionRoles', connectionRoles);
122
+ mode && url.searchParams.append('mode', mode);
123
+ modelRoles && url.searchParams.append('modelRoles', modelRoles);
123
124
  entityFolderContentRole &&
124
- url.searchParams.append("entityFolderContentRole", entityFolderContentRole);
125
+ url.searchParams.append('entityFolderContentRole', entityFolderContentRole);
125
126
  entityFolderGroupContentRole &&
126
- url.searchParams.append("entityFolderGroupContentRole", entityFolderGroupContentRole);
127
- groups && url.searchParams.append("groups", groups);
128
- email && url.searchParams.append("email", email);
129
- uiSettings && url.searchParams.append("uiSettings", uiSettings);
127
+ url.searchParams.append('entityFolderGroupContentRole', entityFolderGroupContentRole);
128
+ groups && url.searchParams.append('groups', groups);
129
+ email && url.searchParams.append('email', email);
130
+ uiSettings && url.searchParams.append('uiSettings', uiSettings);
130
131
  entityGroupLabel &&
131
- url.searchParams.append("entityGroupLabel", entityGroupLabel);
132
+ url.searchParams.append('entityGroupLabel', entityGroupLabel);
132
133
  entityFolderLabel &&
133
- url.searchParams.append("entityFolderLabel", entityFolderLabel);
134
+ url.searchParams.append('entityFolderLabel', entityFolderLabel);
134
135
  preserveEntityFolderContentRole !== undefined &&
135
- url.searchParams.append("preserveEntityFolderContentRole", preserveEntityFolderContentRole.toString());
136
- branch && url.searchParams.append("branch", branch);
136
+ url.searchParams.append('preserveEntityFolderContentRole', preserveEntityFolderContentRole.toString());
137
+ branch && url.searchParams.append('branch', branch);
137
138
  return url.toString();
138
139
  };
139
140
  const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
@@ -153,9 +154,7 @@ export const embedSsoWorkbook = async (props) => {
153
154
  export const embedSsoContentDiscovery = async (props) => {
154
155
  // Entity paths for the Content Discovery embed no longer require stripping the leading `/`.
155
156
  // This check maintains backwards compatibility with the old behavior.
156
- const contentPath = props.path.startsWith("/")
157
- ? props.path
158
- : `/${props.path}`;
157
+ const contentPath = props.path.startsWith('/') ? props.path : `/${props.path}`;
159
158
  return embedSsoContent({
160
159
  ...props,
161
160
  contentPath,
@@ -179,13 +178,13 @@ export const createSessionToken = async ({ apiKey, domain, host, organizationNam
179
178
  });
180
179
  // Hit the endpoint with the endpoint params + signature
181
180
  const fetchResponse = await fetch(generateRequestUrl, {
182
- method: "POST",
181
+ method: 'POST',
183
182
  body: JSON.stringify({
184
183
  ...restProps,
185
184
  }),
186
185
  headers: {
187
186
  Authorization: `Bearer ${apiKey}`,
188
- "Content-type": "application/json",
187
+ 'Content-type': 'application/json',
189
188
  },
190
189
  });
191
190
  if (!fetchResponse.ok)
@@ -195,7 +194,7 @@ export const createSessionToken = async ({ apiKey, domain, host, organizationNam
195
194
  };
196
195
  const fetchData = (await fetchResponse.json());
197
196
  if (!fetchData.sessionId)
198
- return { error: "No session ID returned from endpoint.", success: false };
197
+ return { error: 'No session ID returned from endpoint.', success: false };
199
198
  return { sessionToken: fetchData.sessionId, success: true };
200
199
  };
201
200
  /**
@@ -222,13 +221,12 @@ theme, }) => {
222
221
  theme,
223
222
  branch,
224
223
  });
225
- branch !== undefined &&
226
- redeemRequestUrl.searchParams.append("branch", branch);
224
+ branch !== undefined && redeemRequestUrl.searchParams.append('branch', branch);
227
225
  prefersDark !== undefined &&
228
- redeemRequestUrl.searchParams.append("prefersDark", prefersDark);
229
- theme !== undefined && redeemRequestUrl.searchParams.append("theme", theme);
230
- redeemRequestUrl.searchParams.append("nonce", nonce);
231
- redeemRequestUrl.searchParams.append("sessionId", sessionId);
232
- redeemRequestUrl.searchParams.append("signature", signature);
226
+ redeemRequestUrl.searchParams.append('prefersDark', prefersDark);
227
+ theme !== undefined && redeemRequestUrl.searchParams.append('theme', theme);
228
+ redeemRequestUrl.searchParams.append('nonce', nonce);
229
+ redeemRequestUrl.searchParams.append('sessionId', sessionId);
230
+ redeemRequestUrl.searchParams.append('signature', signature);
233
231
  return redeemRequestUrl.toString();
234
232
  };
@@ -1,4 +1,4 @@
1
- export * from "./embed.js";
2
- export * from "./types.js";
3
- export * from "./signature.js";
4
- export * from "./constants.js";
1
+ export * from './embed.js';
2
+ export * from './types.js';
3
+ export * from './signature.js';
4
+ export * from './constants.js';
package/lib/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./embed.js";
2
- export * from "./types.js";
3
- export * from "./signature.js";
4
- export * from "./constants.js";
1
+ export * from './embed.js';
2
+ export * from './types.js';
3
+ export * from './signature.js';
4
+ export * from './constants.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Client / browser entrypoint for the Omni Embed SDK.
3
3
  */
4
- export * from "./constants.js";
5
- export * from "./types.js";
4
+ export * from './constants.js';
5
+ export * from './types.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Client / browser entrypoint for the Omni Embed SDK.
3
3
  */
4
- export * from "./constants.js";
5
- export * from "./types.js";
4
+ export * from './constants.js';
5
+ export * from './types.js';
@@ -1,4 +1,4 @@
1
- import crypto from "crypto";
1
+ import crypto from 'crypto';
2
2
  /**
3
3
  * Generates a random 32 byte, human readable string.
4
4
  * Based on math at https://zelark.github.io/nano-id-cc/
@@ -7,8 +7,8 @@ import crypto from "crypto";
7
7
  * of at least one collision.
8
8
  */
9
9
  export const random32ByteString = async () => {
10
- const humanReadableByteSpace = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
11
- let randomString = "";
10
+ const humanReadableByteSpace = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
11
+ let randomString = '';
12
12
  for (let i = 0; i < 32; i++) {
13
13
  // Generate a random number between 0 and humanReadableByteSpace.length - 1
14
14
  // and return the corresponding character from humanReadableByteSpace.
@@ -1,4 +1,4 @@
1
- import { RedeemSessionExclusiveProps } from "./types.js";
1
+ import { RedeemSessionExclusiveProps } from './types.js';
2
2
  export declare const hmacSign: (data: string, secret: string) => string;
3
3
  type SignatureProps = {
4
4
  /**
@@ -109,6 +109,12 @@ type SignatureProps = {
109
109
  * The theme of the embed.
110
110
  */
111
111
  theme?: string;
112
+ /**
113
+ * IANA timezone override applied to the embed session's query execution.
114
+ *
115
+ * Example: "America/New_York"
116
+ */
117
+ timezone?: string;
112
118
  /**
113
119
  * The UI settings for the embedded content.
114
120
  */
@@ -140,6 +146,6 @@ type SignSessionRedemptionProps = Pick<SignatureProps, RedeemSessionExclusivePro
140
146
  */
141
147
  export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, branch, prefersDark, theme, }: SignSessionRedemptionProps) => string;
142
148
  export declare const TEST_ONLY: {
143
- generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, branch, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
149
+ generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, branch, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, timezone, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
144
150
  };
145
151
  export {};
@@ -1,18 +1,18 @@
1
- import crypto from "crypto";
1
+ import crypto from 'crypto';
2
2
  export const hmacSign = (data, secret) => {
3
- const hmac = crypto.createHmac("sha256", secret);
3
+ const hmac = crypto.createHmac('sha256', secret);
4
4
  hmac.update(data);
5
- return hmac.digest("base64url");
5
+ return hmac.digest('base64url');
6
6
  };
7
7
  const generateStringForSignature = ({
8
8
  // Required parameters
9
9
  loginUrl, contentPath, externalId, name, nonce,
10
10
  // Optional parameters
11
- accessBoost, branch, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }) => {
11
+ accessBoost, branch, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, timezone, uiSettings, userAttributes, }) => {
12
12
  // We create a map of optional params and convert it to an array
13
13
  // to ensure that the order of the optional params is alphabetical and consistent.
14
14
  const optionalParamsMap = {
15
- ...(accessBoost !== undefined && { accessBoost: accessBoost.toString() }),
15
+ ...(accessBoost !== undefined && { accessBoost: accessBoost.toString() }), // need to support accessBoost=false
16
16
  ...(branch && { branch }),
17
17
  ...(connectionRoles && { connectionRoles }),
18
18
  ...(customTheme && { customTheme }),
@@ -33,6 +33,7 @@ accessBoost, branch, connectionRoles, customTheme, customThemeId, email, entity,
33
33
  preserveEntityFolderContentRole: preserveEntityFolderContentRole.toString(),
34
34
  }),
35
35
  ...(theme && { theme }),
36
+ ...(timezone && { timezone }),
36
37
  ...(uiSettings && { uiSettings }),
37
38
  ...(userAttributes && { userAttributes }),
38
39
  };
@@ -47,10 +48,10 @@ accessBoost, branch, connectionRoles, customTheme, customThemeId, email, entity,
47
48
  ${externalId}
48
49
  ${name}
49
50
  ${nonce}
50
- ${optionalParams.join("\n")}
51
+ ${optionalParams.join('\n')}
51
52
  `
52
53
  .trim()
53
- .replace(/\n\s+/g, "\n");
54
+ .replace(/\n\s+/g, '\n');
54
55
  };
55
56
  /**
56
57
  * Creates a signature value for the /embed/login endpoint.
@@ -81,10 +82,10 @@ export const signSessionRedemption = ({ requestUrl, nonce, sessionId, secret, br
81
82
  ${requestUrl}
82
83
  ${nonce}
83
84
  ${sessionId}
84
- ${optionalParams.join("\n")}
85
+ ${optionalParams.join('\n')}
85
86
  `
86
87
  .trim()
87
- .replace(/\n\s+/g, "\n");
88
+ .replace(/\n\s+/g, '\n');
88
89
  return hmacSign(signatureString, secret);
89
90
  };
90
91
  export const TEST_ONLY = {
@@ -1,4 +1,15 @@
1
- import { CustomThemeProperty, EmbedEntityFolderContentRoles, EmbedSessionMode, EmbedUiSettings } from "./constants.js";
1
+ import { EmbedUiSettings } from './constants.js';
2
+ import type { BreadcrumbDisplayMode, CustomThemeProperty, EmbedEntityFolderContentRoles, EmbedSessionMode } from './constants.js';
3
+ /**
4
+ * UI settings object controlling appearance settings of the embed session.
5
+ * Each key is optional; values are booleans except `documentBreadcrumb`, which
6
+ * takes a `BreadcrumbDisplayMode`.
7
+ */
8
+ export type EmbedUiSettingsObject = {
9
+ [EmbedUiSettings.SHOW_NAVIGATION]?: boolean;
10
+ [EmbedUiSettings.DASHBOARD_CHART_CONTEXT_MENU]?: boolean;
11
+ [EmbedUiSettings.DOCUMENT_BREADCRUMB]?: BreadcrumbDisplayMode;
12
+ };
2
13
  type UserAttributeValue = string | string[] | number | number[];
3
14
  type HostProps = ({
4
15
  host?: never;
@@ -39,6 +50,7 @@ type EmbedSsoBaseProps = {
39
50
  userAttributes?: Record<string, UserAttributeValue>;
40
51
  prefersDark?: string;
41
52
  theme?: string;
53
+ timezone?: string;
42
54
  customTheme?: CustomThemeProperties;
43
55
  customThemeId?: string;
44
56
  /**
@@ -109,7 +121,7 @@ type EmbedSsoBaseProps = {
109
121
  email?: string;
110
122
  filterSearchParam?: string;
111
123
  linkAccess?: string;
112
- uiSettings?: Record<EmbedUiSettings, boolean>;
124
+ uiSettings?: EmbedUiSettingsObject;
113
125
  /**
114
126
  * Optional branch setting that sets the model branch of the embed session.
115
127
  */
@@ -188,7 +200,7 @@ export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
188
200
  */
189
201
  path: string;
190
202
  };
191
- export type RedeemSessionExclusiveProps = "branch" | "nonce" | "prefersDark" | "secret" | "theme";
203
+ export type RedeemSessionExclusiveProps = 'branch' | 'nonce' | 'prefersDark' | 'secret' | 'theme';
192
204
  export type CreateSessionTokenProps = Omit<EmbedSsoContentProps, RedeemSessionExclusiveProps> & {
193
205
  apiKey: string;
194
206
  } & HostProps;
package/lib/esm/types.js CHANGED
@@ -1 +1 @@
1
- import { CustomThemeProperty, } from "./constants.js";
1
+ import { EmbedUiSettings } from './constants.js';
@@ -78,5 +78,24 @@ export declare enum EmbedUiSettings {
78
78
  * When false, hides all in-app navigation elements. Note that in-app navigation
79
79
  * is only visible when the embed session is in APPLICATION mode.
80
80
  */
81
- SHOW_NAVIGATION = "showNavigation"
81
+ SHOW_NAVIGATION = "showNavigation",
82
+ /**
83
+ * When false, hides the chart context menu (the per-tile "..." / right-click menu)
84
+ * on advanced-layout dashboards. The menu is hidden in view mode but kept in
85
+ * draft/edit mode so authors can still edit tiles. Defaults to true.
86
+ */
87
+ DASHBOARD_CHART_CONTEXT_MENU = "dashboardChartContextMenu",
88
+ /**
89
+ * Controls the folder-path breadcrumb in the document title header when in
90
+ * APPLICATION mode. Accepts a `BreadcrumbDisplayMode` value. Defaults to "link".
91
+ */
92
+ DOCUMENT_BREADCRUMB = "documentBreadcrumb"
82
93
  }
94
+ /**
95
+ * Display modes for the `documentBreadcrumb` UI setting.
96
+ *
97
+ * "link": breadcrumb shown as clickable links (default behavior).
98
+ * "display": breadcrumb text stays visible but is not a hyperlink.
99
+ * "none": breadcrumb is hidden entirely.
100
+ */
101
+ export type BreadcrumbDisplayMode = 'display' | 'link' | 'none';
@@ -91,4 +91,15 @@ export var EmbedUiSettings;
91
91
  * is only visible when the embed session is in APPLICATION mode.
92
92
  */
93
93
  EmbedUiSettings["SHOW_NAVIGATION"] = "showNavigation";
94
+ /**
95
+ * When false, hides the chart context menu (the per-tile "..." / right-click menu)
96
+ * on advanced-layout dashboards. The menu is hidden in view mode but kept in
97
+ * draft/edit mode so authors can still edit tiles. Defaults to true.
98
+ */
99
+ EmbedUiSettings["DASHBOARD_CHART_CONTEXT_MENU"] = "dashboardChartContextMenu";
100
+ /**
101
+ * Controls the folder-path breadcrumb in the document title header when in
102
+ * APPLICATION mode. Accepts a `BreadcrumbDisplayMode` value. Defaults to "link".
103
+ */
104
+ EmbedUiSettings["DOCUMENT_BREADCRUMB"] = "documentBreadcrumb";
94
105
  })(EmbedUiSettings || (EmbedUiSettings = {}));
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Client / browser entrypoint for the Omni Embed SDK.
3
3
  */
4
- export * from "./constants.js";
5
- export * from "./types.js";
4
+ export * from './constants.js';
5
+ export * from './types.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Client / browser entrypoint for the Omni Embed SDK.
3
3
  */
4
- export * from "./constants.js";
5
- export * from "./types.js";
4
+ export * from './constants.js';
5
+ export * from './types.js';
@@ -1,4 +1,15 @@
1
- import { CustomThemeProperty, EmbedEntityFolderContentRoles, EmbedSessionMode, EmbedUiSettings } from "./constants.js";
1
+ import { EmbedUiSettings } from './constants.js';
2
+ import type { BreadcrumbDisplayMode, CustomThemeProperty, EmbedEntityFolderContentRoles, EmbedSessionMode } from './constants.js';
3
+ /**
4
+ * UI settings object controlling appearance settings of the embed session.
5
+ * Each key is optional; values are booleans except `documentBreadcrumb`, which
6
+ * takes a `BreadcrumbDisplayMode`.
7
+ */
8
+ export type EmbedUiSettingsObject = {
9
+ [EmbedUiSettings.SHOW_NAVIGATION]?: boolean;
10
+ [EmbedUiSettings.DASHBOARD_CHART_CONTEXT_MENU]?: boolean;
11
+ [EmbedUiSettings.DOCUMENT_BREADCRUMB]?: BreadcrumbDisplayMode;
12
+ };
2
13
  type UserAttributeValue = string | string[] | number | number[];
3
14
  type HostProps = ({
4
15
  host?: never;
@@ -39,6 +50,7 @@ type EmbedSsoBaseProps = {
39
50
  userAttributes?: Record<string, UserAttributeValue>;
40
51
  prefersDark?: string;
41
52
  theme?: string;
53
+ timezone?: string;
42
54
  customTheme?: CustomThemeProperties;
43
55
  customThemeId?: string;
44
56
  /**
@@ -109,7 +121,7 @@ type EmbedSsoBaseProps = {
109
121
  email?: string;
110
122
  filterSearchParam?: string;
111
123
  linkAccess?: string;
112
- uiSettings?: Record<EmbedUiSettings, boolean>;
124
+ uiSettings?: EmbedUiSettingsObject;
113
125
  /**
114
126
  * Optional branch setting that sets the model branch of the embed session.
115
127
  */
@@ -188,7 +200,7 @@ export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
188
200
  */
189
201
  path: string;
190
202
  };
191
- export type RedeemSessionExclusiveProps = "branch" | "nonce" | "prefersDark" | "secret" | "theme";
203
+ export type RedeemSessionExclusiveProps = 'branch' | 'nonce' | 'prefersDark' | 'secret' | 'theme';
192
204
  export type CreateSessionTokenProps = Omit<EmbedSsoContentProps, RedeemSessionExclusiveProps> & {
193
205
  apiKey: string;
194
206
  } & HostProps;
@@ -1 +1 @@
1
- import { CustomThemeProperty, } from "./constants.js";
1
+ import { EmbedUiSettings } from './constants.js';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.18.0",
2
+ "version": "0.20.0",
3
3
  "license": "MIT",
4
4
  "name": "@omni-co/embed",
5
5
  "author": "Nate Agrin <nate@exploreomni.com>",
@@ -7,10 +7,16 @@
7
7
  "lib/**/*"
8
8
  ],
9
9
  "devDependencies": {
10
+ "@eslint/js": "^10.0.1",
10
11
  "@types/node": "^20.8.9",
12
+ "eslint": "^10.3.0",
13
+ "eslint-config-prettier": "^10.1.8",
14
+ "globals": "^17.6.0",
15
+ "prettier": "^3.8.3",
11
16
  "semantic-release": "^25.0.2",
12
17
  "typescript": "^5.2.2",
13
- "vitest": "^0.34.6"
18
+ "typescript-eslint": "^8.59.3",
19
+ "vitest": "^4.1.6"
14
20
  },
15
21
  "scripts": {
16
22
  "build": "npm run clean && npm run build:esm && npm run build:cjs && npm run build:omni_internal_browser",
@@ -18,9 +24,15 @@
18
24
  "build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > ./lib/cjs/package.json",
19
25
  "build:omni_internal_browser": "tsc -p tsconfig.omni_internal_browser.json && echo '{\"type\": \"module\"}' > ./lib/omni_internal_browser/package.json",
20
26
  "clean": "rm -rf lib",
27
+ "eslint": "eslint .",
28
+ "eslint:fix": "eslint . --fix",
29
+ "fix": "npm run eslint:fix && npm run prettier:fix",
30
+ "lint": "npm run eslint && npm run prettier",
21
31
  "lint:ts": "tsc -p tsconfig.json --noEmit",
32
+ "prettier": "prettier --check .",
33
+ "prettier:fix": "prettier --write .",
22
34
  "prepublishOnly": "npm run build",
23
- "test": "vitest",
35
+ "test": "vitest run",
24
36
  "test:watch": "vitest --watch"
25
37
  },
26
38
  "engines": {