strapi-plugin-magic-sessionmanager 4.7.2 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +380 -663
  3. package/dist/admin/Analytics-B6d-39Qh.js +420 -0
  4. package/dist/admin/Analytics-DxOWXHn8.mjs +418 -0
  5. package/dist/admin/App-ZsSGj7n8.mjs +1894 -0
  6. package/dist/admin/App-mRFV50K6.js +1896 -0
  7. package/dist/admin/License-BE6UQ_V3.mjs +443 -0
  8. package/dist/admin/License-DXt2oi6u.js +443 -0
  9. package/dist/admin/OnlineUsersWidget-CFvM3Vbp.js +273 -0
  10. package/dist/admin/OnlineUsersWidget-_tJ6aeWl.mjs +254 -0
  11. package/dist/admin/SectionCard-BlWv8CRt.js +54 -0
  12. package/dist/admin/SectionCard-D51bv4Hi.mjs +55 -0
  13. package/dist/admin/Settings-BUc12TP5.js +3570 -0
  14. package/dist/admin/Settings-dtW7cjTX.mjs +3568 -0
  15. package/dist/admin/de-BFKoGEVT.js +544 -0
  16. package/dist/admin/de-j0oZH9Pz.mjs +544 -0
  17. package/dist/admin/en-UY4Tb5tE.mjs +544 -0
  18. package/dist/admin/en-s7Ksdkcg.js +544 -0
  19. package/dist/admin/es-07OGMe_5.js +544 -0
  20. package/dist/admin/es-DGBcZwQy.mjs +544 -0
  21. package/dist/admin/fr-B6-DWhGO.mjs +544 -0
  22. package/dist/admin/fr-ETj_2UBY.js +544 -0
  23. package/dist/admin/index-C_SyRULc.mjs +1750 -0
  24. package/dist/admin/index-D4kEnXSp.js +1751 -0
  25. package/dist/admin/index.js +1 -1
  26. package/dist/admin/index.mjs +2 -2
  27. package/dist/admin/maskSensitiveValue-BWcSjow7.js +9 -0
  28. package/dist/admin/maskSensitiveValue-lLRhN_S7.mjs +10 -0
  29. package/dist/admin/pt-C7PwrQtV.js +544 -0
  30. package/dist/admin/pt-YMRLm9gx.mjs +544 -0
  31. package/dist/server/index.js +3555 -6350
  32. package/dist/server/index.mjs +3555 -6350
  33. package/package.json +30 -19
  34. package/pics/analytics.png +0 -0
  35. package/pics/dashboard-dark.png +0 -0
  36. package/pics/dashboard.png +0 -0
  37. package/pics/dashboardsessionmodal.png +0 -0
  38. package/pics/mobile-dashboard.png +0 -0
  39. package/pics/mobile-session.png +0 -0
  40. package/pics/sessioninfopanel.png +0 -0
  41. package/pics/settings1.png +0 -0
  42. package/pics/settings2.png +0 -0
  43. package/pics/widget.png +0 -0
  44. package/scripts/geoip-updater.cjs +266 -36
  45. package/scripts/update-geoip-db.mjs +3 -0
  46. package/dist/admin/Analytics-CsrpxJwQ.mjs +0 -497
  47. package/dist/admin/Analytics-D03ZNNMR.js +0 -499
  48. package/dist/admin/App-B2VCS3cz.js +0 -1481
  49. package/dist/admin/App-qxKnK7G2.mjs +0 -1479
  50. package/dist/admin/License-ClW7sZLR.mjs +0 -318
  51. package/dist/admin/License-fixnQ7wF.js +0 -320
  52. package/dist/admin/OnlineUsersWidget-mR_OMiwi.mjs +0 -185
  53. package/dist/admin/OnlineUsersWidget-qb9utPBy.js +0 -185
  54. package/dist/admin/Settings-U3V4eGMo.mjs +0 -2038
  55. package/dist/admin/Settings-gv2BF54w.js +0 -2040
  56. package/dist/admin/StyledButtons-Cz8oYhmc.mjs +0 -418
  57. package/dist/admin/StyledButtons-DDuxnYz8.js +0 -419
  58. package/dist/admin/de-BnqGCokx.js +0 -316
  59. package/dist/admin/de-JBE-iylO.mjs +0 -316
  60. package/dist/admin/en-BRmVwd8-.js +0 -316
  61. package/dist/admin/en-kQWtdEai.mjs +0 -316
  62. package/dist/admin/es-CH691xcL.js +0 -301
  63. package/dist/admin/es-DOQvBxih.mjs +0 -301
  64. package/dist/admin/fr-CLExO0w_.js +0 -301
  65. package/dist/admin/fr-CmfCpepX.mjs +0 -301
  66. package/dist/admin/index-B_lFjUAg.mjs +0 -551
  67. package/dist/admin/index-Duc7cR_d.js +0 -552
  68. package/dist/admin/pt-BJ_F0yNi.js +0 -301
  69. package/dist/admin/pt-BSzZdyAH.mjs +0 -301
  70. package/dist/admin/sessionStatus-D_fWEzgj.js +0 -11
  71. package/dist/admin/sessionStatus-kwggjEMw.mjs +0 -12
