@heycatch/sdk 0.7.0-dev.13 → 0.7.0-dev.43

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,78 +1,5 @@
1
- /**
2
- * Which HeyCatch backend this bundle was built against - `dev` or `prod`.
3
- * Introspection for debugging ("which stage bundle is this page running?"),
4
- * and stamped on every event as `heycatch_sdk_stage`. Describes OUR backend,
5
- * not the customer's own app environment.
6
- */
7
- declare const STAGE: "dev" | "prod";
8
- declare const SDK_VERSION: string;
9
- /**
10
- * Frameworks the install guides can detect. Kept as a type alias, not a
11
- * runtime array: `apps/landing-web/tests/agent-install-guides.spec.ts`
12
- * reads this source text and asserts the set matches the guides' tables,
13
- * so docs, types, and reported values cannot drift.
14
- */
15
- type KnownFramework = 'nextjs' | 'vite-react' | 'react' | 'vue' | 'svelte' | 'astro' | 'angular' | 'web';
16
- /** Coding agents that run the install. `other` is the catch-all. */
17
- type KnownInstallAgent = 'lovable' | 'bolt' | 'v0' | 'replit' | 'cursor' | 'claude-code' | 'codex' | 'windsurf' | 'other';
18
- /**
19
- * Who installed the SDK and into what. Stamped as super-properties on
20
- * every event - the dashboard reads them off the event stream, so there
21
- * is no separate install call to make or to fail.
22
- *
23
- * `(string & {})` keeps the known ids as editor completions while still
24
- * accepting anything: a framework we haven't listed yet must not block
25
- * an install.
26
- */
27
- interface HeyCatchInstall {
28
- /** Framework id from the install guide, e.g. `nextjs`. */
29
- framework?: KnownFramework | (string & {});
30
- /** That framework's major version, e.g. `15`. */
31
- frameworkVersion?: string;
32
- /** The agent doing the install, e.g. `claude-code`. */
33
- agent?: KnownInstallAgent | (string & {});
34
- }
35
- /** Configuration for {@link init}. */
36
- interface HeyCatchConfig {
37
- /** Your project's publishable key (`hck_pk_...`). */
38
- projectKey: string;
39
- /** Install metadata, stamped on every event. Omit any field you can't determine. */
40
- install?: HeyCatchInstall;
41
- }
42
-
43
- /**
44
- * Initialize HeyCatch. Call once at the client-side entry point -
45
- * autocapture starts immediately, nothing else to instrument.
46
- * Idempotent and a safe no-op on the server.
47
- */
48
- declare function init(config: HeyCatchConfig): void;
49
-
50
- /**
51
- * Person and event properties a customer's app can send.
52
- *
53
- * Deliberately not `unknown`: these values are serialised onto the wire and
54
- * rendered in a dashboard, so a nested object or a function would either be
55
- * dropped upstream or arrive as `[object Object]`. Restricting the type puts
56
- * that failure at the call site, in the customer's editor.
57
- */
58
- type HeyCatchProperties = Record<string, string | number | boolean | null>;
59
- /**
60
- * Person properties, in the two flavours every analytics backend distinguishes.
61
- *
62
- * - `set` overwrites on every send - use for values that change (`plan`,
63
- * `last_seen_at`).
64
- * - `setOnce` writes only if the person does not already have the key - use for
65
- * values that describe the beginning and must not be overwritten by a later
66
- * visit (`signup_date`, `initial_referrer`).
67
- *
68
- * Named `set` / `setOnce` rather than the transport's own `$set` / `$set_once`:
69
- * the `$` names are an implementation detail of who we send to, and this is a
70
- * published customer-facing API that must not change if that ever does.
71
- */
72
- interface PersonPropertyUpdate {
73
- set?: HeyCatchProperties;
74
- setOnce?: HeyCatchProperties;
75
- }
1
+ import { a as HeyCatchPersonProperties, H as HeyCatchConfig, b as HeyCatchProperties, T as TrackOptions } from './shared-B8y8fJCD.cjs';
2
+ export { P as PersonPropertyUpdate, S as SDK_VERSION, c as STAGE, d as ServerTrackOptions } from './shared-B8y8fJCD.cjs';
76
3
 
