@clue-ai/browser-sdk 0.0.1 → 0.0.2

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.
Files changed (60) hide show
  1. package/dist/authoring/overlay.d.ts +1 -1
  2. package/dist/authoring/overlay.js +3 -3
  3. package/dist/authoring/recording.d.ts +1 -1
  4. package/dist/authoring/service-logo.d.ts +1 -1
  5. package/dist/authoring/service-logo.js +1 -1
  6. package/dist/authoring/toolbar-drag.js +1 -1
  7. package/dist/authoring/toolbar-view.d.ts +2 -2
  8. package/dist/authoring/toolbar-view.js +4 -4
  9. package/dist/capture/action.d.ts +1 -1
  10. package/dist/capture/action.js +2 -2
  11. package/dist/capture/drag.d.ts +1 -1
  12. package/dist/capture/drag.js +2 -2
  13. package/dist/capture/error.d.ts +1 -1
  14. package/dist/capture/form.d.ts +1 -1
  15. package/dist/capture/form.js +2 -2
  16. package/dist/capture/frustration.d.ts +1 -1
  17. package/dist/capture/frustration.js +2 -2
  18. package/dist/capture/input.d.ts +1 -1
  19. package/dist/capture/input.js +2 -2
  20. package/dist/capture/navigation.d.ts +1 -1
  21. package/dist/capture/navigation.js +2 -2
  22. package/dist/capture/network.d.ts +1 -1
  23. package/dist/capture/network.js +7 -7
  24. package/dist/capture/page.d.ts +1 -1
  25. package/dist/capture/page.js +1 -1
  26. package/dist/capture/performance.d.ts +1 -1
  27. package/dist/capture/performance.js +1 -1
  28. package/dist/context/account.d.ts +1 -1
  29. package/dist/context/account.js +1 -1
  30. package/dist/context/environment.d.ts +1 -1
  31. package/dist/context/identity.d.ts +1 -1
  32. package/dist/context/identity.js +2 -2
  33. package/dist/context/session.d.ts +1 -1
  34. package/dist/context/session.js +2 -2
  35. package/dist/context/tab.js +2 -2
  36. package/dist/context/trace.js +1 -1
  37. package/dist/core/config.d.ts +1 -1
  38. package/dist/core/config.js +2 -2
  39. package/dist/core/constants.d.ts +1 -1
  40. package/dist/core/sdk.d.ts +1 -1
  41. package/dist/core/sdk.js +29 -29
  42. package/dist/core/types.d.ts +3 -3
  43. package/dist/core/usage-governor.d.ts +1 -1
  44. package/dist/index.d.ts +5 -5
  45. package/dist/index.js +3 -3
  46. package/dist/normalize/builders.d.ts +1 -1
  47. package/dist/normalize/builders.js +5 -5
  48. package/dist/normalize/canonical.d.ts +1 -1
  49. package/dist/normalize/canonical.js +2 -2
  50. package/dist/privacy/mask.js +1 -1
  51. package/dist/privacy/parameter-snapshot.d.ts +1 -1
  52. package/dist/privacy/parameter-snapshot.js +3 -3
  53. package/dist/privacy/sanitize.js +2 -2
  54. package/dist/transport/batch.d.ts +3 -3
  55. package/dist/transport/batch.js +1 -1
  56. package/dist/transport/client.d.ts +2 -2
  57. package/dist/transport/client.js +2 -2
  58. package/dist/transport/queue.d.ts +2 -2
  59. package/dist/transport/retry.js +1 -1
  60. package/package.json +3 -2
@@ -1,4 +1,4 @@
1
- import type { AuthoringRecordingController } from "./recording";
1
+ import type { AuthoringRecordingController } from "./recording.js";
2
2
  declare function resolveAuthoringBaseEndpoint(ingestEndpoint: string): string;
3
3
  declare function resolveAuthoringActionUnitsEndpoint(ingestEndpoint: string): string;
4
4
  export { resolveAuthoringBaseEndpoint, resolveAuthoringActionUnitsEndpoint };
