@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/index.cjs
CHANGED
|
@@ -74,17 +74,23 @@ function isoWeek(d) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
// src/dsn.ts
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
console
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
var PRODUCT_PROJECT = Object.freeze({
|
|
78
|
+
console: "019fa40b-94ae-7f1d-8f7b-e92f123fad42",
|
|
79
|
+
// console.hanzo.ai
|
|
80
|
+
app: "019f9b1e-57eb-7171-9d92-72c0b85e4b4b",
|
|
81
|
+
// hanzo.app
|
|
82
|
+
site: "019f9b1e-5785-7359-ad0b-f75db8e58c99"
|
|
83
|
+
// hanzo.ai (marketing; product `site`)
|
|
84
84
|
});
|
|
85
85
|
function dsnForProduct(product) {
|
|
86
86
|
if (!product) return void 0;
|
|
87
|
-
|
|
87
|
+
const projectId = PRODUCT_PROJECT[product];
|
|
88
|
+
if (!projectId) return void 0;
|
|
89
|
+
return `https://${HANZO_PUBLISHABLE_KEY}@api.hanzo.ai/v1/sentry/${projectId}`;
|
|
90
|
+
}
|
|
91
|
+
var HANZO_PUBLISHABLE_KEY = "pk-live-c88649f1085fb6ad441d8a0072933a9b";
|
|
92
|
+
function defaultPublishableKey(host) {
|
|
93
|
+
return host === void 0 || host === "https://api.hanzo.ai" ? HANZO_PUBLISHABLE_KEY : void 0;
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
// src/events.ts
|
|
@@ -367,7 +373,7 @@ function uuidv7Time(id) {
|
|
|
367
373
|
}
|
|
368
374
|
|
|
369
375
|
// src/version.ts
|
|
370
|
-
var VERSION = "0.3.
|
|
376
|
+
var VERSION = "0.3.19";
|
|
371
377
|
|
|
372
378
|
// src/sentry.ts
|
|
373
379
|
var MAX_FRAMES = 50;
|
|
@@ -730,22 +736,24 @@ var Analytics = class {
|
|
|
730
736
|
enabled: true,
|
|
731
737
|
captureErrors: true,
|
|
732
738
|
...config,
|
|
733
|
-
// The publishable key resolves the SAME way the DSN below does
|
|
734
|
-
//
|
|
735
|
-
//
|
|
736
|
-
//
|
|
737
|
-
//
|
|
738
|
-
//
|
|
739
|
-
//
|
|
740
|
-
//
|
|
739
|
+
// The publishable key resolves the SAME way the DSN below does, and now
|
|
740
|
+
// ends the SAME way too — in a baked default, so declaring nothing is
|
|
741
|
+
// enough. Most specific first:
|
|
742
|
+
// 1. an explicit `ingestKey` in config;
|
|
743
|
+
// 2. NEXT_PUBLIC_PUBLISHABLE_KEY, the inlined build-time env the fleet
|
|
744
|
+
// carries end to end (KMS `deploy/PUBLISHABLE_KEY` -> the PUBLISHABLE_KEY
|
|
745
|
+
// build-arg -> the NEXT_PUBLIC_ prefix Next inlines);
|
|
746
|
+
// 3. the hanzo org key baked in `dsn.ts`, on the hanzo cloud only.
|
|
741
747
|
//
|
|
742
|
-
//
|
|
743
|
-
//
|
|
744
|
-
//
|
|
745
|
-
//
|
|
746
|
-
// in the page and invisible until you read the
|
|
747
|
-
// missing entirely.
|
|
748
|
-
|
|
748
|
+
// (3) is why this is `publishable_key for all`: a hanzo surface that passes
|
|
749
|
+
// no key in code and inlines no env still emits attributed, exactly as
|
|
750
|
+
// declaring `product` is enough for the DSN. Without it that surface sent
|
|
751
|
+
// its beacons to `$public` — which drops every track/identify/group and
|
|
752
|
+
// still answers 200 — silent in the page and invisible until you read the
|
|
753
|
+
// warehouse and find the host missing entirely. A white-label surface on
|
|
754
|
+
// its own cloud (a non-default host) gets no default, so the org this
|
|
755
|
+
// attributes to is never the wrong one.
|
|
756
|
+
ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY") ?? defaultPublishableKey(config.host ?? DEFAULT_HOST)
|
|
749
757
|
};
|
|
750
758
|
this.transport = config.transport ?? new DefaultTransport();
|
|
751
759
|
this.dsn = parseDsn(config.dsn ?? readEnvDsn() ?? dsnForProduct(this.cfg.product));
|
|
@@ -1149,7 +1157,7 @@ exports.FUNNELS = FUNNELS;
|
|
|
1149
1157
|
exports.GOALS = GOALS;
|
|
1150
1158
|
exports.PAGEVIEW = PAGEVIEW;
|
|
1151
1159
|
exports.PRODUCTS = PRODUCTS;
|
|
1152
|
-
exports.
|
|
1160
|
+
exports.PRODUCT_PROJECT = PRODUCT_PROJECT;
|
|
1153
1161
|
exports.VERSION = VERSION;
|
|
1154
1162
|
exports.buildEnvelope = buildEnvelope;
|
|
1155
1163
|
exports.buildSentryEvent = buildSentryEvent;
|