Consent API (#1)

# Changelog
- fix typo in supressDnt to suppressDnt setting,
- expose recordConsent and revokeConsent API calls,
- expose Wide Angle API as `useWideAngle()` and remove obsolete `useWaaEvent`

Reviewed-on: https://cloud.inputobjects.eu/forge/forge/wideangle/wideangle-nuxt/pulls/1
Co-authored-by: Jarek Rozanski <jrozanski@inputobjects.eu>
Co-committed-by: Jarek Rozanski <jrozanski@inputobjects.eu>
This commit is contained in:
Jarek Rozanski 2025-01-29 20:28:22 +00:00 committed by Jarek Rozanski
parent 787a1fd57f
commit f621c33de9
13 changed files with 191 additions and 116 deletions

View file

@ -1,36 +0,0 @@
<template>
<main>
<h1>Nuxt Application</h1>
<button @click="trackClick">
Track Click
</button>
</main>
</template>
<script setup lang="ts">
import { useWaaEvent } from "#imports";
function trackClick() {
useWaaEvent("foo", {"name": "bar"}, {"count" : 2});
}
</script>
<style>
main {
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 2rem;
display: flex;
flex-direction: column;
max-width: 300px;
gap: 2rem;
align-items: center;
margin: 0 auto;
text-align: center;
}
button {
padding: 1rem;
}
</style>

View file

@ -0,0 +1,11 @@
<template>
<button @click="sendEvent">Send Event</button>
</template>
<script setup>
import { useWideAngle } from '#imports';
const sendEvent = () => {
useWideAngle().dispatchEvent('foo', {'param1': 'bar'}, {'value1': 123});
}
</script>

View file

@ -1,12 +1,17 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: ['../src/module'],
devtools: { enabled: true },
compatibilityDate: "2025-01-28",
modules: ['wideangle-nuxt'],
// ssr: false,
runtimeConfig: {
public: {
wideangle: {
siteId: "7982G3B9ACB1BF4380",
fingerprint: true,
supressDnt: true
siteId: "8D27G3B9ACA01F4241",
domain: "events.wideangle.test",
fingerprint: false,
suppressDnt: true
}
}
}
});
})

View file

@ -1,4 +0,0 @@
{
"private": true,
"name": "wideangle-playground"
}

View file

@ -0,0 +1,7 @@
<template>
<div>
<h1>Wide Angle Analytics Playground</h1>
<sample-tracker/>
</div>
</template>