feat: add nuxt sdk (#260)

* wip

* fix: improve api route for nuxt
This commit is contained in:
Carl-Gerhard Lindesvärd
2026-01-07 10:28:11 +01:00
committed by GitHub
parent 3bd1f99d28
commit 1f088d2208
13 changed files with 4990 additions and 215 deletions

View File

@@ -0,0 +1,30 @@
import { OpenPanel } from '@openpanel/web';
import { defineNuxtPlugin, useRuntimeConfig } from '#app';
import type { ModuleOptions } from '../types';
declare module '#app' {
interface NuxtApp {
$openpanel: OpenPanel;
}
}
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$openpanel: OpenPanel;
}
}
export default defineNuxtPlugin({
name: 'openpanel',
parallel: true,
setup() {
const config = useRuntimeConfig().public.openpanel as ModuleOptions;
const op = new OpenPanel(config);
return {
provide: {
openpanel: op,
},
};
},
});