@walkeros/web-destination-posthog 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 +308 -0
- package/dist/dev.d.mts +269 -0
- package/dist/dev.d.ts +269 -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 +206 -0
- package/dist/examples/index.d.ts +206 -0
- package/dist/examples/index.js +14439 -0
- package/dist/examples/index.mjs +14417 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.d.mts +112 -0
- package/dist/index.d.ts +112 -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 +1096 -0
- package/package.json +79 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
|
|
2
|
+
import { DestinationWeb } from '@walkeros/web-core';
|
|
3
|
+
import { PostHogConfig, Properties } from 'posthog-js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Destination-level settings.
|
|
7
|
+
*
|
|
8
|
+
* PostHog's `PostHogConfig` interface has ~80 fields — extending the SDK type
|
|
9
|
+
* directly keeps IntelliSense complete and prevents drift. The destination adds:
|
|
10
|
+
* - `apiKey` (required) — first arg to `posthog.init(...)`, NOT an init option
|
|
11
|
+
* - `identify` — destination-level identity mapping
|
|
12
|
+
* - `include` — event sections flattened into `capture()` properties
|
|
13
|
+
* - `group` — destination-level group association
|
|
14
|
+
* - `_state` — runtime state (not user-facing, mutated by init/push)
|
|
15
|
+
*
|
|
16
|
+
* All other walkerOS-specific mapping features live under mapping.settings
|
|
17
|
+
* (see Mapping interface below). Built-in PostHog features (session_recording,
|
|
18
|
+
* advanced_disable_flags, disable_surveys, capture_heatmaps, capture_exceptions,
|
|
19
|
+
* bootstrap, cookieless_mode, ...) are passthrough via PostHogConfig.
|
|
20
|
+
*/
|
|
21
|
+
interface Settings extends Partial<PostHogConfig> {
|
|
22
|
+
/** PostHog project API key (e.g. "phc_XXX"). First arg to posthog.init(). */
|
|
23
|
+
apiKey: string;
|
|
24
|
+
/** Destination-level identity mapping, resolved on first push. */
|
|
25
|
+
identify?: Mapping$1.Value;
|
|
26
|
+
/** Destination-level group association, resolved on first push. */
|
|
27
|
+
group?: Mapping$1.Value;
|
|
28
|
+
/** Runtime state — populated by init() and mutated by push(). Not user-facing. */
|
|
29
|
+
_state?: RuntimeState;
|
|
30
|
+
}
|
|
31
|
+
interface RuntimeState {
|
|
32
|
+
/** Last-resolved identity values, used to skip redundant identify/group calls. */
|
|
33
|
+
lastIdentity?: {
|
|
34
|
+
distinctId?: string;
|
|
35
|
+
};
|
|
36
|
+
lastGroup?: {
|
|
37
|
+
type?: string;
|
|
38
|
+
key?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
type InitSettings = Partial<Settings>;
|
|
42
|
+
/**
|
|
43
|
+
* Per-rule mapping settings. Every feature here is a walkerOS mapping value
|
|
44
|
+
* resolved via getMappingValue(). The resolved object's keys drive which
|
|
45
|
+
* SDK methods are called.
|
|
46
|
+
*
|
|
47
|
+
* - identify: { distinctId?, $set?, $set_once? } → posthog.identify() OR posthog.setPersonProperties()
|
|
48
|
+
* - group: { type, key, properties? } → posthog.group()
|
|
49
|
+
* - reset: boolean → posthog.reset()
|
|
50
|
+
* - include: string[] → flattened properties (overrides destination-level)
|
|
51
|
+
*/
|
|
52
|
+
interface Mapping {
|
|
53
|
+
identify?: Mapping$1.Value;
|
|
54
|
+
group?: Mapping$1.Value;
|
|
55
|
+
reset?: Mapping$1.Value | boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* PostHog SDK surface — the subset of `posthog-js` the destination actually
|
|
59
|
+
* uses. Mirrors the real module's default singleton export shape. Tests mock
|
|
60
|
+
* via env.posthog to intercept every call.
|
|
61
|
+
*/
|
|
62
|
+
interface PostHogSDK {
|
|
63
|
+
init: (token: string, config?: Partial<PostHogConfig> & {
|
|
64
|
+
loaded?: (posthog: PostHogSDK) => void;
|
|
65
|
+
}, name?: string) => PostHogSDK;
|
|
66
|
+
capture: (eventName: string, properties?: Properties) => void;
|
|
67
|
+
identify: (distinctId?: string, userPropertiesToSet?: Properties, userPropertiesToSetOnce?: Properties) => void;
|
|
68
|
+
setPersonProperties: (userPropertiesToSet?: Properties, userPropertiesToSetOnce?: Properties) => void;
|
|
69
|
+
group: (groupType: string, groupKey: string, groupPropertiesToSet?: Properties) => void;
|
|
70
|
+
reset: (resetDeviceId?: boolean) => void;
|
|
71
|
+
opt_in_capturing: (options?: {
|
|
72
|
+
captureEventName?: string | null | false;
|
|
73
|
+
captureProperties?: Properties;
|
|
74
|
+
}) => void;
|
|
75
|
+
opt_out_capturing: () => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Env — optional SDK override. Production leaves this undefined and the
|
|
79
|
+
* destination falls back to the real `posthog-js` default export. Tests
|
|
80
|
+
* provide a mock via env.posthog = { ... }.
|
|
81
|
+
*/
|
|
82
|
+
interface Env extends DestinationWeb.Env {
|
|
83
|
+
posthog?: PostHogSDK;
|
|
84
|
+
}
|
|
85
|
+
type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
|
|
86
|
+
type Destination = DestinationWeb.Destination<Types>;
|
|
87
|
+
type Config = DestinationWeb.Config<Types>;
|
|
88
|
+
interface PostHogDestination extends Destination {
|
|
89
|
+
env?: Env;
|
|
90
|
+
}
|
|
91
|
+
type Rule = Mapping$1.Rule<Mapping>;
|
|
92
|
+
type Rules = Mapping$1.Rules<Rule>;
|
|
93
|
+
|
|
94
|
+
type index_Config = Config;
|
|
95
|
+
type index_Destination = Destination;
|
|
96
|
+
type index_Env = Env;
|
|
97
|
+
type index_InitSettings = InitSettings;
|
|
98
|
+
type index_Mapping = Mapping;
|
|
99
|
+
type index_PostHogDestination = PostHogDestination;
|
|
100
|
+
type index_PostHogSDK = PostHogSDK;
|
|
101
|
+
type index_Rule = Rule;
|
|
102
|
+
type index_Rules = Rules;
|
|
103
|
+
type index_RuntimeState = RuntimeState;
|
|
104
|
+
type index_Settings = Settings;
|
|
105
|
+
type index_Types = Types;
|
|
106
|
+
declare namespace index {
|
|
107
|
+
export type { index_Config as Config, index_Destination as Destination, index_Env as Env, index_InitSettings as InitSettings, index_Mapping as Mapping, index_PostHogDestination as PostHogDestination, index_PostHogSDK as PostHogSDK, index_Rule as Rule, index_Rules as Rules, index_RuntimeState as RuntimeState, index_Settings as Settings, index_Types as Types };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare const destinationPostHog: Destination;
|
|
111
|
+
|
|
112
|
+
export { index as DestinationPostHog, destinationPostHog as default, destinationPostHog };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
|
|
2
|
+
import { DestinationWeb } from '@walkeros/web-core';
|
|
3
|
+
import { PostHogConfig, Properties } from 'posthog-js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Destination-level settings.
|
|
7
|
+
*
|
|
8
|
+
* PostHog's `PostHogConfig` interface has ~80 fields — extending the SDK type
|
|
9
|
+
* directly keeps IntelliSense complete and prevents drift. The destination adds:
|
|
10
|
+
* - `apiKey` (required) — first arg to `posthog.init(...)`, NOT an init option
|
|
11
|
+
* - `identify` — destination-level identity mapping
|
|
12
|
+
* - `include` — event sections flattened into `capture()` properties
|
|
13
|
+
* - `group` — destination-level group association
|
|
14
|
+
* - `_state` — runtime state (not user-facing, mutated by init/push)
|
|
15
|
+
*
|
|
16
|
+
* All other walkerOS-specific mapping features live under mapping.settings
|
|
17
|
+
* (see Mapping interface below). Built-in PostHog features (session_recording,
|
|
18
|
+
* advanced_disable_flags, disable_surveys, capture_heatmaps, capture_exceptions,
|
|
19
|
+
* bootstrap, cookieless_mode, ...) are passthrough via PostHogConfig.
|
|
20
|
+
*/
|
|
21
|
+
interface Settings extends Partial<PostHogConfig> {
|
|
22
|
+
/** PostHog project API key (e.g. "phc_XXX"). First arg to posthog.init(). */
|
|
23
|
+
apiKey: string;
|
|
24
|
+
/** Destination-level identity mapping, resolved on first push. */
|
|
25
|
+
identify?: Mapping$1.Value;
|
|
26
|
+
/** Destination-level group association, resolved on first push. */
|
|
27
|
+
group?: Mapping$1.Value;
|
|
28
|
+
/** Runtime state — populated by init() and mutated by push(). Not user-facing. */
|
|
29
|
+
_state?: RuntimeState;
|
|
30
|
+
}
|
|
31
|
+
interface RuntimeState {
|
|
32
|
+
/** Last-resolved identity values, used to skip redundant identify/group calls. */
|
|
33
|
+
lastIdentity?: {
|
|
34
|
+
distinctId?: string;
|
|
35
|
+
};
|
|
36
|
+
lastGroup?: {
|
|
37
|
+
type?: string;
|
|
38
|
+
key?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
type InitSettings = Partial<Settings>;
|
|
42
|
+
/**
|
|
43
|
+
* Per-rule mapping settings. Every feature here is a walkerOS mapping value
|
|
44
|
+
* resolved via getMappingValue(). The resolved object's keys drive which
|
|
45
|
+
* SDK methods are called.
|
|
46
|
+
*
|
|
47
|
+
* - identify: { distinctId?, $set?, $set_once? } → posthog.identify() OR posthog.setPersonProperties()
|
|
48
|
+
* - group: { type, key, properties? } → posthog.group()
|
|
49
|
+
* - reset: boolean → posthog.reset()
|
|
50
|
+
* - include: string[] → flattened properties (overrides destination-level)
|
|
51
|
+
*/
|
|
52
|
+
interface Mapping {
|
|
53
|
+
identify?: Mapping$1.Value;
|
|
54
|
+
group?: Mapping$1.Value;
|
|
55
|
+
reset?: Mapping$1.Value | boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* PostHog SDK surface — the subset of `posthog-js` the destination actually
|
|
59
|
+
* uses. Mirrors the real module's default singleton export shape. Tests mock
|
|
60
|
+
* via env.posthog to intercept every call.
|
|
61
|
+
*/
|
|
62
|
+
interface PostHogSDK {
|
|
63
|
+
init: (token: string, config?: Partial<PostHogConfig> & {
|
|
64
|
+
loaded?: (posthog: PostHogSDK) => void;
|
|
65
|
+
}, name?: string) => PostHogSDK;
|
|
66
|
+
capture: (eventName: string, properties?: Properties) => void;
|
|
67
|
+
identify: (distinctId?: string, userPropertiesToSet?: Properties, userPropertiesToSetOnce?: Properties) => void;
|
|
68
|
+
setPersonProperties: (userPropertiesToSet?: Properties, userPropertiesToSetOnce?: Properties) => void;
|
|
69
|
+
group: (groupType: string, groupKey: string, groupPropertiesToSet?: Properties) => void;
|
|
70
|
+
reset: (resetDeviceId?: boolean) => void;
|
|
71
|
+
opt_in_capturing: (options?: {
|
|
72
|
+
captureEventName?: string | null | false;
|
|
73
|
+
captureProperties?: Properties;
|
|
74
|
+
}) => void;
|
|
75
|
+
opt_out_capturing: () => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Env — optional SDK override. Production leaves this undefined and the
|
|
79
|
+
* destination falls back to the real `posthog-js` default export. Tests
|
|
80
|
+
* provide a mock via env.posthog = { ... }.
|
|
81
|
+
*/
|
|
82
|
+
interface Env extends DestinationWeb.Env {
|
|
83
|
+
posthog?: PostHogSDK;
|
|
84
|
+
}
|
|
85
|
+
type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
|
|
86
|
+
type Destination = DestinationWeb.Destination<Types>;
|
|
87
|
+
type Config = DestinationWeb.Config<Types>;
|
|
88
|
+
interface PostHogDestination extends Destination {
|
|
89
|
+
env?: Env;
|
|
90
|
+
}
|
|
91
|
+
type Rule = Mapping$1.Rule<Mapping>;
|
|
92
|
+
type Rules = Mapping$1.Rules<Rule>;
|
|
93
|
+
|
|
94
|
+
type index_Config = Config;
|
|
95
|
+
type index_Destination = Destination;
|
|
96
|
+
type index_Env = Env;
|
|
97
|
+
type index_InitSettings = InitSettings;
|
|
98
|
+
type index_Mapping = Mapping;
|
|
99
|
+
type index_PostHogDestination = PostHogDestination;
|
|
100
|
+
type index_PostHogSDK = PostHogSDK;
|
|
101
|
+
type index_Rule = Rule;
|
|
102
|
+
type index_Rules = Rules;
|
|
103
|
+
type index_RuntimeState = RuntimeState;
|
|
104
|
+
type index_Settings = Settings;
|
|
105
|
+
type index_Types = Types;
|
|
106
|
+
declare namespace index {
|
|
107
|
+
export type { index_Config as Config, index_Destination as Destination, index_Env as Env, index_InitSettings as InitSettings, index_Mapping as Mapping, index_PostHogDestination as PostHogDestination, index_PostHogSDK as PostHogSDK, index_Rule as Rule, index_Rules as Rules, index_RuntimeState as RuntimeState, index_Settings as Settings, index_Types as Types };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare const destinationPostHog: Destination;
|
|
111
|
+
|
|
112
|
+
export { index as DestinationPostHog, destinationPostHog as default, destinationPostHog };
|