@voyantjs/distribution-ui 0.30.7 → 0.31.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.
Files changed (53) hide show
  1. package/README.md +9 -1
  2. package/dist/components/booking-link-detail-page.d.ts +10 -0
  3. package/dist/components/booking-link-detail-page.d.ts.map +1 -0
  4. package/dist/components/booking-link-detail-page.js +51 -0
  5. package/dist/components/channel-detail-page.d.ts +12 -0
  6. package/dist/components/channel-detail-page.d.ts.map +1 -0
  7. package/dist/components/channel-detail-page.js +41 -0
  8. package/dist/components/channel-sync-page.d.ts +8 -0
  9. package/dist/components/channel-sync-page.d.ts.map +1 -0
  10. package/dist/components/channel-sync-page.js +242 -0
  11. package/dist/components/channels-page.d.ts +6 -0
  12. package/dist/components/channels-page.d.ts.map +1 -0
  13. package/dist/components/channels-page.js +132 -0
  14. package/dist/components/commission-rule-detail-page.d.ts +10 -0
  15. package/dist/components/commission-rule-detail-page.d.ts.map +1 -0
  16. package/dist/components/commission-rule-detail-page.js +57 -0
  17. package/dist/components/contract-detail-page.d.ts +10 -0
  18. package/dist/components/contract-detail-page.d.ts.map +1 -0
  19. package/dist/components/contract-detail-page.js +64 -0
  20. package/dist/components/distribution-page.d.ts +26 -0
  21. package/dist/components/distribution-page.d.ts.map +1 -0
  22. package/dist/components/distribution-page.js +190 -0
  23. package/dist/components/distribution-tabs-primary.d.ts +57 -0
  24. package/dist/components/distribution-tabs-primary.d.ts.map +1 -0
  25. package/dist/components/distribution-tabs-primary.js +89 -0
  26. package/dist/components/distribution-tabs-secondary.d.ts +58 -0
  27. package/dist/components/distribution-tabs-secondary.d.ts.map +1 -0
  28. package/dist/components/distribution-tabs-secondary.js +89 -0
  29. package/dist/components/mapping-detail-page.d.ts +10 -0
  30. package/dist/components/mapping-detail-page.d.ts.map +1 -0
  31. package/dist/components/mapping-detail-page.js +51 -0
  32. package/dist/components/webhook-event-detail-page.d.ts +9 -0
  33. package/dist/components/webhook-event-detail-page.d.ts.map +1 -0
  34. package/dist/components/webhook-event-detail-page.js +46 -0
  35. package/dist/i18n/en.d.ts +381 -0
  36. package/dist/i18n/en.d.ts.map +1 -1
  37. package/dist/i18n/en.js +363 -0
  38. package/dist/i18n/index.d.ts +1 -1
  39. package/dist/i18n/index.d.ts.map +1 -1
  40. package/dist/i18n/messages.d.ts +244 -0
  41. package/dist/i18n/messages.d.ts.map +1 -1
  42. package/dist/i18n/provider.d.ts +762 -0
  43. package/dist/i18n/provider.d.ts.map +1 -1
  44. package/dist/i18n/ro.d.ts +381 -0
  45. package/dist/i18n/ro.d.ts.map +1 -1
  46. package/dist/i18n/ro.js +363 -0
  47. package/dist/i18n/utils.d.ts +4 -0
  48. package/dist/i18n/utils.d.ts.map +1 -0
  49. package/dist/i18n/utils.js +8 -0
  50. package/dist/index.d.ts +12 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +11 -0
  53. package/package.json +7 -7
