@abbox/inspector 0.4.8 → 0.4.9
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/react/AbboxInspectorBoot.d.ts +11 -2
- package/dist/react/AbboxInspectorBoot.d.ts.map +1 -1
- package/dist/react/AbboxInspectorBoot.js +14 -4
- package/dist/runtime/bootstrap.d.ts +1 -0
- package/dist/runtime/bootstrap.d.ts.map +1 -1
- package/dist/runtime/bootstrap.js +10 -1
- package/package.json +4 -3
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export type AbboxInspectorBootProps = {
|
|
2
|
+
/** Search params from Next.js useSearchParams (for RSC environments).
|
|
3
|
+
* Required in Next.js 13+ RSC where window.location.search may be empty.
|
|
4
|
+
* Pass Object.fromEntries(useSearchParams()) from your layout.
|
|
5
|
+
*/
|
|
6
|
+
searchParams?: Record<string, string | string[]>;
|
|
7
|
+
};
|
|
8
|
+
/** Mount once in the root layout so the Viewer iframe can connect via `abboxSession`.
|
|
9
|
+
* In Next.js 13+ RSC, pass searchParams prop from useSearchParams() in your layout.
|
|
10
|
+
*/
|
|
11
|
+
export declare function AbboxInspectorBoot(props?: AbboxInspectorBootProps): null;
|
|
3
12
|
//# sourceMappingURL=AbboxInspectorBoot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbboxInspectorBoot.d.ts","sourceRoot":"","sources":["../../src/react/AbboxInspectorBoot.tsx"],"names":[],"mappings":"AAKA,
|
|
1
|
+
{"version":3,"file":"AbboxInspectorBoot.d.ts","sourceRoot":"","sources":["../../src/react/AbboxInspectorBoot.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;CAClD,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,uBAAuB,QAiBjE"}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import { bootstrapInspectorPreview } from "../runtime/bootstrap.js";
|
|
4
|
-
/** Mount once in the root layout so the Viewer iframe can connect via `abboxSession`.
|
|
5
|
-
|
|
4
|
+
/** Mount once in the root layout so the Viewer iframe can connect via `abboxSession`.
|
|
5
|
+
* In Next.js 13+ RSC, pass searchParams prop from useSearchParams() in your layout.
|
|
6
|
+
*/
|
|
7
|
+
export function AbboxInspectorBoot(props) {
|
|
6
8
|
useEffect(() => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
// Convert searchParams to URLSearchParams if provided
|
|
10
|
+
let searchParams;
|
|
11
|
+
if (props?.searchParams) {
|
|
12
|
+
searchParams = new URLSearchParams(Object.entries(props.searchParams).map(([k, v]) => [
|
|
13
|
+
k,
|
|
14
|
+
Array.isArray(v) ? v[0] : v,
|
|
15
|
+
]));
|
|
16
|
+
}
|
|
17
|
+
bootstrapInspectorPreview({ searchParams });
|
|
18
|
+
}, [props?.searchParams]);
|
|
9
19
|
return null;
|
|
10
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":"AAuCA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":"AAuCA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,YAAY,CAAC,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzD,CAAC;AA8CF;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,gBAAqB,GAC7B,IAAI,CAiDN;AAED,4CAA4C;AAC5C,wBAAgB,+BAA+B,IAAI,IAAI,CAMtD"}
|
|
@@ -72,7 +72,16 @@ export function bootstrapInspectorPreview(options = {}) {
|
|
|
72
72
|
if (!isAbboxInspectorRuntimeEnabled())
|
|
73
73
|
return;
|
|
74
74
|
const win = window;
|
|
75
|
-
|
|
75
|
+
// In Next.js 13+ RSC, window.location.search may be empty. Fallback to passed searchParams.
|
|
76
|
+
let params;
|
|
77
|
+
if (options.searchParams) {
|
|
78
|
+
params = options.searchParams instanceof URLSearchParams
|
|
79
|
+
? options.searchParams
|
|
80
|
+
: new URLSearchParams(options.searchParams);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
params = new URLSearchParams(win.location.search);
|
|
84
|
+
}
|
|
76
85
|
const sessionFromUrl = params.get("abboxSession");
|
|
77
86
|
const hostParam = params.get("abboxHostOrigin");
|
|
78
87
|
if (!sessionFromUrl) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abbox/inspector",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -82,12 +82,13 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@types/react": "^19.3.0",
|
|
86
|
-
"react": "^19.3.0",
|
|
87
85
|
"@biomejs/biome": "2.5.15",
|
|
88
86
|
"@types/babel__core": "^7.20.5",
|
|
89
87
|
"@types/node": "^22.20.5",
|
|
88
|
+
"@types/react": "^19.3.0",
|
|
90
89
|
"happy-dom": "^20.0.10",
|
|
90
|
+
"next": "^16.4.3",
|
|
91
|
+
"react": "^19.3.0",
|
|
91
92
|
"typescript": "^5.7.3",
|
|
92
93
|
"vitest": "^5.0.4"
|
|
93
94
|
}
|