@krak-stack/registry 0.11.5 → 0.11.7

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 (47) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/components/audit-log-table/classes.d.ts +1 -0
  3. package/dist/components/audit-log-table/html.d.ts +158 -0
  4. package/dist/components/audit-log-table/html.js +3260 -0
  5. package/dist/components/audit-log-table/index.d.ts +37 -0
  6. package/dist/components/audit-log-table/react.d.ts +3 -51
  7. package/dist/components/audit-log-table/react.js +246 -92
  8. package/dist/components/audit-log-table/schema.d.ts +122 -0
  9. package/dist/components/copy-button/html.d.ts +2 -2
  10. package/dist/components/danger-confirmation/index.d.ts +2 -2
  11. package/dist/components/data-table/classes.d.ts +10 -3
  12. package/dist/components/data-table/html.d.ts +93 -21
  13. package/dist/components/data-table/html.js +122 -32
  14. package/dist/components/data-table/index.d.ts +97 -9
  15. package/dist/components/data-table/react.d.ts +14 -3
  16. package/dist/components/data-table/react.js +162 -19
  17. package/dist/components/data-table/schema.d.ts +175 -16
  18. package/dist/components/date-input/html.d.ts +2 -2
  19. package/dist/components/docs/html.js +1 -1
  20. package/dist/components/editable-text/html.d.ts +2 -2
  21. package/dist/components/editable-text/index.d.ts +4 -4
  22. package/dist/components/editing-locale-switcher/html.d.ts +2 -2
  23. package/dist/components/email-editor/legacy-editor.html.d.ts +6 -6
  24. package/dist/components/form/react.d.ts +5 -5
  25. package/dist/components/locale-switcher/html.d.ts +2 -2
  26. package/dist/components/map-menu/html.d.ts +4 -4
  27. package/dist/components/presence-transition/index.d.ts +2 -2
  28. package/dist/components/select-with-custom-input/html.d.ts +2 -2
  29. package/dist/components/sidebar-layout/html.js +1 -1
  30. package/dist/components/switch/react.d.ts +14 -0
  31. package/dist/components/switch/react.js +55 -0
  32. package/dist/components/theme-switcher/html.d.ts +2 -2
  33. package/dist/components/tracking-notice/classes.d.ts +6 -0
  34. package/dist/components/tracking-notice/html.d.ts +85 -0
  35. package/dist/components/tracking-notice/html.js +354 -0
  36. package/dist/components/tracking-notice/index.d.ts +95 -0
  37. package/dist/components/tracking-notice/react.d.ts +5 -27
  38. package/dist/components/tracking-notice/react.js +189 -59
  39. package/dist/components/tracking-notice/schema.d.ts +45 -0
  40. package/dist/components/upload-attachment/html.d.ts +4 -4
  41. package/dist/components/virtualized-combobox/html.d.ts +3 -3
  42. package/dist/components/webhook-delivery-table/html.js +122 -32
  43. package/dist/components/webhook-delivery-table/react.js +162 -19
  44. package/dist/services/events/browser.js +39 -26
  45. package/dist/services/events/index.js +23 -19
  46. package/dist/services/opentelemetry/web-vitals.js +27 -23
  47. package/package.json +9 -1
