magic-editor-x 1.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 (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +890 -0
  3. package/dist/_chunks/App-B1FgOsWa.mjs +2143 -0
  4. package/dist/_chunks/App-mtrlABtd.js +2146 -0
  5. package/dist/_chunks/LicensePage-BnyWSrWs.js +375 -0
  6. package/dist/_chunks/LicensePage-CWH-AFR-.mjs +373 -0
  7. package/dist/_chunks/LiveCollaborationPanel-DbDHwr2C.js +222 -0
  8. package/dist/_chunks/LiveCollaborationPanel-ryjcDAA7.mjs +220 -0
  9. package/dist/_chunks/Settings-Bk9bxJTy.js +440 -0
  10. package/dist/_chunks/Settings-D-V2MLVm.mjs +438 -0
  11. package/dist/_chunks/de-CSrHZWEb.mjs +295 -0
  12. package/dist/_chunks/de-CzSo1oD2.js +295 -0
  13. package/dist/_chunks/en-DuQun2v4.mjs +295 -0
  14. package/dist/_chunks/en-DxIkVPUh.js +295 -0
  15. package/dist/_chunks/es-DAQ_97zx.js +273 -0
  16. package/dist/_chunks/es-DEB0CA8S.mjs +273 -0
  17. package/dist/_chunks/fr-Bqkhvdx2.mjs +273 -0
  18. package/dist/_chunks/fr-ChPabvNP.js +273 -0
  19. package/dist/_chunks/getTranslation-C4uWR0DB.mjs +50985 -0
  20. package/dist/_chunks/getTranslation-D35vbDap.js +51001 -0
  21. package/dist/_chunks/index-B5MzUyo0.mjs +2541 -0
  22. package/dist/_chunks/index-BRVqbnOb.mjs +4450 -0
  23. package/dist/_chunks/index-BiLy_f7C.js +2540 -0
  24. package/dist/_chunks/index-CQx7-dFP.js +4472 -0
  25. package/dist/_chunks/pt-BMoYltav.mjs +273 -0
  26. package/dist/_chunks/pt-Cm74LpyZ.js +273 -0
  27. package/dist/_chunks/tools-CjnQJ9w2.mjs +2155 -0
  28. package/dist/_chunks/tools-DNt2tioN.js +2186 -0
  29. package/dist/admin/index.js +3 -0
  30. package/dist/admin/index.mjs +4 -0
  31. package/dist/server/index.js +2554 -0
  32. package/dist/server/index.mjs +2544 -0
  33. package/dist/style.css +164 -0
  34. package/package.json +122 -0
  35. package/pics/collab-magiceditorX.png +0 -0
  36. package/pics/editorX.png +0 -0
  37. package/pics/liveCollabwidget1.png +0 -0
@@ -0,0 +1,375 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const admin = require("@strapi/strapi/admin");
6
+ const getTranslation = require("./getTranslation-D35vbDap.js");
7
+ const styled = require("styled-components");
8
+ const index = require("./index-BiLy_f7C.js");
9
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
+ const styled__default = /* @__PURE__ */ _interopDefault(styled);
11
+ const Container = styled__default.default(getTranslation.Box)`
12
+ padding: 32px;
13
+ max-width: 1400px;
14
+ margin: 0 auto;
15
+ `;
16
+ const Header = styled__default.default(getTranslation.Box)`
17
+ text-align: center;
18
+ margin-bottom: 48px;
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ gap: 8px;
23
+ `;
24
+ const Title = styled__default.default(getTranslation.Typography)`
25
+ font-size: 2.5rem;
26
+ font-weight: 700;
27
+ margin-bottom: 8px;
28
+ background: linear-gradient(135deg, #7C3AED, #6d28d9);
29
+ -webkit-background-clip: text;
30
+ -webkit-text-fill-color: transparent;
31
+ display: block;
32
+ `;
33
+ const Subtitle = styled__default.default(getTranslation.Typography)`
34
+ font-size: 1.125rem;
35
+ color: ${(props) => props.theme.colors.neutral600};
36
+ line-height: 1.6;
37
+ display: block;
38
+ `;
39
+ const TierGrid = styled__default.default(getTranslation.Flex)`
40
+ gap: 32px;
41
+ margin: 0 auto 48px;
42
+ max-width: 1080px;
43
+ justify-content: center;
44
+ flex-wrap: wrap;
45
+ align-items: stretch;
46
+ `;
47
+ const TierWrapper = styled__default.default(getTranslation.Box)`
48
+ flex: 1;
49
+ min-width: 280px;
50
+ max-width: 340px;
51
+ display: flex;
52
+ `;
53
+ const TierCard = styled__default.default(getTranslation.Box)`
54
+ background: ${(props) => props.theme.colors.neutral0};
55
+ border-radius: 16px;
56
+ padding: 32px;
57
+ border: 2px solid ${(props) => props.$featured ? "#7C3AED" : props.theme.colors.neutral200};
58
+ position: relative;
59
+ transition: all 0.3s ease;
60
+ box-shadow: ${(props) => props.$featured ? "0 20px 25px -5px rgba(124, 58, 237, 0.25), 0 8px 10px -6px rgba(124, 58, 237, 0.2)" : "0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05)"};
61
+ display: flex;
62
+ flex-direction: column;
63
+ width: 100%;
64
+
65
+ &:hover {
66
+ transform: translateY(-4px);
67
+ box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
68
+ }
69
+ `;
70
+ const PopularBadge = styled__default.default(getTranslation.Badge)`
71
+ position: absolute;
72
+ top: -12px;
73
+ right: 24px;
74
+ background: linear-gradient(135deg, #7C3AED, #6d28d9);
75
+ color: white;
76
+ padding: 4px 16px;
77
+ font-size: 12px;
78
+ font-weight: 600;
79
+ `;
80
+ const TierIcon = styled__default.default(getTranslation.Box)`
81
+ width: 48px;
82
+ height: 48px;
83
+ border-radius: 12px;
84
+ display: flex;
85
+ align-items: center;
86
+ justify-content: center;
87
+ margin-bottom: 16px;
88
+ background: ${(props) => props.$color};
89
+
90
+ svg {
91
+ width: 28px;
92
+ height: 28px;
93
+ color: white;
94
+ }
95
+ `;
96
+ const TierName = styled__default.default(getTranslation.Typography)`
97
+ font-size: 1.5rem;
98
+ font-weight: 700;
99
+ margin-bottom: 8px;
100
+ `;
101
+ const TierPrice = styled__default.default(getTranslation.Typography)`
102
+ font-size: 2rem;
103
+ font-weight: 800;
104
+ margin-bottom: 4px;
105
+ `;
106
+ const TierDescription = styled__default.default(getTranslation.Typography)`
107
+ color: ${(props) => props.theme.colors.neutral600};
108
+ margin-bottom: 24px;
109
+ `;
110
+ const FeatureList = styled__default.default(getTranslation.Box)`
111
+ margin-bottom: 24px;
112
+ flex: 1;
113
+ `;
114
+ const Feature = styled__default.default(getTranslation.Flex)`
115
+ gap: 12px;
116
+ margin-bottom: 12px;
117
+ align-items: flex-start;
118
+ `;
119
+ const FeatureIcon = styled__default.default(getTranslation.Box)`
120
+ width: 20px;
121
+ height: 20px;
122
+ border-radius: 50%;
123
+ display: flex;
124
+ align-items: center;
125
+ justify-content: center;
126
+ flex-shrink: 0;
127
+ margin-top: 2px;
128
+
129
+ ${(props) => props.$included ? `
130
+ background: #DCFCE7;
131
+ svg { color: #16A34A; }
132
+ ` : `
133
+ background: #FEE2E2;
134
+ svg { color: #DC2626; }
135
+ `}
136
+ `;
137
+ const UpgradeButton = styled__default.default(getTranslation.Button)`
138
+ width: 100%;
139
+ height: 48px;
140
+ font-weight: 600;
141
+ font-size: 15px;
142
+ background: ${(props) => props.$gradient};
143
+ border: none;
144
+ color: white;
145
+
146
+ &:hover {
147
+ transform: translateY(-2px);
148
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
149
+ }
150
+ `;
151
+ const CurrentPlanBadge = styled__default.default(getTranslation.Badge)`
152
+ width: 100%;
153
+ height: 48px;
154
+ display: flex;
155
+ align-items: center;
156
+ justify-content: center;
157
+ background: ${(props) => props.theme.colors.neutral100};
158
+ color: ${(props) => props.theme.colors.neutral600};
159
+ font-weight: 600;
160
+ font-size: 15px;
161
+ `;
162
+ const UsageBox = styled__default.default(getTranslation.Box)`
163
+ background: ${(props) => props.theme.colors.neutral100};
164
+ border: 1px solid ${(props) => props.theme.colors.neutral200};
165
+ border-radius: 12px;
166
+ padding: 20px;
167
+ margin-bottom: 32px;
168
+ `;
169
+ const UsageBar = styled__default.default.div`
170
+ height: 8px;
171
+ background: ${(props) => props.theme.colors.neutral200};
172
+ border-radius: 4px;
173
+ overflow: hidden;
174
+ margin-top: 8px;
175
+ `;
176
+ const UsageProgress = styled__default.default.div`
177
+ height: 100%;
178
+ background: ${(props) => props.$percentage > 80 ? "#ef4444" : props.$percentage > 50 ? "#f59e0b" : "#10b981"};
179
+ width: ${(props) => Math.min(props.$percentage, 100)}%;
180
+ transition: width 0.3s ease;
181
+ `;
182
+ const LicensePage = () => {
183
+ const { formatMessage } = getTranslation.useIntl();
184
+ const t = (id, defaultMessage, values) => formatMessage({ id: getTranslation.getTranslation(id), defaultMessage }, values);
185
+ const { get } = admin.useFetchClient();
186
+ const { toggleNotification } = admin.useNotification();
187
+ const [currentTier, setCurrentTier] = React.useState("free");
188
+ const [limits, setLimits] = React.useState(null);
189
+ const [loading, setLoading] = React.useState(true);
190
+ React.useEffect(() => {
191
+ fetchLicenseInfo();
192
+ }, []);
193
+ const fetchLicenseInfo = async () => {
194
+ try {
195
+ const response = await get("/magic-editor-x/license/limits");
196
+ const licenseData = response.data || {};
197
+ setCurrentTier(licenseData.tier || "free");
198
+ setLimits(licenseData.limits);
199
+ setLoading(false);
200
+ } catch (error) {
201
+ console.error("Failed to fetch license info:", error);
202
+ setLoading(false);
203
+ }
204
+ };
205
+ const getTierRank = (tierId) => {
206
+ const ranks = {
207
+ "free": 0,
208
+ "premium": 1,
209
+ "advanced": 2,
210
+ "enterprise": 3
211
+ };
212
+ return ranks[tierId] || 0;
213
+ };
214
+ const getButtonText = (tierId) => {
215
+ const currentRank = getTierRank(currentTier);
216
+ const targetRank = getTierRank(tierId);
217
+ if (currentRank === targetRank) {
218
+ return t("upgradePage.currentPlan", "Current Plan");
219
+ } else if (targetRank > currentRank) {
220
+ return t("upgradePage.upgradeNow", "Upgrade Now");
221
+ } else {
222
+ return t("upgradePage.downgrade", "Downgrade");
223
+ }
224
+ };
225
+ const tiers = [
226
+ {
227
+ id: "free",
228
+ name: "FREE",
229
+ price: "$0",
230
+ period: "forever",
231
+ description: "Perfect for small projects and testing",
232
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index.ForwardRef$o, {}),
233
+ color: "linear-gradient(135deg, #6B7280, #4B5563)",
234
+ features: [
235
+ { name: "Full Editor Access", included: true },
236
+ { name: "All Editor Tools", included: true },
237
+ { name: "2 Collaborators", included: true },
238
+ { name: "Real-time Sync", included: true },
239
+ { name: "AI Grammar Check (3/day)", included: true },
240
+ { name: "AI Style + Rewrite", included: false },
241
+ { name: "Version History", included: false },
242
+ { name: "Priority Support", included: false }
243
+ ],
244
+ limits: {
245
+ collaborators: "2"
246
+ }
247
+ },
248
+ {
249
+ id: "premium",
250
+ name: "PREMIUM",
251
+ price: "$9.90",
252
+ period: "/month",
253
+ description: "Enhanced collaboration for teams",
254
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index.ForwardRef$1g, {}),
255
+ color: "linear-gradient(135deg, #8B5CF6, #7C3AED)",
256
+ featured: true,
257
+ features: [
258
+ { name: "Full Editor Access", included: true },
259
+ { name: "All Editor Tools", included: true },
260
+ { name: "10 Collaborators", included: true },
261
+ { name: "Real-time Sync", included: true },
262
+ { name: "AI Grammar + Style (10/day)", included: true },
263
+ { name: "Version History", included: true },
264
+ { name: "Priority Support", included: true }
265
+ ],
266
+ limits: {
267
+ collaborators: "10"
268
+ }
269
+ },
270
+ {
271
+ id: "advanced",
272
+ name: "ADVANCED",
273
+ price: "$24.90",
274
+ period: "/month",
275
+ description: "Unlimited collaboration for enterprises",
276
+ icon: /* @__PURE__ */ jsxRuntime.jsx(index.ForwardRef$y, {}),
277
+ color: "linear-gradient(135deg, #7C3AED, #6d28d9)",
278
+ features: [
279
+ { name: "Full Editor Access", included: true },
280
+ { name: "All Editor Tools", included: true },
281
+ { name: "Unlimited Collaborators", included: true },
282
+ { name: "Real-time Sync", included: true },
283
+ { name: "AI All Types (Unlimited)", included: true },
284
+ { name: "Version History", included: true },
285
+ { name: "Priority Support", included: true }
286
+ ],
287
+ limits: {
288
+ collaborators: "Unlimited"
289
+ }
290
+ }
291
+ ];
292
+ const handleUpgrade = (tierId) => {
293
+ window.open("https://store.magicdx.dev/", "_blank");
294
+ };
295
+ if (loading) {
296
+ return /* @__PURE__ */ jsxRuntime.jsx(Container, { children: /* @__PURE__ */ jsxRuntime.jsx(getTranslation.Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsxRuntime.jsx(getTranslation.Loader, { children: t("license.loading", "Loading license information...") }) }) });
297
+ }
298
+ const collaboratorUsage = limits?.collaborators ? {
299
+ current: limits.collaborators.current || 0,
300
+ max: limits.collaborators.max,
301
+ unlimited: limits.collaborators.unlimited,
302
+ percentage: limits.collaborators.unlimited ? 0 : limits.collaborators.current / limits.collaborators.max * 100
303
+ } : { current: 0, max: 2, unlimited: false, percentage: 0 };
304
+ return /* @__PURE__ */ jsxRuntime.jsxs(Container, { children: [
305
+ /* @__PURE__ */ jsxRuntime.jsxs(Header, { children: [
306
+ /* @__PURE__ */ jsxRuntime.jsx(Title, { variant: "alpha", children: t("upgradePage.title", "Magic Editor X") }),
307
+ /* @__PURE__ */ jsxRuntime.jsx(Subtitle, { variant: "omega", children: t("upgradePage.subtitle", "Choose your plan for collaborative editing") })
308
+ ] }),
309
+ /* @__PURE__ */ jsxRuntime.jsxs(UsageBox, { children: [
310
+ /* @__PURE__ */ jsxRuntime.jsxs(getTranslation.Flex, { justifyContent: "space-between", alignItems: "center", children: [
311
+ /* @__PURE__ */ jsxRuntime.jsx(getTranslation.Typography, { variant: "beta", fontWeight: "bold", children: t("upgradePage.currentUsage", "Current Usage") }),
312
+ /* @__PURE__ */ jsxRuntime.jsx(getTranslation.Badge, { style: { background: currentTier === "free" ? "#6B7280" : "#7C3AED", color: "white" }, children: currentTier.toUpperCase() })
313
+ ] }),
314
+ /* @__PURE__ */ jsxRuntime.jsxs(getTranslation.Box, { marginTop: 4, children: [
315
+ /* @__PURE__ */ jsxRuntime.jsxs(getTranslation.Flex, { justifyContent: "space-between", children: [
316
+ /* @__PURE__ */ jsxRuntime.jsx(getTranslation.Typography, { variant: "omega", children: t("upgradePage.collaborators", "Collaborators") }),
317
+ /* @__PURE__ */ jsxRuntime.jsxs(getTranslation.Typography, { variant: "omega", fontWeight: "bold", children: [
318
+ collaboratorUsage.current,
319
+ " / ",
320
+ collaboratorUsage.unlimited ? t("license.unlimited", "Unlimited") : collaboratorUsage.max
321
+ ] })
322
+ ] }),
323
+ !collaboratorUsage.unlimited && /* @__PURE__ */ jsxRuntime.jsx(UsageBar, { children: /* @__PURE__ */ jsxRuntime.jsx(UsageProgress, { $percentage: collaboratorUsage.percentage }) })
324
+ ] })
325
+ ] }),
326
+ /* @__PURE__ */ jsxRuntime.jsx(TierGrid, { children: tiers.map((tier) => /* @__PURE__ */ jsxRuntime.jsx(TierWrapper, { children: /* @__PURE__ */ jsxRuntime.jsxs(TierCard, { $featured: tier.featured, children: [
327
+ tier.featured && /* @__PURE__ */ jsxRuntime.jsx(PopularBadge, { children: t("upgradePage.mostPopular", "MOST POPULAR") }),
328
+ /* @__PURE__ */ jsxRuntime.jsx(TierIcon, { $color: tier.color, children: tier.icon }),
329
+ /* @__PURE__ */ jsxRuntime.jsx(TierName, { variant: "beta", children: tier.name }),
330
+ /* @__PURE__ */ jsxRuntime.jsxs(getTranslation.Flex, { alignItems: "baseline", gap: 1, children: [
331
+ /* @__PURE__ */ jsxRuntime.jsx(TierPrice, { variant: "alpha", children: tier.price }),
332
+ /* @__PURE__ */ jsxRuntime.jsx(getTranslation.Typography, { variant: "omega", style: { color: "#6B7280" }, children: tier.period })
333
+ ] }),
334
+ /* @__PURE__ */ jsxRuntime.jsx(TierDescription, { variant: "omega", children: tier.description }),
335
+ /* @__PURE__ */ jsxRuntime.jsx(
336
+ getTranslation.Box,
337
+ {
338
+ background: "neutral100",
339
+ hasRadius: true,
340
+ padding: 3,
341
+ marginBottom: 5,
342
+ children: /* @__PURE__ */ jsxRuntime.jsxs(getTranslation.Typography, { variant: "pi", style: { fontSize: "13px" }, children: [
343
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Collaborators:" }),
344
+ " ",
345
+ tier.limits.collaborators
346
+ ] })
347
+ }
348
+ ),
349
+ /* @__PURE__ */ jsxRuntime.jsx(FeatureList, { children: tier.features.map((feature, index$1) => /* @__PURE__ */ jsxRuntime.jsxs(Feature, { children: [
350
+ /* @__PURE__ */ jsxRuntime.jsx(FeatureIcon, { $included: feature.included, children: feature.included ? /* @__PURE__ */ jsxRuntime.jsx(index.ForwardRef$2o, { style: { width: 14, height: 14 } }) : /* @__PURE__ */ jsxRuntime.jsx(index.ForwardRef$26, { style: { width: 14, height: 14 } }) }),
351
+ /* @__PURE__ */ jsxRuntime.jsx(
352
+ getTranslation.Typography,
353
+ {
354
+ variant: "omega",
355
+ textColor: feature.included ? "neutral800" : "neutral500",
356
+ style: {
357
+ fontSize: "14px",
358
+ textDecoration: feature.included ? "none" : "line-through"
359
+ },
360
+ children: feature.name
361
+ }
362
+ )
363
+ ] }, index$1)) }),
364
+ currentTier === tier.id ? /* @__PURE__ */ jsxRuntime.jsx(CurrentPlanBadge, { children: t("upgradePage.currentPlan", "Current Plan") }) : /* @__PURE__ */ jsxRuntime.jsx(
365
+ UpgradeButton,
366
+ {
367
+ $gradient: tier.color,
368
+ onClick: () => handleUpgrade(tier.id),
369
+ children: getButtonText(tier.id)
370
+ }
371
+ )
372
+ ] }) }, tier.id)) })
373
+ ] });
374
+ };
375
+ exports.default = LicensePage;