@@ -1,6 +1,6 @@
1
- import { clearPersistedBusinessEventAuthoringToken, isBusinessEventAuthoringSession, persistBusinessEventAuthoringToken, readPersistedBusinessEventAuthoringToken, } from "./session";
2
- import { AUTHORING_INTERNAL_REQUEST_HEADER, AUTHORING_INTERNAL_REQUEST_HEADER_VALUE, } from "./surface";
3
- import { mountToolbar } from "./toolbar-view";
1
+ import { clearPersistedBusinessEventAuthoringToken, isBusinessEventAuthoringSession, persistBusinessEventAuthoringToken, readPersistedBusinessEventAuthoringToken, } from "./session.js";
2
+ import { AUTHORING_INTERNAL_REQUEST_HEADER, AUTHORING_INTERNAL_REQUEST_HEADER_VALUE, } from "./surface.js";
3
+ import { mountToolbar } from "./toolbar-view.js";
4
4
  function notifyOpener(session) {
5
5
  if (!window.opener) {
6
6
  return;
@@ -1,4 +1,4 @@
1
- import type { BusinessEventAuthoringSession } from "./session";
1
+ import type { BusinessEventAuthoringSession } from "./session.js";
2
2
  export type AuthoringActionUnitAtom = {
3
3
  atom_id: string;
4
4
  occurred_at: string;
@@ -1 +1 @@
1
- export { SERVICE_LOGO_URL } from "./service-logo.generated";
1
+ export { SERVICE_LOGO_URL } from "./service-logo.generated.js";
@@ -1 +1 @@
1
- export { SERVICE_LOGO_URL } from "./service-logo.generated";
1
+ export { SERVICE_LOGO_URL } from "./service-logo.generated.js";
@@ -1,4 +1,4 @@
1
- import { TOOLBAR_FALLBACK_HEIGHT, TOOLBAR_INITIAL_TOP, TOOLBAR_VIEWPORT_GUTTER, } from "./toolbar-constants";
1
+ import { TOOLBAR_FALLBACK_HEIGHT, TOOLBAR_INITIAL_TOP, TOOLBAR_VIEWPORT_GUTTER, } from "./toolbar-constants.js";
2
2
  export function getViewportSize() {
3
3
  return {
4
4
  width: Math.max(document.documentElement.clientWidth, window.innerWidth, 0),
@@ -1,5 +1,5 @@
1
- import type { AuthoringRecordingController } from "./recording";
2
- import type { BusinessEventAuthoringSession } from "./session";
1
+ import type { AuthoringRecordingController } from "./recording.js";
2
+ import type { BusinessEventAuthoringSession } from "./session.js";
3
3
  export type ToolbarMountHandle = {
4
4
  root: HTMLElement;
5
5
  dispose: () => void;
@@ -1,8 +1,8 @@
1
1
  import { ChevronDown, ChevronUp, PauseCircle } from "lucide";
2
- import { SERVICE_LOGO_URL } from "./service-logo";
3
- import { AUTHORING_ROOT_ATTRIBUTE, AUTHORING_ROOT_ATTRIBUTE_VALUE, markAuthoringRoot, } from "./surface";
4
- import { AUTHORING_ACTIONS, TOOLBAR_ACTION_BUTTON_SIZE, TOOLBAR_BASE_BUTTON_EDGE_OFFSET, TOOLBAR_BASE_BUTTON_SIZE, TOOLBAR_COLLAPSED_HEIGHT, TOOLBAR_COLLAPSED_WIDTH, TOOLBAR_DOCK_GAP, TOOLBAR_INITIAL_TOP, TOOLBAR_PANEL_HEIGHT, TOOLBAR_PANEL_WIDTH, TOOLBAR_ROOT_ID, TOOLBAR_VIEWPORT_GUTTER, } from "./toolbar-constants";
5
- import { applyToolbarPosition, clampToolbarPosition, getViewportSize, installToolbarDrag, measureToolbar, } from "./toolbar-drag";
2
+ import { SERVICE_LOGO_URL } from "./service-logo.js";
3
+ import { AUTHORING_ROOT_ATTRIBUTE, AUTHORING_ROOT_ATTRIBUTE_VALUE, markAuthoringRoot, } from "./surface.js";
4
+ import { AUTHORING_ACTIONS, TOOLBAR_ACTION_BUTTON_SIZE, TOOLBAR_BASE_BUTTON_EDGE_OFFSET, TOOLBAR_BASE_BUTTON_SIZE, TOOLBAR_COLLAPSED_HEIGHT, TOOLBAR_COLLAPSED_WIDTH, TOOLBAR_DOCK_GAP, TOOLBAR_INITIAL_TOP, TOOLBAR_PANEL_HEIGHT, TOOLBAR_PANEL_WIDTH, TOOLBAR_ROOT_ID, TOOLBAR_VIEWPORT_GUTTER, } from "./toolbar-constants.js";
5
+ import { applyToolbarPosition, clampToolbarPosition, getViewportSize, installToolbarDrag, measureToolbar, } from "./toolbar-drag.js";
6
6
  const toolbarDisposers = new WeakMap();
7
7
  const AUTHORING_GLASS_BACKGROUND = "rgba(255,255,255,0.16)";
8
8
  const AUTHORING_GLASS_BACKGROUND_STRONG = "rgba(255,253,249,0.2)";
@@ -1,2 +1,2 @@
1
- import type { CaptureModuleContext, CaptureStopHandle } from "../core/types";
1
+ import type { CaptureModuleContext, CaptureStopHandle } from "../core/types.js";
2
2
  export declare const startActionCapture: (context: CaptureModuleContext) => CaptureStopHandle;
@@ -1,5 +1,5 @@
1
- import { buildLocalTextDescriptor } from "../privacy/local-minimization";
2
- import { extractFieldName, extractFieldType, getElementAriaLabel, getElementClassList, getElementLabel, getElementPlaceholder, getElementRole, getElementSectionHeading, isEditableElement, resolveClickDisplayTarget, resolveStableKeyDescriptor, } from "./dom";
1
+ import { buildLocalTextDescriptor } from "../privacy/local-minimization.js";
2
+ import { extractFieldName, extractFieldType, getElementAriaLabel, getElementClassList, getElementLabel, getElementPlaceholder, getElementRole, getElementSectionHeading, isEditableElement, resolveClickDisplayTarget, resolveStableKeyDescriptor, } from "./dom.js";
3
3
  export const startActionCapture = (context) => {
4
4
  if (typeof document === "undefined") {
5
5
  return { stop: () => undefined };
@@ -1,2 +1,2 @@
1
- import type { CaptureModuleContext, CaptureStopHandle } from "../core/types";
1
+ import type { CaptureModuleContext, CaptureStopHandle } from "../core/types.js";
2
2
  export declare const startDragCapture: (context: CaptureModuleContext) => CaptureStopHandle;
@@ -1,5 +1,5 @@
1
- import { buildLocalValueDescriptor } from "../privacy/local-minimization";
2
- import { extractFieldName, extractFieldType, getElementAriaLabel, getElementLabel, getElementPlaceholder, getElementRole, getElementSectionHeading, resolveStableKeyDescriptor, } from "./dom";
1
+ import { buildLocalValueDescriptor } from "../privacy/local-minimization.js";
2
+ import { extractFieldName, extractFieldType, getElementAriaLabel, getElementLabel, getElementPlaceholder, getElementRole, getElementSectionHeading, resolveStableKeyDescriptor, } from "./dom.js";
3
3
  const readDragPayload = (event) => {
4
4
  const dataTransfer = event.dataTransfer;
5
5
  if (!dataTransfer) {
@@ -1,2 +1,2 @@
1
- import type { CaptureModuleContext, CaptureStopHandle } from "../core/types";
1
+ import type { CaptureModuleContext, CaptureStopHandle } from "../core/types.js";
2
2
  export declare const startErrorCapture: (context: CaptureModuleContext) => CaptureStopHandle;
@@ -1,2 +1,2 @@
1
- import type { CaptureModuleContext, CaptureStopHandle } from "../core/types";
1
+ import type { CaptureModuleContext, CaptureStopHandle } from "../core/types.js";
2
2
  export declare const startFormCapture: (context: CaptureModuleContext) => CaptureStopHandle;
@@ -1,5 +1,5 @@
1
- import { buildLocalTextDescriptor } from "../privacy/local-minimization";
2
- import { extractFieldName, extractFieldType, getElementAriaLabel, getElementClassList, getElementLabel, getElementPlaceholder, getElementRole, getElementSectionHeading, isEditableElement, resolveClickDisplayTarget, resolveStableKeyDescriptor, } from "./dom";
1
+ import { buildLocalTextDescriptor } from "../privacy/local-minimization.js";
2
+ import { extractFieldName, extractFieldType, getElementAriaLabel, getElementClassList, getElementLabel, getElementPlaceholder, getElementRole, getElementSectionHeading, isEditableElement, resolveClickDisplayTarget, resolveStableKeyDescriptor, } from "./dom.js";
3
3
  const VALIDATION_REASON_KEYS = [
4
4
  "valueMissing",
5
5
  "typeMismatch",
@@ -1,2 +1,2 @@
1
- import type { CaptureModuleContext, CaptureStopHandle } from "../core/types";
1
+ import type { CaptureModuleContext, CaptureStopHandle } from "../core/types.js";
2
2
  export declare const startFrustrationCapture: (context: CaptureModuleContext) => CaptureStopHandle;
@@ -1,5 +1,5 @@
1
- import { buildLocalTextDescriptor } from "../privacy/local-minimization";
2
- import { getElementAriaLabel, getElementLabel, getElementPlaceholder, getElementRole, resolveClickDisplayTarget, resolveStableKeyDescriptor, } from "./dom";
1
+ import { buildLocalTextDescriptor } from "../privacy/local-minimization.js";
2
+ import { getElementAriaLabel, getElementLabel, getElementPlaceholder, getElementRole, resolveClickDisplayTarget, resolveStableKeyDescriptor, } from "./dom.js";
3
3
  const CLICK_WINDOW_MS = 1200;
4
4
  const RAGE_CLICK_COUNT = 3;
5
5
  const RAGE_DISTANCE_PX = 24;
@@ -1,2 +1,2 @@
1
- import type { CaptureModuleContext, CaptureStopHandle } from "../core/types";
1
+ import type { CaptureModuleContext, CaptureStopHandle } from "../core/types.js";
2
2
  export declare const startInputCapture: (context: CaptureModuleContext) => CaptureStopHandle;
@@ -1,5 +1,5 @@
1
- import { buildLocalTextDescriptor, buildLocalValueDescriptor, } from "../privacy/local-minimization";
2
- import { extractFieldName, extractFieldType, getElementAriaLabel, getElementLabel, getElementPlaceholder, getElementRole, getElementSectionHeading, getElementValue, resolveStableKeyDescriptor, } from "./dom";
1
+ import { buildLocalTextDescriptor, buildLocalValueDescriptor, } from "../privacy/local-minimization.js";
2
+ import { extractFieldName, extractFieldType, getElementAriaLabel, getElementLabel, getElementPlaceholder, getElementRole, getElementSectionHeading, getElementValue, resolveStableKeyDescriptor, } from "./dom.js";
3
3
  const buildFileDescriptors = (input) => {
4
4
  const files = input.files ? Array.from(input.files) : [];
5
5
  return files.map((file) => ({
@@ -1,2 +1,2 @@
1
- import type { CaptureModuleContext, CaptureStopHandle } from "../core/types";
1
+ import type { CaptureModuleContext, CaptureStopHandle } from "../core/types.js";
2
2
  export declare const startNavigationCapture: (context: CaptureModuleContext) => CaptureStopHandle;
@@ -1,5 +1,5 @@
1
- import { generateViewId } from "../normalize/event-id";
2
- import { getCurrentPageSnapshot } from "./location";
1
+ import { generateViewId } from "../normalize/event-id.js";
2
+ import { getCurrentPageSnapshot } from "./location.js";
3
3
  export const startNavigationCapture = (context) => {
4
4
  if (typeof window === "undefined") {
5
5
  return { stop: () => undefined };
@@ -1,4 +1,4 @@
1
- import type { CaptureModuleContext, CaptureStopHandle } from "../core/types";
1
+ import type { CaptureModuleContext, CaptureStopHandle } from "../core/types.js";
2
2
  export declare const startNetworkCapture: (context: CaptureModuleContext, options?: {
3
3
  ignoreUrlPrefixes?: string[];
4
4
  tracePropagationOrigins?: string[];
@@ -1,10 +1,10 @@
1
- import { generateEventId, generateRequestId, generateRequestSpanId, } from "../normalize/event-id";
2
- import { toPathTemplate } from "../normalize/path-template";
3
- import { buildLocalQuerySummary, buildLocalStructuredSummary, } from "../privacy/local-minimization";
4
- import { maybeParseJson, sanitizeHeaders } from "../privacy/sanitize";
5
- import { buildSchemaEvidence, deriveOutcomeClass, extractErrorCodeCandidate, extractGraphqlEvidence, } from "../privacy/schema-evidence";
6
- import { hasAuthoringInternalRequestHeader, isAuthoringInternalRequestUrl, logAuthoringRequestExclusion, } from "../authoring/surface";
7
- import { CLUE_SDK_REQUEST_HEADER } from "../transport/client";
1
+ import { generateEventId, generateRequestId, generateRequestSpanId, } from "../normalize/event-id.js";
2
+ import { toPathTemplate } from "../normalize/path-template.js";
3
+ import { buildLocalQuerySummary, buildLocalStructuredSummary, } from "../privacy/local-minimization.js";
4
+ import { maybeParseJson, sanitizeHeaders } from "../privacy/sanitize.js";
5
+ import { buildSchemaEvidence, deriveOutcomeClass, extractErrorCodeCandidate, extractGraphqlEvidence, } from "../privacy/schema-evidence.js";
6
+ import { hasAuthoringInternalRequestHeader, isAuthoringInternalRequestUrl, logAuthoringRequestExclusion, } from "../authoring/surface.js";
7
+ import { CLUE_SDK_REQUEST_HEADER } from "../transport/client.js";
8
8
  const XHR_META_KEY = "__clue_xhr_meta__";
9
9
  const headersToRecord = (headers) => {
10
10
  if (!headers) {
@@ -1,2 +1,2 @@
1
- import type { CaptureModuleContext, CaptureStopHandle } from "../core/types";
1
+ import type { CaptureModuleContext, CaptureStopHandle } from "../core/types.js";
2
2
  export declare const startPageCapture: (context: CaptureModuleContext) => CaptureStopHandle;
@@ -1,4 +1,4 @@
1
- import { getCurrentPageSnapshot } from "./location";
1
+ import { getCurrentPageSnapshot } from "./location.js";
2
2
  export const startPageCapture = (context) => {
3
3
  if (typeof window === "undefined" || typeof document === "undefined") {
4
4
  return { stop: () => undefined };
@@ -1,2 +1,2 @@
1
- import type { CaptureModuleContext, CaptureStopHandle } from "../core/types";
1
+ import type { CaptureModuleContext, CaptureStopHandle } from "../core/types.js";
2
2
  export declare const startPerformanceCapture: (context: CaptureModuleContext) => CaptureStopHandle;
@@ -1,4 +1,4 @@
1
- import { FRONTEND_EVENT_NAME } from "../core/contracts";
1
+ import { FRONTEND_EVENT_NAME } from "../core/contracts.js";
2
2
  const SUMMARY_WINDOW_MS = 60000;
3
3
  const LONG_TASK_THRESHOLD_MS = 250;
4
4
  const INTERACTION_LONG_TASK_THRESHOLD_MS = 100;
@@ -1,4 +1,4 @@
1
- import type { AccountContext } from "../core/types";
1
+ import type { AccountContext } from "../core/types.js";
2
2
  type StorageLike = Pick<Storage, "getItem" | "setItem" | "removeItem">;
3
3
  export declare class AccountManager {
4
4
  private readonly storage;
@@ -1,4 +1,4 @@
1
- import { STORAGE_KEYS } from "../core/constants";
1
+ import { STORAGE_KEYS } from "../core/constants.js";
2
2
  const createMemoryStorage = () => {
3
3
  const store = new Map();
4
4
  return {
@@ -1,4 +1,4 @@
1
- import type { ClueEnvironment } from "../core/types";
1
+ import type { ClueEnvironment } from "../core/types.js";
2
2
  type EnvironmentOptions = {
3
3
  environment: ClueEnvironment;
4
4
  frontendRelease: string | null;
@@ -1,4 +1,4 @@
1
- import type { IdentityContext } from "../core/types";
1
+ import type { IdentityContext } from "../core/types.js";
2
2
  type StorageLike = Pick<Storage, "getItem" | "setItem" | "removeItem">;
3
3
  export declare class IdentityManager {
4
4
  private readonly storage;
@@ -1,5 +1,5 @@
1
- import { STORAGE_KEYS } from "../core/constants";
2
- import { generateAnonymousId } from "../normalize/event-id";
1
+ import { STORAGE_KEYS } from "../core/constants.js";
2
+ import { generateAnonymousId } from "../normalize/event-id.js";
3
3
  const createMemoryStorage = () => {
4
4
  const store = new Map();
5
5
  return {
@@ -1,4 +1,4 @@
1
- import type { SessionContext } from "../core/types";
1
+ import type { SessionContext } from "../core/types.js";
2
2
  type StorageLike = Pick<Storage, "getItem" | "setItem" | "removeItem">;
3
3
  type SessionLifecycleResult = {
4
4
  sessionId: string;
@@ -1,5 +1,5 @@
1
- import { DEFAULT_SESSION_TIMEOUT_MS, STORAGE_KEYS } from "../core/constants";
2
- import { generateSessionId } from "../normalize/event-id";
1
+ import { DEFAULT_SESSION_TIMEOUT_MS, STORAGE_KEYS } from "../core/constants.js";
2
+ import { generateSessionId } from "../normalize/event-id.js";
3
3
  const createMemoryStorage = () => {
4
4
  const store = new Map();
5
5
  return {
@@ -1,5 +1,5 @@
1
- import { STORAGE_KEYS } from "../core/constants";
2
- import { generateEventId, generateTabId } from "../normalize/event-id";
1
+ import { STORAGE_KEYS } from "../core/constants.js";
2
+ import { generateEventId, generateTabId } from "../normalize/event-id.js";
3
3
  const TAB_CLAIM_KEY_PREFIX = "clue:tab_claim:";
4
4
  const TAB_CLAIM_TTL_MS = 5 * 60 * 1000;
5
5
  const DOCUMENT_CLAIM_ID = `doc_${generateEventId()}`;
@@ -1,4 +1,4 @@
1
- import { generateEventId, generateInteractionId, generateRequestId, generateRequestSpanId, } from "../normalize/event-id";
1
+ import { generateEventId, generateInteractionId, generateRequestId, generateRequestSpanId, } from "../normalize/event-id.js";
2
2
  const generateTraceId = () => {
3
3
  return `trace_${generateEventId()}`;
4
4
  };
@@ -1,4 +1,4 @@
1
- import type { ClueInitOptions, ResolvedClueConfig } from "./types";
1
+ import type { ClueInitOptions, ResolvedClueConfig } from "./types.js";
2
2
  export declare const resolveConfig: (options: ClueInitOptions) => ResolvedClueConfig;
3
3
  export declare const validateConfig: (config: ResolvedClueConfig) => string[];
4
4
  export declare const isConfigValid: (config: ResolvedClueConfig) => boolean;
@@ -1,5 +1,5 @@
1
- import { ALWAYS_DENIED_KEYS, DEFAULT_CONFIG, MAX_DIAGNOSTIC_TTL_MS, } from "./constants";
2
- import { SDK_COLLECTION_MODE } from "./contracts";
1
+ import { ALWAYS_DENIED_KEYS, DEFAULT_CONFIG, MAX_DIAGNOSTIC_TTL_MS, } from "./constants.js";
2
+ import { SDK_COLLECTION_MODE } from "./contracts.js";
3
3
  const normalizeKeyList = (keys) => {
4
4
  if (!keys || keys.length === 0) {
5
5
  return [];
@@ -1,4 +1,4 @@
1
- import type { ClueConsentState, ResolvedClueConfig } from "./types";
1
+ import type { ClueConsentState, ResolvedClueConfig } from "./types.js";
2
2
  export declare const SDK_NAME = "@clue-ai/browser-sdk";
3
3
  export declare const SDK_VERSION = "0.0.1";
4
4
  export declare const EVENT_SOURCE: "browser_sdk";
@@ -1,2 +1,2 @@
1
- import type { ClueBrowserSdk } from "./types";
1
+ import type { ClueBrowserSdk } from "./types.js";
2
2
  export declare const createClueBrowserSdk: () => ClueBrowserSdk;
package/dist/core/sdk.js CHANGED
@@ -1,32 +1,32 @@
1
- import { resolveAuthoringBaseEndpoint, startBusinessEventAuthoringOverlay, } from "../authoring/overlay";
2
- import { createAuthoringRecordingController } from "../authoring/recording";
3
- import { readPersistedBusinessEventAuthoringToken } from "../authoring/session";
4
- import { isWithinAuthoringSurface } from "../authoring/surface";
5
- import { startActionCapture } from "../capture/action";
6
- import { startDragCapture } from "../capture/drag";
7
- import { startErrorCapture } from "../capture/error";
8
- import { startFormCapture } from "../capture/form";
9
- import { startFrustrationCapture } from "../capture/frustration";
10
- import { startInputCapture } from "../capture/input";
11
- import { startNavigationCapture } from "../capture/navigation";
12
- import { startNetworkCapture } from "../capture/network";
13
- import { startPageCapture } from "../capture/page";
14
- import { startPerformanceCapture } from "../capture/performance";
15
- import { AccountManager } from "../context/account";
16
- import { EnvironmentManager } from "../context/environment";
17
- import { IdentityManager } from "../context/identity";
18
- import { SessionManager } from "../context/session";
19
- import { TabManager } from "../context/tab";
20
- import { TraceManager } from "../context/trace";
21
- import { InternalMetricsStore } from "../internal/metrics";
22
- import { buildCanonicalEvent, buildDegradedCanonicalCandidates, } from "../normalize/builders";
23
- import { generateViewId } from "../normalize/event-id";
24
- import { BatchTransport } from "../transport/batch";
25
- import { IngestClient } from "../transport/client";
26
- import { isConfigValid, resolveConfig, validateConfig } from "./config";
27
- import { DEFAULT_CONSENT, DEFAULT_INTERACTION_PROPAGATION_WINDOW_MS, DEFAULT_MAX_BATCH_QUEUE_BYTES, SDK_VERSION, } from "./constants";
28
- import { FRONTEND_EVENT_CATEGORY, FRONTEND_EVENT_NAME } from "./contracts";
29
- import { DEFAULT_INGEST_USAGE_GOVERNOR_FEEDBACK, hasUsageGovernorFeedbackChanged, isCostCapabilityDisabled, normalizeIngestUsageGovernorFeedback, } from "./usage-governor";
1
+ import { resolveAuthoringBaseEndpoint, startBusinessEventAuthoringOverlay, } from "../authoring/overlay.js";
2
+ import { createAuthoringRecordingController } from "../authoring/recording.js";
3
+ import { readPersistedBusinessEventAuthoringToken } from "../authoring/session.js";
4
+ import { isWithinAuthoringSurface } from "../authoring/surface.js";
5
+ import { startActionCapture } from "../capture/action.js";
6
+ import { startDragCapture } from "../capture/drag.js";
7
+ import { startErrorCapture } from "../capture/error.js";
8
+ import { startFormCapture } from "../capture/form.js";
9
+ import { startFrustrationCapture } from "../capture/frustration.js";
10
+ import { startInputCapture } from "../capture/input.js";
11
+ import { startNavigationCapture } from "../capture/navigation.js";
12
+ import { startNetworkCapture } from "../capture/network.js";
13
+ import { startPageCapture } from "../capture/page.js";
14
+ import { startPerformanceCapture } from "../capture/performance.js";
15
+ import { AccountManager } from "../context/account.js";
16
+ import { EnvironmentManager } from "../context/environment.js";
17
+ import { IdentityManager } from "../context/identity.js";
18
+ import { SessionManager } from "../context/session.js";
19
+ import { TabManager } from "../context/tab.js";
20
+ import { TraceManager } from "../context/trace.js";
21
+ import { InternalMetricsStore } from "../internal/metrics.js";
22
+ import { buildCanonicalEvent, buildDegradedCanonicalCandidates, } from "../normalize/builders.js";
23
+ import { generateViewId } from "../normalize/event-id.js";
24
+ import { BatchTransport } from "../transport/batch.js";
25
+ import { IngestClient } from "../transport/client.js";
26
+ import { isConfigValid, resolveConfig, validateConfig } from "./config.js";
27
+ import { DEFAULT_CONSENT, DEFAULT_INTERACTION_PROPAGATION_WINDOW_MS, DEFAULT_MAX_BATCH_QUEUE_BYTES, SDK_VERSION, } from "./constants.js";
28
+ import { FRONTEND_EVENT_CATEGORY, FRONTEND_EVENT_NAME } from "./contracts.js";
29
+ import { DEFAULT_INGEST_USAGE_GOVERNOR_FEEDBACK, hasUsageGovernorFeedbackChanged, isCostCapabilityDisabled, normalizeIngestUsageGovernorFeedback, } from "./usage-governor.js";
30
30
  const TRACE_ROOT_EVENTS = new Set([
31
31
  "page_view",
32
32
  "route_change",
@@ -1,6 +1,6 @@
1
- import type { InternalMetricsSnapshot } from "../internal/metrics";
2
- import type { FrontendEventCategory, FrontendEventName, FrontendEventStatus, ParameterCaptureMode, SdkCollectionMode } from "./contracts";
3
- export type { FrontendEventCategory, FrontendEventName, FrontendEventStatus, ParameterCaptureMode, SdkCollectionMode, } from "./contracts";
1
+ import type { InternalMetricsSnapshot } from "../internal/metrics.js";
2
+ import type { FrontendEventCategory, FrontendEventName, FrontendEventStatus, ParameterCaptureMode, SdkCollectionMode } from "./contracts.js";
3
+ export type { FrontendEventCategory, FrontendEventName, FrontendEventStatus, ParameterCaptureMode, SdkCollectionMode, } from "./contracts.js";
4
4
  export type ClueConsentState = "granted" | "denied" | "unknown";
5
5
  export type ClueEnvironment = string;
6
6
  export type TransportProfile = "standard" | "authoring_realtime";
@@ -1,4 +1,4 @@
1
- import type { CostCapability, IngestUsageGovernorFeedback } from "./types";
1
+ import type { CostCapability, IngestUsageGovernorFeedback } from "./types.js";
2
2
  export declare const DEFAULT_INGEST_USAGE_GOVERNOR_FEEDBACK: IngestUsageGovernorFeedback;
3
3
  export declare const normalizeIngestUsageGovernorFeedback: (feedback?: Partial<IngestUsageGovernorFeedback> | null) => IngestUsageGovernorFeedback;
4
4
  export declare const mergeIngestUsageGovernorFeedback: (current: IngestUsageGovernorFeedback | null, incoming: IngestUsageGovernorFeedback | null) => IngestUsageGovernorFeedback | null;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { createClueBrowserSdk } from "./core/sdk";
2
- import type { ClueBrowserSdk, ClueConsentState, ClueInitOptions, ClueSubjectTraits } from "./core/types";
3
- import type { InternalMetricsSnapshot } from "./internal/metrics";
1
+ import { createClueBrowserSdk } from "./core/sdk.js";
2
+ import type { ClueBrowserSdk, ClueConsentState, ClueInitOptions, ClueSubjectTraits } from "./core/types.js";
3
+ import type { InternalMetricsSnapshot } from "./internal/metrics.js";
4
4
  export declare const ClueInit: (options: ClueInitOptions) => void;
5
5
  export declare const ClueIdentify: (userId: string, traits?: ClueSubjectTraits) => void;
6
6
  export declare const ClueSetAccount: (accountId: string, traits?: ClueSubjectTraits) => void;
@@ -9,8 +9,8 @@ export declare const ClueLogout: () => void;
9
9
  export declare const ClueTrack: (eventName: string, properties?: Record<string, unknown>, metrics?: Record<string, number>) => void;
10
10
  export declare const setConsent: (consent: ClueConsentState) => void;
11
11
  export declare const getInternalMetrics: () => InternalMetricsSnapshot;
12
- export { attachNextRouterIntegration } from "./integrations/next-router";
13
- export { attachReactRouterIntegration } from "./integrations/react-router";
12
+ export { attachNextRouterIntegration } from "./integrations/next-router.js";
13
+ export { attachReactRouterIntegration } from "./integrations/react-router.js";
14
14
  export type { ClueBrowserSdk, ClueConsentState, ClueInitOptions, ClueSubjectTraits, InternalMetricsSnapshot, };
15
15
  export { createClueBrowserSdk };
16
16
  declare const _default: ClueBrowserSdk;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createClueBrowserSdk } from "./core/sdk";
1
+ import { createClueBrowserSdk } from "./core/sdk.js";
2
2
  const GLOBAL_SDK_KEY = "__clue_browser_sdk_singleton__";
3
3
  const globalWithClueSdk = globalThis;
4
4
  const existingSdk = globalWithClueSdk[GLOBAL_SDK_KEY];
@@ -30,7 +30,7 @@ export const setConsent = (consent) => {
30
30
  export const getInternalMetrics = () => {
31
31
  return sdk.getInternalMetrics();
32
32
  };
33
- export { attachNextRouterIntegration } from "./integrations/next-router";
34
- export { attachReactRouterIntegration } from "./integrations/react-router";
33
+ export { attachNextRouterIntegration } from "./integrations/next-router.js";
34
+ export { attachReactRouterIntegration } from "./integrations/react-router.js";
35
35
  export { createClueBrowserSdk };
36
36
  export default sdk;
@@ -1,4 +1,4 @@
1
- import type { CanonicalBaseEvent, ClueContext, RawCapturedEvent } from "../core/types";
1
+ import type { CanonicalBaseEvent, ClueContext, RawCapturedEvent } from "../core/types.js";
2
2
  type BuilderOptions = {
3
3
  context: ClueContext;
4
4
  deniedKeys: string[];
@@ -1,8 +1,8 @@
1
- import { FRONTEND_EVENT_CATEGORY, FRONTEND_EVENT_NAME, FRONTEND_EVENT_STATUS, } from "../core/contracts";
2
- import { maskMessage, maskUnknown, maskUrl } from "../privacy/mask";
3
- import { parseUrlForNetwork, sanitizeObject } from "../privacy/sanitize";
4
- import { buildParameterSnapshotBundle, buildUnavailableParameterSnapshot, truncateParameterSnapshotValue, } from "../privacy/parameter-snapshot";
5
- import { createCanonicalBaseEvent } from "./canonical";
1
+ import { FRONTEND_EVENT_CATEGORY, FRONTEND_EVENT_NAME, FRONTEND_EVENT_STATUS, } from "../core/contracts.js";
2
+ import { maskMessage, maskUnknown, maskUrl } from "../privacy/mask.js";
3
+ import { parseUrlForNetwork, sanitizeObject } from "../privacy/sanitize.js";
4
+ import { buildParameterSnapshotBundle, buildUnavailableParameterSnapshot, truncateParameterSnapshotValue, } from "../privacy/parameter-snapshot.js";
5
+ import { createCanonicalBaseEvent } from "./canonical.js";
6
6
  const asString = (value) => {
7
7
  return typeof value === "string" ? value : null;
8
8
  };
@@ -1,4 +1,4 @@
1
- import type { CanonicalBaseEvent, ClueContext, FrontendEventCategory, FrontendEventName, FrontendEventStatus } from "../core/types";
1
+ import type { CanonicalBaseEvent, ClueContext, FrontendEventCategory, FrontendEventName, FrontendEventStatus } from "../core/types.js";
2
2
  export type CanonicalBaseInput = {
3
3
  eventName: FrontendEventName;
4
4
  eventCategory: FrontendEventCategory;
@@ -1,5 +1,5 @@
1
- import { EVENT_SOURCE, EVENT_VERSION, SOURCE_SCHEMA_VERSION, SURFACE_TYPE, } from "../core/constants";
2
- import { generateEventId } from "./event-id";
1
+ import { EVENT_SOURCE, EVENT_VERSION, SOURCE_SCHEMA_VERSION, SURFACE_TYPE, } from "../core/constants.js";
2
+ import { generateEventId } from "./event-id.js";
3
3
  export const createCanonicalBaseEvent = (input) => {
4
4
  const eventId = generateEventId();
5
5
  const occurredAt = new Date(input.occurredAtMs ?? Date.now()).toISOString();
@@ -1,4 +1,4 @@
1
- import { MASKED_VALUE } from "../core/constants";
1
+ import { MASKED_VALUE } from "../core/constants.js";
2
2
  export const maskString = (value) => {
3
3
  if (value == null) {
4
4
  return null;
@@ -1,4 +1,4 @@
1
- import type { ParameterSnapshotValue } from "../core/types";
1
+ import type { ParameterSnapshotValue } from "../core/types.js";
2
2
  type ParameterSnapshotBundle = {
3
3
  snapshot: ParameterSnapshotValue;
4
4
  allowedValueKeys: string[];
@@ -1,6 +1,6 @@
1
- import { FORBIDDEN_PARAMETER_VALUE, MASKED_VALUE, MAX_SANITIZE_DEPTH, TRUNCATED_PARAMETER_VALUE, } from "../core/constants";
2
- import { PARAMETER_CAPTURE_MODE } from "../core/contracts";
3
- import { isDeniedKey } from "./sanitize";
1
+ import { FORBIDDEN_PARAMETER_VALUE, MASKED_VALUE, MAX_SANITIZE_DEPTH, TRUNCATED_PARAMETER_VALUE, } from "../core/constants.js";
2
+ import { PARAMETER_CAPTURE_MODE } from "../core/contracts.js";
3
+ import { isDeniedKey } from "./sanitize.js";
4
4
  const SNAPSHOT_UNAVAILABLE_KEY = "_clue_snapshot_unavailable";
5
5
  const normalizeParameterLookupPath = (path) => {
6
6
  return path.replace(/\[\d+\]/g, "[]");
@@ -1,5 +1,5 @@
1
- import { ALWAYS_DENIED_KEYS, MASKED_VALUE, MAX_SANITIZE_DEPTH, } from "../core/constants";
2
- import { toPathTemplate } from "../normalize/path-template";
1
+ import { ALWAYS_DENIED_KEYS, MASKED_VALUE, MAX_SANITIZE_DEPTH, } from "../core/constants.js";
2
+ import { toPathTemplate } from "../normalize/path-template.js";
3
3
  const normalizeHeaderKey = (key) => key.trim().toLowerCase();
4
4
  const normalizeLookupKey = (key) => key
5
5
  .trim()
@@ -1,6 +1,6 @@
1
- import type { CanonicalBaseEvent, IngestUsageGovernorFeedback } from "../core/types";
2
- import type { InternalMetricsStore } from "../internal/metrics";
3
- import type { IngestClient } from "./client";
1
+ import type { CanonicalBaseEvent, IngestUsageGovernorFeedback } from "../core/types.js";
2
+ import type { InternalMetricsStore } from "../internal/metrics.js";
3
+ import type { IngestClient } from "./client.js";
4
4
  export type BatchTransportOptions = {
5
5
  enabled: boolean;
6
6
  flushIntervalMs: number;
@@ -1,4 +1,4 @@
1
- import { EventQueue } from "./queue";
1
+ import { EventQueue } from "./queue.js";
2
2
  export class BatchTransport {
3
3
  constructor(options) {
4
4
  this.enabled = options.enabled;
@@ -1,5 +1,5 @@
1
- import type { CanonicalBaseEvent, ClueEnvironment, IngestUsageGovernorFeedback } from "../core/types";
2
- import type { InternalMetricsStore } from "../internal/metrics";
1
+ import type { CanonicalBaseEvent, ClueEnvironment, IngestUsageGovernorFeedback } from "../core/types.js";
2
+ import type { InternalMetricsStore } from "../internal/metrics.js";
3
3
  export declare const CLUE_SDK_REQUEST_HEADER = "x-clue-sdk-request";
4
4
  export declare const CLUE_ENVIRONMENT_HEADER = "x-clue-environment";
5
5
  export declare const CLUE_SDK_VERSION_HEADER = "x-clue-sdk-version";
@@ -1,5 +1,5 @@
1
- import { mergeIngestUsageGovernorFeedback, parseGovernorFeedbackEnvelope, } from "../core/usage-governor";
2
- import { executeWithRetry, isRetryableStatus } from "./retry";
1
+ import { mergeIngestUsageGovernorFeedback, parseGovernorFeedbackEnvelope, } from "../core/usage-governor.js";
2
+ import { executeWithRetry, isRetryableStatus } from "./retry.js";
3
3
  export const CLUE_SDK_REQUEST_HEADER = "x-clue-sdk-request";
4
4
  export const CLUE_ENVIRONMENT_HEADER = "x-clue-environment";
5
5
  export const CLUE_SDK_VERSION_HEADER = "x-clue-sdk-version";
@@ -1,5 +1,5 @@
1
- import type { CanonicalBaseEvent } from "../core/types";
2
- import type { InternalMetricsStore } from "../internal/metrics";
1
+ import type { CanonicalBaseEvent } from "../core/types.js";
2
+ import type { InternalMetricsStore } from "../internal/metrics.js";
3
3
  export declare class EventQueue {
4
4
  private readonly items;
5
5
  private readonly maxItems;
@@ -1,4 +1,4 @@
1
- import { RETRY_CONFIG } from "../core/constants";
1
+ import { RETRY_CONFIG } from "../core/constants.js";
2
2
  export const isRetryableStatus = (status) => {
3
3
  return status === 429 || (status >= 500 && status < 600);
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clue-ai/browser-sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Clue Browser SDK for raw telemetry capture and transport",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,7 +16,8 @@
16
16
  }
17
17
  },
18
18
  "scripts": {
19
- "build": "node ./scripts/clean-dist.mjs && node ./scripts/generate-service-logo-module.mjs && tsc -p tsconfig.build.json",
19
+ "build": "node ./scripts/clean-dist.mjs && node ./scripts/generate-service-logo-module.mjs && tsc -p tsconfig.build.json && node ./scripts/fix-esm-relative-imports.mjs",
20
+ "test:package-import": "pnpm build && node ./scripts/check-package-import.mjs",
20
21
  "typecheck": "tsc -p tsconfig.json --noEmit",
21
22
  "test": "vitest run",
22
23
  "test:cov": "vitest run --coverage"