@voyantjs/distribution-react 0.105.2 → 0.107.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.
Files changed (66) hide show
  1. package/README.md +56 -10
  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 +257 -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-overview.d.ts +19 -0
  21. package/dist/components/distribution-overview.d.ts.map +1 -0
  22. package/dist/components/distribution-overview.js +13 -0
  23. package/dist/components/distribution-page.d.ts +26 -0
  24. package/dist/components/distribution-page.d.ts.map +1 -0
  25. package/dist/components/distribution-page.js +190 -0
  26. package/dist/components/distribution-section-header.d.ts +7 -0
  27. package/dist/components/distribution-section-header.d.ts.map +1 -0
  28. package/dist/components/distribution-section-header.js +6 -0
  29. package/dist/components/distribution-shared.d.ts +32 -0
  30. package/dist/components/distribution-shared.d.ts.map +1 -0
  31. package/dist/components/distribution-shared.js +246 -0
  32. package/dist/components/distribution-tabs-primary.d.ts +57 -0
  33. package/dist/components/distribution-tabs-primary.d.ts.map +1 -0
  34. package/dist/components/distribution-tabs-primary.js +89 -0
  35. package/dist/components/distribution-tabs-secondary.d.ts +58 -0
  36. package/dist/components/distribution-tabs-secondary.d.ts.map +1 -0
  37. package/dist/components/distribution-tabs-secondary.js +89 -0
  38. package/dist/components/mapping-detail-page.d.ts +10 -0
  39. package/dist/components/mapping-detail-page.d.ts.map +1 -0
  40. package/dist/components/mapping-detail-page.js +51 -0
  41. package/dist/components/webhook-event-detail-page.d.ts +9 -0
  42. package/dist/components/webhook-event-detail-page.d.ts.map +1 -0
  43. package/dist/components/webhook-event-detail-page.js +46 -0
  44. package/dist/i18n/en.d.ts +592 -0
  45. package/dist/i18n/en.d.ts.map +1 -0
  46. package/dist/i18n/en.js +561 -0
  47. package/dist/i18n/index.d.ts +5 -0
  48. package/dist/i18n/index.d.ts.map +1 -0
  49. package/dist/i18n/index.js +3 -0
  50. package/dist/i18n/messages.d.ts +409 -0
  51. package/dist/i18n/messages.d.ts.map +1 -0
  52. package/dist/i18n/messages.js +1 -0
  53. package/dist/i18n/provider.d.ts +1207 -0
  54. package/dist/i18n/provider.d.ts.map +1 -0
  55. package/dist/i18n/provider.js +44 -0
  56. package/dist/i18n/ro.d.ts +592 -0
  57. package/dist/i18n/ro.d.ts.map +1 -0
  58. package/dist/i18n/ro.js +561 -0
  59. package/dist/i18n/utils.d.ts +4 -0
  60. package/dist/i18n/utils.d.ts.map +1 -0
  61. package/dist/i18n/utils.js +8 -0
  62. package/dist/ui.d.ts +16 -0
  63. package/dist/ui.d.ts.map +1 -0
  64. package/dist/ui.js +14 -0
  65. package/package.json +53 -9
  66. package/src/styles.css +11 -0
