@logora/debate 0.4.109 → 0.4.111

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.
@@ -0,0 +1 @@
1
+ ._body_14nv4_3{display:flex;flex-direction:column;align-items:center;text-align:center;gap:1em;padding-top:var(--spacer-xxs, calc(var(--space-unit, 1em) * .25))!important;padding-bottom:var(--spacer-xxs, calc(var(--space-unit, 1em) * .25))!important;padding-right:var(--spacer-xxs, calc(var(--space-unit, 1em) * .25))!important;padding-left:var(--spacer-xxs, calc(var(--space-unit, 1em) * .25))!important}._title_14nv4_15{font-weight:700;font-size:1.2em}
@@ -1,44 +1,50 @@
1
- import { jsx as t, Fragment as _ } from "react/jsx-runtime";
1
+ import { jsx as t, Fragment as C } from "react/jsx-runtime";
2
2
  import { useState as h, useEffect as m } from "react";
3
- import w from "./AuthModal.module.scss.js";
4
- import { useConfig as I } from "../../data/config_provider/useConfig.js";
5
- import { useModal as y } from "../../dialog/modal/useModal.js";
6
- import { useAuth as C } from "../use_auth/useAuth.js";
7
- import { useAuthActions as E } from "../use_auth/useAuthActions.js";
8
- import { httpClient as P } from "../../data/http_client/httpClient.js";
9
- import { Modal as T } from "../../dialog/modal/Modal.js";
10
- import { Loader as R } from "../../progress/loader/Loader.js";
11
- import { SocialAuthForm as B } from "../social_auth_form/SocialAuthForm.js";
12
- import { SSOForm as L } from "../sso_form/SSOForm.js";
13
- import { AuthProviderFactory as M } from "../providers/AuthProviderFactory.js";
14
- const $ = ({ onHideModal: s = null }) => {
15
- const o = I(), { hideModal: c } = y(), { isLoggedIn: l, authError: r } = C(), [p, n] = h(!1), [e, d] = h(null), { loginUser: g } = E(
16
- P,
3
+ import E from "./AuthModal.module.scss.js";
4
+ import { useConfig as P } from "../../data/config_provider/useConfig.js";
5
+ import { useModal as T } from "../../dialog/modal/useModal.js";
6
+ import { useAuth as L } from "../use_auth/useAuth.js";
7
+ import { useAuthActions as R } from "../use_auth/useAuthActions.js";
8
+ import { httpClient as B } from "../../data/http_client/httpClient.js";
9
+ import { Modal as M } from "../../dialog/modal/Modal.js";
10
+ import { Loader as O } from "../../progress/loader/Loader.js";
11
+ import { SocialAuthForm as b } from "../social_auth_form/SocialAuthForm.js";
12
+ import { SSOForm as N } from "../sso_form/SSOForm.js";
13
+ import { AuthProviderFactory as S } from "../providers/AuthProviderFactory.js";
14
+ const V = ({
15
+ onHideModal: s = null,
16
+ title: c,
17
+ text: p,
18
+ buttonLabel: d,
19
+ url: g
20
+ }) => {
21
+ const o = P(), { hideModal: f } = T(), { isLoggedIn: l, authError: r } = L(), [A, n] = h(!1), [e, U] = h(null), { loginUser: v } = R(
22
+ B,
17
23
  process.env.API_AUTH_URL,
18
24
  "logora_user_token"
19
25
  );
20
26
  m(() => {
21
- l && f();
27
+ l && _();
22
28
  }, [l]), m(() => {
23
29
  e && r && n(!1);
24
30
  }, [e, r]);
25
- const f = () => {
26
- c(), s && s();
27
- }, A = (i, a, u) => {
28
- d(u), n(!0), U(i, a);
29
- }, U = (i, a) => {
30
- const v = M.create(
31
+ const _ = () => {
32
+ f(), s && s();
33
+ }, w = (i, a, u) => {
34
+ U(u), n(!0), I(i, a);
35
+ }, I = (i, a) => {
36
+ const y = S.create(
31
37
  o.auth?.type,
32
38
  o.shortname,
33
39
  i,
34
40
  a
35
41
  ).getAuthorizationParams();
36
- g(v);
42
+ v(y);
37
43
  };
38
- return /* @__PURE__ */ t(T, { "data-vid": "login_modal", children: /* @__PURE__ */ t("div", { className: w.loginModalBody, children: p ? /* @__PURE__ */ t(R, {}) : /* @__PURE__ */ t(_, { children: o.auth.type === "form" || o.auth.type === "social" ? /* @__PURE__ */ t(
39
- B,
44
+ return /* @__PURE__ */ t(M, { "data-vid": "login_modal", children: /* @__PURE__ */ t("div", { className: E.loginModalBody, children: A ? /* @__PURE__ */ t(O, {}) : /* @__PURE__ */ t(C, { children: o.auth.type === "form" || o.auth.type === "social" ? /* @__PURE__ */ t(
45
+ b,
40
46
  {
41
- onSubmit: A,
47
+ onSubmit: w,
42
48
  error: r,
43
49
  lastStep: e,
44
50
  facebookClientId: process.env.FACEBOOK_CLIENT_ID,
@@ -51,7 +57,7 @@ const $ = ({ onHideModal: s = null }) => {
51
57
  privacyUrl: o.provider?.privacyUrl || "https://www.logora.com/blog-posts/privacy-policy"
52
58
  }
53
59
  ) : /* @__PURE__ */ t(
54
- L,
60
+ N,
55
61
  {
56
62
  authType: o.auth.type,
57
63
  error: r && e === "OAUTH2",
@@ -60,7 +66,10 @@ const $ = ({ onHideModal: s = null }) => {
60
66
  scope: o.auth.scope,
61
67
  logoUrl: o.logo_url,
62
68
  loginUrl: o.auth.login_url,
63
- signupUrl: o.auth.registration_url || o.auth.login_url,
69
+ signupUrl: g || o.auth.registration_url || o.auth.login_url,
70
+ title: c,
71
+ subtitle: p,
72
+ signupLabel: d,
64
73
  termsUrl: o.provider?.cguUrl || "https://www.logora.com/blog-posts/cgu",
65
74
  redirectParameter: o.auth.redirectParameter,
66
75
  trackingParameters: o.auth.trackingParameters,
@@ -74,5 +83,5 @@ const $ = ({ onHideModal: s = null }) => {
74
83
  ) }) }) });
75
84
  };
76
85
  export {
77
- $ as AuthModal
86
+ V as AuthModal
78
87
  };
@@ -1,16 +1,16 @@
1
1
  import { jsxs as n, jsx as e, Fragment as m } from "react/jsx-runtime";
2
- import G from "classnames";
2
+ import z from "classnames";
3
3
  import "react";
4
- import { useIntl as D, FormattedMessage as w } from "react-intl";
5
- import { useLocation as Y } from "react-router";
4
+ import { useIntl as H, FormattedMessage as w } from "react-intl";
5
+ import { useLocation as K } from "react-router";
6
6
  import a from "./SSOForm.module.scss.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
- import { utf8ToBase64url as $ } from "../use_auth/base64.js";
13
- const ie = ({
7
+ import { useSessionStorageState as V } from "../../hooks/use_session_storage_state/useSessionStorageState.js";
8
+ import { Icon as W } from "../../icons/icon/Icon.js";
9
+ import { Button as $ } from "../../action/button/Button.js";
10
+ import { Toggle as q } from "../../input/toggle/Toggle.js";
11
+ import { EMAIL_CONSENT_STORAGE_KEY as J } from "../use_auth/useAuthActions.js";
12
+ import { utf8ToBase64url as Q } from "../use_auth/base64.js";
13
+ const de = ({
14
14
  authType: v,
15
15
  providerName: c,
16
16
  loginUrl: M,
@@ -27,41 +27,44 @@ const ie = ({
27
27
  showEmailConsent: g = !1,
28
28
  showTerms: L = !1,
29
29
  hideBelowButton: x = !1,
30
- error: R = !1
30
+ error: R = !1,
31
+ title: T,
32
+ subtitle: A,
33
+ signupLabel: C
31
34
  }) => {
32
- const [h, T] = g ? z(W, !1) : [!1, () => {
33
- }], o = D(), d = Y(), A = (t) => {
35
+ const [h, B] = g ? V(J, !1) : [!1, () => {
36
+ }], o = H(), d = K(), O = (t) => {
34
37
  if (typeof window < "u") {
35
- const s = t === "CURRENT_LOCATION" ? window.location : t, i = new URL(s, window.location.origin), l = i.searchParams, E = new URLSearchParams(d.search);
38
+ const s = t === "CURRENT_LOCATION" ? window.location : t, i = new URL(s, window.location.origin), l = i.searchParams, G = new URLSearchParams(d.search);
36
39
  l.has("code") && l.delete("code"), f && l.append(f, window.location.toString());
37
- for (const [_, F] of Object.entries(P)) {
38
- let r = F;
40
+ for (const [_, D] of Object.entries(P)) {
41
+ let r = D;
39
42
  if (r) {
40
- const j = d.pathname.slice(
43
+ const Y = d.pathname.slice(
41
44
  0,
42
45
  d.pathname.lastIndexOf("/")
43
46
  );
44
47
  r = r.replace(
45
48
  "{{UTM_CAMPAIGN}}",
46
- E.get("utm_campaign")
49
+ G.get("utm_campaign")
47
50
  ), r = r.replace(
48
51
  "{{CURRENT_PATH}}",
49
- decodeURIComponent(j)
52
+ decodeURIComponent(Y)
50
53
  );
51
54
  }
52
- _ === "metadata" && r && (r = $(r)), l.append(_, r);
55
+ _ === "metadata" && r && (r = Q(r)), l.append(_, r);
53
56
  }
54
57
  return i.search = l.toString(), i.toString();
55
58
  }
56
59
  return "";
57
- }, C = (t) => {
60
+ }, E = (t) => {
58
61
  const s = new URL(t);
59
62
  if (s.searchParams.delete("code"), s.searchParams.append("client_id", S), s.searchParams.append("redirect_uri", y), s.searchParams.append("scope", I), s.searchParams.append("response_type", "code"), typeof window < "u") {
60
63
  const i = new URL(window.location.href);
61
64
  i.searchParams.delete("code"), s.searchParams.append("state", window.btoa(i.toString()));
62
65
  }
63
66
  return s.href;
64
- }, p = (t) => v === "oauth2_server" ? C(t) : A(t), B = p(M), O = p(b);
67
+ }, p = (t) => v === "oauth2_server" ? E(t) : O(t), F = p(M), j = p(b);
65
68
  return /* @__PURE__ */ n("div", { className: a.ssoForm, children: [
66
69
  /* @__PURE__ */ e("div", { className: a.logo, children: u ? /* @__PURE__ */ e(
67
70
  "img",
@@ -73,7 +76,7 @@ const ie = ({
73
76
  alt: `Logo ${c}`
74
77
  }
75
78
  ) : /* @__PURE__ */ e(
76
- H,
79
+ W,
77
80
  {
78
81
  name: "next",
79
82
  "aria-hidden": "true",
@@ -84,13 +87,13 @@ const ie = ({
84
87
  ) }),
85
88
  /* @__PURE__ */ n("div", { className: a.mainText, children: [
86
89
  /* @__PURE__ */ n("div", { className: a.title, children: [
87
- o.formatMessage({
90
+ T || o.formatMessage({
88
91
  id: "auth.sso_form.title",
89
92
  defaultMessage: "Debate now !"
90
93
  }),
91
94
  /* @__PURE__ */ e("br", {})
92
95
  ] }),
93
- o.formatMessage(
96
+ A || o.formatMessage(
94
97
  {
95
98
  id: "auth.sso_form.subtitle",
96
99
  defaultMessage: "Sign up right now and receive alerts by email."
@@ -100,15 +103,15 @@ const ie = ({
100
103
  ] }),
101
104
  U ? null : /* @__PURE__ */ n(m, { children: [
102
105
  /* @__PURE__ */ e(
103
- K,
106
+ $,
104
107
  {
105
108
  "data-tid": "link_signup",
106
109
  "data-testid": "signup-button",
107
110
  className: a.loginButton,
108
- to: O,
111
+ to: j,
109
112
  external: !0,
110
113
  border: !1,
111
- children: o.formatMessage({
114
+ children: C || o.formatMessage({
112
115
  id: "auth.sso_form.signup",
113
116
  defaultMessage: "Sign up"
114
117
  })
@@ -127,7 +130,7 @@ const ie = ({
127
130
  "data-testid": "signin-link",
128
131
  "data-tid": "link_login",
129
132
  rel: "nofollow",
130
- href: B,
133
+ href: F,
131
134
  children: o.formatMessage({
132
135
  id: "auth.sso_form.signin",
133
136
  defaultMessage: "Sign in"
@@ -135,8 +138,8 @@ const ie = ({
135
138
  }
136
139
  )
137
140
  ] }),
138
- g ? /* @__PURE__ */ e("div", { className: G(a.switchBox), children: /* @__PURE__ */ e(
139
- V,
141
+ g ? /* @__PURE__ */ e("div", { className: z(a.switchBox), children: /* @__PURE__ */ e(
142
+ q,
140
143
  {
141
144
  type: "checkbox",
142
145
  name: "accepts_provider_email",
@@ -149,7 +152,7 @@ const ie = ({
149
152
  },
150
153
  { variable: c }
151
154
  ),
152
- onInputChanged: (t) => T(!h),
155
+ onInputChanged: (t) => B(!h),
153
156
  "data-testid": "accepts-email-input"
154
157
  }
155
158
  ) }) : null,
@@ -190,5 +193,5 @@ const ie = ({
190
193
  ] });
191
194
  };
192
195
  export {
193
- ie as SSOForm
196
+ de as SSOForm
194
197
  };
@@ -0,0 +1,26 @@
1
+ import { jsx as t, jsxs as d } from "react/jsx-runtime";
2
+ import "react";
3
+ import { useIntl as l } from "react-intl";
4
+ import o from "./SubscriptionModal.module.scss.js";
5
+ import { Modal as m } from "../../dialog/modal/Modal.js";
6
+ import { Button as n } from "../../action/button/Button.js";
7
+ const M = ({ title: i, text: r, buttonLabel: a, url: s }) => {
8
+ const e = l();
9
+ return /* @__PURE__ */ t(m, { "data-vid": "subscription_modal", showCloseButton: !0, children: /* @__PURE__ */ d("div", { className: o.body, children: [
10
+ /* @__PURE__ */ t("div", { className: o.title, children: i || e.formatMessage({
11
+ id: "auth.subscription_modal.title",
12
+ defaultMessage: "Subscribe to comment"
13
+ }) }),
14
+ /* @__PURE__ */ t("div", { children: r || e.formatMessage({
15
+ id: "auth.subscription_modal.text",
16
+ defaultMessage: "Commenting is reserved to subscribers."
17
+ }) }),
18
+ s && /* @__PURE__ */ t(n, { "data-tid": "link_subscribe", to: s, external: !0, border: !1, children: a || e.formatMessage({
19
+ id: "auth.subscription_modal.button",
20
+ defaultMessage: "Subscribe"
21
+ }) })
22
+ ] }) });
23
+ };
24
+ export {
25
+ M as SubscriptionModal
26
+ };
@@ -0,0 +1,9 @@
1
+ import '../../../assets/components/auth/subscription_modal/SubscriptionModal.module-xQS4aWtJ.css';const t = "_body_14nv4_3", o = "_title_14nv4_15", e = {
2
+ body: t,
3
+ title: o
4
+ };
5
+ export {
6
+ t as body,
7
+ e as default,
8
+ o as title
9
+ };
@@ -0,0 +1,4 @@
1
+ import { SubscriptionModal as r } from "./SubscriptionModal.js";
2
+ export {
3
+ r as SubscriptionModal
4
+ };
@@ -1,38 +1,38 @@
1
- import { jsxs as i, jsx as t, Fragment as u } from "react/jsx-runtime";
2
- import f from "classnames";
1
+ import { jsxs as i, jsx as t, Fragment as g } from "react/jsx-runtime";
2
+ import B from "classnames";
3
3
  import "react";
4
- import { useIntl as x, FormattedMessage as h } from "react-intl";
4
+ import { useIntl as w, FormattedMessage as N } from "react-intl";
5
5
  import a from "./DebateBox.module.scss.js";
6
- import { useConfig as B } from "../../data/config_provider/useConfig.js";
7
- import { useRoutes as w } from "../../data/config_provider/useRoutes.js";
8
- import { useResponsive as M } from "../../hooks/use_responsive/useResponsive.js";
9
- import { useTranslatedContent as b } from "../../translation/translated_content/useTranslatedContent.js";
6
+ import { useConfig as M } from "../../data/config_provider/useConfig.js";
7
+ import { useRoutes as S } from "../../data/config_provider/useRoutes.js";
8
+ import { useResponsive as P } from "../../hooks/use_responsive/useResponsive.js";
9
+ import { useTranslatedContent as f } from "../../translation/translated_content/useTranslatedContent.js";
10
10
  import { Link as c } from "../../action/link/Link.js";
11
- import { Icon as S } from "../../icons/icon/Icon.js";
12
- import { Tooltip as P } from "../../dialog/tooltip/Tooltip.js";
13
- import { Avatar as y } from "../../user/avatar/Avatar.js";
14
- const R = ({ debate: e }) => {
15
- const d = B(), r = w(), l = x(), { isMobile: v } = M(), g = e.votes_count?.total || Object.values(e.votes_count).reduce(
11
+ import { Icon as y } from "../../icons/icon/Icon.js";
12
+ import { Tooltip as D } from "../../dialog/tooltip/Tooltip.js";
13
+ import { Avatar as C } from "../../user/avatar/Avatar.js";
14
+ const H = ({ debate: e }) => {
15
+ const m = M(), d = S(), r = w(), { isMobile: v } = P(), l = e.votes_count ?? {}, p = l.total || Object.values(l).reduce(
16
16
  (o, s) => o + Number.parseFloat(s),
17
17
  0
18
- ) || 0, n = e.group_context?.positions.reduce(
19
- (o, s) => Number.parseInt(e.votes_count[s.id]) > Number.parseInt(e.votes_count[o.id]) ? s : o
20
- ), m = b(
18
+ ) || 0, h = e.group_context?.positions ?? [], n = h.length ? h.reduce(
19
+ (o, s) => Number.parseInt(l[s.id]) > Number.parseInt(l[o.id]) ? s : o
20
+ ) : void 0, u = f(
21
21
  e.name,
22
22
  e.language,
23
23
  "name",
24
24
  e.translation_entries
25
- ), p = b(
26
- n.name,
27
- n.language,
25
+ ), _ = f(
26
+ n?.name,
27
+ n?.language,
28
28
  "name",
29
- n.translation_entries
30
- ), _ = (o, s) => s == 0 || o == 0 ? 0 : Math.round(100 * (o / s)), N = (o, s) => /* @__PURE__ */ t("div", { className: a.debateParticipantItem, children: /* @__PURE__ */ t(
29
+ n?.translation_entries
30
+ ), b = (o, s) => s == 0 || o == 0 ? 0 : Math.round(100 * (o / s)), x = (o, s) => /* @__PURE__ */ t("div", { className: a.debateParticipantItem, children: /* @__PURE__ */ t(
31
31
  c,
32
32
  {
33
- to: r.userShowLocation.toUrl({ userSlug: o.hash_id }),
33
+ to: d.userShowLocation.toUrl({ userSlug: o.hash_id }),
34
34
  children: /* @__PURE__ */ t(
35
- y,
35
+ C,
36
36
  {
37
37
  avatarUrl: o.image_url,
38
38
  userName: o.full_name,
@@ -48,7 +48,7 @@ const R = ({ debate: e }) => {
48
48
  /* @__PURE__ */ t(
49
49
  c,
50
50
  {
51
- to: r.debateShowLocation.toUrl({ debateSlug: e.slug }),
51
+ to: d.debateShowLocation.toUrl({ debateSlug: e.slug }),
52
52
  className: a.imageLink,
53
53
  children: /* @__PURE__ */ t(
54
54
  "img",
@@ -58,11 +58,11 @@ const R = ({ debate: e }) => {
58
58
  className: a.debateBoxImage,
59
59
  src: e.banner_image_url,
60
60
  height: 200,
61
- alt: e?.image_alt ? e.image_alt : l.formatMessage({
61
+ alt: e?.image_alt ? e.image_alt : r.formatMessage({
62
62
  id: "debate.debate_box.alt_debate_image",
63
63
  defaultMessage: "Debate image"
64
64
  }),
65
- title: e?.image_alt ? e.image_alt : l.formatMessage({
65
+ title: e?.image_alt ? e.image_alt : r.formatMessage({
66
66
  id: "debate.debate_box.alt_debate_image",
67
67
  defaultMessage: "Debate image"
68
68
  })
@@ -71,7 +71,7 @@ const R = ({ debate: e }) => {
71
71
  }
72
72
  ),
73
73
  e.is_active === !1 && /* @__PURE__ */ t("div", { className: a.inactiveDebate, children: /* @__PURE__ */ t(
74
- h,
74
+ N,
75
75
  {
76
76
  id: "debate.debate_box.debate_is_inactive",
77
77
  defaultMessage: "Debate is ended"
@@ -79,10 +79,10 @@ const R = ({ debate: e }) => {
79
79
  ) })
80
80
  ] }),
81
81
  e.group_context.author && e.group_context.author.is_admin === !1 && /* @__PURE__ */ i("div", { className: a.debateSuggestion, children: [
82
- /* @__PURE__ */ t(S, { name: "suggestion", width: 15, height: 15 }),
82
+ /* @__PURE__ */ t(y, { name: "suggestion", width: 15, height: 15 }),
83
83
  /* @__PURE__ */ i("span", { className: a.authorSuggestion, children: [
84
84
  /* @__PURE__ */ t(
85
- h,
85
+ N,
86
86
  {
87
87
  id: "debate.debate_box.suggestion_author_short",
88
88
  defaultMessage: "Suggested by"
@@ -93,15 +93,15 @@ const R = ({ debate: e }) => {
93
93
  ] })
94
94
  ] }),
95
95
  /* @__PURE__ */ i("div", { className: a.debateBoxBody, children: [
96
- /* @__PURE__ */ i("div", { className: a.debateBoxTitle, title: m.translatedContent, children: [
97
- d?.actions?.allowDebateBranding === !0 && e.sub_application?.logo && /* @__PURE__ */ i("span", { className: a.subApplication, children: [
96
+ /* @__PURE__ */ i("div", { className: a.debateBoxTitle, title: u.translatedContent, children: [
97
+ m?.actions?.allowDebateBranding === !0 && e.sub_application?.logo && /* @__PURE__ */ i("span", { className: a.subApplication, children: [
98
98
  /* @__PURE__ */ t(
99
99
  "img",
100
100
  {
101
101
  "data-tid": "view_debate_image",
102
102
  loading: "lazy",
103
103
  src: e.sub_application.logo,
104
- alt: `Logo ${d.display_name}`
104
+ alt: `Logo ${m.display_name}`
105
105
  }
106
106
  ),
107
107
  e.sub_application.name
@@ -109,47 +109,47 @@ const R = ({ debate: e }) => {
109
109
  /* @__PURE__ */ t(
110
110
  c,
111
111
  {
112
- to: r.debateShowLocation.toUrl({ debateSlug: e.slug }),
113
- children: /* @__PURE__ */ t(u, { children: v ? /* @__PURE__ */ t(
112
+ to: d.debateShowLocation.toUrl({ debateSlug: e.slug }),
113
+ children: /* @__PURE__ */ t(g, { children: v ? /* @__PURE__ */ t(
114
114
  "div",
115
115
  {
116
116
  "data-tid": "view_debate_title",
117
- className: f(a.debateTitle, a.debateTitleMobile),
118
- children: m.translatedContent
117
+ className: B(a.debateTitle, a.debateTitleMobile),
118
+ children: u.translatedContent
119
119
  }
120
120
  ) : /* @__PURE__ */ t(
121
121
  "div",
122
122
  {
123
123
  "data-tid": "view_debate_title",
124
124
  className: a.debateTitle,
125
- children: m.translatedContent
125
+ children: u.translatedContent
126
126
  }
127
127
  ) })
128
128
  }
129
129
  )
130
130
  ] }),
131
131
  /* @__PURE__ */ i("div", { className: a.debateBoxFooter, children: [
132
- /* @__PURE__ */ t("div", { className: a.debateParticipantsBox, children: e.participants.length === 0 ? /* @__PURE__ */ t("span", { className: a.debateParticipantsEmpty, children: l.formatMessage({
132
+ /* @__PURE__ */ t("div", { className: a.debateParticipantsBox, children: e.participants.length === 0 ? /* @__PURE__ */ t("span", { className: a.debateParticipantsEmpty, children: r.formatMessage({
133
133
  id: "debate.debate_box.fallback_no_participants",
134
134
  defaultMessage: "No participants"
135
- }) }) : /* @__PURE__ */ i(u, { children: [
136
- e.participants.map(N),
135
+ }) }) : /* @__PURE__ */ i(g, { children: [
136
+ e.participants.map(x),
137
137
  e.participants_count > 3 && /* @__PURE__ */ t("div", { className: a.debateParticipantItem, children: /* @__PURE__ */ t(
138
- P,
138
+ D,
139
139
  {
140
- text: l.formatMessage({
140
+ text: r.formatMessage({
141
141
  id: "debate.debate_box.participants_count",
142
142
  defaultMessage: "Number of debaters"
143
143
  }),
144
144
  children: /* @__PURE__ */ t(
145
145
  c,
146
146
  {
147
- to: r.debateShowLocation.toUrl({
147
+ to: d.debateShowLocation.toUrl({
148
148
  debateSlug: e.slug
149
149
  }),
150
150
  children: /* @__PURE__ */ i("div", { className: a.participantsCountBox, children: [
151
151
  "+",
152
- l.formatNumber(e.participants_count - 3, {
152
+ r.formatNumber(e.participants_count - 3, {
153
153
  notation: "compact",
154
154
  maximumFractionDigits: 1,
155
155
  roundingMode: "floor"
@@ -160,21 +160,21 @@ const R = ({ debate: e }) => {
160
160
  }
161
161
  ) })
162
162
  ] }) }),
163
- d.modules.votes === !1 || e.allow_votes === !1 ? null : /* @__PURE__ */ t("div", { className: a.debateBoxNumbers, children: /* @__PURE__ */ t(
163
+ m.modules.votes === !1 || e.allow_votes === !1 ? null : /* @__PURE__ */ t("div", { className: a.debateBoxNumbers, children: /* @__PURE__ */ t(
164
164
  "div",
165
165
  {
166
166
  className: a.debateBoxNumbersText,
167
- title: n ? `${_(e.votes_count[n.id] || 0, g)} % ${p.translatedContent}` : void 0,
168
- children: n && /* @__PURE__ */ i(u, { children: [
167
+ title: n ? `${b(l[n.id] || 0, p)} % ${_.translatedContent}` : void 0,
168
+ children: n && /* @__PURE__ */ i(g, { children: [
169
169
  /* @__PURE__ */ i("span", { className: a.debateBoxPercentage, children: [
170
- _(
171
- e.votes_count[n.id] || 0,
172
- g
170
+ b(
171
+ l[n.id] || 0,
172
+ p
173
173
  ),
174
174
  " ",
175
175
  "%"
176
176
  ] }),
177
- /* @__PURE__ */ t("span", { className: a.debateBoxPositionName, children: p.translatedContent })
177
+ /* @__PURE__ */ t("span", { className: a.debateBoxPositionName, children: _.translatedContent })
178
178
  ] })
179
179
  }
180
180
  ) })
@@ -183,5 +183,5 @@ const R = ({ debate: e }) => {
183
183
  ] });
184
184
  };
185
185
  export {
186
- R as DebateBox
186
+ H as DebateBox
187
187
  };
@@ -1,10 +1,20 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { useContext as i, Suspense as r, lazy as u } from "react";
3
- import { ConfigContext as a } from "../../data/config_provider/ConfigProvider.js";
4
- import { useModal as d } from "../../dialog/modal/useModal.js";
5
- const l = u(() => import("../../auth/auth_modal/index.js").then((t) => ({ default: t.AuthModal }))), m = () => {
6
- const { config: t } = i(a), { showModal: o } = d();
7
- return (n = {}) => {
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { createContext as f, useContext as i, Suspense as s, lazy as l } from "react";
3
+ import { ConfigContext as c } from "../../data/config_provider/ConfigProvider.js";
4
+ import { useModal as h } from "../../dialog/modal/useModal.js";
5
+ import { useAuth as m } from "../../auth/use_auth/useAuth.js";
6
+ const p = l(() => import("../../auth/auth_modal/index.js").then((t) => ({ default: t.AuthModal }))), w = l(() => import("../../auth/subscription_modal/index.js").then((t) => ({ default: t.SubscriptionModal }))), d = f(null), b = () => {
7
+ const { config: t } = i(c), o = i(d), { isLoggedIn: r, currentUser: e } = m() || {};
8
+ return !!(r && o && t?.[o]?.subscribersOnly === !0 && e?.is_subscriber !== !0);
9
+ }, R = () => {
10
+ const { config: t } = i(c), o = i(d), r = b(), { showModal: e } = h(), u = o ? t?.[o] : null;
11
+ return (a = {}) => {
12
+ if (r) {
13
+ e(
14
+ /* @__PURE__ */ n(s, { fallback: null, children: /* @__PURE__ */ n(w, { ...u?.subscriptionModal }) })
15
+ );
16
+ return;
17
+ }
8
18
  typeof window < "u" && (window.dispatchEvent(
9
19
  new CustomEvent("LOGORA::authenticationRequired", {
10
20
  detail: { redirectUrl: window.location.href }
@@ -13,11 +23,13 @@ const l = u(() => import("../../auth/auth_modal/index.js").then((t) => ({ defaul
13
23
  new CustomEvent("logora:authentication:requested", {
14
24
  detail: { redirectUrl: window.location.href }
15
25
  })
16
- )), t?.auth?.disableLoginModal !== !0 && o(
17
- /* @__PURE__ */ e(r, { fallback: null, children: /* @__PURE__ */ e(l, { ...n }) })
26
+ )), t?.auth?.disableLoginModal !== !0 && e(
27
+ /* @__PURE__ */ n(s, { fallback: null, children: /* @__PURE__ */ n(p, { ...u?.loginModal, ...a }) })
18
28
  );
19
29
  };
20
30
  };
21
31
  export {
22
- m as useAuthRequired
32
+ d as ModuleContext,
33
+ R as useAuthRequired,
34
+ b as useSubscriptionRequired
23
35
  };