{"version":3,"sources":["webpack:///view-selector2.js","webpack:///webpack/bootstrap 0853746ae09c5b7c1eb6?7fc4*","webpack:///./src/javascript/embed-api/components/view-selector2.js","webpack:///./~/javascript-api-utils/lib/account-summaries/index.js","webpack:///./~/javascript-api-utils/lib/account-summaries/account-summaries.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","_javascriptApiUtilsLibAccountSummaries","_javascriptApiUtilsLibAccountSummaries2","gapi","analytics","ready","updateSelect","select","options","innerHTML","map","option","selected","name","join","getIdProp","opts","ids","viewId","prop","value","replace","propertyId","accountId","createComponent","execute","this","setup_","updateAccounts_","changed_","render_","onChange_","bind","set","Error","container","prevOpts","get","Component","prototype","cb","onAuthorize","then","summaries","self","accounts","all","err","emit","auth","isAuthorized","on","view","account","property","getProfile","getAccountByProfileId","getWebPropertyByProfileId","getWebProperty","getAccountByWebPropertyId","views","getAccount","properties","slice","document","getElementById","template","selects","querySelectorAll","onchange","onUserSelect_","props","data","requestAccountSummaries","promise","client","request","path","API_PATH","resp","constructor","resolve","reject","fn","result","items","concat","startIndex","itemsPerPage","totalResults","params","start-index","AccountSummaries","cache","noCache","accounts_","webProperties_","profiles_","accountsById_","webPropertiesById_","propertiesById_","profilesById_","viewsById_","i","webProperties","alias","webProperty","j","push","parent","profiles","profile","k","grandParent","object","referenceProp","aliasName","Object","defineProperty","allWebProperties","allProfiles","webPropertyId","profileId"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAE,WACAE,GAAAJ,EACAK,QAAA,EAUA,OANAP,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,QAAA,EAGAF,EAAAD,QAvBA,GAAAD,KAqCA,OATAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU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WAAAzD,EAAA4H,WAAA5H,EAAAoB,SACAQ,KAAAgC,eAAA5D,EAAA2H,eAAA3H,EAAAwB,aACAI,KAAAmC,WAAA/D,EAAAyB,YASAqE,EAAArD,UAAAsB,WAAA,SAAAtC,GACA,MAAAG,MAAAwE,cAAA3E,IACAG,KAAAwE,cAAA3E,GAAAqB,MASAgD,EAAArD,UAAAmB,eAAA,SAAA+D,GACA,MAAA/F,MAAAyE,mBAAAsB,IACA/F,KAAAyE,mBAAAsB,GAAA7E,MAGA6D,EAAAb,EAAArD,UAAA,iBACA,eAQAqD,EAAArD,UAAAgB,WAAA,SAAAmE,GACA,MAAAhG,MAAA2E,cAAAqB,IACAhG,KAAA2E,cAAAqB,GAAA9E,MAGA6D,EAAAb,EAAArD,UAAA,aACA,WAQAqD,EAAArD,UAAAiB,sBAAA,SAAAkE,GACA,MAAAhG,MAAA2E,cAAAqB,IACAhG,KAAA2E,cAAAqB,GAAAT,aAIAR,EAAAb,EAAArD,UAAA,wBACA,sBASAqD,EAAArD,UAAAkB,0BAAA,SAAAiE,GACA,MAAAhG,MAAA2E,cAAAqB,IACAhG,KAAA2E,cAAAqB,GAAAb,QAGAJ,EAAAb,EAAArD,UAAA,4BACA,uBAQAqD,EAAArD,UAAAoB,0BAAA,SAAA8D,GACA,MAAA/F,MAAAyE,mBAAAsB,IACA/F,KAAAyE,mBAAAsB,GAAAZ,QAGAJ,EAAAb,EAAArD,UAAA,4BACA,0BAwBAjD,EAAAD,QAAAuG","file":"view-selector2.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t// Copyright 2014 Google Inc. All rights reserved.\n\t//\n\t// Licensed under the Apache License, Version 2.0 (the \"License\");\n\t// you may not use this file except in compliance with the License.\n\t// You may obtain a copy of the License at\n\t//\n\t// http://www.apache.org/licenses/LICENSE-2.0\n\t//\n\t// Unless required by applicable law or agreed to in writing, software\n\t// distributed under the License is distributed on an \"AS IS\" BASIS,\n\t// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\t// See the License for the specific language governing permissions and\n\t// limitations under the License.\n\t\n\t/* global gapi */\n\t\n\t'use strict';\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _javascriptApiUtilsLibAccountSummaries = __webpack_require__(1);\n\t\n\tvar _javascriptApiUtilsLibAccountSummaries2 = _interopRequireDefault(_javascriptApiUtilsLibAccountSummaries);\n\t\n\t/**\n\t * A ViewSelector2 component for the Embed API.\n\t */\n\tgapi.analytics.ready(function () {\n\t\n\t gapi.analytics.createComponent('ViewSelector2', {\n\t\n\t /**\n\t * Render the view selector instance on the page or update an existing\n\t * instance if any options have changed.\n\t * @return {ViewSelector2} The instance.\n\t */\n\t execute: function execute() {\n\t this.setup_((function () {\n\t this.updateAccounts_();\n\t if (this.changed_) {\n\t this.render_();\n\t this.onChange_();\n\t }\n\t }).bind(this));\n\t\n\t return this;\n\t },\n\t\n\t /**\n\t * Extend the base `set` function with some error checking and handling of\n\t * ID data.\n\t * @extends gapi.analytics.Component.prototype.set\n\t * @param {Object} opts The options to set.\n\t * @return {ViewSelector2}\n\t */\n\t set: function set(opts) {\n\t\n\t if (!!opts.ids + !!opts.viewId + !!opts.propertyId + !!opts.accountId > 1) {\n\t\n\t throw new Error('You cannot specify more than one of the following ' + 'options: \"ids\", \"viewId\", \"accountId\", \"propertyId\"');\n\t }\n\t\n\t if (opts.container && this.container) {\n\t throw new Error('You cannot change containers once a view selector ' + 'has been rendered on the page.');\n\t }\n\t\n\t var prevOpts = this.get();\n\t\n\t if (prevOpts.ids != opts.ids || prevOpts.viewId != opts.viewId || prevOpts.propertyId != opts.propertyId || prevOpts.accountId != opts.accountId) {\n\t\n\t // If new ID data is being set, first unset all existing ID data.\n\t // This prevents the problem where you set an account ID then set a\n\t // view ID for a new view in a different account. Both IDs should not\n\t // persist or there will be problems.\n\t prevOpts.ids = null;\n\t prevOpts.viewId = null;\n\t prevOpts.propertyId = null;\n\t prevOpts.accountId = null;\n\t }\n\t\n\t // Call super.\n\t return gapi.analytics.Component.prototype.set.call(this, opts);\n\t },\n\t\n\t /**\n\t * Set up the view selector instance with values from the Management API's\n\t * accountSummaries.list method via the `accountSummaries` module.\n\t * If the user has not authorized, wait until that happens before\n\t * requesting the account summaries.\n\t * @param {Function} cb A function to be invoked once authorization has\n\t * succeeded and the accountSummaries have been retrieved.\n\t */\n\t setup_: function setup_(cb) {\n\t var self = this;\n\t\n\t function onAuthorize() {\n\t _javascriptApiUtilsLibAccountSummaries2['default'].get().then(function (summaries) {\n\t self.summaries = summaries;\n\t self.accounts = self.summaries.all();\n\t cb();\n\t }, function (err) {\n\t self.emit('error', err);\n\t });\n\t }\n\t\n\t if (gapi.analytics.auth.isAuthorized()) {\n\t onAuthorize();\n\t } else {\n\t gapi.analytics.auth.on('success', onAuthorize);\n\t }\n\t },\n\t\n\t /**\n\t * Update the view selector instance properties with new account\n\t * information.\n\t * @throws {Error} If the user has set an ID value for an account they\n\t * don't have access to.\n\t */\n\t updateAccounts_: function updateAccounts_() {\n\t\n\t var opts = this.get();\n\t var ids = getIdProp(opts);\n\t var view, account, property;\n\t\n\t // If there are no id props, set the defaults.\n\t if (!ids) {\n\t account = this.accounts[0];\n\t property = account && account.properties && account.properties[0];\n\t view = property && property.views && property.views[0];\n\t } else {\n\t switch (ids.prop) {\n\t case 'viewId':\n\t view = this.summaries.getProfile(ids.value);\n\t account = this.summaries.getAccountByProfileId(ids.value);\n\t property = this.summaries.getWebPropertyByProfileId(ids.value);\n\t break;\n\t case 'propertyId':\n\t property = this.summaries.getWebProperty(ids.value);\n\t account = this.summaries.getAccountByWebPropertyId(ids.value);\n\t view = property && property.views && property.views[0];\n\t break;\n\t case 'accountId':\n\t account = this.summaries.getAccount(ids.value);\n\t property = account && account.properties && account.properties[0];\n\t view = property && property.views && property.views[0];\n\t break;\n\t }\n\t }\n\t\n\t if (account || property || view) {\n\t\n\t // Only update if something has changed.\n\t if (account != this.account || property != this.property || view != this.view) {\n\t\n\t // Store what value changed.\n\t this.changed_ = {\n\t account: account && account != this.account,\n\t property: property && property != this.property,\n\t view: view && view != this.view\n\t };\n\t\n\t this.account = account;\n\t this.properties = account.properties;\n\t this.property = property;\n\t this.views = property && property.views;\n\t this.view = view;\n\t this.ids = view && 'ga:' + view.id;\n\t }\n\t } else {\n\t this.emit('error', new Error('You do not have access to ' + ids.prop.slice(0, -2) + ' : ' + ids.value));\n\t }\n\t },\n\t\n\t /**\n\t * Render the view selector based on the users accounts and the\n\t * pre-defined template. Also add event handlers to watch for\n\t * changes.\n\t */\n\t render_: function render_() {\n\t\n\t var opts = this.get();\n\t\n\t this.container = typeof opts.container == 'string' ? document.getElementById(opts.container) : opts.container;\n\t\n\t this.container.innerHTML = opts.template || this.template;\n\t var selects = this.container.querySelectorAll('select');\n\t\n\t var accounts = this.accounts;\n\t var properties = this.properties || [{ name: '(Empty)', id: '' }];\n\t var views = this.views || [{ name: '(Empty)', id: '' }];\n\t\n\t updateSelect(selects[0], accounts, this.account.id);\n\t updateSelect(selects[1], properties, this.property && this.property.id);\n\t updateSelect(selects[2], views, this.view && this.view.id);\n\t\n\t selects[0].onchange = this.onUserSelect_.bind(this, selects[0], 'accountId');\n\t selects[1].onchange = this.onUserSelect_.bind(this, selects[1], 'propertyId');\n\t selects[2].onchange = this.onUserSelect_.bind(this, selects[2], 'viewId');\n\t },\n\t\n\t /**\n\t * A callback that is invoked from the `execute` method whenever the ID\n\t * data has changed. Most of the time this change happens when the user\n\t * has selected a new view in the UI, but it can also happen\n\t * programmatically via the `set` method.\n\t */\n\t onChange_: function onChange_() {\n\t\n\t var props = {\n\t account: this.account,\n\t property: this.property,\n\t view: this.view,\n\t ids: this.view && 'ga:' + this.view.id\n\t };\n\t\n\t if (this.changed_) {\n\t if (this.changed_.account) this.emit('accountChange', props);\n\t if (this.changed_.property) this.emit('propertyChange', props);\n\t if (this.changed_.view) {\n\t this.emit('viewChange', props);\n\t this.emit('idsChange', props);\n\t\n\t // For backwards compatibility with the original ViewSelector.\n\t this.emit('change', props.ids);\n\t }\n\t }\n\t\n\t this.changed_ = null;\n\t },\n\t\n\t /**\n\t * The handler assigned to the `onchange` method of each of the select\n\t * elements. The context is bound to the view selector instance and it is\n\t * invoked with the element and property as its arguments.\n\t * @param {HTMLSelectElement} select The select element.\n\t * @param {string} property The property key to be set on the instance.\n\t */\n\t onUserSelect_: function onUserSelect_(select, property) {\n\t var data = {};\n\t data[property] = select.value;\n\t\n\t this.set(data);\n\t this.execute();\n\t },\n\t\n\t /**\n\t * The html structure used to build the component. Developers can override\n\t * this by passing it to the component constructor. The only requirement\n\t * is that the structure contain three selects. The first will be the\n\t * account select, the second will be the property select, and the third\n\t * will be the view select. Order is important.\n\t */\n\t template: '