strapi-plugin-magic-mail 2.5.0 → 2.6.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.
@@ -4899,8 +4899,8 @@ const TemplateList = () => {
4899
4899
  });
4900
4900
  fetchTemplates();
4901
4901
  fetchStats();
4902
- if (duplicated?.id) {
4903
- navigate(`/plugins/magic-mail/designer/${duplicated.id}`);
4902
+ if (duplicated?.templateReferenceId) {
4903
+ navigate(`/plugins/magic-mail/designer/${duplicated.templateReferenceId}`);
4904
4904
  }
4905
4905
  } catch (error) {
4906
4906
  toggleNotification({
@@ -5211,7 +5211,7 @@ const TemplateList = () => {
5211
5211
  /* @__PURE__ */ jsxRuntime.jsx(
5212
5212
  StyledButtons.IconButtonPrimary,
5213
5213
  {
5214
- onClick: () => navigate(`/plugins/magic-mail/designer/${template.id}`),
5214
+ onClick: () => navigate(`/plugins/magic-mail/designer/${template.templateReferenceId}`),
5215
5215
  "aria-label": "Edit Template",
5216
5216
  title: "Edit Template",
5217
5217
  children: /* @__PURE__ */ jsxRuntime.jsx(outline.PencilIcon, {})
@@ -5220,7 +5220,7 @@ const TemplateList = () => {
5220
5220
  /* @__PURE__ */ jsxRuntime.jsx(
5221
5221
  StyledButtons.IconButton,
5222
5222
  {
5223
- onClick: () => handleDownload(template.id, "html"),
5223
+ onClick: () => handleDownload(template.templateReferenceId, "html"),
5224
5224
  "aria-label": "Download HTML",
5225
5225
  title: "Download as HTML",
5226
5226
  children: /* @__PURE__ */ jsxRuntime.jsx(outline.DocumentArrowDownIcon, {})
@@ -5229,7 +5229,7 @@ const TemplateList = () => {
5229
5229
  /* @__PURE__ */ jsxRuntime.jsx(
5230
5230
  StyledButtons.IconButton,
5231
5231
  {
5232
- onClick: () => handleDownload(template.id, "json"),
5232
+ onClick: () => handleDownload(template.templateReferenceId, "json"),
5233
5233
  "aria-label": "Download JSON",
5234
5234
  title: "Download as JSON",
5235
5235
  children: /* @__PURE__ */ jsxRuntime.jsx(outline.CodeBracketIcon, {})
@@ -5238,7 +5238,7 @@ const TemplateList = () => {
5238
5238
  /* @__PURE__ */ jsxRuntime.jsx(
5239
5239
  StyledButtons.IconButton,
5240
5240
  {
5241
- onClick: () => handleDuplicate(template.id, template.name),
5241
+ onClick: () => handleDuplicate(template.templateReferenceId, template.name),
5242
5242
  "aria-label": "Duplicate Template",
5243
5243
  title: "Duplicate Template",
5244
5244
  children: /* @__PURE__ */ jsxRuntime.jsx(outline.DocumentDuplicateIcon, {})
@@ -5268,14 +5268,14 @@ const TemplateList = () => {
5268
5268
  /* @__PURE__ */ jsxRuntime.jsx(
5269
5269
  StyledButtons.IconButtonDanger,
5270
5270
  {
5271
- onClick: () => handleDelete(template.id, template.name),
5271
+ onClick: () => handleDelete(template.templateReferenceId, template.name),
5272
5272
  "aria-label": "Delete Template",
5273
5273
  title: "Delete Template",
5274
5274
  children: /* @__PURE__ */ jsxRuntime.jsx(outline.TrashIcon, {})
5275
5275
  }
5276
5276
  )
5277
5277
  ] }) })
5278
- ] }, template.id)) })
5278
+ ] }, template.templateReferenceId)) })
5279
5279
  ] }),
