@voyant-travel/action-ledger-react 0.6.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may accept and charge a
167
+ fee for, the acceptance of support, warranty, indemnity, or
168
+ other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 PixelMakers Studio SRL
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # @voyant-travel/action-ledger-react
2
+
3
+ React client utilities for `@voyant-travel/action-ledger`.
4
+
5
+ This package delivers the packaged admin surface for the action ledger
6
+ (packaged-admin RFC): the Logs list page with cursor pagination, the
7
+ filters popover (booking/product/person/organization/workflow-run pickers),
8
+ and the entry detail sheet, plus the `createActionLedgerAdminExtension`
9
+ factory that contributes the nav entry and the full route implementation
10
+ to an admin host.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pnpm add @voyant-travel/action-ledger-react @voyant-travel/action-ledger
16
+ ```
17
+
18
+ ## Exports
19
+
20
+ | Entry | Description |
21
+ | --- | --- |
22
+ | `.` | Provider/context re-exports |
23
+ | `./provider` | `VoyantActionLedgerProvider` and context helpers |
24
+ | `./admin` | `createActionLedgerAdminExtension` admin contribution |
25
+
26
+ ## License
27
+
28
+ Apache-2.0
@@ -0,0 +1,7 @@
1
+ export declare function ActionLedgerEntrySheet({ open, onOpenChange, entryId, locale, }: {
2
+ open: boolean;
3
+ onOpenChange: (open: boolean) => void;
4
+ entryId: string | null;
5
+ locale: string;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=action-ledger-entry-sheet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-ledger-entry-sheet.d.ts","sourceRoot":"","sources":["../../src/admin/action-ledger-entry-sheet.tsx"],"names":[],"mappings":"AAmDA,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,MAAM,GACP,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;CACf,2CAuCA"}
@@ -0,0 +1,78 @@
1
+ // agent-quality: file-size exception -- owner: action-ledger-react; existing UI surface stays co-located until a dedicated split preserves behavior and tests.
2
+ "use client";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { useQuery } from "@tanstack/react-query";
5
+ import { useOperatorAdminMessages as useAdminMessages } from "@voyant-travel/admin";
6
+ import { Badge } from "@voyant-travel/ui/components/badge";
7
+ import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from "@voyant-travel/ui/components/sheet";
8
+ import { Eye, KeyRound, ScrollText, ShieldCheck } from "lucide-react";
9
+ import { useVoyantActionLedgerContext } from "../provider.js";
10
+ import { getActionLedgerEntry } from "./admin-api.js";
11
+ import { actionLedgerQueryKeys } from "./query-keys.js";
12
+ const STATUS_VARIANT = {
13
+ succeeded: "default",
14
+ approved: "default",
15
+ awaiting_approval: "secondary",
16
+ requested: "secondary",
17
+ denied: "destructive",
18
+ failed: "destructive",
19
+ expired: "destructive",
20
+ cancelled: "destructive",
21
+ superseded: "outline",
22
+ reversed: "outline",
23
+ compensated: "outline",
24
+ };
25
+ const RISK_VARIANT = {
26
+ low: "outline",
27
+ medium: "secondary",
28
+ high: "default",
29
+ critical: "destructive",
30
+ };
31
+ export function ActionLedgerEntrySheet({ open, onOpenChange, entryId, locale, }) {
32
+ const t = useAdminMessages().actionLedgerPage.entrySheet;
33
+ const client = useVoyantActionLedgerContext();
34
+ const entryDetailQuery = useQuery({
35
+ queryKey: actionLedgerQueryKeys.entry(entryId ?? ""),
36
+ queryFn: () => getActionLedgerEntry(client, entryId ?? ""),
37
+ enabled: open && Boolean(entryId),
38
+ });
39
+ const entry = entryDetailQuery.data?.data ?? null;
40
+ const isLoading = entryDetailQuery.isLoading || entryDetailQuery.isFetching;
41
+ return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { side: "right", className: "w-full overflow-hidden p-0 sm:max-w-2xl lg:max-w-3xl", children: [_jsxs(SheetHeader, { className: "border-b px-6 py-4", children: [_jsx(SheetTitle, { children: t.title }), _jsx(SheetDescription, { children: t.description }), entry ? (_jsxs("div", { className: "flex flex-wrap items-center gap-2 pt-1", children: [_jsx(Badge, { variant: RISK_VARIANT[entry.evaluatedRisk] ?? "outline", children: entry.evaluatedRisk }), _jsx(Badge, { variant: STATUS_VARIANT[entry.status] ?? "outline", children: entry.status }), _jsx("span", { className: "font-mono text-muted-foreground text-xs", children: entry.id })] })) : null] }), _jsx("div", { className: "h-[calc(100vh-9rem)] overflow-auto px-6 py-5", children: isLoading ? (_jsx("p", { className: "text-muted-foreground text-sm", children: t.loading })) : entry ? (_jsx(ActionLedgerEntryDetail, { entry: entry, locale: locale, messages: t })) : (_jsx("p", { className: "text-muted-foreground text-sm", children: t.notFound })) })] }) }));
42
+ }
43
+ function ActionLedgerEntryDetail({ entry, locale, messages, }) {
44
+ return (_jsxs("div", { className: "space-y-6", children: [_jsxs(DetailGrid, { children: [_jsx(DetailField, { label: messages.baseFields.when, value: formatDateTime(entry.occurredAt, locale), noValue: messages.noValue }), _jsx(DetailField, { label: messages.baseFields.action, value: entry.actionName, noValue: messages.noValue }), _jsx(DetailField, { label: messages.baseFields.version, value: entry.actionVersion, noValue: messages.noValue }), _jsx(DetailField, { label: messages.baseFields.kind, value: entry.actionKind, noValue: messages.noValue }), _jsx(DetailField, { label: messages.baseFields.routeOrTool, value: entry.routeOrToolName, noValue: messages.noValue }), _jsx(DetailField, { label: messages.baseFields.authorization, value: entry.authorizationSource, noValue: messages.noValue })] }), _jsx(DetailSection, { title: messages.actor.title, icon: _jsx(ShieldCheck, { className: "h-4 w-4" }), children: _jsxs(DetailGrid, { children: [_jsx(DetailField, { label: messages.actor.principalType, value: entry.principalType, noValue: messages.noValue }), _jsx(DetailField, { label: messages.actor.principalId, value: entry.principalId, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.actor.actorType, value: entry.actorType, noValue: messages.noValue }), _jsx(DetailField, { label: messages.actor.callerType, value: entry.callerType, noValue: messages.noValue }), _jsx(DetailField, { label: messages.actor.sessionId, value: entry.sessionId, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.actor.apiToken, value: entry.apiTokenId, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.actor.organization, value: entry.organizationId, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.actor.internal, value: entry.internalRequest ? messages.booleanYes : messages.booleanNo, noValue: messages.noValue })] }) }), _jsx(DetailSection, { title: messages.targetFlow.title, icon: _jsx(ScrollText, { className: "h-4 w-4" }), children: _jsxs(DetailGrid, { children: [_jsx(DetailField, { label: messages.targetFlow.targetType, value: entry.targetType, noValue: messages.noValue }), _jsx(DetailField, { label: messages.targetFlow.targetId, value: entry.targetId, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.targetFlow.workflowRun, value: entry.workflowRunId, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.targetFlow.workflowStep, value: entry.workflowStepId, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.targetFlow.correlation, value: entry.correlationId, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.targetFlow.causationAction, value: entry.causationActionId, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.targetFlow.capability, value: entry.capabilityId, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.targetFlow.capabilityVersion, value: entry.capabilityVersion, noValue: messages.noValue })] }) }), _jsx(DetailSection, { title: messages.idempotency.title, icon: _jsx(KeyRound, { className: "h-4 w-4" }), children: _jsxs(DetailGrid, { children: [_jsx(DetailField, { label: messages.idempotency.scope, value: entry.idempotencyScope, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.idempotency.key, value: entry.idempotencyKey, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.idempotency.fingerprint, value: entry.idempotencyFingerprint, mono: true, noValue: messages.noValue })] }) }), entry.mutationDetail ? _jsx(MutationDetail, { entry: entry, messages: messages }) : null, entry.sensitiveReadDetail ? _jsx(SensitiveReadDetail, { entry: entry, messages: messages }) : null, _jsx(PayloadRefs, { entry: entry, messages: messages }), _jsx(RelayRows, { entry: entry, messages: messages })] }));
45
+ }
46
+ function MutationDetail({ entry, messages, }) {
47
+ const detail = entry.mutationDetail;
48
+ if (!detail)
49
+ return null;
50
+ return (_jsx(DetailSection, { title: messages.mutation.title, icon: _jsx(ScrollText, { className: "h-4 w-4" }), children: _jsxs(DetailGrid, { children: [_jsx(DetailField, { label: messages.mutation.summary, value: detail.summary, noValue: messages.noValue }), _jsx(DetailField, { label: messages.mutation.inputRef, value: detail.commandInputRef, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.mutation.resultRef, value: detail.commandResultRef, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.mutation.reversalKind, value: detail.reversalKind, noValue: messages.noValue }), _jsx(DetailField, { label: messages.mutation.reversalState, value: detail.reversalStateProjection, noValue: messages.noValue }), _jsx(DetailField, { label: messages.mutation.reverses, value: detail.reversesActionId, mono: true, noValue: messages.noValue })] }) }));
51
+ }
52
+ function SensitiveReadDetail({ entry, messages, }) {
53
+ const detail = entry.sensitiveReadDetail;
54
+ if (!detail)
55
+ return null;
56
+ return (_jsx(DetailSection, { title: messages.sensitiveRead.title, icon: _jsx(Eye, { className: "h-4 w-4" }), children: _jsxs(DetailGrid, { children: [_jsx(DetailField, { label: messages.sensitiveRead.reason, value: detail.reasonCode, noValue: messages.noValue }), _jsx(DetailField, { label: messages.sensitiveRead.decisionPolicy, value: detail.decisionPolicy, noValue: messages.noValue }), _jsx(DetailField, { label: messages.sensitiveRead.disclosure, value: detail.disclosureSummary, noValue: messages.noValue }), _jsx(DetailField, { label: messages.sensitiveRead.fields, value: detail.disclosedFieldSet?.join(", "), noValue: messages.noValue })] }) }));
57
+ }
58
+ function PayloadRefs({ entry, messages, }) {
59
+ return (_jsx(DetailSection, { title: messages.payloads.title, icon: _jsx(ScrollText, { className: "h-4 w-4" }), children: entry.payloads.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: messages.payloads.empty })) : (_jsx("div", { className: "space-y-3", children: entry.payloads.map((payload) => (_jsxs(DetailGrid, { children: [_jsx(DetailField, { label: messages.payloads.kind, value: payload.payloadKind, noValue: messages.noValue }), _jsx(DetailField, { label: messages.payloads.schema, value: payload.schemaTag, noValue: messages.noValue }), _jsx(DetailField, { label: messages.payloads.storageRef, value: payload.storageRef, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.payloads.redaction, value: payload.redactionStatus, noValue: messages.noValue }), _jsx(DetailField, { label: messages.payloads.retention, value: payload.retentionPolicy, noValue: messages.noValue }), _jsx(DetailField, { label: messages.payloads.hash, value: payload.hash, mono: true, noValue: messages.noValue })] }, payload.id))) })) }));
60
+ }
61
+ function RelayRows({ entry, messages, }) {
62
+ return (_jsx(DetailSection, { title: messages.relay.title, icon: _jsx(ScrollText, { className: "h-4 w-4" }), children: entry.relayOutbox.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: messages.relay.empty })) : (_jsx("div", { className: "space-y-3", children: entry.relayOutbox.map((row) => (_jsxs(DetailGrid, { children: [_jsx(DetailField, { label: messages.relay.status, value: row.relayStatus, noValue: messages.noValue }), _jsx(DetailField, { label: messages.relay.payloadRef, value: row.payloadRef, mono: true, noValue: messages.noValue }), _jsx(DetailField, { label: messages.relay.attempts, value: String(row.attemptCount), noValue: messages.noValue }), _jsx(DetailField, { label: messages.relay.nextRetry, value: row.nextRetryAt, noValue: messages.noValue }), _jsx(DetailField, { label: messages.relay.processed, value: row.processedAt, noValue: messages.noValue }), _jsx(DetailField, { label: messages.relay.lastError, value: row.lastError, noValue: messages.noValue })] }, row.id))) })) }));
63
+ }
64
+ function DetailSection({ title, icon, children, }) {
65
+ return (_jsxs("section", { className: "space-y-3", children: [_jsxs("h2", { className: "flex items-center gap-2 font-medium text-sm", children: [_jsx("span", { className: "text-muted-foreground", children: icon }), title] }), children] }));
66
+ }
67
+ function DetailGrid({ children }) {
68
+ return _jsx("div", { className: "grid gap-3 md:grid-cols-2", children: children });
69
+ }
70
+ function DetailField({ label, value, mono = false, noValue, }) {
71
+ return (_jsxs("div", { className: "min-w-0 rounded-md border bg-muted/20 px-3 py-2", children: [_jsx("div", { className: "text-muted-foreground text-xs", children: label }), _jsx("div", { className: `mt-1 min-h-5 truncate text-sm ${mono ? "font-mono text-xs" : "font-medium"}`, title: value ?? noValue, children: value || noValue })] }));
72
+ }
73
+ function formatDateTime(value, locale) {
74
+ return new Intl.DateTimeFormat(locale, {
75
+ dateStyle: "medium",
76
+ timeStyle: "short",
77
+ }).format(new Date(value));
78
+ }
@@ -0,0 +1,28 @@
1
+ export declare const ANY = "__all__";
2
+ export declare const RISK_ALL = "__all__";
3
+ export declare const STATUS_ALL = "__all__";
4
+ export declare const PRINCIPAL_TYPE_ALL = "__all__";
5
+ export declare const TARGET_TYPE_ALL = "__all__";
6
+ export interface ActionLedgerFiltersPopoverProps {
7
+ open: boolean;
8
+ onOpenChange: (open: boolean) => void;
9
+ activeFilterCount: number;
10
+ principalType: string;
11
+ onPrincipalTypeChange: (value: string) => void;
12
+ principalId: string;
13
+ onPrincipalIdChange: (value: string) => void;
14
+ targetType: string;
15
+ onTargetTypeChange: (value: string) => void;
16
+ targetId: string;
17
+ onTargetIdChange: (value: string) => void;
18
+ workflowRunId: string;
19
+ onWorkflowRunIdChange: (value: string) => void;
20
+ correlationId: string;
21
+ onCorrelationIdChange: (value: string) => void;
22
+ evaluatedRisk: string;
23
+ onEvaluatedRiskChange: (value: string) => void;
24
+ status: string;
25
+ onStatusChange: (value: string) => void;
26
+ }
27
+ export declare function ActionLedgerFiltersPopover({ open, onOpenChange, activeFilterCount, principalType, onPrincipalTypeChange, principalId, onPrincipalIdChange, targetType, onTargetTypeChange, targetId, onTargetIdChange, workflowRunId, onWorkflowRunIdChange, correlationId, onCorrelationIdChange, evaluatedRisk, onEvaluatedRiskChange, status, onStatusChange, }: ActionLedgerFiltersPopoverProps): import("react/jsx-runtime").JSX.Element;
28
+ //# sourceMappingURL=action-ledger-filters-popover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-ledger-filters-popover.d.ts","sourceRoot":"","sources":["../../src/admin/action-ledger-filters-popover.tsx"],"names":[],"mappings":"AA+BA,eAAO,MAAM,GAAG,YAAY,CAAA;AAC5B,eAAO,MAAM,QAAQ,YAAM,CAAA;AAC3B,eAAO,MAAM,UAAU,YAAM,CAAA;AAC7B,eAAO,MAAM,kBAAkB,YAAM,CAAA;AACrC,eAAO,MAAM,eAAe,YAAM,CAAA;AA+ClC,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,iBAAiB,EAAE,MAAM,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,aAAa,EAAE,MAAM,CAAA;IACrB,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,aAAa,EAAE,MAAM,CAAA;IACrB,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,aAAa,EAAE,MAAM,CAAA;IACrB,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC;AAMD,wBAAgB,0BAA0B,CAAC,EACzC,IAAI,EACJ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACnB,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACrB,MAAM,EACN,cAAc,GACf,EAAE,+BAA+B,2CAiJjC"}
@@ -0,0 +1,211 @@
1
+ // agent-quality: file-size exception -- owner: action-ledger-react; existing UI surface stays co-located until a dedicated split preserves behavior and tests.
2
+ "use client";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { useOperatorAdminMessages as useAdminMessages } from "@voyant-travel/admin";
5
+ import { useBookings } from "@voyant-travel/bookings-react";
6
+ import { useProducts } from "@voyant-travel/inventory-react";
7
+ import { useOrganizations, usePeople, } from "@voyant-travel/relationships-react";
8
+ import { AsyncCombobox } from "@voyant-travel/ui/components/async-combobox";
9
+ import { Badge } from "@voyant-travel/ui/components/badge";
10
+ import { Button } from "@voyant-travel/ui/components/button";
11
+ import { Input } from "@voyant-travel/ui/components/input";
12
+ import { Label } from "@voyant-travel/ui/components/label";
13
+ import { Popover, PopoverContent, PopoverTrigger } from "@voyant-travel/ui/components/popover";
14
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@voyant-travel/ui/components/select";
15
+ import { ListFilter } from "lucide-react";
16
+ import * as React from "react";
17
+ import { useVoyantActionLedgerContext } from "../provider.js";
18
+ import { listWorkflowRuns } from "./admin-api.js";
19
+ export const ANY = "__all__";
20
+ export const RISK_ALL = ANY;
21
+ export const STATUS_ALL = ANY;
22
+ export const PRINCIPAL_TYPE_ALL = ANY;
23
+ export const TARGET_TYPE_ALL = ANY;
24
+ const PRINCIPAL_TYPE_VALUES = [
25
+ PRINCIPAL_TYPE_ALL,
26
+ "user",
27
+ "api_key",
28
+ "agent",
29
+ "workflow",
30
+ "system",
31
+ ];
32
+ const TARGET_TYPE_VALUES = [
33
+ TARGET_TYPE_ALL,
34
+ "booking",
35
+ "product",
36
+ "person",
37
+ "organization",
38
+ "invoice",
39
+ "supplier",
40
+ ];
41
+ const RISK_VALUES = [RISK_ALL, "low", "medium", "high", "critical"];
42
+ const STATUS_VALUES = [
43
+ STATUS_ALL,
44
+ "requested",
45
+ "awaiting_approval",
46
+ "approved",
47
+ "denied",
48
+ "succeeded",
49
+ "failed",
50
+ "reversed",
51
+ "compensated",
52
+ "expired",
53
+ "cancelled",
54
+ "superseded",
55
+ ];
56
+ function optionKey(value) {
57
+ return value === ANY ? "any" : value;
58
+ }
59
+ export function ActionLedgerFiltersPopover({ open, onOpenChange, activeFilterCount, principalType, onPrincipalTypeChange, principalId, onPrincipalIdChange, targetType, onTargetTypeChange, targetId, onTargetIdChange, workflowRunId, onWorkflowRunIdChange, correlationId, onCorrelationIdChange, evaluatedRisk, onEvaluatedRiskChange, status, onStatusChange, }) {
60
+ const messages = useAdminMessages().actionLedgerPage;
61
+ const f = messages.filtersPopover;
62
+ const principalIdKey = optionKey(principalType);
63
+ const principalIdPlaceholder = f.principalIdPlaceholder[principalIdKey] ?? f.principalIdPlaceholder.any;
64
+ return (_jsxs(Popover, { open: open, onOpenChange: onOpenChange, children: [_jsx(PopoverTrigger, { render: _jsxs(Button, { variant: "outline", size: "default", children: [_jsx(ListFilter, { className: "mr-2 size-4" }), messages.filters, activeFilterCount > 0 ? (_jsx(Badge, { variant: "secondary", className: "ml-2 px-1.5", children: activeFilterCount })) : null] }) }), _jsx(PopoverContent, { align: "start", className: "w-[22rem] p-4", children: _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "logs-filter-principal-type", children: f.principalTypeLabel }), _jsxs(Select, { value: principalType, onValueChange: (value) => onPrincipalTypeChange(value ?? PRINCIPAL_TYPE_ALL), children: [_jsx(SelectTrigger, { id: "logs-filter-principal-type", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: PRINCIPAL_TYPE_VALUES.map((value) => (_jsx(SelectItem, { value: value, children: f.principalTypeOptions[optionKey(value)] }, value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "logs-filter-principal-id", children: f.principalIdLabel }), _jsx(Input, { id: "logs-filter-principal-id", placeholder: principalIdPlaceholder, value: principalId, onChange: (event) => onPrincipalIdChange(event.target.value) })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "logs-filter-target-type", children: f.targetTypeLabel }), _jsxs(Select, { value: isKnownTargetType(targetType) ? targetType : TARGET_TYPE_ALL, onValueChange: (value) => onTargetTypeChange(value ?? TARGET_TYPE_ALL), children: [_jsx(SelectTrigger, { id: "logs-filter-target-type", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: TARGET_TYPE_VALUES.map((value) => (_jsx(SelectItem, { value: value, children: f.targetTypeOptions[optionKey(value)] }, value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "logs-filter-target-id", children: f.targetLabel }), _jsx(TargetCombobox, { targetType: targetType, value: targetId, onChange: onTargetIdChange, messages: f.targetSearch })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "logs-filter-workflow", children: f.workflowRunLabel }), _jsx(WorkflowRunCombobox, { value: workflowRunId, onChange: onWorkflowRunIdChange, placeholder: f.workflowRunPlaceholder, loadingText: f.workflowRunLoading, emptyText: f.workflowRunEmpty })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "logs-filter-correlation", children: f.correlationIdLabel }), _jsx(Input, { id: "logs-filter-correlation", placeholder: f.correlationIdPlaceholder, value: correlationId, onChange: (event) => onCorrelationIdChange(event.target.value) })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "logs-filter-risk", children: f.riskLabel }), _jsxs(Select, { value: evaluatedRisk, onValueChange: (value) => onEvaluatedRiskChange(value ?? RISK_ALL), children: [_jsx(SelectTrigger, { id: "logs-filter-risk", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: RISK_VALUES.map((value) => (_jsx(SelectItem, { value: value, children: f.riskOptions[optionKey(value)] }, value))) })] })] }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Label, { htmlFor: "logs-filter-status", children: f.statusLabel }), _jsxs(Select, { value: status, onValueChange: (value) => onStatusChange(value ?? STATUS_ALL), children: [_jsx(SelectTrigger, { id: "logs-filter-status", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: STATUS_VALUES.map((value) => (_jsx(SelectItem, { value: value, children: f.statusOptions[optionKey(value)] }, value))) })] })] })] }) })] }));
65
+ }
66
+ function isKnownTargetType(value) {
67
+ return TARGET_TYPE_VALUES.includes(value);
68
+ }
69
+ function TargetCombobox({ targetType, value, onChange, messages, }) {
70
+ switch (targetType) {
71
+ case "booking":
72
+ return _jsx(BookingTargetCombobox, { value: value, onChange: onChange, messages: messages });
73
+ case "product":
74
+ return _jsx(ProductTargetCombobox, { value: value, onChange: onChange, messages: messages });
75
+ case "person":
76
+ return _jsx(PersonTargetCombobox, { value: value, onChange: onChange, messages: messages });
77
+ case "organization":
78
+ return _jsx(OrganizationTargetCombobox, { value: value, onChange: onChange, messages: messages });
79
+ default:
80
+ return (_jsx(Input, { id: "logs-filter-target-id", placeholder: targetType === TARGET_TYPE_ALL ? messages.unknownPickType : messages.unknownPlaceholder, value: value, onChange: (event) => onChange(event.target.value) }));
81
+ }
82
+ }
83
+ function BookingTargetCombobox({ value, onChange, messages, }) {
84
+ const [search, setSearch] = React.useState("");
85
+ const [selected, setSelected] = React.useState(null);
86
+ const { data } = useBookings({ search: search || undefined, limit: 20 });
87
+ const items = data?.data ?? [];
88
+ return (_jsx(AsyncCombobox, { value: value || null, onChange: (next) => {
89
+ onChange(next ?? "");
90
+ if (!next)
91
+ setSelected(null);
92
+ else {
93
+ const match = items.find((booking) => booking.id === next);
94
+ if (match)
95
+ setSelected(match);
96
+ }
97
+ }, items: items, selectedItem: selected, getKey: (booking) => booking.id, getLabel: (booking) => booking.bookingNumber, onSearchChange: setSearch, placeholder: messages.bookingPlaceholder, emptyText: messages.bookingEmpty }));
98
+ }
99
+ function ProductTargetCombobox({ value, onChange, messages, }) {
100
+ const [search, setSearch] = React.useState("");
101
+ const [selected, setSelected] = React.useState(null);
102
+ const { data } = useProducts({ search: search || undefined, limit: 20 });
103
+ const items = data?.data ?? [];
104
+ return (_jsx(AsyncCombobox, { value: value || null, onChange: (next) => {
105
+ onChange(next ?? "");
106
+ if (!next)
107
+ setSelected(null);
108
+ else {
109
+ const match = items.find((product) => product.id === next);
110
+ if (match)
111
+ setSelected(match);
112
+ }
113
+ }, items: items, selectedItem: selected, getKey: (product) => product.id, getLabel: (product) => product.name, onSearchChange: setSearch, placeholder: messages.productPlaceholder, emptyText: messages.productEmpty }));
114
+ }
115
+ function PersonTargetCombobox({ value, onChange, messages, }) {
116
+ const [search, setSearch] = React.useState("");
117
+ const [selected, setSelected] = React.useState(null);
118
+ const { data } = usePeople({ search: search || undefined, limit: 20 });
119
+ const items = data?.data ?? [];
120
+ return (_jsx(AsyncCombobox, { value: value || null, onChange: (next) => {
121
+ onChange(next ?? "");
122
+ if (!next)
123
+ setSelected(null);
124
+ else {
125
+ const match = items.find((person) => person.id === next);
126
+ if (match)
127
+ setSelected(match);
128
+ }
129
+ }, items: items, selectedItem: selected, getKey: (person) => person.id, getLabel: formatPersonName, getSecondary: (person) => person.email ?? undefined, onSearchChange: setSearch, placeholder: messages.personPlaceholder, emptyText: messages.personEmpty }));
130
+ }
131
+ function OrganizationTargetCombobox({ value, onChange, messages, }) {
132
+ const [search, setSearch] = React.useState("");
133
+ const [selected, setSelected] = React.useState(null);
134
+ const { data } = useOrganizations({ search: search || undefined, limit: 20 });
135
+ const items = data?.data ?? [];
136
+ return (_jsx(AsyncCombobox, { value: value || null, onChange: (next) => {
137
+ onChange(next ?? "");
138
+ if (!next)
139
+ setSelected(null);
140
+ else {
141
+ const match = items.find((organization) => organization.id === next);
142
+ if (match)
143
+ setSelected(match);
144
+ }
145
+ }, items: items, selectedItem: selected, getKey: (organization) => organization.id, getLabel: (organization) => organization.name, onSearchChange: setSearch, placeholder: messages.organizationPlaceholder, emptyText: messages.organizationEmpty }));
146
+ }
147
+ function formatPersonName(person) {
148
+ const name = [person.firstName, person.lastName].filter(Boolean).join(" ").trim();
149
+ return name || person.email || person.id;
150
+ }
151
+ function WorkflowRunCombobox({ value, onChange, placeholder, loadingText, emptyText, }) {
152
+ const [search, setSearch] = React.useState("");
153
+ const [selected, setSelected] = React.useState(null);
154
+ const runsQuery = useWorkflowRunsList();
155
+ const filtered = React.useMemo(() => {
156
+ if (!search.trim())
157
+ return runsQuery.data ?? [];
158
+ const needle = search.trim().toLowerCase();
159
+ return (runsQuery.data ?? []).filter((run) => run.workflowName.toLowerCase().includes(needle) || run.id.toLowerCase().includes(needle));
160
+ }, [runsQuery.data, search]);
161
+ return (_jsx(AsyncCombobox, { value: value || null, onChange: (next) => {
162
+ onChange(next ?? "");
163
+ if (!next)
164
+ setSelected(null);
165
+ else {
166
+ const match = filtered.find((run) => run.id === next);
167
+ if (match)
168
+ setSelected(match);
169
+ }
170
+ }, items: filtered, selectedItem: selected, getKey: (run) => run.id, getLabel: (run) => run.workflowName, getSecondary: (run) => `${run.status} · ${formatRunTimestamp(run.startedAt)}`, onSearchChange: setSearch, placeholder: placeholder, emptyText: runsQuery.isLoading ? loadingText : emptyText }));
171
+ }
172
+ function useWorkflowRunsList() {
173
+ const client = useVoyantActionLedgerContext();
174
+ const [data, setData] = React.useState(undefined);
175
+ const [isLoading, setLoading] = React.useState(true);
176
+ React.useEffect(() => {
177
+ let cancelled = false;
178
+ setLoading(true);
179
+ listWorkflowRuns(client)
180
+ .then((res) => {
181
+ if (cancelled)
182
+ return;
183
+ setData(res.data ?? []);
184
+ })
185
+ .catch(() => {
186
+ if (cancelled)
187
+ return;
188
+ setData([]);
189
+ })
190
+ .finally(() => {
191
+ if (cancelled)
192
+ return;
193
+ setLoading(false);
194
+ });
195
+ return () => {
196
+ cancelled = true;
197
+ };
198
+ }, [client]);
199
+ return { data, isLoading };
200
+ }
201
+ function formatRunTimestamp(value) {
202
+ try {
203
+ return new Intl.DateTimeFormat(undefined, {
204
+ dateStyle: "short",
205
+ timeStyle: "short",
206
+ }).format(new Date(value));
207
+ }
208
+ catch {
209
+ return value;
210
+ }
211
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Packaged admin host for the action-ledger Logs page (packaged-admin RFC
3
+ * Phase 3). The page keeps its filter/cursor state locally (no URL search
4
+ * contract); booking targets link through the `"booking.detail"` semantic
5
+ * destination (RFC §4.7). Data flows through the shared provider context —
6
+ * no app RPC client.
7
+ */
8
+ export declare function ActionLedgerHost(): import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=action-ledger-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-ledger-host.d.ts","sourceRoot":"","sources":["../../src/admin/action-ledger-host.tsx"],"names":[],"mappings":"AAsGA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,4CAoO/B"}
@@ -0,0 +1,201 @@
1
+ // agent-quality: file-size exception -- owner: action-ledger-react; existing UI surface stays co-located until a dedicated split preserves behavior and tests.
2
+ "use client";
3
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
+ import { keepPreviousData, useQuery } from "@tanstack/react-query";
5
+ import { useAdminHref, useOperatorAdminMessages as useAdminMessages, useAdminNavigate, useLocale, } from "@voyant-travel/admin";
6
+ import { formatMessage } from "@voyant-travel/i18n";
7
+ import { Badge } from "@voyant-travel/ui/components/badge";
8
+ import { Button } from "@voyant-travel/ui/components/button";
9
+ import { Input } from "@voyant-travel/ui/components/input";
10
+ import { Label } from "@voyant-travel/ui/components/label";
11
+ import { Skeleton } from "@voyant-travel/ui/components/skeleton";
12
+ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@voyant-travel/ui/components/table";
13
+ import { ArrowDown, ArrowUp, ArrowUpDown, ExternalLink, Eye, Search, X } from "lucide-react";
14
+ import * as React from "react";
15
+ import { useVoyantActionLedgerContext } from "../provider.js";
16
+ import { ActionLedgerEntrySheet } from "./action-ledger-entry-sheet.js";
17
+ import { ActionLedgerFiltersPopover, PRINCIPAL_TYPE_ALL, RISK_ALL, STATUS_ALL, TARGET_TYPE_ALL, } from "./action-ledger-filters-popover.js";
18
+ import { ACTION_LEDGER_PAGE_SIZE, getActionLedgerEntries } from "./admin-api.js";
19
+ import { actionLedgerQueryKeys } from "./query-keys.js";
20
+ const EMPTY_FILTERS = {
21
+ actionName: "",
22
+ principalType: PRINCIPAL_TYPE_ALL,
23
+ principalId: "",
24
+ targetType: TARGET_TYPE_ALL,
25
+ targetId: "",
26
+ workflowRunId: "",
27
+ correlationId: "",
28
+ evaluatedRisk: RISK_ALL,
29
+ status: STATUS_ALL,
30
+ };
31
+ const PAGE_SIZE = ACTION_LEDGER_PAGE_SIZE;
32
+ const SKELETON_ROW_COUNT = 6;
33
+ const TABLE_COLUMN_COUNT = 8;
34
+ const STATUS_VARIANT = {
35
+ succeeded: "default",
36
+ approved: "default",
37
+ awaiting_approval: "secondary",
38
+ requested: "secondary",
39
+ denied: "destructive",
40
+ failed: "destructive",
41
+ expired: "destructive",
42
+ cancelled: "destructive",
43
+ superseded: "outline",
44
+ reversed: "outline",
45
+ compensated: "outline",
46
+ };
47
+ const RISK_VARIANT = {
48
+ low: "outline",
49
+ medium: "secondary",
50
+ high: "default",
51
+ critical: "destructive",
52
+ };
53
+ /**
54
+ * Packaged admin host for the action-ledger Logs page (packaged-admin RFC
55
+ * Phase 3). The page keeps its filter/cursor state locally (no URL search
56
+ * contract); booking targets link through the `"booking.detail"` semantic
57
+ * destination (RFC §4.7). Data flows through the shared provider context —
58
+ * no app RPC client.
59
+ */
60
+ export function ActionLedgerHost() {
61
+ const { resolvedLocale } = useLocale();
62
+ const t = useAdminMessages().actionLedgerPage;
63
+ const client = useVoyantActionLedgerContext();
64
+ const [filters, setFilters] = React.useState(EMPTY_FILTERS);
65
+ const [sortDir, setSortDir] = React.useState("desc");
66
+ const [cursorStack, setCursorStack] = React.useState([null]);
67
+ const [filterPopoverOpen, setFilterPopoverOpen] = React.useState(false);
68
+ const [selectedEntryId, setSelectedEntryId] = React.useState(null);
69
+ const currentCursor = cursorStack[cursorStack.length - 1] ?? null;
70
+ const filterCacheKey = React.useMemo(() => getFilterCacheKey(filters, sortDir), [filters, sortDir]);
71
+ const ledgerQuery = useQuery({
72
+ queryKey: actionLedgerQueryKeys.entries(`${filterCacheKey}|cursor=${cursorKey(currentCursor)}`),
73
+ queryFn: () => {
74
+ const search = buildFilterSearchParams(filters, sortDir);
75
+ search.set("limit", String(PAGE_SIZE));
76
+ if (currentCursor) {
77
+ search.set("cursorOccurredAt", currentCursor.occurredAt);
78
+ search.set("cursorId", currentCursor.id);
79
+ }
80
+ return getActionLedgerEntries(client, search);
81
+ },
82
+ placeholderData: keepPreviousData,
83
+ });
84
+ const entries = ledgerQuery.data?.data ?? [];
85
+ const nextCursor = ledgerQuery.data?.pageInfo.nextCursor ?? null;
86
+ const page = cursorStack.length;
87
+ const hasPrev = cursorStack.length > 1;
88
+ const hasNext = nextCursor !== null;
89
+ const showSkeleton = ledgerQuery.isLoading;
90
+ const activeFilterCount = React.useMemo(() => countActiveFilters(filters), [filters]);
91
+ const hasActiveSearch = filters.actionName !== "";
92
+ const hasActiveFilters = activeFilterCount > 0 || hasActiveSearch;
93
+ const resetPagination = React.useCallback(() => setCursorStack([null]), []);
94
+ const updateFilter = React.useCallback((key, value) => {
95
+ setFilters((current) => ({ ...current, [key]: value }));
96
+ resetPagination();
97
+ }, [resetPagination]);
98
+ const clearFilters = () => {
99
+ setFilters(EMPTY_FILTERS);
100
+ resetPagination();
101
+ };
102
+ const handleSortWhen = () => {
103
+ setSortDir((prev) => (prev === "desc" ? "asc" : "desc"));
104
+ resetPagination();
105
+ };
106
+ const goNext = () => {
107
+ if (!nextCursor)
108
+ return;
109
+ setCursorStack((stack) => [...stack, nextCursor]);
110
+ };
111
+ const goPrev = () => {
112
+ if (cursorStack.length <= 1)
113
+ return;
114
+ setCursorStack((stack) => stack.slice(0, -1));
115
+ };
116
+ return (_jsxs("div", { className: "flex flex-col gap-6 p-6", children: [_jsx("div", { className: "flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between", children: _jsxs("div", { children: [_jsx("h1", { className: "font-semibold text-2xl tracking-tight", children: t.title }), _jsx("p", { className: "mt-1 text-muted-foreground text-sm", children: t.description })] }) }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs("div", { className: "relative min-w-[14rem] flex-1", children: [_jsx(Label, { htmlFor: "logs-search", className: "sr-only", children: t.searchAria }), _jsx(Search, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { id: "logs-search", placeholder: t.searchPlaceholder, value: filters.actionName, onChange: (event) => updateFilter("actionName", event.target.value), className: "pl-9" })] }), _jsx(ActionLedgerFiltersPopover, { open: filterPopoverOpen, onOpenChange: setFilterPopoverOpen, activeFilterCount: activeFilterCount, principalType: filters.principalType, onPrincipalTypeChange: (value) => {
117
+ setFilters((current) => ({ ...current, principalType: value, principalId: "" }));
118
+ resetPagination();
119
+ }, principalId: filters.principalId, onPrincipalIdChange: (value) => updateFilter("principalId", value), targetType: filters.targetType, onTargetTypeChange: (value) => {
120
+ setFilters((current) => ({ ...current, targetType: value, targetId: "" }));
121
+ resetPagination();
122
+ }, targetId: filters.targetId, onTargetIdChange: (value) => updateFilter("targetId", value), workflowRunId: filters.workflowRunId, onWorkflowRunIdChange: (value) => updateFilter("workflowRunId", value), correlationId: filters.correlationId, onCorrelationIdChange: (value) => updateFilter("correlationId", value), evaluatedRisk: filters.evaluatedRisk, onEvaluatedRiskChange: (value) => updateFilter("evaluatedRisk", value), status: filters.status, onStatusChange: (value) => updateFilter("status", value) }), hasActiveFilters ? (_jsxs(Button, { variant: "ghost", size: "sm", onClick: clearFilters, children: [_jsx(X, { className: "mr-1 size-4" }), t.clear] })) : null] }), _jsx("div", { className: "rounded-md border", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: _jsx(SortHeader, { label: t.table.headerWhen, sortDir: sortDir, onSort: handleSortWhen }) }), _jsx(TableHead, { children: t.table.headerAction }), _jsx(TableHead, { children: t.table.headerActor }), _jsx(TableHead, { children: t.table.headerTarget }), _jsx(TableHead, { children: t.table.headerWorkflow }), _jsx(TableHead, { children: t.table.headerRisk }), _jsx(TableHead, { children: t.table.headerStatus }), _jsx(TableHead, { className: "w-12" })] }) }), _jsx(TableBody, { children: showSkeleton ? (_jsx(LedgerTableSkeleton, { rows: SKELETON_ROW_COUNT })) : ledgerQuery.isError ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: TABLE_COLUMN_COUNT, className: "h-24 text-center text-destructive text-sm", children: t.table.loadFailed }) })) : entries.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: TABLE_COLUMN_COUNT, className: "h-24 text-center text-muted-foreground text-sm", children: t.table.empty }) })) : (entries.map((entry) => (_jsx(LedgerRow, { entry: entry, locale: resolvedLocale, onSelect: setSelectedEntryId, viewAriaTemplate: t.viewEntryAria }, entry.id)))) })] }) }), _jsxs("div", { className: "flex items-center justify-between text-muted-foreground text-sm", children: [_jsx("span", { children: entries.length === 0
123
+ ? t.footer.empty
124
+ : entries.length === 1
125
+ ? t.footer.showingOne
126
+ : formatMessage(t.footer.showingMany, { count: entries.length }) }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", disabled: !hasPrev || ledgerQuery.isFetching, onClick: goPrev, children: t.footer.previous }), _jsx("span", { children: formatMessage(t.footer.pageLabel, { page }) }), _jsx(Button, { variant: "outline", size: "sm", disabled: !hasNext || ledgerQuery.isFetching, onClick: goNext, children: t.footer.next })] })] })] }), _jsx(ActionLedgerEntrySheet, { open: Boolean(selectedEntryId), onOpenChange: (open) => {
127
+ if (!open)
128
+ setSelectedEntryId(null);
129
+ }, entryId: selectedEntryId, locale: resolvedLocale })] }));
130
+ }
131
+ function SortHeader({ label, sortDir, onSort }) {
132
+ const Icon = sortDir === "asc" ? ArrowUp : sortDir === "desc" ? ArrowDown : ArrowUpDown;
133
+ return (_jsxs("button", { type: "button", onClick: onSort, className: "-ml-2 inline-flex h-8 items-center gap-1 rounded-sm px-2 hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx("span", { children: label }), _jsx(Icon, { className: "size-3.5 text-foreground", "aria-hidden": true })] }));
134
+ }
135
+ function LedgerTableSkeleton({ rows }) {
136
+ return (_jsx(_Fragment, { children: Array.from({ length: rows }).map((_, idx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-28" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-40" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-28" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-32" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-4 w-24" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-5 w-16 rounded-full" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-5 w-20 rounded-full" }) }), _jsx(TableCell, { children: _jsx(Skeleton, { className: "h-8 w-8 rounded-md" }) })] }, `logs-skeleton-${idx}`))) }));
137
+ }
138
+ function LedgerRow({ entry, locale, onSelect, viewAriaTemplate, }) {
139
+ const resolveHref = useAdminHref();
140
+ const navigateTo = useAdminNavigate();
141
+ return (_jsxs(TableRow, { className: "cursor-pointer", onClick: () => onSelect(entry.id), children: [_jsx(TableCell, { className: "whitespace-nowrap text-muted-foreground text-xs", children: formatDateTime(entry.occurredAt, locale) }), _jsxs(TableCell, { children: [_jsx("div", { className: "font-medium", children: formatActionName(entry.actionName) }), _jsx("div", { className: "mt-0.5 max-w-[16rem] truncate text-muted-foreground text-xs", children: entry.routeOrToolName ?? entry.id })] }), _jsxs(TableCell, { children: [_jsx("div", { className: "font-medium", children: entry.principalType }), _jsx("div", { className: "mt-0.5 max-w-[13rem] truncate font-mono text-muted-foreground text-xs", children: entry.principalId })] }), _jsxs(TableCell, { children: [_jsx("div", { className: "font-medium", children: formatTargetType(entry.targetType) }), _jsx("div", { className: "mt-0.5 max-w-[14rem] truncate font-mono text-muted-foreground text-xs", children: entry.targetType === "booking" ? (_jsxs("a", { href: resolveHref("booking.detail", { bookingId: entry.targetId }), onClick: (event) => {
142
+ event.preventDefault();
143
+ event.stopPropagation();
144
+ navigateTo("booking.detail", { bookingId: entry.targetId });
145
+ }, className: "inline-flex items-center text-primary underline-offset-4 hover:underline", children: [entry.targetId, _jsx(ExternalLink, { className: "ml-1 h-3 w-3" })] })) : (entry.targetId) })] }), _jsx(TableCell, { children: _jsx("div", { className: "max-w-[12rem] truncate font-mono text-muted-foreground text-xs", children: entry.workflowRunId ?? entry.correlationId ?? "-" }) }), _jsx(TableCell, { children: _jsx(Badge, { variant: RISK_VARIANT[entry.evaluatedRisk] ?? "outline", children: entry.evaluatedRisk }) }), _jsx(TableCell, { children: _jsx(Badge, { variant: STATUS_VARIANT[entry.status] ?? "outline", children: entry.status }) }), _jsx(TableCell, { className: "text-right", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", className: "h-8 w-8", "aria-label": formatMessage(viewAriaTemplate, { id: entry.id }), onClick: (event) => {
146
+ event.stopPropagation();
147
+ onSelect(entry.id);
148
+ }, children: _jsx(Eye, { className: "h-4 w-4" }) }) })] }));
149
+ }
150
+ function getFilterCacheKey(filters, sortDir) {
151
+ return buildFilterSearchParams(filters, sortDir).toString();
152
+ }
153
+ function buildFilterSearchParams(filters, sortDir) {
154
+ const search = new URLSearchParams({ sortDir });
155
+ for (const [key, value] of Object.entries(filters)) {
156
+ const trimmed = typeof value === "string" ? value.trim() : "";
157
+ if (!trimmed || trimmed === PRINCIPAL_TYPE_ALL || trimmed === TARGET_TYPE_ALL)
158
+ continue;
159
+ if (trimmed === RISK_ALL || trimmed === STATUS_ALL)
160
+ continue;
161
+ search.set(key, trimmed);
162
+ }
163
+ return search;
164
+ }
165
+ function cursorKey(cursor) {
166
+ if (!cursor)
167
+ return "first";
168
+ return `${cursor.occurredAt}:${cursor.id}`;
169
+ }
170
+ function countActiveFilters(filters) {
171
+ let count = 0;
172
+ if (filters.principalType !== PRINCIPAL_TYPE_ALL)
173
+ count += 1;
174
+ if (filters.principalId.trim())
175
+ count += 1;
176
+ if (filters.targetType !== TARGET_TYPE_ALL)
177
+ count += 1;
178
+ if (filters.targetId.trim())
179
+ count += 1;
180
+ if (filters.workflowRunId.trim())
181
+ count += 1;
182
+ if (filters.correlationId.trim())
183
+ count += 1;
184
+ if (filters.evaluatedRisk !== RISK_ALL)
185
+ count += 1;
186
+ if (filters.status !== STATUS_ALL)
187
+ count += 1;
188
+ return count;
189
+ }
190
+ function formatDateTime(value, locale) {
191
+ return new Intl.DateTimeFormat(locale, {
192
+ dateStyle: "medium",
193
+ timeStyle: "short",
194
+ }).format(new Date(value));
195
+ }
196
+ function formatActionName(value) {
197
+ return value.replaceAll(".", " / ").replaceAll("_", " ");
198
+ }
199
+ function formatTargetType(value) {
200
+ return value.replaceAll("_", " ");
201
+ }
@@ -0,0 +1,50 @@
1
+ import type { ActionLedgerGetResponse, ActionLedgerListResponse } from "@voyant-travel/action-ledger";
2
+ import type { VoyantActionLedgerContextValue } from "../provider.js";
3
+ /**
4
+ * REST transport for the packaged action-ledger admin surfaces. The module
5
+ * exposes plain admin REST reads, so the pages send requests through the
6
+ * shared provider context (`baseUrl` + `fetcher`) — no app RPC client.
7
+ */
8
+ export type ActionLedgerAdminClient = VoyantActionLedgerContextValue;
9
+ export declare class ActionLedgerApiError extends Error {
10
+ readonly status: number;
11
+ readonly body: unknown;
12
+ constructor(message: string, status: number, body: unknown);
13
+ }
14
+ export declare function getActionLedgerEntries(client: ActionLedgerAdminClient, search: URLSearchParams): Promise<ActionLedgerListResponse>;
15
+ /** Page size shared by the Logs page and the contribution's loader. */
16
+ export declare const ACTION_LEDGER_PAGE_SIZE = 25;
17
+ /**
18
+ * Query options for the first (unfiltered, newest-first) Logs page — the
19
+ * contribution's loader seeds this entry, and the page's initial state
20
+ * (empty filters, `desc` sort, first cursor) derives the identical key, so
21
+ * the SSR-seeded cache lines up with the page's first `useQuery`.
22
+ */
23
+ export declare function actionLedgerFirstPageQueryOptions(client: ActionLedgerAdminClient): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<ActionLedgerListResponse, Error, ActionLedgerListResponse, readonly ["actionLedger", "entries", {
24
+ readonly filtersKey: string | undefined;
25
+ }]>, "queryFn"> & {
26
+ queryFn?: import("@tanstack/react-query").QueryFunction<ActionLedgerListResponse, readonly ["actionLedger", "entries", {
27
+ readonly filtersKey: string | undefined;
28
+ }], never> | undefined;
29
+ } & {
30
+ queryKey: readonly ["actionLedger", "entries", {
31
+ readonly filtersKey: string | undefined;
32
+ }] & {
33
+ [dataTagSymbol]: ActionLedgerListResponse;
34
+ [dataTagErrorSymbol]: Error;
35
+ };
36
+ };
37
+ export declare function getActionLedgerEntry(client: ActionLedgerAdminClient, id: string): Promise<ActionLedgerGetResponse>;
38
+ /** Summary row of the starter-level workflow-runs admin surface — the
39
+ * filters popover lets operators scope the ledger to one run. */
40
+ export interface WorkflowRunSummary {
41
+ id: string;
42
+ workflowName: string;
43
+ status: string;
44
+ startedAt: string;
45
+ }
46
+ export interface WorkflowRunsListResponse {
47
+ data: WorkflowRunSummary[];
48
+ }
49
+ export declare function listWorkflowRuns(client: ActionLedgerAdminClient, limit?: number): Promise<WorkflowRunsListResponse>;
50
+ //# sourceMappingURL=admin-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-api.d.ts","sourceRoot":"","sources":["../../src/admin/admin-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,8BAA8B,CAAA;AAErC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAA;AAGpE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,8BAA8B,CAAA;AAEpE,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;gBAEV,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAM3D;AAaD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,wBAAwB,CAAC,CAEnC;AAED,uEAAuE;AACvE,eAAO,MAAM,uBAAuB,KAAK,CAAA;AAEzC;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,uBAAuB;;;;;;;;;;;;;EAQhF;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,uBAAuB,EAC/B,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,uBAAuB,CAAC,CAElC;AAED;iEACiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,kBAAkB,EAAE,CAAA;CAC3B;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,uBAAuB,EAC/B,KAAK,SAAK,GACT,OAAO,CAAC,wBAAwB,CAAC,CAEnC"}
@@ -0,0 +1,71 @@
1
+ import { queryOptions } from "@tanstack/react-query";
2
+ import { actionLedgerQueryKeys } from "./query-keys.js";
3
+ export class ActionLedgerApiError extends Error {
4
+ status;
5
+ body;
6
+ constructor(message, status, body) {
7
+ super(message);
8
+ this.name = "ActionLedgerApiError";
9
+ this.status = status;
10
+ this.body = body;
11
+ }
12
+ }
13
+ async function getJson(client, path) {
14
+ const response = await client.fetcher(joinUrl(client.baseUrl, path), {
15
+ headers: { Accept: "application/json" },
16
+ });
17
+ const body = await safeJson(response);
18
+ if (!response.ok) {
19
+ throw new ActionLedgerApiError(errorMessage(response, body), response.status, body);
20
+ }
21
+ return body;
22
+ }
23
+ export function getActionLedgerEntries(client, search) {
24
+ return getJson(client, `/v1/admin/action-ledger/entries?${search}`);
25
+ }
26
+ /** Page size shared by the Logs page and the contribution's loader. */
27
+ export const ACTION_LEDGER_PAGE_SIZE = 25;
28
+ /**
29
+ * Query options for the first (unfiltered, newest-first) Logs page — the
30
+ * contribution's loader seeds this entry, and the page's initial state
31
+ * (empty filters, `desc` sort, first cursor) derives the identical key, so
32
+ * the SSR-seeded cache lines up with the page's first `useQuery`.
33
+ */
34
+ export function actionLedgerFirstPageQueryOptions(client) {
35
+ const search = new URLSearchParams({ sortDir: "desc" });
36
+ const queryKey = actionLedgerQueryKeys.entries(`${search.toString()}|cursor=first`);
37
+ search.set("limit", String(ACTION_LEDGER_PAGE_SIZE));
38
+ return queryOptions({
39
+ queryKey,
40
+ queryFn: () => getActionLedgerEntries(client, search),
41
+ });
42
+ }
43
+ export function getActionLedgerEntry(client, id) {
44
+ return getJson(client, `/v1/admin/action-ledger/entries/${id}`);
45
+ }
46
+ export function listWorkflowRuns(client, limit = 50) {
47
+ return getJson(client, `/v1/admin/workflow-runs?limit=${limit}`);
48
+ }
49
+ function joinUrl(baseUrl, path) {
50
+ const trimmed = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
51
+ return `${trimmed}${path.startsWith("/") ? path : `/${path}`}`;
52
+ }
53
+ async function safeJson(response) {
54
+ try {
55
+ return await response.json();
56
+ }
57
+ catch {
58
+ return undefined;
59
+ }
60
+ }
61
+ function errorMessage(response, body) {
62
+ if (typeof body === "object" && body !== null && "error" in body) {
63
+ const error = body.error;
64
+ if (typeof error === "string")
65
+ return error;
66
+ if (typeof error === "object" && error !== null && "message" in error) {
67
+ return String(error.message);
68
+ }
69
+ }
70
+ return `Request failed: ${response.status} ${response.statusText}`;
71
+ }
@@ -0,0 +1,42 @@
1
+ import { type AdminExtension, type NavItem } from "@voyant-travel/admin";
2
+ /**
3
+ * No destinations declared: nothing navigates TO the Logs page by semantic
4
+ * key (the nav entry below carries the URL), and the page's own outbound
5
+ * link (`booking.detail`) comes from the bookings-react augmentation bound
6
+ * in the host module.
7
+ */
8
+ export type { ActionLedgerAdminClient, WorkflowRunSummary, WorkflowRunsListResponse, } from "./admin-api.js";
9
+ export { actionLedgerQueryKeys } from "./query-keys.js";
10
+ export interface CreateActionLedgerAdminExtensionOptions {
11
+ /** Mount path of the Logs page inside the admin workspace. Default `/action-ledger`. */
12
+ path?: string;
13
+ /** Localized nav/page labels. Defaults are the English operator nav labels. */
14
+ labels?: {
15
+ actionLedger?: string;
16
+ };
17
+ /** Nav icon — icon choice stays with the host (e.g. lucide `ScrollText`). */
18
+ icon?: NavItem["icon"];
19
+ /** Nav ordering past the host's base items. Default 60. */
20
+ order?: number;
21
+ }
22
+ /**
23
+ * The action-ledger admin contribution (packaged-admin RFC Phase 3,
24
+ * `@voyant-travel/<domain>-react/admin` convention).
25
+ *
26
+ * NAVIGATION: package-delivered. The Logs item is NOT part of the BASE
27
+ * operator navigation (`createOperatorAdminNavigation` in
28
+ * `@voyant-travel/admin`), so the extension contributes it — order 60 nudges it
29
+ * past the default admin items so it lands with the operator's audit
30
+ * tooling. The icon stays a host choice.
31
+ *
32
+ * ROUTES: the contribution carries the FULL route implementation
33
+ * (packaged-admin RFC §4.2/§4.8) — a lazy `page` module loader resolving
34
+ * the packaged `ActionLedgerHost`, plus a loader that seeds the first
35
+ * (unfiltered, newest-first) Logs page through the host-supplied runtime.
36
+ * Filters and cursor paging stay component-local, so there is no URL
37
+ * search contract.
38
+ *
39
+ * WIDGETS: none contributed and no slots exposed yet.
40
+ */
41
+ export declare function createActionLedgerAdminExtension(options?: CreateActionLedgerAdminExtensionOptions): AdminExtension;
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAKnB,KAAK,OAAO,EACb,MAAM,sBAAsB,CAAA;AAM7B;;;;;GAKG;AAWH,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAEvD,MAAM,WAAW,uCAAuC;IACtD,wFAAwF;IACxF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,+EAA+E;IAC/E,MAAM,CAAC,EAAE;QACP,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,6EAA6E;IAC7E,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACtB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,GAAE,uCAA4C,GACpD,cAAc,CAkChB"}
@@ -0,0 +1,62 @@
1
+ import { adminRoutePageModule, defineAdminExtension, } from "@voyant-travel/admin";
2
+ // Lean static only: the shared fetcher fallback. The page-data helpers
3
+ // resolve via dynamic import inside the loader so the admin REST module
4
+ // stays out of the workspace-chrome chunk that evaluates this factory.
5
+ import { defaultFetcher } from "@voyant-travel/react";
6
+ export { actionLedgerQueryKeys } from "./query-keys.js";
7
+ /**
8
+ * The action-ledger admin contribution (packaged-admin RFC Phase 3,
9
+ * `@voyant-travel/<domain>-react/admin` convention).
10
+ *
11
+ * NAVIGATION: package-delivered. The Logs item is NOT part of the BASE
12
+ * operator navigation (`createOperatorAdminNavigation` in
13
+ * `@voyant-travel/admin`), so the extension contributes it — order 60 nudges it
14
+ * past the default admin items so it lands with the operator's audit
15
+ * tooling. The icon stays a host choice.
16
+ *
17
+ * ROUTES: the contribution carries the FULL route implementation
18
+ * (packaged-admin RFC §4.2/§4.8) — a lazy `page` module loader resolving
19
+ * the packaged `ActionLedgerHost`, plus a loader that seeds the first
20
+ * (unfiltered, newest-first) Logs page through the host-supplied runtime.
21
+ * Filters and cursor paging stay component-local, so there is no URL
22
+ * search contract.
23
+ *
24
+ * WIDGETS: none contributed and no slots exposed yet.
25
+ */
26
+ export function createActionLedgerAdminExtension(options = {}) {
27
+ const { path = "/action-ledger", labels = {}, icon, order = 60 } = options;
28
+ const { actionLedger = "Logs" } = labels;
29
+ return defineAdminExtension({
30
+ id: "action-ledger",
31
+ navigation: [
32
+ {
33
+ order,
34
+ items: [{ id: "action-ledger", title: actionLedger, url: path, icon }],
35
+ },
36
+ ],
37
+ routes: [
38
+ {
39
+ id: "action-ledger-index",
40
+ path,
41
+ title: actionLedger,
42
+ ssr: "data-only",
43
+ page: () => import("./action-ledger-host.js").then((module) => adminRoutePageModule(module.ActionLedgerHost)),
44
+ // Dynamic import on purpose: the helper pulls the admin REST
45
+ // module, and a static import here would pin it into the
46
+ // workspace-chrome chunk that evaluates this factory.
47
+ loader: async ({ queryClient, runtime }) => {
48
+ const { actionLedgerFirstPageQueryOptions } = await import("./admin-api.js");
49
+ return queryClient.ensureQueryData(actionLedgerFirstPageQueryOptions(loaderClient(runtime)));
50
+ },
51
+ },
52
+ ],
53
+ });
54
+ }
55
+ /**
56
+ * Bridge the host-supplied {@link AdminRouteRuntime} (optional fetcher) to
57
+ * the required-fetcher client contract the admin REST module takes — SSR
58
+ * loaders run with the host runtime's cookie-forwarding fetcher.
59
+ */
60
+ function loaderClient(runtime) {
61
+ return { baseUrl: runtime.baseUrl, fetcher: runtime.fetcher ?? defaultFetcher };
62
+ }
@@ -0,0 +1,9 @@
1
+ /** Stable TanStack Query keys for the packaged action-ledger admin pages. */
2
+ export declare const actionLedgerQueryKeys: {
3
+ all: readonly ["actionLedger"];
4
+ entries: (filtersKey?: string) => readonly ["actionLedger", "entries", {
5
+ readonly filtersKey: string | undefined;
6
+ }];
7
+ entry: (id: string) => readonly ["actionLedger", "entry", string];
8
+ };
9
+ //# sourceMappingURL=query-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-keys.d.ts","sourceRoot":"","sources":["../../src/admin/query-keys.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB;;2BAET,MAAM;;;gBAEjB,MAAM;CACnB,CAAA"}
@@ -0,0 +1,6 @@
1
+ /** Stable TanStack Query keys for the packaged action-ledger admin pages. */
2
+ export const actionLedgerQueryKeys = {
3
+ all: ["actionLedger"],
4
+ entries: (filtersKey) => [...actionLedgerQueryKeys.all, "entries", { filtersKey }],
5
+ entry: (id) => [...actionLedgerQueryKeys.all, "entry", id],
6
+ };
@@ -0,0 +1,2 @@
1
+ export { useVoyantActionLedgerContext, type VoyantActionLedgerContextValue, VoyantActionLedgerProvider, type VoyantActionLedgerProviderProps, } from "./provider.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,KAAK,8BAA8B,EACnC,0BAA0B,EAC1B,KAAK,+BAA+B,GACrC,MAAM,eAAe,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { useVoyantActionLedgerContext, VoyantActionLedgerProvider, } from "./provider.js";
@@ -0,0 +1,2 @@
1
+ export { useVoyantReactContext as useVoyantActionLedgerContext, type VoyantReactContextValue as VoyantActionLedgerContextValue, VoyantReactProvider as VoyantActionLedgerProvider, type VoyantReactProviderProps as VoyantActionLedgerProviderProps, } from "@voyant-travel/react";
2
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,4BAA4B,EACrD,KAAK,uBAAuB,IAAI,8BAA8B,EAC9D,mBAAmB,IAAI,0BAA0B,EACjD,KAAK,wBAAwB,IAAI,+BAA+B,GACjE,MAAM,sBAAsB,CAAA"}
@@ -0,0 +1 @@
1
+ export { useVoyantReactContext as useVoyantActionLedgerContext, VoyantReactProvider as VoyantActionLedgerProvider, } from "@voyant-travel/react";
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "@voyant-travel/action-ledger-react",
3
+ "version": "0.6.0",
4
+ "license": "Apache-2.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/voyant-travel/voyant.git",
8
+ "directory": "packages/action-ledger-react"
9
+ },
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "./provider": {
19
+ "types": "./dist/provider.d.ts",
20
+ "import": "./dist/provider.js",
21
+ "default": "./dist/provider.js"
22
+ },
23
+ "./admin": {
24
+ "types": "./dist/admin/index.d.ts",
25
+ "import": "./dist/admin/index.js",
26
+ "default": "./dist/admin/index.js"
27
+ }
28
+ },
29
+ "peerDependencies": {
30
+ "@tanstack/react-query": "^5.0.0",
31
+ "lucide-react": "^0.475.0",
32
+ "react": "^19.0.0",
33
+ "react-dom": "^19.0.0",
34
+ "@voyant-travel/action-ledger": "^0.104.10",
35
+ "@voyant-travel/relationships-react": "^0.119.2",
36
+ "@voyant-travel/admin": "^0.111.0",
37
+ "@voyant-travel/bookings-react": "^0.119.3",
38
+ "@voyant-travel/inventory-react": "^0.1.0",
39
+ "@voyant-travel/ui": "^0.106.1"
40
+ },
41
+ "peerDependenciesMeta": {
42
+ "@voyant-travel/admin": {
43
+ "optional": true
44
+ },
45
+ "@voyant-travel/bookings-react": {
46
+ "optional": true
47
+ },
48
+ "@voyant-travel/relationships-react": {
49
+ "optional": true
50
+ },
51
+ "@voyant-travel/inventory-react": {
52
+ "optional": true
53
+ },
54
+ "@voyant-travel/ui": {
55
+ "optional": true
56
+ }
57
+ },
58
+ "dependencies": {
59
+ "@voyant-travel/i18n": "^0.106.1",
60
+ "@voyant-travel/react": "^0.104.1"
61
+ },
62
+ "devDependencies": {
63
+ "@tanstack/react-query": "^5.100.11",
64
+ "@types/react": "^19.2.14",
65
+ "@types/react-dom": "^19.2.3",
66
+ "lucide-react": "^0.475.0",
67
+ "react": "^19.2.4",
68
+ "react-dom": "^19.2.4",
69
+ "typescript": "^6.0.2",
70
+ "vitest": "^4.1.2",
71
+ "@voyant-travel/action-ledger": "^0.104.10",
72
+ "@voyant-travel/bookings-react": "^0.119.3",
73
+ "@voyant-travel/relationships-react": "^0.119.2",
74
+ "@voyant-travel/i18n": "^0.106.1",
75
+ "@voyant-travel/react": "^0.104.1",
76
+ "@voyant-travel/ui": "^0.106.1",
77
+ "@voyant-travel/admin": "^0.111.0",
78
+ "@voyant-travel/inventory-react": "^0.1.0",
79
+ "@voyant-travel/voyant-typescript-config": "^0.1.0"
80
+ },
81
+ "files": [
82
+ "dist"
83
+ ],
84
+ "publishConfig": {
85
+ "access": "public"
86
+ },
87
+ "scripts": {
88
+ "build": "tsc -p tsconfig.build.json",
89
+ "clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo",
90
+ "typecheck": "tsc --noEmit",
91
+ "lint": "biome check src/ tests/",
92
+ "test": "vitest run --passWithNoTests"
93
+ },
94
+ "main": "./dist/index.js",
95
+ "types": "./dist/index.d.ts"
96
+ }