@bikdotai/bik-component-library 0.0.853 → 0.0.855
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/cjs/components/add-variableV2/AddDataPill.js +10 -0
- package/dist/cjs/components/add-variableV2/AddDataPill.js.map +1 -0
- package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +11 -11
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +7 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +41 -14
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +6 -5
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +2 -2
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/VariableInlineField.js +65 -0
- package/dist/cjs/components/agent-builder/components/VariableInlineField.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js +10 -0
- package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js.map +1 -0
- package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +4 -4
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/toaster/Toaster.js +1 -1
- package/dist/cjs/components/toaster/Toaster.js.map +1 -1
- package/dist/cjs/components/toaster/Toaster.styled.js +7 -7
- package/dist/cjs/components/toaster/Toaster.styled.js.map +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.js.map +1 -1
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.styles.js +8 -0
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/BikEditor.types.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionDropdown.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionDropdown.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/add-variableV2/AddDataPill.d.ts +24 -0
- package/dist/esm/components/add-variableV2/AddDataPill.js +33 -0
- package/dist/esm/components/add-variableV2/AddDataPill.js.map +1 -0
- package/dist/esm/components/add-variableV2/index.d.ts +1 -0
- package/dist/esm/components/agent-builder/AgentBuilder.js +76 -74
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +8 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.d.ts +8 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +182 -136
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +3 -0
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +195 -188
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +12 -0
- package/dist/esm/components/agent-builder/components/MentionEditor.js +144 -103
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionField.js +48 -45
- package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +14 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.js +286 -218
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +8 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +192 -176
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.d.ts +9 -0
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +67 -48
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/VariableInlineField.d.ts +26 -0
- package/dist/esm/components/agent-builder/components/VariableInlineField.js +149 -0
- package/dist/esm/components/agent-builder/components/VariableInlineField.js.map +1 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.d.ts +46 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.js +118 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.js.map +1 -0
- package/dist/esm/components/agent-builder/constants/tools.d.ts +1 -1
- package/dist/esm/components/agent-builder/constants/tools.js +14 -13
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +7 -0
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +99 -96
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +164 -160
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +14 -4
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +54 -36
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/toaster/Toaster.js +30 -25
- package/dist/esm/components/toaster/Toaster.js.map +1 -1
- package/dist/esm/components/toaster/Toaster.styled.js +5 -5
- package/dist/esm/components/toaster/Toaster.styled.js.map +1 -1
- package/dist/esm/components/variable-picker-v3/Content.js +16 -15
- package/dist/esm/components/variable-picker-v3/Content.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +40 -34
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.styles.js +20 -12
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/BikEditor.types.d.ts +9 -0
- package/dist/esm/editor/BikEditor.types.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionDropdown.js +28 -28
- package/dist/esm/editor/extensions/mention/MentionDropdown.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionExtension.js +23 -19
- package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/index.js +543 -541
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentBuilder.js","sources":["../../../../src/components/agent-builder/AgentBuilder.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Spinner } from '@src/components/spinner';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentBuilderProps,\n\tAgentValue,\n\tSubAgentDraft,\n} from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n\tStepScroll,\n} from './AgentBuilder.styled';\nimport { AgentBuilderFooter } from './components/AgentBuilderFooter';\nimport { AgentBuilderTopBar } from './components/AgentBuilderTopBar';\nimport { DiscardModal } from './components/DiscardModal';\nimport { GoLiveModal, GoLiveModalMode } from './components/GoLiveModal';\nimport { StepRail } from './components/StepRail';\nimport { UndoToast } from './components/UndoToast';\nimport {\n\tAgentBuilderProvider,\n\tuseAgentBuilderContext,\n} from './context/AgentBuilderContext';\nimport { Step1About } from './steps/Step1About';\nimport { Step2WhenItStepsIn } from './steps/Step2WhenItStepsIn';\nimport { Step3HowItResponds } from './steps/Step3HowItResponds';\nimport { Step4HandoverRules } from './steps/Step4HandoverRules';\n\nconst StepContent: React.FC = () => {\n\tconst { activeStep } = useAgentBuilderContext();\n\tswitch (activeStep) {\n\t\tcase 'about':\n\t\t\treturn <Step1About />;\n\t\tcase 'trigger':\n\t\t\treturn <Step2WhenItStepsIn />;\n\t\tcase 'response':\n\t\t\treturn <Step3HowItResponds />;\n\t\tcase 'handover':\n\t\t\treturn <Step4HandoverRules />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\n/**\n * 4-step creation/edit wizard body for an AI agent. Presentational and\n * controlled — the consumer owns the `value`, persistence and routing.\n *\n * @example\n * <AgentBuilder\n * value={agent}\n * onChange={(patch) => setAgent({ ...agent, ...patch })}\n * availableTools={tools}\n * availableSubAgents={subAgents}\n * onDiscard={() => router.back()}\n * onSaveDraft={saveDraft}\n * onPublish={publish}\n * />\n */\nexport const AgentBuilder: React.FC<AgentBuilderProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonChange,\n\t\tonStepChange,\n\t\tonDiscard,\n\t\tonSaveDraft,\n\t\tonPublish,\n\t\tonBack,\n\t\tonTestAgent,\n\t\tonGoToDashboard,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tonConnectIntegration,\n\t\t...rest\n\t} = props;\n\tconst {\n\t\tvalue,\n\t\tactiveStep,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableIntents = [],\n\t\tavailableModels = [],\n\t\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tvalidation,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tisSaving,\n\t\tisPublishing,\n\t\tisLoading,\n\t\tfooterHint = 'Changes don’t affect customers until you go live',\n\t\tdisableStepNavigation,\n\t\tdebugLog,\n\t} = config;\n\n\tconst [modalMode, setModalMode] = useState<GoLiveModalMode>(null);\n\tconst [publishingLocal, setPublishingLocal] = useState(false);\n\t// True while onTestAgent's async work (e.g. save-as-draft before the test\n\t// modal opens) is in flight — loads + disables the Test agent button.\n\tconst [testingLocal, setTestingLocal] = useState(false);\n\t// Back was pressed → confirm leaving (save draft / discard) before navigating.\n\tconst [showLeaveConfirm, setShowLeaveConfirm] = useState(false);\n\tconst [savingAndLeaving, setSavingAndLeaving] = useState(false);\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentBuilder] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleChange = useCallback(\n\t\t(patch: Partial<AgentValue>) => {\n\t\t\tlogAction('onChange', patch);\n\t\t\tonChange(patch);\n\t\t},\n\t\t[logAction, onChange],\n\t);\n\tconst handleStepChange = useCallback(\n\t\t(step: Parameters<NonNullable<typeof onStepChange>>[0]) => {\n\t\t\tlogAction('onStepChange', step);\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[logAction, onStepChange],\n\t);\n\tconst handleSaveDraft = useCallback(() => {\n\t\tlogAction('onSaveDraft');\n\t\treturn onSaveDraft();\n\t}, [logAction, onSaveDraft]);\n\tconst handlePublish = useCallback(() => {\n\t\tlogAction('onPublish');\n\t\treturn onPublish();\n\t}, [logAction, onPublish]);\n\t// Back opens the \"Save as draft?\" confirmation rather than leaving directly.\n\tconst handleBack = useCallback(() => {\n\t\tlogAction('onBack');\n\t\tsetShowLeaveConfirm(true);\n\t}, [logAction]);\n\n\t// Modal \"Discard\" defers to the parent's discard handler (same as the top bar).\n\tconst handleDiscardAndLeave = useCallback(() => {\n\t\tlogAction('onDiscardAndLeave');\n\t\tsetShowLeaveConfirm(false);\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\n\tconst handleSaveDraftAndLeave = useCallback(async () => {\n\t\tlogAction('onSaveDraftAndLeave');\n\t\tconst result = onSaveDraft();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSavingAndLeaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSavingAndLeaving(false);\n\t\t\t}\n\t\t}\n\t\tsetShowLeaveConfirm(false);\n\t\tonBack?.();\n\t}, [logAction, onSaveDraft, onBack]);\n\tconst handleTestAgent = useCallback(async () => {\n\t\tlogAction('onTestAgent');\n\t\tconst result = onTestAgent?.();\n\t\t// A new agent saves as draft before the test modal opens — that's slow, so\n\t\t// disable + load the button until it settles (prevents double-triggering).\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetTestingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetTestingLocal(false);\n\t\t\t}\n\t\t}\n\t}, [logAction, onTestAgent]);\n\tconst handleGoToDashboard = useCallback(() => {\n\t\tlogAction('onGoToDashboard');\n\t\tonGoToDashboard?.();\n\t}, [logAction, onGoToDashboard]);\n\tconst handleCreateSubAgent = useCallback(\n\t\t(draft: SubAgentDraft) => {\n\t\t\tlogAction('onCreateSubAgent', draft);\n\t\t\treturn onCreateSubAgent\n\t\t\t\t? onCreateSubAgent(draft)\n\t\t\t\t: Promise.reject(new Error('onCreateSubAgent not provided'));\n\t\t},\n\t\t[logAction, onCreateSubAgent],\n\t);\n\n\tconst handleConfirmGoLive = async () => {\n\t\tlogAction('onGoLiveConfirm');\n\t\tconst result = handlePublish();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetPublishingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t\tsetModalMode('success');\n\t\t\t} finally {\n\t\t\t\tsetPublishingLocal(false);\n\t\t\t}\n\t\t} else {\n\t\t\tsetModalMode('success');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AgentBuilderProvider\n\t\t\tvalue={value}\n\t\t\tonChange={handleChange}\n\t\t\tactiveStep={activeStep}\n\t\t\tonStepChange={onStepChange ? handleStepChange : undefined}\n\t\t\tavailableTools={availableTools}\n\t\t\tavailableSubAgents={availableSubAgents}\n\t\t\tavailableIntents={availableIntents}\n\t\t\tavailableModels={availableModels}\n\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tcharLimits={charLimits}\n\t\t\tdisableStepNavigation={disableStepNavigation}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? handleCreateSubAgent : undefined}\n\t\t\tonFetchSubAgent={onFetchSubAgent}\n\t\t\tonUpdateSubAgent={onUpdateSubAgent}\n\t\t\tonImproveSubAgent={onImproveSubAgent}\n\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t>\n\t\t\t<BuilderRoot data-test={rest['data-test'] ?? 'agent-builder'}>\n\t\t\t\t<AgentBuilderTopBar\n\t\t\t\t\tname={value.name}\n\t\t\t\t\tstatus={value.status}\n\t\t\t\t\tonBack={onBack ? handleBack : undefined}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<Main>\n\t\t\t\t\t<Rail>\n\t\t\t\t\t\t<StepRail />\n\t\t\t\t\t</Rail>\n\t\t\t\t\t<Content>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ContentCard>\n\t\t\t\t\t\t\t\t<StepScroll>\n\t\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t\t</StepScroll>\n\t\t\t\t\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\t\t\t\t\tisTesting={testingLocal}\n\t\t\t\t\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ContentCard>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Content>\n\t\t\t\t</Main>\n\n\t\t\t\t<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => {\n\t\t\t\t\t\tconst wasSuccess = modalMode === 'success';\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\tif (wasSuccess) {\n\t\t\t\t\t\t\thandleGoToDashboard();\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\tonConfirm={handleConfirmGoLive}\n\t\t\t\t\tonSaveDraft={() => {\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\thandleSaveDraft();\n\t\t\t\t\t}}\n\t\t\t\t\tonGoToDashboard={onGoToDashboard ? handleGoToDashboard : undefined}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<DiscardModal\n\t\t\t\t\topen={showLeaveConfirm}\n\t\t\t\t\tonClose={() => setShowLeaveConfirm(false)}\n\t\t\t\t\tonDiscard={handleDiscardAndLeave}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tdisableSaveDraft={!value.name.trim()}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<UndoToast />\n\t\t\t</BuilderRoot>\n\t\t</AgentBuilderProvider>\n\t);\n};\n\nAgentBuilder.displayName = 'AgentBuilder';\n"],"names":["StepContent","activeStep","useAgentBuilderContext","Step1About","Step2WhenItStepsIn","Step3HowItResponds","Step4HandoverRules","AgentBuilder","props","config","onChange","onStepChange","onDiscard","onSaveDraft","onPublish","onBack","onTestAgent","onGoToDashboard","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","onConnectIntegration","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","validation","applicationType","charLimits","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","testingLocal","setTestingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","StepSc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ACpBV,EAAa,SAAS;AAAA,gBACvB;AAAA,gBACA,cAAcN,KAAgBQ;AAAA,cAAA;AAAA,YAAA;AAAA,UAC/B,EAAA,CACD,EAAA,CAEF;AAAA,QAAA,GACD;AAAA,QAEA,gBAAA2B;AAAA,UAACa;AAAA,UAAA;AAAA,YACA,MAAM3C;AAAA,YACN,SAAS,MAAM;AACd,oBAAM4C,IAAa5C,MAAc;AACjC,cAAAC,EAAa,IAAI,GACb2C,KACHlB,EAAA;AAAA,YAEF;AAAA,YACA,WAAWG;AAAA,YACX,aAAa,MAAM;AAClB,cAAA5B,EAAa,IAAI,GACjBkB,GAAA;AAAA,YACD;AAAA,YACA,iBAAiB3C,IAAkBkD,IAAsB;AAAA,YACzD,cAAc/B,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAA2B;AAAA,UAACe;AAAA,UAAA;AAAA,YACA,MAAMtC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWc;AAAA,YACX,aAAaC;AAAA,YACb,kBAAkB,CAACvC,EAAM,KAAK,KAAA;AAAA,YAC9B,UAAUU,KAAYe;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBqC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEAhF,GAAa,cAAc;"}
|
|
1
|
+
{"version":3,"file":"AgentBuilder.js","sources":["../../../../src/components/agent-builder/AgentBuilder.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Spinner } from '@src/components/spinner';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentBuilderProps,\n\tAgentValue,\n\tSubAgentDraft,\n} from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n\tStepScroll,\n} from './AgentBuilder.styled';\nimport { AgentBuilderFooter } from './components/AgentBuilderFooter';\nimport { AgentBuilderTopBar } from './components/AgentBuilderTopBar';\nimport { DiscardModal } from './components/DiscardModal';\nimport { GoLiveModal, GoLiveModalMode } from './components/GoLiveModal';\nimport { StepRail } from './components/StepRail';\nimport { UndoToast } from './components/UndoToast';\nimport {\n\tAgentBuilderProvider,\n\tuseAgentBuilderContext,\n} from './context/AgentBuilderContext';\nimport { Step1About } from './steps/Step1About';\nimport { Step2WhenItStepsIn } from './steps/Step2WhenItStepsIn';\nimport { Step3HowItResponds } from './steps/Step3HowItResponds';\nimport { Step4HandoverRules } from './steps/Step4HandoverRules';\n\nconst StepContent: React.FC = () => {\n\tconst { activeStep } = useAgentBuilderContext();\n\tswitch (activeStep) {\n\t\tcase 'about':\n\t\t\treturn <Step1About />;\n\t\tcase 'trigger':\n\t\t\treturn <Step2WhenItStepsIn />;\n\t\tcase 'response':\n\t\t\treturn <Step3HowItResponds />;\n\t\tcase 'handover':\n\t\t\treturn <Step4HandoverRules />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\n/**\n * 4-step creation/edit wizard body for an AI agent. Presentational and\n * controlled — the consumer owns the `value`, persistence and routing.\n *\n * @example\n * <AgentBuilder\n * value={agent}\n * onChange={(patch) => setAgent({ ...agent, ...patch })}\n * availableTools={tools}\n * availableSubAgents={subAgents}\n * onDiscard={() => router.back()}\n * onSaveDraft={saveDraft}\n * onPublish={publish}\n * />\n */\nexport const AgentBuilder: React.FC<AgentBuilderProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonChange,\n\t\tonStepChange,\n\t\tonDiscard,\n\t\tonSaveDraft,\n\t\tonPublish,\n\t\tonBack,\n\t\tonTestAgent,\n\t\tonGoToDashboard,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tonConnectIntegration,\n\t\t...rest\n\t} = props;\n\tconst {\n\t\tvalue,\n\t\tactiveStep,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableIntents = [],\n\t\tavailableModels = [],\n\t\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tvariablesData,\n\t\tvalidation,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tisSaving,\n\t\tisPublishing,\n\t\tisLoading,\n\t\tfooterHint = 'Changes don’t affect customers until you go live',\n\t\tdisableStepNavigation,\n\t\tdebugLog,\n\t} = config;\n\n\tconst [modalMode, setModalMode] = useState<GoLiveModalMode>(null);\n\tconst [publishingLocal, setPublishingLocal] = useState(false);\n\t// True while onTestAgent's async work (e.g. save-as-draft before the test\n\t// modal opens) is in flight — loads + disables the Test agent button.\n\tconst [testingLocal, setTestingLocal] = useState(false);\n\t// Back was pressed → confirm leaving (save draft / discard) before navigating.\n\tconst [showLeaveConfirm, setShowLeaveConfirm] = useState(false);\n\tconst [savingAndLeaving, setSavingAndLeaving] = useState(false);\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentBuilder] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleChange = useCallback(\n\t\t(patch: Partial<AgentValue>) => {\n\t\t\tlogAction('onChange', patch);\n\t\t\tonChange(patch);\n\t\t},\n\t\t[logAction, onChange],\n\t);\n\tconst handleStepChange = useCallback(\n\t\t(step: Parameters<NonNullable<typeof onStepChange>>[0]) => {\n\t\t\tlogAction('onStepChange', step);\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[logAction, onStepChange],\n\t);\n\tconst handleSaveDraft = useCallback(() => {\n\t\tlogAction('onSaveDraft');\n\t\treturn onSaveDraft();\n\t}, [logAction, onSaveDraft]);\n\tconst handlePublish = useCallback(() => {\n\t\tlogAction('onPublish');\n\t\treturn onPublish();\n\t}, [logAction, onPublish]);\n\t// Back opens the \"Save as draft?\" confirmation rather than leaving directly.\n\tconst handleBack = useCallback(() => {\n\t\tlogAction('onBack');\n\t\tsetShowLeaveConfirm(true);\n\t}, [logAction]);\n\n\t// Modal \"Discard\" defers to the parent's discard handler (same as the top bar).\n\tconst handleDiscardAndLeave = useCallback(() => {\n\t\tlogAction('onDiscardAndLeave');\n\t\tsetShowLeaveConfirm(false);\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\n\tconst handleSaveDraftAndLeave = useCallback(async () => {\n\t\tlogAction('onSaveDraftAndLeave');\n\t\tconst result = onSaveDraft();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSavingAndLeaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSavingAndLeaving(false);\n\t\t\t}\n\t\t}\n\t\tsetShowLeaveConfirm(false);\n\t\tonBack?.();\n\t}, [logAction, onSaveDraft, onBack]);\n\tconst handleTestAgent = useCallback(async () => {\n\t\tlogAction('onTestAgent');\n\t\tconst result = onTestAgent?.();\n\t\t// A new agent saves as draft before the test modal opens — that's slow, so\n\t\t// disable + load the button until it settles (prevents double-triggering).\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetTestingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetTestingLocal(false);\n\t\t\t}\n\t\t}\n\t}, [logAction, onTestAgent]);\n\tconst handleGoToDashboard = useCallback(() => {\n\t\tlogAction('onGoToDashboard');\n\t\tonGoToDashboard?.();\n\t}, [logAction, onGoToDashboard]);\n\tconst handleCreateSubAgent = useCallback(\n\t\t(draft: SubAgentDraft) => {\n\t\t\tlogAction('onCreateSubAgent', draft);\n\t\t\treturn onCreateSubAgent\n\t\t\t\t? onCreateSubAgent(draft)\n\t\t\t\t: Promise.reject(new Error('onCreateSubAgent not provided'));\n\t\t},\n\t\t[logAction, onCreateSubAgent],\n\t);\n\n\tconst handleConfirmGoLive = async () => {\n\t\tlogAction('onGoLiveConfirm');\n\t\tconst result = handlePublish();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetPublishingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t\tsetModalMode('success');\n\t\t\t} finally {\n\t\t\t\tsetPublishingLocal(false);\n\t\t\t}\n\t\t} else {\n\t\t\tsetModalMode('success');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AgentBuilderProvider\n\t\t\tvalue={value}\n\t\t\tonChange={handleChange}\n\t\t\tactiveStep={activeStep}\n\t\t\tonStepChange={onStepChange ? handleStepChange : undefined}\n\t\t\tavailableTools={availableTools}\n\t\t\tavailableSubAgents={availableSubAgents}\n\t\t\tavailableIntents={availableIntents}\n\t\t\tavailableModels={availableModels}\n\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tvariablesData={variablesData}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tcharLimits={charLimits}\n\t\t\tdisableStepNavigation={disableStepNavigation}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? handleCreateSubAgent : undefined}\n\t\t\tonFetchSubAgent={onFetchSubAgent}\n\t\t\tonUpdateSubAgent={onUpdateSubAgent}\n\t\t\tonImproveSubAgent={onImproveSubAgent}\n\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t>\n\t\t\t<BuilderRoot data-test={rest['data-test'] ?? 'agent-builder'}>\n\t\t\t\t<AgentBuilderTopBar\n\t\t\t\t\tname={value.name}\n\t\t\t\t\tstatus={value.status}\n\t\t\t\t\tonBack={onBack ? handleBack : undefined}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<Main>\n\t\t\t\t\t<Rail>\n\t\t\t\t\t\t<StepRail />\n\t\t\t\t\t</Rail>\n\t\t\t\t\t<Content>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ContentCard>\n\t\t\t\t\t\t\t\t<StepScroll>\n\t\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t\t</StepScroll>\n\t\t\t\t\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\t\t\t\t\tisTesting={testingLocal}\n\t\t\t\t\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ContentCard>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Content>\n\t\t\t\t</Main>\n\n\t\t\t\t<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => {\n\t\t\t\t\t\tconst wasSuccess = modalMode === 'success';\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\tif (wasSuccess) {\n\t\t\t\t\t\t\thandleGoToDashboard();\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\tonConfirm={handleConfirmGoLive}\n\t\t\t\t\tonSaveDraft={() => {\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\thandleSaveDraft();\n\t\t\t\t\t}}\n\t\t\t\t\tonGoToDashboard={onGoToDashboard ? handleGoToDashboard : undefined}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<DiscardModal\n\t\t\t\t\topen={showLeaveConfirm}\n\t\t\t\t\tonClose={() => setShowLeaveConfirm(false)}\n\t\t\t\t\tonDiscard={handleDiscardAndLeave}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tdisableSaveDraft={!value.name.trim()}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<UndoToast />\n\t\t\t</BuilderRoot>\n\t\t</AgentBuilderProvider>\n\t);\n};\n\nAgentBuilder.displayName = 'AgentBuilder';\n"],"names":["StepContent","activeStep","useAgentBuilderContext","Step1About","Step2WhenItStepsIn","Step3HowItResponds","Step4HandoverRules","AgentBuilder","props","config","onChange","onStepChange","onDiscard","onSaveDraft","onPublish","onBack","onTestAgent","onGoToDashboard","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","onConnectIntegration","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","variablesData","validation","applicationType","charLimits","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","testingLocal","setTestingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","StepScroll","AgentBuilderFooter","GoLiveModal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U,UAAU,GACpBV,EAAa,SAAS;AAAA,gBACvB;AAAA,gBACA,cAAcN,KAAgBQ;AAAA,cAAA;AAAA,YAAA;AAAA,UAC/B,EAAA,CACD,EAAA,CAEF;AAAA,QAAA,GACD;AAAA,QAEA,gBAAA2B;AAAA,UAACa;AAAA,UAAA;AAAA,YACA,MAAM3C;AAAA,YACN,SAAS,MAAM;AACd,oBAAM4C,IAAa5C,MAAc;AACjC,cAAAC,EAAa,IAAI,GACb2C,KACHlB,EAAA;AAAA,YAEF;AAAA,YACA,WAAWG;AAAA,YACX,aAAa,MAAM;AAClB,cAAA5B,EAAa,IAAI,GACjBkB,GAAA;AAAA,YACD;AAAA,YACA,iBAAiB5C,IAAkBmD,IAAsB;AAAA,YACzD,cAAc/B,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAA2B;AAAA,UAACe;AAAA,UAAA;AAAA,YACA,MAAMtC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWc;AAAA,YACX,aAAaC;AAAA,YACb,kBAAkB,CAACxC,EAAM,KAAK,KAAA;AAAA,YAC9B,UAAUW,KAAYe;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBqC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEAjF,GAAa,cAAc;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AgentConfig, AgentHandoverConfig, AgentToolDoc, IntentOption, ModelOption, StepKey, StepValidation, SubAgentRef, Trigger } from '@bikdotai/bik-models/ai-agents';
|
|
2
2
|
import { ApplicationType } from '@bikdotai/bik-models/growth';
|
|
3
|
+
import { VariableListInterfaceV3 } from '../variable-picker-v3/model';
|
|
3
4
|
import { AgentCharLimits } from './constants/charLimits';
|
|
4
5
|
import { ConfigToolKey, ToolSource } from './constants/tools';
|
|
5
6
|
/**
|
|
@@ -232,6 +233,13 @@ export interface AgentBuilderConfig {
|
|
|
232
233
|
* {@link AgentBuilderProps.onConnectIntegration}.
|
|
233
234
|
*/
|
|
234
235
|
integrationStatus?: Partial<Record<ToolSource, boolean>>;
|
|
236
|
+
/**
|
|
237
|
+
* Variable catalog for the `@` picker's "Variables" view (the shared
|
|
238
|
+
* VariablePicker's `data` shape). Picking a variable inserts its
|
|
239
|
+
* `{{actualValue}}` token into the instructions / guardrails at the cursor.
|
|
240
|
+
* Omit (or pass empty) to hide the Variables category entirely.
|
|
241
|
+
*/
|
|
242
|
+
variablesData?: VariableListInterfaceV3[];
|
|
235
243
|
/** Host application context the merchant runs in (e.g. ApplicationType.MANIFEST). */
|
|
236
244
|
applicationType?: ApplicationType;
|
|
237
245
|
/** Optional consumer-supplied validity; merged over the builder's derived validity. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { VariableListInterfaceV3 } from '../../variable-picker-v3/model';
|
|
2
3
|
import { ConfigToolConfig, ConfigToolKey, ParamsBlob } from '../AgentBuilder.model';
|
|
3
4
|
import { AgentCharLimits } from '../constants/charLimits';
|
|
4
5
|
interface ConfigToolPanelProps {
|
|
@@ -18,6 +19,13 @@ interface ConfigToolPanelProps {
|
|
|
18
19
|
/** Optional "Improve with AI" for multiline fields. Omit to hide it. */
|
|
19
20
|
onImprove?: (text: string) => Promise<string>;
|
|
20
21
|
charLimits?: AgentCharLimits;
|
|
22
|
+
/**
|
|
23
|
+
* Variable catalog for the `@` trigger. When non-empty, `@` in the email
|
|
24
|
+
* tool's Subject / Send To / Reply To / CC opens the variable picker
|
|
25
|
+
* directly, and Message Instructions upgrades to the variables-only mention
|
|
26
|
+
* editor. Absent → the drawer behaves exactly as before.
|
|
27
|
+
*/
|
|
28
|
+
variablesData?: VariableListInterfaceV3[];
|
|
21
29
|
/** SideModal stacking order — raise it when opened over another drawer. */
|
|
22
30
|
zIndex?: number;
|
|
23
31
|
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useState as
|
|
4
|
-
import
|
|
5
|
-
import { TitleSmall as
|
|
6
|
-
import { COLORS as
|
|
7
|
-
import { FieldBlock as
|
|
8
|
-
import { AGENT_CHAR_LIMITS as
|
|
9
|
-
import { DRAWER_BODY_STYLE as
|
|
10
|
-
import { ToolInstructionsField as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
1
|
+
import { jsx as r, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import L from "../../../assets/icons/cross.svg.js";
|
|
3
|
+
import j, { useState as R, useRef as T } from "react";
|
|
4
|
+
import w from "styled-components";
|
|
5
|
+
import { TitleSmall as O, BodyCaption as F } from "../../TypographyStyle.js";
|
|
6
|
+
import { COLORS as u } from "../../../constants/Theme.js";
|
|
7
|
+
import { FieldBlock as P } from "../AgentBuilder.styled.js";
|
|
8
|
+
import { AGENT_CHAR_LIMITS as Y } from "../constants/charLimits.js";
|
|
9
|
+
import { DRAWER_BODY_STYLE as V, DRAWER_HEADER_STYLE as z, DrawerHeaderText as M } from "./DrawerHeaderText.js";
|
|
10
|
+
import { ToolInstructionsField as H } from "./ToolInstructionsField.js";
|
|
11
|
+
import { VariableTriggerArea as A } from "./VariableTriggerArea.js";
|
|
12
|
+
import { SideModal as W } from "../../side-modal/SideModal.js";
|
|
13
|
+
import { Switch as q } from "../../switch/Switch.js";
|
|
14
|
+
import { Input as G } from "../../input/Input.js";
|
|
15
|
+
import { Tag as N } from "../../tag/Tag.js";
|
|
16
|
+
const J = {
|
|
16
17
|
send_email: {
|
|
17
18
|
title: "Send email",
|
|
18
19
|
subtitle: "Notify someone by email when this agent can't continue. You pick the recipient, the AI drafts the message."
|
|
@@ -21,222 +22,267 @@ const V = {
|
|
|
21
22
|
title: "Send Slack message",
|
|
22
23
|
subtitle: "Post a message to a Slack channel. You pick the channel, the AI composes the message from the conversation."
|
|
23
24
|
}
|
|
24
|
-
},
|
|
25
|
+
}, K = ({
|
|
25
26
|
chips: n,
|
|
26
|
-
onChange:
|
|
27
|
-
placeholder:
|
|
28
|
-
nativeID:
|
|
29
|
-
hint:
|
|
27
|
+
onChange: s,
|
|
28
|
+
placeholder: h,
|
|
29
|
+
nativeID: y,
|
|
30
|
+
hint: C,
|
|
31
|
+
variablesData: E
|
|
30
32
|
}) => {
|
|
31
|
-
const [
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
|
|
33
|
+
const [i, g] = R(""), [$, a] = R(!1), v = T(null), S = T(null), x = () => {
|
|
34
|
+
const t = i.split(",").map((c) => c.trim()).filter(Boolean);
|
|
35
|
+
t.length && s([...n, ...t.filter((c) => !n.includes(c))]), g("");
|
|
36
|
+
}, f = T(x);
|
|
37
|
+
f.current = x;
|
|
38
|
+
const b = T(!1), l = T(!1);
|
|
39
|
+
return /* @__PURE__ */ I(X, { ref: v, children: [
|
|
36
40
|
/* @__PURE__ */ r(
|
|
37
|
-
|
|
41
|
+
A,
|
|
38
42
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
addDataButton: !0,
|
|
44
|
+
variablesData: E,
|
|
45
|
+
onOpenChange: (t) => {
|
|
46
|
+
b.current = t, !t && setTimeout(() => {
|
|
47
|
+
!l.current && !v.current?.contains(document.activeElement) && f.current(), l.current = !1;
|
|
48
|
+
}, 0);
|
|
49
|
+
},
|
|
50
|
+
onInsert: (t, c) => {
|
|
51
|
+
l.current = !0;
|
|
52
|
+
const k = c ?? i.length;
|
|
53
|
+
g(`${i.slice(0, k)}${t}${i.slice(k)}`), requestAnimationFrame(() => {
|
|
54
|
+
const p = S.current;
|
|
55
|
+
p?.focus(), p?.setSelectionRange(k + t.length, k + t.length);
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
children: /* @__PURE__ */ r(
|
|
59
|
+
Z,
|
|
60
|
+
{
|
|
61
|
+
id: y,
|
|
62
|
+
ref: S,
|
|
63
|
+
type: "text",
|
|
64
|
+
placeholder: $ && i === "" && (E?.length ?? 0) > 0 ? "Enter text, type @ to add variable" : h,
|
|
65
|
+
value: i,
|
|
66
|
+
onChange: (t) => g(t.target.value),
|
|
67
|
+
onFocus: () => a(!0),
|
|
68
|
+
onBlur: () => {
|
|
69
|
+
a(!1), setTimeout(() => {
|
|
70
|
+
!b.current && !v.current?.contains(document.activeElement) && f.current();
|
|
71
|
+
}, 0);
|
|
72
|
+
},
|
|
73
|
+
onKeyDown: (t) => {
|
|
74
|
+
t.key === "Enter" || t.key === "," ? (t.preventDefault(), x()) : t.key === "Backspace" && i === "" && n.length > 0 && s(n.slice(0, -1));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
)
|
|
48
78
|
}
|
|
49
79
|
),
|
|
50
|
-
|
|
51
|
-
n.length > 0 && /* @__PURE__ */ r(
|
|
52
|
-
|
|
80
|
+
C,
|
|
81
|
+
n.length > 0 && /* @__PURE__ */ r(ee, { children: n.map((t, c) => /* @__PURE__ */ r(
|
|
82
|
+
N,
|
|
53
83
|
{
|
|
54
|
-
tagText:
|
|
84
|
+
tagText: t.replace(/\{\{variable:([^}]+)\}\}/g, "{{$1}}"),
|
|
55
85
|
theme: "light",
|
|
56
86
|
type: "neutral",
|
|
57
87
|
variant: "regular",
|
|
58
|
-
TrailingIcon:
|
|
59
|
-
onTrailingIconClicked: () =>
|
|
88
|
+
TrailingIcon: L,
|
|
89
|
+
onTrailingIconClicked: () => s(n.filter((k, p) => p !== c))
|
|
60
90
|
},
|
|
61
|
-
`${
|
|
91
|
+
`${t}-${c}`
|
|
62
92
|
)) })
|
|
63
93
|
] });
|
|
64
|
-
},
|
|
65
|
-
const
|
|
66
|
-
return Object.keys(n).forEach((
|
|
67
|
-
|
|
68
|
-
}),
|
|
69
|
-
},
|
|
94
|
+
}, Q = (n, s) => {
|
|
95
|
+
const h = {};
|
|
96
|
+
return Object.keys(n).forEach((y) => {
|
|
97
|
+
h[y] = s?.params[y]?.value ?? n[y].value;
|
|
98
|
+
}), h;
|
|
99
|
+
}, U = (n) => String(n ?? "").split(",").map((s) => s.trim()).filter(Boolean), ke = ({
|
|
70
100
|
toolKey: n,
|
|
71
|
-
template:
|
|
72
|
-
onClose:
|
|
73
|
-
onSave:
|
|
74
|
-
initial:
|
|
75
|
-
onImprove:
|
|
76
|
-
charLimits:
|
|
77
|
-
|
|
101
|
+
template: s,
|
|
102
|
+
onClose: h,
|
|
103
|
+
onSave: y,
|
|
104
|
+
initial: C,
|
|
105
|
+
onImprove: E,
|
|
106
|
+
charLimits: i = Y,
|
|
107
|
+
variablesData: g,
|
|
108
|
+
zIndex: $
|
|
78
109
|
}) => {
|
|
79
|
-
const [
|
|
80
|
-
() =>
|
|
81
|
-
), [
|
|
82
|
-
(
|
|
83
|
-
), I = async () => {
|
|
84
|
-
if (!T || x)
|
|
110
|
+
const [a, v] = R(
|
|
111
|
+
() => Q(s, C)
|
|
112
|
+
), [S, x] = R(!1), f = Object.values(s), b = n === "send_email", l = (e, m) => v((d) => ({ ...d, [e]: m })), t = f.every((e) => !(e.required && String(a[e.key] ?? "").trim() === "" || e.component === "MultilineInput" && String(a[e.key] ?? "").length > i.instructions)), c = async () => {
|
|
113
|
+
if (!t || S)
|
|
85
114
|
return;
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
115
|
+
const e = {};
|
|
116
|
+
f.forEach((o) => {
|
|
117
|
+
e[o.key] = { ...o, value: a[o.key] };
|
|
89
118
|
});
|
|
90
|
-
const
|
|
91
|
-
id:
|
|
119
|
+
const m = {
|
|
120
|
+
id: C?.id ?? `${n}_${Date.now().toString(36)}`,
|
|
92
121
|
tool_key: n,
|
|
93
|
-
params:
|
|
94
|
-
},
|
|
95
|
-
if (
|
|
96
|
-
|
|
122
|
+
params: e
|
|
123
|
+
}, d = y(m);
|
|
124
|
+
if (d && typeof d.then == "function") {
|
|
125
|
+
x(!0);
|
|
97
126
|
try {
|
|
98
|
-
await
|
|
127
|
+
await d;
|
|
99
128
|
} finally {
|
|
100
|
-
|
|
129
|
+
x(!1);
|
|
101
130
|
}
|
|
102
131
|
}
|
|
103
|
-
},
|
|
104
|
-
const
|
|
105
|
-
switch (
|
|
132
|
+
}, k = (e) => {
|
|
133
|
+
const m = `config-tool-${e.key.toLowerCase()}`;
|
|
134
|
+
switch (e.component) {
|
|
106
135
|
// Multi-value email chips — only for the email tool. Slack's KeywordInput
|
|
107
136
|
// (channelId) falls through to the plain input below.
|
|
108
137
|
case "KeywordInput":
|
|
109
|
-
if (!
|
|
138
|
+
if (!b)
|
|
110
139
|
break;
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */ r(
|
|
140
|
+
return /* @__PURE__ */ I(P, { children: [
|
|
141
|
+
/* @__PURE__ */ r(O, { color: u.content.primary, children: e.title }),
|
|
113
142
|
/* @__PURE__ */ r(
|
|
114
|
-
|
|
143
|
+
K,
|
|
115
144
|
{
|
|
116
|
-
nativeID:
|
|
117
|
-
placeholder:
|
|
118
|
-
chips:
|
|
119
|
-
onChange: (o) =>
|
|
120
|
-
|
|
145
|
+
nativeID: m,
|
|
146
|
+
placeholder: e.hint ?? "",
|
|
147
|
+
chips: U(a[e.key]),
|
|
148
|
+
onChange: (o) => l(e.key, o.join(",")),
|
|
149
|
+
variablesData: g,
|
|
150
|
+
hint: /* @__PURE__ */ r(F, { color: u.content.secondary, children: "Press Enter or comma to add multiple emails" })
|
|
121
151
|
}
|
|
122
152
|
)
|
|
123
|
-
] },
|
|
153
|
+
] }, e.key);
|
|
124
154
|
case "MultilineInput":
|
|
125
155
|
return /* @__PURE__ */ r(
|
|
126
|
-
|
|
156
|
+
H,
|
|
127
157
|
{
|
|
128
|
-
"data-test":
|
|
129
|
-
label:
|
|
130
|
-
value: String(e
|
|
131
|
-
onChange: (o) =>
|
|
132
|
-
maxLength:
|
|
133
|
-
placeholder:
|
|
134
|
-
onImprove:
|
|
158
|
+
"data-test": m,
|
|
159
|
+
label: e.title,
|
|
160
|
+
value: String(a[e.key] ?? ""),
|
|
161
|
+
onChange: (o) => l(e.key, o),
|
|
162
|
+
maxLength: i.instructions,
|
|
163
|
+
placeholder: e.hint ?? "",
|
|
164
|
+
onImprove: E,
|
|
165
|
+
variablesData: g
|
|
135
166
|
},
|
|
136
|
-
|
|
167
|
+
e.key
|
|
137
168
|
);
|
|
138
169
|
case "Switch":
|
|
139
|
-
return /* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
141
|
-
/* @__PURE__ */ r(
|
|
142
|
-
|
|
170
|
+
return /* @__PURE__ */ I(te, { children: [
|
|
171
|
+
/* @__PURE__ */ I(ne, { children: [
|
|
172
|
+
/* @__PURE__ */ r(O, { color: u.content.primary, children: e.title }),
|
|
173
|
+
e.hint && /* @__PURE__ */ r(F, { color: u.content.secondary, children: e.hint })
|
|
143
174
|
] }),
|
|
144
175
|
/* @__PURE__ */ r(
|
|
145
|
-
|
|
176
|
+
q,
|
|
146
177
|
{
|
|
147
|
-
"data-test":
|
|
148
|
-
value: !!e
|
|
149
|
-
onValueChange: async (o) =>
|
|
178
|
+
"data-test": m,
|
|
179
|
+
value: !!a[e.key],
|
|
180
|
+
onValueChange: async (o) => l(e.key, o)
|
|
150
181
|
}
|
|
151
182
|
)
|
|
152
|
-
] },
|
|
183
|
+
] }, e.key);
|
|
153
184
|
}
|
|
154
|
-
|
|
155
|
-
|
|
185
|
+
const d = /* @__PURE__ */ r(
|
|
186
|
+
G,
|
|
156
187
|
{
|
|
157
|
-
"data-test":
|
|
188
|
+
"data-test": m,
|
|
158
189
|
variant: "small",
|
|
159
|
-
labelText:
|
|
190
|
+
labelText: e.title,
|
|
160
191
|
labelTextBold: !0,
|
|
161
|
-
placeholder:
|
|
162
|
-
value: String(e
|
|
163
|
-
onChangeText: (o) =>
|
|
164
|
-
}
|
|
165
|
-
t.key
|
|
192
|
+
placeholder: e.hint ?? "",
|
|
193
|
+
value: String(a[e.key] ?? ""),
|
|
194
|
+
onChangeText: (o) => l(e.key, o)
|
|
195
|
+
}
|
|
166
196
|
);
|
|
167
|
-
|
|
197
|
+
return b ? /* @__PURE__ */ r(
|
|
198
|
+
A,
|
|
199
|
+
{
|
|
200
|
+
addDataButton: !0,
|
|
201
|
+
variablesData: g,
|
|
202
|
+
onInsert: (o, D) => {
|
|
203
|
+
const B = String(a[e.key] ?? ""), _ = D ?? B.length;
|
|
204
|
+
l(
|
|
205
|
+
e.key,
|
|
206
|
+
`${B.slice(0, _)}${o}${B.slice(_)}`
|
|
207
|
+
);
|
|
208
|
+
},
|
|
209
|
+
children: d
|
|
210
|
+
},
|
|
211
|
+
e.key
|
|
212
|
+
) : /* @__PURE__ */ r(j.Fragment, { children: d }, e.key);
|
|
213
|
+
}, p = J[n];
|
|
168
214
|
return /* @__PURE__ */ r(
|
|
169
|
-
|
|
215
|
+
W,
|
|
170
216
|
{
|
|
171
|
-
header:
|
|
217
|
+
header: p.title,
|
|
172
218
|
closeOnEscapeKey: !1,
|
|
173
|
-
zIndex:
|
|
174
|
-
headerCustomComponent: /* @__PURE__ */ r(
|
|
219
|
+
zIndex: $,
|
|
220
|
+
headerCustomComponent: /* @__PURE__ */ r(M, { title: p.title, subtitle: p.subtitle }),
|
|
175
221
|
hideCrossButton: !1,
|
|
176
222
|
width: "431px",
|
|
177
|
-
headerStyle:
|
|
178
|
-
bodyStyle:
|
|
179
|
-
onClose:
|
|
223
|
+
headerStyle: z,
|
|
224
|
+
bodyStyle: V,
|
|
225
|
+
onClose: h,
|
|
180
226
|
saveButtonProps: {
|
|
181
227
|
"data-test": "config-tool-save",
|
|
182
228
|
buttonText: "Save",
|
|
183
229
|
buttonType: "primary",
|
|
184
230
|
size: "small",
|
|
185
|
-
disabled: !
|
|
186
|
-
isLoading:
|
|
187
|
-
onClick:
|
|
231
|
+
disabled: !t,
|
|
232
|
+
isLoading: S,
|
|
233
|
+
onClick: c
|
|
188
234
|
},
|
|
189
235
|
cancelButtonProps: {
|
|
190
236
|
"data-test": "config-tool-cancel",
|
|
191
237
|
buttonText: "Cancel",
|
|
192
238
|
buttonType: "tertiaryGray",
|
|
193
239
|
size: "small",
|
|
194
|
-
onClick:
|
|
240
|
+
onClick: h
|
|
195
241
|
},
|
|
196
|
-
children:
|
|
242
|
+
children: f.map(k)
|
|
197
243
|
}
|
|
198
244
|
);
|
|
199
|
-
},
|
|
245
|
+
}, X = w.div`
|
|
200
246
|
display: flex;
|
|
201
247
|
flex-direction: column;
|
|
202
248
|
gap: 8px;
|
|
203
|
-
`,
|
|
249
|
+
`, Z = w.input`
|
|
204
250
|
width: 100%;
|
|
205
251
|
min-width: 0;
|
|
206
252
|
box-sizing: border-box;
|
|
207
253
|
height: 32px;
|
|
208
254
|
padding: 0 8px;
|
|
209
|
-
border: 1px solid ${
|
|
255
|
+
border: 1px solid ${u.stroke.primary};
|
|
210
256
|
border-radius: 4px;
|
|
211
257
|
font-family: 'Inter', sans-serif;
|
|
212
258
|
font-size: 14px;
|
|
213
|
-
color: ${
|
|
214
|
-
background: ${
|
|
259
|
+
color: ${u.content.primary};
|
|
260
|
+
background: ${u.surface.standard};
|
|
215
261
|
outline: none;
|
|
216
262
|
|
|
217
263
|
&::placeholder {
|
|
218
|
-
color: ${
|
|
264
|
+
color: ${u.content.secondary};
|
|
219
265
|
}
|
|
220
266
|
|
|
221
267
|
&:focus {
|
|
222
|
-
border-color: ${
|
|
268
|
+
border-color: ${u.stroke.brand};
|
|
223
269
|
}
|
|
224
|
-
`,
|
|
270
|
+
`, ee = w.div`
|
|
225
271
|
display: flex;
|
|
226
272
|
flex-wrap: wrap;
|
|
227
273
|
gap: 6px;
|
|
228
|
-
`,
|
|
274
|
+
`, te = w.div`
|
|
229
275
|
display: flex;
|
|
230
276
|
align-items: center;
|
|
231
277
|
justify-content: space-between;
|
|
232
278
|
gap: 12px;
|
|
233
|
-
`,
|
|
279
|
+
`, ne = w.div`
|
|
234
280
|
display: flex;
|
|
235
281
|
flex-direction: column;
|
|
236
282
|
gap: 4px;
|
|
237
283
|
min-width: 0;
|
|
238
284
|
`;
|
|
239
285
|
export {
|
|
240
|
-
|
|
286
|
+
ke as ConfigToolPanel
|
|
241
287
|
};
|
|
242
288
|
//# sourceMappingURL=ConfigToolPanel.js.map
|