@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
package/.turbo/turbo-build.log
CHANGED
|
@@ -138,7 +138,7 @@ const AttachmentInput = ({
|
|
|
138
138
|
}
|
|
139
139
|
)
|
|
140
140
|
] }),
|
|
141
|
-
error ? /* @__PURE__ */ jsx("div", { className: "text-xs text-
|
|
141
|
+
error ? /* @__PURE__ */ jsx("div", { className: "text-xs text-status-error-text", children: error }) : null,
|
|
142
142
|
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
143
143
|
loading ? /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: t("attachments.library.loading", "Loading attachments\u2026") }) : null,
|
|
144
144
|
items.map((it) => /* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/attachments/fields/attachment.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { FieldRegistry } from '@open-mercato/ui/backend/fields/registry'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport type { CustomFieldDefDto } from '@open-mercato/ui/backend/utils/customFieldDefs'\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 { Upload } from 'lucide-react'\n\nfunction humanSize(n: number): string {\n if (!Number.isFinite(n)) return String(n)\n const units = ['B','KB','MB','GB']\n let i = 0\n let x = n\n while (x >= 1024 && i < units.length - 1) { x /= 1024; i++ }\n return `${x.toFixed(i === 0 ? 0 : 1)} ${units[i]}`\n}\n\ntype AttachmentsResponse = {\n items?: Array<{ id: string; url: string; fileName: string; fileSize: number }>\n error?: string\n}\n\ntype AttachmentFieldDef = CustomFieldDefDto & {\n configJson?: {\n maxAttachmentSizeMb?: number\n acceptExtensions?: string[]\n partitionCode?: string\n }\n}\n\ntype AttachmentDefEditorPatch = {\n maxAttachmentSizeMb?: number\n acceptExtensions?: string[]\n partitionCode?: string\n}\n\nfunction buildAcceptAttribute(def?: AttachmentFieldDef): string | undefined {\n if (!Array.isArray(def?.acceptExtensions) || def.acceptExtensions.length === 0) return undefined\n const values = def.acceptExtensions\n .map((entry) => String(entry ?? '').trim().replace(/^\\./, ''))\n .filter((entry) => entry.length > 0)\n if (values.length === 0) return undefined\n return values.map((entry) => `.${entry}`).join(',')\n}\n\nexport const AttachmentInput = ({\n entityId,\n recordId,\n def,\n disabled,\n}: {\n entityId?: string\n recordId?: string\n def?: AttachmentFieldDef\n disabled?: boolean\n}) => {\n const t = useT()\n const [items, setItems] = React.useState<Array<{ id: string; url: string; fileName: string; fileSize: number }>>([])\n const [loading, setLoading] = React.useState(false)\n const [error, setError] = React.useState<string | null>(null)\n const [uploading, setUploading] = React.useState(false)\n const fileInputRef = React.useRef<HTMLInputElement | null>(null)\n const accept = React.useMemo(() => buildAcceptAttribute(def), [def])\n\n const load = React.useCallback(async () => {\n if (!entityId || !recordId) return\n try {\n setLoading(true)\n const call = await apiCall<AttachmentsResponse>(\n `/api/attachments?entityId=${encodeURIComponent(entityId)}&recordId=${encodeURIComponent(recordId)}`,\n undefined,\n { fallback: { items: [] } },\n )\n if (!call.ok) {\n const message = call.result?.error || t('attachments.library.errors.load', 'Failed to load attachments.')\n throw new Error(message)\n }\n const j = call.result ?? { items: [] }\n setItems(Array.isArray(j.items) ? j.items : [])\n } catch (error: unknown) {\n setError(error instanceof Error ? error.message : t('attachments.library.errors.load', 'Failed to load attachments.'))\n } finally {\n setLoading(false)\n }\n }, [entityId, recordId, t])\n\n React.useEffect(() => { load() }, [load])\n\n const onUpload = async (files: FileList | null) => {\n if (!files || !entityId || !recordId) return\n setError(null)\n setUploading(true)\n try {\n for (const file of Array.from(files)) {\n const ext = (file.name || '').split('.').pop()?.toLowerCase() || ''\n const acceptExtensions = Array.isArray(def?.acceptExtensions) ? def.acceptExtensions : []\n if (acceptExtensions.length > 0) {\n const allowed = new Set(acceptExtensions.map((entry) => String(entry).toLowerCase().replace(/^\\./, '')))\n if (!allowed.has(ext)) { setError('File type not allowed'); continue }\n }\n const maxAttachmentSizeMb = typeof def?.maxAttachmentSizeMb === 'number' ? def.maxAttachmentSizeMb : undefined\n if (typeof maxAttachmentSizeMb === 'number' && maxAttachmentSizeMb > 0) {\n const maxBytes = Math.floor(maxAttachmentSizeMb * 1024 * 1024)\n if (file.size > maxBytes) { setError(`File exceeds ${maxAttachmentSizeMb} MB limit`); continue }\n }\n const fd = new FormData()\n fd.set('entityId', entityId)\n fd.set('recordId', recordId)\n if (def?.key) fd.set('fieldKey', String(def.key))\n fd.set('file', file)\n const call = await apiCall<{ error?: string }>(\n '/api/attachments',\n { method: 'POST', body: fd },\n { fallback: null },\n )\n if (!call.ok) {\n setError(call.result?.error || t('attachments.library.upload.failed', 'Upload failed.'))\n break\n }\n }\n await load()\n } finally {\n setUploading(false)\n if (fileInputRef.current) {\n fileInputRef.current.value = ''\n }\n }\n }\n\n return (\n <div className=\"space-y-3\">\n {!entityId || !recordId ? (\n <div className=\"rounded-md border border-dashed border-border/70 px-3 py-4 text-sm text-muted-foreground\">\n {t('attachments.library.upload.saveFirst', 'Save the record before uploading files.')}\n </div>\n ) : (\n <div className=\"rounded-md border border-dashed border-border/70 bg-muted/30 px-4 py-4\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => fileInputRef.current?.click()}\n disabled={disabled || uploading}\n >\n <Upload className=\"h-4 w-4\" />\n {uploading\n ? t('attachments.library.upload.submitting', 'Uploading\u2026')\n : t('attachments.library.upload.choose', 'Choose files')}\n </Button>\n </div>\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple\n className=\"hidden\"\n accept={accept}\n disabled={disabled || uploading}\n onChange={(event) => { void onUpload(event.target.files) }}\n />\n </div>\n )}\n {error ? <div className=\"text-xs text-
|
|
5
|
-
"mappings": ";AAsIQ,cAMI,YANJ;AArIR,YAAY,WAAW;AACvB,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAExB,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,cAAc;AAEvB,SAAS,UAAU,GAAmB;AACpC,MAAI,CAAC,OAAO,SAAS,CAAC,EAAG,QAAO,OAAO,CAAC;AACxC,QAAM,QAAQ,CAAC,KAAI,MAAK,MAAK,IAAI;AACjC,MAAI,IAAI;AACR,MAAI,IAAI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K;AAAA,UACL,MAAK;AAAA,UACL,UAAQ;AAAA,UACR,WAAU;AAAA,UACV;AAAA,UACA,UAAU,YAAY;AAAA,UACtB,UAAU,CAAC,UAAU;AAAE,iBAAK,SAAS,MAAM,OAAO,KAAK;AAAA,UAAE;AAAA;AAAA,MAC3D;AAAA,OACF;AAAA,IAED,QAAQ,oBAAC,SAAI,WAAU,
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { FieldRegistry } from '@open-mercato/ui/backend/fields/registry'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport type { CustomFieldDefDto } from '@open-mercato/ui/backend/utils/customFieldDefs'\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 { Upload } from 'lucide-react'\n\nfunction humanSize(n: number): string {\n if (!Number.isFinite(n)) return String(n)\n const units = ['B','KB','MB','GB']\n let i = 0\n let x = n\n while (x >= 1024 && i < units.length - 1) { x /= 1024; i++ }\n return `${x.toFixed(i === 0 ? 0 : 1)} ${units[i]}`\n}\n\ntype AttachmentsResponse = {\n items?: Array<{ id: string; url: string; fileName: string; fileSize: number }>\n error?: string\n}\n\ntype AttachmentFieldDef = CustomFieldDefDto & {\n configJson?: {\n maxAttachmentSizeMb?: number\n acceptExtensions?: string[]\n partitionCode?: string\n }\n}\n\ntype AttachmentDefEditorPatch = {\n maxAttachmentSizeMb?: number\n acceptExtensions?: string[]\n partitionCode?: string\n}\n\nfunction buildAcceptAttribute(def?: AttachmentFieldDef): string | undefined {\n if (!Array.isArray(def?.acceptExtensions) || def.acceptExtensions.length === 0) return undefined\n const values = def.acceptExtensions\n .map((entry) => String(entry ?? '').trim().replace(/^\\./, ''))\n .filter((entry) => entry.length > 0)\n if (values.length === 0) return undefined\n return values.map((entry) => `.${entry}`).join(',')\n}\n\nexport const AttachmentInput = ({\n entityId,\n recordId,\n def,\n disabled,\n}: {\n entityId?: string\n recordId?: string\n def?: AttachmentFieldDef\n disabled?: boolean\n}) => {\n const t = useT()\n const [items, setItems] = React.useState<Array<{ id: string; url: string; fileName: string; fileSize: number }>>([])\n const [loading, setLoading] = React.useState(false)\n const [error, setError] = React.useState<string | null>(null)\n const [uploading, setUploading] = React.useState(false)\n const fileInputRef = React.useRef<HTMLInputElement | null>(null)\n const accept = React.useMemo(() => buildAcceptAttribute(def), [def])\n\n const load = React.useCallback(async () => {\n if (!entityId || !recordId) return\n try {\n setLoading(true)\n const call = await apiCall<AttachmentsResponse>(\n `/api/attachments?entityId=${encodeURIComponent(entityId)}&recordId=${encodeURIComponent(recordId)}`,\n undefined,\n { fallback: { items: [] } },\n )\n if (!call.ok) {\n const message = call.result?.error || t('attachments.library.errors.load', 'Failed to load attachments.')\n throw new Error(message)\n }\n const j = call.result ?? { items: [] }\n setItems(Array.isArray(j.items) ? j.items : [])\n } catch (error: unknown) {\n setError(error instanceof Error ? error.message : t('attachments.library.errors.load', 'Failed to load attachments.'))\n } finally {\n setLoading(false)\n }\n }, [entityId, recordId, t])\n\n React.useEffect(() => { load() }, [load])\n\n const onUpload = async (files: FileList | null) => {\n if (!files || !entityId || !recordId) return\n setError(null)\n setUploading(true)\n try {\n for (const file of Array.from(files)) {\n const ext = (file.name || '').split('.').pop()?.toLowerCase() || ''\n const acceptExtensions = Array.isArray(def?.acceptExtensions) ? def.acceptExtensions : []\n if (acceptExtensions.length > 0) {\n const allowed = new Set(acceptExtensions.map((entry) => String(entry).toLowerCase().replace(/^\\./, '')))\n if (!allowed.has(ext)) { setError('File type not allowed'); continue }\n }\n const maxAttachmentSizeMb = typeof def?.maxAttachmentSizeMb === 'number' ? def.maxAttachmentSizeMb : undefined\n if (typeof maxAttachmentSizeMb === 'number' && maxAttachmentSizeMb > 0) {\n const maxBytes = Math.floor(maxAttachmentSizeMb * 1024 * 1024)\n if (file.size > maxBytes) { setError(`File exceeds ${maxAttachmentSizeMb} MB limit`); continue }\n }\n const fd = new FormData()\n fd.set('entityId', entityId)\n fd.set('recordId', recordId)\n if (def?.key) fd.set('fieldKey', String(def.key))\n fd.set('file', file)\n const call = await apiCall<{ error?: string }>(\n '/api/attachments',\n { method: 'POST', body: fd },\n { fallback: null },\n )\n if (!call.ok) {\n setError(call.result?.error || t('attachments.library.upload.failed', 'Upload failed.'))\n break\n }\n }\n await load()\n } finally {\n setUploading(false)\n if (fileInputRef.current) {\n fileInputRef.current.value = ''\n }\n }\n }\n\n return (\n <div className=\"space-y-3\">\n {!entityId || !recordId ? (\n <div className=\"rounded-md border border-dashed border-border/70 px-3 py-4 text-sm text-muted-foreground\">\n {t('attachments.library.upload.saveFirst', 'Save the record before uploading files.')}\n </div>\n ) : (\n <div className=\"rounded-md border border-dashed border-border/70 bg-muted/30 px-4 py-4\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => fileInputRef.current?.click()}\n disabled={disabled || uploading}\n >\n <Upload className=\"h-4 w-4\" />\n {uploading\n ? t('attachments.library.upload.submitting', 'Uploading\u2026')\n : t('attachments.library.upload.choose', 'Choose files')}\n </Button>\n </div>\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple\n className=\"hidden\"\n accept={accept}\n disabled={disabled || uploading}\n onChange={(event) => { void onUpload(event.target.files) }}\n />\n </div>\n )}\n {error ? <div className=\"text-xs text-status-error-text\">{error}</div> : null}\n <div className=\"space-y-1\">\n {loading ? <div className=\"text-xs text-muted-foreground\">{t('attachments.library.loading', 'Loading attachments\u2026')}</div> : null}\n {items.map(it => (\n <div key={it.id} className=\"text-sm\">\n <a className=\"underline\" href={it.url} target=\"_blank\" rel=\"noreferrer\">{it.fileName}</a>\n <span className=\"text-xs text-muted-foreground\"> \u2022 {humanSize(it.fileSize)}</span>\n </div>\n ))}\n {!loading && items.length === 0 ? <div className=\"text-xs text-muted-foreground\">{t('attachments.library.table.empty', 'No attachments found.')}</div> : null}\n </div>\n </div>\n )\n}\n\n// Register with field registry under kind 'attachment'\nfunction AttachmentDefEditor({ def, onChange }: { def: AttachmentFieldDef; onChange: (patch: AttachmentDefEditorPatch) => void }) {\n const cfg = def?.configJson || {}\n const [maxMb, setMaxMb] = React.useState<number | ''>(typeof cfg.maxAttachmentSizeMb === 'number' ? cfg.maxAttachmentSizeMb : '')\n const [exts, setExts] = React.useState<string>((Array.isArray(cfg.acceptExtensions) ? cfg.acceptExtensions : []).join(', '))\n const [partition, setPartition] = React.useState<string>(typeof cfg.partitionCode === 'string' ? cfg.partitionCode : '')\n return (\n <div className=\"grid grid-cols-1 gap-3 md:grid-cols-2\">\n <div className=\"space-y-2\">\n <label className=\"text-xs font-medium\">Max file size (MB)</label>\n <Input\n type=\"number\"\n min={0}\n placeholder=\"e.g., 10\"\n value={maxMb}\n onChange={(e) => setMaxMb(e.target.value === '' ? '' : Number(e.target.value))}\n onBlur={() => onChange({ maxAttachmentSizeMb: maxMb === '' ? undefined : Number(maxMb) })}\n />\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-xs font-medium\">Accepted extensions</label>\n <Input\n placeholder=\"e.g., pdf, jpg, png\"\n value={exts}\n onChange={(e) => setExts(e.target.value)}\n onBlur={() => onChange({ acceptExtensions: exts.split(',').map((s) => s.trim()).filter(Boolean) })}\n />\n <div className=\"text-xs text-muted-foreground\">Leave blank to allow any.</div>\n </div>\n <div className=\"space-y-2\">\n <label className=\"text-xs font-medium\">Partition code</label>\n <Input\n placeholder=\"e.g., productsMedia\"\n value={partition}\n onChange={(e) => setPartition(e.target.value)}\n onBlur={() => onChange({ partitionCode: partition.trim() || undefined })}\n />\n <div className=\"text-xs text-muted-foreground\">\n Configure partitions under Settings \u2192 Attachments. Leave blank for default.\n </div>\n </div>\n </div>\n )\n}\n\nFieldRegistry.register('attachment', {\n input: (props) => <AttachmentInput entityId={props.entityId} recordId={props.recordId} def={props.def} disabled={props.disabled} />,\n defEditor: (p) => <AttachmentDefEditor {...p} />,\n})\n\nexport {}\n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AAY;AAAA,UACZ,OAAO;AAAA,UACP,UAAU,CAAC,MAAM,aAAa,EAAE,OAAO,KAAK;AAAA,UAC5C,QAAQ,MAAM,SAAS,EAAE,eAAe,UAAU,KAAK,KAAK,OAAU,CAAC;AAAA;AAAA,MACzE;AAAA,MACA,oBAAC,SAAI,WAAU,iCAAgC,8FAE/C;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,cAAc,SAAS,cAAc;AAAA,EACnC,OAAO,CAAC,UAAU,oBAAC,mBAAgB,UAAU,MAAM,UAAU,UAAU,MAAM,UAAU,KAAK,MAAM,KAAK,UAAU,MAAM,UAAU;AAAA,EACjI,WAAW,CAAC,MAAM,oBAAC,uBAAqB,GAAG,GAAG;AAChD,CAAC;",
|
|
6
6
|
"names": ["error"]
|
|
7
7
|
}
|
|
@@ -52,7 +52,7 @@ function UserConsentsPanel({ userId }) {
|
|
|
52
52
|
return /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("auth.users.consents.loading", "Loading consents...") });
|
|
53
53
|
}
|
|
54
54
|
if (error) {
|
|
55
|
-
return /* @__PURE__ */ jsx("p", { className: "text-sm text-
|
|
55
|
+
return /* @__PURE__ */ jsx("p", { className: "text-sm text-status-error-text", children: error });
|
|
56
56
|
}
|
|
57
57
|
if (consents.length === 0) {
|
|
58
58
|
return /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("auth.users.consents.empty", "No consent records found.") });
|
|
@@ -65,11 +65,11 @@ function UserConsentsPanel({ userId }) {
|
|
|
65
65
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
|
|
66
66
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: CONSENT_TYPE_LABELS[consent.consentType] ?? consent.consentType }),
|
|
67
67
|
/* @__PURE__ */ jsx("span", { className: "flex items-center gap-1.5", children: consent.isGranted ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68
|
-
/* @__PURE__ */ jsx(ShieldCheck, { className: "size-4 text-
|
|
69
|
-
/* @__PURE__ */ jsx("span", { className: "text-
|
|
68
|
+
/* @__PURE__ */ jsx(ShieldCheck, { className: "size-4 text-status-success-icon" }),
|
|
69
|
+
/* @__PURE__ */ jsx("span", { className: "text-status-success-text font-medium", children: t("auth.users.consents.granted", "Granted") })
|
|
70
70
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
|
-
/* @__PURE__ */ jsx(ShieldX, { className: "size-4 text-
|
|
72
|
-
/* @__PURE__ */ jsx("span", { className: "text-
|
|
71
|
+
/* @__PURE__ */ jsx(ShieldX, { className: "size-4 text-status-error-icon" }),
|
|
72
|
+
/* @__PURE__ */ jsx("span", { className: "text-status-error-text font-medium", children: t("auth.users.consents.withdrawn", "Withdrawn") })
|
|
73
73
|
] }) })
|
|
74
74
|
] }),
|
|
75
75
|
/* @__PURE__ */ jsxs("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-xs text-muted-foreground", children: [
|
|
@@ -85,11 +85,11 @@ function UserConsentsPanel({ userId }) {
|
|
|
85
85
|
/* @__PURE__ */ jsx("dd", { className: "font-mono", children: consent.ipAddress ?? "-" }),
|
|
86
86
|
/* @__PURE__ */ jsx("dt", { children: t("auth.users.consents.field.integrity", "Integrity") }),
|
|
87
87
|
/* @__PURE__ */ jsx("dd", { className: "flex items-center gap-1", children: consent.integrityValid ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
88
|
-
/* @__PURE__ */ jsx(ShieldCheck, { className: "size-3 text-
|
|
89
|
-
/* @__PURE__ */ jsx("span", { className: "text-
|
|
88
|
+
/* @__PURE__ */ jsx(ShieldCheck, { className: "size-3 text-status-success-icon" }),
|
|
89
|
+
/* @__PURE__ */ jsx("span", { className: "text-status-success-text", children: t("auth.users.consents.integrityValid", "Valid") })
|
|
90
90
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
91
|
-
/* @__PURE__ */ jsx(ShieldAlert, { className: "size-3 text-
|
|
92
|
-
/* @__PURE__ */ jsx("span", { className: "text-
|
|
91
|
+
/* @__PURE__ */ jsx(ShieldAlert, { className: "size-3 text-status-warning-icon" }),
|
|
92
|
+
/* @__PURE__ */ jsx("span", { className: "text-status-warning-text", children: t("auth.users.consents.integrityInvalid", "Tampered or missing") })
|
|
93
93
|
] }) }),
|
|
94
94
|
/* @__PURE__ */ jsx("dt", { children: t("auth.users.consents.field.createdAt", "Created") }),
|
|
95
95
|
/* @__PURE__ */ jsx("dd", { children: formatDate(consent.createdAt) })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/auth/components/UserConsentsPanel.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { ShieldCheck, ShieldAlert, ShieldX } from 'lucide-react'\nimport type { ConsentItem } from '@open-mercato/core/modules/auth/lib/consentTypes'\n\ntype ConsentsResponse = {\n ok?: boolean\n items?: ConsentItem[]\n}\n\nconst CONSENT_TYPE_LABELS: Record<string, string> = {\n marketing_email: 'Marketing Email',\n}\n\nfunction formatDate(iso: string | null): string {\n if (!iso) return '-'\n try {\n return new Date(iso).toLocaleString()\n } catch {\n return iso\n }\n}\n\ntype UserConsentsPanelProps = {\n userId: string\n}\n\nexport function UserConsentsPanel({ userId }: UserConsentsPanelProps) {\n const t = useT()\n const tRef = React.useRef(t)\n tRef.current = t\n const [consents, setConsents] = React.useState<ConsentItem[]>([])\n const [loading, setLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n\n React.useEffect(() => {\n let cancelled = false\n async function load() {\n setLoading(true)\n setError(null)\n try {\n const { ok, result } = await apiCall<ConsentsResponse>(\n `/api/auth/users/consents?userId=${encodeURIComponent(userId)}`,\n )\n if (!cancelled) {\n if (!ok) {\n setError(tRef.current('auth.users.consents.loadError', 'Failed to load consents'))\n } else {\n setConsents(result?.items ?? [])\n }\n }\n } catch {\n if (!cancelled) setError(tRef.current('auth.users.consents.loadError', 'Failed to load consents'))\n }\n if (!cancelled) setLoading(false)\n }\n load()\n return () => { cancelled = true }\n }, [userId])\n\n if (loading) {\n return <p className=\"text-sm text-muted-foreground\">{t('auth.users.consents.loading', 'Loading consents...')}</p>\n }\n\n if (error) {\n return <p className=\"text-sm text-
|
|
5
|
-
"mappings": ";AA+DW,SAwBK,UAxBL,KAwBK,YAxBL;AA9DX,YAAY,WAAW;AACvB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,aAAa,aAAa,eAAe;AAQlD,MAAM,sBAA8C;AAAA,EAClD,iBAAiB;AACnB;AAEA,SAAS,WAAW,KAA4B;AAC9C,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI;AACF,WAAO,IAAI,KAAK,GAAG,EAAE,eAAe;AAAA,EACtC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMO,SAAS,kBAAkB,EAAE,OAAO,GAA2B;AACpE,QAAM,IAAI,KAAK;AACf,QAAM,OAAO,MAAM,OAAO,CAAC;AAC3B,OAAK,UAAU;AACf,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAwB,CAAC,CAAC;AAChE,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,IAAI;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAwB,IAAI;AAE5D,QAAM,UAAU,MAAM;AACpB,QAAI,YAAY;AAChB,mBAAe,OAAO;AACpB,iBAAW,IAAI;AACf,eAAS,IAAI;AACb,UAAI;AACF,cAAM,EAAE,IAAI,OAAO,IAAI,MAAM;AAAA,UAC3B,mCAAmC,mBAAmB,MAAM,CAAC;AAAA,QAC/D;AACA,YAAI,CAAC,WAAW;AACd,cAAI,CAAC,IAAI;AACP,qBAAS,KAAK,QAAQ,iCAAiC,yBAAyB,CAAC;AAAA,UACnF,OAAO;AACL,wBAAY,QAAQ,SAAS,CAAC,CAAC;AAAA,UACjC;AAAA,QACF;AAAA,MACF,QAAQ;AACN,YAAI,CAAC,UAAW,UAAS,KAAK,QAAQ,iCAAiC,yBAAyB,CAAC;AAAA,MACnG;AACA,UAAI,CAAC,UAAW,YAAW,KAAK;AAAA,IAClC;AACA,SAAK;AACL,WAAO,MAAM;AAAE,kBAAY;AAAA,IAAK;AAAA,EAClC,GAAG,CAAC,MAAM,CAAC;AAEX,MAAI,SAAS;AACX,WAAO,oBAAC,OAAE,WAAU,iCAAiC,YAAE,+BAA+B,qBAAqB,GAAE;AAAA,EAC/G;AAEA,MAAI,OAAO;AACT,WAAO,oBAAC,OAAE,WAAU,
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { ShieldCheck, ShieldAlert, ShieldX } from 'lucide-react'\nimport type { ConsentItem } from '@open-mercato/core/modules/auth/lib/consentTypes'\n\ntype ConsentsResponse = {\n ok?: boolean\n items?: ConsentItem[]\n}\n\nconst CONSENT_TYPE_LABELS: Record<string, string> = {\n marketing_email: 'Marketing Email',\n}\n\nfunction formatDate(iso: string | null): string {\n if (!iso) return '-'\n try {\n return new Date(iso).toLocaleString()\n } catch {\n return iso\n }\n}\n\ntype UserConsentsPanelProps = {\n userId: string\n}\n\nexport function UserConsentsPanel({ userId }: UserConsentsPanelProps) {\n const t = useT()\n const tRef = React.useRef(t)\n tRef.current = t\n const [consents, setConsents] = React.useState<ConsentItem[]>([])\n const [loading, setLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n\n React.useEffect(() => {\n let cancelled = false\n async function load() {\n setLoading(true)\n setError(null)\n try {\n const { ok, result } = await apiCall<ConsentsResponse>(\n `/api/auth/users/consents?userId=${encodeURIComponent(userId)}`,\n )\n if (!cancelled) {\n if (!ok) {\n setError(tRef.current('auth.users.consents.loadError', 'Failed to load consents'))\n } else {\n setConsents(result?.items ?? [])\n }\n }\n } catch {\n if (!cancelled) setError(tRef.current('auth.users.consents.loadError', 'Failed to load consents'))\n }\n if (!cancelled) setLoading(false)\n }\n load()\n return () => { cancelled = true }\n }, [userId])\n\n if (loading) {\n return <p className=\"text-sm text-muted-foreground\">{t('auth.users.consents.loading', 'Loading consents...')}</p>\n }\n\n if (error) {\n return <p className=\"text-sm text-status-error-text\">{error}</p>\n }\n\n if (consents.length === 0) {\n return <p className=\"text-sm text-muted-foreground\">{t('auth.users.consents.empty', 'No consent records found.')}</p>\n }\n\n return (\n <div className=\"space-y-3\">\n {consents.map((consent) => (\n <div\n key={consent.id}\n className=\"rounded-lg border bg-background p-4 text-sm\"\n >\n <div className=\"flex items-center justify-between mb-2\">\n <span className=\"font-medium\">\n {CONSENT_TYPE_LABELS[consent.consentType] ?? consent.consentType}\n </span>\n <span className=\"flex items-center gap-1.5\">\n {consent.isGranted ? (\n <>\n <ShieldCheck className=\"size-4 text-status-success-icon\" />\n <span className=\"text-status-success-text font-medium\">\n {t('auth.users.consents.granted', 'Granted')}\n </span>\n </>\n ) : (\n <>\n <ShieldX className=\"size-4 text-status-error-icon\" />\n <span className=\"text-status-error-text font-medium\">\n {t('auth.users.consents.withdrawn', 'Withdrawn')}\n </span>\n </>\n )}\n </span>\n </div>\n <dl className=\"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-xs text-muted-foreground\">\n <dt>{t('auth.users.consents.field.grantedAt', 'Granted at')}</dt>\n <dd>{formatDate(consent.grantedAt)}</dd>\n {consent.withdrawnAt && (\n <>\n <dt>{t('auth.users.consents.field.withdrawnAt', 'Withdrawn at')}</dt>\n <dd>{formatDate(consent.withdrawnAt)}</dd>\n </>\n )}\n <dt>{t('auth.users.consents.field.source', 'Source')}</dt>\n <dd>{consent.source ?? '-'}</dd>\n <dt>{t('auth.users.consents.field.ipAddress', 'IP address')}</dt>\n <dd className=\"font-mono\">{consent.ipAddress ?? '-'}</dd>\n <dt>{t('auth.users.consents.field.integrity', 'Integrity')}</dt>\n <dd className=\"flex items-center gap-1\">\n {consent.integrityValid ? (\n <>\n <ShieldCheck className=\"size-3 text-status-success-icon\" />\n <span className=\"text-status-success-text\">{t('auth.users.consents.integrityValid', 'Valid')}</span>\n </>\n ) : (\n <>\n <ShieldAlert className=\"size-3 text-status-warning-icon\" />\n <span className=\"text-status-warning-text\">{t('auth.users.consents.integrityInvalid', 'Tampered or missing')}</span>\n </>\n )}\n </dd>\n <dt>{t('auth.users.consents.field.createdAt', 'Created')}</dt>\n <dd>{formatDate(consent.createdAt)}</dd>\n </dl>\n </div>\n ))}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA+DW,SAwBK,UAxBL,KAwBK,YAxBL;AA9DX,YAAY,WAAW;AACvB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,aAAa,aAAa,eAAe;AAQlD,MAAM,sBAA8C;AAAA,EAClD,iBAAiB;AACnB;AAEA,SAAS,WAAW,KAA4B;AAC9C,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI;AACF,WAAO,IAAI,KAAK,GAAG,EAAE,eAAe;AAAA,EACtC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMO,SAAS,kBAAkB,EAAE,OAAO,GAA2B;AACpE,QAAM,IAAI,KAAK;AACf,QAAM,OAAO,MAAM,OAAO,CAAC;AAC3B,OAAK,UAAU;AACf,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAwB,CAAC,CAAC;AAChE,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,IAAI;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAwB,IAAI;AAE5D,QAAM,UAAU,MAAM;AACpB,QAAI,YAAY;AAChB,mBAAe,OAAO;AACpB,iBAAW,IAAI;AACf,eAAS,IAAI;AACb,UAAI;AACF,cAAM,EAAE,IAAI,OAAO,IAAI,MAAM;AAAA,UAC3B,mCAAmC,mBAAmB,MAAM,CAAC;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AC,QAAG,WAAU,2EACZ;AAAA,8BAAC,QAAI,YAAE,uCAAuC,YAAY,GAAE;AAAA,UAC5D,oBAAC,QAAI,qBAAW,QAAQ,SAAS,GAAE;AAAA,UAClC,QAAQ,eACP,iCACE;AAAA,gCAAC,QAAI,YAAE,yCAAyC,cAAc,GAAE;AAAA,YAChE,oBAAC,QAAI,qBAAW,QAAQ,WAAW,GAAE;AAAA,aACvC;AAAA,UAEF,oBAAC,QAAI,YAAE,oCAAoC,QAAQ,GAAE;AAAA,UACrD,oBAAC,QAAI,kBAAQ,UAAU,KAAI;AAAA,UAC3B,oBAAC,QAAI,YAAE,uCAAuC,YAAY,GAAE;AAAA,UAC5D,oBAAC,QAAG,WAAU,aAAa,kBAAQ,aAAa,KAAI;AAAA,UACpD,oBAAC,QAAI,YAAE,uCAAuC,WAAW,GAAE;AAAA,UAC3D,oBAAC,QAAG,WAAU,2BACX,kBAAQ,iBACP,iCACE;AAAA,gCAAC,eAAY,WAAU,mCAAkC;AAAA,YACzD,oBAAC,UAAK,WAAU,4BAA4B,YAAE,sCAAsC,OAAO,GAAE;AAAA,aAC/F,IAEA,iCACE;AAAA,gCAAC,eAAY,WAAU,mCAAkC;AAAA,YACzD,oBAAC,UAAK,WAAU,4BAA4B,YAAE,wCAAwC,qBAAqB,GAAE;AAAA,aAC/G,GAEJ;AAAA,UACA,oBAAC,QAAI,YAAE,uCAAuC,SAAS,GAAE;AAAA,UACzD,oBAAC,QAAI,qBAAW,QAAQ,SAAS,GAAE;AAAA,WACrC;AAAA;AAAA;AAAA,IAtDK,QAAQ;AAAA,EAuDf,CACD,GACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -44,11 +44,11 @@ function ResetPage() {
|
|
|
44
44
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("auth.reset.sent", "If an account with that email exists, we sent a reset link. Please check your inbox.") }),
|
|
45
45
|
/* @__PURE__ */ jsx(Link, { href: "/login", className: "text-sm underline", children: t("auth.reset.backToLogin", "Back to login") })
|
|
46
46
|
] }) : /* @__PURE__ */ jsxs("form", { className: "grid gap-3", onSubmit, noValidate: true, children: [
|
|
47
|
-
error && /* @__PURE__ */ jsx("div", { className: "text-sm text-
|
|
47
|
+
error && /* @__PURE__ */ jsx("div", { className: "text-sm text-status-error-text", children: error }),
|
|
48
48
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-1", children: [
|
|
49
49
|
/* @__PURE__ */ jsx(Label, { htmlFor: "email", children: t("auth.email") }),
|
|
50
50
|
/* @__PURE__ */ jsx(EmailInput, { id: "email", name: "email", required: true, "aria-invalid": !!fieldError, "aria-describedby": fieldError ? "email-error" : void 0 }),
|
|
51
|
-
fieldError && /* @__PURE__ */ jsx("p", { id: "email-error", className: "text-sm text-
|
|
51
|
+
fieldError && /* @__PURE__ */ jsx("p", { id: "email-error", className: "text-sm text-status-error-text", children: fieldError })
|
|
52
52
|
] }),
|
|
53
53
|
/* @__PURE__ */ jsx(Button, { type: "submit", className: "mt-2 w-full", disabled: submitting, children: submitting ? "..." : t("auth.sendResetLink") }),
|
|
54
54
|
/* @__PURE__ */ jsx("div", { className: "text-center", children: /* @__PURE__ */ jsx(Link, { href: "/login", className: "text-xs text-muted-foreground underline", children: t("auth.reset.backToLogin", "Back to login") }) })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/auth/frontend/reset.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\nimport { useState } from 'react'\nimport Link from 'next/link'\nimport { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@open-mercato/ui/primitives/card'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { EmailInput } from '@open-mercato/ui/primitives/email-input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\nexport default function ResetPage() {\n const t = useT()\n const [sent, setSent] = useState(false)\n const [submitting, setSubmitting] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [fieldError, setFieldError] = useState<string | null>(null)\n\n async function onSubmit(e: React.FormEvent<HTMLFormElement>) {\n e.preventDefault()\n setError(null)\n setFieldError(null)\n setSubmitting(true)\n try {\n const form = new FormData(e.currentTarget)\n const res = await fetch('/api/auth/reset', { method: 'POST', body: form })\n if (!res.ok) {\n const data = await res.json().catch(() => null)\n if (data?.fieldErrors?.email?.length) {\n setFieldError(t('auth.reset.errors.emailInvalid', 'Please enter a valid email address.'))\n return\n }\n setError(data?.error || t('auth.reset.error', 'Something went wrong'))\n return\n }\n setSent(true)\n } finally {\n setSubmitting(false)\n }\n }\n\n return (\n <div className=\"min-h-svh flex items-center justify-center p-4\">\n <Card className=\"w-full max-w-sm\">\n <CardHeader>\n <CardTitle>{t('auth.resetPassword')}</CardTitle>\n <CardDescription>{t('auth.reset.description', 'Enter your email to receive reset link')}</CardDescription>\n </CardHeader>\n <CardContent>\n {sent ? (\n <div className=\"grid gap-3\">\n <p className=\"text-sm text-muted-foreground\">\n {t('auth.reset.sent', 'If an account with that email exists, we sent a reset link. Please check your inbox.')}\n </p>\n <Link href=\"/login\" className=\"text-sm underline\">\n {t('auth.reset.backToLogin', 'Back to login')}\n </Link>\n </div>\n ) : (\n <form className=\"grid gap-3\" onSubmit={onSubmit} noValidate>\n {error && <div className=\"text-sm text-
|
|
5
|
-
"mappings": ";AA0CQ,SACE,KADF;AAzCR,SAAS,gBAAgB;AACzB,OAAO,UAAU;AACjB,SAAS,MAAM,aAAa,YAAY,WAAW,uBAAuB;AAC1E,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,YAAY;AAEN,SAAR,YAA6B;AAClC,QAAM,IAAI,KAAK;AACf,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AACtD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAwB,IAAI;AAEhE,iBAAe,SAAS,GAAqC;AAC3D,MAAE,eAAe;AACjB,aAAS,IAAI;AACb,kBAAc,IAAI;AAClB,kBAAc,IAAI;AAClB,QAAI;AACF,YAAM,OAAO,IAAI,SAAS,EAAE,aAAa;AACzC,YAAM,MAAM,MAAM,MAAM,mBAAmB,EAAE,QAAQ,QAAQ,MAAM,KAAK,CAAC;AACzE,UAAI,CAAC,IAAI,IAAI;AACX,cAAM,OAAO,MAAM,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI;AAC9C,YAAI,MAAM,aAAa,OAAO,QAAQ;AACpC,wBAAc,EAAE,kCAAkC,qCAAqC,CAAC;AACxF;AAAA,QACF;AACA,iBAAS,MAAM,SAAS,EAAE,oBAAoB,sBAAsB,CAAC;AACrE;AAAA,MACF;AACA,cAAQ,IAAI;AAAA,IACd,UAAE;AACA,oBAAc,KAAK;AAAA,IACrB;AAAA,EACF;AAEA,SACE,oBAAC,SAAI,WAAU,kDACb,+BAAC,QAAK,WAAU,mBACd;AAAA,yBAAC,cACC;AAAA,0BAAC,aAAW,YAAE,oBAAoB,GAAE;AAAA,MACpC,oBAAC,mBAAiB,YAAE,0BAA0B,wCAAwC,GAAE;AAAA,OAC1F;AAAA,IACA,oBAAC,eACE,iBACC,qBAAC,SAAI,WAAU,cACb;AAAA,0BAAC,OAAE,WAAU,iCACV,YAAE,mBAAmB,sFAAsF,GAC9G;AAAA,MACA,oBAAC,QAAK,MAAK,UAAS,WAAU,qBAC3B,YAAE,0BAA0B,eAAe,GAC9C;AAAA,OACF,IAEA,qBAAC,UAAK,WAAU,cAAa,UAAoB,YAAU,MACxD;AAAA,eAAS,oBAAC,SAAI,WAAU,
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport { useState } from 'react'\nimport Link from 'next/link'\nimport { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@open-mercato/ui/primitives/card'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { EmailInput } from '@open-mercato/ui/primitives/email-input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\nexport default function ResetPage() {\n const t = useT()\n const [sent, setSent] = useState(false)\n const [submitting, setSubmitting] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [fieldError, setFieldError] = useState<string | null>(null)\n\n async function onSubmit(e: React.FormEvent<HTMLFormElement>) {\n e.preventDefault()\n setError(null)\n setFieldError(null)\n setSubmitting(true)\n try {\n const form = new FormData(e.currentTarget)\n const res = await fetch('/api/auth/reset', { method: 'POST', body: form })\n if (!res.ok) {\n const data = await res.json().catch(() => null)\n if (data?.fieldErrors?.email?.length) {\n setFieldError(t('auth.reset.errors.emailInvalid', 'Please enter a valid email address.'))\n return\n }\n setError(data?.error || t('auth.reset.error', 'Something went wrong'))\n return\n }\n setSent(true)\n } finally {\n setSubmitting(false)\n }\n }\n\n return (\n <div className=\"min-h-svh flex items-center justify-center p-4\">\n <Card className=\"w-full max-w-sm\">\n <CardHeader>\n <CardTitle>{t('auth.resetPassword')}</CardTitle>\n <CardDescription>{t('auth.reset.description', 'Enter your email to receive reset link')}</CardDescription>\n </CardHeader>\n <CardContent>\n {sent ? (\n <div className=\"grid gap-3\">\n <p className=\"text-sm text-muted-foreground\">\n {t('auth.reset.sent', 'If an account with that email exists, we sent a reset link. Please check your inbox.')}\n </p>\n <Link href=\"/login\" className=\"text-sm underline\">\n {t('auth.reset.backToLogin', 'Back to login')}\n </Link>\n </div>\n ) : (\n <form className=\"grid gap-3\" onSubmit={onSubmit} noValidate>\n {error && <div className=\"text-sm text-status-error-text\">{error}</div>}\n <div className=\"grid gap-1\">\n <Label htmlFor=\"email\">{t('auth.email')}</Label>\n <EmailInput id=\"email\" name=\"email\" required aria-invalid={!!fieldError} aria-describedby={fieldError ? 'email-error' : undefined} />\n {fieldError && <p id=\"email-error\" className=\"text-sm text-status-error-text\">{fieldError}</p>}\n </div>\n <Button type=\"submit\" className=\"mt-2 w-full\" disabled={submitting}>\n {submitting ? '...' : t('auth.sendResetLink')}\n </Button>\n <div className=\"text-center\">\n <Link href=\"/login\" className=\"text-xs text-muted-foreground underline\">\n {t('auth.reset.backToLogin', 'Back to login')}\n </Link>\n </div>\n </form>\n )}\n </CardContent>\n </Card>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA0CQ,SACE,KADF;AAzCR,SAAS,gBAAgB;AACzB,OAAO,UAAU;AACjB,SAAS,MAAM,aAAa,YAAY,WAAW,uBAAuB;AAC1E,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,YAAY;AAEN,SAAR,YAA6B;AAClC,QAAM,IAAI,KAAK;AACf,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AACtD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAwB,IAAI;AAEhE,iBAAe,SAAS,GAAqC;AAC3D,MAAE,eAAe;AACjB,aAAS,IAAI;AACb,kBAAc,IAAI;AAClB,kBAAc,IAAI;AAClB,QAAI;AACF,YAAM,OAAO,IAAI,SAAS,EAAE,aAAa;AACzC,YAAM,MAAM,MAAM,MAAM,mBAAmB,EAAE,QAAQ,QAAQ,MAAM,KAAK,CAAC;AACzE,UAAI,CAAC,IAAI,IAAI;AACX,cAAM,OAAO,MAAM,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI;AAC9C,YAAI,MAAM,aAAa,OAAO,QAAQ;AACpC,wBAAc,EAAE,kCAAkC,qCAAqC,CAAC;AACxF;AAAA,QACF;AACA,iBAAS,MAAM,SAAS,EAAE,oBAAoB,sBAAsB,CAAC;AACrE;AAAA,MACF;AACA,cAAQ,IAAI;AAAA,IACd,UAAE;AACA,oBAAc,KAAK;AAAA,IACrB;AAAA,EACF;AAEA,SACE,oBAAC,SAAI,WAAU,kDACb,+BAAC,QAAK,WAAU,mBACd;AAAA,yBAAC,cACC;AAAA,0BAAC,aAAW,YAAE,oBAAoB,GAAE;AAAA,MACpC,oBAAC,mBAAiB,YAAE,0BAA0B,wCAAwC,GAAE;AAAA,OAC1F;AAAA,IACA,oBAAC,eACE,iBACC,qBAAC,SAAI,WAAU,cACb;AAAA,0BAAC,OAAE,WAAU,iCACV,YAAE,mBAAmB,sFAAsF,GAC9G;AAAA,MACA,oBAAC,QAAK,MAAK,UAAS,WAAU,qBAC3B,YAAE,0BAA0B,eAAe,GAC9C;AAAA,OACF,IAEA,qBAAC,UAAK,WAAU,cAAa,UAAoB,YAAU,MACxD;AAAA,eAAS,oBAAC,SAAI,WAAU,kCAAkC,iBAAM;AAAA,MACjE,qBAAC,SAAI,WAAU,cACb;AAAA,4BAAC,SAAM,SAAQ,SAAS,YAAE,YAAY,GAAE;AAAA,QACxC,oBAAC,cAAW,IAAG,SAAQ,MAAK,SAAQ,UAAQ,MAAC,gBAAc,CAAC,CAAC,YAAY,oBAAkB,aAAa,gBAAgB,QAAW;AAAA,QAClI,cAAc,oBAAC,OAAE,IAAG,eAAc,WAAU,kCAAkC,sBAAW;AAAA,SAC5F;AAAA,MACA,oBAAC,UAAO,MAAK,UAAS,WAAU,eAAc,UAAU,YACrD,uBAAa,QAAQ,EAAE,oBAAoB,GAC9C;AAAA,MACA,oBAAC,SAAI,WAAU,eACb,8BAAC,QAAK,MAAK,UAAS,WAAU,2CAC3B,YAAE,0BAA0B,eAAe,GAC9C,GACF;AAAA,OACF,GAEJ;AAAA,KACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -289,7 +289,7 @@ function ActionRow({
|
|
|
289
289
|
onClick: () => onDelete(index),
|
|
290
290
|
variant: "ghost",
|
|
291
291
|
size: "xs",
|
|
292
|
-
className: "hover:text-
|
|
292
|
+
className: "hover:bg-destructive/10 hover:text-destructive",
|
|
293
293
|
title: t("business_rules.components.actionRow.delete"),
|
|
294
294
|
"aria-label": t("business_rules.components.actionRow.delete"),
|
|
295
295
|
children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/business_rules/components/ActionRow.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { X, ChevronUp, ChevronDown } from 'lucide-react'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { ComboboxInput, type ComboboxOption } from '@open-mercato/ui/backend/inputs'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport type { Action } from './utils/actionValidation'\nimport { getActionTypeOptions, getRequiredConfigFields, getOptionalConfigFields } from './utils/actionValidation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type {\n OpenMercatoApiKeyOption,\n OpenMercatoEndpointOption,\n} from '../lib/openmercato-call-options-types'\n\nexport type OpenMercatoCallOptionsState = {\n endpoints: OpenMercatoEndpointOption[]\n apiKeys: OpenMercatoApiKeyOption[]\n loading: boolean\n error: string | null\n}\n\nexport type ActionRowProps = {\n action: Action\n index: number\n onChange: (index: number, action: Action) => void\n onDelete: (index: number) => void\n onMoveUp?: (index: number) => void\n onMoveDown?: (index: number) => void\n canMoveUp?: boolean\n canMoveDown?: boolean\n error?: string\n openMercatoOptions?: OpenMercatoCallOptionsState\n}\n\nexport function ActionRow({\n action,\n index,\n onChange,\n onDelete,\n onMoveUp,\n onMoveDown,\n canMoveUp,\n canMoveDown,\n error,\n openMercatoOptions,\n}: ActionRowProps) {\n const t = useT()\n const actionTypes = getActionTypeOptions(t)\n const requiredFields = getRequiredConfigFields(action.type)\n const optionalFields = getOptionalConfigFields(action.type)\n\n const handleTypeChange = (e: React.ChangeEvent<HTMLSelectElement>) => {\n onChange(index, {\n ...action,\n type: e.target.value,\n config: {}, // Reset config when type changes\n })\n }\n\n const handleConfigChange = (field: string, value: any) => {\n onChange(index, {\n ...action,\n config: {\n ...(action.config || {}),\n [field]: value,\n },\n })\n }\n\n const renderOpenMercatoConfig = () => {\n const options = openMercatoOptions ?? { endpoints: [], apiKeys: [], loading: false, error: null }\n const endpointValue = action.config?.endpoint && action.config?.method\n ? `${String(action.config.method).toUpperCase()} ${action.config.endpoint}`\n : undefined\n const apiKeyValue = action.config?.apiKeyId || undefined\n const endpointOptions = options.endpoints.map<ComboboxOption>((option) => ({\n value: option.id,\n label: option.label,\n description: option.summary || option.operationId || null,\n }))\n const bodyValue = action.config?.body == null\n ? ''\n : typeof action.config.body === 'string'\n ? action.config.body\n : JSON.stringify(action.config.body, null, 2)\n\n const handleEndpointChange = (value: string) => {\n const option = options.endpoints.find((candidate) => candidate.id === value)\n if (!option) return\n onChange(index, {\n ...action,\n config: {\n ...(action.config || {}),\n endpoint: option.path,\n method: option.method,\n },\n })\n }\n\n return (\n <div className=\"space-y-2\">\n {options.loading && (\n <p className=\"text-xs text-muted-foreground col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.loading')}\n </p>\n )}\n {options.error && (\n <p className=\"text-xs text-status-error-text col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.error', { error: options.error })}\n </p>\n )}\n {!options.loading && !options.error && options.endpoints.length === 0 && (\n <p className=\"text-xs text-muted-foreground col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.noEndpoints')}\n </p>\n )}\n {!options.loading && !options.error && options.apiKeys.length === 0 && (\n <p className=\"text-xs text-muted-foreground col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.noApiKeys')}\n </p>\n )}\n\n <div className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.endpoint')} <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>\n </label>\n <div className=\"col-span-3\">\n <ComboboxInput\n value={endpointValue ?? ''}\n onChange={handleEndpointChange}\n suggestions={endpointOptions}\n placeholder={t('business_rules.components.actionRow.config.endpoint.placeholder')}\n disabled={options.loading || !!options.error || options.endpoints.length === 0}\n allowCustomValues={false}\n />\n </div>\n </div>\n\n <div className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.apiKey')} <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>\n </label>\n <Select\n value={apiKeyValue}\n onValueChange={(next) => handleConfigChange('apiKeyId', next)}\n disabled={options.loading || !!options.error || options.apiKeys.length === 0}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue placeholder={t('business_rules.components.actionRow.config.apiKey.placeholder')} />\n </SelectTrigger>\n <SelectContent>\n {options.apiKeys.map((apiKey) => (\n <SelectItem key={apiKey.id} value={apiKey.id}>\n {apiKey.organizationName\n ? `${apiKey.name} (${apiKey.keyPrefix}, ${apiKey.organizationName})`\n : `${apiKey.name} (${apiKey.keyPrefix})`}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.body')}\n </label>\n <Textarea\n value={bodyValue}\n onChange={(e) => handleConfigChange('body', e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.body.placeholder')}\n rows={3}\n className=\"col-span-3\"\n />\n </div>\n </div>\n )\n }\n\n const renderConfigField = (field: string, required: boolean) => {\n const value = action.config?.[field] || ''\n\n // Special handling for different field types\n if (field === 'recipients' && action.type === 'NOTIFY') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.recipients')} {required && <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Input\n type=\"text\"\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value.split(',').map((s) => s.trim()))}\n placeholder={t('business_rules.components.actionRow.config.recipients.placeholder')}\n className=\"col-span-3\"\n />\n <div className=\"col-span-4 col-start-2\">\n <p className=\"text-xs text-muted-foreground\">{t('business_rules.components.actionRow.config.recipients.help')}</p>\n </div>\n </div>\n )\n }\n\n if (field === 'level' && action.type === 'LOG') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">{t('business_rules.components.actionRow.config.level')}</label>\n <Select\n value={value || 'info'}\n onValueChange={(next) => handleConfigChange(field, next)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"info\">{t('business_rules.components.actionRow.config.level.info')}</SelectItem>\n <SelectItem value=\"warn\">{t('business_rules.components.actionRow.config.level.warn')}</SelectItem>\n <SelectItem value=\"error\">{t('business_rules.components.actionRow.config.level.error')}</SelectItem>\n <SelectItem value=\"debug\">{t('business_rules.components.actionRow.config.level.debug')}</SelectItem>\n </SelectContent>\n </Select>\n </div>\n )\n }\n\n if (field === 'method' && action.type === 'CALL_WEBHOOK') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">{t('business_rules.components.actionRow.config.method')}</label>\n <Select\n value={value || 'POST'}\n onValueChange={(next) => handleConfigChange(field, next)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"GET\">GET</SelectItem>\n <SelectItem value=\"POST\">POST</SelectItem>\n <SelectItem value=\"PUT\">PUT</SelectItem>\n <SelectItem value=\"PATCH\">PATCH</SelectItem>\n <SelectItem value=\"DELETE\">DELETE</SelectItem>\n </SelectContent>\n </Select>\n </div>\n )\n }\n\n if (field === 'message') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.message')} {required && <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Textarea\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.message.placeholder')}\n rows={2}\n className=\"col-span-3\"\n />\n <div className=\"col-span-4 col-start-2\">\n <p className=\"text-xs text-muted-foreground\">{t('business_rules.components.actionRow.config.message.help')}</p>\n </div>\n </div>\n )\n }\n\n // Default text input\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {field} {required && <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Input\n type=\"text\"\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.field.placeholder', { field })}\n className=\"col-span-3\"\n />\n </div>\n )\n }\n\n return (\n <div className=\"flex items-start gap-2 p-3 bg-muted rounded border border-border\">\n <div className=\"flex-1 space-y-2\">\n {/* Action Type */}\n <div className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.actionType')} <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>\n </label>\n <Select\n value={action.type || undefined}\n onValueChange={(value) => handleTypeChange({ target: { value } } as React.ChangeEvent<HTMLSelectElement>)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3 font-medium\">\n <SelectValue placeholder={t('business_rules.components.actionRow.actionType.placeholder')} />\n </SelectTrigger>\n <SelectContent>\n {actionTypes.map((type) => (\n <SelectItem key={type.value} value={type.value}>\n {type.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n {/* Config Fields */}\n {action.type && (\n <>\n {action.type === 'CALL_OPEN_MERCATO'\n ? renderOpenMercatoConfig()\n : (\n <>\n {requiredFields.map((field) => renderConfigField(field, true))}\n {optionalFields.map((field) => renderConfigField(field, false))}\n </>\n )}\n </>\n )}\n\n {/* Error Display */}\n {error && (\n <div className=\"mt-2\">\n <p className=\"text-xs text-status-error-text\">{error}</p>\n </div>\n )}\n </div>\n\n {/* Control Buttons */}\n <div className=\"flex flex-col gap-1\">\n {onMoveUp && (\n <IconButton\n type=\"button\"\n onClick={() => onMoveUp(index)}\n disabled={!canMoveUp}\n variant=\"ghost\"\n size=\"xs\"\n title={t('business_rules.components.actionRow.moveUp')}\n aria-label={t('business_rules.components.actionRow.moveUp')}\n >\n <ChevronUp className=\"w-4 h-4\" />\n </IconButton>\n )}\n {onMoveDown && (\n <IconButton\n type=\"button\"\n onClick={() => onMoveDown(index)}\n disabled={!canMoveDown}\n variant=\"ghost\"\n size=\"xs\"\n title={t('business_rules.components.actionRow.moveDown')}\n aria-label={t('business_rules.components.actionRow.moveDown')}\n >\n <ChevronDown className=\"w-4 h-4\" />\n </IconButton>\n )}\n <IconButton\n type=\"button\"\n onClick={() => onDelete(index)}\n variant=\"ghost\"\n size=\"xs\"\n className=\"hover:text-status-error-text\"\n title={t('business_rules.components.actionRow.delete')}\n aria-label={t('business_rules.components.actionRow.delete')}\n >\n <X className=\"w-4 h-4\" />\n </IconButton>\n </div>\n </div>\n )\n}\n"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { X, ChevronUp, ChevronDown } from 'lucide-react'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { ComboboxInput, type ComboboxOption } from '@open-mercato/ui/backend/inputs'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport type { Action } from './utils/actionValidation'\nimport { getActionTypeOptions, getRequiredConfigFields, getOptionalConfigFields } from './utils/actionValidation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type {\n OpenMercatoApiKeyOption,\n OpenMercatoEndpointOption,\n} from '../lib/openmercato-call-options-types'\n\nexport type OpenMercatoCallOptionsState = {\n endpoints: OpenMercatoEndpointOption[]\n apiKeys: OpenMercatoApiKeyOption[]\n loading: boolean\n error: string | null\n}\n\nexport type ActionRowProps = {\n action: Action\n index: number\n onChange: (index: number, action: Action) => void\n onDelete: (index: number) => void\n onMoveUp?: (index: number) => void\n onMoveDown?: (index: number) => void\n canMoveUp?: boolean\n canMoveDown?: boolean\n error?: string\n openMercatoOptions?: OpenMercatoCallOptionsState\n}\n\nexport function ActionRow({\n action,\n index,\n onChange,\n onDelete,\n onMoveUp,\n onMoveDown,\n canMoveUp,\n canMoveDown,\n error,\n openMercatoOptions,\n}: ActionRowProps) {\n const t = useT()\n const actionTypes = getActionTypeOptions(t)\n const requiredFields = getRequiredConfigFields(action.type)\n const optionalFields = getOptionalConfigFields(action.type)\n\n const handleTypeChange = (e: React.ChangeEvent<HTMLSelectElement>) => {\n onChange(index, {\n ...action,\n type: e.target.value,\n config: {}, // Reset config when type changes\n })\n }\n\n const handleConfigChange = (field: string, value: any) => {\n onChange(index, {\n ...action,\n config: {\n ...(action.config || {}),\n [field]: value,\n },\n })\n }\n\n const renderOpenMercatoConfig = () => {\n const options = openMercatoOptions ?? { endpoints: [], apiKeys: [], loading: false, error: null }\n const endpointValue = action.config?.endpoint && action.config?.method\n ? `${String(action.config.method).toUpperCase()} ${action.config.endpoint}`\n : undefined\n const apiKeyValue = action.config?.apiKeyId || undefined\n const endpointOptions = options.endpoints.map<ComboboxOption>((option) => ({\n value: option.id,\n label: option.label,\n description: option.summary || option.operationId || null,\n }))\n const bodyValue = action.config?.body == null\n ? ''\n : typeof action.config.body === 'string'\n ? action.config.body\n : JSON.stringify(action.config.body, null, 2)\n\n const handleEndpointChange = (value: string) => {\n const option = options.endpoints.find((candidate) => candidate.id === value)\n if (!option) return\n onChange(index, {\n ...action,\n config: {\n ...(action.config || {}),\n endpoint: option.path,\n method: option.method,\n },\n })\n }\n\n return (\n <div className=\"space-y-2\">\n {options.loading && (\n <p className=\"text-xs text-muted-foreground col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.loading')}\n </p>\n )}\n {options.error && (\n <p className=\"text-xs text-status-error-text col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.error', { error: options.error })}\n </p>\n )}\n {!options.loading && !options.error && options.endpoints.length === 0 && (\n <p className=\"text-xs text-muted-foreground col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.noEndpoints')}\n </p>\n )}\n {!options.loading && !options.error && options.apiKeys.length === 0 && (\n <p className=\"text-xs text-muted-foreground col-start-2\">\n {t('business_rules.components.actionRow.openMercato.options.noApiKeys')}\n </p>\n )}\n\n <div className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.endpoint')} <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>\n </label>\n <div className=\"col-span-3\">\n <ComboboxInput\n value={endpointValue ?? ''}\n onChange={handleEndpointChange}\n suggestions={endpointOptions}\n placeholder={t('business_rules.components.actionRow.config.endpoint.placeholder')}\n disabled={options.loading || !!options.error || options.endpoints.length === 0}\n allowCustomValues={false}\n />\n </div>\n </div>\n\n <div className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.apiKey')} <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>\n </label>\n <Select\n value={apiKeyValue}\n onValueChange={(next) => handleConfigChange('apiKeyId', next)}\n disabled={options.loading || !!options.error || options.apiKeys.length === 0}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue placeholder={t('business_rules.components.actionRow.config.apiKey.placeholder')} />\n </SelectTrigger>\n <SelectContent>\n {options.apiKeys.map((apiKey) => (\n <SelectItem key={apiKey.id} value={apiKey.id}>\n {apiKey.organizationName\n ? `${apiKey.name} (${apiKey.keyPrefix}, ${apiKey.organizationName})`\n : `${apiKey.name} (${apiKey.keyPrefix})`}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.body')}\n </label>\n <Textarea\n value={bodyValue}\n onChange={(e) => handleConfigChange('body', e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.body.placeholder')}\n rows={3}\n className=\"col-span-3\"\n />\n </div>\n </div>\n )\n }\n\n const renderConfigField = (field: string, required: boolean) => {\n const value = action.config?.[field] || ''\n\n // Special handling for different field types\n if (field === 'recipients' && action.type === 'NOTIFY') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.recipients')} {required && <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Input\n type=\"text\"\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value.split(',').map((s) => s.trim()))}\n placeholder={t('business_rules.components.actionRow.config.recipients.placeholder')}\n className=\"col-span-3\"\n />\n <div className=\"col-span-4 col-start-2\">\n <p className=\"text-xs text-muted-foreground\">{t('business_rules.components.actionRow.config.recipients.help')}</p>\n </div>\n </div>\n )\n }\n\n if (field === 'level' && action.type === 'LOG') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">{t('business_rules.components.actionRow.config.level')}</label>\n <Select\n value={value || 'info'}\n onValueChange={(next) => handleConfigChange(field, next)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"info\">{t('business_rules.components.actionRow.config.level.info')}</SelectItem>\n <SelectItem value=\"warn\">{t('business_rules.components.actionRow.config.level.warn')}</SelectItem>\n <SelectItem value=\"error\">{t('business_rules.components.actionRow.config.level.error')}</SelectItem>\n <SelectItem value=\"debug\">{t('business_rules.components.actionRow.config.level.debug')}</SelectItem>\n </SelectContent>\n </Select>\n </div>\n )\n }\n\n if (field === 'method' && action.type === 'CALL_WEBHOOK') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">{t('business_rules.components.actionRow.config.method')}</label>\n <Select\n value={value || 'POST'}\n onValueChange={(next) => handleConfigChange(field, next)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"GET\">GET</SelectItem>\n <SelectItem value=\"POST\">POST</SelectItem>\n <SelectItem value=\"PUT\">PUT</SelectItem>\n <SelectItem value=\"PATCH\">PATCH</SelectItem>\n <SelectItem value=\"DELETE\">DELETE</SelectItem>\n </SelectContent>\n </Select>\n </div>\n )\n }\n\n if (field === 'message') {\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-start\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.config.message')} {required && <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Textarea\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.message.placeholder')}\n rows={2}\n className=\"col-span-3\"\n />\n <div className=\"col-span-4 col-start-2\">\n <p className=\"text-xs text-muted-foreground\">{t('business_rules.components.actionRow.config.message.help')}</p>\n </div>\n </div>\n )\n }\n\n // Default text input\n return (\n <div key={field} className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {field} {required && <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>}\n </label>\n <Input\n type=\"text\"\n value={value}\n onChange={(e) => handleConfigChange(field, e.target.value)}\n placeholder={t('business_rules.components.actionRow.config.field.placeholder', { field })}\n className=\"col-span-3\"\n />\n </div>\n )\n }\n\n return (\n <div className=\"flex items-start gap-2 p-3 bg-muted rounded border border-border\">\n <div className=\"flex-1 space-y-2\">\n {/* Action Type */}\n <div className=\"grid grid-cols-4 gap-2 items-center\">\n <label className=\"text-xs font-medium text-foreground col-span-1\">\n {t('business_rules.components.actionRow.actionType')} <span className=\"text-status-error-text\">{t('business_rules.components.actionRow.actionType.required')}</span>\n </label>\n <Select\n value={action.type || undefined}\n onValueChange={(value) => handleTypeChange({ target: { value } } as React.ChangeEvent<HTMLSelectElement>)}\n >\n <SelectTrigger size=\"sm\" className=\"col-span-3 font-medium\">\n <SelectValue placeholder={t('business_rules.components.actionRow.actionType.placeholder')} />\n </SelectTrigger>\n <SelectContent>\n {actionTypes.map((type) => (\n <SelectItem key={type.value} value={type.value}>\n {type.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n {/* Config Fields */}\n {action.type && (\n <>\n {action.type === 'CALL_OPEN_MERCATO'\n ? renderOpenMercatoConfig()\n : (\n <>\n {requiredFields.map((field) => renderConfigField(field, true))}\n {optionalFields.map((field) => renderConfigField(field, false))}\n </>\n )}\n </>\n )}\n\n {/* Error Display */}\n {error && (\n <div className=\"mt-2\">\n <p className=\"text-xs text-status-error-text\">{error}</p>\n </div>\n )}\n </div>\n\n {/* Control Buttons */}\n <div className=\"flex flex-col gap-1\">\n {onMoveUp && (\n <IconButton\n type=\"button\"\n onClick={() => onMoveUp(index)}\n disabled={!canMoveUp}\n variant=\"ghost\"\n size=\"xs\"\n title={t('business_rules.components.actionRow.moveUp')}\n aria-label={t('business_rules.components.actionRow.moveUp')}\n >\n <ChevronUp className=\"w-4 h-4\" />\n </IconButton>\n )}\n {onMoveDown && (\n <IconButton\n type=\"button\"\n onClick={() => onMoveDown(index)}\n disabled={!canMoveDown}\n variant=\"ghost\"\n size=\"xs\"\n title={t('business_rules.components.actionRow.moveDown')}\n aria-label={t('business_rules.components.actionRow.moveDown')}\n >\n <ChevronDown className=\"w-4 h-4\" />\n </IconButton>\n )}\n <IconButton\n type=\"button\"\n onClick={() => onDelete(index)}\n variant=\"ghost\"\n size=\"xs\"\n className=\"hover:bg-destructive/10 hover:text-destructive\"\n title={t('business_rules.components.actionRow.delete')}\n aria-label={t('business_rules.components.actionRow.delete')}\n >\n <X className=\"w-4 h-4\" />\n </IconButton>\n </div>\n </div>\n )\n}\n"],
|
|
5
5
|
"mappings": ";AA+GU,SAqNM,UArNN,KAqBA,YArBA;AA5GV,SAAS,GAAG,WAAW,mBAAmB;AAC1C,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,qBAA0C;AACnD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,sBAAsB,yBAAyB,+BAA+B;AACvF,SAAS,YAAY;AA0Bd,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAmB;AACjB,QAAM,IAAI,KAAK;AACf,QAAM,cAAc,qBAAqB,CAAC;AAC1C,QAAM,iBAAiB,wBAAwB,OAAO,IAAI;AAC1D,QAAM,iBAAiB,wBAAwB,OAAO,IAAI;AAE1D,QAAM,mBAAmB,CAAC,MAA4C;AACpE,aAAS,OAAO;AAAA,MACd,GAAG;AAAA,MACH,MAAM,EAAE,OAAO;AAAA,MACf,QAAQ,CAAC;AAAA;AAAA,IACX,CAAC;AAAA,EACH;AAEA,QAAM,qBAAqB,CAAC,OAAe,UAAe;AACxD,aAAS,OAAO;AAAA,MACd,GAAG;AAAA,MACH,QAAQ;AAAA,QACN,GAAI,OAAO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AAA,UACR,MAAK;AAAA,UACL,WAAU;AAAA,UACV,OAAO,EAAE,4CAA4C;AAAA,UACrD,cAAY,EAAE,4CAA4C;AAAA,UAE1D,8BAAC,KAAE,WAAU,WAAU;AAAA;AAAA,MACzB;AAAA,OACF;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import { IconButton } from "@open-mercato/ui/primitives/icon-button";
|
|
4
5
|
import { Input } from "@open-mercato/ui/primitives/input";
|
|
5
6
|
import {
|
|
6
7
|
Select,
|
|
@@ -62,7 +63,7 @@ function ConditionRow({ condition, onChange, onDelete, error }) {
|
|
|
62
63
|
"aria-invalid": fieldError ? true : void 0
|
|
63
64
|
}
|
|
64
65
|
),
|
|
65
|
-
fieldError && /* @__PURE__ */ jsx("p", { className: "text-xs text-
|
|
66
|
+
fieldError && /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text mt-0.5", children: t("business_rules.components.conditionRow.field.invalidPath") })
|
|
66
67
|
] }),
|
|
67
68
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
68
69
|
/* @__PURE__ */ jsx("label", { className: "block text-xs font-medium text-foreground mb-1", children: t("business_rules.components.conditionRow.operator") }),
|
|
@@ -105,16 +106,19 @@ function ConditionRow({ condition, onChange, onDelete, error }) {
|
|
|
105
106
|
] })
|
|
106
107
|
] }),
|
|
107
108
|
/* @__PURE__ */ jsx(
|
|
108
|
-
|
|
109
|
+
IconButton,
|
|
109
110
|
{
|
|
110
111
|
type: "button",
|
|
111
112
|
onClick: onDelete,
|
|
112
|
-
|
|
113
|
+
variant: "ghost",
|
|
114
|
+
size: "xs",
|
|
115
|
+
className: "hover:bg-destructive/10 hover:text-destructive",
|
|
113
116
|
title: t("business_rules.components.conditionRow.deleteCondition"),
|
|
117
|
+
"aria-label": t("business_rules.components.conditionRow.deleteCondition"),
|
|
114
118
|
children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" })
|
|
115
119
|
}
|
|
116
120
|
),
|
|
117
|
-
error && /* @__PURE__ */ jsx("div", { className: "col-span-full mt-2", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-
|
|
121
|
+
error && /* @__PURE__ */ jsx("div", { className: "col-span-full mt-2", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text", children: error }) })
|
|
118
122
|
] });
|
|
119
123
|
}
|
|
120
124
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/business_rules/components/ConditionRow.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport {
|
|
5
|
-
"mappings": ";AA8EQ,SACE,KADF;AA5ER,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { X } from 'lucide-react'\nimport type { SimpleCondition } from './utils/conditionValidation'\nimport { getComparisonOperators, isValidFieldPath } from './utils/conditionValidation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\nexport type ConditionRowProps = {\n condition: SimpleCondition\n onChange: (condition: SimpleCondition) => void\n onDelete: () => void\n entityType?: string\n error?: string\n}\n\nexport function ConditionRow({ condition, onChange, onDelete, error }: ConditionRowProps) {\n const t = useT()\n const operators = getComparisonOperators(t)\n const [useFieldComparison, setUseFieldComparison] = React.useState(!!condition.valueField)\n\n const handleFieldChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange({ ...condition, field: e.target.value })\n }\n\n const handleOperatorChange = (e: React.ChangeEvent<HTMLSelectElement>) => {\n onChange({ ...condition, operator: e.target.value as any })\n }\n\n const handleValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const rawValue = e.target.value\n\n // Try to parse as JSON for arrays/objects\n let parsedValue: any = rawValue\n if (rawValue.trim().startsWith('[') || rawValue.trim().startsWith('{')) {\n try {\n parsedValue = JSON.parse(rawValue)\n } catch {\n // Keep as string if not valid JSON\n parsedValue = rawValue\n }\n }\n\n onChange({ ...condition, value: parsedValue, valueField: undefined })\n }\n\n const handleValueFieldChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange({ ...condition, valueField: e.target.value, value: null })\n }\n\n const toggleFieldComparison = () => {\n if (useFieldComparison) {\n onChange({ ...condition, valueField: undefined, value: null })\n setUseFieldComparison(false)\n } else {\n onChange({ ...condition, value: null, valueField: '' })\n setUseFieldComparison(true)\n }\n }\n\n // Operators that don't need a value\n const operatorNeedsValue = !['IS_EMPTY', 'IS_NOT_EMPTY'].includes(condition.operator)\n\n const fieldError = condition.field && !isValidFieldPath(condition.field)\n\n return (\n <div className=\"flex items-start gap-2 p-3 bg-muted rounded border border-border\">\n <div className=\"flex-1 grid grid-cols-1 md:grid-cols-3 gap-2\">\n {/* Field Input */}\n <div>\n <label className=\"block text-xs font-medium text-foreground mb-1\">\n {t('business_rules.components.conditionRow.field')}\n </label>\n <Input\n type=\"text\"\n value={condition.field || ''}\n onChange={handleFieldChange}\n placeholder={t('business_rules.components.conditionRow.field.placeholder')}\n aria-invalid={fieldError ? true : undefined}\n />\n {fieldError && (\n <p className=\"text-xs text-status-error-text mt-0.5\">\n {t('business_rules.components.conditionRow.field.invalidPath')}\n </p>\n )}\n </div>\n\n {/* Operator Select */}\n <div>\n <label className=\"block text-xs font-medium text-foreground mb-1\">\n {t('business_rules.components.conditionRow.operator')}\n </label>\n <Select\n value={condition.operator || '='}\n onValueChange={(value) => handleOperatorChange({ target: { value } } as React.ChangeEvent<HTMLSelectElement>)}\n >\n <SelectTrigger size=\"sm\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {operators.map((op) => (\n <SelectItem key={op.value} value={op.value}>\n {op.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n {/* Value Input */}\n {operatorNeedsValue && (\n <div>\n <div className=\"flex items-center justify-between mb-1\">\n <label className=\"block text-xs font-medium text-foreground\">\n {useFieldComparison\n ? t('business_rules.components.conditionRow.compareToField')\n : t('business_rules.components.conditionRow.value')\n }\n </label>\n <button\n type=\"button\"\n onClick={toggleFieldComparison}\n className=\"text-xs text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300\"\n title={t('business_rules.components.conditionRow.toggleFieldComparison')}\n >\n {useFieldComparison\n ? t('business_rules.components.conditionRow.useValue')\n : t('business_rules.components.conditionRow.useField')\n }\n </button>\n </div>\n <Input\n type=\"text\"\n value={\n useFieldComparison\n ? (condition.valueField || '')\n : (condition.value === null || condition.value === undefined)\n ? ''\n : typeof condition.value === 'string'\n ? condition.value\n : JSON.stringify(condition.value)\n }\n onChange={useFieldComparison ? handleValueFieldChange : handleValueChange}\n placeholder={useFieldComparison\n ? t('business_rules.components.conditionRow.field.comparisonPlaceholder')\n : t('business_rules.components.conditionRow.value.placeholder')\n }\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {useFieldComparison\n ? t('business_rules.components.conditionRow.field.comparisonHelp')\n : t('business_rules.components.conditionRow.value.help')\n }\n </p>\n </div>\n )}\n </div>\n\n {/* Delete Button */}\n <IconButton\n type=\"button\"\n onClick={onDelete}\n variant=\"ghost\"\n size=\"xs\"\n className=\"hover:bg-destructive/10 hover:text-destructive\"\n title={t('business_rules.components.conditionRow.deleteCondition')}\n aria-label={t('business_rules.components.conditionRow.deleteCondition')}\n >\n <X className=\"w-4 h-4\" />\n </IconButton>\n\n {/* Error Display */}\n {error && (\n <div className=\"col-span-full mt-2\">\n <p className=\"text-xs text-status-error-text\">{error}</p>\n </div>\n )}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";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AS;AAAA,cACT,WAAU;AAAA,cACV,OAAO,EAAE,8DAA8D;AAAA,cAEtE,+BACG,EAAE,iDAAiD,IACnD,EAAE,iDAAiD;AAAA;AAAA,UAEzD;AAAA,WACF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,OACE,qBACK,UAAU,cAAc,KACxB,UAAU,UAAU,QAAQ,UAAU,UAAU,SAC/C,KACA,OAAO,UAAU,UAAU,WACzB,UAAU,QACV,KAAK,UAAU,UAAU,KAAK;AAAA,YAExC,UAAU,qBAAqB,yBAAyB;AAAA,YACxD,aAAa,qBACT,EAAE,oEAAoE,IACtE,EAAE,0DAA0D;AAAA;AAAA,QAElE;AAAA,QACA,oBAAC,OAAE,WAAU,wCACV,+BACG,EAAE,6DAA6D,IAC/D,EAAE,mDAAmD,GAE3D;AAAA,SACF;AAAA,OAEJ;AAAA,IAGA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS;AAAA,QACT,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,WAAU;AAAA,QACV,OAAO,EAAE,wDAAwD;AAAA,QACjE,cAAY,EAAE,wDAAwD;AAAA,QAEtE,8BAAC,KAAE,WAAU,WAAU;AAAA;AAAA,IACzB;AAAA,IAGC,SACC,oBAAC,SAAI,WAAU,sBACb,8BAAC,OAAE,WAAU,kCAAkC,iBAAM,GACvD;AAAA,KAEJ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2117,7 +2117,7 @@ function ProductMetaSection({
|
|
|
2117
2117
|
)
|
|
2118
2118
|
}
|
|
2119
2119
|
),
|
|
2120
|
-
errors.subtitle ? /* @__PURE__ */ jsx("p", { className: "text-xs text-
|
|
2120
|
+
errors.subtitle ? /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text", children: errors.subtitle }) : null
|
|
2121
2121
|
] }),
|
|
2122
2122
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2123
2123
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
@@ -2148,7 +2148,7 @@ function ProductMetaSection({
|
|
|
2148
2148
|
"catalog.products.create.handleHelp",
|
|
2149
2149
|
"Handle is used for URLs and must be unique."
|
|
2150
2150
|
) }),
|
|
2151
|
-
errors.handle ? /* @__PURE__ */ jsx("p", { className: "text-xs text-
|
|
2151
|
+
errors.handle ? /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text", children: errors.handle }) : null
|
|
2152
2152
|
] }),
|
|
2153
2153
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2154
2154
|
/* @__PURE__ */ jsx(Label, { children: t("catalog.products.form.sku", "SKU") }),
|
|
@@ -2168,7 +2168,7 @@ function ProductMetaSection({
|
|
|
2168
2168
|
"catalog.products.create.skuHelp",
|
|
2169
2169
|
"Unique product identifier. Letters, numbers, hyphens, underscores, periods."
|
|
2170
2170
|
) }),
|
|
2171
|
-
errors.sku ? /* @__PURE__ */ jsx("p", { className: "text-xs text-
|
|
2171
|
+
errors.sku ? /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text", children: errors.sku }) : null
|
|
2172
2172
|
] }),
|
|
2173
2173
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2174
2174
|
/* @__PURE__ */ jsx(Label, { children: t("catalog.products.form.productType", "Product type") }),
|
|
@@ -2198,7 +2198,7 @@ function ProductMetaSection({
|
|
|
2198
2198
|
]
|
|
2199
2199
|
}
|
|
2200
2200
|
),
|
|
2201
|
-
errors.productType ? /* @__PURE__ */ jsx("p", { className: "text-xs text-
|
|
2201
|
+
errors.productType ? /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text", children: errors.productType }) : null
|
|
2202
2202
|
] }),
|
|
2203
2203
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2204
2204
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|