@hanzo/event 0.3.21 → 0.3.23

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.d.cts CHANGED
@@ -1,12 +1,14 @@
1
1
  import { C as Cohort, A as Attribution, S as SentryEvent, D as Dsn, a as CaptureErrorOptions, b as SentryFrame, E as ExceptionEntry, c as SentryLevel, d as ExceptionProperties } from './core-CHLpJy51.cjs';
2
2
  export { e as Analytics, f as AnalyticsConfig, g as EventKind, h as Exception, i as ExceptionFrame, T as Transport, W as WireEvent, j as createAnalytics } from './core-CHLpJy51.cjs';
3
+ import { FunnelId } from '@hanzo/events';
4
+ export { EVENTS, EXCEPTION, EventName, FUNNELS, FunnelDef, FunnelId, FunnelStep, PAGEVIEW, PRODUCTS, ProductId, eventsOf } from '@hanzo/events';
3
5
 
4
6
  /** Read the persisted first-touch attribution. */
5
7
  declare function getFirstTouch(): Attribution | undefined;
6
8
  /** Read persisted cohort dimensions. */
7
9
  declare function getCohort(): Cohort | undefined;
8
10
 
9
- declare const VERSION = "0.3.21";
11
+ declare const VERSION = "0.3.23";
10
12
 
11
13
  /**
12
14
  * parseDsn parses "https://<version>:<hmac>@<host>/v1/sentry/<projectId>" into its
@@ -128,56 +130,6 @@ declare function scrubPII(s: string): string;
128
130
  * first: unbounded text is a denial-of-service surface, not just a size problem. */
129
131
  declare function scrubText(s: string | undefined, capturePII?: boolean): string;
130
132
 