@@ -1,318 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { Loader, Box, Alert, Flex, Typography, Button, Badge, Accordion } from "@strapi/design-system";
4
- import { useFetchClient, useNotification } from "@strapi/strapi/admin";
5
- import { ArrowClockwise, Duplicate, Download, User, Shield, Sparkle, ChartBubble } from "@strapi/icons";
6
- import styled, { css, keyframes } from "styled-components";
7
- import { a as pluginId } from "./index-B_lFjUAg.mjs";
8
- const theme = {
9
- borderRadius: { lg: "12px" }
10
- };
11
- const fadeIn = keyframes`
12
- from { opacity: 0; transform: translateY(10px); }
13
- to { opacity: 1; transform: translateY(0); }
14
- `;
15
- const shimmer = keyframes`
16
- 0% { background-position: -200% 0; }
17
- 100% { background-position: 200% 0; }
18
- `;
19
- const Container = styled(Box)`
20
- ${css`animation: ${fadeIn} 0.5s;`}
21
- max-width: 1400px;
22
- margin: 0 auto;
23
- `;
24
- const StickySaveBar = styled(Box)`
25
- position: sticky;
26
- top: 0;
27
- z-index: 10;
28
- background: ${(p) => p.theme.colors.neutral0};
29
- border-bottom: 1px solid rgba(128, 128, 128, 0.2);
30
- box-shadow: 0 1px 3px rgba(0,0,0,0.1);
31
- `;
32
- const LicenseKeyBanner = styled(Box)`
33
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
34
- border-radius: ${theme.borderRadius.lg};
35
- padding: 28px 32px;
36
- color: white;
37
- position: relative;
38
- overflow: hidden;
39
- box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25);
40
- margin-bottom: 24px;
41
-
42
- &::after {
43
- content: '';
44
- position: absolute;
45
- top: -50%;
46
- right: -50%;
47
- width: 200%;
48
- height: 200%;
49
- background: linear-gradient(
50
- 45deg,
51
- transparent,
52
- rgba(255, 255, 255, 0.08),
53
- transparent
54
- );
55
- ${css`animation: ${shimmer} 3s infinite;`}
56
- pointer-events: none;
57
- z-index: 0;
58
- }
59
-
60
- & > * {
61
- position: relative;
62
- z-index: 1;
63
- }
64
- `;
65
- const LoaderContainer = styled(Flex)`
66
- min-height: 400px;
67
- align-items: center;
68
- justify-content: center;
69
- flex-direction: column;
70
- gap: 16px;
71
- `;
72
- const LicensePage = () => {
73
- const { get } = useFetchClient();
74
- const { toggleNotification } = useNotification();
75
- const [loading, setLoading] = useState(true);
76
- const [licenseData, setLicenseData] = useState(null);
77
- const [error, setError] = useState(null);
78
- const fetchLicenseStatus = async () => {
79
- setLoading(true);
80
- setError(null);
81
- try {
82
- const response = await get(`/${pluginId}/license/status`);
83
- setLicenseData(response.data);
84
- } catch (err) {
85
- console.error("[magic-sessionmanager/License] Error fetching license:", err);
86
- setError("Failed to load activation information");
87
- } finally {
88
- setLoading(false);
89
- }
90
- };
91
- const handleCopyLicenseKey = async () => {
92
- try {
93
- await navigator.clipboard.writeText(licenseData?.data?.licenseKey || "");
94
- toggleNotification({
95
- type: "success",
96
- message: "Activation key copied to clipboard!"
97
- });
98
- } catch (err) {
99
- toggleNotification({
100
- type: "danger",
101
- message: "Failed to copy activation key"
102
- });
103
- }
104
- };
105
- const handleDownloadLicenseKey = () => {
106
- try {
107
- const data2 = licenseData?.data || {};
108
- const licenseKey = data2.licenseKey || "";
109
- const email = data2.email || "N/A";
110
- const firstName = data2.firstName || "";
111
- const lastName = data2.lastName || "";
112
- const fullName = `${firstName} ${lastName}`.trim() || "N/A";
113
- const content = `Magic Session Manager - Optional Activation Key
114
- =======================================
115
-
116
- Activation Key: ${licenseKey}
117
-
118
- Activation Holder Information:
119
- ---------------------------------------
120
- Name: ${fullName}
121
- Email: ${email}
122
-
123
- Activation Status:
124
- ---------------------------------------
125
- Status: ${data2.isActive ? "ACTIVE" : "INACTIVE"}
126
- Expires: ${data2.expiresAt ? new Date(data2.expiresAt).toLocaleDateString() : "Never"}
127
-
128
- Features:
129
- ---------------------------------------
130
- All Session Manager features are included without a paid key.
131
-
132
- =======================================
133
- Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}
134
- `;
135
- const blob = new Blob([content], { type: "text/plain" });
136
- const url = window.URL.createObjectURL(blob);
137
- const link = document.createElement("a");
138
- link.href = url;
139
- link.download = `session-manager-activation-${licenseKey.substring(0, 8)}.txt`;
140
- document.body.appendChild(link);
141
- link.click();
142
- document.body.removeChild(link);
143
- window.URL.revokeObjectURL(url);
144
- toggleNotification({
145
- type: "success",
146
- message: "Activation key downloaded successfully!"
147
- });
148
- } catch (err) {
149
- toggleNotification({
150
- type: "danger",
151
- message: "Failed to download activation key"
152
- });
153
- }
154
- };
155
- useEffect(() => {
156
- fetchLicenseStatus();
157
- }, []);
158
- if (loading) {
159
- return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(LoaderContainer, { children: /* @__PURE__ */ jsx(Loader, { children: "Loading activation information..." }) }) });
160
- }
161
- if (error) {
162
- return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Box, { padding: 8, children: /* @__PURE__ */ jsx(Alert, { variant: "danger", title: "Error", closeLabel: "Close", children: error }) }) });
163
- }
164
- const isValid = licenseData?.valid;
165
- const data = licenseData?.data || {};
166
- const hasKey = licenseData?.hasKey ?? Boolean(data.licenseKey);
167
- return /* @__PURE__ */ jsxs(Container, { children: [
168
- /* @__PURE__ */ jsx(StickySaveBar, { paddingTop: 5, paddingBottom: 5, paddingLeft: 6, paddingRight: 6, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
169
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, children: [
170
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", fontWeight: "bold", children: "Optional Activation" }),
171
- /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: "Store and inspect an optional activation key. All features work without one." })
172
- ] }),
173
- /* @__PURE__ */ jsx(
174
- Button,
175
- {
176
- startIcon: /* @__PURE__ */ jsx(ArrowClockwise, {}),
177
- onClick: fetchLicenseStatus,
178
- size: "L",
179
- style: {
180
- background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
181
- color: "white",
182
- fontWeight: "600",
183
- border: "none"
184
- },
185
- children: "Refresh Status"
186
- }
187
- )
188
- ] }) }),
189
- /* @__PURE__ */ jsxs(Box, { paddingTop: 6, paddingLeft: 6, paddingRight: 6, paddingBottom: 10, children: [
190
- !hasKey ? /* @__PURE__ */ jsx(Alert, { variant: "default", title: "No Activation Key Stored", closeLabel: "Close", children: "All Session Manager features are available. An activation key is optional and only used for install tracking or display." }) : isValid ? /* @__PURE__ */ jsx(Alert, { variant: "success", title: "Activation Key Stored", closeLabel: "Close", children: "Your optional activation key is stored. All features remain available with or without this key." }) : /* @__PURE__ */ jsx(Alert, { variant: "warning", title: "Activation Check Failed", closeLabel: "Close", children: "The activation server could not verify this key. The plugin still keeps all features available." }),
191
- data.licenseKey && /* @__PURE__ */ jsx(Box, { marginTop: 6, children: /* @__PURE__ */ jsx(LicenseKeyBanner, { children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", children: [
192
- /* @__PURE__ */ jsxs(Box, { style: { flex: 1 }, children: [
193
- /* @__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: "Activation Key" }),
194
- /* @__PURE__ */ jsx(Typography, { style: { color: "white", fontFamily: "monospace", fontSize: "28px", fontWeight: "bold", wordBreak: "break-all", marginBottom: "16px" }, children: data.licenseKey }),
195
- /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
196
- /* @__PURE__ */ jsx(
197
- Button,
198
- {
199
- onClick: handleCopyLicenseKey,
200
- startIcon: /* @__PURE__ */ jsx(Duplicate, {}),
201
- size: "S",
202
- variant: "secondary",
203
- style: {
204
- backgroundColor: "rgba(255,255,255,0.2)",
205
- color: "white",
206
- border: "1px solid rgba(255,255,255,0.3)",
207
- fontWeight: "600"
208
- },
209
- children: "Copy Key"
210
- }
211
- ),
212
- /* @__PURE__ */ jsx(
213
- Button,
214
- {
215
- onClick: handleDownloadLicenseKey,
216
- startIcon: /* @__PURE__ */ jsx(Download, {}),
217
- size: "S",
218
- variant: "secondary",
219
- style: {
220
- backgroundColor: "rgba(255,255,255,0.2)",
221
- color: "white",
222
- border: "1px solid rgba(255,255,255,0.3)",
223
- fontWeight: "600"
224
- },
225
- children: "Download as TXT"
226
- }
227
- )
228
- ] })
229
- ] }),
230
- /* @__PURE__ */ jsx(
231
- Badge,
232
- {
233
- backgroundColor: data.isActive ? "success100" : "danger100",
234
- textColor: data.isActive ? "success700" : "danger700",
235
- style: { fontSize: "11px", fontWeight: "700", padding: "6px 12px", marginLeft: "16px", flexShrink: 0 },
236
- children: data.isActive ? "ACTIVE" : "INACTIVE"
237
- }
238
- )
239
- ] }) }) }),
240
- /* @__PURE__ */ jsx(Box, { marginTop: 6, children: /* @__PURE__ */ jsxs(Accordion.Root, { defaultValue: "account", collapsible: true, children: [
241
- /* @__PURE__ */ jsxs(Accordion.Item, { value: "account", children: [
242
- /* @__PURE__ */ jsx(Accordion.Header, { children: /* @__PURE__ */ jsx(Accordion.Trigger, { icon: User, children: "Account Information" }) }),
243
- /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Box, { padding: 6, children: /* @__PURE__ */ jsxs(Flex, { gap: 8, wrap: "wrap", children: [
244
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "200px" }, children: [
245
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Email Address" }),
246
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.email || "Not provided" })
247
- ] }),
248
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "200px" }, children: [
249
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Activation Holder" }),
250
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.firstName && data.lastName ? `${data.firstName} ${data.lastName}` : "Not specified" })
251
- ] })
252
- ] }) }) })
253
- ] }),
254
- /* @__PURE__ */ jsxs(Accordion.Item, { value: "details", children: [
255
- /* @__PURE__ */ jsx(Accordion.Header, { children: /* @__PURE__ */ jsx(Accordion.Trigger, { icon: Shield, children: "Activation Details" }) }),
256
- /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Box, { padding: 6, children: /* @__PURE__ */ jsxs(Flex, { gap: 8, wrap: "wrap", children: [
257
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "180px" }, children: [
258
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: data.isExpired ? "Expired On" : "Expires On" }),
259
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.expiresAt ? new Date(data.expiresAt).toLocaleDateString("en-US", {
260
- year: "numeric",
261
- month: "long",
262
- day: "numeric"
263
- }) : "Never" })
264
- ] }),
265
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "180px" }, children: [
266
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Device Name" }),
267
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.deviceName || "Unknown" })
268
- ] }),
269
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "180px" }, children: [
270
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "IP Address" }),
271
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.ipAddress || "Not detected" })
272
- ] })
273
- ] }) }) })
274
- ] }),
275
- /* @__PURE__ */ jsxs(Accordion.Item, { value: "features", children: [
276
- /* @__PURE__ */ jsx(Accordion.Header, { children: /* @__PURE__ */ jsx(Accordion.Trigger, { icon: Sparkle, children: "Features & Capabilities" }) }),
277
- /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Box, { padding: 6, children: /* @__PURE__ */ jsxs(Box, { padding: 5, background: "success50", hasRadius: true, style: { border: "2px solid rgba(34, 197, 94, 0.3)" }, children: [
278
- /* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "bold", textColor: "success700", style: { marginBottom: "16px", display: "block" }, children: "All Features Included" }),
279
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
280
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "success700", style: { fontSize: "14px" }, children: "IP geolocation tracking with country, city, and timezone" }),
281
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "success700", style: { fontSize: "14px" }, children: "Security scoring, VPN/proxy detection, and threat analysis" }),
282
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "success700", style: { fontSize: "14px" }, children: "Session analytics, CSV/JSON export, and real-time monitoring" }),
283
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "success700", style: { fontSize: "14px" }, children: "Email alerts, Discord/Slack webhooks, and geofencing" })
284
- ] })
285
- ] }) }) })
286
- ] }),
287
- /* @__PURE__ */ jsxs(Accordion.Item, { value: "status", children: [
288
- /* @__PURE__ */ jsx(Accordion.Header, { children: /* @__PURE__ */ jsx(Accordion.Trigger, { icon: ChartBubble, children: "System Status" }) }),
289
- /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Box, { padding: 6, children: /* @__PURE__ */ jsxs(Flex, { gap: 8, wrap: "wrap", children: [
290
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "150px" }, children: [
291
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Activation Status" }),
292
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.isActive ? "Active" : "Inactive" })
293
- ] }),
294
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "150px" }, children: [
295
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Connection" }),
296
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.isOnline ? "Online" : "Offline" })
297
- ] }),
298
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "150px" }, children: [
299
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Last Sync" }),
300
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", children: data.lastPingAt ? new Date(data.lastPingAt).toLocaleTimeString() : "Never" })
301
- ] }),
302
- /* @__PURE__ */ jsxs(Box, { style: { flex: "1", minWidth: "150px" }, children: [
303
- /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Device Limit" }),
304
- /* @__PURE__ */ jsxs(Typography, { variant: "omega", fontWeight: "semiBold", children: [
305
- data.currentDevices || 0,
306
- " / ",
307
- data.maxDevices || 1
308
- ] })
309
- ] })
310
- ] }) }) })
311
- ] })
312
- ] }) })
313
- ] })
314
- ] });
315
- };
316
- export {
317
- LicensePage as default
318
- };
@@ -1,320 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const react = require("react");
5
- const designSystem = require("@strapi/design-system");
6
- const admin = require("@strapi/strapi/admin");
7
- const icons = require("@strapi/icons");
8
- const styled = require("styled-components");
9
- const index = require("./index-Duc7cR_d.js");
10
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
12
- const theme = {
13
- borderRadius: { lg: "12px" }
14
- };
15
- const fadeIn = styled.keyframes`
16
- from { opacity: 0; transform: translateY(10px); }
17
- to { opacity: 1; transform: translateY(0); }
18
- `;
19
- const shimmer = styled.keyframes`
20
- 0% { background-position: -200% 0; }
21
- 100% { background-position: 200% 0; }
22
- `;
23
- const Container = styled__default.default(designSystem.Box)`
24
- ${styled.css`animation: ${fadeIn} 0.5s;`}
25
- max-width: 1400px;
26
- margin: 0 auto;
27
- `;
28
- const StickySaveBar = styled__default.default(designSystem.Box)`
29
- position: sticky;
30
- top: 0;
31
- z-index: 10;
32
- background: ${(p) => p.theme.colors.neutral0};
33
- border-bottom: 1px solid rgba(128, 128, 128, 0.2);
34
- box-shadow: 0 1px 3px rgba(0,0,0,0.1);
35
- `;
36
- const LicenseKeyBanner = styled__default.default(designSystem.Box)`
37
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
38
- border-radius: ${theme.borderRadius.lg};
39
- padding: 28px 32px;
40
- color: white;
41
- position: relative;
42
- overflow: hidden;
43
- box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25);
44
- margin-bottom: 24px;
45
-
46
- &::after {
47
- content: '';
48
- position: absolute;
49
- top: -50%;
50
- right: -50%;
51
- width: 200%;
52
- height: 200%;
53
- background: linear-gradient(
54
- 45deg,
55
- transparent,
56
- rgba(255, 255, 255, 0.08),
57
- transparent
58
- );
59
- ${styled.css`animation: ${shimmer} 3s infinite;`}
60
- pointer-events: none;
61
- z-index: 0;
62
- }
63
-
64
- & > * {
65
- position: relative;
66
- z-index: 1;
67
- }
68
- `;
69
- const LoaderContainer = styled__default.default(designSystem.Flex)`
70
- min-height: 400px;
71
- align-items: center;
72
- justify-content: center;
73
- flex-direction: column;
74
- gap: 16px;
75
- `;
76
- const LicensePage = () => {
77
- const { get } = admin.useFetchClient();
78
- const { toggleNotification } = admin.useNotification();
79
- const [loading, setLoading] = react.useState(true);
80
- const [licenseData, setLicenseData] = react.useState(null);
81
- const [error, setError] = react.useState(null);
82
- const fetchLicenseStatus = async () => {
83
- setLoading(true);
84
- setError(null);
85
- try {
86
- const response = await get(`/${index.pluginId}/license/status`);
87
- setLicenseData(response.data);
88
- } catch (err) {
89
- console.error("[magic-sessionmanager/License] Error fetching license:", err);
90
- setError("Failed to load activation information");
91
- } finally {
92
- setLoading(false);
93
- }
94
- };
95
- const handleCopyLicenseKey = async () => {
96
- try {
97
- await navigator.clipboard.writeText(licenseData?.data?.licenseKey || "");
98
- toggleNotification({
99
- type: "success",
100
- message: "Activation key copied to clipboard!"
101
- });
102
- } catch (err) {
103
- toggleNotification({
104
- type: "danger",
105
- message: "Failed to copy activation key"
106
- });
107
- }
108
- };
109
- const handleDownloadLicenseKey = () => {
110
- try {
111
- const data2 = licenseData?.data || {};
112
- const licenseKey = data2.licenseKey || "";
113
- const email = data2.email || "N/A";
114
- const firstName = data2.firstName || "";
115
- const lastName = data2.lastName || "";
116
- const fullName = `${firstName} ${lastName}`.trim() || "N/A";
117
- const content = `Magic Session Manager - Optional Activation Key
118
- =======================================
119
-
120
- Activation Key: ${licenseKey}
121
-
122
- Activation Holder Information:
123
- ---------------------------------------
124
- Name: ${fullName}
125
- Email: ${email}
126
-
127
- Activation Status:
128
- ---------------------------------------
129
- Status: ${data2.isActive ? "ACTIVE" : "INACTIVE"}
130
- Expires: ${data2.expiresAt ? new Date(data2.expiresAt).toLocaleDateString() : "Never"}
131
-
132
- Features:
133
- ---------------------------------------
134
- All Session Manager features are included without a paid key.
135
-
136
- =======================================
137
- Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}
138
- `;
139
- const blob = new Blob([content], { type: "text/plain" });
140
- const url = window.URL.createObjectURL(blob);
141
- const link = document.createElement("a");
142
- link.href = url;
143
- link.download = `session-manager-activation-${licenseKey.substring(0, 8)}.txt`;
144
- document.body.appendChild(link);
145
- link.click();
146
- document.body.removeChild(link);
147
- window.URL.revokeObjectURL(url);
148
- toggleNotification({
149
- type: "success",
150
- message: "Activation key downloaded successfully!"
151
- });
152
- } catch (err) {
153
- toggleNotification({
154
- type: "danger",
155
- message: "Failed to download activation key"
156
- });
157
- }
158
- };
159
- react.useEffect(() => {
160
- fetchLicenseStatus();
161
- }, []);
162
- if (loading) {
163
- return /* @__PURE__ */ jsxRuntime.jsx(Container, { children: /* @__PURE__ */ jsxRuntime.jsx(LoaderContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading activation information..." }) }) });
164
- }
165
- if (error) {
166
- return /* @__PURE__ */ jsxRuntime.jsx(Container, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "danger", title: "Error", closeLabel: "Close", children: error }) }) });
167
- }
168
- const isValid = licenseData?.valid;
169
- const data = licenseData?.data || {};
170
- const hasKey = licenseData?.hasKey ?? Boolean(data.licenseKey);
171
- return /* @__PURE__ */ jsxRuntime.jsxs(Container, { children: [
172
- /* @__PURE__ */ jsxRuntime.jsx(StickySaveBar, { paddingTop: 5, paddingBottom: 5, paddingLeft: 6, paddingRight: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
173
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, children: [
174
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", fontWeight: "bold", children: "Optional Activation" }),
175
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: "Store and inspect an optional activation key. All features work without one." })
176
- ] }),
177
- /* @__PURE__ */ jsxRuntime.jsx(
178
- designSystem.Button,
179
- {
180
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}),
181
- onClick: fetchLicenseStatus,
182
- size: "L",
183
- style: {
184
- background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
185
- color: "white",
186
- fontWeight: "600",
187
- border: "none"
188
- },
189
- children: "Refresh Status"
190
- }
191
- )
192
- ] }) }),
193
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingTop: 6, paddingLeft: 6, paddingRight: 6, paddingBottom: 10, children: [
194
- !hasKey ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "default", title: "No Activation Key Stored", closeLabel: "Close", children: "All Session Manager features are available. An activation key is optional and only used for install tracking or display." }) : isValid ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "success", title: "Activation Key Stored", closeLabel: "Close", children: "Your optional activation key is stored. All features remain available with or without this key." }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "warning", title: "Activation Check Failed", closeLabel: "Close", children: "The activation server could not verify this key. The plugin still keeps all features available." }),
195
- data.licenseKey && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(LicenseKeyBanner, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-start", children: [
196
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1 }, children: [
197
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", style: { color: "rgba(255,255,255,0.8)", marginBottom: "12px", textTransform: "uppercase", fontSize: "11px", letterSpacing: "0.5px", display: "block" }, children: "Activation Key" }),
198
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { style: { color: "white", fontFamily: "monospace", fontSize: "28px", fontWeight: "bold", wordBreak: "break-all", marginBottom: "16px" }, children: data.licenseKey }),
199
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
200
- /* @__PURE__ */ jsxRuntime.jsx(
201
- designSystem.Button,
202
- {
203
- onClick: handleCopyLicenseKey,
204
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {}),
205
- size: "S",
206
- variant: "secondary",
207
- style: {
208
- backgroundColor: "rgba(255,255,255,0.2)",
209
- color: "white",
210
- border: "1px solid rgba(255,255,255,0.3)",
211
- fontWeight: "600"
212
- },
213
- children: "Copy Key"
214
- }
215
- ),
216
- /* @__PURE__ */ jsxRuntime.jsx(
217
- designSystem.Button,
218
- {
219
- onClick: handleDownloadLicenseKey,
220
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
221
- size: "S",
222
- variant: "secondary",
223
- style: {
224
- backgroundColor: "rgba(255,255,255,0.2)",
225
- color: "white",
226
- border: "1px solid rgba(255,255,255,0.3)",
227
- fontWeight: "600"
228
- },
229
- children: "Download as TXT"
230
- }
231
- )
232
- ] })
233
- ] }),
234
- /* @__PURE__ */ jsxRuntime.jsx(
235
- designSystem.Badge,
236
- {
237
- backgroundColor: data.isActive ? "success100" : "danger100",
238
- textColor: data.isActive ? "success700" : "danger700",
239
- style: { fontSize: "11px", fontWeight: "700", padding: "6px 12px", marginLeft: "16px", flexShrink: 0 },
240
- children: data.isActive ? "ACTIVE" : "INACTIVE"
241
- }
242
- )
243
- ] }) }) }),
244
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Root, { defaultValue: "account", collapsible: true, children: [
245
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: "account", children: [
246
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { icon: icons.User, children: "Account Information" }) }),
247
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, wrap: "wrap", children: [
248
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: "1", minWidth: "200px" }, children: [
249
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Email Address" }),
250
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: data.email || "Not provided" })
251
- ] }),
252
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: "1", minWidth: "200px" }, children: [
253
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Activation Holder" }),
254
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: data.firstName && data.lastName ? `${data.firstName} ${data.lastName}` : "Not specified" })
255
- ] })
256
- ] }) }) })
257
- ] }),
258
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: "details", children: [
259
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { icon: icons.Shield, children: "Activation Details" }) }),
260
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, wrap: "wrap", children: [
261
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: "1", minWidth: "180px" }, children: [
262
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: data.isExpired ? "Expired On" : "Expires On" }),
263
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: data.expiresAt ? new Date(data.expiresAt).toLocaleDateString("en-US", {
264
- year: "numeric",
265
- month: "long",
266
- day: "numeric"
267
- }) : "Never" })
268
- ] }),
269
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: "1", minWidth: "180px" }, children: [
270
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Device Name" }),
271
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: data.deviceName || "Unknown" })
272
- ] }),
273
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: "1", minWidth: "180px" }, children: [
274
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "IP Address" }),
275
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: data.ipAddress || "Not detected" })
276
- ] })
277
- ] }) }) })
278
- ] }),
279
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: "features", children: [
280
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { icon: icons.Sparkle, children: "Features & Capabilities" }) }),
281
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 5, background: "success50", hasRadius: true, style: { border: "2px solid rgba(34, 197, 94, 0.3)" }, children: [
282
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", textColor: "success700", style: { marginBottom: "16px", display: "block" }, children: "All Features Included" }),
283
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
284
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "success700", style: { fontSize: "14px" }, children: "IP geolocation tracking with country, city, and timezone" }),
285
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "success700", style: { fontSize: "14px" }, children: "Security scoring, VPN/proxy detection, and threat analysis" }),
286
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "success700", style: { fontSize: "14px" }, children: "Session analytics, CSV/JSON export, and real-time monitoring" }),
287
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "success700", style: { fontSize: "14px" }, children: "Email alerts, Discord/Slack webhooks, and geofencing" })
288
- ] })
289
- ] }) }) })
290
- ] }),
291
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: "status", children: [
292
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { icon: icons.ChartBubble, children: "System Status" }) }),
293
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, wrap: "wrap", children: [
294
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: "1", minWidth: "150px" }, children: [
295
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Activation Status" }),
296
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: data.isActive ? "Active" : "Inactive" })
297
- ] }),
298
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: "1", minWidth: "150px" }, children: [
299
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Connection" }),
300
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: data.isOnline ? "Online" : "Offline" })
301
- ] }),
302
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: "1", minWidth: "150px" }, children: [
303
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Last Sync" }),
304
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: data.lastPingAt ? new Date(data.lastPingAt).toLocaleTimeString() : "Never" })
305
- ] }),
306
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: "1", minWidth: "150px" }, children: [
307
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", textTransform: "uppercase", style: { marginBottom: "8px", display: "block" }, children: "Device Limit" }),
308
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: [
309
- data.currentDevices || 0,
310
- " / ",
311
- data.maxDevices || 1
312
- ] })
313
- ] })
314
- ] }) }) })
315
- ] })
316
- ] }) })
317
- ] })
318
- ] });
319
- };
320
- exports.default = LicensePage;