node_modules ignore

This commit is contained in:
oier committed 2025-05-08 23:43:47 +02:00
1 parent e19d52f172
commit 4574544c9f
65041 files changed
+10593536

No files matched your search

@@ -0,0 +1,171 @@
'use strict';
var jsxRuntime = require('react/jsx-runtime');
require('react');
var designSystem = require('@strapi/design-system');
var admin = require('@strapi/strapi/admin');
var PropTypes = require('prop-types');
var reactIntl = require('react-intl');
require('lodash/isEmpty');
var getTrad = require('../../../utils/getTrad.js');
var schema = require('../utils/schema.js');
const EmailForm = ({ template = {}, onToggle, open, onSubmit })=>{
const { formatMessage } = reactIntl.useIntl();
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Root, {
open: open,
onOpenChange: onToggle,
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Modal.Content, {
children: [
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Modal.Header, {
children: [
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Breadcrumbs, {
label: `${formatMessage({
id: getTrad('PopUpForm.header.edit.email-templates'),
defaultMessage: 'Edit email template'
})}, ${template.display ? formatMessage({
id: getTrad(template.display),
defaultMessage: template.display
}) : ''}`,
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Crumb, {
children: formatMessage({
id: getTrad('PopUpForm.header.edit.email-templates'),
defaultMessage: 'Edit email template'
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Crumb, {
isCurrent: true,
children: template.display ? formatMessage({
id: getTrad(template.display),
defaultMessage: template.display
}) : ''
})
]
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.VisuallyHidden, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Title, {
children: `${formatMessage({
id: getTrad('PopUpForm.header.edit.email-templates'),
defaultMessage: 'Edit email template'
})}, ${template.display ? formatMessage({
id: getTrad(template.display),
defaultMessage: template.display
}) : ''}`
})
})
]
}),
/*#__PURE__*/ jsxRuntime.jsx(admin.Form, {
onSubmit: onSubmit,
initialValues: template,
validationSchema: schema,
children: ({ isSubmitting })=>{
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Body, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Grid.Root, {
gap: 5,
children: [
{
label: formatMessage({
id: getTrad('PopUpForm.Email.options.from.name.label'),
defaultMessage: 'Shipper name'
}),
name: 'options.from.name',
size: 6,
type: 'string'
},
{
label: formatMessage({
id: getTrad('PopUpForm.Email.options.from.email.label'),
defaultMessage: 'Shipper email'
}),
name: 'options.from.email',
size: 6,
type: 'string'
},
{
label: formatMessage({
id: getTrad('PopUpForm.Email.options.response_email.label'),
defaultMessage: 'Response email'
}),
name: 'options.response_email',
size: 6,
type: 'string'
},
{
label: formatMessage({
id: getTrad('PopUpForm.Email.options.object.label'),
defaultMessage: 'Subject'
}),
name: 'options.object',
size: 6,
type: 'string'
},
{
label: formatMessage({
id: getTrad('PopUpForm.Email.options.message.label'),
defaultMessage: 'Message'
}),
name: 'options.message',
size: 12,
type: 'text'
}
].map(({ size, ...field })=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.Grid.Item, {
col: size,
direction: "column",
alignItems: "stretch",
children: /*#__PURE__*/ jsxRuntime.jsx(admin.InputRenderer, {
...field
})
}, field.name))
})
}),
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Modal.Footer, {
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Modal.Close, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
variant: "tertiary",
children: "Cancel"
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
loading: isSubmitting,
type: "submit",
children: "Finish"
})
]
})
]
});
}
})
]
})
});
};
EmailForm.defaultProps = {
template: {}
};
EmailForm.propTypes = {
template: PropTypes.shape({
display: PropTypes.string,
icon: PropTypes.string,
options: PropTypes.shape({
from: PropTypes.shape({
name: PropTypes.string,
email: PropTypes.string
}),
message: PropTypes.string,
object: PropTypes.string,
response_email: PropTypes.string
})
}),
open: PropTypes.bool.isRequired,
onSubmit: PropTypes.func.isRequired,
onToggle: PropTypes.func.isRequired
};
module.exports = EmailForm;
//# sourceMappingURL=EmailForm.js.map
@@ -0,0 +1 @@
{"version":3,"file":"EmailForm.js","sources":["../../../../../admin/src/pages/EmailTemplates/components/EmailForm.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button, Grid, Modal, Breadcrumbs, Crumb, VisuallyHidden } from '@strapi/design-system';\nimport { Form, InputRenderer } from '@strapi/strapi/admin';\nimport PropTypes from 'prop-types';\nimport { useIntl } from 'react-intl';\n\nimport { getTrad } from '../../../utils';\nimport schema from '../utils/schema';\n\nconst EmailForm = ({ template = {}, onToggle, open, onSubmit }) => {\n const { formatMessage } = useIntl();\n\n return (\n <Modal.Root open={open} onOpenChange={onToggle}>\n <Modal.Content>\n <Modal.Header>\n <Breadcrumbs\n label={`${formatMessage({\n id: getTrad('PopUpForm.header.edit.email-templates'),\n defaultMessage: 'Edit email template',\n })}, ${\n template.display\n ? formatMessage({\n id: getTrad(template.display),\n defaultMessage: template.display,\n })\n : ''\n }`}\n >\n <Crumb>\n {formatMessage({\n id: getTrad('PopUpForm.header.edit.email-templates'),\n defaultMessage: 'Edit email template',\n })}\n </Crumb>\n <Crumb isCurrent>\n {template.display\n ? formatMessage({ id: getTrad(template.display), defaultMessage: template.display })\n : ''}\n </Crumb>\n </Breadcrumbs>\n <VisuallyHidden>\n <Modal.Title>\n {`${formatMessage({\n id: getTrad('PopUpForm.header.edit.email-templates'),\n defaultMessage: 'Edit email template',\n })}, ${template.display ? formatMessage({ id: getTrad(template.display), defaultMessage: template.display }) : ''}`}\n </Modal.Title>\n </VisuallyHidden>\n </Modal.Header>\n <Form onSubmit={onSubmit} initialValues={template} validationSchema={schema}>\n {({ isSubmitting }) => {\n return (\n <>\n <Modal.Body>\n <Grid.Root gap={5}>\n {[\n {\n label: formatMessage({\n id: getTrad('PopUpForm.Email.options.from.name.label'),\n defaultMessage: 'Shipper name',\n }),\n name: 'options.from.name',\n size: 6,\n type: 'string',\n },\n {\n label: formatMessage({\n id: getTrad('PopUpForm.Email.options.from.email.label'),\n defaultMessage: 'Shipper email',\n }),\n name: 'options.from.email',\n size: 6,\n type: 'string',\n },\n {\n label: formatMessage({\n id: getTrad('PopUpForm.Email.options.response_email.label'),\n defaultMessage: 'Response email',\n }),\n name: 'options.response_email',\n size: 6,\n type: 'string',\n },\n {\n label: formatMessage({\n id: getTrad('PopUpForm.Email.options.object.label'),\n defaultMessage: 'Subject',\n }),\n name: 'options.object',\n size: 6,\n type: 'string',\n },\n {\n label: formatMessage({\n id: getTrad('PopUpForm.Email.options.message.label'),\n defaultMessage: 'Message',\n }),\n name: 'options.message',\n size: 12,\n type: 'text',\n },\n ].map(({ size, ...field }) => (\n <Grid.Item\n key={field.name}\n col={size}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <InputRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n </Modal.Body>\n <Modal.Footer>\n <Modal.Close>\n <Button variant=\"tertiary\">Cancel</Button>\n </Modal.Close>\n <Button loading={isSubmitting} type=\"submit\">\n Line truncated
@@ -0,0 +1,169 @@
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
import 'react';
import { Modal, Breadcrumbs, Crumb, VisuallyHidden, Grid, Button } from '@strapi/design-system';
import { Form, InputRenderer } from '@strapi/strapi/admin';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import 'lodash/isEmpty';
import getTrad from '../../../utils/getTrad.mjs';
import schema from '../utils/schema.mjs';
const EmailForm = ({ template = {}, onToggle, open, onSubmit })=>{
const { formatMessage } = useIntl();
return /*#__PURE__*/ jsx(Modal.Root, {
open: open,
onOpenChange: onToggle,
children: /*#__PURE__*/ jsxs(Modal.Content, {
children: [
/*#__PURE__*/ jsxs(Modal.Header, {
children: [
/*#__PURE__*/ jsxs(Breadcrumbs, {
label: `${formatMessage({
id: getTrad('PopUpForm.header.edit.email-templates'),
defaultMessage: 'Edit email template'
})}, ${template.display ? formatMessage({
id: getTrad(template.display),
defaultMessage: template.display
}) : ''}`,
children: [
/*#__PURE__*/ jsx(Crumb, {
children: formatMessage({
id: getTrad('PopUpForm.header.edit.email-templates'),
defaultMessage: 'Edit email template'
})
}),
/*#__PURE__*/ jsx(Crumb, {
isCurrent: true,
children: template.display ? formatMessage({
id: getTrad(template.display),
defaultMessage: template.display
}) : ''
})
]
}),
/*#__PURE__*/ jsx(VisuallyHidden, {
children: /*#__PURE__*/ jsx(Modal.Title, {
children: `${formatMessage({
id: getTrad('PopUpForm.header.edit.email-templates'),
defaultMessage: 'Edit email template'
})}, ${template.display ? formatMessage({
id: getTrad(template.display),
defaultMessage: template.display
}) : ''}`
})
})
]
}),
/*#__PURE__*/ jsx(Form, {
onSubmit: onSubmit,
initialValues: template,
validationSchema: schema,
children: ({ isSubmitting })=>{
return /*#__PURE__*/ jsxs(Fragment, {
children: [
/*#__PURE__*/ jsx(Modal.Body, {
children: /*#__PURE__*/ jsx(Grid.Root, {
gap: 5,
children: [
{
label: formatMessage({
id: getTrad('PopUpForm.Email.options.from.name.label'),
defaultMessage: 'Shipper name'
}),
name: 'options.from.name',
size: 6,
type: 'string'
},
{
label: formatMessage({
id: getTrad('PopUpForm.Email.options.from.email.label'),
defaultMessage: 'Shipper email'
}),
name: 'options.from.email',
size: 6,
type: 'string'
},
{
label: formatMessage({
id: getTrad('PopUpForm.Email.options.response_email.label'),
defaultMessage: 'Response email'
}),
name: 'options.response_email',
size: 6,
type: 'string'
},
{
label: formatMessage({
id: getTrad('PopUpForm.Email.options.object.label'),
defaultMessage: 'Subject'
}),
name: 'options.object',
size: 6,
type: 'string'
},
{
label: formatMessage({
id: getTrad('PopUpForm.Email.options.message.label'),
defaultMessage: 'Message'
}),
name: 'options.message',
size: 12,
type: 'text'
}
].map(({ size, ...field })=>/*#__PURE__*/ jsx(Grid.Item, {
col: size,
direction: "column",
alignItems: "stretch",
children: /*#__PURE__*/ jsx(InputRenderer, {
...field
})
}, field.name))
})
}),
/*#__PURE__*/ jsxs(Modal.Footer, {
children: [
/*#__PURE__*/ jsx(Modal.Close, {
children: /*#__PURE__*/ jsx(Button, {
variant: "tertiary",
children: "Cancel"
})
}),
/*#__PURE__*/ jsx(Button, {
loading: isSubmitting,
type: "submit",
children: "Finish"
})
]
})
]
});
}
})
]
})
});
};
EmailForm.defaultProps = {
template: {}
};
EmailForm.propTypes = {
template: PropTypes.shape({
display: PropTypes.string,
icon: PropTypes.string,
options: PropTypes.shape({
from: PropTypes.shape({
name: PropTypes.string,
email: PropTypes.string
}),
message: PropTypes.string,
object: PropTypes.string,
response_email: PropTypes.string
})
}),
open: PropTypes.bool.isRequired,
onSubmit: PropTypes.func.isRequired,
onToggle: PropTypes.func.isRequired
};
export { EmailForm as default };
//# sourceMappingURL=EmailForm.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"EmailForm.mjs","sources":["../../../../../admin/src/pages/EmailTemplates/components/EmailForm.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button, Grid, Modal, Breadcrumbs, Crumb, VisuallyHidden } from '@strapi/design-system';\nimport { Form, InputRenderer } from '@strapi/strapi/admin';\nimport PropTypes from 'prop-types';\nimport { useIntl } from 'react-intl';\n\nimport { getTrad } from '../../../utils';\nimport schema from '../utils/schema';\n\nconst EmailForm = ({ template = {}, onToggle, open, onSubmit }) => {\n const { formatMessage } = useIntl();\n\n return (\n <Modal.Root open={open} onOpenChange={onToggle}>\n <Modal.Content>\n <Modal.Header>\n <Breadcrumbs\n label={`${formatMessage({\n id: getTrad('PopUpForm.header.edit.email-templates'),\n defaultMessage: 'Edit email template',\n })}, ${\n template.display\n ? formatMessage({\n id: getTrad(template.display),\n defaultMessage: template.display,\n })\n : ''\n }`}\n >\n <Crumb>\n {formatMessage({\n id: getTrad('PopUpForm.header.edit.email-templates'),\n defaultMessage: 'Edit email template',\n })}\n </Crumb>\n <Crumb isCurrent>\n {template.display\n ? formatMessage({ id: getTrad(template.display), defaultMessage: template.display })\n : ''}\n </Crumb>\n </Breadcrumbs>\n <VisuallyHidden>\n <Modal.Title>\n {`${formatMessage({\n id: getTrad('PopUpForm.header.edit.email-templates'),\n defaultMessage: 'Edit email template',\n })}, ${template.display ? formatMessage({ id: getTrad(template.display), defaultMessage: template.display }) : ''}`}\n </Modal.Title>\n </VisuallyHidden>\n </Modal.Header>\n <Form onSubmit={onSubmit} initialValues={template} validationSchema={schema}>\n {({ isSubmitting }) => {\n return (\n <>\n <Modal.Body>\n <Grid.Root gap={5}>\n {[\n {\n label: formatMessage({\n id: getTrad('PopUpForm.Email.options.from.name.label'),\n defaultMessage: 'Shipper name',\n }),\n name: 'options.from.name',\n size: 6,\n type: 'string',\n },\n {\n label: formatMessage({\n id: getTrad('PopUpForm.Email.options.from.email.label'),\n defaultMessage: 'Shipper email',\n }),\n name: 'options.from.email',\n size: 6,\n type: 'string',\n },\n {\n label: formatMessage({\n id: getTrad('PopUpForm.Email.options.response_email.label'),\n defaultMessage: 'Response email',\n }),\n name: 'options.response_email',\n size: 6,\n type: 'string',\n },\n {\n label: formatMessage({\n id: getTrad('PopUpForm.Email.options.object.label'),\n defaultMessage: 'Subject',\n }),\n name: 'options.object',\n size: 6,\n type: 'string',\n },\n {\n label: formatMessage({\n id: getTrad('PopUpForm.Email.options.message.label'),\n defaultMessage: 'Message',\n }),\n name: 'options.message',\n size: 12,\n type: 'text',\n },\n ].map(({ size, ...field }) => (\n <Grid.Item\n key={field.name}\n col={size}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <InputRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n </Modal.Body>\n <Modal.Footer>\n <Modal.Close>\n <Button variant=\"tertiary\">Cancel</Button>\n </Modal.Close>\n <Button loading={isSubmitting} type=\"submit\">\n Line truncated
@@ -0,0 +1,145 @@
'use strict';
var jsxRuntime = require('react/jsx-runtime');
require('react');
var designSystem = require('@strapi/design-system');
var icons = require('@strapi/icons');
var PropTypes = require('prop-types');
var reactIntl = require('react-intl');
require('lodash/isEmpty');
var getTrad = require('../../../utils/getTrad.js');
const EmailTable = ({ canUpdate, onEditClick })=>{
const { formatMessage } = reactIntl.useIntl();
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Table, {
colCount: 3,
rowCount: 3,
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Thead, {
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
width: "1%",
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.VisuallyHidden, {
children: formatMessage({
id: getTrad('Email.template.table.icon.label'),
defaultMessage: 'icon'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
variant: "sigma",
textColor: "neutral600",
children: formatMessage({
id: getTrad('Email.template.table.name.label'),
defaultMessage: 'name'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
width: "1%",
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.VisuallyHidden, {
children: formatMessage({
id: getTrad('Email.template.table.action.label'),
defaultMessage: 'action'
})
})
})
]
})
}),
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tbody, {
children: [
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
cursor: "pointer",
onClick: ()=>onEditClick('reset_password'),
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
width: "3.2rem",
height: "3.2rem",
padding: "0.8rem",
children: /*#__PURE__*/ jsxRuntime.jsx(icons.ArrowClockwise, {
"aria-label": formatMessage({
id: 'global.reset-password',
defaultMessage: 'Reset password'
})
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
children: formatMessage({
id: 'global.reset-password',
defaultMessage: 'Reset password'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
onClick: (e)=>e.stopPropagation(),
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
onClick: ()=>onEditClick('reset_password'),
label: formatMessage({
id: getTrad('Email.template.form.edit.label'),
defaultMessage: 'Edit a template'
}),
variant: "ghost",
disabled: !canUpdate,
children: /*#__PURE__*/ jsxRuntime.jsx(icons.Pencil, {})
})
})
]
}),
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
cursor: "pointer",
onClick: ()=>onEditClick('email_confirmation'),
children: [
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
width: "3.2rem",
height: "3.2rem",
padding: "0.8rem",
children: /*#__PURE__*/ jsxRuntime.jsx(icons.Check, {
"aria-label": formatMessage({
id: getTrad('Email.template.email_confirmation'),
defaultMessage: 'Email address confirmation'
})
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
children: formatMessage({
id: getTrad('Email.template.email_confirmation'),
defaultMessage: 'Email address confirmation'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
onClick: (e)=>e.stopPropagation(),
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
onClick: ()=>onEditClick('email_confirmation'),
label: formatMessage({
id: getTrad('Email.template.form.edit.label'),
defaultMessage: 'Edit a template'
}),
variant: "ghost",
disabled: !canUpdate,
children: /*#__PURE__*/ jsxRuntime.jsx(icons.Pencil, {})
})
})
]
})
]
})
]
});
};
EmailTable.propTypes = {
canUpdate: PropTypes.bool.isRequired,
onEditClick: PropTypes.func.isRequired
};
module.exports = EmailTable;
//# sourceMappingURL=EmailTable.js.map
@@ -0,0 +1 @@
{"version":3,"file":"EmailTable.js","sources":["../../../../../admin/src/pages/EmailTemplates/components/EmailTable.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n IconButton,\n Table,\n Tbody,\n Td,\n Th,\n Thead,\n Tr,\n Typography,\n VisuallyHidden,\n Box,\n} from '@strapi/design-system';\nimport { Check, Pencil, ArrowClockwise as Refresh } from '@strapi/icons';\nimport PropTypes from 'prop-types';\nimport { useIntl } from 'react-intl';\n\nimport { getTrad } from '../../../utils';\n\nconst EmailTable = ({ canUpdate, onEditClick }) => {\n const { formatMessage } = useIntl();\n\n return (\n <Table colCount={3} rowCount={3}>\n <Thead>\n <Tr>\n <Th width=\"1%\">\n <VisuallyHidden>\n {formatMessage({\n id: getTrad('Email.template.table.icon.label'),\n defaultMessage: 'icon',\n })}\n </VisuallyHidden>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTrad('Email.template.table.name.label'),\n defaultMessage: 'name',\n })}\n </Typography>\n </Th>\n <Th width=\"1%\">\n <VisuallyHidden>\n {formatMessage({\n id: getTrad('Email.template.table.action.label'),\n defaultMessage: 'action',\n })}\n </VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n <Tbody>\n <Tr cursor=\"pointer\" onClick={() => onEditClick('reset_password')}>\n <Td>\n <Box width=\"3.2rem\" height=\"3.2rem\" padding=\"0.8rem\">\n <Refresh\n aria-label={formatMessage({\n id: 'global.reset-password',\n defaultMessage: 'Reset password',\n })}\n />\n </Box>\n </Td>\n <Td>\n <Typography>\n {formatMessage({\n id: 'global.reset-password',\n defaultMessage: 'Reset password',\n })}\n </Typography>\n </Td>\n <Td onClick={(e) => e.stopPropagation()}>\n <IconButton\n onClick={() => onEditClick('reset_password')}\n label={formatMessage({\n id: getTrad('Email.template.form.edit.label'),\n defaultMessage: 'Edit a template',\n })}\n variant=\"ghost\"\n disabled={!canUpdate}\n >\n <Pencil />\n </IconButton>\n </Td>\n </Tr>\n <Tr cursor=\"pointer\" onClick={() => onEditClick('email_confirmation')}>\n <Td>\n <Box width=\"3.2rem\" height=\"3.2rem\" padding=\"0.8rem\">\n <Check\n aria-label={formatMessage({\n id: getTrad('Email.template.email_confirmation'),\n defaultMessage: 'Email address confirmation',\n })}\n />\n </Box>\n </Td>\n <Td>\n <Typography>\n {formatMessage({\n id: getTrad('Email.template.email_confirmation'),\n defaultMessage: 'Email address confirmation',\n })}\n </Typography>\n </Td>\n <Td onClick={(e) => e.stopPropagation()}>\n <IconButton\n onClick={() => onEditClick('email_confirmation')}\n label={formatMessage({\n id: getTrad('Email.template.form.edit.label'),\n defaultMessage: 'Edit a template',\n })}\n variant=\"ghost\"\n disabled={!canUpdate}\n >\n <Pencil />\n </IconButton>\n </Td>\n </Tr>\n </Tbody>\n </Table>\n );\n};\n\nEmailTable.propTypes = {\n canUpdate: PropTypes.bool.isRequired,\n onEditClick: PropTypes.func.isRequired,\n};\n\nexport default EmailTable;\n"],"names":["EmailTable","canUpdate","onEditClick","formatMessage","useIntl","_jsxs","Table","colCount","rowCount","_jsx","Thead","Tr","Th","width","VisuallyHidden","id","getTrad","defaultMessage","Typography","variant","textColor","Tbody","cursor","onClick","Td","Box","height","padding","Refresh","aria-label","e","stopPropagation","IconButton","label","disabled","Pencil","Check","propTypes","PropTypes","bool","isRequired","func"],"mappings":";;;;;;;;;;;AAoBA,MAAMA,aAAa,CAAC,EAAEC,SAAS,EAAEC,WAAW,EAAE,GAAA;IAC5C,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAE1B,IAAA,qBACEC,eAACC,CAAAA,kBAAAA,EAAAA;QAAMC,QAAU,EAAA,CAAA;QAAGC,QAAU,EAAA,CAAA;;0BAC5BC,cAACC,CAAAA,kBAAAA,EAAAA;AACC,gBAAA,QAAA,gBAAAL,eAACM,CAAAA,eAAAA,EAAAA;;sCACCF,cAACG,CAAAA,eAAAA,EAAAA;4BAAGC,KAAM,EAAA,IAAA;AACR,4BAAA,QAAA,gBAAAJ,cAACK,CAAAA,2BAAAA,EAAAA;0CACEX,aAAc,CAAA;AACbY,oCAAAA,EAAAA,EAAIC,OAAQ,CAAA,iCAAA,CAAA;oCACZC,cAAgB,EAAA;AAClB,iCALine truncated
@@ -0,0 +1,143 @@
import { jsxs, jsx } from 'react/jsx-runtime';
import 'react';
import { Table, Thead, Tr, Th, VisuallyHidden, Typography, Tbody, Td, Box, IconButton } from '@strapi/design-system';
import { ArrowClockwise, Pencil, Check } from '@strapi/icons';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import 'lodash/isEmpty';
import getTrad from '../../../utils/getTrad.mjs';
const EmailTable = ({ canUpdate, onEditClick })=>{
const { formatMessage } = useIntl();
return /*#__PURE__*/ jsxs(Table, {
colCount: 3,
rowCount: 3,
children: [
/*#__PURE__*/ jsx(Thead, {
children: /*#__PURE__*/ jsxs(Tr, {
children: [
/*#__PURE__*/ jsx(Th, {
width: "1%",
children: /*#__PURE__*/ jsx(VisuallyHidden, {
children: formatMessage({
id: getTrad('Email.template.table.icon.label'),
defaultMessage: 'icon'
})
})
}),
/*#__PURE__*/ jsx(Th, {
children: /*#__PURE__*/ jsx(Typography, {
variant: "sigma",
textColor: "neutral600",
children: formatMessage({
id: getTrad('Email.template.table.name.label'),
defaultMessage: 'name'
})
})
}),
/*#__PURE__*/ jsx(Th, {
width: "1%",
children: /*#__PURE__*/ jsx(VisuallyHidden, {
children: formatMessage({
id: getTrad('Email.template.table.action.label'),
defaultMessage: 'action'
})
})
})
]
})
}),
/*#__PURE__*/ jsxs(Tbody, {
children: [
/*#__PURE__*/ jsxs(Tr, {
cursor: "pointer",
onClick: ()=>onEditClick('reset_password'),
children: [
/*#__PURE__*/ jsx(Td, {
children: /*#__PURE__*/ jsx(Box, {
width: "3.2rem",
height: "3.2rem",
padding: "0.8rem",
children: /*#__PURE__*/ jsx(ArrowClockwise, {
"aria-label": formatMessage({
id: 'global.reset-password',
defaultMessage: 'Reset password'
})
})
})
}),
/*#__PURE__*/ jsx(Td, {
children: /*#__PURE__*/ jsx(Typography, {
children: formatMessage({
id: 'global.reset-password',
defaultMessage: 'Reset password'
})
})
}),
/*#__PURE__*/ jsx(Td, {
onClick: (e)=>e.stopPropagation(),
children: /*#__PURE__*/ jsx(IconButton, {
onClick: ()=>onEditClick('reset_password'),
label: formatMessage({
id: getTrad('Email.template.form.edit.label'),
defaultMessage: 'Edit a template'
}),
variant: "ghost",
disabled: !canUpdate,
children: /*#__PURE__*/ jsx(Pencil, {})
})
})
]
}),
/*#__PURE__*/ jsxs(Tr, {
cursor: "pointer",
onClick: ()=>onEditClick('email_confirmation'),
children: [
/*#__PURE__*/ jsx(Td, {
children: /*#__PURE__*/ jsx(Box, {
width: "3.2rem",
height: "3.2rem",
padding: "0.8rem",
children: /*#__PURE__*/ jsx(Check, {
"aria-label": formatMessage({
id: getTrad('Email.template.email_confirmation'),
defaultMessage: 'Email address confirmation'
})
})
})
}),
/*#__PURE__*/ jsx(Td, {
children: /*#__PURE__*/ jsx(Typography, {
children: formatMessage({
id: getTrad('Email.template.email_confirmation'),
defaultMessage: 'Email address confirmation'
})
})
}),
/*#__PURE__*/ jsx(Td, {
onClick: (e)=>e.stopPropagation(),
children: /*#__PURE__*/ jsx(IconButton, {
onClick: ()=>onEditClick('email_confirmation'),
label: formatMessage({
id: getTrad('Email.template.form.edit.label'),
defaultMessage: 'Edit a template'
}),
variant: "ghost",
disabled: !canUpdate,
children: /*#__PURE__*/ jsx(Pencil, {})
})
})
]
})
]
})
]
});
};
EmailTable.propTypes = {
canUpdate: PropTypes.bool.isRequired,
onEditClick: PropTypes.func.isRequired
};
export { EmailTable as default };
//# sourceMappingURL=EmailTable.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"EmailTable.mjs","sources":["../../../../../admin/src/pages/EmailTemplates/components/EmailTable.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n IconButton,\n Table,\n Tbody,\n Td,\n Th,\n Thead,\n Tr,\n Typography,\n VisuallyHidden,\n Box,\n} from '@strapi/design-system';\nimport { Check, Pencil, ArrowClockwise as Refresh } from '@strapi/icons';\nimport PropTypes from 'prop-types';\nimport { useIntl } from 'react-intl';\n\nimport { getTrad } from '../../../utils';\n\nconst EmailTable = ({ canUpdate, onEditClick }) => {\n const { formatMessage } = useIntl();\n\n return (\n <Table colCount={3} rowCount={3}>\n <Thead>\n <Tr>\n <Th width=\"1%\">\n <VisuallyHidden>\n {formatMessage({\n id: getTrad('Email.template.table.icon.label'),\n defaultMessage: 'icon',\n })}\n </VisuallyHidden>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTrad('Email.template.table.name.label'),\n defaultMessage: 'name',\n })}\n </Typography>\n </Th>\n <Th width=\"1%\">\n <VisuallyHidden>\n {formatMessage({\n id: getTrad('Email.template.table.action.label'),\n defaultMessage: 'action',\n })}\n </VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n <Tbody>\n <Tr cursor=\"pointer\" onClick={() => onEditClick('reset_password')}>\n <Td>\n <Box width=\"3.2rem\" height=\"3.2rem\" padding=\"0.8rem\">\n <Refresh\n aria-label={formatMessage({\n id: 'global.reset-password',\n defaultMessage: 'Reset password',\n })}\n />\n </Box>\n </Td>\n <Td>\n <Typography>\n {formatMessage({\n id: 'global.reset-password',\n defaultMessage: 'Reset password',\n })}\n </Typography>\n </Td>\n <Td onClick={(e) => e.stopPropagation()}>\n <IconButton\n onClick={() => onEditClick('reset_password')}\n label={formatMessage({\n id: getTrad('Email.template.form.edit.label'),\n defaultMessage: 'Edit a template',\n })}\n variant=\"ghost\"\n disabled={!canUpdate}\n >\n <Pencil />\n </IconButton>\n </Td>\n </Tr>\n <Tr cursor=\"pointer\" onClick={() => onEditClick('email_confirmation')}>\n <Td>\n <Box width=\"3.2rem\" height=\"3.2rem\" padding=\"0.8rem\">\n <Check\n aria-label={formatMessage({\n id: getTrad('Email.template.email_confirmation'),\n defaultMessage: 'Email address confirmation',\n })}\n />\n </Box>\n </Td>\n <Td>\n <Typography>\n {formatMessage({\n id: getTrad('Email.template.email_confirmation'),\n defaultMessage: 'Email address confirmation',\n })}\n </Typography>\n </Td>\n <Td onClick={(e) => e.stopPropagation()}>\n <IconButton\n onClick={() => onEditClick('email_confirmation')}\n label={formatMessage({\n id: getTrad('Email.template.form.edit.label'),\n defaultMessage: 'Edit a template',\n })}\n variant=\"ghost\"\n disabled={!canUpdate}\n >\n <Pencil />\n </IconButton>\n </Td>\n </Tr>\n </Tbody>\n </Table>\n );\n};\n\nEmailTable.propTypes = {\n canUpdate: PropTypes.bool.isRequired,\n onEditClick: PropTypes.func.isRequired,\n};\n\nexport default EmailTable;\n"],"names":["EmailTable","canUpdate","onEditClick","formatMessage","useIntl","_jsxs","Table","colCount","rowCount","_jsx","Thead","Tr","Th","width","VisuallyHidden","id","getTrad","defaultMessage","Typography","variant","textColor","Tbody","cursor","onClick","Td","Box","height","padding","Refresh","aria-label","e","stopPropagation","IconButton","label","disabled","Pencil","Check","propTypes","PropTypes","bool","isRequired","func"],"mappings":";;;;;;;;;AAoBA,MAAMA,aAAa,CAAC,EAAEC,SAAS,EAAEC,WAAW,EAAE,GAAA;IAC5C,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,qBACEC,IAACC,CAAAA,KAAAA,EAAAA;QAAMC,QAAU,EAAA,CAAA;QAAGC,QAAU,EAAA,CAAA;;0BAC5BC,GAACC,CAAAA,KAAAA,EAAAA;AACC,gBAAA,QAAA,gBAAAL,IAACM,CAAAA,EAAAA,EAAAA;;sCACCF,GAACG,CAAAA,EAAAA,EAAAA;4BAAGC,KAAM,EAAA,IAAA;AACR,4BAAA,QAAA,gBAAAJ,GAACK,CAAAA,cAAAA,EAAAA;0CACEX,aAAc,CAAA;AACbY,oCAAAA,EAAAA,EAAIC,OAAQ,CAAA,iCAAA,CAAA;oCACZC,cAAgB,EAAA;AAClB,iCAAA;;;Line truncated
@@ -0,0 +1,157 @@
'use strict';
var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var strapiAdmin = require('@strapi/admin/strapi-admin');
var designSystem = require('@strapi/design-system');
var admin = require('@strapi/strapi/admin');
var reactIntl = require('react-intl');
var reactQuery = require('react-query');
var constants = require('../../constants.js');
require('lodash/isEmpty');
var getTrad = require('../../utils/getTrad.js');
var EmailForm = require('./components/EmailForm.js');
var EmailTable = require('./components/EmailTable.js');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
const ProtectedEmailTemplatesPage = ()=>/*#__PURE__*/ jsxRuntime.jsx(admin.Page.Protect, {
permissions: constants.PERMISSIONS.readEmailTemplates,
children: /*#__PURE__*/ jsxRuntime.jsx(EmailTemplatesPage, {})
});
const EmailTemplatesPage = ()=>{
const { formatMessage } = reactIntl.useIntl();
const { trackUsage } = strapiAdmin.useTracking();
const { notifyStatus } = designSystem.useNotifyAT();
const { toggleNotification } = admin.useNotification();
const queryClient = reactQuery.useQueryClient();
const { get, put } = admin.useFetchClient();
const { formatAPIError } = admin.useAPIErrorHandler();
const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
const [templateToEdit, setTemplateToEdit] = React__namespace.useState(null);
const { isLoading: isLoadingForPermissions, allowedActions: { canUpdate } } = admin.useRBAC({
update: constants.PERMISSIONS.updateEmailTemplates
});
const { isLoading: isLoadingData, data } = reactQuery.useQuery([
'users-permissions',
'email-templates'
], async ()=>{
const { data } = await get('/users-permissions/email-templates');
return data;
}, {
onSuccess () {
notifyStatus(formatMessage({
id: getTrad('Email.template.data.loaded'),
defaultMessage: 'Email templates has been loaded'
}));
},
onError (error) {
toggleNotification({
type: 'danger',
message: formatAPIError(error)
});
}
});
const isLoading = isLoadingForPermissions || isLoadingData;
const handleToggle = ()=>{
setIsModalOpen((prev)=>!prev);
};
const handleEditClick = (template)=>{
setTemplateToEdit(template);
handleToggle();
};
const submitMutation = reactQuery.useMutation((body)=>put('/users-permissions/email-templates', {
'email-templates': body
}), {
async onSuccess () {
await queryClient.invalidateQueries([
'users-permissions',
'email-templates'
]);
toggleNotification({
type: 'success',
message: formatMessage({
id: 'notification.success.saved',
defaultMessage: 'Saved'
})
});
trackUsage('didEditEmailTemplates');
handleToggle();
},
onError (error) {
toggleNotification({
type: 'danger',
message: formatAPIError(error)
});
},
refetchActive: true
});
const handleSubmit = (body)=>{
trackUsage('willEditEmailTemplates');
const editedTemplates = {
...data,
[templateToEdit]: body
};
submitMutation.mutate(editedTemplates);
};
if (isLoading) {
return /*#__PURE__*/ jsxRuntime.jsx(admin.Page.Loading, {});
}
return /*#__PURE__*/ jsxRuntime.jsxs(admin.Page.Main, {
"aria-busy": submitMutation.isLoading,
children: [
/*#__PURE__*/ jsxRuntime.jsx(admin.Page.Title, {
children: formatMessage({
id: 'Settings.PageTitle',
defaultMessage: 'Settings - {name}'
}, {
name: formatMessage({
id: getTrad('HeaderNav.link.emailTemplates'),
defaultMessage: 'Email templates'
})
})
}),
/*#__PURE__*/ jsxRuntime.jsx(admin.Layouts.Header, {
title: formatMessage({
id: getTrad('HeaderNav.link.emailTemplates'),
defaultMessage: 'Email templates'
})
}),
/*#__PURE__*/ jsxRuntime.jsxs(admin.Layouts.Content, {
children: [
/*#__PURE__*/ jsxRuntime.jsx(EmailTable, {
onEditClick: handleEditClick,
canUpdate: canUpdate
}),
/*#__PURE__*/ jsxRuntime.jsx(EmailForm, {
template: data[templateToEdit],
onToggle: handleToggle,
open: isModalOpen,
onSubmit: handleSubmit
})
]
})
]
});
};
exports.EmailTemplatesPage = EmailTemplatesPage;
exports.ProtectedEmailTemplatesPage = ProtectedEmailTemplatesPage;
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../../../admin/src/pages/EmailTemplates/index.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useTracking } from '@strapi/admin/strapi-admin';\nimport { useNotifyAT } from '@strapi/design-system';\nimport {\n Page,\n useAPIErrorHandler,\n useNotification,\n useFetchClient,\n useRBAC,\n Layouts,\n} from '@strapi/strapi/admin';\nimport { useIntl } from 'react-intl';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { PERMISSIONS } from '../../constants';\nimport { getTrad } from '../../utils';\n\nimport EmailForm from './components/EmailForm';\nimport EmailTable from './components/EmailTable';\n\nconst ProtectedEmailTemplatesPage = () => (\n <Page.Protect permissions={PERMISSIONS.readEmailTemplates}>\n <EmailTemplatesPage />\n </Page.Protect>\n);\nconst EmailTemplatesPage = () => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const { notifyStatus } = useNotifyAT();\n const { toggleNotification } = useNotification();\n const queryClient = useQueryClient();\n const { get, put } = useFetchClient();\n const { formatAPIError } = useAPIErrorHandler();\n\n const [isModalOpen, setIsModalOpen] = React.useState(false);\n const [templateToEdit, setTemplateToEdit] = React.useState(null);\n\n const {\n isLoading: isLoadingForPermissions,\n allowedActions: { canUpdate },\n } = useRBAC({ update: PERMISSIONS.updateEmailTemplates });\n\n const { isLoading: isLoadingData, data } = useQuery(\n ['users-permissions', 'email-templates'],\n async () => {\n const { data } = await get('/users-permissions/email-templates');\n\n return data;\n },\n {\n onSuccess() {\n notifyStatus(\n formatMessage({\n id: getTrad('Email.template.data.loaded'),\n defaultMessage: 'Email templates has been loaded',\n })\n );\n },\n onError(error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n },\n }\n );\n\n const isLoading = isLoadingForPermissions || isLoadingData;\n\n const handleToggle = () => {\n setIsModalOpen((prev) => !prev);\n };\n\n const handleEditClick = (template) => {\n setTemplateToEdit(template);\n handleToggle();\n };\n\n const submitMutation = useMutation(\n (body) => put('/users-permissions/email-templates', { 'email-templates': body }),\n {\n async onSuccess() {\n await queryClient.invalidateQueries(['users-permissions', 'email-templates']);\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n\n trackUsage('didEditEmailTemplates');\n\n handleToggle();\n },\n onError(error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n },\n refetchActive: true,\n }\n );\n\n const handleSubmit = (body) => {\n trackUsage('willEditEmailTemplates');\n\n const editedTemplates = { ...data, [templateToEdit]: body };\n submitMutation.mutate(editedTemplates);\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n return (\n <Page.Main aria-busy={submitMutation.isLoading}>\n <Page.Title>\n {formatMessage(\n { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },\n {\n name: formatMessage({\n id: getTrad('HeaderNav.link.emailTemplates'),\n defaultMessage: 'Email templates',\n }),\n }\n )}\n </Page.Title>\n <Layouts.Header\n title={formatMessage({\n id: getTrad('HeaderNav.link.emailTemplates'),\n defaultMessage: 'Email templates',\n })}\n />\n <Layouts.Content>\n <EmailTable onEditClick={handleEditClick} canUpdate={canUpdate} />\n <EmailForm\n template={data[templateToEdit]}\n onToggle={handleToggle}\n open={isModalOpen}\n onSubmit={handleSubmit}\n />\n </Layouts.Content>\n </Page.Main>\n );\n};\n\nexport { ProtectedEmailTemplatesPage, EmailTemplatesPage };\n"],"names":["ProtectedEmailTemplatesPage","_jsx","Page","Protect","permissions","PERMISSIONS","readEmailTemplates","EmailTemplatesPage","formatMessage","useIntl","trackUsage","useTracking","notifyStatus","useNotifyAT","toggleNotification","useNotification","queryClient","useQueryClient","get","put","useFetchClient","formatAPIError","useAPIErrorHandler","isModalOpen","setIsModalOpen","React","useState","templateToEdit","setTemplateToEdit","isLoading","isLoadingForPermissions","allowedActions","canUpdate","useRBAC","update","updateEmailTemplates","isLoadingData","data","useQuery","onSuccess","id","getTrad","defaultMessage","onError","error","type","message","handleToggle","prev","handlLine truncated
@@ -0,0 +1,135 @@
import { jsx, jsxs } from 'react/jsx-runtime';
import * as React from 'react';
import { useTracking } from '@strapi/admin/strapi-admin';
import { useNotifyAT } from '@strapi/design-system';
import { Page, useNotification, useFetchClient, useAPIErrorHandler, useRBAC, Layouts } from '@strapi/strapi/admin';
import { useIntl } from 'react-intl';
import { useQueryClient, useQuery, useMutation } from 'react-query';
import { PERMISSIONS } from '../../constants.mjs';
import 'lodash/isEmpty';
import getTrad from '../../utils/getTrad.mjs';
import EmailForm from './components/EmailForm.mjs';
import EmailTable from './components/EmailTable.mjs';
const ProtectedEmailTemplatesPage = ()=>/*#__PURE__*/ jsx(Page.Protect, {
permissions: PERMISSIONS.readEmailTemplates,
children: /*#__PURE__*/ jsx(EmailTemplatesPage, {})
});
const EmailTemplatesPage = ()=>{
const { formatMessage } = useIntl();
const { trackUsage } = useTracking();
const { notifyStatus } = useNotifyAT();
const { toggleNotification } = useNotification();
const queryClient = useQueryClient();
const { get, put } = useFetchClient();
const { formatAPIError } = useAPIErrorHandler();
const [isModalOpen, setIsModalOpen] = React.useState(false);
const [templateToEdit, setTemplateToEdit] = React.useState(null);
const { isLoading: isLoadingForPermissions, allowedActions: { canUpdate } } = useRBAC({
update: PERMISSIONS.updateEmailTemplates
});
const { isLoading: isLoadingData, data } = useQuery([
'users-permissions',
'email-templates'
], async ()=>{
const { data } = await get('/users-permissions/email-templates');
return data;
}, {
onSuccess () {
notifyStatus(formatMessage({
id: getTrad('Email.template.data.loaded'),
defaultMessage: 'Email templates has been loaded'
}));
},
onError (error) {
toggleNotification({
type: 'danger',
message: formatAPIError(error)
});
}
});
const isLoading = isLoadingForPermissions || isLoadingData;
const handleToggle = ()=>{
setIsModalOpen((prev)=>!prev);
};
const handleEditClick = (template)=>{
setTemplateToEdit(template);
handleToggle();
};
const submitMutation = useMutation((body)=>put('/users-permissions/email-templates', {
'email-templates': body
}), {
async onSuccess () {
await queryClient.invalidateQueries([
'users-permissions',
'email-templates'
]);
toggleNotification({
type: 'success',
message: formatMessage({
id: 'notification.success.saved',
defaultMessage: 'Saved'
})
});
trackUsage('didEditEmailTemplates');
handleToggle();
},
onError (error) {
toggleNotification({
type: 'danger',
message: formatAPIError(error)
});
},
refetchActive: true
});
const handleSubmit = (body)=>{
trackUsage('willEditEmailTemplates');
const editedTemplates = {
...data,
[templateToEdit]: body
};
submitMutation.mutate(editedTemplates);
};
if (isLoading) {
return /*#__PURE__*/ jsx(Page.Loading, {});
}
return /*#__PURE__*/ jsxs(Page.Main, {
"aria-busy": submitMutation.isLoading,
children: [
/*#__PURE__*/ jsx(Page.Title, {
children: formatMessage({
id: 'Settings.PageTitle',
defaultMessage: 'Settings - {name}'
}, {
name: formatMessage({
id: getTrad('HeaderNav.link.emailTemplates'),
defaultMessage: 'Email templates'
})
})
}),
/*#__PURE__*/ jsx(Layouts.Header, {
title: formatMessage({
id: getTrad('HeaderNav.link.emailTemplates'),
defaultMessage: 'Email templates'
})
}),
/*#__PURE__*/ jsxs(Layouts.Content, {
children: [
/*#__PURE__*/ jsx(EmailTable, {
onEditClick: handleEditClick,
canUpdate: canUpdate
}),
/*#__PURE__*/ jsx(EmailForm, {
template: data[templateToEdit],
onToggle: handleToggle,
open: isModalOpen,
onSubmit: handleSubmit
})
]
})
]
});
};
export { EmailTemplatesPage, ProtectedEmailTemplatesPage };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../admin/src/pages/EmailTemplates/index.jsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useTracking } from '@strapi/admin/strapi-admin';\nimport { useNotifyAT } from '@strapi/design-system';\nimport {\n Page,\n useAPIErrorHandler,\n useNotification,\n useFetchClient,\n useRBAC,\n Layouts,\n} from '@strapi/strapi/admin';\nimport { useIntl } from 'react-intl';\nimport { useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { PERMISSIONS } from '../../constants';\nimport { getTrad } from '../../utils';\n\nimport EmailForm from './components/EmailForm';\nimport EmailTable from './components/EmailTable';\n\nconst ProtectedEmailTemplatesPage = () => (\n <Page.Protect permissions={PERMISSIONS.readEmailTemplates}>\n <EmailTemplatesPage />\n </Page.Protect>\n);\nconst EmailTemplatesPage = () => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const { notifyStatus } = useNotifyAT();\n const { toggleNotification } = useNotification();\n const queryClient = useQueryClient();\n const { get, put } = useFetchClient();\n const { formatAPIError } = useAPIErrorHandler();\n\n const [isModalOpen, setIsModalOpen] = React.useState(false);\n const [templateToEdit, setTemplateToEdit] = React.useState(null);\n\n const {\n isLoading: isLoadingForPermissions,\n allowedActions: { canUpdate },\n } = useRBAC({ update: PERMISSIONS.updateEmailTemplates });\n\n const { isLoading: isLoadingData, data } = useQuery(\n ['users-permissions', 'email-templates'],\n async () => {\n const { data } = await get('/users-permissions/email-templates');\n\n return data;\n },\n {\n onSuccess() {\n notifyStatus(\n formatMessage({\n id: getTrad('Email.template.data.loaded'),\n defaultMessage: 'Email templates has been loaded',\n })\n );\n },\n onError(error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n },\n }\n );\n\n const isLoading = isLoadingForPermissions || isLoadingData;\n\n const handleToggle = () => {\n setIsModalOpen((prev) => !prev);\n };\n\n const handleEditClick = (template) => {\n setTemplateToEdit(template);\n handleToggle();\n };\n\n const submitMutation = useMutation(\n (body) => put('/users-permissions/email-templates', { 'email-templates': body }),\n {\n async onSuccess() {\n await queryClient.invalidateQueries(['users-permissions', 'email-templates']);\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'notification.success.saved', defaultMessage: 'Saved' }),\n });\n\n trackUsage('didEditEmailTemplates');\n\n handleToggle();\n },\n onError(error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n },\n refetchActive: true,\n }\n );\n\n const handleSubmit = (body) => {\n trackUsage('willEditEmailTemplates');\n\n const editedTemplates = { ...data, [templateToEdit]: body };\n submitMutation.mutate(editedTemplates);\n };\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n return (\n <Page.Main aria-busy={submitMutation.isLoading}>\n <Page.Title>\n {formatMessage(\n { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },\n {\n name: formatMessage({\n id: getTrad('HeaderNav.link.emailTemplates'),\n defaultMessage: 'Email templates',\n }),\n }\n )}\n </Page.Title>\n <Layouts.Header\n title={formatMessage({\n id: getTrad('HeaderNav.link.emailTemplates'),\n defaultMessage: 'Email templates',\n })}\n />\n <Layouts.Content>\n <EmailTable onEditClick={handleEditClick} canUpdate={canUpdate} />\n <EmailForm\n template={data[templateToEdit]}\n onToggle={handleToggle}\n open={isModalOpen}\n onSubmit={handleSubmit}\n />\n </Layouts.Content>\n </Page.Main>\n );\n};\n\nexport { ProtectedEmailTemplatesPage, EmailTemplatesPage };\n"],"names":["ProtectedEmailTemplatesPage","_jsx","Page","Protect","permissions","PERMISSIONS","readEmailTemplates","EmailTemplatesPage","formatMessage","useIntl","trackUsage","useTracking","notifyStatus","useNotifyAT","toggleNotification","useNotification","queryClient","useQueryClient","get","put","useFetchClient","formatAPIError","useAPIErrorHandler","isModalOpen","setIsModalOpen","React","useState","templateToEdit","setTemplateToEdit","isLoading","isLoadingForPermissions","allowedActions","canUpdate","useRBAC","update","updateEmailTemplates","isLoadingData","data","useQuery","onSuccess","id","getTrad","defaultMessage","onError","error","type","message","handleToggle","prev","handLine truncated
@@ -0,0 +1,50 @@
'use strict';
var admin = require('@strapi/strapi/admin');
var yup = require('yup');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
const schema = yup__namespace.object().shape({
options: yup__namespace.object().shape({
from: yup__namespace.object().shape({
name: yup__namespace.string().required({
id: admin.translatedErrors.required.id,
defaultMessage: 'This field is required'
}),
email: yup__namespace.string().email(admin.translatedErrors.email).required({
id: admin.translatedErrors.required.id,
defaultMessage: 'This field is required'
})
}).required(),
response_email: yup__namespace.string().email(admin.translatedErrors.email),
object: yup__namespace.string().required({
id: admin.translatedErrors.required.id,
defaultMessage: 'This field is required'
}),
message: yup__namespace.string().required({
id: admin.translatedErrors.required.id,
defaultMessage: 'This field is required'
})
}).required(admin.translatedErrors.required.id)
});
module.exports = schema;
//# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
{"version":3,"file":"schema.js","sources":["../../../../../admin/src/pages/EmailTemplates/utils/schema.js"],"sourcesContent":["import { translatedErrors } from '@strapi/strapi/admin';\nimport * as yup from 'yup';\n\nconst schema = yup.object().shape({\n options: yup\n .object()\n .shape({\n from: yup\n .object()\n .shape({\n name: yup.string().required({\n id: translatedErrors.required.id,\n defaultMessage: 'This field is required',\n }),\n email: yup.string().email(translatedErrors.email).required({\n id: translatedErrors.required.id,\n defaultMessage: 'This field is required',\n }),\n })\n .required(),\n response_email: yup.string().email(translatedErrors.email),\n object: yup.string().required({\n id: translatedErrors.required.id,\n defaultMessage: 'This field is required',\n }),\n message: yup.string().required({\n id: translatedErrors.required.id,\n defaultMessage: 'This field is required',\n }),\n })\n .required(translatedErrors.required.id),\n});\n\nexport default schema;\n"],"names":["schema","yup","object","shape","options","from","name","string","required","id","translatedErrors","defaultMessage","email","response_email","message"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,MAASC,GAAAA,cAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AAChCC,IAAAA,OAAAA,EAASH,cACNC,CAAAA,MAAM,EACNC,CAAAA,KAAK,CAAC;AACLE,QAAAA,IAAAA,EAAMJ,cACHC,CAAAA,MAAM,EACNC,CAAAA,KAAK,CAAC;AACLG,YAAAA,IAAAA,EAAML,cAAIM,CAAAA,MAAM,EAAGC,CAAAA,QAAQ,CAAC;gBAC1BC,EAAIC,EAAAA,sBAAAA,CAAiBF,QAAQ,CAACC,EAAE;gBAChCE,cAAgB,EAAA;AAClB,aAAA,CAAA;YACAC,KAAOX,EAAAA,cAAAA,CAAIM,MAAM,EAAGK,CAAAA,KAAK,CAACF,sBAAiBE,CAAAA,KAAK,CAAEJ,CAAAA,QAAQ,CAAC;gBACzDC,EAAIC,EAAAA,sBAAAA,CAAiBF,QAAQ,CAACC,EAAE;gBAChCE,cAAgB,EAAA;AAClB,aAAA;AACF,SAAA,CAAA,CACCH,QAAQ,EAAA;AACXK,QAAAA,cAAAA,EAAgBZ,eAAIM,MAAM,EAAA,CAAGK,KAAK,CAACF,uBAAiBE,KAAK,CAAA;AACzDV,QAAAA,MAAAA,EAAQD,cAAIM,CAAAA,MAAM,EAAGC,CAAAA,QAAQ,CAAC;YAC5BC,EAAIC,EAAAA,sBAAAA,CAAiBF,QAAQ,CAACC,EAAE;YAChCE,cAAgB,EAAA;AAClB,SAAA,CAAA;AACAG,QAAAA,OAAAA,EAASb,cAAIM,CAAAA,MAAM,EAAGC,CAAAA,QAAQ,CAAC;YAC7BC,EAAIC,EAAAA,sBAAAA,CAAiBF,QAAQ,CAACC,EAAE;YAChCE,cAAgB,EAAA;AAClB,SAAA;AACF,KAAA,CAAA,CACCH,QAAQ,CAACE,sBAAiBF,CAAAA,QAAQ,CAACC,EAAE;AAC1C,CAAA;;;;"}
@@ -0,0 +1,29 @@
import { translatedErrors } from '@strapi/strapi/admin';
import * as yup from 'yup';
const schema = yup.object().shape({
options: yup.object().shape({
from: yup.object().shape({
name: yup.string().required({
id: translatedErrors.required.id,
defaultMessage: 'This field is required'
}),
email: yup.string().email(translatedErrors.email).required({
id: translatedErrors.required.id,
defaultMessage: 'This field is required'
})
}).required(),
response_email: yup.string().email(translatedErrors.email),
object: yup.string().required({
id: translatedErrors.required.id,
defaultMessage: 'This field is required'
}),
message: yup.string().required({
id: translatedErrors.required.id,
defaultMessage: 'This field is required'
})
}).required(translatedErrors.required.id)
});
export { schema as default };
//# sourceMappingURL=schema.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"schema.mjs","sources":["../../../../../admin/src/pages/EmailTemplates/utils/schema.js"],"sourcesContent":["import { translatedErrors } from '@strapi/strapi/admin';\nimport * as yup from 'yup';\n\nconst schema = yup.object().shape({\n options: yup\n .object()\n .shape({\n from: yup\n .object()\n .shape({\n name: yup.string().required({\n id: translatedErrors.required.id,\n defaultMessage: 'This field is required',\n }),\n email: yup.string().email(translatedErrors.email).required({\n id: translatedErrors.required.id,\n defaultMessage: 'This field is required',\n }),\n })\n .required(),\n response_email: yup.string().email(translatedErrors.email),\n object: yup.string().required({\n id: translatedErrors.required.id,\n defaultMessage: 'This field is required',\n }),\n message: yup.string().required({\n id: translatedErrors.required.id,\n defaultMessage: 'This field is required',\n }),\n })\n .required(translatedErrors.required.id),\n});\n\nexport default schema;\n"],"names":["schema","yup","object","shape","options","from","name","string","required","id","translatedErrors","defaultMessage","email","response_email","message"],"mappings":";;;AAGA,MAAMA,MAASC,GAAAA,GAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AAChCC,IAAAA,OAAAA,EAASH,GACNC,CAAAA,MAAM,EACNC,CAAAA,KAAK,CAAC;AACLE,QAAAA,IAAAA,EAAMJ,GACHC,CAAAA,MAAM,EACNC,CAAAA,KAAK,CAAC;AACLG,YAAAA,IAAAA,EAAML,GAAIM,CAAAA,MAAM,EAAGC,CAAAA,QAAQ,CAAC;gBAC1BC,EAAIC,EAAAA,gBAAAA,CAAiBF,QAAQ,CAACC,EAAE;gBAChCE,cAAgB,EAAA;AAClB,aAAA,CAAA;YACAC,KAAOX,EAAAA,GAAAA,CAAIM,MAAM,EAAGK,CAAAA,KAAK,CAACF,gBAAiBE,CAAAA,KAAK,CAAEJ,CAAAA,QAAQ,CAAC;gBACzDC,EAAIC,EAAAA,gBAAAA,CAAiBF,QAAQ,CAACC,EAAE;gBAChCE,cAAgB,EAAA;AAClB,aAAA;AACF,SAAA,CAAA,CACCH,QAAQ,EAAA;AACXK,QAAAA,cAAAA,EAAgBZ,IAAIM,MAAM,EAAA,CAAGK,KAAK,CAACF,iBAAiBE,KAAK,CAAA;AACzDV,QAAAA,MAAAA,EAAQD,GAAIM,CAAAA,MAAM,EAAGC,CAAAA,QAAQ,CAAC;YAC5BC,EAAIC,EAAAA,gBAAAA,CAAiBF,QAAQ,CAACC,EAAE;YAChCE,cAAgB,EAAA;AAClB,SAAA,CAAA;AACAG,QAAAA,OAAAA,EAASb,GAAIM,CAAAA,MAAM,EAAGC,CAAAA,QAAQ,CAAC;YAC7BC,EAAIC,EAAAA,gBAAAA,CAAiBF,QAAQ,CAACC,EAAE;YAChCE,cAAgB,EAAA;AAClB,SAAA;AACF,KAAA,CAAA,CACCH,QAAQ,CAACE,gBAAiBF,CAAAA,QAAQ,CAACC,EAAE;AAC1C,CAAA;;;;"}