@webiny/app-mailer 5.43.2-beta.0 → 6.0.0-alpha.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/hooks/usePermission.js +10 -15
- package/hooks/usePermission.js.map +1 -1
- package/index.js +2 -12
- package/index.js.map +1 -1
- package/package.json +9 -10
- package/plugins/Module.js +45 -51
- package/plugins/Module.js.map +1 -1
- package/types.js +1 -5
- package/views/settings/Settings.js +161 -169
- package/views/settings/Settings.js.map +1 -1
- package/views/settings/graphql.js +37 -14
- package/views/settings/graphql.js.map +1 -1
- package/views/settings/index.js +2 -8
- package/views/settings/index.js.map +1 -1
package/hooks/usePermission.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _useSecurity = (0, _appSecurity.useSecurity)(),
|
|
11
|
-
identity = _useSecurity.identity,
|
|
12
|
-
getPermission = _useSecurity.getPermission;
|
|
13
|
-
var canChangeSettings = (0, _react.useCallback)(function () {
|
|
14
|
-
var permission = getPermission("mailer.settings");
|
|
1
|
+
import { useSecurity } from "@webiny/app-security";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
export const usePermission = () => {
|
|
4
|
+
const {
|
|
5
|
+
identity,
|
|
6
|
+
getPermission
|
|
7
|
+
} = useSecurity();
|
|
8
|
+
const canChangeSettings = useCallback(() => {
|
|
9
|
+
const permission = getPermission("mailer.settings");
|
|
15
10
|
return !!permission;
|
|
16
11
|
}, [identity]);
|
|
17
12
|
return {
|
|
18
|
-
canChangeSettings
|
|
13
|
+
canChangeSettings
|
|
19
14
|
};
|
|
20
15
|
};
|
|
21
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useSecurity","useCallback","usePermission","identity","getPermission","canChangeSettings","permission"],"sources":["usePermission.ts"],"sourcesContent":["import { useSecurity } from \"@webiny/app-security\";\nimport { useCallback } from \"react\";\nimport { MailerSecurityPermission } from \"~/types\";\n\nexport const usePermission = () => {\n const { identity, getPermission } = useSecurity();\n\n const canChangeSettings = useCallback((): boolean => {\n const permission = getPermission<MailerSecurityPermission>(\"mailer.settings\");\n return !!permission;\n }, [identity]);\n\n return {\n canChangeSettings\n };\n};\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,sBAAsB;AAClD,SAASC,WAAW,QAAQ,OAAO;AAGnC,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAGJ,WAAW,CAAC,CAAC;EAEjD,MAAMK,iBAAiB,GAAGJ,WAAW,CAAC,MAAe;IACjD,MAAMK,UAAU,GAAGF,aAAa,CAA2B,iBAAiB,CAAC;IAC7E,OAAO,CAAC,CAACE,UAAU;EACvB,CAAC,EAAE,CAACH,QAAQ,CAAC,CAAC;EAEd,OAAO;IACHE;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
|
package/index.js
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Module", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Module.Module;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _Module = require("./plugins/Module");
|
|
1
|
+
import { Module } from "./plugins/Module";
|
|
2
|
+
export { Module };
|
|
13
3
|
|
|
14
4
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Module"],"sources":["index.tsx"],"sourcesContent":["import { Module } from \"~/plugins/Module\";\n\nexport { Module };\n"],"mappings":"AAAA,SAASA,MAAM;AAEf,SAASA,MAAM","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-mailer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@apollo/react-components": "3.1.5",
|
|
13
|
-
"@
|
|
14
|
-
"@webiny/app-admin": "
|
|
15
|
-
"@webiny/app-security": "
|
|
16
|
-
"@webiny/form": "
|
|
17
|
-
"@webiny/ui": "
|
|
18
|
-
"@webiny/validation": "
|
|
13
|
+
"@webiny/admin-ui": "6.0.0-alpha.0",
|
|
14
|
+
"@webiny/app-admin": "6.0.0-alpha.0",
|
|
15
|
+
"@webiny/app-security": "6.0.0-alpha.0",
|
|
16
|
+
"@webiny/form": "6.0.0-alpha.0",
|
|
17
|
+
"@webiny/ui": "6.0.0-alpha.0",
|
|
18
|
+
"@webiny/validation": "6.0.0-alpha.0",
|
|
19
19
|
"apollo-cache": "1.3.5",
|
|
20
20
|
"apollo-client": "2.6.10",
|
|
21
21
|
"apollo-link": "1.2.14",
|
|
@@ -29,9 +29,8 @@
|
|
|
29
29
|
"react-helmet": "6.1.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@emotion/babel-plugin": "11.11.0",
|
|
33
32
|
"@types/react": "18.2.79",
|
|
34
|
-
"@webiny/project-utils": "
|
|
33
|
+
"@webiny/project-utils": "6.0.0-alpha.0",
|
|
35
34
|
"rimraf": "6.0.1",
|
|
36
35
|
"typescript": "5.3.3"
|
|
37
36
|
},
|
|
@@ -48,5 +47,5 @@
|
|
|
48
47
|
"removeViewBox": false
|
|
49
48
|
}
|
|
50
49
|
},
|
|
51
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "a5b28fed7a242d8f56712197a8ea83aa6d2ed101"
|
|
52
51
|
}
|
package/plugins/Module.js
CHANGED
|
@@ -1,60 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
24
|
-
return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
25
|
-
fallback: /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, null)
|
|
26
|
-
}, /*#__PURE__*/_react.default.cloneElement(children, props));
|
|
27
|
-
};
|
|
28
|
-
var MailerSettings = function MailerSettings() {
|
|
29
|
-
var _usePermission = (0, _usePermission2.usePermission)(),
|
|
30
|
-
canChangeSettings = _usePermission.canChangeSettings;
|
|
31
|
-
var changeSettings = canChangeSettings();
|
|
1
|
+
import React, { lazy, Suspense } from "react";
|
|
2
|
+
import { AdminConfig, Plugins, Layout } from "@webiny/app-admin";
|
|
3
|
+
import { HasPermission } from "@webiny/app-security";
|
|
4
|
+
import Helmet from "react-helmet";
|
|
5
|
+
import { usePermission } from "../hooks/usePermission";
|
|
6
|
+
import { CircularProgress } from "@webiny/ui/Progress";
|
|
7
|
+
const {
|
|
8
|
+
Menu,
|
|
9
|
+
Route
|
|
10
|
+
} = AdminConfig;
|
|
11
|
+
const Settings = /*#__PURE__*/lazy(() => import(/* webpackChunkName: "MailerModuleSettings" */"../views/settings"));
|
|
12
|
+
const Loader = ({
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}) => /*#__PURE__*/React.createElement(Suspense, {
|
|
16
|
+
fallback: /*#__PURE__*/React.createElement(CircularProgress, null)
|
|
17
|
+
}, /*#__PURE__*/React.cloneElement(children, props));
|
|
18
|
+
const MailerSettings = () => {
|
|
19
|
+
const {
|
|
20
|
+
canChangeSettings
|
|
21
|
+
} = usePermission();
|
|
22
|
+
const changeSettings = canChangeSettings();
|
|
32
23
|
if (!changeSettings) {
|
|
33
24
|
return null;
|
|
34
25
|
}
|
|
35
|
-
return /*#__PURE__*/
|
|
36
|
-
name: "settings"
|
|
37
|
-
}, /*#__PURE__*/
|
|
38
|
-
name: "settings
|
|
39
|
-
label: "Mailer"
|
|
40
|
-
}, /*#__PURE__*/_react.default.createElement(_appAdmin.AddMenu, {
|
|
41
|
-
name: "settings.mailer.settings",
|
|
42
|
-
label: "Settings",
|
|
43
|
-
path: "/mailer/settings"
|
|
44
|
-
}))), /*#__PURE__*/_react.default.createElement(_appAdmin.AddRoute, {
|
|
26
|
+
return /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(HasPermission, {
|
|
27
|
+
name: "mailer.settings"
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Route, {
|
|
29
|
+
name: "mailer.settings",
|
|
45
30
|
exact: true,
|
|
46
31
|
path: "/mailer/settings",
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
32
|
+
element: /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Helmet, {
|
|
33
|
+
title: "Mailer - Settings"
|
|
34
|
+
}), /*#__PURE__*/React.createElement(Loader, null, /*#__PURE__*/React.createElement(Settings, null)))
|
|
35
|
+
}), /*#__PURE__*/React.createElement(Menu, {
|
|
36
|
+
name: "mailer.settings",
|
|
37
|
+
parent: "settings",
|
|
38
|
+
element: /*#__PURE__*/React.createElement(Menu.Group, {
|
|
39
|
+
text: "Mailer"
|
|
40
|
+
})
|
|
41
|
+
}), /*#__PURE__*/React.createElement(Menu, {
|
|
42
|
+
name: "mailer.settings.general",
|
|
43
|
+
parent: "settings",
|
|
44
|
+
element: /*#__PURE__*/React.createElement(Menu.Link, {
|
|
45
|
+
text: "Settings",
|
|
46
|
+
to: "/mailer/settings"
|
|
47
|
+
})
|
|
48
|
+
})));
|
|
55
49
|
};
|
|
56
|
-
|
|
57
|
-
return /*#__PURE__*/
|
|
50
|
+
export const Module = () => {
|
|
51
|
+
return /*#__PURE__*/React.createElement(Plugins, null, /*#__PURE__*/React.createElement(MailerSettings, null));
|
|
58
52
|
};
|
|
59
53
|
|
|
60
54
|
//# sourceMappingURL=Module.js.map
|
package/plugins/Module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","lazy","Suspense","AdminConfig","Plugins","Layout","HasPermission","Helmet","usePermission","CircularProgress","Menu","Route","Settings","Loader","children","props","createElement","fallback","cloneElement","MailerSettings","canChangeSettings","changeSettings","name","exact","path","element","title","parent","Group","text","Link","to","Module"],"sources":["Module.tsx"],"sourcesContent":["import React, { lazy, Suspense } from \"react\";\nimport { AdminConfig, Plugins, Layout } from \"@webiny/app-admin\";\nimport { HasPermission } from \"@webiny/app-security\";\nimport Helmet from \"react-helmet\";\nimport { usePermission } from \"~/hooks/usePermission\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\n\nconst { Menu, Route } = AdminConfig;\n\nconst Settings = lazy(\n () =>\n import(\n /* webpackChunkName: \"MailerModuleSettings\" */\n \"~/views/settings\"\n )\n);\n\ninterface LoaderProps {\n children: React.ReactElement;\n}\n\nconst Loader = ({ children, ...props }: LoaderProps) => (\n <Suspense fallback={<CircularProgress />}>{React.cloneElement(children, props)}</Suspense>\n);\n\nconst MailerSettings = () => {\n const { canChangeSettings } = usePermission();\n\n const changeSettings = canChangeSettings();\n\n if (!changeSettings) {\n return null;\n }\n\n return (\n <AdminConfig>\n <HasPermission name={\"mailer.settings\"}>\n <Route\n name={\"mailer.settings\"}\n exact\n path={\"/mailer/settings\"}\n element={\n <Layout>\n <Helmet title={\"Mailer - Settings\"} />\n <Loader>\n <Settings />\n </Loader>\n </Layout>\n }\n />\n <Menu\n name={\"mailer.settings\"}\n parent={\"settings\"}\n element={<Menu.Group text={\"Mailer\"} />}\n />\n <Menu\n name={\"mailer.settings.general\"}\n parent={\"settings\"}\n element={<Menu.Link text={\"Settings\"} to={\"/mailer/settings\"} />}\n />\n </HasPermission>\n </AdminConfig>\n );\n};\n\nexport const Module = () => {\n return (\n <Plugins>\n <MailerSettings />\n </Plugins>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAC7C,SAASC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,mBAAmB;AAChE,SAASC,aAAa,QAAQ,sBAAsB;AACpD,OAAOC,MAAM,MAAM,cAAc;AACjC,SAASC,aAAa;AACtB,SAASC,gBAAgB,QAAQ,qBAAqB;AAEtD,MAAM;EAAEC,IAAI;EAAEC;AAAM,CAAC,GAAGR,WAAW;AAEnC,MAAMS,QAAQ,gBAAGX,IAAI,CACjB,MACI,MAAM,CACF,iEAEJ,CACR,CAAC;AAMD,MAAMY,MAAM,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAmB,CAAC,kBAC/Cf,KAAA,CAAAgB,aAAA,CAACd,QAAQ;EAACe,QAAQ,eAAEjB,KAAA,CAAAgB,aAAA,CAACP,gBAAgB,MAAE;AAAE,gBAAET,KAAK,CAACkB,YAAY,CAACJ,QAAQ,EAAEC,KAAK,CAAY,CAC5F;AAED,MAAMI,cAAc,GAAGA,CAAA,KAAM;EACzB,MAAM;IAAEC;EAAkB,CAAC,GAAGZ,aAAa,CAAC,CAAC;EAE7C,MAAMa,cAAc,GAAGD,iBAAiB,CAAC,CAAC;EAE1C,IAAI,CAACC,cAAc,EAAE;IACjB,OAAO,IAAI;EACf;EAEA,oBACIrB,KAAA,CAAAg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|
|
10
|
-
|
|
11
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _appAdmin = require("@webiny/app-admin");
|
|
13
|
-
var _reactComponents = require("@apollo/react-components");
|
|
14
|
-
var _form = require("@webiny/form");
|
|
15
|
-
var _SimpleForm = require("@webiny/app-admin/components/SimpleForm");
|
|
16
|
-
var _Progress = require("@webiny/ui/Progress");
|
|
17
|
-
var _Grid = require("@webiny/ui/Grid");
|
|
18
|
-
var _Input = require("@webiny/ui/Input");
|
|
19
|
-
var _validation = require("@webiny/validation");
|
|
20
|
-
var _Button = require("@webiny/ui/Button");
|
|
21
|
-
var _graphql = require("./graphql");
|
|
22
|
-
var _Alert = require("@webiny/ui/Alert");
|
|
23
|
-
var _dotPropImmutable = _interopRequireDefault(require("dot-prop-immutable"));
|
|
24
|
-
var displayErrors = function displayErrors(errors) {
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { CenteredView, useSnackbar } from "@webiny/app-admin";
|
|
3
|
+
import { Mutation, Query } from "@apollo/react-components";
|
|
4
|
+
import { Form } from "@webiny/form";
|
|
5
|
+
import { SimpleForm, SimpleFormContent, SimpleFormFooter, SimpleFormHeader } from "@webiny/app-admin/components/SimpleForm";
|
|
6
|
+
import { validation } from "@webiny/validation";
|
|
7
|
+
import { GET_SETTINGS_QUERY, SAVE_SETTINGS_MUTATION } from "./graphql";
|
|
8
|
+
import dotPropImmutable from "dot-prop-immutable";
|
|
9
|
+
import { Alert, Button, Grid, Input, OverlayLoader } from "@webiny/admin-ui";
|
|
10
|
+
const displayErrors = errors => {
|
|
25
11
|
if (!errors) {
|
|
26
12
|
return null;
|
|
27
13
|
}
|
|
28
|
-
return /*#__PURE__*/
|
|
29
|
-
|
|
14
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, errors.map(error => {
|
|
15
|
+
const field = error.path[0];
|
|
30
16
|
if (!field) {
|
|
31
17
|
return null;
|
|
32
18
|
}
|
|
33
|
-
return /*#__PURE__*/
|
|
34
|
-
key:
|
|
35
|
-
title:
|
|
19
|
+
return /*#__PURE__*/React.createElement(Alert, {
|
|
20
|
+
key: `${field}`,
|
|
21
|
+
title: "Error",
|
|
36
22
|
type: "danger"
|
|
37
|
-
});
|
|
23
|
+
}, error.message, "ssss");
|
|
38
24
|
}));
|
|
39
25
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
showSnackbar
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
(0, _react.useEffect)(function () {
|
|
49
|
-
var t = setTimeout(function () {
|
|
26
|
+
export const Settings = () => {
|
|
27
|
+
const {
|
|
28
|
+
showSnackbar
|
|
29
|
+
} = useSnackbar();
|
|
30
|
+
const password = useRef();
|
|
31
|
+
const [errors, setErrors] = useState();
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const t = setTimeout(() => {
|
|
50
34
|
if (!password.current) {
|
|
51
35
|
return;
|
|
52
36
|
}
|
|
53
37
|
password.current.value = "";
|
|
54
38
|
}, 300);
|
|
55
|
-
return
|
|
39
|
+
return () => {
|
|
56
40
|
clearTimeout(t);
|
|
57
41
|
};
|
|
58
42
|
}, []);
|
|
59
|
-
return /*#__PURE__*/
|
|
60
|
-
query:
|
|
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
|
-
showSnackbar("Settings updated successfully.");
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
if (settingsError) {
|
|
99
|
-
return /*#__PURE__*/_react.default.createElement(_appAdmin.CenteredView, null, /*#__PURE__*/_react.default.createElement(_SimpleForm.SimpleFormHeader, {
|
|
100
|
-
title: "Mailer Settings"
|
|
101
|
-
}), /*#__PURE__*/_react.default.createElement(_Grid.Grid, {
|
|
102
|
-
style: {
|
|
103
|
-
backgroundColor: "#FFFFFF"
|
|
43
|
+
return /*#__PURE__*/React.createElement(Query, {
|
|
44
|
+
query: GET_SETTINGS_QUERY
|
|
45
|
+
}, ({
|
|
46
|
+
data: response,
|
|
47
|
+
loading: queryInProgress
|
|
48
|
+
}) => /*#__PURE__*/React.createElement(Mutation, {
|
|
49
|
+
mutation: SAVE_SETTINGS_MUTATION
|
|
50
|
+
}, (update, result) => {
|
|
51
|
+
const {
|
|
52
|
+
data: settingsData,
|
|
53
|
+
error: settingsError
|
|
54
|
+
} = response?.mailer.settings || {};
|
|
55
|
+
const {
|
|
56
|
+
loading: mutationInProgress
|
|
57
|
+
} = result;
|
|
58
|
+
const onSubmit = async data => {
|
|
59
|
+
setErrors([]);
|
|
60
|
+
await update({
|
|
61
|
+
variables: {
|
|
62
|
+
data
|
|
63
|
+
},
|
|
64
|
+
update: (cache, result) => {
|
|
65
|
+
const data = structuredClone(cache.readQuery({
|
|
66
|
+
query: GET_SETTINGS_QUERY
|
|
67
|
+
}));
|
|
68
|
+
const {
|
|
69
|
+
data: updateData,
|
|
70
|
+
error: updateError
|
|
71
|
+
} = result.data?.mailer.settings || {};
|
|
72
|
+
const errors = updateError?.data.errors;
|
|
73
|
+
if (errors) {
|
|
74
|
+
setErrors(errors);
|
|
75
|
+
showSnackbar("Settings not updated! Please check your network and console logs for detailed information.");
|
|
76
|
+
return;
|
|
104
77
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
78
|
+
cache.writeQuery({
|
|
79
|
+
query: GET_SETTINGS_QUERY,
|
|
80
|
+
data: dotPropImmutable.set(data, "mailer.settings.data", {
|
|
81
|
+
...settingsData,
|
|
82
|
+
...updateData
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
showSnackbar("Settings updated successfully.");
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
if (settingsError) {
|
|
90
|
+
return /*#__PURE__*/React.createElement(SimpleForm, null, /*#__PURE__*/React.createElement(SimpleFormHeader, {
|
|
91
|
+
title: "Mailer Settings"
|
|
92
|
+
}), /*#__PURE__*/React.createElement(SimpleFormContent, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
93
|
+
span: 12
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Alert, {
|
|
95
|
+
title: settingsError.message,
|
|
96
|
+
type: "danger"
|
|
97
|
+
}, settingsError.data?.description && /*#__PURE__*/React.createElement("p", null, settingsError.data.description))))), /*#__PURE__*/React.createElement(SimpleFormFooter, null, ""));
|
|
98
|
+
}
|
|
99
|
+
const passwordValidators = [];
|
|
100
|
+
if (!settingsData?.user) {
|
|
101
|
+
passwordValidators.push(validation.create("required,minLength:5"));
|
|
102
|
+
}
|
|
103
|
+
return /*#__PURE__*/React.createElement(CenteredView, null, /*#__PURE__*/React.createElement(Form, {
|
|
104
|
+
data: settingsData || {},
|
|
105
|
+
onSubmit: data => {
|
|
106
|
+
/**
|
|
107
|
+
* We are positive that data is TransportSettings.
|
|
108
|
+
*/
|
|
109
|
+
onSubmit(data);
|
|
111
110
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
}, ({
|
|
112
|
+
Bind,
|
|
113
|
+
form
|
|
114
|
+
}) => /*#__PURE__*/React.createElement(SimpleForm, null, (queryInProgress || mutationInProgress) && /*#__PURE__*/React.createElement(OverlayLoader, null), /*#__PURE__*/React.createElement(SimpleFormHeader, {
|
|
115
|
+
title: "Mailer Settings"
|
|
116
|
+
}), /*#__PURE__*/React.createElement(SimpleFormContent, null, displayErrors(errors), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
117
|
+
span: 12
|
|
118
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
119
|
+
name: "host",
|
|
120
|
+
validators: [validation.create("required,minLength:1")]
|
|
121
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
122
|
+
size: "lg",
|
|
123
|
+
type: "text",
|
|
124
|
+
label: "Hostname"
|
|
125
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
126
|
+
span: 12
|
|
127
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
128
|
+
name: "port"
|
|
129
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
130
|
+
size: "lg",
|
|
131
|
+
type: "number",
|
|
132
|
+
label: "Port"
|
|
133
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
134
|
+
span: 12
|
|
135
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
136
|
+
name: "user",
|
|
137
|
+
validators: [validation.create("required,minLength:1")]
|
|
138
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
139
|
+
size: "lg",
|
|
140
|
+
type: "text",
|
|
141
|
+
label: "User",
|
|
142
|
+
autoComplete: "new-password"
|
|
143
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
144
|
+
span: 12
|
|
145
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
146
|
+
name: "password",
|
|
147
|
+
validators: passwordValidators
|
|
148
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
149
|
+
size: "lg",
|
|
150
|
+
label: "Password",
|
|
151
|
+
type: "password",
|
|
152
|
+
autoComplete: "new-password",
|
|
153
|
+
value: ""
|
|
154
|
+
// @ts-expect-error
|
|
155
|
+
,
|
|
156
|
+
inputRef: password
|
|
157
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
158
|
+
span: 12
|
|
159
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
160
|
+
name: "from",
|
|
161
|
+
validators: [validation.create("required,minLength:1,email")]
|
|
162
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
163
|
+
size: "lg",
|
|
164
|
+
type: "text",
|
|
165
|
+
label: "Mail from"
|
|
166
|
+
}))), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
167
|
+
span: 12
|
|
168
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
169
|
+
name: "replyTo",
|
|
170
|
+
validators: [validation.create("email")]
|
|
171
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
172
|
+
size: "lg",
|
|
173
|
+
type: "text",
|
|
174
|
+
label: "Mail reply-to"
|
|
175
|
+
}))))), /*#__PURE__*/React.createElement(SimpleFormFooter, null, /*#__PURE__*/React.createElement(Button, {
|
|
176
|
+
text: "Save",
|
|
177
|
+
onClick: ev => {
|
|
178
|
+
form.submit(ev);
|
|
115
179
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
onSubmit: function onSubmit(data) {
|
|
119
|
-
/**
|
|
120
|
-
* We are positive that data is TransportSettings.
|
|
121
|
-
*/
|
|
122
|
-
_onSubmit(data);
|
|
123
|
-
}
|
|
124
|
-
}, function (_ref4) {
|
|
125
|
-
var Bind = _ref4.Bind,
|
|
126
|
-
form = _ref4.form;
|
|
127
|
-
return /*#__PURE__*/_react.default.createElement(_SimpleForm.SimpleForm, null, (queryInProgress || mutationInProgress) && /*#__PURE__*/_react.default.createElement(_Progress.CircularProgress, null), /*#__PURE__*/_react.default.createElement(_SimpleForm.SimpleFormHeader, {
|
|
128
|
-
title: "Mailer Settings"
|
|
129
|
-
}), /*#__PURE__*/_react.default.createElement(_SimpleForm.SimpleFormContent, null, displayErrors(errors), /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
130
|
-
span: 12
|
|
131
|
-
}, /*#__PURE__*/_react.default.createElement(Bind, {
|
|
132
|
-
name: "host",
|
|
133
|
-
validators: [_validation.validation.create("required,minLength:1")]
|
|
134
|
-
}, /*#__PURE__*/_react.default.createElement(_Input.Input, {
|
|
135
|
-
type: "text",
|
|
136
|
-
label: "Hostname"
|
|
137
|
-
}))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
138
|
-
span: 12
|
|
139
|
-
}, /*#__PURE__*/_react.default.createElement(Bind, {
|
|
140
|
-
name: "port"
|
|
141
|
-
}, /*#__PURE__*/_react.default.createElement(_Input.Input, {
|
|
142
|
-
type: "number",
|
|
143
|
-
label: "Port"
|
|
144
|
-
}))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
145
|
-
span: 12
|
|
146
|
-
}, /*#__PURE__*/_react.default.createElement(Bind, {
|
|
147
|
-
name: "user",
|
|
148
|
-
validators: [_validation.validation.create("required,minLength:1")]
|
|
149
|
-
}, /*#__PURE__*/_react.default.createElement(_Input.Input, {
|
|
150
|
-
type: "text",
|
|
151
|
-
label: "User",
|
|
152
|
-
autoComplete: "new-password"
|
|
153
|
-
}))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
154
|
-
span: 12
|
|
155
|
-
}, /*#__PURE__*/_react.default.createElement(Bind, {
|
|
156
|
-
name: "password",
|
|
157
|
-
validators: passwordValidators
|
|
158
|
-
}, /*#__PURE__*/_react.default.createElement(_Input.Input, {
|
|
159
|
-
label: "Password",
|
|
160
|
-
type: "password",
|
|
161
|
-
autoComplete: "new-password",
|
|
162
|
-
value: ""
|
|
163
|
-
// @ts-expect-error
|
|
164
|
-
,
|
|
165
|
-
inputRef: password
|
|
166
|
-
}))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
167
|
-
span: 12
|
|
168
|
-
}, /*#__PURE__*/_react.default.createElement(Bind, {
|
|
169
|
-
name: "from",
|
|
170
|
-
validators: [_validation.validation.create("required,minLength:1,email")]
|
|
171
|
-
}, /*#__PURE__*/_react.default.createElement(_Input.Input, {
|
|
172
|
-
type: "text",
|
|
173
|
-
label: "Mail from"
|
|
174
|
-
}))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
175
|
-
span: 12
|
|
176
|
-
}, /*#__PURE__*/_react.default.createElement(Bind, {
|
|
177
|
-
name: "replyTo",
|
|
178
|
-
validators: [_validation.validation.create("email")]
|
|
179
|
-
}, /*#__PURE__*/_react.default.createElement(_Input.Input, {
|
|
180
|
-
type: "text",
|
|
181
|
-
label: "Mail reply-to"
|
|
182
|
-
}))))), /*#__PURE__*/_react.default.createElement(_SimpleForm.SimpleFormFooter, null, /*#__PURE__*/_react.default.createElement(_Button.ButtonPrimary, {
|
|
183
|
-
onClick: function onClick(ev) {
|
|
184
|
-
form.submit(ev);
|
|
185
|
-
}
|
|
186
|
-
}, "Save Settings")));
|
|
187
|
-
}));
|
|
188
|
-
});
|
|
189
|
-
});
|
|
180
|
+
})))));
|
|
181
|
+
}));
|
|
190
182
|
};
|
|
191
183
|
|
|
192
184
|
//# sourceMappingURL=Settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_appAdmin","_reactComponents","_form","_SimpleForm","_Progress","_Grid","_Input","_validation","_Button","_graphql","_Alert","_dotPropImmutable","_interopRequireDefault","displayErrors","errors","default","createElement","Fragment","map","error","field","path","Alert","key","concat","title","message","type","Settings","exports","_useSnackbar","useSnackbar","showSnackbar","password","useRef","_useState","useState","_useState2","_slicedToArray2","setErrors","useEffect","t","setTimeout","current","value","clearTimeout","Query","query","GET_SETTINGS_QUERY","_ref","response","data","queryInProgress","loading","Mutation","mutation","SAVE_SETTINGS_MUTATION","update","result","_ref2","mailer","settings","settingsData","settingsError","mutationInProgress","onSubmit","variables","cache","structuredClone","readQuery","_ref3","updateData","updateError","writeQuery","dotPropImmutable","set","_objectSpread2","CenteredView","SimpleFormHeader","Grid","style","backgroundColor","Cell","span","description","passwordValidators","user","push","validation","create","Form","_ref4","Bind","form","SimpleForm","CircularProgress","SimpleFormContent","name","validators","Input","label","autoComplete","inputRef","SimpleFormFooter","ButtonPrimary","onClick","ev","submit"],"sources":["Settings.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport { CenteredView, useSnackbar } from \"@webiny/app-admin\";\nimport { Mutation, Query } from \"@apollo/react-components\";\nimport { Form } from \"@webiny/form\";\nimport {\n SimpleForm,\n SimpleFormContent,\n SimpleFormFooter,\n SimpleFormHeader\n} from \"@webiny/app-admin/components/SimpleForm\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { Cell, Grid } from \"@webiny/ui/Grid\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport {\n GET_SETTINGS_QUERY,\n SAVE_SETTINGS_MUTATION,\n SaveSettingsMutationResponse,\n SaveSettingsMutationVariables,\n SettingsQueryResponse\n} from \"./graphql\";\nimport { TransportSettings, ValidationError } from \"~/types\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { Validator } from \"@webiny/validation/types\";\nimport dotPropImmutable from \"dot-prop-immutable\";\n\nconst displayErrors = (errors?: ValidationError[]) => {\n if (!errors) {\n return null;\n }\n return (\n <>\n {errors.map(error => {\n const field = error.path[0];\n if (!field) {\n return null;\n }\n return <Alert key={`${field}`} title={error.message} type=\"danger\" />;\n })}\n </>\n );\n};\n\nexport const Settings = () => {\n const { showSnackbar } = useSnackbar();\n\n const password = useRef<HTMLInputElement>();\n\n const [errors, setErrors] = useState<ValidationError[] | undefined>();\n\n useEffect(() => {\n const t = setTimeout(() => {\n if (!password.current) {\n return;\n }\n password.current.value = \"\";\n }, 300);\n\n return () => {\n clearTimeout(t);\n };\n }, []);\n\n return (\n <Query<SettingsQueryResponse> query={GET_SETTINGS_QUERY}>\n {({ data: response, loading: queryInProgress }) => (\n <Mutation<SaveSettingsMutationResponse, SaveSettingsMutationVariables>\n mutation={SAVE_SETTINGS_MUTATION}\n >\n {(update, result) => {\n const { data: settingsData, error: settingsError } =\n response?.mailer.settings || {};\n const { loading: mutationInProgress } = result;\n\n const onSubmit = async (data: TransportSettings): Promise<void> => {\n setErrors([]);\n await update({\n variables: {\n data\n },\n update: (cache, result) => {\n const data = structuredClone(\n cache.readQuery<SettingsQueryResponse>({\n query: GET_SETTINGS_QUERY\n })\n );\n\n const { data: updateData, error: updateError } =\n result.data?.mailer.settings || {};\n\n const errors = updateError?.data.errors;\n if (errors) {\n setErrors(errors);\n showSnackbar(\n \"Settings not updated! Please check your network and console logs for detailed information.\"\n );\n return;\n }\n\n cache.writeQuery({\n query: GET_SETTINGS_QUERY,\n data: dotPropImmutable.set(data, \"mailer.settings.data\", {\n ...settingsData,\n ...updateData\n })\n });\n showSnackbar(\"Settings updated successfully.\");\n }\n });\n };\n if (settingsError) {\n return (\n <CenteredView>\n <SimpleFormHeader title=\"Mailer Settings\" />\n <Grid style={{ backgroundColor: \"#FFFFFF\" }}>\n <Cell span={12}>\n <Alert title={settingsError.message} type=\"danger\" />\n {settingsError.data?.description && (\n <p>{settingsError.data.description}</p>\n )}\n </Cell>\n </Grid>\n </CenteredView>\n );\n }\n\n const passwordValidators: Validator[] = [];\n if (!settingsData?.user) {\n passwordValidators.push(validation.create(\"required,minLength:5\"));\n }\n\n return (\n <CenteredView>\n <Form\n data={settingsData || {}}\n onSubmit={data => {\n /**\n * We are positive that data is TransportSettings.\n */\n onSubmit(data as unknown as TransportSettings);\n }}\n >\n {({ Bind, form }) => (\n <SimpleForm>\n {(queryInProgress || mutationInProgress) && (\n <CircularProgress />\n )}\n <SimpleFormHeader title=\"Mailer Settings\" />\n <SimpleFormContent>\n {displayErrors(errors)}\n <Grid>\n <Cell span={12}>\n <Bind\n name={\"host\"}\n validators={[\n validation.create(\n \"required,minLength:1\"\n )\n ]}\n >\n <Input type=\"text\" label=\"Hostname\" />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind name={\"port\"}>\n <Input type=\"number\" label=\"Port\" />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"user\"}\n validators={[\n validation.create(\n \"required,minLength:1\"\n )\n ]}\n >\n <Input\n type=\"text\"\n label=\"User\"\n autoComplete=\"new-password\"\n />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"password\"}\n validators={passwordValidators}\n >\n <Input\n label=\"Password\"\n type=\"password\"\n autoComplete=\"new-password\"\n value={\"\"}\n // @ts-expect-error\n inputRef={password}\n />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"from\"}\n validators={[\n validation.create(\n \"required,minLength:1,email\"\n )\n ]}\n >\n <Input type=\"text\" label=\"Mail from\" />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"replyTo\"}\n validators={[\n validation.create(\"email\")\n ]}\n >\n <Input\n type=\"text\"\n label=\"Mail reply-to\"\n />\n </Bind>\n </Cell>\n </Grid>\n </SimpleFormContent>\n <SimpleFormFooter>\n <ButtonPrimary\n onClick={ev => {\n form.submit(ev);\n }}\n >\n Save Settings\n </ButtonPrimary>\n </SimpleFormFooter>\n </SimpleForm>\n )}\n </Form>\n </CenteredView>\n );\n }}\n </Mutation>\n )}\n </Query>\n );\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAMA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AAQA,IAAAW,MAAA,GAAAX,OAAA;AAEA,IAAAY,iBAAA,G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AAS,CACtB,CACC,CACJ,CAAC,eACPpC,MAAA,CAAAkB,OAAA,CAAAC,aAAA,CAACX,KAAA,CAAA6E,IAAI;UAACC,IAAI,EAAE;QAAG,gBACXtF,MAAA,CAAAkB,OAAA,CAAAC,aAAA,CAAC4E,IAAI;UACDK,IAAI,EAAE,MAAO;UACbC,UAAU,EAAE,CACRV,sBAAU,CAACC,MAAM,CACb,4BACJ,CAAC;QACH,gBAEF5F,MAAA,CAAAkB,OAAA,CAAAC,aAAA,CAACV,MAAA,CAAA6F,KAAK;UAACxE,IAAI,EAAC,MAAM;UAACyE,KAAK,EAAC;QAAW,CAAE,CACpC,CACJ,CAAC,eACPvG,MAAA,CAAAkB,OAAA,CAAAC,aAAA,CAACX,KAAA,CAAA6E,IAAI;UAACC,IAAI,EAAE;QAAG,gBACXtF,MAAA,CAAAkB,OAAA,CAAAC,aAAA,CAAC4E,IAAI;UACDK,IAAI,EAAE,SAAU;UAChBC,UAAU,EAAE,CACRV,sBAAU,CAACC,MAAM,CAAC,OAAO,CAAC;QAC5B,gBAEF5F,MAAA,CAAAkB,OAAA,CAAAC,aAAA,CAACV,MAAA,CAAA6F,KAAK;UACFxE,IAAI,EAAC,MAAM;UACXyE,KAAK,EAAC;QAAe,CACxB,CACC,CACJ,CACJ,CACS,CAAC,eACpBvG,MAAA,CAAAkB,OAAA,CAAAC,aAAA,CAACb,WAAA,CAAAoG,gBAAgB,qBACb1G,MAAA,CAAAkB,OAAA,CAAAC,aAAA,CAACR,OAAA,CAAAgG,aAAa;UACVC,OAAO,EAAE,SAATA,OAAOA,CAAEC,EAAE,EAAI;YACXb,IAAI,CAACc,MAAM,CAACD,EAAE,CAAC;UACnB;QAAE,GACL,eAEc,CACD,CACV,CAAC;MAAA,CAEf,CACI,CAAC;IAEvB,CACM,CAAC;EAAA,CAEZ,CAAC;AAEhB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","useState","CenteredView","useSnackbar","Mutation","Query","Form","SimpleForm","SimpleFormContent","SimpleFormFooter","SimpleFormHeader","validation","GET_SETTINGS_QUERY","SAVE_SETTINGS_MUTATION","dotPropImmutable","Alert","Button","Grid","Input","OverlayLoader","displayErrors","errors","createElement","Fragment","map","error","field","path","key","title","type","message","Settings","showSnackbar","password","setErrors","t","setTimeout","current","value","clearTimeout","query","data","response","loading","queryInProgress","mutation","update","result","settingsData","settingsError","mailer","settings","mutationInProgress","onSubmit","variables","cache","structuredClone","readQuery","updateData","updateError","writeQuery","set","Column","span","description","passwordValidators","user","push","create","Bind","form","name","validators","size","label","autoComplete","inputRef","text","onClick","ev","submit"],"sources":["Settings.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport { CenteredView, useSnackbar } from \"@webiny/app-admin\";\nimport { Mutation, Query } from \"@apollo/react-components\";\nimport { Form } from \"@webiny/form\";\nimport {\n SimpleForm,\n SimpleFormContent,\n SimpleFormFooter,\n SimpleFormHeader\n} from \"@webiny/app-admin/components/SimpleForm\";\nimport { validation } from \"@webiny/validation\";\nimport {\n GET_SETTINGS_QUERY,\n SAVE_SETTINGS_MUTATION,\n SaveSettingsMutationResponse,\n SaveSettingsMutationVariables,\n SettingsQueryResponse\n} from \"./graphql\";\nimport { TransportSettings, ValidationError } from \"~/types\";\nimport { Validator } from \"@webiny/validation/types\";\nimport dotPropImmutable from \"dot-prop-immutable\";\nimport { Alert, Button, Grid, Input, OverlayLoader } from \"@webiny/admin-ui\";\n\nconst displayErrors = (errors?: ValidationError[]) => {\n if (!errors) {\n return null;\n }\n return (\n <>\n {errors.map(error => {\n const field = error.path[0];\n if (!field) {\n return null;\n }\n return (\n <Alert key={`${field}`} title={\"Error\"} type=\"danger\">\n {error.message}\n {\"ssss\"}\n </Alert>\n );\n })}\n </>\n );\n};\n\nexport const Settings = () => {\n const { showSnackbar } = useSnackbar();\n\n const password = useRef<HTMLInputElement>();\n\n const [errors, setErrors] = useState<ValidationError[] | undefined>();\n\n useEffect(() => {\n const t = setTimeout(() => {\n if (!password.current) {\n return;\n }\n password.current.value = \"\";\n }, 300);\n\n return () => {\n clearTimeout(t);\n };\n }, []);\n\n return (\n <Query<SettingsQueryResponse> query={GET_SETTINGS_QUERY}>\n {({ data: response, loading: queryInProgress }) => (\n <Mutation<SaveSettingsMutationResponse, SaveSettingsMutationVariables>\n mutation={SAVE_SETTINGS_MUTATION}\n >\n {(update, result) => {\n const { data: settingsData, error: settingsError } =\n response?.mailer.settings || {};\n const { loading: mutationInProgress } = result;\n\n const onSubmit = async (data: TransportSettings): Promise<void> => {\n setErrors([]);\n await update({\n variables: {\n data\n },\n update: (cache, result) => {\n const data = structuredClone(\n cache.readQuery<SettingsQueryResponse>({\n query: GET_SETTINGS_QUERY\n })\n );\n\n const { data: updateData, error: updateError } =\n result.data?.mailer.settings || {};\n\n const errors = updateError?.data.errors;\n if (errors) {\n setErrors(errors);\n showSnackbar(\n \"Settings not updated! Please check your network and console logs for detailed information.\"\n );\n return;\n }\n\n cache.writeQuery({\n query: GET_SETTINGS_QUERY,\n data: dotPropImmutable.set(data, \"mailer.settings.data\", {\n ...settingsData,\n ...updateData\n })\n });\n showSnackbar(\"Settings updated successfully.\");\n }\n });\n };\n if (settingsError) {\n return (\n <SimpleForm>\n <SimpleFormHeader title=\"Mailer Settings\" />\n <SimpleFormContent>\n <Grid>\n <Grid.Column span={12}>\n <Alert title={settingsError.message} type=\"danger\">\n {settingsError.data?.description && (\n <p>{settingsError.data.description}</p>\n )}\n </Alert>\n </Grid.Column>\n </Grid>\n </SimpleFormContent>\n <SimpleFormFooter>{\"\"}</SimpleFormFooter>\n </SimpleForm>\n );\n }\n\n const passwordValidators: Validator[] = [];\n if (!settingsData?.user) {\n passwordValidators.push(validation.create(\"required,minLength:5\"));\n }\n\n return (\n <CenteredView>\n <Form\n data={settingsData || {}}\n onSubmit={data => {\n /**\n * We are positive that data is TransportSettings.\n */\n onSubmit(data as unknown as TransportSettings);\n }}\n >\n {({ Bind, form }) => (\n <SimpleForm>\n {(queryInProgress || mutationInProgress) && (\n <OverlayLoader />\n )}\n <SimpleFormHeader title=\"Mailer Settings\" />\n <SimpleFormContent>\n {displayErrors(errors)}\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name={\"host\"}\n validators={[\n validation.create(\n \"required,minLength:1\"\n )\n ]}\n >\n <Input\n size={\"lg\"}\n type=\"text\"\n label=\"Hostname\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name={\"port\"}>\n <Input\n size={\"lg\"}\n type=\"number\"\n label=\"Port\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name={\"user\"}\n validators={[\n validation.create(\n \"required,minLength:1\"\n )\n ]}\n >\n <Input\n size={\"lg\"}\n type=\"text\"\n label=\"User\"\n autoComplete=\"new-password\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name={\"password\"}\n validators={passwordValidators}\n >\n <Input\n size={\"lg\"}\n label=\"Password\"\n type=\"password\"\n autoComplete=\"new-password\"\n value={\"\"}\n // @ts-expect-error\n inputRef={password}\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name={\"from\"}\n validators={[\n validation.create(\n \"required,minLength:1,email\"\n )\n ]}\n >\n <Input\n size={\"lg\"}\n type=\"text\"\n label=\"Mail from\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name={\"replyTo\"}\n validators={[\n validation.create(\"email\")\n ]}\n >\n <Input\n size={\"lg\"}\n type=\"text\"\n label=\"Mail reply-to\"\n />\n </Bind>\n </Grid.Column>\n </Grid>\n </SimpleFormContent>\n <SimpleFormFooter>\n <Button\n text={\"Save\"}\n onClick={ev => {\n form.submit(ev);\n }}\n />\n </SimpleFormFooter>\n </SimpleForm>\n )}\n </Form>\n </CenteredView>\n );\n }}\n </Mutation>\n )}\n </Query>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,EA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U,EAAE,CACR9D,UAAU,CAAC0D,MAAM,CAAC,OAAO,CAAC;IAC5B,gBAEFvE,KAAA,CAAAwB,aAAA,CAACJ,KAAK;MACFwD,IAAI,EAAE,IAAK;MACX5C,IAAI,EAAC,MAAM;MACX6C,KAAK,EAAC;IAAe,CACxB,CACC,CACG,CACX,CACS,CAAC,eACpB7E,KAAA,CAAAwB,aAAA,CAACb,gBAAgB,qBACbX,KAAA,CAAAwB,aAAA,CAACN,MAAM;MACH8D,IAAI,EAAE,MAAO;MACbC,OAAO,EAAEC,EAAE,IAAI;QACXT,IAAI,CAACU,MAAM,CAACD,EAAE,CAAC;MACnB;IAAE,CACL,CACa,CACV,CAEd,CACI,CAAC;EAEvB,CACM,CAEX,CAAC;AAEhB,CAAC","ignoreList":[]}
|
|
@@ -1,16 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import gql from "graphql-tag";
|
|
2
|
+
const SETTINGS_FIELDS = `
|
|
3
|
+
{
|
|
4
|
+
host
|
|
5
|
+
port
|
|
6
|
+
user
|
|
7
|
+
from
|
|
8
|
+
replyTo
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
const ERROR_FIELDS = `
|
|
12
|
+
{
|
|
13
|
+
message
|
|
14
|
+
code
|
|
15
|
+
data
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
export const GET_SETTINGS_QUERY = gql`
|
|
19
|
+
query GetMailerSettings {
|
|
20
|
+
mailer {
|
|
21
|
+
settings: getSettings {
|
|
22
|
+
data ${SETTINGS_FIELDS}
|
|
23
|
+
error ${ERROR_FIELDS}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
export const SAVE_SETTINGS_MUTATION = gql`
|
|
29
|
+
mutation SaveTransportSettings($data: MailerTransportSettingsInput!) {
|
|
30
|
+
mailer {
|
|
31
|
+
settings: saveSettings(data: $data) {
|
|
32
|
+
data ${SETTINGS_FIELDS}
|
|
33
|
+
error ${ERROR_FIELDS}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
15
38
|
|
|
16
39
|
//# sourceMappingURL=graphql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["gql","SETTINGS_FIELDS","ERROR_FIELDS","GET_SETTINGS_QUERY","SAVE_SETTINGS_MUTATION"],"sources":["graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { ApiError, TransportSettings, ValidationErrors } from \"~/types\";\n\nconst SETTINGS_FIELDS = `\n {\n host\n port\n user\n from\n replyTo\n }\n`;\n\nconst ERROR_FIELDS = `\n {\n message\n code\n data\n }\n`;\n\nexport interface SettingsQueryResponse {\n mailer: {\n settings: {\n data: TransportSettings | null;\n error: ApiError | null;\n };\n };\n}\nexport const GET_SETTINGS_QUERY = gql`\n query GetMailerSettings {\n mailer {\n settings: getSettings {\n data ${SETTINGS_FIELDS}\n error ${ERROR_FIELDS}\n }\n }\n }\n`;\n\nexport interface SaveSettingsMutationVariables {\n data: TransportSettings & {\n password?: string;\n };\n}\n\nexport interface SaveSettingsMutationResponse {\n mailer: {\n settings: {\n data: TransportSettings | null;\n error: ApiError<ValidationErrors> | null;\n };\n };\n}\nexport const SAVE_SETTINGS_MUTATION = gql`\n mutation SaveTransportSettings($data: MailerTransportSettingsInput!) {\n mailer {\n settings: saveSettings(data: $data) {\n data ${SETTINGS_FIELDS}\n error ${ERROR_FIELDS}\n }\n }\n }\n`;\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,aAAa;AAG7B,MAAMC,eAAe,GAAG;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,YAAY,GAAG;AACrB;AACA;AACA;AACA;AACA;AACA,CAAC;AAUD,OAAO,MAAMC,kBAAkB,GAAGH,GAAG;AACrC;AACA;AACA;AACA,uBAAuBC,eAAe;AACtC,wBAAwBC,YAAY;AACpC;AACA;AACA;AACA,CAAC;AAgBD,OAAO,MAAME,sBAAsB,GAAGJ,GAAG;AACzC;AACA;AACA;AACA,uBAAuBC,eAAe;AACtC,wBAAwBC,YAAY;AACpC;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
package/views/settings/index.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _Settings = require("./Settings");
|
|
8
|
-
var _default = exports.default = _Settings.Settings;
|
|
1
|
+
import { Settings } from "./Settings";
|
|
2
|
+
export default Settings;
|
|
9
3
|
|
|
10
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Settings"],"sources":["index.ts"],"sourcesContent":["import { Settings } from \"./Settings\";\n\nexport default Settings;\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,eAAeA,QAAQ","ignoreList":[]}
|