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