@omni-co/embed 0.10.0 → 1.0.0-beta.2

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
@@ -1,5 +1,7 @@
1
1
  # Omni Embed SSO Typescript SDK for Server (Node, etc)
2
2
 
3
+ Node.js only SDK for generating signed SSO embed links for Omni dashboards, workbooks, and content discovery pages.
4
+
3
5
  ## Server Side Only
4
6
 
5
7
  **This SDK is intented to be used in a server context.**
package/lib/cjs/embed.js CHANGED
@@ -54,7 +54,7 @@ const validateProps = (props) => {
54
54
  };
55
55
  const embedSsoContent = async (props) => {
56
56
  validateProps(props);
57
- let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, externalId, filterSearchParam, host, linkAccess, mode, name, nonce, organizationName, port, secret, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, entity, prefersDark, theme, entityFolderContentRole, groups: rawGroups, } = props;
57
+ let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, name, nonce, organizationName, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
58
58
  // Handle defaults
59
59
  nonce = nonce !== null && nonce !== void 0 ? nonce : (await (0, random_str_1.random32ByteString)());
60
60
  const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
@@ -86,6 +86,8 @@ const embedSsoContent = async (props) => {
86
86
  email,
87
87
  entity,
88
88
  entityFolderContentRole,
89
+ entityFolderLabel,
90
+ entityGroupLabel,
89
91
  filterSearchParam,
90
92
  groups,
91
93
  linkAccess,
@@ -120,6 +122,10 @@ const embedSsoContent = async (props) => {
120
122
  groups && url.searchParams.append("groups", groups);
121
123
  email && url.searchParams.append("email", email);
122
124
  uiSettings && url.searchParams.append("uiSettings", uiSettings);
125
+ entityGroupLabel &&
126
+ url.searchParams.append("entityGroupLabel", entityGroupLabel);
127
+ entityFolderLabel &&
128
+ url.searchParams.append("entityFolderLabel", entityFolderLabel);
123
129
  return url.toString();
124
130
  };
125
131
  const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
@@ -58,6 +58,14 @@ type SignatureProps = {
58
58
  * The content role for the embed user on the entity folder.
59
59
  */
60
60
  entityFolderContentRole?: string;
61
+ /**
62
+ * The label for the generated entity folder.
63
+ */
64
+ entityFolderLabel?: string;
65
+ /**
66
+ * The label for the generated entity group.
67
+ */
68
+ entityGroupLabel?: string;
61
69
  /**
62
70
  * Filter search parameter.
63
71
  */
@@ -113,6 +121,6 @@ type SignSessionRedemptionProps = Pick<SignatureProps, "nonce" | "prefersDark" |
113
121
  */
114
122
  export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }: SignSessionRedemptionProps) => string;
115
123
  export declare const TEST_ONLY: {
116
- generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
124
+ generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
117
125
  };
118
126
  export {};
