@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.mjs
CHANGED
|
@@ -68,17 +68,23 @@ function hasAttribution(a) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// src/dsn.ts
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
console
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
var PRODUCT_PROJECT = Object.freeze({
|
|
72
|
+
console: "019fa40b-94ae-7f1d-8f7b-e92f123fad42",
|
|
73
|
+
// console.hanzo.ai
|
|
74
|
+
app: "019f9b1e-57eb-7171-9d92-72c0b85e4b4b",
|
|
75
|
+
// hanzo.app
|
|
76
|
+
site: "019f9b1e-5785-7359-ad0b-f75db8e58c99"
|
|
77
|
+
// hanzo.ai (marketing; product `site`)
|
|
78
78
|
});
|
|
79
79
|
function dsnForProduct(product) {
|
|
80
80
|
if (!product) return void 0;
|
|
81
|
-
|
|
81
|
+
const projectId = PRODUCT_PROJECT[product];
|
|
82
|
+
if (!projectId) return void 0;
|
|
83
|
+
return `https://${HANZO_PUBLISHABLE_KEY}@api.hanzo.ai/v1/sentry/${projectId}`;
|
|
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;
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
// src/events.ts
|
|
@@ -307,7 +313,7 @@ function hzAnonId() {
|
|
|
307
313
|
}
|
|
308
314
|
|
|
309
315
|
// src/version.ts
|
|
310
|
-
var VERSION = "0.3.
|
|
316
|
+
var VERSION = "0.3.19";
|
|
311
317
|
|
|
312
318
|
// src/sentry.ts
|
|
313
319
|
var MAX_FRAMES = 50;
|
|
@@ -670,22 +676,24 @@ var Analytics = class {
|
|
|
670
676
|
enabled: true,
|
|
671
677
|
captureErrors: true,
|
|
672
678
|
...config,
|
|
673
|
-
// The publishable key resolves the SAME way the DSN below does
|
|
674
|
-
//
|
|
675
|
-
//
|
|
676
|
-
//
|
|
677
|
-
//
|
|
678
|
-
//
|
|
679
|
-
//
|
|
680
|
-
//
|
|
679
|
+
// The publishable key resolves the SAME way the DSN below does, and now
|
|
680
|
+
// ends the SAME way too — in a baked default, so declaring nothing is
|
|
681
|
+
// enough. Most specific first:
|
|
682
|
+
// 1. an explicit `ingestKey` in config;
|
|
683
|
+
// 2. NEXT_PUBLIC_PUBLISHABLE_KEY, the inlined build-time env the fleet
|
|
684
|
+
// carries end to end (KMS `deploy/PUBLISHABLE_KEY` -> the PUBLISHABLE_KEY
|
|
685
|
+
// build-arg -> the NEXT_PUBLIC_ prefix Next inlines);
|
|
686
|
+
// 3. the hanzo org key baked in `dsn.ts`, on the hanzo cloud only.
|
|
681
687
|
//
|
|
682
|
-
//
|
|
683
|
-
//
|
|
684
|
-
//
|
|
685
|
-
//
|
|
686
|
-
// in the page and invisible until you read the
|
|
687
|
-
// missing entirely.
|
|
688
|
-
|
|
688
|
+
// (3) is why this is `publishable_key for all`: a hanzo surface that passes
|
|
689
|
+
// no key in code and inlines no env still emits attributed, exactly as
|
|
690
|
+
// declaring `product` is enough for the DSN. Without it that surface sent
|
|
691
|
+
// its beacons to `$public` — which drops every track/identify/group and
|
|
692
|
+
// still answers 200 — silent in the page and invisible until you read the
|
|
693
|
+
// warehouse and find the host missing entirely. A white-label surface on
|
|
694
|
+
// its own cloud (a non-default host) gets no default, so the org this
|
|
695
|
+
// attributes to is never the wrong one.
|
|
696
|
+
ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY") ?? defaultPublishableKey(config.host ?? DEFAULT_HOST)
|
|
689
697
|
};
|
|
690
698
|
this.transport = config.transport ?? new DefaultTransport();
|
|
691
699
|
this.dsn = parseDsn(config.dsn ?? readEnvDsn() ?? dsnForProduct(this.cfg.product));
|