@logora/debate 0.4.56 → 0.4.58
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/input/text_editor/plugins/ToolbarPlugin.module-DSNBpqDn.css +1 -0
- package/dist/components/auth/auth_initializer/AuthInitializer.js +87 -54
- package/dist/components/gamification/badge_box/BadgeBox.js +47 -45
- package/dist/components/input/text_editor/plugins/ResetPlugin.js +14 -12
- package/dist/components/input/text_editor/plugins/ToolbarPlugin.js +46 -45
- package/dist/components/input/text_editor/plugins/ToolbarPlugin.module.scss.js +20 -20
- package/dist/components/user/onboarding_modal/OnboardingModal.js +80 -73
- package/dist/components/user/onboarding_modal/useOnboarding.js +49 -44
- package/package.json +1 -1
- package/dist/assets/components/input/text_editor/plugins/ToolbarPlugin.module-f1t2UhlS.css +0 -1
|
@@ -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
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useAuthInterceptor as
|
|
5
|
-
import { authTokenHandler as
|
|
6
|
-
import { useAuthActions as
|
|
7
|
-
import { useAuthRequired as
|
|
8
|
-
import { AuthProviderFactory as
|
|
9
|
-
import { OnboardingModal as
|
|
10
|
-
import { saveOnboardingBeforeLogin as
|
|
11
|
-
import { httpClient as
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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",
|
|
29
|
-
window.removeEventListener("logora:authentication:require",
|
|
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
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
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
|
-
|
|
39
|
-
},
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
if (
|
|
44
|
-
|
|
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
|
-
|
|
76
|
+
g(i);
|
|
48
77
|
}
|
|
49
78
|
} else
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
|
|
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:
|
|
60
|
-
showTerms:
|
|
61
|
-
showEmailConsent:
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
100
|
+
X as AuthInitializer,
|
|
101
|
+
j as decodeJwtPayload
|
|
69
102
|
};
|
|
@@ -1,95 +1,97 @@
|
|
|
1
|
-
import { jsxs as o, jsx as
|
|
2
|
-
import
|
|
3
|
-
import "react";
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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:
|
|
13
|
+
steps: s,
|
|
13
14
|
title: c,
|
|
14
15
|
progress: t,
|
|
15
16
|
eloquenceTitle: m
|
|
16
17
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
return /* @__PURE__ */ o("div", { className:
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
|
|
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:
|
|
24
|
+
values: { count: r },
|
|
24
25
|
defaultMessage: "Level {count}"
|
|
25
26
|
}
|
|
26
27
|
) }),
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ a("div", { className: e.badgeImageBox, children: /* @__PURE__ */ a(
|
|
28
29
|
"img",
|
|
29
30
|
{
|
|
30
|
-
className:
|
|
31
|
-
src:
|
|
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__ */
|
|
40
|
-
id: `gamification.badge_box.${
|
|
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__ */
|
|
44
|
-
|
|
45
|
+
/* @__PURE__ */ a("div", { className: e.badgeDescription, children: /* @__PURE__ */ a(
|
|
46
|
+
l,
|
|
45
47
|
{
|
|
46
|
-
id: `gamification.badge_box.${
|
|
47
|
-
values: { count:
|
|
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:
|
|
52
|
-
t >=
|
|
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__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
57
|
+
}) }) : /* @__PURE__ */ a("span", { children: t + "/" + s }),
|
|
58
|
+
/* @__PURE__ */ a(
|
|
59
|
+
$,
|
|
58
60
|
{
|
|
59
61
|
progress: t,
|
|
60
|
-
goal:
|
|
61
|
-
className:
|
|
62
|
-
innerClassName:
|
|
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:
|
|
70
|
-
[
|
|
71
|
-
[
|
|
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__ */
|
|
77
|
+
/* @__PURE__ */ a("span", { children: m === i ? d.formatMessage({
|
|
76
78
|
id: "gamification.badge_box.title_shown",
|
|
77
79
|
defaultMessage: "Title shown :"
|
|
78
|
-
}) : t >=
|
|
80
|
+
}) : t >= s ? d.formatMessage({
|
|
79
81
|
id: "gamification.badge_box.title_obtained",
|
|
80
82
|
defaultMessage: "Title obtained :"
|
|
81
|
-
}) : /* @__PURE__ */
|
|
82
|
-
|
|
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:
|
|
91
|
+
/* @__PURE__ */ o("span", { className: e.rewardName, children: [
|
|
90
92
|
'"',
|
|
91
|
-
|
|
92
|
-
id: `gamification.badge_box.${
|
|
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
|
-
|
|
105
|
+
j as BadgeBox
|
|
104
106
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { useLexicalComposerContext as p } from "@lexical/react/LexicalComposerContext";
|
|
2
|
-
import
|
|
3
|
-
import { $addUpdateTag as
|
|
4
|
-
import { useEffect as
|
|
2
|
+
import m from "@rooks/use-localstorage-state";
|
|
3
|
+
import { $addUpdateTag as i, $getRoot as l, $createParagraphNode as f } from "lexical";
|
|
4
|
+
import { useEffect as d } from "react";
|
|
5
5
|
import { useInput as u } from "../../input_provider/useInput.js";
|
|
6
|
-
const
|
|
7
|
-
const [
|
|
8
|
-
`TextEditor:content_${
|
|
6
|
+
const L = ({ storageUid: s }) => {
|
|
7
|
+
const [n] = p(), { reset: t, setReset: a } = u(), [g, x, c] = m(
|
|
8
|
+
`TextEditor:content_${s}`,
|
|
9
9
|
{}
|
|
10
10
|
);
|
|
11
|
-
return
|
|
12
|
-
t &&
|
|
13
|
-
|
|
14
|
-
const e =
|
|
15
|
-
e.clear(), e.append(
|
|
11
|
+
return d(() => {
|
|
12
|
+
t && n.update(() => {
|
|
13
|
+
i("skip-dom-selection");
|
|
14
|
+
const e = l(), o = f();
|
|
15
|
+
e.clear(), e.append(o);
|
|
16
|
+
const r = o.selectStart();
|
|
17
|
+
r.format = 0, r.style = "", c(), a(!1);
|
|
16
18
|
});
|
|
17
19
|
}, [t]), null;
|
|
18
20
|
};
|
|
19
21
|
export {
|
|
20
|
-
|
|
22
|
+
L as ResetPlugin
|
|
21
23
|
};
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { $isListNode as
|
|
1
|
+
import { jsxs as B, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { $isListNode as $, ListNode as Y, INSERT_ORDERED_LIST_COMMAND as Z, $isListItemNode as q, $createListNode as ee } from "@lexical/list";
|
|
3
3
|
import { useLexicalComposerContext as te } from "@lexical/react/LexicalComposerContext";
|
|
4
|
-
import { $isHeadingNode as oe, $createQuoteNode as
|
|
5
|
-
import { $setBlocksType as
|
|
4
|
+
import { $isHeadingNode as oe, $createQuoteNode as K } from "@lexical/rich-text";
|
|
5
|
+
import { $setBlocksType as F } from "@lexical/selection";
|
|
6
6
|
import { $getNearestNodeOfType as ne, mergeRegister as ie } from "@lexical/utils";
|
|
7
7
|
import l from "classnames";
|
|
8
|
-
import { $getSelection as M, $isRangeSelection as I, SELECTION_CHANGE_COMMAND as le, FORMAT_TEXT_COMMAND as ae, $createParagraphNode as
|
|
9
|
-
import { useRef as
|
|
8
|
+
import { $getSelection as M, $isRangeSelection as I, SELECTION_CHANGE_COMMAND as le, FORMAT_TEXT_COMMAND as ae, $createParagraphNode as U } from "lexical";
|
|
9
|
+
import { useRef as D, useState as N, useCallback as re, useEffect as j } from "react";
|
|
10
10
|
import { useIntl as se } from "react-intl";
|
|
11
11
|
import t from "./ToolbarPlugin.module.scss.js";
|
|
12
12
|
import { Icon as f } from "../../../icons/icon/Icon.js";
|
|
13
13
|
import { Button as ce } from "../../../action/button/Button.js";
|
|
14
14
|
const Ce = (r) => {
|
|
15
|
-
const d = se(),
|
|
15
|
+
const d = se(), H = 1, [a] = te(), Q = D(null), [T, C] = N("paragraph"), [de, E] = N(null), [V, k] = N(!1), [z, w] = N(!1), [G, x] = N(!1), v = r.hideSubmit && r.hideSourceAction && r.disableRichText, _ = re(() => {
|
|
16
16
|
const e = M();
|
|
17
17
|
if (I(e)) {
|
|
18
18
|
const o = e.anchor.getNode(), s = o.getKey() === "root" ? o : o.getTopLevelElementOrThrow(), u = s.getKey();
|
|
19
19
|
if (a.getElementByKey(u) !== null)
|
|
20
|
-
if (
|
|
20
|
+
if (E(u), $(s)) {
|
|
21
21
|
const n = ne(o, Y), p = n ? n.getTag() : s.getTag();
|
|
22
|
-
|
|
22
|
+
C(p);
|
|
23
23
|
} else {
|
|
24
24
|
const n = oe(s) ? s.getTag() : s.getType();
|
|
25
|
-
|
|
25
|
+
C(n);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
}
|
|
27
|
+
k(e.hasFormat("bold")), w(e.hasFormat("italic")), x(e.hasFormat("underline"));
|
|
28
|
+
} else
|
|
29
|
+
E(null), C("paragraph"), k(!1), w(!1), x(!1);
|
|
29
30
|
}, [a]);
|
|
30
|
-
|
|
31
|
+
j(() => ie(
|
|
31
32
|
a.registerUpdateListener(({ editorState: e }) => {
|
|
32
33
|
e.read(() => {
|
|
33
34
|
_();
|
|
@@ -36,11 +37,11 @@ const Ce = (r) => {
|
|
|
36
37
|
a.registerCommand(
|
|
37
38
|
le,
|
|
38
39
|
() => (_(), !1),
|
|
39
|
-
|
|
40
|
+
H
|
|
40
41
|
)
|
|
41
42
|
), [a, _]);
|
|
42
|
-
const y =
|
|
43
|
-
|
|
43
|
+
const y = D(!1), c = D(null);
|
|
44
|
+
j(() => () => {
|
|
44
45
|
c.current && clearTimeout(c.current);
|
|
45
46
|
}, []);
|
|
46
47
|
const g = (e, o) => {
|
|
@@ -53,17 +54,17 @@ const Ce = (r) => {
|
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
56
|
e();
|
|
56
|
-
},
|
|
57
|
+
}, S = () => {
|
|
57
58
|
setTimeout(() => {
|
|
58
59
|
a.getEditorState().read(() => {
|
|
59
60
|
_();
|
|
60
61
|
});
|
|
61
62
|
}, 0);
|
|
62
63
|
}, b = (e) => {
|
|
63
|
-
a.dispatchCommand(ae, e), e === "bold" ?
|
|
64
|
+
a.dispatchCommand(ae, e), e === "bold" ? k((o) => !o) : e === "italic" ? w((o) => !o) : e === "underline" && x((o) => !o), a.focus(() => {
|
|
64
65
|
const o = a.getRootElement();
|
|
65
66
|
o && o.focus();
|
|
66
|
-
}),
|
|
67
|
+
}), S();
|
|
67
68
|
}, X = () => {
|
|
68
69
|
a.update(() => {
|
|
69
70
|
const e = M();
|
|
@@ -72,53 +73,53 @@ const Ce = (r) => {
|
|
|
72
73
|
const o = e.getNodes(), s = /* @__PURE__ */ new Set();
|
|
73
74
|
for (const m of o) {
|
|
74
75
|
let n = m;
|
|
75
|
-
for (; n !== null &&
|
|
76
|
+
for (; n !== null && !q(n); )
|
|
76
77
|
n = n.getParent();
|
|
77
|
-
|
|
78
|
+
q(n) && s.add(n);
|
|
78
79
|
}
|
|
79
80
|
const u = Array.from(s).reverse();
|
|
80
81
|
for (const m of u) {
|
|
81
82
|
const n = m.getParent();
|
|
82
|
-
if (
|
|
83
|
+
if (!$(n))
|
|
83
84
|
continue;
|
|
84
|
-
const p =
|
|
85
|
-
for (const
|
|
86
|
-
p.append(
|
|
87
|
-
const
|
|
88
|
-
if (n.insertAfter(p),
|
|
89
|
-
const
|
|
90
|
-
for (const W of
|
|
91
|
-
|
|
92
|
-
p.insertAfter(
|
|
85
|
+
const p = U(), J = m.getChildren();
|
|
86
|
+
for (const A of J)
|
|
87
|
+
p.append(A);
|
|
88
|
+
const L = m.getNextSiblings();
|
|
89
|
+
if (n.insertAfter(p), L.length > 0) {
|
|
90
|
+
const A = L[0].getValue(), R = ee(n.getListType(), A);
|
|
91
|
+
for (const W of L)
|
|
92
|
+
R.append(W);
|
|
93
|
+
p.insertAfter(R);
|
|
93
94
|
}
|
|
94
95
|
m.remove(), n.getChildrenSize() === 0 && n.remove();
|
|
95
96
|
}
|
|
96
97
|
});
|
|
97
|
-
}, v = () => {
|
|
98
|
-
T !== "ol" ? a.dispatchCommand(Z) : X(), C();
|
|
99
98
|
}, O = () => {
|
|
99
|
+
T !== "ol" ? a.dispatchCommand(Z) : X(), S();
|
|
100
|
+
}, P = () => {
|
|
100
101
|
T !== "quote" ? a.update(() => {
|
|
101
102
|
const e = M();
|
|
102
103
|
if (I(e))
|
|
103
104
|
if (e.isCollapsed()) {
|
|
104
|
-
const s = e.anchor.getNode().getTopLevelElementOrThrow(), u =
|
|
105
|
+
const s = e.anchor.getNode().getTopLevelElementOrThrow(), u = K();
|
|
105
106
|
s.insertAfter(u), u.selectEnd();
|
|
106
107
|
} else
|
|
107
|
-
|
|
108
|
+
F(e, () => K());
|
|
108
109
|
}) : a.update(() => {
|
|
109
110
|
const e = M();
|
|
110
|
-
I(e) &&
|
|
111
|
-
}),
|
|
111
|
+
I(e) && F(e, () => U());
|
|
112
|
+
}), S();
|
|
112
113
|
};
|
|
113
|
-
return
|
|
114
|
+
return v ? null : /* @__PURE__ */ B(
|
|
114
115
|
"div",
|
|
115
116
|
{
|
|
116
117
|
className: l(t.toolbar, {
|
|
117
|
-
[t.toolbarIsActive]:
|
|
118
|
+
[t.toolbarIsActive]: v ? !1 : r.isActive
|
|
118
119
|
}),
|
|
119
|
-
ref:
|
|
120
|
+
ref: Q,
|
|
120
121
|
children: [
|
|
121
|
-
r.isActive ? !r.disableRichText && /* @__PURE__ */
|
|
122
|
+
r.isActive ? !r.disableRichText && /* @__PURE__ */ B(
|
|
122
123
|
"div",
|
|
123
124
|
{
|
|
124
125
|
className: l(t.iconToolbar, {
|
|
@@ -199,8 +200,8 @@ const Ce = (r) => {
|
|
|
199
200
|
/* @__PURE__ */ i(
|
|
200
201
|
"button",
|
|
201
202
|
{
|
|
202
|
-
onPointerDown: (e) => g(e, () =>
|
|
203
|
-
onClick: () => h(() =>
|
|
203
|
+
onPointerDown: (e) => g(e, () => P()),
|
|
204
|
+
onClick: () => h(() => P()),
|
|
204
205
|
type: "button",
|
|
205
206
|
className: l(t.toolbarItem, {
|
|
206
207
|
[t.active]: T === "quote"
|
|
@@ -223,8 +224,8 @@ const Ce = (r) => {
|
|
|
223
224
|
/* @__PURE__ */ i(
|
|
224
225
|
"button",
|
|
225
226
|
{
|
|
226
|
-
onPointerDown: (e) => g(e, () =>
|
|
227
|
-
onClick: () => h(() =>
|
|
227
|
+
onPointerDown: (e) => g(e, () => O()),
|
|
228
|
+
onClick: () => h(() => O()),
|
|
228
229
|
type: "button",
|
|
229
230
|
className: l(t.toolbarItem, {
|
|
230
231
|
[t.active]: T === "ol"
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import '../../../../assets/components/input/text_editor/plugins/ToolbarPlugin.module-
|
|
2
|
-
toolbar:
|
|
3
|
-
toolbarIsActive:
|
|
4
|
-
iconToolbar:
|
|
5
|
-
shortBar:
|
|
6
|
-
toolbarItem:
|
|
7
|
-
active:
|
|
8
|
-
format:
|
|
9
|
-
actionButton:
|
|
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:
|
|
11
|
+
submitAction: m
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
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
|
|
3
|
+
import { useIntl as re, FormattedMessage as ie } from "react-intl";
|
|
4
4
|
import s from "./OnboardingModal.module.scss.js";
|
|
5
|
-
import { useAuth as
|
|
6
|
-
import { useDataProvider as
|
|
7
|
-
import { useConfig as
|
|
8
|
-
import { useResponsive as
|
|
9
|
-
import { useFormValidation as
|
|
10
|
-
import { useModal as
|
|
11
|
-
import { Modal as
|
|
12
|
-
import { Loader as
|
|
13
|
-
import { AvatarSelector as
|
|
14
|
-
import { Icon as
|
|
15
|
-
import { Button as
|
|
16
|
-
import { TextInput as
|
|
17
|
-
import { Select as
|
|
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
|
|
19
|
+
const Le = ({
|
|
20
20
|
termsUrl: L,
|
|
21
|
-
privacyUrl:
|
|
22
|
-
showEmailConsent:
|
|
23
|
-
showTerms:
|
|
21
|
+
privacyUrl: A,
|
|
22
|
+
showEmailConsent: y = !1,
|
|
23
|
+
showTerms: g = !1,
|
|
24
24
|
pendingAuth: n = !1,
|
|
25
|
-
onConsentConfirmed:
|
|
25
|
+
onConsentConfirmed: C = null,
|
|
26
|
+
initialFirstName: j = "",
|
|
27
|
+
initialLastName: $ = "",
|
|
28
|
+
initialImageUrl: x = null
|
|
26
29
|
}) => {
|
|
27
|
-
const o =
|
|
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
|
-
), [
|
|
32
|
+
), [m, E] = l(
|
|
33
|
+
j || o.currentUser.first_name || ""
|
|
34
|
+
), [_, z] = l(
|
|
30
35
|
o.currentUser.description || ""
|
|
31
|
-
), [
|
|
32
|
-
o.currentUser.
|
|
33
|
-
), [
|
|
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
|
-
|
|
43
|
+
k(t.result);
|
|
37
44
|
}, t.readAsDataURL(e);
|
|
38
|
-
},
|
|
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
|
-
...
|
|
45
|
-
],
|
|
51
|
+
...g ? [{ accepts_terms: ["enforceValue", !0] }] : []
|
|
52
|
+
], ae = (e) => {
|
|
46
53
|
e.preventDefault();
|
|
47
54
|
const t = {};
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
Object.entries(t).forEach(([
|
|
52
|
-
|
|
53
|
-
}), n &&
|
|
54
|
-
|
|
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
|
-
},
|
|
64
|
+
}, te = (e) => {
|
|
58
65
|
const t = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/i;
|
|
59
|
-
|
|
66
|
+
G(e), v(!1), t.test(e) ? (k(e), w(!1)) : (w(!0), Z(e));
|
|
60
67
|
};
|
|
61
68
|
return /* @__PURE__ */ a(
|
|
62
|
-
|
|
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:
|
|
74
|
-
minWidth:
|
|
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:
|
|
86
|
+
children: J ? /* @__PURE__ */ a(fe, {}) : W ? /* @__PURE__ */ d(S, { children: [
|
|
80
87
|
/* @__PURE__ */ a(
|
|
81
|
-
|
|
88
|
+
pe,
|
|
82
89
|
{
|
|
83
|
-
onChooseAvatar:
|
|
84
|
-
avatarUrlList:
|
|
85
|
-
userName:
|
|
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(
|
|
107
|
+
] }) : /* @__PURE__ */ d(S, { children: [
|
|
101
108
|
/* @__PURE__ */ d("div", { className: s.container, children: [
|
|
102
109
|
/* @__PURE__ */ d("div", { className: s.userImageContainer, children: [
|
|
103
|
-
|
|
110
|
+
b ? /* @__PURE__ */ a(
|
|
104
111
|
"img",
|
|
105
112
|
{
|
|
106
113
|
className: s.userPictureUpload,
|
|
107
|
-
src:
|
|
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
|
-
|
|
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
|
-
|
|
126
|
-
|
|
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
|
-
|
|
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 :
|
|
155
|
-
value:
|
|
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
|
-
|
|
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 :
|
|
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
|
-
|
|
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) =>
|
|
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:
|
|
212
|
-
onChange: (e) =>
|
|
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
|
-
|
|
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:
|
|
232
|
+
checked: M,
|
|
226
233
|
label: /* @__PURE__ */ a(
|
|
227
|
-
|
|
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:
|
|
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) =>
|
|
262
|
+
onInputChanged: (e) => X(!M),
|
|
256
263
|
message: c.accepts_terms,
|
|
257
264
|
"data-testid": "accepts-terms-input"
|
|
258
265
|
}
|
|
259
266
|
) }),
|
|
260
|
-
|
|
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:
|
|
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) =>
|
|
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
|
-
|
|
286
|
+
F,
|
|
280
287
|
{
|
|
281
288
|
"data-testid": "save-button",
|
|
282
289
|
"data-tid": "action_save_profile",
|
|
283
|
-
onClick: (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
|
-
|
|
302
|
+
Le as OnboardingModal
|
|
296
303
|
};
|
|
@@ -1,80 +1,85 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { OnboardingModal as
|
|
4
|
-
import { useAuth as
|
|
5
|
-
import { useModal as
|
|
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
|
|
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
|
-
|
|
11
|
-
JSON.stringify(
|
|
15
|
+
w(n),
|
|
16
|
+
JSON.stringify(t)
|
|
12
17
|
);
|
|
13
|
-
},
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
|
|
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:
|
|
20
|
-
showTerms:
|
|
21
|
-
termsUrl:
|
|
22
|
-
privacyUrl:
|
|
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 (!
|
|
29
|
-
if (
|
|
30
|
-
|
|
33
|
+
if (!f && !i && a && t?.is_onboarded === !1 && o.auth?.showOnboarding === !0) {
|
|
34
|
+
if (B()) {
|
|
35
|
+
v();
|
|
31
36
|
return;
|
|
32
37
|
}
|
|
33
|
-
|
|
38
|
+
y();
|
|
34
39
|
}
|
|
35
|
-
}, [
|
|
36
|
-
const
|
|
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(
|
|
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
|
|
44
|
-
return
|
|
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
|
-
},
|
|
49
|
-
typeof window > "u" || !window.sessionStorage || (window.sessionStorage.removeItem(
|
|
50
|
-
},
|
|
51
|
-
if (
|
|
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 =
|
|
58
|
+
const e = _();
|
|
54
59
|
return e?.accepts_terms === !0 || e?.acceptsTerms === !0;
|
|
55
|
-
},
|
|
56
|
-
const e =
|
|
60
|
+
}, v = () => {
|
|
61
|
+
const e = _();
|
|
57
62
|
if (!e)
|
|
58
63
|
return;
|
|
59
|
-
const
|
|
64
|
+
const r = {
|
|
60
65
|
accepts_terms: !0,
|
|
61
66
|
is_onboarded: !0
|
|
62
67
|
};
|
|
63
|
-
e.accepts_provider_email !== void 0 ?
|
|
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(
|
|
66
|
-
m.append(s,
|
|
67
|
-
}),
|
|
68
|
-
|
|
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
|
-
|
|
75
|
+
p(), l(!1);
|
|
71
76
|
});
|
|
72
77
|
};
|
|
73
78
|
return null;
|
|
74
79
|
};
|
|
75
80
|
export {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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 +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}
|