@signap/signals-nuxtjs
v2.0.0
Published
SSR-safe Nuxt 3 wrapper for @signap/signals-web
Downloads
79
Readme
@signap/signals-nuxtjs
SSR-safe wrapper for @signap/signals-web targeting Nuxt 3.
Install
pnpm add @signap/signals-nuxtjs
# nuxt + vue are peerDependenciesUsage
Wrap your app once in app.vue with <SignalsClient>, then call
useVisitorData() in any <script setup> below it.
<!-- app.vue -->
<script setup lang="ts">
import { SignalsClient } from "@signap/signals-nuxtjs";
const agent = { apiKey: useRuntimeConfig().public.signalsApiKey };
</script>
<template>
<SignalsClient :agent="agent">
<NuxtPage />
</SignalsClient>
</template><!-- components/VisitorBadge.vue -->
<script setup lang="ts">
import { useVisitorData } from "@signap/signals-nuxtjs";
const { data, isLoading } = useVisitorData({ tag: "homepage" });
</script>
<template>
<span v-if="!isLoading">visitor: {{ data?.visitorId }}</span>
</template>v2 (ADR §A2) returns the resolved visitor in a single round-trip — no separate ack/lookup transition. The composable returns reactive refs; see the
@signap/signals-vueREADME for the full shape.
SSR-safe contract
- The barrel imports cleanly on the Nitro/Node server — module evaluation touches no browser APIs.
SignalsClientjust wraps<SignalsProvider>, which loads the agent insideonMounted— never during SSR render or hydration.- Public env vars carry only the public apiKey (
pk_live_*); never put server-only secrets inruntimeConfig.public.
Endpoint (required)
SignalsClient takes the underlying AgentLoadOptions as its agent prop.
endpoint is required — the published SDK ships no baked default host (the
region→host map is empty in this alpha), so pass an explicit endpoint (a string
or a callback). See the @signap/signals-web README (Endpoint section).
