strapi-plugin-magic-mail 2.10.11 → 3.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 (27) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +21 -10
  3. package/dist/{_chunks/App-CInlcJMb.js → admin/App-BhDvUsMa.js} +97 -789
  4. package/dist/{_chunks/App-D4bFKNcg.mjs → admin/App-CjlxXCZb.mjs} +109 -801
  5. package/dist/{_chunks/PluginSettings-cZXE_vy8.js → admin/PluginSettings-Css2nHrB.js} +10 -4
  6. package/dist/{_chunks/PluginSettings-XwyzH95_.mjs → admin/PluginSettings-Duc_Y571.mjs} +10 -4
  7. package/dist/{_chunks/StyledButtons-CdOf4Sps.mjs → admin/StyledButtons-aq1EWrQ-.mjs} +1 -2
  8. package/dist/{_chunks/StyledButtons-DVGuFoqy.js → admin/StyledButtons-jHF7TXal.js} +1 -2
  9. package/dist/{_chunks/de-CF2ItE3Z.js → admin/de-DKEFnBGC.js} +0 -21
  10. package/dist/{_chunks/de-CwbYw2jT.mjs → admin/de-SKsLY2de.mjs} +0 -21
  11. package/dist/{_chunks/en-CK6UpShS.js → admin/en-CvtZE1HH.js} +0 -21
  12. package/dist/{_chunks/en-ZRmfU4qX.mjs → admin/en-Ds2Q7fue.mjs} +0 -21
  13. package/dist/{_chunks/es-DQHwzPpP.mjs → admin/es-BEvzLtTg.mjs} +20 -21
  14. package/dist/{_chunks/es-BpV1MIdm.js → admin/es-BbLLes3D.js} +20 -21
  15. package/dist/{_chunks/fr-BG1WfEVm.mjs → admin/fr-CRpwImX6.mjs} +20 -21
  16. package/dist/{_chunks/fr-vpziIpRp.js → admin/fr-nH9uN6s9.js} +20 -21
  17. package/dist/admin/index.js +6 -44
  18. package/dist/admin/index.mjs +4 -43
  19. package/dist/{_chunks/pt-CMoGrOib.mjs → admin/pt-CjOe2N_n.mjs} +20 -21
  20. package/dist/{_chunks/pt-ODpAhDNa.js → admin/pt-qt_48NxL.js} +20 -21
  21. package/dist/server/index.js +8052 -17573
  22. package/dist/server/index.mjs +8079 -17578
  23. package/package.json +40 -27
  24. package/dist/_chunks/LicensePage-B61HnhyD.mjs +0 -352
  25. package/dist/_chunks/LicensePage-sB-xDRL9.js +0 -354
  26. package/dist/_chunks/Settings-BRFoD1yZ.js +0 -354
  27. package/dist/_chunks/Settings-DoSrZKfp.mjs +0 -352
@@ -8,7 +8,7 @@ const admin = require("@strapi/strapi/admin");
8
8
  const outline = require("@heroicons/react/24/outline");
9
9
  const styled = require("styled-components");
10
10
  const icons = require("@strapi/icons");
11
- const StyledButtons = require("./StyledButtons-DVGuFoqy.js");
11
+ const StyledButtons = require("./StyledButtons-jHF7TXal.js");
12
12
  const ReactEmailEditor = require("react-email-editor");
13
13
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
14
14
  function _interopNamespace(e) {
@@ -84,7 +84,7 @@ const theme$3 = {
84
84
  xl: "16px"
85
85
  }
86
86
  };
87
- const fadeIn$6 = styled.keyframes`
87
+ const fadeIn$5 = styled.keyframes`
88
88
  from {
89
89
  opacity: 0;
90
90
  transform: translateY(10px);
@@ -130,7 +130,7 @@ const StepHeader = styled__default.default(designSystem.Box)`
130
130
  padding-bottom: 24px;
131
131
  margin-bottom: 32px;
132
132
  position: relative;
133
- animation: ${fadeIn$6} 0.4s ease;
133
+ animation: ${fadeIn$5} 0.4s ease;
134
134
 
135
135
  &::after {
136
136
  content: '';
@@ -225,7 +225,7 @@ const ProviderCategoryHeader = styled__default.default(designSystem.Box)`
225
225
  align-items: center;
226
226
  gap: 12px;
227
227
  margin: 0 0 16px;
228
- animation: ${fadeIn$6} 0.4s ease;
228
+ animation: ${fadeIn$5} 0.4s ease;
229
229
 
230
230
  &::after {
231
231
  content: '';
@@ -367,7 +367,7 @@ const ProviderTagline = styled__default.default(designSystem.Typography)`
367
367
  const InfoAlert = styled__default.default(designSystem.Alert)`
368
368
  background: ${colors$1.primaryLight};
369
369
  border: 1px solid ${colors$1.primary}33;
370
- animation: ${fadeIn$6} 0.4s ease;
370
+ animation: ${fadeIn$5} 0.4s ease;
371
371
 
372
372
  svg {
373
373
  color: ${colors$1.primary};
@@ -1231,7 +1231,9 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1231
1231
  designSystem.Toggle,
1232
1232
  {
1233
1233
  checked: formData.secure,
1234
- onChange: () => handleChange("secure", !formData.secure)
1234
+ onChange: () => handleChange("secure", !formData.secure),
1235
+ onLabel: "Enabled",
1236
+ offLabel: "Disabled"
1235
1237
  }
1236
1238
  ),
1237
1239
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, style: { flex: 1 }, children: [
@@ -1865,7 +1867,9 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1865
1867
  designSystem.Toggle,
1866
1868
  {
1867
1869
  checked: formData.isActive,
1868
- onChange: () => handleChange("isActive", !formData.isActive)
1870
+ onChange: () => handleChange("isActive", !formData.isActive),
1871
+ onLabel: "Active",
1872
+ offLabel: "Inactive"
1869
1873
  }
1870
1874
  ) }),
1871
1875
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1 }, children: [
@@ -1897,7 +1901,9 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1897
1901
  designSystem.Toggle,
1898
1902
  {
1899
1903
  checked: formData.isPrimary,
1900
- onChange: () => handleChange("isPrimary", !formData.isPrimary)
1904
+ onChange: () => handleChange("isPrimary", !formData.isPrimary),
1905
+ onLabel: "Primary",
1906
+ offLabel: "Off"
1901
1907
  }
1902
1908
  ) }),
1903
1909
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1 }, children: [
@@ -1945,7 +1951,7 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1945
1951
  ] }) })
1946
1952
  ] }) });
1947
1953
  };
1948
- const fadeIn$5 = styled.keyframes`
1954
+ const fadeIn$4 = styled.keyframes`
1949
1955
  from { opacity: 0; transform: translateY(10px); }
1950
1956
  to { opacity: 1; transform: translateY(0); }
1951
1957
  `;
@@ -1973,7 +1979,7 @@ const breakpoints$3 = {
1973
1979
  mobile: "768px"
1974
1980
  };
1975
1981
  const Container$4 = styled__default.default(designSystem.Box)`
1976
- ${styled.css`animation: ${fadeIn$5} ${theme$3.transitions.slow};`}
1982
+ ${styled.css`animation: ${fadeIn$4} ${theme$3.transitions.slow};`}
1977
1983
  min-height: 100vh;
1978
1984
  max-width: 1440px;
1979
1985
  margin: 0 auto;
@@ -2091,7 +2097,7 @@ const StatCard$3 = styled__default.default(designSystem.Box)`
2091
2097
  position: relative;
2092
2098
  overflow: hidden;
2093
2099
  transition: all ${theme$3.transitions.normal};
2094
- ${styled.css`animation: ${fadeIn$5} ${theme$3.transitions.slow} backwards;`}
2100
+ ${styled.css`animation: ${fadeIn$4} ${theme$3.transitions.slow} backwards;`}
2095
2101
  animation-delay: ${(props) => props.$delay || "0s"};
2096
2102
  box-shadow: ${theme$3.shadows.sm};
2097
2103
  border: 1px solid rgba(128, 128, 128, 0.2);
@@ -2979,7 +2985,7 @@ const theme$2 = {
2979
2985
  xl: "16px"
2980
2986
  }
2981
2987
  };
2982
- const fadeIn$4 = styled.keyframes`
2988
+ const fadeIn$3 = styled.keyframes`
2983
2989
  from { opacity: 0; transform: translateY(10px); }
2984
2990
  to { opacity: 1; transform: translateY(0); }
2985
2991
  `;
@@ -3007,7 +3013,7 @@ const breakpoints$2 = {
3007
3013
  mobile: "768px"
3008
3014
  };
3009
3015
  const Container$3 = styled__default.default(designSystem.Box)`
3010
- ${styled.css`animation: ${fadeIn$4} ${theme$2.transitions.slow};`}
3016
+ ${styled.css`animation: ${fadeIn$3} ${theme$2.transitions.slow};`}
3011
3017
  min-height: 100vh;
3012
3018
  max-width: 1440px;
3013
3019
  margin: 0 auto;
@@ -3125,7 +3131,7 @@ const StatCard$2 = styled__default.default(designSystem.Box)`
3125
3131
  position: relative;
3126
3132
  overflow: hidden;
3127
3133
  transition: all ${theme$2.transitions.normal};
