<commit_before><link rel="import" href="../polymer/polymer.html">
<link rel="import" href="auth0.html">

<dom-module id="auth0-link-account">

  <template>
  </template>

  <script>
    Polymer({

      is: 'auth0-link-account',

      properties: {
        connection: {
          type: String,
          notify: true
        },
        clientId: {
          type: String
        },
        domain: {
          type: String
        },
        options: {
          type: Object
        }
      },

      observers: [
        '_initAccountLinking(connection)'
      ],

      _initAccountLinking: function(connection) {
        if(!connection) return;
        localStorage.setItem('auth0:link-account', connection);

        var webAuth = new auth0.WebAuth({
          domain: this.domain,
          clientID: this.clientId
        });

        webAuth.authorize({
          scope: this.options.auth.scope,
          connection: connection,
          responseType: this.options.auth.responseType,
          redirectUri: this.options.auth.redirectUri
        });
      }
    });

  </script>
</dom-module><commit_msg>refact(auth0-link-account): Flatten options as auth0.js library doesn't depend on a nested hierarchy.<commit_after><link rel="import" href="../polymer/polymer.html">
<link rel="import" href="auth0.html">

<dom-module id="auth0-link-account">

  <template>
  </template>

  <script>
    Polymer({

      is: 'auth0-link-account',

      properties: {
        connection: {
          type: String,
          notify: true
        },
        clientId: {
          type: String
        },
        domain: {
          type: String
        },
        options: {
          type: Object
        }
      },

      observers: [
        '_initAccountLinking(connection)'
      ],

      _initAccountLinking: function(connection) {
        if(!connection) return;
        localStorage.setItem('auth0:link-account', connection);

        var webAuth = new auth0.WebAuth({
          domain: this.domain,
          clientID: this.clientId
        });

        var options = Object.assign({}, this.options, {connection: this.connection});

        webAuth.authorize(options);
      }
    });

  </script>
</dom-module>
{'fraction_non_alphanumeric': 0.13086642599277978, 'fraction_numerical': 0.005415162454873646, 'mean_word_length': 1.8754863813229572, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '885266', 'n_tokens_mistral': 648, 'n_tokens_neox': 625, 'n_words': 120}