@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 CHANGED
@@ -74,17 +74,23 @@ function isoWeek(d) {
74
74
  }
75
75
 
76
76
  // src/dsn.ts
77
- var PRODUCT_DSN = Object.freeze({
78
- // hanzo-console — console.hanzo.ai (also served embedded by the cloud binary)
79
- console: "https://1:0c8054dbde157f4f420c56b58660052b2ad782293c4de1d606ef8fbc46a0bf34@api.hanzo.ai/v1/sentry/019fa40b-94ae-7f1d-8f7b-e92f123fad42",
80
- // hanzo-app — hanzo.app
81
- app: "https://1:b3e1173125568c80f91ef4b1fabbbd2d7e22341de02b33ce7e22ef4fc16a196e@api.hanzo.ai/v1/sentry/019f9b1e-57eb-7171-9d92-72c0b85e4b4b",
82
- // hanzo-ai — hanzo.ai (the marketing site; `site` is the product name it declares)
83
- site: "https://1:d9cbfb844958bd7ef2a455600f00fbf237fbd71b75c1504f137773096d6aa53f@api.hanzo.ai/v1/sentry/019f9b1e-5785-7359-ad0b-f75db8e58c99"
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
- return PRODUCT_DSN[product];
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.17";
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: an explicit
734
- // config wins, else the inlined build-time env.
735
- //
736
- // NEXT_PUBLIC_PUBLISHABLE_KEY is that env, and it is the name the fleet
737
- // ALREADY carries end to end KMS holds deploy/PUBLISHABLE_KEY, each
738
- // Dockerfile takes it as the PUBLISHABLE_KEY build-arg and re-exports it
739
- // with the NEXT_PUBLIC_ prefix Next needs to inline it. Reading anything
740
- // else here would add a fourth spelling of one value.
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
- // Without this the key was the one piece of wiring a surface could not
743
- // declare the way it declares every other piece, so a surface that shipped
744
- // without passing it in code sent its beacons unattributed and an
745
- // unattributed write is refused (401 ingest_key_required), which is silent
746
- // in the page and invisible until you read the warehouse and find the host
747
- // missing entirely.
748
- ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY")
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.PRODUCT_DSN = PRODUCT_DSN;
1160
+ exports.PRODUCT_PROJECT = PRODUCT_PROJECT;
1153
1161
  exports.VERSION = VERSION;
1154
1162
  exports.buildEnvelope = buildEnvelope;
1155
1163
  exports.buildSentryEvent = buildSentryEvent;