@logora/debate 0.4.40 → 0.4.41

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.
@@ -5,15 +5,15 @@ import { useConfig as I } from "../../data/config_provider/useConfig.js";
5
5
  import { useModal as y } from "../../dialog/modal/useModal.js";
6
6
  import { useAuth as C } from "../use_auth/useAuth.js";
7
7
  import { useAuthActions as E } from "../use_auth/useAuthActions.js";
8
- import { httpClient as T } from "../../data/axios_client/httpClient.js";
9
- import { Modal as P } from "../../dialog/modal/Modal.js";
8
+ import { httpClient as P } from "../../data/axios_client/httpClient.js";
9
+ import { Modal as T } from "../../dialog/modal/Modal.js";
10
10
  import { Loader as R } from "../../progress/loader/Loader.js";
11
11
  import { SocialAuthForm as B } from "../social_auth_form/SocialAuthForm.js";
12
12
  import { SSOForm as L } from "../sso_form/SSOForm.js";
13
13
  import { AuthProviderFactory as M } from "../providers/AuthProviderFactory.js";
14
14
  const $ = ({ onHideModal: s = null }) => {
15
15
  const o = I(), { hideModal: c } = y(), { isLoggedIn: l, authError: r } = C(), [p, n] = h(!1), [e, d] = h(null), { loginUser: g } = E(
16
- T,
16
+ P,
17
17
  process.env.API_AUTH_URL,
18
18
  "logora_user_token"
19
19
  );
@@ -35,7 +35,7 @@ const $ = ({ onHideModal: s = null }) => {
35
35
  ).getAuthorizationParams();
36
36
  g(v);
37
37
  };
38
- return /* @__PURE__ */ t(P, { "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(
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
39
  B,
40
40
  {
41
41
  onSubmit: A,
@@ -69,8 +69,7 @@ const $ = ({ onHideModal: s = null }) => {
69
69
  hideLoginButton: o.auth.hideModalLoginButton,
70
70
  showEmailConsent: o.auth.showEmailConsent,
71
71
  showTerms: o.auth.hideCgu !== !0,
72
- hideBelowButton: o.auth.hideBelowButton,
73
- hideTerms: o.auth.hideTerms
72
+ hideBelowButton: o.auth.hideBelowButton
74
73
  }
75
74
  ) }) }) });
76
75
  };
@@ -1,17 +1,17 @@
1
- import { jsxs as o, jsx as e, Fragment as d } from "react/jsx-runtime";
2
- import D from "@rooks/use-sessionstorage-state";
3
- import Y from "classnames";
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";
4
4
  import "react";
5
- import { useIntl as z, FormattedMessage as w } from "react-intl";
6
- import { useLocation as H } from "react-router";
5
+ import { useIntl as Y, FormattedMessage as w } from "react-intl";
6
+ import { useLocation as z } from "react-router";
7
7
  import a from "./SSOForm.module.scss.js";