@@ -0,0 +1,354 @@
1
+ // ../../src/components/tracking-notice/html.ts
2
+ import { Html } from "effect/ui/html";
3
+ import { Dialog } from "effect/ui/kit";
4
+ import { Button } from "@/components/effectcn/button";
5
+ import {
6
+ DialogBackdrop,
7
+ DialogCloseIcon,
8
+ DialogDescription,
9
+ DialogHeader,
10
+ DialogPopup,
11
+ DialogTitle,
12
+ DialogViewport
13
+ } from "@/components/effectcn/dialog";
14
+ import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
15
+ import { X } from "@krak-stack/registry/lucide-effect";
16
+
17
+ // ../../src/components/tracking-notice/classes.ts
18
+ var trackingNoticeClasses = {
19
+ trigger: "text-muted-foreground hover:text-foreground text-sm underline",
20
+ banner: "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",
21
+ dismiss: "text-muted-foreground hover:text-foreground absolute top-2 right-2 rounded-sm p-1",
22
+ bannerActions: "mt-4 flex shrink-0 flex-wrap gap-2 sm:mt-0"
23
+ };
24
+
25
+ // ../../src/components/tracking-notice/index.ts
26
+ import { Effect as Effect2, Queue, Schema as Schema4, Stream } from "effect";
27
+ import { Command, Component, Subscription, UiSchema } from "effect/ui";
28
+
29
+ // ../../src/services/opentelemetry/consent.ts
30
+ import * as Data from "effect/Data";
31
+ import { SecureRandom } from "effect/crypto";
32
+ import { Effect, Option, Schema as Schema2 } from "effect";
33
+
34
+ // ../../src/services/opentelemetry/schema.ts
35
+ import { Schema } from "effect";
36
+ var BrowserAnalyticsPreference = Schema.Struct({
37
+ version: Schema.String,
38
+ choice: Schema.Literals(["accepted", "declined"]),
39
+ revision: Schema.String,
40
+ issuedAt: Schema.Finite,
41
+ expiresAt: Schema.Finite
42
+ }).annotate({ identifier: "BrowserAnalyticsPreference" });
43
+ var BrowserPrivacySignals = Schema.Struct({
44
+ globalPrivacyControl: Schema.optional(Schema.Boolean)
45
+ }).annotate({ identifier: "BrowserPrivacySignals" });
46
+ var BrowserWebVital = Schema.Struct({
47
+ name: Schema.Literals(["LCP", "INP", "CLS", "FCP", "TTFB"]),
48
+ id: Schema.NonEmptyString.check(Schema.isMaxLength(64)),
49
+ value: Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0)),
50
+ delta: Schema.Finite,
51
+ rating: Schema.Literals(["good", "needs-improvement", "poor"]),
52
+ navigationType: Schema.Literals([
53
+ "navigate",
54
+ "reload",
55
+ "back-forward",
56
+ "back-forward-cache",
57
+ "prerender",
58
+ "restore"
59
+ ])
60
+ }).annotate({ identifier: "BrowserWebVital" });
61
+ var EventAttributeValue = Schema.Union([
62
+ Schema.String,
63
+ Schema.Finite,
64
+ Schema.Boolean,
65
+ Schema.Array(Schema.String),
66
+ Schema.Array(Schema.Finite),
67
+ Schema.Array(Schema.Boolean)
68
+ ]);
69
+ var EventAttributesSchema = Schema.Record(Schema.String, EventAttributeValue).annotate({ identifier: "EventAttributes" });
70
+ var EventPropertiesSchema = Schema.Record(Schema.String, Schema.Json).annotate({ identifier: "EventProperties" });
71
+ var EventOptionsSchema = Schema.Struct({
72
+ userId: Schema.optional(Schema.NonEmptyString),
73
+ anonymousId: Schema.optional(Schema.NonEmptyString),
74
+ sessionId: Schema.optional(Schema.NonEmptyString),
75
+ messageId: Schema.optional(Schema.NonEmptyString),
76
+ timestamp: Schema.optional(Schema.DateTimeUtc),
77
+ context: Schema.optional(EventAttributesSchema)
78
+ }).annotate({ identifier: "EventOptions" });
79
+ var TelemetryEvent = Schema.Struct({
80
+ name: Schema.NonEmptyString,
81
+ properties: Schema.optional(EventPropertiesSchema),
82
+ options: Schema.optional(EventOptionsSchema)
83
+ }).annotate({ identifier: "TelemetryEvent" });
84
+
85
+ // ../../src/services/opentelemetry/consent.ts
86
+ class AnalyticsPreferenceStorageError extends Data.TaggedError("AnalyticsPreferenceStorageError") {
87
+ }
88
+ var ANALYTICS_CONSENT_COOKIE = "krakstack_analytics_consent";
89
+ var ANALYTICS_NOTICE_VERSION = "1";
90
+ var changedEvent = "krakstack:analytics-consent";
91
+ var lifetime = 180 * 24 * 60 * 60 * 1000;
92
+ var cookiePrefix = `${ANALYTICS_CONSENT_COOKIE}=`;
93
+ var codec = Schema2.StringFromUriComponent.pipe(Schema2.decodeTo(Schema2.fromJsonString(BrowserAnalyticsPreference)));
94
+ var decodePreference = Schema2.decodeOption(codec);
95
+ var encodePreference = Schema2.encodeSync(codec);
96
+ var decodePrivacySignals = Schema2.decodeUnknownOption(BrowserPrivacySignals);
97
+ var readCookie = (cookie) => cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith(cookiePrefix))?.slice(cookiePrefix.length);
98
+ var analyticsPreference = (cookie, now = Date.now()) => {
99
+ const value = readCookie(cookie);
100
+ if (!value)
101
+ return;
102
+ const decoded = decodePreference(value);
103
+ if (Option.isNone(decoded))
104
+ return;
105
+ const preference = decoded.value;
106
+ return preference.version === ANALYTICS_NOTICE_VERSION && preference.issuedAt <= now && preference.expiresAt > now && preference.expiresAt - preference.issuedAt <= lifetime ? preference : undefined;
107
+ };
108
+ var browserPrivacyEnabled = () => {
109
+ if (globalThis.navigator === undefined)
110
+ return false;
111
+ const value = decodePrivacySignals(navigator);
112
+ return navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || Option.isSome(value) && value.value.globalPrivacyControl === true;
113
+ };
114
+ var cookieOperation = (operation) => Effect.try({
115
+ try: operation,
116
+ catch: (cause) => new AnalyticsPreferenceStorageError({
117
+ message: "Analytics preference storage unavailable",
118
+ cause
119
+ })
120
+ });
121
+ var browserPreference = () => analyticsPreference(Effect.runSync(cookieOperation(() => globalThis.document?.cookie ?? "").pipe(Effect.orElseSucceed(() => ""))));
122
+ var consentGeneration = 0;
123
+ var previousSnapshot;
124
+ var observeBrowserConsent = () => {
125
+ const blocked = browserPrivacyEnabled();
126
+ const preference = blocked ? undefined : browserPreference();
127
+ const snapshot = blocked ? "blocked" : preference ? `${preference.choice}:${preference.revision}` : "pending";
128
+ if (snapshot !== previousSnapshot) {
129
+ consentGeneration++;
130
+ previousSnapshot = snapshot;
131
+ }
132
+ return { preference, snapshot, generation: consentGeneration };
133
+ };
134
+ var analyticsConsentSnapshot = () => observeBrowserConsent().snapshot;
135
+ var saveAnalyticsPreference = (choice) => {
136
+ const host = globalThis.document;
137
+ if (host === undefined)
138
+ return false;
139
+ const issuedAt = Date.now();
140
+ const revision = Effect.runSync(SecureRandom.SecureRandom.use((random) => random.uuidV7()).pipe(Effect.provide(SecureRandom.layerWebCrypto)));
141
+ const value = encodePreference({
142
+ choice,
143
+ revision,
144
+ version: ANALYTICS_NOTICE_VERSION,
145
+ issuedAt,
146
+ expiresAt: issuedAt + lifetime
147
+ });
148
+ const secure = host.location?.protocol === "https:" ? "; Secure" : "";
149
+ const written = Effect.runSync(cookieOperation(() => {
150
+ host.cookie = `${cookiePrefix}${value}; Path=/; Max-Age=${lifetime / 1000}; SameSite=Lax${secure}`;
151
+ return true;
152
+ }).pipe(Effect.orElseSucceed(() => false)));
153
+ if (!written)
154
+ return false;
155
+ const saved = browserPreference();
156
+ globalThis.dispatchEvent(new Event(changedEvent));
157
+ return saved?.choice === choice && saved.revision === revision;
158
+ };
159
+ var subscribeAnalyticsConsent = (listener) => {
160
+ let previous = analyticsConsentSnapshot();
161
+ const notify = () => {
162
+ const next = analyticsConsentSnapshot();
163
+ if (next === previous)
164
+ return;
165
+ previous = next;
166
+ listener();
167
+ };
168
+ const timer = globalThis.setInterval(notify, 1000);
169
+ globalThis.addEventListener(changedEvent, notify);
170
+ globalThis.addEventListener("focus", notify);
171
+ document.addEventListener("visibilitychange", notify);
172
+ return () => {
173
+ globalThis.clearInterval(timer);
174
+ globalThis.removeEventListener(changedEvent, notify);
175
+ globalThis.removeEventListener("focus", notify);
176
+ document.removeEventListener("visibilitychange", notify);
177
+ };
178
+ };
179
+
180
+ // ../../src/components/tracking-notice/schema.ts
181
+ import { Schema as Schema3 } from "effect";
182
+ var Text = Schema3.optional(Schema3.String);
183
+ var Messages = Schema3.Struct({
184
+ preferences: Text,
185
+ title: Text,
186
+ description: Text,
187
+ learnMore: Text,
188
+ details: Text,
189
+ essential: Text,
190
+ privacy: Text,
191
+ accept: Text,
192
+ decline: Text,
193
+ close: Text,
194
+ blocked: Text,
195
+ accepted: Text,
196
+ declined: Text,
197
+ pending: Text,
198
+ error: Text
199
+ }).annotate({ identifier: "TrackingNoticeMessages" });
200
+ var TrackingNoticePropsSchema = Schema3.Struct({
201
+ messages: Schema3.optional(Messages),
202
+ locale: Text,
203
+ privacyHref: Text
204
+ }).annotate({ identifier: "TrackingNoticeProps" });
205
+
206
+ // ../../src/components/tracking-notice/index.ts
207
+ var TrackingChoice = Schema4.Literals(["accepted", "declined"]);
208
+ var browserPreferences = {
209
+ subscribe: subscribeAnalyticsConsent,
210
+ getSnapshot: analyticsConsentSnapshot,
211
+ save: saveAnalyticsPreference
212
+ };
213
+
214
+ class ConsentStorageError extends Schema4.TaggedError()("ConsentStorageError", {}) {
215
+ }
216
+ var defaultMessages = {
217
+ en: {
218
+ preferences: "Analytics preferences",
219
+ title: "Help us improve this site",
220
+ 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.",
221
+ learnMore: "Learn more",
222
+ 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.",
223
+ 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.",
224
+ privacy: "Privacy policy",
225
+ accept: "Accept analytics",
226
+ decline: "Decline analytics",
227
+ close: "Close",
228
+ blocked: "Your browser asks us not to track, so usage analytics is off. Your saved choice hasn’t changed.",
229
+ accepted: "You’ve allowed usage analytics. You can turn it off below.",
230
+ declined: "You’ve declined usage analytics. You can change your choice below.",
231
+ pending: "Usage analytics is off unless you choose to accept.",
232
+ error: "We could not save your preference. Check that cookies are allowed and try again."
233
+ },
234
+ fr: {
235
+ preferences: "Préférences de mesure d’audience",
236
+ title: "Aidez-nous à améliorer ce site",
237
+ 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.",
238
+ learnMore: "En savoir plus",
239
+ 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.",
240
+ 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.",
241
+ privacy: "Politique de confidentialité",
242
+ accept: "Accepter la mesure d’audience",
243
+ decline: "Refuser la mesure d’audience",
244
+ close: "Fermer",
245
+ 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é.",
246
+ accepted: "Vous avez accepté la mesure d’audience. Vous pouvez la désactiver ci-dessous.",
247
+ declined: "Vous avez refusé la mesure d’audience. Vous pouvez changer votre choix ci-dessous.",
248
+ pending: "La mesure d’audience reste désactivée tant que vous ne l’acceptez pas.",
249
+ error: "Impossible d’enregistrer votre préférence. Vérifiez que les témoins sont autorisés et réessayez."
250
+ }
251
+ };
252
+ var trackingNoticeMessages = (locale, overrides) => {
253
+ const defaults = locale.split("-")[0] === "fr" ? defaultMessages.fr : defaultMessages.en;
254
+ return {
255
+ ...defaults,
256
+ ...Object.fromEntries(Object.entries(overrides ?? {}).filter(([, value]) => value !== undefined))
257
+ };
258
+ };
259
+ var trackingNoticeStatus = (snapshot, labels) => snapshot === "blocked" ? labels.blocked : snapshot.startsWith("accepted:") ? labels.accepted : snapshot.startsWith("declined:") ? labels.declined : labels.pending;
260
+ var TrackingNoticeMessage = UiSchema.TaggedEnum({
261
+ Opened: {},
262
+ Closed: {},
263
+ Dismissed: {},
264
+ ChoiceRequested: { choice: TrackingChoice },
265
+ Saved: { success: Schema4.Boolean },
266
+ SnapshotChanged: { snapshot: Schema4.String }
267
+ });
268
+ var trackingNoticeOptions = {
269
+ name: "TrackingNotice",
270
+ props: TrackingNoticePropsSchema,
271
+ model: Schema4.Struct({
272
+ open: Schema4.Boolean,
273
+ dismissed: Schema4.Boolean,
274
+ failed: Schema4.Boolean,
275
+ snapshot: Schema4.String
276
+ }).annotate({ identifier: "TrackingNoticeModel" }),
277
+ message: TrackingNoticeMessage,
278
+ restore: false
279
+ };
280
+ var trackingNoticeBehaviours = (preferences) => {
281
+ const watch = Subscription.make("TrackingNotice/Watch", Stream.callback((queue) => Effect2.acquireRelease(Effect2.sync(() => {
282
+ const notify = () => {
283
+ Queue.offerUnsafe(queue, TrackingNoticeMessage.SnapshotChanged({
284
+ snapshot: preferences.getSnapshot()
285
+ }));
286
+ };
287
+ const unsubscribe = preferences.subscribe(notify);
288
+ notify();
289
+ return unsubscribe;
290
+ }), (unsubscribe) => Effect2.sync(unsubscribe))));
291
+ const Save = Command.make("TrackingNotice/Save", { args: { choice: TrackingChoice } }, ({ choice }) => Effect2.try({
292
+ try: () => !(choice === "accepted" && preferences.getSnapshot() === "blocked") && preferences.save(choice),
293
+ catch: () => new ConsentStorageError
294
+ }).pipe(Effect2.orElseSucceed(() => false), Effect2.map((success) => TrackingNoticeMessage.Saved({ success }))));
295
+ const update = Component.define(trackingNoticeOptions).update({
296
+ Opened: ($) => $.evolve({ open: true, failed: false }),
297
+ Closed: ($) => $.evolve({ open: false }),
298
+ Dismissed: ($) => $.evolve({ dismissed: true }),
299
+ ChoiceRequested: ($, { choice }) => $.run(Save.make({ choice })),
300
+ Saved: ($, { success }) => $.evolve({ failed: !success, open: !success && $.model.open }),
301
+ SnapshotChanged: ($, { snapshot }) => $.evolve({ snapshot })
302
+ });
303
+ return {
304
+ init: () => ({
305
+ open: false,
306
+ dismissed: false,
307
+ failed: false,
308
+ snapshot: "server"
309
+ }),
310
+ update,
311
+ subscriptions: () => [watch]
312
+ };
313
+ };
314
+
315
+ // ../../src/components/tracking-notice/html.ts
316
+ var makeTrackingNotice = (preferences) => Html.component({
317
+ ...trackingNoticeOptions,
318
+ reads: { locale: krakstackLocaleRead }
319
+ }).make({
320
+ ...trackingNoticeBehaviours(preferences),
321
+ view: (h, { open, dismissed, failed, snapshot }) => {
322
+ const { privacyHref, messages } = h.props;
323
+ const copy = trackingNoticeMessages(h.props.locale ?? h.reads.locale?.locale ?? "en", messages);
324
+ const actions = () => [
325
+ Button(h, {
326
+ variant: "outline",
327
+ onPress: TrackingNoticeMessage.ChoiceRequested({ choice: "declined" })
328
+ }).children(copy.decline),
329
+ Button(h, {
330
+ props: { disabled: snapshot === "blocked" },
331
+ onPress: TrackingNoticeMessage.ChoiceRequested({ choice: "accepted" })
332
+ }).children(copy.accept)
333
+ ];
334
+ const failure = () => failed && h.p.attr("role", "alert").class("text-destructive text-sm").children(copy.error);
335
+ return h.div.class("contents").children(snapshot === "pending" && !dismissed && !open && h.section.attr("aria-label", copy.title).class(trackingNoticeClasses.banner).children(h.button.attr("type", "button").attr("aria-label", copy.close).class(trackingNoticeClasses.dismiss).on("click", TrackingNoticeMessage.Dismissed()).children(X(h, { size: 14 })), h.div.class("min-w-0 flex-1").children(h.h2.class("font-medium").children(copy.title), h.p.class("text-muted-foreground mt-2 text-sm leading-6").children(copy.description, " ", privacyHref ? h.a.class("underline").attr("href", privacyHref).children(copy.learnMore) : h.button.attr("type", "button").class("underline").on("click", TrackingNoticeMessage.Opened()).children(copy.learnMore))), h.div.class(trackingNoticeClasses.bannerActions).children(actions()), failure()), Dialog(h, {
336
+ props: { open },
337
+ onEmit: {
338
+ RequestedOpen: () => TrackingNoticeMessage.Opened(),
339
+ RequestedClose: () => TrackingNoticeMessage.Closed(),
340
+ Settled: () => {
341
+ return;
342
+ }
343
+ },
344
+ view: (dialog) => h.div.class("contents").children(dialog.trigger(h.button.class(trackingNoticeClasses.trigger)).children(copy.preferences), dialog.portal(h.div.class("relative z-50"))?.children(DialogBackdrop(h, dialog), DialogViewport(h, dialog).children(DialogPopup(h, dialog, {
345
+ class: "overflow-y-auto"
346
+ }).children(DialogCloseIcon(h, dialog, { label: copy.close }), DialogHeader(h).children(DialogTitle(h, dialog).children(copy.title), DialogDescription(h, dialog).children(trackingNoticeStatus(snapshot, copy))), h.div.class("text-muted-foreground space-y-2 text-sm leading-6").children(h.p.children(copy.description), h.p.children(copy.details), h.p.children(copy.essential), !!privacyHref && h.a.class("inline-block underline").attr("href", privacyHref).children(copy.privacy)), failure(), h.div.class("flex flex-wrap justify-end gap-2").children(actions())))))
347
+ }));
348
+ }
349
+ });
350
+ var TrackingNotice = makeTrackingNotice(browserPreferences);
351
+ export {
352
+ TrackingNotice,
353
+ makeTrackingNotice
354
+ };
@@ -0,0 +1,95 @@
1
+ import { Schema } from "effect";
2
+ import { Component, Subscription, UiSchema } from "effect/ui";
3
+ import { type TrackingNoticeMessages, type TrackingNoticeProps } from "./schema.js";
4
+ export declare const TrackingChoice: Schema.Literals<readonly ["accepted", "declined"]>;
5
+ type TrackingChoice = typeof TrackingChoice.Type;
6
+ export interface TrackingNoticePreferenceStore {
7
+ readonly subscribe: (listener: () => void) => () => void;
8
+ readonly getSnapshot: () => string;
9
+ readonly save: (choice: TrackingChoice) => boolean;
10
+ }
11
+ export declare const browserPreferences: TrackingNoticePreferenceStore;
12
+ export declare const trackingNoticeMessages: (locale: string, overrides?: TrackingNoticeProps["messages"]) => TrackingNoticeMessages;
13
+ export declare const trackingNoticeStatus: (snapshot: string, labels: TrackingNoticeMessages) => string;
14
+ export declare const TrackingNoticeMessage: UiSchema.TaggedEnum<{
15
+ readonly ChoiceRequested: Schema.TaggedStruct<"ChoiceRequested", {
16
+ readonly choice: Schema.Literals<readonly ["accepted", "declined"]>;
17
+ }>;
18
+ readonly Closed: Schema.TaggedStruct<"Closed", {}>;
19
+ readonly Dismissed: Schema.TaggedStruct<"Dismissed", {}>;
20
+ readonly Opened: Schema.TaggedStruct<"Opened", {}>;
21
+ readonly Saved: Schema.TaggedStruct<"Saved", {
22
+ readonly success: Schema.Boolean;
23
+ }>;
24
+ readonly SnapshotChanged: Schema.TaggedStruct<"SnapshotChanged", {
25
+ readonly snapshot: Schema.String;
26
+ }>;
27
+ }>;
28
+ export declare const trackingNoticeOptions: {
29
+ readonly name: "TrackingNotice";
30
+ readonly props: Schema.Struct<{
31
+ readonly messages: Schema.optional<Schema.Struct<{
32
+ readonly preferences: Schema.optional<Schema.String>;
33
+ readonly title: Schema.optional<Schema.String>;
34
+ readonly description: Schema.optional<Schema.String>;
35
+ readonly learnMore: Schema.optional<Schema.String>;
36
+ readonly details: Schema.optional<Schema.String>;
37
+ readonly essential: Schema.optional<Schema.String>;
38
+ readonly privacy: Schema.optional<Schema.String>;
39
+ readonly accept: Schema.optional<Schema.String>;
40
+ readonly decline: Schema.optional<Schema.String>;
41
+ readonly close: Schema.optional<Schema.String>;
42
+ readonly blocked: Schema.optional<Schema.String>;
43
+ readonly accepted: Schema.optional<Schema.String>;
44
+ readonly declined: Schema.optional<Schema.String>;
45
+ readonly pending: Schema.optional<Schema.String>;
46
+ readonly error: Schema.optional<Schema.String>;
47
+ }>>;
48
+ readonly locale: Schema.optional<Schema.String>;
49
+ readonly privacyHref: Schema.optional<Schema.String>;
50
+ }>;
51
+ readonly model: Schema.Struct<{
52
+ readonly open: Schema.Boolean;
53
+ readonly dismissed: Schema.Boolean;
54
+ readonly failed: Schema.Boolean;
55
+ readonly snapshot: Schema.String;
56
+ }>;
57
+ readonly message: UiSchema.TaggedEnum<{
58
+ readonly ChoiceRequested: Schema.TaggedStruct<"ChoiceRequested", {
59
+ readonly choice: Schema.Literals<readonly ["accepted", "declined"]>;
60
+ }>;
61
+ readonly Closed: Schema.TaggedStruct<"Closed", {}>;
62
+ readonly Dismissed: Schema.TaggedStruct<"Dismissed", {}>;
63
+ readonly Opened: Schema.TaggedStruct<"Opened", {}>;
64
+ readonly Saved: Schema.TaggedStruct<"Saved", {
65
+ readonly success: Schema.Boolean;
66
+ }>;
67
+ readonly SnapshotChanged: Schema.TaggedStruct<"SnapshotChanged", {
68
+ readonly snapshot: Schema.String;
69
+ }>;
70
+ }>;
71
+ readonly restore: false;
72
+ };
73
+ type Model = typeof trackingNoticeOptions.model.Type;
74
+ type Message = typeof TrackingNoticeMessage.Type;
75
+ export declare const trackingNoticeBehaviours: (preferences: TrackingNoticePreferenceStore) => {
76
+ init: () => Model;
77
+ update: (context: Component.Update<Model, Message, never, TrackingNoticeProps>, message: Message) => Model | Component.Step<Model, Message, never>;
78
+ subscriptions: () => Subscription.Subscription<{
79
+ readonly _tag: "Closed";
80
+ } | {
81
+ readonly _tag: "Opened";
82
+ } | {
83
+ readonly _tag: "Dismissed";
84
+ } | {
85
+ readonly _tag: "ChoiceRequested";
86
+ readonly choice: "accepted" | "declined";
87
+ } | {
88
+ readonly _tag: "Saved";
89
+ readonly success: boolean;
90
+ } | {
91
+ readonly _tag: "SnapshotChanged";
92
+ readonly snapshot: string;
93
+ }, never>[];
94
+ };
95
+ export {};
@@ -1,30 +1,8 @@
1
- export interface TrackingNoticePreferenceStore {
2
- readonly subscribe: (listener: () => void) => () => void;
3
- readonly getSnapshot: () => string;
4
- readonly save: (choice: "accepted" | "declined") => boolean;
5
- }
6
- export interface TrackingNoticeMessages {
7
- readonly preferences: string;
8
- readonly title: string;
9
- readonly description: string;
10
- readonly learnMore: string;
11
- readonly details: string;
12
- readonly essential: string;
13
- readonly privacy: string;
14
- readonly accept: string;
15
- readonly decline: string;
16
- readonly close: string;
17
- readonly blocked: string;
18
- readonly accepted: string;
19
- readonly declined: string;
20
- readonly pending: string;
21
- readonly error: string;
22
- }
1
+ import { type TrackingNoticePreferenceStore } from "./index.js";
2
+ import type { TrackingNoticeProps } from "./schema.js";
3
+ export type { TrackingNoticeMessages } from "./schema.js";
4
+ export type { TrackingNoticePreferenceStore } from "./index.js";
23
5
  /** Mount once in a persistent footer. English/French defaults follow KrakstackProvider. */
24
- export declare const TrackingNotice: ({ messages, locale: localeOverride, privacyHref, preferences, }?: {
25
- readonly messages?: Partial<TrackingNoticeMessages>;
26
- readonly locale?: string;
27
- /** Open an application-owned page instead of the details dialog. */
28
- readonly privacyHref?: string;
6
+ export declare const TrackingNotice: ({ messages, locale: localeOverride, privacyHref, preferences, }?: TrackingNoticeProps & {
29
7
  readonly preferences?: TrackingNoticePreferenceStore;
30
8
  }) => import("react").JSX.Element;