@nyaruka/temba-components 0.130.5 → 0.131.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -20
- package/dist/temba-components.js +65 -64
- package/dist/temba-components.js.map +1 -1
- package/out-tsc/src/flow/nodes/split_by_random.js +1 -0
- package/out-tsc/src/flow/nodes/split_by_random.js.map +1 -1
- package/out-tsc/src/flow/nodes/wait_for_response.js +254 -65
- package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
- package/out-tsc/src/form/ArrayEditor.js +195 -2
- package/out-tsc/src/form/ArrayEditor.js.map +1 -1
- package/out-tsc/src/form/select/Omnibox.js +4 -0
- package/out-tsc/src/form/select/Omnibox.js.map +1 -1
- package/out-tsc/test/nodes/wait_for_response.test.js +373 -8
- package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -1
- package/package.json +1 -1
- package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
- package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
- package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
- package/src/flow/nodes/split_by_random.ts +1 -0
- package/src/flow/nodes/wait_for_response.ts +327 -72
- package/src/form/ArrayEditor.ts +260 -2
- package/src/form/select/Omnibox.ts +3 -0
- package/test/nodes/wait_for_response.test.ts +426 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait_for_response.js","sourceRoot":"","sources":["../../../../src/flow/nodes/wait_for_response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAA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C,MAAM,kBAAkB,GACtB,MAAM,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;wBAE7C,sBAAsB;wBACtB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC;wBAErD,4BAA4B;wBAC5B,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAC/B,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,CAC1D,CAAC;wBACF,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;4BACrB,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;wBAC7B,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;YAChE,4CAA4C;QAC9C,CAAC;QAED,WAAW,CAAC,IAAI,GAAG,UAAU,CAAC;QAC9B,OAAO;YACL,GAAG,YAAY;YACf,MAAM,EAAE,WAAW;YACnB,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { COLORS, NodeConfig } from '../types';\nimport { Node, Category, Exit, Case } from '../../store/flow-definition';\nimport { generateUUID } from '../../utils';\nimport {\n getWaitForResponseOperators,\n operatorsToSelectOptions,\n getOperatorConfig\n} from '../operators';\n\nconst TIMEOUT_OPTIONS = [\n { value: '60', name: '1 minute' },\n { value: '120', name: '2 minutes' },\n { value: '180', name: '3 minutes' },\n { value: '240', name: '4 minutes' },\n { value: '300', name: '5 minutes' },\n { value: '600', name: '10 minutes' },\n { value: '900', name: '15 minutes' },\n { value: '1800', name: '30 minutes' },\n { value: '3600', name: '1 hour' },\n { value: '7200', name: '2 hours' },\n { value: '10800', name: '3 hours' },\n { value: '21600', name: '6 hours' },\n { value: '43200', name: '12 hours' },\n { value: '64800', name: '18 hours' },\n { value: '86400', name: '1 day' },\n { value: '172800', name: '2 days' },\n { value: '259200', name: '3 days' },\n { value: '604800', name: '1 week' }\n];\n\n// Helper function to create a wait_for_response router with user rules\nconst createWaitForResponseRouter = (\n userRules: any[],\n existingCategories: Category[] = [],\n existingExits: Exit[] = [],\n existingCases: Case[] = []\n) => {\n const categories: Category[] = [];\n const exits: Exit[] = [];\n const cases: Case[] = [];\n\n // Filter existing categories to get only user-defined rules (exclude system categories)\n const existingUserCategories = existingCategories.filter(\n (cat) =>\n cat.name !== 'No Response' &&\n cat.name !== 'Other' &&\n cat.name !== 'Timeout'\n );\n\n // Track categories as we create them (case-insensitive lookup)\n const createdCategories = new Map<\n string,\n { uuid: string; name: string; exit_uuid: string }\n >();\n\n // Process rules in their original order to preserve rule order\n userRules.forEach((rule, ruleIndex) => {\n const categoryKey = rule.category.trim().toLowerCase();\n const categoryName = rule.category.trim(); // Use original casing\n\n let categoryInfo = createdCategories.get(categoryKey);\n\n if (!categoryInfo) {\n // First time seeing this category - create it\n\n // Smart category matching: try by name first, then fall back to position\n let existingCategory = existingUserCategories.find(\n (cat) => cat.name.toLowerCase() === categoryKey\n );\n\n // If no match by name, try by position (for category rename scenarios)\n const categoryCreationOrder = Array.from(createdCategories.keys()).length;\n if (\n !existingCategory &&\n categoryCreationOrder < existingUserCategories.length\n ) {\n existingCategory = existingUserCategories[categoryCreationOrder];\n }\n\n const existingExit = existingCategory\n ? existingExits.find((exit) => exit.uuid === existingCategory.exit_uuid)\n : null;\n\n const exitUuid = existingExit?.uuid || generateUUID();\n const categoryUuid = existingCategory?.uuid || generateUUID();\n\n categoryInfo = {\n uuid: categoryUuid,\n name: categoryName,\n exit_uuid: exitUuid\n };\n\n createdCategories.set(categoryKey, categoryInfo);\n\n // Add category and exit\n categories.push({\n uuid: categoryUuid,\n name: categoryName,\n exit_uuid: exitUuid\n });\n\n exits.push({\n uuid: exitUuid,\n destination_uuid: existingExit?.destination_uuid || null\n });\n }\n\n // Create case for this rule\n let existingCase = existingCases[ruleIndex];\n\n // If we can't find by position, try to find by matching rule content\n if (!existingCase && existingCases.length > 0) {\n existingCase = existingCases.find((case_) => {\n // Find the category for this case\n const caseCategory = existingCategories.find(\n (cat) => cat.uuid === case_.category_uuid\n );\n\n // Match by operator type and category name\n return (\n case_.type === rule.operator &&\n caseCategory?.name.toLowerCase() === categoryKey\n );\n });\n }\n\n const caseUuid = existingCase?.uuid || generateUUID();\n\n // Parse rule value based on operator configuration\n const operatorConfig = getOperatorConfig(rule.operator);\n let arguments_: string[] = [];\n\n if (operatorConfig) {\n if (operatorConfig.operands === 0) {\n // No operands needed\n arguments_ = [];\n } else if (operatorConfig.operands === 2) {\n // Split value for two operands (e.g., \"1 10\" for between)\n arguments_ = rule.value.split(' ').filter((arg: string) => arg.trim());\n } else {\n // Single operand - but split words for operators that expect multiple words\n if (rule.value && rule.value.trim()) {\n // Split on spaces and filter out empty strings\n arguments_ = rule.value\n .trim()\n .split(/\\s+/)\n .filter((arg: string) => arg.length > 0);\n } else {\n arguments_ = [];\n }\n }\n } else {\n // Fallback for unknown operators - split on spaces if value exists\n if (rule.value && rule.value.trim()) {\n arguments_ = rule.value\n .trim()\n .split(/\\s+/)\n .filter((arg: string) => arg.length > 0);\n } else {\n arguments_ = [];\n }\n }\n\n cases.push({\n uuid: caseUuid,\n type: rule.operator,\n arguments: arguments_,\n category_uuid: categoryInfo.uuid\n });\n });\n\n // Preserve existing timeout categories like \"No Response\"\n existingCategories.forEach((category) => {\n if (category.name === 'No Response' || category.name === 'Timeout') {\n const existingExit = existingExits.find(\n (exit) => exit.uuid === category.exit_uuid\n );\n\n if (existingExit) {\n categories.push(category);\n exits.push(existingExit);\n }\n }\n });\n\n // Add \"Other\" category (default) only if there are user rules\n if (userRules.length > 0) {\n const existingOtherCategory = existingCategories.find(\n (cat) => cat.name === 'Other'\n );\n const existingOtherExit = existingOtherCategory\n ? existingExits.find(\n (exit) => exit.uuid === existingOtherCategory.exit_uuid\n )\n : null;\n\n const otherExitUuid = existingOtherExit?.uuid || generateUUID();\n const otherCategoryUuid = existingOtherCategory?.uuid || generateUUID();\n\n categories.push({\n uuid: otherCategoryUuid,\n name: 'Other',\n exit_uuid: otherExitUuid\n });\n\n exits.push({\n uuid: otherExitUuid,\n destination_uuid: existingOtherExit?.destination_uuid || null\n });\n }\n\n return {\n router: {\n type: 'switch' as const,\n categories: categories,\n default_category_uuid: categories.find((cat) => cat.name === 'Other')\n ?.uuid,\n operand: '@input.text',\n cases: cases\n },\n exits: exits\n };\n};\n\nexport const wait_for_response: NodeConfig = {\n type: 'wait_for_response',\n name: 'Wait for Response',\n color: COLORS.wait,\n dialogSize: 'large',\n form: {\n rules: {\n type: 'array',\n helpText: 'Define rules to categorize responses',\n itemLabel: 'Rule',\n minItems: 0,\n maxItems: 100,\n sortable: true,\n maintainEmptyItem: true, // Explicitly enable empty item maintenance\n isEmptyItem: (item: any) => {\n // Helper function to get operator value from various formats\n const getOperatorValue = (operator: any): string => {\n if (typeof operator === 'string') {\n return operator.trim();\n } else if (Array.isArray(operator) && operator.length > 0) {\n // Handle array format: [{value: \"has_any_word\", name: \"...\"}]\n const firstOperator = operator[0];\n if (\n firstOperator &&\n typeof firstOperator === 'object' &&\n firstOperator.value\n ) {\n return firstOperator.value.trim();\n }\n } else if (\n operator &&\n typeof operator === 'object' &&\n operator.value\n ) {\n // Handle object format: {value: \"has_any_word\", name: \"...\"}\n return operator.value.trim();\n }\n return '';\n };\n\n // Check if operator and category are provided\n const operatorValue = getOperatorValue(item.operator);\n if (!operatorValue || !item.category || item.category.trim() === '') {\n return true;\n }\n\n // Check if value is required based on operator configuration\n const operatorConfig = getOperatorConfig(operatorValue);\n if (operatorConfig && operatorConfig.operands === 1) {\n // value1 is required for this operator\n return !item.value1 || item.value1.trim() === '';\n } else if (operatorConfig && operatorConfig.operands === 2) {\n // Both value1 and value2 are required for this operator\n return (\n !item.value1 ||\n item.value1.trim() === '' ||\n !item.value2 ||\n item.value2.trim() === ''\n );\n }\n\n // No value required for this operator\n return false;\n },\n itemConfig: {\n operator: {\n type: 'select',\n required: true,\n multi: false, // Explicitly set as single-select\n options: operatorsToSelectOptions(getWaitForResponseOperators()),\n flavor: 'xsmall',\n width: '200px'\n },\n value1: {\n type: 'text',\n flavor: 'xsmall',\n conditions: {\n visible: (formData: Record<string, any>) => {\n // Helper function to get operator value from various formats\n const getOperatorValue = (operator: any): string => {\n if (typeof operator === 'string') {\n return operator.trim();\n } else if (Array.isArray(operator) && operator.length > 0) {\n const firstOperator = operator[0];\n if (\n firstOperator &&\n typeof firstOperator === 'object' &&\n firstOperator.value\n ) {\n return firstOperator.value.trim();\n }\n } else if (\n operator &&\n typeof operator === 'object' &&\n operator.value\n ) {\n return operator.value.trim();\n }\n return '';\n };\n\n // Show value1 field for operators that require 1 or 2 operands\n const operatorValue = getOperatorValue(formData.operator);\n const operatorConfig = getOperatorConfig(operatorValue);\n return operatorConfig ? operatorConfig.operands >= 1 : true;\n }\n }\n },\n value2: {\n type: 'text',\n flavor: 'xsmall',\n conditions: {\n visible: (formData: Record<string, any>) => {\n // Helper function to get operator value from various formats\n const getOperatorValue = (operator: any): string => {\n if (typeof operator === 'string') {\n return operator.trim();\n } else if (Array.isArray(operator) && operator.length > 0) {\n const firstOperator = operator[0];\n if (\n firstOperator &&\n typeof firstOperator === 'object' &&\n firstOperator.value\n ) {\n return firstOperator.value.trim();\n }\n } else if (\n operator &&\n typeof operator === 'object' &&\n operator.value\n ) {\n return operator.value.trim();\n }\n return '';\n };\n\n // Show value2 field only if operator requires exactly 2 operands\n const operatorValue = getOperatorValue(formData.operator);\n const operatorConfig = getOperatorConfig(operatorValue);\n return operatorConfig ? operatorConfig.operands === 2 : false;\n }\n }\n },\n category: {\n type: 'text',\n placeholder: 'Category',\n required: true,\n maxWidth: '120px',\n flavor: 'xsmall'\n }\n }\n },\n timeout_enabled: {\n type: 'checkbox',\n label: (formData: Record<string, any>) => {\n return formData.timeout_enabled\n ? 'Continue when there is no response for'\n : 'Continue when there is no response..';\n },\n labelPadding: '4px 8px'\n },\n timeout_duration: {\n type: 'select',\n placeholder: '5 minutes',\n multi: false,\n maxWidth: '150px',\n flavor: 'xsmall',\n options: TIMEOUT_OPTIONS,\n conditions: {\n visible: (formData: Record<string, any>) => {\n return formData.timeout_enabled === true;\n }\n }\n },\n result_name: {\n type: 'text',\n label: 'Result Name',\n helpText: 'The name to save the response as',\n placeholder: 'response'\n }\n },\n layout: ['rules', 'result_name'],\n gutter: [\n {\n type: 'row',\n items: ['timeout_enabled', 'timeout_duration'],\n gap: '0.5rem'\n }\n ],\n validate: (_formData: any) => {\n const errors: { [key: string]: string } = {};\n\n // No validation needed - allow multiple rules to use same category name\n // Rules with the same category name will be merged to use the same exit\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n },\n toFormData: (node: Node) => {\n // Extract rules from router cases\n const rules = [];\n if (node.router?.cases && node.router?.categories) {\n node.router.cases.forEach((case_) => {\n // Find the category for this case\n const category = node.router!.categories.find(\n (cat) => cat.uuid === case_.category_uuid\n );\n\n // Skip timeout/system categories like \"No Response\"\n if (\n category &&\n category.name !== 'No Response' &&\n category.name !== 'Other'\n ) {\n // Handle different operator types\n const operatorConfig = getOperatorConfig(case_.type);\n const operatorDisplayName = operatorConfig\n ? operatorConfig.name\n : case_.type;\n let value1 = '';\n let value2 = '';\n\n if (operatorConfig && operatorConfig.operands === 0) {\n // No value needed for operators like has_text, has_number\n value1 = '';\n value2 = '';\n } else if (operatorConfig && operatorConfig.operands === 1) {\n // Single value for operators like has_number_lt - use value1\n value1 = case_.arguments.join(' ');\n value2 = '';\n } else if (operatorConfig && operatorConfig.operands === 2) {\n // Two separate values for operators like has_number_between\n value1 = case_.arguments[0] || '';\n value2 = case_.arguments[1] || '';\n } else {\n // Fallback: use first argument for unknown operators\n value1 = case_.arguments.join(' ');\n value2 = '';\n }\n\n rules.push({\n operator: { value: case_.type, name: operatorDisplayName },\n value1: value1,\n value2: value2,\n category: category.name\n });\n }\n });\n }\n\n // Extract timeout configuration\n const timeoutSeconds = node.router?.wait?.timeout?.seconds;\n let timeoutOption = TIMEOUT_OPTIONS.find(\n (opt) => opt.value === String(timeoutSeconds)\n );\n\n if (!timeoutOption) {\n timeoutOption = { value: '300', name: '5 minutes' };\n }\n\n return {\n uuid: node.uuid,\n rules: rules,\n timeout_enabled: !!timeoutSeconds,\n timeout_duration: timeoutOption,\n result_name: node.router?.result_name || 'response'\n };\n },\n fromFormData: (formData: any, originalNode: Node): Node => {\n // Helper function to get operator value from various formats\n const getOperatorValue = (operator: any): string => {\n if (typeof operator === 'string') {\n return operator.trim();\n } else if (Array.isArray(operator) && operator.length > 0) {\n // Handle array format: [{value: \"has_any_word\", name: \"...\"}]\n const firstOperator = operator[0];\n if (\n firstOperator &&\n typeof firstOperator === 'object' &&\n firstOperator.value\n ) {\n return firstOperator.value.trim();\n }\n } else if (operator && typeof operator === 'object' && operator.value) {\n // Handle object format: {value: \"has_any_word\", name: \"...\"}\n return operator.value.trim();\n }\n return '';\n };\n\n // Get user rules\n const userRules = (formData.rules || [])\n .filter((rule: any) => {\n // Always need operator and category\n const operatorValue = getOperatorValue(rule?.operator);\n if (\n !operatorValue ||\n !rule?.category ||\n operatorValue === '' ||\n rule.category.trim() === ''\n ) {\n return false;\n }\n\n // Check if value is required based on operator\n const operatorConfig = getOperatorConfig(operatorValue);\n if (operatorConfig && operatorConfig.operands === 1) {\n // value1 is required for this operator\n return rule?.value1 && rule.value1.trim() !== '';\n } else if (operatorConfig && operatorConfig.operands === 2) {\n // Both value1 and value2 are required for this operator\n return (\n rule?.value1 &&\n rule.value1.trim() !== '' &&\n rule?.value2 &&\n rule.value2.trim() !== ''\n );\n }\n\n // No value required for this operator\n return true;\n })\n .map((rule: any) => {\n const operatorValue = getOperatorValue(rule.operator);\n const operatorConfig = getOperatorConfig(operatorValue);\n\n let value = '';\n\n if (operatorConfig && operatorConfig.operands === 1) {\n // Single value from value1\n value = rule.value1 ? rule.value1.trim() : '';\n } else if (operatorConfig && operatorConfig.operands === 2) {\n // Two values - combine them with space\n const val1 = rule.value1 ? rule.value1.trim() : '';\n const val2 = rule.value2 ? rule.value2.trim() : '';\n value = `${val1} ${val2}`.trim();\n } else {\n // No value needed for 0-operand operators\n value = '';\n }\n\n return {\n operator: operatorValue,\n value: value,\n category: rule.category.trim()\n };\n });\n\n // If no user rules, clear cases but preserve other router config\n if (userRules.length === 0) {\n const router: any = {\n ...originalNode.router,\n result_name: formData.result_name || 'response'\n };\n\n // Only set cases to empty if the original node had cases\n if (originalNode.router?.cases !== undefined) {\n router.cases = []; // Clear all cases when no rules\n }\n\n // Build wait configuration based on form data\n const waitConfig: any = {\n type: 'msg'\n };\n\n // Add timeout if enabled\n if (formData.timeout_enabled) {\n // Extract timeout value (handle both string and object formats)\n let timeoutSeconds;\n\n if (formData.timeout_duration) {\n if (\n Array.isArray(formData.timeout_duration) &&\n formData.timeout_duration.length > 0\n ) {\n // Handle array of selected options (multi-select behavior)\n timeoutSeconds = parseInt(formData.timeout_duration[0].value, 10);\n } else if (typeof formData.timeout_duration === 'string') {\n timeoutSeconds = parseInt(formData.timeout_duration, 10);\n } else if (\n formData.timeout_duration &&\n typeof formData.timeout_duration === 'object' &&\n formData.timeout_duration.value\n ) {\n timeoutSeconds = parseInt(formData.timeout_duration.value, 10);\n } else {\n timeoutSeconds = 300; // Default to 5 minutes\n }\n } else {\n // No duration selected, use default\n timeoutSeconds = 300; // Default to 5 minutes\n }\n\n // Validate that we got a valid number\n if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {\n timeoutSeconds = 300; // Default to 5 minutes\n }\n\n // Find or create the \"No Response\" category\n let noResponseCategory = originalNode.router?.categories?.find(\n (cat: any) => cat.name === 'No Response'\n );\n\n if (!noResponseCategory) {\n noResponseCategory = {\n uuid: generateUUID(),\n name: 'No Response',\n exit_uuid: generateUUID()\n };\n\n // Add to router categories\n router.categories = router.categories || [];\n router.categories.push(noResponseCategory);\n }\n\n waitConfig.timeout = {\n seconds: timeoutSeconds,\n category_uuid: noResponseCategory.uuid\n };\n }\n\n router.wait = waitConfig;\n\n return {\n ...originalNode,\n router\n };\n }\n\n // Get existing router data for preservation\n const existingCategories = originalNode.router?.categories || [];\n const existingExits = originalNode.exits || [];\n const existingCases = originalNode.router?.cases || [];\n\n // Create router and exits using existing data when possible\n const { router, exits } = createWaitForResponseRouter(\n userRules,\n existingCategories,\n existingExits,\n existingCases\n );\n\n // Build final router with wait configuration and result_name\n const finalRouter: any = {\n ...router,\n result_name: formData.result_name || 'response'\n };\n\n // Build wait configuration based on form data\n const waitConfig: any = {\n type: 'msg'\n };\n\n try {\n // Handle timeout configuration\n if (formData.timeout_enabled) {\n // Extract timeout value (handle both string and object formats)\n let timeoutSeconds;\n\n if (formData.timeout_duration) {\n try {\n timeoutSeconds = parseInt(formData.timeout_duration[0].value, 10);\n } catch (e) {\n timeoutSeconds = 300; // Default to 5 minutes\n }\n }\n\n // Find or create the \"No Response\" category\n const existingNoResponseCategory =\n originalNode.router?.categories?.find(\n (cat: any) => cat.name === 'No Response'\n );\n\n const noResponseCategory = existingNoResponseCategory || {\n uuid: generateUUID(),\n name: 'No Response',\n exit_uuid: generateUUID()\n };\n\n waitConfig.timeout = {\n seconds: timeoutSeconds,\n category_uuid: noResponseCategory.uuid\n };\n\n // Ensure No Response category and exit exist\n if (\n !router.categories?.some((cat: any) => cat.name === 'No Response')\n ) {\n router.categories = router.categories || [];\n router.categories.push(noResponseCategory);\n\n // Add corresponding exit if it doesn't exist\n if (\n !exits.some(\n (exit: any) => exit.uuid === noResponseCategory.exit_uuid\n )\n ) {\n const noResponseExit = {\n uuid: noResponseCategory.exit_uuid,\n destination_uuid: existingNoResponseCategory?.exit_uuid\n ? originalNode.exits?.find(\n (exit) => exit.uuid === existingNoResponseCategory.exit_uuid\n )?.destination_uuid || null\n : null\n };\n exits.push(noResponseExit);\n }\n }\n } else {\n // Remove \"No Response\" category if timeout is disabled\n if (router.categories) {\n const noResponseCategoryIndex = router.categories.findIndex(\n (cat: any) => cat.name === 'No Response'\n );\n if (noResponseCategoryIndex !== -1) {\n const noResponseCategory =\n router.categories[noResponseCategoryIndex];\n\n // Remove the category\n router.categories.splice(noResponseCategoryIndex, 1);\n\n // Remove corresponding exit\n const exitIndex = exits.findIndex(\n (exit: any) => exit.uuid === noResponseCategory.exit_uuid\n );\n if (exitIndex !== -1) {\n exits.splice(exitIndex, 1);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error processing timeout configuration:', error);\n // Continue without timeout in case of error\n }\n\n finalRouter.wait = waitConfig;\n return {\n ...originalNode,\n router: finalRouter,\n exits: exits\n };\n }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"wait_for_response.js","sourceRoot":"","sources":["../../../../src/flow/nodes/wait_for_response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB,MAAM,eAAe,GAAG;IACtB,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE;IACjC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE;IACnC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE;IACnC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE;IACnC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE;IACnC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE;IACpC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE;IACpC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE;IACrC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,Q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GAAG,KAAK,CAAC,SAAS,CAC/B,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,SAAS,CAC1D,CAAC;wBACF,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;4BACrB,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;wBAC7B,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;YAChE,4CAA4C;QAC9C,CAAC;QAED,WAAW,CAAC,IAAI,GAAG,UAAU,CAAC;QAC9B,OAAO;YACL,GAAG,YAAY;YACf,MAAM,EAAE,WAAW;YACnB,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { COLORS, NodeConfig } from '../types';\nimport { Node, Category, Exit, Case } from '../../store/flow-definition';\nimport { generateUUID } from '../../utils';\nimport {\n getWaitForResponseOperators,\n operatorsToSelectOptions,\n getOperatorConfig\n} from '../operators';\n\nconst TIMEOUT_OPTIONS = [\n { value: '60', name: '1 minute' },\n { value: '120', name: '2 minutes' },\n { value: '180', name: '3 minutes' },\n { value: '240', name: '4 minutes' },\n { value: '300', name: '5 minutes' },\n { value: '600', name: '10 minutes' },\n { value: '900', name: '15 minutes' },\n { value: '1800', name: '30 minutes' },\n { value: '3600', name: '1 hour' },\n { value: '7200', name: '2 hours' },\n { value: '10800', name: '3 hours' },\n { value: '21600', name: '6 hours' },\n { value: '43200', name: '12 hours' },\n { value: '64800', name: '18 hours' },\n { value: '86400', name: '1 day' },\n { value: '172800', name: '2 days' },\n { value: '259200', name: '3 days' },\n { value: '604800', name: '1 week' }\n];\n\n// Helper function to check if a category is a system category\nconst isSystemCategory = (categoryName: string): boolean => {\n return ['No Response', 'Other', 'All Responses', 'Timeout'].includes(\n categoryName\n );\n};\n\n// Helper function to check if a UUID belongs to a system category\nconst isSystemCategoryUuid = (\n uuid: string,\n categories: Category[]\n): boolean => {\n const category = categories.find((cat) => cat.uuid === uuid);\n return category ? isSystemCategory(category.name) : false;\n};\n\n// Helper function to generate default category name based on operator and operands\nconst generateDefaultCategoryName = (\n operator: string,\n value1?: string,\n value2?: string\n): string => {\n const operatorConfig = getOperatorConfig(operator);\n if (!operatorConfig) return '';\n\n // Fixed category names (no operands)\n if (operatorConfig.operands === 0) {\n return operatorConfig.categoryName || '';\n }\n\n // Dynamic category names based on operands\n const cleanValue1 = (value1 || '').trim();\n const cleanValue2 = (value2 || '').trim();\n\n // Helper to capitalize first letter\n const capitalize = (str: string) => {\n if (!str) return '';\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\n };\n\n // Handle different operator types\n switch (operator) {\n // Word/phrase operators - capitalize first letter of value\n case 'has_any_word':\n case 'has_all_words':\n case 'has_phrase':\n case 'has_only_phrase':\n case 'has_beginning':\n return cleanValue1 ? capitalize(cleanValue1) : '';\n\n // Pattern operators - show as-is\n case 'has_pattern':\n return cleanValue1;\n\n // Number comparison operators - include symbol\n case 'has_number_eq':\n return cleanValue1 ? `= ${cleanValue1}` : '';\n case 'has_number_lt':\n return cleanValue1 ? `< ${cleanValue1}` : '';\n case 'has_number_lte':\n return cleanValue1 ? `≤ ${cleanValue1}` : '';\n case 'has_number_gt':\n return cleanValue1 ? `> ${cleanValue1}` : '';\n case 'has_number_gte':\n return cleanValue1 ? `≥ ${cleanValue1}` : '';\n\n // Number between - range format\n case 'has_number_between':\n if (cleanValue1 && cleanValue2) {\n return `${cleanValue1} - ${cleanValue2}`;\n }\n return '';\n\n // Date operators - format with relative expressions\n case 'has_date_lt':\n case 'has_date_lte':\n if (cleanValue1) {\n // Parse relative date expression (e.g., \"today + 5\" or \"today - 3\")\n const match = cleanValue1.match(/^(today)\\s*([+-])\\s*(\\d+)$/i);\n if (match) {\n const [, base, operator, days] = match;\n const dayWord = days === '1' ? 'day' : 'days';\n return `Before ${base} ${operator} ${days} ${dayWord}`;\n }\n // Fallback for other date formats\n return `Before ${cleanValue1}`;\n }\n return '';\n\n case 'has_date_gt':\n case 'has_date_gte':\n if (cleanValue1) {\n // Parse relative date expression\n const match = cleanValue1.match(/^(today)\\s*([+-])\\s*(\\d+)$/i);\n if (match) {\n const [, base, operator, days] = match;\n const dayWord = days === '1' ? 'day' : 'days';\n return `After ${base} ${operator} ${days} ${dayWord}`;\n }\n // Fallback for other date formats\n return `After ${cleanValue1}`;\n }\n return '';\n\n case 'has_date_eq':\n if (cleanValue1) {\n // Parse relative date expression\n const match = cleanValue1.match(/^(today)\\s*([+-])\\s*(\\d+)$/i);\n if (match) {\n const [, base, operator, days] = match;\n const dayWord = days === '1' ? 'day' : 'days';\n return `${base} ${operator} ${days} ${dayWord}`;\n }\n return cleanValue1;\n }\n return '';\n\n default:\n // Fallback - capitalize first value\n return cleanValue1 ? capitalize(cleanValue1) : '';\n }\n};\n\n// Helper function to create a wait_for_response router with user rules\nconst createWaitForResponseRouter = (\n userRules: any[],\n existingCategories: Category[] = [],\n existingExits: Exit[] = [],\n existingCases: Case[] = []\n) => {\n const categories: Category[] = [];\n const exits: Exit[] = [];\n const cases: Case[] = [];\n\n // Filter existing categories to get only user-defined rules (exclude system categories)\n const existingUserCategories = existingCategories.filter(\n (cat) => !isSystemCategory(cat.name)\n );\n\n // Track categories as we create them (case-insensitive lookup)\n const createdCategories = new Map<\n string,\n { uuid: string; name: string; exit_uuid: string }\n >();\n\n // Process rules in their original order to preserve rule order\n userRules.forEach((rule, ruleIndex) => {\n const categoryKey = rule.category.trim().toLowerCase();\n const categoryName = rule.category.trim(); // Use original casing\n\n let categoryInfo = createdCategories.get(categoryKey);\n\n if (!categoryInfo) {\n // First time seeing this category - create it\n\n // Smart category matching: try by name first, then fall back to position\n let existingCategory = existingUserCategories.find(\n (cat) => cat.name.toLowerCase() === categoryKey\n );\n\n // If no match by name, try by position (for category rename scenarios)\n const categoryCreationOrder = Array.from(createdCategories.keys()).length;\n if (\n !existingCategory &&\n categoryCreationOrder < existingUserCategories.length\n ) {\n const candidateCategory = existingUserCategories[categoryCreationOrder];\n // Double-check that this candidate is not a system category UUID\n if (\n candidateCategory &&\n !isSystemCategoryUuid(candidateCategory.uuid, existingCategories)\n ) {\n existingCategory = candidateCategory;\n }\n }\n\n const existingExit = existingCategory\n ? existingExits.find((exit) => exit.uuid === existingCategory.exit_uuid)\n : null;\n\n // Generate UUIDs, ensuring we don't reuse system category UUIDs\n let exitUuid = existingExit?.uuid || generateUUID();\n let categoryUuid = existingCategory?.uuid || generateUUID();\n\n // Additional safety check: if somehow we got a system category UUID, generate new ones\n if (isSystemCategoryUuid(categoryUuid, existingCategories)) {\n categoryUuid = generateUUID();\n exitUuid = generateUUID();\n }\n\n categoryInfo = {\n uuid: categoryUuid,\n name: categoryName,\n exit_uuid: exitUuid\n };\n\n createdCategories.set(categoryKey, categoryInfo);\n\n // Add category and exit\n categories.push({\n uuid: categoryUuid,\n name: categoryName,\n exit_uuid: exitUuid\n });\n\n exits.push({\n uuid: exitUuid,\n destination_uuid: existingExit?.destination_uuid || null\n });\n }\n\n // Create case for this rule\n let existingCase = existingCases[ruleIndex];\n\n // If we can't find by position, try to find by matching rule content\n if (!existingCase && existingCases.length > 0) {\n existingCase = existingCases.find((case_) => {\n // Find the category for this case\n const caseCategory = existingCategories.find(\n (cat) => cat.uuid === case_.category_uuid\n );\n\n // Match by operator type and category name\n return (\n case_.type === rule.operator &&\n caseCategory?.name.toLowerCase() === categoryKey\n );\n });\n }\n\n const caseUuid = existingCase?.uuid || generateUUID();\n\n // Parse rule value based on operator configuration\n const operatorConfig = getOperatorConfig(rule.operator);\n let arguments_: string[] = [];\n\n if (operatorConfig) {\n if (operatorConfig.operands === 0) {\n // No operands needed\n arguments_ = [];\n } else if (operatorConfig.operands === 2) {\n // Split value for two operands (e.g., \"1 10\" for between)\n arguments_ = rule.value.split(' ').filter((arg: string) => arg.trim());\n } else {\n // Single operand - but split words for operators that expect multiple words\n if (rule.value && rule.value.trim()) {\n // Split on spaces and filter out empty strings\n arguments_ = rule.value\n .trim()\n .split(/\\s+/)\n .filter((arg: string) => arg.length > 0);\n } else {\n arguments_ = [];\n }\n }\n } else {\n // Fallback for unknown operators - split on spaces if value exists\n if (rule.value && rule.value.trim()) {\n arguments_ = rule.value\n .trim()\n .split(/\\s+/)\n .filter((arg: string) => arg.length > 0);\n } else {\n arguments_ = [];\n }\n }\n\n cases.push({\n uuid: caseUuid,\n type: rule.operator,\n arguments: arguments_,\n category_uuid: categoryInfo.uuid\n });\n });\n\n // Add default category (always present)\n // Name is \"Other\" if there are user rules, \"All Responses\" if there are no user rules\n const defaultCategoryName = userRules.length > 0 ? 'Other' : 'All Responses';\n\n // Try to find existing default category by name (prefer exact match)\n let existingDefaultCategory = existingCategories.find(\n (cat) => cat.name === defaultCategoryName\n );\n\n // If no exact match, try to find the other possible default category name\n if (!existingDefaultCategory) {\n const alternateName = userRules.length > 0 ? 'All Responses' : 'Other';\n existingDefaultCategory = existingCategories.find(\n (cat) => cat.name === alternateName\n );\n }\n\n const existingDefaultExit = existingDefaultCategory\n ? existingExits.find(\n (exit) => exit.uuid === existingDefaultCategory.exit_uuid\n )\n : null;\n\n const defaultExitUuid = existingDefaultExit?.uuid || generateUUID();\n const defaultCategoryUuid = existingDefaultCategory?.uuid || generateUUID();\n\n categories.push({\n uuid: defaultCategoryUuid,\n name: defaultCategoryName,\n exit_uuid: defaultExitUuid\n });\n\n exits.push({\n uuid: defaultExitUuid,\n destination_uuid: existingDefaultExit?.destination_uuid || null\n });\n\n // Add \"No Response\" category last (if it exists in the original)\n const existingNoResponseCategory = existingCategories.find(\n (cat) => cat.name === 'No Response' || cat.name === 'Timeout'\n );\n\n if (existingNoResponseCategory) {\n const existingNoResponseExit = existingExits.find(\n (exit) => exit.uuid === existingNoResponseCategory.exit_uuid\n );\n\n if (existingNoResponseExit) {\n categories.push(existingNoResponseCategory);\n exits.push(existingNoResponseExit);\n }\n }\n\n // Find the default category (either \"Other\" or \"All Responses\")\n const defaultCategory = categories.find(\n (cat) => cat.name === 'Other' || cat.name === 'All Responses'\n );\n\n return {\n router: {\n type: 'switch' as const,\n categories: categories,\n default_category_uuid: defaultCategory?.uuid,\n operand: '@input.text',\n cases: cases\n },\n exits: exits\n };\n};\n\nexport const wait_for_response: NodeConfig = {\n type: 'wait_for_response',\n name: 'Wait for Response',\n color: COLORS.wait,\n dialogSize: 'large',\n form: {\n rules: {\n type: 'array',\n helpText: 'Define rules to categorize responses',\n itemLabel: 'Rule',\n minItems: 0,\n maxItems: 100,\n sortable: true,\n maintainEmptyItem: true, // Explicitly enable empty item maintenance\n isEmptyItem: (item: any) => {\n // Helper function to get operator value from various formats\n const getOperatorValue = (operator: any): string => {\n if (typeof operator === 'string') {\n return operator.trim();\n } else if (Array.isArray(operator) && operator.length > 0) {\n // Handle array format: [{value: \"has_any_word\", name: \"...\"}]\n const firstOperator = operator[0];\n if (\n firstOperator &&\n typeof firstOperator === 'object' &&\n firstOperator.value\n ) {\n return firstOperator.value.trim();\n }\n } else if (\n operator &&\n typeof operator === 'object' &&\n operator.value\n ) {\n // Handle object format: {value: \"has_any_word\", name: \"...\"}\n return operator.value.trim();\n }\n return '';\n };\n\n // Check if operator and category are provided\n const operatorValue = getOperatorValue(item.operator);\n if (!operatorValue || !item.category || item.category.trim() === '') {\n return true;\n }\n\n // Check if value is required based on operator configuration\n const operatorConfig = getOperatorConfig(operatorValue);\n if (operatorConfig && operatorConfig.operands === 1) {\n // value1 is required for this operator\n return !item.value1 || item.value1.trim() === '';\n } else if (operatorConfig && operatorConfig.operands === 2) {\n // Both value1 and value2 are required for this operator\n return (\n !item.value1 ||\n item.value1.trim() === '' ||\n !item.value2 ||\n item.value2.trim() === ''\n );\n }\n\n // No value required for this operator\n return false;\n },\n onItemChange: (\n itemIndex: number,\n field: string,\n value: any,\n allItems: any[]\n ) => {\n const updatedItems = [...allItems];\n const item = { ...updatedItems[itemIndex] };\n\n // Helper to get operator value from various formats\n const getOperatorValue = (operator: any): string => {\n if (typeof operator === 'string') {\n return operator.trim();\n } else if (Array.isArray(operator) && operator.length > 0) {\n const firstOperator = operator[0];\n if (\n firstOperator &&\n typeof firstOperator === 'object' &&\n firstOperator.value\n ) {\n return firstOperator.value.trim();\n }\n } else if (\n operator &&\n typeof operator === 'object' &&\n operator.value\n ) {\n return operator.value.trim();\n }\n return '';\n };\n\n // Update the changed field\n item[field] = value;\n\n // Get operator values (before and after the change)\n const oldItem = allItems[itemIndex] || {};\n const oldOperatorValue =\n field === 'operator'\n ? getOperatorValue(oldItem.operator)\n : getOperatorValue(item.operator);\n const newOperatorValue = getOperatorValue(item.operator);\n\n // Calculate what the default category name should be before the change\n const oldDefaultCategory = generateDefaultCategoryName(\n oldOperatorValue,\n field === 'value1' ? oldItem.value1 : item.value1,\n field === 'value2' ? oldItem.value2 : item.value2\n );\n\n // Calculate what the new default category name should be after the change\n const newDefaultCategory = generateDefaultCategoryName(\n newOperatorValue,\n item.value1,\n item.value2\n );\n\n // Determine if we should auto-update the category\n const shouldUpdateCategory =\n // Category is empty\n !item.category ||\n item.category.trim() === '' ||\n // Category matches the old default (user hasn't customized it)\n item.category === oldDefaultCategory;\n\n // Auto-populate or update category if conditions are met\n if (shouldUpdateCategory && newDefaultCategory) {\n item.category = newDefaultCategory;\n }\n\n updatedItems[itemIndex] = item;\n return updatedItems;\n },\n itemConfig: {\n operator: {\n type: 'select',\n required: true,\n multi: false, // Explicitly set as single-select\n options: operatorsToSelectOptions(getWaitForResponseOperators()),\n flavor: 'xsmall',\n width: '200px'\n },\n value1: {\n type: 'text',\n flavor: 'xsmall',\n conditions: {\n visible: (formData: Record<string, any>) => {\n // Helper function to get operator value from various formats\n const getOperatorValue = (operator: any): string => {\n if (typeof operator === 'string') {\n return operator.trim();\n } else if (Array.isArray(operator) && operator.length > 0) {\n const firstOperator = operator[0];\n if (\n firstOperator &&\n typeof firstOperator === 'object' &&\n firstOperator.value\n ) {\n return firstOperator.value.trim();\n }\n } else if (\n operator &&\n typeof operator === 'object' &&\n operator.value\n ) {\n return operator.value.trim();\n }\n return '';\n };\n\n // Show value1 field for operators that require 1 or 2 operands\n const operatorValue = getOperatorValue(formData.operator);\n const operatorConfig = getOperatorConfig(operatorValue);\n return operatorConfig ? operatorConfig.operands >= 1 : true;\n }\n }\n },\n value2: {\n type: 'text',\n flavor: 'xsmall',\n conditions: {\n visible: (formData: Record<string, any>) => {\n // Helper function to get operator value from various formats\n const getOperatorValue = (operator: any): string => {\n if (typeof operator === 'string') {\n return operator.trim();\n } else if (Array.isArray(operator) && operator.length > 0) {\n const firstOperator = operator[0];\n if (\n firstOperator &&\n typeof firstOperator === 'object' &&\n firstOperator.value\n ) {\n return firstOperator.value.trim();\n }\n } else if (\n operator &&\n typeof operator === 'object' &&\n operator.value\n ) {\n return operator.value.trim();\n }\n return '';\n };\n\n // Show value2 field only if operator requires exactly 2 operands\n const operatorValue = getOperatorValue(formData.operator);\n const operatorConfig = getOperatorConfig(operatorValue);\n return operatorConfig ? operatorConfig.operands === 2 : false;\n }\n }\n },\n category: {\n type: 'text',\n placeholder: 'Category',\n required: true,\n maxWidth: '120px',\n flavor: 'xsmall'\n }\n }\n },\n timeout_enabled: {\n type: 'checkbox',\n label: (formData: Record<string, any>) => {\n return formData.timeout_enabled\n ? 'Continue when there is no response for'\n : 'Continue when there is no response..';\n },\n labelPadding: '4px 8px'\n },\n timeout_duration: {\n type: 'select',\n placeholder: '5 minutes',\n multi: false,\n maxWidth: '150px',\n flavor: 'xsmall',\n options: TIMEOUT_OPTIONS,\n conditions: {\n visible: (formData: Record<string, any>) => {\n return formData.timeout_enabled === true;\n }\n }\n },\n result_name: {\n type: 'text',\n label: 'Result Name',\n helpText: 'The name to save the response as',\n placeholder: 'response'\n }\n },\n layout: ['rules', 'result_name'],\n gutter: [\n {\n type: 'row',\n items: ['timeout_enabled', 'timeout_duration'],\n gap: '0.5rem'\n }\n ],\n validate: (_formData: any) => {\n const errors: { [key: string]: string } = {};\n\n // No validation needed - allow multiple rules to use same category name\n // Rules with the same category name will be merged to use the same exit\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n },\n toFormData: (node: Node) => {\n // Extract rules from router cases\n const rules = [];\n if (node.router?.cases && node.router?.categories) {\n node.router.cases.forEach((case_) => {\n // Find the category for this case\n const category = node.router!.categories.find(\n (cat) => cat.uuid === case_.category_uuid\n );\n\n // Skip system categories\n if (category && !isSystemCategory(category.name)) {\n // Handle different operator types\n const operatorConfig = getOperatorConfig(case_.type);\n const operatorDisplayName = operatorConfig\n ? operatorConfig.name\n : case_.type;\n let value1 = '';\n let value2 = '';\n\n if (operatorConfig && operatorConfig.operands === 0) {\n // No value needed for operators like has_text, has_number\n value1 = '';\n value2 = '';\n } else if (operatorConfig && operatorConfig.operands === 1) {\n // Single value for operators like has_number_lt - use value1\n value1 = case_.arguments.join(' ');\n value2 = '';\n } else if (operatorConfig && operatorConfig.operands === 2) {\n // Two separate values for operators like has_number_between\n value1 = case_.arguments[0] || '';\n value2 = case_.arguments[1] || '';\n } else {\n // Fallback: use first argument for unknown operators\n value1 = case_.arguments.join(' ');\n value2 = '';\n }\n\n rules.push({\n operator: { value: case_.type, name: operatorDisplayName },\n value1: value1,\n value2: value2,\n category: category.name\n });\n }\n });\n }\n\n // Extract timeout configuration\n const timeoutSeconds = node.router?.wait?.timeout?.seconds;\n let timeoutOption = TIMEOUT_OPTIONS.find(\n (opt) => opt.value === String(timeoutSeconds)\n );\n\n if (!timeoutOption) {\n timeoutOption = { value: '300', name: '5 minutes' };\n }\n\n return {\n uuid: node.uuid,\n rules: rules,\n timeout_enabled: !!timeoutSeconds,\n timeout_duration: timeoutOption,\n result_name: node.router?.result_name || 'response'\n };\n },\n fromFormData: (formData: any, originalNode: Node): Node => {\n // Helper function to get operator value from various formats\n const getOperatorValue = (operator: any): string => {\n if (typeof operator === 'string') {\n return operator.trim();\n } else if (Array.isArray(operator) && operator.length > 0) {\n // Handle array format: [{value: \"has_any_word\", name: \"...\"}]\n const firstOperator = operator[0];\n if (\n firstOperator &&\n typeof firstOperator === 'object' &&\n firstOperator.value\n ) {\n return firstOperator.value.trim();\n }\n } else if (operator && typeof operator === 'object' && operator.value) {\n // Handle object format: {value: \"has_any_word\", name: \"...\"}\n return operator.value.trim();\n }\n return '';\n };\n\n // Get user rules\n const userRules = (formData.rules || [])\n .filter((rule: any) => {\n // Always need operator and category\n const operatorValue = getOperatorValue(rule?.operator);\n if (\n !operatorValue ||\n !rule?.category ||\n operatorValue === '' ||\n rule.category.trim() === ''\n ) {\n return false;\n }\n\n // Check if value is required based on operator\n const operatorConfig = getOperatorConfig(operatorValue);\n if (operatorConfig && operatorConfig.operands === 1) {\n // value1 is required for this operator\n return rule?.value1 && rule.value1.trim() !== '';\n } else if (operatorConfig && operatorConfig.operands === 2) {\n // Both value1 and value2 are required for this operator\n return (\n rule?.value1 &&\n rule.value1.trim() !== '' &&\n rule?.value2 &&\n rule.value2.trim() !== ''\n );\n }\n\n // No value required for this operator\n return true;\n })\n .map((rule: any) => {\n const operatorValue = getOperatorValue(rule.operator);\n const operatorConfig = getOperatorConfig(operatorValue);\n\n let value = '';\n\n if (operatorConfig && operatorConfig.operands === 1) {\n // Single value from value1\n value = rule.value1 ? rule.value1.trim() : '';\n } else if (operatorConfig && operatorConfig.operands === 2) {\n // Two values - combine them with space\n const val1 = rule.value1 ? rule.value1.trim() : '';\n const val2 = rule.value2 ? rule.value2.trim() : '';\n value = `${val1} ${val2}`.trim();\n } else {\n // No value needed for 0-operand operators\n value = '';\n }\n\n return {\n operator: operatorValue,\n value: value,\n category: rule.category.trim()\n };\n });\n\n // If no user rules, clear cases but preserve other router config\n if (userRules.length === 0) {\n // Get existing router data for preservation\n let existingCategories = originalNode.router?.categories || [];\n const existingExits = [...(originalNode.exits || [])]; // Create a copy to avoid extensibility issues\n\n // Handle timeout: ensure \"No Response\" category exists if timeout is enabled,\n // or remove it if timeout is disabled\n if (formData.timeout_enabled) {\n let noResponseCategory = existingCategories.find(\n (cat: any) => cat.name === 'No Response'\n );\n\n if (!noResponseCategory) {\n // Create new \"No Response\" category and exit\n const noResponseExitUuid = generateUUID();\n noResponseCategory = {\n uuid: generateUUID(),\n name: 'No Response',\n exit_uuid: noResponseExitUuid\n };\n\n // Add to existing categories for processing\n existingCategories = [...existingCategories, noResponseCategory];\n\n // Add corresponding exit if it doesn't exist\n if (!existingExits.find((exit) => exit.uuid === noResponseExitUuid)) {\n existingExits.push({\n uuid: noResponseExitUuid,\n destination_uuid: null\n });\n }\n }\n } else {\n // If timeout is disabled, remove \"No Response\" category from existing categories\n existingCategories = existingCategories.filter(\n (cat: any) => cat.name !== 'No Response'\n );\n }\n\n // Create router with \"All Responses\" as default category\n // This will now properly handle the \"No Response\" category if it exists\n const { router: noRulesRouter, exits: noRulesExits } =\n createWaitForResponseRouter(\n [], // No user rules\n existingCategories,\n existingExits,\n [] // No cases\n );\n\n const router: any = {\n ...noRulesRouter,\n result_name: formData.result_name || 'response',\n cases: [] // Clear all cases when no rules\n };\n\n // Build wait configuration based on form data\n const waitConfig: any = {\n type: 'msg'\n };\n\n // Add timeout if enabled\n if (formData.timeout_enabled) {\n // Extract timeout value (handle both string and object formats)\n let timeoutSeconds;\n\n if (formData.timeout_duration) {\n if (\n Array.isArray(formData.timeout_duration) &&\n formData.timeout_duration.length > 0\n ) {\n // Handle array of selected options (multi-select behavior)\n timeoutSeconds = parseInt(formData.timeout_duration[0].value, 10);\n } else if (typeof formData.timeout_duration === 'string') {\n timeoutSeconds = parseInt(formData.timeout_duration, 10);\n } else if (\n formData.timeout_duration &&\n typeof formData.timeout_duration === 'object' &&\n formData.timeout_duration.value\n ) {\n timeoutSeconds = parseInt(formData.timeout_duration.value, 10);\n } else {\n timeoutSeconds = 300; // Default to 5 minutes\n }\n } else {\n // No duration selected, use default\n timeoutSeconds = 300; // Default to 5 minutes\n }\n\n // Validate that we got a valid number\n if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {\n timeoutSeconds = 300; // Default to 5 minutes\n }\n\n // Find the \"No Response\" category (should exist now)\n const noResponseCategory = router.categories.find(\n (cat: any) => cat.name === 'No Response'\n );\n\n if (noResponseCategory) {\n waitConfig.timeout = {\n seconds: timeoutSeconds,\n category_uuid: noResponseCategory.uuid\n };\n }\n }\n\n router.wait = waitConfig;\n\n return {\n ...originalNode,\n router,\n exits: noRulesExits\n };\n }\n\n // Get existing router data for preservation\n const existingCategories = originalNode.router?.categories || [];\n const existingExits = originalNode.exits || [];\n const existingCases = originalNode.router?.cases || [];\n\n // Create router and exits using existing data when possible\n const { router, exits } = createWaitForResponseRouter(\n userRules,\n existingCategories,\n existingExits,\n existingCases\n );\n\n // Build final router with wait configuration and result_name\n const finalRouter: any = {\n ...router,\n result_name: formData.result_name || 'response'\n };\n\n // Build wait configuration based on form data\n const waitConfig: any = {\n type: 'msg'\n };\n\n try {\n // Handle timeout configuration\n if (formData.timeout_enabled) {\n // Extract timeout value (handle both string and object formats)\n let timeoutSeconds;\n\n if (formData.timeout_duration) {\n try {\n timeoutSeconds = parseInt(formData.timeout_duration[0].value, 10);\n } catch (e) {\n timeoutSeconds = 300; // Default to 5 minutes\n }\n }\n\n // Find or create the \"No Response\" category\n const existingNoResponseCategory =\n originalNode.router?.categories?.find(\n (cat: any) => cat.name === 'No Response'\n );\n\n const noResponseCategory = existingNoResponseCategory || {\n uuid: generateUUID(),\n name: 'No Response',\n exit_uuid: generateUUID()\n };\n\n waitConfig.timeout = {\n seconds: timeoutSeconds,\n category_uuid: noResponseCategory.uuid\n };\n\n // Ensure No Response category and exit exist\n if (\n !router.categories?.some((cat: any) => cat.name === 'No Response')\n ) {\n router.categories = router.categories || [];\n router.categories.push(noResponseCategory);\n\n // Add corresponding exit if it doesn't exist\n if (\n !exits.some(\n (exit: any) => exit.uuid === noResponseCategory.exit_uuid\n )\n ) {\n const noResponseExit = {\n uuid: noResponseCategory.exit_uuid,\n destination_uuid: existingNoResponseCategory?.exit_uuid\n ? originalNode.exits?.find(\n (exit) => exit.uuid === existingNoResponseCategory.exit_uuid\n )?.destination_uuid || null\n : null\n };\n exits.push(noResponseExit);\n }\n }\n } else {\n // Remove \"No Response\" category if timeout is disabled\n if (router.categories) {\n const noResponseCategoryIndex = router.categories.findIndex(\n (cat: any) => cat.name === 'No Response'\n );\n if (noResponseCategoryIndex !== -1) {\n const noResponseCategory =\n router.categories[noResponseCategoryIndex];\n\n // Remove the category\n router.categories.splice(noResponseCategoryIndex, 1);\n\n // Remove corresponding exit\n const exitIndex = exits.findIndex(\n (exit: any) => exit.uuid === noResponseCategory.exit_uuid\n );\n if (exitIndex !== -1) {\n exits.splice(exitIndex, 1);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error processing timeout configuration:', error);\n // Continue without timeout in case of error\n }\n\n finalRouter.wait = waitConfig;\n return {\n ...originalNode,\n router: finalRouter,\n exits: exits\n };\n }\n};\n"]}
|
|
@@ -12,6 +12,8 @@ let TembaArrayEditor = class TembaArrayEditor extends BaseListEditor {
|
|
|
12
12
|
this.itemLabel = 'Item';
|
|
13
13
|
this.sortable = false;
|
|
14
14
|
this.maintainEmptyItem = true; // Enable by default for better UX
|
|
15
|
+
// Focus preservation properties
|
|
16
|
+
this.focusInfo = null;
|
|
15
17
|
this._items = [];
|
|
16
18
|
}
|
|
17
19
|
// External API
|
|
@@ -44,6 +46,181 @@ let TembaArrayEditor = class TembaArrayEditor extends BaseListEditor {
|
|
|
44
46
|
values.some((value) => value !== undefined && value !== null && value !== ''));
|
|
45
47
|
});
|
|
46
48
|
}
|
|
49
|
+
// Capture focus information before update
|
|
50
|
+
captureFocus() {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
52
|
+
const activeElement = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement;
|
|
53
|
+
// Also try document.activeElement as a fallback
|
|
54
|
+
const globalActive = document.activeElement;
|
|
55
|
+
let targetElement = activeElement || globalActive;
|
|
56
|
+
// If active element is within this component's shadow root, use it
|
|
57
|
+
if (globalActive && ((_b = this.shadowRoot) === null || _b === void 0 ? void 0 : _b.contains(globalActive))) {
|
|
58
|
+
targetElement = globalActive;
|
|
59
|
+
}
|
|
60
|
+
if (!targetElement) {
|
|
61
|
+
this.focusInfo = null;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
// Find the array item container by traversing up the DOM
|
|
65
|
+
let currentElement = targetElement;
|
|
66
|
+
let arrayItemElement = null;
|
|
67
|
+
// Traverse up through shadow DOM boundaries
|
|
68
|
+
while (currentElement) {
|
|
69
|
+
if ((_c = currentElement.classList) === null || _c === void 0 ? void 0 : _c.contains('array-item')) {
|
|
70
|
+
arrayItemElement = currentElement;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
// Move up to parent, or cross shadow boundaries
|
|
74
|
+
if (currentElement.parentElement) {
|
|
75
|
+
currentElement = currentElement.parentElement;
|
|
76
|
+
}
|
|
77
|
+
else if (currentElement.parentNode &&
|
|
78
|
+
currentElement.parentNode.host) {
|
|
79
|
+
// Cross shadow boundary
|
|
80
|
+
currentElement = currentElement.parentNode.host;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!arrayItemElement) {
|
|
87
|
+
this.focusInfo = null;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
// Find the item index by looking at the item ID
|
|
91
|
+
const itemIdMatch = (_d = arrayItemElement.id) === null || _d === void 0 ? void 0 : _d.match(/array-item-(\d+)/);
|
|
92
|
+
if (!itemIdMatch) {
|
|
93
|
+
this.focusInfo = null;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const itemIndex = parseInt(itemIdMatch[1], 10);
|
|
97
|
+
// Determine the field name by examining the input element and its containers
|
|
98
|
+
let fieldName = '';
|
|
99
|
+
// First, check if it's a temba component with a name attribute
|
|
100
|
+
if ((_e = targetElement.tagName) === null || _e === void 0 ? void 0 : _e.toLowerCase().startsWith('temba-')) {
|
|
101
|
+
fieldName =
|
|
102
|
+
targetElement.name || targetElement.getAttribute('name') || '';
|
|
103
|
+
}
|
|
104
|
+
// If not found, check regular HTML elements
|
|
105
|
+
if (!fieldName &&
|
|
106
|
+
targetElement.hasAttribute &&
|
|
107
|
+
targetElement.hasAttribute('name')) {
|
|
108
|
+
fieldName = targetElement.getAttribute('name') || '';
|
|
109
|
+
}
|
|
110
|
+
// If still not found, look for data-field-name in parent containers
|
|
111
|
+
if (!fieldName) {
|
|
112
|
+
let searchElement = targetElement;
|
|
113
|
+
while (searchElement && searchElement !== arrayItemElement) {
|
|
114
|
+
if (searchElement.hasAttribute &&
|
|
115
|
+
searchElement.hasAttribute('data-field-name')) {
|
|
116
|
+
fieldName = searchElement.getAttribute('data-field-name') || '';
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
searchElement = searchElement.parentElement;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (!fieldName) {
|
|
123
|
+
this.focusInfo = null;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
// Capture selection for text inputs (try the actual input element inside temba components)
|
|
127
|
+
let inputForSelection = targetElement;
|
|
128
|
+
if ((_f = targetElement.tagName) === null || _f === void 0 ? void 0 : _f.toLowerCase().startsWith('temba-')) {
|
|
129
|
+
// Look for the actual input element inside the temba component
|
|
130
|
+
const innerInput = ((_g = targetElement.shadowRoot) === null || _g === void 0 ? void 0 : _g.querySelector('input, textarea')) ||
|
|
131
|
+
targetElement.querySelector('input, textarea');
|
|
132
|
+
if (innerInput) {
|
|
133
|
+
inputForSelection = innerInput;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const selectionStart = inputForSelection.selectionStart;
|
|
137
|
+
const selectionEnd = inputForSelection.selectionEnd;
|
|
138
|
+
this.focusInfo = {
|
|
139
|
+
itemIndex,
|
|
140
|
+
fieldName,
|
|
141
|
+
selectionStart,
|
|
142
|
+
selectionEnd
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
// Restore focus after update
|
|
146
|
+
restoreFocus() {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
if (!this.focusInfo) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const { itemIndex, fieldName, selectionStart, selectionEnd } = this.focusInfo;
|
|
152
|
+
// Find the target element by array item index
|
|
153
|
+
const arrayItemId = `array-item-${itemIndex}`;
|
|
154
|
+
const arrayItemElement = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(arrayItemId);
|
|
155
|
+
if (!arrayItemElement) {
|
|
156
|
+
// If the exact item doesn't exist (e.g., due to reordering), try to find by field name
|
|
157
|
+
const allItems = (_b = this.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelectorAll('.array-item');
|
|
158
|
+
if (allItems && allItems.length > itemIndex) {
|
|
159
|
+
const fallbackItem = allItems[itemIndex];
|
|
160
|
+
if (fallbackItem) {
|
|
161
|
+
this.attemptFocusRestore(fallbackItem, fieldName, selectionStart, selectionEnd);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
this.focusInfo = null;
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
this.attemptFocusRestore(arrayItemElement, fieldName, selectionStart, selectionEnd);
|
|
168
|
+
this.focusInfo = null;
|
|
169
|
+
}
|
|
170
|
+
attemptFocusRestore(container, fieldName, selectionStart, selectionEnd) {
|
|
171
|
+
// Look for the field container first
|
|
172
|
+
const fieldContainer = container.querySelector(`[data-field-name="${fieldName}"]`);
|
|
173
|
+
let targetElement = null;
|
|
174
|
+
if (fieldContainer) {
|
|
175
|
+
// Look for temba components or input elements within the field container
|
|
176
|
+
targetElement = fieldContainer.querySelector('temba-textinput, temba-completion, input, textarea');
|
|
177
|
+
}
|
|
178
|
+
// Fallback: search entire container
|
|
179
|
+
if (!targetElement) {
|
|
180
|
+
const selectors = [
|
|
181
|
+
`temba-textinput[name="${fieldName}"]`,
|
|
182
|
+
`temba-completion[name="${fieldName}"]`,
|
|
183
|
+
`input[name="${fieldName}"]`,
|
|
184
|
+
`textarea[name="${fieldName}"]`,
|
|
185
|
+
`[name="${fieldName}"]`
|
|
186
|
+
];
|
|
187
|
+
for (const selector of selectors) {
|
|
188
|
+
targetElement = container.querySelector(selector);
|
|
189
|
+
if (targetElement)
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (targetElement) {
|
|
194
|
+
// Use multiple animation frames to ensure DOM is fully settled
|
|
195
|
+
requestAnimationFrame(() => {
|
|
196
|
+
requestAnimationFrame(() => {
|
|
197
|
+
var _a, _b;
|
|
198
|
+
try {
|
|
199
|
+
targetElement.focus();
|
|
200
|
+
// Restore selection if it's a text input
|
|
201
|
+
if (selectionStart !== undefined && selectionEnd !== undefined) {
|
|
202
|
+
// For temba components, we need to focus the inner input
|
|
203
|
+
let inputForSelection = targetElement;
|
|
204
|
+
if ((_a = targetElement.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase().startsWith('temba-')) {
|
|
205
|
+
const innerInput = ((_b = targetElement.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('input, textarea')) ||
|
|
206
|
+
targetElement.querySelector('input, textarea');
|
|
207
|
+
if (innerInput && 'setSelectionRange' in innerInput) {
|
|
208
|
+
inputForSelection = innerInput;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if ('setSelectionRange' in inputForSelection) {
|
|
212
|
+
inputForSelection.setSelectionRange(selectionStart, selectionEnd);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
// Ignore focus errors - element might not be focusable
|
|
218
|
+
// Focus restoration failed, silently continue
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
47
224
|
createEmptyItem() {
|
|
48
225
|
return {};
|
|
49
226
|
}
|
|
@@ -61,6 +238,21 @@ let TembaArrayEditor = class TembaArrayEditor extends BaseListEditor {
|
|
|
61
238
|
}
|
|
62
239
|
this.updateValue(updatedItems);
|
|
63
240
|
}
|
|
241
|
+
// Override Lit's update lifecycle methods for focus preservation
|
|
242
|
+
willUpdate(changedProperties) {
|
|
243
|
+
super.willUpdate(changedProperties);
|
|
244
|
+
// Capture focus before update if items are changing
|
|
245
|
+
if (changedProperties.has('_items') || changedProperties.has('value')) {
|
|
246
|
+
this.captureFocus();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
updated(changedProperties) {
|
|
250
|
+
super.updated(changedProperties);
|
|
251
|
+
// Restore focus after update if items changed
|
|
252
|
+
if (changedProperties.has('_items') || changedProperties.has('value')) {
|
|
253
|
+
this.restoreFocus();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
64
256
|
handleOrderChanged(event) {
|
|
65
257
|
const detail = event.detail;
|
|
66
258
|
// Handle swap-based logic from SortableList
|
|
@@ -205,6 +397,7 @@ let TembaArrayEditor = class TembaArrayEditor extends BaseListEditor {
|
|
|
205
397
|
}
|
|
206
398
|
fieldElements.push(html `
|
|
207
399
|
<div
|
|
400
|
+
data-field-name="${fieldName}"
|
|
208
401
|
style="${config.width || config.maxWidth || config.type === 'select'
|
|
209
402
|
? 'flex:none'
|
|
210
403
|
: 'flex:1'}"
|
|
@@ -217,10 +410,10 @@ let TembaArrayEditor = class TembaArrayEditor extends BaseListEditor {
|
|
|
217
410
|
// If no value fields are visible, add a spacer to maintain alignment
|
|
218
411
|
if (!hasVisibleValueField) {
|
|
219
412
|
// Insert spacer after operator (first field) and before category (last field)
|
|
220
|
-
fieldElements.splice(-1, 0, html `<div class="field field-flex spacer"></div>`);
|
|
413
|
+
fieldElements.splice(-1, 0, html `<div class="field field-flex spacer" style="flex-grow:1"></div>`);
|
|
221
414
|
}
|
|
222
415
|
return html `
|
|
223
|
-
<div class="array-item">
|
|
416
|
+
<div class="array-item" id="array-item-${index}">
|
|
224
417
|
<div
|
|
225
418
|
class="item-fields ${canRemove ? '' : 'removable'}"
|
|
226
419
|
style="display: flex; gap: 12px; align-items: center"
|