@logora/debate 0.3.61 → 0.3.62

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,6 +1,6 @@
1
- import { jsx as o, jsxs as l, Fragment as y } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as l, Fragment as h } from "react/jsx-runtime";
2
2
  import B from "classnames";
3
- import { useState as _, useEffect as ae, useCallback as le, Suspense as ne, lazy as de } from "react";
3
+ import { useState as f, useEffect as ae, useCallback as le, Suspense as ne, lazy as de } from "react";
4
4
  import { useIntl as ce } from "react-intl";
5
5
  import s from "./Argument.module.scss.js";
6
6
  import { ReplyFooter as pe } from "./ReplyFooter.js";
@@ -22,18 +22,18 @@ import { Button as Se } from "../../action/button/Button.js";
22
22
  const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({ default: e.ArgumentInput }))), P = (e) => e?.replace(/ /g, " "), Te = ({
23
23
  argument: e,
24
24
  argumentReplies: n,
25
- nestingLevel: g = 0,
26
- maxNestingLevel: S = 2,
27
- groupType: R,
28
- groupName: T,
29
- positions: b = [],
25
+ nestingLevel: y = 0,
26
+ maxNestingLevel: C = 2,
27
+ groupType: S,
28
+ groupName: R,
29
+ positions: _ = [],
30
30
  disableLinks: F = !1,
31
- parentArgument: c,
31
+ parentArgument: d,
32
32
  flashParent: j,
33
33
  expandable: G,
34
- disabled: M = !1,
35
- hideFooter: N = !1,
36
- hideReplies: w,
34
+ disabled: g = !1,
35
+ hideFooter: T = !1,
36
+ hideReplies: N,
37
37
  vote: H,
38
38
  fixedContentHeight: V = !1,
39
39
  enableEdition: z = !0,
@@ -44,7 +44,7 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
44
44
  replyRedirectUrl: K,
45
45
  hideContent: Q = !1
46
46
  }) => {
47
- const i = ce(), { isLoggedIn: W, currentUser: p } = ue(), A = p?.moderation_status === "banned", r = he(), [m, v] = _(!1), [X, x] = _(!1), [Z, ee] = _(!1), L = me(e), [u, h] = _(), f = D(
47
+ const i = ce(), { isLoggedIn: W, currentUser: c } = ue(), w = c?.moderation_status === "banned", r = he(), [p, b] = f(!1), [X, A] = f(!1), [Z, ee] = f(!1), x = me(e), [m, M] = f(), u = D(
48
48
  e.content,
49
49
  e.language,
50
50
  "content",
@@ -54,21 +54,21 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
54
54
  e.position?.language,
55
55
  "name",
56
56
  e.position?.translation_entries
57
- ), I = `argument_${e.id}`, C = e.position && b?.map((t) => t.id).indexOf(e.position.id) + 1;
57
+ ), v = `argument_${e.id}`, I = e.position && _?.map((t) => t.id).indexOf(e.position.id) + 1;
58
58
  ae(() => {
59
59
  n !== void 0 && ie();
60
60
  }, [n]);
61
61
  const oe = (t) => {
62
- if (I === t) {
63
- const d = document.getElementById(t);
64
- d && d.scrollIntoView({ behavior: "smooth" }), x(!0);
62
+ if (v === t) {
63
+ const $ = document.getElementById(t);
64
+ $ && $.scrollIntoView({ behavior: "smooth" }), A(!0);
65
65
  }
66
- }, U = () => {
66
+ }, L = () => {
67
67
  ee((t) => !t);
68
68
  }, k = () => {
69
- v((t) => !t), h([]);
69
+ b((t) => !t), M([]);
70
70
  }, se = (t) => {
71
- if (!u?.find((a) => a.id === t.id))
71
+ if (!m?.find((a) => a.id === t.id))
72
72
  return t;
73
73
  }, re = le((t, a) => /* @__PURE__ */ o(
74
74
  fe,
@@ -84,24 +84,24 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
84
84
  const t = n.filter(
85
85
  (a) => a.reply_to_id === e.id
86
86
  );
87
- t.length > 0 && (h(t), v(!0));
87
+ t.length > 0 && (M(t), b(!0));
88
88
  }
89
- }, $ = (t = null) => /* @__PURE__ */ o(
89
+ }, U = (t = null) => /* @__PURE__ */ o(
90
90
  Ne,
91
91
  {
92
92
  ...t ? { argument: t } : {},
93
- nestingLevel: g + 1,
94
- maxNestingLevel: S,
95
- disabled: M,
96
- groupName: T,
97
- groupType: R,
98
- positions: b,
93
+ nestingLevel: y + 1,
94
+ maxNestingLevel: C,
95
+ disabled: g,
96
+ groupName: R,
97
+ groupType: S,
98
+ positions: _,
99
99
  argumentReplies: n,
100
100
  parentArgument: e,
101
101
  flashParent: (a) => oe(`argument_${a}`)
102
102
  }
103
103
  );
104
- return /* @__PURE__ */ l(ye, { elementId: I, onScroll: () => x(!0), children: [
104
+ return /* @__PURE__ */ l(ye, { elementId: v, onScroll: () => A(!0), children: [
105
105
  /* @__PURE__ */ l(
106
106
  "div",
107
107
  {
@@ -111,10 +111,10 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
111
111
  [s.flash]: X,
112
112
  [s.argumentReply]: e.is_reply === !0
113
113
  },
114
- s[`level-${g}`],
115
- s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") && C}`]
114
+ s[`level-${y}`],
115
+ s[`position-${!(e.author.role === "editor" || e.author.role === "moderator") && I}`]
116
116
  ),
117
- id: I,
117
+ id: v,
118
118
  children: [
119
119
  /* @__PURE__ */ o(
120
120
  _e,
@@ -123,7 +123,7 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
123
123
  author: e.author,
124
124
  tag: (e.author.role === "editor" || e.author.role === "moderator") && e.is_reply ? null : te.translatedContent,
125
125
  date: e.created_at,
126
- tagClassName: s[`headerPosition-${C}`],
126
+ tagClassName: s[`headerPosition-${I}`],
127
127
  disableLinks: F,
128
128
  isDeleted: e.is_deleted,
129
129
  showModerationFeedback: q ?? (e.status === "rejected" && r.moderation?.showFeedback === !0),
@@ -138,7 +138,7 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
138
138
  }) }) : Q ? /* @__PURE__ */ o("div", { className: s.argumentDeletedBody, children: i.formatMessage({
139
139
  id: "argument.argument.content_deleted",
140
140
  defaultMessage: "This content has been removed."
141
- }) }) : /* @__PURE__ */ l(y, { children: [
141
+ }) }) : /* @__PURE__ */ l(h, { children: [
142
142
  /* @__PURE__ */ l(
143
143
  "div",
144
144
  {
@@ -146,21 +146,21 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
146
146
  [s.fixedHeight]: r?.layout?.showAllArgumentInEmbed !== !0 ? V : !1
147
147
  }),
148
148
  children: [
149
- e.is_reply && c && /* @__PURE__ */ l(
149
+ e.is_reply && d && /* @__PURE__ */ l(
150
150
  "div",
151
151
  {
152
152
  className: s.replyTo,
153
- onClick: () => j(c.id),
153
+ onClick: () => j(d.id),
154
154
  children: [
155
155
  i.formatMessage({
156
156
  id: "info.replying_to",
157
157
  defaultMessage: "Replying to"
158
158
  }),
159
159
  /* @__PURE__ */ l("span", { className: s.replyingTo, children: [
160
- c.is_deleted ? i.formatMessage({
160
+ d.is_deleted ? i.formatMessage({
161
161
  id: "info.deleted",
162
162
  defaultMessage: "Deleted"
163
- }) : c.author.full_name,
163
+ }) : d.author.full_name,
164
164
  /* @__PURE__ */ o(E, { name: "chat", height: 16 })
165
165
  ] })
166
166
  ]
@@ -169,23 +169,23 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
169
169
  /* @__PURE__ */ o(
170
170
  ge,
171
171
  {
172
- content: /* @__PURE__ */ l(y, { children: [
172
+ content: /* @__PURE__ */ l(h, { children: [
173
173
  e.is_edited && /* @__PURE__ */ o("div", { className: s.edited, children: i.formatMessage({
174
174
  id: "argument.argument.updated",
175
175
  defaultMessage: "Updated argument"
176
176
  }) }),
177
- L && !f.isTranslated ? /* @__PURE__ */ o(
177
+ x && !u.isTranslated ? /* @__PURE__ */ o(
178
178
  "div",
179
179
  {
180
180
  className: s.argumentContent,
181
- dangerouslySetInnerHTML: { __html: P(L) }
181
+ dangerouslySetInnerHTML: { __html: P(x) }
182
182
  }
183
- ) : /* @__PURE__ */ o("div", { className: s.argumentContent, children: P(f.translatedContent) }),
184
- f.isTranslated && /* @__PURE__ */ o(
183
+ ) : /* @__PURE__ */ o("div", { className: s.argumentContent, children: P(u.translatedContent) }),
184
+ u.isTranslated && /* @__PURE__ */ o(
185
185
  be,
186
186
  {
187
187
  language: e.language,
188
- callback: () => f.toggleContent()
188
+ callback: () => u.toggleContent()
189
189
  }
190
190
  )
191
191
  ] }),
@@ -207,17 +207,17 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
207
207
  ),
208
208
  e.sources?.length > 0 && /* @__PURE__ */ o("div", { className: s.argumentSourcesList, children: e.sources.map(re) })
209
209
  ] }),
210
- !N && !e.is_deleted && /* @__PURE__ */ o(
210
+ !T && !e.is_deleted && /* @__PURE__ */ o(
211
211
  Me,
212
212
  {
213
213
  resource: e,
214
- disabled: M || e.status === "rejected" || !W && r?.actions?.disableInputForVisitor === !0 || A,
214
+ disabled: g || e.status === "rejected" || !W && r?.actions?.disableInputForVisitor === !0 || w,
215
215
  reportType: "Message",
216
216
  softDelete: r.actions?.softDelete,
217
217
  deleteType: "messages",
218
218
  deleteListId: Y,
219
- enableReply: g <= S || p.role === "editor" || p.role === "moderator",
220
- handleReplyTo: U,
219
+ enableReply: y <= C || c.role === "editor" || c.role === "moderator",
220
+ handleReplyTo: L,
221
221
  replyRedirectUrl: K,
222
222
  shareUrl: `https://app.logora.fr/share/a/${e.id}`,
223
223
  shareTitle: i.formatMessage({
@@ -242,18 +242,18 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
242
242
  voteableId: e.id,
243
243
  totalUpvote: e.upvotes,
244
244
  totalDownvote: 0,
245
- activeClassName: s[`voteButtonPosition-${C}`],
246
- disabled: e.status === "rejected" || p?.id === e?.author?.id || A
245
+ activeClassName: s[`voteButtonPosition-${I}`],
246
+ disabled: e.status === "rejected" || c?.id === e?.author?.id || w
247
247
  }
248
248
  )
249
249
  }
250
250
  ),
251
- !N && !w && /* @__PURE__ */ o(
251
+ !T && !N && /* @__PURE__ */ o(
252
252
  pe,
253
253
  {
254
254
  numberReplies: e.number_replies,
255
255
  repliesAuthors: e.replies_authors,
256
- expandReplies: m,
256
+ expandReplies: p,
257
257
  onToggleReplies: k,
258
258
  isReply: e.is_reply
259
259
  }
@@ -261,26 +261,21 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
261
261
  ]
262
262
  }
263
263
  ),
264
- !w && /* @__PURE__ */ l(y, { children: [
264
+ !N && /* @__PURE__ */ l(h, { children: [
265
265
  Z && /* @__PURE__ */ o(ne, { fallback: null, children: /* @__PURE__ */ o(
266
266
  Re,
267
267
  {
268
268
  groupId: e.group_id,
269
- groupType: R,
270
- groupName: T,
271
- positions: b,
269
+ groupType: S,
270
+ groupName: R,
271
+ positions: _,
272
272
  parentId: e.id,
273
273
  positionId: H?.position_id,
274
- disabled: M,
274
+ disabled: g,
275
275
  hideSourceAction: r?.actions?.disableUserSources || !1,
276
276
  argumentListId: `argument_${e.id}_reply_list`,
277
277
  onSubmit: (t) => {
278
- U(), h([t]), v(!0);
279
- },
280
- onUpdate: (t) => {
281
- h(
282
- (a) => a.map((d) => d.id === t.id ? t : d)
283
- );
278
+ L(), M([t]), b(!0);
284
279
  },
285
280
  isReply: !0,
286
281
  avatarSize: 40,
@@ -293,8 +288,8 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
293
288
  },
294
289
  `Reply${e.id}`
295
290
  ) }),
296
- u?.length > 0 && m && /* @__PURE__ */ o("div", { className: s.repliesList, children: u.map((t) => $(t)) }),
297
- m && /* @__PURE__ */ o("div", { className: s.repliesList, children: /* @__PURE__ */ o(
291
+ m?.length > 0 && p && /* @__PURE__ */ o("div", { className: s.repliesList, children: m.map((t) => U(t)) }),
292
+ p && /* @__PURE__ */ o("div", { className: s.repliesList, children: /* @__PURE__ */ o(
298
293
  Ie,
299
294
  {
300
295
  voteableType: "Message",
@@ -310,12 +305,12 @@ const Re = de(() => import("../../input/argument_input/index.js").then((e) => ({
310
305
  perPage: 5,
311
306
  display: "column",
312
307
  resourcePropName: "argument",
313
- emptyListComponent: /* @__PURE__ */ o(y, {}),
308
+ emptyListComponent: /* @__PURE__ */ o(h, {}),
314
309
  transformData: (t) => se(t),
315
- children: $(e)
310
+ children: U(e)
316
311
  }
317
312
  ) }),
318
- u?.length > 0 && !m && /* @__PURE__ */ o("div", { className: s.repliesList, children: e.number_replies > 1 && /* @__PURE__ */ o("div", { className: s.readMoreLink, children: /* @__PURE__ */ o(
313
+ m?.length > 0 && !p && /* @__PURE__ */ o("div", { className: s.repliesList, children: e.number_replies > 1 && /* @__PURE__ */ o("div", { className: s.readMoreLink, children: /* @__PURE__ */ o(
319
314
  Se,
320
315
  {
321
316
  role: "link",
@@ -1,138 +1,137 @@
1
- import { jsxs as _, jsx as i } from "react/jsx-runtime";
2
- import De from "@rooks/use-sessionstorage-state";
3
- import { useRef as Ue, useState as c, useEffect as M, Suspense as We, lazy as Ye } from "react";
4
- import { useIntl as ke, FormattedMessage as ge } from "react-intl";
5
- import { useLocation as Re } from "react-router";
1
+ import { jsxs as _, jsx as o } from "react/jsx-runtime";
2
+ import $e from "@rooks/use-sessionstorage-state";
3
+ import { useRef as qe, useState as c, useEffect as M, Suspense as De, lazy as We } from "react";
4
+ import { useIntl as Ye, FormattedMessage as me } from "react-intl";
5
+ import { useLocation as ke } from "react-router";
6
6
  import I from "classnames";
7
7
  import n from "./ArgumentInput.module.scss.js";
8
- import { useDataProvider as je } from "../../data/data_provider/useDataProvider.js";
9
- import { useList as ze } from "../../list/list_provider/useList.js";
10
- import { useConfig as Oe } from "../../data/config_provider/useConfig.js";
11
- import { useInput as Je } from "../input_provider/useInput.js";
12
- import { useAuth as Ke } from "../../auth/use_auth/useAuth.js";
13
- import { useFormValidation as Ge } from "../../forms/use_form_validation/useFormValidation.js";
14
- import { useResponsive as He } from "../../hooks/use_responsive/useResponsive.js";
15
- import { useAuthRequired as Qe } from "../../hooks/use_auth_required/useAuthRequired.js";
16
- import { useModal as Xe } from "../../dialog/modal/useModal.js";
17
- import { useToast as Ze } from "../../dialog/toast_provider/useToast.js";
18
- import { TogglePosition as et } from "../toggle_position/TogglePosition.js";
19
- import { Avatar as tt } from "../../user/avatar/Avatar.js";
20
- import { AuthorBox as nt } from "../../user/author_box/AuthorBox.js";
21
- import { TextEditor as at } from "../text_editor/TextEditor.js";
22
- import { Icon as it } from "../../icons/icon/Icon.js";
23
- const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ default: v.SideModal }))), yt = ({
8
+ import { useDataProvider as Re } from "../../data/data_provider/useDataProvider.js";
9
+ import { useList as je } from "../../list/list_provider/useList.js";
10
+ import { useConfig as ze } from "../../data/config_provider/useConfig.js";
11
+ import { useInput as Oe } from "../input_provider/useInput.js";
12
+ import { useAuth as Je } from "../../auth/use_auth/useAuth.js";
13
+ import { useFormValidation as Ke } from "../../forms/use_form_validation/useFormValidation.js";
14
+ import { useResponsive as Ge } from "../../hooks/use_responsive/useResponsive.js";
15
+ import { useAuthRequired as He } from "../../hooks/use_auth_required/useAuthRequired.js";
16
+ import { useModal as Qe } from "../../dialog/modal/useModal.js";
17
+ import { useToast as Xe } from "../../dialog/toast_provider/useToast.js";
18
+ import { TogglePosition as Ze } from "../toggle_position/TogglePosition.js";
19
+ import { Avatar as et } from "../../user/avatar/Avatar.js";
20
+ import { AuthorBox as tt } from "../../user/author_box/AuthorBox.js";
21
+ import { TextEditor as nt } from "../text_editor/TextEditor.js";
22
+ import { Icon as at } from "../../icons/icon/Icon.js";
23
+ const ot = We(() => import("../../modal/side_modal/index.js").then((v) => ({ default: v.SideModal }))), Nt = ({
24
24
  argumentListId: v,
25
- avatarSize: fe = 48,
25
+ avatarSize: ge = 48,
26
26
  disabled: z = !1,
27
27
  positions: a = [],
28
28
  disabledPositions: S = [],
29
29
  groupId: A,
30
- groupName: he,
30
+ groupName: fe,
31
31
  groupType: O,
32
- hideSourceAction: pe = !1,
32
+ hideSourceAction: he = !1,
33
33
  isReply: u = !1,
34
34
  onSubmit: J,
35
- onUpdate: K,
36
35
  parentId: F,
37
- placeholder: _e,
36
+ placeholder: pe,
38
37
  positionId: b,
39
- focusOnInit: Me = !1,
38
+ focusOnInit: _e = !1,
40
39
  activeOnInit: P = !1,
41
- userGuideUrl: G,
42
- hideUserGuideLink: ve = !1,
43
- hideCharCount: Ae = !1,
44
- disableAutoActivate: be = !1
40
+ userGuideUrl: K,
41
+ hideUserGuideLink: Me = !1,
42
+ hideCharCount: ve = !1,
43
+ disableAutoActivate: Ae = !1
45
44
  }) => {
46
- const r = ke(), H = je(), x = ze(), h = Oe(), {
47
- focus: Q,
45
+ const r = Ye(), G = Re(), x = je(), h = ze(), {
46
+ focus: H,
48
47
  setFocus: N,
49
- setReset: Ce,
48
+ setReset: be,
50
49
  inputContent: B,
51
- setInputContent: X,
52
- setInputRichContent: we
53
- } = Je(), { isLoggedIn: C, currentUser: d } = Ke(), { errors: E, validate: V } = Ge(), { isMobile: m } = He(), Ie = Re(), Z = Ue(null), [$, q] = c([]), [D, U] = c(""), [ee, W] = c(null), [l, p] = c(null), [te, ne] = c(null), [ae, ie] = c(!1), [w, oe] = c(!1), [y, se] = c({}), [g, Se] = De(
50
+ setInputContent: Q,
51
+ setInputRichContent: Ce
52
+ } = Oe(), { isLoggedIn: C, currentUser: d } = Je(), { errors: E, validate: V } = Ke(), { isMobile: m } = Ge(), we = ke(), X = qe(null), [U, $] = c([]), [q, D] = c(""), [Z, W] = c(null), [l, p] = c(null), [ee, te] = c(null), [ne, ae] = c(!1), [w, oe] = c(!1), [y, ie] = c({}), [g, Ie] = $e(
54
53
  "userSide",
55
54
  {}
56
- ), [f, xe] = c(
55
+ ), [f, Se] = c(
57
56
  !C && h?.actions?.disableInputForVisitor
58
- ), Y = Qe(), { showModal: Ne } = Xe(), { toast: k } = Ze() || {}, re = new URLSearchParams(
59
- typeof window < "u" ? window.location.search : Ie.search
57
+ ), Y = He(), { showModal: xe } = Qe(), { toast: k } = Xe() || {}, se = new URLSearchParams(
58
+ typeof window < "u" ? window.location.search : we.search
60
59
  );
61
60
  M(() => {
62
- xe(
61
+ Se(
63
62
  !C && h?.actions?.disableInputForVisitor
64
63
  );
65
64
  }, [C, h]);
66
- const R = d?.role === "editor" || d?.role === "moderator", ue = d?.moderation_status === "banned";
65
+ const R = d?.role === "editor" || d?.role === "moderator", re = d?.moderation_status === "banned";
67
66
  M(() => {
68
67
  let e = null;
69
- typeof window < "u" && (e = re.get("positionId")), b && b != a[2]?.id && a?.find((t) => t.id === b) ? p(b) : e && e != a[2]?.id ? p(e) : g && g.groupId == A && g.positionId != a[2]?.id && p(g.positionId);
68
+ typeof window < "u" && (e = se.get("positionId")), b && b != a[2]?.id && a?.find((t) => t.id === b) ? p(b) : e && e != a[2]?.id ? p(e) : g && g.groupId == A && g.positionId != a[2]?.id && p(g.positionId);
70
69
  }, [b]), M(() => {
71
70
  P && (j(), N(!0));
72
71
  }, [P]), M(() => {
73
72
  if (typeof window < "u") {
74
- const e = Me || re.get("initArgument");
75
- (e === !0 || e === "true") && (N(!0), Ve());
73
+ const e = _e || se.get("initArgument");
74
+ (e === !0 || e === "true") && (N(!0), Ee());
76
75
  }
77
76
  }, []), M(() => {
78
- Q && (de(), N(!1));
79
- }, [Q]), M(() => {
80
- B?.id && (ye(B), N(!0));
77
+ H && (ue(), N(!1));
78
+ }, [H]), M(() => {
79
+ B?.id && (Ne(B), N(!0));
81
80
  }, [B]);
82
- const ye = (e) => {
83
- se(e), oe(!0), q(e.sources), U(e.content), W(e.rich_content), ne(e.id), de(), p(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? we(e.rich_content) : X(e.content);
81
+ const Ne = (e) => {
82
+ ie(e), oe(!0), $(e.sources), D(e.content), W(e.rich_content), te(e.id), ue(), p(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Ce(e.rich_content) : Q(e.content);
83
+ }, ue = () => {
84
+ X.current.scrollIntoView(!1);
84
85
  }, de = () => {
85
- Z.current.scrollIntoView(!1);
86
- }, le = () => {
87
- U(""), W(null), se({}), ne(null), q([]), Ce(!0), X(null);
88
- }, Te = (e) => {
89
- p(e), me(e);
90
- }, Le = () => {
91
- Ne(
92
- /* @__PURE__ */ i(We, { fallback: null, children: /* @__PURE__ */ i(
86
+ D(""), W(null), ie({}), te(null), $([]), be(!0), Q(null);
87
+ }, ye = (e) => {
88
+ p(e), ce(e);
89
+ }, Te = () => {
90
+ xe(
91
+ /* @__PURE__ */ o(De, { fallback: null, children: /* @__PURE__ */ o(
93
92
  ot,
94
93
  {
95
94
  modalTitle: r.formatMessage({
96
95
  id: "modal.side_modal.modal_title",
97
96
  defaultMessage: "Choose your side"
98
97
  }),
99
- onChooseSide: Te,
98
+ onChooseSide: ye,
100
99
  positions: a,
101
- title: he,
100
+ title: fe,
102
101
  disabledPositions: !u && S,
103
102
  isNeutral: g && g.groupId == A && g.positionId === a[2]?.id
104
103
  }
105
104
  ) })
106
105
  );
107
- }, Fe = () => {
108
- C ? te ? Ee() : !a || a?.length === 0 || !S?.find((e) => e?.id === l) && l || R && u ? me(u && R && a[0]?.id) : Le() : Y({ loginAction: "argument" });
109
- }, Pe = (e, t) => {
110
- f ? Y({ loginAction: "argument" }) : (U(e), W(t), V({ content: e }, [{ content: ["url", null] }]));
111
- }, Be = (e) => {
112
- q(e);
113
- }, ce = [
106
+ }, Le = () => {
107
+ C ? ee ? Be() : !a || a?.length === 0 || !S?.find((e) => e?.id === l) && l || R && u ? ce(u && R && a[0]?.id) : Te() : Y({ loginAction: "argument" });
108
+ }, Fe = (e, t) => {
109
+ f ? Y({ loginAction: "argument" }) : (D(e), W(t), V({ content: e }, [{ content: ["url", null] }]));
110
+ }, Pe = (e) => {
111
+ $(e);
112
+ }, le = [
114
113
  { content: ["length", 3] },
115
114
  { content: ["required", null] },
116
115
  { content: ["url", null] },
117
116
  ...!a || a?.length === 0 ? [] : [{ position_id: ["required", null] }]
118
- ], me = (e) => {
119
- const t = e || l, o = {
120
- content: D,
121
- rich_content: ee,
117
+ ], ce = (e) => {
118
+ const t = e || l, s = {
119
+ content: q,
120
+ rich_content: Z,
122
121
  group_id: A,
123
122
  ...O && { group_type: O },
124
123
  ...t && { position_id: t },
125
124
  is_reply: !!F,
126
125
  message_id: F || null,
127
- source_ids: $?.map((s) => s.id)
126
+ source_ids: U?.map((i) => i.id)
128
127
  };
129
- V(o, ce) && (t && a && a.map((s) => s.id).includes(t) && Se({
128
+ V(s, le) && (t && a && a.map((i) => i.id).includes(t) && Ie({
130
129
  groupId: A,
131
130
  positionId: t
132
- }), le(), H.create("messages", o).then((s) => {
133
- if (s.data.success) {
131
+ }), de(), G.create("messages", s).then((i) => {
132
+ if (i.data.success) {
134
133
  if (F)
135
- J(s.data.data.resource), k(
134
+ J(i.data.data.resource), k(
136
135
  r.formatMessage({
137
136
  id: "alert.argument_create",
138
137
  defaultMessage: "Your contribution has been sent !"
@@ -146,11 +145,11 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
146
145
  }
147
146
  );
148
147
  else {
149
- const T = s.data.data.resource;
148
+ const T = i.data.data.resource;
150
149
  let L = v;
151
150
  t && !m && (L = `argumentList${T.position.id}`), J?.(
152
- D,
153
- a.find((qe) => qe.id === t) || null
151
+ q,
152
+ a.find((Ue) => Ue.id === t) || null
154
153
  ), x.add(L, [T]), k(
155
154
  r.formatMessage({
156
155
  id: "alert.argument_create",
@@ -170,45 +169,45 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
170
169
  typeof window < "u" && window.dispatchEvent(
171
170
  new CustomEvent("logora:user_content:created", {
172
171
  detail: {
173
- content: s.data.data?.resource
172
+ content: i.data.data?.resource
174
173
  }
175
174
  })
176
175
  );
177
176
  }
178
177
  }));
179
- }, Ee = () => {
178
+ }, Be = () => {
180
179
  const e = {
181
- content: D,
182
- rich_content: ee,
183
- source_ids: $?.map((t) => t.id),
180
+ content: q,
181
+ rich_content: Z,
182
+ source_ids: U?.map((t) => t.id),
184
183
  ...l && { position_id: l }
185
184
  };
186
- V(e, ce) && H.update("messages", te, e).then((t) => {
185
+ V(e, le) && G.update("messages", ee, e).then((t) => {
187
186
  if (t.data.success) {
188
- const o = t.data.data.resource;
189
- console.log("[updateArgument] réponse API:", o), console.log("[updateArgument] editElement:", y), console.log("[updateArgument] argumentListId prop:", v);
190
- let s = v;
191
- if (o.is_reply ? s = `argument_${o.reply_to_id || y?.reply_to_id}_reply_list` : l && !m && (s = `argumentList${o.position?.id}`), console.log("[updateArgument] listId final:", s), y?.position?.id != o.position?.id && !m && !o.is_reply) {
192
- const T = `argumentList${y.position.id}`, L = `argumentList${o.position.id}`;
193
- x.remove(T, [o]), x.add(L, [o]);
187
+ const s = t.data.data.resource;
188
+ console.log("[updateArgument] réponse API:", s), console.log("[updateArgument] editElement:", y), console.log("[updateArgument] argumentListId prop:", v);
189
+ let i = v;
190
+ if (s.is_reply ? i = `argument_${s.reply_to_id || y?.reply_to_id}_reply_list` : l && !m && (i = `argumentList${s.position?.id}`), console.log("[updateArgument] listId final:", i), y?.position?.id != s.position?.id && !m && !s.is_reply) {
191
+ const T = `argumentList${y.position.id}`, L = `argumentList${s.position.id}`;
192
+ x.remove(T, [s]), x.add(L, [s]);
194
193
  } else
195
- x.update(s, [o]), K && K(o);
194
+ x.update(i, [s]);
196
195
  k(r.formatMessage({ id: "alert.argument_modify" }), {
197
196
  type: "success"
198
- }), le();
197
+ }), de();
199
198
  }
200
199
  });
201
- }, Ve = () => {
202
- if (!ae) {
203
- ie(!0);
200
+ }, Ee = () => {
201
+ if (!ne) {
202
+ ae(!0);
204
203
  const e = setTimeout(() => {
205
- ie(!1);
204
+ ae(!1);
206
205
  }, 2e3);
207
206
  return () => clearTimeout(e);
208
207
  }
209
208
  }, j = () => {
210
209
  f ? Y({ loginAction: "argument" }) : oe(!0);
211
- }, $e = () => {
210
+ }, Ve = () => {
212
211
  const e = S.find(
213
212
  (t) => t.id === l
214
213
  );
@@ -222,28 +221,28 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
222
221
  );
223
222
  };
224
223
  return /* @__PURE__ */ _("div", { className: n.inputContainer, children: [
225
- z && /* @__PURE__ */ i("div", { className: n.disabledInputMask, children: ue ? r.formatMessage({
224
+ z && /* @__PURE__ */ o("div", { className: n.disabledInputMask, children: re ? r.formatMessage({
226
225
  id: "input.argument_input.user_banned",
227
226
  defaultMessage: "You are banned from the debate space."
228
227
  }) : r.formatMessage({
229
228
  id: "info.debate_is_inactive",
230
229
  defaultMessage: "Debate is closed"
231
230
  }) }),
232
- /* @__PURE__ */ i(
231
+ /* @__PURE__ */ o(
233
232
  "div",
234
233
  {
235
234
  className: I(n.argumentInput, {
236
- [n.flash]: ae,
235
+ [n.flash]: ne,
237
236
  [n.replyInputContainer]: u
238
237
  }),
239
- children: /* @__PURE__ */ i("div", { "data-tid": "action_add_argument", ref: Z, children: /* @__PURE__ */ _("div", { className: n.argumentInputBox, children: [
238
+ children: /* @__PURE__ */ o("div", { "data-tid": "action_add_argument", ref: X, children: /* @__PURE__ */ _("div", { className: n.argumentInputBox, children: [
240
239
  a.length > 0 && C && (!u || !R) && /* @__PURE__ */ _("div", { className: n.userPosition, children: [
241
- /* @__PURE__ */ i("div", { children: r.formatMessage({
240
+ /* @__PURE__ */ o("div", { children: r.formatMessage({
242
241
  id: "input.position",
243
242
  defaultMessage: "Your position"
244
243
  }) }),
245
- /* @__PURE__ */ i(
246
- et,
244
+ /* @__PURE__ */ o(
245
+ Ze,
247
246
  {
248
247
  activeLabel: l === a[0].id ? 0 : l === a[1].id ? 1 : null,
249
248
  firstLabel: a[0],
@@ -260,22 +259,22 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
260
259
  [n.replyEditorRow]: u
261
260
  }),
262
261
  children: [
263
- /* @__PURE__ */ i(
262
+ /* @__PURE__ */ o(
264
263
  "div",
265
264
  {
266
265
  className: I(n.argumentAuthorContainer, {
267
266
  [n.argumentAuthorContainerMobile]: m,
268
267
  [n.argumentAuthorContainerActivated]: !m && w || u
269
268
  }),
270
- children: !m && w || u ? /* @__PURE__ */ i(
271
- tt,
269
+ children: !m && w || u ? /* @__PURE__ */ o(
270
+ et,
272
271
  {
273
272
  avatarUrl: d.image_url,
274
273
  userName: d.full_name,
275
- size: fe
274
+ size: ge
276
275
  }
277
- ) : /* @__PURE__ */ i(
278
- nt,
276
+ ) : /* @__PURE__ */ o(
277
+ tt,
279
278
  {
280
279
  fullName: d?.full_name || r.formatMessage({ id: "default_author.full_name" }),
281
280
  avatarUrl: d?.image_url,
@@ -294,38 +293,38 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
294
293
  [n.replyTextEditorBox]: u
295
294
  }),
296
295
  children: [
297
- /* @__PURE__ */ i(
298
- at,
296
+ /* @__PURE__ */ o(
297
+ nt,
299
298
  {
300
299
  handleChange: (e, t) => {
301
- Pe(e, t);
300
+ Fe(e, t);
302
301
  },
303
302
  handleSourcesChange: (e) => {
304
- Be(e);
303
+ Pe(e);
305
304
  },
306
- placeholder: _e,
305
+ placeholder: pe,
307
306
  "aria-label": r.formatMessage({
308
307
  id: "input.argument_input.aria_label",
309
308
  defaultMessage: "Message input field"
310
309
  }),
311
- onSubmit: Fe,
312
- sources: $,
313
- hideSourceAction: pe || f,
310
+ onSubmit: Le,
311
+ sources: U,
312
+ hideSourceAction: he || f,
314
313
  uid: `Argument${A}`,
315
314
  onActivation: j,
316
315
  showStylesControls: w,
317
- disabled: z || f || ue,
316
+ disabled: z || f || re,
318
317
  maxLength: f ? !1 : h?.actions?.argumentMaxLength,
319
318
  disableRichText: h?.actions?.disableRichText || f,
320
319
  shortBar: u,
321
320
  hideSubmit: f,
322
321
  allowedDomains: h?.allowed_sources,
323
322
  active: P,
324
- hideCharCount: Ae,
325
- disableAutoActivate: be
323
+ hideCharCount: ve,
324
+ disableAutoActivate: Ae
326
325
  }
327
326
  ),
328
- E?.content && /* @__PURE__ */ i("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ i("div", { children: e }, t)) }),
327
+ E?.content && /* @__PURE__ */ o("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ o("div", { children: e }, t)) }),
329
328
  w && S?.find(
330
329
  (e) => e.id === l
331
330
  ) && /* @__PURE__ */ _(
@@ -336,8 +335,8 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
336
335
  n.disabledPositionWarning
337
336
  ),
338
337
  children: [
339
- /* @__PURE__ */ i(
340
- it,
338
+ /* @__PURE__ */ o(
339
+ at,
341
340
  {
342
341
  name: "announcement",
343
342
  className: n.warningIcon,
@@ -345,25 +344,25 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
345
344
  width: 20
346
345
  }
347
346
  ),
348
- /* @__PURE__ */ i("div", { className: n.argumentInputWarningText, children: $e() })
347
+ /* @__PURE__ */ o("div", { className: n.argumentInputWarningText, children: Ve() })
349
348
  ]
350
349
  }
351
350
  ),
352
- w && G && !ve && /* @__PURE__ */ i("div", { className: n.guideMessage, children: /* @__PURE__ */ i(
353
- ge,
351
+ w && K && !Me && /* @__PURE__ */ o("div", { className: n.guideMessage, children: /* @__PURE__ */ o(
352
+ me,
354
353
  {
355
354
  id: "alert.guide_message",
356
355
  defaultMessage: "Contributions must comply with our {userCharter}.",
357
356
  values: {
358
- userCharter: /* @__PURE__ */ i(
357
+ userCharter: /* @__PURE__ */ o(
359
358
  "a",
360
359
  {
361
360
  className: n.guideMessage,
362
- href: G,
361
+ href: K,
363
362
  target: "_blank",
364
363
  rel: "noreferrer",
365
- children: /* @__PURE__ */ i(
366
- ge,
364
+ children: /* @__PURE__ */ o(
365
+ me,
367
366
  {
368
367
  id: "alert.user_charter",
369
368
  defaultMessage: "user charter"
@@ -386,5 +385,5 @@ const ot = Ye(() => import("../../modal/side_modal/index.js").then((v) => ({ def
386
385
  ] });
387
386
  };
388
387
  export {
389
- yt as ArgumentInput
388
+ Nt as ArgumentInput
390
389
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.61",
3
+ "version": "0.3.62",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",