77
4
  /**
78
5
  * Link the anonymous visitor to your authenticated user. Call once
@@ -90,28 +17,20 @@ interface PersonPropertyUpdate {
90
17
  * those as regular properties would reset them on every login.
91
18
  *
92
19
  * @example
93
- * identify(user.id,
20
+ * setIdentity(user.id,
94
21
  * { email: user.email, plan: 'pro' },
95
22
  * { signup_date: user.createdAt },
96
23
  * );
97
24
  */
98
- declare function identify(userId: string, properties?: HeyCatchProperties, propertiesOnce?: HeyCatchProperties): void;
25
+ declare function setIdentity(userId: string, properties?: HeyCatchPersonProperties, propertiesOnce?: HeyCatchPersonProperties): void;
99
26
  /**
100
27
  * Clear the current identity. Call on sign-out so the next visitor on
101
28
  * this browser starts anonymous.
102
29
  */
103
- declare function reset(): void;
30
+ declare function resetIdentity(): void;
31
+
32
+ declare function init(config: HeyCatchConfig): void;
104
33
 
105
- interface TrackOptions extends PersonPropertyUpdate {
106
- /**
107
- * Send this event immediately instead of batching it.
108
- *
109
- * Only worth setting when the page is about to unload - a sign-up redirect,
110
- * a checkout hand-off - where a batched event would be lost. It costs a
111
- * request per event, so it is not the default.
112
- */
113
- sendInstantly?: boolean;
114
- }
115
34
  /**
116
35
  * Record a product event.
117
36
  *
@@ -131,7 +50,7 @@ interface TrackOptions extends PersonPropertyUpdate {
131
50
  *
132
51
  * No-op before `init()` or on the server.
133
52
  */
134
- declare function track(event: string, properties?: HeyCatchProperties, options?: TrackOptions): void;
53
+ declare function trackEvent(event: string, properties?: HeyCatchProperties, options?: TrackOptions): void;
135
54
  /**
136
55
  * Update the current person's properties without sending a product event, and
137
56
  * without changing who they are.
@@ -145,6 +64,22 @@ declare function track(event: string, properties?: HeyCatchProperties, options?:
145
64
  *
146
65
  * No-op before `init()` or on the server.
147
66
  */
148
- declare function setPersonProperties(set?: HeyCatchProperties, setOnce?: HeyCatchProperties): void;
67
+ declare function setPersonProperties(set?: HeyCatchPersonProperties, setOnce?: HeyCatchPersonProperties): void;
68
+
69
+ /**
70
+ * The analytics surface, as one namespace. The package is HeyCatch's
71
+ * product SDK - analytics is its first capability, not its identity - so
72
+ * the API ships as `analytics.*` and a future capability arrives as a
73
+ * sibling namespace instead of more loose top-level functions. The server
74
+ * entry exports the same-shaped object, which is what keeps isomorphic
75
+ * code resolving under every `exports` condition.
76
+ */
77
+ declare const analytics: {
78
+ readonly init: typeof init;
79
+ readonly resetIdentity: typeof resetIdentity;
80
+ readonly setIdentity: typeof setIdentity;
81
+ readonly setPersonProperties: typeof setPersonProperties;
82
+ readonly trackEvent: typeof trackEvent;
83
+ };
149
84
 
