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