@revturbine/sdk 0.2.40 → 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"}
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { type RevTurbineInitInputOptions, type RevTurbinePlacementConfig, type RevTurbinePlacementDecisionInput } from '../customer-side';
3
+ import { type AnnotatedCaptureOptions } from '../telemetry';
3
4
  type BootstrapPlacementInput = Omit<RevTurbinePlacementDecisionInput, 'placementId'> & {
4
5
  placement: RevTurbinePlacementConfig;
5
6
  };
@@ -8,6 +9,16 @@ export type RevTurbineProviderProps = {
8
9
  options: RevTurbineInitInputOptions;
9
10
  /** Placements to bootstrap (preload decisions) on mount. */
10
11
  bootstrapPlacements?: BootstrapPlacementInput[];
12
+ /**
13
+ * Opt into annotated DOM capture (plan 144 TASK-15). When set, one delegated
14
+ * listener per event is installed at the document root; a click on an element
15
+ * with `data-rt-event` emits that event with its allowlisted `data-rt-prop-*`
16
+ * / `data-rt-ref` values — never text, input values, hrefs, or selectors, and
17
+ * never a password / file / hidden / payment control (REQ-14). `true` uses the
18
+ * defaults; pass {@link AnnotatedCaptureOptions} to configure events/caps.
19
+ * Omit to disable. Memoize an object value to avoid re-installing.
20
+ */
21
+ domCapture?: boolean | AnnotatedCaptureOptions;
11
22
  /** React children. */
12
23
  children: React.ReactNode;
13
24
  };
