autotel-subscribers 43.0.0 → 44.0.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autotel-subscribers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "44.0.0",
|
|
4
4
|
"description": "Write Once, Observe Anywhere - Event subscribers for autotel (PostHog, Mixpanel, Amplitude, Segment)",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -76,8 +76,7 @@
|
|
|
76
76
|
"files": [
|
|
77
77
|
"dist",
|
|
78
78
|
"examples",
|
|
79
|
-
"README.md"
|
|
80
|
-
"skills"
|
|
79
|
+
"README.md"
|
|
81
80
|
],
|
|
82
81
|
"keywords": [
|
|
83
82
|
"autotel",
|
|
@@ -100,7 +99,7 @@
|
|
|
100
99
|
"slow-redact": "^0.3.2"
|
|
101
100
|
},
|
|
102
101
|
"peerDependencies": {
|
|
103
|
-
"autotel": "
|
|
102
|
+
"autotel": "6.0.0"
|
|
104
103
|
},
|
|
105
104
|
"peerDependenciesMeta": {
|
|
106
105
|
"posthog-node": {
|
|
@@ -137,7 +136,7 @@
|
|
|
137
136
|
"typescript": "^6.0.3",
|
|
138
137
|
"typescript-eslint": "^8.65.0",
|
|
139
138
|
"vitest": "^4.1.10",
|
|
140
|
-
"autotel": "
|
|
139
|
+
"autotel": "6.0.0"
|
|
141
140
|
},
|
|
142
141
|
"repository": {
|
|
143
142
|
"type": "git",
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: autotel-subscribers
|
|
3
|
-
description: >
|
|
4
|
-
Event subscribers for autotel. PostHog, Mixpanel, Amplitude, Segment, Webhook, Slack. Configure in init() subscribers; use track() or Event from autotel. Import from autotel-subscribers/posthog etc.
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# autotel-subscribers
|
|
8
|
-
|
|
9
|
-
Event subscribers send product/analytics events from autotel to external platforms. Configure subscribers in `init()`; then use `track()` or `Event` from `autotel`. Each adapter is a separate import path for tree-shaking.
|
|
10
|
-
|
|
11
|
-
## Setup
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { init, track } from 'autotel';
|
|
15
|
-
import { PostHogSubscriber } from 'autotel-subscribers/posthog';
|
|
16
|
-
|
|
17
|
-
init({
|
|
18
|
-
service: 'my-app',
|
|
19
|
-
subscribers: [new PostHogSubscriber({ apiKey: 'phc_...' })],
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
track('order.completed', { userId: 'user-123', amount: 99.99 });
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Subscribers and import paths
|
|
26
|
-
|
|
27
|
-
| Platform | Import path | Peer dependency |
|
|
28
|
-
| --------- | ------------------------------- | ------------------------- |
|
|
29
|
-
| PostHog | `autotel-subscribers/posthog` | posthog-node (optional) |
|
|
30
|
-
| Mixpanel | `autotel-subscribers/mixpanel` | mixpanel (optional) |
|
|
31
|
-
| Amplitude | `autotel-subscribers/amplitude` | @amplitude/analytics-node |
|
|
32
|
-
| Segment | `autotel-subscribers/segment` | @segment/analytics-node |
|
|
33
|
-
| Webhook | `autotel-subscribers/webhook` | none |
|
|
34
|
-
| Slack | `autotel-subscribers/slack` | none |
|
|
35
|
-
|
|
36
|
-
Install the peer dependency for the subscriber you use (e.g. `pnpm add posthog-node` for PostHog).
|
|
37
|
-
|
|
38
|
-
## Core patterns
|
|
39
|
-
|
|
40
|
-
**Multiple subscribers:** Pass an array to `init({ subscribers: [new PostHogSubscriber(...), new MixpanelSubscriber(...)] })`. Events are sent to all.
|
|
41
|
-
|
|
42
|
-
**Event instance with overrides:** Use `Event` from `autotel/event` with a custom `subscribers` option to send only to specific backends for that instance.
|
|
43
|
-
|
|
44
|
-
**Factories:** `autotel-subscribers/factories` provides `createPostHogSubscriber()` etc. for env-based config.
|
|
45
|
-
|
|
46
|
-
## Common mistakes
|
|
47
|
-
|
|
48
|
-
### HIGH Import from "autotel-subscribers" instead of the adapter path
|
|
49
|
-
|
|
50
|
-
Wrong:
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
import { PostHogSubscriber } from 'autotel-subscribers';
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Correct:
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
import { PostHogSubscriber } from 'autotel-subscribers/posthog';
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Each adapter is a separate export; use the subpath so only the adapter you use is bundled.
|
|
63
|
-
|
|
64
|
-
Source: packages/autotel-subscribers/package.json exports
|
|
65
|
-
|
|
66
|
-
### MEDIUM Call track() before init() with subscribers
|
|
67
|
-
|
|
68
|
-
Subscribers are configured in `init()`. Without `init({ subscribers: [...] })`, `track()` has nowhere to send events. Call `init()` once at app startup before any `track()`.
|
|
69
|
-
|
|
70
|
-
Source: packages/autotel/src/event.ts
|
|
71
|
-
|
|
72
|
-
### MEDIUM Omit peer dependency for the chosen adapter
|
|
73
|
-
|
|
74
|
-
Install the platform SDK for the subscriber you use (e.g. `posthog-node`, `@segment/analytics-node`). Missing peer deps can cause runtime errors or no-op behavior.
|
|
75
|
-
|
|
76
|
-
Source: packages/autotel-subscribers/package.json peerDependencies
|
|
77
|
-
|
|
78
|
-
## Version
|
|
79
|
-
|
|
80
|
-
Targets autotel-subscribers v27.x. Requires autotel (workspace). See also: autotel package skill autotel-events for track() and Event API.
|