Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- function _classCallCheck(e, t) {
- if(!(e instanceof t)) {
- throw new TypeError('Cannot call a class as a function')
- }
- }
- var _createClass = function () {
- function e(e, t) {
- for(var i = 0; i < t['length']; i++) {
- var o = t[i];
- o['enumerable'] = o['enumerable'] || !1, o['configurable'] = !0, 'value' in o && (o['writable'] = !0), Object['defineProperty'](e, o['key'], o)
- }
- }
- return function (t, i, o) {
- return i && e(t['prototype'], i), o && e(t, o), t
- }
- }(),
- _ = require('underscore'),
- path = require('path'),
- _require = require('electron'),
- ipcRenderer = _require['ipcRenderer'],
- FranzIntegration = function () {
- function e(t, i) {
- if(_classCallCheck(this, e), this['options'] = t || {}, this['model'] = i, this['packageJSON'] = {}, void(0) === this['options']['path']) {
- throw console['error']('No plugin path specified')
- };
- try {
- if(this['packageJSON'] = require(path['join'](this['options']['path'], 'package.json')), !this['packageJSON']['config']) {
- throw console['error']('Integration "' + this['packageJSON']['name'] + '" is missing \'config\'')
- };
- _['extend'](this['options'], this['packageJSON']['config'])
- } catch(o) {
- throw console['error']('Could not load "' + this['options']['path'] + 'package.json"')
- };
- Object['freeze'](this['getConfig']), Object['freeze'](this['getWebview'])
- }
- return _createClass(e, [{
- key: 'getConfig',
- value: function (e) {
- return void(0) !== e ? this['options'][e] : this['options']
- }
- }, {
- key: 'getURL',
- value: function () {
- var e = void(0);
- return e = this['options']['hostedOnly'] ? this['model']['get']('team') : this['options']['hasTeamID'] ? this['options']['serviceURL']['replace']('{teamID}', this['model']['get']('team')) : this['options']['serviceURL']
- }
- }, {
- key: 'validateServer',
- value: function () {
- return Promise['resolve'](!0)
- }
- }, {
- key: 'getWebview',
- value: function () {
- if(void(0) === this['model']) {
- throw console['error']('Model is missing')
- };
- var e = {
- id: 'webview_' + this['model']['get']('id'),
- "class": 'chatContainer',
- src: this['getURL'](),
- preload: './scripts/service/integration.js',
- partition: 'persist:' + this['options']['service'] + '_' + this['model']['get']('id'),
- "data-service": this['options']['service'],
- "data-id": this['model']['get']('id')
- },
- t = $('<webview />');
- var w = this.options.webviewOptions;
- return Object.keys(e).forEach(function (i) {
- t.attr(i, e[i]);
- }), Object.keys(w).forEach(function (i) {
- t.attr(i, w[i]);
- }), t;
- }
- }]), e
- }();
- module['exports'] = FranzIntegration
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement