diff --git a/app/javascript/dashboard/components-next/NewConversation/components/WhatsappTemplateParser.vue b/app/javascript/dashboard/components-next/NewConversation/components/WhatsappTemplateParser.vue index 12cfbf39f..9e747023d 100644 --- a/app/javascript/dashboard/components-next/NewConversation/components/WhatsappTemplateParser.vue +++ b/app/javascript/dashboard/components-next/NewConversation/components/WhatsappTemplateParser.vue @@ -54,15 +54,17 @@ const buttonComponents = computed(() => { }); const interactiveComponents = computed(() => { - return templateComponents.value.filter( - component => ['LIST', 'PRODUCT', 'CATALOG'].includes(component.type) + return templateComponents.value.filter(component => + ['LIST', 'PRODUCT', 'CATALOG'].includes(component.type) ); }); const isInteractiveTemplate = computed(() => { const hasInteractiveButtons = buttonComponents.value.some(component => component.buttons?.some(button => - ['quick_reply', 'url', 'phone_number', 'catalog_browse'].includes(button.type) + ['quick_reply', 'url', 'phone_number', 'catalog_browse'].includes( + button.type + ) ) ); return hasInteractiveButtons || interactiveComponents.value.length > 0; @@ -105,13 +107,16 @@ const processedStringWithVariableHighlight = computed(() => { const rules = computed(() => { const paramRules = {}; Object.keys(processedParams.value).forEach(key => { - if (key === 'header' && processedParams.value.header.location_type === 'location') { + if ( + key === 'header' && + processedParams.value.header.location_type === 'location' + ) { // Add specific validation for location parameters paramRules[key] = { location: { latitude: { required: requiredIf(true) }, - longitude: { required: requiredIf(true) } - } + longitude: { required: requiredIf(true) }, + }, }; } else { paramRules[key] = { required: requiredIf(true) }; @@ -131,10 +136,6 @@ const getFieldErrorType = key => { const generateVariables = () => { const allVariables = {}; - - // Debug: Log template structure - console.log('Template components:', templateComponents.value); - console.log('Header component:', headerComponent.value); // Process body variables const bodyVars = templateString.value.match(/{{([^}]+)}}/g) || []; @@ -191,7 +192,6 @@ const generateVariables = () => { headerComponent.value.format === 'LOCATION' ) { // Location headers need location data - console.log('Detected LOCATION header template:', headerComponent.value); allVariables.header = { location: { latitude: '', @@ -262,19 +262,19 @@ const generateVariables = () => { allVariables.interactive = { type: 'list', button_text: 'Select Option', - sections: component.sections || [] + sections: component.sections || [], }; } else if (component.type === 'PRODUCT') { allVariables.interactive = { type: 'product', catalog_id: component.catalog_id || '', - product_id: component.product_id || '' + product_id: component.product_id || '', }; } else if (component.type === 'CATALOG') { allVariables.interactive = { type: 'catalog', catalog_id: component.catalog_id || '', - title: component.title || 'Browse Products' + title: component.title || 'Browse Products', }; } }); @@ -450,7 +450,7 @@ onMounted(() => {