@nuxt/scripts 1.0.0-beta.24 → 1.0.0-beta.26
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/dist/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/{Bh9fd9qr.js → C-7nRtzO.js} +1 -1
- package/dist/client/_nuxt/{UTi7FhVv.js → D5k4eN9O.js} +1 -1
- package/dist/client/_nuxt/DjhmCJlE.js +162 -0
- package/dist/client/_nuxt/{B7aPLMNo.js → TJ5JFHov.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/33e1ac0e-aba1-4856-8beb-775c426be236.json +1 -0
- package/dist/client/_nuxt/entry.C5SUNdim.css +1 -0
- package/dist/client/_nuxt/error-404.C_3_IG5y.css +1 -0
- package/dist/client/_nuxt/error-500.DSv6YikH.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/module.d.mts +6 -20
- package/dist/module.d.ts +6 -20
- package/dist/module.json +1 -1
- package/dist/module.mjs +303 -277
- package/dist/registry.mjs +121 -71
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +2 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +14 -15
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +2 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +30 -37
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +18 -22
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +30 -37
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +31 -36
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +1 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +17 -22
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue +19 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue +19 -28
- package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +11 -0
- package/dist/runtime/components/GoogleMaps/injectionKeys.js +3 -0
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +26 -0
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +37 -0
- package/dist/runtime/composables/useScriptTriggerConsent.d.ts +10 -0
- package/dist/runtime/composables/useScriptTriggerConsent.js +32 -19
- package/dist/runtime/registry/bing-uet.d.ts +20 -0
- package/dist/runtime/registry/bing-uet.js +29 -0
- package/dist/runtime/registry/bluesky-embed.d.ts +1 -1
- package/dist/runtime/registry/crisp.d.ts +1 -1
- package/dist/runtime/registry/fathom-analytics.d.ts +1 -1
- package/dist/runtime/registry/google-adsense.d.ts +1 -1
- package/dist/runtime/registry/hotjar.d.ts +1 -1
- package/dist/runtime/registry/instagram-embed.d.ts +1 -1
- package/dist/runtime/registry/intercom.d.ts +1 -1
- package/dist/runtime/registry/matomo-analytics.d.ts +1 -1
- package/dist/runtime/registry/meta-pixel.d.ts +1 -1
- package/dist/runtime/registry/mixpanel-analytics.d.ts +22 -0
- package/dist/runtime/registry/mixpanel-analytics.js +46 -0
- package/dist/runtime/registry/npm.d.ts +1 -1
- package/dist/runtime/registry/reddit-pixel.d.ts +1 -1
- package/dist/runtime/registry/schemas.d.ts +19 -0
- package/dist/runtime/registry/schemas.js +19 -0
- package/dist/runtime/registry/snapchat-pixel.d.ts +1 -1
- package/dist/runtime/registry/tiktok-pixel.d.ts +1 -1
- package/dist/runtime/registry/vercel-analytics.d.ts +1 -1
- package/dist/runtime/registry/x-embed.d.ts +1 -1
- package/dist/runtime/registry/x-pixel.d.ts +1 -1
- package/dist/runtime/server/proxy-handler.js +36 -23
- package/dist/runtime/server/utils/privacy.d.ts +1 -1
- package/dist/runtime/server/utils/privacy.js +3 -3
- package/dist/runtime/types.d.ts +30 -18
- package/dist/runtime/utils/pure.d.ts +1 -1
- package/dist/runtime/utils.js +1 -1
- package/dist/shared/scripts.ViOoYQXH.mjs +381 -0
- package/dist/stats.d.mts +95 -3
- package/dist/stats.d.ts +95 -3
- package/dist/stats.mjs +2845 -169
- package/dist/types-source.mjs +47 -0
- package/package.json +13 -13
- package/dist/client/_nuxt/BNNMZFwZ.js +0 -162
- package/dist/client/_nuxt/builds/meta/78647cef-f45a-4560-82b4-b9364815198a.json +0 -1
- package/dist/client/_nuxt/entry.CACgbLJl.css +0 -1
- package/dist/client/_nuxt/error-404.DMdWw4vT.css +0 -1
- package/dist/client/_nuxt/error-500.CROTF27X.css +0 -1
- package/dist/shared/scripts.Crpn87WB.mjs +0 -318
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
|
|
2
|
+
import { watch } from "vue";
|
|
3
|
+
import { useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
5
4
|
const props = defineProps({
|
|
6
5
|
options: { type: Object, required: false }
|
|
7
6
|
});
|
|
@@ -21,36 +20,28 @@ const eventsWithMapMouseEventPayload = [
|
|
|
21
20
|
"dragend",
|
|
22
21
|
"dragstart"
|
|
23
22
|
];
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
polygon?.setOptions(options);
|
|
34
|
-
}, {
|
|
35
|
-
deep: true
|
|
36
|
-
});
|
|
37
|
-
}, {
|
|
38
|
-
immediate: true,
|
|
39
|
-
once: true
|
|
40
|
-
});
|
|
41
|
-
onUnmounted(() => {
|
|
42
|
-
if (!polygon || !mapContext?.mapsApi.value) {
|
|
43
|
-
return;
|
|
23
|
+
const polygon = useGoogleMapsResource({
|
|
24
|
+
create({ mapsApi, map }) {
|
|
25
|
+
const p = new mapsApi.Polygon({ map, ...props.options });
|
|
26
|
+
setupEventListeners(p);
|
|
27
|
+
return p;
|
|
28
|
+
},
|
|
29
|
+
cleanup(p, { mapsApi }) {
|
|
30
|
+
mapsApi.event.clearInstanceListeners(p);
|
|
31
|
+
p.setMap(null);
|
|
44
32
|
}
|
|
45
|
-
mapContext.mapsApi.value.event.clearInstanceListeners(polygon);
|
|
46
|
-
polygon.setMap(null);
|
|
47
33
|
});
|
|
48
|
-
|
|
34
|
+
watch(() => props.options, (options) => {
|
|
35
|
+
if (polygon.value && options) {
|
|
36
|
+
polygon.value.setOptions(options);
|
|
37
|
+
}
|
|
38
|
+
}, { deep: true });
|
|
39
|
+
function setupEventListeners(p) {
|
|
49
40
|
eventsWithPolyMouseEventPayload.forEach((event) => {
|
|
50
|
-
|
|
41
|
+
p.addListener(event, (payload) => emit(event, payload));
|
|
51
42
|
});
|
|
52
43
|
eventsWithMapMouseEventPayload.forEach((event) => {
|
|
53
|
-
|
|
44
|
+
p.addListener(event, (payload) => emit(event, payload));
|
|
54
45
|
});
|
|
55
46
|
}
|
|
56
47
|
</script>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
|
|
2
|
+
import { watch } from "vue";
|
|
3
|
+
import { useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
5
4
|
const props = defineProps({
|
|
6
5
|
options: { type: Object, required: false }
|
|
7
6
|
});
|
|
@@ -21,36 +20,28 @@ const eventsWithMapMouseEventPayload = [
|
|
|
21
20
|
"dragend",
|
|
22
21
|
"dragstart"
|
|
23
22
|
];
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
polyline?.setOptions(options);
|
|
34
|
-
}, {
|
|
35
|
-
deep: true
|
|
36
|
-
});
|
|
37
|
-
}, {
|
|
38
|
-
immediate: true,
|
|
39
|
-
once: true
|
|
40
|
-
});
|
|
41
|
-
onUnmounted(() => {
|
|
42
|
-
if (!polyline || !mapContext?.mapsApi.value) {
|
|
43
|
-
return;
|
|
23
|
+
const polyline = useGoogleMapsResource({
|
|
24
|
+
create({ mapsApi, map }) {
|
|
25
|
+
const p = new mapsApi.Polyline({ map, ...props.options });
|
|
26
|
+
setupEventListeners(p);
|
|
27
|
+
return p;
|
|
28
|
+
},
|
|
29
|
+
cleanup(p, { mapsApi }) {
|
|
30
|
+
mapsApi.event.clearInstanceListeners(p);
|
|
31
|
+
p.setMap(null);
|
|
44
32
|
}
|
|
45
|
-
mapContext.mapsApi.value.event.clearInstanceListeners(polyline);
|
|
46
|
-
polyline.setMap(null);
|
|
47
33
|
});
|
|
48
|
-
|
|
34
|
+
watch(() => props.options, (options) => {
|
|
35
|
+
if (polyline.value && options) {
|
|
36
|
+
polyline.value.setOptions(options);
|
|
37
|
+
}
|
|
38
|
+
}, { deep: true });
|
|
39
|
+
function setupEventListeners(p) {
|
|
49
40
|
eventsWithPolyMouseEventPayload.forEach((event) => {
|
|
50
|
-
|
|
41
|
+
p.addListener(event, (payload) => emit(event, payload));
|
|
51
42
|
});
|
|
52
43
|
eventsWithMapMouseEventPayload.forEach((event) => {
|
|
53
|
-
|
|
44
|
+
p.addListener(event, (payload) => emit(event, payload));
|
|
54
45
|
});
|
|
55
46
|
}
|
|
56
47
|
</script>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
|
|
2
|
+
import { watch } from "vue";
|
|
3
|
+
import { useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
5
4
|
const props = defineProps({
|
|
6
5
|
options: { type: Object, required: false }
|
|
7
6
|
});
|
|
@@ -22,36 +21,28 @@ const eventsWithMapMouseEventPayload = [
|
|
|
22
21
|
"mouseover",
|
|
23
22
|
"mouseup"
|
|
24
23
|
];
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
rectangle?.setOptions(options);
|
|
35
|
-
}, {
|
|
36
|
-
deep: true
|
|
37
|
-
});
|
|
38
|
-
}, {
|
|
39
|
-
immediate: true,
|
|
40
|
-
once: true
|
|
41
|
-
});
|
|
42
|
-
onUnmounted(() => {
|
|
43
|
-
if (!rectangle || !mapContext?.mapsApi.value) {
|
|
44
|
-
return;
|
|
24
|
+
const rectangle = useGoogleMapsResource({
|
|
25
|
+
create({ mapsApi, map }) {
|
|
26
|
+
const r = new mapsApi.Rectangle({ map, ...props.options });
|
|
27
|
+
setupEventListeners(r);
|
|
28
|
+
return r;
|
|
29
|
+
},
|
|
30
|
+
cleanup(r, { mapsApi }) {
|
|
31
|
+
mapsApi.event.clearInstanceListeners(r);
|
|
32
|
+
r.setMap(null);
|
|
45
33
|
}
|
|
46
|
-
mapContext.mapsApi.value.event.clearInstanceListeners(rectangle);
|
|
47
|
-
rectangle.setMap(null);
|
|
48
34
|
});
|
|
49
|
-
|
|
35
|
+
watch(() => props.options, (options) => {
|
|
36
|
+
if (rectangle.value && options) {
|
|
37
|
+
rectangle.value.setOptions(options);
|
|
38
|
+
}
|
|
39
|
+
}, { deep: true });
|
|
40
|
+
function setupEventListeners(r) {
|
|
50
41
|
eventsWithoutPayload.forEach((event) => {
|
|
51
|
-
|
|
42
|
+
r.addListener(event, () => emit(event));
|
|
52
43
|
});
|
|
53
44
|
eventsWithMapMouseEventPayload.forEach((event) => {
|
|
54
|
-
|
|
45
|
+
r.addListener(event, (payload) => emit(event, payload));
|
|
55
46
|
});
|
|
56
47
|
}
|
|
57
48
|
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InjectionKey, Ref, ShallowRef } from 'vue';
|
|
2
|
+
export declare const MAP_INJECTION_KEY: InjectionKey<{
|
|
3
|
+
map: ShallowRef<google.maps.Map | undefined>;
|
|
4
|
+
mapsApi: Ref<typeof google.maps | undefined>;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const ADVANCED_MARKER_ELEMENT_INJECTION_KEY: InjectionKey<{
|
|
7
|
+
advancedMarkerElement: ShallowRef<google.maps.marker.AdvancedMarkerElement | undefined>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const MARKER_INJECTION_KEY: InjectionKey<{
|
|
10
|
+
marker: ShallowRef<google.maps.Marker | undefined>;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ShallowRef } from 'vue';
|
|
2
|
+
export interface GoogleMapsResourceContext {
|
|
3
|
+
map: google.maps.Map;
|
|
4
|
+
mapsApi: typeof google.maps;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Composable for safely managing Google Maps resource lifecycle.
|
|
8
|
+
*
|
|
9
|
+
* Handles the common pattern: wait for map readiness → async create → cleanup on unmount.
|
|
10
|
+
*
|
|
11
|
+
* Safety guarantees:
|
|
12
|
+
* - No watchers created after `await` (prevents orphaned watchers that leak memory)
|
|
13
|
+
* - Unmount guard prevents resource creation after component unmount
|
|
14
|
+
* - Resources created during the async gap are immediately cleaned up
|
|
15
|
+
* - Resource ref is always nulled on unmount to allow GC
|
|
16
|
+
*/
|
|
17
|
+
export declare function useGoogleMapsResource<T>({ ready, create, cleanup, }: {
|
|
18
|
+
/** Additional readiness condition beyond map + mapsApi being available */
|
|
19
|
+
ready?: () => boolean;
|
|
20
|
+
/** Create the Google Maps resource. Receives map context snapshot. May be async. */
|
|
21
|
+
create: (ctx: GoogleMapsResourceContext) => Promise<T> | T;
|
|
22
|
+
/** Clean up the resource. Called on unmount, or immediately if resource was created after unmount. */
|
|
23
|
+
cleanup?: (resource: T, ctx: {
|
|
24
|
+
mapsApi: typeof google.maps;
|
|
25
|
+
}) => void;
|
|
26
|
+
}): ShallowRef<T | undefined>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { whenever } from "@vueuse/core";
|
|
2
|
+
import { inject, onUnmounted, ref, shallowRef } from "vue";
|
|
3
|
+
import { MAP_INJECTION_KEY } from "./injectionKeys.js";
|
|
4
|
+
export function useGoogleMapsResource({
|
|
5
|
+
ready,
|
|
6
|
+
create,
|
|
7
|
+
cleanup
|
|
8
|
+
}) {
|
|
9
|
+
const mapContext = inject(MAP_INJECTION_KEY, void 0);
|
|
10
|
+
const resource = shallowRef(void 0);
|
|
11
|
+
const isUnmounted = ref(false);
|
|
12
|
+
whenever(
|
|
13
|
+
() => mapContext?.map.value && mapContext.mapsApi.value && (!ready || ready()),
|
|
14
|
+
async () => {
|
|
15
|
+
const result = await create({
|
|
16
|
+
map: mapContext.map.value,
|
|
17
|
+
mapsApi: mapContext.mapsApi.value
|
|
18
|
+
});
|
|
19
|
+
if (isUnmounted.value) {
|
|
20
|
+
if (cleanup && mapContext?.mapsApi.value) {
|
|
21
|
+
cleanup(result, { mapsApi: mapContext.mapsApi.value });
|
|
22
|
+
}
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
resource.value = result;
|
|
26
|
+
},
|
|
27
|
+
{ immediate: true, once: true }
|
|
28
|
+
);
|
|
29
|
+
onUnmounted(() => {
|
|
30
|
+
isUnmounted.value = true;
|
|
31
|
+
if (resource.value && cleanup && mapContext?.mapsApi.value) {
|
|
32
|
+
cleanup(resource.value, { mapsApi: mapContext.mapsApi.value });
|
|
33
|
+
}
|
|
34
|
+
resource.value = void 0;
|
|
35
|
+
});
|
|
36
|
+
return resource;
|
|
37
|
+
}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
1
2
|
import type { ConsentScriptTriggerOptions } from '../types.js';
|
|
2
3
|
interface UseConsentScriptTriggerApi extends Promise<void> {
|
|
3
4
|
/**
|
|
4
5
|
* A function that can be called to accept the consent and load the script.
|
|
5
6
|
*/
|
|
6
7
|
accept: () => void;
|
|
8
|
+
/**
|
|
9
|
+
* A function that can be called to revoke consent and signal the script should be unloaded.
|
|
10
|
+
*/
|
|
11
|
+
revoke: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Reactive reference to the consent state
|
|
14
|
+
*/
|
|
15
|
+
consented: Ref<boolean>;
|
|
7
16
|
}
|
|
8
17
|
/**
|
|
9
18
|
* Load a script once consent has been provided either through a resolvable `consent` or calling the `accept` method.
|
|
19
|
+
* Supports revoking consent via the reactive `consented` ref. Consumers should watch `consented` to react to revocation.
|
|
10
20
|
* @param options
|
|
11
21
|
*/
|
|
12
22
|
export declare function useScriptTriggerConsent(options?: ConsentScriptTriggerOptions): UseConsentScriptTriggerApi;
|
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
import { onNuxtReady, requestIdleCallback, tryUseNuxtApp } from "nuxt/app";
|
|
2
2
|
import { isRef, ref, toValue, watch } from "vue";
|
|
3
3
|
export function useScriptTriggerConsent(options) {
|
|
4
|
-
if (import.meta.server)
|
|
5
|
-
|
|
4
|
+
if (import.meta.server) {
|
|
5
|
+
const p = new Promise(() => {
|
|
6
6
|
});
|
|
7
|
+
p.accept = () => {
|
|
8
|
+
};
|
|
9
|
+
p.revoke = () => {
|
|
10
|
+
};
|
|
11
|
+
p.consented = ref(false);
|
|
12
|
+
return p;
|
|
13
|
+
}
|
|
7
14
|
const consented = ref(false);
|
|
8
15
|
const nuxtApp = tryUseNuxtApp();
|
|
16
|
+
if (options?.consent) {
|
|
17
|
+
if (isRef(options?.consent)) {
|
|
18
|
+
watch(options.consent, (_val) => {
|
|
19
|
+
const val = toValue(_val);
|
|
20
|
+
consented.value = Boolean(val);
|
|
21
|
+
}, { immediate: true });
|
|
22
|
+
} else if (typeof options?.consent === "boolean") {
|
|
23
|
+
consented.value = options?.consent;
|
|
24
|
+
} else if (options?.consent instanceof Promise) {
|
|
25
|
+
options.consent.then((res) => {
|
|
26
|
+
consented.value = typeof res === "boolean" ? res : true;
|
|
27
|
+
}).catch(() => {
|
|
28
|
+
consented.value = false;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
9
32
|
const promise = new Promise((resolve) => {
|
|
10
|
-
watch(consented, (
|
|
11
|
-
if (
|
|
33
|
+
watch(consented, (newValue, oldValue) => {
|
|
34
|
+
if (newValue && !oldValue) {
|
|
12
35
|
const runner = nuxtApp?.runWithContext || ((cb) => cb());
|
|
13
36
|
if (options?.postConsentTrigger instanceof Promise) {
|
|
14
37
|
options.postConsentTrigger.then(() => runner(resolve));
|
|
@@ -32,24 +55,14 @@ export function useScriptTriggerConsent(options) {
|
|
|
32
55
|
}
|
|
33
56
|
runner(resolve);
|
|
34
57
|
}
|
|
35
|
-
});
|
|
36
|
-
if (options?.consent) {
|
|
37
|
-
if (isRef(options?.consent)) {
|
|
38
|
-
watch(options.consent, (_val) => {
|
|
39
|
-
const val = toValue(_val);
|
|
40
|
-
consented.value = Boolean(val);
|
|
41
|
-
}, { immediate: true });
|
|
42
|
-
} else if (typeof options?.consent === "boolean") {
|
|
43
|
-
consented.value = options?.consent;
|
|
44
|
-
} else if (options?.consent instanceof Promise) {
|
|
45
|
-
options?.consent.then((res) => {
|
|
46
|
-
consented.value = typeof res === "boolean" ? res : true;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
58
|
+
}, { immediate: true });
|
|
50
59
|
});
|
|
51
60
|
promise.accept = () => {
|
|
52
61
|
consented.value = true;
|
|
53
62
|
};
|
|
63
|
+
promise.revoke = () => {
|
|
64
|
+
consented.value = false;
|
|
65
|
+
};
|
|
66
|
+
promise.consented = consented;
|
|
54
67
|
return promise;
|
|
55
68
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
|
+
import { BingUetOptions } from './schemas.js';
|
|
3
|
+
export { BingUetOptions };
|
|
4
|
+
export type BingUetInput = RegistryScriptInput<typeof BingUetOptions, true, false>;
|
|
5
|
+
export interface BingUetApi {
|
|
6
|
+
uetq: {
|
|
7
|
+
push: (event: string | Record<string, any>) => void;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
UET: new (options: {
|
|
13
|
+
ti: string;
|
|
14
|
+
enableAutoSpaTracking?: boolean;
|
|
15
|
+
q?: any[];
|
|
16
|
+
}) => BingUetApi['uetq'];
|
|
17
|
+
uetq: any[] | BingUetApi['uetq'];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare function useScriptBingUet<T extends BingUetApi>(_options?: BingUetInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useRegistryScript } from "../utils.js";
|
|
2
|
+
import { BingUetOptions } from "./schemas.js";
|
|
3
|
+
export { BingUetOptions };
|
|
4
|
+
export function useScriptBingUet(_options) {
|
|
5
|
+
return useRegistryScript("bingUet", (options) => ({
|
|
6
|
+
scriptInput: {
|
|
7
|
+
src: "https://bat.bing.com/bat.js",
|
|
8
|
+
crossorigin: false
|
|
9
|
+
},
|
|
10
|
+
schema: import.meta.dev ? BingUetOptions : void 0,
|
|
11
|
+
scriptOptions: {
|
|
12
|
+
use() {
|
|
13
|
+
if (options?.id && typeof window.UET === "function" && Array.isArray(window.uetq)) {
|
|
14
|
+
const uetOptions = {
|
|
15
|
+
ti: options.id,
|
|
16
|
+
enableAutoSpaTracking: options.enableAutoSpaTracking ?? true,
|
|
17
|
+
q: window.uetq
|
|
18
|
+
};
|
|
19
|
+
window.uetq = new window.UET(uetOptions);
|
|
20
|
+
window.uetq.push("pageLoad");
|
|
21
|
+
}
|
|
22
|
+
return { uetq: window.uetq };
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
26
|
+
window.uetq = window.uetq || [];
|
|
27
|
+
}
|
|
28
|
+
}), _options);
|
|
29
|
+
}
|
|
@@ -90,7 +90,7 @@ export interface BlueskyEmbedPostData {
|
|
|
90
90
|
val: string;
|
|
91
91
|
}>;
|
|
92
92
|
}
|
|
93
|
-
export type BlueskyEmbedInput = RegistryScriptInput<typeof BlueskyEmbedOptions, false, false
|
|
93
|
+
export type BlueskyEmbedInput = RegistryScriptInput<typeof BlueskyEmbedOptions, false, false>;
|
|
94
94
|
/**
|
|
95
95
|
* Extract the handle/DID and post rkey from a Bluesky post URL
|
|
96
96
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
2
|
import { CrispOptions } from './schemas.js';
|
|
3
3
|
export { CrispOptions };
|
|
4
|
-
export type CrispInput = RegistryScriptInput<typeof CrispOptions, false, false
|
|
4
|
+
export type CrispInput = RegistryScriptInput<typeof CrispOptions, false, false>;
|
|
5
5
|
export interface CrispApi {
|
|
6
6
|
push: (...args: any[]) => void;
|
|
7
7
|
is: (name: 'chat:opened' | 'chat:closed' | 'chat:visible' | 'chat:hidden' | 'chat:small' | 'chat:large' | 'session:ongoing' | 'website:available' | 'overlay:opened' | 'overlay:closed' | (string & {})) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
2
|
import { FathomAnalyticsOptions } from './schemas.js';
|
|
3
3
|
export { FathomAnalyticsOptions };
|
|
4
|
-
export type FathomAnalyticsInput = RegistryScriptInput<typeof FathomAnalyticsOptions, false, false
|
|
4
|
+
export type FathomAnalyticsInput = RegistryScriptInput<typeof FathomAnalyticsOptions, false, false>;
|
|
5
5
|
export interface FathomAnalyticsApi {
|
|
6
6
|
beacon: (ctx: {
|
|
7
7
|
url: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
2
|
import { GoogleAdsenseOptions } from './schemas.js';
|
|
3
3
|
export { GoogleAdsenseOptions };
|
|
4
|
-
export type GoogleAdsenseInput = RegistryScriptInput<typeof GoogleAdsenseOptions, true, false
|
|
4
|
+
export type GoogleAdsenseInput = RegistryScriptInput<typeof GoogleAdsenseOptions, true, false>;
|
|
5
5
|
export interface GoogleAdsenseApi {
|
|
6
6
|
/**
|
|
7
7
|
* The Google Adsense API.
|
|
@@ -14,5 +14,5 @@ declare global {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
export type HotjarInput = RegistryScriptInput<typeof HotjarOptions, true, false
|
|
17
|
+
export type HotjarInput = RegistryScriptInput<typeof HotjarOptions, true, false>;
|
|
18
18
|
export declare function useScriptHotjar<T extends HotjarApi>(_options?: HotjarInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
2
|
import { InstagramEmbedOptions } from './schemas.js';
|
|
3
3
|
export { InstagramEmbedOptions };
|
|
4
|
-
export type InstagramEmbedInput = RegistryScriptInput<typeof InstagramEmbedOptions, false, false
|
|
4
|
+
export type InstagramEmbedInput = RegistryScriptInput<typeof InstagramEmbedOptions, false, false>;
|
|
5
5
|
/**
|
|
6
6
|
* Extract the post shortcode from an Instagram URL
|
|
7
7
|
*/
|
|
@@ -2,7 +2,7 @@ import type { InferInput } from '#nuxt-scripts-validator';
|
|
|
2
2
|
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
3
3
|
import { IntercomOptions } from './schemas.js';
|
|
4
4
|
export { IntercomOptions };
|
|
5
|
-
export type IntercomInput = RegistryScriptInput<typeof IntercomOptions, true, false
|
|
5
|
+
export type IntercomInput = RegistryScriptInput<typeof IntercomOptions, true, false>;
|
|
6
6
|
export interface IntercomApi {
|
|
7
7
|
Intercom: ((event: 'boot', data?: InferInput<typeof IntercomOptions>) => void) & ((event: 'shutdown') => void) & ((event: 'update', options?: InferInput<typeof IntercomOptions>) => void) & ((event: 'hide') => void) & ((event: 'show') => void) & ((event: 'showSpace', spaceName: 'home' | 'messages' | 'help' | 'news' | 'tasks' | 'tickets' | (string & {})) => void) & ((event: 'showMessages') => void) & ((event: 'showNewMessage', content?: string) => void) & ((event: 'onHide', fn: () => void) => void) & ((event: 'onShow', fn: () => void) => void) & ((event: 'onUnreadCountChange', fn: () => void) => void) & ((event: 'trackEvent', eventName: string, metadata?: Record<string, any>) => void) & ((event: 'getVisitorId') => Promise<string>) & ((event: 'startTour', tourId: string | number) => void) & ((event: 'showArticle', articleId: string | number) => void) & ((event: 'showNews', newsItemId: string | number) => void) & ((event: 'startSurvey', surveyId: string | number) => void) & ((event: 'startChecklist', checklistId: string | number) => void) & ((event: 'showTicket', ticketId: string | number) => void) & ((event: 'showConversation', conversationId: string | number) => void) & ((event: 'onUserEmailSupplied', fn: () => void) => void) & ((event: (string & {}), ...params: any[]) => void);
|
|
8
8
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
2
|
import { MatomoAnalyticsOptions } from './schemas.js';
|
|
3
3
|
export { MatomoAnalyticsOptions };
|
|
4
|
-
export type MatomoAnalyticsInput = RegistryScriptInput<typeof MatomoAnalyticsOptions, false, false
|
|
4
|
+
export type MatomoAnalyticsInput = RegistryScriptInput<typeof MatomoAnalyticsOptions, false, false>;
|
|
5
5
|
interface MatomoAnalyticsApi {
|
|
6
6
|
_paq: unknown[];
|
|
7
7
|
}
|
|
@@ -37,5 +37,5 @@ declare global {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
export { MetaPixelOptions };
|
|
40
|
-
export type MetaPixelInput = RegistryScriptInput<typeof MetaPixelOptions, true, false
|
|
40
|
+
export type MetaPixelInput = RegistryScriptInput<typeof MetaPixelOptions, true, false>;
|
|
41
41
|
export declare function useScriptMetaPixel<T extends MetaPixelApi>(_options?: MetaPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
|
+
import { MixpanelAnalyticsOptions } from './schemas.js';
|
|
3
|
+
export { MixpanelAnalyticsOptions };
|
|
4
|
+
export type MixpanelAnalyticsInput = RegistryScriptInput<typeof MixpanelAnalyticsOptions>;
|
|
5
|
+
export interface MixpanelAnalyticsApi {
|
|
6
|
+
mixpanel: {
|
|
7
|
+
track: (event: string, properties?: Record<string, any>) => void;
|
|
8
|
+
identify: (distinctId: string) => void;
|
|
9
|
+
reset: () => void;
|
|
10
|
+
people: {
|
|
11
|
+
set: (properties: Record<string, any>) => void;
|
|
12
|
+
};
|
|
13
|
+
register: (properties: Record<string, any>) => void;
|
|
14
|
+
init: (token: string, config?: Record<string, any>) => void;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface Window {
|
|
19
|
+
mixpanel: MixpanelAnalyticsApi['mixpanel'];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export declare function useScriptMixpanelAnalytics<T extends MixpanelAnalyticsApi>(_options?: MixpanelAnalyticsInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useRegistryScript } from "../utils.js";
|
|
2
|
+
import { MixpanelAnalyticsOptions } from "./schemas.js";
|
|
3
|
+
export { MixpanelAnalyticsOptions };
|
|
4
|
+
const methods = ["track", "identify", "reset", "register"];
|
|
5
|
+
const peopleMethods = ["set"];
|
|
6
|
+
export function useScriptMixpanelAnalytics(_options) {
|
|
7
|
+
return useRegistryScript("mixpanelAnalytics", (options) => {
|
|
8
|
+
return {
|
|
9
|
+
scriptInput: {
|
|
10
|
+
src: "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js"
|
|
11
|
+
},
|
|
12
|
+
schema: import.meta.dev ? MixpanelAnalyticsOptions : void 0,
|
|
13
|
+
scriptOptions: {
|
|
14
|
+
use() {
|
|
15
|
+
return {
|
|
16
|
+
mixpanel: window.mixpanel
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
21
|
+
const mp = window.mixpanel = window.mixpanel || [];
|
|
22
|
+
if (!mp.__SV) {
|
|
23
|
+
mp.__SV = 1.2;
|
|
24
|
+
mp._i = mp._i || [];
|
|
25
|
+
mp.init = (token, config, name = "mixpanel") => {
|
|
26
|
+
const target = name === "mixpanel" ? mp : mp[name] = [];
|
|
27
|
+
target.people = target.people || [];
|
|
28
|
+
for (const method of methods) {
|
|
29
|
+
target[method] = (...args) => {
|
|
30
|
+
target.push([method, ...args]);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
for (const method of peopleMethods) {
|
|
34
|
+
target.people[method] = (...args) => {
|
|
35
|
+
target.push([`people.${method}`, ...args]);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
mp._i.push([token, config, name]);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (options?.token)
|
|
42
|
+
mp.init(options.token);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}, _options);
|
|
46
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
2
|
import { NpmOptions } from './schemas.js';
|
|
3
3
|
export { NpmOptions };
|
|
4
|
-
export type NpmInput = RegistryScriptInput<typeof NpmOptions, true, true
|
|
4
|
+
export type NpmInput = RegistryScriptInput<typeof NpmOptions, true, true>;
|
|
5
5
|
export declare function useScriptNpm<T extends Record<string | symbol, any>>(_options: NpmInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -13,5 +13,5 @@ declare global {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
export { RedditPixelOptions };
|
|
16
|
-
export type RedditPixelInput = RegistryScriptInput<typeof RedditPixelOptions, true, false
|
|
16
|
+
export type RedditPixelInput = RegistryScriptInput<typeof RedditPixelOptions, true, false>;
|
|
17
17
|
export declare function useScriptRedditPixel<T extends RedditPixelApi>(_options?: RedditPixelInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -697,6 +697,25 @@ export declare const RybbitAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
|
697
697
|
*/
|
|
698
698
|
readonly analyticsHost: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
699
699
|
}, undefined>;
|
|
700
|
+
export declare const MixpanelAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
701
|
+
/**
|
|
702
|
+
* Your Mixpanel project token.
|
|
703
|
+
* @see https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#1-initialize-the-library
|
|
704
|
+
*/
|
|
705
|
+
readonly token: import("valibot").StringSchema<undefined>;
|
|
706
|
+
}, undefined>;
|
|
707
|
+
export declare const BingUetOptions: import("valibot").ObjectSchema<{
|
|
708
|
+
/**
|
|
709
|
+
* Your Bing UET tag ID.
|
|
710
|
+
* @see https://help.ads.microsoft.com/#apex/ads/en/56682/2-500
|
|
711
|
+
*/
|
|
712
|
+
readonly id: import("valibot").StringSchema<undefined>;
|
|
713
|
+
/**
|
|
714
|
+
* Enable automatic SPA page tracking.
|
|
715
|
+
* @default true
|
|
716
|
+
*/
|
|
717
|
+
readonly enableAutoSpaTracking: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
718
|
+
}, undefined>;
|
|
700
719
|
export declare const SegmentOptions: import("valibot").ObjectSchema<{
|
|
701
720
|
/**
|
|
702
721
|
* Your Segment write key.
|
|
@@ -695,6 +695,25 @@ export const RybbitAnalyticsOptions = object({
|
|
|
695
695
|
*/
|
|
696
696
|
analyticsHost: optional(string())
|
|
697
697
|
});
|
|
698
|
+
export const MixpanelAnalyticsOptions = object({
|
|
699
|
+
/**
|
|
700
|
+
* Your Mixpanel project token.
|
|
701
|
+
* @see https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript#1-initialize-the-library
|
|
702
|
+
*/
|
|
703
|
+
token: string()
|
|
704
|
+
});
|
|
705
|
+
export const BingUetOptions = object({
|
|
706
|
+
/**
|
|
707
|
+
* Your Bing UET tag ID.
|
|
708
|
+
* @see https://help.ads.microsoft.com/#apex/ads/en/56682/2-500
|
|
709
|
+
*/
|
|
710
|
+
id: string(),
|
|
711
|
+
/**
|
|
712
|
+
* Enable automatic SPA page tracking.
|
|
713
|
+
* @default true
|
|
714
|
+
*/
|
|
715
|
+
enableAutoSpaTracking: optional(boolean())
|
|
716
|
+
});
|
|
698
717
|
export const SegmentOptions = object({
|
|
699
718
|
/**
|
|
700
719
|
* Your Segment write key.
|