150
- export { type HeyCatchConfig, type HeyCatchProperties, type PersonPropertyUpdate, SDK_VERSION, STAGE, type TrackOptions, identify, init, reset, setPersonProperties, track };
85
+ export { HeyCatchConfig, HeyCatchPersonProperties, HeyCatchProperties, TrackOptions, analytics };
package/dist/index.d.ts CHANGED
@@ -1,78 +1,5 @@
1
- /**
2
- * Which HeyCatch backend this bundle was built against - `dev` or `prod`.
3
- * Introspection for debugging ("which stage bundle is this page running?"),
4
- * and stamped on every event as `heycatch_sdk_stage`. Describes OUR backend,
5
- * not the customer's own app environment.
6
- */
7
- declare const STAGE: "dev" | "prod";
8
- declare const SDK_VERSION: string;
9
- /**
10
- * Frameworks the install guides can detect. Kept as a type alias, not a
11
- * runtime array: `apps/landing-web/tests/agent-install-guides.spec.ts`
12
- * reads this source text and asserts the set matches the guides' tables,
13
- * so docs, types, and reported values cannot drift.
14
- */
15
- type KnownFramework = 'nextjs' | 'vite-react' | 'react' | 'vue' | 'svelte' | 'astro' | 'angular' | 'web';
16
- /** Coding agents that run the install. `other` is the catch-all. */
17
- type KnownInstallAgent = 'lovable' | 'bolt' | 'v0' | 'replit' | 'cursor' | 'claude-code' | 'codex' | 'windsurf' | 'other';
18
- /**
19
- * Who installed the SDK and into what. Stamped as super-properties on
20
- * every event - the dashboard reads them off the event stream, so there
21
- * is no separate install call to make or to fail.
22
- *
23
- * `(string & {})` keeps the known ids as editor completions while still
24
- * accepting anything: a framework we haven't listed yet must not block
25
- * an install.
26
- */
27
- interface HeyCatchInstall {
28
- /** Framework id from the install guide, e.g. `nextjs`. */
29
- framework?: KnownFramework | (string & {});
30
- /** That framework's major version, e.g. `15`. */
31
- frameworkVersion?: string;
32
- /** The agent doing the install, e.g. `claude-code`. */
33
- agent?: KnownInstallAgent | (string & {});
34
- }
35
- /** Configuration for {@link init}. */
36
- interface HeyCatchConfig {
37
- /** Your project's publishable key (`hck_pk_...`). */
38
- projectKey: string;
39
- /** Install metadata, stamped on every event. Omit any field you can't determine. */
40
- install?: HeyCatchInstall;
41
- }
42
-
43
- /**
44
- * Initialize HeyCatch. Call once at the client-side entry point -
45
- * autocapture starts immediately, nothing else to instrument.
46
- * Idempotent and a safe no-op on the server.
47
- */
48
- declare function init(config: HeyCatchConfig): void;
49
-
50
- /**
51
- * Person and event properties a customer's app can send.
52
- *
53
- * Deliberately not `unknown`: these values are serialised onto the wire and
54
- * rendered in a dashboard, so a nested object or a function would either be
55
- * dropped upstream or arrive as `[object Object]`. Restricting the type puts
56
- * that failure at the call site, in the customer's editor.
57
- */
58
- type HeyCatchProperties = Record<string, string | number | boolean | null>;
59
- /**
60
- * Person properties, in the two flavours every analytics backend distinguishes.
61
- *
62
- * - `set` overwrites on every send - use for values that change (`plan`,
63
- * `last_seen_at`).
64
- * - `setOnce` writes only if the person does not already have the key - use for
65
- * values that describe the beginning and must not be overwritten by a later
66
- * visit (`signup_date`, `initial_referrer`).
67
- *
68
- * Named `set` / `setOnce` rather than the transport's own `$set` / `$set_once`:
69
- * the `$` names are an implementation detail of who we send to, and this is a
70
- * published customer-facing API that must not change if that ever does.
71
- */
72
- interface PersonPropertyUpdate {
73
- set?: HeyCatchProperties;
74
- setOnce?: HeyCatchProperties;
75
- }
1
+ import { a as HeyCatchPersonProperties, H as HeyCatchConfig, b as HeyCatchProperties, T as TrackOptions } from './shared-B8y8fJCD.js';
2
+ export { P as PersonPropertyUpdate, S as SDK_VERSION, c as STAGE, d as ServerTrackOptions } from './shared-B8y8fJCD.js';
76
3
 
