@buildinams/tracking 0.2.0 → 0.4.0

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 (69) hide show
  1. package/README.md +86 -208
  2. package/dist/{sources/cart → cart}/index.d.ts +4 -4
  3. package/dist/{sources/cart → cart}/index.js +13 -3
  4. package/dist/cart/index.js.map +1 -0
  5. package/dist/chunk-JZ6HFGVJ.js +163 -0
  6. package/dist/chunk-JZ6HFGVJ.js.map +1 -0
  7. package/dist/{compatibility-Dc1JmTeG.d.ts → compatibility-wHn2I_ws.d.ts} +2 -2
  8. package/dist/{consent/index.d.ts → consent-types-DgKtGapr.d.ts} +5 -1
  9. package/dist/{consent/cookiebot → cookiebot}/index.d.ts +1 -1
  10. package/dist/{consent/cookiebot → cookiebot}/index.js +1 -1
  11. package/dist/cookiebot/index.js.map +1 -0
  12. package/dist/destination-types-DNMBOW_e.d.ts +22 -0
  13. package/dist/devtools/index.d.ts +18 -0
  14. package/dist/devtools/index.js +299 -0
  15. package/dist/devtools/index.js.map +1 -0
  16. package/dist/{sources/dom → dom}/index.d.ts +34 -40
  17. package/dist/{sources/dom → dom}/index.js +149 -247
  18. package/dist/dom/index.js.map +1 -0
  19. package/dist/events/index.d.ts +3 -6
  20. package/dist/events/index.js +5 -4
  21. package/dist/events/index.js.map +1 -1
  22. package/dist/flow/index.d.ts +10 -8
  23. package/dist/flow/index.js +23 -9
  24. package/dist/flow/index.js.map +1 -1
  25. package/dist/google/index.d.ts +32 -0
  26. package/dist/google/index.js +66 -0
  27. package/dist/google/index.js.map +1 -0
  28. package/dist/{page → navigation}/index.d.ts +7 -12
  29. package/dist/{page → navigation}/index.js +4 -10
  30. package/dist/navigation/index.js.map +1 -0
  31. package/dist/{consent/onetrust → onetrust}/index.d.ts +1 -1
  32. package/dist/{consent/onetrust → onetrust}/index.js +1 -1
  33. package/dist/onetrust/index.js.map +1 -0
  34. package/dist/shopify/index.d.ts +45 -0
  35. package/dist/{consent/shopify → shopify}/index.js +48 -20
  36. package/dist/shopify/index.js.map +1 -0
  37. package/dist/{sources/index.d.ts → source-types-fJXZeF2Q.d.ts} +1 -1
  38. package/dist/{types-DfPz7mBl.d.ts → types-CZEg03xW.d.ts} +3 -7
  39. package/docs/annotations.md +104 -0
  40. package/docs/context.md +64 -0
  41. package/docs/decisions/001-vendor-neutral-event-pipeline.md +2 -2
  42. package/docs/decisions/002-data-per-annotation-word.md +34 -0
  43. package/docs/events.md +93 -84
  44. package/docs/setup.md +189 -0
  45. package/package.json +41 -69
  46. package/dist/consent/cookiebot/index.js.map +0 -1
  47. package/dist/consent/index.js +0 -3
  48. package/dist/consent/index.js.map +0 -1
  49. package/dist/consent/onetrust/index.js.map +0 -1
  50. package/dist/consent/shopify/index.d.ts +0 -13
  51. package/dist/consent/shopify/index.js.map +0 -1
  52. package/dist/destinations/ga4/index.d.ts +0 -16
  53. package/dist/destinations/ga4/index.js +0 -15
  54. package/dist/destinations/ga4/index.js.map +0 -1
  55. package/dist/destinations/index.d.ts +0 -9
  56. package/dist/destinations/index.js +0 -17
  57. package/dist/destinations/index.js.map +0 -1
  58. package/dist/destinations/shopify/index.d.ts +0 -12
  59. package/dist/destinations/shopify/index.js +0 -18
  60. package/dist/destinations/shopify/index.js.map +0 -1
  61. package/dist/page/index.js.map +0 -1
  62. package/dist/sources/cart/index.js.map +0 -1
  63. package/dist/sources/cart/shopify/index.d.ts +0 -28
  64. package/dist/sources/cart/shopify/index.js +0 -16
  65. package/dist/sources/cart/shopify/index.js.map +0 -1
  66. package/dist/sources/dom/index.js.map +0 -1
  67. package/dist/sources/index.js +0 -3
  68. package/dist/sources/index.js.map +0 -1
  69. package/dist/types-BfJsv8AV.d.ts +0 -30
@@ -8,11 +8,15 @@ type ConsentProvider = {
8
8
  get(): Consent | null;
9
9
  subscribe(listener: (consent: Consent | null) => void): () => void;
10
10
  };
11
+ /** Turns an answer into a platform's consent state; `defaults` is the sink's own mapping of it. */
12
+ type ConsentMapping<T> = (consent: Consent, defaults: T) => T;
11
13
  /** Is told every consent answer, e.g. a platform that gates its own tracking on it. */
12
14
  type ConsentSink = {
13
15
  /** A sink named like the Consent Provider is skipped, so consent isn't written back to its source. */
14
16
  name: string;
15
17
  apply(consent: Consent): void;
18
+ /** Told when an answer is withdrawn back to unanswered, e.g. by a banner reset, to undo what `apply()` granted. */
19
+ clear?(): void;
16
20
  };
17
21
 
18
- export type { Consent, ConsentCategory, ConsentProvider, ConsentRequirement, ConsentSink };
22
+ export type { ConsentProvider as C, ConsentRequirement as a, ConsentCategory as b, ConsentSink as c, Consent as d, ConsentMapping as e };
@@ -1,4 +1,4 @@
1
- import { ConsentProvider } from '../index.js';
1
+ import { C as ConsentProvider } from '../consent-types-DgKtGapr.js';
2
2
 
3
3
  declare const cookiebot: () => ConsentProvider;
4
4
 
