@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
@@ -7,7 +7,7 @@ import type { FlatPropertyValue } from "#/destinations/shared";
7
7
  * transmission gate (`ttq.grantConsent()`/`revokeConsent()`) follows `analytics` and is the
8
8
  * tracker's job; this models the `ads`-driven LDU lever.
9
9
  *
10
- * @since 1.0.0-canary.7
10
+ * @since 0.5.0-canary.6
11
11
  */
12
12
  export interface TiktokConsent {
13
13
  limited_data_use: boolean;
@@ -15,13 +15,13 @@ export interface TiktokConsent {
15
15
  /**
16
16
  * Maps a `ConsentDecision` to TikTok's LDU boolean — on when `ads` is denied.
17
17
  *
18
- * @since 1.0.0-canary.7
18
+ * @since 0.5.0-canary.6
19
19
  */
20
20
  export declare function toTiktokConsent(decision: ConsentDecision): TiktokConsent;
21
21
  /**
22
22
  * The mapped per-event payload handed to a TikTok transport (`ttq.track` / Events API).
23
23
  *
24
- * @since 1.0.0-canary.7
24
+ * @since 0.5.0-canary.6
25
25
  */
26
26
  export interface TiktokEventPayload {
27
27
  consent: TiktokConsent;
@@ -29,7 +29,9 @@ export interface TiktokEventPayload {
29
29
  properties: Record<string, FlatPropertyValue>;
30
30
  }
31
31
  /**
32
- * @since 1.0.0-canary.7
32
+ * Options for `createTiktokDestination`.
33
+ *
34
+ * @since 0.5.0-canary.6
33
35
  */
34
36
  export interface TiktokDestinationOptions {
35
37
  /** Erasure cookie-clear seam — TikTok exposes no per-visitor deletion API, so erasure is cookie-clear + stop-send (DSR-V4). */
@@ -49,7 +51,6 @@ export interface TiktokDestinationOptions {
49
51
  * only — the pixel id and `ttq` transport are the integrator's. `consentRequirement` stays
50
52
  * `"required"`.
51
53
  *
52
- * @since 1.0.0-canary.7
54
+ * @since 0.5.0-canary.6
53
55
  */
54
- export declare function createTiktokDestination(options: TiktokDestinationOptions): Destination;
55
- //# sourceMappingURL=tiktok.d.ts.map
56
+ export declare function createTiktokDestination(options: TiktokDestinationOptions): Destination;
@@ -3,7 +3,7 @@ import { flattenEventProps } from "#/destinations/shared";
3
3
  /**
4
4
  * Maps a `ConsentDecision` to TikTok's LDU boolean — on 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 toTiktokConsent(decision) {
9
9
  return { limited_data_use: toAdConsentState(decision).limitedDataUse };
@@ -14,7 +14,7 @@ export function toTiktokConsent(decision) {
14
14
  * only — the pixel id and `ttq` transport are the integrator's. `consentRequirement` stays
15
15
  * `"required"`.
16
16
  *
17
- * @since 1.0.0-canary.7
17
+ * @since 0.5.0-canary.6
18
18
  */
19
19
  export function createTiktokDestination(options) {
20
20
  let stopped = false;
@@ -36,5 +36,4 @@ export function createTiktokDestination(options) {
36
36
  });
37
37
  },
38
38
  };
39
- }
40
- //# sourceMappingURL=tiktok.js.map
39
+ }
@@ -1,6 +1,8 @@
1
1
  import type { Destination } from "#/core/destination";
2
2
  /**
3
- * @since 1.0.0-canary.6
3
+ * Options for `createVercelAnalyticsDestination`.
4
+ *
5
+ * @since 0.5.0-canary.6
4
6
  */
5
7
  export interface VercelAnalyticsDestinationOptions {
6
8
  /**
@@ -21,5 +23,4 @@ export interface VercelAnalyticsDestinationOptions {
21
23
  *
22
24
  * @since 0.5.0-canary.4
23
25
  */
24
- export declare function createVercelAnalyticsDestination(options?: VercelAnalyticsDestinationOptions): Destination;
25
- //# sourceMappingURL=vercel-analytics.d.ts.map
26
+ export declare function createVercelAnalyticsDestination(options?: VercelAnalyticsDestinationOptions): Destination;
@@ -19,5 +19,4 @@ export function createVercelAnalyticsDestination(options = {}) {
19
19
  track(event.name, flattenEventProps(event.properties, { allowNull: true }));
20
20
  },
21
21
  };
22
- }
23
- //# sourceMappingURL=vercel-analytics.js.map
22
+ }
package/dist/index.d.ts CHANGED
@@ -61,5 +61,4 @@ export { createMetaDestination, toMetaDataProcessingOptions } from "#/destinatio
61
61
  export type { MicrosoftUetConsent, MicrosoftUetDestinationOptions, MicrosoftUetEventPayload, } from "#/destinations/microsoft-uet";
