@stephenov/feedbackwidget 0.2.2 → 0.3.5
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/auto.d.mts +5 -0
- package/dist/auto.d.ts +5 -0
- package/dist/auto.js +1529 -0
- package/dist/auto.mjs +46 -0
- package/dist/chunk-QQLLK6MC.mjs +1457 -0
- package/dist/cli.js +86 -64
- package/dist/cli.mjs +86 -64
- package/dist/index.mjs +21 -1459
- package/package.json +8 -3
package/dist/auto.mjs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
FeedbackWidget
|
|
4
|
+
} from "./chunk-QQLLK6MC.mjs";
|
|
5
|
+
|
|
6
|
+
// src/auto.tsx
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
function AutoFeedbackWidget() {
|
|
10
|
+
const [mounted, setMounted] = useState(false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setMounted(true);
|
|
13
|
+
}, []);
|
|
14
|
+
const apiKey = typeof process !== "undefined" && (process.env?.NEXT_PUBLIC_FEEDBACKWIDGET_API_KEY || process.env?.VITE_FEEDBACKWIDGET_API_KEY || process.env?.REACT_APP_FEEDBACKWIDGET_API_KEY);
|
|
15
|
+
if (!mounted || !apiKey) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(FeedbackWidget, { apiKey });
|
|
19
|
+
}
|
|
20
|
+
if (typeof window !== "undefined") {
|
|
21
|
+
const init = () => {
|
|
22
|
+
const scriptTag = document.querySelector(
|
|
23
|
+
"script[data-feedbackwidget-key]"
|
|
24
|
+
);
|
|
25
|
+
const apiKey = window.FEEDBACKWIDGET_API_KEY || scriptTag?.dataset.feedbackwidgetKey;
|
|
26
|
+
if (apiKey) {
|
|
27
|
+
const container = document.createElement("div");
|
|
28
|
+
container.id = "feedbackwidget-auto";
|
|
29
|
+
document.body.appendChild(container);
|
|
30
|
+
import("react-dom/client").then(({ createRoot }) => {
|
|
31
|
+
const root = createRoot(container);
|
|
32
|
+
root.render(/* @__PURE__ */ jsx(FeedbackWidget, { apiKey }));
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
if (document.readyState === "loading") {
|
|
37
|
+
document.addEventListener("DOMContentLoaded", init);
|
|
38
|
+
} else {
|
|
39
|
+
init();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
var auto_default = AutoFeedbackWidget;
|
|
43
|
+
export {
|
|
44
|
+
AutoFeedbackWidget,
|
|
45
|
+
auto_default as default
|
|
46
|
+
};
|