@c15t/scripts 2.0.0-rc.1 → 2.0.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 (59) hide show
  1. package/README.md +3 -3
  2. package/dist/databuddy.cjs +103 -48
  3. package/dist/databuddy.js +99 -47
  4. package/dist/engine/compile.cjs +126 -0
  5. package/dist/engine/compile.js +89 -0
  6. package/dist/engine/runtime.cjs +379 -0
  7. package/dist/engine/runtime.js +345 -0
  8. package/dist/google-tag-manager.cjs +78 -86
  9. package/dist/google-tag-manager.js +74 -79
  10. package/dist/google-tag.cjs +86 -37
  11. package/dist/google-tag.js +82 -36
  12. package/dist/linkedin-insights.cjs +51 -33
  13. package/dist/linkedin-insights.js +46 -31
  14. package/dist/meta-pixel.cjs +90 -28
  15. package/dist/meta-pixel.js +86 -27
  16. package/dist/microsoft-uet.cjs +90 -50
  17. package/dist/microsoft-uet.js +86 -49
  18. package/dist/posthog.cjs +100 -51
  19. package/dist/posthog.js +96 -50
  20. package/dist/resolve.cjs +67 -0
  21. package/dist/resolve.js +33 -0
  22. package/dist/tiktok-pixel.cjs +91 -29
  23. package/dist/tiktok-pixel.js +86 -27
  24. package/dist/types.cjs +47 -0
  25. package/dist/types.js +7 -0
  26. package/dist/x-pixel.cjs +48 -14
  27. package/dist/x-pixel.js +43 -12
  28. package/dist-types/databuddy.d.ts +144 -0
  29. package/dist-types/engine/compile.d.ts +3 -0
  30. package/dist-types/engine/runtime.d.ts +3 -0
  31. package/dist-types/engine.test.d.ts +1 -0
  32. package/dist-types/google-tag-manager.d.ts +97 -0
  33. package/dist-types/google-tag.d.ts +96 -0
  34. package/dist-types/helpers.test.d.ts +1 -0
  35. package/dist-types/linkedin-insights.d.ts +79 -0
  36. package/{dist → dist-types}/meta-pixel.d.ts +61 -14
  37. package/dist-types/microsoft-uet.d.ts +94 -0
  38. package/dist-types/posthog.d.ts +112 -0
  39. package/dist-types/resolve.d.ts +9 -0
  40. package/dist-types/tiktok-pixel.d.ts +91 -0
  41. package/dist-types/types.d.ts +259 -0
  42. package/{dist → dist-types}/x-pixel.d.ts +38 -12
  43. package/package.json +9 -8
  44. package/dist/databuddy.d.ts +0 -104
  45. package/dist/databuddy.d.ts.map +0 -1
  46. package/dist/google-tag-manager.d.ts +0 -63
  47. package/dist/google-tag-manager.d.ts.map +0 -1
  48. package/dist/google-tag.d.ts +0 -38
  49. package/dist/google-tag.d.ts.map +0 -1
  50. package/dist/linkedin-insights.d.ts +0 -48
  51. package/dist/linkedin-insights.d.ts.map +0 -1
  52. package/dist/meta-pixel.d.ts.map +0 -1
  53. package/dist/microsoft-uet.d.ts +0 -40
  54. package/dist/microsoft-uet.d.ts.map +0 -1
  55. package/dist/posthog.d.ts +0 -54
  56. package/dist/posthog.d.ts.map +0 -1
  57. package/dist/tiktok-pixel.d.ts +0 -44
  58. package/dist/tiktok-pixel.d.ts.map +0 -1
  59. package/dist/x-pixel.d.ts.map +0 -1
