cartodb/lib/assets/javascripts/dashboard/components/vendor-scripts/vendor-scripts-view.js
2020-06-15 10:58:47 +08:00

43 lines
1.6 KiB
JavaScript

const CoreView = require('backbone/core-view');
const template = require('./vendor-scripts.tpl');
const checkAndBuildOpts = require('builder/helpers/required-opts');
const REQUIRED_OPTS = [
'configModel',
'userModel',
'assetsVersion'
];
module.exports = CoreView.extend({
initialize: function (options) {
checkAndBuildOpts(options, REQUIRED_OPTS, this);
},
render: function () {
this.$el.html(
template({
assetsVersion: this._assetsVersion,
googleTagManagerId: this._configModel.get('google_tag_manager_id'),
hubspotIds: this._configModel.get('hubspot_ids'),
hubspotToken: this._configModel.get('hubspot_token'),
intercomAppId: this._configModel.get('intercom_app_id'),
intercomEnabled: !!this._userModel.featureEnabled('intercom'),
trackjsAppKey: this._configModel.get('trackjs_app_key'),
trackjsCustomer: this._configModel.get('trackjs_customer'),
trackjsEnabled: !!this._configModel.get('trackjs_enabled'),
fullstoryEnabled: !!this._configModel.get('fullstory_enabled'),
fullstoryOrg: this._configModel.get('fullstoryOrg'),
userEmail: this._userModel.get('email'),
userName: this._userModel.get('username'),
userId: this._userModel.get('id'),
userAccountType: this._userModel.get('account_type'),
userCreatedAtInSeconds: Date.parse(this._userModel.get('created_at')) / 1000,
userJobRole: this._userModel.get('job_role'),
userInTrialPeriod: this._userModel.get('show_trial_reminder')
})
);
return this;
}
});