@hanzo/event 0.3.20 → 0.3.22
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/index.cjs +61 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -58
- package/dist/index.d.ts +12 -58
- package/dist/index.mjs +21 -78
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +20 -30
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +18 -28
- package/dist/react.mjs.map +1 -1
- package/hz.js +7 -8
- package/package.json +4 -1
- 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/events.ts +21 -76
- package/src/hz.test.ts +4 -10
- package/src/version.ts +1 -1
package/dist/react.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createContext, Component, useMemo, useEffect, createElement, useContext, useRef } from 'react';
|
|
2
|
+
import { PAGEVIEW, EXCEPTION } from '@hanzo/events';
|
|
2
3
|
|
|
3
4
|
// src/react.tsx
|
|
4
5
|
|
|
@@ -76,20 +77,12 @@ var PRODUCT_PROJECT = Object.freeze({
|
|
|
76
77
|
site: "019f9b1e-5785-7359-ad0b-f75db8e58c99"
|
|
77
78
|
// hanzo.ai (marketing; product `site`)
|
|
78
79
|
});
|
|
79
|
-
function dsnForProduct(product) {
|
|
80
|
-
if (!product) return void 0;
|
|
80
|
+
function dsnForProduct(product, key) {
|
|
81
|
+
if (!product || !key) return void 0;
|
|
81
82
|
const projectId = PRODUCT_PROJECT[product];
|
|
82
83
|
if (!projectId) return void 0;
|
|
83
|
-
return `https://${
|
|
84
|
+
return `https://${key}@api.hanzo.ai/v1/sentry/${projectId}`;
|
|
84
85
|
}
|
|
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;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// src/events.ts
|
|
91
|
-
var PAGEVIEW = "$pageview";
|
|
92
|
-
var EXCEPTION = "$exception";
|
|
93
86
|
|
|
94
87
|
// src/scrub.ts
|
|
95
88
|
var REDACTED = "[redacted]";
|
|
@@ -314,7 +307,7 @@ function hzAnonId() {
|
|
|
314
307
|
}
|
|
315
308
|
|
|
316
309
|
// src/version.ts
|
|
317
|
-
var VERSION = "0.3.
|
|
310
|
+
var VERSION = "0.3.21";
|
|
318
311
|
|
|
319
312
|
// src/sentry.ts
|
|
320
313
|
var MAX_FRAMES = 50;
|
|
@@ -765,27 +758,24 @@ var Analytics = class {
|
|
|
765
758
|
enabled: true,
|
|
766
759
|
captureErrors: true,
|
|
767
760
|
...config,
|
|
768
|
-
// The publishable key resolves
|
|
769
|
-
//
|
|
770
|
-
// enough. Most specific first:
|
|
761
|
+
// The publishable key resolves from ONE live source, never a literal baked
|
|
762
|
+
// beside the code. Most specific first:
|
|
771
763
|
// 1. an explicit `ingestKey` in config;
|
|
772
764
|
// 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.
|
|
765
|
+
// carries end to end — KMS `deploy/PUBLISHABLE_KEY` -> the PUBLISHABLE_KEY
|
|
766
|
+
// build-arg -> the NEXT_PUBLIC_ prefix Next inlines.
|
|
776
767
|
//
|
|
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)
|
|
768
|
+
// A surface that provides neither has no key, and its anonymous traffic
|
|
769
|
+
// files under `$public` (which drops track/identify/group and answers 200);
|
|
770
|
+
// the fix is to give it the KMS-sourced env, not to hardcode the org key
|
|
771
|
+
// here. The key is a credential-class value: its home is KMS, and the ONE
|
|
772
|
+
// build reads it from there.
|
|
773
|
+
ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY")
|
|
786
774
|
};
|
|
787
775
|
this.transport = config.transport ?? new DefaultTransport();
|
|
788
|
-
this.dsn = parseDsn(
|
|
776
|
+
this.dsn = parseDsn(
|
|
777
|
+
config.dsn ?? readEnvDsn() ?? dsnForProduct(this.cfg.product, this.cfg.ingestKey)
|
|
778
|
+
);
|
|
789
779
|
}
|
|
790
780
|
/** errorPlaneEnabled reports whether captured exceptions can actually reach the
|
|
791
781
|
* error host. False means a DSN was never configured — the documented
|