@logora/debate 0.4.57 → 0.4.59

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
+ ._toolbar_1ml63_3{display:flex!important;justify-content:space-between!important;flex-wrap:wrap;background:var(--background-color-primary, white);padding-top:var(--spacer-md, calc(var(--space-unit, 1em) * .75))!important;vertical-align:middle;align-items:flex-start;gap:var(--space-unit, 1em)}._toolbar_1ml63_3._toolbarIsActive_1ml63_13{border-top:1px solid var(--text-tertiary, #fafafa)}._iconToolbar_1ml63_17{display:flex!important;flex-wrap:wrap;gap:var(--spacer-lg, calc(var(--space-unit, 1em) * 1.5))}._iconToolbar_1ml63_17._shortBar_1ml63_22{gap:var(--spacer-md, calc(var(--space-unit, 1em) * .75))}@container (max-width: 575.98px){._iconToolbar_1ml63_17{gap:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))}}._toolbarItem_1ml63_31{-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;border:0;background:none;padding:0!important;cursor:pointer;vertical-align:middle;touch-action:manipulation;display:flex;align-items:center;justify-content:center;outline:none}@container (max-width: 575.98px){._toolbarItem_1ml63_31{min-width:44px;min-height:44px}}._toolbarItem_1ml63_31._disabled_1ml63_52{cursor:not-allowed}._toolbarItem_1ml63_31:active,._toolbarItem_1ml63_31._active_1ml63_55{background-color:#bababa66!important;border-radius:50%}._toolbarItem_1ml63_31 ._format_1ml63_59{background-size:contain;display:inline-block;vertical-align:-.25em;display:flex!important}._actionButton_1ml63_66{display:flex!important;gap:var(--space-unit, 1em);margin-left:auto}._inputSubmitActionButton_1ml63_72{width:100%;height:35px;display:flex!important;justify-content:center!important;align-items:center!important;background-color:var(--call-primary-color, #434343)!important}._inputSubmitActionButton_1ml63_72._submitAction_1ml63_80 svg{fill:var(--text-light, white)!important}._inputSubmitActionButton_1ml63_72 ._inputSourceText_1ml63_83{display:none!important;margin-left:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;font-size:var(--font-size-small, 16px)}@container (min-width: 576px){._inputSubmitActionButton_1ml63_72 ._inputSourceText_1ml63_83{display:block!important}}._tooltip_1ml63_94{width:230px!important;margin-left:-117px!important}
@@ -1,69 +1,102 @@
1
- import { jsx as l, Fragment as L } from "react/jsx-runtime";
2
- import { useState as O, useEffect as g } from "react";
3
- import { useConfig as U } from "../../data/config_provider/useConfig.js";
4
- import { useAuthInterceptor as y } from "../use_auth/useAuthInterceptor.js";
5
- import { authTokenHandler as _ } from "../use_auth/authTokenHandler.js";
6
- import { useAuthActions as q } from "../use_auth/useAuthActions.js";
7
- import { useAuthRequired as I } from "../../hooks/use_auth_required/useAuthRequired.js";
8
- import { AuthProviderFactory as S } from "../providers/AuthProviderFactory.js";
9
- import { OnboardingModal as T } from "../../user/onboarding_modal/OnboardingModal.js";
10
- import { saveOnboardingBeforeLogin as z } from "../../user/onboarding_modal/useOnboarding.js";
11
- import { httpClient as u } from "../../data/axios_client/httpClient.js";
12
- const G = ({ authUrl: r, authType: n, provider: p, assertion: w }) => {
13
- const i = "logora_user_token", e = U();
14
- y(u, r, i);
15
- const [v, c] = O(!1), { getToken: A, removeToken: C } = _(
16
- u,
17
- r,
18
- i
19
- ), { loginUser: m, logoutUser: b, fetchUser: P } = q(
20
- u,
21
- r,
22
- i
23
- ), h = I();
24
- g(() => {
25
- s();
26
- }, []), g(() => {
1
+ import { jsx as v, Fragment as E } from "react/jsx-runtime";
2
+ import { useState as L, useEffect as _ } from "react";
3
+ import { useConfig as O } from "../../data/config_provider/useConfig.js";
4
+ import { useAuthInterceptor as k } from "../use_auth/useAuthInterceptor.js";
5
+ import { authTokenHandler as I } from "../use_auth/authTokenHandler.js";
6
+ import { useAuthActions as S } from "../use_auth/useAuthActions.js";
7
+ import { useAuthRequired as q } from "../../hooks/use_auth_required/useAuthRequired.js";
8
+ import { AuthProviderFactory as F } from "../providers/AuthProviderFactory.js";
9
+ import { OnboardingModal as J } from "../../user/onboarding_modal/OnboardingModal.js";
10
+ import { saveOnboardingBeforeLogin as M } from "../../user/onboarding_modal/useOnboarding.js";
11
+ import { httpClient as h } from "../../data/axios_client/httpClient.js";
12
+ const T = (t) => {
13
+ const e = t.replace(/-/g, "+").replace(/_/g, "/"), s = e.padEnd(e.length + (4 - e.length % 4) % 4, "=");
14
+ return atob(s);
15
+ }, j = (t) => {
16
+ if (!t || typeof t != "string")
17
+ return null;
18
+ const e = t.split(".");
19
+ if (e.length < 2)
20
+ return null;
21
+ try {
22
+ return JSON.parse(T(e[1]));
23
+ } catch {
24
+ return null;
25
+ }
26
+ }, z = (t, e) => {
27
+ if (!t || typeof t != "object")
28
+ return {};
29
+ const s = e || {}, a = (u) => {
30
+ const r = s[u];
31
+ return typeof r == "string" && r.length > 0 ? r.split(".").reduce((o, l) => o == null ? o : o[l], t) : t[u];
32
+ };
33
+ return {
34
+ first_name: a("first_name"),
35
+ last_name: a("last_name"),
36
+ image_url: a("image_url")
37
+ };
38
+ }, X = ({ authUrl: t, authType: e, provider: s, assertion: a }) => {
39
+ const u = "logora_user_token", r = O();
40
+ k(h, t, u);
41
+ const o = z(
42
+ j(a),
43
+ r.auth?.userProfileMapping
44
+ ), [l, f] = L(!1), { getToken: A, removeToken: b } = I(
45
+ h,
46
+ t,
47
+ u
48
+ ), { loginUser: g, logoutUser: P, fetchUser: C } = S(
49
+ h,
50
+ t,
51
+ u
52
+ ), d = q();
53
+ _(() => {
54
+ c();
55
+ }, []), _(() => {
27
56
  if (typeof window < "u")
28
- return window.addEventListener("logora:authentication:require", h), window.addEventListener("logora:authentication:refresh", s), () => {
29
- window.removeEventListener("logora:authentication:require", h), window.removeEventListener("logora:authentication:refresh", s);
57
+ return window.addEventListener("logora:authentication:require", d), window.addEventListener("logora:authentication:refresh", c), () => {
58
+ window.removeEventListener("logora:authentication:require", d), window.removeEventListener("logora:authentication:refresh", c);
30
59
  };
31
60
  }, []);
32
- const s = () => {
33
- const o = f(), t = A();
34
- if (t) {
35
- const a = t.session_id;
36
- o.isSameUser(a) ? P() : (C(), d(o));
61
+ const c = () => {
62
+ const n = w(), i = A();
63
+ if (i) {
64
+ const m = i.session_id;
65
+ n.isSameUser(m) ? C() : (b(), p(n));
37
66
  } else
38
- d(o);
39
- }, d = (o) => {
40
- if (o.shouldInitAuth()) {
41
- const t = o.getAuthorizationParams();
42
- if (t) {
43
- if (n !== "social" && n !== "oauth2_server" && e.auth?.showOnboardingBeforeLogin === !0) {
44
- c(!0);
67
+ p(n);
68
+ }, p = (n) => {
69
+ if (n.shouldInitAuth()) {
70
+ const i = n.getAuthorizationParams();
71
+ if (i) {
72
+ if (e !== "social" && e !== "oauth2_server" && r.auth?.showOnboardingBeforeLogin === !0) {
73
+ f(!0);
45
74
  return;
46
75
  }
47
- m(t);
76
+ g(i);
48
77
  }
49
78
  } else
50
- b();
51
- }, k = (o, t) => {
52
- const E = f().getAuthorizationParams();
53
- z(e.shortname, t), c(!1), m(E);
54
- }, f = () => S.create(n, p, w);
55
- return /* @__PURE__ */ l(L, { children: v && /* @__PURE__ */ l(
56
- T,
79
+ P();
80
+ }, U = (n, i) => {
81
+ const y = w().getAuthorizationParams();
82
+ M(r.shortname, i), f(!1), g(y);
83
+ }, w = () => F.create(e, s, a);
84
+ return /* @__PURE__ */ v(E, { children: l && /* @__PURE__ */ v(
85
+ J,
57
86
  {
58
87
  pendingAuth: !0,
59
- onConsentConfirmed: k,
60
- showTerms: e.auth?.hideCgu !== !0,
61
- showEmailConsent: e.auth?.showEmailConsent,
62
- termsUrl: e.provider?.cguUrl || "https://www.logora.com/blog-posts/cgu",
63
- privacyUrl: e.provider?.privacyUrl || "https://www.logora.com/blog-posts/privacy-policy"
88
+ onConsentConfirmed: U,
89
+ showTerms: r.auth?.hideCgu !== !0,
90
+ showEmailConsent: r.auth?.showEmailConsent,
91
+ initialFirstName: o.first_name,
92
+ initialLastName: o.last_name,
93
+ initialImageUrl: o.image_url,
94
+ termsUrl: r.provider?.cguUrl || "https://www.logora.com/blog-posts/cgu",
95
+ privacyUrl: r.provider?.privacyUrl || "https://www.logora.com/blog-posts/privacy-policy"
64
96
  }
65
97
  ) });
66
98
  };
67
99
  export {
68
- G as AuthInitializer
100
+ X as AuthInitializer,
101
+ j as decodeJwtPayload
69
102
  };
@@ -1,95 +1,97 @@
1
- import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
- import r from "classnames";
3
- import "react";
4
- import { useIntl as f, FormattedMessage as g } from "react-intl";
5
- import a from "./BadgeBox.module.scss.js";
6
- import { ProgressBar as u } from "../../progress/progress_bar/ProgressBar.js";
7
- const _ = ({
8
- icon_url: b,
9
- level: l,
10
- name: d,
1
+ import { jsxs as o, jsx as a } from "react/jsx-runtime";
2
+ import g from "classnames";
3
+ import { useState as N } from "react";
4
+ import { useIntl as w, FormattedMessage as l } from "react-intl";
5
+ import e from "./BadgeBox.module.scss.js";
6
+ import { useConfig as p } from "../../data/config_provider/useConfig.js";
7
+ import { ProgressBar as $ } from "../../progress/progress_bar/ProgressBar.js";
8
+ const j = ({
9
+ icon_url: h,
10
+ level: r,
11
+ name: i,
11
12
  next_title_level: n,
12
- steps: i,
13
+ steps: s,
13
14
  title: c,
14
15
  progress: t,
15
16
  eloquenceTitle: m
16
17
  }) => {
17
- const s = f();
18
- return /* @__PURE__ */ o("div", { className: a.badgeBox, children: [
19
- /* @__PURE__ */ e("div", { className: r(a.badgeLevel, a[`level-${l}`]), children: /* @__PURE__ */ e(
20
- g,
18
+ const d = w(), b = p(), [v, M] = N(!1), f = b?.badges?.baseUrl, u = f && `${f.replace(/\/+$/, "")}/${i}.${b?.badges?.fileExtension || "png"}`, x = !v && u ? u : h;
19
+ return /* @__PURE__ */ o("div", { className: e.badgeBox, children: [
20
+ /* @__PURE__ */ a("div", { className: g(e.badgeLevel, e[`level-${r}`]), children: /* @__PURE__ */ a(
21
+ l,
21
22
  {
22
23
  id: "gamification.badge_box.level",
23
- values: { count: l },
24
+ values: { count: r },
24
25
  defaultMessage: "Level {count}"
25
26
  }
26
27
  ) }),
27
- /* @__PURE__ */ e("div", { className: a.badgeImageBox, children: /* @__PURE__ */ e(
28
+ /* @__PURE__ */ a("div", { className: e.badgeImageBox, children: /* @__PURE__ */ a(
28
29
  "img",
29
30
  {
30
- className: a.badgeImage,
31
- src: b,
31
+ className: e.badgeImage,
32
+ src: x,
32
33
  loading: "lazy",
33
34
  width: 80,
34
35
  height: 80,
35
36
  title: c,
36
- alt: `Badge ${c}`
37
+ alt: `Badge ${c}`,
38
+ onError: () => M(!0)
37
39
  }
38
40
  ) }),
39
- /* @__PURE__ */ e("div", { className: a.badgeName, children: s.formatMessage({
40
- id: `gamification.badge_box.${d}.title`,
41
+ /* @__PURE__ */ a("div", { className: e.badgeName, children: d.formatMessage({
42
+ id: `gamification.badge_box.${i}.title`,
41
43
  defaultMessage: "Contributor"
42
44
  }) }),
43
- /* @__PURE__ */ e("div", { className: a.badgeDescription, children: /* @__PURE__ */ e(
44
- g,
45
+ /* @__PURE__ */ a("div", { className: e.badgeDescription, children: /* @__PURE__ */ a(
46
+ l,
45
47
  {
46
- id: `gamification.badge_box.${d}.description`,
47
- values: { count: i },
48
+ id: `gamification.badge_box.${i}.description`,
49
+ values: { count: s },
48
50
  defaultMessage: "Write {count} arguments with a relevance score of at least 75"
49
51
  }
50
52
  ) }),
51
- /* @__PURE__ */ o("div", { className: a.badgeProgressContainer, children: [
52
- t >= i ? /* @__PURE__ */ e("span", { children: s.formatMessage({
53
+ /* @__PURE__ */ o("div", { className: e.badgeProgressContainer, children: [
54
+ t >= s ? /* @__PURE__ */ a("span", { children: d.formatMessage({
53
55
  id: "gamification.badge_box.completed",
54
56
  defaultMessage: "Completed !"
55
- }) }) : /* @__PURE__ */ e("span", { children: t + "/" + i }),
56
- /* @__PURE__ */ e(
57
- u,
57
+ }) }) : /* @__PURE__ */ a("span", { children: t + "/" + s }),
58
+ /* @__PURE__ */ a(
59
+ $,
58
60
  {
59
61
  progress: t,
60
- goal: i,
61
- className: a.badgeProgress,
62
- innerClassName: r(a.badgeProgressBar, a[`level-${l}`])
62
+ goal: s,
63
+ className: e.badgeProgress,
64
+ innerClassName: g(e.badgeProgressBar, e[`level-${r}`])
63
65
  }
64
66
  )
65
67
  ] }),
66
68
  n !== null && /* @__PURE__ */ o(
67
69
  "div",
68
70
  {
69
- className: r(a.badgeReward, {
70
- [a.rewardObtained]: t >= i,
71
- [a.rewardShown]: m === d
71
+ className: g(e.badgeReward, {
72
+ [e.rewardObtained]: t >= s,
73
+ [e.rewardShown]: m === i
72
74
  }),
73
75
  "data-testid": "badge-reward",
74
76
  children: [
75
- /* @__PURE__ */ e("span", { children: m === d ? s.formatMessage({
77
+ /* @__PURE__ */ a("span", { children: m === i ? d.formatMessage({
76
78
  id: "gamification.badge_box.title_shown",
77
79
  defaultMessage: "Title shown :"
78
- }) : t >= i ? s.formatMessage({
80
+ }) : t >= s ? d.formatMessage({
79
81
  id: "gamification.badge_box.title_obtained",
80
82
  defaultMessage: "Title obtained :"
81
- }) : /* @__PURE__ */ e(
82
- g,
83
+ }) : /* @__PURE__ */ a(
84
+ l,
83
85
  {
84
86
  id: "gamification.badge_box.title",
85
87
  values: { variable: n },
86
88
  defaultMessage: "At level {variable} you will get the title :"
87
89
  }
88
90
  ) }),
89
- /* @__PURE__ */ o("span", { className: a.rewardName, children: [
91
+ /* @__PURE__ */ o("span", { className: e.rewardName, children: [
90
92
  '"',
91
- s.formatMessage({
92
- id: `gamification.badge_box.${d}.reward`,
93
+ d.formatMessage({
94
+ id: `gamification.badge_box.${i}.reward`,
93
95
  defaultMessage: "Dialogue pro"
94
96
  }),
95
97
  '"'
@@ -100,5 +102,5 @@ const _ = ({
100
102
  ] });
101
103
  };
102
104
  export {
103
- _ as BadgeBox
105
+ j as BadgeBox
104
106
  };
@@ -1,25 +1,25 @@
1
- import '../../../../assets/components/input/text_editor/plugins/ToolbarPlugin.module-f1t2UhlS.css';const o = "_toolbar_iro9e_3", t = "_toolbarIsActive_iro9e_13", i = "_iconToolbar_iro9e_17", n = "_shortBar_iro9e_21", r = "_toolbarItem_iro9e_25", _ = "_active_iro9e_49", c = "_format_iro9e_53", a = "_actionButton_iro9e_60", s = "_inputSubmitActionButton_iro9e_66", e = "_submitAction_iro9e_74", b = {
2
- toolbar: o,
3
- toolbarIsActive: t,
4
- iconToolbar: i,
5
- shortBar: n,
6
- toolbarItem: r,
7
- active: _,
8
- format: c,
9
- actionButton: a,
1
+ import '../../../../assets/components/input/text_editor/plugins/ToolbarPlugin.module-DSNBpqDn.css';const t = "_toolbar_1ml63_3", o = "_toolbarIsActive_1ml63_13", n = "_iconToolbar_1ml63_17", _ = "_shortBar_1ml63_22", c = "_toolbarItem_1ml63_31", i = "_active_1ml63_55", a = "_format_1ml63_59", l = "_actionButton_1ml63_66", s = "_inputSubmitActionButton_1ml63_72", m = "_submitAction_1ml63_80", r = {
2
+ toolbar: t,
3
+ toolbarIsActive: o,
4
+ iconToolbar: n,
5
+ shortBar: _,
6
+ toolbarItem: c,
7
+ active: i,
8
+ format: a,
9
+ actionButton: l,
10
10
  inputSubmitActionButton: s,
11
- submitAction: e
11
+ submitAction: m
12
12
  };
13
13
  export {
14
- a as actionButton,
15
- _ as active,
16
- b as default,
17
- c as format,
18
- i as iconToolbar,
14
+ l as actionButton,
15
+ i as active,
16
+ r as default,
17
+ a as format,
18
+ n as iconToolbar,
19
19
  s as inputSubmitActionButton,
20
- n as shortBar,
21
- e as submitAction,
22
- o as toolbar,
23
- t as toolbarIsActive,
24
- r as toolbarItem
20
+ _ as shortBar,
21
+ m as submitAction,
22
+ t as toolbar,
23
+ o as toolbarIsActive,
24
+ c as toolbarItem
25
25
  };
@@ -1,65 +1,72 @@
1
- import { jsx as a, jsxs as d, Fragment as O } from "react/jsx-runtime";
1
+ import { jsx as a, jsxs as d, Fragment as S } from "react/jsx-runtime";
2
2
  import { useState as l } from "react";
3
- import { useIntl as ee, FormattedMessage as ae } from "react-intl";
3
+ import { useIntl as re, FormattedMessage as ie } from "react-intl";
4
4
  import s from "./OnboardingModal.module.scss.js";
5
- import { useAuth as te } from "../../auth/use_auth/useAuth.js";
6
- import { useDataProvider as se } from "../../data/data_provider/useDataProvider.js";
7
- import { useConfig as re } from "../../data/config_provider/useConfig.js";
8
- import { useResponsive as ie } from "../../hooks/use_responsive/useResponsive.js";
9
- import { useFormValidation as le } from "../../forms/use_form_validation/useFormValidation.js";
10
- import { useModal as oe } from "../../dialog/modal/useModal.js";
11
- import { Modal as ne } from "../../dialog/modal/Modal.js";
12
- import { Loader as de } from "../../progress/loader/Loader.js";
13
- import { AvatarSelector as ce } from "../avatar_selector/AvatarSelector.js";
14
- import { Icon as me } from "../../icons/icon/Icon.js";
15
- import { Button as S } from "../../action/button/Button.js";
16
- import { TextInput as F } from "../../input/text_input/TextInput.js";
17
- import { Select as ue } from "../../input/select/Select.js";
5
+ import { useAuth as le } from "../../auth/use_auth/useAuth.js";
6
+ import { useDataProvider as oe } from "../../data/data_provider/useDataProvider.js";
7
+ import { useConfig as ne } from "../../data/config_provider/useConfig.js";
8
+ import { useResponsive as de } from "../../hooks/use_responsive/useResponsive.js";
9
+ import { useFormValidation as ce } from "../../forms/use_form_validation/useFormValidation.js";
10
+ import { useModal as me } from "../../dialog/modal/useModal.js";
11
+ import { Modal as ue } from "../../dialog/modal/Modal.js";
12
+ import { Loader as fe } from "../../progress/loader/Loader.js";
13
+ import { AvatarSelector as pe } from "../avatar_selector/AvatarSelector.js";
14
+ import { Icon as ge } from "../../icons/icon/Icon.js";
15
+ import { Button as F } from "../../action/button/Button.js";
16
+ import { TextInput as B } from "../../input/text_input/TextInput.js";
17
+ import { Select as _e } from "../../input/select/Select.js";
18
18
  import { Toggle as D } from "../../input/toggle/Toggle.js";
19
- const Se = ({
19
+ const Le = ({
20
20
  termsUrl: L,
21
- privacyUrl: B,
22
- showEmailConsent: U = !1,
23
- showTerms: f = !1,
21
+ privacyUrl: A,
22
+ showEmailConsent: y = !1,
23
+ showTerms: g = !1,
24
24
  pendingAuth: n = !1,
25
- onConsentConfirmed: y = null
25
+ onConsentConfirmed: C = null,
26
+ initialFirstName: j = "",
27
+ initialLastName: $ = "",
28
+ initialImageUrl: x = null
26
29
  }) => {
27
- const o = te(), A = se(), r = ee(), i = re(), $ = [...Array(i.avatars?.maxFileName || 0).keys()].map(
30
+ const o = le(), R = oe(), r = re(), i = ne(), q = [...Array(i.avatars?.maxFileName || 0).keys()].map(
28
31
  (e) => `${i.avatars?.baseUrl}/${e + 1}.${i.avatars?.fileExtension}`
29
- ), [p, j] = l(o.currentUser.first_name || ""), [g, R] = l(
32
+ ), [m, E] = l(
33
+ j || o.currentUser.first_name || ""
34
+ ), [_, z] = l(
30
35
  o.currentUser.description || ""
31
- ), [_, q] = l(o.currentUser.last_name || ""), [h, E] = l(o.currentUser.language), [z, v] = l(!1), [C, x] = l(
32
- o.currentUser.image_url
33
- ), [m, T] = l(null), [k, P] = l(!1), [V, W] = l(!1), { isMobile: w } = ie(), { errors: c, validate: G } = le(), { hideModal: I } = oe(), [b, H] = l(!1), [M, J] = l(!1), K = (e) => {
36
+ ), [u, T] = l(
37
+ $ || o.currentUser.last_name || ""
38
+ ), [h, V] = l(o.currentUser.language), [W, v] = l(!1), [b, k] = l(
39
+ x || o.currentUser.image_url
40
+ ), [f, G] = l(x || null), H = [m, u].filter(Boolean).join(" ") || o.currentUser?.full_name, [P, w] = l(!1), [J, K] = l(!1), { isMobile: I } = de(), { errors: c, validate: Q } = ce(), { hideModal: O } = me(), [M, X] = l(!1), [N, Y] = l(!1), Z = (e) => {
34
41
  const t = new FileReader();
35
42
  t.onloadend = () => {
36
- x(t.result);
43
+ k(t.result);
37
44
  }, t.readAsDataURL(e);
38
- }, Q = [
45
+ }, ee = [
39
46
  { first_name: ["required", null] },
40
47
  { first_name: ["minChar", 2] },
41
48
  { last_name: ["required", null] },
42
49
  { last_name: ["minChar", 2] },
43
50
  ...n ? [] : [{ language: ["required", null] }],
44
- ...f ? [{ accepts_terms: ["enforceValue", !0] }] : []
45
- ], X = (e) => {
51
+ ...g ? [{ accepts_terms: ["enforceValue", !0] }] : []
52
+ ], ae = (e) => {
46
53
  e.preventDefault();
47
54
  const t = {};
48
- if (p && (t.first_name = p), _ && (t.last_name = _), h && (t.language = h), m && k && (t.image = m), m && !k && (t.origin_image_url = m), g && (t.description = g), U && (t.accepts_provider_email = M), f && (t.accepts_terms = b), t.is_onboarded = !0, G(t, Q)) {
49
- W(!0);
50
- const N = new FormData();
51
- Object.entries(t).forEach(([u, Z]) => {
52
- N.append(u, Z);
53
- }), n && y ? y(N, t) : A.update("users", o.currentUser.slug, N).then((u) => {
54
- u.data.success && o.setCurrentUser(u.data.data.resource), I();
55
+ if (m && (t.first_name = m), u && (t.last_name = u), h && (t.language = h), f && P && (t.image = n ? b : f), f && !P && (t.origin_image_url = f), _ && (t.description = _), y && (t.accepts_provider_email = N), g && (t.accepts_terms = M), t.is_onboarded = !0, Q(t, ee)) {
56
+ K(!0);
57
+ const U = new FormData();
58
+ Object.entries(t).forEach(([p, se]) => {
59
+ U.append(p, se);
60
+ }), n && C ? C(U, t) : R.update("users", o.currentUser.slug, U).then((p) => {
61
+ p.data.success && o.setCurrentUser(p.data.data.resource), O();
55
62
  });
56
63
  }
57
- }, Y = (e) => {
64
+ }, te = (e) => {
58
65
  const t = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/i;
59
- T(e), v(!1), t.test(e) ? (x(e), P(!1)) : (P(!0), K(e));
66
+ G(e), v(!1), t.test(e) ? (k(e), w(!1)) : (w(!0), Z(e));
60
67
  };
61
68
  return /* @__PURE__ */ a(
62
- ne,
69
+ ue,
63
70
  {
64
71
  "data-vid": "update_user_info_modal",
65
72
  title: n ? r.formatMessage({
@@ -70,19 +77,19 @@ const Se = ({
70
77
  defaultMessage: "Update your profile"
71
78
  }),
72
79
  style: {
73
- width: w ? "unset" : "max-content",
74
- minWidth: w ? "unset" : "500px",
80
+ width: I ? "unset" : "max-content",
81
+ minWidth: I ? "unset" : "500px",
75
82
  maxWidth: "800px"
76
83
  },
77
84
  showCloseButton: !1,
78
85
  disableClickOutside: !0,
79
- children: V ? /* @__PURE__ */ a(de, {}) : z && !n ? /* @__PURE__ */ d(O, { children: [
86
+ children: J ? /* @__PURE__ */ a(fe, {}) : W ? /* @__PURE__ */ d(S, { children: [
80
87
  /* @__PURE__ */ a(
81
- ce,
88
+ pe,
82
89
  {
83
- onChooseAvatar: Y,
84
- avatarUrlList: $,
85
- userName: o.currentUser.full_name,
90
+ onChooseAvatar: te,
91
+ avatarUrlList: q,
92
+ userName: H,
86
93
  allowUserImage: i.avatars?.allowUserImage
87
94
  }
88
95
  ),
@@ -97,21 +104,21 @@ const Se = ({
97
104
  })
98
105
  }
99
106
  )
100
- ] }) : /* @__PURE__ */ d(O, { children: [
107
+ ] }) : /* @__PURE__ */ d(S, { children: [
101
108
  /* @__PURE__ */ d("div", { className: s.container, children: [
102
109
  /* @__PURE__ */ d("div", { className: s.userImageContainer, children: [
103
- C ? /* @__PURE__ */ a(
110
+ b ? /* @__PURE__ */ a(
104
111
  "img",
105
112
  {
106
113
  className: s.userPictureUpload,
107
- src: C,
114
+ src: b,
108
115
  alt: r.formatMessage({
109
116
  id: "alt.my_profile_picture",
110
117
  defaultMessage: "Ma photo de profil"
111
118
  })
112
119
  }
113
120
  ) : /* @__PURE__ */ a("div", { className: s.userPictureUpload, children: /* @__PURE__ */ a(
114
- me,
121
+ ge,
115
122
  {
116
123
  name: "camera",
117
124
  height: 20,
@@ -122,8 +129,8 @@ const Se = ({
122
129
  })
123
130
  }
124
131
  ) }),
125
- !n && /* @__PURE__ */ a(
126
- S,
132
+ /* @__PURE__ */ a(
133
+ F,
127
134
  {
128
135
  "data-testid": "avatar-button",
129
136
  "data-tid": "action_save_profile",
@@ -139,7 +146,7 @@ const Se = ({
139
146
  /* @__PURE__ */ d("div", { className: s.inputsContainer, children: [
140
147
  /* @__PURE__ */ d("div", { className: s.nameContainer, children: [
141
148
  /* @__PURE__ */ a("div", { className: s.updateProfileInput, children: /* @__PURE__ */ a(
142
- F,
149
+ B,
143
150
  {
144
151
  type: "text",
145
152
  name: "first_name",
@@ -151,8 +158,8 @@ const Se = ({
151
158
  id: "auth_signup_form_first_name_placeholder",
152
159
  defaultMessage: "First name"
153
160
  }),
154
- onChange: (e) => i.actions?.disableOnboardingNameUpdate === !0 ? null : j(e.target.value),
155
- value: p,
161
+ onChange: (e) => i.actions?.disableOnboardingNameUpdate === !0 ? null : E(e.target.value),
162
+ value: m,
156
163
  error: !!c.first_name,
157
164
  message: c.first_name,
158
165
  "data-testid": "first-name",
@@ -160,7 +167,7 @@ const Se = ({
160
167
  }
161
168
  ) }),
162
169
  /* @__PURE__ */ a("div", { className: s.updateProfileInput, children: /* @__PURE__ */ a(
163
- F,
170
+ B,
164
171
  {
165
172
  type: "text",
166
173
  name: "last_name",
@@ -172,8 +179,8 @@ const Se = ({
172
179
  id: "auth_signup_form_last_name_placeholder",
173
180
  defaultMessage: "Last name"
174
181
  }),
175
- onChange: (e) => i.actions?.disableOnboardingNameUpdate === !0 ? null : q(e.target.value),
176
- value: _,
182
+ onChange: (e) => i.actions?.disableOnboardingNameUpdate === !0 ? null : T(e.target.value),
183
+ value: u,
177
184
  error: !!c.last_name,
178
185
  message: c.last_name,
179
186
  "data-testid": "last-name",
@@ -186,7 +193,7 @@ const Se = ({
186
193
  defaultMessage: "last name"
187
194
  }) }),
188
195
  !n && i.translation?.translationMethods && Object.keys(i.translation.translationMethods).length > 0 && /* @__PURE__ */ a(
189
- ue,
196
+ _e,
190
197
  {
191
198
  selectClassName: s.langSelect,
192
199
  options: Object.keys(
@@ -197,7 +204,7 @@ const Se = ({
197
204
  text: `${e.toUpperCase()}`
198
205
  })),
199
206
  defaultOption: h,
200
- onChange: (e) => E(e.value)
207
+ onChange: (e) => V(e.value)
201
208
  }
202
209
  ),
203
210
  !n && /* @__PURE__ */ a("div", { className: s.userDescription, children: /* @__PURE__ */ a(
@@ -208,23 +215,23 @@ const Se = ({
208
215
  id: "user.user_edit.user_description",
209
216
  defaultMessage: "Describe yourself in a few words"
210
217
  }),
211
- value: g,
212
- onChange: (e) => R(e.target.value),
218
+ value: _,
219
+ onChange: (e) => z(e.target.value),
213
220
  maxLength: 500,
214
221
  "data-testid": "description"
215
222
  }
216
223
  ) })
217
224
  ] })
218
225
  ] }),
219
- f && /* @__PURE__ */ a("div", { className: s.toggle, children: /* @__PURE__ */ a(
226
+ g && /* @__PURE__ */ a("div", { className: s.toggle, children: /* @__PURE__ */ a(
220
227
  D,
221
228
  {
222
229
  type: "checkbox",
223
230
  name: "accepts_terms",
224
231
  style: { fontSize: 18 },
225
- checked: b,
232
+ checked: M,
226
233
  label: /* @__PURE__ */ a(
227
- ae,
234
+ ie,
228
235
  {
229
236
  id: "modal.update_user_info_modal.accepts_terms",
230
237
  defaultMessage: "I declare I have read the <var1>General Conditions of Use</var1> and the <var2>Privacy policy</var2> of the debate space and accept them.",
@@ -244,7 +251,7 @@ const Se = ({
244
251
  {
245
252
  className: s.cgu,
246
253
  target: "_blank",
247
- href: B,
254
+ href: A,
248
255
  rel: "noreferrer",
249
256
  children: e
250
257
  }
@@ -252,18 +259,18 @@ const Se = ({
252
259
  }
253
260
  }
254
261
  ),
255
- onInputChanged: (e) => H(!b),
262
+ onInputChanged: (e) => X(!M),
256
263
  message: c.accepts_terms,
257
264
  "data-testid": "accepts-terms-input"
258
265
  }
259
266
  ) }),
260
- U && /* @__PURE__ */ a("div", { className: s.toggle, children: /* @__PURE__ */ a(
267
+ y && /* @__PURE__ */ a("div", { className: s.toggle, children: /* @__PURE__ */ a(
261
268
  D,
262
269
  {
263
270
  type: "checkbox",
264
271
  name: "accepts_provider_email",
265
272
  style: { fontSize: 18 },
266
- checked: M,
273
+ checked: N,
267
274
  label: r.formatMessage(
268
275
  {
269
276
  id: "modal.update_user_info_modal.consent_label",
@@ -271,16 +278,16 @@ const Se = ({
271
278
  },
272
279
  { provider: i.provider?.companyName }
273
280
  ),
274
- onInputChanged: (e) => J(!M),
281
+ onInputChanged: (e) => Y(!N),
275
282
  "data-testid": "accepts-email-input"
276
283
  }
277
284
  ) }),
278
285
  /* @__PURE__ */ a("div", { className: s.userSaveBox, children: /* @__PURE__ */ a(
279
- S,
286
+ F,
280
287
  {
281
288
  "data-testid": "save-button",
282
289
  "data-tid": "action_save_profile",
283
- onClick: (e) => X(e),
290
+ onClick: (e) => ae(e),
284
291
  children: r.formatMessage({
285
292
  id: "user.user_edit.save",
286
293
  defaultMessage: "Save"
@@ -292,5 +299,5 @@ const Se = ({
292
299
  );
293
300
  };
294
301
  export {
295
- Se as OnboardingModal
302
+ Le as OnboardingModal
296
303
  };
@@ -1,80 +1,85 @@
1
- import { jsx as B } from "react/jsx-runtime";
2
- import { useState as w, useEffect as S } from "react";
3
- import { OnboardingModal as E } from "./OnboardingModal.js";
4
- import { useAuth as I } from "../../auth/use_auth/useAuth.js";
5
- import { useModal as A } from "../../dialog/modal/useModal.js";
1
+ import { jsx as L } from "react/jsx-runtime";
2
+ import { useState as h, useEffect as S } from "react";
3
+ import { OnboardingModal as A } from "./OnboardingModal.js";
4
+ import { useAuth as E } from "../../auth/use_auth/useAuth.js";
5
+ import { useModal as I } from "../../dialog/modal/useModal.js";
6
6
  import { useDataProvider as U } from "../../data/data_provider/useDataProvider.js";
7
7
  import { useConfig as C } from "../../data/config_provider/useConfig.js";
8
- const i = "logora:onboardingBeforeLogin", g = (t) => t ? `${i}:${t}` : i, T = (t, r) => {
8
+ const c = "logora:onboardingBeforeLogin", w = (n) => n ? `${c}:${n}` : c, D = (n) => {
9
+ const [t, a] = n.split(","), d = t.match(/^data:([^;]+)/)?.[1] || "application/octet-stream", i = atob(a), g = new Uint8Array(i.length);
10
+ for (let o = 0; o < i.length; o++)
11
+ g[o] = i.charCodeAt(o);
12
+ return new Blob([g], { type: d });
13
+ }, x = (n, t) => {
9
14
  typeof window > "u" || !window.sessionStorage || window.sessionStorage.setItem(
10
- g(t),
11
- JSON.stringify(r)
15
+ w(n),
16
+ JSON.stringify(t)
12
17
  );
13
- }, x = () => {
14
- const t = I(), { currentUser: r, isLoggedIn: f } = t, { showModal: b, isModalPresent: u } = A(), _ = U(), n = C(), [a, d] = w(!1), [l, O] = w(!1), h = () => {
15
- b(
16
- /* @__PURE__ */ B(
17
- E,
18
+ }, F = () => {
19
+ const n = E(), { currentUser: t, isLoggedIn: a } = n, { showModal: d, isModalPresent: i } = I(), g = U(), o = C(), [f, l] = h(!1), [b, O] = h(!1), y = () => {
20
+ d(
21
+ /* @__PURE__ */ L(
22
+ A,
18
23
  {
19
- showEmailConsent: n.auth?.showEmailConsent,
20
- showTerms: n.auth?.hideCgu !== !0,
21
- termsUrl: n.provider?.cguUrl || "https://www.logora.com/blog-posts/cgu",
22
- privacyUrl: n.provider?.privacyUrl || "https://www.logora.com/blog-posts/privacy-policy"
24
+ showEmailConsent: o.auth?.showEmailConsent,
25
+ showTerms: o.auth?.hideCgu !== !0,
26
+ termsUrl: o.provider?.cguUrl || "https://www.logora.com/blog-posts/cgu",
27
+ privacyUrl: o.provider?.privacyUrl || "https://www.logora.com/blog-posts/privacy-policy"
23
28
  }
24
29
  )
25
30
  );
26
31
  };
27
32
  S(() => {
28
- if (!a && !u && f && r?.is_onboarded === !1 && n.auth?.showOnboarding === !0) {
29
- if (v()) {
30
- y();
33
+ if (!f && !i && a && t?.is_onboarded === !1 && o.auth?.showOnboarding === !0) {
34
+ if (B()) {
35
+ v();
31
36
  return;
32
37
  }
33
- h();
38
+ y();
34
39
  }
35
- }, [u, f, r?.slug, r?.is_onboarded, n.auth?.showOnboarding, a, l]);
36
- const p = () => {
40
+ }, [i, a, t?.slug, t?.is_onboarded, o.auth?.showOnboarding, f, b]);
41
+ const _ = () => {
37
42
  if (typeof window > "u" || !window.sessionStorage)
38
43
  return null;
39
- const e = window.sessionStorage.getItem(g(n.shortname)) || window.sessionStorage.getItem(i);
44
+ const e = window.sessionStorage.getItem(w(o.shortname)) || window.sessionStorage.getItem(c);
40
45
  if (!e)
41
46
  return null;
42
47
  try {
43
- const o = JSON.parse(e);
44
- return o && typeof o == "object" ? o : { accepts_terms: !0 };
48
+ const r = JSON.parse(e);
49
+ return r && typeof r == "object" ? r : { accepts_terms: !0 };
45
50
  } catch {
46
51
  return { accepts_terms: e === "true" };
47
52
  }
48
- }, c = () => {
49
- typeof window > "u" || !window.sessionStorage || (window.sessionStorage.removeItem(g(n.shortname)), window.sessionStorage.removeItem(i));
50
- }, v = () => {
51
- if (a || l || n.auth?.showOnboardingBeforeLogin !== !0 || !r?.slug)
53
+ }, p = () => {
54
+ typeof window > "u" || !window.sessionStorage || (window.sessionStorage.removeItem(w(o.shortname)), window.sessionStorage.removeItem(c));
55
+ }, B = () => {
56
+ if (f || b || o.auth?.showOnboardingBeforeLogin !== !0 || !t?.slug)
52
57
  return !1;
53
- const e = p();
58
+ const e = _();
54
59
  return e?.accepts_terms === !0 || e?.acceptsTerms === !0;
55
- }, y = () => {
56
- const e = p();
60
+ }, v = () => {
61
+ const e = _();
57
62
  if (!e)
58
63
  return;
59
- const o = {
64
+ const r = {
60
65
  accepts_terms: !0,
61
66
  is_onboarded: !0
62
67
  };
63
- e.accepts_provider_email !== void 0 ? o.accepts_provider_email = e.accepts_provider_email : e.acceptsProviderEmail !== void 0 && (o.accepts_provider_email = e.acceptsProviderEmail), e.first_name && !r.first_name && (o.first_name = e.first_name), e.last_name && !r.last_name && (o.last_name = e.last_name);
68
+ e.accepts_provider_email !== void 0 ? r.accepts_provider_email = e.accepts_provider_email : e.acceptsProviderEmail !== void 0 && (r.accepts_provider_email = e.acceptsProviderEmail), e.first_name && !t.first_name && (r.first_name = e.first_name), e.last_name && !t.last_name && (r.last_name = e.last_name), e.origin_image_url && (r.origin_image_url = e.origin_image_url), e.image && typeof e.image == "string" && (r.image = D(e.image));
64
69
  const m = new FormData();
65
- Object.entries(o).forEach(([s, L]) => {
66
- m.append(s, L);
67
- }), d(!0), O(!0), _.update("users", r.slug, m).then((s) => {
68
- d(!1), s.data.success ? (c(), t.setCurrentUser(s.data.data.resource)) : c();
70
+ Object.entries(r).forEach(([s, u]) => {
71
+ s === "image" && u instanceof Blob ? m.append(s, u, "avatar.png") : m.append(s, u);
72
+ }), l(!0), O(!0), g.update("users", t.slug, m).then((s) => {
73
+ l(!1), s.data.success ? (p(), n.setCurrentUser(s.data.data.resource)) : p();
69
74
  }).catch(() => {
70
- c(), d(!1);
75
+ p(), l(!1);
71
76
  });
72
77
  };
73
78
  return null;
74
79
  };
75
80
  export {
76
- i as ONBOARDING_BEFORE_LOGIN_STORAGE_KEY,
77
- g as getOnboardingBeforeLoginStorageKey,
78
- T as saveOnboardingBeforeLogin,
79
- x as useOnboarding
81
+ c as ONBOARDING_BEFORE_LOGIN_STORAGE_KEY,
82
+ w as getOnboardingBeforeLoginStorageKey,
83
+ x as saveOnboardingBeforeLogin,
84
+ F as useOnboarding
80
85
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.4.57",
3
+ "version": "0.4.59",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",
@@ -16,7 +16,6 @@ $box-shadow-main-container : var(--box-shadow-main-container, $box-shadow);
16
16
  $box-border: var(--box-border, 1px solid rgba(7,42,68, 0.1));
17
17
  $box-border-main-container: var(--box-border-main-container, $box-border);
18
18
  $box-border-radius: var(--box-border-radius, 6px);
19
- $button-shadow: var(--button-shadow, $box-shadow);
20
19
  $button-border: var(--button-border, $box-border);
21
20
  $button-border-radius: var(--button-border-radius, $box-border-radius);
22
21
  $text-primary: var(--text-primary, #222222);
@@ -68,7 +68,6 @@ This SASS file contains all the variables used for defining colors, fonts, borde
68
68
 
69
69
  - **$box-shadow**: Box shadow for boxes (`0px 2px 5px rgba(7,42,68, 0.1)`).
70
70
  - **$box-shadow-main-container**: Box shadow for main containers (defaults to `$box-shadow`).
71
- - **$button-shadow**: Box shadow for buttons (`0px 2px 5px rgba(7,42,68, 0.1)`).
72
71
 
73
72
  ### Layout
74
73
 
@@ -1 +0,0 @@
1
- ._toolbar_iro9e_3{display:flex!important;justify-content:space-between!important;flex-wrap:wrap;background:var(--background-color-primary, white);padding-top:var(--spacer-md, calc(var(--space-unit, 1em) * .75))!important;vertical-align:middle;align-items:flex-start;gap:var(--space-unit, 1em)}._toolbar_iro9e_3._toolbarIsActive_iro9e_13{border-top:1px solid var(--text-tertiary, #fafafa)}._iconToolbar_iro9e_17{display:flex!important;gap:var(--spacer-lg, calc(var(--space-unit, 1em) * 1.5))}._iconToolbar_iro9e_17._shortBar_iro9e_21{gap:var(--spacer-md, calc(var(--space-unit, 1em) * .75))}._toolbarItem_iro9e_25{-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;border:0;background:none;padding:0!important;cursor:pointer;vertical-align:middle;touch-action:manipulation;display:flex;align-items:center;justify-content:center;outline:none}@container (max-width: 575.98px){._toolbarItem_iro9e_25{min-width:44px;min-height:44px}}._toolbarItem_iro9e_25._disabled_iro9e_46{cursor:not-allowed}._toolbarItem_iro9e_25:active,._toolbarItem_iro9e_25._active_iro9e_49{background-color:#bababa66!important;border-radius:50%}._toolbarItem_iro9e_25 ._format_iro9e_53{background-size:contain;display:inline-block;vertical-align:-.25em;display:flex!important}._actionButton_iro9e_60{display:flex!important;gap:var(--space-unit, 1em);margin-left:auto}._inputSubmitActionButton_iro9e_66{width:100%;height:35px;display:flex!important;justify-content:center!important;align-items:center!important;background-color:var(--call-primary-color, #434343)!important}._inputSubmitActionButton_iro9e_66._submitAction_iro9e_74 svg{fill:var(--text-light, white)!important}._inputSubmitActionButton_iro9e_66 ._inputSourceText_iro9e_77{display:none!important;margin-left:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;font-size:var(--font-size-small, 16px)}@container (min-width: 576px){._inputSubmitActionButton_iro9e_66 ._inputSourceText_iro9e_77{display:block!important}}._tooltip_iro9e_88{width:230px!important;margin-left:-117px!important}