@omni-co/embed 0.9.0 → 0.11.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/README.md +220 -0
- package/lib/cjs/embed.d.ts +3 -3
- package/lib/cjs/embed.js +7 -1
- package/lib/cjs/signature.d.ts +9 -1
- package/lib/cjs/signature.js +3 -1
- package/lib/cjs/types.d.ts +14 -2
- package/lib/esm/embed.d.ts +3 -3
- package/lib/esm/embed.js +7 -1
- package/lib/esm/signature.d.ts +9 -1
- package/lib/esm/signature.js +3 -1
- package/lib/esm/types.d.ts +14 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,6 +62,38 @@ const iframeUrl = await embedSsoContentDiscovery({
|
|
|
62
62
|
});
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
## 2-step Example
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
// Step 1
|
|
69
|
+
const { success, sessionToken } = await createSessionToken({
|
|
70
|
+
apiKey: "<YOUR API KEY>",
|
|
71
|
+
connectionRoles: {
|
|
72
|
+
"abcd1234-abcd-efgh-ijkl-abcdef123456":
|
|
73
|
+
EmbedConnectionRoles.RESTRICTED_QUERIER,
|
|
74
|
+
},
|
|
75
|
+
contentPath: "/dashboards/abcd1234",
|
|
76
|
+
externalId: "dodgers-17",
|
|
77
|
+
host: "myorg.embed-omniapp.co",
|
|
78
|
+
mode: EmbedSessionMode.Application,
|
|
79
|
+
name: "Shohei Ohtani",
|
|
80
|
+
});
|
|
81
|
+
if (!success) throw new Error("Failed to generate session");
|
|
82
|
+
|
|
83
|
+
// Step 2
|
|
84
|
+
const redeemSessionUrl = await redeemSessionToken({
|
|
85
|
+
host: "myorg.embed-omniapp.co",
|
|
86
|
+
prefersDark: "false",
|
|
87
|
+
theme: "vibes",
|
|
88
|
+
secret: "<YOUR EMBED SECRET>",
|
|
89
|
+
sessionToken,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
...
|
|
93
|
+
|
|
94
|
+
<iframe src={redeemSessionUrl} />
|
|
95
|
+
```
|
|
96
|
+
|
|
65
97
|
## Using Vanity Domains
|
|
66
98
|
|
|
67
99
|
```ts
|
|
@@ -186,6 +218,9 @@ type EmbedSsoDashboardProps = {
|
|
|
186
218
|
// Optional theme setting. Can be one of "dawn", "vibes", "breeze" or "blank".
|
|
187
219
|
theme?: string;
|
|
188
220
|
|
|
221
|
+
// Optional UI settings object to control appearance of embed experience.
|
|
222
|
+
uiSettings?: Record<EmbedUiSettings, boolean>;
|
|
223
|
+
|
|
189
224
|
/**
|
|
190
225
|
* Optional user attributes to be passed to user associated with the
|
|
191
226
|
* externalId. User attributes must be created in Omni before being
|
|
@@ -304,6 +339,9 @@ type EmbedSsoWorkbookProps = {
|
|
|
304
339
|
// Optional theme setting. Can be one of "dawn", "vibes", "breeze" or "blank".
|
|
305
340
|
theme?: string;
|
|
306
341
|
|
|
342
|
+
// Optional UI settings object to control appearance of embed experience.
|
|
343
|
+
uiSettings?: Record<EmbedUiSettings, boolean>;
|
|
344
|
+
|
|
307
345
|
/**
|
|
308
346
|
* Optional user attributes to be passed to user associated with the
|
|
309
347
|
* externalId. User attributes must be created in Omni before being
|
|
@@ -424,6 +462,9 @@ type EmbedSsoContentDiscoveryProps = {
|
|
|
424
462
|
// Optional theme setting. Can be one of "dawn", "vibes", "breeze" or "blank".
|
|
425
463
|
theme?: string;
|
|
426
464
|
|
|
465
|
+
// Optional UI settings object to control appearance of embed experience.
|
|
466
|
+
uiSettings?: Record<EmbedUiSettings, boolean>;
|
|
467
|
+
|
|
427
468
|
/**
|
|
428
469
|
* Optional user attributes to be passed to user associated with the
|
|
429
470
|
* externalId. User attributes must be created in Omni before being
|
|
@@ -442,3 +483,182 @@ type EmbedSsoContentDiscoveryProps = {
|
|
|
442
483
|
domain?: string;
|
|
443
484
|
};
|
|
444
485
|
```
|
|
486
|
+
|
|
487
|
+
## createSessionToken
|
|
488
|
+
|
|
489
|
+
This is the type signature for the `createSessionToken` function:
|
|
490
|
+
|
|
491
|
+
```ts
|
|
492
|
+
type CreateSessionTokenProps = {
|
|
493
|
+
// Optional boolean property that toggles the dashboard's Access Boost setting.
|
|
494
|
+
accessBoost?: boolean;
|
|
495
|
+
|
|
496
|
+
// An Omni API key used for authentication purposes. Can be generated in your Omni application in the Admin > API Keys section.
|
|
497
|
+
apiKey: string;
|
|
498
|
+
|
|
499
|
+
// Optional object that determines the connection permissions for the embed user.
|
|
500
|
+
connectionRoles?: Record<string, EmbedConnectionRoles>;
|
|
501
|
+
|
|
502
|
+
// Short GUID of the dashboard. Can be obtained via the dashboard's url.
|
|
503
|
+
contentId: string;
|
|
504
|
+
|
|
505
|
+
// Optional custom theme object that styles the embedded dashboard.
|
|
506
|
+
customTheme?: CustomThemeProperties;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Optional custom theme ID setting that styles the embedded dashboard.
|
|
510
|
+
* This ID should be from a theme created within the Omni application.
|
|
511
|
+
*/
|
|
512
|
+
customThemeId?: string;
|
|
513
|
+
|
|
514
|
+
// Optional email parameter that sets the default scheduling email for the embed user.
|
|
515
|
+
email?: string;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Optional identifier to associate the user with an external organization or system.
|
|
519
|
+
* Note that each distinct entity will generate its own folder and group. These can be used by
|
|
520
|
+
* an embed user to share content with other members in the same entity.
|
|
521
|
+
*/
|
|
522
|
+
entity?: string;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Optional content role setting for the entity folder. Can be one of "MANAGER", "EDITOR", or "VIEWER".
|
|
526
|
+
*
|
|
527
|
+
* MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
|
|
528
|
+
* EDITOR: the user will have the ability to manage content in the entity folder.
|
|
529
|
+
* VIEWER: the user will only be able to view content in the entity folder.
|
|
530
|
+
*/
|
|
531
|
+
entityFolderContentRole?: EmbedEntityFolderContentRoles;
|
|
532
|
+
|
|
533
|
+
// Required identifier to associate the external user with an automatically generated internal Omni user.
|
|
534
|
+
externalId: string;
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Optional url filter search parameter. Should be the same as the filter search parameters on a dashboard url.
|
|
538
|
+
* Example: f--inventory_items.cost=%7B"kind"%3A"EQUALS"%2C"type"%3A"number"%2C"values"%3A%5B%5D%2C"is_negative"%3Afalse%2C"is_inclusive"%3Afalse%7D&f--users.state=%7B"kind"%3A"EQUALS"%2C"type"%3A"string"%2C"values"%3A%5B"Aberdeen"%2C"Alabama"%5D%2C"is_negative"%3Afalse%7D&f--users.country=%7B"kind"%3A"EQUALS"%2C"type"%3A"string"%2C"values"%3A%5B"UK"%5D%2C"is_negative"%3Afalse%7D
|
|
539
|
+
*
|
|
540
|
+
*/
|
|
541
|
+
filterSearchParam?: string;
|
|
542
|
+
|
|
543
|
+
/*
|
|
544
|
+
* Optional groups array property. The array should be a list of group names from the Omni application, which the embed user will be added to.
|
|
545
|
+
*/
|
|
546
|
+
groups?: string[];
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Used to set the host of signed embed URL, required when using vanity domains.
|
|
550
|
+
* Protocol is not required, as https is assumed.
|
|
551
|
+
* Port is not accepted. If required, use the `port` prop.
|
|
552
|
+
*
|
|
553
|
+
* @throws Error if `domain` or `organizationName` are provided.
|
|
554
|
+
* @example "omni.example.com"
|
|
555
|
+
* @example "omni.another-example.app"
|
|
556
|
+
*/
|
|
557
|
+
host?: string;
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Optional link access setting to control which Omni dashboard links are shown. Note that regardless of the linkAccess value,
|
|
561
|
+
* all non-Omni dashboard links will be shown and allowed in drill menus. Acceptable values include:
|
|
562
|
+
*
|
|
563
|
+
* "__omni_link_access_open": Special string keyword that permisses and shows all Omni dashboard links on the embedded dashboard.
|
|
564
|
+
* "abcd1234,efgh5678,ijkl9999": An allowlist of dashboard IDs that permisses and shows links to the specified dashboards.
|
|
565
|
+
* undefined: If left undefined, the default behavior is to hide and disallow all links to other Omni dashboards on the embedded dashboard.
|
|
566
|
+
*/
|
|
567
|
+
linkAccess?: string;
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Optional mode setting that determines whether the entire application should be embedded or a single piece of content.
|
|
571
|
+
*
|
|
572
|
+
* APPLICATION: the entire application will be embedded, meaning in-app navigation and document header options will be available.
|
|
573
|
+
* SINGLE_CONTENT: only the content specified in the contentId will be embedded and application mode features will be hidden.
|
|
574
|
+
*/
|
|
575
|
+
mode?: EmbedSessionMode;
|
|
576
|
+
|
|
577
|
+
// Required name of the external user.
|
|
578
|
+
name: string;
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Name of the organization the content belongs to. If provided, generates a default embed host
|
|
582
|
+
* URL in the form of `https://<organizationName>.embed-omniapp.co`.
|
|
583
|
+
*
|
|
584
|
+
* @throws Error if `host` is provided.
|
|
585
|
+
*/
|
|
586
|
+
organizationName?: string;
|
|
587
|
+
|
|
588
|
+
// Port of host.
|
|
589
|
+
port?: number;
|
|
590
|
+
|
|
591
|
+
// Optional UI settings object to control appearance of embed experience.
|
|
592
|
+
uiSettings?: Record<EmbedUiSettings, boolean>;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Optional user attributes to be passed to user associated with the
|
|
596
|
+
* externalId. User attributes must be created in Omni before being
|
|
597
|
+
* defined and given a value here.
|
|
598
|
+
*/
|
|
599
|
+
userAttributes?: Record<string, string | string[] | number | number[]>;
|
|
600
|
+
|
|
601
|
+
// DEPRECATED
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* @deprecated Introduced for internal testing only. For vanity domains, use the `host`
|
|
605
|
+
* prop instead. Will be dropped in a v1.0.0 release.
|
|
606
|
+
*
|
|
607
|
+
* @throws Error if `host` is provided.
|
|
608
|
+
*/
|
|
609
|
+
domain?: string;
|
|
610
|
+
};
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
## redeemSessionToken
|
|
614
|
+
|
|
615
|
+
This is the type signature for the `redeemSessionToken` function:
|
|
616
|
+
|
|
617
|
+
```ts
|
|
618
|
+
type RedeemSessionTokenProps = {
|
|
619
|
+
/**
|
|
620
|
+
* Used to set the host of signed embed URL, required when using vanity domains.
|
|
621
|
+
* Protocol is not required, as https is assumed.
|
|
622
|
+
* Port is not accepted. If required, use the `port` prop.
|
|
623
|
+
*
|
|
624
|
+
* @throws Error if `domain` or `organizationName` are provided.
|
|
625
|
+
* @example "omni.example.com"
|
|
626
|
+
* @example "omni.another-example.app"
|
|
627
|
+
*/
|
|
628
|
+
host?: string;
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Name of the organization the content belongs to. If provided, generates a default embed host
|
|
632
|
+
* URL in the form of `https://<organizationName>.embed-omniapp.co`.
|
|
633
|
+
*
|
|
634
|
+
* @throws Error if `host` is provided.
|
|
635
|
+
*/
|
|
636
|
+
organizationName?: string;
|
|
637
|
+
|
|
638
|
+
// Port of host.
|
|
639
|
+
port?: number;
|
|
640
|
+
|
|
641
|
+
// Optional dark mode setting. Can be one of "true", "false", or "system".
|
|
642
|
+
prefersDark?: string;
|
|
643
|
+
|
|
644
|
+
// Signing secret available to Omni admins.
|
|
645
|
+
secret: string;
|
|
646
|
+
|
|
647
|
+
// Session token string. The `createSessionToken` sdk function returns a session token that
|
|
648
|
+
// can be used as the `sessionToken` parameter here in `redeemSessionToken`.
|
|
649
|
+
sessionToken: string;
|
|
650
|
+
|
|
651
|
+
// Optional theme setting. Can be one of "dawn", "vibes", "breeze" or "blank".
|
|
652
|
+
theme?: string;
|
|
653
|
+
|
|
654
|
+
// DEPRECATED
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* @deprecated Introduced for internal testing only. For vanity domains, use the `host`
|
|
658
|
+
* prop instead. Will be dropped in a v1.0.0 release.
|
|
659
|
+
*
|
|
660
|
+
* @throws Error if `host` is provided.
|
|
661
|
+
*/
|
|
662
|
+
domain?: string;
|
|
663
|
+
};
|
|
664
|
+
```
|
package/lib/cjs/embed.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmbedSsoContentDiscoveryProps, EmbedSsoDashboardProps, EmbedSsoWorkbookProps,
|
|
1
|
+
import { EmbedSsoContentDiscoveryProps, EmbedSsoDashboardProps, EmbedSsoWorkbookProps, CreateSessionTokenProps, RedeemSessionTokenProps } from "./types";
|
|
2
2
|
export declare const embedSsoDashboard: (props: EmbedSsoDashboardProps) => Promise<string>;
|
|
3
3
|
export declare const embedSsoWorkbook: (props: EmbedSsoWorkbookProps) => Promise<string>;
|
|
4
4
|
/**
|
|
@@ -15,7 +15,7 @@ export declare const embedSsoContentDiscovery: (props: EmbedSsoContentDiscoveryP
|
|
|
15
15
|
* To elaborate, this function upserts an SSO embed user and session to the specified Omni
|
|
16
16
|
* organization / host. The returned session token corresponds to the generated session.
|
|
17
17
|
*/
|
|
18
|
-
export declare const createSessionToken: ({ apiKey, domain, host, organizationName, port, ...restProps }:
|
|
18
|
+
export declare const createSessionToken: ({ apiKey, domain, host, organizationName, port, ...restProps }: CreateSessionTokenProps) => Promise<{
|
|
19
19
|
success: true;
|
|
20
20
|
sessionToken: string;
|
|
21
21
|
error?: never;
|
|
@@ -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, }:
|
|
32
|
+
export declare const redeemSessionToken: ({ 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, externalId, filterSearchParam, host, linkAccess, mode, name, nonce, organizationName, port, secret, uiSettings: rawUiSettings, userAttributes: rawUserAttributes,
|
|
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}`;
|
package/lib/cjs/signature.d.ts
CHANGED
|
@@ -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 {};
|
package/lib/cjs/signature.js
CHANGED
|
@@ -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 }),
|
package/lib/cjs/types.d.ts
CHANGED
|
@@ -58,10 +58,22 @@ type EmbedSsoBaseProps = {
|
|
|
58
58
|
* Optional content role setting. Can be one of "MANAGER", "EDITOR", or "VIEWER".
|
|
59
59
|
*
|
|
60
60
|
* MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
|
|
61
|
+
*
|
|
61
62
|
* EDITOR: the user will have the ability to manage content in the entity folder.
|
|
63
|
+
*
|
|
62
64
|
* VIEWER: the user will only be able to view content in the entity folder.
|
|
63
65
|
*/
|
|
64
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;
|
|
65
77
|
/**
|
|
66
78
|
* Optional groups setting. An array of group names that the user will be added to.
|
|
67
79
|
*/
|
|
@@ -230,10 +242,10 @@ export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
|
|
|
230
242
|
*/
|
|
231
243
|
path: string;
|
|
232
244
|
};
|
|
233
|
-
export type
|
|
245
|
+
export type CreateSessionTokenProps = Omit<EmbedSsoContentProps, "prefersDark" | "theme" | "secret" | "nonce"> & {
|
|
234
246
|
apiKey: string;
|
|
235
247
|
} & HostProps;
|
|
236
|
-
export type
|
|
248
|
+
export type RedeemSessionTokenProps = Pick<EmbedSsoContentProps, "nonce" | "prefersDark" | "secret" | "theme" | "port"> & {
|
|
237
249
|
sessionToken: string;
|
|
238
250
|
} & HostProps;
|
|
239
251
|
export {};
|
package/lib/esm/embed.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmbedSsoContentDiscoveryProps, EmbedSsoDashboardProps, EmbedSsoWorkbookProps,
|
|
1
|
+
import { EmbedSsoContentDiscoveryProps, EmbedSsoDashboardProps, EmbedSsoWorkbookProps, CreateSessionTokenProps, RedeemSessionTokenProps } from "./types";
|
|
2
2
|
export declare const embedSsoDashboard: (props: EmbedSsoDashboardProps) => Promise<string>;
|
|
3
3
|
export declare const embedSsoWorkbook: (props: EmbedSsoWorkbookProps) => Promise<string>;
|
|
4
4
|
/**
|
|
@@ -15,7 +15,7 @@ export declare const embedSsoContentDiscovery: (props: EmbedSsoContentDiscoveryP
|
|
|
15
15
|
* To elaborate, this function upserts an SSO embed user and session to the specified Omni
|
|
16
16
|
* organization / host. The returned session token corresponds to the generated session.
|
|
17
17
|
*/
|
|
18
|
-
export declare const createSessionToken: ({ apiKey, domain, host, organizationName, port, ...restProps }:
|
|
18
|
+
export declare const createSessionToken: ({ apiKey, domain, host, organizationName, port, ...restProps }: CreateSessionTokenProps) => Promise<{
|
|
19
19
|
success: true;
|
|
20
20
|
sessionToken: string;
|
|
21
21
|
error?: never;
|
|
@@ -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, }:
|
|
32
|
+
export declare const redeemSessionToken: ({ 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, externalId, filterSearchParam, host, linkAccess, mode, name, nonce, organizationName, port, secret, uiSettings: rawUiSettings, userAttributes: rawUserAttributes,
|
|
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}`;
|
package/lib/esm/signature.d.ts
CHANGED
|
@@ -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 {};
|
package/lib/esm/signature.js
CHANGED
|
@@ -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 }),
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -58,10 +58,22 @@ type EmbedSsoBaseProps = {
|
|
|
58
58
|
* Optional content role setting. Can be one of "MANAGER", "EDITOR", or "VIEWER".
|
|
59
59
|
*
|
|
60
60
|
* MANAGER: the user will have the ability to manage content and content permissions of the entity folder.
|
|
61
|
+
*
|
|
61
62
|
* EDITOR: the user will have the ability to manage content in the entity folder.
|
|
63
|
+
*
|
|
62
64
|
* VIEWER: the user will only be able to view content in the entity folder.
|
|
63
65
|
*/
|
|
64
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;
|
|
65
77
|
/**
|
|
66
78
|
* Optional groups setting. An array of group names that the user will be added to.
|
|
67
79
|
*/
|
|
@@ -230,10 +242,10 @@ export type EmbedSsoContentDiscoveryProps = EmbedSsoBaseProps & {
|
|
|
230
242
|
*/
|
|
231
243
|
path: string;
|
|
232
244
|
};
|
|
233
|
-
export type
|
|
245
|
+
export type CreateSessionTokenProps = Omit<EmbedSsoContentProps, "prefersDark" | "theme" | "secret" | "nonce"> & {
|
|
234
246
|
apiKey: string;
|
|
235
247
|
} & HostProps;
|
|
236
|
-
export type
|
|
248
|
+
export type RedeemSessionTokenProps = Pick<EmbedSsoContentProps, "nonce" | "prefersDark" | "secret" | "theme" | "port"> & {
|
|
237
249
|
sessionToken: string;
|
|
238
250
|
} & HostProps;
|
|
239
251
|
export {};
|
package/package.json
CHANGED