@@ -0,0 +1,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { formatMessage } from "@voyantjs/i18n";
3
+ import { ConfirmActionButton, SelectionActionBar } from "@voyantjs/ui/components";
4
+ import { DataTable } from "@voyantjs/ui/components/data-table";
5
+ import { TabsContent } from "@voyantjs/ui/components/tabs";
6
+ import { useDistributionUiI18nOrDefault } from "../i18n/index.js";
7
+ import { formatDistributionCount, formatDistributionSummary } from "../i18n/utils.js";
8
+ import { SectionHeader } from "./distribution-section-header.js";
9
+ import { bookingLinkColumns, mappingColumns, webhookColumns } from "./distribution-shared.js";
10
+ function getSelectionSummary(count, template) {
11
+ return formatDistributionSummary(template, { count });
12
+ }
13
+ export function DistributionMappingsTab(props) {
14
+ const i18n = useDistributionUiI18nOrDefault();
15
+ const { messages } = i18n;
16
+ const tab = messages.tabs.mappings;
17
+ return (_jsxs(TabsContent, { value: "mappings", className: "space-y-4", children: [_jsx(SectionHeader, { title: tab.title, description: tab.description, actionLabel: tab.actionLabel, onAction: props.onCreate }), _jsx(DataTable, { columns: mappingColumns(props.channels, props.products, props.onOpenRoute, i18n), data: props.filteredMappings, emptyMessage: tab.empty, enableRowSelection: true, getRowId: (row) => row.id, rowSelection: props.mappingSelection, onRowSelectionChange: props.setMappingSelection, renderSelectionActions: ({ selectedRows, clearSelection }) => {
18
+ const countLabel = formatDistributionCount(messages, "mapping", selectedRows.length);
19
+ return (_jsxs(SelectionActionBar, { selectedCount: selectedRows.length, onClear: clearSelection, selectionSummary: getSelectionSummary(selectedRows.length, messages.common.selectionSummary), clearLabel: messages.common.clearSelection, children: [_jsx(ConfirmActionButton, { buttonLabel: tab.actions.activate.button, confirmLabel: tab.actions.activate.confirm, cancelLabel: messages.common.cancel, title: formatMessage(tab.actions.activate.title, { countLabel }), description: tab.actions.activate.description, disabled: props.bulkActionTarget === "mappings-activate", onConfirm: () => props.handleBulkUpdate({
20
+ ids: selectedRows.map((row) => row.original.id),
21
+ endpoint: "/v1/distribution/product-mappings",
22
+ target: "mappings-activate",
23
+ noun: "mapping",
24
+ payload: { active: true },
25
+ successVerb: messages.page.bulkVerbs.activated,
26
+ clearSelection,
27
+ }) }), _jsx(ConfirmActionButton, { buttonLabel: tab.actions.deactivate.button, confirmLabel: tab.actions.deactivate.confirm, cancelLabel: messages.common.cancel, title: formatMessage(tab.actions.deactivate.title, { countLabel }), description: tab.actions.deactivate.description, disabled: props.bulkActionTarget === "mappings-deactivate", onConfirm: () => props.handleBulkUpdate({
28
+ ids: selectedRows.map((row) => row.original.id),
29
+ endpoint: "/v1/distribution/product-mappings",
30
+ target: "mappings-deactivate",
31
+ noun: "mapping",
32
+ payload: { active: false },
33
+ successVerb: messages.page.bulkVerbs.deactivated,
34
+ clearSelection,
35
+ }) }), _jsx(ConfirmActionButton, { buttonLabel: tab.actions.delete.button, confirmLabel: tab.actions.delete.confirm, cancelLabel: messages.common.cancel, title: formatMessage(tab.actions.delete.title, { countLabel }), description: tab.actions.delete.description, disabled: props.bulkActionTarget === "mappings-delete", variant: "destructive", confirmVariant: "destructive", onConfirm: () => props.handleBulkDelete({
36
+ ids: selectedRows.map((row) => row.original.id),
37
+ endpoint: "/v1/distribution/product-mappings",
38
+ target: "mappings-delete",
39
+ noun: "mapping",
40
+ clearSelection,
41
+ }) })] }));
42
+ }, onRowClick: (row) => props.onEdit(row.original) })] }));
43
+ }
44
+ export function DistributionBookingLinksTab(props) {
45
+ const i18n = useDistributionUiI18nOrDefault();
46
+ const { messages } = i18n;
47
+ const tab = messages.tabs.bookingLinks;
48
+ return (_jsxs(TabsContent, { value: "booking-links", className: "space-y-4", children: [_jsx(SectionHeader, { title: tab.title, description: tab.description, actionLabel: tab.actionLabel, onAction: props.onCreate }), _jsx(DataTable, { columns: bookingLinkColumns(props.channels, props.bookings, props.onOpenRoute, i18n), data: props.filteredBookingLinks, emptyMessage: tab.empty, enableRowSelection: true, getRowId: (row) => row.id, rowSelection: props.bookingLinkSelection, onRowSelectionChange: props.setBookingLinkSelection, renderSelectionActions: ({ selectedRows, clearSelection }) => {
49
+ const countLabel = formatDistributionCount(messages, "bookingLink", selectedRows.length);
50
+ return (_jsx(SelectionActionBar, { selectedCount: selectedRows.length, onClear: clearSelection, selectionSummary: getSelectionSummary(selectedRows.length, messages.common.selectionSummary), clearLabel: messages.common.clearSelection, children: _jsx(ConfirmActionButton, { buttonLabel: tab.actions.delete.button, confirmLabel: tab.actions.delete.confirm, cancelLabel: messages.common.cancel, title: formatMessage(tab.actions.delete.title, { countLabel }), description: tab.actions.delete.description, disabled: props.bulkActionTarget === "booking-links-delete", variant: "destructive", confirmVariant: "destructive", onConfirm: () => props.handleBulkDelete({
51
+ ids: selectedRows.map((row) => row.original.id),
52
+ endpoint: "/v1/distribution/booking-links",
53
+ target: "booking-links-delete",
54
+ noun: "bookingLink",
55
+ clearSelection,
56
+ }) }) }));
57
+ }, onRowClick: (row) => props.onEdit(row.original) })] }));
58
+ }
59
+ export function DistributionWebhooksTab(props) {
60
+ const i18n = useDistributionUiI18nOrDefault();
61
+ const { messages } = i18n;
62
+ const tab = messages.tabs.webhooks;
63
+ return (_jsxs(TabsContent, { value: "webhooks", className: "space-y-4", children: [_jsx(SectionHeader, { title: tab.title, description: tab.description, actionLabel: tab.actionLabel, onAction: props.onCreate }), _jsx(DataTable, { columns: webhookColumns(props.channels, props.onOpenRoute, i18n), data: props.filteredWebhookEvents, emptyMessage: tab.empty, enableRowSelection: true, getRowId: (row) => row.id, rowSelection: props.webhookSelection, onRowSelectionChange: props.setWebhookSelection, renderSelectionActions: ({ selectedRows, clearSelection }) => {
64
+ const countLabel = formatDistributionCount(messages, "webhookEvent", selectedRows.length);
65
+ return (_jsxs(SelectionActionBar, { selectedCount: selectedRows.length, onClear: clearSelection, selectionSummary: getSelectionSummary(selectedRows.length, messages.common.selectionSummary), clearLabel: messages.common.clearSelection, children: [_jsx(ConfirmActionButton, { buttonLabel: tab.actions.markProcessed.button, confirmLabel: tab.actions.markProcessed.confirm, cancelLabel: messages.common.cancel, title: formatMessage(tab.actions.markProcessed.title, { countLabel }), description: tab.actions.markProcessed.description, disabled: props.bulkActionTarget === "webhook-events-processed", onConfirm: () => props.handleBulkUpdate({
66
+ ids: selectedRows.map((row) => row.original.id),
67
+ endpoint: "/v1/distribution/webhook-events",
68
+ target: "webhook-events-processed",
69
+ noun: "webhookEvent",
70
+ payload: { status: "processed" },
71
+ successVerb: messages.page.bulkVerbs.processed,
72
+ clearSelection,
73
+ }) }), _jsx(ConfirmActionButton, { buttonLabel: tab.actions.ignore.button, confirmLabel: tab.actions.ignore.confirm, cancelLabel: messages.common.cancel, title: formatMessage(tab.actions.ignore.title, { countLabel }), description: tab.actions.ignore.description, disabled: props.bulkActionTarget === "webhook-events-ignored", onConfirm: () => props.handleBulkUpdate({
74
+ ids: selectedRows.map((row) => row.original.id),
75
+ endpoint: "/v1/distribution/webhook-events",
76
+ target: "webhook-events-ignored",
77
+ noun: "webhookEvent",
78
+ payload: { status: "ignored" },
79
+ successVerb: messages.page.bulkVerbs.ignored,
80
+ clearSelection,
81
+ }) }), _jsx(ConfirmActionButton, { buttonLabel: tab.actions.delete.button, confirmLabel: tab.actions.delete.confirm, cancelLabel: messages.common.cancel, title: formatMessage(tab.actions.delete.title, { countLabel }), description: tab.actions.delete.description, disabled: props.bulkActionTarget === "webhook-events-delete", variant: "destructive", confirmVariant: "destructive", onConfirm: () => props.handleBulkDelete({
82
+ ids: selectedRows.map((row) => row.original.id),
83
+ endpoint: "/v1/distribution/webhook-events",
84
+ target: "webhook-events-delete",
85
+ noun: "webhookEvent",
86
+ clearSelection,
87
+ }) })] }));
88
+ }, onRowClick: (row) => props.onEdit(row.original) })] }));
89
+ }
@@ -0,0 +1,10 @@
1
+ export interface MappingDetailPageProps {
2
+ id: string;
3
+ className?: string;
4
+ onBack?: () => void;
5
+ onDeleted?: () => void;
6
+ onChannelOpen?: (channelId: string) => void;
7
+ onProductOpen?: (productId: string) => void;
8
+ }
9
+ export declare function MappingDetailPage({ id, className, onBack, onDeleted, onChannelOpen, onProductOpen, }: MappingDetailPageProps): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=mapping-detail-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapping-detail-page.d.ts","sourceRoot":"","sources":["../../src/components/mapping-detail-page.tsx"],"names":[],"mappings":"AAyBA,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C;AAID,wBAAgB,iBAAiB,CAAC,EAChC,EAAE,EACF,SAAS,EACT,MAAa,EACb,SAAgB,EAChB,aAAoB,EACpB,aAAoB,GACrB,EAAE,sBAAsB,2CAoIxB"}
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
3
+ import { distributionQueryKeys, fetchWithValidation, getChannelQueryOptions, getMappingQueryOptions, getProductQueryOptions, successEnvelope, useVoyantDistributionContext, } from "@voyantjs/distribution-react";
4
+ import { Badge, Button, Card, CardContent, CardHeader, CardTitle, ConfirmActionButton, } from "@voyantjs/ui/components";
5
+ import { cn } from "@voyantjs/ui/lib/utils";
6
+ import { ArrowLeft, Link2, Loader2, Package } from "lucide-react";
7
+ import { useDistributionUiI18nOrDefault } from "../i18n/index.js";
8
+ import { formatDistributionDateTime } from "./distribution-shared.js";
9
+ const noop = () => { };
10
+ export function MappingDetailPage({ id, className, onBack = noop, onDeleted = noop, onChannelOpen = noop, onProductOpen = noop, }) {
11
+ const i18n = useDistributionUiI18nOrDefault();
12
+ const { messages } = i18n;
13
+ const detail = messages.details.mapping;
14
+ const client = useVoyantDistributionContext();
15
+ const queryClient = useQueryClient();
16
+ const mappingQuery = useQuery({
17
+ ...getMappingQueryOptions(client, id),
18
+ select: (result) => result.data,
19
+ });
20
+ const mapping = mappingQuery.data;
21
+ const channelQuery = useQuery({
22
+ ...getChannelQueryOptions(client, mapping?.channelId),
23
+ select: (result) => result.data,
24
+ enabled: Boolean(mapping?.channelId),
25
+ });
26
+ const productQuery = useQuery({
27
+ ...getProductQueryOptions(client, mapping?.productId),
28
+ select: (result) => result.data,
29
+ enabled: Boolean(mapping?.productId),
30
+ });
31
+ const remove = useMutation({
32
+ mutationFn: () => fetchWithValidation(`/v1/distribution/product-mappings/${id}`, successEnvelope, client, {
33
+ method: "DELETE",
34
+ }),
35
+ onSuccess: () => {
36
+ void queryClient.invalidateQueries({ queryKey: distributionQueryKeys.mappings() });
37
+ queryClient.removeQueries({ queryKey: distributionQueryKeys.mapping(id) });
38
+ onDeleted();
39
+ onBack();
40
+ },
41
+ });
42
+ if (mappingQuery.isPending) {
43
+ return (_jsx("div", { className: "flex items-center justify-center py-12", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }));
44
+ }
45
+ if (!mapping) {
46
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center gap-4 py-12", children: [_jsx("p", { className: "text-muted-foreground", children: detail.notFound }), _jsx(Button, { variant: "outline", onClick: onBack, children: messages.common.backToDistribution })] }));
47
+ }
48
+ return (_jsxs("div", { "data-slot": "mapping-detail-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx(Button, { variant: "ghost", size: "icon", onClick: onBack, children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsxs("div", { className: "flex-1", children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight", children: detail.title }), _jsxs("div", { className: "mt-1 flex items-center gap-2", children: [_jsx(Badge, { variant: mapping.active ? "default" : "secondary", children: mapping.active ? messages.common.active : messages.common.inactive }), _jsx(Badge, { variant: "outline", children: mapping.externalProductId })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Button, { variant: "outline", onClick: () => onChannelOpen(mapping.channelId), children: [_jsx(Link2, { className: "mr-2 h-4 w-4" }), detail.openChannel] }), _jsxs(Button, { variant: "outline", onClick: () => onProductOpen(mapping.productId), children: [_jsx(Package, { className: "mr-2 h-4 w-4" }), detail.openProduct] }), _jsx(ConfirmActionButton, { buttonLabel: detail.deleteButton, confirmLabel: detail.deleteButton, title: detail.deleteConfirm, description: detail.deleteDescription, variant: "destructive", confirmVariant: "destructive", disabled: remove.isPending, onConfirm: async () => {
49
+ await remove.mutateAsync();
50
+ } })] })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: detail.sections.details }) }), _jsxs(CardContent, { className: "grid gap-3 text-sm md:grid-cols-2", children: [_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.common.channelLabel, ":"] }), " ", _jsx("span", { children: channelQuery.data?.name ?? mapping.channelId })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.common.productLabel, ":"] }), " ", _jsx("span", { children: productQuery.data?.name ?? mapping.productId })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [detail.labels.externalProduct, ":"] }), " ", _jsx("span", { children: mapping.externalProductId })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [detail.labels.externalRate, ":"] }), " ", _jsx("span", { children: mapping.externalRateId ?? messages.common.none })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [detail.labels.externalCategory, ":"] }), " ", _jsx("span", { children: mapping.externalCategoryId ?? messages.common.none })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.common.createdLabel, ":"] }), " ", _jsx("span", { children: formatDistributionDateTime(mapping.createdAt, i18n) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.common.updatedLabel, ":"] }), " ", _jsx("span", { children: formatDistributionDateTime(mapping.updatedAt, i18n) })] })] })] })] }));
51
+ }
@@ -0,0 +1,9 @@
1
+ export interface WebhookEventDetailPageProps {
2
+ id: string;
3
+ className?: string;
4
+ onBack?: () => void;
5
+ onDeleted?: () => void;
6
+ onChannelOpen?: (channelId: string) => void;
7
+ }
8
+ export declare function WebhookEventDetailPage({ id, className, onBack, onDeleted, onChannelOpen, }: WebhookEventDetailPageProps): import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=webhook-event-detail-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-event-detail-page.d.ts","sourceRoot":"","sources":["../../src/components/webhook-event-detail-page.tsx"],"names":[],"mappings":"AAwBA,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C;AAID,wBAAgB,sBAAsB,CAAC,EACrC,EAAE,EACF,SAAS,EACT,MAAa,EACb,SAAgB,EAChB,aAAoB,GACrB,EAAE,2BAA2B,2CA0I7B"}
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
3
+ import { distributionQueryKeys, fetchWithValidation, getChannelQueryOptions, getWebhookEventQueryOptions, successEnvelope, useVoyantDistributionContext, } from "@voyantjs/distribution-react";
4
+ import { Badge, Button, Card, CardContent, CardHeader, CardTitle, ConfirmActionButton, } from "@voyantjs/ui/components";
5
+ import { cn } from "@voyantjs/ui/lib/utils";
6
+ import { ArrowLeft, Link2, Loader2, Webhook } from "lucide-react";
7
+ import { useDistributionUiI18nOrDefault } from "../i18n/index.js";
8
+ import { formatDistributionDateTime } from "./distribution-shared.js";
9
+ const noop = () => { };
10
+ export function WebhookEventDetailPage({ id, className, onBack = noop, onDeleted = noop, onChannelOpen = noop, }) {
11
+ const i18n = useDistributionUiI18nOrDefault();
12
+ const { messages } = i18n;
13
+ const detail = messages.details.webhookEvent;
14
+ const client = useVoyantDistributionContext();
15
+ const queryClient = useQueryClient();
16
+ const eventQuery = useQuery({
17
+ ...getWebhookEventQueryOptions(client, id),
18
+ select: (result) => result.data,
19
+ });
20
+ const event = eventQuery.data;
21
+ const channelQuery = useQuery({
22
+ ...getChannelQueryOptions(client, event?.channelId),
23
+ select: (result) => result.data,
24
+ enabled: Boolean(event?.channelId),
25
+ });
26
+ const remove = useMutation({
27
+ mutationFn: () => fetchWithValidation(`/v1/distribution/webhook-events/${id}`, successEnvelope, client, {
28
+ method: "DELETE",
29
+ }),
30
+ onSuccess: () => {
31
+ void queryClient.invalidateQueries({ queryKey: distributionQueryKeys.webhookEvents() });
32
+ queryClient.removeQueries({ queryKey: distributionQueryKeys.webhookEvent(id) });
33
+ onDeleted();
34
+ onBack();
35
+ },
36
+ });
37
+ if (eventQuery.isPending) {
38
+ return (_jsx("div", { className: "flex items-center justify-center py-12", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }));
39
+ }
40
+ if (!event) {
41
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center gap-4 py-12", children: [_jsx("p", { className: "text-muted-foreground", children: detail.notFound }), _jsx(Button, { variant: "outline", onClick: onBack, children: messages.common.backToDistribution })] }));
42
+ }
43
+ return (_jsxs("div", { "data-slot": "webhook-event-detail-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsxs("div", { className: "flex items-center gap-4", children: [_jsx(Button, { variant: "ghost", size: "icon", onClick: onBack, children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsxs("div", { className: "flex-1", children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight", children: detail.title }), _jsxs("div", { className: "mt-1 flex items-center gap-2", children: [_jsx(Badge, { variant: "outline", children: messages.common.webhookStatusLabels[event.status] }), _jsx(Badge, { variant: "secondary", children: event.eventType })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Button, { variant: "outline", onClick: () => onChannelOpen(event.channelId), children: [_jsx(Link2, { className: "mr-2 h-4 w-4" }), detail.openChannel] }), _jsx(ConfirmActionButton, { buttonLabel: detail.deleteButton, confirmLabel: detail.deleteButton, title: detail.deleteConfirm, description: detail.deleteDescription, variant: "destructive", confirmVariant: "destructive", disabled: remove.isPending, onConfirm: async () => {
44
+ await remove.mutateAsync();
45
+ } })] })] }), _jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center gap-2", children: [_jsx(Webhook, { className: "h-4 w-4" }), _jsx(CardTitle, { children: detail.sections.details })] }), _jsxs(CardContent, { className: "grid gap-3 text-sm", children: [_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.common.channelLabel, ":"] }), " ", _jsx("span", { children: channelQuery.data?.name ?? event.channelId })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [detail.labels.externalEvent, ":"] }), " ", _jsx("span", { children: event.externalEventId ?? messages.common.none })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [detail.labels.received, ":"] }), " ", _jsx("span", { children: formatDistributionDateTime(event.receivedAt, i18n) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [detail.labels.processed, ":"] }), " ", _jsx("span", { children: formatDistributionDateTime(event.processedAt, i18n) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.common.createdLabel, ":"] }), " ", _jsx("span", { children: formatDistributionDateTime(event.createdAt, i18n) })] }), _jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: [messages.common.updatedLabel, ":"] }), " ", _jsx("span", { children: formatDistributionDateTime(event.updatedAt, i18n) })] }), event.errorMessage ? (_jsxs("div", { children: [_jsx("div", { className: "mb-1 text-muted-foreground", children: detail.labels.error }), _jsx("div", { className: "whitespace-pre-wrap rounded-md border p-3", children: event.errorMessage })] })) : null] })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: detail.sections.payload }) }), _jsx(CardContent, { className: "text-sm", children: _jsx("pre", { className: "overflow-x-auto rounded-md bg-muted p-3 text-xs", children: JSON.stringify(event.payload, null, 2) }) })] })] })] }));
46
+ }
package/dist/i18n/en.d.ts CHANGED
@@ -2,15 +2,68 @@ export declare const distributionUiEn: {
2
2
  common: {
3
3
  open: string;
4
4
  view: string;
5
+ cancel: string;
6
+ create: string;
7
+ save: string;
8
+ delete: string;
5
9
  clearFilters: string;
10
+ clearSelection: string;
11
+ backToDistribution: string;
12
+ loading: string;
13
+ none: string;
14
+ openEnded: string;
15
+ noReference: string;
16
+ unmappedStatus: string;
17
+ yes: string;
6
18
  searchPlaceholder: string;
7
19
  allChannels: string;
8
20
  received: string;
9
21
  supplier: string;
22
+ channelLabel: string;
23
+ contractLabel: string;
24
+ productLabel: string;
25
+ bookingLabel: string;
26
+ supplierLabel: string;
27
+ createdLabel: string;
28
+ updatedLabel: string;
10
29
  emptyValue: string;
11
30
  dateTimeFallback: string;
12
31
  active: string;
13
32
  inactive: string;
33
+ selectionSummary: string;
34
+ resultSummary: string;
35
+ deleteSummary: string;
36
+ entities: {
37
+ channel: {
38
+ one: string;
39
+ other: string;
40
+ };
41
+ contract: {
42
+ one: string;
43
+ other: string;
44
+ };
45
+ commissionRule: {
46
+ one: string;
47
+ other: string;
48
+ };
49
+ mapping: {
50
+ one: string;
51
+ other: string;
52
+ };
53
+ bookingLink: {
54
+ one: string;
55
+ other: string;
56
+ };
57
+ webhookEvent: {
58
+ one: string;
59
+ other: string;
60
+ };
61
+ };
62
+ cancellationOwnerLabels: {
63
+ operator: string;
64
+ channel: string;
65
+ mixed: string;
66
+ };
14
67
  channelKindLabels: {
15
68
  direct: string;
16
69
  affiliate: string;
@@ -54,6 +107,27 @@ export declare const distributionUiEn: {
54
107
  ignored: string;
55
108
  };
56
109
  };
110
+ page: {
111
+ title: string;
112
+ description: string;
113
+ tabs: {
114
+ channels: string;
115
+ contracts: string;
116
+ commissions: string;
117
+ mappings: string;
118
+ bookingLinks: string;
119
+ webhooks: string;
120
+ };
121
+ bulkVerbs: {
122
+ activated: string;
123
+ archived: string;
124
+ deleted: string;
125
+ expired: string;
126
+ deactivated: string;
127
+ processed: string;
128
+ ignored: string;
129
+ };
130
+ };
57
131
  overview: {
58
132
  metrics: {
59
133
  activeChannels: {
@@ -127,5 +201,312 @@ export declare const distributionUiEn: {
127
201
  processed: string;
128
202
  };
129
203
  };
204
+ tabs: {
205
+ channels: {
206
+ title: string;
207
+ description: string;
208
+ actionLabel: string;
209
+ empty: string;
210
+ actions: {
211
+ activate: {
212
+ button: string;
213
+ confirm: string;
214
+ title: string;
215
+ description: string;
216
+ };
217
+ archive: {
218
+ button: string;
219
+ confirm: string;
220
+ title: string;
221
+ description: string;
222
+ };
223
+ delete: {
224
+ button: string;
225
+ confirm: string;
226
+ title: string;
227
+ description: string;
228
+ };
229
+ };
230
+ };
231
+ contracts: {
232
+ title: string;
233
+ description: string;
234
+ actionLabel: string;
235
+ empty: string;
236
+ actions: {
237
+ activate: {
238
+ button: string;
239
+ confirm: string;
240
+ title: string;
241
+ description: string;
242
+ };
243
+ expire: {
244
+ button: string;
245
+ confirm: string;
246
+ title: string;
247
+ description: string;
248
+ };
249
+ delete: {
250
+ button: string;
251
+ confirm: string;
252
+ title: string;
253
+ description: string;
254
+ };
255
+ };
256
+ };
257
+ commissions: {
258
+ title: string;
259
+ description: string;
260
+ actionLabel: string;
261
+ empty: string;
262
+ actions: {
263
+ delete: {
264
+ button: string;
265
+ confirm: string;
266
+ title: string;
267
+ description: string;
268
+ };
269
+ };
270
+ };
271
+ mappings: {
272
+ title: string;
273
+ description: string;
274
+ actionLabel: string;
275
+ empty: string;
276
+ actions: {
277
+ activate: {
278
+ button: string;
279
+ confirm: string;
280
+ title: string;
281
+ description: string;
282
+ };
283
+ deactivate: {
284
+ button: string;
285
+ confirm: string;
286
+ title: string;
287
+ description: string;
288
+ };
289
+ delete: {
290
+ button: string;
291
+ confirm: string;
292
+ title: string;
293
+ description: string;
294
+ };
295
+ };
296
+ };
297
+ bookingLinks: {
298
+ title: string;
299
+ description: string;
300
+ actionLabel: string;
301
+ empty: string;
302
+ actions: {
303
+ delete: {
304
+ button: string;
305
+ confirm: string;
306
+ title: string;
307
+ description: string;
308
+ };
309
+ };
310
+ };
311
+ webhooks: {
312
+ title: string;
313
+ description: string;
314
+ actionLabel: string;
315
+ empty: string;
316
+ actions: {
317
+ markProcessed: {
318
+ button: string;
319
+ confirm: string;
320
+ title: string;
321
+ description: string;
322
+ };
323
+ ignore: {
324
+ button: string;
325
+ confirm: string;
326
+ title: string;
327
+ description: string;
328
+ };
329
+ delete: {
330
+ button: string;
331
+ confirm: string;
332
+ title: string;
333
+ description: string;
334
+ };
335
+ };
336
+ };
337
+ };
338
+ settings: {
339
+ channelsPage: {
340
+ title: string;
341
+ description: string;
342
+ addChannel: string;
343
+ empty: string;
344
+ edit: string;
345
+ delete: string;
346
+ deleteConfirm: string;
347
+ deleteDescription: string;
348
+ editSheetTitle: string;
349
+ newSheetTitle: string;
350
+ nameLabel: string;
351
+ namePlaceholder: string;
352
+ kindLabel: string;
353
+ statusLabel: string;
354
+ websiteLabel: string;
355
+ websitePlaceholder: string;
356
+ primaryContactLabel: string;
357
+ primaryContactPlaceholder: string;
358
+ contactEmailLabel: string;
359
+ contactEmailPlaceholder: string;
360
+ saveChanges: string;
361
+ createChannel: string;
362
+ validationNameRequired: string;
363
+ validationInvalidUrl: string;
364
+ validationInvalidEmail: string;
365
+ paginationShowing: string;
366
+ paginationPage: string;
367
+ paginationPrevious: string;
368
+ paginationNext: string;
369
+ };
370
+ };
371
+ details: {
372
+ channel: {
373
+ notFound: string;
374
+ title: string;
375
+ deleteConfirm: string;
376
+ deleteDescription: string;
377
+ deleteButton: string;
378
+ sections: {
379
+ details: string;
380
+ metadata: string;
381
+ contracts: string;
382
+ mappings: string;
383
+ bookingLinks: string;
384
+ webhooks: string;
385
+ };
386
+ labels: {
387
+ website: string;
388
+ contactName: string;
389
+ contactEmail: string;
390
+ supplier: string;
391
+ payment: string;
392
+ cancellation: string;
393
+ externalProduct: string;
394
+ externalBooking: string;
395
+ reference: string;
396
+ lastSynced: string;
397
+ rate: string;
398
+ category: string;
399
+ booking: string;
400
+ };
401
+ empty: {
402
+ metadata: string;
403
+ contracts: string;
404
+ mappings: string;
405
+ bookingLinks: string;
406
+ webhooks: string;
407
+ };
408
+ };
409
+ contract: {
410
+ notFound: string;
411
+ title: string;
412
+ deleteConfirm: string;
413
+ deleteDescription: string;
414
+ deleteButton: string;
415
+ openChannel: string;
416
+ sections: {
417
+ details: string;
418
+ notes: string;
419
+ commissionRules: string;
420
+ };
421
+ labels: {
422
+ supplier: string;
423
+ endsAt: string;
424
+ paymentOwner: string;
425
+ cancellationOwner: string;
426
+ settlementTerms: string;
427
+ notes: string;
428
+ amount: string;
429
+ basisPoints: string;
430
+ rate: string;
431
+ category: string;
432
+ valid: string;
433
+ };
434
+ empty: {
435
+ commissionRules: string;
436
+ };
437
+ };
438
+ commissionRule: {
439
+ notFound: string;
440
+ title: string;
441
+ deleteConfirm: string;
442
+ deleteDescription: string;
443
+ deleteButton: string;
444
+ openContract: string;
445
+ openProduct: string;
446
+ sections: {
447
+ details: string;
448
+ };
449
+ labels: {
450
+ amount: string;
451
+ basisPoints: string;
452
+ externalRate: string;
453
+ externalCategory: string;
454
+ valid: string;
455
+ };
456
+ };
457
+ bookingLink: {
458
+ notFound: string;
459
+ title: string;
460
+ deleteConfirm: string;
461
+ deleteDescription: string;
462
+ deleteButton: string;
463
+ openChannel: string;
464
+ openBooking: string;
465
+ sections: {
466
+ details: string;
467
+ };
468
+ labels: {
469
+ externalBooking: string;
470
+ reference: string;
471
+ bookedAtExternal: string;
472
+ lastSynced: string;
473
+ };
474
+ };
475
+ webhookEvent: {
476
+ notFound: string;
477
+ title: string;
478
+ deleteConfirm: string;
479
+ deleteDescription: string;
480
+ deleteButton: string;
481
+ openChannel: string;
482
+ sections: {
483
+ details: string;
484
+ payload: string;
485
+ };
486
+ labels: {
487
+ externalEvent: string;
488
+ received: string;
489
+ processed: string;
490
+ error: string;
491
+ };
492
+ };
493
+ mapping: {
494
+ notFound: string;
495
+ title: string;
496
+ deleteConfirm: string;
497
+ deleteDescription: string;
498
+ deleteButton: string;
499
+ openChannel: string;
500
+ openProduct: string;
501
+ sections: {
502
+ details: string;
503
+ };
504
+ labels: {
505
+ externalProduct: string;
506
+ externalRate: string;
507
+ externalCategory: string;
508
+ };
509
+ };
510
+ };
130
511
  };
131
512
  //# sourceMappingURL=en.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiIK,CAAA"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0fK,CAAA"}