@voyant-travel/distribution-react 0.109.8
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 +201 -0
- package/README.md +82 -0
- package/dist/admin/index.d.ts +30 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +65 -0
- package/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +59 -0
- package/dist/components/booking-link-detail-page.d.ts +10 -0
- package/dist/components/booking-link-detail-page.d.ts.map +1 -0
- package/dist/components/booking-link-detail-page.js +51 -0
- package/dist/components/channel-detail-page.d.ts +12 -0
- package/dist/components/channel-detail-page.d.ts.map +1 -0
- package/dist/components/channel-detail-page.js +41 -0
- package/dist/components/channel-sync-controls.d.ts +15 -0
- package/dist/components/channel-sync-controls.d.ts.map +1 -0
- package/dist/components/channel-sync-controls.js +29 -0
- package/dist/components/channel-sync-deliveries-drawer.d.ts +12 -0
- package/dist/components/channel-sync-deliveries-drawer.d.ts.map +1 -0
- package/dist/components/channel-sync-deliveries-drawer.js +18 -0
- package/dist/components/channel-sync-page-utils.d.ts +99 -0
- package/dist/components/channel-sync-page-utils.d.ts.map +1 -0
- package/dist/components/channel-sync-page-utils.js +85 -0
- package/dist/components/channel-sync-page.d.ts +4 -0
- package/dist/components/channel-sync-page.d.ts.map +1 -0
- package/dist/components/channel-sync-page.js +141 -0
- package/dist/components/channels-page.d.ts +6 -0
- package/dist/components/channels-page.d.ts.map +1 -0
- package/dist/components/channels-page.js +132 -0
- package/dist/components/commission-rule-detail-page.d.ts +10 -0
- package/dist/components/commission-rule-detail-page.d.ts.map +1 -0
- package/dist/components/commission-rule-detail-page.js +57 -0
- package/dist/components/contract-detail-page.d.ts +10 -0
- package/dist/components/contract-detail-page.d.ts.map +1 -0
- package/dist/components/contract-detail-page.js +64 -0
- package/dist/components/distribution-overview.d.ts +19 -0
- package/dist/components/distribution-overview.d.ts.map +1 -0
- package/dist/components/distribution-overview.js +13 -0
- package/dist/components/distribution-page.d.ts +26 -0
- package/dist/components/distribution-page.d.ts.map +1 -0
- package/dist/components/distribution-page.js +190 -0
- package/dist/components/distribution-section-header.d.ts +7 -0
- package/dist/components/distribution-section-header.d.ts.map +1 -0
- package/dist/components/distribution-section-header.js +6 -0
- package/dist/components/distribution-shared.d.ts +32 -0
- package/dist/components/distribution-shared.d.ts.map +1 -0
- package/dist/components/distribution-shared.js +246 -0
- package/dist/components/distribution-tabs-primary.d.ts +57 -0
- package/dist/components/distribution-tabs-primary.d.ts.map +1 -0
- package/dist/components/distribution-tabs-primary.js +89 -0
- package/dist/components/distribution-tabs-secondary.d.ts +58 -0
- package/dist/components/distribution-tabs-secondary.d.ts.map +1 -0
- package/dist/components/distribution-tabs-secondary.js +89 -0
- package/dist/components/mapping-detail-page.d.ts +10 -0
- package/dist/components/mapping-detail-page.d.ts.map +1 -0
- package/dist/components/mapping-detail-page.js +51 -0
- package/dist/components/webhook-event-detail-page.d.ts +9 -0
- package/dist/components/webhook-event-detail-page.d.ts.map +1 -0
- package/dist/components/webhook-event-detail-page.js +46 -0
- package/dist/constants.d.ts +103 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +48 -0
- package/dist/external-refs/client.d.ts +14 -0
- package/dist/external-refs/client.d.ts.map +1 -0
- package/dist/external-refs/client.js +58 -0
- package/dist/external-refs/components/entity-ref-picker.d.ts +21 -0
- package/dist/external-refs/components/entity-ref-picker.d.ts.map +1 -0
- package/dist/external-refs/components/entity-ref-picker.js +38 -0
- package/dist/external-refs/components/external-ref-dialog.d.ts +11 -0
- package/dist/external-refs/components/external-ref-dialog.d.ts.map +1 -0
- package/dist/external-refs/components/external-ref-dialog.js +120 -0
- package/dist/external-refs/components/external-refs-page.d.ts +16 -0
- package/dist/external-refs/components/external-refs-page.d.ts.map +1 -0
- package/dist/external-refs/components/external-refs-page.js +109 -0
- package/dist/external-refs/hooks/index.d.ts +3 -0
- package/dist/external-refs/hooks/index.d.ts.map +1 -0
- package/dist/external-refs/hooks/index.js +2 -0
- package/dist/external-refs/hooks/use-external-ref-mutation.d.ts +57 -0
- package/dist/external-refs/hooks/use-external-ref-mutation.d.ts.map +1 -0
- package/dist/external-refs/hooks/use-external-ref-mutation.js +40 -0
- package/dist/external-refs/hooks/use-external-refs.d.ts +26 -0
- package/dist/external-refs/hooks/use-external-refs.d.ts.map +1 -0
- package/dist/external-refs/hooks/use-external-refs.js +12 -0
- package/dist/external-refs/i18n/en.d.ts +3 -0
- package/dist/external-refs/i18n/en.d.ts.map +1 -0
- package/dist/external-refs/i18n/en.js +92 -0
- package/dist/external-refs/i18n/index.d.ts +5 -0
- package/dist/external-refs/i18n/index.d.ts.map +1 -0
- package/dist/external-refs/i18n/index.js +3 -0
- package/dist/external-refs/i18n/messages.d.ts +85 -0
- package/dist/external-refs/i18n/messages.d.ts.map +1 -0
- package/dist/external-refs/i18n/messages.js +1 -0
- package/dist/external-refs/i18n/provider.d.ts +26 -0
- package/dist/external-refs/i18n/provider.d.ts.map +1 -0
- package/dist/external-refs/i18n/provider.js +44 -0
- package/dist/external-refs/i18n/ro.d.ts +3 -0
- package/dist/external-refs/i18n/ro.d.ts.map +1 -0
- package/dist/external-refs/i18n/ro.js +92 -0
- package/dist/external-refs/index.d.ts +7 -0
- package/dist/external-refs/index.d.ts.map +1 -0
- package/dist/external-refs/index.js +6 -0
- package/dist/external-refs/provider.d.ts +2 -0
- package/dist/external-refs/provider.d.ts.map +1 -0
- package/dist/external-refs/provider.js +1 -0
- package/dist/external-refs/query-keys.d.ts +18 -0
- package/dist/external-refs/query-keys.d.ts.map +1 -0
- package/dist/external-refs/query-keys.js +6 -0
- package/dist/external-refs/query-options.d.ts +159 -0
- package/dist/external-refs/query-options.d.ts.map +1 -0
- package/dist/external-refs/query-options.js +31 -0
- package/dist/external-refs/schemas.d.ts +82 -0
- package/dist/external-refs/schemas.d.ts.map +1 -0
- package/dist/external-refs/schemas.js +20 -0
- package/dist/external-refs/ui.d.ts +5 -0
- package/dist/external-refs/ui.d.ts.map +1 -0
- package/dist/external-refs/ui.js +4 -0
- package/dist/hooks/index.d.ts +12 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +12 -0
- package/dist/hooks/use-booking-links.d.ts +20 -0
- package/dist/hooks/use-booking-links.d.ts.map +1 -0
- package/dist/hooks/use-booking-links.js +9 -0
- package/dist/hooks/use-bookings.d.ts +14 -0
- package/dist/hooks/use-bookings.d.ts.map +1 -0
- package/dist/hooks/use-bookings.js +9 -0
- package/dist/hooks/use-channel-mutation.d.ts +69 -0
- package/dist/hooks/use-channel-mutation.d.ts.map +1 -0
- package/dist/hooks/use-channel-mutation.js +49 -0
- package/dist/hooks/use-channel.d.ts +16 -0
- package/dist/hooks/use-channel.d.ts.map +1 -0
- package/dist/hooks/use-channel.js +13 -0
- package/dist/hooks/use-channels.d.ts +20 -0
- package/dist/hooks/use-channels.d.ts.map +1 -0
- package/dist/hooks/use-channels.js +9 -0
- package/dist/hooks/use-commission-rules.d.ts +23 -0
- package/dist/hooks/use-commission-rules.d.ts.map +1 -0
- package/dist/hooks/use-commission-rules.js +9 -0
- package/dist/hooks/use-contracts.d.ts +22 -0
- package/dist/hooks/use-contracts.d.ts.map +1 -0
- package/dist/hooks/use-contracts.js +9 -0
- package/dist/hooks/use-mappings.d.ts +19 -0
- package/dist/hooks/use-mappings.d.ts.map +1 -0
- package/dist/hooks/use-mappings.js +9 -0
- package/dist/hooks/use-products.d.ts +14 -0
- package/dist/hooks/use-products.d.ts.map +1 -0
- package/dist/hooks/use-products.js +9 -0
- package/dist/hooks/use-suppliers.d.ts +14 -0
- package/dist/hooks/use-suppliers.d.ts.map +1 -0
- package/dist/hooks/use-suppliers.js +9 -0
- package/dist/hooks/use-webhook-events.d.ts +21 -0
- package/dist/hooks/use-webhook-events.d.ts.map +1 -0
- package/dist/hooks/use-webhook-events.js +9 -0
- package/dist/i18n/en.d.ts +592 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +561 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/messages.d.ts +409 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +1 -0
- package/dist/i18n/provider.d.ts +1207 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +44 -0
- package/dist/i18n/ro.d.ts +592 -0
- package/dist/i18n/ro.d.ts.map +1 -0
- package/dist/i18n/ro.js +561 -0
- package/dist/i18n/utils.d.ts +4 -0
- package/dist/i18n/utils.d.ts.map +1 -0
- package/dist/i18n/utils.js +8 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +1 -0
- package/dist/query-keys.d.ts +61 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +30 -0
- package/dist/query-options.d.ts +999 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +219 -0
- package/dist/schemas.d.ts +615 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +144 -0
- package/dist/suppliers/admin/index.d.ts +69 -0
- package/dist/suppliers/admin/index.d.ts.map +1 -0
- package/dist/suppliers/admin/index.js +111 -0
- package/dist/suppliers/admin/pages/supplier-detail-page.d.ts +9 -0
- package/dist/suppliers/admin/pages/supplier-detail-page.d.ts.map +1 -0
- package/dist/suppliers/admin/pages/supplier-detail-page.js +11 -0
- package/dist/suppliers/admin/slots.d.ts +19 -0
- package/dist/suppliers/admin/slots.d.ts.map +1 -0
- package/dist/suppliers/admin/slots.js +18 -0
- package/dist/suppliers/admin/supplier-detail-host.d.ts +30 -0
- package/dist/suppliers/admin/supplier-detail-host.d.ts.map +1 -0
- package/dist/suppliers/admin/supplier-detail-host.js +34 -0
- package/dist/suppliers/admin/supplier-detail-skeleton.d.ts +9 -0
- package/dist/suppliers/admin/supplier-detail-skeleton.d.ts.map +1 -0
- package/dist/suppliers/admin/supplier-detail-skeleton.js +20 -0
- package/dist/suppliers/admin/suppliers-host.d.ts +11 -0
- package/dist/suppliers/admin/suppliers-host.d.ts.map +1 -0
- package/dist/suppliers/admin/suppliers-host.js +17 -0
- package/dist/suppliers/admin/suppliers-list-skeleton.d.ts +9 -0
- package/dist/suppliers/admin/suppliers-list-skeleton.d.ts.map +1 -0
- package/dist/suppliers/admin/suppliers-list-skeleton.js +24 -0
- package/dist/suppliers/client.d.ts +14 -0
- package/dist/suppliers/client.d.ts.map +1 -0
- package/dist/suppliers/client.js +59 -0
- package/dist/suppliers/components/message-format.d.ts +2 -0
- package/dist/suppliers/components/message-format.d.ts.map +1 -0
- package/dist/suppliers/components/message-format.js +3 -0
- package/dist/suppliers/components/rate-dialog.d.ts +11 -0
- package/dist/suppliers/components/rate-dialog.d.ts.map +1 -0
- package/dist/suppliers/components/rate-dialog.js +93 -0
- package/dist/suppliers/components/service-dialog.d.ts +10 -0
- package/dist/suppliers/components/service-dialog.d.ts.map +1 -0
- package/dist/suppliers/components/service-dialog.js +69 -0
- package/dist/suppliers/components/supplier-combobox.d.ts +13 -0
- package/dist/suppliers/components/supplier-combobox.d.ts.map +1 -0
- package/dist/suppliers/components/supplier-combobox.js +23 -0
- package/dist/suppliers/components/supplier-detail-page.d.ts +17 -0
- package/dist/suppliers/components/supplier-detail-page.d.ts.map +1 -0
- package/dist/suppliers/components/supplier-detail-page.js +105 -0
- package/dist/suppliers/components/supplier-dialog.d.ts +9 -0
- package/dist/suppliers/components/supplier-dialog.d.ts.map +1 -0
- package/dist/suppliers/components/supplier-dialog.js +118 -0
- package/dist/suppliers/components/supplier-service-row.d.ts +22 -0
- package/dist/suppliers/components/supplier-service-row.d.ts.map +1 -0
- package/dist/suppliers/components/supplier-service-row.js +18 -0
- package/dist/suppliers/components/suppliers-page.d.ts +10 -0
- package/dist/suppliers/components/suppliers-page.d.ts.map +1 -0
- package/dist/suppliers/components/suppliers-page.js +94 -0
- package/dist/suppliers/constants.d.ts +69 -0
- package/dist/suppliers/constants.d.ts.map +1 -0
- package/dist/suppliers/constants.js +34 -0
- package/dist/suppliers/hooks/index.d.ts +10 -0
- package/dist/suppliers/hooks/index.d.ts.map +1 -0
- package/dist/suppliers/hooks/index.js +10 -0
- package/dist/suppliers/hooks/use-supplier-mutation.d.ts +95 -0
- package/dist/suppliers/hooks/use-supplier-mutation.d.ts.map +1 -0
- package/dist/suppliers/hooks/use-supplier-mutation.js +41 -0
- package/dist/suppliers/hooks/use-supplier-note-mutation.d.ts +13 -0
- package/dist/suppliers/hooks/use-supplier-note-mutation.d.ts.map +1 -0
- package/dist/suppliers/hooks/use-supplier-note-mutation.js +20 -0
- package/dist/suppliers/hooks/use-supplier-notes.d.ts +13 -0
- package/dist/suppliers/hooks/use-supplier-notes.d.ts.map +1 -0
- package/dist/suppliers/hooks/use-supplier-notes.js +12 -0
- package/dist/suppliers/hooks/use-supplier-rate-mutation.d.ts +56 -0
- package/dist/suppliers/hooks/use-supplier-rate-mutation.d.ts.map +1 -0
- package/dist/suppliers/hooks/use-supplier-rate-mutation.js +41 -0
- package/dist/suppliers/hooks/use-supplier-service-mutation.d.ts +45 -0
- package/dist/suppliers/hooks/use-supplier-service-mutation.d.ts.map +1 -0
- package/dist/suppliers/hooks/use-supplier-service-mutation.js +44 -0
- package/dist/suppliers/hooks/use-supplier-service-rates.d.ts +20 -0
- package/dist/suppliers/hooks/use-supplier-service-rates.d.ts.map +1 -0
- package/dist/suppliers/hooks/use-supplier-service-rates.js +12 -0
- package/dist/suppliers/hooks/use-supplier-services.d.ts +19 -0
- package/dist/suppliers/hooks/use-supplier-services.d.ts.map +1 -0
- package/dist/suppliers/hooks/use-supplier-services.js +12 -0
- package/dist/suppliers/hooks/use-supplier.d.ts +38 -0
- package/dist/suppliers/hooks/use-supplier.d.ts.map +1 -0
- package/dist/suppliers/hooks/use-supplier.js +9 -0
- package/dist/suppliers/hooks/use-suppliers.d.ts +42 -0
- package/dist/suppliers/hooks/use-suppliers.d.ts.map +1 -0
- package/dist/suppliers/hooks/use-suppliers.js +9 -0
- package/dist/suppliers/i18n/en.d.ts +204 -0
- package/dist/suppliers/i18n/en.d.ts.map +1 -0
- package/dist/suppliers/i18n/en.js +203 -0
- package/dist/suppliers/i18n/index.d.ts +5 -0
- package/dist/suppliers/i18n/index.d.ts.map +1 -0
- package/dist/suppliers/i18n/index.js +3 -0
- package/dist/suppliers/i18n/messages.d.ts +187 -0
- package/dist/suppliers/i18n/messages.d.ts.map +1 -0
- package/dist/suppliers/i18n/messages.js +1 -0
- package/dist/suppliers/i18n/provider.d.ts +430 -0
- package/dist/suppliers/i18n/provider.d.ts.map +1 -0
- package/dist/suppliers/i18n/provider.js +44 -0
- package/dist/suppliers/i18n/ro.d.ts +204 -0
- package/dist/suppliers/i18n/ro.d.ts.map +1 -0
- package/dist/suppliers/i18n/ro.js +203 -0
- package/dist/suppliers/index.d.ts +9 -0
- package/dist/suppliers/index.d.ts.map +1 -0
- package/dist/suppliers/index.js +8 -0
- package/dist/suppliers/provider.d.ts +2 -0
- package/dist/suppliers/provider.d.ts.map +1 -0
- package/dist/suppliers/provider.js +1 -0
- package/dist/suppliers/query-keys.d.ts +29 -0
- package/dist/suppliers/query-keys.d.ts.map +1 -0
- package/dist/suppliers/query-keys.js +12 -0
- package/dist/suppliers/query-options.d.ts +467 -0
- package/dist/suppliers/query-options.d.ts.map +1 -0
- package/dist/suppliers/query-options.js +63 -0
- package/dist/suppliers/schemas.d.ts +363 -0
- package/dist/suppliers/schemas.d.ts.map +1 -0
- package/dist/suppliers/schemas.js +109 -0
- package/dist/suppliers/ui.d.ts +9 -0
- package/dist/suppliers/ui.d.ts.map +1 -0
- package/dist/suppliers/ui.js +8 -0
- package/dist/suppliers/utils.d.ts +4 -0
- package/dist/suppliers/utils.d.ts.map +1 -0
- package/dist/suppliers/utils.js +10 -0
- package/dist/ui.d.ts +16 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +14 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +44 -0
- package/package.json +263 -0
- package/src/external-refs/styles.css +11 -0
- package/src/styles.css +11 -0
- package/src/suppliers/styles.css +11 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge, Button } from "@voyant-travel/ui/components";
|
|
4
|
+
import { DataTable } from "@voyant-travel/ui/components/data-table";
|
|
5
|
+
import { cn } from "@voyant-travel/ui/lib/utils";
|
|
6
|
+
import { ChevronLeft, ChevronRight, Link2, Pencil, Plus, Star, Trash2 } from "lucide-react";
|
|
7
|
+
import { useMemo, useState } from "react";
|
|
8
|
+
import { useExternalRefsUiMessagesOrDefault } from "../i18n/index.js";
|
|
9
|
+
import { useExternalRefMutation, useExternalRefs } from "../index.js";
|
|
10
|
+
import { EntityRefPicker } from "./entity-ref-picker.js";
|
|
11
|
+
import { ExternalRefDialog } from "./external-ref-dialog.js";
|
|
12
|
+
const PAGE_SIZE = 25;
|
|
13
|
+
export function ExternalRefsPage({ entityType, entityId, onScopeChange, className, } = {}) {
|
|
14
|
+
const messages = useExternalRefsUiMessagesOrDefault();
|
|
15
|
+
const pageMessages = messages.externalRefsPage;
|
|
16
|
+
const [innerEntityType, setInnerEntityType] = useState(entityType ?? "");
|
|
17
|
+
const [innerEntityId, setInnerEntityId] = useState(entityId ?? "");
|
|
18
|
+
const activeEntityType = entityType ?? innerEntityType;
|
|
19
|
+
const activeEntityId = entityId ?? innerEntityId;
|
|
20
|
+
const scopeReady = activeEntityType.trim().length > 0 && activeEntityId.trim().length > 0;
|
|
21
|
+
const updateScope = (next) => {
|
|
22
|
+
const nextEntityType = next.entityType ?? activeEntityType;
|
|
23
|
+
const nextEntityId = next.entityId ?? activeEntityId;
|
|
24
|
+
if (entityType === undefined)
|
|
25
|
+
setInnerEntityType(nextEntityType);
|
|
26
|
+
if (entityId === undefined)
|
|
27
|
+
setInnerEntityId(nextEntityId);
|
|
28
|
+
onScopeChange?.({ entityType: nextEntityType, entityId: nextEntityId });
|
|
29
|
+
};
|
|
30
|
+
return (_jsxs("div", { "data-slot": "external-refs-page", className: cn("flex flex-col gap-6 p-6", className), children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Link2, { className: "size-5 text-muted-foreground", "aria-hidden": "true" }), _jsx("h1", { className: "text-2xl font-bold tracking-tight", children: pageMessages.title })] }), _jsx("p", { className: "max-w-2xl text-sm text-muted-foreground", children: pageMessages.description }), _jsx(EntityRefPicker, { entityType: activeEntityType, entityId: activeEntityId, onChange: updateScope, messages: {
|
|
31
|
+
entityTypeLabel: pageMessages.fields.entityType,
|
|
32
|
+
entityLabel: pageMessages.fields.entity,
|
|
33
|
+
customEntityTypeLabel: pageMessages.fields.customEntityType,
|
|
34
|
+
typePlaceholder: pageMessages.placeholders.entityType,
|
|
35
|
+
entityPlaceholder: pageMessages.placeholders.entity,
|
|
36
|
+
entityTypeLabels: pageMessages.entityTypeLabels,
|
|
37
|
+
} }), !scopeReady ? (_jsx("div", { className: "rounded-md border border-dashed p-12 text-center", children: _jsx("p", { className: "text-sm text-muted-foreground", children: pageMessages.emptyScope }) })) : (_jsx(ExternalRefsTab, { entityType: activeEntityType, entityId: activeEntityId }))] }));
|
|
38
|
+
}
|
|
39
|
+
export function ExternalRefsTab({ entityType, entityId }) {
|
|
40
|
+
const messages = useExternalRefsUiMessagesOrDefault();
|
|
41
|
+
const tabMessages = messages.externalRefsTab;
|
|
42
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
43
|
+
const [editing, setEditing] = useState();
|
|
44
|
+
const [pageIndex, setPageIndex] = useState(0);
|
|
45
|
+
const { data, isPending, refetch } = useExternalRefs({
|
|
46
|
+
entityType,
|
|
47
|
+
entityId,
|
|
48
|
+
limit: PAGE_SIZE,
|
|
49
|
+
offset: pageIndex * PAGE_SIZE,
|
|
50
|
+
enabled: Boolean(entityType) && Boolean(entityId),
|
|
51
|
+
});
|
|
52
|
+
const { remove } = useExternalRefMutation();
|
|
53
|
+
const total = data?.total ?? 0;
|
|
54
|
+
const pageCount = Math.max(1, Math.ceil(total / PAGE_SIZE));
|
|
55
|
+
const canPreviousPage = pageIndex > 0;
|
|
56
|
+
const canNextPage = pageIndex + 1 < pageCount;
|
|
57
|
+
const columns = useMemo(() => [
|
|
58
|
+
{
|
|
59
|
+
accessorKey: "sourceSystem",
|
|
60
|
+
header: tabMessages.columns.sourceSystem,
|
|
61
|
+
cell: ({ row }) => _jsx("span", { className: "font-medium", children: row.original.sourceSystem }),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
accessorKey: "objectType",
|
|
65
|
+
header: tabMessages.columns.objectType,
|
|
66
|
+
cell: ({ row }) => _jsx("span", { className: "text-muted-foreground", children: row.original.objectType }),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
accessorKey: "externalId",
|
|
70
|
+
header: tabMessages.columns.externalId,
|
|
71
|
+
cell: ({ row }) => _jsx("span", { className: "font-mono text-xs", children: row.original.externalId }),
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
accessorKey: "namespace",
|
|
75
|
+
header: tabMessages.columns.namespace,
|
|
76
|
+
cell: ({ row }) => _jsx("span", { className: "text-muted-foreground", children: row.original.namespace }),
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
accessorKey: "status",
|
|
80
|
+
header: tabMessages.columns.status,
|
|
81
|
+
cell: ({ row }) => (_jsx(Badge, { variant: row.original.status === "active" ? "default" : "outline", className: "capitalize", children: messages.common.refStatusLabels[row.original.status] })),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
accessorKey: "isPrimary",
|
|
85
|
+
header: tabMessages.columns.primary,
|
|
86
|
+
cell: ({ row }) => row.original.isPrimary ? (_jsx(Star, { className: "size-3.5 fill-current text-amber-500", "aria-hidden": "true" })) : null,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "actions",
|
|
90
|
+
header: () => _jsx("div", { className: "w-20" }),
|
|
91
|
+
cell: ({ row }) => (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("button", { type: "button", onClick: () => {
|
|
92
|
+
setEditing(row.original);
|
|
93
|
+
setDialogOpen(true);
|
|
94
|
+
}, className: "text-muted-foreground hover:text-foreground", "aria-label": tabMessages.actions.edit, children: _jsx(Pencil, { className: "size-3.5", "aria-hidden": "true" }) }), _jsx("button", { type: "button", onClick: () => {
|
|
95
|
+
if (confirm(tabMessages.actions.deleteConfirm)) {
|
|
96
|
+
remove.mutate(row.original.id, { onSuccess: () => void refetch() });
|
|
97
|
+
}
|
|
98
|
+
}, className: "text-muted-foreground hover:text-destructive", "aria-label": tabMessages.actions.delete, children: _jsx(Trash2, { className: "size-3.5", "aria-hidden": "true" }) })] })),
|
|
99
|
+
},
|
|
100
|
+
], [refetch, remove, messages.common.refStatusLabels, tabMessages]);
|
|
101
|
+
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: tabMessages.description }), _jsxs(Button, { size: "sm", onClick: () => {
|
|
102
|
+
setEditing(undefined);
|
|
103
|
+
setDialogOpen(true);
|
|
104
|
+
}, children: [_jsx(Plus, { className: "mr-2 size-4", "aria-hidden": "true" }), tabMessages.add] })] }), _jsx(DataTable, { columns: columns, data: data?.data ?? [], emptyMessage: isPending ? tabMessages.empty.loading : tabMessages.empty.none, pageSize: PAGE_SIZE, showPagination: false }), total > PAGE_SIZE ? (_jsxs("div", { className: "flex items-center justify-end gap-2", children: [_jsxs("span", { className: "text-sm text-muted-foreground", children: [tabMessages.pagination.page, " ", pageIndex + 1, " ", tabMessages.pagination.of, " ", pageCount] }), _jsx(Button, { type: "button", variant: "outline", size: "icon-sm", onClick: () => setPageIndex((page) => Math.max(0, page - 1)), disabled: !canPreviousPage, "aria-label": tabMessages.pagination.previous, children: _jsx(ChevronLeft, { className: "size-4", "aria-hidden": "true" }) }), _jsx(Button, { type: "button", variant: "outline", size: "icon-sm", onClick: () => setPageIndex((page) => page + 1), disabled: !canNextPage, "aria-label": tabMessages.pagination.next, children: _jsx(ChevronRight, { className: "size-4", "aria-hidden": "true" }) })] })) : null, _jsx(ExternalRefDialog, { open: dialogOpen, onOpenChange: setDialogOpen, entityType: entityType, entityId: entityId, externalRef: editing, onSuccess: () => {
|
|
105
|
+
setDialogOpen(false);
|
|
106
|
+
setEditing(undefined);
|
|
107
|
+
void refetch();
|
|
108
|
+
} })] }));
|
|
109
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/external-refs/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAA;AAC9C,cAAc,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { insertExternalRefSchema, updateExternalRefSchema } from "@voyant-travel/distribution";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export type CreateExternalRefInput = z.input<typeof insertExternalRefSchema>;
|
|
4
|
+
export type UpdateExternalRefInput = z.input<typeof updateExternalRefSchema>;
|
|
5
|
+
export declare function useExternalRefMutation(): {
|
|
6
|
+
create: import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
entityType: string;
|
|
8
|
+
entityId: string;
|
|
9
|
+
sourceSystem: string;
|
|
10
|
+
objectType: string;
|
|
11
|
+
namespace: string;
|
|
12
|
+
externalId: string;
|
|
13
|
+
isPrimary: boolean;
|
|
14
|
+
status: "active" | "inactive" | "archived";
|
|
15
|
+
id: string;
|
|
16
|
+
externalParentId: string | null;
|
|
17
|
+
lastSyncedAt: string | null;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
21
|
+
}, Error, {
|
|
22
|
+
entityType: string;
|
|
23
|
+
entityId: string;
|
|
24
|
+
sourceSystem: string;
|
|
25
|
+
objectType: string;
|
|
26
|
+
externalId: string;
|
|
27
|
+
namespace?: string | undefined;
|
|
28
|
+
externalParentId?: string | null | undefined;
|
|
29
|
+
isPrimary?: boolean | undefined;
|
|
30
|
+
status?: "active" | "inactive" | "archived" | undefined;
|
|
31
|
+
lastSyncedAt?: string | null | undefined;
|
|
32
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
33
|
+
}, unknown>;
|
|
34
|
+
update: import("@tanstack/react-query").UseMutationResult<{
|
|
35
|
+
entityType: string;
|
|
36
|
+
entityId: string;
|
|
37
|
+
sourceSystem: string;
|
|
38
|
+
objectType: string;
|
|
39
|
+
namespace: string;
|
|
40
|
+
externalId: string;
|
|
41
|
+
isPrimary: boolean;
|
|
42
|
+
status: "active" | "inactive" | "archived";
|
|
43
|
+
id: string;
|
|
44
|
+
externalParentId: string | null;
|
|
45
|
+
lastSyncedAt: string | null;
|
|
46
|
+
createdAt: string;
|
|
47
|
+
updatedAt: string;
|
|
48
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
49
|
+
}, Error, {
|
|
50
|
+
id: string;
|
|
51
|
+
input: UpdateExternalRefInput;
|
|
52
|
+
}, unknown>;
|
|
53
|
+
remove: import("@tanstack/react-query").UseMutationResult<{
|
|
54
|
+
success: boolean;
|
|
55
|
+
}, Error, string, unknown>;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=use-external-ref-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-external-ref-mutation.d.ts","sourceRoot":"","sources":["../../../src/external-refs/hooks/use-external-ref-mutation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACnG,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAO5B,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAC5E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE5E,wBAAgB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBM,MAAM;eAAS,sBAAsB;;;;;EAgChF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { fetchWithValidation } from "../client.js";
|
|
4
|
+
import { useVoyantExternalRefsContext } from "../provider.js";
|
|
5
|
+
import { externalRefsQueryKeys } from "../query-keys.js";
|
|
6
|
+
import { externalRefSingleResponse, successEnvelope } from "../schemas.js";
|
|
7
|
+
export function useExternalRefMutation() {
|
|
8
|
+
const { baseUrl, fetcher } = useVoyantExternalRefsContext();
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const create = useMutation({
|
|
11
|
+
mutationFn: async (input) => {
|
|
12
|
+
const { data } = await fetchWithValidation("/v1/external-refs/refs", externalRefSingleResponse, { baseUrl, fetcher }, { method: "POST", body: JSON.stringify(input) });
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
onSuccess: (data) => {
|
|
16
|
+
void queryClient.invalidateQueries({ queryKey: externalRefsQueryKeys.refs() });
|
|
17
|
+
queryClient.setQueryData(externalRefsQueryKeys.ref(data.id), data);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const update = useMutation({
|
|
21
|
+
mutationFn: async ({ id, input }) => {
|
|
22
|
+
const { data } = await fetchWithValidation(`/v1/external-refs/refs/${id}`, externalRefSingleResponse, { baseUrl, fetcher }, { method: "PATCH", body: JSON.stringify(input) });
|
|
23
|
+
return data;
|
|
24
|
+
},
|
|
25
|
+
onSuccess: (data) => {
|
|
26
|
+
void queryClient.invalidateQueries({ queryKey: externalRefsQueryKeys.refs() });
|
|
27
|
+
queryClient.setQueryData(externalRefsQueryKeys.ref(data.id), data);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const remove = useMutation({
|
|
31
|
+
mutationFn: async (id) => fetchWithValidation(`/v1/external-refs/refs/${id}`, successEnvelope, { baseUrl, fetcher }, {
|
|
32
|
+
method: "DELETE",
|
|
33
|
+
}),
|
|
34
|
+
onSuccess: (_data, id) => {
|
|
35
|
+
void queryClient.invalidateQueries({ queryKey: externalRefsQueryKeys.refs() });
|
|
36
|
+
queryClient.removeQueries({ queryKey: externalRefsQueryKeys.ref(id) });
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
return { create, update, remove };
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ExternalRefsListFilters } from "../query-keys.js";
|
|
2
|
+
export interface UseExternalRefsOptions extends ExternalRefsListFilters {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useExternalRefs(options?: UseExternalRefsOptions): import("@tanstack/react-query").UseQueryResult<{
|
|
6
|
+
data: {
|
|
7
|
+
entityType: string;
|
|
8
|
+
entityId: string;
|
|
9
|
+
sourceSystem: string;
|
|
10
|
+
objectType: string;
|
|
11
|
+
namespace: string;
|
|
12
|
+
externalId: string;
|
|
13
|
+
isPrimary: boolean;
|
|
14
|
+
status: "active" | "inactive" | "archived";
|
|
15
|
+
id: string;
|
|
16
|
+
externalParentId: string | null;
|
|
17
|
+
lastSyncedAt: string | null;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
21
|
+
}[];
|
|
22
|
+
total: number;
|
|
23
|
+
limit: number;
|
|
24
|
+
offset: number;
|
|
25
|
+
}, Error>;
|
|
26
|
+
//# sourceMappingURL=use-external-refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-external-refs.d.ts","sourceRoot":"","sources":["../../../src/external-refs/hooks/use-external-refs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG/D,MAAM,WAAW,sBAAuB,SAAQ,uBAAuB;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;UAQnE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { useVoyantExternalRefsContext } from "../provider.js";
|
|
4
|
+
import { getExternalRefsQueryOptions } from "../query-options.js";
|
|
5
|
+
export function useExternalRefs(options = {}) {
|
|
6
|
+
const { baseUrl, fetcher } = useVoyantExternalRefsContext();
|
|
7
|
+
const { enabled = true, ...filters } = options;
|
|
8
|
+
return useQuery({
|
|
9
|
+
...getExternalRefsQueryOptions({ baseUrl, fetcher }, filters),
|
|
10
|
+
enabled,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../src/external-refs/i18n/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE3D,eAAO,MAAM,gBAAgB,EAAE,sBA4F9B,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export const externalRefsUiEn = {
|
|
2
|
+
common: {
|
|
3
|
+
refStatusLabels: {
|
|
4
|
+
active: "Active",
|
|
5
|
+
inactive: "Inactive",
|
|
6
|
+
archived: "Archived",
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
externalRefsPage: {
|
|
10
|
+
title: "External References",
|
|
11
|
+
description: "IDs from third-party systems linked to Voyant entities. Enter the entity type and ID below to manage its external references.",
|
|
12
|
+
fields: {
|
|
13
|
+
entityType: "Entity type",
|
|
14
|
+
entity: "Entity",
|
|
15
|
+
customEntityType: "Other entity type",
|
|
16
|
+
},
|
|
17
|
+
placeholders: {
|
|
18
|
+
entityType: "person, booking, product...",
|
|
19
|
+
entity: "Paste a reference for custom entity types",
|
|
20
|
+
},
|
|
21
|
+
entityTypeLabels: {
|
|
22
|
+
person: "Person",
|
|
23
|
+
organization: "Organization",
|
|
24
|
+
supplier: "Supplier",
|
|
25
|
+
booking: "Booking",
|
|
26
|
+
product: "Product",
|
|
27
|
+
},
|
|
28
|
+
emptyScope: "Choose an entity above to browse its external references.",
|
|
29
|
+
},
|
|
30
|
+
externalRefsTab: {
|
|
31
|
+
description: "Links between this entity and IDs in external systems.",
|
|
32
|
+
add: "Add External Ref",
|
|
33
|
+
empty: {
|
|
34
|
+
none: "No external references yet.",
|
|
35
|
+
loading: "Loading external references...",
|
|
36
|
+
},
|
|
37
|
+
columns: {
|
|
38
|
+
sourceSystem: "Source System",
|
|
39
|
+
objectType: "Object Type",
|
|
40
|
+
externalId: "External ID",
|
|
41
|
+
namespace: "Namespace",
|
|
42
|
+
status: "Status",
|
|
43
|
+
primary: "Primary",
|
|
44
|
+
},
|
|
45
|
+
actions: {
|
|
46
|
+
edit: "Edit external reference",
|
|
47
|
+
delete: "Delete external reference",
|
|
48
|
+
deleteConfirm: "Delete external reference?",
|
|
49
|
+
},
|
|
50
|
+
pagination: {
|
|
51
|
+
previous: "Previous page",
|
|
52
|
+
next: "Next page",
|
|
53
|
+
page: "Page",
|
|
54
|
+
of: "of",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
externalRefDialog: {
|
|
58
|
+
titles: {
|
|
59
|
+
edit: "Edit External Ref",
|
|
60
|
+
add: "Add External Ref",
|
|
61
|
+
},
|
|
62
|
+
labels: {
|
|
63
|
+
sourceSystem: "Source system",
|
|
64
|
+
objectType: "Object type",
|
|
65
|
+
namespace: "Namespace",
|
|
66
|
+
externalId: "External ID",
|
|
67
|
+
externalParentId: "External parent ID",
|
|
68
|
+
status: "Status",
|
|
69
|
+
primary: "Primary",
|
|
70
|
+
metadataJson: "Metadata (JSON)",
|
|
71
|
+
},
|
|
72
|
+
placeholders: {
|
|
73
|
+
sourceSystem: "bokun, pipedrive, stripe...",
|
|
74
|
+
objectType: "booking, person, product...",
|
|
75
|
+
namespace: "default",
|
|
76
|
+
externalId: "abc-123",
|
|
77
|
+
externalParentId: "parent-id...",
|
|
78
|
+
metadataJson: '{ "key": "value" }',
|
|
79
|
+
},
|
|
80
|
+
actions: {
|
|
81
|
+
cancel: "Cancel",
|
|
82
|
+
saveChanges: "Save Changes",
|
|
83
|
+
addExternalRef: "Add External Ref",
|
|
84
|
+
},
|
|
85
|
+
validation: {
|
|
86
|
+
sourceSystemRequired: "Source system is required",
|
|
87
|
+
objectTypeRequired: "Object type is required",
|
|
88
|
+
externalIdRequired: "External ID is required",
|
|
89
|
+
metadataMustBeObject: "Must be a JSON object",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { externalRefsUiEn } from "./en.js";
|
|
2
|
+
export type { ExternalRefStatus, ExternalRefsUiMessages } from "./messages.js";
|
|
3
|
+
export { type ExternalRefsUiMessageOverrides, ExternalRefsUiMessagesProvider, externalRefsUiMessageDefinitions, getExternalRefsUiI18n, resolveExternalRefsUiMessages, useExternalRefsUiI18n, useExternalRefsUiI18nOrDefault, useExternalRefsUiMessages, useExternalRefsUiMessagesOrDefault, } from "./provider.js";
|
|
4
|
+
export { externalRefsUiRo } from "./ro.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/external-refs/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC1C,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,EACL,KAAK,8BAA8B,EACnC,8BAA8B,EAC9B,gCAAgC,EAChC,qBAAqB,EACrB,6BAA6B,EAC7B,qBAAqB,EACrB,8BAA8B,EAC9B,yBAAyB,EACzB,kCAAkC,GACnC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { externalRefsUiEn } from "./en.js";
|
|
2
|
+
export { ExternalRefsUiMessagesProvider, externalRefsUiMessageDefinitions, getExternalRefsUiI18n, resolveExternalRefsUiMessages, useExternalRefsUiI18n, useExternalRefsUiI18nOrDefault, useExternalRefsUiMessages, useExternalRefsUiMessagesOrDefault, } from "./provider.js";
|
|
3
|
+
export { externalRefsUiRo } from "./ro.js";
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ExternalRefRecord } from "../index.js";
|
|
2
|
+
export type ExternalRefStatus = ExternalRefRecord["status"];
|
|
3
|
+
export type ExternalRefsUiMessages = {
|
|
4
|
+
common: {
|
|
5
|
+
refStatusLabels: Record<ExternalRefStatus, string>;
|
|
6
|
+
};
|
|
7
|
+
externalRefsPage: {
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
fields: {
|
|
11
|
+
entityType: string;
|
|
12
|
+
entity: string;
|
|
13
|
+
customEntityType: string;
|
|
14
|
+
};
|
|
15
|
+
placeholders: {
|
|
16
|
+
entityType: string;
|
|
17
|
+
entity: string;
|
|
18
|
+
};
|
|
19
|
+
entityTypeLabels: Record<"person" | "organization" | "supplier" | "booking" | "product", string>;
|
|
20
|
+
emptyScope: string;
|
|
21
|
+
};
|
|
22
|
+
externalRefsTab: {
|
|
23
|
+
description: string;
|
|
24
|
+
add: string;
|
|
25
|
+
empty: {
|
|
26
|
+
none: string;
|
|
27
|
+
loading: string;
|
|
28
|
+
};
|
|
29
|
+
columns: {
|
|
30
|
+
sourceSystem: string;
|
|
31
|
+
objectType: string;
|
|
32
|
+
externalId: string;
|
|
33
|
+
namespace: string;
|
|
34
|
+
status: string;
|
|
35
|
+
primary: string;
|
|
36
|
+
};
|
|
37
|
+
actions: {
|
|
38
|
+
edit: string;
|
|
39
|
+
delete: string;
|
|
40
|
+
deleteConfirm: string;
|
|
41
|
+
};
|
|
42
|
+
pagination: {
|
|
43
|
+
previous: string;
|
|
44
|
+
next: string;
|
|
45
|
+
page: string;
|
|
46
|
+
of: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
externalRefDialog: {
|
|
50
|
+
titles: {
|
|
51
|
+
edit: string;
|
|
52
|
+
add: string;
|
|
53
|
+
};
|
|
54
|
+
labels: {
|
|
55
|
+
sourceSystem: string;
|
|
56
|
+
objectType: string;
|
|
57
|
+
namespace: string;
|
|
58
|
+
externalId: string;
|
|
59
|
+
externalParentId: string;
|
|
60
|
+
status: string;
|
|
61
|
+
primary: string;
|
|
62
|
+
metadataJson: string;
|
|
63
|
+
};
|
|
64
|
+
placeholders: {
|
|
65
|
+
sourceSystem: string;
|
|
66
|
+
objectType: string;
|
|
67
|
+
namespace: string;
|
|
68
|
+
externalId: string;
|
|
69
|
+
externalParentId: string;
|
|
70
|
+
metadataJson: string;
|
|
71
|
+
};
|
|
72
|
+
actions: {
|
|
73
|
+
cancel: string;
|
|
74
|
+
saveChanges: string;
|
|
75
|
+
addExternalRef: string;
|
|
76
|
+
};
|
|
77
|
+
validation: {
|
|
78
|
+
sourceSystemRequired: string;
|
|
79
|
+
objectTypeRequired: string;
|
|
80
|
+
externalIdRequired: string;
|
|
81
|
+
metadataMustBeObject: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/external-refs/i18n/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAEpD,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AAE3D,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE;QACN,eAAe,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAA;KACnD,CAAA;IACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,MAAM,CAAA;QACb,WAAW,EAAE,MAAM,CAAA;QACnB,MAAM,EAAE;YACN,UAAU,EAAE,MAAM,CAAA;YAClB,MAAM,EAAE,MAAM,CAAA;YACd,gBAAgB,EAAE,MAAM,CAAA;SACzB,CAAA;QACD,YAAY,EAAE;YACZ,UAAU,EAAE,MAAM,CAAA;YAClB,MAAM,EAAE,MAAM,CAAA;SACf,CAAA;QACD,gBAAgB,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,EAAE,MAAM,CAAC,CAAA;QAChG,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,eAAe,EAAE;QACf,WAAW,EAAE,MAAM,CAAA;QACnB,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE;YACL,IAAI,EAAE,MAAM,CAAA;YACZ,OAAO,EAAE,MAAM,CAAA;SAChB,CAAA;QACD,OAAO,EAAE;YACP,YAAY,EAAE,MAAM,CAAA;YACpB,UAAU,EAAE,MAAM,CAAA;YAClB,UAAU,EAAE,MAAM,CAAA;YAClB,SAAS,EAAE,MAAM,CAAA;YACjB,MAAM,EAAE,MAAM,CAAA;YACd,OAAO,EAAE,MAAM,CAAA;SAChB,CAAA;QACD,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAA;YACZ,MAAM,EAAE,MAAM,CAAA;YACd,aAAa,EAAE,MAAM,CAAA;SACtB,CAAA;QACD,UAAU,EAAE;YACV,QAAQ,EAAE,MAAM,CAAA;YAChB,IAAI,EAAE,MAAM,CAAA;YACZ,IAAI,EAAE,MAAM,CAAA;YACZ,EAAE,EAAE,MAAM,CAAA;SACX,CAAA;KACF,CAAA;IACD,iBAAiB,EAAE;QACjB,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAA;YACZ,GAAG,EAAE,MAAM,CAAA;SACZ,CAAA;QACD,MAAM,EAAE;YACN,YAAY,EAAE,MAAM,CAAA;YACpB,UAAU,EAAE,MAAM,CAAA;YAClB,SAAS,EAAE,MAAM,CAAA;YACjB,UAAU,EAAE,MAAM,CAAA;YAClB,gBAAgB,EAAE,MAAM,CAAA;YACxB,MAAM,EAAE,MAAM,CAAA;YACd,OAAO,EAAE,MAAM,CAAA;YACf,YAAY,EAAE,MAAM,CAAA;SACrB,CAAA;QACD,YAAY,EAAE;YACZ,YAAY,EAAE,MAAM,CAAA;YACpB,UAAU,EAAE,MAAM,CAAA;YAClB,SAAS,EAAE,MAAM,CAAA;YACjB,UAAU,EAAE,MAAM,CAAA;YAClB,gBAAgB,EAAE,MAAM,CAAA;YACxB,YAAY,EAAE,MAAM,CAAA;SACrB,CAAA;QACD,OAAO,EAAE;YACP,MAAM,EAAE,MAAM,CAAA;YACd,WAAW,EAAE,MAAM,CAAA;YACnB,cAAc,EAAE,MAAM,CAAA;SACvB,CAAA;QACD,UAAU,EAAE;YACV,oBAAoB,EAAE,MAAM,CAAA;YAC5B,kBAAkB,EAAE,MAAM,CAAA;YAC1B,kBAAkB,EAAE,MAAM,CAAA;YAC1B,oBAAoB,EAAE,MAAM,CAAA;SAC7B,CAAA;KACF,CAAA;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type LocaleMessageOverrides, type PackageI18nValue } from "@voyant-travel/i18n";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import type { ExternalRefsUiMessages } from "./messages.js";
|
|
4
|
+
export declare const externalRefsUiMessageDefinitions: {
|
|
5
|
+
en: ExternalRefsUiMessages;
|
|
6
|
+
ro: ExternalRefsUiMessages;
|
|
7
|
+
};
|
|
8
|
+
export type ExternalRefsUiMessageOverrides = LocaleMessageOverrides<ExternalRefsUiMessages>;
|
|
9
|
+
export declare function resolveExternalRefsUiMessages({ locale, overrides, }: {
|
|
10
|
+
locale: string | null | undefined;
|
|
11
|
+
overrides?: ExternalRefsUiMessageOverrides | null;
|
|
12
|
+
}): ExternalRefsUiMessages;
|
|
13
|
+
export declare function getExternalRefsUiI18n({ locale, overrides, }: {
|
|
14
|
+
locale?: string | null | undefined;
|
|
15
|
+
overrides?: ExternalRefsUiMessageOverrides | null;
|
|
16
|
+
}): PackageI18nValue<ExternalRefsUiMessages>;
|
|
17
|
+
export declare function ExternalRefsUiMessagesProvider({ children, locale, overrides, }: {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
locale: string | null | undefined;
|
|
20
|
+
overrides?: ExternalRefsUiMessageOverrides | null;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const useExternalRefsUiI18n: () => PackageI18nValue<ExternalRefsUiMessages>;
|
|
23
|
+
export declare const useExternalRefsUiMessages: () => ExternalRefsUiMessages;
|
|
24
|
+
export declare function useExternalRefsUiI18nOrDefault(): PackageI18nValue<ExternalRefsUiMessages>;
|
|
25
|
+
export declare function useExternalRefsUiMessagesOrDefault(): ExternalRefsUiMessages;
|
|
26
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/external-refs/i18n/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EAEtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAK3D,eAAO,MAAM,gCAAgC;;;CAGe,CAAA;AAE5D,MAAM,MAAM,8BAA8B,GAAG,sBAAsB,CAAC,sBAAsB,CAAC,CAAA;AAU3F,wBAAgB,6BAA6B,CAAC,EAC5C,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACjC,SAAS,CAAC,EAAE,8BAA8B,GAAG,IAAI,CAAA;CAClD,0BAOA;AAED,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAClC,SAAS,CAAC,EAAE,8BAA8B,GAAG,IAAI,CAAA;CAClD,GAAG,gBAAgB,CAAC,sBAAsB,CAAC,CAS3C;AAED,wBAAgB,8BAA8B,CAAC,EAC7C,QAAQ,EACR,MAAM,EACN,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACjC,SAAS,CAAC,EAAE,8BAA8B,GAAG,IAAI,CAAA;CAClD,2CAWA;AAED,eAAO,MAAM,qBAAqB,gDAAgC,CAAA;AAClE,eAAO,MAAM,yBAAyB,8BAAoC,CAAA;AAE1E,wBAAgB,8BAA8B,6CAE7C;AAED,wBAAgB,kCAAkC,2BAEjD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createLocaleFormatters, createPackageMessagesContext, resolvePackageMessages, } from "@voyant-travel/i18n";
|
|
4
|
+
import { externalRefsUiEn } from "./en.js";
|
|
5
|
+
import { externalRefsUiRo } from "./ro.js";
|
|
6
|
+
const fallbackLocale = "en";
|
|
7
|
+
export const externalRefsUiMessageDefinitions = {
|
|
8
|
+
en: externalRefsUiEn,
|
|
9
|
+
ro: externalRefsUiRo,
|
|
10
|
+
};
|
|
11
|
+
const externalRefsUiContext = createPackageMessagesContext("ExternalRefsUiMessages");
|
|
12
|
+
const defaultExternalRefsUiI18n = {
|
|
13
|
+
messages: externalRefsUiEn,
|
|
14
|
+
...createLocaleFormatters(fallbackLocale),
|
|
15
|
+
};
|
|
16
|
+
export function resolveExternalRefsUiMessages({ locale, overrides, }) {
|
|
17
|
+
return resolvePackageMessages({
|
|
18
|
+
definitions: externalRefsUiMessageDefinitions,
|
|
19
|
+
fallbackLocale,
|
|
20
|
+
locale,
|
|
21
|
+
overrides,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export function getExternalRefsUiI18n({ locale, overrides, }) {
|
|
25
|
+
const resolvedLocale = locale ?? fallbackLocale;
|
|
26
|
+
return {
|
|
27
|
+
messages: resolveExternalRefsUiMessages({
|
|
28
|
+
locale: resolvedLocale,
|
|
29
|
+
overrides,
|
|
30
|
+
}),
|
|
31
|
+
...createLocaleFormatters(resolvedLocale),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function ExternalRefsUiMessagesProvider({ children, locale, overrides, }) {
|
|
35
|
+
return (_jsx(externalRefsUiContext.ResolvedMessagesProvider, { definitions: externalRefsUiMessageDefinitions, fallbackLocale: fallbackLocale, locale: locale, overrides: overrides, children: children }));
|
|
36
|
+
}
|
|
37
|
+
export const useExternalRefsUiI18n = externalRefsUiContext.useI18n;
|
|
38
|
+
export const useExternalRefsUiMessages = externalRefsUiContext.useMessages;
|
|
39
|
+
export function useExternalRefsUiI18nOrDefault() {
|
|
40
|
+
return externalRefsUiContext.useOptionalI18n() ?? defaultExternalRefsUiI18n;
|
|
41
|
+
}
|
|
42
|
+
export function useExternalRefsUiMessagesOrDefault() {
|
|
43
|
+
return useExternalRefsUiI18nOrDefault().messages;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ro.d.ts","sourceRoot":"","sources":["../../../src/external-refs/i18n/ro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE3D,eAAO,MAAM,gBAAgB,EAAE,sBA4F9B,CAAA"}
|