5280
5280
  totalPages > 1 && /* @__PURE__ */ jsxRuntime.jsxs(PaginationWrapper, { justifyContent: "space-between", alignItems: "center", children: [
5281
5281
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "center", children: [
@@ -4876,8 +4876,8 @@ const TemplateList = () => {
4876
4876
  });
4877
4877
  fetchTemplates();
4878
4878
  fetchStats();
4879
- if (duplicated?.id) {
4880
- navigate(`/plugins/magic-mail/designer/${duplicated.id}`);
4879
+ if (duplicated?.templateReferenceId) {
4880
+ navigate(`/plugins/magic-mail/designer/${duplicated.templateReferenceId}`);
4881
4881
  }
4882
4882
  } catch (error) {
4883
4883
  toggleNotification({
@@ -5188,7 +5188,7 @@ const TemplateList = () => {
5188
5188
  /* @__PURE__ */ jsx(
5189
5189
  IconButtonPrimary,
5190
5190
  {
5191
- onClick: () => navigate(`/plugins/magic-mail/designer/${template.id}`),
5191
+ onClick: () => navigate(`/plugins/magic-mail/designer/${template.templateReferenceId}`),
5192
5192
  "aria-label": "Edit Template",
5193
5193
  title: "Edit Template",
5194
5194
  children: /* @__PURE__ */ jsx(PencilIcon, {})
@@ -5197,7 +5197,7 @@ const TemplateList = () => {
5197
5197
  /* @__PURE__ */ jsx(
5198
5198
  IconButton,
5199
5199
  {
5200
- onClick: () => handleDownload(template.id, "html"),
5200
+ onClick: () => handleDownload(template.templateReferenceId, "html"),
5201
5201
  "aria-label": "Download HTML",
5202
5202
  title: "Download as HTML",
5203
5203
  children: /* @__PURE__ */ jsx(DocumentArrowDownIcon, {})
@@ -5206,7 +5206,7 @@ const TemplateList = () => {
5206
5206
  /* @__PURE__ */ jsx(
5207
5207
  IconButton,
5208
5208
  {
5209
- onClick: () => handleDownload(template.id, "json"),
5209
+ onClick: () => handleDownload(template.templateReferenceId, "json"),
5210
5210
  "aria-label": "Download JSON",
5211
5211
  title: "Download as JSON",
5212
5212
  children: /* @__PURE__ */ jsx(CodeBracketIcon, {})
@@ -5215,7 +5215,7 @@ const TemplateList = () => {
5215
5215
  /* @__PURE__ */ jsx(
5216
5216
  IconButton,
5217
5217
  {
5218
- onClick: () => handleDuplicate(template.id, template.name),
5218
+ onClick: () => handleDuplicate(template.templateReferenceId, template.name),
5219
5219
  "aria-label": "Duplicate Template",
5220
5220
  title: "Duplicate Template",
5221
5221
  children: /* @__PURE__ */ jsx(DocumentDuplicateIcon, {})
@@ -5245,14 +5245,14 @@ const TemplateList = () => {
5245
5245
  /* @__PURE__ */ jsx(
5246
5246
  IconButtonDanger,
5247
5247
  {
5248
- onClick: () => handleDelete(template.id, template.name),
5248
+ onClick: () => handleDelete(template.templateReferenceId, template.name),
5249
5249
  "aria-label": "Delete Template",
5250
5250
  title: "Delete Template",
5251
5251
  children: /* @__PURE__ */ jsx(TrashIcon, {})
5252
5252
  }
5253
5253
  )
5254
5254
  ] }) })
5255
- ] }, template.id)) })
5255
+ ] }, template.templateReferenceId)) })
5256
5256
  ] }),
