@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.cjs
CHANGED
|
@@ -74,6 +74,44 @@ var import_feedback_kit_core5 = require("@solhun/feedback-kit-core");
|
|
|
74
74
|
var import_feedback_kit_core6 = require("@solhun/feedback-kit-core");
|
|
75
75
|
|
|
76
76
|
// src/react-tree.ts
|
|
77
|
+
var FRAMEWORK_INTERNALS = /* @__PURE__ */ new Set([
|
|
78
|
+
// Next.js App Router
|
|
79
|
+
"AppRouter",
|
|
80
|
+
"InnerLayoutRouter",
|
|
81
|
+
"OuterLayoutRouter",
|
|
82
|
+
"LayoutRouterContext",
|
|
83
|
+
"RenderFromTemplateContext",
|
|
84
|
+
"TemplateContext",
|
|
85
|
+
"SegmentStateProvider",
|
|
86
|
+
"SegmentViewNode",
|
|
87
|
+
"ScrollAndMaybeFocusHandler",
|
|
88
|
+
"InnerScrollAndFocusHandler",
|
|
89
|
+
"InnerScrollAndFocusHandlerOld",
|
|
90
|
+
"RedirectBoundary",
|
|
91
|
+
"RedirectErrorBoundary",
|
|
92
|
+
"NotFoundBoundary",
|
|
93
|
+
"NotFoundErrorBoundary",
|
|
94
|
+
"HTTPAccessFallbackBoundary",
|
|
95
|
+
"HTTPAccessFallbackErrorBoundary",
|
|
96
|
+
"DevRootHTTPAccessFallbackBoundary",
|
|
97
|
+
"LoadingBoundary",
|
|
98
|
+
"ErrorBoundaryHandler",
|
|
99
|
+
"MetadataBoundary",
|
|
100
|
+
"ViewportBoundary",
|
|
101
|
+
"OutletBoundary",
|
|
102
|
+
// 개발 전용 오버레이 — 프로덕션엔 없지만 dev 제보에는 항상 낀다
|
|
103
|
+
"HotReload",
|
|
104
|
+
"AppDevOverlay",
|
|
105
|
+
"AppDevOverlayErrorBoundary",
|
|
106
|
+
"ReactDevOverlay",
|
|
107
|
+
"DevOverlay",
|
|
108
|
+
"Router",
|
|
109
|
+
"ServerRoot",
|
|
110
|
+
"RSCComponent"
|
|
111
|
+
]);
|
|
112
|
+
function isFrameworkName(name) {
|
|
113
|
+
return FRAMEWORK_INTERNALS.has(name) || name.startsWith("__next");
|
|
114
|
+
}
|
|
77
115
|
function componentName(type) {
|
|
78
116
|
if (typeof type === "function") {
|
|
79
117
|
const fn = type;
|
|
@@ -96,13 +134,15 @@ function fiberOf(node) {
|
|
|
96
134
|
}
|
|
97
135
|
return null;
|
|
98
136
|
}
|
|
99
|
-
function reactComponentPath(node, limit =
|
|
137
|
+
function reactComponentPath(node, limit = 5) {
|
|
100
138
|
try {
|
|
101
139
|
let fiber = fiberOf(node);
|
|
102
140
|
const names = [];
|
|
103
|
-
|
|
141
|
+
let depth = 0;
|
|
142
|
+
while (fiber && names.length < limit && depth < 200) {
|
|
143
|
+
depth += 1;
|
|
104
144
|
const name = componentName(fiber.elementType ?? fiber.type);
|
|
105
|
-
if (name && names[0] !== name) names.unshift(name);
|
|
145
|
+
if (name && !isFrameworkName(name) && names[0] !== name) names.unshift(name);
|
|
106
146
|
fiber = fiber.return ?? null;
|
|
107
147
|
}
|
|
108
148
|
return names;
|
|
@@ -928,6 +968,23 @@ function FeedbackKit(props) {
|
|
|
928
968
|
previousModalOpenRef.current = modal2.open;
|
|
929
969
|
previousConfirmVisibleRef.current = modal2.closeConfirmVisible;
|
|
930
970
|
}, [widgetState]);
|
|
971
|
+
(0, import_react.useEffect)(() => {
|
|
972
|
+
if (!kit || !widgetState) return;
|
|
973
|
+
const { screen: screen2, modal: modal2 } = widgetState;
|
|
974
|
+
if (screen2 !== "modal" && screen2 !== "pin") return;
|
|
975
|
+
const widget = kit.widget;
|
|
976
|
+
function onKeyDownCapture(event) {
|
|
977
|
+
if (event.key !== "Escape") return;
|
|
978
|
+
if (event.isComposing) return;
|
|
979
|
+
event.stopPropagation();
|
|
980
|
+
event.preventDefault();
|
|
981
|
+
if (screen2 === "pin") widget.cancelPin();
|
|
982
|
+
else if (modal2.closeConfirmVisible) widget.cancelCloseReport();
|
|
983
|
+
else widget.closeReport();
|
|
984
|
+
}
|
|
985
|
+
document.addEventListener("keydown", onKeyDownCapture, true);
|
|
986
|
+
return () => document.removeEventListener("keydown", onKeyDownCapture, true);
|
|
987
|
+
}, [kit, widgetState]);
|
|
931
988
|
if (!kit || !widgetState) {
|
|
932
989
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...OWN_UI_PROPS, "data-feedback-kit-loading": "true" });
|
|
933
990
|
}
|