strapi-plugin-magic-sessionmanager 4.2.15 → 4.3.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.
@@ -1,12 +1,378 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import { useIntl } from "react-intl";
4
- import { Flex, Loader, Typography, Button, Box, Badge, Accordion, Grid, SingleSelect, SingleSelectOption, Divider, Alert, TextInput, Toggle, NumberInput, Checkbox, Tabs } from "@strapi/design-system";
4
+ import { Button, Flex, Loader, Typography, Box, Badge, Accordion, Grid, SingleSelect, SingleSelectOption, Divider, Alert, TextInput, Toggle, NumberInput, Checkbox, Tabs } from "@strapi/design-system";
5
5
  import { useFetchClient, useNotification } from "@strapi/strapi/admin";
6
6
  import { Check, Information, Cog, Trash, Shield, Code, Duplicate, Mail } from "@strapi/icons";
7
7
  import styled, { css, keyframes } from "styled-components";
8
- import { a as pluginId, g as getTranslation } from "./index-CUSrDKCG.mjs";
9
- import { u as useLicense } from "./useLicense-xjKLHcVq.mjs";
8
+ import { a as pluginId, g as getTranslation } from "./index-Dpdcg2zl.mjs";
9
+ import { u as useLicense } from "./useLicense-CThICQyr.mjs";
10
+ const GradientButton = styled(Button)`
11
+ && {
12
+ background: linear-gradient(135deg, #0EA5E9 0%, #A855F7 100%);
13
+ color: white;
14
+ font-weight: 600;
15
+ border: none;
16
+ padding: 10px 20px;
17
+ min-height: 40px;
18
+ transition: all 0.2s ease;
19
+
20
+ &:hover:not(:disabled) {
21
+ background: linear-gradient(135deg, #0284C7 0%, #9333EA 100%);
22
+ transform: translateY(-1px);
23
+ box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
24
+ }
25
+
26
+ &:active:not(:disabled) {
27
+ transform: translateY(0);
28
+ }
29
+
30
+ &:disabled {
31
+ opacity: 0.6;
32
+ cursor: not-allowed;
33
+ }
34
+ }
35
+ `;
36
+ const SecondaryButton = styled(Button)`
37
+ && {
38
+ background: white;
39
+ color: #7C3AED;
40
+ font-weight: 600;
41
+ border: 2px solid transparent;
42
+ background-image: linear-gradient(white, white), linear-gradient(135deg, #0EA5E9 0%, #A855F7 100%);
43
+ background-origin: border-box;
44
+ background-clip: padding-box, border-box;
45
+ padding: 10px 20px;
46
+ min-height: 40px;
47
+ transition: all 0.2s ease;
48
+
49
+ &:hover:not(:disabled) {
50
+ background: linear-gradient(135deg, #0EA5E9 0%, #A855F7 100%);
51
+ background-clip: padding-box;
52
+ color: white;
53
+ transform: translateY(-1px);
54
+ box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
55
+ }
56
+
57
+ &:active:not(:disabled) {
58
+ transform: translateY(0);
59
+ }
60
+
61
+ &:disabled {
62
+ opacity: 0.6;
63
+ cursor: not-allowed;
64
+ }
65
+ }
66
+ `;
67
+ const TertiaryButton = styled(Button)`
68
+ && {
69
+ background: transparent;
70
+ color: #64748B;
71
+ font-weight: 500;
72
+ border: 1px solid #E2E8F0;
73
+ padding: 10px 20px;
74
+ min-height: 40px;
75
+ transition: all 0.2s ease;
76
+
77
+ &:hover:not(:disabled) {
78
+ background: #F1F5F9;
79
+ border-color: #CBD5E1;
80
+ color: #334155;
81
+ }
82
+
83
+ &:disabled {
84
+ opacity: 0.6;
85
+ cursor: not-allowed;
86
+ }
87
+ }
88
+ `;
89
+ const DangerButton = styled(Button)`
90
+ && {
91
+ background: #FEE2E2;
92
+ color: #DC2626;
93
+ font-weight: 600;
94
+ border: 1px solid #FECACA;
95
+ padding: 10px 20px;
96
+ min-height: 40px;
97
+ transition: all 0.2s ease;
98
+
99
+ &:hover:not(:disabled) {
100
+ background: #DC2626;
101
+ color: white;
102
+ border-color: #DC2626;
103
+ }
104
+
105
+ &:disabled {
106
+ opacity: 0.6;
107
+ cursor: not-allowed;
108
+ }
109
+ }
110
+ `;
111
+ styled(Button)`
112
+ && {
113
+ background: linear-gradient(135deg, #10B981 0%, #059669 100%);
114
+ color: white;
115
+ font-weight: 600;
116
+ border: none;
117
+ padding: 10px 20px;
118
+ min-height: 40px;
119
+ transition: all 0.2s ease;
120
+
121
+ &:hover:not(:disabled) {
122
+ background: linear-gradient(135deg, #059669 0%, #047857 100%);
123
+ transform: translateY(-1px);
124
+ box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
125
+ }
126
+
127
+ &:disabled {
128
+ opacity: 0.6;
129
+ cursor: not-allowed;
130
+ }
131
+ }
132
+ `;
133
+ styled(Button)`
134
+ && {
135
+ background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
136
+ color: #64748B;
137
+ border: 1px solid #E2E8F0;
138
+ padding: 8px;
139
+ min-width: 38px;
140
+ min-height: 38px;
141
+ width: 38px;
142
+ height: 38px;
143
+ border-radius: 10px;
144
+ display: flex;
145
+ align-items: center;
146
+ justify-content: center;
147
+ transition: all 0.2s ease;
148
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
149
+
150
+ svg {
151
+ width: 18px;
152
+ height: 18px;
153
+ }
154
+
155
+ &:hover:not(:disabled) {
156
+ background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
157
+ border-color: #0EA5E9;
158
+ color: white;
159
+ transform: translateY(-1px);
160
+ box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
161
+ }
162
+
163
+ &:disabled {
164
+ opacity: 0.6;
165
+ cursor: not-allowed;
166
+ }
167
+ }
168
+ `;
169
+ styled(Button)`
170
+ && {
171
+ background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
172
+ color: #EF4444;
173
+ border: 1px solid #FECACA;
174
+ padding: 8px;
175
+ min-width: 38px;
176
+ min-height: 38px;
177
+ width: 38px;
178
+ height: 38px;
179
+ border-radius: 10px;
180
+ display: flex;
181
+ align-items: center;
182
+ justify-content: center;
183
+ transition: all 0.2s ease;
184
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
185
+
186
+ svg {
187
+ width: 18px;
188
+ height: 18px;
189
+ }
190
+
191
+ &:hover:not(:disabled) {
192
+ background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
193
+ border-color: #EF4444;
194
+ color: white;
195
+ transform: translateY(-1px);
196
+ box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
197
+ }
198
+
199
+ &:disabled {
200
+ opacity: 0.6;
201
+ cursor: not-allowed;
202
+ }
203
+ }
204
+ `;
205
+ styled(Button)`
206
+ && {
207
+ background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
208
+ color: #0EA5E9;
209
+ border: 1px solid #BAE6FD;
210
+ padding: 8px;
211
+ min-width: 38px;
212
+ min-height: 38px;
213
+ width: 38px;
214
+ height: 38px;
215
+ border-radius: 10px;
216
+ display: flex;
217
+ align-items: center;
218
+ justify-content: center;
219
+ transition: all 0.2s ease;
220
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
221
+
222
+ svg {
223
+ width: 18px;
224
+ height: 18px;
225
+ }
226
+
227
+ &:hover:not(:disabled) {
228
+ background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
229
+ border-color: #0EA5E9;
230
+ color: white;
231
+ transform: translateY(-1px);
232
+ box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
233
+ }
234
+
235
+ &:disabled {
236
+ opacity: 0.6;
237
+ cursor: not-allowed;
238
+ }
239
+ }
240
+ `;
241
+ styled(Button)`
242
+ && {
243
+ background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
244
+ color: #22C55E;
245
+ border: 1px solid #BBF7D0;
246
+ padding: 8px;
247
+ min-width: 38px;
248
+ min-height: 38px;
249
+ width: 38px;
250
+ height: 38px;
251
+ border-radius: 10px;
252
+ display: flex;
253
+ align-items: center;
254
+ justify-content: center;
255
+ transition: all 0.2s ease;
256
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
257
+
258
+ svg {
259
+ width: 18px;
260
+ height: 18px;
261
+ }
262
+
263
+ &:hover:not(:disabled) {
264
+ background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
265
+ border-color: #22C55E;
266
+ color: white;
267
+ transform: translateY(-1px);
268
+ box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
269
+ }
270
+
271
+ &:disabled {
272
+ opacity: 0.6;
273
+ cursor: not-allowed;
274
+ }
275
+ }
276
+ `;
277
+ styled(Button)`
278
+ && {
279
+ background: linear-gradient(135deg, #0EA5E9 0%, #A855F7 100%);
280
+ color: white;
281
+ font-weight: 700;
282
+ font-size: 1rem;
283
+ border: none;
284
+ padding: 14px 28px;
285
+ min-height: 52px;
286
+ border-radius: 12px;
287
+ transition: all 0.2s ease;
288
+ box-shadow: 0 4px 14px rgba(14, 165, 233, 0.25);
289
+
290
+ &:hover:not(:disabled) {
291
+ background: linear-gradient(135deg, #0284C7 0%, #9333EA 100%);
292
+ transform: translateY(-2px);
293
+ box-shadow: 0 6px 20px rgba(14, 165, 233, 0.35);
294
+ }
295
+
296
+ &:active:not(:disabled) {
297
+ transform: translateY(0);
298
+ }
299
+
300
+ &:disabled {
301
+ opacity: 0.6;
302
+ cursor: not-allowed;
303
+ }
304
+ }
305
+ `;
306
+ styled(Button)`
307
+ && {
308
+ background: transparent;
309
+ color: #0EA5E9;
310
+ font-weight: 500;
311
+ border: none;
312
+ padding: 4px 8px;
313
+ min-height: auto;
314
+ text-decoration: underline;
315
+ transition: all 0.2s ease;
316
+
317
+ &:hover:not(:disabled) {
318
+ color: #0284C7;
319
+ text-decoration: none;
320
+ }
321
+
322
+ &:disabled {
323
+ opacity: 0.6;
324
+ cursor: not-allowed;
325
+ }
326
+ }
327
+ `;
328
+ const ShowHideButton = styled(Button)`
329
+ && {
330
+ background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
331
+ color: #64748B;
332
+ font-weight: 600;
333
+ border: 1px solid #E2E8F0;
334
+ padding: 10px 16px;
335
+ min-height: 40px;
336
+ border-radius: 8px;
337
+ transition: all 0.2s ease;
338
+
339
+ &:hover:not(:disabled) {
340
+ background: linear-gradient(135deg, #E2E8F0 0%, #CBD5E1 100%);
341
+ color: #334155;
342
+ transform: translateY(-1px);
343
+ }
344
+
345
+ &:disabled {
346
+ opacity: 0.6;
347
+ cursor: not-allowed;
348
+ }
349
+ }
350
+ `;
351
+ const CopyButton = styled(Button)`
352
+ && {
353
+ background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
354
+ color: #0284C7;
355
+ font-weight: 600;
356
+ border: 1px solid #BAE6FD;
357
+ padding: 10px 16px;
358
+ min-height: 40px;
359
+ border-radius: 8px;
360
+ transition: all 0.2s ease;
361
+
362
+ &:hover:not(:disabled) {
363
+ background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
364
+ color: white;
365
+ border-color: #0EA5E9;
366
+ transform: translateY(-1px);
367
+ box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
368
+ }
369
+
370
+ &:disabled {
371
+ opacity: 0.6;
372
+ cursor: not-allowed;
373
+ }
374
+ }
375
+ `;
10
376
  const theme = {
11
377
  colors: {
12
378
  primary: { 600: "#0284C7", 700: "#075985", 100: "#E0F2FE", 50: "#F0F9FF" },
@@ -637,12 +1003,11 @@ const SettingsPage = () => {
637
1003
  /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "danger600", style: { fontSize: "13px", lineHeight: "1.7" }, children: t("settings.general.danger.description", "Clean All Inactive: Permanently deletes all inactive sessions. This cannot be undone.") })
638
1004
  ] }),
