@lucida-analytics/vue 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 +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @lucida-analytics/vue
|
|
2
|
+
|
|
3
|
+
Vue 3.3+ plugin and composables over `@lucida-analytics/browser`. The browser SDK is never touched during SSR.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install @lucida-analytics/vue @lucida-analytics/browser
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createApp } from "vue";
|
|
11
|
+
import { lucida } from "@lucida-analytics/vue";
|
|
12
|
+
|
|
13
|
+
createApp(App).use(lucida, { apiKey: "lc_pk_...", options: { apiHost: "https://<your capture host>", consent: { mode: "opt_in" } } }).mount("#app");
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```vue
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { useFlag, useCapture, useConsent } from "@lucida-analytics/vue";
|
|
19
|
+
const variant = useFlag("new-checkout"); // ComputedRef<FlagValue | undefined>
|
|
20
|
+
const capture = useCapture();
|
|
21
|
+
const { grant } = useConsent();
|
|
22
|
+
</script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- Plugin options (`LucidaPluginOptions`): `apiKey`, `options` (browser SDK config), `client` (use an existing client instead),
|
|
26
|
+
`bootstrapFlags` (server-resolved flags, rendered on the server and the first client render).
|
|
27
|
+
- Composables: `useLucida()` (the client or `null`), `useCapture()` (a no-op without a client), `useFlag(key)` (the exposure is
|
|
28
|
+
recorded after mount and when the value changes, never during setup), `useFlagPayload(key)`, `useActiveFlags()` (keys that are on),
|
|
29
|
+
`useConsent()` (`setConsent`, `optIn`, `optOut`, `grant`, `revoke`).
|
|
30
|
+
- Also exported: `LUCIDA_KEY`, types `LucidaPluginOptions`, `LucidaState`, `Flags`.
|
|
31
|
+
- A composable called without `app.use(lucida, ...)` throws.
|
|
32
|
+
- Nuxt: use `@lucida-analytics/nuxt`, which wires this plugin for you.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucida-analytics/vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"vue": ">=3.3",
|
|
27
|
-
"@lucida-analytics/browser": "0.1.
|
|
27
|
+
"@lucida-analytics/browser": "^0.1.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^22.0.0",
|
|
31
31
|
"jsdom": "^26.1.0",
|
|
32
32
|
"tsup": "^8.5.0",
|
|
33
33
|
"vue": "^3.5.0",
|
|
34
|
-
"@lucida-analytics/browser": "0.1.
|
|
34
|
+
"@lucida-analytics/browser": "0.1.4"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsup",
|