@omni-co/embed 0.4.0 → 0.4.1
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 +6 -2
- package/lib/cjs/signature.d.ts +5 -1
- package/lib/cjs/signature.js +2 -1
- package/lib/cjs/types.d.ts +1 -0
- package/lib/esm/embed.js +6 -2
- package/lib/esm/signature.d.ts +5 -1
- package/lib/esm/signature.js +2 -1
- package/lib/esm/types.d.ts +1 -0
- package/package.json +1 -1
package/lib/cjs/embed.js
CHANGED
|
@@ -7,7 +7,7 @@ const types_1 = require("./types");
|
|
|
7
7
|
const defaultEmbedDomain = "embed-omniapp.co";
|
|
8
8
|
const embedLoginPath = "/embed/login";
|
|
9
9
|
const validateProps = (props) => {
|
|
10
|
-
const { externalId, name, nonce, secret, userAttributes } = props;
|
|
10
|
+
const { externalId, name, nonce, secret, userAttributes, customTheme, customThemeId, } = props;
|
|
11
11
|
let host, domain, organizationName;
|
|
12
12
|
if ("host" in props)
|
|
13
13
|
host = props.host;
|
|
@@ -25,6 +25,8 @@ const validateProps = (props) => {
|
|
|
25
25
|
throw new Error("Must specify either `host` or `organizationName`");
|
|
26
26
|
if (host && (organizationName || domain))
|
|
27
27
|
throw new Error("`host` must be used exclusively and cannot be combined with `organizationName` or `domain` (domain is deprecated)");
|
|
28
|
+
if (customThemeId && customTheme)
|
|
29
|
+
console.warn("If you use a `customThemeId` any theme styles passed in via `customTheme` will be ignored.");
|
|
28
30
|
if (domain)
|
|
29
31
|
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'`).");
|
|
30
32
|
if (nonce && nonce.length !== 32)
|
|
@@ -34,7 +36,7 @@ const validateProps = (props) => {
|
|
|
34
36
|
};
|
|
35
37
|
const embedSsoContent = async (props) => {
|
|
36
38
|
validateProps(props);
|
|
37
|
-
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, externalId, filterSearchParam, linkAccess, mode, name, nonce, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, } = props;
|
|
39
|
+
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, externalId, filterSearchParam, linkAccess, mode, name, nonce, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, } = props;
|
|
38
40
|
let host, domain, organizationName;
|
|
39
41
|
if ("host" in props)
|
|
40
42
|
host = props.host;
|
|
@@ -66,6 +68,7 @@ const embedSsoContent = async (props) => {
|
|
|
66
68
|
filterSearchParam,
|
|
67
69
|
linkAccess,
|
|
68
70
|
customTheme,
|
|
71
|
+
customThemeId,
|
|
69
72
|
connectionRoles,
|
|
70
73
|
accessBoost,
|
|
71
74
|
mode,
|
|
@@ -85,6 +88,7 @@ const embedSsoContent = async (props) => {
|
|
|
85
88
|
url.searchParams.append("filterSearchParam", filterSearchParam);
|
|
86
89
|
linkAccess && url.searchParams.append("linkAccess", linkAccess);
|
|
87
90
|
customTheme && url.searchParams.append("customTheme", customTheme);
|
|
91
|
+
customThemeId && url.searchParams.append("customThemeId", customThemeId);
|
|
88
92
|
connectionRoles &&
|
|
89
93
|
url.searchParams.append("connectionRoles", connectionRoles);
|
|
90
94
|
mode && url.searchParams.append("mode", mode);
|
package/lib/cjs/signature.d.ts
CHANGED
|
@@ -42,6 +42,10 @@ type SignatureProps = {
|
|
|
42
42
|
* Example: '{ "dashboard-background-color": "hotpink" }'
|
|
43
43
|
*/
|
|
44
44
|
customTheme?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The custom theme id to be sent with the request. This Id refers to an Custom Theme created in the Omni App.
|
|
47
|
+
*/
|
|
48
|
+
customThemeId?: string;
|
|
45
49
|
/**
|
|
46
50
|
* The entity that the created embed user will belong to. Practically speaking, the embed
|
|
47
51
|
* user will this value assigned to its omni_user_embed_entity user attribute.
|
|
@@ -76,6 +80,6 @@ type SignatureProps = {
|
|
|
76
80
|
};
|
|
77
81
|
export declare const getSignature: ({ secret, ...props }: SignatureProps) => string;
|
|
78
82
|
export declare const TEST_ONLY: {
|
|
79
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, entity, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
83
|
+
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, entity, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
80
84
|
};
|
|
81
85
|
export {};
|
package/lib/cjs/signature.js
CHANGED
|
@@ -17,13 +17,14 @@ const generateStringForSignature = ({
|
|
|
17
17
|
// Required parameters
|
|
18
18
|
loginUrl, contentPath, externalId, name, nonce,
|
|
19
19
|
// Optional parameters
|
|
20
|
-
accessBoost, connectionRoles, customTheme, entity, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }) => {
|
|
20
|
+
accessBoost, connectionRoles, customTheme, customThemeId, 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 = {
|
|
24
24
|
...(accessBoost && { accessBoost: accessBoost === null || accessBoost === void 0 ? void 0 : accessBoost.toString() }),
|
|
25
25
|
...(connectionRoles && { connectionRoles }),
|
|
26
26
|
...(customTheme && { customTheme }),
|
|
27
|
+
...(customThemeId && { customThemeId }),
|
|
27
28
|
...(entity && { entity }),
|
|
28
29
|
...(filterSearchParam && { filterSearchParam }),
|
|
29
30
|
...(linkAccess && { linkAccess }),
|
package/lib/cjs/types.d.ts
CHANGED
package/lib/esm/embed.js
CHANGED
|
@@ -4,7 +4,7 @@ import { EmbeddedContent, } from "./types";
|
|
|
4
4
|
const defaultEmbedDomain = "embed-omniapp.co";
|
|
5
5
|
const embedLoginPath = "/embed/login";
|
|
6
6
|
const validateProps = (props) => {
|
|
7
|
-
const { externalId, name, nonce, secret, userAttributes } = props;
|
|
7
|
+
const { externalId, name, nonce, secret, userAttributes, customTheme, customThemeId, } = props;
|
|
8
8
|
let host, domain, organizationName;
|
|
9
9
|
if ("host" in props)
|
|
10
10
|
host = props.host;
|
|
@@ -22,6 +22,8 @@ const validateProps = (props) => {
|
|
|
22
22
|
throw new Error("Must specify either `host` or `organizationName`");
|
|
23
23
|
if (host && (organizationName || domain))
|
|
24
24
|
throw new Error("`host` must be used exclusively and cannot be combined with `organizationName` or `domain` (domain is deprecated)");
|
|
25
|
+
if (customThemeId && customTheme)
|
|
26
|
+
console.warn("If you use a `customThemeId` any theme styles passed in via `customTheme` will be ignored.");
|
|
25
27
|
if (domain)
|
|
26
28
|
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'`).");
|
|
27
29
|
if (nonce && nonce.length !== 32)
|
|
@@ -31,7 +33,7 @@ const validateProps = (props) => {
|
|
|
31
33
|
};
|
|
32
34
|
const embedSsoContent = async (props) => {
|
|
33
35
|
validateProps(props);
|
|
34
|
-
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, externalId, filterSearchParam, linkAccess, mode, name, nonce, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, } = props;
|
|
36
|
+
let { accessBoost, connectionRoles: rawConnectionRoles, contentPath, customTheme: rawCustomTheme, customThemeId, externalId, filterSearchParam, linkAccess, mode, name, nonce, port, secret, userAttributes: rawUserAttributes, entity, prefersDark, theme, } = props;
|
|
35
37
|
let host, domain, organizationName;
|
|
36
38
|
if ("host" in props)
|
|
37
39
|
host = props.host;
|
|
@@ -63,6 +65,7 @@ const embedSsoContent = async (props) => {
|
|
|
63
65
|
filterSearchParam,
|
|
64
66
|
linkAccess,
|
|
65
67
|
customTheme,
|
|
68
|
+
customThemeId,
|
|
66
69
|
connectionRoles,
|
|
67
70
|
accessBoost,
|
|
68
71
|
mode,
|
|
@@ -82,6 +85,7 @@ const embedSsoContent = async (props) => {
|
|
|
82
85
|
url.searchParams.append("filterSearchParam", filterSearchParam);
|
|
83
86
|
linkAccess && url.searchParams.append("linkAccess", linkAccess);
|
|
84
87
|
customTheme && url.searchParams.append("customTheme", customTheme);
|
|
88
|
+
customThemeId && url.searchParams.append("customThemeId", customThemeId);
|
|
85
89
|
connectionRoles &&
|
|
86
90
|
url.searchParams.append("connectionRoles", connectionRoles);
|
|
87
91
|
mode && url.searchParams.append("mode", mode);
|
package/lib/esm/signature.d.ts
CHANGED
|
@@ -42,6 +42,10 @@ type SignatureProps = {
|
|
|
42
42
|
* Example: '{ "dashboard-background-color": "hotpink" }'
|
|
43
43
|
*/
|
|
44
44
|
customTheme?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The custom theme id to be sent with the request. This Id refers to an Custom Theme created in the Omni App.
|
|
47
|
+
*/
|
|
48
|
+
customThemeId?: string;
|
|
45
49
|
/**
|
|
46
50
|
* The entity that the created embed user will belong to. Practically speaking, the embed
|
|
47
51
|
* user will this value assigned to its omni_user_embed_entity user attribute.
|
|
@@ -76,6 +80,6 @@ type SignatureProps = {
|
|
|
76
80
|
};
|
|
77
81
|
export declare const getSignature: ({ secret, ...props }: SignatureProps) => string;
|
|
78
82
|
export declare const TEST_ONLY: {
|
|
79
|
-
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, entity, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
83
|
+
generateStringForSignature: ({ loginUrl, contentPath, externalId, name, nonce, accessBoost, connectionRoles, customTheme, customThemeId, entity, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }: Omit<SignatureProps, "secret">) => string;
|
|
80
84
|
};
|
|
81
85
|
export {};
|
package/lib/esm/signature.js
CHANGED
|
@@ -10,13 +10,14 @@ const generateStringForSignature = ({
|
|
|
10
10
|
// Required parameters
|
|
11
11
|
loginUrl, contentPath, externalId, name, nonce,
|
|
12
12
|
// Optional parameters
|
|
13
|
-
accessBoost, connectionRoles, customTheme, entity, filterSearchParam, linkAccess, mode, prefersDark, theme, userAttributes, }) => {
|
|
13
|
+
accessBoost, connectionRoles, customTheme, customThemeId, 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 = {
|
|
17
17
|
...(accessBoost && { accessBoost: accessBoost === null || accessBoost === void 0 ? void 0 : accessBoost.toString() }),
|
|
18
18
|
...(connectionRoles && { connectionRoles }),
|
|
19
19
|
...(customTheme && { customTheme }),
|
|
20
|
+
...(customThemeId && { customThemeId }),
|
|
20
21
|
...(entity && { entity }),
|
|
21
22
|
...(filterSearchParam && { filterSearchParam }),
|
|
22
23
|
...(linkAccess && { linkAccess }),
|
package/lib/esm/types.d.ts
CHANGED
package/package.json
CHANGED