@@ -1,4 +1,4 @@
1
- // src/consent/cookiebot/cookiebot.ts
1
+ // src/cookiebot/cookiebot.ts
2
2
  var EVENTS = [
3
3
  "CookiebotOnConsentReady",
4
4
  "CookiebotOnAccept",
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cookiebot/cookiebot.ts"],"names":["cookiebot"],"mappings":";AASA,IAAM,MAAA,GAAS;AAAA,EACd,yBAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACD,CAAA;AAEA,IAAM,OAAO,MAAsB;AAClC,EAAA,MAAMA,aAAa,MAAA,CAA2B,SAAA;AAC9C,EAAA,IAAI,CAACA,UAAAA,EAAW,WAAA,IAAe,CAACA,UAAAA,CAAU,SAAS,OAAO,IAAA;AAC1D,EAAA,MAAM,EAAE,WAAA,EAAa,UAAA,EAAY,SAAA,KAAcA,UAAAA,CAAU,OAAA;AACzD,EAAA,OAAO,EAAE,SAAA,EAAW,IAAA,EAAM,WAAA,EAAa,SAAA,EAAW,YAAY,SAAA,EAAU;AACzE,CAAA;AAEO,IAAM,YAAY,OAAwB;AAAA,EAChD,IAAA,EAAM,WAAA;AAAA,EACN,GAAA,EAAK,IAAA;AAAA,EACL,UAAU,QAAA,EAAU;AACnB,IAAA,MAAM,QAAA,GAAW,MAAM,QAAA,CAAS,IAAA,EAAM,CAAA;AACtC,IAAA,KAAA,MAAW,IAAA,IAAQ,MAAA,EAAQ,MAAA,CAAO,gBAAA,CAAiB,MAAM,QAAQ,CAAA;AACjE,IAAA,OAAO,MAAM;AACZ,MAAA,KAAA,MAAW,IAAA,IAAQ,MAAA,EAAQ,MAAA,CAAO,mBAAA,CAAoB,MAAM,QAAQ,CAAA;AAAA,IACrE,CAAA;AAAA,EACD;AACD,CAAA","file":"index.js","sourcesContent":["import type { Consent, ConsentProvider } from \"../flow\";\n\ntype CookiebotGlobal = {\n\tCookiebot?: {\n\t\thasResponse?: boolean;\n\t\tconsent?: { preferences: boolean; statistics: boolean; marketing: boolean };\n\t};\n};\n\nconst EVENTS = [\n\t\"CookiebotOnConsentReady\",\n\t\"CookiebotOnAccept\",\n\t\"CookiebotOnDecline\",\n];\n\nconst read = (): Consent | null => {\n\tconst cookiebot = (window as CookiebotGlobal).Cookiebot;\n\tif (!cookiebot?.hasResponse || !cookiebot.consent) return null;\n\tconst { preferences, statistics, marketing } = cookiebot.consent;\n\treturn { necessary: true, preferences, analytics: statistics, marketing };\n};\n\nexport const cookiebot = (): ConsentProvider => ({\n\tname: \"cookiebot\",\n\tget: read,\n\tsubscribe(listener) {\n\t\tconst onChange = () => listener(read());\n\t\tfor (const name of EVENTS) window.addEventListener(name, onChange);\n\t\treturn () => {\n\t\t\tfor (const name of EVENTS) window.removeEventListener(name, onChange);\n\t\t};\n\t},\n});\n"]}
@@ -0,0 +1,22 @@
1
+ import { C as Catalog, T as TrackingEvent, E as EventName } from './types-CZEg03xW.js';
2
+ import { a as ConsentRequirement } from './consent-types-DgKtGapr.js';
3
+
4
+ type DestinationEvent = {
5
+ name: string;
6
+ payload: unknown;
7
+ };
8
+ type Destination<E extends DestinationEvent = DestinationEvent> = {
9
+ name: string;
10
+ send(event: E): void | Promise<void>;
11
+ };
12
+ type Mapping<C extends Catalog, E extends DestinationEvent, Cx> = {
13
+ [N in EventName<C>]?: (event: TrackingEvent<C, N, Cx>) => E | null | undefined;
14
+ };
15
+ type MappedDestination<C extends Catalog, Cx = unknown> = {
16
+ name: string;
17
+ requires: ConsentRequirement;
18
+ /** Maps and sends; nothing when the Event has no Mapping or it returned nothing. */
19
+ deliver(event: TrackingEvent<C, EventName<C>, Cx>): void | Promise<void>;
20
+ };
21
+
22
+ export type { DestinationEvent as D, Mapping as M, Destination as a, MappedDestination as b };
@@ -0,0 +1,18 @@
1
+ type AnnotationIssueCode = "unknown-word" | "unknown-attribute" | "orphan-field" | "ignored-key" | "empty-field" | "detail-without-item" | "auto-in-ignored";
2
+ type AnnotationIssue = {
3
+ code: AnnotationIssueCode;
4
+ element: Element;
5
+ message: string;
6
+ };
7
+ /** Annotation mistakes the DOM Source would otherwise silently ignore, in document order. */
8
+ declare const checkAnnotations: (root?: ParentNode) => AnnotationIssue[];
9
+ /** Warns about each new issue once, rechecking whenever the DOM changes. */
10
+ declare const watchAnnotations: () => () => void;
11
+
12
+ /**
13
+ * Outlines Annotated Elements, marks the ones with mistakes in red, and shows how the DOM Source reads the element
14
+ * under the pointer: each word's Data and Composition, and where its fields go. For development and QA; returns `hide`.
15
+ */
16
+ declare const showInspector: () => () => void;
17
+
18
+ export { type AnnotationIssue, type AnnotationIssueCode, checkAnnotations, showInspector, watchAnnotations };
@@ -0,0 +1,299 @@
1
+ import { ROLES, FLAGS, DATA_ATTRIBUTES, AUTO_ATTRIBUTE, CLONE_ATTRIBUTE, IGNORE_ATTRIBUTE, ANNOTATION_ATTRIBUTE, IGNORED, isIgnored, hasWord, isRole, roleSelector, parse, DATA_WORDS, dataAttribute, readAnnotated } from '../chunk-JZ6HFGVJ.js';
2
+ import '../chunk-KLN5K6PR.js';
3
+
4
+ // src/dom/check-annotations.ts
5
+ var WORDS = [...ROLES, ...FLAGS];
6
+ var PREFIX = `${ANNOTATION_ATTRIBUTE}-`;
7
+ var KNOWN_ATTRIBUTES = [
8
+ ...DATA_ATTRIBUTES,
9
+ AUTO_ATTRIBUTE,
10
+ CLONE_ATTRIBUTE,
11
+ IGNORE_ATTRIBUTE
12
+ ];
13
+ var checkElement = (element, issues) => {
14
+ const report = (code, message) => issues.push({ code, element, message });
15
+ if (isIgnored(element)) {
16
+ if (element.hasAttribute(AUTO_ATTRIBUTE))
17
+ report(
18
+ "auto-in-ignored",
19
+ `${AUTO_ATTRIBUTE} has no effect inside ${IGNORE_ATTRIBUTE}: nothing there is tracked.`
20
+ );
21
+ return;
22
+ }
23
+ for (const word of (element.getAttribute(ANNOTATION_ATTRIBUTE) ?? "").split(/\s+/).filter(Boolean))
24
+ if (!WORDS.includes(word))
25
+ report(
26
+ "unknown-word",
27
+ `"${word}" in ${ANNOTATION_ATTRIBUTE} isn't a Role (${ROLES.join(", ")}) or Flag (${FLAGS.join(", ")}).`
28
+ );
29
+ if (hasWord(element, "detail") && !hasWord(element, "item"))
30
+ report(
31
+ "detail-without-item",
32
+ `"detail" only applies to an Item: use ${ANNOTATION_ATTRIBUTE}="item detail".`
33
+ );
34
+ for (const { name, value } of element.attributes) {
35
+ if (!name.startsWith(PREFIX)) continue;
36
+ if (!KNOWN_ATTRIBUTES.includes(name)) {
37
+ report(
38
+ "unknown-attribute",
39
+ `${name} isn't read: Data attributes are ${DATA_ATTRIBUTES.join(", ")}.`
40
+ );
41
+ continue;
42
+ }
43
+ if (name === AUTO_ATTRIBUTE || name === CLONE_ATTRIBUTE || name === IGNORE_ATTRIBUTE)
44
+ continue;
45
+ const word = name.slice(PREFIX.length);
46
+ const own = !isRole(word) || hasWord(element, word) || word === "form" && element instanceof HTMLFormElement;
47
+ if (!own && !element.closest(roleSelector(word))) {
48
+ report(
49
+ "orphan-field",
50
+ `${name} is a field of the nearest ${word} above it, and there is none.`
51
+ );
52
+ continue;
53
+ }
54
+ for (const { key, value: fieldValue } of parse(value)) {
55
+ if (fieldValue !== void 0) continue;
56
+ if (own)
57
+ report(
58
+ "ignored-key",
59
+ `"${key}" in ${name} has no value; only a field on a descendant reads its text.`
60
+ );
61
+ else if (!element.textContent?.trim())
62
+ report("empty-field", `Field "${key}" in ${name} has no text.`);
63
+ }
64
+ }
65
+ };
66
+ var checkAnnotation = (element) => {
67
+ const issues = [];
68
+ checkElement(element, issues);
69
+ return issues;
70
+ };
71
+ var checkAnnotations = (root = document) => {
72
+ const issues = [];
73
+ if (root instanceof Element) checkElement(root, issues);
74
+ for (const element of root.querySelectorAll("*"))
75
+ checkElement(element, issues);
76
+ return issues;
77
+ };
78
+ var CHECK_DELAY = 500;
79
+ var watchAnnotations = () => {
80
+ const warned = /* @__PURE__ */ new WeakMap();
81
+ const check = () => {
82
+ for (const issue of checkAnnotations()) {
83
+ let seen = warned.get(issue.element);
84
+ if (!seen) warned.set(issue.element, seen = /* @__PURE__ */ new Set());
85
+ if (seen.has(issue.message)) continue;
86
+ seen.add(issue.message);
87
+ console.warn(`[tracking] ${issue.message}`, issue.element);
88
+ }
89
+ };
90
+ let timer;
91
+ const schedule = () => {
92
+ clearTimeout(timer);
93
+ timer = setTimeout(check, CHECK_DELAY);
94
+ };
95
+ const observer = new MutationObserver(schedule);
96
+ observer.observe(document.documentElement, {
97
+ childList: true,
98
+ subtree: true,
99
+ attributes: true,
100
+ attributeFilter: [ANNOTATION_ATTRIBUTE, ...KNOWN_ATTRIBUTES]
101
+ });
102
+ schedule();
103
+ return () => {
104
+ observer.disconnect();
105
+ clearTimeout(timer);
106
+ };
107
+ };
108
+
109
+ // src/dom/inspect.ts
110
+ var ANNOTATED_SELECTOR = [
111
+ `[${ANNOTATION_ATTRIBUTE}]`,
112
+ IGNORED,
113
+ ...DATA_ATTRIBUTES.map((attribute) => `[${attribute}]`)
114
+ ].join(", ");
115
+ var inspect = (element) => {
116
+ const ignoredBy = element.closest(IGNORED) ?? void 0;
117
+ if (ignoredBy)
118
+ return {
119
+ ignoredBy,
120
+ words: {},
121
+ fields: {},
122
+ issues: checkAnnotation(element)
123
+ };
124
+ const words = {};
125
+ const fields = {};
126
+ for (const word of DATA_WORDS) {
127
+ const declared = hasWord(element, word);
128
+ if (!declared && !element.hasAttribute(dataAttribute(word))) continue;
129
+ if (declared || !isRole(word)) {
130
+ words[word] = readAnnotated(element, word);
131
+ continue;
132
+ }
133
+ const owner = element.closest(roleSelector(word));
134
+ if (owner) fields[word] = owner;
135
+ }
136
+ return { words, fields, issues: checkAnnotation(element) };
137
+ };
138
+
139
+ // src/devtools/inspector.ts
140
+ var ISSUE_ATTRIBUTE = "data-tracking-inspector-issue";
141
+ var RECHECK_DELAY = 300;
142
+ var STYLE = `
143
+ [${ANNOTATION_ATTRIBUTE}] { outline: 1px dashed #7c3aed; outline-offset: -1px; }
144
+ [${ISSUE_ATTRIBUTE}] { outline: 2px solid #dc2626; outline-offset: -2px; }
145
+ ${IGNORED} { outline: 2px dashed #9ca3af; outline-offset: -2px; }
146
+ ${IGNORED} [${ANNOTATION_ATTRIBUTE}] { outline-color: #9ca3af; }
147
+ `;
148
+ var create = (tag, style, text) => {
149
+ const element = document.createElement(tag);
150
+ Object.assign(element.style, style);
151
+ if (text !== void 0) element.textContent = text;
152
+ return element;
153
+ };
154
+ var box = (color) => create("div", {
155
+ position: "fixed",
156
+ pointerEvents: "none",
157
+ zIndex: "2147483646",
158
+ border: `2px solid ${color}`,
159
+ background: `${color}1a`,
160
+ display: "none"
161
+ });
162
+ var place = (highlight, element) => {
163
+ if (!element) {
164
+ highlight.style.display = "none";
165
+ return;
166
+ }
167
+ const { top, left, width, height } = element.getBoundingClientRect();
168
+ Object.assign(highlight.style, {
169
+ display: "block",
170
+ top: `${top}px`,
171
+ left: `${left}px`,
172
+ width: `${width}px`,
173
+ height: `${height}px`
174
+ });
175
+ };
176
+ var describe = (element) => {
177
+ const words = element.getAttribute(ANNOTATION_ATTRIBUTE);
178
+ return `<${element.tagName.toLowerCase()}${words ? ` ${ANNOTATION_ATTRIBUTE}="${words}"` : ""}>`;
179
+ };
180
+ var showInspector = () => {
181
+ const style = document.createElement("style");
182
+ style.textContent = STYLE;
183
+ const hovered = box("#7c3aed");
184
+ const owner = box("#16a34a");
185
+ const panel = create("aside", {
186
+ position: "fixed",
187
+ right: "8px",
188
+ bottom: "8px",
189
+ zIndex: "2147483647",
190
+ width: "min(420px, calc(100vw - 16px))",
191
+ maxHeight: "50vh",
192
+ overflow: "auto",
193
+ padding: "8px 12px",
194
+ background: "#111827",
195
+ color: "#f9fafb",
196
+ font: "12px/1.4 ui-monospace, monospace",
197
+ borderRadius: "6px",
198
+ boxShadow: "0 4px 16px rgb(0 0 0 / 0.3)"
199
+ });
200
+ const summary = create("p", { margin: "0 0 4px", color: "#9ca3af" });
201
+ const details = create("div", {});
202
+ panel.append(summary, details);
203
+ document.head.append(style);
204
+ document.body.append(hovered, owner, panel);
205
+ let marked = [];
206
+ let current = null;
207
+ const recheck = () => {
208
+ current = null;
209
+ for (const element of marked) element.removeAttribute(ISSUE_ATTRIBUTE);
210
+ const issues = checkAnnotations();
211
+ marked = issues.map(({ element }) => element);
212
+ for (const element of marked) element.setAttribute(ISSUE_ATTRIBUTE, "");
213
+ summary.textContent = `${issues.length} Annotation issue${issues.length === 1 ? "" : "s"} \xB7 hover an outlined element`;
214
+ };
215
+ const show = (element) => {
216
+ const { ignoredBy, words, fields, issues } = inspect(element);
217
+ details.replaceChildren(
218
+ create("strong", {}, describe(element)),
219
+ ...ignoredBy ? [
220
+ create(
221
+ "p",
222
+ { margin: "4px 0", color: "#9ca3af" },
223
+ `not tracked: inside ${IGNORE_ATTRIBUTE} on ${describe(ignoredBy)}`
224
+ )
225
+ ] : [],
226
+ ...Object.entries(words).map(
227
+ ([word, annotated]) => create(
228
+ "pre",
229
+ { margin: "4px 0", whiteSpace: "pre-wrap" },
230
+ `${word}: ${JSON.stringify(annotated, null, 2)}`
231
+ )
232
+ ),
233
+ ...Object.entries(fields).map(
234
+ ([role, fieldOwner]) => create(
235
+ "p",
236
+ { margin: "4px 0", color: "#86efac" },
237
+ `field of ${role} \u2192 ${describe(fieldOwner)}`
238
+ )
239
+ ),
240
+ ...issues.map(
241
+ ({ message }) => create("p", { margin: "4px 0", color: "#fca5a5" }, message)
242
+ )
243
+ );
244
+ place(hovered, element);
245
+ const [firstOwner] = Object.values(fields);
246
+ place(owner, firstOwner);
247
+ };
248
+ const onPointerMove = (event) => {
249
+ if (!(event.target instanceof Element) || panel.contains(event.target))
250
+ return;
251
+ const element = event.target.closest(ANNOTATED_SELECTOR);
252
+ if (element === current) return;
253
+ current = element;
254
+ if (element) show(element);
255
+ else {
256
+ place(hovered, void 0);
257
+ place(owner, void 0);
258
+ }
259
+ };
260
+ const onScroll = () => {
261
+ current = null;
262
+ place(hovered, void 0);
263
+ place(owner, void 0);
264
+ };
265
+ let timer;
266
+ const observer = new MutationObserver((records) => {
267
+ if (records.every(({ target }) => panel.contains(target))) return;
268
+ clearTimeout(timer);
269
+ timer = setTimeout(recheck, RECHECK_DELAY);
270
+ });
271
+ observer.observe(document.body, {
272
+ childList: true,
273
+ subtree: true,
274
+ attributes: true,
275
+ attributeFilter: [
276
+ ANNOTATION_ATTRIBUTE,
277
+ ...DATA_ATTRIBUTES,
278
+ IGNORE_ATTRIBUTE
279
+ ]
280
+ });
281
+ document.addEventListener("pointermove", onPointerMove);
282
+ window.addEventListener("scroll", onScroll, { capture: true, passive: true });
283
+ recheck();
284
+ return () => {
285
+ observer.disconnect();
286
+ clearTimeout(timer);
287
+ document.removeEventListener("pointermove", onPointerMove);
288
+ window.removeEventListener("scroll", onScroll, { capture: true });
289
+ for (const element of marked) element.removeAttribute(ISSUE_ATTRIBUTE);
290
+ style.remove();
291
+ hovered.remove();
292
+ owner.remove();
293
+ panel.remove();
294
+ };
295
+ };
296
+
297
+ export { checkAnnotations, showInspector, watchAnnotations };
298
+ //# sourceMappingURL=index.js.map
299
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/dom/check-annotations.ts","../../src/dom/in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M,MAAA,EAAO;AACb,IAAA,KAAA,CAAM,MAAA,EAAO;AAAA,EACd,CAAA;AACD","file":"index.js","sourcesContent":["import type { DataWord } from \"./annotations\";\nimport {\n\tANNOTATION_ATTRIBUTE,\n\tCLONE_ATTRIBUTE,\n\tDATA_ATTRIBUTES,\n\tFLAGS,\n\thasWord,\n\tIGNORE_ATTRIBUTE,\n\tisIgnored,\n\tisRole,\n\tparse,\n\tROLES,\n\troleSelector,\n} from \"./annotations\";\nimport { AUTO_ATTRIBUTE } from \"./opt-in\";\n\nexport type AnnotationIssueCode =\n\t| \"unknown-word\"\n\t| \"unknown-attribute\"\n\t| \"orphan-field\"\n\t| \"ignored-key\"\n\t| \"empty-field\"\n\t| \"detail-without-item\"\n\t| \"auto-in-ignored\";\n\nexport type AnnotationIssue = {\n\tcode: AnnotationIssueCode;\n\telement: Element;\n\tmessage: string;\n};\n\nconst WORDS: readonly string[] = [...ROLES, ...FLAGS];\nconst PREFIX = `${ANNOTATION_ATTRIBUTE}-`;\nconst KNOWN_ATTRIBUTES: readonly string[] = [\n\t...DATA_ATTRIBUTES,\n\tAUTO_ATTRIBUTE,\n\tCLONE_ATTRIBUTE,\n\tIGNORE_ATTRIBUTE,\n];\n\nconst checkElement = (element: Element, issues: AnnotationIssue[]) => {\n\tconst report = (code: AnnotationIssueCode, message: string) =>\n\t\tissues.push({ code, element, message });\n\n\t// Nothing in an ignored area is read, so only a setting that can't take effect there is a mistake.\n\tif (isIgnored(element)) {\n\t\tif (element.hasAttribute(AUTO_ATTRIBUTE))\n\t\t\treport(\n\t\t\t\t\"auto-in-ignored\",\n\t\t\t\t`${AUTO_ATTRIBUTE} has no effect inside ${IGNORE_ATTRIBUTE}: nothing there is tracked.`,\n\t\t\t);\n\t\treturn;\n\t}\n\n\tfor (const word of (element.getAttribute(ANNOTATION_ATTRIBUTE) ?? \"\")\n\t\t.split(/\\s+/)\n\t\t.filter(Boolean))\n\t\tif (!WORDS.includes(word))\n\t\t\treport(\n\t\t\t\t\"unknown-word\",\n\t\t\t\t`\"${word}\" in ${ANNOTATION_ATTRIBUTE} isn't a Role (${ROLES.join(\", \")}) or Flag (${FLAGS.join(\", \")}).`,\n\t\t\t);\n\n\tif (hasWord(element, \"detail\") && !hasWord(element, \"item\"))\n\t\treport(\n\t\t\t\"detail-without-item\",\n\t\t\t`\"detail\" only applies to an Item: use ${ANNOTATION_ATTRIBUTE}=\"item detail\".`,\n\t\t);\n\n\tfor (const { name, value } of element.attributes) {\n\t\tif (!name.startsWith(PREFIX)) continue;\n\t\tif (!KNOWN_ATTRIBUTES.includes(name)) {\n\t\t\treport(\n\t\t\t\t\"unknown-attribute\",\n\t\t\t\t`${name} isn't read: Data attributes are ${DATA_ATTRIBUTES.join(\", \")}.`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tif (\n\t\t\tname === AUTO_ATTRIBUTE ||\n\t\t\tname === CLONE_ATTRIBUTE ||\n\t\t\tname === IGNORE_ATTRIBUTE\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst word = name.slice(PREFIX.length) as DataWord;\n\t\t// An auto-tracked `<form>` reads its own `data-e-form` without the Role.\n\t\tconst own =\n\t\t\t!isRole(word) ||\n\t\t\thasWord(element, word) ||\n\t\t\t(word === \"form\" && element instanceof HTMLFormElement);\n\t\tif (!own && !element.closest(roleSelector(word))) {\n\t\t\treport(\n\t\t\t\t\"orphan-field\",\n\t\t\t\t`${name} is a field of the nearest ${word} above it, and there is none.`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const { key, value: fieldValue } of parse(value)) {\n\t\t\tif (fieldValue !== undefined) continue;\n\t\t\tif (own)\n\t\t\t\treport(\n\t\t\t\t\t\"ignored-key\",\n\t\t\t\t\t`\"${key}\" in ${name} has no value; only a field on a descendant reads its text.`,\n\t\t\t\t);\n\t\t\telse if (!element.textContent?.trim())\n\t\t\t\treport(\"empty-field\", `Field \"${key}\" in ${name} has no text.`);\n\t\t}\n\t}\n};\n\n/** The mistakes in this element's own Annotation. */\nexport const checkAnnotation = (element: Element) => {\n\tconst issues: AnnotationIssue[] = [];\n\tcheckElement(element, issues);\n\treturn issues;\n};\n\n/** Annotation mistakes the DOM Source would otherwise silently ignore, in document order. */\nexport const checkAnnotations = (root: ParentNode = document) => {\n\tconst issues: AnnotationIssue[] = [];\n\tif (root instanceof Element) checkElement(root, issues);\n\tfor (const element of root.querySelectorAll(\"*\"))\n\t\tcheckElement(element, issues);\n\treturn issues;\n};\n\nconst CHECK_DELAY = 500;\n\n/** Warns about each new issue once, rechecking whenever the DOM changes. */\nexport const watchAnnotations = () => {\n\tconst warned = new WeakMap<Element, Set<string>>();\n\tconst check = () => {\n\t\tfor (const issue of checkAnnotations()) {\n\t\t\tlet seen = warned.get(issue.element);\n\t\t\tif (!seen) warned.set(issue.element, (seen = new Set()));\n\t\t\tif (seen.has(issue.message)) continue;\n\t\t\tseen.add(issue.message);\n\t\t\tconsole.warn(`[tracking] ${issue.message}`, issue.element);\n\t\t}\n\t};\n\n\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\tconst schedule = () => {\n\t\tclearTimeout(timer);\n\t\ttimer = setTimeout(check, CHECK_DELAY);\n\t};\n\tconst observer = new MutationObserver(schedule);\n\tobserver.observe(document.documentElement, {\n\t\tchildList: true,\n\t\tsubtree: true,\n\t\tattributes: true,\n\t\tattributeFilter: [ANNOTATION_ATTRIBUTE, ...KNOWN_ATTRIBUTES],\n\t});\n\tschedule();\n\treturn () => {\n\t\tobserver.disconnect();\n\t\tclearTimeout(timer);\n\t};\n};\n","import type { Annotated, DataWord, Role } from \"./annotations\";\nimport {\n\tANNOTATION_ATTRIBUTE,\n\tDATA_ATTRIBUTES,\n\tDATA_WORDS,\n\tdataAttribute,\n\thasWord,\n\tIGNORED,\n\tisRole,\n\treadAnnotated,\n\troleSelector,\n} from \"./annotations\";\nimport type { AnnotationIssue } from \"./check-annotations\";\nimport { checkAnnotation } from \"./check-annotations\";\n\n/** Selects every element with an Annotation, a field or `data-e-ignore`. */\nexport const ANNOTATED_SELECTOR = [\n\t`[${ANNOTATION_ATTRIBUTE}]`,\n\tIGNORED,\n\t...DATA_ATTRIBUTES.map((attribute) => `[${attribute}]`),\n].join(\", \");\n\nexport type Inspection = {\n\t/** The `data-e-ignore` area it's in, whose content the DOM Source doesn't see. */\n\tignoredBy?: Element;\n\t/** What each of the element's words publishes with. */\n\twords: Partial<Record<DataWord, Annotated>>;\n\t/** The element each of its fields belongs to. */\n\tfields: Partial<Record<Role, Element>>;\n\tissues: AnnotationIssue[];\n};\n\n/** How the DOM Source reads this element: each word's Data and Composition, its fields' owners and its mistakes. */\nexport const inspect = (element: Element): Inspection => {\n\tconst ignoredBy = element.closest(IGNORED) ?? undefined;\n\tif (ignoredBy)\n\t\treturn {\n\t\t\tignoredBy,\n\t\t\twords: {},\n\t\t\tfields: {},\n\t\t\tissues: checkAnnotation(element),\n\t\t};\n\tconst words: Inspection[\"words\"] = {};\n\tconst fields: Inspection[\"fields\"] = {};\n\tfor (const word of DATA_WORDS) {\n\t\tconst declared = hasWord(element, word);\n\t\tif (!declared && !element.hasAttribute(dataAttribute(word))) continue;\n\t\tif (declared || !isRole(word)) {\n\t\t\twords[word] = readAnnotated(element, word);\n\t\t\tcontinue;\n\t\t}\n\t\tconst owner = element.closest(roleSelector(word));\n\t\tif (owner) fields[word] = owner;\n\t}\n\treturn { words, fields, issues: checkAnnotation(element) };\n};\n","import {\n\tANNOTATION_ATTRIBUTE,\n\tDATA_ATTRIBUTES,\n\tIGNORE_ATTRIBUTE,\n\tIGNORED,\n} from \"../dom/annotations\";\nimport { checkAnnotations } from \"../dom/check-annotations\";\nimport { ANNOTATED_SELECTOR, inspect } from \"../dom/inspect\";\n\nconst ISSUE_ATTRIBUTE = \"data-tracking-inspector-issue\";\nconst RECHECK_DELAY = 300;\n\nconst STYLE = `\n[${ANNOTATION_ATTRIBUTE}] { outline: 1px dashed #7c3aed; outline-offset: -1px; }\n[${ISSUE_ATTRIBUTE}] { outline: 2px solid #dc2626; outline-offset: -2px; }\n${IGNORED} { outline: 2px dashed #9ca3af; outline-offset: -2px; }\n${IGNORED} [${ANNOTATION_ATTRIBUTE}] { outline-color: #9ca3af; }\n`;\n\nconst create = <K extends keyof HTMLElementTagNameMap>(\n\ttag: K,\n\tstyle: Partial<CSSStyleDeclaration>,\n\ttext?: string,\n) => {\n\tconst element = document.createElement(tag);\n\tObject.assign(element.style, style);\n\tif (text !== undefined) element.textContent = text;\n\treturn element;\n};\n\nconst box = (color: string) =>\n\tcreate(\"div\", {\n\t\tposition: \"fixed\",\n\t\tpointerEvents: \"none\",\n\t\tzIndex: \"2147483646\",\n\t\tborder: `2px solid ${color}`,\n\t\tbackground: `${color}1a`,\n\t\tdisplay: \"none\",\n\t});\n\nconst place = (highlight: HTMLElement, element: Element | undefined) => {\n\tif (!element) {\n\t\thighlight.style.display = \"none\";\n\t\treturn;\n\t}\n\tconst { top, left, width, height } = element.getBoundingClientRect();\n\tObject.assign(highlight.style, {\n\t\tdisplay: \"block\",\n\t\ttop: `${top}px`,\n\t\tleft: `${left}px`,\n\t\twidth: `${width}px`,\n\t\theight: `${height}px`,\n\t});\n};\n\nconst describe = (element: Element) => {\n\tconst words = element.getAttribute(ANNOTATION_ATTRIBUTE);\n\treturn `<${element.tagName.toLowerCase()}${words ? ` ${ANNOTATION_ATTRIBUTE}=\"${words}\"` : \"\"}>`;\n};\n\n/**\n * Outlines Annotated Elements, marks the ones with mistakes in red, and shows how the DOM Source reads the element\n * under the pointer: each word's Data and Composition, and where its fields go. For development and QA; returns `hide`.\n */\nexport const showInspector = () => {\n\tconst style = document.createElement(\"style\");\n\tstyle.textContent = STYLE;\n\tconst hovered = box(\"#7c3aed\");\n\tconst owner = box(\"#16a34a\");\n\tconst panel = create(\"aside\", {\n\t\tposition: \"fixed\",\n\t\tright: \"8px\",\n\t\tbottom: \"8px\",\n\t\tzIndex: \"2147483647\",\n\t\twidth: \"min(420px, calc(100vw - 16px))\",\n\t\tmaxHeight: \"50vh\",\n\t\toverflow: \"auto\",\n\t\tpadding: \"8px 12px\",\n\t\tbackground: \"#111827\",\n\t\tcolor: \"#f9fafb\",\n\t\tfont: \"12px/1.4 ui-monospace, monospace\",\n\t\tborderRadius: \"6px\",\n\t\tboxShadow: \"0 4px 16px rgb(0 0 0 / 0.3)\",\n\t});\n\tconst summary = create(\"p\", { margin: \"0 0 4px\", color: \"#9ca3af\" });\n\tconst details = create(\"div\", {});\n\tpanel.append(summary, details);\n\tdocument.head.append(style);\n\tdocument.body.append(hovered, owner, panel);\n\n\tlet marked: Element[] = [];\n\tlet current: Element | null = null;\n\tconst recheck = () => {\n\t\tcurrent = null;\n\t\tfor (const element of marked) element.removeAttribute(ISSUE_ATTRIBUTE);\n\t\tconst issues = checkAnnotations();\n\t\tmarked = issues.map(({ element }) => element);\n\t\tfor (const element of marked) element.setAttribute(ISSUE_ATTRIBUTE, \"\");\n\t\tsummary.textContent = `${issues.length} Annotation issue${issues.length === 1 ? \"\" : \"s\"} · hover an outlined element`;\n\t};\n\n\tconst show = (element: Element) => {\n\t\tconst { ignoredBy, words, fields, issues } = inspect(element);\n\t\tdetails.replaceChildren(\n\t\t\tcreate(\"strong\", {}, describe(element)),\n\t\t\t...(ignoredBy\n\t\t\t\t? [\n\t\t\t\t\t\tcreate(\n\t\t\t\t\t\t\t\"p\",\n\t\t\t\t\t\t\t{ margin: \"4px 0\", color: \"#9ca3af\" },\n\t\t\t\t\t\t\t`not tracked: inside ${IGNORE_ATTRIBUTE} on ${describe(ignoredBy)}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t\t...Object.entries(words).map(([word, annotated]) =>\n\t\t\t\tcreate(\n\t\t\t\t\t\"pre\",\n\t\t\t\t\t{ margin: \"4px 0\", whiteSpace: \"pre-wrap\" },\n\t\t\t\t\t`${word}: ${JSON.stringify(annotated, null, 2)}`,\n\t\t\t\t),\n\t\t\t),\n\t\t\t...Object.entries(fields).map(([role, fieldOwner]) =>\n\t\t\t\tcreate(\n\t\t\t\t\t\"p\",\n\t\t\t\t\t{ margin: \"4px 0\", color: \"#86efac\" },\n\t\t\t\t\t`field of ${role} → ${describe(fieldOwner)}`,\n\t\t\t\t),\n\t\t\t),\n\t\t\t...issues.map(({ message }) =>\n\t\t\t\tcreate(\"p\", { margin: \"4px 0\", color: \"#fca5a5\" }, message),\n\t\t\t),\n\t\t);\n\t\tplace(hovered, element);\n\t\tconst [firstOwner] = Object.values(fields);\n\t\tplace(owner, firstOwner);\n\t};\n\n\tconst onPointerMove = (event: PointerEvent) => {\n\t\tif (!(event.target instanceof Element) || panel.contains(event.target))\n\t\t\treturn;\n\t\tconst element = event.target.closest(ANNOTATED_SELECTOR);\n\t\tif (element === current) return;\n\t\tcurrent = element;\n\t\tif (element) show(element);\n\t\telse {\n\t\t\tplace(hovered, undefined);\n\t\t\tplace(owner, undefined);\n\t\t}\n\t};\n\tconst onScroll = () => {\n\t\tcurrent = null;\n\t\tplace(hovered, undefined);\n\t\tplace(owner, undefined);\n\t};\n\n\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\tconst observer = new MutationObserver((records) => {\n\t\tif (records.every(({ target }) => panel.contains(target))) return;\n\t\tclearTimeout(timer);\n\t\ttimer = setTimeout(recheck, RECHECK_DELAY);\n\t});\n\tobserver.observe(document.body, {\n\t\tchildList: true,\n\t\tsubtree: true,\n\t\tattributes: true,\n\t\tattributeFilter: [\n\t\t\tANNOTATION_ATTRIBUTE,\n\t\t\t...DATA_ATTRIBUTES,\n\t\t\tIGNORE_ATTRIBUTE,\n\t\t],\n\t});\n\tdocument.addEventListener(\"pointermove\", onPointerMove);\n\twindow.addEventListener(\"scroll\", onScroll, { capture: true, passive: true });\n\trecheck();\n\n\treturn () => {\n\t\tobserver.disconnect();\n\t\tclearTimeout(timer);\n\t\tdocument.removeEventListener(\"pointermove\", onPointerMove);\n\t\twindow.removeEventListener(\"scroll\", onScroll, { capture: true });\n\t\tfor (const element of marked) element.removeAttribute(ISSUE_ATTRIBUTE);\n\t\tstyle.remove();\n\t\thovered.remove();\n\t\towner.remove();\n\t\tpanel.remove();\n\t};\n};\n"]}
@@ -1,37 +1,40 @@
1
- import { C as CheckPublished } from '../../compatibility-Dc1JmTeG.js';
2
- import { C as Catalog, E as EventBroker } from '../../types-DfPz7mBl.js';
3
- import { CurrentPage } from '../../page/index.js';
4
- import { Source } from '../index.js';
1
+ import { C as Catalog, b as EventBroker } from '../types-CZEg03xW.js';
2
+ import { C as CheckPublished } from '../compatibility-wHn2I_ws.js';
3
+ import { S as Source } from '../source-types-fJXZeF2Q.js';
4
+ import { ClientNavigation } from '../navigation/index.js';
5
5
 
