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