3128
- ${styled.css`animation: ${fadeIn$4} ${theme$2.transitions.slow} backwards;`}
3134
+ ${styled.css`animation: ${fadeIn$3} ${theme$2.transitions.slow} backwards;`}
3129
3135
  animation-delay: ${(props) => props.$delay || "0s"};
3130
3136
  box-shadow: ${theme$2.shadows.sm};
3131
3137
  border: 1px solid rgba(128, 128, 128, 0.2);
@@ -3577,13 +3583,13 @@ const RoutingRulesPage = () => {
3577
3583
  /* @__PURE__ */ jsxRuntime.jsx(
3578
3584
  StyledButtons.IconButtonDanger,
3579
3585
  {
3580
- onClick: () => deleteRule(rule.id, rule.name),
3586
+ onClick: () => deleteRule(rule.documentId || rule.id, rule.name),
3581
3587
  "aria-label": "Delete Rule",
3582
3588
  children: /* @__PURE__ */ jsxRuntime.jsx(outline.TrashIcon, {})
3583
3589
  }
3584
3590
  )
3585
3591
  ] }) })
3586
- ] }, rule.id)) })
3592
+ ] }, rule.documentId || rule.id)) })
3587
3593
  ] }) }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 8, style: { textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", textColor: "neutral600", children: "No rules found matching your filters" }) })
3588
3594
  ] }),
3589
3595
  (showModal || editingRule) && /* @__PURE__ */ jsxRuntime.jsx(
@@ -3623,7 +3629,7 @@ const RuleModal = ({ rule, accounts, onClose, onSave }) => {
3623
3629
  setLoading(true);
3624
3630
  try {
3625
3631
  if (isEditMode) {
3626
- await put(`/magic-mail/routing-rules/${rule.id}`, formData);
3632
+ await put(`/magic-mail/routing-rules/${rule.documentId || rule.id}`, formData);
3627
3633
  toggleNotification({
3628
3634
  type: "success",
3629
3635
  message: "Routing rule updated successfully"
@@ -3786,7 +3792,9 @@ const RuleModal = ({ rule, accounts, onClose, onSave }) => {
3786
3792
  designSystem.Toggle,
3787
3793
  {
3788
3794
  checked: formData.whatsappFallback,
3789
- onChange: () => handleChange("whatsappFallback", !formData.whatsappFallback)
3795
+ onChange: () => handleChange("whatsappFallback", !formData.whatsappFallback),
3796
+ onLabel: "Enabled",
3797
+ offLabel: "Disabled"
3790
3798
  }
3791
3799
  ),
3792
3800
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1 }, children: [
@@ -3830,7 +3838,9 @@ const RuleModal = ({ rule, accounts, onClose, onSave }) => {
3830
3838
  designSystem.Toggle,
3831
3839
  {
3832
3840
  checked: formData.isActive,
3833
- onChange: () => handleChange("isActive", !formData.isActive)
3841
+ onChange: () => handleChange("isActive", !formData.isActive),
3842
+ onLabel: "Active",
3843
+ offLabel: "Inactive"
3834
3844
  }
3835
3845
  ),
3836
3846
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1 }, children: [
@@ -3867,124 +3877,6 @@ const RuleModal = ({ rule, accounts, onClose, onSave }) => {
3867
3877
  ] }) })
3868
3878
  ] }) });
3869
3879
  };