6
6
  declare const ROLES: readonly ["location", "list", "item", "promotion", "form"];
7
7
  declare const FLAGS: readonly ["click", "video", "detail", "page"];
8
8
  type Role = (typeof ROLES)[number];
9
9
  type Flag = (typeof FLAGS)[number];
10
+ /** Words with their own Data attribute, `data-e-<word>`. */
11
+ type DataWord = Exclude<Role | Flag, "detail">;
10
12
  type AnnotationData = Record<string, string>;
11
13
  type AnnotationValue = string | number | boolean | null | undefined;
12
- /** Attributes to spread onto an element. */
13
- type Annotation = {
14
- "data-e": string;
15
- "data-e-data"?: string;
16
- };
17
14
  type Annotated = {
18
15
  data: AnnotationData;
19
16
  composed: Partial<Record<Role, {
20
17
  data: AnnotationData;
21
18
  }>>;
22
19
  };
20
+ /** Data typed by the project's own shape, e.g. a `ProductData` type without an index signature. */
21
+ type AnnotationFields<D> = {
22
+ [K in keyof D]: AnnotationValue;
23
+ };
23
24
  /**
24
- * The `data-e` and `data-e-data` attributes for an element with these Roles and Flags and this Data,
25
- * e.g. `<div {...annotate(["item", "detail"], { id, title })} />`. Values may contain `;`;
26
- * `null` and `undefined` ones are left out.
25
+ * Data as a `data-e-<word>` value, the inverse of the DOM Source's reader,
26
+ * e.g. `<div data-e="item" data-e-item={encodeData({ id, title })} />`.
27
+ * `null` and `undefined` values are left out; values may contain `;` and `\`.
27
28
  */
