@heycatch/sdk 0.6.0 → 0.7.0-dev.41

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