@c15t/scripts 2.0.1 → 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.
Files changed (106) hide show
  1. package/README.md +9 -9
  2. package/dist/engine/runtime.cjs +11 -0
  3. package/dist/engine/runtime.js +11 -0
  4. package/dist/registry.cjs +338 -0
  5. package/dist/registry.js +292 -0
  6. package/dist/types.cjs +18 -0
  7. package/dist/types.js +10 -1
  8. package/dist/vendors/_shared/attributes.cjs +51 -0
  9. package/dist/vendors/_shared/attributes.js +14 -0
  10. package/dist/vendors/_shared/google-consent.cjs +64 -0
  11. package/dist/vendors/_shared/google-consent.js +27 -0
  12. package/dist/vendors/_shared/install-builders.cjs +55 -0
  13. package/dist/vendors/_shared/install-builders.js +21 -0
  14. package/dist/vendors/_shared/script-url.cjs +74 -0
  15. package/dist/vendors/_shared/script-url.js +28 -0
  16. package/dist/{linkedin-insights.cjs → vendors/ads-and-pixels/linkedin-insights.cjs} +2 -2
  17. package/dist/{linkedin-insights.js → vendors/ads-and-pixels/linkedin-insights.js} +2 -2
  18. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +202 -0
  19. package/dist/vendors/ads-and-pixels/meta-pixel.js +153 -0
  20. package/dist/{microsoft-uet.cjs → vendors/ads-and-pixels/microsoft-uet.cjs} +31 -14
  21. package/dist/{microsoft-uet.js → vendors/ads-and-pixels/microsoft-uet.js} +31 -14
  22. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +147 -0
  23. package/dist/vendors/ads-and-pixels/reddit-pixel.js +107 -0
  24. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +127 -0
  25. package/dist/vendors/ads-and-pixels/snapchat-pixel.js +87 -0
  26. package/dist/{tiktok-pixel.cjs → vendors/ads-and-pixels/tiktok-pixel.cjs} +2 -2
  27. package/dist/{tiktok-pixel.js → vendors/ads-and-pixels/tiktok-pixel.js} +2 -2
  28. package/dist/{x-pixel.cjs → vendors/ads-and-pixels/x-pixel.cjs} +6 -3
  29. package/dist/{x-pixel.js → vendors/ads-and-pixels/x-pixel.js} +6 -3
  30. package/dist/vendors/analytics/ahrefs-analytics.cjs +64 -0
  31. package/dist/vendors/analytics/ahrefs-analytics.js +27 -0
  32. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +69 -0
  33. package/dist/vendors/analytics/cloudflare-web-analytics.js +32 -0
  34. package/dist/{databuddy.cjs → vendors/analytics/databuddy.cjs} +3 -3
  35. package/dist/{databuddy.js → vendors/analytics/databuddy.js} +3 -3
  36. package/dist/vendors/analytics/fathom-analytics.cjs +72 -0
  37. package/dist/vendors/analytics/fathom-analytics.js +35 -0
  38. package/dist/{google-tag.cjs → vendors/analytics/google-tag.cjs} +7 -28
  39. package/dist/{google-tag.js → vendors/analytics/google-tag.js} +7 -28
  40. package/dist/vendors/analytics/hotjar.cjs +81 -0
  41. package/dist/vendors/analytics/hotjar.js +44 -0
  42. package/dist/vendors/analytics/matomo-analytics.cjs +228 -0
  43. package/dist/vendors/analytics/matomo-analytics.js +191 -0
  44. package/dist/vendors/analytics/microsoft-clarity.cjs +110 -0
  45. package/dist/vendors/analytics/microsoft-clarity.js +73 -0
  46. package/dist/vendors/analytics/mixpanel-analytics.cjs +119 -0
  47. package/dist/vendors/analytics/mixpanel-analytics.js +82 -0
  48. package/dist/vendors/analytics/plausible-analytics.cjs +118 -0
  49. package/dist/vendors/analytics/plausible-analytics.js +81 -0
  50. package/dist/{posthog.cjs → vendors/analytics/posthog.cjs} +69 -6
  51. package/dist/vendors/analytics/posthog.js +163 -0
  52. package/dist/vendors/analytics/promptwatch.cjs +66 -0
  53. package/dist/vendors/analytics/promptwatch.js +29 -0
  54. package/dist/vendors/analytics/rybbit-analytics.cjs +100 -0
  55. package/dist/vendors/analytics/rybbit-analytics.js +63 -0
  56. package/dist/vendors/analytics/segment.cjs +93 -0
  57. package/dist/vendors/analytics/segment.js +56 -0
  58. package/dist/vendors/analytics/umami-analytics.cjs +76 -0
  59. package/dist/vendors/analytics/umami-analytics.js +39 -0
  60. package/dist/vendors/analytics/vercel-analytics.cjs +90 -0
  61. package/dist/vendors/analytics/vercel-analytics.js +53 -0
  62. package/dist/vendors/functional/crisp.cjs +139 -0
  63. package/dist/vendors/functional/crisp.js +102 -0
  64. package/dist/vendors/functional/intercom.cjs +85 -0
  65. package/dist/vendors/functional/intercom.js +45 -0
  66. package/dist/{google-tag-manager.cjs → vendors/tag-managers/google-tag-manager.cjs} +6 -27
  67. package/dist/{google-tag-manager.js → vendors/tag-managers/google-tag-manager.js} +6 -27
  68. package/dist-types/__tests__/helpers.d.ts +141 -0
  69. package/dist-types/engine/runtime.d.ts +1 -1
  70. package/dist-types/registry.d.ts +368 -0
  71. package/dist-types/types.d.ts +13 -0
  72. package/dist-types/vendors/_shared/attributes.d.ts +35 -0
  73. package/dist-types/vendors/_shared/google-consent.d.ts +47 -0
  74. package/dist-types/vendors/_shared/install-builders.d.ts +30 -0
  75. package/dist-types/vendors/_shared/script-url.d.ts +75 -0
  76. package/dist-types/{linkedin-insights.d.ts → vendors/ads-and-pixels/linkedin-insights.d.ts} +22 -9
  77. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +289 -0
  78. package/dist-types/{microsoft-uet.d.ts → vendors/ads-and-pixels/microsoft-uet.d.ts} +21 -10
  79. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +211 -0
  80. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +171 -0
  81. package/dist-types/{tiktok-pixel.d.ts → vendors/ads-and-pixels/tiktok-pixel.d.ts} +20 -5
  82. package/dist-types/{x-pixel.d.ts → vendors/ads-and-pixels/x-pixel.d.ts} +21 -4
  83. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +62 -0
  84. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +67 -0
  85. package/dist-types/vendors/analytics/fathom-analytics.d.ts +90 -0
  86. package/dist-types/{google-tag.d.ts → vendors/analytics/google-tag.d.ts} +5 -8
  87. package/dist-types/vendors/analytics/hotjar.d.ts +73 -0
  88. package/dist-types/vendors/analytics/matomo-analytics.d.ts +41 -0
  89. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +86 -0
  90. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +101 -0
  91. package/dist-types/vendors/analytics/plausible-analytics.d.ts +122 -0
  92. package/dist-types/{posthog.d.ts → vendors/analytics/posthog.d.ts} +47 -5
  93. package/dist-types/vendors/analytics/promptwatch.d.ts +36 -0
  94. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +82 -0
  95. package/dist-types/vendors/analytics/segment.d.ts +158 -0
  96. package/dist-types/vendors/analytics/umami-analytics.d.ts +93 -0
  97. package/dist-types/vendors/analytics/vercel-analytics.d.ts +66 -0
  98. package/dist-types/vendors/functional/crisp.d.ts +78 -0
  99. package/dist-types/vendors/functional/intercom.d.ts +135 -0
  100. package/dist-types/{google-tag-manager.d.ts → vendors/tag-managers/google-tag-manager.d.ts} +5 -8
  101. package/package.json +165 -4
  102. package/dist/meta-pixel.cjs +0 -129
  103. package/dist/meta-pixel.js +0 -89
  104. package/dist/posthog.js +0 -100
  105. package/dist-types/meta-pixel.d.ts +0 -185
  106. /package/dist-types/{databuddy.d.ts → vendors/analytics/databuddy.d.ts} +0 -0
