@hanzo/event 0.3.17 → 0.3.18
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 +22 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +22 -16
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +22 -16
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +22 -16
- 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.ts +26 -0
- package/src/hz.test.ts +10 -1
- package/src/version.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -86,6 +86,10 @@ function dsnForProduct(product) {
|
|
|
86
86
|
if (!product) return void 0;
|
|
87
87
|
return PRODUCT_DSN[product];
|
|
88
88
|
}
|
|
89
|
+
var HANZO_PUBLISHABLE_KEY = "pk-live-c88649f1085fb6ad441d8a0072933a9b";
|
|
90
|
+
function defaultPublishableKey(host) {
|
|
91
|
+
return host === void 0 || host === "https://api.hanzo.ai" ? HANZO_PUBLISHABLE_KEY : void 0;
|
|
92
|
+
}
|
|
89
93
|
|
|
90
94
|
// src/events.ts
|
|
91
95
|
var EVENTS = {
|
|
@@ -367,7 +371,7 @@ function uuidv7Time(id) {
|
|
|
367
371
|
}
|
|
368
372
|
|
|
369
373
|
// src/version.ts
|
|
370
|
-
var VERSION = "0.3.
|
|
374
|
+
var VERSION = "0.3.18";
|
|
371
375
|
|
|
372
376
|
// src/sentry.ts
|
|
373
377
|
var MAX_FRAMES = 50;
|
|
@@ -730,22 +734,24 @@ var Analytics = class {
|
|
|
730
734
|
enabled: true,
|
|
731
735
|
captureErrors: true,
|
|
732
736
|
...config,
|
|
733
|
-
// The publishable key resolves the SAME way the DSN below does
|
|
734
|
-
//
|
|
735
|
-
//
|
|
736
|
-
//
|
|
737
|
-
//
|
|
738
|
-
//
|
|
739
|
-
//
|
|
740
|
-
//
|
|
737
|
+
// The publishable key resolves the SAME way the DSN below does, and now
|
|
738
|
+
// ends the SAME way too — in a baked default, so declaring nothing is
|
|
739
|
+
// enough. Most specific first:
|
|
740
|
+
// 1. an explicit `ingestKey` in config;
|
|
741
|
+
// 2. NEXT_PUBLIC_PUBLISHABLE_KEY, the inlined build-time env the fleet
|
|
742
|
+
// carries end to end (KMS `deploy/PUBLISHABLE_KEY` -> the PUBLISHABLE_KEY
|
|
743
|
+
// build-arg -> the NEXT_PUBLIC_ prefix Next inlines);
|
|
744
|
+
// 3. the hanzo org key baked in `dsn.ts`, on the hanzo cloud only.
|
|
741
745
|
//
|
|
742
|
-
//
|
|
743
|
-
//
|
|
744
|
-
//
|
|
745
|
-
//
|
|
746
|
-
// in the page and invisible until you read the
|
|
747
|
-
// missing entirely.
|
|
748
|
-
|
|
746
|
+
// (3) is why this is `publishable_key for all`: a hanzo surface that passes
|
|
747
|
+
// no key in code and inlines no env still emits attributed, exactly as
|
|
748
|
+
// declaring `product` is enough for the DSN. Without it that surface sent
|
|
749
|
+
// its beacons to `$public` — which drops every track/identify/group and
|
|
750
|
+
// still answers 200 — silent in the page and invisible until you read the
|
|
751
|
+
// warehouse and find the host missing entirely. A white-label surface on
|
|
752
|
+
// its own cloud (a non-default host) gets no default, so the org this
|
|
753
|
+
// attributes to is never the wrong one.
|
|
754
|
+
ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY") ?? defaultPublishableKey(config.host ?? DEFAULT_HOST)
|
|
749
755
|
};
|
|
750
756
|
this.transport = config.transport ?? new DefaultTransport();
|
|
751
757
|
this.dsn = parseDsn(config.dsn ?? readEnvDsn() ?? dsnForProduct(this.cfg.product));
|