@open-mercato/core 0.6.6-develop.6515.1.01911d00e2 → 0.6.6-develop.6519.1.bdc91fb755
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 +1 -1
- package/dist/modules/configs/lib/upgrade-actions.js +31 -1
- package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
- package/dist/modules/customers/ai-tools/activities-tasks-pack.js +11 -2
- package/dist/modules/customers/ai-tools/activities-tasks-pack.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/route.js +3 -2
- package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
- package/dist/modules/customers/api/dictionaries/context.js +4 -2
- package/dist/modules/customers/api/dictionaries/context.js.map +2 -2
- package/dist/modules/customers/api/interactions/conflicts/route.js +2 -1
- package/dist/modules/customers/api/interactions/conflicts/route.js.map +2 -2
- package/dist/modules/customers/api/interactions/counts/route.js +7 -2
- package/dist/modules/customers/api/interactions/counts/route.js.map +2 -2
- package/dist/modules/customers/api/people/[id]/route.js +3 -2
- package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
- package/dist/modules/customers/cli.js +19 -0
- package/dist/modules/customers/cli.js.map +2 -2
- package/dist/modules/customers/commands/interactions.js +8 -3
- package/dist/modules/customers/commands/interactions.js.map +2 -2
- package/dist/modules/customers/commands/shared.js +2 -1
- package/dist/modules/customers/commands/shared.js.map +2 -2
- package/dist/modules/customers/components/DictionarySettings.js +5 -0
- package/dist/modules/customers/components/DictionarySettings.js.map +2 -2
- package/dist/modules/customers/components/DictionarySortSettings.js +5 -0
- package/dist/modules/customers/components/DictionarySortSettings.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivitiesCard.js +3 -2
- package/dist/modules/customers/components/detail/ActivitiesCard.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivityCard.js +2 -1
- package/dist/modules/customers/components/detail/ActivityCard.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivityTimeline.js +3 -2
- package/dist/modules/customers/components/detail/ActivityTimeline.js.map +2 -2
- package/dist/modules/customers/components/detail/TaskDialog.js +3 -2
- package/dist/modules/customers/components/detail/TaskDialog.js.map +2 -2
- package/dist/modules/customers/components/detail/TaskForm.js +170 -69
- package/dist/modules/customers/components/detail/TaskForm.js.map +2 -2
- package/dist/modules/customers/components/detail/TasksSection.js +27 -4
- package/dist/modules/customers/components/detail/TasksSection.js.map +2 -2
- package/dist/modules/customers/components/detail/hooks/usePersonTasks.js.map +2 -2
- package/dist/modules/customers/data/enrichers.js +2 -2
- package/dist/modules/customers/data/enrichers.js.map +2 -2
- package/dist/modules/customers/data/validators.js +6 -2
- package/dist/modules/customers/data/validators.js.map +2 -2
- package/dist/modules/customers/lib/dictionaries.js +2 -1
- package/dist/modules/customers/lib/dictionaries.js.map +2 -2
- package/dist/modules/customers/lib/interactionProjection.js +2 -1
- package/dist/modules/customers/lib/interactionProjection.js.map +2 -2
- package/dist/modules/customers/lib/interactionStatus.js +24 -0
- package/dist/modules/customers/lib/interactionStatus.js.map +7 -0
- package/dist/modules/customers/lib/link-channel-message-handler.js +4 -5
- package/dist/modules/customers/lib/link-channel-message-handler.js.map +2 -2
- package/dist/modules/dictionaries/components/AppearanceSelector.js +7 -3
- package/dist/modules/dictionaries/components/AppearanceSelector.js.map +2 -2
- package/dist/modules/dictionaries/components/DictionaryEntriesEditor.js +1 -0
- package/dist/modules/dictionaries/components/DictionaryEntriesEditor.js.map +2 -2
- package/package.json +7 -7
- package/src/modules/configs/lib/upgrade-actions.ts +31 -1
- package/src/modules/customers/ai-tools/activities-tasks-pack.ts +12 -3
- package/src/modules/customers/api/companies/[id]/route.ts +3 -2
- package/src/modules/customers/api/dictionaries/context.ts +2 -0
- package/src/modules/customers/api/interactions/conflicts/route.ts +2 -1
- package/src/modules/customers/api/interactions/counts/route.ts +7 -2
- package/src/modules/customers/api/people/[id]/route.ts +3 -2
- package/src/modules/customers/cli.ts +19 -0
- package/src/modules/customers/commands/interactions.ts +8 -3
- package/src/modules/customers/commands/shared.ts +1 -0
- package/src/modules/customers/components/DictionarySettings.tsx +5 -0
- package/src/modules/customers/components/DictionarySortSettings.tsx +5 -0
- package/src/modules/customers/components/detail/ActivitiesCard.tsx +3 -2
- package/src/modules/customers/components/detail/ActivityCard.tsx +2 -1
- package/src/modules/customers/components/detail/ActivityTimeline.tsx +3 -2
- package/src/modules/customers/components/detail/TaskDialog.tsx +4 -1
- package/src/modules/customers/components/detail/TaskForm.tsx +218 -71
- package/src/modules/customers/components/detail/TasksSection.tsx +28 -2
- package/src/modules/customers/components/detail/hooks/usePersonTasks.ts +1 -0
- package/src/modules/customers/data/enrichers.ts +2 -7
- package/src/modules/customers/data/validators.ts +16 -2
- package/src/modules/customers/i18n/de.json +10 -0
- package/src/modules/customers/i18n/en.json +10 -0
- package/src/modules/customers/i18n/es.json +10 -0
- package/src/modules/customers/i18n/pl.json +10 -0
- package/src/modules/customers/lib/dictionaries.ts +1 -0
- package/src/modules/customers/lib/interactionProjection.ts +6 -2
- package/src/modules/customers/lib/interactionStatus.ts +30 -0
- package/src/modules/customers/lib/link-channel-message-handler.ts +4 -5
- package/src/modules/dictionaries/components/AppearanceSelector.tsx +10 -1
- package/src/modules/dictionaries/components/DictionaryEntriesEditor.tsx +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/dictionaries/components/AppearanceSelector.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Ellipsis } from 'lucide-react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { ColorPicker } from '@open-mercato/ui/primitives/color-picker'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { ICON_LIBRARY, ICON_SUGGESTIONS, type IconOption, renderDictionaryColor, renderDictionaryIcon } from './dictionaryAppearance'\n\nexport type AppearanceSelectorLabels = {\n colorLabel: string\n colorHelp?: string\n colorClearLabel: string\n iconLabel: string\n iconPlaceholder: string\n iconPickerTriggerLabel: string\n iconSearchPlaceholder: string\n iconSearchEmptyLabel: string\n iconSuggestionsLabel: string\n iconClearLabel: string\n previewEmptyLabel: string\n}\n\ntype AppearanceSelectorProps = {\n icon: string | null | undefined\n color: string | null | undefined\n onIconChange: (next: string | null) => void\n onColorChange: (next: string | null) => void\n labels: AppearanceSelectorLabels\n disabled?: boolean\n iconSuggestions?: IconOption[]\n iconLibrary?: IconOption[]\n className?: string\n}\n\nconst ICON_PICKER_LIMIT = 240\n\nexport function AppearanceSelector({\n icon,\n color,\n onIconChange,\n onColorChange,\n labels,\n disabled = false,\n iconSuggestions = ICON_SUGGESTIONS,\n iconLibrary,\n className,\n}: AppearanceSelectorProps) {\n const normalizedIcon = icon ?? ''\n const normalizedColor = color ?? '#000000'\n const hasAppearance = Boolean(icon) || Boolean(color)\n const iconOptions = React.useMemo(() => (iconLibrary && iconLibrary.length ? iconLibrary : ICON_LIBRARY), [iconLibrary])\n const [pickerOpen, setPickerOpen] = React.useState(false)\n const [iconSearch, setIconSearch] = React.useState('')\n const pickerContainerRef = React.useRef<HTMLDivElement | null>(null)\n const searchInputRef = React.useRef<HTMLInputElement | null>(null)\n\n const closePicker = React.useCallback(() => {\n setPickerOpen(false)\n setIconSearch('')\n }, [])\n\n const handleIconSelection = React.useCallback(\n (next: string) => {\n onIconChange(next)\n closePicker()\n },\n [closePicker, onIconChange],\n )\n\n React.useEffect(() => {\n if (!pickerOpen) return\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (pickerContainerRef.current?.contains(target)) return\n closePicker()\n }\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') closePicker()\n }\n document.addEventListener('pointerdown', handlePointerDown)\n document.addEventListener('keydown', handleKeyDown)\n return () => {\n document.removeEventListener('pointerdown', handlePointerDown)\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [closePicker, pickerOpen])\n\n React.useEffect(() => {\n if (!pickerOpen) return\n const frame = window.requestAnimationFrame(() => {\n searchInputRef.current?.focus()\n searchInputRef.current?.select()\n })\n return () => window.cancelAnimationFrame(frame)\n }, [pickerOpen])\n\n React.useEffect(() => {\n if (!disabled) return\n closePicker()\n }, [closePicker, disabled])\n\n const filteredIcons = React.useMemo(() => {\n const term = iconSearch.trim().toLowerCase()\n if (!term) {\n return iconOptions.slice(0, ICON_PICKER_LIMIT)\n }\n const matches = iconOptions.filter((option) => {\n const haystack = [option.label, option.value, ...(option.keywords ?? [])].join(' ').toLowerCase()\n return haystack.includes(term)\n })\n return matches.slice(0, ICON_PICKER_LIMIT)\n }, [iconOptions, iconSearch])\n\n return (\n <div className={['space-y-4', className].filter(Boolean).join(' ')}>\n <div className=\"space-y-2\">\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n {labels.colorLabel}\n {labels.colorHelp ? <span className=\"text-xs font-normal text-muted-foreground\">{labels.colorHelp}</span> : null}\n </label>\n <div className=\"flex flex-wrap items-center gap-2\">\n <ColorPicker\n value={normalizedColor}\n onChange={(next) => onColorChange(next)}\n disabled={disabled}\n aria-label={labels.colorLabel}\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => onColorChange(null)}\n disabled={disabled || !color}\n >\n {labels.colorClearLabel}\n </Button>\n </div>\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">{labels.iconLabel}</label>\n <div ref={pickerContainerRef} className=\"relative\">\n <div className=\"flex gap-2\">\n <Input\n type=\"text\"\n value={normalizedIcon}\n onChange={(event) => onIconChange(event.target.value)}\n placeholder={labels.iconPlaceholder}\n className=\"flex-1\"\n disabled={disabled}\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n onClick={() => setPickerOpen((prev) => !prev)}\n aria-label={labels.iconPickerTriggerLabel}\n aria-expanded={pickerOpen}\n aria-haspopup=\"dialog\"\n disabled={disabled}\n >\n <Ellipsis className=\"h-4 w-4\" />\n </Button>\n </div>\n {pickerOpen ? (\n <div className=\"absolute left-0 right-0 top-full z-dropdown mt-2 rounded-md border border-border bg-popover p-3 shadow-lg\">\n <div className=\"space-y-3\">\n <Input\n ref={searchInputRef}\n type=\"search\"\n value={iconSearch}\n onChange={(event) => setIconSearch(event.target.value)}\n placeholder={labels.iconSearchPlaceholder}\n aria-label={labels.iconSearchPlaceholder}\n autoComplete=\"off\"\n />\n <div className=\"max-h-64 overflow-y-auto pr-1\">\n {filteredIcons.length ? (\n <div className=\"grid grid-cols-6 gap-2 sm:grid-cols-8\">\n {filteredIcons.map((option) => {\n const isSelected = normalizedIcon === option.value\n return (\n <Button\n key={option.value}\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={isSelected ? 'bg-primary/10 text-primary ring-1 ring-primary/60' : undefined}\n onClick={() => handleIconSelection(option.value)}\n title={option.label}\n aria-label={option.label}\n aria-pressed={isSelected}\n >\n {renderDictionaryIcon(option.value, 'h-4 w-4')}\n </Button>\n )\n })}\n </div>\n ) : (\n <p className=\"text-sm text-muted-foreground\">{labels.iconSearchEmptyLabel}</p>\n )}\n </div>\n {iconSuggestions.length ? (\n <div className=\"space-y-2\">\n <p className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {labels.iconSuggestionsLabel}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {iconSuggestions.map((suggestion) => {\n const isSelected = normalizedIcon === suggestion.value\n return (\n <Button\n key={suggestion.value}\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className={`text-xs ${isSelected ? 'border-primary bg-primary/10 text-primary' : ''}`}\n onClick={() => handleIconSelection(suggestion.value)}\n >\n {renderDictionaryIcon(suggestion.value, 'h-3 w-3')}\n {suggestion.label}\n </Button>\n )\n })}\n </div>\n </div>\n ) : null}\n <div className=\"flex justify-end\">\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={() => onIconChange(null)}>\n {labels.iconClearLabel}\n </Button>\n </div>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n\n <div>\n <label className=\"text-sm font-medium\">Preview</label>\n <div className=\"flex items-center gap-3 rounded border border-dashed border-border px-3 py-2\">\n {hasAppearance ? (\n <>\n {renderDictionaryIcon(icon, 'h-5 w-5')}\n {renderDictionaryColor(color, 'h-4 w-4 rounded-full')}\n </>\n ) : (\n <span className=\"text-sm text-muted-foreground\">{labels.previewEmptyLabel}</span>\n )}\n </div>\n </div>\n </div>\n )\n}\n\nexport function useAppearanceState(initialIcon: string | null, initialColor: string | null) {\n const [icon, setIcon] = React.useState<string | null>(initialIcon)\n const [color, setColor] = React.useState<string | null>(initialColor)\n return React.useMemo(\n () => ({\n icon,\n color,\n setIcon,\n setColor,\n }),\n [icon, color],\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Ellipsis } from 'lucide-react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { ColorPicker } from '@open-mercato/ui/primitives/color-picker'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { ICON_LIBRARY, ICON_SUGGESTIONS, type IconOption, renderDictionaryColor, renderDictionaryIcon } from './dictionaryAppearance'\n\nexport type AppearanceSelectorLabels = {\n colorLabel: string\n colorHelp?: string\n colorClearLabel: string\n iconLabel: string\n iconPlaceholder: string\n iconPickerTriggerLabel: string\n iconSearchPlaceholder: string\n iconSearchEmptyLabel: string\n iconSuggestionsLabel: string\n iconClearLabel: string\n previewEmptyLabel: string\n}\n\ntype AppearanceSelectorProps = {\n icon: string | null | undefined\n color: string | null | undefined\n onIconChange: (next: string | null) => void\n onColorChange: (next: string | null) => void\n labels: AppearanceSelectorLabels\n disabled?: boolean\n iconSuggestions?: IconOption[]\n iconLibrary?: IconOption[]\n className?: string\n /**\n * Title/value shown alongside the icon and color swatch in the preview, so the entry\n * previews the way it renders elsewhere (icon + color + label). Omit to preview appearance only.\n */\n previewLabel?: string | null\n}\n\nconst ICON_PICKER_LIMIT = 240\n\nexport function AppearanceSelector({\n icon,\n color,\n onIconChange,\n onColorChange,\n labels,\n disabled = false,\n iconSuggestions = ICON_SUGGESTIONS,\n iconLibrary,\n className,\n previewLabel,\n}: AppearanceSelectorProps) {\n const normalizedIcon = icon ?? ''\n const normalizedColor = color ?? '#000000'\n const hasAppearance = Boolean(icon) || Boolean(color)\n const trimmedPreviewLabel = typeof previewLabel === 'string' ? previewLabel.trim() : ''\n const hasPreviewContent = hasAppearance || trimmedPreviewLabel.length > 0\n const iconOptions = React.useMemo(() => (iconLibrary && iconLibrary.length ? iconLibrary : ICON_LIBRARY), [iconLibrary])\n const [pickerOpen, setPickerOpen] = React.useState(false)\n const [iconSearch, setIconSearch] = React.useState('')\n const pickerContainerRef = React.useRef<HTMLDivElement | null>(null)\n const searchInputRef = React.useRef<HTMLInputElement | null>(null)\n\n const closePicker = React.useCallback(() => {\n setPickerOpen(false)\n setIconSearch('')\n }, [])\n\n const handleIconSelection = React.useCallback(\n (next: string) => {\n onIconChange(next)\n closePicker()\n },\n [closePicker, onIconChange],\n )\n\n React.useEffect(() => {\n if (!pickerOpen) return\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (pickerContainerRef.current?.contains(target)) return\n closePicker()\n }\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') closePicker()\n }\n document.addEventListener('pointerdown', handlePointerDown)\n document.addEventListener('keydown', handleKeyDown)\n return () => {\n document.removeEventListener('pointerdown', handlePointerDown)\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [closePicker, pickerOpen])\n\n React.useEffect(() => {\n if (!pickerOpen) return\n const frame = window.requestAnimationFrame(() => {\n searchInputRef.current?.focus()\n searchInputRef.current?.select()\n })\n return () => window.cancelAnimationFrame(frame)\n }, [pickerOpen])\n\n React.useEffect(() => {\n if (!disabled) return\n closePicker()\n }, [closePicker, disabled])\n\n const filteredIcons = React.useMemo(() => {\n const term = iconSearch.trim().toLowerCase()\n if (!term) {\n return iconOptions.slice(0, ICON_PICKER_LIMIT)\n }\n const matches = iconOptions.filter((option) => {\n const haystack = [option.label, option.value, ...(option.keywords ?? [])].join(' ').toLowerCase()\n return haystack.includes(term)\n })\n return matches.slice(0, ICON_PICKER_LIMIT)\n }, [iconOptions, iconSearch])\n\n return (\n <div className={['space-y-4', className].filter(Boolean).join(' ')}>\n <div className=\"space-y-2\">\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n {labels.colorLabel}\n {labels.colorHelp ? <span className=\"text-xs font-normal text-muted-foreground\">{labels.colorHelp}</span> : null}\n </label>\n <div className=\"flex flex-wrap items-center gap-2\">\n <ColorPicker\n value={normalizedColor}\n onChange={(next) => onColorChange(next)}\n disabled={disabled}\n aria-label={labels.colorLabel}\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => onColorChange(null)}\n disabled={disabled || !color}\n >\n {labels.colorClearLabel}\n </Button>\n </div>\n </div>\n\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">{labels.iconLabel}</label>\n <div ref={pickerContainerRef} className=\"relative\">\n <div className=\"flex gap-2\">\n <Input\n type=\"text\"\n value={normalizedIcon}\n onChange={(event) => onIconChange(event.target.value)}\n placeholder={labels.iconPlaceholder}\n className=\"flex-1\"\n disabled={disabled}\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n onClick={() => setPickerOpen((prev) => !prev)}\n aria-label={labels.iconPickerTriggerLabel}\n aria-expanded={pickerOpen}\n aria-haspopup=\"dialog\"\n disabled={disabled}\n >\n <Ellipsis className=\"h-4 w-4\" />\n </Button>\n </div>\n {pickerOpen ? (\n <div className=\"absolute left-0 right-0 top-full z-dropdown mt-2 rounded-md border border-border bg-popover p-3 shadow-lg\">\n <div className=\"space-y-3\">\n <Input\n ref={searchInputRef}\n type=\"search\"\n value={iconSearch}\n onChange={(event) => setIconSearch(event.target.value)}\n placeholder={labels.iconSearchPlaceholder}\n aria-label={labels.iconSearchPlaceholder}\n autoComplete=\"off\"\n />\n <div className=\"max-h-64 overflow-y-auto pr-1\">\n {filteredIcons.length ? (\n <div className=\"grid grid-cols-6 gap-2 sm:grid-cols-8\">\n {filteredIcons.map((option) => {\n const isSelected = normalizedIcon === option.value\n return (\n <Button\n key={option.value}\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={isSelected ? 'bg-primary/10 text-primary ring-1 ring-primary/60' : undefined}\n onClick={() => handleIconSelection(option.value)}\n title={option.label}\n aria-label={option.label}\n aria-pressed={isSelected}\n >\n {renderDictionaryIcon(option.value, 'h-4 w-4')}\n </Button>\n )\n })}\n </div>\n ) : (\n <p className=\"text-sm text-muted-foreground\">{labels.iconSearchEmptyLabel}</p>\n )}\n </div>\n {iconSuggestions.length ? (\n <div className=\"space-y-2\">\n <p className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">\n {labels.iconSuggestionsLabel}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {iconSuggestions.map((suggestion) => {\n const isSelected = normalizedIcon === suggestion.value\n return (\n <Button\n key={suggestion.value}\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n className={`text-xs ${isSelected ? 'border-primary bg-primary/10 text-primary' : ''}`}\n onClick={() => handleIconSelection(suggestion.value)}\n >\n {renderDictionaryIcon(suggestion.value, 'h-3 w-3')}\n {suggestion.label}\n </Button>\n )\n })}\n </div>\n </div>\n ) : null}\n <div className=\"flex justify-end\">\n <Button type=\"button\" variant=\"ghost\" size=\"sm\" onClick={() => onIconChange(null)}>\n {labels.iconClearLabel}\n </Button>\n </div>\n </div>\n </div>\n ) : null}\n </div>\n </div>\n\n <div>\n <label className=\"text-sm font-medium\">Preview</label>\n <div className=\"flex items-center gap-3 rounded border border-dashed border-border px-3 py-2\">\n {hasPreviewContent ? (\n <>\n {renderDictionaryIcon(icon, 'h-5 w-5')}\n {renderDictionaryColor(color, 'h-4 w-4 rounded-full')}\n {trimmedPreviewLabel ? <span className=\"text-sm\">{trimmedPreviewLabel}</span> : null}\n </>\n ) : (\n <span className=\"text-sm text-muted-foreground\">{labels.previewEmptyLabel}</span>\n )}\n </div>\n </div>\n </div>\n )\n}\n\nexport function useAppearanceState(initialIcon: string | null, initialColor: string | null) {\n const [icon, setIcon] = React.useState<string | null>(initialIcon)\n const [color, setColor] = React.useState<string | null>(initialColor)\n return React.useMemo(\n () => ({\n icon,\n color,\n setIcon,\n setColor,\n }),\n [icon, color],\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA6HQ,SA8HI,UA5HkB,KAFtB;AA3HR,YAAY,WAAW;AACvB,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,cAAc,kBAAmC,uBAAuB,4BAA4B;AAiC7G,MAAM,oBAAoB;AAEnB,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AACF,GAA4B;AAC1B,QAAM,iBAAiB,QAAQ;AAC/B,QAAM,kBAAkB,SAAS;AACjC,QAAM,gBAAgB,QAAQ,IAAI,KAAK,QAAQ,KAAK;AACpD,QAAM,sBAAsB,OAAO,iBAAiB,WAAW,aAAa,KAAK,IAAI;AACrF,QAAM,oBAAoB,iBAAiB,oBAAoB,SAAS;AACxE,QAAM,cAAc,MAAM,QAAQ,MAAO,eAAe,YAAY,SAAS,cAAc,cAAe,CAAC,WAAW,CAAC;AACvH,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,KAAK;AACxD,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,EAAE;AACrD,QAAM,qBAAqB,MAAM,OAA8B,IAAI;AACnE,QAAM,iBAAiB,MAAM,OAAgC,IAAI;AAEjE,QAAM,cAAc,MAAM,YAAY,MAAM;AAC1C,kBAAc,KAAK;AACnB,kBAAc,EAAE;AAAA,EAClB,GAAG,CAAC,CAAC;AAE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MAAK;AAAA,kBACL,WAAW,WAAW,aAAa,8CAA8C,EAAE;AAAA,kBACnF,SAAS,MAAM,oBAAoB,WAAW,KAAK;AAAA,kBAElD;AAAA,yCAAqB,WAAW,OAAO,SAAS;AAAA,oBAChD,WAAW;AAAA;AAAA;AAAA,gBARP,WAAW;AAAA,cASlB;AAAA,YAEJ,CAAC,GACH;AAAA,aACF,IACE;AAAA,UACJ,oBAAC,SAAI,WAAU,oBACb,8BAAC,UAAO,MAAK,UAAS,SAAQ,SAAQ,MAAK,MAAK,SAAS,MAAM,aAAa,IAAI,GAC7E,iBAAO,gBACV,GACF;AAAA,WACF,GACF,IACE;AAAA,SACN;AAAA,OACF;AAAA,IAEA,qBAAC,SACC;AAAA,0BAAC,WAAM,WAAU,uBAAsB,qBAAO;AAAA,MAC9C,oBAAC,SAAI,WAAU,gFACZ,8BACC,iCACG;AAAA,6BAAqB,MAAM,SAAS;AAAA,QACpC,sBAAsB,OAAO,sBAAsB;AAAA,QACnD,sBAAsB,oBAAC,UAAK,WAAU,WAAW,+BAAoB,IAAU;AAAA,SAClF,IAEA,oBAAC,UAAK,WAAU,iCAAiC,iBAAO,mBAAkB,GAE9E;AAAA,OACF;AAAA,KACF;AAEJ;AAEO,SAAS,mBAAmB,aAA4B,cAA6B;AAC1F,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAwB,WAAW;AACjE,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAwB,YAAY;AACpE,SAAO,MAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,MAAM,KAAK;AAAA,EACd;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -407,6 +407,7 @@ function DictionaryEntriesEditor({ dictionaryId, dictionaryName, readOnly = fals
|
|
|
407
407
|
{
|
|
408
408
|
icon: appearance.icon,
|
|
409
409
|
color: appearance.color,
|
|
410
|
+
previewLabel: formState.label.trim() || formState.value.trim(),
|
|
410
411
|
onIconChange: (next) => {
|
|
411
412
|
appearance.setIcon(next);
|
|
412
413
|
setFormState((prev) => ({ ...prev, icon: next }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/dictionaries/components/DictionaryEntriesEditor.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Plus, Pencil, Trash2, RefreshCw, Languages } from 'lucide-react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport {\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@open-mercato/ui/primitives/table'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { apiCall, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'\nimport { buildOptimisticLockHeader } from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { surfaceRecordConflict } from '@open-mercato/ui/backend/conflicts'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { AppearanceSelector, useAppearanceState } from './AppearanceSelector'\nimport { DictionaryValue } from './dictionaryAppearance'\nimport {\n invalidateDictionaryEntries,\n useDictionaryEntries,\n} from './hooks/useDictionaryEntries'\nimport type { DictionaryEntryRecord } from './hooks/useDictionaryEntries'\nimport {\n DialogDescription,\n} from '@open-mercato/ui/primitives/dialog'\nimport { TranslationManager } from '@open-mercato/core/modules/translations/components/TranslationManager'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('dictionaries').child({ component: 'DictionaryEntriesEditor' })\n\ntype Entry = DictionaryEntryRecord\n\ntype DictionaryEntriesEditorProps = {\n dictionaryId: string\n dictionaryName: string\n readOnly?: boolean\n}\n\ntype FormState = {\n id?: string | null\n value: string\n label: string\n color: string | null\n icon: string | null\n updatedAt?: string | null\n}\n\nexport function DictionaryEntriesEditor({ dictionaryId, dictionaryName, readOnly = false }: DictionaryEntriesEditorProps) {\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const readOnlyMessage = t('dictionaries.config.entries.readOnly', 'Inherited dictionaries are managed at the parent organization.')\n const queryClient = useQueryClient()\n const scopeVersion = useOrganizationScopeVersion()\n const dictionaryQuery = useDictionaryEntries(dictionaryId, scopeVersion)\n const entries = React.useMemo<Entry[]>(() => dictionaryQuery.data?.fullEntries ?? [], [dictionaryQuery.data?.fullEntries])\n const dictionaryMap = dictionaryQuery.data?.map ?? {}\n const isInitialLoading = dictionaryQuery.isLoading\n const loadError = dictionaryQuery.isError\n ? t('dictionaries.config.entries.error.load', 'Failed to load dictionary entries.')\n : null\n const [dialogOpen, setDialogOpen] = React.useState(false)\n const [isDeleting, setIsDeleting] = React.useState(false)\n const [isSaving, setIsSaving] = React.useState(false)\n const [formState, setFormState] = React.useState<FormState>(() => ({\n value: '',\n label: '',\n color: null,\n icon: null,\n }))\n const [errors, setErrors] = React.useState<{ value?: string; label?: string }>({})\n const [translateEntry, setTranslateEntry] = React.useState<Entry | null>(null)\n const appearance = useAppearanceState(formState.icon, formState.color)\n const mutationContextId = React.useMemo(\n () => `dictionaries:dictionary_entry:${dictionaryId}`,\n [dictionaryId],\n )\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n formId: string\n resourceKind: string\n resourceId?: string\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: mutationContextId,\n blockedMessage: t('ui.forms.flash.saveBlocked', 'Save blocked by validation'),\n })\n\n const resetForm = React.useCallback(() => {\n setFormState({ value: '', label: '', color: null, icon: null })\n appearance.setColor(null)\n appearance.setIcon(null)\n setErrors({})\n }, [appearance])\n\n const openDialog = React.useCallback(\n (entry?: Entry) => {\n if (readOnly) {\n flash(readOnlyMessage, 'info')\n return\n }\n if (entry) {\n setFormState({\n id: entry.id,\n value: entry.value,\n label: entry.label,\n color: entry.color ?? null,\n icon: entry.icon ?? null,\n updatedAt: entry.updatedAt ?? null,\n })\n appearance.setColor(entry.color ?? null)\n appearance.setIcon(entry.icon ?? null)\n } else {\n resetForm()\n }\n setErrors({})\n setDialogOpen(true)\n },\n [appearance, readOnly, readOnlyMessage, resetForm],\n )\n\n const closeDialog = React.useCallback(() => {\n setDialogOpen(false)\n resetForm()\n setErrors({})\n }, [resetForm])\n\n const handleSave = React.useCallback(async () => {\n if (readOnly) {\n flash(readOnlyMessage, 'info')\n return\n }\n const trimmedValue = formState.value.trim()\n const trimmedLabel = formState.label.trim()\n const nextErrors: { value?: string } = {}\n if (!trimmedValue) {\n nextErrors.value = t('dictionaries.config.entries.error.required', 'Value is required.')\n }\n if (nextErrors.value) {\n setErrors(nextErrors)\n return\n }\n setErrors({})\n setIsSaving(true)\n try {\n const payload = {\n value: trimmedValue,\n label: trimmedLabel || trimmedValue,\n color: appearance.color,\n icon: appearance.icon,\n }\n if (formState.id) {\n const entryId = formState.id\n const expectedUpdatedAt = formState.updatedAt\n await runMutation({\n operation: () =>\n withScopedApiRequestHeaders(\n buildOptimisticLockHeader(expectedUpdatedAt),\n async () => {\n const call = await apiCall<Record<string, unknown>>(\n `/api/dictionaries/${dictionaryId}/entries/${entryId}`,\n {\n method: 'PATCH',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n },\n )\n if (!call.ok) {\n throw Object.assign(\n new Error(typeof call.result?.error === 'string' ? call.result.error : 'Failed to save dictionary entry'),\n { status: call.status, ...(call.result && typeof call.result === 'object' ? call.result : {}) },\n )\n }\n return call\n },\n ),\n context: {\n formId: mutationContextId,\n resourceKind: 'dictionaries.dictionary_entry',\n resourceId: entryId,\n retryLastMutation,\n },\n mutationPayload: payload,\n })\n flash(t('dictionaries.config.entries.success.update', 'Dictionary entry updated.'), 'success')\n } else {\n await runMutation({\n operation: async () => {\n const call = await apiCall<Record<string, unknown>>(\n `/api/dictionaries/${dictionaryId}/entries`,\n {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n },\n )\n if (!call.ok) {\n throw new Error(\n typeof call.result?.error === 'string' ? call.result.error : 'Failed to create dictionary entry',\n )\n }\n return call\n },\n context: {\n formId: mutationContextId,\n resourceKind: 'dictionaries.dictionary_entry',\n retryLastMutation,\n },\n mutationPayload: payload,\n })\n flash(t('dictionaries.config.entries.success.create', 'Dictionary entry created.'), 'success')\n }\n await invalidateDictionaryEntries(queryClient, dictionaryId)\n setDialogOpen(false)\n setFormState({ value: '', label: '', color: null, icon: null })\n appearance.setColor(null)\n appearance.setIcon(null)\n setErrors({})\n } catch (err) {\n if (surfaceRecordConflict(err, t)) {\n return\n }\n logger.error('Failed to save dictionary entry', { err })\n flash(t('dictionaries.config.entries.error.save', 'Failed to save dictionary entry.'), 'error')\n } finally {\n setIsSaving(false)\n }\n }, [appearance, dictionaryId, formState.id, formState.label, formState.updatedAt, formState.value, mutationContextId, queryClient, readOnly, readOnlyMessage, runMutation, retryLastMutation, t])\n\n const handleDelete = React.useCallback(\n async (entry: Entry) => {\n if (readOnly) {\n flash(readOnlyMessage, 'info')\n return\n }\n if (!entry.id) return\n const confirmDelete = await confirm({\n title: t('dictionaries.config.entries.delete.confirm', 'Delete \"{{value}}\"?', { value: entry.label || entry.value }),\n variant: 'destructive',\n })\n if (!confirmDelete) return\n setIsDeleting(true)\n try {\n await runMutation({\n operation: () =>\n withScopedApiRequestHeaders(\n buildOptimisticLockHeader(entry.updatedAt),\n async () => {\n const call = await apiCall<Record<string, unknown>>(\n `/api/dictionaries/${dictionaryId}/entries/${entry.id}`,\n { method: 'DELETE' },\n )\n if (!call.ok) {\n throw Object.assign(\n new Error(\n typeof call.result?.error === 'string' ? call.result.error : 'Failed to delete dictionary entry',\n ),\n { status: call.status, ...(call.result && typeof call.result === 'object' ? call.result : {}) },\n )\n }\n return call\n },\n ),\n context: {\n formId: mutationContextId,\n resourceKind: 'dictionaries.dictionary_entry',\n resourceId: entry.id,\n retryLastMutation,\n },\n mutationPayload: { id: entry.id },\n })\n await invalidateDictionaryEntries(queryClient, dictionaryId)\n flash(t('dictionaries.config.entries.success.delete', 'Dictionary entry deleted.'), 'success')\n } catch (err) {\n // Route a concurrent-edit 409 through the single conflict surface (matching\n // the entry save path); fall back to a flash for any other delete failure.\n if (surfaceRecordConflict(err, t)) {\n return\n }\n logger.error('Failed to delete dictionary entry', { err })\n flash(t('dictionaries.config.entries.error.delete', 'Failed to delete dictionary entry.'), 'error')\n } finally {\n setIsDeleting(false)\n }\n },\n [confirm, dictionaryId, mutationContextId, queryClient, readOnly, readOnlyMessage, runMutation, retryLastMutation, t],\n )\n\n const tableContent = React.useMemo(() => {\n if (isInitialLoading) {\n return (\n <TableRow>\n <TableCell colSpan={4} className=\"py-8 text-center text-sm text-muted-foreground\">\n <Spinner className=\"mx-auto mb-2 h-5 w-5\" />\n {t('dictionaries.config.entries.loading', 'Loading entries\u2026')}\n </TableCell>\n </TableRow>\n )\n }\n if (loadError) {\n return (\n <TableRow>\n <TableCell colSpan={4} className=\"py-6 text-center text-sm text-destructive\">\n {loadError}\n </TableCell>\n </TableRow>\n )\n }\n if (!entries.length) {\n return (\n <TableRow>\n <TableCell colSpan={4} className=\"py-6 text-center text-sm text-muted-foreground\">\n {t('dictionaries.config.entries.empty', 'No entries yet.')}\n </TableCell>\n </TableRow>\n )\n }\n return entries.map((entry) => (\n <TableRow key={entry.id}>\n <TableCell className=\"font-medium\">{entry.value}</TableCell>\n <TableCell>{entry.label}</TableCell>\n <TableCell>\n <DictionaryValue\n value={entry.value}\n map={dictionaryMap}\n fallback={<span className=\"text-sm text-muted-foreground\">{t('dictionaries.config.entries.appearance.none', 'None')}</span>}\n />\n </TableCell>\n <TableCell className=\"flex items-center gap-2\">\n {readOnly ? (\n <span className=\"text-xs text-muted-foreground\">\n {t('dictionaries.config.entries.readOnlyActions', 'Managed in parent organization')}\n </span>\n ) : (\n <>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => openDialog(entry)}\n >\n <Pencil className=\"h-4 w-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => setTranslateEntry(entry)}\n title={t('dictionaries.config.entries.actions.translate', 'Translate')}\n >\n <Languages className=\"h-4 w-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => handleDelete(entry)}\n disabled={isDeleting}\n >\n <Trash2 className=\"h-4 w-4\" />\n </Button>\n </>\n )}\n </TableCell>\n </TableRow>\n ))\n }, [dictionaryMap, entries, handleDelete, isDeleting, isInitialLoading, loadError, openDialog, readOnly, t])\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div>\n <h2 className=\"text-lg font-semibold\">{dictionaryName}</h2>\n <p className=\"text-sm text-muted-foreground\">\n {readOnly\n ? readOnlyMessage\n : t('dictionaries.config.entries.subtitle', 'Manage reusable values and appearance for this dictionary.')}\n </p>\n </div>\n <div className=\"flex gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => {\n dictionaryQuery.refetch().catch(() => {})\n }}\n >\n <RefreshCw className=\"mr-2 h-4 w-4\" />\n {t('dictionaries.config.entries.actions.refresh', 'Refresh')}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => openDialog()}\n disabled={readOnly}\n title={readOnly ? readOnlyMessage : undefined}\n >\n <Plus className=\"mr-2 h-4 w-4\" />\n {t('dictionaries.config.entries.actions.add', 'Add entry')}\n </Button>\n </div>\n </div>\n\n <div className=\"overflow-hidden rounded-md border\">\n <Table>\n <TableHeader>\n <TableRow>\n <TableHead className=\"w-48\">{t('dictionaries.config.entries.columns.value', 'Value')}</TableHead>\n <TableHead className=\"w-48\">{t('dictionaries.config.entries.columns.label', 'Label')}</TableHead>\n <TableHead>{t('dictionaries.config.entries.columns.appearance', 'Appearance')}</TableHead>\n <TableHead className=\"w-32 text-right\">{t('dictionaries.config.entries.columns.actions', 'Actions')}</TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>{tableContent}</TableBody>\n </Table>\n </div>\n\n <Dialog open={dialogOpen} onOpenChange={(open) => (!open ? closeDialog() : undefined)}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>\n {formState.id\n ? t('dictionaries.config.entries.dialog.editTitle', 'Edit dictionary entry')\n : t('dictionaries.config.entries.dialog.addTitle', 'Add dictionary entry')}\n </DialogTitle>\n </DialogHeader>\n <div className=\"space-y-4\">\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">\n {t('dictionaries.config.entries.dialog.valueLabel', 'Value')}\n <span className=\"ml-1 text-destructive\">*</span>\n </label>\n <Input\n type=\"text\"\n value={formState.value}\n onChange={(event) => {\n const nextValue = event.target.value\n setFormState((prev) => ({ ...prev, value: nextValue }))\n if (errors.value) {\n setErrors((prev) => ({ ...prev, value: undefined }))\n }\n }}\n aria-invalid={errors.value ? 'true' : 'false'}\n aria-describedby=\"dictionary-entry-value-error\"\n />\n {errors.value ? (\n <p id=\"dictionary-entry-value-error\" className=\"text-xs text-destructive\">\n {errors.value}\n </p>\n ) : null}\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">\n {t('dictionaries.config.entries.dialog.labelLabel', 'Label')}\n </label>\n <Input\n type=\"text\"\n value={formState.label}\n onChange={(event) => setFormState((prev) => ({ ...prev, label: event.target.value }))}\n placeholder={t('dictionaries.config.entries.dialog.labelPlaceholder', 'Display name shown in UI')}\n />\n </div>\n <AppearanceSelector\n icon={appearance.icon}\n color={appearance.color}\n onIconChange={(next) => {\n appearance.setIcon(next)\n setFormState((prev) => ({ ...prev, icon: next }))\n }}\n onColorChange={(next) => {\n appearance.setColor(next)\n setFormState((prev) => ({ ...prev, color: next }))\n }}\n labels={{\n colorLabel: t('dictionaries.config.entries.dialog.colorLabel', 'Color'),\n colorHelp: t('dictionaries.config.entries.dialog.colorHelp', 'Pick a highlight color for this entry.'),\n colorClearLabel: t('dictionaries.config.entries.dialog.colorClear', 'Remove color'),\n iconLabel: t('dictionaries.config.entries.dialog.iconLabel', 'Icon or emoji'),\n iconPlaceholder: t('dictionaries.config.entries.dialog.iconPlaceholder', 'Type an emoji or icon token.'),\n iconPickerTriggerLabel: t('dictionaries.config.entries.dialog.iconBrowse', 'Browse icons and emoji'),\n iconSearchPlaceholder: t('dictionaries.config.entries.dialog.iconSearchPlaceholder', 'Search icons or emojis\u2026'),\n iconSearchEmptyLabel: t('dictionaries.config.entries.dialog.iconSearchEmpty', 'No icons match your search.'),\n iconSuggestionsLabel: t('dictionaries.config.entries.dialog.iconSuggestions', 'Suggestions'),\n iconClearLabel: t('dictionaries.config.entries.dialog.iconClear', 'Remove icon'),\n previewEmptyLabel: t('dictionaries.config.entries.dialog.previewEmpty', 'No appearance selected'),\n }}\n />\n </div>\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={closeDialog}\n disabled={isSaving}\n >\n {t('dictionaries.config.entries.dialog.cancel', 'Cancel')}\n </Button>\n <Button\n type=\"button\"\n onClick={handleSave}\n disabled={isSaving}\n >\n {isSaving ? <Spinner className=\"mr-2 h-4 w-4\" /> : null}\n {t('dictionaries.config.entries.dialog.save', 'Save')}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n <Dialog open={!!translateEntry} onOpenChange={(open) => { if (!open) setTranslateEntry(null) }}>\n <DialogContent className=\"max-w-2xl max-h-[80vh] overflow-y-auto\">\n <DialogHeader>\n <DialogTitle>{t('translations.manager.translateEntry', 'Translate: {{label}}', { label: translateEntry?.label ?? '' })}</DialogTitle>\n <DialogDescription>\n {t('translations.manager.translateEntryDescription', 'Manage translations for this dictionary entry.')}\n </DialogDescription>\n </DialogHeader>\n {translateEntry?.id && (\n <TranslationManager\n mode=\"embedded\"\n entityType=\"dictionaries:dictionary_entry\"\n recordId={translateEntry.id}\n baseValues={{ label: translateEntry.label }}\n translatableFields={['label']}\n />\n )}\n </DialogContent>\n </Dialog>\n {ConfirmDialogElement}\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";AA2SU,SA0CI,UAzCF,KADF;AAzSV,YAAY,WAAW;AACvB,SAAS,MAAM,QAAQ,QAAQ,WAAW,iBAAiB;AAC3D,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,OAAO,WAAW,WAAW,WAAW,aAAa,gBAAgB;AAC9E,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,SAAS,mCAAmC;AACrD,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB,SAAS,wBAAwB;AACjC,SAAS,oBAAoB,0BAA0B;AACvD,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,cAAc,EAAE,MAAM,EAAE,WAAW,0BAA0B,CAAC;AAmBnF,SAAS,wBAAwB,EAAE,cAAc,gBAAgB,WAAW,MAAM,GAAiC;AACxH,QAAM,IAAI,KAAK;AACf,QAAM,EAAE,SAAS,qBAAqB,IAAI,iBAAiB;AAC3D,QAAM,kBAAkB,EAAE,wCAAwC,gEAAgE;AAClI,QAAM,cAAc,eAAe;AACnC,QAAM,eAAe,4BAA4B;AACjD,QAAM,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AAU,0CACvB;AAAA,2BAAC,gBACC;AAAA,4BAAC,eAAa,YAAE,uCAAuC,wBAAwB,EAAE,OAAO,gBAAgB,SAAS,GAAG,CAAC,GAAE;AAAA,QACvH,oBAAC,qBACE,YAAE,kDAAkD,gDAAgD,GACvG;AAAA,SACF;AAAA,MACC,gBAAgB,MACf;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,YAAW;AAAA,UACX,UAAU,eAAe;AAAA,UACzB,YAAY,EAAE,OAAO,eAAe,MAAM;AAAA,UAC1C,oBAAoB,CAAC,OAAO;AAAA;AAAA,MAC9B;AAAA,OAEJ,GACF;AAAA,IACC;AAAA,KACH;AAEJ;",
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Plus, Pencil, Trash2, RefreshCw, Languages } from 'lucide-react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport {\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@open-mercato/ui/primitives/table'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { apiCall, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'\nimport { buildOptimisticLockHeader } from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { surfaceRecordConflict } from '@open-mercato/ui/backend/conflicts'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { AppearanceSelector, useAppearanceState } from './AppearanceSelector'\nimport { DictionaryValue } from './dictionaryAppearance'\nimport {\n invalidateDictionaryEntries,\n useDictionaryEntries,\n} from './hooks/useDictionaryEntries'\nimport type { DictionaryEntryRecord } from './hooks/useDictionaryEntries'\nimport {\n DialogDescription,\n} from '@open-mercato/ui/primitives/dialog'\nimport { TranslationManager } from '@open-mercato/core/modules/translations/components/TranslationManager'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('dictionaries').child({ component: 'DictionaryEntriesEditor' })\n\ntype Entry = DictionaryEntryRecord\n\ntype DictionaryEntriesEditorProps = {\n dictionaryId: string\n dictionaryName: string\n readOnly?: boolean\n}\n\ntype FormState = {\n id?: string | null\n value: string\n label: string\n color: string | null\n icon: string | null\n updatedAt?: string | null\n}\n\nexport function DictionaryEntriesEditor({ dictionaryId, dictionaryName, readOnly = false }: DictionaryEntriesEditorProps) {\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const readOnlyMessage = t('dictionaries.config.entries.readOnly', 'Inherited dictionaries are managed at the parent organization.')\n const queryClient = useQueryClient()\n const scopeVersion = useOrganizationScopeVersion()\n const dictionaryQuery = useDictionaryEntries(dictionaryId, scopeVersion)\n const entries = React.useMemo<Entry[]>(() => dictionaryQuery.data?.fullEntries ?? [], [dictionaryQuery.data?.fullEntries])\n const dictionaryMap = dictionaryQuery.data?.map ?? {}\n const isInitialLoading = dictionaryQuery.isLoading\n const loadError = dictionaryQuery.isError\n ? t('dictionaries.config.entries.error.load', 'Failed to load dictionary entries.')\n : null\n const [dialogOpen, setDialogOpen] = React.useState(false)\n const [isDeleting, setIsDeleting] = React.useState(false)\n const [isSaving, setIsSaving] = React.useState(false)\n const [formState, setFormState] = React.useState<FormState>(() => ({\n value: '',\n label: '',\n color: null,\n icon: null,\n }))\n const [errors, setErrors] = React.useState<{ value?: string; label?: string }>({})\n const [translateEntry, setTranslateEntry] = React.useState<Entry | null>(null)\n const appearance = useAppearanceState(formState.icon, formState.color)\n const mutationContextId = React.useMemo(\n () => `dictionaries:dictionary_entry:${dictionaryId}`,\n [dictionaryId],\n )\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n formId: string\n resourceKind: string\n resourceId?: string\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: mutationContextId,\n blockedMessage: t('ui.forms.flash.saveBlocked', 'Save blocked by validation'),\n })\n\n const resetForm = React.useCallback(() => {\n setFormState({ value: '', label: '', color: null, icon: null })\n appearance.setColor(null)\n appearance.setIcon(null)\n setErrors({})\n }, [appearance])\n\n const openDialog = React.useCallback(\n (entry?: Entry) => {\n if (readOnly) {\n flash(readOnlyMessage, 'info')\n return\n }\n if (entry) {\n setFormState({\n id: entry.id,\n value: entry.value,\n label: entry.label,\n color: entry.color ?? null,\n icon: entry.icon ?? null,\n updatedAt: entry.updatedAt ?? null,\n })\n appearance.setColor(entry.color ?? null)\n appearance.setIcon(entry.icon ?? null)\n } else {\n resetForm()\n }\n setErrors({})\n setDialogOpen(true)\n },\n [appearance, readOnly, readOnlyMessage, resetForm],\n )\n\n const closeDialog = React.useCallback(() => {\n setDialogOpen(false)\n resetForm()\n setErrors({})\n }, [resetForm])\n\n const handleSave = React.useCallback(async () => {\n if (readOnly) {\n flash(readOnlyMessage, 'info')\n return\n }\n const trimmedValue = formState.value.trim()\n const trimmedLabel = formState.label.trim()\n const nextErrors: { value?: string } = {}\n if (!trimmedValue) {\n nextErrors.value = t('dictionaries.config.entries.error.required', 'Value is required.')\n }\n if (nextErrors.value) {\n setErrors(nextErrors)\n return\n }\n setErrors({})\n setIsSaving(true)\n try {\n const payload = {\n value: trimmedValue,\n label: trimmedLabel || trimmedValue,\n color: appearance.color,\n icon: appearance.icon,\n }\n if (formState.id) {\n const entryId = formState.id\n const expectedUpdatedAt = formState.updatedAt\n await runMutation({\n operation: () =>\n withScopedApiRequestHeaders(\n buildOptimisticLockHeader(expectedUpdatedAt),\n async () => {\n const call = await apiCall<Record<string, unknown>>(\n `/api/dictionaries/${dictionaryId}/entries/${entryId}`,\n {\n method: 'PATCH',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n },\n )\n if (!call.ok) {\n throw Object.assign(\n new Error(typeof call.result?.error === 'string' ? call.result.error : 'Failed to save dictionary entry'),\n { status: call.status, ...(call.result && typeof call.result === 'object' ? call.result : {}) },\n )\n }\n return call\n },\n ),\n context: {\n formId: mutationContextId,\n resourceKind: 'dictionaries.dictionary_entry',\n resourceId: entryId,\n retryLastMutation,\n },\n mutationPayload: payload,\n })\n flash(t('dictionaries.config.entries.success.update', 'Dictionary entry updated.'), 'success')\n } else {\n await runMutation({\n operation: async () => {\n const call = await apiCall<Record<string, unknown>>(\n `/api/dictionaries/${dictionaryId}/entries`,\n {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n },\n )\n if (!call.ok) {\n throw new Error(\n typeof call.result?.error === 'string' ? call.result.error : 'Failed to create dictionary entry',\n )\n }\n return call\n },\n context: {\n formId: mutationContextId,\n resourceKind: 'dictionaries.dictionary_entry',\n retryLastMutation,\n },\n mutationPayload: payload,\n })\n flash(t('dictionaries.config.entries.success.create', 'Dictionary entry created.'), 'success')\n }\n await invalidateDictionaryEntries(queryClient, dictionaryId)\n setDialogOpen(false)\n setFormState({ value: '', label: '', color: null, icon: null })\n appearance.setColor(null)\n appearance.setIcon(null)\n setErrors({})\n } catch (err) {\n if (surfaceRecordConflict(err, t)) {\n return\n }\n logger.error('Failed to save dictionary entry', { err })\n flash(t('dictionaries.config.entries.error.save', 'Failed to save dictionary entry.'), 'error')\n } finally {\n setIsSaving(false)\n }\n }, [appearance, dictionaryId, formState.id, formState.label, formState.updatedAt, formState.value, mutationContextId, queryClient, readOnly, readOnlyMessage, runMutation, retryLastMutation, t])\n\n const handleDelete = React.useCallback(\n async (entry: Entry) => {\n if (readOnly) {\n flash(readOnlyMessage, 'info')\n return\n }\n if (!entry.id) return\n const confirmDelete = await confirm({\n title: t('dictionaries.config.entries.delete.confirm', 'Delete \"{{value}}\"?', { value: entry.label || entry.value }),\n variant: 'destructive',\n })\n if (!confirmDelete) return\n setIsDeleting(true)\n try {\n await runMutation({\n operation: () =>\n withScopedApiRequestHeaders(\n buildOptimisticLockHeader(entry.updatedAt),\n async () => {\n const call = await apiCall<Record<string, unknown>>(\n `/api/dictionaries/${dictionaryId}/entries/${entry.id}`,\n { method: 'DELETE' },\n )\n if (!call.ok) {\n throw Object.assign(\n new Error(\n typeof call.result?.error === 'string' ? call.result.error : 'Failed to delete dictionary entry',\n ),\n { status: call.status, ...(call.result && typeof call.result === 'object' ? call.result : {}) },\n )\n }\n return call\n },\n ),\n context: {\n formId: mutationContextId,\n resourceKind: 'dictionaries.dictionary_entry',\n resourceId: entry.id,\n retryLastMutation,\n },\n mutationPayload: { id: entry.id },\n })\n await invalidateDictionaryEntries(queryClient, dictionaryId)\n flash(t('dictionaries.config.entries.success.delete', 'Dictionary entry deleted.'), 'success')\n } catch (err) {\n // Route a concurrent-edit 409 through the single conflict surface (matching\n // the entry save path); fall back to a flash for any other delete failure.\n if (surfaceRecordConflict(err, t)) {\n return\n }\n logger.error('Failed to delete dictionary entry', { err })\n flash(t('dictionaries.config.entries.error.delete', 'Failed to delete dictionary entry.'), 'error')\n } finally {\n setIsDeleting(false)\n }\n },\n [confirm, dictionaryId, mutationContextId, queryClient, readOnly, readOnlyMessage, runMutation, retryLastMutation, t],\n )\n\n const tableContent = React.useMemo(() => {\n if (isInitialLoading) {\n return (\n <TableRow>\n <TableCell colSpan={4} className=\"py-8 text-center text-sm text-muted-foreground\">\n <Spinner className=\"mx-auto mb-2 h-5 w-5\" />\n {t('dictionaries.config.entries.loading', 'Loading entries\u2026')}\n </TableCell>\n </TableRow>\n )\n }\n if (loadError) {\n return (\n <TableRow>\n <TableCell colSpan={4} className=\"py-6 text-center text-sm text-destructive\">\n {loadError}\n </TableCell>\n </TableRow>\n )\n }\n if (!entries.length) {\n return (\n <TableRow>\n <TableCell colSpan={4} className=\"py-6 text-center text-sm text-muted-foreground\">\n {t('dictionaries.config.entries.empty', 'No entries yet.')}\n </TableCell>\n </TableRow>\n )\n }\n return entries.map((entry) => (\n <TableRow key={entry.id}>\n <TableCell className=\"font-medium\">{entry.value}</TableCell>\n <TableCell>{entry.label}</TableCell>\n <TableCell>\n <DictionaryValue\n value={entry.value}\n map={dictionaryMap}\n fallback={<span className=\"text-sm text-muted-foreground\">{t('dictionaries.config.entries.appearance.none', 'None')}</span>}\n />\n </TableCell>\n <TableCell className=\"flex items-center gap-2\">\n {readOnly ? (\n <span className=\"text-xs text-muted-foreground\">\n {t('dictionaries.config.entries.readOnlyActions', 'Managed in parent organization')}\n </span>\n ) : (\n <>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => openDialog(entry)}\n >\n <Pencil className=\"h-4 w-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => setTranslateEntry(entry)}\n title={t('dictionaries.config.entries.actions.translate', 'Translate')}\n >\n <Languages className=\"h-4 w-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => handleDelete(entry)}\n disabled={isDeleting}\n >\n <Trash2 className=\"h-4 w-4\" />\n </Button>\n </>\n )}\n </TableCell>\n </TableRow>\n ))\n }, [dictionaryMap, entries, handleDelete, isDeleting, isInitialLoading, loadError, openDialog, readOnly, t])\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div>\n <h2 className=\"text-lg font-semibold\">{dictionaryName}</h2>\n <p className=\"text-sm text-muted-foreground\">\n {readOnly\n ? readOnlyMessage\n : t('dictionaries.config.entries.subtitle', 'Manage reusable values and appearance for this dictionary.')}\n </p>\n </div>\n <div className=\"flex gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => {\n dictionaryQuery.refetch().catch(() => {})\n }}\n >\n <RefreshCw className=\"mr-2 h-4 w-4\" />\n {t('dictionaries.config.entries.actions.refresh', 'Refresh')}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => openDialog()}\n disabled={readOnly}\n title={readOnly ? readOnlyMessage : undefined}\n >\n <Plus className=\"mr-2 h-4 w-4\" />\n {t('dictionaries.config.entries.actions.add', 'Add entry')}\n </Button>\n </div>\n </div>\n\n <div className=\"overflow-hidden rounded-md border\">\n <Table>\n <TableHeader>\n <TableRow>\n <TableHead className=\"w-48\">{t('dictionaries.config.entries.columns.value', 'Value')}</TableHead>\n <TableHead className=\"w-48\">{t('dictionaries.config.entries.columns.label', 'Label')}</TableHead>\n <TableHead>{t('dictionaries.config.entries.columns.appearance', 'Appearance')}</TableHead>\n <TableHead className=\"w-32 text-right\">{t('dictionaries.config.entries.columns.actions', 'Actions')}</TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>{tableContent}</TableBody>\n </Table>\n </div>\n\n <Dialog open={dialogOpen} onOpenChange={(open) => (!open ? closeDialog() : undefined)}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>\n {formState.id\n ? t('dictionaries.config.entries.dialog.editTitle', 'Edit dictionary entry')\n : t('dictionaries.config.entries.dialog.addTitle', 'Add dictionary entry')}\n </DialogTitle>\n </DialogHeader>\n <div className=\"space-y-4\">\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">\n {t('dictionaries.config.entries.dialog.valueLabel', 'Value')}\n <span className=\"ml-1 text-destructive\">*</span>\n </label>\n <Input\n type=\"text\"\n value={formState.value}\n onChange={(event) => {\n const nextValue = event.target.value\n setFormState((prev) => ({ ...prev, value: nextValue }))\n if (errors.value) {\n setErrors((prev) => ({ ...prev, value: undefined }))\n }\n }}\n aria-invalid={errors.value ? 'true' : 'false'}\n aria-describedby=\"dictionary-entry-value-error\"\n />\n {errors.value ? (\n <p id=\"dictionary-entry-value-error\" className=\"text-xs text-destructive\">\n {errors.value}\n </p>\n ) : null}\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-sm font-medium\">\n {t('dictionaries.config.entries.dialog.labelLabel', 'Label')}\n </label>\n <Input\n type=\"text\"\n value={formState.label}\n onChange={(event) => setFormState((prev) => ({ ...prev, label: event.target.value }))}\n placeholder={t('dictionaries.config.entries.dialog.labelPlaceholder', 'Display name shown in UI')}\n />\n </div>\n <AppearanceSelector\n icon={appearance.icon}\n color={appearance.color}\n previewLabel={formState.label.trim() || formState.value.trim()}\n onIconChange={(next) => {\n appearance.setIcon(next)\n setFormState((prev) => ({ ...prev, icon: next }))\n }}\n onColorChange={(next) => {\n appearance.setColor(next)\n setFormState((prev) => ({ ...prev, color: next }))\n }}\n labels={{\n colorLabel: t('dictionaries.config.entries.dialog.colorLabel', 'Color'),\n colorHelp: t('dictionaries.config.entries.dialog.colorHelp', 'Pick a highlight color for this entry.'),\n colorClearLabel: t('dictionaries.config.entries.dialog.colorClear', 'Remove color'),\n iconLabel: t('dictionaries.config.entries.dialog.iconLabel', 'Icon or emoji'),\n iconPlaceholder: t('dictionaries.config.entries.dialog.iconPlaceholder', 'Type an emoji or icon token.'),\n iconPickerTriggerLabel: t('dictionaries.config.entries.dialog.iconBrowse', 'Browse icons and emoji'),\n iconSearchPlaceholder: t('dictionaries.config.entries.dialog.iconSearchPlaceholder', 'Search icons or emojis\u2026'),\n iconSearchEmptyLabel: t('dictionaries.config.entries.dialog.iconSearchEmpty', 'No icons match your search.'),\n iconSuggestionsLabel: t('dictionaries.config.entries.dialog.iconSuggestions', 'Suggestions'),\n iconClearLabel: t('dictionaries.config.entries.dialog.iconClear', 'Remove icon'),\n previewEmptyLabel: t('dictionaries.config.entries.dialog.previewEmpty', 'No appearance selected'),\n }}\n />\n </div>\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={closeDialog}\n disabled={isSaving}\n >\n {t('dictionaries.config.entries.dialog.cancel', 'Cancel')}\n </Button>\n <Button\n type=\"button\"\n onClick={handleSave}\n disabled={isSaving}\n >\n {isSaving ? <Spinner className=\"mr-2 h-4 w-4\" /> : null}\n {t('dictionaries.config.entries.dialog.save', 'Save')}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n <Dialog open={!!translateEntry} onOpenChange={(open) => { if (!open) setTranslateEntry(null) }}>\n <DialogContent className=\"max-w-2xl max-h-[80vh] overflow-y-auto\">\n <DialogHeader>\n <DialogTitle>{t('translations.manager.translateEntry', 'Translate: {{label}}', { label: translateEntry?.label ?? '' })}</DialogTitle>\n <DialogDescription>\n {t('translations.manager.translateEntryDescription', 'Manage translations for this dictionary entry.')}\n </DialogDescription>\n </DialogHeader>\n {translateEntry?.id && (\n <TranslationManager\n mode=\"embedded\"\n entityType=\"dictionaries:dictionary_entry\"\n recordId={translateEntry.id}\n baseValues={{ label: translateEntry.label }}\n translatableFields={['label']}\n />\n )}\n </DialogContent>\n </Dialog>\n {ConfirmDialogElement}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA2SU,SA0CI,UAzCF,KADF;AAzSV,YAAY,WAAW;AACvB,SAAS,MAAM,QAAQ,QAAQ,WAAW,iBAAiB;AAC3D,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,OAAO,WAAW,WAAW,WAAW,aAAa,gBAAgB;AAC9E,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,SAAS,mCAAmC;AACrD,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB,SAAS,wBAAwB;AACjC,SAAS,oBAAoB,0BAA0B;AACvD,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,cAAc,EAAE,MAAM,EAAE,WAAW,0BAA0B,CAAC;AAmBnF,SAAS,wBAA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AAA,YAET;AAAA,yBAAW,oBAAC,WAAQ,WAAU,gBAAe,IAAK;AAAA,cAClD,EAAE,2CAA2C,MAAM;AAAA;AAAA;AAAA,QACtD;AAAA,SACF;AAAA,OACF,GACF;AAAA,IACA,oBAAC,UAAO,MAAM,CAAC,CAAC,gBAAgB,cAAc,CAAC,SAAS;AAAE,UAAI,CAAC,KAAM,mBAAkB,IAAI;AAAA,IAAE,GAC3F,+BAAC,iBAAc,WAAU,0CACvB;AAAA,2BAAC,gBACC;AAAA,4BAAC,eAAa,YAAE,uCAAuC,wBAAwB,EAAE,OAAO,gBAAgB,SAAS,GAAG,CAAC,GAAE;AAAA,QACvH,oBAAC,qBACE,YAAE,kDAAkD,gDAAgD,GACvG;AAAA,SACF;AAAA,MACC,gBAAgB,MACf;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,YAAW;AAAA,UACX,UAAU,eAAe;AAAA,UACzB,YAAY,EAAE,OAAO,eAAe,MAAM;AAAA,UAC1C,oBAAoB,CAAC,OAAO;AAAA;AAAA,MAC9B;AAAA,OAEJ,GACF;AAAA,IACC;AAAA,KACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
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.6519.1.bdc91fb755",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -253,16 +253,16 @@
|
|
|
253
253
|
"zod": "^4.4.3"
|
|
254
254
|
},
|
|
255
255
|
"peerDependencies": {
|
|
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.6519.1.bdc91fb755",
|
|
257
|
+
"@open-mercato/shared": "0.6.6-develop.6519.1.bdc91fb755",
|
|
258
|
+
"@open-mercato/ui": "0.6.6-develop.6519.1.bdc91fb755",
|
|
259
259
|
"react": "^19.0.0",
|
|
260
260
|
"react-dom": "^19.0.0"
|
|
261
261
|
},
|
|
262
262
|
"devDependencies": {
|
|
263
|
-
"@open-mercato/ai-assistant": "0.6.6-develop.
|
|
264
|
-
"@open-mercato/shared": "0.6.6-develop.
|
|
265
|
-
"@open-mercato/ui": "0.6.6-develop.
|
|
263
|
+
"@open-mercato/ai-assistant": "0.6.6-develop.6519.1.bdc91fb755",
|
|
264
|
+
"@open-mercato/shared": "0.6.6-develop.6519.1.bdc91fb755",
|
|
265
|
+
"@open-mercato/ui": "0.6.6-develop.6519.1.bdc91fb755",
|
|
266
266
|
"@testing-library/dom": "^10.4.1",
|
|
267
267
|
"@testing-library/jest-dom": "^6.9.1",
|
|
268
268
|
"@testing-library/react": "^16.3.1",
|
|
@@ -37,7 +37,37 @@ export function compareVersions(a: string, b: string): number {
|
|
|
37
37
|
return semver.compare(cleanA, cleanB)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export const upgradeActions: UpgradeActionDefinition[] = [
|
|
40
|
+
export const upgradeActions: UpgradeActionDefinition[] = [
|
|
41
|
+
{
|
|
42
|
+
id: 'customers.seed-interaction-statuses',
|
|
43
|
+
version: '0.6.5',
|
|
44
|
+
messageKey: 'customers.config.upgradeActions.interactionStatuses.message',
|
|
45
|
+
ctaKey: 'customers.config.upgradeActions.interactionStatuses.cta',
|
|
46
|
+
successKey: 'customers.config.upgradeActions.interactionStatuses.success',
|
|
47
|
+
loadingKey: 'customers.config.upgradeActions.interactionStatuses.loading',
|
|
48
|
+
// Existing tenants predate the `interaction_status` dictionary, so their status
|
|
49
|
+
// dropdown is empty until seeded. New tenants get it via customers `seedDefaults`.
|
|
50
|
+
// Lazy-imported so configs stays decoupled from customers (the catalog of actions
|
|
51
|
+
// lives here, but customers code only loads when the action actually runs).
|
|
52
|
+
run: async ({ em, tenantId, organizationId }) => {
|
|
53
|
+
const [{ INTERACTION_STATUS_DEFAULTS }, { ensureDictionaryEntry }] = await Promise.all([
|
|
54
|
+
import('@open-mercato/core/modules/customers/cli'),
|
|
55
|
+
import('@open-mercato/core/modules/customers/commands/shared'),
|
|
56
|
+
])
|
|
57
|
+
for (const entry of INTERACTION_STATUS_DEFAULTS) {
|
|
58
|
+
await ensureDictionaryEntry(em, {
|
|
59
|
+
tenantId,
|
|
60
|
+
organizationId,
|
|
61
|
+
kind: 'interaction_status',
|
|
62
|
+
value: entry.value,
|
|
63
|
+
label: entry.label,
|
|
64
|
+
color: entry.color,
|
|
65
|
+
icon: entry.icon,
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
]
|
|
41
71
|
|
|
42
72
|
export function actionsUpToVersion(version: string): UpgradeActionDefinition[] {
|
|
43
73
|
return upgradeActions // NOSONAR — upgradeActions is populated at boot time by modules
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type AiToolExecutionContext,
|
|
14
14
|
} from '@open-mercato/ai-assistant/modules/ai_assistant/lib/ai-api-operation-runner'
|
|
15
15
|
import { findOneWithDecryption, findWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
16
|
+
import { TERMINAL_INTERACTION_STATUS_LIST } from '../lib/interactionStatus'
|
|
16
17
|
import {
|
|
17
18
|
CustomerActivity,
|
|
18
19
|
CustomerComment,
|
|
@@ -238,9 +239,9 @@ const listTasksInput = z
|
|
|
238
239
|
companyId: z.string().uuid().optional().describe('Restrict to tasks linked to this company entity id.'),
|
|
239
240
|
dealId: z.string().uuid().optional().describe('Restrict to tasks connected to this deal id.'),
|
|
240
241
|
status: z
|
|
241
|
-
.enum(['open', 'done', 'cancelled'])
|
|
242
|
+
.enum(['open', 'in_progress', 'waiting', 'done', 'canceled', 'cancelled'])
|
|
242
243
|
.optional()
|
|
243
|
-
.describe('Filter canonical interaction tasks by status. Ignored when listing legacy todo links.'),
|
|
244
|
+
.describe('Filter canonical interaction tasks by status. "open" matches every non-terminal status (planned/in_progress/waiting and custom statuses). "cancelled" is accepted as an alias for "canceled". Ignored when listing legacy todo links.'),
|
|
244
245
|
limit: z.number().int().min(1).max(100).optional().describe('Max rows (default 50, max 100).'),
|
|
245
246
|
offset: z.number().int().min(0).optional().describe('Rows to skip (default 0).'),
|
|
246
247
|
})
|
|
@@ -269,7 +270,15 @@ const listTasksTool: CustomersAiToolDefinition = {
|
|
|
269
270
|
if (ctx.organizationId) interactionWhere.organizationId = ctx.organizationId
|
|
270
271
|
if (entityId) interactionWhere.entity = entityId
|
|
271
272
|
if (input.dealId) interactionWhere.dealId = input.dealId
|
|
272
|
-
if (input.status)
|
|
273
|
+
if (input.status) {
|
|
274
|
+
if (input.status === 'open') {
|
|
275
|
+
interactionWhere.status = { $nin: [...TERMINAL_INTERACTION_STATUS_LIST] }
|
|
276
|
+
} else if (input.status === 'cancelled') {
|
|
277
|
+
interactionWhere.status = 'canceled'
|
|
278
|
+
} else {
|
|
279
|
+
interactionWhere.status = input.status
|
|
280
|
+
}
|
|
281
|
+
}
|
|
273
282
|
const interactionRows = await findWithDecryption<CustomerInteraction>(
|
|
274
283
|
em,
|
|
275
284
|
CustomerInteraction,
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
resolveCompanyCustomFieldRouting,
|
|
29
29
|
mergeCompanyCustomFieldValues,
|
|
30
30
|
} from '../../../lib/customFieldRouting'
|
|
31
|
+
import { isOpenInteractionStatus, TERMINAL_INTERACTION_STATUS_LIST } from '../../../lib/interactionStatus'
|
|
31
32
|
import {
|
|
32
33
|
CUSTOMER_INTERACTION_ACTIVITY_ADAPTER_SOURCE,
|
|
33
34
|
EXAMPLE_TODO_SOURCE,
|
|
@@ -624,7 +625,7 @@ export async function GET(_req: Request, ctx: { params?: { id?: string } }) {
|
|
|
624
625
|
const plannedPreviewRows =
|
|
625
626
|
canonicalActiveInteractions.length > 0
|
|
626
627
|
? canonicalActiveInteractions
|
|
627
|
-
.filter((interaction) => interaction.status
|
|
628
|
+
.filter((interaction) => isOpenInteractionStatus(interaction.status) && interaction.interactionType !== 'task')
|
|
628
629
|
.sort((left, right) => {
|
|
629
630
|
const leftTime = new Date(left.scheduledAt ?? left.createdAt).getTime()
|
|
630
631
|
const rightTime = new Date(right.scheduledAt ?? right.createdAt).getTime()
|
|
@@ -640,7 +641,7 @@ export async function GET(_req: Request, ctx: { params?: { id?: string } }) {
|
|
|
640
641
|
organizationId: company.organizationId,
|
|
641
642
|
tenantId: company.tenantId,
|
|
642
643
|
deletedAt: null,
|
|
643
|
-
status:
|
|
644
|
+
status: { $nin: [...TERMINAL_INTERACTION_STATUS_LIST] },
|
|
644
645
|
interactionType: { $ne: 'task' },
|
|
645
646
|
...emailVisibilityFilter,
|
|
646
647
|
},
|
|
@@ -25,6 +25,7 @@ export const BUILTIN_DICTIONARY_ROUTE_KINDS = [
|
|
|
25
25
|
'temperature',
|
|
26
26
|
'renewal-quarters',
|
|
27
27
|
'person-company-roles',
|
|
28
|
+
'interaction-statuses',
|
|
28
29
|
] as const
|
|
29
30
|
|
|
30
31
|
type BuiltinDictionaryRouteKind = (typeof BUILTIN_DICTIONARY_ROUTE_KINDS)[number]
|
|
@@ -55,6 +56,7 @@ const KIND_MAP: Record<BuiltinDictionaryRouteKind, DictionaryEntityKind> = {
|
|
|
55
56
|
temperature: 'temperature',
|
|
56
57
|
'renewal-quarters': 'renewal_quarter',
|
|
57
58
|
'person-company-roles': 'person_company_role',
|
|
59
|
+
'interaction-statuses': 'interaction_status',
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
export const paramsSchema = z.object({
|
|
@@ -10,6 +10,7 @@ import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
|
10
10
|
import { findWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
11
11
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
12
12
|
import { CustomerInteraction } from '../../../data/entities'
|
|
13
|
+
import { TERMINAL_INTERACTION_STATUS_LIST } from '../../../lib/interactionStatus'
|
|
13
14
|
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
14
15
|
|
|
15
16
|
const logger = createLogger('customers')
|
|
@@ -103,7 +104,7 @@ export async function GET(req: Request) {
|
|
|
103
104
|
.selectFrom('customer_interactions')
|
|
104
105
|
.select(['id', 'scheduled_at', 'duration_minutes', 'interaction_type'])
|
|
105
106
|
.where('tenant_id', '=', auth.tenantId)
|
|
106
|
-
.where('status', '
|
|
107
|
+
.where('status', 'not in', [...TERMINAL_INTERACTION_STATUS_LIST])
|
|
107
108
|
.where('scheduled_at', 'is not', null)
|
|
108
109
|
.where('deleted_at', 'is', null)
|
|
109
110
|
|
|
@@ -9,13 +9,16 @@ import { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/d
|
|
|
9
9
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
10
10
|
import type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'
|
|
11
11
|
import { applyEmailVisibilityFilter } from '../../../lib/visibilityFilter'
|
|
12
|
+
import { TERMINAL_INTERACTION_STATUS_LIST } from '../../../lib/interactionStatus'
|
|
12
13
|
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
13
14
|
|
|
14
15
|
const logger = createLogger('customers')
|
|
15
16
|
|
|
16
17
|
const querySchema = z.object({
|
|
17
18
|
entityId: z.string().uuid(),
|
|
18
|
-
status
|
|
19
|
+
// `open` counts every non-terminal status (planned/in_progress/waiting + any custom status);
|
|
20
|
+
// `planned` is kept as the BC alias for callers that used it to mean "open".
|
|
21
|
+
status: z.enum(['done', 'planned', 'open']).optional(),
|
|
19
22
|
})
|
|
20
23
|
|
|
21
24
|
const responseSchema = z.object({
|
|
@@ -87,7 +90,9 @@ export async function GET(req: Request) {
|
|
|
87
90
|
baseQuery = baseQuery.where('organization_id', 'in', organizationIds)
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
if (query.status) {
|
|
93
|
+
if (query.status === 'open' || query.status === 'planned') {
|
|
94
|
+
baseQuery = baseQuery.where('status', 'not in', [...TERMINAL_INTERACTION_STATUS_LIST])
|
|
95
|
+
} else if (query.status) {
|
|
91
96
|
baseQuery = baseQuery.where('status', '=', query.status)
|
|
92
97
|
}
|
|
93
98
|
|
|
@@ -23,6 +23,7 @@ import { User } from '@open-mercato/core/modules/auth/data/entities'
|
|
|
23
23
|
import { loadCustomFieldValues } from '@open-mercato/shared/lib/crud/custom-fields'
|
|
24
24
|
import { E } from '#generated/entities.ids.generated'
|
|
25
25
|
import { mergePersonCustomFieldValues, resolvePersonCustomFieldRouting } from '../../../lib/customFieldRouting'
|
|
26
|
+
import { isOpenInteractionStatus, TERMINAL_INTERACTION_STATUS_LIST } from '../../../lib/interactionStatus'
|
|
26
27
|
import {
|
|
27
28
|
CUSTOMER_INTERACTION_ACTIVITY_ADAPTER_SOURCE,
|
|
28
29
|
EXAMPLE_TODO_SOURCE,
|
|
@@ -663,7 +664,7 @@ export async function GET(_req: Request, ctx: { params?: { id?: string } }) {
|
|
|
663
664
|
const plannedPreviewInteractions = shouldLoadCanonicalInteractions
|
|
664
665
|
? (() => {
|
|
665
666
|
const sorted = [...canonicalInteractions]
|
|
666
|
-
.filter((interaction) => interaction.status
|
|
667
|
+
.filter((interaction) => isOpenInteractionStatus(interaction.status) && interaction.interactionType !== 'task')
|
|
667
668
|
.sort((left, right) => {
|
|
668
669
|
const leftTime = new Date(left.scheduledAt ?? left.createdAt).getTime()
|
|
669
670
|
const rightTime = new Date(right.scheduledAt ?? right.createdAt).getTime()
|
|
@@ -685,7 +686,7 @@ export async function GET(_req: Request, ctx: { params?: { id?: string } }) {
|
|
|
685
686
|
organizationId: person.organizationId,
|
|
686
687
|
tenantId: person.tenantId,
|
|
687
688
|
deletedAt: null,
|
|
688
|
-
status:
|
|
689
|
+
status: { $nin: [...TERMINAL_INTERACTION_STATUS_LIST] },
|
|
689
690
|
interactionType: { $ne: 'task' },
|
|
690
691
|
...emailVisibilityFilter,
|
|
691
692
|
},
|
|
@@ -119,6 +119,14 @@ const ACTIVITY_TYPE_DEFAULTS: DictionaryDefault[] = [
|
|
|
119
119
|
{ value: 'task', label: 'Task', color: '#ef4444', icon: 'lucide:check-square' },
|
|
120
120
|
]
|
|
121
121
|
|
|
122
|
+
export const INTERACTION_STATUS_DEFAULTS: DictionaryDefault[] = [
|
|
123
|
+
{ value: 'planned', label: 'Planned', color: '#2563eb', icon: 'lucide:circle' },
|
|
124
|
+
{ value: 'in_progress', label: 'In progress', color: '#f59e0b', icon: 'lucide:activity' },
|
|
125
|
+
{ value: 'waiting', label: 'Waiting / blocked', color: '#a855f7', icon: 'lucide:pause-circle' },
|
|
126
|
+
{ value: 'done', label: 'Done', color: '#22c55e', icon: 'lucide:check-circle' },
|
|
127
|
+
{ value: 'canceled', label: 'Canceled', color: '#6b7280', icon: 'lucide:x-circle' },
|
|
128
|
+
]
|
|
129
|
+
|
|
122
130
|
const JOB_TITLE_DEFAULTS: DictionaryDefault[] = [
|
|
123
131
|
{ value: 'Director of Operations', label: 'Director of Operations', color: '#f97316', icon: 'lucide:settings' },
|
|
124
132
|
{ value: 'VP of Partnerships', label: 'VP of Partnerships', color: '#6366f1', icon: 'lucide:users' },
|
|
@@ -1155,6 +1163,17 @@ async function seedCustomerDictionaries(em: EntityManager, { tenantId, organizat
|
|
|
1155
1163
|
icon: entry.icon,
|
|
1156
1164
|
})
|
|
1157
1165
|
}
|
|
1166
|
+
for (const entry of INTERACTION_STATUS_DEFAULTS) {
|
|
1167
|
+
await ensureDictionaryEntry(em, {
|
|
1168
|
+
tenantId,
|
|
1169
|
+
organizationId,
|
|
1170
|
+
kind: 'interaction_status',
|
|
1171
|
+
value: entry.value,
|
|
1172
|
+
label: entry.label,
|
|
1173
|
+
color: entry.color,
|
|
1174
|
+
icon: entry.icon,
|
|
1175
|
+
})
|
|
1176
|
+
}
|
|
1158
1177
|
for (const entry of JOB_TITLE_DEFAULTS) {
|
|
1159
1178
|
await ensureDictionaryEntry(em, {
|
|
1160
1179
|
tenantId,
|
|
@@ -43,6 +43,11 @@ import { enforceRecordGoneIsConflict, enforceCommandOptimisticLockWithGuards } f
|
|
|
43
43
|
import { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
44
44
|
import type { CrudIndexerConfig, CrudEventsConfig } from '@open-mercato/shared/lib/crud/types'
|
|
45
45
|
import { recomputeNextInteraction } from '../lib/interactionProjection'
|
|
46
|
+
import {
|
|
47
|
+
INTERACTION_STATUS_CANCELED,
|
|
48
|
+
INTERACTION_STATUS_COMPLETED,
|
|
49
|
+
INTERACTION_STATUS_PLANNED,
|
|
50
|
+
} from '../lib/interactionStatus'
|
|
46
51
|
import { canChangeEmailVisibility } from '../lib/visibilityFilter'
|
|
47
52
|
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
48
53
|
|
|
@@ -393,7 +398,7 @@ const createInteractionCommand: CommandHandler<InteractionCreateInput, { interac
|
|
|
393
398
|
interactionType: parsed.interactionType,
|
|
394
399
|
title: parsed.title ?? null,
|
|
395
400
|
body: parsed.body ?? null,
|
|
396
|
-
status: parsed.status ??
|
|
401
|
+
status: parsed.status ?? INTERACTION_STATUS_PLANNED,
|
|
397
402
|
scheduledAt: parsed.scheduledAt ?? null,
|
|
398
403
|
occurredAt: parsed.occurredAt ?? null,
|
|
399
404
|
priority: parsed.priority ?? null,
|
|
@@ -922,7 +927,7 @@ const completeInteractionCommand: CommandHandler<InteractionCompleteInput, { int
|
|
|
922
927
|
request: ctx.request ?? null,
|
|
923
928
|
})
|
|
924
929
|
|
|
925
|
-
interaction.status =
|
|
930
|
+
interaction.status = INTERACTION_STATUS_COMPLETED
|
|
926
931
|
interaction.occurredAt = parsed.occurredAt ?? new Date()
|
|
927
932
|
await trx.flush()
|
|
928
933
|
|
|
@@ -1062,7 +1067,7 @@ const cancelInteractionCommand: CommandHandler<InteractionCancelInput, { interac
|
|
|
1062
1067
|
request: ctx.request ?? null,
|
|
1063
1068
|
})
|
|
1064
1069
|
|
|
1065
|
-
interaction.status =
|
|
1070
|
+
interaction.status = INTERACTION_STATUS_CANCELED
|
|
1066
1071
|
await trx.flush()
|
|
1067
1072
|
|
|
1068
1073
|
const entityId = typeof interaction.entity === 'string' ? interaction.entity : interaction.entity.id
|
|
@@ -110,6 +110,11 @@ export default function DictionarySettings() {
|
|
|
110
110
|
title: t('customers.config.dictionaries.sections.activityTypes.title', 'Activity types'),
|
|
111
111
|
description: t('customers.config.dictionaries.sections.activityTypes.description', 'Define the activity types used for customer interactions.'),
|
|
112
112
|
},
|
|
113
|
+
{
|
|
114
|
+
kind: 'interaction-statuses',
|
|
115
|
+
title: t('customers.config.dictionaries.sections.interactionStatuses.title', 'Interaction statuses'),
|
|
116
|
+
description: t('customers.config.dictionaries.sections.interactionStatuses.description', 'Manage the statuses available for tasks and logged interactions.'),
|
|
117
|
+
},
|
|
113
118
|
{
|
|
114
119
|
kind: 'address-types',
|
|
115
120
|
title: t('customers.config.dictionaries.sections.addressTypes.title', 'Address types'),
|
|
@@ -92,6 +92,11 @@ export function DictionarySortSettings() {
|
|
|
92
92
|
title: t('customers.config.dictionaries.sections.activityTypes.title', 'Activity types'),
|
|
93
93
|
description: t('customers.config.dictionaries.sections.activityTypes.description', 'Define the activity types used for customer interactions.'),
|
|
94
94
|
},
|
|
95
|
+
{
|
|
96
|
+
kind: 'interaction-statuses',
|
|
97
|
+
title: t('customers.config.dictionaries.sections.interactionStatuses.title', 'Interaction statuses'),
|
|
98
|
+
description: t('customers.config.dictionaries.sections.interactionStatuses.description', 'Manage the statuses available for tasks and logged interactions.'),
|
|
99
|
+
},
|
|
95
100
|
{
|
|
96
101
|
kind: 'address-types',
|
|
97
102
|
title: t('customers.config.dictionaries.sections.addressTypes.title', 'Address types'),
|