strapi-plugin-magic-mail 3.0.4 → 3.1.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.
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
5
4
  const reactRouterDom = require("react-router-dom");
6
5
  const designSystem = require("@strapi/design-system");
7
6
  const admin = require("@strapi/strapi/admin");
8
7
  const outline = require("@heroicons/react/24/outline");
8
+ const React = require("react");
9
9
  const styled = require("styled-components");
10
10
  const icons = require("@strapi/icons");
11
11
  const StyledButtons = require("./StyledButtons-jHF7TXal.js");
@@ -84,7 +84,7 @@ const theme$3 = {
84
84
  xl: "16px"
85
85
  }
86
86
  };
87
- const fadeIn$5 = styled.keyframes`
87
+ const fadeIn$4 = styled.keyframes`
88
88
  from {
89
89
  opacity: 0;
90
90
  transform: translateY(10px);
@@ -94,7 +94,7 @@ const fadeIn$5 = styled.keyframes`
94
94
  transform: translateY(0);
95
95
  }
96
96
  `;
97
- const pulse$3 = styled.keyframes`
97
+ const pulse$2 = styled.keyframes`
98
98
  0%, 100% {
99
99
  transform: scale(1);
100
100
  }
@@ -112,7 +112,7 @@ const slideIn = styled.keyframes`
112
112
  opacity: 1;
113
113
  }
114
114
  `;
115
- const colors$1 = {
115
+ const colors = {
116
116
  primary: "#4945ff",
117
117
  // Strapi Primary Blue
118
118
  primaryLight: "rgba(73, 69, 255, 0.06)",
@@ -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$5} 0.4s ease;
133
+ animation: ${fadeIn$4} 0.4s ease;
134
134
 
135
135
  &::after {
136
136
  content: '';
@@ -139,11 +139,11 @@ const StepHeader = styled__default.default(designSystem.Box)`
139
139
  left: -24px;
140
140
  right: -24px;
141
141
  height: 1px;
142
- background: linear-gradient(90deg, transparent, ${colors$1.border}, transparent);
142
+ background: linear-gradient(90deg, transparent, ${colors.border}, transparent);
143
143
  }
144
144
  `;
145
145
  const StepTitle = styled__default.default(designSystem.Typography)`
146
- color: ${colors$1.text};
146
+ color: ${colors.text};
147
147
  font-size: 24px;
148
148
  font-weight: 600;
149
149
  margin-bottom: 8px;
@@ -152,11 +152,11 @@ const StepTitle = styled__default.default(designSystem.Typography)`
152
152
  gap: 12px;
153
153
  `;
154
154
  const StepSubtitle = styled__default.default(designSystem.Typography)`
155
- color: ${colors$1.textLight};
155
+ color: ${colors.textLight};
156
156
  font-size: 14px;
157
157
  line-height: 1.5;
158
158
  `;
159
- const StepperContainer$1 = styled__default.default(designSystem.Box)`
159
+ const StepperContainer = styled__default.default(designSystem.Box)`
160
160
  display: flex;
161
161
  align-items: flex-start;
162
162
  justify-content: center;
@@ -166,7 +166,7 @@ const StepperContainer$1 = styled__default.default(designSystem.Box)`
166
166
  position: relative;
167
167
  padding: 0 40px;
168
168
  `;
169
- const StepWrapper$1 = styled__default.default.div`
169
+ const StepWrapper = styled__default.default.div`
170
170
  flex: 1;
171
171
  display: flex;
172
172
  flex-direction: column;
@@ -180,18 +180,18 @@ const StepWrapper$1 = styled__default.default.div`
180
180
  left: 50%;
181
181
  width: 100%;
182
182
  height: 3px;
183
- background: ${(props) => props.$completed ? colors$1.success : colors$1.neutralLight};
183
+ background: ${(props) => props.$completed ? colors.success : colors.neutralLight};
184
184
  transition: all 0.4s ease;
185
185
  z-index: 0;
186
186
  }
187
187
  `;
188
- const StepDot$1 = styled__default.default.div`
188
+ const StepDot = styled__default.default.div`
189
189
  width: 56px;
190
190
  height: 56px;
191
191
  border-radius: 50%;
192
- background: ${(props) => props.$active ? colors$1.primary : props.$completed ? colors$1.success : props.theme.colors.neutral0};
193
- color: ${(props) => props.$active || props.$completed ? "#ffffff" : colors$1.textLight};
194
- border: 4px solid ${(props) => props.$active ? colors$1.primary : props.$completed ? colors$1.success : colors$1.border};
192
+ background: ${(props) => props.$active ? colors.primary : props.$completed ? colors.success : props.theme.colors.neutral0};
193
+ color: ${(props) => props.$active || props.$completed ? "#ffffff" : colors.textLight};
194
+ border: 4px solid ${(props) => props.$active ? colors.primary : props.$completed ? colors.success : colors.border};
195
195
  display: flex;
196
196
  align-items: center;
197
197
  justify-content: center;
@@ -201,20 +201,20 @@ const StepDot$1 = styled__default.default.div`
201
201
  position: relative;
202
202
  z-index: 1;
203
203
  cursor: ${(props) => props.$completed ? "pointer" : "default"};
204
- box-shadow: ${(props) => props.$active ? `0 4px 16px ${colors$1.primary}40, 0 0 0 8px ${colors$1.primaryLight}` : props.$completed ? `0 4px 12px ${colors$1.success}30` : "0 2px 8px rgba(0,0,0,0.08)"};
204
+ box-shadow: ${(props) => props.$active ? `0 4px 16px ${colors.primary}40, 0 0 0 8px ${colors.primaryLight}` : props.$completed ? `0 4px 12px ${colors.success}30` : "0 2px 8px rgba(0,0,0,0.08)"};
205
205
 
206
206
  ${(props) => props.$active && styled.css`
207
- animation: ${pulse$3} 2s infinite;
207
+ animation: ${pulse$2} 2s infinite;
208
208
  `}
209
209
 
210
210
  &:hover {
211
211
  transform: ${(props) => props.$completed ? "scale(1.1)" : props.$active ? "scale(1.05)" : "scale(1)"};
212
212
  }
213
213
  `;
214
- const StepLabel$1 = styled__default.default(designSystem.Typography)`
214
+ const StepLabel = styled__default.default(designSystem.Typography)`
215
215
  margin-top: 12px;
216
216
  font-size: 13px;
217
- color: ${(props) => props.$active ? colors$1.primary : props.$completed ? colors$1.success : colors$1.textLight};
217
+ color: ${(props) => props.$active ? colors.primary : props.$completed ? colors.success : colors.textLight};
218
218
  white-space: nowrap;
219
219
  font-weight: ${(props) => props.$active ? 600 : 500};
220
220
  text-align: center;
@@ -225,13 +225,13 @@ 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$5} 0.4s ease;
228
+ animation: ${fadeIn$4} 0.4s ease;
229
229
 
230
230
  &::after {
231
231
  content: '';
232
232
  flex: 1;
233
233
  height: 1px;
234
- background: linear-gradient(90deg, ${colors$1.border}, transparent);
234
+ background: linear-gradient(90deg, ${colors.border}, transparent);
235
235
  }
236
236
  `;
237
237
  const ProviderCategoryLabel = styled__default.default(designSystem.Typography)`
@@ -239,15 +239,15 @@ const ProviderCategoryLabel = styled__default.default(designSystem.Typography)`
239
239
  font-weight: 600;
240
240
  letter-spacing: 0.08em;
241
241
  text-transform: uppercase;
242
- color: ${colors$1.textLight};
242
+ color: ${colors.textLight};
243
243
  `;
244
244
  const ProviderCategoryHint = styled__default.default.span`
245
245
  font-size: 11px;
246
246
  font-weight: 500;
247
247
  padding: 3px 10px;
248
248
  border-radius: 999px;
249
- background: ${colors$1.primaryLight};
250
- color: ${colors$1.primary};
249
+ background: ${colors.primaryLight};
250
+ color: ${colors.primary};
251
251
  letter-spacing: 0.02em;
252
252
  text-transform: none;
253
253
  `;
@@ -267,8 +267,8 @@ const ProvidersGrid = styled__default.default(designSystem.Box)`
267
267
  }
268
268
  `;
269
269
  const ProviderCard = styled__default.default(designSystem.Box)`
270
- background: ${(props) => props.$selected ? `linear-gradient(180deg, ${colors$1.successLight}, rgba(92, 177, 118, 0.04))` : "var(--colors-neutral100, rgba(255,255,255,0.02))"};
271
- border: 1.5px solid ${(props) => props.$selected ? colors$1.success : colors$1.border};
270
+ background: ${(props) => props.$selected ? `linear-gradient(180deg, ${colors.successLight}, rgba(92, 177, 118, 0.04))` : "var(--colors-neutral100, rgba(255,255,255,0.02))"};
271
+ border: 1.5px solid ${(props) => props.$selected ? colors.success : colors.border};
272
272
  border-radius: 14px;
273
273
  padding: 22px 20px 20px;
274
274
  cursor: pointer;
@@ -294,7 +294,7 @@ const ProviderCard = styled__default.default(designSystem.Box)`
294
294
  &:hover {
295
295
  transform: translateY(-3px);
296
296
  box-shadow: 0 10px 28px rgba(73, 69, 255, 0.18);
297
- border-color: ${(props) => props.$selected ? colors$1.success : colors$1.primary};
297
+ border-color: ${(props) => props.$selected ? colors.success : colors.primary};
298
298
 
299
299
  &::before {
300
300
  opacity: 1;
@@ -302,12 +302,12 @@ const ProviderCard = styled__default.default(designSystem.Box)`
302
302
  }