77
4
  /**
78
5
  * Link the anonymous visitor to your authenticated user. Call once
@@ -90,28 +17,20 @@ interface PersonPropertyUpdate {
90
17
  * those as regular properties would reset them on every login.
91
18
  *
92
19
  * @example
93
- * identify(user.id,
20
+ * setIdentity(user.id,
94
21
  * { email: user.email, plan: 'pro' },
95
22
  * { signup_date: user.createdAt },
96
23
  * );
97
24
  */
98
- declare function identify(userId: string, properties?: HeyCatchProperties, propertiesOnce?: HeyCatchProperties): void;
25
+ declare function setIdentity(userId: string, properties?: HeyCatchPersonProperties, propertiesOnce?: HeyCatchPersonProperties): void;
99
26
  /**
100
27
  * Clear the current identity. Call on sign-out so the next visitor on
101
28
  * this browser starts anonymous.
102
29
  */
103
- declare function reset(): void;
30
+ declare function resetIdentity(): void;
31
+
32
+ declare function init(config: HeyCatchConfig): void;
104
33
 
105
- interface TrackOptions extends PersonPropertyUpdate {
106
- /**
107
- * Send this event immediately instead of batching it.
108
- *
109
- * Only worth setting when the page is about to unload - a sign-up redirect,
110
- * a checkout hand-off - where a batched event would be lost. It costs a
111
- * request per event, so it is not the default.
112
- */
113
- sendInstantly?: boolean;
114
- }
115
34
  /**
116
35
  * Record a product event.
117
36
  *
@@ -131,7 +50,7 @@ interface TrackOptions extends PersonPropertyUpdate {
131
50
  *
132
51
  * No-op before `init()` or on the server.
133
52
  */
134
- declare function track(event: string, properties?: HeyCatchProperties, options?: TrackOptions): void;
53
+ declare function trackEvent(event: string, properties?: HeyCatchProperties, options?: TrackOptions): void;
135
54
  /**
136
55
  * Update the current person's properties without sending a product event, and
137
56
  * without changing who they are.
@@ -145,6 +64,22 @@ declare function track(event: string, properties?: HeyCatchProperties, options?:
145
64
  *
146
65
  * No-op before `init()` or on the server.
147
66
  */
148
- declare function setPersonProperties(set?: HeyCatchProperties, setOnce?: HeyCatchProperties): void;
67
+ declare function setPersonProperties(set?: HeyCatchPersonProperties, setOnce?: HeyCatchPersonProperties): void;
68
+
69
+ /**
70
+ * The analytics surface, as one namespace. The package is HeyCatch's
71
+ * product SDK - analytics is its first capability, not its identity - so
72
+ * the API ships as `analytics.*` and a future capability arrives as a
73
+ * sibling namespace instead of more loose top-level functions. The server
74
+ * entry exports the same-shaped object, which is what keeps isomorphic
75
+ * code resolving under every `exports` condition.
76
+ */
77
+ declare const analytics: {
78
+ readonly init: typeof init;
79
+ readonly resetIdentity: typeof resetIdentity;
80
+ readonly setIdentity: typeof setIdentity;
81
+ readonly setPersonProperties: typeof setPersonProperties;
82
+ readonly trackEvent: typeof trackEvent;
83
+ };
149
84
 
150
- export { type HeyCatchConfig, type HeyCatchProperties, type PersonPropertyUpdate, SDK_VERSION, STAGE, type TrackOptions, identify, init, reset, setPersonProperties, track };
85
+ export { HeyCatchConfig, HeyCatchPersonProperties, HeyCatchProperties, TrackOptions, analytics };