@hanzo/event 0.3.36 → 0.3.37

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 (60) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +8 -8
  3. package/TAXONOMY.md +1 -1
  4. package/dist/attribution.d.ts +14 -0
  5. package/dist/attribution.d.ts.map +1 -0
  6. package/dist/core.d.ts +102 -0
  7. package/dist/core.d.ts.map +1 -0
  8. package/dist/dsn.d.ts +43 -0
  9. package/dist/dsn.d.ts.map +1 -0
  10. package/dist/events.d.ts +21 -0
  11. package/dist/events.d.ts.map +1 -0
  12. package/dist/exception.d.ts +50 -0
  13. package/dist/exception.d.ts.map +1 -0
  14. package/dist/funnels.d.ts +14 -0
  15. package/dist/funnels.d.ts.map +1 -0
  16. package/dist/goals.d.ts +24 -0
  17. package/dist/goals.d.ts.map +1 -0
  18. package/dist/index.cjs +7 -7
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +22 -292
  21. package/dist/index.d.ts +22 -292
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.mjs +7 -7
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/org.d.ts +74 -0
  26. package/dist/org.d.ts.map +1 -0
  27. package/dist/react.cjs +7 -7
  28. package/dist/react.cjs.map +1 -1
  29. package/dist/react.d.cts +13 -14
  30. package/dist/react.d.ts +13 -14
  31. package/dist/react.d.ts.map +1 -0
  32. package/dist/react.mjs +7 -7
  33. package/dist/react.mjs.map +1 -1
  34. package/dist/scrub.d.ts +20 -0
  35. package/dist/scrub.d.ts.map +1 -0
  36. package/dist/sentry.d.ts +62 -0
  37. package/dist/sentry.d.ts.map +1 -0
  38. package/dist/stack.d.ts +25 -0
  39. package/dist/stack.d.ts.map +1 -0
  40. package/dist/storage.d.ts +32 -0
  41. package/dist/storage.d.ts.map +1 -0
  42. package/dist/{core-CIhI2R7S.d.cts → types.d.ts} +21 -119
  43. package/dist/types.d.ts.map +1 -0
  44. package/dist/uid.d.ts +10 -0
  45. package/dist/uid.d.ts.map +1 -0
  46. package/dist/version.d.ts +2 -0
  47. package/dist/version.d.ts.map +1 -0
  48. package/package.json +11 -11
  49. package/src/anon.d.ts +1 -1
  50. package/src/anon.js +3 -3
  51. package/src/anon.test.ts +3 -3
  52. package/src/core.test.ts +6 -6
  53. package/src/core.ts +11 -11
  54. package/src/events.ts +1 -1
  55. package/src/exception.ts +1 -1
  56. package/src/stack.ts +1 -1
  57. package/src/types.ts +3 -3
  58. package/src/uid.ts +2 -2
  59. package/src/version.ts +1 -1
  60. package/dist/core-CIhI2R7S.d.ts +0 -380
package/dist/org.d.ts ADDED
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Which org owns a host's telemetry.
3
+ *
4
+ * A surface should not have to LEARN its key. It already knows the domain it is
5
+ * served from, and a domain belongs to exactly one brand, so the key is derivable
6
+ * and asking a surface to carry one is asking it to restate something already
7
+ * true. This module answers `orgOf(location.hostname)` and hands back that org's
8
+ * publishable key, which is what lets a static export report correctly while
9
+ * configuring nothing.
10
+ *
11
+ * This is the SAME question `hanzo.id` answers at runtime for the identity hosts
12
+ * (`pkgs/shared/src/ingest.ts`): one image serves every brand, so the key cannot
13
+ * be a property of the build. It was, and the bill is on record — Lux's, Zoo's,
14
+ * Osage's and Pars' visitors were all filed in HANZO's project, because one
15
+ * build-time key was inlined for every brand. That is the white-label boundary
16
+ * crossed in the direction that shows up latest. The marketing sites carry the
17
+ * identical defect in its other form: each commits its OWN key literal, so the
18
+ * fleet holds N copies of a value with one source, and a site added tomorrow
19
+ * reports nothing until somebody remembers to paste one in.
20
+ *
21
+ * A `pk-` is PUBLISHABLE: it authorizes a write into one org and mints no reading
22
+ * principal. It is readable in devtools on every deployed page that sends an
23
+ * event, so stating it here exposes nothing that serving the page did not. What
24
+ * it does buy is that correct attribution becomes the DEFAULT rather than
25
+ * something each surface opts into.
26
+ *
27
+ * Keyed by ORG, never by host: a brand's facts repeat on every alias it owns
28
+ * (`lux.id`, `id.lux.network`), and a key stated per host would have to be
29
+ * repeated too — so the day someone adds an alias and forgets the key, that host
30
+ * silently stops reporting. Stated once per org, a new alias inherits its brand's
31
+ * key by naming its brand's domain, which is all an alias ever says.
32
+ */
33
+ /** One publishable key per org. */
34
+ export type Keyring = Readonly<Record<string, string>>;
35
+ /**
36
+ * Each org's registrable domains. A host matches a domain when it IS that domain
37
+ * or a subdomain of it, so `explore.lux.network` needs no entry of its own.
38
+ *
39
+ * An org absent from this table resolves to undefined, and that is deliberate:
40
+ * `osage`, `pars` and `bootnode` have no project of their own yet, and reporting
41
+ * NOTHING is the honest answer. Filing them under a brand that is not theirs is
42
+ * the defect this module exists to prevent — it is silent, it reads as working,
43
+ * and it is only visible later in someone else's warehouse.
44
+ */
45
+ export declare const ORG_DOMAIN: Readonly<Record<string, readonly string[]>>;
46
+ /**
47
+ * Each org's publishable key — the same values `universe`'s `SPA_INGEST_KEYRING`
48
+ * serves to the identity hosts, which are each brand's own insights team token.
49
+ * Add an org here the day its project exists, never before.
50
+ */
51
+ export declare const ORG_KEY: Keyring;
52
+ /**
53
+ * The org that owns a host, or undefined when no brand claims it.
54
+ *
55
+ * Longest match wins, so a brand owning both a domain and a subdomain of another
56
+ * brand's cannot be decided by table order. Pure and total.
57
+ */
58
+ export declare function orgOf(host: string): string | undefined;
59
+ /**
60
+ * The publishable key for a host, or undefined when there is not exactly one to
61
+ * give.
62
+ *
63
+ * Deliberately WITHOUT a fallback: returning Hanzo's key for an unrecognised host
64
+ * is precisely the defect described above. Undefined is the honest answer and the
65
+ * caller reports nothing.
66
+ *
67
+ * `keyring` is a parameter so the identity runtime — which receives its keyring
68
+ * from `/config.json` because one image serves every brand — resolves through
69
+ * this SAME function rather than a second copy of it.
70
+ */
71
+ export declare function keyFor(host: string, keyring?: Keyring): string | undefined;
72
+ /** The key for the page this code is running on; undefined off a browser. */
73
+ export declare function keyForPage(keyring?: Keyring): string | undefined;
74
+ //# sourceMappingURL=org.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../src/org.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,mCAAmC;AACnC,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAEtD;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CA6BjE,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,OAIpB,CAAA;AAWF;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CActD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,OAAiB,GAAG,MAAM,GAAG,SAAS,CAOnF;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,OAAO,GAAE,OAAiB,GAAG,MAAM,GAAG,SAAS,CAGzE"}
package/dist/react.cjs CHANGED
@@ -382,7 +382,7 @@ function hzAnonId() {
382
382
  }