303
303
 
304
304
  &:focus-visible {
305
- outline: 2px solid ${colors$1.primary};
305
+ outline: 2px solid ${colors.primary};
306
306
  outline-offset: 2px;
307
307
  }
308
308
 
309
309
  ${(props) => props.$selected && styled.css`
310
- box-shadow: 0 0 0 1px ${colors$1.success}, 0 10px 28px rgba(92, 177, 118, 0.18);
310
+ box-shadow: 0 0 0 1px ${colors.success}, 0 10px 28px rgba(92, 177, 118, 0.18);
311
311
 
312
312
  &::after {
313
313
  content: '✓';
@@ -316,7 +316,7 @@ const ProviderCard = styled__default.default(designSystem.Box)`
316
316
  right: 12px;
317
317
  width: 24px;
318
318
  height: 24px;
319
- background: ${colors$1.success};
319
+ background: ${colors.success};
320
320
  color: #fff;
321
321
  border-radius: 50%;
322
322
  display: flex;
@@ -341,7 +341,7 @@ const ProviderIcon = styled__default.default.div`
341
341
  justify-content: center;
342
342
  font-size: ${(props) => props.$fontSize || "22px"};
343
343
  font-weight: 700;
344
- color: ${(props) => props.$color || colors$1.primary};
344
+ color: ${(props) => props.$color || colors.primary};
345
345
  box-shadow: 0 4px 14px ${(props) => props.$shadowColor || "rgba(73, 69, 255, 0.25)"};
346
346
  flex-shrink: 0;
347
347
  `;
@@ -355,22 +355,22 @@ const ProviderName = styled__default.default(designSystem.Typography)`
355
355
  font-weight: 600;
356
356
  font-size: 16px;
357
357
  line-height: 1.25;
358
- color: ${colors$1.text};
358
+ color: ${colors.text};
359
359
  margin: 0;
360
360
  `;
361
361
  const ProviderTagline = styled__default.default(designSystem.Typography)`
362
362
  font-size: 12.5px;
363
363
  line-height: 1.4;
364
- color: ${colors$1.textLight};
364
+ color: ${colors.textLight};
365
365
  margin: 0;
366
366
  `;
367
367
  const InfoAlert = styled__default.default(designSystem.Alert)`
368
- background: ${colors$1.primaryLight};
369
- border: 1px solid ${colors$1.primary}33;
370
- animation: ${fadeIn$5} 0.4s ease;
368
+ background: ${colors.primaryLight};
369
+ border: 1px solid ${colors.primary}33;
370
+ animation: ${fadeIn$4} 0.4s ease;
371
371
 
372
372
  svg {
373
- color: ${colors$1.primary};
373
+ color: ${colors.primary};
374
374
  }
375
375
  `;
376
376
  const FormSection = styled__default.default(designSystem.Box)`
@@ -390,7 +390,7 @@ const FullWidthField = styled__default.default(designSystem.Box)`
390
390
  }
391
391
  `;
392
392
  const SectionTitle = styled__default.default(designSystem.Typography)`
393
- color: ${colors$1.text};
393
+ color: ${colors.text};
394
394
  font-weight: 600;
395
395
  font-size: 16px;
396
396
  margin-bottom: 16px;
@@ -888,13 +888,13 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
888
888
  currentStep === 4 && "Set rate limits and priority for this account"
889
889
  ] })
890
890
  ] }),
891
- /* @__PURE__ */ jsxRuntime.jsx(StepperContainer$1, { children: [1, 2, 3, 4].map((step) => /* @__PURE__ */ jsxRuntime.jsxs(
892
- StepWrapper$1,
891
+ /* @__PURE__ */ jsxRuntime.jsx(StepperContainer, { children: [1, 2, 3, 4].map((step) => /* @__PURE__ */ jsxRuntime.jsxs(
892
+ StepWrapper,
893
893
  {
894
894
  $completed: currentStep > step,
895
895
  children: [
896
896
  /* @__PURE__ */ jsxRuntime.jsx(
897
- StepDot$1,
897
+ StepDot,
898
898
  {
899
899
  $active: currentStep === step,
900
900
  $completed: currentStep > step,
@@ -903,7 +903,7 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
903
903
  }
904
904
  ),
905
905
  /* @__PURE__ */ jsxRuntime.jsx(
906
- StepLabel$1,
906
+ StepLabel,
907
907
  {
908
908
  $active: currentStep === step,
909
909
  $completed: currentStep > step,
@@ -1295,7 +1295,7 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1295
1295
  background: "neutral100",
1296
1296
  hasRadius: true,
1297
1297
  style: {
1298
- border: `1px solid ${colors$1.border}`,
1298
+ border: `1px solid ${colors.border}`,
1299
1299
  borderRadius: "8px"
1300
1300
  },
1301
1301
  children: [
@@ -1312,7 +1312,7 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1312
1312
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
1313
1313
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "1." }),
1314
1314
  " Go to ",
1315
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://console.cloud.google.com", target: "_blank", rel: "noopener noreferrer", style: { color: colors$1.primary, textDecoration: "underline" }, children: "console.cloud.google.com" })
1315
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://console.cloud.google.com", target: "_blank", rel: "noopener noreferrer", style: { color: colors.primary, textDecoration: "underline" }, children: "console.cloud.google.com" })
1316
1316
  ] }),
1317
1317
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
1318
1318
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "2." }),
@@ -1338,7 +1338,7 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1338
1338
  fontFamily: "monospace",
1339
1339
  fontSize: "13px",
1340
1340
  wordBreak: "break-all",
1341
- border: `1px solid ${colors$1.border}`
1341
+ border: `1px solid ${colors.border}`
1342
1342
  },
1343
1343
  children: [
1344
1344
  window.location.origin,
@@ -1439,7 +1439,7 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1439
1439
  background: "neutral100",
1440
1440
  hasRadius: true,
1441
1441
  style: {
1442
- border: `1px solid ${colors$1.border}`,
1442
+ border: `1px solid ${colors.border}`,
1443
1443
  borderRadius: "8px"
1444
1444
  },
1445
1445
  children: [
@@ -1456,7 +1456,7 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1456
1456
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
1457
1457
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "1." }),
1458
1458
  " Go to ",
1459
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://portal.azure.com", target: "_blank", rel: "noopener noreferrer", style: { color: colors$1.primary, textDecoration: "underline" }, children: "portal.azure.com" })
1459
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://portal.azure.com", target: "_blank", rel: "noopener noreferrer", style: { color: colors.primary, textDecoration: "underline" }, children: "portal.azure.com" })
1460
1460
  ] }),
1461
1461
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
1462
1462
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "2." }),
@@ -1490,8 +1490,8 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1490
1490
  fontFamily: "monospace",
1491
1491
  fontSize: "13px",
1492
1492
  wordBreak: "break-all",
1493
- color: colors$1.textSecondary,
1494
- border: `1px solid ${colors$1.border}`
1493
+ color: colors.textSecondary,
1494
+ border: `1px solid ${colors.border}`
1495
1495
  },
1496
1496
  children: `${window.location.origin}/magic-mail/oauth/microsoft/callback`
1497
1497
  }
@@ -1616,7 +1616,7 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1616
1616
  background: "neutral100",
1617
1617
  hasRadius: true,
1618
1618
  style: {
1619
- border: `1px solid ${colors$1.border}`,
1619
+ border: `1px solid ${colors.border}`,
1620
1620
  borderRadius: "8px"
1621
1621
  },
1622
1622
  children: [
@@ -1633,7 +1633,7 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1633
1633
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
1634
1634
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "1." }),
1635
1635
  " Go to ",
1636
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://developer.yahoo.com/apps/", target: "_blank", rel: "noopener noreferrer", style: { color: colors$1.primary, textDecoration: "underline" }, children: "developer.yahoo.com/apps" })
1636
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://developer.yahoo.com/apps/", target: "_blank", rel: "noopener noreferrer", style: { color: colors.primary, textDecoration: "underline" }, children: "developer.yahoo.com/apps" })
1637
1637
  ] }),
