strapi-plugin-magic-mail 2.4.0 → 2.6.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.
@@ -7632,11 +7632,79 @@ const InfoBox = styled__default.default(designSystem.Box)`
7632
7632
  margin: 20px 0;
7633
7633
  `;
7634
7634
  const TestSection = styled__default.default(designSystem.Box)`
7635
- background: ${(props) => props.theme.colors.neutral100};
7636
- border-radius: 12px;
7635
+ background: linear-gradient(135deg, ${colors.whatsappLight} 0%, #E8F5E9 100%);
7636
+ border: 1px solid ${colors.whatsapp}40;
7637
+ border-radius: 16px;
7637
7638
  padding: 24px;
7638
7639
  margin-top: 24px;
7639
7640
  `;
7641
+ const WhatsAppInput = styled__default.default.input`
7642
+ width: 100%;
7643
+ padding: 14px 16px;
7644
+ border: 2px solid ${(props) => props.theme.colors.neutral200};
7645
+ border-radius: 12px;
7646
+ font-size: 15px;
7647
+ background: white;
7648
+ color: ${(props) => props.theme.colors.neutral800};
7649
+ transition: all 0.2s ease;
7650
+ box-sizing: border-box;
7651
+
7652
+ &:focus {
7653
+ outline: none;
7654
+ border-color: ${colors.whatsapp};
7655
+ box-shadow: 0 0 0 3px ${colors.whatsapp}20;
7656
+ }
7657
+
7658
+ &::placeholder {
7659
+ color: ${(props) => props.theme.colors.neutral400};
7660
+ }
7661
+ `;
7662
+ const WhatsAppTextarea = styled__default.default.textarea`
7663
+ width: 100%;
7664
+ padding: 14px 16px;
7665
+ border: 2px solid ${(props) => props.theme.colors.neutral200};
7666
+ border-radius: 12px;
7667
+ font-size: 15px;
7668
+ background: white;
7669
+ color: ${(props) => props.theme.colors.neutral800};
7670
+ transition: all 0.2s ease;
7671
+ box-sizing: border-box;
7672
+ resize: vertical;
7673
+ min-height: 80px;
7674
+ font-family: inherit;
7675
+
7676
+ &:focus {
7677
+ outline: none;
7678
+ border-color: ${colors.whatsapp};
7679
+ box-shadow: 0 0 0 3px ${colors.whatsapp}20;
7680
+ }
7681
+
7682
+ &::placeholder {
7683
+ color: ${(props) => props.theme.colors.neutral400};
7684
+ }
7685
+ `;
7686
+ const InputLabel = styled__default.default.label`
7687
+ display: flex;
7688
+ align-items: center;
7689
+ gap: 8px;
7690
+ font-size: 14px;
7691
+ font-weight: 600;
7692
+ color: ${colors.whatsappDark};
7693
+ margin-bottom: 8px;
7694
+ `;
7695
+ const InputHint = styled__default.default.span`
7696
+ font-size: 12px;
7697
+ color: ${(props) => props.theme.colors.neutral500};
7698
+ margin-top: 6px;
7699
+ display: block;
7700
+ `;
7701
+ const PhoneSymbol = styled__default.default.span`
7702
+ font-size: 16px;
7703
+ font-weight: 700;
7704
+ `;
7705
+ const MessageSymbol = styled__default.default.span`
7706
+ font-size: 16px;
7707
+ `;
7640
7708
  const UseCaseCard = styled__default.default(designSystem.Box)`
7641
7709
  background: linear-gradient(135deg, ${colors.whatsappLight}, ${theme$3.colors.primary[50]});
7642
7710
  border: 2px solid ${colors.whatsapp};
@@ -8073,27 +8141,34 @@ const WhatsAppPage = () => {
8073
8141
  /* @__PURE__ */ jsxRuntime.jsxs(ContentCard, { style: { marginTop: "24px" }, children: [
8074
8142
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Send Test Message" }),
8075
8143
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { display: "block", marginBottom: "24px" }, children: "Test your WhatsApp connection by sending a message." }),
8076
- /* @__PURE__ */ jsxRuntime.jsx(TestSection, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 4, children: [
8077
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
8078
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Phone Number" }),
8144
+ /* @__PURE__ */ jsxRuntime.jsxs(TestSection, { children: [
8145
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { marginBottom: "20px" }, children: [
8146
+ /* @__PURE__ */ jsxRuntime.jsxs(InputLabel, { children: [
8147
+ /* @__PURE__ */ jsxRuntime.jsx(PhoneSymbol, { children: "+" }),
8148
+ "Phone Number"
8149
+ ] }),
8079
8150
  /* @__PURE__ */ jsxRuntime.jsx(
8080
- designSystem.TextInput,
8151
+ WhatsAppInput,
8081
8152
  {
8082
- placeholder: "49123456789 (with country code, no +)",
8153
+ placeholder: "49123456789",
8083
8154
  value: testPhone,
8084
8155
  onChange: (e) => setTestPhone(e.target.value)
8085
8156
  }
8086
8157
  ),
8087
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, { children: "Enter phone number with country code (e.g., 49 for Germany)" })
8158
+ /* @__PURE__ */ jsxRuntime.jsx(InputHint, { children: "Enter with country code, without + (e.g., 49 for Germany, 1 for USA)" })
8088
8159
  ] }),
8089
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
8090
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Message (optional)" }),
8160
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { marginBottom: "24px" }, children: [
8161
+ /* @__PURE__ */ jsxRuntime.jsxs(InputLabel, { children: [
8162
+ /* @__PURE__ */ jsxRuntime.jsx(MessageSymbol, { children: "@" }),
8163
+ "Message (optional)"
8164
+ ] }),
8091
8165
  /* @__PURE__ */ jsxRuntime.jsx(
8092
- designSystem.TextInput,
8166
+ WhatsAppTextarea,
8093
8167
  {
8094
- placeholder: "Leave empty for default test message",
8168
+ placeholder: "Type your message here... or leave empty for default test message",
8095
8169
  value: testMessage,
8096
- onChange: (e) => setTestMessage(e.target.value)
8170
+ onChange: (e) => setTestMessage(e.target.value),
8171
+ rows: 3
8097
8172
  }
8098
8173
  )
8099
8174
  ] }),
@@ -8102,10 +8177,12 @@ const WhatsAppPage = () => {
8102
8177
  {
8103
8178
  onClick: handleSendTest,
8104
8179
  loading: sendingTest,
8180
+ disabled: !testPhone,
8181
+ style: { width: "100%" },
8105
8182
  children: "Send Test Message"
8106
8183
  }
8107
8184
  )
8108
- ] }) }),
8185
+ ] }),
8109
8186
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { style: { margin: "24px 0" } }),
8110
8187
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Using WhatsApp in Your Code" }),
8111
8188
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { display: "block", marginBottom: "16px" }, children: "Use the WhatsApp service programmatically in your Strapi code." }),
@@ -7609,11 +7609,79 @@ const InfoBox = styled(Box)`
7609
7609
  margin: 20px 0;