62
62
  export { createMicrosoftUetDestination, toMicrosoftUetConsent } from "#/destinations/microsoft-uet";
63
63
  export type { TiktokConsent, TiktokDestinationOptions, TiktokEventPayload } from "#/destinations/tiktok";
64
- export { createTiktokDestination, toTiktokConsent } from "#/destinations/tiktok";
65
- //# sourceMappingURL=index.d.ts.map
64
+ export { createTiktokDestination, toTiktokConsent } from "#/destinations/tiktok";
package/dist/index.js CHANGED
@@ -38,5 +38,4 @@ export { toAdConsentState } from "#/destinations/ad-consent";
38
38
  export { buildGtagConsentBootstrapScript, clearGoogleAnalyticsCookies, createGoogleAnalyticsDestination, ensureGtag, loadGtagScript, updateGoogleConsent, } from "#/destinations/google-analytics";
39
39
  export { createMetaDestination, toMetaDataProcessingOptions } from "#/destinations/meta";
40
40
  export { createMicrosoftUetDestination, toMicrosoftUetConsent } from "#/destinations/microsoft-uet";
41
- export { createTiktokDestination, toTiktokConsent } from "#/destinations/tiktok";
42
- //# sourceMappingURL=index.js.map
41
+ export { createTiktokDestination, toTiktokConsent } from "#/destinations/tiktok";
@@ -2,6 +2,8 @@ import type { ComponentProps, ReactNode } from "react";
2
2
  import type { ConsentCategory } from "#/core/consent";
3
3
  import type { UseConsentResult } from "#/react/use-consent";
4
4
  /**
5
+ * Props for {@link ConsentBanner}.
6
+ *
5
7
  * @since 0.5.0-canary.4
6
8
  */
