title: Creating an embeddable javascript widget
body: <p>I'm trying to figure out the best way to create a javascript widget that:
  - Can be embedded in most websites
  - It's self contained (initially only 
  - Can be configured</p>
  
  <p>An example of desired functionality would be Stripe's checkout widget: <a href="https://stripe.com/docs/checkout#integration-simple" rel="noreferrer">link</a></p>
  
  <p>I'm not getting very lucky in finding resources, tutorial or best practices. From what I've seen so far the most common flow is:</p>
  
  <ol>
  <li><strong>Initial</strong> self executed script is inserted in website</li>
  <li>The script reads the passed configuration and merges it with the default</li>
  <li>Html element that triggers the behaviour (e.g. button), and bound to a handler</li>
  <li>An iFrame is created passing the configuration and most of the logic happens</li>
  </ol>
  
  <p>My current doubts are:</p>
  
  <ol>
  <li>Is there a recommended Webpack (or similar) template to create the initial script from ES6 project?</li>
  <li>Communication (both ways) between website and iframe</li>
  <li>Security concerns</li>
  </ol>
  
  <p>Any input is welcome!</p>