@reproapp/react-sdk 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -55,6 +55,12 @@ export default function App() {
55
55
  appId="app_123"
56
56
  tenantId="tenant_abc"
57
57
  apiBase="https://repro.example.com"
58
+ logCollectorUrl="https://collector.example.com"
59
+ ingest={{
60
+ mode: "staging",
61
+ actorType: "browser",
62
+ actorLabels: { env: "prod", platform: "web" },
63
+ }}
58
64
  button={{ text: "Report issue" }}
59
65
  masking={masking}
60
66
  >
@@ -66,6 +72,13 @@ export default function App() {
66
72
 
67
73
  Notes:
68
74
  - `apiBase` defaults to `https://repro-api-d7288.ondigitalocean.app/api`.
75
+ - `logCollectorUrl` defaults to `https://log-collector-5rj86.ondigitalocean.app`.
76
+ - `ingest.mode` defaults to `live`.
77
+ - In `live` mode, rrweb, frontend action events, and a final session-end marker are sent through ingest (`/v1/ingest/events`). The API reconstructs only after that marker is visible and the ClickHouse session stream is stable.
78
+ - Set `ingest.mode = "staging"` to send rrweb chunks and frontend action events into ClickHouse via `POST /v1/ingest/events` without automatic reconstruction.
79
+ - Legacy mode names `api` and `log-collector` are still accepted as aliases for `live` and `staging`.
80
+ - `ingest.logCollectorUrl`, `ingest.logCollectorUri`, and legacy `ingest.baseUrl` can override the log-collector URL per provider instance.
81
+ - `REPRO_LOG_COLLECTOR_URL`, `REPRO_LOG_COLLECTOR_URI`, and legacy `REPRO_INGEST_BASE` are also accepted when exposed to the browser through `globalThis.__REPRO_SDK_ENV__` or a compatible runtime env shim.
69
82
  - `button.text` overrides the floating button label (same label for Record and Stop).
70
83
  - `attachAxios` works with any Axios instance; `window.axios` is auto-attached if present.
71
84
  - This SDK runs in the browser; for Next.js use a client component.
@@ -93,6 +106,21 @@ type Props = {
93
106
  appId: string;
94
107
  tenantId: string;
95
108
  apiBase?: string; // default: https://repro-api-d7288.ondigitalocean.app/api
109
+ logCollectorUrl?: string; // default: https://log-collector-5rj86.ondigitalocean.app
110
+ logCollectorUri?: string; // alias for logCollectorUrl
111
+ ingest?: {
112
+ mode?: "live" | "staging" | "api" | "log-collector"; // default: "live"
113
+ logCollectorUrl?: string;
114
+ logCollectorUri?: string;
115
+ baseUrl?: string; // legacy alias for logCollectorUrl
116
+ path?: string; // default: /v1/ingest/events
117
+ appSecret?: string;
118
+ appName?: string;
119
+ actorId?: string;
120
+ actorType?: string;
121
+ actorLabels?: Record<string, string>;
122
+ schemaVersion?: number; // default: 1
123
+ };
96
124
  children: React.ReactNode;
97
125
  button?: { text?: string };
98
126
  masking?: MaskingOptions;
package/dist/index.d.ts CHANGED
@@ -1,25 +1,47 @@
1
- import React from "react";
2
- import { record } from "rrweb";
1
+ import React from 'react';
2
+ import { record } from 'rrweb';
3
3
  /**
4
4
  * Repro React SDK (MVP)
5
5
  * - Floating "Record / Stop & Report" button
6
6
  * - Bootstrap -> start session -> rrweb capture
7
- * - Intercepts window.fetch to inject X-Bug-Session-Id / X-Bug-Action-Id
7
+ * - Intercepts window.fetch to propagate request/session context
8
8
  * - Generates Action IDs on clicks; posts minimal action events
9
9
  * - Uses ORIGINAL fetch for SDK-internal calls to avoid recursion
10
10
  */
11
11
  type RrwebRecordOptions = NonNullable<Parameters<typeof record>[0]>;
12
- export type MaskingOptions = Pick<RrwebRecordOptions, "maskAllInputs" | "maskTextClass" | "maskTextSelector" | "maskInputOptions" | "maskInputFn" | "maskTextFn">;
12
+ export type MaskingOptions = Pick<RrwebRecordOptions, 'maskAllInputs' | 'maskTextClass' | 'maskTextSelector' | 'maskInputOptions' | 'maskInputFn' | 'maskTextFn'>;
13
+ type IngestMode = 'live' | 'staging';
14
+ type LegacyIngestMode = 'api' | 'log-collector';
15
+ export type IngestOptions = {
16
+ mode?: IngestMode | LegacyIngestMode;
17
+ /** Preferred log-collector base URL, for example https://log-collector.example.com. */
18
+ logCollectorUrl?: string;
19
+ /** Alias for logCollectorUrl. */
20
+ logCollectorUri?: string;
21
+ /** Legacy alias for logCollectorUrl. */
22
+ baseUrl?: string;
23
+ path?: string;
24
+ appSecret?: string;
25
+ appName?: string;
26
+ actorId?: string;
27
+ actorType?: string;
28
+ actorLabels?: Record<string, string>;
29
+ schemaVersion?: number;
30
+ };
13
31
  type Props = {
14
32
  appId: string;
33
+ tenantId?: string;
15
34
  children: React.ReactNode;
16
35
  button?: {
17
36
  text?: string;
18
37
  };
19
38
  masking?: MaskingOptions;
20
39
  apiBase?: string;
40
+ logCollectorUrl?: string;
41
+ logCollectorUri?: string;
42
+ ingest?: IngestOptions;
21
43
  };
22
44
  /** Manually attach Repro to any Axios instance (no recursion). */
23
45
  export declare function attachAxios(axiosInstance: any): void;
24
- export declare function ReproProvider({ appId, children, button, masking, apiBase }: Props): import("react/jsx-runtime").JSX.Element;
46
+ export declare function ReproProvider({ appId, tenantId, children, button, masking, apiBase, logCollectorUrl, logCollectorUri, ingest, }: Props): import("react/jsx-runtime").JSX.Element;
25
47
  export default ReproProvider;