@insitue/sdk 0.1.0
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/babel.d.ts +13 -0
- package/dist/babel.js +36 -0
- package/dist/capture-only.d.ts +26 -0
- package/dist/capture-only.js +7 -0
- package/dist/chunk-6SMY7D6U.js +1715 -0
- package/dist/chunk-BYR4ZXVS.js +300 -0
- package/dist/chunk-LGN4LKXD.js +973 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +52 -0
- package/dist/overlay.d.ts +6 -0
- package/dist/overlay.js +7 -0
- package/package.json +86 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IssueDraft, CaptureBundle } from '@insitue/capture-core';
|
|
2
|
+
export { InSitueOptions, mountInSitue } from './overlay.js';
|
|
3
|
+
export { CaptureOnlyOptions, mountCaptureOnly } from './capture-only.js';
|
|
4
|
+
|
|
5
|
+
interface InSitueProps {
|
|
6
|
+
/** Companion loopback port (default 5747). */
|
|
7
|
+
port?: number;
|
|
8
|
+
}
|
|
9
|
+
declare function InSitue({ port }: InSitueProps): null;
|
|
10
|
+
interface InSitueCaptureProps {
|
|
11
|
+
/**
|
|
12
|
+
* Publishable project key (e.g. `pk_…`). When set, captures POST
|
|
13
|
+
* to the InSitue cloud automatically. Origin-pinned + quota-gated
|
|
14
|
+
* server-side, so safe to ship in your production bundle.
|
|
15
|
+
*/
|
|
16
|
+
projectKey?: string;
|
|
17
|
+
/** Override the ingest endpoint (default = InSitue cloud). */
|
|
18
|
+
endpoint?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Take over delivery yourself. Wins over `projectKey`. Default
|
|
21
|
+
* (neither set): console + JSON download + `window.__insitu_capture__`.
|
|
22
|
+
*/
|
|
23
|
+
onCapture?: (draft: IssueDraft, bundle: CaptureBundle) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* `<InSitueCapture />` — the prod capture-only path. UNLIKE
|
|
27
|
+
* `<InSitue />` it does NOT bail in a production build: capture-only
|
|
28
|
+
* is exactly what prod runs (no companion to refuse). It never touches
|
|
29
|
+
* fs/agent/WS; the same bundle just flows to the configured sink.
|
|
30
|
+
*
|
|
31
|
+
* The simplest path: set `projectKey` and the SDK POSTs captures to
|
|
32
|
+
* the InSitue cloud automatically.
|
|
33
|
+
*/
|
|
34
|
+
declare function InSitueCapture({ projectKey, endpoint, onCapture, }: InSitueCaptureProps): null;
|
|
35
|
+
|
|
36
|
+
export { InSitue, InSitueCapture, type InSitueCaptureProps, type InSitueProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mountCaptureOnly
|
|
3
|
+
} from "./chunk-BYR4ZXVS.js";
|
|
4
|
+
import {
|
|
5
|
+
mountInSitue
|
|
6
|
+
} from "./chunk-LGN4LKXD.js";
|
|
7
|
+
import "./chunk-6SMY7D6U.js";
|
|
8
|
+
|
|
9
|
+
// src/InSitue.tsx
|
|
10
|
+
import { useEffect } from "react";
|
|
11
|
+
function InSitue({ port }) {
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const nodeEnv = typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
|
|
14
|
+
if (nodeEnv === "production") return;
|
|
15
|
+
let active = true;
|
|
16
|
+
let dispose;
|
|
17
|
+
void import("./overlay.js").then((m) => {
|
|
18
|
+
if (active) dispose = m.mountInSitue(port === void 0 ? {} : { port });
|
|
19
|
+
});
|
|
20
|
+
return () => {
|
|
21
|
+
active = false;
|
|
22
|
+
dispose?.();
|
|
23
|
+
};
|
|
24
|
+
}, [port]);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
function InSitueCapture({
|
|
28
|
+
projectKey,
|
|
29
|
+
endpoint,
|
|
30
|
+
onCapture
|
|
31
|
+
}) {
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
let active = true;
|
|
34
|
+
let dispose;
|
|
35
|
+
void import("./capture-only.js").then((m) => {
|
|
36
|
+
if (active) {
|
|
37
|
+
dispose = m.mountCaptureOnly({ projectKey, endpoint, onCapture });
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return () => {
|
|
41
|
+
active = false;
|
|
42
|
+
dispose?.();
|
|
43
|
+
};
|
|
44
|
+
}, [projectKey, endpoint, onCapture]);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
InSitue,
|
|
49
|
+
InSitueCapture,
|
|
50
|
+
mountCaptureOnly,
|
|
51
|
+
mountInSitue
|
|
52
|
+
};
|
package/dist/overlay.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@insitue/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./overlay": {
|
|
16
|
+
"types": "./dist/overlay.d.ts",
|
|
17
|
+
"import": "./dist/overlay.js"
|
|
18
|
+
},
|
|
19
|
+
"./capture-only": {
|
|
20
|
+
"types": "./dist/capture-only.d.ts",
|
|
21
|
+
"import": "./dist/capture-only.js"
|
|
22
|
+
},
|
|
23
|
+
"./babel": {
|
|
24
|
+
"types": "./dist/babel.d.ts",
|
|
25
|
+
"import": "./dist/babel.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsup",
|
|
36
|
+
"dev": "tsup --watch",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"lint": "tsc --noEmit",
|
|
39
|
+
"prepublishOnly": "pnpm build"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": ">=18"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"react": {
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"html-to-image": "^1.11.13",
|
|
51
|
+
"preact": "^10.25.1"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@insitue/capture-core": "workspace:*",
|
|
55
|
+
"@types/node": "^22.9.0",
|
|
56
|
+
"@types/react": "^19.0.0",
|
|
57
|
+
"react": "^19.0.0",
|
|
58
|
+
"tsup": "^8.3.5",
|
|
59
|
+
"typescript": "^5.6.3"
|
|
60
|
+
},
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "git+https://github.com/InSitue/insitue.git",
|
|
64
|
+
"directory": "packages/sdk"
|
|
65
|
+
},
|
|
66
|
+
"homepage": "https://www.insitue.com",
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/InSitue/insitue/issues"
|
|
69
|
+
},
|
|
70
|
+
"keywords": [
|
|
71
|
+
"insitue",
|
|
72
|
+
"bug-report",
|
|
73
|
+
"in-app",
|
|
74
|
+
"pull-request",
|
|
75
|
+
"autopilot",
|
|
76
|
+
"react",
|
|
77
|
+
"nextjs",
|
|
78
|
+
"ai",
|
|
79
|
+
"agent"
|
|
80
|
+
],
|
|
81
|
+
"author": "InSitue (https://www.insitue.com)",
|
|
82
|
+
"publishConfig": {
|
|
83
|
+
"access": "public",
|
|
84
|
+
"registry": "https://registry.npmjs.org/"
|
|
85
|
+
}
|
|
86
|
+
}
|