@nuxt/scripts 0.1.11 → 0.2.0
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 +10 -200
- package/dist/client/200.html +14 -14
- package/dist/client/404.html +14 -14
- package/dist/client/_nuxt/-hLHpAOl.js +1 -0
- package/dist/client/_nuxt/3Yx8WcR-.js +1 -0
- package/dist/client/_nuxt/BLO8rZtj.js +31 -0
- package/dist/client/_nuxt/{DggdVF2v.js → CQ1WWl9n.js} +1 -1
- package/dist/client/_nuxt/CudBhkk3.js +1 -0
- package/dist/client/_nuxt/{DWfzZAoR.js → D6KmUh4-.js} +1 -1
- package/dist/client/_nuxt/{7fd6vGzb.js → DBeuZS66.js} +1 -1
- package/dist/client/_nuxt/DG73IEBO.js +1 -0
- package/dist/client/_nuxt/DX0ZGhB-.js +1 -0
- package/dist/client/_nuxt/{A1WiD9SJ.js → DaCkt_J7.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/69e9f83a-05c7-439f-bf82-0c2d6d83b961.json +1 -0
- package/dist/client/_nuxt/error-404.BRldFSII.css +1 -0
- package/dist/client/_nuxt/error-500.D8yw_IbC.css +1 -0
- package/dist/client/index.html +14 -14
- package/dist/module.d.mts +2 -6
- package/dist/module.d.ts +2 -6
- package/dist/module.json +6 -2
- package/dist/module.mjs +275 -131
- package/dist/runtime/components/GoogleMaps.vue +130 -0
- package/dist/runtime/components/LemonSqueezyButton.vue +28 -0
- package/dist/runtime/components/StripePricingTableEmbed.vue +33 -0
- package/dist/runtime/components/VimeoEmbed.vue +161 -0
- package/dist/runtime/components/YouTubeEmbed.vue +79 -0
- package/dist/runtime/composables/useElementScriptTrigger.d.ts +3 -0
- package/dist/runtime/composables/useElementScriptTrigger.mjs +9 -0
- package/dist/runtime/composables/useScript.d.ts +1 -1
- package/dist/runtime/composables/useScript.mjs +0 -1
- package/dist/runtime/registry/cloudflare-web-analytics.d.ts +9 -7
- package/dist/runtime/registry/cloudflare-web-analytics.mjs +16 -18
- package/dist/runtime/registry/confetti.d.ts +4 -4
- package/dist/runtime/registry/confetti.mjs +11 -8
- package/dist/runtime/registry/facebook-pixel.d.ts +4 -5
- package/dist/runtime/registry/facebook-pixel.mjs +15 -17
- package/dist/runtime/registry/fathom-analytics.d.ts +22 -14
- package/dist/runtime/registry/fathom-analytics.mjs +25 -20
- package/dist/runtime/registry/google-analytics.d.ts +19 -1
- package/dist/runtime/registry/google-analytics.mjs +30 -3
- package/dist/runtime/registry/google-maps.d.ts +21 -1
- package/dist/runtime/registry/google-maps.mjs +40 -3
- package/dist/runtime/registry/google-tag-manager.d.ts +19 -1
- package/dist/runtime/registry/google-tag-manager.mjs +29 -3
- package/dist/runtime/registry/hotjar.d.ts +3 -3
- package/dist/runtime/registry/hotjar.mjs +14 -18
- package/dist/runtime/registry/intercom.d.ts +3 -3
- package/dist/runtime/registry/intercom.mjs +19 -16
- package/dist/runtime/registry/lemon-squeezy.d.ts +66 -0
- package/dist/runtime/registry/lemon-squeezy.mjs +21 -0
- package/dist/runtime/registry/matomo-analytics.d.ts +22 -0
- package/dist/runtime/registry/matomo-analytics.mjs +33 -0
- package/dist/runtime/registry/npm.d.ts +5 -3
- package/dist/runtime/registry/npm.mjs +10 -11
- package/dist/runtime/registry/plausible-analytics.d.ts +20 -0
- package/dist/runtime/registry/plausible-analytics.mjs +35 -0
- package/dist/runtime/registry/segment.d.ts +3 -3
- package/dist/runtime/registry/segment.mjs +34 -34
- package/dist/runtime/registry/stripe.d.ts +16 -0
- package/dist/runtime/registry/stripe.mjs +27 -0
- package/dist/runtime/registry/vimeo-player.d.ts +13 -0
- package/dist/runtime/registry/vimeo-player.mjs +45 -0
- package/dist/runtime/registry/x-pixel.d.ts +39 -0
- package/dist/runtime/registry/x-pixel.mjs +28 -0
- package/dist/runtime/registry/youtube-iframe.d.ts +13 -0
- package/dist/runtime/registry/youtube-iframe.mjs +54 -0
- package/dist/runtime/types.d.ts +31 -15
- package/dist/runtime/utils.d.ts +11 -0
- package/dist/runtime/utils.mjs +30 -1
- package/package.json +34 -23
- package/dist/client/_nuxt/BG_OyJVq.js +0 -1
- package/dist/client/_nuxt/BVxXpP8q.js +0 -1
- package/dist/client/_nuxt/C3YqBJkQ.js +0 -1
- package/dist/client/_nuxt/CgE1uXjm.js +0 -1
- package/dist/client/_nuxt/CrjQeCwm.js +0 -1
- package/dist/client/_nuxt/builds/meta/30ab3bf1-cef9-406d-a50f-876dac2441b6.json +0 -1
- package/dist/client/_nuxt/error-404.ORekjfyJ.css +0 -1
- package/dist/client/_nuxt/error-500.BIuFL0tW.css +0 -1
- package/dist/client/_nuxt/tEXKqKss.js +0 -36
- package/dist/runtime/composables/validateScriptInputSchema.d.ts +0 -2
- package/dist/runtime/composables/validateScriptInputSchema.mjs +0 -14
- package/dist/runtime/registry/cloudflare-turnstile.d.ts +0 -1
- package/dist/runtime/registry/cloudflare-turnstile.mjs +0 -4
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { NuxtUseScriptIntegrationOptions } from '#nuxt-scripts';
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
2
|
export declare const FathomAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
4
3
|
site: import("valibot").StringSchema<string>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
'data-honor-dnt': import("valibot").OptionalSchema<import("valibot").BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
4
|
+
spa: import("valibot").OptionalSchema<import("valibot").UnionSchema<(import("valibot").LiteralSchema<"hash", "hash"> | import("valibot").LiteralSchema<"auto", "auto"> | import("valibot").LiteralSchema<"history", "history">)[], "auto" | "hash" | "history">, undefined, "auto" | "hash" | "history" | undefined>;
|
|
5
|
+
auto: import("valibot").OptionalSchema<import("valibot").BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
6
|
+
canonical: import("valibot").OptionalSchema<import("valibot").BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
7
|
+
honorDnt: import("valibot").OptionalSchema<import("valibot").BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
10
8
|
}, undefined, {
|
|
11
9
|
site: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'data-honor-dnt'?: boolean | undefined;
|
|
10
|
+
auto?: boolean | undefined;
|
|
11
|
+
spa?: "auto" | "hash" | "history" | undefined;
|
|
12
|
+
canonical?: boolean | undefined;
|
|
13
|
+
honorDnt?: boolean | undefined;
|
|
17
14
|
}>;
|
|
18
|
-
export type FathomAnalyticsInput =
|
|
15
|
+
export type FathomAnalyticsInput = RegistryScriptInput<typeof FathomAnalyticsOptions, false>;
|
|
19
16
|
export interface FathomAnalyticsApi {
|
|
17
|
+
beacon: (ctx: {
|
|
18
|
+
url: string;
|
|
19
|
+
referrer?: string;
|
|
20
|
+
}) => void;
|
|
21
|
+
blockTrackingForMe: () => void;
|
|
22
|
+
enableTrackingForMe: () => void;
|
|
23
|
+
isTrackingEnabled: () => boolean;
|
|
24
|
+
send: (type: string, data: unknown) => void;
|
|
25
|
+
setSite: (siteId: string) => void;
|
|
26
|
+
sideId: string;
|
|
20
27
|
trackPageview: (ctx?: {
|
|
21
28
|
url: string;
|
|
22
29
|
referrer?: string;
|
|
23
30
|
}) => void;
|
|
31
|
+
trackGoal: (goalId: string, cents: number) => void;
|
|
24
32
|
trackEvent: (eventName: string, value: {
|
|
25
33
|
_value: number;
|
|
26
34
|
}) => void;
|
|
@@ -30,4 +38,4 @@ declare global {
|
|
|
30
38
|
fathom: FathomAnalyticsApi;
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
|
-
export declare function useScriptFathomAnalytics<T extends FathomAnalyticsApi>(
|
|
41
|
+
export declare function useScriptFathomAnalytics<T extends FathomAnalyticsApi>(_options?: FathomAnalyticsInput): any;
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { boolean, literal, object, optional, string, union } from "valibot";
|
|
2
|
-
import {
|
|
2
|
+
import { registryScript } from "../utils.mjs";
|
|
3
3
|
export const FathomAnalyticsOptions = object({
|
|
4
|
-
|
|
4
|
+
site: string(),
|
|
5
5
|
// site is required
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"data-honor-dnt": optional(boolean())
|
|
6
|
+
spa: optional(union([literal("auto"), literal("history"), literal("hash")])),
|
|
7
|
+
auto: optional(boolean()),
|
|
8
|
+
canonical: optional(boolean()),
|
|
9
|
+
honorDnt: optional(boolean())
|
|
11
10
|
});
|
|
12
|
-
export function useScriptFathomAnalytics(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
export function useScriptFathomAnalytics(_options) {
|
|
12
|
+
return registryScript("fathomAnalytics", (options) => ({
|
|
13
|
+
scriptInput: {
|
|
14
|
+
src: "https://cdn.usefathom.com/script.js",
|
|
15
|
+
// can't be bundled
|
|
16
|
+
// append the data attr's
|
|
17
|
+
...Object.entries(options).filter(([key]) => ["site", "spa", "auto", "canonical", "honorDnt"].includes(key)).reduce((acc, [_key, value]) => {
|
|
18
|
+
const key = _key === "honourDnt" ? "honor-dnt" : _key;
|
|
19
|
+
acc[`data-${key}`] = value;
|
|
20
|
+
return acc;
|
|
21
|
+
}, {})
|
|
22
|
+
},
|
|
23
|
+
schema: FathomAnalyticsOptions,
|
|
24
|
+
scriptOptions: {
|
|
25
|
+
use() {
|
|
26
|
+
return window.fathom;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}), _options);
|
|
25
30
|
}
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import type { GoogleAnalyticsApi } from 'third-party-capital';
|
|
2
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
|
+
declare const GoogleAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
4
|
+
id: import("valibot").StringSchema<string>;
|
|
5
|
+
}, undefined, {
|
|
6
|
+
id: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type GoogleAnalyticsInput = RegistryScriptInput<typeof GoogleAnalyticsOptions>;
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window extends GoogleAnalyticsApi {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* useScriptGoogleAnalytics
|
|
15
|
+
*
|
|
16
|
+
* A 3P wrapper for Google Analytics that takes an options input to feed into third-party-capital({@link https://github.com/GoogleChromeLabs/third-party-capital}), which returns instructions for nuxt-scripts.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useScriptGoogleAnalytics<T extends GoogleAnalyticsApi>(_options?: GoogleAnalyticsInput): any;
|
|
19
|
+
export {};
|
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { object, string } from "valibot";
|
|
2
|
+
import { registryScript } from "../utils.mjs";
|
|
3
|
+
import { GoogleAnalyticsScriptResolver } from "../../registry";
|
|
4
|
+
const GoogleAnalyticsOptions = object({
|
|
5
|
+
id: string()
|
|
6
|
+
});
|
|
7
|
+
export function useScriptGoogleAnalytics(_options) {
|
|
8
|
+
return registryScript("googleAnalytics", (options) => ({
|
|
9
|
+
scriptInput: {
|
|
10
|
+
src: GoogleAnalyticsScriptResolver(options)
|
|
11
|
+
},
|
|
12
|
+
schema: GoogleAnalyticsOptions,
|
|
13
|
+
scriptOptions: {
|
|
14
|
+
use() {
|
|
15
|
+
return { dataLayer: window.dataLayer, gtag: window.gtag };
|
|
16
|
+
},
|
|
17
|
+
// allow dataLayer to be accessed on the server
|
|
18
|
+
stub: import.meta.client ? void 0 : ({ fn }) => {
|
|
19
|
+
return fn === "dataLayer" ? [] : void 0;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
23
|
+
window.dataLayer = window.dataLayer || [];
|
|
24
|
+
window.gtag = function gtag(...p) {
|
|
25
|
+
window.dataLayer.push(p);
|
|
26
|
+
};
|
|
27
|
+
window.gtag("js", /* @__PURE__ */ new Date());
|
|
28
|
+
window.gtag("config", options?.id);
|
|
29
|
+
}
|
|
30
|
+
}), _options);
|
|
4
31
|
}
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import type google from 'google.maps';
|
|
2
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
|
+
export declare const GoogleMapsOptions: import("valibot").ObjectSchema<{
|
|
4
|
+
apiKey: import("valibot").StringSchema<string>;
|
|
5
|
+
libraries: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").StringSchema<string>, string[]>, undefined, string[] | undefined>;
|
|
6
|
+
v: import("valibot").OptionalSchema<import("valibot").UnionSchema<(import("valibot").LiteralSchema<"weekly", "weekly"> | import("valibot").LiteralSchema<"beta", "beta"> | import("valibot").LiteralSchema<"alpha", "alpha">)[], "weekly" | "beta" | "alpha">, undefined, "weekly" | "beta" | "alpha" | undefined>;
|
|
7
|
+
}, undefined, {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
libraries?: string[] | undefined;
|
|
10
|
+
v?: "weekly" | "beta" | "alpha" | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export type GoogleMapsInput = RegistryScriptInput<typeof GoogleMapsOptions>;
|
|
13
|
+
export interface GoogleMapsApi {
|
|
14
|
+
maps: google.maps;
|
|
15
|
+
}
|
|
16
|
+
declare global {
|
|
17
|
+
interface Window {
|
|
18
|
+
google: typeof google;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export declare function useScriptGoogleMaps<T extends GoogleMapsApi>(_options?: GoogleMapsInput): any;
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { array, literal, object, optional, string, union } from "valibot";
|
|
2
|
+
import { withQuery } from "ufo";
|
|
3
|
+
import { registryScript } from "../utils.mjs";
|
|
4
|
+
export const GoogleMapsOptions = object({
|
|
5
|
+
apiKey: string(),
|
|
6
|
+
libraries: optional(array(string())),
|
|
7
|
+
v: optional(union([literal("weekly"), literal("beta"), literal("alpha")]))
|
|
8
|
+
});
|
|
9
|
+
export function useScriptGoogleMaps(_options) {
|
|
10
|
+
let readyPromise = Promise.resolve();
|
|
11
|
+
return registryScript("googleMaps", (options) => {
|
|
12
|
+
const libraries = options?.libraries || ["places"];
|
|
13
|
+
return {
|
|
14
|
+
scriptInput: {
|
|
15
|
+
src: withQuery(`https://maps.googleapis.com/maps/api/js`, {
|
|
16
|
+
libraries: libraries.join(","),
|
|
17
|
+
key: options?.apiKey,
|
|
18
|
+
loading: "async",
|
|
19
|
+
callback: "google.maps.__ib__"
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
23
|
+
window.google = window.google || {};
|
|
24
|
+
window.google.maps = window.google.maps || {};
|
|
25
|
+
readyPromise = new Promise((resolve) => {
|
|
26
|
+
window.google.maps.__ib__ = resolve;
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
schema: GoogleMapsOptions,
|
|
30
|
+
scriptOptions: {
|
|
31
|
+
use() {
|
|
32
|
+
return {
|
|
33
|
+
maps: readyPromise.then(() => {
|
|
34
|
+
return window.google.maps;
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}, _options);
|
|
4
41
|
}
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import type { GoogleTagManagerApi } from 'third-party-capital';
|
|
2
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
|
+
declare const GoogleTagManagerOptions: import("valibot").ObjectSchema<{
|
|
4
|
+
id: import("valibot").StringSchema<string>;
|
|
5
|
+
}, undefined, {
|
|
6
|
+
id: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type GoogleTagManagerInput = RegistryScriptInput<typeof GoogleTagManagerOptions>;
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window extends GoogleTagManagerApi {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* useScriptGoogleTagManager
|
|
15
|
+
*
|
|
16
|
+
* A 3P wrapper for Google Tag Manager that takes an options input to feed into third-party-capital({@link https://github.com/GoogleChromeLabs/third-party-capital}), which returns instructions for nuxt-scripts.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useScriptGoogleTagManager<T extends GoogleTagManagerApi>(options?: GoogleTagManagerInput): any;
|
|
19
|
+
export {};
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { object, string } from "valibot";
|
|
2
|
+
import { withQuery } from "ufo";
|
|
3
|
+
import { registryScript } from "../utils.mjs";
|
|
4
|
+
const GoogleTagManagerOptions = object({
|
|
5
|
+
id: string()
|
|
6
|
+
});
|
|
7
|
+
export function useScriptGoogleTagManager(options) {
|
|
8
|
+
return registryScript("googleTagManager", (options2) => ({
|
|
9
|
+
scriptInput: {
|
|
10
|
+
async: true,
|
|
11
|
+
src: withQuery("https://www.googletagmanager.com/gtm.js", {
|
|
12
|
+
id: options2?.id
|
|
13
|
+
})
|
|
14
|
+
},
|
|
15
|
+
schema: GoogleTagManagerOptions,
|
|
16
|
+
scriptOptions: {
|
|
17
|
+
use() {
|
|
18
|
+
return { dataLayer: window.dataLayer, google_tag_manager: window.google_tag_manager };
|
|
19
|
+
},
|
|
20
|
+
// allow dataLayer to be accessed on the server
|
|
21
|
+
stub: import.meta.client ? void 0 : ({ fn }) => {
|
|
22
|
+
return fn === "dataLayer" ? [] : void 0;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
26
|
+
window.dataLayer = window.dataLayer || [];
|
|
27
|
+
window.dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), "event": "gtm.js" });
|
|
28
|
+
}
|
|
29
|
+
}), options);
|
|
4
30
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
2
2
|
export interface HotjarApi {
|
|
3
3
|
hj: ((event: 'identify', userId: string, attributes?: Record<string, any>) => void) & ((event: 'stateChange', path: string) => void) & ((event: 'event', eventName: string) => void) & ((event: string, arg?: string) => void) & ((...params: any[]) => void) & {
|
|
4
4
|
q: any[];
|
|
@@ -19,5 +19,5 @@ export declare const HotjarOptions: import("valibot").ObjectSchema<{
|
|
|
19
19
|
id: number;
|
|
20
20
|
sv?: number | undefined;
|
|
21
21
|
}>;
|
|
22
|
-
export type HotjarInput =
|
|
23
|
-
export declare function useScriptHotjar<T extends HotjarApi>(
|
|
22
|
+
export type HotjarInput = RegistryScriptInput<typeof HotjarOptions>;
|
|
23
|
+
export declare function useScriptHotjar<T extends HotjarApi>(_options?: HotjarInput): any;
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
import { number, object, optional } from "valibot";
|
|
2
|
-
import {
|
|
2
|
+
import { registryScript } from "../utils.mjs";
|
|
3
3
|
export const HotjarOptions = object({
|
|
4
4
|
id: number(),
|
|
5
5
|
sv: optional(number())
|
|
6
6
|
});
|
|
7
|
-
export function useScriptHotjar(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export function useScriptHotjar(_options) {
|
|
8
|
+
return registryScript("hotjar", (options) => ({
|
|
9
|
+
scriptInput: {
|
|
10
|
+
src: `https://static.hotjar.com/c/hotjar-${options?.id}.js?sv=${options?.sv}`
|
|
11
|
+
},
|
|
12
|
+
schema: HotjarOptions,
|
|
13
|
+
scriptOptions: {
|
|
14
|
+
use() {
|
|
15
|
+
return { hj: window.hj };
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
12
19
|
window._hjSettings = window._hjSettings || { hjid: options?.id, hjsv: options?.sv };
|
|
13
20
|
window.hj = window.hj || function(...params) {
|
|
14
21
|
(window.hj.q = window.hj.q || []).push(params);
|
|
15
22
|
};
|
|
16
23
|
}
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
return useScript({
|
|
20
|
-
key: "hotjar",
|
|
21
|
-
// requires extra steps to bundle
|
|
22
|
-
src: options?.src || `https://static.hotjar.com/c/hotjar-${options?.id}.js?sv=${options?.sv}`
|
|
23
|
-
}, {
|
|
24
|
-
...scriptOptions,
|
|
25
|
-
use() {
|
|
26
|
-
return { hj: window.hj };
|
|
27
|
-
}
|
|
28
|
-
});
|
|
24
|
+
}), _options);
|
|
29
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Input } from 'valibot';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
3
3
|
export declare const IntercomOptions: import("valibot").ObjectSchema<{
|
|
4
4
|
app_id: import("valibot").StringSchema<string>;
|
|
5
5
|
api_base: import("valibot").OptionalSchema<import("valibot").UnionSchema<(import("valibot").LiteralSchema<"https://api-iam.intercom.io", "https://api-iam.intercom.io"> | import("valibot").LiteralSchema<"https://api-iam.eu.intercom.io", "https://api-iam.eu.intercom.io"> | import("valibot").LiteralSchema<"https://api-iam.au.intercom.io", "https://api-iam.au.intercom.io">)[], "https://api-iam.intercom.io" | "https://api-iam.eu.intercom.io" | "https://api-iam.au.intercom.io">, undefined, "https://api-iam.intercom.io" | "https://api-iam.eu.intercom.io" | "https://api-iam.au.intercom.io" | undefined>;
|
|
@@ -19,7 +19,7 @@ export declare const IntercomOptions: import("valibot").ObjectSchema<{
|
|
|
19
19
|
horizontal_padding?: number | undefined;
|
|
20
20
|
vertical_padding?: number | undefined;
|
|
21
21
|
}>;
|
|
22
|
-
export type IntercomInput =
|
|
22
|
+
export type IntercomInput = RegistryScriptInput<typeof IntercomOptions>;
|
|
23
23
|
export interface IntercomApi {
|
|
24
24
|
Intercom: ((event: 'boot', data?: Input<typeof IntercomOptions>) => void) & ((event: 'shutdown') => void) & ((event: 'update', options?: Input<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);
|
|
25
25
|
}
|
|
@@ -28,4 +28,4 @@ declare global {
|
|
|
28
28
|
intercomSettings?: IntercomInput;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
export declare function useScriptIntercom<T extends IntercomApi>(
|
|
31
|
+
export declare function useScriptIntercom<T extends IntercomApi>(_options?: IntercomInput): any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { literal, number, object, optional, string, union } from "valibot";
|
|
2
2
|
import { joinURL } from "ufo";
|
|
3
|
-
import {
|
|
3
|
+
import { registryScript } from "../utils.mjs";
|
|
4
4
|
export const IntercomOptions = object({
|
|
5
5
|
app_id: string(),
|
|
6
6
|
api_base: optional(union([literal("https://api-iam.intercom.io"), literal("https://api-iam.eu.intercom.io"), literal("https://api-iam.au.intercom.io")])),
|
|
@@ -12,21 +12,24 @@ export const IntercomOptions = object({
|
|
|
12
12
|
horizontal_padding: optional(number()),
|
|
13
13
|
vertical_padding: optional(number())
|
|
14
14
|
});
|
|
15
|
-
export function useScriptIntercom(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export function useScriptIntercom(_options) {
|
|
16
|
+
return registryScript("intercom", (options) => ({
|
|
17
|
+
scriptInput: {
|
|
18
|
+
src: joinURL(`https://widget.intercom.io/widget`, options?.app_id || ""),
|
|
19
|
+
// append the data attr's
|
|
20
|
+
...Object.entries(options).filter(([key]) => key.startsWith("data-")).reduce((acc, [key, value]) => {
|
|
21
|
+
acc[key] = value;
|
|
22
|
+
return acc;
|
|
23
|
+
})
|
|
24
|
+
},
|
|
25
|
+
schema: IntercomOptions,
|
|
26
|
+
scriptOptions: {
|
|
27
|
+
use() {
|
|
28
|
+
return { Intercom: window.Intercom };
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
20
32
|
window.intercomSettings = options;
|
|
21
|
-
scriptOptions.beforeInit?.();
|
|
22
|
-
};
|
|
23
|
-
return useScript({
|
|
24
|
-
key: "intercom",
|
|
25
|
-
src: options?.src || joinURL(`https://widget.intercom.io/widget`, options?.app_id || "")
|
|
26
|
-
}, {
|
|
27
|
-
...scriptOptions,
|
|
28
|
-
use() {
|
|
29
|
-
return { Intercom: window.Intercom };
|
|
30
33
|
}
|
|
31
|
-
});
|
|
34
|
+
}), _options);
|
|
32
35
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
2
|
+
export declare const LemonSqueezyOptions: import("valibot").ObjectSchema<{}, undefined, {}>;
|
|
3
|
+
export type LemonSqueezyInput = RegistryScriptInput<typeof LemonSqueezyOptions>;
|
|
4
|
+
export interface LemonSqueezyApi {
|
|
5
|
+
/**
|
|
6
|
+
* Initialises Lemon.js on your page.
|
|
7
|
+
* @param options - An object with a single property, eventHandler, which is a function that will be called when Lemon.js emits an event.
|
|
8
|
+
*/
|
|
9
|
+
Setup: (options: {
|
|
10
|
+
eventHandler: (event: {
|
|
11
|
+
event: 'Checkout.Success';
|
|
12
|
+
data: Record<string, any>;
|
|
13
|
+
} & {
|
|
14
|
+
event: 'PaymentMethodUpdate.Mounted';
|
|
15
|
+
} & {
|
|
16
|
+
event: 'PaymentMethodUpdate.Closed';
|
|
17
|
+
} & {
|
|
18
|
+
event: 'PaymentMethodUpdate.Updated';
|
|
19
|
+
} & {
|
|
20
|
+
event: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
}) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Refreshes `lemonsqueezy-button` listeners on the page.
|
|
25
|
+
*/
|
|
26
|
+
Refresh: () => void;
|
|
27
|
+
Url: {
|
|
28
|
+
/**
|
|
29
|
+
* Opens a given Lemon Squeezy URL, typically these are Checkout or Payment Details Update overlays.
|
|
30
|
+
* @param url - The URL to open.
|
|
31
|
+
*/
|
|
32
|
+
Open: (url: string) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Closes the current opened Lemon Squeezy overlay checkout window.
|
|
35
|
+
*/
|
|
36
|
+
Close: () => void;
|
|
37
|
+
};
|
|
38
|
+
Affiliate: {
|
|
39
|
+
/**
|
|
40
|
+
* Retrieve the affiliate tracking ID
|
|
41
|
+
*/
|
|
42
|
+
GetID: () => string;
|
|
43
|
+
/**
|
|
44
|
+
* Append the affiliate tracking parameter to the given URL
|
|
45
|
+
* @param url - The URL to append the affiliate tracking parameter to.
|
|
46
|
+
*/
|
|
47
|
+
Build: (url: string) => string;
|
|
48
|
+
};
|
|
49
|
+
Loader: {
|
|
50
|
+
/**
|
|
51
|
+
* Show the Lemon.js loader.
|
|
52
|
+
*/
|
|
53
|
+
Show: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Hide the Lemon.js loader.
|
|
56
|
+
*/
|
|
57
|
+
Hide: () => void;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
declare global {
|
|
61
|
+
interface Window {
|
|
62
|
+
createLemonSqueezy: () => void;
|
|
63
|
+
LemonSqueezy: LemonSqueezyApi;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export declare function useScriptLemonSqueezy<T extends LemonSqueezyApi>(_options?: LemonSqueezyInput): any;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { object } from "valibot";
|
|
2
|
+
import { registryScript } from "../utils.mjs";
|
|
3
|
+
export const LemonSqueezyOptions = object({});
|
|
4
|
+
export function useScriptLemonSqueezy(_options) {
|
|
5
|
+
return registryScript("lemonSqueezy", () => ({
|
|
6
|
+
scriptInput: {
|
|
7
|
+
src: "https://assets.lemonsqueezy.com/lemon.js",
|
|
8
|
+
// @ts-expect-error untyped
|
|
9
|
+
crossorigin: null
|
|
10
|
+
},
|
|
11
|
+
schema: LemonSqueezyOptions,
|
|
12
|
+
scriptOptions: {
|
|
13
|
+
use() {
|
|
14
|
+
if (typeof window.createLemonSqueezy === "undefined")
|
|
15
|
+
return void 0;
|
|
16
|
+
window.createLemonSqueezy();
|
|
17
|
+
return window.LemonSqueezy;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}), _options);
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
2
|
+
export declare const MatomoAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
3
|
+
matomoUrl: import("valibot").StringSchema<string>;
|
|
4
|
+
siteId: import("valibot").StringSchema<string>;
|
|
5
|
+
trackPageView: import("valibot").OptionalSchema<import("valibot").BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
6
|
+
enableLinkTracking: import("valibot").OptionalSchema<import("valibot").BooleanSchema<boolean>, undefined, boolean | undefined>;
|
|
7
|
+
}, undefined, {
|
|
8
|
+
matomoUrl: string;
|
|
9
|
+
siteId: string;
|
|
10
|
+
trackPageView?: boolean | undefined;
|
|
11
|
+
enableLinkTracking?: boolean | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
export type MatomoAnalyticsInput = RegistryScriptInput<typeof MatomoAnalyticsOptions, false>;
|
|
14
|
+
interface MatomoAnalyticsApi {
|
|
15
|
+
_paq: unknown[];
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface Window extends MatomoAnalyticsApi {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export declare function useScriptMatomoAnalytics<T extends MatomoAnalyticsApi>(_options?: MatomoAnalyticsInput): any;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { boolean, object, optional, string } from "valibot";
|
|
2
|
+
import { registryScript } from "../utils.mjs";
|
|
3
|
+
export const MatomoAnalyticsOptions = object({
|
|
4
|
+
matomoUrl: string(),
|
|
5
|
+
// site is required
|
|
6
|
+
siteId: string(),
|
|
7
|
+
trackPageView: optional(boolean()),
|
|
8
|
+
enableLinkTracking: optional(boolean())
|
|
9
|
+
});
|
|
10
|
+
export function useScriptMatomoAnalytics(_options) {
|
|
11
|
+
return registryScript("matomoAnalytics", (options) => ({
|
|
12
|
+
scriptInput: {
|
|
13
|
+
src: `https://${options?.matomoUrl}/matomo.js`
|
|
14
|
+
},
|
|
15
|
+
schema: MatomoAnalyticsOptions,
|
|
16
|
+
scriptOptions: {
|
|
17
|
+
use() {
|
|
18
|
+
return { _paq: window._paq };
|
|
19
|
+
},
|
|
20
|
+
// allow _paq to be accessed on the server
|
|
21
|
+
stub: import.meta.client ? void 0 : ({ fn }) => {
|
|
22
|
+
return fn === "_paq" ? [] : void 0;
|
|
23
|
+
},
|
|
24
|
+
clientInit: import.meta.server ? void 0 : () => {
|
|
25
|
+
const _paq = window._paq = window._paq || [];
|
|
26
|
+
options?.trackPageView !== false && _paq.push(["trackPageView"]);
|
|
27
|
+
options?.enableLinkTracking !== false && _paq.push(["enableLinkTracking"]);
|
|
28
|
+
_paq.push(["setTrackerUrl", `//${options?.matomoUrl}/matomo.php`]);
|
|
29
|
+
_paq.push(["setSiteId", options?.siteId]);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}), _options);
|
|
33
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts';
|
|
2
2
|
export declare const NpmOptions: import("valibot").ObjectSchema<{
|
|
3
3
|
packageName: import("valibot").StringSchema<string>;
|
|
4
4
|
file: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
|
|
5
5
|
version: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
|
|
6
|
+
type: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
|
|
6
7
|
}, undefined, {
|
|
7
8
|
packageName: string;
|
|
9
|
+
type?: string | undefined;
|
|
8
10
|
file?: string | undefined;
|
|
9
11
|
version?: string | undefined;
|
|
10
12
|
}>;
|
|
11
|
-
export type NpmInput =
|
|
12
|
-
export declare function useScriptNpm<T
|
|
13
|
+
export type NpmInput = RegistryScriptInput<typeof NpmOptions>;
|
|
14
|
+
export declare function useScriptNpm<T extends Record<string | symbol, any>>(key: string, _options: NpmInput): any;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { object, optional, string } from "valibot";
|
|
2
2
|
import { withBase } from "ufo";
|
|
3
|
-
import {
|
|
3
|
+
import { registryScript } from "../utils.mjs";
|
|
4
4
|
export const NpmOptions = object({
|
|
5
5
|
packageName: string(),
|
|
6
6
|
file: optional(string()),
|
|
7
|
-
version: optional(string())
|
|
7
|
+
version: optional(string()),
|
|
8
|
+
type: optional(string())
|
|
8
9
|
});
|
|
9
|
-
export function useScriptNpm(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
src: options.src || withBase(options.file || "", `https://unpkg.com/${options?.packageName}@${options.version || "latest"}`)
|
|
17
|
-
}, scriptOptions);
|
|
10
|
+
export function useScriptNpm(key, _options) {
|
|
11
|
+
return registryScript(`${key}-npm`, (options) => ({
|
|
12
|
+
scriptInput: {
|
|
13
|
+
src: withBase(options.file || "", `https://unpkg.com/${options?.packageName}@${options.version || "latest"}`)
|
|
14
|
+
},
|
|
15
|
+
schema: NpmOptions
|
|
16
|
+
}), _options);
|
|
18
17
|
}
|