639
1005
  /* @__PURE__ */ jsx(
640
- Button,
1006
+ DangerButton,
641
1007
  {
642
1008
  onClick: handleCleanInactive,
643
1009
  loading: cleaning,
644
1010
  startIcon: /* @__PURE__ */ jsx(Trash, {}),
645
- variant: "danger",
646
1011
  size: "S",
647
1012
  style: { flexShrink: 0 },
648
1013
  children: t("settings.general.danger.cleanNow", "Clean Now")
@@ -701,9 +1066,8 @@ const SettingsPage = () => {
701
1066
  }
702
1067
  ) }),
703
1068
  /* @__PURE__ */ jsx(
704
- Button,
1069
+ ShowHideButton,
705
1070
  {
706
- variant: "secondary",
707
1071
  onClick: () => setShowEncryptionKey(!showEncryptionKey),
708
1072
  size: "L",
709
1073
  children: showEncryptionKey ? t("settings.security.encryption.hide", "Hide") : t("settings.security.encryption.show", "Show")
@@ -712,9 +1076,8 @@ const SettingsPage = () => {
712
1076
  ] }),
713
1077
  /* @__PURE__ */ jsxs(Flex, { gap: 3, children: [
714
1078
  /* @__PURE__ */ jsx(
715
- Button,
1079
+ GradientButton,
716
1080
  {
717
- variant: "default",
718
1081
  startIcon: /* @__PURE__ */ jsx(Code, {}),
719
1082
  onClick: () => {
720
1083
  const key = generateSecureKey();
@@ -730,9 +1093,8 @@ const SettingsPage = () => {
730
1093
  }
731
1094
  ),
732
1095
  /* @__PURE__ */ jsx(
733
- Button,
1096
+ CopyButton,
734
1097
  {
735
- variant: "tertiary",
736
1098
  startIcon: /* @__PURE__ */ jsx(Duplicate, {}),
737
1099
  onClick: () => {
738
1100
  if (encryptionKey) {
@@ -749,9 +1111,8 @@ const SettingsPage = () => {
749
1111
  }
750
1112
  ),
751
1113
  /* @__PURE__ */ jsx(
752
- Button,
1114
+ CopyButton,
753
1115
  {
754
- variant: "tertiary",
755
1116
  startIcon: /* @__PURE__ */ jsx(Duplicate, {}),
756
1117
  onClick: () => {
757
1118
  if (encryptionKey) {
@@ -1094,10 +1455,9 @@ const SettingsPage = () => {
1094
1455
  ] }),
1095
1456
  /* @__PURE__ */ jsx(Badge, { variant: "success", children: t("settings.email.templates.html.badge", "Main Template") })
1096
1457
  ] }),
1097
- /* @__PURE__ */ jsxs(
1098
- Button,
1458
+ /* @__PURE__ */ jsx(
1459
+ TertiaryButton,
1099
1460
  {
1100
- variant: "tertiary",
1101
1461
  size: "S",
1102
1462
  onClick: () => {
1103
1463
  const defaultTemplates = getDefaultTemplates();
@@ -1106,10 +1466,7 @@ const SettingsPage = () => {
1106
1466
  handleChange("emailTemplates", newTemplates);
1107
1467
  toggleNotification({ type: "success", message: t("notifications.success.defaultLoaded", "Default template loaded!") });
1108
1468
  },
1109
- children: [
1110
- "📋 ",
1111
- t("settings.email.templates.html.loadDefault", "Load Default")
1112
- ]
1469
+ children: t("settings.email.templates.html.loadDefault", "Load Default")
1113
1470
  }
1114
1471
  )
1115
1472
  ] }),
@@ -1169,25 +1526,20 @@ const SettingsPage = () => {
1169
1526
  }
1170
1527
  ),
1171
1528
  /* @__PURE__ */ jsxs(Flex, { gap: 2, style: { marginTop: "12px" }, wrap: "wrap", children: [
1172
- /* @__PURE__ */ jsxs(
1173
- Button,
1529
+ /* @__PURE__ */ jsx(
1530
+ CopyButton,
1174
1531
  {
1175
- variant: "secondary",
1176
1532
  size: "S",
1177
1533
  onClick: () => {
1178
1534
  navigator.clipboard.writeText(settings.emailTemplates[templateKey].html);
1179
1535
  toggleNotification({ type: "success", message: t("notifications.success.htmlCopied", "HTML template copied!") });
1180
1536
  },
1181
- children: [
1182
- "📋 ",
1183
- t("settings.email.templates.html.copy", "Copy Template")
1184
- ]
1537
+ children: t("settings.email.templates.html.copy", "Copy Template")
1185
1538
  }
1186
1539
  ),
1187
- /* @__PURE__ */ jsxs(
1188
- Button,
1540
+ /* @__PURE__ */ jsx(
1541
+ SecondaryButton,
1189
1542
  {
1190
- variant: "tertiary",
1191
1543
  size: "S",
1192
1544
  onClick: () => {
1193
1545
  const validation = validateTemplate(settings.emailTemplates[templateKey].html, templateKey);
@@ -1196,16 +1548,12 @@ const SettingsPage = () => {
1196
1548
  message: validation.isValid ? t("notifications.success.validated", "Template valid! Found {found}/{total} variables.", { found: validation.foundVars.length, total: validation.totalAvailable }) : t("notifications.warning.noVariables", "[WARNING] No variables found. Add at least one variable.")
1197
1549
  });
1198
1550
  },
1199
- children: [
1200
- "✓ ",
1201
- t("settings.email.templates.html.validate", "Validate")
1202
- ]
1551
+ children: t("settings.email.templates.html.validate", "Validate")
1203
1552
  }
1204
1553
  ),
1205
- /* @__PURE__ */ jsxs(
1206
- Button,
1554
+ /* @__PURE__ */ jsx(
1555
+ TertiaryButton,
1207
1556
  {
1208
- variant: "tertiary",
1209
1557
  size: "S",
1210
1558
  onClick: () => {
1211
1559
  const lines = settings.emailTemplates[templateKey].html.split("\n").length;
@@ -1215,10 +1563,7 @@ const SettingsPage = () => {
1215
1563
  message: t("notifications.info.templateStats", "Template has {lines} lines and {chars} characters", { lines, chars })
1216
1564
  });
1217
1565
  },
1218
- children: [
1219
- "ℹ️ ",
1220
- t("settings.email.templates.html.info", "Template Info")
1221
- ]
1566
+ children: t("settings.email.templates.html.info", "Template Info")
1222
1567
  }
1223
1568
  )
1224
1569
  ] })
@@ -1240,10 +1585,9 @@ const SettingsPage = () => {
1240
1585
  ] }),
1241
1586
  /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: t("settings.email.templates.text.badge", "Fallback") })
1242
1587
  ] }),
