@walkeros/web-destination-mixpanel 3.3.0-next-1776098542393
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 +21 -0
- package/README.md +281 -0
- package/dist/dev.d.mts +253 -0
- package/dist/dev.d.ts +253 -0
- package/dist/dev.js +1 -0
- package/dist/dev.js.map +1 -0
- package/dist/dev.mjs +1 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/examples/index.d.mts +199 -0
- package/dist/examples/index.d.ts +199 -0
- package/dist/examples/index.js +14560 -0
- package/dist/examples/index.mjs +14538 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.d.mts +126 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.es5.js +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/dist/walkerOS.json +1314 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 elbWalker GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
<p align="left">
|
|
2
|
+
<a href="https://www.walkeros.io">
|
|
3
|
+
<img alt="walkerOS" title="walkerOS" src="https://www.walkeros.io/img/walkerOS_logo.svg" width="256px"/>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
# Mixpanel Destination for walkerOS
|
|
8
|
+
|
|
9
|
+
[Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/destinations/mixpanel)
|
|
10
|
+
•
|
|
11
|
+
[NPM Package](https://www.npmjs.com/package/@walkeros/web-destination-mixpanel)
|
|
12
|
+
• [Documentation](https://www.walkeros.io/docs/destinations/web/mixpanel)
|
|
13
|
+
|
|
14
|
+
This package forwards walkerOS events to [Mixpanel](https://mixpanel.com/) —
|
|
15
|
+
product analytics for tracking user behaviour, funnels, retention, and
|
|
16
|
+
group-level metrics. Built on the official
|
|
17
|
+
[`mixpanel-browser`](https://www.npmjs.com/package/mixpanel-browser) SDK.
|
|
18
|
+
|
|
19
|
+
walkerOS follows a **source → collector → destination** architecture. This
|
|
20
|
+
Mixpanel destination receives processed events from the walkerOS collector and
|
|
21
|
+
forwards them as `track()` calls, identity updates, people-profile operations,
|
|
22
|
+
group assignments, and consent changes.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **Default event forwarding** — every walkerOS event becomes
|
|
27
|
+
`mixpanel.track(name, properties)` with no extra config
|
|
28
|
+
- **Identity** — destination- or per-event `settings.identify` resolves to
|
|
29
|
+
`{ distinctId }` → `mixpanel.identify(distinctId)`, with runtime state diffing
|
|
30
|
+
so identical distinct IDs don't re-fire
|
|
31
|
+
- **Full people vocabulary** — all eight Mixpanel operations supported: `set`,
|
|
32
|
+
`set_once`, `increment`, `append`, `union`, `remove`, `unset`, `delete_user`
|
|
33
|
+
- **Groups** — user→group association via `mixpanel.set_group(key, id)` and
|
|
34
|
+
group-profile properties via `mixpanel.get_group(key, id).set/set_once/…`
|
|
35
|
+
- **Reset on logout** — `settings.reset: true` calls `mixpanel.reset()` so the
|
|
36
|
+
next session starts with a fresh anonymous distinct ID
|
|
37
|
+
- **Consent** — `on('consent')` handler derives required keys from
|
|
38
|
+
`config.consent` and toggles `opt_in_tracking` / `opt_out_tracking`
|
|
39
|
+
- **Full SDK passthrough** — every `mixpanel-browser` `Config` option
|
|
40
|
+
(`api_host`, `persistence`, `batch_requests`, `record_sessions_percent`,
|
|
41
|
+
`cross_subdomain_cookie`, etc.) flows through directly
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install @walkeros/web-destination-mixpanel
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { startFlow } from '@walkeros/collector';
|
|
53
|
+
import { destinationMixpanel } from '@walkeros/web-destination-mixpanel';
|
|
54
|
+
|
|
55
|
+
await startFlow({
|
|
56
|
+
destinations: {
|
|
57
|
+
mixpanel: {
|
|
58
|
+
code: destinationMixpanel,
|
|
59
|
+
config: {
|
|
60
|
+
consent: { analytics: true },
|
|
61
|
+
settings: {
|
|
62
|
+
apiKey: 'YOUR_PROJECT_TOKEN',
|
|
63
|
+
api_host: 'https://api-eu.mixpanel.com', // optional, for EU residency
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
### Settings (destination-level)
|
|
74
|
+
|
|
75
|
+
| Name | Type | Description | Required |
|
|
76
|
+
| ------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------ | -------- |
|
|
77
|
+
| `apiKey` | `string` | Mixpanel project token (Project Settings → Access Keys) | Yes |
|
|
78
|
+
| `api_host` | `string` | Ingestion host. Default `https://api-js.mixpanel.com`. Use `https://api-eu.mixpanel.com` for EU. | No |
|
|
79
|
+
| `persistence` | `'cookie' \| 'localStorage'` | Client-side persistence backend. Default `cookie`. | No |
|
|
80
|
+
| `batch_requests` | `boolean` | Use the `/batch` endpoint. Default `true`. | No |
|
|
81
|
+
| `record_sessions_percent` | `number` | Session replay sampling (0–100). Default `0`. | No |
|
|
82
|
+
| `track_pageview` | `boolean \| string` | Mixpanel auto-pageview. walkerOS default `false` (walkerOS sources handle page views). | No |
|
|
83
|
+
| `autocapture` | `boolean \| object` | Mixpanel autocapture. walkerOS default `false`. | No |
|
|
84
|
+
| `include` | `string[]` | Event sections flattened into `track()` properties (`data`, `globals`, `context`, `user`, …) | No |
|
|
85
|
+
| `identify` | `Mapping.Value` | Destination-level identity mapping; resolves to `{ distinctId }` | No |
|
|
86
|
+
| `group` | `Mapping.Value` | Destination-level group assignment; resolves to `{ key, id }` | No |
|
|
87
|
+
|
|
88
|
+
All other `mixpanel-browser` `Config` options (snake_case) pass through directly
|
|
89
|
+
— the destination's `Settings` type extends `Partial<Config>`.
|
|
90
|
+
|
|
91
|
+
### Mapping (`rule.settings`)
|
|
92
|
+
|
|
93
|
+
| Name | Type | Description |
|
|
94
|
+
| -------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `identify` | `Mapping.Value` | Per-event identity override; resolves to `{ distinctId }` |
|
|
96
|
+
| `include` | `string[]` | Override destination-level `include` for this rule |
|
|
97
|
+
| `people` | `Mapping.Value` | Per-event people operations (see People section below) |
|
|
98
|
+
| `group` | `Mapping.Value` | Per-event group assignment; resolves to `{ key, id }` |
|
|
99
|
+
| `groupProfile` | `Mapping.Value` | Per-event group-profile operations; resolves to `{ key, id, set?, set_once?, union?, remove?, unset?, delete? }` |
|
|
100
|
+
| `reset` | `boolean \| Mapping.Value` | Logout trigger; resolves truthy → `mixpanel.reset()` |
|
|
101
|
+
|
|
102
|
+
## Custom Event Properties
|
|
103
|
+
|
|
104
|
+
Use `settings.include` (destination-level) or `rule.settings.include` (per-rule)
|
|
105
|
+
to flatten walkerOS event sections into `track()` properties. Each section is
|
|
106
|
+
prefixed (`data_*`, `globals_*`, `user_*`, …):
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// Destination-level: every event carries data_* properties
|
|
110
|
+
settings: { include: ['data'] }
|
|
111
|
+
|
|
112
|
+
// Per-rule override: this rule sends only globals_* properties
|
|
113
|
+
mapping: {
|
|
114
|
+
order: {
|
|
115
|
+
complete: {
|
|
116
|
+
settings: { include: ['globals'] },
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
For revenue events the Mixpanel `people.track_charge` API is deprecated
|
|
123
|
+
(v2.78+); pass revenue fields as regular event properties instead — currency
|
|
124
|
+
values in sample events use `"EUR"`.
|
|
125
|
+
|
|
126
|
+
## Identity
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// Destination-level — every push with a user.id fires identify
|
|
130
|
+
settings: {
|
|
131
|
+
apiKey: 'YOUR_TOKEN',
|
|
132
|
+
identify: { map: { distinctId: 'user.id' } },
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Per-event override
|
|
136
|
+
mapping: {
|
|
137
|
+
user: {
|
|
138
|
+
login: {
|
|
139
|
+
settings: {
|
|
140
|
+
identify: { map: { distinctId: 'data.user_id' } },
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Runtime state diffing means identical `distinctId` values don't re-fire
|
|
148
|
+
`mixpanel.identify()` — the SDK call only runs when the resolved value changes.
|
|
149
|
+
|
|
150
|
+
## People
|
|
151
|
+
|
|
152
|
+
All eight Mixpanel people operations are supported via `settings.people`. Each
|
|
153
|
+
key in the resolved object fires a separate `mixpanel.people.*` call:
|
|
154
|
+
|
|
155
|
+
| Key | Signature | Fires |
|
|
156
|
+
| ------------- | --------------------------- | -------------------------------- |
|
|
157
|
+
| `set` | `Record<string, unknown>` | `mixpanel.people.set(obj)` |
|
|
158
|
+
| `set_once` | `Record<string, unknown>` | `mixpanel.people.set_once(obj)` |
|
|
159
|
+
| `increment` | `Record<string, number>` | `mixpanel.people.increment(obj)` |
|
|
160
|
+
| `append` | `Record<string, unknown>` | `mixpanel.people.append(obj)` |
|
|
161
|
+
| `union` | `Record<string, unknown[]>` | `mixpanel.people.union(obj)` |
|
|
162
|
+
| `remove` | `Record<string, unknown>` | `mixpanel.people.remove(obj)` |
|
|
163
|
+
| `unset` | `string[]` | `mixpanel.people.unset(list)` |
|
|
164
|
+
| `delete_user` | `true` | `mixpanel.people.delete_user()` |
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
mapping: {
|
|
168
|
+
user: {
|
|
169
|
+
login: {
|
|
170
|
+
skip: true,
|
|
171
|
+
settings: {
|
|
172
|
+
identify: { map: { distinctId: 'data.user_id' } },
|
|
173
|
+
people: {
|
|
174
|
+
map: {
|
|
175
|
+
set: { map: { plan: 'data.plan', email: 'data.email' } },
|
|
176
|
+
set_once: { map: { first_login: 'timestamp' } },
|
|
177
|
+
increment: { map: { login_count: { value: 1 } } },
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Groups
|
|
187
|
+
|
|
188
|
+
User→group association uses `mixpanel.set_group(key, id)`:
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
mapping: {
|
|
192
|
+
user: {
|
|
193
|
+
login: {
|
|
194
|
+
settings: {
|
|
195
|
+
group: { map: { key: { value: 'company_id' }, id: 'data.company_id' } },
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Group profile properties use `mixpanel.get_group(key, id).set/…`:
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
mapping: {
|
|
206
|
+
company: {
|
|
207
|
+
update: {
|
|
208
|
+
skip: true,
|
|
209
|
+
settings: {
|
|
210
|
+
groupProfile: {
|
|
211
|
+
map: {
|
|
212
|
+
key: { value: 'company_id' },
|
|
213
|
+
id: 'data.company_id',
|
|
214
|
+
set: {
|
|
215
|
+
map: { name: 'data.company_name', plan: 'data.plan' },
|
|
216
|
+
},
|
|
217
|
+
set_once: { map: { founded: 'data.founded_year' } },
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Reset / Logout
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
mapping: {
|
|
230
|
+
user: {
|
|
231
|
+
logout: {
|
|
232
|
+
skip: true,
|
|
233
|
+
settings: { reset: true },
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
`reset: true` fires `mixpanel.reset()`, clearing all persistence and generating
|
|
240
|
+
a new anonymous distinct ID. The destination also clears its runtime identity
|
|
241
|
+
state so the next identify call will fire again.
|
|
242
|
+
|
|
243
|
+
## Consent
|
|
244
|
+
|
|
245
|
+
Mixpanel consent is wired via the destination's `on('consent')` handler. Declare
|
|
246
|
+
`config.consent` on the destination — the handler requires **all** declared keys
|
|
247
|
+
to be granted to opt in:
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
destinations: {
|
|
251
|
+
mixpanel: {
|
|
252
|
+
code: destinationMixpanel,
|
|
253
|
+
config: {
|
|
254
|
+
consent: { analytics: true },
|
|
255
|
+
settings: { apiKey: 'YOUR_TOKEN' },
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
- All required keys granted → `mixpanel.opt_in_tracking()`
|
|
262
|
+
- Any required key missing/denied → `mixpanel.opt_out_tracking()`
|
|
263
|
+
- No `config.consent` declared → handler no-ops (relies on walkerOS's own
|
|
264
|
+
consent gate)
|
|
265
|
+
|
|
266
|
+
## Destroy
|
|
267
|
+
|
|
268
|
+
The `destroy()` hook calls `mixpanel.stop_batch_senders?.()` to halt the
|
|
269
|
+
in-memory batcher. Mixpanel has no public flush API; already-queued events rely
|
|
270
|
+
on the SDK's built-in `sendBeacon` unload handler.
|
|
271
|
+
|
|
272
|
+
## Contribute
|
|
273
|
+
|
|
274
|
+
Feel free to contribute by submitting an
|
|
275
|
+
[issue](https://github.com/elbwalker/walkerOS/issues), starting a
|
|
276
|
+
[discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
|
|
277
|
+
[contact](https://calendly.com/elb-alexander/30min).
|
|
278
|
+
|
|
279
|
+
## License
|
|
280
|
+
|
|
281
|
+
This project is licensed under the MIT License.
|
package/dist/dev.d.mts
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
|
+
import { z } from '@walkeros/core/dev';
|
|
3
|
+
import { Mapping as Mapping$1, Flow } from '@walkeros/core';
|
|
4
|
+
import { DestinationWeb } from '@walkeros/web-core';
|
|
5
|
+
import { Config } from 'mixpanel-browser';
|
|
6
|
+
|
|
7
|
+
declare const SettingsSchema: z.ZodObject<{
|
|
8
|
+
apiKey: z.ZodString;
|
|
9
|
+
api_host: z.ZodOptional<z.ZodString>;
|
|
10
|
+
persistence: z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
cookie: "cookie";
|
|
12
|
+
localStorage: "localStorage";
|
|
13
|
+
}>>;
|
|
14
|
+
cross_subdomain_cookie: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
cookie_expiration: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
secure_cookie: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
ip: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
batch_requests: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
batch_size: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
batch_flush_interval_ms: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
debug: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
opt_out_tracking_by_default: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
track_pageview: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
24
|
+
autocapture: z.ZodOptional<z.ZodUnknown>;
|
|
25
|
+
record_sessions_percent: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
record_mask_all_inputs: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
identify: z.ZodOptional<z.ZodUnknown>;
|
|
28
|
+
group: z.ZodOptional<z.ZodUnknown>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
31
|
+
|
|
32
|
+
declare const MappingSchema: z.ZodObject<{
|
|
33
|
+
identify: z.ZodOptional<z.ZodUnknown>;
|
|
34
|
+
people: z.ZodOptional<z.ZodUnknown>;
|
|
35
|
+
group: z.ZodOptional<z.ZodUnknown>;
|
|
36
|
+
groupProfile: z.ZodOptional<z.ZodUnknown>;
|
|
37
|
+
reset: z.ZodOptional<z.ZodUnknown>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
type Mapping = z.infer<typeof MappingSchema>;
|
|
40
|
+
|
|
41
|
+
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
42
|
+
declare const mapping: _walkeros_core_dev.JSONSchema;
|
|
43
|
+
|
|
44
|
+
type index$1_Mapping = Mapping;
|
|
45
|
+
declare const index$1_MappingSchema: typeof MappingSchema;
|
|
46
|
+
declare const index$1_SettingsSchema: typeof SettingsSchema;
|
|
47
|
+
declare const index$1_mapping: typeof mapping;
|
|
48
|
+
declare const index$1_settings: typeof settings;
|
|
49
|
+
declare namespace index$1 {
|
|
50
|
+
export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Destination-level settings.
|
|
55
|
+
*
|
|
56
|
+
* Extends Mixpanel's `Config` so every `mixpanel.init()` option flows through
|
|
57
|
+
* without per-field plumbing. The destination adds walkerOS-specific keys:
|
|
58
|
+
* - `apiKey` (required) — maps to the first arg of `mixpanel.init()`
|
|
59
|
+
* - `identify` — destination-level identity mapping
|
|
60
|
+
* - `include` — event sections flattened into `track()` properties
|
|
61
|
+
* - `group` — destination-level group association
|
|
62
|
+
* - `_state` — runtime state (not user-facing, mutated by init/push)
|
|
63
|
+
*/
|
|
64
|
+
interface Settings extends Partial<Config> {
|
|
65
|
+
apiKey: string;
|
|
66
|
+
identify?: Mapping$1.Value;
|
|
67
|
+
group?: Mapping$1.Value;
|
|
68
|
+
/** Runtime state — populated by init() and mutated by push(). Not user-facing. */
|
|
69
|
+
_state?: RuntimeState;
|
|
70
|
+
}
|
|
71
|
+
interface RuntimeState {
|
|
72
|
+
/** Last-set distinct_id, used to skip redundant identify() calls. */
|
|
73
|
+
lastIdentity?: {
|
|
74
|
+
distinctId?: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The `people` namespace on the mixpanel singleton. Mirrors the real SDK
|
|
79
|
+
* shape so tests can spy each method individually.
|
|
80
|
+
*/
|
|
81
|
+
interface MixpanelPeople {
|
|
82
|
+
set: (prop: string | Record<string, unknown>, to?: unknown, callback?: () => void) => void;
|
|
83
|
+
set_once: (prop: string | Record<string, unknown>, to?: unknown, callback?: () => void) => void;
|
|
84
|
+
increment: (prop: string | Record<string, number>, by?: number, callback?: () => void) => void;
|
|
85
|
+
append: (prop: string | Record<string, unknown>, value?: unknown, callback?: () => void) => void;
|
|
86
|
+
union: (prop: string | Record<string, unknown[]>, value?: unknown[], callback?: () => void) => void;
|
|
87
|
+
remove: (prop: string | Record<string, unknown>, value?: unknown, callback?: () => void) => void;
|
|
88
|
+
unset: (prop: string | string[], callback?: () => void) => void;
|
|
89
|
+
delete_user: () => void;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The handle returned by `mixpanel.get_group(key, id)`. Supports property
|
|
93
|
+
* operations on the group profile.
|
|
94
|
+
*/
|
|
95
|
+
interface MixpanelGroup {
|
|
96
|
+
set: (prop: string | Record<string, unknown>, to?: unknown, callback?: () => void) => void;
|
|
97
|
+
set_once: (prop: string | Record<string, unknown>, to?: unknown, callback?: () => void) => void;
|
|
98
|
+
unset: (prop: string | string[], callback?: () => void) => void;
|
|
99
|
+
union: (prop: string | Record<string, unknown[]>, value?: unknown[], callback?: () => void) => void;
|
|
100
|
+
remove: (prop: string | Record<string, unknown>, value?: unknown, callback?: () => void) => void;
|
|
101
|
+
delete: () => void;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Mixpanel SDK surface — the subset of `mixpanel-browser` the destination
|
|
105
|
+
* actually uses. Mirrors the singleton's shape so tests can mock the whole
|
|
106
|
+
* object via env.mixpanel.
|
|
107
|
+
*/
|
|
108
|
+
interface MixpanelSDK {
|
|
109
|
+
init: (token: string, config?: Partial<Config>, name?: string) => void;
|
|
110
|
+
track: (event: string, properties?: Record<string, unknown>, callback?: () => void) => void;
|
|
111
|
+
identify: (distinctId?: string) => void;
|
|
112
|
+
reset: () => void;
|
|
113
|
+
set_group: (groupKey: string, groupIds: string | string[], callback?: () => void) => void;
|
|
114
|
+
get_group: (groupKey: string, groupId: string) => MixpanelGroup;
|
|
115
|
+
opt_in_tracking: (options?: Record<string, unknown>) => void;
|
|
116
|
+
opt_out_tracking: (options?: Record<string, unknown>) => void;
|
|
117
|
+
stop_batch_senders?: () => void;
|
|
118
|
+
people: MixpanelPeople;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Env — optional SDK override. Production leaves this undefined and the
|
|
122
|
+
* destination falls back to the real `mixpanel-browser` default export.
|
|
123
|
+
* Tests provide a mock via env.mixpanel = { ... }.
|
|
124
|
+
*/
|
|
125
|
+
interface Env extends DestinationWeb.Env {
|
|
126
|
+
mixpanel?: MixpanelSDK;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Pre-init env — all methods are no-ops until the test runner wires spies.
|
|
131
|
+
*/
|
|
132
|
+
declare const init: Env | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Post-init env — same shape. The test runner clones this and replaces
|
|
135
|
+
* individual methods with jest.fn() so it can assert on calls.
|
|
136
|
+
*/
|
|
137
|
+
declare const push: Env;
|
|
138
|
+
/** Simulation tracking paths for CLI --simulate. */
|
|
139
|
+
declare const simulation: string[];
|
|
140
|
+
|
|
141
|
+
declare const env_init: typeof init;
|
|
142
|
+
declare const env_push: typeof push;
|
|
143
|
+
declare const env_simulation: typeof simulation;
|
|
144
|
+
declare namespace env {
|
|
145
|
+
export { env_init as init, env_push as push, env_simulation as simulation };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Examples may optionally carry destination-level settings. The test runner
|
|
150
|
+
* reads `settings` from the example and merges it into the base destination
|
|
151
|
+
* settings on top of the fixed apiKey.
|
|
152
|
+
*/
|
|
153
|
+
type MixpanelStepExample = Flow.StepExample & {
|
|
154
|
+
settings?: Partial<Settings>;
|
|
155
|
+
configInclude?: string[];
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Default event forwarding — every walkerOS event becomes
|
|
159
|
+
* mixpanel.track(event.name, properties). With no mapping and no
|
|
160
|
+
* destination-level include, properties is `{}`.
|
|
161
|
+
*/
|
|
162
|
+
declare const defaultEventForwarding: MixpanelStepExample;
|
|
163
|
+
/**
|
|
164
|
+
* Wildcard ignore — walkerOS's standard way to drop events. The rule
|
|
165
|
+
* matches but does nothing. The destination fires zero SDK calls.
|
|
166
|
+
*/
|
|
167
|
+
declare const wildcardIgnored: MixpanelStepExample;
|
|
168
|
+
/**
|
|
169
|
+
* Destination-level settings.include flattens the walkerOS `data` section
|
|
170
|
+
* into prefixed track() properties on every push.
|
|
171
|
+
*/
|
|
172
|
+
declare const destinationLevelInclude: MixpanelStepExample;
|
|
173
|
+
/**
|
|
174
|
+
* Per-rule settings.include REPLACES destination-level include for the
|
|
175
|
+
* matched rule. Here destination-level sends `data`, but the rule
|
|
176
|
+
* overrides it with `globals` only.
|
|
177
|
+
*/
|
|
178
|
+
declare const ruleIncludeReplaces: MixpanelStepExample;
|
|
179
|
+
/**
|
|
180
|
+
* Destination-level settings.identify fires on the first push. The
|
|
181
|
+
* destination resolves { distinctId } and calls mixpanel.identify(distinctId),
|
|
182
|
+
* then tracks the result in runtime state. Subsequent pushes with unchanged
|
|
183
|
+
* distinctId do NOT re-fire identify().
|
|
184
|
+
*/
|
|
185
|
+
declare const destinationLevelIdentify: MixpanelStepExample;
|
|
186
|
+
/**
|
|
187
|
+
* Per-event identify + people operations — the canonical "user login"
|
|
188
|
+
* pattern. `skip: true` suppresses the default mixpanel.track() call
|
|
189
|
+
* because we're running identity side effects only.
|
|
190
|
+
*/
|
|
191
|
+
declare const userLoginIdentifyAndPeople: MixpanelStepExample;
|
|
192
|
+
/**
|
|
193
|
+
* Full people operation vocabulary — a profile update rule that exercises
|
|
194
|
+
* set, set_once, increment, append, union, remove, and unset in a single
|
|
195
|
+
* rule. `skip: true` because only side effects are needed.
|
|
196
|
+
*/
|
|
197
|
+
declare const profileUpdateAllPeopleOperations: MixpanelStepExample;
|
|
198
|
+
/**
|
|
199
|
+
* people.delete_user — destructive operation. The resolved people object
|
|
200
|
+
* uses `{ delete_user: true }` to trigger the call.
|
|
201
|
+
*/
|
|
202
|
+
declare const accountDeleteUser: MixpanelStepExample;
|
|
203
|
+
/**
|
|
204
|
+
* User logout — reset: true fires mixpanel.reset(), which clears all
|
|
205
|
+
* persistence and generates a new anonymous distinct_id.
|
|
206
|
+
*/
|
|
207
|
+
declare const userLogoutReset: MixpanelStepExample;
|
|
208
|
+
/**
|
|
209
|
+
* User-group association — settings.group resolves to { key, id } and
|
|
210
|
+
* calls mixpanel.set_group(key, id). Fires default track too.
|
|
211
|
+
*/
|
|
212
|
+
declare const userGroupAssociation: MixpanelStepExample;
|
|
213
|
+
/**
|
|
214
|
+
* Group profile properties — settings.groupProfile resolves to
|
|
215
|
+
* { key, id, set?, set_once?, ... } and calls
|
|
216
|
+
* mixpanel.get_group(key, id).set(...), .set_once(...), etc.
|
|
217
|
+
*/
|
|
218
|
+
declare const companyUpdateGroupProfile: MixpanelStepExample;
|
|
219
|
+
/**
|
|
220
|
+
* Consent revoked → mixpanel.opt_out_tracking(). The destination checks
|
|
221
|
+
* the consent keys declared in config.consent and toggles opt_out/opt_in.
|
|
222
|
+
*/
|
|
223
|
+
declare const consentRevokeOptOut: MixpanelStepExample;
|
|
224
|
+
/**
|
|
225
|
+
* Consent granted → mixpanel.opt_in_tracking().
|
|
226
|
+
*/
|
|
227
|
+
declare const consentGrantOptIn: MixpanelStepExample;
|
|
228
|
+
|
|
229
|
+
type step_MixpanelStepExample = MixpanelStepExample;
|
|
230
|
+
declare const step_accountDeleteUser: typeof accountDeleteUser;
|
|
231
|
+
declare const step_companyUpdateGroupProfile: typeof companyUpdateGroupProfile;
|
|
232
|
+
declare const step_consentGrantOptIn: typeof consentGrantOptIn;
|
|
233
|
+
declare const step_consentRevokeOptOut: typeof consentRevokeOptOut;
|
|
234
|
+
declare const step_defaultEventForwarding: typeof defaultEventForwarding;
|
|
235
|
+
declare const step_destinationLevelIdentify: typeof destinationLevelIdentify;
|
|
236
|
+
declare const step_destinationLevelInclude: typeof destinationLevelInclude;
|
|
237
|
+
declare const step_profileUpdateAllPeopleOperations: typeof profileUpdateAllPeopleOperations;
|
|
238
|
+
declare const step_ruleIncludeReplaces: typeof ruleIncludeReplaces;
|
|
239
|
+
declare const step_userGroupAssociation: typeof userGroupAssociation;
|
|
240
|
+
declare const step_userLoginIdentifyAndPeople: typeof userLoginIdentifyAndPeople;
|
|
241
|
+
declare const step_userLogoutReset: typeof userLogoutReset;
|
|
242
|
+
declare const step_wildcardIgnored: typeof wildcardIgnored;
|
|
243
|
+
declare namespace step {
|
|
244
|
+
export { type step_MixpanelStepExample as MixpanelStepExample, step_accountDeleteUser as accountDeleteUser, step_companyUpdateGroupProfile as companyUpdateGroupProfile, step_consentGrantOptIn as consentGrantOptIn, step_consentRevokeOptOut as consentRevokeOptOut, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_profileUpdateAllPeopleOperations as profileUpdateAllPeopleOperations, step_ruleIncludeReplaces as ruleIncludeReplaces, step_userGroupAssociation as userGroupAssociation, step_userLoginIdentifyAndPeople as userLoginIdentifyAndPeople, step_userLogoutReset as userLogoutReset, step_wildcardIgnored as wildcardIgnored };
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
declare const index_env: typeof env;
|
|
248
|
+
declare const index_step: typeof step;
|
|
249
|
+
declare namespace index {
|
|
250
|
+
export { index_env as env, index_step as step };
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export { index as examples, index$1 as schemas };
|