@burdenoff/microfe-channel 2026.510.112

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 (156) hide show
  1. package/README.md +147 -0
  2. package/dist/channel/ChannelRoot.d.ts +32 -0
  3. package/dist/channel/ChannelRoot.d.ts.map +1 -0
  4. package/dist/channel/ChannelRoot.js +81 -0
  5. package/dist/channel/ChannelRoot.js.map +1 -0
  6. package/dist/channel/ChannelRoutes.d.ts +10 -0
  7. package/dist/channel/ChannelRoutes.d.ts.map +1 -0
  8. package/dist/channel/ChannelRoutes.js +104 -0
  9. package/dist/channel/ChannelRoutes.js.map +1 -0
  10. package/dist/channel/components/AdapterCredentialsForm.d.ts +20 -0
  11. package/dist/channel/components/AdapterCredentialsForm.d.ts.map +1 -0
  12. package/dist/channel/components/AdapterCredentialsForm.js +230 -0
  13. package/dist/channel/components/AdapterCredentialsForm.js.map +1 -0
  14. package/dist/channel/components/FeatureNotEnabled.d.ts +10 -0
  15. package/dist/channel/components/FeatureNotEnabled.d.ts.map +1 -0
  16. package/dist/channel/components/FeatureNotEnabled.js +32 -0
  17. package/dist/channel/components/FeatureNotEnabled.js.map +1 -0
  18. package/dist/channel/components/PermissionGuard.d.ts +15 -0
  19. package/dist/channel/components/PermissionGuard.d.ts.map +1 -0
  20. package/dist/channel/components/PermissionGuard.js +23 -0
  21. package/dist/channel/components/PermissionGuard.js.map +1 -0
  22. package/dist/channel/config/adapterCredentials.d.ts +44 -0
  23. package/dist/channel/config/adapterCredentials.d.ts.map +1 -0
  24. package/dist/channel/config/adapterCredentials.js +946 -0
  25. package/dist/channel/config/adapterCredentials.js.map +1 -0
  26. package/dist/channel/constants/permissions.d.ts +32 -0
  27. package/dist/channel/constants/permissions.d.ts.map +1 -0
  28. package/dist/channel/constants/permissions.js +30 -0
  29. package/dist/channel/constants/permissions.js.map +1 -0
  30. package/dist/channel/graphql/global-client.d.ts +11 -0
  31. package/dist/channel/graphql/global-client.d.ts.map +1 -0
  32. package/dist/channel/graphql/global-client.js +56 -0
  33. package/dist/channel/graphql/global-client.js.map +1 -0
  34. package/dist/channel/hooks/useChannelOrgSettings.d.ts +22 -0
  35. package/dist/channel/hooks/useChannelOrgSettings.d.ts.map +1 -0
  36. package/dist/channel/hooks/useChannelOrgSettings.js +61 -0
  37. package/dist/channel/hooks/useChannelOrgSettings.js.map +1 -0
  38. package/dist/channel/hooks/useChannelSubscription.d.ts +36 -0
  39. package/dist/channel/hooks/useChannelSubscription.d.ts.map +1 -0
  40. package/dist/channel/hooks/useChannelSubscription.js +111 -0
  41. package/dist/channel/hooks/useChannelSubscription.js.map +1 -0
  42. package/dist/channel/hooks/useChannels.d.ts +214 -0
  43. package/dist/channel/hooks/useChannels.d.ts.map +1 -0
  44. package/dist/channel/hooks/useChannels.js +416 -0
  45. package/dist/channel/hooks/useChannels.js.map +1 -0
  46. package/dist/channel/index.d.ts +12 -0
  47. package/dist/channel/index.d.ts.map +1 -0
  48. package/dist/channel/index.js +2 -0
  49. package/dist/channel/modules/channels/hooks/useExport.d.ts +45 -0
  50. package/dist/channel/modules/channels/hooks/useExport.d.ts.map +1 -0
  51. package/dist/channel/modules/channels/hooks/useExport.js +195 -0
  52. package/dist/channel/modules/channels/hooks/useExport.js.map +1 -0
  53. package/dist/channel/modules/channels/i18n.d.ts +14 -0
  54. package/dist/channel/modules/channels/i18n.d.ts.map +1 -0
  55. package/dist/channel/modules/channels/i18n.js +110 -0
  56. package/dist/channel/modules/channels/i18n.js.map +1 -0
  57. package/dist/channel/modules/channels/pages/ChannelDashboardPage.d.ts +14 -0
  58. package/dist/channel/modules/channels/pages/ChannelDashboardPage.d.ts.map +1 -0
  59. package/dist/channel/modules/channels/pages/ChannelDashboardPage.js +680 -0
  60. package/dist/channel/modules/channels/pages/ChannelDashboardPage.js.map +1 -0
  61. package/dist/channel/modules/channels/pages/ChannelDetailsPage.d.ts +7 -0
  62. package/dist/channel/modules/channels/pages/ChannelDetailsPage.d.ts.map +1 -0
  63. package/dist/channel/modules/channels/pages/ChannelDetailsPage.js +949 -0
  64. package/dist/channel/modules/channels/pages/ChannelDetailsPage.js.map +1 -0
  65. package/dist/channel/modules/channels/pages/ChannelSettingsPage.d.ts +7 -0
  66. package/dist/channel/modules/channels/pages/ChannelSettingsPage.d.ts.map +1 -0
  67. package/dist/channel/modules/channels/pages/ChannelSettingsPage.js +404 -0
  68. package/dist/channel/modules/channels/pages/ChannelSettingsPage.js.map +1 -0
  69. package/dist/channel/modules/channels/pages/ChannelUsersPage.d.ts +7 -0
  70. package/dist/channel/modules/channels/pages/ChannelUsersPage.d.ts.map +1 -0
  71. package/dist/channel/modules/channels/pages/ChannelUsersPage.js +315 -0
  72. package/dist/channel/modules/channels/pages/ChannelUsersPage.js.map +1 -0
  73. package/dist/channel/modules/channels/pages/ChannelsListPage.d.ts +7 -0
  74. package/dist/channel/modules/channels/pages/ChannelsListPage.d.ts.map +1 -0
  75. package/dist/channel/modules/channels/pages/ChannelsListPage.js +604 -0
  76. package/dist/channel/modules/channels/pages/ChannelsListPage.js.map +1 -0
  77. package/dist/channel/modules/channels/pages/ConnectionDetailsPage.d.ts +7 -0
  78. package/dist/channel/modules/channels/pages/ConnectionDetailsPage.d.ts.map +1 -0
  79. package/dist/channel/modules/channels/pages/ConnectionDetailsPage.js +323 -0
  80. package/dist/channel/modules/channels/pages/ConnectionDetailsPage.js.map +1 -0
  81. package/dist/channel/modules/channels/pages/ConnectionsListPage.d.ts +7 -0
  82. package/dist/channel/modules/channels/pages/ConnectionsListPage.d.ts.map +1 -0
  83. package/dist/channel/modules/channels/pages/ConnectionsListPage.js +276 -0
  84. package/dist/channel/modules/channels/pages/ConnectionsListPage.js.map +1 -0
  85. package/dist/channel/modules/channels/pages/CreateChannelPage.d.ts +12 -0
  86. package/dist/channel/modules/channels/pages/CreateChannelPage.d.ts.map +1 -0
  87. package/dist/channel/modules/channels/pages/CreateChannelPage.js +456 -0
  88. package/dist/channel/modules/channels/pages/CreateChannelPage.js.map +1 -0
  89. package/dist/channel/modules/channels/pages/CreateConnectionPage.d.ts +11 -0
  90. package/dist/channel/modules/channels/pages/CreateConnectionPage.d.ts.map +1 -0
  91. package/dist/channel/modules/channels/pages/CreateConnectionPage.js +219 -0
  92. package/dist/channel/modules/channels/pages/CreateConnectionPage.js.map +1 -0
  93. package/dist/channel/modules/channels/pages/DeliveryHistoryPage.d.ts +7 -0
  94. package/dist/channel/modules/channels/pages/DeliveryHistoryPage.d.ts.map +1 -0
  95. package/dist/channel/modules/channels/pages/DeliveryHistoryPage.js +375 -0
  96. package/dist/channel/modules/channels/pages/DeliveryHistoryPage.js.map +1 -0
  97. package/dist/channel/modules/channels/pages/EditChannelPage.d.ts +8 -0
  98. package/dist/channel/modules/channels/pages/EditChannelPage.d.ts.map +1 -0
  99. package/dist/channel/modules/channels/pages/EditChannelPage.js +459 -0
  100. package/dist/channel/modules/channels/pages/EditChannelPage.js.map +1 -0
  101. package/dist/channel/modules/channels/pages/EditConnectionPage.d.ts +10 -0
  102. package/dist/channel/modules/channels/pages/EditConnectionPage.d.ts.map +1 -0
  103. package/dist/channel/modules/channels/pages/EditConnectionPage.js +199 -0
  104. package/dist/channel/modules/channels/pages/EditConnectionPage.js.map +1 -0
  105. package/dist/channel/modules/channels/pages/SendMessagePage.d.ts +8 -0
  106. package/dist/channel/modules/channels/pages/SendMessagePage.d.ts.map +1 -0
  107. package/dist/channel/modules/channels/pages/SendMessagePage.js +403 -0
  108. package/dist/channel/modules/channels/pages/SendMessagePage.js.map +1 -0
  109. package/dist/channel/modules/channels/pages/WebhookEventsPage.d.ts +7 -0
  110. package/dist/channel/modules/channels/pages/WebhookEventsPage.d.ts.map +1 -0
  111. package/dist/channel/modules/channels/pages/WebhookEventsPage.js +303 -0
  112. package/dist/channel/modules/channels/pages/WebhookEventsPage.js.map +1 -0
  113. package/dist/channel/modules/channels/pages/index.d.ts +18 -0
  114. package/dist/channel/modules/channels/pages/index.d.ts.map +1 -0
  115. package/dist/channel/modules/channels/pages/index.js +14 -0
  116. package/dist/channel/pages/ChannelLandingPage.d.ts +9 -0
  117. package/dist/channel/pages/ChannelLandingPage.d.ts.map +1 -0
  118. package/dist/channel/pages/ChannelLandingPage.js +72 -0
  119. package/dist/channel/pages/ChannelLandingPage.js.map +1 -0
  120. package/dist/channel/providers/ChannelProvider.d.ts +16 -0
  121. package/dist/channel/providers/ChannelProvider.d.ts.map +1 -0
  122. package/dist/channel/providers/ChannelProvider.js +35 -0
  123. package/dist/channel/providers/ChannelProvider.js.map +1 -0
  124. package/dist/channel/types/index.d.ts +89 -0
  125. package/dist/channel/types/index.d.ts.map +1 -0
  126. package/dist/channel/utils/shellBridge.d.ts +59 -0
  127. package/dist/channel/utils/shellBridge.d.ts.map +1 -0
  128. package/dist/channel/utils/shellBridge.js +36 -0
  129. package/dist/channel/utils/shellBridge.js.map +1 -0
  130. package/dist/dev/App.d.ts +6 -0
  131. package/dist/dev/App.d.ts.map +1 -0
  132. package/dist/dev/main.d.ts +2 -0
  133. package/dist/dev/main.d.ts.map +1 -0
  134. package/dist/generated/global-operations.d.ts +1547 -0
  135. package/dist/generated/global-operations.d.ts.map +1 -0
  136. package/dist/generated/global-operations.js +466 -0
  137. package/dist/generated/global-operations.js.map +1 -0
  138. package/dist/generated/global-types.d.ts +21289 -0
  139. package/dist/generated/global-types.d.ts.map +1 -0
  140. package/dist/generated/global-types.js +14 -0
  141. package/dist/generated/global-types.js.map +1 -0
  142. package/dist/generated/wspace-operations.d.ts +2 -0
  143. package/dist/generated/wspace-operations.d.ts.map +1 -0
  144. package/dist/generated/wspace-types.d.ts +55214 -0
  145. package/dist/generated/wspace-types.d.ts.map +1 -0
  146. package/dist/index.d.ts +5 -0
  147. package/dist/index.d.ts.map +1 -0
  148. package/dist/index.js +4 -0
  149. package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +24 -0
  150. package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -0
  151. package/dist/node_modules/@apollo/client/errors/utils.js +16 -0
  152. package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -0
  153. package/dist/utils/nativeBridge.d.ts +3 -0
  154. package/dist/utils/nativeBridge.d.ts.map +1 -0
  155. package/dist/utils/nativeBridge.js +2 -0
  156. package/package.json +116 -0
