diff --git a/packages/figma-widget/src/ui/config.ts b/packages/figma-widget/src/ui/config.ts index d72b696..29806f7 100644 --- a/packages/figma-widget/src/ui/config.ts +++ b/packages/figma-widget/src/ui/config.ts @@ -3,7 +3,7 @@ const featureFlags = { } as Record; export const config = { - API_HOST: import.meta.env.VITE_API_HOST, + HOST_URL: import.meta.env.VITE_HOST_URL, API_KEY_READ_INTERVAL: 2 * 1000, // 2 seconds CREDENTIALS_KEY: 'ds-pro__credentials', PROJECT_ID_KEY: 'ds-pro__id', diff --git a/packages/figma-widget/src/ui/modules/providers/api-provider.tsx b/packages/figma-widget/src/ui/modules/providers/api-provider.tsx index afb3342..7910883 100644 --- a/packages/figma-widget/src/ui/modules/providers/api-provider.tsx +++ b/packages/figma-widget/src/ui/modules/providers/api-provider.tsx @@ -9,7 +9,7 @@ export function ApiProvider({ children }: { children: React.ReactNode }) { {children} diff --git a/packages/figma-widget/src/ui/modules/providers/auth-provider.tsx b/packages/figma-widget/src/ui/modules/providers/auth-provider.tsx index 3a80244..e73f0e2 100644 --- a/packages/figma-widget/src/ui/modules/providers/auth-provider.tsx +++ b/packages/figma-widget/src/ui/modules/providers/auth-provider.tsx @@ -85,7 +85,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { setState('authorizing'); setShouldUpdatePlugin(true); - const startResponse = await fetch(`${config.API_HOST}/api/auth/start`, { + const startResponse = await fetch(`${config.HOST_URL}/api/auth/start`, { method: 'POST', }); @@ -97,13 +97,13 @@ export function AuthProvider({ children }: { children: React.ReactNode }) { const { writeKey, readKey } = (await startResponse.json()) as AuthStartResponse; - window.open(`${config.API_HOST}/auth/sign-in?figma_key=${writeKey}`); + window.open(`${config.HOST_URL}/auth/sign-in?figma_key=${writeKey}`); return new Promise((resolve, reject) => { // eslint-disable-next-line @typescript-eslint/no-misused-promises -- we want to use async function with interval const interval = setInterval(async () => { const exchangeResponse = await fetch( - `${config.API_HOST}/api/auth/exchange`, + `${config.HOST_URL}/api/auth/exchange`, { method: 'POST', body: JSON.stringify({ readKey }), diff --git a/packages/figma-widget/src/ui/vite-env.d.ts b/packages/figma-widget/src/ui/vite-env.d.ts index 58fa559..ed25531 100644 --- a/packages/figma-widget/src/ui/vite-env.d.ts +++ b/packages/figma-widget/src/ui/vite-env.d.ts @@ -1,7 +1,7 @@ /// interface ImportMetaEnv { - readonly VITE_API_HOST: string; + readonly VITE_HOST_URL: string; } interface ImportMeta { diff --git a/packages/figma-widget/src/widget/components/container.tsx b/packages/figma-widget/src/widget/components/container.tsx index 8f68a94..c9feae0 100644 --- a/packages/figma-widget/src/widget/components/container.tsx +++ b/packages/figma-widget/src/widget/components/container.tsx @@ -1,3 +1,4 @@ +import { config } from '../config'; import { AutoLayout, Text } from '../lib/widget'; import { ConnectButton } from '../modules/auth/connect-button'; import { Divider } from './divider'; @@ -33,7 +34,9 @@ export const Container = ({ children, ...props }: ContainerProps) => { spacing={4} verticalAlignItems="center" > - DS Pro + + DS Pro + @@ -62,6 +65,7 @@ export const Container = ({ children, ...props }: ContainerProps) => { > Feedback + Configure ); diff --git a/packages/figma-widget/src/widget/components/variables.tsx b/packages/figma-widget/src/widget/components/variables.tsx index 0ea9ce5..6dae373 100644 --- a/packages/figma-widget/src/widget/components/variables.tsx +++ b/packages/figma-widget/src/widget/components/variables.tsx @@ -30,7 +30,7 @@ export function Variables({ > - 🧩 Local variables + 🧩 Local styles & variables diff --git a/packages/figma-widget/src/widget/config.ts b/packages/figma-widget/src/widget/config.ts index 7a74603..664b05c 100644 --- a/packages/figma-widget/src/widget/config.ts +++ b/packages/figma-widget/src/widget/config.ts @@ -1,3 +1,4 @@ export const config = { + HOST_URL: import.meta.env.VITE_HOST_URL, extensionPluginKey: 'pro.getds.figma', } as const; diff --git a/packages/figma-widget/src/widget/tsconfig.json b/packages/figma-widget/src/widget/tsconfig.json index b69404e..49fee37 100644 --- a/packages/figma-widget/src/widget/tsconfig.json +++ b/packages/figma-widget/src/widget/tsconfig.json @@ -13,5 +13,6 @@ "sourceMap": true, "esModuleInterop": true, "skipLibCheck": true - } + }, + "include": ["./**/*.ts", "./**/*.tsx"] } diff --git a/packages/figma-widget/src/widget/vite-env.d.ts b/packages/figma-widget/src/widget/vite-env.d.ts new file mode 100644 index 0000000..ed25531 --- /dev/null +++ b/packages/figma-widget/src/widget/vite-env.d.ts @@ -0,0 +1,9 @@ +/// + +interface ImportMetaEnv { + readonly VITE_HOST_URL: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} diff --git a/turbo.json b/turbo.json index 357fbd6..21daaad 100644 --- a/turbo.json +++ b/turbo.json @@ -19,7 +19,7 @@ "SEND_EMAIL_HOOK_SECRET", "SUPABASE_ANON_KEY", "SUPABASE_URL", - "VITE_API_HOST" + "VITE_HOST_URL" ], "tasks": { "topo": {