@krak-stack/notifications-admin 0.2.0 → 0.2.1
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.
- package/CHANGELOG.md +19 -0
- package/README.md +183 -3
- package/dist/atoms.d.ts +1 -0
- package/dist/atoms.js +33 -14
- package/dist/chunk-4r5x0qzz.js +522 -0
- package/dist/{chunk-wkxc1y7w.js → chunk-d32m2dmf.js} +160 -136
- package/dist/chunk-ghs5tkqn.js +37 -0
- package/dist/client-options.d.ts +9 -0
- package/dist/deliveries.d.ts +69 -1
- package/dist/deliveries.js +10 -2
- package/dist/delivery.atom.d.ts +95 -9
- package/dist/hooks.d.ts +21 -0
- package/dist/hooks.js +6 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +21 -3
- package/dist/operations.atom.d.ts +6 -4
- package/dist/operations.d.ts +39 -1
- package/dist/operations.js +8 -2
- package/dist/presentation.d.ts +13 -3
- package/package.json +7 -3
- package/dist/chunk-28xppc9m.js +0 -404
package/dist/chunk-28xppc9m.js
DELETED
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn,
|
|
3
|
-
Button,
|
|
4
|
-
Dialog,
|
|
5
|
-
DialogContent,
|
|
6
|
-
DialogHeader,
|
|
7
|
-
DialogTitle
|
|
8
|
-
} from "./chunk-tck9drx2.js";
|
|
9
|
-
import {
|
|
10
|
-
NotificationTable2,
|
|
11
|
-
NotificationReference2
|
|
12
|
-
} from "./chunk-aqmv7g24.js";
|
|
13
|
-
|
|
14
|
-
// ../../src/components/ui/tabs.tsx
|
|
15
|
-
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
16
|
-
import { cva } from "class-variance-authority";
|
|
17
|
-
import { jsx } from "react/jsx-runtime";
|
|
18
|
-
function Tabs({
|
|
19
|
-
className,
|
|
20
|
-
orientation = "horizontal",
|
|
21
|
-
...props
|
|
22
|
-
}) {
|
|
23
|
-
return /* @__PURE__ */ jsx(TabsPrimitive.Root, {
|
|
24
|
-
"data-slot": "tabs",
|
|
25
|
-
"data-orientation": orientation,
|
|
26
|
-
className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
|
|
27
|
-
...props
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
var tabsListVariants = cva("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-9 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none", {
|
|
31
|
-
variants: {
|
|
32
|
-
variant: {
|
|
33
|
-
default: "bg-muted",
|
|
34
|
-
line: "gap-1 bg-transparent"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
defaultVariants: {
|
|
38
|
-
variant: "default"
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
function TabsList({
|
|
42
|
-
className,
|
|
43
|
-
variant = "default",
|
|
44
|
-
...props
|
|
45
|
-
}) {
|
|
46
|
-
return /* @__PURE__ */ jsx(TabsPrimitive.List, {
|
|
47
|
-
"data-slot": "tabs-list",
|
|
48
|
-
"data-variant": variant,
|
|
49
|
-
className: cn(tabsListVariants({ variant }), className),
|
|
50
|
-
...props
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function TabsTrigger({ className, ...props }) {
|
|
54
|
-
return /* @__PURE__ */ jsx(TabsPrimitive.Tab, {
|
|
55
|
-
"data-slot": "tabs-trigger",
|
|
56
|
-
className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className),
|
|
57
|
-
...props
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// src/deliveries.tsx
|
|
62
|
-
import { jsx as jsx2, jsxs, Fragment } from "react/jsx-runtime";
|
|
63
|
-
var metricKeys = [
|
|
64
|
-
"total",
|
|
65
|
-
"queued",
|
|
66
|
-
"processing",
|
|
67
|
-
"retrying",
|
|
68
|
-
"accepted",
|
|
69
|
-
"failed",
|
|
70
|
-
"suppressed",
|
|
71
|
-
"cancelled",
|
|
72
|
-
"feedbackCovered",
|
|
73
|
-
"feedbackUnavailable",
|
|
74
|
-
"confirmed",
|
|
75
|
-
"hardBounced",
|
|
76
|
-
"softBounced",
|
|
77
|
-
"complained"
|
|
78
|
-
];
|
|
79
|
-
var NotificationDeliveries2 = (p) => {
|
|
80
|
-
const m = p.messages;
|
|
81
|
-
const c = m.common;
|
|
82
|
-
const columns = [
|
|
83
|
-
{ field: "recipientAddress", headerName: c.email },
|
|
84
|
-
{
|
|
85
|
-
field: "source",
|
|
86
|
-
headerName: m.source,
|
|
87
|
-
filterOptions: ["contacts", "engine"].map((value) => ({
|
|
88
|
-
value,
|
|
89
|
-
label: value === "contacts" ? m.sources.contacts : m.sources.engine
|
|
90
|
-
})),
|
|
91
|
-
cellRenderer: ({ data }) => m.sources[data.source]
|
|
92
|
-
},
|
|
93
|
-
{ field: "recipientUserId", headerName: m.recipientUserId },
|
|
94
|
-
{ field: "organizationId", headerName: m.organizationId },
|
|
95
|
-
{ field: "workspaceId", headerName: m.workspaceId },
|
|
96
|
-
{ field: "eventKey", headerName: m.eventKey },
|
|
97
|
-
{ field: "template", headerName: m.template },
|
|
98
|
-
{
|
|
99
|
-
field: "purpose",
|
|
100
|
-
headerName: c.purpose,
|
|
101
|
-
filterOptions: Object.entries(m.purposes).map(([value, label]) => ({
|
|
102
|
-
value,
|
|
103
|
-
label
|
|
104
|
-
})),
|
|
105
|
-
cellRenderer: ({ data }) => m.purposes[data.purpose]
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
field: "status",
|
|
109
|
-
headerName: c.status,
|
|
110
|
-
filterOptions: Object.entries(c.statuses).map(([value, label]) => ({
|
|
111
|
-
value,
|
|
112
|
-
label
|
|
113
|
-
})),
|
|
114
|
-
cellRenderer: ({ data }) => c.statuses[data.status]
|
|
115
|
-
},
|
|
116
|
-
{ field: "attempts", headerName: c.attempts, type: "number" },
|
|
117
|
-
{ field: "provider", headerName: c.provider },
|
|
118
|
-
{ field: "createdAt", headerName: c.created, type: "date" },
|
|
119
|
-
{ field: "sentAt", headerName: c.accepted, type: "date" },
|
|
120
|
-
{
|
|
121
|
-
colId: "inspect",
|
|
122
|
-
headerName: c.inspect,
|
|
123
|
-
sortable: false,
|
|
124
|
-
searchable: false,
|
|
125
|
-
filterable: false,
|
|
126
|
-
hideable: false,
|
|
127
|
-
cellRenderer: ({ data }) => /* @__PURE__ */ jsx2(Button, {
|
|
128
|
-
variant: "outline",
|
|
129
|
-
onClick: () => p.onInspect(data.id),
|
|
130
|
-
children: c.inspect
|
|
131
|
-
})
|
|
132
|
-
}
|
|
133
|
-
];
|
|
134
|
-
const delivery = p.inspection?.delivery;
|
|
135
|
-
const metrics = {
|
|
136
|
-
...c.metrics,
|
|
137
|
-
feedbackCovered: m.feedbackCovered,
|
|
138
|
-
feedbackUnavailable: m.feedbackUnavailable
|
|
139
|
-
};
|
|
140
|
-
return /* @__PURE__ */ jsxs("section", {
|
|
141
|
-
className: "space-y-4",
|
|
142
|
-
"aria-busy": p.pending,
|
|
143
|
-
children: [
|
|
144
|
-
/* @__PURE__ */ jsxs("header", {
|
|
145
|
-
className: "flex justify-between gap-4",
|
|
146
|
-
children: [
|
|
147
|
-
/* @__PURE__ */ jsxs("div", {
|
|
148
|
-
children: [
|
|
149
|
-
/* @__PURE__ */ jsx2("h1", {
|
|
150
|
-
className: "text-2xl font-semibold",
|
|
151
|
-
children: m.title
|
|
152
|
-
}),
|
|
153
|
-
/* @__PURE__ */ jsx2("p", {
|
|
154
|
-
children: m.description
|
|
155
|
-
})
|
|
156
|
-
]
|
|
157
|
-
}),
|
|
158
|
-
/* @__PURE__ */ jsx2(Button, {
|
|
159
|
-
variant: "outline",
|
|
160
|
-
onClick: p.onRefresh,
|
|
161
|
-
children: c.refresh
|
|
162
|
-
})
|
|
163
|
-
]
|
|
164
|
-
}),
|
|
165
|
-
/* @__PURE__ */ jsx2(Tabs, {
|
|
166
|
-
value: p.source,
|
|
167
|
-
onValueChange: (value) => {
|
|
168
|
-
if (value === "all" || value === "contacts" || value === "engine")
|
|
169
|
-
p.onSource(value);
|
|
170
|
-
},
|
|
171
|
-
children: /* @__PURE__ */ jsx2(TabsList, {
|
|
172
|
-
"aria-label": m.source,
|
|
173
|
-
children: ["all", "contacts", "engine"].map((source) => /* @__PURE__ */ jsx2(TabsTrigger, {
|
|
174
|
-
value: source,
|
|
175
|
-
children: m.sources[source]
|
|
176
|
-
}, source))
|
|
177
|
-
})
|
|
178
|
-
}),
|
|
179
|
-
/* @__PURE__ */ jsx2(Tabs, {
|
|
180
|
-
value: p.view,
|
|
181
|
-
onValueChange: (value) => {
|
|
182
|
-
if (value === "overview" || value === "activity")
|
|
183
|
-
p.onView(value);
|
|
184
|
-
},
|
|
185
|
-
children: /* @__PURE__ */ jsx2(TabsList, {
|
|
186
|
-
"aria-label": m.title,
|
|
187
|
-
children: ["overview", "activity"].map((view) => /* @__PURE__ */ jsx2(TabsTrigger, {
|
|
188
|
-
value: view,
|
|
189
|
-
children: c.views[view]
|
|
190
|
-
}, view))
|
|
191
|
-
})
|
|
192
|
-
}),
|
|
193
|
-
p.error && /* @__PURE__ */ jsx2("p", {
|
|
194
|
-
role: "alert",
|
|
195
|
-
children: p.error
|
|
196
|
-
}),
|
|
197
|
-
/* @__PURE__ */ jsx2("p", {
|
|
198
|
-
children: m.feedbackNotice
|
|
199
|
-
}),
|
|
200
|
-
p.view === "overview" && p.overview && /* @__PURE__ */ jsx2("dl", {
|
|
201
|
-
className: "grid gap-3 sm:grid-cols-3",
|
|
202
|
-
children: metricKeys.map((key) => /* @__PURE__ */ jsxs("div", {
|
|
203
|
-
role: "group",
|
|
204
|
-
"aria-label": metrics[key],
|
|
205
|
-
className: "rounded border p-3",
|
|
206
|
-
children: [
|
|
207
|
-
/* @__PURE__ */ jsx2("dt", {
|
|
208
|
-
children: metrics[key]
|
|
209
|
-
}),
|
|
210
|
-
/* @__PURE__ */ jsx2("dd", {
|
|
211
|
-
className: "text-2xl font-semibold",
|
|
212
|
-
children: p.overview?.[key]
|
|
213
|
-
})
|
|
214
|
-
]
|
|
215
|
-
}, key))
|
|
216
|
-
}),
|
|
217
|
-
p.view === "activity" && /* @__PURE__ */ jsx2(NotificationTable2, {
|
|
218
|
-
rowData: p.activity?.items ?? [],
|
|
219
|
-
columnDefs: columns,
|
|
220
|
-
getRowId: (row) => row.id,
|
|
221
|
-
state: p.table,
|
|
222
|
-
onStateChange: p.onTable,
|
|
223
|
-
status: { loading: p.pending, error: p.error },
|
|
224
|
-
features: {
|
|
225
|
-
pagination: { mode: "server", rowCount: p.total },
|
|
226
|
-
refresh: p.onRefresh
|
|
227
|
-
},
|
|
228
|
-
messages: {
|
|
229
|
-
en: { empty: c.empty, loading: c.loading },
|
|
230
|
-
fr: { empty: c.empty, loading: c.loading }
|
|
231
|
-
}
|
|
232
|
-
}),
|
|
233
|
-
/* @__PURE__ */ jsx2(Dialog, {
|
|
234
|
-
open: p.inspecting,
|
|
235
|
-
onOpenChange: (open) => {
|
|
236
|
-
if (!open)
|
|
237
|
-
p.onInspect(undefined);
|
|
238
|
-
},
|
|
239
|
-
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
240
|
-
className: "max-h-[90vh] overflow-auto sm:max-w-4xl",
|
|
241
|
-
children: [
|
|
242
|
-
/* @__PURE__ */ jsx2(DialogHeader, {
|
|
243
|
-
children: /* @__PURE__ */ jsx2(DialogTitle, {
|
|
244
|
-
children: c.inspect
|
|
245
|
-
})
|
|
246
|
-
}),
|
|
247
|
-
p.inspectionError && /* @__PURE__ */ jsx2("p", {
|
|
248
|
-
role: "alert",
|
|
249
|
-
children: p.inspectionError
|
|
250
|
-
}),
|
|
251
|
-
!delivery && !p.inspectionError && /* @__PURE__ */ jsx2("p", {
|
|
252
|
-
role: "status",
|
|
253
|
-
children: c.loading
|
|
254
|
-
}),
|
|
255
|
-
delivery && /* @__PURE__ */ jsxs(Fragment, {
|
|
256
|
-
children: [
|
|
257
|
-
/* @__PURE__ */ jsx2("dl", {
|
|
258
|
-
className: "grid gap-2 break-all sm:grid-cols-2",
|
|
259
|
-
children: [
|
|
260
|
-
[
|
|
261
|
-
c.id,
|
|
262
|
-
/* @__PURE__ */ jsx2(NotificationReference2, {
|
|
263
|
-
kind: "delivery",
|
|
264
|
-
id: delivery.id
|
|
265
|
-
}, "delivery")
|
|
266
|
-
],
|
|
267
|
-
[m.source, m.sources[delivery.source]],
|
|
268
|
-
[c.email, delivery.recipientAddress],
|
|
269
|
-
[
|
|
270
|
-
m.recipientUserId,
|
|
271
|
-
/* @__PURE__ */ jsx2(NotificationReference2, {
|
|
272
|
-
kind: "account",
|
|
273
|
-
id: delivery.recipientUserId
|
|
274
|
-
}, "account")
|
|
275
|
-
],
|
|
276
|
-
[
|
|
277
|
-
m.organizationId,
|
|
278
|
-
/* @__PURE__ */ jsx2(NotificationReference2, {
|
|
279
|
-
kind: "organization",
|
|
280
|
-
id: delivery.organizationId
|
|
281
|
-
}, "organization")
|
|
282
|
-
],
|
|
283
|
-
[
|
|
284
|
-
m.workspaceId,
|
|
285
|
-
/* @__PURE__ */ jsx2(NotificationReference2, {
|
|
286
|
-
kind: "workspace",
|
|
287
|
-
id: delivery.workspaceId
|
|
288
|
-
}, "workspace")
|
|
289
|
-
],
|
|
290
|
-
[m.eventKey, delivery.eventKey],
|
|
291
|
-
[m.template, delivery.template],
|
|
292
|
-
[c.purpose, m.purposes[delivery.purpose]],
|
|
293
|
-
[c.status, c.statuses[delivery.status]],
|
|
294
|
-
[c.provider, delivery.provider],
|
|
295
|
-
[c.providerMessageId, delivery.providerMessageId],
|
|
296
|
-
[c.reason, delivery.errorMessage],
|
|
297
|
-
[
|
|
298
|
-
c.attempts,
|
|
299
|
-
`${delivery.attempts} / ${delivery.maxAttempts}`
|
|
300
|
-
]
|
|
301
|
-
].map(([label, value], index) => /* @__PURE__ */ jsxs("div", {
|
|
302
|
-
children: [
|
|
303
|
-
/* @__PURE__ */ jsx2("dt", {
|
|
304
|
-
className: "font-semibold",
|
|
305
|
-
children: label
|
|
306
|
-
}),
|
|
307
|
-
/* @__PURE__ */ jsx2("dd", {
|
|
308
|
-
children: value ?? "—"
|
|
309
|
-
})
|
|
310
|
-
]
|
|
311
|
-
}, index))
|
|
312
|
-
}),
|
|
313
|
-
delivery.contactId && p.onContact && /* @__PURE__ */ jsx2(Button, {
|
|
314
|
-
variant: "outline",
|
|
315
|
-
onClick: () => p.onContact?.(delivery.contactId),
|
|
316
|
-
children: c.contactId
|
|
317
|
-
}),
|
|
318
|
-
delivery.campaignId && p.onCampaign && /* @__PURE__ */ jsx2(Button, {
|
|
319
|
-
variant: "outline",
|
|
320
|
-
onClick: () => p.onCampaign?.(delivery.campaignId),
|
|
321
|
-
children: c.campaign
|
|
322
|
-
}),
|
|
323
|
-
/* @__PURE__ */ jsx2("h3", {
|
|
324
|
-
children: m.references
|
|
325
|
-
}),
|
|
326
|
-
/* @__PURE__ */ jsx2("dl", {
|
|
327
|
-
children: p.inspection?.references.map((ref) => /* @__PURE__ */ jsxs("div", {
|
|
328
|
-
children: [
|
|
329
|
-
/* @__PURE__ */ jsx2("dt", {
|
|
330
|
-
children: ref.namespace
|
|
331
|
-
}),
|
|
332
|
-
/* @__PURE__ */ jsx2("dd", {
|
|
333
|
-
children: /* @__PURE__ */ jsx2(NotificationReference2, {
|
|
334
|
-
kind: ref.namespace,
|
|
335
|
-
id: ref.value
|
|
336
|
-
})
|
|
337
|
-
})
|
|
338
|
-
]
|
|
339
|
-
}, `${ref.namespace}:${ref.value}`))
|
|
340
|
-
}),
|
|
341
|
-
/* @__PURE__ */ jsx2("h3", {
|
|
342
|
-
children: c.attempts
|
|
343
|
-
}),
|
|
344
|
-
/* @__PURE__ */ jsx2(NotificationTable2, {
|
|
345
|
-
rowData: p.inspection?.attempts ?? [],
|
|
346
|
-
getRowId: (row) => row.id,
|
|
347
|
-
columnDefs: [
|
|
348
|
-
{
|
|
349
|
-
field: "generation",
|
|
350
|
-
headerName: c.generation,
|
|
351
|
-
type: "number"
|
|
352
|
-
},
|
|
353
|
-
{ field: "attempt", headerName: c.attempts, type: "number" },
|
|
354
|
-
{
|
|
355
|
-
colId: "outcome",
|
|
356
|
-
headerName: c.outcome,
|
|
357
|
-
cellRenderer: ({ data }) => data.outcome ? c.outcomes[data.outcome._tag] : c.pending
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
colId: "reason",
|
|
361
|
-
headerName: c.reason,
|
|
362
|
-
cellRenderer: ({ data }) => {
|
|
363
|
-
const o = data.outcome;
|
|
364
|
-
if (!o)
|
|
365
|
-
return "—";
|
|
366
|
-
switch (o._tag) {
|
|
367
|
-
case "Sent":
|
|
368
|
-
return o.providerMessageId ?? "—";
|
|
369
|
-
case "Skipped":
|
|
370
|
-
return o.reason;
|
|
371
|
-
default:
|
|
372
|
-
return o.message;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
},
|
|
376
|
-
{ field: "startedAt", headerName: c.started, type: "date" },
|
|
377
|
-
{
|
|
378
|
-
field: "completedAt",
|
|
379
|
-
headerName: c.completed,
|
|
380
|
-
type: "date"
|
|
381
|
-
}
|
|
382
|
-
],
|
|
383
|
-
features: { pagination: { mode: "client" } }
|
|
384
|
-
})
|
|
385
|
-
]
|
|
386
|
-
}),
|
|
387
|
-
/* @__PURE__ */ jsx2(Button, {
|
|
388
|
-
variant: "outline",
|
|
389
|
-
onClick: p.onRefresh,
|
|
390
|
-
children: c.refresh
|
|
391
|
-
}),
|
|
392
|
-
/* @__PURE__ */ jsx2(Button, {
|
|
393
|
-
variant: "outline",
|
|
394
|
-
onClick: () => p.onInspect(undefined),
|
|
395
|
-
children: c.close
|
|
396
|
-
})
|
|
397
|
-
]
|
|
398
|
-
})
|
|
399
|
-
})
|
|
400
|
-
]
|
|
401
|
-
});
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
export { Tabs, TabsList, TabsTrigger, NotificationDeliveries2 };
|