@hanzo/event 0.3.17 → 0.3.18

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/dist/index.cjs CHANGED
@@ -86,6 +86,10 @@ function dsnForProduct(product) {
86
86
  if (!product) return void 0;
87
87
  return PRODUCT_DSN[product];
88
88
  }
89
+ var HANZO_PUBLISHABLE_KEY = "pk-live-c88649f1085fb6ad441d8a0072933a9b";
90
+ function defaultPublishableKey(host) {
91
+ return host === void 0 || host === "https://api.hanzo.ai" ? HANZO_PUBLISHABLE_KEY : void 0;
92
+ }
89
93
 
90
94
  // src/events.ts
91
95
  var EVENTS = {
@@ -367,7 +371,7 @@ function uuidv7Time(id) {
367
371
  }
368
372
 
369
373
  // src/version.ts
370
- var VERSION = "0.3.17";
374
+ var VERSION = "0.3.18";
371
375
 
372
376
  // src/sentry.ts
373
377
  var MAX_FRAMES = 50;
@@ -730,22 +734,24 @@ var Analytics = class {
730
734
  enabled: true,
731
735
  captureErrors: true,
732
736
  ...config,
733
- // The publishable key resolves the SAME way the DSN below does: an explicit
734
- // config wins, else the inlined build-time env.
735
- //
736
- // NEXT_PUBLIC_PUBLISHABLE_KEY is that env, and it is the name the fleet
737
- // ALREADY carries end to end KMS holds deploy/PUBLISHABLE_KEY, each
738
- // Dockerfile takes it as the PUBLISHABLE_KEY build-arg and re-exports it
739
- // with the NEXT_PUBLIC_ prefix Next needs to inline it. Reading anything
740
- // else here would add a fourth spelling of one value.
737
+ // The publishable key resolves the SAME way the DSN below does, and now
738
+ // ends the SAME way too — in a baked default, so declaring nothing is
739
+ // enough. Most specific first:
740
+ // 1. an explicit `ingestKey` in config;
741
+ // 2. NEXT_PUBLIC_PUBLISHABLE_KEY, the inlined build-time env the fleet
742
+ // carries end to end (KMS `deploy/PUBLISHABLE_KEY` -> the PUBLISHABLE_KEY
743
+ // build-arg -> the NEXT_PUBLIC_ prefix Next inlines);
744
+ // 3. the hanzo org key baked in `dsn.ts`, on the hanzo cloud only.
741
745
  //
742
- // Without this the key was the one piece of wiring a surface could not
743
- // declare the way it declares every other piece, so a surface that shipped
744
- // without passing it in code sent its beacons unattributed and an
745
- // unattributed write is refused (401 ingest_key_required), which is silent
746
- // in the page and invisible until you read the warehouse and find the host
747
- // missing entirely.
748
- ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY")
746
+ // (3) is why this is `publishable_key for all`: a hanzo surface that passes
747
+ // no key in code and inlines no env still emits attributed, exactly as
748
+ // declaring `product` is enough for the DSN. Without it that surface sent
749
+ // its beacons to `$public` which drops every track/identify/group and
750
+ // still answers 200 — silent in the page and invisible until you read the
751
+ // warehouse and find the host missing entirely. A white-label surface on
752
+ // its own cloud (a non-default host) gets no default, so the org this
753
+ // attributes to is never the wrong one.
754
+ ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY") ?? defaultPublishableKey(config.host ?? DEFAULT_HOST)
749
755
  };
750
756
  this.transport = config.transport ?? new DefaultTransport();
751
757
  this.dsn = parseDsn(config.dsn ?? readEnvDsn() ?? dsnForProduct(this.cfg.product));