28
- declare const annotate: <D extends { [K in keyof D]: AnnotationValue; }>(words: Role | Flag | readonly (Role | Flag)[], data?: D) => Annotation;
29
+ declare const encodeData: <D extends AnnotationFields<D>>(data: D) => string;
29
30
 
30
31
  type DetectorContext = {
31
32
  publish(name: string, event: {
32
33
  data: object;
33
34
  composed: Annotated["composed"];
34
35
  }): void;
36
+ /** Called with every batch of DOM changes, from one observer the DOM Source shares between its Detectors; returns the unsubscribe. */
37
+ onMutation(listener: (records: MutationRecord[]) => void): () => void;
35
38
  };
36
39
  /** `P` maps each Event Name it publishes to the Data it guarantees; the catalog must declare them compatibly. */
37
40
  type Detector<P extends Record<string, object> = Record<string, object>> = {
@@ -48,12 +51,6 @@ type Detector<P extends Record<string, object> = Record<string, object>> = {
48
51
  type LinkClickData = {
49
52
  url: string;
50
53
  text: string;
51
- /** On another host than the page and `internalHosts`. */
52
- outbound: boolean;
53
- download?: {
54
- name: string;
55
- extension: string;
56
- };
57
54
  [field: string]: unknown;
58
55
  };
59
56
  type ButtonClickData = {
@@ -66,26 +63,28 @@ type ClicksOptions = {
66
63
  links?: boolean;
67
64
  buttons?: boolean;
68
65
  };
69
- /** Hosts besides the page's own that links aren't outbound to. */
70
- internalHosts?: string[];
71
- downloadExtensions?: string[];
72
66
  };
73
67
  /** Publishes `link:click` and `button:click` for opted-in links and buttons. */
74
- declare const clicks: ({ auto, internalHosts, downloadExtensions, }?: ClicksOptions) => Detector<{
68
+ declare const clicks: ({ auto }?: ClicksOptions) => Detector<{
75
69
  "link:click": LinkClickData;
76
70
  "button:click": ButtonClickData;
77
71
  }>;
78
72
 
79
73
  type DomSourceOptions = {
80
- currentPage: Pick<CurrentPage, "subscribe">;
74
+ /** Leave out when every navigation is a full page load. */
75
+ clientNavigation?: Pick<ClientNavigation, "subscribe">;
81
76
  };
82
77
  type DomSource = Source & {
83
78
  flush(): void;
84
79
  };
85
- declare const createDomSource: <C extends Catalog, const D extends readonly Detector<any>[]>(broker: EventBroker<C>, detectors: [...D] & { [I in keyof D]: D[I] extends Detector<infer P> ? Detector<CheckPublished<C, P>> : never; }, { currentPage }: DomSourceOptions) => DomSource;
80
+ declare const createDomSource: <C extends Catalog, const D extends readonly Detector<any>[]>(broker: EventBroker<C>, detectors: [...D] & { [I in keyof D]: D[I] extends Detector<infer P> ? Detector<CheckPublished<C, P>> : never; }, { clientNavigation }?: DomSourceOptions) => DomSource;
86
81
 
87
- /** Publishes `item:view` when an Item flagged `detail` (`data-e="item detail"`), e.g. a product page's, is rendered or shows another Item. */
88
- declare const detailViews: () => Detector<{
82
+ type DetailViewsOptions = {
83
+ /** What makes two detail Items the same Item; by default all their Data. E.g. `(data) => data.handle` counts a variant switch as the same product. */
84
+ key?: (data: AnnotationData) => string;
85
+ };
86
+ /** Publishes `item:view` when an Item flagged `detail` (`data-e="item detail"`), e.g. a product page's, starts being shown. */
87
+ declare const detailViews: ({ key, }?: DetailViewsOptions) => Detector<{
89
88
  "item:view": AnnotationData;
90
89
  }>;
91
90
 
@@ -119,6 +118,11 @@ type ListViewData = {
119
118
  items: ListViewItem[];
120
119
  [field: string]: unknown;
121
120
  };
121
+ type PromotionData = {
122
+ /** Every Item in the Promotion, in order, seen or not. */
123
+ items: ListViewItem[];
124
+ [field: string]: unknown;
125
+ };
122
126
  type ImpressionsOptions = {
123
127
  /** Share of an element that must be visible. */
124
128
  threshold?: number;
@@ -130,7 +134,7 @@ type ImpressionsOptions = {
130
134
  * `list:view` with the Items of a List first visible on a Page, batched per List.
131
135
  */
132
136
  declare const impressions: ({ threshold, delay, }?: ImpressionsOptions) => Detector<{
133
- "promotion:view": AnnotationData;
137
+ "promotion:view": PromotionData;
134
138
  "list:view": ListViewData;
135
139
  }>;
136
140
 
@@ -139,16 +143,6 @@ declare const pageViews: () => Detector<{
139
143
  "page:view": AnnotationData;
140
144
  }>;
141
145
 
142
- /**
143
- * An exact pathname (`"/search"`), a pathname ending in `/*` for everything below it
144
- * (`"/collections/*"`), a `RegExp` tested against the pathname, or a function of the URL.
145
- */
146
- type PathMatcher = string | RegExp | ((url: URL) => boolean);
147
- /** Publishes the Detector's Events only on Pages matching one of `paths`. */
148
- declare const only: <P extends Record<string, object>>(detector: Detector<P>, paths: PathMatcher[]) => Detector<P>;
149
- /** Publishes the Detector's Events on every Page except those matching one of `paths`. */
150
- declare const except: <P extends Record<string, object>>(detector: Detector<P>, paths: PathMatcher[]) => Detector<P>;
151
-
152
146
  type ScrollOptions = {
153
147
  /** Percentages of the page height. */
154
148
  thresholds?: number[];
@@ -172,7 +166,7 @@ type ItemSelectData = {
172
166
  */
173
167
  declare const selections: () => Detector<{
174
168
  "item:select": ItemSelectData;
175
- "promotion:select": AnnotationData;
169
+ "promotion:select": PromotionData;
176
170
  }>;
177
171
 
178
172
  type VideoEventData = {
@@ -199,4 +193,4 @@ declare const videos: ({ auto, thresholds, }?: VideosOptions) => Detector<{
199
193
  "video:complete": VideoEventData;
200
194
  }>;
201
195
 
202
- export { type Annotation, type AnnotationData, type AnnotationValue, type ButtonClickData, type ClicksOptions, type Detector, type DetectorContext, type DomSource, type DomSourceOptions, type Flag, type FormEventData, type FormSubmitData, type FormsOptions, type ImpressionsOptions, type ItemSelectData, type LinkClickData, type ListViewData, type ListViewItem, type PathMatcher, type Role, type ScrollOptions, type VideoEventData, type VideosOptions, annotate, clicks, createDomSource, detailViews, except, forms, impressions, only, pageViews, scroll, selections, videos };
196
+ export { type AnnotationData, type AnnotationFields, type AnnotationValue, type ButtonClickData, type ClicksOptions, type DataWord, type DetailViewsOptions, type Detector, type DetectorContext, type DomSource, type DomSourceOptions, type Flag, type FormEventData, type FormSubmitData, type FormsOptions, type ImpressionsOptions, type ItemSelectData, type LinkClickData, type ListViewData, type ListViewItem, type PromotionData, type Role, type ScrollOptions, type VideoEventData, type VideosOptions, clicks, createDomSource, detailViews, encodeData, forms, impressions, pageViews, scroll, selections, videos };