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