@lucida-analytics/nuxt 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @lucida-analytics/nuxt
|
|
2
|
+
|
|
3
|
+
Nuxt 3.8+ module. It installs the Vue plugin from `@lucida-analytics/vue` in a runtime plugin, keeps the options in
|
|
4
|
+
`runtimeConfig.public.lucida` and auto-imports the composables. The browser SDK is only constructed where `window` exists, so SSR
|
|
5
|
+
never touches it.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @lucida-analytics/nuxt @lucida-analytics/vue @lucida-analytics/browser
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// nuxt.config.ts
|
|
13
|
+
import { lucidaModule } from "@lucida-analytics/nuxt";
|
|
14
|
+
export default defineNuxtConfig({
|
|
15
|
+
modules: [[lucidaModule, { apiKey: "lc_pk_...", options: { apiHost: "https://<your capture host>" } }]],
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```vue
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
const checkout = useFlag("new-checkout"); // ComputedRef; the exposure is recorded after mount
|
|
22
|
+
const capture = useCapture();
|
|
23
|
+
</script>
|
|
24
|
+
<template><button @click="capture('cta_clicked')">{{ checkout ? "New" : "Old" }}</button></template>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Module options: `apiKey` (public key), `options` (browser SDK config, including `consent`), `bootstrapFlags` (server-resolved
|
|
28
|
+
flags for a flicker-free first render). `NUXT_PUBLIC_LUCIDA_API_KEY` overrides the key per environment.
|
|
29
|
+
- Auto-imported: `useLucida`, `useCapture`, `useFlag`, `useFlagPayload`, `useActiveFlags`, `useConsent` (also exported, with
|
|
30
|
+
`COMPOSABLES`, `lucidaPlugin` and the `LucidaModuleOptions` / `NuxtLike` / `NuxtAppLike` types).
|
|
31
|
+
- With no `apiKey` the plugin installs an inert client, so the composables never throw.
|
|
32
|
+
- Consent is the SDK's: in `opt_in` mode nothing is stored or sent until `useConsent().grant()`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucida-analytics/nuxt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@lucida-analytics/vue": "0.1.
|
|
30
|
+
"@lucida-analytics/vue": "0.1.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"nuxt": ">=3.8",
|
|
34
34
|
"vue": ">=3.3",
|
|
35
|
-
"@lucida-analytics/browser": "0.1.
|
|
35
|
+
"@lucida-analytics/browser": "^0.1.4"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"nuxt": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"jsdom": "^26.1.0",
|
|
45
45
|
"tsup": "^8.5.0",
|
|
46
46
|
"vue": "^3.5.0",
|
|
47
|
-
"@lucida-analytics/browser": "0.1.
|
|
47
|
+
"@lucida-analytics/browser": "0.1.4"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsup",
|