@@ -1,40 +0,0 @@
1
- import type { Script } from 'c15t';
2
- declare global {
3
- interface Window {
4
- uetq: unknown[] | undefined;
5
- }
6
- }
7
- export interface MicrosoftUetOptions {
8
- /**
9
- * Your Microsoft UET ID
10
- * @example `123456789012345`
11
- */
12
- id: string;
13
- /**
14
- * Override or extend the default script values.
15
- *
16
- * Default values:
17
- * - `id`: 'microsoft-uet'
18
- * - `src`: `//bat.bing.com/bat.js`
19
- * - `category`: 'marketing'
20
- */
21
- script?: Partial<Script>;
22
- }
23
- /**
24
- * Microsoft UET Script
25
- * This script is persistent after consent is revoked because it has built-in functionality to opt into and out of tracking based on consent, which allows us to not need to load the script again when consent is revoked.
26
- *
27
- * @param options - The options for the Microsoft UET script
28
- * @returns The Microsoft UET script configuration
29
- *
30
- * @example
31
- * ```ts
32
- * const microsoftUetScript = microsoftUet({
33
- * id: '123456789012345',
34
- * });
35
- * ```
36
- *
37
- * @see https://learn.microsoft.com/en-us/advertising/guides/universal-event-tracking?view=bingads-13
38
- */
39
- export declare function microsoftUet({ id, script }: MicrosoftUetOptions): Script;
40
- //# sourceMappingURL=microsoft-uet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"microsoft-uet.d.ts","sourceRoot":"","sources":["../src/microsoft-uet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,IAAI,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;KAC5B;CACD;AAED,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,mBAAmB,GAAG,MAAM,CAmExE"}
package/dist/posthog.d.ts DELETED
@@ -1,54 +0,0 @@
1
- import type { Script } from 'c15t';
2
- declare global {
3
- interface Window {
4
- posthog: {
5
- init: (token: string, options: {
6
- api_host: string;
7
- ui_host?: string;
8
- autocapture?: boolean;
9
- [key: string]: unknown;
10
- }) => void;
11
- opt_in_capturing: () => void;
12
- opt_out_capturing: () => void;
13
- get_explicit_consent_status: () => string;
14
- };
15
- }
16
- }
17
- export interface PosthogConsentOptions {
18
- /**
19
- * Your posthog id, begins with 'phc_'.
20
- */
21
- id: string;
22
- /**
23
- * Your posthog api host.
24
- * @default 'https://eu.i.posthog.com'
25
- */
26
- apiHost: string;
27
- /**
28
- * The defaults for the posthog script.
29
- */
30
- defaults: string;
31
- /**
32
- * Other optional options for the posthog script.
33
- * @example { person_profiles: 'identified_only' }
34
- */
35
- options: Record<string, unknown>;
36
- /**
37
- * Override or extend the default script values.
38
- *
39
- * Default values:
40
- * - `id`: 'posthog-consent'
41
- * - `category`: 'measurement'
42
- */
43
- script?: Partial<Script>;
44
- }
45
- /**
46
- * Loads the PostHog script and initializes it with the given options.
47
- * This uses posthog.opt_in_capturing() to opt in to capturing. And posthog.opt_out_capturing() to opt out of capturing.
48
- * @see https://posthog.com/docs/libraries/js#opt-in-capturing
49
- *
50
- * @param options - Optional configuration for the PostHog consent script
51
- * @returns The Posthog script
52
- */
53
- export declare function posthog(options: PosthogConsentOptions): Script;
54
- //# sourceMappingURL=posthog.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"posthog.d.ts","sourceRoot":"","sources":["../src/posthog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,OAAO,EAAE;YACR,IAAI,EAAE,CACL,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;gBACR,QAAQ,EAAE,MAAM,CAAC;gBACjB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,WAAW,CAAC,EAAE,OAAO,CAAC;gBACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;aACvB,KACG,IAAI,CAAC;YACV,gBAAgB,EAAE,MAAM,IAAI,CAAC;YAC7B,iBAAiB,EAAE,MAAM,IAAI,CAAC;YAC9B,2BAA2B,EAAE,MAAM,MAAM,CAAC;SAC1C,CAAC;KACF;CACD;AAED,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAkE9D"}
@@ -1,44 +0,0 @@
1
- import type { Script } from 'c15t';
2
- declare global {
3
- interface Window {
4
- ttq: {
5
- grantConsent: () => void;
6
- revokeConsent: () => void;
7
- page: () => void;
8
- };
9
- }
10
- }
11
- export interface TikTokPixelOptions {
12
- /**
13
- * Your TikTok Pixel ID
14
- * @example `123456789012345`
15
- */
16
- pixelId: string;
17
- /**
18
- * Override or extend the default script values.
19
- *
20
- * Default values:
21
- * - `id`: 'tiktok-pixel'
22
- * - `src`: `https://analytics.tiktok.com/i18n/pixel/events.js`
23
- * - `category`: 'marketing'
24
- */
25
- script?: Partial<Script>;
26
- }
27
- /**
28
- * Creates a Tiktok Pixel script.
29
- * This script is persistent after consent is revoked because it has built-in functionality to opt into and out of tracking based on consent, which allows us to not need to load the script again when consent is revoked.
30
- *
31
- * @param options - The options for the TikTok Pixel script
32
- * @returns The TikTok Pixel script configuration
33
- *
34
- * @example
35
- * ```ts
36
- * const tiktokPixelScript = tiktokPixel({
37
- * pixelId: '123456789012345',
38
- * });
39
- * ```
40
- *
41
- * @see {@link https://ads.tiktok.com/help/article/tiktok-pixel} TikTok Pixel documentation
42
- */
43
- export declare function tiktokPixel({ pixelId, script }: TikTokPixelOptions): Script;
44
- //# sourceMappingURL=tiktok-pixel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiktok-pixel.d.ts","sourceRoot":"","sources":["../src/tiktok-pixel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,GAAG,EAAE;YACJ,YAAY,EAAE,MAAM,IAAI,CAAC;YACzB,aAAa,EAAE,MAAM,IAAI,CAAC;YAC1B,IAAI,EAAE,MAAM,IAAI,CAAC;SACjB,CAAC;KACF;CACD;AAED,MAAM,WAAW,kBAAkB;IAClC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;;OAOG;IACH,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