magic-editor-x 1.6.0 → 2.1.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 (97) hide show
  1. package/CHANGELOG.md +322 -0
  2. package/LICENSE +1 -7
  3. package/README.md +398 -969
  4. package/dist/admin/ConfigurationPage-CK2AbfGW.mjs +886 -0
  5. package/dist/admin/ConfigurationPage-CzsT_dO_.js +888 -0
  6. package/dist/admin/CustomBlocksPage-B2A8S5MV.mjs +1741 -0
  7. package/dist/admin/CustomBlocksPage-CvLrsBds.js +1743 -0
  8. package/dist/admin/EditorField-7YCdXx-v.mjs +6829 -0
  9. package/dist/admin/EditorField-BdBCW15Q.js +6864 -0
  10. package/dist/admin/api-CmccMxlN.js +36 -0
  11. package/dist/admin/api-D5CAH0nh.mjs +37 -0
  12. package/dist/admin/de-BHPyA2S-.mjs +103 -0
  13. package/dist/admin/de-Bt6pYIWi.mjs +246 -0
  14. package/dist/admin/de-CVbi685U.js +246 -0
  15. package/dist/admin/de-CkUYGb7U.js +176 -0
  16. package/dist/admin/de-DBR893G4.js +13 -0
  17. package/dist/admin/de-RMs-_SCK.js +103 -0
  18. package/dist/admin/de-fBFh09Wl.mjs +13 -0
  19. package/dist/admin/de-rRIutpYJ.mjs +176 -0
  20. package/dist/admin/en-BX362fTp.js +246 -0
  21. package/dist/admin/en-B_HltUxZ.mjs +246 -0
  22. package/dist/admin/en-BluCStLw.mjs +103 -0
  23. package/dist/admin/en-C81faOHP.js +103 -0
  24. package/dist/admin/en-D9Nfccux.mjs +13 -0
  25. package/dist/admin/en-DulOcmXb.js +176 -0
  26. package/dist/admin/en-Puup8TFi.mjs +176 -0
  27. package/dist/admin/en-gueRT44P.js +13 -0
  28. package/dist/admin/es-257SSB7f.mjs +176 -0
  29. package/dist/admin/es-B0Zy8DVg.mjs +13 -0
  30. package/dist/admin/es-BoQZC86B.js +176 -0
  31. package/dist/admin/es-CHHEZi44.js +246 -0
  32. package/dist/admin/es-CQRI2Prp.mjs +103 -0
  33. package/dist/admin/es-CrhwOq-5.mjs +246 -0
  34. package/dist/admin/es-D1QzY0JW.js +103 -0
  35. package/dist/admin/es-DRGs7meF.js +13 -0
  36. package/dist/admin/fr-5djKfQ3s.mjs +246 -0
  37. package/dist/admin/fr-B3SL0TBV.js +246 -0
  38. package/dist/admin/fr-B8rdLAIL.js +13 -0
  39. package/dist/admin/fr-C5rSdKU4.mjs +176 -0
  40. package/dist/admin/fr-Di3R6gOX.mjs +103 -0
  41. package/dist/admin/fr-HxFcPpv4.js +176 -0
  42. package/dist/admin/fr-R3_MbzT5.js +103 -0
  43. package/dist/admin/fr-oiUb2bb_.mjs +13 -0
  44. package/dist/admin/index-0_b1iroK.mjs +156 -0
  45. package/dist/admin/index-6SZLli70.js +155 -0
  46. package/dist/admin/index.js +1 -1
  47. package/dist/admin/index.mjs +2 -2
  48. package/dist/admin/pt-B3Jce6uT.mjs +13 -0
  49. package/dist/admin/pt-BCW1u_Hp.js +103 -0
  50. package/dist/admin/pt-BdnY2Cth.mjs +246 -0
  51. package/dist/admin/pt-BiWuSBcH.js +13 -0
  52. package/dist/admin/pt-Cjn2Sc9k.js +176 -0
  53. package/dist/admin/pt-Cr9AL408.mjs +103 -0
  54. package/dist/admin/pt-D6UuEtPy.mjs +176 -0
  55. package/dist/admin/pt-EVwCuBUK.js +246 -0
  56. package/dist/admin/sanitize-DP5aeU7V.js +597 -0
  57. package/dist/admin/sanitize-jjCot5PM.mjs +596 -0
  58. package/dist/admin/useT-91ruePzq.js +130 -0
  59. package/dist/admin/useT-vgY88N_H.mjs +131 -0
  60. package/dist/server/index.js +5373 -64722
  61. package/dist/server/index.mjs +5373 -64731
  62. package/package.json +90 -66
  63. package/strapi-admin.js +3 -0
  64. package/strapi-server.js +3 -0
  65. package/COPYRIGHT_NOTICE.txt +0 -20
  66. package/dist/admin/App-BwMEZnS-.mjs +0 -2144
  67. package/dist/admin/App-HNr2tizR.js +0 -2147
  68. package/dist/admin/CustomBlocksPage-BjcA7MGz.js +0 -1519
  69. package/dist/admin/CustomBlocksPage-COPOZ2-_.mjs +0 -1517
  70. package/dist/admin/LicensePage-D0DMTF41.mjs +0 -392
  71. package/dist/admin/LicensePage-D0_9yPkw.js +0 -394
  72. package/dist/admin/LiveCollaborationPanel-CZAbgAVr.js +0 -223
  73. package/dist/admin/LiveCollaborationPanel-D8z72afw.mjs +0 -221
  74. package/dist/admin/Settings-DRenvRcG.js +0 -441
  75. package/dist/admin/Settings-DjyNURlS.mjs +0 -439
  76. package/dist/admin/de-C_0Mj-Zo.mjs +0 -296
  77. package/dist/admin/de-DVNVpAt9.js +0 -296
  78. package/dist/admin/en-B7AAf1ie.mjs +0 -296
  79. package/dist/admin/en-C2hv5GsA.js +0 -296
  80. package/dist/admin/es-BzJqcIST.js +0 -274
  81. package/dist/admin/es-zdP8sd-f.mjs +0 -274
  82. package/dist/admin/fr-CtAgOgH1.mjs +0 -274
  83. package/dist/admin/fr-D3GwqAAJ.js +0 -274
  84. package/dist/admin/getTranslation-2OiEgVGt.mjs +0 -49459
  85. package/dist/admin/getTranslation-DQ_WJ-7M.js +0 -49475
  86. package/dist/admin/index-Bn2tfJrC.js +0 -2186
  87. package/dist/admin/index-DAtClhqy.js +0 -6956
  88. package/dist/admin/index-FVEbTfqO.mjs +0 -2187
  89. package/dist/admin/index-gjWl-6E2.mjs +0 -6934
  90. package/dist/admin/magic-editor-x.css +0 -1103
  91. package/dist/admin/pt-BmUw6YMP.mjs +0 -274
  92. package/dist/admin/pt-CFo0nTbj.js +0 -274
  93. package/dist/admin/tools-CzHTZaY_.mjs +0 -2268
  94. package/dist/admin/tools-DALFhvPO.js +0 -2299
  95. package/pics/collab-magiceditorX.png +0 -0
  96. package/pics/editorX.png +0 -0
  97. package/pics/liveCollabwidget1.png +0 -0