@@ -26,6 +37,6 @@ export type RevTurbineProviderProps = {
26
37
  * </RevTurbineProvider>
27
38
  * ```
28
39
  */
29
- export declare function RevTurbineProvider({ options, bootstrapPlacements, children }: RevTurbineProviderProps): React.JSX.Element;
40
+ export declare function RevTurbineProvider({ options, bootstrapPlacements, domCapture, children }: RevTurbineProviderProps): React.JSX.Element;
30
41
  export {};
31
42
  //# sourceMappingURL=RevTurbineProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RevTurbineProvider.d.ts","sourceRoot":"","sources":["../../../../react/RevTurbineProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EAItC,MAAM,kBAAkB,CAAC;AAO1B,KAAK,uBAAuB,GAAG,IAAI,CAAC,gCAAgC,EAAE,aAAa,CAAC,GAAG;IACrF,SAAS,EAAE,yBAAyB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,wEAAwE;IACxE,OAAO,EAAE,0BAA0B,CAAC;IACpC,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAChD,sBAAsB;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAcF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,EAAE,uBAAuB,qBAoIrG"}
1
+ {"version":3,"file":"RevTurbineProvider.d.ts","sourceRoot":"","sources":["../../../../react/RevTurbineProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EAItC,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAA2B,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGrF,KAAK,uBAAuB,GAAG,IAAI,CAAC,gCAAgC,EAAE,aAAa,CAAC,GAAG;IACrF,SAAS,EAAE,yBAAyB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,wEAAwE;IACxE,OAAO,EAAE,0BAA0B,CAAC;IACpC,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAChD;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IAC/C,sBAAsB;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAcF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,uBAAuB,qBAiJjH"}
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { type TrackOptions } from './useTrack';
3
+ import type { SdkEventProperties } from '../customer-side';
4
+ /** Props for {@link Track}. */
5
+ export interface TrackProps {
6
+ /** Event name to emit on click. */
7
+ event: string;
8
+ /** Event data (reserved names are dropped by {@link useTrack}). */
9
+ data?: SdkEventProperties;
10
+ /** Track options (area / action / purpose / once / dedupeKey / immediate). */
11
+ options?: TrackOptions;
12
+ /**
13
+ * Compose the telemetry onto the **single child element** instead of rendering
14
+ * a wrapper (Radix-Slot style). Preserves the child's accessible name, disabled
15
+ * state, and existing `onClick`.
16
+ */
17
+ asChild?: boolean;
18
+ /** Host element tag when not `asChild`. Default `'span'`. */
19
+ as?: keyof React.JSX.IntrinsicElements;
20
+ className?: string;
21
+ style?: React.CSSProperties;
22
+ children?: React.ReactNode;
23
+ }
24
+ /**
25
+ * Fire a telemetry event on click (plan 144 TASK-16 / REQ-22, AC-14).
26
+ *
27
+ * With `asChild`, it **composes onto the single child element** rather than
28
+ * wrapping it: the child's own `onClick` runs first, and the telemetry fires only
29
+ * if the child did **not** `preventDefault`. Because it clones the child (no
30
+ * wrapper element, no added `role`/`tabIndex`), the child's accessible name and
31
+ * disabled state are unchanged (REQ-19). Without `asChild` it renders a host
32
+ * element (default `<span>`).
33
+ */
34
+ export declare function Track({ event, data, options, asChild, as, className, style, children, }: TrackProps): React.ReactElement;
35
+ /**
36
+ * Telemetry props to spread onto a primitive that **cannot take a wrapper** and
37
+ * so can't use `<Track asChild>` (plan 144 TASK-16 / REQ-22). Returns an
38
+ * `onClick` bound to the enclosing {@link TelemetryScope}; the caller composes it
39
+ * with any handler of their own. Respects `preventDefault` — if a prior handler
40
+ * prevents default, the event does not fire.
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * const t = useTelemetryProps('cta_clicked', { plan: 'pro' });
45
+ * <button {...t}>Upgrade</button>
46
+ * ```
47
+ */
48
+ export declare function useTelemetryProps(event: string, data?: SdkEventProperties, options?: TrackOptions): {
49
+ onClick: React.MouseEventHandler;
50
+ };
51
+ //# sourceMappingURL=Track.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Track.d.ts","sourceRoot":"","sources":["../../../../react/Track.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAW3D,+BAA+B;AAC/B,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,8EAA8E;IAC9E,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6DAA6D;IAC7D,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAID;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,OAAO,EACP,OAAO,EACP,EAAW,EACX,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,UAAU,GAAG,KAAK,CAAC,YAAY,CA4BjC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,kBAAkB,EACzB,OAAO,CAAC,EAAE,YAAY,GACrB;IAAE,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAA;CAAE,CAStC"}
@@ -12,6 +12,7 @@ export * from './TrackOnView';
12
12
  export * from './EngagementArea';
13
13
  export * from './useTrackedAction';
14
14
  export * from './useGatedAction';
15
+ export * from './Track';
15
16
  export * from './useCan';
16
17
  export * from './useUsageSnapshot';
17
18
  export { useRevTurbineTheme } from '../theme/ThemeContext';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../react/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../react/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Annotated DOM capture (plan 144 TASK-15 / REQ-14, REQ-23).
3
+ *
4
+ * `annotated` mode ONLY — hand-authored `data-rt-event` / `data-rt-ref` /
5
+ * `data-rt-prop-*` attributes. There is no `mapped` (selector-based) or
6
+ * `discovery` (auto) capture: those read arbitrary page content and are out of
7
+ * scope.
8
+ *
9
+ * PRIVACY INVARIANTS (REQ-14) — the collection layer NEVER reads:
10
+ * - element text / `innerText` / `textContent`
11
+ * - input `.value` / `name` / `label`
12
+ * - `href` / URLs
13
+ * - CSS selectors or the element path
14
+ * - arbitrary attributes
15
+ * Only allowlisted `data-rt-prop-*` values are collected, capped in count and
16
+ * length, then handed to the caller which passes them through the existing PII
17
+ * redactor. Password / file / hidden / payment-autocomplete controls are always
18
+ * excluded, and a `data-rt-no-capture` ancestor opts an element and its whole
19
+ * subtree out.
20
+ */
21
+ /** Options for {@link installAnnotatedCapture}. */
22
+ export interface AnnotatedCaptureOptions {
23
+ /** DOM events to delegate. One listener is attached per event. Default `['click']`. */
24
+ events?: string[];
25
+ /** Max `data-rt-prop-*` values collected per element. Default 24. */
26
+ maxProps?: number;
27
+ /** Max length of each collected value. Default 256. */
28
+ maxValueLen?: number;
29
+ }
30
+ /**
31
+ * Install one delegated listener per supported event at `root` (plan 144
32
+ * TASK-15). On a matching interaction it emits the element's `data-rt-event` with
33
+ * its allowlisted `data-rt-prop-*` / `data-rt-ref` values — nothing else. Returns
34
+ * a cleanup function that removes every listener.
35
+ *
36
+ * @param root - the provider root (a DOM element or document)
37
+ * @param emit - receives `(eventName, props)`; the caller must pass `props`
38
+ * through the SDK's redactor (e.g. `sdk.capture`)
39
+ * @param options - events + caps
40
+ */
41
+ export declare function installAnnotatedCapture(root: Element | Document, emit: (eventName: string, props: Record<string, string>) => void, options?: AnnotatedCaptureOptions): () => void;
42
+ //# sourceMappingURL=dom-capture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-capture.d.ts","sourceRoot":"","sources":["../../../../telemetry/dom-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA4EH,mDAAmD;AACnD,MAAM,WAAW,uBAAuB;IACtC,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,GAAG,QAAQ,EACxB,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,EAChE,OAAO,GAAE,uBAA4B,GACpC,MAAM,IAAI,CAkBZ"}
@@ -14,4 +14,6 @@ export { createTelemetryCounters } from './counters';
14
14
  export type { TelemetryCounters } from './counters';
15
15
  export { createExposureManager, exposureManager } from './visibility';
16
16
  export type { ExposureBasis, ExposureManager, ExposureObserveOptions } from './visibility';
17
+ export { installAnnotatedCapture } from './dom-capture';
18
+ export type { AnnotatedCaptureOptions } from './dom-capture';
17
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../telemetry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC9D,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACtE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../telemetry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC9D,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACtE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revturbine/sdk",
3
- "version": "0.2.40",
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",