@c15t/scripts 2.0.0 → 2.1.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 +9 -9
- package/dist/e2e-test-utils.cjs +125 -0
- package/dist/e2e-test-utils.js +67 -0
- package/dist/engine/runtime.cjs +19 -9
- package/dist/engine/runtime.js +19 -9
- package/dist/registry.cjs +338 -0
- package/dist/registry.js +292 -0
- package/dist/types.cjs +18 -0
- package/dist/types.js +10 -1
- package/dist/vendors/_shared/attributes.cjs +51 -0
- package/dist/vendors/_shared/attributes.js +14 -0
- package/dist/vendors/_shared/google-consent.cjs +64 -0
- package/dist/vendors/_shared/google-consent.js +27 -0
- package/dist/vendors/_shared/install-builders.cjs +55 -0
- package/dist/vendors/_shared/install-builders.js +21 -0
- package/dist/vendors/_shared/script-url.cjs +74 -0
- package/dist/vendors/_shared/script-url.js +28 -0
- package/dist/{linkedin-insights.cjs → vendors/ads-and-pixels/linkedin-insights.cjs} +2 -2
- package/dist/{linkedin-insights.js → vendors/ads-and-pixels/linkedin-insights.js} +2 -2
- package/dist/vendors/ads-and-pixels/meta-pixel.cjs +202 -0
- package/dist/vendors/ads-and-pixels/meta-pixel.js +153 -0
- package/dist/{microsoft-uet.cjs → vendors/ads-and-pixels/microsoft-uet.cjs} +31 -14
- package/dist/{microsoft-uet.js → vendors/ads-and-pixels/microsoft-uet.js} +31 -14
- package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +147 -0
- package/dist/vendors/ads-and-pixels/reddit-pixel.js +107 -0
- package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +127 -0
- package/dist/vendors/ads-and-pixels/snapchat-pixel.js +87 -0
- package/dist/{tiktok-pixel.cjs → vendors/ads-and-pixels/tiktok-pixel.cjs} +2 -2
- package/dist/{tiktok-pixel.js → vendors/ads-and-pixels/tiktok-pixel.js} +2 -2
- package/dist/{x-pixel.cjs → vendors/ads-and-pixels/x-pixel.cjs} +6 -3
- package/dist/{x-pixel.js → vendors/ads-and-pixels/x-pixel.js} +6 -3
- package/dist/vendors/analytics/ahrefs-analytics.cjs +64 -0
- package/dist/vendors/analytics/ahrefs-analytics.js +27 -0
- package/dist/vendors/analytics/cloudflare-web-analytics.cjs +69 -0
- package/dist/vendors/analytics/cloudflare-web-analytics.js +32 -0
- package/dist/{databuddy.cjs → vendors/analytics/databuddy.cjs} +3 -3
- package/dist/{databuddy.js → vendors/analytics/databuddy.js} +3 -3
- package/dist/vendors/analytics/fathom-analytics.cjs +72 -0
- package/dist/vendors/analytics/fathom-analytics.js +35 -0
- package/dist/{google-tag.cjs → vendors/analytics/google-tag.cjs} +7 -28
- package/dist/{google-tag.js → vendors/analytics/google-tag.js} +7 -28
- package/dist/vendors/analytics/hotjar.cjs +81 -0
- package/dist/vendors/analytics/hotjar.js +44 -0
- package/dist/vendors/analytics/matomo-analytics.cjs +228 -0
- package/dist/vendors/analytics/matomo-analytics.js +191 -0
- package/dist/vendors/analytics/microsoft-clarity.cjs +110 -0
- package/dist/vendors/analytics/microsoft-clarity.js +73 -0
- package/dist/vendors/analytics/mixpanel-analytics.cjs +119 -0
- package/dist/vendors/analytics/mixpanel-analytics.js +82 -0
- package/dist/vendors/analytics/plausible-analytics.cjs +118 -0
- package/dist/vendors/analytics/plausible-analytics.js +81 -0
- package/dist/{posthog.cjs → vendors/analytics/posthog.cjs} +69 -6
- package/dist/vendors/analytics/posthog.js +163 -0
- package/dist/vendors/analytics/promptwatch.cjs +66 -0
- package/dist/vendors/analytics/promptwatch.js +29 -0
- package/dist/vendors/analytics/rybbit-analytics.cjs +100 -0
- package/dist/vendors/analytics/rybbit-analytics.js +63 -0
- package/dist/vendors/analytics/segment.cjs +93 -0
- package/dist/vendors/analytics/segment.js +56 -0
- package/dist/vendors/analytics/umami-analytics.cjs +76 -0
- package/dist/vendors/analytics/umami-analytics.js +39 -0
- package/dist/vendors/analytics/vercel-analytics.cjs +90 -0
- package/dist/vendors/analytics/vercel-analytics.js +53 -0
- package/dist/vendors/functional/crisp.cjs +139 -0
- package/dist/vendors/functional/crisp.js +102 -0
- package/dist/vendors/functional/intercom.cjs +85 -0
- package/dist/vendors/functional/intercom.js +45 -0
- package/dist/{google-tag-manager.cjs → vendors/tag-managers/google-tag-manager.cjs} +6 -27
- package/dist/{google-tag-manager.js → vendors/tag-managers/google-tag-manager.js} +6 -27
- package/dist-types/__tests__/helpers.d.ts +141 -0
- package/dist-types/engine/runtime.d.ts +1 -1
- package/dist-types/registry.d.ts +368 -0
- package/dist-types/types.d.ts +13 -0
- package/dist-types/vendors/_shared/attributes.d.ts +35 -0
- package/dist-types/vendors/_shared/google-consent.d.ts +47 -0
- package/dist-types/vendors/_shared/install-builders.d.ts +30 -0
- package/dist-types/vendors/_shared/script-url.d.ts +75 -0
- package/dist-types/{linkedin-insights.d.ts → vendors/ads-and-pixels/linkedin-insights.d.ts} +22 -9
- package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +289 -0
- package/dist-types/{microsoft-uet.d.ts → vendors/ads-and-pixels/microsoft-uet.d.ts} +21 -10
- package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +211 -0
- package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +171 -0
- package/dist-types/{tiktok-pixel.d.ts → vendors/ads-and-pixels/tiktok-pixel.d.ts} +20 -5
- package/dist-types/{x-pixel.d.ts → vendors/ads-and-pixels/x-pixel.d.ts} +21 -4
- package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +62 -0
- package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +67 -0
- package/dist-types/vendors/analytics/fathom-analytics.d.ts +90 -0
- package/dist-types/{google-tag.d.ts → vendors/analytics/google-tag.d.ts} +5 -8
- package/dist-types/vendors/analytics/hotjar.d.ts +73 -0
- package/dist-types/vendors/analytics/matomo-analytics.d.ts +41 -0
- package/dist-types/vendors/analytics/microsoft-clarity.d.ts +86 -0
- package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +101 -0
- package/dist-types/vendors/analytics/plausible-analytics.d.ts +122 -0
- package/dist-types/{posthog.d.ts → vendors/analytics/posthog.d.ts} +47 -5
- package/dist-types/vendors/analytics/promptwatch.d.ts +36 -0
- package/dist-types/vendors/analytics/rybbit-analytics.d.ts +82 -0
- package/dist-types/vendors/analytics/segment.d.ts +158 -0
- package/dist-types/vendors/analytics/umami-analytics.d.ts +93 -0
- package/dist-types/vendors/analytics/vercel-analytics.d.ts +66 -0
- package/dist-types/vendors/functional/crisp.d.ts +78 -0
- package/dist-types/vendors/functional/intercom.d.ts +135 -0
- package/dist-types/{google-tag-manager.d.ts → vendors/tag-managers/google-tag-manager.d.ts} +5 -8
- package/package.json +166 -5
- package/dist/meta-pixel.cjs +0 -129
- package/dist/meta-pixel.js +0 -89
- package/dist/posthog.js +0 -100
- package/dist-types/engine.test.d.ts +0 -1
- package/dist-types/helpers.test.d.ts +0 -1
- package/dist-types/meta-pixel.d.ts +0 -185
- /package/dist-types/{databuddy.d.ts → vendors/analytics/databuddy.d.ts} +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
/**
|
|
3
|
+
* Public Segment Analytics.js API exposed on `window.analytics`.
|
|
4
|
+
*
|
|
5
|
+
* Use this interface when interacting with Segment calls queued before or after
|
|
6
|
+
* the client library is fully initialized.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* window.analytics.track('Signup', { plan: 'pro' });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export interface SegmentApi {
|
|
14
|
+
/**
|
|
15
|
+
* Queues an event tracking call.
|
|
16
|
+
*
|
|
17
|
+
* @param event - Event name to record.
|
|
18
|
+
* @param properties - Optional event properties payload.
|
|
19
|
+
* @returns `void`.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Calls are queued until Analytics.js initializes.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* window.analytics.track('Signup', { plan: 'pro' });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
track: (event: string, properties?: Record<string, unknown>) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Queues a page tracking call.
|
|
32
|
+
*
|
|
33
|
+
* @param name - Optional page name override.
|
|
34
|
+
* @param properties - Optional page metadata payload.
|
|
35
|
+
* @returns `void`.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* If no name is passed, Segment infers the current page context.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* window.analytics.page('Pricing');
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
page: (name?: string, properties?: Record<string, unknown>) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Queues a user identification call.
|
|
48
|
+
*
|
|
49
|
+
* @param userId - Stable user identifier.
|
|
50
|
+
* @param traits - Optional trait map associated with the user.
|
|
51
|
+
* @param options - Optional Segment call options.
|
|
52
|
+
* @returns `void`.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Ensure the client is initialized and use a stable `userId` to avoid
|
|
56
|
+
* fragmented user profiles.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* window.analytics.identify('user_123', { email: 'dev@example.com' });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
identify: (userId: string, traits?: Record<string, unknown>, options?: Record<string, unknown>) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Queues a group association call for account-level analytics.
|
|
66
|
+
*
|
|
67
|
+
* @param groupId - Group or account identifier.
|
|
68
|
+
* @param traits - Optional group trait map.
|
|
69
|
+
* @param options - Optional Segment call options.
|
|
70
|
+
* @returns `void`.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* window.analytics.group('acme-inc', { plan: 'enterprise' });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
group: (groupId: string, traits?: Record<string, unknown>, options?: Record<string, unknown>) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Queues a user alias call to merge identities.
|
|
80
|
+
*
|
|
81
|
+
* @param userId - New canonical user identifier.
|
|
82
|
+
* @param previousId - Optional previous anonymous or legacy identifier.
|
|
83
|
+
* @param options - Optional Segment call options.
|
|
84
|
+
* @returns `void`.
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* Use `previousId` only when linking an existing anonymous identity to the
|
|
88
|
+
* new `userId`.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* window.analytics.alias('user_123', 'anon_456');
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
alias: (userId: string, previousId?: string, options?: Record<string, unknown>) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Queues a reset call that clears current user identity state.
|
|
98
|
+
*
|
|
99
|
+
* @returns `void`.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* window.analytics.reset();
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
reset: () => void;
|
|
107
|
+
}
|
|
108
|
+
declare global {
|
|
109
|
+
interface Window {
|
|
110
|
+
analytics?: SegmentApi;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Segment vendor manifest.
|
|
115
|
+
*
|
|
116
|
+
* Uses Segment's standard `window.analytics` queue shape and optionally queues
|
|
117
|
+
* the initial `page()` call before the bundle loads.
|
|
118
|
+
*/
|
|
119
|
+
export declare const segmentManifest: {
|
|
120
|
+
readonly vendor: "segment";
|
|
121
|
+
readonly category: "measurement";
|
|
122
|
+
readonly bootstrap: [{
|
|
123
|
+
readonly type: "setGlobal";
|
|
124
|
+
readonly name: "analytics";
|
|
125
|
+
readonly value: readonly [];
|
|
126
|
+
readonly ifUndefined: true;
|
|
127
|
+
}, {
|
|
128
|
+
readonly type: "defineQueueMethods";
|
|
129
|
+
readonly target: "analytics";
|
|
130
|
+
readonly methods: ["track", "page", "identify", "group", "alias", "reset"];
|
|
131
|
+
}];
|
|
132
|
+
readonly install: [{
|
|
133
|
+
readonly type: "callGlobal";
|
|
134
|
+
readonly global: "analytics";
|
|
135
|
+
readonly method: "page";
|
|
136
|
+
}, {
|
|
137
|
+
readonly type: "loadScript";
|
|
138
|
+
readonly src: "{{scriptUrl}}";
|
|
139
|
+
readonly async: true;
|
|
140
|
+
}];
|
|
141
|
+
readonly kind: "c15t.vendor-manifest";
|
|
142
|
+
readonly schemaVersion: 1;
|
|
143
|
+
};
|
|
144
|
+
export interface SegmentOptions {
|
|
145
|
+
/** Your Segment write key. */
|
|
146
|
+
writeKey: string;
|
|
147
|
+
/** Queue the initial `analytics.page()` call during setup. */
|
|
148
|
+
trackPageView?: boolean;
|
|
149
|
+
/** Optional full loader URL override. */
|
|
150
|
+
scriptUrl?: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Creates a Segment Analytics.js script.
|
|
154
|
+
*
|
|
155
|
+
* @param options - The options for the Segment script.
|
|
156
|
+
* @returns The Segment script configuration.
|
|
157
|
+
*/
|
|
158
|
+
export declare function segment({ writeKey, trackPageView, scriptUrl, }: SegmentOptions): Script;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
umami?: {
|
|
5
|
+
identify: (sessionData?: Record<string, unknown> | string) => void;
|
|
6
|
+
track: {
|
|
7
|
+
(payload?: Record<string, unknown>): void;
|
|
8
|
+
(eventName: string, eventData?: Record<string, unknown>): void;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Umami Analytics vendor manifest.
|
|
15
|
+
*
|
|
16
|
+
* Configures Umami entirely through script `data-*` attributes. Umami is a
|
|
17
|
+
* cookieless analytics product, so the script is consent-gated on
|
|
18
|
+
* `measurement` and unloaded when consent is revoked.
|
|
19
|
+
*/
|
|
20
|
+
export declare const umamiAnalyticsManifest: {
|
|
21
|
+
readonly vendor: "umami-analytics";
|
|
22
|
+
readonly category: "measurement";
|
|
23
|
+
readonly install: [{
|
|
24
|
+
readonly type: "loadScript";
|
|
25
|
+
readonly src: "{{scriptUrl}}";
|
|
26
|
+
readonly defer: true;
|
|
27
|
+
readonly attributes: {
|
|
28
|
+
readonly 'data-website-id': "{{websiteId}}";
|
|
29
|
+
readonly 'data-host-url': "{{hostUrl}}";
|
|
30
|
+
readonly 'data-auto-track': "{{autoTrackAttribute}}";
|
|
31
|
+
readonly 'data-domains': "{{domains}}";
|
|
32
|
+
readonly 'data-tag': "{{tag}}";
|
|
33
|
+
readonly 'data-before-send': "{{beforeSend}}";
|
|
34
|
+
};
|
|
35
|
+
}];
|
|
36
|
+
readonly kind: "c15t.vendor-manifest";
|
|
37
|
+
readonly schemaVersion: 1;
|
|
38
|
+
};
|
|
39
|
+
export interface UmamiAnalyticsOptions {
|
|
40
|
+
/**
|
|
41
|
+
* Your Umami website ID.
|
|
42
|
+
*/
|
|
43
|
+
websiteId: string;
|
|
44
|
+
/**
|
|
45
|
+
* Override the host that receives analytics events.
|
|
46
|
+
*/
|
|
47
|
+
hostUrl?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Disable automatic tracking when set to `false`.
|
|
50
|
+
*/
|
|
51
|
+
autoTrack?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Restrict tracking to specific domains.
|
|
54
|
+
*/
|
|
55
|
+
domains?: string[] | string;
|
|
56
|
+
/**
|
|
57
|
+
* Attach a tag to tracked events.
|
|
58
|
+
*/
|
|
59
|
+
tag?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Optional global hook name used for Umami's `data-before-send` attribute.
|
|
62
|
+
*
|
|
63
|
+
* Callback functions are intentionally not supported here because the c15t
|
|
64
|
+
* manifest runtime cannot serialize custom JavaScript functions.
|
|
65
|
+
*/
|
|
66
|
+
beforeSend?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Custom loader URL.
|
|
69
|
+
* @default 'https://cloud.umami.is/script.js'
|
|
70
|
+
*/
|
|
71
|
+
scriptUrl?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates an Umami Analytics script.
|
|
75
|
+
*
|
|
76
|
+
* @see https://umami.is/docs/tracker-config
|
|
77
|
+
*
|
|
78
|
+
* @param options - The options for the Umami Analytics script.
|
|
79
|
+
* @returns The Umami Analytics script.
|
|
80
|
+
* @throws {Error} When `websiteId` is missing, empty, or invalid. Provide a
|
|
81
|
+
* valid non-empty `websiteId` string to prevent this error.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { umamiAnalytics } from '@c15t/scripts/umami-analytics';
|
|
86
|
+
*
|
|
87
|
+
* umamiAnalytics({
|
|
88
|
+
* websiteId: 'site-abc-123',
|
|
89
|
+
* domains: ['example.com', 'www.example.com'],
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function umamiAnalytics(options: UmamiAnalyticsOptions): Script;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
export type VercelAnalyticsMode = 'auto' | 'development' | 'production';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
va?: (event: string, properties?: unknown) => void;
|
|
6
|
+
vaq?: [string, unknown?][];
|
|
7
|
+
vam?: 'development' | 'production';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Vercel Analytics vendor manifest.
|
|
12
|
+
*
|
|
13
|
+
* Seeds Vercel's event queue before loading the tracker bundle.
|
|
14
|
+
*/
|
|
15
|
+
export declare const vercelAnalyticsManifest: {
|
|
16
|
+
readonly vendor: "vercel-analytics";
|
|
17
|
+
readonly category: "measurement";
|
|
18
|
+
readonly bootstrap: [{
|
|
19
|
+
readonly type: "setGlobal";
|
|
20
|
+
readonly name: "vaq";
|
|
21
|
+
readonly value: readonly [];
|
|
22
|
+
readonly ifUndefined: true;
|
|
23
|
+
}, {
|
|
24
|
+
readonly type: "defineStubFunction";
|
|
25
|
+
readonly name: "va";
|
|
26
|
+
readonly queue: {
|
|
27
|
+
readonly global: "vaq";
|
|
28
|
+
};
|
|
29
|
+
readonly queueFormat: "array";
|
|
30
|
+
readonly ifUndefined: true;
|
|
31
|
+
}];
|
|
32
|
+
readonly install: [{
|
|
33
|
+
readonly type: "loadScript";
|
|
34
|
+
readonly src: "{{scriptUrl}}";
|
|
35
|
+
readonly defer: true;
|
|
36
|
+
readonly attributes: {
|
|
37
|
+
readonly 'data-sdkn': "c15t";
|
|
38
|
+
readonly 'data-dsn': "{{dsn}}";
|
|
39
|
+
readonly 'data-disable-auto-track': "{{disableAutoTrackAttribute}}";
|
|
40
|
+
readonly 'data-endpoint': "{{endpoint}}";
|
|
41
|
+
};
|
|
42
|
+
}];
|
|
43
|
+
readonly kind: "c15t.vendor-manifest";
|
|
44
|
+
readonly schemaVersion: 1;
|
|
45
|
+
};
|
|
46
|
+
export interface VercelAnalyticsOptions {
|
|
47
|
+
/** Project DSN for self-hosted or non-Vercel deployments. */
|
|
48
|
+
dsn?: string;
|
|
49
|
+
/** Disable automatic pageview tracking. */
|
|
50
|
+
disableAutoTrack?: boolean;
|
|
51
|
+
/** Preferred script mode. */
|
|
52
|
+
mode?: VercelAnalyticsMode;
|
|
53
|
+
/** Load Vercel's debug bundle when set to `true`. */
|
|
54
|
+
debug?: boolean;
|
|
55
|
+
/** Custom ingestion endpoint. */
|
|
56
|
+
endpoint?: string;
|
|
57
|
+
/** Custom loader URL. */
|
|
58
|
+
scriptUrl?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a Vercel Analytics script.
|
|
62
|
+
*
|
|
63
|
+
* @param options - The options for the Vercel Analytics script.
|
|
64
|
+
* @returns The Vercel Analytics script.
|
|
65
|
+
*/
|
|
66
|
+
export declare function vercelAnalytics(options?: VercelAnalyticsOptions): Script;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
$crisp: unknown[][];
|
|
5
|
+
CRISP_WEBSITE_ID: string;
|
|
6
|
+
CRISP_RUNTIME_CONFIG?: {
|
|
7
|
+
locale?: string;
|
|
8
|
+
session_merge?: boolean;
|
|
9
|
+
};
|
|
10
|
+
CRISP_COOKIE_DOMAIN?: string;
|
|
11
|
+
CRISP_COOKIE_EXPIRE?: number;
|
|
12
|
+
CRISP_TOKEN_ID?: string;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Crisp vendor manifest.
|
|
17
|
+
*
|
|
18
|
+
* Seeds the Crisp queue and website ID before loading the chat client.
|
|
19
|
+
* Optional runtime globals are added when provided by the helper options.
|
|
20
|
+
*/
|
|
21
|
+
export declare const crispManifest: {
|
|
22
|
+
readonly vendor: "crisp";
|
|
23
|
+
readonly category: "functionality";
|
|
24
|
+
readonly install: [{
|
|
25
|
+
readonly type: "setGlobal";
|
|
26
|
+
readonly name: "$crisp";
|
|
27
|
+
readonly value: readonly [];
|
|
28
|
+
readonly ifUndefined: false;
|
|
29
|
+
}, {
|
|
30
|
+
readonly type: "setGlobal";
|
|
31
|
+
readonly name: "CRISP_WEBSITE_ID";
|
|
32
|
+
readonly value: "{{websiteId}}";
|
|
33
|
+
readonly ifUndefined: false;
|
|
34
|
+
}, {
|
|
35
|
+
readonly type: "loadScript";
|
|
36
|
+
readonly src: "{{scriptSrc}}";
|
|
37
|
+
readonly async: true;
|
|
38
|
+
}];
|
|
39
|
+
readonly kind: "c15t.vendor-manifest";
|
|
40
|
+
readonly schemaVersion: 1;
|
|
41
|
+
};
|
|
42
|
+
export interface CrispOptions {
|
|
43
|
+
/** Your Crisp website ID. */
|
|
44
|
+
websiteId: string;
|
|
45
|
+
/** Optional locale passed through `window.CRISP_RUNTIME_CONFIG`. */
|
|
46
|
+
locale?: string;
|
|
47
|
+
/** Optional cookie domain override for Crisp. */
|
|
48
|
+
cookieDomain?: string;
|
|
49
|
+
/** Optional cookie expiration in seconds. */
|
|
50
|
+
cookieExpiry?: number;
|
|
51
|
+
/** Optional Crisp token ID for session continuity. */
|
|
52
|
+
tokenId?: string;
|
|
53
|
+
/** Whether to merge anonymous sessions into token-backed sessions. */
|
|
54
|
+
sessionMerge?: boolean;
|
|
55
|
+
/** Whether to enable `$crisp` safe mode before other queued calls. */
|
|
56
|
+
safeMode?: boolean;
|
|
57
|
+
/** Crisp loader URL. */
|
|
58
|
+
scriptSrc?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a Crisp chat script.
|
|
62
|
+
*
|
|
63
|
+
* This manifest-based helper keeps the serializable queue/bootstrap globals and
|
|
64
|
+
* omits the upstream ready callback wrapper.
|
|
65
|
+
*
|
|
66
|
+
* @param options - The options for the Crisp script.
|
|
67
|
+
* @returns The Crisp script configuration.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const crispScript = crisp({
|
|
72
|
+
* websiteId: '1234-abcd',
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @see {@link https://help.crisp.chat/en/article/how-do-i-install-crisp-live-chat-on-my-website-10wcj3l/} Crisp installation documentation.
|
|
77
|
+
*/
|
|
78
|
+
export declare function crisp(options: CrispOptions): Script;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
export declare const INTERCOM_API_BASES: {
|
|
3
|
+
readonly us: "https://api-iam.intercom.io";
|
|
4
|
+
readonly eu: "https://api-iam.eu.intercom.io";
|
|
5
|
+
readonly au: "https://api-iam.au.intercom.io";
|
|
6
|
+
};
|
|
7
|
+
export type IntercomApiBase = (typeof INTERCOM_API_BASES)[keyof typeof INTERCOM_API_BASES] | (string & {});
|
|
8
|
+
export type IntercomThemeMode = 'light' | 'dark' | 'system';
|
|
9
|
+
export interface IntercomAvatar {
|
|
10
|
+
type: 'avatar';
|
|
11
|
+
image_url: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IntercomCompany {
|
|
14
|
+
id?: string;
|
|
15
|
+
company_id?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
created_at?: number;
|
|
18
|
+
remote_created_at?: number;
|
|
19
|
+
plan?: string;
|
|
20
|
+
monthly_spend?: number;
|
|
21
|
+
size?: number;
|
|
22
|
+
website?: string;
|
|
23
|
+
industry?: string;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
export interface IntercomSettings extends Record<string, unknown> {
|
|
27
|
+
app_id: string;
|
|
28
|
+
api_base: IntercomApiBase;
|
|
29
|
+
custom_launcher_selector?: string;
|
|
30
|
+
alignment?: 'left' | 'right';
|
|
31
|
+
vertical_padding?: number;
|
|
32
|
+
horizontal_padding?: number;
|
|
33
|
+
z_index?: number;
|
|
34
|
+
hide_default_launcher?: boolean;
|
|
35
|
+
hide_notifications?: boolean;
|
|
36
|
+
theme_mode?: IntercomThemeMode;
|
|
37
|
+
session_duration?: number;
|
|
38
|
+
action_color?: string;
|
|
39
|
+
background_color?: string;
|
|
40
|
+
link_color?: string;
|
|
41
|
+
email?: string;
|
|
42
|
+
user_id?: string;
|
|
43
|
+
created_at?: number;
|
|
44
|
+
name?: string;
|
|
45
|
+
phone?: string;
|
|
46
|
+
unsubscribed_from_emails?: boolean;
|
|
47
|
+
language_override?: string;
|
|
48
|
+
utm_campaign?: string;
|
|
49
|
+
utm_content?: string;
|
|
50
|
+
utm_medium?: string;
|
|
51
|
+
utm_source?: string;
|
|
52
|
+
utm_term?: string;
|
|
53
|
+
avatar?: IntercomAvatar;
|
|
54
|
+
user_hash?: string;
|
|
55
|
+
company?: IntercomCompany;
|
|
56
|
+
companies?: IntercomCompany[];
|
|
57
|
+
page_title?: string;
|
|
58
|
+
}
|
|
59
|
+
export type IntercomCustomSettings = Partial<Omit<IntercomSettings, 'app_id' | 'api_base'>> & Record<string, unknown>;
|
|
60
|
+
declare global {
|
|
61
|
+
interface Window {
|
|
62
|
+
Intercom?: ((...args: unknown[]) => void) & {
|
|
63
|
+
q?: unknown[][];
|
|
64
|
+
};
|
|
65
|
+
intercomSettings?: IntercomSettings;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Intercom vendor manifest.
|
|
70
|
+
*
|
|
71
|
+
* Seeds `window.intercomSettings` and a queueing `Intercom` stub before loading
|
|
72
|
+
* the messenger widget bundle.
|
|
73
|
+
*/
|
|
74
|
+
export declare const intercomManifest: {
|
|
75
|
+
readonly vendor: "intercom";
|
|
76
|
+
readonly category: "functionality";
|
|
77
|
+
readonly install: [{
|
|
78
|
+
readonly type: "defineStubFunction";
|
|
79
|
+
readonly name: "Intercom";
|
|
80
|
+
readonly queue: {
|
|
81
|
+
readonly property: "q";
|
|
82
|
+
};
|
|
83
|
+
readonly queueFormat: "array";
|
|
84
|
+
readonly ifUndefined: true;
|
|
85
|
+
}, {
|
|
86
|
+
readonly type: "setGlobal";
|
|
87
|
+
readonly name: "intercomSettings";
|
|
88
|
+
readonly value: "{{settings}}";
|
|
89
|
+
readonly ifUndefined: false;
|
|
90
|
+
}, {
|
|
91
|
+
readonly type: "loadScript";
|
|
92
|
+
readonly src: "{{scriptSrc}}";
|
|
93
|
+
readonly async: true;
|
|
94
|
+
}];
|
|
95
|
+
readonly kind: "c15t.vendor-manifest";
|
|
96
|
+
readonly schemaVersion: 1;
|
|
97
|
+
};
|
|
98
|
+
export interface IntercomOptions {
|
|
99
|
+
/**
|
|
100
|
+
* Your Intercom app ID.
|
|
101
|
+
*/
|
|
102
|
+
appId: string;
|
|
103
|
+
/**
|
|
104
|
+
* Regional Intercom API base.
|
|
105
|
+
*
|
|
106
|
+
* @default 'https://api-iam.intercom.io'
|
|
107
|
+
*/
|
|
108
|
+
apiBase?: IntercomApiBase;
|
|
109
|
+
/**
|
|
110
|
+
* Additional serializable Intercom settings merged into
|
|
111
|
+
* `window.intercomSettings`.
|
|
112
|
+
*/
|
|
113
|
+
settings?: IntercomCustomSettings;
|
|
114
|
+
/** Intercom loader URL. */
|
|
115
|
+
scriptSrc?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Creates an Intercom messenger script.
|
|
119
|
+
*
|
|
120
|
+
* The helper bootstraps the documented Intercom settings object and queues
|
|
121
|
+
* early `Intercom(...)` calls until the messenger bundle loads.
|
|
122
|
+
*
|
|
123
|
+
* @param options - The options for the Intercom script.
|
|
124
|
+
* @returns The Intercom script configuration.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const intercomScript = intercom({
|
|
129
|
+
* appId: 'abc123',
|
|
130
|
+
* });
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @see {@link https://developers.intercom.com/installing-intercom/web/installation} Intercom installation documentation.
|
|
134
|
+
*/
|
|
135
|
+
export declare function intercom({ appId, apiBase, settings, scriptSrc, }: IntercomOptions): Script;
|
|
@@ -32,7 +32,10 @@ export declare const googleTagManagerManifest: {
|
|
|
32
32
|
readonly type: "pushToQueue";
|
|
33
33
|
readonly queue: "dataLayer";
|
|
34
34
|
readonly value: {
|
|
35
|
-
readonly 'gtm.start':
|
|
35
|
+
readonly 'gtm.start': {
|
|
36
|
+
readonly kind: "c15t.runtime-value";
|
|
37
|
+
readonly value: "timestamp";
|
|
38
|
+
};
|
|
36
39
|
readonly event: "gtm.js";
|
|
37
40
|
};
|
|
38
41
|
}, {
|
|
@@ -45,13 +48,7 @@ export declare const googleTagManagerManifest: {
|
|
|
45
48
|
readonly global: "gtag";
|
|
46
49
|
readonly args: ["event", "{{updateEventName}}"];
|
|
47
50
|
}];
|
|
48
|
-
readonly consentMapping:
|
|
49
|
-
readonly necessary: ["security_storage"];
|
|
50
|
-
readonly functionality: ["functionality_storage"];
|
|
51
|
-
readonly measurement: ["analytics_storage"];
|
|
52
|
-
readonly marketing: ["ad_storage", "ad_user_data", "ad_personalization"];
|
|
53
|
-
readonly experience: ["personalization_storage"];
|
|
54
|
-
};
|
|
51
|
+
readonly consentMapping: Record<string, string[]>;
|
|
55
52
|
readonly consentSignal: "gtag";
|
|
56
53
|
readonly kind: "c15t.vendor-manifest";
|
|
57
54
|
readonly schemaVersion: 1;
|