keycloakify 10.0.0-rc.80 → 10.0.0-rc.82
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/login/index.d.ts +0 -1
- package/login/index.js +0 -1
- package/login/index.js.map +1 -1
- package/login/pages/Register.js +2 -10
- package/login/pages/Register.js.map +1 -1
- package/login/pages/Terms.js +1 -9
- package/login/pages/Terms.js.map +1 -1
- package/package.json +1 -10
- package/src/login/index.ts +0 -1
- package/src/login/pages/Register.tsx +2 -13
- package/src/login/pages/Terms.tsx +1 -12
- package/stories/login/pages/Terms.stories.tsx +9 -8
- package/login/lib/useDownloadTerms.d.ts +0 -27
- package/login/lib/useDownloadTerms.js +0 -48
- package/login/lib/useDownloadTerms.js.map +0 -1
- package/src/login/lib/useDownloadTerms.tsx +0 -88
- package/src/tools/react-markdown.ts +0 -3
- package/tools/react-markdown.d.ts +0 -3
- package/tools/react-markdown.js +0 -4
- package/tools/react-markdown.js.map +0 -1
package/login/index.d.ts
CHANGED
package/login/index.js
CHANGED
package/login/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/login/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/login/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
|
package/login/pages/Register.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
2
|
import { useState } from "react";
|
3
|
-
import { useTermsMarkdown } from "../../login/lib/useDownloadTerms";
|
4
3
|
import { getKcClsx } from "../../login/lib/kcClsx";
|
5
4
|
export default function Register(props) {
|
6
5
|
const { kcContext, i18n, doUseDefaultCss, Template, classes, UserProfileFormFields, doMakeUserConfirmPassword } = props;
|
@@ -15,14 +14,7 @@ export default function Register(props) {
|
|
15
14
|
}
|
16
15
|
function TermsAcceptance(props) {
|
17
16
|
const { i18n, kcClsx, messagesPerField } = props;
|
18
|
-
const { msg
|
19
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: "form-group" }, { children: _jsxs("div", Object.assign({ className: kcClsx("kcInputWrapperClass") }, { children: [msg("termsTitle"), _jsx("div", Object.assign({ id: "kc-registration-terms-text" }, { children:
|
20
|
-
}
|
21
|
-
function TermsMarkdown() {
|
22
|
-
const { isDownloadComplete, termsMarkdown, ReactMarkdown } = useTermsMarkdown();
|
23
|
-
if (!isDownloadComplete) {
|
24
|
-
return null;
|
25
|
-
}
|
26
|
-
return _jsx(ReactMarkdown, { children: termsMarkdown });
|
17
|
+
const { msg } = i18n;
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: "form-group" }, { children: _jsxs("div", Object.assign({ className: kcClsx("kcInputWrapperClass") }, { children: [msg("termsTitle"), _jsx("div", Object.assign({ id: "kc-registration-terms-text" }, { children: msg("termsText") }))] })) })), _jsxs("div", Object.assign({ className: "form-group" }, { children: [_jsxs("div", Object.assign({ className: kcClsx("kcLabelWrapperClass") }, { children: [_jsx("input", { type: "checkbox", id: "termsAccepted", name: "termsAccepted", className: kcClsx("kcCheckboxInputClass"), "aria-invalid": messagesPerField.existsError("termsAccepted") }), _jsx("label", Object.assign({ htmlFor: "termsAccepted", className: kcClsx("kcLabelClass") }, { children: msg("acceptTerms") }))] })), messagesPerField.existsError("termsAccepted") && (_jsx("div", Object.assign({ className: kcClsx("kcLabelWrapperClass") }, { children: _jsx("span", Object.assign({ id: "input-error-terms-accepted", className: kcClsx("kcInputErrorMessageClass"), "aria-live": "polite" }, { children: messagesPerField.get("termsAccepted") })) })))] }))] }));
|
27
19
|
}
|
28
20
|
//# sourceMappingURL=Register.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Register.js","sourceRoot":"","sources":["../../src/login/pages/Register.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,MAAM,CAAC,qBAAqB,CAAC,iBACxC,GAAG,CAAC,YAAY,CAAC,EAClB,4BAAK,EAAE,EAAC,4BAA4B,gBAAE,GAAG,CAAC,WAAW,CAAC,IAAO,KAC3D,IACJ,EACN,6BAAK,SAAS,EAAC,YAAY,iBACvB,6BAAK,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,iBACzC,gBACI,IAAI,EAAC,UAAU,EACf,EAAE,EAAC,eAAe,EAClB,IAAI,EAAC,eAAe,EACpB,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,kBAC3B,gBAAgB,CAAC,WAAW,CAAC,eAAe,CAAC,GAC7D,EACF,8BAAO,OAAO,EAAC,eAAe,EAAC,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,gBAC3D,GAAG,CAAC,aAAa,CAAC,IACf,KACN,EACL,gBAAgB,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAC9C,4BAAK,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,gBACzC,6BAAM,EAAE,EAAC,4BAA4B,EAAC,SAAS,EAAE,MAAM,CAAC,0BAA0B,CAAC,eAAY,QAAQ,gBAClG,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,IACnC,IACL,CACT,KACC,IACP,CACN,CAAC;AACN,CAAC"}
|
package/login/pages/Terms.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { getKcClsx } from "../../login/lib/kcClsx";
|
3
|
-
import { useTermsMarkdown } from "../../login/lib/useDownloadTerms";
|
4
3
|
export default function Terms(props) {
|
5
4
|
const { kcContext, i18n, doUseDefaultCss, Template, classes } = props;
|
6
5
|
const { kcClsx } = getKcClsx({
|
@@ -9,13 +8,6 @@ export default function Terms(props) {
|
|
9
8
|
});
|
10
9
|
const { msg, msgStr } = i18n;
|
11
10
|
const { url } = kcContext;
|
12
|
-
return (_jsxs(Template, Object.assign({ kcContext: kcContext, i18n: i18n, doUseDefaultCss: doUseDefaultCss, classes: classes, displayMessage: false, headerNode: msg("termsTitle") }, { children: [_jsx("div", Object.assign({ id: "kc-terms-text" }, { children:
|
13
|
-
}
|
14
|
-
function TermsMarkdown() {
|
15
|
-
const { isDownloadComplete, termsMarkdown, ReactMarkdown } = useTermsMarkdown();
|
16
|
-
if (!isDownloadComplete) {
|
17
|
-
return null;
|
18
|
-
}
|
19
|
-
return _jsx(ReactMarkdown, { children: termsMarkdown });
|
11
|
+
return (_jsxs(Template, Object.assign({ kcContext: kcContext, i18n: i18n, doUseDefaultCss: doUseDefaultCss, classes: classes, displayMessage: false, headerNode: msg("termsTitle") }, { children: [_jsx("div", Object.assign({ id: "kc-terms-text" }, { children: msg("termsText") })), _jsxs("form", Object.assign({ className: "form-actions", action: url.loginAction, method: "POST" }, { children: [_jsx("input", { className: kcClsx("kcButtonClass", "kcButtonClass", "kcButtonClass", "kcButtonPrimaryClass", "kcButtonLargeClass"), name: "accept", id: "kc-accept", type: "submit", value: msgStr("doAccept") }), _jsx("input", { className: kcClsx("kcButtonClass", "kcButtonDefaultClass", "kcButtonLargeClass"), name: "cancel", id: "kc-decline", type: "submit", value: msgStr("doDecline") })] })), _jsx("div", { className: "clearfix" })] })));
|
20
12
|
}
|
21
13
|
//# sourceMappingURL=Terms.js.map
|
package/login/pages/Terms.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Terms.js","sourceRoot":"","sources":["../../src/login/pages/Terms.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
1
|
+
{"version":3,"file":"Terms.js","sourceRoot":"","sources":["../../src/login/pages/Terms.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAKzD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,KAAmE;IAC7F,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EA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Create Keycloak themes using React",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -301,9 +301,6 @@
|
|
301
301
|
"login/lib/kcClsx.d.ts",
|
302
302
|
"login/lib/kcClsx.js",
|
303
303
|
"login/lib/kcClsx.js.map",
|
304
|
-
"login/lib/useDownloadTerms.d.ts",
|
305
|
-
"login/lib/useDownloadTerms.js",
|
306
|
-
"login/lib/useDownloadTerms.js.map",
|
307
304
|
"login/lib/useUserProfileForm.d.ts",
|
308
305
|
"login/lib/useUserProfileForm.js",
|
309
306
|
"login/lib/useUserProfileForm.js.map",
|
@@ -582,7 +579,6 @@
|
|
582
579
|
"src/login/i18n/useI18n.ts",
|
583
580
|
"src/login/index.ts",
|
584
581
|
"src/login/lib/kcClsx.ts",
|
585
|
-
"src/login/lib/useDownloadTerms.tsx",
|
586
582
|
"src/login/lib/useUserProfileForm.tsx",
|
587
583
|
"src/login/pages/Code.tsx",
|
588
584
|
"src/login/pages/DeleteAccountConfirm.tsx",
|
@@ -639,7 +635,6 @@
|
|
639
635
|
"src/tools/emailRegExp.ts",
|
640
636
|
"src/tools/formatNumber.ts",
|
641
637
|
"src/tools/pathBasename.ts",
|
642
|
-
"src/tools/react-markdown.ts",
|
643
638
|
"src/tools/structuredCloneButFunctions.ts",
|
644
639
|
"src/tools/useConst.ts",
|
645
640
|
"src/tools/useConstCallback.ts",
|
@@ -749,9 +744,6 @@
|
|
749
744
|
"tools/pathBasename.d.ts",
|
750
745
|
"tools/pathBasename.js",
|
751
746
|
"tools/pathBasename.js.map",
|
752
|
-
"tools/react-markdown.d.ts",
|
753
|
-
"tools/react-markdown.js",
|
754
|
-
"tools/react-markdown.js.map",
|
755
747
|
"tools/structuredCloneButFunctions.d.ts",
|
756
748
|
"tools/structuredCloneButFunctions.js",
|
757
749
|
"tools/structuredCloneButFunctions.js.map",
|
@@ -832,7 +824,6 @@
|
|
832
824
|
"react": "*"
|
833
825
|
},
|
834
826
|
"dependencies": {
|
835
|
-
"react-markdown": "^9.0.1",
|
836
827
|
"tsafe": "^1.6.6"
|
837
828
|
},
|
838
829
|
"devDependencies": {
|
package/src/login/index.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
1
|
export type { ExtendKcContext, Attribute } from "keycloakify/login/KcContext";
|
2
2
|
export type { ClassKey } from "keycloakify/login/TemplateProps";
|
3
|
-
export { useDownloadTerms } from "keycloakify/login/lib/useDownloadTerms";
|
4
3
|
export { createUseI18n } from "keycloakify/login/i18n";
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { useState } from "react";
|
2
2
|
import type { LazyOrNot } from "keycloakify/tools/LazyOrNot";
|
3
|
-
import { useTermsMarkdown } from "keycloakify/login/lib/useDownloadTerms";
|
4
3
|
import { getKcClsx, type KcClsx } from "keycloakify/login/lib/kcClsx";
|
5
4
|
import type { UserProfileFormFieldsProps } from "keycloakify/login/UserProfileFormFieldsProps";
|
6
5
|
import type { PageProps } from "keycloakify/login/pages/PageProps";
|
@@ -77,14 +76,14 @@ export default function Register(props: RegisterProps) {
|
|
77
76
|
function TermsAcceptance(props: { i18n: I18n; kcClsx: KcClsx; messagesPerField: Pick<KcContext["messagesPerField"], "existsError" | "get"> }) {
|
78
77
|
const { i18n, kcClsx, messagesPerField } = props;
|
79
78
|
|
80
|
-
const { msg
|
79
|
+
const { msg } = i18n;
|
81
80
|
|
82
81
|
return (
|
83
82
|
<>
|
84
83
|
<div className="form-group">
|
85
84
|
<div className={kcClsx("kcInputWrapperClass")}>
|
86
85
|
{msg("termsTitle")}
|
87
|
-
<div id="kc-registration-terms-text">{
|
86
|
+
<div id="kc-registration-terms-text">{msg("termsText")}</div>
|
88
87
|
</div>
|
89
88
|
</div>
|
90
89
|
<div className="form-group">
|
@@ -111,13 +110,3 @@ function TermsAcceptance(props: { i18n: I18n; kcClsx: KcClsx; messagesPerField:
|
|
111
110
|
</>
|
112
111
|
);
|
113
112
|
}
|
114
|
-
|
115
|
-
function TermsMarkdown() {
|
116
|
-
const { isDownloadComplete, termsMarkdown, ReactMarkdown } = useTermsMarkdown();
|
117
|
-
|
118
|
-
if (!isDownloadComplete) {
|
119
|
-
return null;
|
120
|
-
}
|
121
|
-
|
122
|
-
return <ReactMarkdown>{termsMarkdown}</ReactMarkdown>;
|
123
|
-
}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { getKcClsx } from "keycloakify/login/lib/kcClsx";
|
2
|
-
import { useTermsMarkdown } from "keycloakify/login/lib/useDownloadTerms";
|
3
2
|
import type { PageProps } from "keycloakify/login/pages/PageProps";
|
4
3
|
import type { KcContext } from "../KcContext";
|
5
4
|
import type { I18n } from "../i18n";
|
@@ -25,7 +24,7 @@ export default function Terms(props: PageProps<Extract<KcContext, { pageId: "ter
|
|
25
24
|
displayMessage={false}
|
26
25
|
headerNode={msg("termsTitle")}
|
27
26
|
>
|
28
|
-
<div id="kc-terms-text">{
|
27
|
+
<div id="kc-terms-text">{msg("termsText")}</div>
|
29
28
|
<form className="form-actions" action={url.loginAction} method="POST">
|
30
29
|
<input
|
31
30
|
className={kcClsx("kcButtonClass", "kcButtonClass", "kcButtonClass", "kcButtonPrimaryClass", "kcButtonLargeClass")}
|
@@ -46,13 +45,3 @@ export default function Terms(props: PageProps<Extract<KcContext, { pageId: "ter
|
|
46
45
|
</Template>
|
47
46
|
);
|
48
47
|
}
|
49
|
-
|
50
|
-
function TermsMarkdown() {
|
51
|
-
const { isDownloadComplete, termsMarkdown, ReactMarkdown } = useTermsMarkdown();
|
52
|
-
|
53
|
-
if (!isDownloadComplete) {
|
54
|
-
return null;
|
55
|
-
}
|
56
|
-
|
57
|
-
return <ReactMarkdown>{termsMarkdown}</ReactMarkdown>;
|
58
|
-
}
|
@@ -14,27 +14,28 @@ export default meta;
|
|
14
14
|
type Story = StoryObj<typeof meta>;
|
15
15
|
|
16
16
|
export const Default: Story = {
|
17
|
-
render: () => <KcPageStory />
|
18
|
-
};
|
19
|
-
|
20
|
-
export const French: Story = {
|
21
17
|
render: () => (
|
22
18
|
<KcPageStory
|
23
19
|
kcContext={{
|
24
|
-
|
25
|
-
|
20
|
+
"x-keycloakify": {
|
21
|
+
realmMessageBundleTermsText: "<p>My terms in <strong>English</strong></p>"
|
26
22
|
}
|
27
23
|
}}
|
28
24
|
/>
|
29
25
|
)
|
30
26
|
};
|
31
27
|
|
32
|
-
export const
|
28
|
+
export const French: Story = {
|
33
29
|
render: () => (
|
34
30
|
<KcPageStory
|
35
31
|
kcContext={{
|
36
32
|
locale: {
|
37
|
-
currentLanguageTag: "
|
33
|
+
currentLanguageTag: "fr"
|
34
|
+
},
|
35
|
+
"x-keycloakify": {
|
36
|
+
// cSpell: disable
|
37
|
+
realmMessageBundleTermsText: "<p>Mes terme en <strong>Français</strong></p>"
|
38
|
+
// cSpell: enable
|
38
39
|
}
|
39
40
|
}}
|
40
41
|
/>
|
@@ -1,27 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
export type KcContextLike_useDownloadTerms = {
|
3
|
-
pageId: string;
|
4
|
-
locale?: {
|
5
|
-
currentLanguageTag: string;
|
6
|
-
};
|
7
|
-
termsAcceptanceRequired?: boolean;
|
8
|
-
};
|
9
|
-
/** Allow to avoid bundling the terms and download it on demand*/
|
10
|
-
export declare function useDownloadTerms(params: {
|
11
|
-
kcContext: KcContextLike_useDownloadTerms;
|
12
|
-
downloadTermsMarkdown: (params: {
|
13
|
-
currentLanguageTag: string;
|
14
|
-
}) => Promise<{
|
15
|
-
termsMarkdown: string;
|
16
|
-
termsLanguageTag: string | undefined;
|
17
|
-
}>;
|
18
|
-
}): void;
|
19
|
-
export declare function useTermsMarkdown(): {
|
20
|
-
isDownloadComplete: false;
|
21
|
-
ReactMarkdown?: undefined;
|
22
|
-
termsMarkdown?: undefined;
|
23
|
-
} | {
|
24
|
-
isDownloadComplete: boolean;
|
25
|
-
ReactMarkdown: (props: Readonly<import("react-markdown/lib").Options>) => JSX.Element;
|
26
|
-
termsMarkdown: string;
|
27
|
-
};
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { useState, useEffect } from "react";
|
3
|
-
import { fallbackLanguageTag } from "../../login/i18n";
|
4
|
-
import { assert } from "tsafe/assert";
|
5
|
-
import { createStatefulObservable, useRerenderOnChange } from "../../tools/StatefulObservable";
|
6
|
-
import { useOnFistMount } from "../../tools/useOnFirstMount";
|
7
|
-
const obs = createStatefulObservable(() => undefined);
|
8
|
-
assert();
|
9
|
-
/** Allow to avoid bundling the terms and download it on demand*/
|
10
|
-
export function useDownloadTerms(params) {
|
11
|
-
const { kcContext, downloadTermsMarkdown } = params;
|
12
|
-
useOnFistMount(async () => {
|
13
|
-
var _a, _b;
|
14
|
-
if (kcContext.pageId === "terms.ftl" || kcContext.termsAcceptanceRequired) {
|
15
|
-
const currentLanguageTag = (_b = (_a = kcContext.locale) === null || _a === void 0 ? void 0 : _a.currentLanguageTag) !== null && _b !== void 0 ? _b : fallbackLanguageTag;
|
16
|
-
const [ReactMarkdown_base, { termsMarkdown, termsLanguageTag }] = await Promise.all([
|
17
|
-
import("../../tools/react-markdown").then(_ => _.default),
|
18
|
-
downloadTermsMarkdown({ currentLanguageTag })
|
19
|
-
]);
|
20
|
-
const htmlLang = termsLanguageTag !== currentLanguageTag ? termsLanguageTag : undefined;
|
21
|
-
const ReactMarkdown = htmlLang === undefined
|
22
|
-
? ReactMarkdown_base
|
23
|
-
: props => {
|
24
|
-
const [anchor, setAnchor] = useState(null);
|
25
|
-
useEffect(() => {
|
26
|
-
if (anchor === null) {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
const parent = anchor.parentElement;
|
30
|
-
assert(parent !== null);
|
31
|
-
parent.setAttribute("lang", htmlLang);
|
32
|
-
anchor.remove();
|
33
|
-
}, [anchor]);
|
34
|
-
return (_jsxs(_Fragment, { children: [_jsx(ReactMarkdown_base, Object.assign({}, props)), _jsx("div", { ref: setAnchor, style: { display: "none" }, "aria-hidden": true })] }));
|
35
|
-
};
|
36
|
-
obs.current = { ReactMarkdown, termsMarkdown };
|
37
|
-
}
|
38
|
-
});
|
39
|
-
}
|
40
|
-
export function useTermsMarkdown() {
|
41
|
-
useRerenderOnChange(obs);
|
42
|
-
if (obs.current === undefined) {
|
43
|
-
return { isDownloadComplete: false };
|
44
|
-
}
|
45
|
-
const { ReactMarkdown, termsMarkdown } = obs.current;
|
46
|
-
return { isDownloadComplete: true, ReactMarkdown, termsMarkdown };
|
47
|
-
}
|
48
|
-
//# sourceMappingURL=useDownloadTerms.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useDownloadTerms.js","sourceRoot":"","sources":["../../src/login/lib/useDownloadTerms.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAInE,MAAM,GAAG,GAAG,wBAAwB,CAMlC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AAUnB,MAAM,EAAmE,CAAC;AAE1E,iEAAiE;AACjE,MAAM,UAAU,gBAAgB,CAAC,MAGhC;IACG,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAAC;IAEpD,cAAc,CAAC,KAAK,IAAI,EAAE;;QACtB,IAAI,SAAS,CAAC,MAAM,KAAK,WAAW,IAAI,SAAS,CAAC,uBAAuB,EAAE;YACvE,MAAM,kBAAkB,GAAG,MAAA,MAAA,SAAS,CAAC,MAAM,0CAAE,kBAAkB,mCAAI,mBAAmB,CAAC;YAEvF,MAAM,CAAC,kBAAkB,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC,G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QAC3B,OAAO,EAAE,kBAAkB,EAAE,KAAc,EAAE,CAAC;KACjD;IAED,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC;IAErD,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;AACtE,CAAC"}
|
@@ -1,88 +0,0 @@
|
|
1
|
-
import { useState, useEffect } from "react";
|
2
|
-
import { fallbackLanguageTag } from "keycloakify/login/i18n";
|
3
|
-
import { assert } from "tsafe/assert";
|
4
|
-
import { createStatefulObservable, useRerenderOnChange } from "keycloakify/tools/StatefulObservable";
|
5
|
-
import { useOnFistMount } from "keycloakify/tools/useOnFirstMount";
|
6
|
-
import { KcContext } from "../KcContext";
|
7
|
-
import type { Options as ReactMarkdownOptions } from "../../tools/react-markdown";
|
8
|
-
|
9
|
-
const obs = createStatefulObservable<
|
10
|
-
| {
|
11
|
-
ReactMarkdown: (props: Readonly<ReactMarkdownOptions>) => JSX.Element;
|
12
|
-
termsMarkdown: string;
|
13
|
-
}
|
14
|
-
| undefined
|
15
|
-
>(() => undefined);
|
16
|
-
|
17
|
-
export type KcContextLike_useDownloadTerms = {
|
18
|
-
pageId: string;
|
19
|
-
locale?: {
|
20
|
-
currentLanguageTag: string;
|
21
|
-
};
|
22
|
-
termsAcceptanceRequired?: boolean;
|
23
|
-
};
|
24
|
-
|
25
|
-
assert<KcContext extends KcContextLike_useDownloadTerms ? true : false>();
|
26
|
-
|
27
|
-
/** Allow to avoid bundling the terms and download it on demand*/
|
28
|
-
export function useDownloadTerms(params: {
|
29
|
-
kcContext: KcContextLike_useDownloadTerms;
|
30
|
-
downloadTermsMarkdown: (params: { currentLanguageTag: string }) => Promise<{ termsMarkdown: string; termsLanguageTag: string | undefined }>;
|
31
|
-
}) {
|
32
|
-
const { kcContext, downloadTermsMarkdown } = params;
|
33
|
-
|
34
|
-
useOnFistMount(async () => {
|
35
|
-
if (kcContext.pageId === "terms.ftl" || kcContext.termsAcceptanceRequired) {
|
36
|
-
const currentLanguageTag = kcContext.locale?.currentLanguageTag ?? fallbackLanguageTag;
|
37
|
-
|
38
|
-
const [ReactMarkdown_base, { termsMarkdown, termsLanguageTag }] = await Promise.all([
|
39
|
-
import("../../tools/react-markdown").then(_ => _.default),
|
40
|
-
downloadTermsMarkdown({ currentLanguageTag })
|
41
|
-
] as const);
|
42
|
-
|
43
|
-
const htmlLang = termsLanguageTag !== currentLanguageTag ? termsLanguageTag : undefined;
|
44
|
-
|
45
|
-
const ReactMarkdown: (props: Readonly<ReactMarkdownOptions>) => JSX.Element =
|
46
|
-
htmlLang === undefined
|
47
|
-
? ReactMarkdown_base
|
48
|
-
: props => {
|
49
|
-
const [anchor, setAnchor] = useState<HTMLDivElement | null>(null);
|
50
|
-
|
51
|
-
useEffect(() => {
|
52
|
-
if (anchor === null) {
|
53
|
-
return;
|
54
|
-
}
|
55
|
-
|
56
|
-
const parent = anchor.parentElement;
|
57
|
-
|
58
|
-
assert(parent !== null);
|
59
|
-
|
60
|
-
parent.setAttribute("lang", htmlLang);
|
61
|
-
|
62
|
-
anchor.remove();
|
63
|
-
}, [anchor]);
|
64
|
-
|
65
|
-
return (
|
66
|
-
<>
|
67
|
-
<ReactMarkdown_base {...props} />
|
68
|
-
<div ref={setAnchor} style={{ display: "none" }} aria-hidden />
|
69
|
-
</>
|
70
|
-
);
|
71
|
-
};
|
72
|
-
|
73
|
-
obs.current = { ReactMarkdown, termsMarkdown };
|
74
|
-
}
|
75
|
-
});
|
76
|
-
}
|
77
|
-
|
78
|
-
export function useTermsMarkdown() {
|
79
|
-
useRerenderOnChange(obs);
|
80
|
-
|
81
|
-
if (obs.current === undefined) {
|
82
|
-
return { isDownloadComplete: false as const };
|
83
|
-
}
|
84
|
-
|
85
|
-
const { ReactMarkdown, termsMarkdown } = obs.current;
|
86
|
-
|
87
|
-
return { isDownloadComplete: true, ReactMarkdown, termsMarkdown };
|
88
|
-
}
|
package/tools/react-markdown.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"react-markdown.js","sourceRoot":"","sources":["../src/tools/react-markdown.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,eAAe,QAAQ,CAAC"}
|