7
9
  export interface ConsentBannerProps extends ComponentProps<"section"> {
@@ -25,15 +27,21 @@ export interface ConsentBannerProps extends ComponentProps<"section"> {
25
27
  */
26
28
  export declare function ConsentBanner({ children, consent, open, ...props }: ConsentBannerProps): ReactNode;
27
29
  /**
30
+ * Props for {@link ConsentBannerTitle}.
31
+ *
28
32
  * @since 0.5.0-canary.5
29
33
  */
30
34
  export interface ConsentBannerTitleProps extends ComponentProps<"h2"> {
31
35
  }
32
36
  /**
37
+ * Renders the banner's heading.
38
+ *
33
39
  * @since 0.5.0-canary.5
34
40
  */
35
41
  export declare function ConsentBannerTitle({ children, ...props }: ConsentBannerTitleProps): ReactNode;
36
42
  /**
43
+ * Props for {@link ConsentBannerDescription}.
44
+ *
37
45
  * @since 0.5.0-canary.5
38
46
  */
39
47
  export interface ConsentBannerDescriptionProps extends ComponentProps<"p"> {
@@ -45,15 +53,21 @@ export interface ConsentBannerDescriptionProps extends ComponentProps<"p"> {
45
53
  */
46
54
  export declare function ConsentBannerDescription(props: ConsentBannerDescriptionProps): ReactNode;
47
55
  /**
56
+ * Props for {@link ConsentBannerActions}.
57
+ *
48
58
  * @since 0.5.0-canary.5
49
59
  */
50
60
  export interface ConsentBannerActionsProps extends ComponentProps<"div"> {
51
61
  }
52
62
  /**
63
+ * Renders the container grouping the banner's action buttons.
64
+ *
53
65
  * @since 0.5.0-canary.5
54
66
  */
55
67
  export declare function ConsentBannerActions(props: ConsentBannerActionsProps): ReactNode;
56
68
  /**
69
+ * Props for {@link ConsentBannerAccept}.
70
+ *
57
71
  * @since 0.5.0-canary.5
58
72
  */
59
73
  export interface ConsentBannerAcceptProps extends Omit<ComponentProps<"button">, "type"> {
@@ -65,15 +79,21 @@ export interface ConsentBannerAcceptProps extends Omit<ComponentProps<"button">,
65
79
  */
66
80
  export declare function ConsentBannerAccept({ onClick, ...props }: ConsentBannerAcceptProps): ReactNode;
67
81
  /**
82
+ * Props for {@link ConsentBannerReject}.
83
+ *
68
84
  * @since 0.5.0-canary.5
69
85
  */
70
86
  export interface ConsentBannerRejectProps extends Omit<ComponentProps<"button">, "type"> {
71
87
  }
72
88
  /**
89
+ * Denies every category via the consent hook's `denyAll` — rejecting stays as easy as accepting.
90
+ *
73
91
  * @since 0.5.0-canary.5
74
92
  */
75
93
  export declare function ConsentBannerReject({ onClick, ...props }: ConsentBannerRejectProps): ReactNode;
76
94
  /**
95
+ * Props for {@link ConsentBannerCustomize}.
96
+ *
77
97
  * @since 0.5.0-canary.5
78
98
  */
79
99
  export interface ConsentBannerCustomizeProps extends Omit<ComponentProps<"button">, "type"> {
@@ -87,6 +107,8 @@ export interface ConsentBannerCustomizeProps extends Omit<ComponentProps<"button
87
107
  */
88
108
  export declare function ConsentBannerCustomize({ onClick, ...props }: ConsentBannerCustomizeProps): ReactNode;
89
109
  /**
110
+ * Props for {@link ConsentBannerPreferences}.
111
+ *
90
112
  * @since 0.5.0-canary.5
91
113
  */
92
114
  export interface ConsentBannerPreferencesProps extends ComponentProps<"div"> {
@@ -98,6 +120,8 @@ export interface ConsentBannerPreferencesProps extends ComponentProps<"div"> {
98
120
  */
99
121
  export declare function ConsentBannerPreferences(props: ConsentBannerPreferencesProps): ReactNode;
100
122
  /**
123
+ * Props for {@link ConsentBannerCategory}.
124
+ *
101
125
  * @since 0.5.0-canary.5
102
126
  */
103
127
  export interface ConsentBannerCategoryProps extends ComponentProps<"label"> {
@@ -110,6 +134,8 @@ export interface ConsentBannerCategoryProps extends ComponentProps<"label"> {
110
134
  */
111
135
  export declare function ConsentBannerCategory({ category, children, ...props }: ConsentBannerCategoryProps): ReactNode;
112
136
  /**
137
+ * Props for {@link ConsentBannerSave}.
138
+ *
113
139
  * @since 0.5.0-canary.5
114
140
  */
115
141
  export interface ConsentBannerSaveProps extends Omit<ComponentProps<"button">, "type"> {
@@ -121,6 +147,8 @@ export interface ConsentBannerSaveProps extends Omit<ComponentProps<"button">, "
121
147
  */
122
148
  export declare function ConsentBannerSave({ onClick, ...props }: ConsentBannerSaveProps): ReactNode;
123
149
  /**
150
+ * Props for {@link ConsentToggle}.
151
+ *
124
152
  * @since 0.5.0-canary.4
125
153
  */
126
154
  export interface ConsentToggleProps extends Omit<ComponentProps<"button">, "children" | "onClick" | "type"> {
@@ -151,5 +179,4 @@ export interface ConsentToggleProps extends Omit<ComponentProps<"button">, "chil
151
179
  *
152
180
  * @since 0.5.0-canary.4
153
181
  */
154
- export declare function ConsentToggle({ allowLabel, consent, denyLabel, toggledCategories, ...props }: ConsentToggleProps): ReactNode;
155
- //# sourceMappingURL=consent-banner.d.ts.map
182
+ export declare function ConsentToggle({ allowLabel, consent, denyLabel, toggledCategories, ...props }: ConsentToggleProps): ReactNode;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { createContext, useContext, useEffect, useState } from "react";
3
+ import { createContext, useContext, useState } from "react";
4
4
  const ConsentBannerContext = createContext(null);
5
5
  function useConsentBannerContext(part) {
6
6
  const context = useContext(ConsentBannerContext);
@@ -24,20 +24,20 @@ function useConsentBannerContext(part) {
24
24
  * @since 0.5.0-canary.4
25
25
  */
26
26
  export function ConsentBanner({ children, consent, open, ...props }) {
27
- const [pending, setPending] = useState(undefined);
28
27
  const isVisible = open ?? consent.isPromptNeeded;
29
- // Closing must reset the layer — a reopened banner starts at the prompt, not mid-preferences.
30
- useEffect(() => {
31
- if (!isVisible) {
28
+ const [pending, setPending] = useState(undefined);
29
+ if (!isVisible) {
30
+ // Closing resets the layer — a reopened banner starts at the prompt, not mid-preferences.
31
+ if (pending !== undefined) {
32
32
  setPending(undefined);
33
33
  }
34
- }, [isVisible]);
35
- if (!isVisible) {
36
34
  return null;
37
35
  }
38
36
  return (_jsx(ConsentBannerContext.Provider, { value: { consent, pending, setPending }, children: _jsx("section", { "aria-label": "Cookie consent", "data-slot": "consent-banner", "data-state": pending === undefined ? "prompt" : "preferences", ...props, children: children }) }));
39
37
  }
40
38
  /**
39
+ * Renders the banner's heading.
40
+ *
41
41
  * @since 0.5.0-canary.5
42
42
  */
43
43
  export function ConsentBannerTitle({ children, ...props }) {
@@ -52,6 +52,8 @@ export function ConsentBannerDescription(props) {
52
52
  return _jsx("p", { "data-slot": "consent-description", ...props });
53
53
  }
54
54
  /**
55
+ * Renders the container grouping the banner's action buttons.
56
+ *
55
57
  * @since 0.5.0-canary.5
56
58
  */
57
59
  export function ConsentBannerActions(props) {
@@ -73,6 +75,8 @@ export function ConsentBannerAccept({ onClick, ...props }) {
73
75
  }, type: "button" }));
74
76
  }
75
77
  /**
78
+ * Denies every category via the consent hook's `denyAll` — rejecting stays as easy as accepting.
79
+ *
76
80
  * @since 0.5.0-canary.5
77
81
  */
78
82
  export function ConsentBannerReject({ onClick, ...props }) {
@@ -167,5 +171,4 @@ export function ConsentToggle({ allowLabel = "Allow tracking", consent, denyLabe
167
171
  }
168
172
  consent.saveDecision(next);
169
173
  }, type: "button", children: isAnyCategoryGranted ? denyLabel : allowLabel }));
170
- }
171
- //# sourceMappingURL=consent-banner.js.map
174
+ }
@@ -1,7 +1,9 @@
1
1
  import type { ComponentProps, ReactNode } from "react";
2
2
  import type { GtagConsentBootstrapOptions } from "#/destinations/google-analytics";
3
3
  /**
4
- * @since 1.0.0-canary.6
4
+ * Props for {@link GtagConsentBootstrap}.
5
+ *
6
+ * @since 0.5.0-canary.6
5
7
  */
6
8
  export interface GtagConsentBootstrapProps extends Omit<ComponentProps<"script">, "children" | "dangerouslySetInnerHTML" | "nonce" | "src" | "type">, GtagConsentBootstrapOptions {
7
9
  }
@@ -11,7 +13,6 @@ export interface GtagConsentBootstrapProps extends Omit<ComponentProps<"script">
11
13
  * only sets the attribute on the host script — the generated source also stamps it onto
12
14
  * the injected gtag.js tag when `nonce` is provided.
13
15
  *
14
- * @since 1.0.0-canary.6
16
+ * @since 0.5.0-canary.6
15
17
  */
16
- export declare function GtagConsentBootstrap({ config, dataLayerName, defaultConsent, debugMode, gaMeasurementId, nonce, ...props }: GtagConsentBootstrapProps): ReactNode;
17
- //# sourceMappingURL=gtag-consent-bootstrap.d.ts.map
18
+ export declare function GtagConsentBootstrap({ config, dataLayerName, defaultConsent, debugMode, gaMeasurementId, nonce, ...props }: GtagConsentBootstrapProps): ReactNode;
@@ -6,7 +6,7 @@ import { buildGtagConsentBootstrapScript } from "#/destinations/google-analytics
6
6
  * only sets the attribute on the host script — the generated source also stamps it onto
7
7
  * the injected gtag.js tag when `nonce` is provided.
8
8
  *
9
- * @since 1.0.0-canary.6
9
+ * @since 0.5.0-canary.6
10
10
  */
11
11
  export function GtagConsentBootstrap({ config, dataLayerName, defaultConsent, debugMode, gaMeasurementId, nonce, ...props }) {
12
12
  const bootstrapOptions = {
@@ -18,5 +18,4 @@ export function GtagConsentBootstrap({ config, dataLayerName, defaultConsent, de
18
18
  ...(nonce === undefined ? {} : { nonce }),
19
19
  };
20
20
  return (_jsx("script", { ...props, dangerouslySetInnerHTML: { __html: buildGtagConsentBootstrapScript(bootstrapOptions) }, ...(nonce === undefined ? {} : { nonce }), suppressHydrationWarning: true }));
21
- }
22
- //# sourceMappingURL=gtag-consent-bootstrap.js.map
21
+ }
@@ -1,6 +1,8 @@
1
1
  import type { ConsentDecision, ConsentMode, ConsentStorage } from "#/core/consent";
2
2
  import type { ConsentConfig } from "#/core/consent-config";
3
3
  /**
4
+ * Options for `useConsent`.
5
+ *
4
6
  * @since 0.5.0-canary.4
5
7
  */
6
8
  export interface UseConsentOptions {
@@ -13,6 +15,8 @@ export interface UseConsentOptions {
13
15
  storage: ConsentStorage;
14
16
  }
15
17
  /**
18
+ * The live consent state and decision actions returned by `useConsent`.
19
+ *
16
20
  * @since 0.5.0-canary.4
17
21
  */
18
22
  export interface UseConsentResult {
@@ -38,5 +42,4 @@ export interface UseConsentResult {
38
42
  *
39
43
  * @since 0.5.0-canary.4
40
44
  */
41
- export declare function useConsent(options: UseConsentOptions): UseConsentResult;
42
- //# sourceMappingURL=use-consent.d.ts.map
45
+ export declare function useConsent(options: UseConsentOptions): UseConsentResult;
@@ -56,5 +56,4 @@ export function useConsent(options) {
56
56
  isPromptNeeded: mode === "opt-in" && decision === undefined,
57
57
  saveDecision,
58
58
  }), [decision, denyAll, effectiveConsent, grantAll, mode, saveDecision]);
59
- }
60
- //# sourceMappingURL=use-consent.js.map
59
+ }
@@ -1,6 +1,8 @@
1
1
  import type { UseConsentResult } from "#/react/use-consent";
2
2
  /**
3
- * @since 1.0.0-canary.6
3
+ * Options for `useGoogleConsentSync`.
4
+ *
5
+ * @since 0.5.0-canary.6
4
6
  */
5
7
  export interface UseGoogleConsentSyncOptions {
6
8
  /**
@@ -14,7 +16,6 @@ export interface UseGoogleConsentSyncOptions {
14
16
  * decision exists (including cross-tab / privacy-page saves), and optionally loads gtag
15
17
  * when analytics is effective. Mount once on a page-wide surface (e.g. the footer gate).
16
18
  *
17
- * @since 1.0.0-canary.6
19
+ * @since 0.5.0-canary.6
18
20
  */
19
- export declare function useGoogleConsentSync(consent: UseConsentResult, options?: UseGoogleConsentSyncOptions): void;
20
- //# sourceMappingURL=use-google-consent-sync.d.ts.map
21
+ export declare function useGoogleConsentSync(consent: UseConsentResult, options?: UseGoogleConsentSyncOptions): void;
@@ -6,7 +6,7 @@ import { updateGoogleConsent } from "#/destinations/google-analytics";
6
6
  * decision exists (including cross-tab / privacy-page saves), and optionally loads gtag
7
7
  * when analytics is effective. Mount once on a page-wide surface (e.g. the footer gate).
8
8
  *
9
- * @since 1.0.0-canary.6
9
+ * @since 0.5.0-canary.6
10
10
  */
11
11
  export function useGoogleConsentSync(consent, options = {}) {
12
12
  const { loadGtagScript } = options;
@@ -18,5 +18,4 @@ export function useGoogleConsentSync(consent, options = {}) {
18
18
  loadGtagScript?.();
19
19
  }
20
20
  }, [consent.decision, consent.effectiveConsent.analytics, loadGtagScript]);
21
- }
22
- //# sourceMappingURL=use-google-consent-sync.js.map
21
+ }
@@ -5,7 +5,6 @@ import type { InitialConsentSnapshot, InitialConsentStore } from "#/client/initi
5
5
  * answers. SSR and the first client render read the strictest snapshot, so hydration can
6
6
  * never mismatch on region.
7
7
  *
8
- * @since 1.0.0-canary.6
8
+ * @since 0.5.0-canary.6
9
9
  */
10
- export declare function useInitialConsent(store: InitialConsentStore): InitialConsentSnapshot;
11
- //# sourceMappingURL=use-initial-consent.d.ts.map
10
+ export declare function useInitialConsent(store: InitialConsentStore): InitialConsentSnapshot;
@@ -6,7 +6,7 @@ import { useEffect, useSyncExternalStore } from "react";
6
6
  * answers. SSR and the first client render read the strictest snapshot, so hydration can
7
7
  * never mismatch on region.
8
8
  *
9
- * @since 1.0.0-canary.6
9
+ * @since 0.5.0-canary.6
10
10
  */
11
11
  export function useInitialConsent(store) {
12
12
  // Post-hydration safety net — idempotent with an earlier, pre-hydration kick.
@@ -14,5 +14,4 @@ export function useInitialConsent(store) {
14
14
  store.ensureResolved();
15
15
  }, [store]);
16
16
  return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
17
- }
18
- //# sourceMappingURL=use-initial-consent.js.map
17
+ }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @throws Error when `cookieName` is not a valid token.
5
5
  *
6
- * @since 1.0.0-canary.7
6
+ * @since 0.5.0-canary.6
7
7
  */
8
8
  export declare function assertValidAnonymousIdCookieName(cookieName: string): void;
9
9
  /**
@@ -11,11 +11,13 @@ export declare function assertValidAnonymousIdCookieName(cookieName: string): vo
11
11
  * writes its input into a `Set-Cookie`, so only an exactly-UUID-shaped value may pass —
12
12
  * anything else is a header-injection attempt or corruption, never a valid id.
13
13
  *
14
- * @since 1.0.0-canary.6
14
+ * @since 0.5.0-canary.6
15
15
  */
16
16
  export declare function isValidAnonymousId(value: string): boolean;
17
17
  /**
18
- * @since 1.0.0-canary.6
18
+ * Options for persisting a client-minted anonymous id via a server `Set-Cookie`.
19
+ *
20
+ * @since 0.5.0-canary.6
19
21
  */
20
22
  export interface AnonymousIdCookieOptions {
21
23
  /** Cookie name — must match what the client tracker reads. */
@@ -39,7 +41,7 @@ export interface AnonymousIdCookieOptions {
39
41
  *
40
42
  * @throws Error when `id` is not UUID-shaped or `cookieName` is not a valid token.
41
43
  *
42
- * @since 1.0.0-canary.6
44
+ * @since 0.5.0-canary.6
43
45
  */
44
46
  export declare function resolveAnonymousIdCookie(options: AnonymousIdCookieOptions): {
45
47
  maxAge: number;
@@ -56,12 +58,11 @@ export declare function resolveAnonymousIdCookie(options: AnonymousIdCookieOptio
56
58
  *
57
59
  * @throws Error when `cookieName` is not a valid token.
58
60
  *
59
- * @since 1.0.0-canary.6
61
+ * @since 0.5.0-canary.6
60
62
  */
61
63
  export declare function resolveClearAnonymousIdCookie(cookieName: string): {
62
64
  name: string;
63
65
  path: string;
64
66
  sameSite: "lax";
65
67
  secure: true;
66
- };
67
- //# sourceMappingURL=anonymous-id-cookie.d.ts.map
68
+ };
@@ -8,7 +8,7 @@ const COOKIE_NAME_PATTERN = /^[\w-]+$/;
8
8
  *
9
9
  * @throws Error when `cookieName` is not a valid token.
10
10
  *
11
- * @since 1.0.0-canary.7
11
+ * @since 0.5.0-canary.6
12
12
  */
13
13
  export function assertValidAnonymousIdCookieName(cookieName) {
14
14
  if (!COOKIE_NAME_PATTERN.test(cookieName)) {
@@ -20,7 +20,7 @@ export function assertValidAnonymousIdCookieName(cookieName) {
20
20
  * writes its input into a `Set-Cookie`, so only an exactly-UUID-shaped value may pass —
21
21
  * anything else is a header-injection attempt or corruption, never a valid id.
22
22
  *
23
- * @since 1.0.0-canary.6
23
+ * @since 0.5.0-canary.6
24
24
  */
25
25
  export function isValidAnonymousId(value) {
26
26
  return UUID_PATTERN.test(value);
@@ -39,7 +39,7 @@ export function isValidAnonymousId(value) {
39
39
  *
40
40
  * @throws Error when `id` is not UUID-shaped or `cookieName` is not a valid token.
41
41
  *
42
- * @since 1.0.0-canary.6
42
+ * @since 0.5.0-canary.6
43
43
  */
44
44
  export function resolveAnonymousIdCookie(options) {
45
45
  assertValidAnonymousIdCookieName(options.cookieName);
@@ -62,10 +62,9 @@ export function resolveAnonymousIdCookie(options) {
62
62
  *
63
63
  * @throws Error when `cookieName` is not a valid token.
64
64
  *
65
- * @since 1.0.0-canary.6
65
+ * @since 0.5.0-canary.6
66
66
  */
67
67
  export function resolveClearAnonymousIdCookie(cookieName) {
68
68
  assertValidAnonymousIdCookieName(cookieName);
69
69
  return { name: cookieName, path: "/", sameSite: "lax", secure: true };
70
- }
71
- //# sourceMappingURL=anonymous-id-cookie.js.map
70
+ }
@@ -5,7 +5,7 @@ import type { ConsentReceipt } from "#/core/consent-receipt";
5
5
  * and an update/withdrawal is a new receipt referencing the prior one (spec-consent-receipts §3).
6
6
  * May be async so a real backend can await its write.
7
7
  *
8
- * @since 1.0.0-canary.7
8
+ * @since 0.5.0-canary.6
9
9
  */
10
10
  export interface ReceiptStore {
11
11
  append: (receipt: ConsentReceipt) => Promise<void> | void;
@@ -21,7 +21,7 @@ export interface ReceiptStore {
21
21
  * Append is idempotent-by-id: re-appending the same `receiptId` is ignored, preserving the
22
22
  * append-only guarantee even if a client retries.
23
23
  *
24
- * @since 1.0.0-canary.7
24
+ * @since 0.5.0-canary.6
25
25
  */
26
26
  export declare function createInMemoryReceiptStore(): ReceiptStore;
27
27
  /**
@@ -29,7 +29,7 @@ export declare function createInMemoryReceiptStore(): ReceiptStore;
29
29
  * Keeping it this small lets an integrator back receipts with any store (Vercel KV, Postgres,
30
30
  * an append-only log) by implementing two methods rather than the full {@link ReceiptStore}.
31
31
  *
32
- * @since 1.0.0-canary.7
32
+ * @since 0.5.0-canary.6
33
33
  */
34
34
  export interface ReceiptStoreBackend {
35
35
  get: (receiptId: string) => Promise<ConsentReceipt | undefined>;
@@ -48,9 +48,8 @@ export interface ReceiptStoreBackend {
48
48
  * client (no database dependency is baked in). Pair it with a real backend in production,
49
49
  * where {@link createInMemoryReceiptStore} is not a lawful store on its own.
50
50
  *
51
- * @since 1.0.0-canary.7
51
+ * @since 0.5.0-canary.6
52
52
  */
53
53
  export declare function createDurableReceiptStore(options: {
54
54
  backend: ReceiptStoreBackend;
55
- }): ReceiptStore;
56
- //# sourceMappingURL=consent-receipt-store.d.ts.map
55
+ }): ReceiptStore;
@@ -8,7 +8,7 @@
8
8
  * Append is idempotent-by-id: re-appending the same `receiptId` is ignored, preserving the
9
9
  * append-only guarantee even if a client retries.
10
10
  *
11
- * @since 1.0.0-canary.7
11
+ * @since 0.5.0-canary.6
12
12
  */
13
13
  export function createInMemoryReceiptStore() {
14
14
  const receipts = new Map();
@@ -29,7 +29,7 @@ export function createInMemoryReceiptStore() {
29
29
  * client (no database dependency is baked in). Pair it with a real backend in production,
30
30
  * where {@link createInMemoryReceiptStore} is not a lawful store on its own.
31
31
  *
32
- * @since 1.0.0-canary.7
32
+ * @since 0.5.0-canary.6
33
33
  */
34
34
  export function createDurableReceiptStore(options) {
35
35
  return {
@@ -40,5 +40,4 @@ export function createDurableReceiptStore(options) {
40
40
  return options.backend.get(receiptId);
41
41
  },
42
42
  };
43
- }
44
- //# sourceMappingURL=consent-receipt-store.js.map
43
+ }
@@ -3,7 +3,7 @@ import type { ConsentReceipt, ConsentReceiptInput } from "#/core/consent-receipt
3
3
  * The receipt information-structure version this builder emits (ISO/IEC TS 27560-shaped).
4
4
  * Bump when the receipt field set changes; stored receipts carry it so a reader can migrate.
5
5
  *
6
- * @since 1.0.0-canary.7
6
+ * @since 0.5.0-canary.6
7
7
  */
8
8
  export declare const RECEIPT_SCHEMA_VERSION = "1.0.0";
9
9
  /**
@@ -13,7 +13,7 @@ export declare const RECEIPT_SCHEMA_VERSION = "1.0.0";
13
13
  * a controller may widen it under counsel, but the builder never returns a full address.
14
14
  * Returns `undefined` for a missing or malformed input rather than storing a bad value.
15
15
  *
16
- * @since 1.0.0-canary.7
16
+ * @since 0.5.0-canary.6
17
17
  */
18
18
  export declare function coarsenIp(ip: string | null | undefined): string | undefined;
19
19
  /**
@@ -22,7 +22,7 @@ export declare function coarsenIp(ip: string | null | undefined): string | undef
22
22
  * function to stamp an `integrityKey`, letting a client prove its state matches the stored
23
23
  * original (spec-consent-receipts §5). Omit it and receipts carry no integrity key.
24
24
  *
25
- * @since 1.0.0-canary.7
25
+ * @since 0.5.0-canary.6
26
26
  */
27
27
  export interface BuildConsentReceiptOptions {
28
28
  input: ConsentReceiptInput;
@@ -35,7 +35,6 @@ export interface BuildConsentReceiptOptions {
35
35
  * (`receiptId`, `timestamp`, coarsened IP, optional `integrityKey`). Pure except for the
36
36
  * id/clock it stamps — pass those in via a seam if a deterministic build is needed.
37
37
  *
38
- * @since 1.0.0-canary.7
38
+ * @since 0.5.0-canary.6
39
39
  */
40
- export declare function buildConsentReceipt(options: BuildConsentReceiptOptions): ConsentReceipt;
41
- //# sourceMappingURL=consent-receipt.d.ts.map
40
+ export declare function buildConsentReceipt(options: BuildConsentReceiptOptions): ConsentReceipt;
@@ -2,7 +2,7 @@
2
2
  * The receipt information-structure version this builder emits (ISO/IEC TS 27560-shaped).
3
3
  * Bump when the receipt field set changes; stored receipts carry it so a reader can migrate.
4
4
  *
5
- * @since 1.0.0-canary.7
5
+ * @since 0.5.0-canary.6
6
6
  */
7
7
  export const RECEIPT_SCHEMA_VERSION = "1.0.0";
8
8
  const IPV4_PATTERN = /^(\d{1,3}\.){3}\d{1,3}$/;
@@ -13,7 +13,7 @@ const IPV4_PATTERN = /^(\d{1,3}\.){3}\d{1,3}$/;
13
13
  * a controller may widen it under counsel, but the builder never returns a full address.
14
14
  * Returns `undefined` for a missing or malformed input rather than storing a bad value.
15
15
  *
16
- * @since 1.0.0-canary.7
16
+ * @since 0.5.0-canary.6
17
17
  */
18
18
  export function coarsenIp(ip) {
19
19
  if (!ip) {
@@ -44,7 +44,7 @@ export function coarsenIp(ip) {
44
44
  * (`receiptId`, `timestamp`, coarsened IP, optional `integrityKey`). Pure except for the
45
45
  * id/clock it stamps — pass those in via a seam if a deterministic build is needed.
46
46
  *
47
- * @since 1.0.0-canary.7
47
+ * @since 0.5.0-canary.6
48
48
  */
49
49
  export function buildConsentReceipt(options) {
50
50
  const base = {
@@ -56,5 +56,4 @@ export function buildConsentReceipt(options) {
56
56
  };
57
57
  const integrityKey = options.sign?.(base);
58
58
  return integrityKey === undefined ? base : { ...base, integrityKey };
59
- }
60
- //# sourceMappingURL=consent-receipt.js.map
59
+ }