1243
- /* @__PURE__ */ jsxs(
1244
- Button,
1588
+ /* @__PURE__ */ jsx(
1589
+ TertiaryButton,
1245
1590
  {
1246
- variant: "tertiary",
1247
1591
  size: "S",
1248
1592
  onClick: () => {
1249
1593
  const defaultTemplates = getDefaultTemplates();
@@ -1252,10 +1596,7 @@ const SettingsPage = () => {
1252
1596
  handleChange("emailTemplates", newTemplates);
1253
1597
  toggleNotification({ type: "success", message: t("notifications.success.defaultLoaded", "Default template loaded!") });
1254
1598
  },
1255
- children: [
1256
- "📋 ",
1257
- t("settings.email.templates.text.loadDefault", "Load Default")
1258
- ]
1599
+ children: t("settings.email.templates.text.loadDefault", "Load Default")
1259
1600
  }
1260
1601
  )
1261
1602
  ] }),
@@ -1314,19 +1655,15 @@ const SettingsPage = () => {
1314
1655
  ]
1315
1656
  }
1316
1657
  ),
1317
- /* @__PURE__ */ jsx(Flex, { gap: 2, style: { marginTop: "12px" }, wrap: "wrap", children: /* @__PURE__ */ jsxs(
1318
- Button,
1658
+ /* @__PURE__ */ jsx(Flex, { gap: 2, style: { marginTop: "12px" }, wrap: "wrap", children: /* @__PURE__ */ jsx(
1659
+ CopyButton,
1319
1660
  {
1320
- variant: "secondary",
1321
1661
  size: "S",
1322
1662
  onClick: () => {
1323
1663
  navigator.clipboard.writeText(settings.emailTemplates[templateKey].text);
1324
1664
  toggleNotification({ type: "success", message: t("notifications.success.textCopied", "Text template copied!") });
1325
1665
  },
1326
- children: [
1327
- "📋 ",
1328
- t("settings.email.templates.text.copy", "Copy Template")
1329
- ]
1666
+ children: t("settings.email.templates.text.copy", "Copy Template")
1330
1667
  }
1331
1668
  ) })
1332
1669
  ]
@@ -4,7 +4,7 @@ import { useFetchClient, useNotification } from "@strapi/strapi/admin";
4
4
  import styled from "styled-components";
5
5
  import { Flex, Typography, Box, Badge, Button } from "@strapi/design-system";
6
6
  import { Check, Cross, Sparkle, Lightning, Rocket } from "@strapi/icons";
7
- import { a as pluginId } from "./index-CUSrDKCG.mjs";
7
+ import { a as pluginId } from "./index-Dpdcg2zl.mjs";
8
8
  const Container = styled(Box)`
9
9
  padding: 32px;
10
10
  max-width: 1400px;
@@ -6,7 +6,7 @@ const admin = require("@strapi/strapi/admin");
6
6
  const styled = require("styled-components");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
- const index = require("./index-BuxWeACw.js");
9
+ const index = require("./index-Cf1Wqdeg.js");
10
10
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
11
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
12
12
  const Container = styled__default.default(designSystem.Box)`
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  const react = require("react");
3
+ const admin = require("@strapi/strapi/admin");
3
4
  const jsxRuntime = require("react/jsx-runtime");
4
5
  const reactIntl = require("react-intl");
5
6
  const designSystem = require("@strapi/design-system");
6
7
  const icons = require("@strapi/icons");
7
- const admin = require("@strapi/strapi/admin");
8
8
  const strapi = {
9
9
  name: "magic-sessionmanager",
10
10
  displayName: "Magic Sessionmanager"
@@ -14,10 +14,29 @@ const pluginPkg = {
14
14
  };
15
15
  const pluginId = "magic-sessionmanager";
16
16
  const PLUGIN_ID = pluginId;
17
- const Initializer = () => {
17
+ const Initializer = ({ setPlugin }) => {
18
+ const ref = react.useRef(setPlugin);
19
+ const { get } = admin.useFetchClient();
18
20
  react.useEffect(() => {
19
- console.log("[magic-sessionmanager] Plugin initialized");
21
+ if (ref.current) {
22
+ ref.current(pluginId);
23
+ }
20
24
  }, []);
25
+ react.useEffect(() => {
26
+ const HEARTBEAT_INTERVAL = 4 * 60 * 1e3;
27
+ const heartbeat = async () => {
28
+ try {
29
+ await get(`/${pluginId}/license/status`);
30
+ } catch (error) {
31
+ }
32
+ };
33
+ const initialTimeout = setTimeout(heartbeat, 60 * 1e3);
34
+ const interval = setInterval(heartbeat, HEARTBEAT_INTERVAL);
35
+ return () => {
36
+ clearTimeout(initialTimeout);
37
+ clearInterval(interval);
38
+ };
39
+ }, [get]);
21
40
  return null;
22
41
  };
23
42
  const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 32 32", fill: "currentColor", width: "24", height: "24", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M26 5H6a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h20a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3M20 27h-8a1 1 0 0 0 0 2h8a1 1 0 0 0 0-2" }) });
