@open-mercato/core 0.6.6-develop.6257.1.6d0af84d26 → 0.6.6-develop.6286.1.d985c5c374
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/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/carrier_shipment_idempotency_key/index.js +19 -0
- package/dist/generated/entities/carrier_shipment_idempotency_key/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +2 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +10 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/catalog/lib/productResolution.js +45 -0
- package/dist/modules/catalog/lib/productResolution.js.map +7 -0
- package/dist/modules/communication_channels/workers/channel-import-history.js +1 -1
- package/dist/modules/communication_channels/workers/channel-import-history.js.map +2 -2
- package/dist/modules/currencies/api/fetch-configs/route.js +34 -0
- package/dist/modules/currencies/api/fetch-configs/route.js.map +2 -2
- package/dist/modules/currencies/components/CurrencyFetchingConfig.js +17 -15
- package/dist/modules/currencies/components/CurrencyFetchingConfig.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/route.js +176 -161
- package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/route.js +75 -59
- package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
- package/dist/modules/customers/backend/config/customers/pipeline-stages/page.js +17 -10
- package/dist/modules/customers/backend/config/customers/pipeline-stages/page.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivitiesAddNewMenu.js +6 -4
- package/dist/modules/customers/components/detail/ActivitiesAddNewMenu.js.map +2 -2
- package/dist/modules/customers/components/detail/AiActionChips.js +5 -2
- package/dist/modules/customers/components/detail/AiActionChips.js.map +2 -2
- package/dist/modules/customers/components/detail/schedule/ParticipantsField.js +19 -21
- package/dist/modules/customers/components/detail/schedule/ParticipantsField.js.map +2 -2
- package/dist/modules/data_sync/api/runs/[id]/cancel.js +1 -1
- package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +9 -45
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js +11 -17
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js.map +2 -2
- package/dist/modules/data_sync/components/IntegrationScheduleTab.js +12 -10
- package/dist/modules/data_sync/components/IntegrationScheduleTab.js.map +2 -2
- package/dist/modules/data_sync/lib/id-mapping.js +46 -1
- package/dist/modules/data_sync/lib/id-mapping.js.map +2 -2
- package/dist/modules/data_sync/lib/sync-engine.js +2 -2
- package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
- package/dist/modules/data_sync/lib/syncRunStatus.js +30 -0
- package/dist/modules/data_sync/lib/syncRunStatus.js.map +7 -0
- package/dist/modules/entities/api/records.js +6 -0
- package/dist/modules/entities/api/records.js.map +2 -2
- package/dist/modules/feature_toggles/api/global/route.js +17 -15
- package/dist/modules/feature_toggles/api/global/route.js.map +2 -2
- package/dist/modules/feature_toggles/api/openapi.js +2 -2
- package/dist/modules/feature_toggles/api/openapi.js.map +2 -2
- package/dist/modules/feature_toggles/commands/global.js +14 -0
- package/dist/modules/feature_toggles/commands/global.js.map +2 -2
- package/dist/modules/inbox_ops/backend/inbox-ops/page.js +6 -0
- package/dist/modules/inbox_ops/backend/inbox-ops/page.js.map +2 -2
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetails.js +3 -1
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetails.js.map +2 -2
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsActions.js +12 -5
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsActions.js.map +2 -2
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsQueries.js +10 -1
- package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsQueries.js.map +2 -2
- package/dist/modules/payment_gateways/api/cancel/route.js +5 -0
- package/dist/modules/payment_gateways/api/cancel/route.js.map +2 -2
- package/dist/modules/payment_gateways/api/capture/route.js +5 -0
- package/dist/modules/payment_gateways/api/capture/route.js.map +2 -2
- package/dist/modules/payment_gateways/api/refund/route.js +5 -0
- package/dist/modules/payment_gateways/api/refund/route.js.map +2 -2
- package/dist/modules/payment_gateways/lib/gateway-service.js +52 -25
- package/dist/modules/payment_gateways/lib/gateway-service.js.map +2 -2
- package/dist/modules/payment_gateways/lib/status-machine.js +13 -0
- package/dist/modules/payment_gateways/lib/status-machine.js.map +2 -2
- package/dist/modules/perspectives/api/[tableId]/route.js +8 -2
- package/dist/modules/perspectives/api/[tableId]/route.js.map +2 -2
- package/dist/modules/perspectives/data/entities.js +33 -3
- package/dist/modules/perspectives/data/entities.js.map +2 -2
- package/dist/modules/perspectives/migrations/Migration20260619120000_perspectives_live_row_uniqueness.js +63 -0
- package/dist/modules/perspectives/migrations/Migration20260619120000_perspectives_live_row_uniqueness.js.map +7 -0
- package/dist/modules/perspectives/services/perspectiveService.js +17 -0
- package/dist/modules/perspectives/services/perspectiveService.js.map +2 -2
- package/dist/modules/planner/commands/availability-weekly.js +33 -1
- package/dist/modules/planner/commands/availability-weekly.js.map +2 -2
- package/dist/modules/planner/components/AvailabilityRulesEditor.js +14 -2
- package/dist/modules/planner/components/AvailabilityRulesEditor.js.map +2 -2
- package/dist/modules/progress/api/active/route.js +1 -1
- package/dist/modules/progress/api/active/route.js.map +2 -2
- package/dist/modules/progress/lib/progressService.js.map +1 -1
- package/dist/modules/progress/lib/progressServiceImpl.js +33 -8
- package/dist/modules/progress/lib/progressServiceImpl.js.map +2 -2
- package/dist/modules/query_index/api/status.js +19 -24
- package/dist/modules/query_index/api/status.js.map +3 -3
- package/dist/modules/query_index/lib/coverage.js +35 -0
- package/dist/modules/query_index/lib/coverage.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +11 -6
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/resources/api/resource-types.js +5 -37
- package/dist/modules/resources/api/resource-types.js.map +2 -2
- package/dist/modules/resources/api/resourceTypeCounts.js +35 -0
- package/dist/modules/resources/api/resourceTypeCounts.js.map +7 -0
- package/dist/modules/resources/backend/resources/resource-types/[id]/edit/page.js +1 -1
- package/dist/modules/resources/backend/resources/resource-types/[id]/edit/page.js.map +1 -1
- package/dist/modules/resources/backend/resources/resource-types/page.js +2 -1
- package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
- package/dist/modules/sales/components/documents/ReturnDialog.js +4 -1
- package/dist/modules/sales/components/documents/ReturnDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentDialog.js +17 -2
- package/dist/modules/sales/components/documents/ShipmentDialog.js.map +2 -2
- package/dist/modules/sales/di.js +4 -0
- package/dist/modules/sales/di.js.map +2 -2
- package/dist/modules/sales/services/salesOrderService.js +26 -0
- package/dist/modules/sales/services/salesOrderService.js.map +7 -0
- package/dist/modules/shipping_carriers/api/shipments/route.js +8 -0
- package/dist/modules/shipping_carriers/api/shipments/route.js.map +2 -2
- package/dist/modules/shipping_carriers/data/entities.js +38 -0
- package/dist/modules/shipping_carriers/data/entities.js.map +2 -2
- package/dist/modules/shipping_carriers/data/validators.js +2 -1
- package/dist/modules/shipping_carriers/data/validators.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/shipment-idempotency.js +76 -0
- package/dist/modules/shipping_carriers/lib/shipment-idempotency.js.map +7 -0
- package/dist/modules/shipping_carriers/lib/shipment-wizard/hooks/shipmentApi.js +2 -1
- package/dist/modules/shipping_carriers/lib/shipment-wizard/hooks/shipmentApi.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/shipment-wizard/hooks/useShipmentWizard.js +20 -2
- package/dist/modules/shipping_carriers/lib/shipment-wizard/hooks/useShipmentWizard.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/shipping-service.js +82 -43
- package/dist/modules/shipping_carriers/lib/shipping-service.js.map +2 -2
- package/dist/modules/shipping_carriers/migrations/Migration20260618173616_shipping_carriers.js +14 -0
- package/dist/modules/shipping_carriers/migrations/Migration20260618173616_shipping_carriers.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/ListView.js +15 -6
- package/dist/modules/staff/lib/timesheets-ui/ListView.js.map +2 -2
- package/dist/modules/translations/components/TranslationManager.js +9 -18
- package/dist/modules/translations/components/TranslationManager.js.map +2 -2
- package/generated/entities/carrier_shipment_idempotency_key/index.ts +8 -0
- package/generated/entities.ids.generated.ts +2 -1
- package/generated/entity-fields-registry.ts +10 -0
- package/package.json +9 -8
- package/src/modules/catalog/lib/productResolution.ts +75 -0
- package/src/modules/communication_channels/workers/channel-import-history.ts +1 -1
- package/src/modules/currencies/api/fetch-configs/route.ts +36 -0
- package/src/modules/currencies/components/CurrencyFetchingConfig.tsx +20 -17
- package/src/modules/currencies/i18n/de.json +2 -1
- package/src/modules/currencies/i18n/en.json +2 -1
- package/src/modules/currencies/i18n/es.json +2 -1
- package/src/modules/currencies/i18n/pl.json +2 -1
- package/src/modules/customers/api/companies/[id]/route.ts +214 -189
- package/src/modules/customers/api/people/[id]/route.ts +106 -80
- package/src/modules/customers/backend/config/customers/pipeline-stages/page.tsx +19 -12
- package/src/modules/customers/components/detail/ActivitiesAddNewMenu.tsx +8 -6
- package/src/modules/customers/components/detail/AiActionChips.tsx +6 -3
- package/src/modules/customers/components/detail/schedule/ParticipantsField.tsx +16 -18
- package/src/modules/data_sync/api/runs/[id]/cancel.ts +1 -1
- package/src/modules/data_sync/backend/data-sync/page.tsx +11 -58
- package/src/modules/data_sync/backend/data-sync/runs/[id]/page.tsx +13 -20
- package/src/modules/data_sync/components/IntegrationScheduleTab.tsx +10 -8
- package/src/modules/data_sync/lib/id-mapping.ts +58 -1
- package/src/modules/data_sync/lib/sync-engine.ts +2 -2
- package/src/modules/data_sync/lib/syncRunStatus.ts +39 -0
- package/src/modules/entities/api/records.ts +14 -0
- package/src/modules/feature_toggles/api/global/route.ts +16 -14
- package/src/modules/feature_toggles/api/openapi.ts +2 -2
- package/src/modules/feature_toggles/commands/global.ts +15 -0
- package/src/modules/inbox_ops/backend/inbox-ops/page.tsx +7 -0
- package/src/modules/messages/components/message-detail/hooks/useMessageDetails.ts +2 -0
- package/src/modules/messages/components/message-detail/hooks/useMessageDetailsActions.ts +14 -4
- package/src/modules/messages/components/message-detail/hooks/useMessageDetailsQueries.ts +15 -1
- package/src/modules/payment_gateways/api/cancel/route.ts +5 -0
- package/src/modules/payment_gateways/api/capture/route.ts +5 -0
- package/src/modules/payment_gateways/api/refund/route.ts +5 -0
- package/src/modules/payment_gateways/lib/gateway-service.ts +58 -25
- package/src/modules/payment_gateways/lib/status-machine.ts +16 -0
- package/src/modules/perspectives/api/[tableId]/route.ts +8 -2
- package/src/modules/perspectives/data/entities.ts +43 -3
- package/src/modules/perspectives/migrations/.snapshot-open-mercato.json +69 -25
- package/src/modules/perspectives/migrations/Migration20260619120000_perspectives_live_row_uniqueness.ts +65 -0
- package/src/modules/perspectives/services/perspectiveService.ts +17 -0
- package/src/modules/planner/commands/availability-weekly.ts +48 -1
- package/src/modules/planner/components/AvailabilityRulesEditor.tsx +31 -10
- package/src/modules/progress/api/active/route.ts +1 -1
- package/src/modules/progress/lib/progressService.ts +2 -2
- package/src/modules/progress/lib/progressServiceImpl.ts +33 -8
- package/src/modules/query_index/api/status.ts +28 -32
- package/src/modules/query_index/lib/coverage.ts +63 -0
- package/src/modules/query_index/lib/engine.ts +37 -24
- package/src/modules/resources/api/resource-types.ts +4 -44
- package/src/modules/resources/api/resourceTypeCounts.ts +74 -0
- package/src/modules/resources/backend/resources/resource-types/[id]/edit/page.tsx +1 -1
- package/src/modules/resources/backend/resources/resource-types/page.tsx +1 -0
- package/src/modules/sales/components/documents/ReturnDialog.tsx +4 -1
- package/src/modules/sales/components/documents/ShipmentDialog.tsx +20 -2
- package/src/modules/sales/di.ts +6 -0
- package/src/modules/sales/services/salesOrderService.ts +38 -0
- package/src/modules/shipping_carriers/api/shipments/route.ts +8 -0
- package/src/modules/shipping_carriers/data/entities.ts +33 -0
- package/src/modules/shipping_carriers/data/validators.ts +1 -0
- package/src/modules/shipping_carriers/i18n/de.json +1 -0
- package/src/modules/shipping_carriers/i18n/en.json +1 -0
- package/src/modules/shipping_carriers/i18n/es.json +1 -0
- package/src/modules/shipping_carriers/i18n/pl.json +1 -0
- package/src/modules/shipping_carriers/lib/shipment-idempotency.ts +119 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/hooks/shipmentApi.ts +3 -1
- package/src/modules/shipping_carriers/lib/shipment-wizard/hooks/useShipmentWizard.ts +24 -2
- package/src/modules/shipping_carriers/lib/shipping-service.ts +87 -43
- package/src/modules/shipping_carriers/migrations/.snapshot-open-mercato.json +197 -0
- package/src/modules/shipping_carriers/migrations/Migration20260618173616_shipping_carriers.ts +14 -0
- package/src/modules/staff/i18n/de.json +1 -0
- package/src/modules/staff/i18n/en.json +1 -0
- package/src/modules/staff/i18n/es.json +1 -0
- package/src/modules/staff/i18n/pl.json +1 -0
- package/src/modules/staff/lib/timesheets-ui/ListView.tsx +15 -7
- package/src/modules/translations/components/TranslationManager.tsx +17 -24
- package/src/modules/translations/i18n/de.json +1 -0
- package/src/modules/translations/i18n/en.json +1 -0
- package/src/modules/translations/i18n/es.json +1 -0
- package/src/modules/translations/i18n/pl.json +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/translations/components/TranslationManager.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { ComboboxInput } from '@open-mercato/ui/backend/inputs'\nimport { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { apiCall, readApiResultOrThrow, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'\nimport { buildOptimisticLockHeader } from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { useCustomFieldDefs } from '@open-mercato/ui/backend/utils/customFieldDefs'\nimport { Save, Plus, X } from 'lucide-react'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { locales as defaultLocales } from '@open-mercato/shared/lib/i18n/config'\nimport { ISO_639_1, isValidIso639, getIso639Label } from '@open-mercato/shared/lib/i18n/iso639'\nimport { formatEntityLabel, buildEntityListUrl, getRecordLabel, resolveBaseValue } from '../lib/helpers'\nimport { resolveFieldList } from '../lib/resolve-field-list'\nimport type { ResolvedField } from '../lib/resolve-field-list'\n\nconst TRANSLATION_MUTATION_CONTEXT_ID = 'translations.entity-translations'\nconst SUPPORTED_LOCALES_MUTATION_CONTEXT_ID = 'translations.supported-locales'\n\ntype TranslationManagerProps = {\n entityType?: string\n recordId?: string\n baseValues?: Record<string, unknown>\n translatableFields?: string[]\n mode?: 'standalone' | 'embedded'\n compact?: boolean\n}\n\ntype EntityOption = { entityId: string; label?: string; source?: string }\n\ntype TranslationsResponse = {\n entityType: string\n entityId: string\n translations: Record<string, Record<string, unknown>>\n createdAt?: string\n updatedAt?: string\n}\n\nfunction useTranslationLocales() {\n return useQuery<string[]>({\n queryKey: ['translation-locales'],\n queryFn: async () => {\n const res = await apiCall<{ locales: string[] }>('/api/translations/locales')\n if (!res.ok) return [...defaultLocales]\n return Array.isArray(res.result?.locales) && res.result.locales.length > 0\n ? res.result.locales\n : [...defaultLocales]\n },\n staleTime: 60_000,\n })\n}\n\nexport function TranslationManager({\n entityType: propEntityType,\n recordId: propRecordId,\n baseValues: propBaseValues,\n translatableFields: propTranslatableFields,\n mode = 'standalone',\n compact = false,\n}: TranslationManagerProps) {\n const t = useT()\n const scopeVersion = useOrganizationScopeVersion()\n const isEmbedded = mode === 'embedded'\n\n const [selectedEntityType, setSelectedEntityType] = React.useState(propEntityType ?? '')\n const [selectedRecordId, setSelectedRecordId] = React.useState(propRecordId ?? '')\n const [activeLocale, setActiveLocale] = React.useState('')\n const [editedTranslations, setEditedTranslations] = React.useState<Record<string, Record<string, string>>>({})\n const editedTranslationsRef = React.useRef<Record<string, Record<string, string>>>({})\n const [hasUserEdited, setHasUserEdited] = React.useState(false)\n const hasUserEditedRef = React.useRef(false)\n\n const entityType = isEmbedded ? (propEntityType ?? '') : selectedEntityType\n const recordId = isEmbedded ? (propRecordId ?? '') : selectedRecordId\n\n const { data: locales = [...defaultLocales] } = useTranslationLocales()\n\n React.useEffect(() => {\n if (locales.length > 0 && (!activeLocale || !locales.includes(activeLocale))) {\n setActiveLocale(locales[0])\n }\n }, [locales, activeLocale])\n\n React.useEffect(() => {\n if (isEmbedded && propEntityType) setSelectedEntityType(propEntityType)\n }, [isEmbedded, propEntityType])\n\n React.useEffect(() => {\n if (isEmbedded && propRecordId) setSelectedRecordId(propRecordId)\n }, [isEmbedded, propRecordId])\n\n const { data: entities, isLoading: loadingEntities, error: entitiesError } = useQuery<{ items: EntityOption[] }>({\n queryKey: ['entities-list', scopeVersion],\n enabled: !isEmbedded,\n queryFn: async () =>\n readApiResultOrThrow('/api/entities/entities', undefined, {\n errorMessage: t('translations.manager.errors.loadEntities', 'Failed to load entities'),\n }),\n })\n\n const entitySuggestions = React.useMemo(\n () =>\n (entities?.items || []).map((item) => ({\n value: item.entityId,\n label: formatEntityLabel(item.entityId, item.label),\n description: item.entityId,\n })),\n [entities],\n )\n\n const resolveEntityLabel = React.useCallback(\n (value: string) => {\n const match = entities?.items?.find((e) => e.entityId === value)\n return match ? formatEntityLabel(match.entityId, match.label) : formatEntityLabel(value)\n },\n [entities],\n )\n\n const listUrl = React.useMemo(() => entityType ? buildEntityListUrl(entityType) : null, [entityType])\n\n const loadRecordSuggestions = React.useCallback(\n async (query?: string) => {\n if (!entityType || !listUrl) return []\n const url = `${listUrl}?pageSize=20${query ? `&search=${encodeURIComponent(query)}` : ''}`\n const res = await apiCall<{ items: Array<Record<string, unknown>> }>(url)\n if (!res.ok) return []\n const items = res.result?.items ?? []\n return items.map((item) => ({\n value: String(item.id ?? ''),\n label: getRecordLabel(item),\n }))\n },\n [entityType, listUrl],\n )\n\n const { data: recordData } = useQuery<Record<string, unknown> | null>({\n queryKey: ['translation-record-data', entityType, recordId, listUrl, scopeVersion],\n enabled: !isEmbedded && !!entityType && !!recordId && !!listUrl,\n queryFn: async () => {\n const res = await apiCall<{ items: Array<Record<string, unknown>> }>(\n // Some APIs filter by `id` (catalog), others by `ids` (resources) \u2014 send both so the one recognized by the target route's buildFilters is applied\n `${listUrl}?id=${encodeURIComponent(recordId)}&ids=${encodeURIComponent(recordId)}&pageSize=1`,\n )\n if (!res.ok) return null\n const items = res.result?.items\n return Array.isArray(items) && items.length > 0 ? items[0] : null\n },\n })\n\n const baseValues = isEmbedded ? (propBaseValues ?? {}) : (recordData ?? {})\n\n const resolveRecordLabel = React.useCallback(\n (value: string) => {\n if (recordData) return getRecordLabel(recordData)\n return value\n },\n [recordData],\n )\n\n const { data: fieldDefs = [], isLoading: loadingFieldDefs } = useCustomFieldDefs(entityType ? [entityType] : [], {\n enabled: !!entityType,\n })\n\n const fieldList = React.useMemo(\n () => resolveFieldList(entityType, propTranslatableFields, fieldDefs as Array<{ key: string; kind: string; label?: string }>),\n [entityType, propTranslatableFields, fieldDefs],\n )\n\n const {\n data: translationData,\n isLoading: loadingTranslation,\n isError: translationError,\n refetch: refetchTranslation,\n } = useQuery<TranslationsResponse | null>({\n queryKey: ['entity-translation', entityType, recordId, scopeVersion],\n enabled: !!entityType && !!recordId,\n queryFn: async () => {\n const res = await apiCall<TranslationsResponse>(\n `/api/translations/${encodeURIComponent(entityType)}/${encodeURIComponent(recordId)}`,\n )\n if (!res.ok) {\n if (res.response?.status === 404) return null\n return null\n }\n return res.result ?? null\n },\n })\n\n const translationSignature = React.useMemo(() => JSON.stringify(translationData ?? null), [translationData])\n const lastTranslationSignatureRef = React.useRef<string | null>(null)\n\n React.useEffect(() => {\n const sig = translationSignature\n if (sig === lastTranslationSignatureRef.current && hasUserEditedRef.current) return\n lastTranslationSignatureRef.current = sig\n\n if (!translationData?.translations) {\n if (!hasUserEditedRef.current) {\n editedTranslationsRef.current = {}\n setEditedTranslations({})\n }\n return\n }\n\n const parsed: Record<string, Record<string, string>> = {}\n for (const [locale, fields] of Object.entries(translationData.translations)) {\n if (!fields || typeof fields !== 'object') continue\n parsed[locale] = {}\n for (const [key, val] of Object.entries(fields)) {\n parsed[locale][key] = typeof val === 'string' ? val : ''\n }\n }\n if (!hasUserEditedRef.current) {\n editedTranslationsRef.current = parsed\n setEditedTranslations(parsed)\n }\n }, [translationSignature, translationData])\n\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n formId: string\n entityType: string\n recordId: string\n resourceKind: string\n resourceId: string\n data: TranslationsResponse | null\n retryLastMutation: () => Promise<boolean>\n }>({ contextId: TRANSLATION_MUTATION_CONTEXT_ID })\n\n const mutation = useMutation({\n mutationFn: async () => {\n if (!entityType || !recordId) {\n throw new Error(t('translations.manager.errors.selectRecord', 'Select an entity and record before saving'))\n }\n const body: Record<string, Record<string, string | null>> = {}\n for (const [locale, fields] of Object.entries(editedTranslationsRef.current)) {\n const localeFields: Record<string, string | null> = {}\n let hasValues = false\n for (const [key, val] of Object.entries(fields)) {\n if (val && val.trim().length > 0) {\n localeFields[key] = val.trim()\n hasValues = true\n }\n }\n if (hasValues) body[locale] = localeFields\n }\n if (Object.keys(body).length === 0) {\n console.warn('[translations] Save skipped: payload is empty \u2014 no locale contains any non-empty field')\n throw new Error(t('translations.manager.errors.nothingToSave', 'Nothing to save \u2014 enter a translation first'))\n }\n return runMutation({\n operation: async () => {\n const res = await withScopedApiRequestHeaders(\n buildOptimisticLockHeader(translationData?.updatedAt),\n () => apiCall(\n `/api/translations/${encodeURIComponent(entityType)}/${encodeURIComponent(recordId)}`,\n {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n },\n ),\n )\n if (!res.ok) {\n throw new Error(t('translations.manager.errors.save', 'Failed to save translations'))\n }\n return true\n },\n context: {\n formId: TRANSLATION_MUTATION_CONTEXT_ID,\n entityType,\n recordId,\n resourceKind: 'translation',\n resourceId: recordId,\n data: translationData ?? null,\n retryLastMutation,\n },\n mutationPayload: body,\n })\n },\n onSuccess: () => {\n flash(t('translations.manager.flash.saved', 'Translations saved'), 'success')\n hasUserEditedRef.current = false\n setHasUserEdited(false)\n void refetchTranslation()\n },\n onError: (err: unknown) => {\n const message = err instanceof Error ? err.message : t('translations.manager.errors.save', 'Failed to save translations')\n flash(message, 'error')\n },\n })\n\n const updateFieldValue = (locale: string, fieldKey: string, value: string) => {\n hasUserEditedRef.current = true\n setHasUserEdited(true)\n const next = {\n ...editedTranslationsRef.current,\n [locale]: {\n ...editedTranslationsRef.current[locale],\n [fieldKey]: value,\n },\n }\n editedTranslationsRef.current = next\n setEditedTranslations(next)\n }\n\n const getBaseValue = (fieldKey: string): string => resolveBaseValue(baseValues, fieldKey)\n\n const renderRecordPicker = () => {\n if (isEmbedded) return null\n\n return (\n <div className=\"space-y-2\">\n <label className=\"text-xs text-muted-foreground\">\n {t('translations.manager.selectRecord', 'Select record')}\n </label>\n <ComboboxInput\n value={selectedRecordId}\n onChange={(next) => {\n setSelectedRecordId(next)\n hasUserEditedRef.current = false\n setHasUserEdited(false)\n }}\n placeholder={t('translations.manager.searchRecords', 'Search records...')}\n loadSuggestions={loadRecordSuggestions}\n resolveLabel={resolveRecordLabel}\n allowCustomValues\n disabled={!entityType}\n />\n </div>\n )\n }\n\n const renderLocaleTabs = () => (\n <div className=\"flex gap-1 border-b\">\n {locales.map((locale) => {\n const isActive = activeLocale === locale\n return (\n <button\n key={locale}\n type=\"button\"\n data-state={isActive ? 'active' : 'inactive'}\n data-locale={locale}\n className={`px-3 py-1.5 text-sm font-medium transition-colors ${\n isActive\n ? 'border-b-2 border-accent-indigo text-foreground'\n : 'text-muted-foreground hover:text-foreground'\n }`}\n onClick={() => setActiveLocale(locale)}\n >\n {locale.toUpperCase()}\n </button>\n )\n })}\n </div>\n )\n\n const renderFieldTable = () => {\n if (!entityType || !recordId) {\n return (\n <div className=\"rounded border bg-background/80 p-4 text-sm text-muted-foreground\">\n {t('translations.manager.selectFirst', 'Select an entity and record to manage translations.')}\n </div>\n )\n }\n if (loadingTranslation || loadingFieldDefs) {\n return (\n <LoadingMessage\n label={t('translations.manager.loadingTranslations', 'Loading translations...')}\n className=\"border-0 bg-transparent p-4\"\n />\n )\n }\n if (translationError) {\n return (\n <ErrorMessage\n label={t('translations.manager.errors.loadTranslation', 'Failed to load translations')}\n action={(\n <Button variant=\"outline\" size=\"sm\" onClick={() => void refetchTranslation()}>\n {t('translations.manager.actions.retry', 'Retry')}\n </Button>\n )}\n />\n )\n }\n if (!fieldList.length) {\n return (\n <div className=\"rounded border bg-background/80 p-4 text-sm text-muted-foreground\">\n {t('translations.manager.noFields', 'No translatable fields found for this entity type.')}\n </div>\n )\n }\n\n const localeTranslations = editedTranslations[activeLocale] ?? {}\n\n return (\n <div className=\"overflow-x-auto\">\n <table className=\"w-full min-w-[480px] text-sm\">\n <thead>\n <tr className=\"text-xs uppercase tracking-wide text-muted-foreground\">\n <th className=\"px-3 py-2 text-left w-[140px]\">\n {t('translations.manager.fields.field', 'Field')}\n </th>\n {!compact && (\n <th className=\"px-3 py-2 text-left\">\n {t('translations.manager.fields.baseValue', 'Base value')}\n </th>\n )}\n <th className=\"px-3 py-2 text-left\">\n {t('translations.manager.fields.translation', 'Translation')} ({activeLocale.toUpperCase()})\n </th>\n </tr>\n </thead>\n <tbody>\n {fieldList.map((field) => {\n const baseVal = getBaseValue(field.key)\n const translatedVal = localeTranslations[field.key] ?? ''\n\n return (\n <tr key={field.key} className=\"border-t\">\n <td className=\"px-3 py-2 align-top text-xs font-medium text-muted-foreground\">\n {field.label}\n </td>\n {!compact && (\n <td className=\"px-3 py-2 align-top text-xs text-muted-foreground max-w-[200px]\">\n {baseVal ? (\n <span className=\"line-clamp-3\">{baseVal}</span>\n ) : (\n <span className=\"text-muted-foreground/50\">-</span>\n )}\n </td>\n )}\n <td className=\"px-3 py-2 align-top\">\n {field.multiline ? (\n <textarea\n className=\"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\"\n rows={3}\n value={translatedVal}\n onChange={(e) => updateFieldValue(activeLocale, field.key, e.target.value)}\n placeholder={baseVal || field.label}\n />\n ) : (\n <Input\n value={translatedVal}\n onChange={(e) => updateFieldValue(activeLocale, field.key, e.target.value)}\n placeholder={baseVal || field.label}\n />\n )}\n </td>\n </tr>\n )\n })}\n </tbody>\n </table>\n </div>\n )\n }\n\n React.useEffect(() => {\n const handler = (e: KeyboardEvent) => {\n if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') {\n e.preventDefault()\n if (entityType && recordId && !mutation.isPending) mutation.mutate()\n }\n }\n document.addEventListener('keydown', handler)\n return () => document.removeEventListener('keydown', handler)\n }, [entityType, recordId, mutation])\n\n if (compact) {\n return (\n <div className=\"space-y-3\">\n {renderLocaleTabs()}\n {renderFieldTable()}\n <div className=\"flex justify-end\">\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => mutation.mutate()}\n disabled={mutation.isPending || !entityType || !recordId}\n data-testid=\"translations-save\"\n >\n <Save className=\"mr-2 h-3 w-3\" />\n {mutation.isPending\n ? t('translations.manager.actions.saving', 'Saving...')\n : t('translations.manager.actions.save', 'Save translations')}\n </Button>\n </div>\n </div>\n )\n }\n\n return (\n <div className=\"space-y-6\">\n <div className=\"flex flex-col gap-3 rounded-lg border bg-card p-4 shadow-sm\">\n <div className=\"space-y-2\">\n <h2 className=\"text-xl font-semibold\">{t('translations.manager.title', 'Translations')}</h2>\n <p className=\"text-sm text-muted-foreground\">\n {t('translations.manager.description', 'Manage translations for entity records across supported locales.')}\n </p>\n </div>\n\n {!isEmbedded && (\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-start\">\n <div className=\"flex-1 space-y-3\">\n <div>\n <label className=\"text-xs text-muted-foreground\">\n {t('translations.manager.selectEntity', 'Choose entity')}\n </label>\n <div className=\"mt-1\">\n <ComboboxInput\n value={selectedEntityType}\n onChange={(next) => {\n setSelectedEntityType(next)\n setSelectedRecordId('')\n hasUserEditedRef.current = false\n setHasUserEdited(false)\n }}\n placeholder={t('translations.manager.placeholder', 'Select an entity')}\n suggestions={entitySuggestions}\n resolveLabel={resolveEntityLabel}\n disabled={loadingEntities || !!entitiesError}\n />\n </div>\n {entitiesError && (\n <p className=\"mt-1 text-xs text-destructive\">\n {t('translations.manager.errors.loadEntities', 'Failed to load entities')}\n </p>\n )}\n </div>\n {renderRecordPicker()}\n </div>\n </div>\n )}\n\n <div className=\"rounded-lg border bg-background/80 p-4\">\n {renderLocaleTabs()}\n <div className=\"mt-3\">\n {renderFieldTable()}\n </div>\n </div>\n\n <div className=\"flex justify-end\">\n <Button\n type=\"button\"\n onClick={() => mutation.mutate()}\n disabled={mutation.isPending || loadingEntities || !!entitiesError || !entityType || !recordId}\n data-testid=\"translations-save\"\n >\n <Save className=\"mr-2 h-4 w-4\" />\n {mutation.isPending\n ? t('translations.manager.actions.saving', 'Saving...')\n : t('translations.manager.actions.save', 'Save translations')}\n </Button>\n </div>\n </div>\n </div>\n )\n}\n\nexport function LocaleManager() {\n const t = useT()\n const queryClient = useQueryClient()\n const { data: locales = [], isLoading } = useTranslationLocales()\n const [newLocale, setNewLocale] = React.useState('')\n\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n formId: string\n resourceKind: string\n retryLastMutation: () => Promise<boolean>\n }>({ contextId: SUPPORTED_LOCALES_MUTATION_CONTEXT_ID })\n\n const mutation = useMutation({\n mutationFn: async (updatedLocales: string[]) => {\n // optimistic-lock-exempt: single-row tenant supported-locales settings list \u2014 no per-record version / concurrent record edit\n return runMutation({\n operation: async () => {\n const res = await apiCall<{ locales: string[] }>('/api/translations/locales', {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ locales: updatedLocales }),\n })\n if (!res.ok) throw new Error('Failed to save locales')\n return res.result?.locales ?? updatedLocales\n },\n context: {\n formId: SUPPORTED_LOCALES_MUTATION_CONTEXT_ID,\n resourceKind: 'translation-locales',\n retryLastMutation,\n },\n mutationPayload: { locales: updatedLocales },\n })\n },\n onSuccess: (result) => {\n queryClient.setQueryData(['translation-locales'], result)\n flash(t('translations.locales.flash.saved', 'Locales updated'), 'success')\n },\n onError: () => {\n flash(t('translations.locales.flash.error', 'Failed to update locales'), 'error')\n },\n })\n\n const availableLocales = React.useMemo(\n () => ISO_639_1.filter((entry) => !locales.includes(entry.code)).map((entry) => ({\n value: entry.code,\n label: `${entry.code.toUpperCase()} \u2014 ${entry.label}`,\n })),\n [locales],\n )\n\n const addLocale = () => {\n const code = newLocale.toLowerCase().trim()\n if (!code || !isValidIso639(code) || locales.includes(code)) return\n mutation.mutate([...locales, code])\n setNewLocale('')\n }\n\n const removeLocale = (locale: string) => {\n if (locales.length <= 1) return\n mutation.mutate(locales.filter((l) => l !== locale))\n }\n\n if (isLoading) {\n return <LoadingMessage label={t('translations.locales.loading', 'Loading locales...')} className=\"border-0 bg-transparent p-4\" />\n }\n\n return (\n <div className=\"flex flex-col gap-3 rounded-lg border bg-card p-4 shadow-sm\">\n <div className=\"space-y-1\">\n <h3 className=\"text-lg font-semibold\">{t('translations.locales.title', 'Supported locales')}</h3>\n <p className=\"text-sm text-muted-foreground\">\n {t('translations.locales.description', 'Configure which locales are available for translations. Add ISO language codes (e.g. fr, it, ja, zh).')}\n </p>\n </div>\n\n <div className=\"flex flex-wrap gap-2\">\n {locales.map((locale) => (\n <span\n key={locale}\n className=\"inline-flex items-center gap-1.5 rounded-full border bg-muted/50 px-3 py-1 text-sm font-medium\"\n title={getIso639Label(locale) ?? locale}\n >\n {locale.toUpperCase()}{getIso639Label(locale) ? ` \u2014 ${getIso639Label(locale)}` : ''}\n {locales.length > 1 && (\n <button\n type=\"button\"\n className=\"rounded-full p-0.5 text-muted-foreground hover:text-foreground transition-colors\"\n onClick={() => removeLocale(locale)}\n disabled={mutation.isPending}\n >\n <X className=\"h-3 w-3\" />\n </button>\n )}\n </span>\n ))}\n </div>\n\n <div className=\"flex gap-2 items-center\">\n <div className=\"max-w-[240px] flex-1\">\n <ComboboxInput\n value={newLocale}\n onChange={setNewLocale}\n placeholder={t('translations.locales.addPlaceholder', 'Search language...')}\n suggestions={availableLocales}\n resolveLabel={(value) => {\n const label = getIso639Label(value)\n return label ? `${value.toUpperCase()} \u2014 ${label}` : value.toUpperCase()\n }}\n />\n </div>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={addLocale}\n disabled={mutation.isPending || !newLocale.trim() || !isValidIso639(newLocale) || locales.includes(newLocale.toLowerCase().trim())}\n >\n <Plus className=\"mr-1 h-3 w-3\" />\n {t('translations.locales.add', 'Add')}\n </Button>\n </div>\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";AA6TM,SACE,KADF;AA3TN,YAAY,WAAW;AACvB,SAAS,UAAU,aAAa,sBAAsB;AACtD,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,aAAa;AACtB,SAAS,SAAS,sBAAsB,mCAAmC;AAC3E,SAAS,iCAAiC;AAC1C,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,MAAM,MAAM,SAAS;AAC9B,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB,SAAS,WAAW,sBAAsB;AAC1C,SAAS,WAAW,eAAe,sBAAsB;AACzD,SAAS,mBAAmB,oBAAoB,gBAAgB,wBAAwB;AACxF,SAAS,wBAAwB;AAGjC,MAAM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AAA;AAAA,MACF,GACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,SAAS;AAAA,UACT,UAAU,SAAS,aAAa,CAAC,UAAU,KAAK,KAAK,CAAC,cAAc,SAAS,KAAK,QAAQ,SAAS,UAAU,YAAY,EAAE,KAAK,CAAC;AAAA,UAEjI;AAAA,gCAAC,QAAK,WAAU,gBAAe;AAAA,YAC9B,EAAE,4BAA4B,KAAK;AAAA;AAAA;AAAA,MACtC;AAAA,OACF;AAAA,KACF;AAEJ;",
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Tabs, TabsList, TabsTrigger } from '@open-mercato/ui/primitives/tabs'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { ComboboxInput } from '@open-mercato/ui/backend/inputs'\nimport { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { apiCall, readApiResultOrThrow, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'\nimport { buildOptimisticLockHeader } from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { useCustomFieldDefs } from '@open-mercato/ui/backend/utils/customFieldDefs'\nimport { Save, Plus, X } from 'lucide-react'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { locales as defaultLocales } from '@open-mercato/shared/lib/i18n/config'\nimport { ISO_639_1, isValidIso639, getIso639Label } from '@open-mercato/shared/lib/i18n/iso639'\nimport { formatEntityLabel, buildEntityListUrl, getRecordLabel, resolveBaseValue } from '../lib/helpers'\nimport { resolveFieldList } from '../lib/resolve-field-list'\nimport type { ResolvedField } from '../lib/resolve-field-list'\n\nconst TRANSLATION_MUTATION_CONTEXT_ID = 'translations.entity-translations'\nconst SUPPORTED_LOCALES_MUTATION_CONTEXT_ID = 'translations.supported-locales'\n\ntype TranslationManagerProps = {\n entityType?: string\n recordId?: string\n baseValues?: Record<string, unknown>\n translatableFields?: string[]\n mode?: 'standalone' | 'embedded'\n compact?: boolean\n}\n\ntype EntityOption = { entityId: string; label?: string; source?: string }\n\ntype TranslationsResponse = {\n entityType: string\n entityId: string\n translations: Record<string, Record<string, unknown>>\n createdAt?: string\n updatedAt?: string\n}\n\nfunction useTranslationLocales() {\n return useQuery<string[]>({\n queryKey: ['translation-locales'],\n queryFn: async () => {\n const res = await apiCall<{ locales: string[] }>('/api/translations/locales')\n if (!res.ok) return [...defaultLocales]\n return Array.isArray(res.result?.locales) && res.result.locales.length > 0\n ? res.result.locales\n : [...defaultLocales]\n },\n staleTime: 60_000,\n })\n}\n\nexport function TranslationManager({\n entityType: propEntityType,\n recordId: propRecordId,\n baseValues: propBaseValues,\n translatableFields: propTranslatableFields,\n mode = 'standalone',\n compact = false,\n}: TranslationManagerProps) {\n const t = useT()\n const scopeVersion = useOrganizationScopeVersion()\n const isEmbedded = mode === 'embedded'\n\n const [selectedEntityType, setSelectedEntityType] = React.useState(propEntityType ?? '')\n const [selectedRecordId, setSelectedRecordId] = React.useState(propRecordId ?? '')\n const [activeLocale, setActiveLocale] = React.useState('')\n const [editedTranslations, setEditedTranslations] = React.useState<Record<string, Record<string, string>>>({})\n const editedTranslationsRef = React.useRef<Record<string, Record<string, string>>>({})\n const [hasUserEdited, setHasUserEdited] = React.useState(false)\n const hasUserEditedRef = React.useRef(false)\n\n const entityType = isEmbedded ? (propEntityType ?? '') : selectedEntityType\n const recordId = isEmbedded ? (propRecordId ?? '') : selectedRecordId\n\n const { data: locales = [...defaultLocales] } = useTranslationLocales()\n\n React.useEffect(() => {\n if (locales.length > 0 && (!activeLocale || !locales.includes(activeLocale))) {\n setActiveLocale(locales[0])\n }\n }, [locales, activeLocale])\n\n React.useEffect(() => {\n if (isEmbedded && propEntityType) setSelectedEntityType(propEntityType)\n }, [isEmbedded, propEntityType])\n\n React.useEffect(() => {\n if (isEmbedded && propRecordId) setSelectedRecordId(propRecordId)\n }, [isEmbedded, propRecordId])\n\n const { data: entities, isLoading: loadingEntities, error: entitiesError } = useQuery<{ items: EntityOption[] }>({\n queryKey: ['entities-list', scopeVersion],\n enabled: !isEmbedded,\n queryFn: async () =>\n readApiResultOrThrow('/api/entities/entities', undefined, {\n errorMessage: t('translations.manager.errors.loadEntities', 'Failed to load entities'),\n }),\n })\n\n const entitySuggestions = React.useMemo(\n () =>\n (entities?.items || []).map((item) => ({\n value: item.entityId,\n label: formatEntityLabel(item.entityId, item.label),\n description: item.entityId,\n })),\n [entities],\n )\n\n const resolveEntityLabel = React.useCallback(\n (value: string) => {\n const match = entities?.items?.find((e) => e.entityId === value)\n return match ? formatEntityLabel(match.entityId, match.label) : formatEntityLabel(value)\n },\n [entities],\n )\n\n const listUrl = React.useMemo(() => entityType ? buildEntityListUrl(entityType) : null, [entityType])\n\n const loadRecordSuggestions = React.useCallback(\n async (query?: string) => {\n if (!entityType || !listUrl) return []\n const url = `${listUrl}?pageSize=20${query ? `&search=${encodeURIComponent(query)}` : ''}`\n const res = await apiCall<{ items: Array<Record<string, unknown>> }>(url)\n if (!res.ok) return []\n const items = res.result?.items ?? []\n return items.map((item) => ({\n value: String(item.id ?? ''),\n label: getRecordLabel(item),\n }))\n },\n [entityType, listUrl],\n )\n\n const { data: recordData } = useQuery<Record<string, unknown> | null>({\n queryKey: ['translation-record-data', entityType, recordId, listUrl, scopeVersion],\n enabled: !isEmbedded && !!entityType && !!recordId && !!listUrl,\n queryFn: async () => {\n const res = await apiCall<{ items: Array<Record<string, unknown>> }>(\n // Some APIs filter by `id` (catalog), others by `ids` (resources) \u2014 send both so the one recognized by the target route's buildFilters is applied\n `${listUrl}?id=${encodeURIComponent(recordId)}&ids=${encodeURIComponent(recordId)}&pageSize=1`,\n )\n if (!res.ok) return null\n const items = res.result?.items\n return Array.isArray(items) && items.length > 0 ? items[0] : null\n },\n })\n\n const baseValues = isEmbedded ? (propBaseValues ?? {}) : (recordData ?? {})\n\n const resolveRecordLabel = React.useCallback(\n (value: string) => {\n if (recordData) return getRecordLabel(recordData)\n return value\n },\n [recordData],\n )\n\n const { data: fieldDefs = [], isLoading: loadingFieldDefs } = useCustomFieldDefs(entityType ? [entityType] : [], {\n enabled: !!entityType,\n })\n\n const fieldList = React.useMemo(\n () => resolveFieldList(entityType, propTranslatableFields, fieldDefs as Array<{ key: string; kind: string; label?: string }>),\n [entityType, propTranslatableFields, fieldDefs],\n )\n\n const {\n data: translationData,\n isLoading: loadingTranslation,\n isError: translationError,\n refetch: refetchTranslation,\n } = useQuery<TranslationsResponse | null>({\n queryKey: ['entity-translation', entityType, recordId, scopeVersion],\n enabled: !!entityType && !!recordId,\n queryFn: async () => {\n const res = await apiCall<TranslationsResponse>(\n `/api/translations/${encodeURIComponent(entityType)}/${encodeURIComponent(recordId)}`,\n )\n if (!res.ok) {\n if (res.response?.status === 404) return null\n return null\n }\n return res.result ?? null\n },\n })\n\n const translationSignature = React.useMemo(() => JSON.stringify(translationData ?? null), [translationData])\n const lastTranslationSignatureRef = React.useRef<string | null>(null)\n\n React.useEffect(() => {\n const sig = translationSignature\n if (sig === lastTranslationSignatureRef.current && hasUserEditedRef.current) return\n lastTranslationSignatureRef.current = sig\n\n if (!translationData?.translations) {\n if (!hasUserEditedRef.current) {\n editedTranslationsRef.current = {}\n setEditedTranslations({})\n }\n return\n }\n\n const parsed: Record<string, Record<string, string>> = {}\n for (const [locale, fields] of Object.entries(translationData.translations)) {\n if (!fields || typeof fields !== 'object') continue\n parsed[locale] = {}\n for (const [key, val] of Object.entries(fields)) {\n parsed[locale][key] = typeof val === 'string' ? val : ''\n }\n }\n if (!hasUserEditedRef.current) {\n editedTranslationsRef.current = parsed\n setEditedTranslations(parsed)\n }\n }, [translationSignature, translationData])\n\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n formId: string\n entityType: string\n recordId: string\n resourceKind: string\n resourceId: string\n data: TranslationsResponse | null\n retryLastMutation: () => Promise<boolean>\n }>({ contextId: TRANSLATION_MUTATION_CONTEXT_ID })\n\n const mutation = useMutation({\n mutationFn: async () => {\n if (!entityType || !recordId) {\n throw new Error(t('translations.manager.errors.selectRecord', 'Select an entity and record before saving'))\n }\n const body: Record<string, Record<string, string | null>> = {}\n for (const [locale, fields] of Object.entries(editedTranslationsRef.current)) {\n const localeFields: Record<string, string | null> = {}\n let hasValues = false\n for (const [key, val] of Object.entries(fields)) {\n if (val && val.trim().length > 0) {\n localeFields[key] = val.trim()\n hasValues = true\n }\n }\n if (hasValues) body[locale] = localeFields\n }\n if (Object.keys(body).length === 0) {\n console.warn('[translations] Save skipped: payload is empty \u2014 no locale contains any non-empty field')\n throw new Error(t('translations.manager.errors.nothingToSave', 'Nothing to save \u2014 enter a translation first'))\n }\n return runMutation({\n operation: async () => {\n const res = await withScopedApiRequestHeaders(\n buildOptimisticLockHeader(translationData?.updatedAt),\n () => apiCall(\n `/api/translations/${encodeURIComponent(entityType)}/${encodeURIComponent(recordId)}`,\n {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n },\n ),\n )\n if (!res.ok) {\n throw new Error(t('translations.manager.errors.save', 'Failed to save translations'))\n }\n return true\n },\n context: {\n formId: TRANSLATION_MUTATION_CONTEXT_ID,\n entityType,\n recordId,\n resourceKind: 'translation',\n resourceId: recordId,\n data: translationData ?? null,\n retryLastMutation,\n },\n mutationPayload: body,\n })\n },\n onSuccess: () => {\n flash(t('translations.manager.flash.saved', 'Translations saved'), 'success')\n hasUserEditedRef.current = false\n setHasUserEdited(false)\n void refetchTranslation()\n },\n onError: (err: unknown) => {\n const message = err instanceof Error ? err.message : t('translations.manager.errors.save', 'Failed to save translations')\n flash(message, 'error')\n },\n })\n\n const updateFieldValue = (locale: string, fieldKey: string, value: string) => {\n hasUserEditedRef.current = true\n setHasUserEdited(true)\n const next = {\n ...editedTranslationsRef.current,\n [locale]: {\n ...editedTranslationsRef.current[locale],\n [fieldKey]: value,\n },\n }\n editedTranslationsRef.current = next\n setEditedTranslations(next)\n }\n\n const getBaseValue = (fieldKey: string): string => resolveBaseValue(baseValues, fieldKey)\n\n const renderRecordPicker = () => {\n if (isEmbedded) return null\n\n return (\n <div className=\"space-y-2\">\n <label className=\"text-xs text-muted-foreground\">\n {t('translations.manager.selectRecord', 'Select record')}\n </label>\n <ComboboxInput\n value={selectedRecordId}\n onChange={(next) => {\n setSelectedRecordId(next)\n hasUserEditedRef.current = false\n setHasUserEdited(false)\n }}\n placeholder={t('translations.manager.searchRecords', 'Search records...')}\n loadSuggestions={loadRecordSuggestions}\n resolveLabel={resolveRecordLabel}\n allowCustomValues\n disabled={!entityType}\n />\n </div>\n )\n }\n\n const renderLocaleTabs = () => (\n <Tabs variant=\"underline\" value={activeLocale} onValueChange={setActiveLocale}>\n <TabsList>\n {locales.map((locale) => (\n <TabsTrigger key={locale} value={locale}>\n {locale.toUpperCase()}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n )\n\n const renderFieldTable = () => {\n if (!entityType || !recordId) {\n return (\n <div className=\"rounded border bg-background/80 p-4 text-sm text-muted-foreground\">\n {t('translations.manager.selectFirst', 'Select an entity and record to manage translations.')}\n </div>\n )\n }\n if (loadingTranslation || loadingFieldDefs) {\n return (\n <LoadingMessage\n label={t('translations.manager.loadingTranslations', 'Loading translations...')}\n className=\"border-0 bg-transparent p-4\"\n />\n )\n }\n if (translationError) {\n return (\n <ErrorMessage\n label={t('translations.manager.errors.loadTranslation', 'Failed to load translations')}\n action={(\n <Button variant=\"outline\" size=\"sm\" onClick={() => void refetchTranslation()}>\n {t('translations.manager.actions.retry', 'Retry')}\n </Button>\n )}\n />\n )\n }\n if (!fieldList.length) {\n return (\n <div className=\"rounded border bg-background/80 p-4 text-sm text-muted-foreground\">\n {t('translations.manager.noFields', 'No translatable fields found for this entity type.')}\n </div>\n )\n }\n\n const localeTranslations = editedTranslations[activeLocale] ?? {}\n\n return (\n <div className=\"overflow-x-auto\">\n <table className=\"w-full min-w-[480px] text-sm\">\n <thead>\n <tr className=\"text-xs uppercase tracking-wide text-muted-foreground\">\n <th className=\"px-3 py-2 text-left w-[140px]\">\n {t('translations.manager.fields.field', 'Field')}\n </th>\n {!compact && (\n <th className=\"px-3 py-2 text-left\">\n {t('translations.manager.fields.baseValue', 'Base value')}\n </th>\n )}\n <th className=\"px-3 py-2 text-left\">\n {t('translations.manager.fields.translation', 'Translation')} ({activeLocale.toUpperCase()})\n </th>\n </tr>\n </thead>\n <tbody>\n {fieldList.map((field) => {\n const baseVal = getBaseValue(field.key)\n const translatedVal = localeTranslations[field.key] ?? ''\n\n return (\n <tr key={field.key} className=\"border-t\">\n <td className=\"px-3 py-2 align-top text-xs font-medium text-muted-foreground\">\n {field.label}\n </td>\n {!compact && (\n <td className=\"px-3 py-2 align-top text-xs text-muted-foreground max-w-[200px]\">\n {baseVal ? (\n <span className=\"line-clamp-3\">{baseVal}</span>\n ) : (\n <span className=\"text-muted-foreground/50\">-</span>\n )}\n </td>\n )}\n <td className=\"px-3 py-2 align-top\">\n {field.multiline ? (\n <textarea\n className=\"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\"\n rows={3}\n value={translatedVal}\n onChange={(e) => updateFieldValue(activeLocale, field.key, e.target.value)}\n placeholder={baseVal || field.label}\n />\n ) : (\n <Input\n value={translatedVal}\n onChange={(e) => updateFieldValue(activeLocale, field.key, e.target.value)}\n placeholder={baseVal || field.label}\n />\n )}\n </td>\n </tr>\n )\n })}\n </tbody>\n </table>\n </div>\n )\n }\n\n React.useEffect(() => {\n const handler = (e: KeyboardEvent) => {\n if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') {\n e.preventDefault()\n if (entityType && recordId && !mutation.isPending) mutation.mutate()\n }\n }\n document.addEventListener('keydown', handler)\n return () => document.removeEventListener('keydown', handler)\n }, [entityType, recordId, mutation])\n\n if (compact) {\n return (\n <div className=\"space-y-3\">\n {renderLocaleTabs()}\n {renderFieldTable()}\n <div className=\"flex justify-end\">\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => mutation.mutate()}\n disabled={mutation.isPending || !entityType || !recordId}\n data-testid=\"translations-save\"\n >\n <Save className=\"mr-2 h-3 w-3\" />\n {mutation.isPending\n ? t('translations.manager.actions.saving', 'Saving...')\n : t('translations.manager.actions.save', 'Save translations')}\n </Button>\n </div>\n </div>\n )\n }\n\n return (\n <div className=\"space-y-6\">\n <div className=\"flex flex-col gap-3 rounded-lg border bg-card p-4 shadow-sm\">\n <div className=\"space-y-2\">\n <h2 className=\"text-xl font-semibold\">{t('translations.manager.title', 'Translations')}</h2>\n <p className=\"text-sm text-muted-foreground\">\n {t('translations.manager.description', 'Manage translations for entity records across supported locales.')}\n </p>\n </div>\n\n {!isEmbedded && (\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-start\">\n <div className=\"flex-1 space-y-3\">\n <div>\n <label className=\"text-xs text-muted-foreground\">\n {t('translations.manager.selectEntity', 'Choose entity')}\n </label>\n <div className=\"mt-1\">\n <ComboboxInput\n value={selectedEntityType}\n onChange={(next) => {\n setSelectedEntityType(next)\n setSelectedRecordId('')\n hasUserEditedRef.current = false\n setHasUserEdited(false)\n }}\n placeholder={t('translations.manager.placeholder', 'Select an entity')}\n suggestions={entitySuggestions}\n resolveLabel={resolveEntityLabel}\n disabled={loadingEntities || !!entitiesError}\n />\n </div>\n {entitiesError && (\n <p className=\"mt-1 text-xs text-destructive\">\n {t('translations.manager.errors.loadEntities', 'Failed to load entities')}\n </p>\n )}\n </div>\n {renderRecordPicker()}\n </div>\n </div>\n )}\n\n <div className=\"rounded-lg border bg-background/80 p-4\">\n {renderLocaleTabs()}\n <div className=\"mt-3\">\n {renderFieldTable()}\n </div>\n </div>\n\n <div className=\"flex justify-end\">\n <Button\n type=\"button\"\n onClick={() => mutation.mutate()}\n disabled={mutation.isPending || loadingEntities || !!entitiesError || !entityType || !recordId}\n data-testid=\"translations-save\"\n >\n <Save className=\"mr-2 h-4 w-4\" />\n {mutation.isPending\n ? t('translations.manager.actions.saving', 'Saving...')\n : t('translations.manager.actions.save', 'Save translations')}\n </Button>\n </div>\n </div>\n </div>\n )\n}\n\nexport function LocaleManager() {\n const t = useT()\n const queryClient = useQueryClient()\n const { data: locales = [], isLoading } = useTranslationLocales()\n const [newLocale, setNewLocale] = React.useState('')\n\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n formId: string\n resourceKind: string\n retryLastMutation: () => Promise<boolean>\n }>({ contextId: SUPPORTED_LOCALES_MUTATION_CONTEXT_ID })\n\n const mutation = useMutation({\n mutationFn: async (updatedLocales: string[]) => {\n // optimistic-lock-exempt: single-row tenant supported-locales settings list \u2014 no per-record version / concurrent record edit\n return runMutation({\n operation: async () => {\n const res = await apiCall<{ locales: string[] }>('/api/translations/locales', {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ locales: updatedLocales }),\n })\n if (!res.ok) throw new Error('Failed to save locales')\n return res.result?.locales ?? updatedLocales\n },\n context: {\n formId: SUPPORTED_LOCALES_MUTATION_CONTEXT_ID,\n resourceKind: 'translation-locales',\n retryLastMutation,\n },\n mutationPayload: { locales: updatedLocales },\n })\n },\n onSuccess: (result) => {\n queryClient.setQueryData(['translation-locales'], result)\n flash(t('translations.locales.flash.saved', 'Locales updated'), 'success')\n },\n onError: () => {\n flash(t('translations.locales.flash.error', 'Failed to update locales'), 'error')\n },\n })\n\n const availableLocales = React.useMemo(\n () => ISO_639_1.filter((entry) => !locales.includes(entry.code)).map((entry) => ({\n value: entry.code,\n label: `${entry.code.toUpperCase()} \u2014 ${entry.label}`,\n })),\n [locales],\n )\n\n const addLocale = () => {\n const code = newLocale.toLowerCase().trim()\n if (!code || !isValidIso639(code) || locales.includes(code)) return\n mutation.mutate([...locales, code])\n setNewLocale('')\n }\n\n const removeLocale = (locale: string) => {\n if (locales.length <= 1) return\n mutation.mutate(locales.filter((l) => l !== locale))\n }\n\n if (isLoading) {\n return <LoadingMessage label={t('translations.locales.loading', 'Loading locales...')} className=\"border-0 bg-transparent p-4\" />\n }\n\n return (\n <div className=\"flex flex-col gap-3 rounded-lg border bg-card p-4 shadow-sm\">\n <div className=\"space-y-1\">\n <h3 className=\"text-lg font-semibold\">{t('translations.locales.title', 'Supported locales')}</h3>\n <p className=\"text-sm text-muted-foreground\">\n {t('translations.locales.description', 'Configure which locales are available for translations. Add ISO language codes (e.g. fr, it, ja, zh).')}\n </p>\n </div>\n\n <div className=\"flex flex-wrap gap-2\">\n {locales.map((locale) => (\n <span\n key={locale}\n className=\"inline-flex items-center gap-1.5 rounded-full border bg-muted/50 px-3 py-1 text-sm font-medium\"\n title={getIso639Label(locale) ?? locale}\n >\n {locale.toUpperCase()}{getIso639Label(locale) ? ` \u2014 ${getIso639Label(locale)}` : ''}\n {locales.length > 1 && (\n <IconButton\n variant=\"ghost\"\n size=\"xs\"\n fullRadius\n aria-label={t('translations.locales.remove', 'Remove {{locale}}', { locale: getIso639Label(locale) ?? locale.toUpperCase() })}\n title={t('translations.locales.remove', 'Remove {{locale}}', { locale: getIso639Label(locale) ?? locale.toUpperCase() })}\n onClick={() => removeLocale(locale)}\n disabled={mutation.isPending}\n >\n <X className=\"h-3 w-3\" />\n </IconButton>\n )}\n </span>\n ))}\n </div>\n\n <div className=\"flex gap-2 items-center\">\n <div className=\"max-w-[240px] flex-1\">\n <ComboboxInput\n value={newLocale}\n onChange={setNewLocale}\n placeholder={t('translations.locales.addPlaceholder', 'Search language...')}\n suggestions={availableLocales}\n resolveLabel={(value) => {\n const label = getIso639Label(value)\n return label ? `${value.toUpperCase()} \u2014 ${label}` : value.toUpperCase()\n }}\n />\n </div>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={addLocale}\n disabled={mutation.isPending || !newLocale.trim() || !isValidIso639(newLocale) || locales.includes(newLocale.toLowerCase().trim())}\n >\n <Plus className=\"mr-1 h-3 w-3\" />\n {t('translations.locales.add', 'Add')}\n </Button>\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA+TM,SACE,KADF;AA7TN,YAAY,WAAW;AACvB,SAAS,UAAU,aAAa,sBAAsB;AACtD,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,MAAM,UAAU,mBAAmB;AAC5C,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,aAAa;AACtB,SAAS,SAAS,sBAAsB,mCAAmC;AAC3E,SAAS,iCAAiC;AAC1C,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,MAAM,MAAM,SAAS;AAC9B,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB,SAAS,WAAW,sBAAsB;AAC1C,SAAS,WAAW,eAAe,sBAAsB;AACzD,SAAS,mBAAmB,oBAAoB,gBAAgB,wBAAwB;AACxF,SAAS,wBAAwB;AAGjC,MAAM,kCAAkC;AACxC,MAAM,wCAAwC;AAqB9C,SAAS,wBAAwB;AAC/B,SAAO,SAAmB;AAAA,IACxB,UAAU,CAAC,qBAAqB;AAAA,IAChC,SAAS,YAAY;AACnB,YAAM,MAAM,MAAM,QAA+B,2BAA2B;AAC5E,UAAI,CAAC,IAAI,GAAI,QAAO,CAAC,GAAG,cAAc;AACtC,aAAO,MAAM,QAAQ,IAAI,QAAQ,OAAO,KAAK,IAAI,OAAO,QAAQ,SAAS,IACrE,IAAI,OAAO,UACX,CAAC,GAAG,cAAc;AAAA,IACxB;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACH;AAEO,SAAS,mBAAmB;AAAA,EACjC,YAAY;AAAA,EACZ,UA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+1,8 @@
|
|
|
1
|
+
export const id = "id";
|
|
2
|
+
export const provider_key = "provider_key";
|
|
3
|
+
export const idempotency_key = "idempotency_key";
|
|
4
|
+
export const request_hash = "request_hash";
|
|
5
|
+
export const shipment_id = "shipment_id";
|
|
6
|
+
export const organization_id = "organization_id";
|
|
7
|
+
export const tenant_id = "tenant_id";
|
|
8
|
+
export const created_at = "created_at";
|
|
@@ -271,7 +271,8 @@ export const M = {
|
|
|
271
271
|
},
|
|
272
272
|
"shipping_carriers": {
|
|
273
273
|
"carrier_shipment": "shipping_carriers:carrier_shipment",
|
|
274
|
-
"carrier_webhook_processed_event": "shipping_carriers:carrier_webhook_processed_event"
|
|
274
|
+
"carrier_webhook_processed_event": "shipping_carriers:carrier_webhook_processed_event",
|
|
275
|
+
"carrier_shipment_idempotency_key": "shipping_carriers:carrier_shipment_idempotency_key"
|
|
275
276
|
},
|
|
276
277
|
"customer_accounts": {
|
|
277
278
|
"customer_user": "customer_accounts:customer_user",
|
|
@@ -138,6 +138,16 @@ export const entityFieldsRegistry: Record<string, Record<string, string>> = {
|
|
|
138
138
|
"updated_at": "updated_at",
|
|
139
139
|
"deleted_at": "deleted_at"
|
|
140
140
|
},
|
|
141
|
+
"carrier_shipment_idempotency_key": {
|
|
142
|
+
"id": "id",
|
|
143
|
+
"provider_key": "provider_key",
|
|
144
|
+
"idempotency_key": "idempotency_key",
|
|
145
|
+
"request_hash": "request_hash",
|
|
146
|
+
"shipment_id": "shipment_id",
|
|
147
|
+
"organization_id": "organization_id",
|
|
148
|
+
"tenant_id": "tenant_id",
|
|
149
|
+
"created_at": "created_at"
|
|
150
|
+
},
|
|
141
151
|
"carrier_webhook_processed_event": {
|
|
142
152
|
"id": "id",
|
|
143
153
|
"provider_key": "provider_key",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/core",
|
|
3
|
-
"version": "0.6.6-develop.
|
|
3
|
+
"version": "0.6.6-develop.6286.1.d985c5c374",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -246,16 +246,16 @@
|
|
|
246
246
|
"zod": "^4.4.3"
|
|
247
247
|
},
|
|
248
248
|
"peerDependencies": {
|
|
249
|
-
"@open-mercato/ai-assistant": "0.6.6-develop.
|
|
250
|
-
"@open-mercato/shared": "0.6.6-develop.
|
|
251
|
-
"@open-mercato/ui": "0.6.6-develop.
|
|
249
|
+
"@open-mercato/ai-assistant": "0.6.6-develop.6286.1.d985c5c374",
|
|
250
|
+
"@open-mercato/shared": "0.6.6-develop.6286.1.d985c5c374",
|
|
251
|
+
"@open-mercato/ui": "0.6.6-develop.6286.1.d985c5c374",
|
|
252
252
|
"react": "^19.0.0",
|
|
253
253
|
"react-dom": "^19.0.0"
|
|
254
254
|
},
|
|
255
255
|
"devDependencies": {
|
|
256
|
-
"@open-mercato/ai-assistant": "0.6.6-develop.
|
|
257
|
-
"@open-mercato/shared": "0.6.6-develop.
|
|
258
|
-
"@open-mercato/ui": "0.6.6-develop.
|
|
256
|
+
"@open-mercato/ai-assistant": "0.6.6-develop.6286.1.d985c5c374",
|
|
257
|
+
"@open-mercato/shared": "0.6.6-develop.6286.1.d985c5c374",
|
|
258
|
+
"@open-mercato/ui": "0.6.6-develop.6286.1.d985c5c374",
|
|
259
259
|
"@testing-library/dom": "^10.4.1",
|
|
260
260
|
"@testing-library/jest-dom": "^6.9.1",
|
|
261
261
|
"@testing-library/react": "^16.3.1",
|
|
@@ -271,7 +271,8 @@
|
|
|
271
271
|
"jest-environment-jsdom": "^30.4.1",
|
|
272
272
|
"react": "19.2.7",
|
|
273
273
|
"react-dom": "19.2.7",
|
|
274
|
-
"ts-jest": "^29.4.11"
|
|
274
|
+
"ts-jest": "^29.4.11",
|
|
275
|
+
"typescript": "^6.0.3"
|
|
275
276
|
},
|
|
276
277
|
"publishConfig": {
|
|
277
278
|
"access": "public"
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
2
|
+
import { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
3
|
+
import { CatalogProduct } from '../data/entities'
|
|
4
|
+
|
|
5
|
+
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
|
|
6
|
+
|
|
7
|
+
export type ResolveCatalogProductLookup = {
|
|
8
|
+
sku?: string | null
|
|
9
|
+
externalId?: string | null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ResolveCatalogProductScope = {
|
|
13
|
+
organizationId: string
|
|
14
|
+
tenantId: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function normalizeLookupValue(value: string | null | undefined): string {
|
|
18
|
+
return typeof value === 'string' ? value.trim() : ''
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Public seam for cross-module callers (e.g. the `sync_magento` order mapper) to look up a
|
|
23
|
+
* {@link CatalogProduct} without reaching into the catalog ORM directly. Uses
|
|
24
|
+
* `findOneWithDecryption` so encrypted product fields are respected, and always scopes the query by
|
|
25
|
+
* `organizationId` + `tenantId` plus `deletedAt: null`.
|
|
26
|
+
*
|
|
27
|
+
* Catalog does not store a foreign external id on the product — those mappings live per-integration
|
|
28
|
+
* in `SyncExternalIdMapping` (data_sync) and resolve to the local OM product id. `externalId` here is
|
|
29
|
+
* therefore matched against the OM product `id` (the value an external→local mapping yields) and only
|
|
30
|
+
* when it is a valid UUID, so a stray non-UUID value falls through to the SKU lookup instead of
|
|
31
|
+
* raising a Postgres uuid-cast error. When both identifiers are supplied the `externalId` match takes
|
|
32
|
+
* precedence, mirroring the mapping-first/SKU-fallback order used by the existing sync importers.
|
|
33
|
+
*/
|
|
34
|
+
export async function resolveProductBySkuOrExternalId(
|
|
35
|
+
em: EntityManager,
|
|
36
|
+
lookup: ResolveCatalogProductLookup,
|
|
37
|
+
scope: ResolveCatalogProductScope,
|
|
38
|
+
): Promise<CatalogProduct | null> {
|
|
39
|
+
const externalId = normalizeLookupValue(lookup.externalId)
|
|
40
|
+
const sku = normalizeLookupValue(lookup.sku)
|
|
41
|
+
if (!externalId && !sku) return null
|
|
42
|
+
|
|
43
|
+
if (externalId && UUID_REGEX.test(externalId)) {
|
|
44
|
+
const byExternalId = await findOneWithDecryption(
|
|
45
|
+
em,
|
|
46
|
+
CatalogProduct,
|
|
47
|
+
{
|
|
48
|
+
id: externalId,
|
|
49
|
+
organizationId: scope.organizationId,
|
|
50
|
+
tenantId: scope.tenantId,
|
|
51
|
+
deletedAt: null,
|
|
52
|
+
},
|
|
53
|
+
undefined,
|
|
54
|
+
scope,
|
|
55
|
+
)
|
|
56
|
+
if (byExternalId) return byExternalId
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (sku) {
|
|
60
|
+
return findOneWithDecryption(
|
|
61
|
+
em,
|
|
62
|
+
CatalogProduct,
|
|
63
|
+
{
|
|
64
|
+
sku,
|
|
65
|
+
organizationId: scope.organizationId,
|
|
66
|
+
tenantId: scope.tenantId,
|
|
67
|
+
deletedAt: null,
|
|
68
|
+
},
|
|
69
|
+
undefined,
|
|
70
|
+
scope,
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return null
|
|
75
|
+
}
|
|
@@ -161,7 +161,7 @@ export default async function handle(
|
|
|
161
161
|
// enforced by the schema, so this only trips on adapter bugs.
|
|
162
162
|
const MAX_PAGES = 100
|
|
163
163
|
for (let pageIndex = 0; pageIndex < MAX_PAGES; pageIndex += 1) {
|
|
164
|
-
if (await progressService.isCancellationRequested(progressJobId, scope.tenantId)) {
|
|
164
|
+
if (await progressService.isCancellationRequested(progressJobId, scope.tenantId, scope.organizationId)) {
|
|
165
165
|
await progressService.markCancelled(progressJobId, progressContext)
|
|
166
166
|
return
|
|
167
167
|
}
|
|
@@ -4,6 +4,8 @@ import { z } from 'zod'
|
|
|
4
4
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
5
5
|
import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
6
6
|
import { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'
|
|
7
|
+
import { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'
|
|
8
|
+
import { enforceCommandOptimisticLock } from '@open-mercato/shared/lib/crud/optimistic-lock-command'
|
|
7
9
|
import { CurrencyFetchConfig } from '../../data/entities'
|
|
8
10
|
import {
|
|
9
11
|
createFetchConfig,
|
|
@@ -107,6 +109,20 @@ export async function PUT(req: NextRequest) {
|
|
|
107
109
|
return NextResponse.json({ error: 'ID required' }, { status: 400 })
|
|
108
110
|
}
|
|
109
111
|
|
|
112
|
+
const existing = await em.findOne(CurrencyFetchConfig, {
|
|
113
|
+
id,
|
|
114
|
+
tenantId: auth.tenantId,
|
|
115
|
+
organizationId: auth.orgId,
|
|
116
|
+
})
|
|
117
|
+
if (existing) {
|
|
118
|
+
enforceCommandOptimisticLock({
|
|
119
|
+
resourceKind: 'currencies.currency_fetch_config',
|
|
120
|
+
resourceId: existing.id,
|
|
121
|
+
current: existing.updatedAt ?? null,
|
|
122
|
+
request: req,
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
|
|
110
126
|
const config = await updateFetchConfig(em, id, data, {
|
|
111
127
|
tenantId: auth.tenantId,
|
|
112
128
|
organizationId: auth.orgId,
|
|
@@ -115,6 +131,9 @@ export async function PUT(req: NextRequest) {
|
|
|
115
131
|
|
|
116
132
|
return NextResponse.json({ config })
|
|
117
133
|
} catch (err: any) {
|
|
134
|
+
if (isCrudHttpError(err)) {
|
|
135
|
+
return NextResponse.json(err.body, { status: err.status })
|
|
136
|
+
}
|
|
118
137
|
return NextResponse.json({ error: err.message }, { status: 400 })
|
|
119
138
|
} finally {
|
|
120
139
|
await (container as any).dispose?.()
|
|
@@ -138,6 +157,20 @@ export async function DELETE(req: NextRequest) {
|
|
|
138
157
|
return NextResponse.json({ error: 'ID required' }, { status: 400 })
|
|
139
158
|
}
|
|
140
159
|
|
|
160
|
+
const existing = await em.findOne(CurrencyFetchConfig, {
|
|
161
|
+
id,
|
|
162
|
+
tenantId: auth.tenantId,
|
|
163
|
+
organizationId: auth.orgId,
|
|
164
|
+
})
|
|
165
|
+
if (existing) {
|
|
166
|
+
enforceCommandOptimisticLock({
|
|
167
|
+
resourceKind: 'currencies.currency_fetch_config',
|
|
168
|
+
resourceId: existing.id,
|
|
169
|
+
current: existing.updatedAt ?? null,
|
|
170
|
+
request: req,
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
141
174
|
await deleteFetchConfig(em, id, {
|
|
142
175
|
tenantId: auth.tenantId,
|
|
143
176
|
organizationId: auth.orgId,
|
|
@@ -146,6 +179,9 @@ export async function DELETE(req: NextRequest) {
|
|
|
146
179
|
|
|
147
180
|
return NextResponse.json({ success: true })
|
|
148
181
|
} catch (err: any) {
|
|
182
|
+
if (isCrudHttpError(err)) {
|
|
183
|
+
return NextResponse.json(err.body, { status: err.status })
|
|
184
|
+
}
|
|
149
185
|
return NextResponse.json({ error: err.message }, { status: 400 })
|
|
150
186
|
} finally {
|
|
151
187
|
await (container as any).dispose?.()
|
|
@@ -8,6 +8,9 @@ import { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuarde
|
|
|
8
8
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
9
9
|
import { Spinner } from '@open-mercato/ui/primitives/spinner'
|
|
10
10
|
import { Switch } from '@open-mercato/ui/primitives/switch'
|
|
11
|
+
import { StatusBadge, type StatusBadgeVariant } from '@open-mercato/ui/primitives/status-badge'
|
|
12
|
+
import { Alert } from '@open-mercato/ui/primitives/alert'
|
|
13
|
+
import { TimeInput } from '@open-mercato/ui/backend/inputs/TimeInput'
|
|
11
14
|
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
12
15
|
|
|
13
16
|
interface FetchConfig {
|
|
@@ -22,6 +25,12 @@ interface FetchConfig {
|
|
|
22
25
|
updatedAt?: string | null
|
|
23
26
|
}
|
|
24
27
|
|
|
28
|
+
const STATUS_BADGE_VARIANT: Record<string, StatusBadgeVariant> = {
|
|
29
|
+
success: 'success',
|
|
30
|
+
error: 'error',
|
|
31
|
+
partial: 'warning',
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
export default function CurrencyFetchingConfig() {
|
|
26
35
|
const t = useT()
|
|
27
36
|
const [configs, setConfigs] = useState<FetchConfig[]>([])
|
|
@@ -238,7 +247,7 @@ export default function CurrencyFetchingConfig() {
|
|
|
238
247
|
if (count === 0) {
|
|
239
248
|
flash(t('currencies.fetch.sync_no_rates'), 'warning')
|
|
240
249
|
} else {
|
|
241
|
-
flash(
|
|
250
|
+
flash(t('currencies.fetch.sync_success', { count }), 'success')
|
|
242
251
|
}
|
|
243
252
|
await loadConfigs()
|
|
244
253
|
}
|
|
@@ -254,23 +263,17 @@ export default function CurrencyFetchingConfig() {
|
|
|
254
263
|
}, [loadConfigs])
|
|
255
264
|
|
|
256
265
|
function formatLastSync(date: string | null): string {
|
|
257
|
-
if (!date) return '
|
|
266
|
+
if (!date) return t('currencies.fetch.last_sync_never')
|
|
258
267
|
return new Date(date).toLocaleString()
|
|
259
268
|
}
|
|
260
269
|
|
|
261
270
|
function getStatusBadge(status: string | null) {
|
|
262
271
|
if (!status) return null
|
|
263
272
|
|
|
264
|
-
const styles: Record<string, string> = {
|
|
265
|
-
success: 'bg-green-100 text-green-800 px-2 py-1 rounded text-xs',
|
|
266
|
-
error: 'bg-red-100 text-red-800 px-2 py-1 rounded text-xs',
|
|
267
|
-
partial: 'bg-yellow-100 text-yellow-800 px-2 py-1 rounded text-xs',
|
|
268
|
-
}
|
|
269
|
-
|
|
270
273
|
return (
|
|
271
|
-
<
|
|
274
|
+
<StatusBadge variant={STATUS_BADGE_VARIANT[status] ?? 'neutral'}>
|
|
272
275
|
{status}
|
|
273
|
-
</
|
|
276
|
+
</StatusBadge>
|
|
274
277
|
)
|
|
275
278
|
}
|
|
276
279
|
|
|
@@ -345,11 +348,9 @@ export default function CurrencyFetchingConfig() {
|
|
|
345
348
|
<label className="text-xs text-muted-foreground whitespace-nowrap">
|
|
346
349
|
{t('currencies.fetch.sync_time')}:
|
|
347
350
|
</label>
|
|
348
|
-
<
|
|
349
|
-
type="time"
|
|
351
|
+
<TimeInput
|
|
350
352
|
value={config.syncTime || '09:00'}
|
|
351
|
-
onChange={(
|
|
352
|
-
className="rounded border bg-background px-2 py-1.5 text-sm"
|
|
353
|
+
onChange={(time) => updateSyncTime(config.id, time, config.updatedAt)}
|
|
353
354
|
/>
|
|
354
355
|
</div>
|
|
355
356
|
|
|
@@ -364,6 +365,7 @@ export default function CurrencyFetchingConfig() {
|
|
|
364
365
|
</div>
|
|
365
366
|
|
|
366
367
|
<Button
|
|
368
|
+
type="button"
|
|
367
369
|
onClick={() => fetchNow(config.provider)}
|
|
368
370
|
disabled={fetching === config.provider}
|
|
369
371
|
size="default"
|
|
@@ -382,14 +384,14 @@ export default function CurrencyFetchingConfig() {
|
|
|
382
384
|
|
|
383
385
|
{config.lastSyncCount !== null && (
|
|
384
386
|
<div className="text-xs text-muted-foreground mt-2">
|
|
385
|
-
{t('currencies.fetch.last_sync_count')}: <span className="font-medium">{config.lastSyncCount}</span>
|
|
387
|
+
{t('currencies.fetch.last_sync_count')}: <span className="font-medium">{config.lastSyncCount}</span>
|
|
386
388
|
</div>
|
|
387
389
|
)}
|
|
388
390
|
|
|
389
391
|
{config.lastSyncMessage && config.lastSyncStatus === 'error' && (
|
|
390
|
-
<
|
|
392
|
+
<Alert status="error" style="lighter" size="xs" className="mt-2">
|
|
391
393
|
{config.lastSyncMessage}
|
|
392
|
-
</
|
|
394
|
+
</Alert>
|
|
393
395
|
)}
|
|
394
396
|
</>
|
|
395
397
|
)}
|
|
@@ -402,6 +404,7 @@ export default function CurrencyFetchingConfig() {
|
|
|
402
404
|
{t('currencies.fetch.no_providers')}
|
|
403
405
|
</p>
|
|
404
406
|
<Button
|
|
407
|
+
type="button"
|
|
405
408
|
onClick={() => initializeMissingProviders(availableProviders)}
|
|
406
409
|
>
|
|
407
410
|
{t('currencies.fetch.initialize_providers')}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"currencies.fetch.initializing_providers": "Anbieter werden initialisiert...",
|
|
20
20
|
"currencies.fetch.last_sync": "Letzte Synchronisation",
|
|
21
21
|
"currencies.fetch.last_sync_count": "Abgerufene Kurse",
|
|
22
|
+
"currencies.fetch.last_sync_never": "Nie",
|
|
22
23
|
"currencies.fetch.last_sync_status": "Status",
|
|
23
24
|
"currencies.fetch.loading": "Wird geladen...",
|
|
24
25
|
"currencies.fetch.no_providers": "Noch keine Währungsanbieter konfiguriert.",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"currencies.fetch.provider_raiffeisen_description": "4 Hauptwährungen (EUR, USD, CHF, GBP) mit Kauf-/Verkaufskursen",
|
|
31
32
|
"currencies.fetch.sync_error": "Fehler beim Abrufen der Kurse",
|
|
32
33
|
"currencies.fetch.sync_no_rates": "Kein Kurs abgerufen. Sie haben keine Währungen definiert, bitte erstellen Sie die Paare, die Sie abrufen möchten",
|
|
33
|
-
"currencies.fetch.sync_success": "Kurse erfolgreich abgerufen",
|
|
34
|
+
"currencies.fetch.sync_success": "Kurse erfolgreich abgerufen: {{count}}",
|
|
34
35
|
"currencies.fetch.sync_time": "Tägliche Synchronisierungszeit",
|
|
35
36
|
"currencies.fetch.title": "Währungskurs-Abruf",
|
|
36
37
|
"currencies.flash.baseSet": "Basiswährung erfolgreich aktualisiert",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"currencies.fetch.initializing_providers": "Initializing providers...",
|
|
20
20
|
"currencies.fetch.last_sync": "Last Sync",
|
|
21
21
|
"currencies.fetch.last_sync_count": "Rates Fetched",
|
|
22
|
+
"currencies.fetch.last_sync_never": "Never",
|
|
22
23
|
"currencies.fetch.last_sync_status": "Status",
|
|
23
24
|
"currencies.fetch.loading": "Loading...",
|
|
24
25
|
"currencies.fetch.no_providers": "No currency providers configured yet.",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"currencies.fetch.provider_raiffeisen_description": "4 major currencies (EUR, USD, CHF, GBP) with buy/sell rates",
|
|
31
32
|
"currencies.fetch.sync_error": "Failed to fetch rates",
|
|
32
33
|
"currencies.fetch.sync_no_rates": "No rate fetched. You've got no currencies defined, please create the pairs you want to fetch",
|
|
33
|
-
"currencies.fetch.sync_success": "Rates fetched successfully",
|
|
34
|
+
"currencies.fetch.sync_success": "Rates fetched successfully: {{count}}",
|
|
34
35
|
"currencies.fetch.sync_time": "Daily Sync Time",
|
|
35
36
|
"currencies.fetch.title": "Currency Rate Fetching",
|
|
36
37
|
"currencies.flash.baseSet": "Base currency updated successfully",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"currencies.fetch.initializing_providers": "Inicializando proveedores...",
|
|
20
20
|
"currencies.fetch.last_sync": "Última Sincronización",
|
|
21
21
|
"currencies.fetch.last_sync_count": "Tipos Obtenidos",
|
|
22
|
+
"currencies.fetch.last_sync_never": "Nunca",
|
|
22
23
|
"currencies.fetch.last_sync_status": "Estado",
|
|
23
24
|
"currencies.fetch.loading": "Cargando...",
|
|
24
25
|
"currencies.fetch.no_providers": "Aún no hay proveedores de monedas configurados.",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"currencies.fetch.provider_raiffeisen_description": "4 monedas principales (EUR, USD, CHF, GBP) con tipos de compra/venta",
|
|
31
32
|
"currencies.fetch.sync_error": "Error al obtener tipos",
|
|
32
33
|
"currencies.fetch.sync_no_rates": "No se obtuvo ningún tipo. No tiene monedas definidas, por favor cree los pares que desea obtener",
|
|
33
|
-
"currencies.fetch.sync_success": "Tipos obtenidos correctamente",
|
|
34
|
+
"currencies.fetch.sync_success": "Tipos obtenidos correctamente: {{count}}",
|
|
34
35
|
"currencies.fetch.sync_time": "Hora de Sincronización Diaria",
|
|
35
36
|
"currencies.fetch.title": "Obtención de Tipos de Cambio",
|
|
36
37
|
"currencies.flash.baseSet": "Moneda base actualizada correctamente",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"currencies.fetch.initializing_providers": "Inicjalizacja dostawców...",
|
|
20
20
|
"currencies.fetch.last_sync": "Ostatnia Synchronizacja",
|
|
21
21
|
"currencies.fetch.last_sync_count": "Pobrane Kursy",
|
|
22
|
+
"currencies.fetch.last_sync_never": "Nigdy",
|
|
22
23
|
"currencies.fetch.last_sync_status": "Status",
|
|
23
24
|
"currencies.fetch.loading": "Ładowanie...",
|
|
24
25
|
"currencies.fetch.no_providers": "Nie skonfigurowano jeszcze żadnych dostawców walut.",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"currencies.fetch.provider_raiffeisen_description": "4 główne waluty (EUR, USD, CHF, GBP) z kursami kupna/sprzedaży",
|
|
31
32
|
"currencies.fetch.sync_error": "Nie udało się pobrać kursów",
|
|
32
33
|
"currencies.fetch.sync_no_rates": "Nie pobrano żadnego kursu. Nie masz zdefiniowanych walut, proszę utworzyć pary które chcesz pobrać",
|
|
33
|
-
"currencies.fetch.sync_success": "Kursy pobrane pomyślnie",
|
|
34
|
+
"currencies.fetch.sync_success": "Kursy pobrane pomyślnie: {{count}}",
|
|
34
35
|
"currencies.fetch.sync_time": "Dzienna Godzina Synchronizacji",
|
|
35
36
|
"currencies.fetch.title": "Pobieranie Kursów Walut",
|
|
36
37
|
"currencies.flash.baseSet": "Waluta bazowa zaktualizowana pomyślnie",
|