@revturbine/sdk 0.2.40 → 0.2.41
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/dist/headless.js +10 -10
- package/dist/headless.js.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/types/web-sdk/react/RevTurbineProvider.d.ts +12 -1
- package/dist/types/web-sdk/react/RevTurbineProvider.d.ts.map +1 -1
- package/dist/types/web-sdk/react/Track.d.ts +51 -0
- package/dist/types/web-sdk/react/Track.d.ts.map +1 -0
- package/dist/types/web-sdk/react/index.d.ts +1 -0
- package/dist/types/web-sdk/react/index.d.ts.map +1 -1
- package/dist/types/web-sdk/telemetry/dom-capture.d.ts +42 -0
- package/dist/types/web-sdk/telemetry/dom-capture.d.ts.map +1 -0
- package/dist/types/web-sdk/telemetry/index.d.ts +2 -0
- package/dist/types/web-sdk/telemetry/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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;
|
|
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