@@ -397,7 +416,7 @@ const index = {
397
416
  id: `${pluginId}.plugin.name`,
398
417
  defaultMessage: pluginPkg.strapi.displayName
399
418
  },
400
- Component: () => Promise.resolve().then(() => require("./App-BkaaNOpt.js"))
419
+ Component: () => Promise.resolve().then(() => require("./App-iF0Cl3Lj.js"))
401
420
  });
402
421
  app.createSettingSection(
403
422
  {
@@ -413,7 +432,7 @@ const index = {
413
432
  },
414
433
  id: "upgrade",
415
434
  to: `${pluginId}/upgrade`,
416
- Component: () => Promise.resolve().then(() => require("./UpgradePage-Bwy_1m6f.js"))
435
+ Component: () => Promise.resolve().then(() => require("./UpgradePage-D8GaP9Yi.js"))
417
436
  },
418
437
  {
419
438
  intlLabel: {
@@ -422,7 +441,7 @@ const index = {
422
441
  },
423
442
  id: "general",
424
443
  to: `${pluginId}/general`,
425
- Component: () => Promise.resolve().then(() => require("./Settings-jtZRw_VP.js"))
444
+ Component: () => Promise.resolve().then(() => require("./Settings-5ZqZ0GC8.js"))
426
445
  },
427
446
  {
428
447
  intlLabel: {
@@ -431,7 +450,7 @@ const index = {
431
450
  },
432
451
  id: "analytics",
433
452
  to: `${pluginId}/analytics`,
434
- Component: () => Promise.resolve().then(() => require("./Analytics-D6RGeWO5.js"))
453
+ Component: () => Promise.resolve().then(() => require("./Analytics-BWvrf9k5.js"))
435
454
  },
436
455
  {
437
456
  intlLabel: {
@@ -440,7 +459,7 @@ const index = {
440
459
  },
441
460
  id: "license",
442
461
  to: `${pluginId}/license`,
443
- Component: () => Promise.resolve().then(() => require("./License-C8VnKtV1.js"))
462
+ Component: () => Promise.resolve().then(() => require("./License-DFShBRh1.js"))
444
463
  }
445
464
  ]
446
465
  );
@@ -458,7 +477,7 @@ const index = {
458
477
  defaultMessage: "Online Users"
459
478
  },
460
479
  component: async () => {
461
- const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-uJ6DZB_N.js"));
480
+ const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-CdJFMOUZ.js"));
462
481
  return component.default;
463
482
  },
464
483
  id: "online-users-widget",