keycloakify 10.0.0-rc.17 → 10.0.0-rc.19
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/PUBLIC_URL.js.map +1 -1
- package/account/Template.js +5 -5
- package/account/Template.js.map +1 -1
- package/account/i18n/i18n.js +37 -29
- package/account/i18n/i18n.js.map +1 -1
- package/account/kcContext/KcContext.js.map +1 -1
- package/account/kcContext/createGetKcContext.js +20 -15
- package/account/kcContext/createGetKcContext.js.map +1 -1
- package/account/kcContext/getKcContext.js.map +1 -1
- package/account/kcContext/getKcContextFromWindow.d.ts +3 -1
- package/account/kcContext/getKcContextFromWindow.js.map +1 -1
- package/account/kcContext/kcContextMocks.js +148 -144
- package/account/kcContext/kcContextMocks.js.map +1 -1
- package/account/lib/useGetClassName.js +14 -14
- package/account/lib/useGetClassName.js.map +1 -1
- package/account/pages/Account.js +1 -1
- package/account/pages/Account.js.map +1 -1
- package/account/pages/Password.js +7 -7
- package/account/pages/Password.js.map +1 -1
- package/account/pages/Totp.js +4 -4
- package/account/pages/Totp.js.map +1 -1
- package/bin/main.js +2265 -2028
- package/bin/shared/constants.d.ts +1 -0
- package/bin/shared/constants.js +4 -3
- package/bin/shared/constants.js.map +1 -1
- package/lib/isStorybook.js +2 -1
- package/lib/isStorybook.js.map +1 -1
- package/lib/useGetClassName.js.map +1 -1
- package/login/Template.js +13 -13
- package/login/Template.js.map +1 -1
- package/login/UserProfileFormFields.js +43 -41
- package/login/UserProfileFormFields.js.map +1 -1
- package/login/i18n/baseMessages/ca.d.ts +1 -1
- package/login/i18n/baseMessages/ca.js +1 -1
- package/login/i18n/baseMessages/el.d.ts +0 -1
- package/login/i18n/baseMessages/el.js +0 -1
- package/login/i18n/baseMessages/el.js.map +1 -1
- package/login/i18n/baseMessages/en.d.ts +1 -1
- package/login/i18n/baseMessages/en.js +1 -1
- package/login/i18n/baseMessages/es.d.ts +1 -1
- package/login/i18n/baseMessages/es.js +1 -1
- package/login/i18n/baseMessages/fa.d.ts +0 -1
- package/login/i18n/baseMessages/fa.js +0 -1
- package/login/i18n/baseMessages/fa.js.map +1 -1
- package/login/i18n/baseMessages/hu.d.ts +1 -1
- package/login/i18n/baseMessages/hu.js +1 -1
- package/login/i18n/baseMessages/index.d.ts +1 -2
- package/login/i18n/baseMessages/zh-CN.d.ts +1 -1
- package/login/i18n/baseMessages/zh-CN.js +1 -1
- package/login/i18n/i18n.js +39 -31
- package/login/i18n/i18n.js.map +1 -1
- package/login/kcContext/KcContext.js.map +1 -1
- package/login/kcContext/createGetKcContext.js +30 -22
- package/login/kcContext/createGetKcContext.js.map +1 -1
- package/login/kcContext/getKcContext.js.map +1 -1
- package/login/kcContext/getKcContextFromWindow.d.ts +3 -1
- package/login/kcContext/getKcContextFromWindow.js.map +1 -1
- package/login/kcContext/kcContextMocks.js +233 -231
- package/login/kcContext/kcContextMocks.js.map +1 -1
- package/login/lib/useDownloadTerms.js.map +1 -1
- package/login/lib/useGetClassName.js +112 -112
- package/login/lib/useGetClassName.js.map +1 -1
- package/login/lib/useUserProfileForm.js +181 -181
- package/login/lib/useUserProfileForm.js.map +1 -1
- package/login/pages/DeleteAccountConfirm.js +5 -1
- package/login/pages/DeleteAccountConfirm.js.map +1 -1
- package/login/pages/FrontchannelLogout.js +1 -1
- package/login/pages/FrontchannelLogout.js.map +1 -1
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeConfig.js +3 -3
- package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
- package/login/pages/LoginResetPassword.js.map +1 -1
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.js +11 -8
- package/login/pages/WebauthnAuthenticate.js.map +1 -1
- package/login/pages/WebauthnRegister.js +7 -7
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/package.json +232 -226
- package/src/PUBLIC_URL.ts +4 -1
- package/src/account/Template.tsx +5 -5
- package/src/account/TemplateProps.ts +4 -1
- package/src/account/i18n/i18n.tsx +40 -30
- package/src/account/kcContext/KcContext.ts +4 -1
- package/src/account/kcContext/createGetKcContext.ts +48 -22
- package/src/account/kcContext/getKcContext.ts +3 -1
- package/src/account/kcContext/getKcContextFromWindow.ts +6 -2
- package/src/account/kcContext/kcContextMocks.ts +164 -160
- package/src/account/lib/useGetClassName.ts +15 -14
- package/src/account/pages/Account.tsx +2 -2
- package/src/account/pages/Password.tsx +8 -8
- package/src/account/pages/Totp.tsx +4 -6
- package/src/bin/copy-keycloak-resources-to-public.ts +2 -2
- package/src/bin/download-keycloak-default-theme.ts +30 -8
- package/src/bin/eject-page.ts +48 -11
- package/src/bin/initialize-email-theme.ts +25 -17
- package/src/bin/keycloakify/buildJars/buildJar.ts +179 -104
- package/src/bin/keycloakify/buildJars/buildJars.ts +35 -16
- package/src/bin/keycloakify/buildJars/extensionVersions.ts +2 -1
- package/src/bin/keycloakify/buildJars/generatePom.ts +11 -3
- package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +33 -8
- package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +20 -2
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +49 -12
- package/src/bin/keycloakify/generateSrcMainResources/bringInAccountV1.ts +29 -18
- package/src/bin/keycloakify/generateSrcMainResources/generateMessageProperties.ts +35 -12
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +3 -1
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +86 -41
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +39 -15
- package/src/bin/keycloakify/generateSrcMainResources/readExtraPageNames.ts +21 -7
- package/src/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.ts +34 -7
- package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +19 -5
- package/src/bin/keycloakify/keycloakify.ts +28 -9
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +24 -5
- package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +6 -2
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +6 -3
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +24 -6
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +49 -11
- package/src/bin/main.ts +78 -41
- package/src/bin/shared/KeycloakVersionRange.ts +3 -1
- package/src/bin/shared/buildOptions.ts +70 -43
- package/src/bin/shared/constants.ts +4 -2
- package/src/bin/shared/copyKeycloakResourcesToPublic.ts +27 -13
- package/src/bin/shared/downloadKeycloakDefaultTheme.ts +161 -218
- package/src/bin/shared/downloadKeycloakStaticResources.ts +25 -21
- package/src/bin/shared/getJarFileBasename.ts +3 -1
- package/src/bin/shared/getThemeSrcDirPath.ts +5 -2
- package/src/bin/shared/metaInfKeycloakThemes.ts +35 -8
- package/src/bin/shared/promptKeycloakVersion.ts +33 -14
- package/src/bin/start-keycloak/appBuild.ts +128 -0
- package/src/bin/start-keycloak/index.ts +1 -0
- package/src/bin/start-keycloak/keycloakifyBuild.ts +41 -0
- package/src/bin/start-keycloak/myrealm-realm-23.json +2142 -0
- package/src/bin/start-keycloak/myrealm-realm-24.json +2318 -0
- package/src/bin/start-keycloak/start-keycloak.ts +469 -0
- package/src/bin/tools/SemVer.ts +32 -13
- package/src/bin/tools/String.prototype.replaceAll.ts +9 -2
- package/src/bin/tools/crawl.ts +4 -1
- package/src/bin/tools/crc32.ts +42 -24
- package/src/bin/tools/downloadAndExtractArchive/downloadAndExtractArchive.ts +262 -0
- package/src/bin/tools/downloadAndExtractArchive/fetchProxyOptions.ts +96 -0
- package/src/bin/tools/downloadAndExtractArchive/index.ts +1 -0
- package/src/bin/tools/extractArchive.ts +132 -0
- package/src/bin/tools/fetchProxyOptions.ts +31 -8
- package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +10 -2
- package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +18 -5
- package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +8 -2
- package/src/bin/tools/octokit-addons/listTags.ts +15 -4
- package/src/bin/tools/partitionPromiseSettledResults.ts +12 -3
- package/src/bin/tools/readThisNpmPackageVersion.ts +5 -1
- package/src/bin/tools/transformCodebase.ts +29 -10
- package/src/bin/tools/trimIndent.ts +4 -1
- package/src/lib/isStorybook.ts +3 -1
- package/src/lib/useGetClassName.ts +12 -3
- package/src/login/Template.tsx +14 -14
- package/src/login/TemplateProps.ts +4 -1
- package/src/login/UserProfileFormFields.tsx +44 -42
- package/src/login/i18n/baseMessages/ca.ts +1 -1
- package/src/login/i18n/baseMessages/el.ts +0 -1
- package/src/login/i18n/baseMessages/en.ts +1 -1
- package/src/login/i18n/baseMessages/es.ts +1 -1
- package/src/login/i18n/baseMessages/fa.ts +0 -1
- package/src/login/i18n/baseMessages/hu.ts +1 -1
- package/src/login/i18n/baseMessages/zh-CN.ts +1 -1
- package/src/login/i18n/i18n.tsx +42 -32
- package/src/login/kcContext/KcContext.ts +8 -2
- package/src/login/kcContext/createGetKcContext.ts +84 -37
- package/src/login/kcContext/getKcContext.ts +3 -1
- package/src/login/kcContext/getKcContextFromWindow.ts +6 -2
- package/src/login/kcContext/kcContextMocks.ts +339 -325
- package/src/login/lib/useDownloadTerms.ts +6 -4
- package/src/login/lib/useGetClassName.ts +119 -112
- package/src/login/lib/useUserProfileForm.tsx +219 -205
- package/src/login/pages/DeleteAccountConfirm.tsx +9 -3
- package/src/login/pages/FrontchannelLogout.tsx +1 -1
- package/src/login/pages/Login.tsx +2 -2
- package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +3 -3
- package/src/login/pages/LoginResetPassword.tsx +2 -2
- package/src/login/pages/LoginUsername.tsx +2 -2
- package/src/login/pages/WebauthnAuthenticate.tsx +11 -8
- package/src/login/pages/WebauthnRegister.tsx +7 -7
- package/src/tools/AndByDiscriminatingKey.ts +12 -6
- package/src/tools/Array.prototype.every.ts +4 -1
- package/src/tools/LazyOrNot.ts +3 -1
- package/src/tools/clsx.ts +7 -1
- package/src/tools/deepAssign.ts +15 -8
- package/src/tools/deepClone.ts +3 -1
- package/src/tools/formatNumber.ts +4 -1
- package/src/tools/useConstCallback.ts +3 -1
- package/src/tools/useInsertLinkTags.ts +20 -7
- package/src/tools/useInsertScriptTags.ts +7 -2
- package/src/tools/useSetClassName.ts +4 -1
- package/src/vite-plugin/vite-plugin.ts +45 -21
- package/tools/Array.prototype.every.js +2 -1
- package/tools/Array.prototype.every.js.map +1 -1
- package/tools/clsx.js.map +1 -1
- package/tools/deepAssign.js +9 -7
- package/tools/deepAssign.js.map +1 -1
- package/tools/deepClone.js.map +1 -1
- package/tools/formatNumber.js.map +1 -1
- package/tools/useConstCallback.js.map +1 -1
- package/tools/useInsertLinkTags.js +5 -4
- package/tools/useInsertLinkTags.js.map +1 -1
- package/tools/useInsertScriptTags.js +5 -2
- package/tools/useInsertScriptTags.js.map +1 -1
- package/tools/useSetClassName.js.map +1 -1
- package/vite-plugin/index.js +985 -1651
- package/src/bin/shared/downloadAndUnzip.ts +0 -203
- package/src/bin/start-keycloak.ts +0 -309
- package/src/bin/tools/unzip.ts +0 -141
@@ -23,11 +23,11 @@ export function useUserProfileForm(params) {
|
|
23
23
|
var _a, _b;
|
24
24
|
const { kcContext, i18n, doMakeUserConfirmPassword } = params;
|
25
25
|
const { insertScriptTags } = useInsertScriptTags({
|
26
|
-
|
26
|
+
scriptTags: Object.keys((_b = (_a = kcContext.profile) === null || _a === void 0 ? void 0 : _a.html5DataAnnotations) !== null && _b !== void 0 ? _b : {})
|
27
27
|
.filter(key => key !== "kcMultivalued" && key !== "kcNumberFormat") // NOTE: Keycloakify handles it.
|
28
28
|
.map(key => ({
|
29
|
-
|
30
|
-
|
29
|
+
type: "module",
|
30
|
+
src: `${kcContext.url.resourcesPath}/js/${key}.js`
|
31
31
|
}))
|
32
32
|
});
|
33
33
|
useEffect(() => {
|
@@ -58,15 +58,15 @@ export function useUserProfileForm(params) {
|
|
58
58
|
.map(name => {
|
59
59
|
var _a;
|
60
60
|
return id({
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
61
|
+
name: name,
|
62
|
+
displayName: id(`\${${name}}`),
|
63
|
+
required: true,
|
64
|
+
value: (_a = kcContext.register.formData[name]) !== null && _a !== void 0 ? _a : "",
|
65
|
+
html5DataAnnotations: {},
|
66
|
+
readOnly: false,
|
67
|
+
validators: {},
|
68
|
+
annotations: {},
|
69
|
+
autocomplete: (() => {
|
70
70
|
switch (name) {
|
71
71
|
case "email":
|
72
72
|
return "email";
|
@@ -86,15 +86,15 @@ export function useUserProfileForm(params) {
|
|
86
86
|
.map(name => {
|
87
87
|
var _a;
|
88
88
|
return id({
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
89
|
+
name: name,
|
90
|
+
displayName: id(`\${${name}}`),
|
91
|
+
required: true,
|
92
|
+
value: (_a = kcContext.user[name]) !== null && _a !== void 0 ? _a : "",
|
93
|
+
html5DataAnnotations: {},
|
94
|
+
readOnly: false,
|
95
|
+
validators: {},
|
96
|
+
annotations: {},
|
97
|
+
autocomplete: (() => {
|
98
98
|
switch (name) {
|
99
99
|
case "email":
|
100
100
|
return "email";
|
@@ -111,15 +111,15 @@ export function useUserProfileForm(params) {
|
|
111
111
|
//NOTE: Handle legacy update-email.ftl
|
112
112
|
return [
|
113
113
|
id({
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
114
|
+
name: "email",
|
115
|
+
displayName: id(`\${email}`),
|
116
|
+
required: true,
|
117
|
+
value: (_a = kcContext.email.value) !== null && _a !== void 0 ? _a : "",
|
118
|
+
html5DataAnnotations: {},
|
119
|
+
readOnly: false,
|
120
|
+
validators: {},
|
121
|
+
annotations: {},
|
122
|
+
autocomplete: "email"
|
123
123
|
})
|
124
124
|
];
|
125
125
|
}
|
@@ -128,11 +128,11 @@ export function useUserProfileForm(params) {
|
|
128
128
|
return kcContext.profile.attributes.map(attribute_pre_group_patch => {
|
129
129
|
if (typeof attribute_pre_group_patch.group === "string" && attribute_pre_group_patch.group !== "") {
|
130
130
|
const _a = attribute_pre_group_patch, { group, groupDisplayHeader, groupDisplayDescription, groupAnnotations } = _a, rest = __rest(_a, ["group", "groupDisplayHeader", "groupDisplayDescription", "groupAnnotations"]);
|
131
|
-
return id(Object.assign(Object.assign({}, rest), {
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
131
|
+
return id(Object.assign(Object.assign({}, rest), { group: {
|
132
|
+
name: group,
|
133
|
+
displayHeader: groupDisplayHeader,
|
134
|
+
displayDescription: groupDisplayDescription,
|
135
|
+
html5DataAnnotations: {}
|
136
136
|
} }));
|
137
137
|
}
|
138
138
|
return attribute_pre_group_patch;
|
@@ -149,7 +149,7 @@ export function useUserProfileForm(params) {
|
|
149
149
|
// It's either email or username.
|
150
150
|
break add_password_and_password_confirm;
|
151
151
|
}
|
152
|
-
syntheticAttributes.push(Object.assign({
|
152
|
+
syntheticAttributes.push(Object.assign({ name: "password", displayName: id("${password}"), required: true, readOnly: false, validators: {}, annotations: {}, autocomplete: "new-password", html5DataAnnotations: {} }, { groupAnnotations: {} }), Object.assign({ name: "password-confirm", displayName: id("${passwordConfirm}"), required: true, readOnly: false, validators: {}, annotations: {}, html5DataAnnotations: {}, autocomplete: "new-password" }, { groupAnnotations: {} }));
|
153
153
|
}
|
154
154
|
}
|
155
155
|
return syntheticAttributes;
|
@@ -172,7 +172,7 @@ export function useUserProfileForm(params) {
|
|
172
172
|
break apply_validator_min_range;
|
173
173
|
}
|
174
174
|
const { min: minStr } = validator;
|
175
|
-
if (minStr
|
175
|
+
if (!minStr) {
|
176
176
|
break apply_validator_min_range;
|
177
177
|
}
|
178
178
|
const min = parseInt(`${minStr}`);
|
@@ -182,26 +182,26 @@ export function useUserProfileForm(params) {
|
|
182
182
|
}
|
183
183
|
out.push({
|
184
184
|
attribute,
|
185
|
-
|
185
|
+
valueOrValues: values
|
186
186
|
});
|
187
187
|
continue;
|
188
188
|
}
|
189
189
|
out.push({
|
190
190
|
attribute,
|
191
|
-
|
191
|
+
valueOrValues: (_c = attribute.value) !== null && _c !== void 0 ? _c : ""
|
192
192
|
});
|
193
193
|
}
|
194
194
|
return out;
|
195
195
|
})();
|
196
196
|
const initialState = {
|
197
|
-
|
197
|
+
formFieldStates: initialFormFieldState.map(({ attribute, valueOrValues }) => ({
|
198
198
|
attribute,
|
199
|
-
|
200
|
-
|
201
|
-
|
199
|
+
errors: getErrors({
|
200
|
+
attributeName: attribute.name,
|
201
|
+
formFieldStates: initialFormFieldState
|
202
202
|
}),
|
203
|
-
|
204
|
-
|
203
|
+
hasLostFocusAtLeastOnce: valueOrValues instanceof Array ? valueOrValues.map(() => false) : false,
|
204
|
+
valueOrValues: valueOrValues
|
205
205
|
}))
|
206
206
|
};
|
207
207
|
return initialState;
|
@@ -217,7 +217,7 @@ export function useUserProfileForm(params) {
|
|
217
217
|
apply_formatters: {
|
218
218
|
const { attribute } = formFieldState;
|
219
219
|
const { kcNumberFormat } = (_a = attribute.html5DataAnnotations) !== null && _a !== void 0 ? _a : {};
|
220
|
-
if (kcNumberFormat
|
220
|
+
if (!kcNumberFormat) {
|
221
221
|
break apply_formatters;
|
222
222
|
}
|
223
223
|
if (formFieldState.valueOrValues instanceof Array) {
|
@@ -228,8 +228,8 @@ export function useUserProfileForm(params) {
|
|
228
228
|
}
|
229
229
|
}
|
230
230
|
formFieldState.errors = getErrors({
|
231
|
-
|
232
|
-
|
231
|
+
attributeName: formAction.name,
|
232
|
+
formFieldStates: state.formFieldStates
|
233
233
|
});
|
234
234
|
update_password_confirm: {
|
235
235
|
if (doMakeUserConfirmPassword) {
|
@@ -239,9 +239,9 @@ export function useUserProfileForm(params) {
|
|
239
239
|
break update_password_confirm;
|
240
240
|
}
|
241
241
|
state = reducer(state, {
|
242
|
-
|
243
|
-
|
244
|
-
|
242
|
+
action: "update",
|
243
|
+
name: "password-confirm",
|
244
|
+
valueOrValues: formAction.valueOrValues
|
245
245
|
});
|
246
246
|
}
|
247
247
|
return;
|
@@ -260,9 +260,9 @@ export function useUserProfileForm(params) {
|
|
260
260
|
return Object.assign({}, state);
|
261
261
|
}, initialState);
|
262
262
|
const formState = useMemo(() => ({
|
263
|
-
|
263
|
+
formFieldStates: state.formFieldStates.map((_a) => {
|
264
264
|
var { errors, hasLostFocusAtLeastOnce: hasLostFocusAtLeastOnceOrArr, attribute } = _a, valueOrValuesWrap = __rest(_a, ["errors", "hasLostFocusAtLeastOnce", "attribute"]);
|
265
|
-
return (Object.assign({
|
265
|
+
return (Object.assign({ displayableErrors: errors.filter(error => {
|
266
266
|
const hasLostFocusAtLeastOnce = typeof hasLostFocusAtLeastOnceOrArr === "boolean"
|
267
267
|
? hasLostFocusAtLeastOnceOrArr
|
268
268
|
: error.fieldIndex !== undefined
|
@@ -316,7 +316,7 @@ export function useUserProfileForm(params) {
|
|
316
316
|
}
|
317
317
|
}), attribute }, valueOrValuesWrap));
|
318
318
|
}),
|
319
|
-
|
319
|
+
isFormSubmittable: state.formFieldStates.every(({ errors }) => errors.length === 0)
|
320
320
|
}), [state]);
|
321
321
|
return {
|
322
322
|
formState,
|
@@ -338,7 +338,7 @@ function useGetErrors(params) {
|
|
338
338
|
let { valueOrValues } = formFieldState;
|
339
339
|
unFormat_number: {
|
340
340
|
const { kcNumberUnFormat } = (_a = attribute.html5DataAnnotations) !== null && _a !== void 0 ? _a : {};
|
341
|
-
if (kcNumberUnFormat
|
341
|
+
if (!kcNumberUnFormat) {
|
342
342
|
break unFormat_number;
|
343
343
|
}
|
344
344
|
if (valueOrValues instanceof Array) {
|
@@ -382,10 +382,10 @@ function useGetErrors(params) {
|
|
382
382
|
return [
|
383
383
|
{
|
384
384
|
errorMessageStr,
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
385
|
+
errorMessage: _jsx("span", { children: errorMessageStr }, 0),
|
386
|
+
fieldIndex: undefined,
|
387
|
+
source: {
|
388
|
+
type: "server"
|
389
389
|
}
|
390
390
|
}
|
391
391
|
];
|
@@ -403,12 +403,12 @@ function useGetErrors(params) {
|
|
403
403
|
.map((...[, index]) => {
|
404
404
|
const specificValueErrors = getErrors({
|
405
405
|
attributeName,
|
406
|
-
|
406
|
+
formFieldStates: formFieldStates.map(formFieldState => {
|
407
407
|
if (formFieldState.attribute.name === attributeName) {
|
408
408
|
assert(formFieldState.valueOrValues instanceof Array);
|
409
409
|
return {
|
410
|
-
|
411
|
-
|
410
|
+
attribute: Object.assign(Object.assign({}, attribute), { annotations: Object.assign(Object.assign({}, attribute.annotations), { inputType: undefined }), multivalued: false }),
|
411
|
+
valueOrValues: formFieldState.valueOrValues[index]
|
412
412
|
};
|
413
413
|
}
|
414
414
|
return formFieldState;
|
@@ -421,7 +421,7 @@ function useGetErrors(params) {
|
|
421
421
|
}
|
422
422
|
return true;
|
423
423
|
})
|
424
|
-
.map((error) => (Object.assign(Object.assign({}, error), {
|
424
|
+
.map((error) => (Object.assign(Object.assign({}, error), { fieldIndex: index })));
|
425
425
|
})
|
426
426
|
.reduce((acc, errors) => [...acc, ...errors], []);
|
427
427
|
required_field: {
|
@@ -433,12 +433,12 @@ function useGetErrors(params) {
|
|
433
433
|
}
|
434
434
|
const msgArgs = ["error-user-attribute-required"];
|
435
435
|
errors.push({
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
436
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
437
|
+
errorMessageStr: msgStr(...msgArgs),
|
438
|
+
fieldIndex: undefined,
|
439
|
+
source: {
|
440
|
+
type: "other",
|
441
|
+
rule: "requiredField"
|
442
442
|
}
|
443
443
|
});
|
444
444
|
}
|
@@ -457,10 +457,10 @@ function useGetErrors(params) {
|
|
457
457
|
return [];
|
458
458
|
}
|
459
459
|
const { min: minStr } = validator;
|
460
|
-
const min = minStr
|
460
|
+
const min = minStr ? parseInt(`${minStr}`) : attribute.required ? 1 : 0;
|
461
461
|
assert(!isNaN(min));
|
462
462
|
const { max: maxStr } = validator;
|
463
|
-
const max = maxStr
|
463
|
+
const max = !maxStr ? Infinity : parseInt(`${maxStr}`);
|
464
464
|
assert(!isNaN(max));
|
465
465
|
assert(valueOrValues instanceof Array);
|
466
466
|
const values = valueOrValues;
|
@@ -470,12 +470,12 @@ function useGetErrors(params) {
|
|
470
470
|
const msgArgs = ["error-invalid-multivalued-size", `${min}`, `${max}`];
|
471
471
|
return [
|
472
472
|
{
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
473
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, 0),
|
474
|
+
errorMessageStr: msgStr(...msgArgs),
|
475
|
+
fieldIndex: undefined,
|
476
|
+
source: {
|
477
|
+
type: "validator",
|
478
|
+
name: validatorName
|
479
479
|
}
|
480
480
|
}
|
481
481
|
];
|
@@ -493,7 +493,7 @@ function useGetErrors(params) {
|
|
493
493
|
check_password_policy_x: {
|
494
494
|
const policyName = "length";
|
495
495
|
const policy = passwordPolicies[policyName];
|
496
|
-
if (policy
|
496
|
+
if (!policy) {
|
497
497
|
break check_password_policy_x;
|
498
498
|
}
|
499
499
|
const minLength = policy;
|
@@ -502,19 +502,19 @@ function useGetErrors(params) {
|
|
502
502
|
}
|
503
503
|
const msgArgs = ["invalidPasswordMinLengthMessage", `${minLength}`];
|
504
504
|
errors.push({
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
505
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
506
|
+
errorMessageStr: msgStr(...msgArgs),
|
507
|
+
fieldIndex: undefined,
|
508
|
+
source: {
|
509
|
+
type: "passwordPolicy",
|
510
|
+
name: policyName
|
511
511
|
}
|
512
512
|
});
|
513
513
|
}
|
514
514
|
check_password_policy_x: {
|
515
515
|
const policyName = "digits";
|
516
516
|
const policy = passwordPolicies[policyName];
|
517
|
-
if (policy
|
517
|
+
if (!policy) {
|
518
518
|
break check_password_policy_x;
|
519
519
|
}
|
520
520
|
const minNumberOfDigits = policy;
|
@@ -523,19 +523,19 @@ function useGetErrors(params) {
|
|
523
523
|
}
|
524
524
|
const msgArgs = ["invalidPasswordMinDigitsMessage", `${minNumberOfDigits}`];
|
525
525
|
errors.push({
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
526
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
527
|
+
errorMessageStr: msgStr(...msgArgs),
|
528
|
+
fieldIndex: undefined,
|
529
|
+
source: {
|
530
|
+
type: "passwordPolicy",
|
531
|
+
name: policyName
|
532
532
|
}
|
533
533
|
});
|
534
534
|
}
|
535
535
|
check_password_policy_x: {
|
536
536
|
const policyName = "lowerCase";
|
537
537
|
const policy = passwordPolicies[policyName];
|
538
|
-
if (policy
|
538
|
+
if (!policy) {
|
539
539
|
break check_password_policy_x;
|
540
540
|
}
|
541
541
|
const minNumberOfLowerCaseChar = policy;
|
@@ -544,19 +544,19 @@ function useGetErrors(params) {
|
|
544
544
|
}
|
545
545
|
const msgArgs = ["invalidPasswordMinLowerCaseCharsMessage", `${minNumberOfLowerCaseChar}`];
|
546
546
|
errors.push({
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
547
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
548
|
+
errorMessageStr: msgStr(...msgArgs),
|
549
|
+
fieldIndex: undefined,
|
550
|
+
source: {
|
551
|
+
type: "passwordPolicy",
|
552
|
+
name: policyName
|
553
553
|
}
|
554
554
|
});
|
555
555
|
}
|
556
556
|
check_password_policy_x: {
|
557
557
|
const policyName = "upperCase";
|
558
558
|
const policy = passwordPolicies[policyName];
|
559
|
-
if (policy
|
559
|
+
if (!policy) {
|
560
560
|
break check_password_policy_x;
|
561
561
|
}
|
562
562
|
const minNumberOfUpperCaseChar = policy;
|
@@ -565,19 +565,19 @@ function useGetErrors(params) {
|
|
565
565
|
}
|
566
566
|
const msgArgs = ["invalidPasswordMinUpperCaseCharsMessage", `${minNumberOfUpperCaseChar}`];
|
567
567
|
errors.push({
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
568
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
569
|
+
errorMessageStr: msgStr(...msgArgs),
|
570
|
+
fieldIndex: undefined,
|
571
|
+
source: {
|
572
|
+
type: "passwordPolicy",
|
573
|
+
name: policyName
|
574
574
|
}
|
575
575
|
});
|
576
576
|
}
|
577
577
|
check_password_policy_x: {
|
578
578
|
const policyName = "specialChars";
|
579
579
|
const policy = passwordPolicies[policyName];
|
580
|
-
if (policy
|
580
|
+
if (!policy) {
|
581
581
|
break check_password_policy_x;
|
582
582
|
}
|
583
583
|
const minNumberOfSpecialChar = policy;
|
@@ -586,12 +586,12 @@ function useGetErrors(params) {
|
|
586
586
|
}
|
587
587
|
const msgArgs = ["invalidPasswordMinSpecialCharsMessage", `${minNumberOfSpecialChar}`];
|
588
588
|
errors.push({
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
589
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
590
|
+
errorMessageStr: msgStr(...msgArgs),
|
591
|
+
fieldIndex: undefined,
|
592
|
+
source: {
|
593
|
+
type: "passwordPolicy",
|
594
|
+
name: policyName
|
595
595
|
}
|
596
596
|
});
|
597
597
|
}
|
@@ -602,7 +602,7 @@ function useGetErrors(params) {
|
|
602
602
|
break check_password_policy_x;
|
603
603
|
}
|
604
604
|
const usernameFormFieldState = formFieldStates.find(formFieldState => formFieldState.attribute.name === "username");
|
605
|
-
if (usernameFormFieldState
|
605
|
+
if (!usernameFormFieldState) {
|
606
606
|
break check_password_policy_x;
|
607
607
|
}
|
608
608
|
const usernameValue = (() => {
|
@@ -611,7 +611,7 @@ function useGetErrors(params) {
|
|
611
611
|
assert(typeof valueOrValues === "string");
|
612
612
|
unFormat_number: {
|
613
613
|
const { kcNumberUnFormat } = (_a = attribute.html5DataAnnotations) !== null && _a !== void 0 ? _a : {};
|
614
|
-
if (kcNumberUnFormat
|
614
|
+
if (!kcNumberUnFormat) {
|
615
615
|
break unFormat_number;
|
616
616
|
}
|
617
617
|
valueOrValues = formatNumber(valueOrValues, kcNumberUnFormat);
|
@@ -623,12 +623,12 @@ function useGetErrors(params) {
|
|
623
623
|
}
|
624
624
|
const msgArgs = ["invalidPasswordNotUsernameMessage"];
|
625
625
|
errors.push({
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
626
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
627
|
+
errorMessageStr: msgStr(...msgArgs),
|
628
|
+
fieldIndex: undefined,
|
629
|
+
source: {
|
630
|
+
type: "passwordPolicy",
|
631
|
+
name: policyName
|
632
632
|
}
|
633
633
|
});
|
634
634
|
}
|
@@ -639,7 +639,7 @@ function useGetErrors(params) {
|
|
639
639
|
break check_password_policy_x;
|
640
640
|
}
|
641
641
|
const emailFormFieldState = formFieldStates.find(formFieldState => formFieldState.attribute.name === "email");
|
642
|
-
if (emailFormFieldState
|
642
|
+
if (!emailFormFieldState) {
|
643
643
|
break check_password_policy_x;
|
644
644
|
}
|
645
645
|
assert(typeof emailFormFieldState.valueOrValues === "string");
|
@@ -651,12 +651,12 @@ function useGetErrors(params) {
|
|
651
651
|
}
|
652
652
|
const msgArgs = ["invalidPasswordNotEmailMessage"];
|
653
653
|
errors.push({
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
654
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
655
|
+
errorMessageStr: msgStr(...msgArgs),
|
656
|
+
fieldIndex: undefined,
|
657
|
+
source: {
|
658
|
+
type: "passwordPolicy",
|
659
|
+
name: policyName
|
660
660
|
}
|
661
661
|
});
|
662
662
|
}
|
@@ -676,12 +676,12 @@ function useGetErrors(params) {
|
|
676
676
|
}
|
677
677
|
const msgArgs = ["invalidPasswordConfirmMessage"];
|
678
678
|
errors.push({
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
679
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
680
|
+
errorMessageStr: msgStr(...msgArgs),
|
681
|
+
fieldIndex: undefined,
|
682
|
+
source: {
|
683
|
+
type: "other",
|
684
|
+
rule: "passwordConfirmMatchesPassword"
|
685
685
|
}
|
686
686
|
});
|
687
687
|
}
|
@@ -695,19 +695,19 @@ function useGetErrors(params) {
|
|
695
695
|
}
|
696
696
|
const msgArgs = ["error-user-attribute-required"];
|
697
697
|
errors.push({
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
698
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
699
|
+
errorMessageStr: msgStr(...msgArgs),
|
700
|
+
fieldIndex: undefined,
|
701
|
+
source: {
|
702
|
+
type: "other",
|
703
|
+
rule: "requiredField"
|
704
704
|
}
|
705
705
|
});
|
706
706
|
}
|
707
707
|
validator_x: {
|
708
708
|
const validatorName = "length";
|
709
709
|
const validator = validators[validatorName];
|
710
|
-
if (validator
|
710
|
+
if (!validator) {
|
711
711
|
break validator_x;
|
712
712
|
}
|
713
713
|
const { "ignore.empty.value": ignoreEmptyValue = false, max, min } = validator;
|
@@ -715,24 +715,24 @@ function useGetErrors(params) {
|
|
715
715
|
break validator_x;
|
716
716
|
}
|
717
717
|
const source = {
|
718
|
-
|
719
|
-
|
718
|
+
type: "validator",
|
719
|
+
name: validatorName
|
720
720
|
};
|
721
|
-
if (max
|
721
|
+
if (max && value.length > parseInt(`${max}`)) {
|
722
722
|
const msgArgs = ["error-invalid-length-too-long", `${max}`];
|
723
723
|
errors.push({
|
724
|
-
|
725
|
-
|
726
|
-
|
724
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
725
|
+
errorMessageStr: msgStr(...msgArgs),
|
726
|
+
fieldIndex: undefined,
|
727
727
|
source
|
728
728
|
});
|
729
729
|
}
|
730
|
-
if (min
|
730
|
+
if (min && value.length < parseInt(`${min}`)) {
|
731
731
|
const msgArgs = ["error-invalid-length-too-short", `${min}`];
|
732
732
|
errors.push({
|
733
|
-
|
734
|
-
|
735
|
-
|
733
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
734
|
+
errorMessageStr: msgStr(...msgArgs),
|
735
|
+
fieldIndex: undefined,
|
736
736
|
source
|
737
737
|
});
|
738
738
|
}
|
@@ -752,12 +752,12 @@ function useGetErrors(params) {
|
|
752
752
|
}
|
753
753
|
const msgArgs = [errorMessageKey !== null && errorMessageKey !== void 0 ? errorMessageKey : id("shouldMatchPattern"), pattern];
|
754
754
|
errors.push({
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
755
|
+
errorMessage: _jsx(Fragment, { children: advancedMsg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
756
|
+
errorMessageStr: advancedMsgStr(...msgArgs),
|
757
|
+
fieldIndex: undefined,
|
758
|
+
source: {
|
759
|
+
type: "validator",
|
760
|
+
name: validatorName
|
761
761
|
}
|
762
762
|
});
|
763
763
|
}
|
@@ -782,12 +782,12 @@ function useGetErrors(params) {
|
|
782
782
|
}
|
783
783
|
const msgArgs = [id("invalidEmailMessage")];
|
784
784
|
errors.push({
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
785
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
786
|
+
errorMessageStr: msgStr(...msgArgs),
|
787
|
+
fieldIndex: undefined,
|
788
|
+
source: {
|
789
|
+
type: "validator",
|
790
|
+
name: validatorName
|
791
791
|
}
|
792
792
|
});
|
793
793
|
}
|
@@ -803,35 +803,35 @@ function useGetErrors(params) {
|
|
803
803
|
}
|
804
804
|
const intValue = parseInt(value);
|
805
805
|
const source = {
|
806
|
-
|
807
|
-
|
806
|
+
type: "validator",
|
807
|
+
name: validatorName
|
808
808
|
};
|
809
809
|
if (isNaN(intValue)) {
|
810
810
|
const msgArgs = ["mustBeAnInteger"];
|
811
811
|
errors.push({
|
812
|
-
|
813
|
-
|
814
|
-
|
812
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
813
|
+
errorMessageStr: msgStr(...msgArgs),
|
814
|
+
fieldIndex: undefined,
|
815
815
|
source
|
816
816
|
});
|
817
817
|
break validator_x;
|
818
818
|
}
|
819
|
-
if (max
|
819
|
+
if (max && intValue > parseInt(`${max}`)) {
|
820
820
|
const msgArgs = ["error-number-out-of-range-too-big", `${max}`];
|
821
821
|
errors.push({
|
822
|
-
|
823
|
-
|
824
|
-
|
822
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
823
|
+
errorMessageStr: msgStr(...msgArgs),
|
824
|
+
fieldIndex: undefined,
|
825
825
|
source
|
826
826
|
});
|
827
827
|
break validator_x;
|
828
828
|
}
|
829
|
-
if (min
|
829
|
+
if (min && intValue < parseInt(`${min}`)) {
|
830
830
|
const msgArgs = ["error-number-out-of-range-too-small", `${min}`];
|
831
831
|
errors.push({
|
832
|
-
|
833
|
-
|
834
|
-
|
832
|
+
errorMessage: _jsx(Fragment, { children: msg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
833
|
+
errorMessageStr: msgStr(...msgArgs),
|
834
|
+
fieldIndex: undefined,
|
835
835
|
source
|
836
836
|
});
|
837
837
|
break validator_x;
|
@@ -851,12 +851,12 @@ function useGetErrors(params) {
|
|
851
851
|
}
|
852
852
|
const msgArgs = [id("notAValidOption")];
|
853
853
|
errors.push({
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
854
|
+
errorMessage: _jsx(Fragment, { children: advancedMsg(...msgArgs) }, `${attributeName}-${errors.length}`),
|
855
|
+
errorMessageStr: advancedMsgStr(...msgArgs),
|
856
|
+
fieldIndex: undefined,
|
857
|
+
source: {
|
858
|
+
type: "validator",
|
859
|
+
name: validatorName
|
860
860
|
}
|
861
861
|
});
|
862
862
|
}
|