@burdenoff/microfe-notification 2026.424.101

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 (161) hide show
  1. package/README.md +376 -0
  2. package/dist/AdminNotificationRoot.d.ts +35 -0
  3. package/dist/AdminNotificationRoot.d.ts.map +1 -0
  4. package/dist/AdminNotificationRoot.js +81 -0
  5. package/dist/AdminNotificationRoot.js.map +1 -0
  6. package/dist/AdminNotificationRoutes.d.ts +2 -0
  7. package/dist/AdminNotificationRoutes.d.ts.map +1 -0
  8. package/dist/AdminNotificationRoutes.js +108 -0
  9. package/dist/AdminNotificationRoutes.js.map +1 -0
  10. package/dist/NotificationRoot.d.ts +31 -0
  11. package/dist/NotificationRoot.d.ts.map +1 -0
  12. package/dist/NotificationRoot.js +81 -0
  13. package/dist/NotificationRoot.js.map +1 -0
  14. package/dist/NotificationRoutes.d.ts +17 -0
  15. package/dist/NotificationRoutes.d.ts.map +1 -0
  16. package/dist/NotificationRoutes.js +67 -0
  17. package/dist/NotificationRoutes.js.map +1 -0
  18. package/dist/UserNotificationRoot.d.ts +34 -0
  19. package/dist/UserNotificationRoot.d.ts.map +1 -0
  20. package/dist/UserNotificationRoot.js +64 -0
  21. package/dist/UserNotificationRoot.js.map +1 -0
  22. package/dist/UserNotificationRoutes.d.ts +15 -0
  23. package/dist/UserNotificationRoutes.d.ts.map +1 -0
  24. package/dist/UserNotificationRoutes.js +52 -0
  25. package/dist/UserNotificationRoutes.js.map +1 -0
  26. package/dist/__tests__/setup.d.ts +2 -0
  27. package/dist/__tests__/setup.d.ts.map +1 -0
  28. package/dist/components/NotificationBell.d.ts +14 -0
  29. package/dist/components/NotificationBell.d.ts.map +1 -0
  30. package/dist/components/NotificationBell.js +47 -0
  31. package/dist/components/NotificationBell.js.map +1 -0
  32. package/dist/components/NotificationCard.d.ts +19 -0
  33. package/dist/components/NotificationCard.d.ts.map +1 -0
  34. package/dist/components/NotificationCard.js +112 -0
  35. package/dist/components/NotificationCard.js.map +1 -0
  36. package/dist/components/NotificationPanel.d.ts +11 -0
  37. package/dist/components/NotificationPanel.d.ts.map +1 -0
  38. package/dist/components/NotificationPanel.js +100 -0
  39. package/dist/components/NotificationPanel.js.map +1 -0
  40. package/dist/components/RecipientSelector.d.ts +34 -0
  41. package/dist/components/RecipientSelector.d.ts.map +1 -0
  42. package/dist/components/RecipientSelector.js +212 -0
  43. package/dist/components/RecipientSelector.js.map +1 -0
  44. package/dist/components/TemplatePreview.d.ts +22 -0
  45. package/dist/components/TemplatePreview.d.ts.map +1 -0
  46. package/dist/components/TemplatePreview.js +425 -0
  47. package/dist/components/TemplatePreview.js.map +1 -0
  48. package/dist/components/VariableInserter.d.ts +12 -0
  49. package/dist/components/VariableInserter.d.ts.map +1 -0
  50. package/dist/components/index.d.ts +4 -0
  51. package/dist/components/index.d.ts.map +1 -0
  52. package/dist/components/index.js +3 -0
  53. package/dist/constants/permissions.d.ts +24 -0
  54. package/dist/constants/permissions.d.ts.map +1 -0
  55. package/dist/constants/permissions.js +17 -0
  56. package/dist/constants/permissions.js.map +1 -0
  57. package/dist/dev/main.d.ts +2 -0
  58. package/dist/dev/main.d.ts.map +1 -0
  59. package/dist/generated/global-operations.d.ts +1408 -0
  60. package/dist/generated/global-operations.d.ts.map +1 -0
  61. package/dist/generated/global-operations.js +514 -0
  62. package/dist/generated/global-operations.js.map +1 -0
  63. package/dist/generated/global-types.d.ts +20773 -0
  64. package/dist/generated/global-types.d.ts.map +1 -0
  65. package/dist/generated/wspace-operations.d.ts +2 -0
  66. package/dist/generated/wspace-operations.d.ts.map +1 -0
  67. package/dist/generated/wspace-types.d.ts +53363 -0
  68. package/dist/generated/wspace-types.d.ts.map +1 -0
  69. package/dist/graphql/global-client.d.ts +19 -0
  70. package/dist/graphql/global-client.d.ts.map +1 -0
  71. package/dist/graphql/global-client.js +57 -0
  72. package/dist/graphql/global-client.js.map +1 -0
  73. package/dist/hooks/index.d.ts +6 -0
  74. package/dist/hooks/index.d.ts.map +1 -0
  75. package/dist/hooks/index.js +5 -0
  76. package/dist/hooks/useNotificationAdmin.d.ts +51 -0
  77. package/dist/hooks/useNotificationAdmin.d.ts.map +1 -0
  78. package/dist/hooks/useNotificationAdmin.js +203 -0
  79. package/dist/hooks/useNotificationAdmin.js.map +1 -0
  80. package/dist/hooks/useNotificationTemplates.d.ts +136 -0
  81. package/dist/hooks/useNotificationTemplates.d.ts.map +1 -0
  82. package/dist/hooks/useNotificationTemplates.js +168 -0
  83. package/dist/hooks/useNotificationTemplates.js.map +1 -0
  84. package/dist/hooks/useNotificationTopics.d.ts +36 -0
  85. package/dist/hooks/useNotificationTopics.d.ts.map +1 -0
  86. package/dist/hooks/useNotificationTopics.js +127 -0
  87. package/dist/hooks/useNotificationTopics.js.map +1 -0
  88. package/dist/hooks/useNotifications.d.ts +36 -0
  89. package/dist/hooks/useNotifications.d.ts.map +1 -0
  90. package/dist/hooks/useNotifications.js +289 -0
  91. package/dist/hooks/useNotifications.js.map +1 -0
  92. package/dist/hooks/useSendNotification.d.ts +159 -0
  93. package/dist/hooks/useSendNotification.d.ts.map +1 -0
  94. package/dist/hooks/useSendNotification.js +123 -0
  95. package/dist/hooks/useSendNotification.js.map +1 -0
  96. package/dist/hooks/useUserSearch.d.ts +27 -0
  97. package/dist/hooks/useUserSearch.d.ts.map +1 -0
  98. package/dist/hooks/useUserSearch.js +76 -0
  99. package/dist/hooks/useUserSearch.js.map +1 -0
  100. package/dist/index.d.ts +37 -0
  101. package/dist/index.d.ts.map +1 -0
  102. package/dist/index.js +13 -0
  103. package/dist/pages/CreateNotificationPage.d.ts +6 -0
  104. package/dist/pages/CreateNotificationPage.d.ts.map +1 -0
  105. package/dist/pages/CreateNotificationPage.js +1366 -0
  106. package/dist/pages/CreateNotificationPage.js.map +1 -0
  107. package/dist/pages/NotificationCenterPage.d.ts +7 -0
  108. package/dist/pages/NotificationCenterPage.d.ts.map +1 -0
  109. package/dist/pages/NotificationCenterPage.js +203 -0
  110. package/dist/pages/NotificationCenterPage.js.map +1 -0
  111. package/dist/pages/NotificationHistoryAdminPage.d.ts +3 -0
  112. package/dist/pages/NotificationHistoryAdminPage.d.ts.map +1 -0
  113. package/dist/pages/NotificationHistoryAdminPage.js +484 -0
  114. package/dist/pages/NotificationHistoryAdminPage.js.map +1 -0
  115. package/dist/pages/NotificationHistoryPage.d.ts +3 -0
  116. package/dist/pages/NotificationHistoryPage.d.ts.map +1 -0
  117. package/dist/pages/NotificationHistoryPage.js +136 -0
  118. package/dist/pages/NotificationHistoryPage.js.map +1 -0
  119. package/dist/pages/NotificationLandingPage.d.ts +11 -0
  120. package/dist/pages/NotificationLandingPage.d.ts.map +1 -0
  121. package/dist/pages/NotificationLandingPage.js +85 -0
  122. package/dist/pages/NotificationLandingPage.js.map +1 -0
  123. package/dist/pages/NotificationPreferencesPage.d.ts +2 -0
  124. package/dist/pages/NotificationPreferencesPage.d.ts.map +1 -0
  125. package/dist/pages/NotificationPreferencesPage.js +108 -0
  126. package/dist/pages/NotificationPreferencesPage.js.map +1 -0
  127. package/dist/pages/NotificationTemplatesPage.d.ts +8 -0
  128. package/dist/pages/NotificationTemplatesPage.d.ts.map +1 -0
  129. package/dist/pages/NotificationTemplatesPage.js +310 -0
  130. package/dist/pages/NotificationTemplatesPage.js.map +1 -0
  131. package/dist/pages/NotificationTopicsPage.d.ts +2 -0
  132. package/dist/pages/NotificationTopicsPage.d.ts.map +1 -0
  133. package/dist/pages/NotificationTopicsPage.js +254 -0
  134. package/dist/pages/NotificationTopicsPage.js.map +1 -0
  135. package/dist/pages/TemplateEditorPage.d.ts +13 -0
  136. package/dist/pages/TemplateEditorPage.d.ts.map +1 -0
  137. package/dist/pages/TemplateEditorPage.js +790 -0
  138. package/dist/pages/TemplateEditorPage.js.map +1 -0
  139. package/dist/providers/NotificationProvider.d.ts +19 -0
  140. package/dist/providers/NotificationProvider.d.ts.map +1 -0
  141. package/dist/providers/NotificationProvider.js +35 -0
  142. package/dist/providers/NotificationProvider.js.map +1 -0
  143. package/dist/shared/hooks/useTr.d.ts +14 -0
  144. package/dist/shared/hooks/useTr.d.ts.map +1 -0
  145. package/dist/shared/hooks/useTr.js +14 -0
  146. package/dist/shared/hooks/useTr.js.map +1 -0
  147. package/dist/store/notificationStore.d.ts +32 -0
  148. package/dist/store/notificationStore.d.ts.map +1 -0
  149. package/dist/store/notificationStore.js +124 -0
  150. package/dist/store/notificationStore.js.map +1 -0
  151. package/dist/types/index.d.ts +215 -0
  152. package/dist/types/index.d.ts.map +1 -0
  153. package/dist/utils/index.d.ts +68 -0
  154. package/dist/utils/index.d.ts.map +1 -0
  155. package/dist/utils/index.js +122 -0
  156. package/dist/utils/index.js.map +1 -0
  157. package/dist/utils/notificationHistoryExport.d.ts +13 -0
  158. package/dist/utils/notificationHistoryExport.d.ts.map +1 -0
  159. package/dist/utils/notificationHistoryExport.js +29 -0
  160. package/dist/utils/notificationHistoryExport.js.map +1 -0
  161. package/package.json +115 -0
