@solhun/feedback-kit-web 0.2.1 → 0.2.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/dist/index.cjs +60 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +60 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -17,6 +17,44 @@ import {
|
|
|
17
17
|
} from "@solhun/feedback-kit-core";
|
|
18
18
|
|
|
19
19
|
// src/react-tree.ts
|
|
20
|
+
var FRAMEWORK_INTERNALS = /* @__PURE__ */ new Set([
|
|
21
|
+
// Next.js App Router
|
|
22
|
+
"AppRouter",
|
|
23
|
+
"InnerLayoutRouter",
|
|
24
|
+
"OuterLayoutRouter",
|
|
25
|
+
"LayoutRouterContext",
|
|
26
|
+
"RenderFromTemplateContext",
|
|
27
|
+
"TemplateContext",
|
|
28
|
+
"SegmentStateProvider",
|
|
29
|
+
"SegmentViewNode",
|
|
30
|
+
"ScrollAndMaybeFocusHandler",
|
|
31
|
+
"InnerScrollAndFocusHandler",
|
|
32
|
+
"InnerScrollAndFocusHandlerOld",
|
|
33
|
+
"RedirectBoundary",
|
|
34
|
+
"RedirectErrorBoundary",
|
|
35
|
+
"NotFoundBoundary",
|
|
36
|
+
"NotFoundErrorBoundary",
|
|
37
|
+
"HTTPAccessFallbackBoundary",
|
|
38
|
+
"HTTPAccessFallbackErrorBoundary",
|
|
39
|
+
"DevRootHTTPAccessFallbackBoundary",
|
|
40
|
+
"LoadingBoundary",
|
|
41
|
+
"ErrorBoundaryHandler",
|
|
42
|
+
"MetadataBoundary",
|
|
43
|
+
"ViewportBoundary",
|
|
44
|
+
"OutletBoundary",
|
|
45
|
+
// 개발 전용 오버레이 — 프로덕션엔 없지만 dev 제보에는 항상 낀다
|
|
46
|
+
"HotReload",
|
|
47
|
+
"AppDevOverlay",
|
|
48
|
+
"AppDevOverlayErrorBoundary",
|
|
49
|
+
"ReactDevOverlay",
|
|
50
|
+
"DevOverlay",
|
|
51
|
+
"Router",
|
|
52
|
+
"ServerRoot",
|
|
53
|
+
"RSCComponent"
|
|
54
|
+
]);
|
|
55
|
+
function isFrameworkName(name) {
|
|
56
|
+
return FRAMEWORK_INTERNALS.has(name) || name.startsWith("__next");
|
|
57
|
+
}
|
|
20
58
|
function componentName(type) {
|
|
21
59
|
if (typeof type === "function") {
|
|
22
60
|
const fn = type;
|
|
@@ -39,13 +77,15 @@ function fiberOf(node) {
|
|
|
39
77
|
}
|
|
40
78
|
return null;
|
|
41
79
|
}
|
|
42
|
-
function reactComponentPath(node, limit =
|
|
80
|
+
function reactComponentPath(node, limit = 5) {
|
|
43
81
|
try {
|
|
44
82
|
let fiber = fiberOf(node);
|
|
45
83
|
const names = [];
|
|
46
|
-
|
|
84
|
+
let depth = 0;
|
|
85
|
+
while (fiber && names.length < limit && depth < 200) {
|
|
86
|
+
depth += 1;
|
|
47
87
|
const name = componentName(fiber.elementType ?? fiber.type);
|
|
48
|
-
if (name && names[0] !== name) names.unshift(name);
|
|
88
|
+
if (name && !isFrameworkName(name) && names[0] !== name) names.unshift(name);
|
|
49
89
|
fiber = fiber.return ?? null;
|
|
50
90
|
}
|
|
51
91
|
return names;
|
|
@@ -887,6 +927,23 @@ function FeedbackKit(props) {
|
|
|
887
927
|
previousModalOpenRef.current = modal2.open;
|
|
888
928
|
previousConfirmVisibleRef.current = modal2.closeConfirmVisible;
|
|
889
929
|
}, [widgetState]);
|
|
930
|
+
useEffect(() => {
|
|
931
|
+
if (!kit || !widgetState) return;
|
|
932
|
+
const { screen: screen2, modal: modal2 } = widgetState;
|
|
933
|
+
if (screen2 !== "modal" && screen2 !== "pin") return;
|
|
934
|
+
const widget = kit.widget;
|
|
935
|
+
function onKeyDownCapture(event) {
|
|
936
|
+
if (event.key !== "Escape") return;
|
|
937
|
+
if (event.isComposing) return;
|
|
938
|
+
event.stopPropagation();
|
|
939
|
+
event.preventDefault();
|
|
940
|
+
if (screen2 === "pin") widget.cancelPin();
|
|
941
|
+
else if (modal2.closeConfirmVisible) widget.cancelCloseReport();
|
|
942
|
+
else widget.closeReport();
|
|
943
|
+
}
|
|
944
|
+
document.addEventListener("keydown", onKeyDownCapture, true);
|
|
945
|
+
return () => document.removeEventListener("keydown", onKeyDownCapture, true);
|
|
946
|
+
}, [kit, widgetState]);
|
|
890
947
|
if (!kit || !widgetState) {
|
|
891
948
|
return /* @__PURE__ */ jsx("div", { ...OWN_UI_PROPS, "data-feedback-kit-loading": "true" });
|
|
892
949
|
}
|