@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/LICENSE.md +21 -0
- package/dist/index.cjs +17 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.mjs +17 -24
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +17 -24
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +17 -24
- package/dist/react.mjs.map +1 -1
- package/hz.js +7 -8
- package/package.json +10 -10
- package/src/core.test.ts +3 -37
- package/src/core.ts +18 -24
- package/src/dsn.test.ts +28 -18
- package/src/dsn.ts +14 -34
- package/src/hz.test.ts +4 -10
- package/src/version.ts +1 -1
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://${
|
|
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.
|
|
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
|
|
771
|
-
//
|
|
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
|
|
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
|
-
//
|
|
780
|
-
//
|
|
781
|
-
//
|
|
782
|
-
//
|
|
783
|
-
//
|
|
784
|
-
|
|
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(
|
|
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
|