@@ -0,0 +1,112 @@
1
+ import { useTr as e } from "../shared/hooks/useTr.js";
2
+ import { formatRelativeTime as t, getNotificationTypeIcon as n, getPriorityColor as r, getPriorityIcon as i, truncateText as a } from "../utils/index.js";
3
+ import { ExternalLink as o, X as s } from "lucide-react";
4
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ //#region src/components/NotificationCard.tsx
6
+ function d({ notification: d, onMarkAsRead: f, onArchive: p, onAction: m, onClick: h, showArchivedState: g = !1, compact: _ = !1 }) {
7
+ let v = e(), y = !d.readAt, b = !!d.archivedAt, x = () => {
8
+ h && h(d), y && f && f(d.id);
9
+ }, S = (e) => {
10
+ e.stopPropagation(), p && p(d.id);
11
+ }, C = (e) => {
12
+ e.stopPropagation(), d.actionUrl && (m?.(d.id), window.open(d.actionUrl, "_blank"));
13
+ }, w = (e, t, n) => {
14
+ e.stopPropagation(), m?.(d.id, t), window.open(n, "_blank");
15
+ };
16
+ return /* @__PURE__ */ u("div", {
17
+ className: `
18
+ relative flex flex-col gap-2 p-4 rounded-lg border cursor-pointer
19
+ transition-all duration-200 ease-in-out
20
+ ${y ? "bg-accent-subtle/5 border-accent-primary/20 shadow-sm ring-1 ring-accent-primary/10" : "bg-surface border-default opacity-75"}
21
+ ${g && b ? "border-dashed opacity-60" : ""}
22
+ hover:bg-muted hover:shadow-md hover:-translate-y-0.5 hover:opacity-100
23
+ `,
24
+ onClick: x,
25
+ children: [
26
+ y && /* @__PURE__ */ l("div", { className: "absolute top-4 left-1.5 w-2.5 h-2.5 bg-accent-primary rounded-full shadow-sm shadow-accent-primary/50 animate-pulse" }),
27
+ /* @__PURE__ */ u("div", {
28
+ className: "flex items-start justify-between gap-2 ml-3",
29
+ children: [/* @__PURE__ */ u("div", {
30
+ className: "flex items-center gap-2 flex-1 min-w-0",
31
+ children: [
32
+ /* @__PURE__ */ l("span", {
33
+ className: "text-base",
34
+ "aria-hidden": "true",
35
+ children: n(d.type)
36
+ }),
37
+ /* @__PURE__ */ l("h3", {
38
+ className: `text-sm truncate ${y ? "font-bold text-primary" : "font-medium text-secondary"}`,
39
+ children: _ ? a(d.title, 60) : d.title
40
+ }),
41
+ /* @__PURE__ */ l("span", {
42
+ className: "text-xs",
43
+ "aria-label": `Priority: ${d.priority}`,
44
+ children: i(d.priority)
45
+ })
46
+ ]
47
+ }), p && /* @__PURE__ */ l("button", {
48
+ onClick: S,
49
+ className: "flex-shrink-0 p-1 hover:bg-muted rounded transition-colors duration-150",
50
+ "aria-label": v("notifCommon.archiveNotification", "Archive notification"),
51
+ children: /* @__PURE__ */ l(s, {
52
+ size: 16,
53
+ className: "text-tertiary hover:text-secondary"
54
+ })
55
+ })]
56
+ }),
57
+ /* @__PURE__ */ u("div", {
58
+ className: "ml-3",
59
+ children: [
60
+ d.media[0]?.url && /* @__PURE__ */ l("img", {
61
+ src: d.media[0].thumbnailUrl || d.media[0].url,
62
+ alt: d.media[0].label || d.title,
63
+ className: "mb-3 h-40 w-full rounded-md object-cover border border-default"
64
+ }),
65
+ /* @__PURE__ */ l("p", {
66
+ className: `text-sm text-secondary ${_ ? "line-clamp-2" : ""}`,
67
+ children: _ ? a(d.body, 120) : d.body
68
+ }),
69
+ d.topic && /* @__PURE__ */ l("div", {
70
+ className: "mt-2 inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-xs text-secondary",
71
+ children: d.topic.name
72
+ })
73
+ ]
74
+ }),
75
+ d.actions.length > 0 && !_ && /* @__PURE__ */ l("div", {
76
+ className: "ml-3 flex flex-wrap gap-2",
77
+ children: d.actions.map((e) => /* @__PURE__ */ l("button", {
78
+ onClick: (t) => w(t, e.id, e.url),
79
+ className: `rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${e.style === "secondary" ? "bg-muted text-secondary hover:bg-muted/80" : e.style === "danger" ? "bg-status-error-bg-subtle text-status-error-text hover:opacity-80" : "bg-accent-primary text-white hover:opacity-90"}`,
80
+ children: e.label
81
+ }, e.id))
82
+ }),
83
+ /* @__PURE__ */ u("div", {
84
+ className: "flex items-center justify-between gap-2 ml-3",
85
+ children: [/* @__PURE__ */ u("div", {
86
+ className: "flex items-center gap-2 text-xs text-tertiary",
87
+ children: [
88
+ /* @__PURE__ */ l("span", {
89
+ className: r(d.priority),
90
+ children: d.priority
91
+ }),
92
+ g && b && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("span", { children: "•" }), /* @__PURE__ */ l("span", { children: v("notifCommon.archived", "Archived") })] }),
93
+ /* @__PURE__ */ l("span", { children: "•" }),
94
+ /* @__PURE__ */ l("time", {
95
+ dateTime: d.createdAt,
96
+ children: t(d.createdAt)
97
+ })
98
+ ]
99
+ }), d.actionUrl && /* @__PURE__ */ u("button", {
100
+ onClick: C,
101
+ className: "flex items-center gap-1 text-xs text-accent-primary hover:text-accent-primary/80 transition-colors duration-150",
102
+ "aria-label": v("notifCommon.openLink", "Open link"),
103
+ children: [/* @__PURE__ */ l("span", { children: v("notifCommon.view", "View") }), /* @__PURE__ */ l(o, { size: 12 })]
104
+ })]
105
+ })
106
+ ]
107
+ });
108
+ }
109
+ //#endregion
110
+ export { d as NotificationCard };
111
+
112
+ //# sourceMappingURL=NotificationCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationCard.js","names":[],"sources":["../../src/components/NotificationCard.tsx"],"sourcesContent":["import { X, ExternalLink } from 'lucide-react';\nimport type { Notification } from '../types';\nimport { useTr } from '../shared/hooks/useTr';\nimport {\n formatRelativeTime,\n getPriorityColor,\n getPriorityIcon,\n getNotificationTypeIcon,\n truncateText,\n} from '../utils';\n\ninterface NotificationCardProps {\n notification: Notification;\n onMarkAsRead?: (id: string) => void;\n onArchive?: (id: string) => void;\n onAction?: (notificationId: string, actionId?: string) => void;\n onClick?: (notification: Notification) => void;\n showArchivedState?: boolean;\n compact?: boolean;\n}\n\n/**\n * Notification card component\n *\n * Displays notification information with action buttons\n */\nexport function NotificationCard({\n notification,\n onMarkAsRead,\n onArchive,\n onAction,\n onClick,\n showArchivedState = false,\n compact = false,\n}: NotificationCardProps) {\n const tr = useTr();\n const isUnread = !notification.readAt;\n const isArchived = Boolean(notification.archivedAt);\n\n const handleClick = () => {\n if (onClick) {\n onClick(notification);\n }\n if (isUnread && onMarkAsRead) {\n onMarkAsRead(notification.id);\n }\n };\n\n const handleArchive = (e: React.MouseEvent) => {\n e.stopPropagation();\n if (onArchive) {\n onArchive(notification.id);\n }\n };\n\n const handleActionUrl = (e: React.MouseEvent) => {\n e.stopPropagation();\n if (notification.actionUrl) {\n onAction?.(notification.id);\n window.open(notification.actionUrl, '_blank');\n }\n };\n\n const handleActionClick = (e: React.MouseEvent, actionId: string, actionUrl: string) => {\n e.stopPropagation();\n onAction?.(notification.id, actionId);\n window.open(actionUrl, '_blank');\n };\n\n return (\n <div\n className={`\n relative flex flex-col gap-2 p-4 rounded-lg border cursor-pointer\n transition-all duration-200 ease-in-out\n ${isUnread ? 'bg-accent-subtle/5 border-accent-primary/20 shadow-sm ring-1 ring-accent-primary/10' : 'bg-surface border-default opacity-75'}\n ${showArchivedState && isArchived ? 'border-dashed opacity-60' : ''}\n hover:bg-muted hover:shadow-md hover:-translate-y-0.5 hover:opacity-100\n `}\n onClick={handleClick}\n >\n {/* Unread indicator */}\n {isUnread && (\n <div className=\"absolute top-4 left-1.5 w-2.5 h-2.5 bg-accent-primary rounded-full shadow-sm shadow-accent-primary/50 animate-pulse\" />\n )}\n\n {/* Header */}\n <div className=\"flex items-start justify-between gap-2 ml-3\">\n <div className=\"flex items-center gap-2 flex-1 min-w-0\">\n <span className=\"text-base\" aria-hidden=\"true\">\n {getNotificationTypeIcon(notification.type)}\n </span>\n <h3\n className={`text-sm truncate ${isUnread ? 'font-bold text-primary' : 'font-medium text-secondary'}`}\n >\n {compact ? truncateText(notification.title, 60) : notification.title}\n </h3>\n <span className=\"text-xs\" aria-label={`Priority: ${notification.priority}`}>\n {getPriorityIcon(notification.priority)}\n </span>\n </div>\n\n {onArchive && (\n <button\n onClick={handleArchive}\n className=\"flex-shrink-0 p-1 hover:bg-muted rounded transition-colors duration-150\"\n aria-label={tr('notifCommon.archiveNotification', 'Archive notification')}\n >\n <X size={16} className=\"text-tertiary hover:text-secondary\" />\n </button>\n )}\n </div>\n\n {/* Body */}\n <div className=\"ml-3\">\n {notification.media[0]?.url && (\n <img\n src={notification.media[0].thumbnailUrl || notification.media[0].url}\n alt={notification.media[0].label || notification.title}\n className=\"mb-3 h-40 w-full rounded-md object-cover border border-default\"\n />\n )}\n <p className={`text-sm text-secondary ${compact ? 'line-clamp-2' : ''}`}>\n {compact ? truncateText(notification.body, 120) : notification.body}\n </p>\n {notification.topic && (\n <div className=\"mt-2 inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-xs text-secondary\">\n {notification.topic.name}\n </div>\n )}\n </div>\n\n {notification.actions.length > 0 && !compact && (\n <div className=\"ml-3 flex flex-wrap gap-2\">\n {notification.actions.map((action) => (\n <button\n key={action.id}\n onClick={(e) => handleActionClick(e, action.id, action.url)}\n className={`rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${\n action.style === 'secondary'\n ? 'bg-muted text-secondary hover:bg-muted/80'\n : action.style === 'danger'\n ? 'bg-status-error-bg-subtle text-status-error-text hover:opacity-80'\n : 'bg-accent-primary text-white hover:opacity-90'\n }`}\n >\n {action.label}\n </button>\n ))}\n </div>\n )}\n\n {/* Footer */}\n <div className=\"flex items-center justify-between gap-2 ml-3\">\n <div className=\"flex items-center gap-2 text-xs text-tertiary\">\n <span className={getPriorityColor(notification.priority)}>{notification.priority}</span>\n {showArchivedState && isArchived && (\n <>\n <span>•</span>\n <span>{tr('notifCommon.archived', 'Archived')}</span>\n </>\n )}\n <span>•</span>\n <time dateTime={notification.createdAt}>\n {formatRelativeTime(notification.createdAt)}\n </time>\n </div>\n\n {notification.actionUrl && (\n <button\n onClick={handleActionUrl}\n className=\"flex items-center gap-1 text-xs text-accent-primary hover:text-accent-primary/80 transition-colors duration-150\"\n aria-label={tr('notifCommon.openLink', 'Open link')}\n >\n <span>{tr('notifCommon.view', 'View')}</span>\n <ExternalLink size={12} />\n </button>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;AA0BA,SAAgB,EAAiB,EAC/B,iBACA,iBACA,cACA,aACA,YACA,uBAAoB,IACpB,aAAU,MACc;CACxB,IAAM,IAAK,GAAO,EACZ,IAAW,CAAC,EAAa,QACzB,IAAa,EAAQ,EAAa,YAElC,UAAoB;AAIxB,EAHI,KACF,EAAQ,EAAa,EAEnB,KAAY,KACd,EAAa,EAAa,GAAG;IAI3B,KAAiB,MAAwB;AAE7C,EADA,EAAE,iBAAiB,EACf,KACF,EAAU,EAAa,GAAG;IAIxB,KAAmB,MAAwB;AAE/C,EADA,EAAE,iBAAiB,EACf,EAAa,cACf,IAAW,EAAa,GAAG,EAC3B,OAAO,KAAK,EAAa,WAAW,SAAS;IAI3C,KAAqB,GAAqB,GAAkB,MAAsB;AAGtF,EAFA,EAAE,iBAAiB,EACnB,IAAW,EAAa,IAAI,EAAS,EACrC,OA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D;KAEE,UAAU,MAAM,EAAkB,GAAG,EAAO,IAAI,EAAO,IAAI;KAC3D,WAAW,gEACT,EAAO,UAAU,cACb,8CACA,EAAO,UAAU,WACf,sEACA;eAGP,EAAO;KACD,EAXF,EAAO,GAWL,CACT;IACE,CAAA;GAIR,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,QAAD;OAAM,WAAW,EAAiB,EAAa,SAAS;iBAAG,EAAa;OAAgB,CAAA;MACvF,KAAqB,KACpB,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,QAAD,EAAA,UAAM,KAAQ,CAAA,EACd,kBAAC,QAAD,EAAA,UAAO,EAAG,wBAAwB,WAAW,EAAQ,CAAA,CACpD,EAAA,CAAA;MAEL,kBAAC,QAAD,EAAA,UAAM,KAAQ,CAAA;MACd,kBAAC,QAAD;OAAM,UAAU,EAAa;iBAC1B,EAAmB,EAAa,UAAU;OACtC,CAAA;MACH;QAEL,EAAa,aACZ,kBAAC,UAAD;KACE,SAAS;KACT,WAAU;KACV,cAAY,EAAG,wBAAwB,YAAY;eAHrD,CAKE,kBAAC,QAAD,EAAA,UAAO,EAAG,oBAAoB,OAAO,EAAQ,CAAA,EAC7C,kBAAC,GAAD,EAAc,MAAM,IAAM,CAAA,CACnB;OAEP;;GACF"}
@@ -0,0 +1,11 @@
1
+ interface NotificationPanelProps {
2
+ onViewAll?: () => void;
3
+ }
4
+ /**
5
+ * Notification dropdown panel
6
+ *
7
+ * Quick view of recent notifications that appears when clicking the bell icon
8
+ */
9
+ export declare function NotificationPanel({ onViewAll }: NotificationPanelProps): import("react/jsx-runtime").JSX.Element | null;
10
+ export {};
11
+ //# sourceMappingURL=NotificationPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationPanel.d.ts","sourceRoot":"","sources":["../../src/components/NotificationPanel.tsx"],"names":[],"mappings":"AAMA,UAAU,sBAAsB;IAC9B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,EAAE,sBAAsB,kDAsGtE"}
@@ -0,0 +1,100 @@
1
+ import { useNotificationStore as e } from "../store/notificationStore.js";
2
+ import { useNotifications as t } from "../hooks/useNotifications.js";
3
+ import "../hooks/index.js";
4
+ import { useTr as n } from "../shared/hooks/useTr.js";
5
+ import { NotificationCard as r } from "./NotificationCard.js";
6
+ import { Bell as i, X as a } from "lucide-react";
7
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
8
+ //#region src/components/NotificationPanel.tsx
9
+ function l({ onViewAll: l }) {
10
+ let u = n(), { isPanelOpen: d, togglePanel: f } = e(), { notifications: p, unreadCount: m, markAsRead: h, markAllAsRead: g, archiveNotification: _, recordAction: v } = t();
11
+ if (!d) return null;
12
+ let y = p.slice(0, 5);
13
+ return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", {
14
+ className: "fixed inset-0 z-40",
15
+ onClick: f,
16
+ "aria-hidden": "true"
17
+ }), /* @__PURE__ */ c("div", {
18
+ className: "absolute right-0 top-full mt-2 w-96 max-h-[600px] bg-surface border border-default rounded-lg shadow-lg z-50 overflow-hidden flex flex-col animate-in fade-in slide-in-from-top-2 duration-200",
19
+ children: [
20
+ /* @__PURE__ */ c("div", {
21
+ className: "flex items-center justify-between p-4 border-b border-default",
22
+ children: [/* @__PURE__ */ c("div", {
23
+ className: "flex items-center gap-2",
24
+ children: [
25
+ /* @__PURE__ */ s(i, {
26
+ size: 20,
27
+ className: "text-primary"
28
+ }),
29
+ /* @__PURE__ */ s("h2", {
30
+ className: "text-base font-semibold text-primary",
31
+ children: u("notifCommon.notifications", "Notifications")
32
+ }),
33
+ m > 0 && /* @__PURE__ */ s("span", {
34
+ className: "px-2 py-0.5 text-xs font-semibold text-white bg-primary-500 rounded-full",
35
+ children: m
36
+ })
37
+ ]
38
+ }), /* @__PURE__ */ c("div", {
39
+ className: "flex items-center gap-2",
40
+ children: [m > 0 && /* @__PURE__ */ s("button", {
41
+ onClick: g,
42
+ className: "text-xs text-accent-primary hover:text-accent-primary/80 transition-colors duration-150",
43
+ children: u("notifCommon.markAllRead", "Mark all read")
44
+ }), /* @__PURE__ */ s("button", {
45
+ onClick: f,
46
+ className: "p-1 hover:bg-muted rounded transition-colors duration-150",
47
+ "aria-label": u("notifCommon.closePanel", "Close panel"),
48
+ children: /* @__PURE__ */ s(a, {
49
+ size: 16,
50
+ className: "text-tertiary"
51
+ })
52
+ })]
53
+ })]
54
+ }),
55
+ /* @__PURE__ */ s("div", {
56
+ className: "flex-1 overflow-y-auto",
57
+ children: y.length > 0 ? /* @__PURE__ */ s("div", {
58
+ className: "flex flex-col gap-2 p-2",
59
+ children: y.map((e) => /* @__PURE__ */ s(r, {
60
+ notification: e,
61
+ onMarkAsRead: h,
62
+ onArchive: _,
63
+ onAction: v,
64
+ compact: !0
65
+ }, e.id))
66
+ }) : /* @__PURE__ */ c("div", {
67
+ className: "flex flex-col items-center justify-center p-8 text-center animate-in fade-in duration-300",
68
+ children: [
69
+ /* @__PURE__ */ s(i, {
70
+ size: 48,
71
+ className: "text-tertiary mb-4"
72
+ }),
73
+ /* @__PURE__ */ s("p", {
74
+ className: "text-sm text-secondary",
75
+ children: u("notifCommon.noNotifications", "No notifications")
76
+ }),
77
+ /* @__PURE__ */ s("p", {
78
+ className: "text-xs text-tertiary mt-1",
79
+ children: u("notifCommon.allCaughtUp", "You're all caught up!")
80
+ })
81
+ ]
82
+ })
83
+ }),
84
+ y.length > 0 && /* @__PURE__ */ s("div", {
85
+ className: "p-3 border-t border-default",
86
+ children: /* @__PURE__ */ s("button", {
87
+ onClick: () => {
88
+ f(), l && l();
89
+ },
90
+ className: "w-full py-2 text-sm text-accent-primary hover:text-accent-primary/80 font-medium transition-colors duration-150",
91
+ children: u("notifCommon.viewAllNotifications", "View All Notifications")
92
+ })
93
+ })
94
+ ]
95
+ })] });
96
+ }
97
+ //#endregion
98
+ export { l as NotificationPanel };
99
+
100
+ //# sourceMappingURL=NotificationPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationPanel.js","names":[],"sources":["../../src/components/NotificationPanel.tsx"],"sourcesContent":["import { X, Bell } from 'lucide-react';\nimport { useNotificationStore } from '../store/notificationStore';\nimport { useNotifications } from '../hooks';\nimport { NotificationCard } from './NotificationCard';\nimport { useTr } from '../shared/hooks/useTr';\n\ninterface NotificationPanelProps {\n onViewAll?: () => void;\n}\n\n/**\n * Notification dropdown panel\n *\n * Quick view of recent notifications that appears when clicking the bell icon\n */\nexport function NotificationPanel({ onViewAll }: NotificationPanelProps) {\n const tr = useTr();\n const { isPanelOpen, togglePanel } = useNotificationStore();\n const {\n notifications,\n unreadCount,\n markAsRead,\n markAllAsRead,\n archiveNotification,\n recordAction,\n } = useNotifications();\n\n if (!isPanelOpen) return null;\n\n // Show only the 5 most recent notifications\n const recentNotifications = notifications.slice(0, 5);\n\n return (\n <>\n {/* Backdrop */}\n <div className=\"fixed inset-0 z-40\" onClick={togglePanel} aria-hidden=\"true\" />\n\n {/* Panel */}\n <div className=\"absolute right-0 top-full mt-2 w-96 max-h-[600px] bg-surface border border-default rounded-lg shadow-lg z-50 overflow-hidden flex flex-col animate-in fade-in slide-in-from-top-2 duration-200\">\n {/* Header */}\n <div className=\"flex items-center justify-between p-4 border-b border-default\">\n <div className=\"flex items-center gap-2\">\n <Bell size={20} className=\"text-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifCommon.notifications', 'Notifications')}\n </h2>\n {unreadCount > 0 && (\n <span className=\"px-2 py-0.5 text-xs font-semibold text-white bg-primary-500 rounded-full\">\n {unreadCount}\n </span>\n )}\n </div>\n\n <div className=\"flex items-center gap-2\">\n {unreadCount > 0 && (\n <button\n onClick={markAllAsRead}\n className=\"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors duration-150\"\n >\n {tr('notifCommon.markAllRead', 'Mark all read')}\n </button>\n )}\n <button\n onClick={togglePanel}\n className=\"p-1 hover:bg-muted rounded transition-colors duration-150\"\n aria-label={tr('notifCommon.closePanel', 'Close panel')}\n >\n <X size={16} className=\"text-tertiary\" />\n </button>\n </div>\n </div>\n\n {/* Notifications list */}\n <div className=\"flex-1 overflow-y-auto\">\n {recentNotifications.length > 0 ? (\n <div className=\"flex flex-col gap-2 p-2\">\n {recentNotifications.map((notification) => (\n <NotificationCard\n key={notification.id}\n notification={notification}\n onMarkAsRead={markAsRead}\n onArchive={archiveNotification}\n onAction={recordAction}\n compact\n />\n ))}\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center p-8 text-center animate-in fade-in duration-300\">\n <Bell size={48} className=\"text-tertiary mb-4\" />\n <p className=\"text-sm text-secondary\">\n {tr('notifCommon.noNotifications', 'No notifications')}\n </p>\n <p className=\"text-xs text-tertiary mt-1\">\n {tr('notifCommon.allCaughtUp', \"You're all caught up!\")}\n </p>\n </div>\n )}\n </div>\n\n {/* Footer */}\n {recentNotifications.length > 0 && (\n <div className=\"p-3 border-t border-default\">\n <button\n onClick={() => {\n togglePanel();\n if (onViewAll) onViewAll();\n }}\n className=\"w-full py-2 text-sm text-accent-primary hover:text-accent-primary/80 font-medium transition-colors duration-150\"\n >\n {tr('notifCommon.viewAllNotifications', 'View All Notifications')}\n </button>\n </div>\n )}\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;AAeA,SAAgB,EAAkB,EAAE,gBAAqC;CACvE,IAAM,IAAK,GAAO,EACZ,EAAE,gBAAa,mBAAgB,GAAsB,EACrD,EACJ,kBACA,gBACA,eACA,kBACA,wBACA,oBACE,GAAkB;AAEtB,KAAI,CAAC,EAAa,QAAO;CAGzB,IAAM,IAAsB,EAAc,MAAM,GAAG,EAAE;AAErD,QACE,kBAAA,GAAA,EAAA,UAAA,CAEE,kBAAC,OAAD;EAAK,WAAU;EAAqB,SAAS;EAAa,eAAY;EAAS,CAAA,EAG/E,kBAAC,OAAD;EAAK,WA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}
@@ -0,0 +1,34 @@
1
+ import { RecipientInput, NotificationChannelType } from '../hooks/useSendNotification';
2
+
3
+ /**
4
+ * Recipient with display info
5
+ */
6
+ export interface Recipient extends RecipientInput {
7
+ id: string;
8
+ displayName: string;
9
+ type: 'email' | 'phone' | 'user' | 'manual';
10
+ }
11
+ interface RecipientSelectorProps {
12
+ recipients: Recipient[];
13
+ onChange: (recipients: Recipient[]) => void;
14
+ channel: NotificationChannelType;
15
+ placeholder?: string;
16
+ disabled?: boolean;
17
+ maxRecipients?: number;
18
+ error?: string;
19
+ }
20
+ /**
21
+ * RecipientSelector component
22
+ *
23
+ * Allows selecting multiple recipients for notifications.
24
+ * Supports email, phone, and manual input based on channel type.
25
+ */
26
+ export declare function RecipientSelector({ recipients, onChange, channel, placeholder, disabled, maxRecipients, error, }: RecipientSelectorProps): import("react/jsx-runtime").JSX.Element;
27
+ /**
28
+ * Compact recipient display for read-only views
29
+ */
30
+ export declare function RecipientList({ recipients }: {
31
+ recipients: Recipient[];
32
+ }): import("react/jsx-runtime").JSX.Element;
33
+ export {};
34
+ //# sourceMappingURL=RecipientSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecipientSelector.d.ts","sourceRoot":"","sources":["../../src/components/RecipientSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAG5F;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;CAC7C;AAED,UAAU,sBAAsB;IAC9B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,uBAAuB,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAyCD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAgB,EAChB,aAAmB,EACnB,KAAK,GACN,EAAE,sBAAsB,2CAmTxB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,2CA6BxE"}
@@ -0,0 +1,212 @@
1
+ import { useTr as e } from "../shared/hooks/useTr.js";
2
+ import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
3
+ import { AlertCircle as a, Mail as o, Phone as s, Plus as c, User as l, X as u } from "lucide-react";
4
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
+ //#region src/components/RecipientSelector.tsx
6
+ function p(e) {
7
+ switch (e) {
8
+ case "email": return /* @__PURE__ */ d(o, {
9
+ size: 14,
10
+ className: "text-status-info-text"
11
+ });
12
+ case "phone": return /* @__PURE__ */ d(s, {
13
+ size: 14,
14
+ className: "text-status-success-text"
15
+ });
16
+ case "user": return /* @__PURE__ */ d(l, {
17
+ size: 14,
18
+ className: "text-accent-purple"
19
+ });
20
+ default: return /* @__PURE__ */ d(l, {
21
+ size: 14,
22
+ className: "text-muted-foreground"
23
+ });
24
+ }
25
+ }
26
+ function m(e) {
27
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
28
+ }
29
+ function h(e) {
30
+ return /^\+?[1-9]\d{6,14}$/.test(e.replace(/[\s\-\(\)]/g, ""));
31
+ }
32
+ function g() {
33
+ return `recipient-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
34
+ }
35
+ function _({ recipients: o, onChange: s, channel: l, placeholder: _, disabled: v = !1, maxRecipients: y = 100, error: b }) {
36
+ let x = e(), [S, C] = i(""), [w, T] = i(null), [E, D] = i(!1), O = r(null), k = l === "EMAIL" ? "email" : l === "SMS" || l === "WHATSAPP" ? "phone" : "text", A = _ || (l === "EMAIL" ? x("notifCommon.enterEmailPlaceholder", "Enter email address...") : l === "SMS" || l === "WHATSAPP" ? x("notifCommon.enterPhonePlaceholder", "Enter phone number (e.g., +1234567890)...") : l === "PUSH" ? x("notifCommon.enterDeviceTokenPlaceholder", "Enter device token...") : l === "SLACK" ? x("notifCommon.enterSlackIdPlaceholder", "Enter Slack user ID...") : l === "TEAMS" ? x("notifCommon.enterTeamsIdPlaceholder", "Enter Teams user ID...") : x("notifCommon.enterRecipientPlaceholder", "Enter recipient..."));
37
+ n(() => {
38
+ S && T(null);
39
+ }, [S]);
40
+ let j = t((e) => {
41
+ let t = e.trim();
42
+ if (!t) return;
43
+ if (o.length >= y) {
44
+ T(x("notifCommon.maxRecipientsAllowed", `Maximum ${y} recipients allowed`));
45
+ return;
46
+ }
47
+ if (o.some((e) => l === "EMAIL" ? e.email === t : l === "SMS" || l === "WHATSAPP" ? e.phoneNumber === t || e.whatsappNumber === t : !1)) {
48
+ T(x("notifCommon.duplicateRecipient", "This recipient has already been added"));
49
+ return;
50
+ }
51
+ let n = null;
52
+ if (l === "EMAIL") {
53
+ if (!m(t)) {
54
+ T(x("notifCommon.invalidEmail", "Please enter a valid email address"));
55
+ return;
56
+ }
57
+ n = {
58
+ id: g(),
59
+ email: t,
60
+ displayName: t,
61
+ type: "email"
62
+ };
63
+ } else if (l === "SMS") {
64
+ if (!h(t)) {
65
+ T(x("notifCommon.invalidPhone", "Please enter a valid phone number (e.g., +1234567890)"));
66
+ return;
67
+ }
68
+ n = {
69
+ id: g(),
70
+ phoneNumber: t,
71
+ displayName: t,
72
+ type: "phone"
73
+ };
74
+ } else if (l === "WHATSAPP") {
75
+ if (!h(t)) {
76
+ T(x("notifCommon.invalidWhatsApp", "Please enter a valid WhatsApp number (e.g., +1234567890)"));
77
+ return;
78
+ }
79
+ n = {
80
+ id: g(),
81
+ whatsappNumber: t,
82
+ displayName: t,
83
+ type: "phone"
84
+ };
85
+ } else n = l === "PUSH" ? {
86
+ id: g(),
87
+ pushToken: t,
88
+ displayName: t.substring(0, 20) + "...",
89
+ type: "manual"
90
+ } : l === "SLACK" ? {
91
+ id: g(),
92
+ slackUserId: t,
93
+ displayName: t,
94
+ type: "user"
95
+ } : l === "TEAMS" ? {
96
+ id: g(),
97
+ teamsUserId: t,
98
+ displayName: t,
99
+ type: "user"
100
+ } : l === "WEBHOOK" ? {
101
+ id: g(),
102
+ webhookUrl: t,
103
+ displayName: t,
104
+ type: "manual"
105
+ } : {
106
+ id: g(),
107
+ userId: t,
108
+ displayName: t,
109
+ type: "user"
110
+ };
111
+ n && (s([...o, n]), C(""), T(null));
112
+ }, [
113
+ o,
114
+ s,
115
+ l,
116
+ y,
117
+ x
118
+ ]), M = t((e) => {
119
+ s(o.filter((t) => t.id !== e));
120
+ }, [o, s]);
121
+ return /* @__PURE__ */ f("div", {
122
+ className: "space-y-2",
123
+ children: [
124
+ /* @__PURE__ */ f("div", {
125
+ className: `
126
+ relative flex flex-wrap items-center gap-2 p-2 min-h-[42px]
127
+ bg-surface border rounded-lg transition-colors
128
+ ${E ? "border-primary-500 ring-1 ring-primary-500" : "border-border"}
129
+ ${v ? "opacity-50 cursor-not-allowed bg-muted" : ""}
130
+ ${b || w ? "border-error-500" : ""}
131
+ `,
132
+ onClick: () => O.current?.focus(),
133
+ children: [
134
+ o.map((e) => /* @__PURE__ */ f("div", {
135
+ className: "flex items-center gap-1.5 px-2 py-1 bg-surface-elevated border border-border rounded-full text-sm",
136
+ children: [
137
+ p(e.type),
138
+ /* @__PURE__ */ d("span", {
139
+ className: "text-foreground max-w-[200px] truncate",
140
+ children: e.displayName
141
+ }),
142
+ !v && /* @__PURE__ */ d("button", {
143
+ type: "button",
144
+ onClick: (t) => {
145
+ t.stopPropagation(), M(e.id);
146
+ },
147
+ className: "p-0.5 hover:bg-surface-hover rounded-full transition-colors",
148
+ "aria-label": x("notifCommon.removeRecipient", "Remove {{name}}").replace("{{name}}", e.displayName),
149
+ children: /* @__PURE__ */ d(u, {
150
+ size: 12,
151
+ className: "text-muted-foreground"
152
+ })
153
+ })
154
+ ]
155
+ }, e.id)),
156
+ !v && o.length < y && /* @__PURE__ */ d("input", {
157
+ ref: O,
158
+ type: k,
159
+ value: S,
160
+ onChange: (e) => C(e.target.value),
161
+ onKeyDown: (e) => {
162
+ e.key === "Enter" || e.key === "," ? (e.preventDefault(), j(S)) : e.key === "Backspace" && !S && o.length > 0 && M(o[o.length - 1].id);
163
+ },
164
+ onPaste: (e) => {
165
+ let t = e.clipboardData.getData("text");
166
+ (t.includes(",") || t.includes("\n")) && (e.preventDefault(), t.split(/[,\n]/).map((e) => e.trim()).filter(Boolean).forEach((e) => {
167
+ j(e);
168
+ }));
169
+ },
170
+ onFocus: () => D(!0),
171
+ onBlur: () => {
172
+ D(!1), S.trim() && j(S);
173
+ },
174
+ placeholder: o.length === 0 ? A : x("notifCommon.addMore", "Add more..."),
175
+ className: "flex-1 min-w-[150px] bg-transparent border-none outline-none text-sm text-foreground placeholder:text-muted-foreground",
176
+ disabled: v
177
+ }),
178
+ !v && S.trim() && /* @__PURE__ */ d("button", {
179
+ type: "button",
180
+ onClick: () => j(S),
181
+ className: "p-1 text-primary-500 hover:bg-primary-100 rounded transition-colors",
182
+ "aria-label": x("notifCommon.addRecipient", "Add recipient"),
183
+ children: /* @__PURE__ */ d(c, { size: 16 })
184
+ })
185
+ ]
186
+ }),
187
+ (b || w) && /* @__PURE__ */ f("div", {
188
+ className: "flex items-center gap-1.5 text-error-500 text-sm",
189
+ children: [/* @__PURE__ */ d(a, { size: 14 }), /* @__PURE__ */ d("span", { children: b || w })]
190
+ }),
191
+ /* @__PURE__ */ f("div", {
192
+ className: "flex items-center justify-between text-xs text-muted-foreground",
193
+ children: [/* @__PURE__ */ f("span", { children: [
194
+ l === "EMAIL" && x("notifCommon.emailHelperText", "Enter email addresses. Press Enter or comma to add multiple."),
195
+ (l === "SMS" || l === "WHATSAPP") && x("notifCommon.phoneHelperText", "Enter phone numbers with country code (e.g., +1234567890)."),
196
+ l === "PUSH" && x("notifCommon.pushHelperText", "Enter device tokens for push notifications."),
197
+ l === "SLACK" && x("notifCommon.slackHelperText", "Enter Slack user IDs."),
198
+ l === "TEAMS" && x("notifCommon.teamsHelperText", "Enter Microsoft Teams user IDs."),
199
+ l === "WEBHOOK" && x("notifCommon.webhookHelperText", "Enter webhook URLs.")
200
+ ] }), /* @__PURE__ */ f("span", { children: [
201
+ o.length,
202
+ " / ",
203
+ y
204
+ ] })]
205
+ })
206
+ ]
207
+ });
208
+ }
209
+ //#endregion
210
+ export { _ as RecipientSelector };
211
+
212
+ //# sourceMappingURL=RecipientSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecipientSelector.js","names":[],"sources":["../../src/components/RecipientSelector.tsx"],"sourcesContent":["import { useState, useCallback, useRef, useEffect } from 'react';\nimport { X, Plus, Mail, Phone, User, Users, AlertCircle } from 'lucide-react';\nimport type { RecipientInput, NotificationChannelType } from '../hooks/useSendNotification';\nimport { useTr } from '../shared/hooks/useTr';\n\n/**\n * Recipient with display info\n */\nexport interface Recipient extends RecipientInput {\n id: string;\n displayName: string;\n type: 'email' | 'phone' | 'user' | 'manual';\n}\n\ninterface RecipientSelectorProps {\n recipients: Recipient[];\n onChange: (recipients: Recipient[]) => void;\n channel: NotificationChannelType;\n placeholder?: string;\n disabled?: boolean;\n maxRecipients?: number;\n error?: string;\n}\n\n/**\n * Get icon for recipient type\n */\nfunction getRecipientIcon(type: Recipient['type']) {\n switch (type) {\n case 'email':\n return <Mail size={14} className=\"text-status-info-text\" />;\n case 'phone':\n return <Phone size={14} className=\"text-status-success-text\" />;\n case 'user':\n return <User size={14} className=\"text-accent-purple\" />;\n default:\n return <User size={14} className=\"text-muted-foreground\" />;\n }\n}\n\n/**\n * Validate email format\n */\nfunction isValidEmail(email: string): boolean {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n return emailRegex.test(email);\n}\n\n/**\n * Validate phone format (basic validation)\n */\nfunction isValidPhone(phone: string): boolean {\n const phoneRegex = /^\\+?[1-9]\\d{6,14}$/;\n return phoneRegex.test(phone.replace(/[\\s\\-\\(\\)]/g, ''));\n}\n\n/**\n * Generate unique ID\n */\nfunction generateId(): string {\n return `recipient-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n}\n\n/**\n * RecipientSelector component\n *\n * Allows selecting multiple recipients for notifications.\n * Supports email, phone, and manual input based on channel type.\n */\nexport function RecipientSelector({\n recipients,\n onChange,\n channel,\n placeholder,\n disabled = false,\n maxRecipients = 100,\n error,\n}: RecipientSelectorProps) {\n const tr = useTr();\n const [inputValue, setInputValue] = useState('');\n const [inputError, setInputError] = useState<string | null>(null);\n const [isFocused, setIsFocused] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Determine input type based on channel\n const inputType =\n channel === 'EMAIL' ? 'email' : channel === 'SMS' || channel === 'WHATSAPP' ? 'phone' : 'text';\n const inputPlaceholder =\n placeholder ||\n (channel === 'EMAIL'\n ? tr('notifCommon.enterEmailPlaceholder', 'Enter email address...')\n : channel === 'SMS' || channel === 'WHATSAPP'\n ? tr('notifCommon.enterPhonePlaceholder', 'Enter phone number (e.g., +1234567890)...')\n : channel === 'PUSH'\n ? tr('notifCommon.enterDeviceTokenPlaceholder', 'Enter device token...')\n : channel === 'SLACK'\n ? tr('notifCommon.enterSlackIdPlaceholder', 'Enter Slack user ID...')\n : channel === 'TEAMS'\n ? tr('notifCommon.enterTeamsIdPlaceholder', 'Enter Teams user ID...')\n : tr('notifCommon.enterRecipientPlaceholder', 'Enter recipient...'));\n\n // Clear input error when input changes\n useEffect(() => {\n if (inputValue) {\n setInputError(null);\n }\n }, [inputValue]);\n\n /**\n * Add a recipient\n */\n const addRecipient = useCallback(\n (value: string) => {\n const trimmedValue = value.trim();\n if (!trimmedValue) return;\n\n // Check max recipients\n if (recipients.length >= maxRecipients) {\n setInputError(\n tr('notifCommon.maxRecipientsAllowed', `Maximum ${maxRecipients} recipients allowed`)\n );\n return;\n }\n\n // Check for duplicates\n const isDuplicate = recipients.some((r) => {\n if (channel === 'EMAIL') return r.email === trimmedValue;\n if (channel === 'SMS' || channel === 'WHATSAPP')\n return r.phoneNumber === trimmedValue || r.whatsappNumber === trimmedValue;\n return false;\n });\n\n if (isDuplicate) {\n setInputError(\n tr('notifCommon.duplicateRecipient', 'This recipient has already been added')\n );\n return;\n }\n\n // Validate based on channel\n let recipient: Recipient | null = null;\n\n if (channel === 'EMAIL') {\n if (!isValidEmail(trimmedValue)) {\n setInputError(tr('notifCommon.invalidEmail', 'Please enter a valid email address'));\n return;\n }\n recipient = {\n id: generateId(),\n email: trimmedValue,\n displayName: trimmedValue,\n type: 'email',\n };\n } else if (channel === 'SMS') {\n if (!isValidPhone(trimmedValue)) {\n setInputError(\n tr('notifCommon.invalidPhone', 'Please enter a valid phone number (e.g., +1234567890)')\n );\n return;\n }\n recipient = {\n id: generateId(),\n phoneNumber: trimmedValue,\n displayName: trimmedValue,\n type: 'phone',\n };\n } else if (channel === 'WHATSAPP') {\n if (!isValidPhone(trimmedValue)) {\n setInputError(\n tr(\n 'notifCommon.invalidWhatsApp',\n 'Please enter a valid WhatsApp number (e.g., +1234567890)'\n )\n );\n return;\n }\n recipient = {\n id: generateId(),\n whatsappNumber: trimmedValue,\n displayName: trimmedValue,\n type: 'phone',\n };\n } else if (channel === 'PUSH') {\n recipient = {\n id: generateId(),\n pushToken: trimmedValue,\n displayName: trimmedValue.substring(0, 20) + '...',\n type: 'manual',\n };\n } else if (channel === 'SLACK') {\n recipient = {\n id: generateId(),\n slackUserId: trimmedValue,\n displayName: trimmedValue,\n type: 'user',\n };\n } else if (channel === 'TEAMS') {\n recipient = {\n id: generateId(),\n teamsUserId: trimmedValue,\n displayName: trimmedValue,\n type: 'user',\n };\n } else if (channel === 'WEBHOOK') {\n recipient = {\n id: generateId(),\n webhookUrl: trimmedValue,\n displayName: trimmedValue,\n type: 'manual',\n };\n } else {\n // Other channels - use userId\n recipient = {\n id: generateId(),\n userId: trimmedValue,\n displayName: trimmedValue,\n type: 'user',\n };\n }\n\n if (recipient) {\n onChange([...recipients, recipient]);\n setInputValue('');\n setInputError(null);\n }\n },\n [recipients, onChange, channel, maxRecipients, tr]\n );\n\n /**\n * Remove a recipient\n */\n const removeRecipient = useCallback(\n (id: string) => {\n onChange(recipients.filter((r) => r.id !== id));\n },\n [recipients, onChange]\n );\n\n /**\n * Handle key down\n */\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter' || e.key === ',') {\n e.preventDefault();\n addRecipient(inputValue);\n } else if (e.key === 'Backspace' && !inputValue && recipients.length > 0) {\n // Remove last recipient on backspace when input is empty\n removeRecipient(recipients[recipients.length - 1].id);\n }\n };\n\n /**\n * Handle paste (for bulk adding)\n */\n const handlePaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n const pastedText = e.clipboardData.getData('text');\n\n // Check if pasted text contains multiple values (comma or newline separated)\n if (pastedText.includes(',') || pastedText.includes('\\n')) {\n e.preventDefault();\n const values = pastedText\n .split(/[,\\n]/)\n .map((v) => v.trim())\n .filter(Boolean);\n\n values.forEach((value) => {\n addRecipient(value);\n });\n }\n };\n\n return (\n <div className=\"space-y-2\">\n {/* Input container */}\n <div\n className={`\n relative flex flex-wrap items-center gap-2 p-2 min-h-[42px]\n bg-surface border rounded-lg transition-colors\n ${isFocused ? 'border-primary-500 ring-1 ring-primary-500' : 'border-border'}\n ${disabled ? 'opacity-50 cursor-not-allowed bg-muted' : ''}\n ${error || inputError ? 'border-error-500' : ''}\n `}\n onClick={() => inputRef.current?.focus()}\n >\n {/* Selected recipients */}\n {recipients.map((recipient) => (\n <div\n key={recipient.id}\n className=\"flex items-center gap-1.5 px-2 py-1 bg-surface-elevated border border-border rounded-full text-sm\"\n >\n {getRecipientIcon(recipient.type)}\n <span className=\"text-foreground max-w-[200px] truncate\">{recipient.displayName}</span>\n {!disabled && (\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n removeRecipient(recipient.id);\n }}\n className=\"p-0.5 hover:bg-surface-hover rounded-full transition-colors\"\n aria-label={tr('notifCommon.removeRecipient', 'Remove {{name}}').replace(\n '{{name}}',\n recipient.displayName\n )}\n >\n <X size={12} className=\"text-muted-foreground\" />\n </button>\n )}\n </div>\n ))}\n\n {/* Input */}\n {!disabled && recipients.length < maxRecipients && (\n <input\n ref={inputRef}\n type={inputType}\n value={inputValue}\n onChange={(e) => setInputValue(e.target.value)}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n onFocus={() => setIsFocused(true)}\n onBlur={() => {\n setIsFocused(false);\n if (inputValue.trim()) {\n addRecipient(inputValue);\n }\n }}\n placeholder={\n recipients.length === 0 ? inputPlaceholder : tr('notifCommon.addMore', 'Add more...')\n }\n className=\"flex-1 min-w-[150px] bg-transparent border-none outline-none text-sm text-foreground placeholder:text-muted-foreground\"\n disabled={disabled}\n />\n )}\n\n {/* Add button for clarity */}\n {!disabled && inputValue.trim() && (\n <button\n type=\"button\"\n onClick={() => addRecipient(inputValue)}\n className=\"p-1 text-primary-500 hover:bg-primary-100 rounded transition-colors\"\n aria-label={tr('notifCommon.addRecipient', 'Add recipient')}\n >\n <Plus size={16} />\n </button>\n )}\n </div>\n\n {/* Error message */}\n {(error || inputError) && (\n <div className=\"flex items-center gap-1.5 text-error-500 text-sm\">\n <AlertCircle size={14} />\n <span>{error || inputError}</span>\n </div>\n )}\n\n {/* Helper text */}\n <div className=\"flex items-center justify-between text-xs text-muted-foreground\">\n <span>\n {channel === 'EMAIL' &&\n tr(\n 'notifCommon.emailHelperText',\n 'Enter email addresses. Press Enter or comma to add multiple.'\n )}\n {(channel === 'SMS' || channel === 'WHATSAPP') &&\n tr(\n 'notifCommon.phoneHelperText',\n 'Enter phone numbers with country code (e.g., +1234567890).'\n )}\n\n {channel === 'PUSH' &&\n tr('notifCommon.pushHelperText', 'Enter device tokens for push notifications.')}\n {channel === 'SLACK' && tr('notifCommon.slackHelperText', 'Enter Slack user IDs.')}\n {channel === 'TEAMS' &&\n tr('notifCommon.teamsHelperText', 'Enter Microsoft Teams user IDs.')}\n {channel === 'WEBHOOK' && tr('notifCommon.webhookHelperText', 'Enter webhook URLs.')}\n </span>\n <span>\n {recipients.length} / {maxRecipients}\n </span>\n </div>\n </div>\n );\n}\n\n/**\n * Compact recipient display for read-only views\n */\nexport function RecipientList({ recipients }: { recipients: Recipient[] }) {\n const tr = useTr();\n\n if (recipients.length === 0) {\n return (\n <span className=\"text-muted-foreground text-sm\">\n {tr('notifCommon.noRecipients', 'No recipients')}\n </span>\n );\n }\n\n return (\n <div className=\"flex flex-wrap items-center gap-1.5\">\n {recipients.slice(0, 5).map((recipient) => (\n <div\n key={recipient.id}\n className=\"flex items-center gap-1 px-2 py-0.5 bg-surface-elevated border border-border rounded-full text-xs\"\n >\n {getRecipientIcon(recipient.type)}\n <span className=\"text-foreground max-w-[150px] truncate\">{recipient.displayName}</span>\n </div>\n ))}\n {recipients.length > 5 && (\n <span className=\"flex items-center gap-1 px-2 py-0.5 bg-muted text-muted-foreground rounded-full text-xs\">\n <Users size={12} />+{recipients.length - 5} {tr('notifCommon.more', 'more')}\n </span>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;AA2BA,SAAS,EAAiB,GAAyB;AACjD,SAAQ,GAAR;EACE,KAAK,QACH,QAAO,kBAAC,GAAD;GAAM,MAAM;GAAI,WAAU;GAA0B,CAAA;EAC7D,KAAK,QACH,QAAO,kBAAC,GAAD;GAAO,MAAM;GAAI,WAAU;GAA6B,CAAA;EACjE,KAAK,OACH,QAAO,kBAAC,GAAD;GAAM,MAAM;GAAI,WAAU;GAAuB,CAAA;EAC1D,QACE,QAAO,kBAAC,GAAD;GAAM,MAAM;GAAI,WAAU;GAA0B,CAAA;;;AAOj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,EACf,EAAW,MAAM,IACnB,EAAa,EAAW;;MAG5B,aACE,EAAW,WAAW,IAAI,IAAmB,EAAG,uBAAuB,cAAc;MAEvF,WAAU;MACA;MACV,CAAA;KAIH,CAAC,KAAY,EAAW,MAAM,IAC7B,kBAAC,UAAD;MACE,MAAK;MACL,eAAe,EAAa,EAAW;MACvC,WAAU;MACV,cAAY,EAAG,4BAA4B,gBAAgB;gBAE3D,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA;MACX,CAAA;KAEP;;IAGJ,KAAS,MACT,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD,EAAa,MAAM,IAAM,CAAA,EACzB,kBAAC,QAAD,EAAA,UAAO,KAAS,GAAkB,CAAA,CAC9B;;GAIR,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD,EAAA,UAAA;KACG,MAAY,WACX,EACE,+BACA,+DACD;MACD,MAAY,SAAS,MAAY,eACjC,EACE,+BACA,6DACD;KAEF,MAAY,UACX,EAAG,8BAA8B,8CAA8C;KAChF,MAAY,WAAW,EAAG,+BAA+B,wBAAwB;KACjF,MAAY,WACX,EAAG,+BAA+B,kCAAkC;KACrE,MAAY,aAAa,EAAG,iCAAiC,sBAAsB;KAC/E,EAAA,CAAA,EACP,kBAAC,QAAD,EAAA,UAAA;KACG,EAAW;KAAO;KAAI;KAClB,EAAA,CAAA,CACH;;GACF"}
@@ -0,0 +1,22 @@
1
+ export type PreviewChannel = 'email' | 'sms' | 'push' | 'in_app';
2
+ export interface TemplatePreviewProps {
3
+ channel: PreviewChannel;
4
+ subject: string;
5
+ body: string;
6
+ html: string;
7
+ appName: string;
8
+ onChannelChange: (channel: PreviewChannel) => void;
9
+ }
10
+ /**
11
+ * Template Preview Component
12
+ *
13
+ * Shows how a notification template will look across different channels.
14
+ * Templates are channel-agnostic — this component lets you preview
15
+ * the same content as it would render on Email, SMS, Push, or In-App.
16
+ *
17
+ * Uses semantic theme tokens (text-primary, bg-surface, etc.) for theme
18
+ * compatibility, with hardcoded colors only inside device mockups where
19
+ * the real device UI is always dark (iPhone SMS, Push lock screen).
20
+ */
21
+ export declare function TemplatePreview({ channel, subject, body, html, appName, onChannelChange, }: TemplatePreviewProps): import("react/jsx-runtime").JSX.Element;
22
+ //# sourceMappingURL=TemplatePreview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplatePreview.d.ts","sourceRoot":"","sources":["../../src/components/TemplatePreview.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CACpD;AAkED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,eAAe,GAChB,EAAE,oBAAoB,2CAkVtB"}