@@ -0,0 +1,368 @@
1
+ /**
2
+ * High-level product area for a built-in script integration.
3
+ *
4
+ * Used for discovery surfaces such as docs navigation and CLI grouping. This is
5
+ * intentionally separate from a manifest consent category.
6
+ */
7
+ export type IntegrationCategory = 'analytics' | 'ads-and-pixels' | 'functional' | 'tag-manager';
8
+ /**
9
+ * Consent bucket that a built-in integration maps to by default.
10
+ *
11
+ * These values mirror c15t's consent categories without importing core types, so
12
+ * the registry stays safe to consume from docs and CLI code.
13
+ */
14
+ export type IntegrationConsentCategory = 'necessary' | 'functionality' | 'experience' | 'measurement' | 'marketing';
15
+ /**
16
+ * Display metadata for an integration category.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const label = BUILT_IN_INTEGRATION_CATEGORIES[0]?.label;
21
+ * ```
22
+ */
23
+ export interface IntegrationCategoryEntry {
24
+ /** Stable category key used by registry entries. */
25
+ key: IntegrationCategory;
26
+ /** Human-readable label for display surfaces. */
27
+ label: string;
28
+ }
29
+ /**
30
+ * Identity and discovery metadata for a built-in script integration.
31
+ *
32
+ * All fields are required except `hint`, which is optional short help text for
33
+ * picker UIs. Do not add runtime behavior, disclosure metadata, or vendor
34
+ * implementation details here.
35
+ */
36
+ export interface IntegrationRegistryEntry {
37
+ /** Stable key used by tests and generated metadata. */
38
+ key: string;
39
+ /** Script id emitted by the resolved helper. */
40
+ vendor: string;
41
+ /** Human-readable integration name. */
42
+ label: string;
43
+ /** Optional short description for CLI or docs picker UIs. */
44
+ hint?: string;
45
+ /** Docs route slug for this integration. */
46
+ docsSlug: string;
47
+ /** Package subpath, e.g. `meta-pixel` for `@c15t/scripts/meta-pixel`. */
48
+ packageSubpath: string;
49
+ /** Product area used for grouping and discovery. */
50
+ integrationCategory: IntegrationCategory;
51
+ /** Default consent bucket expected from the generated script. */
52
+ consentCategory: IntegrationConsentCategory;
53
+ }
54
+ /**
55
+ * Canonical display list for built-in integration categories.
56
+ *
57
+ * Consumers should use this list for category labels and ordering instead of
58
+ * re-declaring category names.
59
+ */
60
+ export declare const BUILT_IN_INTEGRATION_CATEGORIES: readonly [{
61
+ readonly key: "analytics";
62
+ readonly label: "Analytics";
63
+ }, {
64
+ readonly key: "ads-and-pixels";
65
+ readonly label: "Ads & Pixels";
66
+ }, {
67
+ readonly key: "functional";
68
+ readonly label: "Functional";
69
+ }, {
70
+ readonly key: "tag-manager";
71
+ readonly label: "Tag Managers";
72
+ }];
73
+ /**
74
+ * Canonical identity catalog for built-in `@c15t/scripts` integrations.
75
+ *
76
+ * Adding a new built-in integration should add one row here so docs, tests, and
77
+ * the CLI can discover it from the same source.
78
+ */
79
+ export declare const builtInScriptIntegrations: readonly [{
80
+ readonly key: "googleTagManager";
81
+ readonly vendor: "google-tag-manager";
82
+ readonly label: "Google Tag Manager";
83
+ readonly hint: "GTM container script";
84
+ readonly docsSlug: "google-tag-manager";
85
+ readonly packageSubpath: "google-tag-manager";
86
+ readonly integrationCategory: "tag-manager";
87
+ readonly consentCategory: "necessary";
88
+ }, {
89
+ readonly key: "gtag";
90
+ readonly vendor: "gtag";
91
+ readonly label: "Google Tag (gtag.js)";
92
+ readonly hint: "Google Analytics 4";
93
+ readonly docsSlug: "google-tag";
94
+ readonly packageSubpath: "google-tag";
95
+ readonly integrationCategory: "analytics";
96
+ readonly consentCategory: "measurement";
97
+ }, {
98
+ readonly key: "ahrefsAnalytics";
99
+ readonly vendor: "ahrefs-analytics";
100
+ readonly label: "Ahrefs Analytics";
101
+ readonly hint: "Cookieless web analytics from Ahrefs";
102
+ readonly docsSlug: "ahrefs-analytics";
103
+ readonly packageSubpath: "ahrefs-analytics";
104
+ readonly integrationCategory: "analytics";
105
+ readonly consentCategory: "measurement";
106
+ }, {
107
+ readonly key: "cloudflareWebAnalytics";
108
+ readonly vendor: "cloudflare-web-analytics";
109
+ readonly label: "Cloudflare Web Analytics";
110
+ readonly hint: "Cookieless analytics from Cloudflare";
111
+ readonly docsSlug: "cloudflare-web-analytics";
112
+ readonly packageSubpath: "cloudflare-web-analytics";
113
+ readonly integrationCategory: "analytics";
114
+ readonly consentCategory: "measurement";
115
+ }, {
116
+ readonly key: "microsoft-clarity";
117
+ readonly vendor: "microsoft-clarity";
118
+ readonly label: "Microsoft Clarity";
119
+ readonly hint: "Session replay and heatmaps";
120
+ readonly docsSlug: "microsoft-clarity";
121
+ readonly packageSubpath: "microsoft-clarity";
122
+ readonly integrationCategory: "analytics";
123
+ readonly consentCategory: "measurement";
124
+ }, {
125
+ readonly key: "databuddy";
126
+ readonly vendor: "databuddy";
127
+ readonly label: "Databuddy";
128
+ readonly hint: "Data collection";
129
+ readonly docsSlug: "databuddy";
130
+ readonly packageSubpath: "databuddy";
131
+ readonly integrationCategory: "analytics";
132
+ readonly consentCategory: "measurement";
133
+ }, {
134
+ readonly key: "fathomAnalytics";
135
+ readonly vendor: "fathom-analytics";
136
+ readonly label: "Fathom Analytics";
137
+ readonly hint: "Privacy-friendly cookieless analytics";
138
+ readonly docsSlug: "fathom-analytics";
139
+ readonly packageSubpath: "fathom-analytics";
140
+ readonly integrationCategory: "analytics";
141
+ readonly consentCategory: "measurement";
142
+ }, {
143
+ readonly key: "mixpanelAnalytics";
144
+ readonly vendor: "mixpanel-analytics";
145
+ readonly label: "Mixpanel Analytics";
146
+ readonly hint: "Product analytics and funnels";
147
+ readonly docsSlug: "mixpanel-analytics";
148
+ readonly packageSubpath: "mixpanel-analytics";
149
+ readonly integrationCategory: "analytics";
150
+ readonly consentCategory: "measurement";
151
+ }, {
152
+ readonly key: "hotjar";
153
+ readonly vendor: "hotjar";
154
+ readonly label: "Hotjar";
155
+ readonly hint: "Heatmaps and session recordings";
156
+ readonly docsSlug: "hotjar";
157
+ readonly packageSubpath: "hotjar";
158
+ readonly integrationCategory: "analytics";
159
+ readonly consentCategory: "measurement";
160
+ }, {
161
+ readonly key: "matomoAnalytics";
162
+ readonly vendor: "matomo-analytics";
163
+ readonly label: "Matomo Analytics";
164
+ readonly hint: "Self-hosted privacy analytics";
165
+ readonly docsSlug: "matomo-analytics";
166
+ readonly packageSubpath: "matomo-analytics";
167
+ readonly integrationCategory: "analytics";
168
+ readonly consentCategory: "measurement";
169
+ }, {
170
+ readonly key: "posthog";
171
+ readonly vendor: "posthog";
172
+ readonly label: "PostHog";
173
+ readonly hint: "Product analytics";
174
+ readonly docsSlug: "posthog";
175
+ readonly packageSubpath: "posthog";
176
+ readonly integrationCategory: "analytics";
177
+ readonly consentCategory: "measurement";
178
+ }, {
179
+ readonly key: "promptwatch";
180
+ readonly vendor: "promptwatch";
181
+ readonly label: "Promptwatch";
182
+ readonly hint: "AI traffic analytics";
183
+ readonly docsSlug: "promptwatch";
184
+ readonly packageSubpath: "promptwatch";
185
+ readonly integrationCategory: "analytics";
186
+ readonly consentCategory: "measurement";
187
+ }, {
188
+ readonly key: "segment";
189
+ readonly vendor: "segment";
190
+ readonly label: "Segment";
191
+ readonly hint: "Customer data platform";
192
+ readonly docsSlug: "segment";
193
+ readonly packageSubpath: "segment";
194
+ readonly integrationCategory: "analytics";
195
+ readonly consentCategory: "measurement";
196
+ }, {
197
+ readonly key: "rybbitAnalytics";
198
+ readonly vendor: "rybbit-analytics";
199
+ readonly label: "Rybbit Analytics";
200
+ readonly hint: "Privacy-friendly web analytics";
201
+ readonly docsSlug: "rybbit-analytics";
202
+ readonly packageSubpath: "rybbit-analytics";
203
+ readonly integrationCategory: "analytics";
204
+ readonly consentCategory: "measurement";
205
+ }, {
206
+ readonly key: "plausibleAnalytics";
207
+ readonly vendor: "plausible-analytics";
208
+ readonly label: "Plausible Analytics";
209
+ readonly hint: "Privacy-friendly cookieless analytics";
210
+ readonly docsSlug: "plausible-analytics";
211
+ readonly packageSubpath: "plausible-analytics";
212
+ readonly integrationCategory: "analytics";
213
+ readonly consentCategory: "measurement";
214
+ }, {
215
+ readonly key: "umamiAnalytics";
216
+ readonly vendor: "umami-analytics";
217
+ readonly label: "Umami Analytics";
218
+ readonly hint: "Open-source cookieless analytics";
219
+ readonly docsSlug: "umami-analytics";
220
+ readonly packageSubpath: "umami-analytics";
221
+ readonly integrationCategory: "analytics";
222
+ readonly consentCategory: "measurement";
223
+ }, {
224
+ readonly key: "vercelAnalytics";
225
+ readonly vendor: "vercel-analytics";
226
+ readonly label: "Vercel Analytics";
227
+ readonly hint: "Vercel web analytics";
228
+ readonly docsSlug: "vercel-analytics";
229
+ readonly packageSubpath: "vercel-analytics";
230
+ readonly integrationCategory: "analytics";
231
+ readonly consentCategory: "measurement";
232
+ }, {
233
+ readonly key: "crisp";
234
+ readonly vendor: "crisp";
235
+ readonly label: "Crisp";
236
+ readonly hint: "Live chat widget";
237
+ readonly docsSlug: "crisp";
238
+ readonly packageSubpath: "crisp";
239
+ readonly integrationCategory: "functional";
240
+ readonly consentCategory: "functionality";
241
+ }, {
242
+ readonly key: "intercom";
243
+ readonly vendor: "intercom";
244
+ readonly label: "Intercom";
245
+ readonly hint: "Messenger and live chat widget";
246
+ readonly docsSlug: "intercom";
247
+ readonly packageSubpath: "intercom";
248
+ readonly integrationCategory: "functional";
249
+ readonly consentCategory: "functionality";
250
+ }, {
251
+ readonly key: "metaPixel";
252
+ readonly vendor: "meta-pixel";
253
+ readonly label: "Meta Pixel";
254
+ readonly hint: "Facebook/Instagram tracking";
255
+ readonly docsSlug: "meta-pixel";
256
+ readonly packageSubpath: "meta-pixel";
257
+ readonly integrationCategory: "ads-and-pixels";
258
+ readonly consentCategory: "marketing";
259
+ }, {
260
+ readonly key: "redditPixel";
261
+ readonly vendor: "reddit-pixel";
262
+ readonly label: "Reddit Pixel";
263
+ readonly hint: "Reddit ads tracking";
264
+ readonly docsSlug: "reddit-pixel";
265
+ readonly packageSubpath: "reddit-pixel";
266
+ readonly integrationCategory: "ads-and-pixels";
267
+ readonly consentCategory: "marketing";
268
+ }, {
269
+ readonly key: "tiktokPixel";
270
+ readonly vendor: "tiktok-pixel";
271
+ readonly label: "TikTok Pixel";
272
+ readonly hint: "TikTok ads tracking";
273
+ readonly docsSlug: "tiktok-pixel";
274
+ readonly packageSubpath: "tiktok-pixel";
275
+ readonly integrationCategory: "ads-and-pixels";
276
+ readonly consentCategory: "marketing";
277
+ }, {
278
+ readonly key: "linkedinInsights";
279
+ readonly vendor: "linkedin-insights";
280
+ readonly label: "LinkedIn Insight Tag";
281
+ readonly hint: "LinkedIn conversion tracking";
282
+ readonly docsSlug: "linkedin-insights";
283
+ readonly packageSubpath: "linkedin-insights";
284
+ readonly integrationCategory: "ads-and-pixels";
285
+ readonly consentCategory: "marketing";
286
+ }, {
287
+ readonly key: "microsoftUet";
288
+ readonly vendor: "microsoft-uet";
289
+ readonly label: "Microsoft UET";
290
+ readonly hint: "Bing Ads tracking";
291
+ readonly docsSlug: "microsoft-uet";
292
+ readonly packageSubpath: "microsoft-uet";
293
+ readonly integrationCategory: "ads-and-pixels";
294
+ readonly consentCategory: "marketing";
295
+ }, {
296
+ readonly key: "snapchatPixel";
297
+ readonly vendor: "snapchat-pixel";
298
+ readonly label: "Snapchat Pixel";
299
+ readonly hint: "Snapchat ads tracking";
300
+ readonly docsSlug: "snapchat-pixel";
301
+ readonly packageSubpath: "snapchat-pixel";
302
+ readonly integrationCategory: "ads-and-pixels";
303
+ readonly consentCategory: "marketing";
304
+ }, {
305
+ readonly key: "xPixel";
306
+ readonly vendor: "x-pixel";
307
+ readonly label: "X (Twitter) Pixel";
308
+ readonly hint: "X/Twitter conversion tracking";
309
+ readonly docsSlug: "x-pixel";
310
+ readonly packageSubpath: "x-pixel";
311
+ readonly integrationCategory: "ads-and-pixels";
312
+ readonly consentCategory: "marketing";
313
+ }];
314
+ /**
315
+ * Concrete registry entry type inferred from `builtInScriptIntegrations`.
316
+ */
317
+ export type BuiltInScriptIntegration = (typeof builtInScriptIntegrations)[number];
318
+ /**
319
+ * Union of stable keys for built-in integrations.
320
+ */
321
+ export type BuiltInScriptIntegrationKey = BuiltInScriptIntegration['key'];
322
+ /**
323
+ * Union of public package subpaths for built-in integrations.
324
+ */
325
+ export type BuiltInScriptIntegrationSubpath = BuiltInScriptIntegration['packageSubpath'];
326
+ /**
327
+ * Looks up a built-in integration by its registry key.
328
+ *
329
+ * @param key - Stable integration key.
330
+ * @returns The matching built-in integration entry.
331
+ * @throws `Error("Unknown built-in script integration: <key>")` when the key is
332
+ * not present. Catch this when accepting untrusted or user-provided keys.
333
+ *
334
+ * @example
335
+ * ```ts
336
+ * const integration = getBuiltInScriptIntegration('metaPixel');
337
+ * console.log(integration.packageSubpath); // "meta-pixel"
338
+ * ```
339
+ */
340
+ export declare function getBuiltInScriptIntegration(key: BuiltInScriptIntegrationKey): BuiltInScriptIntegration;
341
+ /**
342
+ * Finds a built-in integration by its public package subpath.
343
+ *
344
+ * @param subpath - Kebab-case subpath such as `google-tag`.
345
+ * @returns The matching integration, or `undefined` when no entry matches.
346
+ *
347
+ * @example
348
+ * ```ts
349
+ * const integration = getBuiltInScriptIntegrationBySubpath('meta-pixel');
350
+ * console.log(integration?.label); // "Meta Pixel"
351
+ * ```
352
+ */
353
+ export declare function getBuiltInScriptIntegrationBySubpath(subpath: string): BuiltInScriptIntegration | undefined;
354
+ /**
355
+ * Finds a built-in integration by the emitted script vendor id.
356
+ *
357
+ * Use this to connect a resolved manifest/script id back to registry metadata.
358
+ *
359
+ * @param vendor - Vendor id emitted as `Script.id`.
360
+ * @returns The matching integration, or `undefined` when no entry matches.
361
+ *
362
+ * @example
363
+ * ```ts
364
+ * const integration = getBuiltInScriptIntegrationByVendor('google-tag-manager');
365
+ * console.log(integration?.label); // "Google Tag Manager"
366
+ * ```
367
+ */
368
+ export declare function getBuiltInScriptIntegrationByVendor(vendor: string): BuiltInScriptIntegration | undefined;
@@ -5,6 +5,19 @@ export declare const vendorManifestContract: {
5
5
  readonly kind: "c15t.vendor-manifest";
6
6
  readonly schemaVersion: 1;
7
7
  };
