strapi-plugin-magic-mail 2.10.0 → 2.10.2

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.
@@ -1,352 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { Loader, Box, Alert, Flex, Typography, Badge, Accordion } from "@strapi/design-system";
4
- import { useFetchClient, useNotification } from "@strapi/strapi/admin";
5
- import { ArrowPathIcon, DocumentDuplicateIcon, ArrowDownTrayIcon, UserIcon, ShieldCheckIcon, SparklesIcon, ChartBarIcon } from "@heroicons/react/24/outline";
6
- import styled, { css, keyframes } from "styled-components";
7
- import { S as SecondaryButton, W as WhiteOutlineButton } from "./StyledButtons-CdOf4Sps.mjs";
8
- const fadeIn = keyframes`
9
- from { opacity: 0; transform: translateY(10px); }
10
- to { opacity: 1; transform: translateY(0); }
11
- `;
12
- const shimmer = keyframes`
13
- 0% { background-position: -200% 0; }
14
- 100% { background-position: 200% 0; }
15
- `;
16
- const Container = styled(Box)`
17
- ${css`animation: ${fadeIn} 0.5s;`}
18
- max-width: 1400px;
19
- margin: 0 auto;
20
- `;
21
- const StickySaveBar = styled(Box)`
22
- position: sticky;
23
- top: 0;
24
- z-index: 10;
25
- background: ${(p) => p.theme.colors.neutral0};
26
- border-bottom: 1px solid rgba(128, 128, 128, 0.2);
27
- box-shadow: 0 1px 3px rgba(0,0,0,0.1);
28
- `;
29
- const LicenseKeyBanner = styled(Box)`
30
- background: linear-gradient(135deg, var(--colors-primary600, #0EA5E9) 0%, var(--colors-secondary500, #A855F7) 100%);
31
- border-radius: 12px;
32
- padding: 28px 32px;
33
- color: white;
34
- position: relative;
35
- overflow: hidden;
36
- box-shadow: 0 4px 20px rgba(14, 165, 233, 0.25);
37
- margin-bottom: 24px;
38
-
39
- &::after {
40
- content: '';
41
- position: absolute;
42
- top: -50%;
43
- right: -50%;
44
- width: 200%;
45
- height: 200%;
46
- background: linear-gradient(
47
- 45deg,
48
- transparent,
49
- rgba(255, 255, 255, 0.08),
50
- transparent
51
- );
52
- ${css`animation: ${shimmer} 3s infinite;`}
53
- pointer-events: none;
54
- z-index: 0;
55
- }
56
-
57
- & > * {
58
- position: relative;
59
- z-index: 1;
60
- }
61
- `;
62
- const LoaderContainer = styled(Flex)`
63
- min-height: 400px;
64
- align-items: center;
65
- justify-content: center;
66
- flex-direction: column;
67
- gap: 16px;
68
- `;
69
- const LicenseDetailsPage = () => {
70
- const { get } = useFetchClient();
71
- const { toggleNotification } = useNotification();
72
- const [loading, setLoading] = useState(true);
73
- const [licenseData, setLicenseData] = useState(null);
74
- const [error, setError] = useState(null);
75
- const fetchLicenseStatus = async () => {
76
- setLoading(true);
77
- setError(null);
78
- try {
79
- const response = await get("/magic-mail/license/status");
80
- setLicenseData(response.data);
81
- } catch (err) {
82
- console.error("[MagicMail] Error fetching license:", err);
83
- setError("Failed to load license information");
84
- } finally {
85
- setLoading(false);
86
- }
87
- };
88
- const handleCopyLicenseKey = async () => {
89
- try {
90
- await navigator.clipboard.writeText(licenseData?.data?.licenseKey || "");
91
- toggleNotification({
92
- type: "success",
93
- message: "License key copied to clipboard!"
94
- });
95
- } catch (err) {
96
- toggleNotification({
97
- type: "danger",
98
- message: "Failed to copy license key"
99
- });
100
- }
101
- };
102
- const handleDownloadLicenseKey = () => {
103
- try {
104
- const data2 = licenseData?.data || {};
105
- const licenseKey = data2.licenseKey || "";
106
- const email = data2.email || "N/A";
107
- const firstName = data2.firstName || "";
108
- const lastName = data2.lastName || "";
109
- const fullName = `${firstName} ${lastName}`.trim() || "N/A";
110
- const content = `MagicMail - Email Business Suite - License Key
111
- ===============================================
112
-
113
- License Key: ${licenseKey}
114
-
115
- License Holder Information:
116
- ----------------------------------------------
117
- Name: ${fullName}
118
- Email: ${email}
119
-
120
- License Status:
121
- ----------------------------------------------
122
- Status: ${data2.isActive ? "ACTIVE" : "INACTIVE"}
123
- Expires: ${data2.expiresAt ? new Date(data2.expiresAt).toLocaleDateString() : "Never"}
124
-
125
- Features:
126
- ----------------------------------------------
127
- Premium: ${data2.features?.premium ? "Enabled" : "Disabled"}
128
- Advanced: ${data2.features?.advanced ? "Enabled" : "Disabled"}
129
- Enterprise: ${data2.features?.enterprise ? "Enabled" : "Disabled"}
130
-
131
- ===============================================
132
- Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}
133
- `;
134
- const blob = new Blob([content], { type: "text/plain" });
135
- const url = window.URL.createObjectURL(blob);
136
- const link = document.createElement("a");
137
- link.href = url;
138
- link.download = `magicmail-license-${licenseKey.substring(0, 8)}.txt`;
139
- document.body.appendChild(link);
140
- link.click();
141
- document.body.removeChild(link);
142
- window.URL.revokeObjectURL(url);
143
- toggleNotification({
144
- type: "success",
145
- message: "License key downloaded successfully!"
146
- });
147
- } catch (err) {
148
- toggleNotification({
149
- type: "danger",
150
- message: "Failed to download license key"
151
- });
152
- }
153
- };
154
- useEffect(() => {
155
- fetchLicenseStatus();
156
- }, []);
157
- if (loading) {
158
- return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(LoaderContainer, { children: /* @__PURE__ */ jsx(Loader, { children: "Loading license information..." }) }) });
159
- }
160
- if (error) {
161
- return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Box, { padding: 8, children: /* @__PURE__ */ jsx(Alert, { variant: "danger", title: "Error", closeLabel: "Close", children: error }) }) });
162
- }
163
- const isValid = licenseData?.valid;
164
- const isDemo = licenseData?.demo;
165
- const data = licenseData?.data || {};
166
- return /* @__PURE__ */ jsxs(Container, { children: [
167
- /* @__PURE__ */ jsx(StickySaveBar, { paddingTop: 5, paddingBottom: 5, paddingLeft: 6, paddingRight: 6, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", children: [
168
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "flex-start", children: [
169
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", fontWeight: "bold", children: "License Management" }),
170
- /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: "View your MagicMail plugin license" })
171
- ] }),
172
- /* @__PURE__ */ jsx(
173
- SecondaryButton,
174
- {
175
- startIcon: /* @__PURE__ */ jsx(ArrowPathIcon, { style: { width: 18, height: 18 } }),
176
- onClick: fetchLicenseStatus,
177
- children: "Refresh Status"
178
- }
179
- )
180
- ] }) }),
181
- /* @__PURE__ */ jsxs(Box, { paddingTop: 6, paddingLeft: 6, paddingRight: 6, paddingBottom: 10, children: [
182
- isDemo ? /* @__PURE__ */ jsx(Alert, { variant: "warning", title: "Demo Mode", closeLabel: "Close", children: "You're using the demo version. Create a license to unlock all features." }) : isValid ? /* @__PURE__ */ jsx(Alert, { variant: "success", title: "License Active", closeLabel: "Close", children: "Your license is active and all features are unlocked." }) : /* @__PURE__ */ jsx(Alert, { variant: "danger", title: "License Issue", closeLabel: "Close", children: "There's an issue with your license. Please check your license status." }),
183
- data.licenseKey && /* @__PURE__ */ jsx(Box, { marginTop: 6, children: /* @__PURE__ */ jsx(LicenseKeyBanner, { children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", children: [
184
- /* @__PURE__ */ jsxs(Box, { style: { flex: 1 }, children: [
185
- /* @__PURE__ */ jsx(Typography, { variant: "pi", style: { color: "rgba(255,255,255,0.8)", marginBottom: "12px", textTransform: "uppercase", fontSize: "11px", letterSpacing: "0.5px", display: "block" }, children: "License Key" }),
186
- /* @__PURE__ */ jsx(Typography, { style: { color: "white", fontFamily: "monospace", fontSize: "28px", fontWeight: "bold", wordBreak: "break-all", marginBottom: "16px" }, children: data.licenseKey }),
187
- /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
188
- /* @__PURE__ */ jsx(
189
- WhiteOutlineButton,
190
- {
191
- onClick: handleCopyLicenseKey,
192
- startIcon: /* @__PURE__ */ jsx(DocumentDuplicateIcon, { style: { width: 16, height: 16 } }),
193
- size: "S",
194
- children: "Copy Key"
195
- }
196
- ),
197
- /* @__PURE__ */ jsx(
198
- WhiteOutlineButton,
199
- {
200
- onClick: handleDownloadLicenseKey,
201
- startIcon: /* @__PURE__ */ jsx(ArrowDownTrayIcon, { style: { width: 16, height: 16 } }),
202
- size: "S",
203
- children: "Download as TXT"
204
- }
205
- )
206
- ] })
207
- ] }),
208
- /* @__PURE__ */ jsx(
209
- Badge,
210
- {
211
- backgroundColor: data.isActive ? "success100" : "danger100",
212
- textColor: data.isActive ? "success700" : "danger700",
213
- style: { fontSize: "11px", fontWeight: "700", padding: "6px 12px", marginLeft: "16px", flexShrink: 0 },
214
- children: data.isActive ? "ACTIVE" : "INACTIVE"
215
- }
216
- )
217
- ] }) }) }),
218
- /* @__PURE__ */ jsx(Box, { marginTop: 6, children: /* @__PURE__ */ jsxs(Accordion.Root, { defaultValue: "account", collapsible: true, children: [
219
- /* @__PURE__ */ jsxs(Accordion.Item, { value: "account", children: [
220
- /* @__PURE__ */ jsx(Accordion.Header, { children: /* @__PURE__ */ jsx(Accordion.Trigger, { icon: () => /* @__PURE__ */ jsx(UserIcon, { style: { width: 16, height: 16 } }), children: "Account Information" }) }),
221
- /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Box, { padding: 6, children: /* @__PURE__ */ jsxs(Flex, { gap: 8, wrap: "wrap", children: [
222
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "200px" }, children: [
223
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Email Address" }),
224
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.email || "Not provided" })
225
- ] }),
226
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "200px" }, children: [
227
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "License Holder" }),
228
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.firstName && data.lastName ? `${data.firstName} ${data.lastName}` : "Not specified" })
229
- ] })
230
- ] }) }) })
231
- ] }),
232
- /* @__PURE__ */ jsxs(Accordion.Item, { value: "details", children: [
233
- /* @__PURE__ */ jsx(Accordion.Header, { children: /* @__PURE__ */ jsx(Accordion.Trigger, { icon: () => /* @__PURE__ */ jsx(ShieldCheckIcon, { style: { width: 16, height: 16 } }), children: "License Details" }) }),
234
- /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Box, { padding: 6, children: /* @__PURE__ */ jsxs(Flex, { gap: 8, wrap: "wrap", children: [
235
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "180px" }, children: [
236
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: data.isExpired ? "Expired On" : "Expires On" }),
237
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.expiresAt ? new Date(data.expiresAt).toLocaleDateString("en-US", {
238
- year: "numeric",
239
- month: "long",
240
- day: "numeric"
241
- }) : "Never" })
242
- ] }),
243
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "180px" }, children: [
244
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Device Name" }),
245
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.deviceName || "Unknown" })
246
- ] }),
247
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "180px" }, children: [
248
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "IP Address" }),
249
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.ipAddress || "Not detected" })
250
- ] })
251
- ] }) }) })
252
- ] }),
253
- /* @__PURE__ */ jsxs(Accordion.Item, { value: "features", children: [
254
- /* @__PURE__ */ jsx(Accordion.Header, { children: /* @__PURE__ */ jsx(Accordion.Trigger, { icon: () => /* @__PURE__ */ jsx(SparklesIcon, { style: { width: 16, height: 16 } }), children: "Features & Capabilities" }) }),
255
- /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsxs(Box, { padding: 6, children: [
256
- /* @__PURE__ */ jsxs(Flex, { gap: 3, style: { marginBottom: "32px" }, children: [
257
- /* @__PURE__ */ jsxs(
258
- Badge,
259
- {
260
- backgroundColor: data.features?.premium ? "success100" : "neutral100",
261
- textColor: data.features?.premium ? "success700" : "neutral600",
262
- style: { fontSize: "13px", fontWeight: "700", padding: "8px 16px" },
263
- children: [
264
- data.features?.premium ? "[OK]" : "[X]",
265
- " PREMIUM"
266
- ]
267
- }
268
- ),
269
- /* @__PURE__ */ jsxs(
270
- Badge,
271
- {
272
- backgroundColor: data.features?.advanced ? "primary100" : "neutral100",
273
- textColor: data.features?.advanced ? "primary700" : "neutral600",
274
- style: { fontSize: "13px", fontWeight: "700", padding: "8px 16px" },
275
- children: [
276
- data.features?.advanced ? "[OK]" : "[X]",
277
- " ADVANCED"
278
- ]
279
- }
280
- ),
281
- /* @__PURE__ */ jsxs(
282
- Badge,
283
- {
284
- backgroundColor: data.features?.enterprise ? "secondary100" : "neutral100",
285
- textColor: data.features?.enterprise ? "secondary700" : "neutral600",
286
- style: { fontSize: "13px", fontWeight: "700", padding: "8px 16px" },
287
- children: [
288
- data.features?.enterprise ? "[OK]" : "[X]",
289
- " ENTERPRISE"
290
- ]
291
- }
292
- )
293
- ] }),
294
- data.features?.premium && /* @__PURE__ */ jsxs(Box, { marginBottom: 5, padding: 5, background: "success50", hasRadius: true, children: [
295
- /* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "bold", textColor: "success700", style: { marginBottom: "16px" }, children: "Premium Features Active" }),
296
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
297
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "success700", children: "[OK] Gmail OAuth 2.0" }),
298
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "success700", children: "[OK] Microsoft 365 OAuth" }),
299
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "success700", children: "[OK] Smart Routing Rules" }),
300
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "success700", children: "[OK] Email Analytics" })
301
- ] })
302
- ] }),
303
- data.features?.advanced && /* @__PURE__ */ jsxs(Box, { marginBottom: 5, padding: 5, background: "primary50", hasRadius: true, children: [
304
- /* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "bold", textColor: "primary700", style: { marginBottom: "16px" }, children: "Advanced Features Active" }),
305
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
306
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "primary700", children: "[OK] DKIM Signing" }),
307
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "primary700", children: "[OK] Email Designer" }),
308
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "primary700", children: "[OK] List-Unsubscribe Headers" })
309
- ] })
310
- ] }),
311
- data.features?.enterprise && /* @__PURE__ */ jsxs(Box, { padding: 5, background: "secondary50", hasRadius: true, children: [
312
- /* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "bold", textColor: "secondary700", style: { marginBottom: "16px" }, children: "Enterprise Features Active" }),
313
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
314
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "secondary700", children: "[OK] Multi-tenant Management" }),
315
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "secondary700", children: "[OK] Compliance Reports" }),
316
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "secondary700", children: "[OK] Priority Support" })
317
- ] })
318
- ] })
319
- ] }) })
320
- ] }),
321
- /* @__PURE__ */ jsxs(Accordion.Item, { value: "status", children: [
322
- /* @__PURE__ */ jsx(Accordion.Header, { children: /* @__PURE__ */ jsx(Accordion.Trigger, { icon: () => /* @__PURE__ */ jsx(ChartBarIcon, { style: { width: 16, height: 16 } }), children: "System Status" }) }),
323
- /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Box, { padding: 6, children: /* @__PURE__ */ jsxs(Flex, { gap: 8, wrap: "wrap", children: [
324
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "150px" }, children: [
325
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "License Status" }),
326
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.isActive ? "Active" : "Inactive" })
327
- ] }),
328
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "150px" }, children: [
329
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Connection" }),
330
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.isOnline ? "Online" : "Offline" })
331
- ] }),
332
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "150px" }, children: [
333
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Last Sync" }),
334
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.lastPingAt ? new Date(data.lastPingAt).toLocaleTimeString() : "Never" })
335
- ] }),
336
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "150px" }, children: [
337
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Device Limit" }),
338
- /* @__PURE__ */ jsxs(Typography, { variant: "omega", fontWeight: "semiBold", children: [
339
- data.currentDevices || 0,
340
- " / ",
341
- data.maxDevices || 1
342
- ] })
343
- ] })
344
- ] }) }) })
345
- ] })
346
- ] }) })
347
- ] })
348
- ] });
349
- };
350
- export {
351
- LicenseDetailsPage as default
352
- };