strapi-plugin-magic-mark 3.4.0 → 4.0.1

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 (48) hide show
  1. package/CHANGELOG.md +373 -0
  2. package/README.md +393 -618
  3. package/dist/admin/App-BIc-2qv8.mjs +580 -0
  4. package/dist/admin/App-DxALpMK_.js +580 -0
  5. package/dist/admin/PinnedBookmarksWidget-BWiAKlnA.mjs +55 -0
  6. package/dist/admin/PinnedBookmarksWidget-VM6buexr.js +55 -0
  7. package/dist/admin/de-BF0nCjGF.mjs +183 -0
  8. package/dist/admin/de-Cn90CcnC.js +183 -0
  9. package/dist/admin/en-D-EGHodf.mjs +183 -0
  10. package/dist/admin/en-GDfO_EfL.js +183 -0
  11. package/dist/admin/es-6o-_RABX.js +183 -0
  12. package/dist/admin/es-C33BufuB.mjs +183 -0
  13. package/dist/admin/fr-BOZS5mJT.js +183 -0
  14. package/dist/admin/fr-DJHTjkmb.mjs +183 -0
  15. package/dist/admin/index-BJ8l6K7P.mjs +1861 -0
  16. package/dist/admin/index-C9FMo0F_.js +1862 -0
  17. package/dist/admin/index.js +4 -2
  18. package/dist/admin/index.mjs +2 -1
  19. package/dist/admin/pt-D13SxuK2.js +183 -0
  20. package/dist/admin/pt-yoB1jrsq.mjs +183 -0
  21. package/dist/server/index.js +1129 -1542
  22. package/dist/server/index.mjs +1126 -1539
  23. package/package.json +90 -54
  24. package/strapi-admin.js +5 -0
  25. package/strapi-server.js +2 -1
  26. package/COPYRIGHT_NOTICE.txt +0 -20
  27. package/dist/_chunks/App-DNyxeldt.js +0 -1451
  28. package/dist/_chunks/App-D_Vllkur.mjs +0 -1449
  29. package/dist/_chunks/UpgradePage-DuyIskve.mjs +0 -351
  30. package/dist/_chunks/UpgradePage-SzlmS6po.js +0 -353
  31. package/dist/_chunks/de-Cs9dd3Mr.js +0 -138
  32. package/dist/_chunks/de-DOVki5VS.mjs +0 -138
  33. package/dist/_chunks/en-CE3r46Y2.js +0 -138
  34. package/dist/_chunks/en-Cf5-O03L.mjs +0 -138
  35. package/dist/_chunks/es-Ba6JcPIm.mjs +0 -138
  36. package/dist/_chunks/es-D4AOyJYJ.js +0 -138
  37. package/dist/_chunks/fr-CWSfoA8i.js +0 -138
  38. package/dist/_chunks/fr-CrMBXR3c.mjs +0 -138
  39. package/dist/_chunks/index-CBwb0AEf.js +0 -3618
  40. package/dist/_chunks/index-JirQF8zE.mjs +0 -328
  41. package/dist/_chunks/index-QkINaIgJ.mjs +0 -3614
  42. package/dist/_chunks/index-uUErgmi9.js +0 -330
  43. package/dist/_chunks/pt-BXxZ1Zym.mjs +0 -138
  44. package/dist/_chunks/pt-DW_6r_mP.js +0 -138
  45. package/pics/advancedFilters.png +0 -0
  46. package/pics/dashboard.png +0 -0
  47. package/pics/quickaccesinContentmanager.png +0 -0
  48. package/pics/saveAsMagicMark.png +0 -0