5257
5257
  totalPages > 1 && /* @__PURE__ */ jsxs(PaginationWrapper, { justifyContent: "space-between", alignItems: "center", children: [
5258
5258
  /* @__PURE__ */ jsxs(Flex, { gap: 3, alignItems: "center", children: [
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  const React = require("react");
3
+ const admin = require("@strapi/strapi/admin");
3
4
  const jsxRuntime = require("react/jsx-runtime");
4
5
  const outline = require("@heroicons/react/24/outline");
5
6
  const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
@@ -25,9 +26,25 @@ const pluginPkg = {
25
26
  const pluginId = "magic-mail";
26
27
  const Initializer = ({ setPlugin }) => {
27
28
  const ref = React.useRef(setPlugin);
29
+ const { get } = admin.useFetchClient();
28
30
  React.useEffect(() => {
29
31
  ref.current(pluginId);
30
32
  }, []);
33
+ React.useEffect(() => {
34
+ const HEARTBEAT_INTERVAL = 4 * 60 * 1e3;
35
+ const heartbeat = async () => {
36
+ try {
37
+ await get(`/${pluginId}/license/status`);
38
+ } catch (error) {
39
+ }
40
+ };
41
+ const initialTimeout = setTimeout(heartbeat, 60 * 1e3);
42
+ const interval = setInterval(heartbeat, HEARTBEAT_INTERVAL);
43
+ return () => {
44
+ clearTimeout(initialTimeout);
45
+ clearInterval(interval);
46
+ };
47
+ }, [get]);
31
48
  return null;
32
49
  };
33
50
  const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(outline.EnvelopeIcon, { style: { width: 24, height: 24 } });
@@ -48,7 +65,7 @@ const index = {
48
65
  id: `${pluginId}.plugin.name`,
49
66
  defaultMessage: "MagicMail"
50
67
  },
51
- Component: () => Promise.resolve().then(() => require("../_chunks/App-BTKgUbIs.js"))
68
+ Component: () => Promise.resolve().then(() => require("../_chunks/App-Boq8cits.js"))
52
69
  });
53
70
  app.createSettingSection(
54
71
  {
@@ -1,4 +1,5 @@
1
1
  import { useRef, useEffect } from "react";
2
+ import { useFetchClient } from "@strapi/strapi/admin";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  import { EnvelopeIcon } from "@heroicons/react/24/outline";
4
5
  const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
@@ -24,9 +25,25 @@ const pluginPkg = {
24
25
  const pluginId = "magic-mail";
25
26
  const Initializer = ({ setPlugin }) => {
26
27
  const ref = useRef(setPlugin);
28
+ const { get } = useFetchClient();
27
29
  useEffect(() => {
28
30
  ref.current(pluginId);
29
31
  }, []);
32
+ useEffect(() => {
33
+ const HEARTBEAT_INTERVAL = 4 * 60 * 1e3;
34
+ const heartbeat = async () => {
35
+ try {
36
+ await get(`/${pluginId}/license/status`);
37
+ } catch (error) {
38
+ }
39
+ };
40
+ const initialTimeout = setTimeout(heartbeat, 60 * 1e3);
41
+ const interval = setInterval(heartbeat, HEARTBEAT_INTERVAL);
42
+ return () => {
43
+ clearTimeout(initialTimeout);
44
+ clearInterval(interval);
45
+ };
46
+ }, [get]);
30
47
  return null;
31
48
  };
32
49
  const PluginIcon = () => /* @__PURE__ */ jsx(EnvelopeIcon, { style: { width: 24, height: 24 } });
@@ -47,7 +64,7 @@ const index = {
47
64
  id: `${pluginId}.plugin.name`,
48
65
  defaultMessage: "MagicMail"
49
66
  },
50
- Component: () => import("../_chunks/App-J8-8Wz0m.mjs")
67
+ Component: () => import("../_chunks/App-zdhx2Ony.mjs")
51
68
  });
52
69
  app.createSettingSection(
53
70
  {
@@ -5649,7 +5649,7 @@ function requireOauth() {
5649
5649
  });
5650
5650
  return oauth;
5651
5651
  }
5652
- const version = "2.4.0";
5652
+ const version = "2.6.0";
5653
5653
  const require$$2 = {
5654
5654
  version
5655
5655
  };
@@ -5639,7 +5639,7 @@ function requireOauth() {
5639
5639
  });
5640
5640
  return oauth;
5641
5641
  }
5642
- const version = "2.4.0";
5642
+ const version = "2.6.0";
5643
5643
  const require$$2 = {
5644
5644
  version
5645
5645
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.5.0",
2
+ "version": "2.6.1",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",
@@ -48,14 +48,14 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@heroicons/react": "^2.2.0",
51
- "@strapi/design-system": "^2.0.2",
52
- "@strapi/icons": "^2.0.2",
51
+ "@strapi/design-system": "^2.1.2",
52
+ "@strapi/icons": "^2.1.2",
53
53
  "baileys": "^7.0.0-rc.9",
54
54
  "decode-html": "^2.0.0",
55
55
  "form-data": "^4.0.4",
56
56
  "html-to-text": "^9.0.5",
57
57
  "mustache": "^4.2.0",
58
- "nodemailer": "^7.0.10",
58
+ "nodemailer": "^7.0.12",
59
59
  "pino": "^9.5.0",
60
60
  "qrcode": "^1.5.4",
61
61
  "react-email-editor": "^1.7.11",
@@ -70,8 +70,8 @@
70
70
  "@semantic-release/github": "^11.0.2",
71
71
  "@semantic-release/npm": "^13.1.2",
72
72
  "@semantic-release/release-notes-generator": "^14.0.1",
73
- "@strapi/sdk-plugin": "^5.3.2",
74
- "@strapi/strapi": "^5.33.4",
73
+ "@strapi/sdk-plugin": "^5.4.0",
74
+ "@strapi/strapi": "^5.35.0",
75
75
  "prettier": "^3.6.2",
76
76
  "react": "^18.3.1",
77
77
  "react-dom": "^18.3.1",
@@ -80,7 +80,7 @@
80
80
  "styled-components": "^6.3.8"
81
81
  },
82
82
  "peerDependencies": {
83
- "@strapi/sdk-plugin": "^5.3.2",
83
+ "@strapi/sdk-plugin": "^5.4.0",
84
84
  "@strapi/strapi": "^5.33.4",
85
85
  "react": "^18.3.1",
86
86
  "react-dom": "^18.3.1",