@insitue/sdk 0.2.0 → 0.3.1
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 +203 -0
- package/dist/capture-only.d.ts +26 -16
- package/dist/capture-only.js +1 -2
- package/dist/{chunk-62N4L6RA.js → chunk-BCKDBCPG.js} +781 -68
- package/dist/index.d.ts +52 -25
- package/dist/index.js +26 -25
- package/package.json +1 -6
- package/dist/chunk-VRINS2SK.js +0 -1236
- package/dist/chunk-ZV3AVYBI.js +0 -400
- package/dist/overlay.d.ts +0 -6
- package/dist/overlay.js +0 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,49 +1,76 @@
|
|
|
1
1
|
import { IssueDraft, CaptureBundle } from '@insitue/capture-core';
|
|
2
|
-
|
|
2
|
+
import { CaptureSink } from './capture-only.js';
|
|
3
3
|
export { CaptureOnlyOptions, mountCaptureOnly } from './capture-only.js';
|
|
4
4
|
|
|
5
|
-
interface InSitueProps {
|
|
6
|
-
/** Companion loopback port (default 5747). */
|
|
7
|
-
port?: number;
|
|
8
|
-
}
|
|
9
|
-
declare function InSitue({ port }: InSitueProps): null;
|
|
10
5
|
interface InSitueCaptureProps {
|
|
11
6
|
/**
|
|
12
7
|
* Publishable project key (e.g. `pk_…`). When set, captures POST
|
|
13
8
|
* to the InSitue cloud automatically. Origin-pinned + quota-gated
|
|
14
|
-
* server-side, so safe to ship in your production bundle.
|
|
9
|
+
* server-side, so safe to ship in your production bundle. Auto-
|
|
10
|
+
* selects `sink: { kind: "cloud" }` unless `sink` is set
|
|
11
|
+
* explicitly.
|
|
15
12
|
*/
|
|
16
13
|
projectKey?: string;
|
|
17
|
-
/** Override the ingest endpoint (
|
|
14
|
+
/** Override the ingest endpoint (cloud sink). */
|
|
18
15
|
endpoint?: string;
|
|
19
16
|
/**
|
|
20
|
-
* Take over delivery yourself. Wins over `projectKey
|
|
21
|
-
* (
|
|
17
|
+
* Take over delivery yourself. Wins over `projectKey` AND
|
|
18
|
+
* `sink`. Default (none set + no companion reachable): console +
|
|
19
|
+
* JSON download + `window.__insitu_capture__`.
|
|
22
20
|
*/
|
|
23
21
|
onCapture?: (draft: IssueDraft, bundle: CaptureBundle) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Explicit sink override. Most callers leave this undefined and
|
|
24
|
+
* rely on auto-detection (projectKey → cloud, otherwise →
|
|
25
|
+
* companion).
|
|
26
|
+
*/
|
|
27
|
+
sink?: CaptureSink;
|
|
24
28
|
/**
|
|
25
29
|
* Default the user's "Always pixel-perfect screenshots" setting
|
|
26
|
-
* to `true` on mount — every capture uses
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
+
* to `true` on mount — every capture uses `getDisplayMedia`,
|
|
31
|
+
* paying a one-time tab-share permission per session in exchange
|
|
32
|
+
* for screenshots that are pixel-accurate across any content
|
|
33
|
+
* (next/image, video, canvas, cross-origin).
|
|
30
34
|
*
|
|
31
|
-
* Recommended for dev / dogfood
|
|
32
|
-
* more than the permission UX. Not the default — production
|
|
33
|
-
* end-users shouldn't see a permission dialog they didn't ask for.
|
|
35
|
+
* Recommended for dev / dogfood; not for production end-users.
|
|
34
36
|
*/
|
|
35
37
|
defaultPixelPerfect?: boolean;
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
|
|
40
|
+
* The canonical InSitue widget. Use this for both prod (with
|
|
41
|
+
* `projectKey`) and dev (without). One mount, one component, the
|
|
42
|
+
* UI and theme adapt to the sink.
|
|
43
|
+
*/
|
|
44
|
+
declare function InSitueCapture({ projectKey, endpoint, onCapture, sink, defaultPixelPerfect, }: InSitueCaptureProps): null;
|
|
45
|
+
interface InSitueProps {
|
|
46
|
+
/**
|
|
47
|
+
* Companion loopback port (default 5747). Only meaningful when
|
|
48
|
+
* not also passing `projectKey` — when `projectKey` is set, the
|
|
49
|
+
* widget ships to the cloud sink and this is ignored.
|
|
50
|
+
*/
|
|
51
|
+
port?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `<InSitue />` — backward-compat dev alias.
|
|
55
|
+
*
|
|
56
|
+
* Equivalent to `<InSitueCapture sink={{ kind: "companion", port }} />`.
|
|
57
|
+
* Kept so existing `<InSitue />` mounts (callers that imported the
|
|
58
|
+
* pre-0.3.0 chat overlay) keep compiling. The behaviour is the
|
|
59
|
+
* unified widget, NOT the removed chat overlay — the in-overlay
|
|
60
|
+
* thread, diff display, and SESSION history are gone in 0.3.0.
|
|
61
|
+
*
|
|
62
|
+
* For new code, prefer `<InSitueCapture />`.
|
|
63
|
+
*/
|
|
64
|
+
declare function InSitue({ port }: InSitueProps): null;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* `@insitue/sdk` — the InSitue capture widget for browser apps.
|
|
42
68
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
69
|
+
* One component, two sinks. `<InSitueCapture />` is the canonical
|
|
70
|
+
* mount; `<InSitue />` is a backward-compat dev alias (companion
|
|
71
|
+
* sink). The chat-style overlay that existed pre-0.3.0 has been
|
|
72
|
+
* removed in favour of the unified widget.
|
|
45
73
|
*/
|
|
46
|
-
declare function InSitueCapture({ projectKey, endpoint, onCapture, defaultPixelPerfect, }: InSitueCaptureProps): null;
|
|
47
74
|
|
|
48
75
|
/** Build-time-inlined version of `@insitue/sdk` (from package.json).
|
|
49
76
|
* Exposed so the host app can self-verify which SDK build is loaded
|
|
@@ -51,4 +78,4 @@ declare function InSitueCapture({ projectKey, endpoint, onCapture, defaultPixelP
|
|
|
51
78
|
* the capture widget footer so a screenshot proves the build. */
|
|
52
79
|
declare const SDK_VERSION: string;
|
|
53
80
|
|
|
54
|
-
export { InSitue, InSitueCapture, type InSitueCaptureProps, type InSitueProps, SDK_VERSION };
|
|
81
|
+
export { CaptureSink, InSitue, InSitueCapture, type InSitueCaptureProps, type InSitueProps, SDK_VERSION };
|
package/dist/index.js
CHANGED
|
@@ -1,45 +1,47 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mountCaptureOnly
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
mountInSitue
|
|
6
|
-
} from "./chunk-VRINS2SK.js";
|
|
7
|
-
import "./chunk-62N4L6RA.js";
|
|
3
|
+
} from "./chunk-BCKDBCPG.js";
|
|
8
4
|
|
|
9
5
|
// src/InSitue.tsx
|
|
10
6
|
import { useEffect } from "react";
|
|
11
|
-
function
|
|
7
|
+
function InSitueCapture({
|
|
8
|
+
projectKey,
|
|
9
|
+
endpoint,
|
|
10
|
+
onCapture,
|
|
11
|
+
sink,
|
|
12
|
+
defaultPixelPerfect
|
|
13
|
+
}) {
|
|
12
14
|
useEffect(() => {
|
|
13
|
-
const nodeEnv = typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
|
|
14
|
-
if (nodeEnv === "production") return;
|
|
15
15
|
let active = true;
|
|
16
16
|
let dispose;
|
|
17
|
-
void import("./
|
|
18
|
-
if (active)
|
|
17
|
+
void import("./capture-only.js").then((m) => {
|
|
18
|
+
if (active) {
|
|
19
|
+
dispose = m.mountCaptureOnly({
|
|
20
|
+
...projectKey ? { projectKey } : {},
|
|
21
|
+
...endpoint ? { endpoint } : {},
|
|
22
|
+
...onCapture ? { onCapture } : {},
|
|
23
|
+
...sink ? { sink } : {},
|
|
24
|
+
...defaultPixelPerfect === true ? { defaultPixelPerfect } : {}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
19
27
|
});
|
|
20
28
|
return () => {
|
|
21
29
|
active = false;
|
|
22
30
|
dispose?.();
|
|
23
31
|
};
|
|
24
|
-
}, [
|
|
32
|
+
}, [projectKey, endpoint, onCapture, sink, defaultPixelPerfect]);
|
|
25
33
|
return null;
|
|
26
34
|
}
|
|
27
|
-
function
|
|
28
|
-
projectKey,
|
|
29
|
-
endpoint,
|
|
30
|
-
onCapture,
|
|
31
|
-
defaultPixelPerfect
|
|
32
|
-
}) {
|
|
35
|
+
function InSitue({ port }) {
|
|
33
36
|
useEffect(() => {
|
|
37
|
+
const nodeEnv = typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
|
|
38
|
+
if (nodeEnv === "production") return;
|
|
34
39
|
let active = true;
|
|
35
40
|
let dispose;
|
|
36
41
|
void import("./capture-only.js").then((m) => {
|
|
37
42
|
if (active) {
|
|
38
43
|
dispose = m.mountCaptureOnly({
|
|
39
|
-
|
|
40
|
-
endpoint,
|
|
41
|
-
onCapture,
|
|
42
|
-
defaultPixelPerfect
|
|
44
|
+
sink: port === void 0 ? { kind: "companion" } : { kind: "companion", port }
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
47
|
});
|
|
@@ -47,16 +49,15 @@ function InSitueCapture({
|
|
|
47
49
|
active = false;
|
|
48
50
|
dispose?.();
|
|
49
51
|
};
|
|
50
|
-
}, [
|
|
52
|
+
}, [port]);
|
|
51
53
|
return null;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
// src/index.ts
|
|
55
|
-
var SDK_VERSION = "0.
|
|
57
|
+
var SDK_VERSION = "0.3.1";
|
|
56
58
|
export {
|
|
57
59
|
InSitue,
|
|
58
60
|
InSitueCapture,
|
|
59
61
|
SDK_VERSION,
|
|
60
|
-
mountCaptureOnly
|
|
61
|
-
mountInSitue
|
|
62
|
+
mountCaptureOnly
|
|
62
63
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@insitue/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "InSitue capture SDK — drop one snippet into your deployed app; your users point at a bug, InSitue opens a verified pull request.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
"import": "./dist/index.js",
|
|
14
14
|
"default": "./dist/index.js"
|
|
15
15
|
},
|
|
16
|
-
"./overlay": {
|
|
17
|
-
"types": "./dist/overlay.d.ts",
|
|
18
|
-
"import": "./dist/overlay.js",
|
|
19
|
-
"default": "./dist/overlay.js"
|
|
20
|
-
},
|
|
21
16
|
"./capture-only": {
|
|
22
17
|
"types": "./dist/capture-only.d.ts",
|
|
23
18
|
"import": "./dist/capture-only.js",
|