1638
1638
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
1639
1639
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "2." }),
@@ -1659,8 +1659,8 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1659
1659
  fontFamily: "monospace",
1660
1660
  fontSize: "13px",
1661
1661
  wordBreak: "break-all",
1662
- color: colors$1.textSecondary,
1663
- border: `1px solid ${colors$1.border}`
1662
+ color: colors.textSecondary,
1663
+ border: `1px solid ${colors.border}`
1664
1664
  },
1665
1665
  children: `${window.location.origin}/magic-mail/oauth/yahoo/callback`
1666
1666
  }
@@ -1925,7 +1925,7 @@ const AddAccountModal = ({ isOpen, onClose, onAccountAdded, editAccount = null }
1925
1925
  ] }) })
1926
1926
  ] }) });
1927
1927
  };
1928
- const fadeIn$4 = styled.keyframes`
1928
+ const fadeIn$3 = styled.keyframes`
1929
1929
  from { opacity: 0; transform: translateY(10px); }
1930
1930
  to { opacity: 1; transform: translateY(0); }
1931
1931
  `;
@@ -1937,7 +1937,7 @@ const float$3 = styled.keyframes`
1937
1937
  0%, 100% { transform: translateY(0px); }
1938
1938
  50% { transform: translateY(-5px); }
1939
1939
  `;
1940
- const pulse$2 = styled.keyframes`
1940
+ const pulse$1 = styled.keyframes`
1941
1941
  0%, 100% { opacity: 1; }
1942
1942
  50% { opacity: 0.5; }
1943
1943
  `;
@@ -1953,7 +1953,7 @@ const breakpoints$3 = {
1953
1953
  mobile: "768px"
1954
1954
  };
1955
1955
  const Container$4 = styled__default.default(designSystem.Box)`
1956
- ${styled.css`animation: ${fadeIn$4} ${theme$3.transitions.slow};`}
1956
+ ${styled.css`animation: ${fadeIn$3} ${theme$3.transitions.slow};`}
1957
1957
  min-height: 100vh;
1958
1958
  max-width: 1440px;
1959
1959
  margin: 0 auto;
@@ -2071,7 +2071,7 @@ const StatCard$3 = styled__default.default(designSystem.Box)`
2071
2071
  position: relative;
2072
2072
  overflow: hidden;
2073
2073
  transition: all ${theme$3.transitions.normal};
2074
- ${styled.css`animation: ${fadeIn$4} ${theme$3.transitions.slow} backwards;`}
2074
+ ${styled.css`animation: ${fadeIn$3} ${theme$3.transitions.slow} backwards;`}
2075
2075
  animation-delay: ${(props) => props.$delay || "0s"};
2076
2076
  box-shadow: ${theme$3.shadows.sm};
2077
2077
  border: 1px solid rgba(128, 128, 128, 0.2);
@@ -2197,7 +2197,7 @@ const OnlineBadge$1 = styled__default.default.div`
2197
2197
  background: ${(props) => props.$active ? "var(--colors-success600, #22C55E)" : "rgba(128, 128, 128, 0.4)"};
2198
2198
  display: inline-block;
2199
2199
  margin-right: 8px;
2200
- ${styled.css`animation: ${(props) => props.$active ? pulse$2 : "none"} 2s ease-in-out infinite;`}
2200
+ ${styled.css`animation: ${(props) => props.$active ? pulse$1 : "none"} 2s ease-in-out infinite;`}
2201
2201
  `;
2202
2202
  const StyledTable$3 = styled__default.default(designSystem.Table)`
2203
2203
  thead {
@@ -2959,7 +2959,7 @@ const theme$2 = {
2959
2959
  xl: "16px"
2960
2960
  }
2961
2961
  };
2962
- const fadeIn$3 = styled.keyframes`
2962
+ const fadeIn$2 = styled.keyframes`
2963
2963
  from { opacity: 0; transform: translateY(10px); }
2964
2964
  to { opacity: 1; transform: translateY(0); }
2965
2965
  `;
@@ -2971,7 +2971,7 @@ const float$2 = styled.keyframes`
2971
2971
  0%, 100% { transform: translateY(0px); }
2972
2972
  50% { transform: translateY(-5px); }
2973
2973
  `;
2974
- const pulse$1 = styled.keyframes`
2974
+ const pulse = styled.keyframes`
2975
2975
  0%, 100% { opacity: 1; }
2976
2976
  50% { opacity: 0.5; }
2977
2977
  `;
@@ -2987,7 +2987,7 @@ const breakpoints$2 = {
2987
2987
  mobile: "768px"
2988
2988
  };
2989
2989
  const Container$3 = styled__default.default(designSystem.Box)`
2990
- ${styled.css`animation: ${fadeIn$3} ${theme$2.transitions.slow};`}
2990
+ ${styled.css`animation: ${fadeIn$2} ${theme$2.transitions.slow};`}
2991
2991
  min-height: 100vh;
2992
2992
  max-width: 1440px;
2993
2993
  margin: 0 auto;
@@ -3105,7 +3105,7 @@ const StatCard$2 = styled__default.default(designSystem.Box)`
3105
3105
  position: relative;
3106
3106
  overflow: hidden;
3107
3107
  transition: all ${theme$2.transitions.normal};
3108
- ${styled.css`animation: ${fadeIn$3} ${theme$2.transitions.slow} backwards;`}
3108
+ ${styled.css`animation: ${fadeIn$2} ${theme$2.transitions.slow} backwards;`}
3109
3109
  animation-delay: ${(props) => props.$delay || "0s"};
3110
3110
  box-shadow: ${theme$2.shadows.sm};
3111
3111
  border: 1px solid rgba(128, 128, 128, 0.2);
@@ -3231,7 +3231,7 @@ const OnlineBadge = styled__default.default.div`
3231
3231
  background: ${(props) => props.$active ? "var(--colors-success600, #22C55E)" : "rgba(128, 128, 128, 0.4)"};
3232
3232
  display: inline-block;
3233
3233
  margin-right: 8px;
3234
- ${styled.css`animation: ${(props) => props.$active ? pulse$1 : "none"} 2s ease-in-out infinite;`}
3234
+ ${styled.css`animation: ${(props) => props.$active ? pulse : "none"} 2s ease-in-out infinite;`}
3235
3235
  `;
3236
3236
  const StyledTable$2 = styled__default.default(designSystem.Table)`
3237
3237
  thead {
@@ -3529,8 +3529,7 @@ const RoutingRulesPage = () => {
3529
3529
  rule.fallbackAccountName && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
3530
3530
  "Fallback: ",
3531
3531
  rule.fallbackAccountName
3532
- ] }),
3533
- rule.whatsappFallback && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "success100", textColor: "success700", size: "S", children: "+ WhatsApp" })
3532
+ ] })
3534
3533
  ] }) }),
3535
3534
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(
3536
3535
  designSystem.Badge,
@@ -3593,8 +3592,7 @@ const RuleModal = ({ rule, accounts, onClose, onSave }) => {
3593
3592
  matchType: rule?.matchType || "emailType",
3594
3593
  matchValue: rule?.matchValue || "",
3595
3594
  accountName: rule?.accountName || "",
3596
- fallbackAccountName: rule?.fallbackAccountName || "",
3597
- whatsappFallback: rule?.whatsappFallback || false
3595
+ fallbackAccountName: rule?.fallbackAccountName || ""
3598
3596
  });
3599
3597
  const handleChange = (field, value) => {
3600
3598
  setFormData((prev) => ({ ...prev, [field]: value }));
@@ -3749,38 +3747,6 @@ const RuleModal = ({ rule, accounts, onClose, onSave }) => {
3749
3747
  ),
3750
3748
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, { children: "Use this account if the target account is unavailable or rate-limited" })
3751
3749
  ] }),
