@strapi/plugin-users-permissions 5.0.0-beta.8 → 5.0.0-rc.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/LICENSE +18 -3
- package/admin/src/components/FormModal/index.jsx +50 -66
- package/admin/src/components/Permissions/PermissionRow/CheckboxWrapper.jsx +3 -2
- package/admin/src/components/Permissions/PermissionRow/SubCategory.jsx +11 -20
- package/admin/src/components/Permissions/index.jsx +1 -0
- package/admin/src/components/Policies/index.jsx +3 -3
- package/admin/src/components/UsersPermissions/index.jsx +5 -5
- package/admin/src/pages/AdvancedSettings/index.jsx +5 -5
- package/admin/src/pages/EmailTemplates/components/EmailForm.jsx +113 -112
- package/admin/src/pages/EmailTemplates/components/EmailTable.jsx +17 -12
- package/admin/src/pages/EmailTemplates/index.jsx +6 -7
- package/admin/src/pages/Providers/index.jsx +1 -1
- package/admin/src/pages/Roles/pages/CreatePage.jsx +6 -7
- package/admin/src/pages/Roles/pages/EditPage.jsx +6 -7
- package/admin/src/pages/Roles/pages/ListPage/components/TableBody.jsx +6 -5
- package/admin/src/pages/Roles/pages/ListPage/index.jsx +5 -6
- package/dist/_chunks/{index-69WUS0qJ-DzUzGVgd.mjs → index-8-k5RCnK-BHUgmsKx.mjs} +1231 -320
- package/dist/_chunks/index-8-k5RCnK-BHUgmsKx.mjs.map +1 -0
- package/dist/_chunks/{index-69WUS0qJ-621Sl9hj.js → index-8-k5RCnK-qR3QHvSP.js} +1228 -317
- package/dist/_chunks/index-8-k5RCnK-qR3QHvSP.js.map +1 -0
- package/dist/_chunks/{index-B_rNTZBF.mjs → index-B9OX-a4A.mjs} +29 -34
- package/dist/_chunks/index-B9OX-a4A.mjs.map +1 -0
- package/dist/_chunks/{index-B6AAcVOR.mjs → index-Cf2sMpyd.mjs} +10 -10
- package/dist/_chunks/{index-B6AAcVOR.mjs.map → index-Cf2sMpyd.mjs.map} +1 -1
- package/dist/_chunks/{index-00_Lq0-y.mjs → index-DCFIfSfa.mjs} +17 -23
- package/dist/_chunks/index-DCFIfSfa.mjs.map +1 -0
- package/dist/_chunks/{index-DGyiWVHr.js → index-DRoVF6Y7.js} +20 -26
- package/dist/_chunks/index-DRoVF6Y7.js.map +1 -0
- package/dist/_chunks/{index-BSqwdKVh.js → index-DVEZVDjs.js} +28 -33
- package/dist/_chunks/index-DVEZVDjs.js.map +1 -0
- package/dist/_chunks/{index-DTK4DMrt.js → index-iMO1GC3n.js} +94 -96
- package/dist/_chunks/index-iMO1GC3n.js.map +1 -0
- package/dist/_chunks/{index-CIJz4WB2.js → index-iSLj9xJT.js} +4 -4
- package/dist/_chunks/index-iSLj9xJT.js.map +1 -0
- package/dist/_chunks/{index-BGu68xEV.js → index-iaebB1BT.js} +10 -10
- package/dist/_chunks/{index-BGu68xEV.js.map → index-iaebB1BT.js.map} +1 -1
- package/dist/_chunks/{index-DaCuO0x_.mjs → index-qhy_K2pJ.mjs} +5 -5
- package/dist/_chunks/index-qhy_K2pJ.mjs.map +1 -0
- package/dist/_chunks/{index-fnfzDsYv.mjs → index-zmcUQlrv.mjs} +95 -97
- package/dist/_chunks/index-zmcUQlrv.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/package.json +6 -6
- package/server/config.js +29 -0
- package/server/controllers/auth.js +22 -4
- package/dist/_chunks/index-00_Lq0-y.mjs.map +0 -1
- package/dist/_chunks/index-69WUS0qJ-621Sl9hj.js.map +0 -1
- package/dist/_chunks/index-69WUS0qJ-DzUzGVgd.mjs.map +0 -1
- package/dist/_chunks/index-BSqwdKVh.js.map +0 -1
- package/dist/_chunks/index-B_rNTZBF.mjs.map +0 -1
- package/dist/_chunks/index-CIJz4WB2.js.map +0 -1
- package/dist/_chunks/index-DGyiWVHr.js.map +0 -1
- package/dist/_chunks/index-DTK4DMrt.js.map +0 -1
- package/dist/_chunks/index-DaCuO0x_.mjs.map +0 -1
- package/dist/_chunks/index-fnfzDsYv.mjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -2,7 +2,21 @@ Copyright (c) 2015-present Strapi Solutions SAS
|
|
|
2
2
|
|
|
3
3
|
Portions of the Strapi software are licensed as follows:
|
|
4
4
|
|
|
5
|
-
* All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined
|
|
5
|
+
* All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined below.
|
|
6
|
+
|
|
7
|
+
Enterprise License
|
|
8
|
+
|
|
9
|
+
If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at
|
|
10
|
+
https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you
|
|
11
|
+
represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have
|
|
12
|
+
agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software.
|
|
13
|
+
Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software.
|
|
14
|
+
|
|
15
|
+
BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT.
|
|
16
|
+
IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU
|
|
17
|
+
HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF
|
|
18
|
+
THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS;
|
|
19
|
+
IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
|
|
6
20
|
|
|
7
21
|
* All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
|
|
8
22
|
|
|
@@ -18,5 +32,6 @@ furnished to do so, subject to the following conditions:
|
|
|
18
32
|
The above copyright notice and this permission notice shall be included in all
|
|
19
33
|
copies or substantial portions of the Software.
|
|
20
34
|
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
|
|
35
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
36
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
37
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -6,17 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
Button,
|
|
11
|
-
Flex,
|
|
12
|
-
Grid,
|
|
13
|
-
GridItem,
|
|
14
|
-
ModalBody,
|
|
15
|
-
ModalFooter,
|
|
16
|
-
ModalHeader,
|
|
17
|
-
ModalLayout,
|
|
18
|
-
} from '@strapi/design-system';
|
|
19
|
-
import { Breadcrumbs, Crumb } from '@strapi/design-system';
|
|
9
|
+
import { Button, Flex, Grid, Modal, Breadcrumbs, Crumb } from '@strapi/design-system';
|
|
20
10
|
import { Form, Formik } from 'formik';
|
|
21
11
|
import PropTypes from 'prop-types';
|
|
22
12
|
import { useIntl } from 'react-intl';
|
|
@@ -35,71 +25,65 @@ const FormModal = ({
|
|
|
35
25
|
}) => {
|
|
36
26
|
const { formatMessage } = useIntl();
|
|
37
27
|
|
|
38
|
-
if (!isOpen) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
28
|
return (
|
|
43
|
-
<
|
|
44
|
-
<
|
|
45
|
-
<
|
|
46
|
-
{headerBreadcrumbs.
|
|
47
|
-
|
|
48
|
-
{crumb}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
29
|
+
<Modal.Root open={isOpen} onOpenChange={onToggle}>
|
|
30
|
+
<Modal.Content>
|
|
31
|
+
<Modal.Header>
|
|
32
|
+
<Breadcrumbs label={headerBreadcrumbs.join(', ')}>
|
|
33
|
+
{headerBreadcrumbs.map((crumb, index, arr) => (
|
|
34
|
+
<Crumb isCurrent={index === arr.length - 1} key={crumb}>
|
|
35
|
+
{crumb}
|
|
36
|
+
</Crumb>
|
|
37
|
+
))}
|
|
38
|
+
</Breadcrumbs>
|
|
39
|
+
</Modal.Header>
|
|
40
|
+
<Formik
|
|
41
|
+
onSubmit={(values) => onSubmit(values)}
|
|
42
|
+
initialValues={initialData}
|
|
43
|
+
validationSchema={layout.schema}
|
|
44
|
+
validateOnChange={false}
|
|
45
|
+
>
|
|
46
|
+
{({ errors, handleChange, values }) => {
|
|
47
|
+
return (
|
|
48
|
+
<Form>
|
|
49
|
+
<Modal.Body>
|
|
50
|
+
<Flex direction="column" alignItems="stretch" gap={1}>
|
|
51
|
+
<Grid.Root gap={5}>
|
|
52
|
+
{layout.form.map((row) => {
|
|
53
|
+
return row.map((input) => {
|
|
54
|
+
return (
|
|
55
|
+
<Grid.Item key={input.name} col={input.size} xs={12}>
|
|
56
|
+
<Input
|
|
57
|
+
{...input}
|
|
58
|
+
error={errors[input.name]}
|
|
59
|
+
onChange={handleChange}
|
|
60
|
+
value={values[input.name]}
|
|
61
|
+
providerToEditName={providerToEditName}
|
|
62
|
+
/>
|
|
63
|
+
</Grid.Item>
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
})}
|
|
67
|
+
</Grid.Root>
|
|
68
|
+
</Flex>
|
|
69
|
+
</Modal.Body>
|
|
70
|
+
<Modal.Footer>
|
|
85
71
|
<Button variant="tertiary" onClick={onToggle} type="button">
|
|
86
72
|
{formatMessage({
|
|
87
73
|
id: 'app.components.Button.cancel',
|
|
88
74
|
defaultMessage: 'Cancel',
|
|
89
75
|
})}
|
|
90
76
|
</Button>
|
|
91
|
-
}
|
|
92
|
-
endActions={
|
|
93
77
|
<Button type="submit" loading={isSubmiting}>
|
|
94
78
|
{formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
|
|
95
79
|
</Button>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</
|
|
102
|
-
</
|
|
80
|
+
</Modal.Footer>
|
|
81
|
+
</Form>
|
|
82
|
+
);
|
|
83
|
+
}}
|
|
84
|
+
</Formik>
|
|
85
|
+
</Modal.Content>
|
|
86
|
+
</Modal.Root>
|
|
103
87
|
);
|
|
104
88
|
};
|
|
105
89
|
|
|
@@ -3,7 +3,8 @@ import { styled, css } from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
const activeCheckboxWrapperStyles = css`
|
|
5
5
|
background: ${(props) => props.theme.colors.primary100};
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
#cog {
|
|
7
8
|
opacity: 1;
|
|
8
9
|
}
|
|
9
10
|
`;
|
|
@@ -13,7 +14,7 @@ const CheckboxWrapper = styled(Box)`
|
|
|
13
14
|
justify-content: space-between;
|
|
14
15
|
align-items: center;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
#cog {
|
|
17
18
|
opacity: 0;
|
|
18
19
|
path {
|
|
19
20
|
fill: ${(props) => props.theme.colors.primary600};
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
Checkbox,
|
|
6
|
-
Flex,
|
|
7
|
-
Typography,
|
|
8
|
-
Grid,
|
|
9
|
-
GridItem,
|
|
10
|
-
VisuallyHidden,
|
|
11
|
-
} from '@strapi/design-system';
|
|
12
|
-
import { Cog as CogIcon } from '@strapi/icons';
|
|
3
|
+
import { Box, Checkbox, Flex, Typography, Grid, VisuallyHidden } from '@strapi/design-system';
|
|
4
|
+
import { Cog } from '@strapi/icons';
|
|
13
5
|
import get from 'lodash/get';
|
|
14
6
|
import PropTypes from 'prop-types';
|
|
15
7
|
import { useIntl } from 'react-intl';
|
|
@@ -71,28 +63,27 @@ const SubCategory = ({ subCategory }) => {
|
|
|
71
63
|
<Box paddingLeft={4}>
|
|
72
64
|
<Checkbox
|
|
73
65
|
name={subCategory.name}
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
checked={hasSomeActionsSelected ? 'indeterminate' : hasAllActionsSelected}
|
|
67
|
+
onCheckedChange={(value) =>
|
|
76
68
|
handleChangeSelectAll({ target: { name: subCategory.name, value } })
|
|
77
69
|
}
|
|
78
|
-
indeterminate={hasSomeActionsSelected}
|
|
79
70
|
>
|
|
80
71
|
{formatMessage({ id: 'app.utils.select-all', defaultMessage: 'Select all' })}
|
|
81
72
|
</Checkbox>
|
|
82
73
|
</Box>
|
|
83
74
|
</Flex>
|
|
84
75
|
<Flex paddingTop={6} paddingBottom={6}>
|
|
85
|
-
<Grid gap={2} style={{ flex: 1 }}>
|
|
76
|
+
<Grid.Root gap={2} style={{ flex: 1 }}>
|
|
86
77
|
{subCategory.actions.map((action) => {
|
|
87
78
|
const name = `${action.name}.enabled`;
|
|
88
79
|
|
|
89
80
|
return (
|
|
90
|
-
<
|
|
81
|
+
<Grid.Item col={6} key={action.name}>
|
|
91
82
|
<CheckboxWrapper isActive={isActionSelected(action.name)} padding={2} hasRadius>
|
|
92
83
|
<Checkbox
|
|
93
|
-
|
|
84
|
+
checked={get(modifiedData, name, false)}
|
|
94
85
|
name={name}
|
|
95
|
-
|
|
86
|
+
onCheckedChange={(value) => onChange({ target: { name, value } })}
|
|
96
87
|
>
|
|
97
88
|
{action.label}
|
|
98
89
|
</Checkbox>
|
|
@@ -112,13 +103,13 @@ const SubCategory = ({ subCategory }) => {
|
|
|
112
103
|
}
|
|
113
104
|
)}
|
|
114
105
|
</VisuallyHidden>
|
|
115
|
-
<
|
|
106
|
+
<Cog id="cog" />
|
|
116
107
|
</button>
|
|
117
108
|
</CheckboxWrapper>
|
|
118
|
-
</
|
|
109
|
+
</Grid.Item>
|
|
119
110
|
);
|
|
120
111
|
})}
|
|
121
|
-
</Grid>
|
|
112
|
+
</Grid.Root>
|
|
122
113
|
</Flex>
|
|
123
114
|
</Box>
|
|
124
115
|
);
|
|
@@ -22,6 +22,7 @@ const Permissions = () => {
|
|
|
22
22
|
<Accordion.Item key={collapse.name} value={collapse.name}>
|
|
23
23
|
<Accordion.Header variant={index % 2 === 0 ? 'secondary' : undefined}>
|
|
24
24
|
<Accordion.Trigger
|
|
25
|
+
caretPosition="right"
|
|
25
26
|
description={formatMessage(
|
|
26
27
|
{
|
|
27
28
|
id: 'users-permissions.Plugin.permissions.plugins.description',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Flex,
|
|
3
|
+
import { Flex, Grid, Typography } from '@strapi/design-system';
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
import isEmpty from 'lodash/isEmpty';
|
|
6
6
|
import without from 'lodash/without';
|
|
@@ -22,7 +22,7 @@ const Policies = () => {
|
|
|
22
22
|
: controllerRoutes.filter((o) => o.handler.endsWith(pathResolved));
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
|
-
<
|
|
25
|
+
<Grid.Item
|
|
26
26
|
col={5}
|
|
27
27
|
background="neutral150"
|
|
28
28
|
paddingTop={6}
|
|
@@ -55,7 +55,7 @@ const Policies = () => {
|
|
|
55
55
|
</Typography>
|
|
56
56
|
</Flex>
|
|
57
57
|
)}
|
|
58
|
-
</
|
|
58
|
+
</Grid.Item>
|
|
59
59
|
);
|
|
60
60
|
};
|
|
61
61
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, memo, useImperativeHandle, useReducer } from 'react';
|
|
2
2
|
|
|
3
|
-
import { Flex, Grid,
|
|
3
|
+
import { Flex, Grid, Typography } from '@strapi/design-system';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
6
|
|
|
@@ -61,8 +61,8 @@ const UsersPermissions = forwardRef(({ permissions, routes }, ref) => {
|
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
63
|
<UsersPermissionsProvider value={providerValue}>
|
|
64
|
-
<Grid gap={0} shadow="filterShadow" hasRadius background="neutral0">
|
|
65
|
-
<
|
|
64
|
+
<Grid.Root gap={0} shadow="filterShadow" hasRadius background="neutral0">
|
|
65
|
+
<Grid.Item col={7} paddingTop={6} paddingBottom={6} paddingLeft={7} paddingRight={7}>
|
|
66
66
|
<Flex direction="column" alignItems="stretch" gap={6}>
|
|
67
67
|
<Flex direction="column" alignItems="stretch" gap={2}>
|
|
68
68
|
<Typography variant="delta" tag="h2">
|
|
@@ -80,9 +80,9 @@ const UsersPermissions = forwardRef(({ permissions, routes }, ref) => {
|
|
|
80
80
|
</Flex>
|
|
81
81
|
<Permissions />
|
|
82
82
|
</Flex>
|
|
83
|
-
</
|
|
83
|
+
</Grid.Item>
|
|
84
84
|
<Policies />
|
|
85
|
-
</Grid>
|
|
85
|
+
</Grid.Root>
|
|
86
86
|
</UsersPermissionsProvider>
|
|
87
87
|
);
|
|
88
88
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Box, Button, Flex, Grid,
|
|
3
|
+
import { Box, Button, Flex, Grid, Typography, useNotifyAT } from '@strapi/design-system';
|
|
4
4
|
import { Check } from '@strapi/icons';
|
|
5
5
|
import {
|
|
6
6
|
useAPIErrorHandler,
|
|
@@ -157,7 +157,7 @@ const AdvancedSettingsPage = () => {
|
|
|
157
157
|
defaultMessage: 'Settings',
|
|
158
158
|
})}
|
|
159
159
|
</Typography>
|
|
160
|
-
<Grid gap={6}>
|
|
160
|
+
<Grid.Root gap={6}>
|
|
161
161
|
{[
|
|
162
162
|
{
|
|
163
163
|
label: {
|
|
@@ -179,7 +179,7 @@ const AdvancedSettingsPage = () => {
|
|
|
179
179
|
},
|
|
180
180
|
...layout,
|
|
181
181
|
].map(({ size, ...field }) => (
|
|
182
|
-
<
|
|
182
|
+
<Grid.Item key={field.name} col={size}>
|
|
183
183
|
<InputRenderer
|
|
184
184
|
{...field}
|
|
185
185
|
disabled={
|
|
@@ -192,9 +192,9 @@ const AdvancedSettingsPage = () => {
|
|
|
192
192
|
field.placeholder ? formatMessage(field.placeholder) : undefined
|
|
193
193
|
}
|
|
194
194
|
/>
|
|
195
|
-
</
|
|
195
|
+
</Grid.Item>
|
|
196
196
|
))}
|
|
197
|
-
</Grid>
|
|
197
|
+
</Grid.Root>
|
|
198
198
|
</Flex>
|
|
199
199
|
</Box>
|
|
200
200
|
</Layouts.Content>
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
Grid,
|
|
6
|
-
GridItem,
|
|
7
|
-
ModalBody,
|
|
8
|
-
ModalFooter,
|
|
9
|
-
ModalHeader,
|
|
10
|
-
ModalLayout,
|
|
11
|
-
Breadcrumbs,
|
|
12
|
-
Crumb,
|
|
13
|
-
} from '@strapi/design-system';
|
|
3
|
+
import { Button, Grid, Modal, Breadcrumbs, Crumb, VisuallyHidden } from '@strapi/design-system';
|
|
14
4
|
import { Form, InputRenderer } from '@strapi/strapi/admin';
|
|
15
5
|
import PropTypes from 'prop-types';
|
|
16
6
|
import { useIntl } from 'react-intl';
|
|
@@ -18,117 +8,127 @@ import { useIntl } from 'react-intl';
|
|
|
18
8
|
import { getTrad } from '../../../utils';
|
|
19
9
|
import schema from '../utils/schema';
|
|
20
10
|
|
|
21
|
-
const EmailForm = ({ template, onToggle, onSubmit }) => {
|
|
11
|
+
const EmailForm = ({ template = {}, onToggle, open, onSubmit }) => {
|
|
22
12
|
const { formatMessage } = useIntl();
|
|
23
13
|
|
|
24
14
|
return (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})}, ${formatMessage({ id: getTrad(template.display), defaultMessage: template.display })}`}
|
|
31
|
-
>
|
|
32
|
-
<ModalHeader>
|
|
33
|
-
<Breadcrumbs
|
|
34
|
-
label={`${formatMessage({
|
|
35
|
-
id: getTrad('PopUpForm.header.edit.email-templates'),
|
|
36
|
-
defaultMessage: 'Edit email template',
|
|
37
|
-
})}, ${formatMessage({
|
|
38
|
-
id: getTrad(template.display),
|
|
39
|
-
defaultMessage: template.display,
|
|
40
|
-
})}`}
|
|
41
|
-
>
|
|
42
|
-
<Crumb>
|
|
43
|
-
{formatMessage({
|
|
15
|
+
<Modal.Root open={open} onOpenChange={onToggle}>
|
|
16
|
+
<Modal.Content>
|
|
17
|
+
<Modal.Header>
|
|
18
|
+
<Breadcrumbs
|
|
19
|
+
label={`${formatMessage({
|
|
44
20
|
id: getTrad('PopUpForm.header.edit.email-templates'),
|
|
45
21
|
defaultMessage: 'Edit email template',
|
|
46
|
-
})}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
22
|
+
})}, ${
|
|
23
|
+
template.display
|
|
24
|
+
? formatMessage({
|
|
25
|
+
id: getTrad(template.display),
|
|
26
|
+
defaultMessage: template.display,
|
|
27
|
+
})
|
|
28
|
+
: ''
|
|
29
|
+
}`}
|
|
30
|
+
>
|
|
31
|
+
<Crumb>
|
|
32
|
+
{formatMessage({
|
|
33
|
+
id: getTrad('PopUpForm.header.edit.email-templates'),
|
|
34
|
+
defaultMessage: 'Edit email template',
|
|
35
|
+
})}
|
|
36
|
+
</Crumb>
|
|
37
|
+
<Crumb isCurrent>
|
|
38
|
+
{template.display
|
|
39
|
+
? formatMessage({ id: getTrad(template.display), defaultMessage: template.display })
|
|
40
|
+
: ''}
|
|
41
|
+
</Crumb>
|
|
42
|
+
</Breadcrumbs>
|
|
43
|
+
<VisuallyHidden>
|
|
44
|
+
<Modal.Title>
|
|
45
|
+
{`${formatMessage({
|
|
46
|
+
id: getTrad('PopUpForm.header.edit.email-templates'),
|
|
47
|
+
defaultMessage: 'Edit email template',
|
|
48
|
+
})}, ${template.display ? formatMessage({ id: getTrad(template.display), defaultMessage: template.display }) : ''}`}
|
|
49
|
+
</Modal.Title>
|
|
50
|
+
</VisuallyHidden>
|
|
51
|
+
</Modal.Header>
|
|
52
|
+
<Form onSubmit={onSubmit} initialValues={template} validationSchema={schema}>
|
|
53
|
+
{({ isSubmitting }) => {
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
<Modal.Body>
|
|
57
|
+
<Grid.Root gap={5}>
|
|
58
|
+
{[
|
|
59
|
+
{
|
|
60
|
+
label: formatMessage({
|
|
61
|
+
id: getTrad('PopUpForm.Email.options.from.name.label'),
|
|
62
|
+
defaultMessage: 'Shipper name',
|
|
63
|
+
}),
|
|
64
|
+
name: 'options.from.name',
|
|
65
|
+
size: 6,
|
|
66
|
+
type: 'string',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: formatMessage({
|
|
70
|
+
id: getTrad('PopUpForm.Email.options.from.email.label'),
|
|
71
|
+
defaultMessage: 'Shipper email',
|
|
72
|
+
}),
|
|
73
|
+
name: 'options.from.email',
|
|
74
|
+
size: 6,
|
|
75
|
+
type: 'string',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: formatMessage({
|
|
79
|
+
id: getTrad('PopUpForm.Email.options.response_email.label'),
|
|
80
|
+
defaultMessage: 'Response email',
|
|
81
|
+
}),
|
|
82
|
+
name: 'options.response_email',
|
|
83
|
+
size: 6,
|
|
84
|
+
type: 'string',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: formatMessage({
|
|
88
|
+
id: getTrad('PopUpForm.Email.options.object.label'),
|
|
89
|
+
defaultMessage: 'Subject',
|
|
90
|
+
}),
|
|
91
|
+
name: 'options.object',
|
|
92
|
+
size: 6,
|
|
93
|
+
type: 'string',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: formatMessage({
|
|
97
|
+
id: getTrad('PopUpForm.Email.options.message.label'),
|
|
98
|
+
defaultMessage: 'Message',
|
|
99
|
+
}),
|
|
100
|
+
name: 'options.message',
|
|
101
|
+
size: 12,
|
|
102
|
+
type: 'text',
|
|
103
|
+
},
|
|
104
|
+
].map(({ size, ...field }) => (
|
|
105
|
+
<Grid.Item key={field.name} col={size}>
|
|
106
|
+
<InputRenderer {...field} />
|
|
107
|
+
</Grid.Item>
|
|
108
|
+
))}
|
|
109
|
+
</Grid.Root>
|
|
110
|
+
</Modal.Body>
|
|
111
|
+
<Modal.Footer>
|
|
112
|
+
<Modal.Close>
|
|
113
|
+
<Button variant="tertiary">Cancel</Button>
|
|
114
|
+
</Modal.Close>
|
|
119
115
|
<Button loading={isSubmitting} type="submit">
|
|
120
116
|
Finish
|
|
121
117
|
</Button>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
</
|
|
128
|
-
</
|
|
118
|
+
</Modal.Footer>
|
|
119
|
+
</>
|
|
120
|
+
);
|
|
121
|
+
}}
|
|
122
|
+
</Form>
|
|
123
|
+
</Modal.Content>
|
|
124
|
+
</Modal.Root>
|
|
129
125
|
);
|
|
130
126
|
};
|
|
131
127
|
|
|
128
|
+
EmailForm.defaultProps = {
|
|
129
|
+
template: {},
|
|
130
|
+
};
|
|
131
|
+
|
|
132
132
|
EmailForm.propTypes = {
|
|
133
133
|
template: PropTypes.shape({
|
|
134
134
|
display: PropTypes.string,
|
|
@@ -142,7 +142,8 @@ EmailForm.propTypes = {
|
|
|
142
142
|
object: PropTypes.string,
|
|
143
143
|
response_email: PropTypes.string,
|
|
144
144
|
}),
|
|
145
|
-
})
|
|
145
|
+
}),
|
|
146
|
+
open: PropTypes.bool.isRequired,
|
|
146
147
|
onSubmit: PropTypes.func.isRequired,
|
|
147
148
|
onToggle: PropTypes.func.isRequired,
|
|
148
149
|
};
|