@logora/debate 0.3.32 → 0.3.33

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,88 +1,65 @@
1
- import { jsxs as S, jsx as s } from "react/jsx-runtime";
2
- import { useState as w, useEffect as b } from "react";
3
- import { useIntl as j } from "react-intl";
4
- import l from "./Summary.module.scss.js";
5
- import { SectionBox as B } from "../../section/section_box/SectionBox.js";
6
- import { BoxSkeleton as f } from "../../skeleton/box_skeleton/BoxSkeleton.js";
7
- import { SummaryBox as h } from "../summary_box/SummaryBox.js";
8
- const k = ({
9
- apiUrl: d,
10
- summaryId: a,
11
- tags: t = [],
12
- tagClassNames: p = [],
13
- title: y,
14
- subtitle: g
1
+ import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
+ import "react";
3
+ import { useIntl as y } from "react-intl";
4
+ import u from "./Summary.module.scss.js";
5
+ import { SectionBox as h } from "../../section/section_box/SectionBox.js";
6
+ import { SummaryBox as n } from "../summary_box/SummaryBox.js";
7
+ const v = ({
8
+ summary: r,
9
+ tags: o = [],
10
+ tagClassNames: l = [],
11
+ title: c,
12
+ subtitle: d
15
13
  }) => {
16
- const [n, x] = w({}), i = j(), u = async (e, r = "") => {
14
+ const s = y(), f = () => {
15
+ if (!r) return {};
16
+ if (typeof r == "object") return r;
17
17
  try {
18
- const o = `${d}/${e}${r ? `-${r}` : ""}`, m = await fetch(o);
19
- if (!m.ok)
20
- throw new Error(`HTTP error! Status: ${m.status}`);
21
- return (await m.json()).data?.content?.arguments || [];
22
- } catch (o) {
23
- console.error(o);
18
+ return JSON.parse(r);
19
+ } catch {
20
+ return { global: r };
24
21
  }
25
- };
26
- return b(() => {
27
- (async () => {
28
- try {
29
- const r = {};
30
- if (t.length === 0)
31
- r["no-position"] = await u(a);
32
- else {
33
- const o = await Promise.all(
34
- t.map((m) => u(a, m.id))
35
- );
36
- t.forEach((m, c) => {
37
- r[m.id] = o[c];
38
- });
39
- }
40
- x(r);
41
- } catch (r) {
42
- console.error(r);
43
- }
44
- })();
45
- }, [a, t]), /* @__PURE__ */ S(
46
- B,
22
+ }, i = (e) => e ? e.split(`
23
+ `).map((a) => a.trim()).filter(Boolean) : [], m = f();
24
+ return /* @__PURE__ */ p(
25
+ h,
47
26
  {
48
27
  isCollapsible: !0,
49
28
  isCollapsedByDefault: !0,
50
- title: y,
51
- subtitle: g,
29
+ title: c,
30
+ subtitle: d,
52
31
  children: [
53
- /* @__PURE__ */ s("div", { className: l.description, children: i.formatMessage({
32
+ /* @__PURE__ */ t("div", { className: u.description, children: s.formatMessage({
54
33
  id: "summary.description.argument_summary",
55
34
  defaultMessage: "Our algorithm produces comprehensive, well-structured summaries of the most recurrent arguments. Each published argument influences the content of this summary. The better structured the argument, the more weight it carries."
56
35
  }) }),
57
- /* @__PURE__ */ s("div", { className: l.summaryContainer, children: Object.keys(n).length === 0 ? t.length === 0 ? /* @__PURE__ */ s(f, { onlyEdgeBox: !0, boxHeight: 120 }) : t.map((e) => /* @__PURE__ */ s(f, { onlyEdgeBox: !0, boxHeight: 120 }, e.id)) : t.length === 0 ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s(
58
- h,
36
+ /* @__PURE__ */ t("div", { className: u.summaryContainer, children: o.length > 0 ? o.map((e, a) => /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
37
+ n,
59
38
  {
60
- summaryItems: (n["no-position"] || []).map(
61
- (e) => e.argument
62
- ),
63
- emptySummaryText: i.formatMessage({
39
+ summaryItems: i(m[e.id]),
40
+ tag: e.name,
41
+ tagClassName: l[a],
42
+ emptySummaryText: s.formatMessage({
64
43
  id: "info.emptysummary",
65
44
  defaultMessage: "No resume found."
66
45
  })
67
46
  }
68
- ) }) : t.map((e, r) => /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s(
69
- h,
47
+ ) }, e.id)) : /* @__PURE__ */ t(
48
+ n,
70
49
  {
71
- summaryItems: (n[e.id] || []).map(
72
- (o) => o.argument
50
+ summaryItems: i(
51
+ m.global || m.untagged || Object.values(m)[0]
73
52
  ),
74
- tag: e.name,
75
- tagClassName: p[r],
76
- emptySummaryText: i.formatMessage({
53
+ emptySummaryText: s.formatMessage({
77
54
  id: "info.emptysummary",
78
55
  defaultMessage: "No resume found."
79
56
  })
80
57
  }
81
- ) }, e.id)) })
58
+ ) })
82
59
  ]
83
60
  }
84
61
  );
85
62
  };
86
63
  export {
87
- k as Summary
64
+ v as Summary
88
65
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.32",
3
+ "version": "0.3.33",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",