3752
- /* @__PURE__ */ jsxRuntime.jsx(
3753
- designSystem.Box,
3754
- {
3755
- padding: 4,
3756
- background: "neutral100",
3757
- hasRadius: true,
3758
- borderColor: "neutral200",
3759
- borderStyle: "solid",
3760
- borderWidth: "1px",
3761
- style: {
3762
- width: "100%",
3763
- borderRadius: theme$2.borderRadius.md
3764
- },
3765
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "center", justifyContent: "space-between", children: [
3766
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1, minWidth: 0 }, children: [
3767
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", children: "WhatsApp Fallback" }),
3768
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", marginTop: 1, children: formData.whatsappFallback ? "If ALL email accounts fail, message will be sent via WhatsApp (requires connected WhatsApp & phone number in email data)" : "Enable to use WhatsApp as last-resort fallback when email delivery fails" })
3769
- ] }),
3770
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
3771
- designSystem.Switch,
3772
- {
3773
- checked: formData.whatsappFallback,
3774
- onCheckedChange: (checked) => handleChange("whatsappFallback", checked),
3775
- "aria-label": "WhatsApp fallback",
3776
- onLabel: "Enabled",
3777
- offLabel: "Disabled",
3778
- visibleLabels: false
3779
- }
3780
- ) })
3781
- ] })
3782
- }
3783
- ),
3784
3750
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { style: { width: "100%" }, children: [
3785
3751
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Rule Priority" }),
3786
3752
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3854,7 +3820,7 @@ const theme$1 = {
3854
3820
  spacing: { xs: "4px", sm: "8px", md: "16px", lg: "24px", xl: "32px", "2xl": "48px" },
3855
3821
  borderRadius: { md: "8px", lg: "12px", xl: "16px" }
3856
3822
  };
3857
- const fadeIn$2 = styled.keyframes`
3823
+ const fadeIn$1 = styled.keyframes`
3858
3824
  from { opacity: 0; transform: translateY(10px); }
3859
3825
  to { opacity: 1; transform: translateY(0); }
3860
3826
  `;
@@ -4008,7 +3974,7 @@ const CopyButton = styled__default.default(designSystem.Button)`
4008
3974
  height: 14px;
4009
3975
  }
4010
3976
  `;
4011
- const InfoBox$1 = styled__default.default(designSystem.Box)`
3977
+ const InfoBox = styled__default.default(designSystem.Box)`
4012
3978
  background: linear-gradient(135deg, ${"rgba(2, 132, 199, 0.06)"}, ${"rgba(2, 132, 199, 0.12)"});
4013
3979
  border-left: 4px solid ${"var(--colors-primary600, #0EA5E9)"};
4014
3980
  border-radius: 8px;
@@ -4030,7 +3996,7 @@ const breakpoints$1 = {
4030
3996
  tablet: "1024px"
4031
3997
  };
4032
3998
  const Container$2 = styled__default.default(designSystem.Box)`
4033
- ${styled.css`animation: ${fadeIn$2} ${theme$1.transitions.slow};`}
3999
+ ${styled.css`animation: ${fadeIn$1} ${theme$1.transitions.slow};`}
4034
4000
  min-height: 100vh;
4035
4001
  max-width: 1440px;
4036
4002
  margin: 0 auto;
@@ -4143,7 +4109,7 @@ const StatCard$1 = styled__default.default(designSystem.Box)`
4143
4109
  position: relative;
4144
4110
  overflow: hidden;
4145
4111
  transition: all ${theme$1.transitions.normal};
4146
- ${styled.css`animation: ${fadeIn$2} ${theme$1.transitions.slow} backwards;`}
4112
+ ${styled.css`animation: ${fadeIn$1} ${theme$1.transitions.slow} backwards;`}
4147
4113
  animation-delay: ${(props) => props.$delay || "0s"};
4148
4114
  box-shadow: ${theme$1.shadows.sm};
4149
4115
  border: 1px solid rgba(128, 128, 128, 0.2);
@@ -5182,7 +5148,7 @@ const TemplateList = () => {
5182
5148
  selectedTemplate.name
5183
5149
  ] }) }),
5184
5150
  /* @__PURE__ */ jsxRuntime.jsxs(ScrollableDialogBody, { children: [
5185
- /* @__PURE__ */ jsxRuntime.jsx(InfoBox$1, { style: { marginTop: 0, marginBottom: "20px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", justifyContent: "space-between", children: [
5151
+ /* @__PURE__ */ jsxRuntime.jsx(InfoBox, { style: { marginTop: 0, marginBottom: "20px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", justifyContent: "space-between", children: [
5186
5152
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", style: { color: "var(--colors-primary600, #075985)" }, children: [
5187
5153
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Template ID:" }),
5188
5154
  " #",
@@ -6621,7 +6587,7 @@ const theme = {
6621
6587
  spacing: { xs: "4px", sm: "8px", md: "16px", lg: "24px", xl: "32px", "2xl": "48px" },
6622
6588
  borderRadius: { lg: "12px", xl: "16px" }
6623
6589
  };
6624
- const fadeIn$1 = styled.keyframes`
6590
+ const fadeIn = styled.keyframes`
6625
6591
  from { opacity: 0; transform: translateY(10px); }
6626
6592
  to { opacity: 1; transform: translateY(0); }
6627
6593
  `;
@@ -6637,7 +6603,7 @@ const breakpoints = {
6637
6603
  mobile: "768px"
6638
6604
  };
6639
6605
  const Container = styled__default.default(designSystem.Box)`
6640
- ${styled.css`animation: ${fadeIn$1} ${theme.transitions.slow};`}
6606
+ ${styled.css`animation: ${fadeIn} ${theme.transitions.slow};`}
6641
6607
  min-height: 100vh;
6642
6608
  max-width: 1440px;
6643
6609
  margin: 0 auto;
@@ -6750,7 +6716,7 @@ const StatCard = styled__default.default(designSystem.Box)`
6750
6716
  position: relative;
6751
6717
  overflow: hidden;
6752
6718
  transition: all ${theme.transitions.normal};
6753
- ${styled.css`animation: ${fadeIn$1} ${theme.transitions.slow} backwards;`}
6719
+ ${styled.css`animation: ${fadeIn} ${theme.transitions.slow} backwards;`}
6754
6720
  animation-delay: ${(props) => props.$delay || "0s"};
6755
6721
  box-shadow: ${theme.shadows.sm};
6756
6722
  border: 1px solid rgba(128, 128, 128, 0.2);
@@ -7159,814 +7125,6 @@ const Analytics = () => {
7159
7125
  ] }) })
7160
7126
  ] });
7161
7127
  };
