@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/index.cjs +33 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -8
- package/dist/index.d.ts +15 -8
- package/dist/index.mjs +33 -25
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +32 -24
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +32 -24
- package/dist/react.mjs.map +1 -1
- package/hz.js +7 -3
- package/package.json +1 -1
- package/src/core.test.ts +37 -1
- package/src/core.ts +21 -16
- package/src/dsn.test.ts +14 -11
- package/src/dsn.ts +45 -14
- package/src/hz.test.ts +10 -1
- package/src/index.ts +1 -1
- package/src/version.ts +1 -1
package/dist/react.cjs
CHANGED
|
@@ -70,17 +70,23 @@ function hasAttribution(a) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// src/dsn.ts
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
console
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|
676
|
-
//
|
|
677
|
-
//
|
|
678
|
-
//
|
|
679
|
-
//
|
|
680
|
-
//
|
|
681
|
-
//
|
|
682
|
-
//
|
|
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
|
-
//
|
|
685
|
-
//
|
|
686
|
-
//
|
|
687
|
-
//
|
|
688
|
-
// in the page and invisible until you read the
|
|
689
|
-
// missing entirely.
|
|
690
|
-
|
|
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));
|