@e-llm-studio/instant-learning 1.3.13 → 1.3.15-alpha.1
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/dist/ComponentRegistry.js +4 -0
- package/dist/ComponentRegistry.js.map +1 -1
- package/dist/ILMarketplaceWrapper.js +29 -4
- package/dist/ILMarketplaceWrapper.js.map +1 -1
- package/dist/cjs/ComponentRegistry.js +4 -0
- package/dist/cjs/ComponentRegistry.js.map +1 -1
- package/dist/cjs/ILMarketplaceWrapper.js +29 -4
- package/dist/cjs/ILMarketplaceWrapper.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/ILOTJ.js +5 -1
- package/dist/cjs/features/IL-OTJ/ILOTJ.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js +21 -7
- package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +16 -9
- package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +188 -30
- package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/_components/ChatComponents/ChatComponent.module.css.js +2 -2
- package/dist/cjs/features/IL-OTJ/_components/CriticalGaps.js +31 -15
- package/dist/cjs/features/IL-OTJ/_components/CriticalGaps.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js +3 -1
- package/dist/cjs/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/_components/MessageRendering/MessageRendering.js +31 -8
- package/dist/cjs/features/IL-OTJ/_components/MessageRendering/MessageRendering.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/_components/hooks/useVariantEditSession.js +21 -7
- package/dist/cjs/features/IL-OTJ/_components/hooks/useVariantEditSession.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/_components/templates/SchemaDriven/SchemaDrivenCreateRule.js +5 -3
- package/dist/cjs/features/IL-OTJ/_components/templates/SchemaDriven/SchemaDrivenCreateRule.js.map +1 -1
- package/dist/cjs/features/IL-OTJ/helpers/rhsFieldAttention.js +19 -0
- package/dist/cjs/features/IL-OTJ/helpers/rhsFieldAttention.js.map +1 -0
- package/dist/cjs/features/IL-OTJ/helpers/utils.js +45 -1
- package/dist/cjs/features/IL-OTJ/helpers/utils.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/PromoteFlow/EnvironmentConfigurationModal.js +26 -0
- package/dist/cjs/features/IL-marketplace/PromoteFlow/EnvironmentConfigurationModal.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/PromoteFlow/PromoteFlow.js +27 -2
- package/dist/cjs/features/IL-marketplace/PromoteFlow/PromoteFlow.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/PromoteFlow/promote-flow.api.js +6 -5
- package/dist/cjs/features/IL-marketplace/PromoteFlow/promote-flow.api.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/PromoteFlow/promote-flow.utils.js +5 -2
- package/dist/cjs/features/IL-marketplace/PromoteFlow/promote-flow.utils.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.js +1 -0
- package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.module.css.js +2 -2
- package/dist/cjs/features/IL-marketplace/components/LearningManagementWrapper.js +4 -1
- package/dist/cjs/features/IL-marketplace/components/LearningManagementWrapper.js.map +1 -1
- package/dist/cjs/features/IL-marketplace/services/IL-marketplace.api.js +6 -1
- package/dist/cjs/features/IL-marketplace/services/IL-marketplace.api.js.map +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/VariantCard.js +5 -1
- package/dist/cjs/features/LearningManagement/RuleContent/VariantCard.js.map +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +31 -7
- package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js.map +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js +47 -18
- package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js.map +1 -1
- package/dist/cjs/features/LearningManagement/store/useEnvStore.js +2 -0
- package/dist/cjs/features/LearningManagement/store/useEnvStore.js.map +1 -1
- package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js +2 -1
- package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +7 -1
- package/dist/cjs/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js.map +1 -1
- package/dist/cjs/schema-driven/BPARenderer.js +80 -12
- package/dist/cjs/schema-driven/BPARenderer.js.map +1 -1
- package/dist/cjs/schema-driven/components/FileUploadField.js +815 -0
- package/dist/cjs/schema-driven/components/FileUploadField.js.map +1 -0
- package/dist/cjs/schema-driven/components/FileUploadField.module.css.js +12 -0
- package/dist/cjs/schema-driven/components/FileUploadField.module.css.js.map +1 -0
- package/dist/cjs/schema-driven/components/GroupEditRow.js +3 -2
- package/dist/cjs/schema-driven/components/GroupEditRow.js.map +1 -1
- package/dist/cjs/schema-driven/components/PromptTextEditorField.js +71 -23
- package/dist/cjs/schema-driven/components/PromptTextEditorField.js.map +1 -1
- package/dist/cjs/schema-driven/components/VariantListField.js +135 -13
- package/dist/cjs/schema-driven/components/VariantListField.js.map +1 -1
- package/dist/cjs/schema-driven/hooks/useUnifiedEditSession.js +147 -0
- package/dist/cjs/schema-driven/hooks/useUnifiedEditSession.js.map +1 -0
- package/dist/cjs/schema-driven/primitives/Accordion.js +7 -4
- package/dist/cjs/schema-driven/primitives/Accordion.js.map +1 -1
- package/dist/cjs/schema-driven/types.js.map +1 -1
- package/dist/cjs/schema-driven/utils/PayloadUtils.js +2 -2
- package/dist/cjs/schema-driven/utils/PayloadUtils.js.map +1 -1
- package/dist/cjs/schema-driven/utils/fileUploadService.js +461 -0
- package/dist/cjs/schema-driven/utils/fileUploadService.js.map +1 -0
- package/dist/features/IL-OTJ/ILOTJ.js +5 -1
- package/dist/features/IL-OTJ/ILOTJ.js.map +1 -1
- package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js +21 -7
- package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js.map +1 -1
- package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +16 -9
- package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js.map +1 -1
- package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js +189 -31
- package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.js.map +1 -1
- package/dist/features/IL-OTJ/_components/ChatComponents/ChatComponent.module.css.js +2 -2
- package/dist/features/IL-OTJ/_components/CriticalGaps.js +31 -15
- package/dist/features/IL-OTJ/_components/CriticalGaps.js.map +1 -1
- package/dist/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js +3 -1
- package/dist/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js.map +1 -1
- package/dist/features/IL-OTJ/_components/MessageRendering/MessageRendering.js +31 -8
- package/dist/features/IL-OTJ/_components/MessageRendering/MessageRendering.js.map +1 -1
- package/dist/features/IL-OTJ/_components/hooks/useVariantEditSession.js +21 -8
- package/dist/features/IL-OTJ/_components/hooks/useVariantEditSession.js.map +1 -1
- package/dist/features/IL-OTJ/_components/templates/SchemaDriven/SchemaDrivenCreateRule.js +5 -3
- package/dist/features/IL-OTJ/_components/templates/SchemaDriven/SchemaDrivenCreateRule.js.map +1 -1
- package/dist/features/IL-OTJ/helpers/rhsFieldAttention.js +14 -0
- package/dist/features/IL-OTJ/helpers/rhsFieldAttention.js.map +1 -0
- package/dist/features/IL-OTJ/helpers/utils.js +45 -2
- package/dist/features/IL-OTJ/helpers/utils.js.map +1 -1
- package/dist/features/IL-marketplace/PromoteFlow/EnvironmentConfigurationModal.js +26 -0
- package/dist/features/IL-marketplace/PromoteFlow/EnvironmentConfigurationModal.js.map +1 -1
- package/dist/features/IL-marketplace/PromoteFlow/PromoteFlow.js +27 -2
- package/dist/features/IL-marketplace/PromoteFlow/PromoteFlow.js.map +1 -1
- package/dist/features/IL-marketplace/PromoteFlow/promote-flow.api.js +6 -5
- package/dist/features/IL-marketplace/PromoteFlow/promote-flow.api.js.map +1 -1
- package/dist/features/IL-marketplace/PromoteFlow/promote-flow.utils.js +5 -2
- package/dist/features/IL-marketplace/PromoteFlow/promote-flow.utils.js.map +1 -1
- package/dist/features/IL-marketplace/components/GuidelineLibraryCard.js +1 -0
- package/dist/features/IL-marketplace/components/GuidelineLibraryCard.js.map +1 -1
- package/dist/features/IL-marketplace/components/GuidelineLibraryCard.module.css.js +2 -2
- package/dist/features/IL-marketplace/components/LearningManagementWrapper.js +4 -1
- package/dist/features/IL-marketplace/components/LearningManagementWrapper.js.map +1 -1
- package/dist/features/IL-marketplace/services/IL-marketplace.api.js +6 -1
- package/dist/features/IL-marketplace/services/IL-marketplace.api.js.map +1 -1
- package/dist/features/LearningManagement/RuleContent/VariantCard.js +6 -2
- package/dist/features/LearningManagement/RuleContent/VariantCard.js.map +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModal.js +32 -8
- package/dist/features/LearningManagement/components/InstantLearningModal.js.map +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js +48 -19
- package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js.map +1 -1
- package/dist/features/LearningManagement/store/useEnvStore.js +2 -0
- package/dist/features/LearningManagement/store/useEnvStore.js.map +1 -1
- package/dist/features/LearningManagement/store/useLMSConfigStore.js +2 -1
- package/dist/features/LearningManagement/store/useLMSConfigStore.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +8 -2
- package/dist/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js.map +1 -1
- package/dist/schema-driven/BPARenderer.js +81 -13
- package/dist/schema-driven/BPARenderer.js.map +1 -1
- package/dist/schema-driven/components/FileUploadField.js +811 -0
- package/dist/schema-driven/components/FileUploadField.js.map +1 -0
- package/dist/schema-driven/components/FileUploadField.module.css.js +8 -0
- package/dist/schema-driven/components/FileUploadField.module.css.js.map +1 -0
- package/dist/schema-driven/components/GroupEditRow.js +3 -2
- package/dist/schema-driven/components/GroupEditRow.js.map +1 -1
- package/dist/schema-driven/components/PromptTextEditorField.js +71 -23
- package/dist/schema-driven/components/PromptTextEditorField.js.map +1 -1
- package/dist/schema-driven/components/VariantListField.js +136 -14
- package/dist/schema-driven/components/VariantListField.js.map +1 -1
- package/dist/schema-driven/hooks/useUnifiedEditSession.js +143 -0
- package/dist/schema-driven/hooks/useUnifiedEditSession.js.map +1 -0
- package/dist/schema-driven/primitives/Accordion.js +7 -4
- package/dist/schema-driven/primitives/Accordion.js.map +1 -1
- package/dist/schema-driven/types.js.map +1 -1
- package/dist/schema-driven/utils/PayloadUtils.js +2 -2
- package/dist/schema-driven/utils/PayloadUtils.js.map +1 -1
- package/dist/schema-driven/utils/fileUploadService.js +443 -0
- package/dist/schema-driven/utils/fileUploadService.js.map +1 -0
- package/dist/types/src/ComponentRegistry.d.ts.map +1 -1
- package/dist/types/src/ILMarketplaceMockTest.d.ts.map +1 -1
- package/dist/types/src/ILMarketplaceWrapper.d.ts +8 -1
- package/dist/types/src/ILMarketplaceWrapper.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/ILOTJ.d.ts +3 -0
- package/dist/types/src/features/IL-OTJ/ILOTJ.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ChatComponents/ChatComponent.d.ts +4 -0
- package/dist/types/src/features/IL-OTJ/_components/ChatComponents/ChatComponent.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/CriticalGaps.d.ts +2 -1
- package/dist/types/src/features/IL-OTJ/_components/CriticalGaps.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.d.ts +2 -1
- package/dist/types/src/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MessageRendering/MessageRendering.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/hooks/useVariantEditSession.d.ts +3 -3
- package/dist/types/src/features/IL-OTJ/_components/hooks/useVariantEditSession.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/SchemaDriven/SchemaDrivenCreateRule.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/helpers/rhsFieldAttention.d.ts +7 -0
- package/dist/types/src/features/IL-OTJ/helpers/rhsFieldAttention.d.ts.map +1 -0
- package/dist/types/src/features/IL-OTJ/helpers/utils.d.ts +12 -2
- package/dist/types/src/features/IL-OTJ/helpers/utils.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/PromoteFlow/EnvironmentConfigurationModal.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/PromoteFlow/PromoteFlow.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-flow.api.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-flow.interfaces.d.ts +4 -0
- package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-flow.interfaces.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/PromoteFlow/promote-flow.utils.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryCard.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/LearningManagementWrapper.d.ts +3 -1
- package/dist/types/src/features/IL-marketplace/components/LearningManagementWrapper.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/services/IL-marketplace.api.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/VariantCard.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/InstantLearningModal.d.ts +5 -0
- package/dist/types/src/features/LearningManagement/components/InstantLearningModal.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts +11 -0
- package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/store/useEnvStore.d.ts +2 -0
- package/dist/types/src/features/LearningManagement/store/useEnvStore.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts +3 -0
- package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts.map +1 -1
- package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRenderer.d.ts.map +1 -1
- package/dist/types/src/schema-driven/BPARenderer.d.ts +4 -0
- package/dist/types/src/schema-driven/BPARenderer.d.ts.map +1 -1
- package/dist/types/src/schema-driven/components/FileUploadField.d.ts +81 -0
- package/dist/types/src/schema-driven/components/FileUploadField.d.ts.map +1 -0
- package/dist/types/src/schema-driven/components/GroupEditRow.d.ts.map +1 -1
- package/dist/types/src/schema-driven/components/PromptTextEditorField.d.ts.map +1 -1
- package/dist/types/src/schema-driven/components/VariantListField.d.ts.map +1 -1
- package/dist/types/src/schema-driven/demoSchema.d.ts.map +1 -1
- package/dist/types/src/schema-driven/hooks/useUnifiedEditSession.d.ts +12 -0
- package/dist/types/src/schema-driven/hooks/useUnifiedEditSession.d.ts.map +1 -0
- package/dist/types/src/schema-driven/primitives/Accordion.d.ts.map +1 -1
- package/dist/types/src/schema-driven/types.d.ts +7 -0
- package/dist/types/src/schema-driven/types.d.ts.map +1 -1
- package/dist/types/src/schema-driven/utils/PayloadUtils.d.ts.map +1 -1
- package/dist/types/src/schema-driven/utils/fileUploadService.d.ts +196 -0
- package/dist/types/src/schema-driven/utils/fileUploadService.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptTextEditorField.js","sources":["../../../../src/schema-driven/components/PromptTextEditorField.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from 'react';\nimport { Check, X, Pencil } from 'lucide-react';\nimport PromptTextEditor from '../../features/LearningManagement/components/PromptTextEditor';\nimport { Textarea } from '../../features/IL-OTJ/_components/atoms/Textarea/Textarea';\nimport { useLearningTemplateStore } from '../../features/LearningManagement/store/useLearningTemplateStore';\nimport { useParentEditEnabled } from '../hooks/useParentEditEnabled';\n\n// Instruction-prompt editor: read-only until its pencil is pressed, then edits\n// the value directly (no local draft copy); Apply just ends the edit session\n// and notifies the chat (the AI reflects the change), Cancel reverts to the\n// value captured when editing started.\ntype PromptViewMode = 'prompt' | 'text';\n\nconst VIEW_TABS: Array<{ key: PromptViewMode; label: string }> = [\n { key: 'text', label: 'Text' },\n { key: 'prompt', label: 'Prompt' },\n];\n\nexport default function PromptTextEditorField(props: any) {\n // Snapshot of props.value taken when editing starts — used only to detect\n // \"changed since edit began\" for the Apply-disabled state, Cancel's revert,\n // and the chat notification. No draft copy of the value itself is kept:\n // every keystroke writes straight through props.onChange (direct state),\n // so the value the outer form's Save reads is never stale.\n const editStartValueRef = useRef<string>('');\n // Presentation-only switch — both views read/write the exact same value.\n const [viewMode, setViewMode] = useState<PromptViewMode>('text');\n const backwardCompatibility = useLearningTemplateStore((state) => state.backwardCompatibility);\n const id = props.id || 'prompt-editor';\n // New UI: the parent variant owns one edit session, so this field drops its own\n // pencil/apply chrome and writes straight into the parent's draft.\n // A parent edit session says so explicitly via `hideEditControls`. When nobody\n // passes it (legacy CreateRule mounts this straight from the registry, with no\n // schema node and so no `parent_edit`), fall back to the new-UI flag.\n const parentEditEnabled = useParentEditEnabled(props.schema);\n const externallyControlled = props.hideEditControls !== undefined\n ? !!props.hideEditControls\n : parentEditEnabled;\n const isEditing = externallyControlled ? !!props.parentEditing : props.uiState?.activeEditId === id;\n const isOtherFieldEditing = !!props.uiState?.activeEditId && props.uiState.activeEditId !== id;\n const editorContainerRef = useRef<HTMLDivElement>(null);\n \n // Prevent auto-focus on mount and focus changes\n useEffect(() => {\n if (!isEditing && editorContainerRef.current) {\n const container = editorContainerRef.current;\n \n // Blur any currently focused element inside the container\n const focusedElement = container.querySelector(':focus') as HTMLElement | null;\n if (focusedElement) {\n focusedElement.blur();\n }\n \n // Add a focus event listener to prevent focus from staying on disabled editor\n const handleFocus = (e: FocusEvent) => {\n if (!isEditing) {\n e.preventDefault();\n const target = e.target as HTMLElement;\n target.blur();\n }\n };\n \n // Use capture phase to intercept focus before it propagates\n container.addEventListener('focus', handleFocus, { capture: true });\n \n return () => {\n container.removeEventListener('focus', handleFocus, { capture: true });\n };\n }\n }, [isEditing]);\n \n // Make the editor inert when not editing to prevent all interaction and focus\n useEffect(() => {\n if (editorContainerRef.current) {\n if (!isEditing) {\n // Set inert to prevent all interactions\n (editorContainerRef.current as any).inert = true;\n // Disable all focusable elements and remove them from tab order\n const focusableElements = editorContainerRef.current.querySelectorAll('input, textarea, button, a, [tabindex], [contenteditable]');\n focusableElements.forEach((element) => {\n element.setAttribute('tabindex', '-1');\n element.setAttribute('aria-hidden', 'true');\n (element as any).disabled = true;\n });\n } else {\n // Restore interactivity when editing\n (editorContainerRef.current as any).inert = false;\n const focusableElements = editorContainerRef.current.querySelectorAll('[aria-hidden=\"true\"]');\n focusableElements.forEach((element) => {\n element.removeAttribute('aria-hidden');\n const tag = element.tagName.toLowerCase();\n if (tag === 'button' || tag === 'input' || tag === 'textarea' || tag === 'a') {\n element.removeAttribute('tabindex');\n (element as any).disabled = false;\n }\n });\n }\n }\n }, [isEditing]);\n\n const handleStartEdit = () => {\n if (isOtherFieldEditing) return;\n editStartValueRef.current = props.value || '';\n props.uiState?.setActiveEditId?.(id);\n };\n\n const handleCancel = () => {\n // Revert to what it was when editing started — the only place a\n // \"discarded\" value ever existed is this ref snapshot, not a live draft.\n if ((props.value || '') !== editStartValueRef.current) {\n props.onChange(editStartValueRef.current);\n }\n props.uiState?.setActiveEditId?.(null);\n };\n\n const handleSave = () => {\n if ((props.value || '') !== editStartValueRef.current && props.uiState?.setSendMessageInChat) {\n const skId = `sk-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;\n props.uiState.setSendMessageInChat(`__SKELETON__:${skId}:The ${props.title} has been updated through the Learning Form`);\n }\n props.uiState?.setActiveEditId?.(null);\n };\n\n const isApplyBtnDisabled = (props.value || '').trim() === editStartValueRef.current.trim();\n const actionBtnStyle = { display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '8px', border: '1px solid var(--il-border, #e5e7eb)', borderRadius: '8px', cursor: 'pointer', width: '36px', height: '36px', backgroundColor: 'var(--il-surface, #ffffff)' };\n const isHighlighted = props.uiState?.highlights?.get(`${props.tierKey}_${props.variantIndex}`)?.instruction_prompt || false;\n const accentHex = backwardCompatibility ? 'var(--il-primary, #2563EB)' : 'var(--il-primary, #2563EB)';\n const accentRgb = backwardCompatibility ? '37, 99, 235' : '89, 37, 220';\n\n // Single source of truth for both views — the tab strip only changes how this\n // value is rendered, never which value or which handler is in play. No draft\n // copy: both externally-controlled and pencil-gated editing write straight\n // through props.onChange, so an outer Save always reads the live value.\n const currentValue = props.value || '';\n // Invalid or omitted limits preserve the existing unlimited behavior.\n const maxLength = typeof props.maxLength === 'number'\n && Number.isFinite(props.maxLength)\n && props.maxLength >= 0\n ? Math.floor(props.maxLength)\n : undefined;\n const handleValueChange = (v: string) => props.onChange(\n maxLength === undefined ? v : v.slice(0, maxLength),\n );\n const hasReachedMaxLength = maxLength !== undefined && currentValue.length >= maxLength;\n\n return (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '4px', width: '100%', maxWidth: '100%', boxSizing: 'border-box', minWidth: 0, marginBottom: '12px' }} data-edit-id={id}>\n <div style={{ display: 'flex', alignItems: 'center', width: '100%', justifyContent: 'space-between' }}>\n <span style={{ fontSize: '14px', fontWeight: 500, color: 'var(--il-foreground, #19213D)', fontFamily: '\"Plus Jakarta Sans\", sans-serif' }}>{props.required && <span style={{ color: 'var(--il-danger, #8F2C23)' }}>*</span>} {props.title}</span>\n {props.enableViewToggle && (\n <div style={{ display: 'flex', alignItems: 'center', gap: '2px', padding: '2px', backgroundColor: 'var(--il-secondary-bg, #f1f5f9)', border: '1px solid var(--il-border, #E2E8F0)', borderRadius: '6px' }}>\n {VIEW_TABS.map(({ key, label }) => {\n const isActive = viewMode === key;\n return (\n <button\n key={key}\n type=\"button\"\n onClick={() => setViewMode(key)}\n style={{\n padding: '3px 8px',\n borderRadius: '4px',\n border: 'none',\n cursor: 'pointer',\n fontSize: '11px',\n fontWeight: 500,\n fontFamily: 'Inter, sans-serif',\n backgroundColor: isActive ? 'var(--il-surface, #ffffff)' : 'transparent',\n color: isActive ? accentHex : 'var(--il-muted, #64748B)',\n boxShadow: isActive ? '0px 1px 2px rgba(18, 18, 23, 0.05)' : 'none',\n }}\n >\n {label}\n </button>\n );\n })}\n </div>\n )}\n </div>\n {/* {props.description && (\n <div style={{ fontFamily: 'Inter', fontWeight: 400, fontSize: '12px', lineHeight: '130%', color: 'var(--il-muted, #64748B)', marginBottom: '4px' }}>\n {props.description}\n </div>\n )} */}\n {/* This field builds its own header rather than going through SectionWrapper, so\n the schema `subtitle` has to be rendered explicitly here. Falls back to\n `description` to preserve what existing configs already display. */}\n {(props.subtitle || props.description) && (\n <div style={{ fontFamily: 'Inter', fontWeight: 400, fontSize: '12px', lineHeight: '130%', color: 'var(--il-muted, #64748B)', marginBottom: '4px' }}>\n {props.subtitle || props.description}\n </div>\n )}\n <div style={{ display: 'flex', alignItems: 'flex-start', gap: '8px', width: '100%', maxWidth: '100%', minWidth: 0, boxSizing: 'border-box' }}>\n {/* minWidth:0 + maxWidth:100% keep the editor inside the RHS panel — without them\n its toolbar sets the flex item's base width and pushes the whole form into a\n horizontal scroll. overflow:hidden clips to the panel; the toolbar scrolls itself. */}\n <div \n ref={editorContainerRef}\n style={{ \n flex: '1 1 0%', \n minWidth: 0, maxWidth: '100%', overflow: 'hidden', boxSizing: 'border-box', \n border: isHighlighted ? `1px solid ${accentHex}` : 'none', \n borderRadius: '8px', \n boxShadow: isHighlighted ? `0 0 12px 3px rgba(${accentRgb}, 0.3)` : 'none', \n transition: 'all 0.3s',\n scrollBehavior: isEditing ? 'auto' : 'unset'\n }}\n aria-disabled={!isEditing}\n >\n <div style={{ pointerEvents: isEditing ? 'auto' : 'none', opacity: isEditing ? 1 : 0.75, maxWidth: '100%', minWidth: 0, overflow: 'hidden' }}>\n {props.enableViewToggle && viewMode === 'text' ? (\n // Same atom the Rule Description field renders through, so Text View\n // looks and behaves like any other text section.\n <Textarea\n rows={6}\n placeholder={props.placeholder || 'Enter the instruction prompt..'}\n value={currentValue}\n maxLength={maxLength}\n onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => handleValueChange(e.target.value)}\n isReadOnly={props.readOnly || props.isAiStreaming}\n inputReadOnly={!isEditing}\n isHighlighted={isHighlighted}\n errorMessage={props.errorMessage}\n />\n ) : (\n <PromptTextEditor\n {...props}\n value={currentValue}\n onChange={handleValueChange}\n maxLength={maxLength}\n minHeight=\"220px\"\n maxHeight=\"400px\"\n readOnly={props.readOnly || props.isAiStreaming || !isEditing}\n />\n )}\n </div>\n </div>\n {!props.readOnly && !externallyControlled && (\n <div style={{ display: 'flex', gap: '8px' }}>\n {isEditing ? (\n <>\n <button onClick={handleSave} disabled={isApplyBtnDisabled} style={{ ...actionBtnStyle, backgroundColor: 'var(--il-primary, #2563eb)', color: 'var(--il-primary-fg, white)', width: 'auto' }}><Check size={20} strokeWidth={2.5} /> Apply</button>\n <button onClick={handleCancel} style={{ ...actionBtnStyle, color: 'var(--il-danger, #dc2626)' }}><X size={20} strokeWidth={2.5} /></button>\n </>\n ) : (\n <button onClick={handleStartEdit} disabled={props.isAiStreaming || isOtherFieldEditing} style={{ ...actionBtnStyle, color: 'var(--il-muted, #64748B)' }}><Pencil size={20} /></button>\n )}\n </div>\n )}\n </div>\n {props.enableViewToggle && viewMode === 'text' && maxLength !== undefined && (\n <div\n role={hasReachedMaxLength ? 'status' : undefined}\n aria-live={hasReachedMaxLength ? 'polite' : undefined}\n style={{\n alignSelf: 'flex-end',\n color: hasReachedMaxLength ? 'var(--il-danger, #dc2626)' : 'var(--il-muted, #64748B)',\n fontFamily: 'Inter, sans-serif',\n fontSize: '12px',\n fontWeight: hasReachedMaxLength ? 600 : 400,\n marginTop: '2px',\n }}\n >\n {currentValue.length} / {maxLength} characters\n {hasReachedMaxLength\n ? ' — Maximum character limit reached'\n : ` — ${maxLength - currentValue.length} characters remaining`}\n </div>\n )}\n </div>\n );\n}\n"],"names":["useRef","useState","useLearningTemplateStore","useParentEditEnabled","useEffect","_a","_b","_c","jsxs","jsx","Textarea","PromptTextEditor","Fragment","Check","X","Pencil"],"mappings":";;;;;;;;;;;;AAaA,MAAM,SAA2D,GAAA;AAAA,EAC/D,EAAE,GAAA,EAAK,MAAQ,EAAA,KAAA,EAAO,MAAO,EAAA;AAAA,EAC7B,EAAE,GAAA,EAAK,QAAU,EAAA,KAAA,EAAO,QAAS,EAAA;AACnC,CAAA,CAAA;AAEA,SAAwB,sBAAsB,KAAY,EAAA;AAlB1D,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAwBE,EAAM,MAAA,iBAAA,GAAoBA,aAAe,EAAE,CAAA,CAAA;AAE3C,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAIC,eAAyB,MAAM,CAAA,CAAA;AAC/D,EAAA,MAAM,qBAAwB,GAAAC,iDAAA,CAAyB,CAAC,KAAA,KAAU,MAAM,qBAAqB,CAAA,CAAA;AAC7F,EAAM,MAAA,EAAA,GAAK,MAAM,EAAM,IAAA,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C,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAM,sBAAsB,QAAW,GAAA,KAAA,CAAA;AAAA,QACvC,WAAA,EAAW,sBAAsB,QAAW,GAAA,KAAA,CAAA;AAAA,QAC5C,KAAO,EAAA;AAAA,UACL,SAAW,EAAA,UAAA;AAAA,UACX,KAAA,EAAO,sBAAsB,2BAA8B,GAAA,0BAAA;AAAA,UAC3D,UAAY,EAAA,mBAAA;AAAA,UACZ,QAAU,EAAA,MAAA;AAAA,UACV,UAAA,EAAY,sBAAsB,GAAM,GAAA,GAAA;AAAA,UACxC,SAAW,EAAA,KAAA;AAAA,SACb;AAAA,QAEC,QAAA,EAAA;AAAA,UAAa,YAAA,CAAA,MAAA;AAAA,UAAO,KAAA;AAAA,UAAI,SAAA;AAAA,UAAU,aAAA;AAAA,UAClC,mBACG,GAAA,yCAAA,GACA,CAAM,QAAA,EAAA,SAAA,GAAY,aAAa,MAAM,CAAA,qBAAA,CAAA;AAAA,SAAA;AAAA,OAAA;AAAA,KAC3C;AAAA,GAEJ,EAAA,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"PromptTextEditorField.js","sources":["../../../../src/schema-driven/components/PromptTextEditorField.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from 'react';\nimport { Check, X, Pencil } from 'lucide-react';\nimport PromptTextEditor from '../../features/LearningManagement/components/PromptTextEditor';\nimport { Textarea } from '../../features/IL-OTJ/_components/atoms/Textarea/Textarea';\nimport { useLearningTemplateStore } from '../../features/LearningManagement/store/useLearningTemplateStore';\nimport { useParentEditEnabled } from '../hooks/useParentEditEnabled';\nimport { MF_EVENTS } from '../../features/LearningManagement/constants';\nimport useEnvStore from '../../features/LearningManagement/store/useEnvStore';\n\n// Instruction-prompt editor: read-only until its pencil is pressed, then edits\n// the value directly (no local draft copy); Apply just ends the edit session\n// and notifies the chat (the AI reflects the change), Cancel reverts to the\n// value captured when editing started.\ntype PromptViewMode = 'prompt' | 'text';\n\nconst VIEW_TABS: Array<{ key: PromptViewMode; label: string }> = [\n { key: 'text', label: 'Text' },\n { key: 'prompt', label: 'Prompt' },\n];\n\nexport default function PromptTextEditorField(props: any) {\n // Snapshot of props.value taken when editing starts — used only to detect\n // \"changed since edit began\" for the Apply-disabled state, Cancel's revert,\n // and the chat notification. No draft copy of the value itself is kept:\n // every keystroke writes straight through props.onChange (direct state),\n // so the value the outer form's Save reads is never stale.\n const editStartValueRef = useRef<string>('');\n // Presentation-only switch — both views read/write the exact same value.\n const [viewMode, setViewMode] = useState<PromptViewMode>('text');\n const backwardCompatibility = useLearningTemplateStore((state) => state.backwardCompatibility);\n const id = props.id || 'prompt-editor';\n // New UI: the parent variant owns one edit session, so this field drops its own\n // pencil/apply chrome and writes straight into the parent's draft.\n // A parent edit session says so explicitly via `hideEditControls`. When nobody\n // passes it (legacy CreateRule mounts this straight from the registry, with no\n // schema node and so no `parent_edit`), fall back to the new-UI flag.\n const parentEditEnabled = useParentEditEnabled(props.schema);\n const externallyControlled = props.hideEditControls !== undefined\n ? !!props.hideEditControls\n : parentEditEnabled;\n const isEditing = externallyControlled ? !!props.parentEditing : props.uiState?.activeEditId === id;\n const isOtherFieldEditing = !!props.uiState?.activeEditId && props.uiState.activeEditId !== id;\n const editorContainerRef = useRef<HTMLDivElement>(null);\n \n // Prevent auto-focus on mount and focus changes\n useEffect(() => {\n if (!isEditing && editorContainerRef.current) {\n const container = editorContainerRef.current;\n \n // Blur any currently focused element inside the container\n const focusedElement = container.querySelector(':focus') as HTMLElement | null;\n if (focusedElement) {\n focusedElement.blur();\n }\n \n // Add a focus event listener to prevent focus from staying on disabled editor\n const handleFocus = (e: FocusEvent) => {\n if (!isEditing) {\n e.preventDefault();\n const target = e.target as HTMLElement;\n target.blur();\n }\n };\n \n // Use capture phase to intercept focus before it propagates\n container.addEventListener('focus', handleFocus, { capture: true });\n \n return () => {\n container.removeEventListener('focus', handleFocus, { capture: true });\n };\n }\n }, [isEditing]);\n \n // Make the editor inert when not editing to prevent all interaction and focus\n useEffect(() => {\n if (editorContainerRef.current) {\n if (!isEditing) {\n // Set inert to prevent all interactions\n (editorContainerRef.current as any).inert = true;\n // Disable all focusable elements and remove them from tab order\n const focusableElements = editorContainerRef.current.querySelectorAll('input, textarea, button, a, [tabindex], [contenteditable]');\n focusableElements.forEach((element) => {\n element.setAttribute('tabindex', '-1');\n element.setAttribute('aria-hidden', 'true');\n (element as any).disabled = true;\n });\n } else {\n // Restore interactivity when editing\n (editorContainerRef.current as any).inert = false;\n const focusableElements = editorContainerRef.current.querySelectorAll('[aria-hidden=\"true\"]');\n focusableElements.forEach((element) => {\n element.removeAttribute('aria-hidden');\n const tag = element.tagName.toLowerCase();\n if (tag === 'button' || tag === 'input' || tag === 'textarea' || tag === 'a') {\n element.removeAttribute('tabindex');\n (element as any).disabled = false;\n }\n });\n }\n }\n }, [isEditing]);\n\n const handleStartEdit = () => {\n if (isOtherFieldEditing) return;\n editStartValueRef.current = props.value || '';\n props.uiState?.setActiveEditId?.(id);\n };\n\n const handleCancel = () => {\n // Revert to what it was when editing started — the only place a\n // \"discarded\" value ever existed is this ref snapshot, not a live draft.\n if ((props.value || '') !== editStartValueRef.current) {\n props.onChange(editStartValueRef.current);\n }\n props.uiState?.setActiveEditId?.(null);\n };\n\n const handleSave = () => {\n if ((props.value || '') !== editStartValueRef.current && props.uiState?.setSendMessageInChat) {\n const skId = `sk-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;\n props.uiState.setSendMessageInChat(`__SKELETON__:${skId}:The ${props.title} has been updated through the Learning Form`);\n }\n props.uiState?.setActiveEditId?.(null);\n };\n\n // Handler for the \"Edit with eCG Pro\" button. Builds the Prompt Mode submode\n // request (same shape as ContinueWithTemplateModal's Configure Now payload) and\n // dispatches MF_EVENTS.TRIGGER_SUBMODE through the host mfApi. It does not change\n // the local view. promptSection is null because PromptTextEditor exposes no\n // section identity (its props are value/onChange/sizing/styling only).\n // const externalWorkflowMetaData = useExternalWorkflowStore((state) => state.externalWorkflowMetaData);\n const handleEditWithEcgPro = () => {\n const baseModeName = useEnvStore.getState().baseModeName;\n console.log('hi handleEditWithEcgPro')\n // if (props.readOnly || props.isAiStreaming) return;\n // Prefer the mfApi passed as a prop (threaded from TeachMePlugin); fall back to the\n // external workflow store, which TeachMePlugin also populates.\n // const mfApi = props.mfApi ;\n const mfApi = window.hostMicroFrontendApi;\n if (!mfApi || typeof mfApi.dispatch !== 'function') {\n console.error('PromptTextEditorField: mfApi is not available; cannot open Prompt Mode.');\n return;\n }\n console.log(props,'props in trigger moee',baseModeName)\n const payload = {\n modeType: 'submode',\n eventType: 'modeToTrigger',\n showWelcomeMessageOnTargetModeLoad:false,\n previousMode: {\n modeName: props.currentModeName ??baseModeName?? 'Instant Learning Mode',\n additionalData: {},\n navigateToECGPro:true\n },\n modeToTrigger: {\n modeName: 'eCG Pro',\n query: '',\n responseOfThisMode: null,\n additionalData: {\n prompt: props.value || '',\n promptSection: null,\n focusStep: props.currentStep ?? null,\n ...(props.modeState ?? {}),\n },\n },\n nextMode: {\n modeName: props.currentModeName ??baseModeName?? 'Instant Learning Mode',\n queryForNextMode: 'i want to use the updated prompt',\n additionalData: {\n type: '',\n prompt: '',\n },\n },\n };\n console.log(payload,'payload')\n mfApi.dispatch(MF_EVENTS.TRIGGER_SUBMODE, payload);\n };\n\n const isApplyBtnDisabled = (props.value || '').trim() === editStartValueRef.current.trim();\n const actionBtnStyle = { display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '8px', border: '1px solid var(--il-border, #e5e7eb)', borderRadius: '8px', cursor: 'pointer', width: '36px', height: '36px', backgroundColor: 'var(--il-surface, #ffffff)' };\n const isHighlighted = props.uiState?.highlights?.get(`${props.tierKey}_${props.variantIndex}`)?.instruction_prompt || false;\n const accentHex = backwardCompatibility ? 'var(--il-primary, #2563EB)' : 'var(--il-primary, #2563EB)';\n const accentRgb = backwardCompatibility ? '37, 99, 235' : '89, 37, 220';\n\n // Single source of truth for both views — the tab strip only changes how this\n // value is rendered, never which value or which handler is in play. No draft\n // copy: both externally-controlled and pencil-gated editing write straight\n // through props.onChange, so an outer Save always reads the live value.\n const currentValue = props.value || '';\n // Invalid or omitted limits preserve the existing unlimited behavior.\n const maxLength = typeof props.maxLength === 'number'\n && Number.isFinite(props.maxLength)\n && props.maxLength >= 0\n ? Math.floor(props.maxLength)\n : undefined;\n const handleValueChange = (v: string) => props.onChange(\n maxLength === undefined ? v : v.slice(0, maxLength),\n );\n const hasReachedMaxLength = maxLength !== undefined && currentValue.length >= maxLength;\nconsole.log(\"PromptTextEditorField\",props.readOnly, props.isAiStreaming, isOtherFieldEditing)\n return (\n <div style={{ display: 'flex', flexDirection: 'column', gap: '4px', width: '100%', maxWidth: '100%', boxSizing: 'border-box', minWidth: 0, marginBottom: '12px' }} data-edit-id={id}>\n <div style={{ display: 'flex', alignItems: 'center', width: '100%', justifyContent: 'space-between' }}>\n <span style={{ fontSize: '14px', fontWeight: 500, color: 'var(--il-foreground, #19213D)', fontFamily: '\"Plus Jakarta Sans\", sans-serif' }}>{props.required && <span style={{ color: 'var(--il-danger, #8F2C23)' }}>*</span>} {props.title}</span>\n {props.enableViewToggle && (\n <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '2px', padding: '2px', backgroundColor: 'var(--il-secondary-bg, #f1f5f9)', border: '1px solid var(--il-border, #E2E8F0)', borderRadius: '6px' }}>\n {VIEW_TABS.map(({ key, label }) => {\n const isActive = viewMode === key;\n return (\n <button\n key={key}\n type=\"button\"\n onClick={() => setViewMode(key)}\n style={{\n padding: '3px 8px',\n borderRadius: '4px',\n border: 'none',\n cursor: 'pointer',\n fontSize: '11px',\n fontWeight: 500,\n fontFamily: 'Inter, sans-serif',\n backgroundColor: isActive ? 'var(--il-surface, #ffffff)' : 'transparent',\n color: isActive ? accentHex : 'var(--il-muted, #64748B)',\n boxShadow: isActive ? '0px 1px 2px rgba(18, 18, 23, 0.05)' : 'none',\n }}\n >\n {label}\n </button>\n );\n })}\n </div>\n <button type=\"button\" onClick={handleEditWithEcgPro} style={{ padding: '3px 8px', borderRadius: '4px', border: '1px solid var(--il-border, #E2E8F0)', cursor: 'pointer', fontSize: '11px', fontWeight: 500, fontFamily: 'Inter, sans-serif', backgroundColor: 'var(--il-surface, #ffffff)', color: accentHex }}>Edit with eCG Pro</button>\n </div>\n )}\n </div>\n {/* {props.description && (\n <div style={{ fontFamily: 'Inter', fontWeight: 400, fontSize: '12px', lineHeight: '130%', color: 'var(--il-muted, #64748B)', marginBottom: '4px' }}>\n {props.description}\n </div>\n )} */}\n {/* This field builds its own header rather than going through SectionWrapper, so\n the schema `subtitle` has to be rendered explicitly here. Falls back to\n `description` to preserve what existing configs already display. */}\n {(props.subtitle || props.description) && (\n <div style={{ fontFamily: 'Inter', fontWeight: 400, fontSize: '12px', lineHeight: '130%', color: 'var(--il-muted, #64748B)', marginBottom: '4px' }}>\n {props.subtitle || props.description}\n </div>\n )}\n <div style={{ display: 'flex', alignItems: 'flex-start', gap: '8px', width: '100%', maxWidth: '100%', minWidth: 0, boxSizing: 'border-box' }}>\n {/* minWidth:0 + maxWidth:100% keep the editor inside the RHS panel — without them\n its toolbar sets the flex item's base width and pushes the whole form into a\n horizontal scroll. overflow:hidden clips to the panel; the toolbar scrolls itself. */}\n <div \n ref={editorContainerRef}\n style={{ \n flex: '1 1 0%', \n minWidth: 0, maxWidth: '100%', overflow: 'hidden', boxSizing: 'border-box', \n border: isHighlighted ? `1px solid ${accentHex}` : 'none', \n borderRadius: '8px', \n boxShadow: isHighlighted ? `0 0 12px 3px rgba(${accentRgb}, 0.3)` : 'none', \n transition: 'all 0.3s',\n scrollBehavior: isEditing ? 'auto' : 'unset'\n }}\n aria-disabled={!isEditing}\n >\n <div style={{ pointerEvents: isEditing ? 'auto' : 'none', opacity: isEditing ? 1 : 0.75, maxWidth: '100%', minWidth: 0, overflow: 'hidden' }}>\n {props.enableViewToggle && viewMode === 'text' ? (\n // Same atom the Rule Description field renders through, so Text View\n // looks and behaves like any other text section.\n <Textarea\n rows={6}\n placeholder={props.placeholder || 'Enter the instruction prompt..'}\n value={currentValue}\n maxLength={maxLength}\n onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => handleValueChange(e.target.value)}\n isReadOnly={props.readOnly || props.isAiStreaming}\n inputReadOnly={!isEditing}\n isHighlighted={isHighlighted}\n errorMessage={props.errorMessage}\n />\n ) : \n (\n <PromptTextEditor\n {...props}\n value={currentValue}\n onChange={handleValueChange}\n maxLength={maxLength}\n minHeight=\"220px\"\n maxHeight=\"400px\"\n readOnly={props.readOnly || props.isAiStreaming || !isEditing}\n />\n )}\n </div>\n </div>\n {!props.readOnly && !externallyControlled && (\n <div style={{ display: 'flex', gap: '8px' }}>\n {isEditing ? (\n <>\n <button onClick={handleSave} disabled={isApplyBtnDisabled} style={{ ...actionBtnStyle, backgroundColor: 'var(--il-primary, #2563eb)', color: 'var(--il-primary-fg, white)', width: 'auto' }}><Check size={20} strokeWidth={2.5} /> Apply</button>\n <button onClick={handleCancel} style={{ ...actionBtnStyle, color: 'var(--il-danger, #dc2626)' }}><X size={20} strokeWidth={2.5} /></button>\n </>\n ) : (\n <button onClick={handleStartEdit} disabled={props.isAiStreaming || isOtherFieldEditing} style={{ ...actionBtnStyle, color: 'var(--il-muted, #64748B)' }}><Pencil size={20} /></button>\n )}\n </div>\n )}\n </div>\n {props.enableViewToggle && viewMode === 'text' && maxLength !== undefined && (\n <div\n role={hasReachedMaxLength ? 'status' : undefined}\n aria-live={hasReachedMaxLength ? 'polite' : undefined}\n style={{\n alignSelf: 'flex-end',\n color: hasReachedMaxLength ? 'var(--il-danger, #dc2626)' : 'var(--il-muted, #64748B)',\n fontFamily: 'Inter, sans-serif',\n fontSize: '12px',\n fontWeight: hasReachedMaxLength ? 600 : 400,\n marginTop: '2px',\n }}\n >\n {currentValue.length} / {maxLength} characters\n {hasReachedMaxLength\n ? ' — Maximum character limit reached'\n : ` — ${maxLength - currentValue.length} characters remaining`}\n </div>\n )}\n </div>\n );\n}\n"],"names":["useRef","useState","useLearningTemplateStore","useParentEditEnabled","useEffect","_a","_b","_c","_d","_e","useEnvStore","MF_EVENTS","jsxs","jsx","Textarea","PromptTextEditor","Fragment","Check","X","Pencil"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,SAA2D,GAAA;AAAA,EAC/D,EAAE,GAAA,EAAK,MAAQ,EAAA,KAAA,EAAO,MAAO,EAAA;AAAA,EAC7B,EAAE,GAAA,EAAK,QAAU,EAAA,KAAA,EAAO,QAAS,EAAA;AACnC,CAAA,CAAA;AAEA,SAAwB,sBAAsB,KAAY,EAAA;AApB1D,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AA0BE,EAAM,MAAA,iBAAA,GAAoBA,aAAe,EAAE,CAAA,CAAA;AAE3C,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAIC,eAAyB,MAAM,CAAA,CAAA;AAC/D,EAAA,MAAM,qBAAwB,GAAAC,iDAAA,CAAyB,CAAC,KAAA,KAAU,MAAM,qBAAqB,CAAA,CAAA;AAC7F,EAAM,MAAA,EAAA,GAAK,MAAM,EAAM,IAAA,eAAA,CAAA;AAMvB,EAAM,MAAA,iBAAA,GAAoBC,yCAAqB,CAAA,KAAA,CAAM,MAAM,CAAA,CAAA;AAC3D,EAAA,MAAM,uBAAuB,KAAM,CAAA,gBAAA,KAAqB,SACpD,CAAC,CAAC,MAAM,gBACR,GAAA,iBAAA,CAAA;AACJ,EAAM,MAAA,SAAA,GAAY,uBAAuB,CAAC,CAAC,MAAM,aAAgB,GAAA,CAAA,CAAA,EAAA,GAAA,KAAA,CAAM,OAAN,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAe,YAAiB,MAAA,EAAA,CAAA;AACjG,EAAM,MAAA,mBAAA,GAAsB,CAAC,EAAC,CAAA,EAAA,GAAA,KAAA,CAAM,YAAN,IAAe,G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AAA,UAAI,SAAA;AAAA,UAAU,aAAA;AAAA,UAClC,mBACG,GAAA,yCAAA,GACA,CAAM,QAAA,EAAA,SAAA,GAAY,aAAa,MAAM,CAAA,qBAAA,CAAA;AAAA,SAAA;AAAA,OAAA;AAAA,KAC3C;AAAA,GAEJ,EAAA,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -20,7 +20,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
20
20
|
|
|
21
21
|
function VariantListField(props) {
|
|
22
22
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
23
|
-
const parentEdit = useParentEditEnabled.useParentEditEnabled(props.schema);
|
|
23
|
+
const parentEdit = useParentEditEnabled.useParentEditEnabled(props.schema) && !props.unifiedEditSession;
|
|
24
24
|
const tier = props.tierKey || "tier_1";
|
|
25
25
|
const showVariantPill = ((_a = props.schema) == null ? void 0 : _a.show_variant_pill) !== false;
|
|
26
26
|
const variants = ((_c = (_b = props.state) == null ? void 0 : _b.variantsByTier) == null ? void 0 : _c[tier]) || [{}];
|
|
@@ -48,13 +48,21 @@ function VariantListField(props) {
|
|
|
48
48
|
const [promptCleanKey] = byComponent("PromptTextEditor");
|
|
49
49
|
const [wtaCleanKey, wntaCleanKey] = byComponent("ConditionSection");
|
|
50
50
|
const buildVariantDraft = (variantIndex) => {
|
|
51
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
51
52
|
const { getVariantField } = useDynamicFormStore.useDynamicFormStore.getState();
|
|
53
|
+
const item = variants[variantIndex] || {};
|
|
52
54
|
const read = (key) => key ? getVariantField(tier, variantIndex, key) : void 0;
|
|
55
|
+
const descValue = (_c2 = (_b2 = (_a2 = read(descCleanKey)) != null ? _a2 : item.ruleDescription) != null ? _b2 : item.description) != null ? _c2 : "";
|
|
56
|
+
const promptValue = (_e2 = (_d2 = read(promptCleanKey)) != null ? _d2 : item.instructionPrompt) != null ? _e2 : "";
|
|
57
|
+
const wtaRaw = read(wtaCleanKey);
|
|
58
|
+
const wtaConditions = wtaRaw !== void 0 && wtaRaw !== "" ? conditionText.splitConditions(wtaRaw, "wta") : Array.isArray(item.whenToApplyConditions) && item.whenToApplyConditions.length > 0 ? item.whenToApplyConditions : conditionText.splitConditions(item.whenToApply || "", "wta");
|
|
59
|
+
const wntaRaw = read(wntaCleanKey);
|
|
60
|
+
const wntaConditions = wntaRaw !== void 0 && wntaRaw !== "" ? conditionText.splitConditions(wntaRaw, "wnta") : Array.isArray(item.whenNotToApplyConditions) && item.whenNotToApplyConditions.length > 0 ? item.whenNotToApplyConditions : conditionText.splitConditions(item.whenNotToApply || "", "wnta");
|
|
53
61
|
return {
|
|
54
|
-
ruleDescription:
|
|
55
|
-
instructionPrompt:
|
|
56
|
-
whenToApplyConditions:
|
|
57
|
-
whenNotToApplyConditions:
|
|
62
|
+
ruleDescription: typeof descValue === "string" ? descValue : "",
|
|
63
|
+
instructionPrompt: typeof promptValue === "string" ? promptValue : "",
|
|
64
|
+
whenToApplyConditions: wtaConditions,
|
|
65
|
+
whenNotToApplyConditions: wntaConditions
|
|
58
66
|
};
|
|
59
67
|
};
|
|
60
68
|
const commitVariantEdit = (committed, session) => {
|
|
@@ -92,6 +100,86 @@ function VariantListField(props) {
|
|
|
92
100
|
addDraftCondition,
|
|
93
101
|
handleSaveVariantEdit
|
|
94
102
|
} = useVariantEditSession.useVariantEditSession(props.uiState, buildVariantDraft, commitVariantEdit);
|
|
103
|
+
const [extraDrafts, setExtraDrafts] = React.useState({});
|
|
104
|
+
const initialExtraDraftsRef = React.useRef({});
|
|
105
|
+
const startVariantEdit = (vIndex, tierKey, index, variantType) => {
|
|
106
|
+
const { getVariantField } = useDynamicFormStore.useDynamicFormStore.getState();
|
|
107
|
+
const initialExtra = {};
|
|
108
|
+
Object.entries(variantProperties).forEach(([key, node]) => {
|
|
109
|
+
const cleanKey = String((node == null ? void 0 : node.data_key) || key).replace("global.", "");
|
|
110
|
+
if (cleanKey !== descCleanKey && cleanKey !== promptCleanKey && cleanKey !== wtaCleanKey && cleanKey !== wntaCleanKey) {
|
|
111
|
+
const val = getVariantField(tierKey, vIndex, cleanKey);
|
|
112
|
+
initialExtra[cleanKey] = val !== void 0 ? JSON.parse(JSON.stringify(val)) : (node == null ? void 0 : node.type) === "array" ? [] : "";
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
initialExtraDraftsRef.current = initialExtra;
|
|
116
|
+
setExtraDrafts(initialExtra);
|
|
117
|
+
handleStartVariantEdit(vIndex, tierKey, index, variantType);
|
|
118
|
+
};
|
|
119
|
+
const cancelVariantEdit = () => {
|
|
120
|
+
if (variantEdit) {
|
|
121
|
+
const { setVariantField } = useDynamicFormStore.useDynamicFormStore.getState();
|
|
122
|
+
Object.entries(initialExtraDraftsRef.current).forEach(([key, val]) => {
|
|
123
|
+
setVariantField(variantEdit.tierKey, variantEdit.variantIndex, key, val);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
initialExtraDraftsRef.current = {};
|
|
127
|
+
setExtraDrafts({});
|
|
128
|
+
handleCancelVariantEdit();
|
|
129
|
+
};
|
|
130
|
+
const saveVariantEdit = (extraChanged) => {
|
|
131
|
+
const extraChanges = [];
|
|
132
|
+
Object.entries(extraDrafts).forEach(([key, currentVal]) => {
|
|
133
|
+
const initialVal = initialExtraDraftsRef.current[key];
|
|
134
|
+
if (JSON.stringify(currentVal) === JSON.stringify(initialVal)) return;
|
|
135
|
+
const node = variantProperties[key] || Object.values(variantProperties).find(
|
|
136
|
+
(n) => String((n == null ? void 0 : n.data_key) || "").replace("global.", "") === key
|
|
137
|
+
);
|
|
138
|
+
const label = (node == null ? void 0 : node.title) || key;
|
|
139
|
+
if (Array.isArray(currentVal) || Array.isArray(initialVal)) {
|
|
140
|
+
const origList = Array.isArray(initialVal) ? initialVal : [];
|
|
141
|
+
const currList = Array.isArray(currentVal) ? currentVal : [];
|
|
142
|
+
const getFileName = (item) => {
|
|
143
|
+
if (item && typeof item === "object" && item.status === "error") return "";
|
|
144
|
+
return ((item == null ? void 0 : item.name) || (item == null ? void 0 : item.filename) || (typeof item === "string" ? item.split("/").pop() : "") || "").trim();
|
|
145
|
+
};
|
|
146
|
+
const origNames = origList.map(getFileName).filter(Boolean);
|
|
147
|
+
const currNames = currList.map(getFileName).filter(Boolean);
|
|
148
|
+
const added = currNames.filter((name) => !origNames.includes(name));
|
|
149
|
+
const removed = origNames.filter((name) => !currNames.includes(name));
|
|
150
|
+
if (removed.length > 0) {
|
|
151
|
+
extraChanges.push({
|
|
152
|
+
action: "remove",
|
|
153
|
+
label,
|
|
154
|
+
value: useVariantEditSession.quoteList(removed)
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
if (added.length > 0) {
|
|
158
|
+
extraChanges.push({
|
|
159
|
+
action: "update",
|
|
160
|
+
label,
|
|
161
|
+
value: useVariantEditSession.quoteList(added)
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
extraChanges.push({
|
|
166
|
+
action: "update",
|
|
167
|
+
label,
|
|
168
|
+
previous: initialVal ? useVariantEditSession.quoteList([String(initialVal)]) : void 0,
|
|
169
|
+
value: useVariantEditSession.quoteList([String(currentVal)])
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
if (variantEdit) {
|
|
174
|
+
const { setVariantField } = useDynamicFormStore.useDynamicFormStore.getState();
|
|
175
|
+
Object.entries(extraDrafts).forEach(([key, val]) => {
|
|
176
|
+
setVariantField(variantEdit.tierKey, variantEdit.variantIndex, key, val);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
initialExtraDraftsRef.current = {};
|
|
180
|
+
setExtraDrafts({});
|
|
181
|
+
handleSaveVariantEdit(extraChanges.length > 0 ? extraChanges : extraChanged != null ? extraChanged : false);
|
|
182
|
+
};
|
|
95
183
|
const editButtonRefs = React.useRef({});
|
|
96
184
|
const [glowingVariantId, setGlowingVariantId] = React.useState(null);
|
|
97
185
|
const glowTimer = React.useRef(null);
|
|
@@ -106,13 +194,17 @@ function VariantListField(props) {
|
|
|
106
194
|
if (glowTimer.current) clearTimeout(glowTimer.current);
|
|
107
195
|
glowTimer.current = setTimeout(() => setGlowingVariantId(null), 1800);
|
|
108
196
|
}, []);
|
|
109
|
-
const buildReadOnlyOverrides = (readOnly) => {
|
|
197
|
+
const buildReadOnlyOverrides = (readOnly, editing) => {
|
|
110
198
|
var _a2;
|
|
111
199
|
const overrides = {};
|
|
112
200
|
const collectOverrides = (properties = {}) => {
|
|
113
201
|
Object.entries(properties).forEach(([key, rawNode]) => {
|
|
114
202
|
const cleanKey = ((rawNode == null ? void 0 : rawNode.data_key) || key).replace("global.", "");
|
|
115
|
-
overrides[cleanKey] = {
|
|
203
|
+
overrides[cleanKey] = {
|
|
204
|
+
readOnly,
|
|
205
|
+
parentEditing: editing,
|
|
206
|
+
hideEditControls: parentEdit
|
|
207
|
+
};
|
|
116
208
|
if (rawNode == null ? void 0 : rawNode.properties) collectOverrides(rawNode.properties);
|
|
117
209
|
});
|
|
118
210
|
};
|
|
@@ -127,7 +219,7 @@ function VariantListField(props) {
|
|
|
127
219
|
if ((_a2 = props.handlers) == null ? void 0 : _a2.addNewVariant) props.handlers.addNewVariant(tier);
|
|
128
220
|
},
|
|
129
221
|
isDisabled: (_h = props.uiState) == null ? void 0 : _h.isAiStreaming,
|
|
130
|
-
showAddVariantBtn: !parentEdit && ((_i = props.uiState) == null ? void 0 : _i.usedFor) !== "Edit",
|
|
222
|
+
showAddVariantBtn: !parentEdit && !props.unifiedEditSession && ((_i = props.uiState) == null ? void 0 : _i.usedFor) !== "Edit",
|
|
131
223
|
showConnectorLines: !parentEdit,
|
|
132
224
|
children: [
|
|
133
225
|
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `@keyframes ilVariantEditGlow {
|
|
@@ -150,8 +242,21 @@ function VariantListField(props) {
|
|
|
150
242
|
const isVariantEditDisabled = isEffectivelyReadOnly || isThisVariantPending;
|
|
151
243
|
const variantValues = ((_c2 = variantStore == null ? void 0 : variantStore[tier]) == null ? void 0 : _c2[vIndex]) || {};
|
|
152
244
|
const isVariantEmpty = ![descCleanKey, promptCleanKey, wtaCleanKey, wntaCleanKey].some((key) => key && useVariantEditSession.hasMeaningfulText(variantValues[key]));
|
|
153
|
-
const
|
|
154
|
-
const
|
|
245
|
+
const hasCoreChanges = !!(isThisVariantEditing && variantEdit && draft && (draft.ruleDescription.trim() !== variantEdit.original.ruleDescription.trim() || draft.instructionPrompt.trim() !== variantEdit.original.instructionPrompt.trim() || useVariantEditSession.conditionsToText(draft.whenToApplyConditions) !== useVariantEditSession.conditionsToText(variantEdit.original.whenToApplyConditions) || useVariantEditSession.conditionsToText(draft.whenNotToApplyConditions) !== useVariantEditSession.conditionsToText(variantEdit.original.whenNotToApplyConditions)));
|
|
246
|
+
const hasExtraChanges = isThisVariantEditing && Object.keys(extraDrafts).some((key) => {
|
|
247
|
+
const currentVal = extraDrafts[key];
|
|
248
|
+
const initialVal = initialExtraDraftsRef.current[key];
|
|
249
|
+
return JSON.stringify(currentVal) !== JSON.stringify(initialVal);
|
|
250
|
+
});
|
|
251
|
+
const isFileUploading = isThisVariantEditing && Object.values(extraDrafts).some(
|
|
252
|
+
(val) => Array.isArray(val) && val.some((f) => (f == null ? void 0 : f.status) === "uploading")
|
|
253
|
+
);
|
|
254
|
+
const hasChanges = hasCoreChanges || hasExtraChanges;
|
|
255
|
+
const isVariantSaveDisabled = !draft || !hasChanges || isFileUploading || hasCoreChanges && (!useVariantEditSession.hasMeaningfulText(draft.ruleDescription) || !draft.whenToApplyConditions.some((c) => useVariantEditSession.hasMeaningfulText(c.text)));
|
|
256
|
+
const isVariantReadOnly = isEffectivelyReadOnly || wrapperLocked || parentEdit && !isThisVariantEditing;
|
|
257
|
+
const overrides = {
|
|
258
|
+
...buildReadOnlyOverrides(isVariantReadOnly, isThisVariantEditing)
|
|
259
|
+
};
|
|
155
260
|
if (parentEdit) {
|
|
156
261
|
const put = (key, patch) => {
|
|
157
262
|
if (!key) return;
|
|
@@ -201,6 +306,23 @@ function VariantListField(props) {
|
|
|
201
306
|
onEdit: (_t, _i2, id, text) => editDraftCondition("whenNotToApplyConditions", id, text)
|
|
202
307
|
} : {}
|
|
203
308
|
});
|
|
309
|
+
if (isThisVariantEditing) {
|
|
310
|
+
const { getVariantField } = useDynamicFormStore.useDynamicFormStore.getState();
|
|
311
|
+
Object.entries(variantProperties).forEach(([key, node]) => {
|
|
312
|
+
const cleanKey = String((node == null ? void 0 : node.data_key) || key).replace("global.", "");
|
|
313
|
+
if (cleanKey !== descCleanKey && cleanKey !== promptCleanKey && cleanKey !== wtaCleanKey && cleanKey !== wntaCleanKey) {
|
|
314
|
+
put(cleanKey, {
|
|
315
|
+
value: extraDrafts[cleanKey] !== void 0 ? extraDrafts[cleanKey] : getVariantField(tier, vIndex, cleanKey) || [],
|
|
316
|
+
onChange: (newVal) => {
|
|
317
|
+
setExtraDrafts((prev) => ({
|
|
318
|
+
...prev,
|
|
319
|
+
[cleanKey]: newVal
|
|
320
|
+
}));
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
204
326
|
}
|
|
205
327
|
const isGlowing = glowingVariantId === variantEditId;
|
|
206
328
|
const renderVariantHeaderActions = (isOpen, onToggle) => {
|
|
@@ -217,7 +339,7 @@ function VariantListField(props) {
|
|
|
217
339
|
title: isVariantEditDisabled ? "Editing unavailable" : isVariantEmpty ? "Add" : "Edit",
|
|
218
340
|
onClick: (e) => {
|
|
219
341
|
e.stopPropagation();
|
|
220
|
-
|
|
342
|
+
startVariantEdit(vIndex, tier, vIndex, variantType);
|
|
221
343
|
if (!isOpen) onToggle();
|
|
222
344
|
},
|
|
223
345
|
disabled: isVariantEditDisabled,
|
|
@@ -279,7 +401,7 @@ function VariantListField(props) {
|
|
|
279
401
|
{
|
|
280
402
|
onClick: (e) => {
|
|
281
403
|
e.stopPropagation();
|
|
282
|
-
|
|
404
|
+
saveVariantEdit(hasExtraChanges);
|
|
283
405
|
},
|
|
284
406
|
disabled: isVariantSaveDisabled || isThisVariantPending,
|
|
285
407
|
style: {
|
|
@@ -304,7 +426,7 @@ function VariantListField(props) {
|
|
|
304
426
|
{
|
|
305
427
|
onClick: (e) => {
|
|
306
428
|
e.stopPropagation();
|
|
307
|
-
|
|
429
|
+
cancelVariantEdit();
|
|
308
430
|
},
|
|
309
431
|
style: {
|
|
310
432
|
display: "flex",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariantListField.js","sources":["../../../../src/schema-driven/components/VariantListField.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState, useCallback } from 'react';\nimport { AlertTriangle } from 'lucide-react';\nimport { VariantListWrapper } from '../../features/IL-OTJ/_components/templates/TrafficManager/CreateRule';\nimport AccordionSection from '../../features/IL-OTJ/_components/AccordianSection';\nimport { EditPencilIcon } from '../../features/IL-OTJ/_components/_svg/EditPencilIcon';\nimport { useVariantEditSession, hasMeaningfulText, VariantDraft } from '../../features/IL-OTJ/_components/hooks/useVariantEditSession';\nimport { useDynamicFormStore } from '../store/useDynamicFormStore';\nimport { splitConditions } from '../utils/conditionText';\nimport { useParentEditEnabled } from '../hooks/useParentEditEnabled';\nimport { isNodeLocked, isWrapperEditLocked } from '../utils/editLock';\n\n// Renders one accordion per variant for the active tier and injects each variant's\n// schema children (description/prompt/WTA/WNTA/Config) via renderChildren(variantIndex).\n//\n// `parent_edit: true` on the wrapper node opts the section into the single\n// edit-session-per-variant UX (mirroring CreateRule.tsx): one Edit button in the\n// variant header opens a local draft covering Rule Description, Instruction Prompt,\n// When-to-Apply and When-NOT-to-Apply, and Save sends ONE combined chat message.\n// Without the flag the section keeps the per-field inline edits: every field stays\n// live-bound to the store and owns its own pencil/Apply.\nexport default function VariantListField(props: any) {\n // Dynamic form → schema flag; legacy mount → new UI (backwardCompatibility false).\n const parentEdit = useParentEditEnabled(props.schema);\n const tier = props.tierKey || 'tier_1';\n // Config decides whether each variant header carries its \"Variant N\" pill.\n const showVariantPill = props.schema?.show_variant_pill !== false;\n const variants = props.state?.variantsByTier?.[tier] || [{}];\n\n // Resolve which store key each of the four session fields lives under by the schema's\n // `bpa_ui_component` + `ui_position`, NOT by property name: property keys are\n // config-authored and vary per template (`rule_description` vs `ruleDescription`,\n // `wta` vs `whenToApply`), while the component type is what actually defines the role.\n const variantProperties = props.schema?.properties || {};\n\n // `read_only_in_edit_flow`: in the edit flow the wrapper (or every editable field\n // in it) can be frozen — then the variant header shows no Edit button at all, and\n // the whole subtree renders read-only. A partially frozen variant still gets its\n // Edit button; the frozen fields simply stay locked inside the open session and\n // say so (BPARenderer renders the lock notice + tooltip).\n const wrapperLocked = isNodeLocked(props.schema, props.uiState);\n const variantEditLocked = isWrapperEditLocked(props.schema, props.uiState);\n /** cleanKey → true for every field frozen in the current flow. */\n const lockedCleanKeys = React.useMemo(() => {\n const set = new Set<string>();\n const walk = (properties: Record<string, any> = {}, inherited = false) => {\n Object.entries(properties).forEach(([key, node]: any) => {\n const locked = inherited || wrapperLocked || isNodeLocked(node, props.uiState);\n if (locked) set.add(String(node?.data_key || key).replace('global.', ''));\n if (node?.properties) walk(node.properties, locked);\n });\n };\n walk(variantProperties);\n return set;\n }, [variantProperties, wrapperLocked, props.uiState?.usedFor]);\n const isLockedKey = (key?: string) => !!key && lockedCleanKeys.has(key);\n const byComponent = (component: string) =>\n Object.entries(variantProperties)\n .filter(([, node]: any) => node?.bpa_ui_component === component && !node?.hidden)\n .sort(([, a]: any, [, b]: any) => (a?.ui_position ?? 0) - (b?.ui_position ?? 0))\n .map(([key, node]: any) => String(node?.data_key || key).replace('global.', ''));\n\n const [descCleanKey] = byComponent('TextInput');\n const [promptCleanKey] = byComponent('PromptTextEditor');\n // First ConditionSection by ui_position is \"when to apply\", second is \"when NOT to apply\".\n const [wtaCleanKey, wntaCleanKey] = byComponent('ConditionSection');\n\n // `item` here is just the variant index — the draft is built straight from the\n // canonical dynamic-form store, not from `props.state.variantsByTier` (which is a\n // read-display mirror and may not reflect the same value). Only ever called when\n // the user opens an edit session, so the non-reactive getState() read is safe.\n const buildVariantDraft = (variantIndex: number): VariantDraft => {\n const { getVariantField } = useDynamicFormStore.getState();\n const read = (key?: string) => (key ? getVariantField(tier, variantIndex, key) : undefined);\n return {\n ruleDescription: read(descCleanKey) || '',\n instructionPrompt: read(promptCleanKey) || '',\n whenToApplyConditions: splitConditions(read(wtaCleanKey) || '', 'wta'),\n whenNotToApplyConditions: splitConditions(read(wntaCleanKey) || '', 'wnta'),\n };\n };\n\n // The instruction prompt is user-owned and committed straight to the store on\n // Save (no AI round-trip): the user sees exactly what they typed the moment the\n // session closes. Description/WTA/WNTA are AI-owned — they're mirrored instead,\n // so they stay visible without looking committed until the AI actually writes\n // them back (mirrors the \"Instruction Setup\" title's mirage behaviour).\n const commitVariantEdit = (\n committed: {\n instructionPrompt?: string;\n ruleDescription?: string;\n whenToApplyText?: string;\n whenNotToApplyText?: string;\n },\n session: { variantIndex: number; tierKey: string },\n ) => {\n const { setVariantField, setVariantMirage } = useDynamicFormStore.getState();\n if (committed.instructionPrompt !== undefined && promptCleanKey) {\n setVariantField(session.tierKey, session.variantIndex, promptCleanKey, committed.instructionPrompt);\n }\n if (committed.ruleDescription !== undefined && descCleanKey) {\n setVariantMirage(session.tierKey, session.variantIndex, descCleanKey, committed.ruleDescription);\n }\n if (committed.whenToApplyText !== undefined && wtaCleanKey) {\n setVariantMirage(session.tierKey, session.variantIndex, wtaCleanKey, committed.whenToApplyText);\n }\n if (committed.whenNotToApplyText !== undefined && wntaCleanKey) {\n setVariantMirage(session.tierKey, session.variantIndex, wntaCleanKey, committed.whenNotToApplyText);\n }\n };\n\n // Reactive read (the getState() reads elsewhere are one-shot) so the Add/Edit\n // label flips as soon as the AI or the user fills the variant in.\n const variantStore = useDynamicFormStore((s) => s.variantData);\n\n // Mirages exist only to keep the user's draft visible while the AI's turn is in\n // flight — once that turn ends, drop them (see useSectionEditSession, which does\n // the same for the \"Instruction Setup\" title). If the AI actually wrote the\n // fields back, the real store value wins from here on; if it didn't, the field\n // falls back to its real (unset) value instead of looking permanently saved.\n const prevVariantStreaming = useRef(props.uiState?.isAiStreaming);\n useEffect(() => {\n if (prevVariantStreaming.current && !props.uiState?.isAiStreaming) {\n useDynamicFormStore.getState().clearAllMirages();\n }\n prevVariantStreaming.current = props.uiState?.isAiStreaming;\n }, [props.uiState?.isAiStreaming]);\n\n const {\n variantEdit,\n pendingVariantId,\n handleStartVariantEdit,\n handleCancelVariantEdit,\n patchVariantDraft,\n editDraftCondition,\n removeDraftCondition,\n addDraftCondition,\n handleSaveVariantEdit,\n } = useVariantEditSession(props.uiState, buildVariantDraft, commitVariantEdit);\n\n // Discoverability nudge: clicking anywhere inside a variant's body while no edit\n // session is open pulses the header's Add/Edit button (the only way in) and scrolls\n // it into view, instead of leaving the click silently inert.\n const editButtonRefs = useRef<Record<string, HTMLButtonElement | null>>({});\n const [glowingVariantId, setGlowingVariantId] = useState<string | null>(null);\n const glowTimer = useRef<any>(null);\n\n useEffect(() => () => { if (glowTimer.current) clearTimeout(glowTimer.current); }, []);\n\n const nudgeEditButton = useCallback((editId: string) => {\n const btn = editButtonRefs.current[editId];\n if (!btn || btn.disabled) return;\n btn.scrollIntoView({ behavior: 'smooth', block: 'center' });\n setGlowingVariantId(editId);\n if (glowTimer.current) clearTimeout(glowTimer.current);\n glowTimer.current = setTimeout(() => setGlowingVariantId(null), 1800);\n }, []);\n\n const buildReadOnlyOverrides = (readOnly: boolean) => {\n const overrides: Record<string, any> = {};\n const collectOverrides = (properties: Record<string, any> = {}) => {\n Object.entries(properties).forEach(([key, rawNode]: any) => {\n const cleanKey = (rawNode?.data_key || key).replace('global.', '');\n overrides[cleanKey] = { readOnly };\n if (rawNode?.properties) collectOverrides(rawNode.properties);\n });\n };\n collectOverrides(props.schema?.properties);\n return overrides;\n };\n\n return (\n <VariantListWrapper\n onAddVariant={() => { if (props.handlers?.addNewVariant) props.handlers.addNewVariant(tier); }}\n isDisabled={props.uiState?.isAiStreaming}\n // Under parent_edit the outer rule-list \"Add Variant\" button (RuleAccordionShell)\n // owns this action instead — matches CreateRule.tsx's new-UI behaviour.\n showAddVariantBtn={!parentEdit && props.uiState?.usedFor !== 'Edit'}\n // Under parent_edit each variant is already its own bordered card, so the\n // connector stick between them is redundant chrome — hide it here only.\n showConnectorLines={!parentEdit}\n >\n <style>{`@keyframes ilVariantEditGlow {\n 0%, 100% { box-shadow: 0 0 0 0 rgba(127, 86, 217, 0); }\n 50% { box-shadow: 0 0 0 4px rgba(127, 86, 217, 0.25), 0 0 10px 2px rgba(127, 86, 217, 0.35); }\n }`}</style>\n {variants.map((item: any, vIndex: number) => {\n const variantType = item.variantType || 'default';\n const isDefault = variantType === 'default' || variantType === 'default_variant';\n const uniqueId = `${tier}-variant-${vIndex}`;\n const isDraftVariant = item.is_variant === true;\n // Once the user picks a variant, that choice wins; until then the drafted\n // (new) variant is open by default and loaded variants stay collapsed.\n const activeIndex = props.uiState?.activeVariantAccordionIndex;\n const isExpanded = activeIndex !== undefined ? activeIndex === vIndex : isDraftVariant;\n const isEffectivelyReadOnly = item.isReadOnly || props.uiState?.isAiStreaming;\n\n const variantEditId = `variant-${tier}-${vIndex}`;\n const isThisVariantEditing = parentEdit && variantEdit?.id === variantEditId;\n const isThisVariantPending = pendingVariantId === variantEditId;\n const draft = isThisVariantEditing ? variantEdit!.draft : null;\n const isVariantEditDisabled = isEffectivelyReadOnly || isThisVariantPending;\n\n // Nothing filled in yet → the header offers \"Add\" rather than \"Edit\".\n const variantValues = variantStore?.[tier]?.[vIndex] || {};\n const isVariantEmpty = ![descCleanKey, promptCleanKey, wtaCleanKey, wntaCleanKey]\n .some((key) => key && hasMeaningfulText(variantValues[key]));\n\n const isVariantSaveDisabled = !draft\n || !hasMeaningfulText(draft.ruleDescription)\n || !draft.whenToApplyConditions.some((c) => hasMeaningfulText(c.text));\n\n // Only the variant in an open edit session gets draft-bound value/conditions.\n // Everywhere else the fields keep reading the store themselves (BPAFieldWrapper\n // subscribes to it), so AI write-backs stay live — we only add the props that\n // suppress the old per-field pencil/Apply chrome.\n const overrides: Record<string, any> = { ...buildReadOnlyOverrides(isEffectivelyReadOnly || wrapperLocked) };\n\n if (parentEdit) {\n const put = (key: string | undefined, patch: any) => {\n if (!key) return;\n // Frozen field: keep it store-bound and read-only, never draft-bound.\n if (isLockedKey(key)) {\n overrides[key] = {\n ...(overrides[key] || {}),\n readOnly: true,\n enableInlineEdit: false,\n hideEditControls: true,\n parentEditing: isThisVariantEditing,\n };\n return;\n }\n overrides[key] = { ...(overrides[key] || {}), ...patch };\n };\n\n put(descCleanKey, {\n readOnly: isEffectivelyReadOnly || !isThisVariantEditing,\n enableInlineEdit: false, // no per-field pencil — the variant header owns editing\n ...(draft ? { value: draft.ruleDescription, onChange: (v: string) => patchVariantDraft({ ruleDescription: v }) } : {}),\n });\n\n put(promptCleanKey, {\n readOnly: isEffectivelyReadOnly || !isThisVariantEditing,\n hideEditControls: true,\n parentEditing: isThisVariantEditing,\n ...(draft ? { value: draft.instructionPrompt, onChange: (v: string) => patchVariantDraft({ instructionPrompt: v }) } : {}),\n });\n\n put(wtaCleanKey, {\n readOnly: isEffectivelyReadOnly,\n hideEditControls: true,\n parentEditing: isThisVariantEditing,\n ...(draft ? {\n conditions: draft.whenToApplyConditions,\n onAdd: () => addDraftCondition('whenToApplyConditions'),\n onRemove: (_t: string, _i: number, id: any) => removeDraftCondition('whenToApplyConditions', id),\n onEdit: (_t: string, _i: number, id: any, text: string) => editDraftCondition('whenToApplyConditions', id, text),\n } : {}),\n });\n\n put(wntaCleanKey, {\n readOnly: isEffectivelyReadOnly,\n hideEditControls: true,\n parentEditing: isThisVariantEditing,\n ...(draft ? {\n conditions: draft.whenNotToApplyConditions,\n onAdd: () => addDraftCondition('whenNotToApplyConditions'),\n onRemove: (_t: string, _i: number, id: any) => removeDraftCondition('whenNotToApplyConditions', id),\n onEdit: (_t: string, _i: number, id: any, text: string) => editDraftCondition('whenNotToApplyConditions', id, text),\n } : {}),\n });\n }\n\n const isGlowing = glowingVariantId === variantEditId;\n\n const renderVariantHeaderActions = (isOpen: boolean, onToggle: () => void) => {\n if (!parentEdit) return null;\n // Wrapper frozen, or nothing left in it that can still be edited.\n if (variantEditLocked) return null;\n if (isEffectivelyReadOnly && !isThisVariantEditing && !isThisVariantPending) return null;\n\n // Save/Cancel live at the bottom-left of the variant body (users read and edit\n // top-to-bottom, then look down-left to commit) — not in the header.\n if (isThisVariantEditing || isThisVariantPending) return null;\n\n return (\n <button\n ref={(el) => { editButtonRefs.current[variantEditId] = el; }}\n title={isVariantEditDisabled ? 'Editing unavailable' : (isVariantEmpty ? 'Add' : 'Edit')}\n onClick={(e) => {\n e.stopPropagation();\n handleStartVariantEdit(vIndex, tier, vIndex, variantType);\n if (!isOpen) onToggle();\n }}\n disabled={isVariantEditDisabled}\n style={{\n display: 'flex', alignItems: 'center', justifyContent: 'center',\n padding: '6px 8px', borderRadius: '6px',\n border: `1px solid ${isGlowing ? 'var(--il-primary, #7F56D9)' : 'var(--il-border, #E2E8F0)'}`,\n backgroundColor: isGlowing ? 'var(--il-primary-subtle, #f5f3ff)' : 'var(--il-surface, #ffffff)',\n color: isGlowing ? 'var(--il-primary, #2563EB)' : 'var(--il-muted, #64748B)', fontSize: '13px', fontWeight: 500,\n cursor: isVariantEditDisabled ? 'not-allowed' : 'pointer',\n opacity: isVariantEditDisabled ? 0.5 : 1,\n gap: '6px',\n transition: 'border-color 150ms ease, background-color 150ms ease, color 150ms ease',\n animation: isGlowing ? 'ilVariantEditGlow 900ms ease-in-out 2' : undefined,\n }}\n >\n <EditPencilIcon size={12} /> Edit\n {/* {isVariantEmpty ? 'Add' : 'Edit'} */}\n </button>\n );\n };\n\n return (\n <div key={uniqueId} style={{ width: '100%' }} data-edit-id={parentEdit ? variantEditId : undefined}>\n <AccordionSection\n title={{ type: isDefault ? 'default' : 'variant', label: variantType, number: vIndex + 1, isNewVariant: isDraftVariant, isDefault: item.isDefault, isModified: item.isModified }}\n expanded={isExpanded}\n onToggle={() => props.uiState?.setActiveVariantAccordionIndex?.(isExpanded ? null : vIndex)}\n variant=\"rule-behavior\"\n showTitlePill={showVariantPill}\n footerData={{ ruleTitle: variantType, description: item.ruleDescription || '' }}\n readOnly={isEffectivelyReadOnly}\n actionButtons={parentEdit ? renderVariantHeaderActions : undefined}\n isAiStreaming={props.uiState?.isAiStreaming}\n // Keep the header mounted while streaming so the Save button can show\n // \"Validating...\" — the render fn already returns null for variants that\n // aren't the one being validated.\n alwaysShowActions={parentEdit}\n >\n <div\n style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}\n onClickCapture={(e) => {\n if (!parentEdit || variantEditLocked || isThisVariantEditing || isThisVariantPending || isVariantEditDisabled) return;\n\n // Cognitive icon / reasoning toggles must just expand — no nudge, no scroll.\n const target = e.target as HTMLElement;\n if (target.closest('[data-no-edit-nudge], button, a, [role=\"button\"]')) return;\n\n nudgeEditButton(variantEditId);\n }}\n >\n {/* Pass the resolved tier so nested fields hit variantData[tier][vIndex]. */}\n {props.renderChildren ? props.renderChildren(vIndex, overrides, tier) : null}\n\n {/* Bottom-left Save/Cancel for the open edit session. */}\n {parentEdit && (isThisVariantEditing || isThisVariantPending) && (\n <div style={{ display: 'flex', alignItems: 'center', gap: '6px', justifyContent: 'flex-start' }}>\n <button\n onClick={(e) => { e.stopPropagation(); handleSaveVariantEdit(); }}\n disabled={isVariantSaveDisabled || isThisVariantPending}\n style={{\n display: 'flex', alignItems: 'center', gap: '6px',\n padding: '6px 10.5px', borderRadius: '6px',\n border: '1px solid var(--il-primary, #D9D6FE)', backgroundColor: isThisVariantPending ? 'var(--il-primary-subtle, #f5f3ff)' : 'var(--il-surface, #ffffff)',\n color: 'var(--il-primary, #2563EB)', fontSize: '13px', fontWeight: 500,\n cursor: (isVariantSaveDisabled || isThisVariantPending) ? 'not-allowed' : 'pointer',\n opacity: isVariantSaveDisabled ? 0.5 : 1,\n }}\n >\n {isThisVariantPending ? 'Validating...' : 'Save'}\n </button>\n {!isThisVariantPending && (\n <button\n onClick={(e) => { e.stopPropagation(); handleCancelVariantEdit(); }}\n style={{\n display: 'flex', alignItems: 'center', gap: '6px',\n padding: '6px 10.5px', borderRadius: '6px',\n border: '1px solid var(--il-primary, #D9D6FE)', backgroundColor: 'var(--il-surface, #ffffff)',\n color: 'var(--il-primary, #2563EB)', fontSize: '13px', fontWeight: 500,\n cursor: 'pointer',\n }}\n >\n Cancel\n </button>\n )}\n </div>\n )}\n\n {/* Pending warning — user was editing this variant but clicked away without saving. */}\n {parentEdit && isThisVariantEditing && props.uiState?.pendingEditId === variantEditId && (\n <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>\n <AlertTriangle size={14} style={{ color: 'var(--il-warning, #C2410C)' }} />\n <div style={{ color: 'var(--il-warning, #C2410C)', fontSize: '13px' }}>\n Pending - Changes not applied yet. Apply or discard them to continue.\n </div>\n </div>\n )}\n </div>\n </AccordionSection>\n </div>\n );\n })}\n </VariantListWrapper>\n );\n}\n"],"names":["useParentEditEnabled","isNodeLocked","isWrapperEditLocked","React","_a","_b","useDynamicFormStore","splitConditions","useRef","useEffect","useVariantEditSession","useState","useCallback","jsxs","VariantListWrapper","jsx","_c","_d","_e","hasMeaningfulText","_i","EditPencilIcon","AccordionSection","AlertTriangle"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAwB,iBAAiB,KAAY,EAAA;AApBrD,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAsBE,EAAM,MAAA,UAAA,GAAaA,yCAAqB,CAAA,KAAA,CAAM,MAAM,CAAA,CAAA;AACpD,EAAM,MAAA,IAAA,GAAO,MAAM,OAAW,IAAA,QAAA,CAAA;AAE9B,EAAA,MAAM,eAAkB,GAAA,CAAA,CAAA,EAAA,GAAA,KAAA,CAAM,MAAN,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,cAAc,oBAAwBG,IAAAA,CAAAA,CAAAA,GAAAA,GAAA,MAAM,OAAN,KAAA,IAAA,GAAA,KAAA,CAAA,GAAAA,IAAe,aAAkB,MAAA,aAAA,oCACrE,KAAI,EAAA,EAAA,KAAA,EAAO,EAAE,OAAS,EAAA,MAAA,EAAQ,YAAY,QAAU,EAAA,GAAA,EAAK,OACxD,EAAA,QAAA,EAAA;AAAA,sCAAAH,cAAA,CAACQ,6BAAc,IAAM,EAAA,EAAA,EAAI,OAAO,EAAE,KAAA,EAAO,8BAAgC,EAAA,CAAA;AAAA,sCACzER,cAAA,CAAC,SAAI,KAAO,EAAA,EAAE,OAAO,4BAA8B,EAAA,QAAA,EAAU,MAAO,EAAA,EAAG,QAEvE,EAAA,uEAAA,EAAA,CAAA;AAAA,qBACF,EAAA,CAAA;AAAA,mBAAA;AAAA,iBAAA;AAAA,eAEJ;AAAA,aAAA;AAAA,eA1EM,QA4EV,CAAA,CAAA;AAAA,SAEH,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"VariantListField.js","sources":["../../../../src/schema-driven/components/VariantListField.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState, useCallback } from 'react';\nimport { AlertTriangle } from 'lucide-react';\nimport { VariantListWrapper } from '../../features/IL-OTJ/_components/templates/TrafficManager/CreateRule';\nimport AccordionSection from '../../features/IL-OTJ/_components/AccordianSection';\nimport { EditPencilIcon } from '../../features/IL-OTJ/_components/_svg/EditPencilIcon';\nimport { useVariantEditSession, hasMeaningfulText, conditionsToText, VariantDraft, ChangedField, quoteList } from '../../features/IL-OTJ/_components/hooks/useVariantEditSession';\nimport { useDynamicFormStore } from '../store/useDynamicFormStore';\nimport { splitConditions } from '../utils/conditionText';\nimport { useParentEditEnabled } from '../hooks/useParentEditEnabled';\nimport { isNodeLocked, isWrapperEditLocked } from '../utils/editLock';\n\n// Renders one accordion per variant for the active tier and injects each variant's\n// schema children (description/prompt/WTA/WNTA/Config) via renderChildren(variantIndex).\n//\n// `parent_edit: true` on the wrapper node opts the section into the single\n// edit-session-per-variant UX (mirroring CreateRule.tsx): one Edit button in the\n// variant header opens a local draft covering Rule Description, Instruction Prompt,\n// When-to-Apply and When-NOT-to-Apply, and Save sends ONE combined chat message.\n// Without the flag the section keeps the per-field inline edits: every field stays\n// live-bound to the store and owns its own pencil/Apply.\nexport default function VariantListField(props: any) {\n // Dynamic form → schema flag; legacy mount → new UI (backwardCompatibility false).\n // In unified mode the root session supplies draft bindings for every variant;\n // keep this component's per-variant Edit/Save controls out of the way.\n const parentEdit = useParentEditEnabled(props.schema) && !props.unifiedEditSession;\n const tier = props.tierKey || 'tier_1';\n // Config decides whether each variant header carries its \"Variant N\" pill.\n const showVariantPill = props.schema?.show_variant_pill !== false;\n const variants = props.state?.variantsByTier?.[tier] || [{}];\n\n // Resolve which store key each of the four session fields lives under by the schema's\n // `bpa_ui_component` + `ui_position`, NOT by property name: property keys are\n // config-authored and vary per template (`rule_description` vs `ruleDescription`,\n // `wta` vs `whenToApply`), while the component type is what actually defines the role.\n const variantProperties = props.schema?.properties || {};\n\n // `read_only_in_edit_flow`: in the edit flow the wrapper (or every editable field\n // in it) can be frozen — then the variant header shows no Edit button at all, and\n // the whole subtree renders read-only. A partially frozen variant still gets its\n // Edit button; the frozen fields simply stay locked inside the open session and\n // say so (BPARenderer renders the lock notice + tooltip).\n const wrapperLocked = isNodeLocked(props.schema, props.uiState);\n const variantEditLocked = isWrapperEditLocked(props.schema, props.uiState);\n /** cleanKey → true for every field frozen in the current flow. */\n const lockedCleanKeys = React.useMemo(() => {\n const set = new Set<string>();\n const walk = (properties: Record<string, any> = {}, inherited = false) => {\n Object.entries(properties).forEach(([key, node]: any) => {\n const locked = inherited || wrapperLocked || isNodeLocked(node, props.uiState);\n if (locked) set.add(String(node?.data_key || key).replace('global.', ''));\n if (node?.properties) walk(node.properties, locked);\n });\n };\n walk(variantProperties);\n return set;\n }, [variantProperties, wrapperLocked, props.uiState?.usedFor]);\n const isLockedKey = (key?: string) => !!key && lockedCleanKeys.has(key);\n const byComponent = (component: string) =>\n Object.entries(variantProperties)\n .filter(([, node]: any) => node?.bpa_ui_component === component && !node?.hidden)\n .sort(([, a]: any, [, b]: any) => (a?.ui_position ?? 0) - (b?.ui_position ?? 0))\n .map(([key, node]: any) => String(node?.data_key || key).replace('global.', ''));\n\n const [descCleanKey] = byComponent('TextInput');\n const [promptCleanKey] = byComponent('PromptTextEditor');\n // First ConditionSection by ui_position is \"when to apply\", second is \"when NOT to apply\".\n const [wtaCleanKey, wntaCleanKey] = byComponent('ConditionSection');\n\n // `item` here is just the variant index — the draft is built straight from the\n // canonical dynamic-form store, not from `props.state.variantsByTier` (which is a\n // read-display mirror and may not reflect the same value). Only ever called when\n // the user opens an edit session, so the non-reactive getState() read is safe.\n // `item` is read from `variants[variantIndex]` as a fallback if the canonical\n // dynamic-form store hasn't been seeded yet (e.g. before initial hydration or in ADD mode).\n const buildVariantDraft = (variantIndex: number): VariantDraft => {\n const { getVariantField } = useDynamicFormStore.getState();\n const item = variants[variantIndex] || {};\n const read = (key?: string) => (key ? getVariantField(tier, variantIndex, key) : undefined);\n\n const descValue = read(descCleanKey) ?? item.ruleDescription ?? item.description ?? '';\n const promptValue = read(promptCleanKey) ?? item.instructionPrompt ?? '';\n\n const wtaRaw = read(wtaCleanKey);\n const wtaConditions = wtaRaw !== undefined && wtaRaw !== ''\n ? splitConditions(wtaRaw, 'wta')\n : (Array.isArray(item.whenToApplyConditions) && item.whenToApplyConditions.length > 0\n ? item.whenToApplyConditions\n : splitConditions(item.whenToApply || '', 'wta'));\n\n const wntaRaw = read(wntaCleanKey);\n const wntaConditions = wntaRaw !== undefined && wntaRaw !== ''\n ? splitConditions(wntaRaw, 'wnta')\n : (Array.isArray(item.whenNotToApplyConditions) && item.whenNotToApplyConditions.length > 0\n ? item.whenNotToApplyConditions\n : splitConditions(item.whenNotToApply || '', 'wnta'));\n\n return {\n ruleDescription: typeof descValue === 'string' ? descValue : '',\n instructionPrompt: typeof promptValue === 'string' ? promptValue : '',\n whenToApplyConditions: wtaConditions,\n whenNotToApplyConditions: wntaConditions,\n };\n };\n\n // The instruction prompt is user-owned and committed straight to the store on\n // Save (no AI round-trip): the user sees exactly what they typed the moment the\n // session closes. Description/WTA/WNTA are AI-owned — they're mirrored instead,\n // so they stay visible without looking committed until the AI actually writes\n // them back (mirrors the \"Instruction Setup\" title's mirage behaviour).\n const commitVariantEdit = (\n committed: {\n instructionPrompt?: string;\n ruleDescription?: string;\n whenToApplyText?: string;\n whenNotToApplyText?: string;\n },\n session: { variantIndex: number; tierKey: string },\n ) => {\n const { setVariantField, setVariantMirage } = useDynamicFormStore.getState();\n if (committed.instructionPrompt !== undefined && promptCleanKey) {\n setVariantField(session.tierKey, session.variantIndex, promptCleanKey, committed.instructionPrompt);\n }\n if (committed.ruleDescription !== undefined && descCleanKey) {\n setVariantMirage(session.tierKey, session.variantIndex, descCleanKey, committed.ruleDescription);\n }\n if (committed.whenToApplyText !== undefined && wtaCleanKey) {\n setVariantMirage(session.tierKey, session.variantIndex, wtaCleanKey, committed.whenToApplyText);\n }\n if (committed.whenNotToApplyText !== undefined && wntaCleanKey) {\n setVariantMirage(session.tierKey, session.variantIndex, wntaCleanKey, committed.whenNotToApplyText);\n }\n };\n\n // Reactive read (the getState() reads elsewhere are one-shot) so the Add/Edit\n // label flips as soon as the AI or the user fills the variant in.\n const variantStore = useDynamicFormStore((s) => s.variantData);\n\n // Mirages exist only to keep the user's draft visible while the AI's turn is in\n // flight — once that turn ends, drop them (see useSectionEditSession, which does\n // the same for the \"Instruction Setup\" title). If the AI actually wrote the\n // fields back, the real store value wins from here on; if it didn't, the field\n // falls back to its real (unset) value instead of looking permanently saved.\n const prevVariantStreaming = useRef(props.uiState?.isAiStreaming);\n useEffect(() => {\n if (prevVariantStreaming.current && !props.uiState?.isAiStreaming) {\n useDynamicFormStore.getState().clearAllMirages();\n }\n prevVariantStreaming.current = props.uiState?.isAiStreaming;\n }, [props.uiState?.isAiStreaming]);\n\n const {\n variantEdit,\n pendingVariantId,\n handleStartVariantEdit,\n handleCancelVariantEdit,\n patchVariantDraft,\n editDraftCondition,\n removeDraftCondition,\n addDraftCondition,\n handleSaveVariantEdit,\n } = useVariantEditSession(props.uiState, buildVariantDraft, commitVariantEdit);\n\n // Draft state for additional variant fields (such as FileUpload / supporting_documents)\n // so that edits (uploads/removals) can be cancelled or committed atomically with the variant session.\n const [extraDrafts, setExtraDrafts] = useState<Record<string, any>>({});\n const initialExtraDraftsRef = useRef<Record<string, any>>({});\n\n const startVariantEdit = (vIndex: number, tierKey: string, index: number, variantType: string) => {\n const { getVariantField } = useDynamicFormStore.getState();\n const initialExtra: Record<string, any> = {};\n Object.entries(variantProperties).forEach(([key, node]: any) => {\n const cleanKey = String(node?.data_key || key).replace('global.', '');\n if (cleanKey !== descCleanKey && cleanKey !== promptCleanKey && cleanKey !== wtaCleanKey && cleanKey !== wntaCleanKey) {\n const val = getVariantField(tierKey, vIndex, cleanKey);\n initialExtra[cleanKey] = val !== undefined ? JSON.parse(JSON.stringify(val)) : (node?.type === 'array' ? [] : '');\n }\n });\n initialExtraDraftsRef.current = initialExtra;\n setExtraDrafts(initialExtra);\n handleStartVariantEdit(vIndex, tierKey, index, variantType);\n };\n\n const cancelVariantEdit = () => {\n if (variantEdit) {\n const { setVariantField } = useDynamicFormStore.getState();\n Object.entries(initialExtraDraftsRef.current).forEach(([key, val]) => {\n setVariantField(variantEdit.tierKey, variantEdit.variantIndex, key, val);\n });\n }\n initialExtraDraftsRef.current = {};\n setExtraDrafts({});\n handleCancelVariantEdit();\n };\n\n const saveVariantEdit = (extraChanged?: boolean) => {\n const extraChanges: ChangedField[] = [];\n\n Object.entries(extraDrafts).forEach(([key, currentVal]) => {\n const initialVal = initialExtraDraftsRef.current[key];\n if (JSON.stringify(currentVal) === JSON.stringify(initialVal)) return;\n\n const node = variantProperties[key] || Object.values(variantProperties).find(\n (n: any) => String(n?.data_key || '').replace('global.', '') === key\n );\n const label = (node as any)?.title || key;\n\n if (Array.isArray(currentVal) || Array.isArray(initialVal)) {\n const origList: any[] = Array.isArray(initialVal) ? initialVal : [];\n const currList: any[] = Array.isArray(currentVal) ? currentVal : [];\n\n const getFileName = (item: any) => {\n if (item && typeof item === 'object' && item.status === 'error') return '';\n return (item?.name || item?.filename || (typeof item === 'string' ? item.split('/').pop() : '') || '').trim();\n };\n\n const origNames = origList.map(getFileName).filter(Boolean);\n const currNames = currList.map(getFileName).filter(Boolean);\n\n const added = currNames.filter((name) => !origNames.includes(name));\n const removed = origNames.filter((name) => !currNames.includes(name));\n\n if (removed.length > 0) {\n extraChanges.push({\n action: 'remove',\n label,\n value: quoteList(removed),\n });\n }\n if (added.length > 0) {\n extraChanges.push({\n action: 'update',\n label,\n value: quoteList(added),\n });\n }\n } else {\n extraChanges.push({\n action: 'update',\n label,\n previous: initialVal ? quoteList([String(initialVal)]) : undefined,\n value: quoteList([String(currentVal)]),\n });\n }\n });\n\n if (variantEdit) {\n const { setVariantField } = useDynamicFormStore.getState();\n Object.entries(extraDrafts).forEach(([key, val]) => {\n setVariantField(variantEdit.tierKey, variantEdit.variantIndex, key, val);\n });\n }\n initialExtraDraftsRef.current = {};\n setExtraDrafts({});\n handleSaveVariantEdit(extraChanges.length > 0 ? extraChanges : (extraChanged ?? false));\n };\n\n // Discoverability nudge: clicking anywhere inside a variant's body while no edit\n // session is open pulses the header's Add/Edit button (the only way in) and scrolls\n // it into view, instead of leaving the click silently inert.\n const editButtonRefs = useRef<Record<string, HTMLButtonElement | null>>({});\n const [glowingVariantId, setGlowingVariantId] = useState<string | null>(null);\n const glowTimer = useRef<any>(null);\n\n useEffect(() => () => { if (glowTimer.current) clearTimeout(glowTimer.current); }, []);\n\n const nudgeEditButton = useCallback((editId: string) => {\n const btn = editButtonRefs.current[editId];\n if (!btn || btn.disabled) return;\n btn.scrollIntoView({ behavior: 'smooth', block: 'center' });\n setGlowingVariantId(editId);\n if (glowTimer.current) clearTimeout(glowTimer.current);\n glowTimer.current = setTimeout(() => setGlowingVariantId(null), 1800);\n }, []);\n\n const buildReadOnlyOverrides = (readOnly: boolean, editing: boolean) => {\n const overrides: Record<string, any> = {};\n const collectOverrides = (properties: Record<string, any> = {}) => {\n Object.entries(properties).forEach(([key, rawNode]: any) => {\n const cleanKey = (rawNode?.data_key || key).replace('global.', '');\n overrides[cleanKey] = {\n readOnly,\n parentEditing: editing,\n hideEditControls: parentEdit,\n };\n if (rawNode?.properties) collectOverrides(rawNode.properties);\n });\n };\n collectOverrides(props.schema?.properties);\n return overrides;\n };\n\n return (\n <VariantListWrapper\n onAddVariant={() => { if (props.handlers?.addNewVariant) props.handlers.addNewVariant(tier); }}\n isDisabled={props.uiState?.isAiStreaming}\n // Under parent_edit the outer rule-list \"Add Variant\" button (RuleAccordionShell)\n // owns this action instead — matches CreateRule.tsx's new-UI behaviour.\n showAddVariantBtn={!parentEdit && !props.unifiedEditSession && props.uiState?.usedFor !== 'Edit'}\n // Under parent_edit each variant is already its own bordered card, so the\n // connector stick between them is redundant chrome — hide it here only.\n showConnectorLines={!parentEdit}\n >\n <style>{`@keyframes ilVariantEditGlow {\n 0%, 100% { box-shadow: 0 0 0 0 rgba(127, 86, 217, 0); }\n 50% { box-shadow: 0 0 0 4px rgba(127, 86, 217, 0.25), 0 0 10px 2px rgba(127, 86, 217, 0.35); }\n }`}</style>\n {variants.map((item: any, vIndex: number) => {\n const variantType = item.variantType || 'default';\n const isDefault = variantType === 'default' || variantType === 'default_variant';\n const uniqueId = `${tier}-variant-${vIndex}`;\n const isDraftVariant = item.is_variant === true;\n // Once the user picks a variant, that choice wins; until then the drafted\n // (new) variant is open by default and loaded variants stay collapsed.\n const activeIndex = props.uiState?.activeVariantAccordionIndex;\n const isExpanded = activeIndex !== undefined ? activeIndex === vIndex : isDraftVariant;\n const isEffectivelyReadOnly = item.isReadOnly || props.uiState?.isAiStreaming;\n\n const variantEditId = `variant-${tier}-${vIndex}`;\n const isThisVariantEditing = parentEdit && variantEdit?.id === variantEditId;\n const isThisVariantPending = pendingVariantId === variantEditId;\n const draft = isThisVariantEditing ? variantEdit!.draft : null;\n const isVariantEditDisabled = isEffectivelyReadOnly || isThisVariantPending;\n\n // Nothing filled in yet → the header offers \"Add\" rather than \"Edit\".\n const variantValues = variantStore?.[tier]?.[vIndex] || {};\n const isVariantEmpty = ![descCleanKey, promptCleanKey, wtaCleanKey, wntaCleanKey]\n .some((key) => key && hasMeaningfulText(variantValues[key]));\n\n const hasCoreChanges = !!(isThisVariantEditing && variantEdit && draft && (\n draft.ruleDescription.trim() !== variantEdit.original.ruleDescription.trim() ||\n draft.instructionPrompt.trim() !== variantEdit.original.instructionPrompt.trim() ||\n conditionsToText(draft.whenToApplyConditions) !== conditionsToText(variantEdit.original.whenToApplyConditions) ||\n conditionsToText(draft.whenNotToApplyConditions) !== conditionsToText(variantEdit.original.whenNotToApplyConditions)\n ));\n\n const hasExtraChanges = isThisVariantEditing && Object.keys(extraDrafts).some((key) => {\n const currentVal = extraDrafts[key];\n const initialVal = initialExtraDraftsRef.current[key];\n return JSON.stringify(currentVal) !== JSON.stringify(initialVal);\n });\n\n const isFileUploading = isThisVariantEditing && Object.values(extraDrafts).some((val) =>\n Array.isArray(val) && val.some((f: any) => f?.status === 'uploading')\n );\n\n const hasChanges = hasCoreChanges || hasExtraChanges;\n\n const isVariantSaveDisabled = !draft\n || !hasChanges\n || isFileUploading\n || (hasCoreChanges && (\n !hasMeaningfulText(draft.ruleDescription) ||\n !draft.whenToApplyConditions.some((c) => hasMeaningfulText(c.text))\n ));\n\n // Only the variant in an open edit session gets draft-bound value/conditions.\n // Everywhere else the fields keep reading the store themselves (BPAFieldWrapper\n // subscribes to it), so AI write-backs stay live — we only add the props that\n // suppress the old per-field pencil/Apply chrome.\n const isVariantReadOnly = isEffectivelyReadOnly || wrapperLocked || (parentEdit && !isThisVariantEditing);\n const overrides: Record<string, any> = {\n ...buildReadOnlyOverrides(isVariantReadOnly, isThisVariantEditing),\n };\n\n if (parentEdit) {\n const put = (key: string | undefined, patch: any) => {\n if (!key) return;\n // Frozen field: keep it store-bound and read-only, never draft-bound.\n if (isLockedKey(key)) {\n overrides[key] = {\n ...(overrides[key] || {}),\n readOnly: true,\n enableInlineEdit: false,\n hideEditControls: true,\n parentEditing: isThisVariantEditing,\n };\n return;\n }\n overrides[key] = { ...(overrides[key] || {}), ...patch };\n };\n\n put(descCleanKey, {\n readOnly: isEffectivelyReadOnly || !isThisVariantEditing,\n enableInlineEdit: false, // no per-field pencil — the variant header owns editing\n ...(draft ? { value: draft.ruleDescription, onChange: (v: string) => patchVariantDraft({ ruleDescription: v }) } : {}),\n });\n\n put(promptCleanKey, {\n readOnly: isEffectivelyReadOnly || !isThisVariantEditing,\n hideEditControls: true,\n parentEditing: isThisVariantEditing,\n ...(draft ? { value: draft.instructionPrompt, onChange: (v: string) => patchVariantDraft({ instructionPrompt: v }) } : {}),\n });\n\n put(wtaCleanKey, {\n readOnly: isEffectivelyReadOnly,\n hideEditControls: true,\n parentEditing: isThisVariantEditing,\n ...(draft ? {\n conditions: draft.whenToApplyConditions,\n onAdd: () => addDraftCondition('whenToApplyConditions'),\n onRemove: (_t: string, _i: number, id: any) => removeDraftCondition('whenToApplyConditions', id),\n onEdit: (_t: string, _i: number, id: any, text: string) => editDraftCondition('whenToApplyConditions', id, text),\n } : {}),\n });\n\n put(wntaCleanKey, {\n readOnly: isEffectivelyReadOnly,\n hideEditControls: true,\n parentEditing: isThisVariantEditing,\n ...(draft ? {\n conditions: draft.whenNotToApplyConditions,\n onAdd: () => addDraftCondition('whenNotToApplyConditions'),\n onRemove: (_t: string, _i: number, id: any) => removeDraftCondition('whenNotToApplyConditions', id),\n onEdit: (_t: string, _i: number, id: any, text: string) => editDraftCondition('whenNotToApplyConditions', id, text),\n } : {}),\n });\n // Inject draft value and onChange for extra variant fields (e.g. supporting_documents)\n // so modifications stay in draft until Save is clicked, or revert if Cancel is clicked.\n if (isThisVariantEditing) {\n const { getVariantField } = useDynamicFormStore.getState();\n Object.entries(variantProperties).forEach(([key, node]: any) => {\n const cleanKey = String(node?.data_key || key).replace('global.', '');\n if (cleanKey !== descCleanKey && cleanKey !== promptCleanKey && cleanKey !== wtaCleanKey && cleanKey !== wntaCleanKey) {\n put(cleanKey, {\n value: extraDrafts[cleanKey] !== undefined ? extraDrafts[cleanKey] : (getVariantField(tier, vIndex, cleanKey) || []),\n onChange: (newVal: any) => {\n setExtraDrafts((prev) => ({\n ...prev,\n [cleanKey]: newVal,\n }));\n },\n });\n }\n });\n }\n }\n\n const isGlowing = glowingVariantId === variantEditId;\n\n const renderVariantHeaderActions = (isOpen: boolean, onToggle: () => void) => {\n if (!parentEdit) return null;\n // Wrapper frozen, or nothing left in it that can still be edited.\n if (variantEditLocked) return null;\n if (isEffectivelyReadOnly && !isThisVariantEditing && !isThisVariantPending) return null;\n\n // Save/Cancel live at the bottom-left of the variant body (users read and edit\n // top-to-bottom, then look down-left to commit) — not in the header.\n if (isThisVariantEditing || isThisVariantPending) return null;\n\n return (\n <button\n ref={(el) => { editButtonRefs.current[variantEditId] = el; }}\n title={isVariantEditDisabled ? 'Editing unavailable' : (isVariantEmpty ? 'Add' : 'Edit')}\n onClick={(e) => {\n e.stopPropagation();\n startVariantEdit(vIndex, tier, vIndex, variantType);\n if (!isOpen) onToggle();\n }}\n disabled={isVariantEditDisabled}\n style={{\n display: 'flex', alignItems: 'center', justifyContent: 'center',\n padding: '6px 8px', borderRadius: '6px',\n border: `1px solid ${isGlowing ? 'var(--il-primary, #7F56D9)' : 'var(--il-border, #E2E8F0)'}`,\n backgroundColor: isGlowing ? 'var(--il-primary-subtle, #f5f3ff)' : 'var(--il-surface, #ffffff)',\n color: isGlowing ? 'var(--il-primary, #2563EB)' : 'var(--il-muted, #64748B)', fontSize: '13px', fontWeight: 500,\n cursor: isVariantEditDisabled ? 'not-allowed' : 'pointer',\n opacity: isVariantEditDisabled ? 0.5 : 1,\n gap: '6px',\n transition: 'border-color 150ms ease, background-color 150ms ease, color 150ms ease',\n animation: isGlowing ? 'ilVariantEditGlow 900ms ease-in-out 2' : undefined,\n }}\n >\n <EditPencilIcon size={12} /> Edit\n {/* {isVariantEmpty ? 'Add' : 'Edit'} */}\n </button>\n );\n };\n\n return (\n <div key={uniqueId} style={{ width: '100%' }} data-edit-id={parentEdit ? variantEditId : undefined}>\n <AccordionSection\n title={{ type: isDefault ? 'default' : 'variant', label: variantType, number: vIndex + 1, isNewVariant: isDraftVariant, isDefault: item.isDefault, isModified: item.isModified }}\n expanded={isExpanded}\n onToggle={() => props.uiState?.setActiveVariantAccordionIndex?.(isExpanded ? null : vIndex)}\n variant=\"rule-behavior\"\n showTitlePill={showVariantPill}\n footerData={{ ruleTitle: variantType, description: item.ruleDescription || '' }}\n readOnly={isEffectivelyReadOnly}\n actionButtons={parentEdit ? renderVariantHeaderActions : undefined}\n isAiStreaming={props.uiState?.isAiStreaming}\n // Keep the header mounted while streaming so the Save button can show\n // \"Validating...\" — the render fn already returns null for variants that\n // aren't the one being validated.\n alwaysShowActions={parentEdit}\n >\n <div\n style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}\n onClickCapture={(e) => {\n if (!parentEdit || variantEditLocked || isThisVariantEditing || isThisVariantPending || isVariantEditDisabled) return;\n\n // Cognitive icon / reasoning toggles must just expand — no nudge, no scroll.\n const target = e.target as HTMLElement;\n if (target.closest('[data-no-edit-nudge], button, a, [role=\"button\"]')) return;\n\n nudgeEditButton(variantEditId);\n }}\n >\n {/* Pass the resolved tier so nested fields hit variantData[tier][vIndex]. */}\n {props.renderChildren ? props.renderChildren(vIndex, overrides, tier) : null}\n\n {/* Bottom-left Save/Cancel for the open edit session. */}\n {parentEdit && (isThisVariantEditing || isThisVariantPending) && (\n <div style={{ display: 'flex', alignItems: 'center', gap: '6px', justifyContent: 'flex-start' }}>\n <button\n onClick={(e) => { e.stopPropagation(); saveVariantEdit(hasExtraChanges); }}\n disabled={isVariantSaveDisabled || isThisVariantPending}\n style={{\n display: 'flex', alignItems: 'center', gap: '6px',\n padding: '6px 10.5px', borderRadius: '6px',\n border: '1px solid var(--il-primary, #D9D6FE)', backgroundColor: isThisVariantPending ? 'var(--il-primary-subtle, #f5f3ff)' : 'var(--il-surface, #ffffff)',\n color: 'var(--il-primary, #2563EB)', fontSize: '13px', fontWeight: 500,\n cursor: (isVariantSaveDisabled || isThisVariantPending) ? 'not-allowed' : 'pointer',\n opacity: isVariantSaveDisabled ? 0.5 : 1,\n }}\n >\n {isThisVariantPending ? 'Validating...' : 'Save'}\n </button>\n {!isThisVariantPending && (\n <button\n onClick={(e) => { e.stopPropagation(); cancelVariantEdit(); }}\n style={{\n display: 'flex', alignItems: 'center', gap: '6px',\n padding: '6px 10.5px', borderRadius: '6px',\n border: '1px solid var(--il-primary, #D9D6FE)', backgroundColor: 'var(--il-surface, #ffffff)',\n color: 'var(--il-primary, #2563EB)', fontSize: '13px', fontWeight: 500,\n cursor: 'pointer',\n }}\n >\n Cancel\n </button>\n )}\n </div>\n )}\n\n {/* Pending warning — user was editing this variant but clicked away without saving. */}\n {parentEdit && isThisVariantEditing && props.uiState?.pendingEditId === variantEditId && (\n <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>\n <AlertTriangle size={14} style={{ color: 'var(--il-warning, #C2410C)' }} />\n <div style={{ color: 'var(--il-warning, #C2410C)', fontSize: '13px' }}>\n Pending - Changes not applied yet. Apply or discard them to continue.\n </div>\n </div>\n )}\n </div>\n </AccordionSection>\n </div>\n );\n })}\n </VariantListWrapper>\n );\n}\n"],"names":["useParentEditEnabled","isNodeLocked","isWrapperEditLocked","React","_a","_b","_c","_d","_e","useDynamicFormStore","splitConditions","useRef","useEffect","useVariantEditSession","useState","quoteList","useCallback","jsxs","VariantListWrapper","jsx","hasMeaningfulText","conditionsToText","_i","EditPencilIcon","AccordionSection","AlertTriangle"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAwB,iBAAiB,KAAY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