7162
- const fadeIn = styled.keyframes`
7163
- from {
7164
- opacity: 0;
7165
- transform: translateY(10px);
7166
- }
7167
- to {
7168
- opacity: 1;
7169
- transform: translateY(0);
7170
- }
7171
- `;
7172
- const pulse = styled.keyframes`
7173
- 0%, 100% {
7174
- transform: scale(1);
7175
- }
7176
- 50% {
7177
- transform: scale(1.05);
7178
- }
7179
- `;
7180
- const spin = styled.keyframes`
7181
- from {
7182
- transform: rotate(0deg);
7183
- }
7184
- to {
7185
- transform: rotate(360deg);
7186
- }
7187
- `;
7188
- const colors = {
7189
- whatsapp: "#25D366",
7190
- whatsappDark: "#128C7E",
7191
- whatsappLight: "rgba(37, 211, 102, 0.2)",
7192
- primary: "#4945ff",
7193
- primaryLight: "rgba(73, 69, 255, 0.06)",
7194
- success: "#5cb176",
7195
- successLight: "rgba(92, 177, 118, 0.12)",
7196
- danger: "#d02b20",
7197
- neutral: "#8e8ea9",
7198
- neutralLight: "rgba(142, 142, 169, 0.08)",
7199
- border: "rgba(128, 128, 128, 0.2)",
7200
- textLight: "var(--colors-neutral600, #666687)"
7201
- };
7202
- const PageContainer = styled__default.default(designSystem.Box)`
7203
- padding: 40px;
7204
- max-width: 900px;
7205
- margin: 0 auto;
7206
- animation: ${fadeIn} 0.4s ease;
7207
- `;
7208
- const HeaderSection = styled__default.default(designSystem.Box)`
7209
- text-align: center;
7210
- margin-bottom: 48px;
7211
- `;
7212
- const WhatsAppLogo = styled__default.default.div`
7213
- width: 80px;
7214
- height: 80px;
7215
- border-radius: 50%;
7216
- background: linear-gradient(135deg, ${colors.whatsapp}, ${colors.whatsappDark});
7217
- display: flex;
7218
- align-items: center;
7219
- justify-content: center;
7220
- margin: 0 auto 24px;
7221
- box-shadow: 0 8px 32px ${colors.whatsapp}40;
7222
- `;
7223
- const PhoneIcon = styled__default.default.div`
7224
- width: 40px;
7225
- height: 40px;
7226
- color: white;
7227
- font-size: 32px;
7228
- `;
7229
- const StepperContainer = styled__default.default(designSystem.Box)`
7230
- display: flex;
7231
- align-items: flex-start;
7232
- justify-content: center;
7233
- gap: 0;
7234
- margin-bottom: 48px;
7235
- position: relative;
7236
- padding: 0 40px;
7237
- `;
7238
- const StepWrapper = styled__default.default.div`
7239
- flex: 1;
7240
- display: flex;
7241
- flex-direction: column;
7242
- align-items: center;
7243
- position: relative;
7244
-
7245
- &:not(:last-child)::after {
7246
- content: '';
7247
- position: absolute;
7248
- top: 28px;
7249
- left: 50%;
7250
- width: 100%;
7251
- height: 3px;
7252
- background: ${(props) => props.$completed ? colors.success : colors.neutralLight};
7253
- transition: all 0.4s ease;
7254
- z-index: 0;
7255
- }
7256
- `;
7257
- const StepDot = styled__default.default.div`
7258
- width: 56px;
7259
- height: 56px;
7260
- border-radius: 50%;
7261
- background: ${(props) => props.$active ? colors.whatsapp : props.$completed ? colors.success : props.theme.colors.neutral0};
7262
- color: ${(props) => props.$active || props.$completed ? "#ffffff" : colors.textLight};
7263
- border: 4px solid ${(props) => props.$active ? colors.whatsapp : props.$completed ? colors.success : colors.border};
7264
- display: flex;
7265
- align-items: center;
7266
- justify-content: center;
7267
- font-weight: 700;
7268
- font-size: 18px;
7269
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
7270
- position: relative;
7271
- z-index: 1;
7272
- cursor: ${(props) => props.$completed ? "pointer" : "default"};
7273
- box-shadow: ${(props) => props.$active ? `0 4px 16px ${colors.whatsapp}40, 0 0 0 8px ${colors.whatsappLight}` : props.$completed ? `0 4px 12px ${colors.success}30` : "0 2px 8px rgba(0,0,0,0.08)"};
7274
-
7275
- ${(props) => props.$active && styled.css`
7276
- animation: ${pulse} 2s infinite;
7277
- `}
7278
-
7279
- &:hover {
7280
- transform: ${(props) => props.$completed ? "scale(1.1)" : props.$active ? "scale(1.05)" : "scale(1)"};
7281
- }
7282
- `;
7283
- const StepLabel = styled__default.default(designSystem.Typography)`
7284
- margin-top: 12px;
7285
- font-size: 13px;
7286
- color: ${(props) => props.$active ? colors.whatsapp : props.$completed ? colors.success : colors.textLight};
7287
- white-space: nowrap;
7288
- font-weight: ${(props) => props.$active ? 600 : 500};
7289
- text-align: center;
7290
- transition: all 0.3s ease;
7291
- `;
7292
- const ContentCard = styled__default.default(designSystem.Box)`
7293
- background: ${(p) => p.theme.colors.neutral0};
7294
- border: 1px solid ${colors.border};
7295
- border-radius: 16px;
7296
- padding: 32px;
7297
- margin-bottom: 24px;
7298
- animation: ${fadeIn} 0.4s ease;
7299
- box-shadow: 0 4px 24px rgba(0,0,0,0.06);
7300
- `;
7301
- const QRCodeContainer = styled__default.default.div`
7302
- display: flex;
7303
- flex-direction: column;
7304
- align-items: center;
7305
- padding: 32px;
7306
- background: ${colors.neutralLight};
7307
- border-radius: 16px;
7308
- margin: 24px 0;
7309
- `;
7310
- const QRImage = styled__default.default.img`
7311
- width: 280px;
7312
- height: 280px;
7313
- border-radius: 12px;
7314
- box-shadow: 0 4px 24px rgba(0,0,0,0.1);
7315
- `;
7316
- const StatusBadge = styled__default.default.div`
7317
- display: inline-flex;
7318
- align-items: center;
7319
- gap: 8px;
7320
- padding: 8px 16px;
7321
- border-radius: 20px;
7322
- font-weight: 600;
7323
- font-size: 14px;
7324
- background: ${(props) => {
7325
- switch (props.$status) {
7326
- case "connected":
7327
- return colors.successLight;
7328
- case "connecting":
7329
- return colors.primaryLight;
7330
- case "qr_pending":
7331
- return colors.whatsappLight;
7332
- case "disconnected":
7333
- return colors.neutralLight;
7334
- default:
7335
- return colors.neutralLight;
7336
- }
7337
- }};
7338
- color: ${(props) => {
7339
- switch (props.$status) {
7340
- case "connected":
7341
- return colors.success;
7342
- case "connecting":
7343
- return colors.primary;
7344
- case "qr_pending":
7345
- return colors.whatsappDark;
7346
- case "disconnected":
7347
- return colors.neutral;
7348
- default:
7349
- return colors.neutral;
7350
- }
7351
- }};
7352
- `;
7353
- const SpinningLoader = styled__default.default.div`
7354
- width: 20px;
7355
- height: 20px;
7356
- border: 2px solid ${colors.primary}40;
7357
- border-top-color: ${colors.primary};
7358
- border-radius: 50%;
7359
- animation: ${spin} 1s linear infinite;
7360
- `;
7361
- const ConnectedCard = styled__default.default(designSystem.Box)`
7362
- background: linear-gradient(135deg, ${colors.successLight}, ${colors.whatsappLight});
7363
- border: 2px solid ${colors.success};
7364
- border-radius: 16px;
7365
- padding: 32px;
7366
- text-align: center;
7367
- `;
7368
- const InfoBox = styled__default.default(designSystem.Box)`
7369
- background: linear-gradient(135deg, rgba(2, 132, 199, 0.06) 0%, ${colors.whatsappLight} 100%);
7370
- border: 1px solid rgba(2, 132, 199, 0.2);
7371
- border-radius: 12px;
7372
- padding: 24px;
7373
- margin: 20px 0;
7374
- `;
7375
- const TestSection = styled__default.default(designSystem.Box)`
7376
- background: linear-gradient(135deg, ${colors.whatsappLight} 0%, rgba(34, 197, 94, 0.1) 100%);
7377
- border: 1px solid ${colors.whatsapp}40;
7378
- border-radius: 16px;
7379
- padding: 24px;
7380
- margin-top: 24px;
7381
- `;
7382
- const WhatsAppInput = styled__default.default.input`
7383
- width: 100%;
7384
- padding: 14px 16px;
7385
- border: 2px solid rgba(128, 128, 128, 0.2);
7386
- border-radius: 12px;
7387
- font-size: 15px;
7388
- background: ${(p) => p.theme.colors.neutral0};
7389
- color: var(--colors-neutral800);
7390
- transition: all 0.2s ease;
7391
- box-sizing: border-box;
7392
-
7393
- &:focus {
7394
- outline: none;
7395
- border-color: ${colors.whatsapp};
7396
- box-shadow: 0 0 0 3px ${colors.whatsapp}20;
7397
- }
7398
-
7399
- &::placeholder {
7400
- color: rgba(128, 128, 128, 0.4);
7401
- }
7402
- `;
7403
- const WhatsAppTextarea = styled__default.default.textarea`
7404
- width: 100%;
7405
- padding: 14px 16px;
7406
- border: 2px solid rgba(128, 128, 128, 0.2);
7407
- border-radius: 12px;
7408
- font-size: 15px;
7409
- background: ${(p) => p.theme.colors.neutral0};
7410
- color: var(--colors-neutral800);
7411
- transition: all 0.2s ease;
7412
- box-sizing: border-box;
7413
- resize: vertical;
7414
- min-height: 80px;
7415
- font-family: inherit;
7416
-
7417
- &:focus {
7418
- outline: none;
7419
- border-color: ${colors.whatsapp};
7420
- box-shadow: 0 0 0 3px ${colors.whatsapp}20;
7421
- }
7422
-
7423
- &::placeholder {
7424
- color: rgba(128, 128, 128, 0.4);
7425
- }
7426
- `;
7427
- const InputLabel = styled__default.default.label`
7428
- display: flex;
7429
- align-items: center;
7430
- gap: 8px;
7431
- font-size: 14px;
7432
- font-weight: 600;
7433
- color: ${colors.whatsappDark};
7434
- margin-bottom: 8px;
7435
- `;
7436
- const InputHint = styled__default.default.span`
7437
- font-size: 12px;
7438
- color: var(--colors-neutral500);
7439
- margin-top: 6px;
7440
- display: block;
7441
- `;
7442
- const PhoneSymbol = styled__default.default.span`
7443
- font-size: 16px;
7444
- font-weight: 700;
7445
- `;
7446
- const MessageSymbol = styled__default.default.span`
7447
- font-size: 16px;
7448
- `;
7449
- const UseCaseCard = styled__default.default(designSystem.Box)`
7450
- background: linear-gradient(135deg, ${colors.whatsappLight}, rgba(2, 132, 199, 0.06));
7451
- border: 2px solid ${colors.whatsapp};
7452
- border-radius: 16px;
7453
- padding: 24px;
7454
- margin-bottom: 32px;
7455
- `;
7456
- const ButtonRow = styled__default.default(designSystem.Flex)`
7457
- margin-top: 32px;
7458
- padding-top: 24px;
7459
- border-top: 1px solid rgba(128, 128, 128, 0.2);
7460
- `;
7461
- const AlertBox = styled__default.default(designSystem.Box)`
7462
- background: rgba(2, 132, 199, 0.06);
7463
- border: 1px solid rgba(2, 132, 199, 0.2);
7464
- border-radius: 12px;
7465
- padding: 16px 20px;
7466
- margin-top: 20px;
7467
- display: flex;
7468
- align-items: flex-start;
7469
- gap: 12px;
7470
- `;
7471
- const AlertIcon = styled__default.default.div`
7472
- width: 24px;
7473
- height: 24px;
7474
- border-radius: 50%;
7475
- background: var(--colors-primary600, #0EA5E9);
7476
- color: white;
7477
- display: flex;
7478
- align-items: center;
7479
- justify-content: center;
7480
- font-size: 14px;
7481
- font-weight: bold;
7482
- flex-shrink: 0;
7483
- `;
7484
- const SuccessBox = styled__default.default(designSystem.Box)`
7485
- background: rgba(22, 163, 74, 0.06);
7486
- border: 1px solid rgba(22, 163, 74, 0.2);
7487
- border-radius: 12px;
7488
- padding: 16px 20px;
7489
- display: flex;
7490
- align-items: flex-start;
7491
- gap: 12px;
7492
- `;
7493
- const SuccessIcon = styled__default.default.div`
7494
- width: 24px;
7495
- height: 24px;
7496
- border-radius: 50%;
7497
- background: var(--colors-success600, #22C55E);
7498
- color: white;
7499
- display: flex;
7500
- align-items: center;
7501
- justify-content: center;
7502
- flex-shrink: 0;
7503
- `;
7504
- const WhatsAppButton = styled__default.default(StyledButtons.GradientButton)`
7505
- && {
7506
- background: linear-gradient(135deg, ${colors.whatsapp} 0%, ${colors.whatsappDark} 100%) !important;
7507
-
7508
- &:hover:not(:disabled) {
7509
- background: linear-gradient(135deg, ${colors.whatsappDark} 0%, ${colors.whatsapp} 100%) !important;
7510
- }
7511
- }
7512
- `;
7513
- const NotInstalledCard = styled__default.default(designSystem.Box)`
7514
- background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(220, 38, 38, 0.12));
7515
- border: 2px solid var(--colors-warning600, #F59E0B);
7516
- border-radius: 16px;
7517
- padding: 32px;
7518
- text-align: center;
7519
- `;
7520
- const WhatsAppPage = () => {
7521
- const { get, post } = admin.useFetchClient();
7522
- const { toggleNotification } = admin.useNotification();
7523
- const [currentStep, setCurrentStep] = React.useState(1);
7524
- const [loading, setLoading] = React.useState(true);
7525
- const [connecting, setConnecting] = React.useState(false);
7526
- const [isAvailable, setIsAvailable] = React.useState(false);
7527
- const [status, setStatus] = React.useState({
7528
- status: "disconnected",
7529
- qrCode: null,
7530
- isConnected: false,
7531
- session: null
7532
- });
7533
- const [testPhone, setTestPhone] = React.useState("");
7534
- const [testMessage, setTestMessage] = React.useState("");
7535
- const [sendingTest, setSendingTest] = React.useState(false);
7536
- const stepTitles = ["Check Installation", "Connect WhatsApp", "Scan QR Code", "Ready to Use"];
7537
- const checkAvailability = React.useCallback(async () => {
7538
- try {
7539
- const { data } = await get("/magic-mail/whatsapp/available");
7540
- setIsAvailable(data.data.available);
7541
- return data.data.available;
7542
- } catch (error) {
7543
- console.error("[MagicMail WhatsApp] Error checking availability:", error);
7544
- setIsAvailable(false);
7545
- return false;
7546
- }
7547
- }, [get]);
7548
- const fetchStatus = React.useCallback(async () => {
7549
- try {
7550
- const { data } = await get("/magic-mail/whatsapp/status");
7551
- setStatus(data.data);
7552
- if (data.data.isConnected) {
7553
- setCurrentStep(4);
7554
- } else if (data.data.qrCode) {
7555
- setCurrentStep(3);
7556
- } else if (isAvailable) {
7557
- setCurrentStep(2);
7558
- }
7559
- return data.data;
7560
- } catch (error) {
7561
- console.error("[MagicMail WhatsApp] Error fetching status:", error);
7562
- return null;
7563
- }
7564
- }, [get, isAvailable]);
7565
- React.useEffect(() => {
7566
- const init = async () => {
7567
- setLoading(true);
7568
- const available = await checkAvailability();
7569
- if (available) {
7570
- await fetchStatus();
7571
- }
7572
- setLoading(false);
7573
- };
7574
- init();
7575
- }, [checkAvailability, fetchStatus]);
7576
- React.useEffect(() => {
7577
- let pollInterval;
7578
- if (connecting || status.status === "connecting" || status.status === "qr_pending") {
7579
- pollInterval = setInterval(async () => {
7580
- const newStatus = await fetchStatus();
7581
- if (newStatus?.isConnected) {
7582
- setConnecting(false);
7583
- setCurrentStep(4);
7584
- toggleNotification({
7585
- type: "success",
7586
- message: "[SUCCESS] WhatsApp connected successfully!"
7587
- });
7588
- }
7589
- }, 2e3);
7590
- }
7591
- return () => {
7592
- if (pollInterval) clearInterval(pollInterval);
7593
- };
7594
- }, [connecting, status.status, fetchStatus, toggleNotification]);
7595
- const handleConnect = async () => {
7596
- setConnecting(true);
7597
- try {
7598
- const { data } = await post("/magic-mail/whatsapp/connect", {});
7599
- if (data.data.qrCode) {
7600
- setStatus((prev) => ({ ...prev, qrCode: data.data.qrCode, status: "qr_pending" }));
7601
- setCurrentStep(3);
7602
- } else if (data.data.status === "connected") {
7603
- setStatus((prev) => ({ ...prev, isConnected: true, status: "connected" }));
7604
- setCurrentStep(4);
7605
- toggleNotification({
7606
- type: "success",
7607
- message: "[SUCCESS] WhatsApp already connected!"
7608
- });
7609
- }
7610
- } catch (error) {
7611
- toggleNotification({
7612
- type: "danger",
7613
- message: "[ERROR] Failed to connect: " + (error.response?.data?.error?.message || error.message)
7614
- });
7615
- setConnecting(false);
7616
- }
7617
- };
7618
- const handleDisconnect = async () => {
7619
- try {
7620
- await post("/magic-mail/whatsapp/disconnect", {});
7621
- setStatus({
7622
- status: "disconnected",
7623
- qrCode: null,
7624
- isConnected: false,
7625
- session: null
7626
- });
7627
- setCurrentStep(2);
7628
- toggleNotification({
7629
- type: "success",
7630
- message: "[SUCCESS] WhatsApp disconnected"
7631
- });
7632
- } catch (error) {
7633
- toggleNotification({
7634
- type: "danger",
7635
- message: "[ERROR] Failed to disconnect"
7636
- });
7637
- }
7638
- };
7639
- const handleSendTest = async () => {
7640
- if (!testPhone) {
7641
- toggleNotification({
7642
- type: "warning",
7643
- message: "Please enter a phone number"
7644
- });
7645
- return;
7646
- }
7647
- setSendingTest(true);
7648
- try {
7649
- const { data } = await post("/magic-mail/whatsapp/send-test", {
7650
- phoneNumber: testPhone,
7651
- message: testMessage || void 0
7652
- });
7653
- if (data.success) {
7654
- toggleNotification({
7655
- type: "success",
7656
- message: "[SUCCESS] Test message sent!"
7657
- });
7658
- setTestPhone("");
7659
- setTestMessage("");
7660
- } else {
7661
- toggleNotification({
7662
- type: "danger",
7663
- message: "[ERROR] " + (data.data.error || "Failed to send message")
7664
- });
7665
- }
7666
- } catch (error) {
7667
- toggleNotification({
7668
- type: "danger",
7669
- message: "[ERROR] " + (error.response?.data?.error?.message || error.message)
7670
- });
7671
- } finally {
7672
- setSendingTest(false);
7673
- }
7674
- };
7675
- const renderStatusBadge = () => {
7676
- const statusText = {
7677
- connected: "Connected",
7678
- connecting: "Connecting...",
7679
- qr_pending: "Waiting for QR Scan",
7680
- disconnected: "Disconnected"
7681
- };
7682
- return /* @__PURE__ */ jsxRuntime.jsxs(StatusBadge, { $status: status.status, children: [
7683
- status.status === "connecting" && /* @__PURE__ */ jsxRuntime.jsx(SpinningLoader, {}),
7684
- status.status === "connected" && /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}),
7685
- statusText[status.status] || "Unknown"
7686
- ] });
7687
- };
7688
- if (loading) {
7689
- return /* @__PURE__ */ jsxRuntime.jsx(PageContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}) }) });
7690
- }
7691
- return /* @__PURE__ */ jsxRuntime.jsxs(PageContainer, { children: [
7692
- /* @__PURE__ */ jsxRuntime.jsxs(HeaderSection, { children: [
7693
- /* @__PURE__ */ jsxRuntime.jsx(WhatsAppLogo, { children: /* @__PURE__ */ jsxRuntime.jsx(PhoneIcon, { children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "40", height: "40", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z" }) }) }) }),
7694
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "WhatsApp Integration" }),
7695
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", style: { display: "block" }, children: "Send messages via WhatsApp - completely free!" }),
7696
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 3, children: renderStatusBadge() })
7697
- ] }),
7698
- /* @__PURE__ */ jsxRuntime.jsx(StepperContainer, { children: [1, 2, 3, 4].map((step) => /* @__PURE__ */ jsxRuntime.jsxs(
7699
- StepWrapper,
7700
- {
7701
- $completed: currentStep > step,
7702
- children: [
7703
- /* @__PURE__ */ jsxRuntime.jsx(
7704
- StepDot,
7705
- {
7706
- $active: currentStep === step,
7707
- $completed: currentStep > step,
7708
- onClick: () => currentStep > step && setCurrentStep(step),
7709
- children: currentStep > step ? /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}) : step
7710
- }
7711
- ),
7712
- /* @__PURE__ */ jsxRuntime.jsx(
7713
- StepLabel,
7714
- {
7715
- $active: currentStep === step,
7716
- $completed: currentStep > step,
7717
- children: stepTitles[step - 1]
7718
- }
7719
- )
7720
- ]
7721
- },
7722
- step
7723
- )) }),
7724
- /* @__PURE__ */ jsxRuntime.jsxs(UseCaseCard, { children: [
7725
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { display: "block", marginBottom: "12px" }, children: "What can you do with WhatsApp?" }),
7726
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", style: { display: "block", marginBottom: "16px" }, children: "WhatsApp integration provides free messaging as an alternative or backup to email delivery." }),
7727
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, children: [
7728
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 3, background: "neutral0", hasRadius: true, style: { border: `1px solid ${colors.border}` }, children: [
7729
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", style: { display: "block", marginBottom: "4px" }, children: "1. FALLBACK-KANAL" }),
7730
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { display: "block" }, children: "Wenn alle Email-Accounts fehlschlagen, wird die Nachricht automatisch via WhatsApp zugestellt." })
7731
- ] }),
7732
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 3, background: "neutral0", hasRadius: true, style: { border: `1px solid ${colors.border}` }, children: [
7733
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", style: { display: "block", marginBottom: "4px" }, children: "2. ADMIN-BENACHRICHTIGUNGEN" }),
7734
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { display: "block" }, children: "Bei Email-Bounces, Quota-Limits oder Account-Fehlern wird der Admin via WhatsApp benachrichtigt." })
7735
- ] }),
7736
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 3, background: "neutral0", hasRadius: true, style: { border: `1px solid ${colors.border}` }, children: [
7737
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", style: { display: "block", marginBottom: "4px" }, children: "3. ROUTING-INTEGRATION" }),
7738
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { display: "block" }, children: "In Routing-Regeln kann WhatsApp als Fallback-Kanal definiert werden (Routing Rules Tab)." })
7739
- ] })
7740
- ] })
7741
- ] }),
7742
- currentStep === 1 && /* @__PURE__ */ jsxRuntime.jsxs(ContentCard, { children: [
7743
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Check Installation" }),
7744
- /* @__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." }),
7745
- isAvailable ? /* @__PURE__ */ jsxRuntime.jsxs(SuccessBox, { children: [
7746
- /* @__PURE__ */ jsxRuntime.jsx(SuccessIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, { style: { width: 14, height: 14 } }) }),
7747
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
7748
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", style: { display: "block", marginBottom: "4px", color: "var(--colors-success600, #15803D)" }, children: "Dependencies Installed" }),
7749
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Baileys library is installed and ready to use. You can proceed to connect your WhatsApp account." })
7750
- ] })
7751
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(NotInstalledCard, { children: [
7752
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "12px", color: colors.danger }, children: "[WARNING] Dependencies Not Installed" }),
7753
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { display: "block", marginBottom: "16px" }, children: "The WhatsApp integration requires additional dependencies. Please install them:" }),
7754
- /* @__PURE__ */ jsxRuntime.jsx(
7755
- designSystem.Box,
7756
- {
7757
- padding: 4,
7758
- background: "neutral0",
7759
- hasRadius: true,
7760
- style: {
7761
- fontFamily: "monospace",
7762
- fontSize: "14px",
7763
- border: `1px solid ${colors.border}`,
7764
- marginBottom: "16px"
7765
- },
7766
- children: "npm install baileys pino qrcode"
7767
- }
7768
- ),
7769
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "After installing, restart your Strapi server and refresh this page." })
7770
- ] }),
7771
- /* @__PURE__ */ jsxRuntime.jsxs(ButtonRow, { justifyContent: "flex-end", gap: 3, children: [
7772
- /* @__PURE__ */ jsxRuntime.jsx(
7773
- StyledButtons.SecondaryButton,
7774
- {
7775
- onClick: () => {
7776
- checkAvailability();
7777
- },
7778
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}),
7779
- children: "Refresh"
7780
- }
7781
- ),
7782
- /* @__PURE__ */ jsxRuntime.jsx(
7783
- StyledButtons.GradientButton,
7784
- {
7785
- onClick: () => setCurrentStep(2),
7786
- disabled: !isAvailable,
7787
- endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowRight, {}),
7788
- children: "Continue"
7789
- }
7790
- )
7791
- ] })
7792
- ] }),
7793
- currentStep === 2 && /* @__PURE__ */ jsxRuntime.jsxs(ContentCard, { children: [
7794
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Connect Your WhatsApp" }),
7795
- /* @__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." }),
7796
- /* @__PURE__ */ jsxRuntime.jsxs(InfoBox, { children: [
7797
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { display: "block", marginBottom: "16px", color: "var(--colors-primary600, #075985)" }, children: "How it works" }),
7798
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, children: [
7799
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: '1. Click "Connect WhatsApp" to generate a QR code' }),
7800
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: "2. Open WhatsApp on your phone" }),
7801
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: "3. Go to Settings - Linked Devices - Link a Device" }),
7802
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: "4. Scan the QR code with your phone" })
7803
- ] })
7804
- ] }),
7805
- /* @__PURE__ */ jsxRuntime.jsxs(AlertBox, { children: [
7806
- /* @__PURE__ */ jsxRuntime.jsx(AlertIcon, { children: "i" }),
7807
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
7808
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", style: { display: "block", marginBottom: "4px" }, children: "Session Persistence" }),
7809
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Your WhatsApp session will be saved. You won't need to scan the QR code again unless you manually disconnect or your session expires." })
7810
- ] })
7811
- ] }),
7812
- /* @__PURE__ */ jsxRuntime.jsxs(ButtonRow, { justifyContent: "space-between", children: [
7813
- /* @__PURE__ */ jsxRuntime.jsx(
7814
- StyledButtons.TertiaryButton,
7815
- {
7816
- onClick: () => setCurrentStep(1),
7817
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}),
7818
- children: "Back"
7819
- }
7820
- ),
7821
- /* @__PURE__ */ jsxRuntime.jsx(
7822
- WhatsAppButton,
7823
- {
7824
- onClick: handleConnect,
7825
- loading: connecting,
7826
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Play, {}),
7827
- children: "Connect WhatsApp"
7828
- }
7829
- )
7830
- ] })
7831
- ] }),
7832
- currentStep === 3 && /* @__PURE__ */ jsxRuntime.jsxs(ContentCard, { children: [
7833
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Scan QR Code" }),
7834
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { display: "block", marginBottom: "24px" }, children: "Open WhatsApp on your phone and scan this QR code to connect." }),
7835
- /* @__PURE__ */ jsxRuntime.jsx(QRCodeContainer, { children: status.qrCode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7836
- /* @__PURE__ */ jsxRuntime.jsx(QRImage, { src: status.qrCode, alt: "WhatsApp QR Code" }),
7837
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { marginTop: "16px" }, children: 'QR code expires in 60 seconds. If it expires, click "Refresh QR".' })
7838
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 3, children: [
7839
- /* @__PURE__ */ jsxRuntime.jsx(SpinningLoader, { style: { width: "40px", height: "40px" } }),
7840
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: "Generating QR code..." })
7841
- ] }) }),
7842
- /* @__PURE__ */ jsxRuntime.jsxs(InfoBox, { children: [
7843
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", style: { display: "block", marginBottom: "16px", color: "var(--colors-primary600, #075985)" }, children: "Instructions" }),
7844
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
7845
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: "1. Open WhatsApp on your phone" }),
7846
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: "2. Tap Menu or Settings" }),
7847
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: '3. Select "Linked Devices"' }),
7848
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: '4. Tap "Link a Device"' }),
7849
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral700", children: "5. Point your phone camera at this QR code" })
7850
- ] })
7851
- ] }),
7852
- /* @__PURE__ */ jsxRuntime.jsxs(ButtonRow, { justifyContent: "space-between", children: [
7853
- /* @__PURE__ */ jsxRuntime.jsx(
7854
- StyledButtons.TertiaryButton,
7855
- {
7856
- onClick: () => setCurrentStep(2),
7857
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}),
7858
- children: "Back"
7859
- }
7860
- ),
7861
- /* @__PURE__ */ jsxRuntime.jsx(
7862
- StyledButtons.SecondaryButton,
7863
- {
7864
- onClick: handleConnect,
7865
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}),
7866
- children: "Refresh QR"
7867
- }
7868
- )
7869
- ] })
7870
- ] }),
7871
- currentStep === 4 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7872
- /* @__PURE__ */ jsxRuntime.jsxs(ConnectedCard, { children: [
7873
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, { style: { width: "48px", height: "48px", color: colors.success } }) }),
7874
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "WhatsApp Connected" }),
7875
- status.session && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { display: "block" }, children: [
7876
- "Connected as: ",
7877
- status.session.phoneNumber,
7878
- " ",
7879
- status.session.name && `(${status.session.name})`
7880
- ] })
7881
- ] }),
7882
- /* @__PURE__ */ jsxRuntime.jsxs(ContentCard, { style: { marginTop: "24px" }, children: [
7883
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Send Test Message" }),
7884
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { display: "block", marginBottom: "24px" }, children: "Test your WhatsApp connection by sending a message." }),
7885
- /* @__PURE__ */ jsxRuntime.jsxs(TestSection, { children: [
7886
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { marginBottom: "20px" }, children: [
7887
- /* @__PURE__ */ jsxRuntime.jsxs(InputLabel, { children: [
7888
- /* @__PURE__ */ jsxRuntime.jsx(PhoneSymbol, { children: "+" }),
7889
- "Phone Number"
7890
- ] }),
7891
- /* @__PURE__ */ jsxRuntime.jsx(
7892
- WhatsAppInput,
7893
- {
7894
- placeholder: "49123456789",
7895
- value: testPhone,
7896
- onChange: (e) => setTestPhone(e.target.value)
7897
- }
7898
- ),
7899
- /* @__PURE__ */ jsxRuntime.jsx(InputHint, { children: "Enter with country code, without + (e.g., 49 for Germany, 1 for USA)" })
7900
- ] }),
7901
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { marginBottom: "24px" }, children: [
7902
- /* @__PURE__ */ jsxRuntime.jsxs(InputLabel, { children: [
7903
- /* @__PURE__ */ jsxRuntime.jsx(MessageSymbol, { children: "@" }),
7904
- "Message (optional)"
7905
- ] }),
7906
- /* @__PURE__ */ jsxRuntime.jsx(
7907
- WhatsAppTextarea,
7908
- {
7909
- placeholder: "Type your message here... or leave empty for default test message",
7910
- value: testMessage,
7911
- onChange: (e) => setTestMessage(e.target.value),
7912
- rows: 3
7913
- }
7914
- )
7915
- ] }),
7916
- /* @__PURE__ */ jsxRuntime.jsx(
7917
- WhatsAppButton,
7918
- {
7919
- onClick: handleSendTest,
7920
- loading: sendingTest,
7921
- disabled: !testPhone,
7922
- style: { width: "100%" },
7923
- children: "Send Test Message"
7924
- }
7925
- )
7926
- ] }),
7927
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { style: { margin: "24px 0" } }),
7928
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Using WhatsApp in Your Code" }),
7929
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: { display: "block", marginBottom: "16px" }, children: "Use the WhatsApp service programmatically in your Strapi code." }),
7930
- /* @__PURE__ */ jsxRuntime.jsx(
7931
- designSystem.Box,
7932
- {
7933
- padding: 4,
7934
- background: "neutral100",
7935
- hasRadius: true,
7936
- style: {
7937
- fontFamily: "monospace",
7938
- fontSize: "13px",
7939
- lineHeight: "1.6",
7940
- overflow: "auto"
7941
- },
7942
- children: /* @__PURE__ */ jsxRuntime.jsx("pre", { style: { margin: 0 }, children: `// Send a message via WhatsApp
7943
- const whatsapp = strapi.plugin('magic-mail').service('whatsapp');
7944
-
7945
- // Send simple message
7946
- await whatsapp.sendMessage('49123456789', 'Hello from MagicMail!');
7947
-
7948
- // Send template message
7949
- await whatsapp.sendTemplateMessage('49123456789', 'welcome', {
7950
- name: 'John',
7951
- company: 'ACME Corp',
7952
- });` })
7953
- }
7954
- ),
7955
- /* @__PURE__ */ jsxRuntime.jsxs(ButtonRow, { justifyContent: "space-between", alignItems: "center", children: [
7956
- /* @__PURE__ */ jsxRuntime.jsx(
7957
- StyledButtons.DangerButton,
7958
- {
7959
- onClick: handleDisconnect,
7960
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
7961
- children: "Disconnect WhatsApp"
7962
- }
7963
- ),
7964
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "success600", textColor: "neutral0", style: { padding: "8px 16px", fontSize: "13px" }, children: "FREE - No API costs!" })
7965
- ] })
7966
- ] })
7967
- ] })
7968
- ] });
7969
- };
7970
7128
  const pluginId = "magic-mail";