@@ -1,1451 +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 reactIntl = require("react-intl");
6
- const reactRouterDom = require("react-router-dom");
7
- const styled = require("styled-components");
8
- const designSystem = require("@strapi/design-system");
9
- const icons = require("@strapi/icons");
10
- const outline = require("@heroicons/react/24/outline");
11
- const admin = require("@strapi/strapi/admin");
12
- const index = require("./index-CBwb0AEf.js");
13
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
14
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
15
- const theme = {
16
- colors: {
17
- primary: {
18
- 50: "#F0F9FF",
19
- 100: "#E0F2FE",
20
- 500: "#0EA5E9",
21
- 600: "#0284C7",
22
- 700: "#0369A1"
23
- },
24
- secondary: {
25
- 600: "#9333EA"
26
- },
27
- success: {
28
- 100: "#DCFCE7",
29
- 500: "#22C55E",
30
- 600: "#16A34A"
31
- },
32
- warning: {
33
- 100: "#FEF3C7",
34
- 500: "#F59E0B",
35
- 600: "#D97706"
36
- },
37
- danger: {
38
- 100: "#FEE2E2",
39
- 500: "#EF4444",
40
- 600: "#DC2626"
41
- },
42
- neutral: {
43
- 0: "#FFFFFF",
44
- 100: "#F3F4F6",
45
- 600: "#4B5563"
46
- }
47
- },
48
- shadows: {
49
- sm: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",
50
- xl: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)"
51
- },
52
- transitions: {
53
- fast: "150ms cubic-bezier(0.4, 0, 0.2, 1)",
54
- normal: "300ms cubic-bezier(0.4, 0, 0.2, 1)",
55
- slow: "500ms cubic-bezier(0.4, 0, 0.2, 1)"
56
- },
57
- spacing: {
58
- xs: "4px",
59
- sm: "8px",
60
- md: "16px",
61
- lg: "24px",
62
- xl: "32px",
63
- "2xl": "48px"
64
- },
65
- borderRadius: {
66
- md: "8px",
67
- lg: "12px",
68
- xl: "16px"
69
- }
70
- };
71
- const fadeIn$1 = styled.keyframes`
72
- from { opacity: 0; transform: translateY(10px); }
73
- to { opacity: 1; transform: translateY(0); }
74
- `;
75
- styled.keyframes`
76
- from { opacity: 0; transform: translateX(-10px); }
77
- to { opacity: 1; transform: translateX(0); }
78
- `;
79
- const shimmer = styled.keyframes`
80
- 0% { background-position: -200% 0; }
81
- 100% { background-position: 200% 0; }
82
- `;
83
- const float = styled.keyframes`
84
- 0%, 100% { transform: translateY(0px); }
85
- 50% { transform: translateY(-5px); }
86
- `;
87
- const breakpoints = {
88
- mobile: "768px"
89
- };
90
- const Container = styled__default.default(designSystem.Box)`
91
- animation: ${fadeIn$1} ${theme.transitions.slow};
92
- min-height: 100vh;
93
- max-width: 1440px;
94
- margin: 0 auto;
95
- padding: ${theme.spacing.xl} ${theme.spacing.lg} 0;
96
-
97
- @media screen and (max-width: ${breakpoints.mobile}) {
98
- padding: ${theme.spacing.md} ${theme.spacing.sm} 0;
99
- }
100
- `;
101
- const Header = styled__default.default(designSystem.Box)`
102
- background: linear-gradient(135deg,
103
- ${theme.colors.primary[600]} 0%,
104
- ${theme.colors.secondary[600]} 100%
105
- );
106
- border-radius: ${theme.borderRadius.xl};
107
- padding: ${theme.spacing.xl} ${theme.spacing["2xl"]};
108
- margin-bottom: ${theme.spacing.xl};
109
- position: relative;
110
- overflow: hidden;
111
- box-shadow: ${theme.shadows.xl};
112
-
113
- @media screen and (max-width: ${breakpoints.mobile}) {
114
- padding: ${theme.spacing.lg} ${theme.spacing.md} !important;
115
- border-radius: ${theme.borderRadius.lg} !important;
116
- }
117
-
118
- &::before {
119
- content: '';
120
- position: absolute;
121
- top: 0;
122
- left: -100%;
123
- width: 200%;
124
- height: 100%;
125
- background: linear-gradient(
126
- 90deg,
127
- transparent,
128
- rgba(255, 255, 255, 0.1),
129
- transparent
130
- );
131
- animation: ${shimmer} 3s infinite;
132
- }
133
-
134
- &::after {
135
- content: '';
136
- position: absolute;
137
- top: 0;
138
- right: 0;
139
- width: 100%;
140
- height: 100%;
141
- background-image: radial-gradient(circle at 20% 80%, transparent 50%, rgba(255, 255, 255, 0.1) 50%);
142
- background-size: 15px 15px;
143
- opacity: 0.3;
144
- }
145
- `;
146
- const HeaderContent = styled__default.default(designSystem.Flex)`
147
- position: relative;
148
- z-index: 1;
149
- `;
150
- const Title = styled__default.default(designSystem.Typography)`
151
- color: ${theme.colors.neutral[0]};
152
- font-size: 2rem;
153
- font-weight: 700;
154
- letter-spacing: -0.025em;
155
- text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
156
- display: flex;
157
- align-items: center;
158
- gap: ${theme.spacing.sm};
159
-
160
- svg {
161
- width: 28px;
162
- height: 28px;
163
- animation: ${float} 3s ease-in-out infinite;
164
- }
165
- `;
166
- const Subtitle = styled__default.default(designSystem.Typography)`
167
- color: rgba(255, 255, 255, 0.9);
168
- font-size: 0.95rem;
169
- font-weight: 400;
170
- margin-top: ${theme.spacing.xs};
171
- letter-spacing: 0.01em;
172
- `;
173
- const StatsGrid = styled__default.default.div`
174
- margin-bottom: ${theme.spacing.xl};
175
- display: grid;
176
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
177
- gap: ${theme.spacing.md};
178
- justify-content: center;
179
- max-width: 1200px;
180
- margin-left: auto;
181
- margin-right: auto;
182
-
183
- @media screen and (max-width: ${breakpoints.mobile}) {
184
- grid-template-columns: repeat(2, 1fr) !important;
185
- gap: 12px !important;
186
- margin-bottom: 24px !important;
187
- }
188
- `;
189
- const StatCard = styled__default.default(designSystem.Box)`
190
- background: ${(p) => p.theme.colors.neutral0};
191
- border-radius: ${theme.borderRadius.lg};
192
- padding: ${theme.spacing.lg};
193
- position: relative;
194
- overflow: hidden;
195
- transition: all ${theme.transitions.normal};
196
- animation: ${fadeIn$1} ${theme.transitions.slow} backwards;
197
- animation-delay: ${(props) => props.$delay || "0s"};
198
- box-shadow: ${theme.shadows.sm};
199
- border: 1px solid rgba(128, 128, 128, 0.2);
200
- min-width: 200px;
201
- flex: 1;
202
- text-align: center;
203
- display: flex;
204
- flex-direction: column;
205
- align-items: center;
206
- justify-content: center;
207
-
208
- &:hover {
209
- transform: translateY(-4px);
210
- box-shadow: ${theme.shadows.xl};
211
- border-color: ${(props) => props.$color || theme.colors.primary[500]};
212
-
213
- .stat-icon {
214
- transform: scale(1.1);
215
- }
216
-
217
- .stat-value {
218
- transform: scale(1.05);
219
- }
220
- }
221
-
222
- @media screen and (max-width: ${breakpoints.mobile}) {
223
- min-width: unset !important;
224
- padding: ${theme.spacing.md} !important;
225
-
226
- &:hover {
227
- transform: none !important;
228
- }
229
- }
230
- `;
231
- const StatIcon = styled__default.default(designSystem.Box)`
232
- width: 64px;
233
- height: 64px;
234
- border-radius: ${theme.borderRadius.md};
235
- display: flex;
236
- align-items: center;
237
- justify-content: center;
238
- background: ${(props) => props.$bg || theme.colors.primary[100]};
239
- transition: all ${theme.transitions.normal};
240
- margin-bottom: ${theme.spacing.md};
241
-
242
- svg {
243
- width: 32px;
244
- height: 32px;
245
- color: ${(props) => props.$color || theme.colors.primary[600]};
246
- }
247
- `;
248
- const StatValue = styled__default.default(designSystem.Typography)`
249
- font-size: 2.5rem;
250
- font-weight: 700;
251
- color: ${(p) => p.theme.colors.neutral800};
252
- line-height: 1;
253
- margin-bottom: ${theme.spacing.xs};
254
- transition: transform ${theme.transitions.normal};
255
- `;
256
- const StatLabel = styled__default.default(designSystem.Typography)`
257
- font-size: 0.875rem;
258
- color: ${(p) => p.theme.colors.neutral600};
259
- font-weight: 500;
260
- letter-spacing: 0.025em;
261
- text-transform: capitalize;
262
- `;
263
- const DataTable = styled__default.default(designSystem.Box)`
264
- background: ${(p) => p.theme.colors.neutral0};
265
- border-radius: ${theme.borderRadius.lg};
266
- overflow: hidden;
267
- box-shadow: ${theme.shadows.sm};
268
- border: 1px solid rgba(128, 128, 128, 0.2);
269
- margin-bottom: ${theme.spacing.xl};
270
- `;
271
- const StyledTable = styled__default.default(designSystem.Table)`
272
- thead {
273
- background: ${(p) => p.theme.colors.neutral0};
274
- border-bottom: 2px solid rgba(128, 128, 128, 0.15);
275
-
276
- th {
277
- font-weight: 600;
278
- color: ${(p) => p.theme.colors.neutral700};
279
- font-size: 0.875rem;
280
- text-transform: uppercase;
281
- letter-spacing: 0.025em;
282
- padding: ${theme.spacing.lg} ${theme.spacing.lg};
283
- }
284
- }
285
-
286
- tbody tr {
287
- transition: all ${theme.transitions.fast};
288
- border-bottom: 1px solid rgba(128, 128, 128, 0.1);
289
-
290
- &:last-child {
291
- border-bottom: none;
292
- }
293
-
294
- &:hover {
295
- background: ${(p) => p.theme.colors.neutral100};
296
-
297
- .action-buttons {
298
- opacity: 1;
299
- }
300
- }
301
-
302
- td {
303
- padding: ${theme.spacing.lg} ${theme.spacing.lg};
304
- color: ${(p) => p.theme.colors.neutral700};
305
- vertical-align: middle;
306
- }
307
- }
308
- `;
309
- styled__default.default(designSystem.Box)`
310
- width: 4px;
311
- height: 40px;
312
- background: ${(props) => props.$isPinned ? theme.colors.warning[500] : "transparent"};
313
- border-radius: 2px;
314
- transition: all ${theme.transitions.normal};
315
- `;
316
- const BookmarkIconWrapper = styled__default.default.div`
317
- display: flex;
318
- align-items: center;
319
- justify-content: center;
320
- width: 40px;
321
- height: 40px;
322
- background: linear-gradient(135deg, ${theme.colors.primary[100]} 0%, #E0E7FF 100%);
323
- border-radius: 8px;
324
- flex-shrink: 0;
325
-
326
- svg {
327
- width: 20px;
328
- height: 20px;
329
- color: ${theme.colors.primary[600]};
330
- }
331
- `;
332
- const ActionButtons = styled__default.default(designSystem.Flex)`
333
- opacity: 1;
334
- transition: all ${theme.transitions.fast};
335
- gap: ${theme.spacing.xs};
336
- justify-content: flex-end;
337
- `;
338
- const FloatingIcon = styled__default.default.div`
339
- position: absolute;
340
- bottom: 40px;
341
- right: 40px;
342
- opacity: 0.08;
343
- animation: ${float} 4s ease-in-out infinite;
344
-
345
- svg {
346
- width: 72px;
347
- height: 72px;
348
- color: ${theme.colors.warning[500]};
349
- }
350
- `;
351
- const FilterBar = styled__default.default(designSystem.Flex)`
352
- background: ${(p) => p.theme.colors.neutral0};
353
- padding: ${theme.spacing.md} ${theme.spacing.lg};
354
- border-radius: ${theme.borderRadius.lg};
355
- margin-bottom: ${theme.spacing.lg};
356
- box-shadow: ${theme.shadows.sm};
357
- border: 1px solid rgba(128, 128, 128, 0.2);
358
- gap: ${theme.spacing.md};
359
- align-items: center;
360
- `;
361
- const FilterSelect = styled__default.default(designSystem.Box)`
362
- min-width: 120px;
363
- `;
364
- const SearchInputWrapper = styled__default.default.div`
365
- position: relative;
366
- width: 100%;
367
- display: flex;
368
- align-items: center;
369
- `;
370
- const SearchIconStyled = styled__default.default(outline.MagnifyingGlassIcon)`
371
- position: absolute;
372
- left: 12px;
373
- width: 16px;
374
- height: 16px;
375
- color: ${(p) => p.theme.colors.neutral600};
376
- pointer-events: none;
377
- `;
378
- const StyledSearchInput = styled__default.default.input`
379
- width: 100%;
380
- padding: ${theme.spacing.sm} ${theme.spacing.sm} ${theme.spacing.sm} 36px;
381
- border: 1px solid rgba(128, 128, 128, 0.2);
382
- border-radius: ${theme.borderRadius.md};
383
- font-size: 0.875rem;
384
- transition: all ${theme.transitions.fast};
385
- background: ${(p) => p.theme.colors.neutral0};
386
- color: ${(p) => p.theme.colors.neutral800};
387
-
388
- &:focus {
389
- outline: none;
390
- border-color: ${theme.colors.primary[500]};
391
- box-shadow: 0 0 0 3px ${theme.colors.primary[100]};
392
- }
393
-
394
- &::placeholder {
395
- color: ${(p) => p.theme.colors.neutral600};
396
- }
397
- `;
398
- const HomePageModern = () => {
399
- const { formatMessage } = reactIntl.useIntl();
400
- const navigate = reactRouterDom.useNavigate();
401
- const { get, post, del } = admin.useFetchClient();
402
- index.useLicenseInfo();
403
- const [currentUser, setCurrentUser] = React.useState(null);
404
- const [bookmarks, setBookmarks] = React.useState([]);
405
- const [loading, setLoading] = React.useState(false);
406
- const [showModal, setShowModal] = React.useState(false);
407
- const [editingBookmark, setEditingBookmark] = React.useState(null);
408
- const [searchQuery, setSearchQuery] = React.useState("");
409
- const [filterType, setFilterType] = React.useState("all");
410
- const [entriesPerPage, setEntriesPerPage] = React.useState("10");
411
- const [availableRoles, setAvailableRoles] = React.useState([]);
412
- const [availableUsers, setAvailableUsers] = React.useState([]);
413
- const [licenseLimits, setLicenseLimits] = React.useState({
414
- maxBookmarks: 10,
415
- currentBookmarks: 0,
416
- canCreate: true,
417
- tier: "free",
418
- features: {}
419
- });
420
- React.useEffect(() => {
421
- fetchBookmarks();
422
- fetchCurrentUser();
423
- fetchRoles();
424
- fetchUsers();
425
- fetchLicenseLimits();
426
- }, []);
427
- const fetchRoles = async () => {
428
- try {
429
- const response = await get(`/${index.pluginId}/roles`);
430
- const roles = response.data?.data?.data || response.data?.data || [];
431
- console.log("[Magic-Mark] Available roles in HomePage:", roles);
432
- setAvailableRoles(roles);
433
- } catch (error) {
434
- console.error("[Magic-Mark] Error fetching roles:", error);
435
- }
436
- };
437
- const fetchUsers = async () => {
438
- try {
439
- const response = await get("/admin/users?pageSize=100&page=1&sort=firstname");
440
- console.log("[Magic-Mark] Admin users API response:", response);
441
- const allUsers = response.data?.data?.results || response.data?.results || [];
442
- console.log("[Magic-Mark] All users from API in HomePage:", allUsers);
443
- const users = currentUser && Array.isArray(allUsers) ? allUsers.filter((u) => u.id !== currentUser.id) : allUsers;
444
- console.log("[Magic-Mark] Available users in HomePage:", users);
445
- setAvailableUsers(users);
446
- } catch (error) {
447
- console.error("[Magic-Mark] Error fetching users from admin API:", error);
448
- try {
449
- const response = await get(`/${index.pluginId}/users`);
450
- const users = response.data?.data?.data || response.data?.data || [];
451
- setAvailableUsers(users);
452
- } catch (fallbackError) {
453
- console.warn("[Magic-Mark] Both user endpoints failed");
454
- setAvailableUsers([]);
455
- }
456
- }
457
- };
458
- const fetchCurrentUser = async () => {
459
- try {
460
- const response = await get("/admin/users/me");
461
- console.log("[Magic-Mark] Current user response:", response);
462
- const userData = response.data?.data || response.data || response;
463
- setCurrentUser(userData);
464
- console.log("[Magic-Mark] Current user set to:", userData);
465
- } catch (error) {
466
- console.error("[Magic-Mark] Error fetching current user:", error);
467
- }
468
- };
469
- const isCurrentUserOwner = (bookmark) => {
470
- if (!bookmark.createdBy || !currentUser) return false;
471
- if (bookmark.createdBy.documentId && currentUser.documentId) {
472
- return bookmark.createdBy.documentId === currentUser.documentId;
473
- }
474
- if (bookmark.createdBy.id && currentUser.id) {
475
- return String(bookmark.createdBy.id) === String(currentUser.id);
476
- }
477
- if (bookmark.createdBy.id && currentUser.documentId) {
478
- return String(bookmark.createdBy.id) === String(currentUser.documentId);
479
- }
480
- return false;
481
- };
482
- const fetchLicenseLimits = async () => {
483
- try {
484
- const response = await get(`/${index.pluginId}/license/limits`);
485
- if (response.data?.success) {
486
- setLicenseLimits(response.data.data);
487
- console.log("[Magic-Mark] License limits loaded:", response.data.data);
488
- }
489
- } catch (error) {
490
- console.error("[Magic-Mark] Error fetching license limits:", error);
491
- }
492
- };
493
- const fetchBookmarks = async () => {
494
- setLoading(true);
495
- try {
496
- const { data } = await get(`/${index.pluginId}/bookmarks`);
497
- console.log("[Magic-Mark HomePage] Bookmarks loaded:", data);
498
- console.log("[Magic-Mark HomePage] Current user state:", currentUser);
499
- setBookmarks(data.data || []);
500
- } catch (error) {
501
- console.error("[Magic-Mark HomePage] Error fetching bookmarks:", error);
502
- } finally {
503
- setLoading(false);
504
- }
505
- };
506
- const handleDelete = async (bookmark) => {
507
- if (!confirm(formatMessage({
508
- id: `${index.pluginId}.confirm.delete`,
509
- defaultMessage: "Are you sure you want to delete this bookmark?"
510
- }))) {
511
- return;
512
- }
513
- const deleteId = bookmark.documentId || bookmark.id;
514
- try {
515
- await del(`/${index.pluginId}/bookmarks/${deleteId}`);
516
- console.log("[Magic-Mark HomePage] Bookmark deleted:", deleteId);
517
- fetchBookmarks();
518
- } catch (error) {
519
- console.error("[Magic-Mark HomePage] Error deleting bookmark:", error);
520
- }
521
- };
522
- const handlePin = async (bookmark) => {
523
- const pinId = bookmark.documentId || bookmark.id;
524
- try {
525
- await post(`/${index.pluginId}/bookmarks/${pinId}/pin`, {
526
- isPinned: !bookmark.isPinned
527
- });
528
- console.log("[Magic-Mark HomePage] Bookmark pinned:", pinId);
529
- fetchBookmarks();
530
- } catch (error) {
531
- console.error("[Magic-Mark HomePage] Error pinning bookmark:", error);
532
- }
533
- };
534
- const handleEdit = (bookmark) => {
535
- setEditingBookmark(bookmark);
536
- setShowModal(true);
537
- };
538
- const handleModalClose = () => {
539
- setShowModal(false);
540
- setEditingBookmark(null);
541
- };
542
- const handleModalSuccess = () => {
543
- setShowModal(false);
544
- setEditingBookmark(null);
545
- fetchBookmarks();
546
- fetchLicenseLimits();
547
- };
548
- const handleBookmarkClick = (bookmark) => {
549
- if (bookmark.path) {
550
- let path = bookmark.path;
551
- if (path.startsWith("/admin/")) {
552
- path = path.substring(6);
553
- }
554
- const url = bookmark.query ? `${path}?${bookmark.query}` : path;
555
- console.log("[HomePage] Navigating to:", url);
556
- navigate(url);
557
- }
558
- };
559
- const filteredBookmarks = bookmarks.filter((bookmark) => {
560
- if (filterType === "pinned" && !bookmark.isPinned) return false;
561
- if (filterType === "unpinned" && bookmark.isPinned) return false;
562
- if (!searchQuery) return true;
563
- const query = searchQuery.toLowerCase();
564
- return bookmark.name.toLowerCase().includes(query) || bookmark.description && bookmark.description.toLowerCase().includes(query) || bookmark.path.toLowerCase().includes(query);
565
- }).slice(0, parseInt(entriesPerPage));
566
- const pinnedBookmarks = bookmarks.filter((b) => b.isPinned);
567
- const myBookmarks = bookmarks.filter((b) => isCurrentUserOwner(b));
568
- const sharedWithMe = bookmarks.filter((b) => !isCurrentUserOwner(b) && b.createdBy);
569
- return /* @__PURE__ */ jsxRuntime.jsxs(Container, { padding: 8, children: [
570
- /* @__PURE__ */ jsxRuntime.jsx(Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(HeaderContent, { direction: "column", alignItems: "flex-start", gap: 2, children: [
571
- /* @__PURE__ */ jsxRuntime.jsxs(Title, { children: [
572
- /* @__PURE__ */ jsxRuntime.jsx(outline.BookOpenIcon, {}),
573
- " MagicMark"
574
- ] }),
575
- /* @__PURE__ */ jsxRuntime.jsx(Subtitle, { children: "Save filtered views and navigate with one click" })
576
- ] }) }),
577
- /* @__PURE__ */ jsxRuntime.jsxs(StatsGrid, { children: [
578
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.1s", $color: theme.colors.primary[500], children: [
579
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.primary[100], $color: theme.colors.primary[600], children: /* @__PURE__ */ jsxRuntime.jsx(outline.UserIcon, {}) }),
580
- /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: myBookmarks.length }),
581
- /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: "My Bookmarks" })
582
- ] }),
583
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.2s", $color: theme.colors.success[500], children: [
584
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.success[100], $color: theme.colors.success[600], children: /* @__PURE__ */ jsxRuntime.jsx(outline.SparklesIcon, {}) }),
585
- /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: sharedWithMe.length }),
586
- /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: formatMessage({ id: `${index.pluginId}.stats.shared`, defaultMessage: "Shared with Me" }) })
587
- ] }),
588
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.3s", $color: theme.colors.warning[500], children: [
589
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: theme.colors.warning[100], $color: theme.colors.warning[600], children: /* @__PURE__ */ jsxRuntime.jsx(icons.Pin, {}) }),
590
- /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: pinnedBookmarks.length }),
591
- /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: formatMessage({ id: `${index.pluginId}.stats.pinned`, defaultMessage: "Pinned" }) })
592
- ] }),
593
- /* @__PURE__ */ jsxRuntime.jsxs(
594
- StatCard,
595
- {
596
- $delay: "0.4s",
597
- $color: licenseLimits.canCreate ? theme.colors.neutral[600] : theme.colors.danger[500],
598
- onClick: () => !licenseLimits.canCreate && navigate(`/settings/${index.pluginId}/upgrade`),
599
- style: { cursor: !licenseLimits.canCreate ? "pointer" : "default" },
600
- children: [
601
- /* @__PURE__ */ jsxRuntime.jsx(
602
- StatIcon,
603
- {
604
- className: "stat-icon",
605
- $bg: licenseLimits.canCreate ? theme.colors.neutral[100] : theme.colors.danger[100],
606
- $color: licenseLimits.canCreate ? theme.colors.neutral[600] : theme.colors.danger[600],
607
- children: /* @__PURE__ */ jsxRuntime.jsx(outline.LinkIcon, {})
608
- }
609
- ),
610
- /* @__PURE__ */ jsxRuntime.jsxs(StatValue, { className: "stat-value", children: [
611
- licenseLimits.currentBookmarks,
612
- "/",
613
- licenseLimits.maxBookmarks === -1 ? "∞" : licenseLimits.maxBookmarks
614
- ] }),
615
- /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: licenseLimits.canCreate ? formatMessage({ id: `${index.pluginId}.stats.limit`, defaultMessage: "Bookmark Limit" }) : formatMessage({ id: `${index.pluginId}.stats.limitReached`, defaultMessage: "Limit Reached - Upgrade" }) })
616
- ]
617
- }
618
- )
619
- ] }),
620
- loading && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: formatMessage({ id: `${index.pluginId}.loading`, defaultMessage: "Loading bookmarks..." }) }) }),
621
- !loading && sharedWithMe.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: {
622
- padding: theme.spacing.lg,
623
- background: theme.colors.primary[50],
624
- borderRadius: theme.borderRadius.lg,
625
- border: `1px solid ${theme.colors.primary[200]}`
626
- }, children: [
627
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", style: { marginBottom: theme.spacing.sm, color: theme.colors.primary[700] }, children: formatMessage({ id: `${index.pluginId}.shared.title`, defaultMessage: "🤝 Shared with You" }) }),
628
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", style: { color: theme.colors.primary[600] }, children: sharedWithMe.length > 1 ? formatMessage({ id: `${index.pluginId}.shared.countPlural`, defaultMessage: "{count} bookmarks have been shared with you" }, { count: sharedWithMe.length }) : formatMessage({ id: `${index.pluginId}.shared.count`, defaultMessage: "{count} bookmark has been shared with you" }, { count: sharedWithMe.length }) }),
629
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 2, children: [...new Map(sharedWithMe.map((b) => [b.createdBy?.id, b.createdBy])).values()].map((creator) => {
630
- const creatorBookmarks = sharedWithMe.filter((b) => b.createdBy?.id === creator?.id);
631
- return creator && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", marginTop: 1, children: [
632
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", fontWeight: "semiBold", children: [
633
- creator.firstname || formatMessage({ id: `${index.pluginId}.bookmark.unknown`, defaultMessage: "Unknown" }),
634
- " ",
635
- creator.lastname || "",
636
- ":"
637
- ] }),
638
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", marginLeft: 1, children: creatorBookmarks.length > 1 ? formatMessage({ id: `${index.pluginId}.shared.byCreatorPlural`, defaultMessage: "{count} bookmarks" }, { count: creatorBookmarks.length }) : formatMessage({ id: `${index.pluginId}.shared.byCreator`, defaultMessage: "{count} bookmark" }, { count: creatorBookmarks.length }) })
639
- ] }, creator.id);
640
- }) })
641
- ] }) }),
642
- !loading && bookmarks.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
643
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { marginBottom: theme.spacing.md }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", style: { marginBottom: theme.spacing.md, color: "var(--colors-neutral700, #374151)" }, children: formatMessage({ id: `${index.pluginId}.allBookmarks.title`, defaultMessage: "🔖 All Available Bookmarks" }) }) }),
644
- /* @__PURE__ */ jsxRuntime.jsxs(FilterBar, { children: [
645
- /* @__PURE__ */ jsxRuntime.jsxs(SearchInputWrapper, { style: { flex: 1 }, children: [
646
- /* @__PURE__ */ jsxRuntime.jsx(SearchIconStyled, {}),
647
- /* @__PURE__ */ jsxRuntime.jsx(
648
- StyledSearchInput,
649
- {
650
- value: searchQuery,
651
- onChange: (e) => setSearchQuery(e.target.value),
652
- placeholder: formatMessage({ id: `${index.pluginId}.search.placeholder`, defaultMessage: "Search by name, description..." }),
653
- type: "text"
654
- }
655
- )
656
- ] }),
657
- /* @__PURE__ */ jsxRuntime.jsx(FilterSelect, { children: /* @__PURE__ */ jsxRuntime.jsxs(
658
- designSystem.SingleSelect,
659
- {
660
- value: filterType,
661
- onChange: setFilterType,
662
- placeholder: formatMessage({ id: `${index.pluginId}.filter.placeholder`, defaultMessage: "Filter" }),
663
- size: "S",
664
- children: [
665
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "all", children: formatMessage({ id: `${index.pluginId}.filter.all`, defaultMessage: "Show All" }) }),
666
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "pinned", children: formatMessage({ id: `${index.pluginId}.filter.pinned`, defaultMessage: "Pinned Only" }) }),
667
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "unpinned", children: formatMessage({ id: `${index.pluginId}.filter.unpinned`, defaultMessage: "Unpinned Only" }) })
668
- ]
669
- }
670
- ) }),
671
- /* @__PURE__ */ jsxRuntime.jsx(FilterSelect, { children: /* @__PURE__ */ jsxRuntime.jsxs(
672
- designSystem.SingleSelect,
673
- {
674
- value: entriesPerPage,
675
- onChange: setEntriesPerPage,
676
- placeholder: formatMessage({ id: `${index.pluginId}.entries.placeholder`, defaultMessage: "Entries" }),
677
- size: "S",
678
- children: [
679
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "10", children: formatMessage({ id: `${index.pluginId}.entries.10`, defaultMessage: "10 entries" }) }),
680
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "25", children: formatMessage({ id: `${index.pluginId}.entries.25`, defaultMessage: "25 entries" }) }),
681
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "50", children: formatMessage({ id: `${index.pluginId}.entries.50`, defaultMessage: "50 entries" }) }),
682
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "100", children: formatMessage({ id: `${index.pluginId}.entries.100`, defaultMessage: "100 entries" }) })
683
- ]
684
- }
685
- ) })
686
- ] }),
687
- /* @__PURE__ */ jsxRuntime.jsx(DataTable, { children: /* @__PURE__ */ jsxRuntime.jsxs(StyledTable, { children: [
688
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
689
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: formatMessage({
690
- id: `${index.pluginId}.table.name`,
691
- defaultMessage: "Name"
692
- }) }),
693
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: formatMessage({
694
- id: `${index.pluginId}.table.description`,
695
- defaultMessage: "Description"
696
- }) }),
697
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: "Actions" }) })
698
- ] }) }),
699
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: filteredBookmarks.map((bookmark) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { style: {
700
- background: bookmark.isPinned ? theme.colors.warning[50] : "transparent"
701
- }, children: [
702
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { onClick: () => handleBookmarkClick(bookmark), style: { cursor: "pointer" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, children: [
703
- /* @__PURE__ */ jsxRuntime.jsx(BookmarkIconWrapper, { children: (() => {
704
- const IconComponent = index.getIconById(bookmark.icon || bookmark.emoji || "bookmark");
705
- return /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {});
706
- })() }),
707
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 0, children: [
708
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", ellipsis: true, style: { fontSize: "1.125rem", lineHeight: "1.4" }, children: bookmark.name }),
709
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, alignItems: "center", children: [
710
- isCurrentUserOwner(bookmark) ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { fontSize: "0.75rem", color: theme.colors.primary[600], fontWeight: 500 }, children: [
711
- "• ",
712
- formatMessage({ id: `${index.pluginId}.bookmark.myBookmark`, defaultMessage: "My Bookmark" })
713
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { fontSize: "0.75rem", color: "var(--colors-neutral600, #4B5563)" }, children: [
714
- "• ",
715
- formatMessage({ id: `${index.pluginId}.bookmark.sharedBy`, defaultMessage: "Shared by {name}" }, { name: bookmark.createdBy?.firstname || formatMessage({ id: `${index.pluginId}.bookmark.unknown`, defaultMessage: "Unknown" }) })
716
- ] }),
717
- bookmark.isPublic && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { fontSize: "0.75rem", color: theme.colors.success[600], marginLeft: "8px" }, children: [
718
- "• ",
719
- formatMessage({ id: `${index.pluginId}.bookmark.public`, defaultMessage: "Public" })
720
- ] }),
721
- bookmark.sharedWithRoles && bookmark.sharedWithRoles.length > 0 && !bookmark.isPublic && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { fontSize: "0.75rem", color: theme.colors.warning[600], marginLeft: "8px" }, children: [
722
- "• Roles: ",
723
- bookmark.sharedWithRoles.map((roleId) => {
724
- const role = availableRoles.find((r) => r.id === roleId);
725
- return role?.name || `Role ${roleId}`;
726
- }).join(", ")
727
- ] }),
728
- bookmark.sharedWithUsers && bookmark.sharedWithUsers.length > 0 && !bookmark.isPublic && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { fontSize: "0.75rem", color: theme.colors.primary[600], marginLeft: "8px" }, children: [
729
- "• Users: ",
730
- bookmark.sharedWithUsers.map((userId) => {
731
- const user = availableUsers.find((u) => u.id === userId);
732
- return user ? `${user.firstname} ${user.lastname}` : `User ${userId}`;
733
- }).join(", ")
734
- ] })
735
- ] })
736
- ] })
737
- ] }) }),
738
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { onClick: () => handleBookmarkClick(bookmark), style: { cursor: "pointer" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", ellipsis: true, style: { fontSize: "1rem", lineHeight: "1.6", fontWeight: 400 }, children: bookmark.description || "-" }) }),
739
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(
740
- ActionButtons,
741
- {
742
- className: "action-buttons",
743
- children: [
744
- /* @__PURE__ */ jsxRuntime.jsx(
745
- designSystem.Button,
746
- {
747
- variant: bookmark.isPinned ? "secondary" : "ghost",
748
- size: "S",
749
- onClick: (e) => {
750
- e.stopPropagation();
751
- handlePin(bookmark);
752
- },
753
- style: {
754
- color: bookmark.isPinned ? theme.colors.warning[600] : "inherit",
755
- background: bookmark.isPinned ? theme.colors.warning[100] : "transparent"
756
- },
757
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Pin, {})
758
- }
759
- ),
760
- /* @__PURE__ */ jsxRuntime.jsx(
761
- designSystem.Button,
762
- {
763
- variant: "ghost",
764
- size: "S",
765
- onClick: (e) => {
766
- e.stopPropagation();
767
- handleBookmarkClick(bookmark);
768
- },
769
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Eye, {})
770
- }
771
- ),
772
- /* @__PURE__ */ jsxRuntime.jsx(
773
- designSystem.Button,
774
- {
775
- variant: "ghost",
776
- size: "S",
777
- onClick: (e) => {
778
- e.stopPropagation();
779
- handleEdit(bookmark);
780
- },
781
- disabled: !isCurrentUserOwner(bookmark),
782
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {})
783
- }
784
- ),
785
- isCurrentUserOwner(bookmark) && /* @__PURE__ */ jsxRuntime.jsx(
786
- designSystem.Button,
787
- {
788
- variant: "ghost",
789
- size: "S",
790
- onClick: (e) => {
791
- e.stopPropagation();
792
- handleDelete(bookmark);
793
- },
794
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
795
- }
796
- )
797
- ]
798
- }
799
- ) })
800
- ] }, bookmark.id)) })
801
- ] }) })
802
- ] }),
803
- !loading && bookmarks.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs(
804
- designSystem.Box,
805
- {
806
- style: {
807
- background: "transparent",
808
- borderRadius: theme.borderRadius.xl,
809
- border: "2px dashed rgba(128, 128, 128, 0.2)",
810
- padding: theme.spacing["3xl"],
811
- textAlign: "center",
812
- position: "relative",
813
- overflow: "hidden",
814
- minHeight: "400px",
815
- display: "flex",
816
- alignItems: "center",
817
- justifyContent: "center"
818
- },
819
- children: [
820
- /* @__PURE__ */ jsxRuntime.jsx(
821
- designSystem.Box,
822
- {
823
- style: {
824
- content: "",
825
- position: "absolute",
826
- top: 0,
827
- left: 0,
828
- right: 0,
829
- bottom: 0,
830
- background: `linear-gradient(135deg, ${theme.colors.primary[50]} 0%, ${theme.colors.secondary[50]} 100%)`,
831
- opacity: 0.3,
832
- zIndex: 0
833
- }
834
- }
835
- ),
836
- /* @__PURE__ */ jsxRuntime.jsx(FloatingIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(outline.SparklesIcon, {}) }),
837
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 6, style: { position: "relative", zIndex: 1 }, children: [
838
- /* @__PURE__ */ jsxRuntime.jsx(
839
- designSystem.Box,
840
- {
841
- style: {
842
- width: "120px",
843
- height: "120px",
844
- borderRadius: "50%",
845
- background: `linear-gradient(135deg, ${theme.colors.primary[100]} 0%, ${theme.colors.secondary[100]} 100%)`,
846
- display: "flex",
847
- alignItems: "center",
848
- justifyContent: "center",
849
- boxShadow: theme.shadows.xl
850
- },
851
- children: /* @__PURE__ */ jsxRuntime.jsx(outline.SparklesIcon, { style: { width: "60px", height: "60px", color: theme.colors.primary[600] } })
852
- }
853
- ),
854
- /* @__PURE__ */ jsxRuntime.jsx(
855
- designSystem.Typography,
856
- {
857
- variant: "alpha",
858
- style: {
859
- fontSize: "1.75rem",
860
- fontWeight: "700",
861
- color: "var(--colors-neutral800, #1F2937)",
862
- marginBottom: "8px"
863
- },
864
- children: formatMessage({ id: `${index.pluginId}.empty.title`, defaultMessage: "No bookmarks yet" })
865
- }
866
- ),
867
- /* @__PURE__ */ jsxRuntime.jsx(
868
- designSystem.Typography,
869
- {
870
- variant: "omega",
871
- textColor: "neutral600",
872
- style: {
873
- fontSize: "1rem",
874
- maxWidth: "500px",
875
- lineHeight: "1.6"
876
- },
877
- children: formatMessage({ id: `${index.pluginId}.empty.description`, defaultMessage: 'Navigate to any Content Manager view, apply filters, and click "Save Bookmark" to create quick access shortcuts' })
878
- }
879
- )
880
- ] })
881
- ]
882
- }
883
- ),
884
- showModal && /* @__PURE__ */ jsxRuntime.jsx(
885
- index.CreateEditModal,
886
- {
887
- bookmark: editingBookmark,
888
- pluginId: index.pluginId,
889
- onClose: handleModalClose,
890
- onSuccess: handleModalSuccess,
891
- currentPath: "",
892
- currentQuery: ""
893
- }
894
- )
895
- ] });
896
- };
897
- const fadeIn = styled.keyframes`
898
- from { opacity: 0; }
899
- to { opacity: 1; }
900
- `;
901
- const slideUp = styled.keyframes`
902
- from {
903
- opacity: 0;
904
- transform: translateY(30px);
905
- }
906
- to {
907
- opacity: 1;
908
- transform: translateY(0);
909
- }
910
- `;
911
- const ModalOverlay = styled__default.default.div`
912
- position: fixed;
913
- top: 0;
914
- left: 0;
915
- right: 0;
916
- bottom: 0;
917
- background: rgba(4, 28, 47, 0.85);
918
- backdrop-filter: blur(8px);
919
- z-index: 9999;
920
- display: flex;
921
- align-items: center;
922
- justify-content: center;
923
- animation: ${fadeIn} 0.3s ease-out;
924
- padding: 20px;
925
- `;
926
- const ModalContent = styled__default.default(designSystem.Box)`
927
- background: ${(p) => p.theme.colors.neutral0};
928
- border-radius: 16px;
929
- width: 100%;
930
- max-width: 580px;
931
- box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
932
- animation: ${slideUp} 0.4s cubic-bezier(0.4, 0, 0.2, 1);
933
- overflow: hidden;
934
- `;
935
- const GradientHeader = styled__default.default(designSystem.Box)`
936
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
937
- padding: 32px 40px;
938
- position: relative;
939
- overflow: hidden;
940
-
941
- &::before {
942
- content: '';
943
- position: absolute;
944
- top: -50%;
945
- right: -50%;
946
- width: 200%;
947
- height: 200%;
948
- background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
949
- }
950
- `;
951
- const IconWrapper = styled__default.default.div`
952
- width: 72px;
953
- height: 72px;
954
- border-radius: 50%;
955
- background: rgba(255, 255, 255, 0.2);
956
- display: flex;
957
- align-items: center;
958
- justify-content: center;
959
- margin: 0 auto 16px;
960
- backdrop-filter: blur(10px);
961
- border: 2px solid rgba(255, 255, 255, 0.3);
962
-
963
- svg {
964
- width: 36px;
965
- height: 36px;
966
- color: white;
967
- }
968
- `;
969
- const CloseButton = styled__default.default.button`
970
- position: absolute;
971
- top: 16px;
972
- right: 16px;
973
- background: rgba(255, 255, 255, 0.2);
974
- border: 2px solid rgba(255, 255, 255, 0.3);
975
- border-radius: 50%;
976
- width: 36px;
977
- height: 36px;
978
- display: flex;
979
- align-items: center;
980
- justify-content: center;
981
- cursor: pointer;
982
- transition: all 0.2s;
983
- z-index: 10;
984
-
985
- svg {
986
- width: 20px;
987
- height: 20px;
988
- color: white;
989
- }
990
-
991
- &:hover {
992
- background: rgba(255, 255, 255, 0.3);
993
- transform: scale(1.1);
994
- }
995
-
996
- &:active {
997
- transform: scale(0.95);
998
- }
999
- `;
1000
- const ToggleButton = styled__default.default.button`
1001
- background: none;
1002
- border: none;
1003
- color: #667eea;
1004
- font-size: 13px;
1005
- font-weight: 600;
1006
- cursor: pointer;
1007
- padding: 8px 0;
1008
- text-decoration: underline;
1009
- transition: color 0.2s;
1010
-
1011
- &:hover {
1012
- color: #764ba2;
1013
- }
1014
- `;
1015
- const LicenseGuard = ({ children }) => {
1016
- const { get, post } = admin.useFetchClient();
1017
- const { toggleNotification } = admin.useNotification();
1018
- const navigate = reactRouterDom.useNavigate();
1019
- const [isChecking, setIsChecking] = React.useState(true);
1020
- const [needsLicense, setNeedsLicense] = React.useState(false);
1021
- const [isCreating, setIsCreating] = React.useState(false);
1022
- const [useExistingKey, setUseExistingKey] = React.useState(false);
1023
- const [useAutoCreate, setUseAutoCreate] = React.useState(true);
1024
- const [existingLicenseKey, setExistingLicenseKey] = React.useState("");
1025
- const [existingEmail, setExistingEmail] = React.useState("");
1026
- const [adminUser, setAdminUser] = React.useState(null);
1027
- const [formData, setFormData] = React.useState({
1028
- email: "",
1029
- firstName: "",
1030
- lastName: ""
1031
- });
1032
- React.useEffect(() => {
1033
- checkLicenseStatus();
1034
- fetchAdminUser();
1035
- }, []);
1036
- const fetchAdminUser = async () => {
1037
- try {
1038
- const response = await get("/admin/users/me");
1039
- console.log("Admin user response:", response);
1040
- const userData = response.data?.data || response.data;
1041
- console.log("User data extracted:", userData);
1042
- if (userData) {
1043
- setAdminUser(userData);
1044
- setFormData({
1045
- email: userData.email || "",
1046
- firstName: userData.firstname || "",
1047
- lastName: userData.lastname || ""
1048
- });
1049
- console.log("Admin user set:", {
1050
- email: userData.email,
1051
- firstname: userData.firstname,
1052
- lastname: userData.lastname
1053
- });
1054
- }
1055
- } catch (error) {
1056
- console.error("Error fetching admin user:", error);
1057
- }
1058
- };
1059
- const checkLicenseStatus = async () => {
1060
- setIsChecking(true);
1061
- try {
1062
- const response = await get("/magic-mark/license/status");
1063
- if (response.data.valid) {
1064
- setNeedsLicense(false);
1065
- } else {
1066
- setNeedsLicense(true);
1067
- }
1068
- } catch (error) {
1069
- console.error("Error checking license:", error);
1070
- setNeedsLicense(true);
1071
- } finally {
1072
- setIsChecking(false);
1073
- }
1074
- };
1075
- const handleAutoCreateLicense = async (e) => {
1076
- e.preventDefault();
1077
- setIsCreating(true);
1078
- try {
1079
- console.log("Auto-creating license with admin user data...");
1080
- const response = await post("/magic-mark/license/auto-create", {});
1081
- if (response.data && response.data.success) {
1082
- toggleNotification({
1083
- type: "success",
1084
- message: `License automatically created! Reloading...`
1085
- });
1086
- setNeedsLicense(false);
1087
- setTimeout(() => {
1088
- window.location.reload();
1089
- }, 500);
1090
- } else {
1091
- throw new Error("Failed to auto-create license");
1092
- }
1093
- } catch (error) {
1094
- console.error("Error auto-creating license:", error);
1095
- toggleNotification({
1096
- type: "danger",
1097
- message: error?.response?.data?.error?.message || "Failed to auto-create license. Try manual creation."
1098
- });
1099
- setIsCreating(false);
1100
- setUseAutoCreate(false);
1101
- }
1102
- };
1103
- const handleCreateLicense = async (e) => {
1104
- e.preventDefault();
1105
- if (!formData.email || !formData.firstName || !formData.lastName) {
1106
- toggleNotification({
1107
- type: "warning",
1108
- message: "Please fill in all fields"
1109
- });
1110
- return;
1111
- }
1112
- setIsCreating(true);
1113
- try {
1114
- console.log("Creating license with data:", formData);
1115
- const response = await post("/magic-mark/license/create", formData);
1116
- console.log("License creation response:", response);
1117
- if (response.data && response.data.success) {
1118
- toggleNotification({
1119
- type: "success",
1120
- message: `License created successfully! Reloading...`
1121
- });
1122
- setNeedsLicense(false);
1123
- setTimeout(() => {
1124
- window.location.reload();
1125
- }, 500);
1126
- } else {
1127
- throw new Error("Failed to create license");
1128
- }
1129
- } catch (error) {
1130
- console.error("Error creating license:", error);
1131
- toggleNotification({
1132
- type: "danger",
1133
- message: error?.response?.data?.error?.message || "Failed to create license. Please try again."
1134
- });
1135
- setIsCreating(false);
1136
- }
1137
- };
1138
- const handleValidateExistingKey = async (e) => {
1139
- e.preventDefault();
1140
- if (!existingLicenseKey.trim() || !existingEmail.trim()) {
1141
- toggleNotification({
1142
- type: "warning",
1143
- message: "Please enter both license key and email address"
1144
- });
1145
- return;
1146
- }
1147
- setIsCreating(true);
1148
- try {
1149
- console.log("Validating existing license key...");
1150
- const pluginStore = await post("/magic-mark/license/store-key", {
1151
- licenseKey: existingLicenseKey.trim(),
1152
- email: existingEmail.trim()
1153
- });
1154
- if (pluginStore.data && pluginStore.data.success) {
1155
- toggleNotification({
1156
- type: "success",
1157
- message: "License key validated successfully! Reloading..."
1158
- });
1159
- setNeedsLicense(false);
1160
- setTimeout(() => {
1161
- window.location.reload();
1162
- }, 500);
1163
- } else {
1164
- throw new Error("Invalid license key or email");
1165
- }
1166
- } catch (error) {
1167
- console.error("Error validating license key:", error);
1168
- toggleNotification({
1169
- type: "danger",
1170
- message: error?.response?.data?.error?.message || "Invalid license key or email address. Please check and try again."
1171
- });
1172
- setIsCreating(false);
1173
- }
1174
- };
1175
- const handleClose = () => {
1176
- navigate("/content-manager");
1177
- };
1178
- if (isChecking) {
1179
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 8, style: { textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Checking license..." }) });
1180
- }
1181
- if (needsLicense) {
1182
- return /* @__PURE__ */ jsxRuntime.jsx(ModalOverlay, { children: /* @__PURE__ */ jsxRuntime.jsxs(ModalContent, { children: [
1183
- /* @__PURE__ */ jsxRuntime.jsxs(GradientHeader, { children: [
1184
- /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: handleClose, type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}) }),
1185
- /* @__PURE__ */ jsxRuntime.jsx(IconWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.Key, {}) }),
1186
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { textAlign: "center", position: "relative" }, children: [
1187
- /* @__PURE__ */ jsxRuntime.jsx(
1188
- designSystem.Typography,
1189
- {
1190
- variant: "alpha",
1191
- style: {
1192
- color: "white",
1193
- fontSize: "24px",
1194
- fontWeight: "700",
1195
- marginBottom: "12px",
1196
- display: "block"
1197
- },
1198
- children: "Activate MagicMark Plugin"
1199
- }
1200
- ),
1201
- /* @__PURE__ */ jsxRuntime.jsx(
1202
- designSystem.Typography,
1203
- {
1204
- variant: "epsilon",
1205
- style: {
1206
- color: "rgba(255, 255, 255, 0.9)",
1207
- fontSize: "14px",
1208
- display: "block"
1209
- },
1210
- children: useExistingKey ? "Enter your existing license key" : "Create a license to start using the plugin"
1211
- }
1212
- )
1213
- ] })
1214
- ] }),
1215
- /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: useExistingKey ? handleValidateExistingKey : useAutoCreate ? handleAutoCreateLicense : handleCreateLicense, children: /* @__PURE__ */ jsxRuntime.jsx(
1216
- designSystem.Box,
1217
- {
1218
- padding: 6,
1219
- paddingLeft: 8,
1220
- paddingRight: 8,
1221
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, style: { width: "100%" }, children: [
1222
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { textAlign: "center", width: "100%" }, children: [
1223
- !useExistingKey && /* @__PURE__ */ jsxRuntime.jsx(
1224
- ToggleButton,
1225
- {
1226
- type: "button",
1227
- onClick: () => setUseAutoCreate(!useAutoCreate),
1228
- disabled: isCreating,
1229
- style: { marginBottom: "8px", display: "block", margin: "0 auto" },
1230
- children: useAutoCreate ? "→ Manual entry" : "← Auto-create with my account"
1231
- }
1232
- ),
1233
- /* @__PURE__ */ jsxRuntime.jsx(
1234
- ToggleButton,
1235
- {
1236
- type: "button",
1237
- onClick: () => {
1238
- setUseExistingKey(!useExistingKey);
1239
- if (!useExistingKey) setUseAutoCreate(false);
1240
- },
1241
- disabled: isCreating,
1242
- children: useExistingKey ? "← Create new license" : "Have a license key? →"
1243
- }
1244
- )
1245
- ] }),
1246
- /* @__PURE__ */ jsxRuntime.jsx(
1247
- designSystem.Box,
1248
- {
1249
- background: "primary100",
1250
- padding: 4,
1251
- style: {
1252
- borderRadius: "8px",
1253
- border: "2px solid rgba(14, 165, 233, 0.3)",
1254
- width: "100%"
1255
- },
1256
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", style: { fontSize: "13px", lineHeight: "1.6" }, children: useExistingKey ? "Enter your email and license key to activate." : useAutoCreate && adminUser && adminUser.email ? `Click "Activate" to auto-create a license with your account (${adminUser.email})` : useAutoCreate ? 'Click "Activate" to auto-create a license with your admin account' : "A license will be created with the details below." })
1257
- }
1258
- ),
1259
- useExistingKey ? (
1260
- // Existing License Key Input
1261
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1262
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: "100%" }, children: [
1263
- /* @__PURE__ */ jsxRuntime.jsx(
1264
- designSystem.Typography,
1265
- {
1266
- variant: "pi",
1267
- fontWeight: "bold",
1268
- style: { marginBottom: "8px", display: "block" },
1269
- children: "Email Address *"
1270
- }
1271
- ),
1272
- /* @__PURE__ */ jsxRuntime.jsx(
1273
- designSystem.TextInput,
1274
- {
1275
- placeholder: "admin@example.com",
1276
- type: "email",
1277
- value: existingEmail,
1278
- onChange: (e) => setExistingEmail(e.target.value),
1279
- required: true,
1280
- disabled: isCreating
1281
- }
1282
- ),
1283
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { fontSize: "11px", marginTop: "4px" }, children: "Enter the email address associated with this license" })
1284
- ] }),
1285
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: "100%" }, children: [
1286
- /* @__PURE__ */ jsxRuntime.jsx(
1287
- designSystem.Typography,
1288
- {
1289
- variant: "pi",
1290
- fontWeight: "bold",
1291
- style: { marginBottom: "8px", display: "block" },
1292
- children: "License Key *"
1293
- }
1294
- ),
1295
- /* @__PURE__ */ jsxRuntime.jsx(
1296
- designSystem.TextInput,
1297
- {
1298
- placeholder: "67C5-40D2-7695-718C",
1299
- value: existingLicenseKey,
1300
- onChange: (e) => setExistingLicenseKey(e.target.value),
1301
- required: true,
1302
- disabled: isCreating
1303
- }
1304
- ),
1305
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { fontSize: "11px", marginTop: "4px" }, children: "Enter the license key in the format: XXXX-XXXX-XXXX-XXXX" })
1306
- ] })
1307
- ] })
1308
- ) : useAutoCreate && adminUser ? (
1309
- // Auto-create mode - Show user info
1310
- /* @__PURE__ */ jsxRuntime.jsxs(
1311
- designSystem.Box,
1312
- {
1313
- background: "success100",
1314
- padding: 5,
1315
- style: {
1316
- borderRadius: "8px",
1317
- border: "2px solid rgba(34, 197, 94, 0.15)",
1318
- textAlign: "center"
1319
- },
1320
- children: [
1321
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", style: { marginBottom: "12px", display: "block" }, children: "Ready to activate with your account:" }),
1322
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, style: { marginBottom: "4px" }, children: [
1323
- /* @__PURE__ */ jsxRuntime.jsx(icons.User, { fill: "neutral700", width: "14px", height: "14px" }),
1324
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", children: [
1325
- adminUser.firstname || "Admin",
1326
- " ",
1327
- adminUser.lastname || "User"
1328
- ] })
1329
- ] }),
1330
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
1331
- /* @__PURE__ */ jsxRuntime.jsx(icons.Mail, { fill: "neutral600", width: "14px", height: "14px" }),
1332
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: adminUser.email || "Loading..." })
1333
- ] })
1334
- ]
1335
- }
1336
- )
1337
- ) : (
1338
- // Manual Create License Fields
1339
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1340
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: "100%" }, children: [
1341
- /* @__PURE__ */ jsxRuntime.jsx(
1342
- designSystem.Typography,
1343
- {
1344
- variant: "pi",
1345
- fontWeight: "bold",
1346
- style: { marginBottom: "8px", display: "block" },
1347
- children: "Email Address *"
1348
- }
1349
- ),
1350
- /* @__PURE__ */ jsxRuntime.jsx(
1351
- designSystem.TextInput,
1352
- {
1353
- placeholder: "admin@example.com",
1354
- type: "email",
1355
- value: formData.email,
1356
- onChange: (e) => setFormData({ ...formData, email: e.target.value }),
1357
- required: true,
1358
- disabled: isCreating
1359
- }
1360
- )
1361
- ] }),
1362
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: "100%" }, children: [
1363
- /* @__PURE__ */ jsxRuntime.jsx(
1364
- designSystem.Typography,
1365
- {
1366
- variant: "pi",
1367
- fontWeight: "bold",
1368
- style: { marginBottom: "8px", display: "block" },
1369
- children: "First Name *"
1370
- }
1371
- ),
1372
- /* @__PURE__ */ jsxRuntime.jsx(
1373
- designSystem.TextInput,
1374
- {
1375
- placeholder: "John",
1376
- value: formData.firstName,
1377
- onChange: (e) => setFormData({ ...formData, firstName: e.target.value }),
1378
- required: true,
1379
- disabled: isCreating
1380
- }
1381
- )
1382
- ] }),
1383
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: "100%" }, children: [
1384
- /* @__PURE__ */ jsxRuntime.jsx(
1385
- designSystem.Typography,
1386
- {
1387
- variant: "pi",
1388
- fontWeight: "bold",
1389
- style: { marginBottom: "8px", display: "block" },
1390
- children: "Last Name *"
1391
- }
1392
- ),
1393
- /* @__PURE__ */ jsxRuntime.jsx(
1394
- designSystem.TextInput,
1395
- {
1396
- placeholder: "Doe",
1397
- value: formData.lastName,
1398
- onChange: (e) => setFormData({ ...formData, lastName: e.target.value }),
1399
- required: true,
1400
- disabled: isCreating
1401
- }
1402
- )
1403
- ] })
1404
- ] })
1405
- ),
1406
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 3, justifyContent: "center", style: { marginTop: "16px" }, children: useExistingKey ? /* @__PURE__ */ jsxRuntime.jsx(
1407
- designSystem.Button,
1408
- {
1409
- type: "submit",
1410
- size: "L",
1411
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}),
1412
- loading: isCreating,
1413
- disabled: isCreating || !existingLicenseKey.trim() || !existingEmail.trim(),
1414
- style: {
1415
- background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
1416
- color: "white",
1417
- fontWeight: "600",
1418
- border: "none",
1419
- boxShadow: "0 4px 12px rgba(102, 126, 234, 0.4)"
1420
- },
1421
- children: "Validate License"
1422
- }
1423
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1424
- designSystem.Button,
1425
- {
1426
- type: "submit",
1427
- size: "L",
1428
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}),
1429
- loading: isCreating,
1430
- disabled: isCreating || !useAutoCreate && (!formData.email || !formData.firstName || !formData.lastName),
1431
- style: {
1432
- background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
1433
- color: "white",
1434
- fontWeight: "600",
1435
- border: "none",
1436
- boxShadow: "0 4px 12px rgba(102, 126, 234, 0.4)"
1437
- },
1438
- children: useAutoCreate ? "Activate License" : "Create License"
1439
- }
1440
- ) })
1441
- ] })
1442
- }
1443
- ) })
1444
- ] }) });
1445
- }
1446
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
1447
- };
1448
- const App = () => {
1449
- return /* @__PURE__ */ jsxRuntime.jsx(LicenseGuard, { children: /* @__PURE__ */ jsxRuntime.jsx(HomePageModern, {}) });
1450
- };
1451
- exports.default = App;