@genai-fi/base 4.3.0 → 4.3.1

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,10 +1,11 @@
1
1
  import { CSSProperties } from 'react';
2
2
  interface Props {
3
3
  application: string;
4
+ apiUrl: string;
4
5
  delay?: number;
5
6
  className?: string;
6
7
  style?: CSSProperties;
7
8
  variant?: 'contained' | 'outlined' | 'text';
8
9
  }
9
- export default function Feedback({ application, delay, className, style, variant }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export default function Feedback({ application, apiUrl, delay, className, style, variant }: Props): import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -1,9 +1,9 @@
1
- import { jsx as t, jsxs as b, Fragment as h } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as S, Fragment as T } from "react/jsx-runtime";
2
2
  import "../../state/webrtcState.js";
3
- import { useState as o, useEffect as k } from "react";
4
- import { useTranslation as S } from "react-i18next";
3
+ import { useState as r, useEffect as g } from "react";
4
+ import { useTranslation as w } from "react-i18next";
5
5
  import "../../hooks/peer.js";
6
- import { Button as T } from "../Button/Button.js";
6
+ import { Button as F } from "../Button/Button.js";
7
7
  import "../../index-SOhdqzHq.js";
8
8
  import "../../style/theme.js";
9
9
  import "../../util/canvas.js";
@@ -16,48 +16,53 @@ import "../WorkflowLayout/svgContext.js";
16
16
  import "../WorkflowLayout/Widget.js";
17
17
  import "../IconMenu/context.js";
18
18
  import "@emotion/react";
19
- import g from "./FeedbackForm.js";
20
- import { c as I } from "../../createSvgIcon-BM4dw4Lw.js";
21
- const v = I(/* @__PURE__ */ t("path", {
19
+ import I from "./FeedbackForm.js";
20
+ import { c as v } from "../../createSvgIcon-BM4dw4Lw.js";
21
+ const j = v(/* @__PURE__ */ t("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 P({ application: c, delay: e, className: n, style: i, variant: s }) {
25
- const { t: a } = S(), [p, u] = o(!1), [l, w] = o(""), [f, r] = o(!1), m = localStorage.getItem("feedbackSubmitted") === "true";
26
- return k(() => {
27
- if (!m) {
28
- const d = setTimeout(
24
+ function R({ application: s, apiUrl: o, delay: n, className: a, style: p, variant: u }) {
25
+ const { t: f } = w(), [l, c] = r(!1), [d, h] = r(""), [b, m] = r(!1), i = localStorage.getItem("feedbackSubmitted") === "true";
26
+ return g(() => {
27
+ if (!i) {
28
+ const k = setTimeout(
29
29
  () => {
30
+ o && fetch(`${o}`).then((e) => e.json()).then((e) => {
31
+ h(e.token), c(!0);
32
+ }).catch(() => {
33
+ console.warn("Feedback denied");
34
+ });
30
35
  },
31
- e ?? 3e5
36
+ n ?? 3e5
32
37
  );
33
- return () => clearTimeout(d);
38
+ return () => clearTimeout(k);
34
39
  }
35
- }, [m, e]), /* @__PURE__ */ b(h, { children: [
36
- p && /* @__PURE__ */ t(
37
- T,
40
+ }, [i, n, o]), /* @__PURE__ */ S(T, { children: [
41
+ l && /* @__PURE__ */ t(
42
+ F,
38
43
  {
39
- variant: s ?? "contained",
40
- onClick: () => r(!0),
41
- className: n,
42
- style: i,
43
- startIcon: /* @__PURE__ */ t(v, {}),
44
- children: a("feedback.button")
44
+ variant: u ?? "contained",
45
+ onClick: () => m(!0),
46
+ className: a,
47
+ style: p,
48
+ startIcon: /* @__PURE__ */ t(j, {}),
49
+ children: f("feedback.button")
45
50
  }
46
51
  ),
47
52
  /* @__PURE__ */ t(
48
- g,
53
+ I,
49
54
  {
50
- open: f,
51
- onClose: () => r(!1),
55
+ open: b,
56
+ onClose: () => m(!1),
52
57
  onDone: () => {
53
- localStorage.setItem("feedbackSubmitted", "true"), u(!1);
58
+ localStorage.setItem("feedbackSubmitted", "true"), c(!1);
54
59
  },
55
- token: l,
56
- application: c
60
+ token: d,
61
+ application: s
57
62
  }
58
63
  )
59
64
  ] });
60
65
  }
61
66
  export {
62
- P as default
67
+ R as default
63
68
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genai-fi/base",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",