7971
7129
  const pluginPermissions = {
7972
7130
  access: [{ action: `plugin::${pluginId}.access`, subject: null }]
@@ -7980,22 +7138,18 @@ const App = () => {
7980
7138
  if (location.pathname.includes("/analytics")) return "analytics";
7981
7139
  if (location.pathname.includes("/routing")) return "routing";
7982
7140
  if (location.pathname.includes("/designer") && !isEditorRoute) return "templates";
7983
- if (location.pathname.includes("/whatsapp")) return "whatsapp";
7984
7141
  return "accounts";
7985
7142
  };
7986
- const [activeTab, setActiveTab] = React.useState(getActiveTab());
7987
7143
  const handleTabChange = (tab) => {
7988
- setActiveTab(tab);
7989
7144
  if (tab === "accounts") navigate("/plugins/magic-mail");
7990
7145
  if (tab === "routing") navigate("/plugins/magic-mail/routing");
7991
7146
  if (tab === "templates") navigate("/plugins/magic-mail/designer");
7992
7147
  if (tab === "analytics") navigate("/plugins/magic-mail/analytics");
7993
- if (tab === "whatsapp") navigate("/plugins/magic-mail/whatsapp");
7994
7148
  };
7995
7149
  if (isEditorRoute) {
7996
7150
  return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: pluginPermissions.access, children: /* @__PURE__ */ jsxRuntime.jsx(EditorPage, {}) });
