strapi-plugin-magic-link-v5 5.5.9 → 6.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 (58) hide show
  1. package/CHANGELOG.md +733 -0
  2. package/README.md +662 -928
  3. package/dist/admin/LicenseGuard-BgLA9go3.mjs +495 -0
  4. package/dist/admin/LicenseGuard-ewCjpc17.js +513 -0
  5. package/dist/admin/de-B1FNErPH.mjs +673 -0
  6. package/dist/admin/de-e75OECdq.js +673 -0
  7. package/dist/admin/en-CABKGbxH.js +673 -0
  8. package/dist/admin/en-HqDOFBCc.mjs +673 -0
  9. package/dist/admin/es-DpWl0Fax.js +673 -0
  10. package/dist/admin/es-jb94jqPR.mjs +673 -0
  11. package/dist/admin/fr-BQhLPvYw.js +673 -0
  12. package/dist/admin/fr-BseH1wrr.mjs +673 -0
  13. package/dist/admin/index-6ot9j1cN.js +5268 -0
  14. package/dist/admin/index-B390rccl.js +622 -0
  15. package/dist/admin/index-BPGKtruf.mjs +5266 -0
  16. package/dist/admin/index-BaTIQtnA.js +3869 -0
  17. package/dist/admin/index-CmG-93yx.js +141 -0
  18. package/dist/admin/index-DXe_ge4v.mjs +620 -0
  19. package/dist/admin/index-Dv5PVT1E.mjs +3867 -0
  20. package/dist/admin/index-k240ls6p.mjs +142 -0
  21. package/dist/admin/index.js +3 -3
  22. package/dist/admin/index.mjs +1 -2
  23. package/dist/admin/pt-CPkaveti.js +673 -0
  24. package/dist/admin/pt-DhlSCJn2.mjs +673 -0
  25. package/dist/admin/useUnsavedChangesGuard-BVZ4Mg4E.js +225 -0
  26. package/dist/admin/useUnsavedChangesGuard-QnkiZTLP.mjs +224 -0
  27. package/dist/server/i18n/de.json +32 -1
  28. package/dist/server/i18n/en.json +32 -1
  29. package/dist/server/i18n/es.json +32 -1
  30. package/dist/server/i18n/fr.json +32 -1
  31. package/dist/server/i18n/pt.json +32 -1
  32. package/dist/server/index.js +7092 -5971
  33. package/dist/server/index.mjs +7115 -5972
  34. package/package.json +42 -41
  35. package/strapi-admin.js +3 -1
  36. package/strapi-server.js +3 -2
  37. package/dist/_chunks/LicenseGuard-CiyjFnrw.js +0 -54
  38. package/dist/_chunks/LicenseGuard-DJ5fq2UZ.mjs +0 -55
  39. package/dist/_chunks/de-BSOk5suQ.js +0 -454
  40. package/dist/_chunks/de-CwhYs3O3.mjs +0 -454
  41. package/dist/_chunks/en-DnvSpXvu.js +0 -454
  42. package/dist/_chunks/en-gXXgGDV1.mjs +0 -454
  43. package/dist/_chunks/es-B-tnwByt.js +0 -407
  44. package/dist/_chunks/es-DG5gW3RZ.mjs +0 -407
  45. package/dist/_chunks/fr-BKo8t7Fx.js +0 -407
  46. package/dist/_chunks/fr-BQn1OHOR.mjs +0 -407
  47. package/dist/_chunks/index-01GHNxSr.js +0 -307
  48. package/dist/_chunks/index-5jsDgD-q.mjs +0 -330
  49. package/dist/_chunks/index-BWuj-5WE.js +0 -5068
  50. package/dist/_chunks/index-Bj3H_Z4B.js +0 -142
  51. package/dist/_chunks/index-CC4Eu9Dm.js +0 -332
  52. package/dist/_chunks/index-Csyi13vd.mjs +0 -2891
  53. package/dist/_chunks/index-DJqXiiP1.js +0 -2893
  54. package/dist/_chunks/index-DQUYFsLT.mjs +0 -143
  55. package/dist/_chunks/index-Dufv-daf.mjs +0 -305
  56. package/dist/_chunks/index-szeYJKpN.mjs +0 -5066
  57. package/dist/_chunks/pt-CjEkXBAz.js +0 -407
  58. package/dist/_chunks/pt-trziAOzT.mjs +0 -407
