@logora/debate 0.4.75 → 0.4.77

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,18 +1,18 @@
1
1
  import { jsx as e, Fragment as E, jsxs as G } from "react/jsx-runtime";
2
- import P from "@rooks/use-sessionstorage-state";
3
- import x from "classnames";
2
+ import P from "classnames";
4
3
  import { useState as i } from "react";
5
- import { useIntl as F } from "react-intl";
4
+ import { useIntl as x } from "react-intl";
6
5
  import r from "./SignupForm.module.scss.js";
7
- import { EMAIL_CONSENT_STORAGE_KEY as I } from "../use_auth/useAuthActions.js";
6
+ import { useSessionStorageState as F } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
8
7
  import { TextInput as m } from "../../input/text_input/TextInput.js";
9
- import { Toggle as k } from "../../input/toggle/Toggle.js";
10
- import { Button as q } from "../../action/button/Button.js";
8
+ import { Toggle as I } from "../../input/toggle/Toggle.js";
9
+ import { Button as k } from "../../action/button/Button.js";
10
+ import { EMAIL_CONSENT_STORAGE_KEY as q } from "../use_auth/useAuthActions.js";
11
11
  const U = ({ onSubmit: n, providerName: f, error: t = !1 }) => {
12
- const [p, g] = i(""), [c, _] = i(""), [h, M] = i(""), [d, w] = i(""), [u, b] = i(""), [l, v] = P(
13
- I,
12
+ const [p, g] = i(""), [c, _] = i(""), [h, M] = i(""), [d, w] = i(""), [u, b] = i(""), [l, v] = F(
13
+ q,
14
14
  !1
15
- ), [o, N] = i(""), a = F(), C = (s) => {
15
+ ), [o, N] = i(""), a = x(), C = (s) => {
16
16
  s.preventDefault(), S(d, u) && n && n(
17
17
  c,
18
18
  h,
@@ -128,7 +128,7 @@ const U = ({ onSubmit: n, providerName: f, error: t = !1 }) => {
128
128
  }
129
129
  ) }),
130
130
  /* @__PURE__ */ e("div", { className: r.formGroup, children: /* @__PURE__ */ e(
131
- k,
131
+ I,
132
132
  {
133
133
  type: "checkbox",
134
134
  name: "accepts_provider_email",
@@ -145,8 +145,8 @@ const U = ({ onSubmit: n, providerName: f, error: t = !1 }) => {
145
145
  "data-testid": "accepts-email-input"
146
146
  }
147
147
  ) }),
148
- /* @__PURE__ */ e("div", { className: x(r.formGroup, r.formSubmitGroup), children: /* @__PURE__ */ e(
149
- q,
148
+ /* @__PURE__ */ e("div", { className: P(r.formGroup, r.formSubmitGroup), children: /* @__PURE__ */ e(
149
+ k,
150
150
  {
151
151
  className: r.formSubmitButton,
152
152
  role: "button",
@@ -1,15 +1,15 @@
1
1
  import { jsx as e, jsxs as r, Fragment as c } from "react/jsx-runtime";
2
- import B from "@rooks/use-sessionstorage-state";
3
2
  import { useState as N } from "react";
4
- import { useIntl as O, FormattedMessage as P } from "react-intl";
3
+ import { useIntl as B, FormattedMessage as O } from "react-intl";
5
4
  import a from "./SocialAuthForm.module.scss.js";
6
- import { EMAIL_CONSENT_STORAGE_KEY as E } from "../use_auth/useAuthActions.js";
7
- import { FacebookLoginButton as j } from "../facebook_login_button/FacebookLoginButton.js";
8
- import { GoogleLoginButton as z } from "../google_login_button/GoogleLoginButton.js";
5
+ import { useSessionStorageState as P } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
6
+ import { FacebookLoginButton as E } from "../facebook_login_button/FacebookLoginButton.js";
7
+ import { GoogleLoginButton as j } from "../google_login_button/GoogleLoginButton.js";
9
8
  import { Icon as y } from "../../icons/icon/Icon.js";
10
- import { Toggle as D } from "../../input/toggle/Toggle.js";
11
- import { SignupForm as K } from "../signup_form/SignupForm.js";
12
- import { LoginForm as R } from "../login_form/LoginForm.js";
9
+ import { Toggle as z } from "../../input/toggle/Toggle.js";
10
+ import { SignupForm as D } from "../signup_form/SignupForm.js";
11
+ import { LoginForm as K } from "../login_form/LoginForm.js";
12
+ import { EMAIL_CONSENT_STORAGE_KEY as R } from "../use_auth/useAuthActions.js";
13
13
  const te = ({
14
14
  lastStep: s,
15
15
  providerName: l,
@@ -25,10 +25,10 @@ const te = ({
25
25
  }) => {
26
26
  const [w, g] = N(
27
27
  !(s === "LOGIN" || s === "SIGNUP")
28
- ), [t, I] = N(s !== "SIGNUP"), [f, F] = B(
29
- E,
28
+ ), [t, I] = N(s !== "SIGNUP"), [f, F] = P(
29
+ R,
30
30
  !1
31
- ), o = O(), G = (i, n, M, A, Y, v) => {
31
+ ), o = B(), G = (i, n, M, A, Y, v) => {
32
32
  const T = {
33
33
  uid: typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "0000-0000-0000-0000",
34
34
  first_name: i,
@@ -47,7 +47,7 @@ const te = ({
47
47
  }, _ = (i, n) => {
48
48
  d(i, n, "SOCIAL");
49
49
  }, x = () => /* @__PURE__ */ e("div", { className: a.formFooterTerms, children: /* @__PURE__ */ e(
50
- P,
50
+ O,
51
51
  {
52
52
  id: "auth.social_auth_form.terms_text",
53
53
  values: {
@@ -112,7 +112,7 @@ const te = ({
112
112
  defaultMessage: "Create your account in one click to vote and start debating !"
113
113
  }) }),
114
114
  /* @__PURE__ */ e(
115
- j,
115
+ E,
116
116
  {
117
117
  text: o.formatMessage({
118
118
  id: "auth.social_auth_form.facebook_login",
@@ -124,7 +124,7 @@ const te = ({
124
124
  }
125
125
  ),
126
126
  /* @__PURE__ */ e(
127
- z,
127
+ j,
128
128
  {
129
129
  text: o.formatMessage({
130
130
  id: "auth.social_auth_form.google_login",
@@ -150,7 +150,7 @@ const te = ({
150
150
  }
151
151
  ),
152
152
  !t && /* @__PURE__ */ e("div", { className: a.checkboxContainer, children: /* @__PURE__ */ e(
153
- D,
153
+ z,
154
154
  {
155
155
  type: "checkbox",
156
156
  name: "accepts_emails",
@@ -195,7 +195,7 @@ const te = ({
195
195
  }) })
196
196
  ] }),
197
197
  t ? /* @__PURE__ */ e("div", { className: a.loginFormContainer, children: /* @__PURE__ */ e(
198
- R,
198
+ K,
199
199
  {
200
200
  onSubmit: U,
201
201
  error: m && s === "LOGIN",
@@ -210,7 +210,7 @@ const te = ({
210
210
  { provider: l }
211
211
  ) }),
212
212
  /* @__PURE__ */ e(
213
- K,
213
+ D,
214
214
  {
215
215
  onSubmit: G,
216
216
  providerName: l,
@@ -1,14 +1,14 @@
1
1
  import { jsxs as n, jsx as e, Fragment as m } from "react/jsx-runtime";
2
- import G from "@rooks/use-sessionstorage-state";
3
- import D from "classnames";
2
+ import G from "classnames";
4
3
  import "react";
5
- import { useIntl as Y, FormattedMessage as w } from "react-intl";
6
- import { useLocation as z } from "react-router";
4
+ import { useIntl as D, FormattedMessage as w } from "react-intl";
5
+ import { useLocation as Y } from "react-router";
7
6
  import a from "./SSOForm.module.scss.js";
8
- import { EMAIL_CONSENT_STORAGE_KEY as H } from "../use_auth/useAuthActions.js";
9
- import { Icon as K } from "../../icons/icon/Icon.js";
10
- import { Button as V } from "../../action/button/Button.js";
11
- import { Toggle as W } from "../../input/toggle/Toggle.js";
7
+ import { useSessionStorageState as z } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
8
+ import { Icon as H } from "../../icons/icon/Icon.js";
9
+ import { Button as K } from "../../action/button/Button.js";
10
+ import { Toggle as V } from "../../input/toggle/Toggle.js";
11
+ import { EMAIL_CONSENT_STORAGE_KEY as W } from "../use_auth/useAuthActions.js";
12
12
  import { utf8ToBase64url as $ } from "../use_auth/base64.js";
13
13
  const ie = ({
14
14
  authType: v,
@@ -29,8 +29,8 @@ const ie = ({
29
29
  hideBelowButton: x = !1,
30
30
  error: R = !1
31
31
  }) => {
32
- const [h, T] = g ? G(H, !1) : [!1, () => {
33
- }], o = Y(), d = z(), A = (t) => {
32
+ const [h, T] = g ? z(W, !1) : [!1, () => {
33
+ }], o = D(), d = Y(), A = (t) => {
34
34
  if (typeof window < "u") {
35
35
  const s = t === "CURRENT_LOCATION" ? window.location : t, i = new URL(s, window.location.origin), l = i.searchParams, E = new URLSearchParams(d.search);
36
36
  l.has("code") && l.delete("code"), f && l.append(f, window.location.toString());
@@ -73,7 +73,7 @@ const ie = ({
73
73
  alt: `Logo ${c}`
74
74
  }
75
75
  ) : /* @__PURE__ */ e(
76
- K,
76
+ H,
77
77
  {
78
78
  name: "next",
79
79
  "aria-hidden": "true",
@@ -100,7 +100,7 @@ const ie = ({
100
100
  ] }),
101
101
  U ? null : /* @__PURE__ */ n(m, { children: [
102
102
  /* @__PURE__ */ e(
103
- V,
103
+ K,
104
104
  {
105
105
  "data-tid": "link_signup",
106
106
  "data-testid": "signup-button",
@@ -135,8 +135,8 @@ const ie = ({
135
135
  }
136
136
  )
137
137
  ] }),
138
- g ? /* @__PURE__ */ e("div", { className: D(a.switchBox), children: /* @__PURE__ */ e(
139
- W,
138
+ g ? /* @__PURE__ */ e("div", { className: G(a.switchBox), children: /* @__PURE__ */ e(
139
+ V,
140
140
  {
141
141
  type: "checkbox",
142
142
  name: "accepts_provider_email",
@@ -0,0 +1,25 @@
1
+ import { useState as n, useEffect as a } from "react";
2
+ const c = (t, s) => {
3
+ try {
4
+ const e = JSON.parse(sessionStorage.getItem(t));
5
+ return e === null ? s : e;
6
+ } catch {
7
+ return s;
8
+ }
9
+ }, S = (t, s) => {
10
+ const [e, r] = n(() => c(t, s));
11
+ return a(() => {
12
+ try {
13
+ sessionStorage.setItem(t, JSON.stringify(e));
14
+ } catch {
15
+ }
16
+ }, [e]), [e, r, () => {
17
+ try {
18
+ sessionStorage.removeItem(t);
19
+ } catch {
20
+ }
21
+ }];
22
+ };
23
+ export {
24
+ S as useSessionStorageState
25
+ };
@@ -1,37 +1,37 @@
1
1
  import { jsxs as C, jsx as s } from "react/jsx-runtime";
2
- import We from "@rooks/use-sessionstorage-state";
3
- import { useRef as Ye, useState as c, useEffect as p, Suspense as je, lazy as ze } from "react";
2
+ import { useRef as Ye, useState as u, useEffect as p, Suspense as je, lazy as ze } from "react";
4
3
  import { useIntl as Oe, FormattedMessage as he } from "react-intl";
5
- import { useLocation as Re } from "react-router";
4
+ import { useLocation as Je } from "react-router";
6
5
  import x from "classnames";
7
6
  import n from "./ArgumentInput.module.scss.js";
8
- import { useDataProvider as Je } from "../../data/data_provider/useDataProvider.js";
9
- import { useList as Ke } from "../../list/list_provider/useList.js";
7
+ import { useDataProvider as Ke } from "../../data/data_provider/useDataProvider.js";
8
+ import { useList as Re } from "../../list/list_provider/useList.js";
10
9
  import { useConfig as Ge } from "../../data/config_provider/useConfig.js";
11
10
  import { useInput as He } from "../input_provider/useInput.js";
12
11
  import { useAuth as Qe } from "../../auth/use_auth/useAuth.js";
13
12
  import { useFormValidation as Xe } from "../../forms/use_form_validation/useFormValidation.js";
14
13
  import { useResponsive as Ze } from "../../hooks/use_responsive/useResponsive.js";
15
- import { useAuthRequired as et } from "../../hooks/use_auth_required/useAuthRequired.js";
16
- import { useModal as tt } from "../../dialog/modal/useModal.js";
17
- import { useToast as nt } from "../../dialog/toast_provider/useToast.js";
18
- import { TogglePosition as at } from "../toggle_position/TogglePosition.js";
19
- import { Avatar as st } from "../../user/avatar/Avatar.js";
20
- import { AuthorBox as it } from "../../user/author_box/AuthorBox.js";
21
- import { TextEditor as ot } from "../text_editor/TextEditor.js";
22
- import { Icon as rt } from "../../icons/icon/Icon.js";
23
- const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ default: N.SideModal }))), Ft = ({
14
+ import { useSessionStorageState as et } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
15
+ import { useAuthRequired as tt } from "../../hooks/use_auth_required/useAuthRequired.js";
16
+ import { useModal as nt } from "../../dialog/modal/useModal.js";
17
+ import { useToast as at } from "../../dialog/toast_provider/useToast.js";
18
+ import { TogglePosition as st } from "../toggle_position/TogglePosition.js";
19
+ import { Avatar as it } from "../../user/avatar/Avatar.js";
20
+ import { AuthorBox as ot } from "../../user/author_box/AuthorBox.js";
21
+ import { TextEditor as rt } from "../text_editor/TextEditor.js";
22
+ import { Icon as ut } from "../../icons/icon/Icon.js";
23
+ const dt = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ default: N.SideModal }))), Pt = ({
24
24
  argumentListId: N,
25
25
  avatarSize: pe = 48,
26
- disabled: R = !1,
26
+ disabled: J = !1,
27
27
  positions: a = [],
28
28
  disabledPositions: T = [],
29
29
  groupId: _,
30
30
  groupName: _e,
31
- groupType: J,
31
+ groupType: K,
32
32
  hideSourceAction: Me = !1,
33
33
  isReply: i = !1,
34
- onSubmit: K,
34
+ onSubmit: R,
35
35
  onUpdate: G,
36
36
  parentId: M,
37
37
  placeholder: ve,
@@ -44,62 +44,61 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
44
44
  disableAutoActivate: we = !1,
45
45
  autoFocus: Q = !1
46
46
  }) => {
47
- const r = Oe(), X = Je(), y = Ke(), v = Ge(), {
47
+ const r = Oe(), X = Ke(), L = Re(), v = Ge(), {
48
48
  focus: Z,
49
49
  setFocus: ee,
50
- setReset: Se,
51
50
  inputContent: B,
52
51
  setInputContent: te,
53
- setInputRichContent: Ie
54
- } = He(), { isLoggedIn: S, currentUser: u } = Qe(), { errors: E, validate: $ } = Xe(), { isMobile: m } = Ze(), xe = Re(), ne = Ye(null), [V, k] = c([]), [q, D] = c(""), [ae, U] = c(null), [d, b] = c(null), [se, ie] = c(null), [oe, re] = c(!1), [I, ue] = c(!1), [A, de] = c({}), [Ne, W] = c(!1), [f, Te] = We(
52
+ setInputRichContent: Se
53
+ } = He(), { isLoggedIn: S, currentUser: d } = Qe(), { errors: E, validate: $ } = Xe(), { isMobile: m } = Ze(), Ie = Je(), ne = Ye(null), [V, k] = u([]), [q, D] = u(""), [ae, U] = u(null), [l, b] = u(null), [se, ie] = u(null), [oe, re] = u(!1), [I, ue] = u(!1), [A, de] = u({}), [xe, W] = u(!1), [Ne, Te] = u(0), [f, Le] = et(
55
54
  "userSide",
56
55
  {}
57
- ), [g, ye] = c(
56
+ ), [g, ye] = u(
58
57
  !S && v?.actions?.disableInputForVisitor
59
- ), Y = et(), { showModal: Le } = tt(), { toast: j } = nt() || {}, le = new URLSearchParams(
60
- typeof window < "u" ? window.location.search : xe.search
58
+ ), Y = tt(), { showModal: Fe } = nt(), { toast: j } = at() || {}, le = new URLSearchParams(
59
+ typeof window < "u" ? window.location.search : Ie.search
61
60
  );
62
61
  p(() => {
63
62
  ye(
64
63
  !S && v?.actions?.disableInputForVisitor
65
64
  );
66
65
  }, [S, v]);
67
- const z = u?.role === "editor" || u?.role === "moderator", ce = u?.moderation_status === "banned";
66
+ const z = d?.role === "editor" || d?.role === "moderator", ce = d?.moderation_status === "banned";
68
67
  p(() => {
69
68
  let e = null;
70
69
  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
70
  }, [w]), p(() => {
72
71
  Q && W(!0);
73
72
  }, [Q]), p(() => {
74
- P && (O(), W(!0), L());
73
+ P && (O(), W(!0), y());
75
74
  }, [P]), p(() => {
76
75
  if (typeof window < "u") {
77
76
  const e = be || le.get("initArgument");
78
- (e === !0 || e === "true") && (W(!0), L(), qe());
77
+ (e === !0 || e === "true") && (W(!0), y(), De());
79
78
  }
80
79
  }, []), p(() => {
81
- Z && (L(), ee(!1));
80
+ Z && !i && (y(), ee(!1));
82
81
  }, [Z]), p(() => {
83
- B?.id && !i && (Fe(B), ee(!0));
82
+ B?.id && !i && (Pe(B), ee(!0));
84
83
  }, [B]);
85
- const Fe = (e) => {
86
- de(e), ue(!0), k(e.sources), D(e.content), U(e.rich_content), ie(e.id), L(), b(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Ie(e.rich_content) : te(e.content);
87
- }, L = () => {
84
+ const Pe = (e) => {
85
+ de(e), ue(!0), k(e.sources), D(e.content), U(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);
86
+ }, y = () => {
88
87
  ne.current.scrollIntoView({ behavior: "smooth", block: "center" });
89
88
  }, me = () => {
90
- D(""), U(null), de({}), ie(null), k([]), Se(!0), te(null);
91
- }, Pe = (e) => {
89
+ D(""), U(null), de({}), ie(null), k([]), Te((e) => e + 1), te(null);
90
+ }, Be = (e) => {
92
91
  b(e), ge(e);
93
- }, Be = () => {
94
- Le(
92
+ }, Ee = () => {
93
+ Fe(
95
94
  /* @__PURE__ */ s(je, { fallback: null, children: /* @__PURE__ */ s(
96
- ut,
95
+ dt,
97
96
  {
98
97
  modalTitle: r.formatMessage({
99
98
  id: "modal.side_modal.modal_title",
100
99
  defaultMessage: "Choose your side"
101
100
  }),
102
- onChooseSide: Pe,
101
+ onChooseSide: Be,
103
102
  positions: a,
104
103
  title: _e,
105
104
  disabledPositions: !i && T,
@@ -107,11 +106,11 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
107
106
  }
108
107
  ) })
109
108
  );
110
- }, Ee = () => {
111
- S ? se ? ke() : !a || a?.length === 0 || !T?.find((e) => e?.id === d) && d || z && i ? ge(i && z && a[0]?.id) : Be() : Y({ loginAction: "argument" });
112
- }, $e = (e, t) => {
109
+ }, $e = () => {
110
+ S ? se ? qe() : !a || a?.length === 0 || !T?.find((e) => e?.id === l) && l || z && i ? ge(i && z && a[0]?.id) : Ee() : Y({ loginAction: "argument" });
111
+ }, Ve = (e, t) => {
113
112
  g ? Y({ loginAction: "argument" }) : (D(e), U(t), $({ content: e }, [{ content: ["url", null] }]));
114
- }, Ve = (e) => {
113
+ }, ke = (e) => {
115
114
  k(e);
116
115
  }, fe = [
117
116
  { content: ["length", 3] },
@@ -119,23 +118,23 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
119
118
  { content: ["url", null] },
120
119
  ...!a || a?.length === 0 ? [] : [{ position_id: ["required", null] }]
121
120
  ], ge = (e) => {
122
- const t = e || d, l = {
121
+ const t = e || l, c = {
123
122
  content: q,
124
123
  rich_content: ae,
125
124
  group_id: _,
126
- ...J && { group_type: J },
125
+ ...K && { group_type: K },
127
126
  ...t && { position_id: t },
128
127
  is_reply: !!M,
129
128
  message_id: M || null,
130
129
  source_ids: V?.map((o) => o.id)
131
130
  };
132
- $(l, fe) && (t && a && a.map((o) => o.id).includes(t) && Te({
131
+ $(c, fe) && (t && a && a.map((o) => o.id).includes(t) && Le({
133
132
  groupId: _,
134
133
  positionId: t
135
- }), me(), X.create("messages", l).then((o) => {
134
+ }), me(), X.create("messages", c).then((o) => {
136
135
  if (o.data.success) {
137
136
  if (M)
138
- K(o.data.data.resource), j(
137
+ R(o.data.data.resource), j(
139
138
  r.formatMessage({
140
139
  id: "alert.argument_create",
141
140
  defaultMessage: "Your contribution has been sent !"
@@ -151,10 +150,10 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
151
150
  else {
152
151
  const h = o.data.data.resource;
153
152
  let F = N;
154
- t && !m && (F = `argumentList${h.position.id}`), K?.(
153
+ t && !m && (F = `argumentList${h.position.id}`), R?.(
155
154
  q,
156
- a.find((Ue) => Ue.id === t) || null
157
- ), y.add(F, [h]), j(
155
+ a.find((We) => We.id === t) || null
156
+ ), L.add(F, [h]), j(
158
157
  r.formatMessage({
159
158
  id: "alert.argument_create",
160
159
  defaultMessage: "Your contribution has been sent !"
@@ -166,7 +165,7 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
166
165
  defaultMessage: "Up to 10 eloquence points"
167
166
  }),
168
167
  category: "ARGUMENT",
169
- contentKey: u.messages_count === 2 ? "alert.third_argument" : "alert.first_argument"
168
+ contentKey: d.messages_count === 2 ? "alert.third_argument" : "alert.first_argument"
170
169
  }
171
170
  );
172
171
  }
@@ -179,32 +178,32 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
179
178
  );
180
179
  }
181
180
  }));
182
- }, ke = () => {
181
+ }, qe = () => {
183
182
  const e = {
184
183
  content: q,
185
184
  rich_content: ae,
186
185
  source_ids: V?.map((t) => t.id),
187
- ...d && { position_id: d }
186
+ ...l && { position_id: l }
188
187
  };
189
188
  $(e, fe) && X.update("messages", se, e).then((t) => {
190
189
  if (t.data.success) {
191
- const l = t.data.data.resource;
190
+ const c = t.data.data.resource;
192
191
  let o = N;
193
192
  if (A?.is_reply || i) {
194
193
  const h = A?.message_id || A?.reply_to_id || M;
195
194
  h && (o = `argument_${h}_reply_list`);
196
- } else d && !m && (o = `argumentList${l.position?.id}`);
197
- if (!A?.is_reply && A?.position?.id != l.position?.id && !m) {
198
- const h = `argumentList${A.position.id}`, F = `argumentList${l.position.id}`;
199
- y.remove(h, [l]), y.add(F, [l]);
195
+ } else l && !m && (o = `argumentList${c.position?.id}`);
196
+ if (!A?.is_reply && A?.position?.id != c.position?.id && !m) {
197
+ const h = `argumentList${A.position.id}`, F = `argumentList${c.position.id}`;
198
+ L.remove(h, [c]), L.add(F, [c]);
200
199
  } else
201
- y.update(o, [l]);
202
- G && G(l), j(r.formatMessage({ id: "alert.argument_modify" }), {
200
+ L.update(o, [c]);
201
+ G && G(c), j(r.formatMessage({ id: "alert.argument_modify" }), {
203
202
  type: "success"
204
203
  }), me();
205
204
  }
206
205
  });
207
- }, qe = () => {
206
+ }, De = () => {
208
207
  if (!oe) {
209
208
  re(!0);
210
209
  const e = setTimeout(() => {
@@ -214,9 +213,9 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
214
213
  }
215
214
  }, O = () => {
216
215
  g ? Y({ loginAction: "argument" }) : ue(!0);
217
- }, De = () => {
216
+ }, Ue = () => {
218
217
  const e = T.find(
219
- (t) => t.id === d
218
+ (t) => t.id === l
220
219
  );
221
220
  if (e)
222
221
  return r.formatMessage(
@@ -228,7 +227,7 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
228
227
  );
229
228
  };
230
229
  return /* @__PURE__ */ C("div", { className: n.inputContainer, children: [
231
- R && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ce ? r.formatMessage({
230
+ J && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ce ? r.formatMessage({
232
231
  id: "input.argument_input.user_banned",
233
232
  defaultMessage: "You are banned from the debate space."
234
233
  }) : r.formatMessage({
@@ -249,9 +248,9 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
249
248
  defaultMessage: "Your position"
250
249
  }) }),
251
250
  /* @__PURE__ */ s(
252
- at,
251
+ st,
253
252
  {
254
- activeLabel: d === a[0].id ? 0 : d === a[1].id ? 1 : null,
253
+ activeLabel: l === a[0].id ? 0 : l === a[1].id ? 1 : null,
255
254
  firstLabel: a[0],
256
255
  secondLabel: a[1],
257
256
  onChange: (e) => b(a[e].id)
@@ -274,19 +273,19 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
274
273
  [n.argumentAuthorContainerActivated]: !m && I || i
275
274
  }),
276
275
  children: !m && I || i ? /* @__PURE__ */ s(
277
- st,
276
+ it,
278
277
  {
279
- avatarUrl: u.image_url,
280
- userName: u.full_name,
278
+ avatarUrl: d.image_url,
279
+ userName: d.full_name,
281
280
  size: pe
282
281
  }
283
282
  ) : /* @__PURE__ */ s(
284
- it,
283
+ ot,
285
284
  {
286
- fullName: u?.full_name || r.formatMessage({ id: "default_author.full_name" }),
287
- avatarUrl: u?.image_url,
288
- points: u?.points || 0,
289
- slug: u?.hash_id
285
+ fullName: d?.full_name || r.formatMessage({ id: "default_author.full_name" }),
286
+ avatarUrl: d?.image_url,
287
+ points: d?.points || 0,
288
+ slug: d?.hash_id
290
289
  }
291
290
  )
292
291
  }
@@ -301,41 +300,42 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
301
300
  }),
302
301
  children: [
303
302
  /* @__PURE__ */ s(
304
- ot,
303
+ rt,
305
304
  {
306
305
  handleChange: (e, t) => {
307
- $e(e, t);
306
+ Ve(e, t);
308
307
  },
309
308
  handleSourcesChange: (e) => {
310
- Ve(e);
309
+ ke(e);
311
310
  },
312
311
  placeholder: ve,
313
312
  "aria-label": r.formatMessage({
314
313
  id: "input.argument_input.aria_label",
315
314
  defaultMessage: "Message input field"
316
315
  }),
317
- onSubmit: Ee,
316
+ onSubmit: $e,
318
317
  sources: V,
319
318
  hideSourceAction: Me || g,
320
319
  uid: M ? `Reply${_}_${M}` : `Argument${_}`,
321
320
  onActivation: O,
322
321
  showStylesControls: I,
323
- disabled: R || g || ce,
322
+ disabled: J || g || ce,
324
323
  maxLength: g ? !1 : v?.actions?.argumentMaxLength,
325
324
  disableRichText: v?.actions?.disableRichText || g,
326
325
  shortBar: i,
327
326
  isReply: i,
327
+ resetSignal: Ne,
328
328
  hideSubmit: g,
329
329
  allowedDomains: v?.allowed_sources,
330
330
  active: P,
331
- autoFocus: Ne,
331
+ autoFocus: xe,
332
332
  hideCharCount: Ce,
333
333
  disableAutoActivate: we
334
334
  }
335
335
  ),
336
336
  E?.content && /* @__PURE__ */ s("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ s("div", { children: e }, t)) }),
337
337
  I && T?.find(
338
- (e) => e.id === d
338
+ (e) => e.id === l
339
339
  ) && /* @__PURE__ */ C(
340
340
  "div",
341
341
  {
@@ -345,7 +345,7 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
345
345
  ),
346
346
  children: [
347
347
  /* @__PURE__ */ s(
348
- rt,
348
+ ut,
349
349
  {
350
350
  name: "announcement",
351
351
  className: n.warningIcon,
@@ -353,7 +353,7 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
353
353
  width: 20
354
354
  }
355
355
  ),
356
- /* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children: De() })
356
+ /* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children: Ue() })
357
357
  ]
358
358
  }
359
359
  ),
@@ -394,5 +394,5 @@ const ut = ze(() => import("../../modal/side_modal/index.js").then((N) => ({ def
394
394
  ] });
395
395
  };
396
396
  export {
397
- Ft as ArgumentInput
397
+ Pt as ArgumentInput
398
398
  };
@@ -1,188 +1,189 @@
1
- import { jsxs as S, Fragment as re, jsx as e } from "react/jsx-runtime";
2
- import { ListNode as ie, ListItemNode as ne } from "@lexical/list";
3
- import { OverflowNode as se } from "@lexical/overflow";
4
- import { CharacterLimitPlugin as ce } from "@lexical/react/LexicalCharacterLimitPlugin";
5
- import { LexicalComposer as le } from "@lexical/react/LexicalComposer";
6
- import { ContentEditable as me } from "@lexical/react/LexicalContentEditable";
7
- import { EditorRefPlugin as ae } from "@lexical/react/LexicalEditorRefPlugin";
8
- import { LexicalErrorBoundary as de } from "@lexical/react/LexicalErrorBoundary";
9
- import { HistoryPlugin as ue } from "@lexical/react/LexicalHistoryPlugin";
10
- import { ListPlugin as fe } from "@lexical/react/LexicalListPlugin";
11
- import { OnChangePlugin as pe } from "@lexical/react/LexicalOnChangePlugin";
12
- import { RichTextPlugin as he } from "@lexical/react/LexicalRichTextPlugin";
13
- import { QuoteNode as ge } from "@lexical/rich-text";
14
- import M from "classnames";
15
- import { $getRoot as Se } from "lexical";
16
- import { useState as f, useId as xe, useRef as Pe, useEffect as w } from "react";
17
- import { useIntl as Ce } from "react-intl";
18
- import Te from "./EditorTheme.js";
1
+ import { jsxs as x, Fragment as it, jsx as t } from "react/jsx-runtime";
2
+ import { ListNode as nt, ListItemNode as st } from "@lexical/list";
3
+ import { OverflowNode as ct } from "@lexical/overflow";
4
+ import { CharacterLimitPlugin as lt } from "@lexical/react/LexicalCharacterLimitPlugin";
5
+ import { LexicalComposer as mt } from "@lexical/react/LexicalComposer";
6
+ import { ContentEditable as at } from "@lexical/react/LexicalContentEditable";
7
+ import { EditorRefPlugin as dt } from "@lexical/react/LexicalEditorRefPlugin";
8
+ import { LexicalErrorBoundary as ut } from "@lexical/react/LexicalErrorBoundary";
9
+ import { HistoryPlugin as ft } from "@lexical/react/LexicalHistoryPlugin";
10
+ import { ListPlugin as pt } from "@lexical/react/LexicalListPlugin";
11
+ import { OnChangePlugin as ht } from "@lexical/react/LexicalOnChangePlugin";
12
+ import { RichTextPlugin as gt } from "@lexical/react/LexicalRichTextPlugin";
13
+ import { QuoteNode as St } from "@lexical/rich-text";
14
+ import R from "classnames";
15
+ import { $getRoot as xt } from "lexical";
16
+ import { useState as p, useId as Pt, useRef as Ct, useEffect as w } from "react";
17
+ import { useIntl as Tt } from "react-intl";
18
+ import It from "./EditorTheme.js";
19
19
  import i from "./TextEditor.module.scss.js";
20
- import { AutoSavePlugin as Ie } from "./plugins/AutoSavePlugin.js";
21
- import { FocusPlugin as Ne } from "./plugins/FocusPlugin.js";
22
- import { IOSInsertParagraphFallbackPlugin as ve } from "./plugins/IOSInsertParagraphFallbackPlugin.js";
23
- import { MaxLengthPlugin as Ee } from "./plugins/MaxLengthPlugin.js";
24
- import { ResetPlugin as be } from "./plugins/ResetPlugin.js";
25
- import { SetContentPlugin as Re } from "./plugins/SetContentPlugin.js";
26
- import { SetRichContentPlugin as Me } from "./plugins/SetRichContentPlugin.js";
27
- import { ToolbarPlugin as we } from "./plugins/ToolbarPlugin.js";
28
- import { useModal as ye } from "../../dialog/modal/useModal.js";
29
- import { SourceModal as Le } from "../../source/source_modal/SourceModal.js";
30
- import { SourceListItem as _e } from "../../source/source_list_item/SourceListItem.js";
31
- const y = (l) => l?.replace(/&nbsp;/g, " "), mt = ({
20
+ import { AutoSavePlugin as Nt } from "./plugins/AutoSavePlugin.js";
21
+ import { FocusPlugin as vt } from "./plugins/FocusPlugin.js";
22
+ import { IOSInsertParagraphFallbackPlugin as Et } from "./plugins/IOSInsertParagraphFallbackPlugin.js";
23
+ import { MaxLengthPlugin as bt } from "./plugins/MaxLengthPlugin.js";
24
+ import { ResetPlugin as Mt } from "./plugins/ResetPlugin.js";
25
+ import { SetContentPlugin as Rt } from "./plugins/SetContentPlugin.js";
26
+ import { SetRichContentPlugin as wt } from "./plugins/SetRichContentPlugin.js";
27
+ import { ToolbarPlugin as Lt } from "./plugins/ToolbarPlugin.js";
28
+ import { useModal as _t } from "../../dialog/modal/useModal.js";
29
+ import { SourceModal as yt } from "../../source/source_modal/SourceModal.js";
30
+ import { SourceListItem as At } from "../../source/source_list_item/SourceListItem.js";
31
+ const L = (l) => l?.replace(/&nbsp;/g, " "), ae = ({
32
32
  placeholder: l,
33
- initialContent: L,
34
- initialRichContent: _,
35
- onSubmit: x,
36
- sources: p,
33
+ initialContent: _,
34
+ initialRichContent: y,
35
+ onSubmit: P,
36
+ sources: h,
37
37
  hideSubmit: A = !1,
38
38
  hideSourceAction: O = !1,
39
39
  onActivation: n,
40
40
  disabled: k = !1,
41
- handleChange: P,
42
- handleSourcesChange: h,
41
+ handleChange: C,
42
+ handleSourcesChange: g,
43
43
  shortBar: B = !1,
44
- active: g = !1,
44
+ active: S = !1,
45
45
  maxLength: m,
46
46
  disableRichText: U = !1,
47
47
  editorRef: j,
48
- uid: C,
49
- allowedDomains: T = [],
48
+ uid: T,
49
+ allowedDomains: I = [],
50
50
  hideCharCount: z = !1,
51
51
  disableAutoActivate: F = !1,
52
52
  autoFocus: a = !1,
53
- isReply: I = !1,
54
- ...H
53
+ isReply: d = !1,
54
+ resetSignal: H,
55
+ ...J
55
56
  }) => {
56
- const [s, J] = f(a || g), [Q, W] = f(""), [$, q] = f(""), [d, u] = f([]), { showModal: D } = ye(), N = Ce(), v = xe(), E = Pe(!1);
57
+ const [s, Q] = p(a || S), [W, $] = p(""), [q, D] = p(""), [u, f] = p([]), { showModal: G } = _t(), N = Tt(), v = Pt(), E = Ct(!1);
57
58
  w(() => {
58
59
  a && !E.current && n && (E.current = !0, n());
59
60
  }, [a, n]), w(() => {
60
- p && u(p);
61
- }, [p]);
61
+ h && f(h);
62
+ }, [h]);
62
63
  const b = () => {
63
- s || (J(!0), n && n());
64
- }, G = {
64
+ s || (Q(!0), n && n());
65
+ }, K = {
65
66
  editable: !k,
66
- theme: Te,
67
- onError(t) {
68
- console.error("TextEditor error:", t);
67
+ theme: It,
68
+ onError(e) {
69
+ console.error("TextEditor error:", e);
69
70
  },
70
- nodes: [ie, ne, ge, se]
71
- }, K = () => {
71
+ nodes: [nt, st, St, ct]
72
+ }, V = () => {
72
73
  b();
73
- }, V = (t) => {
74
- t.read(() => {
75
- const o = Se().getTextContent(), r = y(o), c = JSON.stringify(t), R = y(c);
76
- W(r), q(R), P && P(r, R);
74
+ }, X = (e) => {
75
+ e.read(() => {
76
+ const o = xt().getTextContent(), r = L(o), c = JSON.stringify(e), M = L(c);
77
+ $(r), D(M), C && C(r, M);
77
78
  });
78
- }, X = (t) => {
79
- const o = Q, r = $, c = d;
80
- x && (t.preventDefault(), x(o, r, c)), u([]), h?.([]);
81
- }, Y = () => {
82
- D(
83
- /* @__PURE__ */ e(
84
- Le,
79
+ }, Y = (e) => {
80
+ const o = W, r = q, c = u;
81
+ P && (e.preventDefault(), P(o, r, c)), f([]), g?.([]);
82
+ }, Z = () => {
83
+ G(
84
+ /* @__PURE__ */ t(
85
+ yt,
85
86
  {
86
- onAddSource: Z,
87
- allowedSources: T
87
+ onAddSource: tt,
88
+ allowedSources: I
88
89
  }
89
90
  )
90
91
  );
91
- }, Z = (t) => {
92
- u((o) => {
93
- const r = [...o, t];
94
- return h?.(r), r;
92
+ }, tt = (e) => {
93
+ f((o) => {
94
+ const r = [...o, e];
95
+ return g?.(r), r;
95
96
  });
96
- }, ee = (t) => {
97
- u((o) => {
97
+ }, et = (e) => {
98
+ f((o) => {
98
99
  const r = o.filter(
99
- (c) => c.source_url !== t.source_url
100
+ (c) => c.source_url !== e.source_url
100
101
  );
101
- return h?.(r), r;
102
+ return g?.(r), r;
102
103
  });
103
- }, te = (t, o) => /* @__PURE__ */ e(
104
- _e,
104
+ }, ot = (e, o) => /* @__PURE__ */ t(
105
+ At,
105
106
  {
106
- publisher: t.publisher,
107
- url: t.source_url,
108
- title: t.title,
107
+ publisher: e.publisher,
108
+ url: e.source_url,
109
+ title: e.title,
109
110
  index: o,
110
- onRemove: () => ee(t)
111
+ onRemove: () => et(e)
111
112
  },
112
113
  o
113
- ), oe = () => /* @__PURE__ */ e("div", { className: i.editorPlaceholder, children: l });
114
- return /* @__PURE__ */ S(re, { children: [
115
- /* @__PURE__ */ e(le, { initialConfig: G, children: /* @__PURE__ */ e("div", { className: i.editorContainer, onClick: K, children: /* @__PURE__ */ S(
114
+ ), rt = () => /* @__PURE__ */ t("div", { className: i.editorPlaceholder, children: l });
115
+ return /* @__PURE__ */ x(it, { children: [
116
+ /* @__PURE__ */ t(mt, { initialConfig: K, children: /* @__PURE__ */ t("div", { className: i.editorContainer, onClick: V, children: /* @__PURE__ */ x(
116
117
  "div",
117
118
  {
118
- className: M(i.editorInner, {
119
- [i.editorInnerInactive]: !s && !g
119
+ className: R(i.editorInner, {
120
+ [i.editorInnerInactive]: !s && !S
120
121
  }),
121
122
  children: [
122
- /* @__PURE__ */ e(
123
- he,
123
+ /* @__PURE__ */ t(
124
+ gt,
124
125
  {
125
- contentEditable: /* @__PURE__ */ e(
126
- me,
126
+ contentEditable: /* @__PURE__ */ t(
127
+ at,
127
128
  {
128
- className: M(i.editorInput, {
129
+ className: R(i.editorInput, {
129
130
  [i.editorInputInactive]: !s
130
131
  }),
131
- ...H
132
+ ...J
132
133
  }
133
134
  ),
134
- placeholder: l && /* @__PURE__ */ e(oe, {}),
135
- ErrorBoundary: de
135
+ placeholder: l && /* @__PURE__ */ t(rt, {}),
136
+ ErrorBoundary: ut
136
137
  }
137
138
  ),
138
- /* @__PURE__ */ e(
139
- we,
139
+ /* @__PURE__ */ t(
140
+ Lt,
140
141
  {
141
142
  hideSourceAction: O,
142
143
  hideSubmit: A,
143
144
  disableRichText: U,
144
145
  shortBar: B,
145
- onSubmit: X,
146
- onAddSource: Y,
147
- isActive: s || g,
148
- sourceTooltip: T?.length > 0 && N.formatMessage({
146
+ onSubmit: Y,
147
+ onAddSource: Z,
148
+ isActive: s || S,
149
+ sourceTooltip: I?.length > 0 && N.formatMessage({
149
150
  id: "input.allowed_domains_tooltip",
150
151
  defaultMessage: "With the new source function, you can add links to your article."
151
152
  })
152
153
  }
153
154
  ),
154
- s && m && !z && /* @__PURE__ */ S("div", { className: i.charactersCount, children: [
155
- /* @__PURE__ */ e(ce, { maxLength: m }),
155
+ s && m && !z && /* @__PURE__ */ x("div", { className: i.charactersCount, children: [
156
+ /* @__PURE__ */ t(lt, { maxLength: m }),
156
157
  " ",
157
158
  N.formatMessage({
158
159
  id: "input.remaining_chars",
159
160
  defaultMessage: "remaining characters"
160
161
  })
161
162
  ] }),
162
- /* @__PURE__ */ e(fe, {}),
163
- /* @__PURE__ */ e(ue, {}),
164
- /* @__PURE__ */ e(pe, { onChange: V, ignoreSelectionChange: !0 }),
165
- /* @__PURE__ */ e(
166
- Ie,
163
+ /* @__PURE__ */ t(pt, {}),
164
+ /* @__PURE__ */ t(ft, {}),
165
+ /* @__PURE__ */ t(ht, { onChange: X, ignoreSelectionChange: !0 }),
166
+ /* @__PURE__ */ t(
167
+ Nt,
167
168
  {
168
169
  onSetContent: F ? () => {
169
170
  } : b,
170
- storageUid: C || v
171
+ storageUid: T || v
171
172
  }
172
173
  ),
173
- /* @__PURE__ */ e(Re, { content: L, isReply: I }),
174
- /* @__PURE__ */ e(Me, { richContent: _, isReply: I }),
175
- /* @__PURE__ */ e(Ne, { autoFocus: a }),
176
- /* @__PURE__ */ e(ve, {}),
177
- m && /* @__PURE__ */ e(Ee, { maxLength: m }),
178
- /* @__PURE__ */ e(be, { storageUid: C || v }),
179
- /* @__PURE__ */ e(ae, { editorRef: j })
174
+ /* @__PURE__ */ t(Rt, { content: _, isReply: d }),
175
+ /* @__PURE__ */ t(wt, { richContent: y, isReply: d }),
176
+ /* @__PURE__ */ t(vt, { autoFocus: a, isReply: d }),
177
+ /* @__PURE__ */ t(Et, {}),
178
+ m && /* @__PURE__ */ t(bt, { maxLength: m }),
179
+ /* @__PURE__ */ t(Mt, { storageUid: T || v, resetSignal: H, isReply: d }),
180
+ /* @__PURE__ */ t(dt, { editorRef: j })
180
181
  ]
181
182
  }
182
183
  ) }) }),
183
- d && d.length !== 0 ? /* @__PURE__ */ e("div", { className: i.sourcesBox, children: /* @__PURE__ */ e("div", { className: i.sourceList, children: d.map(te) }) }) : null
184
+ u && u.length !== 0 ? /* @__PURE__ */ t("div", { className: i.sourcesBox, children: /* @__PURE__ */ t("div", { className: i.sourceList, children: u.map(ot) }) }) : null
184
185
  ] });
185
186
  };
186
187
  export {
187
- mt as TextEditor
188
+ ae as TextEditor
188
189
  };
@@ -1,34 +1,32 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { useLexicalComposerContext as f } from "@lexical/react/LexicalComposerContext";
3
- import { OnChangePlugin as d } from "@lexical/react/LexicalOnChangePlugin";
4
- import g from "@rooks/use-localstorage-state";
5
- import { useEffect as u } from "react";
6
- import { useDebouncedCallback as S } from "use-debounce";
7
- const O = ({ storageUid: r, onSetContent: n }) => {
8
- const [o] = f(), [t, i, l] = g(
9
- `TextEditor:content_${r}`,
10
- {}
11
- );
12
- u(() => {
13
- if (t && Object.keys(t).length !== 0) {
14
- const e = o.parseEditorState(t.editorState);
15
- o.setEditorState(e), n?.();
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { useLexicalComposerContext as c } from "@lexical/react/LexicalComposerContext";
3
+ import { OnChangePlugin as s } from "@lexical/react/LexicalOnChangePlugin";
4
+ import { useEffect as m } from "react";
5
+ import { useDebouncedCallback as g } from "use-debounce";
6
+ const C = ({ storageUid: r, onSetContent: n }) => {
7
+ const [e] = c(), o = `TextEditor:content_${r}`;
8
+ m(() => {
9
+ try {
10
+ const t = JSON.parse(localStorage.getItem(o));
11
+ t?.editorState && (e.setEditorState(e.parseEditorState(t.editorState)), n?.());
12
+ } catch {
16
13
  }
17
14
  }, []);
18
- const s = S(
19
- (e, a) => {
20
- e.read(() => {
21
- const c = {
22
- editorState: JSON.stringify(a.getEditorState())
23
- };
24
- i(c);
25
- });
15
+ const a = g(
16
+ (t) => {
17
+ try {
18
+ localStorage.setItem(
19
+ o,
20
+ JSON.stringify({ editorState: JSON.stringify(t) })
21
+ );
22
+ } catch {
23
+ }
26
24
  },
27
25
  1e3,
28
26
  !1
29
27
  );
30
- return /* @__PURE__ */ m(d, { onChange: s, ignoreSelectionChange: !0 });
28
+ return /* @__PURE__ */ i(s, { onChange: a, ignoreSelectionChange: !0 });
31
29
  };
32
30
  export {
33
- O as AutoSavePlugin
31
+ C as AutoSavePlugin
34
32
  };
@@ -1,10 +1,10 @@
1
- import { useLexicalComposerContext as u } from "@lexical/react/LexicalComposerContext";
2
- import { useRef as c, useEffect as n } from "react";
3
- import { useInput as l } from "../../input_provider/useInput.js";
4
- const p = ({ autoFocus: o = !1 }) => {
5
- const [e] = u(), { focus: t } = l(), r = c(!1);
1
+ import { useLexicalComposerContext as c } from "@lexical/react/LexicalComposerContext";
2
+ import { useRef as l, useEffect as n } from "react";
3
+ import { useInput as f } from "../../input_provider/useInput.js";
4
+ const E = ({ autoFocus: o = !1, isReply: s = !1 }) => {
5
+ const [e] = c(), { focus: t } = f(), r = l(!1);
6
6
  return n(() => {
7
- t && e.focus(() => {
7
+ t && !s && e.focus(() => {
8
8
  e.getRootElement().focus({ preventScroll: !0 });
9
9
  });
10
10
  }, [t, e]), n(() => {
@@ -14,5 +14,5 @@ const p = ({ autoFocus: o = !1 }) => {
14
14
  }, [o, e]), null;
15
15
  };
16
16
  export {
17
- p as FocusPlugin
17
+ E as FocusPlugin
18
18
  };
@@ -1,23 +1,25 @@
1
- import { useLexicalComposerContext as p } from "@lexical/react/LexicalComposerContext";
2
- import m from "@rooks/use-localstorage-state";
3
- import { $addUpdateTag as i, $getRoot as l, $createParagraphNode as f } from "lexical";
4
- import { useEffect as d } from "react";
5
- import { useInput as u } from "../../input_provider/useInput.js";
6
- const L = ({ storageUid: s }) => {
7
- const [n] = p(), { reset: t, setReset: a } = u(), [g, x, c] = m(
8
- `TextEditor:content_${s}`,
9
- {}
10
- );
11
- return d(() => {
12
- t && n.update(() => {
13
- i("skip-dom-selection");
14
- const e = l(), o = f();
15
- e.clear(), e.append(o);
16
- const r = o.selectStart();
17
- r.format = 0, r.style = "", c(), a(!1);
1
+ import { useLexicalComposerContext as f } from "@lexical/react/LexicalComposerContext";
2
+ import { $addUpdateTag as l, $getRoot as u, $createParagraphNode as d } from "lexical";
3
+ import { useRef as R, useEffect as g } from "react";
4
+ import { useInput as h } from "../../input_provider/useInput.js";
5
+ const E = ({ storageUid: a, resetSignal: t, isReply: n = !1 }) => {
6
+ const [p] = f(), { reset: e, setReset: i } = h(), o = R(t);
7
+ return g(() => {
8
+ const m = t !== void 0 && t !== o.current;
9
+ o.current = t, (m || e && !n) && p.update(() => {
10
+ l("skip-dom-selection");
11
+ const r = u(), s = d();
12
+ r.clear(), r.append(s);
13
+ const c = s.selectStart();
14
+ c.format = 0, c.style = "";
15
+ try {
16
+ localStorage.removeItem(`TextEditor:content_${a}`);
17
+ } catch {
18
+ }
19
+ e && i(!1);
18
20
  });
19
- }, [t]), null;
21
+ }, [t, e]), null;
20
22
  };
21
23
  export {
22
- L as ResetPlugin
24
+ E as ResetPlugin
23
25
  };
@@ -1,9 +1,9 @@
1
1
  import { jsx as f, Fragment as I } from "react/jsx-runtime";
2
- import L from "@rooks/use-sessionstorage-state";
3
- import { flatten as O } from "flat";
4
- import { useState as u, useEffect as P } from "react";
5
- import { IntlProvider as b } from "react-intl";
6
- import { IntlContext as y } from "./IntlContext.js";
2
+ import { flatten as L } from "flat";
3
+ import { useState as u, useEffect as O } from "react";
4
+ import { IntlProvider as P } from "react-intl";
5
+ import { IntlContext as b } from "./IntlContext.js";
6
+ import { useSessionStorageState as y } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
7
7
  const R = ({
8
8
  language: l,
9
9
  locales: t,
@@ -12,7 +12,7 @@ const R = ({
12
12
  children: g,
13
13
  onError: p
14
14
  }) => {
15
- const [s, h] = L(
15
+ const [s, h] = y(
16
16
  "logora:locale",
17
17
  null
18
18
  ), v = () => {
@@ -21,7 +21,7 @@ const R = ({
21
21
  if (l)
22
22
  return l;
23
23
  }, x = () => !o && e in t ? t[e] : {}, [e, S] = u(v()), [c, d] = u(x());
24
- P(() => {
24
+ O(() => {
25
25
  e && (o && e in t && t[e]().then((r) => {
26
26
  d(r?.default || r);
27
27
  }).catch(() => d({})), s !== e && h(e));
@@ -32,12 +32,12 @@ const R = ({
32
32
  Object.keys(a).indexOf(i) > -1 && (n[i] = a[i]);
33
33
  }), n;
34
34
  }, m = () => /* @__PURE__ */ f(
35
- b,
35
+ P,
36
36
  {
37
37
  locale: e,
38
- messages: j(O(c)),
38
+ messages: j(L(c)),
39
39
  onError: p,
40
- children: /* @__PURE__ */ f(y.Provider, { value: { locale: e, setLocale: S }, children: g })
40
+ children: /* @__PURE__ */ f(b.Provider, { value: { locale: e, setLocale: S }, children: g })
41
41
  }
42
42
  );
43
43
  return /* @__PURE__ */ f(I, { children: o && typeof window < "u" ? Object.keys(c).length > 0 ? m() : null : m() });
@@ -1,15 +1,15 @@
1
1
  import { jsx as e, jsxs as g, Fragment as P } from "react/jsx-runtime";
2
- import z from "@rooks/use-sessionstorage-state";
3
- import H from "classnames";
2
+ import z from "classnames";
4
3
  import { useState as l, useRef as b, useEffect as c } from "react";
5
- import { useIntl as K, FormattedMessage as n } from "react-intl";
4
+ import { useIntl as H, FormattedMessage as n } from "react-intl";
6
5
  import t from "./SuggestionInput.module.scss.js";
7
- import { useDataProvider as Q } from "../../data/data_provider/useDataProvider.js";
8
- import { useList as W } from "../../list/list_provider/useList.js";
9
- import { useToast as X } from "../../dialog/toast_provider/useToast.js";
10
- import { useAuth as Z } from "../../auth/use_auth/useAuth.js";
11
- import { useInput as $ } from "../../input/input_provider/useInput.js";
12
- import { useFormValidation as G } from "../../forms/use_form_validation/useFormValidation.js";
6
+ import { useDataProvider as K } from "../../data/data_provider/useDataProvider.js";
7
+ import { useList as Q } from "../../list/list_provider/useList.js";
8
+ import { useToast as W } from "../../dialog/toast_provider/useToast.js";
9
+ import { useAuth as X } from "../../auth/use_auth/useAuth.js";
10
+ import { useInput as Z } from "../../input/input_provider/useInput.js";
11
+ import { useFormValidation as $ } from "../../forms/use_form_validation/useFormValidation.js";
12
+ import { useSessionStorageState as G } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
13
13
  import { useAuthRequired as U } from "../../hooks/use_auth_required/useAuthRequired.js";
14
14
  import { TextInput as ee } from "../../input/text_input/TextInput.js";
15
15
  import { Button as se } from "../../action/button/Button.js";
@@ -21,7 +21,7 @@ const ve = ({
21
21
  userGuideUrl: d,
22
22
  hideUserGuideLink: N = !1
23
23
  }) => {
24
- const o = K(), C = Q(), x = W(), { toast: T } = X() || {}, { isLoggedIn: y } = Z(), { focus: f, setFocus: q } = $(), { errors: p, validate: F } = G(), [h, E] = l(!0), [Y, v] = l(!1), [i, a] = l(""), [S, k, A] = z("userSuggestion", {}), R = b(null), u = b(null), V = U();
24
+ const o = H(), C = K(), x = Q(), { toast: T } = W() || {}, { isLoggedIn: y } = X(), { focus: f, setFocus: q } = Z(), { errors: p, validate: F } = $(), [h, E] = l(!0), [Y, v] = l(!1), [i, a] = l(""), [S, k, A] = G("userSuggestion", {}), R = b(null), u = b(null), V = U();
25
25
  c(() => {
26
26
  S?.suggestion && a(S.suggestion);
27
27
  }, []), c(() => {
@@ -88,7 +88,7 @@ const ve = ({
88
88
  className: t.suggestionInputContainer,
89
89
  ref: R,
90
90
  children: /* @__PURE__ */ g(P, { children: [
91
- /* @__PURE__ */ g("div", { className: H(t.suggestionInputItem), children: [
91
+ /* @__PURE__ */ g("div", { className: z(t.suggestionInputItem), children: [
92
92
  /* @__PURE__ */ e("div", { className: t.suggestionInputTitle, children: /* @__PURE__ */ e(
93
93
  n,
94
94
  {
@@ -1,11 +1,11 @@
1
1
  import { jsx as s, Fragment as pe, jsxs as c } from "react/jsx-runtime";
2
- import P from "@rooks/use-sessionstorage-state";
3
2
  import d from "classnames";
4
3
  import { useState as N, useEffect as T } from "react";
5
4
  import { useIntl as _e, FormattedMessage as f } from "react-intl";
6
5
  import { useLocation as Ne } from "react-router";
7
6
  import o from "./VoteBox.module.scss.js";
8
7
  import { useTranslatedContent as j } from "../../translation/translated_content/useTranslatedContent.js";
8
+ import { useSessionStorageState as P } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
9
9
  import { useToast as be } from "../../dialog/toast_provider/useToast.js";
10
10
  import { useAuthRequired as Se } from "../../hooks/use_auth_required/useAuthRequired.js";
11
11
  import { useDataProvider as we } from "../../data/data_provider/useDataProvider.js";
package/dist/index.js CHANGED
@@ -160,10 +160,11 @@ import { useReportContent as rm } from "./components/user_content/use_report_con
160
160
  import { useResponsive as tm } from "./components/hooks/use_responsive/useResponsive.js";
161
161
  import { useRichContent as mm } from "./components/argument/argument/useRichContent.js";
162
162
  import { useRoutes as fm } from "./components/data/config_provider/useRoutes.js";
163
- import { useToast as am } from "./components/dialog/toast_provider/useToast.js";
164
- import { useVote as sm } from "./components/vote/use_vote/useVote.js";
165
- import { utf8ToBase64url as dm } from "./components/auth/use_auth/base64.js";
166
- import { withConfig as gm } from "./components/data/config_provider/withConfig.js";
163
+ import { useSessionStorageState as am } from "./components/hooks/use_session_storage_state/useSessionStorageState.js";
164
+ import { useToast as sm } from "./components/dialog/toast_provider/useToast.js";
165
+ import { useVote as dm } from "./components/vote/use_vote/useVote.js";
166
+ import { utf8ToBase64url as gm } from "./components/auth/use_auth/base64.js";
167
+ import { withConfig as Bm } from "./components/data/config_provider/withConfig.js";
167
168
  export {
168
169
  a as ActionBar,
169
170
  s as AdUnit,
@@ -338,10 +339,11 @@ export {
338
339
  tm as useResponsive,
339
340
  mm as useRichContent,
340
341
  fm as useRoutes,
341
- am as useToast,
342
+ am as useSessionStorageState,
343
+ sm as useToast,
342
344
  mx as useTranslatedContent,
343
- sm as useVote,
344
- dm as utf8ToBase64url,
345
+ dm as useVote,
346
+ gm as utf8ToBase64url,
345
347
  F as withAuth,
346
- gm as withConfig
348
+ Bm as withConfig
347
349
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.4.75",
3
+ "version": "0.4.77",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",
@@ -64,9 +64,7 @@
64
64
  "@lexical/rich-text": "^0.45.0",
65
65
  "@lexical/selection": "^0.45.0",
66
66
  "@lexical/utils": "^0.45.0",
67
- "@rooks/use-localstorage-state": "^4.11.2",
68
67
  "@rooks/use-previous": "^4.11.2",
69
- "@rooks/use-sessionstorage-state": "^4.11.2",
70
68
  "axios": "^1.15.2",
71
69
  "chart.js": "^4.5.1",
72
70
  "chartjs-plugin-datalabels": "^2.2.0",