@hanzo/event 0.3.20 → 0.3.21

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
@@ -78,15 +78,11 @@ var PRODUCT_PROJECT = Object.freeze({
78
78
  site: "019f9b1e-5785-7359-ad0b-f75db8e58c99"
79
79
  // hanzo.ai (marketing; product `site`)
80
80
  });
81
- function dsnForProduct(product) {
82
- if (!product) return void 0;
81
+ function dsnForProduct(product, key) {
82
+ if (!product || !key) return void 0;
83
83
  const projectId = PRODUCT_PROJECT[product];
84
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;
85
+ return `https://${key}@api.hanzo.ai/v1/sentry/${projectId}`;
90
86
  }
91
87
 
92
88
  // src/events.ts
@@ -316,7 +312,7 @@ function hzAnonId() {
316
312
  }
317
313
 
318
314
  // src/version.ts
319
- var VERSION = "0.3.20";
315
+ var VERSION = "0.3.21";
320
316
 
321
317
  // src/sentry.ts
322
318
  var MAX_FRAMES = 50;
@@ -767,27 +763,24 @@ var Analytics = class {
767
763
  enabled: true,
768
764
  captureErrors: true,
769
765
  ...config,
770
- // The publishable key resolves the SAME way the DSN below does, and now
771
- // ends the SAME way too — in a baked default, so declaring nothing is
772
- // enough. Most specific first:
766
+ // The publishable key resolves from ONE live source, never a literal baked
767
+ // beside the code. Most specific first:
773
768
  // 1. an explicit `ingestKey` in config;
774
769
  // 2. NEXT_PUBLIC_PUBLISHABLE_KEY, the inlined build-time env the fleet
775
- // carries end to end (KMS `deploy/PUBLISHABLE_KEY` -> the PUBLISHABLE_KEY
776
- // build-arg -> the NEXT_PUBLIC_ prefix Next inlines);
777
- // 3. the hanzo org key baked in `dsn.ts`, on the hanzo cloud only.
770
+ // carries end to end KMS `deploy/PUBLISHABLE_KEY` -> the PUBLISHABLE_KEY
771
+ // build-arg -> the NEXT_PUBLIC_ prefix Next inlines.
778
772
  //
779
- // (3) is why this is `publishable_key for all`: a hanzo surface that passes
780
- // no key in code and inlines no env still emits attributed, exactly as
781
- // declaring `product` is enough for the DSN. Without it that surface sent
782
- // its beacons to `$public` which drops every track/identify/group and
783
- // still answers 200 silent in the page and invisible until you read the
784
- // warehouse and find the host missing entirely. A white-label surface on
785
- // its own cloud (a non-default host) gets no default, so the org this
786
- // attributes to is never the wrong one.
787
- ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY") ?? defaultPublishableKey(config.host ?? DEFAULT_HOST)
773
+ // A surface that provides neither has no key, and its anonymous traffic
774
+ // files under `$public` (which drops track/identify/group and answers 200);
775
+ // the fix is to give it the KMS-sourced env, not to hardcode the org key
776
+ // here. The key is a credential-class value: its home is KMS, and the ONE
777
+ // build reads it from there.
778
+ ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY")
788
779
  };
789
780
  this.transport = config.transport ?? new DefaultTransport();
790
- this.dsn = parseDsn(config.dsn ?? readEnvDsn() ?? dsnForProduct(this.cfg.product));
781
+ this.dsn = parseDsn(
782
+ config.dsn ?? readEnvDsn() ?? dsnForProduct(this.cfg.product, this.cfg.ingestKey)
783
+ );
791
784
  }
792
785
  /** errorPlaneEnabled reports whether captured exceptions can actually reach the
793
786
  * error host. False means a DSN was never configured — the documented