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