@@ -17,7 +17,7 @@ const generateStringForSignature = ({
17
17
  // Required parameters
18
18
  loginUrl, contentPath, externalId, name, nonce,
19
19
  // Optional parameters
20
- accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }) => {
20
+ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, 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 = {
@@ -28,6 +28,8 @@ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityF
28
28
  ...(email && { email }),
29
29
  ...(entity && { entity }),
30
30
  ...(entityFolderContentRole && { entityFolderContentRole }),
31
+ ...(entityFolderLabel && { entityFolderLabel }),
32
+ ...(entityGroupLabel && { entityGroupLabel }),
31
33
  ...(filterSearchParam && { filterSearchParam }),
32
34
  ...(groups && { groups }),
33
35
  ...(linkAccess && { linkAccess }),
@@ -64,6 +64,16 @@ type EmbedSsoBaseProps = {
64
64
  * VIEWER: the user will only be able to view content in the entity folder.
65
65
  */
66
66
  entityFolderContentRole?: EmbedEntityFolderContentRoles;
67
+ /**
68
+ * Optional setting that customizes the generated entity folder label. This only affects the entity folder
69
+ * corresponding to the `entity` parameter value in the relevant generated SSO embed URL.
70
+ */
71
+ entityFolderLabel?: string;
72
+ /**
73
+ * Optional setting that customizes the generated entity group label. This only affects the entity group
74
+ * corresponding to the `entity` parameter value in the relevant generated SSO embed URL.
75
+ */
76
+ entityGroupLabel?: string;
67
77
  /**
68
78
  * Optional groups setting. An array of group names that the user will be added to.
69
79
  */
package/lib/esm/embed.js CHANGED
@@ -51,7 +51,7 @@ const validateProps = (props) => {
51
51
  };
52
52
  const embedSsoContent = async (props) => {
53
53
  validateProps(props);
54
- let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, externalId, filterSearchParam, host, linkAccess, mode, name, nonce, organizationName, port, secret, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, entity, prefersDark, theme, entityFolderContentRole, groups: rawGroups, } = props;
54
+ let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, domain, email, entity, entityFolderContentRole, entityFolderLabel, entityGroupLabel, externalId, filterSearchParam, groups: rawGroups, host, linkAccess, mode, name, nonce, organizationName, prefersDark, port, secret, theme, uiSettings: rawUiSettings, userAttributes: rawUserAttributes, } = props;
55
55
  // Handle defaults
56
56
  nonce = nonce !== null && nonce !== void 0 ? nonce : (await random32ByteString());
57
57
  const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
@@ -83,6 +83,8 @@ const embedSsoContent = async (props) => {
83
83
  email,
84
84
  entity,
85
85
  entityFolderContentRole,
86
+ entityFolderLabel,
87
+ entityGroupLabel,
86
88
  filterSearchParam,
87
89
  groups,
88
90
  linkAccess,
@@ -117,6 +119,10 @@ const embedSsoContent = async (props) => {
117
119
  groups && url.searchParams.append("groups", groups);
118
120
  email && url.searchParams.append("email", email);
119
121
  uiSettings && url.searchParams.append("uiSettings", uiSettings);
122
+ entityGroupLabel &&
123
+ url.searchParams.append("entityGroupLabel", entityGroupLabel);
124
+ entityFolderLabel &&
125
+ url.searchParams.append("entityFolderLabel", entityFolderLabel);
120
126
  return url.toString();
121
127
  };
122
128
  const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
@@ -58,6 +58,14 @@ type SignatureProps = {
58
58
  * The content role for the embed user on the entity folder.
59
59
  */
60
60
  entityFolderContentRole?: string;
61
+ /**
62
+ * The label for the generated entity folder.
63
+ */
64
+ entityFolderLabel?: string;
65
+ /**
66
+ * The label for the generated entity group.
67
+ */
68
+ entityGroupLabel?: string;
61
69
  /**
62
70
  * Filter search parameter.
63
71
  */
@@ -113,6 +121,6 @@ type SignSessionRedemptionProps = Pick<SignatureProps, "nonce" | "prefersDark" |
113
121
  */
114
122
  export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }: SignSessionRedemptionProps) => string;
115
123
  export declare const TEST_ONLY: {
116
- generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
124
+ generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
117
125
  };
118
126
  export {};
@@ -10,7 +10,7 @@ const generateStringForSignature = ({
10
10
  // Required parameters
11
11
  loginUrl, contentPath, externalId, name, nonce,
12
12
  // Optional parameters
13
- accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, userAttributes, }) => {
13
+ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, prefersDark, theme, uiSettings, 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 = {
@@ -21,6 +21,8 @@ accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityF
21
21
  ...(email && { email }),
22
22
  ...(entity && { entity }),
23
23
  ...(entityFolderContentRole && { entityFolderContentRole }),
24
+ ...(entityFolderLabel && { entityFolderLabel }),
25
+ ...(entityGroupLabel && { entityGroupLabel }),
24
26
  ...(filterSearchParam && { filterSearchParam }),
25
27
  ...(groups && { groups }),
26
28
  ...(linkAccess && { linkAccess }),
@@ -64,6 +64,16 @@ type EmbedSsoBaseProps = {
64
64
  * VIEWER: the user will only be able to view content in the entity folder.
65
65
  */
66
66
  entityFolderContentRole?: EmbedEntityFolderContentRoles;
67
+ /**
68
+ * Optional setting that customizes the generated entity folder label. This only affects the entity folder
69
+ * corresponding to the `entity` parameter value in the relevant generated SSO embed URL.
70
+ */
71
+ entityFolderLabel?: string;
72
+ /**
73
+ * Optional setting that customizes the generated entity group label. This only affects the entity group
74
+ * corresponding to the `entity` parameter value in the relevant generated SSO embed URL.
75
+ */
76
+ entityGroupLabel?: string;
67
77
  /**
68
78
  * Optional groups setting. An array of group names that the user will be added to.
69
79
  */
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.10.0",
2
+ "version": "1.0.0-beta.2",
3
3
  "license": "MIT",
4
4
  "name": "@omni-co/embed",
5
5
  "author": "Nate Agrin <nate@exploreomni.com>",
@@ -27,6 +27,8 @@
27
27
  "node": ">=16"
28
28
  },
29
29
  "engineStrict": true,
30
+ "main": "./lib/cjs/index.js",
31
+ "type": "module",
30
32
  "types": "./lib/esm/index.d.ts",
31
33
  "exports": {
32
34
  ".": {