mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	- Discard conflicting keys - Do not merge if there is already an identified contact Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
		
			
				
	
	
		
			10 lines
		
	
	
		
			366 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			10 lines
		
	
	
		
			366 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
module WidgetHelper
 | 
						|
  def build_contact_inbox_with_token(web_widget, additional_attributes = {})
 | 
						|
    contact_inbox = web_widget.create_contact_inbox(additional_attributes)
 | 
						|
    payload = { source_id: contact_inbox.source_id, inbox_id: web_widget.inbox.id }
 | 
						|
    token = ::Widget::TokenService.new(payload: payload).generate_token
 | 
						|
 | 
						|
    [contact_inbox, token]
 | 
						|
  end
 | 
						|
end
 |