@codefast/tracking 0.7.0 → 0.7.2

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 (214) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +235 -105
  3. package/dist/adapters/tanstack-start.d.ts +12 -9
  4. package/dist/adapters/tanstack-start.js +5 -6
  5. package/dist/client/ad-framework-consent.d.ts +9 -8
  6. package/dist/client/ad-framework-consent.js +4 -5
  7. package/dist/client/browser-cookie.d.ts +2 -3
  8. package/dist/client/browser-cookie.js +2 -3
  9. package/dist/client/consent-runtime.d.ts +6 -5
  10. package/dist/client/consent-runtime.js +2 -3
  11. package/dist/client/consent-storage.d.ts +1 -2
  12. package/dist/client/consent-storage.js +1 -2
  13. package/dist/client/consent-withdrawal.d.ts +5 -4
  14. package/dist/client/consent-withdrawal.js +2 -3
  15. package/dist/client/cookie-anonymous-id.d.ts +8 -5
  16. package/dist/client/cookie-anonymous-id.js +2 -3
  17. package/dist/client/create-client-tracker.d.ts +8 -3
  18. package/dist/client/create-client-tracker.js +3 -2
  19. package/dist/client/gpc.d.ts +1 -2
  20. package/dist/client/gpc.js +1 -2
  21. package/dist/client/initial-consent-store.d.ts +7 -6
  22. package/dist/client/initial-consent-store.js +2 -3
  23. package/dist/client/is-analytics-allowed.d.ts +5 -4
  24. package/dist/client/is-analytics-allowed.js +2 -3
  25. package/dist/client/server-persisted-anonymous-id.d.ts +5 -4
  26. package/dist/client/server-persisted-anonymous-id.js +2 -3
  27. package/dist/core/consent-config.d.ts +3 -4
  28. package/dist/core/consent-config.js +2 -3
  29. package/dist/core/consent-receipt.d.ts +7 -8
  30. package/dist/core/consent-receipt.js +2 -3
  31. package/dist/core/consent.d.ts +24 -13
  32. package/dist/core/consent.js +13 -10
  33. package/dist/core/cookie.d.ts +3 -4
  34. package/dist/core/cookie.js +3 -4
  35. package/dist/core/destination.d.ts +1 -2
  36. package/dist/core/destination.js +1 -2
  37. package/dist/core/event-catalog.d.ts +2 -3
  38. package/dist/core/event-catalog.js +2 -3
  39. package/dist/core/event-id.d.ts +1 -2
  40. package/dist/core/event-id.js +1 -2
  41. package/dist/core/tracked-event.d.ts +1 -2
  42. package/dist/core/tracked-event.js +1 -2
  43. package/dist/destinations/ad-consent.d.ts +3 -4
  44. package/dist/destinations/ad-consent.js +2 -3
  45. package/dist/destinations/google-analytics.d.ts +17 -10
  46. package/dist/destinations/google-analytics.js +5 -6
  47. package/dist/destinations/google-consent.d.ts +10 -9
  48. package/dist/destinations/google-consent.js +6 -7
  49. package/dist/destinations/meta.d.ts +8 -7
  50. package/dist/destinations/meta.js +3 -4
  51. package/dist/destinations/microsoft-uet.d.ts +8 -7
  52. package/dist/destinations/microsoft-uet.js +3 -4
  53. package/dist/destinations/shared.d.ts +8 -5
  54. package/dist/destinations/shared.js +4 -3
  55. package/dist/destinations/tiktok.d.ts +8 -7
  56. package/dist/destinations/tiktok.js +3 -4
  57. package/dist/destinations/vercel-analytics.d.ts +4 -3
  58. package/dist/destinations/vercel-analytics.js +1 -2
  59. package/dist/index.d.ts +1 -2
  60. package/dist/index.js +1 -2
  61. package/dist/react/consent-banner.d.ts +29 -2
  62. package/dist/react/consent-banner.js +12 -9
  63. package/dist/react/gtag-consent-bootstrap.d.ts +5 -4
  64. package/dist/react/gtag-consent-bootstrap.js +2 -3
  65. package/dist/react/use-consent.d.ts +5 -2
  66. package/dist/react/use-consent.js +1 -2
  67. package/dist/react/use-google-consent-sync.d.ts +5 -4
  68. package/dist/react/use-google-consent-sync.js +2 -3
  69. package/dist/react/use-initial-consent.d.ts +2 -3
  70. package/dist/react/use-initial-consent.js +2 -3
  71. package/dist/server/anonymous-id-cookie.d.ts +8 -7
  72. package/dist/server/anonymous-id-cookie.js +5 -6
  73. package/dist/server/consent-receipt-store.d.ts +5 -6
  74. package/dist/server/consent-receipt-store.js +3 -4
  75. package/dist/server/consent-receipt.d.ts +5 -6
  76. package/dist/server/consent-receipt.js +4 -5
  77. package/dist/server/initial-consent.d.ts +5 -4
  78. package/dist/server/initial-consent.js +2 -3
  79. package/dist/server/measurement-protocol.d.ts +10 -9
  80. package/dist/server/measurement-protocol.js +4 -5
  81. package/dist/server/region.d.ts +3 -4
  82. package/dist/server/region.js +3 -4
  83. package/dist/server/user-deletion.d.ts +10 -7
  84. package/dist/server/user-deletion.js +3 -4
  85. package/dist/tooling/import-protection.d.ts +2 -3
  86. package/dist/tooling/import-protection.js +2 -3
  87. package/package.json +11 -62
  88. package/dist/adapters/tanstack-start.d.ts.map +0 -1
  89. package/dist/adapters/tanstack-start.js.map +0 -1
  90. package/dist/client/ad-framework-consent.d.ts.map +0 -1
  91. package/dist/client/ad-framework-consent.js.map +0 -1
  92. package/dist/client/browser-cookie.d.ts.map +0 -1
  93. package/dist/client/browser-cookie.js.map +0 -1
  94. package/dist/client/consent-runtime.d.ts.map +0 -1
  95. package/dist/client/consent-runtime.js.map +0 -1
  96. package/dist/client/consent-storage.d.ts.map +0 -1
  97. package/dist/client/consent-storage.js.map +0 -1
  98. package/dist/client/consent-withdrawal.d.ts.map +0 -1
  99. package/dist/client/consent-withdrawal.js.map +0 -1
  100. package/dist/client/cookie-anonymous-id.d.ts.map +0 -1
  101. package/dist/client/cookie-anonymous-id.js.map +0 -1
  102. package/dist/client/create-client-tracker.d.ts.map +0 -1
  103. package/dist/client/create-client-tracker.js.map +0 -1
  104. package/dist/client/gpc.d.ts.map +0 -1
  105. package/dist/client/gpc.js.map +0 -1
  106. package/dist/client/initial-consent-store.d.ts.map +0 -1
  107. package/dist/client/initial-consent-store.js.map +0 -1
  108. package/dist/client/is-analytics-allowed.d.ts.map +0 -1
  109. package/dist/client/is-analytics-allowed.js.map +0 -1
  110. package/dist/client/server-persisted-anonymous-id.d.ts.map +0 -1
  111. package/dist/client/server-persisted-anonymous-id.js.map +0 -1
  112. package/dist/core/consent-config.d.ts.map +0 -1
  113. package/dist/core/consent-config.js.map +0 -1
  114. package/dist/core/consent-receipt.d.ts.map +0 -1
  115. package/dist/core/consent-receipt.js.map +0 -1
  116. package/dist/core/consent.d.ts.map +0 -1
  117. package/dist/core/consent.js.map +0 -1
  118. package/dist/core/cookie.d.ts.map +0 -1
  119. package/dist/core/cookie.js.map +0 -1
  120. package/dist/core/destination.d.ts.map +0 -1
  121. package/dist/core/destination.js.map +0 -1
  122. package/dist/core/event-catalog.d.ts.map +0 -1
  123. package/dist/core/event-catalog.js.map +0 -1
  124. package/dist/core/event-id.d.ts.map +0 -1
  125. package/dist/core/event-id.js.map +0 -1
  126. package/dist/core/tracked-event.d.ts.map +0 -1
  127. package/dist/core/tracked-event.js.map +0 -1
  128. package/dist/destinations/ad-consent.d.ts.map +0 -1
  129. package/dist/destinations/ad-consent.js.map +0 -1
  130. package/dist/destinations/google-analytics.d.ts.map +0 -1
  131. package/dist/destinations/google-analytics.js.map +0 -1
  132. package/dist/destinations/google-consent.d.ts.map +0 -1
  133. package/dist/destinations/google-consent.js.map +0 -1
  134. package/dist/destinations/meta.d.ts.map +0 -1
  135. package/dist/destinations/meta.js.map +0 -1
  136. package/dist/destinations/microsoft-uet.d.ts.map +0 -1
  137. package/dist/destinations/microsoft-uet.js.map +0 -1
  138. package/dist/destinations/shared.d.ts.map +0 -1
  139. package/dist/destinations/shared.js.map +0 -1
  140. package/dist/destinations/tiktok.d.ts.map +0 -1
  141. package/dist/destinations/tiktok.js.map +0 -1
  142. package/dist/destinations/vercel-analytics.d.ts.map +0 -1
  143. package/dist/destinations/vercel-analytics.js.map +0 -1
  144. package/dist/index.d.ts.map +0 -1
  145. package/dist/index.js.map +0 -1
  146. package/dist/react/consent-banner.d.ts.map +0 -1
  147. package/dist/react/consent-banner.js.map +0 -1
  148. package/dist/react/gtag-consent-bootstrap.d.ts.map +0 -1
  149. package/dist/react/gtag-consent-bootstrap.js.map +0 -1
  150. package/dist/react/use-consent.d.ts.map +0 -1
  151. package/dist/react/use-consent.js.map +0 -1
  152. package/dist/react/use-google-consent-sync.d.ts.map +0 -1
  153. package/dist/react/use-google-consent-sync.js.map +0 -1
  154. package/dist/react/use-initial-consent.d.ts.map +0 -1
  155. package/dist/react/use-initial-consent.js.map +0 -1
  156. package/dist/server/anonymous-id-cookie.d.ts.map +0 -1
  157. package/dist/server/anonymous-id-cookie.js.map +0 -1
  158. package/dist/server/consent-receipt-store.d.ts.map +0 -1
  159. package/dist/server/consent-receipt-store.js.map +0 -1
  160. package/dist/server/consent-receipt.d.ts.map +0 -1
  161. package/dist/server/consent-receipt.js.map +0 -1
  162. package/dist/server/initial-consent.d.ts.map +0 -1
  163. package/dist/server/initial-consent.js.map +0 -1
  164. package/dist/server/measurement-protocol.d.ts.map +0 -1
  165. package/dist/server/measurement-protocol.js.map +0 -1
  166. package/dist/server/region.d.ts.map +0 -1
  167. package/dist/server/region.js.map +0 -1
  168. package/dist/server/user-deletion.d.ts.map +0 -1
  169. package/dist/server/user-deletion.js.map +0 -1
  170. package/dist/tooling/import-protection.d.ts.map +0 -1
  171. package/dist/tooling/import-protection.js.map +0 -1
  172. package/src/adapters/tanstack-start.ts +0 -135
  173. package/src/client/ad-framework-consent.ts +0 -86
  174. package/src/client/browser-cookie.ts +0 -16
  175. package/src/client/consent-runtime.ts +0 -80
  176. package/src/client/consent-storage.ts +0 -125
  177. package/src/client/consent-withdrawal.ts +0 -32
  178. package/src/client/cookie-anonymous-id.ts +0 -112
  179. package/src/client/create-client-tracker.ts +0 -168
  180. package/src/client/gpc.ts +0 -15
  181. package/src/client/initial-consent-store.ts +0 -218
  182. package/src/client/is-analytics-allowed.ts +0 -43
  183. package/src/client/server-persisted-anonymous-id.ts +0 -102
  184. package/src/core/consent-config.ts +0 -27
  185. package/src/core/consent-receipt.ts +0 -115
  186. package/src/core/consent.ts +0 -286
  187. package/src/core/cookie.ts +0 -29
  188. package/src/core/destination.ts +0 -29
  189. package/src/core/event-catalog.ts +0 -54
  190. package/src/core/event-id.ts +0 -8
  191. package/src/core/tracked-event.ts +0 -14
  192. package/src/css/consent.css +0 -119
  193. package/src/destinations/ad-consent.ts +0 -29
  194. package/src/destinations/google-analytics.ts +0 -296
  195. package/src/destinations/google-consent.ts +0 -164
  196. package/src/destinations/meta.ts +0 -96
  197. package/src/destinations/microsoft-uet.ts +0 -86
  198. package/src/destinations/shared.ts +0 -45
  199. package/src/destinations/tiktok.ts +0 -85
  200. package/src/destinations/vercel-analytics.ts +0 -39
  201. package/src/index.ts +0 -171
  202. package/src/react/consent-banner.tsx +0 -360
  203. package/src/react/gtag-consent-bootstrap.tsx +0 -48
  204. package/src/react/use-consent.ts +0 -119
  205. package/src/react/use-google-consent-sync.ts +0 -38
  206. package/src/react/use-initial-consent.ts +0 -22
  207. package/src/server/anonymous-id-cookie.ts +0 -103
  208. package/src/server/consent-receipt-store.ts +0 -79
  209. package/src/server/consent-receipt.ts +0 -89
  210. package/src/server/initial-consent.ts +0 -46
  211. package/src/server/measurement-protocol.ts +0 -114
  212. package/src/server/region.ts +0 -77
  213. package/src/server/user-deletion.ts +0 -93
  214. package/src/tooling/import-protection.ts +0 -22
