@statelyai/sdk 0.1.0 → 0.1.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/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -71,7 +71,7 @@ type EmbedEventName = keyof EmbedEventMap;
|
|
|
71
71
|
type EmbedEventHandler<K extends EmbedEventName> = (data: EmbedEventMap[K]) => void;
|
|
72
72
|
interface StatelyEmbedOptions {
|
|
73
73
|
baseUrl: string;
|
|
74
|
-
apiKey
|
|
74
|
+
apiKey?: string;
|
|
75
75
|
origin?: string;
|
|
76
76
|
onReady?: () => void;
|
|
77
77
|
onLoaded?: (graph: unknown) => void;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
//#region src/embed.ts
|
|
2
2
|
const PREFIX = "@statelyai.";
|
|
3
3
|
function createStatelyEmbed(options) {
|
|
4
|
-
const
|
|
4
|
+
const base = options.baseUrl.replace(/\/+$/, "") + "/embed";
|
|
5
|
+
const embedUrl = options.apiKey ? `${base}?api_key=${encodeURIComponent(options.apiKey)}` : base;
|
|
5
6
|
const targetOrigin = options.origin ?? new URL(embedUrl).origin;
|
|
6
7
|
let iframe = null;
|
|
7
8
|
let ownedIframe = false;
|