7610
7610
  `;
7611
7611
  const TestSection = styled(Box)`
7612
- background: ${(props) => props.theme.colors.neutral100};
7613
- border-radius: 12px;
7612
+ background: linear-gradient(135deg, ${colors.whatsappLight} 0%, #E8F5E9 100%);
7613
+ border: 1px solid ${colors.whatsapp}40;
7614
+ border-radius: 16px;
7614
7615
  padding: 24px;
7615
7616
  margin-top: 24px;
7616
7617
  `;
7618
+ const WhatsAppInput = styled.input`
7619
+ width: 100%;
7620
+ padding: 14px 16px;
7621
+ border: 2px solid ${(props) => props.theme.colors.neutral200};
7622
+ border-radius: 12px;
7623
+ font-size: 15px;
7624
+ background: white;
7625
+ color: ${(props) => props.theme.colors.neutral800};
7626
+ transition: all 0.2s ease;
7627
+ box-sizing: border-box;
7628
+
7629
+ &:focus {
7630
+ outline: none;
7631
+ border-color: ${colors.whatsapp};
7632
+ box-shadow: 0 0 0 3px ${colors.whatsapp}20;
7633
+ }
7634
+
7635
+ &::placeholder {
7636
+ color: ${(props) => props.theme.colors.neutral400};
7637
+ }
7638
+ `;
7639
+ const WhatsAppTextarea = styled.textarea`
7640
+ width: 100%;
7641
+ padding: 14px 16px;
7642
+ border: 2px solid ${(props) => props.theme.colors.neutral200};
7643
+ border-radius: 12px;
7644
+ font-size: 15px;
7645
+ background: white;
7646
+ color: ${(props) => props.theme.colors.neutral800};
7647
+ transition: all 0.2s ease;
7648
+ box-sizing: border-box;
7649
+ resize: vertical;
7650
+ min-height: 80px;
7651
+ font-family: inherit;
7652
+
7653
+ &:focus {
7654
+ outline: none;
7655
+ border-color: ${colors.whatsapp};
7656
+ box-shadow: 0 0 0 3px ${colors.whatsapp}20;
7657
+ }
7658
+
7659
+ &::placeholder {
7660
+ color: ${(props) => props.theme.colors.neutral400};
7661
+ }
7662
+ `;
7663
+ const InputLabel = styled.label`
7664
+ display: flex;
7665
+ align-items: center;
7666
+ gap: 8px;
7667
+ font-size: 14px;
7668
+ font-weight: 600;
7669
+ color: ${colors.whatsappDark};
7670
+ margin-bottom: 8px;
7671
+ `;
7672
+ const InputHint = styled.span`
7673
+ font-size: 12px;
7674
+ color: ${(props) => props.theme.colors.neutral500};
7675
+ margin-top: 6px;
7676
+ display: block;
7677
+ `;
7678
+ const PhoneSymbol = styled.span`
7679
+ font-size: 16px;
7680
+ font-weight: 700;
7681
+ `;
7682
+ const MessageSymbol = styled.span`
7683
+ font-size: 16px;
7684
+ `;
7617
7685
  const UseCaseCard = styled(Box)`
7618
7686
  background: linear-gradient(135deg, ${colors.whatsappLight}, ${theme$3.colors.primary[50]});
7619
7687
  border: 2px solid ${colors.whatsapp};
@@ -8050,27 +8118,34 @@ const WhatsAppPage = () => {
8050
8118
  /* @__PURE__ */ jsxs(ContentCard, { style: { marginTop: "24px" }, children: [
8051
8119
  /* @__PURE__ */ jsx(Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Send Test Message" }),
8052
8120
  /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", style: { display: "block", marginBottom: "24px" }, children: "Test your WhatsApp connection by sending a message." }),
8053
- /* @__PURE__ */ jsx(TestSection, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 4, children: [
8054
- /* @__PURE__ */ jsxs(Field.Root, { children: [
8055
- /* @__PURE__ */ jsx(Field.Label, { children: "Phone Number" }),
8121
+ /* @__PURE__ */ jsxs(TestSection, { children: [
8122
+ /* @__PURE__ */ jsxs(Box, { style: { marginBottom: "20px" }, children: [
8123
+ /* @__PURE__ */ jsxs(InputLabel, { children: [
8124
+ /* @__PURE__ */ jsx(PhoneSymbol, { children: "+" }),
8125
+ "Phone Number"
8126
+ ] }),
8056
8127
  /* @__PURE__ */ jsx(
8057
- TextInput,
8128
+ WhatsAppInput,
8058
8129
  {
8059
- placeholder: "49123456789 (with country code, no +)",
8130
+ placeholder: "49123456789",
8060
8131
  value: testPhone,
8061
8132
  onChange: (e) => setTestPhone(e.target.value)
8062
8133
  }
8063
8134
  ),
8064
- /* @__PURE__ */ jsx(Field.Hint, { children: "Enter phone number with country code (e.g., 49 for Germany)" })
8135
+ /* @__PURE__ */ jsx(InputHint, { children: "Enter with country code, without + (e.g., 49 for Germany, 1 for USA)" })
8065
8136
  ] }),
8066
- /* @__PURE__ */ jsxs(Field.Root, { children: [
8067
- /* @__PURE__ */ jsx(Field.Label, { children: "Message (optional)" }),
8137
+ /* @__PURE__ */ jsxs(Box, { style: { marginBottom: "24px" }, children: [
8138
+ /* @__PURE__ */ jsxs(InputLabel, { children: [
8139
+ /* @__PURE__ */ jsx(MessageSymbol, { children: "@" }),
8140
+ "Message (optional)"
8141
+ ] }),
8068
8142
  /* @__PURE__ */ jsx(
8069
- TextInput,
8143
+ WhatsAppTextarea,
8070
8144
  {
8071
- placeholder: "Leave empty for default test message",
8145
+ placeholder: "Type your message here... or leave empty for default test message",
8072
8146
  value: testMessage,
8073
- onChange: (e) => setTestMessage(e.target.value)
8147
+ onChange: (e) => setTestMessage(e.target.value),
8148
+ rows: 3
8074
8149
  }
8075
8150
  )
8076
8151
  ] }),
@@ -8079,10 +8154,12 @@ const WhatsAppPage = () => {
8079
8154
  {
8080
8155
  onClick: handleSendTest,
8081
8156
  loading: sendingTest,
8157
+ disabled: !testPhone,
8158
+ style: { width: "100%" },
8082
8159
  children: "Send Test Message"
8083
8160
  }
8084
8161
  )
8085
- ] }) }),
8162
+ ] }),
8086
8163
  /* @__PURE__ */ jsx(Divider, { style: { margin: "24px 0" } }),
8087
8164
  /* @__PURE__ */ jsx(Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Using WhatsApp in Your Code" }),
8088
8165
  /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", style: { display: "block", marginBottom: "16px" }, children: "Use the WhatsApp service programmatically in your Strapi code." }),
@@ -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-58t1-H0G.js"))
68
+ Component: () => Promise.resolve().then(() => require("../_chunks/App-BTKgUbIs.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-ClJVoU2s.mjs")
67
+ Component: () => import("../_chunks/App-J8-8Wz0m.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.5.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.5.0";
5643
5643
  const require$$2 = {
5644
5644
  version
5645
5645
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.4.0",
2
+ "version": "2.6.0",
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,7 +70,7 @@
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",
73
+ "@strapi/sdk-plugin": "^5.4.0",
74
74
  "@strapi/strapi": "^5.33.4",
75
75
  "prettier": "^3.6.2",
76
76
  "react": "^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",