@logora/debate 0.4.103 → 0.4.104

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