@krak-stack/registry 0.1.53 → 0.1.54

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.
@@ -0,0 +1,24 @@
1
+ export interface TrackingNoticeMessages {
2
+ readonly preferences: string;
3
+ readonly title: string;
4
+ readonly description: string;
5
+ readonly learnMore: string;
6
+ readonly details: string;
7
+ readonly essential: string;
8
+ readonly privacy: string;
9
+ readonly accept: string;
10
+ readonly decline: string;
11
+ readonly close: string;
12
+ readonly blocked: string;
13
+ readonly accepted: string;
14
+ readonly declined: string;
15
+ readonly pending: string;
16
+ readonly error: string;
17
+ }
18
+ /** Mount once in a persistent footer. English/French defaults follow KrakstackProvider. */
19
+ export declare const TrackingNotice: ({ messages, locale: localeOverride, privacyHref, }?: {
20
+ readonly messages?: Partial<TrackingNoticeMessages>;
21
+ readonly locale?: string;
22
+ /** Open an application-owned page instead of the details dialog. */
23
+ readonly privacyHref?: string;
24
+ }) => import("react").JSX.Element;
@@ -0,0 +1,480 @@
1
+ // ../../src/services/events/client/tracking-notice.tsx
2
+ import { useState, useSyncExternalStore } from "react";
3
+ import { createPortal } from "react-dom";
4
+ import { Effect as Effect2, Schema as Schema3 } from "effect";
5
+ import { XIcon as XIcon2 } from "lucide-react";
6
+
7
+ // ../../src/components/ui/button.tsx
8
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
9
+ import { cva } from "class-variance-authority";
10
+
11
+ // ../../src/lib/utils.ts
12
+ import { cn } from "cn";
13
+
14
+ // ../../src/components/ui/button.tsx
15
+ import { jsx } from "react/jsx-runtime";
16
+ var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
17
+ variants: {
18
+ variant: {
19
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
20
+ outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
21
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
22
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
23
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
24
+ link: "text-primary underline-offset-4 hover:underline"
25
+ },
26
+ size: {
27
+ default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
28
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
29
+ sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
30
+ lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
31
+ icon: "size-9",
32
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
33
+ "icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
34
+ "icon-lg": "size-10"
35
+ }
36
+ },
37
+ defaultVariants: {
38
+ variant: "default",
39
+ size: "default"
40
+ }
41
+ });
42
+ function Button({
43
+ className,
44
+ variant = "default",
45
+ size = "default",
46
+ ...props
47
+ }) {
48
+ return /* @__PURE__ */ jsx(ButtonPrimitive, {
49
+ "data-slot": "button",
50
+ className: cn(buttonVariants({ variant, size, className })),
51
+ ...props
52
+ });
53
+ }
54
+
55
+ // ../../src/services/events/client/tracking-notice.tsx
56
+ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
57
+
58
+ // ../../src/components/ui/dialog.tsx
59
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
60
+ import { XIcon } from "lucide-react";
61
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
62
+ function Dialog({ ...props }) {
63
+ return /* @__PURE__ */ jsx2(DialogPrimitive.Root, {
64
+ "data-slot": "dialog",
65
+ ...props
66
+ });
67
+ }
68
+ function DialogPortal({ ...props }) {
69
+ return /* @__PURE__ */ jsx2(DialogPrimitive.Portal, {
70
+ "data-slot": "dialog-portal",
71
+ ...props
72
+ });
73
+ }
74
+ function DialogOverlay({
75
+ className,
76
+ ...props
77
+ }) {
78
+ return /* @__PURE__ */ jsx2(DialogPrimitive.Backdrop, {
79
+ "data-slot": "dialog-overlay",
80
+ className: cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className),
81
+ ...props
82
+ });
83
+ }
84
+ function DialogContent({
85
+ className,
86
+ children,
87
+ ...props
88
+ }) {
89
+ return /* @__PURE__ */ jsxs(DialogPortal, {
90
+ children: [
91
+ /* @__PURE__ */ jsx2(DialogOverlay, {}),
92
+ /* @__PURE__ */ jsxs(DialogPrimitive.Popup, {
93
+ "data-slot": "dialog-content",
94
+ className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
95
+ ...props,
96
+ children: [
97
+ children,
98
+ /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
99
+ className: "focus-visible:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:outline-none disabled:pointer-events-none",
100
+ children: [
101
+ /* @__PURE__ */ jsx2(XIcon, {
102
+ className: "size-4"
103
+ }),
104
+ /* @__PURE__ */ jsx2("span", {
105
+ className: "sr-only",
106
+ children: "Close"
107
+ })
108
+ ]
109
+ })
110
+ ]
111
+ })
112
+ ]
113
+ });
114
+ }
115
+ function DialogHeader({ className, ...props }) {
116
+ return /* @__PURE__ */ jsx2("div", {
117
+ "data-slot": "dialog-header",
118
+ className: cn("grid gap-1.5", className),
119
+ ...props
120
+ });
121
+ }
122
+ function DialogFooter({ className, ...props }) {
123
+ return /* @__PURE__ */ jsx2("div", {
124
+ "data-slot": "dialog-footer",
125
+ className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
126
+ ...props
127
+ });
128
+ }
129
+ function DialogTitle({
130
+ className,
131
+ ...props
132
+ }) {
133
+ return /* @__PURE__ */ jsx2(DialogPrimitive.Title, {
134
+ "data-slot": "dialog-title",
135
+ className: cn("text-lg font-medium", className),
136
+ ...props
137
+ });
138
+ }
139
+ function DialogDescription({
140
+ className,
141
+ ...props
142
+ }) {
143
+ return /* @__PURE__ */ jsx2(DialogPrimitive.Description, {
144
+ "data-slot": "dialog-description",
145
+ className: cn("text-sm text-muted-foreground", className),
146
+ ...props
147
+ });
148
+ }
149
+
150
+ // ../../src/services/opentelemetry/consent.ts
151
+ import { Effect, Option, Schema as Schema2 } from "effect";
152
+
153
+ // ../../src/services/opentelemetry/schema.ts
154
+ import { Schema } from "effect";
155
+ var BrowserAnalyticsPreference = Schema.Struct({
156
+ version: Schema.String,
157
+ choice: Schema.Literals(["accepted", "declined"]),
158
+ revision: Schema.String,
159
+ issuedAt: Schema.Finite,
160
+ expiresAt: Schema.Finite
161
+ }).annotate({ identifier: "BrowserAnalyticsPreference" });
162
+ var BrowserPrivacySignals = Schema.Struct({
163
+ globalPrivacyControl: Schema.optional(Schema.Boolean)
164
+ }).annotate({ identifier: "BrowserPrivacySignals" });
165
+ var BrowserWebVital = Schema.Struct({
166
+ name: Schema.Literals(["LCP", "INP", "CLS", "FCP", "TTFB"]),
167
+ id: Schema.NonEmptyString.check(Schema.isMaxLength(64)),
168
+ value: Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0)),
169
+ delta: Schema.Finite,
170
+ rating: Schema.Literals(["good", "needs-improvement", "poor"]),
171
+ navigationType: Schema.Literals([
172
+ "navigate",
173
+ "reload",
174
+ "back-forward",
175
+ "back-forward-cache",
176
+ "prerender",
177
+ "restore"
178
+ ])
179
+ }).annotate({ identifier: "BrowserWebVital" });
180
+ var EventAttributeValue = Schema.Union([
181
+ Schema.String,
182
+ Schema.Finite,
183
+ Schema.Boolean,
184
+ Schema.Array(Schema.String),
185
+ Schema.Array(Schema.Finite),
186
+ Schema.Array(Schema.Boolean)
187
+ ]);
188
+ var EventAttributesSchema = Schema.Record(Schema.String, EventAttributeValue).annotate({ identifier: "EventAttributes" });
189
+ var EventOptionsSchema = Schema.Struct({
190
+ userId: Schema.optional(Schema.NonEmptyString),
191
+ anonymousId: Schema.optional(Schema.NonEmptyString),
192
+ sessionId: Schema.optional(Schema.NonEmptyString),
193
+ messageId: Schema.optional(Schema.NonEmptyString),
194
+ timestamp: Schema.optional(Schema.DateTimeUtc),
195
+ context: Schema.optional(EventAttributesSchema)
196
+ }).annotate({ identifier: "EventOptions" });
197
+ var TelemetryEvent = Schema.Struct({
198
+ name: Schema.NonEmptyString,
199
+ properties: Schema.optional(EventAttributesSchema),
200
+ options: Schema.optional(EventOptionsSchema)
201
+ }).annotate({ identifier: "TelemetryEvent" });
202
+
203
+ // ../../src/services/opentelemetry/consent.ts
204
+ var ANALYTICS_CONSENT_COOKIE = "krakstack_analytics_consent";
205
+ var ANALYTICS_NOTICE_VERSION = "1";
206
+ var changedEvent = "krakstack:analytics-consent";
207
+ var lifetime = 180 * 24 * 60 * 60 * 1000;
208
+ var codec = Schema2.StringFromUriComponent.pipe(Schema2.decodeTo(Schema2.fromJsonString(BrowserAnalyticsPreference)));
209
+ var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(`${ANALYTICS_CONSENT_COOKIE}=`))?.slice(ANALYTICS_CONSENT_COOKIE.length + 1);
210
+ var analyticsPreference = (cookie, now = Date.now()) => {
211
+ const value = readCookie(cookie);
212
+ if (!value)
213
+ return;
214
+ const decoded = Schema2.decodeUnknownOption(codec)(value);
215
+ if (Option.isNone(decoded))
216
+ return;
217
+ const preference = decoded.value;
218
+ return preference.version === ANALYTICS_NOTICE_VERSION && preference.issuedAt <= now && preference.expiresAt > now && preference.expiresAt - preference.issuedAt <= lifetime ? preference : undefined;
219
+ };
220
+ var browserPrivacyEnabled = () => {
221
+ if (globalThis.navigator === undefined)
222
+ return false;
223
+ const value = Schema2.decodeUnknownOption(BrowserPrivacySignals)(navigator);
224
+ return navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || Option.isSome(value) && value.value.globalPrivacyControl === true;
225
+ };
226
+ var browserPreference = () => {
227
+ if (globalThis.document === undefined)
228
+ return;
229
+ const cookie = Effect.runSync(Effect.try({
230
+ try: () => document.cookie,
231
+ catch: () => new Error("Analytics preference storage unavailable")
232
+ }).pipe(Effect.catch(() => Effect.succeed(""))));
233
+ return analyticsPreference(cookie);
234
+ };
235
+ var consentGeneration = 0;
236
+ var previousSnapshot;
237
+ var analyticsConsentSnapshot = () => {
238
+ const preference = browserPreference();
239
+ const snapshot = browserPrivacyEnabled() ? "blocked" : preference ? `${preference.choice}:${preference.revision}` : "pending";
240
+ if (snapshot !== previousSnapshot) {
241
+ consentGeneration++;
242
+ previousSnapshot = snapshot;
243
+ }
244
+ return snapshot;
245
+ };
246
+ var saveAnalyticsPreference = (choice) => {
247
+ const issuedAt = Date.now();
248
+ const value = Schema2.encodeSync(codec)({
249
+ choice,
250
+ revision: crypto.randomUUID(),
251
+ version: ANALYTICS_NOTICE_VERSION,
252
+ issuedAt,
253
+ expiresAt: issuedAt + lifetime
254
+ });
255
+ document.cookie = `${ANALYTICS_CONSENT_COOKIE}=${value}; Path=/; Max-Age=${lifetime / 1000}; SameSite=Lax${location.protocol === "https:" ? "; Secure" : ""}`;
256
+ globalThis.dispatchEvent(new Event(changedEvent));
257
+ return analyticsPreference(document.cookie)?.choice === choice;
258
+ };
259
+ var subscribeAnalyticsConsent = (listener) => {
260
+ let previous = analyticsConsentSnapshot();
261
+ const notify = () => {
262
+ const next = analyticsConsentSnapshot();
263
+ if (next === previous)
264
+ return;
265
+ previous = next;
266
+ listener();
267
+ };
268
+ const timer = globalThis.setInterval(notify, 1000);
269
+ globalThis.addEventListener(changedEvent, notify);
270
+ globalThis.addEventListener("focus", notify);
271
+ document.addEventListener("visibilitychange", notify);
272
+ return () => {
273
+ globalThis.clearInterval(timer);
274
+ globalThis.removeEventListener(changedEvent, notify);
275
+ globalThis.removeEventListener("focus", notify);
276
+ document.removeEventListener("visibilitychange", notify);
277
+ };
278
+ };
279
+
280
+ // ../../src/services/events/client/tracking-notice.tsx
281
+ import { jsx as jsx3, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
282
+ var translations = {
283
+ en: {
284
+ preferences: "Analytics preferences",
285
+ title: "Help us improve this site",
286
+ description: "With your permission, we use visits and activity on this site to learn what’s helpful and make it better. It’s your choice.",
287
+ learnMore: "Learn more",
288
+ details: "If you accept, we’ll learn which pages are helpful and how people use the site so we can improve it. We’ll remember your choice for six months. You can change your mind at any time in Analytics preferences.",
289
+ essential: "If you decline, we won’t collect this usage data. Anonymous error reports and records needed to keep the site safe and working stay on either way.",
290
+ privacy: "Privacy policy",
291
+ accept: "Accept analytics",
292
+ decline: "Decline analytics",
293
+ close: "Close",
294
+ blocked: "Your browser asks us not to track, so usage analytics is off. Your saved choice hasn’t changed.",
295
+ accepted: "You’ve allowed usage analytics. You can turn it off below.",
296
+ declined: "You’ve declined usage analytics. You can change your choice below.",
297
+ pending: "Usage analytics is off unless you choose to accept.",
298
+ error: "We could not save your preference. Check that cookies are allowed and try again."
299
+ },
300
+ fr: {
301
+ preferences: "Préférences de mesure d’audience",
302
+ title: "Aidez-nous à améliorer ce site",
303
+ description: "Avec votre permission, nous utilisons les visites et l’activité sur ce site pour comprendre ce qui vous est utile et l’améliorer. C’est vous qui décidez.",
304
+ learnMore: "En savoir plus",
305
+ details: "Si vous acceptez, nous pourrons comprendre quelles pages sont utiles et comment le site est utilisé pour l’améliorer. Nous mémoriserons votre choix pendant six mois. Vous pouvez changer d’avis à tout moment dans les préférences de mesure d’audience.",
306
+ essential: "Si vous refusez, nous ne recueillerons pas ces données d’utilisation. Les rapports d’erreur anonymes et les données nécessaires à la sécurité et au bon fonctionnement du site restent actifs dans tous les cas.",
307
+ privacy: "Politique de confidentialité",
308
+ accept: "Accepter la mesure d’audience",
309
+ decline: "Refuser la mesure d’audience",
310
+ close: "Fermer",
311
+ blocked: "Votre navigateur nous demande de ne pas vous suivre : la mesure d’audience est donc désactivée. Votre choix enregistré n’a pas changé.",
312
+ accepted: "Vous avez accepté la mesure d’audience. Vous pouvez la désactiver ci-dessous.",
313
+ declined: "Vous avez refusé la mesure d’audience. Vous pouvez changer votre choix ci-dessous.",
314
+ pending: "La mesure d’audience reste désactivée tant que vous ne l’acceptez pas.",
315
+ error: "Impossible d’enregistrer votre préférence. Vérifiez que les témoins sont autorisés et réessayez."
316
+ }
317
+ };
318
+
319
+ class ConsentStorageError extends Schema3.TaggedError()("ConsentStorageError", {}) {
320
+ }
321
+ var TrackingNotice = ({
322
+ messages,
323
+ locale: localeOverride,
324
+ privacyHref
325
+ } = {}) => {
326
+ const locale = useKrakstackLocale(localeOverride);
327
+ const labels = {
328
+ ...locale.split("-")[0] === "fr" ? translations.fr : translations.en,
329
+ ...messages
330
+ };
331
+ const snapshot = useSyncExternalStore(subscribeAnalyticsConsent, analyticsConsentSnapshot, () => "server");
332
+ const [open, setOpen] = useState(false);
333
+ const [dismissed, setDismissed] = useState(false);
334
+ const [failed, setFailed] = useState(false);
335
+ const save = (choice) => {
336
+ const result = Effect2.runSync(Effect2.try({
337
+ try: () => saveAnalyticsPreference(choice),
338
+ catch: () => new ConsentStorageError
339
+ }).pipe(Effect2.catch(() => Effect2.succeed(false))));
340
+ setFailed(!result);
341
+ if (result)
342
+ setOpen(false);
343
+ };
344
+ const actions = /* @__PURE__ */ jsxs2(Fragment, {
345
+ children: [
346
+ /* @__PURE__ */ jsx3(Button, {
347
+ type: "button",
348
+ variant: "outline",
349
+ onClick: () => save("declined"),
350
+ children: labels.decline
351
+ }),
352
+ /* @__PURE__ */ jsx3(Button, {
353
+ type: "button",
354
+ disabled: snapshot === "blocked",
355
+ onClick: () => save("accepted"),
356
+ children: labels.accept
357
+ })
358
+ ]
359
+ });
360
+ const description = /* @__PURE__ */ jsxs2(Fragment, {
361
+ children: [
362
+ /* @__PURE__ */ jsx3("p", {
363
+ children: labels.description
364
+ }),
365
+ /* @__PURE__ */ jsx3("p", {
366
+ className: "mt-2",
367
+ children: labels.details
368
+ }),
369
+ /* @__PURE__ */ jsx3("p", {
370
+ className: "mt-2",
371
+ children: labels.essential
372
+ }),
373
+ privacyHref ? /* @__PURE__ */ jsx3("a", {
374
+ className: "mt-2 inline-block underline",
375
+ href: privacyHref,
376
+ children: labels.privacy
377
+ }) : null
378
+ ]
379
+ });
380
+ const status = snapshot === "blocked" ? labels.blocked : snapshot.startsWith("accepted:") ? labels.accepted : snapshot.startsWith("declined:") ? labels.declined : labels.pending;
381
+ return /* @__PURE__ */ jsxs2(Fragment, {
382
+ children: [
383
+ /* @__PURE__ */ jsx3("button", {
384
+ type: "button",
385
+ className: "text-muted-foreground hover:text-foreground text-sm underline",
386
+ onClick: () => {
387
+ setFailed(false);
388
+ setOpen(true);
389
+ },
390
+ children: labels.preferences
391
+ }),
392
+ snapshot === "pending" && !dismissed && !open ? createPortal(/* @__PURE__ */ jsxs2("section", {
393
+ "aria-label": labels.title,
394
+ className: "bg-card fixed inset-x-3 bottom-3 z-40 mx-auto max-w-3xl rounded-xl border p-5 shadow-xl sm:inset-x-6 sm:flex sm:items-center sm:gap-6",
395
+ children: [
396
+ /* @__PURE__ */ jsx3("button", {
397
+ type: "button",
398
+ "aria-label": labels.close,
399
+ className: "text-muted-foreground hover:text-foreground absolute top-2 right-2 rounded-sm p-1",
400
+ onClick: () => setDismissed(true),
401
+ children: /* @__PURE__ */ jsx3(XIcon2, {
402
+ className: "size-3.5"
403
+ })
404
+ }),
405
+ /* @__PURE__ */ jsxs2("div", {
406
+ className: "min-w-0 flex-1",
407
+ children: [
408
+ /* @__PURE__ */ jsx3("h2", {
409
+ className: "font-medium",
410
+ children: labels.title
411
+ }),
412
+ /* @__PURE__ */ jsxs2("p", {
413
+ className: "text-muted-foreground mt-2 text-sm leading-6",
414
+ children: [
415
+ labels.description,
416
+ " ",
417
+ privacyHref ? /* @__PURE__ */ jsx3("a", {
418
+ className: "underline",
419
+ href: privacyHref,
420
+ children: labels.learnMore
421
+ }) : /* @__PURE__ */ jsx3("button", {
422
+ type: "button",
423
+ className: "underline",
424
+ onClick: () => {
425
+ setFailed(false);
426
+ setOpen(true);
427
+ },
428
+ children: labels.learnMore
429
+ })
430
+ ]
431
+ })
432
+ ]
433
+ }),
434
+ /* @__PURE__ */ jsx3("div", {
435
+ className: "mt-4 flex shrink-0 gap-2 sm:mt-0",
436
+ children: actions
437
+ }),
438
+ failed ? /* @__PURE__ */ jsx3("p", {
439
+ role: "alert",
440
+ className: "text-destructive mt-3 text-sm sm:mt-0",
441
+ children: labels.error
442
+ }) : null
443
+ ]
444
+ }), document.body) : null,
445
+ /* @__PURE__ */ jsx3(Dialog, {
446
+ open,
447
+ onOpenChange: setOpen,
448
+ children: /* @__PURE__ */ jsxs2(DialogContent, {
449
+ children: [
450
+ /* @__PURE__ */ jsxs2(DialogHeader, {
451
+ children: [
452
+ /* @__PURE__ */ jsx3(DialogTitle, {
453
+ children: labels.title
454
+ }),
455
+ /* @__PURE__ */ jsx3(DialogDescription, {
456
+ children: status
457
+ })
458
+ ]
459
+ }),
460
+ /* @__PURE__ */ jsx3("div", {
461
+ className: "text-muted-foreground text-sm leading-6",
462
+ children: description
463
+ }),
464
+ failed ? /* @__PURE__ */ jsx3("p", {
465
+ role: "alert",
466
+ className: "text-destructive text-sm",
467
+ children: labels.error
468
+ }) : null,
469
+ /* @__PURE__ */ jsx3(DialogFooter, {
470
+ children: actions
471
+ })
472
+ ]
473
+ })
474
+ })
475
+ ]
476
+ });
477
+ };
478
+ export {
479
+ TrackingNotice
480
+ };
@@ -2,12 +2,15 @@ import { Config, Context, Crypto, DateTime, Effect, Layer, Redacted, Schema } fr
2
2
  import { HttpServerRequest } from "effect/http";
3
3
  import { OtlpLogsProcessor, OtlpProcessingError } from "../opentelemetry/processor.js";
4
4
  import { Otlp } from "../opentelemetry/index.js";
5
+ import { OtlpEvents } from "../opentelemetry/events.js";
5
6
  import { EventIdentity, EventGeolocation, EventConflictError, EventsPersistenceError } from "./schema.js";
6
7
  export declare const SESSION_TIMEOUT_MS: number;
7
8
  export type { EventGeolocation } from "./schema.js";
8
9
  export { AuditTarget, TrackEvent, EventLogRecord, ListAudit } from "./schema.js";
9
10
  export type EventGeolocationResolver = (request: HttpServerRequest.HttpServerRequest) => Effect.Effect<EventGeolocation | null, unknown>;
10
11
  export interface EventsOptions {
12
+ /** Enforce the shared browser preference for ingestion and request-scoped analytics. */
13
+ readonly requireConsent?: boolean;
11
14
  /** Defaults to the server's OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES. */
12
15
  readonly serviceName?: string;
13
16
  readonly origin: string;
@@ -205,14 +208,14 @@ declare const Events_base: Context.ServiceClass<Events, "krakstack/events/Events
205
208
  pageCount: number;
206
209
  };
207
210
  }, EventsPersistenceError | import("effect/Cause").NoSuchElementError | Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
