@krak-stack/notifications-admin 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +9 -1
- package/dist/{chunk-nk9ge6g9.js → chunk-28xppc9m.js} +39 -13
- package/dist/chunk-aqmv7g24.js +29 -0
- package/dist/{chunk-8nawv50q.js → chunk-wkxc1y7w.js} +26 -10
- package/dist/deliveries.js +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -2
- package/dist/operations.js +3 -2
- package/dist/presentation.d.ts +15 -0
- package/dist/presentation.js +10 -0
- package/package.json +11 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @krak-stack/notifications-admin
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add an optional NotificationPresentationProvider for host-owned table defaults and named inspection references. Delivery and operations screens retain their existing controlled data, actions, authorization boundaries and backwards-compatible default rendering.
|
|
8
|
+
|
|
3
9
|
## 0.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ TanStack or registry dependency.
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
|
-
bun add @krak-stack/notifications@0.3.0 @krak-stack/notifications-admin@0.
|
|
11
|
+
bun add @krak-stack/notifications@0.3.0 @krak-stack/notifications-admin@0.2.0 @krak-stack/registry@0.2.2
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Install the React, Effect, Effect Atom, Effect browser platform, TanStack, Base UI and icon peer dependencies
|
|
@@ -48,6 +48,14 @@ factories. The existing `Send*` names remain aliases for compatibility.
|
|
|
48
48
|
|
|
49
49
|
## Host integration
|
|
50
50
|
|
|
51
|
+
Hosts can wrap delivery and operations views with `NotificationPresentationProvider`
|
|
52
|
+
from `@krak-stack/notifications-admin/presentation`. Supply `Table` (the registry
|
|
53
|
+
DataTable interface) to share application table defaults, columns and safe exports.
|
|
54
|
+
Optional `renderReference(kind, id)` resolves inspection references to host-owned
|
|
55
|
+
names or links. These hooks are useful to both product admin workspaces and
|
|
56
|
+
embedded sending consoles. They contain no product labels, record lookups,
|
|
57
|
+
authentication or policy. Default rendering remains backwards compatible.
|
|
58
|
+
|
|
51
59
|
- Protect the page with the host's existing authentication and authorization.
|
|
52
60
|
These components confer no permissions and create no routes.
|
|
53
61
|
- Mount the Effect backend groups from `@krak-stack/notifications/admin/*` with
|
|
@@ -6,11 +6,10 @@ import {
|
|
|
6
6
|
DialogHeader,
|
|
7
7
|
DialogTitle
|
|
8
8
|
} from "./chunk-tck9drx2.js";
|
|
9
|
-
|
|
10
|
-
// src/deliveries.tsx
|
|
11
9
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
NotificationTable2,
|
|
11
|
+
NotificationReference2
|
|
12
|
+
} from "./chunk-aqmv7g24.js";
|
|
14
13
|
|
|
15
14
|
// ../../src/components/ui/tabs.tsx
|
|
16
15
|
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
@@ -215,7 +214,7 @@ var NotificationDeliveries2 = (p) => {
|
|
|
215
214
|
]
|
|
216
215
|
}, key))
|
|
217
216
|
}),
|
|
218
|
-
p.view === "activity" && /* @__PURE__ */ jsx2(
|
|
217
|
+
p.view === "activity" && /* @__PURE__ */ jsx2(NotificationTable2, {
|
|
219
218
|
rowData: p.activity?.items ?? [],
|
|
220
219
|
columnDefs: columns,
|
|
221
220
|
getRowId: (row) => row.id,
|
|
@@ -258,12 +257,36 @@ var NotificationDeliveries2 = (p) => {
|
|
|
258
257
|
/* @__PURE__ */ jsx2("dl", {
|
|
259
258
|
className: "grid gap-2 break-all sm:grid-cols-2",
|
|
260
259
|
children: [
|
|
261
|
-
[
|
|
260
|
+
[
|
|
261
|
+
c.id,
|
|
262
|
+
/* @__PURE__ */ jsx2(NotificationReference2, {
|
|
263
|
+
kind: "delivery",
|
|
264
|
+
id: delivery.id
|
|
265
|
+
}, "delivery")
|
|
266
|
+
],
|
|
262
267
|
[m.source, m.sources[delivery.source]],
|
|
263
268
|
[c.email, delivery.recipientAddress],
|
|
264
|
-
[
|
|
265
|
-
|
|
266
|
-
|
|
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
|
+
],
|
|
267
290
|
[m.eventKey, delivery.eventKey],
|
|
268
291
|
[m.template, delivery.template],
|
|
269
292
|
[c.purpose, m.purposes[delivery.purpose]],
|
|
@@ -275,7 +298,7 @@ var NotificationDeliveries2 = (p) => {
|
|
|
275
298
|
c.attempts,
|
|
276
299
|
`${delivery.attempts} / ${delivery.maxAttempts}`
|
|
277
300
|
]
|
|
278
|
-
].map(([label, value]) => /* @__PURE__ */ jsxs("div", {
|
|
301
|
+
].map(([label, value], index) => /* @__PURE__ */ jsxs("div", {
|
|
279
302
|
children: [
|
|
280
303
|
/* @__PURE__ */ jsx2("dt", {
|
|
281
304
|
className: "font-semibold",
|
|
@@ -285,7 +308,7 @@ var NotificationDeliveries2 = (p) => {
|
|
|
285
308
|
children: value ?? "—"
|
|
286
309
|
})
|
|
287
310
|
]
|
|
288
|
-
},
|
|
311
|
+
}, index))
|
|
289
312
|
}),
|
|
290
313
|
delivery.contactId && p.onContact && /* @__PURE__ */ jsx2(Button, {
|
|
291
314
|
variant: "outline",
|
|
@@ -307,7 +330,10 @@ var NotificationDeliveries2 = (p) => {
|
|
|
307
330
|
children: ref.namespace
|
|
308
331
|
}),
|
|
309
332
|
/* @__PURE__ */ jsx2("dd", {
|
|
310
|
-
children:
|
|
333
|
+
children: /* @__PURE__ */ jsx2(NotificationReference2, {
|
|
334
|
+
kind: ref.namespace,
|
|
335
|
+
id: ref.value
|
|
336
|
+
})
|
|
311
337
|
})
|
|
312
338
|
]
|
|
313
339
|
}, `${ref.namespace}:${ref.value}`))
|
|
@@ -315,7 +341,7 @@ var NotificationDeliveries2 = (p) => {
|
|
|
315
341
|
/* @__PURE__ */ jsx2("h3", {
|
|
316
342
|
children: c.attempts
|
|
317
343
|
}),
|
|
318
|
-
/* @__PURE__ */ jsx2(
|
|
344
|
+
/* @__PURE__ */ jsx2(NotificationTable2, {
|
|
319
345
|
rowData: p.inspection?.attempts ?? [],
|
|
320
346
|
getRowId: (row) => row.id,
|
|
321
347
|
columnDefs: [
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/presentation.tsx
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { DataTable } from "@krak-stack/registry/data-table";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var PresentationContext = createContext({
|
|
6
|
+
Table: DataTable
|
|
7
|
+
});
|
|
8
|
+
var NotificationPresentationProvider2 = ({
|
|
9
|
+
children,
|
|
10
|
+
...presentation
|
|
11
|
+
}) => /* @__PURE__ */ jsx(PresentationContext.Provider, {
|
|
12
|
+
value: presentation,
|
|
13
|
+
children
|
|
14
|
+
});
|
|
15
|
+
var NotificationTable2 = (props) => {
|
|
16
|
+
const { Table } = useContext(PresentationContext);
|
|
17
|
+
return /* @__PURE__ */ jsx(Table, {
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var NotificationReference2 = ({
|
|
22
|
+
kind,
|
|
23
|
+
id
|
|
24
|
+
}) => {
|
|
25
|
+
const { renderReference } = useContext(PresentationContext);
|
|
26
|
+
return id ? renderReference ? renderReference(kind, id) : id : "—";
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { NotificationPresentationProvider2, NotificationTable2, NotificationReference2 };
|
|
@@ -10,15 +10,16 @@ import {
|
|
|
10
10
|
Tabs,
|
|
11
11
|
TabsList,
|
|
12
12
|
TabsTrigger
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-28xppc9m.js";
|
|
14
|
+
import {
|
|
15
|
+
NotificationTable2,
|
|
16
|
+
NotificationReference2
|
|
17
|
+
} from "./chunk-aqmv7g24.js";
|
|
14
18
|
|
|
15
19
|
// src/operations.tsx
|
|
16
20
|
import { useState } from "react";
|
|
17
21
|
import { Effect, Schema } from "effect";
|
|
18
22
|
import * as S from "@krak-stack/notifications/admin/operations.schema";
|
|
19
|
-
import {
|
|
20
|
-
DataTable
|
|
21
|
-
} from "@krak-stack/registry/data-table";
|
|
22
23
|
import { useAppForm } from "@krak-stack/registry/form";
|
|
23
24
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
24
25
|
var views = S.OperationsView.literals;
|
|
@@ -46,7 +47,7 @@ var Records = ({
|
|
|
46
47
|
columns,
|
|
47
48
|
m,
|
|
48
49
|
table
|
|
49
|
-
}) => /* @__PURE__ */ jsx(
|
|
50
|
+
}) => /* @__PURE__ */ jsx(NotificationTable2, {
|
|
50
51
|
rowData: items ?? [],
|
|
51
52
|
columnDefs: columns.map((column) => column.colId === "inspect" || column.colId === "remove" ? {
|
|
52
53
|
...column,
|
|
@@ -389,7 +390,10 @@ var SendOperationsAdmin2 = (p) => {
|
|
|
389
390
|
field: "status",
|
|
390
391
|
headerName: m.status,
|
|
391
392
|
cellRenderer: ({ data }) => m.recipientStatuses[data.status],
|
|
392
|
-
filterOptions: Object.entries(m.recipientStatuses).map(([value, label]) => ({
|
|
393
|
+
filterOptions: Object.entries(m.recipientStatuses).map(([value, label]) => ({
|
|
394
|
+
value,
|
|
395
|
+
label
|
|
396
|
+
}))
|
|
393
397
|
},
|
|
394
398
|
{ field: "reason", headerName: m.reason },
|
|
395
399
|
{
|
|
@@ -560,8 +564,20 @@ var SendOperationsAdmin2 = (p) => {
|
|
|
560
564
|
/* @__PURE__ */ jsx("dl", {
|
|
561
565
|
className: "grid gap-2 break-all sm:grid-cols-2",
|
|
562
566
|
children: [
|
|
563
|
-
[
|
|
564
|
-
|
|
567
|
+
[
|
|
568
|
+
m.id,
|
|
569
|
+
/* @__PURE__ */ jsx(NotificationReference2, {
|
|
570
|
+
kind: "delivery",
|
|
571
|
+
id: delivery.id
|
|
572
|
+
}, "delivery")
|
|
573
|
+
],
|
|
574
|
+
[
|
|
575
|
+
m.contactId,
|
|
576
|
+
/* @__PURE__ */ jsx(NotificationReference2, {
|
|
577
|
+
kind: "contact",
|
|
578
|
+
id: delivery.contactId
|
|
579
|
+
}, "contact")
|
|
580
|
+
],
|
|
565
581
|
[m.email, delivery.email],
|
|
566
582
|
[m.subject, delivery.subject],
|
|
567
583
|
[m.status, m.statuses[delivery.status]],
|
|
@@ -578,7 +594,7 @@ var SendOperationsAdmin2 = (p) => {
|
|
|
578
594
|
[m.scheduled, date(delivery.scheduledFor)],
|
|
579
595
|
[m.updated, date(delivery.updatedAt)],
|
|
580
596
|
[m.accepted, date(delivery.sentAt)]
|
|
581
|
-
].map(([label, value]) => /* @__PURE__ */ jsxs("div", {
|
|
597
|
+
].map(([label, value], index) => /* @__PURE__ */ jsxs("div", {
|
|
582
598
|
children: [
|
|
583
599
|
/* @__PURE__ */ jsx("dt", {
|
|
584
600
|
className: "font-semibold",
|
|
@@ -588,7 +604,7 @@ var SendOperationsAdmin2 = (p) => {
|
|
|
588
604
|
children: value ?? "—"
|
|
589
605
|
})
|
|
590
606
|
]
|
|
591
|
-
},
|
|
607
|
+
}, index))
|
|
592
608
|
}),
|
|
593
609
|
/* @__PURE__ */ jsx("dl", {
|
|
594
610
|
children: [
|
package/dist/deliveries.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,16 +8,20 @@ import {
|
|
|
8
8
|
} from "./chunk-dxjvd9tb.js";
|
|
9
9
|
import {
|
|
10
10
|
NotificationDeliveries2
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-28xppc9m.js";
|
|
12
|
+
import {
|
|
13
|
+
NotificationPresentationProvider2
|
|
14
|
+
} from "./chunk-aqmv7g24.js";
|
|
12
15
|
import {
|
|
13
16
|
SendOperationsAdmin2
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-wkxc1y7w.js";
|
|
15
18
|
export {
|
|
16
19
|
SendCampaignAdmin2 as NotificationCampaigns,
|
|
17
20
|
SendContactDetails2 as NotificationContactDetails,
|
|
18
21
|
SendContacts2 as NotificationContacts,
|
|
19
22
|
NotificationDeliveries2 as NotificationDeliveries,
|
|
20
23
|
SendOperationsAdmin2 as NotificationOperations,
|
|
24
|
+
NotificationPresentationProvider2 as NotificationPresentationProvider,
|
|
21
25
|
SendCampaignAdmin2 as SendCampaignAdmin,
|
|
22
26
|
SendContactDetails2 as SendContactDetails,
|
|
23
27
|
SendContacts2 as SendContacts,
|
package/dist/operations.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SendOperationsAdmin2
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-wkxc1y7w.js";
|
|
4
4
|
import {
|
|
5
5
|
NotificationDeliveries2
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-28xppc9m.js";
|
|
7
7
|
import"./chunk-tck9drx2.js";
|
|
8
|
+
import"./chunk-aqmv7g24.js";
|
|
8
9
|
export {
|
|
9
10
|
NotificationDeliveries2 as NotificationDeliveries,
|
|
10
11
|
SendOperationsAdmin2 as NotificationOperations,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { DataTable } from "@krak-stack/registry/data-table";
|
|
3
|
+
export interface NotificationPresentation {
|
|
4
|
+
readonly Table: typeof DataTable;
|
|
5
|
+
readonly renderReference?: (kind: string, id: string) => ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Host-owned appearance and identity labels; never supplies authorization. */
|
|
8
|
+
export declare const NotificationPresentationProvider: ({ children, ...presentation }: NotificationPresentation & {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}) => import("react").JSX.Element;
|
|
11
|
+
export declare const NotificationTable: typeof DataTable;
|
|
12
|
+
export declare const NotificationReference: ({ kind, id, }: {
|
|
13
|
+
kind: string;
|
|
14
|
+
id: string | null | undefined;
|
|
15
|
+
}) => ReactNode;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NotificationPresentationProvider2,
|
|
3
|
+
NotificationTable2,
|
|
4
|
+
NotificationReference2
|
|
5
|
+
} from "./chunk-aqmv7g24.js";
|
|
6
|
+
export {
|
|
7
|
+
NotificationPresentationProvider2 as NotificationPresentationProvider,
|
|
8
|
+
NotificationReference2 as NotificationReference,
|
|
9
|
+
NotificationTable2 as NotificationTable
|
|
10
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krak-stack/notifications-admin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Optional React administration screens and Effect Atom helpers for KrakStack notifications.",
|
|
5
5
|
"homepage": "https://krakstack.net/docs/notifications",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,17 +9,21 @@
|
|
|
9
9
|
"url": "git+https://github.com/krakcons/krakstack.git",
|
|
10
10
|
"directory": "packages/notifications-admin"
|
|
11
11
|
},
|
|
12
|
-
"type": "module",
|
|
13
|
-
"sideEffects": [
|
|
14
|
-
"./tailwind.css"
|
|
15
|
-
],
|
|
16
12
|
"files": [
|
|
17
13
|
"dist",
|
|
18
14
|
"tailwind.css",
|
|
19
15
|
"README.md",
|
|
20
16
|
"CHANGELOG.md"
|
|
21
17
|
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"sideEffects": [
|
|
20
|
+
"./tailwind.css"
|
|
21
|
+
],
|
|
22
22
|
"exports": {
|
|
23
|
+
"./presentation": {
|
|
24
|
+
"types": "./dist/presentation.d.ts",
|
|
25
|
+
"import": "./dist/presentation.js"
|
|
26
|
+
},
|
|
23
27
|
".": {
|
|
24
28
|
"types": "./dist/index.d.ts",
|
|
25
29
|
"import": "./dist/index.js"
|
|
@@ -62,11 +66,11 @@
|
|
|
62
66
|
"cn": "^0.3.0"
|
|
63
67
|
},
|
|
64
68
|
"peerDependencies": {
|
|
65
|
-
"@krak-stack/notifications": "^0.3.0",
|
|
66
|
-
"@krak-stack/registry": "^0.2.2",
|
|
67
69
|
"@base-ui/react": "^1.5.0",
|
|
68
70
|
"@effect/atom-react": "^4.1.0",
|
|
69
71
|
"@effect/platform-browser": "^4.1.0",
|
|
72
|
+
"@krak-stack/notifications": "^0.3.0",
|
|
73
|
+
"@krak-stack/registry": "^0.2.2",
|
|
70
74
|
"@tanstack/react-form": "^1.33.0",
|
|
71
75
|
"@tanstack/react-router": "^1.170.15",
|
|
72
76
|
"@tanstack/react-virtual": "^3.14.5",
|