@bikdotai/bik-component-library 0.0.821 → 0.0.822-beta.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.
Files changed (77) hide show
  1. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  2. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +66 -90
  4. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +1 -1
  6. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/MentionPicker.js +19 -19
  8. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +14 -1
  10. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/constants/charLimits.js.map +1 -1
  12. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  13. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  14. package/dist/cjs/components/agent-builder/steps/Step1About.js +1 -1
  15. package/dist/cjs/components/agent-builder/steps/Step1About.js.map +1 -1
  16. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +1 -1
  17. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  18. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  19. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  20. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
  21. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  22. package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
  23. package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
  24. package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
  25. package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
  26. package/dist/cjs/components/agent-listing/AgentListingFilters.js +1 -1
  27. package/dist/cjs/components/agent-listing/AgentListingFilters.js.map +1 -1
  28. package/dist/cjs/components/dropdown/utils.js +2 -0
  29. package/dist/cjs/components/dropdown/utils.js.map +1 -0
  30. package/dist/cjs/index.js +1 -1
  31. package/dist/cjs/utils/arrayUtils.js +2 -0
  32. package/dist/cjs/utils/arrayUtils.js.map +1 -0
  33. package/dist/esm/components/agent-builder/AgentBuilder.js +67 -65
  34. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  35. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +7 -0
  36. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +117 -141
  37. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  38. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +3 -0
  39. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +95 -96
  40. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  41. package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +4 -0
  42. package/dist/esm/components/agent-builder/components/MentionPicker.js +64 -69
  43. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  44. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +10 -0
  45. package/dist/esm/components/agent-builder/components/SelectableListSection.js +161 -106
  46. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  47. package/dist/esm/components/agent-builder/constants/charLimits.d.ts +6 -0
  48. package/dist/esm/components/agent-builder/constants/charLimits.js.map +1 -1
  49. package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +4 -0
  50. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +126 -120
  51. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  52. package/dist/esm/components/agent-builder/index.d.ts +1 -0
  53. package/dist/esm/components/agent-builder/steps/Step1About.js +6 -7
  54. package/dist/esm/components/agent-builder/steps/Step1About.js.map +1 -1
  55. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +59 -59
  56. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  57. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +114 -109
  58. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  59. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +26 -27
  60. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  61. package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +6 -0
  62. package/dist/esm/components/agent-builder/utils/sourceIcons.js +12 -7
  63. package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
  64. package/dist/esm/components/agent-listing/AgentListing.js +91 -90
  65. package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
  66. package/dist/esm/components/agent-listing/AgentListingFilters.js +31 -30
  67. package/dist/esm/components/agent-listing/AgentListingFilters.js.map +1 -1
  68. package/dist/esm/components/dropdown/index.d.ts +1 -0
  69. package/dist/esm/components/dropdown/utils.d.ts +9 -0
  70. package/dist/esm/components/dropdown/utils.js +5 -0
  71. package/dist/esm/components/dropdown/utils.js.map +1 -0
  72. package/dist/esm/index.js +10 -8
  73. package/dist/esm/index.js.map +1 -1
  74. package/dist/esm/utils/arrayUtils.d.ts +7 -0
  75. package/dist/esm/utils/arrayUtils.js +5 -0
  76. package/dist/esm/utils/arrayUtils.js.map +1 -0
  77. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AgentBuilderContext.js","sources":["../../../../../src/components/agent-builder/context/AgentBuilderContext.tsx"],"sourcesContent":["import type { ApplicationType } from '@bikdotai/bik-models/growth';\nimport React, {\n\tuseCallback,\n\tuseContext,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport {\n\tAgentTool,\n\tAgentValue,\n\tIntentOption,\n\tModelOption,\n\tStepKey,\n\tStepValidation,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport { getStepIndex, STEP_KEYS } from '../constants/steps';\n\n/** Mention-capable text fields in Step 3 (both store firebase token text). */\nexport type MentionFieldKey = 'instructions' | 'guardrail';\ntype MentionInsertFn = (\n\tkind: 'tool' | 'subagent',\n\tid: string,\n\tlabel?: string,\n) => void;\n\n/** Toast shown after a tool / sub-agent is removed, offering an undo. */\nexport interface UndoToastState {\n\t/** Bumped per removal so the toast timer restarts. */\n\tid: number;\n\tmessage: string;\n}\n\nexport interface AgentBuilderContextShape {\n\t/** Controlled value relayed from props. */\n\tvalue: AgentValue;\n\t/** Patch one or more fields. */\n\tpatch: (partial: Partial<AgentValue>) => void;\n\t/** Patch a single field. */\n\tupdateField: <K extends keyof AgentValue>(key: K, val: AgentValue[K]) => void;\n\t/**\n\t * Remove a tool / sub-agent everywhere: drops it from the list AND strips ALL\n\t * its `{{tool:KEY}}` / `{{subagent:ID}}` tokens from BOTH the instructions and\n\t * the guardrails, remounts the editors, and raises an undo toast.\n\t */\n\tremoveReference: (kind: 'tool' | 'subagent', id: string) => void;\n\t/** Remount signal for the mention editors after an external edit. */\n\tmentionResetKey: number;\n\t/**\n\t * Insert a tool / sub-agent mention chip at the last cursor position of\n\t * whichever mention field was focused most recently (Instructions or\n\t * Guardrails). `label` overrides the chip text (e.g. a just-created sub-agent\n\t * not yet in the available list).\n\t */\n\tinsertMention: (\n\t\tkind: 'tool' | 'subagent',\n\t\tid: string,\n\t\tlabel?: string,\n\t) => void;\n\t/** A mention field registers its editor-backed insert here (internal). */\n\tregisterMentionField: (\n\t\tfieldKey: MentionFieldKey,\n\t\tfn: MentionInsertFn | null,\n\t) => void;\n\t/** A mention field reports focus so inserts target it (internal). */\n\tnotifyMentionFocus: (fieldKey: MentionFieldKey) => void;\n\n\t// Undo (post-removal)\n\t/** Non-null while the undo toast should be visible. */\n\tundoToast: UndoToastState | null;\n\t/** Restore the last removed tool / sub-agent (list + stripped tokens). */\n\tundoRemoval: () => void;\n\t/** Dismiss the undo toast without restoring. */\n\tdismissUndo: () => void;\n\n\t// Navigation\n\tactiveStep: StepKey;\n\tactiveIndex: number;\n\tgoToStep: (step: StepKey) => void;\n\tgoNext: () => void;\n\tgoPrev: () => void;\n\tisFirstStep: boolean;\n\tisLastStep: boolean;\n\n\t// Validation\n\tvalidation: StepValidation;\n\tisActiveStepValid: boolean;\n\n\t// Reference data\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\t/** Host application context (e.g. MANIFEST) — drives tool-chip labelling. */\n\tapplicationType?: ApplicationType;\n\t/** When true, step-rail items are not clickable (Back / Next only). */\n\tdisableStepNavigation: boolean;\n\n\t// Sub-agent creation (Step 3 drawer)\n\t/** Persist a new sub-agent and resolve with its ref. Omit to hide the create flow. */\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/**\n\t * Step 3 registers its \"open create-sub-agent drawer\" action here so the `@`\n\t * picker's \"Create new\" row can trigger it. Pass `null` to unregister.\n\t */\n\tregisterSubAgentCreator: (fn: (() => void) | null) => void;\n\t/** Open the create-sub-agent drawer (no-op until Step 3 registers it). */\n\trequestCreateSubAgent: () => void;\n\t/** Fetch a sub-agent's editable data (Configure). Omit to hide Configure. */\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\t/** Persist edits to an existing sub-agent. */\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/** Optional \"Improve with AI\" for the drawer's instructions / guardrails. */\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n}\n\nconst AgentBuilderContext =\n\tReact.createContext<AgentBuilderContextShape | null>(null);\n\nexport const useAgentBuilderContext = (): AgentBuilderContextShape => {\n\tconst ctx = useContext(AgentBuilderContext);\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t'useAgentBuilderContext must be used within an AgentBuilderProvider',\n\t\t);\n\t}\n\treturn ctx;\n};\n\n/** Validity derived purely from the current value (no effects). */\nconst deriveValidation = (value: AgentValue): StepValidation => {\n\tconst triggerValid =\n\t\tvalue.trigger.mode === 'custom_intent'\n\t\t\t? (value.trigger.custom_intent ?? '').trim().length > 0\n\t\t\t: value.trigger.intents.length > 0;\n\n\treturn {\n\t\tabout:\n\t\t\tvalue.name.trim().length > 0 &&\n\t\t\tvalue.name.length <= AGENT_CHAR_LIMITS.name &&\n\t\t\tvalue.description.length <= AGENT_CHAR_LIMITS.description,\n\t\ttrigger: triggerValid,\n\t\t// At least one of Instructions / Guardrails must be filled.\n\t\tresponse:\n\t\t\tvalue.instructions.trim().length > 0 ||\n\t\t\t(value.guardrail ?? '').trim().length > 0,\n\t\t// Optional until specced further — never blocks go-live.\n\t\thandover: true,\n\t};\n};\n\ninterface ProviderProps {\n\tvalue: AgentValue;\n\tonChange: (patch: Partial<AgentValue>) => void;\n\tactiveStep?: StepKey;\n\tonStepChange?: (step: StepKey) => void;\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\tvalidation?: Partial<StepValidation>;\n\tapplicationType?: ApplicationType;\n\tdisableStepNavigation?: boolean;\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\tchildren: React.ReactNode;\n}\n\nexport const AgentBuilderProvider: React.FC<ProviderProps> = ({\n\tvalue,\n\tonChange,\n\tactiveStep: controlledStep,\n\tonStepChange,\n\tavailableTools,\n\tavailableSubAgents,\n\tavailableIntents,\n\tavailableModels,\n\tvalidation: validationOverride,\n\tapplicationType,\n\tdisableStepNavigation = true,\n\tonCreateSubAgent,\n\tonFetchSubAgent,\n\tonUpdateSubAgent,\n\tonImproveSubAgent,\n\tchildren,\n}) => {\n\tconst [internalStep, setInternalStep] = useState<StepKey>('about');\n\tconst activeStep = controlledStep ?? internalStep;\n\tconst activeIndex = getStepIndex(activeStep);\n\n\t// Bumped when a mention field is edited from OUTSIDE its editor (removing a\n\t// tool from the side list, undo), forcing the mention editors to remount.\n\tconst [mentionResetKey, setMentionResetKey] = useState(0);\n\n\t// Each mention field registers an editor-backed insert fn + reports focus, so\n\t// side-panel adds drop a chip into the last-focused field at its cursor.\n\tconst mentionInsertersRef = useRef<\n\t\tPartial<Record<MentionFieldKey, MentionInsertFn>>\n\t>({});\n\tconst lastFocusedFieldRef = useRef<MentionFieldKey>('instructions');\n\tconst registerMentionField = useCallback(\n\t\t(fieldKey: MentionFieldKey, fn: MentionInsertFn | null) => {\n\t\t\tif (fn) {\n\t\t\t\tmentionInsertersRef.current[fieldKey] = fn;\n\t\t\t} else {\n\t\t\t\tdelete mentionInsertersRef.current[fieldKey];\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\tconst notifyMentionFocus = useCallback((fieldKey: MentionFieldKey) => {\n\t\tlastFocusedFieldRef.current = fieldKey;\n\t}, []);\n\n\t// Step 3 registers its drawer opener here; the `@` picker's \"Create new\" calls it.\n\tconst subAgentCreatorRef = useRef<(() => void) | null>(null);\n\tconst registerSubAgentCreator = useCallback((fn: (() => void) | null) => {\n\t\tsubAgentCreatorRef.current = fn;\n\t}, []);\n\tconst requestCreateSubAgent = useCallback(() => {\n\t\tsubAgentCreatorRef.current?.();\n\t}, []);\n\tconst insertMention = useCallback<MentionInsertFn>((kind, id, label) => {\n\t\tconst inserters = mentionInsertersRef.current;\n\t\tconst target =\n\t\t\tinserters[lastFocusedFieldRef.current] ?? inserters.instructions;\n\t\ttarget?.(kind, id, label);\n\t}, []);\n\n\t// Undo state for the most recent removal.\n\tconst [undoToast, setUndoToast] = useState<UndoToastState | null>(null);\n\tconst undoSnapshotRef = useRef<Partial<AgentValue> | null>(null);\n\tconst undoIdRef = useRef(0);\n\n\tconst goToStep = useCallback(\n\t\t(step: StepKey) => {\n\t\t\tif (controlledStep === undefined) {\n\t\t\t\tsetInternalStep(step);\n\t\t\t}\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[controlledStep, onStepChange],\n\t);\n\n\tconst goNext = useCallback(() => {\n\t\tconst next = STEP_KEYS[Math.min(activeIndex + 1, STEP_KEYS.length - 1)];\n\t\tgoToStep(next);\n\t}, [activeIndex, goToStep]);\n\n\tconst goPrev = useCallback(() => {\n\t\tconst prev = STEP_KEYS[Math.max(activeIndex - 1, 0)];\n\t\tgoToStep(prev);\n\t}, [activeIndex, goToStep]);\n\n\tconst patch = useCallback(\n\t\t(partial: Partial<AgentValue>) => onChange(partial),\n\t\t[onChange],\n\t);\n\n\tconst updateField = useCallback(\n\t\t<K extends keyof AgentValue>(key: K, val: AgentValue[K]) =>\n\t\t\tonChange({ [key]: val } as Partial<AgentValue>),\n\t\t[onChange],\n\t);\n\n\tconst removeReference = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\tconst token =\n\t\t\t\tkind === 'tool'\n\t\t\t\t\t? (() => {\n\t\t\t\t\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\t\t\t\t\treturn tool ? `{{tool:${tool.function_key}}}` : null;\n\t\t\t\t\t })()\n\t\t\t\t\t: `{{subagent:${id}}}`;\n\t\t\tconst strip = (text: string) =>\n\t\t\t\ttoken ? text.split(token).join('') : text;\n\n\t\t\t// Snapshot the four fields a removal touches, for undo.\n\t\t\tundoSnapshotRef.current = {\n\t\t\t\ttools: value.tools,\n\t\t\t\tsubagents: value.subagents,\n\t\t\t\tinstructions: value.instructions,\n\t\t\t\tguardrail: value.guardrail,\n\t\t\t};\n\n\t\t\tconst next: Partial<AgentValue> = {\n\t\t\t\tinstructions: strip(value.instructions),\n\t\t\t\tguardrail: strip(value.guardrail ?? ''),\n\t\t\t\t...(kind === 'tool'\n\t\t\t\t\t? { tools: value.tools.filter((t) => t !== id) }\n\t\t\t\t\t: { subagents: value.subagents.filter((s) => s !== id) }),\n\t\t\t};\n\t\t\tonChange(next);\n\t\t\tsetMentionResetKey((k) => k + 1);\n\n\t\t\tconst label =\n\t\t\t\tkind === 'tool'\n\t\t\t\t\t? availableTools.find((t) => t.tool_id === id)?.display_name ?? 'Tool'\n\t\t\t\t\t: availableSubAgents.find((s) => s.id === id)?.name ?? 'Sub-agent';\n\t\t\tundoIdRef.current += 1;\n\t\t\tsetUndoToast({\n\t\t\t\tid: undoIdRef.current,\n\t\t\t\tmessage: `${kind === 'tool' ? 'Tool' : 'Sub-agent'} \"${label}\" removed`,\n\t\t\t});\n\t\t},\n\t\t[availableTools, availableSubAgents, value, onChange],\n\t);\n\n\tconst undoRemoval = useCallback(() => {\n\t\tif (undoSnapshotRef.current) {\n\t\t\tonChange(undoSnapshotRef.current);\n\t\t\tundoSnapshotRef.current = null;\n\t\t\tsetMentionResetKey((k) => k + 1);\n\t\t}\n\t\tsetUndoToast(null);\n\t}, [onChange]);\n\n\tconst dismissUndo = useCallback(() => setUndoToast(null), []);\n\n\tconst validation: StepValidation = useMemo(\n\t\t() => ({ ...deriveValidation(value), ...validationOverride }),\n\t\t[value, validationOverride],\n\t);\n\n\tconst ctx = useMemo<AgentBuilderContextShape>(\n\t\t() => ({\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tisFirstStep: activeIndex === 0,\n\t\t\tisLastStep: activeIndex === STEP_KEYS.length - 1,\n\t\t\tvalidation,\n\t\t\tisActiveStepValid: validation[activeStep],\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tapplicationType,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t}),\n\t\t[\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tvalidation,\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tapplicationType,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t],\n\t);\n\n\treturn (\n\t\t<AgentBuilderContext.Provider value={ctx}>\n\t\t\t{children}\n\t\t</AgentBuilderContext.Provider>\n\t);\n};\n"],"names":["AgentBuilderContext","React","useAgentBuilderContext","ctx","useContext","deriveValidation","value","triggerValid","AGENT_CHAR_LIMITS","AgentBuilderProvider","onChange","controlledStep","onStepChange","availableTools","availableSubAgents","availableIntents","availableModels","validationOverride","applicationType","disableStepNavigation","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","children","internalStep","setInternalStep","useState","activeStep","activeIndex","getStepIndex","mentionResetKey","setMentionResetKey","mentionInsertersRef","useRef","lastFocusedFieldRef","registerMentionField","useCallback","fieldKey","fn","notifyMentionFocus","subAgentCreatorRef","registerSubAgentCreator","requestCreateSubAgent","insertMention","kind","id","label","inserters","undoToast","setUndoToast","undoSnapshotRef","undoIdRef","goToStep","step","goNext","next","STEP_KEYS","goPrev","prev","patch","partial","updateField","key","val","removeReference","token","tool","t","strip","text","k","undoRemoval","dismissUndo","validation","useMemo"],"mappings":"sRA0HMA,EACLC,GAAAA,QAAM,cAA+C,IAAI,EAE7CC,GAAyB,IAAgC,CACrE,MAAMC,EAAMC,EAAAA,WAAWJ,CAAmB,EAC1C,GAAI,CAACG,EACJ,MAAM,IAAI,MACT,oEAAA,EAGF,OAAOA,CACR,EAGME,GAAoBC,GAAsC,CAC/D,MAAMC,EACLD,EAAM,QAAQ,OAAS,iBACnBA,EAAM,QAAQ,eAAiB,IAAI,KAAA,EAAO,OAAS,EACpDA,EAAM,QAAQ,QAAQ,OAAS,EAEnC,MAAO,CACN,MACCA,EAAM,KAAK,KAAA,EAAO,OAAS,GAC3BA,EAAM,KAAK,QAAUE,EAAAA,kBAAkB,MACvCF,EAAM,YAAY,QAAUE,EAAAA,kBAAkB,YAC/C,QAASD,EAET,SACCD,EAAM,aAAa,KAAA,EAAO,OAAS,IAClCA,EAAM,WAAa,IAAI,KAAA,EAAO,OAAS,EAEzC,SAAU,EAAA,CAEZ,EAwBaG,GAAgD,CAAC,CAC7D,MAAAH,EACA,SAAAI,EACA,WAAYC,EACZ,aAAAC,EACA,eAAAC,EACA,mBAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,WAAYC,EACZ,gBAAAC,EACA,sBAAAC,EAAwB,GACxB,iBAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,SAAAC,CACD,IAAM,CACL,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E,EACAG,EACAgB,EACA7D,EACAC,EACAC,EACAC,EACAE,EACAC,EACAC,EACAsB,EACAC,EACAtB,EACAC,EACAC,CAAA,CACD,EAGD,cACEvB,EAAoB,SAApB,CAA6B,MAAOG,EACnC,SAAAqB,EACF,CAEF"}
1
+ {"version":3,"file":"AgentBuilderContext.js","sources":["../../../../../src/components/agent-builder/context/AgentBuilderContext.tsx"],"sourcesContent":["import type { ApplicationType } from '@bikdotai/bik-models/growth';\nimport React, {\n\tuseCallback,\n\tuseContext,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport {\n\tAgentTool,\n\tAgentValue,\n\tIntentOption,\n\tModelOption,\n\tStepKey,\n\tStepValidation,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { getStepIndex, STEP_KEYS } from '../constants/steps';\n\n/** Mention-capable text fields in Step 3 (both store firebase token text). */\nexport type MentionFieldKey = 'instructions' | 'guardrail';\ntype MentionInsertFn = (\n\tkind: 'tool' | 'subagent',\n\tid: string,\n\tlabel?: string,\n) => void;\n\n/** Toast shown after a tool / sub-agent is removed, offering an undo. */\nexport interface UndoToastState {\n\t/** Bumped per removal so the toast timer restarts. */\n\tid: number;\n\tmessage: string;\n}\n\nexport interface AgentBuilderContextShape {\n\t/** Controlled value relayed from props. */\n\tvalue: AgentValue;\n\t/** Patch one or more fields. */\n\tpatch: (partial: Partial<AgentValue>) => void;\n\t/** Patch a single field. */\n\tupdateField: <K extends keyof AgentValue>(key: K, val: AgentValue[K]) => void;\n\t/**\n\t * Remove a tool / sub-agent everywhere: drops it from the list AND strips ALL\n\t * its `{{tool:KEY}}` / `{{subagent:ID}}` tokens from BOTH the instructions and\n\t * the guardrails, remounts the editors, and raises an undo toast.\n\t */\n\tremoveReference: (kind: 'tool' | 'subagent', id: string) => void;\n\t/** Remount signal for the mention editors after an external edit. */\n\tmentionResetKey: number;\n\t/**\n\t * Insert a tool / sub-agent mention chip at the last cursor position of\n\t * whichever mention field was focused most recently (Instructions or\n\t * Guardrails). `label` overrides the chip text (e.g. a just-created sub-agent\n\t * not yet in the available list).\n\t */\n\tinsertMention: (\n\t\tkind: 'tool' | 'subagent',\n\t\tid: string,\n\t\tlabel?: string,\n\t) => void;\n\t/** A mention field registers its editor-backed insert here (internal). */\n\tregisterMentionField: (\n\t\tfieldKey: MentionFieldKey,\n\t\tfn: MentionInsertFn | null,\n\t) => void;\n\t/** A mention field reports focus so inserts target it (internal). */\n\tnotifyMentionFocus: (fieldKey: MentionFieldKey) => void;\n\n\t// Undo (post-removal)\n\t/** Non-null while the undo toast should be visible. */\n\tundoToast: UndoToastState | null;\n\t/** Restore the last removed tool / sub-agent (list + stripped tokens). */\n\tundoRemoval: () => void;\n\t/** Dismiss the undo toast without restoring. */\n\tdismissUndo: () => void;\n\n\t// Navigation\n\tactiveStep: StepKey;\n\tactiveIndex: number;\n\tgoToStep: (step: StepKey) => void;\n\tgoNext: () => void;\n\tgoPrev: () => void;\n\tisFirstStep: boolean;\n\tisLastStep: boolean;\n\n\t// Validation\n\tvalidation: StepValidation;\n\tisActiveStepValid: boolean;\n\n\t// Reference data\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\t/** Host application context (e.g. MANIFEST) — drives tool-chip labelling. */\n\tapplicationType?: ApplicationType;\n\t/** Resolved per-field character limits (consumer overrides merged over defaults). */\n\tcharLimits: AgentCharLimits;\n\t/** When true, step-rail items are not clickable (Back / Next only). */\n\tdisableStepNavigation: boolean;\n\n\t// Sub-agent creation (Step 3 drawer)\n\t/** Persist a new sub-agent and resolve with its ref. Omit to hide the create flow. */\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/**\n\t * Step 3 registers its \"open create-sub-agent drawer\" action here so the `@`\n\t * picker's \"Create new\" row can trigger it. Pass `null` to unregister.\n\t */\n\tregisterSubAgentCreator: (fn: (() => void) | null) => void;\n\t/** Open the create-sub-agent drawer (no-op until Step 3 registers it). */\n\trequestCreateSubAgent: () => void;\n\t/** Fetch a sub-agent's editable data (Configure). Omit to hide Configure. */\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\t/** Persist edits to an existing sub-agent. */\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/** Optional \"Improve with AI\" for the drawer's instructions / guardrails. */\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n}\n\nconst AgentBuilderContext =\n\tReact.createContext<AgentBuilderContextShape | null>(null);\n\nexport const useAgentBuilderContext = (): AgentBuilderContextShape => {\n\tconst ctx = useContext(AgentBuilderContext);\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t'useAgentBuilderContext must be used within an AgentBuilderProvider',\n\t\t);\n\t}\n\treturn ctx;\n};\n\n/** Validity derived purely from the current value (no effects). */\nconst deriveValidation = (\n\tvalue: AgentValue,\n\tlimits: AgentCharLimits,\n): StepValidation => {\n\tconst triggerValid =\n\t\tvalue.trigger.mode === 'custom_intent'\n\t\t\t? (value.trigger.custom_intent ?? '').trim().length > 0\n\t\t\t: value.trigger.intents.length > 0;\n\n\treturn {\n\t\tabout:\n\t\t\tvalue.name.trim().length > 0 &&\n\t\t\tvalue.name.length <= limits.name &&\n\t\t\tvalue.description.length <= limits.description,\n\t\ttrigger: triggerValid,\n\t\t// At least one of Instructions / Guardrails must be filled.\n\t\tresponse:\n\t\t\tvalue.instructions.trim().length > 0 ||\n\t\t\t(value.guardrail ?? '').trim().length > 0,\n\t\t// Optional until specced further — never blocks go-live.\n\t\thandover: true,\n\t};\n};\n\ninterface ProviderProps {\n\tvalue: AgentValue;\n\tonChange: (patch: Partial<AgentValue>) => void;\n\tactiveStep?: StepKey;\n\tonStepChange?: (step: StepKey) => void;\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\tvalidation?: Partial<StepValidation>;\n\tapplicationType?: ApplicationType;\n\tcharLimits?: Partial<AgentCharLimits>;\n\tdisableStepNavigation?: boolean;\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\tchildren: React.ReactNode;\n}\n\nexport const AgentBuilderProvider: React.FC<ProviderProps> = ({\n\tvalue,\n\tonChange,\n\tactiveStep: controlledStep,\n\tonStepChange,\n\tavailableTools,\n\tavailableSubAgents,\n\tavailableIntents,\n\tavailableModels,\n\tvalidation: validationOverride,\n\tapplicationType,\n\tcharLimits: charLimitsOverride,\n\tdisableStepNavigation = true,\n\tonCreateSubAgent,\n\tonFetchSubAgent,\n\tonUpdateSubAgent,\n\tonImproveSubAgent,\n\tchildren,\n}) => {\n\tconst [internalStep, setInternalStep] = useState<StepKey>('about');\n\tconst activeStep = controlledStep ?? internalStep;\n\tconst activeIndex = getStepIndex(activeStep);\n\n\t// Bumped when a mention field is edited from OUTSIDE its editor (removing a\n\t// tool from the side list, undo), forcing the mention editors to remount.\n\tconst [mentionResetKey, setMentionResetKey] = useState(0);\n\n\t// Each mention field registers an editor-backed insert fn + reports focus, so\n\t// side-panel adds drop a chip into the last-focused field at its cursor.\n\tconst mentionInsertersRef = useRef<\n\t\tPartial<Record<MentionFieldKey, MentionInsertFn>>\n\t>({});\n\tconst lastFocusedFieldRef = useRef<MentionFieldKey>('instructions');\n\tconst registerMentionField = useCallback(\n\t\t(fieldKey: MentionFieldKey, fn: MentionInsertFn | null) => {\n\t\t\tif (fn) {\n\t\t\t\tmentionInsertersRef.current[fieldKey] = fn;\n\t\t\t} else {\n\t\t\t\tdelete mentionInsertersRef.current[fieldKey];\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\tconst notifyMentionFocus = useCallback((fieldKey: MentionFieldKey) => {\n\t\tlastFocusedFieldRef.current = fieldKey;\n\t}, []);\n\n\t// Step 3 registers its drawer opener here; the `@` picker's \"Create new\" calls it.\n\tconst subAgentCreatorRef = useRef<(() => void) | null>(null);\n\tconst registerSubAgentCreator = useCallback((fn: (() => void) | null) => {\n\t\tsubAgentCreatorRef.current = fn;\n\t}, []);\n\tconst requestCreateSubAgent = useCallback(() => {\n\t\tsubAgentCreatorRef.current?.();\n\t}, []);\n\tconst insertMention = useCallback<MentionInsertFn>((kind, id, label) => {\n\t\tconst inserters = mentionInsertersRef.current;\n\t\tconst target =\n\t\t\tinserters[lastFocusedFieldRef.current] ?? inserters.instructions;\n\t\ttarget?.(kind, id, label);\n\t}, []);\n\n\t// Undo state for the most recent removal.\n\tconst [undoToast, setUndoToast] = useState<UndoToastState | null>(null);\n\tconst undoSnapshotRef = useRef<Partial<AgentValue> | null>(null);\n\tconst undoIdRef = useRef(0);\n\n\tconst goToStep = useCallback(\n\t\t(step: StepKey) => {\n\t\t\tif (controlledStep === undefined) {\n\t\t\t\tsetInternalStep(step);\n\t\t\t}\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[controlledStep, onStepChange],\n\t);\n\n\tconst goNext = useCallback(() => {\n\t\tconst next = STEP_KEYS[Math.min(activeIndex + 1, STEP_KEYS.length - 1)];\n\t\tgoToStep(next);\n\t}, [activeIndex, goToStep]);\n\n\tconst goPrev = useCallback(() => {\n\t\tconst prev = STEP_KEYS[Math.max(activeIndex - 1, 0)];\n\t\tgoToStep(prev);\n\t}, [activeIndex, goToStep]);\n\n\tconst patch = useCallback(\n\t\t(partial: Partial<AgentValue>) => onChange(partial),\n\t\t[onChange],\n\t);\n\n\tconst updateField = useCallback(\n\t\t<K extends keyof AgentValue>(key: K, val: AgentValue[K]) =>\n\t\t\tonChange({ [key]: val } as Partial<AgentValue>),\n\t\t[onChange],\n\t);\n\n\tconst removeReference = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\tconst token =\n\t\t\t\tkind === 'tool'\n\t\t\t\t\t? (() => {\n\t\t\t\t\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\t\t\t\t\treturn tool ? `{{tool:${tool.function_key}}}` : null;\n\t\t\t\t\t })()\n\t\t\t\t\t: `{{subagent:${id}}}`;\n\t\t\tconst strip = (text: string) =>\n\t\t\t\ttoken ? text.split(token).join('') : text;\n\n\t\t\t// Snapshot the four fields a removal touches, for undo.\n\t\t\tundoSnapshotRef.current = {\n\t\t\t\ttools: value.tools,\n\t\t\t\tsubagents: value.subagents,\n\t\t\t\tinstructions: value.instructions,\n\t\t\t\tguardrail: value.guardrail,\n\t\t\t};\n\n\t\t\tconst next: Partial<AgentValue> = {\n\t\t\t\tinstructions: strip(value.instructions),\n\t\t\t\tguardrail: strip(value.guardrail ?? ''),\n\t\t\t\t...(kind === 'tool'\n\t\t\t\t\t? { tools: value.tools.filter((t) => t !== id) }\n\t\t\t\t\t: { subagents: value.subagents.filter((s) => s !== id) }),\n\t\t\t};\n\t\t\tonChange(next);\n\t\t\tsetMentionResetKey((k) => k + 1);\n\n\t\t\tconst label =\n\t\t\t\tkind === 'tool'\n\t\t\t\t\t? availableTools.find((t) => t.tool_id === id)?.display_name ?? 'Tool'\n\t\t\t\t\t: availableSubAgents.find((s) => s.id === id)?.name ?? 'Sub-agent';\n\t\t\tundoIdRef.current += 1;\n\t\t\tsetUndoToast({\n\t\t\t\tid: undoIdRef.current,\n\t\t\t\tmessage: `${kind === 'tool' ? 'Tool' : 'Sub-agent'} \"${label}\" removed`,\n\t\t\t});\n\t\t},\n\t\t[availableTools, availableSubAgents, value, onChange],\n\t);\n\n\tconst undoRemoval = useCallback(() => {\n\t\tif (undoSnapshotRef.current) {\n\t\t\tonChange(undoSnapshotRef.current);\n\t\t\tundoSnapshotRef.current = null;\n\t\t\tsetMentionResetKey((k) => k + 1);\n\t\t}\n\t\tsetUndoToast(null);\n\t}, [onChange]);\n\n\tconst dismissUndo = useCallback(() => setUndoToast(null), []);\n\n\t// Consumer overrides merged over the built-in defaults (name 60, rest 1000).\n\tconst charLimits = useMemo<AgentCharLimits>(\n\t\t() => ({ ...AGENT_CHAR_LIMITS, ...charLimitsOverride }),\n\t\t[charLimitsOverride],\n\t);\n\n\tconst validation: StepValidation = useMemo(\n\t\t() => ({ ...deriveValidation(value, charLimits), ...validationOverride }),\n\t\t[value, charLimits, validationOverride],\n\t);\n\n\tconst ctx = useMemo<AgentBuilderContextShape>(\n\t\t() => ({\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tisFirstStep: activeIndex === 0,\n\t\t\tisLastStep: activeIndex === STEP_KEYS.length - 1,\n\t\t\tvalidation,\n\t\t\tisActiveStepValid: validation[activeStep],\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tapplicationType,\n\t\t\tcharLimits,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t}),\n\t\t[\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tvalidation,\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tapplicationType,\n\t\t\tcharLimits,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t],\n\t);\n\n\treturn (\n\t\t<AgentBuilderContext.Provider value={ctx}>\n\t\t\t{children}\n\t\t</AgentBuilderContext.Provider>\n\t);\n};\n"],"names":["AgentBuilderContext","React","useAgentBuilderContext","ctx","useContext","deriveValidation","value","limits","triggerValid","AgentBuilderProvider","onChange","controlledStep","onStepChange","availableTools","availableSubAgents","availableIntents","availableModels","validationOverride","applicationType","charLimitsOverride","disableStepNavigation","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","children","internalStep","setInternalStep","useState","activeStep","activeIndex","getStepIndex","mentionResetKey","setMentionResetKey","mentionInsertersRef","useRef","lastFocusedFieldRef","registerMentionField","useCallback","fieldKey","fn","notifyMentionFocus","subAgentCreatorRef","registerSubAgentCreator","requestCreateSubAgent","insertMention","kind","id","label","inserters","undoToast","setUndoToast","undoSnapshotRef","undoIdRef","goToStep","step","goNext","next","STEP_KEYS","goPrev","prev","patch","partial","updateField","key","val","removeReference","token","tool","t","strip","text","k","undoRemoval","dismissUndo","charLimits","useMemo","AGENT_CHAR_LIMITS","validation"],"mappings":"uRA6HMA,EACLC,GAAAA,QAAM,cAA+C,IAAI,EAE7CC,GAAyB,IAAgC,CACrE,MAAMC,EAAMC,EAAAA,WAAWJ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IAAI,EAAG,CAAA,CAAE,EAGtDwB,EAAaC,EAAAA,QAClB,KAAO,CAAE,GAAGC,GAAAA,kBAAmB,GAAG1D,IAClC,CAACA,CAAkB,CAAA,EAGd2D,EAA6BF,EAAAA,QAClC,KAAO,CAAE,GAAGvE,GAAiBC,EAAOqE,CAAU,EAAG,GAAG1D,IACpD,CAACX,EAAOqE,EAAY1D,CAAkB,CAAA,EAGjCd,GAAMyE,EAAAA,QACX,KAAO,CACN,MAAAtE,EACA,MAAAuD,EACA,YAAAE,EACA,gBAAAG,EACA,gBAAAlC,EACA,cAAAa,EACA,qBAAAR,EACA,mBAAAI,EACA,UAAAS,EACA,YAAAuB,EACA,YAAAC,EACA,WAAA7C,EACA,YAAAC,EACA,SAAAwB,EACA,OAAAE,EACA,OAAAG,EACA,YAAa7B,IAAgB,EAC7B,WAAYA,IAAgB4B,YAAU,OAAS,EAC/C,WAAAoB,EACA,kBAAmBA,EAAWjD,CAAU,EACxC,eAAAhB,EACA,mBAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAE,EAAA,WACAyD,EACA,sBAAAvD,EACA,iBAAAC,EACA,wBAAAsB,EACA,sBAAAC,EACA,gBAAAtB,EACA,iBAAAC,EACA,kBAAAC,CAAA,GAED,CACClB,EACAuD,EACAE,EACAG,EACAlC,EACAa,EACAR,EACAI,EACAS,EACAuB,EACAC,EACA7C,EACAC,EACAwB,EACAE,EACAG,EACAmB,EACAjE,EACAC,EACAC,EACAC,EACAE,EACAyD,EACAvD,EACAC,EACAsB,EACAC,EACAtB,EACAC,EACAC,CAAA,CACD,EAGD,cACExB,EAAoB,SAApB,CAA6B,MAAOG,GACnC,SAAAsB,EACF,CAEF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../components/AiTextArea.js"),s=require("../components/StepSectionHeader.js"),a=require("../constants/charLimits.js"),l=require("../constants/steps.js"),c=require("../context/AgentBuilderContext.js"),u=require("../../input/Input.js"),r=l.STEP_DEFINITIONS[0],d=()=>{const{value:n,updateField:i}=c.useAgentBuilderContext();return e.jsxs("div",{className:"bik-agent-step bik-agent-step--about",children:[e.jsx(s.StepSectionHeader,{title:r.title,helper:r.helper}),e.jsx("div",{style:{marginBottom:20},children:e.jsx(u.Input,{"data-test":"agent-name",labelText:"Agent name",labelTextBold:!0,placeholder:"Enter agent name",value:n.name,maxCharLimit:a.AGENT_CHAR_LIMITS.name,maxCharLimitPosition:"TOP",maxCharStyle:{fontSize:12,lineHeight:"16px"},onChangeText:t=>i("name",t)})}),e.jsx(o.AiTextArea,{"data-test":"agent-description",label:"What it does",value:n.description,onChange:t=>i("description",t),maxLength:a.AGENT_CHAR_LIMITS.description,placeholder:"Enter description",minHeight:"200px"})]})};exports.Step1About=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../components/AiTextArea.js"),s=require("../components/StepSectionHeader.js"),l=require("../constants/steps.js"),c=require("../context/AgentBuilderContext.js"),u=require("../../input/Input.js"),r=l.STEP_DEFINITIONS[0],d=()=>{const{value:n,updateField:i,charLimits:a}=c.useAgentBuilderContext();return e.jsxs("div",{className:"bik-agent-step bik-agent-step--about",children:[e.jsx(s.StepSectionHeader,{title:r.title,helper:r.helper}),e.jsx("div",{style:{marginBottom:20},children:e.jsx(u.Input,{"data-test":"agent-name",labelText:"Agent name",labelTextBold:!0,placeholder:"Enter agent name",value:n.name,maxCharLimit:a.name,maxCharLimitPosition:"TOP",maxCharStyle:{fontSize:12,lineHeight:"16px"},onChangeText:t=>i("name",t)})}),e.jsx(o.AiTextArea,{"data-test":"agent-description",label:"What it does",value:n.description,onChange:t=>i("description",t),maxLength:a.description,placeholder:"Enter description",minHeight:"200px"})]})};exports.Step1About=d;
2
2
  //# sourceMappingURL=Step1About.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Step1About.js","sources":["../../../../../src/components/agent-builder/steps/Step1About.tsx"],"sourcesContent":["import React from 'react';\nimport { Input } from '@src/components/input';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\nconst STEP = STEP_DEFINITIONS[0];\n\nexport const Step1About: React.FC = () => {\n\tconst { value, updateField } = useAgentBuilderContext();\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--about\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<div style={{ marginBottom: 20 }}>\n\t\t\t\t<Input\n\t\t\t\t\tdata-test=\"agent-name\"\n\t\t\t\t\tlabelText=\"Agent name\"\n\t\t\t\t\tlabelTextBold\n\t\t\t\t\tplaceholder=\"Enter agent name\"\n\t\t\t\t\tvalue={value.name}\n\t\t\t\t\tmaxCharLimit={AGENT_CHAR_LIMITS.name}\n\t\t\t\t\tmaxCharLimitPosition=\"TOP\"\n\t\t\t\t\tmaxCharStyle={{ fontSize: 12, lineHeight: '16px' }}\n\t\t\t\t\tonChangeText={(text) => updateField('name', text)}\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t<AiTextArea\n\t\t\t\tdata-test=\"agent-description\"\n\t\t\t\tlabel=\"What it does\"\n\t\t\t\tvalue={value.description}\n\t\t\t\tonChange={(text) => updateField('description', text)}\n\t\t\t\tmaxLength={AGENT_CHAR_LIMITS.description}\n\t\t\t\tplaceholder=\"Enter description\"\n\t\t\t\tminHeight=\"200px\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","Step1About","value","updateField","useAgentBuilderContext","jsxs","jsx","StepSectionHeader","Input","AGENT_CHAR_LIMITS","text","AiTextArea"],"mappings":"0WAQMA,EAAOC,EAAAA,iBAAiB,CAAC,EAElBC,EAAuB,IAAM,CACzC,KAAM,CAAE,MAAAC,EAAO,YAAAC,CAAA,EAAgBC,yBAAA,EAE/B,OACCC,EAAAA,KAAC,MAAA,CAAI,UAAU,uCACd,SAAA,CAAAC,MAACC,EAAAA,mBAAkB,MAAOR,EAAK,MAAO,OAAQA,EAAK,OAAQ,QAE1D,MAAA,CAAI,MAAO,CAAE,aAAc,IAC3B,SAAAO,EAAAA,IAACE,EAAAA,MAAA,CACA,YAAU,aACV,UAAU,aACV,cAAa,GACb,YAAY,mBACZ,MAAON,EAAM,KACb,aAAcO,EAAAA,kBAAkB,KAChC,qBAAqB,MACrB,aAAc,CAAE,SAAU,GAAI,WAAY,MAAA,EAC1C,aAAeC,GAASP,EAAY,OAAQO,CAAI,CAAA,CAAA,EAElD,EAEAJ,EAAAA,IAACK,EAAAA,WAAA,CACA,YAAU,oBACV,MAAM,eACN,MAAOT,EAAM,YACb,SAAWQ,GAASP,EAAY,cAAeO,CAAI,EACnD,UAAWD,EAAAA,kBAAkB,YAC7B,YAAY,oBACZ,UAAU,OAAA,CAAA,CACX,EACD,CAEF"}
1
+ {"version":3,"file":"Step1About.js","sources":["../../../../../src/components/agent-builder/steps/Step1About.tsx"],"sourcesContent":["import React from 'react';\nimport { Input } from '@src/components/input';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\nconst STEP = STEP_DEFINITIONS[0];\n\nexport const Step1About: React.FC = () => {\n\tconst { value, updateField, charLimits } = useAgentBuilderContext();\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--about\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<div style={{ marginBottom: 20 }}>\n\t\t\t\t<Input\n\t\t\t\t\tdata-test=\"agent-name\"\n\t\t\t\t\tlabelText=\"Agent name\"\n\t\t\t\t\tlabelTextBold\n\t\t\t\t\tplaceholder=\"Enter agent name\"\n\t\t\t\t\tvalue={value.name}\n\t\t\t\t\tmaxCharLimit={charLimits.name}\n\t\t\t\t\tmaxCharLimitPosition=\"TOP\"\n\t\t\t\t\tmaxCharStyle={{ fontSize: 12, lineHeight: '16px' }}\n\t\t\t\t\tonChangeText={(text) => updateField('name', text)}\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t<AiTextArea\n\t\t\t\tdata-test=\"agent-description\"\n\t\t\t\tlabel=\"What it does\"\n\t\t\t\tvalue={value.description}\n\t\t\t\tonChange={(text) => updateField('description', text)}\n\t\t\t\tmaxLength={charLimits.description}\n\t\t\t\tplaceholder=\"Enter description\"\n\t\t\t\tminHeight=\"200px\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","Step1About","value","updateField","charLimits","useAgentBuilderContext","jsxs","jsx","StepSectionHeader","Input","text","AiTextArea"],"mappings":"kUAOMA,EAAOC,EAAAA,iBAAiB,CAAC,EAElBC,EAAuB,IAAM,CACzC,KAAM,CAAE,MAAAC,EAAO,YAAAC,EAAa,WAAAC,CAAA,EAAeC,EAAAA,uBAAA,EAE3C,OACCC,EAAAA,KAAC,MAAA,CAAI,UAAU,uCACd,SAAA,CAAAC,MAACC,EAAAA,mBAAkB,MAAOT,EAAK,MAAO,OAAQA,EAAK,OAAQ,QAE1D,MAAA,CAAI,MAAO,CAAE,aAAc,IAC3B,SAAAQ,EAAAA,IAACE,EAAAA,MAAA,CACA,YAAU,aACV,UAAU,aACV,cAAa,GACb,YAAY,mBACZ,MAAOP,EAAM,KACb,aAAcE,EAAW,KACzB,qBAAqB,MACrB,aAAc,CAAE,SAAU,GAAI,WAAY,MAAA,EAC1C,aAAeM,GAASP,EAAY,OAAQO,CAAI,CAAA,CAAA,EAElD,EAEAH,EAAAA,IAACI,EAAAA,WAAA,CACA,YAAU,oBACV,MAAM,eACN,MAAOT,EAAM,YACb,SAAWQ,GAASP,EAAY,cAAeO,CAAI,EACnD,UAAWN,EAAW,YACtB,YAAY,oBACZ,UAAU,OAAA,CAAA,CACX,EACD,CAEF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),y=require("../../../assets/icons/cross.svg.js"),j=require("../../../assets/icons/plus.svg.js"),O=require("react"),p=require("../../radioButton/RadioButton.js"),s=require("../../TypographyStyle.js"),i=require("../../../constants/Theme.js"),o=require("../AgentBuilder.styled.js"),R=require("../components/AiTextArea.js"),v=require("../components/StepSectionHeader.js"),_=require("../constants/charLimits.js"),T=require("../constants/steps.js"),b=require("../context/AgentBuilderContext.js"),A=require("../../dropdown/Dropdown.js"),I=r=>r&&typeof r=="object"&&"default"in r?r:{default:r},L=I(O),C=T.STEP_DEFINITIONS[1],q=()=>{const{value:r,patch:a,availableIntents:u}=b.useAgentBuilderContext(),{trigger:n}=r,[S,h]=L.default.useState(!1),c=e=>a({trigger:{...n,mode:e}}),x=e=>{n.intents.includes(e)||a({trigger:{...n,intents:[...n.intents,e]}}),h(!1)},f=e=>a({trigger:{...n,intents:n.intents.filter(l=>l!==e)}}),m=e=>u.find(l=>l.value===e)?.label??e,d=u.filter(e=>!n.intents.includes(e.value)).map(e=>({label:e.label,value:e.value}));return t.jsxs("div",{children:[t.jsx(v.StepSectionHeader,{title:C.title,helper:C.helper}),t.jsxs(o.CardRow,{children:[t.jsxs(o.RadioCard,{"data-test":"trigger-mode-manifest",selected:n.mode==="manifest_intent",onClick:()=>c("manifest_intent"),children:[t.jsx(p.RadioButton,{isActive:n.mode==="manifest_intent",onValueChange:()=>c("manifest_intent"),skipSelectingOff:!0,activeColor:i.COLORS.content.brand}),t.jsxs(o.RadioCardText,{children:[t.jsx(s.TitleSmall,{color:i.COLORS.content.primary,children:"Manifest intent"}),t.jsx(s.BodyCaption,{color:i.COLORS.content.secondary,children:"Manifest's AI classifier routes conversations automatically — no keywords needed."})]})]}),t.jsxs(o.RadioCard,{"data-test":"trigger-mode-custom",selected:n.mode==="custom_intent",onClick:()=>c("custom_intent"),children:[t.jsx(p.RadioButton,{isActive:n.mode==="custom_intent",onValueChange:()=>c("custom_intent"),skipSelectingOff:!0,activeColor:i.COLORS.content.brand}),t.jsxs(o.RadioCardText,{children:[t.jsx(s.TitleSmall,{color:i.COLORS.content.primary,children:"Custom intent"}),t.jsx(s.BodyCaption,{color:i.COLORS.content.secondary,children:"Define your own trigger — use exact phrases or describe the customer's intent."})]})]})]}),n.mode==="manifest_intent"?t.jsxs(o.FieldBlock,{children:[t.jsx(s.TitleSmall,{color:i.COLORS.content.primary,children:"If customer talks about"}),t.jsxs(o.ChipWrap,{children:[n.intents.map(e=>t.jsxs(o.IntentChip,{"data-test":`intent-chip-${e}`,children:[t.jsx(s.BodySecondary,{color:i.COLORS.content.primary,children:m(e)}),t.jsx(o.ChipCloseButton,{onClick:()=>f(e),"aria-label":`Remove ${m(e)}`,children:t.jsx(y.default,{width:14,height:14,color:i.COLORS.content.secondary})})]},e)),S&&d.length>0?t.jsx(A.Dropdown,{"data-test":"intent-add-dropdown",size:"small",width:"200px",placeHolder:"Select intent",isSearchable:!0,options:d,onSelect:e=>{const g=(Array.isArray(e)?e[0]:e)?.value;g&&x(g)}}):d.length>0&&t.jsxs(o.AddChipButton,{"data-test":"intent-add-button",onClick:()=>h(!0),children:[t.jsx(j.default,{width:16,height:16,color:i.COLORS.content.secondary}),t.jsx(s.BodySecondary,{color:i.COLORS.content.secondary,children:"Intent"})]})]}),t.jsx(s.BodyCaption,{color:i.COLORS.content.secondary,children:"This agent takes over from your main assistant when this intent is detected. The changeover is automatic when you go live."})]}):t.jsx(R.AiTextArea,{"data-test":"custom-intent",label:"Describe the trigger",value:n.custom_intent??"",onChange:e=>a({trigger:{...n,custom_intent:e}}),maxLength:_.AGENT_CHAR_LIMITS.custom_intent,placeholder:"e.g. The customer wants to cancel an order they placed.",minHeight:"120px"})]})};exports.Step2WhenItStepsIn=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("../../../assets/icons/cross.svg.js"),j=require("../../../assets/icons/plus.svg.js"),O=require("react"),p=require("../../radioButton/RadioButton.js"),s=require("../../TypographyStyle.js"),o=require("../../../constants/Theme.js"),i=require("../AgentBuilder.styled.js"),R=require("../components/AiTextArea.js"),v=require("../components/StepSectionHeader.js"),b=require("../constants/steps.js"),_=require("../context/AgentBuilderContext.js"),T=require("../../dropdown/Dropdown.js"),q=require("../../dropdown/utils.js"),w=r=>r&&typeof r=="object"&&"default"in r?r:{default:r},B=w(O),g=b.STEP_DEFINITIONS[1],I=()=>{const{value:r,patch:c,availableIntents:u,charLimits:C}=_.useAgentBuilderContext(),{trigger:n}=r,[x,h]=B.default.useState(!1),l=t=>c({trigger:{...n,mode:t}}),S=t=>{n.intents.includes(t)||c({trigger:{...n,intents:[...n.intents,t]}}),h(!1)},f=t=>c({trigger:{...n,intents:n.intents.filter(a=>a!==t)}}),m=t=>u.find(a=>a.value===t)?.label??t,d=u.filter(t=>!n.intents.includes(t.value)).map(t=>({label:t.label,value:t.value}));return e.jsxs("div",{children:[e.jsx(v.StepSectionHeader,{title:g.title,helper:g.helper}),e.jsxs(i.CardRow,{children:[e.jsxs(i.RadioCard,{"data-test":"trigger-mode-manifest",selected:n.mode==="manifest_intent",onClick:()=>l("manifest_intent"),children:[e.jsx(p.RadioButton,{isActive:n.mode==="manifest_intent",onValueChange:()=>l("manifest_intent"),skipSelectingOff:!0,activeColor:o.COLORS.content.brand}),e.jsxs(i.RadioCardText,{children:[e.jsx(s.TitleSmall,{color:o.COLORS.content.primary,children:"Manifest intent"}),e.jsx(s.BodyCaption,{color:o.COLORS.content.secondary,children:"Manifest's AI classifier routes conversations automatically — no keywords needed."})]})]}),e.jsxs(i.RadioCard,{"data-test":"trigger-mode-custom",selected:n.mode==="custom_intent",onClick:()=>l("custom_intent"),children:[e.jsx(p.RadioButton,{isActive:n.mode==="custom_intent",onValueChange:()=>l("custom_intent"),skipSelectingOff:!0,activeColor:o.COLORS.content.brand}),e.jsxs(i.RadioCardText,{children:[e.jsx(s.TitleSmall,{color:o.COLORS.content.primary,children:"Custom intent"}),e.jsx(s.BodyCaption,{color:o.COLORS.content.secondary,children:"Define your own trigger — use exact phrases or describe the customer's intent."})]})]})]}),n.mode==="manifest_intent"?e.jsxs(i.FieldBlock,{children:[e.jsx(s.TitleSmall,{color:o.COLORS.content.primary,children:"If customer talks about"}),e.jsxs(i.ChipWrap,{children:[n.intents.map(t=>e.jsxs(i.IntentChip,{"data-test":`intent-chip-${t}`,children:[e.jsx(s.BodySecondary,{color:o.COLORS.content.primary,children:m(t)}),e.jsx(i.ChipCloseButton,{onClick:()=>f(t),"aria-label":`Remove ${m(t)}`,children:e.jsx(y.default,{width:14,height:14,color:o.COLORS.content.secondary})})]},t)),x&&d.length>0?e.jsx(T.Dropdown,{"data-test":"intent-add-dropdown",size:"small",width:"200px",placeHolder:"Select intent",isSearchable:!0,options:d,onSelect:t=>{const a=q.unwrapDropdownValue(t);a&&S(a)}}):d.length>0&&e.jsxs(i.AddChipButton,{"data-test":"intent-add-button",onClick:()=>h(!0),children:[e.jsx(j.default,{width:16,height:16,color:o.COLORS.content.secondary}),e.jsx(s.BodySecondary,{color:o.COLORS.content.secondary,children:"Intent"})]})]}),e.jsx(s.BodyCaption,{color:o.COLORS.content.secondary,children:"This agent takes over from your main assistant when this intent is detected. The changeover is automatic when you go live."})]}):e.jsx(R.AiTextArea,{"data-test":"custom-intent",label:"Describe the trigger",value:n.custom_intent??"",onChange:t=>c({trigger:{...n,custom_intent:t}}),maxLength:C.custom_intent,placeholder:"e.g. The customer wants to cancel an order they placed.",minHeight:"120px"})]})};exports.Step2WhenItStepsIn=I;
2
2
  //# sourceMappingURL=Step2WhenItStepsIn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Step2WhenItStepsIn.js","sources":["../../../../../src/components/agent-builder/steps/Step2WhenItStepsIn.tsx"],"sourcesContent":["import CrossIcon from '@src/assets/icons/cross.svg';\nimport PlusIcon from '@src/assets/icons/plus.svg';\nimport React from 'react';\nimport { Dropdown } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { RadioButton } from '@src/components/radioButton/RadioButton';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { TriggerMode } from '../AgentBuilder.model';\nimport {\n\tAddChipButton,\n\tCardRow,\n\tChipCloseButton,\n\tChipWrap,\n\tFieldBlock,\n\tIntentChip,\n\tRadioCard,\n\tRadioCardText,\n} from '../AgentBuilder.styled';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\nconst STEP = STEP_DEFINITIONS[1];\n\nexport const Step2WhenItStepsIn: React.FC = () => {\n\tconst { value, patch, availableIntents } = useAgentBuilderContext();\n\tconst { trigger } = value;\n\tconst [adding, setAdding] = React.useState(false);\n\n\tconst setMode = (mode: TriggerMode) =>\n\t\tpatch({ trigger: { ...trigger, mode } });\n\n\tconst addIntent = (intentValue: string) => {\n\t\tif (!trigger.intents.includes(intentValue)) {\n\t\t\tpatch({\n\t\t\t\ttrigger: { ...trigger, intents: [...trigger.intents, intentValue] },\n\t\t\t});\n\t\t}\n\t\tsetAdding(false);\n\t};\n\n\tconst removeIntent = (intentValue: string) =>\n\t\tpatch({\n\t\t\ttrigger: {\n\t\t\t\t...trigger,\n\t\t\t\tintents: trigger.intents.filter((i) => i !== intentValue),\n\t\t\t},\n\t\t});\n\n\tconst labelFor = (v: string) =>\n\t\tavailableIntents.find((o) => o.value === v)?.label ?? v;\n\n\tconst remainingOptions: SingleOption[] = availableIntents\n\t\t.filter((o) => !trigger.intents.includes(o.value))\n\t\t.map((o) => ({ label: o.label, value: o.value }));\n\n\treturn (\n\t\t<div>\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<CardRow>\n\t\t\t\t<RadioCard\n\t\t\t\t\tdata-test=\"trigger-mode-manifest\"\n\t\t\t\t\tselected={trigger.mode === 'manifest_intent'}\n\t\t\t\t\tonClick={() => setMode('manifest_intent')}\n\t\t\t\t>\n\t\t\t\t\t<RadioButton\n\t\t\t\t\t\tisActive={trigger.mode === 'manifest_intent'}\n\t\t\t\t\t\tonValueChange={() => setMode('manifest_intent')}\n\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\tactiveColor={COLORS.content.brand}\n\t\t\t\t\t/>\n\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\tManifest intent\n\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\tManifest&apos;s AI classifier routes conversations automatically —\n\t\t\t\t\t\t\tno keywords needed.\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t</RadioCardText>\n\t\t\t\t</RadioCard>\n\n\t\t\t\t<RadioCard\n\t\t\t\t\tdata-test=\"trigger-mode-custom\"\n\t\t\t\t\tselected={trigger.mode === 'custom_intent'}\n\t\t\t\t\tonClick={() => setMode('custom_intent')}\n\t\t\t\t>\n\t\t\t\t\t<RadioButton\n\t\t\t\t\t\tisActive={trigger.mode === 'custom_intent'}\n\t\t\t\t\t\tonValueChange={() => setMode('custom_intent')}\n\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\tactiveColor={COLORS.content.brand}\n\t\t\t\t\t/>\n\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\tCustom intent\n\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\tDefine your own trigger — use exact phrases or describe the\n\t\t\t\t\t\t\tcustomer&apos;s intent.\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t</RadioCardText>\n\t\t\t\t</RadioCard>\n\t\t\t</CardRow>\n\n\t\t\t{trigger.mode === 'manifest_intent' ? (\n\t\t\t\t<FieldBlock>\n\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\tIf customer talks about\n\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t<ChipWrap>\n\t\t\t\t\t\t{trigger.intents.map((intent) => (\n\t\t\t\t\t\t\t<IntentChip key={intent} data-test={`intent-chip-${intent}`}>\n\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t{labelFor(intent)}\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t<ChipCloseButton\n\t\t\t\t\t\t\t\t\tonClick={() => removeIntent(intent)}\n\t\t\t\t\t\t\t\t\taria-label={`Remove ${labelFor(intent)}`}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<CrossIcon\n\t\t\t\t\t\t\t\t\t\twidth={14}\n\t\t\t\t\t\t\t\t\t\theight={14}\n\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ChipCloseButton>\n\t\t\t\t\t\t\t</IntentChip>\n\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t{adding && remainingOptions.length > 0 ? (\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tdata-test=\"intent-add-dropdown\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\twidth=\"200px\"\n\t\t\t\t\t\t\t\tplaceHolder=\"Select intent\"\n\t\t\t\t\t\t\t\tisSearchable\n\t\t\t\t\t\t\t\toptions={remainingOptions}\n\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\tconst single = Array.isArray(opt) ? opt[0] : opt;\n\t\t\t\t\t\t\t\t\tconst v = (single as SingleOption)?.value;\n\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\taddIntent(v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tremainingOptions.length > 0 && (\n\t\t\t\t\t\t\t\t<AddChipButton\n\t\t\t\t\t\t\t\t\tdata-test=\"intent-add-button\"\n\t\t\t\t\t\t\t\t\tonClick={() => setAdding(true)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<PlusIcon\n\t\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\t\tIntent\n\t\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t</AddChipButton>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ChipWrap>\n\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\tThis agent takes over from your main assistant when this intent is\n\t\t\t\t\t\tdetected. The changeover is automatic when you go live.\n\t\t\t\t\t</BodyCaption>\n\t\t\t\t</FieldBlock>\n\t\t\t) : (\n\t\t\t\t<AiTextArea\n\t\t\t\t\tdata-test=\"custom-intent\"\n\t\t\t\t\tlabel=\"Describe the trigger\"\n\t\t\t\t\tvalue={trigger.custom_intent ?? ''}\n\t\t\t\t\tonChange={(text) =>\n\t\t\t\t\t\tpatch({ trigger: { ...trigger, custom_intent: text } })\n\t\t\t\t\t}\n\t\t\t\t\tmaxLength={AGENT_CHAR_LIMITS.custom_intent}\n\t\t\t\t\tplaceholder=\"e.g. The customer wants to cancel an order they placed.\"\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","Step2WhenItStepsIn","value","patch","availableIntents","useAgentBuilderContext","trigger","adding","setAdding","React","setMode","mode","addIntent","intentValue","removeIntent","i","labelFor","v","o","remainingOptions","jsx","StepSectionHeader","CardRow","jsxs","RadioCard","RadioButton","COLORS","RadioCardText","TitleSmall","BodyCaption","FieldBlock","ChipWrap","intent","IntentChip","BodySecondary","ChipCloseButton","CrossIcon","Dropdown","opt","AddChipButton","PlusIcon","AiTextArea","text","AGENT_CHAR_LIMITS"],"mappings":"qsBA6BMA,EAAOC,EAAAA,iBAAiB,CAAC,EAElBC,EAA+B,IAAM,CACjD,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,iBAAAC,CAAA,EAAqBC,EAAAA,uBAAA,EACrC,CAAE,QAAAC,GAAYJ,EACd,CAACK,EAAQC,CAAS,EAAIC,EAAAA,QAAM,SAAS,EAAK,EAE1CC,EAAWC,GAChBR,EAAM,CAAE,QAAS,CAAE,GAAGG,EAAS,KAAAK,CAAA,EAAQ,EAElCC,EAAaC,GAAwB,CACrCP,EAAQ,QAAQ,SAASO,CAAW,GACxCV,EAAM,CACL,QAAS,CAAE,GAAGG,EAAS,QAAS,CAAC,GAAGA,EAAQ,QAASO,CAAW,CAAA,CAAE,CAClE,EAEFL,EAAU,EAAK,CAChB,EAEMM,EAAgBD,GACrBV,EAAM,CACL,QAAS,CACR,GAAGG,EACH,QAASA,EAAQ,QAAQ,OAAQS,GAAMA,IAAMF,CAAW,CAAA,CACzD,CACA,EAEIG,EAAYC,GACjBb,EAAiB,KAAMc,GAAMA,EAAE,QAAUD,CAAC,GAAG,OAASA,EAEjDE,EAAmCf,EACvC,OAAQc,GAAM,CAACZ,EAAQ,QAAQ,SAASY,EAAE,KAAK,CAAC,EAChD,IAAKA,IAAO,CA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O,QAAQ,UAAW,SAAA,4HAAA,CAG9C,CAAA,CAAA,CACD,EAEAN,EAAAA,IAACqB,EAAAA,WAAA,CACA,YAAU,gBACV,MAAM,uBACN,MAAOnC,EAAQ,eAAiB,GAChC,SAAWoC,GACVvC,EAAM,CAAE,QAAS,CAAE,GAAGG,EAAS,cAAeoC,CAAA,EAAQ,EAEvD,UAAWC,EAAAA,kBAAkB,cAC7B,YAAY,0DACZ,UAAU,OAAA,CAAA,CACX,EAEF,CAEF"}
1
+ {"version":3,"file":"Step2WhenItStepsIn.js","sources":["../../../../../src/components/agent-builder/steps/Step2WhenItStepsIn.tsx"],"sourcesContent":["import CrossIcon from '@src/assets/icons/cross.svg';\nimport PlusIcon from '@src/assets/icons/plus.svg';\nimport React from 'react';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { RadioButton } from '@src/components/radioButton/RadioButton';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { TriggerMode } from '../AgentBuilder.model';\nimport {\n\tAddChipButton,\n\tCardRow,\n\tChipCloseButton,\n\tChipWrap,\n\tFieldBlock,\n\tIntentChip,\n\tRadioCard,\n\tRadioCardText,\n} from '../AgentBuilder.styled';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\nconst STEP = STEP_DEFINITIONS[1];\n\nexport const Step2WhenItStepsIn: React.FC = () => {\n\tconst { value, patch, availableIntents, charLimits } =\n\t\tuseAgentBuilderContext();\n\tconst { trigger } = value;\n\tconst [adding, setAdding] = React.useState(false);\n\n\tconst setMode = (mode: TriggerMode) =>\n\t\tpatch({ trigger: { ...trigger, mode } });\n\n\tconst addIntent = (intentValue: string) => {\n\t\tif (!trigger.intents.includes(intentValue)) {\n\t\t\tpatch({\n\t\t\t\ttrigger: { ...trigger, intents: [...trigger.intents, intentValue] },\n\t\t\t});\n\t\t}\n\t\tsetAdding(false);\n\t};\n\n\tconst removeIntent = (intentValue: string) =>\n\t\tpatch({\n\t\t\ttrigger: {\n\t\t\t\t...trigger,\n\t\t\t\tintents: trigger.intents.filter((i) => i !== intentValue),\n\t\t\t},\n\t\t});\n\n\tconst labelFor = (v: string) =>\n\t\tavailableIntents.find((o) => o.value === v)?.label ?? v;\n\n\tconst remainingOptions: SingleOption[] = availableIntents\n\t\t.filter((o) => !trigger.intents.includes(o.value))\n\t\t.map((o) => ({ label: o.label, value: o.value }));\n\n\treturn (\n\t\t<div>\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<CardRow>\n\t\t\t\t<RadioCard\n\t\t\t\t\tdata-test=\"trigger-mode-manifest\"\n\t\t\t\t\tselected={trigger.mode === 'manifest_intent'}\n\t\t\t\t\tonClick={() => setMode('manifest_intent')}\n\t\t\t\t>\n\t\t\t\t\t<RadioButton\n\t\t\t\t\t\tisActive={trigger.mode === 'manifest_intent'}\n\t\t\t\t\t\tonValueChange={() => setMode('manifest_intent')}\n\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\tactiveColor={COLORS.content.brand}\n\t\t\t\t\t/>\n\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\tManifest intent\n\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\tManifest&apos;s AI classifier routes conversations automatically —\n\t\t\t\t\t\t\tno keywords needed.\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t</RadioCardText>\n\t\t\t\t</RadioCard>\n\n\t\t\t\t<RadioCard\n\t\t\t\t\tdata-test=\"trigger-mode-custom\"\n\t\t\t\t\tselected={trigger.mode === 'custom_intent'}\n\t\t\t\t\tonClick={() => setMode('custom_intent')}\n\t\t\t\t>\n\t\t\t\t\t<RadioButton\n\t\t\t\t\t\tisActive={trigger.mode === 'custom_intent'}\n\t\t\t\t\t\tonValueChange={() => setMode('custom_intent')}\n\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\tactiveColor={COLORS.content.brand}\n\t\t\t\t\t/>\n\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\tCustom intent\n\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\tDefine your own trigger — use exact phrases or describe the\n\t\t\t\t\t\t\tcustomer&apos;s intent.\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t</RadioCardText>\n\t\t\t\t</RadioCard>\n\t\t\t</CardRow>\n\n\t\t\t{trigger.mode === 'manifest_intent' ? (\n\t\t\t\t<FieldBlock>\n\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\tIf customer talks about\n\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t<ChipWrap>\n\t\t\t\t\t\t{trigger.intents.map((intent) => (\n\t\t\t\t\t\t\t<IntentChip key={intent} data-test={`intent-chip-${intent}`}>\n\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\t{labelFor(intent)}\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t<ChipCloseButton\n\t\t\t\t\t\t\t\t\tonClick={() => removeIntent(intent)}\n\t\t\t\t\t\t\t\t\taria-label={`Remove ${labelFor(intent)}`}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<CrossIcon\n\t\t\t\t\t\t\t\t\t\twidth={14}\n\t\t\t\t\t\t\t\t\t\theight={14}\n\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ChipCloseButton>\n\t\t\t\t\t\t\t</IntentChip>\n\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t{adding && remainingOptions.length > 0 ? (\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tdata-test=\"intent-add-dropdown\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\twidth=\"200px\"\n\t\t\t\t\t\t\t\tplaceHolder=\"Select intent\"\n\t\t\t\t\t\t\t\tisSearchable\n\t\t\t\t\t\t\t\toptions={remainingOptions}\n\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\taddIntent(v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tremainingOptions.length > 0 && (\n\t\t\t\t\t\t\t\t<AddChipButton\n\t\t\t\t\t\t\t\t\tdata-test=\"intent-add-button\"\n\t\t\t\t\t\t\t\t\tonClick={() => setAdding(true)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<PlusIcon\n\t\t\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\t\tIntent\n\t\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t\t</AddChipButton>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ChipWrap>\n\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\tThis agent takes over from your main assistant when this intent is\n\t\t\t\t\t\tdetected. The changeover is automatic when you go live.\n\t\t\t\t\t</BodyCaption>\n\t\t\t\t</FieldBlock>\n\t\t\t) : (\n\t\t\t\t<AiTextArea\n\t\t\t\t\tdata-test=\"custom-intent\"\n\t\t\t\t\tlabel=\"Describe the trigger\"\n\t\t\t\t\tvalue={trigger.custom_intent ?? ''}\n\t\t\t\t\tonChange={(text) =>\n\t\t\t\t\t\tpatch({ trigger: { ...trigger, custom_intent: text } })\n\t\t\t\t\t}\n\t\t\t\t\tmaxLength={charLimits.custom_intent}\n\t\t\t\t\tplaceholder=\"e.g. The customer wants to cancel an order they placed.\"\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","Step2WhenItStepsIn","value","patch","availableIntents","charLimits","useAgentBuilderContext","trigger","adding","setAdding","React","setMode","mode","addIntent","intentValue","removeIntent","i","labelFor","v","o","remainingOptions","jsx","StepSectionHeader","CardRow","jsxs","RadioCard","RadioButton","COLORS","RadioCardText","TitleSmall","BodyCaption","FieldBlock","ChipWrap","intent","IntentChip","BodySecondary","ChipCloseButton","CrossIcon","Dropdown","opt","unwrapDropdownValue","AddChipButton","PlusIcon","AiTextArea","text"],"mappings":"ksBA4BMA,EAAOC,EAAAA,iBAAiB,CAAC,EAElBC,EAA+B,IAAM,CACjD,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,iBAAAC,EAAkB,WAAAC,CAAA,EACvCC,EAAAA,uBAAA,EACK,CAAE,QAAAC,GAAYL,EACd,CAACM,EAAQC,CAAS,EAAIC,EAAAA,QAAM,SAAS,EAAK,EAE1CC,EAAWC,GAChBT,EAAM,CAAE,QAAS,CAAE,GAAGI,EAAS,KAAAK,CAAA,EAAQ,EAElCC,EAAaC,GAAwB,CACrCP,EAAQ,QAAQ,SAASO,CAAW,GACxCX,EAAM,CACL,QAAS,CAAE,GAAGI,EAAS,QAAS,CAAC,GAAGA,EAAQ,Q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iB,EAAAA,cAAA,CACA,YAAU,oBACV,QAAS,IAAMhC,EAAU,EAAI,EAE7B,SAAA,CAAAY,EAAAA,IAACqB,EAAAA,QAAA,CACA,MAAO,GACP,OAAQ,GACR,MAAOf,EAAAA,OAAO,QAAQ,SAAA,CAAA,QAEtBQ,EAAAA,cAAA,CAAc,MAAOR,EAAAA,OAAO,QAAQ,UAAW,SAAA,QAAA,CAEhD,CAAA,CAAA,CAAA,CACD,EAGH,QACCG,EAAAA,YAAA,CAAY,MAAOH,EAAAA,OAAO,QAAQ,UAAW,SAAA,4HAAA,CAG9C,CAAA,CAAA,CACD,EAEAN,EAAAA,IAACsB,EAAAA,WAAA,CACA,YAAU,gBACV,MAAM,uBACN,MAAOpC,EAAQ,eAAiB,GAChC,SAAWqC,GACVzC,EAAM,CAAE,QAAS,CAAE,GAAGI,EAAS,cAAeqC,CAAA,EAAQ,EAEvD,UAAWvC,EAAW,cACtB,YAAY,0DACZ,UAAU,OAAA,CAAA,CACX,EAEF,CAEF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("react"),I=require("../../TypographyStyle.js"),T=require("../../../constants/Theme.js"),m=require("../AgentBuilder.styled.js"),$=require("../components/CreateSubAgentPanel.js"),O=require("../components/MentionField.js"),j=require("../components/SelectableListSection.js"),J=require("../components/StepSectionHeader.js"),w=require("../constants/charLimits.js"),Q=require("../constants/steps.js"),V=require("../context/AgentBuilderContext.js"),R=require("../utils/mentionSerialization.js"),E=require("../utils/sourceIcons.js"),X=require("../../dropdown/Dropdown.js"),Y=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},Z=Y(l),ee=t=>{const a=E.SOURCE_ICONS[t];return a?Z.default.createElement(a.Icon,{width:a.w,height:a.h}):void 0},q=t=>({label:t.display_name,value:t.tool_id,leadingIcon:ee(t.source??"manifest")}),_=Q.STEP_DEFINITIONS[2],te=()=>{const{value:t,patch:a,updateField:L,removeReference:x,availableTools:u,availableSubAgents:M,availableModels:h,applicationType:k,insertMention:d,onCreateSubAgent:r,onFetchSubAgent:p,onUpdateSubAgent:f,onImproveSubAgent:H,registerSubAgentCreator:y}=V.useAgentBuilderContext(),[i,g]=l.useState(null),b=l.useRef(0),[N,C]=l.useState([]),S=new Map;M.forEach(e=>S.set(e.id,e)),N.forEach(e=>S.set(e.id,e));const P=Array.from(S.values()),v=l.useCallback(()=>{b.current+=1,g({key:b.current,title:"Create sub-agent"})},[]);l.useEffect(()=>{if(r)return y(v),()=>y(null)},[y,v,r]);const F=l.useCallback(async e=>{if(!p)return;const n=await p(e);b.current+=1,g({key:b.current,title:"Edit sub-agent",editingId:e,initial:n})},[p]),G=l.useCallback(async e=>{if(i?.editingId){if(f){const n=await f(i.editingId,e);C(o=>[...o.filter(c=>c.id!==n.id),n])}}else if(r){const n=await r(e);C(o=>[...o,n]),a({subagents:[...t.subagents,n.id]}),d("subagent",n.id,`sub-agent: ${n.name}`)}g(null)},[i,f,r,a,t.subagents,d]),B=t.tools.map(e=>{const n=u.find(o=>o.tool_id===e);return n?{id:e,label:n.display_name,icon:E.SOURCE_ICONS[n.source??"manifest"]}:null}).filter(e=>e!==null),D=u.map(q),K=(()=>{const e=[],n=new Map;return u.forEach(o=>{const c=o.source??"manifest";n.has(c)||(n.set(c,[]),e.push(c)),n.get(c)?.push(q(o))}),e.map(o=>({source:o,label:R.toolSourceLabel(o),options:n.get(o)??[]}))})(),U=t.subagents.map(e=>{const n=S.get(e);return n?{id:e,label:n.name}:null}).filter(e=>e!==null),z=P.map(e=>({label:e.name,value:e.id})),W=h.map(e=>({label:e.label,value:e.value,selected:e.value===t.model})),A=h.find(e=>e.value===t.model);return s.jsxs("div",{className:"bik-agent-step bik-agent-step--response",children:[s.jsx(J.StepSectionHeader,{title:_.title,helper:_.helper}),s.jsxs(m.Step3Grid,{children:[s.jsxs(m.Step3Main,{children:[s.jsx(O.MentionField,{fieldKey:"instructions","data-test":"agent-instructions",label:"Instructions",maxLength:w.AGENT_CHAR_LIMITS.instructions,placeholder:"Write what this agent should do. Type @ to reference a tool or sub-agent.",minHeight:"200px"}),s.jsx(O.MentionField,{fieldKey:"guardrail","data-test":"agent-guardrail",label:"Guardrails",maxLength:w.AGENT_CHAR_LIMITS.guardrail,placeholder:"Things this agent must never do. Type @ to reference a tool or sub-agent.",minHeight:"140px"})]}),s.jsxs(m.Step3Side,{children:[s.jsx(j.SelectableListSection,{title:"Tools",helper:"Actions this agent can take while responding.",dataTestPrefix:"agent-tools",items:B,addableOptions:D,sourceGroups:K,emptyText:"No tools added yet.",onAdd:e=>{d("tool",e),t.tools.includes(e)||a({tools:[...t.tools,e]})},onRemove:e=>x("tool",e)}),s.jsx(j.SelectableListSection,{title:"Sub-agents",helper:"Other agents this agent can hand off the conversation to.",dataTestPrefix:"agent-subagents",items:U,addableOptions:z,emptyText:"No sub-agents added yet.",onAdd:e=>{d("subagent",e),t.subagents.includes(e)||a({subagents:[...t.subagents,e]})},onRemove:e=>x("subagent",e),onConfigure:p?F:void 0,createOption:r?{label:"Create new",onSelect:v}:void 0}),h.length>0&&s.jsxs(m.SideSection,{children:[s.jsx(I.TitleSmall,{color:T.COLORS.content.primary,children:"Advanced settings"}),s.jsx(I.TitleSmall,{color:T.COLORS.content.secondary,children:"Select AI model"}),s.jsx(X.Dropdown,{"data-test":"agent-model",size:"small",width:"100%",placeHolder:"Select model",options:W,defaultOptions:A?[{label:A.label,value:A.value}]:void 0,onSelect:e=>{const o=(Array.isArray(e)?e[0]:e)?.value;o&&L("model",o)}})]})]})]}),i&&s.jsx($.CreateSubAgentPanel,{title:i.title,initial:i.initial,availableTools:u,appLabel:R.appTypeLabel(k),onImprove:H,onClose:()=>g(null),onSave:G},i.key)]})};exports.Step3HowItResponds=te;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),l=require("react"),M=require("../../TypographyStyle.js"),L=require("../../../constants/Theme.js"),h=require("../AgentBuilder.styled.js"),Q=require("../components/CreateSubAgentPanel.js"),R=require("../components/MentionField.js"),E=require("../components/SelectableListSection.js"),X=require("../components/StepSectionHeader.js"),Y=require("../constants/steps.js"),Z=require("../context/AgentBuilderContext.js"),u=require("../utils/mentionSerialization.js"),C=require("../utils/sourceIcons.js"),ee=require("../../dropdown/Dropdown.js"),te=require("../../dropdown/utils.js"),ne=n=>C.renderSourceIcon(C.SOURCE_ICONS[n])??void 0,k=n=>({label:n.display_name,value:n.tool_id,leadingIcon:ne(n.source??"manifest")}),P=Y.STEP_DEFINITIONS[2],oe=()=>{const{value:n,patch:d,updateField:_,removeReference:T,availableTools:c,availableSubAgents:H,availableModels:f,applicationType:O,charLimits:v,insertMention:p,onCreateSubAgent:i,onFetchSubAgent:g,onUpdateSubAgent:y,onImproveSubAgent:N,registerSubAgentCreator:I}=Z.useAgentBuilderContext(),[a,b]=l.useState(null),S=l.useRef(0),[F,j]=l.useState([]),m=new Map;H.forEach(e=>m.set(e.id,e)),F.forEach(e=>m.set(e.id,e));const w=Array.from(m.values()),A=l.useCallback(()=>{S.current+=1,b({key:S.current,title:"Create sub-agent"})},[]);l.useEffect(()=>{if(i)return I(A),()=>I(null)},[I,A,i]);const B=l.useCallback(async e=>{if(!g)return;const t=await g(e);S.current+=1,b({key:S.current,title:"Edit sub-agent",editingId:e,initial:t})},[g]),D=l.useCallback(async e=>{if(a?.editingId){if(y){const t=await y(a.editingId,e);j(s=>[...s.filter(r=>r.id!==t.id),t])}}else if(i){const t=await i(e);j(s=>[...s,t]),d({subagents:[...n.subagents,t.id]}),p("subagent",t.id,`sub-agent: ${t.name}`)}b(null)},[a,y,i,d,n.subagents,p]),G=n.tools.map(e=>{const t=c.find(s=>s.tool_id===e);return t?{id:e,label:t.display_name,icon:C.SOURCE_ICONS[t.source??"manifest"]}:null}).filter(e=>e!==null),K=c.map(k),U=(()=>{const e=[],t=new Map;return c.forEach(s=>{const r=s.source??"manifest";t.has(r)||(t.set(r,[]),e.push(r)),t.get(r)?.push(k(s))}),e.map(s=>({source:s,label:u.toolSourceLabel(s),options:t.get(s)??[]}))})(),z=n.subagents.map(e=>{const t=m.get(e);return t?{id:e,label:t.name}:null}).filter(e=>e!==null),V=w.map(e=>({label:e.name,value:e.id})),q=u.appTypeLabel(O),W=u.buildAgentMentionItems(c,[],q),$=u.buildAgentMentionItems([],w,q),J=f.map(e=>({label:e.label,value:e.value,selected:e.value===n.model})),x=f.find(e=>e.value===n.model);return o.jsxs("div",{className:"bik-agent-step bik-agent-step--response",children:[o.jsx(X.StepSectionHeader,{title:P.title,helper:P.helper}),o.jsxs(h.Step3Grid,{children:[o.jsxs(h.Step3Main,{children:[o.jsx(R.MentionField,{fieldKey:"instructions","data-test":"agent-instructions",label:"Instructions",maxLength:v.instructions,placeholder:"Write what this agent should do. Type @ to reference a tool or sub-agent.",minHeight:"200px"}),o.jsx(R.MentionField,{fieldKey:"guardrail","data-test":"agent-guardrail",label:"Guardrails",maxLength:v.guardrail,placeholder:"Things this agent must never do. Type @ to reference a tool or sub-agent.",minHeight:"140px"})]}),o.jsxs(h.Step3Side,{children:[o.jsx(E.SelectableListSection,{title:"Tools",helper:"Actions this agent can take while responding.",dataTestPrefix:"agent-tools",items:G,addableOptions:K,sourceGroups:U,mentionItems:W,emptyText:"No tools added yet.",onAdd:e=>{p("tool",e),n.tools.includes(e)||d({tools:[...n.tools,e]})},onRemove:e=>T("tool",e)}),o.jsx(E.SelectableListSection,{title:"Sub-agents",helper:"Other agents this agent can hand off the conversation to.",dataTestPrefix:"agent-subagents",items:z,addableOptions:V,mentionItems:$,emptyText:"No sub-agents added yet.",onAdd:e=>{p("subagent",e),n.subagents.includes(e)||d({subagents:[...n.subagents,e]})},onRemove:e=>T("subagent",e),onConfigure:g?B:void 0,createOption:i?{label:"Create new",onSelect:A}:void 0}),f.length>0&&o.jsxs(h.SideSection,{children:[o.jsx(M.TitleSmall,{color:L.COLORS.content.primary,children:"Advanced settings"}),o.jsx(M.TitleSmall,{color:L.COLORS.content.secondary,children:"Select AI model"}),o.jsx(ee.Dropdown,{"data-test":"agent-model",size:"small",width:"100%",placeHolder:"Select model",options:J,defaultOptions:x?[{label:x.label,value:x.value}]:void 0,onSelect:e=>{const t=te.unwrapDropdownValue(e);t&&_("model",t)}})]})]})]}),a&&o.jsx(Q.CreateSubAgentPanel,{title:a.title,initial:a.initial,availableTools:c,appLabel:u.appTypeLabel(O),charLimits:v,onImprove:N,onClose:()=>b(null),onSave:D},a.key)]})};exports.Step3HowItResponds=oe;
2
2
  //# sourceMappingURL=Step3HowItResponds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Step3HowItResponds.js","sources":["../../../../../src/components/agent-builder/steps/Step3HowItResponds.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { Dropdown } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentTool, SubAgentDraft, SubAgentRef } from '../AgentBuilder.model';\nimport {\n\tSideSection,\n\tStep3Grid,\n\tStep3Main,\n\tStep3Side,\n} from '../AgentBuilder.styled';\nimport { CreateSubAgentPanel } from '../components/CreateSubAgentPanel';\nimport { MentionField } from '../components/MentionField';\nimport {\n\tSelectableItem,\n\tSelectableListSection,\n\tSourceGroup,\n} from '../components/SelectableListSection';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport { appTypeLabel, toolSourceLabel } from '../utils/mentionSerialization';\nimport { SOURCE_ICONS } from '../utils/sourceIcons';\n\n/** Source brand glyph for a tool, as a dropdown leadingIcon element. */\nconst toolIconEl = (source: string): JSX.Element | undefined => {\n\tconst ic = SOURCE_ICONS[source];\n\treturn ic\n\t\t? React.createElement(ic.Icon, { width: ic.w, height: ic.h })\n\t\t: undefined;\n};\n\n/** Dropdown option for a tool: icon left of the name, no description. */\nconst toolOption = (t: AgentTool): SingleOption => ({\n\tlabel: t.display_name,\n\tvalue: t.tool_id,\n\tleadingIcon: toolIconEl(t.source ?? 'manifest'),\n});\n\nconst STEP = STEP_DEFINITIONS[2];\n\n/** Drawer state — null when closed; `key` remounts it fresh per open. */\ninterface SubAgentPanelState {\n\tkey: number;\n\ttitle: string;\n\teditingId?: string;\n\tinitial?: SubAgentDraft;\n}\n\nexport const Step3HowItResponds: React.FC = () => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\tupdateField,\n\t\tremoveReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableModels,\n\t\tapplicationType,\n\t\tinsertMention,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tregisterSubAgentCreator,\n\t} = useAgentBuilderContext();\n\n\tconst [panel, setPanel] = useState<SubAgentPanelState | null>(null);\n\tconst panelKeyRef = useRef(0);\n\t// Sub-agents created / edited in this session, so a chip resolves (and reflects\n\t// a renamed sub-agent) before the consumer refreshes `availableSubAgents`.\n\tconst [createdSubAgents, setCreatedSubAgents] = useState<SubAgentRef[]>([]);\n\t// Created/edited refs take precedence over the consumer-supplied list.\n\tconst subAgentById = new Map<string, SubAgentRef>();\n\tavailableSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tcreatedSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tconst knownSubAgents = Array.from(subAgentById.values());\n\n\tconst openCreate = useCallback(() => {\n\t\tpanelKeyRef.current += 1;\n\t\tsetPanel({ key: panelKeyRef.current, title: 'Create sub-agent' });\n\t}, []);\n\n\t// Let the `@` picker's \"Create new\" row open this step's drawer.\n\tuseEffect(() => {\n\t\tif (!onCreateSubAgent) {\n\t\t\treturn;\n\t\t}\n\t\tregisterSubAgentCreator(openCreate);\n\t\treturn () => registerSubAgentCreator(null);\n\t}, [registerSubAgentCreator, openCreate, onCreateSubAgent]);\n\n\tconst openConfigure = useCallback(\n\t\tasync (id: string) => {\n\t\t\tif (!onFetchSubAgent) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst data = await onFetchSubAgent(id);\n\t\t\tpanelKeyRef.current += 1;\n\t\t\tsetPanel({\n\t\t\t\tkey: panelKeyRef.current,\n\t\t\t\ttitle: 'Edit sub-agent',\n\t\t\t\teditingId: id,\n\t\t\t\tinitial: data,\n\t\t\t});\n\t\t},\n\t\t[onFetchSubAgent],\n\t);\n\n\tconst handlePanelSave = useCallback(\n\t\tasync (draft: SubAgentDraft) => {\n\t\t\tif (panel?.editingId) {\n\t\t\t\tif (onUpdateSubAgent) {\n\t\t\t\t\tconst ref = await onUpdateSubAgent(panel.editingId, draft);\n\t\t\t\t\tsetCreatedSubAgents((prev) => [\n\t\t\t\t\t\t...prev.filter((s) => s.id !== ref.id),\n\t\t\t\t\t\tref,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else if (onCreateSubAgent) {\n\t\t\t\tconst ref = await onCreateSubAgent(draft);\n\t\t\t\tsetCreatedSubAgents((prev) => [...prev, ref]);\n\t\t\t\tpatch({ subagents: [...value.subagents, ref.id] });\n\t\t\t\tinsertMention('subagent', ref.id, `sub-agent: ${ref.name}`);\n\t\t\t}\n\t\t\tsetPanel(null);\n\t\t},\n\t\t[\n\t\t\tpanel,\n\t\t\tonUpdateSubAgent,\n\t\t\tonCreateSubAgent,\n\t\t\tpatch,\n\t\t\tvalue.subagents,\n\t\t\tinsertMention,\n\t\t],\n\t);\n\n\tconst toolItems: SelectableItem[] = value.tools\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\treturn tool\n\t\t\t\t? {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel: tool.display_name,\n\t\t\t\t\t\ticon: SOURCE_ICONS[tool.source ?? 'manifest'],\n\t\t\t\t }\n\t\t\t\t: null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\t// All tools are offered (even already-added ones) so a tool can be referenced\n\t// again in the text; the chip list below still shows each only once.\n\tconst toolOptions: SingleOption[] = availableTools.map(toolOption);\n\n\t// Group tools by source (Manifest / Shopify / …) for the empty-state buttons.\n\tconst toolSourceGroups: SourceGroup[] = (() => {\n\t\tconst order: string[] = [];\n\t\tconst bySource = new Map<string, SingleOption[]>();\n\t\tavailableTools.forEach((t) => {\n\t\t\tconst src = t.source ?? 'manifest';\n\t\t\tif (!bySource.has(src)) {\n\t\t\t\tbySource.set(src, []);\n\t\t\t\torder.push(src);\n\t\t\t}\n\t\t\tbySource.get(src)?.push(toolOption(t));\n\t\t});\n\t\treturn order.map((src) => ({\n\t\t\tsource: src,\n\t\t\tlabel: toolSourceLabel(src),\n\t\t\toptions: bySource.get(src) ?? [],\n\t\t}));\n\t})();\n\n\tconst subAgentItems: SelectableItem[] = value.subagents\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst sub = subAgentById.get(id);\n\t\t\treturn sub ? { id, label: sub.name } : null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\tconst subAgentOptions: SingleOption[] = knownSubAgents.map((s) => ({\n\t\tlabel: s.name,\n\t\tvalue: s.id,\n\t}));\n\n\tconst modelOptions: SingleOption[] = availableModels.map((m) => ({\n\t\tlabel: m.label,\n\t\tvalue: m.value,\n\t\tselected: m.value === value.model,\n\t}));\n\tconst selectedModel = availableModels.find((m) => m.value === value.model);\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--response\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<Step3Grid>\n\t\t\t\t<Step3Main>\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"instructions\"\n\t\t\t\t\t\tdata-test=\"agent-instructions\"\n\t\t\t\t\t\tlabel=\"Instructions\"\n\t\t\t\t\t\tmaxLength={AGENT_CHAR_LIMITS.instructions}\n\t\t\t\t\t\tplaceholder=\"Write what this agent should do. Type @ to reference a tool or sub-agent.\"\n\t\t\t\t\t\tminHeight=\"200px\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"guardrail\"\n\t\t\t\t\t\tdata-test=\"agent-guardrail\"\n\t\t\t\t\t\tlabel=\"Guardrails\"\n\t\t\t\t\t\tmaxLength={AGENT_CHAR_LIMITS.guardrail}\n\t\t\t\t\t\tplaceholder=\"Things this agent must never do. Type @ to reference a tool or sub-agent.\"\n\t\t\t\t\t\tminHeight=\"140px\"\n\t\t\t\t\t/>\n\t\t\t\t</Step3Main>\n\n\t\t\t\t<Step3Side>\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Tools\"\n\t\t\t\t\t\thelper=\"Actions this agent can take while responding.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-tools\"\n\t\t\t\t\t\titems={toolItems}\n\t\t\t\t\t\taddableOptions={toolOptions}\n\t\t\t\t\t\tsourceGroups={toolSourceGroups}\n\t\t\t\t\t\temptyText=\"No tools added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\t// Always drop a chip at the cursor; keep the list deduped.\n\t\t\t\t\t\t\tinsertMention('tool', id);\n\t\t\t\t\t\t\tif (!value.tools.includes(id)) {\n\t\t\t\t\t\t\t\tpatch({ tools: [...value.tools, id] });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={(id) => removeReference('tool', id)}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Sub-agents\"\n\t\t\t\t\t\thelper=\"Other agents this agent can hand off the conversation to.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-subagents\"\n\t\t\t\t\t\titems={subAgentItems}\n\t\t\t\t\t\taddableOptions={subAgentOptions}\n\t\t\t\t\t\temptyText=\"No sub-agents added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\tinsertMention('subagent', id);\n\t\t\t\t\t\t\tif (!value.subagents.includes(id)) {\n\t\t\t\t\t\t\t\tpatch({ subagents: [...value.subagents, id] });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={(id) => removeReference('subagent', id)}\n\t\t\t\t\t\tonConfigure={onFetchSubAgent ? openConfigure : undefined}\n\t\t\t\t\t\tcreateOption={\n\t\t\t\t\t\t\tonCreateSubAgent\n\t\t\t\t\t\t\t\t? { label: 'Create new', onSelect: openCreate }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{availableModels.length > 0 && (\n\t\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tAdvanced settings\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\tSelect AI model\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tdata-test=\"agent-model\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\tplaceHolder=\"Select model\"\n\t\t\t\t\t\t\t\toptions={modelOptions}\n\t\t\t\t\t\t\t\tdefaultOptions={\n\t\t\t\t\t\t\t\t\tselectedModel\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: selectedModel.label,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: selectedModel.value,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\tconst single = Array.isArray(opt) ? opt[0] : opt;\n\t\t\t\t\t\t\t\t\tconst v = (single as SingleOption)?.value;\n\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\tupdateField('model', v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SideSection>\n\t\t\t\t\t)}\n\t\t\t\t</Step3Side>\n\t\t\t</Step3Grid>\n\n\t\t\t{panel && (\n\t\t\t\t<CreateSubAgentPanel\n\t\t\t\t\tkey={panel.key}\n\t\t\t\t\ttitle={panel.title}\n\t\t\t\t\tinitial={panel.initial}\n\t\t\t\t\tavailableTools={availableTools}\n\t\t\t\t\tappLabel={appTypeLabel(applicationType)}\n\t\t\t\t\tonImprove={onImproveSubAgent}\n\t\t\t\t\tonClose={() => setPanel(null)}\n\t\t\t\t\tonSave={handlePanelSave}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"names":["toolIconEl","source","ic","SOURCE_ICONS","React","toolOption","STEP","STEP_DEFINITIONS","Step3HowItResponds","value","patch","updateField","removeReference","availableTools","availableSubAgents","availableModels","applicationType","insertMention","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","registerSubAgentCreator","useAgentBuilderContext","panel","setPanel","useState","panelKeyRef","useRef","createdSubAgents","setCreatedSubAgents","subAgentById","s","knownSubAgents","openCreate","useCallback","useEffect","openConfigure","id","data","handlePanelSave","draft","ref","prev","toolItems","tool","t","x","toolOptions","toolSourceGroups","order","bySource","src","toolSourceLabel","subAgentItems","sub","subAgentOptions","modelOptions","m","selectedModel","jsxs","jsx","StepSectionHeader","Step3Grid","Step3Main","MentionField","AGENT_CHAR_LIMITS","Step3Side","SelectableListSection","SideSection","TitleSmall","COLORS","Dropdown","opt","v","CreateSubAgentPanel","appT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CAAC,EAAIA,IACT,MAChCC,GACH/D,EAAY,QAAS+D,CAAC,CAExB,CAAA,CAAA,CACD,CAAA,CACD,CAAA,CAAA,CAEF,CAAA,EACD,EAEClD,GACAqC,EAAAA,IAACc,EAAAA,oBAAA,CAEA,MAAOnD,EAAM,MACb,QAASA,EAAM,QACf,eAAAX,EACA,SAAU+D,EAAAA,aAAa5D,CAAe,EACtC,UAAWK,EACX,QAAS,IAAMI,EAAS,IAAI,EAC5B,OAAQe,CAAA,EAPHhB,EAAM,GAAA,CAQZ,EAEF,CAEF"}
1
+ {"version":3,"file":"Step3HowItResponds.js","sources":["../../../../../src/components/agent-builder/steps/Step3HowItResponds.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentTool, SubAgentDraft, SubAgentRef } from '../AgentBuilder.model';\nimport {\n\tSideSection,\n\tStep3Grid,\n\tStep3Main,\n\tStep3Side,\n} from '../AgentBuilder.styled';\nimport { CreateSubAgentPanel } from '../components/CreateSubAgentPanel';\nimport { MentionField } from '../components/MentionField';\nimport {\n\tSelectableItem,\n\tSelectableListSection,\n\tSourceGroup,\n} from '../components/SelectableListSection';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport { renderSourceIcon, SOURCE_ICONS } from '../utils/sourceIcons';\n\n/** Source brand glyph for a tool, as a dropdown leadingIcon element. */\nconst toolIconEl = (source: string): JSX.Element | undefined =>\n\trenderSourceIcon(SOURCE_ICONS[source]) ?? undefined;\n\n/** Dropdown option for a tool: icon left of the name, no description. */\nconst toolOption = (t: AgentTool): SingleOption => ({\n\tlabel: t.display_name,\n\tvalue: t.tool_id,\n\tleadingIcon: toolIconEl(t.source ?? 'manifest'),\n});\n\nconst STEP = STEP_DEFINITIONS[2];\n\n/** Drawer state — null when closed; `key` remounts it fresh per open. */\ninterface SubAgentPanelState {\n\tkey: number;\n\ttitle: string;\n\teditingId?: string;\n\tinitial?: SubAgentDraft;\n}\n\nexport const Step3HowItResponds: React.FC = () => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\tupdateField,\n\t\tremoveReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableModels,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tinsertMention,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tregisterSubAgentCreator,\n\t} = useAgentBuilderContext();\n\n\tconst [panel, setPanel] = useState<SubAgentPanelState | null>(null);\n\tconst panelKeyRef = useRef(0);\n\t// Sub-agents created / edited in this session, so a chip resolves (and reflects\n\t// a renamed sub-agent) before the consumer refreshes `availableSubAgents`.\n\tconst [createdSubAgents, setCreatedSubAgents] = useState<SubAgentRef[]>([]);\n\t// Created/edited refs take precedence over the consumer-supplied list.\n\tconst subAgentById = new Map<string, SubAgentRef>();\n\tavailableSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tcreatedSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tconst knownSubAgents = Array.from(subAgentById.values());\n\n\tconst openCreate = useCallback(() => {\n\t\tpanelKeyRef.current += 1;\n\t\tsetPanel({ key: panelKeyRef.current, title: 'Create sub-agent' });\n\t}, []);\n\n\t// Let the `@` picker's \"Create new\" row open this step's drawer.\n\tuseEffect(() => {\n\t\tif (!onCreateSubAgent) {\n\t\t\treturn;\n\t\t}\n\t\tregisterSubAgentCreator(openCreate);\n\t\treturn () => registerSubAgentCreator(null);\n\t}, [registerSubAgentCreator, openCreate, onCreateSubAgent]);\n\n\tconst openConfigure = useCallback(\n\t\tasync (id: string) => {\n\t\t\tif (!onFetchSubAgent) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst data = await onFetchSubAgent(id);\n\t\t\tpanelKeyRef.current += 1;\n\t\t\tsetPanel({\n\t\t\t\tkey: panelKeyRef.current,\n\t\t\t\ttitle: 'Edit sub-agent',\n\t\t\t\teditingId: id,\n\t\t\t\tinitial: data,\n\t\t\t});\n\t\t},\n\t\t[onFetchSubAgent],\n\t);\n\n\tconst handlePanelSave = useCallback(\n\t\tasync (draft: SubAgentDraft) => {\n\t\t\tif (panel?.editingId) {\n\t\t\t\tif (onUpdateSubAgent) {\n\t\t\t\t\tconst ref = await onUpdateSubAgent(panel.editingId, draft);\n\t\t\t\t\tsetCreatedSubAgents((prev) => [\n\t\t\t\t\t\t...prev.filter((s) => s.id !== ref.id),\n\t\t\t\t\t\tref,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else if (onCreateSubAgent) {\n\t\t\t\tconst ref = await onCreateSubAgent(draft);\n\t\t\t\tsetCreatedSubAgents((prev) => [...prev, ref]);\n\t\t\t\tpatch({ subagents: [...value.subagents, ref.id] });\n\t\t\t\tinsertMention('subagent', ref.id, `sub-agent: ${ref.name}`);\n\t\t\t}\n\t\t\tsetPanel(null);\n\t\t},\n\t\t[\n\t\t\tpanel,\n\t\t\tonUpdateSubAgent,\n\t\t\tonCreateSubAgent,\n\t\t\tpatch,\n\t\t\tvalue.subagents,\n\t\t\tinsertMention,\n\t\t],\n\t);\n\n\tconst toolItems: SelectableItem[] = value.tools\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\treturn tool\n\t\t\t\t? {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel: tool.display_name,\n\t\t\t\t\t\ticon: SOURCE_ICONS[tool.source ?? 'manifest'],\n\t\t\t\t }\n\t\t\t\t: null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\t// All tools are offered (even already-added ones) so a tool can be referenced\n\t// again in the text; the chip list below still shows each only once.\n\tconst toolOptions: SingleOption[] = availableTools.map(toolOption);\n\n\t// Group tools by source (Manifest / Shopify / …) for the empty-state buttons.\n\tconst toolSourceGroups: SourceGroup[] = (() => {\n\t\tconst order: string[] = [];\n\t\tconst bySource = new Map<string, SingleOption[]>();\n\t\tavailableTools.forEach((t) => {\n\t\t\tconst src = t.source ?? 'manifest';\n\t\t\tif (!bySource.has(src)) {\n\t\t\t\tbySource.set(src, []);\n\t\t\t\torder.push(src);\n\t\t\t}\n\t\t\tbySource.get(src)?.push(toolOption(t));\n\t\t});\n\t\treturn order.map((src) => ({\n\t\t\tsource: src,\n\t\t\tlabel: toolSourceLabel(src),\n\t\t\toptions: bySource.get(src) ?? [],\n\t\t}));\n\t})();\n\n\tconst subAgentItems: SelectableItem[] = value.subagents\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst sub = subAgentById.get(id);\n\t\t\treturn sub ? { id, label: sub.name } : null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\tconst subAgentOptions: SingleOption[] = knownSubAgents.map((s) => ({\n\t\tlabel: s.name,\n\t\tvalue: s.id,\n\t}));\n\n\t// Per-section `@`-picker items so the header \"+\" opens the same reference\n\t// picker as the Instructions editor, drilled straight into this section's\n\t// category (tools OR sub-agents).\n\tconst appLabel = appTypeLabel(applicationType);\n\tconst toolMentionItems = buildAgentMentionItems(availableTools, [], appLabel);\n\tconst subAgentMentionItems = buildAgentMentionItems(\n\t\t[],\n\t\tknownSubAgents,\n\t\tappLabel,\n\t);\n\n\tconst modelOptions: SingleOption[] = availableModels.map((m) => ({\n\t\tlabel: m.label,\n\t\tvalue: m.value,\n\t\tselected: m.value === value.model,\n\t}));\n\tconst selectedModel = availableModels.find((m) => m.value === value.model);\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--response\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<Step3Grid>\n\t\t\t\t<Step3Main>\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"instructions\"\n\t\t\t\t\t\tdata-test=\"agent-instructions\"\n\t\t\t\t\t\tlabel=\"Instructions\"\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder=\"Write what this agent should do. Type @ to reference a tool or sub-agent.\"\n\t\t\t\t\t\tminHeight=\"200px\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"guardrail\"\n\t\t\t\t\t\tdata-test=\"agent-guardrail\"\n\t\t\t\t\t\tlabel=\"Guardrails\"\n\t\t\t\t\t\tmaxLength={charLimits.guardrail}\n\t\t\t\t\t\tplaceholder=\"Things this agent must never do. Type @ to reference a tool or sub-agent.\"\n\t\t\t\t\t\tminHeight=\"140px\"\n\t\t\t\t\t/>\n\t\t\t\t</Step3Main>\n\n\t\t\t\t<Step3Side>\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Tools\"\n\t\t\t\t\t\thelper=\"Actions this agent can take while responding.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-tools\"\n\t\t\t\t\t\titems={toolItems}\n\t\t\t\t\t\taddableOptions={toolOptions}\n\t\t\t\t\t\tsourceGroups={toolSourceGroups}\n\t\t\t\t\t\tmentionItems={toolMentionItems}\n\t\t\t\t\t\temptyText=\"No tools added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\t// Always drop a chip at the cursor; keep the list deduped.\n\t\t\t\t\t\t\tinsertMention('tool', id);\n\t\t\t\t\t\t\tif (!value.tools.includes(id)) {\n\t\t\t\t\t\t\t\tpatch({ tools: [...value.tools, id] });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={(id) => removeReference('tool', id)}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Sub-agents\"\n\t\t\t\t\t\thelper=\"Other agents this agent can hand off the conversation to.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-subagents\"\n\t\t\t\t\t\titems={subAgentItems}\n\t\t\t\t\t\taddableOptions={subAgentOptions}\n\t\t\t\t\t\tmentionItems={subAgentMentionItems}\n\t\t\t\t\t\temptyText=\"No sub-agents added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\tinsertMention('subagent', id);\n\t\t\t\t\t\t\tif (!value.subagents.includes(id)) {\n\t\t\t\t\t\t\t\tpatch({ subagents: [...value.subagents, id] });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={(id) => removeReference('subagent', id)}\n\t\t\t\t\t\tonConfigure={onFetchSubAgent ? openConfigure : undefined}\n\t\t\t\t\t\tcreateOption={\n\t\t\t\t\t\t\tonCreateSubAgent\n\t\t\t\t\t\t\t\t? { label: 'Create new', onSelect: openCreate }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{availableModels.length > 0 && (\n\t\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tAdvanced settings\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\tSelect AI model\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tdata-test=\"agent-model\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\tplaceHolder=\"Select model\"\n\t\t\t\t\t\t\t\toptions={modelOptions}\n\t\t\t\t\t\t\t\tdefaultOptions={\n\t\t\t\t\t\t\t\t\tselectedModel\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: selectedModel.label,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: selectedModel.value,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\tupdateField('model', v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SideSection>\n\t\t\t\t\t)}\n\t\t\t\t</Step3Side>\n\t\t\t</Step3Grid>\n\n\t\t\t{panel && (\n\t\t\t\t<CreateSubAgentPanel\n\t\t\t\t\tkey={panel.key}\n\t\t\t\t\ttitle={panel.title}\n\t\t\t\t\tinitial={panel.initial}\n\t\t\t\t\tavailableTools={availableTools}\n\t\t\t\t\tappLabel={appTypeLabel(applicationType)}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tonImprove={onImproveSubAgent}\n\t\t\t\t\tonClose={() => setPanel(null)}\n\t\t\t\t\tonSave={handlePanelSave}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"names":["toolIconEl","source","renderSourceIcon","SOURCE_ICONS","toolOption","t","STEP","STEP_DEFINITIONS","Step3HowItResponds","value","patch","updateField","removeReference","availableTools","availableSubAgents","availableModels","applicationType","charLimits","insertMention","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","registerSubAgentCreator","useAgentBuilderContext","panel","setPanel","useState","panelKeyRef","useRef","createdSubAgents","setCreatedSubAgents","subAgentById","s","knownSubAgents","openCreate","useCallback","useEffect","openConfigure","id","data","handlePanelSave","draft","ref","prev","toolItems","tool","x","toolOptions","toolSourceGroups","order","bySource","src","toolSourceLabel","subAgentItems","sub","subAgentOptions","appLabel","appTypeLabel","toolMentionItems","buildAgentMentionItems","subAgentMentionItems","modelOptions","m","selectedModel","jsxs","jsx","StepSectionHeader","Step3Grid","Step3Main","MentionField","Step3Side","SelectableListSection","SideSection","TitleSmall","COLORS","Dropdown","opt","v","unwrapDropdownValue","CreateSubAgentPanel"],"mappings":"mrBA8BMA,GAAcC,GACnBC,EAAAA,iBAAiBC,EAAAA,aAAaF,CAAM,CAAC,GAAK,OAGrCG,EAAcC,IAAgC,CACnD,MAAOA,EAAE,aACT,MAAOA,EAAE,QACT,YAAaL,GAAWK,EAAE,QAAU,UAAU,CAC/C,GAEMC,EAAOC,EAAAA,iBAAiB,CAAC,EAUlBC,GAA+B,IAAM,CACjD,KAAM,CACL,MAAAC,EACA,MAAAC,EACA,YAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,mBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,wBAAAC,CAAA,EACGC,yBAAA,EAEE,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAoC,IAAI,EAC5DC,EAAcC,EAAAA,OAAO,CAAC,EAGtB,CAACC,EAAkBC,CAAmB,EAAIJ,EAAAA,SAAwB,CAAA,CAAE,EAEpEK,MAAmB,IACzBlB,EAAmB,QAASmB,GAAMD,EAAa,IAAIC,EAAE,GAAIA,CAAC,CAAC,EAC3DH,EAAiB,QAASG,GAAMD,EAAa,IAAIC,EAAE,GAAIA,CAAC,CAAC,EACzD,MAAMC,EAAiB,MAAM,KAAKF,EAAa,QAAQ,EAEjDG,EAAaC,EAAAA,YAAY,IAAM,CACpCR,EAAY,SAAW,EACvBF,EAAS,CAAE,IAAKE,EAAY,QAAS,MAAO,mBAAoB,CACjE,EAAG,CAAA,CAAE,EAGLS,EAAAA,U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,QAAQ,QAAS,SAAA,oBAE3C,QACCD,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,UAAW,SAAA,kBAE7C,EACAT,EAAAA,IAACU,GAAAA,SAAA,CACA,YAAU,cACV,KAAK,QACL,MAAM,OACN,YAAY,eACZ,QAASd,EACT,eACCE,EACG,CACA,CACC,MAAOA,EAAc,MACrB,MAAOA,EAAc,KAAA,CACtB,EAEA,OAEJ,SAAWa,GAAQ,CAClB,MAAMC,EAAIC,GAAAA,oBAAoBF,CAAG,EAC7BC,GACHnE,EAAY,QAASmE,CAAC,CAExB,CAAA,CAAA,CACD,CAAA,CACD,CAAA,CAAA,CAEF,CAAA,EACD,EAECrD,GACAyC,EAAAA,IAACc,EAAAA,oBAAA,CAEA,MAAOvD,EAAM,MACb,QAASA,EAAM,QACf,eAAAZ,EACA,SAAU6C,EAAAA,aAAa1C,CAAe,EACtC,WAAAC,EACA,UAAWK,EACX,QAAS,IAAMI,EAAS,IAAI,EAC5B,OAAQe,CAAA,EARHhB,EAAM,GAAA,CASZ,EAEF,CAEF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../radioButton/RadioButton.js"),r=require("../../TypographyStyle.js"),n=require("../../../constants/Theme.js"),o=require("../AgentBuilder.styled.js"),h=require("../components/AiTextArea.js"),u=require("../components/StepSectionHeader.js"),p=require("../constants/charLimits.js"),C=require("../constants/steps.js"),x=require("../context/AgentBuilderContext.js"),d=C.STEP_DEFINITIONS[3],S=()=>{const{value:l,patch:a}=x.useAgentBuilderContext(),{handover:t}=l,s=i=>a({handover:{...t,method:i}});return e.jsxs("div",{className:"bik-agent-step bik-agent-step--handover",children:[e.jsx(u.StepSectionHeader,{title:d.title,helper:d.helper}),e.jsx(h.AiTextArea,{"data-test":"handover-when",label:"Handover when",value:t.when,onChange:i=>a({handover:{...t,when:i}}),maxLength:p.AGENT_CHAR_LIMITS.handoverWhen,placeholder:"e.g. Hand over if the customer is angry or requests a human agent.",minHeight:"120px"}),e.jsxs(o.FieldBlock,{children:[e.jsx(r.TitleSmall,{color:n.COLORS.content.primary,children:"Handover method"}),e.jsxs(o.CardRow,{children:[e.jsxs(o.RadioCard,{"data-test":"handover-method-default",selected:t.method==="default",onClick:()=>s("default"),children:[e.jsx(c.RadioButton,{isActive:t.method==="default",onValueChange:()=>s("default"),skipSelectingOff:!0,activeColor:n.COLORS.content.brand}),e.jsxs(o.RadioCardText,{children:[e.jsx(r.TitleSmall,{color:n.COLORS.content.primary,children:"Use default settings"}),e.jsx(r.BodyCaption,{color:n.COLORS.content.secondary,children:"Defined in Customize > Agent handover"})]})]}),e.jsxs(o.RadioCard,{"data-test":"handover-method-specific",selected:t.method==="specific_channels",onClick:()=>s("specific_channels"),children:[e.jsx(c.RadioButton,{isActive:t.method==="specific_channels",onValueChange:()=>s("specific_channels"),skipSelectingOff:!0,activeColor:n.COLORS.content.brand}),e.jsxs(o.RadioCardText,{children:[e.jsx(r.TitleSmall,{color:n.COLORS.content.primary,children:"Choose specific channels"}),e.jsx(r.BodyCaption,{color:n.COLORS.content.secondary,children:"Always hands over regardless of business hours."})]})]})]})]})]})};exports.Step4HandoverRules=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../radioButton/RadioButton.js"),r=require("../../TypographyStyle.js"),n=require("../../../constants/Theme.js"),o=require("../AgentBuilder.styled.js"),u=require("../components/AiTextArea.js"),p=require("../components/StepSectionHeader.js"),x=require("../constants/steps.js"),C=require("../context/AgentBuilderContext.js"),d=x.STEP_DEFINITIONS[3],S=()=>{const{value:l,patch:a,charLimits:h}=C.useAgentBuilderContext(),{handover:t}=l,s=i=>a({handover:{...t,method:i}});return e.jsxs("div",{className:"bik-agent-step bik-agent-step--handover",children:[e.jsx(p.StepSectionHeader,{title:d.title,helper:d.helper}),e.jsx(u.AiTextArea,{"data-test":"handover-when",label:"Handover when",value:t.when,onChange:i=>a({handover:{...t,when:i}}),maxLength:h.handoverWhen,placeholder:"e.g. Hand over if the customer is angry or requests a human agent.",minHeight:"120px"}),e.jsxs(o.FieldBlock,{children:[e.jsx(r.TitleSmall,{color:n.COLORS.content.primary,children:"Handover method"}),e.jsxs(o.CardRow,{children:[e.jsxs(o.RadioCard,{"data-test":"handover-method-default",selected:t.method==="default",onClick:()=>s("default"),children:[e.jsx(c.RadioButton,{isActive:t.method==="default",onValueChange:()=>s("default"),skipSelectingOff:!0,activeColor:n.COLORS.content.brand}),e.jsxs(o.RadioCardText,{children:[e.jsx(r.TitleSmall,{color:n.COLORS.content.primary,children:"Use default settings"}),e.jsx(r.BodyCaption,{color:n.COLORS.content.secondary,children:"Defined in Customize > Agent handover"})]})]}),e.jsxs(o.RadioCard,{"data-test":"handover-method-specific",selected:t.method==="specific_channels",onClick:()=>s("specific_channels"),children:[e.jsx(c.RadioButton,{isActive:t.method==="specific_channels",onValueChange:()=>s("specific_channels"),skipSelectingOff:!0,activeColor:n.COLORS.content.brand}),e.jsxs(o.RadioCardText,{children:[e.jsx(r.TitleSmall,{color:n.COLORS.content.primary,children:"Choose specific channels"}),e.jsx(r.BodyCaption,{color:n.COLORS.content.secondary,children:"Always hands over regardless of business hours."})]})]})]})]})]})};exports.Step4HandoverRules=S;
2
2
  //# sourceMappingURL=Step4HandoverRules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Step4HandoverRules.js","sources":["../../../../../src/components/agent-builder/steps/Step4HandoverRules.tsx"],"sourcesContent":["import React from 'react';\nimport { RadioButton } from '@src/components/radioButton/RadioButton';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { HandoverMethod } from '../AgentBuilder.model';\nimport {\n\tCardRow,\n\tFieldBlock,\n\tRadioCard,\n\tRadioCardText,\n} from '../AgentBuilder.styled';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\nconst STEP = STEP_DEFINITIONS[3];\n\nexport const Step4HandoverRules: React.FC = () => {\n\tconst { value, patch } = useAgentBuilderContext();\n\tconst { handover } = value;\n\n\tconst setMethod = (method: HandoverMethod) =>\n\t\tpatch({ handover: { ...handover, method } });\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--handover\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<AiTextArea\n\t\t\t\tdata-test=\"handover-when\"\n\t\t\t\tlabel=\"Handover when\"\n\t\t\t\tvalue={handover.when}\n\t\t\t\tonChange={(text) => patch({ handover: { ...handover, when: text } })}\n\t\t\t\tmaxLength={AGENT_CHAR_LIMITS.handoverWhen}\n\t\t\t\tplaceholder=\"e.g. Hand over if the customer is angry or requests a human agent.\"\n\t\t\t\tminHeight=\"120px\"\n\t\t\t/>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Handover method</TitleSmall>\n\t\t\t\t<CardRow>\n\t\t\t\t\t<RadioCard\n\t\t\t\t\t\tdata-test=\"handover-method-default\"\n\t\t\t\t\t\tselected={handover.method === 'default'}\n\t\t\t\t\t\tonClick={() => setMethod('default')}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\tisActive={handover.method === 'default'}\n\t\t\t\t\t\t\tonValueChange={() => setMethod('default')}\n\t\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\t\tactiveColor={COLORS.content.brand}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tUse default settings\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\tDefined in Customize &gt; Agent handover\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t</RadioCardText>\n\t\t\t\t\t</RadioCard>\n\n\t\t\t\t\t<RadioCard\n\t\t\t\t\t\tdata-test=\"handover-method-specific\"\n\t\t\t\t\t\tselected={handover.method === 'specific_channels'}\n\t\t\t\t\t\tonClick={() => setMethod('specific_channels')}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\tisActive={handover.method === 'specific_channels'}\n\t\t\t\t\t\t\tonValueChange={() => setMethod('specific_channels')}\n\t\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\t\tactiveColor={COLORS.content.brand}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tChoose specific channels\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\tAlways hands over regardless of business hours.\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t</RadioCardText>\n\t\t\t\t\t</RadioCard>\n\t\t\t\t</CardRow>\n\t\t\t</FieldBlock>\n\t\t</div>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","Step4HandoverRules","value","patch","useAgentBuilderContext","handover","setMethod","method","jsxs","jsx","StepSectionHeader","AiTextArea","text","AGENT_CHAR_LIMITS","FieldBlock","TitleSmall","COLORS","CardRow","RadioCard","RadioButton","RadioCardText","BodyCaption"],"mappings":"4eAiBMA,EAAOC,EAAAA,iBAAiB,CAAC,EAElBC,EAA+B,IAAM,CACjD,KAAM,CAAE,MAAAC,EAAO,MAAAC,CAAA,EAAUC,yBAAA,EACnB,CAAE,SAAAC,GAAaH,EAEfI,EAAaC,GAClBJ,EAAM,CAAE,SAAU,CAAE,GAAGE,EAAU,OAAAE,CAAA,EAA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AO,QAAQ,KAAA,CAAA,SAE5BI,EAAAA,cAAA,CACA,SAAA,CAAAX,MAACM,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,QAAS,SAAA,2BAE3C,QACCK,EAAAA,YAAA,CAAY,MAAOL,EAAAA,OAAO,QAAQ,UAAW,SAAA,iDAAA,CAE9C,CAAA,CAAA,CACD,CAAA,CAAA,CAAA,CACD,CAAA,CACD,CAAA,CAAA,CACD,CAAA,EACD,CAEF"}
1
+ {"version":3,"file":"Step4HandoverRules.js","sources":["../../../../../src/components/agent-builder/steps/Step4HandoverRules.tsx"],"sourcesContent":["import React from 'react';\nimport { RadioButton } from '@src/components/radioButton/RadioButton';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { HandoverMethod } from '../AgentBuilder.model';\nimport {\n\tCardRow,\n\tFieldBlock,\n\tRadioCard,\n\tRadioCardText,\n} from '../AgentBuilder.styled';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\nconst STEP = STEP_DEFINITIONS[3];\n\nexport const Step4HandoverRules: React.FC = () => {\n\tconst { value, patch, charLimits } = useAgentBuilderContext();\n\tconst { handover } = value;\n\n\tconst setMethod = (method: HandoverMethod) =>\n\t\tpatch({ handover: { ...handover, method } });\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--handover\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<AiTextArea\n\t\t\t\tdata-test=\"handover-when\"\n\t\t\t\tlabel=\"Handover when\"\n\t\t\t\tvalue={handover.when}\n\t\t\t\tonChange={(text) => patch({ handover: { ...handover, when: text } })}\n\t\t\t\tmaxLength={charLimits.handoverWhen}\n\t\t\t\tplaceholder=\"e.g. Hand over if the customer is angry or requests a human agent.\"\n\t\t\t\tminHeight=\"120px\"\n\t\t\t/>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Handover method</TitleSmall>\n\t\t\t\t<CardRow>\n\t\t\t\t\t<RadioCard\n\t\t\t\t\t\tdata-test=\"handover-method-default\"\n\t\t\t\t\t\tselected={handover.method === 'default'}\n\t\t\t\t\t\tonClick={() => setMethod('default')}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\tisActive={handover.method === 'default'}\n\t\t\t\t\t\t\tonValueChange={() => setMethod('default')}\n\t\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\t\tactiveColor={COLORS.content.brand}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tUse default settings\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\tDefined in Customize &gt; Agent handover\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t</RadioCardText>\n\t\t\t\t\t</RadioCard>\n\n\t\t\t\t\t<RadioCard\n\t\t\t\t\t\tdata-test=\"handover-method-specific\"\n\t\t\t\t\t\tselected={handover.method === 'specific_channels'}\n\t\t\t\t\t\tonClick={() => setMethod('specific_channels')}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\tisActive={handover.method === 'specific_channels'}\n\t\t\t\t\t\t\tonValueChange={() => setMethod('specific_channels')}\n\t\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\t\tactiveColor={COLORS.content.brand}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tChoose specific channels\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\tAlways hands over regardless of business hours.\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t</RadioCardText>\n\t\t\t\t\t</RadioCard>\n\t\t\t\t</CardRow>\n\t\t\t</FieldBlock>\n\t\t</div>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","Step4HandoverRules","value","patch","charLimits","useAgentBuilderContext","handover","setMethod","method","jsxs","jsx","StepSectionHeader","AiTextArea","text","FieldBlock","TitleSmall","COLORS","CardRow","RadioCard","RadioButton","RadioCardText","BodyCaption"],"mappings":"ocAgBMA,EAAOC,EAAAA,iBAAiB,CAAC,EAElBC,EAA+B,IAAM,CACjD,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,WAAAC,CAAA,EAAeC,EAAAA,uBAAA,EAC/B,CAAE,SAAAC,GAAaJ,EAEfK,EAAaC,GAClBL,EAAM,CAAE,SAAU,CAAE,GAAGG,EAAU,OAAAE,CAAA,EAAU,EAE5C,OACCC,EAAAA,KAAC,MAAA,CAAI,UAAU,0CACd,SAAA,CAAAC,MAACC,EAAAA,mBAAkB,MAAOZ,EAAK,MAAO,OAAQA,EAAK,OAAQ,EAE3DW,EAAAA,IAACE,EAAAA,WAAA,CACA,YAAU,gBACV,MAAM,gBACN,MAAON,EAAS,KAChB,SAAWO,GAASV,EAAM,CAAE,SAAU,CAAE,GAAGG,EAAU,KAAMO,CAAA,EAAQ,EACnE,UAAWT,EAAW,aACtB,YAAY,qEACZ,UAAU,OAAA,CAAA,SAGVU,EAAAA,WAAA,CACA,SAAA,CAAAJ,MAACK,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,QAAS,SAAA,kBAAe,SACzDC,EAAAA,QAAA,CACA,SAAA,CAAAR,EAAAA,KAACS,EAAAA,UAAA,CACA,YAAU,0BACV,SAAUZ,EAAS,SAAW,UAC9B,QAAS,IAAMC,EAAU,SAAS,EAElC,SAAA,CAAAG,EAAAA,IAACS,EAAAA,YAAA,CACA,SAAUb,EAAS,SAAW,UAC9B,cAAe,IAAMC,EAAU,SAAS,EACxC,iBAAgB,GAChB,YAAaS,EAAAA,OAAO,QAAQ,KAAA,CAAA,SAE5BI,EAAAA,cAAA,CACA,SAAA,CAAAV,MAACK,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,QAAS,SAAA,uBAE3C,QACCK,EAAAA,YAAA,CAAY,MAAOL,EAAAA,OAAO,QAAQ,UAAW,SAAA,uCAAA,CAE9C,CAAA,CAAA,CACD,CAAA,CAAA,CAAA,EAGDP,EAAAA,KAACS,EAAAA,UAAA,CACA,YAAU,2BACV,SAAUZ,EAAS,SAAW,oBAC9B,QAAS,IAAMC,EAAU,mBAAmB,EAE5C,SAAA,CAAAG,EAAAA,IAACS,EAAAA,YAAA,CACA,SAAUb,EAAS,SAAW,oBAC9B,cAAe,IAAMC,EAAU,mBAAmB,EAClD,iBAAgB,GAChB,YAAaS,EAAAA,OAAO,QAAQ,KAAA,CAAA,SAE5BI,EAAAA,cAAA,CACA,SAAA,CAAAV,MAACK,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,QAAS,SAAA,2BAE3C,QACCK,EAAAA,YAAA,CAAY,MAAOL,EAAAA,OAAO,QAAQ,UAAW,SAAA,iDAAA,CAE9C,CAAA,CAAA,CACD,CAAA,CAAA,CAAA,CACD,CAAA,CACD,CAAA,CAAA,CACD,CAAA,EACD,CAEF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../assets/icons/ManifestGlass.svg.js"),t=require("../../../assets/icons/Shopify.svg.js"),o={manifest:{Icon:e.default,w:24,h:24},shopify:{Icon:t.default,w:21,h:24}};exports.SOURCE_ICONS=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../../assets/icons/ManifestGlass.svg.js"),n=require("../../../assets/icons/Shopify.svg.js"),r=require("react"),c=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},u=c(r),a={manifest:{Icon:o.default,w:24,h:24},shopify:{Icon:n.default,w:21,h:24}},f=(e,t=0)=>e?u.default.createElement(e.Icon,{width:e.w+t,height:e.h+t}):null;exports.SOURCE_ICONS=a;exports.renderSourceIcon=f;
2
2
  //# sourceMappingURL=sourceIcons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sourceIcons.js","sources":["../../../../../src/components/agent-builder/utils/sourceIcons.ts"],"sourcesContent":["import ManifestGlass from '@src/assets/icons/ManifestGlass.svg';\nimport Shopify from '@src/assets/icons/Shopify.svg';\nimport type React from 'react';\n\nexport type IconComp = React.FunctionComponent<React.SVGAttributes<SVGElement>>;\n\n/** Brand glyph for a tool source, with its own size so each keeps its aspect ratio. */\nexport interface SourceIcon {\n\tIcon: IconComp;\n\tw: number;\n\th: number;\n}\n\n/** Per-source brand glyph — shared by the `@` picker and the Tools source buttons. */\nexport const SOURCE_ICONS: Record<string, SourceIcon> = {\n\tmanifest: { Icon: ManifestGlass, w: 24, h: 24 },\n\tshopify: { Icon: Shopify, w: 21, h: 24 },\n};\n"],"names":["SOURCE_ICONS","ManifestGlass","Shopify"],"mappings":"gMAcaA,EAA2C,CACvD,SAAU,CAAE,KAAMC,EAAAA,QAAe,EAAG,GAAI,EAAG,EAAA,EAC3C,QAAS,CAAE,KAAMC,EAAAA,QAAS,EAAG,GAAI,EAAG,EAAA,CACrC"}
1
+ {"version":3,"file":"sourceIcons.js","sources":["../../../../../src/components/agent-builder/utils/sourceIcons.ts"],"sourcesContent":["import ManifestGlass from '@src/assets/icons/ManifestGlass.svg';\nimport Shopify from '@src/assets/icons/Shopify.svg';\nimport React from 'react';\n\nexport type IconComp = React.FunctionComponent<React.SVGAttributes<SVGElement>>;\n\n/** Brand glyph for a tool source, with its own size so each keeps its aspect ratio. */\nexport interface SourceIcon {\n\tIcon: IconComp;\n\tw: number;\n\th: number;\n}\n\n/** Per-source brand glyph — shared by the `@` picker and the Tools source buttons. */\nexport const SOURCE_ICONS: Record<string, SourceIcon> = {\n\tmanifest: { Icon: ManifestGlass, w: 24, h: 24 },\n\tshopify: { Icon: Shopify, w: 21, h: 24 },\n};\n\n/**\n * Render a {@link SourceIcon} at its own aspect ratio. `sizeDelta` nudges both\n * dimensions (e.g. `-4` for the smaller source-button glyph). Returns `null` when\n * no icon is supplied, so callers can drop their own `icon &&` guard.\n */\nexport const renderSourceIcon = (\n\ticon: SourceIcon | undefined,\n\tsizeDelta = 0,\n): React.ReactElement | null =>\n\ticon\n\t\t? React.createElement(icon.Icon, {\n\t\t\t\twidth: icon.w + sizeDelta,\n\t\t\t\theight: icon.h + sizeDelta,\n\t\t })\n\t\t: null;\n"],"names":["SOURCE_ICONS","ManifestGlass","Shopify","renderSourceIcon","icon","sizeDelta","React"],"mappings":"kRAcaA,EAA2C,CACvD,SAAU,CAAE,KAAMC,EAAAA,QAAe,EAAG,GAAI,EAAG,EAAA,EAC3C,QAAS,CAAE,KAAMC,EAAAA,QAAS,EAAG,GAAI,EAAG,EAAA,CACrC,EAOaC,EAAmB,CAC/BC,EACAC,EAAY,IAEZD,EACGE,UAAM,cAAcF,EAAK,KAAM,CAC/B,MAAOA,EAAK,EAAIC,EAChB,OAAQD,EAAK,EAAIC,CACjB,CAAC,EACD"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),n=require("react"),K=require("../TablePagination/TablePagination.js"),Q=require("../zeroState/ZeroState.js"),C=require("./AgentListing.styled.js"),U=require("./AgentListingFilters.js"),W=require("./AgentListingHeader.js"),X=require("./AgentTable.js"),Y=require("./DeleteAgentModal.js"),L=({config:q,onSearchChange:m,onSearchSubmit:o,onFilterChange:r,onSortChange:g,onNewAgent:S,onBrowseTemplates:c,onRunAgent:p,onEditAgent:y,onDeleteAgent:l,onRowClick:u,...w})=>{const[i,d]=n.useState(null),[k,N]=n.useState(!1),{agents:P,isLoading:h,searchValue:T,searchPlaceholder:R="Search",filterOptions:v,filterPlaceholder:z="Filters",sortOptions:D,selectedSort:F,title:O="AI Agents",pagination:s,emptyState:b,debugLog:f}=q,B=!h&&P.length===0,t=n.useCallback((e,...A)=>{f&&console.log(`[AgentListing] ${e}`,...A)},[f]),E=n.useCallback(e=>{t("onSearchChange",e),m(e)},[t,m]),I=n.useCallback(e=>{t("onSearchSubmit",e),o?.(e)},[t,o]),H=n.useCallback(e=>{t("onFilterChange",e),r?.(e)},[t,r]),M=n.useCallback(e=>{t("onSortChange",e),g?.(e)},[t,g]),j=n.useCallback(()=>{t("onNewAgent"),S()},[t,S]),Z=n.useCallback(()=>{t("onBrowseTemplates"),c?.()},[t,c]),V=n.useCallback(e=>{t("onRunAgent",e.id),p(e)},[t,p]),_=n.useCallback(e=>{t("onEditAgent",e.id),y(e)},[t,y]),$=n.useCallback(e=>{t("onRowClick",e.id),u?.(e)},[t,u]),G=n.useCallback(e=>{t("onDeleteAgent",e.id),d(e)},[t]),J=n.useCallback(async()=>{if(!(!i||!l)){N(!0);try{await l(i),d(null)}finally{N(!1)}}},[i,l]);return a.jsxs(C.Page,{"data-test":w["data-test"]??"agent-listing",children:[a.jsx(W.AgentListingHeader,{title:O,onNewAgent:j,onBrowseTemplates:c?Z:void 0}),a.jsx(U.AgentListingFilters,{searchValue:T,onSearchChange:E,onSearchSubmit:o?I:void 0,searchPlaceholder:R,filterOptions:v,onFilterChange:r?H:void 0,filterPlaceholder:z,sortOptions:D,selectedSort:F,onSortChange:g?M:void 0}),a.jsx(C.Body,{children:h||B?a.jsx(C.EmptyHolder,{children:a.jsx(Q.ZeroState,{isLoading:h,title:b?.title??"No agents yet",subTitle:b?.subTitle??"Create your first AI agent to start automating conversations.",actionButton:b?.actionButton??{buttonText:"New AI agent",buttonType:"primary",size:"small",onClick:j}})}):a.jsxs(a.Fragment,{children:[a.jsx(X.AgentTable,{agents:P,onRunAgent:V,onEditAgent:_,onDeleteAgent:l?G:void 0,onRowClick:u?$:void 0}),s&&s.totalRows>0&&a.jsx(K.TablePagination,{pageNumber:s.pageNumber,pageSize:s.pageSize,totalRows:s.totalRows,hidePageSizeOptions:s.hidePageSizeOptions,updatePageNumber:s.onPageChange,updatePageSize:e=>{const A=Array.isArray(e)?e[0]:e,x=Number(A?.value);Number.isNaN(x)||s.onPageSizeChange(x)}})]})}),i&&a.jsx(Y.DeleteAgentModal,{agentName:i.name,isDeleting:k,onClose:()=>k?void 0:d(null),onConfirm:J})]})};L.displayName="AgentListing";exports.AgentListing=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),n=require("react"),J=require("../TablePagination/TablePagination.js"),K=require("../zeroState/ZeroState.js"),A=require("./AgentListing.styled.js"),Q=require("./AgentListingFilters.js"),U=require("./AgentListingHeader.js"),W=require("./AgentTable.js"),X=require("./DeleteAgentModal.js"),Y=require("../dropdown/utils.js"),w=({config:x,onSearchChange:p,onSearchSubmit:r,onFilterChange:g,onSortChange:c,onNewAgent:m,onBrowseTemplates:u,onRunAgent:S,onEditAgent:y,onDeleteAgent:l,onRowClick:d,...q})=>{const[i,h]=n.useState(null),[k,N]=n.useState(!1),{agents:P,isLoading:b,searchValue:L,searchPlaceholder:T="Search",filterOptions:R,filterPlaceholder:D="Filters",sortOptions:v,selectedSort:z,title:F="AI Agents",pagination:s,emptyState:C,debugLog:f}=x,O=!b&&P.length===0,t=n.useCallback((e,...o)=>{f&&console.log(`[AgentListing] ${e}`,...o)},[f]),B=n.useCallback(e=>{t("onSearchChange",e),p(e)},[t,p]),E=n.useCallback(e=>{t("onSearchSubmit",e),r?.(e)},[t,r]),I=n.useCallback(e=>{t("onFilterChange",e),g?.(e)},[t,g]),H=n.useCallback(e=>{t("onSortChange",e),c?.(e)},[t,c]),j=n.useCallback(()=>{t("onNewAgent"),m()},[t,m]),M=n.useCallback(()=>{t("onBrowseTemplates"),u?.()},[t,u]),V=n.useCallback(e=>{t("onRunAgent",e.id),S(e)},[t,S]),Z=n.useCallback(e=>{t("onEditAgent",e.id),y(e)},[t,y]),_=n.useCallback(e=>{t("onRowClick",e.id),d?.(e)},[t,d]),$=n.useCallback(e=>{t("onDeleteAgent",e.id),h(e)},[t]),G=n.useCallback(async()=>{if(!(!i||!l)){N(!0);try{await l(i),h(null)}finally{N(!1)}}},[i,l]);return a.jsxs(A.Page,{"data-test":q["data-test"]??"agent-listing",children:[a.jsx(U.AgentListingHeader,{title:F,onNewAgent:j,onBrowseTemplates:u?M:void 0}),a.jsx(Q.AgentListingFilters,{searchValue:L,onSearchChange:B,onSearchSubmit:r?E:void 0,searchPlaceholder:T,filterOptions:R,onFilterChange:g?I:void 0,filterPlaceholder:D,sortOptions:v,selectedSort:z,onSortChange:c?H:void 0}),a.jsx(A.Body,{children:b||O?a.jsx(A.EmptyHolder,{children:a.jsx(K.ZeroState,{isLoading:b,title:C?.title??"No agents yet",subTitle:C?.subTitle??"Create your first AI agent to start automating conversations.",actionButton:C?.actionButton??{buttonText:"New AI agent",buttonType:"primary",size:"small",onClick:j}})}):a.jsxs(a.Fragment,{children:[a.jsx(W.AgentTable,{agents:P,onRunAgent:V,onEditAgent:Z,onDeleteAgent:l?$:void 0,onRowClick:d?_:void 0}),s&&s.totalRows>0&&a.jsx(J.TablePagination,{pageNumber:s.pageNumber,pageSize:s.pageSize,totalRows:s.totalRows,hidePageSizeOptions:s.hidePageSizeOptions,updatePageNumber:s.onPageChange,updatePageSize:e=>{const o=Number(Y.unwrapDropdownValue(e));Number.isNaN(o)||s.onPageSizeChange(o)}})]})}),i&&a.jsx(X.DeleteAgentModal,{agentName:i.name,isDeleting:k,onClose:()=>k?void 0:h(null),onConfirm:G})]})};w.displayName="AgentListing";exports.AgentListing=w;
2
2
  //# sourceMappingURL=AgentListing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentListing.js","sources":["../../../../src/components/agent-listing/AgentListing.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { DropdownOption } from '@src/components/dropdown/type';\nimport { TablePagination } from '@src/components/TablePagination/TablePagination';\nimport { ZeroState } from '@src/components/zeroState/ZeroState';\nimport { AgentListingProps, AgentListItem } from './AgentListing.model';\nimport { Body, EmptyHolder, Page } from './AgentListing.styled';\nimport { AgentListingFilters } from './AgentListingFilters';\nimport { AgentListingHeader } from './AgentListingHeader';\nimport { AgentTable } from './AgentTable';\nimport { DeleteAgentModal } from './DeleteAgentModal';\n\n/**\n * Full body of the \"AI Agents\" listing screen (header + filters + table).\n * Presentational and fully controlled — the consumer owns data, search, sort,\n * pagination and routing. Render it inside your app shell (next to the sidebar).\n *\n * @example\n * <AgentListing\n * agents={rows}\n * searchValue={search}\n * onSearchChange={setSearch}\n * onNewAgent={() => router.push('/agents/new')}\n * onRunAgent={runAgent}\n * onEditAgent={(a) => router.push(`/agents/${a.id}`)}\n * />\n */\nexport const AgentListing: React.FC<AgentListingProps> = ({\n\tconfig,\n\tonSearchChange,\n\tonSearchSubmit,\n\tonFilterChange,\n\tonSortChange,\n\tonNewAgent,\n\tonBrowseTemplates,\n\tonRunAgent,\n\tonEditAgent,\n\tonDeleteAgent,\n\tonRowClick,\n\t...rest\n}) => {\n\t// Agent pending delete-confirmation (null = dialog closed).\n\tconst [pendingDelete, setPendingDelete] = useState<AgentListItem | null>(\n\t\tnull,\n\t);\n\tconst [isDeleting, setIsDeleting] = useState(false);\n\tconst {\n\t\tagents,\n\t\tisLoading,\n\t\tsearchValue,\n\t\tsearchPlaceholder = 'Search',\n\t\tfilterOptions,\n\t\tfilterPlaceholder = 'Filters',\n\t\tsortOptions,\n\t\tselectedSort,\n\t\ttitle = 'AI Agents',\n\t\tpagination,\n\t\temptyState,\n\t\tdebugLog,\n\t} = config;\n\n\tconst showEmpty = !isLoading && agents.length === 0;\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(`[AgentListing] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleSearchChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchChange', v);\n\t\t\tonSearchChange(v);\n\t\t},\n\t\t[logAction, onSearchChange],\n\t);\n\tconst handleSearchSubmit = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchSubmit', v);\n\t\t\tonSearchSubmit?.(v);\n\t\t},\n\t\t[logAction, onSearchSubmit],\n\t);\n\tconst handleFilterChange = useCallback(\n\t\t(selected: DropdownOption | DropdownOption[]) => {\n\t\t\tlogAction('onFilterChange', selected);\n\t\t\tonFilterChange?.(selected);\n\t\t},\n\t\t[logAction, onFilterChange],\n\t);\n\tconst handleSortChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSortChange', v);\n\t\t\tonSortChange?.(v);\n\t\t},\n\t\t[logAction, onSortChange],\n\t);\n\tconst handleNewAgent = useCallback(() => {\n\t\tlogAction('onNewAgent');\n\t\tonNewAgent();\n\t}, [logAction, onNewAgent]);\n\tconst handleBrowseTemplates = useCallback(() => {\n\t\tlogAction('onBrowseTemplates');\n\t\tonBrowseTemplates?.();\n\t}, [logAction, onBrowseTemplates]);\n\tconst handleRunAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRunAgent', agent.id);\n\t\t\tonRunAgent(agent);\n\t\t},\n\t\t[logAction, onRunAgent],\n\t);\n\tconst handleEditAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onEditAgent', agent.id);\n\t\t\tonEditAgent(agent);\n\t\t},\n\t\t[logAction, onEditAgent],\n\t);\n\tconst handleRowClick = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRowClick', agent.id);\n\t\t\tonRowClick?.(agent);\n\t\t},\n\t\t[logAction, onRowClick],\n\t);\n\t// Row delete just opens the confirm dialog; the actual delete runs on confirm.\n\tconst handleDeleteRequest = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onDeleteAgent', agent.id);\n\t\t\tsetPendingDelete(agent);\n\t\t},\n\t\t[logAction],\n\t);\n\tconst handleConfirmDelete = useCallback(async () => {\n\t\tif (!pendingDelete || !onDeleteAgent) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsDeleting(true);\n\t\ttry {\n\t\t\tawait onDeleteAgent(pendingDelete);\n\t\t\tsetPendingDelete(null);\n\t\t} finally {\n\t\t\tsetIsDeleting(false);\n\t\t}\n\t}, [pendingDelete, onDeleteAgent]);\n\n\treturn (\n\t\t<Page data-test={rest['data-test'] ?? 'agent-listing'}>\n\t\t\t<AgentListingHeader\n\t\t\t\ttitle={title}\n\t\t\t\tonNewAgent={handleNewAgent}\n\t\t\t\tonBrowseTemplates={\n\t\t\t\t\tonBrowseTemplates ? handleBrowseTemplates : undefined\n\t\t\t\t}\n\t\t\t/>\n\n\t\t\t<AgentListingFilters\n\t\t\t\tsearchValue={searchValue}\n\t\t\t\tonSearchChange={handleSearchChange}\n\t\t\t\tonSearchSubmit={onSearchSubmit ? handleSearchSubmit : undefined}\n\t\t\t\tsearchPlaceholder={searchPlaceholder}\n\t\t\t\tfilterOptions={filterOptions}\n\t\t\t\tonFilterChange={onFilterChange ? handleFilterChange : undefined}\n\t\t\t\tfilterPlaceholder={filterPlaceholder}\n\t\t\t\tsortOptions={sortOptions}\n\t\t\t\tselectedSort={selectedSort}\n\t\t\t\tonSortChange={onSortChange ? handleSortChange : undefined}\n\t\t\t/>\n\n\t\t\t<Body>\n\t\t\t\t{isLoading || showEmpty ? (\n\t\t\t\t\t<EmptyHolder>\n\t\t\t\t\t\t<ZeroState\n\t\t\t\t\t\t\tisLoading={isLoading}\n\t\t\t\t\t\t\ttitle={emptyState?.title ?? 'No agents yet'}\n\t\t\t\t\t\t\tsubTitle={\n\t\t\t\t\t\t\t\temptyState?.subTitle ??\n\t\t\t\t\t\t\t\t'Create your first AI agent to start automating conversations.'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tactionButton={\n\t\t\t\t\t\t\t\temptyState?.actionButton ?? {\n\t\t\t\t\t\t\t\t\tbuttonText: 'New AI agent',\n\t\t\t\t\t\t\t\t\tbuttonType: 'primary',\n\t\t\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t\t\t\tonClick: handleNewAgent,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</EmptyHolder>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<AgentTable\n\t\t\t\t\t\t\tagents={agents}\n\t\t\t\t\t\t\tonRunAgent={handleRunAgent}\n\t\t\t\t\t\t\tonEditAgent={handleEditAgent}\n\t\t\t\t\t\t\tonDeleteAgent={onDeleteAgent ? handleDeleteRequest : undefined}\n\t\t\t\t\t\t\tonRowClick={onRowClick ? handleRowClick : undefined}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{pagination && pagination.totalRows > 0 && (\n\t\t\t\t\t\t\t<TablePagination\n\t\t\t\t\t\t\t\tpageNumber={pagination.pageNumber}\n\t\t\t\t\t\t\t\tpageSize={pagination.pageSize}\n\t\t\t\t\t\t\t\ttotalRows={pagination.totalRows}\n\t\t\t\t\t\t\t\thidePageSizeOptions={pagination.hidePageSizeOptions}\n\t\t\t\t\t\t\t\tupdatePageNumber={pagination.onPageChange}\n\t\t\t\t\t\t\t\tupdatePageSize={(opt) => {\n\t\t\t\t\t\t\t\t\tconst single = Array.isArray(opt) ? opt[0] : opt;\n\t\t\t\t\t\t\t\t\tconst value = Number((single as { value?: string })?.value);\n\t\t\t\t\t\t\t\t\tif (!Number.isNaN(value)) {\n\t\t\t\t\t\t\t\t\t\tpagination.onPageSizeChange(value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Body>\n\n\t\t\t{pendingDelete && (\n\t\t\t\t<DeleteAgentModal\n\t\t\t\t\tagentName={pendingDelete.name}\n\t\t\t\t\tisDeleting={isDeleting}\n\t\t\t\t\tonClose={() => (isDeleting ? undefined : setPendingDelete(null))}\n\t\t\t\t\tonConfirm={handleConfirmDelete}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Page>\n\t);\n};\n\nAgentListing.displayName = 'AgentListing';\n"],"names":["AgentListing","config","onSearchChange","onSearchSubmit","onFilterChange","onSortChange","onNewAgent","onBrowseTemplates","onRunAgent","onEditAgent","onDeleteAgent","onRowClick","rest","pendingDelete","setPendingDelete","useState","isDeleting","setIsDeleting","agents","isLoading","searchValue","searchPlaceholder","filterOptions","filterPlaceholder","sortOptions","selectedSort","title","pagination","emptyState","debugLog","showEmpty","logAction","useCallback","action","args","handleSearchChange","v","handleSearchSubmit","handleFilterChange","selected","handleSortChange","handleNewAgent","handleBrowseTemplates","handleRunAgent","agent","handleEditAgent","handleRowClick","handleDeleteRequest","handleConfirmDelete","Page","jsx","AgentListingHeader","AgentListingFilters","Body","EmptyHolder","ZeroState","jsxs","Fragment","AgentTable","TablePagination","opt","single","value","DeleteAgentModal"],"mappings":"mZA0BaA,EAA4C,CAAC,CACzD,OAAAC,EACA,eAAAC,EACA,eAAAC,EACA,eAAAC,EACA,aAAAC,EACA,WAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,cAAAC,EACA,WAAAC,EACA,GAAGC,CACJ,IAAM,CAEL,KAAM,CAACC,EAAeC,CAAgB,EAAIC,EAAAA,SACzC,IAAA,EAEK,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAS,EAAK,EAC5C,CACL,OAAAG,EACA,UAAAC,EACA,YAAAC,EACA,kBAAAC,EAAoB,SACpB,cAAAC,EACA,kBAAAC,EAAoB,UACpB,YAAAC,EACA,aAAAC,EACA,MAAAC,EAAQ,YACR,WAAAC,E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CACA,OAAAxC,EACA,WAAYyB,EACZ,YAAaE,EACb,cAAenC,EAAgBqC,EAAsB,OACrD,WAAYpC,EAAamC,EAAiB,MAAA,CAAA,EAE1CnB,GAAcA,EAAW,UAAY,GACrCuB,EAAAA,IAACS,EAAAA,gBAAA,CACA,WAAYhC,EAAW,WACvB,SAAUA,EAAW,SACrB,UAAWA,EAAW,UACtB,oBAAqBA,EAAW,oBAChC,iBAAkBA,EAAW,aAC7B,eAAiBiC,GAAQ,CACxB,MAAMC,EAAS,MAAM,QAAQD,CAAG,EAAIA,EAAI,CAAC,EAAIA,EACvCE,EAAQ,OAAQD,GAA+B,KAAK,EACrD,OAAO,MAAMC,CAAK,GACtBnC,EAAW,iBAAiBmC,CAAK,CAEnC,CAAA,CAAA,CACD,CAAA,CAEF,CAAA,CAEF,EAECjD,GACAqC,EAAAA,IAACa,EAAAA,iBAAA,CACA,UAAWlD,EAAc,KACzB,WAAAG,EACA,QAAS,IAAOA,EAAa,OAAYF,EAAiB,IAAI,EAC9D,UAAWkC,CAAA,CAAA,CACZ,EAEF,CAEF,EAEAhD,EAAa,YAAc"}
1
+ {"version":3,"file":"AgentListing.js","sources":["../../../../src/components/agent-listing/AgentListing.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { unwrapDropdownValue } from '@src/components/dropdown';\nimport { DropdownOption } from '@src/components/dropdown/type';\nimport { TablePagination } from '@src/components/TablePagination/TablePagination';\nimport { ZeroState } from '@src/components/zeroState/ZeroState';\nimport { AgentListingProps, AgentListItem } from './AgentListing.model';\nimport { Body, EmptyHolder, Page } from './AgentListing.styled';\nimport { AgentListingFilters } from './AgentListingFilters';\nimport { AgentListingHeader } from './AgentListingHeader';\nimport { AgentTable } from './AgentTable';\nimport { DeleteAgentModal } from './DeleteAgentModal';\n\n/**\n * Full body of the \"AI Agents\" listing screen (header + filters + table).\n * Presentational and fully controlled — the consumer owns data, search, sort,\n * pagination and routing. Render it inside your app shell (next to the sidebar).\n *\n * @example\n * <AgentListing\n * agents={rows}\n * searchValue={search}\n * onSearchChange={setSearch}\n * onNewAgent={() => router.push('/agents/new')}\n * onRunAgent={runAgent}\n * onEditAgent={(a) => router.push(`/agents/${a.id}`)}\n * />\n */\nexport const AgentListing: React.FC<AgentListingProps> = ({\n\tconfig,\n\tonSearchChange,\n\tonSearchSubmit,\n\tonFilterChange,\n\tonSortChange,\n\tonNewAgent,\n\tonBrowseTemplates,\n\tonRunAgent,\n\tonEditAgent,\n\tonDeleteAgent,\n\tonRowClick,\n\t...rest\n}) => {\n\t// Agent pending delete-confirmation (null = dialog closed).\n\tconst [pendingDelete, setPendingDelete] = useState<AgentListItem | null>(\n\t\tnull,\n\t);\n\tconst [isDeleting, setIsDeleting] = useState(false);\n\tconst {\n\t\tagents,\n\t\tisLoading,\n\t\tsearchValue,\n\t\tsearchPlaceholder = 'Search',\n\t\tfilterOptions,\n\t\tfilterPlaceholder = 'Filters',\n\t\tsortOptions,\n\t\tselectedSort,\n\t\ttitle = 'AI Agents',\n\t\tpagination,\n\t\temptyState,\n\t\tdebugLog,\n\t} = config;\n\n\tconst showEmpty = !isLoading && agents.length === 0;\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(`[AgentListing] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleSearchChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchChange', v);\n\t\t\tonSearchChange(v);\n\t\t},\n\t\t[logAction, onSearchChange],\n\t);\n\tconst handleSearchSubmit = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSearchSubmit', v);\n\t\t\tonSearchSubmit?.(v);\n\t\t},\n\t\t[logAction, onSearchSubmit],\n\t);\n\tconst handleFilterChange = useCallback(\n\t\t(selected: DropdownOption | DropdownOption[]) => {\n\t\t\tlogAction('onFilterChange', selected);\n\t\t\tonFilterChange?.(selected);\n\t\t},\n\t\t[logAction, onFilterChange],\n\t);\n\tconst handleSortChange = useCallback(\n\t\t(v: string) => {\n\t\t\tlogAction('onSortChange', v);\n\t\t\tonSortChange?.(v);\n\t\t},\n\t\t[logAction, onSortChange],\n\t);\n\tconst handleNewAgent = useCallback(() => {\n\t\tlogAction('onNewAgent');\n\t\tonNewAgent();\n\t}, [logAction, onNewAgent]);\n\tconst handleBrowseTemplates = useCallback(() => {\n\t\tlogAction('onBrowseTemplates');\n\t\tonBrowseTemplates?.();\n\t}, [logAction, onBrowseTemplates]);\n\tconst handleRunAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRunAgent', agent.id);\n\t\t\tonRunAgent(agent);\n\t\t},\n\t\t[logAction, onRunAgent],\n\t);\n\tconst handleEditAgent = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onEditAgent', agent.id);\n\t\t\tonEditAgent(agent);\n\t\t},\n\t\t[logAction, onEditAgent],\n\t);\n\tconst handleRowClick = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onRowClick', agent.id);\n\t\t\tonRowClick?.(agent);\n\t\t},\n\t\t[logAction, onRowClick],\n\t);\n\t// Row delete just opens the confirm dialog; the actual delete runs on confirm.\n\tconst handleDeleteRequest = useCallback(\n\t\t(agent: AgentListItem) => {\n\t\t\tlogAction('onDeleteAgent', agent.id);\n\t\t\tsetPendingDelete(agent);\n\t\t},\n\t\t[logAction],\n\t);\n\tconst handleConfirmDelete = useCallback(async () => {\n\t\tif (!pendingDelete || !onDeleteAgent) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsDeleting(true);\n\t\ttry {\n\t\t\tawait onDeleteAgent(pendingDelete);\n\t\t\tsetPendingDelete(null);\n\t\t} finally {\n\t\t\tsetIsDeleting(false);\n\t\t}\n\t}, [pendingDelete, onDeleteAgent]);\n\n\treturn (\n\t\t<Page data-test={rest['data-test'] ?? 'agent-listing'}>\n\t\t\t<AgentListingHeader\n\t\t\t\ttitle={title}\n\t\t\t\tonNewAgent={handleNewAgent}\n\t\t\t\tonBrowseTemplates={\n\t\t\t\t\tonBrowseTemplates ? handleBrowseTemplates : undefined\n\t\t\t\t}\n\t\t\t/>\n\n\t\t\t<AgentListingFilters\n\t\t\t\tsearchValue={searchValue}\n\t\t\t\tonSearchChange={handleSearchChange}\n\t\t\t\tonSearchSubmit={onSearchSubmit ? handleSearchSubmit : undefined}\n\t\t\t\tsearchPlaceholder={searchPlaceholder}\n\t\t\t\tfilterOptions={filterOptions}\n\t\t\t\tonFilterChange={onFilterChange ? handleFilterChange : undefined}\n\t\t\t\tfilterPlaceholder={filterPlaceholder}\n\t\t\t\tsortOptions={sortOptions}\n\t\t\t\tselectedSort={selectedSort}\n\t\t\t\tonSortChange={onSortChange ? handleSortChange : undefined}\n\t\t\t/>\n\n\t\t\t<Body>\n\t\t\t\t{isLoading || showEmpty ? (\n\t\t\t\t\t<EmptyHolder>\n\t\t\t\t\t\t<ZeroState\n\t\t\t\t\t\t\tisLoading={isLoading}\n\t\t\t\t\t\t\ttitle={emptyState?.title ?? 'No agents yet'}\n\t\t\t\t\t\t\tsubTitle={\n\t\t\t\t\t\t\t\temptyState?.subTitle ??\n\t\t\t\t\t\t\t\t'Create your first AI agent to start automating conversations.'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tactionButton={\n\t\t\t\t\t\t\t\temptyState?.actionButton ?? {\n\t\t\t\t\t\t\t\t\tbuttonText: 'New AI agent',\n\t\t\t\t\t\t\t\t\tbuttonType: 'primary',\n\t\t\t\t\t\t\t\t\tsize: 'small',\n\t\t\t\t\t\t\t\t\tonClick: handleNewAgent,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</EmptyHolder>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<AgentTable\n\t\t\t\t\t\t\tagents={agents}\n\t\t\t\t\t\t\tonRunAgent={handleRunAgent}\n\t\t\t\t\t\t\tonEditAgent={handleEditAgent}\n\t\t\t\t\t\t\tonDeleteAgent={onDeleteAgent ? handleDeleteRequest : undefined}\n\t\t\t\t\t\t\tonRowClick={onRowClick ? handleRowClick : undefined}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{pagination && pagination.totalRows > 0 && (\n\t\t\t\t\t\t\t<TablePagination\n\t\t\t\t\t\t\t\tpageNumber={pagination.pageNumber}\n\t\t\t\t\t\t\t\tpageSize={pagination.pageSize}\n\t\t\t\t\t\t\t\ttotalRows={pagination.totalRows}\n\t\t\t\t\t\t\t\thidePageSizeOptions={pagination.hidePageSizeOptions}\n\t\t\t\t\t\t\t\tupdatePageNumber={pagination.onPageChange}\n\t\t\t\t\t\t\t\tupdatePageSize={(opt) => {\n\t\t\t\t\t\t\t\t\tconst value = Number(unwrapDropdownValue(opt));\n\t\t\t\t\t\t\t\t\tif (!Number.isNaN(value)) {\n\t\t\t\t\t\t\t\t\t\tpagination.onPageSizeChange(value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Body>\n\n\t\t\t{pendingDelete && (\n\t\t\t\t<DeleteAgentModal\n\t\t\t\t\tagentName={pendingDelete.name}\n\t\t\t\t\tisDeleting={isDeleting}\n\t\t\t\t\tonClose={() => (isDeleting ? undefined : setPendingDelete(null))}\n\t\t\t\t\tonConfirm={handleConfirmDelete}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Page>\n\t);\n};\n\nAgentListing.displayName = 'AgentListing';\n"],"names":["AgentListing","config","onSearchChange","onSearchSubmit","onFilterChange","onSortChange","onNewAgent","onBrowseTemplates","onRunAgent","onEditAgent","onDeleteAgent","onRowClick","rest","pendingDelete","setPendingDelete","useState","isDeleting","setIsDeleting","agents","isLoading","searchValue","searchPlaceholder","filterOptions","filterPlaceholder","sortOptions","selectedSort","title","pagination","emptyState","debugLog","showEmpty","logAction","useCallback","action","args","handleSearchChange","v","handleSearchSubmit","handleFilterChange","selected","handleSortChange","handleNewAgent","handleBrowseTemplates","handleRunAgent","agent","handleEditAgent","handleRowClick","handleDeleteRequest","handleConfirmDelete","Page","jsx","AgentListingHeader","AgentListingFilters","Body","EmptyHolder","ZeroState","jsxs","Fragment","AgentTable","TablePagination","opt","value","unwrapDropdownValue","DeleteAgentModal"],"mappings":"qbA2BaA,EAA4C,CAAC,CACzD,OAAAC,EACA,eAAAC,EACA,eAAAC,EACA,eAAAC,EACA,aAAAC,EACA,WAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,cAAAC,EACA,WAAAC,EACA,GAAGC,CACJ,IAAM,CAEL,KAAM,CAACC,EAAeC,CAAgB,EAAIC,EAAAA,SACzC,IAAA,EAEK,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAS,EAAK,EAC5C,CACL,OAAAG,EACA,UAAAC,EACA,YAAAC,EACA,kBAAAC,EAAoB,SACpB,cAAAC,EACA,kBAAAC,EAAoB,UACpB,YAAAC,EACA,aAAAC,EACA,MAAAC,EAAQ,YACR,WAAAC,EACA,WAAAC,EACA,SAAAC,CAAA,EACG5B,EAEE6B,EAAY,CAACX,GAAaD,EAAO,SAAW,EAG5Ca,EAAYC,EAAAA,YACjB,CAACC,KAAmBC,IAAoB,CACnCL,GAEH,QAAQ,IAAI,kBAAkBI,CAAM,GAAI,GAAGC,CAAI,CAEjD,EACA,CAACL,CAAQ,CAAA,EAGJM,EAAqBH,EAAAA,YACzBI,GAAc,CACdL,EAAU,iBAAkBK,CAAC,EAC7BlC,EAAekC,CAAC,CACjB,EACA,CAACL,EAAW7B,CAAc,CAAA,EAErBmC,EAAqBL,EAAAA,YACzBI,GAAc,CACdL,EAAU,iBAAkBK,CAAC,EAC7BjC,IAAiBiC,CAAC,CACnB,EACA,CAAC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,CAAA,CAEF,EAEChD,GACAqC,EAAAA,IAACa,EAAAA,iBAAA,CACA,UAAWlD,EAAc,KACzB,WAAAG,EACA,QAAS,IAAOA,EAAa,OAAYF,EAAiB,IAAI,EAC9D,UAAWkC,CAAA,CAAA,CACZ,EAEF,CAEF,EAEAhD,EAAa,YAAc"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),x=require("../../assets/icons/search.svg.js"),v=require("../../constants/Theme.js"),a=require("./AgentListing.styled.js"),j=require("../input/Input.js"),c=require("../dropdown/Dropdown.js"),y=({searchValue:d,onSearchChange:u,onSearchSubmit:r,searchPlaceholder:h,filterOptions:n,onFilterChange:s,filterPlaceholder:p,sortOptions:l,selectedSort:g,onSortChange:i})=>{const w=(l??[]).map(e=>({label:e.label,value:e.value,selected:e.value===g}));return t.jsxs(a.FilterRow,{children:[t.jsxs(a.FilterRowLeft,{children:[t.jsx(j.Input,{"data-test":"agent-search",variant:"small",width:"320px",type:"text",value:d,placeholder:h,hideInputHeader:!0,noErrorHint:!0,leftIcon:{icon:()=>t.jsx(x.default,{width:18,height:18,color:v.COLORS.content.placeholder})},onChangeText:e=>u(e),onKeyDownEvent:r?e=>{e.key==="Enter"&&r(e.target.value)}:void 0}),n&&s&&t.jsx(c.Dropdown,{"data-test":"agent-filters",size:"small",width:"140px",placeHolder:p,showPlaceholderWhenSelected:!0,options:n,isMultiSelect:!0,onSelect:s})]}),l&&i&&t.jsx(c.Dropdown,{"data-test":"agent-sort",size:"small",width:"200px",options:w,onSelect:e=>{const o=(Array.isArray(e)?e[0]:e)?.value;o&&i(o)}})]})};exports.AgentListingFilters=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),x=require("../../assets/icons/search.svg.js"),v=require("../../constants/Theme.js"),a=require("./AgentListing.styled.js"),j=require("../input/Input.js"),u=require("../dropdown/Dropdown.js"),q=require("../dropdown/utils.js"),f=({searchValue:c,onSearchChange:d,onSearchSubmit:r,searchPlaceholder:p,filterOptions:n,onFilterChange:l,filterPlaceholder:h,sortOptions:s,selectedSort:w,onSortChange:o})=>{const g=(s??[]).map(e=>({label:e.label,value:e.value,selected:e.value===w}));return t.jsxs(a.FilterRow,{children:[t.jsxs(a.FilterRowLeft,{children:[t.jsx(j.Input,{"data-test":"agent-search",variant:"small",width:"320px",type:"text",value:c,placeholder:p,hideInputHeader:!0,noErrorHint:!0,leftIcon:{icon:()=>t.jsx(x.default,{width:18,height:18,color:v.COLORS.content.placeholder})},onChangeText:e=>d(e),onKeyDownEvent:r?e=>{e.key==="Enter"&&r(e.target.value)}:void 0}),n&&l&&t.jsx(u.Dropdown,{"data-test":"agent-filters",size:"small",width:"140px",placeHolder:h,showPlaceholderWhenSelected:!0,options:n,isMultiSelect:!0,onSelect:l})]}),s&&o&&t.jsx(u.Dropdown,{"data-test":"agent-sort",size:"small",width:"200px",options:g,onSelect:e=>{const i=q.unwrapDropdownValue(e);i&&o(i)}})]})};exports.AgentListingFilters=f;
2
2
  //# sourceMappingURL=AgentListingFilters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentListingFilters.js","sources":["../../../../src/components/agent-listing/AgentListingFilters.tsx"],"sourcesContent":["import SearchIcon from '@src/assets/icons/search.svg';\nimport React from 'react';\nimport { Dropdown } from '@src/components/dropdown';\nimport { DropdownOption, SingleOption } from '@src/components/dropdown/type';\nimport { Input } from '@src/components/input';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentListSortOption } from './AgentListing.model';\nimport { FilterRow, FilterRowLeft } from './AgentListing.styled';\n\ninterface AgentListingFiltersProps {\n\tsearchValue: string;\n\tonSearchChange: (value: string) => void;\n\t/** When set, Enter in the search box runs the search (typing only edits text). */\n\tonSearchSubmit?: (value: string) => void;\n\tsearchPlaceholder: string;\n\n\tfilterOptions?: DropdownOption[];\n\tonFilterChange?: (selected: DropdownOption | DropdownOption[]) => void;\n\tfilterPlaceholder: string;\n\n\tsortOptions?: AgentListSortOption[];\n\tselectedSort?: string;\n\tonSortChange?: (value: string) => void;\n}\n\nexport const AgentListingFilters: React.FC<AgentListingFiltersProps> = ({\n\tsearchValue,\n\tonSearchChange,\n\tonSearchSubmit,\n\tsearchPlaceholder,\n\tfilterOptions,\n\tonFilterChange,\n\tfilterPlaceholder,\n\tsortOptions,\n\tselectedSort,\n\tonSortChange,\n}) => {\n\tconst sortDropdownOptions: SingleOption[] = (sortOptions ?? []).map((o) => ({\n\t\tlabel: o.label,\n\t\tvalue: o.value,\n\t\tselected: o.value === selectedSort,\n\t}));\n\n\treturn (\n\t\t<FilterRow>\n\t\t\t<FilterRowLeft>\n\t\t\t\t<Input\n\t\t\t\t\tdata-test=\"agent-search\"\n\t\t\t\t\tvariant=\"small\"\n\t\t\t\t\twidth=\"320px\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={searchValue}\n\t\t\t\t\tplaceholder={searchPlaceholder}\n\t\t\t\t\thideInputHeader\n\t\t\t\t\tnoErrorHint\n\t\t\t\t\tleftIcon={{\n\t\t\t\t\t\ticon: () => (\n\t\t\t\t\t\t\t<SearchIcon\n\t\t\t\t\t\t\t\twidth={18}\n\t\t\t\t\t\t\t\theight={18}\n\t\t\t\t\t\t\t\tcolor={COLORS.content.placeholder}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t\tonChangeText={(text) => onSearchChange(text)}\n\t\t\t\t\tonKeyDownEvent={\n\t\t\t\t\t\tonSearchSubmit\n\t\t\t\t\t\t\t? (e) => {\n\t\t\t\t\t\t\t\t\tif ((e as unknown as KeyboardEvent).key === 'Enter') {\n\t\t\t\t\t\t\t\t\t\tonSearchSubmit((e.target as HTMLInputElement).value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\n\t\t\t\t{filterOptions && onFilterChange && (\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tdata-test=\"agent-filters\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\twidth=\"140px\"\n\t\t\t\t\t\tplaceHolder={filterPlaceholder}\n\t\t\t\t\t\tshowPlaceholderWhenSelected\n\t\t\t\t\t\toptions={filterOptions}\n\t\t\t\t\t\tisMultiSelect\n\t\t\t\t\t\tonSelect={onFilterChange}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</FilterRowLeft>\n\n\t\t\t{sortOptions && onSortChange && (\n\t\t\t\t<Dropdown\n\t\t\t\t\tdata-test=\"agent-sort\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\twidth=\"200px\"\n\t\t\t\t\toptions={sortDropdownOptions}\n\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\tconst single = Array.isArray(opt) ? opt[0] : opt;\n\t\t\t\t\t\tconst value = (single as SingleOption)?.value;\n\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\tonSortChange(value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</FilterRow>\n\t);\n};\n"],"names":["AgentListingFilters","searchValue","onSearchChange","onSearchSubmit","searchPlaceholder","filterOptions","onFilterChange","filterPlaceholder","sortOptions","selectedSort","onSortChange","sortDropdownOptions","o","FilterRow","jsxs","FilterRowLeft","jsx","Input","SearchIcon","COLORS","text","Dropdown","opt","value"],"mappings":"mTAyBaA,EAA0D,CAAC,CACvE,YAAAC,EACA,eAAAC,EACA,eAAAC,EACA,kBAAAC,EACA,cAAAC,EACA,eAAAC,EACA,kBAAAC,EACA,YAAAC,EACA,aAAAC,EACA,aAAAC,CACD,IAAM,CACL,MAAMC,GAAuCH,GAAe,CAAA,GAAI,IAAKI,IAAO,CAC3E,MAAOA,EAAE,MACT,MAAOA,EAAE,MACT,SAAUA,EAAE,QAAUH,CAAA,EACrB,EAEF,cACEI,YAAA,CACA,SAAA,CAAAC,OAACC,EAAAA,cAAA,CACA,SAAA,CAAAC,EAAAA,IAACC,EAAAA,MAAA,CACA,YAAU,eACV,QAAQ,QACR,MAAM,QACN,KAAK,OACL,MAAOhB,EACP,YAAaG,EACb,gBAAe,GACf,YAAW,GACX,SAAU,CACT,KAAM,IACLY,EAAAA,IAACE,EAAAA,QAAA,CACA,MAAO,GACP,OAAQ,GACR,MAAOC,EAAAA,OAAO,QAAQ,WAAA,CAAA,CACvB,EAGF,aAAeC,GAASlB,EAAekB,CAAI,EAC3C,eACCjB,EACI,GAAM,CACF,EAA+B,MAAQ,SAC3CA,EAAgB,EAAE,OAA4B,KAAK,CAEpD,EACA,MAAA,CAAA,EAIJE,GAAiBC,GACjBU,EAAAA,IAACK,EAAAA,SAAA,CACA,YAAU,gBACV,KAAK,QACL,MAAM,QACN,YAAad,EACb,4BAA2B,GAC3B,QAASF,EACT,cAAa,GACb,SAAUC,CAAA,CAAA,CACX,EAEF,EAECE,GAAeE,GACfM,EAAAA,IAACK,EAAAA,SAAA,CACA,YAAU,aACV,KAAK,QACL,MAAM,QACN,QAASV,EACT,SAAWW,GAAQ,CAElB,MAAMC,GADS,MAAM,QAAQD,CAAG,EAAIA,EAAI,CAAC,EAAIA,IACL,MACpCC,GACHb,EAAaa,CAAK,CAEpB,CAAA,CAAA,CACD,EAEF,CAEF"}
1
+ {"version":3,"file":"AgentListingFilters.js","sources":["../../../../src/components/agent-listing/AgentListingFilters.tsx"],"sourcesContent":["import SearchIcon from '@src/assets/icons/search.svg';\nimport React from 'react';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { DropdownOption, SingleOption } from '@src/components/dropdown/type';\nimport { Input } from '@src/components/input';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentListSortOption } from './AgentListing.model';\nimport { FilterRow, FilterRowLeft } from './AgentListing.styled';\n\ninterface AgentListingFiltersProps {\n\tsearchValue: string;\n\tonSearchChange: (value: string) => void;\n\t/** When set, Enter in the search box runs the search (typing only edits text). */\n\tonSearchSubmit?: (value: string) => void;\n\tsearchPlaceholder: string;\n\n\tfilterOptions?: DropdownOption[];\n\tonFilterChange?: (selected: DropdownOption | DropdownOption[]) => void;\n\tfilterPlaceholder: string;\n\n\tsortOptions?: AgentListSortOption[];\n\tselectedSort?: string;\n\tonSortChange?: (value: string) => void;\n}\n\nexport const AgentListingFilters: React.FC<AgentListingFiltersProps> = ({\n\tsearchValue,\n\tonSearchChange,\n\tonSearchSubmit,\n\tsearchPlaceholder,\n\tfilterOptions,\n\tonFilterChange,\n\tfilterPlaceholder,\n\tsortOptions,\n\tselectedSort,\n\tonSortChange,\n}) => {\n\tconst sortDropdownOptions: SingleOption[] = (sortOptions ?? []).map((o) => ({\n\t\tlabel: o.label,\n\t\tvalue: o.value,\n\t\tselected: o.value === selectedSort,\n\t}));\n\n\treturn (\n\t\t<FilterRow>\n\t\t\t<FilterRowLeft>\n\t\t\t\t<Input\n\t\t\t\t\tdata-test=\"agent-search\"\n\t\t\t\t\tvariant=\"small\"\n\t\t\t\t\twidth=\"320px\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={searchValue}\n\t\t\t\t\tplaceholder={searchPlaceholder}\n\t\t\t\t\thideInputHeader\n\t\t\t\t\tnoErrorHint\n\t\t\t\t\tleftIcon={{\n\t\t\t\t\t\ticon: () => (\n\t\t\t\t\t\t\t<SearchIcon\n\t\t\t\t\t\t\t\twidth={18}\n\t\t\t\t\t\t\t\theight={18}\n\t\t\t\t\t\t\t\tcolor={COLORS.content.placeholder}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t\tonChangeText={(text) => onSearchChange(text)}\n\t\t\t\t\tonKeyDownEvent={\n\t\t\t\t\t\tonSearchSubmit\n\t\t\t\t\t\t\t? (e) => {\n\t\t\t\t\t\t\t\t\tif ((e as unknown as KeyboardEvent).key === 'Enter') {\n\t\t\t\t\t\t\t\t\t\tonSearchSubmit((e.target as HTMLInputElement).value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\n\t\t\t\t{filterOptions && onFilterChange && (\n\t\t\t\t\t<Dropdown\n\t\t\t\t\t\tdata-test=\"agent-filters\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\twidth=\"140px\"\n\t\t\t\t\t\tplaceHolder={filterPlaceholder}\n\t\t\t\t\t\tshowPlaceholderWhenSelected\n\t\t\t\t\t\toptions={filterOptions}\n\t\t\t\t\t\tisMultiSelect\n\t\t\t\t\t\tonSelect={onFilterChange}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</FilterRowLeft>\n\n\t\t\t{sortOptions && onSortChange && (\n\t\t\t\t<Dropdown\n\t\t\t\t\tdata-test=\"agent-sort\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\twidth=\"200px\"\n\t\t\t\t\toptions={sortDropdownOptions}\n\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\tconst value = unwrapDropdownValue(opt);\n\t\t\t\t\t\tif (value) {\n\t\t\t\t\t\t\tonSortChange(value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</FilterRow>\n\t);\n};\n"],"names":["AgentListingFilters","searchValue","onSearchChange","onSearchSubmit","searchPlaceholder","filterOptions","onFilterChange","filterPlaceholder","sortOptions","selectedSort","onSortChange","sortDropdownOptions","o","FilterRow","jsxs","FilterRowLeft","jsx","Input","SearchIcon","COLORS","text","Dropdown","opt","value","unwrapDropdownValue"],"mappings":"qVAyBaA,EAA0D,CAAC,CACvE,YAAAC,EACA,eAAAC,EACA,eAAAC,EACA,kBAAAC,EACA,cAAAC,EACA,eAAAC,EACA,kBAAAC,EACA,YAAAC,EACA,aAAAC,EACA,aAAAC,CACD,IAAM,CACL,MAAMC,GAAuCH,GAAe,CAAA,GAAI,IAAKI,IAAO,CAC3E,MAAOA,EAAE,MACT,MAAOA,EAAE,MACT,SAAUA,EAAE,QAAUH,CAAA,EACrB,EAEF,cACEI,YAAA,CACA,SAAA,CAAAC,OAACC,EAAAA,cAAA,CACA,SAAA,CAAAC,EAAAA,IAACC,EAAAA,MAAA,CACA,YAAU,eACV,QAAQ,QACR,MAAM,QACN,KAAK,OACL,MAAOhB,EACP,YAAaG,EACb,gBAAe,GACf,YAAW,GACX,SAAU,CACT,KAAM,IACLY,EAAAA,IAACE,EAAAA,QAAA,CACA,MAAO,GACP,OAAQ,GACR,MAAOC,EAAAA,OAAO,QAAQ,WAAA,CAAA,CACvB,EAGF,aAAeC,GAASlB,EAAekB,CAAI,EAC3C,eACCjB,EACI,GAAM,CACF,EAA+B,MAAQ,SAC3CA,EAAgB,EAAE,OAA4B,KAAK,CAEpD,EACA,MAAA,CAAA,EAIJE,GAAiBC,GACjBU,EAAAA,IAACK,EAAAA,SAAA,CACA,YAAU,gBACV,KAAK,QACL,MAAM,QACN,YAAad,EACb,4BAA2B,GAC3B,QAASF,EACT,cAAa,GACb,SAAUC,CAAA,CAAA,CACX,EAEF,EAECE,GAAeE,GACfM,EAAAA,IAACK,EAAAA,SAAA,CACA,YAAU,aACV,KAAK,QACL,MAAM,QACN,QAASV,EACT,SAAWW,GAAQ,CAClB,MAAMC,EAAQC,EAAAA,oBAAoBF,CAAG,EACjCC,GACHb,EAAaa,CAAK,CAEpB,CAAA,CAAA,CACD,EAEF,CAEF"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=r=>(Array.isArray(r)?r[0]:r)?.value;exports.unwrapDropdownValue=e;
2
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/components/dropdown/utils.ts"],"sourcesContent":["import { DropdownOption, SingleOption } from './type';\n\n/**\n * Pull the selected `value` out of a {@link Dropdown} `onSelect` payload.\n *\n * `onSelect` hands back either a single option or an array (multi-select); most\n * single-select callers only want the chosen option's `value`. Returns\n * `undefined` when nothing resolves (empty array / grouped option with no value).\n */\nexport const unwrapDropdownValue = (\n\toption: DropdownOption | DropdownOption[],\n): string | undefined => {\n\tconst single = Array.isArray(option) ? option[0] : option;\n\treturn (single as SingleOption | undefined)?.value;\n};\n"],"names":["unwrapDropdownValue","option"],"mappings":"gFASO,MAAMA,EACZC,IAEe,MAAM,QAAQA,CAAM,EAAIA,EAAO,CAAC,EAAIA,IACN"}