@hanzo/event 0.3.17 → 0.3.19

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/react.mjs CHANGED
@@ -68,17 +68,23 @@ function hasAttribution(a) {
68
68
  }
69
69
 
70
70
  // src/dsn.ts
71
- var PRODUCT_DSN = Object.freeze({
72
- // hanzo-console — console.hanzo.ai (also served embedded by the cloud binary)
73
- console: "https://1:0c8054dbde157f4f420c56b58660052b2ad782293c4de1d606ef8fbc46a0bf34@api.hanzo.ai/v1/sentry/019fa40b-94ae-7f1d-8f7b-e92f123fad42",
74
- // hanzo-app — hanzo.app
75
- app: "https://1:b3e1173125568c80f91ef4b1fabbbd2d7e22341de02b33ce7e22ef4fc16a196e@api.hanzo.ai/v1/sentry/019f9b1e-57eb-7171-9d92-72c0b85e4b4b",
76
- // hanzo-ai — hanzo.ai (the marketing site; `site` is the product name it declares)
77
- site: "https://1:d9cbfb844958bd7ef2a455600f00fbf237fbd71b75c1504f137773096d6aa53f@api.hanzo.ai/v1/sentry/019f9b1e-5785-7359-ad0b-f75db8e58c99"
71
+ var PRODUCT_PROJECT = Object.freeze({
72
+ console: "019fa40b-94ae-7f1d-8f7b-e92f123fad42",
73
+ // console.hanzo.ai
74
+ app: "019f9b1e-57eb-7171-9d92-72c0b85e4b4b",
75
+ // hanzo.app
76
+ site: "019f9b1e-5785-7359-ad0b-f75db8e58c99"
77
+ // hanzo.ai (marketing; product `site`)
78
78
  });
79
79
  function dsnForProduct(product) {
80
80
  if (!product) return void 0;
81
- return PRODUCT_DSN[product];
81
+ const projectId = PRODUCT_PROJECT[product];
82
+ if (!projectId) return void 0;
83
+ return `https://${HANZO_PUBLISHABLE_KEY}@api.hanzo.ai/v1/sentry/${projectId}`;
84
+ }
85
+ var HANZO_PUBLISHABLE_KEY = "pk-live-c88649f1085fb6ad441d8a0072933a9b";
86
+ function defaultPublishableKey(host) {
87
+ return host === void 0 || host === "https://api.hanzo.ai" ? HANZO_PUBLISHABLE_KEY : void 0;
82
88
  }
83
89
 
84
90
  // src/events.ts
@@ -307,7 +313,7 @@ function hzAnonId() {
307
313
  }
308
314
 
309
315
  // src/version.ts
310
- var VERSION = "0.3.17";
316
+ var VERSION = "0.3.19";
311
317
 
312
318
  // src/sentry.ts
313
319
  var MAX_FRAMES = 50;
@@ -670,22 +676,24 @@ var Analytics = class {
670
676
  enabled: true,
671
677
  captureErrors: true,
672
678
  ...config,
673
- // The publishable key resolves the SAME way the DSN below does: an explicit
674
- // config wins, else the inlined build-time env.
675
- //
676
- // NEXT_PUBLIC_PUBLISHABLE_KEY is that env, and it is the name the fleet
677
- // ALREADY carries end to end KMS holds deploy/PUBLISHABLE_KEY, each
678
- // Dockerfile takes it as the PUBLISHABLE_KEY build-arg and re-exports it
679
- // with the NEXT_PUBLIC_ prefix Next needs to inline it. Reading anything
680
- // else here would add a fourth spelling of one value.
679
+ // The publishable key resolves the SAME way the DSN below does, and now
680
+ // ends the SAME way too — in a baked default, so declaring nothing is
681
+ // enough. Most specific first:
682
+ // 1. an explicit `ingestKey` in config;
683
+ // 2. NEXT_PUBLIC_PUBLISHABLE_KEY, the inlined build-time env the fleet
684
+ // carries end to end (KMS `deploy/PUBLISHABLE_KEY` -> the PUBLISHABLE_KEY
685
+ // build-arg -> the NEXT_PUBLIC_ prefix Next inlines);
686
+ // 3. the hanzo org key baked in `dsn.ts`, on the hanzo cloud only.
681
687
  //
682
- // Without this the key was the one piece of wiring a surface could not
683
- // declare the way it declares every other piece, so a surface that shipped
684
- // without passing it in code sent its beacons unattributed and an
685
- // unattributed write is refused (401 ingest_key_required), which is silent
686
- // in the page and invisible until you read the warehouse and find the host
687
- // missing entirely.
688
- ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY")
688
+ // (3) is why this is `publishable_key for all`: a hanzo surface that passes
689
+ // no key in code and inlines no env still emits attributed, exactly as
690
+ // declaring `product` is enough for the DSN. Without it that surface sent
691
+ // its beacons to `$public` which drops every track/identify/group and
692
+ // still answers 200 — silent in the page and invisible until you read the
693
+ // warehouse and find the host missing entirely. A white-label surface on
694
+ // its own cloud (a non-default host) gets no default, so the org this
695
+ // attributes to is never the wrong one.
696
+ ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY") ?? defaultPublishableKey(config.host ?? DEFAULT_HOST)
689
697
  };
690
698
  this.transport = config.transport ?? new DefaultTransport();
691
699
  this.dsn = parseDsn(config.dsn ?? readEnvDsn() ?? dsnForProduct(this.cfg.product));