@basedash/embed 0.1.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/LICENSE +21 -0
- package/README.md +316 -0
- package/dist/index.cjs +139 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +104 -0
- package/dist/index.d.ts +104 -0
- package/dist/index.js +129 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +486 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +134 -0
- package/dist/react.d.ts +134 -0
- package/dist/react.js +477 -0
- package/dist/react.js.map +1 -0
- package/dist/server.cjs +86 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +59 -0
- package/dist/server.d.ts +59 -0
- package/dist/server.js +83 -0
- package/dist/server.js.map +1 -0
- package/package.json +114 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Basedash
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# Basedash embed SDK
|
|
2
|
+
|
|
3
|
+
Typed server helpers and React components for embedding
|
|
4
|
+
[Basedash](https://www.basedash.com) in your product.
|
|
5
|
+
|
|
6
|
+
The SDK wraps Basedash's production iframe and JWT SSO flow. Your server signs
|
|
7
|
+
a short-lived token, your frontend fetches it, and the React component renders
|
|
8
|
+
the correct iframe URL and feature configuration.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @basedash/embed
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
React 18.2 and React 19 are supported.
|
|
17
|
+
|
|
18
|
+
## Quick start
|
|
19
|
+
|
|
20
|
+
### 1. Create a token on your server
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { createEmbedToken } from "@basedash/embed/server";
|
|
24
|
+
|
|
25
|
+
export async function GET() {
|
|
26
|
+
// Get this identity from your authenticated server session.
|
|
27
|
+
const user = {
|
|
28
|
+
email: "jane@example.com",
|
|
29
|
+
firstName: "Jane",
|
|
30
|
+
lastName: "Doe",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const token = await createEmbedToken({
|
|
34
|
+
secret: process.env.BASEDASH_EMBED_JWT_SECRET!,
|
|
35
|
+
orgId: process.env.BASEDASH_ORG_ID!,
|
|
36
|
+
user: {
|
|
37
|
+
...user,
|
|
38
|
+
role: "MEMBER",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return new Response(token, {
|
|
43
|
+
headers: {
|
|
44
|
+
"Cache-Control": "no-store",
|
|
45
|
+
"Content-Type": "text/plain",
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`createEmbedToken` is exported from the server-only entry point. Never import it
|
|
52
|
+
into browser code or expose your embed secret through a public environment
|
|
53
|
+
variable.
|
|
54
|
+
|
|
55
|
+
### 2. Render a Basedash component
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
"use client";
|
|
59
|
+
|
|
60
|
+
import { BasedashChat, BasedashProvider } from "@basedash/embed/react";
|
|
61
|
+
import { useCallback } from "react";
|
|
62
|
+
|
|
63
|
+
export function Analytics() {
|
|
64
|
+
const fetchToken = useCallback(async () => {
|
|
65
|
+
const response = await fetch("/api/basedash-token");
|
|
66
|
+
if (!response.ok) {
|
|
67
|
+
throw new Error("Could not create a Basedash token");
|
|
68
|
+
}
|
|
69
|
+
return response.text();
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<BasedashProvider fetchToken={fetchToken} theme="auto">
|
|
74
|
+
<BasedashChat
|
|
75
|
+
loadingFallback={<p>Loading analytics…</p>}
|
|
76
|
+
style={{ height: 720 }}
|
|
77
|
+
/>
|
|
78
|
+
</BasedashProvider>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The provider fetches once per mount. Multiple components under the same
|
|
84
|
+
provider reuse the token.
|
|
85
|
+
|
|
86
|
+
## React components
|
|
87
|
+
|
|
88
|
+
Import React APIs from `@basedash/embed/react`.
|
|
89
|
+
|
|
90
|
+
### `BasedashChat`
|
|
91
|
+
|
|
92
|
+
Embeds chat and hides dashboards, insights, automations, and the organization
|
|
93
|
+
name by default.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<BasedashChat hideSuggestedPrompts />
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### `BasedashDashboards`
|
|
100
|
+
|
|
101
|
+
Embeds the interactive dashboards workspace and hides all other primary
|
|
102
|
+
features.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
<BasedashDashboards />
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### `BasedashInsights`
|
|
109
|
+
|
|
110
|
+
Embeds insights and hides all other primary features.
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
<BasedashInsights />
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The organization must have insights enabled.
|
|
117
|
+
|
|
118
|
+
### `BasedashAutomations`
|
|
119
|
+
|
|
120
|
+
Embeds automations and hides all other primary features.
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
<BasedashAutomations />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The organization must have automations enabled.
|
|
127
|
+
|
|
128
|
+
### `BasedashApp`
|
|
129
|
+
|
|
130
|
+
Embeds the complete Basedash app. Feature props map to the existing Basedash
|
|
131
|
+
embed configuration.
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
<BasedashApp
|
|
135
|
+
hideOrgName
|
|
136
|
+
hideInsights
|
|
137
|
+
hideAutomations
|
|
138
|
+
hideSuggestedPrompts
|
|
139
|
+
/>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
At least one of chat, dashboards, insights, or automations must remain visible.
|
|
143
|
+
Basedash falls back to chat if all four are hidden.
|
|
144
|
+
|
|
145
|
+
### `BasedashSharedDashboard`
|
|
146
|
+
|
|
147
|
+
Embeds a read-only dashboard from a public sharing link. It does not require a
|
|
148
|
+
provider or a user token.
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
<BasedashSharedDashboard publicSharingLinkId="abc123" />
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
To lock dashboard filters, create a server-side filter token and pass it to the
|
|
155
|
+
component:
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
import { createDashboardFilterToken } from "@basedash/embed/server";
|
|
159
|
+
|
|
160
|
+
const filterToken = await createDashboardFilterToken({
|
|
161
|
+
secret: process.env.BASEDASH_EMBED_JWT_SECRET!,
|
|
162
|
+
dashboardLinkId: "abc123",
|
|
163
|
+
params: {
|
|
164
|
+
company_id: "company_456",
|
|
165
|
+
regions: ["us", "ca"],
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
<BasedashSharedDashboard
|
|
172
|
+
publicSharingLinkId="abc123"
|
|
173
|
+
filterToken={filterToken}
|
|
174
|
+
/>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Authentication options
|
|
178
|
+
|
|
179
|
+
Use `fetchToken` when the browser should request the current user's token from
|
|
180
|
+
your backend:
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
<BasedashProvider fetchToken={fetchToken}>
|
|
184
|
+
<BasedashApp />
|
|
185
|
+
</BasedashProvider>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
If your React tree already receives a server-generated token, pass it directly:
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
<BasedashProvider token={token}>
|
|
192
|
+
<BasedashDashboards />
|
|
193
|
+
</BasedashProvider>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
You can also pass `token` directly to an authenticated component without a
|
|
197
|
+
provider:
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
<BasedashChat token={token} />
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`useBasedash()` exposes the current `token`, `status`, `error`, and a
|
|
204
|
+
`refreshToken()` method.
|
|
205
|
+
|
|
206
|
+
## Frame props
|
|
207
|
+
|
|
208
|
+
All components accept:
|
|
209
|
+
|
|
210
|
+
- `className` and `style` for the outer container
|
|
211
|
+
- `iframeProps` for the underlying iframe
|
|
212
|
+
- `loadingFallback`, shown until the iframe loads
|
|
213
|
+
- `errorFallback`, shown when provider token fetching fails
|
|
214
|
+
- `title` for the iframe's accessible name
|
|
215
|
+
- `instanceUrl` for self-hosted Basedash
|
|
216
|
+
|
|
217
|
+
The iframe defaults to full width and height, no border,
|
|
218
|
+
`allow="clipboard-write"`, and eager loading.
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
<BasedashDashboards
|
|
222
|
+
className="analytics"
|
|
223
|
+
style={{ minHeight: 640 }}
|
|
224
|
+
iframeProps={{
|
|
225
|
+
allow: "clipboard-write; fullscreen",
|
|
226
|
+
onLoad: () => console.log("Basedash loaded"),
|
|
227
|
+
}}
|
|
228
|
+
/>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Non-React usage
|
|
232
|
+
|
|
233
|
+
The root entry point has zero framework dependencies and can build iframe URLs
|
|
234
|
+
for any frontend:
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
import { buildEmbedUrl } from "@basedash/embed";
|
|
238
|
+
|
|
239
|
+
const src = buildEmbedUrl({
|
|
240
|
+
token,
|
|
241
|
+
options: {
|
|
242
|
+
theme: "dark",
|
|
243
|
+
hideOrgName: true,
|
|
244
|
+
hideChat: true,
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
For public dashboards:
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
import { buildSharedDashboardUrl } from "@basedash/embed";
|
|
253
|
+
|
|
254
|
+
const src = buildSharedDashboardUrl({
|
|
255
|
+
publicSharingLinkId: "abc123",
|
|
256
|
+
filterToken,
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
These helpers emit every embed option explicitly so changing or remounting an
|
|
261
|
+
embed cannot inherit stale session configuration.
|
|
262
|
+
|
|
263
|
+
## Self-hosted Basedash
|
|
264
|
+
|
|
265
|
+
Set `instanceUrl` on the provider or component:
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
<BasedashProvider
|
|
269
|
+
fetchToken={fetchToken}
|
|
270
|
+
instanceUrl="https://analytics.example.com"
|
|
271
|
+
>
|
|
272
|
+
<BasedashApp />
|
|
273
|
+
</BasedashProvider>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Server token generation is identical for cloud and self-hosted instances.
|
|
277
|
+
|
|
278
|
+
## Before going to production
|
|
279
|
+
|
|
280
|
+
1. Enable full app embedding in **Settings → Embedding**.
|
|
281
|
+
2. Store the JWT secret from **Settings → Security** only on your backend.
|
|
282
|
+
3. Configure your production domains under allowed embed origins.
|
|
283
|
+
4. Verify every token request against your own authenticated user and
|
|
284
|
+
authorization rules.
|
|
285
|
+
5. Connect Basedash with read-only database credentials.
|
|
286
|
+
|
|
287
|
+
Tokens default to a 10-minute lifetime. Shared dashboard filter tokens default
|
|
288
|
+
to one hour. A valid full-app token is only needed when the iframe establishes
|
|
289
|
+
its Basedash session.
|
|
290
|
+
|
|
291
|
+
## Current limitations
|
|
292
|
+
|
|
293
|
+
- The SDK wraps iframes; it does not render Basedash UI natively.
|
|
294
|
+
- Basedash does not yet expose an iframe `postMessage` protocol, so auto-resize,
|
|
295
|
+
navigation events, and host-triggered actions are not available.
|
|
296
|
+
- Shared dashboard embeds are supported. A standalone shared-chart embed is
|
|
297
|
+
not currently available from the Basedash app.
|
|
298
|
+
|
|
299
|
+
## Development
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
pnpm install
|
|
303
|
+
pnpm check
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
The package ships ESM, CommonJS, and TypeScript declarations for:
|
|
307
|
+
|
|
308
|
+
- `@basedash/embed`
|
|
309
|
+
- `@basedash/embed/server`
|
|
310
|
+
- `@basedash/embed/react`
|
|
311
|
+
|
|
312
|
+
See `examples/nextjs` and `examples/vite` for integrations.
|
|
313
|
+
|
|
314
|
+
## License
|
|
315
|
+
|
|
316
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/embed.ts
|
|
4
|
+
var DEFAULT_BASEDASH_URL = "https://charts.basedash.com";
|
|
5
|
+
var EMBED_QUERY_PARAMS = {
|
|
6
|
+
theme: "theme",
|
|
7
|
+
hideOrgName: "hide_org_name",
|
|
8
|
+
hideChat: "hide_chat",
|
|
9
|
+
hideDashboards: "hide_dashboards",
|
|
10
|
+
hideInsights: "hide_insights",
|
|
11
|
+
hideAutomations: "hide_automations",
|
|
12
|
+
hideSuggestedPrompts: "hide_suggested_prompts"
|
|
13
|
+
};
|
|
14
|
+
var DEFAULT_EMBED_OPTIONS = {
|
|
15
|
+
theme: "auto",
|
|
16
|
+
hideOrgName: false,
|
|
17
|
+
hideChat: false,
|
|
18
|
+
hideDashboards: false,
|
|
19
|
+
hideInsights: false,
|
|
20
|
+
hideAutomations: false,
|
|
21
|
+
hideSuggestedPrompts: false
|
|
22
|
+
};
|
|
23
|
+
var CHAT_EMBED_OPTIONS = {
|
|
24
|
+
...DEFAULT_EMBED_OPTIONS,
|
|
25
|
+
hideOrgName: true,
|
|
26
|
+
hideDashboards: true,
|
|
27
|
+
hideInsights: true,
|
|
28
|
+
hideAutomations: true
|
|
29
|
+
};
|
|
30
|
+
var DASHBOARDS_EMBED_OPTIONS = {
|
|
31
|
+
...DEFAULT_EMBED_OPTIONS,
|
|
32
|
+
hideOrgName: true,
|
|
33
|
+
hideChat: true,
|
|
34
|
+
hideInsights: true,
|
|
35
|
+
hideAutomations: true
|
|
36
|
+
};
|
|
37
|
+
var INSIGHTS_EMBED_OPTIONS = {
|
|
38
|
+
...DEFAULT_EMBED_OPTIONS,
|
|
39
|
+
hideOrgName: true,
|
|
40
|
+
hideChat: true,
|
|
41
|
+
hideDashboards: true,
|
|
42
|
+
hideAutomations: true
|
|
43
|
+
};
|
|
44
|
+
var AUTOMATIONS_EMBED_OPTIONS = {
|
|
45
|
+
...DEFAULT_EMBED_OPTIONS,
|
|
46
|
+
hideOrgName: true,
|
|
47
|
+
hideChat: true,
|
|
48
|
+
hideDashboards: true,
|
|
49
|
+
hideInsights: true
|
|
50
|
+
};
|
|
51
|
+
function buildEmbedUrl({
|
|
52
|
+
token,
|
|
53
|
+
options,
|
|
54
|
+
instanceUrl = DEFAULT_BASEDASH_URL
|
|
55
|
+
}) {
|
|
56
|
+
assertNonEmpty(token, "token");
|
|
57
|
+
const url = createInstanceUrl(instanceUrl, "api/sso/jwt");
|
|
58
|
+
const resolvedOptions = {
|
|
59
|
+
theme: options?.theme ?? DEFAULT_EMBED_OPTIONS.theme,
|
|
60
|
+
hideOrgName: options?.hideOrgName ?? DEFAULT_EMBED_OPTIONS.hideOrgName,
|
|
61
|
+
hideChat: options?.hideChat ?? DEFAULT_EMBED_OPTIONS.hideChat,
|
|
62
|
+
hideDashboards: options?.hideDashboards ?? DEFAULT_EMBED_OPTIONS.hideDashboards,
|
|
63
|
+
hideInsights: options?.hideInsights ?? DEFAULT_EMBED_OPTIONS.hideInsights,
|
|
64
|
+
hideAutomations: options?.hideAutomations ?? DEFAULT_EMBED_OPTIONS.hideAutomations,
|
|
65
|
+
hideSuggestedPrompts: options?.hideSuggestedPrompts ?? DEFAULT_EMBED_OPTIONS.hideSuggestedPrompts
|
|
66
|
+
};
|
|
67
|
+
url.searchParams.set("jwt", token);
|
|
68
|
+
url.searchParams.set(EMBED_QUERY_PARAMS.theme, resolvedOptions.theme);
|
|
69
|
+
url.searchParams.set(
|
|
70
|
+
EMBED_QUERY_PARAMS.hideOrgName,
|
|
71
|
+
String(resolvedOptions.hideOrgName)
|
|
72
|
+
);
|
|
73
|
+
url.searchParams.set(
|
|
74
|
+
EMBED_QUERY_PARAMS.hideChat,
|
|
75
|
+
String(resolvedOptions.hideChat)
|
|
76
|
+
);
|
|
77
|
+
url.searchParams.set(
|
|
78
|
+
EMBED_QUERY_PARAMS.hideDashboards,
|
|
79
|
+
String(resolvedOptions.hideDashboards)
|
|
80
|
+
);
|
|
81
|
+
url.searchParams.set(
|
|
82
|
+
EMBED_QUERY_PARAMS.hideInsights,
|
|
83
|
+
String(resolvedOptions.hideInsights)
|
|
84
|
+
);
|
|
85
|
+
url.searchParams.set(
|
|
86
|
+
EMBED_QUERY_PARAMS.hideAutomations,
|
|
87
|
+
String(resolvedOptions.hideAutomations)
|
|
88
|
+
);
|
|
89
|
+
url.searchParams.set(
|
|
90
|
+
EMBED_QUERY_PARAMS.hideSuggestedPrompts,
|
|
91
|
+
String(resolvedOptions.hideSuggestedPrompts)
|
|
92
|
+
);
|
|
93
|
+
return url.toString();
|
|
94
|
+
}
|
|
95
|
+
function buildSharedDashboardUrl({
|
|
96
|
+
publicSharingLinkId,
|
|
97
|
+
filterToken,
|
|
98
|
+
instanceUrl = DEFAULT_BASEDASH_URL
|
|
99
|
+
}) {
|
|
100
|
+
assertNonEmpty(publicSharingLinkId, "publicSharingLinkId");
|
|
101
|
+
const path = filterToken ? `shared/${encodeURIComponent(publicSharingLinkId)}/${encodeURIComponent(
|
|
102
|
+
filterToken
|
|
103
|
+
)}` : `shared/${encodeURIComponent(publicSharingLinkId)}`;
|
|
104
|
+
return createInstanceUrl(instanceUrl, path).toString();
|
|
105
|
+
}
|
|
106
|
+
function createInstanceUrl(instanceUrl, path) {
|
|
107
|
+
let baseUrl;
|
|
108
|
+
try {
|
|
109
|
+
baseUrl = new URL(instanceUrl);
|
|
110
|
+
} catch {
|
|
111
|
+
throw new TypeError(`instanceUrl must be a valid URL: ${instanceUrl}`);
|
|
112
|
+
}
|
|
113
|
+
if (baseUrl.protocol !== "https:" && baseUrl.protocol !== "http:") {
|
|
114
|
+
throw new TypeError("instanceUrl must use http or https");
|
|
115
|
+
}
|
|
116
|
+
baseUrl.search = "";
|
|
117
|
+
baseUrl.hash = "";
|
|
118
|
+
if (!baseUrl.pathname.endsWith("/")) {
|
|
119
|
+
baseUrl.pathname += "/";
|
|
120
|
+
}
|
|
121
|
+
return new URL(path, baseUrl);
|
|
122
|
+
}
|
|
123
|
+
function assertNonEmpty(value, name) {
|
|
124
|
+
if (value.trim().length === 0) {
|
|
125
|
+
throw new TypeError(`${name} must not be empty`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
exports.AUTOMATIONS_EMBED_OPTIONS = AUTOMATIONS_EMBED_OPTIONS;
|
|
130
|
+
exports.CHAT_EMBED_OPTIONS = CHAT_EMBED_OPTIONS;
|
|
131
|
+
exports.DASHBOARDS_EMBED_OPTIONS = DASHBOARDS_EMBED_OPTIONS;
|
|
132
|
+
exports.DEFAULT_BASEDASH_URL = DEFAULT_BASEDASH_URL;
|
|
133
|
+
exports.DEFAULT_EMBED_OPTIONS = DEFAULT_EMBED_OPTIONS;
|
|
134
|
+
exports.EMBED_QUERY_PARAMS = EMBED_QUERY_PARAMS;
|
|
135
|
+
exports.INSIGHTS_EMBED_OPTIONS = INSIGHTS_EMBED_OPTIONS;
|
|
136
|
+
exports.buildEmbedUrl = buildEmbedUrl;
|
|
137
|
+
exports.buildSharedDashboardUrl = buildSharedDashboardUrl;
|
|
138
|
+
//# sourceMappingURL=index.cjs.map
|
|
139
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/embed.ts"],"names":[],"mappings":";;;AAAO,IAAM,oBAAA,GAAuB;AAE7B,IAAM,kBAAA,GAAqB;AAAA,EAChC,KAAA,EAAO,OAAA;AAAA,EACP,WAAA,EAAa,eAAA;AAAA,EACb,QAAA,EAAU,WAAA;AAAA,EACV,cAAA,EAAgB,iBAAA;AAAA,EAChB,YAAA,EAAc,eAAA;AAAA,EACd,eAAA,EAAiB,kBAAA;AAAA,EACjB,oBAAA,EAAsB;AACxB;AAqDO,IAAM,qBAAA,GAAwB;AAAA,EACnC,KAAA,EAAO,MAAA;AAAA,EACP,WAAA,EAAa,KAAA;AAAA,EACb,QAAA,EAAU,KAAA;AAAA,EACV,cAAA,EAAgB,KAAA;AAAA,EAChB,YAAA,EAAc,KAAA;AAAA,EACd,eAAA,EAAiB,KAAA;AAAA,EACjB,oBAAA,EAAsB;AACxB;AAEO,IAAM,kBAAA,GAAqB;AAAA,EAChC,GAAG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FAULT_BASEDASH_URL = \"https://charts.basedash.com\";\n\nexport const EMBED_QUERY_PARAMS = {\n theme: \"theme\",\n hideOrgName: \"hide_org_name\",\n hideChat: \"hide_chat\",\n hideDashboards: \"hide_dashboards\",\n hideInsights: \"hide_insights\",\n hideAutomations: \"hide_automations\",\n hideSuggestedPrompts: \"hide_suggested_prompts\",\n} as const;\n\nexport type BasedashTheme = \"light\" | \"dark\" | \"auto\";\n\nexport type BasedashRole = \"ADMIN\" | \"MEMBER\";\n\nexport interface EmbedUser {\n email: string;\n firstName?: string;\n lastName?: string;\n role?: BasedashRole;\n /**\n * Reserved for future group synchronization support in Basedash.\n */\n groups?: string[];\n}\n\nexport interface EmbedOptions {\n theme?: BasedashTheme;\n hideOrgName?: boolean;\n hideChat?: boolean;\n hideDashboards?: boolean;\n hideInsights?: boolean;\n hideAutomations?: boolean;\n hideSuggestedPrompts?: boolean;\n}\n\nexport interface BuildEmbedUrlOptions {\n token: string;\n options?: EmbedOptions;\n /**\n * Override this when embedding a self-hosted Basedash instance.\n *\n * @default \"https://charts.basedash.com\"\n */\n instanceUrl?: string;\n}\n\nexport interface BuildSharedDashboardUrlOptions {\n publicSharingLinkId: string;\n /**\n * A token created with `createDashboardFilterToken` from\n * `@basedash/embed/server`.\n */\n filterToken?: string;\n /**\n * Override this when embedding a self-hosted Basedash instance.\n *\n * @default \"https://charts.basedash.com\"\n */\n instanceUrl?: string;\n}\n\nexport const DEFAULT_EMBED_OPTIONS = {\n theme: \"auto\",\n hideOrgName: false,\n hideChat: false,\n hideDashboards: false,\n hideInsights: false,\n hideAutomations: false,\n hideSuggestedPrompts: false,\n} as const satisfies Required<EmbedOptions>;\n\nexport const CHAT_EMBED_OPTIONS = {\n ...DEFAULT_EMBED_OPTIONS,\n hideOrgName: true,\n hideDashboards: true,\n hideInsights: true,\n hideAutomations: true,\n} as const satisfies Required<EmbedOptions>;\n\nexport const DASHBOARDS_EMBED_OPTIONS = {\n ...DEFAULT_EMBED_OPTIONS,\n hideOrgName: true,\n hideChat: true,\n hideInsights: true,\n hideAutomations: true,\n} as const satisfies Required<EmbedOptions>;\n\nexport const INSIGHTS_EMBED_OPTIONS = {\n ...DEFAULT_EMBED_OPTIONS,\n hideOrgName: true,\n hideChat: true,\n hideDashboards: true,\n hideAutomations: true,\n} as const satisfies Required<EmbedOptions>;\n\nexport const AUTOMATIONS_EMBED_OPTIONS = {\n ...DEFAULT_EMBED_OPTIONS,\n hideOrgName: true,\n hideChat: true,\n hideDashboards: true,\n hideInsights: true,\n} as const satisfies Required<EmbedOptions>;\n\nexport function buildEmbedUrl({\n token,\n options,\n instanceUrl = DEFAULT_BASEDASH_URL,\n}: BuildEmbedUrlOptions): string {\n assertNonEmpty(token, \"token\");\n\n const url = createInstanceUrl(instanceUrl, \"api/sso/jwt\");\n const resolvedOptions: Required<EmbedOptions> = {\n theme: options?.theme ?? DEFAULT_EMBED_OPTIONS.theme,\n hideOrgName:\n options?.hideOrgName ?? DEFAULT_EMBED_OPTIONS.hideOrgName,\n hideChat: options?.hideChat ?? DEFAULT_EMBED_OPTIONS.hideChat,\n hideDashboards:\n options?.hideDashboards ?? DEFAULT_EMBED_OPTIONS.hideDashboards,\n hideInsights:\n options?.hideInsights ?? DEFAULT_EMBED_OPTIONS.hideInsights,\n hideAutomations:\n options?.hideAutomations ?? DEFAULT_EMBED_OPTIONS.hideAutomations,\n hideSuggestedPrompts:\n options?.hideSuggestedPrompts ??\n DEFAULT_EMBED_OPTIONS.hideSuggestedPrompts,\n };\n\n url.searchParams.set(\"jwt\", token);\n url.searchParams.set(EMBED_QUERY_PARAMS.theme, resolvedOptions.theme);\n url.searchParams.set(\n EMBED_QUERY_PARAMS.hideOrgName,\n String(resolvedOptions.hideOrgName),\n );\n url.searchParams.set(\n EMBED_QUERY_PARAMS.hideChat,\n String(resolvedOptions.hideChat),\n );\n url.searchParams.set(\n EMBED_QUERY_PARAMS.hideDashboards,\n String(resolvedOptions.hideDashboards),\n );\n url.searchParams.set(\n EMBED_QUERY_PARAMS.hideInsights,\n String(resolvedOptions.hideInsights),\n );\n url.searchParams.set(\n EMBED_QUERY_PARAMS.hideAutomations,\n String(resolvedOptions.hideAutomations),\n );\n url.searchParams.set(\n EMBED_QUERY_PARAMS.hideSuggestedPrompts,\n String(resolvedOptions.hideSuggestedPrompts),\n );\n\n return url.toString();\n}\n\nexport function buildSharedDashboardUrl({\n publicSharingLinkId,\n filterToken,\n instanceUrl = DEFAULT_BASEDASH_URL,\n}: BuildSharedDashboardUrlOptions): string {\n assertNonEmpty(publicSharingLinkId, \"publicSharingLinkId\");\n\n const path = filterToken\n ? `shared/${encodeURIComponent(publicSharingLinkId)}/${encodeURIComponent(\n filterToken,\n )}`\n : `shared/${encodeURIComponent(publicSharingLinkId)}`;\n\n return createInstanceUrl(instanceUrl, path).toString();\n}\n\nfunction createInstanceUrl(instanceUrl: string, path: string): URL {\n let baseUrl: URL;\n\n try {\n baseUrl = new URL(instanceUrl);\n } catch {\n throw new TypeError(`instanceUrl must be a valid URL: ${instanceUrl}`);\n }\n\n if (baseUrl.protocol !== \"https:\" && baseUrl.protocol !== \"http:\") {\n throw new TypeError(\"instanceUrl must use http or https\");\n }\n\n baseUrl.search = \"\";\n baseUrl.hash = \"\";\n if (!baseUrl.pathname.endsWith(\"/\")) {\n baseUrl.pathname += \"/\";\n }\n\n return new URL(path, baseUrl);\n}\n\nfunction assertNonEmpty(value: string, name: string): void {\n if (value.trim().length === 0) {\n throw new TypeError(`${name} must not be empty`);\n }\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
declare const DEFAULT_BASEDASH_URL = "https://charts.basedash.com";
|
|
2
|
+
declare const EMBED_QUERY_PARAMS: {
|
|
3
|
+
readonly theme: "theme";
|
|
4
|
+
readonly hideOrgName: "hide_org_name";
|
|
5
|
+
readonly hideChat: "hide_chat";
|
|
6
|
+
readonly hideDashboards: "hide_dashboards";
|
|
7
|
+
readonly hideInsights: "hide_insights";
|
|
8
|
+
readonly hideAutomations: "hide_automations";
|
|
9
|
+
readonly hideSuggestedPrompts: "hide_suggested_prompts";
|
|
10
|
+
};
|
|
11
|
+
type BasedashTheme = "light" | "dark" | "auto";
|
|
12
|
+
type BasedashRole = "ADMIN" | "MEMBER";
|
|
13
|
+
interface EmbedUser {
|
|
14
|
+
email: string;
|
|
15
|
+
firstName?: string;
|
|
16
|
+
lastName?: string;
|
|
17
|
+
role?: BasedashRole;
|
|
18
|
+
/**
|
|
19
|
+
* Reserved for future group synchronization support in Basedash.
|
|
20
|
+
*/
|
|
21
|
+
groups?: string[];
|
|
22
|
+
}
|
|
23
|
+
interface EmbedOptions {
|
|
24
|
+
theme?: BasedashTheme;
|
|
25
|
+
hideOrgName?: boolean;
|
|
26
|
+
hideChat?: boolean;
|
|
27
|
+
hideDashboards?: boolean;
|
|
28
|
+
hideInsights?: boolean;
|
|
29
|
+
hideAutomations?: boolean;
|
|
30
|
+
hideSuggestedPrompts?: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface BuildEmbedUrlOptions {
|
|
33
|
+
token: string;
|
|
34
|
+
options?: EmbedOptions;
|
|
35
|
+
/**
|
|
36
|
+
* Override this when embedding a self-hosted Basedash instance.
|
|
37
|
+
*
|
|
38
|
+
* @default "https://charts.basedash.com"
|
|
39
|
+
*/
|
|
40
|
+
instanceUrl?: string;
|
|
41
|
+
}
|
|
42
|
+
interface BuildSharedDashboardUrlOptions {
|
|
43
|
+
publicSharingLinkId: string;
|
|
44
|
+
/**
|
|
45
|
+
* A token created with `createDashboardFilterToken` from
|
|
46
|
+
* `@basedash/embed/server`.
|
|
47
|
+
*/
|
|
48
|
+
filterToken?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Override this when embedding a self-hosted Basedash instance.
|
|
51
|
+
*
|
|
52
|
+
* @default "https://charts.basedash.com"
|
|
53
|
+
*/
|
|
54
|
+
instanceUrl?: string;
|
|
55
|
+
}
|
|
56
|
+
declare const DEFAULT_EMBED_OPTIONS: {
|
|
57
|
+
readonly theme: "auto";
|
|
58
|
+
readonly hideOrgName: false;
|
|
59
|
+
readonly hideChat: false;
|
|
60
|
+
readonly hideDashboards: false;
|
|
61
|
+
readonly hideInsights: false;
|
|
62
|
+
readonly hideAutomations: false;
|
|
63
|
+
readonly hideSuggestedPrompts: false;
|
|
64
|
+
};
|
|
65
|
+
declare const CHAT_EMBED_OPTIONS: {
|
|
66
|
+
readonly hideOrgName: true;
|
|
67
|
+
readonly hideDashboards: true;
|
|
68
|
+
readonly hideInsights: true;
|
|
69
|
+
readonly hideAutomations: true;
|
|
70
|
+
readonly theme: "auto";
|
|
71
|
+
readonly hideChat: false;
|
|
72
|
+
readonly hideSuggestedPrompts: false;
|
|
73
|
+
};
|
|
74
|
+
declare const DASHBOARDS_EMBED_OPTIONS: {
|
|
75
|
+
readonly hideOrgName: true;
|
|
76
|
+
readonly hideChat: true;
|
|
77
|
+
readonly hideInsights: true;
|
|
78
|
+
readonly hideAutomations: true;
|
|
79
|
+
readonly theme: "auto";
|
|
80
|
+
readonly hideDashboards: false;
|
|
81
|
+
readonly hideSuggestedPrompts: false;
|
|
82
|
+
};
|
|
83
|
+
declare const INSIGHTS_EMBED_OPTIONS: {
|
|
84
|
+
readonly hideOrgName: true;
|
|
85
|
+
readonly hideChat: true;
|
|
86
|
+
readonly hideDashboards: true;
|
|
87
|
+
readonly hideAutomations: true;
|
|
88
|
+
readonly theme: "auto";
|
|
89
|
+
readonly hideInsights: false;
|
|
90
|
+
readonly hideSuggestedPrompts: false;
|
|
91
|
+
};
|
|
92
|
+
declare const AUTOMATIONS_EMBED_OPTIONS: {
|
|
93
|
+
readonly hideOrgName: true;
|
|
94
|
+
readonly hideChat: true;
|
|
95
|
+
readonly hideDashboards: true;
|
|
96
|
+
readonly hideInsights: true;
|
|
97
|
+
readonly theme: "auto";
|
|
98
|
+
readonly hideAutomations: false;
|
|
99
|
+
readonly hideSuggestedPrompts: false;
|
|
100
|
+
};
|
|
101
|
+
declare function buildEmbedUrl({ token, options, instanceUrl, }: BuildEmbedUrlOptions): string;
|
|
102
|
+
declare function buildSharedDashboardUrl({ publicSharingLinkId, filterToken, instanceUrl, }: BuildSharedDashboardUrlOptions): string;
|
|
103
|
+
|
|
104
|
+
export { AUTOMATIONS_EMBED_OPTIONS, type BasedashRole, type BasedashTheme, type BuildEmbedUrlOptions, type BuildSharedDashboardUrlOptions, CHAT_EMBED_OPTIONS, DASHBOARDS_EMBED_OPTIONS, DEFAULT_BASEDASH_URL, DEFAULT_EMBED_OPTIONS, EMBED_QUERY_PARAMS, type EmbedOptions, type EmbedUser, INSIGHTS_EMBED_OPTIONS, buildEmbedUrl, buildSharedDashboardUrl };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
declare const DEFAULT_BASEDASH_URL = "https://charts.basedash.com";
|
|
2
|
+
declare const EMBED_QUERY_PARAMS: {
|
|
3
|
+
readonly theme: "theme";
|
|
4
|
+
readonly hideOrgName: "hide_org_name";
|
|
5
|
+
readonly hideChat: "hide_chat";
|
|
6
|
+
readonly hideDashboards: "hide_dashboards";
|
|
7
|
+
readonly hideInsights: "hide_insights";
|
|
8
|
+
readonly hideAutomations: "hide_automations";
|
|
9
|
+
readonly hideSuggestedPrompts: "hide_suggested_prompts";
|
|
10
|
+
};
|
|
11
|
+
type BasedashTheme = "light" | "dark" | "auto";
|
|
12
|
+
type BasedashRole = "ADMIN" | "MEMBER";
|
|
13
|
+
interface EmbedUser {
|
|
14
|
+
email: string;
|
|
15
|
+
firstName?: string;
|
|
16
|
+
lastName?: string;
|
|
17
|
+
role?: BasedashRole;
|
|
18
|
+
/**
|
|
19
|
+
* Reserved for future group synchronization support in Basedash.
|
|
20
|
+
*/
|
|
21
|
+
groups?: string[];
|
|
22
|
+
}
|
|
23
|
+
interface EmbedOptions {
|
|
24
|
+
theme?: BasedashTheme;
|
|
25
|
+
hideOrgName?: boolean;
|
|
26
|
+
hideChat?: boolean;
|
|
27
|
+
hideDashboards?: boolean;
|
|
28
|
+
hideInsights?: boolean;
|
|
29
|
+
hideAutomations?: boolean;
|
|
30
|
+
hideSuggestedPrompts?: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface BuildEmbedUrlOptions {
|
|
33
|
+
token: string;
|
|
34
|
+
options?: EmbedOptions;
|
|
35
|
+
/**
|
|
36
|
+
* Override this when embedding a self-hosted Basedash instance.
|
|
37
|
+
*
|
|
38
|
+
* @default "https://charts.basedash.com"
|
|
39
|
+
*/
|
|
40
|
+
instanceUrl?: string;
|
|
41
|
+
}
|
|
42
|
+
interface BuildSharedDashboardUrlOptions {
|
|
43
|
+
publicSharingLinkId: string;
|
|
44
|
+
/**
|
|
45
|
+
* A token created with `createDashboardFilterToken` from
|
|
46
|
+
* `@basedash/embed/server`.
|
|
47
|
+
*/
|
|
48
|
+
filterToken?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Override this when embedding a self-hosted Basedash instance.
|
|
51
|
+
*
|
|
52
|
+
* @default "https://charts.basedash.com"
|
|
53
|
+
*/
|
|
54
|
+
instanceUrl?: string;
|
|
55
|
+
}
|
|
56
|
+
declare const DEFAULT_EMBED_OPTIONS: {
|
|
57
|
+
readonly theme: "auto";
|
|
58
|
+
readonly hideOrgName: false;
|
|
59
|
+
readonly hideChat: false;
|
|
60
|
+
readonly hideDashboards: false;
|
|
61
|
+
readonly hideInsights: false;
|
|
62
|
+
readonly hideAutomations: false;
|
|
63
|
+
readonly hideSuggestedPrompts: false;
|
|
64
|
+
};
|
|
65
|
+
declare const CHAT_EMBED_OPTIONS: {
|
|
66
|
+
readonly hideOrgName: true;
|
|
67
|
+
readonly hideDashboards: true;
|
|
68
|
+
readonly hideInsights: true;
|
|
69
|
+
readonly hideAutomations: true;
|
|
70
|
+
readonly theme: "auto";
|
|
71
|
+
readonly hideChat: false;
|
|
72
|
+
readonly hideSuggestedPrompts: false;
|
|
73
|
+
};
|
|
74
|
+
declare const DASHBOARDS_EMBED_OPTIONS: {
|
|
75
|
+
readonly hideOrgName: true;
|
|
76
|
+
readonly hideChat: true;
|
|
77
|
+
readonly hideInsights: true;
|
|
78
|
+
readonly hideAutomations: true;
|
|
79
|
+
readonly theme: "auto";
|
|
80
|
+
readonly hideDashboards: false;
|
|
81
|
+
readonly hideSuggestedPrompts: false;
|
|
82
|
+
};
|
|
83
|
+
declare const INSIGHTS_EMBED_OPTIONS: {
|
|
84
|
+
readonly hideOrgName: true;
|
|
85
|
+
readonly hideChat: true;
|
|
86
|
+
readonly hideDashboards: true;
|
|
87
|
+
readonly hideAutomations: true;
|
|
88
|
+
readonly theme: "auto";
|
|
89
|
+
readonly hideInsights: false;
|
|
90
|
+
readonly hideSuggestedPrompts: false;
|
|
91
|
+
};
|
|
92
|
+
declare const AUTOMATIONS_EMBED_OPTIONS: {
|
|
93
|
+
readonly hideOrgName: true;
|
|
94
|
+
readonly hideChat: true;
|
|
95
|
+
readonly hideDashboards: true;
|
|
96
|
+
readonly hideInsights: true;
|
|
97
|
+
readonly theme: "auto";
|
|
98
|
+
readonly hideAutomations: false;
|
|
99
|
+
readonly hideSuggestedPrompts: false;
|
|
100
|
+
};
|
|
101
|
+
declare function buildEmbedUrl({ token, options, instanceUrl, }: BuildEmbedUrlOptions): string;
|
|
102
|
+
declare function buildSharedDashboardUrl({ publicSharingLinkId, filterToken, instanceUrl, }: BuildSharedDashboardUrlOptions): string;
|
|
103
|
+
|
|
104
|
+
export { AUTOMATIONS_EMBED_OPTIONS, type BasedashRole, type BasedashTheme, type BuildEmbedUrlOptions, type BuildSharedDashboardUrlOptions, CHAT_EMBED_OPTIONS, DASHBOARDS_EMBED_OPTIONS, DEFAULT_BASEDASH_URL, DEFAULT_EMBED_OPTIONS, EMBED_QUERY_PARAMS, type EmbedOptions, type EmbedUser, INSIGHTS_EMBED_OPTIONS, buildEmbedUrl, buildSharedDashboardUrl };
|