strapi-plugin-magic-mail 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COPYRIGHT_NOTICE.txt +13 -0
- package/LICENSE +22 -0
- package/README.md +1420 -0
- package/admin/jsconfig.json +10 -0
- package/admin/src/components/AddAccountModal.jsx +1943 -0
- package/admin/src/components/Initializer.jsx +14 -0
- package/admin/src/components/LicenseGuard.jsx +475 -0
- package/admin/src/components/PluginIcon.jsx +5 -0
- package/admin/src/hooks/useAuthRefresh.js +44 -0
- package/admin/src/hooks/useLicense.js +158 -0
- package/admin/src/index.js +86 -0
- package/admin/src/pages/Analytics.jsx +762 -0
- package/admin/src/pages/App.jsx +111 -0
- package/admin/src/pages/EmailDesigner/EditorPage.jsx +1405 -0
- package/admin/src/pages/EmailDesigner/TemplateList.jsx +1807 -0
- package/admin/src/pages/HomePage.jsx +1233 -0
- package/admin/src/pages/LicensePage.jsx +424 -0
- package/admin/src/pages/RoutingRules.jsx +1141 -0
- package/admin/src/pages/Settings.jsx +603 -0
- package/admin/src/pluginId.js +3 -0
- package/admin/src/translations/de.json +71 -0
- package/admin/src/translations/en.json +70 -0
- package/admin/src/translations/es.json +71 -0
- package/admin/src/translations/fr.json +71 -0
- package/admin/src/translations/pt.json +71 -0
- package/admin/src/utils/fetchWithRetry.js +123 -0
- package/admin/src/utils/getTranslation.js +5 -0
- package/dist/_chunks/App-B-Gp4Vbr.js +7568 -0
- package/dist/_chunks/App-BymMjoGM.mjs +7543 -0
- package/dist/_chunks/LicensePage-Bl02myMx.mjs +342 -0
- package/dist/_chunks/LicensePage-CJXwPnEe.js +344 -0
- package/dist/_chunks/Settings-C_TmKwcz.mjs +400 -0
- package/dist/_chunks/Settings-zuFQ3pnn.js +402 -0
- package/dist/_chunks/de-CN-G9j1S.js +64 -0
- package/dist/_chunks/de-DS04rP54.mjs +64 -0
- package/dist/_chunks/en-BDc7Jk8u.js +64 -0
- package/dist/_chunks/en-BEFQJXvR.mjs +64 -0
- package/dist/_chunks/es-BpV1MIdm.js +64 -0
- package/dist/_chunks/es-DQHwzPpP.mjs +64 -0
- package/dist/_chunks/fr-BG1WfEVm.mjs +64 -0
- package/dist/_chunks/fr-vpziIpRp.js +64 -0
- package/dist/_chunks/pt-CMoGrOib.mjs +64 -0
- package/dist/_chunks/pt-ODpAhDNa.js +64 -0
- package/dist/admin/index.js +89 -0
- package/dist/admin/index.mjs +90 -0
- package/dist/server/index.js +6214 -0
- package/dist/server/index.mjs +6208 -0
- package/package.json +113 -0
- package/server/jsconfig.json +10 -0
- package/server/src/bootstrap.js +153 -0
- package/server/src/config/features.js +260 -0
- package/server/src/config/index.js +6 -0
- package/server/src/content-types/email-account/schema.json +93 -0
- package/server/src/content-types/email-event/index.js +8 -0
- package/server/src/content-types/email-event/schema.json +57 -0
- package/server/src/content-types/email-link/index.js +8 -0
- package/server/src/content-types/email-link/schema.json +49 -0
- package/server/src/content-types/email-log/index.js +8 -0
- package/server/src/content-types/email-log/schema.json +106 -0
- package/server/src/content-types/email-template/schema.json +74 -0
- package/server/src/content-types/email-template-version/schema.json +60 -0
- package/server/src/content-types/index.js +33 -0
- package/server/src/content-types/routing-rule/schema.json +59 -0
- package/server/src/controllers/accounts.js +220 -0
- package/server/src/controllers/analytics.js +347 -0
- package/server/src/controllers/controller.js +26 -0
- package/server/src/controllers/email-designer.js +474 -0
- package/server/src/controllers/index.js +21 -0
- package/server/src/controllers/license.js +267 -0
- package/server/src/controllers/oauth.js +474 -0
- package/server/src/controllers/routing-rules.js +122 -0
- package/server/src/controllers/test.js +383 -0
- package/server/src/destroy.js +23 -0
- package/server/src/index.js +25 -0
- package/server/src/middlewares/index.js +3 -0
- package/server/src/policies/index.js +3 -0
- package/server/src/register.js +5 -0
- package/server/src/routes/admin.js +469 -0
- package/server/src/routes/content-api.js +37 -0
- package/server/src/routes/index.js +9 -0
- package/server/src/services/account-manager.js +277 -0
- package/server/src/services/analytics.js +496 -0
- package/server/src/services/email-designer.js +870 -0
- package/server/src/services/email-router.js +1420 -0
- package/server/src/services/index.js +17 -0
- package/server/src/services/license-guard.js +418 -0
- package/server/src/services/oauth.js +515 -0
- package/server/src/services/service.js +7 -0
- package/server/src/utils/encryption.js +81 -0
- package/strapi-admin.js +4 -0
- package/strapi-server.js +4 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
import { Flex, Typography, Box, Badge, Button } from "@strapi/design-system";
|
|
6
|
+
import { Check, Cross, Sparkle, Lightning, Rocket } from "@strapi/icons";
|
|
7
|
+
const Container = styled(Box)`
|
|
8
|
+
padding: 32px;
|
|
9
|
+
max-width: 1400px;
|
|
10
|
+
margin: 0 auto;
|
|
11
|
+
`;
|
|
12
|
+
const Header = styled(Box)`
|
|
13
|
+
text-align: center;
|
|
14
|
+
margin-bottom: 48px;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: 8px;
|
|
19
|
+
`;
|
|
20
|
+
const Title = styled(Typography)`
|
|
21
|
+
font-size: 2.5rem;
|
|
22
|
+
font-weight: 700;
|
|
23
|
+
margin-bottom: 8px;
|
|
24
|
+
background: linear-gradient(135deg, #0EA5E9, #A855F7);
|
|
25
|
+
-webkit-background-clip: text;
|
|
26
|
+
-webkit-text-fill-color: transparent;
|
|
27
|
+
display: block;
|
|
28
|
+
`;
|
|
29
|
+
const Subtitle = styled(Typography)`
|
|
30
|
+
font-size: 1.125rem;
|
|
31
|
+
color: #6B7280;
|
|
32
|
+
line-height: 1.6;
|
|
33
|
+
display: block;
|
|
34
|
+
`;
|
|
35
|
+
const TierGrid = styled(Flex)`
|
|
36
|
+
gap: 32px;
|
|
37
|
+
margin: 0 auto 48px;
|
|
38
|
+
max-width: 1080px;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
flex-wrap: wrap;
|
|
41
|
+
`;
|
|
42
|
+
const TierWrapper = styled(Box)`
|
|
43
|
+
flex: 1;
|
|
44
|
+
min-width: 280px;
|
|
45
|
+
max-width: 340px;
|
|
46
|
+
`;
|
|
47
|
+
const TierCard = styled(Box)`
|
|
48
|
+
background: white;
|
|
49
|
+
border-radius: 16px;
|
|
50
|
+
padding: 32px;
|
|
51
|
+
border: 2px solid ${(props) => props.$featured ? "#0EA5E9" : "#E5E7EB"};
|
|
52
|
+
position: relative;
|
|
53
|
+
transition: all 0.3s ease;
|
|
54
|
+
box-shadow: ${(props) => props.$featured ? "0 20px 25px -5px rgba(14, 165, 233, 0.25), 0 8px 10px -6px rgba(14, 165, 233, 0.2)" : "0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05)"};
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
transform: translateY(-4px);
|
|
58
|
+
box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
const PopularBadge = styled(Badge)`
|
|
62
|
+
position: absolute;
|
|
63
|
+
top: -12px;
|
|
64
|
+
right: 24px;
|
|
65
|
+
background: linear-gradient(135deg, #0EA5E9, #0284C7);
|
|
66
|
+
color: white;
|
|
67
|
+
padding: 4px 16px;
|
|
68
|
+
font-size: 12px;
|
|
69
|
+
font-weight: 600;
|
|
70
|
+
`;
|
|
71
|
+
const TierIcon = styled(Box)`
|
|
72
|
+
width: 48px;
|
|
73
|
+
height: 48px;
|
|
74
|
+
border-radius: 12px;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
margin-bottom: 16px;
|
|
79
|
+
background: ${(props) => props.$color};
|
|
80
|
+
|
|
81
|
+
svg {
|
|
82
|
+
width: 28px;
|
|
83
|
+
height: 28px;
|
|
84
|
+
color: white;
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
const TierName = styled(Typography)`
|
|
88
|
+
font-size: 1.5rem;
|
|
89
|
+
font-weight: 700;
|
|
90
|
+
margin-bottom: 8px;
|
|
91
|
+
`;
|
|
92
|
+
const TierPrice = styled(Typography)`
|
|
93
|
+
font-size: 2rem;
|
|
94
|
+
font-weight: 800;
|
|
95
|
+
margin-bottom: 4px;
|
|
96
|
+
`;
|
|
97
|
+
const TierDescription = styled(Typography)`
|
|
98
|
+
color: #6B7280;
|
|
99
|
+
margin-bottom: 24px;
|
|
100
|
+
`;
|
|
101
|
+
const FeatureList = styled(Box)`
|
|
102
|
+
margin-bottom: 24px;
|
|
103
|
+
`;
|
|
104
|
+
const Feature = styled(Flex)`
|
|
105
|
+
gap: 12px;
|
|
106
|
+
margin-bottom: 12px;
|
|
107
|
+
align-items: flex-start;
|
|
108
|
+
`;
|
|
109
|
+
const FeatureIcon = styled(Box)`
|
|
110
|
+
width: 20px;
|
|
111
|
+
height: 20px;
|
|
112
|
+
border-radius: 50%;
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
flex-shrink: 0;
|
|
117
|
+
margin-top: 2px;
|
|
118
|
+
|
|
119
|
+
${(props) => props.$included ? `
|
|
120
|
+
background: #DCFCE7;
|
|
121
|
+
svg { color: #16A34A; }
|
|
122
|
+
` : `
|
|
123
|
+
background: #FEE2E2;
|
|
124
|
+
svg { color: #DC2626; }
|
|
125
|
+
`}
|
|
126
|
+
`;
|
|
127
|
+
const UpgradeButton = styled(Button)`
|
|
128
|
+
width: 100%;
|
|
129
|
+
height: 48px;
|
|
130
|
+
font-weight: 600;
|
|
131
|
+
font-size: 15px;
|
|
132
|
+
background: ${(props) => props.$gradient};
|
|
133
|
+
border: none;
|
|
134
|
+
color: white;
|
|
135
|
+
|
|
136
|
+
&:hover {
|
|
137
|
+
transform: translateY(-2px);
|
|
138
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
const CurrentPlanBadge = styled(Badge)`
|
|
142
|
+
width: 100%;
|
|
143
|
+
height: 48px;
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
justify-content: center;
|
|
147
|
+
background: #F3F4F6;
|
|
148
|
+
color: #6B7280;
|
|
149
|
+
font-weight: 600;
|
|
150
|
+
font-size: 15px;
|
|
151
|
+
`;
|
|
152
|
+
const LicensePage = () => {
|
|
153
|
+
const { get, post } = useFetchClient();
|
|
154
|
+
const { toggleNotification } = useNotification();
|
|
155
|
+
const [currentTier, setCurrentTier] = useState("free");
|
|
156
|
+
const [limits, setLimits] = useState(null);
|
|
157
|
+
const [loading, setLoading] = useState(true);
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
fetchLicenseInfo();
|
|
160
|
+
}, []);
|
|
161
|
+
const fetchLicenseInfo = async () => {
|
|
162
|
+
try {
|
|
163
|
+
const response = await get("/magic-mail/license/limits");
|
|
164
|
+
const licenseData = response.data || {};
|
|
165
|
+
let tier = "free";
|
|
166
|
+
if (licenseData.tier) {
|
|
167
|
+
tier = licenseData.tier;
|
|
168
|
+
}
|
|
169
|
+
setCurrentTier(tier);
|
|
170
|
+
setLimits(licenseData.limits);
|
|
171
|
+
setLoading(false);
|
|
172
|
+
} catch (error) {
|
|
173
|
+
console.error("Failed to fetch license info:", error);
|
|
174
|
+
setLoading(false);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const getTierRank = (tierId) => {
|
|
178
|
+
const ranks = {
|
|
179
|
+
"free": 0,
|
|
180
|
+
"premium": 1,
|
|
181
|
+
"advanced": 2,
|
|
182
|
+
"enterprise": 3
|
|
183
|
+
};
|
|
184
|
+
return ranks[tierId] || 0;
|
|
185
|
+
};
|
|
186
|
+
const getButtonText = (tierId) => {
|
|
187
|
+
const currentRank = getTierRank(currentTier);
|
|
188
|
+
const targetRank = getTierRank(tierId);
|
|
189
|
+
if (currentRank === targetRank) {
|
|
190
|
+
return "Current Plan";
|
|
191
|
+
} else if (targetRank > currentRank) {
|
|
192
|
+
return "Upgrade Now";
|
|
193
|
+
} else {
|
|
194
|
+
return "Downgrade";
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const tiers = [
|
|
198
|
+
{
|
|
199
|
+
id: "free",
|
|
200
|
+
name: "FREE",
|
|
201
|
+
price: "$0",
|
|
202
|
+
period: "forever",
|
|
203
|
+
description: "Perfect for small projects and testing",
|
|
204
|
+
icon: /* @__PURE__ */ jsx(Sparkle, {}),
|
|
205
|
+
color: "linear-gradient(135deg, #6B7280, #4B5563)",
|
|
206
|
+
features: [
|
|
207
|
+
{ name: "25 Email Templates", included: true },
|
|
208
|
+
{ name: "3 Email Accounts", included: true },
|
|
209
|
+
{ name: "5 Routing Rules", included: true },
|
|
210
|
+
{ name: "All OAuth Providers", included: true },
|
|
211
|
+
{ name: "Import/Export Templates", included: true },
|
|
212
|
+
{ name: "Template Versioning", included: false },
|
|
213
|
+
{ name: "Analytics Dashboard", included: false },
|
|
214
|
+
{ name: "Priority Support", included: false }
|
|
215
|
+
],
|
|
216
|
+
limits: {
|
|
217
|
+
templates: "25",
|
|
218
|
+
accounts: "3",
|
|
219
|
+
rules: "5"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
id: "premium",
|
|
224
|
+
name: "PREMIUM",
|
|
225
|
+
price: "$14.50",
|
|
226
|
+
period: "/month",
|
|
227
|
+
description: "Enhanced features for growing teams",
|
|
228
|
+
icon: /* @__PURE__ */ jsx(Lightning, {}),
|
|
229
|
+
color: "linear-gradient(135deg, #8B5CF6, #7C3AED)",
|
|
230
|
+
featured: true,
|
|
231
|
+
features: [
|
|
232
|
+
{ name: "100 Email Templates", included: true },
|
|
233
|
+
{ name: "10 Email Accounts", included: true },
|
|
234
|
+
{ name: "20 Routing Rules", included: true },
|
|
235
|
+
{ name: "All OAuth Providers", included: true },
|
|
236
|
+
{ name: "Import/Export Templates", included: true },
|
|
237
|
+
{ name: "Template Versioning", included: true },
|
|
238
|
+
{ name: "Basic Analytics", included: true },
|
|
239
|
+
{ name: "Priority Support", included: true }
|
|
240
|
+
],
|
|
241
|
+
limits: {
|
|
242
|
+
templates: "100",
|
|
243
|
+
accounts: "10",
|
|
244
|
+
rules: "20"
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
id: "advanced",
|
|
249
|
+
name: "ADVANCED",
|
|
250
|
+
price: "$39.50",
|
|
251
|
+
period: "/month",
|
|
252
|
+
description: "Maximum features for power users",
|
|
253
|
+
icon: /* @__PURE__ */ jsx(Rocket, {}),
|
|
254
|
+
color: "linear-gradient(135deg, #0EA5E9, #0284C7)",
|
|
255
|
+
features: [
|
|
256
|
+
{ name: "500 Email Templates", included: true },
|
|
257
|
+
{ name: "Unlimited Accounts", included: true },
|
|
258
|
+
{ name: "Unlimited Routing Rules", included: true },
|
|
259
|
+
{ name: "All OAuth Providers", included: true },
|
|
260
|
+
{ name: "Import/Export Templates", included: true },
|
|
261
|
+
{ name: "Template Versioning", included: true },
|
|
262
|
+
{ name: "Advanced Analytics & Tracking", included: true },
|
|
263
|
+
{ name: "SendGrid & Mailgun APIs", included: true }
|
|
264
|
+
],
|
|
265
|
+
limits: {
|
|
266
|
+
templates: "500",
|
|
267
|
+
accounts: "Unlimited",
|
|
268
|
+
rules: "Unlimited"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
];
|
|
272
|
+
const handleUpgrade = (tierId) => {
|
|
273
|
+
window.open("https://store.magicdx.dev/", "_blank");
|
|
274
|
+
};
|
|
275
|
+
if (loading) {
|
|
276
|
+
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsx(Typography, { children: "Loading license information..." }) }) });
|
|
277
|
+
}
|
|
278
|
+
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
279
|
+
/* @__PURE__ */ jsxs(Header, { children: [
|
|
280
|
+
/* @__PURE__ */ jsx(Title, { variant: "alpha", children: "Choose Your Plan" }),
|
|
281
|
+
/* @__PURE__ */ jsx(Subtitle, { variant: "omega", children: "Unlock powerful email management features for your Strapi application" })
|
|
282
|
+
] }),
|
|
283
|
+
/* @__PURE__ */ jsx(TierGrid, { children: tiers.map((tier) => /* @__PURE__ */ jsx(TierWrapper, { children: /* @__PURE__ */ jsxs(TierCard, { $featured: tier.featured, children: [
|
|
284
|
+
tier.featured && /* @__PURE__ */ jsx(PopularBadge, { children: "MOST POPULAR" }),
|
|
285
|
+
/* @__PURE__ */ jsx(TierIcon, { $color: tier.color, children: tier.icon }),
|
|
286
|
+
/* @__PURE__ */ jsx(TierName, { variant: "beta", children: tier.name }),
|
|
287
|
+
/* @__PURE__ */ jsxs(Flex, { alignItems: "baseline", gap: 1, children: [
|
|
288
|
+
/* @__PURE__ */ jsx(TierPrice, { variant: "alpha", children: tier.price }),
|
|
289
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", style: { color: "#6B7280" }, children: tier.period })
|
|
290
|
+
] }),
|
|
291
|
+
/* @__PURE__ */ jsx(TierDescription, { variant: "omega", children: tier.description }),
|
|
292
|
+
/* @__PURE__ */ jsx(Box, { style: {
|
|
293
|
+
background: "#F9FAFB",
|
|
294
|
+
borderRadius: "8px",
|
|
295
|
+
padding: "12px",
|
|
296
|
+
marginBottom: "20px"
|
|
297
|
+
}, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
|
|
298
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "pi", style: { fontSize: "13px" }, children: [
|
|
299
|
+
/* @__PURE__ */ jsx("strong", { children: "Templates:" }),
|
|
300
|
+
" ",
|
|
301
|
+
tier.limits.templates
|
|
302
|
+
] }),
|
|
303
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "pi", style: { fontSize: "13px" }, children: [
|
|
304
|
+
/* @__PURE__ */ jsx("strong", { children: "Accounts:" }),
|
|
305
|
+
" ",
|
|
306
|
+
tier.limits.accounts
|
|
307
|
+
] }),
|
|
308
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "pi", style: { fontSize: "13px" }, children: [
|
|
309
|
+
/* @__PURE__ */ jsx("strong", { children: "Routing Rules:" }),
|
|
310
|
+
" ",
|
|
311
|
+
tier.limits.rules
|
|
312
|
+
] })
|
|
313
|
+
] }) }),
|
|
314
|
+
/* @__PURE__ */ jsx(FeatureList, { children: tier.features.map((feature, index) => /* @__PURE__ */ jsxs(Feature, { children: [
|
|
315
|
+
/* @__PURE__ */ jsx(FeatureIcon, { $included: feature.included, children: feature.included ? /* @__PURE__ */ jsx(Check, { style: { width: 14, height: 14 } }) : /* @__PURE__ */ jsx(Cross, { style: { width: 14, height: 14 } }) }),
|
|
316
|
+
/* @__PURE__ */ jsx(
|
|
317
|
+
Typography,
|
|
318
|
+
{
|
|
319
|
+
variant: "omega",
|
|
320
|
+
style: {
|
|
321
|
+
fontSize: "14px",
|
|
322
|
+
color: feature.included ? "#374151" : "#9CA3AF",
|
|
323
|
+
textDecoration: feature.included ? "none" : "line-through"
|
|
324
|
+
},
|
|
325
|
+
children: feature.name
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
] }, index)) }),
|
|
329
|
+
currentTier === tier.id ? /* @__PURE__ */ jsx(CurrentPlanBadge, { children: "Current Plan" }) : /* @__PURE__ */ jsx(
|
|
330
|
+
UpgradeButton,
|
|
331
|
+
{
|
|
332
|
+
$gradient: tier.color,
|
|
333
|
+
onClick: () => handleUpgrade(tier.id),
|
|
334
|
+
children: getButtonText(tier.id)
|
|
335
|
+
}
|
|
336
|
+
)
|
|
337
|
+
] }) }, tier.id)) })
|
|
338
|
+
] });
|
|
339
|
+
};
|
|
340
|
+
export {
|
|
341
|
+
LicensePage as default
|
|
342
|
+
};
|
|
@@ -0,0 +1,344 @@
|
|
|
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 styled = require("styled-components");
|
|
7
|
+
const designSystem = require("@strapi/design-system");
|
|
8
|
+
const icons = require("@strapi/icons");
|
|
9
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
|
+
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
11
|
+
const Container = styled__default.default(designSystem.Box)`
|
|
12
|
+
padding: 32px;
|
|
13
|
+
max-width: 1400px;
|
|
14
|
+
margin: 0 auto;
|
|
15
|
+
`;
|
|
16
|
+
const Header = styled__default.default(designSystem.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(designSystem.Typography)`
|
|
25
|
+
font-size: 2.5rem;
|
|
26
|
+
font-weight: 700;
|
|
27
|
+
margin-bottom: 8px;
|
|
28
|
+
background: linear-gradient(135deg, #0EA5E9, #A855F7);
|
|
29
|
+
-webkit-background-clip: text;
|
|
30
|
+
-webkit-text-fill-color: transparent;
|
|
31
|
+
display: block;
|
|
32
|
+
`;
|
|
33
|
+
const Subtitle = styled__default.default(designSystem.Typography)`
|
|
34
|
+
font-size: 1.125rem;
|
|
35
|
+
color: #6B7280;
|
|
36
|
+
line-height: 1.6;
|
|
37
|
+
display: block;
|
|
38
|
+
`;
|
|
39
|
+
const TierGrid = styled__default.default(designSystem.Flex)`
|
|
40
|
+
gap: 32px;
|
|
41
|
+
margin: 0 auto 48px;
|
|
42
|
+
max-width: 1080px;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
flex-wrap: wrap;
|
|
45
|
+
`;
|
|
46
|
+
const TierWrapper = styled__default.default(designSystem.Box)`
|
|
47
|
+
flex: 1;
|
|
48
|
+
min-width: 280px;
|
|
49
|
+
max-width: 340px;
|
|
50
|
+
`;
|
|
51
|
+
const TierCard = styled__default.default(designSystem.Box)`
|
|
52
|
+
background: white;
|
|
53
|
+
border-radius: 16px;
|
|
54
|
+
padding: 32px;
|
|
55
|
+
border: 2px solid ${(props) => props.$featured ? "#0EA5E9" : "#E5E7EB"};
|
|
56
|
+
position: relative;
|
|
57
|
+
transition: all 0.3s ease;
|
|
58
|
+
box-shadow: ${(props) => props.$featured ? "0 20px 25px -5px rgba(14, 165, 233, 0.25), 0 8px 10px -6px rgba(14, 165, 233, 0.2)" : "0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05)"};
|
|
59
|
+
|
|
60
|
+
&:hover {
|
|
61
|
+
transform: translateY(-4px);
|
|
62
|
+
box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
const PopularBadge = styled__default.default(designSystem.Badge)`
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: -12px;
|
|
68
|
+
right: 24px;
|
|
69
|
+
background: linear-gradient(135deg, #0EA5E9, #0284C7);
|
|
70
|
+
color: white;
|
|
71
|
+
padding: 4px 16px;
|
|
72
|
+
font-size: 12px;
|
|
73
|
+
font-weight: 600;
|
|
74
|
+
`;
|
|
75
|
+
const TierIcon = styled__default.default(designSystem.Box)`
|
|
76
|
+
width: 48px;
|
|
77
|
+
height: 48px;
|
|
78
|
+
border-radius: 12px;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
margin-bottom: 16px;
|
|
83
|
+
background: ${(props) => props.$color};
|
|
84
|
+
|
|
85
|
+
svg {
|
|
86
|
+
width: 28px;
|
|
87
|
+
height: 28px;
|
|
88
|
+
color: white;
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
const TierName = styled__default.default(designSystem.Typography)`
|
|
92
|
+
font-size: 1.5rem;
|
|
93
|
+
font-weight: 700;
|
|
94
|
+
margin-bottom: 8px;
|
|
95
|
+
`;
|
|
96
|
+
const TierPrice = styled__default.default(designSystem.Typography)`
|
|
97
|
+
font-size: 2rem;
|
|
98
|
+
font-weight: 800;
|
|
99
|
+
margin-bottom: 4px;
|
|
100
|
+
`;
|
|
101
|
+
const TierDescription = styled__default.default(designSystem.Typography)`
|
|
102
|
+
color: #6B7280;
|
|
103
|
+
margin-bottom: 24px;
|
|
104
|
+
`;
|
|
105
|
+
const FeatureList = styled__default.default(designSystem.Box)`
|
|
106
|
+
margin-bottom: 24px;
|
|
107
|
+
`;
|
|
108
|
+
const Feature = styled__default.default(designSystem.Flex)`
|
|
109
|
+
gap: 12px;
|
|
110
|
+
margin-bottom: 12px;
|
|
111
|
+
align-items: flex-start;
|
|
112
|
+
`;
|
|
113
|
+
const FeatureIcon = styled__default.default(designSystem.Box)`
|
|
114
|
+
width: 20px;
|
|
115
|
+
height: 20px;
|
|
116
|
+
border-radius: 50%;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
flex-shrink: 0;
|
|
121
|
+
margin-top: 2px;
|
|
122
|
+
|
|
123
|
+
${(props) => props.$included ? `
|
|
124
|
+
background: #DCFCE7;
|
|
125
|
+
svg { color: #16A34A; }
|
|
126
|
+
` : `
|
|
127
|
+
background: #FEE2E2;
|
|
128
|
+
svg { color: #DC2626; }
|
|
129
|
+
`}
|
|
130
|
+
`;
|
|
131
|
+
const UpgradeButton = styled__default.default(designSystem.Button)`
|
|
132
|
+
width: 100%;
|
|
133
|
+
height: 48px;
|
|
134
|
+
font-weight: 600;
|
|
135
|
+
font-size: 15px;
|
|
136
|
+
background: ${(props) => props.$gradient};
|
|
137
|
+
border: none;
|
|
138
|
+
color: white;
|
|
139
|
+
|
|
140
|
+
&:hover {
|
|
141
|
+
transform: translateY(-2px);
|
|
142
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
const CurrentPlanBadge = styled__default.default(designSystem.Badge)`
|
|
146
|
+
width: 100%;
|
|
147
|
+
height: 48px;
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
justify-content: center;
|
|
151
|
+
background: #F3F4F6;
|
|
152
|
+
color: #6B7280;
|
|
153
|
+
font-weight: 600;
|
|
154
|
+
font-size: 15px;
|
|
155
|
+
`;
|
|
156
|
+
const LicensePage = () => {
|
|
157
|
+
const { get, post } = admin.useFetchClient();
|
|
158
|
+
const { toggleNotification } = admin.useNotification();
|
|
159
|
+
const [currentTier, setCurrentTier] = React.useState("free");
|
|
160
|
+
const [limits, setLimits] = React.useState(null);
|
|
161
|
+
const [loading, setLoading] = React.useState(true);
|
|
162
|
+
React.useEffect(() => {
|
|
163
|
+
fetchLicenseInfo();
|
|
164
|
+
}, []);
|
|
165
|
+
const fetchLicenseInfo = async () => {
|
|
166
|
+
try {
|
|
167
|
+
const response = await get("/magic-mail/license/limits");
|
|
168
|
+
const licenseData = response.data || {};
|
|
169
|
+
let tier = "free";
|
|
170
|
+
if (licenseData.tier) {
|
|
171
|
+
tier = licenseData.tier;
|
|
172
|
+
}
|
|
173
|
+
setCurrentTier(tier);
|
|
174
|
+
setLimits(licenseData.limits);
|
|
175
|
+
setLoading(false);
|
|
176
|
+
} catch (error) {
|
|
177
|
+
console.error("Failed to fetch license info:", error);
|
|
178
|
+
setLoading(false);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const getTierRank = (tierId) => {
|
|
182
|
+
const ranks = {
|
|
183
|
+
"free": 0,
|
|
184
|
+
"premium": 1,
|
|
185
|
+
"advanced": 2,
|
|
186
|
+
"enterprise": 3
|
|
187
|
+
};
|
|
188
|
+
return ranks[tierId] || 0;
|
|
189
|
+
};
|
|
190
|
+
const getButtonText = (tierId) => {
|
|
191
|
+
const currentRank = getTierRank(currentTier);
|
|
192
|
+
const targetRank = getTierRank(tierId);
|
|
193
|
+
if (currentRank === targetRank) {
|
|
194
|
+
return "Current Plan";
|
|
195
|
+
} else if (targetRank > currentRank) {
|
|
196
|
+
return "Upgrade Now";
|
|
197
|
+
} else {
|
|
198
|
+
return "Downgrade";
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
const tiers = [
|
|
202
|
+
{
|
|
203
|
+
id: "free",
|
|
204
|
+
name: "FREE",
|
|
205
|
+
price: "$0",
|
|
206
|
+
period: "forever",
|
|
207
|
+
description: "Perfect for small projects and testing",
|
|
208
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Sparkle, {}),
|
|
209
|
+
color: "linear-gradient(135deg, #6B7280, #4B5563)",
|
|
210
|
+
features: [
|
|
211
|
+
{ name: "25 Email Templates", included: true },
|
|
212
|
+
{ name: "3 Email Accounts", included: true },
|
|
213
|
+
{ name: "5 Routing Rules", included: true },
|
|
214
|
+
{ name: "All OAuth Providers", included: true },
|
|
215
|
+
{ name: "Import/Export Templates", included: true },
|
|
216
|
+
{ name: "Template Versioning", included: false },
|
|
217
|
+
{ name: "Analytics Dashboard", included: false },
|
|
218
|
+
{ name: "Priority Support", included: false }
|
|
219
|
+
],
|
|
220
|
+
limits: {
|
|
221
|
+
templates: "25",
|
|
222
|
+
accounts: "3",
|
|
223
|
+
rules: "5"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: "premium",
|
|
228
|
+
name: "PREMIUM",
|
|
229
|
+
price: "$14.50",
|
|
230
|
+
period: "/month",
|
|
231
|
+
description: "Enhanced features for growing teams",
|
|
232
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Lightning, {}),
|
|
233
|
+
color: "linear-gradient(135deg, #8B5CF6, #7C3AED)",
|
|
234
|
+
featured: true,
|
|
235
|
+
features: [
|
|
236
|
+
{ name: "100 Email Templates", included: true },
|
|
237
|
+
{ name: "10 Email Accounts", included: true },
|
|
238
|
+
{ name: "20 Routing Rules", included: true },
|
|
239
|
+
{ name: "All OAuth Providers", included: true },
|
|
240
|
+
{ name: "Import/Export Templates", included: true },
|
|
241
|
+
{ name: "Template Versioning", included: true },
|
|
242
|
+
{ name: "Basic Analytics", included: true },
|
|
243
|
+
{ name: "Priority Support", included: true }
|
|
244
|
+
],
|
|
245
|
+
limits: {
|
|
246
|
+
templates: "100",
|
|
247
|
+
accounts: "10",
|
|
248
|
+
rules: "20"
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: "advanced",
|
|
253
|
+
name: "ADVANCED",
|
|
254
|
+
price: "$39.50",
|
|
255
|
+
period: "/month",
|
|
256
|
+
description: "Maximum features for power users",
|
|
257
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Rocket, {}),
|
|
258
|
+
color: "linear-gradient(135deg, #0EA5E9, #0284C7)",
|
|
259
|
+
features: [
|
|
260
|
+
{ name: "500 Email Templates", included: true },
|
|
261
|
+
{ name: "Unlimited Accounts", included: true },
|
|
262
|
+
{ name: "Unlimited Routing Rules", included: true },
|
|
263
|
+
{ name: "All OAuth Providers", included: true },
|
|
264
|
+
{ name: "Import/Export Templates", included: true },
|
|
265
|
+
{ name: "Template Versioning", included: true },
|
|
266
|
+
{ name: "Advanced Analytics & Tracking", included: true },
|
|
267
|
+
{ name: "SendGrid & Mailgun APIs", included: true }
|
|
268
|
+
],
|
|
269
|
+
limits: {
|
|
270
|
+
templates: "500",
|
|
271
|
+
accounts: "Unlimited",
|
|
272
|
+
rules: "Unlimited"
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
];
|
|
276
|
+
const handleUpgrade = (tierId) => {
|
|
277
|
+
window.open("https://store.magicdx.dev/", "_blank");
|
|
278
|
+
};
|
|
279
|
+
if (loading) {
|
|
280
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: "Loading license information..." }) }) });
|
|
281
|
+
}
|
|
282
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Container, { children: [
|
|
283
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Header, { children: [
|
|
284
|
+
/* @__PURE__ */ jsxRuntime.jsx(Title, { variant: "alpha", children: "Choose Your Plan" }),
|
|
285
|
+
/* @__PURE__ */ jsxRuntime.jsx(Subtitle, { variant: "omega", children: "Unlock powerful email management features for your Strapi application" })
|
|
286
|
+
] }),
|
|
287
|
+
/* @__PURE__ */ jsxRuntime.jsx(TierGrid, { children: tiers.map((tier) => /* @__PURE__ */ jsxRuntime.jsx(TierWrapper, { children: /* @__PURE__ */ jsxRuntime.jsxs(TierCard, { $featured: tier.featured, children: [
|
|
288
|
+
tier.featured && /* @__PURE__ */ jsxRuntime.jsx(PopularBadge, { children: "MOST POPULAR" }),
|
|
289
|
+
/* @__PURE__ */ jsxRuntime.jsx(TierIcon, { $color: tier.color, children: tier.icon }),
|
|
290
|
+
/* @__PURE__ */ jsxRuntime.jsx(TierName, { variant: "beta", children: tier.name }),
|
|
291
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "baseline", gap: 1, children: [
|
|
292
|
+
/* @__PURE__ */ jsxRuntime.jsx(TierPrice, { variant: "alpha", children: tier.price }),
|
|
293
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", style: { color: "#6B7280" }, children: tier.period })
|
|
294
|
+
] }),
|
|
295
|
+
/* @__PURE__ */ jsxRuntime.jsx(TierDescription, { variant: "omega", children: tier.description }),
|
|
296
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: {
|
|
297
|
+
background: "#F9FAFB",
|
|
298
|
+
borderRadius: "8px",
|
|
299
|
+
padding: "12px",
|
|
300
|
+
marginBottom: "20px"
|
|
301
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
|
302
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { fontSize: "13px" }, children: [
|
|
303
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Templates:" }),
|
|
304
|
+
" ",
|
|
305
|
+
tier.limits.templates
|
|
306
|
+
] }),
|
|
307
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { fontSize: "13px" }, children: [
|
|
308
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Accounts:" }),
|
|
309
|
+
" ",
|
|
310
|
+
tier.limits.accounts
|
|
311
|
+
] }),
|
|
312
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { fontSize: "13px" }, children: [
|
|
313
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Routing Rules:" }),
|
|
314
|
+
" ",
|
|
315
|
+
tier.limits.rules
|
|
316
|
+
] })
|
|
317
|
+
] }) }),
|
|
318
|
+
/* @__PURE__ */ jsxRuntime.jsx(FeatureList, { children: tier.features.map((feature, index) => /* @__PURE__ */ jsxRuntime.jsxs(Feature, { children: [
|
|
319
|
+
/* @__PURE__ */ jsxRuntime.jsx(FeatureIcon, { $included: feature.included, children: feature.included ? /* @__PURE__ */ jsxRuntime.jsx(icons.Check, { style: { width: 14, height: 14 } }) : /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, { style: { width: 14, height: 14 } }) }),
|
|
320
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
321
|
+
designSystem.Typography,
|
|
322
|
+
{
|
|
323
|
+
variant: "omega",
|
|
324
|
+
style: {
|
|
325
|
+
fontSize: "14px",
|
|
326
|
+
color: feature.included ? "#374151" : "#9CA3AF",
|
|
327
|
+
textDecoration: feature.included ? "none" : "line-through"
|
|
328
|
+
},
|
|
329
|
+
children: feature.name
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
] }, index)) }),
|
|
333
|
+
currentTier === tier.id ? /* @__PURE__ */ jsxRuntime.jsx(CurrentPlanBadge, { children: "Current Plan" }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
334
|
+
UpgradeButton,
|
|
335
|
+
{
|
|
336
|
+
$gradient: tier.color,
|
|
337
|
+
onClick: () => handleUpgrade(tier.id),
|
|
338
|
+
children: getButtonText(tier.id)
|
|
339
|
+
}
|
|
340
|
+
)
|
|
341
|
+
] }) }, tier.id)) })
|
|
342
|
+
] });
|
|
343
|
+
};
|
|
344
|
+
exports.default = LicensePage;
|