8
+ export declare const RUNTIME_VALUE_KIND = "c15t.runtime-value";
9
+ export interface RuntimeValue {
10
+ kind: typeof RUNTIME_VALUE_KIND;
11
+ value: 'date' | 'timestamp';
12
+ }
13
+ export declare const runtimeDateValue: {
14
+ readonly kind: "c15t.runtime-value";
15
+ readonly value: "date";
16
+ };
17
+ export declare const runtimeTimestampValue: {
18
+ readonly kind: "c15t.runtime-value";
19
+ readonly value: "timestamp";
20
+ };
8
21
  export interface ManifestContract {
9
22
  kind: typeof VENDOR_MANIFEST_KIND;
10
23
  schemaVersion: typeof VENDOR_MANIFEST_SCHEMA_VERSION;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Converts an optional boolean into a string suitable for a script `data-*`
3
+ * attribute.
4
+ *
5
+ * @param value - Optional boolean value from a vendor option.
6
+ * @returns `'true'` or `'false'` when a boolean is provided, otherwise
7
+ * `undefined` so the manifest compiler can omit the attribute.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * booleanDataAttribute(true); // 'true'
12
+ * booleanDataAttribute(false); // 'false'
13
+ * booleanDataAttribute(undefined); // undefined
14
+ * ```
15
+ */
16
+ export declare function booleanDataAttribute(value: boolean | undefined): string | undefined;
17
+ /**
18
+ * Converts a string or string list into a script `data-*` attribute value.
19
+ *
20
+ * Arrays are JSON-serialized so values containing commas can be round-tripped
21
+ * with `JSON.parse` by consumers that read the attribute.
22
+ *
23
+ * @param value - Optional string value or string list from a vendor option.
24
+ * @returns The original string, a JSON-serialized array, or `undefined` so the
25
+ * manifest compiler can omit the attribute.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * listDataAttribute('example.com'); // 'example.com'
30
+ * listDataAttribute(['a.com', 'b.com']); // '["a.com","b.com"]'
31
+ * listDataAttribute([]); // undefined
32
+ * listDataAttribute(undefined); // undefined
33
+ * ```
34
+ */
35
+ export declare function listDataAttribute(value: string[] | string | undefined): string | undefined;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Default c15t consent category mapping for Google Consent Mode v2.
3
+ *
4
+ * @remarks
5
+ * Shared by direct gtag.js and Google Tag Manager integrations so both emit the
6
+ * same Google storage consent defaults unless a caller provides an override.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const manifest = {
11
+ * consentMapping: GOOGLE_CONSENT_MODE_V2_DEFAULT_MAPPING,
12
+ * };
13
+ * ```
14
+ */
15
+ export declare const GOOGLE_CONSENT_MODE_V2_DEFAULT_MAPPING: Record<string, string[]>;
16
+ /**
17
+ * Applies an optional Google consent mapping override to a manifest.
18
+ *
19
+ * @param manifest - Vendor manifest that already contains the default consent
20
+ * mapping.
21
+ * @param consentMapping - Optional caller-provided mapping from c15t consent
22
+ * categories to Google consent types.
23
+ * @returns The original manifest when no override is provided, or a shallow
24
+ * copy with the override mapping when one is provided.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const customMapping: Record<string, string[]> = {
29
+ * marketing: ['ad_storage'],
30
+ * };
31
+ * const mapped = withOptionalConsentMapping<TManifest>(
32
+ * manifest,
33
+ * customMapping
34
+ * );
35
+ * ```
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const unchanged = withOptionalConsentMapping<TManifest>(
40
+ * manifest,
41
+ * undefined
42
+ * );
43
+ * ```
44
+ */
45
+ export declare function withOptionalConsentMapping<TManifest extends {
46
+ consentMapping?: Record<string, string[]>;
47
+ }>(manifest: TManifest, consentMapping: Record<string, string[]> | undefined): TManifest;
@@ -0,0 +1,30 @@
1
+ import type { VendorManifest } from '../../types';
2
+ /**
3
+ * Optional tracking call inserted between the vendor init call and script load.
4
+ */
5
+ interface QueuePixelInstallStep {
6
+ /** Arguments passed to the vendor queue function. */
7
+ args: unknown[];
8
+ }
9
+ /**
10
+ * Options for building the common pixel install sequence.
11
+ */
12
+ export interface BuildQueuePixelInstallOptions {
13
+ /** Global queue function to call, for example `rdt` or `snaptr`. */
14
+ global: string;
15
+ /** Arguments for the required initialization call. */
16
+ initArgs: unknown[];
17
+ /** Optional tracking command queued immediately after initialization. */
18
+ trackStep?: QueuePixelInstallStep;
19
+ /** Manifest interpolation token used for the final loader script URL. */
20
+ scriptPlaceholder?: string;
21
+ }
22
+ /**
23
+ * Builds the common queue-pixel install sequence used by advertising pixels.
24
+ *
25
+ * @param options - Queue pixel install options.
26
+ * @returns Manifest install steps containing the required init call, an
27
+ * optional tracking call, and an async `loadScript` step.
28
+ */
29
+ export declare function buildQueuePixelInstall({ global, initArgs, trackStep, scriptPlaceholder, }: BuildQueuePixelInstallOptions): VendorManifest['install'];
30
+ export {};
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Trims an optional string and treats empty or whitespace-only values as
3
+ * missing.
4
+ *
5
+ * @param value - Optional string value, usually a user-provided override.
6
+ * @returns The trimmed string when it contains non-whitespace characters,
7
+ * otherwise `undefined`.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * trimToUndefined(' https://cdn.example.com '); // 'https://cdn.example.com'
12
+ * trimToUndefined(' '); // undefined
13
+ * trimToUndefined(undefined); // undefined
14
+ * ```
15
+ */
16
+ export declare function trimToUndefined(value: string | undefined): string | undefined;
17
+ /**
18
+ * Resolves a script URL from an optional override and a required fallback.
19
+ *
20
+ * @param override - Explicit script URL supplied by the integration caller.
21
+ * @param fallback - Default vendor script URL.
22
+ * @returns `override` when it is defined, otherwise `fallback`.
23
+ *
24
+ * @remarks
25
+ * This helper intentionally does not trim or validate the override. Use
26
+ * `trimToUndefined` before calling this helper when blank string overrides
27
+ * should fall back to the vendor default.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * resolveScriptUrl(undefined, 'https://cdn.example.com/default.js');
32
+ * // 'https://cdn.example.com/default.js'
33
+ * ```
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * resolveScriptUrl(
38
+ * 'https://custom.com/script.js',
39
+ * 'https://cdn.example.com/default.js'
40
+ * );
41
+ * // 'https://custom.com/script.js'
42
+ * ```
43
+ */
44
+ export declare function resolveScriptUrl(override: string | undefined, fallback: string): string;
45
+ /**
46
+ * Removes leading slash characters without using a regular expression.
47
+ *
48
+ * This helper is used on caller-controlled URL fragments, so it intentionally
49
+ * stays linear even for very long repeated slash input.
50
+ */
51
+ export declare function stripLeadingSlashes(value: string): string;
52
+ /**
53
+ * Removes trailing slash characters without using a regular expression.
54
+ *
55
+ * This helper is used on caller-controlled URL fragments, so it intentionally
56
+ * stays linear even for very long repeated slash input.
57
+ */
58
+ export declare function stripTrailingSlashes(value: string): string;
59
+ /**
60
+ * Joins a base URL and path with exactly one slash between them.
61
+ *
62
+ * @param base - Base URL or origin. Trailing slashes are removed before joining.
63
+ * @param path - Path segment. Leading slashes are removed before joining.
64
+ * @returns A slash-joined URL string.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * joinUrlPath('https://example.com///', '///script.js');
69
+ * // 'https://example.com/script.js'
70
+ *
71
+ * joinUrlPath('https://example.com', 'script.js');
72
+ * // 'https://example.com/script.js'
73
+ * ```
74
+ */
75
+ export declare function joinUrlPath(base: string, path: string): string;
@@ -1,7 +1,15 @@
1
1
  import type { Script } from 'c15t';
2
+ export interface LinkedInInsightsConversionEvent {
3
+ conversion_id: string | number;
4
+ [key: string]: unknown;
5
+ }
6
+ type LinkedInInsightsFunction = {
7
+ (command: 'track', event: LinkedInInsightsConversionEvent): void;
8
+ (command: string, ...args: unknown[]): void;
9
+ };
2
10
  declare global {
3
11
  interface Window {
4
- lintrk: ((...args: unknown[]) => void) & {
12
+ lintrk: LinkedInInsightsFunction & {
5
13
  q?: unknown[][];
6
14
  };
7
15
  _linkedin_partner_id?: string;
@@ -14,9 +22,9 @@ declare global {
14
22
  }
15
23
  }
16
24
  /**
17
- * LinkedIn Insights vendor manifest.
25
+ * LinkedIn Insight Tag vendor manifest.
18
26
  *
19
- * Sets up the LinkedIn partner ID globals and loads the insights script
27
+ * Sets up the LinkedIn partner ID globals and loads the Insight Tag script
20
28
  * via structured startup steps.
21
29
  */
22
30
  export declare const linkedinInsightsManifest: {
@@ -54,18 +62,22 @@ export declare const linkedinInsightsManifest: {
54
62
  };
55
63
  export interface LinkedInInsightsOptions {
56
64
  /**
57
- * Your LinkedIn Insights ID
65
+ * Your LinkedIn Insight Tag partner ID.
66
+ *
67
+ * LinkedIn shows this in Campaign Manager under Data -> Signals manager ->
68
+ * Insight Tag.
69
+ *
58
70
  * @example `123456789012345`
59
71
  */
60
72
  id: string;
61
- /** LinkedIn Insights loader URL. */
73
+ /** LinkedIn Insight Tag loader URL. */
62
74
  scriptSrc?: string;
63
75
  }
64
76
  /**
65
- * LinkedIn Insights Script
77
+ * LinkedIn Insight Tag script.
66
78
  *
67
- * @param options - The options for the LinkedIn Insights script
68
- * @returns The LinkedIn Insights script configuration
79
+ * @param options - The options for the LinkedIn Insight Tag script.
80
+ * @returns The LinkedIn Insight Tag script configuration.
69
81
  *
70
82
  * @example
71
83
  * ```ts
@@ -74,6 +86,7 @@ export interface LinkedInInsightsOptions {
74
86
  * });
75
87
  * ```
76
88
  *
77
- * @see {@link https://business.linkedin.com/marketing-solutions/ad-libraries/insights} LinkedIn Insights documentation
89
+ * @see {@link https://www.linkedin.com/help/lms/answer/a418880} Add the LinkedIn Insight Tag to your website
78
90
  */
79
91
  export declare function linkedinInsights({ id, scriptSrc, }: LinkedInInsightsOptions): Script;
92
+ export {};