383
383
 
384
384
  // src/version.ts
385
- var VERSION = "0.3.36";
385
+ var VERSION = "0.3.37";
386
386
 
387
387
  // src/sentry.ts
388
388
  var MAX_FRAMES = 50;
@@ -852,10 +852,10 @@ var Analytics = class {
852
852
  // so before this the only way to report was to commit a key literal, and the
853
853
  // fleet grew one copy per site of a value with a single source.
854
854
  //
855
- // A surface no brand claims still has no key, and the door REFUSES an
855
+ // A surface no brand claims still has no key, and the edge REFUSES an
856
856
  // unattributed event (401 `ingest_key_required`) — the reserved `$public`
857
857
  // tenant that once caught keyless beacons is retired, and anonymous ingest is
858
- // refused at every door on every brand host. So there is no quiet fallback to
858
+ // refused at every edge on every brand host. So there is no quiet fallback to
859
859
  // rely on: an event lands in the org a credential names, or it does not land.
860
860
  ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY") ?? keyForPage()
861
861
  };
@@ -993,7 +993,7 @@ var Analytics = class {
993
993
  this.cohort = mergeCohort(patch);
994
994
  }
995
995
  /** flush drains the buffer to the server as ONE batch through the ONE ingest
996
- * front door POST /v1/event, body { batch: [Event…] }. beacon=true selects the
996
+ * endpoint POST /v1/event, body { batch: [Event…] }. beacon=true selects the
997
997
  * unload-safe transport. Auth is orthogonal to the wire:
998
998
  *
999
999
  * • publishable key set → rides ?ingest_key=pk-… on both sends, keeping each
@@ -1206,15 +1206,15 @@ ErrorBoundary.contextType = Ctx;
1206
1206
  *
1207
1207
  * The two call sites:
1208
1208
  * 1. src/storage.ts — the bundled npm client; IMPORTS this file.
1209
- * 2. hanzoai/cloud apps/analytics/tag.js — the tag the door hosts at
1209
+ * 2. hanzoai/cloud apps/analytics/tag.js — the tag served at
1210
1210
  * /v1/event.js; vendors this file and its tag.go serves the marked region
1211
- * with the tag as one asset, so the door holds no second copy either.
1211
+ * with the tag as one asset, so cloud holds no second copy either.
1212
1212
  *
1213
1213
  * (2) has no bundler and cannot import anything, which is why the chain lives in a
1214
1214
  * file that is plain ES5 rather than in a .ts: the region between the BEGIN and END
1215
1215
  * markers is COPIED VERBATIM. Keep it ES5, dependency-free, `hz`-prefixed (it is
1216
1216
  * spliced into other people's scopes) and unformatted — a reformat here is a diff
1217
- * against the vendored copy. After editing, resync the door:
1217
+ * against the vendored copy. After editing, resync that copy:
1218
1218
  *
1219
1219
  * curl -fsSL https://unpkg.com/@hanzo/event/src/anon.js -o apps/analytics/anon.js
1220
1220
  */