@hanzo/event 0.3.35 → 0.3.37
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/LICENSE.md +21 -0
- package/README.md +8 -8
- package/TAXONOMY.md +1 -1
- package/dist/attribution.d.ts +14 -0
- package/dist/attribution.d.ts.map +1 -0
- package/dist/core.d.ts +102 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/dsn.d.ts +43 -0
- package/dist/dsn.d.ts.map +1 -0
- package/dist/events.d.ts +21 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/exception.d.ts +50 -0
- package/dist/exception.d.ts.map +1 -0
- package/dist/funnels.d.ts +14 -0
- package/dist/funnels.d.ts.map +1 -0
- package/dist/goals.d.ts +24 -0
- package/dist/goals.d.ts.map +1 -0
- package/dist/index.cjs +24 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -292
- package/dist/index.d.ts +22 -292
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +24 -8
- package/dist/index.mjs.map +1 -1
- package/dist/org.d.ts +74 -0
- package/dist/org.d.ts.map +1 -0
- package/dist/react.cjs +24 -8
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +13 -14
- package/dist/react.d.ts +13 -14
- package/dist/react.d.ts.map +1 -0
- package/dist/react.mjs +24 -8
- package/dist/react.mjs.map +1 -1
- package/dist/scrub.d.ts +20 -0
- package/dist/scrub.d.ts.map +1 -0
- package/dist/sentry.d.ts +62 -0
- package/dist/sentry.d.ts.map +1 -0
- package/dist/stack.d.ts +25 -0
- package/dist/stack.d.ts.map +1 -0
- package/dist/storage.d.ts +32 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/{core-CIhI2R7S.d.cts → types.d.ts} +21 -119
- package/dist/types.d.ts.map +1 -0
- package/dist/uid.d.ts +10 -0
- package/dist/uid.d.ts.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +11 -11
- package/src/anon.d.ts +1 -1
- package/src/anon.js +3 -3
- package/src/anon.test.ts +3 -3
- package/src/core.test.ts +6 -6
- package/src/core.ts +11 -11
- package/src/events.ts +1 -1
- package/src/exception.ts +1 -1
- package/src/org.test.ts +16 -0
- package/src/org.ts +17 -1
- package/src/stack.ts +1 -1
- package/src/types.ts +3 -3
- package/src/uid.ts +2 -2
- package/src/version.ts +1 -1
- package/dist/core-CIhI2R7S.d.ts +0 -380
package/dist/react.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
interface AnalyticsProviderProps {
|
|
1
|
+
import { Component, type ErrorInfo, type ReactNode } from 'react';
|
|
2
|
+
import { Analytics } from './core';
|
|
3
|
+
import type { AnalyticsConfig } from './types';
|
|
4
|
+
declare const Ctx: import("react").Context<Analytics | null>;
|
|
5
|
+
export interface AnalyticsProviderProps {
|
|
7
6
|
/** Provide a pre-built client, or a config to build one. */
|
|
8
7
|
client?: Analytics;
|
|
9
8
|
config?: AnalyticsConfig;
|
|
@@ -11,14 +10,14 @@ interface AnalyticsProviderProps {
|
|
|
11
10
|
autoPageview?: boolean;
|
|
12
11
|
children: ReactNode;
|
|
13
12
|
}
|
|
14
|
-
declare function AnalyticsProvider(props: AnalyticsProviderProps): react.FunctionComponentElement<react.ProviderProps<Analytics | null>>;
|
|
13
|
+
export declare function AnalyticsProvider(props: AnalyticsProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<Analytics | null>>;
|
|
15
14
|
/** useAnalytics returns the client. Outside a provider it returns a no-op-safe
|
|
16
15
|
* null-guarded proxy so calls never throw during SSR/tests. */
|
|
17
|
-
declare function useAnalytics(): Analytics;
|
|
16
|
+
export declare function useAnalytics(): Analytics;
|
|
18
17
|
/** usePageview fires a pageview on every route CHANGE (not the initial mount —
|
|
19
18
|
* the provider's autoPageview covers that, so pages are counted exactly once). */
|
|
20
|
-
declare function usePageview(path: string | null | undefined): void;
|
|
21
|
-
interface ErrorBoundaryProps {
|
|
19
|
+
export declare function usePageview(path: string | null | undefined): void;
|
|
20
|
+
export interface ErrorBoundaryProps {
|
|
22
21
|
children: ReactNode;
|
|
23
22
|
/** Rendered when a child throws. A function receives the error + a reset. */
|
|
24
23
|
fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode);
|
|
@@ -33,8 +32,8 @@ interface ErrorBoundaryState {
|
|
|
33
32
|
* ONLY way to capture them. This is the React half of the @sentry replacement.
|
|
34
33
|
* Pair it with AnalyticsProvider (it reads the client from context), or pass an
|
|
35
34
|
* explicit `client`. */
|
|
36
|
-
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
37
|
-
static contextType: react.Context<Analytics | null>;
|
|
35
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
36
|
+
static contextType: import("react").Context<Analytics | null>;
|
|
38
37
|
context: React.ContextType<typeof Ctx>;
|
|
39
38
|
state: ErrorBoundaryState;
|
|
40
39
|
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
@@ -42,5 +41,5 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryS
|
|
|
42
41
|
private reset;
|
|
43
42
|
render(): ReactNode;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
interface AnalyticsProviderProps {
|
|
1
|
+
import { Component, type ErrorInfo, type ReactNode } from 'react';
|
|
2
|
+
import { Analytics } from './core';
|
|
3
|
+
import type { AnalyticsConfig } from './types';
|
|
4
|
+
declare const Ctx: import("react").Context<Analytics | null>;
|
|
5
|
+
export interface AnalyticsProviderProps {
|
|
7
6
|
/** Provide a pre-built client, or a config to build one. */
|
|
8
7
|
client?: Analytics;
|
|
9
8
|
config?: AnalyticsConfig;
|
|
@@ -11,14 +10,14 @@ interface AnalyticsProviderProps {
|
|
|
11
10
|
autoPageview?: boolean;
|
|
12
11
|
children: ReactNode;
|
|
13
12
|
}
|
|
14
|
-
declare function AnalyticsProvider(props: AnalyticsProviderProps): react.FunctionComponentElement<react.ProviderProps<Analytics | null>>;
|
|
13
|
+
export declare function AnalyticsProvider(props: AnalyticsProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<Analytics | null>>;
|
|
15
14
|
/** useAnalytics returns the client. Outside a provider it returns a no-op-safe
|
|
16
15
|
* null-guarded proxy so calls never throw during SSR/tests. */
|
|
17
|
-
declare function useAnalytics(): Analytics;
|
|
16
|
+
export declare function useAnalytics(): Analytics;
|
|
18
17
|
/** usePageview fires a pageview on every route CHANGE (not the initial mount —
|
|
19
18
|
* the provider's autoPageview covers that, so pages are counted exactly once). */
|
|
20
|
-
declare function usePageview(path: string | null | undefined): void;
|
|
21
|
-
interface ErrorBoundaryProps {
|
|
19
|
+
export declare function usePageview(path: string | null | undefined): void;
|
|
20
|
+
export interface ErrorBoundaryProps {
|
|
22
21
|
children: ReactNode;
|
|
23
22
|
/** Rendered when a child throws. A function receives the error + a reset. */
|
|
24
23
|
fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode);
|
|
@@ -33,8 +32,8 @@ interface ErrorBoundaryState {
|
|
|
33
32
|
* ONLY way to capture them. This is the React half of the @sentry replacement.
|
|
34
33
|
* Pair it with AnalyticsProvider (it reads the client from context), or pass an
|
|
35
34
|
* explicit `client`. */
|
|
36
|
-
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
37
|
-
static contextType: react.Context<Analytics | null>;
|
|
35
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
36
|
+
static contextType: import("react").Context<Analytics | null>;
|
|
38
37
|
context: React.ContextType<typeof Ctx>;
|
|
39
38
|
state: ErrorBoundaryState;
|
|
40
39
|
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
@@ -42,5 +41,5 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryS
|
|
|
42
41
|
private reset;
|
|
43
42
|
render(): ReactNode;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAWA,OAAO,EACL,SAAS,EAMT,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,SAAS,EAAmB,MAAM,QAAQ,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,QAAA,MAAM,GAAG,2CAAwC,CAAA;AAEjD,MAAM,WAAW,sBAAsB;IACrC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,6FAgB9D;AAED;gEACgE;AAChE,wBAAgB,YAAY,IAAI,SAAS,CAIxC;AAED;mFACmF;AACnF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAUjE;AAKD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAA;IACnB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,SAAS,CAAC,CAAA;IACvE,mEAAmE;IACnE,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB;AAED,UAAU,kBAAkB;IAC1B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB;AAED;;;;yBAIyB;AACzB,qBAAa,aAAc,SAAQ,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAClF,MAAM,CAAC,WAAW,4CAAM;IAChB,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO,GAAG,CAAC,CAAA;IAC9C,KAAK,EAAE,kBAAkB,CAAkB;IAE3C,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB,CAEhE;IAED,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAMrD;IAED,OAAO,CAAC,KAAK,CAAuC;IAEpD,MAAM,IAAI,SAAS,CAMlB;CACF"}
|
package/dist/react.mjs
CHANGED
|
@@ -86,7 +86,23 @@ function dsnForProduct(product, key) {
|
|
|
86
86
|
|
|
87
87
|
// src/org.ts
|
|
88
88
|
var ORG_DOMAIN = Object.freeze({
|
|
89
|
-
|
|
89
|
+
// A brand's domains are not a pattern — `hanzoskills.com` is Hanzo's and does
|
|
90
|
+
// not end in `hanzo.ai`, while `hanzo.works` is a registrable domain of its own
|
|
91
|
+
// rather than a subdomain of anything here. Each is stated because each is a
|
|
92
|
+
// separate fact, which is the whole reason this is a table.
|
|
93
|
+
hanzo: Object.freeze([
|
|
94
|
+
"hanzo.ai",
|
|
95
|
+
"hanzo.app",
|
|
96
|
+
"hanzo.bot",
|
|
97
|
+
"hanzo.chat",
|
|
98
|
+
"hanzo.codes",
|
|
99
|
+
"hanzo.id",
|
|
100
|
+
"hanzo.sh",
|
|
101
|
+
"hanzo.team",
|
|
102
|
+
"hanzo.ventures",
|
|
103
|
+
"hanzo.works",
|
|
104
|
+
"hanzoskills.com"
|
|
105
|
+
]),
|
|
90
106
|
lux: Object.freeze([
|
|
91
107
|
"lux.network",
|
|
92
108
|
"lux.exchange",
|
|
@@ -364,7 +380,7 @@ function hzAnonId() {
|
|
|
364
380
|
}
|
|
365
381
|
|
|
366
382
|
// src/version.ts
|
|
367
|
-
var VERSION = "0.3.
|
|
383
|
+
var VERSION = "0.3.37";
|
|
368
384
|
|
|
369
385
|
// src/sentry.ts
|
|
370
386
|
var MAX_FRAMES = 50;
|
|
@@ -834,10 +850,10 @@ var Analytics = class {
|
|
|
834
850
|
// so before this the only way to report was to commit a key literal, and the
|
|
835
851
|
// fleet grew one copy per site of a value with a single source.
|
|
836
852
|
//
|
|
837
|
-
// A surface no brand claims still has no key, and the
|
|
853
|
+
// A surface no brand claims still has no key, and the edge REFUSES an
|
|
838
854
|
// unattributed event (401 `ingest_key_required`) — the reserved `$public`
|
|
839
855
|
// tenant that once caught keyless beacons is retired, and anonymous ingest is
|
|
840
|
-
// refused at every
|
|
856
|
+
// refused at every edge on every brand host. So there is no quiet fallback to
|
|
841
857
|
// rely on: an event lands in the org a credential names, or it does not land.
|
|
842
858
|
ingestKey: config.ingestKey ?? readEnv("NEXT_PUBLIC_PUBLISHABLE_KEY") ?? keyForPage()
|
|
843
859
|
};
|
|
@@ -975,7 +991,7 @@ var Analytics = class {
|
|
|
975
991
|
this.cohort = mergeCohort(patch);
|
|
976
992
|
}
|
|
977
993
|
/** flush drains the buffer to the server as ONE batch through the ONE ingest
|
|
978
|
-
*
|
|
994
|
+
* endpoint POST /v1/event, body { batch: [Event…] }. beacon=true selects the
|
|
979
995
|
* unload-safe transport. Auth is orthogonal to the wire:
|
|
980
996
|
*
|
|
981
997
|
* • publishable key set → rides ?ingest_key=pk-… on both sends, keeping each
|
|
@@ -1188,15 +1204,15 @@ ErrorBoundary.contextType = Ctx;
|
|
|
1188
1204
|
*
|
|
1189
1205
|
* The two call sites:
|
|
1190
1206
|
* 1. src/storage.ts — the bundled npm client; IMPORTS this file.
|
|
1191
|
-
* 2. hanzoai/cloud apps/analytics/tag.js — the tag
|
|
1207
|
+
* 2. hanzoai/cloud apps/analytics/tag.js — the tag served at
|
|
1192
1208
|
* /v1/event.js; vendors this file and its tag.go serves the marked region
|
|
1193
|
-
* with the tag as one asset, so
|
|
1209
|
+
* with the tag as one asset, so cloud holds no second copy either.
|
|
1194
1210
|
*
|
|
1195
1211
|
* (2) has no bundler and cannot import anything, which is why the chain lives in a
|
|
1196
1212
|
* file that is plain ES5 rather than in a .ts: the region between the BEGIN and END
|
|
1197
1213
|
* markers is COPIED VERBATIM. Keep it ES5, dependency-free, `hz`-prefixed (it is
|
|
1198
1214
|
* spliced into other people's scopes) and unformatted — a reformat here is a diff
|
|
1199
|
-
* against the vendored copy. After editing, resync
|
|
1215
|
+
* against the vendored copy. After editing, resync that copy:
|
|
1200
1216
|
*
|
|
1201
1217
|
* curl -fsSL https://unpkg.com/@hanzo/event/src/anon.js -o apps/analytics/anon.js
|
|
1202
1218
|
*/
|