@@ -1,11 +1,13 @@
1
1
  /**
2
- * @since 1.0.0-canary.6
2
+ * Every consent region, in a stable order shared by guards and iteration.
3
+ *
4
+ * @since 0.5.0-canary.6
3
5
  */
4
6
  export const CONSENT_REGIONS = ["eu", "other", "us", "vn"];
5
7
  /**
6
8
  * Guards a region read from untrusted storage (a cached `InitialConsent`, a cookie).
7
9
  *
8
- * @since 1.0.0-canary.6
10
+ * @since 0.5.0-canary.6
9
11
  */
10
12
  export function isConsentRegion(value) {
11
13
  return CONSENT_REGIONS.includes(value);
@@ -30,6 +32,8 @@ export function resolveConsentMode(region) {
30
32
  }
31
33
  }
32
34
  /**
35
+ * Every consent category, in a stable order shared by guards and iteration.
36
+ *
33
37
  * @since 0.5.0-canary.4
34
38
  */
35
39
  export const CONSENT_CATEGORIES = ["ads", "analytics"];
@@ -57,7 +61,7 @@ export function isConsentDecision(value) {
57
61
  * dropped, every category becomes an explicit boolean. The one normalization rule every
58
62
  * reader of stored consent shares (e.g. `readStoredDecision`).
59
63
  *
60
- * @since 1.0.0-canary.6
64
+ * @since 0.5.0-canary.6
61
65
  */
62
66
  export function normalizeConsentDecision(decision) {
63
67
  return createConsentDecision(CONSENT_CATEGORIES.filter((category) => decision[category]));
@@ -65,7 +69,7 @@ export function normalizeConsentDecision(decision) {
65
69
  /**
66
70
  * Guards a persisted consent record read from untrusted storage (e.g. `localStorage`).
67
71
  *
68
- * @since 1.0.0-canary.6
72
+ * @since 0.5.0-canary.6
69
73
  */
70
74
  export function isConsentRecord(value) {
71
75
  return (isPlainObject(value) &&
@@ -100,7 +104,7 @@ export function resolveDefaultConsent(options) {
100
104
  * Prerendered/CDN-cached markup must carry nothing region-specific, and a missing geo
101
105
  * header means "unknown visitor", never "known non-EU visitor".
102
106
  *
103
- * @since 1.0.0-canary.6
107
+ * @since 0.5.0-canary.6
104
108
  */
105
109
  export const STRICTEST_INITIAL_CONSENT = Object.freeze({
106
110
  defaultConsent: Object.freeze(createConsentDecision([])),
@@ -113,7 +117,7 @@ export const STRICTEST_INITIAL_CONSENT = Object.freeze({
113
117
  * {@link STRICTEST_INITIAL_CONSENT}'s own pairing — stricter than the region's usual
114
118
  * mode, never looser.
115
119
  *
116
- * @since 1.0.0-canary.6
120
+ * @since 0.5.0-canary.6
117
121
  */
118
122
  export function isInitialConsent(value) {
119
123
  if (!isPlainObject(value)) {
@@ -134,7 +138,7 @@ export function isInitialConsent(value) {
134
138
  * any tampered extra keys — `undefined` if there is none yet, the record is malformed, or
135
139
  * it was recorded under a superseded policy version.
136
140
  *
137
- * @since 1.0.0-canary.6
141
+ * @since 0.5.0-canary.6
138
142
  */
139
143
  export function readStoredDecision(storage, policyVersion) {
140
144
  const record = storage.load();
@@ -149,11 +153,10 @@ export function readStoredDecision(storage, policyVersion) {
149
153
  * non-React gate (e.g. a tracker's `isAnalyticsAllowed` option) doesn't have to reimplement
150
154
  * "read storage, validate the policy version, fall back to `resolveDefaultConsent`" itself.
151
155
  *
152
- * @since 1.0.0-canary.6
156
+ * @since 0.5.0-canary.6
153
157
  */
154
158
  export function resolveEffectiveConsent(options) {
155
159
  const { hasGlobalPrivacyControlSignal, mode, policyVersion, requestedCategories, storage } = options;
156
160
  return (readStoredDecision(storage, policyVersion) ??
157
161
  resolveDefaultConsent({ hasGlobalPrivacyControlSignal, mode, requestedCategories }));
158
- }
159
- //# sourceMappingURL=consent.js.map
162
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Default lifetime shared by the anonymous-id and consent cookies — one year.
3
3
  *
4
- * @since 1.0.0-canary.6
4
+ * @since 0.5.0-canary.6
5
5
  */
6
6
  export declare const ONE_YEAR_IN_SECONDS: number;
7
7
  /**
@@ -9,7 +9,6 @@ export declare const ONE_YEAR_IN_SECONDS: number;
9
9
  * `document.cookie`, which share the `name=value; name2=value2` wire format — or
10
10
  * `undefined` when absent. The name must match exactly; a longer prefix sibling is ignored.
11
11
  *
12
- * @since 1.0.0-canary.6
12
+ * @since 0.5.0-canary.6
13
13
  */
14
- export declare function readCookieValue(cookieString: string | null | undefined, cookieName: string): string | undefined;
15
- //# sourceMappingURL=cookie.d.ts.map
14
+ export declare function readCookieValue(cookieString: string | null | undefined, cookieName: string): string | undefined;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Default lifetime shared by the anonymous-id and consent cookies — one year.
3
3
  *
4
- * @since 1.0.0-canary.6
4
+ * @since 0.5.0-canary.6
5
5
  */
6
6
  export const ONE_YEAR_IN_SECONDS = 60 * 60 * 24 * 365;
7
7
  /**
@@ -9,7 +9,7 @@ export const ONE_YEAR_IN_SECONDS = 60 * 60 * 24 * 365;
9
9
  * `document.cookie`, which share the `name=value; name2=value2` wire format — or
10
10
  * `undefined` when absent. The name must match exactly; a longer prefix sibling is ignored.
11
11
  *
12
- * @since 1.0.0-canary.6
12
+ * @since 0.5.0-canary.6
13
13
  */
14
14
  export function readCookieValue(cookieString, cookieName) {
15
15
  if (!cookieString) {
@@ -22,5 +22,4 @@ export function readCookieValue(cookieString, cookieName) {
22
22
  }
23
23
  }
24
24
  return undefined;
25
- }
26
- //# sourceMappingURL=cookie.js.map
25
+ }
@@ -25,5 +25,4 @@ export interface Destination {
25
25
  onErasure?: ((id: string) => Promise<void> | void) | undefined;
26
26
  /** Must always return a `Promise` — mark `send` `async` even if the body has no `await`. */
27
27
  send: (event: TrackedEvent) => Promise<void>;
28
- }
29
- //# sourceMappingURL=destination.d.ts.map
28
+ }
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=destination.js.map
1
+ export {};
@@ -29,7 +29,6 @@ export declare function defineEventCatalog<Catalog extends EventCatalog>(catalog
29
29
  * @throws Error when validation reports issues, or when the schema validates asynchronously —
30
30
  * tracking sits on synchronous call paths, so async schemas are unsupported by design.
31
31
  *
32
- * @since 1.0.0-canary.6
32
+ * @since 0.5.0-canary.6
33
33
  */
34
- export declare function assertValidEventProperties(schema: StandardSchemaV1, eventName: string, properties: unknown): unknown;
35
- //# sourceMappingURL=event-catalog.d.ts.map
34
+ export declare function assertValidEventProperties(schema: StandardSchemaV1, eventName: string, properties: unknown): unknown;
@@ -14,7 +14,7 @@ export function defineEventCatalog(catalog) {
14
14
  * @throws Error when validation reports issues, or when the schema validates asynchronously —
15
15
  * tracking sits on synchronous call paths, so async schemas are unsupported by design.
16
16
  *
17
- * @since 1.0.0-canary.6
17
+ * @since 0.5.0-canary.6
18
18
  */
19
19
  export function assertValidEventProperties(schema, eventName, properties) {
20
20
  const result = schema["~standard"].validate(properties);
@@ -26,5 +26,4 @@ export function assertValidEventProperties(schema, eventName, properties) {
26
26
  throw new Error(`Invalid properties for event "${eventName}": ${detail}`);
27
27
  }
28
28
  return result.value;
29
- }
30
- //# sourceMappingURL=event-catalog.js.map
29
+ }
@@ -3,5 +3,4 @@
3
3
  *
4
4
  * @since 0.5.0-canary.4
5
5
  */
6
- export declare function generateEventId(): string;
7
- //# sourceMappingURL=event-id.d.ts.map
6
+ export declare function generateEventId(): string;
@@ -5,5 +5,4 @@
5
5
  */
6
6
  export function generateEventId() {
7
7
  return crypto.randomUUID();
8
- }
9
- //# sourceMappingURL=event-id.js.map
8
+ }
@@ -11,5 +11,4 @@ export interface TrackedEvent {
11
11
  properties: Record<string, unknown>;
12
12
  timestamp: number;
13
13
  type: "track";
14
- }
15
- //# sourceMappingURL=tracked-event.d.ts.map
14
+ }
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=tracked-event.js.map
1
+ export {};
@@ -6,7 +6,7 @@ import type { ConsentDecision } from "#/core/consent";
6
6
  * restricts to LDU but MUST NOT withhold first-party `analytics` (spec-consent §3). Every
7
7
  * ad destination consumes this same shape so per-vendor mappings cannot drift.
8
8
  *
9
- * @since 1.0.0-canary.7
9
+ * @since 0.5.0-canary.6
10
10
  */
11
11
  export interface AdConsentState {
12
12
  /** `ads` denied → the platform must restrict to Limited Data Use (Meta/TikTok LDU, UET `ad_storage` denied). */
@@ -17,7 +17,6 @@ export interface AdConsentState {
17
17
  /**
18
18
  * Normalizes a package `ConsentDecision` to the vendor-agnostic {@link AdConsentState}.
19
19
  *
20
- * @since 1.0.0-canary.7
20
+ * @since 0.5.0-canary.6
21
21
  */
22
- export declare function toAdConsentState(decision: ConsentDecision): AdConsentState;
23
- //# sourceMappingURL=ad-consent.d.ts.map
22
+ export declare function toAdConsentState(decision: ConsentDecision): AdConsentState;
@@ -1,12 +1,11 @@
1
1
  /**
2
2
  * Normalizes a package `ConsentDecision` to the vendor-agnostic {@link AdConsentState}.
3
3
  *
4
- * @since 1.0.0-canary.7
4
+ * @since 0.5.0-canary.6
5
5
  */
6
6
  export function toAdConsentState(decision) {
7
7
  return {
8
8
  limitedDataUse: !decision.ads,
9
9
  transmissionAllowed: decision.analytics,
10
10
  };
11
- }
12
- //# sourceMappingURL=ad-consent.js.map
11
+ }
@@ -9,7 +9,7 @@ type GtagPropertyValue = FlatPropertyValue;
9
9
  * two separate `declare global` augmentations with different signatures for the same
10
10
  * property is a TS error, not a merge.
11
11
  *
12
- * @since 1.0.0-canary.6
12
+ * @since 0.5.0-canary.6
13
13
  */
14
14
  export type GtagFunction = {
15
15
  (command: "config", targetId: string, params?: Record<string, GtagPropertyValue>): void;
@@ -26,7 +26,9 @@ declare global {
26
26
  }
27
27
  }
28
28
  /**
29
- * @since 1.0.0-canary.6
29
+ * Options for `ensureGtag`.
30
+ *
31
+ * @since 0.5.0-canary.6
30
32
  */
31
33
  export interface EnsureGtagOptions {
32
34
  /**
@@ -39,11 +41,13 @@ export interface EnsureGtagOptions {
39
41
  * Ensures the standard gtag.js queueing stub exists so consent commands can be issued
40
42
  * before the tag itself loads — gtag.js replays the queue in order once it boots.
41
43
  *
42
- * @since 1.0.0-canary.6
44
+ * @since 0.5.0-canary.6
43
45
  */
44
46
  export declare function ensureGtag(options?: EnsureGtagOptions): GtagFunction | undefined;
45
47
  /**
46
- * @since 1.0.0-canary.6
48
+ * Options for `loadGtagScript`.
49
+ *
50
+ * @since 0.5.0-canary.6
47
51
  */
48
52
  export interface LoadGtagScriptOptions {
49
53
  /**
@@ -69,7 +73,7 @@ export interface LoadGtagScriptOptions {
69
73
  * (advanced Consent Mode always injects the tag after the default); use this when the
70
74
  * bootstrap did not run, or as an idempotent safety net after a runtime grant.
71
75
  *
72
- * @since 1.0.0-canary.6
76
+ * @since 0.5.0-canary.6
73
77
  */
74
78
  export declare function loadGtagScript(options: LoadGtagScriptOptions): void;
75
79
  /**
@@ -77,7 +81,7 @@ export declare function loadGtagScript(options: LoadGtagScriptOptions): void;
77
81
  * domain. Consent Mode stops using them once denied but never removes them — call from
78
82
  * a consent-withdrawal handler so a revoke does not leave identifier cookies behind.
79
83
  *
80
- * @since 1.0.0-canary.6
84
+ * @since 0.5.0-canary.6
81
85
  */
82
86
  export declare function clearGoogleAnalyticsCookies(): void;
83
87
  /**
@@ -89,7 +93,9 @@ export declare function clearGoogleAnalyticsCookies(): void;
89
93
  */
90
94
  export declare function updateGoogleConsent(decision: ConsentDecision, options?: EnsureGtagOptions): void;
91
95
  /**
92
- * @since 1.0.0-canary.6
96
+ * Options for `buildGtagConsentBootstrapScript`.
97
+ *
98
+ * @since 0.5.0-canary.6
93
99
  */
94
100
  export interface GtagConsentBootstrapOptions {
95
101
  /** The same object `useConsent` receives — the bootstrap reads its `storageKey` and `policyVersion`. */
@@ -125,10 +131,12 @@ export interface GtagConsentBootstrapOptions {
125
131
  * so the already-loaded tag picks up the grant/deny — this only covers the page-load
126
132
  * default + script injection.
127
133
  *
128
- * @since 1.0.0-canary.6
134
+ * @since 0.5.0-canary.6
129
135
  */
130
136
  export declare function buildGtagConsentBootstrapScript(options: GtagConsentBootstrapOptions): string;
131
137
  /**
138
+ * Options for `createGoogleAnalyticsDestination`.
139
+ *
132
140
  * @since 0.5.0-canary.4
133
141
  */
134
142
  export interface GoogleAnalyticsDestinationOptions {
@@ -144,5 +152,4 @@ export interface GoogleAnalyticsDestinationOptions {
144
152
  * @since 0.5.0-canary.4
145
153
  */
146
154
  export declare function createGoogleAnalyticsDestination(options?: GoogleAnalyticsDestinationOptions): Destination;
147
- export {};
148
- //# sourceMappingURL=google-analytics.d.ts.map
155
+ export {};
@@ -14,7 +14,7 @@ function gtagScriptSrc(gaMeasurementId, dataLayerName) {
14
14
  * Ensures the standard gtag.js queueing stub exists so consent commands can be issued
15
15
  * before the tag itself loads — gtag.js replays the queue in order once it boots.
16
16
  *
17
- * @since 1.0.0-canary.6
17
+ * @since 0.5.0-canary.6
18
18
  */
19
19
  export function ensureGtag(options = {}) {
20
20
  if (typeof window === "undefined") {
@@ -37,7 +37,7 @@ export function ensureGtag(options = {}) {
37
37
  * (advanced Consent Mode always injects the tag after the default); use this when the
38
38
  * bootstrap did not run, or as an idempotent safety net after a runtime grant.
39
39
  *
40
- * @since 1.0.0-canary.6
40
+ * @since 0.5.0-canary.6
41
41
  */
42
42
  export function loadGtagScript(options) {
43
43
  if (typeof document === "undefined" || document.querySelector(`script[src^="${GTAG_SCRIPT_BASE_URL}"]`) !== null) {
@@ -68,7 +68,7 @@ export function loadGtagScript(options) {
68
68
  * domain. Consent Mode stops using them once denied but never removes them — call from
69
69
  * a consent-withdrawal handler so a revoke does not leave identifier cookies behind.
70
70
  *
71
- * @since 1.0.0-canary.6
71
+ * @since 0.5.0-canary.6
72
72
  */
73
73
  export function clearGoogleAnalyticsCookies() {
74
74
  if (typeof document === "undefined") {
@@ -103,7 +103,7 @@ export function updateGoogleConsent(decision, options = {}) {
103
103
  * so the already-loaded tag picks up the grant/deny — this only covers the page-load
104
104
  * default + script injection.
105
105
  *
106
- * @since 1.0.0-canary.6
106
+ * @since 0.5.0-canary.6
107
107
  */
108
108
  export function buildGtagConsentBootstrapScript(options) {
109
109
  const { config, dataLayerName = DEFAULT_DATA_LAYER_NAME, defaultConsent, debugMode, gaMeasurementId, nonce, } = options;
@@ -152,5 +152,4 @@ export function createGoogleAnalyticsDestination(options = {}) {
152
152
  window.gtag("event", event.name, flattenEventProps(event.properties));
153
153
  },
154
154
  };
155
- }
156
- //# sourceMappingURL=google-analytics.js.map
155
+ }
@@ -2,7 +2,7 @@ import type { ConsentDecision } from "#/core/consent";
2
2
  /**
3
3
  * gtag.js/gtm.js's default queue-array name — shared so the gtag and GTM helpers cannot disagree.
4
4
  *
5
- * @since 1.0.0-canary.6
5
+ * @since 0.5.0-canary.6
6
6
  */
7
7
  export declare const DEFAULT_DATA_LAYER_NAME = "dataLayer";
8
8
  type GoogleConsentState = "denied" | "granted";
@@ -10,7 +10,7 @@ type GoogleConsentState = "denied" | "granted";
10
10
  * Consent Mode v2 params issued via `gtag('consent', …)` — shared by the gtag and GTM
11
11
  * bootstraps so signal mapping cannot drift between them.
12
12
  *
13
- * @since 1.0.0-canary.6
13
+ * @since 0.5.0-canary.6
14
14
  */
15
15
  export interface GoogleConsentParams {
16
16
  ad_personalization: GoogleConsentState;
@@ -23,11 +23,13 @@ export interface GoogleConsentParams {
23
23
  /**
24
24
  * Maps a package `ConsentDecision` onto Consent Mode v2's four storage signals.
25
25
  *
26
- * @since 1.0.0-canary.6
26
+ * @since 0.5.0-canary.6
27
27
  */
28
28
  export declare function toGoogleConsentParams(decision: ConsentDecision): GoogleConsentParams;
29
29
  /**
30
- * @since 1.0.0-canary.6
30
+ * Options for `buildGoogleConsentBootstrapPreamble`.
31
+ *
32
+ * @since 0.5.0-canary.6
31
33
  */
32
34
  export interface GoogleConsentBootstrapPreambleOptions {
33
35
  /** localStorage key holding the package's `ConsentRecord`. */
@@ -43,20 +45,19 @@ export interface GoogleConsentBootstrapPreambleOptions {
43
45
  * "default" signal. The builders append only their tag-specific tail, so the consent
44
46
  * logic cannot drift between them.
45
47
  *
46
- * @since 1.0.0-canary.6
48
+ * @since 0.5.0-canary.6
47
49
  */
48
50
  export declare function buildGoogleConsentBootstrapPreamble(options: GoogleConsentBootstrapPreambleOptions): string;
49
51
  /**
50
52
  * Reads or creates a named `window[dataLayerName]` queue array.
51
53
  *
52
- * @since 1.0.0-canary.6
54
+ * @since 0.5.0-canary.6
53
55
  */
54
56
  export declare function ensureDataLayer(dataLayerName: string): Array<unknown> | undefined;
55
57
  /**
56
58
  * Warns and returns `false` when `eventName` would be rejected by GA4.
57
59
  *
58
- * @since 1.0.0-canary.6
60
+ * @since 0.5.0-canary.6
59
61
  */
60
62
  export declare function warnUnlessGa4EventName(destinationName: string, eventName: string): boolean;
61
- export {};
62
- //# sourceMappingURL=google-consent.d.ts.map
63
+ export {};
@@ -2,7 +2,7 @@ import { CONSENT_CATEGORIES } from "#/core/consent";
2
2
  /**
3
3
  * gtag.js/gtm.js's default queue-array name — shared so the gtag and GTM helpers cannot disagree.
4
4
  *
5
- * @since 1.0.0-canary.6
5
+ * @since 0.5.0-canary.6
6
6
  */
7
7
  export const DEFAULT_DATA_LAYER_NAME = "dataLayer";
8
8
  /**
@@ -18,7 +18,7 @@ const GOOGLE_CONSENT_SIGNAL_CATEGORIES = {
18
18
  /**
19
19
  * Maps a package `ConsentDecision` onto Consent Mode v2's four storage signals.
20
20
  *
21
- * @since 1.0.0-canary.6
21
+ * @since 0.5.0-canary.6
22
22
  */
23
23
  export function toGoogleConsentParams(decision) {
24
24
  // Derived from the signal map (not hand-written per signal) so the runtime params and
@@ -52,7 +52,7 @@ function consentSignalAssignmentsExpression() {
52
52
  * "default" signal. The builders append only their tag-specific tail, so the consent
53
53
  * logic cannot drift between them.
54
54
  *
55
- * @since 1.0.0-canary.6
55
+ * @since 0.5.0-canary.6
56
56
  */
57
57
  export function buildGoogleConsentBootstrapPreamble(options) {
58
58
  const dataLayerAccess = `window[${JSON.stringify(options.dataLayerName)}]`;
@@ -74,7 +74,7 @@ export function buildGoogleConsentBootstrapPreamble(options) {
74
74
  /**
75
75
  * Reads or creates a named `window[dataLayerName]` queue array.
76
76
  *
77
- * @since 1.0.0-canary.6
77
+ * @since 0.5.0-canary.6
78
78
  */
79
79
  export function ensureDataLayer(dataLayerName) {
80
80
  if (typeof window === "undefined") {
@@ -97,7 +97,7 @@ function isGa4EventName(name) {
97
97
  /**
98
98
  * Warns and returns `false` when `eventName` would be rejected by GA4.
99
99
  *
100
- * @since 1.0.0-canary.6
100
+ * @since 0.5.0-canary.6
101
101
  */
102
102
  export function warnUnlessGa4EventName(destinationName, eventName) {
103
103
  if (isGa4EventName(eventName)) {
@@ -105,5 +105,4 @@ export function warnUnlessGa4EventName(destinationName, eventName) {
105
105
  }
106
106
  console.warn(`[tracking] "${destinationName}" dropped event "${eventName}" — GA4 event names must start with a letter and contain only letters, digits, or underscores (max 40 chars)`);
107
107
  return false;
108
- }
109
- //# sourceMappingURL=google-consent.js.map
108
+ }
@@ -7,7 +7,7 @@ import type { FlatPropertyValue } from "#/destinations/shared";
7
7
  * country `1` (USA) / state `1000` (California) are documented codes (spec-destinations §5).
8
8
  * `[]` applies no restriction.
9
9
  *
10
- * @since 1.0.0-canary.7
10
+ * @since 0.5.0-canary.6
11
11
  */
12
12
  export interface MetaDataProcessingOptions {
13
13
  country: number;
@@ -17,13 +17,13 @@ export interface MetaDataProcessingOptions {
17
17
  /**
18
18
  * Maps a `ConsentDecision` to Meta's `dataProcessingOptions`: LDU when `ads` is denied.
19
19
  *
20
- * @since 1.0.0-canary.7
20
+ * @since 0.5.0-canary.6
21
21
  */
22
22
  export declare function toMetaDataProcessingOptions(decision: ConsentDecision): MetaDataProcessingOptions;
23
23
  /**
24
24
  * The mapped per-event payload handed to a Meta transport (Pixel `fbq` or a CAPI request).
25
25
  *
26
- * @since 1.0.0-canary.7
26
+ * @since 0.5.0-canary.6
27
27
  */
28
28
  export interface MetaEventPayload {
29
29
  dataProcessingOptions: MetaDataProcessingOptions;
@@ -31,7 +31,9 @@ export interface MetaEventPayload {
31
31
  properties: Record<string, FlatPropertyValue>;
32
32
  }
33
33
  /**
34
- * @since 1.0.0-canary.7
34
+ * Options for `createMetaDestination`.
35
+ *
36
+ * @since 0.5.0-canary.6
35
37
  */
36
38
  export interface MetaDestinationOptions {
37
39
  /**
@@ -57,7 +59,6 @@ export interface MetaDestinationOptions {
57
59
  * are the integrator's to supply. `consentRequirement` stays `"required"`: an ad sink is
58
60
  * never exempt.
59
61
  *
60
- * @since 1.0.0-canary.7
62
+ * @since 0.5.0-canary.6
61
63
  */
62
- export declare function createMetaDestination(options: MetaDestinationOptions): Destination;
63
- //# sourceMappingURL=meta.d.ts.map
64
+ export declare function createMetaDestination(options: MetaDestinationOptions): Destination;
@@ -3,7 +3,7 @@ import { flattenEventProps } from "#/destinations/shared";
3
3
  /**
4
4
  * Maps a `ConsentDecision` to Meta's `dataProcessingOptions`: LDU when `ads` is denied.
5
5
  *
6
- * @since 1.0.0-canary.7
6
+ * @since 0.5.0-canary.6
7
7
  */
8
8
  export function toMetaDataProcessingOptions(decision) {
9
9
  return toAdConsentState(decision).limitedDataUse
@@ -17,7 +17,7 @@ export function toMetaDataProcessingOptions(decision) {
17
17
  * are the integrator's to supply. `consentRequirement` stays `"required"`: an ad sink is
18
18
  * never exempt.
19
19
  *
20
- * @since 1.0.0-canary.7
20
+ * @since 0.5.0-canary.6
21
21
  */
22
22
  export function createMetaDestination(options) {
23
23
  // Erasure halts delivery for the rest of the session — Meta has no per-visitor deletion API.
@@ -40,5 +40,4 @@ export function createMetaDestination(options) {
40
40
  });
41
41
  },
42
42
  };
43
- }
44
- //# sourceMappingURL=meta.js.map
43
+ }
@@ -7,7 +7,7 @@ import type { FlatPropertyValue } from "#/destinations/shared";
7
7
  * models the one enforced signal (spec-destinations §5). Pushed via
8
8
  * `uetq.push('consent','update', …)`.
9
9
  *
10
- * @since 1.0.0-canary.7
10
+ * @since 0.5.0-canary.6
11
11
  */
12
12
  export interface MicrosoftUetConsent {
13
13
  ad_storage: "denied" | "granted";
@@ -16,13 +16,13 @@ export interface MicrosoftUetConsent {
16
16
  * Maps a `ConsentDecision` to UET's enforced `ad_storage` signal via the shared ad lever, so
17
17
  * it can't drift from Meta/TikTok — `ad_storage` is the inverse of Limited Data Use.
18
18
  *
19
- * @since 1.0.0-canary.7
19
+ * @since 0.5.0-canary.6
20
20
  */
21
21
  export declare function toMicrosoftUetConsent(decision: ConsentDecision): MicrosoftUetConsent;
22
22
  /**
23
23
  * The mapped per-event payload handed to a UET transport (`uetq.push`).
24
24
  *
25
- * @since 1.0.0-canary.7
25
+ * @since 0.5.0-canary.6
26
26
  */
27
27
  export interface MicrosoftUetEventPayload {
28
28
  consent: MicrosoftUetConsent;
@@ -30,7 +30,9 @@ export interface MicrosoftUetEventPayload {
30
30
  properties: Record<string, FlatPropertyValue>;
31
31
  }
32
32
  /**
33
- * @since 1.0.0-canary.7
33
+ * Options for `createMicrosoftUetDestination`.
34
+ *
35
+ * @since 0.5.0-canary.6
34
36
  */
35
37
  export interface MicrosoftUetDestinationOptions {
36
38
  /** Erasure cookie-clear seam — UET exposes no per-visitor deletion API, so erasure is cookie-clear + stop-send (DSR-V4). */
@@ -50,7 +52,6 @@ export interface MicrosoftUetDestinationOptions {
50
52
  * mapping only — the tag id and `uetq` transport are the integrator's. `consentRequirement`
51
53
  * stays `"required"`.
52
54
  *
53
- * @since 1.0.0-canary.7
55
+ * @since 0.5.0-canary.6
54
56
  */
55
- export declare function createMicrosoftUetDestination(options: MicrosoftUetDestinationOptions): Destination;
56
- //# sourceMappingURL=microsoft-uet.d.ts.map
57
+ export declare function createMicrosoftUetDestination(options: MicrosoftUetDestinationOptions): Destination;
@@ -4,7 +4,7 @@ import { flattenEventProps } from "#/destinations/shared";
4
4
  * Maps a `ConsentDecision` to UET's enforced `ad_storage` signal via the shared ad lever, so
5
5
  * it can't drift from Meta/TikTok — `ad_storage` is the inverse of Limited Data Use.
6
6
  *
7
- * @since 1.0.0-canary.7
7
+ * @since 0.5.0-canary.6
8
8
  */
9
9
  export function toMicrosoftUetConsent(decision) {
10
10
  return { ad_storage: toAdConsentState(decision).limitedDataUse ? "denied" : "granted" };
@@ -15,7 +15,7 @@ export function toMicrosoftUetConsent(decision) {
15
15
  * mapping only — the tag id and `uetq` transport are the integrator's. `consentRequirement`
16
16
  * stays `"required"`.
17
17
  *
18
- * @since 1.0.0-canary.7
18
+ * @since 0.5.0-canary.6
19
19
  */
20
20
  export function createMicrosoftUetDestination(options) {
21
21
  let stopped = false;
@@ -37,5 +37,4 @@ export function createMicrosoftUetDestination(options) {
37
37
  });
38
38
  },
39
39
  };
40
- }
41
- //# sourceMappingURL=microsoft-uet.js.map
40
+ }
@@ -1,18 +1,21 @@
1
1
  /**
2
- * @since 1.0.0-canary.6
2
+ * A primitive value every destination accepts as an event parameter.
3
+ *
4
+ * @since 0.5.0-canary.6
3
5
  */
4
6
  export type FlatPropertyValue = boolean | number | string;
5
7
  /**
6
8
  * Event params must be flat string/number/boolean (optionally `null`) — stringify
7
9
  * anything else instead of letting the destination silently drop it.
8
10
  *
9
- * @since 1.0.0-canary.6
11
+ * @since 0.5.0-canary.6
10
12
  */
11
13
  export declare function flattenEventProps(properties: Record<string, unknown>): Record<string, FlatPropertyValue>;
12
14
  /**
13
- * @since 1.0.0-canary.6
15
+ * Flattens event properties while also passing `null` through for destinations that accept it.
16
+ *
17
+ * @since 0.5.0-canary.6
14
18
  */
15
19
  export declare function flattenEventProps(properties: Record<string, unknown>, options: {
16
20
  allowNull: true;
17
- }): Record<string, FlatPropertyValue | null>;
18
- //# sourceMappingURL=shared.d.ts.map
21
+ }): Record<string, FlatPropertyValue | null>;
@@ -1,5 +1,7 @@
1
1
  /**
2
- * @since 1.0.0-canary.6
2
+ * Shared implementation backing both overloads.
3
+ *
4
+ * @since 0.5.0-canary.6
3
5
  */
4
6
  export function flattenEventProps(properties, options = {}) {
5
7
  const result = {};
@@ -15,5 +17,4 @@ export function flattenEventProps(properties, options = {}) {
15
17
  }
16
18
  }
17
19
  return result;
18
- }
19
- //# sourceMappingURL=shared.js.map
20
+ }