3870
- const useLicense = () => {
3871
- const { get } = admin.useFetchClient();
3872
- const [isPremium, setIsPremium] = React.useState(false);
3873
- const [isAdvanced, setIsAdvanced] = React.useState(false);
3874
- const [isEnterprise, setIsEnterprise] = React.useState(false);
3875
- const [loading, setLoading] = React.useState(true);
3876
- const [error, setError] = React.useState(null);
3877
- const [licenseData, setLicenseData] = React.useState(null);
3878
- React.useEffect(() => {
3879
- let mounted = true;
3880
- const fetchLicense = async () => {
3881
- if (mounted) {
3882
- await checkLicense();
3883
- }
3884
- };
3885
- fetchLicense();
3886
- const interval = setInterval(() => {
3887
- if (mounted) {
3888
- checkLicense(true);
3889
- }
3890
- }, 60 * 60 * 1e3);
3891
- return () => {
3892
- mounted = false;
3893
- clearInterval(interval);
3894
- };
3895
- }, []);
3896
- const checkLicense = async (silent = false) => {
3897
- if (!silent) {
3898
- setLoading(true);
3899
- }
3900
- try {
3901
- const response = await get("/magic-mail/license/status");
3902
- const isValid = response.data?.valid || false;
3903
- const hasPremiumFeature = response.data?.data?.features?.premium || false;
3904
- const hasAdvancedFeature = response.data?.data?.features?.advanced || false;
3905
- const hasEnterpriseFeature = response.data?.data?.features?.enterprise || false;
3906
- setIsPremium(isValid && hasPremiumFeature);
3907
- setIsAdvanced(isValid && hasAdvancedFeature);
3908
- setIsEnterprise(isValid && hasEnterpriseFeature);
3909
- setLicenseData(response.data?.data || null);
3910
- setError(null);
3911
- } catch (err) {
3912
- if (err.name === "AbortError") {
3913
- return;
3914
- }
3915
- if (!silent) {
3916
- console.error("[MagicMail] License check error:", err);
3917
- }
3918
- setIsPremium(false);
3919
- setIsAdvanced(false);
3920
- setIsEnterprise(false);
3921
- setLicenseData(null);
3922
- setError(err);
3923
- } finally {
3924
- if (!silent) {
3925
- setLoading(false);
3926
- }
3927
- }
3928
- };
3929
- const hasFeature = (featureName) => {
3930
- if (!featureName) return false;
3931
- const freeFeatures = [
3932
- "basic-smtp",
3933
- "oauth-gmail",
3934
- "oauth-microsoft",
3935
- "oauth-yahoo",
3936
- "basic-routing",
3937
- "email-logging",
3938
- "account-testing",
3939
- "strapi-service-override",
3940
- "email-designer-basic"
3941
- ];
3942
- if (freeFeatures.includes(featureName)) return true;
3943
- const premiumFeatures = [
3944
- "email-designer-templates"
3945
- ];
3946
- if (premiumFeatures.includes(featureName) && isPremium) return true;
3947
- const advancedFeatures = [
3948
- "sendgrid",
3949
- "mailgun",
3950
- "dkim-signing",
3951
- "priority-headers",
3952
- "list-unsubscribe",
3953
- "security-validation",
3954
- "analytics-dashboard",
3955
- "advanced-routing",
3956
- "email-designer-versioning",
3957
- "email-designer-import-export"
3958
- ];
3959
- if (advancedFeatures.includes(featureName) && isAdvanced) return true;
3960
- const enterpriseFeatures = [
3961
- "multi-tenant",
3962
- "compliance-reports",
3963
- "custom-security-rules",
3964
- "priority-support",
3965
- "email-designer-custom-blocks",
3966
- "email-designer-team-library",
3967
- "email-designer-a-b-testing"
3968
- ];
3969
- if (enterpriseFeatures.includes(featureName) && isEnterprise) return true;
3970
- return false;
3971
- };
3972
- return {
3973
- isPremium,
3974
- isAdvanced,
3975
- isEnterprise,
3976
- loading,
3977
- error,
3978
- licenseData,
3979
- features: {
3980
- premium: isPremium,
3981
- advanced: isAdvanced,
3982
- enterprise: isEnterprise
3983
- },
3984
- hasFeature,
3985
- refetch: checkLicense
3986
- };
3987
- };
3988
3880
  const theme$1 = {
3989
3881
  shadows: {
3990
3882
  sm: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",
@@ -3996,7 +3888,7 @@ const theme$1 = {
3996
3888
  spacing: { xs: "4px", sm: "8px", md: "16px", lg: "24px", xl: "32px", "2xl": "48px" },
3997
3889
  borderRadius: { md: "8px", lg: "12px", xl: "16px" }
3998
3890
  };
3999
- const fadeIn$3 = styled.keyframes`
3891
+ const fadeIn$2 = styled.keyframes`
4000
3892
  from { opacity: 0; transform: translateY(10px); }
4001
3893
  to { opacity: 1; transform: translateY(0); }
4002
3894
  `;
@@ -4150,7 +4042,7 @@ const CopyButton = styled__default.default(designSystem.Button)`
4150
4042
  height: 14px;
4151
4043
  }
4152
4044
  `;
4153
- const InfoBox$2 = styled__default.default(designSystem.Box)`
4045
+ const InfoBox$1 = styled__default.default(designSystem.Box)`
4154
4046
  background: linear-gradient(135deg, ${"rgba(2, 132, 199, 0.06)"}, ${"rgba(2, 132, 199, 0.12)"});
4155
4047
  border-left: 4px solid ${"var(--colors-primary600, #0EA5E9)"};
4156
4048
  border-radius: 8px;
@@ -4167,37 +4059,12 @@ const WarningBox = styled__default.default(designSystem.Box)`
4167
4059
  align-items: center;
4168
4060
  gap: 8px;
4169
4061
  `;
4170
- const LimitWarning = styled__default.default(designSystem.Box)`
4171
- background: linear-gradient(135deg, ${"rgba(234, 179, 8, 0.06)"}, rgba(251, 191, 36, 0.1));
4172
- border: 1px solid rgba(234, 179, 8, 0.2);
4173
- border-radius: 12px;
4174
- padding: 16px;
4175
- margin-bottom: 24px;
4176
- display: flex;
4177
- align-items: center;
4178
- justify-content: space-between;
4179
- `;
4180
- const UpgradeButton = styled__default.default(designSystem.Button)`
4181
- background: linear-gradient(135deg, ${"var(--colors-warning600, #F59E0B)"}, ${"var(--colors-warning600, #D97706)"});
4182
- color: white;
4183
- font-weight: 600;
4184
- padding: 8px 16px;
4185
- font-size: 13px;
4186
- display: inline-flex;
4187
- align-items: center;
4188
- gap: 6px;
4189
-
4190
- &:hover {
4191
- background: linear-gradient(135deg, ${"var(--colors-warning600, #D97706)"}, ${"var(--colors-warning600, #A16207)"});
4192
- transform: translateY(-1px);
4193
- }
4194
- `;
4195
4062
  const breakpoints$1 = {
4196
4063
  mobile: "768px",
4197
4064
  tablet: "1024px"
4198
4065
  };
4199
4066
  const Container$2 = styled__default.default(designSystem.Box)`
4200
- ${styled.css`animation: ${fadeIn$3} ${theme$1.transitions.slow};`}
4067
+ ${styled.css`animation: ${fadeIn$2} ${theme$1.transitions.slow};`}
4201
4068
  min-height: 100vh;
4202
4069
  max-width: 1440px;
4203
4070
  margin: 0 auto;
@@ -4310,7 +4177,7 @@ const StatCard$1 = styled__default.default(designSystem.Box)`
4310
4177
  position: relative;
4311
4178
  overflow: hidden;
4312
4179
  transition: all ${theme$1.transitions.normal};
4313
- ${styled.css`animation: ${fadeIn$3} ${theme$1.transitions.slow} backwards;`}
4180
+ ${styled.css`animation: ${fadeIn$2} ${theme$1.transitions.slow} backwards;`}
4314
4181
  animation-delay: ${(props) => props.$delay || "0s"};
4315
4182
  box-shadow: ${theme$1.shadows.sm};
4316
4183
  border: 1px solid rgba(128, 128, 128, 0.2);
@@ -4505,9 +4372,9 @@ const PaginationWrapper = styled__default.default(designSystem.Flex)`
4505
4372
  border-radius: 0 0 ${theme$1.borderRadius.lg} ${theme$1.borderRadius.lg};
4506
4373
  `;
4507
4374
  const PaginationButton = styled__default.default.button`
4508
- background: ${(props) => props.active ? "linear-gradient(135deg, var(--colors-primary600, #0EA5E9) 0%, var(--colors-secondary500, #A855F7) 100%)" : "${(p) => p.theme.colors.neutral0}"};
4509
- color: ${(props) => props.active ? "white" : "var(--colors-neutral700)"};
4510
- border: 1px solid ${(props) => props.active ? "transparent" : "rgba(128, 128, 128, 0.3)"};
4375
+ background: ${(props) => props.$active ? "linear-gradient(135deg, var(--colors-primary600, #0EA5E9) 0%, var(--colors-secondary500, #A855F7) 100%)" : props.theme.colors.neutral0};
4376
+ color: ${(props) => props.$active ? "white" : "var(--colors-neutral700)"};
4377
+ border: 1px solid ${(props) => props.$active ? "transparent" : "rgba(128, 128, 128, 0.3)"};
4511
4378
  padding: 6px 12px;
4512
4379
  min-width: 36px;
4513
4380
  height: 36px;
@@ -4518,8 +4385,8 @@ const PaginationButton = styled__default.default.button`
4518
4385
  transition: all 0.2s ease;
4519
4386
 
4520
4387
  &:hover:not(:disabled) {
4521
- background: ${(props) => props.active ? "linear-gradient(135deg, var(--colors-primary700, #0284C7) 0%, var(--colors-secondary600, #9333EA) 100%)" : "var(--colors-neutral100)"};
4522
- border-color: ${(props) => props.active ? "transparent" : "rgba(128, 128, 128, 0.4)"};
4388
+ background: ${(props) => props.$active ? "linear-gradient(135deg, var(--colors-primary700, #0284C7) 0%, var(--colors-secondary600, #9333EA) 100%)" : "var(--colors-neutral100)"};
4389
+ border-color: ${(props) => props.$active ? "transparent" : "rgba(128, 128, 128, 0.4)"};
4523
4390
  }
4524
4391
 
4525
4392
  &:disabled {
@@ -4739,7 +4606,6 @@ const TemplateList = () => {
4739
4606
  const { get, del, post } = admin.useFetchClient();
4740
4607
  const { toggleNotification } = admin.useNotification();
4741
4608
  const navigate = reactRouterDom.useNavigate();
4742
- useLicense();
4743
4609
  useAuthRefresh();
4744
4610
  const [templates, setTemplates] = React.useState([]);
4745
4611
  const [stats, setStats] = React.useState(null);
@@ -4749,7 +4615,6 @@ const TemplateList = () => {
4749
4615
  const [showCodeExample, setShowCodeExample] = React.useState(false);
4750
4616
  const [selectedTemplate, setSelectedTemplate] = React.useState(null);
4751
4617
  const [copiedCode, setCopiedCode] = React.useState(null);
4752
- const [limits, setLimits] = React.useState(null);
4753
4618
  const [showTestSendModal, setShowTestSendModal] = React.useState(false);
4754
4619
  const [testEmail, setTestEmail] = React.useState("");
4755
4620
  const [currentPage, setCurrentPage] = React.useState(1);
@@ -4771,7 +4636,6 @@ const TemplateList = () => {
4771
4636
  ];
4772
4637
  React.useEffect(() => {
4773
4638
  fetchData();
4774
- fetchLimits();
4775
4639
  fetchAccounts();
4776
4640
  }, []);
4777
4641
  const fetchData = async () => {
@@ -4789,24 +4653,6 @@ const TemplateList = () => {
4789
4653
  setLoading(false);
4790
4654
  }
4791
4655
  };
4792
- const fetchLimits = async () => {
4793
- try {
4794
- const response = await get("/magic-mail/license/limits");
4795
- console.log("[DEBUG] License limits response:", response.data);
4796
- try {
4797
- const debugResponse = await get("/magic-mail/license/debug");
4798
- console.log("[DEBUG] License debug data:", debugResponse.data);
4799
- } catch (debugError) {
4800
- console.error("[DEBUG] Failed to fetch debug data:", debugError);
4801
- }
4802
- setLimits({
4803
- ...response.data?.limits,
4804
- tier: response.data?.tier || "free"
4805
- });
4806
- } catch (error) {
4807
- console.error("Failed to fetch license limits:", error);
4808
- }
4809
- };
4810
4656
  const fetchAccounts = async () => {
4811
4657
  try {
4812
4658
  const response = await get("/magic-mail/accounts");
@@ -4850,38 +4696,6 @@ const TemplateList = () => {
4850
4696
  });
4851
4697
  }
4852
4698
  };
4853
- const getTierInfo = () => {
4854
- const tier = limits?.tier || "free";
4855
- const tierInfo = {
4856
- free: {
4857
- name: "FREE",
4858
- color: "neutral",
4859
- next: "PREMIUM",
4860
- nextTemplates: 50,
4861
- features: ["10 Templates", "1 Account", "Import/Export"]
4862
- },
4863
- premium: {
4864
- name: "PREMIUM",
4865
- color: "secondary",
4866
- next: "ADVANCED",
4867
- nextTemplates: 200,
4868
- features: ["50 Templates", "5 Accounts", "Versioning", "Basic Analytics"]
4869
- },
4870
- advanced: {
4871
- name: "ADVANCED",
4872
- color: "primary",
4873
- next: "ENTERPRISE",
4874
- nextTemplates: -1,
4875
- features: ["200 Templates", "Unlimited Accounts", "Advanced Analytics", "API Integrations"]
4876
- },
4877
- enterprise: {
4878
- name: "ENTERPRISE",
4879
- color: "warning",
4880
- features: ["Unlimited Everything", "Priority Support", "Custom Features", "SLA"]
4881
- }
4882
- };
4883
- return tierInfo[tier] || tierInfo.free;
4884
- };
4885
4699
  const fetchTemplates = async () => {
4886
4700
  try {
4887
4701
  const response = await get("/magic-mail/designer/templates");
@@ -4966,23 +4780,6 @@ const TemplateList = () => {
4966
4780
  setTimeout(() => setCopiedCode(null), 2e3);
4967
4781
  };
4968
4782
  const handleCreateTemplate = () => {
4969
- if (limits?.emailTemplates && !limits.emailTemplates.canCreate) {
4970
- const max = limits.emailTemplates.max;
4971
- let upgradeMessage = "";
4972
- if (max === 10) {
4973
- upgradeMessage = `You've reached the FREE tier limit of ${max} templates. Upgrade to PREMIUM for 50 templates, versioning, and more!`;
4974
- } else if (max === 50) {
4975
- upgradeMessage = `You've reached the PREMIUM tier limit of ${max} templates. Upgrade to ADVANCED for 200 templates and advanced features!`;
4976
- } else if (max === 200) {
4977
- upgradeMessage = `You've reached the ADVANCED tier limit of ${max} templates. Upgrade to ENTERPRISE for unlimited templates!`;
4978
- }
4979
- toggleNotification({
4980
- type: "warning",
4981
- title: "🚀 Time to Upgrade!",
4982
- message: upgradeMessage
4983
- });
4984
- return;
4985
- }
4986
4783
  navigate("/plugins/magic-mail/designer/new");