208
- }, EventsConfigurationError, Crypto.Crypto | Otlp>;
211
+ }, EventsConfigurationError, Crypto.Crypto | Otlp | OtlpEvents>;
209
212
  };
210
213
  export declare class Events extends Events_base {
211
214
  /** Missing options resolve from APP_SECRET, VITE_SITE_URL and Otlp. */
212
- static readonly baseLayerWith: (options?: Partial<EventsOptions>) => Layer.Layer<Events, Config.ConfigError | EventsConfigurationError, Crypto.Crypto | Otlp>;
213
- static readonly baseLayer: Layer.Layer<Events, Config.ConfigError | EventsConfigurationError, Crypto.Crypto | Otlp>;
215
+ static readonly baseLayerWith: (options?: Partial<EventsOptions>) => Layer.Layer<Events, Config.ConfigError | EventsConfigurationError, Crypto.Crypto | Otlp | OtlpEvents>;
216
+ static readonly baseLayer: Layer.Layer<Events, Config.ConfigError | EventsConfigurationError, Crypto.Crypto | Otlp | OtlpEvents>;
214
217
  /** An injected PostgreSQL/SQLite SqlClient enables persistence and the initial migration. */
215
- static readonly layerWith: (options?: Partial<EventsOptions>) => Layer.Layer<Events, Config.ConfigError | EventsConfigurationError | import("effect/sql/Migrator").MigrationError | import("effect/sql/SqlError").SqlError, Crypto.Crypto | Otlp>;
216
- static readonly layer: Layer.Layer<Events, Config.ConfigError | EventsConfigurationError | import("effect/sql/Migrator").MigrationError | import("effect/sql/SqlError").SqlError, Crypto.Crypto | Otlp>;
218
+ static readonly layerWith: (options?: Partial<EventsOptions>) => Layer.Layer<Events, Config.ConfigError | EventsConfigurationError | import("effect/sql/Migrator").MigrationError | import("effect/sql/SqlError").SqlError, Crypto.Crypto | Otlp | OtlpEvents>;
219
+ static readonly layer: Layer.Layer<Events, Config.ConfigError | EventsConfigurationError | import("effect/sql/Migrator").MigrationError | import("effect/sql/SqlError").SqlError, Crypto.Crypto | Otlp | OtlpEvents>;
217
220
  static readonly ingestionLayer: Layer.Layer<OtlpLogsProcessor, never, Events>;
218
221
  }