@open-mercato/core 0.6.7-develop.6828.1.ab1620a63e → 0.6.7-develop.6842.1.8cd8a8883c
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/attachments/fields/attachment.js +1 -1
- package/dist/modules/attachments/fields/attachment.js.map +2 -2
- package/dist/modules/auth/components/UserConsentsPanel.js +9 -9
- package/dist/modules/auth/components/UserConsentsPanel.js.map +2 -2
- package/dist/modules/auth/frontend/reset.js +2 -2
- package/dist/modules/auth/frontend/reset.js.map +2 -2
- package/dist/modules/business_rules/components/ActionRow.js +1 -1
- package/dist/modules/business_rules/components/ActionRow.js.map +1 -1
- package/dist/modules/business_rules/components/ConditionRow.js +8 -4
- package/dist/modules/business_rules/components/ConditionRow.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +4 -4
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/create/page.js +5 -5
- package/dist/modules/catalog/backend/catalog/products/create/page.js.map +2 -2
- package/dist/modules/catalog/components/PriceKindSettings.js +3 -3
- package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductCategorizeSection.js +3 -3
- package/dist/modules/catalog/components/products/ProductCategorizeSection.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductMediaManager.js +1 -1
- package/dist/modules/catalog/components/products/ProductMediaManager.js.map +2 -2
- package/dist/modules/catalog/components/products/VariantBuilder.js +5 -5
- package/dist/modules/catalog/components/products/VariantBuilder.js.map +2 -2
- package/dist/modules/communication_channels/backend/profile/communication-channels/page.js +1 -1
- package/dist/modules/communication_channels/backend/profile/communication-channels/page.js.map +2 -2
- package/dist/modules/customers/components/detail/ActivitiesDayStrip.js +2 -3
- package/dist/modules/customers/components/detail/ActivitiesDayStrip.js.map +2 -2
- package/dist/modules/customers/components/detail/ConfirmDealLostDialog.js +1 -1
- package/dist/modules/customers/components/detail/ConfirmDealLostDialog.js.map +1 -1
- package/dist/modules/dashboards/api/widgets/data/schema.js +26 -17
- package/dist/modules/dashboards/api/widgets/data/schema.js.map +2 -2
- package/dist/modules/dashboards/lib/aggregations.js +20 -6
- package/dist/modules/dashboards/lib/aggregations.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/detail.js +8 -8
- package/dist/modules/design_system/gallery/entries/detail.js.map +1 -1
- package/dist/modules/design_system/gallery/entries/overlays.js +2 -2
- package/dist/modules/design_system/gallery/entries/overlays.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/scaffolding.js +8 -8
- package/dist/modules/design_system/gallery/entries/scaffolding.js.map +1 -1
- package/dist/modules/dictionaries/components/DictionaryEntrySelect.js +1 -1
- package/dist/modules/dictionaries/components/DictionaryEntrySelect.js.map +2 -2
- package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js +6 -6
- package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js.map +2 -2
- package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js +3 -3
- package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/dialogs.js +1 -1
- package/dist/modules/messages/components/message-detail/panels/dialogs.js.map +1 -1
- package/dist/modules/planner/components/AvailabilityRulesEditor.js +4 -4
- package/dist/modules/planner/components/AvailabilityRulesEditor.js.map +2 -2
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.js +1 -1
- package/dist/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.js.map +1 -1
- package/dist/modules/wms/components/backend/ReleaseReservationDialog.js +1 -1
- package/dist/modules/wms/components/backend/ReleaseReservationDialog.js.map +1 -1
- package/dist/modules/workflows/backend/definitions/page.js +1 -1
- package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js +1 -1
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/page.js +8 -8
- package/dist/modules/workflows/backend/instances/page.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/page.js +6 -6
- package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
- package/dist/modules/workflows/components/ActivitiesEditor.js +2 -2
- package/dist/modules/workflows/components/ActivitiesEditor.js.map +2 -2
- package/dist/modules/workflows/components/BusinessRulesSelector.js +1 -1
- package/dist/modules/workflows/components/BusinessRulesSelector.js.map +2 -2
- package/dist/modules/workflows/components/DefinitionTriggersEditor.js +2 -2
- package/dist/modules/workflows/components/DefinitionTriggersEditor.js.map +2 -2
- package/dist/modules/workflows/components/EdgeEditDialogCrudForm.js +1 -2
- package/dist/modules/workflows/components/EdgeEditDialogCrudForm.js.map +2 -2
- package/dist/modules/workflows/components/NodeEditDialogCrudForm.js +1 -2
- package/dist/modules/workflows/components/NodeEditDialogCrudForm.js.map +2 -2
- package/dist/modules/workflows/components/StepsEditor.js +2 -2
- package/dist/modules/workflows/components/StepsEditor.js.map +2 -2
- package/dist/modules/workflows/components/TransitionsEditor.js +3 -3
- package/dist/modules/workflows/components/TransitionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/WorkflowLegend.js +1 -1
- package/dist/modules/workflows/components/WorkflowLegend.js.map +2 -2
- package/dist/modules/workflows/components/WorkflowSelector.js +1 -1
- package/dist/modules/workflows/components/WorkflowSelector.js.map +2 -2
- package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js +1 -1
- package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js +1 -1
- package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/MappingArrayEditor.js +1 -1
- package/dist/modules/workflows/components/fields/MappingArrayEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js +1 -1
- package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/WorkflowSelectorField.js +4 -4
- package/dist/modules/workflows/components/fields/WorkflowSelectorField.js.map +2 -2
- package/package.json +8 -8
- package/src/modules/api_keys/i18n/ko.json +42 -0
- package/src/modules/attachments/fields/attachment.tsx +1 -1
- package/src/modules/attachments/i18n/ko.json +172 -0
- package/src/modules/audit_logs/i18n/ko.json +66 -0
- package/src/modules/auth/components/UserConsentsPanel.tsx +9 -9
- package/src/modules/auth/frontend/reset.tsx +2 -2
- package/src/modules/auth/i18n/ko.json +255 -0
- package/src/modules/business_rules/components/ActionRow.tsx +1 -1
- package/src/modules/business_rules/components/ConditionRow.tsx +9 -6
- package/src/modules/business_rules/i18n/ko.json +396 -0
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +4 -4
- package/src/modules/catalog/backend/catalog/products/create/page.tsx +5 -5
- package/src/modules/catalog/components/PriceKindSettings.tsx +3 -3
- package/src/modules/catalog/components/products/ProductCategorizeSection.tsx +3 -3
- package/src/modules/catalog/components/products/ProductMediaManager.tsx +1 -1
- package/src/modules/catalog/components/products/VariantBuilder.tsx +5 -5
- package/src/modules/catalog/i18n/ko.json +723 -0
- package/src/modules/communication_channels/backend/profile/communication-channels/page.tsx +1 -1
- package/src/modules/communication_channels/i18n/ko.json +138 -0
- package/src/modules/configs/i18n/ko.json +197 -0
- package/src/modules/currencies/i18n/de.json +1 -0
- package/src/modules/currencies/i18n/en.json +1 -0
- package/src/modules/currencies/i18n/es.json +1 -0
- package/src/modules/currencies/i18n/ko.json +160 -0
- package/src/modules/currencies/i18n/pl.json +1 -0
- package/src/modules/customer_accounts/i18n/ko.json +354 -0
- package/src/modules/customers/components/detail/ActivitiesDayStrip.tsx +2 -3
- package/src/modules/customers/components/detail/ConfirmDealLostDialog.tsx +1 -1
- 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/ko.json +2855 -0
- package/src/modules/customers/i18n/pl.json +10 -0
- package/src/modules/dashboards/api/widgets/data/schema.ts +48 -19
- package/src/modules/dashboards/i18n/ko.json +118 -0
- package/src/modules/dashboards/lib/aggregations.ts +42 -6
- package/src/modules/data_sync/i18n/ko.json +125 -0
- package/src/modules/design_system/gallery/entries/detail.tsx +8 -8
- package/src/modules/design_system/gallery/entries/overlays.tsx +2 -2
- package/src/modules/design_system/gallery/entries/scaffolding.tsx +8 -8
- package/src/modules/design_system/i18n/de.json +12 -0
- package/src/modules/design_system/i18n/en.json +12 -0
- package/src/modules/design_system/i18n/es.json +12 -0
- package/src/modules/design_system/i18n/ko.json +58 -0
- package/src/modules/design_system/i18n/pl.json +12 -0
- package/src/modules/dictionaries/components/DictionaryEntrySelect.tsx +1 -1
- package/src/modules/dictionaries/i18n/ko.json +130 -0
- package/src/modules/directory/i18n/ko.json +105 -0
- package/src/modules/entities/i18n/ko.json +260 -0
- package/src/modules/feature_toggles/i18n/ko.json +96 -0
- package/src/modules/inbox_ops/backend/inbox-ops/log/page.tsx +6 -6
- package/src/modules/inbox_ops/components/proposals/EditActionDialog.tsx +3 -3
- package/src/modules/inbox_ops/i18n/ko.json +196 -0
- package/src/modules/integrations/i18n/ko.json +129 -0
- package/src/modules/messages/components/message-detail/panels/dialogs.tsx +1 -1
- package/src/modules/messages/i18n/ko.json +263 -0
- package/src/modules/notifications/i18n/ko.json +55 -0
- package/src/modules/payment_gateways/i18n/ko.json +87 -0
- package/src/modules/planner/components/AvailabilityRulesEditor.tsx +4 -4
- package/src/modules/planner/i18n/ko.json +565 -0
- package/src/modules/portal/i18n/ko.json +143 -0
- package/src/modules/progress/i18n/ko.json +20 -0
- package/src/modules/query_index/i18n/ko.json +69 -0
- package/src/modules/resources/i18n/ko.json +770 -0
- package/src/modules/sales/i18n/ko.json +1442 -0
- package/src/modules/shipping_carriers/i18n/ko.json +85 -0
- package/src/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.tsx +1 -1
- package/src/modules/staff/i18n/ko.json +1162 -0
- package/src/modules/sync_excel/i18n/ko.json +107 -0
- package/src/modules/translations/i18n/ko.json +45 -0
- package/src/modules/wms/components/backend/ReleaseReservationDialog.tsx +1 -1
- package/src/modules/wms/i18n/ko.json +1053 -0
- package/src/modules/workflows/backend/definitions/page.tsx +1 -1
- package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +1 -1
- package/src/modules/workflows/backend/instances/page.tsx +8 -8
- package/src/modules/workflows/backend/tasks/page.tsx +6 -6
- package/src/modules/workflows/components/ActivitiesEditor.tsx +2 -2
- package/src/modules/workflows/components/BusinessRulesSelector.tsx +1 -1
- package/src/modules/workflows/components/DefinitionTriggersEditor.tsx +2 -2
- package/src/modules/workflows/components/EdgeEditDialogCrudForm.tsx +1 -2
- package/src/modules/workflows/components/NodeEditDialogCrudForm.tsx +1 -2
- package/src/modules/workflows/components/StepsEditor.tsx +2 -2
- package/src/modules/workflows/components/TransitionsEditor.tsx +3 -3
- package/src/modules/workflows/components/WorkflowLegend.tsx +1 -1
- package/src/modules/workflows/components/WorkflowSelector.tsx +1 -1
- package/src/modules/workflows/components/fields/BusinessRuleConditionsEditor.tsx +1 -1
- package/src/modules/workflows/components/fields/FormFieldArrayEditor.tsx +1 -1
- package/src/modules/workflows/components/fields/MappingArrayEditor.tsx +1 -1
- package/src/modules/workflows/components/fields/StartPreConditionsEditor.tsx +1 -1
- package/src/modules/workflows/components/fields/WorkflowSelectorField.tsx +4 -4
- package/src/modules/workflows/i18n/ko.json +1203 -0
|
@@ -39,7 +39,7 @@ const PackageEditor = (props) => {
|
|
|
39
39
|
type: "button",
|
|
40
40
|
variant: "ghost",
|
|
41
41
|
size: "sm",
|
|
42
|
-
className: "h-auto px-2 py-0.5 text-xs text-
|
|
42
|
+
className: "h-auto px-2 py-0.5 text-xs text-destructive hover:text-destructive/80",
|
|
43
43
|
onClick: () => removePackage(index),
|
|
44
44
|
disabled,
|
|
45
45
|
children: t("shipping_carriers.create.package.remove", "Remove")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { PackageDimension, PackageEditorProps } from '../types'\n\nconst PACKAGE_FIELDS = ['weightKg', 'lengthCm', 'widthCm', 'heightCm'] as const\n\nconst DEFAULT_PACKAGE: PackageDimension = { weightKg: 1, lengthCm: 20, widthCm: 15, heightCm: 10 }\n\nexport const PackageEditor = (props: PackageEditorProps) => {\n const { packages, onChange, disabled } = props\n const t = useT()\n\n const fieldLabel = (field: keyof PackageDimension) => {\n const labels: Record<keyof PackageDimension, string> = {\n weightKg: t('shipping_carriers.create.package.weightKg', 'Weight (kg)'),\n lengthCm: t('shipping_carriers.create.package.lengthCm', 'Length (cm)'),\n widthCm: t('shipping_carriers.create.package.widthCm', 'Width (cm)'),\n heightCm: t('shipping_carriers.create.package.heightCm', 'Height (cm)'),\n }\n return labels[field]\n }\n\n const updatePackage = (index: number, field: keyof PackageDimension, raw: string) => {\n const value = parseFloat(raw)\n onChange(packages.map((pkg, idx) =>\n idx === index ? { ...pkg, [field]: Number.isNaN(value) ? 0 : value } : pkg,\n ))\n }\n\n const addPackage = () => onChange([...packages, DEFAULT_PACKAGE])\n\n const removePackage = (index: number) => onChange(packages.filter((_, idx) => idx !== index))\n\n return (\n <div className=\"space-y-3\">\n {packages.map((pkg, index) => (\n <div key={index} className=\"rounded-lg border bg-muted/30 p-3\">\n <div className=\"mb-2 flex items-center justify-between\">\n <span className=\"text-xs font-medium text-muted-foreground\">\n {t('shipping_carriers.create.package.label', 'Package')} {index + 1}\n </span>\n {packages.length > 1 ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-auto px-2 py-0.5 text-xs text-
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { PackageDimension, PackageEditorProps } from '../types'\n\nconst PACKAGE_FIELDS = ['weightKg', 'lengthCm', 'widthCm', 'heightCm'] as const\n\nconst DEFAULT_PACKAGE: PackageDimension = { weightKg: 1, lengthCm: 20, widthCm: 15, heightCm: 10 }\n\nexport const PackageEditor = (props: PackageEditorProps) => {\n const { packages, onChange, disabled } = props\n const t = useT()\n\n const fieldLabel = (field: keyof PackageDimension) => {\n const labels: Record<keyof PackageDimension, string> = {\n weightKg: t('shipping_carriers.create.package.weightKg', 'Weight (kg)'),\n lengthCm: t('shipping_carriers.create.package.lengthCm', 'Length (cm)'),\n widthCm: t('shipping_carriers.create.package.widthCm', 'Width (cm)'),\n heightCm: t('shipping_carriers.create.package.heightCm', 'Height (cm)'),\n }\n return labels[field]\n }\n\n const updatePackage = (index: number, field: keyof PackageDimension, raw: string) => {\n const value = parseFloat(raw)\n onChange(packages.map((pkg, idx) =>\n idx === index ? { ...pkg, [field]: Number.isNaN(value) ? 0 : value } : pkg,\n ))\n }\n\n const addPackage = () => onChange([...packages, DEFAULT_PACKAGE])\n\n const removePackage = (index: number) => onChange(packages.filter((_, idx) => idx !== index))\n\n return (\n <div className=\"space-y-3\">\n {packages.map((pkg, index) => (\n <div key={index} className=\"rounded-lg border bg-muted/30 p-3\">\n <div className=\"mb-2 flex items-center justify-between\">\n <span className=\"text-xs font-medium text-muted-foreground\">\n {t('shipping_carriers.create.package.label', 'Package')} {index + 1}\n </span>\n {packages.length > 1 ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-auto px-2 py-0.5 text-xs text-destructive hover:text-destructive/80\"\n onClick={() => removePackage(index)}\n disabled={disabled}\n >\n {t('shipping_carriers.create.package.remove', 'Remove')}\n </Button>\n ) : null}\n </div>\n <div className=\"grid gap-3 sm:grid-cols-4\">\n {PACKAGE_FIELDS.map((field) => (\n <div key={field}>\n <label className=\"mb-1 block text-xs font-medium text-muted-foreground\">\n {fieldLabel(field)}\n </label>\n <Input\n type=\"number\"\n min=\"0.01\"\n step=\"0.01\"\n value={pkg[field]}\n onChange={(event) => updatePackage(index, field, event.target.value)}\n disabled={disabled}\n />\n </div>\n ))}\n </div>\n </div>\n ))}\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={addPackage} disabled={disabled}>\n {t('shipping_carriers.create.package.add', '+ Add package')}\n </Button>\n </div>\n )\n}\n"],
|
|
5
5
|
"mappings": ";AAyCY,SAIE,KAJF;AAvCZ,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,YAAY;AAGrB,MAAM,iBAAiB,CAAC,YAAY,YAAY,WAAW,UAAU;AAErE,MAAM,kBAAoC,EAAE,UAAU,GAAG,UAAU,IAAI,SAAS,IAAI,UAAU,GAAG;AAE1F,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,QAAM,EAAE,UAAU,UAAU,SAAS,IAAI;AACzC,QAAM,IAAI,KAAK;AAEf,QAAM,aAAa,CAAC,UAAkC;AACpD,UAAM,SAAiD;AAAA,MACrD,UAAU,EAAE,6CAA6C,aAAa;AAAA,MACtE,UAAU,EAAE,6CAA6C,aAAa;AAAA,MACtE,SAAS,EAAE,4CAA4C,YAAY;AAAA,MACnE,UAAU,EAAE,6CAA6C,aAAa;AAAA,IACxE;AACA,WAAO,OAAO,KAAK;AAAA,EACrB;AAEA,QAAM,gBAAgB,CAAC,OAAe,OAA+B,QAAgB;AACnF,UAAM,QAAQ,WAAW,GAAG;AAC5B,aAAS,SAAS;AAAA,MAAI,CAAC,KAAK,QAC1B,QAAQ,QAAQ,EAAE,GAAG,KAAK,CAAC,KAAK,GAAG,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,IAAI;AAAA,IACzE,CAAC;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
|
326
326
|
{
|
|
327
327
|
type: "submit",
|
|
328
|
-
variant: "destructive",
|
|
328
|
+
variant: "destructive-solid",
|
|
329
329
|
disabled: submitDisabled,
|
|
330
330
|
"data-testid": "wms-inventory-release-submit",
|
|
331
331
|
children: t("wms.backend.inventory.release.dialog.submit", "Release reservation")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/wms/components/backend/ReleaseReservationDialog.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { ShieldOff } from 'lucide-react'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { flashMutationError } from '../../lib/flashMutationError'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { raiseCrudError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { FormField } from '@open-mercato/ui/primitives/form-field'\nimport { KbdShortcut } from '@open-mercato/ui/primitives/kbd'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { useLocale, useT } from '@open-mercato/shared/lib/i18n/context'\nimport {\n createInventoryQuantityFormatter,\n formatReservationSourceLabel,\n} from '../../lib/inventoryDisplayUi'\nimport { parseInventoryQuantity } from '../../lib/inventoryMutationUi'\nimport type { WmsInventoryMutationAccess } from './useWmsInventoryMutationAccess'\n\nconst RELEASE_REASON_CODES = ['order_cancelled', 'manual_release', 'correction', 'other'] as const\n\ntype ReleaseReasonCode = (typeof RELEASE_REASON_CODES)[number]\n\ntype ReservationSummary = {\n id: string\n warehouse_name?: string | null\n warehouse_code?: string | null\n variant_name?: string | null\n variant_sku?: string | null\n quantity?: string | number | null\n source_type?: string | null\n source_id?: string | null\n source_label?: string | null\n status?: string | null\n}\n\ntype ReleaseReservationDialogProps = {\n open: boolean\n onOpenChange: (open: boolean) => void\n access: WmsInventoryMutationAccess\n reservation: ReservationSummary | null\n onSuccess?: () => void\n}\n\nfunction formatVariantLabel(\n row: ReservationSummary,\n notAvailableLabel: string,\n): string {\n const name = (row.variant_name ?? '').trim()\n const sku = (row.variant_sku ?? '').trim()\n if (name && sku) return `${name} (${sku})`\n if (name) return name\n if (sku) return sku\n return notAvailableLabel\n}\n\nfunction formatWarehouseLabel(\n row: ReservationSummary,\n notAvailableLabel: string,\n): string {\n return (\n row.warehouse_name?.trim() ||\n row.warehouse_code?.trim() ||\n notAvailableLabel\n )\n}\n\nexport function ReleaseReservationDialog({\n open,\n onOpenChange,\n access,\n reservation,\n onSuccess,\n}: ReleaseReservationDialogProps) {\n const t = useT()\n const locale = useLocale()\n const quantityFormatter = React.useMemo(\n () => createInventoryQuantityFormatter(locale),\n [locale],\n )\n const notAvailableLabel = t('wms.backend.inventory.common.notAvailable', '\u2014')\n const queryClient = useQueryClient()\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: 'wms-inventory-release',\n })\n const mutationContext = React.useMemo(\n () => ({ retryLastMutation }),\n [retryLastMutation],\n )\n const releaseFormSchema = React.useMemo(\n () =>\n z.object({\n reasonCode: z.enum(RELEASE_REASON_CODES),\n notes: z.string().trim().max(500).optional(),\n }),\n [],\n )\n const [submitting, setSubmitting] = React.useState(false)\n const [reasonCode, setReasonCode] = React.useState<ReleaseReasonCode | ''>('')\n const [notes, setNotes] = React.useState('')\n const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({})\n\n const reasonLabel = React.useCallback(\n (code: ReleaseReasonCode) => {\n const fallbacks: Record<ReleaseReasonCode, string> = {\n order_cancelled: 'Order cancelled',\n manual_release: 'Manual release',\n correction: 'Correction',\n other: 'Other',\n }\n return t(`wms.backend.inventory.release.reasons.${code}`, fallbacks[code])\n },\n [t],\n )\n\n const resetDialog = React.useCallback(() => {\n setReasonCode('')\n setNotes('')\n setFieldErrors({})\n setSubmitting(false)\n }, [])\n\n React.useEffect(() => {\n if (!open || !reservation?.id) return\n setReasonCode('manual_release')\n setNotes('')\n setFieldErrors({})\n setSubmitting(false)\n }, [open, reservation?.id])\n\n const closeDialog = React.useCallback(() => {\n onOpenChange(false)\n resetDialog()\n }, [onOpenChange, resetDialog])\n\n const handleSubmit = React.useCallback(\n async (event?: React.FormEvent) => {\n event?.preventDefault()\n if (!reservation?.id) {\n flash(\n t(\n 'wms.backend.inventory.release.errors.missingReservation',\n 'Reservation context is missing. Close the dialog and try again from the reservations table.',\n ),\n 'error',\n )\n return\n }\n\n const parsed = releaseFormSchema.safeParse({\n reasonCode,\n notes: notes.trim() || undefined,\n })\n if (!parsed.success) {\n const nextErrors: Record<string, string> = {}\n for (const issue of parsed.error.issues) {\n const key = String(issue.path[0] ?? 'form')\n if (!nextErrors[key]) nextErrors[key] = issue.message\n }\n setFieldErrors(nextErrors)\n return\n }\n\n if (!access.scopeReady || !access.organizationId || !access.tenantId) {\n flash(\n t(\n 'wms.backend.inventory.mutations.errors.scope',\n 'Select an organization and sign in before posting inventory changes.',\n ),\n 'error',\n )\n return\n }\n\n setSubmitting(true)\n try {\n const reasonParts = [reasonLabel(parsed.data.reasonCode)]\n if (parsed.data.notes?.trim()) reasonParts.push(parsed.data.notes.trim())\n const payload = {\n organizationId: access.organizationId,\n tenantId: access.tenantId,\n reservationId: reservation.id,\n reason: reasonParts.join(' \u2014 ').slice(0, 120),\n reasonCode: parsed.data.reasonCode,\n }\n\n await runMutation({\n operation: async () => {\n const call = await apiCall<{ ok?: boolean }>('/api/wms/inventory/release', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n })\n if (!call.ok) {\n if (call.response.status === 409 && (call.result as { error?: string } | null)?.error === 'balance_integrity_violation') {\n flash(\n t(\n 'wms.backend.inventory.release.errors.balanceIntegrityViolation',\n 'Balance integrity error \u2014 run \"mercato wms verify-balances --repair\" to diagnose and fix drift before retrying.',\n ),\n 'error',\n )\n return {}\n }\n await raiseCrudError(\n call.response,\n t('wms.backend.inventory.release.errors.submit', 'Failed to release reservation.'),\n )\n }\n return call.result ?? {}\n },\n context: mutationContext,\n mutationPayload: payload,\n })\n\n flash(t('wms.backend.inventory.release.flash.success', 'Reservation released'), 'success')\n await queryClient.invalidateQueries({ queryKey: ['wms-inventory-console'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-sku-detail'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-location-detail'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-lot-detail'] })\n closeDialog()\n onSuccess?.()\n } catch (error) {\n flashMutationError(error, t('wms.backend.inventory.release.errors.submit', 'Failed to release reservation.'), t)\n } finally {\n setSubmitting(false)\n }\n },\n [\n access,\n closeDialog,\n mutationContext,\n notes,\n onSuccess,\n queryClient,\n reasonCode,\n reasonLabel,\n releaseFormSchema,\n reservation,\n runMutation,\n t,\n ],\n )\n\n const submitDisabled = submitting || access.loading || !access.scopeReady\n\n const handleDialogKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n closeDialog()\n return\n }\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {\n event.preventDefault()\n if (!submitDisabled) void handleSubmit()\n }\n },\n [closeDialog, handleSubmit, submitDisabled],\n )\n\n if (!reservation) return null\n\n return (\n <Dialog open={open} onOpenChange={(next) => (next ? onOpenChange(true) : closeDialog())}>\n <DialogContent\n className=\"max-w-lg gap-0 overflow-hidden p-0\"\n onKeyDown={handleDialogKeyDown}\n >\n <div className=\"border-b px-6 py-4 pr-12\">\n <DialogHeader className=\"space-y-1 text-left\">\n <DialogTitle>\n {t('wms.backend.inventory.release.dialog.title', 'Release reservation')}\n </DialogTitle>\n <DialogDescription>\n {t(\n 'wms.backend.inventory.release.dialog.description',\n 'Return reserved quantity to available stock for this bucket.',\n )}\n </DialogDescription>\n </DialogHeader>\n </div>\n\n <form onSubmit={handleSubmit} className=\"flex min-h-0 flex-1 flex-col\">\n <div className=\"flex flex-col gap-5 overflow-y-auto px-6 py-6\">\n <div className=\"rounded-lg border bg-muted/40 px-4 py-3.5\">\n <div className=\"flex items-start gap-3\">\n <ShieldOff className=\"mt-0.5 size-4 text-muted-foreground\" aria-hidden=\"true\" />\n <dl className=\"grid gap-2 text-sm\">\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.variant', 'Variant')}\n </dt>\n <dd className=\"font-medium\">\n {formatVariantLabel(reservation, notAvailableLabel)}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.warehouse', 'Warehouse')}\n </dt>\n <dd className=\"font-medium\">\n {formatWarehouseLabel(reservation, notAvailableLabel)}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.quantity', 'Quantity')}\n </dt>\n <dd className=\"font-medium tabular-nums\">\n {quantityFormatter.format(parseInventoryQuantity(reservation.quantity))}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.source', 'Source')}\n </dt>\n <dd className=\"font-medium\">\n {formatReservationSourceLabel(reservation, t) || notAvailableLabel}\n </dd>\n </div>\n </dl>\n </div>\n </div>\n\n <p className=\"rounded-lg border border-status-warning-border bg-status-warning-bg px-3 py-2.5 text-sm text-status-warning-text\">\n {t(\n 'wms.backend.inventory.release.warning',\n 'This action cannot be undone \u2014 the reserved quantity will be released immediately.',\n )}\n </p>\n\n <FormField\n label={t('wms.backend.inventory.release.form.reason', 'Reason')}\n required\n error={fieldErrors.reasonCode}\n >\n <Select\n value={reasonCode || undefined}\n onValueChange={(next) => {\n setReasonCode(next as ReleaseReasonCode)\n setFieldErrors({})\n }}\n disabled={submitting}\n >\n <SelectTrigger>\n <SelectValue\n placeholder={t(\n 'wms.backend.inventory.release.form.reasonPlaceholder',\n 'Select reason',\n )}\n />\n </SelectTrigger>\n <SelectContent>\n {RELEASE_REASON_CODES.map((code) => (\n <SelectItem key={code} value={code}>\n {reasonLabel(code)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </FormField>\n\n <FormField label={t('wms.backend.inventory.release.form.notes', 'Notes')}>\n <Textarea\n value={notes}\n onChange={(event) => setNotes(event.target.value)}\n placeholder={t(\n 'wms.backend.inventory.release.form.notesPlaceholder',\n 'Optional \u2014 additional context',\n )}\n rows={3}\n disabled={submitting}\n />\n </FormField>\n </div>\n\n <DialogFooter bordered={false} className=\"border-t px-6 py-4 sm:justify-between\">\n <p className=\"hidden text-xs text-muted-foreground sm:inline-flex sm:items-center sm:gap-1.5\">\n <KbdShortcut keys={['\u2318', 'Enter']} />\n <span>/</span>\n <KbdShortcut keys={['Ctrl', 'Enter']} />\n <span>{t('wms.backend.inventory.release.dialog.shortcutSave', 'to confirm')}</span>\n </p>\n <div className=\"flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row\">\n <Button type=\"button\" variant=\"outline\" onClick={closeDialog} disabled={submitting}>\n {t('common.cancel', 'Cancel')}\n </Button>\n <Button\n type=\"submit\"\n variant=\"destructive\"\n disabled={submitDisabled}\n data-testid=\"wms-inventory-release-submit\"\n >\n {t('wms.backend.inventory.release.dialog.submit', 'Release reservation')}\n </Button>\n </div>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n )\n}\n"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { ShieldOff } from 'lucide-react'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { flashMutationError } from '../../lib/flashMutationError'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { raiseCrudError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { FormField } from '@open-mercato/ui/primitives/form-field'\nimport { KbdShortcut } from '@open-mercato/ui/primitives/kbd'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { useLocale, useT } from '@open-mercato/shared/lib/i18n/context'\nimport {\n createInventoryQuantityFormatter,\n formatReservationSourceLabel,\n} from '../../lib/inventoryDisplayUi'\nimport { parseInventoryQuantity } from '../../lib/inventoryMutationUi'\nimport type { WmsInventoryMutationAccess } from './useWmsInventoryMutationAccess'\n\nconst RELEASE_REASON_CODES = ['order_cancelled', 'manual_release', 'correction', 'other'] as const\n\ntype ReleaseReasonCode = (typeof RELEASE_REASON_CODES)[number]\n\ntype ReservationSummary = {\n id: string\n warehouse_name?: string | null\n warehouse_code?: string | null\n variant_name?: string | null\n variant_sku?: string | null\n quantity?: string | number | null\n source_type?: string | null\n source_id?: string | null\n source_label?: string | null\n status?: string | null\n}\n\ntype ReleaseReservationDialogProps = {\n open: boolean\n onOpenChange: (open: boolean) => void\n access: WmsInventoryMutationAccess\n reservation: ReservationSummary | null\n onSuccess?: () => void\n}\n\nfunction formatVariantLabel(\n row: ReservationSummary,\n notAvailableLabel: string,\n): string {\n const name = (row.variant_name ?? '').trim()\n const sku = (row.variant_sku ?? '').trim()\n if (name && sku) return `${name} (${sku})`\n if (name) return name\n if (sku) return sku\n return notAvailableLabel\n}\n\nfunction formatWarehouseLabel(\n row: ReservationSummary,\n notAvailableLabel: string,\n): string {\n return (\n row.warehouse_name?.trim() ||\n row.warehouse_code?.trim() ||\n notAvailableLabel\n )\n}\n\nexport function ReleaseReservationDialog({\n open,\n onOpenChange,\n access,\n reservation,\n onSuccess,\n}: ReleaseReservationDialogProps) {\n const t = useT()\n const locale = useLocale()\n const quantityFormatter = React.useMemo(\n () => createInventoryQuantityFormatter(locale),\n [locale],\n )\n const notAvailableLabel = t('wms.backend.inventory.common.notAvailable', '\u2014')\n const queryClient = useQueryClient()\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: 'wms-inventory-release',\n })\n const mutationContext = React.useMemo(\n () => ({ retryLastMutation }),\n [retryLastMutation],\n )\n const releaseFormSchema = React.useMemo(\n () =>\n z.object({\n reasonCode: z.enum(RELEASE_REASON_CODES),\n notes: z.string().trim().max(500).optional(),\n }),\n [],\n )\n const [submitting, setSubmitting] = React.useState(false)\n const [reasonCode, setReasonCode] = React.useState<ReleaseReasonCode | ''>('')\n const [notes, setNotes] = React.useState('')\n const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({})\n\n const reasonLabel = React.useCallback(\n (code: ReleaseReasonCode) => {\n const fallbacks: Record<ReleaseReasonCode, string> = {\n order_cancelled: 'Order cancelled',\n manual_release: 'Manual release',\n correction: 'Correction',\n other: 'Other',\n }\n return t(`wms.backend.inventory.release.reasons.${code}`, fallbacks[code])\n },\n [t],\n )\n\n const resetDialog = React.useCallback(() => {\n setReasonCode('')\n setNotes('')\n setFieldErrors({})\n setSubmitting(false)\n }, [])\n\n React.useEffect(() => {\n if (!open || !reservation?.id) return\n setReasonCode('manual_release')\n setNotes('')\n setFieldErrors({})\n setSubmitting(false)\n }, [open, reservation?.id])\n\n const closeDialog = React.useCallback(() => {\n onOpenChange(false)\n resetDialog()\n }, [onOpenChange, resetDialog])\n\n const handleSubmit = React.useCallback(\n async (event?: React.FormEvent) => {\n event?.preventDefault()\n if (!reservation?.id) {\n flash(\n t(\n 'wms.backend.inventory.release.errors.missingReservation',\n 'Reservation context is missing. Close the dialog and try again from the reservations table.',\n ),\n 'error',\n )\n return\n }\n\n const parsed = releaseFormSchema.safeParse({\n reasonCode,\n notes: notes.trim() || undefined,\n })\n if (!parsed.success) {\n const nextErrors: Record<string, string> = {}\n for (const issue of parsed.error.issues) {\n const key = String(issue.path[0] ?? 'form')\n if (!nextErrors[key]) nextErrors[key] = issue.message\n }\n setFieldErrors(nextErrors)\n return\n }\n\n if (!access.scopeReady || !access.organizationId || !access.tenantId) {\n flash(\n t(\n 'wms.backend.inventory.mutations.errors.scope',\n 'Select an organization and sign in before posting inventory changes.',\n ),\n 'error',\n )\n return\n }\n\n setSubmitting(true)\n try {\n const reasonParts = [reasonLabel(parsed.data.reasonCode)]\n if (parsed.data.notes?.trim()) reasonParts.push(parsed.data.notes.trim())\n const payload = {\n organizationId: access.organizationId,\n tenantId: access.tenantId,\n reservationId: reservation.id,\n reason: reasonParts.join(' \u2014 ').slice(0, 120),\n reasonCode: parsed.data.reasonCode,\n }\n\n await runMutation({\n operation: async () => {\n const call = await apiCall<{ ok?: boolean }>('/api/wms/inventory/release', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n })\n if (!call.ok) {\n if (call.response.status === 409 && (call.result as { error?: string } | null)?.error === 'balance_integrity_violation') {\n flash(\n t(\n 'wms.backend.inventory.release.errors.balanceIntegrityViolation',\n 'Balance integrity error \u2014 run \"mercato wms verify-balances --repair\" to diagnose and fix drift before retrying.',\n ),\n 'error',\n )\n return {}\n }\n await raiseCrudError(\n call.response,\n t('wms.backend.inventory.release.errors.submit', 'Failed to release reservation.'),\n )\n }\n return call.result ?? {}\n },\n context: mutationContext,\n mutationPayload: payload,\n })\n\n flash(t('wms.backend.inventory.release.flash.success', 'Reservation released'), 'success')\n await queryClient.invalidateQueries({ queryKey: ['wms-inventory-console'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-sku-detail'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-location-detail'] })\n await queryClient.invalidateQueries({ queryKey: ['wms-lot-detail'] })\n closeDialog()\n onSuccess?.()\n } catch (error) {\n flashMutationError(error, t('wms.backend.inventory.release.errors.submit', 'Failed to release reservation.'), t)\n } finally {\n setSubmitting(false)\n }\n },\n [\n access,\n closeDialog,\n mutationContext,\n notes,\n onSuccess,\n queryClient,\n reasonCode,\n reasonLabel,\n releaseFormSchema,\n reservation,\n runMutation,\n t,\n ],\n )\n\n const submitDisabled = submitting || access.loading || !access.scopeReady\n\n const handleDialogKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n closeDialog()\n return\n }\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {\n event.preventDefault()\n if (!submitDisabled) void handleSubmit()\n }\n },\n [closeDialog, handleSubmit, submitDisabled],\n )\n\n if (!reservation) return null\n\n return (\n <Dialog open={open} onOpenChange={(next) => (next ? onOpenChange(true) : closeDialog())}>\n <DialogContent\n className=\"max-w-lg gap-0 overflow-hidden p-0\"\n onKeyDown={handleDialogKeyDown}\n >\n <div className=\"border-b px-6 py-4 pr-12\">\n <DialogHeader className=\"space-y-1 text-left\">\n <DialogTitle>\n {t('wms.backend.inventory.release.dialog.title', 'Release reservation')}\n </DialogTitle>\n <DialogDescription>\n {t(\n 'wms.backend.inventory.release.dialog.description',\n 'Return reserved quantity to available stock for this bucket.',\n )}\n </DialogDescription>\n </DialogHeader>\n </div>\n\n <form onSubmit={handleSubmit} className=\"flex min-h-0 flex-1 flex-col\">\n <div className=\"flex flex-col gap-5 overflow-y-auto px-6 py-6\">\n <div className=\"rounded-lg border bg-muted/40 px-4 py-3.5\">\n <div className=\"flex items-start gap-3\">\n <ShieldOff className=\"mt-0.5 size-4 text-muted-foreground\" aria-hidden=\"true\" />\n <dl className=\"grid gap-2 text-sm\">\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.variant', 'Variant')}\n </dt>\n <dd className=\"font-medium\">\n {formatVariantLabel(reservation, notAvailableLabel)}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.warehouse', 'Warehouse')}\n </dt>\n <dd className=\"font-medium\">\n {formatWarehouseLabel(reservation, notAvailableLabel)}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.quantity', 'Quantity')}\n </dt>\n <dd className=\"font-medium tabular-nums\">\n {quantityFormatter.format(parseInventoryQuantity(reservation.quantity))}\n </dd>\n </div>\n <div className=\"flex flex-wrap gap-x-2\">\n <dt className=\"text-muted-foreground\">\n {t('wms.backend.inventory.release.summary.source', 'Source')}\n </dt>\n <dd className=\"font-medium\">\n {formatReservationSourceLabel(reservation, t) || notAvailableLabel}\n </dd>\n </div>\n </dl>\n </div>\n </div>\n\n <p className=\"rounded-lg border border-status-warning-border bg-status-warning-bg px-3 py-2.5 text-sm text-status-warning-text\">\n {t(\n 'wms.backend.inventory.release.warning',\n 'This action cannot be undone \u2014 the reserved quantity will be released immediately.',\n )}\n </p>\n\n <FormField\n label={t('wms.backend.inventory.release.form.reason', 'Reason')}\n required\n error={fieldErrors.reasonCode}\n >\n <Select\n value={reasonCode || undefined}\n onValueChange={(next) => {\n setReasonCode(next as ReleaseReasonCode)\n setFieldErrors({})\n }}\n disabled={submitting}\n >\n <SelectTrigger>\n <SelectValue\n placeholder={t(\n 'wms.backend.inventory.release.form.reasonPlaceholder',\n 'Select reason',\n )}\n />\n </SelectTrigger>\n <SelectContent>\n {RELEASE_REASON_CODES.map((code) => (\n <SelectItem key={code} value={code}>\n {reasonLabel(code)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </FormField>\n\n <FormField label={t('wms.backend.inventory.release.form.notes', 'Notes')}>\n <Textarea\n value={notes}\n onChange={(event) => setNotes(event.target.value)}\n placeholder={t(\n 'wms.backend.inventory.release.form.notesPlaceholder',\n 'Optional \u2014 additional context',\n )}\n rows={3}\n disabled={submitting}\n />\n </FormField>\n </div>\n\n <DialogFooter bordered={false} className=\"border-t px-6 py-4 sm:justify-between\">\n <p className=\"hidden text-xs text-muted-foreground sm:inline-flex sm:items-center sm:gap-1.5\">\n <KbdShortcut keys={['\u2318', 'Enter']} />\n <span>/</span>\n <KbdShortcut keys={['Ctrl', 'Enter']} />\n <span>{t('wms.backend.inventory.release.dialog.shortcutSave', 'to confirm')}</span>\n </p>\n <div className=\"flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row\">\n <Button type=\"button\" variant=\"outline\" onClick={closeDialog} disabled={submitting}>\n {t('common.cancel', 'Cancel')}\n </Button>\n <Button\n type=\"submit\"\n variant=\"destructive-solid\"\n disabled={submitDisabled}\n data-testid=\"wms-inventory-release-submit\"\n >\n {t('wms.backend.inventory.release.dialog.submit', 'Release reservation')}\n </Button>\n </div>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n )\n}\n"],
|
|
5
5
|
"mappings": ";AAmSU,SACE,KADF;AAjSV,YAAY,WAAW;AACvB,SAAS,SAAS;AAClB,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SA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iB,QAAQ,GAC9B;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAK;AAAA,kBACL,SAAQ;AAAA,kBACR,UAAU;AAAA,kBACV,eAAY;AAAA,kBAEX,YAAE,+CAA+C,qBAAqB;AAAA;AAAA,cACzE;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -337,7 +337,7 @@ function WorkflowDefinitionsListPage() {
|
|
|
337
337
|
] }),
|
|
338
338
|
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
339
339
|
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setDeleteTarget(null), children: t("common.cancel") }),
|
|
340
|
-
/* @__PURE__ */ jsxs(Button, { variant: "destructive", onClick: confirmDelete, children: [
|
|
340
|
+
/* @__PURE__ */ jsxs(Button, { variant: "destructive-solid", onClick: confirmDelete, children: [
|
|
341
341
|
/* @__PURE__ */ jsx(Trash2, {}),
|
|
342
342
|
t("common.delete")
|
|
343
343
|
] })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/workflows/backend/definitions/page.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { extensionPoints } from '@open-mercato/core/modules/workflows/extension-points'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\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 { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { ListEmptyState } from '@open-mercato/ui/backend/filters/ListEmptyState'\nimport { Trash2 } from 'lucide-react'\n\ntype WorkflowDefinitionSource = 'code' | 'code_override' | 'user'\n\ntype WorkflowDefinition = {\n id: string\n workflowId: string\n workflowName: string\n description: string | null\n version: number\n definition: Record<string, unknown>\n enabled: boolean\n effectiveFrom: string | null\n effectiveTo: string | null\n metadata: {\n tags?: string[]\n category?: string\n icon?: string\n } | null\n tenantId: string\n organizationId: string\n createdAt: string\n updatedAt: string\n createdBy: string | null\n source?: WorkflowDefinitionSource\n isCodeBased?: boolean\n}\n\ntype DefinitionsResponse = {\n data: WorkflowDefinition[]\n pagination: {\n total: number\n limit: number\n offset: number\n hasMore: boolean\n }\n}\n\ntype CreateDefinitionResponse = {\n data?: {\n id?: string\n }\n error?: string\n}\n\nconst WORKFLOW_ID_MAX_LENGTH = 100\n\nfunction buildDuplicateWorkflowId(sourceWorkflowId: string, attempt: number): string {\n const suffix = attempt === 0 ? '_copy' : `_copy_${attempt + 1}`\n const maxBaseLength = Math.max(1, WORKFLOW_ID_MAX_LENGTH - suffix.length)\n const base = sourceWorkflowId.slice(0, maxBaseLength)\n return `${base}${suffix}`\n}\n\nexport default function WorkflowDefinitionsListPage() {\n const [page, setPage] = React.useState(1)\n const [pageSize] = React.useState(20)\n const [total, setTotal] = React.useState(0)\n const [totalPages, setTotalPages] = React.useState(1)\n const t = useT()\n const router = useRouter()\n const queryClient = useQueryClient()\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [deleteTarget, setDeleteTarget] = React.useState<{ id: string; name: string; updatedAt: string | null } | null>(null)\n\n const { data, isLoading, error } = useQuery({\n queryKey: ['workflow-definitions', 'list', filterValues, page],\n queryFn: async () => {\n const params = new URLSearchParams()\n const offset = (page - 1) * pageSize\n params.set('limit', pageSize.toString())\n params.set('offset', offset.toString())\n\n if (filterValues.enabled !== undefined && filterValues.enabled !== '') {\n params.set('enabled', filterValues.enabled as string)\n }\n if (filterValues.workflowId) params.set('workflowId', filterValues.workflowId as string)\n if (filterValues.search) params.set('search', filterValues.search as string)\n\n const result = await apiCall<DefinitionsResponse>(\n `/api/workflows/definitions?${params.toString()}`\n )\n\n if (!result.ok) {\n throw new Error('Failed to fetch workflow definitions')\n }\n\n const response = result.result\n if (response?.pagination) {\n setTotal(response.pagination.total || 0)\n const calculatedPages = Math.ceil((response.pagination.total || 0) / pageSize)\n setTotalPages(calculatedPages || 1)\n }\n\n return response?.data || []\n },\n })\n\n const handleDelete = (id: string, workflowName: string, updatedAt: string | null) => {\n setDeleteTarget({ id, name: workflowName, updatedAt })\n }\n\n const confirmDelete = async () => {\n if (!deleteTarget) return\n\n const result = await withScopedApiRequestHeaders(\n buildOptimisticLockHeader(deleteTarget.updatedAt),\n () => apiCall(`/api/workflows/definitions/${deleteTarget.id}`, {\n method: 'DELETE',\n }),\n )\n\n if (result.ok) {\n flash(t('workflows.messages.deleted'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n } else {\n const conflictError = Object.assign(new Error(t('workflows.messages.deleteFailed')), {\n status: result.status,\n ...(result.result && typeof result.result === 'object' ? result.result : {}),\n })\n if (!surfaceRecordConflict(conflictError, t)) {\n flash(t('workflows.messages.deleteFailed'), 'error')\n }\n }\n setDeleteTarget(null)\n }\n\n const handleToggleEnabled = async (id: string, currentEnabled: boolean, updatedAt: string | null) => {\n const result = await withScopedApiRequestHeaders(\n buildOptimisticLockHeader(updatedAt),\n () => apiCall(`/api/workflows/definitions/${id}`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n enabled: !currentEnabled,\n }),\n }),\n )\n\n if (result.ok) {\n flash(t('workflows.messages.updated'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n } else {\n const conflictError = Object.assign(new Error(t('workflows.messages.updateFailed')), {\n status: result.status,\n ...(result.result && typeof result.result === 'object' ? result.result : {}),\n })\n if (!surfaceRecordConflict(conflictError, t)) {\n flash(t('workflows.messages.updateFailed'), 'error')\n }\n }\n }\n\n const handleDuplicate = async (definition: WorkflowDefinition) => {\n for (let attempt = 0; attempt < 10; attempt += 1) {\n const duplicateWorkflowId = buildDuplicateWorkflowId(definition.workflowId, attempt)\n const result = await apiCall<CreateDefinitionResponse>('/api/workflows/definitions', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n workflowId: duplicateWorkflowId,\n workflowName: definition.workflowName,\n description: definition.description,\n version: definition.version,\n definition: definition.definition,\n metadata: definition.metadata,\n enabled: definition.enabled,\n }),\n })\n\n if (result.ok) {\n flash(t('workflows.messages.workflowDuplicated'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n return\n }\n\n if (result.status !== 409) {\n break\n }\n }\n\n flash(t('workflows.errors.createFailed'), 'error')\n }\n\n const handleFiltersApply = React.useCallback((values: FilterValues) => {\n const next: FilterValues = {}\n Object.entries(values).forEach(([key, value]) => {\n if (value !== undefined && value !== '') next[key] = value\n })\n setFilterValues(next)\n setPage(1)\n }, [])\n\n const handleFiltersClear = React.useCallback(() => {\n setFilterValues({})\n setPage(1)\n }, [])\n\n const filters: FilterDef[] = [\n {\n id: 'search',\n type: 'text',\n label: t('workflows.filters.search'),\n placeholder: t('workflows.filters.searchPlaceholder'),\n },\n {\n id: 'enabled',\n type: 'select',\n label: t('workflows.filters.status'),\n options: [\n { label: t('common.all'), value: '' },\n { label: t('common.enabled'), value: 'true' },\n { label: t('common.disabled'), value: 'false' },\n ],\n },\n {\n id: 'workflowId',\n type: 'text',\n label: t('workflows.filters.workflowId'),\n placeholder: t('workflows.filters.workflowIdPlaceholder'),\n },\n ]\n\n const columns: ColumnDef<WorkflowDefinition>[] = [\n {\n id: 'workflowId',\n header: t('workflows.fields.workflowId'),\n accessorKey: 'workflowId',\n meta: { truncate: false },\n cell: ({ row }) => (\n <span className=\"font-mono text-sm\">{row.original.workflowId}</span>\n ),\n },\n {\n id: 'workflowName',\n header: t('workflows.fields.workflowName'),\n accessorKey: 'workflowName',\n meta: { truncate: false },\n cell: ({ row }) => (\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium\">{row.original.workflowName}</span>\n {row.original.source === 'code' && (\n <Badge variant=\"secondary\">{t('workflows.source.code')}</Badge>\n )}\n {row.original.source === 'code_override' && (\n <Badge variant=\"outline\">{t('workflows.source.code_override')}</Badge>\n )}\n </div>\n {row.original.description && (\n <div className=\"text-xs text-muted-foreground\">\n {row.original.description}\n </div>\n )}\n {row.original.metadata?.category && (\n <div className=\"text-xs text-muted-foreground mt-0.5\">\n {row.original.metadata.category}\n </div>\n )}\n </div>\n ),\n },\n {\n id: 'version',\n header: t('workflows.fields.version'),\n accessorKey: 'version',\n meta: { truncate: false },\n cell: ({ row }) => (\n <Badge variant=\"secondary\" className=\"font-mono\">\n v{row.original.version}\n </Badge>\n ),\n },\n {\n id: 'enabled',\n header: t('workflows.fields.enabled'),\n accessorKey: 'enabled',\n cell: ({ row }) => (\n <button\n onClick={() => handleToggleEnabled(row.original.id, row.original.enabled, row.original.updatedAt)}\n className={`inline-flex items-center px-2 py-1 rounded text-xs font-medium cursor-pointer ${\n row.original.enabled\n ? 'bg-status-success-bg text-status-success-text hover:bg-status-success-border'\n : 'bg-status-neutral-bg text-status-neutral-text hover:bg-status-neutral-border'\n }`}\n title={t('workflows.actions.toggleEnabled')}\n >\n {row.original.enabled ? t('common.yes') : t('common.no')}\n </button>\n ),\n },\n {\n id: 'tags',\n header: t('workflows.fields.tags'),\n cell: ({ row }) => {\n const tags = row.original.metadata?.tags || []\n if (tags.length === 0) return <span className=\"text-muted-foreground\">-</span>\n return (\n <div className=\"flex flex-wrap gap-1\">\n {tags.slice(0, 2).map((tag, idx) => (\n <Badge key={idx} variant=\"secondary\">\n {tag}\n </Badge>\n ))}\n {tags.length > 2 && (\n <Badge variant=\"outline\">+{tags.length - 2}</Badge>\n )}\n </div>\n )\n },\n },\n {\n id: 'createdAt',\n header: t('workflows.fields.createdAt'),\n accessorKey: 'createdAt',\n cell: ({ row }) => {\n const date = new Date(row.original.createdAt)\n return <span className=\"text-sm text-muted-foreground\">{date.toLocaleDateString()}</span>\n },\n },\n {\n id: 'actions',\n header: '',\n cell: ({ row }) => {\n const isCodeOnly = row.original.source === 'code'\n const items = [\n {\n id: 'edit',\n label: isCodeOnly ? t('common.view') : t('common.edit'),\n href: `/backend/definitions/${row.original.id}`,\n },\n ...(!isCodeOnly ? [{\n id: 'edit-visual',\n label: t('workflows.actions.editVisually'),\n href: `/backend/definitions/visual-editor?id=${row.original.id}`,\n }] : []),\n ...(!isCodeOnly ? [{\n id: row.original.enabled ? 'disable' : 'enable',\n label: row.original.enabled ? t('common.disable') : t('common.enable'),\n onSelect: () => handleToggleEnabled(row.original.id, row.original.enabled, row.original.updatedAt),\n }] : []),\n ...(!isCodeOnly ? [{\n id: 'duplicate',\n label: t('common.duplicate'),\n onSelect: () => handleDuplicate(row.original),\n }] : []),\n ...(!isCodeOnly ? [{\n id: 'delete',\n label: t('common.delete'),\n onSelect: () => handleDelete(row.original.id, row.original.workflowName, row.original.updatedAt),\n destructive: true,\n }] : []),\n ]\n return <RowActions items={items} />\n },\n },\n ]\n\n if (error) {\n return (\n <Page>\n <PageBody>\n <ErrorMessage\n label={t('workflows.messages.loadFailed')}\n description={error.message}\n action={(\n <Button variant=\"outline\" size=\"sm\" onClick={() => queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })}>\n {t('common.retry', 'Retry')}\n </Button>\n )}\n />\n </PageBody>\n </Page>\n )\n }\n\n return (\n <Page>\n <PageBody>\n <DataTable\n title={t('workflows.list.title')}\n actions={(\n <div className=\"flex items-center gap-2\">\n <Button asChild variant=\"outline\">\n <Link href=\"/backend/definitions/visual-editor\">\n {t('workflows.actions.createVisual')}\n </Link>\n </Button>\n <Button asChild>\n <Link href=\"/backend/definitions/create\">\n {t('workflows.actions.create')}\n </Link>\n </Button>\n </div>\n )}\n columns={columns}\n data={data || []}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={handleFiltersApply}\n onFiltersClear={handleFiltersClear}\n onRowClick={(row) => router.push(`/backend/definitions/visual-editor?id=${row.id}`)}\n perspective={{\n tableId: extensionPoints.hosts.definitionsTable.tableId,\n }}\n emptyState={(\n <ListEmptyState\n entityName={t('workflows.list.title')}\n createHref=\"/backend/definitions/create\"\n createLabel={t('workflows.actions.create')}\n />\n )}\n pagination={{ page, pageSize, total, totalPages, onPageChange: setPage }}\n />\n <Dialog open={!!deleteTarget} onOpenChange={(open) => !open && setDeleteTarget(null)}>\n <DialogContent className=\"sm:max-w-md\">\n <DialogHeader>\n <DialogTitle>{t('workflows.confirm.deleteTitle')}</DialogTitle>\n <DialogDescription>\n {t('workflows.confirm.delete', { name: deleteTarget?.name ?? '' })}\n </DialogDescription>\n </DialogHeader>\n <DialogFooter>\n <Button variant=\"outline\" onClick={() => setDeleteTarget(null)}>\n {t('common.cancel')}\n </Button>\n <Button variant=\"destructive\" onClick={confirmDelete}>\n <Trash2/>\n {t('common.delete')}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
-
"mappings": ";AAmQQ,cAUE,YAVF;AAjQR,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,MAAM,gBAAgB;AAC/B,SAAS,iBAAiB;AAE1B,SAAS,cAAc;AACvB,SAA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MACA,qBAAC,gBACC;AAAA,4BAAC,UAAO,SAAQ,WAAU,SAAS,MAAM,gBAAgB,IAAI,GAC1D,YAAE,eAAe,GACpB;AAAA,QACA,qBAAC,UAAO,SAAQ,
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { extensionPoints } from '@open-mercato/core/modules/workflows/extension-points'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\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 { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { ListEmptyState } from '@open-mercato/ui/backend/filters/ListEmptyState'\nimport { Trash2 } from 'lucide-react'\n\ntype WorkflowDefinitionSource = 'code' | 'code_override' | 'user'\n\ntype WorkflowDefinition = {\n id: string\n workflowId: string\n workflowName: string\n description: string | null\n version: number\n definition: Record<string, unknown>\n enabled: boolean\n effectiveFrom: string | null\n effectiveTo: string | null\n metadata: {\n tags?: string[]\n category?: string\n icon?: string\n } | null\n tenantId: string\n organizationId: string\n createdAt: string\n updatedAt: string\n createdBy: string | null\n source?: WorkflowDefinitionSource\n isCodeBased?: boolean\n}\n\ntype DefinitionsResponse = {\n data: WorkflowDefinition[]\n pagination: {\n total: number\n limit: number\n offset: number\n hasMore: boolean\n }\n}\n\ntype CreateDefinitionResponse = {\n data?: {\n id?: string\n }\n error?: string\n}\n\nconst WORKFLOW_ID_MAX_LENGTH = 100\n\nfunction buildDuplicateWorkflowId(sourceWorkflowId: string, attempt: number): string {\n const suffix = attempt === 0 ? '_copy' : `_copy_${attempt + 1}`\n const maxBaseLength = Math.max(1, WORKFLOW_ID_MAX_LENGTH - suffix.length)\n const base = sourceWorkflowId.slice(0, maxBaseLength)\n return `${base}${suffix}`\n}\n\nexport default function WorkflowDefinitionsListPage() {\n const [page, setPage] = React.useState(1)\n const [pageSize] = React.useState(20)\n const [total, setTotal] = React.useState(0)\n const [totalPages, setTotalPages] = React.useState(1)\n const t = useT()\n const router = useRouter()\n const queryClient = useQueryClient()\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [deleteTarget, setDeleteTarget] = React.useState<{ id: string; name: string; updatedAt: string | null } | null>(null)\n\n const { data, isLoading, error } = useQuery({\n queryKey: ['workflow-definitions', 'list', filterValues, page],\n queryFn: async () => {\n const params = new URLSearchParams()\n const offset = (page - 1) * pageSize\n params.set('limit', pageSize.toString())\n params.set('offset', offset.toString())\n\n if (filterValues.enabled !== undefined && filterValues.enabled !== '') {\n params.set('enabled', filterValues.enabled as string)\n }\n if (filterValues.workflowId) params.set('workflowId', filterValues.workflowId as string)\n if (filterValues.search) params.set('search', filterValues.search as string)\n\n const result = await apiCall<DefinitionsResponse>(\n `/api/workflows/definitions?${params.toString()}`\n )\n\n if (!result.ok) {\n throw new Error('Failed to fetch workflow definitions')\n }\n\n const response = result.result\n if (response?.pagination) {\n setTotal(response.pagination.total || 0)\n const calculatedPages = Math.ceil((response.pagination.total || 0) / pageSize)\n setTotalPages(calculatedPages || 1)\n }\n\n return response?.data || []\n },\n })\n\n const handleDelete = (id: string, workflowName: string, updatedAt: string | null) => {\n setDeleteTarget({ id, name: workflowName, updatedAt })\n }\n\n const confirmDelete = async () => {\n if (!deleteTarget) return\n\n const result = await withScopedApiRequestHeaders(\n buildOptimisticLockHeader(deleteTarget.updatedAt),\n () => apiCall(`/api/workflows/definitions/${deleteTarget.id}`, {\n method: 'DELETE',\n }),\n )\n\n if (result.ok) {\n flash(t('workflows.messages.deleted'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n } else {\n const conflictError = Object.assign(new Error(t('workflows.messages.deleteFailed')), {\n status: result.status,\n ...(result.result && typeof result.result === 'object' ? result.result : {}),\n })\n if (!surfaceRecordConflict(conflictError, t)) {\n flash(t('workflows.messages.deleteFailed'), 'error')\n }\n }\n setDeleteTarget(null)\n }\n\n const handleToggleEnabled = async (id: string, currentEnabled: boolean, updatedAt: string | null) => {\n const result = await withScopedApiRequestHeaders(\n buildOptimisticLockHeader(updatedAt),\n () => apiCall(`/api/workflows/definitions/${id}`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n enabled: !currentEnabled,\n }),\n }),\n )\n\n if (result.ok) {\n flash(t('workflows.messages.updated'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n } else {\n const conflictError = Object.assign(new Error(t('workflows.messages.updateFailed')), {\n status: result.status,\n ...(result.result && typeof result.result === 'object' ? result.result : {}),\n })\n if (!surfaceRecordConflict(conflictError, t)) {\n flash(t('workflows.messages.updateFailed'), 'error')\n }\n }\n }\n\n const handleDuplicate = async (definition: WorkflowDefinition) => {\n for (let attempt = 0; attempt < 10; attempt += 1) {\n const duplicateWorkflowId = buildDuplicateWorkflowId(definition.workflowId, attempt)\n const result = await apiCall<CreateDefinitionResponse>('/api/workflows/definitions', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n workflowId: duplicateWorkflowId,\n workflowName: definition.workflowName,\n description: definition.description,\n version: definition.version,\n definition: definition.definition,\n metadata: definition.metadata,\n enabled: definition.enabled,\n }),\n })\n\n if (result.ok) {\n flash(t('workflows.messages.workflowDuplicated'), 'success')\n queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })\n return\n }\n\n if (result.status !== 409) {\n break\n }\n }\n\n flash(t('workflows.errors.createFailed'), 'error')\n }\n\n const handleFiltersApply = React.useCallback((values: FilterValues) => {\n const next: FilterValues = {}\n Object.entries(values).forEach(([key, value]) => {\n if (value !== undefined && value !== '') next[key] = value\n })\n setFilterValues(next)\n setPage(1)\n }, [])\n\n const handleFiltersClear = React.useCallback(() => {\n setFilterValues({})\n setPage(1)\n }, [])\n\n const filters: FilterDef[] = [\n {\n id: 'search',\n type: 'text',\n label: t('workflows.filters.search'),\n placeholder: t('workflows.filters.searchPlaceholder'),\n },\n {\n id: 'enabled',\n type: 'select',\n label: t('workflows.filters.status'),\n options: [\n { label: t('common.all'), value: '' },\n { label: t('common.enabled'), value: 'true' },\n { label: t('common.disabled'), value: 'false' },\n ],\n },\n {\n id: 'workflowId',\n type: 'text',\n label: t('workflows.filters.workflowId'),\n placeholder: t('workflows.filters.workflowIdPlaceholder'),\n },\n ]\n\n const columns: ColumnDef<WorkflowDefinition>[] = [\n {\n id: 'workflowId',\n header: t('workflows.fields.workflowId'),\n accessorKey: 'workflowId',\n meta: { truncate: false },\n cell: ({ row }) => (\n <span className=\"font-mono text-sm\">{row.original.workflowId}</span>\n ),\n },\n {\n id: 'workflowName',\n header: t('workflows.fields.workflowName'),\n accessorKey: 'workflowName',\n meta: { truncate: false },\n cell: ({ row }) => (\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium\">{row.original.workflowName}</span>\n {row.original.source === 'code' && (\n <Badge variant=\"secondary\">{t('workflows.source.code')}</Badge>\n )}\n {row.original.source === 'code_override' && (\n <Badge variant=\"outline\">{t('workflows.source.code_override')}</Badge>\n )}\n </div>\n {row.original.description && (\n <div className=\"text-xs text-muted-foreground\">\n {row.original.description}\n </div>\n )}\n {row.original.metadata?.category && (\n <div className=\"text-xs text-muted-foreground mt-0.5\">\n {row.original.metadata.category}\n </div>\n )}\n </div>\n ),\n },\n {\n id: 'version',\n header: t('workflows.fields.version'),\n accessorKey: 'version',\n meta: { truncate: false },\n cell: ({ row }) => (\n <Badge variant=\"secondary\" className=\"font-mono\">\n v{row.original.version}\n </Badge>\n ),\n },\n {\n id: 'enabled',\n header: t('workflows.fields.enabled'),\n accessorKey: 'enabled',\n cell: ({ row }) => (\n <button\n onClick={() => handleToggleEnabled(row.original.id, row.original.enabled, row.original.updatedAt)}\n className={`inline-flex items-center px-2 py-1 rounded text-xs font-medium cursor-pointer ${\n row.original.enabled\n ? 'bg-status-success-bg text-status-success-text hover:bg-status-success-border'\n : 'bg-status-neutral-bg text-status-neutral-text hover:bg-status-neutral-border'\n }`}\n title={t('workflows.actions.toggleEnabled')}\n >\n {row.original.enabled ? t('common.yes') : t('common.no')}\n </button>\n ),\n },\n {\n id: 'tags',\n header: t('workflows.fields.tags'),\n cell: ({ row }) => {\n const tags = row.original.metadata?.tags || []\n if (tags.length === 0) return <span className=\"text-muted-foreground\">-</span>\n return (\n <div className=\"flex flex-wrap gap-1\">\n {tags.slice(0, 2).map((tag, idx) => (\n <Badge key={idx} variant=\"secondary\">\n {tag}\n </Badge>\n ))}\n {tags.length > 2 && (\n <Badge variant=\"outline\">+{tags.length - 2}</Badge>\n )}\n </div>\n )\n },\n },\n {\n id: 'createdAt',\n header: t('workflows.fields.createdAt'),\n accessorKey: 'createdAt',\n cell: ({ row }) => {\n const date = new Date(row.original.createdAt)\n return <span className=\"text-sm text-muted-foreground\">{date.toLocaleDateString()}</span>\n },\n },\n {\n id: 'actions',\n header: '',\n cell: ({ row }) => {\n const isCodeOnly = row.original.source === 'code'\n const items = [\n {\n id: 'edit',\n label: isCodeOnly ? t('common.view') : t('common.edit'),\n href: `/backend/definitions/${row.original.id}`,\n },\n ...(!isCodeOnly ? [{\n id: 'edit-visual',\n label: t('workflows.actions.editVisually'),\n href: `/backend/definitions/visual-editor?id=${row.original.id}`,\n }] : []),\n ...(!isCodeOnly ? [{\n id: row.original.enabled ? 'disable' : 'enable',\n label: row.original.enabled ? t('common.disable') : t('common.enable'),\n onSelect: () => handleToggleEnabled(row.original.id, row.original.enabled, row.original.updatedAt),\n }] : []),\n ...(!isCodeOnly ? [{\n id: 'duplicate',\n label: t('common.duplicate'),\n onSelect: () => handleDuplicate(row.original),\n }] : []),\n ...(!isCodeOnly ? [{\n id: 'delete',\n label: t('common.delete'),\n onSelect: () => handleDelete(row.original.id, row.original.workflowName, row.original.updatedAt),\n destructive: true,\n }] : []),\n ]\n return <RowActions items={items} />\n },\n },\n ]\n\n if (error) {\n return (\n <Page>\n <PageBody>\n <ErrorMessage\n label={t('workflows.messages.loadFailed')}\n description={error.message}\n action={(\n <Button variant=\"outline\" size=\"sm\" onClick={() => queryClient.invalidateQueries({ queryKey: ['workflow-definitions'] })}>\n {t('common.retry', 'Retry')}\n </Button>\n )}\n />\n </PageBody>\n </Page>\n )\n }\n\n return (\n <Page>\n <PageBody>\n <DataTable\n title={t('workflows.list.title')}\n actions={(\n <div className=\"flex items-center gap-2\">\n <Button asChild variant=\"outline\">\n <Link href=\"/backend/definitions/visual-editor\">\n {t('workflows.actions.createVisual')}\n </Link>\n </Button>\n <Button asChild>\n <Link href=\"/backend/definitions/create\">\n {t('workflows.actions.create')}\n </Link>\n </Button>\n </div>\n )}\n columns={columns}\n data={data || []}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={handleFiltersApply}\n onFiltersClear={handleFiltersClear}\n onRowClick={(row) => router.push(`/backend/definitions/visual-editor?id=${row.id}`)}\n perspective={{\n tableId: extensionPoints.hosts.definitionsTable.tableId,\n }}\n emptyState={(\n <ListEmptyState\n entityName={t('workflows.list.title')}\n createHref=\"/backend/definitions/create\"\n createLabel={t('workflows.actions.create')}\n />\n )}\n pagination={{ page, pageSize, total, totalPages, onPageChange: setPage }}\n />\n <Dialog open={!!deleteTarget} onOpenChange={(open) => !open && setDeleteTarget(null)}>\n <DialogContent className=\"sm:max-w-md\">\n <DialogHeader>\n <DialogTitle>{t('workflows.confirm.deleteTitle')}</DialogTitle>\n <DialogDescription>\n {t('workflows.confirm.delete', { name: deleteTarget?.name ?? '' })}\n </DialogDescription>\n </DialogHeader>\n <DialogFooter>\n <Button variant=\"outline\" onClick={() => setDeleteTarget(null)}>\n {t('common.cancel')}\n </Button>\n <Button variant=\"destructive-solid\" onClick={confirmDelete}>\n <Trash2/>\n {t('common.delete')}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAmQQ,cAUE,YAVF;AAjQR,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,MAAM,gBAAgB;AAC/B,SAAS,iBAAiB;AAE1B,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,mCAAmC;AACrD,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AACtC,SAAS,aAAa;AACtB,SAAS,UAAU,sBAAsB;AACzC,SAAS,YAAY;AAErB,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AA6CvB,MAAM,yBAAyB;AAE/B,SAAS,yBAAyB,kBAA0B,SAAyB;AACnF,QAAM,SAAS,YAAY,IAAI,UAAU,SAAS,UAAU,CAAC;AAC7D,QAAM,gBAAgB,KAAK,IAAI,GAAG,yBAAyB,OAAO,MAAM;AACxE,QAAM,OAAO,iBAAiB,MAAM,GAAG,aAAa;AACpD,SAAO,GAAG,IAAI,GAAG,MAAM;AACzB;AAEe,SAAR,8BAA+C;AACpD,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,CAAC;AACxC,QAAM,CAA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AE,EAAE;AAAA,QAClF,aAAa;AAAA,UACX,SAAS,gBAAgB,MAAM,iBAAiB;AAAA,QAClD;AAAA,QACA,YACE;AAAA,UAAC;AAAA;AAAA,YACC,YAAY,EAAE,sBAAsB;AAAA,YACpC,YAAW;AAAA,YACX,aAAa,EAAE,0BAA0B;AAAA;AAAA,QAC3C;AAAA,QAEF,YAAY,EAAE,MAAM,UAAU,OAAO,YAAY,cAAc,QAAQ;AAAA;AAAA,IACzE;AAAA,IACA,oBAAC,UAAO,MAAM,CAAC,CAAC,cAAc,cAAc,CAAC,SAAS,CAAC,QAAQ,gBAAgB,IAAI,GACjF,+BAAC,iBAAc,WAAU,eACvB;AAAA,2BAAC,gBACC;AAAA,4BAAC,eAAa,YAAE,+BAA+B,GAAE;AAAA,QACjD,oBAAC,qBACE,YAAE,4BAA4B,EAAE,MAAM,cAAc,QAAQ,GAAG,CAAC,GACnE;AAAA,SACF;AAAA,MACA,qBAAC,gBACC;AAAA,4BAAC,UAAO,SAAQ,WAAU,SAAS,MAAM,gBAAgB,IAAI,GAC1D,YAAE,eAAe,GACpB;AAAA,QACA,qBAAC,UAAO,SAAQ,qBAAoB,SAAS,eAC3C;AAAA,8BAAC,UAAM;AAAA,UACN,EAAE,eAAe;AAAA,WACpB;AAAA,SACF;AAAA,OACF,GACF;AAAA,KACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -540,7 +540,7 @@ function VisualEditorPage() {
|
|
|
540
540
|
] }),
|
|
541
541
|
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
542
542
|
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setShowClearConfirm(false), children: t("common.cancel", "Cancel") }),
|
|
543
|
-
/* @__PURE__ */ jsx(Button, { variant: "destructive", onClick: confirmClear, children: t("common.clear", "Clear") })
|
|
543
|
+
/* @__PURE__ */ jsx(Button, { variant: "destructive-solid", onClick: confirmClear, children: t("common.clear", "Clear") })
|
|
544
544
|
] })
|
|
545
545
|
] }) })
|
|
546
546
|
] });
|