4987
4784
  };
4988
4785
  const handleExport = async () => {
@@ -5000,7 +4797,7 @@ const TemplateList = () => {
5000
4797
  } catch (error) {
5001
4798
  toggleNotification({
5002
4799
  type: "danger",
5003
- message: error.response?.data?.message || "Export failed"
4800
+ message: error.response?.data?.error?.message || error.response?.data?.message || "Export failed"
5004
4801
  });
5005
4802
  }
5006
4803
  };
@@ -5023,7 +4820,10 @@ const TemplateList = () => {
5023
4820
  fetchTemplates();
5024
4821
  fetchStats();
5025
4822
  } catch (error) {
5026
- toggleNotification({ type: "danger", message: "Import failed" });
4823
+ toggleNotification({
4824
+ type: "danger",
4825
+ message: error.response?.data?.error?.message || error.response?.data?.message || "Import failed"
4826
+ });
5027
4827
  }
5028
4828
  };
5029
4829
  const getCategoryBadge = (category) => {
@@ -5052,31 +4852,12 @@ const TemplateList = () => {
5052
4852
  /* @__PURE__ */ jsxRuntime.jsx(outline.DocumentTextIcon, {}),
5053
4853
  "Email Templates"
5054
4854
  ] }) }),
5055
- stats && limits && /* @__PURE__ */ jsxRuntime.jsx(Subtitle$1, { variant: "epsilon", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: "8px" }, children: [
5056
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
5057
- stats.total,
5058
- " template",
5059
- stats.total !== 1 ? "s" : "",
5060
- " created"
5061
- ] }),
5062
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { opacity: 0.8 }, children: "•" }),
5063
- !limits.emailTemplates.unlimited ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: {
5064
- background: "rgba(255, 255, 255, 0.2)",
5065
- padding: "2px 10px",
5066
- borderRadius: "12px",
5067
- fontWeight: "600"
5068
- }, children: [
5069
- limits.emailTemplates.max - limits.emailTemplates.current,
5070
- " of ",
5071
- limits.emailTemplates.max,
5072
- " slots remaining"
5073
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
5074
- background: "rgba(255, 255, 255, 0.2)",
5075
- padding: "2px 10px",
5076
- borderRadius: "12px",
5077
- fontWeight: "600"
5078
- }, children: "Unlimited templates" })
5079
- ] }) })
4855
+ stats && /* @__PURE__ */ jsxRuntime.jsx(Subtitle$1, { variant: "epsilon", children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline-flex", alignItems: "center", gap: "8px" }, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4856
+ stats.total,
4857
+ " template",
4858
+ stats.total !== 1 ? "s" : "",
4859
+ " created"
4860
+ ] }) }) })
5080
4861
  ] }) }) }),
5081
4862
  /* @__PURE__ */ jsxRuntime.jsxs(StatsGrid$1, { children: [
5082
4863
  /* @__PURE__ */ jsxRuntime.jsxs(StatCard$1, { $delay: "0.1s", $color: "var(--colors-primary600, #0EA5E9)", children: [
@@ -5088,40 +4869,9 @@ const TemplateList = () => {
5088
4869
  /* @__PURE__ */ jsxRuntime.jsx(StatIcon$1, { className: "stat-icon", $bg: "rgba(22, 163, 74, 0.12)", $color: "var(--colors-success600, #16A34A)", children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChartBarIcon, {}) }),
5089
4870
  /* @__PURE__ */ jsxRuntime.jsx(StatValue$1, { className: "stat-value", variant: "alpha", children: showSkeleton ? "..." : stats?.active || 0 }),
5090
4871
  /* @__PURE__ */ jsxRuntime.jsx(StatLabel$1, { variant: "pi", children: "Active" })
5091
- ] }),
5092
- limits?.emailTemplates && !limits.emailTemplates.unlimited && /* @__PURE__ */ jsxRuntime.jsxs(StatCard$1, { $delay: "0.3s", $color: "var(--colors-warning600, #F59E0B)", children: [
5093
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon$1, { className: "stat-icon", $bg: "rgba(234, 179, 8, 0.12)", $color: "var(--colors-warning600, #D97706)", children: /* @__PURE__ */ jsxRuntime.jsx(outline.SparklesIcon, {}) }),
5094
- /* @__PURE__ */ jsxRuntime.jsx(StatValue$1, { className: "stat-value", variant: "alpha", children: showSkeleton ? "..." : limits.emailTemplates.max - limits.emailTemplates.current }),
5095
- /* @__PURE__ */ jsxRuntime.jsx(StatLabel$1, { variant: "pi", children: "Remaining" })
5096
4872
  ] })
5097
4873
  ] }),
5098
4874
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { margin: "0 -32px 32px -32px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}) }),
5099
- limits?.emailTemplates && !limits.emailTemplates.unlimited && limits.emailTemplates.current >= limits.emailTemplates.max * 0.8 && /* @__PURE__ */ jsxRuntime.jsxs(LimitWarning, { children: [
5100
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, children: [
5101
- /* @__PURE__ */ jsxRuntime.jsx(outline.SparklesIcon, { style: { width: 24, height: 24, color: "var(--colors-warning600, #D97706)" } }),
5102
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
5103
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", textColor: "neutral800", children: limits.emailTemplates.current >= limits.emailTemplates.max ? `You've reached your ${getTierInfo().name} limit!` : `You're approaching your ${getTierInfo().name} limit!` }),
5104
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { marginTop: "4px" }, children: [
5105
- "Using ",
5106
- limits.emailTemplates.current,
5107
- " of ",
5108
- limits.emailTemplates.max,
5109
- " templates.",
5110
- getTierInfo().next && ` Upgrade to ${getTierInfo().next} for ${getTierInfo().nextTemplates === -1 ? "unlimited" : getTierInfo().nextTemplates} templates!`
5111
- ] })
5112
- ] })
5113
- ] }),
5114
- /* @__PURE__ */ jsxRuntime.jsxs(
5115
- UpgradeButton,
5116
- {
5117
- onClick: () => navigate("/admin/settings/magic-mail/upgrade"),
5118
- children: [
5119
- /* @__PURE__ */ jsxRuntime.jsx(outline.BoltIcon, { style: { width: 16, height: 16, marginRight: "6px" } }),
5120
- "Upgrade Now"
5121
- ]
5122
- }
5123
- )
5124
- ] }),
5125
4875
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { value: activeTab, onValueChange: setActiveTab, children: [
5126
4876
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.List, { children: [
5127
4877
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "customTemplates", children: "Custom Templates" }),
@@ -5378,7 +5128,7 @@ const TemplateList = () => {
5378
5128
  return /* @__PURE__ */ jsxRuntime.jsx(
5379
5129
  PaginationButton,
5380
5130
  {
5381
- active: currentPage === pageNum,
5131
+ $active: currentPage === pageNum,
5382
5132
  onClick: () => setCurrentPage(pageNum),
5383
5133
  children: pageNum
5384
5134
  },
@@ -5415,7 +5165,6 @@ const TemplateList = () => {
5415
5165
  variant: "secondary",
5416
5166
  onClick: () => {
5417
5167
  setSearchTerm("");
5418
- setActiveCategory("all");
5419
5168
  },
5420
5169
  style: { marginTop: "20px" },
5421
5170
  children: "Clear Filters"
@@ -5467,7 +5216,7 @@ const TemplateList = () => {
5467
5216
  selectedTemplate.name
5468
5217
  ] }) }),
5469
5218
  /* @__PURE__ */ jsxRuntime.jsxs(ScrollableDialogBody, { children: [
5470
- /* @__PURE__ */ jsxRuntime.jsx(InfoBox$2, { style: { marginTop: 0, marginBottom: "20px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", justifyContent: "space-between", children: [
5219
+ /* @__PURE__ */ jsxRuntime.jsx(InfoBox$1, { style: { marginTop: 0, marginBottom: "20px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", justifyContent: "space-between", children: [
5471
5220
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { color: "var(--colors-primary600, #075985)" }, children: [
5472
5221
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Template ID:" }),
5473
5222
  " #",
@@ -6163,7 +5912,7 @@ const DeleteButton = styled__default.default(designSystem.Button)`
6163
5912
  height: 14px;
6164
5913
  }
6165
5914
  `;
6166
- const CloseButton$1 = styled__default.default.button`
5915
+ const CloseButton = styled__default.default.button`
6167
5916
  background: none;
6168
5917
  border: none;
6169
5918
  cursor: pointer;
@@ -6207,7 +5956,6 @@ const EditorPage = () => {
6207
5956
  const { get, post, put } = admin.useFetchClient();
6208
5957
  const { toggleNotification } = admin.useNotification();
6209
5958
  const navigate = reactRouterDom.useNavigate();
6210
- const { hasFeature } = useLicense();
6211
5959
  const emailEditorRef = React.useRef(null);
6212
5960
  const pathname = location.pathname;
6213
5961
  const coreMatch = pathname.match(/\/designer\/core\/(.+)$/);
@@ -6231,7 +5979,6 @@ const EditorPage = () => {
6231
5979
  bodyText: "",
6232
5980
  tags: []
6233
5981
  });
6234
- const canVersion = hasFeature("email-designer-versioning");
6235
5982
  const [showVersionHistory, setShowVersionHistory] = React.useState(false);
6236
5983
  const [versions, setVersions] = React.useState([]);
6237
5984
  const [loadingVersions, setLoadingVersions] = React.useState(false);
@@ -6480,7 +6227,7 @@ const EditorPage = () => {
6480
6227
  } catch (error) {
6481
6228
  toggleNotification({
6482
6229
  type: "danger",
6483
- message: error.response?.data?.message || "Failed to save"
6230
+ message: error.response?.data?.error?.message || error.response?.data?.message || "Failed to save"
6484
6231
  });
6485
6232
  } finally {
6486
6233
  setSaving(false);
@@ -6535,7 +6282,7 @@ const EditorPage = () => {
6535
6282
  /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => navigate("/plugins/magic-mail/designer"), children: /* @__PURE__ */ jsxRuntime.jsx(outline.ArrowLeftIcon, {}) }),
6536
6283
  /* @__PURE__ */ jsxRuntime.jsxs(TitleContainer, { children: [
6537
6284
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", children: isCoreEmail ? `${coreEmailType === "reset-password" ? "Reset Password" : "Email Confirmation"}` : isNewTemplate ? "New Template" : `${templateData.name}` }),
6538
- canVersion && !isNewTemplate && !isCoreEmail && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Versioning enabled" }),
6285
+ !isNewTemplate && !isCoreEmail && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Versioning enabled" }),
6539
6286
  isCoreEmail && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Core Strapi Email Template" })
6540
6287
  ] })
6541
6288
  ] }),
@@ -6551,7 +6298,7 @@ const EditorPage = () => {
6551
6298
  /* @__PURE__ */ jsxRuntime.jsx(outline.ArrowDownTrayIcon, {}),
6552
6299
  "Export Design"
6553
6300
  ] }),
6554
- !isCoreEmail && !isNewTemplate && canVersion && /* @__PURE__ */ jsxRuntime.jsxs(VersionButton, { onClick: handleOpenVersionHistory, children: [
6301
+ !isCoreEmail && !isNewTemplate && /* @__PURE__ */ jsxRuntime.jsxs(VersionButton, { onClick: handleOpenVersionHistory, children: [
6555
6302
  /* @__PURE__ */ jsxRuntime.jsx(outline.ClockIcon, {}),
6556
6303
  "Version History"
6557
6304
  ] }),
@@ -6623,7 +6370,9 @@ const EditorPage = () => {
6623
6370
  designSystem.Toggle,
6624
6371
  {
6625
6372
  checked: templateData.isActive,
6626
- onChange: () => setTemplateData({ ...templateData, isActive: !templateData.isActive })
6373
+ onChange: () => setTemplateData({ ...templateData, isActive: !templateData.isActive }),
6374
+ onLabel: "Active",
6375
+ offLabel: "Inactive"
6627
6376
  }
6628
6377
  ),
6629
6378
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: templateData.isActive ? "Active" : "Inactive" })
@@ -6858,7 +6607,7 @@ const EditorPage = () => {
6858
6607
  children: "Delete All"
6859
6608
  }
6860
6609
  ),
6861
- /* @__PURE__ */ jsxRuntime.jsx(CloseButton$1, { onClick: () => setShowVersionHistory(false), children: /* @__PURE__ */ jsxRuntime.jsx(outline.XMarkIcon, {}) })
6610
+ /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: () => setShowVersionHistory(false), children: /* @__PURE__ */ jsxRuntime.jsx(outline.XMarkIcon, {}) })
6862
6611
  ] })
6863
6612
  ] }),
