@omni-co/embed 0.15.0 → 0.16.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/cjs/embed.d.ts +1 -1
- package/lib/cjs/embed.js +7 -2
- package/lib/cjs/signature.d.ts +8 -3
- package/lib/cjs/signature.js +4 -2
- package/lib/cjs/types.d.ts +20 -14
- package/lib/esm/embed.d.ts +1 -1
- package/lib/esm/embed.js +7 -2
- package/lib/esm/signature.d.ts +8 -3
- package/lib/esm/signature.js +4 -2
- package/lib/esm/types.d.ts +20 -14
- package/lib/omni_internal_browser/types.d.ts +20 -14
- package/package.json +1 -1
package/lib/cjs/embed.d.ts
CHANGED
|
@@ -29,4 +29,4 @@ export declare const createSessionToken: ({ apiKey, domain, host, organizationNa
|
|
|
29
29
|
* to output an session redemption URL that can be used to display embedded content.
|
|
30
30
|
* The returned URL should be passed into an `iframe`'s src attribute.
|
|
31
31
|
*/
|
|
32
|
-
export declare const redeemSessionToken: ({ domain, host, organizationName, port, nonce: propsNonce, secret, prefersDark, sessionToken: sessionId, theme, }: RedeemSessionTokenProps) => Promise<string>;
|
|
32
|
+
export declare const redeemSessionToken: ({ branch, domain, host, organizationName, port, nonce: propsNonce, secret, prefersDark, sessionToken: sessionId, theme, }: RedeemSessionTokenProps) => Promise<string>;
|
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, 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;
|
|
57
|
+
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;
|
|
58
58
|
// Handle defaults
|
|
59
59
|
nonce = nonce ?? (await (0, random_str_js_1.random32ByteString)());
|
|
60
60
|
const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
|
|
@@ -81,6 +81,7 @@ const embedSsoContent = async (props) => {
|
|
|
81
81
|
secret,
|
|
82
82
|
// Optional parameters
|
|
83
83
|
accessBoost,
|
|
84
|
+
branch,
|
|
84
85
|
connectionRoles,
|
|
85
86
|
customTheme,
|
|
86
87
|
customThemeId,
|
|
@@ -135,6 +136,7 @@ const embedSsoContent = async (props) => {
|
|
|
135
136
|
url.searchParams.append("entityFolderLabel", entityFolderLabel);
|
|
136
137
|
preserveEntityFolderContentRole !== undefined &&
|
|
137
138
|
url.searchParams.append("preserveEntityFolderContentRole", preserveEntityFolderContentRole.toString());
|
|
139
|
+
branch && url.searchParams.append("branch", branch);
|
|
138
140
|
return url.toString();
|
|
139
141
|
};
|
|
140
142
|
const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
|
|
@@ -208,7 +210,7 @@ exports.createSessionToken = createSessionToken;
|
|
|
208
210
|
* to output an session redemption URL that can be used to display embedded content.
|
|
209
211
|
* The returned URL should be passed into an `iframe`'s src attribute.
|
|
210
212
|
*/
|
|
211
|
-
const redeemSessionToken = async ({ domain, host, organizationName, port, nonce: propsNonce, secret, prefersDark, sessionToken: sessionId, // sessionToken is just a facade for the sessionId
|
|
213
|
+
const redeemSessionToken = async ({ branch, domain, host, organizationName, port, nonce: propsNonce, secret, prefersDark, sessionToken: sessionId, // sessionToken is just a facade for the sessionId
|
|
212
214
|
theme, }) => {
|
|
213
215
|
const redeemRequestUrl = createEmbedRequestUrl({
|
|
214
216
|
domain,
|
|
@@ -225,7 +227,10 @@ theme, }) => {
|
|
|
225
227
|
sessionId,
|
|
226
228
|
secret,
|
|
227
229
|
theme,
|
|
230
|
+
branch,
|
|
228
231
|
});
|
|
232
|
+
branch !== undefined &&
|
|
233
|
+
redeemRequestUrl.searchParams.append("branch", branch);
|
|
229
234
|
prefersDark !== undefined &&
|
|
230
235
|
redeemRequestUrl.searchParams.append("prefersDark", prefersDark);
|
|
231
236
|
theme !== undefined && redeemRequestUrl.searchParams.append("theme", theme);
|
package/lib/cjs/signature.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RedeemSessionExclusiveProps } from "./types.js";
|
|
1
2
|
export declare const hmacSign: (data: string, secret: string) => string;
|
|
2
3
|
type SignatureProps = {
|
|
3
4
|
/**
|
|
@@ -32,6 +33,10 @@ type SignatureProps = {
|
|
|
32
33
|
* The access boost setting for content specified in this Embed SSO URL.
|
|
33
34
|
*/
|
|
34
35
|
accessBoost?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The branch setting that sets the model branch of the embed session.
|
|
38
|
+
*/
|
|
39
|
+
branch?: string;
|
|
35
40
|
/**
|
|
36
41
|
* The connection roles to be associated with the embed user. Expected to be a stringified JSON object.
|
|
37
42
|
*/
|
|
@@ -122,7 +127,7 @@ export declare const getSignature: ({ secret, ...props }: SignatureProps) => str
|
|
|
122
127
|
type RequestUrl = {
|
|
123
128
|
requestUrl: string;
|
|
124
129
|
};
|
|
125
|
-
type SignSessionRedemptionProps = Pick<SignatureProps,
|
|
130
|
+
type SignSessionRedemptionProps = Pick<SignatureProps, RedeemSessionExclusiveProps> & RequestUrl & {
|
|
126
131
|
sessionId: string;
|
|
127
132
|
};
|
|
128
133
|
/**
|
|
@@ -133,8 +138,8 @@ type SignSessionRedemptionProps = Pick<SignatureProps, "nonce" | "prefersDark" |
|
|
|
133
138
|
* that is generated based on all other request parameters. That signature is
|
|
134
139
|
* validated by the Omni app server to ensure the request is authentic.
|
|
135
140
|
*/
|
|
136
|
-
export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }: SignSessionRedemptionProps) => string;
|
|
141
|
+
export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, branch, prefersDark, theme, }: SignSessionRedemptionProps) => string;
|
|
137
142
|
export declare const TEST_ONLY: {
|
|
138
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
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;
|
|
139
144
|
};
|
|
140
145
|
export {};
|
package/lib/cjs/signature.js
CHANGED
|
@@ -15,11 +15,12 @@ const generateStringForSignature = ({
|
|
|
15
15
|
// Required parameters
|
|
16
16
|
loginUrl, contentPath, externalId, name, nonce,
|
|
17
17
|
// Optional parameters
|
|
18
|
-
accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }) => {
|
|
18
|
+
accessBoost, branch, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }) => {
|
|
19
19
|
// We create a map of optional params and convert it to an array
|
|
20
20
|
// to ensure that the order of the optional params is alphabetical and consistent.
|
|
21
21
|
const optionalParamsMap = {
|
|
22
22
|
...(accessBoost !== undefined && { accessBoost: accessBoost.toString() }),
|
|
23
|
+
...(branch && { branch }),
|
|
23
24
|
...(connectionRoles && { connectionRoles }),
|
|
24
25
|
...(customTheme && { customTheme }),
|
|
25
26
|
...(customThemeId && { customThemeId }),
|
|
@@ -73,8 +74,9 @@ exports.getSignature = getSignature;
|
|
|
73
74
|
* that is generated based on all other request parameters. That signature is
|
|
74
75
|
* validated by the Omni app server to ensure the request is authentic.
|
|
75
76
|
*/
|
|
76
|
-
const signSessionRedemption = ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }) => {
|
|
77
|
+
const signSessionRedemption = ({ requestUrl, nonce, sessionId, secret, branch, prefersDark, theme, }) => {
|
|
77
78
|
const optionalParamsMap = {
|
|
79
|
+
...(branch && { branch }),
|
|
78
80
|
...(prefersDark && { prefersDark }),
|
|
79
81
|
...(theme && { theme }),
|
|
80
82
|
};
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CustomThemeProperty,
|
|
1
|
+
import { CustomThemeProperty, EmbedEntityFolderContentRoles, EmbedSessionMode, EmbedUiSettings } from "./constants.js";
|
|
2
2
|
type UserAttributeValue = string | string[] | number | number[];
|
|
3
|
-
type HostProps = {
|
|
3
|
+
type HostProps = ({
|
|
4
4
|
host?: never;
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Introduced for internal testing only. For vanity domains, use the `host` prop instead.
|
|
@@ -28,6 +28,8 @@ type HostProps = {
|
|
|
28
28
|
* @example "omni.another-example.app"
|
|
29
29
|
*/
|
|
30
30
|
host: string;
|
|
31
|
+
}) & {
|
|
32
|
+
port?: number;
|
|
31
33
|
};
|
|
32
34
|
type EmbedSsoBaseProps = {
|
|
33
35
|
externalId: string;
|
|
@@ -41,14 +43,14 @@ type EmbedSsoBaseProps = {
|
|
|
41
43
|
customThemeId?: string;
|
|
42
44
|
/**
|
|
43
45
|
* Optional connection roles setting. Object keys should be connection IDs from the embedded Omni instance.
|
|
44
|
-
* Object values should be connection roles.
|
|
46
|
+
* Object values should be connection roles (base roles or custom role names).
|
|
45
47
|
*/
|
|
46
|
-
connectionRoles?: Record<string,
|
|
48
|
+
connectionRoles?: Record<string, string>;
|
|
47
49
|
/**
|
|
48
50
|
* Optional model roles setting. Object keys should be model IDs from the embedded Omni instance.
|
|
49
|
-
* Object values should be
|
|
51
|
+
* Object values should be model roles (base roles or custom role names).
|
|
50
52
|
*/
|
|
51
|
-
modelRoles?: Record<string,
|
|
53
|
+
modelRoles?: Record<string, string>;
|
|
52
54
|
/**
|
|
53
55
|
* Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
|
|
54
56
|
*
|
|
@@ -108,8 +110,11 @@ type EmbedSsoBaseProps = {
|
|
|
108
110
|
filterSearchParam?: string;
|
|
109
111
|
linkAccess?: string;
|
|
110
112
|
uiSettings?: Record<EmbedUiSettings, boolean>;
|
|
113
|
+
/**
|
|
114
|
+
* Optional branch setting that sets the model branch of the embed session.
|
|
115
|
+
*/
|
|
116
|
+
branch?: string;
|
|
111
117
|
nonce?: string;
|
|
112
|
-
port?: number;
|
|
113
118
|
} & HostProps;
|
|
114
119
|
type EmbedSsoDashboardOnlyProps = {
|
|
115
120
|
accessBoost?: boolean;
|
|
@@ -185,20 +190,21 @@ export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
|
|
|
185
190
|
} & ({
|
|
186
191
|
/**
|
|
187
192
|
* Required connection roles object. Object keys should be connection IDs from the embedded Omni instance.
|
|
188
|
-
* Object values should be connection roles.
|
|
193
|
+
* Object values should be connection roles (base roles or custom role names).
|
|
189
194
|
*/
|
|
190
|
-
connectionRoles: Record<string,
|
|
195
|
+
connectionRoles: Record<string, string>;
|
|
191
196
|
} | {
|
|
192
197
|
/**
|
|
193
|
-
* Required model roles object. Object keys should be
|
|
194
|
-
* Object values should be
|
|
198
|
+
* Required model roles object. Object keys should be model IDs from the embedded Omni instance.
|
|
199
|
+
* Object values should be model roles (base roles or custom role names).
|
|
195
200
|
*/
|
|
196
|
-
modelRoles: Record<string,
|
|
201
|
+
modelRoles: Record<string, string>;
|
|
197
202
|
});
|
|
198
|
-
export type
|
|
203
|
+
export type RedeemSessionExclusiveProps = "branch" | "nonce" | "prefersDark" | "secret" | "theme";
|
|
204
|
+
export type CreateSessionTokenProps = Omit<EmbedSsoContentProps, RedeemSessionExclusiveProps> & {
|
|
199
205
|
apiKey: string;
|
|
200
206
|
} & HostProps;
|
|
201
|
-
export type RedeemSessionTokenProps = Pick<EmbedSsoContentProps,
|
|
207
|
+
export type RedeemSessionTokenProps = Pick<EmbedSsoContentProps, RedeemSessionExclusiveProps> & {
|
|
202
208
|
sessionToken: string;
|
|
203
209
|
} & HostProps;
|
|
204
210
|
export {};
|
package/lib/esm/embed.d.ts
CHANGED
|
@@ -29,4 +29,4 @@ export declare const createSessionToken: ({ apiKey, domain, host, organizationNa
|
|
|
29
29
|
* to output an session redemption URL that can be used to display embedded content.
|
|
30
30
|
* The returned URL should be passed into an `iframe`'s src attribute.
|
|
31
31
|
*/
|
|
32
|
-
export declare const redeemSessionToken: ({ domain, host, organizationName, port, nonce: propsNonce, secret, prefersDark, sessionToken: sessionId, theme, }: RedeemSessionTokenProps) => Promise<string>;
|
|
32
|
+
export declare const redeemSessionToken: ({ branch, domain, host, organizationName, port, nonce: propsNonce, secret, prefersDark, sessionToken: sessionId, theme, }: RedeemSessionTokenProps) => Promise<string>;
|
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, 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
|
+
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;
|
|
55
55
|
// Handle defaults
|
|
56
56
|
nonce = nonce ?? (await random32ByteString());
|
|
57
57
|
const uiSettings = rawUiSettings && JSON.stringify(rawUiSettings);
|
|
@@ -78,6 +78,7 @@ const embedSsoContent = async (props) => {
|
|
|
78
78
|
secret,
|
|
79
79
|
// Optional parameters
|
|
80
80
|
accessBoost,
|
|
81
|
+
branch,
|
|
81
82
|
connectionRoles,
|
|
82
83
|
customTheme,
|
|
83
84
|
customThemeId,
|
|
@@ -132,6 +133,7 @@ const embedSsoContent = async (props) => {
|
|
|
132
133
|
url.searchParams.append("entityFolderLabel", entityFolderLabel);
|
|
133
134
|
preserveEntityFolderContentRole !== undefined &&
|
|
134
135
|
url.searchParams.append("preserveEntityFolderContentRole", preserveEntityFolderContentRole.toString());
|
|
136
|
+
branch && url.searchParams.append("branch", branch);
|
|
135
137
|
return url.toString();
|
|
136
138
|
};
|
|
137
139
|
const buildContentPath = (contentType, contentId) => `/${contentType}/${contentId}`;
|
|
@@ -201,7 +203,7 @@ export const createSessionToken = async ({ apiKey, domain, host, organizationNam
|
|
|
201
203
|
* to output an session redemption URL that can be used to display embedded content.
|
|
202
204
|
* The returned URL should be passed into an `iframe`'s src attribute.
|
|
203
205
|
*/
|
|
204
|
-
export const redeemSessionToken = async ({ domain, host, organizationName, port, nonce: propsNonce, secret, prefersDark, sessionToken: sessionId, // sessionToken is just a facade for the sessionId
|
|
206
|
+
export const redeemSessionToken = async ({ branch, domain, host, organizationName, port, nonce: propsNonce, secret, prefersDark, sessionToken: sessionId, // sessionToken is just a facade for the sessionId
|
|
205
207
|
theme, }) => {
|
|
206
208
|
const redeemRequestUrl = createEmbedRequestUrl({
|
|
207
209
|
domain,
|
|
@@ -218,7 +220,10 @@ theme, }) => {
|
|
|
218
220
|
sessionId,
|
|
219
221
|
secret,
|
|
220
222
|
theme,
|
|
223
|
+
branch,
|
|
221
224
|
});
|
|
225
|
+
branch !== undefined &&
|
|
226
|
+
redeemRequestUrl.searchParams.append("branch", branch);
|
|
222
227
|
prefersDark !== undefined &&
|
|
223
228
|
redeemRequestUrl.searchParams.append("prefersDark", prefersDark);
|
|
224
229
|
theme !== undefined && redeemRequestUrl.searchParams.append("theme", theme);
|
package/lib/esm/signature.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RedeemSessionExclusiveProps } from "./types.js";
|
|
1
2
|
export declare const hmacSign: (data: string, secret: string) => string;
|
|
2
3
|
type SignatureProps = {
|
|
3
4
|
/**
|
|
@@ -32,6 +33,10 @@ type SignatureProps = {
|
|
|
32
33
|
* The access boost setting for content specified in this Embed SSO URL.
|
|
33
34
|
*/
|
|
34
35
|
accessBoost?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The branch setting that sets the model branch of the embed session.
|
|
38
|
+
*/
|
|
39
|
+
branch?: string;
|
|
35
40
|
/**
|
|
36
41
|
* The connection roles to be associated with the embed user. Expected to be a stringified JSON object.
|
|
37
42
|
*/
|
|
@@ -122,7 +127,7 @@ export declare const getSignature: ({ secret, ...props }: SignatureProps) => str
|
|
|
122
127
|
type RequestUrl = {
|
|
123
128
|
requestUrl: string;
|
|
124
129
|
};
|
|
125
|
-
type SignSessionRedemptionProps = Pick<SignatureProps,
|
|
130
|
+
type SignSessionRedemptionProps = Pick<SignatureProps, RedeemSessionExclusiveProps> & RequestUrl & {
|
|
126
131
|
sessionId: string;
|
|
127
132
|
};
|
|
128
133
|
/**
|
|
@@ -133,8 +138,8 @@ type SignSessionRedemptionProps = Pick<SignatureProps, "nonce" | "prefersDark" |
|
|
|
133
138
|
* that is generated based on all other request parameters. That signature is
|
|
134
139
|
* validated by the Omni app server to ensure the request is authentic.
|
|
135
140
|
*/
|
|
136
|
-
export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }: SignSessionRedemptionProps) => string;
|
|
141
|
+
export declare const signSessionRedemption: ({ requestUrl, nonce, sessionId, secret, branch, prefersDark, theme, }: SignSessionRedemptionProps) => string;
|
|
137
142
|
export declare const TEST_ONLY: {
|
|
138
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, email, entity, entityFolderContentRole, entityFolderGroupContentRole, entityFolderLabel, entityGroupLabel, filterSearchParam, groups, linkAccess, mode, modelRoles, prefersDark, preserveEntityFolderContentRole, theme, uiSettings, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
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;
|
|
139
144
|
};
|
|
140
145
|
export {};
|
package/lib/esm/signature.js
CHANGED
|
@@ -8,11 +8,12 @@ const generateStringForSignature = ({
|
|
|
8
8
|
// Required parameters
|
|
9
9
|
loginUrl, contentPath, externalId, name, nonce,
|
|
10
10
|
// Optional parameters
|
|
11
|
-
accessBoost, 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, 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
15
|
...(accessBoost !== undefined && { accessBoost: accessBoost.toString() }),
|
|
16
|
+
...(branch && { branch }),
|
|
16
17
|
...(connectionRoles && { connectionRoles }),
|
|
17
18
|
...(customTheme && { customTheme }),
|
|
18
19
|
...(customThemeId && { customThemeId }),
|
|
@@ -65,8 +66,9 @@ export const getSignature = ({ secret, ...props }) => {
|
|
|
65
66
|
* that is generated based on all other request parameters. That signature is
|
|
66
67
|
* validated by the Omni app server to ensure the request is authentic.
|
|
67
68
|
*/
|
|
68
|
-
export const signSessionRedemption = ({ requestUrl, nonce, sessionId, secret, prefersDark, theme, }) => {
|
|
69
|
+
export const signSessionRedemption = ({ requestUrl, nonce, sessionId, secret, branch, prefersDark, theme, }) => {
|
|
69
70
|
const optionalParamsMap = {
|
|
71
|
+
...(branch && { branch }),
|
|
70
72
|
...(prefersDark && { prefersDark }),
|
|
71
73
|
...(theme && { theme }),
|
|
72
74
|
};
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CustomThemeProperty,
|
|
1
|
+
import { CustomThemeProperty, EmbedEntityFolderContentRoles, EmbedSessionMode, EmbedUiSettings } from "./constants.js";
|
|
2
2
|
type UserAttributeValue = string | string[] | number | number[];
|
|
3
|
-
type HostProps = {
|
|
3
|
+
type HostProps = ({
|
|
4
4
|
host?: never;
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Introduced for internal testing only. For vanity domains, use the `host` prop instead.
|
|
@@ -28,6 +28,8 @@ type HostProps = {
|
|
|
28
28
|
* @example "omni.another-example.app"
|
|
29
29
|
*/
|
|
30
30
|
host: string;
|
|
31
|
+
}) & {
|
|
32
|
+
port?: number;
|
|
31
33
|
};
|
|
32
34
|
type EmbedSsoBaseProps = {
|
|
33
35
|
externalId: string;
|
|
@@ -41,14 +43,14 @@ type EmbedSsoBaseProps = {
|
|
|
41
43
|
customThemeId?: string;
|
|
42
44
|
/**
|
|
43
45
|
* Optional connection roles setting. Object keys should be connection IDs from the embedded Omni instance.
|
|
44
|
-
* Object values should be connection roles.
|
|
46
|
+
* Object values should be connection roles (base roles or custom role names).
|
|
45
47
|
*/
|
|
46
|
-
connectionRoles?: Record<string,
|
|
48
|
+
connectionRoles?: Record<string, string>;
|
|
47
49
|
/**
|
|
48
50
|
* Optional model roles setting. Object keys should be model IDs from the embedded Omni instance.
|
|
49
|
-
* Object values should be
|
|
51
|
+
* Object values should be model roles (base roles or custom role names).
|
|
50
52
|
*/
|
|
51
|
-
modelRoles?: Record<string,
|
|
53
|
+
modelRoles?: Record<string, string>;
|
|
52
54
|
/**
|
|
53
55
|
* Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
|
|
54
56
|
*
|
|
@@ -108,8 +110,11 @@ type EmbedSsoBaseProps = {
|
|
|
108
110
|
filterSearchParam?: string;
|
|
109
111
|
linkAccess?: string;
|
|
110
112
|
uiSettings?: Record<EmbedUiSettings, boolean>;
|
|
113
|
+
/**
|
|
114
|
+
* Optional branch setting that sets the model branch of the embed session.
|
|
115
|
+
*/
|
|
116
|
+
branch?: string;
|
|
111
117
|
nonce?: string;
|
|
112
|
-
port?: number;
|
|
113
118
|
} & HostProps;
|
|
114
119
|
type EmbedSsoDashboardOnlyProps = {
|
|
115
120
|
accessBoost?: boolean;
|
|
@@ -185,20 +190,21 @@ export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
|
|
|
185
190
|
} & ({
|
|
186
191
|
/**
|
|
187
192
|
* Required connection roles object. Object keys should be connection IDs from the embedded Omni instance.
|
|
188
|
-
* Object values should be connection roles.
|
|
193
|
+
* Object values should be connection roles (base roles or custom role names).
|
|
189
194
|
*/
|
|
190
|
-
connectionRoles: Record<string,
|
|
195
|
+
connectionRoles: Record<string, string>;
|
|
191
196
|
} | {
|
|
192
197
|
/**
|
|
193
|
-
* Required model roles object. Object keys should be
|
|
194
|
-
* Object values should be
|
|
198
|
+
* Required model roles object. Object keys should be model IDs from the embedded Omni instance.
|
|
199
|
+
* Object values should be model roles (base roles or custom role names).
|
|
195
200
|
*/
|
|
196
|
-
modelRoles: Record<string,
|
|
201
|
+
modelRoles: Record<string, string>;
|
|
197
202
|
});
|
|
198
|
-
export type
|
|
203
|
+
export type RedeemSessionExclusiveProps = "branch" | "nonce" | "prefersDark" | "secret" | "theme";
|
|
204
|
+
export type CreateSessionTokenProps = Omit<EmbedSsoContentProps, RedeemSessionExclusiveProps> & {
|
|
199
205
|
apiKey: string;
|
|
200
206
|
} & HostProps;
|
|
201
|
-
export type RedeemSessionTokenProps = Pick<EmbedSsoContentProps,
|
|
207
|
+
export type RedeemSessionTokenProps = Pick<EmbedSsoContentProps, RedeemSessionExclusiveProps> & {
|
|
202
208
|
sessionToken: string;
|
|
203
209
|
} & HostProps;
|
|
204
210
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CustomThemeProperty,
|
|
1
|
+
import { CustomThemeProperty, EmbedEntityFolderContentRoles, EmbedSessionMode, EmbedUiSettings } from "./constants.js";
|
|
2
2
|
type UserAttributeValue = string | string[] | number | number[];
|
|
3
|
-
type HostProps = {
|
|
3
|
+
type HostProps = ({
|
|
4
4
|
host?: never;
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Introduced for internal testing only. For vanity domains, use the `host` prop instead.
|
|
@@ -28,6 +28,8 @@ type HostProps = {
|
|
|
28
28
|
* @example "omni.another-example.app"
|
|
29
29
|
*/
|
|
30
30
|
host: string;
|
|
31
|
+
}) & {
|
|
32
|
+
port?: number;
|
|
31
33
|
};
|
|
32
34
|
type EmbedSsoBaseProps = {
|
|
33
35
|
externalId: string;
|
|
@@ -41,14 +43,14 @@ type EmbedSsoBaseProps = {
|
|
|
41
43
|
customThemeId?: string;
|
|
42
44
|
/**
|
|
43
45
|
* Optional connection roles setting. Object keys should be connection IDs from the embedded Omni instance.
|
|
44
|
-
* Object values should be connection roles.
|
|
46
|
+
* Object values should be connection roles (base roles or custom role names).
|
|
45
47
|
*/
|
|
46
|
-
connectionRoles?: Record<string,
|
|
48
|
+
connectionRoles?: Record<string, string>;
|
|
47
49
|
/**
|
|
48
50
|
* Optional model roles setting. Object keys should be model IDs from the embedded Omni instance.
|
|
49
|
-
* Object values should be
|
|
51
|
+
* Object values should be model roles (base roles or custom role names).
|
|
50
52
|
*/
|
|
51
|
-
modelRoles?: Record<string,
|
|
53
|
+
modelRoles?: Record<string, string>;
|
|
52
54
|
/**
|
|
53
55
|
* Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
|
|
54
56
|
*
|
|
@@ -108,8 +110,11 @@ type EmbedSsoBaseProps = {
|
|
|
108
110
|
filterSearchParam?: string;
|
|
109
111
|
linkAccess?: string;
|
|
110
112
|
uiSettings?: Record<EmbedUiSettings, boolean>;
|
|
113
|
+
/**
|
|
114
|
+
* Optional branch setting that sets the model branch of the embed session.
|
|
115
|
+
*/
|
|
116
|
+
branch?: string;
|
|
111
117
|
nonce?: string;
|
|
112
|
-
port?: number;
|
|
113
118
|
} & HostProps;
|
|
114
119
|
type EmbedSsoDashboardOnlyProps = {
|
|
115
120
|
accessBoost?: boolean;
|
|
@@ -185,20 +190,21 @@ export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
|
|
|
185
190
|
} & ({
|
|
186
191
|
/**
|
|
187
192
|
* Required connection roles object. Object keys should be connection IDs from the embedded Omni instance.
|
|
188
|
-
* Object values should be connection roles.
|
|
193
|
+
* Object values should be connection roles (base roles or custom role names).
|
|
189
194
|
*/
|
|
190
|
-
connectionRoles: Record<string,
|
|
195
|
+
connectionRoles: Record<string, string>;
|
|
191
196
|
} | {
|
|
192
197
|
/**
|
|
193
|
-
* Required model roles object. Object keys should be
|
|
194
|
-
* Object values should be
|
|
198
|
+
* Required model roles object. Object keys should be model IDs from the embedded Omni instance.
|
|
199
|
+
* Object values should be model roles (base roles or custom role names).
|
|
195
200
|
*/
|
|
196
|
-
modelRoles: Record<string,
|
|
201
|
+
modelRoles: Record<string, string>;
|
|
197
202
|
});
|
|
198
|
-
export type
|
|
203
|
+
export type RedeemSessionExclusiveProps = "branch" | "nonce" | "prefersDark" | "secret" | "theme";
|
|
204
|
+
export type CreateSessionTokenProps = Omit<EmbedSsoContentProps, RedeemSessionExclusiveProps> & {
|
|
199
205
|
apiKey: string;
|
|
200
206
|
} & HostProps;
|
|
201
|
-
export type RedeemSessionTokenProps = Pick<EmbedSsoContentProps,
|
|
207
|
+
export type RedeemSessionTokenProps = Pick<EmbedSsoContentProps, RedeemSessionExclusiveProps> & {
|
|
202
208
|
sessionToken: string;
|
|
203
209
|
} & HostProps;
|
|
204
210
|
export {};
|
package/package.json
CHANGED