@plutonhq/core-frontend 0.1.23 → 0.1.24
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/dist-lib/@types/index.js +4 -1
- package/dist-lib/@types/index.js.map +1 -1
- package/dist-lib/@types/settings.d.ts +14 -0
- package/dist-lib/@types/settings.d.ts.map +1 -1
- package/dist-lib/@types/settings.js +34 -0
- package/dist-lib/@types/settings.js.map +1 -0
- package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettings.d.ts.map +1 -1
- package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettings.js +148 -90
- package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettings.js.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.d.ts.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.js +52 -47
- package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.js.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.module.scss.js +12 -6
- package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.module.scss.js.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.d.ts +9 -0
- package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.d.ts.map +1 -0
- package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.js +79 -0
- package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.js.map +1 -0
- package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.d.ts +4 -3
- package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.d.ts.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.js +37 -35
- package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.js.map +1 -1
- package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.d.ts +10 -0
- package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.d.ts.map +1 -0
- package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.js +49 -0
- package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.js.map +1 -0
- package/dist-lib/components/Storage/EditStorage/EditStorage.js +10 -10
- package/dist-lib/components/Storage/EditStorage/EditStorage.js.map +1 -1
- package/dist-lib/components/index.d.ts +2 -0
- package/dist-lib/components/index.d.ts.map +1 -1
- package/dist-lib/components.js +58 -54
- package/dist-lib/components.js.map +1 -1
- package/dist-lib/services/settings.d.ts +3 -2
- package/dist-lib/services/settings.d.ts.map +1 -1
- package/dist-lib/services/settings.js +0 -1
- package/dist-lib/services/settings.js.map +1 -1
- package/dist-lib/styles/core-frontend.css +1 -1
- package/package.json +1 -1
- package/src/@types/settings.ts +43 -0
- package/src/components/Plan/PlanSettings/PlanNotificationSettings.tsx +65 -0
- package/src/components/Settings/IntegrationSettings/IntegrationSettings.module.scss +16 -0
- package/src/components/Settings/IntegrationSettings/IntegrationSettings.tsx +45 -42
- package/src/components/Settings/IntegrationSettings/NtfySettings.tsx +106 -0
- package/src/components/Settings/IntegrationSettings/SMTPSettings.tsx +28 -19
- package/src/components/Settings/IntegrationSettings/ValidateEmailIntegration.tsx +58 -0
- package/src/components/Storage/EditStorage/EditStorage.tsx +1 -1
- package/src/components/index.ts +2 -0
- package/src/services/settings.ts +2 -2
- /package/dist-lib/providers/{azureBlob.png → azureblob.png} +0 -0
- /package/dist-lib/providers/{azureFiles.png → azurefiles.png} +0 -0
- /package/dist-lib/providers/{files.png → filescom.png} +0 -0
- /package/dist-lib/providers/{oracle.png → oracleobjectstorage.png} +0 -0
- /package/dist-lib/providers/{proton.png → protondrive.png} +0 -0
|
@@ -1,56 +1,61 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import S from "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const [
|
|
11
|
-
console.log("onIntegrationUpdate :", t,
|
|
1
|
+
import { jsxs as o, jsx as e, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g } from "react";
|
|
3
|
+
import l from "./IntegrationSettings.module.scss.js";
|
|
4
|
+
import S from "./SMTPSettings.js";
|
|
5
|
+
import b from "./NtfySettings.js";
|
|
6
|
+
import c from "../../common/Icon/Icon.js";
|
|
7
|
+
import h from "../../common/form/Select/Select.js";
|
|
8
|
+
import { isMobile as N } from "../../../utils/helpers.js";
|
|
9
|
+
const P = ({ settingsID: p, settings: a, onUpdate: y }) => {
|
|
10
|
+
const [i, s] = g("smtp"), n = (a == null ? void 0 : a.integration) || {}, { smtp: r, ntfy: m } = n || {}, f = (t, d) => {
|
|
11
|
+
console.log("onIntegrationUpdate :", t, d), y({ ...n, [t]: { ...n[t], ...d } });
|
|
12
12
|
};
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
return /* @__PURE__ */ o("div", { className: l.integrations, children: [
|
|
14
|
+
N() ? /* @__PURE__ */ e(
|
|
15
|
+
h,
|
|
16
16
|
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
customClasses: l.integrationSelect,
|
|
18
|
+
options: [
|
|
19
|
+
{ label: "SMTP", value: "smtp", icon: "email" },
|
|
20
|
+
{ label: "Ntfy", value: "ntfy", icon: "ntfy" }
|
|
21
|
+
],
|
|
22
|
+
fieldValue: i,
|
|
23
|
+
full: !0,
|
|
24
|
+
onUpdate: (t) => s(t)
|
|
20
25
|
}
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
width: "400px",
|
|
41
|
-
secondaryAction: { title: "Close", action: () => a("") },
|
|
42
|
-
primaryAction: {
|
|
43
|
-
title: "Send Test Email",
|
|
44
|
-
type: "default",
|
|
45
|
-
icon: "email",
|
|
46
|
-
isPending: s.isPending,
|
|
47
|
-
action: () => s.mutate({ settingsID: c, type: "smtp", settings: o, test: { email: n } })
|
|
26
|
+
) : /* @__PURE__ */ e(u, { children: /* @__PURE__ */ o("ul", { className: l.tabs, children: [
|
|
27
|
+
/* @__PURE__ */ o("li", { className: `${i === "smtp" ? l.tabActive : ""}`, onClick: () => s("smtp"), children: [
|
|
28
|
+
/* @__PURE__ */ e(c, { type: "email", size: 14 }),
|
|
29
|
+
" SMTP",
|
|
30
|
+
(r == null ? void 0 : r.connected) && /* @__PURE__ */ e(c, { type: "check-circle-filled", size: 12 })
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ o("li", { className: `${i === "ntfy" ? l.tabActive : ""}`, onClick: () => s("ntfy"), children: [
|
|
33
|
+
/* @__PURE__ */ e(c, { type: "ntfy", size: 14 }),
|
|
34
|
+
" Ntfy",
|
|
35
|
+
(m == null ? void 0 : m.connected) && /* @__PURE__ */ e(c, { type: "check-circle-filled", size: 12 })
|
|
36
|
+
] })
|
|
37
|
+
] }) }),
|
|
38
|
+
/* @__PURE__ */ o("div", { children: [
|
|
39
|
+
i === "smtp" && /* @__PURE__ */ e(
|
|
40
|
+
S,
|
|
41
|
+
{
|
|
42
|
+
settingsID: p,
|
|
43
|
+
settings: n,
|
|
44
|
+
onUpdate: (t) => f("smtp", t)
|
|
48
45
|
}
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
),
|
|
47
|
+
i === "ntfy" && /* @__PURE__ */ e(
|
|
48
|
+
b,
|
|
49
|
+
{
|
|
50
|
+
settingsID: p,
|
|
51
|
+
settings: n,
|
|
52
|
+
onUpdate: (t) => f("ntfy", t)
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] })
|
|
51
56
|
] });
|
|
52
57
|
};
|
|
53
58
|
export {
|
|
54
|
-
|
|
59
|
+
P as default
|
|
55
60
|
};
|
|
56
61
|
//# sourceMappingURL=IntegrationSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrationSettings.js","sources":["../../../../src/components/Settings/IntegrationSettings/IntegrationSettings.tsx"],"sourcesContent":["import { useState } from 'react';\r\nimport classes from './IntegrationSettings.module.scss';\r\nimport
|
|
1
|
+
{"version":3,"file":"IntegrationSettings.js","sources":["../../../../src/components/Settings/IntegrationSettings/IntegrationSettings.tsx"],"sourcesContent":["import { useState } from 'react';\r\nimport classes from './IntegrationSettings.module.scss';\r\nimport SMTPSettings from './SMTPSettings';\r\nimport NtfySettings from './NtfySettings';\r\nimport Icon from '../../common/Icon/Icon';\r\nimport Select from '../../common/form/Select/Select';\r\nimport { isMobile } from '../../../utils';\r\n\r\ninterface IntegrationSettingsProps {\r\n settingsID: number;\r\n settings: Record<string, any>;\r\n onUpdate: (settings: IntegrationSettingsProps['settings']) => void;\r\n}\r\n\r\nconst IntegrationSettings = ({ settingsID, settings, onUpdate }: IntegrationSettingsProps) => {\r\n const [tab, setTab] = useState<'smtp' | 'ntfy'>('smtp');\r\n const integrationSettings = settings?.integration || {};\r\n const { smtp, ntfy } = integrationSettings || {};\r\n\r\n const onIntegrationUpdate = (key: string, intSettings: Record<string, any>) => {\r\n console.log('onIntegrationUpdate :', key, intSettings);\r\n onUpdate({ ...integrationSettings, [key]: { ...integrationSettings[key], ...intSettings } });\r\n };\r\n\r\n return (\r\n <div className={classes.integrations}>\r\n {isMobile() ? (\r\n <Select\r\n customClasses={classes.integrationSelect}\r\n options={[\r\n { label: 'SMTP', value: 'smtp', icon: 'email' },\r\n { label: 'Ntfy', value: 'ntfy', icon: 'ntfy' },\r\n ]}\r\n fieldValue={tab}\r\n full={true}\r\n onUpdate={(val) => setTab(val as 'smtp' | 'ntfy')}\r\n />\r\n ) : (\r\n <>\r\n <ul className={classes.tabs}>\r\n <li className={`${tab === 'smtp' ? classes.tabActive : ''}`} onClick={() => setTab('smtp')}>\r\n <Icon type=\"email\" size={14} /> SMTP\r\n {smtp?.connected && <Icon type=\"check-circle-filled\" size={12} />}\r\n </li>\r\n <li className={`${tab === 'ntfy' ? classes.tabActive : ''}`} onClick={() => setTab('ntfy')}>\r\n <Icon type=\"ntfy\" size={14} /> Ntfy\r\n {ntfy?.connected && <Icon type=\"check-circle-filled\" size={12} />}\r\n </li>\r\n </ul>\r\n </>\r\n )}\r\n <div>\r\n {tab === 'smtp' && (\r\n <SMTPSettings\r\n settingsID={settingsID}\r\n settings={integrationSettings}\r\n onUpdate={(iSettings) => onIntegrationUpdate('smtp', iSettings)}\r\n />\r\n )}\r\n {tab === 'ntfy' && (\r\n <NtfySettings\r\n settingsID={settingsID}\r\n settings={integrationSettings}\r\n onUpdate={(iSettings) => onIntegrationUpdate('ntfy', iSettings)}\r\n />\r\n )}\r\n </div>\r\n </div>\r\n );\r\n};\r\n\r\nexport default IntegrationSettings;\r\n"],"names":["IntegrationSettings","settingsID","settings","onUpdate","tab","setTab","useState","integrationSettings","smtp","ntfy","onIntegrationUpdate","key","intSettings","jsxs","classes","isMobile","jsx","Select","val","Fragment","Icon","SMTPSettings","iSettings","NtfySettings"],"mappings":";;;;;;;;AAcA,MAAMA,IAAsB,CAAC,EAAE,YAAAC,GAAY,UAAAC,GAAU,UAAAC,QAAyC;AAC3F,QAAM,CAACC,GAAKC,CAAM,IAAIC,EAA0B,MAAM,GAChDC,KAAsBL,KAAA,gBAAAA,EAAU,gBAAe,CAAA,GAC/C,EAAE,MAAAM,GAAM,MAAAC,EAAA,IAASF,KAAuB,CAAA,GAExCG,IAAsB,CAACC,GAAaC,MAAqC;AAC5E,YAAQ,IAAI,yBAAyBD,GAAKC,CAAW,GACrDT,EAAS,EAAE,GAAGI,GAAqB,CAACI,CAAG,GAAG,EAAE,GAAGJ,EAAoBI,CAAG,GAAG,GAAGC,EAAA,GAAe;AAAA,EAC9F;AAEA,SACG,gBAAAC,EAAC,OAAA,EAAI,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,UACA,UAAUM;AAAA,UACV,UAAU,CAACe,MAAcZ,EAAoB,QAAQY,CAAS;AAAA,QAAA;AAAA,MAAA;AAAA,MAGnElB,MAAQ,UACN,gBAAAY;AAAA,QAACO;AAAA,QAAA;AAAA,UACE,YAAAtB;AAAA,UACA,UAAUM;AAAA,UACV,UAAU,CAACe,MAAcZ,EAAoB,QAAQY,CAAS;AAAA,QAAA;AAAA,MAAA;AAAA,IACjE,EAAA,CAEN;AAAA,EAAA,GACH;AAEN;"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
const t = "
|
|
1
|
+
const t = "_integrations_MpGgI", e = "_tabs_1kVp0", i = "_tabActive_XYBci", n = "_field_8kD7Y", a = "_validateBtn_uVx7f", s = "_integrationSelect_TiT6F", c = {
|
|
2
2
|
integrations: t,
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
tabs: e,
|
|
4
|
+
tabActive: i,
|
|
5
|
+
field: n,
|
|
6
|
+
validateBtn: a,
|
|
7
|
+
integrationSelect: s
|
|
5
8
|
};
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
c as default,
|
|
11
|
+
n as field,
|
|
12
|
+
s as integrationSelect,
|
|
9
13
|
t as integrations,
|
|
10
|
-
|
|
14
|
+
i as tabActive,
|
|
15
|
+
e as tabs,
|
|
16
|
+
a as validateBtn
|
|
11
17
|
};
|
|
12
18
|
//# sourceMappingURL=IntegrationSettings.module.scss.js.map
|
package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.module.scss.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegrationSettings.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntegrationSettings.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IntegrationSettings, NtfySettingsType } from '../../../@types';
|
|
2
|
+
interface NtfySettingsProps {
|
|
3
|
+
settingsID: number;
|
|
4
|
+
settings: IntegrationSettings;
|
|
5
|
+
onUpdate: (settings: NtfySettingsType) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const NtfySettings: ({ settingsID, settings, onUpdate }: NtfySettingsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default NtfySettings;
|
|
9
|
+
//# sourceMappingURL=NtfySettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NtfySettings.d.ts","sourceRoot":"","sources":["../../../../src/components/Settings/IntegrationSettings/NtfySettings.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAQxE,UAAU,iBAAiB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,QAAQ,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACjD;AAED,QAAA,MAAM,YAAY,GAAI,oCAAoC,iBAAiB,4CAuF1E,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsxs as p, jsx as o, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import { useState as n } from "react";
|
|
3
|
+
import i from "./IntegrationSettings.module.scss.js";
|
|
4
|
+
import M from "../../common/Icon/Icon.js";
|
|
5
|
+
import w from "../../common/form/Select/Select.js";
|
|
6
|
+
import x from "../../common/form/Input/Input.js";
|
|
7
|
+
import A from "../../common/ActionModal/ActionModal.js";
|
|
8
|
+
import { useValidateIntegration as E } from "../../../services/settings.js";
|
|
9
|
+
import I from "../../common/form/PasswordField/PasswordField.js";
|
|
10
|
+
const D = ({ settingsID: h, settings: a, onUpdate: m }) => {
|
|
11
|
+
var f;
|
|
12
|
+
const [t, y] = n((a == null ? void 0 : a.ntfy) || { authType: "token", authToken: "", connected: !1 }), [l, T] = n({ authToken: "" }), [k, r] = n(!1), [c, v] = n(""), s = E(), N = t.authType || "token", u = (e) => {
|
|
13
|
+
y(e), m(e);
|
|
14
|
+
}, g = (e) => {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
const d = { authToken: "" };
|
|
17
|
+
t != null && t.authToken || (d.authToken = "Required"), T(d), Object.values(d).some((S) => S !== "") || r(!0);
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ p("div", { children: [
|
|
20
|
+
/* @__PURE__ */ o("div", { className: i.field, children: /* @__PURE__ */ o(
|
|
21
|
+
w,
|
|
22
|
+
{
|
|
23
|
+
label: "Auth Type*",
|
|
24
|
+
fieldValue: N,
|
|
25
|
+
options: [{ label: "Token", value: "token" }],
|
|
26
|
+
onUpdate: (e) => u({ ...t, authType: e }),
|
|
27
|
+
inline: !0
|
|
28
|
+
}
|
|
29
|
+
) }),
|
|
30
|
+
/* @__PURE__ */ o("div", { className: i.field, children: /* @__PURE__ */ o(
|
|
31
|
+
I,
|
|
32
|
+
{
|
|
33
|
+
label: "Auth Token*",
|
|
34
|
+
fieldValue: t.authToken,
|
|
35
|
+
onUpdate: (e) => u({ ...t, authToken: e }),
|
|
36
|
+
error: l == null ? void 0 : l.authToken
|
|
37
|
+
}
|
|
38
|
+
) }),
|
|
39
|
+
/* @__PURE__ */ o("div", { className: i.field, children: /* @__PURE__ */ p("button", { className: i.validateBtn, onClick: g, type: "button", children: [
|
|
40
|
+
/* @__PURE__ */ o(M, { type: "check", size: 10 }),
|
|
41
|
+
" ",
|
|
42
|
+
t.connected ? "Re-validate Ntfy" : "Validate Ntfy"
|
|
43
|
+
] }) }),
|
|
44
|
+
k && /* @__PURE__ */ o(
|
|
45
|
+
A,
|
|
46
|
+
{
|
|
47
|
+
title: "Test Ntfy Integration",
|
|
48
|
+
message: /* @__PURE__ */ o(b, { children: /* @__PURE__ */ o(
|
|
49
|
+
x,
|
|
50
|
+
{
|
|
51
|
+
label: "Send Test Notification to this topic",
|
|
52
|
+
full: !0,
|
|
53
|
+
inline: !1,
|
|
54
|
+
fieldValue: c,
|
|
55
|
+
onUpdate: (e) => v(e),
|
|
56
|
+
type: "text",
|
|
57
|
+
placeholder: "test/topic url. Eg: https://ntfy.sh/testtopic"
|
|
58
|
+
}
|
|
59
|
+
) }),
|
|
60
|
+
errorMessage: (f = s.error) == null ? void 0 : f.message,
|
|
61
|
+
successMessage: s.isSuccess ? "Test notification sent. Integration validated successfully." : "",
|
|
62
|
+
closeModal: () => r(!1),
|
|
63
|
+
width: "400px",
|
|
64
|
+
secondaryAction: { title: "Close", action: () => r(!1) },
|
|
65
|
+
primaryAction: {
|
|
66
|
+
title: "Send Test Notification",
|
|
67
|
+
type: "default",
|
|
68
|
+
icon: "send",
|
|
69
|
+
isPending: s.isPending,
|
|
70
|
+
action: () => c && s.mutate({ settingsID: h, type: "ntfy", settings: { ...a, ntfy: t }, test: { url: c } })
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] });
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
D as default
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=NtfySettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NtfySettings.js","sources":["../../../../src/components/Settings/IntegrationSettings/NtfySettings.tsx"],"sourcesContent":["import { useState } from 'react';\r\nimport classes from './IntegrationSettings.module.scss';\r\nimport { IntegrationSettings, NtfySettingsType } from '../../../@types';\r\nimport Icon from '../../common/Icon/Icon';\r\nimport Select from '../../common/form/Select/Select';\r\nimport Input from '../../common/form/Input/Input';\r\nimport ActionModal from '../../common/ActionModal/ActionModal';\r\nimport { useValidateIntegration } from '../../../services';\r\nimport PasswordField from '../../common/form/PasswordField/PasswordField';\r\n\r\ninterface NtfySettingsProps {\r\n settingsID: number;\r\n settings: IntegrationSettings;\r\n onUpdate: (settings: NtfySettingsType) => void;\r\n}\r\n\r\nconst NtfySettings = ({ settingsID, settings, onUpdate }: NtfySettingsProps) => {\r\n const [ntfySettings, setNtfySettings] = useState<NtfySettingsType>(settings?.ntfy || { authType: 'token', authToken: '', connected: false });\r\n const [errorFields, setErrorFields] = useState<{ authToken: string }>({ authToken: '' });\r\n const [showTestModal, setShowTestModal] = useState(false);\r\n const [testUrl, setTestUrl] = useState('');\r\n const validationMutation = useValidateIntegration();\r\n\r\n const authType = ntfySettings.authType || 'token';\r\n\r\n const updateNtfySettings = (updated: NtfySettingsType) => {\r\n setNtfySettings(updated);\r\n onUpdate(updated);\r\n };\r\n\r\n const validateSettings = (e: React.FormEvent) => {\r\n e.preventDefault();\r\n\r\n const newErrors = { authToken: '' };\r\n\r\n if (!ntfySettings?.authToken) {\r\n newErrors.authToken = 'Required';\r\n }\r\n setErrorFields(newErrors);\r\n const hasErrors = Object.values(newErrors).some((error) => error !== '');\r\n if (!hasErrors) {\r\n setShowTestModal(true);\r\n }\r\n };\r\n\r\n return (\r\n <div>\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Auth Type*\"\r\n fieldValue={authType}\r\n options={[{ label: 'Token', value: 'token' }]}\r\n onUpdate={(val) => updateNtfySettings({ ...ntfySettings, authType: val })}\r\n inline={true}\r\n />\r\n </div>\r\n <div className={classes.field}>\r\n <PasswordField\r\n label=\"Auth Token*\"\r\n fieldValue={ntfySettings.authToken}\r\n onUpdate={(val) => updateNtfySettings({ ...ntfySettings, authToken: val })}\r\n error={errorFields?.authToken}\r\n />\r\n </div>\r\n <div className={classes.field}>\r\n <button className={classes.validateBtn} onClick={validateSettings} type=\"button\">\r\n <Icon type=\"check\" size={10} /> {ntfySettings.connected ? 'Re-validate Ntfy' : 'Validate Ntfy'}\r\n </button>\r\n </div>\r\n {showTestModal && (\r\n <ActionModal\r\n title={`Test Ntfy Integration`}\r\n message={\r\n <>\r\n <Input\r\n label=\"Send Test Notification to this topic\"\r\n full={true}\r\n inline={false}\r\n fieldValue={testUrl}\r\n onUpdate={(val) => setTestUrl(val)}\r\n type=\"text\"\r\n placeholder=\"test/topic url. Eg: https://ntfy.sh/testtopic\"\r\n />\r\n </>\r\n }\r\n errorMessage={validationMutation.error?.message}\r\n successMessage={validationMutation.isSuccess ? 'Test notification sent. Integration validated successfully.' : ''}\r\n closeModal={() => setShowTestModal(false)}\r\n width=\"400px\"\r\n secondaryAction={{ title: 'Close', action: () => setShowTestModal(false) }}\r\n primaryAction={{\r\n title: `Send Test Notification`,\r\n type: 'default',\r\n icon: 'send',\r\n isPending: validationMutation.isPending,\r\n action: () =>\r\n testUrl &&\r\n validationMutation.mutate({ settingsID, type: 'ntfy', settings: { ...settings, ntfy: ntfySettings }, test: { url: testUrl } }),\r\n }}\r\n />\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default NtfySettings;\r\n"],"names":["NtfySettings","settingsID","settings","onUpdate","ntfySettings","setNtfySettings","useState","errorFields","setErrorFields","showTestModal","setShowTestModal","testUrl","setTestUrl","validationMutation","useValidateIntegration","authType","updateNtfySettings","updated","validateSettings","newErrors","error","jsx","classes","Select","val","PasswordField","jsxs","Icon","ActionModal","Fragment","Input","_a"],"mappings":";;;;;;;;;AAgBA,MAAMA,IAAe,CAAC,EAAE,YAAAC,GAAY,UAAAC,GAAU,UAAAC,QAAkC;;AAC7E,QAAM,CAACC,GAAcC,CAAe,IAAIC,GAA2BJ,KAAA,gBAAAA,EAAU,SAAQ,EAAE,UAAU,SAAS,WAAW,IAAI,WAAW,IAAO,GACrI,CAACK,GAAaC,CAAc,IAAIF,EAAgC,EAAE,WAAW,IAAI,GACjF,CAACG,GAAeC,CAAgB,IAAIJ,EAAS,EAAK,GAClD,CAACK,GAASC,CAAU,IAAIN,EAAS,EAAE,GACnCO,IAAqBC,EAAA,GAErBC,IAAWX,EAAa,YAAY,SAEpCY,IAAqB,CAACC,MAA8B;AACvD,IAAAZ,EAAgBY,CAAO,GACvBd,EAASc,CAAO;AAAA,EACnB,GAEMC,IAAmB,CAAC,MAAuB;AAC9C,MAAE,eAAA;AAEF,UAAMC,IAAY,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,UAACS;AAAA,UAAA;AAAA,YACE,OAAM;AAAA,YACN,MAAM;AAAA,YACN,QAAQ;AAAA,YACR,YAAYnB;AAAA,YACZ,UAAU,CAACa,MAAQZ,EAAWY,CAAG;AAAA,YACjC,MAAK;AAAA,YACL,aAAY;AAAA,UAAA;AAAA,QAAA,GAElB;AAAA,QAEH,eAAcO,IAAAlB,EAAmB,UAAnB,gBAAAkB,EAA0B;AAAA,QACxC,gBAAgBlB,EAAmB,YAAY,gEAAgE;AAAA,QAC/G,YAAY,MAAMH,EAAiB,EAAK;AAAA,QACxC,OAAM;AAAA,QACN,iBAAiB,EAAE,OAAO,SAAS,QAAQ,MAAMA,EAAiB,EAAK,EAAA;AAAA,QACvE,eAAe;AAAA,UACZ,OAAO;AAAA,UACP,MAAM;AAAA,UACN,MAAM;AAAA,UACN,WAAWG,EAAmB;AAAA,UAC9B,QAAQ,MACLF,KACAE,EAAmB,OAAO,EAAE,YAAAZ,GAAY,MAAM,QAAQ,UAAU,EAAE,GAAGC,GAAU,MAAME,EAAA,GAAgB,MAAM,EAAE,KAAKO,IAAQ,CAAG;AAAA,QAAA;AAAA,MACnI;AAAA,IAAA;AAAA,EACH,GAEN;AAEN;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SmtpSettingsType } from '../../../@types/settings';
|
|
2
|
+
import { IntegrationSettings } from '../../../@types';
|
|
2
3
|
interface SMTPSettingsProps {
|
|
3
|
-
|
|
4
|
+
settingsID: number;
|
|
5
|
+
settings: IntegrationSettings;
|
|
4
6
|
onUpdate: (settings: SmtpSettingsType) => void;
|
|
5
|
-
showTestModal: (type: 'smtp') => void;
|
|
6
7
|
}
|
|
7
|
-
declare const SMTPSettings: ({ settings, onUpdate
|
|
8
|
+
declare const SMTPSettings: ({ settingsID, settings, onUpdate }: SMTPSettingsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export default SMTPSettings;
|
|
9
10
|
//# sourceMappingURL=SMTPSettings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SMTPSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/Settings/IntegrationSettings/SMTPSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"SMTPSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/Settings/IntegrationSettings/SMTPSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItD,UAAU,iBAAiB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,QAAQ,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACjD;AAED,QAAA,MAAM,YAAY,GAAI,oCAAoC,iBAAiB,4CAwF1E,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,73 +1,75 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { isValidEmail as
|
|
1
|
+
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m } from "react";
|
|
3
|
+
import s from "../../common/form/Input/Input.js";
|
|
4
|
+
import T from "../../common/Icon/Icon.js";
|
|
5
|
+
import { isValidEmail as P } from "../../../utils/helpers.js";
|
|
6
6
|
import d from "./IntegrationSettings.module.scss.js";
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import M from "./ValidateEmailIntegration.js";
|
|
8
|
+
const q = ({ settingsID: v, settings: n, onUpdate: i }) => {
|
|
9
|
+
const [u, c] = m(!1), [l, E] = m({
|
|
9
10
|
server: "",
|
|
10
11
|
port: "",
|
|
11
12
|
senderEmail: ""
|
|
12
|
-
}),
|
|
13
|
+
}), e = (n == null ? void 0 : n.smtp) || { server: "", port: 587, senderEmail: "", username: "", password: "", connected: !1 }, p = (a) => {
|
|
13
14
|
a.preventDefault();
|
|
14
15
|
const o = { server: "", port: "", senderEmail: "" };
|
|
15
|
-
|
|
16
|
+
e != null && e.server || (o.server = "Server is required"), e != null && e.port || (o.port = "Port is required"), e != null && e.senderEmail ? P(e.senderEmail) || (o.senderEmail = "Invalid email") : o.senderEmail = "Sender Email is required", E(o), Object.values(o).some((h) => h !== "") || c(!0);
|
|
16
17
|
};
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
|
|
18
|
+
return /* @__PURE__ */ f("div", { className: d.integrations, children: [
|
|
19
|
+
/* @__PURE__ */ r("div", { className: d.field, children: /* @__PURE__ */ r(
|
|
20
|
+
s,
|
|
20
21
|
{
|
|
21
22
|
label: "SMTP Server*",
|
|
22
|
-
fieldValue: (
|
|
23
|
-
onUpdate: (a) =>
|
|
23
|
+
fieldValue: (e == null ? void 0 : e.server) || "",
|
|
24
|
+
onUpdate: (a) => i({ ...e, server: a }),
|
|
24
25
|
error: l == null ? void 0 : l.server
|
|
25
26
|
}
|
|
26
27
|
) }),
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
|
|
28
|
+
/* @__PURE__ */ r("div", { className: d.field, children: /* @__PURE__ */ r(
|
|
29
|
+
s,
|
|
29
30
|
{
|
|
30
31
|
label: "SMTP PORT*",
|
|
31
|
-
fieldValue: (
|
|
32
|
-
onUpdate: (a) =>
|
|
32
|
+
fieldValue: (e == null ? void 0 : e.port) || "",
|
|
33
|
+
onUpdate: (a) => i({ ...e, port: parseInt(a, 10) }),
|
|
33
34
|
error: l == null ? void 0 : l.port
|
|
34
35
|
}
|
|
35
36
|
) }),
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
|
|
37
|
+
/* @__PURE__ */ r("div", { className: d.field, children: /* @__PURE__ */ r(
|
|
38
|
+
s,
|
|
38
39
|
{
|
|
39
40
|
label: "Sender Email*",
|
|
40
41
|
type: "email",
|
|
41
|
-
fieldValue: (
|
|
42
|
-
onUpdate: (a) =>
|
|
42
|
+
fieldValue: (e == null ? void 0 : e.senderEmail) || "",
|
|
43
|
+
onUpdate: (a) => i({ ...e, senderEmail: a }),
|
|
43
44
|
error: l == null ? void 0 : l.senderEmail
|
|
44
45
|
}
|
|
45
46
|
) }),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
47
|
+
/* @__PURE__ */ r("div", { className: d.field, children: /* @__PURE__ */ r(
|
|
48
|
+
s,
|
|
48
49
|
{
|
|
49
50
|
label: "SMTP Username",
|
|
50
|
-
fieldValue: (
|
|
51
|
-
onUpdate: (a) =>
|
|
51
|
+
fieldValue: (e == null ? void 0 : e.username) || "",
|
|
52
|
+
onUpdate: (a) => i({ ...e, username: a })
|
|
52
53
|
}
|
|
53
54
|
) }),
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
|
|
55
|
+
/* @__PURE__ */ r("div", { className: d.field, children: /* @__PURE__ */ r(
|
|
56
|
+
s,
|
|
56
57
|
{
|
|
57
58
|
label: "SMTP Password",
|
|
58
|
-
fieldValue: (
|
|
59
|
+
fieldValue: (e == null ? void 0 : e.password) || "",
|
|
59
60
|
type: "password",
|
|
60
|
-
onUpdate: (a) =>
|
|
61
|
+
onUpdate: (a) => i({ ...e, password: a })
|
|
61
62
|
}
|
|
62
63
|
) }),
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ r("div", { className: d.field, children: /* @__PURE__ */ f("button", { className: d.validateBtn, onClick: p, type: "button", children: [
|
|
65
|
+
/* @__PURE__ */ r(T, { type: "check", size: 10 }),
|
|
65
66
|
" ",
|
|
66
|
-
|
|
67
|
-
] }) })
|
|
67
|
+
e != null && e.connected ? "Re-validate SMTP" : "Validate SMTP"
|
|
68
|
+
] }) }),
|
|
69
|
+
u && /* @__PURE__ */ r(M, { settingsID: v, settings: n, integrationType: "smtp", onClose: () => c(!1) })
|
|
68
70
|
] });
|
|
69
71
|
};
|
|
70
72
|
export {
|
|
71
|
-
|
|
73
|
+
q as default
|
|
72
74
|
};
|
|
73
75
|
//# sourceMappingURL=SMTPSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SMTPSettings.js","sources":["../../../../src/components/Settings/IntegrationSettings/SMTPSettings.tsx"],"sourcesContent":["import { useState } from 'react';\r\nimport Input from '../../common/form/Input/Input';\r\nimport Icon from '../../common/Icon/Icon';\r\nimport { isValidEmail } from '../../../utils/helpers';\r\nimport { SmtpSettingsType } from '../../../@types/settings';\r\nimport classes from './IntegrationSettings.module.scss';\r\n\r\ninterface SMTPSettingsProps {\r\n
|
|
1
|
+
{"version":3,"file":"SMTPSettings.js","sources":["../../../../src/components/Settings/IntegrationSettings/SMTPSettings.tsx"],"sourcesContent":["import { useState } from 'react';\r\nimport Input from '../../common/form/Input/Input';\r\nimport Icon from '../../common/Icon/Icon';\r\nimport { isValidEmail } from '../../../utils/helpers';\r\nimport { SmtpSettingsType } from '../../../@types/settings';\r\nimport { IntegrationSettings } from '../../../@types';\r\nimport classes from './IntegrationSettings.module.scss';\r\nimport ValidateEmailIntegration from './ValidateEmailIntegration';\r\n\r\ninterface SMTPSettingsProps {\r\n settingsID: number;\r\n settings: IntegrationSettings;\r\n onUpdate: (settings: SmtpSettingsType) => void;\r\n}\r\n\r\nconst SMTPSettings = ({ settingsID, settings, onUpdate }: SMTPSettingsProps) => {\r\n const [showTestModal, setShowTestModal] = useState(false);\r\n const [errorFields, setErrorFields] = useState<{ server: string; port: string; senderEmail: string }>({\r\n server: '',\r\n port: '',\r\n senderEmail: '',\r\n });\r\n\r\n const smtpSettings = settings?.smtp || { server: '', port: 587, senderEmail: '', username: '', password: '', connected: false };\r\n\r\n const validateSettings = (e: React.FormEvent) => {\r\n e.preventDefault();\r\n\r\n const newErrors = { server: '', port: '', senderEmail: '' };\r\n\r\n if (!smtpSettings?.server) {\r\n newErrors.server = 'Server is required';\r\n }\r\n if (!smtpSettings?.port) {\r\n newErrors.port = 'Port is required';\r\n }\r\n if (!smtpSettings?.senderEmail) {\r\n newErrors.senderEmail = 'Sender Email is required';\r\n } else if (!isValidEmail(smtpSettings.senderEmail)) {\r\n newErrors.senderEmail = 'Invalid email';\r\n }\r\n\r\n setErrorFields(newErrors);\r\n const hasErrors = Object.values(newErrors).some((error) => error !== '');\r\n if (!hasErrors) {\r\n setShowTestModal(true);\r\n }\r\n };\r\n\r\n return (\r\n <div className={classes.integrations}>\r\n <div className={classes.field}>\r\n <Input\r\n label=\"SMTP Server*\"\r\n fieldValue={(smtpSettings?.server || '') as string}\r\n onUpdate={(val) => onUpdate({ ...smtpSettings, server: val })}\r\n error={errorFields?.server}\r\n />\r\n </div>\r\n <div className={classes.field}>\r\n <Input\r\n label=\"SMTP PORT*\"\r\n fieldValue={(smtpSettings?.port || '') as string}\r\n onUpdate={(val) => onUpdate({ ...smtpSettings, port: parseInt(val, 10) })}\r\n error={errorFields?.port}\r\n />\r\n </div>\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Sender Email*\"\r\n type=\"email\"\r\n fieldValue={(smtpSettings?.senderEmail || '') as string}\r\n onUpdate={(val) => onUpdate({ ...smtpSettings, senderEmail: val })}\r\n error={errorFields?.senderEmail}\r\n />\r\n </div>\r\n <div className={classes.field}>\r\n <Input\r\n label=\"SMTP Username\"\r\n fieldValue={(smtpSettings?.username || '') as string}\r\n onUpdate={(val) => onUpdate({ ...smtpSettings, username: val })}\r\n />\r\n </div>\r\n <div className={classes.field}>\r\n <Input\r\n label=\"SMTP Password\"\r\n fieldValue={(smtpSettings?.password || '') as string}\r\n type=\"password\"\r\n onUpdate={(val) => onUpdate({ ...smtpSettings, password: val })}\r\n />\r\n </div>\r\n\r\n <div className={classes.field}>\r\n <button className={classes.validateBtn} onClick={validateSettings} type=\"button\">\r\n <Icon type=\"check\" size={10} /> {smtpSettings?.connected ? 'Re-validate SMTP' : 'Validate SMTP'}\r\n </button>\r\n </div>\r\n\r\n {showTestModal && (\r\n <ValidateEmailIntegration settingsID={settingsID} settings={settings} integrationType=\"smtp\" onClose={() => setShowTestModal(false)} />\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default SMTPSettings;\r\n"],"names":["SMTPSettings","settingsID","settings","onUpdate","showTestModal","setShowTestModal","useState","errorFields","setErrorFields","smtpSettings","validateSettings","e","newErrors","isValidEmail","error","jsxs","classes","jsx","Input","val","Icon","ValidateEmailIntegration"],"mappings":";;;;;;;AAeA,MAAMA,IAAe,CAAC,EAAE,YAAAC,GAAY,UAAAC,GAAU,UAAAC,QAAkC;AAC7E,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClD,CAACC,GAAaC,CAAc,IAAIF,EAAgE;AAAA,IACnG,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,aAAa;AAAA,EAAA,CACf,GAEKG,KAAeP,KAAA,gBAAAA,EAAU,SAAQ,EAAE,QAAQ,IAAI,MAAM,KAAK,aAAa,IAAI,UAAU,IAAI,UAAU,IAAI,WAAW,GAAA,GAElHQ,IAAmB,CAACC,MAAuB;AAC9C,IAAAA,EAAE,eAAA;AAEF,UAAMC,IAAY,EAAE,QAAQ,IAAI,MAAM,IAAI,aAAa,GAAA;AAEvD,IAAKH,KAAA,QAAAA,EAAc,WAChBG,EAAU,SAAS,uBAEjBH,KAAA,QAAAA,EAAc,SAChBG,EAAU,OAAO,qBAEfH,KAAA,QAAAA,EAAc,cAEPI,EAAaJ,EAAa,WAAW,MAC9CG,EAAU,cAAc,mBAFxBA,EAAU,cAAc,4BAK3BJ,EAAeI,CAAS,GACN,OAAO,OAAOA,CAAS,EAAE,KAAK,CAACE,MAAUA,MAAU,EAAE,KAEpET,EAAiB,EAAI;AAAA,EAE3B;AAEA,SACG,gBAAAU,EAAC,OAAA,EAAI,WAAWC,EAAQ,cACrB,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,WAAW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AAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACE,OAAM;AAAA,QACN,aAAaT,KAAA,gBAAAA,EAAc,aAAY;AAAA,QACvC,MAAK;AAAA,QACL,UAAU,CAACU,MAAQhB,EAAS,EAAE,GAAGM,GAAc,UAAUU,EAAA,CAAK;AAAA,MAAA;AAAA,IAAA,GAEpE;AAAA,IAEA,gBAAAF,EAAC,OAAA,EAAI,WAAWD,EAAQ,OACrB,UAAA,gBAAAD,EAAC,UAAA,EAAO,WAAWC,EAAQ,aAAa,SAASN,GAAkB,MAAK,UACrE,UAAA;AAAA,MAAA,gBAAAO,EAACG,GAAA,EAAK,MAAK,SAAQ,MAAM,IAAI;AAAA,MAAE;AAAA,MAAEX,KAAA,QAAAA,EAAc,YAAY,qBAAqB;AAAA,IAAA,EAAA,CACnF,EAAA,CACH;AAAA,IAECL,KACE,gBAAAa,EAACI,GAAA,EAAyB,YAAApB,GAAwB,UAAAC,GAAoB,iBAAgB,QAAO,SAAS,MAAMG,EAAiB,EAAK,EAAA,CAAG;AAAA,EAAA,GAE3I;AAEN;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IntegrationSettings, IntegrationTypes } from '../../../@types';
|
|
2
|
+
interface ValidateEmailIntegrationProps {
|
|
3
|
+
settingsID: number;
|
|
4
|
+
settings: IntegrationSettings;
|
|
5
|
+
integrationType: IntegrationTypes;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const ValidateEmailIntegration: ({ settingsID, settings, integrationType, onClose }: ValidateEmailIntegrationProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default ValidateEmailIntegration;
|
|
10
|
+
//# sourceMappingURL=ValidateEmailIntegration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidateEmailIntegration.d.ts","sourceRoot":"","sources":["../../../../src/components/Settings/IntegrationSettings/ValidateEmailIntegration.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA0B,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEhG,UAAU,6BAA6B;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,eAAe,EAAE,gBAAgB,CAAC;IAClC,OAAO,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,wBAAwB,GAAI,oDAAoD,6BAA6B,4CA0ClH,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as i, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u } from "react";
|
|
3
|
+
import p from "../../common/form/Input/Input.js";
|
|
4
|
+
import f from "../../common/ActionModal/ActionModal.js";
|
|
5
|
+
import { useValidateIntegration as g } from "../../../services/settings.js";
|
|
6
|
+
import { INTEGRATIONS_AVAILABLE as A } from "../../../@types/settings.js";
|
|
7
|
+
const h = ({ settingsID: n, settings: r, integrationType: a, onClose: s }) => {
|
|
8
|
+
var l;
|
|
9
|
+
const [t, m] = u(""), e = g(), o = A[a].name;
|
|
10
|
+
return /* @__PURE__ */ i(
|
|
11
|
+
f,
|
|
12
|
+
{
|
|
13
|
+
title: `Test ${o} Integration`,
|
|
14
|
+
message: /* @__PURE__ */ i(d, { children: /* @__PURE__ */ i(
|
|
15
|
+
p,
|
|
16
|
+
{
|
|
17
|
+
label: "Send Test Email to this email",
|
|
18
|
+
full: !0,
|
|
19
|
+
inline: !1,
|
|
20
|
+
fieldValue: t,
|
|
21
|
+
onUpdate: (c) => m(c),
|
|
22
|
+
type: "email",
|
|
23
|
+
placeholder: "test@test.com"
|
|
24
|
+
}
|
|
25
|
+
) }),
|
|
26
|
+
errorMessage: (l = e.error) == null ? void 0 : l.message,
|
|
27
|
+
successMessage: e.isSuccess ? `Test email sent. ${o} validated successfully.` : "",
|
|
28
|
+
closeModal: s,
|
|
29
|
+
width: "400px",
|
|
30
|
+
secondaryAction: { title: "Close", action: s },
|
|
31
|
+
primaryAction: {
|
|
32
|
+
title: "Send Test Email",
|
|
33
|
+
type: "default",
|
|
34
|
+
icon: "email",
|
|
35
|
+
isPending: e.isPending,
|
|
36
|
+
action: () => t && e.mutate({
|
|
37
|
+
settingsID: n,
|
|
38
|
+
type: a,
|
|
39
|
+
settings: { ...r },
|
|
40
|
+
test: { email: t }
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
h as default
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=ValidateEmailIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidateEmailIntegration.js","sources":["../../../../src/components/Settings/IntegrationSettings/ValidateEmailIntegration.tsx"],"sourcesContent":["import { useState } from 'react';\r\nimport Input from '../../common/form/Input/Input';\r\nimport ActionModal from '../../common/ActionModal/ActionModal';\r\nimport { useValidateIntegration } from '../../../services';\r\nimport { INTEGRATIONS_AVAILABLE, IntegrationSettings, IntegrationTypes } from '../../../@types';\r\n\r\ninterface ValidateEmailIntegrationProps {\r\n settingsID: number;\r\n settings: IntegrationSettings;\r\n integrationType: IntegrationTypes;\r\n onClose: () => void;\r\n}\r\n\r\nconst ValidateEmailIntegration = ({ settingsID, settings, integrationType, onClose }: ValidateEmailIntegrationProps) => {\r\n const [testEmail, setTestEmail] = useState('');\r\n const validationMutation = useValidateIntegration();\r\n const integrationName = INTEGRATIONS_AVAILABLE[integrationType as IntegrationTypes].name;\r\n\r\n return (\r\n <ActionModal\r\n title={`Test ${integrationName} Integration`}\r\n message={\r\n <>\r\n <Input\r\n label=\"Send Test Email to this email\"\r\n full={true}\r\n inline={false}\r\n fieldValue={testEmail}\r\n onUpdate={(val) => setTestEmail(val)}\r\n type=\"email\"\r\n placeholder=\"test@test.com\"\r\n />\r\n </>\r\n }\r\n errorMessage={validationMutation.error?.message}\r\n successMessage={validationMutation.isSuccess ? `Test email sent. ${integrationName} validated successfully.` : ''}\r\n closeModal={onClose}\r\n width=\"400px\"\r\n secondaryAction={{ title: 'Close', action: onClose }}\r\n primaryAction={{\r\n title: 'Send Test Email',\r\n type: 'default',\r\n icon: 'email',\r\n isPending: validationMutation.isPending,\r\n action: () =>\r\n testEmail &&\r\n validationMutation.mutate({\r\n settingsID,\r\n type: integrationType,\r\n settings: { ...settings },\r\n test: { email: testEmail },\r\n }),\r\n }}\r\n />\r\n );\r\n};\r\n\r\nexport default ValidateEmailIntegration;\r\n"],"names":["ValidateEmailIntegration","settingsID","settings","integrationType","onClose","testEmail","setTestEmail","useState","validationMutation","useValidateIntegration","integrationName","INTEGRATIONS_AVAILABLE","jsx","ActionModal","Fragment","Input","val","_a"],"mappings":";;;;;;AAaA,MAAMA,IAA2B,CAAC,EAAE,YAAAC,GAAY,UAAAC,GAAU,iBAAAC,GAAiB,SAAAC,QAA6C;;AACrH,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAE,GACvCC,IAAqBC,EAAA,GACrBC,IAAkBC,EAAuBR,CAAmC,EAAE;AAEpF,SACG,gBAAAS;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,OAAO,QAAQH,CAAe;AAAA,MAC9B,SACG,gBAAAE,EAAAE,GAAA,EACG,UAAA,gBAAAF;AAAA,QAACG;AAAA,QAAA;AAAA,UACE,OAAM;AAAA,UACN,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,YAAYV;AAAA,UACZ,UAAU,CAACW,MAAQV,EAAaU,CAAG;AAAA,UACnC,MAAK;AAAA,UACL,aAAY;AAAA,QAAA;AAAA,MAAA,GAElB;AAAA,MAEH,eAAcC,IAAAT,EAAmB,UAAnB,gBAAAS,EAA0B;AAAA,MACxC,gBAAgBT,EAAmB,YAAY,oBAAoBE,CAAe,6BAA6B;AAAA,MAC/G,YAAYN;AAAA,MACZ,OAAM;AAAA,MACN,iBAAiB,EAAE,OAAO,SAAS,QAAQA,EAAA;AAAA,MAC3C,eAAe;AAAA,QACZ,OAAO;AAAA,QACP,MAAM;AAAA,QACN,MAAM;AAAA,QACN,WAAWI,EAAmB;AAAA,QAC9B,QAAQ,MACLH,KACAG,EAAmB,OAAO;AAAA,UACvB,YAAAP;AAAA,UACA,MAAME;AAAA,UACN,UAAU,EAAE,GAAGD,EAAA;AAAA,UACf,MAAM,EAAE,OAAOG,EAAA;AAAA,QAAU,CAC3B;AAAA,MAAA;AAAA,IACP;AAAA,EAAA;AAGT;"}
|
|
@@ -10,28 +10,28 @@ import B from "../StorageSettings/StorageSettings.js";
|
|
|
10
10
|
import I from "../StorageAuthSettings/StorageAuthSettings.js";
|
|
11
11
|
import { shouldDisplayStorageField as G } from "../../../utils/helpers.js";
|
|
12
12
|
const ee = ({ close: U, storage: s }) => {
|
|
13
|
-
const [h,
|
|
13
|
+
const [h, N] = d({}), [p, k] = d(!1), [g, q] = d(() => s.authType || ""), [m, y] = d({}), [u, b] = d(() => s.settings), [E, $] = d(() => s.tags || []), S = x(), v = s.type, { data: o } = z(s.id);
|
|
14
14
|
R(() => {
|
|
15
15
|
o && o.success && o.result && o.result.credentials && y(o.result.credentials);
|
|
16
16
|
}, [o]);
|
|
17
17
|
const f = A(() => {
|
|
18
18
|
const a = { required: [], optional: [] };
|
|
19
19
|
return s.storageFields.forEach((r) => {
|
|
20
|
-
r.required ? a.required.push(r) : a.optional.push(r);
|
|
20
|
+
r.required ? a.required.push(r) : r.authFieldType || a.optional.push(r);
|
|
21
21
|
}), a;
|
|
22
|
-
}, [s.storageFields]),
|
|
22
|
+
}, [s.storageFields]), T = A(() => {
|
|
23
23
|
var i;
|
|
24
24
|
const a = ((i = o == null ? void 0 : o.result) == null ? void 0 : i.authTypes) || ["client"];
|
|
25
25
|
return { fields: s.storageFields.filter((l) => l.authFieldType), types: a };
|
|
26
26
|
}, [s.storageFields, o]), j = () => {
|
|
27
|
-
|
|
27
|
+
N({});
|
|
28
28
|
const a = {}, r = s.storageFields;
|
|
29
29
|
if (r.forEach((i) => {
|
|
30
30
|
if (!i.required || !G(i, u, r)) return;
|
|
31
31
|
const l = !!i.authFieldType;
|
|
32
32
|
if (!(!l || i.authFieldType === g)) return;
|
|
33
|
-
const
|
|
34
|
-
(
|
|
33
|
+
const F = l ? m[i.value] : u[i.value];
|
|
34
|
+
(F == null || F === "") && (a[i.value] = "Required");
|
|
35
35
|
}), console.log("errors :", a), Object.keys(a).length === 0) {
|
|
36
36
|
const i = {
|
|
37
37
|
id: s.id,
|
|
@@ -54,7 +54,7 @@ Error Detail: ${l.message}`), y(o.result.credentials), b(o.result.settings);
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
} else
|
|
57
|
-
|
|
57
|
+
N(a);
|
|
58
58
|
};
|
|
59
59
|
return /* @__PURE__ */ e(
|
|
60
60
|
P,
|
|
@@ -100,12 +100,12 @@ Error Detail: ${l.message}`), y(o.result.credentials), b(o.result.settings);
|
|
|
100
100
|
s.storageTypeName
|
|
101
101
|
] })
|
|
102
102
|
] }),
|
|
103
|
-
v &&
|
|
103
|
+
v && T.fields.length > 0 && /* @__PURE__ */ e(
|
|
104
104
|
I,
|
|
105
105
|
{
|
|
106
106
|
storageType: v,
|
|
107
|
-
fields:
|
|
108
|
-
authTypes:
|
|
107
|
+
fields: T.fields,
|
|
108
|
+
authTypes: T.types,
|
|
109
109
|
settings: m,
|
|
110
110
|
onUpdate: (a) => y(a),
|
|
111
111
|
errors: h,
|