@strapi/admin 4.9.0-beta.2 → 4.9.0
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/.eslintignore +4 -0
- package/.eslintrc.js +14 -0
- package/admin/src/components/LocalesProvider/__mocks__/useLocalesProvider.js +7 -0
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +3 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findAllAndReplace.js +10 -3
- package/admin/src/content-manager/components/InputUID/endActionStyle.js +4 -13
- package/admin/src/content-manager/components/InputUID/index.js +94 -71
- package/admin/src/hooks/useConfigurations/__mocks__/index.js +7 -0
- package/admin/src/pages/AuthPage/components/Register/index.js +46 -38
- package/build/1387.84b454d3.chunk.js +1 -0
- package/build/1657.45231968.chunk.js +168 -0
- package/build/3081.bcf9a12f.chunk.js +108 -0
- package/build/462.8fff7f3b.chunk.js +71 -0
- package/build/4628.20631dd1.chunk.js +1 -0
- package/build/5542.b8240e3f.chunk.js +70 -0
- package/build/5563.905daa13.chunk.js +79 -0
- package/build/6404.68405699.chunk.js +100 -0
- package/build/7259.b7d00cea.chunk.js +1 -0
- package/build/8694.6522968d.chunk.js +247 -0
- package/build/9347.058ddb22.chunk.js +1 -0
- package/build/Admin-authenticatedApp.31bf88ef.chunk.js +79 -0
- package/build/Admin_InternalErrorPage.15c6bf07.chunk.js +1 -0
- package/build/Admin_homePage.da2181fe.chunk.js +73 -0
- package/build/Admin_marketplace.d99044eb.chunk.js +31 -0
- package/build/Admin_pluginsPage.f6b52ee9.chunk.js +6 -0
- package/build/Admin_profilePage.9112cffc.chunk.js +15 -0
- package/build/Admin_settingsPage.cb63220f.chunk.js +79 -0
- package/build/Upload_ConfigureTheView.eaaec495.chunk.js +1 -0
- package/build/admin-app.8cde5b22.chunk.js +110 -0
- package/build/admin-edit-roles-page.4f1858e9.chunk.js +280 -0
- package/build/admin-edit-users.7e14d85f.chunk.js +10 -0
- package/build/admin-roles-list.97e198f9.chunk.js +31 -0
- package/build/admin-users.d02de059.chunk.js +34 -0
- package/build/api-tokens-create-page.97595e12.chunk.js +1 -0
- package/build/api-tokens-edit-page.cd36e30e.chunk.js +1 -0
- package/build/api-tokens-list-page.6757c7b9.chunk.js +16 -0
- package/build/audit-logs-settings-page.ca9a3c46.chunk.js +76 -0
- package/build/content-manager.de0ee3e5.chunk.js +1132 -0
- package/build/content-type-builder-list-view.9c2c020c.chunk.js +214 -0
- package/build/content-type-builder.ec5ac7ab.chunk.js +126 -0
- package/build/email-settings-page.1095e1ab.chunk.js +10 -0
- package/build/{highlight.js.26ef649f.chunk.js → highlight.js.28a1547e.chunk.js} +2 -2
- package/build/i18n-settings-page.7d80aae0.chunk.js +60 -0
- package/build/index.html +1 -1
- package/build/main.d40f9ca1.js +2280 -0
- package/build/{runtime~main.ee2bfeea.js → runtime~main.7cdc9956.js} +2 -2
- package/build/sso-settings-page.1dd4886e.chunk.js +1 -0
- package/build/transfer-tokens-create-page.ec2ca215.chunk.js +1 -0
- package/build/transfer-tokens-edit-page.22bf28e5.chunk.js +1 -0
- package/build/transfer-tokens-list-page.cf8c77f2.chunk.js +16 -0
- package/build/upload-settings.945fdcfa.chunk.js +13 -0
- package/build/upload-translation-fr-json.baab9911.chunk.js +1 -0
- package/build/{upload-translation-th-json.3847dae0.chunk.js → upload-translation-th-json.98d35574.chunk.js} +1 -1
- package/build/upload.a86b1054.chunk.js +33 -0
- package/build/users-advanced-settings-page.5b5a9baa.chunk.js +8 -0
- package/build/users-email-settings-page.e5506eb4.chunk.js +23 -0
- package/build/users-providers-settings-page.e32089c2.chunk.js +28 -0
- package/build/users-roles-settings-page.a5c5b0df.chunk.js +30 -0
- package/build/webhook-edit-page.213f0075.chunk.js +75 -0
- package/build/webhook-list-page.5beb2a5c.chunk.js +71 -0
- package/ee/server/register.js +3 -2
- package/ee/server/services/audit-logs.js +75 -16
- package/jest.config.front.js +1 -6
- package/package.json +19 -17
- package/webpack.config.js +1 -1
- package/build/2263.4c5916f9.chunk.js +0 -98
- package/build/4049.64715f20.chunk.js +0 -1
- package/build/5563.aa832e5f.chunk.js +0 -30
- package/build/6985.66cca29c.chunk.js +0 -1
- package/build/7259.e6ef3b8e.chunk.js +0 -1
- package/build/8469.853c822b.chunk.js +0 -1
- package/build/9505.dbe702ab.chunk.js +0 -14
- package/build/9816.01ee964f.chunk.js +0 -2
- package/build/Admin-authenticatedApp.5a090404.chunk.js +0 -79
- package/build/Admin_InternalErrorPage.4ad8b0df.chunk.js +0 -1
- package/build/Admin_homePage.1411fb7c.chunk.js +0 -68
- package/build/Admin_marketplace.02608d56.chunk.js +0 -22
- package/build/Admin_pluginsPage.15e3b0fd.chunk.js +0 -1
- package/build/Admin_profilePage.76afeca0.chunk.js +0 -15
- package/build/Admin_settingsPage.0aa4fcdc.chunk.js +0 -9
- package/build/Upload_ConfigureTheView.34dde278.chunk.js +0 -1
- package/build/admin-app.50584489.chunk.js +0 -112
- package/build/admin-edit-roles-page.cf543488.chunk.js +0 -216
- package/build/admin-edit-users.31c20712.chunk.js +0 -10
- package/build/admin-roles-list.489c501f.chunk.js +0 -2
- package/build/admin-users.3e111a7d.chunk.js +0 -11
- package/build/api-tokens-create-page.2a6e22bd.chunk.js +0 -1
- package/build/api-tokens-edit-page.fa38cd63.chunk.js +0 -1
- package/build/api-tokens-list-page.93f24348.chunk.js +0 -16
- package/build/audit-logs-settings-page.7be97e82.chunk.js +0 -1
- package/build/content-manager.f8b9710b.chunk.js +0 -1139
- package/build/content-type-builder-list-view.cf38fe2f.chunk.js +0 -191
- package/build/content-type-builder.0f5dbcf1.chunk.js +0 -126
- package/build/email-settings-page.4bdbef9a.chunk.js +0 -3
- package/build/i18n-settings-page.2bb5be96.chunk.js +0 -1
- package/build/main.7fa3d343.js +0 -3783
- package/build/sso-settings-page.272b87c8.chunk.js +0 -1
- package/build/transfer-tokens-create-page.a1f14bb1.chunk.js +0 -1
- package/build/transfer-tokens-edit-page.00ee1c74.chunk.js +0 -1
- package/build/transfer-tokens-list-page.3c9b0280.chunk.js +0 -16
- package/build/upload-settings.0875e973.chunk.js +0 -1
- package/build/upload-translation-fr-json.84429734.chunk.js +0 -1
- package/build/upload.c7da1611.chunk.js +0 -13
- package/build/users-advanced-settings-page.1d3c14c7.chunk.js +0 -1
- package/build/users-email-settings-page.e8db68c4.chunk.js +0 -1
- package/build/users-providers-settings-page.14cac425.chunk.js +0 -1
- package/build/users-roles-settings-page.2ea4de84.chunk.js +0 -30
- package/build/webhook-edit-page.329141a5.chunk.js +0 -23
- package/build/webhook-list-page.029957a4.chunk.js +0 -1
package/.eslintignore
ADDED
package/.eslintrc.js
ADDED
|
@@ -220,7 +220,9 @@ const reducer = (state, action) =>
|
|
|
220
220
|
|
|
221
221
|
const findAllRelationsAndReplaceWithEmptyArray = findAllAndReplace(
|
|
222
222
|
components,
|
|
223
|
-
(value) =>
|
|
223
|
+
(value) => {
|
|
224
|
+
return value.type === 'relation';
|
|
225
|
+
},
|
|
224
226
|
(_, { path }) => {
|
|
225
227
|
if (state.modifiedData?.id === data.id && get(state.modifiedData, path)) {
|
|
226
228
|
return get(state.modifiedData, path);
|
package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findAllAndReplace.js
CHANGED
|
@@ -26,7 +26,11 @@ const findAllAndReplaceSetup = (components, predicate = () => false, replacement
|
|
|
26
26
|
/**
|
|
27
27
|
* @type {<TData extends object = object>(data: TData, attributes: Attributes, options?: { ignoreFalseyValues?: boolean}) => TData}
|
|
28
28
|
*/
|
|
29
|
-
const findAllAndReplace = (
|
|
29
|
+
const findAllAndReplace = (
|
|
30
|
+
data,
|
|
31
|
+
attributes,
|
|
32
|
+
{ ignoreFalseyValues = false, path = [], parent = attributes } = {}
|
|
33
|
+
) => {
|
|
30
34
|
return Object.entries(attributes).reduce(
|
|
31
35
|
(acc, [key, value]) => {
|
|
32
36
|
if (
|
|
@@ -36,7 +40,7 @@ const findAllAndReplaceSetup = (components, predicate = () => false, replacement
|
|
|
36
40
|
return acc;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
if (predicate(value, { path: [...path, key], parent
|
|
43
|
+
if (predicate(value, { path: [...path, key], parent })) {
|
|
40
44
|
acc[key] =
|
|
41
45
|
typeof replacement === 'function'
|
|
42
46
|
? replacement(acc[key], { path: [...path, key], parent: acc })
|
|
@@ -46,16 +50,18 @@ const findAllAndReplaceSetup = (components, predicate = () => false, replacement
|
|
|
46
50
|
if (value.type === 'component') {
|
|
47
51
|
const componentAttributes = components[value.component].attributes;
|
|
48
52
|
|
|
49
|
-
if (!value.repeatable) {
|
|
53
|
+
if (!value.repeatable && acc[key] && typeof acc[key] === 'object') {
|
|
50
54
|
acc[key] = findAllAndReplace(acc[key], componentAttributes, {
|
|
51
55
|
ignoreFalseyValues,
|
|
52
56
|
path: [...path, key],
|
|
57
|
+
parent: attributes[key],
|
|
53
58
|
});
|
|
54
59
|
} else if (value.repeatable && Array.isArray(acc[key])) {
|
|
55
60
|
acc[key] = acc[key].map((datum, index) => {
|
|
56
61
|
const data = findAllAndReplace(datum, componentAttributes, {
|
|
57
62
|
ignoreFalseyValues,
|
|
58
63
|
path: [...path, key, index],
|
|
64
|
+
parent: attributes[key],
|
|
59
65
|
});
|
|
60
66
|
|
|
61
67
|
return data;
|
|
@@ -67,6 +73,7 @@ const findAllAndReplaceSetup = (components, predicate = () => false, replacement
|
|
|
67
73
|
const data = findAllAndReplace(datum, componentAttributes, {
|
|
68
74
|
ignoreFalseyValues,
|
|
69
75
|
path: [...path, key, index],
|
|
76
|
+
parent: attributes[key],
|
|
70
77
|
});
|
|
71
78
|
|
|
72
79
|
return data;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import styled, { keyframes } from 'styled-components';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export const EndActionWrapper = styled(Box)`
|
|
5
|
-
position: relative;
|
|
6
|
-
`;
|
|
2
|
+
import { Flex, FieldAction } from '@strapi/design-system';
|
|
7
3
|
|
|
8
4
|
export const FieldActionWrapper = styled(FieldAction)`
|
|
9
5
|
svg {
|
|
@@ -22,18 +18,13 @@ export const FieldActionWrapper = styled(FieldAction)`
|
|
|
22
18
|
`;
|
|
23
19
|
|
|
24
20
|
export const TextValidation = styled(Flex)`
|
|
25
|
-
position: absolute;
|
|
26
|
-
right: ${({ theme }) => theme.spaces[6]};
|
|
27
|
-
width: 100px;
|
|
28
|
-
pointer-events: none;
|
|
29
|
-
|
|
30
21
|
svg {
|
|
31
|
-
margin-right: ${({ theme }) => theme.spaces[1]};
|
|
32
22
|
height: ${12 / 16}rem;
|
|
33
23
|
width: ${12 / 16}rem;
|
|
24
|
+
|
|
34
25
|
path {
|
|
35
|
-
fill: ${({ theme,
|
|
36
|
-
|
|
26
|
+
fill: ${({ theme, available }) =>
|
|
27
|
+
available ? theme.colors.success600 : theme.colors.danger600};
|
|
37
28
|
}
|
|
38
29
|
}
|
|
39
30
|
`;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useCMEditViewDataManager,
|
|
5
|
+
useFetchClient,
|
|
6
|
+
useNotification,
|
|
7
|
+
useAPIErrorHandler,
|
|
8
|
+
} from '@strapi/helper-plugin';
|
|
4
9
|
import { useIntl } from 'react-intl';
|
|
5
|
-
import
|
|
6
|
-
import { TextInput, Typography } from '@strapi/design-system';
|
|
10
|
+
import { Flex, TextInput, Typography } from '@strapi/design-system';
|
|
7
11
|
import { Refresh, CheckCircle, ExclamationMarkCircle, Loader } from '@strapi/icons';
|
|
12
|
+
|
|
8
13
|
import { getRequestUrl } from '../../utils';
|
|
9
14
|
import useDebounce from './useDebounce';
|
|
10
15
|
import UID_REGEX from './regex';
|
|
11
|
-
import {
|
|
12
|
-
EndActionWrapper,
|
|
13
|
-
FieldActionWrapper,
|
|
14
|
-
TextValidation,
|
|
15
|
-
LoadingWrapper,
|
|
16
|
-
} from './endActionStyle';
|
|
16
|
+
import { FieldActionWrapper, TextValidation, LoadingWrapper } from './endActionStyle';
|
|
17
17
|
|
|
18
18
|
const InputUID = ({
|
|
19
19
|
attribute,
|
|
@@ -34,9 +34,11 @@ const InputUID = ({
|
|
|
34
34
|
const [availability, setAvailability] = useState(null);
|
|
35
35
|
const debouncedValue = useDebounce(value, 300);
|
|
36
36
|
const generateUid = useRef();
|
|
37
|
+
const toggleNotification = useNotification();
|
|
38
|
+
const { formatAPIError } = useAPIErrorHandler();
|
|
37
39
|
const initialValue = initialData[name];
|
|
38
40
|
const { formatMessage } = useIntl();
|
|
39
|
-
const createdAtName =
|
|
41
|
+
const createdAtName = layout?.options?.timestamps ?? 0;
|
|
40
42
|
const isCreation = !initialData[createdAtName];
|
|
41
43
|
const debouncedTargetFieldValue = useDebounce(modifiedData[attribute.targetField], 300);
|
|
42
44
|
const [isCustomized, setIsCustomized] = useState(false);
|
|
@@ -59,72 +61,74 @@ const InputUID = ({
|
|
|
59
61
|
|
|
60
62
|
generateUid.current = async (shouldSetInitialValue = false) => {
|
|
61
63
|
setIsLoading(true);
|
|
62
|
-
|
|
64
|
+
|
|
63
65
|
try {
|
|
64
66
|
const {
|
|
65
67
|
data: { data },
|
|
66
|
-
} = await post(
|
|
68
|
+
} = await post(getRequestUrl('uid/generate'), {
|
|
67
69
|
contentTypeUID,
|
|
68
70
|
field: name,
|
|
69
71
|
data: modifiedData,
|
|
70
72
|
});
|
|
73
|
+
|
|
71
74
|
onChange({ target: { name, value: data, type: 'text' } }, shouldSetInitialValue);
|
|
72
75
|
setIsLoading(false);
|
|
73
|
-
} catch (
|
|
76
|
+
} catch (error) {
|
|
74
77
|
setIsLoading(false);
|
|
78
|
+
toggleNotification({
|
|
79
|
+
type: 'warning',
|
|
80
|
+
message: formatAPIError(error),
|
|
81
|
+
});
|
|
75
82
|
}
|
|
76
83
|
};
|
|
77
84
|
|
|
78
85
|
const checkAvailability = async () => {
|
|
79
|
-
setIsLoading(true);
|
|
80
|
-
|
|
81
|
-
const requestURL = getRequestUrl('uid/check-availability');
|
|
82
|
-
|
|
83
86
|
if (!value) {
|
|
84
87
|
return;
|
|
85
88
|
}
|
|
86
89
|
|
|
90
|
+
setIsLoading(true);
|
|
91
|
+
|
|
87
92
|
try {
|
|
88
|
-
const { data } = await post(
|
|
93
|
+
const { data } = await post(getRequestUrl('uid/check-availability'), {
|
|
89
94
|
contentTypeUID,
|
|
90
95
|
field: name,
|
|
91
96
|
value: value ? value.trim() : '',
|
|
92
97
|
});
|
|
93
98
|
|
|
94
|
-
setAvailability(data);
|
|
95
|
-
|
|
96
99
|
setIsLoading(false);
|
|
97
|
-
|
|
100
|
+
setAvailability(data);
|
|
101
|
+
} catch (error) {
|
|
98
102
|
setIsLoading(false);
|
|
103
|
+
toggleNotification({
|
|
104
|
+
type: 'warning',
|
|
105
|
+
message: formatAPIError(error),
|
|
106
|
+
});
|
|
99
107
|
}
|
|
100
108
|
};
|
|
101
109
|
|
|
102
|
-
//
|
|
110
|
+
// FIXME: we need to find a better way to autofill the input when it is required.
|
|
103
111
|
useEffect(() => {
|
|
104
112
|
if (!value && attribute.required) {
|
|
105
113
|
generateUid.current(true);
|
|
106
114
|
}
|
|
107
|
-
|
|
108
|
-
}, []);
|
|
115
|
+
}, [attribute.required, generateUid, value]);
|
|
109
116
|
|
|
110
117
|
useEffect(() => {
|
|
111
|
-
if (
|
|
112
|
-
debouncedValue &&
|
|
113
|
-
debouncedValue.trim().match(UID_REGEX) &&
|
|
114
|
-
debouncedValue !== initialValue
|
|
115
|
-
) {
|
|
118
|
+
if (debouncedValue?.trim().match(UID_REGEX) && debouncedValue !== initialValue) {
|
|
116
119
|
checkAvailability();
|
|
117
120
|
}
|
|
121
|
+
|
|
118
122
|
if (!debouncedValue) {
|
|
119
123
|
setAvailability(null);
|
|
120
124
|
}
|
|
121
125
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
122
|
-
}, [
|
|
126
|
+
}, [initialValue, debouncedValue]);
|
|
123
127
|
|
|
124
128
|
useEffect(() => {
|
|
125
129
|
let timer;
|
|
126
130
|
|
|
127
|
-
if (availability
|
|
131
|
+
if (availability?.isAvailable) {
|
|
128
132
|
timer = setTimeout(() => {
|
|
129
133
|
setAvailability(null);
|
|
130
134
|
}, 4000);
|
|
@@ -176,51 +180,70 @@ const InputUID = ({
|
|
|
176
180
|
disabled={disabled}
|
|
177
181
|
error={error}
|
|
178
182
|
endAction={
|
|
179
|
-
<
|
|
180
|
-
{availability &&
|
|
181
|
-
<TextValidation
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
<Flex position="relative" gap={1}>
|
|
184
|
+
{availability && !regenerateLabel && (
|
|
185
|
+
<TextValidation
|
|
186
|
+
alignItems="center"
|
|
187
|
+
gap={1}
|
|
188
|
+
justifyContent="flex-end"
|
|
189
|
+
available={!!availability?.isAvailable}
|
|
190
|
+
data-not-here-outer
|
|
191
|
+
position="absolute"
|
|
192
|
+
pointerEvents="none"
|
|
193
|
+
right={6}
|
|
194
|
+
width="100px"
|
|
195
|
+
>
|
|
196
|
+
{availability?.isAvailable ? <CheckCircle /> : <ExclamationMarkCircle />}
|
|
197
|
+
|
|
198
|
+
<Typography
|
|
199
|
+
textColor={availability.isAvailable ? 'success600' : 'danger600'}
|
|
200
|
+
variant="pi"
|
|
201
|
+
>
|
|
202
|
+
{formatMessage(
|
|
203
|
+
availability.isAvailable
|
|
204
|
+
? {
|
|
205
|
+
id: 'content-manager.components.uid.available',
|
|
206
|
+
defaultMessage: 'Available',
|
|
207
|
+
}
|
|
208
|
+
: {
|
|
209
|
+
id: 'content-manager.components.uid.unavailable',
|
|
210
|
+
defaultMessage: 'Unavailable',
|
|
211
|
+
}
|
|
212
|
+
)}
|
|
188
213
|
</Typography>
|
|
189
214
|
</TextValidation>
|
|
190
215
|
)}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
{
|
|
196
|
-
|
|
197
|
-
|
|
216
|
+
|
|
217
|
+
{!disabled && (
|
|
218
|
+
<>
|
|
219
|
+
{regenerateLabel && (
|
|
220
|
+
<TextValidation alignItems="center" justifyContent="flex-end" gap={1}>
|
|
221
|
+
<Typography textColor="primary600" variant="pi">
|
|
222
|
+
{regenerateLabel}
|
|
223
|
+
</Typography>
|
|
224
|
+
</TextValidation>
|
|
225
|
+
)}
|
|
226
|
+
|
|
227
|
+
<FieldActionWrapper
|
|
228
|
+
onClick={() => generateUid.current()}
|
|
229
|
+
label={formatMessage({
|
|
230
|
+
id: 'content-manager.components.uid.regenerate',
|
|
231
|
+
defaultMessage: 'Regenerate',
|
|
198
232
|
})}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
233
|
+
onMouseEnter={handleGenerateMouseEnter}
|
|
234
|
+
onMouseLeave={handleGenerateMouseLeave}
|
|
235
|
+
>
|
|
236
|
+
{isLoading ? (
|
|
237
|
+
<LoadingWrapper data-testid="loading-wrapper">
|
|
238
|
+
<Loader />
|
|
239
|
+
</LoadingWrapper>
|
|
240
|
+
) : (
|
|
241
|
+
<Refresh />
|
|
242
|
+
)}
|
|
243
|
+
</FieldActionWrapper>
|
|
244
|
+
</>
|
|
208
245
|
)}
|
|
209
|
-
|
|
210
|
-
onClick={() => generateUid.current()}
|
|
211
|
-
label="regenerate"
|
|
212
|
-
onMouseEnter={handleGenerateMouseEnter}
|
|
213
|
-
onMouseLeave={handleGenerateMouseLeave}
|
|
214
|
-
>
|
|
215
|
-
{isLoading ? (
|
|
216
|
-
<LoadingWrapper>
|
|
217
|
-
<Loader />
|
|
218
|
-
</LoadingWrapper>
|
|
219
|
-
) : (
|
|
220
|
-
<Refresh />
|
|
221
|
-
)}
|
|
222
|
-
</FieldActionWrapper>
|
|
223
|
-
</EndActionWrapper>
|
|
246
|
+
</Flex>
|
|
224
247
|
}
|
|
225
248
|
hint={hint}
|
|
226
249
|
label={label}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import get from 'lodash/get';
|
|
5
4
|
import omit from 'lodash/omit';
|
|
6
5
|
import { useHistory } from 'react-router-dom';
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
useTracking,
|
|
15
14
|
getYupInnerErrors,
|
|
16
15
|
Link,
|
|
16
|
+
useAPIErrorHandler,
|
|
17
17
|
} from '@strapi/helper-plugin';
|
|
18
18
|
import {
|
|
19
19
|
Box,
|
|
@@ -27,17 +27,10 @@ import {
|
|
|
27
27
|
Typography,
|
|
28
28
|
} from '@strapi/design-system';
|
|
29
29
|
import { EyeStriked, Eye } from '@strapi/icons';
|
|
30
|
-
import UnauthenticatedLayout, {
|
|
31
|
-
Column,
|
|
32
|
-
LayoutContent,
|
|
33
|
-
} from '../../../../layouts/UnauthenticatedLayout';
|
|
30
|
+
import UnauthenticatedLayout, { LayoutContent } from '../../../../layouts/UnauthenticatedLayout';
|
|
34
31
|
import Logo from '../../../../components/UnauthenticatedLogo';
|
|
35
32
|
import FieldActionWrapper from '../FieldActionWrapper';
|
|
36
33
|
|
|
37
|
-
const CenteredBox = styled(Box)`
|
|
38
|
-
text-align: center;
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
34
|
const A = styled.a`
|
|
42
35
|
color: ${({ theme }) => theme.colors.primary600};
|
|
43
36
|
`;
|
|
@@ -58,6 +51,8 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
|
|
|
58
51
|
const { trackUsage } = useTracking();
|
|
59
52
|
const { formatMessage } = useIntl();
|
|
60
53
|
const query = useQuery();
|
|
54
|
+
const { formatAPIError } = useAPIErrorHandler();
|
|
55
|
+
|
|
61
56
|
const registrationToken = query.get('registrationToken');
|
|
62
57
|
|
|
63
58
|
useEffect(() => {
|
|
@@ -73,17 +68,17 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
|
|
|
73
68
|
if (data) {
|
|
74
69
|
setUserInfo(data);
|
|
75
70
|
}
|
|
76
|
-
} catch (
|
|
77
|
-
const
|
|
71
|
+
} catch (error) {
|
|
72
|
+
const message = formatAPIError(error);
|
|
78
73
|
|
|
79
74
|
toggleNotification({
|
|
80
75
|
type: 'warning',
|
|
81
|
-
message
|
|
76
|
+
message,
|
|
82
77
|
});
|
|
83
78
|
|
|
84
79
|
// Redirect to the oops page in case of an invalid token
|
|
85
80
|
// @alexandrebodin @JAB I am not sure it is the wanted behavior
|
|
86
|
-
push(`/auth/oops?info=${encodeURIComponent(
|
|
81
|
+
push(`/auth/oops?info=${encodeURIComponent(message)}`);
|
|
87
82
|
}
|
|
88
83
|
};
|
|
89
84
|
|
|
@@ -92,6 +87,20 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
|
|
|
92
87
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
93
88
|
}, [registrationToken]);
|
|
94
89
|
|
|
90
|
+
function normalizeData(data) {
|
|
91
|
+
return Object.entries(data).reduce((acc, [key, value]) => {
|
|
92
|
+
let normalizedvalue = value;
|
|
93
|
+
|
|
94
|
+
if (!['password', 'confirmPassword'].includes(key) && typeof value === 'string') {
|
|
95
|
+
normalizedvalue = normalizedvalue.trim();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
acc[key] = normalizedvalue;
|
|
99
|
+
|
|
100
|
+
return acc;
|
|
101
|
+
}, {});
|
|
102
|
+
}
|
|
103
|
+
|
|
95
104
|
return (
|
|
96
105
|
<UnauthenticatedLayout>
|
|
97
106
|
<LayoutContent>
|
|
@@ -107,8 +116,10 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
|
|
|
107
116
|
news: false,
|
|
108
117
|
}}
|
|
109
118
|
onSubmit={async (data, formik) => {
|
|
119
|
+
const normalizedData = normalizeData(data);
|
|
120
|
+
|
|
110
121
|
try {
|
|
111
|
-
await schema.validate(
|
|
122
|
+
await schema.validate(normalizedData, { abortEarly: false });
|
|
112
123
|
|
|
113
124
|
if (submitCount > 0 && authType === 'register-admin') {
|
|
114
125
|
trackUsage('didSubmitWithErrorsFirstAdmin', { count: submitCount.toString() });
|
|
@@ -117,11 +128,11 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
|
|
|
117
128
|
if (registrationToken) {
|
|
118
129
|
// We need to pass the registration token in the url param to the api in order to submit another admin user
|
|
119
130
|
onSubmit(
|
|
120
|
-
{ userInfo: omit(
|
|
131
|
+
{ userInfo: omit(normalizedData, ['registrationToken']), registrationToken },
|
|
121
132
|
formik
|
|
122
133
|
);
|
|
123
134
|
} else {
|
|
124
|
-
onSubmit(
|
|
135
|
+
onSubmit(normalizedData, formik);
|
|
125
136
|
}
|
|
126
137
|
} catch (err) {
|
|
127
138
|
const errors = getYupInnerErrors(err);
|
|
@@ -138,27 +149,26 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
|
|
|
138
149
|
return (
|
|
139
150
|
<Form noValidate>
|
|
140
151
|
<Main>
|
|
141
|
-
<
|
|
152
|
+
<Flex direction="column" alignItems="stretch" gap={3}>
|
|
142
153
|
<Logo />
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
<Flex direction="column" alignItems="stretch" gap={6}>
|
|
154
|
+
|
|
155
|
+
<Typography as="h1" variant="alpha" textAlign="center">
|
|
156
|
+
{formatMessage({
|
|
157
|
+
id: 'Auth.form.welcome.title',
|
|
158
|
+
defaultMessage: 'Welcome to Strapi!',
|
|
159
|
+
})}
|
|
160
|
+
</Typography>
|
|
161
|
+
|
|
162
|
+
<Typography variant="epsilon" textColor="neutral600" textAlign="center">
|
|
163
|
+
{formatMessage({
|
|
164
|
+
id: 'Auth.form.register.subtitle',
|
|
165
|
+
defaultMessage:
|
|
166
|
+
'Credentials are only used to authenticate in Strapi. All saved data will be stored in your database.',
|
|
167
|
+
})}
|
|
168
|
+
</Typography>
|
|
169
|
+
</Flex>
|
|
170
|
+
|
|
171
|
+
<Flex direction="column" alignItems="stretch" gap={6} marginTop={7}>
|
|
162
172
|
<Grid gap={4}>
|
|
163
173
|
<GridItem col={6}>
|
|
164
174
|
<TextInput
|
|
@@ -204,7 +214,6 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
|
|
|
204
214
|
value={values.password}
|
|
205
215
|
error={errors.password ? formatMessage(errors.password) : undefined}
|
|
206
216
|
endAction={
|
|
207
|
-
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
208
217
|
<FieldActionWrapper
|
|
209
218
|
onClick={(e) => {
|
|
210
219
|
e.preventDefault();
|
|
@@ -245,7 +254,6 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
|
|
|
245
254
|
errors.confirmPassword ? formatMessage(errors.confirmPassword) : undefined
|
|
246
255
|
}
|
|
247
256
|
endAction={
|
|
248
|
-
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
249
257
|
<FieldActionWrapper
|
|
250
258
|
onClick={(e) => {
|
|
251
259
|
e.preventDefault();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[1387],{49776:function(D,g,s){s.d(g,{j:function(){return l}});var d={};function l(){return d}function h(o){d=o}},46784:function(D,g,s){s.d(g,{Z:function(){return m}});var d=s(907),l=s(96256),h=s(10420),o=s(49776);function m(c,f){var b,T,O,w,_,y,p,W;(0,l.Z)(1,arguments);var U=(0,o.j)(),P=(0,h.Z)((b=(T=(O=(w=f?.weekStartsOn)!==null&&w!==void 0?w:f==null||(_=f.locale)===null||_===void 0||(y=_.options)===null||y===void 0?void 0:y.weekStartsOn)!==null&&O!==void 0?O:U.weekStartsOn)!==null&&T!==void 0?T:(p=U.locale)===null||p===void 0||(W=p.options)===null||W===void 0?void 0:W.weekStartsOn)!==null&&b!==void 0?b:0);if(!(P>=0&&P<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var L=(0,d.Z)(c),X=L.getUTCDay(),V=(X<P?7:0)+X-P;return L.setUTCDate(L.getUTCDate()-V),L.setUTCHours(0,0,0,0),L}},14723:function(D,g,s){s.d(g,{Z:function(){return De}});var d=s(96256);function l(n){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?l=function(e){return typeof e}:l=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(n)}function h(n){return(0,d.Z)(1,arguments),n instanceof Date||l(n)==="object"&&Object.prototype.toString.call(n)==="[object Date]"}var o=s(907);function m(n){if((0,d.Z)(1,arguments),!h(n)&&typeof n!="number")return!1;var t=(0,o.Z)(n);return!isNaN(Number(t))}var c=s(10420);function f(n,t){(0,d.Z)(2,arguments);var e=(0,o.Z)(n).getTime(),a=(0,c.Z)(t);return new Date(e+a)}function b(n,t){(0,d.Z)(2,arguments);var e=(0,c.Z)(t);return f(n,-e)}var T=864e5;function O(n){(0,d.Z)(1,arguments);var t=(0,o.Z)(n),e=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var a=t.getTime(),r=e-a;return Math.floor(r/T)+1}function w(n){(0,d.Z)(1,arguments);var t=1,e=(0,o.Z)(n),a=e.getUTCDay(),r=(a<t?7:0)+a-t;return e.setUTCDate(e.getUTCDate()-r),e.setUTCHours(0,0,0,0),e}function _(n){(0,d.Z)(1,arguments);var t=(0,o.Z)(n),e=t.getUTCFullYear(),a=new Date(0);a.setUTCFullYear(e+1,0,4),a.setUTCHours(0,0,0,0);var r=w(a),i=new Date(0);i.setUTCFullYear(e,0,4),i.setUTCHours(0,0,0,0);var u=w(i);return t.getTime()>=r.getTime()?e+1:t.getTime()>=u.getTime()?e:e-1}function y(n){(0,d.Z)(1,arguments);var t=_(n),e=new Date(0);e.setUTCFullYear(t,0,4),e.setUTCHours(0,0,0,0);var a=w(e);return a}var p=6048e5;function W(n){(0,d.Z)(1,arguments);var t=(0,o.Z)(n),e=w(t).getTime()-y(t).getTime();return Math.round(e/p)+1}var U=s(46784),P=s(49776);function L(n,t){var e,a,r,i,u,C,x,k;(0,d.Z)(1,arguments);var S=(0,o.Z)(n),E=S.getUTCFullYear(),N=(0,P.j)(),Z=(0,c.Z)((e=(a=(r=(i=t?.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(u=t.locale)===null||u===void 0||(C=u.options)===null||C===void 0?void 0:C.firstWeekContainsDate)!==null&&r!==void 0?r:N.firstWeekContainsDate)!==null&&a!==void 0?a:(x=N.locale)===null||x===void 0||(k=x.options)===null||k===void 0?void 0:k.firstWeekContainsDate)!==null&&e!==void 0?e:1);if(!(Z>=1&&Z<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var Y=new Date(0);Y.setUTCFullYear(E+1,0,Z),Y.setUTCHours(0,0,0,0);var A=(0,U.Z)(Y,t),H=new Date(0);H.setUTCFullYear(E,0,Z),H.setUTCHours(0,0,0,0);var B=(0,U.Z)(H,t);return S.getTime()>=A.getTime()?E+1:S.getTime()>=B.getTime()?E:E-1}function X(n,t){var e,a,r,i,u,C,x,k;(0,d.Z)(1,arguments);var S=(0,P.j)(),E=(0,c.Z)((e=(a=(r=(i=t?.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(u=t.locale)===null||u===void 0||(C=u.options)===null||C===void 0?void 0:C.firstWeekContainsDate)!==null&&r!==void 0?r:S.firstWeekContainsDate)!==null&&a!==void 0?a:(x=S.locale)===null||x===void 0||(k=x.options)===null||k===void 0?void 0:k.firstWeekContainsDate)!==null&&e!==void 0?e:1),N=L(n,t),Z=new Date(0);Z.setUTCFullYear(N,0,E),Z.setUTCHours(0,0,0,0);var Y=(0,U.Z)(Z,t);return Y}var V=6048e5;function ue(n,t){(0,d.Z)(1,arguments);var e=(0,o.Z)(n),a=(0,U.Z)(e,t).getTime()-X(e,t).getTime();return Math.round(a/V)+1}var v=s(24319),de={y:function(t,e){var a=t.getUTCFullYear(),r=a>0?a:1-a;return(0,v.Z)(e==="yy"?r%100:r,e.length)},M:function(t,e){var a=t.getUTCMonth();return e==="M"?String(a+1):(0,v.Z)(a+1,2)},d:function(t,e){return(0,v.Z)(t.getUTCDate(),e.length)},a:function(t,e){var a=t.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];case"aaaa":default:return a==="am"?"a.m.":"p.m."}},h:function(t,e){return(0,v.Z)(t.getUTCHours()%12||12,e.length)},H:function(t,e){return(0,v.Z)(t.getUTCHours(),e.length)},m:function(t,e){return(0,v.Z)(t.getUTCMinutes(),e.length)},s:function(t,e){return(0,v.Z)(t.getUTCSeconds(),e.length)},S:function(t,e){var a=e.length,r=t.getUTCMilliseconds(),i=Math.floor(r*Math.pow(10,a-3));return(0,v.Z)(i,e.length)}},F=de,I={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},se={G:function(t,e,a){var r=t.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return a.era(r,{width:"abbreviated"});case"GGGGG":return a.era(r,{width:"narrow"});case"GGGG":default:return a.era(r,{width:"wide"})}},y:function(t,e,a){if(e==="yo"){var r=t.getUTCFullYear(),i=r>0?r:1-r;return a.ordinalNumber(i,{unit:"year"})}return F.y(t,e)},Y:function(t,e,a,r){var i=L(t,r),u=i>0?i:1-i;if(e==="YY"){var C=u%100;return(0,v.Z)(C,2)}return e==="Yo"?a.ordinalNumber(u,{unit:"year"}):(0,v.Z)(u,e.length)},R:function(t,e){var a=_(t);return(0,v.Z)(a,e.length)},u:function(t,e){var a=t.getUTCFullYear();return(0,v.Z)(a,e.length)},Q:function(t,e,a){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return(0,v.Z)(r,2);case"Qo":return a.ordinalNumber(r,{unit:"quarter"});case"QQQ":return a.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,a){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return(0,v.Z)(r,2);case"qo":return a.ordinalNumber(r,{unit:"quarter"});case"qqq":return a.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,a){var r=t.getUTCMonth();switch(e){case"M":case"MM":return F.M(t,e);case"Mo":return a.ordinalNumber(r+1,{unit:"month"});case"MMM":return a.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,a){var r=t.getUTCMonth();switch(e){case"L":return String(r+1);case"LL":return(0,v.Z)(r+1,2);case"Lo":return a.ordinalNumber(r+1,{unit:"month"});case"LLL":return a.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,a,r){var i=ue(t,r);return e==="wo"?a.ordinalNumber(i,{unit:"week"}):(0,v.Z)(i,e.length)},I:function(t,e,a){var r=W(t);return e==="Io"?a.ordinalNumber(r,{unit:"week"}):(0,v.Z)(r,e.length)},d:function(t,e,a){return e==="do"?a.ordinalNumber(t.getUTCDate(),{unit:"date"}):F.d(t,e)},D:function(t,e,a){var r=O(t);return e==="Do"?a.ordinalNumber(r,{unit:"dayOfYear"}):(0,v.Z)(r,e.length)},E:function(t,e,a){var r=t.getUTCDay();switch(e){case"E":case"EE":case"EEE":return a.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(r,{width:"short",context:"formatting"});case"EEEE":default:return a.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,a,r){var i=t.getUTCDay(),u=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(u);case"ee":return(0,v.Z)(u,2);case"eo":return a.ordinalNumber(u,{unit:"day"});case"eee":return a.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(i,{width:"short",context:"formatting"});case"eeee":default:return a.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,a,r){var i=t.getUTCDay(),u=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(u);case"cc":return(0,v.Z)(u,e.length);case"co":return a.ordinalNumber(u,{unit:"day"});case"ccc":return a.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(i,{width:"narrow",context:"standalone"});case"cccccc":return a.day(i,{width:"short",context:"standalone"});case"cccc":default:return a.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,a){var r=t.getUTCDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return(0,v.Z)(i,e.length);case"io":return a.ordinalNumber(i,{unit:"day"});case"iii":return a.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(r,{width:"short",context:"formatting"});case"iiii":default:return a.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,a){var r=t.getUTCHours(),i=r/12>=1?"pm":"am";switch(e){case"a":case"aa":return a.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,a){var r=t.getUTCHours(),i;switch(r===12?i=I.noon:r===0?i=I.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return a.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,a){var r=t.getUTCHours(),i;switch(r>=17?i=I.evening:r>=12?i=I.afternoon:r>=4?i=I.morning:i=I.night,e){case"B":case"BB":case"BBB":return a.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,a){if(e==="ho"){var r=t.getUTCHours()%12;return r===0&&(r=12),a.ordinalNumber(r,{unit:"hour"})}return F.h(t,e)},H:function(t,e,a){return e==="Ho"?a.ordinalNumber(t.getUTCHours(),{unit:"hour"}):F.H(t,e)},K:function(t,e,a){var r=t.getUTCHours()%12;return e==="Ko"?a.ordinalNumber(r,{unit:"hour"}):(0,v.Z)(r,e.length)},k:function(t,e,a){var r=t.getUTCHours();return r===0&&(r=24),e==="ko"?a.ordinalNumber(r,{unit:"hour"}):(0,v.Z)(r,e.length)},m:function(t,e,a){return e==="mo"?a.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):F.m(t,e)},s:function(t,e,a){return e==="so"?a.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):F.s(t,e)},S:function(t,e){return F.S(t,e)},X:function(t,e,a,r){var i=r._originalDate||t,u=i.getTimezoneOffset();if(u===0)return"Z";switch(e){case"X":return re(u);case"XXXX":case"XX":return $(u);case"XXXXX":case"XXX":default:return $(u,":")}},x:function(t,e,a,r){var i=r._originalDate||t,u=i.getTimezoneOffset();switch(e){case"x":return re(u);case"xxxx":case"xx":return $(u);case"xxxxx":case"xxx":default:return $(u,":")}},O:function(t,e,a,r){var i=r._originalDate||t,u=i.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+ae(u,":");case"OOOO":default:return"GMT"+$(u,":")}},z:function(t,e,a,r){var i=r._originalDate||t,u=i.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+ae(u,":");case"zzzz":default:return"GMT"+$(u,":")}},t:function(t,e,a,r){var i=r._originalDate||t,u=Math.floor(i.getTime()/1e3);return(0,v.Z)(u,e.length)},T:function(t,e,a,r){var i=r._originalDate||t,u=i.getTime();return(0,v.Z)(u,e.length)}};function ae(n,t){var e=n>0?"-":"+",a=Math.abs(n),r=Math.floor(a/60),i=a%60;if(i===0)return e+String(r);var u=t||"";return e+String(r)+u+(0,v.Z)(i,2)}function re(n,t){if(n%60===0){var e=n>0?"-":"+";return e+(0,v.Z)(Math.abs(n)/60,2)}return $(n,t)}function $(n,t){var e=t||"",a=n>0?"-":"+",r=Math.abs(n),i=(0,v.Z)(Math.floor(r/60),2),u=(0,v.Z)(r%60,2);return a+i+e+u}var le=se,ne=function(t,e){switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},ie=function(t,e){switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},ce=function(t,e){var a=t.match(/(P+)(p+)?/)||[],r=a[1],i=a[2];if(!i)return ne(t,e);var u;switch(r){case"P":u=e.dateTime({width:"short"});break;case"PP":u=e.dateTime({width:"medium"});break;case"PPP":u=e.dateTime({width:"long"});break;case"PPPP":default:u=e.dateTime({width:"full"});break}return u.replace("{{date}}",ne(r,e)).replace("{{time}}",ie(i,e))},fe={p:ie,P:ce},me=fe,ve=s(22774),he=["D","DD"],ge=["YY","YYYY"];function we(n){return he.indexOf(n)!==-1}function be(n){return ge.indexOf(n)!==-1}function oe(n,t,e){if(n==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var ye=s(54828),Te=ye.Z,Oe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,_e=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,pe=/^'([^]*?)'?$/,Ce=/''/g,Me=/[a-zA-Z]/;function De(n,t,e){var a,r,i,u,C,x,k,S,E,N,Z,Y,A,H,B,K,J,z;(0,d.Z)(2,arguments);var Ze=String(t),j=(0,P.j)(),Q=(a=(r=e?.locale)!==null&&r!==void 0?r:j.locale)!==null&&a!==void 0?a:Te,ee=(0,c.Z)((i=(u=(C=(x=e?.firstWeekContainsDate)!==null&&x!==void 0?x:e==null||(k=e.locale)===null||k===void 0||(S=k.options)===null||S===void 0?void 0:S.firstWeekContainsDate)!==null&&C!==void 0?C:j.firstWeekContainsDate)!==null&&u!==void 0?u:(E=j.locale)===null||E===void 0||(N=E.options)===null||N===void 0?void 0:N.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(ee>=1&&ee<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var te=(0,c.Z)((Z=(Y=(A=(H=e?.weekStartsOn)!==null&&H!==void 0?H:e==null||(B=e.locale)===null||B===void 0||(K=B.options)===null||K===void 0?void 0:K.weekStartsOn)!==null&&A!==void 0?A:j.weekStartsOn)!==null&&Y!==void 0?Y:(J=j.locale)===null||J===void 0||(z=J.options)===null||z===void 0?void 0:z.weekStartsOn)!==null&&Z!==void 0?Z:0);if(!(te>=0&&te<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!Q.localize)throw new RangeError("locale must contain localize property");if(!Q.formatLong)throw new RangeError("locale must contain formatLong property");var q=(0,o.Z)(n);if(!m(q))throw new RangeError("Invalid time value");var We=(0,ve.Z)(q),xe=b(q,We),ke={firstWeekContainsDate:ee,weekStartsOn:te,locale:Q,_originalDate:q},Ee=Ze.match(_e).map(function(M){var R=M[0];if(R==="p"||R==="P"){var G=me[R];return G(M,Q.formatLong)}return M}).join("").match(Oe).map(function(M){if(M==="''")return"'";var R=M[0];if(R==="'")return Pe(M);var G=le[R];if(G)return!(e!=null&&e.useAdditionalWeekYearTokens)&&be(M)&&oe(M,t,String(n)),!(e!=null&&e.useAdditionalDayOfYearTokens)&&we(M)&&oe(M,t,String(n)),G(xe,M,Q.localize,ke);if(R.match(Me))throw new RangeError("Format string contains an unescaped latin alphabet character `"+R+"`");return M}).join("");return Ee}function Pe(n){var t=n.match(pe);return t?t[1].replace(Ce,"'"):n}},39446:function(D,g,s){s.d(g,{Z:function(){return d}});function d(l){return function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=h.width?String(h.width):l.defaultWidth,m=l.formats[o]||l.formats[l.defaultWidth];return m}}},56565:function(D,g,s){s.d(g,{Z:function(){return d}});function d(l){return function(h,o){var m=o!=null&&o.context?String(o.context):"standalone",c;if(m==="formatting"&&l.formattingValues){var f=l.defaultFormattingWidth||l.defaultWidth,b=o!=null&&o.width?String(o.width):f;c=l.formattingValues[b]||l.formattingValues[f]}else{var T=l.defaultWidth,O=o!=null&&o.width?String(o.width):l.defaultWidth;c=l.values[O]||l.values[T]}var w=l.argumentCallback?l.argumentCallback(h):h;return c[w]}}},29450:function(D,g,s){s.d(g,{Z:function(){return d}});function d(o){return function(m){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=c.width,b=f&&o.matchPatterns[f]||o.matchPatterns[o.defaultMatchWidth],T=m.match(b);if(!T)return null;var O=T[0],w=f&&o.parsePatterns[f]||o.parsePatterns[o.defaultParseWidth],_=Array.isArray(w)?h(w,function(W){return W.test(O)}):l(w,function(W){return W.test(O)}),y;y=o.valueCallback?o.valueCallback(_):_,y=c.valueCallback?c.valueCallback(y):y;var p=m.slice(O.length);return{value:y,rest:p}}}function l(o,m){for(var c in o)if(o.hasOwnProperty(c)&&m(o[c]))return c}function h(o,m){for(var c=0;c<o.length;c++)if(m(o[c]))return c}},60965:function(D,g,s){s.d(g,{Z:function(){return d}});function d(l){return function(h){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=h.match(l.matchPattern);if(!m)return null;var c=m[0],f=h.match(l.parsePattern);if(!f)return null;var b=l.valueCallback?l.valueCallback(f[0]):f[0];b=o.valueCallback?o.valueCallback(b):b;var T=h.slice(c.length);return{value:b,rest:T}}}},10661:function(D,g){var s={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},d=function(h,o,m){var c,f=s[h];return typeof f=="string"?c=f:o===1?c=f.one:c=f.other.replace("{{count}}",o.toString()),m!=null&&m.addSuffix?m.comparison&&m.comparison>0?"in "+c:c+" ago":c};g.Z=d},57459:function(D,g){var s={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},d=function(h,o,m,c){return s[h]};g.Z=d},52855:function(D,g,s){var d=s(56565),l={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},h={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},o={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},m={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},c={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},f={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},b=function(w,_){var y=Number(w),p=y%100;if(p>20||p<10)switch(p%10){case 1:return y+"st";case 2:return y+"nd";case 3:return y+"rd"}return y+"th"},T={ordinalNumber:b,era:(0,d.Z)({values:l,defaultWidth:"wide"}),quarter:(0,d.Z)({values:h,defaultWidth:"wide",argumentCallback:function(w){return w-1}}),month:(0,d.Z)({values:o,defaultWidth:"wide"}),day:(0,d.Z)({values:m,defaultWidth:"wide"}),dayPeriod:(0,d.Z)({values:c,defaultWidth:"wide",formattingValues:f,defaultFormattingWidth:"wide"})};g.Z=T},63614:function(D,g,s){var d=s(29450),l=s(60965),h=/^(\d+)(th|st|nd|rd)?/i,o=/\d+/i,m={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},c={any:[/^b/i,/^(a|c)/i]},f={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},b={any:[/1/i,/2/i,/3/i,/4/i]},T={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},O={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},w={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},_={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},y={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},p={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},W={ordinalNumber:(0,l.Z)({matchPattern:h,parsePattern:o,valueCallback:function(P){return parseInt(P,10)}}),era:(0,d.Z)({matchPatterns:m,defaultMatchWidth:"wide",parsePatterns:c,defaultParseWidth:"any"}),quarter:(0,d.Z)({matchPatterns:f,defaultMatchWidth:"wide",parsePatterns:b,defaultParseWidth:"any",valueCallback:function(P){return P+1}}),month:(0,d.Z)({matchPatterns:T,defaultMatchWidth:"wide",parsePatterns:O,defaultParseWidth:"any"}),day:(0,d.Z)({matchPatterns:w,defaultMatchWidth:"wide",parsePatterns:_,defaultParseWidth:"any"}),dayPeriod:(0,d.Z)({matchPatterns:y,defaultMatchWidth:"any",parsePatterns:p,defaultParseWidth:"any"})};g.Z=W},54828:function(D,g,s){s.d(g,{Z:function(){return _}});var d=s(10661),l=s(39446),h={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},o={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},m={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},c={date:(0,l.Z)({formats:h,defaultWidth:"full"}),time:(0,l.Z)({formats:o,defaultWidth:"full"}),dateTime:(0,l.Z)({formats:m,defaultWidth:"full"})},f=c,b=s(57459),T=s(52855),O=s(63614),w={code:"en-US",formatDistance:d.Z,formatLong:f,formatRelative:b.Z,localize:T.Z,match:O.Z,options:{weekStartsOn:0,firstWeekContainsDate:1}},_=w},29439:function(D,g,s){s.d(g,{Z:function(){return h}});var d=s(74512);const l=o=>(0,d.jsx)("svg",{width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:(0,d.jsx)("path",{d:"M24 13.3a.2.2 0 0 1-.2.2H5.74l8.239 8.239a.2.2 0 0 1 0 .282L12.14 23.86a.2.2 0 0 1-.282 0L.14 12.14a.2.2 0 0 1 0-.282L11.86.14a.2.2 0 0 1 .282 0L13.98 1.98a.2.2 0 0 1 0 .282L5.74 10.5H23.8c.11 0 .2.09.2.2v2.6Z",fill:"#212134"})}),h=l}}]);
|