@@ -1,142 +0,0 @@
1
- "use strict";
2
- const react = require("react");
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const icons = require("@strapi/icons");
5
- const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
6
- const v = glob[path];
7
- if (v) {
8
- return typeof v === "function" ? v() : Promise.resolve(v);
9
- }
10
- return new Promise((_, reject) => {
11
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
12
- reject.bind(
13
- null,
14
- new Error(
15
- "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
16
- )
17
- )
18
- );
19
- });
20
- };
21
- const strapi = {
22
- name: "magic-link"
23
- };
24
- const pluginPkg = {
25
- strapi
26
- };
27
- const PLUGIN_ID = "magic-link";
28
- const Initializer = ({ setPlugin }) => {
29
- const ref = react.useRef(setPlugin);
30
- react.useEffect(() => {
31
- ref.current(PLUGIN_ID);
32
- }, []);
33
- return null;
34
- };
35
- const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Key, {});
36
- const pluginPermissions = {
37
- access: [{ action: "plugin::magic-link.access", subject: null }],
38
- readSettings: [{ action: "plugin::magic-link.settings.read", subject: null }]
39
- };
40
- const getTrad = (id) => {
41
- if (id.startsWith(`${PLUGIN_ID}.`)) {
42
- return id;
43
- }
44
- return `${PLUGIN_ID}.${id}`;
45
- };
46
- const name = pluginPkg.strapi.name;
47
- const index = {
48
- register(app) {
49
- app.registerPlugin({
50
- id: PLUGIN_ID,
51
- initializer: Initializer,
52
- isReady: false,
53
- name
54
- });
55
- app.addMenuLink({
56
- to: `plugins/${PLUGIN_ID}/tokens`,
57
- icon: PluginIcon,
58
- intlLabel: {
59
- id: getTrad("tokens.title"),
60
- defaultMessage: "Magic Link Tokens"
61
- },
62
- Component: () => Promise.resolve().then(() => require(
63
- /* webpackChunkName: "magic-link-tokens" */
64
- "./index-BWuj-5WE.js"
65
- )),
66
- permissions: pluginPermissions.access
67
- });
68
- app.createSettingSection(
69
- {
70
- id: PLUGIN_ID,
71
- intlLabel: {
72
- id: getTrad("Header.Settings"),
73
- defaultMessage: "Magic Link"
74
- }
75
- },
76
- [
77
- {
78
- intlLabel: {
79
- id: getTrad("Form.title.Settings"),
80
- defaultMessage: "Settings"
81
- },
82
- id: "magic-link-settings",
83
- to: `${PLUGIN_ID}/config`,
84
- Component: () => Promise.resolve().then(() => require(
85
- /* webpackChunkName: "magic-link-settings" */
86
- "./index-DJqXiiP1.js"
87
- )),
88
- permissions: pluginPermissions.readSettings
89
- },
90
- {
91
- intlLabel: {
92
- id: getTrad("Form.title.License"),
93
- defaultMessage: "License"
94
- },
95
- id: "magic-link-license",
96
- to: `${PLUGIN_ID}/license`,
97
- Component: () => Promise.resolve().then(() => require(
98
- /* webpackChunkName: "magic-link-license" */
99
- "./index-01GHNxSr.js"
100
- )),
101
- permissions: pluginPermissions.access
102
- },
103
- {
104
- intlLabel: {
105
- id: getTrad("Form.title.WhatsApp"),
106
- defaultMessage: "WhatsApp"
107
- },
108
- id: "magic-link-whatsapp",
109
- to: `${PLUGIN_ID}/whatsapp`,
110
- Component: () => Promise.resolve().then(() => require(
111
- /* webpackChunkName: "magic-link-whatsapp" */
112
- "./index-CC4Eu9Dm.js"
113
- )),
114
- permissions: pluginPermissions.access
115
- }
116
- ]
117
- );
118
- },
119
- bootstrap() {
120
- },
121
- async registerTrads({ locales }) {
122
- const importedTrads = await Promise.all(
123
- locales.map((locale) => {
124
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-BSOk5suQ.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-DnvSpXvu.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-B-tnwByt.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-BKo8t7Fx.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CjEkXBAz.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
125
- return {
126
- data,
127
- locale
128
- };
129
- }).catch(() => {
130
- return {
131
- data: {},
132
- locale
133
- };
134
- });
135
- })
136
- );
137
- return Promise.resolve(importedTrads);
138
- }
139
- };
140
- exports.PLUGIN_ID = PLUGIN_ID;
141
- exports.getTrad = getTrad;
142
- exports.index = index;
@@ -1,332 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const react = require("react");
5
- const styled = require("styled-components");
6
- const reactIntl = require("react-intl");
7
- const designSystem = require("@strapi/design-system");
8
- const icons = require("@strapi/icons");
9
- const admin = require("@strapi/strapi/admin");
10
- const index = require("./index-Bj3H_Z4B.js");
11
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
12
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
13
- const theme = {
14
- colors: {
15
- primary: { 700: "#075985", 100: "#E0F2FE", 50: "#F0F9FF" },
16
- success: { 600: "#16A34A", 700: "#15803D", 100: "#DCFCE7" },
17
- danger: { 700: "#B91C1C", 100: "#FEE2E2" },
18
- warning: { 700: "#A16207", 100: "#FEF3C7", 50: "#FFFBEB" },
19
- whatsapp: { 600: "#25D366" },
20
- neutral: { 50: "#F9FAFB", 100: "#F3F4F6", 200: "#E5E7EB", 800: "#1F2937" }
21
- },
22
- shadows: { md: "0 4px 6px rgba(0,0,0,0.1)" },
23
- borderRadius: { md: "8px", lg: "12px" }
24
- };
25
- const Container = styled__default.default(designSystem.Box)`
26
- max-width: 900px;
27
- margin: 0 auto;
28
- padding: 32px;
29
- `;
30
- const Card = styled__default.default(designSystem.Box)`
31
- background: white;
32
- border-radius: ${theme.borderRadius.lg};
33
- box-shadow: ${theme.shadows.md};
34
- padding: 24px;
35
- margin-bottom: 24px;
36
- `;
37
- const QRCodeContainer = styled__default.default(designSystem.Box)`
38
- display: flex;
39
- justify-content: center;
40
- align-items: center;
41
- padding: 24px;
42
- background: ${theme.colors.neutral[50]};
43
- border-radius: ${theme.borderRadius.lg};
44
- border: 2px dashed ${theme.colors.neutral[200]};
45
- min-height: 280px;
46
-
47
- img {
48
- max-width: 256px;
49
- border-radius: ${theme.borderRadius.md};
50
- }
51
- `;
52
- const StatusBadge = styled__default.default(designSystem.Badge)`
53
- background: ${(props) => {
54
- switch (props.$status) {
55
- case "connected":
56
- return theme.colors.success[100];
57
- case "connecting":
58
- return theme.colors.warning[100];
59
- case "qr_pending":
60
- return theme.colors.primary[100];
61
- default:
62
- return theme.colors.danger[100];
63
- }
64
- }};
65
- color: ${(props) => {
66
- switch (props.$status) {
67
- case "connected":
68
- return theme.colors.success[700];
69
- case "connecting":
70
- return theme.colors.warning[700];
71
- case "qr_pending":
72
- return theme.colors.primary[700];
73
- default:
74
- return theme.colors.danger[700];
75
- }
76
- }};
77
- font-weight: 600;
78
- padding: 8px 16px;
79
- font-size: 14px;
80
- `;
81
- const WhatsAppIcon = styled__default.default.div`
82
- width: 48px;
83
- height: 48px;
84
- border-radius: 50%;
85
- background: ${theme.colors.whatsapp[600]};
86
- display: flex;
87
- align-items: center;
88
- justify-content: center;
89
- color: white;
90
- font-size: 24px;
91
- `;
92
- const WhatsAppPage = () => {
93
- const { formatMessage } = reactIntl.useIntl();
94
- const { toggleNotification } = admin.useNotification();
95
- const { get, post } = admin.useFetchClient();
96
- const [loading, setLoading] = react.useState(true);
97
- const [status, setStatus] = react.useState({
98
- available: false,
99
- status: "disconnected",
100
- qrCode: null,
101
- session: null,
102
- delegatedTo: null
103
- });
104
- const [settings, setSettings] = react.useState({
105
- whatsapp_enabled: false,
106
- whatsapp_app_name: "Magic Link"
107
- });
108
- const [testPhone, setTestPhone] = react.useState("");
109
- const [testMessage, setTestMessage] = react.useState("");
110
- const [sending, setSending] = react.useState(false);
111
- const [connecting, setConnecting] = react.useState(false);
112
- const fetchStatus = react.useCallback(async () => {
113
- try {
114
- const response = await get("/magic-link/whatsapp/status");
115
- setStatus(response.data);
116
- } catch (error) {
117
- console.error("Error fetching WhatsApp status:", error);
118
- }
119
- }, [get]);
120
- const fetchSettings = react.useCallback(async () => {
121
- try {
122
- const response = await get("/magic-link/settings");
123
- setSettings(response.data || {});
124
- } catch (error) {
125
- console.error("Error fetching settings:", error);
126
- }
127
- }, [get]);
128
- react.useEffect(() => {
129
- const init = async () => {
130
- setLoading(true);
131
- await Promise.all([fetchStatus(), fetchSettings()]);
132
- setLoading(false);
133
- };
134
- init();
135
- }, [fetchStatus, fetchSettings]);
136
- react.useEffect(() => {
137
- if (status.status === "connecting" || status.status === "qr_pending") {
138
- const interval = setInterval(fetchStatus, 3e3);
139
- return () => clearInterval(interval);
140
- }
141
- }, [status.status, fetchStatus]);
142
- const handleConnect = async () => {
143
- setConnecting(true);
144
- try {
145
- await post("/magic-link/whatsapp/connect");
146
- await fetchStatus();
147
- toggleNotification({
148
- type: "success",
149
- message: formatMessage({ id: index.getTrad("whatsapp.notifications.connecting") })
150
- });
151
- } catch (error) {
152
- toggleNotification({
153
- type: "warning",
154
- message: error.response?.data?.error?.message || "Connection failed"
155
- });
156
- }
157
- setConnecting(false);
158
- };
159
- const handleDisconnect = async () => {
160
- try {
161
- await post("/magic-link/whatsapp/disconnect");
162
- await fetchStatus();
163
- toggleNotification({
164
- type: "success",
165
- message: formatMessage({ id: index.getTrad("whatsapp.notifications.disconnected") })
166
- });
167
- } catch (error) {
168
- toggleNotification({
169
- type: "warning",
170
- message: "Disconnect failed"
171
- });
172
- }
173
- };
174
- const handleTestMessage = async () => {
175
- if (!testPhone) {
176
- toggleNotification({
177
- type: "warning",
178
- message: formatMessage({ id: index.getTrad("whatsapp.notifications.phoneRequired") })
179
- });
180
- return;
181
- }
182
- setSending(true);
183
- try {
184
- const response = await post("/magic-link/whatsapp/test-message", {
185
- phoneNumber: testPhone,
186
- message: testMessage || void 0
187
- });
188
- if (response.data.success) {
189
- toggleNotification({
190
- type: "success",
191
- message: formatMessage({ id: index.getTrad("whatsapp.notifications.messageSent") })
192
- });
193
- setTestMessage("");
194
- } else {
195
- toggleNotification({
196
- type: "warning",
197
- message: response.data.error || "Failed to send"
198
- });
199
- }
200
- } catch (error) {
201
- toggleNotification({
202
- type: "warning",
203
- message: error.response?.data?.error?.message || "Failed to send message"
204
- });
205
- }
206
- setSending(false);
207
- };
208
- const getStatusLabel = () => {
209
- switch (status.status) {
210
- case "connected":
211
- return "Connected";
212
- case "connecting":
213
- return "Connecting...";
214
- case "qr_pending":
215
- return "Scan QR Code";
216
- case "not_installed":
217
- return "Baileys not installed";
218
- default:
219
- return "Disconnected";
220
- }
221
- };
222
- if (loading) {
223
- return /* @__PURE__ */ jsxRuntime.jsx(Container, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}) }) });
224
- }
225
- return /* @__PURE__ */ jsxRuntime.jsxs(Container, { children: [
226
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 6, children: [
227
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-start", marginBottom: 2, children: [
228
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 4, children: [
229
- /* @__PURE__ */ jsxRuntime.jsx(WhatsAppIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.Phone, {}) }),
230
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", fontWeight: "bold", children: formatMessage({ id: index.getTrad("whatsapp.title") }) })
231
- ] }),
232
- /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { $status: status.status, children: getStatusLabel() })
233
- ] }),
234
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", style: { marginLeft: "64px" }, children: formatMessage({ id: index.getTrad("whatsapp.subtitle") }) })
235
- ] }),
236
- status.delegatedTo === "magic-mail" && /* @__PURE__ */ jsxRuntime.jsxs(Card, { style: { background: theme.colors.primary[50], border: `2px solid ${theme.colors.primary[100]}` }, children: [
237
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { display: "block", marginBottom: "12px" }, children: "WhatsApp managed by Magic-Mail" }),
238
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { display: "block", lineHeight: "1.6", marginBottom: "16px" }, children: "Magic-Mail plugin is installed and handles the WhatsApp connection. You only need to scan the QR code once in Magic-Mail, and both plugins will share the same WhatsApp session." }),
239
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { padding: "12px", background: theme.colors.neutral[100], borderRadius: theme.borderRadius.md }, children: [
240
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Go to: Plugins → Magic-Mail → WhatsApp" }),
241
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: "All WhatsApp settings and connection management is done there." })
242
- ] })
243
- ] }),
244
- !status.available && !status.delegatedTo && /* @__PURE__ */ jsxRuntime.jsxs(Card, { style: { background: theme.colors.warning[50], border: `2px solid ${theme.colors.warning[100]}` }, children: [
245
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { display: "block", marginBottom: "12px" }, children: formatMessage({ id: index.getTrad("whatsapp.notInstalled.title") }) }),
246
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { display: "block", lineHeight: "1.6", marginBottom: "16px" }, children: formatMessage({ id: index.getTrad("whatsapp.notInstalled.description") }) }),
247
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { padding: "12px", background: theme.colors.neutral[100], borderRadius: theme.borderRadius.md }, children: /* @__PURE__ */ jsxRuntime.jsx("code", { style: { fontSize: "14px" }, children: "npm install @whiskeysockets/baileys pino" }) })
248
- ] }),
249
- status.available && !status.delegatedTo && /* @__PURE__ */ jsxRuntime.jsxs(Card, { children: [
250
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", marginBottom: 4, children: formatMessage({ id: index.getTrad("whatsapp.connection.title") }) }),
251
- (status.status === "qr_pending" || status.status === "disconnected" || status.status === "connecting") && /* @__PURE__ */ jsxRuntime.jsx(QRCodeContainer, { children: status.qrCode ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { textAlign: "center", children: [
252
- /* @__PURE__ */ jsxRuntime.jsx("img", { src: status.qrCode, alt: "WhatsApp QR Code" }),
253
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { marginTop: "16px", display: "block" }, children: formatMessage({ id: index.getTrad("whatsapp.qr.instruction") }) })
254
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 4, children: [
255
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: status.status === "connecting" ? formatMessage({ id: index.getTrad("whatsapp.connection.generating") }) : formatMessage({ id: index.getTrad("whatsapp.connection.clickToConnect") }) }),
256
- status.status !== "connecting" && /* @__PURE__ */ jsxRuntime.jsx(
257
- designSystem.Button,
258
- {
259
- onClick: handleConnect,
260
- loading: connecting,
261
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Phone, {}),
262
- style: { background: theme.colors.whatsapp[600] },
263
- children: formatMessage({ id: index.getTrad("whatsapp.actions.connect") })
264
- }
265
- )
266
- ] }) }),
267
- status.status === "connected" && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
268
- /* @__PURE__ */ jsxRuntime.jsxs(
269
- designSystem.Flex,
270
- {
271
- alignItems: "flex-start",
272
- justifyContent: "space-between",
273
- padding: 4,
274
- background: "success100",
275
- style: { borderRadius: theme.borderRadius.md, marginBottom: "16px" },
276
- children: [
277
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-start", gap: 3, children: [
278
- /* @__PURE__ */ jsxRuntime.jsx(icons.Check, { style: { color: theme.colors.success[600], marginTop: "4px" } }),
279
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
280
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: formatMessage({ id: index.getTrad("whatsapp.connected.title") }) }),
281
- status.session && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { display: "block" }, children: [
282
- status.session.phoneNumber,
283
- " • ",
284
- status.session.name || "WhatsApp User"
285
- ] })
286
- ] })
287
- ] }),
288
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "danger", onClick: handleDisconnect, size: "S", children: formatMessage({ id: index.getTrad("whatsapp.actions.disconnect") }) })
289
- ]
290
- }
291
- ),
292
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { marginTop: "24px" }, children: [
293
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { display: "block", marginBottom: "16px" }, children: formatMessage({ id: index.getTrad("whatsapp.test.title") }) }),
294
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "flex-start", children: [
295
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(
296
- designSystem.TextInput,
297
- {
298
- placeholder: "491234567890",
299
- value: testPhone,
300
- onChange: (e) => setTestPhone(e.target.value)
301
- }
302
- ) }),
303
- /* @__PURE__ */ jsxRuntime.jsx(
304
- designSystem.Button,
305
- {
306
- onClick: handleTestMessage,
307
- loading: sending,
308
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Message, {}),
309
- children: formatMessage({ id: index.getTrad("whatsapp.actions.sendTest") })
310
- }
311
- )
312
- ] })
313
- ] })
314
- ] }),
315
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: fetchStatus, startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}), children: formatMessage({ id: index.getTrad("whatsapp.actions.refresh") }) }) })
316
- ] }),
317
- !status.delegatedTo && /* @__PURE__ */ jsxRuntime.jsxs(Card, { style: { background: theme.colors.primary[50], border: `2px solid ${theme.colors.primary[100]}` }, children: [
318
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { display: "block", marginBottom: "12px" }, children: formatMessage({ id: index.getTrad("whatsapp.info.title") }) }),
319
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral700", style: { display: "block", lineHeight: "1.6", marginBottom: "16px" }, children: formatMessage({ id: index.getTrad("whatsapp.info.description") }) }),
320
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { marginTop: "16px" }, children: [
321
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: formatMessage({ id: index.getTrad("whatsapp.info.apiExample") }) }),
322
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { padding: "12px", background: theme.colors.neutral[800], borderRadius: theme.borderRadius.md, color: "#fff", fontFamily: "monospace", fontSize: "13px" }, children: /* @__PURE__ */ jsxRuntime.jsx("pre", { style: { margin: 0, whiteSpace: "pre-wrap" }, children: `POST /api/magic-link/send-link
323
- {
324
- "email": "user@example.com",
325
- "phoneNumber": "491234567890",
326
- "delivery": "whatsapp"
327
- }` }) })
328
- ] })
329
- ] })
330
- ] });
331
- };
332
- exports.default = WhatsAppPage;