@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.
- package/dist/assets/components/auth/subscription_modal/SubscriptionModal.module-xQS4aWtJ.css +1 -0
- package/dist/components/auth/auth_modal/AuthModal.js +38 -29
- package/dist/components/auth/sso_form/SSOForm.js +36 -33
- package/dist/components/auth/subscription_modal/SubscriptionModal.js +26 -0
- package/dist/components/auth/subscription_modal/SubscriptionModal.module.scss.js +9 -0
- package/dist/components/auth/subscription_modal/index.js +4 -0
- package/dist/components/debate/debate_box/DebateBox.js +51 -51
- package/dist/components/hooks/use_auth_required/useAuthRequired.js +22 -10
- package/dist/components/input/argument_input/ArgumentInput.js +145 -145
- package/dist/components/vote/use_vote/useVote.js +20 -20
- package/dist/index.js +232 -228
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
4
|
-
import { useConfig as
|
|
5
|
-
import { useModal as
|
|
6
|
-
import { useAuth as
|
|
7
|
-
import { useAuthActions as
|
|
8
|
-
import { httpClient as
|
|
9
|
-
import { Modal as
|
|
10
|
-
import { Loader as
|
|
11
|
-
import { SocialAuthForm as
|
|
12
|
-
import { SSOForm as
|
|
13
|
-
import { AuthProviderFactory as
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
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 &&
|
|
27
|
+
l && _();
|
|
22
28
|
}, [l]), m(() => {
|
|
23
29
|
e && r && n(!1);
|
|
24
30
|
}, [e, r]);
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
const
|
|
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
|
-
|
|
42
|
+
v(y);
|
|
37
43
|
};
|
|
38
|
-
return /* @__PURE__ */ t(
|
|
39
|
-
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
2
|
+
import z from "classnames";
|
|
3
3
|
import "react";
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { useLocation as
|
|
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
|
|
8
|
-
import { Icon as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { Toggle as
|
|
11
|
-
import { EMAIL_CONSENT_STORAGE_KEY as
|
|
12
|
-
import { utf8ToBase64url as
|
|
13
|
-
const
|
|
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,
|
|
33
|
-
}], o =
|
|
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,
|
|
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 [_,
|
|
38
|
-
let r =
|
|
40
|
+
for (const [_, D] of Object.entries(P)) {
|
|
41
|
+
let r = D;
|
|
39
42
|
if (r) {
|
|
40
|
-
const
|
|
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
|
-
|
|
49
|
+
G.get("utm_campaign")
|
|
47
50
|
), r = r.replace(
|
|
48
51
|
"{{CURRENT_PATH}}",
|
|
49
|
-
decodeURIComponent(
|
|
52
|
+
decodeURIComponent(Y)
|
|
50
53
|
);
|
|
51
54
|
}
|
|
52
|
-
_ === "metadata" && r && (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
|
-
},
|
|
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" ?
|
|
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
|
-
|
|
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
|
-
|
|
106
|
+
$,
|
|
104
107
|
{
|
|
105
108
|
"data-tid": "link_signup",
|
|
106
109
|
"data-testid": "signup-button",
|
|
107
110
|
className: a.loginButton,
|
|
108
|
-
to:
|
|
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:
|
|
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:
|
|
139
|
-
|
|
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) =>
|
|
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
|
-
|
|
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
|
+
};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsxs as i, jsx as t, Fragment as
|
|
2
|
-
import
|
|
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
|
|
4
|
+
import { useIntl as w, FormattedMessage as N } from "react-intl";
|
|
5
5
|
import a from "./DebateBox.module.scss.js";
|
|
6
|
-
import { useConfig as
|
|
7
|
-
import { useRoutes as
|
|
8
|
-
import { useResponsive as
|
|
9
|
-
import { useTranslatedContent as
|
|
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
|
|
12
|
-
import { Tooltip as
|
|
13
|
-
import { Avatar as
|
|
14
|
-
const
|
|
15
|
-
const
|
|
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,
|
|
19
|
-
(o, s) => Number.parseInt(
|
|
20
|
-
),
|
|
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
|
-
),
|
|
26
|
-
n
|
|
27
|
-
n
|
|
25
|
+
), _ = f(
|
|
26
|
+
n?.name,
|
|
27
|
+
n?.language,
|
|
28
28
|
"name",
|
|
29
|
-
n
|
|
30
|
-
),
|
|
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:
|
|
33
|
+
to: d.userShowLocation.toUrl({ userSlug: o.hash_id }),
|
|
34
34
|
children: /* @__PURE__ */ t(
|
|
35
|
-
|
|
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:
|
|
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 :
|
|
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 :
|
|
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
|
-
|
|
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(
|
|
82
|
+
/* @__PURE__ */ t(y, { name: "suggestion", width: 15, height: 15 }),
|
|
83
83
|
/* @__PURE__ */ i("span", { className: a.authorSuggestion, children: [
|
|
84
84
|
/* @__PURE__ */ t(
|
|
85
|
-
|
|
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:
|
|
97
|
-
|
|
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 ${
|
|
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:
|
|
113
|
-
children: /* @__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:
|
|
118
|
-
children:
|
|
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:
|
|
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:
|
|
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(
|
|
136
|
-
e.participants.map(
|
|
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
|
-
|
|
138
|
+
D,
|
|
139
139
|
{
|
|
140
|
-
text:
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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 ? `${
|
|
168
|
-
children: n && /* @__PURE__ */ i(
|
|
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
|
-
|
|
172
|
-
|
|
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:
|
|
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
|
-
|
|
186
|
+
H as DebateBox
|
|
187
187
|
};
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as i, Suspense as
|
|
3
|
-
import { ConfigContext as
|
|
4
|
-
import { useModal as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 &&
|
|
17
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
32
|
+
d as ModuleContext,
|
|
33
|
+
R as useAuthRequired,
|
|
34
|
+
b as useSubscriptionRequired
|
|
23
35
|
};
|