@revturbine/sdk 0.2.41 → 0.2.42

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.
@@ -110,10 +110,19 @@ export interface AnalyticsProviderOptions {
110
110
  export declare function createAnalyticsProvider(options: AnalyticsProviderOptions): EventConsumerProvider;
111
111
  /**
112
112
  * Minimal shape of a PostHog client — satisfied by both `posthog-js`
113
- * (browser) and `posthog-node` (server). Only `capture` is used.
113
+ * (browser) and `posthog-node` (server). `capture` is always used; the identity
114
+ * lifecycle methods are optional and only called by {@link createPostHogIntegration}
115
+ * when the matching sync flag is on. This is a structural interface — no PostHog
116
+ * package is imported or bundled (the client is injected).
114
117
  */
115
118
  export interface PostHogLike {
116
119
  capture(event: string, properties?: Record<string, unknown>): void;
120
+ /** Optional — mirrors a RevTurbine identify when `syncIdentity` is on. */
121
+ identify?(distinctId: string, properties?: Record<string, unknown>): void;
122
+ /** Optional — mirrors an account group when `syncAccountGroup` is on. */
123
+ group?(groupType: string, groupKey: string, properties?: Record<string, unknown>): void;
124
+ /** Optional — called when the identity is cleared (logout) under `syncIdentity`. */
125
+ reset?(): void;
117
126
  }
118
127
  /** Configuration for {@link createPostHogAnalyticsProvider}. */
119
128
  export interface PostHogAnalyticsProviderOptions {
@@ -154,4 +163,40 @@ export interface PostHogAnalyticsProviderOptions {
154
163
  * ```
155
164
  */
156
165
  export declare function createPostHogAnalyticsProvider(options: PostHogAnalyticsProviderOptions): EventConsumerProvider;
166
+ /** Configuration for {@link createPostHogIntegration}. */
167
+ export interface PostHogIntegrationOptions extends PostHogAnalyticsProviderOptions {
168
+ /**
169
+ * Mirror RevTurbine identify / logout to `posthog.identify` / `posthog.reset`.
170
+ * The distinct id is RevTurbine's already-redacted (hashed) user id — never a
171
+ * raw email. Default `false`.
172
+ */
173
+ syncIdentity?: boolean;
174
+ /**
175
+ * Mirror the `account_id` trait to a PostHog group (`group('account', id)`)
176
+ * when it changes. Default `false`.
177
+ */
178
+ syncAccountGroup?: boolean;
179
+ /**
180
+ * Mirror `page_view` events to a native PostHog `$pageview`. Default `false`.
181
+ */
182
+ mirrorNavigation?: boolean;
183
+ }
184
+ /**
185
+ * Create a PostHog integration with an optional identity lifecycle (plan 144
186
+ * TASK-17 / REQ-26).
187
+ *
188
+ * A superset of {@link createPostHogAnalyticsProvider}: every event is still
189
+ * `posthog.capture(name, properties)` with the **same `filter` / `transform`
190
+ * semantics** (REQ-27), and — when the matching flag is on — RevTurbine's
191
+ * identify/logout, account grouping, and navigation are mirrored to PostHog's
192
+ * native `identify` / `reset` / `group` / `$pageview`. All sync flags default
193
+ * `false`, so by default this behaves exactly like the capture-only provider.
194
+ *
195
+ * No PostHog package is imported or bundled — the client is injected — so this
196
+ * code is tree-shakable and only pulled in when you import it (AC-20). A throw
197
+ * from any PostHog call is swallowed and never blocks RevTurbine ingest (AC-17).
198
+ *
199
+ * `createPostHogAnalyticsProvider` remains exported for existing integrations.
200
+ */
201
+ export declare function createPostHogIntegration(options: PostHogIntegrationOptions): EventConsumerProvider;
157
202
  //# sourceMappingURL=analytics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../analytics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAEV,qBAAqB,EAEtB,MAAM,gBAAgB,CAAC;AAMxB;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAClC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,wBAAwB,KACjC,IAAI,CAAC;AAEV;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,wBAAwB,KACjC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,wBAAwB,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AAW,CAAC;IAErB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,yBAAyB,CAAC;IAEtC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,+BAA+B,GACvC,qBAAqB,CAUvB;AAED,0DAA0D;AAC1D,MAAM,WAAW,yBAA0B,SAAQ,+BAA+B;IAChF;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,qBAAqB,CA0DlG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revturbine/sdk",
3
- "version": "0.2.41",
3
+ "version": "0.2.42",
4
4
  "description": "RevTurbine customer-facing SDK — placement decisioning, entitlement checks, and usage tracking.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.12.0",