Skip to content

Commit 4de5251

Browse files
authored
fix: fix scrollbar and dev env vars (#21)
1 parent acbc8a0 commit 4de5251

File tree

5 files changed

+30
-8
lines changed

5 files changed

+30
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Load the widget via a CDN:
4747
```html
4848
<button id="open-airbyte">Open Airbyte</button>
4949

50-
<script src="https://cdn.jsdelivr.net/npm/@airbyte-embedded/airbyte-embedded-widget"></script>
50+
<script src="https://cdn.jsdelivr.net/npm/@airbyte-embedded/airbyte-embedded-widget@0.4.2"></script>
5151
<script>
5252
const widget = new AirbyteEmbeddedWidget({
5353
token: "<your-token-here>",

demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<h1>Airbyte Embedded Widget</h1>
2424
<button id="open-widget" class="open-widget-btn">Open Airbyte Widget</button>
2525

26-
<script src="https://cdn.jsdelivr.net/npm/@airbyte-embedded/airbyte-embedded-widget"></script>
26+
<script src="https://cdn.jsdelivr.net/npm/@airbyte-embedded/airbyte-embedded-widget@0.4.2"></script>
2727

2828
<script>
2929
document.getElementById('open-widget').addEventListener('click', async () => {

dev/app/api/widget_token/route.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const AIRBYTE_WIDGET_URL = `${BASE_URL}/v1/embedded/widget_token`;
2222
const AIRBYTE_ACCESS_TOKEN_URL = `${BASE_URL}/v1/applications/token`;
2323
const CLIENT_ID = process.env.NEXT_PUBLIC_CLIENT_ID;
2424
const CLIENT_SECRET = process.env.NEXT_PUBLIC_CLIENT_SECRET;
25-
const WORKSPACE_ID = process.env.NEXT_PUBLIC_WORKSPACE_ID;
26-
25+
const EXTERNAL_ID = process.env.NEXT_PUBLIC_EXTERNAL_USER_ID;
26+
const ORGANIZATION_ID = process.env.NEXT_PUBLIC_ORGANIZATION_ID;
2727
export async function GET(request: NextRequest) {
2828
try {
2929
const referer = request.headers.get("referer");
@@ -43,10 +43,14 @@ export async function GET(request: NextRequest) {
4343
return NextResponse.json({ error: "Missing CLIENT_SECRET environment variable" }, { status: 500 });
4444
}
4545

46-
if (!WORKSPACE_ID) {
46+
if (!EXTERNAL_ID) {
4747
return NextResponse.json({ error: "Missing WORKSPACE_ID environment variable" }, { status: 500 });
4848
}
4949

50+
if (!ORGANIZATION_ID) {
51+
return NextResponse.json({ error: "Missing ORGANIZATION_ID environment variable" }, { status: 500 });
52+
}
53+
5054
// Get access token
5155
const accessTokenBody = JSON.stringify({
5256
client_id: CLIENT_ID,
@@ -96,7 +100,8 @@ export async function GET(request: NextRequest) {
96100
Authorization: `Bearer ${accessToken}`,
97101
},
98102
body: JSON.stringify({
99-
workspaceId: WORKSPACE_ID,
103+
externalUserId: EXTERNAL_ID,
104+
organizationId: ORGANIZATION_ID,
100105
allowedOrigin: origin,
101106
}),
102107
});
@@ -119,7 +124,7 @@ export async function GET(request: NextRequest) {
119124
const tokenUrl = new URL(decodedToken.widgetUrl);
120125

121126
const newToken = {
122-
widgetUrl: `https://localhost:3000${tokenUrl.pathname}?${tokenUrl.searchParams.toString()}`,
127+
widgetUrl: `${process.env.NEXT_PUBLIC_WEBAPP_URL}${tokenUrl.pathname}?${tokenUrl.searchParams.toString()}`,
123128
token: decodedToken.token,
124129
};
125130
debugLog("New token:", newToken);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@airbyte-embedded/airbyte-embedded-widget",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "Embedded widget for Airbyte",
55
"type": "module",
66
"main": "dist/index.cjs.js",

src/EmbeddedWidget.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ const WIDGET_STYLES = `
3939
border: none;
4040
background: transparent;
4141
position: relative;
42+
max-height: 100vh;
43+
max-width: 100vw;
44+
overflow: hidden;
4245
}
4346
4447
.airbyte-widget-dialog-container {
@@ -47,6 +50,9 @@ const WIDGET_STYLES = `
4750
background: transparent;
4851
display: flex;
4952
flex-direction: column;
53+
max-height: 100vh;
54+
max-width: 100vw;
55+
overflow: hidden;
5056
}
5157
5258
.airbyte-widget-dialog-content {
@@ -55,6 +61,8 @@ const WIDGET_STYLES = `
5561
border-radius: 10px;
5662
background: none;
5763
overflow: hidden;
64+
max-width: 100vw;
65+
max-height: calc(100vh - 60px);
5866
}
5967
6068
.airbyte-widget-dialog-branding {
@@ -67,6 +75,15 @@ const WIDGET_STYLES = `
6775
background-position: center;
6876
}
6977
78+
@media (max-height: 782px) {
79+
.airbyte-widget-dialog-branding {
80+
display: none;
81+
}
82+
.airbyte-widget-dialog-content {
83+
max-height: 100vh;
84+
}
85+
}
86+
7087
.airbyte-widget-dialog-wrapper::backdrop {
7188
background-color: hsl(241, 51%, 20%);
7289
opacity: 0.6;

0 commit comments

Comments
 (0)