@@ -0,0 +1,32 @@
1
+ import type { ColumnDef } from "@tanstack/react-table";
2
+ import type { DistributionUiMessages } from "../i18n/index.js";
3
+ import { type DistributionUiI18n } from "../i18n/index.js";
4
+ import { type BookingOption, type ChannelBookingLinkRow, type ChannelCommissionRuleRow, type ChannelContractRow, type ChannelProductMappingRow, type ChannelRow, type ChannelWebhookEventRow, cancellationOwnerOptions, channelKindOptions, channelStatusOptions, commissionScopeOptions, commissionTypeOptions, contractStatusOptions, formatSelectionLabel, labelById, NONE_VALUE, nullableNumber, nullableString, type ProductOption, parseJsonRecord, paymentOwnerOptions, formatDateTime as reactFormatDateTime, type SupplierOption, toIsoDateTime, toLocalDateTimeInput, webhookStatusOptions } from "../index.js";
5
+ export type BatchMutationResponse<T = unknown> = {
6
+ data?: T[];
7
+ deletedIds?: string[];
8
+ total: number;
9
+ succeeded: number;
10
+ failed: Array<{
11
+ id: string;
12
+ error: string;
13
+ }>;
14
+ };
15
+ export type { BookingOption, ChannelBookingLinkRow, ChannelCommissionRuleRow, ChannelContractRow, ChannelProductMappingRow, ChannelRow, ChannelWebhookEventRow, ProductOption, SupplierOption, };
16
+ export { cancellationOwnerOptions, channelKindOptions, channelStatusOptions, commissionScopeOptions, commissionTypeOptions, contractStatusOptions, formatSelectionLabel, labelById, NONE_VALUE, nullableNumber, nullableString, parseJsonRecord, paymentOwnerOptions, reactFormatDateTime as formatDateTime, toIsoDateTime, toLocalDateTimeInput, webhookStatusOptions, };
17
+ export declare function formatDistributionDateTime(value: Date | string | number | null | undefined, i18n?: DistributionUiI18n): string;
18
+ export declare function formatDistributionDate(value: Date | string | number | null | undefined, i18n?: DistributionUiI18n): string;
19
+ export declare function getChannelKindLabel(kind: ChannelRow["kind"], messages: DistributionUiMessages): string;
20
+ export declare function getChannelStatusLabel(status: ChannelRow["status"], messages: DistributionUiMessages): string;
21
+ export declare function getContractStatusLabel(status: ChannelContractRow["status"], messages: DistributionUiMessages): string;
22
+ export declare function getPaymentOwnerLabel(paymentOwner: ChannelContractRow["paymentOwner"], messages: DistributionUiMessages): string;
23
+ export declare function getCommissionScopeLabel(scope: ChannelCommissionRuleRow["scope"], messages: DistributionUiMessages): string;
24
+ export declare function getCommissionTypeLabel(commissionType: ChannelCommissionRuleRow["commissionType"], messages: DistributionUiMessages): string;
25
+ export declare function getWebhookStatusLabel(status: ChannelWebhookEventRow["status"], messages: DistributionUiMessages): string;
26
+ export declare const channelColumns: (onView: (channelId: string) => void, i18n?: DistributionUiI18n) => ColumnDef<ChannelRow>[];
27
+ export declare const contractColumns: (channels: ChannelRow[], suppliers: SupplierOption[], onView: (contractId: string) => void, i18n?: DistributionUiI18n) => ColumnDef<ChannelContractRow>[];
28
+ export declare const commissionColumns: (_contracts: ChannelContractRow[], products: ProductOption[], onView: (commissionRuleId: string) => void, i18n?: DistributionUiI18n) => ColumnDef<ChannelCommissionRuleRow>[];
29
+ export declare const mappingColumns: (channels: ChannelRow[], products: ProductOption[], onView: (mappingId: string) => void, i18n?: DistributionUiI18n) => ColumnDef<ChannelProductMappingRow>[];
30
+ export declare const bookingLinkColumns: (channels: ChannelRow[], bookings: BookingOption[], onView: (bookingLinkId: string) => void, i18n?: DistributionUiI18n) => ColumnDef<ChannelBookingLinkRow>[];
31
+ export declare const webhookColumns: (channels: ChannelRow[], onView: (webhookEventId: string) => void, i18n?: DistributionUiI18n) => ColumnDef<ChannelWebhookEventRow>[];
32
+ //# sourceMappingURL=distribution-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distribution-shared.d.ts","sourceRoot":"","sources":["../../src/components/distribution-shared.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAKtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACd,K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AAK,IAAI,EACnC,OAAM,kBAA8C,KACnD,SAAS,CAAC,wBAAwB,CAAC,EAmDrC,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,UAAU,UAAU,EAAE,EACtB,UAAU,aAAa,EAAE,EACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,EACvC,OAAM,kBAA8C,KACnD,SAAS,CAAC,qBAAqB,CAAC,EA6DlC,CAAA;AAED,eAAO,MAAM,cAAc,GACzB,UAAU,UAAU,EAAE,EACtB,QAAQ,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,EACxC,OAAM,kBAA8C,KACnD,SAAS,CAAC,sBAAsB,CAAC,EAwDnC,CAAA"}
@@ -0,0 +1,246 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Badge, Button } from "@voyantjs/ui/components";
3
+ import { DataTableColumnHeader } from "@voyantjs/ui/components/data-table-column-header";
4
+ import { ExternalLink } from "lucide-react";
5
+ import { getDistributionUiI18n, useDistributionUiMessagesOrDefault, } from "../i18n/index.js";
6
+ import { cancellationOwnerOptions, channelKindOptions, channelStatusOptions, commissionScopeOptions, commissionTypeOptions, contractStatusOptions, formatSelectionLabel, labelById, NONE_VALUE, nullableNumber, nullableString, parseJsonRecord, paymentOwnerOptions, formatDateTime as reactFormatDateTime, toIsoDateTime, toLocalDateTimeInput, webhookStatusOptions, } from "../index.js";
7
+ export { cancellationOwnerOptions, channelKindOptions, channelStatusOptions, commissionScopeOptions, commissionTypeOptions, contractStatusOptions, formatSelectionLabel, labelById, NONE_VALUE, nullableNumber, nullableString, parseJsonRecord, paymentOwnerOptions, reactFormatDateTime as formatDateTime, toIsoDateTime, toLocalDateTimeInput, webhookStatusOptions, };
8
+ const defaultDistributionUiI18n = getDistributionUiI18n({ locale: "en" });
9
+ function DistributionOpenButton({ label, onClick, }) {
10
+ useDistributionUiMessagesOrDefault();
11
+ return (_jsxs(Button, { variant: "ghost", size: "sm", "aria-label": label, title: label, onClick: onClick, children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), label] }));
12
+ }
13
+ export function formatDistributionDateTime(value, i18n = defaultDistributionUiI18n) {
14
+ if (!value) {
15
+ return i18n.messages.common.dateTimeFallback;
16
+ }
17
+ return i18n.formatDateTime(value);
18
+ }
19
+ export function formatDistributionDate(value, i18n = defaultDistributionUiI18n) {
20
+ if (!value) {
21
+ return i18n.messages.common.dateTimeFallback;
22
+ }
23
+ return i18n.formatDate(value);
24
+ }
25
+ export function getChannelKindLabel(kind, messages) {
26
+ return messages.common.channelKindLabels[kind];
27
+ }
28
+ export function getChannelStatusLabel(status, messages) {
29
+ return messages.common.channelStatusLabels[status];
30
+ }
31
+ export function getContractStatusLabel(status, messages) {
32
+ return messages.common.contractStatusLabels[status];
33
+ }
34
+ export function getPaymentOwnerLabel(paymentOwner, messages) {
35
+ return messages.common.paymentOwnerLabels[paymentOwner];
36
+ }
37
+ export function getCommissionScopeLabel(scope, messages) {
38
+ return messages.common.commissionScopeLabels[scope];
39
+ }
40
+ export function getCommissionTypeLabel(commissionType, messages) {
41
+ return messages.common.commissionTypeLabels[commissionType];
42
+ }
43
+ export function getWebhookStatusLabel(status, messages) {
44
+ return messages.common.webhookStatusLabels[status];
45
+ }
46
+ export const channelColumns = (onView, i18n = defaultDistributionUiI18n) => [
47
+ {
48
+ accessorKey: "name",
49
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.channel.channel })),
50
+ },
51
+ {
52
+ accessorKey: "kind",
53
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.channel.kind })),
54
+ cell: ({ row }) => (_jsx(Badge, { variant: "outline", children: getChannelKindLabel(row.original.kind, i18n.messages) })),
55
+ },
56
+ {
57
+ accessorKey: "status",
58
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.channel.status })),
59
+ cell: ({ row }) => (_jsx(Badge, { variant: row.original.status === "active" ? "default" : "secondary", children: getChannelStatusLabel(row.original.status, i18n.messages) })),
60
+ },
61
+ {
62
+ accessorKey: "website",
63
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.channel.website })),
64
+ cell: ({ row }) => row.original.website ?? i18n.messages.common.emptyValue,
65
+ },
66
+ {
67
+ id: "view",
68
+ header: i18n.messages.common.view,
69
+ cell: ({ row }) => (_jsx(DistributionOpenButton, { label: i18n.messages.common.open, onClick: (event) => {
70
+ event.stopPropagation();
71
+ onView(row.original.id);
72
+ } })),
73
+ },
74
+ ];
75
+ export const contractColumns = (channels, suppliers, onView, i18n = defaultDistributionUiI18n) => [
76
+ {
77
+ accessorKey: "channelId",
78
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.contract.channel })),
79
+ cell: ({ row }) => labelById(channels, row.original.channelId),
80
+ },
81
+ {
82
+ accessorKey: "supplierId",
83
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.contract.supplier })),
84
+ cell: ({ row }) => row.original.supplierId
85
+ ? labelById(suppliers, row.original.supplierId)
86
+ : i18n.messages.common.emptyValue,
87
+ },
88
+ {
89
+ accessorKey: "status",
90
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.contract.status })),
91
+ cell: ({ row }) => (_jsx(Badge, { variant: "outline", children: getContractStatusLabel(row.original.status, i18n.messages) })),
92
+ },
93
+ {
94
+ accessorKey: "paymentOwner",
95
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.contract.payment })),
96
+ cell: ({ row }) => getPaymentOwnerLabel(row.original.paymentOwner, i18n.messages),
97
+ },
98
+ {
99
+ accessorKey: "startsAt",
100
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.contract.start })),
101
+ cell: ({ row }) => formatDistributionDate(row.original.startsAt, i18n),
102
+ },
103
+ {
104
+ id: "view",
105
+ header: i18n.messages.common.view,
106
+ cell: ({ row }) => (_jsxs(Button, { variant: "ghost", size: "sm", "aria-label": i18n.messages.common.open, title: i18n.messages.common.open, onClick: (event) => {
107
+ event.stopPropagation();
108
+ onView(row.original.id);
109
+ }, children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), i18n.messages.common.open] })),
110
+ },
111
+ ];
112
+ export const commissionColumns = (_contracts, products, onView, i18n = defaultDistributionUiI18n) => [
113
+ {
114
+ accessorKey: "contractId",
115
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.commission.contract })),
116
+ cell: ({ row }) => row.original.contractId,
117
+ },
118
+ {
119
+ accessorKey: "scope",
120
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.commission.scope })),
121
+ cell: ({ row }) => (_jsx(Badge, { variant: "outline", children: getCommissionScopeLabel(row.original.scope, i18n.messages) })),
122
+ },
123
+ {
124
+ accessorKey: "productId",
125
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.commission.product })),
126
+ cell: ({ row }) => row.original.productId
127
+ ? labelById(products, row.original.productId)
128
+ : i18n.messages.common.emptyValue,
129
+ },
130
+ {
131
+ accessorKey: "commissionType",
132
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.commission.type })),
133
+ cell: ({ row }) => getCommissionTypeLabel(row.original.commissionType, i18n.messages),
134
+ },
135
+ {
136
+ accessorKey: "amountCents",
137
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.commission.amount })),
138
+ cell: ({ row }) => row.original.amountCents ?? i18n.messages.common.emptyValue,
139
+ },
140
+ {
141
+ id: "view",
142
+ header: i18n.messages.common.view,
143
+ cell: ({ row }) => (_jsxs(Button, { variant: "ghost", size: "sm", "aria-label": i18n.messages.common.open, title: i18n.messages.common.open, onClick: (event) => {
144
+ event.stopPropagation();
145
+ onView(row.original.id);
146
+ }, children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), i18n.messages.common.open] })),
147
+ },
148
+ ];
149
+ export const mappingColumns = (channels, products, onView, i18n = defaultDistributionUiI18n) => [
150
+ {
151
+ accessorKey: "channelId",
152
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.mapping.channel })),
153
+ cell: ({ row }) => labelById(channels, row.original.channelId),
154
+ },
155
+ {
156
+ accessorKey: "productId",
157
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.mapping.product })),
158
+ cell: ({ row }) => labelById(products, row.original.productId),
159
+ },
160
+ {
161
+ accessorKey: "externalProductId",
162
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.mapping.externalProduct })),
163
+ },
164
+ {
165
+ accessorKey: "active",
166
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.mapping.status })),
167
+ cell: ({ row }) => (_jsx(Badge, { variant: row.original.active ? "default" : "secondary", children: row.original.active ? i18n.messages.common.active : i18n.messages.common.inactive })),
168
+ },
169
+ {
170
+ id: "view",
171
+ header: i18n.messages.common.view,
172
+ cell: ({ row }) => (_jsxs(Button, { variant: "ghost", size: "sm", "aria-label": i18n.messages.common.open, title: i18n.messages.common.open, onClick: (event) => {
173
+ event.stopPropagation();
174
+ onView(row.original.id);
175
+ }, children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), i18n.messages.common.open] })),
176
+ },
177
+ ];
178
+ export const bookingLinkColumns = (channels, bookings, onView, i18n = defaultDistributionUiI18n) => [
179
+ {
180
+ accessorKey: "channelId",
181
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.bookingLink.channel })),
182
+ cell: ({ row }) => labelById(channels, row.original.channelId),
183
+ },
184
+ {
185
+ accessorKey: "bookingId",
186
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.bookingLink.booking })),
187
+ cell: ({ row }) => labelById(bookings, row.original.bookingId),
188
+ },
189
+ {
190
+ accessorKey: "externalBookingId",
191
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.bookingLink.externalBooking })),
192
+ cell: ({ row }) => row.original.externalBookingId ?? i18n.messages.common.emptyValue,
193
+ },
194
+ {
195
+ accessorKey: "externalStatus",
196
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.bookingLink.externalStatus })),
197
+ cell: ({ row }) => row.original.externalStatus ?? i18n.messages.common.emptyValue,
198
+ },
199
+ {
200
+ accessorKey: "lastSyncedAt",
201
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.bookingLink.synced })),
202
+ cell: ({ row }) => formatDistributionDateTime(row.original.lastSyncedAt, i18n),
203
+ },
204
+ {
205
+ id: "view",
206
+ header: i18n.messages.common.view,
207
+ cell: ({ row }) => (_jsxs(Button, { variant: "ghost", size: "sm", "aria-label": i18n.messages.common.open, title: i18n.messages.common.open, onClick: (event) => {
208
+ event.stopPropagation();
209
+ onView(row.original.id);
210
+ }, children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), i18n.messages.common.open] })),
211
+ },
212
+ ];
213
+ export const webhookColumns = (channels, onView, i18n = defaultDistributionUiI18n) => [
214
+ {
215
+ accessorKey: "channelId",
216
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.webhook.channel })),
217
+ cell: ({ row }) => labelById(channels, row.original.channelId),
218
+ },
219
+ {
220
+ accessorKey: "eventType",
221
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.webhook.eventType })),
222
+ },
223
+ {
224
+ accessorKey: "status",
225
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.webhook.status })),
226
+ cell: ({ row }) => (_jsx(Badge, { variant: "outline", children: getWebhookStatusLabel(row.original.status, i18n.messages) })),
227
+ },
228
+ {
229
+ accessorKey: "receivedAt",
230
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.webhook.received })),
231
+ cell: ({ row }) => formatDistributionDateTime(row.original.receivedAt, i18n),
232
+ },
233
+ {
234
+ accessorKey: "processedAt",
235
+ header: ({ column }) => (_jsx(DataTableColumnHeader, { column: column, title: i18n.messages.tables.webhook.processed })),
236
+ cell: ({ row }) => formatDistributionDateTime(row.original.processedAt, i18n),
237
+ },
238
+ {
239
+ id: "view",
240
+ header: i18n.messages.common.view,
241
+ cell: ({ row }) => (_jsxs(Button, { variant: "ghost", size: "sm", "aria-label": i18n.messages.common.open, title: i18n.messages.common.open, onClick: (event) => {
242
+ event.stopPropagation();
243
+ onView(row.original.id);
244
+ }, children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), i18n.messages.common.open] })),
245
+ },
246
+ ];
@@ -0,0 +1,57 @@
1
+ import type { OnChangeFn, RowSelectionState } from "@tanstack/react-table";
2
+ import type { DistributionEntity } from "../i18n/messages.js";
3
+ import type { ChannelCommissionRuleRow, ChannelContractRow, ChannelRow, ProductOption, SupplierOption } from "./distribution-shared.js";
4
+ type BulkFn = (args: {
5
+ ids: string[];
6
+ endpoint: string;
7
+ target: string;
8
+ noun: DistributionEntity;
9
+ payload: Record<string, unknown>;
10
+ successVerb: string;
11
+ clearSelection: () => void;
12
+ }) => Promise<void>;
13
+ type DeleteFn = (args: {
14
+ ids: string[];
15
+ endpoint: string;
16
+ target: string;
17
+ noun: DistributionEntity;
18
+ clearSelection: () => void;
19
+ }) => Promise<void>;
20
+ export declare function DistributionChannelsTab(props: {
21
+ filteredChannels: ChannelRow[];
22
+ channelSelection: RowSelectionState;
23
+ setChannelSelection: OnChangeFn<RowSelectionState>;
24
+ bulkActionTarget: string | null;
25
+ handleBulkUpdate: BulkFn;
26
+ handleBulkDelete: DeleteFn;
27
+ onCreate: () => void;
28
+ onOpenRoute: (channelId: string) => void;
29
+ onEdit: (row: ChannelRow) => void;
30
+ }): import("react/jsx-runtime").JSX.Element;
31
+ export declare function DistributionContractsTab(props: {
32
+ channels: ChannelRow[];
33
+ suppliers: SupplierOption[];
34
+ filteredContracts: ChannelContractRow[];
35
+ contractSelection: RowSelectionState;
36
+ setContractSelection: OnChangeFn<RowSelectionState>;
37
+ bulkActionTarget: string | null;
38
+ handleBulkUpdate: BulkFn;
39
+ handleBulkDelete: DeleteFn;
40
+ onCreate: () => void;
41
+ onOpenRoute: (contractId: string) => void;
42
+ onEdit: (row: ChannelContractRow) => void;
43
+ }): import("react/jsx-runtime").JSX.Element;
44
+ export declare function DistributionCommissionsTab(props: {
45
+ contracts: ChannelContractRow[];
46
+ products: ProductOption[];
47
+ filteredCommissionRules: ChannelCommissionRuleRow[];
48
+ commissionSelection: RowSelectionState;
49
+ setCommissionSelection: OnChangeFn<RowSelectionState>;
50
+ bulkActionTarget: string | null;
51
+ handleBulkDelete: DeleteFn;
52
+ onCreate: () => void;
53
+ onOpenRoute: (commissionRuleId: string) => void;
54
+ onEdit: (row: ChannelCommissionRuleRow) => void;
55
+ }): import("react/jsx-runtime").JSX.Element;
56
+ export {};
57
+ //# sourceMappingURL=distribution-tabs-primary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distribution-tabs-primary.d.ts","sourceRoot":"","sources":["../../src/components/distribution-tabs-primary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAM1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAG7D,OAAO,KAAK,EACV,wBAAwB,EACxB,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,cAAc,EACf,MAAM,0BAA0B,CAAA;AAGjC,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE;IACnB,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,M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AM,CAAA;IACxB,gBAAgB,EAAE,QAAQ,CAAA;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,WAAW,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,MAAM,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,CAAA;CAC1C,2CAkGA;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,SAAS,EAAE,kBAAkB,EAAE,CAAA;IAC/B,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,uBAAuB,EAAE,wBAAwB,EAAE,CAAA;IACnD,mBAAmB,EAAE,iBAAiB,CAAA;IACtC,sBAAsB,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAA;IACrD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,gBAAgB,EAAE,QAAQ,CAAA;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,WAAW,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C,MAAM,EAAE,CAAC,GAAG,EAAE,wBAAwB,KAAK,IAAI,CAAA;CAChD,2CAgEA"}
@@ -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 { channelColumns, commissionColumns, contractColumns } from "./distribution-shared.js";
10
+ function getSelectionSummary(count, template) {
11
+ return formatDistributionSummary(template, { count });
12
+ }
13
+ export function DistributionChannelsTab(props) {
14
+ const i18n = useDistributionUiI18nOrDefault();
15
+ const { messages } = i18n;
16
+ const tab = messages.tabs.channels;
17
+ return (_jsxs(TabsContent, { value: "channels", className: "space-y-4", children: [_jsx(SectionHeader, { title: tab.title, description: tab.description, actionLabel: tab.actionLabel, onAction: props.onCreate }), _jsx(DataTable, { columns: channelColumns(props.onOpenRoute, i18n), data: props.filteredChannels, emptyMessage: tab.empty, enableRowSelection: true, getRowId: (row) => row.id, rowSelection: props.channelSelection, onRowSelectionChange: props.setChannelSelection, renderSelectionActions: ({ selectedRows, clearSelection }) => {
18
+ const countLabel = formatDistributionCount(messages, "channel", 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 === "channels-activate", onConfirm: () => props.handleBulkUpdate({
20
+ ids: selectedRows.map((row) => row.original.id),
21
+ endpoint: "/v1/distribution/channels",
22
+ target: "channels-activate",
23
+ noun: "channel",
24
+ payload: { status: "active" },
25
+ successVerb: messages.page.bulkVerbs.activated,
26
+ clearSelection,
27
+ }) }), _jsx(ConfirmActionButton, { buttonLabel: tab.actions.archive.button, confirmLabel: tab.actions.archive.confirm, cancelLabel: messages.common.cancel, title: formatMessage(tab.actions.archive.title, { countLabel }), description: tab.actions.archive.description, disabled: props.bulkActionTarget === "channels-archive", onConfirm: () => props.handleBulkUpdate({
28
+ ids: selectedRows.map((row) => row.original.id),
29
+ endpoint: "/v1/distribution/channels",
30
+ target: "channels-archive",
31
+ noun: "channel",
32
+ payload: { status: "archived" },
33
+ successVerb: messages.page.bulkVerbs.archived,
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 === "channels-delete", variant: "destructive", confirmVariant: "destructive", onConfirm: () => props.handleBulkDelete({
36
+ ids: selectedRows.map((row) => row.original.id),
37
+ endpoint: "/v1/distribution/channels",
38
+ target: "channels-delete",
39
+ noun: "channel",
40
+ clearSelection,
41
+ }) })] }));
42
+ }, onRowClick: (row) => props.onEdit(row.original) })] }));
43
+ }
44
+ export function DistributionContractsTab(props) {
45
+ const i18n = useDistributionUiI18nOrDefault();
46
+ const { messages } = i18n;
47
+ const tab = messages.tabs.contracts;
48
+ return (_jsxs(TabsContent, { value: "contracts", className: "space-y-4", children: [_jsx(SectionHeader, { title: tab.title, description: tab.description, actionLabel: tab.actionLabel, onAction: props.onCreate }), _jsx(DataTable, { columns: contractColumns(props.channels, props.suppliers, props.onOpenRoute, i18n), data: props.filteredContracts, emptyMessage: tab.empty, enableRowSelection: true, getRowId: (row) => row.id, rowSelection: props.contractSelection, onRowSelectionChange: props.setContractSelection, renderSelectionActions: ({ selectedRows, clearSelection }) => {
49
+ const countLabel = formatDistributionCount(messages, "contract", selectedRows.length);
50
+ 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 === "contracts-activate", onConfirm: () => props.handleBulkUpdate({
51
+ ids: selectedRows.map((row) => row.original.id),
52
+ endpoint: "/v1/distribution/contracts",
53
+ target: "contracts-activate",
54
+ noun: "contract",
55
+ payload: { status: "active" },
56
+ successVerb: messages.page.bulkVerbs.activated,
57
+ clearSelection,
58
+ }) }), _jsx(ConfirmActionButton, { buttonLabel: tab.actions.expire.button, confirmLabel: tab.actions.expire.confirm, cancelLabel: messages.common.cancel, title: formatMessage(tab.actions.expire.title, { countLabel }), description: tab.actions.expire.description, disabled: props.bulkActionTarget === "contracts-expire", onConfirm: () => props.handleBulkUpdate({
59
+ ids: selectedRows.map((row) => row.original.id),
60
+ endpoint: "/v1/distribution/contracts",
61
+ target: "contracts-expire",
62
+ noun: "contract",
63
+ payload: { status: "expired" },
64
+ successVerb: messages.page.bulkVerbs.expired,
65
+ clearSelection,
66
+ }) }), _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 === "contracts-delete", variant: "destructive", confirmVariant: "destructive", onConfirm: () => props.handleBulkDelete({
67
+ ids: selectedRows.map((row) => row.original.id),
68
+ endpoint: "/v1/distribution/contracts",
69
+ target: "contracts-delete",
70
+ noun: "contract",
71
+ clearSelection,
72
+ }) })] }));
73
+ }, onRowClick: (row) => props.onEdit(row.original) })] }));
74
+ }
75
+ export function DistributionCommissionsTab(props) {
76
+ const i18n = useDistributionUiI18nOrDefault();
77
+ const { messages } = i18n;
78
+ const tab = messages.tabs.commissions;
79
+ return (_jsxs(TabsContent, { value: "commissions", className: "space-y-4", children: [_jsx(SectionHeader, { title: tab.title, description: tab.description, actionLabel: tab.actionLabel, onAction: props.onCreate }), _jsx(DataTable, { columns: commissionColumns(props.contracts, props.products, props.onOpenRoute, i18n), data: props.filteredCommissionRules, emptyMessage: tab.empty, enableRowSelection: true, getRowId: (row) => row.id, rowSelection: props.commissionSelection, onRowSelectionChange: props.setCommissionSelection, renderSelectionActions: ({ selectedRows, clearSelection }) => {
80
+ const countLabel = formatDistributionCount(messages, "commissionRule", selectedRows.length);
81
+ 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 === "commission-rules-delete", variant: "destructive", confirmVariant: "destructive", onConfirm: () => props.handleBulkDelete({
82
+ ids: selectedRows.map((row) => row.original.id),
83
+ endpoint: "/v1/distribution/commission-rules",
84
+ target: "commission-rules-delete",
85
+ noun: "commissionRule",
86
+ clearSelection,
87
+ }) }) }));
88
+ }, onRowClick: (row) => props.onEdit(row.original) })] }));
89
+ }
@@ -0,0 +1,58 @@
1
+ import type { OnChangeFn, RowSelectionState } from "@tanstack/react-table";
2
+ import type { DistributionEntity } from "../i18n/messages.js";
3
+ import type { BookingOption, ChannelBookingLinkRow, ChannelProductMappingRow, ChannelRow, ChannelWebhookEventRow, ProductOption } from "./distribution-shared.js";
4
+ type BulkFn = (args: {
5
+ ids: string[];
6
+ endpoint: string;
7
+ target: string;
8
+ noun: DistributionEntity;
9
+ payload: Record<string, unknown>;
10
+ successVerb: string;
11
+ clearSelection: () => void;
12
+ }) => Promise<void>;
13
+ type DeleteFn = (args: {
14
+ ids: string[];
15
+ endpoint: string;
16
+ target: string;
17
+ noun: DistributionEntity;
18
+ clearSelection: () => void;
19
+ }) => Promise<void>;
20
+ export declare function DistributionMappingsTab(props: {
21
+ channels: ChannelRow[];
22
+ products: ProductOption[];
23
+ filteredMappings: ChannelProductMappingRow[];
24
+ mappingSelection: RowSelectionState;
25
+ setMappingSelection: OnChangeFn<RowSelectionState>;
26
+ bulkActionTarget: string | null;
27
+ handleBulkUpdate: BulkFn;
28
+ handleBulkDelete: DeleteFn;
29
+ onCreate: () => void;
30
+ onOpenRoute: (mappingId: string) => void;
31
+ onEdit: (row: ChannelProductMappingRow) => void;
32
+ }): import("react/jsx-runtime").JSX.Element;
33
+ export declare function DistributionBookingLinksTab(props: {
34
+ channels: ChannelRow[];
35
+ bookings: BookingOption[];
36
+ filteredBookingLinks: ChannelBookingLinkRow[];
37
+ bookingLinkSelection: RowSelectionState;
38
+ setBookingLinkSelection: OnChangeFn<RowSelectionState>;
39
+ bulkActionTarget: string | null;
40
+ handleBulkDelete: DeleteFn;
41
+ onCreate: () => void;
42
+ onOpenRoute: (bookingLinkId: string) => void;
43
+ onEdit: (row: ChannelBookingLinkRow) => void;
44
+ }): import("react/jsx-runtime").JSX.Element;
45
+ export declare function DistributionWebhooksTab(props: {
46
+ channels: ChannelRow[];
47
+ filteredWebhookEvents: ChannelWebhookEventRow[];
48
+ webhookSelection: RowSelectionState;
49
+ setWebhookSelection: OnChangeFn<RowSelectionState>;
50
+ bulkActionTarget: string | null;
51
+ handleBulkUpdate: BulkFn;
52
+ handleBulkDelete: DeleteFn;
53
+ onCreate: () => void;
54
+ onOpenRoute: (webhookEventId: string) => void;
55
+ onEdit: (row: ChannelWebhookEventRow) => void;
56
+ }): import("react/jsx-runtime").JSX.Element;
57
+ export {};
58
+ //# sourceMappingURL=distribution-tabs-secondary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distribution-tabs-secondary.d.ts","sourceRoot":"","sources":["../../src/components/distribution-tabs-secondary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAM1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAG7D,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,UAAU,EACV,sBAAsB,EACtB,aAAa,EACd,MAAM,0BAA0B,CAAA;AAGjC,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE;IACnB,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,kBAAkB,CAAA;IACxB,OAAO,EAAE,MA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gBAAgB,EAAE,QAAQ,CAAA;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,WAAW,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5C,MAAM,EAAE,CAAC,GAAG,EAAE,qBAAqB,KAAK,IAAI,CAAA;CAC7C,2CA4DA;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,EAAE,UAAU,EAAE,CAAA;IACtB,qBAAqB,EAAE,sBAAsB,EAAE,CAAA;IAC/C,gBAAgB,EAAE,iBAAiB,CAAA;IACnC,mBAAmB,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAClD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,QAAQ,CAAA;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,WAAW,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C,MAAM,EAAE,CAAC,GAAG,EAAE,sBAAsB,KAAK,IAAI,CAAA;CAC9C,2CAkGA"}
@@ -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":"AAwBA,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"}