@webiny/app-mailer 6.3.0-beta.2 → 6.3.0-beta.3
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/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-mailer",
|
|
3
|
-
"version": "6.3.0-beta.
|
|
3
|
+
"version": "6.3.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js",
|
|
7
|
+
"./*": "./*"
|
|
8
|
+
},
|
|
6
9
|
"repository": {
|
|
7
10
|
"type": "git",
|
|
8
11
|
"url": "https://github.com/webiny/webiny-js.git"
|
|
@@ -11,15 +14,14 @@
|
|
|
11
14
|
"license": "MIT",
|
|
12
15
|
"dependencies": {
|
|
13
16
|
"@apollo/react-components": "3.1.5",
|
|
14
|
-
"@webiny/admin-ui": "6.3.0-beta.
|
|
15
|
-
"@webiny/app-admin": "6.3.0-beta.
|
|
16
|
-
"@webiny/form": "6.3.0-beta.
|
|
17
|
-
"@webiny/validation": "6.3.0-beta.
|
|
17
|
+
"@webiny/admin-ui": "6.3.0-beta.3",
|
|
18
|
+
"@webiny/app-admin": "6.3.0-beta.3",
|
|
19
|
+
"@webiny/form": "6.3.0-beta.3",
|
|
20
|
+
"@webiny/validation": "6.3.0-beta.3",
|
|
18
21
|
"apollo-cache": "1.3.5",
|
|
19
22
|
"apollo-client": "2.6.10",
|
|
20
23
|
"apollo-link": "1.2.14",
|
|
21
24
|
"apollo-utilities": "1.3.4",
|
|
22
|
-
"dot-prop-immutable": "2.1.1",
|
|
23
25
|
"graphql": "16.13.2",
|
|
24
26
|
"graphql-tag": "2.12.6",
|
|
25
27
|
"react": "18.3.1",
|
|
@@ -27,7 +29,7 @@
|
|
|
27
29
|
},
|
|
28
30
|
"devDependencies": {
|
|
29
31
|
"@types/react": "18.3.28",
|
|
30
|
-
"@webiny/build-tools": "6.3.0-beta.
|
|
32
|
+
"@webiny/build-tools": "6.3.0-beta.3",
|
|
31
33
|
"rimraf": "6.1.3",
|
|
32
34
|
"typescript": "6.0.3"
|
|
33
35
|
},
|
|
@@ -40,5 +42,5 @@
|
|
|
40
42
|
"removeViewBox": false
|
|
41
43
|
}
|
|
42
44
|
},
|
|
43
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "e154ec3326903876c357d35422dc60d29e061419"
|
|
44
46
|
}
|
package/types.d.ts
CHANGED
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { Identity } from \"@webiny/app-admin/domain/Identity.js\";\n\n/**\n * A base security permission for APW.\n *\n * @category SecurityPermission\n */\nexport interface MailerSecurityPermission extends Identity.Permission {\n changeSettings?: boolean;\n}\n\n/**\n * GraphQL API call response for the transport settings values\n * @category GraphQL\n */\nexport interface TransportSettings {\n host: string;\n user: string;\n from: string;\n replyTo?: string;\n password?: string;\n}\n/**\n *\n * @category GraphQL\n */\nexport interface ApiError<T = Record<string, any>> {\n message: string;\n code: string;\n data: T;\n}\n\n/**\n * Description of the JOI validation errors received from the API.\n *\n * @category GraphQL\n */\nexport interface ValidationError {\n message: string;\n path: string[];\n}\n\nexport interface ValidationErrors {\n errors: ValidationError[];\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { Identity } from \"@webiny/app-admin/domain/Identity.js\";\n\n/**\n * A base security permission for APW.\n *\n * @category SecurityPermission\n */\nexport interface MailerSecurityPermission extends Identity.Permission {\n changeSettings?: boolean;\n}\n\n/**\n * GraphQL API call response for the transport settings values\n * @category GraphQL\n */\nexport interface TransportSettings {\n host: string;\n port?: number;\n user: string;\n from: string;\n replyTo?: string;\n password?: string;\n}\n/**\n *\n * @category GraphQL\n */\nexport interface ApiError<T = Record<string, any>> {\n message: string;\n code: string;\n data: T;\n}\n\n/**\n * Description of the JOI validation errors received from the API.\n *\n * @category GraphQL\n */\nexport interface ValidationError {\n message: string;\n path: string[];\n}\n\nexport interface ValidationErrors {\n errors: ValidationError[];\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ import { Form } from "@webiny/form";
|
|
|
5
5
|
import { SimpleForm, SimpleFormContent, SimpleFormFooter, SimpleFormHeader } from "@webiny/app-admin";
|
|
6
6
|
import { validation } from "@webiny/validation";
|
|
7
7
|
import { GET_SETTINGS_QUERY, SAVE_SETTINGS_MUTATION } from "./graphql.js";
|
|
8
|
-
import dotPropImmutable from "dot-prop-immutable";
|
|
9
8
|
import { Alert, Button, Grid, Input, OverlayLoader } from "@webiny/admin-ui";
|
|
10
9
|
const displayErrors = errors => {
|
|
11
10
|
if (!errors) {
|
|
@@ -20,7 +19,7 @@ const displayErrors = errors => {
|
|
|
20
19
|
key: `${field}`,
|
|
21
20
|
title: "Error",
|
|
22
21
|
type: "danger"
|
|
23
|
-
}, error.message
|
|
22
|
+
}, error.message);
|
|
24
23
|
}));
|
|
25
24
|
};
|
|
26
25
|
export const Settings = () => {
|
|
@@ -52,40 +51,82 @@ export const Settings = () => {
|
|
|
52
51
|
data: settingsData,
|
|
53
52
|
error: settingsError
|
|
54
53
|
} = response?.mailer.settings || {};
|
|
54
|
+
const settingsSource = settingsData?.source;
|
|
55
55
|
const {
|
|
56
56
|
loading: mutationInProgress
|
|
57
57
|
} = result;
|
|
58
58
|
const onSubmit = async data => {
|
|
59
59
|
setErrors([]);
|
|
60
|
-
await update({
|
|
60
|
+
const response = await update({
|
|
61
61
|
variables: {
|
|
62
62
|
data
|
|
63
63
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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;
|
|
77
|
-
}
|
|
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
|
-
}
|
|
64
|
+
refetchQueries: [{
|
|
65
|
+
query: GET_SETTINGS_QUERY
|
|
66
|
+
}],
|
|
67
|
+
awaitRefetchQueries: true
|
|
87
68
|
});
|
|
69
|
+
const saveError = response.data?.mailer.settings.error;
|
|
70
|
+
if (saveError) {
|
|
71
|
+
const validationErrors = saveError.data?.errors;
|
|
72
|
+
if (validationErrors) {
|
|
73
|
+
setErrors(validationErrors);
|
|
74
|
+
}
|
|
75
|
+
showSnackbar("Settings not updated! Please check your network and console logs for detailed information.");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
showSnackbar("Settings updated successfully.");
|
|
88
79
|
};
|
|
80
|
+
if (settingsSource === "code") {
|
|
81
|
+
return /*#__PURE__*/React.createElement(CenteredView, null, /*#__PURE__*/React.createElement(SimpleForm, null, /*#__PURE__*/React.createElement(SimpleFormHeader, {
|
|
82
|
+
title: "Mailer Settings"
|
|
83
|
+
}), /*#__PURE__*/React.createElement(SimpleFormContent, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Grid.Column, {
|
|
84
|
+
span: 12
|
|
85
|
+
}, /*#__PURE__*/React.createElement(Alert, {
|
|
86
|
+
title: "Managed by code",
|
|
87
|
+
type: "info"
|
|
88
|
+
}, "Mailer settings are managed by code. Edit", " ", /*#__PURE__*/React.createElement("code", null, "webiny.config.tsx"), " to change them.")), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
89
|
+
span: 12
|
|
90
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
91
|
+
size: "lg",
|
|
92
|
+
type: "text",
|
|
93
|
+
label: "Hostname",
|
|
94
|
+
value: settingsData?.host ?? "",
|
|
95
|
+
disabled: true
|
|
96
|
+
})), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
97
|
+
span: 12
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
99
|
+
size: "lg",
|
|
100
|
+
type: "number",
|
|
101
|
+
label: "Port",
|
|
102
|
+
value: String(settingsData?.port ?? ""),
|
|
103
|
+
disabled: true
|
|
104
|
+
})), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
105
|
+
span: 12
|
|
106
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
107
|
+
size: "lg",
|
|
108
|
+
type: "text",
|
|
109
|
+
label: "User",
|
|
110
|
+
value: settingsData?.user ?? "",
|
|
111
|
+
disabled: true
|
|
112
|
+
})), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
113
|
+
span: 12
|
|
114
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
115
|
+
size: "lg",
|
|
116
|
+
type: "text",
|
|
117
|
+
label: "From",
|
|
118
|
+
value: settingsData?.from ?? "",
|
|
119
|
+
disabled: true
|
|
120
|
+
})), /*#__PURE__*/React.createElement(Grid.Column, {
|
|
121
|
+
span: 12
|
|
122
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
123
|
+
size: "lg",
|
|
124
|
+
type: "text",
|
|
125
|
+
label: "Reply-To",
|
|
126
|
+
value: settingsData?.replyTo ?? "",
|
|
127
|
+
disabled: true
|
|
128
|
+
})))), /*#__PURE__*/React.createElement(SimpleFormFooter, null, "")));
|
|
129
|
+
}
|
|
89
130
|
if (settingsError) {
|
|
90
131
|
return /*#__PURE__*/React.createElement(SimpleForm, null, /*#__PURE__*/React.createElement(SimpleFormHeader, {
|
|
91
132
|
title: "Mailer Settings"
|
|
@@ -94,7 +135,7 @@ export const Settings = () => {
|
|
|
94
135
|
}, /*#__PURE__*/React.createElement(Alert, {
|
|
95
136
|
title: settingsError.message,
|
|
96
137
|
type: "danger"
|
|
97
|
-
}
|
|
138
|
+
})))), /*#__PURE__*/React.createElement(SimpleFormFooter, null, ""));
|
|
98
139
|
}
|
|
99
140
|
const passwordValidators = [];
|
|
100
141
|
if (!settingsData?.user) {
|
|
@@ -1 +1 @@
|
|
|
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","code","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\";\nimport { validation } from \"@webiny/validation\";\nimport type {\n SaveSettingsMutationResponse,\n SaveSettingsMutationVariables,\n SettingsQueryResponse\n} from \"./graphql.js\";\nimport { GET_SETTINGS_QUERY, SAVE_SETTINGS_MUTATION } from \"./graphql.js\";\nimport type { TransportSettings, ValidationError } from \"~/types.js\";\nimport type { Validator } from \"@webiny/validation/types.js\";\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>(null);\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.code ===\n \"PASSWORD_SECRET_ERROR\" && (\n <p>\n To store the Mailer settings, you must\n have a password secret environment\n variable defined.\n </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 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,EAAEC,QAAQ,QAAQ,OAAO;AAC1D,SAASC,YAAY,EAAEC,WAAW,QAAQ,mBAAmB;AAC7D,SAASC,QAAQ,EAAEC,KAAK,QAAQ,0BAA0B;AAC1D,SAASC,IAAI,QAAQ,cAAc;AACnC,SACIC,UAAU,EACVC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,QACb,mBAAmB;AAC1B,SAASC,UAAU,QAAQ,oBAAoB;AAM/C,SAASC,kBAAkB,EAAEC,sBAAsB;AAGnD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,aAAa,QAAQ,kBAAkB;AAE5E,MAAMC,aAAa,GAAIC,MAA0B,IAAK;EAClD,IAAI,CAACA,MAAM,EAAE;IACT,OAAO,IAAI;EACf;EACA,oBACIvB,KAAA,CAAAwB,aAAA,CAAAxB,KAAA,CAAAyB,QAAA,QACKF,MAAM,CAACG,GAAG,CAACC,KAAK,IAAI;IACjB,MAAMC,KAAK,GAAGD,KAAK,CAACE,IAAI,CAAC,CAAC,CAAC;IAC3B,IAAI,CAACD,KAAK,EAAE;MACR,OAAO,IAAI;IACf;IACA,oBACI5B,KAAA,CAAAwB,aAAA,CAACP,KAAK;MAACa,GAAG,EAAE,GAAGF,KAAK,EAAG;MAACG,KAAK,EAAE,OAAQ;MAACC,IAAI,EAAC;IAAQ,GAChDL,KAAK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ACb,4BACJ,CAAC;IACH,gBAEFvE,KAAA,CAAAwB,aAAA,CAACJ,KAAK;MACFwD,IAAI,EAAE,IAAK;MACX5C,IAAI,EAAC,MAAM;MACX6C,KAAK,EAAC;IAAW,CACpB,CACC,CACG,CAAC,eACd7E,KAAA,CAAAwB,aAAA,CAACL,IAAI,CAAC8C,MAAM;MAACC,IAAI,EAAE;IAAG,gBAClBlE,KAAA,CAAAwB,aAAA,CAACgD,IAAI;MACDE,IAAI,EAAE,SAAU;MAChBC,UAAU,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
|
+
{"version":3,"names":["React","useEffect","useRef","useState","CenteredView","useSnackbar","Mutation","Query","Form","SimpleForm","SimpleFormContent","SimpleFormFooter","SimpleFormHeader","validation","GET_SETTINGS_QUERY","SAVE_SETTINGS_MUTATION","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","settingsSource","source","mutationInProgress","onSubmit","variables","refetchQueries","awaitRefetchQueries","saveError","validationErrors","Column","span","size","label","host","disabled","String","port","user","from","replyTo","passwordValidators","push","create","Bind","form","name","validators","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\";\nimport { validation } from \"@webiny/validation\";\nimport type {\n SaveSettingsMutationResponse,\n SaveSettingsMutationVariables,\n SettingsQueryResponse\n} from \"./graphql.js\";\nimport { GET_SETTINGS_QUERY, SAVE_SETTINGS_MUTATION } from \"./graphql.js\";\nimport type { TransportSettings, ValidationError } from \"~/types.js\";\nimport type { Validator } from \"@webiny/validation/types.js\";\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 </Alert>\n );\n })}\n </>\n );\n};\n\nexport const Settings = () => {\n const { showSnackbar } = useSnackbar();\n\n const password = useRef<HTMLInputElement>(null);\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 settingsSource = settingsData?.source;\n const { loading: mutationInProgress } = result;\n\n const onSubmit = async (data: TransportSettings): Promise<void> => {\n setErrors([]);\n const response = await update({\n variables: { data },\n refetchQueries: [{ query: GET_SETTINGS_QUERY }],\n awaitRefetchQueries: true\n });\n\n const saveError = response.data?.mailer.settings.error;\n if (saveError) {\n const validationErrors = saveError.data?.errors;\n if (validationErrors) {\n setErrors(validationErrors);\n }\n showSnackbar(\n \"Settings not updated! Please check your network and console logs for detailed information.\"\n );\n return;\n }\n showSnackbar(\"Settings updated successfully.\");\n };\n if (settingsSource === \"code\") {\n return (\n <CenteredView>\n <SimpleForm>\n <SimpleFormHeader title=\"Mailer Settings\" />\n <SimpleFormContent>\n <Grid>\n <Grid.Column span={12}>\n <Alert title=\"Managed by code\" type=\"info\">\n Mailer settings are managed by code. Edit{\" \"}\n <code>webiny.config.tsx</code> to change\n them.\n </Alert>\n </Grid.Column>\n <Grid.Column span={12}>\n <Input\n size=\"lg\"\n type=\"text\"\n label=\"Hostname\"\n value={settingsData?.host ?? \"\"}\n disabled\n />\n </Grid.Column>\n <Grid.Column span={12}>\n <Input\n size=\"lg\"\n type=\"number\"\n label=\"Port\"\n value={String(settingsData?.port ?? \"\")}\n disabled\n />\n </Grid.Column>\n <Grid.Column span={12}>\n <Input\n size=\"lg\"\n type=\"text\"\n label=\"User\"\n value={settingsData?.user ?? \"\"}\n disabled\n />\n </Grid.Column>\n <Grid.Column span={12}>\n <Input\n size=\"lg\"\n type=\"text\"\n label=\"From\"\n value={settingsData?.from ?? \"\"}\n disabled\n />\n </Grid.Column>\n <Grid.Column span={12}>\n <Input\n size=\"lg\"\n type=\"text\"\n label=\"Reply-To\"\n value={settingsData?.replyTo ?? \"\"}\n disabled\n />\n </Grid.Column>\n </Grid>\n </SimpleFormContent>\n <SimpleFormFooter>{\"\"}</SimpleFormFooter>\n </SimpleForm>\n </CenteredView>\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\n title={settingsError.message}\n type=\"danger\"\n />\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 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,EAAEC,QAAQ,QAAQ,OAAO;AAC1D,SAASC,YAAY,EAAEC,WAAW,QAAQ,mBAAmB;AAC7D,SAASC,QAAQ,EAAEC,KAAK,QAAQ,0BAA0B;AAC1D,SAASC,IAAI,QAAQ,cAAc;AACnC,SACIC,UAAU,EACVC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,QACb,mBAAmB;AAC1B,SAASC,UAAU,QAAQ,oBAAoB;AAM/C,SAASC,kBAAkB,EAAEC,sBAAsB;AAGnD,SAASC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,aAAa,QAAQ,kBAAkB;AAE5E,MAAMC,aAAa,GAAIC,MAA0B,IAAK;EAClD,IAAI,CAACA,MAAM,EAAE;IACT,OAAO,IAAI;EACf;EACA,oBACItB,KAAA,CAAAuB,aAAA,CAAAvB,KAAA,CAAAwB,QAAA,QACKF,MAAM,CAACG,GAAG,CAACC,KAAK,IAAI;IACjB,MAAMC,KAAK,GAAGD,KAAK,CAACE,IAAI,CAAC,CAAC,CAAC;IAC3B,IAAI,CAACD,KAAK,EAAE;MACR,OAAO,IAAI;IACf;IACA,oBACI3B,KAAA,CAAAuB,aAAA,CAACP,KAAK;MAACa,GAAG,EAAE,GAAGF,KAAK,EAAG;MAACG,KAAK,EAAE,OAAQ;MAACC,IAAI,EAAC;IAAQ,GAChDL,KAAK,CAACM,OACJ,CAAC;EAEhB,CAAC,CACH,CAAC;AAEX,CAAC;AAED,OAAO,MAAMC,QAAQ,GAA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CAEd,CACI,CAAC;EAEvB,CACM,CAEX,CAAC;AAEhB,CAAC","ignoreList":[]}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import type { ApiError, TransportSettings, ValidationErrors } from "../../types.js";
|
|
2
|
+
export type MailerSettingsSource = "code" | "storage" | null;
|
|
3
|
+
/** Settings as they appear in GraphQL responses — never includes the password. */
|
|
4
|
+
export type PublicTransportSettings = Omit<TransportSettings, "password"> & {
|
|
5
|
+
source?: MailerSettingsSource;
|
|
6
|
+
};
|
|
2
7
|
export interface SettingsQueryResponse {
|
|
3
8
|
mailer: {
|
|
4
9
|
settings: {
|
|
5
|
-
data:
|
|
10
|
+
data: PublicTransportSettings | null;
|
|
6
11
|
error: ApiError | null;
|
|
7
12
|
};
|
|
8
13
|
};
|
|
9
14
|
}
|
|
10
15
|
export declare const GET_SETTINGS_QUERY: import("graphql").DocumentNode;
|
|
11
16
|
export interface SaveSettingsMutationVariables {
|
|
12
|
-
data: TransportSettings
|
|
13
|
-
password?: string;
|
|
14
|
-
};
|
|
17
|
+
data: TransportSettings;
|
|
15
18
|
}
|
|
16
19
|
export interface SaveSettingsMutationResponse {
|
|
17
20
|
mailer: {
|
|
18
21
|
settings: {
|
|
19
|
-
data:
|
|
22
|
+
data: PublicTransportSettings | null;
|
|
20
23
|
error: ApiError<ValidationErrors> | null;
|
|
21
24
|
};
|
|
22
25
|
};
|
|
@@ -6,6 +6,7 @@ const SETTINGS_FIELDS = `
|
|
|
6
6
|
user
|
|
7
7
|
from
|
|
8
8
|
replyTo
|
|
9
|
+
source
|
|
9
10
|
}
|
|
10
11
|
`;
|
|
11
12
|
const ERROR_FIELDS = `
|
|
@@ -15,6 +16,9 @@ const ERROR_FIELDS = `
|
|
|
15
16
|
data
|
|
16
17
|
}
|
|
17
18
|
`;
|
|
19
|
+
|
|
20
|
+
/** Settings as they appear in GraphQL responses — never includes the password. */
|
|
21
|
+
|
|
18
22
|
export const GET_SETTINGS_QUERY = gql`
|
|
19
23
|
query GetMailerSettings {
|
|
20
24
|
mailer {
|
|
@@ -1 +1 @@
|
|
|
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 type { ApiError, TransportSettings, ValidationErrors } from \"~/types.js\";\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:
|
|
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 type { ApiError, TransportSettings, ValidationErrors } from \"~/types.js\";\n\nconst SETTINGS_FIELDS = `\n {\n host\n port\n user\n from\n replyTo\n source\n }\n`;\n\nconst ERROR_FIELDS = `\n {\n message\n code\n data\n }\n`;\n\nexport type MailerSettingsSource = \"code\" | \"storage\" | null;\n\n/** Settings as they appear in GraphQL responses — never includes the password. */\nexport type PublicTransportSettings = Omit<TransportSettings, \"password\"> & {\n source?: MailerSettingsSource;\n};\n\nexport interface SettingsQueryResponse {\n mailer: {\n settings: {\n data: PublicTransportSettings | 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}\n\nexport interface SaveSettingsMutationResponse {\n mailer: {\n settings: {\n data: PublicTransportSettings | 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;AACA,CAAC;AAED,MAAMC,YAAY,GAAG;AACrB;AACA;AACA;AACA;AACA;AACA,CAAC;;AAID;;AAaA,OAAO,MAAMC,kBAAkB,GAAGH,GAAG;AACrC;AACA;AACA;AACA,uBAAuBC,eAAe;AACtC,wBAAwBC,YAAY;AACpC;AACA;AACA;AACA,CAAC;AAcD,OAAO,MAAME,sBAAsB,GAAGJ,GAAG;AACzC;AACA;AACA;AACA,uBAAuBC,eAAe;AACtC,wBAAwBC,YAAY;AACpC;AACA;AACA;AACA,CAAC","ignoreList":[]}
|