131
- declare const EVENTS: {
132
- readonly SIGNUP_VIEWED: "signup_viewed";
133
- readonly SIGNUP_SUBMITTED: "signup_submitted";
134
- readonly SIGNUP_VERIFIED: "signup_verified";
135
- readonly SIGNUP_COMPLETED: "signup_completed";
136
- /** A RETURNING user authenticated — the non-signup half of the IAM callback.
137
- * Keeping it distinct is what stops returning logins from inflating signups. */
138
- readonly LOGIN_COMPLETED: "login_completed";
139
- /** Activation: the first moment of real value. ONE event for every product —
140
- * the product-specific moment is the `action` property (api_call, app_live,
141
- * chat_reply), never a new event name. */
142
- readonly FIRST_ACTION: "first_action";
143
- readonly WAITLIST_JOINED: "waitlist_joined";
144
- readonly WAITLIST_SHARED: "waitlist_shared";
145
- readonly REFERRAL_USED: "referral_used";
146
- readonly REFERRAL_CLAIMED: "referral_claimed";
147
- readonly PRICING_VIEWED: "pricing_viewed";
148
- readonly PLAN_CLICKED: "plan_clicked";
149
- readonly CHECKOUT_STARTED: "checkout_started";
150
- readonly ORDER_COMPLETED: "order_completed";
151
- readonly FEATURE_USED: "feature_used";
152
- readonly API_KEY_CREATED: "api_key_created";
153
- readonly APP_CREATED: "app_created";
154
- readonly PROJECT_CREATED: "project_created";
155
- readonly AGENT_CREATED: "agent_created";
156
- readonly CHAT_STARTED: "chat_started";
157
- readonly CHAT_MESSAGE_SENT: "chat_message_sent";
158
- /** The user switched model/endpoint — the single strongest quality signal a
159
- * chat surface emits (a switch usually follows a bad answer). */
160
- readonly MODEL_SWITCHED: "model_switched";
161
- readonly TASK_STARTED: "task_started";
162
- readonly TASK_COMPLETED: "task_completed";
163
- readonly BUILD_STARTED: "build_started";
164
- /** A model finished producing an artifact (an app build, a chat reply, an agent
165
- * run). Carries `durationMs` — the outcome event owns its own duration, so no
166
- * paired start event is needed. */
167
- readonly GENERATION_COMPLETED: "generation_completed";
168
- readonly GENERATION_FAILED: "generation_failed";
169
- readonly DEPLOY_STARTED: "deploy_started";
170
- readonly DEPLOY_SUCCEEDED: "deploy_succeeded";
171
- readonly DEPLOY_FAILED: "deploy_failed";
172
- };
173
- type EventName = (typeof EVENTS)[keyof typeof EVENTS];
174
- /** The reserved event name a pageview is stored under (server + read lens). */
175
- declare const PAGEVIEW = "$pageview";
176
- /** The reserved name every captured exception is emitted under. Error Tracking
177
- * reads exactly this name; an exception emitted under its own message instead
178
- * makes every distinct message a permanent entry in the event taxonomy. */
179
- declare const EXCEPTION = "$exception";
180
-
181
133
  /**
182
134
  * digest is a stable 32-hex-char (128-bit) content hash, computed synchronously.
183
135
  *
@@ -227,96 +179,6 @@ declare function exceptionProperties(err: unknown, opts: {
227
179
  level?: SentryLevel;
228
180
  }): ExceptionProperties;
229
181
 
230
- /** The emitting surfaces — the closed set of `AnalyticsConfig.product` values.
231
- * `product` is on every event, so a funnel scopes by product instead of every
232
- * surface prefixing its event names. */
233
- declare const PRODUCTS: readonly ["site", "app", "chat", "console", "admin", "cloud"];
234
- type ProductId = (typeof PRODUCTS)[number];
235
- interface FunnelStep {
236
- /** An EVENTS value (or PAGEVIEW). */
237
- event: string;
238
- /** Human label for the Insights step. */
239
- label: string;
240
- /** Property equality that qualifies the step, e.g. first_action{action:'api_call'}. */
241
- where?: {
242
- property: string;
243
- equals: string;
244
- };
245
- }
246
- interface FunnelDef {
247
- label: string;
248
- /** Surface(s) the steps are emitted from — matched against the `product` field. */
249
- products: ProductId[];
250
- /**
251
- * How steps are joined:
252
- * • 'person' — steps join on distinctId (one browser, or one logged-in
253
- * person across surfaces). The normal case.
254
- * • 'aggregate' — steps are emitted on DIFFERENT origins by a LOGGED-OUT
255
- * visitor, so there is no shared id: hanzo.ai, hanzo.app and
256
- * hanzo.chat each mint their own anonymousId in their own
257
- * storage. Read these as step-over-step COUNTS, never as a
258
- * per-person conversion. Honest by construction.
259
- */
260
- join: 'person' | 'aggregate';
261
- steps: FunnelStep[];
262
- }
263
- declare const FUNNELS: {
264
- /** hanzo.ai: land → sign up. IAM hosts the form, so `signup_submitted` is the
265
- * redirect INTO IAM and `signup_completed` is the return at /auth/callback. */
266
- readonly signup: {
267
- readonly label: "Signup";
268
- readonly products: ["site"];
269
- readonly join: "person";
270
- readonly steps: [FunnelStep, FunnelStep, FunnelStep, FunnelStep, FunnelStep];
271
- };
272
- /** The developer activation path: an account is worth nothing until a key has
273
- * made a call. `first_action{action:'api_call'}` is emitted SERVER-SIDE by
274
- * Cloud on an org's first successful /v1 request — a browser cannot see it. */
275
- readonly apiActivation: {
276
- readonly label: "API activation";
277
- readonly products: ["site", "cloud"];
278
- readonly join: "person";
279
- readonly steps: [FunnelStep, FunnelStep, FunnelStep];
280
- };
281
- /** Upgrade intent → revenue. `order_completed{kind:'plan'}` is the Sale goal. */
282
- readonly upgrade: {
283
- readonly label: "Upgrade";
284
- readonly products: ["site", "app", "console"];
285
- readonly join: "person";
286
- readonly steps: [FunnelStep, FunnelStep, FunnelStep, FunnelStep];
287
- };
288
- /** hanzo.app: describe → build → deploy → live URL. The whole product thesis
289
- * in five steps; `deploy_succeeded` is the moment a live URL exists. */
290
- readonly appShip: {
291
- readonly label: "Describe → ship";
292
- readonly products: ["app"];
293
- readonly join: "person";
294
- readonly steps: [FunnelStep, FunnelStep, FunnelStep, FunnelStep, FunnelStep];
295
- };
296
- /** hanzo.chat: visit → first message → answer. `generation_completed` is what
297
- * separates "typed something" from "got value". */
298
- readonly chatEngage: {
299
- readonly label: "Chat engagement";
300
- readonly products: ["chat"];
301
- readonly join: "person";
302
- readonly steps: [FunnelStep, FunnelStep, FunnelStep, FunnelStep];
303
- };
304
- /** The cross-surface handoff: the hanzo.ai composer forwards its prompt to
305
- * hanzo.chat. Two origins, two anonymousIds — so this is an AGGREGATE funnel.
306
- * The join is the `referrerProduct` property hanzo.chat reads off `?hz_ref=`,
307
- * which makes the drop-off measurable without any cross-domain identity. */
308
- readonly siteToChat: {
309
- readonly label: "Site → Chat handoff";
310
- readonly products: ["site", "chat"];
311
- readonly join: "aggregate";
312
- readonly steps: [FunnelStep, FunnelStep, FunnelStep];
313
- };
314
- };
315
- type FunnelId = keyof typeof FUNNELS;
316
- /** eventsOf flattens a funnel to its ordered event names — what a goal's `funnel`
317
- * field carries, so the steps are defined exactly once (here). */
318
- declare function eventsOf(id: FunnelId): string[];
319
-
320
182
  interface GoalDef {
321
183
  /** Human label shown in Insights. */
322
184
  label: string;
@@ -353,4 +215,4 @@ declare function hasAttribution(a: Attribution): boolean;
353
215
  /** isoWeek returns the ISO-8601 week label, e.g. "2026-W28". */
354
216
  declare function isoWeek(d: Date): string;
355
217
 
356
- export { Attribution, COHORTS, CaptureErrorOptions, Cohort, type CohortDef, Dsn, EVENTS, EXCEPTION, type ErrorIdentity, type EventName, ExceptionEntry, ExceptionProperties, FUNNELS, type FunnelDef, type FunnelId, type FunnelStep, GOALS, type GoalDef, PAGEVIEW, PRODUCTS, PRODUCT_PROJECT, type ProductId, SentryEvent, SentryFrame, SentryLevel, VERSION, buildEnvelope, buildSentryEvent, deriveChannel, digest, dsnForProduct, eventsOf, exceptionEntry, exceptionProperties, fingerprint, framesFromStack, getCohort, getFirstTouch, hasAttribution, hostOf, isoWeek, parseAttribution, parseDsn, redactSecrets, scrubPII, scrubText, hzUuidv7 as uuidv7, uuidv7Time };
218
+ export { Attribution, COHORTS, CaptureErrorOptions, Cohort, type CohortDef, Dsn, type ErrorIdentity, ExceptionEntry, ExceptionProperties, GOALS, type GoalDef, PRODUCT_PROJECT, SentryEvent, SentryFrame, SentryLevel, VERSION, buildEnvelope, buildSentryEvent, deriveChannel, digest, dsnForProduct, exceptionEntry, exceptionProperties, fingerprint, framesFromStack, getCohort, getFirstTouch, hasAttribution, hostOf, isoWeek, parseAttribution, parseDsn, redactSecrets, scrubPII, scrubText, hzUuidv7 as uuidv7, uuidv7Time };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  import { C as Cohort, A as Attribution, S as SentryEvent, D as Dsn, a as CaptureErrorOptions, b as SentryFrame, E as ExceptionEntry, c as SentryLevel, d as ExceptionProperties } from './core-CHLpJy51.js';
2
2
  export { e as Analytics, f as AnalyticsConfig, g as EventKind, h as Exception, i as ExceptionFrame, T as Transport, W as WireEvent, j as createAnalytics } from './core-CHLpJy51.js';
3
+ import { FunnelId } from '@hanzo/events';
4
+ export { EVENTS, EXCEPTION, EventName, FUNNELS, FunnelDef, FunnelId, FunnelStep, PAGEVIEW, PRODUCTS, ProductId, eventsOf } from '@hanzo/events';
3
5
 
4
6
  /** Read the persisted first-touch attribution. */
5
7
  declare function getFirstTouch(): Attribution | undefined;
6
8
  /** Read persisted cohort dimensions. */
7
9
  declare function getCohort(): Cohort | undefined;
8
10
 
9
- declare const VERSION = "0.3.21";
11
+ declare const VERSION = "0.3.23";
10
12
 
11
13
  /**
12
14
  * parseDsn parses "https://<version>:<hmac>@<host>/v1/sentry/<projectId>" into its
@@ -128,56 +130,6 @@ declare function scrubPII(s: string): string;
128
130
  * first: unbounded text is a denial-of-service surface, not just a size problem. */
129
131
  declare function scrubText(s: string | undefined, capturePII?: boolean): string;
130
132
 
131
- declare const EVENTS: {
132
- readonly SIGNUP_VIEWED: "signup_viewed";
133
- readonly SIGNUP_SUBMITTED: "signup_submitted";
134
- readonly SIGNUP_VERIFIED: "signup_verified";
135
- readonly SIGNUP_COMPLETED: "signup_completed";
136
- /** A RETURNING user authenticated — the non-signup half of the IAM callback.
137
- * Keeping it distinct is what stops returning logins from inflating signups. */
138
- readonly LOGIN_COMPLETED: "login_completed";
139
- /** Activation: the first moment of real value. ONE event for every product —
140
- * the product-specific moment is the `action` property (api_call, app_live,
141
- * chat_reply), never a new event name. */
142
- readonly FIRST_ACTION: "first_action";
143
- readonly WAITLIST_JOINED: "waitlist_joined";
144
- readonly WAITLIST_SHARED: "waitlist_shared";
145
- readonly REFERRAL_USED: "referral_used";
146
- readonly REFERRAL_CLAIMED: "referral_claimed";
147
- readonly PRICING_VIEWED: "pricing_viewed";
148
- readonly PLAN_CLICKED: "plan_clicked";
149
- readonly CHECKOUT_STARTED: "checkout_started";
150
- readonly ORDER_COMPLETED: "order_completed";
151
- readonly FEATURE_USED: "feature_used";
152
- readonly API_KEY_CREATED: "api_key_created";
153
- readonly APP_CREATED: "app_created";
154
- readonly PROJECT_CREATED: "project_created";
155
- readonly AGENT_CREATED: "agent_created";
156
- readonly CHAT_STARTED: "chat_started";
157
- readonly CHAT_MESSAGE_SENT: "chat_message_sent";
158
- /** The user switched model/endpoint — the single strongest quality signal a
159
- * chat surface emits (a switch usually follows a bad answer). */
160
- readonly MODEL_SWITCHED: "model_switched";
161
- readonly TASK_STARTED: "task_started";
162
- readonly TASK_COMPLETED: "task_completed";
163
- readonly BUILD_STARTED: "build_started";
164
- /** A model finished producing an artifact (an app build, a chat reply, an agent
165
- * run). Carries `durationMs` — the outcome event owns its own duration, so no
166
- * paired start event is needed. */
167
- readonly GENERATION_COMPLETED: "generation_completed";
168
- readonly GENERATION_FAILED: "generation_failed";
169
- readonly DEPLOY_STARTED: "deploy_started";
170
- readonly DEPLOY_SUCCEEDED: "deploy_succeeded";
171
- readonly DEPLOY_FAILED: "deploy_failed";
172
- };
173
- type EventName = (typeof EVENTS)[keyof typeof EVENTS];
174
- /** The reserved event name a pageview is stored under (server + read lens). */
175
- declare const PAGEVIEW = "$pageview";
176
- /** The reserved name every captured exception is emitted under. Error Tracking
177
- * reads exactly this name; an exception emitted under its own message instead
178
- * makes every distinct message a permanent entry in the event taxonomy. */
179
- declare const EXCEPTION = "$exception";
180
-
181
133
  /**
182
134
  * digest is a stable 32-hex-char (128-bit) content hash, computed synchronously.
183
135
  *
@@ -227,96 +179,6 @@ declare function exceptionProperties(err: unknown, opts: {
227
179
  level?: SentryLevel;
228
180
  }): ExceptionProperties;
229
181
 
230
- /** The emitting surfaces — the closed set of `AnalyticsConfig.product` values.
231
- * `product` is on every event, so a funnel scopes by product instead of every
232
- * surface prefixing its event names. */
233
- declare const PRODUCTS: readonly ["site", "app", "chat", "console", "admin", "cloud"];
234
- type ProductId = (typeof PRODUCTS)[number];
235
- interface FunnelStep {
236
- /** An EVENTS value (or PAGEVIEW). */
237
- event: string;
238
- /** Human label for the Insights step. */
239
- label: string;
240
- /** Property equality that qualifies the step, e.g. first_action{action:'api_call'}. */
241
- where?: {
242
- property: string;
243
- equals: string;
244
- };
245
- }
246
- interface FunnelDef {
247
- label: string;
248
- /** Surface(s) the steps are emitted from — matched against the `product` field. */
249
- products: ProductId[];
250
- /**
251
- * How steps are joined:
252
- * • 'person' — steps join on distinctId (one browser, or one logged-in
253
- * person across surfaces). The normal case.
254
- * • 'aggregate' — steps are emitted on DIFFERENT origins by a LOGGED-OUT
255
- * visitor, so there is no shared id: hanzo.ai, hanzo.app and
256
- * hanzo.chat each mint their own anonymousId in their own
257
- * storage. Read these as step-over-step COUNTS, never as a
258
- * per-person conversion. Honest by construction.
259
- */
260
- join: 'person' | 'aggregate';
261
- steps: FunnelStep[];
262
- }
263
- declare const FUNNELS: {
264
- /** hanzo.ai: land → sign up. IAM hosts the form, so `signup_submitted` is the
265
- * redirect INTO IAM and `signup_completed` is the return at /auth/callback. */
266
- readonly signup: {
267
- readonly label: "Signup";
268
- readonly products: ["site"];
269
- readonly join: "person";
270
- readonly steps: [FunnelStep, FunnelStep, FunnelStep, FunnelStep, FunnelStep];
271
- };
272
- /** The developer activation path: an account is worth nothing until a key has
273
- * made a call. `first_action{action:'api_call'}` is emitted SERVER-SIDE by
274
- * Cloud on an org's first successful /v1 request — a browser cannot see it. */
275
- readonly apiActivation: {
276
- readonly label: "API activation";
277
- readonly products: ["site", "cloud"];
278
- readonly join: "person";
279
- readonly steps: [FunnelStep, FunnelStep, FunnelStep];
280
- };
281
- /** Upgrade intent → revenue. `order_completed{kind:'plan'}` is the Sale goal. */
282
- readonly upgrade: {
283
- readonly label: "Upgrade";
284
- readonly products: ["site", "app", "console"];
285
- readonly join: "person";
286
- readonly steps: [FunnelStep, FunnelStep, FunnelStep, FunnelStep];
287
- };
288
- /** hanzo.app: describe → build → deploy → live URL. The whole product thesis
289
- * in five steps; `deploy_succeeded` is the moment a live URL exists. */
290
- readonly appShip: {
291
- readonly label: "Describe → ship";
292
- readonly products: ["app"];
293
- readonly join: "person";
294
- readonly steps: [FunnelStep, FunnelStep, FunnelStep, FunnelStep, FunnelStep];
295
- };
296
- /** hanzo.chat: visit → first message → answer. `generation_completed` is what
297
- * separates "typed something" from "got value". */
298
- readonly chatEngage: {
299
- readonly label: "Chat engagement";
300
- readonly products: ["chat"];
301
- readonly join: "person";
302
- readonly steps: [FunnelStep, FunnelStep, FunnelStep, FunnelStep];
303
- };
304
- /** The cross-surface handoff: the hanzo.ai composer forwards its prompt to
305
- * hanzo.chat. Two origins, two anonymousIds — so this is an AGGREGATE funnel.
306
- * The join is the `referrerProduct` property hanzo.chat reads off `?hz_ref=`,
307
- * which makes the drop-off measurable without any cross-domain identity. */
308
- readonly siteToChat: {
309
- readonly label: "Site → Chat handoff";
310
- readonly products: ["site", "chat"];
311
- readonly join: "aggregate";
312
- readonly steps: [FunnelStep, FunnelStep, FunnelStep];
313
- };
314
- };
315
- type FunnelId = keyof typeof FUNNELS;
316
- /** eventsOf flattens a funnel to its ordered event names — what a goal's `funnel`
317
- * field carries, so the steps are defined exactly once (here). */
318
- declare function eventsOf(id: FunnelId): string[];
319
-
320
182
  interface GoalDef {
321
183
  /** Human label shown in Insights. */
322
184
  label: string;
@@ -353,4 +215,4 @@ declare function hasAttribution(a: Attribution): boolean;
353
215
  /** isoWeek returns the ISO-8601 week label, e.g. "2026-W28". */
354
216
  declare function isoWeek(d: Date): string;
355
217
 
356
- export { Attribution, COHORTS, CaptureErrorOptions, Cohort, type CohortDef, Dsn, EVENTS, EXCEPTION, type ErrorIdentity, type EventName, ExceptionEntry, ExceptionProperties, FUNNELS, type FunnelDef, type FunnelId, type FunnelStep, GOALS, type GoalDef, PAGEVIEW, PRODUCTS, PRODUCT_PROJECT, type ProductId, SentryEvent, SentryFrame, SentryLevel, VERSION, buildEnvelope, buildSentryEvent, deriveChannel, digest, dsnForProduct, eventsOf, exceptionEntry, exceptionProperties, fingerprint, framesFromStack, getCohort, getFirstTouch, hasAttribution, hostOf, isoWeek, parseAttribution, parseDsn, redactSecrets, scrubPII, scrubText, hzUuidv7 as uuidv7, uuidv7Time };
218
+ export { Attribution, COHORTS, CaptureErrorOptions, Cohort, type CohortDef, Dsn, type ErrorIdentity, ExceptionEntry, ExceptionProperties, GOALS, type GoalDef, PRODUCT_PROJECT, SentryEvent, SentryFrame, SentryLevel, VERSION, buildEnvelope, buildSentryEvent, deriveChannel, digest, dsnForProduct, exceptionEntry, exceptionProperties, fingerprint, framesFromStack, getCohort, getFirstTouch, hasAttribution, hostOf, isoWeek, parseAttribution, parseDsn, redactSecrets, scrubPII, scrubText, hzUuidv7 as uuidv7, uuidv7Time };