7997
7151
  }
7998
- 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: [
7152
+ return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: pluginPermissions.access, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { value: getActiveTab(), onValueChange: handleTabChange, children: [
7999
7153
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.List, { children: [
8000
7154
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "accounts", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
8001
7155
  /* @__PURE__ */ jsxRuntime.jsx(outline.EnvelopeIcon, { style: { width: 16, height: 16 } }),
@@ -8012,17 +7166,12 @@ const App = () => {
8012
7166
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "analytics", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
8013
7167
  /* @__PURE__ */ jsxRuntime.jsx(outline.ChartBarIcon, { style: { width: 16, height: 16 } }),
8014
7168
  "Analytics"
8015
- ] }) }),
8016
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "whatsapp", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
8017
- /* @__PURE__ */ jsxRuntime.jsx(outline.ChatBubbleLeftIcon, { style: { width: 16, height: 16 } }),
8018
- "WhatsApp"
8019
7169
  ] }) })
8020
7170
  ] }),
8021
7171
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "accounts", children: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }),
8022
7172
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "routing", children: /* @__PURE__ */ jsxRuntime.jsx(RoutingRulesPage, {}) }),
8023
7173
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "templates", children: /* @__PURE__ */ jsxRuntime.jsx(TemplateList, {}) }),
8024
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "analytics", children: /* @__PURE__ */ jsxRuntime.jsx(Analytics, {}) }),
8025
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "whatsapp", children: /* @__PURE__ */ jsxRuntime.jsx(WhatsAppPage, {}) })
7174
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "analytics", children: /* @__PURE__ */ jsxRuntime.jsx(Analytics, {}) })
8026
7175
  ] }) }) });
8027
7176
  };
8028
7177
  exports.default = App;