@@ -1,2144 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useState, useRef, useEffect } from "react";
3
- import { useNavigate, Routes, Route } from "react-router-dom";
4
- import { useFetchClient, useNotification, Page } from "@strapi/strapi/admin";
5
- import { P as PLUGIN_ID, p as pluginPermissions } from "./index-FVEbTfqO.mjs";
6
- import styled, { css, keyframes } from "styled-components";
7
- import { HashtagIcon, DocumentTextIcon, ListBulletIcon, CheckIcon, ChatBubbleBottomCenterTextIcon, CodeBracketIcon, PhotoIcon, TableCellsIcon, LinkIcon, ExclamationTriangleIcon, PaperClipIcon, BellAlertIcon, SparklesIcon, BeakerIcon, PlayCircleIcon, ArrowPathIcon, EyeIcon, DocumentDuplicateIcon, ChevronRightIcon, CubeTransparentIcon, Cog6ToothIcon, UserGroupIcon, BookOpenIcon, CommandLineIcon, UserPlusIcon, TrashIcon, CheckCircleIcon, XMarkIcon, KeyIcon } from "@heroicons/react/24/outline";
8
- import EditorJS from "@editorjs/editorjs";
9
- import { useIntl } from "react-intl";
10
- import { g as getTools } from "./tools-CzHTZaY_.mjs";
11
- import { g as getTranslation, k as kt, S, A, C, P as Pc, a as Ct } from "./getTranslation-2OiEgVGt.mjs";
12
- import LicensePage from "./LicensePage-D0DMTF41.mjs";
13
- const fadeInUp = keyframes`
14
- from { opacity: 0; transform: translateY(20px); }
15
- to { opacity: 1; transform: translateY(0); }
16
- `;
17
- const pulse = keyframes`
18
- 0%, 100% { opacity: 1; transform: scale(1); }
19
- 50% { opacity: 0.8; transform: scale(1.05); }
20
- `;
21
- keyframes`
22
- 0% { background-position: -200% 0; }
23
- 100% { background-position: 200% 0; }
24
- `;
25
- const spin = keyframes`
26
- from { transform: rotate(0deg); }
27
- to { transform: rotate(360deg); }
28
- `;
29
- const PageWrapper = styled.div`
30
- min-height: 100vh;
31
- background: ${(props) => props.theme.colors.neutral100};
32
- `;
33
- const Container$1 = styled.div`
34
- max-width: 1400px;
35
- margin: 0 auto;
36
- padding: 32px;
37
- `;
38
- const Header$1 = styled.header`
39
- display: flex;
40
- align-items: center;
41
- justify-content: space-between;
42
- margin-bottom: 32px;
43
- padding-bottom: 24px;
44
- border-bottom: 1px solid ${(props) => props.theme.colors.neutral200};
45
- `;
46
- const HeaderLeft = styled.div`
47
- display: flex;
48
- align-items: center;
49
- gap: 16px;
50
- `;
51
- const Logo = styled.div`
52
- width: 48px;
53
- height: 48px;
54
- background: linear-gradient(135deg, #7C3AED 0%, #6366f1 100%);
55
- border-radius: 14px;
56
- display: flex;
57
- align-items: center;
58
- justify-content: center;
59
- box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
60
-
61
- svg {
62
- width: 26px;
63
- height: 26px;
64
- color: white;
65
- }
66
- `;
67
- const HeaderTitle = styled.div`
68
- h1 {
69
- font-size: 24px;
70
- font-weight: 700;
71
- color: ${(props) => props.theme.colors.neutral800};
72
- margin: 0 0 4px 0;
73
- }
74
-
75
- p {
76
- font-size: 14px;
77
- color: ${(props) => props.theme.colors.neutral600};
78
- margin: 0;
79
- }
80
- `;
81
- const HeaderRight = styled.div`
82
- display: flex;
83
- align-items: center;
84
- gap: 12px;
85
- `;
86
- const StatusBadge = styled.div`
87
- display: flex;
88
- align-items: center;
89
- gap: 8px;
90
- padding: 8px 16px;
91
- background: ${(props) => props.$active ? "rgba(34, 197, 94, 0.1)" : "rgba(100, 116, 139, 0.1)"};
92
- border: 1px solid ${(props) => props.$active ? "rgba(34, 197, 94, 0.2)" : "rgba(100, 116, 139, 0.2)"};
93
- border-radius: 100px;
94
- font-size: 13px;
95
- font-weight: 500;
96
- color: ${(props) => props.$active ? "#22c55e" : "#64748b"};
97
-
98
- &::before {
99
- content: '';
100
- width: 8px;
101
- height: 8px;
102
- background: ${(props) => props.$active ? "#22c55e" : "#64748b"};
103
- border-radius: 50%;
104
- animation: ${(props) => props.$active ? pulse : "none"} 2s ease-in-out infinite;
105
- }
106
- `;
107
- const Grid = styled.div`
108
- display: grid;
109
- grid-template-columns: 1fr 380px;
110
- gap: 24px;
111
-
112
- @media (max-width: 1100px) {
113
- grid-template-columns: 1fr;
114
- }
115
- `;
116
- const MainArea = styled.div`
117
- display: flex;
118
- flex-direction: column;
119
- gap: 24px;
120
- `;
121
- const Sidebar = styled.aside`
122
- display: flex;
123
- flex-direction: column;
124
- gap: 24px;
125
- `;
126
- const Card$1 = styled.div`
127
- background: ${(props) => props.theme.colors.neutral0};
128
- border: 1px solid ${(props) => props.theme.colors.neutral200};
129
- border-radius: 16px;
130
- overflow: hidden;
131
- animation: ${fadeInUp} 0.5s ease ${(props) => props.$delay || 0}s both;
132
- `;
133
- const CardHeader$1 = styled.div`
134
- display: flex;
135
- align-items: center;
136
- justify-content: space-between;
137
- padding: 20px 24px;
138
- border-bottom: 1px solid ${(props) => props.theme.colors.neutral200};
139
- background: ${(props) => props.theme.colors.neutral100};
140
- `;
141
- const CardTitle$1 = styled.h2`
142
- display: flex;
143
- align-items: center;
144
- gap: 10px;
145
- font-size: 16px;
146
- font-weight: 600;
147
- color: ${(props) => props.theme.colors.neutral800};
148
- margin: 0;
149
-
150
- svg {
151
- width: 20px;
152
- height: 20px;
153
- color: #7C3AED;
154
- }
155
- `;
156
- const CardContent = styled.div`
157
- padding: ${(props) => props.$noPadding ? "0" : "24px"};
158
- `;
159
- const CardActions = styled.div`
160
- display: flex;
161
- gap: 8px;
162
- `;
163
- const IconButton = styled.button`
164
- width: 36px;
165
- height: 36px;
166
- border: 1px solid ${(props) => props.theme.colors.neutral200};
167
- border-radius: 10px;
168
- background: ${(props) => props.theme.colors.neutral0};
169
- color: ${(props) => props.theme.colors.neutral600};
170
- display: flex;
171
- align-items: center;
172
- justify-content: center;
173
- cursor: pointer;
174
- transition: all 0.15s ease;
175
-
176
- svg {
177
- width: 18px;
178
- height: 18px;
179
- }
180
-
181
- &:hover {
182
- background: ${(props) => props.theme.colors.neutral100};
183
- border-color: #7C3AED;
184
- color: #7C3AED;
185
- }
186
-
187
- ${(props) => props.$spinning && css`
188
- svg {
189
- animation: ${spin} 1s linear infinite;
190
- }
191
- `}
192
- `;
193
- const Button$1 = styled.button`
194
- display: inline-flex;
195
- align-items: center;
196
- gap: 8px;
197
- padding: 10px 20px;
198
- background: ${(props) => props.$primary ? "linear-gradient(135deg, #7C3AED 0%, #6366f1 100%)" : props.theme.colors.neutral0};
199
- border: 1px solid ${(props) => props.$primary ? "transparent" : props.theme.colors.neutral200};
200
- border-radius: 10px;
201
- font-size: 14px;
202
- font-weight: 600;
203
- color: ${(props) => props.$primary ? "white" : props.theme.colors.neutral800};
204
- cursor: pointer;
205
- transition: all 0.2s ease;
206
-
207
- svg {
208
- width: 18px;
209
- height: 18px;
210
- }
211
-
212
- &:hover {
213
- transform: translateY(-2px);
214
- box-shadow: ${(props) => props.$primary ? "0 8px 24px rgba(124, 58, 237, 0.3)" : "0 4px 12px rgba(0, 0, 0, 0.1)"};
215
- }
216
-
217
- &:disabled {
218
- opacity: 0.6;
219
- cursor: not-allowed;
220
- transform: none;
221
- }
222
- `;
223
- const PlaygroundWrapper = styled.div`
224
- min-height: 400px;
225
- border: 2px dashed ${(props) => props.theme.colors.neutral300};
226
- border-radius: 12px;
227
- margin: 16px;
228
- position: relative;
229
- transition: all 0.2s ease;
230
-
231
- &:focus-within {
232
- border-color: #7C3AED;
233
- border-style: solid;
234
- }
235
- `;
236
- const PlaygroundEditor = styled.div`
237
- padding: 24px;
238
- min-height: 350px;
239
-
240
- .codex-editor__redactor {
241
- padding-bottom: 60px !important;
242
- }
243
- `;
244
- const PlaygroundEmpty = styled.div`
245
- position: absolute;
246
- top: 50%;
247
- left: 50%;
248
- transform: translate(-50%, -50%);
249
- text-align: center;
250
- color: ${(props) => props.theme.colors.neutral500};
251
- pointer-events: none;
252
-
253
- svg {
254
- width: 48px;
255
- height: 48px;
256
- margin-bottom: 12px;
257
- opacity: 0.5;
258
- }
259
-
260
- p {
261
- font-size: 15px;
262
- margin: 0;
263
- }
264
- `;
265
- const OutputPreview = styled.div`
266
- background: #1e293b;
267
- border-radius: 12px;
268
- margin: 16px;
269
- overflow: hidden;
270
- `;
271
- const OutputHeader = styled.div`
272
- display: flex;
273
- align-items: center;
274
- justify-content: space-between;
275
- padding: 12px 16px;
276
- background: #0f172a;
277
- border-bottom: 1px solid #334155;
278
- `;
279
- const OutputTitle = styled.span`
280
- font-size: 12px;
281
- font-weight: 600;
282
- color: #94a3b8;
283
- text-transform: uppercase;
284
- letter-spacing: 0.5px;
285
- `;
286
- const OutputContent = styled.pre`
287
- padding: 16px;
288
- margin: 0;
289
- font-family: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
290
- font-size: 12px;
291
- color: #e2e8f0;
292
- overflow-x: auto;
293
- max-height: 300px;
294
-
295
- .key { color: #7dd3fc; }
296
- .string { color: #86efac; }
297
- .number { color: #fcd34d; }
298
- .boolean { color: #f472b6; }
299
- .null { color: #94a3b8; }
300
- `;
301
- const ToolGrid = styled.div`
302
- display: grid;
303
- grid-template-columns: repeat(2, 1fr);
304
- gap: 8px;
305
- padding: 16px;
306
-
307
- @media (max-width: 480px) {
308
- grid-template-columns: 1fr;
309
- }
310
- `;
311
- const ToolItem = styled.div`
312
- display: flex;
313
- align-items: center;
314
- gap: 10px;
315
- padding: 12px;
316
- background: ${(props) => props.$active ? "rgba(124, 58, 237, 0.08)" : props.theme.colors.neutral100};
317
- border: 1px solid ${(props) => props.$active ? "rgba(124, 58, 237, 0.2)" : "transparent"};
318
- border-radius: 10px;
319
- cursor: pointer;
320
- transition: all 0.15s ease;
321
-
322
- &:hover {
323
- background: rgba(124, 58, 237, 0.05);
324
- }
325
- `;
326
- const ToolIcon = styled.div`
327
- width: 32px;
328
- height: 32px;
329
- background: ${(props) => props.$color || "linear-gradient(135deg, #7C3AED 0%, #6366f1 100%)"};
330
- border-radius: 8px;
331
- display: flex;
332
- align-items: center;
333
- justify-content: center;
334
-
335
- svg {
336
- width: 16px;
337
- height: 16px;
338
- color: white;
339
- }
340
- `;
341
- const ToolInfo = styled.div`
342
- flex: 1;
343
- min-width: 0;
344
-
345
- h4 {
346
- font-size: 13px;
347
- font-weight: 600;
348
- color: ${(props) => props.theme.colors.neutral800};
349
- margin: 0 0 2px 0;
350
- }
351
-
352
- p {
353
- font-size: 11px;
354
- color: ${(props) => props.theme.colors.neutral600};
355
- margin: 0;
356
- white-space: nowrap;
357
- overflow: hidden;
358
- text-overflow: ellipsis;
359
- }
360
- `;
361
- const ShortcutList = styled.div`
362
- display: flex;
363
- flex-direction: column;
364
- gap: 4px;
365
- padding: 16px;
366
- `;
367
- const ShortcutItem = styled.div`
368
- display: flex;
369
- align-items: center;
370
- justify-content: space-between;
371
- padding: 10px 12px;
372
- background: ${(props) => props.theme.colors.neutral100};
373
- border-radius: 8px;
374
- `;
375
- const ShortcutLabel = styled.span`
376
- font-size: 13px;
377
- color: ${(props) => props.theme.colors.neutral800};
378
- `;
379
- const ShortcutKeys = styled.div`
380
- display: flex;
381
- gap: 4px;
382
- `;
383
- const Kbd = styled.kbd`
384
- display: inline-flex;
385
- align-items: center;
386
- justify-content: center;
387
- min-width: 24px;
388
- height: 24px;
389
- padding: 0 8px;
390
- background: ${(props) => props.theme.colors.neutral0};
391
- border: 1px solid ${(props) => props.theme.colors.neutral200};
392
- border-radius: 6px;
393
- font-family: 'SF Mono', Monaco, monospace;
394
- font-size: 11px;
395
- font-weight: 600;
396
- color: ${(props) => props.theme.colors.neutral600};
397
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
398
- `;
399
- const StatsGrid = styled.div`
400
- display: grid;
401
- grid-template-columns: repeat(2, 1fr);
402
- gap: 12px;
403
- padding: 16px;
404
- `;
405
- const StatCard = styled.div`
406
- padding: 16px;
407
- background: linear-gradient(135deg, ${(props) => props.$bg || "rgba(124, 58, 237, 0.05)"} 0%, transparent 100%);
408
- border-radius: 12px;
409
- text-align: center;
410
- `;
411
- const StatNumber = styled.div`
412
- font-size: 28px;
413
- font-weight: 800;
414
- color: ${(props) => props.$color || "#7C3AED"};
415
- margin-bottom: 4px;
416
- `;
417
- const StatLabel = styled.div`
418
- font-size: 12px;
419
- color: #64748b;
420
- font-weight: 500;
421
- `;
422
- const TabsContainer = styled.div`
423
- display: flex;
424
- gap: 4px;
425
- padding: 4px;
426
- background: ${(props) => props.theme.colors.neutral150};
427
- border-radius: 10px;
428
- `;
429
- const Tab = styled.button`
430
- flex: 1;
431
- padding: 8px 16px;
432
- background: ${(props) => props.$active ? props.theme.colors.neutral0 : "transparent"};
433
- border: none;
434
- border-radius: 8px;
435
- font-size: 13px;
436
- font-weight: 500;
437
- color: ${(props) => props.$active ? props.theme.colors.neutral800 : props.theme.colors.neutral600};
438
- cursor: pointer;
439
- transition: all 0.15s ease;
440
- box-shadow: ${(props) => props.$active ? "0 1px 3px rgba(0, 0, 0, 0.1)" : "none"};
441
-
442
- &:hover {
443
- color: ${(props) => props.theme.colors.neutral800};
444
- }
445
- `;
446
- const QuickLinksGrid = styled.div`
447
- display: flex;
448
- flex-direction: column;
449
- gap: 8px;
450
- padding: 16px;
451
- `;
452
- const QuickLinkItem = styled.button`
453
- display: flex;
454
- align-items: center;
455
- gap: 12px;
456
- padding: 14px 16px;
457
- background: ${(props) => props.$active ? "rgba(124, 58, 237, 0.08)" : props.theme.colors.neutral100};
458
- border: 1px solid ${(props) => props.$active ? "rgba(124, 58, 237, 0.2)" : "transparent"};
459
- border-radius: 12px;
460
- cursor: pointer;
461
- transition: all 0.2s ease;
462
- text-align: left;
463
- width: 100%;
464
-
465
- &:hover {
466
- background: rgba(124, 58, 237, 0.08);
467
- border-color: rgba(124, 58, 237, 0.2);
468
- transform: translateX(4px);
469
- }
470
- `;
471
- const QuickLinkIcon = styled.div`
472
- width: 40px;
473
- height: 40px;
474
- background: ${(props) => props.$color || "linear-gradient(135deg, #7C3AED 0%, #6366f1 100%)"};
475
- border-radius: 10px;
476
- display: flex;
477
- align-items: center;
478
- justify-content: center;
479
- flex-shrink: 0;
480
-
481
- svg {
482
- width: 20px;
483
- height: 20px;
484
- color: white;
485
- }
486
- `;
487
- const QuickLinkInfo = styled.div`
488
- flex: 1;
489
- min-width: 0;
490
-
491
- h4 {
492
- font-size: 14px;
493
- font-weight: 600;
494
- color: ${(props) => props.theme.colors.neutral800};
495
- margin: 0 0 2px 0;
496
- }
497
-
498
- p {
499
- font-size: 12px;
500
- color: ${(props) => props.theme.colors.neutral600};
501
- margin: 0;
502
- }
503
- `;
504
- const QuickLinkArrow = styled.div`
505
- color: ${(props) => props.theme.colors.neutral500};
506
-
507
- svg {
508
- width: 16px;
509
- height: 16px;
510
- }
511
- `;
512
- const HomePage = () => {
513
- const navigate = useNavigate();
514
- const { formatMessage } = useIntl();
515
- const t = (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
516
- const [activeTab, setActiveTab] = useState("playground");
517
- const [editorData, setEditorData] = useState(null);
518
- const [isLoading, setIsLoading] = useState(false);
519
- const [hasContent, setHasContent] = useState(false);
520
- const editorRef = useRef(null);
521
- const editorInstanceRef = useRef(null);
522
- const toolsData = [
523
- { name: t("tools.header", "Header"), desc: t("tools.header.desc", "H1-H6 Headings"), icon: HashtagIcon, color: "linear-gradient(135deg, #7C3AED, #6366f1)" },
524
- { name: t("tools.paragraph", "Paragraph"), desc: t("tools.paragraph.desc", "Text paragraphs"), icon: DocumentTextIcon, color: "linear-gradient(135deg, #334155, #475569)" },
525
- { name: t("tools.list", "List"), desc: t("tools.list.desc", "Nested lists"), icon: ListBulletIcon, color: "linear-gradient(135deg, #14b8a6, #2dd4bf)" },
526
- { name: t("tools.checklist", "Checklist"), desc: t("tools.checklist.desc", "Interactive checkboxes"), icon: CheckIcon, color: "linear-gradient(135deg, #22c55e, #4ade80)" },
527
- { name: t("tools.quote", "Quote"), desc: t("tools.quote.desc", "Quotes with author"), icon: ChatBubbleBottomCenterTextIcon, color: "linear-gradient(135deg, #f59e0b, #fbbf24)" },
528
- { name: t("tools.code", "Code"), desc: t("tools.code.desc", "Code blocks"), icon: CodeBracketIcon, color: "linear-gradient(135deg, #06b6d4, #22d3ee)" },
529
- { name: t("tools.image", "Image"), desc: t("tools.image.desc", "Upload images"), icon: PhotoIcon, color: "linear-gradient(135deg, #ec4899, #f472b6)" },
530
- { name: t("tools.table", "Table"), desc: t("tools.table.desc", "Create tables"), icon: TableCellsIcon, color: "linear-gradient(135deg, #8b5cf6, #a78bfa)" },
531
- { name: t("tools.link", "Link"), desc: t("tools.link.desc", "Link preview"), icon: LinkIcon, color: "linear-gradient(135deg, #3b82f6, #60a5fa)" },
532
- { name: t("tools.warning", "Warning"), desc: t("tools.warning.desc", "Warning notices"), icon: ExclamationTriangleIcon, color: "linear-gradient(135deg, #ef4444, #f87171)" },
533
- { name: t("tools.attaches", "Attaches"), desc: t("tools.attaches.desc", "File attachments"), icon: PaperClipIcon, color: "linear-gradient(135deg, #64748b, #94a3b8)" },
534
- { name: t("tools.alert", "Alert"), desc: t("tools.alert.desc", "Colored alerts"), icon: BellAlertIcon, color: "linear-gradient(135deg, #f97316, #fb923c)" }
535
- ];
536
- const shortcuts = [
537
- { keys: ["⌘", "B"], label: t("shortcuts.bold", "Bold") },
538
- { keys: ["⌘", "I"], label: t("shortcuts.italic", "Italic") },
539
- { keys: ["⌘", "U"], label: t("shortcuts.underline", "Underline") },
540
- { keys: ["⌘", "⇧", "H"], label: t("shortcuts.heading", "Heading") },
541
- { keys: ["⌘", "⇧", "L"], label: t("shortcuts.list", "List") },
542
- { keys: ["⌘", "⇧", "M"], label: t("shortcuts.highlight", "Highlight") },
543
- { keys: ["Tab"], label: t("shortcuts.blockMenu", "Block Menu") },
544
- { keys: ["⌘", "Z"], label: t("shortcuts.undo", "Undo") }
545
- ];
546
- useEffect(() => {
547
- if (activeTab === "playground" && editorRef.current && !editorInstanceRef.current) {
548
- const tools = getTools({
549
- mediaLibToggleFunc: () => {
550
- },
551
- pluginId: PLUGIN_ID
552
- });
553
- const playgroundTools = { ...tools };
554
- delete playgroundTools.image;
555
- delete playgroundTools.attaches;
556
- delete playgroundTools.linkTool;
557
- delete playgroundTools.personality;
558
- delete playgroundTools.mediaLib;
559
- editorInstanceRef.current = new EditorJS({
560
- holder: editorRef.current,
561
- tools: playgroundTools,
562
- placeholder: t("homepage.playground.placeholder", "Type / for block menu or start writing..."),
563
- onChange: async () => {
564
- try {
565
- const data = await editorInstanceRef.current.save();
566
- setEditorData(data);
567
- setHasContent(data.blocks && data.blocks.length > 0);
568
- } catch (e) {
569
- console.warn("Could not save:", e);
570
- }
571
- }
572
- });
573
- }
574
- return () => {
575
- if (editorInstanceRef.current && editorInstanceRef.current.destroy) {
576
- editorInstanceRef.current.destroy();
577
- editorInstanceRef.current = null;
578
- }
579
- };
580
- }, [activeTab]);
581
- const clearPlayground = async () => {
582
- if (editorInstanceRef.current) {
583
- await editorInstanceRef.current.clear();
584
- setEditorData(null);
585
- setHasContent(false);
586
- }
587
- };
588
- const copyJSON = () => {
589
- if (editorData) {
590
- navigator.clipboard.writeText(JSON.stringify(editorData, null, 2));
591
- }
592
- };
593
- const formatJSON = (obj) => {
594
- if (!obj) return "";
595
- const json = JSON.stringify(obj, null, 2);
596
- return json.replace(/"([^"]+)":/g, '<span class="key">"$1"</span>:').replace(/: "([^"]*)"/g, ': <span class="string">"$1"</span>').replace(/: (\d+)/g, ': <span class="number">$1</span>').replace(/: (true|false)/g, ': <span class="boolean">$1</span>').replace(/: null/g, ': <span class="null">null</span>');
597
- };
598
- return /* @__PURE__ */ jsx(PageWrapper, { children: /* @__PURE__ */ jsxs(Container$1, { children: [
599
- /* @__PURE__ */ jsxs(Header$1, { children: [
600
- /* @__PURE__ */ jsxs(HeaderLeft, { children: [
601
- /* @__PURE__ */ jsx(Logo, { children: /* @__PURE__ */ jsx(SparklesIcon, {}) }),
602
- /* @__PURE__ */ jsxs(HeaderTitle, { children: [
603
- /* @__PURE__ */ jsx("h1", { children: t("homepage.title", "Magic Editor X") }),
604
- /* @__PURE__ */ jsx("p", { children: t("homepage.subtitle", "Block Editor Dashboard for Strapi v5") })
605
- ] })
606
- ] }),
607
- /* @__PURE__ */ jsx(HeaderRight, { children: /* @__PURE__ */ jsx(StatusBadge, { $active: true, children: t("homepage.status.ready", "Realtime Ready") }) })
608
- ] }),
609
- /* @__PURE__ */ jsxs(Grid, { children: [
610
- /* @__PURE__ */ jsxs(MainArea, { children: [
611
- /* @__PURE__ */ jsxs(Card$1, { $delay: 0.1, children: [
612
- /* @__PURE__ */ jsxs(CardHeader$1, { children: [
613
- /* @__PURE__ */ jsxs(CardTitle$1, { children: [
614
- /* @__PURE__ */ jsx(BeakerIcon, {}),
615
- t("homepage.playground", "Editor Playground")
616
- ] }),
617
- /* @__PURE__ */ jsx(CardActions, { children: /* @__PURE__ */ jsxs(TabsContainer, { children: [
618
- /* @__PURE__ */ jsx(Tab, { $active: activeTab === "playground", onClick: () => setActiveTab("playground"), children: t("homepage.tabs.editor", "Editor") }),
619
- /* @__PURE__ */ jsx(Tab, { $active: activeTab === "output", onClick: () => setActiveTab("output"), children: t("homepage.tabs.output", "JSON Output") })
620
- ] }) })
621
- ] }),
622
- activeTab === "playground" ? /* @__PURE__ */ jsxs(CardContent, { $noPadding: true, children: [
623
- /* @__PURE__ */ jsxs(PlaygroundWrapper, { children: [
624
- /* @__PURE__ */ jsx(PlaygroundEditor, { ref: editorRef }),
625
- !hasContent && /* @__PURE__ */ jsxs(PlaygroundEmpty, { children: [
626
- /* @__PURE__ */ jsx(PlayCircleIcon, {}),
627
- /* @__PURE__ */ jsx("p", { children: t("homepage.playground.empty", "Type here to try the editor") })
628
- ] })
629
- ] }),
630
- /* @__PURE__ */ jsxs("div", { style: { padding: "0 16px 16px", display: "flex", gap: "8px" }, children: [
631
- /* @__PURE__ */ jsxs(Button$1, { onClick: clearPlayground, children: [
632
- /* @__PURE__ */ jsx(ArrowPathIcon, {}),
633
- t("homepage.button.clear", "Clear")
634
- ] }),
635
- hasContent && /* @__PURE__ */ jsxs(Button$1, { $primary: true, onClick: () => setActiveTab("output"), children: [
636
- /* @__PURE__ */ jsx(EyeIcon, {}),
637
- t("homepage.button.showJson", "Show JSON")
638
- ] })
639
- ] })
640
- ] }) : /* @__PURE__ */ jsxs(CardContent, { $noPadding: true, children: [
641
- /* @__PURE__ */ jsxs(OutputPreview, { children: [
642
- /* @__PURE__ */ jsxs(OutputHeader, { children: [
643
- /* @__PURE__ */ jsx(OutputTitle, { children: t("homepage.output.title", "Editor.js JSON Output") }),
644
- /* @__PURE__ */ jsx(IconButton, { onClick: copyJSON, title: t("homepage.button.copyJson", "Copy JSON"), children: /* @__PURE__ */ jsx(DocumentDuplicateIcon, {}) })
645
- ] }),
646
- /* @__PURE__ */ jsx(
647
- OutputContent,
648
- {
649
- dangerouslySetInnerHTML: {
650
- __html: editorData ? formatJSON(editorData) : `<span class="null">${t("homepage.output.empty", "// No content - create blocks in the editor")}</span>`
651
- }
652
- }
653
- )
654
- ] }),
655
- /* @__PURE__ */ jsx("div", { style: { padding: "0 16px 16px" }, children: /* @__PURE__ */ jsxs(Button$1, { onClick: () => setActiveTab("playground"), children: [
656
- /* @__PURE__ */ jsx(ChevronRightIcon, { style: { transform: "rotate(180deg)" } }),
657
- t("homepage.button.backToEditor", "Back to Editor")
658
- ] }) })
659
- ] })
660
- ] }),
661
- /* @__PURE__ */ jsxs(Card$1, { $delay: 0.2, children: [
662
- /* @__PURE__ */ jsx(CardHeader$1, { children: /* @__PURE__ */ jsxs(CardTitle$1, { children: [
663
- /* @__PURE__ */ jsx(CubeTransparentIcon, {}),
664
- t("homepage.features.title", "Editor Features")
665
- ] }) }),
666
- /* @__PURE__ */ jsx(CardContent, { $noPadding: true, children: /* @__PURE__ */ jsxs(StatsGrid, { children: [
667
- /* @__PURE__ */ jsxs(StatCard, { $bg: "rgba(124, 58, 237, 0.08)", children: [
668
- /* @__PURE__ */ jsx(StatNumber, { $color: "#7C3AED", children: "21+" }),
669
- /* @__PURE__ */ jsx(StatLabel, { children: t("homepage.stats.blockTools", "Block Tools") })
670
- ] }),
671
- /* @__PURE__ */ jsxs(StatCard, { $bg: "rgba(236, 72, 153, 0.08)", children: [
672
- /* @__PURE__ */ jsx(StatNumber, { $color: "#ec4899", children: "6" }),
673
- /* @__PURE__ */ jsx(StatLabel, { children: t("homepage.stats.inlineTools", "Inline Tools") })
674
- ] }),
675
- /* @__PURE__ */ jsxs(StatCard, { $bg: "rgba(34, 197, 94, 0.08)", children: [
676
- /* @__PURE__ */ jsx(StatNumber, { $color: "#22c55e", children: "✓" }),
677
- /* @__PURE__ */ jsx(StatLabel, { children: t("homepage.stats.realtimeCollab", "Realtime Collab") })
678
- ] }),
679
- /* @__PURE__ */ jsxs(StatCard, { $bg: "rgba(59, 130, 246, 0.08)", children: [
680
- /* @__PURE__ */ jsx(StatNumber, { $color: "#3b82f6", children: "v5" }),
681
- /* @__PURE__ */ jsx(StatLabel, { children: t("homepage.stats.strapiReady", "Strapi Ready") })
682
- ] })
683
- ] }) })
684
- ] })
685
- ] }),
686
- /* @__PURE__ */ jsxs(Sidebar, { children: [
687
- /* @__PURE__ */ jsxs(Card$1, { $delay: 0.25, children: [
688
- /* @__PURE__ */ jsx(CardHeader$1, { children: /* @__PURE__ */ jsxs(CardTitle$1, { children: [
689
- /* @__PURE__ */ jsx(Cog6ToothIcon, {}),
690
- t("homepage.quickLinks.title", "Quick Access")
691
- ] }) }),
692
- /* @__PURE__ */ jsx(CardContent, { $noPadding: true, children: /* @__PURE__ */ jsxs(QuickLinksGrid, { children: [
693
- /* @__PURE__ */ jsxs(QuickLinkItem, { onClick: () => navigate("collaboration"), children: [
694
- /* @__PURE__ */ jsx(QuickLinkIcon, { $color: "linear-gradient(135deg, #7C3AED 0%, #6366f1 100%)", children: /* @__PURE__ */ jsx(UserGroupIcon, {}) }),
695
- /* @__PURE__ */ jsxs(QuickLinkInfo, { children: [
696
- /* @__PURE__ */ jsx("h4", { children: t("homepage.quickLinks.collaboration", "Collaboration") }),
697
- /* @__PURE__ */ jsx("p", { children: t("homepage.quickLinks.collaboration.desc", "Manage users & permissions") })
698
- ] }),
699
- /* @__PURE__ */ jsx(QuickLinkArrow, { children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) })
700
- ] }),
701
- /* @__PURE__ */ jsxs(QuickLinkItem, { onClick: () => window.open("https://editorjs.io/base-concepts/", "_blank"), children: [
702
- /* @__PURE__ */ jsx(QuickLinkIcon, { $color: "linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%)", children: /* @__PURE__ */ jsx(BookOpenIcon, {}) }),
703
- /* @__PURE__ */ jsxs(QuickLinkInfo, { children: [
704
- /* @__PURE__ */ jsx("h4", { children: t("homepage.quickLinks.docs", "Editor.js Docs") }),
705
- /* @__PURE__ */ jsx("p", { children: t("homepage.quickLinks.docs.desc", "Official documentation") })
706
- ] }),
707
- /* @__PURE__ */ jsx(QuickLinkArrow, { children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) })
708
- ] })
709
- ] }) })
710
- ] }),
711
- /* @__PURE__ */ jsxs(Card$1, { $delay: 0.3, children: [
712
- /* @__PURE__ */ jsx(CardHeader$1, { children: /* @__PURE__ */ jsxs(CardTitle$1, { children: [
713
- /* @__PURE__ */ jsx(BookOpenIcon, {}),
714
- t("homepage.tools.title", "Available Tools")
715
- ] }) }),
716
- /* @__PURE__ */ jsx(CardContent, { $noPadding: true, children: /* @__PURE__ */ jsx(ToolGrid, { children: toolsData.map((tool, i) => /* @__PURE__ */ jsxs(ToolItem, { children: [
717
- /* @__PURE__ */ jsx(ToolIcon, { $color: tool.color, children: /* @__PURE__ */ jsx(tool.icon, {}) }),
718
- /* @__PURE__ */ jsxs(ToolInfo, { children: [
719
- /* @__PURE__ */ jsx("h4", { children: tool.name }),
720
- /* @__PURE__ */ jsx("p", { children: tool.desc })
721
- ] })
722
- ] }, i)) }) })
723
- ] }),
724
- /* @__PURE__ */ jsxs(Card$1, { $delay: 0.4, children: [
725
- /* @__PURE__ */ jsx(CardHeader$1, { children: /* @__PURE__ */ jsxs(CardTitle$1, { children: [
726
- /* @__PURE__ */ jsx(CommandLineIcon, {}),
727
- t("homepage.shortcuts.title", "Keyboard Shortcuts")
728
- ] }) }),
729
- /* @__PURE__ */ jsx(CardContent, { $noPadding: true, children: /* @__PURE__ */ jsx(ShortcutList, { children: shortcuts.map((shortcut, i) => /* @__PURE__ */ jsxs(ShortcutItem, { children: [
730
- /* @__PURE__ */ jsx(ShortcutLabel, { children: shortcut.label }),
731
- /* @__PURE__ */ jsx(ShortcutKeys, { children: shortcut.keys.map((key, j) => /* @__PURE__ */ jsx(Kbd, { children: key }, j)) })
732
- ] }, i)) }) })
733
- ] })
734
- ] })
735
- ] })
736
- ] }) });
737
- };
738
- const Container = styled.div`
739
- padding: clamp(16px, 4vw, 40px);
740
- max-width: 1400px;
741
- margin: 0 auto;
742
- min-height: 100vh;
743
- box-sizing: border-box;
744
- `;
745
- const Header = styled.div`
746
- margin-bottom: clamp(20px, 4vw, 32px);
747
- `;
748
- const Title = styled.h1`
749
- font-size: clamp(22px, 4vw, 32px);
750
- font-weight: 700;
751
- color: ${(props) => props.theme.colors.neutral800};
752
- margin: 0 0 8px 0;
753
- display: flex;
754
- align-items: center;
755
- gap: 12px;
756
- flex-wrap: wrap;
757
-
758
- svg {
759
- width: clamp(24px, 4vw, 32px);
760
- height: clamp(24px, 4vw, 32px);
761
- color: #7C3AED;
762
- flex-shrink: 0;
763
- }
764
- `;
765
- const Subtitle = styled.p`
766
- font-size: clamp(13px, 2vw, 15px);
767
- color: ${(props) => props.theme.colors.neutral600};
768
- margin: 0;
769
- `;
770
- const Card = styled.div`
771
- background: ${(props) => props.theme.colors.neutral0};
772
- border: 1px solid ${(props) => props.theme.colors.neutral200};
773
- border-radius: clamp(12px, 2vw, 16px);
774
- padding: clamp(16px, 3vw, 24px);
775
- margin-bottom: 24px;
776
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
777
- overflow-x: auto;
778
- `;
779
- const CardHeader = styled.div`
780
- display: flex;
781
- align-items: center;
782
- justify-content: space-between;
783
- margin-bottom: 20px;
784
- gap: 12px;
785
- flex-wrap: wrap;
786
-
787
- @media (max-width: 480px) {
788
- flex-direction: column;
789
- align-items: stretch;
790
- }
791
- `;
792
- const CardTitle = styled.h2`
793
- font-size: clamp(16px, 2.5vw, 18px);
794
- font-weight: 600;
795
- color: ${(props) => props.theme.colors.neutral800};
796
- margin: 0;
797
- `;
798
- const Button = styled.button`
799
- display: inline-flex;
800
- align-items: center;
801
- justify-content: center;
802
- gap: 8px;
803
- padding: clamp(8px, 1.5vw, 10px) clamp(14px, 2vw, 20px);
804
- background: ${(props) => props.$danger ? "#ef4444" : props.$secondary ? props.theme.colors.neutral0 : "linear-gradient(135deg, #7C3AED 0%, #6d28d9 100%)"};
805
- border: 1px solid ${(props) => props.$danger ? "#ef4444" : props.$secondary ? props.theme.colors.neutral200 : "transparent"};
806
- border-radius: 10px;
807
- color: ${(props) => props.$secondary ? props.theme.colors.neutral600 : "white"};
808
- font-size: clamp(13px, 2vw, 14px);
809
- font-weight: 500;
810
- cursor: pointer;
811
- transition: all 0.2s ease;
812
- white-space: nowrap;
813
- flex-shrink: 0;
814
-
815
- svg {
816
- width: 18px;
817
- height: 18px;
818
- flex-shrink: 0;
819
- }
820
-
821
- &:hover {
822
- transform: translateY(-1px);
823
- box-shadow: 0 4px 12px ${(props) => props.$danger ? "rgba(239, 68, 68, 0.3)" : props.$secondary ? "rgba(0,0,0,0.1)" : "rgba(124, 58, 237, 0.3)"};
824
- }
825
-
826
- &:active {
827
- transform: translateY(0);
828
- }
829
-
830
- &:disabled {
831
- opacity: 0.5;
832
- cursor: not-allowed;
833
- transform: none;
834
- }
835
-
836
- @media (max-width: 480px) {
837
- width: 100%;
838
- }
839
- `;
840
- const PermissionsList = styled.div`
841
- display: none;
842
-
843
- @media (max-width: 768px) {
844
- display: flex;
845
- flex-direction: column;
846
- gap: 12px;
847
- }
848
- `;
849
- const PermissionCard = styled.div`
850
- background: ${(props) => props.theme.colors.neutral100};
851
- border: 1px solid ${(props) => props.theme.colors.neutral200};
852
- border-radius: 12px;
853
- padding: 16px;
854
- `;
855
- const PermissionCardHeader = styled.div`
856
- display: flex;
857
- align-items: center;
858
- justify-content: space-between;
859
- margin-bottom: 12px;
860
- `;
861
- const PermissionCardBody = styled.div`
862
- display: flex;
863
- flex-direction: column;
864
- gap: 12px;
865
- `;
866
- const PermissionRow = styled.div`
867
- display: flex;
868
- justify-content: space-between;
869
- align-items: center;
870
- gap: 8px;
871
- `;
872
- const PermissionLabel = styled.span`
873
- font-size: 12px;
874
- font-weight: 600;
875
- color: ${(props) => props.theme.colors.neutral600};
876
- text-transform: uppercase;
877
- `;
878
- const Table = styled.table`
879
- width: 100%;
880
- border-collapse: collapse;
881
- min-width: 600px;
882
-
883
- @media (max-width: 768px) {
884
- display: none;
885
- }
886
- `;
887
- const Th = styled.th`
888
- text-align: left;
889
- padding: 12px 16px;
890
- font-size: 13px;
891
- font-weight: 600;
892
- color: ${(props) => props.theme.colors.neutral600};
893
- text-transform: uppercase;
894
- letter-spacing: 0.5px;
895
- border-bottom: 2px solid ${(props) => props.theme.colors.neutral150};
896
- white-space: nowrap;
897
- `;
898
- const Td = styled.td`
899
- padding: 16px;
900
- border-bottom: 1px solid ${(props) => props.theme.colors.neutral150};
901
- font-size: 14px;
902
- color: ${(props) => props.theme.colors.neutral800};
903
- `;
904
- const UserInfo = styled.div`
905
- display: flex;
906
- align-items: center;
907
- gap: 12px;
908
- `;
909
- const Avatar = styled.div`
910
- width: clamp(36px, 5vw, 40px);
911
- height: clamp(36px, 5vw, 40px);
912
- border-radius: 50%;
913
- background: linear-gradient(135deg, #7C3AED 0%, #6d28d9 100%);
914
- display: flex;
915
- align-items: center;
916
- justify-content: center;
917
- color: white;
918
- font-weight: 600;
919
- font-size: clamp(12px, 2vw, 14px);
920
- flex-shrink: 0;
921
- `;
922
- const UserDetails = styled.div`
923
- display: flex;
924
- flex-direction: column;
925
- min-width: 0;
926
- `;
927
- const UserName = styled.div`
928
- font-weight: 600;
929
- color: ${(props) => props.theme.colors.neutral800};
930
- font-size: clamp(13px, 2vw, 14px);
931
- `;
932
- const UserEmail = styled.div`
933
- font-size: clamp(11px, 1.5vw, 13px);
934
- color: ${(props) => props.theme.colors.neutral600};
935
- overflow: hidden;
936
- text-overflow: ellipsis;
937
- white-space: nowrap;
938
- max-width: 200px;
939
-
940
- @media (max-width: 480px) {
941
- max-width: 150px;
942
- }
943
- `;
944
- styled.span`
945
- display: inline-flex;
946
- align-items: center;
947
- gap: 6px;
948
- padding: 6px 12px;
949
- border-radius: 20px;
950
- font-size: 12px;
951
- font-weight: 600;
952
- background: ${(props) => props.$role === "owner" ? "#7C3AED" : props.$role === "editor" ? "#10B981" : "#64748b"};
953
- color: white;
954
-
955
- svg {
956
- width: 14px;
957
- height: 14px;
958
- }
959
- `;
960
- const Select = styled.select`
961
- padding: clamp(6px, 1vw, 8px) clamp(10px, 1.5vw, 12px);
962
- border: 1px solid ${(props) => props.theme.colors.neutral200};
963
- border-radius: 8px;
964
- font-size: clamp(12px, 2vw, 14px);
965
- color: ${(props) => props.theme.colors.neutral800};
966
- background: ${(props) => props.theme.colors.neutral0};
967
- cursor: pointer;
968
- max-width: 100%;
969
-
970
- &:focus {
971
- outline: none;
972
- border-color: #7C3AED;
973
- }
974
- `;
975
- const EmptyState = styled.div`
976
- text-align: center;
977
- padding: clamp(40px, 6vw, 60px) 20px;
978
- color: ${(props) => props.theme.colors.neutral500};
979
-
980
- h3 {
981
- font-size: clamp(16px, 2.5vw, 18px);
982
- margin: 0 0 8px;
983
- color: ${(props) => props.theme.colors.neutral600};
984
- }
985
-
986
- p {
987
- font-size: clamp(13px, 2vw, 14px);
988
- margin: 0;
989
- }
990
- `;
991
- const EmptyIcon = styled.div`
992
- width: clamp(60px, 10vw, 80px);
993
- height: clamp(60px, 10vw, 80px);
994
- margin: 0 auto 20px;
995
- background: ${(props) => props.theme.colors.neutral100};
996
- border-radius: 50%;
997
- display: flex;
998
- align-items: center;
999
- justify-content: center;
1000
-
1001
- svg {
1002
- width: clamp(30px, 5vw, 40px);
1003
- height: clamp(30px, 5vw, 40px);
1004
- color: ${(props) => props.theme.colors.neutral400};
1005
- }
1006
- `;
1007
- const Modal = styled.div`
1008
- position: fixed;
1009
- top: 0;
1010
- left: 0;
1011
- right: 0;
1012
- bottom: 0;
1013
- background: rgba(15, 23, 42, 0.75);
1014
- backdrop-filter: blur(8px);
1015
- display: flex;
1016
- align-items: center;
1017
- justify-content: center;
1018
- z-index: 10000;
1019
- padding: 16px;
1020
- animation: fadeIn 0.2s ease;
1021
- overflow-y: auto;
1022
-
1023
- @keyframes fadeIn {
1024
- from { opacity: 0; }
1025
- to { opacity: 1; }
1026
- }
1027
-
1028
- @media (max-width: 600px) {
1029
- align-items: flex-start;
1030
- padding-top: 20px;
1031
- padding-bottom: 20px;
1032
- }
1033
- `;
1034
- const ModalContent$1 = styled.div`
1035
- background: ${(props) => props.theme.colors.neutral0};
1036
- border-radius: clamp(16px, 3vw, 24px);
1037
- padding: 0;
1038
- max-width: 580px;
1039
- width: 100%;
1040
- max-height: calc(100vh - 40px);
1041
- overflow-y: auto;
1042
- box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
1043
- animation: slideUp 0.3s ease;
1044
-
1045
- @keyframes slideUp {
1046
- from {
1047
- opacity: 0;
1048
- transform: translateY(20px);
1049
- }
1050
- to {
1051
- opacity: 1;
1052
- transform: translateY(0);
1053
- }
1054
- }
1055
-
1056
- @media (max-width: 600px) {
1057
- max-height: none;
1058
- border-radius: 16px;
1059
- }
1060
- `;
1061
- const ModalHeader = styled.div`
1062
- background: linear-gradient(135deg, #7C3AED 0%, #6d28d9 100%);
1063
- padding: clamp(20px, 4vw, 32px);
1064
- color: white;
1065
- position: relative;
1066
- overflow: hidden;
1067
-
1068
- &::before {
1069
- content: '';
1070
- position: absolute;
1071
- top: -50%;
1072
- right: -10%;
1073
- width: 200px;
1074
- height: 200px;
1075
- background: rgba(255, 255, 255, 0.1);
1076
- border-radius: 50%;
1077
- filter: blur(40px);
1078
- }
1079
- `;
1080
- const ModalBody = styled.div`
1081
- padding: clamp(20px, 4vw, 32px);
1082
- `;
1083
- const ModalTitle = styled.h3`
1084
- font-size: clamp(18px, 3vw, 24px);
1085
- font-weight: 700;
1086
- margin: 0 0 8px 0;
1087
- display: flex;
1088
- align-items: center;
1089
- gap: 12px;
1090
- position: relative;
1091
-
1092
- svg {
1093
- width: clamp(22px, 3vw, 28px);
1094
- height: clamp(22px, 3vw, 28px);
1095
- flex-shrink: 0;
1096
- }
1097
- `;
1098
- const ModalSubtitle = styled.p`
1099
- font-size: clamp(13px, 2vw, 15px);
1100
- margin: 0;
1101
- opacity: 0.95;
1102
- position: relative;
1103
- `;
1104
- const FormGroup = styled.div`
1105
- margin-bottom: clamp(16px, 3vw, 24px);
1106
- `;
1107
- const Label = styled.label`
1108
- display: block;
1109
- font-size: clamp(13px, 2vw, 14px);
1110
- font-weight: 600;
1111
- color: ${(props) => props.theme.colors.neutral800};
1112
- margin-bottom: 10px;
1113
- `;
1114
- const SelectWrapper = styled.div`
1115
- position: relative;
1116
- `;
1117
- const StyledSelect = styled.select`
1118
- width: 100%;
1119
- padding: clamp(12px, 2vw, 14px) clamp(14px, 2vw, 16px);
1120
- border: 2px solid ${(props) => props.theme.colors.neutral200};
1121
- border-radius: 12px;
1122
- font-size: clamp(14px, 2vw, 15px);
1123
- color: ${(props) => props.theme.colors.neutral800};
1124
- background: ${(props) => props.theme.colors.neutral0};
1125
- cursor: pointer;
1126
- transition: all 0.2s ease;
1127
- appearance: none;
1128
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
1129
- background-repeat: no-repeat;
1130
- background-position: right 12px center;
1131
- background-size: 20px;
1132
- padding-right: 40px;
1133
-
1134
- &:hover {
1135
- border-color: #a78bfa;
1136
- }
1137
-
1138
- &:focus {
1139
- outline: none;
1140
- border-color: #7C3AED;
1141
- box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
1142
- }
1143
-
1144
- option {
1145
- padding: 12px;
1146
- }
1147
- `;
1148
- styled.input`
1149
- width: 100%;
1150
- padding: clamp(12px, 2vw, 14px) clamp(14px, 2vw, 16px);
1151
- border: 2px solid ${(props) => props.theme.colors.neutral200};
1152
- border-radius: 12px;
1153
- font-size: clamp(14px, 2vw, 15px);
1154
- color: ${(props) => props.theme.colors.neutral800};
1155
- background: ${(props) => props.theme.colors.neutral0};
1156
- transition: all 0.2s ease;
1157
- box-sizing: border-box;
1158
-
1159
- &:hover {
1160
- border-color: #a78bfa;
1161
- }
1162
-
1163
- &:focus {
1164
- outline: none;
1165
- border-color: #7C3AED;
1166
- box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
1167
- }
1168
-
1169
- &::placeholder {
1170
- color: ${(props) => props.theme.colors.neutral500};
1171
- }
1172
- `;
1173
- const RoleOption = styled.div`
1174
- display: flex;
1175
- align-items: center;
1176
- gap: clamp(10px, 2vw, 12px);
1177
- padding: clamp(12px, 2vw, 16px);
1178
- border: 2px solid ${(props) => props.$selected ? "#7C3AED" : props.theme.colors.neutral200};
1179
- border-radius: 12px;
1180
- cursor: pointer;
1181
- transition: all 0.2s ease;
1182
- background: ${(props) => props.$selected ? "rgba(124, 58, 237, 0.05)" : props.theme.colors.neutral0};
1183
-
1184
- &:hover {
1185
- border-color: #7C3AED;
1186
- background: rgba(124, 58, 237, 0.03);
1187
- }
1188
-
1189
- &:active {
1190
- transform: scale(0.99);
1191
- }
1192
- `;
1193
- const RoleIcon = styled.div`
1194
- font-size: clamp(18px, 3vw, 24px);
1195
- width: clamp(40px, 6vw, 48px);
1196
- height: clamp(40px, 6vw, 48px);
1197
- display: flex;
1198
- align-items: center;
1199
- justify-content: center;
1200
- background: ${(props) => props.$role === "owner" ? "linear-gradient(135deg, #FFD700 0%, #FFA500 100%)" : props.$role === "editor" ? "linear-gradient(135deg, #10B981 0%, #059669 100%)" : "linear-gradient(135deg, #64748b 0%, #475569 100%)"};
1201
- border-radius: 12px;
1202
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
1203
- flex-shrink: 0;
1204
- `;
1205
- const RoleInfo = styled.div`
1206
- flex: 1;
1207
- min-width: 0;
1208
- `;
1209
- const RoleName = styled.div`
1210
- font-weight: 600;
1211
- color: ${(props) => props.theme.colors.neutral800};
1212
- font-size: clamp(14px, 2vw, 16px);
1213
- margin-bottom: 4px;
1214
- `;
1215
- const RoleDescription = styled.div`
1216
- font-size: clamp(11px, 1.5vw, 13px);
1217
- color: ${(props) => props.theme.colors.neutral600};
1218
- line-height: 1.4;
1219
- `;
1220
- const RoleGrid = styled.div`
1221
- display: grid;
1222
- gap: 12px;
1223
- margin-bottom: clamp(16px, 3vw, 24px);
1224
- `;
1225
- const ModalActions = styled.div`
1226
- display: flex;
1227
- gap: 12px;
1228
- margin-top: clamp(16px, 3vw, 24px);
1229
- flex-wrap: wrap;
1230
-
1231
- @media (max-width: 400px) {
1232
- flex-direction: column;
1233
-
1234
- button {
1235
- width: 100%;
1236
- }
1237
- }
1238
- `;
1239
- const LoadingContainer = styled.div`
1240
- display: flex;
1241
- align-items: center;
1242
- justify-content: center;
1243
- padding: clamp(40px, 6vw, 60px);
1244
- `;
1245
- const HelpText = styled.small`
1246
- display: block;
1247
- margin-top: 8px;
1248
- font-size: clamp(11px, 1.5vw, 12px);
1249
- color: ${(props) => props.$warning ? "#f59e0b" : props.theme.colors.neutral600};
1250
- line-height: 1.4;
1251
- `;
1252
- styled.span`
1253
- display: inline-block;
1254
- background: ${(props) => props.theme.colors.neutral100};
1255
- color: #7C3AED;
1256
- padding: 4px 10px;
1257
- border-radius: 6px;
1258
- font-size: clamp(11px, 1.5vw, 13px);
1259
- font-weight: 500;
1260
- max-width: 180px;
1261
- overflow: hidden;
1262
- text-overflow: ellipsis;
1263
- white-space: nowrap;
1264
-
1265
- @media (max-width: 480px) {
1266
- max-width: 120px;
1267
- }
1268
- `;
1269
- const CollaborationSettings = () => {
1270
- const { formatMessage } = useIntl();
1271
- const t = (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
1272
- const { get, post, put, del } = useFetchClient();
1273
- const [loading, setLoading] = useState(true);
1274
- const [permissions, setPermissions] = useState([]);
1275
- const [users, setUsers] = useState([]);
1276
- const [contentTypes, setContentTypes] = useState([]);
1277
- const [showAddModal, setShowAddModal] = useState(false);
1278
- const [selectedUser, setSelectedUser] = useState("");
1279
- const [selectedRole, setSelectedRole] = useState("editor");
1280
- const [contentType, setContentType] = useState("");
1281
- const [saving, setSaving] = useState(false);
1282
- const [limits, setLimits] = useState({ current: 0, max: 2, unlimited: false, canAdd: true });
1283
- useEffect(() => {
1284
- loadData();
1285
- loadLimits();
1286
- }, []);
1287
- const loadLimits = async () => {
1288
- try {
1289
- const response = await get("/magic-editor-x/license/limits");
1290
- if (response.data?.limits?.collaborators) {
1291
- setLimits(response.data.limits.collaborators);
1292
- }
1293
- } catch (error) {
1294
- console.error("[Collab Settings] Error loading limits:", error);
1295
- }
1296
- };
1297
- const loadData = async () => {
1298
- setLoading(true);
1299
- try {
1300
- const [permsRes, usersRes, typesRes] = await Promise.all([
1301
- get("/magic-editor-x/collaboration/permissions"),
1302
- get("/magic-editor-x/collaboration/users"),
1303
- get("/content-type-builder/content-types")
1304
- ]);
1305
- setPermissions(permsRes.data?.data || permsRes.data || []);
1306
- setUsers(usersRes.data?.data || usersRes.data || []);
1307
- const allTypes = typesRes.data?.data || typesRes.data || [];
1308
- console.log("[Collab] All content types from API:", allTypes);
1309
- const filteredTypes = allTypes.filter((type) => {
1310
- const uid = type.uid || "";
1311
- if (!uid.startsWith("api::")) {
1312
- return false;
1313
- }
1314
- const schema = type.schema || type;
1315
- const attributes = schema.attributes || type.attributes || {};
1316
- const hasMagicEditorField = Object.entries(attributes).some(([fieldName, attr]) => {
1317
- const customFieldValue = attr.customField || "";
1318
- const isMagicEditor = customFieldValue.includes("magic-editor-x");
1319
- if (isMagicEditor) {
1320
- console.log(`[Collab] ✅ Found Magic Editor field: ${uid}.${fieldName}`, attr);
1321
- }
1322
- return isMagicEditor;
1323
- });
1324
- return hasMagicEditorField;
1325
- }).map((type) => {
1326
- const schema = type.schema || type;
1327
- const attributes = schema.attributes || type.attributes || {};
1328
- return {
1329
- uid: type.uid,
1330
- displayName: schema.info?.displayName || schema.info?.singularName || type.uid,
1331
- singularName: schema.info?.singularName,
1332
- pluralName: schema.info?.pluralName,
1333
- kind: schema.kind || type.kind,
1334
- // Find the magic editor field names
1335
- magicEditorFields: Object.entries(attributes).filter(
1336
- ([_, attr]) => (attr.customField || "").includes("magic-editor-x")
1337
- ).map(([name]) => name)
1338
- };
1339
- }).sort((a, b) => a.displayName.localeCompare(b.displayName));
1340
- setContentTypes(filteredTypes);
1341
- console.log("[Collab] Content types with Magic Editor X:", filteredTypes);
1342
- console.log("[Collab] Loaded users:", usersRes.data);
1343
- console.log("[Collab] Loaded permissions:", permsRes.data);
1344
- console.log("[Collab] Loaded content types:", filteredTypes);
1345
- } catch (error) {
1346
- console.error("[Collab Settings] Load error:", error);
1347
- alert(t("collaboration.errorLoading", "Error loading: {error}", { error: error.message || "Unknown error" }));
1348
- } finally {
1349
- setLoading(false);
1350
- }
1351
- };
1352
- const handleAddPermission = async () => {
1353
- if (!selectedUser || !selectedRole) return;
1354
- setSaving(true);
1355
- try {
1356
- await post("/magic-editor-x/collaboration/permissions", {
1357
- userId: selectedUser,
1358
- role: selectedRole,
1359
- contentType: contentType || "*",
1360
- entryId: null,
1361
- fieldName: null
1362
- });
1363
- await loadData();
1364
- await loadLimits();
1365
- setShowAddModal(false);
1366
- setSelectedUser("");
1367
- setSelectedRole("editor");
1368
- setContentType("");
1369
- } catch (error) {
1370
- console.error("[Collab Settings] Add error:", error);
1371
- if (error.response?.data?.upgradeRequired) {
1372
- alert(t("collaboration.limitReachedAlert", "Collaborator limit reached.\n\nUpgrade at https://store.magicdx.dev/ for more collaborators."));
1373
- } else {
1374
- alert(t("collaboration.errorAdding", "Error adding permission"));
1375
- }
1376
- } finally {
1377
- setSaving(false);
1378
- }
1379
- };
1380
- const handleOpenAddModal = () => {
1381
- if (!limits.canAdd && !limits.unlimited) {
1382
- alert(t("collaboration.limitReachedAlert", "Collaborator limit reached ({current}/{max}).\n\nUpgrade at https://store.magicdx.dev/ for more collaborators.", { current: limits.current, max: limits.max }));
1383
- return;
1384
- }
1385
- setShowAddModal(true);
1386
- };
1387
- const handleUpdateRole = async (permissionId, newRole) => {
1388
- try {
1389
- await put(`/magic-editor-x/collaboration/permissions/${permissionId}`, {
1390
- role: newRole
1391
- });
1392
- await loadData();
1393
- } catch (error) {
1394
- console.error("[Collab Settings] Update error:", error);
1395
- alert(t("collaboration.errorUpdating", "Error updating role"));
1396
- }
1397
- };
1398
- const handleUpdateContentType = async (permissionId, newContentType) => {
1399
- try {
1400
- await put(`/magic-editor-x/collaboration/permissions/${permissionId}`, {
1401
- contentType: newContentType === "*" ? null : newContentType
1402
- });
1403
- await loadData();
1404
- } catch (error) {
1405
- console.error("[Collab Settings] Update content type error:", error);
1406
- alert(t("collaboration.errorUpdating", "Error updating role"));
1407
- }
1408
- };
1409
- const handleDeletePermission = async (permissionId) => {
1410
- if (!confirm(t("collaboration.confirmDelete", "Really remove permission?"))) return;
1411
- try {
1412
- await del(`/magic-editor-x/collaboration/permissions/${permissionId}`);
1413
- await loadData();
1414
- await loadLimits();
1415
- } catch (error) {
1416
- console.error("[Collab Settings] Delete error:", error);
1417
- alert(t("collaboration.errorDeleting", "Error deleting permission"));
1418
- }
1419
- };
1420
- const getUserInitials = (user) => {
1421
- if (!user) return "?";
1422
- const first = (user.firstname?.[0] || user.email?.[0] || "?").toUpperCase();
1423
- const last = (user.lastname?.[0] || "").toUpperCase();
1424
- return `${first}${last}`.trim();
1425
- };
1426
- if (loading) {
1427
- return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(LoadingContainer, { children: /* @__PURE__ */ jsx(kt, {}) }) });
1428
- }
1429
- return /* @__PURE__ */ jsxs(Container, { children: [
1430
- /* @__PURE__ */ jsxs(Header, { children: [
1431
- /* @__PURE__ */ jsxs(Title, { children: [
1432
- /* @__PURE__ */ jsx(UserGroupIcon, {}),
1433
- t("collaboration.title", "Collaboration")
1434
- ] }),
1435
- /* @__PURE__ */ jsx(Subtitle, { children: t("collaboration.subtitle", "Manage permissions for real-time editing") })
1436
- ] }),
1437
- !limits.unlimited && /* @__PURE__ */ jsx(Card, { style: { marginBottom: "16px", background: limits.canAdd ? "#f0fdf4" : "#fef2f2", borderColor: limits.canAdd ? "#bbf7d0" : "#fecaca" }, children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", flexWrap: "wrap", gap: "12px" }, children: [
1438
- /* @__PURE__ */ jsxs("div", { children: [
1439
- /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, marginBottom: "4px" }, children: t("collaboration.limitInfo", "Collaborators: {current} / {max}", { current: limits.current, max: limits.max }) }),
1440
- /* @__PURE__ */ jsx("div", { style: { fontSize: "13px", color: "#6b7280" }, children: limits.canAdd ? t("collaboration.limitCanAdd", "You can add {remaining} more collaborator(s).", { remaining: limits.max - limits.current }) : t("collaboration.limitReached", "Limit reached. Upgrade for more collaborators.") })
1441
- ] }),
1442
- !limits.canAdd && /* @__PURE__ */ jsx(
1443
- Button,
1444
- {
1445
- onClick: () => window.open("https://store.magicdx.dev/", "_blank"),
1446
- style: { background: "linear-gradient(135deg, #7C3AED, #6d28d9)", color: "white" },
1447
- children: t("collaboration.upgrade", "Upgrade")
1448
- }
1449
- )
1450
- ] }) }),
1451
- /* @__PURE__ */ jsxs(Card, { children: [
1452
- /* @__PURE__ */ jsxs(CardHeader, { children: [
1453
- /* @__PURE__ */ jsx(CardTitle, { children: t("collaboration.authorizedUsers", "Authorized Users ({count})", { count: permissions.length }) }),
1454
- /* @__PURE__ */ jsxs(Button, { onClick: handleOpenAddModal, disabled: !limits.canAdd && !limits.unlimited, children: [
1455
- /* @__PURE__ */ jsx(UserPlusIcon, {}),
1456
- t("collaboration.addUser", "Add User")
1457
- ] })
1458
- ] }),
1459
- permissions.length === 0 ? /* @__PURE__ */ jsxs(EmptyState, { children: [
1460
- /* @__PURE__ */ jsx(EmptyIcon, { children: /* @__PURE__ */ jsx(UserGroupIcon, {}) }),
1461
- /* @__PURE__ */ jsx("h3", { children: t("collaboration.noPermissions", "No Permissions") }),
1462
- /* @__PURE__ */ jsx("p", { children: t("collaboration.noPermissions.description", "Add users to enable collaboration") })
1463
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1464
- /* @__PURE__ */ jsxs(Table, { children: [
1465
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
1466
- /* @__PURE__ */ jsx(Th, { children: t("collaboration.user", "User") }),
1467
- /* @__PURE__ */ jsx(Th, { children: t("collaboration.role", "Role") }),
1468
- /* @__PURE__ */ jsx(Th, { children: t("collaboration.contentType", "Content Type") }),
1469
- /* @__PURE__ */ jsx(Th, { children: t("collaboration.actions", "Actions") })
1470
- ] }) }),
1471
- /* @__PURE__ */ jsx("tbody", { children: permissions.map((perm) => /* @__PURE__ */ jsxs("tr", { children: [
1472
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(UserInfo, { children: [
1473
- /* @__PURE__ */ jsx(Avatar, { children: getUserInitials(perm.user) }),
1474
- /* @__PURE__ */ jsxs(UserDetails, { children: [
1475
- /* @__PURE__ */ jsxs(UserName, { children: [
1476
- perm.user?.firstname,
1477
- " ",
1478
- perm.user?.lastname
1479
- ] }),
1480
- /* @__PURE__ */ jsx(UserEmail, { children: perm.user?.email })
1481
- ] })
1482
- ] }) }),
1483
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(
1484
- Select,
1485
- {
1486
- value: perm.role,
1487
- onChange: (e) => handleUpdateRole(perm.documentId, e.target.value),
1488
- children: [
1489
- /* @__PURE__ */ jsxs("option", { value: "viewer", children: [
1490
- "👁️ ",
1491
- t("role.viewer", "Viewer")
1492
- ] }),
1493
- /* @__PURE__ */ jsxs("option", { value: "editor", children: [
1494
- "✏️ ",
1495
- t("role.editor", "Editor")
1496
- ] }),
1497
- /* @__PURE__ */ jsxs("option", { value: "owner", children: [
1498
- "👑 ",
1499
- t("role.owner", "Owner")
1500
- ] })
1501
- ]
1502
- }
1503
- ) }),
1504
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(
1505
- Select,
1506
- {
1507
- value: perm.contentType || "*",
1508
- onChange: (e) => handleUpdateContentType(perm.documentId, e.target.value),
1509
- style: { minWidth: "160px" },
1510
- children: [
1511
- /* @__PURE__ */ jsxs("option", { value: "*", children: [
1512
- "🌐 ",
1513
- t("collaboration.allContentTypes", "All Content Types with Magic Editor")
1514
- ] }),
1515
- contentTypes.map((type) => /* @__PURE__ */ jsxs("option", { value: type.uid, children: [
1516
- type.kind === "singleType" ? "📄" : "📚",
1517
- " ",
1518
- type.displayName
1519
- ] }, type.uid))
1520
- ]
1521
- }
1522
- ) }),
1523
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
1524
- Button,
1525
- {
1526
- $danger: true,
1527
- onClick: () => handleDeletePermission(perm.documentId),
1528
- style: { padding: "8px 12px" },
1529
- children: /* @__PURE__ */ jsx(TrashIcon, {})
1530
- }
1531
- ) })
1532
- ] }, perm.documentId)) })
1533
- ] }),
1534
- /* @__PURE__ */ jsx(PermissionsList, { children: permissions.map((perm) => /* @__PURE__ */ jsxs(PermissionCard, { children: [
1535
- /* @__PURE__ */ jsxs(PermissionCardHeader, { children: [
1536
- /* @__PURE__ */ jsxs(UserInfo, { children: [
1537
- /* @__PURE__ */ jsx(Avatar, { children: getUserInitials(perm.user) }),
1538
- /* @__PURE__ */ jsxs(UserDetails, { children: [
1539
- /* @__PURE__ */ jsxs(UserName, { children: [
1540
- perm.user?.firstname,
1541
- " ",
1542
- perm.user?.lastname
1543
- ] }),
1544
- /* @__PURE__ */ jsx(UserEmail, { children: perm.user?.email })
1545
- ] })
1546
- ] }),
1547
- /* @__PURE__ */ jsx(
1548
- Button,
1549
- {
1550
- $danger: true,
1551
- onClick: () => handleDeletePermission(perm.documentId),
1552
- style: { padding: "8px 12px" },
1553
- children: /* @__PURE__ */ jsx(TrashIcon, {})
1554
- }
1555
- )
1556
- ] }),
1557
- /* @__PURE__ */ jsxs(PermissionCardBody, { children: [
1558
- /* @__PURE__ */ jsxs(PermissionRow, { children: [
1559
- /* @__PURE__ */ jsx(PermissionLabel, { children: t("collaboration.role", "Role") }),
1560
- /* @__PURE__ */ jsxs(
1561
- Select,
1562
- {
1563
- value: perm.role,
1564
- onChange: (e) => handleUpdateRole(perm.documentId, e.target.value),
1565
- children: [
1566
- /* @__PURE__ */ jsxs("option", { value: "viewer", children: [
1567
- "👁️ ",
1568
- t("role.viewer", "Viewer")
1569
- ] }),
1570
- /* @__PURE__ */ jsxs("option", { value: "editor", children: [
1571
- "✏️ ",
1572
- t("role.editor", "Editor")
1573
- ] }),
1574
- /* @__PURE__ */ jsxs("option", { value: "owner", children: [
1575
- "👑 ",
1576
- t("role.owner", "Owner")
1577
- ] })
1578
- ]
1579
- }
1580
- )
1581
- ] }),
1582
- /* @__PURE__ */ jsxs(PermissionRow, { children: [
1583
- /* @__PURE__ */ jsx(PermissionLabel, { children: t("collaboration.contentType", "Content Type") }),
1584
- /* @__PURE__ */ jsxs(
1585
- Select,
1586
- {
1587
- value: perm.contentType || "*",
1588
- onChange: (e) => handleUpdateContentType(perm.documentId, e.target.value),
1589
- children: [
1590
- /* @__PURE__ */ jsxs("option", { value: "*", children: [
1591
- "🌐 ",
1592
- t("collaboration.allContentTypes", "All Content Types with Magic Editor")
1593
- ] }),
1594
- contentTypes.map((type) => /* @__PURE__ */ jsxs("option", { value: type.uid, children: [
1595
- type.kind === "singleType" ? "📄" : "📚",
1596
- " ",
1597
- type.displayName
1598
- ] }, type.uid))
1599
- ]
1600
- }
1601
- )
1602
- ] })
1603
- ] })
1604
- ] }, perm.documentId)) })
1605
- ] })
1606
- ] }),
1607
- showAddModal && /* @__PURE__ */ jsx(Modal, { onClick: () => setShowAddModal(false), children: /* @__PURE__ */ jsxs(ModalContent$1, { onClick: (e) => e.stopPropagation(), children: [
1608
- /* @__PURE__ */ jsxs(ModalHeader, { children: [
1609
- /* @__PURE__ */ jsxs(ModalTitle, { children: [
1610
- /* @__PURE__ */ jsx(UserPlusIcon, {}),
1611
- t("collaboration.inviteUser", "Invite User")
1612
- ] }),
1613
- /* @__PURE__ */ jsx(ModalSubtitle, { children: t("collaboration.inviteUser.subtitle", "Grant access to real-time editing") })
1614
- ] }),
1615
- /* @__PURE__ */ jsxs(ModalBody, { children: [
1616
- /* @__PURE__ */ jsxs(FormGroup, { children: [
1617
- /* @__PURE__ */ jsx(Label, { children: t("collaboration.selectUser", "Select User") }),
1618
- /* @__PURE__ */ jsx(SelectWrapper, { children: /* @__PURE__ */ jsxs(
1619
- StyledSelect,
1620
- {
1621
- value: selectedUser,
1622
- onChange: (e) => setSelectedUser(e.target.value),
1623
- children: [
1624
- /* @__PURE__ */ jsx("option", { value: "", children: t("collaboration.selectUser.placeholder", "Choose a user...") }),
1625
- users.map((user) => /* @__PURE__ */ jsxs("option", { value: user.id, children: [
1626
- user.firstname,
1627
- " ",
1628
- user.lastname,
1629
- " • ",
1630
- user.email
1631
- ] }, user.id))
1632
- ]
1633
- }
1634
- ) })
1635
- ] }),
1636
- /* @__PURE__ */ jsxs(FormGroup, { children: [
1637
- /* @__PURE__ */ jsx(Label, { children: t("collaboration.rolePermissions", "Role & Permissions") }),
1638
- /* @__PURE__ */ jsxs(RoleGrid, { children: [
1639
- /* @__PURE__ */ jsxs(
1640
- RoleOption,
1641
- {
1642
- $selected: selectedRole === "viewer",
1643
- onClick: () => setSelectedRole("viewer"),
1644
- children: [
1645
- /* @__PURE__ */ jsx(RoleIcon, { $role: "viewer", children: "👁️" }),
1646
- /* @__PURE__ */ jsxs(RoleInfo, { children: [
1647
- /* @__PURE__ */ jsx(RoleName, { children: t("role.viewer", "Viewer") }),
1648
- /* @__PURE__ */ jsx(RoleDescription, { children: t("role.viewer.description", "Can view changes but not edit") })
1649
- ] })
1650
- ]
1651
- }
1652
- ),
1653
- /* @__PURE__ */ jsxs(
1654
- RoleOption,
1655
- {
1656
- $selected: selectedRole === "editor",
1657
- onClick: () => setSelectedRole("editor"),
1658
- children: [
1659
- /* @__PURE__ */ jsx(RoleIcon, { $role: "editor", children: "✏️" }),
1660
- /* @__PURE__ */ jsxs(RoleInfo, { children: [
1661
- /* @__PURE__ */ jsx(RoleName, { children: t("role.editor", "Editor") }),
1662
- /* @__PURE__ */ jsx(RoleDescription, { children: t("role.editor.description", "Can edit content and collaborate with others") })
1663
- ] })
1664
- ]
1665
- }
1666
- ),
1667
- /* @__PURE__ */ jsxs(
1668
- RoleOption,
1669
- {
1670
- $selected: selectedRole === "owner",
1671
- onClick: () => setSelectedRole("owner"),
1672
- children: [
1673
- /* @__PURE__ */ jsx(RoleIcon, { $role: "owner", children: "👑" }),
1674
- /* @__PURE__ */ jsxs(RoleInfo, { children: [
1675
- /* @__PURE__ */ jsx(RoleName, { children: t("role.owner", "Owner") }),
1676
- /* @__PURE__ */ jsx(RoleDescription, { children: t("role.owner.description", "Full access including managing permissions") })
1677
- ] })
1678
- ]
1679
- }
1680
- )
1681
- ] })
1682
- ] }),
1683
- /* @__PURE__ */ jsxs(FormGroup, { children: [
1684
- /* @__PURE__ */ jsx(Label, { children: t("collaboration.contentTypeOptional", "Content Type (optional)") }),
1685
- /* @__PURE__ */ jsx(SelectWrapper, { children: /* @__PURE__ */ jsxs(
1686
- StyledSelect,
1687
- {
1688
- value: contentType,
1689
- onChange: (e) => setContentType(e.target.value),
1690
- children: [
1691
- /* @__PURE__ */ jsxs("option", { value: "", children: [
1692
- "🌐 ",
1693
- t("collaboration.allContentTypes", "All Content Types with Magic Editor")
1694
- ] }),
1695
- contentTypes.map((type) => /* @__PURE__ */ jsxs("option", { value: type.uid, children: [
1696
- type.kind === "singleType" ? "📄" : "📚",
1697
- " ",
1698
- type.displayName,
1699
- type.magicEditorFields?.length > 0 && ` (${type.magicEditorFields.join(", ")})`
1700
- ] }, type.uid))
1701
- ]
1702
- }
1703
- ) }),
1704
- contentTypes.length === 0 ? /* @__PURE__ */ jsx(HelpText, { $warning: true, children: t("collaboration.contentTypeWarning", "⚠️ No content type currently uses the Magic Editor X field. Add the custom field to a content type.") }) : /* @__PURE__ */ jsx(HelpText, { children: t("collaboration.contentTypeHelp", "Shows only content types with Magic Editor X field • Empty = access to all") })
1705
- ] }),
1706
- /* @__PURE__ */ jsxs(ModalActions, { children: [
1707
- /* @__PURE__ */ jsx(Button, { $secondary: true, onClick: () => setShowAddModal(false), children: t("collaboration.cancel", "Cancel") }),
1708
- /* @__PURE__ */ jsxs(Button, { onClick: handleAddPermission, disabled: !selectedUser || saving, children: [
1709
- /* @__PURE__ */ jsx(CheckCircleIcon, {}),
1710
- saving ? t("collaboration.saving", "Saving...") : t("collaboration.invite", "Invite")
1711
- ] })
1712
- ] })
1713
- ] })
1714
- ] }) })
1715
- ] });
1716
- };
1717
- const fadeIn = keyframes`
1718
- from { opacity: 0; }
1719
- to { opacity: 1; }
1720
- `;
1721
- const slideUp = keyframes`
1722
- from {
1723
- opacity: 0;
1724
- transform: translateY(30px);
1725
- }
1726
- to {
1727
- opacity: 1;
1728
- transform: translateY(0);
1729
- }
1730
- `;
1731
- const ModalOverlay = styled.div`
1732
- position: fixed;
1733
- top: 0;
1734
- left: 0;
1735
- right: 0;
1736
- bottom: 0;
1737
- background: rgba(4, 28, 47, 0.85);
1738
- backdrop-filter: blur(8px);
1739
- z-index: 9999;
1740
- display: flex;
1741
- align-items: center;
1742
- justify-content: center;
1743
- animation: ${fadeIn} 0.3s ease-out;
1744
- padding: 20px;
1745
- `;
1746
- const ModalContent = styled(S)`
1747
- background: white;
1748
- border-radius: 16px;
1749
- width: 100%;
1750
- max-width: 580px;
1751
- box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
1752
- animation: ${slideUp} 0.4s cubic-bezier(0.4, 0, 0.2, 1);
1753
- overflow: hidden;
1754
- `;
1755
- const GradientHeader = styled(S)`
1756
- background: linear-gradient(135deg, #7C3AED 0%, #6d28d9 100%);
1757
- padding: 32px 40px;
1758
- position: relative;
1759
- overflow: hidden;
1760
-
1761
- &::before {
1762
- content: '';
1763
- position: absolute;
1764
- top: -50%;
1765
- right: -50%;
1766
- width: 200%;
1767
- height: 200%;
1768
- background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
1769
- }
1770
- `;
1771
- const IconWrapper = styled.div`
1772
- width: 72px;
1773
- height: 72px;
1774
- border-radius: 50%;
1775
- background: rgba(255, 255, 255, 0.2);
1776
- display: flex;
1777
- align-items: center;
1778
- justify-content: center;
1779
- margin: 0 auto 16px;
1780
- backdrop-filter: blur(10px);
1781
- border: 2px solid rgba(255, 255, 255, 0.3);
1782
-
1783
- svg {
1784
- width: 36px;
1785
- height: 36px;
1786
- color: white;
1787
- }
1788
- `;
1789
- const CloseButton = styled.button`
1790
- position: absolute;
1791
- top: 16px;
1792
- right: 16px;
1793
- background: rgba(255, 255, 255, 0.2);
1794
- border: 2px solid rgba(255, 255, 255, 0.3);
1795
- border-radius: 50%;
1796
- width: 36px;
1797
- height: 36px;
1798
- display: flex;
1799
- align-items: center;
1800
- justify-content: center;
1801
- cursor: pointer;
1802
- transition: all 0.2s;
1803
- z-index: 10;
1804
-
1805
- svg {
1806
- width: 20px;
1807
- height: 20px;
1808
- color: white;
1809
- }
1810
-
1811
- &:hover {
1812
- background: rgba(255, 255, 255, 0.3);
1813
- transform: scale(1.1);
1814
- }
1815
-
1816
- &:active {
1817
- transform: scale(0.95);
1818
- }
1819
- `;
1820
- const ToggleButton = styled.button`
1821
- background: none;
1822
- border: none;
1823
- color: #7C3AED;
1824
- font-size: 13px;
1825
- font-weight: 600;
1826
- cursor: pointer;
1827
- padding: 8px 0;
1828
- text-decoration: underline;
1829
- transition: color 0.2s;
1830
-
1831
- &:hover {
1832
- color: #6d28d9;
1833
- }
1834
-
1835
- &:disabled {
1836
- opacity: 0.5;
1837
- cursor: not-allowed;
1838
- }
1839
- `;
1840
- const InfoBox = styled(S)`
1841
- background: #f0fdf4;
1842
- border: 2px solid #bbf7d0;
1843
- border-radius: 8px;
1844
- padding: 16px;
1845
- margin-bottom: 20px;
1846
- `;
1847
- const LicenseGuard = ({ children }) => {
1848
- const { formatMessage } = useIntl();
1849
- const t = (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
1850
- const { get, post } = useFetchClient();
1851
- const { toggleNotification } = useNotification();
1852
- const navigate = useNavigate();
1853
- const [isChecking, setIsChecking] = useState(true);
1854
- const [needsLicense, setNeedsLicense] = useState(false);
1855
- const [isCreating, setIsCreating] = useState(false);
1856
- const [useExistingKey, setUseExistingKey] = useState(false);
1857
- const [existingLicenseKey, setExistingLicenseKey] = useState("");
1858
- const [existingEmail, setExistingEmail] = useState("");
1859
- const [adminUser, setAdminUser] = useState(null);
1860
- useEffect(() => {
1861
- checkLicenseStatus();
1862
- fetchAdminUser();
1863
- }, []);
1864
- const fetchAdminUser = async () => {
1865
- try {
1866
- const response = await get("/admin/users/me");
1867
- const userData = response.data?.data || response.data;
1868
- if (userData) {
1869
- setAdminUser(userData);
1870
- }
1871
- } catch (error) {
1872
- console.debug("[Magic Editor X] Could not fetch admin user");
1873
- }
1874
- };
1875
- const checkLicenseStatus = async () => {
1876
- setIsChecking(true);
1877
- try {
1878
- const response = await get("/magic-editor-x/license/status");
1879
- if (response.data.valid || response.data.demo === false) {
1880
- setNeedsLicense(false);
1881
- } else {
1882
- setNeedsLicense(true);
1883
- }
1884
- } catch (error) {
1885
- console.error("[Magic Editor X] License check error:", error);
1886
- setNeedsLicense(false);
1887
- } finally {
1888
- setIsChecking(false);
1889
- }
1890
- };
1891
- const handleAutoCreateLicense = async (e) => {
1892
- e.preventDefault();
1893
- setIsCreating(true);
1894
- try {
1895
- const response = await post("/magic-editor-x/license/auto-create", {});
1896
- if (response.data && response.data.success) {
1897
- toggleNotification({
1898
- type: "success",
1899
- message: t("licenseGuard.success.created", "License created! Reloading...")
1900
- });
1901
- setNeedsLicense(false);
1902
- setTimeout(() => {
1903
- window.location.reload();
1904
- }, 500);
1905
- } else {
1906
- throw new Error("Failed to auto-create license");
1907
- }
1908
- } catch (error) {
1909
- console.error("[Magic Editor X] Error:", error);
1910
- toggleNotification({
1911
- type: "danger",
1912
- message: t("licenseGuard.error.create", "Failed to create license. Try manual entry.")
1913
- });
1914
- setIsCreating(false);
1915
- setUseExistingKey(true);
1916
- }
1917
- };
1918
- const handleValidateExistingKey = async (e) => {
1919
- e.preventDefault();
1920
- if (!existingLicenseKey.trim() || !existingEmail.trim()) {
1921
- toggleNotification({
1922
- type: "warning",
1923
- message: t("licenseGuard.error.required", "Please enter both license key and email address")
1924
- });
1925
- return;
1926
- }
1927
- setIsCreating(true);
1928
- try {
1929
- const response = await post("/magic-editor-x/license/store-key", {
1930
- licenseKey: existingLicenseKey.trim(),
1931
- email: existingEmail.trim()
1932
- });
1933
- if (response.data && response.data.success) {
1934
- toggleNotification({
1935
- type: "success",
1936
- message: t("licenseGuard.success.activated", "License activated! Reloading...")
1937
- });
1938
- setNeedsLicense(false);
1939
- setTimeout(() => {
1940
- window.location.reload();
1941
- }, 500);
1942
- } else {
1943
- throw new Error("Invalid license");
1944
- }
1945
- } catch (error) {
1946
- toggleNotification({
1947
- type: "danger",
1948
- message: t("licenseGuard.error.invalid", "Invalid license key or email address")
1949
- });
1950
- setIsCreating(false);
1951
- }
1952
- };
1953
- const handleSkip = () => {
1954
- setNeedsLicense(false);
1955
- };
1956
- const handleClose = () => {
1957
- navigate("/content-manager");
1958
- };
1959
- if (isChecking) {
1960
- return /* @__PURE__ */ jsx(S, { padding: 8, style: { textAlign: "center" }, children: /* @__PURE__ */ jsx(kt, { children: t("license.checking", "Checking license...") }) });
1961
- }
1962
- if (needsLicense) {
1963
- return /* @__PURE__ */ jsx(ModalOverlay, { children: /* @__PURE__ */ jsxs(ModalContent, { children: [
1964
- /* @__PURE__ */ jsxs(GradientHeader, { children: [
1965
- /* @__PURE__ */ jsx(CloseButton, { onClick: handleClose, type: "button", children: /* @__PURE__ */ jsx(XMarkIcon, {}) }),
1966
- /* @__PURE__ */ jsx(IconWrapper, { children: /* @__PURE__ */ jsx(KeyIcon, {}) }),
1967
- /* @__PURE__ */ jsxs(S, { style: { textAlign: "center", position: "relative" }, children: [
1968
- /* @__PURE__ */ jsx(
1969
- A,
1970
- {
1971
- variant: "alpha",
1972
- style: {
1973
- color: "white",
1974
- fontSize: "24px",
1975
- fontWeight: "700",
1976
- marginBottom: "12px",
1977
- display: "block"
1978
- },
1979
- children: t("licenseGuard.title", "Activate Magic Editor X")
1980
- }
1981
- ),
1982
- /* @__PURE__ */ jsx(
1983
- A,
1984
- {
1985
- variant: "epsilon",
1986
- style: {
1987
- color: "rgba(255, 255, 255, 0.9)",
1988
- fontSize: "14px",
1989
- display: "block"
1990
- },
1991
- children: useExistingKey ? t("licenseGuard.subtitle.existing", "Enter your existing license key") : t("licenseGuard.subtitle.new", "Create a FREE license to start using the editor")
1992
- }
1993
- )
1994
- ] })
1995
- ] }),
1996
- /* @__PURE__ */ jsx("form", { onSubmit: useExistingKey ? handleValidateExistingKey : handleAutoCreateLicense, children: /* @__PURE__ */ jsx(S, { padding: 6, paddingLeft: 8, paddingRight: 8, children: /* @__PURE__ */ jsxs(C, { direction: "column", gap: 5, style: { width: "100%" }, children: [
1997
- /* @__PURE__ */ jsx(InfoBox, { children: /* @__PURE__ */ jsxs(A, { variant: "omega", style: { fontSize: "13px", lineHeight: "1.6" }, children: [
1998
- "[FREE] ",
1999
- t("licenseGuard.info", "The editor is completely FREE to use! Creating a license helps us track usage and provide better support. You get 2 collaborators included.")
2000
- ] }) }),
2001
- /* @__PURE__ */ jsx(S, { style: { textAlign: "center", width: "100%" }, children: /* @__PURE__ */ jsx(
2002
- ToggleButton,
2003
- {
2004
- type: "button",
2005
- onClick: () => setUseExistingKey(!useExistingKey),
2006
- disabled: isCreating,
2007
- children: useExistingKey ? t("licenseGuard.toggleNew", "Create new license") : t("licenseGuard.toggleExisting", "Have a license key?")
2008
- }
2009
- ) }),
2010
- useExistingKey ? /* @__PURE__ */ jsxs(Fragment, { children: [
2011
- /* @__PURE__ */ jsxs(S, { style: { width: "100%" }, children: [
2012
- /* @__PURE__ */ jsxs(
2013
- A,
2014
- {
2015
- variant: "pi",
2016
- fontWeight: "bold",
2017
- style: { marginBottom: "8px", display: "block" },
2018
- children: [
2019
- t("licenseGuard.email", "Email Address"),
2020
- " *"
2021
- ]
2022
- }
2023
- ),
2024
- /* @__PURE__ */ jsx(
2025
- Pc,
2026
- {
2027
- placeholder: t("licenseGuard.email.placeholder", "admin@example.com"),
2028
- type: "email",
2029
- value: existingEmail,
2030
- onChange: (e) => setExistingEmail(e.target.value),
2031
- required: true,
2032
- disabled: isCreating
2033
- }
2034
- )
2035
- ] }),
2036
- /* @__PURE__ */ jsxs(S, { style: { width: "100%" }, children: [
2037
- /* @__PURE__ */ jsxs(
2038
- A,
2039
- {
2040
- variant: "pi",
2041
- fontWeight: "bold",
2042
- style: { marginBottom: "8px", display: "block" },
2043
- children: [
2044
- t("licenseGuard.licenseKey", "License Key"),
2045
- " *"
2046
- ]
2047
- }
2048
- ),
2049
- /* @__PURE__ */ jsx(
2050
- Pc,
2051
- {
2052
- placeholder: t("licenseGuard.licenseKey.placeholder", "MAGIC-EDITOR-XXXX-XXXX-XXXX"),
2053
- value: existingLicenseKey,
2054
- onChange: (e) => setExistingLicenseKey(e.target.value),
2055
- required: true,
2056
- disabled: isCreating
2057
- }
2058
- )
2059
- ] })
2060
- ] }) : adminUser ? /* @__PURE__ */ jsxs(
2061
- S,
2062
- {
2063
- background: "success100",
2064
- padding: 5,
2065
- style: {
2066
- borderRadius: "8px",
2067
- border: "2px solid #DCFCE7",
2068
- textAlign: "center"
2069
- },
2070
- children: [
2071
- /* @__PURE__ */ jsx(A, { variant: "omega", fontWeight: "bold", style: { marginBottom: "12px", display: "block" }, children: t("licenseGuard.readyToActivate", "Ready to activate with your account:") }),
2072
- /* @__PURE__ */ jsxs(A, { variant: "pi", style: { marginBottom: "4px", display: "block" }, children: [
2073
- adminUser.firstname || "Admin",
2074
- " ",
2075
- adminUser.lastname || "User"
2076
- ] }),
2077
- /* @__PURE__ */ jsx(A, { variant: "pi", textColor: "neutral600", children: adminUser.email || "Loading..." })
2078
- ]
2079
- }
2080
- ) : /* @__PURE__ */ jsxs(S, { padding: 4, background: "neutral100", hasRadius: true, style: { textAlign: "center" }, children: [
2081
- /* @__PURE__ */ jsx(kt, { small: true }),
2082
- /* @__PURE__ */ jsx(A, { variant: "pi", marginTop: 2, children: t("licenseGuard.loadingUser", "Loading admin user data...") })
2083
- ] }),
2084
- /* @__PURE__ */ jsxs(C, { gap: 3, justifyContent: "center", style: { marginTop: "16px" }, children: [
2085
- /* @__PURE__ */ jsx(
2086
- Ct,
2087
- {
2088
- variant: "tertiary",
2089
- onClick: handleSkip,
2090
- disabled: isCreating,
2091
- children: t("licenseGuard.skip", "Skip for now")
2092
- }
2093
- ),
2094
- useExistingKey ? /* @__PURE__ */ jsx(
2095
- Ct,
2096
- {
2097
- type: "submit",
2098
- size: "L",
2099
- startIcon: /* @__PURE__ */ jsx(CheckIcon, { style: { width: 20, height: 20 } }),
2100
- loading: isCreating,
2101
- disabled: isCreating || !existingLicenseKey.trim() || !existingEmail.trim(),
2102
- style: {
2103
- background: "linear-gradient(135deg, #7C3AED 0%, #6d28d9 100%)",
2104
- color: "white",
2105
- fontWeight: "600",
2106
- border: "none"
2107
- },
2108
- children: t("licenseGuard.validate", "Validate License")
2109
- }
2110
- ) : /* @__PURE__ */ jsx(
2111
- Ct,
2112
- {
2113
- type: "submit",
2114
- size: "L",
2115
- startIcon: /* @__PURE__ */ jsx(CheckIcon, { style: { width: 20, height: 20 } }),
2116
- loading: isCreating,
2117
- disabled: isCreating || !adminUser,
2118
- style: {
2119
- background: "linear-gradient(135deg, #7C3AED 0%, #6d28d9 100%)",
2120
- color: "white",
2121
- fontWeight: "600",
2122
- border: "none"
2123
- },
2124
- children: t("licenseGuard.activate", "Activate FREE License")
2125
- }
2126
- )
2127
- ] })
2128
- ] }) }) })
2129
- ] }) });
2130
- }
2131
- return /* @__PURE__ */ jsx(Fragment, { children });
2132
- };
2133
- const App = () => {
2134
- return /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions.access, children: /* @__PURE__ */ jsx(LicenseGuard, { children: /* @__PURE__ */ jsxs(Routes, { children: [
2135
- /* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
2136
- /* @__PURE__ */ jsx(Route, { path: "collaboration", element: /* @__PURE__ */ jsx(CollaborationSettings, {}) }),
2137
- /* @__PURE__ */ jsx(Route, { path: "license", element: /* @__PURE__ */ jsx(LicensePage, {}) }),
2138
- /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
2139
- ] }) }) });
2140
- };
2141
- export {
2142
- App,
2143
- App as default
2144
- };