Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: lib/src/ga-api-utils/build/ga-api-utils.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.expo rts=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"u ndefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined "!=typeof self&&(f=self),f.gaApiUtils=e()}}(function(){var define,module,exports ;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof requi re=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Er ror("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={ exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)} ,l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&requ ire;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exp orts){function AccountSummaries(accounts){this.accounts_=accounts;this.webProper ties_=[];this.profiles_=[];this.accountsById_={};this.webPropertiesById_=this.pr opertiesById_={};this.profilesById_=this.viewsById_={};for(var i=0,account;accou nt=this.accounts_[i];i++){this.accountsById_[account.id]={self:account};if(!acco unt.webProperties)continue;alias(account,"webProperties","properties");for(var j =0,webProperty;webProperty=account.webProperties[j];j++){this.webProperties_.pus h(webProperty);this.webPropertiesById_[webProperty.id]={self:webProperty,parent: account};if(!webProperty.profiles)continue;alias(webProperty,"profiles","views") ;for(var k=0,profile;profile=webProperty.profiles[k];k++){this.profiles_.push(pr ofile);this.profilesById_[profile.id]={self:profile,parent:webProperty,grandPare nt:account}}}}}AccountSummaries.prototype.all=function(){return this.accounts_}; alias(AccountSummaries.prototype,"all","allAccounts");AccountSummaries.prototype .allWebProperties=function(){return this.webProperties_};alias(AccountSummaries. prototype,"allWebProperties","allProperties");AccountSummaries.prototype.allProf iles=function(){return this.profiles_};alias(AccountSummaries.prototype,"allProf iles","allViews");AccountSummaries.prototype.get=function(obj){if(!!obj.accountI d+!!obj.webPropertyId+!!obj.propertyId+!!obj.profileId+!!obj.viewId>1){throw new Error("get() only accepts an object with a single "+'property: either "accountI d", "webPropertyId", "propertyId", '+'"profileId" or "viewId"')}return this.getP rofile(obj.profileId||obj.viewId)||this.getWebProperty(obj.webPropertyId||obj.pr opertyId)||this.getAccount(obj.accountId)};AccountSummaries.prototype.getAccount =function(accountId){return this.accountsById_[accountId]&&this.accountsById_[ac countId].self};AccountSummaries.prototype.getWebProperty=function(webPropertyId) {return this.webPropertiesById_[webPropertyId]&&this.webPropertiesById_[webPrope rtyId].self};alias(AccountSummaries.prototype,"getWebProperty","getProperty");Ac countSummaries.prototype.getProfile=function(profileId){return this.profilesById _[profileId]&&this.profilesById_[profileId].self};alias(AccountSummaries.prototy pe,"getProfile","getView");AccountSummaries.prototype.getAccountByProfileId=func tion(profileId){return this.profilesById_[profileId]&&this.profilesById_[profile Id].grandParent};alias(AccountSummaries.prototype,"getAccountByProfileId","getAc countByViewId");AccountSummaries.prototype.getWebPropertyByProfileId=function(pr ofileId){return this.profilesById_[profileId]&&this.profilesById_[profileId].par ent};alias(AccountSummaries.prototype,"getWebPropertyByProfileId","getPropertyBy ViewId");AccountSummaries.prototype.getAccountByWebPropertyId=function(webProper tyId){return this.webPropertiesById_[webPropertyId]&&this.webPropertiesById_[web PropertyId].parent};alias(AccountSummaries.prototype,"getAccountByWebPropertyId" ,"getAccountByPropertyId");function alias(object,referenceProp,aliasName){if(Obj ect.defineProperty){Object.defineProperty(object,aliasName,{get:function(){retur n object[referenceProp]}})}else{object[aliasName]=object[referenceProp]}}module. exports=AccountSummaries},{}],2:[function(require,module,exports){var AccountSum maries=require("./account-summaries");var cache;function requestAccountSummaries (){var promise=gapi.client.analytics.management.accountSummaries.list().then(fun ction(resp){return resp});return new promise.constructor(function(resolve,reject ){var summaries=[];promise.then(function fn(resp){var result=resp.result;if(resu lt.items){summaries=summaries.concat(result.items)}else{reject(new Error("You do not have any Google Analytics accounts. "+"Go to http://google.com/analytics to sign up."))}if(result.startIndex+result.itemsPerPage<=result.totalResults){gapi .client.analytics.management.accountSummaries.list({"start-index":result.startIn dex+result.itemsPerPage}).then(fn)}else{resolve(new AccountSummaries(summaries)) }}).then(null,reject)})}module.exports={get:function(noCache){if(noCache)cache=n ull;return cache||(cache=requestAccountSummaries())}}},{"./account-summaries":1} ],3:[function(require,module,exports){var Metadata=require("./metadata");var cac he;function requestMetadata(){var promise=gapi.client.analytics.metadata.columns .list({reportType:"ga"}).then(function(resp){return resp});return new promise.co nstructor(function(resolve,reject){promise.then(function(resp){resolve(new Metad ata(resp.result.items))}).then(null,reject)})}module.exports={get:function(noCac he){if(noCache)cache=null;return cache||(cache=requestMetadata())}}},{"./metadat a":4}],4:[function(require,module,exports){function Metadata(columns){this._colu mns=columns;this._metrics=[];this._dimensions=[];this._ids={};this._columns.forE ach(function(column){this._ids[column.id]=column.attributes;if(column.attributes .type=="METRIC"){this._metrics.push(column)}else if(column.attributes.type=="DIM ENSION"){this._dimensions.push(column)}}.bind(this))}Metadata.prototype.all=func tion(status){return!status?this._columns:this._columns.filter(function(column){r eturn column.attributes.status.toLowerCase()===status.toLowerCase()})};Metadata. prototype.allMetrics=function(status){return!status?this._metrics:this._metrics. filter(function(metric){return metric.attributes.status.toLowerCase()===status.t oLowerCase()})};Metadata.prototype.allDimensions=function(status){return!status? this._dimensions:this._dimensions.filter(function(dimension){return dimension.at tributes.status.toLowerCase()===status.toLowerCase()})};Metadata.prototype.get=f unction(id){return this._ids[id]};module.exports=Metadata},{}],5:[function(requi re,module,exports){module.exports={accountSummaries:require("./account-summaries "),metadata:require("./metadata")}},{"./account-summaries":2,"./metadata":3}]},{ },[5])(5)});
OLDNEW
« no previous file with comments | « lib/src/firebase/firebase-debug.js ('k') | lib/src/google-analytics/google-analytics-query.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698