8
- import { EMAIL_CONSENT_STORAGE_KEY as K } from "../use_auth/useAuthActions.js";
9
- import { Icon as V } from "../../icons/icon/Icon.js";
10
- import { Button as W } from "../../action/button/Button.js";
11
- import { Toggle as $ } from "../../input/toggle/Toggle.js";
12
- const ne = ({
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";
12
+ const oe = ({
13
13
  authType: v,
14
- providerName: c,
14
+ providerName: d,
15
15
  loginUrl: M,
16
16
  signupUrl: b,
17
17
  termsUrl: N,
@@ -26,27 +26,26 @@ const ne = ({
26
26
  showEmailConsent: g = !1,
27
27
  showTerms: L = !1,
28
28
  hideBelowButton: R = !1,
29
- hideTerms: x = !1,
30
- error: A = !1
29
+ error: x = !1
31
30
  }) => {
32
- const [h, C] = g ? D(K, !1) : [!1, () => {
33
- }], n = z(), m = H(), T = (t) => {
31
+ const [h, A] = g ? G(H, !1) : [!1, () => {
32
+ }], o = Y(), c = z(), C = (t) => {
34
33
  if (typeof window < "u") {
35
- const s = t === "CURRENT_LOCATION" ? window.location : t, i = new URL(s, window.location.origin), l = i.searchParams, F = new URLSearchParams(m.search);
34
+ const s = t === "CURRENT_LOCATION" ? window.location : t, i = new URL(s, window.location.origin), l = i.searchParams, E = new URLSearchParams(c.search);
36
35
  l.has("code") && l.delete("code"), f && l.append(f, window.location.toString());
37
- for (const [_, j] of Object.entries(U)) {
38
- let r = j;
36
+ for (const [_, F] of Object.entries(U)) {
37
+ let r = F;
39
38
  if (r) {
40
- const G = m.pathname.slice(
39
+ const j = c.pathname.slice(
41
40
  0,
42
- m.pathname.lastIndexOf("/")
41
+ c.pathname.lastIndexOf("/")
43
42
  );
44
43
  r = r.replace(
45
44
  "{{UTM_CAMPAIGN}}",
46
- F.get("utm_campaign")
45
+ E.get("utm_campaign")
47
46
  ), r = r.replace(
48
47
  "{{CURRENT_PATH}}",
49
- decodeURIComponent(G)
48
+ decodeURIComponent(j)
50
49
  );
51
50
  }
52
51
  _ === "metadata" && r && (r = window.btoa(r)), l.append(_, encodeURIComponent(r));
@@ -54,15 +53,15 @@ const ne = ({
54
53
  return i.search = l.toString(), i.toString();
55
54
  }
56
55
  return "";
57
- }, O = (t) => {
56
+ }, T = (t) => {
58
57
  const s = new URL(t);
59
58
  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
59
  const i = new URL(window.location.href);
61
60
  i.searchParams.delete("code"), s.searchParams.append("state", window.btoa(i.toString()));
62
61
  }
63
62
  return s.href;
64
- }, p = (t) => v === "oauth2_server" ? O(t) : T(t), B = p(M), E = p(b);
65
- return /* @__PURE__ */ o("div", { className: a.ssoForm, children: [
63
+ }, p = (t) => v === "oauth2_server" ? T(t) : C(t), O = p(M), B = p(b);
64
+ return /* @__PURE__ */ n("div", { className: a.ssoForm, children: [
66
65
  /* @__PURE__ */ e("div", { className: a.logo, children: u ? /* @__PURE__ */ e(
67
66
  "img",
68
67
  {
@@ -70,10 +69,10 @@ const ne = ({
70
69
  width: 100,
71
70
  className: a.logoImage,
72
71
  src: u,
73
- alt: `Logo ${c}`
72
+ alt: `Logo ${d}`
74
73
  }
75
74
  ) : /* @__PURE__ */ e(
76
- V,
75
+ K,
77
76
  {
78
77
  name: "next",
79
78
  "aria-hidden": "true",
@@ -82,41 +81,41 @@ const ne = ({
82
81
  className: a.loginIcon
83
82
  }
84
83
  ) }),
85
- /* @__PURE__ */ o("div", { className: a.mainText, children: [
86
- /* @__PURE__ */ o("div", { className: a.title, children: [
87
- n.formatMessage({
84
+ /* @__PURE__ */ n("div", { className: a.mainText, children: [
85
+ /* @__PURE__ */ n("div", { className: a.title, children: [
86
+ o.formatMessage({
88
87
  id: "auth.sso_form.title",
89
88
  defaultMessage: "Debate now !"
90
89
  }),
91
90
  /* @__PURE__ */ e("br", {})
92
91
  ] }),
93
- n.formatMessage(
92
+ o.formatMessage(
94
93
  {
95
94
  id: "auth.sso_form.subtitle",
96
95
  defaultMessage: "Sign up right now and receive alerts by email."
97
96
  },
98
- { provider: c }
97
+ { provider: d }
99
98
  )
100
99
  ] }),
101
- P ? null : /* @__PURE__ */ o(d, { children: [
100
+ P ? null : /* @__PURE__ */ n(m, { children: [
102
101
  /* @__PURE__ */ e(
103
- W,
102
+ V,
104
103
  {
105
104
  "data-tid": "link_signup",
106
105
  "data-testid": "signup-button",
107
106
  className: a.loginButton,
108
- to: E,
107
+ to: B,
109
108
  external: !0,
110
109
  border: !1,
111
- children: n.formatMessage({
110
+ children: o.formatMessage({
112
111
  id: "auth.sso_form.signup",
113
112
  defaultMessage: "Sign up"
114
113
  })
115
114
  }
116
115
  ),
117
- R ? null : /* @__PURE__ */ o(d, { children: [
118
- k === !0 ? null : /* @__PURE__ */ o("div", { className: a.cgu, children: [
119
- n.formatMessage({
116
+ R ? null : /* @__PURE__ */ n(m, { children: [
117
+ k === !0 ? null : /* @__PURE__ */ n("div", { className: a.cgu, children: [
118
+ o.formatMessage({
120
119
  id: "auth.sso_form.already_account",
121
120
  defaultMessage: "Already have an account ?"
122
121
  }),
@@ -127,70 +126,68 @@ const ne = ({
127
126
  "data-testid": "signin-link",
128
127
  "data-tid": "link_login",
129
128
  rel: "nofollow",
130
- href: B,
131
- children: n.formatMessage({
129
+ href: O,
130
+ children: o.formatMessage({
132
131
  id: "auth.sso_form.signin",
133
132
  defaultMessage: "Sign in"
134
133
  })
135
134
  }
136
135
  )
137
136
  ] }),
138
- x ? null : /* @__PURE__ */ o(d, { children: [
139
- g ? /* @__PURE__ */ e("div", { className: Y(a.switchBox), children: /* @__PURE__ */ e(
140
- $,
141
- {
142
- type: "checkbox",
143
- name: "accepts_provider_email",
144
- style: { fontSize: 18 },
145
- checked: h,
146
- label: n.formatMessage(
147
- {
148
- id: "auth.sso_form.consent_label",
149
- defaultMessage: "I agree to receive emails from the editor"
150
- },
151
- { variable: c }
152
- ),
153
- onInputChanged: (t) => C(!h),
154
- "data-testid": "accepts-email-input"
155
- }
156
- ) }) : null,
157
- A ? /* @__PURE__ */ e("div", { className: a.error, children: n.formatMessage({
158
- id: "auth.sso_form.error",
159
- defaultMessage: "An error occurred during sign in. Please try again in a few moments."
160
- }) }) : null,
161
- L && /* @__PURE__ */ o(d, { children: [
162
- /* @__PURE__ */ e("div", { className: a.cguButton, children: /* @__PURE__ */ e(
163
- w,
164
- {
165
- id: "auth.sso_form.terms",
166
- defaultMessage: "By clicking on « Sign up », I declare that I have read the <var1> General Conditions of Use </var1> of the debate space and accept them",
167
- values: {
168
- var1: (t) => /* @__PURE__ */ e(
169
- "a",
170
- {
171
- className: a.termsTarget,
172
- target: "_blank",
173
- href: N,
174
- rel: "noreferrer",
175
- children: t
176
- }
177
- )
178
- }
179
- }
180
- ) }),
181
- /* @__PURE__ */ e("div", { className: a.cguButton, children: /* @__PURE__ */ e(
182
- w,
137
+ g ? /* @__PURE__ */ e("div", { className: D(a.switchBox), children: /* @__PURE__ */ e(
138
+ W,
139
+ {
140
+ type: "checkbox",
141
+ name: "accepts_provider_email",
142
+ style: { fontSize: 18 },
143
+ checked: h,
144
+ label: o.formatMessage(
183
145
  {
184
- id: "auth.sso_form.data_terms",
185
- defaultMessage: "Your personal data are being processed by the Editor. For more information and to exercise your rights, see our personal data policy available on the site."
146
+ id: "auth.sso_form.consent_label",
147
+ defaultMessage: "I agree to receive emails from the editor"
148
+ },
149
+ { variable: d }
150
+ ),
151
+ onInputChanged: (t) => A(!h),
152
+ "data-testid": "accepts-email-input"
153
+ }
154
+ ) }) : null,
155
+ x ? /* @__PURE__ */ e("div", { className: a.error, children: o.formatMessage({
156
+ id: "auth.sso_form.error",
157
+ defaultMessage: "An error occurred during sign in. Please try again in a few moments."
158
+ }) }) : null,
159
+ L && /* @__PURE__ */ n(m, { children: [
160
+ /* @__PURE__ */ e("div", { className: a.cguButton, children: /* @__PURE__ */ e(
161
+ w,
162
+ {
163
+ id: "auth.sso_form.terms",
164
+ defaultMessage: "By clicking on « Sign up », I declare that I have read the <var1> General Conditions of Use </var1> of the debate space and accept them",
165
+ values: {
166
+ var1: (t) => /* @__PURE__ */ e(
167
+ "a",
168
+ {
169
+ className: a.termsTarget,
170
+ target: "_blank",
171
+ href: N,
172
+ rel: "noreferrer",
173
+ children: t
174
+ }
175
+ )
186
176
  }
187
- ) })
188
- ] })
177
+ }
178
+ ) }),
179
+ /* @__PURE__ */ e("div", { className: a.cguButton, children: /* @__PURE__ */ e(
180
+ w,
181
+ {
182
+ id: "auth.sso_form.data_terms",
183
+ defaultMessage: "Your personal data are being processed by the Editor. For more information and to exercise your rights, see our personal data policy available on the site."
184
+ }
185
+ ) })
189
186
  ] })
190
187
  ] })
191
188
  ] })
192
189
  ] });
193
190
  };
194
191
  export {
195
- ne as SSOForm
192
+ oe as SSOForm
196
193
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.4.40",
3
+ "version": "0.4.41",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",