AI-native design editor. Open-source Figma alternative.
refactor(tauri): clean up external link helper
Danila Poyarkov82c390c2d214
diff --git a/src/components/chat/ProviderSettings.vue b/src/components/chat/ProviderSettings.vueindex 24dd5fee2..0e4c1dd2a 100644--- a/src/components/chat/ProviderSettings.vue+++ b/src/components/chat/ProviderSettings.vue@@ -16,7 +16,7 @@ import ProviderSelectField from '@/components/chat/ProviderSelectField.vue'import { useInputUI } from '@/components/ui/input'import { usePopoverUI } from '@/components/ui/popover'import { useAIChat } from '@/composables/use-chat'-import { openExternalLink } from '@/composables/use-external-link'+import { openExternalLink } from '@/utils/external-link'const cls = usePopoverUI({ content: 'isolate z-[51] w-64 p-3' })@@ -298,7 +298,7 @@ function clearUnsplashKey() {v-if="providerDef.keyURL"type="button"class="cursor-pointer text-[9px] text-muted underline hover:text-surface"- @click="openExternalLink(providerDef.keyURL!)"+ @click="openExternalLink(providerDef.keyURL as string)">Get API key →</button>diff --git a/src/components/chat/ProviderSetup.vue b/src/components/chat/ProviderSetup.vueindex 937413e28..3418efb17 100644--- a/src/components/chat/ProviderSetup.vue+++ b/src/components/chat/ProviderSetup.vue@@ -5,7 +5,7 @@ import ProviderSelectField from '@/components/chat/ProviderSelectField.vue'import { useInputUI } from '@/components/ui/input'import { useAIChat } from '@/composables/use-chat'import { ACP_AGENTS } from '@open-pencil/core'-import { openExternalLink } from '@/composables/use-external-link'+import { openExternalLink } from '@/utils/external-link'import { useI18n } from '@open-pencil/vue'const { providerID, providerDef, setAPIKey, customBaseURL, customModelID } = useAIChat()@@ -110,7 +110,7 @@ function save() {type="button"data-test-id="api-key-get-link"class="mt-2.5 cursor-pointer text-[10px] text-muted underline hover:text-surface"- @click="openExternalLink(providerDef.keyURL!)"+ @click="openExternalLink(providerDef.keyURL as string)">{{ dialogs.getAPIKey({ provider: providerDef.name }) }}</button>diff --git a/src/global.d.ts b/src/global.d.tsindex 7e4b189eb..b99ea3450 100644--- a/src/global.d.ts+++ b/src/global.d.ts@@ -41,5 +41,4 @@ interface Window {// The assignment in EditorView.vue is type-safe; test code uses `!` assertion.// eslint-disable-next-line @typescript-eslint/no-explicit-any__OPEN_PENCIL_STORE__?: any- __mocked_window_open?: (url?: string | URL, target?: string) => Window | null}diff --git a/src/composables/use-external-link.ts b/src/utils/external-link.tssimilarity index 100%rename from src/composables/use-external-link.tsrename to src/utils/external-link.tsdiff --git a/tests/e2e/chat-panel.spec.ts b/tests/e2e/chat-panel.spec.tsindex d9c7ed56c..c397f1dec 100644--- a/tests/e2e/chat-panel.spec.ts+++ b/tests/e2e/chat-panel.spec.ts@@ -232,7 +232,7 @@ test('"Get API key" link opens external URL via window.open', async () => {const openedUrls: string[] = []await page.exposeFunction('mockWindowOpen', (url: string) => openedUrls.push(url))await page.evaluate(() => {- window.__mocked_window_open = window.open+ ;(window as any).__savedOpen = window.openwindow.open = (url: string | URL) => {;(window as any).mockWindowOpen(String(url))return null@@ -248,6 +248,6 @@ test('"Get API key" link opens external URL via window.open', async () => {// Restoreawait page.evaluate(() => {- window.open = window.__mocked_window_open+ window.open = (window as any).__savedOpen})})