diff --git a/.codeclimate.yml b/.codeclimate.yml index ab41af6b0..b715d26ec 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -25,11 +25,15 @@ checks: config: threshold: 300 method-lines: + enabled: true config: threshold: 50 exclude_paths: - 'app/javascript/dashboard/composables/' cognitive-complexity: + enabled: true + config: + threshold: 5 exclude_paths: - 'app/javascript/dashboard/composables/' exclude_patterns: diff --git a/app/javascript/dashboard/composables/useWhatsappEmbeddedSignup.js b/app/javascript/dashboard/composables/useWhatsappEmbeddedSignup.js index 6adab5bf6..98a35a505 100644 --- a/app/javascript/dashboard/composables/useWhatsappEmbeddedSignup.js +++ b/app/javascript/dashboard/composables/useWhatsappEmbeddedSignup.js @@ -171,6 +171,14 @@ export function useWhatsappEmbeddedSignup() { } }; + const isValidBusinessData = businessDataLocal => { + return ( + businessDataLocal && + (businessDataLocal.business_id || businessDataLocal.businessId) && + (businessDataLocal.waba_id || businessDataLocal.wabaId) + ); + }; + // Message handling const handleEmbeddedSignupData = async data => { // Handle different embedded signup events per Facebook documentation @@ -184,11 +192,7 @@ export function useWhatsappEmbeddedSignup() { } // Validate we have the required business information - if ( - businessDataLocal && - (businessDataLocal.business_id || businessDataLocal.businessId) && - (businessDataLocal.waba_id || businessDataLocal.wabaId) - ) { + if (isValidBusinessData(businessDataLocal)) { // Normalize the data structure to match our backend expectations const normalizedData = { business_id: