

<% @encrypted_data %>

<% content_for :head do %>
  
  <meta content='True' name='HandheldFriendly'>
  <meta content='320' name='MobileOptimized'>
  <meta content='width=device-width, initial-scale=1' name='viewport'>
  <meta content='width=device-width, initial-scale=1' media='(device-height: 568px)' name='viewport'>
  <meta content='yes' name='mobile-web-app-capable'>
  <meta content='VADB' name='apple-mobile-web-app-title'>
  <meta content='yes' name='apple-mobile-web-app-capable'>
  <meta content='black' name='apple-mobile-web-app-status-bar-style'>
  <meta content='telephone=no' name='format-detection'>
<% end %>


<% content_for :body do %>
  <%= render "simple" %>

  <script>
    (function(d,t) {
      var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
      g.src=`${window.location.origin}/embed.js`
      s.parentNode.insertBefore(g,s);
      g.onload=function(){
        window.chaskiqMessenger = new window.ChaskiqMessengerEncrypted({
          domain: window.location.origin,
          ws:  '<%= Rails.application.config.action_cable.url %>',
          data: <%= raw @encrypted_data %>,
          lang: "<%= @lang %>",
          app_id: "<%= @app.key %>"
        })
      }
    })(document,"script");
  </script>

<% end %>

<%
=begin %>
<script type="text/javascript">
  var m = new window.Hermessenger({
    domain: "<%=Rails.application.routes.default_url_options[:host]%>",
    ws: "<%=Rails.application.config.action_cable.url%>",
    app_id: "<%= App.first.key %>",
    name: "miguel",
    email: "miguel@preyhq.com",
    properties: {
                  id: "localhost",
                  country: "chile"
                }
  })
  m.render()
</script>
<%
=end %>



