@krak-stack/registry 0.1.52 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @krak-stack/registry
2
2
 
3
+ ## 0.1.54
4
+
5
+ ### Patch Changes
6
+
7
+ - Emit newly persisted server events through `Otlp.event` as well as SQL, preserving enriched attributes, event IDs, timestamps, and trace context in the application event scope. Duplicate retries and conflicts do not emit again. OTLP delivery remains best effort and is not atomic with an outer application transaction.
8
+ - Export server events when SQL persistence is not configured; `inserted: false` then means no database row was written, not that telemetry was suppressed.
9
+
10
+ - Add `TrackingNotice` with English/French defaults, optional copy overrides, a custom privacy-policy link, and persistent analytics preferences. Import it from `@krak-stack/registry/events/tracking-notice`.
11
+ - Require consent by default for BrowserEvents and BrowserWebVitals. Remember choices for 180 days, honor DNT/GPC, and invalidate unsent events after withdrawal. Existing consumers must mount the notice or explicitly configure `requireConsent: false`.
12
+ - Add optional server consent enforcement through `Events.layerWith({ requireConsent: true })`, while preserving necessary audit recording. Keep essential browser error reporting independent, with sanitized messages and stack locations.
13
+ - Collect Web Vitals only when consent predates navigation; withdrawal disables it for the rest of the document. Already-started exports, including retries, may finish after withdrawal.
14
+ - Reorganize Events and OpenTelemetry documentation around setup and practical examples.
15
+
16
+ ## 0.1.53
17
+
18
+ ### Patch Changes
19
+
20
+ - Use Effect Crypto for secret-salted SHA-256 visitor IDs and generated UUIDv7 event and visit IDs. Applications must provide a platform Crypto layer alongside Otlp. The versioned visitor derivation changes IDs from the previous HMAC algorithm.
21
+
22
+ Replace the Events layer factories with default `Events.layer` / `Events.baseLayer` values and partial `Events.layerWith(options)` / `Events.baseLayerWith(options)` overrides. Missing secret and origin options read server-only `APP_SECRET` and the origin of `VITE_SITE_URL`; explicit values skip their environment lookup. Geolocation remains opt-in. Migrate existing `Events.layer(options)` and `Events.baseLayer(options)` calls to their With counterparts.
23
+
3
24
  ## 0.1.52
4
25
 
5
26
  ### Patch Changes
@@ -1,11 +1,14 @@
1
1
  import type { EventAttributes } from "../opentelemetry/schema.js";
2
2
  import { OtlpEvents } from "../opentelemetry/events.js";
3
3
  import { Context, Effect, Layer, Schema } from "effect";
4
+ export { analyticsAllowed, analyticsConsentSnapshot, saveAnalyticsPreference, subscribeAnalyticsConsent, } from "../opentelemetry/consent.js";
4
5
  import { BrowserEventOptions, type BrowserPageOptions } from "./schema.js";
5
6
  export type { BrowserEventOptions, BrowserPageOptions } from "./schema.js";
6
7
  export type { EventAttributes } from "../opentelemetry/schema.js";
7
8
  export interface BrowserEventsOptions {
8
9
  readonly enabled?: boolean;
10
+ /** Opt in to the shared notice policy. Defaults to true. */
11
+ readonly requireConsent?: boolean;
9
12
  readonly respectDoNotTrack?: boolean;
10
13
  readonly pageViews?: boolean;
11
14
  readonly locale?: () => string;
@@ -14,6 +17,7 @@ export interface BrowserEventsOptions {
14
17
  }
15
18
  declare const BrowserEventsClient_base: Context.ServiceClass<BrowserEventsClient, "krakstack/events/BrowserEventsClient", {
16
19
  readonly events: OtlpEvents["Service"];
20
+ readonly allowed: () => boolean;
17
21
  readonly context: (name: string, properties?: EventAttributes) => EventAttributes;
18
22
  }>;
19
23
  declare class BrowserEventsClient extends BrowserEventsClient_base {
@@ -22,5 +26,5 @@ export declare class BrowserEvents {
22
26
  static readonly track: (name: string, properties?: EventAttributes, options?: BrowserEventOptions) => Effect.Effect<void, Schema.SchemaError, never>;
23
27
  static readonly page: (options?: BrowserPageOptions) => Effect.Effect<void, Schema.SchemaError, never>;
24
28
  /** Requires BrowserOtlp; no identifiers are persisted. */
25
- static readonly layer: ({ enabled, respectDoNotTrack, pageViews, locale, sanitizePath, }?: BrowserEventsOptions) => Layer.Layer<BrowserEventsClient, never, OtlpEvents>;
29
+ static readonly layer: ({ enabled, requireConsent, respectDoNotTrack, pageViews, locale, sanitizePath, }?: BrowserEventsOptions) => Layer.Layer<BrowserEventsClient, never, OtlpEvents>;
26
30
  }