@@ -0,0 +1,949 @@
1
+ import { nativeImpact as e, nativeNotify as t } from "../../../../utils/nativeBridge.js";
2
+ import { useChannel as n } from "../../../hooks/useChannels.js";
3
+ import { PermissionGuard as r } from "../../../components/PermissionGuard.js";
4
+ import { CHANNEL_PERMISSIONS as i } from "../../../constants/permissions.js";
5
+ import { AUTH_TYPE_I18N as a, HEALTH_I18N as ee, PLATFORM_I18N as te, STATUS_I18N as o, translateLabel as s } from "../i18n.js";
6
+ import { AdapterCredentialsForm as ne, CredentialValidationStatus as re } from "../../../components/AdapterCredentialsForm.js";
7
+ import { useEffect as ie, useState as c } from "react";
8
+ import { useI18n as ae } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
+ import { AlertCircle as l, AlertTriangle as u, ArrowLeft as oe, ArrowRight as d, Cable as f, CheckCircle2 as p, Clock as se, HelpCircle as m, Key as ce, Loader2 as h, Mail as le, MessageSquare as ue, Pencil as g, Phone as de, Play as fe, Plus as pe, Power as me, PowerOff as _, Radio as he, RefreshCw as ge, Save as v, Send as y, Trash2 as _e, Truck as ve, Users as ye, X as b, XCircle as x } from "lucide-react";
10
+ import { useLocation as be, useNavigate as xe, useParams as S } from "react-router-dom";
11
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
12
+ import { TagBadge as Se } from "@burdenoff/fe-libs/tag";
13
+ //#region src/channel/modules/channels/pages/ChannelDetailsPage.tsx
14
+ var T = {
15
+ EMAIL: {
16
+ label: "Email",
17
+ color: "bg-accent-blue-subtle text-accent-blue"
18
+ },
19
+ SMS: {
20
+ label: "SMS",
21
+ color: "bg-status-success-bg-subtle text-status-success-text"
22
+ },
23
+ PUSH: {
24
+ label: "Push",
25
+ color: "bg-accent-purple-subtle text-accent-purple"
26
+ },
27
+ INAPP: {
28
+ label: "In-App",
29
+ color: "bg-accent-indigo-subtle text-accent-indigo"
30
+ },
31
+ WEBHOOK: {
32
+ label: "Webhook",
33
+ color: "bg-accent-orange-subtle text-accent-orange"
34
+ },
35
+ SLACK: {
36
+ label: "Slack",
37
+ color: "bg-accent-pink-subtle text-accent-pink"
38
+ },
39
+ TEAMS: {
40
+ label: "Teams",
41
+ color: "bg-accent-cyan-subtle text-accent-cyan"
42
+ },
43
+ DISCORD: {
44
+ label: "Discord",
45
+ color: "bg-accent-violet-subtle text-accent-violet"
46
+ },
47
+ WHATSAPP: {
48
+ label: "WhatsApp",
49
+ color: "bg-accent-emerald-subtle text-accent-emerald"
50
+ },
51
+ WEBCHAT: {
52
+ label: "Webchat",
53
+ color: "bg-accent-teal-subtle text-accent-teal"
54
+ }
55
+ }, E = {
56
+ ACTIVE: {
57
+ label: "Active",
58
+ color: "text-success-500 bg-success-100",
59
+ icon: p
60
+ },
61
+ INACTIVE: {
62
+ label: "Inactive",
63
+ color: "text-muted-foreground bg-muted",
64
+ icon: _
65
+ },
66
+ ERROR: {
67
+ label: "Error",
68
+ color: "text-error-500 bg-error-100",
69
+ icon: x
70
+ },
71
+ SUSPENDED: {
72
+ label: "Suspended",
73
+ color: "text-warning-500 bg-warning-100",
74
+ icon: u
75
+ },
76
+ ARCHIVED: {
77
+ label: "Archived",
78
+ color: "text-muted-foreground bg-muted",
79
+ icon: _
80
+ }
81
+ }, D = {
82
+ HEALTHY: {
83
+ label: "Healthy",
84
+ color: "text-success-500",
85
+ icon: p
86
+ },
87
+ DEGRADED: {
88
+ label: "Degraded",
89
+ color: "text-warning-500",
90
+ icon: u
91
+ },
92
+ UNHEALTHY: {
93
+ label: "Unhealthy",
94
+ color: "text-error-500",
95
+ icon: x
96
+ },
97
+ UNKNOWN: {
98
+ label: "Unknown",
99
+ color: "text-muted-foreground",
100
+ icon: m
101
+ }
102
+ };
103
+ function O() {
104
+ let { channelId: u } = S(), m = xe(), O = be(), { t: k } = ae(), A = (e, t) => {
105
+ let n = k(e);
106
+ return n === e ? t : n;
107
+ }, j = O.state, [M, N] = c(null), [P, F] = c(j?.showCredentialsForm || !1), [I, L] = c(j?.pendingCredentials || {}), [Ce, R] = c(!1), [z, B] = c(null), [we, V] = c(!1), [H, U] = c(""), [W, Te] = c(() => A("channel.testNotificationSubject", "Test Notification")), [G, Ee] = c(() => A("channel.testNotificationBody", "This is a test notification from Burdenoff Channel Service.")), [K, q] = c(null);
108
+ ie(() => {
109
+ (j?.pendingCredentials || j?.showCredentialsForm) && m(O.pathname, {
110
+ replace: !0,
111
+ state: null
112
+ });
113
+ }, []);
114
+ let { channel: J, isLoading: De, error: Y, updateChannel: Oe, runHealthCheck: ke, createConnection: Ae, updateConnection: je, deleteConnection: Me, testConnection: Ne, sendTestNotification: Pe } = n(u), Fe = async () => {
115
+ N("health");
116
+ try {
117
+ await ke();
118
+ } catch (e) {
119
+ console.error("[channel] Failed to run health check", e);
120
+ } finally {
121
+ N(null);
122
+ }
123
+ }, Ie = async () => {
124
+ if (J) {
125
+ N("status");
126
+ try {
127
+ await Oe({ status: J.status === "ACTIVE" ? "INACTIVE" : "ACTIVE" });
128
+ } catch (e) {
129
+ console.error("[channel] Failed to toggle channel status", e);
130
+ } finally {
131
+ N(null);
132
+ }
133
+ }
134
+ }, Le = async () => {
135
+ if (J) {
136
+ N("connection");
137
+ try {
138
+ let e = "API_KEY", t = J.adapterType;
139
+ t?.includes("BOT") ? e = "BOT_TOKEN" : t?.includes("WEBHOOK") ? e = "WEBHOOK" : t === "SMTP" && (e = "SMTP_IMAP"), await Ae({
140
+ authType: e,
141
+ credentials: I
142
+ }), F(!1), L({}), R(!1);
143
+ } catch (e) {
144
+ console.error("[channel] Failed to create connection", e);
145
+ } finally {
146
+ N(null);
147
+ }
148
+ }
149
+ }, Re = async (e) => {
150
+ N("connection");
151
+ try {
152
+ await je(e, { credentials: I }), F(!1), L({}), R(!1);
153
+ } catch (e) {
154
+ console.error("[channel] Failed to update connection", e);
155
+ } finally {
156
+ N(null);
157
+ }
158
+ }, ze = async (n) => {
159
+ e("medium"), N("delete-connection");
160
+ try {
161
+ await Me(n), t("success");
162
+ } catch (e) {
163
+ t("error"), console.error("[channel] Failed to delete connection", e);
164
+ } finally {
165
+ N(null);
166
+ }
167
+ }, Be = async (e) => {
168
+ N("test"), B(null);
169
+ try {
170
+ let t = await Ne(e);
171
+ t && B({
172
+ success: t.success,
173
+ message: t.message || (t.success ? A("channel.connectionTestSuccess", "Connection successful!") : A("channel.connectionTestFailed", "Connection failed"))
174
+ });
175
+ } catch (e) {
176
+ console.error("[channel] Failed to test connection", e), B({
177
+ success: !1,
178
+ message: A("channel.connectionTestRequestFailed", "Failed to test connection")
179
+ });
180
+ } finally {
181
+ N(null);
182
+ }
183
+ }, Ve = async () => {
184
+ if (H.trim()) {
185
+ N("send-test"), q(null);
186
+ try {
187
+ let e = J?.platform === "EMAIL" ? {
188
+ subject: W,
189
+ html: `<p>${G}</p>`
190
+ } : void 0, t = await Pe(H.trim(), G, e);
191
+ t && q({
192
+ success: t.success,
193
+ messageId: t.messageId,
194
+ externalId: t.externalId,
195
+ status: t.status,
196
+ sentAt: t.sentAt,
197
+ error: t.error ? {
198
+ code: t.error.code,
199
+ message: t.error.message,
200
+ retryable: t.error.retryable
201
+ } : null
202
+ });
203
+ } catch (e) {
204
+ let t = e instanceof Error ? e.message : A("channel.sendTestNotificationFailed", "Failed to send test notification");
205
+ console.error("[channel] Failed to send test notification", e), q({
206
+ success: !1,
207
+ error: {
208
+ code: "SEND_FAILED",
209
+ message: t,
210
+ retryable: !1
211
+ }
212
+ });
213
+ } finally {
214
+ N(null);
215
+ }
216
+ }
217
+ }, He = (e) => {
218
+ switch (e) {
219
+ case "EMAIL": return A("channel.recipientPlaceholder.email", "email@example.com");
220
+ case "SMS": return A("channel.recipientPlaceholder.phone", "+1234567890");
221
+ case "PUSH": return A("channel.recipientPlaceholder.deviceToken", "Device token");
222
+ case "SLACK": return A("channel.recipientPlaceholder.slack", "Channel ID or User ID");
223
+ case "TEAMS": return A("channel.recipientPlaceholder.channelId", "Channel ID");
224
+ case "DISCORD": return A("channel.recipientPlaceholder.channelId", "Channel ID");
225
+ case "WHATSAPP": return A("channel.recipientPlaceholder.phone", "+1234567890");
226
+ default: return A("channel.recipientPlaceholder.default", "Recipient");
227
+ }
228
+ }, Ue = (e) => {
229
+ switch (e) {
230
+ case "EMAIL": return A("channel.recipientLabel.email", "Email Address");
231
+ case "SMS":
232
+ case "WHATSAPP": return A("channel.recipientLabel.phone", "Phone Number");
233
+ case "PUSH": return A("channel.recipientLabel.deviceToken", "Device Token");
234
+ case "SLACK":
235
+ case "TEAMS":
236
+ case "DISCORD": return A("channel.recipientLabel.channelOrUserId", "Channel/User ID");
237
+ default: return A("channel.recipientLabel.default", "Recipient");
238
+ }
239
+ }, We = (e) => ({
240
+ ...T[e] || {
241
+ label: e,
242
+ color: "bg-bg-sunken text-text-secondary"
243
+ },
244
+ label: s(e, te, A)
245
+ }), Ge = (e) => ({
246
+ ...E[e] || E.INACTIVE,
247
+ label: s(e, o, A)
248
+ }), Ke = (e) => ({
249
+ ...D[e] || D.UNKNOWN,
250
+ label: s(e, ee, A)
251
+ });
252
+ if (De) return /* @__PURE__ */ C("div", {
253
+ className: "flex items-center justify-center min-h-screen",
254
+ children: /* @__PURE__ */ C(h, {
255
+ size: 32,
256
+ className: "animate-spin text-accent-primary"
257
+ })
258
+ });
259
+ if (Y || !J) return /* @__PURE__ */ C("div", {
260
+ className: "p-6",
261
+ children: /* @__PURE__ */ w("div", {
262
+ className: "flex items-center gap-3 p-4 bg-error-100 border border-error-500 rounded-lg",
263
+ children: [
264
+ /* @__PURE__ */ C(l, {
265
+ size: 20,
266
+ className: "text-error-500"
267
+ }),
268
+ /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C("p", {
269
+ className: "text-sm font-medium text-error-700",
270
+ children: Y || A("channel.channelNotFound", "Channel not found")
271
+ }) }),
272
+ /* @__PURE__ */ C("button", {
273
+ onClick: () => m(-1),
274
+ className: "ml-auto px-3 py-1 text-sm text-error-700 hover:bg-error-200 rounded transition-colors",
275
+ children: A("channel.goBack", "Go Back")
276
+ })
277
+ ]
278
+ })
279
+ });
280
+ let X = We(J.platform), Z = Ge(J.status), Q = Ke(J.connectionHealth), qe = Z.icon, Je = Q.icon, $ = J.connection;
281
+ return /* @__PURE__ */ C(r, {
282
+ permission: i.CHANNEL_READ,
283
+ children: /* @__PURE__ */ w("div", {
284
+ className: "space-y-6 p-3 sm:p-6",
285
+ children: [
286
+ /* @__PURE__ */ w("div", {
287
+ className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
288
+ children: [/* @__PURE__ */ w("div", {
289
+ className: "flex items-center gap-3",
290
+ children: [/* @__PURE__ */ C("button", {
291
+ onClick: () => m(-1),
292
+ className: "p-2 text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors",
293
+ children: /* @__PURE__ */ C(oe, { size: 20 })
294
+ }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ w("div", {
295
+ className: "flex items-center gap-2",
296
+ children: [/* @__PURE__ */ C(he, {
297
+ size: 24,
298
+ className: "text-accent-primary"
299
+ }), /* @__PURE__ */ C("h1", {
300
+ className: "text-xl sm:text-2xl font-bold text-foreground",
301
+ children: J.name
302
+ })]
303
+ }), J.description && /* @__PURE__ */ C("p", {
304
+ className: "text-sm text-muted-foreground mt-1",
305
+ children: J.description
306
+ })] })]
307
+ }), /* @__PURE__ */ w("div", {
308
+ className: "flex items-center gap-2",
309
+ children: [
310
+ /* @__PURE__ */ C(r, {
311
+ permission: i.CHANNEL_EXECUTE,
312
+ children: /* @__PURE__ */ w("button", {
313
+ onClick: Fe,
314
+ disabled: M === "health",
315
+ className: "flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground hover:text-info-500 hover:bg-info-100 rounded-lg transition-colors disabled:opacity-50",
316
+ children: [M === "health" ? /* @__PURE__ */ C(h, {
317
+ size: 16,
318
+ className: "animate-spin"
319
+ }) : /* @__PURE__ */ C(ge, { size: 16 }), A("channel.healthCheck", "Health Check")]
320
+ })
321
+ }),
322
+ /* @__PURE__ */ C(r, {
323
+ permission: i.CHANNEL_UPDATE,
324
+ children: /* @__PURE__ */ w("button", {
325
+ onClick: Ie,
326
+ disabled: M === "status",
327
+ className: `flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors disabled:opacity-50 ${J.status === "ACTIVE" ? "text-warning-500 hover:bg-warning-100" : "text-success-500 hover:bg-success-100"}`,
328
+ children: [M === "status" ? /* @__PURE__ */ C(h, {
329
+ size: 16,
330
+ className: "animate-spin"
331
+ }) : J.status === "ACTIVE" ? /* @__PURE__ */ C(_, { size: 16 }) : /* @__PURE__ */ C(me, { size: 16 }), J.status === "ACTIVE" ? A("channel.deactivate", "Deactivate") : A("channel.activate", "Activate")]
332
+ })
333
+ }),
334
+ /* @__PURE__ */ w("button", {
335
+ onClick: () => {
336
+ V(!0), q(null), U("");
337
+ },
338
+ disabled: !J.connection,
339
+ className: "flex items-center gap-2 px-3 py-2 text-sm text-accent-primary hover:bg-accent-primary/10 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
340
+ title: J.connection ? A("channel.sendTestNotification", "Send test notification") : A("channel.configureCredentialsFirst", "Configure credentials first"),
341
+ children: [/* @__PURE__ */ C(y, { size: 16 }), A("channel.testChannel", "Test Channel")]
342
+ }),
343
+ /* @__PURE__ */ w("button", {
344
+ onClick: () => m("./edit"),
345
+ className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg hover:bg-action-primary-bg-hover rounded-lg transition-colors shadow-sm",
346
+ children: [/* @__PURE__ */ C(g, { size: 16 }), A("channel.edit", "Edit")]
347
+ })
348
+ ]
349
+ })]
350
+ }),
351
+ /* @__PURE__ */ w("div", {
352
+ className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-4",
353
+ children: [
354
+ /* @__PURE__ */ w("div", {
355
+ className: "p-4 bg-surface border border-border rounded-lg",
356
+ children: [/* @__PURE__ */ C("p", {
357
+ className: "text-xs text-muted-foreground mb-1",
358
+ children: A("channel.platform", "Platform")
359
+ }), /* @__PURE__ */ C("span", {
360
+ className: `inline-flex px-2 py-1 text-sm font-semibold rounded-full ${X.color}`,
361
+ children: X.label
362
+ })]
363
+ }),
364
+ /* @__PURE__ */ w("div", {
365
+ className: "p-4 bg-surface border border-border rounded-lg",
366
+ children: [/* @__PURE__ */ C("p", {
367
+ className: "text-xs text-muted-foreground mb-1",
368
+ children: A("channel.status", "Status")
369
+ }), /* @__PURE__ */ w("div", {
370
+ className: "flex items-center gap-2",
371
+ children: [/* @__PURE__ */ C(qe, {
372
+ size: 16,
373
+ className: Z.color.split(" ")[0]
374
+ }), /* @__PURE__ */ C("span", {
375
+ className: `px-2 py-1 text-sm font-medium rounded-full ${Z.color}`,
376
+ children: Z.label
377
+ })]
378
+ })]
379
+ }),
380
+ /* @__PURE__ */ w("div", {
381
+ className: "p-4 bg-surface border border-border rounded-lg",
382
+ children: [
383
+ /* @__PURE__ */ C("p", {
384
+ className: "text-xs text-muted-foreground mb-1",
385
+ children: A("channel.connectionHealth", "Connection Health")
386
+ }),
387
+ /* @__PURE__ */ w("div", {
388
+ className: "flex items-center gap-2",
389
+ children: [/* @__PURE__ */ C(Je, {
390
+ size: 16,
391
+ className: Q.color
392
+ }), /* @__PURE__ */ C("span", {
393
+ className: `text-sm font-medium ${Q.color}`,
394
+ children: Q.label
395
+ })]
396
+ }),
397
+ J.lastHealthCheckAt && /* @__PURE__ */ w("p", {
398
+ className: "text-xs text-muted-foreground mt-1",
399
+ children: [
400
+ A("channel.lastCheck", "Last check"),
401
+ ":",
402
+ " ",
403
+ new Date(J.lastHealthCheckAt).toLocaleString()
404
+ ]
405
+ })
406
+ ]
407
+ }),
408
+ /* @__PURE__ */ w("div", {
409
+ className: "p-4 bg-surface border border-border rounded-lg",
410
+ children: [/* @__PURE__ */ C("p", {
411
+ className: "text-xs text-muted-foreground mb-1",
412
+ children: A("channel.connection", "Connection")
413
+ }), /* @__PURE__ */ w("div", {
414
+ className: "flex items-center gap-2",
415
+ children: [/* @__PURE__ */ C(f, {
416
+ size: 16,
417
+ className: J.isConnected ? "text-success-500" : "text-muted-foreground"
418
+ }), /* @__PURE__ */ C("span", {
419
+ className: `text-sm font-medium ${J.isConnected ? "text-success-500" : "text-muted-foreground"}`,
420
+ children: J.isConnected ? A("channel.connected", "Connected") : A("channel.notConnected", "Not Connected")
421
+ })]
422
+ })]
423
+ })
424
+ ]
425
+ }),
426
+ /* @__PURE__ */ w("div", {
427
+ className: "p-4 bg-surface border border-border rounded-lg",
428
+ children: [
429
+ /* @__PURE__ */ C("h2", {
430
+ className: "text-lg font-semibold text-foreground mb-4",
431
+ children: A("channel.channelDetails", "Channel Details")
432
+ }),
433
+ /* @__PURE__ */ w("div", {
434
+ className: "grid gap-4 sm:grid-cols-2",
435
+ children: [
436
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
437
+ className: "text-xs text-muted-foreground",
438
+ children: A("channel.adapterType", "Adapter Type")
439
+ }), /* @__PURE__ */ C("p", {
440
+ className: "text-sm font-medium text-foreground",
441
+ children: J.adapterType?.replace(/_/g, " ") || A("channel.notConfigured", "Not configured")
442
+ })] }),
443
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
444
+ className: "text-xs text-muted-foreground",
445
+ children: A("channel.priority", "Priority")
446
+ }), /* @__PURE__ */ C("p", {
447
+ className: "text-sm font-medium text-foreground",
448
+ children: J.priority
449
+ })] }),
450
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
451
+ className: "text-xs text-muted-foreground",
452
+ children: A("channel.consecutiveFailures", "Consecutive Failures")
453
+ }), /* @__PURE__ */ C("p", {
454
+ className: "text-sm font-medium text-foreground",
455
+ children: J.consecutiveFailures
456
+ })] }),
457
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
458
+ className: "text-xs text-muted-foreground",
459
+ children: A("channel.messages24h", "Messages (24h)")
460
+ }), /* @__PURE__ */ C("p", {
461
+ className: "text-sm font-medium text-foreground",
462
+ children: J.messageCount24h
463
+ })] }),
464
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
465
+ className: "text-xs text-muted-foreground",
466
+ children: A("channel.createdAt", "Created At")
467
+ }), /* @__PURE__ */ C("p", {
468
+ className: "text-sm font-medium text-foreground",
469
+ children: new Date(J.createdAt).toLocaleString()
470
+ })] }),
471
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
472
+ className: "text-xs text-muted-foreground",
473
+ children: A("channel.updatedAt", "Updated At")
474
+ }), /* @__PURE__ */ C("p", {
475
+ className: "text-sm font-medium text-foreground",
476
+ children: new Date(J.updatedAt).toLocaleString()
477
+ })] })
478
+ ]
479
+ }),
480
+ J.tagAssignments && J.tagAssignments.length > 0 && /* @__PURE__ */ w("div", {
481
+ className: "mt-4",
482
+ children: [/* @__PURE__ */ C("p", {
483
+ className: "text-xs text-muted-foreground mb-1.5",
484
+ children: A("channel.tags", "Tags")
485
+ }), /* @__PURE__ */ C("div", {
486
+ className: "flex flex-wrap gap-1.5",
487
+ "aria-label": "Channel tags",
488
+ children: J.tagAssignments.map((e) => /* @__PURE__ */ C(Se, {
489
+ id: e.tagId,
490
+ label: e.tagId,
491
+ size: "md"
492
+ }, e.id))
493
+ })]
494
+ }),
495
+ J.healthCheckError && /* @__PURE__ */ w("div", {
496
+ className: "mt-4 p-3 bg-error-100 border border-error-300 rounded-lg",
497
+ children: [/* @__PURE__ */ C("p", {
498
+ className: "text-xs text-error-700 font-medium",
499
+ children: A("channel.lastHealthCheckError", "Last Health Check Error")
500
+ }), /* @__PURE__ */ C("p", {
501
+ className: "text-sm text-error-600",
502
+ children: J.healthCheckError
503
+ })]
504
+ })
505
+ ]
506
+ }),
507
+ /* @__PURE__ */ w("div", {
508
+ className: "grid gap-3 sm:grid-cols-3",
509
+ children: [
510
+ /* @__PURE__ */ w("button", {
511
+ onClick: () => m("./deliveries"),
512
+ className: "flex items-center gap-3 p-3 bg-surface border border-border rounded-lg hover:bg-action-primary-bg/10 transition-colors text-left",
513
+ children: [
514
+ /* @__PURE__ */ C("div", {
515
+ className: "p-2 bg-accent-orange/10 rounded-lg",
516
+ children: /* @__PURE__ */ C(ve, {
517
+ size: 18,
518
+ className: "text-accent-orange"
519
+ })
520
+ }),
521
+ /* @__PURE__ */ w("div", {
522
+ className: "flex-1 min-w-0",
523
+ children: [/* @__PURE__ */ C("p", {
524
+ className: "text-sm font-medium text-foreground",
525
+ children: A("channel.deliveryHistory", "Delivery History")
526
+ }), /* @__PURE__ */ C("p", {
527
+ className: "text-xs text-muted-foreground truncate",
528
+ children: A("channel.viewMessageDeliveries", "View message deliveries")
529
+ })]
530
+ }),
531
+ /* @__PURE__ */ C(d, {
532
+ size: 16,
533
+ className: "text-muted-foreground shrink-0"
534
+ })
535
+ ]
536
+ }),
537
+ /* @__PURE__ */ w("button", {
538
+ onClick: () => m("./webhooks"),
539
+ className: "flex items-center gap-3 p-3 bg-surface border border-border rounded-lg hover:bg-action-primary-bg/10 transition-colors text-left",
540
+ children: [
541
+ /* @__PURE__ */ C("div", {
542
+ className: "p-2 bg-accent-purple/10 rounded-lg",
543
+ children: /* @__PURE__ */ C(se, {
544
+ size: 18,
545
+ className: "text-accent-purple"
546
+ })
547
+ }),
548
+ /* @__PURE__ */ w("div", {
549
+ className: "flex-1 min-w-0",
550
+ children: [/* @__PURE__ */ C("p", {
551
+ className: "text-sm font-medium text-foreground",
552
+ children: A("channel.webhookEvents", "Webhook Events")
553
+ }), /* @__PURE__ */ C("p", {
554
+ className: "text-xs text-muted-foreground truncate",
555
+ children: A("channel.viewIncomingWebhooks", "View incoming webhooks")
556
+ })]
557
+ }),
558
+ /* @__PURE__ */ C(d, {
559
+ size: 16,
560
+ className: "text-muted-foreground shrink-0"
561
+ })
562
+ ]
563
+ }),
564
+ /* @__PURE__ */ w("button", {
565
+ onClick: () => m("./users"),
566
+ className: "flex items-center gap-3 p-3 bg-surface border border-border rounded-lg hover:bg-action-primary-bg/10 transition-colors text-left",
567
+ children: [
568
+ /* @__PURE__ */ C("div", {
569
+ className: "p-2 bg-accent-blue/10 rounded-lg",
570
+ children: /* @__PURE__ */ C(ye, {
571
+ size: 18,
572
+ className: "text-accent-blue"
573
+ })
574
+ }),
575
+ /* @__PURE__ */ w("div", {
576
+ className: "flex-1 min-w-0",
577
+ children: [/* @__PURE__ */ C("p", {
578
+ className: "text-sm font-medium text-foreground",
579
+ children: A("channel.channelUsers", "Channel Users")
580
+ }), /* @__PURE__ */ C("p", {
581
+ className: "text-xs text-muted-foreground truncate",
582
+ children: A("channel.viewConnectedUsers", "View connected users")
583
+ })]
584
+ }),
585
+ /* @__PURE__ */ C(d, {
586
+ size: 16,
587
+ className: "text-muted-foreground shrink-0"
588
+ })
589
+ ]
590
+ })
591
+ ]
592
+ }),
593
+ /* @__PURE__ */ w("div", {
594
+ className: "p-4 bg-surface border border-border rounded-lg",
595
+ children: [
596
+ /* @__PURE__ */ w("div", {
597
+ className: "flex items-center justify-between mb-4",
598
+ children: [/* @__PURE__ */ w("div", {
599
+ className: "flex items-center gap-2",
600
+ children: [/* @__PURE__ */ C(ce, {
601
+ size: 20,
602
+ className: "text-accent-primary"
603
+ }), /* @__PURE__ */ C("h2", {
604
+ className: "text-lg font-semibold text-foreground",
605
+ children: A("channel.connectionAndCredentials", "Connection & Credentials")
606
+ })]
607
+ }), !$ && !P && /* @__PURE__ */ w("button", {
608
+ onClick: () => F(!0),
609
+ className: "flex items-center gap-2 px-3 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg hover:bg-action-primary-bg-hover rounded-lg transition-colors",
610
+ children: [/* @__PURE__ */ C(pe, { size: 16 }), A("channel.addCredentials", "Add Credentials")]
611
+ })]
612
+ }),
613
+ $ && !P && /* @__PURE__ */ w("div", {
614
+ className: "space-y-4",
615
+ children: [
616
+ /* @__PURE__ */ w("div", {
617
+ className: "grid gap-4 sm:grid-cols-2",
618
+ children: [
619
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
620
+ className: "text-xs text-muted-foreground",
621
+ children: A("channel.authType", "Auth Type")
622
+ }), /* @__PURE__ */ C("p", {
623
+ className: "text-sm font-medium text-foreground",
624
+ children: s($.authType, a, A)
625
+ })] }),
626
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
627
+ className: "text-xs text-muted-foreground",
628
+ children: A("channel.status", "Status")
629
+ }), /* @__PURE__ */ w("div", {
630
+ className: "flex items-center gap-2",
631
+ children: [$.isHealthy ? /* @__PURE__ */ C(p, {
632
+ size: 14,
633
+ className: "text-success-500"
634
+ }) : /* @__PURE__ */ C(x, {
635
+ size: 14,
636
+ className: "text-error-500"
637
+ }), /* @__PURE__ */ C("span", {
638
+ className: `text-sm font-medium ${$.isHealthy ? "text-success-500" : "text-error-500"}`,
639
+ children: $.isHealthy ? A("channel.healthy", "Healthy") : A("channel.unhealthy", "Unhealthy")
640
+ })]
641
+ })] }),
642
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
643
+ className: "text-xs text-muted-foreground",
644
+ children: A("channel.lastTested", "Last Tested")
645
+ }), /* @__PURE__ */ C("p", {
646
+ className: "text-sm font-medium text-foreground",
647
+ children: $.lastTestedAt ? new Date($.lastTestedAt).toLocaleString() : A("channel.never", "Never")
648
+ })] }),
649
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
650
+ className: "text-xs text-muted-foreground",
651
+ children: A("channel.testStatus", "Test Status")
652
+ }), /* @__PURE__ */ C("p", {
653
+ className: "text-sm font-medium text-foreground",
654
+ children: $.testStatus || A("channel.notTested", "Not tested")
655
+ })] }),
656
+ $.tokenExpiresAt && /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
657
+ className: "text-xs text-muted-foreground",
658
+ children: A("channel.tokenExpires", "Token Expires")
659
+ }), /* @__PURE__ */ w("p", {
660
+ className: `text-sm font-medium ${$.needsTokenRefresh ? "text-warning-500" : "text-foreground"}`,
661
+ children: [new Date($.tokenExpiresAt).toLocaleString(), $.daysUntilExpiry !== void 0 && /* @__PURE__ */ w("span", {
662
+ className: "text-xs text-muted-foreground ml-1",
663
+ children: [
664
+ "(",
665
+ $.daysUntilExpiry,
666
+ " ",
667
+ A("channel.days", "days"),
668
+ ")"
669
+ ]
670
+ })]
671
+ })] })
672
+ ]
673
+ }),
674
+ z && /* @__PURE__ */ C("div", {
675
+ className: `p-3 rounded-lg ${z.success ? "bg-success-100 border border-success-300" : "bg-error-100 border border-error-300"}`,
676
+ children: /* @__PURE__ */ w("div", {
677
+ className: "flex items-center gap-2",
678
+ children: [z.success ? /* @__PURE__ */ C(p, {
679
+ size: 16,
680
+ className: "text-success-500"
681
+ }) : /* @__PURE__ */ C(x, {
682
+ size: 16,
683
+ className: "text-error-500"
684
+ }), /* @__PURE__ */ C("p", {
685
+ className: `text-sm font-medium ${z.success ? "text-success-700" : "text-error-700"}`,
686
+ children: z.message
687
+ })]
688
+ })
689
+ }),
690
+ /* @__PURE__ */ w("div", {
691
+ className: "flex items-center gap-2 pt-2",
692
+ children: [
693
+ /* @__PURE__ */ C(r, {
694
+ permission: i.CHANNEL_CONNECTION_UPDATE,
695
+ children: /* @__PURE__ */ w("button", {
696
+ onClick: () => Be($.id),
697
+ disabled: M === "test",
698
+ className: "flex items-center gap-2 px-3 py-2 text-sm text-info-500 hover:bg-info-100 rounded-lg transition-colors disabled:opacity-50",
699
+ children: [M === "test" ? /* @__PURE__ */ C(h, {
700
+ size: 16,
701
+ className: "animate-spin"
702
+ }) : /* @__PURE__ */ C(fe, { size: 16 }), A("channel.testConnection", "Test Connection")]
703
+ })
704
+ }),
705
+ /* @__PURE__ */ w("button", {
706
+ onClick: () => {
707
+ F(!0), L($?.platformMetadata ?? {});
708
+ },
709
+ className: "flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground hover:text-accent-primary hover:bg-accent-primary/10 rounded-lg transition-colors",
710
+ children: [/* @__PURE__ */ C(g, { size: 16 }), A("channel.updateCredentials", "Update Credentials")]
711
+ }),
712
+ /* @__PURE__ */ C(r, {
713
+ permission: i.CHANNEL_CONNECTION_DELETE,
714
+ children: /* @__PURE__ */ w("button", {
715
+ onClick: () => ze($.id),
716
+ disabled: M === "delete-connection",
717
+ className: "flex items-center gap-2 px-3 py-2 text-sm text-error-500 hover:bg-error-100 rounded-lg transition-colors disabled:opacity-50",
718
+ children: [M === "delete-connection" ? /* @__PURE__ */ C(h, {
719
+ size: 16,
720
+ className: "animate-spin"
721
+ }) : /* @__PURE__ */ C(_e, { size: 16 }), A("channel.remove", "Remove")]
722
+ })
723
+ })
724
+ ]
725
+ })
726
+ ]
727
+ }),
728
+ !$ && !P && /* @__PURE__ */ w("div", {
729
+ className: "text-center py-8",
730
+ children: [
731
+ /* @__PURE__ */ C(f, {
732
+ size: 32,
733
+ className: "mx-auto text-muted-foreground mb-3"
734
+ }),
735
+ /* @__PURE__ */ C("p", {
736
+ className: "text-sm text-muted-foreground mb-2",
737
+ children: A("channel.noCredentialsConfigured", "No credentials configured for this channel")
738
+ }),
739
+ /* @__PURE__ */ C("p", {
740
+ className: "text-xs text-muted-foreground",
741
+ children: A("channel.addCredentialsHint", "Add credentials to enable message delivery through this channel")
742
+ })
743
+ ]
744
+ }),
745
+ P && /* @__PURE__ */ w("div", {
746
+ className: "space-y-4",
747
+ children: [
748
+ !J.adapterType && /* @__PURE__ */ C("div", {
749
+ className: "p-3 bg-accent-orange/10 border border-accent-orange/30 rounded-lg",
750
+ children: /* @__PURE__ */ w("div", {
751
+ className: "flex items-start gap-2",
752
+ children: [/* @__PURE__ */ C(l, {
753
+ size: 16,
754
+ className: "text-accent-orange mt-0.5"
755
+ }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
756
+ className: "text-sm font-medium text-accent-orange",
757
+ children: A("channel.noAdapterTypeConfigured", "No adapter type configured")
758
+ }), /* @__PURE__ */ C("p", {
759
+ className: "text-xs text-muted-foreground mt-1",
760
+ children: A("channel.noAdapterTypeConfiguredHint", "You can still add credentials below. The system will attempt to validate them when the channel is configured with an adapter type.")
761
+ })] })]
762
+ })
763
+ }),
764
+ /* @__PURE__ */ C(ne, {
765
+ adapterType: J.adapterType ?? void 0,
766
+ credentials: I,
767
+ onChange: L,
768
+ onValidationChange: (e) => R(e),
769
+ disabled: M === "connection"
770
+ }),
771
+ J.adapterType && /* @__PURE__ */ C("div", {
772
+ className: "pt-2",
773
+ children: /* @__PURE__ */ C(re, {
774
+ adapterType: J.adapterType,
775
+ credentials: I
776
+ })
777
+ }),
778
+ /* @__PURE__ */ w("div", {
779
+ className: "flex items-center gap-2 pt-2 border-t border-border",
780
+ children: [/* @__PURE__ */ C(r, {
781
+ permission: i.CHANNEL_CONNECTION_UPDATE,
782
+ children: /* @__PURE__ */ w("button", {
783
+ onClick: () => {
784
+ $ ? Re($.id) : Le();
785
+ },
786
+ disabled: M === "connection" || !Ce && !!J.adapterType,
787
+ className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg hover:bg-action-primary-bg-hover rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
788
+ children: [M === "connection" ? /* @__PURE__ */ C(h, {
789
+ size: 16,
790
+ className: "animate-spin"
791
+ }) : /* @__PURE__ */ C(v, { size: 16 }), $ ? A("channel.updateCredentials", "Update Credentials") : A("channel.saveCredentials", "Save Credentials")]
792
+ })
793
+ }), /* @__PURE__ */ w("button", {
794
+ onClick: () => {
795
+ F(!1), L({}), R(!1);
796
+ },
797
+ className: "flex items-center gap-2 px-4 py-2 text-sm text-muted-foreground hover:bg-muted rounded-lg transition-colors",
798
+ children: [/* @__PURE__ */ C(b, { size: 16 }), A("channel.cancel", "Cancel")]
799
+ })]
800
+ })
801
+ ]
802
+ })
803
+ ]
804
+ }),
805
+ we && /* @__PURE__ */ C("div", {
806
+ className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50",
807
+ children: /* @__PURE__ */ w("div", {
808
+ className: "w-full max-w-md mx-4 p-6 bg-surface border border-border rounded-lg shadow-xl",
809
+ children: [/* @__PURE__ */ w("div", {
810
+ className: "flex items-center justify-between mb-4",
811
+ children: [/* @__PURE__ */ w("div", {
812
+ className: "flex items-center gap-2",
813
+ children: [/* @__PURE__ */ C(y, {
814
+ size: 20,
815
+ className: "text-accent-primary"
816
+ }), /* @__PURE__ */ w("h3", {
817
+ className: "text-lg font-semibold text-foreground",
818
+ children: [
819
+ "Test ",
820
+ T[J.platform]?.label || J.platform,
821
+ " Channel"
822
+ ]
823
+ })]
824
+ }), /* @__PURE__ */ C("button", {
825
+ onClick: () => V(!1),
826
+ className: "p-1 text-muted-foreground hover:text-foreground rounded",
827
+ children: /* @__PURE__ */ C(b, { size: 20 })
828
+ })]
829
+ }), /* @__PURE__ */ w("div", {
830
+ className: "space-y-4",
831
+ children: [
832
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ w("label", {
833
+ className: "block text-sm font-medium text-foreground mb-1.5",
834
+ children: [
835
+ Ue(J.platform),
836
+ " ",
837
+ /* @__PURE__ */ C("span", {
838
+ className: "text-error-500",
839
+ children: "*"
840
+ })
841
+ ]
842
+ }), /* @__PURE__ */ w("div", {
843
+ className: "relative",
844
+ children: [/* @__PURE__ */ C("input", {
845
+ type: "text",
846
+ value: H,
847
+ onChange: (e) => U(e.target.value),
848
+ placeholder: He(J.platform),
849
+ className: "w-full pl-9 pr-3 py-2 text-sm bg-surface border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-action-primary-bg"
850
+ }), /* @__PURE__ */ C("div", {
851
+ className: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",
852
+ children: J.platform === "EMAIL" ? /* @__PURE__ */ C(le, { size: 16 }) : J.platform === "SMS" || J.platform === "WHATSAPP" ? /* @__PURE__ */ C(de, { size: 16 }) : /* @__PURE__ */ C(ue, { size: 16 })
853
+ })]
854
+ })] }),
855
+ J.platform === "EMAIL" && /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("label", {
856
+ className: "block text-sm font-medium text-foreground mb-1.5",
857
+ children: "Subject"
858
+ }), /* @__PURE__ */ C("input", {
859
+ type: "text",
860
+ value: W,
861
+ onChange: (e) => Te(e.target.value),
862
+ placeholder: "Email subject",
863
+ className: "w-full px-3 py-2 text-sm bg-surface border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-action-primary-bg"
864
+ })] }),
865
+ /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("label", {
866
+ className: "block text-sm font-medium text-foreground mb-1.5",
867
+ children: "Message"
868
+ }), /* @__PURE__ */ C("textarea", {
869
+ value: G,
870
+ onChange: (e) => Ee(e.target.value),
871
+ placeholder: "Test message content",
872
+ rows: 3,
873
+ className: "w-full px-3 py-2 text-sm bg-surface border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-action-primary-bg resize-none"
874
+ })] }),
875
+ K && /* @__PURE__ */ C("div", {
876
+ className: `p-3 rounded-lg ${K.success ? "bg-success-100 border border-success-300" : "bg-error-100 border border-error-300"}`,
877
+ children: /* @__PURE__ */ w("div", {
878
+ className: "flex items-start gap-2",
879
+ children: [K.success ? /* @__PURE__ */ C(p, {
880
+ size: 16,
881
+ className: "text-success-500 mt-0.5"
882
+ }) : /* @__PURE__ */ C(x, {
883
+ size: 16,
884
+ className: "text-error-500 mt-0.5"
885
+ }), /* @__PURE__ */ w("div", {
886
+ className: "flex-1",
887
+ children: [
888
+ /* @__PURE__ */ C("p", {
889
+ className: `text-sm font-medium ${K.success ? "text-success-700" : "text-error-700"}`,
890
+ children: K.success ? A("channel.messageSentSuccess", "Message sent successfully!") : A("channel.messageSendFailed", "Failed to send message")
891
+ }),
892
+ K.messageId && /* @__PURE__ */ w("p", {
893
+ className: "text-xs text-success-600 mt-1",
894
+ children: ["Message ID: ", K.messageId]
895
+ }),
896
+ K.externalId && /* @__PURE__ */ w("p", {
897
+ className: "text-xs text-muted-foreground mt-1",
898
+ children: ["External ID: ", K.externalId]
899
+ }),
900
+ K.status && /* @__PURE__ */ w("p", {
901
+ className: "text-xs text-muted-foreground mt-1",
902
+ children: ["Status: ", K.status]
903
+ }),
904
+ K.error && /* @__PURE__ */ w("p", {
905
+ className: "text-xs text-error-600 mt-1",
906
+ children: [K.error.message, K.error.retryable && /* @__PURE__ */ C("span", {
907
+ className: "text-warning-600 ml-1",
908
+ children: "(will retry)"
909
+ })]
910
+ }),
911
+ K.sentAt && /* @__PURE__ */ w("p", {
912
+ className: "text-xs text-muted-foreground mt-1",
913
+ children: ["Sent at: ", new Date(K.sentAt).toLocaleString()]
914
+ })
915
+ ]
916
+ })]
917
+ })
918
+ }),
919
+ /* @__PURE__ */ w("div", {
920
+ className: "flex items-center gap-2 pt-2",
921
+ children: [/* @__PURE__ */ C(r, {
922
+ permission: i.CHANNEL_DELIVERY_SEND,
923
+ children: /* @__PURE__ */ w("button", {
924
+ onClick: Ve,
925
+ disabled: M === "send-test" || !H.trim(),
926
+ className: "flex-1 flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg hover:bg-action-primary-bg-hover rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
927
+ children: [M === "send-test" ? /* @__PURE__ */ C(h, {
928
+ size: 16,
929
+ className: "animate-spin"
930
+ }) : /* @__PURE__ */ C(y, { size: 16 }), A("channel.sendTest", "Send Test")]
931
+ })
932
+ }), /* @__PURE__ */ C("button", {
933
+ onClick: () => V(!1),
934
+ className: "px-4 py-2 text-sm text-muted-foreground hover:bg-muted rounded-lg transition-colors",
935
+ children: A("channel.close", "Close")
936
+ })]
937
+ })
938
+ ]
939
+ })]
940
+ })
941
+ })
942
+ ]
943
+ })
944
+ });
945
+ }
946
+ //#endregion
947
+ export { O as ChannelDetailsPage };
948
+
949
+ //# sourceMappingURL=ChannelDetailsPage.js.map