6864
6613
  /* @__PURE__ */ jsxRuntime.jsx(VersionModalContent, { children: loadingVersions ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { textAlign: "center", padding: "40px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}) }) : versions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(EmptyVersions, { children: [
@@ -6921,7 +6670,7 @@ const theme = {
6921
6670
  spacing: { xs: "4px", sm: "8px", md: "16px", lg: "24px", xl: "32px", "2xl": "48px" },
6922
6671
  borderRadius: { lg: "12px", xl: "16px" }
6923
6672
  };
6924
- const fadeIn$2 = styled.keyframes`
6673
+ const fadeIn$1 = styled.keyframes`
6925
6674
  from { opacity: 0; transform: translateY(10px); }
6926
6675
  to { opacity: 1; transform: translateY(0); }
6927
6676
  `;
@@ -6937,7 +6686,7 @@ const breakpoints = {
6937
6686
  mobile: "768px"
6938
6687
  };
6939
6688
  const Container = styled__default.default(designSystem.Box)`
6940
- ${styled.css`animation: ${fadeIn$2} ${theme.transitions.slow};`}
6689
+ ${styled.css`animation: ${fadeIn$1} ${theme.transitions.slow};`}
6941
6690
  min-height: 100vh;
6942
6691
  max-width: 1440px;
6943
6692
  margin: 0 auto;
@@ -7050,7 +6799,7 @@ const StatCard = styled__default.default(designSystem.Box)`
7050
6799
  position: relative;
7051
6800
  overflow: hidden;
7052
6801
  transition: all ${theme.transitions.normal};
7053
- ${styled.css`animation: ${fadeIn$2} ${theme.transitions.slow} backwards;`}
6802
+ ${styled.css`animation: ${fadeIn$1} ${theme.transitions.slow} backwards;`}
7054
6803
  animation-delay: ${(props) => props.$delay || "0s"};
7055
6804
  box-shadow: ${theme.shadows.sm};
7056
6805
  border: 1px solid rgba(128, 128, 128, 0.2);
@@ -7239,22 +6988,18 @@ const Analytics = () => {
7239
6988
  useAuthRefresh();
7240
6989
  const { get, del } = admin.useFetchClient();
7241
6990
  const { toggleNotification } = admin.useNotification();
7242
- const { hasFeature } = useLicense();
7243
6991
  const [loading, setLoading] = React.useState(true);
7244
6992
  const [stats, setStats] = React.useState(null);
7245
6993
  const [emailLogs, setEmailLogs] = React.useState([]);
6994
+ const [logsError, setLogsError] = React.useState(null);
6995
+ const [pagination, setPagination] = React.useState(null);
7246
6996
  const [searchTerm, setSearchTerm] = React.useState("");
7247
6997
  const [showClearDialog, setShowClearDialog] = React.useState(false);
7248
6998
  const [isDeleting, setIsDeleting] = React.useState(false);
7249
- const hasBasicAnalytics = hasFeature("email-logging");
7250
6999
  React.useEffect(() => {
7251
- if (hasBasicAnalytics) {
7252
- fetchAnalytics();
7253
- fetchEmailLogs();
7254
- } else {
7255
- setLoading(false);
7256
- }
7257
- }, [hasBasicAnalytics]);
7000
+ fetchAnalytics();
7001
+ fetchEmailLogs();
7002
+ }, []);
7258
7003
  const fetchAnalytics = async () => {
7259
7004
  try {
7260
7005
  const response = await get("/magic-mail/analytics/stats");
@@ -7271,10 +7016,17 @@ const Analytics = () => {
7271
7016
  const fetchEmailLogs = async () => {
7272
7017
  setLoading(true);
7273
7018
  try {
7274
- const response = await get("/magic-mail/analytics/emails?_limit=50&_sort=sentAt:DESC");
7019
+ const response = await get("/magic-mail/analytics/emails?page=1&pageSize=50");
7275
7020
  setEmailLogs(response.data?.data || []);
7021
+ setPagination(response.data?.pagination || null);
7022
+ setLogsError(null);
7276
7023
  } catch (error) {
7277
7024
  console.error("Failed to fetch email logs:", error);
7025
+ const message = error.response?.data?.error?.message || error.response?.data?.message || "Failed to load email logs";
7026
+ setEmailLogs([]);
7027
+ setPagination(null);
7028
+ setLogsError(message);
7029
+ toggleNotification({ type: "danger", message });
7278
7030
  } finally {
7279
7031
  setLoading(false);
7280
7032
  }
@@ -7313,29 +7065,6 @@ const Analytics = () => {
7313
7065
  const filteredLogs = emailLogs.filter(
7314
7066
  (log) => log.recipient?.toLowerCase().includes(searchTerm.toLowerCase()) || log.subject?.toLowerCase().includes(searchTerm.toLowerCase()) || log.templateName?.toLowerCase().includes(searchTerm.toLowerCase())
7315
7067
  );
7316
- if (!hasBasicAnalytics) {
7317
- return /* @__PURE__ */ jsxRuntime.jsxs(Container, { children: [
7318
- /* @__PURE__ */ jsxRuntime.jsx(Header, { children: /* @__PURE__ */ jsxRuntime.jsx(HeaderContent, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center" }, children: [
7319
- /* @__PURE__ */ jsxRuntime.jsxs(Title, { variant: "alpha", children: [
7320
- /* @__PURE__ */ jsxRuntime.jsx(outline.ChartBarIcon, {}),
7321
- "Email Analytics"
7322
- ] }),
7323
- /* @__PURE__ */ jsxRuntime.jsx(Subtitle, { variant: "epsilon", children: "Upgrade to Premium to unlock detailed email analytics and tracking" })
7324
- ] }) }) }),
7325
- /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: /* @__PURE__ */ jsxRuntime.jsxs(EmptyContent, { children: [
7326
- /* @__PURE__ */ jsxRuntime.jsx(EmptyIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChartBarIcon, {}) }),
7327
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { marginBottom: "12px", display: "block" }, children: "Analytics Available in Premium" }),
7328
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { marginBottom: "32px", lineHeight: "1.6", display: "block" }, children: "Upgrade to Premium to unlock email analytics, tracking, open rates, click rates, and detailed reports about your email campaigns." }),
7329
- /* @__PURE__ */ jsxRuntime.jsx(
7330
- StyledButtons.GradientButton,
7331
- {
7332
- onClick: () => window.location.href = "/admin/settings/magic-mail/upgrade",
7333
- children: "View Upgrade Plans"
7334
- }
7335
- )
7336
- ] }) })
7337
- ] });
7338
- }
7339
7068
  if (loading) {
7340
7069
  return /* @__PURE__ */ jsxRuntime.jsx(Container, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading analytics..." }) }) });
7341
7070
  }
@@ -7373,6 +7102,7 @@ const Analytics = () => {
7373
7102
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral700", children: [
7374
7103
  "Recent Emails (",
7375
7104
  filteredLogs.length,
7105
+ pagination?.total ? ` of ${pagination.total}` : "",
7376
7106
  ")"
7377
7107
  ] }),
7378
7108
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
@@ -7397,7 +7127,11 @@ const Analytics = () => {
7397
7127
  )
7398
7128
  ] })
7399
7129
  ] }) }),
7400
- filteredLogs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: /* @__PURE__ */ jsxRuntime.jsxs(EmptyContent, { children: [
7130
+ logsError ? /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: /* @__PURE__ */ jsxRuntime.jsxs(EmptyContent, { children: [
7131
+ /* @__PURE__ */ jsxRuntime.jsx(EmptyIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(outline.ExclamationTriangleIcon, {}) }),
7132
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { marginBottom: "12px", display: "block" }, children: "Couldn't load email logs" }),
7133
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { lineHeight: "1.6", display: "block" }, children: logsError })
7134
+ ] }) }) : filteredLogs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: /* @__PURE__ */ jsxRuntime.jsxs(EmptyContent, { children: [
7401
7135
  /* @__PURE__ */ jsxRuntime.jsx(EmptyIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(outline.EnvelopeIcon, {}) }),
7402
7136
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { marginBottom: "12px", display: "block" }, children: searchTerm ? "No emails found" : "No emails sent yet" }),
7403
7137
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { lineHeight: "1.6", display: "block" }, children: searchTerm ? "Try adjusting your search terms" : "Send your first email to see analytics and tracking information here!" })
@@ -7474,7 +7208,7 @@ const Analytics = () => {
7474
7208
  ] }) })
7475
7209
  ] });
7476
7210
  };
7477
- const fadeIn$1 = styled.keyframes`
7211
+ const fadeIn = styled.keyframes`
7478
7212
  from {
7479
7213
  opacity: 0;
7480
7214
  transform: translateY(10px);
@@ -7518,7 +7252,7 @@ const PageContainer = styled__default.default(designSystem.Box)`
7518
7252
  padding: 40px;
7519
7253
  max-width: 900px;
7520
7254
  margin: 0 auto;
7521
- animation: ${fadeIn$1} 0.4s ease;
7255
+ animation: ${fadeIn} 0.4s ease;
7522
7256
  `;
7523
7257
  const HeaderSection = styled__default.default(designSystem.Box)`
7524
7258
  text-align: center;
@@ -7610,7 +7344,7 @@ const ContentCard = styled__default.default(designSystem.Box)`
7610
7344
  border-radius: 16px;
7611
7345
  padding: 32px;
7612
7346
  margin-bottom: 24px;
7613
- animation: ${fadeIn$1} 0.4s ease;
7347
+ animation: ${fadeIn} 0.4s ease;
7614
7348
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
7615
7349
  `;
7616
7350
  const QRCodeContainer = styled__default.default.div`
@@ -7680,7 +7414,7 @@ const ConnectedCard = styled__default.default(designSystem.Box)`
7680
7414
  padding: 32px;
7681
7415
  text-align: center;
7682
7416
  `;
7683
- const InfoBox$1 = styled__default.default(designSystem.Box)`
7417
+ const InfoBox = styled__default.default(designSystem.Box)`
7684
7418
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.06) 0%, ${colors.whatsappLight} 100%);
7685
7419
  border: 1px solid rgba(2, 132, 199, 0.2);
7686
7420
  border-radius: 12px;
@@ -7796,7 +7530,7 @@ const AlertIcon = styled__default.default.div`
7796
7530
  font-weight: bold;
7797
7531
  flex-shrink: 0;
7798
7532
  `;
7799
- const SuccessBox$1 = styled__default.default(designSystem.Box)`
7533
+ const SuccessBox = styled__default.default(designSystem.Box)`
7800
7534
  background: rgba(22, 163, 74, 0.06);
7801
7535
  border: 1px solid rgba(22, 163, 74, 0.2);
7802
7536
  border-radius: 12px;
@@ -8057,7 +7791,7 @@ const WhatsAppPage = () => {
8057
7791
  currentStep === 1 && /* @__PURE__ */ jsxRuntime.jsxs(ContentCard, { children: [
8058
7792
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Check Installation" }),
8059
7793
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { display: "block", marginBottom: "24px" }, children: "First, we need to verify that the required dependencies are installed." }),
8060
- isAvailable ? /* @__PURE__ */ jsxRuntime.jsxs(SuccessBox$1, { children: [
7794
+ isAvailable ? /* @__PURE__ */ jsxRuntime.jsxs(SuccessBox, { children: [
8061
7795
  /* @__PURE__ */ jsxRuntime.jsx(SuccessIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, { style: { width: 14, height: 14 } }) }),
8062
7796
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
8063
7797
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", style: { display: "block", marginBottom: "4px", color: "var(--colors-success600, #15803D)" }, children: "Dependencies Installed" }),
@@ -8108,7 +7842,7 @@ const WhatsAppPage = () => {
8108
7842
  currentStep === 2 && /* @__PURE__ */ jsxRuntime.jsxs(ContentCard, { children: [
8109
7843
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Connect Your WhatsApp" }),
8110
7844
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { display: "block", marginBottom: "24px" }, children: "Click the button below to start the connection process. A QR code will be generated for you to scan." }),
8111
- /* @__PURE__ */ jsxRuntime.jsxs(InfoBox$1, { children: [
7845
+ /* @__PURE__ */ jsxRuntime.jsxs(InfoBox, { children: [
8112
7846
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { display: "block", marginBottom: "16px", color: "var(--colors-primary600, #075985)" }, children: "How it works" }),
8113
7847
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, children: [
8114
7848
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: '1. Click "Connect WhatsApp" to generate a QR code' }),
@@ -8154,7 +7888,7 @@ const WhatsAppPage = () => {
8154
7888
  /* @__PURE__ */ jsxRuntime.jsx(SpinningLoader, { style: { width: "40px", height: "40px" } }),
8155
7889
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: "Generating QR code..." })
8156
7890
  ] }) }),
8157
- /* @__PURE__ */ jsxRuntime.jsxs(InfoBox$1, { children: [
7891
+ /* @__PURE__ */ jsxRuntime.jsxs(InfoBox, { children: [
8158
7892
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { display: "block", marginBottom: "16px", color: "var(--colors-primary600, #075985)" }, children: "Instructions" }),
8159
7893
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
8160
7894
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: "1. Open WhatsApp on your phone" }),
@@ -8282,440 +8016,14 @@ await whatsapp.sendTemplateMessage('49123456789', 'welcome', {
8282
8016
  ] })
8283
8017
  ] });
8284
8018
  };
8285
- const fadeIn = styled.keyframes`
8286
- from { opacity: 0; }
8287
- to { opacity: 1; }
8288
- `;
8289
- const slideUp = styled.keyframes`
8290
- from {
8291
- opacity: 0;
8292
- transform: translateY(30px);
8293
- }
8294
- to {
8295
- opacity: 1;
8296
- transform: translateY(0);
8297
- }
8298
- `;
8299
- const ModalOverlay = styled__default.default.div`
8300
- position: fixed;
8301
- top: 0;
8302
- left: 0;
8303
- right: 0;
8304
- bottom: 0;
8305
- background: rgba(4, 28, 47, 0.85);
8306
- backdrop-filter: blur(8px);
8307
- z-index: 9999;
8308
- display: flex;
8309
- align-items: center;
8310
- justify-content: center;
8311
- animation: ${fadeIn} 0.3s ease-out;
8312
- padding: 20px;
8313
- `;
8314
- const ModalContent = styled__default.default(designSystem.Box)`
8315
- background: ${(p) => p.theme.colors.neutral0};
8316
- border-radius: 16px;
8317
- width: 100%;
8318
- max-width: 580px;
8319
- box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
8320
- animation: ${slideUp} 0.4s cubic-bezier(0.4, 0, 0.2, 1);
8321
- overflow: hidden;
8322
- `;
8323
- const GradientHeader = styled__default.default(designSystem.Box)`
8324
- background: linear-gradient(135deg, #4945ff 0%, #7c3aed 100%);
8325
- padding: 32px 40px;
8326
- position: relative;
8327
- overflow: hidden;
8328
-
8329
- &::before {
8330
- content: '';
8331
- position: absolute;
8332
- top: -50%;
8333
- right: -50%;
8334
- width: 200%;
8335
- height: 200%;
8336
- background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
8337
- }
8338
- `;
8339
- const IconWrapper = styled__default.default.div`
8340
- width: 72px;
8341
- height: 72px;
8342
- border-radius: 50%;
8343
- background: rgba(255, 255, 255, 0.2);
8344
- display: flex;
8345
- align-items: center;
8346
- justify-content: center;
8347
- margin: 0 auto 16px;
8348
- backdrop-filter: blur(10px);
8349
- border: 2px solid rgba(255, 255, 255, 0.3);
8350
-
8351
- svg {
8352
- width: 36px;
8353
- height: 36px;
8354
- color: white;
8355
- }
8356
- `;
8357
- const CloseButton = styled__default.default.button`
8358
- position: absolute;
8359
- top: 16px;
8360
- right: 16px;
8361
- background: rgba(255, 255, 255, 0.2);
8362
- border: 2px solid rgba(255, 255, 255, 0.3);
8363
- border-radius: 50%;
8364
- width: 36px;
8365
- height: 36px;
8366
- display: flex;
8367
- align-items: center;
8368
- justify-content: center;
8369
- cursor: pointer;
8370
- transition: all 0.2s;
8371
- z-index: 10;
8372
-
8373
- svg {
8374
- width: 20px;
8375
- height: 20px;
8376
- color: white;
8377
- }
8378
-
8379
- &:hover {
8380
- background: rgba(255, 255, 255, 0.3);
8381
- transform: scale(1.1);
8382
- }
8383
-
8384
- &:active {
8385
- transform: scale(0.95);
8386
- }
8387
- `;
8388
- const GradientButton = styled__default.default(designSystem.Button)`
8389
- && {
8390
- background: linear-gradient(135deg, #4945ff 0%, #7c3aed 100%);
8391
- color: white;
8392
- font-weight: 600;
8393
- border: none;
8394
- box-shadow: 0 4px 12px rgba(73, 69, 255, 0.4);
8395
- padding: 12px 24px;
8396
- min-height: 44px;
8397
-
8398
- &:hover:not(:disabled) {
8399
- background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
8400
- box-shadow: 0 6px 16px rgba(73, 69, 255, 0.5);
8401
- }
8402
-
8403
- &:disabled {
8404
- opacity: 0.6;
8405
- cursor: not-allowed;
8406
- }
8407
- }
8408
- `;
8409
- styled__default.default(designSystem.Button)`
8410
- && {
8411
- background: rgba(73, 69, 255, 0.06);
8412
- color: #4945ff;
8413
- font-weight: 600;
8414
- border: 2px solid #4945ff;
8415
- padding: 12px 24px;
8416
- min-height: 44px;
8417
-
8418
- &:hover:not(:disabled) {
8419
- background: rgba(73, 69, 255, 0.12);
8420
- }
8421
- }
8422
- `;
8423
- const ToggleButton = styled__default.default.button`
8424
- background: none;
8425
- border: none;
8426
- color: #4945ff;
8427
- font-size: 13px;
8428
- font-weight: 600;
8429
- cursor: pointer;
8430
- padding: 8px 0;
8431
- text-decoration: underline;
8432
- transition: color 0.2s;
8433
-
8434
- &:hover {
8435
- color: #7c3aed;
8436
- }
8437
-
8438
- &:disabled {
8439
- opacity: 0.5;
8440
- cursor: not-allowed;
8441
- }
8442
- `;
8443
- const InfoBox = styled__default.default(designSystem.Box)`
8444
- background: rgba(73, 69, 255, 0.06);
8445
- border: 2px solid rgba(73, 69, 255, 0.3);
8446
- border-radius: 8px;
8447
- padding: 16px;
8448
- width: 100%;
8449
- `;
8450
- const SuccessBox = styled__default.default(designSystem.Box)`
8451
- background: rgba(34, 197, 94, 0.06);
8452
- border: 2px solid rgba(34, 197, 94, 0.3);
8453
- border-radius: 8px;
8454
- padding: 20px;
8455
- text-align: center;
8456
- `;
8457
- const InfoText = styled__default.default(designSystem.Typography)`
8458
- font-size: 13px;
8459
- line-height: 1.6;
8460
- color: ${(p) => p.theme.colors.neutral800};
8461
- `;
8462
- const LicenseGuard = ({ children }) => {
8463
- const { get, post } = admin.useFetchClient();
8464
- const { toggleNotification } = admin.useNotification();
8465
- const navigate = reactRouterDom.useNavigate();
8466
- useAuthRefresh();
8467
- const [isChecking, setIsChecking] = React.useState(true);
8468
- const [needsLicense, setNeedsLicense] = React.useState(false);
8469
- const [isCreating, setIsCreating] = React.useState(false);
8470
- const [useExistingKey, setUseExistingKey] = React.useState(false);
8471
- const [useAutoCreate, setUseAutoCreate] = React.useState(true);
8472
- const [existingLicenseKey, setExistingLicenseKey] = React.useState("");
8473
- const [existingEmail, setExistingEmail] = React.useState("");
8474
- const [adminUser, setAdminUser] = React.useState(null);
8475
- React.useEffect(() => {
8476
- checkLicenseStatus();
8477
- fetchAdminUser();
8478
- }, []);
8479
- const fetchAdminUser = async () => {
8480
- try {
8481
- const response = await get("/admin/users/me");
8482
- const userData = response.data?.data || response.data;
8483
- if (userData) {
8484
- setAdminUser(userData);
8485
- }
8486
- } catch (error) {
8487
- console.debug("[MagicMail] Could not fetch admin user");
8488
- }
8489
- };
8490
- const checkLicenseStatus = async () => {
8491
- setIsChecking(true);
8492
- try {
8493
- const response = await get("/magic-mail/license/status");
8494
- if (response.data.valid) {
8495
- setNeedsLicense(false);
8496
- } else {
8497
- setNeedsLicense(true);
8498
- }
8499
- } catch (error) {
8500
- console.error("[MagicMail] License check error:", error);
8501
- setNeedsLicense(true);
8502
- } finally {
8503
- setIsChecking(false);
8504
- }
8505
- };
8506
- const handleAutoCreateLicense = async (e) => {
8507
- e.preventDefault();
8508
- setIsCreating(true);
8509
- try {
8510
- const response = await post("/magic-mail/license/auto-create", {});
8511
- if (response.data && response.data.success) {
8512
- toggleNotification({
8513
- type: "success",
8514
- message: "✅ License created! Reloading..."
8515
- });
8516
- setNeedsLicense(false);
8517
- setTimeout(() => {
8518
- window.location.reload();
8519
- }, 500);
8520
- } else {
8521
- throw new Error("Failed to auto-create license");
8522
- }
8523
- } catch (error) {
8524
- console.error("[MagicMail] Error:", error);
8525
- toggleNotification({
8526
- type: "danger",
8527
- message: "Failed to create license. Try manual entry."
8528
- });
8529
- setIsCreating(false);
8530
- setUseAutoCreate(false);
8531
- }
8532
- };
8533
- const handleValidateExistingKey = async (e) => {
8534
- e.preventDefault();
8535
- if (!existingLicenseKey.trim() || !existingEmail.trim()) {
8536
- toggleNotification({
8537
- type: "warning",
8538
- message: "Please enter both license key and email address"
8539
- });
8540
- return;
8541
- }
8542
- setIsCreating(true);
8543
- try {
8544
- const response = await post("/magic-mail/license/store-key", {
8545
- licenseKey: existingLicenseKey.trim(),
8546
- email: existingEmail.trim()
8547
- });
8548
- if (response.data && response.data.success) {
8549
- toggleNotification({
8550
- type: "success",
8551
- message: "✅ License activated! Reloading..."
8552
- });
8553
- setNeedsLicense(false);
8554
- setTimeout(() => {
8555
- window.location.reload();
8556
- }, 500);
8557
- } else {
8558
- throw new Error("Invalid license");
8559
- }
8560
- } catch (error) {
8561
- toggleNotification({
8562
- type: "danger",
8563
- message: "Invalid license key or email address"
8564
- });
8565
- setIsCreating(false);
8566
- }
8567
- };
8568
- const handleClose = () => {
8569
- navigate("/content-manager");
8570
- };
8571
- if (isChecking) {
8572
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 8, style: { textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Checking license..." }) });
8573
- }
8574
- if (needsLicense) {
8575
- return /* @__PURE__ */ jsxRuntime.jsx(ModalOverlay, { children: /* @__PURE__ */ jsxRuntime.jsxs(ModalContent, { children: [
8576
- /* @__PURE__ */ jsxRuntime.jsxs(GradientHeader, { children: [
8577
- /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: handleClose, type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(outline.XMarkIcon, {}) }),
8578
- /* @__PURE__ */ jsxRuntime.jsx(IconWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(outline.KeyIcon, {}) }),
8579
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { textAlign: "center", position: "relative" }, children: [
8580
- /* @__PURE__ */ jsxRuntime.jsx(
8581
- designSystem.Typography,
8582
- {
8583
- variant: "alpha",
8584
- style: {
8585
- color: "white",
8586
- fontSize: "24px",
8587
- fontWeight: "700",
8588
- marginBottom: "12px",
8589
- display: "block"
8590
- },
8591
- children: "🔐 Activate MagicMail"
8592
- }
8593
- ),
8594
- /* @__PURE__ */ jsxRuntime.jsx(
8595
- designSystem.Typography,
8596
- {
8597
- variant: "epsilon",
8598
- style: {
8599
- color: "rgba(255, 255, 255, 0.9)",
8600
- fontSize: "14px",
8601
- display: "block"
8602
- },
8603
- children: useExistingKey ? "Enter your existing license key" : "Create a license to start using the plugin"
8604
- }
8605
- )
8606
- ] })
8607
- ] }),
8608
- /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: useExistingKey ? handleValidateExistingKey : handleAutoCreateLicense, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 6, paddingLeft: 8, paddingRight: 8, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, style: { width: "100%" }, children: [
8609
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { textAlign: "center", width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
8610
- ToggleButton,
8611
- {
8612
- type: "button",
8613
- onClick: () => setUseExistingKey(!useExistingKey),
8614
- disabled: isCreating,
8615
- children: useExistingKey ? "← Create new license" : "Have a license key? →"
8616
- }
8617
- ) }),
8618
- /* @__PURE__ */ jsxRuntime.jsx(InfoBox, { children: /* @__PURE__ */ jsxRuntime.jsx(InfoText, { variant: "omega", children: useExistingKey ? "Enter your email and license key to activate." : adminUser && adminUser.email ? `Click "Activate" to auto-create a license with your account (${adminUser.email})` : 'Click "Activate" to auto-create a license with your admin account' }) }),
8619
- useExistingKey ? (
8620
- // Existing License Key Input
8621
- /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8622
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: "100%" }, children: [
8623
- /* @__PURE__ */ jsxRuntime.jsx(
8624
- designSystem.Typography,
8625
- {
8626
- variant: "pi",
8627
- fontWeight: "bold",
8628
- style: { marginBottom: "8px", display: "block" },
8629
- children: "Email Address *"
8630
- }
8631
- ),
8632
- /* @__PURE__ */ jsxRuntime.jsx(
8633
- designSystem.TextInput,
8634
- {
8635
- placeholder: "admin@example.com",
8636
- type: "email",
8637
- value: existingEmail,
8638
- onChange: (e) => setExistingEmail(e.target.value),
8639
- required: true,
8640
- disabled: isCreating
8641
- }
8642
- ),
8643
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { fontSize: "11px", marginTop: "4px" }, children: "Enter the email address associated with this license" })
8644
- ] }),
8645
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: "100%" }, children: [
8646
- /* @__PURE__ */ jsxRuntime.jsx(
8647
- designSystem.Typography,
8648
- {
8649
- variant: "pi",
8650
- fontWeight: "bold",
8651
- style: { marginBottom: "8px", display: "block" },
8652
- children: "License Key *"
8653
- }
8654
- ),
8655
- /* @__PURE__ */ jsxRuntime.jsx(
8656
- designSystem.TextInput,
8657
- {
8658
- placeholder: "MAGIC-MAIL-XXXX-XXXX-XXXX",
8659
- value: existingLicenseKey,
8660
- onChange: (e) => setExistingLicenseKey(e.target.value),
8661
- required: true,
8662
- disabled: isCreating
8663
- }
8664
- ),
8665
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { fontSize: "11px", marginTop: "4px" }, children: "Enter the license key" })
8666
- ] })
8667
- ] })
8668
- ) : adminUser ? (
8669
- // Auto-create mode - Show user info
8670
- /* @__PURE__ */ jsxRuntime.jsxs(SuccessBox, { children: [
8671
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", style: { marginBottom: "12px", display: "block" }, children: "Ready to activate with your account:" }),
8672
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { marginBottom: "4px", display: "block" }, children: [
8673
- adminUser.firstname || "Admin",
8674
- " ",
8675
- adminUser.lastname || "User"
8676
- ] }),
8677
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: adminUser.email || "Loading..." })
8678
- ] })
8679
- ) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, background: "neutral100", hasRadius: true, style: { textAlign: "center" }, children: [
8680
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true }),
8681
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", marginTop: 2, children: "Loading admin user data..." })
8682
- ] }),
8683
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 3, justifyContent: "center", style: { marginTop: "16px" }, children: useExistingKey ? /* @__PURE__ */ jsxRuntime.jsx(
8684
- GradientButton,
8685
- {
8686
- type: "submit",
8687
- size: "L",
8688
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(outline.CheckIcon, { style: { width: 20, height: 20 } }),
8689
- loading: isCreating,
8690
- disabled: isCreating || !existingLicenseKey.trim() || !existingEmail.trim(),
8691
- children: "Validate License"
8692
- }
8693
- ) : /* @__PURE__ */ jsxRuntime.jsx(
8694
- GradientButton,
8695
- {
8696
- type: "submit",
8697
- size: "L",
8698
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(outline.CheckIcon, { style: { width: 20, height: 20 } }),
8699
- loading: isCreating,
8700
- disabled: isCreating || !adminUser,
8701
- children: "Activate License"
8702
- }
8703
- ) })
8704
- ] }) }) })
8705
- ] }) });
8706
- }
8707
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
8708
- };
8709
8019
  const pluginId = "magic-mail";
8710
8020
  const pluginPermissions = {
8711
8021
  access: [{ action: `plugin::${pluginId}.access`, subject: null }]
8712
8022
  };
8713
8023
  const App = () => {
8024
+ useAuthRefresh();
8714
8025
  const location = reactRouterDom.useLocation();
8715
8026
  const navigate = reactRouterDom.useNavigate();
8716
- const { hasFeature } = useLicense();
8717
- const hasEmailDesigner = hasFeature("email-designer-basic");
8718
- const hasAnalytics = hasFeature("email-logging");
8719
8027
  const isEditorRoute = /\/designer\/(new|\d+|core\/.+)/.test(location.pathname);
8720
8028
  const getActiveTab = () => {
8721
8029
  if (location.pathname.includes("/analytics")) return "analytics";
@@ -8734,9 +8042,9 @@ const App = () => {
8734
8042
  if (tab === "whatsapp") navigate("/plugins/magic-mail/whatsapp");
8735
8043
  };
8736
8044
  if (isEditorRoute) {
8737
- return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: pluginPermissions.access, children: /* @__PURE__ */ jsxRuntime.jsx(LicenseGuard, { children: /* @__PURE__ */ jsxRuntime.jsx(EditorPage, {}) }) });
8045
+ return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: pluginPermissions.access, children: /* @__PURE__ */ jsxRuntime.jsx(EditorPage, {}) });
8738
8046
  }
8739
- return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: pluginPermissions.access, children: /* @__PURE__ */ jsxRuntime.jsx(LicenseGuard, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { value: activeTab, onValueChange: handleTabChange, children: [
8047
+ return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: pluginPermissions.access, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { value: activeTab, onValueChange: handleTabChange, children: [
8740
8048
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.List, { children: [
8741
8049
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "accounts", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
8742
8050
  /* @__PURE__ */ jsxRuntime.jsx(outline.EnvelopeIcon, { style: { width: 16, height: 16 } }),
@@ -8746,11 +8054,11 @@ const App = () => {
8746
8054
  /* @__PURE__ */ jsxRuntime.jsx(outline.FunnelIcon, { style: { width: 16, height: 16 } }),
8747
8055
  "Routing Rules"
8748
8056
  ] }) }),
8749
- hasEmailDesigner && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "templates", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
8057
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "templates", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
8750
8058
  /* @__PURE__ */ jsxRuntime.jsx(outline.DocumentTextIcon, { style: { width: 16, height: 16 } }),
8751
8059
  "Email Templates"
8752
8060
  ] }) }),
8753
- hasAnalytics && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "analytics", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
8061
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "analytics", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
8754
8062
  /* @__PURE__ */ jsxRuntime.jsx(outline.ChartBarIcon, { style: { width: 16, height: 16 } }),
8755
8063
  "Analytics"
8756
8064
  ] }) }),
@@ -8761,9 +8069,9 @@ const App = () => {
8761
8069
  ] }),
8762
8070
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "accounts", children: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }),
8763
8071
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "routing", children: /* @__PURE__ */ jsxRuntime.jsx(RoutingRulesPage, {}) }),
8764
- hasEmailDesigner && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "templates", children: /* @__PURE__ */ jsxRuntime.jsx(TemplateList, {}) }),
8765
- hasAnalytics && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "analytics", children: /* @__PURE__ */ jsxRuntime.jsx(Analytics, {}) }),
8072
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "templates", children: /* @__PURE__ */ jsxRuntime.jsx(TemplateList, {}) }),
8073
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "analytics", children: /* @__PURE__ */ jsxRuntime.jsx(Analytics, {}) }),
8766
8074
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "whatsapp", children: /* @__PURE__ */ jsxRuntime.jsx(WhatsAppPage, {}) })
8767
- ] }) }) }) });
8075
+ ] }) }) });
8768
8076
  };
8769
8077
  exports.default = App;