%s

', esc_html($error)); } } delete_transient('afromewo_errors'); $this->render_waba_notice(); } protected function render_waba_notice() { if (! Request::has_get('afromewo_notice')) { return; } $notice = Request::get('afromewo_notice', ''); if (isset($this->error_messages()[$notice])) { printf('

%s

', esc_html($this->error_messages()[$notice])); } else if (isset($this->success_messages()[$notice])) { printf('

%s

', esc_html($this->success_messages()[$notice])); } else { printf('

%s

', esc_html($notice)); } delete_transient('afromewo_notice'); } protected function error_messages() { return [ 'no_business_selected' => __( 'No WhatsApp Business Account was selected.', 'afroit-messaging-workflows' ), 'no_business' => __( 'No WhatsApp Business Account selected. Go to Settings to configure.', 'afroit-messaging-workflows' ), 'invalid_business' => __( 'The selected business is invalid.', 'afroit-messaging-workflows' ), 'no_user_access_token' => __( 'No user access token was found.', 'afroit-messaging-workflows' ), 'failed_to_ensure_system_user_and_token' => __( 'Failed to create system user and token.', 'afroit-messaging-workflows' ), 'authentication_failed' => __( 'Authentication failed. Please try again.', 'afroit-messaging-workflows' ), 'token_exchange_failed' => __( 'Token exchange failed. Please try again.', 'afroit-messaging-workflows' ), 'missing_app_credentials' => __( 'Missing app credentials. Please set your app credentials.', 'afroit-messaging-workflows' ), 'template_delete_missing_id' => __( 'Template ID is missing.', 'afroit-messaging-workflows' ), 'template_delete_failed' => __( 'Failed to delete template. Please try again.', 'afroit-messaging-workflows' ), 'automation_delete_missing_id' => __( 'Workflow ID is missing.', 'afroit-messaging-workflows' ), 'automation_delete_failed' => __( 'Failed to delete automation. Please try again.', 'afroit-messaging-workflows' ), 'automation_toggle_missing_id' => __( 'Workflow ID is missing.', 'afroit-messaging-workflows' ), 'automation_not_found' => __( 'Workflow not found. You can create a new workflow or try again later.', 'afroit-messaging-workflows' ), 'automation_toggle_failed' => __( 'Failed to toggle automation. Please try again.', 'afroit-messaging-workflows' ), 'queue_delete_missing_id' => __( 'Queue item ID is missing.', 'afroit-messaging-workflows' ), 'queue_item_delete_failed' => __( 'Failed to delete queue item. Please try again.', 'afroit-messaging-workflows' ), ]; } protected function success_messages() { return [ 'workflow_created' => __( 'Workflow modified successfully.', 'afroit-messaging-workflows' ), 'business_selected' => __( 'Business selected successfully.', 'afroit-messaging-workflows' ), 'template_deleted' => __( 'Template deleted successfully.', 'afroit-messaging-workflows' ), 'automation_deleted' => __( 'Automation deleted successfully.', 'afroit-messaging-workflows' ), 'automation_activated' => __( 'Automation activated.', 'afroit-messaging-workflows' ), 'automation_deactivated' => __( 'Automation deactivated.', 'afroit-messaging-workflows' ), 'queue_item_deleted' => __( 'Queue item deleted successfully.', 'afroit-messaging-workflows' ), ]; } }