@plutonhq/core-frontend 0.1.22 → 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.
Files changed (96) hide show
  1. package/dist-lib/@types/index.js +4 -1
  2. package/dist-lib/@types/index.js.map +1 -1
  3. package/dist-lib/@types/plans.d.ts +11 -20
  4. package/dist-lib/@types/plans.d.ts.map +1 -1
  5. package/dist-lib/@types/settings.d.ts +14 -0
  6. package/dist-lib/@types/settings.d.ts.map +1 -1
  7. package/dist-lib/@types/settings.js +34 -0
  8. package/dist-lib/@types/settings.js.map +1 -0
  9. package/dist-lib/components/Plan/PlanSettings/PlanAdvancedSettings.js +49 -47
  10. package/dist-lib/components/Plan/PlanSettings/PlanAdvancedSettings.js.map +1 -1
  11. package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettings.d.ts +7 -4
  12. package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettings.d.ts.map +1 -1
  13. package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettings.js +235 -52
  14. package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettings.js.map +1 -1
  15. package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettingsTester.d.ts +9 -0
  16. package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettingsTester.d.ts.map +1 -0
  17. package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettingsTester.js +62 -0
  18. package/dist-lib/components/Plan/PlanSettings/PlanNotificationSettingsTester.js.map +1 -0
  19. package/dist-lib/components/Plan/PlanSettings/PlanPruneSettings.js +2 -2
  20. package/dist-lib/components/Plan/PlanSettings/PlanPruneSettings.js.map +1 -1
  21. package/dist-lib/components/Plan/PlanSettings/PlanSettings.module.scss.js +56 -40
  22. package/dist-lib/components/Plan/PlanSettings/PlanSettings.module.scss.js.map +1 -1
  23. package/dist-lib/components/Settings/GeneralSettings/GeneralSettings.d.ts.map +1 -1
  24. package/dist-lib/components/Settings/GeneralSettings/GeneralSettings.js +16 -8
  25. package/dist-lib/components/Settings/GeneralSettings/GeneralSettings.js.map +1 -1
  26. package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.d.ts.map +1 -1
  27. package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.js +52 -47
  28. package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.js.map +1 -1
  29. package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.module.scss.js +12 -6
  30. package/dist-lib/components/Settings/IntegrationSettings/IntegrationSettings.module.scss.js.map +1 -1
  31. package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.d.ts +9 -0
  32. package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.d.ts.map +1 -0
  33. package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.js +79 -0
  34. package/dist-lib/components/Settings/IntegrationSettings/NtfySettings.js.map +1 -0
  35. package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.d.ts +4 -3
  36. package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.d.ts.map +1 -1
  37. package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.js +37 -35
  38. package/dist-lib/components/Settings/IntegrationSettings/SMTPSettings.js.map +1 -1
  39. package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.d.ts +10 -0
  40. package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.d.ts.map +1 -0
  41. package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.js +49 -0
  42. package/dist-lib/components/Settings/IntegrationSettings/ValidateEmailIntegration.js.map +1 -0
  43. package/dist-lib/components/Storage/EditStorage/EditStorage.js +10 -10
  44. package/dist-lib/components/Storage/EditStorage/EditStorage.js.map +1 -1
  45. package/dist-lib/components/common/Icon/Icon.d.ts.map +1 -1
  46. package/dist-lib/components/common/Icon/Icon.js +15 -1
  47. package/dist-lib/components/common/Icon/Icon.js.map +1 -1
  48. package/dist-lib/components/index.d.ts +3 -0
  49. package/dist-lib/components/index.d.ts.map +1 -1
  50. package/dist-lib/components.js +114 -108
  51. package/dist-lib/components.js.map +1 -1
  52. package/dist-lib/providers/s3compatible.png +0 -0
  53. package/dist-lib/services/plans.d.ts +13 -1
  54. package/dist-lib/services/plans.d.ts.map +1 -1
  55. package/dist-lib/services/plans.js +88 -61
  56. package/dist-lib/services/plans.js.map +1 -1
  57. package/dist-lib/services/settings.d.ts +3 -2
  58. package/dist-lib/services/settings.d.ts.map +1 -1
  59. package/dist-lib/services/settings.js +25 -25
  60. package/dist-lib/services/settings.js.map +1 -1
  61. package/dist-lib/services.js +102 -100
  62. package/dist-lib/styles/core-frontend.css +1 -1
  63. package/dist-lib/utils/constants.d.ts.map +1 -1
  64. package/dist-lib/utils/constants.js +28 -5
  65. package/dist-lib/utils/constants.js.map +1 -1
  66. package/dist-lib/utils/helpers.d.ts +1 -0
  67. package/dist-lib/utils/helpers.d.ts.map +1 -1
  68. package/dist-lib/utils/helpers.js +17 -10
  69. package/dist-lib/utils/helpers.js.map +1 -1
  70. package/dist-lib/utils.js +28 -27
  71. package/package.json +1 -1
  72. package/src/@types/plans.ts +11 -20
  73. package/src/@types/settings.ts +43 -0
  74. package/src/components/Plan/PlanSettings/PlanAdvancedSettings.tsx +4 -4
  75. package/src/components/Plan/PlanSettings/PlanNotificationSettings.tsx +244 -47
  76. package/src/components/Plan/PlanSettings/PlanNotificationSettingsTester.tsx +85 -0
  77. package/src/components/Plan/PlanSettings/PlanPruneSettings.tsx +2 -2
  78. package/src/components/Plan/PlanSettings/PlanSettings.module.scss +71 -0
  79. package/src/components/Settings/GeneralSettings/GeneralSettings.tsx +6 -1
  80. package/src/components/Settings/IntegrationSettings/IntegrationSettings.module.scss +16 -0
  81. package/src/components/Settings/IntegrationSettings/IntegrationSettings.tsx +45 -42
  82. package/src/components/Settings/IntegrationSettings/NtfySettings.tsx +106 -0
  83. package/src/components/Settings/IntegrationSettings/SMTPSettings.tsx +28 -19
  84. package/src/components/Settings/IntegrationSettings/ValidateEmailIntegration.tsx +58 -0
  85. package/src/components/Storage/EditStorage/EditStorage.tsx +1 -1
  86. package/src/components/common/Icon/Icon.tsx +16 -0
  87. package/src/components/index.ts +3 -0
  88. package/src/services/plans.ts +38 -1
  89. package/src/services/settings.ts +4 -4
  90. package/src/utils/constants.ts +23 -0
  91. package/src/utils/helpers.ts +9 -0
  92. /package/dist-lib/providers/{azureBlob.png → azureblob.png} +0 -0
  93. /package/dist-lib/providers/{azureFiles.png → azurefiles.png} +0 -0
  94. /package/dist-lib/providers/{files.png → filescom.png} +0 -0
  95. /package/dist-lib/providers/{oracle.png → oracleobjectstorage.png} +0 -0
  96. /package/dist-lib/providers/{proton.png → protondrive.png} +0 -0
@@ -1,67 +1,250 @@
1
- import { jsxs as i, Fragment as b, jsx as a } from "react/jsx-runtime";
2
- import s from "./PlanSettings.module.scss.js";
3
- import y from "../../common/form/Select/Select.js";
4
- import O from "../../common/form/Input/Input.js";
5
- import E from "../../common/form/Toggle/Toggle.js";
6
- import { NavLink as j } from "react-router";
7
- const B = ({ plan: d, types: N = [], admin_email: m = "", onUpdate: r }) => {
8
- var o, n, t, u, h, f;
9
- const e = ((o = d.settings) == null ? void 0 : o.notification) || {}, p = (l) => {
10
- r({ ...e, email: { ...e.email, emails: l } });
11
- }, c = N.length > 0, v = !c && m ? m : "";
12
- return /* @__PURE__ */ i(b, { children: [
13
- /* @__PURE__ */ i("div", { className: s.field, children: [
14
- /* @__PURE__ */ a("label", { className: s.label, children: "Notification" }),
15
- /* @__PURE__ */ a(
16
- E,
17
- {
18
- fieldValue: ((n = e == null ? void 0 : e.email) == null ? void 0 : n.enabled) || !1,
19
- onUpdate: (l) => r({ ...e, email: { ...e.email, enabled: l } }),
20
- description: d.method === "sync" ? "Notify Me when Sync fails" : "Notify Me when Backup fails or succeeds"
21
- }
22
- )
1
+ import { jsxs as u, Fragment as _, jsx as e } from "react/jsx-runtime";
2
+ import d from "./PlanSettings.module.scss.js";
3
+ import N from "../../common/form/Select/Select.js";
4
+ import m from "../../common/form/Input/Input.js";
5
+ import b from "../../common/form/Toggle/Toggle.js";
6
+ import { NavLink as K } from "react-router";
7
+ import Q from "./PlanNotificationSettingsTester.js";
8
+ import v from "../../common/Icon/Icon.js";
9
+ const el = ({
10
+ planID: k,
11
+ isSync: s,
12
+ types: x = [],
13
+ admin_email: y = "",
14
+ notificationSettings: l,
15
+ notificationType: V = "backup",
16
+ onUpdate: a
17
+ }) => {
18
+ var $, T, E, O, q, P, R, w, z, B, C, F, I, L, U, j, D, A, W, M, G, H, J;
19
+ const c = x.length > 0, X = !c && y ? y : "", Y = x.includes("ntfy"), Z = (r) => {
20
+ a({ ...l, email: { ...l.email, emails: r } });
21
+ }, p = [
22
+ { label: "On Start", value: "start" },
23
+ { label: "On End", value: "end" },
24
+ { label: "On Both Start & End", value: "both" },
25
+ { label: "On Success Only", value: "success" },
26
+ { label: "On Failure Only", value: "failure" }
27
+ ];
28
+ return /* @__PURE__ */ u(_, { children: [
29
+ /* @__PURE__ */ u("div", { className: d.notificationSettingsSection, children: [
30
+ /* @__PURE__ */ u("div", { className: `${d.field} ${d.notificationToggle}`, children: [
31
+ /* @__PURE__ */ e(v, { type: "email", size: 14 }),
32
+ /* @__PURE__ */ e(
33
+ b,
34
+ {
35
+ label: "Enable Email Notifications",
36
+ fieldValue: (($ = l == null ? void 0 : l.email) == null ? void 0 : $.enabled) || !1,
37
+ onUpdate: (r) => a({ ...l, email: { ...l.email, enabled: r } }),
38
+ hint: "Notify me via email when Backup fails or succeeds",
39
+ inline: !0
40
+ }
41
+ )
42
+ ] }),
43
+ ((T = l == null ? void 0 : l.email) == null ? void 0 : T.enabled) && /* @__PURE__ */ u("div", { className: d.notificationSettings, children: [
44
+ !s && /* @__PURE__ */ e("div", { className: d.field, children: /* @__PURE__ */ e(
45
+ N,
46
+ {
47
+ label: "Send Notification",
48
+ fieldValue: ((E = l == null ? void 0 : l.email) == null ? void 0 : E.case) || "failure",
49
+ options: p,
50
+ onUpdate: (r) => a({ ...l, email: { ...l.email, case: r } }),
51
+ inline: !0
52
+ }
53
+ ) }),
54
+ /* @__PURE__ */ u("div", { className: d.field, children: [
55
+ /* @__PURE__ */ e(
56
+ m,
57
+ {
58
+ label: "Email Addresses",
59
+ fieldValue: ((O = l == null ? void 0 : l.email) == null ? void 0 : O.emails) || X,
60
+ onUpdate: (r) => Z(r),
61
+ placeholder: "john@gmail.com, chris@icloud.com",
62
+ full: !0,
63
+ inline: !0,
64
+ required: !0,
65
+ disabled: !c,
66
+ error: (q = l == null ? void 0 : l.email) != null && q.emails ? void 0 : "Required"
67
+ }
68
+ ),
69
+ !c && /* @__PURE__ */ u("div", { className: d.fieldNotice, children: [
70
+ "⚠️ SMTP has not been setup yet. Set it up in ",
71
+ /* @__PURE__ */ e(K, { to: "/settings?t=integration", children: "Settings" }),
72
+ " to enable Email Notification."
73
+ ] })
74
+ ] })
75
+ ] })
23
76
  ] }),
24
- ((t = e == null ? void 0 : e.email) == null ? void 0 : t.enabled) && /* @__PURE__ */ i(b, { children: [
25
- d.method !== "sync" && /* @__PURE__ */ i("div", { className: s.field, children: [
26
- /* @__PURE__ */ a("label", { className: s.label, children: "Send Notification" }),
27
- /* @__PURE__ */ a(
28
- y,
77
+ /* @__PURE__ */ u("div", { className: d.notificationSettingsSection, children: [
78
+ /* @__PURE__ */ u("div", { className: `${d.field} ${d.notificationToggle}`, children: [
79
+ /* @__PURE__ */ e(v, { type: "slack", size: 14 }),
80
+ /* @__PURE__ */ e(
81
+ b,
29
82
  {
30
- fieldValue: ((u = e == null ? void 0 : e.email) == null ? void 0 : u.case) || "failure",
31
- options: [
32
- { label: "On Start", value: "start" },
33
- { label: "On End", value: "end" },
34
- { label: "On Both Start & End", value: "both" },
35
- { label: "On Success Only", value: "success" },
36
- { label: "On Failure Only", value: "failure" }
37
- ],
38
- onUpdate: (l) => r({ ...e, email: { ...e.email, case: l } })
83
+ label: "Enable Slack Notifications",
84
+ fieldValue: ((P = l == null ? void 0 : l.slack) == null ? void 0 : P.enabled) || !1,
85
+ onUpdate: (r) => {
86
+ var h;
87
+ return a({
88
+ ...l,
89
+ slack: { ...l.slack, enabled: r, url: ((h = l.slack) == null ? void 0 : h.url) || "" }
90
+ });
91
+ },
92
+ hint: "Send notifications to a Slack channel via webhook",
93
+ inline: !0
39
94
  }
40
95
  )
41
96
  ] }),
42
- /* @__PURE__ */ i("div", { className: s.field, children: [
43
- /* @__PURE__ */ a("label", { className: s.label, children: "Email Addresses" }),
44
- /* @__PURE__ */ a(
45
- O,
97
+ ((R = l == null ? void 0 : l.slack) == null ? void 0 : R.enabled) && /* @__PURE__ */ u("div", { className: d.notificationSettings, children: [
98
+ !s && /* @__PURE__ */ e("div", { className: d.field, children: /* @__PURE__ */ e(
99
+ N,
100
+ {
101
+ label: "Send Slack Notification",
102
+ fieldValue: ((w = l == null ? void 0 : l.slack) == null ? void 0 : w.case) || "failure",
103
+ options: p,
104
+ onUpdate: (r) => a({ ...l, slack: { ...l.slack, case: r } }),
105
+ inline: !0
106
+ }
107
+ ) }),
108
+ /* @__PURE__ */ e("div", { className: d.field, children: /* @__PURE__ */ e(
109
+ m,
46
110
  {
47
- fieldValue: ((h = e == null ? void 0 : e.email) == null ? void 0 : h.emails) || v,
48
- onUpdate: (l) => p(l),
49
- placeholder: "john@gmail.com, chris@icloud.com",
111
+ label: "Slack Webhook URL",
112
+ fieldValue: ((z = l == null ? void 0 : l.slack) == null ? void 0 : z.url) || "",
113
+ onUpdate: (r) => a({ ...l, slack: { ...l.slack, url: r } }),
114
+ placeholder: "https://hooks.slack.com/services/T00/B00/xxxx",
115
+ required: !0,
116
+ inline: !0,
50
117
  full: !0,
51
- disabled: !c,
52
- error: (f = e == null ? void 0 : e.email) != null && f.emails ? void 0 : "Required"
118
+ error: (B = l == null ? void 0 : l.slack) != null && B.enabled && !((C = l == null ? void 0 : l.slack) != null && C.url) ? "Required" : void 0
53
119
  }
54
- ),
55
- !c && /* @__PURE__ */ i("div", { className: s.fieldNotice, children: [
56
- "⚠️ SMTP has not been setup yet. Set it up in ",
57
- /* @__PURE__ */ a(j, { to: "/settings?t=integration", children: "Settings" }),
58
- " to enable Email Notification."
59
- ] })
120
+ ) }),
121
+ /* @__PURE__ */ e("div", { className: `${d.field} ${d.notificationTestField}`, children: /* @__PURE__ */ e(
122
+ Q,
123
+ {
124
+ planId: k || "",
125
+ notificationChannel: "slack",
126
+ notificationSettings: l,
127
+ notificationType: V
128
+ }
129
+ ) })
130
+ ] })
131
+ ] }),
132
+ /* @__PURE__ */ u("div", { className: d.notificationSettingsSection, children: [
133
+ /* @__PURE__ */ u("div", { className: `${d.field} ${d.notificationToggle}`, children: [
134
+ /* @__PURE__ */ e(v, { type: "discord", size: 14 }),
135
+ /* @__PURE__ */ e(
136
+ b,
137
+ {
138
+ label: "Send Discord Notifications",
139
+ fieldValue: ((F = l == null ? void 0 : l.discord) == null ? void 0 : F.enabled) || !1,
140
+ onUpdate: (r) => {
141
+ var h;
142
+ return a({
143
+ ...l,
144
+ discord: { ...l.discord, enabled: r, url: ((h = l.discord) == null ? void 0 : h.url) || "" }
145
+ });
146
+ },
147
+ hint: "Send notifications to a Discord channel via webhook",
148
+ inline: !0
149
+ }
150
+ )
151
+ ] }),
152
+ ((I = l == null ? void 0 : l.discord) == null ? void 0 : I.enabled) && /* @__PURE__ */ u("div", { className: d.notificationSettings, children: [
153
+ !s && /* @__PURE__ */ e("div", { className: d.field, children: /* @__PURE__ */ e(
154
+ N,
155
+ {
156
+ label: "Send Discord Notification",
157
+ fieldValue: ((L = l == null ? void 0 : l.discord) == null ? void 0 : L.case) || "failure",
158
+ options: p,
159
+ onUpdate: (r) => a({ ...l, discord: { ...l.discord, case: r } }),
160
+ inline: !0
161
+ }
162
+ ) }),
163
+ /* @__PURE__ */ e("div", { className: d.field, children: /* @__PURE__ */ e(
164
+ m,
165
+ {
166
+ label: "Discord Webhook URL",
167
+ fieldValue: ((U = l == null ? void 0 : l.discord) == null ? void 0 : U.url) || "",
168
+ onUpdate: (r) => a({ ...l, discord: { ...l.discord, url: r } }),
169
+ placeholder: "https://discord.com/api/webhooks/xxxx/xxxx",
170
+ required: !0,
171
+ inline: !0,
172
+ full: !0,
173
+ error: (j = l == null ? void 0 : l.discord) != null && j.enabled && !((D = l == null ? void 0 : l.discord) != null && D.url) ? "Required" : void 0
174
+ }
175
+ ) }),
176
+ /* @__PURE__ */ e("div", { className: `${d.field} ${d.notificationTestField}`, children: /* @__PURE__ */ e(
177
+ Q,
178
+ {
179
+ planId: k || "",
180
+ notificationChannel: "discord",
181
+ notificationType: V,
182
+ notificationSettings: l
183
+ }
184
+ ) })
60
185
  ] })
186
+ ] }),
187
+ /* @__PURE__ */ u("div", { className: d.notificationSettingsSection, children: [
188
+ /* @__PURE__ */ u("div", { className: `${d.field} ${d.notificationToggle}`, children: [
189
+ /* @__PURE__ */ e(v, { type: "ntfy", size: 14 }),
190
+ /* @__PURE__ */ e(
191
+ b,
192
+ {
193
+ label: "Enable Ntfy Push Notifications",
194
+ fieldValue: ((A = l == null ? void 0 : l.push) == null ? void 0 : A.enabled) || !1,
195
+ onUpdate: (r) => a({ ...l, push: { ...l.push, enabled: r } }),
196
+ hint: "Send me Push Notifications on Backup failure or success.",
197
+ inline: !0
198
+ }
199
+ )
200
+ ] }),
201
+ ((W = l.push) == null ? void 0 : W.enabled) && (Y ? /* @__PURE__ */ u("div", { className: d.notificationSettings, children: [
202
+ !s && /* @__PURE__ */ e("div", { className: d.field, children: /* @__PURE__ */ e(
203
+ N,
204
+ {
205
+ label: "Send Notification On",
206
+ fieldValue: ((M = l == null ? void 0 : l.push) == null ? void 0 : M.case) || "failure",
207
+ options: p,
208
+ onUpdate: (r) => a({
209
+ ...l,
210
+ push: { ...l.push, case: r }
211
+ }),
212
+ inline: !0
213
+ }
214
+ ) }),
215
+ /* @__PURE__ */ e("div", { className: d.field, children: /* @__PURE__ */ e(
216
+ m,
217
+ {
218
+ label: "Ntfy Push URL",
219
+ fieldValue: ((G = l == null ? void 0 : l.push) == null ? void 0 : G.url) || "",
220
+ onUpdate: (r) => a({ ...l, push: { ...l.push, url: r } }),
221
+ placeholder: "https://ntfy.sh/mytopic",
222
+ inline: !0,
223
+ required: !0,
224
+ full: !0,
225
+ error: (H = l == null ? void 0 : l.push) != null && H.url ? void 0 : "Required"
226
+ }
227
+ ) }),
228
+ /* @__PURE__ */ e("div", { className: d.field, children: /* @__PURE__ */ e(
229
+ m,
230
+ {
231
+ label: "Tags",
232
+ fieldValue: ((J = l == null ? void 0 : l.push) == null ? void 0 : J.tags) || "",
233
+ onUpdate: (r) => a({ ...l, push: { ...l.push, tags: r } }),
234
+ placeholder: "warning, daily-backup",
235
+ inline: !0,
236
+ full: !0
237
+ }
238
+ ) })
239
+ ] }) : /* @__PURE__ */ e("div", { className: d.notificationSettings, children: /* @__PURE__ */ u("div", { className: d.fieldNotice, children: [
240
+ "⚠️ Ntfy Auth Token is not configured. Set it up in ",
241
+ /* @__PURE__ */ e(K, { to: "/settings?t=integration", children: "Settings" }),
242
+ " to enable Ntfy Push Notifications."
243
+ ] }) }))
61
244
  ] })
62
245
  ] });
63
246
  };
64
247
  export {
65
- B as default
248
+ el as default
66
249
  };
67
250
  //# sourceMappingURL=PlanNotificationSettings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlanNotificationSettings.js","sources":["../../../../src/components/Plan/PlanSettings/PlanNotificationSettings.tsx"],"sourcesContent":["import classes from './PlanSettings.module.scss';\r\nimport Select from '../../common/form/Select/Select';\r\nimport Input from '../../common/form/Input/Input';\r\nimport Toggle from '../../common/form/Toggle/Toggle';\r\nimport { NewPlanSettings, PlanNotificationCase } from '../../../@types/plans';\r\nimport { NavLink } from 'react-router';\r\n\r\ninterface PlanNotificationSettingsProps {\r\n plan: NewPlanSettings;\r\n types: string[];\r\n admin_email?: string;\r\n onUpdate: (notificationSettings: NewPlanSettings['settings']['notification']) => void;\r\n}\r\n\r\nconst PlanNotificationSettings = ({ plan, types = [], admin_email = '', onUpdate }: PlanNotificationSettingsProps) => {\r\n const notificationSettings = plan.settings?.notification || {};\r\n\r\n const updateNotificationEmails = (emails: string) => {\r\n onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, emails } });\r\n };\r\n\r\n const hasConnectedIntegrations = types.length > 0;\r\n const defaultEmail = !hasConnectedIntegrations && admin_email ? admin_email : '';\r\n\r\n return (\r\n <>\r\n <div className={classes.field}>\r\n <label className={classes.label}>Notification</label>\r\n <Toggle\r\n fieldValue={notificationSettings?.email?.enabled || false}\r\n onUpdate={(val: boolean) => onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, enabled: val } })}\r\n description={plan.method === 'sync' ? 'Notify Me when Sync fails' : 'Notify Me when Backup fails or succeeds'}\r\n />\r\n </div>\r\n {notificationSettings?.email?.enabled && (\r\n <>\r\n {plan.method !== 'sync' && (\r\n <div className={classes.field}>\r\n <label className={classes.label}>Send Notification</label>\r\n <Select\r\n fieldValue={notificationSettings?.email?.case || 'failure'}\r\n options={[\r\n { label: 'On Start', value: 'start' },\r\n { label: 'On End', value: 'end' },\r\n { label: 'On Both Start & End', value: 'both' },\r\n { label: 'On Success Only', value: 'success' },\r\n { label: 'On Failure Only', value: 'failure' },\r\n ]}\r\n onUpdate={(val: string) =>\r\n onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, case: val as PlanNotificationCase } })\r\n }\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <label className={classes.label}>Email Addresses</label>\r\n <Input\r\n fieldValue={notificationSettings?.email?.emails || defaultEmail}\r\n onUpdate={(val) => updateNotificationEmails(val)}\r\n placeholder=\"john@gmail.com, chris@icloud.com\"\r\n full={true}\r\n disabled={!hasConnectedIntegrations}\r\n error={!notificationSettings?.email?.emails ? 'Required' : undefined}\r\n />\r\n {!hasConnectedIntegrations && (\r\n <div className={classes.fieldNotice}>\r\n ⚠️ SMTP has not been setup yet. Set it up in <NavLink to={`/settings?t=integration`}>Settings</NavLink> to enable Email\r\n Notification.\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n )}\r\n </>\r\n );\r\n};\r\n\r\nexport default PlanNotificationSettings;\r\n"],"names":["PlanNotificationSettings","plan","types","admin_email","onUpdate","notificationSettings","_a","updateNotificationEmails","emails","hasConnectedIntegrations","defaultEmail","jsxs","Fragment","classes","jsx","Toggle","_b","val","_c","Select","_d","Input","_e","_f","NavLink"],"mappings":";;;;;;AAcA,MAAMA,IAA2B,CAAC,EAAE,MAAAC,GAAM,OAAAC,IAAQ,CAAA,GAAI,aAAAC,IAAc,IAAI,UAAAC,QAA8C;;AACnH,QAAMC,MAAuBC,IAAAL,EAAK,aAAL,gBAAAK,EAAe,iBAAgB,CAAA,GAEtDC,IAA2B,CAACC,MAAmB;AAClD,IAAAJ,EAAS,EAAE,GAAGC,GAAsB,OAAO,EAAE,GAAGA,EAAqB,OAAO,QAAAG,EAAA,GAAU;AAAA,EACzF,GAEMC,IAA2BP,EAAM,SAAS,GAC1CQ,IAAe,CAACD,KAA4BN,IAAcA,IAAc;AAE9E,SACG,gBAAAQ,EAAAC,GAAA,EACG,UAAA;AAAA,IAAA,gBAAAD,EAAC,OAAA,EAAI,WAAWE,EAAQ,OACrB,UAAA;AAAA,MAAA,gBAAAC,EAAC,SAAA,EAAM,WAAWD,EAAQ,OAAO,UAAA,gBAAY;AAAA,MAC7C,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACE,cAAYC,IAAAX,KAAA,gBAAAA,EAAsB,UAAtB,gBAAAW,EAA6B,YAAW;AAAA,UACpD,UAAU,CAACC,MAAiBb,EAAS,EAAE,GAAGC,GAAsB,OAAO,EAAE,GAAGA,EAAqB,OAAO,SAASY,EAAA,GAAO;AAAA,UACxH,aAAahB,EAAK,WAAW,SAAS,8BAA8B;AAAA,QAAA;AAAA,MAAA;AAAA,IACvE,GACH;AAAA,MACCiB,IAAAb,KAAA,gBAAAA,EAAsB,UAAtB,gBAAAa,EAA6B,YAC3B,gBAAAP,EAAAC,GAAA,EACI,UAAA;AAAA,MAAAX,EAAK,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UACW,gBAAAC,EAACU,GAAA,EAAQ,IAAI,2BAA2B,UAAA,YAAQ;AAAA,UAAU;AAAA,QAAA,EAAA,CAE1G;AAAA,MAAA,EAAA,CAEN;AAAA,IAAA,EAAA,CACH;AAAA,EAAA,GAEN;AAEN;"}
1
+ {"version":3,"file":"PlanNotificationSettings.js","sources":["../../../../src/components/Plan/PlanSettings/PlanNotificationSettings.tsx"],"sourcesContent":["import classes from './PlanSettings.module.scss';\r\nimport Select from '../../common/form/Select/Select';\r\nimport Input from '../../common/form/Input/Input';\r\nimport Toggle from '../../common/form/Toggle/Toggle';\r\nimport { PlanNotification, PlanNotificationCase } from '../../../@types/plans';\r\nimport { NavLink } from 'react-router';\r\nimport PlanNotificationSettingsTester from './PlanNotificationSettingsTester';\r\nimport { Icon } from '../..';\r\n\r\ninterface PlanNotificationSettingsProps {\r\n types: string[];\r\n isSync: boolean;\r\n notificationType?: 'backup' | 'integrity';\r\n admin_email?: string;\r\n planID?: string;\r\n notificationSettings: PlanNotification;\r\n onUpdate: (notificationSettings: PlanNotification) => void;\r\n}\r\n\r\nconst PlanNotificationSettings = ({\r\n planID,\r\n isSync,\r\n types = [],\r\n admin_email = '',\r\n notificationSettings,\r\n notificationType = 'backup',\r\n onUpdate,\r\n}: PlanNotificationSettingsProps) => {\r\n const hasConnectedIntegrations = types.length > 0;\r\n const defaultEmail = !hasConnectedIntegrations && admin_email ? admin_email : '';\r\n const hasNtfyConnected = types.includes('ntfy');\r\n\r\n const updateNotificationEmails = (emails: string) => {\r\n onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, emails } });\r\n };\r\n\r\n const caseOptions = [\r\n { label: 'On Start', value: 'start' },\r\n { label: 'On End', value: 'end' },\r\n { label: 'On Both Start & End', value: 'both' },\r\n { label: 'On Success Only', value: 'success' },\r\n { label: 'On Failure Only', value: 'failure' },\r\n ];\r\n\r\n return (\r\n <>\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"email\" size={14} />\r\n <Toggle\r\n label=\"Enable Email Notifications\"\r\n fieldValue={notificationSettings?.email?.enabled || false}\r\n onUpdate={(val: boolean) => onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, enabled: val } })}\r\n hint={'Notify me via email when Backup fails or succeeds'}\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings?.email?.enabled && (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Notification\"\r\n fieldValue={notificationSettings?.email?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({ ...notificationSettings, email: { ...notificationSettings.email, case: val as PlanNotificationCase } })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Email Addresses\"\r\n fieldValue={notificationSettings?.email?.emails || defaultEmail}\r\n onUpdate={(val) => updateNotificationEmails(val)}\r\n placeholder=\"john@gmail.com, chris@icloud.com\"\r\n full={true}\r\n inline={true}\r\n required={true}\r\n disabled={!hasConnectedIntegrations}\r\n error={!notificationSettings?.email?.emails ? 'Required' : undefined}\r\n />\r\n {!hasConnectedIntegrations && (\r\n <div className={classes.fieldNotice}>\r\n ⚠️ SMTP has not been setup yet. Set it up in <NavLink to={`/settings?t=integration`}>Settings</NavLink> to enable Email\r\n Notification.\r\n </div>\r\n )}\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n\r\n {/* Slack Notification */}\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"slack\" size={14} />\r\n <Toggle\r\n label=\"Enable Slack Notifications\"\r\n fieldValue={notificationSettings?.slack?.enabled || false}\r\n onUpdate={(val: boolean) =>\r\n onUpdate({\r\n ...notificationSettings,\r\n slack: { ...notificationSettings.slack, enabled: val, url: notificationSettings.slack?.url || '' },\r\n })\r\n }\r\n hint=\"Send notifications to a Slack channel via webhook\"\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings?.slack?.enabled && (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Slack Notification\"\r\n fieldValue={notificationSettings?.slack?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({ ...notificationSettings, slack: { ...notificationSettings.slack, case: val as PlanNotificationCase } })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Slack Webhook URL\"\r\n fieldValue={notificationSettings?.slack?.url || ''}\r\n onUpdate={(val) => onUpdate({ ...notificationSettings, slack: { ...notificationSettings.slack, url: val } })}\r\n placeholder=\"https://hooks.slack.com/services/T00/B00/xxxx\"\r\n required={true}\r\n inline={true}\r\n full={true}\r\n error={notificationSettings?.slack?.enabled && !notificationSettings?.slack?.url ? 'Required' : undefined}\r\n />\r\n </div>\r\n <div className={`${classes.field} ${classes.notificationTestField}`}>\r\n <PlanNotificationSettingsTester\r\n planId={planID || ''}\r\n notificationChannel=\"slack\"\r\n notificationSettings={notificationSettings}\r\n notificationType={notificationType}\r\n />\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n\r\n {/* Discord Notification */}\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"discord\" size={14} />\r\n <Toggle\r\n label=\"Send Discord Notifications\"\r\n fieldValue={notificationSettings?.discord?.enabled || false}\r\n onUpdate={(val: boolean) =>\r\n onUpdate({\r\n ...notificationSettings,\r\n discord: { ...notificationSettings.discord, enabled: val, url: notificationSettings.discord?.url || '' },\r\n })\r\n }\r\n hint=\"Send notifications to a Discord channel via webhook\"\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings?.discord?.enabled && (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Discord Notification\"\r\n fieldValue={notificationSettings?.discord?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({ ...notificationSettings, discord: { ...notificationSettings.discord, case: val as PlanNotificationCase } })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Discord Webhook URL\"\r\n fieldValue={notificationSettings?.discord?.url || ''}\r\n onUpdate={(val) => onUpdate({ ...notificationSettings, discord: { ...notificationSettings.discord, url: val } })}\r\n placeholder=\"https://discord.com/api/webhooks/xxxx/xxxx\"\r\n required={true}\r\n inline={true}\r\n full={true}\r\n error={notificationSettings?.discord?.enabled && !notificationSettings?.discord?.url ? 'Required' : undefined}\r\n />\r\n </div>\r\n <div className={`${classes.field} ${classes.notificationTestField}`}>\r\n <PlanNotificationSettingsTester\r\n planId={planID || ''}\r\n notificationChannel=\"discord\"\r\n notificationType={notificationType}\r\n notificationSettings={notificationSettings}\r\n />\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n\r\n {/* Ntfy Push Notification */}\r\n <div className={classes.notificationSettingsSection}>\r\n <div className={`${classes.field} ${classes.notificationToggle}`}>\r\n <Icon type=\"ntfy\" size={14} />\r\n <Toggle\r\n label=\"Enable Ntfy Push Notifications\"\r\n fieldValue={notificationSettings?.push?.enabled || false}\r\n onUpdate={(val: boolean) => onUpdate({ ...notificationSettings, push: { ...notificationSettings.push, enabled: val } })}\r\n hint={`Send me Push Notifications on Backup failure or success.`}\r\n inline={true}\r\n />\r\n </div>\r\n {notificationSettings.push?.enabled &&\r\n (hasNtfyConnected ? (\r\n <div className={classes.notificationSettings}>\r\n {!isSync && (\r\n <div className={classes.field}>\r\n <Select\r\n label=\"Send Notification On\"\r\n fieldValue={notificationSettings?.push?.case || 'failure'}\r\n options={caseOptions}\r\n onUpdate={(val: string) =>\r\n onUpdate({\r\n ...notificationSettings,\r\n push: { ...notificationSettings.push, case: val as PlanNotification['push']['case'] },\r\n })\r\n }\r\n inline={true}\r\n />\r\n </div>\r\n )}\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Ntfy Push URL\"\r\n fieldValue={notificationSettings?.push?.url || ''}\r\n onUpdate={(val) => onUpdate({ ...notificationSettings, push: { ...notificationSettings.push, url: val } })}\r\n placeholder=\"https://ntfy.sh/mytopic\"\r\n inline={true}\r\n required={true}\r\n full={true}\r\n error={!notificationSettings?.push?.url ? 'Required' : undefined}\r\n />\r\n </div>\r\n <div className={classes.field}>\r\n <Input\r\n label=\"Tags\"\r\n fieldValue={notificationSettings?.push?.tags || ''}\r\n onUpdate={(val) => onUpdate({ ...notificationSettings, push: { ...notificationSettings.push, tags: val } })}\r\n placeholder=\"warning, daily-backup\"\r\n inline={true}\r\n full={true}\r\n />\r\n </div>\r\n </div>\r\n ) : (\r\n <div className={classes.notificationSettings}>\r\n <div className={classes.fieldNotice}>\r\n ⚠️ Ntfy Auth Token is not configured. Set it up in <NavLink to={`/settings?t=integration`}>Settings</NavLink> to enable Ntfy\r\n Push Notifications.\r\n </div>\r\n </div>\r\n ))}\r\n </div>\r\n </>\r\n );\r\n};\r\n\r\nexport default PlanNotificationSettings;\r\n"],"names":["PlanNotificationSettings","planID","isSync","types","admin_email","notificationSettings","notificationType","onUpdate","hasConnectedIntegrations","defaultEmail","hasNtfyConnected","updateNotificationEmails","emails","caseOptions","jsxs","Fragment","classes","jsx","Icon","Toggle","_a","val","_b","Select","_c","Input","_d","_e","NavLink","_f","_g","_h","_i","_j","_k","PlanNotificationSettingsTester","_l","_m","_n","_o","_p","_q","_r","_s","_t","_u","_v","_w"],"mappings":";;;;;;;;AAmBA,MAAMA,KAA2B,CAAC;AAAA,EAC/B,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC,IAAQ,CAAA;AAAA,EACR,aAAAC,IAAc;AAAA,EACd,sBAAAC;AAAA,EACA,kBAAAC,IAAmB;AAAA,EACnB,UAAAC;AACH,MAAqC;;AAClC,QAAMC,IAA2BL,EAAM,SAAS,GAC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({ planId, notificationChannel, notificationSettings, notificationType, }: {
3
+ planId: string;
4
+ notificationType?: "backup" | "integrity";
5
+ notificationChannel: "webhook" | "slack" | "discord";
6
+ notificationSettings: NewPlanSettings["settings"]["notification"];
7
+ }) => import("react/jsx-runtime").JSX.Element;
8
+ export default PlanNotificationSettingsTester;
9
+ //# sourceMappingURL=PlanNotificationSettingsTester.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanNotificationSettingsTester.d.ts","sourceRoot":"","sources":["../../../../src/components/Plan/PlanSettings/PlanNotificationSettingsTester.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAwB,MAAM,UAAU,CAAC;AAIjE,QAAA,MAAM,8BAA8B,GAAI,0EAKrC;IACA,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC1C,mBAAmB,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACrD,oBAAoB,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,CAAC;CACpE,4CAgEA,CAAC;AAEF,eAAe,8BAA8B,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import { toast as n } from "react-toastify";
3
+ import { useState as T } from "react";
4
+ import { useTestNotification as k } from "../../../services/plans.js";
5
+ import b from "../../common/Icon/Icon.js";
6
+ import r from "./PlanSettings.module.scss.js";
7
+ import { isValidURL as y } from "../../../utils/helpers.js";
8
+ const w = ({
9
+ planId: s,
10
+ notificationChannel: i,
11
+ notificationSettings: f,
12
+ notificationType: d = "backup"
13
+ }) => {
14
+ const [a, l] = T(!1), m = k(), t = f[i], u = d === "integrity", o = (N) => {
15
+ if (l(!1), !s)
16
+ return n.error("Test notification can be sent after creating the Plan");
17
+ if (!(t != null && t.url) || !y(t.url))
18
+ return n.error("Please enter a valid URL to send test notifications");
19
+ n.promise(
20
+ m.mutateAsync({
21
+ planId: s,
22
+ notificationCase: N,
23
+ notificationChannel: i,
24
+ channelSettings: t
25
+ }),
26
+ {
27
+ pending: `Sending Test Request to your ${i}...`,
28
+ success: "Test Request Sent Successfully!",
29
+ error: {
30
+ render({ data: p }) {
31
+ return p.message || "Failed to send test request";
32
+ }
33
+ }
34
+ }
35
+ );
36
+ };
37
+ return /* @__PURE__ */ c("div", { className: r.testNotificationContainer, children: [
38
+ /* @__PURE__ */ c(
39
+ "button",
40
+ {
41
+ onClick: () => u ? o("integrity_failure") : l(!a),
42
+ className: `${r.testNotificationButton} ${t != null && t.url ? "" : r.disabled}`,
43
+ disabled: !(t != null && t.url) || !s,
44
+ title: s ? t != null && t.url ? void 0 : `Enter ${i === "webhook" ? "the" : i.charAt(0).toUpperCase() + i.slice(1)} Webhook URL to send test notifications` : "Create the Plan first to send test notifications",
45
+ children: [
46
+ /* @__PURE__ */ e(b, { type: "send", size: 12 }),
47
+ " Send Test Request"
48
+ ]
49
+ }
50
+ ),
51
+ !u && a && /* @__PURE__ */ e("div", { className: r.testNotificationOptions, children: /* @__PURE__ */ c("ul", { children: [
52
+ /* @__PURE__ */ e("li", { onClick: () => o("start"), children: "Start Notification" }),
53
+ /* @__PURE__ */ e("li", { onClick: () => o("end"), children: "End Notification" }),
54
+ /* @__PURE__ */ e("li", { onClick: () => o("success"), children: "Success Notification" }),
55
+ /* @__PURE__ */ e("li", { onClick: () => o("failure"), children: "Failure Notification" })
56
+ ] }) })
57
+ ] });
58
+ };
59
+ export {
60
+ w as default
61
+ };
62
+ //# sourceMappingURL=PlanNotificationSettingsTester.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlanNotificationSettingsTester.js","sources":["../../../../src/components/Plan/PlanSettings/PlanNotificationSettingsTester.tsx"],"sourcesContent":["import { toast } from 'react-toastify';\r\nimport { useState } from 'react';\r\nimport { useTestNotification } from '../../../services';\r\nimport { Icon } from '../..';\r\nimport { NewPlanSettings, PlanNotificationCase } from '../../..';\r\nimport classes from './PlanSettings.module.scss';\r\nimport { isValidURL } from '../../../utils';\r\n\r\nconst PlanNotificationSettingsTester = ({\r\n planId,\r\n notificationChannel,\r\n notificationSettings,\r\n notificationType = 'backup',\r\n}: {\r\n planId: string;\r\n notificationType?: 'backup' | 'integrity';\r\n notificationChannel: 'webhook' | 'slack' | 'discord';\r\n notificationSettings: NewPlanSettings['settings']['notification'];\r\n}) => {\r\n const [showTestNotificationOptions, setShowTestNotificationOptions] = useState(false);\r\n const testNotificationMutation = useTestNotification();\r\n const channelSettings = notificationSettings[notificationChannel as 'webhook' | 'slack' | 'discord'];\r\n const integrityNotification = notificationType === 'integrity';\r\n\r\n const sendTestNotification = (notificationCase: PlanNotificationCase | 'integrity_failure') => {\r\n setShowTestNotificationOptions(false);\r\n if (!planId) {\r\n return toast.error('Test notification can be sent after creating the Plan');\r\n }\r\n if (!channelSettings?.url || !isValidURL(channelSettings.url)) {\r\n return toast.error(`Please enter a valid URL to send test notifications`);\r\n }\r\n\r\n toast.promise(\r\n testNotificationMutation.mutateAsync({\r\n planId,\r\n notificationCase: notificationCase,\r\n notificationChannel,\r\n channelSettings: channelSettings,\r\n }),\r\n {\r\n pending: `Sending Test Request to your ${notificationChannel}...`,\r\n success: 'Test Request Sent Successfully!',\r\n error: {\r\n render({ data }: any) {\r\n return data.message || 'Failed to send test request';\r\n },\r\n },\r\n },\r\n );\r\n };\r\n\r\n return (\r\n <div className={classes.testNotificationContainer}>\r\n <button\r\n onClick={() =>\r\n integrityNotification ? sendTestNotification('integrity_failure') : setShowTestNotificationOptions(!showTestNotificationOptions)\r\n }\r\n className={`${classes.testNotificationButton} ${!channelSettings?.url ? classes.disabled : ''}`}\r\n disabled={!channelSettings?.url || !planId}\r\n title={\r\n !planId\r\n ? 'Create the Plan first to send test notifications'\r\n : !channelSettings?.url\r\n ? `Enter ${notificationChannel === 'webhook' ? 'the' : notificationChannel.charAt(0).toUpperCase() + notificationChannel.slice(1)} Webhook URL to send test notifications`\r\n : undefined\r\n }\r\n >\r\n <Icon type=\"send\" size={12} /> Send Test Request\r\n </button>\r\n {!integrityNotification && showTestNotificationOptions && (\r\n <div className={classes.testNotificationOptions}>\r\n <ul>\r\n <li onClick={() => sendTestNotification('start')}>Start Notification</li>\r\n <li onClick={() => sendTestNotification('end')}>End Notification</li>\r\n <li onClick={() => sendTestNotification('success')}>Success Notification</li>\r\n <li onClick={() => sendTestNotification('failure')}>Failure Notification</li>\r\n </ul>\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default PlanNotificationSettingsTester;\r\n"],"names":["PlanNotificationSettingsTester","planId","notificationChannel","notificationSettings","notificationType","showTestNotificationOptions","setShowTestNotificationOptions","useState","testNotificationMutation","useTestNotification","channelSettings","integrityNotification","sendTestNotification","notificationCase","toast","isValidURL","data","jsxs","classes","jsx","Icon"],"mappings":";;;;;;;AAQA,MAAMA,IAAiC,CAAC;AAAA,EACrC,QAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,kBAAAC,IAAmB;AACtB,MAKM;AACH,QAAM,CAACC,GAA6BC,CAA8B,IAAIC,EAAS,EAAK,GAC9EC,IAA2BC,EAAA,GAC3BC,IAAkBP,EAAqBD,CAAsD,GAC7FS,IAAwBP,MAAqB,aAE7CQ,IAAuB,CAACC,MAAiE;AAE5F,QADAP,EAA+B,EAAK,GAChC,CAACL;AACF,aAAOa,EAAM,MAAM,uDAAuD;AAE7E,QAAI,EAACJ,KAAA,QAAAA,EAAiB,QAAO,CAACK,EAAWL,EAAgB,GAAG;AACzD,aAAOI,EAAM,MAAM,qDAAqD;AAG3E,IAAAA,EAAM;AAAA,MACHN,EAAyB,YAAY;AAAA,QAClC,QAAAP;AAAA,QACA,kBAAAY;AAAA,QACA,qBAAAX;AAAA,QACA,iBAAAQ;AAAA,MAAA,CACF;AAAA,MACD;AAAA,QACG,SAAS,gCAAgCR,CAAmB;AAAA,QAC5D,SAAS;AAAA,QACT,OAAO;AAAA,UACJ,OAAO,EAAE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({ plan: c, onUpdate: t }) => {
82
82
  onUpdate: (a) => t({ ...e, keepWeeklySnaps: a })
83
83
  }
84
84
  ),
85
- /* @__PURE__ */ l("span", { children: "Days" })
85
+ /* @__PURE__ */ l("span", { children: "Weeks" })
86
86
  ] }),
87
87
  /* @__PURE__ */ s("div", { className: i.customPolicyOption, children: [
88
88
  /* @__PURE__ */ l("span", { children: "Keep Monthly Backups for " }),
@@ -93,7 +93,7 @@ const b = ({ plan: c, onUpdate: t }) => {
93
93
  onUpdate: (a) => t({ ...e, keepMonthlySnaps: a })
94
94
  }
95
95
  ),
96
- /* @__PURE__ */ l("span", { children: "Days" })
96
+ /* @__PURE__ */ l("span", { children: "Months" })
97
97
  ] })
98
98
  ] }) })
99
99
  ] });
@@ -1 +1 @@
1
- {"version":3,"file":"PlanPruneSettings.js","sources":["../../../../src/components/Plan/PlanSettings/PlanPruneSettings.tsx"],"sourcesContent":["import classes from './PlanSettings.module.scss';\r\nimport Select from '../../common/form/Select/Select';\r\nimport Input from '../../common/form/Input/Input';\r\nimport Tristate from '../../common/form/Tristate/Tristate';\r\nimport { NewPlanSettings } from '../../../@types/plans';\r\nimport NumberInput from '../../common/form/NumberInput/NumberInput';\r\n\r\ninterface PlanPruneSettingsProps {\r\n plan: NewPlanSettings;\r\n onUpdate: (pruneSettings: NewPlanSettings['settings']['prune']) => void;\r\n}\r\n\r\nconst PlanPruneSettings = ({ plan, onUpdate }: PlanPruneSettingsProps) => {\r\n const pruneSettings = plan.settings?.prune;\r\n\r\n return (\r\n <>\r\n <div className={classes.field}>\r\n <label className={classes.label}>Backup Retention Policy</label>\r\n <Select\r\n options={[\r\n { label: 'Remove by Age', value: 'forgetByAge' },\r\n { label: 'Remove by Date', value: 'forgetByDate' },\r\n { label: 'Custom Prune Policy', value: 'custom' },\r\n ]}\r\n fieldValue={pruneSettings.policy}\r\n onUpdate={(val: string) => onUpdate({ ...pruneSettings, policy: val })}\r\n />\r\n </div>\r\n {pruneSettings.policy === 'forgetByAge' && (\r\n <div className={classes.field}>\r\n <label className={classes.label}>Remove Backups Older Than</label>\r\n <div className={classes.forgetByAgeField}>\r\n <NumberInput\r\n fieldValue={pruneSettings.forgetAge ? parseInt(pruneSettings.forgetAge.replace(/\\D/g, ''), 10) : 3}\r\n onUpdate={(val) =>\r\n onUpdate({\r\n ...pruneSettings,\r\n forgetAge: (pruneSettings.forgetAge || '3m').replace(/\\d+/g, val.toString()),\r\n })\r\n }\r\n placeholder=\"5\"\r\n min={1}\r\n full={true}\r\n />\r\n <Tristate\r\n fieldValue={(pruneSettings.forgetAge || '3m').replace(/\\d/g, '')}\r\n options={[\r\n { label: 'Days', value: 'd' },\r\n { label: 'Weeks', value: 'w' },\r\n { label: 'Months', value: 'm' },\r\n ]}\r\n onUpdate={(val: string) =>\r\n onUpdate({\r\n ...pruneSettings,\r\n forgetAge: (pruneSettings.forgetAge || '3m').replace(/\\D/g, val),\r\n })\r\n }\r\n />\r\n </div>\r\n </div>\r\n )}\r\n {pruneSettings.policy === 'forgetByDate' && (\r\n <div className={classes.field} style={{ width: '200px' }}>\r\n <label className={classes.label}>Remove Backups Older Than</label>\r\n <Input type=\"date\" fieldValue={pruneSettings.forgetDate || ''} onUpdate={(val) => onUpdate({ ...pruneSettings, forgetDate: val })} />\r\n </div>\r\n )}\r\n {pruneSettings.policy === 'custom' && (\r\n <>\r\n <div className={classes.field}>\r\n <label className={classes.label}>Custom Policy Settings</label>\r\n <div className={classes.customPolicyOption}>\r\n <span>Keep Daily Backups for </span>\r\n <NumberInput\r\n fieldValue={pruneSettings.keepDailySnaps || ''}\r\n onUpdate={(val) => onUpdate({ ...pruneSettings, keepDailySnaps: val })}\r\n />\r\n <span>Days</span>\r\n </div>\r\n <div className={classes.customPolicyOption}>\r\n <span>Keep Weekly Backups for </span>\r\n <NumberInput\r\n fieldValue={pruneSettings.keepWeeklySnaps || ''}\r\n onUpdate={(val) => onUpdate({ ...pruneSettings, keepWeeklySnaps: val })}\r\n />\r\n <span>Days</span>\r\n </div>\r\n <div className={classes.customPolicyOption}>\r\n <span>Keep Monthly Backups for </span>\r\n <NumberInput\r\n fieldValue={pruneSettings.keepMonthlySnaps || ''}\r\n onUpdate={(val) => onUpdate({ ...pruneSettings, keepMonthlySnaps: val })}\r\n />\r\n <span>Days</span>\r\n </div>\r\n </div>\r\n </>\r\n )}\r\n </>\r\n );\r\n};\r\n\r\nexport default PlanPruneSettings;\r\n"],"names":["PlanPruneSettings","plan","onUpdate","pruneSettings","_a","jsxs","Fragment","classes","jsx","Select","val","NumberInput","Tristate","Input"],"mappings":";;;;;;AAYA,MAAMA,IAAoB,CAAC,EAAE,MAAAC,GAAM,UAAAC,QAAuC;;AACvE,QAAMC,KAAgBC,IAAAH,EAAK,aAAL,gBAAAG,EAAe;AAErC,SACG,gBAAAC,EAAAC,GAAA,EACG,UAAA;AAAA,IAAA,gBAAAD,EAAC,OAAA,EAAI,WAAWE,EAAQ,OACrB,UAAA;AAAA,MAAA,gBAAAC,EAAC,SAAA,EAAM,WAAWD,EAAQ,OAAO,UAAA,2BAAuB;AAAA,MACxD,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACE,SAAS;AAAA,YACN,EAAE,OAAO,iBAAiB,OAAO,cAAA;AAAA,YACjC,EAAE,OAAO,kBAAkB,OAAO,eAAA;AAAA,YAClC,EAAE,OAAO,uBAAuB,OAAO,SAAA;AAAA,UAAS;AAAA,UAEnD,YAAYN,EAAc;AAAA,UAC1B,UAAU,CAACO,MAAgBR,EAAS,EAAE,GAAGC,GAAe,QAAQO,EAAA,CAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IACxE,GACH;AAAA,IACCP,EAAc,WAAW,mCACtB,OAAA,EAAI,WAAWI,EAAQ,OACrB,UAAA;AAAA,MAAA,gBAAAC,EAAC,SAAA,EAAM,WAAWD,EAAQ,OAAO,UAAA,6BAAyB;AAAA,MAC1D,gBAAAF,EAAC,OAAA,EAAI,WAAWE,EAAQ,kBACrB,UAAA;AAAA,QAAA,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AEN;AAEN;"}
1
+ {"version":3,"file":"PlanPruneSettings.js","sources":["../../../../src/components/Plan/PlanSettings/PlanPruneSettings.tsx"],"sourcesContent":["import classes from './PlanSettings.module.scss';\r\nimport Select from '../../common/form/Select/Select';\r\nimport Input from '../../common/form/Input/Input';\r\nimport Tristate from '../../common/form/Tristate/Tristate';\r\nimport { NewPlanSettings } from '../../../@types/plans';\r\nimport NumberInput from '../../common/form/NumberInput/NumberInput';\r\n\r\ninterface PlanPruneSettingsProps {\r\n plan: NewPlanSettings;\r\n onUpdate: (pruneSettings: NewPlanSettings['settings']['prune']) => void;\r\n}\r\n\r\nconst PlanPruneSettings = ({ plan, onUpdate }: PlanPruneSettingsProps) => {\r\n const pruneSettings = plan.settings?.prune;\r\n\r\n return (\r\n <>\r\n <div className={classes.field}>\r\n <label className={classes.label}>Backup Retention Policy</label>\r\n <Select\r\n options={[\r\n { label: 'Remove by Age', value: 'forgetByAge' },\r\n { label: 'Remove by Date', value: 'forgetByDate' },\r\n { label: 'Custom Prune Policy', value: 'custom' },\r\n ]}\r\n fieldValue={pruneSettings.policy}\r\n onUpdate={(val: string) => onUpdate({ ...pruneSettings, policy: val })}\r\n />\r\n </div>\r\n {pruneSettings.policy === 'forgetByAge' && (\r\n <div className={classes.field}>\r\n <label className={classes.label}>Remove Backups Older Than</label>\r\n <div className={classes.forgetByAgeField}>\r\n <NumberInput\r\n fieldValue={pruneSettings.forgetAge ? parseInt(pruneSettings.forgetAge.replace(/\\D/g, ''), 10) : 3}\r\n onUpdate={(val) =>\r\n onUpdate({\r\n ...pruneSettings,\r\n forgetAge: (pruneSettings.forgetAge || '3m').replace(/\\d+/g, val.toString()),\r\n })\r\n }\r\n placeholder=\"5\"\r\n min={1}\r\n full={true}\r\n />\r\n <Tristate\r\n fieldValue={(pruneSettings.forgetAge || '3m').replace(/\\d/g, '')}\r\n options={[\r\n { label: 'Days', value: 'd' },\r\n { label: 'Weeks', value: 'w' },\r\n { label: 'Months', value: 'm' },\r\n ]}\r\n onUpdate={(val: string) =>\r\n onUpdate({\r\n ...pruneSettings,\r\n forgetAge: (pruneSettings.forgetAge || '3m').replace(/\\D/g, val),\r\n })\r\n }\r\n />\r\n </div>\r\n </div>\r\n )}\r\n {pruneSettings.policy === 'forgetByDate' && (\r\n <div className={classes.field} style={{ width: '200px' }}>\r\n <label className={classes.label}>Remove Backups Older Than</label>\r\n <Input type=\"date\" fieldValue={pruneSettings.forgetDate || ''} onUpdate={(val) => onUpdate({ ...pruneSettings, forgetDate: val })} />\r\n </div>\r\n )}\r\n {pruneSettings.policy === 'custom' && (\r\n <>\r\n <div className={classes.field}>\r\n <label className={classes.label}>Custom Policy Settings</label>\r\n <div className={classes.customPolicyOption}>\r\n <span>Keep Daily Backups for </span>\r\n <NumberInput\r\n fieldValue={pruneSettings.keepDailySnaps || ''}\r\n onUpdate={(val) => onUpdate({ ...pruneSettings, keepDailySnaps: val })}\r\n />\r\n <span>Days</span>\r\n </div>\r\n <div className={classes.customPolicyOption}>\r\n <span>Keep Weekly Backups for </span>\r\n <NumberInput\r\n fieldValue={pruneSettings.keepWeeklySnaps || ''}\r\n onUpdate={(val) => onUpdate({ ...pruneSettings, keepWeeklySnaps: val })}\r\n />\r\n <span>Weeks</span>\r\n </div>\r\n <div className={classes.customPolicyOption}>\r\n <span>Keep Monthly Backups for </span>\r\n <NumberInput\r\n fieldValue={pruneSettings.keepMonthlySnaps || ''}\r\n onUpdate={(val) => onUpdate({ ...pruneSettings, keepMonthlySnaps: val })}\r\n />\r\n <span>Months</span>\r\n </div>\r\n </div>\r\n </>\r\n )}\r\n </>\r\n );\r\n};\r\n\r\nexport default PlanPruneSettings;\r\n"],"names":["PlanPruneSettings","plan","onUpdate","pruneSettings","_a","jsxs","Fragment","classes","jsx","Select","val","NumberInput","Tristate","Input"],"mappings":";;;;;;AAYA,MAAMA,IAAoB,CAAC,EAAE,MAAAC,GAAM,UAAAC,QAAuC;;AACvE,QAAMC,KAAgBC,IAAAH,EAAK,aAAL,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