@genai-fi/base 4.3.1 → 4.3.2
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o, jsxs as S, Fragment as T } from "react/jsx-runtime";
|
|
2
2
|
import "../../state/webrtcState.js";
|
|
3
3
|
import { useState as r, useEffect as g } from "react";
|
|
4
4
|
import { useTranslation as w } from "react-i18next";
|
|
@@ -18,16 +18,16 @@ import "../IconMenu/context.js";
|
|
|
18
18
|
import "@emotion/react";
|
|
19
19
|
import I from "./FeedbackForm.js";
|
|
20
20
|
import { c as v } from "../../createSvgIcon-BM4dw4Lw.js";
|
|
21
|
-
const j = v(/* @__PURE__ */
|
|
21
|
+
const j = v(/* @__PURE__ */ o("path", {
|
|
22
22
|
d: "M12 6c0-.55-.45-1-1-1H5.82l.66-3.18.02-.23c0-.31-.13-.59-.33-.8L5.38 0 .44 4.94C.17 5.21 0 5.59 0 6v6.5c0 .83.67 1.5 1.5 1.5h6.75c.62 0 1.15-.38 1.38-.91l2.26-5.29c.07-.17.11-.36.11-.55zm10.5 4h-6.75c-.62 0-1.15.38-1.38.91l-2.26 5.29c-.07.17-.11.36-.11.55V18c0 .55.45 1 1 1h5.18l-.66 3.18-.02.24c0 .31.13.59.33.8l.79.78 4.94-4.94c.27-.27.44-.65.44-1.06v-6.5c0-.83-.67-1.5-1.5-1.5"
|
|
23
23
|
}), "ThumbsUpDown");
|
|
24
|
-
function R({ application: s, apiUrl:
|
|
24
|
+
function R({ application: s, apiUrl: t, delay: n, className: a, style: p, variant: u }) {
|
|
25
25
|
const { t: f } = w(), [l, c] = r(!1), [d, h] = r(""), [b, m] = r(!1), i = localStorage.getItem("feedbackSubmitted") === "true";
|
|
26
26
|
return g(() => {
|
|
27
27
|
if (!i) {
|
|
28
28
|
const k = setTimeout(
|
|
29
29
|
() => {
|
|
30
|
-
|
|
30
|
+
t && fetch(`${t}`).then((e) => e.json()).then((e) => {
|
|
31
31
|
h(e.token), c(!0);
|
|
32
32
|
}).catch(() => {
|
|
33
33
|
console.warn("Feedback denied");
|
|
@@ -37,22 +37,23 @@ function R({ application: s, apiUrl: o, delay: n, className: a, style: p, varian
|
|
|
37
37
|
);
|
|
38
38
|
return () => clearTimeout(k);
|
|
39
39
|
}
|
|
40
|
-
}, [i, n,
|
|
41
|
-
l && /* @__PURE__ */
|
|
40
|
+
}, [i, n, t]), /* @__PURE__ */ S(T, { children: [
|
|
41
|
+
l && /* @__PURE__ */ o(
|
|
42
42
|
F,
|
|
43
43
|
{
|
|
44
44
|
variant: u ?? "contained",
|
|
45
45
|
onClick: () => m(!0),
|
|
46
46
|
className: a,
|
|
47
47
|
style: p,
|
|
48
|
-
startIcon: /* @__PURE__ */
|
|
48
|
+
startIcon: /* @__PURE__ */ o(j, {}),
|
|
49
49
|
children: f("feedback.button")
|
|
50
50
|
}
|
|
51
51
|
),
|
|
52
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ o(
|
|
53
53
|
I,
|
|
54
54
|
{
|
|
55
55
|
open: b,
|
|
56
|
+
apiUrl: t,
|
|
56
57
|
onClose: () => m(!1),
|
|
57
58
|
onDone: () => {
|
|
58
59
|
localStorage.setItem("feedbackSubmitted", "true"), c(!1);
|
|
@@ -2,8 +2,9 @@ interface Props {
|
|
|
2
2
|
token: string;
|
|
3
3
|
application: string;
|
|
4
4
|
open?: boolean;
|
|
5
|
+
apiUrl: string;
|
|
5
6
|
onClose?: () => void;
|
|
6
7
|
onDone?: () => void;
|
|
7
8
|
}
|
|
8
|
-
export default function FeedbackForm({ application, open, onClose, token, onDone }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default function FeedbackForm({ application, open, onClose, token, onDone, apiUrl }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -1,88 +1,107 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Dialog as
|
|
3
|
-
import { s as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { Button as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { useTranslation as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
return !(
|
|
1
|
+
import { jsxs as r, Fragment as F, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as S, DialogContent as Y, DialogActions as _ } from "@mui/material";
|
|
3
|
+
import { s as h } from "../../Feedback.module-C2gI6YmB.js";
|
|
4
|
+
import { useState as o, useRef as A, useEffect as B } from "react";
|
|
5
|
+
import { Button as T } from "../Button/Button.js";
|
|
6
|
+
import D from "./Rating.js";
|
|
7
|
+
import O from "./Recommend.js";
|
|
8
|
+
import I from "./Experience.js";
|
|
9
|
+
import { useTranslation as M } from "react-i18next";
|
|
10
|
+
const y = "https://store.gen-ai.fi/common/thank_you_graphic.jpg";
|
|
11
|
+
function P(a, t, s) {
|
|
12
|
+
return !(a <= 0 || a > 5 || t <= 0 || t > 5 || s.length > 1e3);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const { t } =
|
|
16
|
-
|
|
17
|
-
if (!
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
}, [
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
function Q({ application: a, open: t, onClose: s, token: E, onDone: g, apiUrl: p }) {
|
|
15
|
+
const { t: n } = M(), [l, k] = o(0), [f, b] = o(0), [d, x] = o(""), [i, C] = o(!1), [c, m] = o(!1), v = A(!1);
|
|
16
|
+
B(() => {
|
|
17
|
+
if (!t || v.current) return;
|
|
18
|
+
const u = new Image();
|
|
19
|
+
u.src = y, v.current = !0;
|
|
20
|
+
}, [t]);
|
|
21
|
+
const N = P(l, f, d), j = () => {
|
|
22
|
+
p && fetch(`${p}`, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: {
|
|
25
|
+
"Content-Type": "application/json"
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify({
|
|
28
|
+
token: E,
|
|
29
|
+
application: a,
|
|
30
|
+
rating: l,
|
|
31
|
+
recommend: f,
|
|
32
|
+
describe: d,
|
|
33
|
+
valuableFeature: "",
|
|
34
|
+
suggestions: ""
|
|
35
|
+
})
|
|
36
|
+
}).then((u) => {
|
|
37
|
+
u.ok ? (C(!0), g && g()) : m(!0);
|
|
38
|
+
}).catch(() => {
|
|
39
|
+
m(!0);
|
|
40
|
+
});
|
|
41
|
+
}, R = () => {
|
|
42
|
+
s && s(), setTimeout(() => {
|
|
43
|
+
C(!1), m(!1), k(0), b(0), x("");
|
|
25
44
|
}, 500);
|
|
26
45
|
};
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
|
|
46
|
+
return /* @__PURE__ */ r(
|
|
47
|
+
S,
|
|
29
48
|
{
|
|
30
|
-
open:
|
|
31
|
-
onClose:
|
|
49
|
+
open: t ?? !1,
|
|
50
|
+
onClose: R,
|
|
32
51
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
!i && !
|
|
35
|
-
/* @__PURE__ */ e("h1", { children:
|
|
52
|
+
/* @__PURE__ */ r(Y, { className: h.feedback, children: [
|
|
53
|
+
!i && !c && /* @__PURE__ */ r(F, { children: [
|
|
54
|
+
/* @__PURE__ */ e("h1", { children: n("feedback.title") }),
|
|
36
55
|
/* @__PURE__ */ e(
|
|
37
|
-
|
|
56
|
+
D,
|
|
38
57
|
{
|
|
39
|
-
rating:
|
|
40
|
-
onChange:
|
|
58
|
+
rating: l,
|
|
59
|
+
onChange: k
|
|
41
60
|
}
|
|
42
61
|
),
|
|
43
62
|
/* @__PURE__ */ e(
|
|
44
|
-
|
|
63
|
+
O,
|
|
45
64
|
{
|
|
46
|
-
rating:
|
|
47
|
-
onChange:
|
|
65
|
+
rating: f,
|
|
66
|
+
onChange: b
|
|
48
67
|
}
|
|
49
68
|
),
|
|
50
69
|
/* @__PURE__ */ e(
|
|
51
|
-
|
|
70
|
+
I,
|
|
52
71
|
{
|
|
53
|
-
experience:
|
|
54
|
-
onChange:
|
|
72
|
+
experience: d,
|
|
73
|
+
onChange: x
|
|
55
74
|
}
|
|
56
75
|
)
|
|
57
76
|
] }),
|
|
58
|
-
i && /* @__PURE__ */ e("div", { className:
|
|
77
|
+
i && /* @__PURE__ */ e("div", { className: h.thankYouBox, children: /* @__PURE__ */ e(
|
|
59
78
|
"img",
|
|
60
79
|
{
|
|
61
|
-
src:
|
|
62
|
-
alt:
|
|
80
|
+
src: y,
|
|
81
|
+
alt: n("feedback.thankYou")
|
|
63
82
|
}
|
|
64
83
|
) }),
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */ e("h1", { children:
|
|
67
|
-
/* @__PURE__ */ e("p", { children:
|
|
84
|
+
c && /* @__PURE__ */ r("div", { className: h.messageBox, children: [
|
|
85
|
+
/* @__PURE__ */ e("h1", { children: n("feedback.error") }),
|
|
86
|
+
/* @__PURE__ */ e("p", { children: n("feedback.errorMessage") })
|
|
68
87
|
] })
|
|
69
88
|
] }),
|
|
70
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ r(_, { children: [
|
|
71
90
|
/* @__PURE__ */ e(
|
|
72
|
-
|
|
91
|
+
T,
|
|
73
92
|
{
|
|
74
|
-
variant: !i && !
|
|
75
|
-
onClick:
|
|
76
|
-
children:
|
|
93
|
+
variant: !i && !c ? "outlined" : "contained",
|
|
94
|
+
onClick: R,
|
|
95
|
+
children: n("feedback.close")
|
|
77
96
|
}
|
|
78
97
|
),
|
|
79
|
-
!i && !
|
|
80
|
-
|
|
98
|
+
!i && !c && /* @__PURE__ */ e(
|
|
99
|
+
T,
|
|
81
100
|
{
|
|
82
101
|
variant: "contained",
|
|
83
|
-
onClick:
|
|
84
|
-
disabled: !
|
|
85
|
-
children:
|
|
102
|
+
onClick: j,
|
|
103
|
+
disabled: !N,
|
|
104
|
+
children: n("feedback.send")
|
|
86
105
|
}
|
|
87
106
|
)
|
|
88
107
|
] })
|
|
@@ -91,5 +110,5 @@ function L({ application: c, open: n, onClose: a, token: S, onDone: w }) {
|
|
|
91
110
|
);
|
|
92
111
|
}
|
|
93
112
|
export {
|
|
94
|
-
|
|
113
|
+
Q as default
|
|
95
114
|
};
|