@mixmaxhq/sdk
Advanced tools
Comparing version 2.0.2 to 2.0.4
@@ -28,1 +28,3 @@ /** | ||
export { done, cancel }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjpudWxsLCJzb3VyY2VzIjpbIi9Vc2Vycy9icmFkL2Rldi9taXhtYXgtc2RrLWpzL3NyYy9lZGl0b3IuanMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBUaGUgTWl4bWF4IEFwcCBKUyBTREsuIFNlZSBkb2N1bWVudGF0aW9uIGF0IGh0dHA6Ly9zZGsubWl4bWF4LmNvbVxuICovXG5cbi8qKlxuICogQ2FsbCB0aGlzIHdoZW4gdGhlIHVzZXIgaXMgZmluaXNoZWQgd2l0aCB0aGUgYXBwIGVkaXRvciB3aW5kb3cuIFBhc3MgdGhlIHBhcmFtZXRlcnNcbiAqIHRoYXQgYXJlIHRvIGJlIHVzZWQgdG8gY3JlYXRlIGFuIGFwcCBpbnN0YW5jZS5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGRvbmUocGFyYW1zKSB7XG4gIGlmICghd2luZG93Lm9wZW5lcikgcmV0dXJuO1xuXG4gIHdpbmRvdy5vcGVuZXIucG9zdE1lc3NhZ2Uoe1xuICAgIG1ldGhvZDogJ2RvbmUnLFxuICAgIHBheWxvYWQ6IHBhcmFtc1xuICB9LCAnKicgLyogQ291bGQgYmUgdG8gdGhlIGFwcCBkYXNoYm9hcmQgb3IgdG8gYSBjb21wb3NlciAqLyApO1xuXG4gIHdpbmRvdy5jbG9zZSgpO1xufVxuXG4vKipcbiAqIENhbmNlbHMgdGhpcyBlZGl0b3Igd2luZG93LiBKdXN0IGNsb3NlcyB0aGUgd2luZG93LlxuICovXG5leHBvcnQgZnVuY3Rpb24gY2FuY2VsKCkge1xuICB3aW5kb3cuY2xvc2UoKTtcbn1cbiJdLCJuYW1lcyI6WyJkb25lIiwicGFyYW1zIiwid2luZG93Iiwib3Blbm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ogQ291bGQgYmUgdG8gdGhlIGFwcCBkYXNoYm9hcmQgb3IgdG8gYSBjb21wb3NlciAqLyApO1xuXG4gIHdpbmRvdy5jbG9zZSgpO1xufVxuXG4vKipcbiAqIENhbmNlbHMgdGhpcyBlZGl0b3Igd2luZG93LiBKdXN0IGNsb3NlcyB0aGUgd2luZG93LlxuICovXG5leHBvcnQgZnVuY3Rpb24gY2FuY2VsKCkge1xuICB3aW5kb3cuY2xvc2UoKTtcbn1cbiJdLCJuYW1lcyI6WyJkb25lIiwicGFyYW1zIiwid2luZG93Iiwib3BlbmVyIiwicG9zdE1lc3NhZ2UiLCJjbG9zZSIsImNhbmNlbCJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUE7Ozs7Ozs7O0FBUUEsQUFBTyxTQUFTQSxJQUFULENBQWNDLE1BQWQsRUFBc0I7TUFDdkIsQ0FBQ0MsT0FBT0MsTUFBWixFQUFvQjs7U0FFYkEsTUFBUCxDQUFjQyxXQUFkLENBQTBCO1lBQ2hCLE1BRGdCO2FBRWZIO0dBRlgsRUFHRyxHQUhIOztTQUtPSSxLQUFQOzs7Ozs7QUFNRixBQUFPLFNBQVNDLE1BQVQsR0FBa0I7U0FDaEJELEtBQVA7Ozs7Ozs7Ozs7Ozs7OyJ9 |
@@ -344,2 +344,68 @@ function createCommonjsModule(fn, module) { | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
var createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
var inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
var possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
/** | ||
@@ -358,4 +424,6 @@ * This class is used to model the lifecycle of an event emitted by an `EventEmitter`. Specifically, | ||
*/ | ||
class Event { | ||
constructor() { | ||
var Event = function () { | ||
function Event() { | ||
classCallCheck(this, Event); | ||
this._isDefaultPrevented = false; | ||
@@ -368,22 +436,36 @@ } | ||
*/ | ||
preventDefault() { | ||
this._isDefaultPrevented = true; | ||
} | ||
/** | ||
* @return {Boolean} `true` if the default has been prevented, `false` otherwise. | ||
*/ | ||
get isDefaultPrevented() { | ||
return this._isDefaultPrevented; | ||
} | ||
} | ||
class Host extends eventemitter3 { | ||
constructor() { | ||
super(); | ||
createClass(Event, [{ | ||
key: "preventDefault", | ||
value: function preventDefault() { | ||
this._isDefaultPrevented = true; | ||
} | ||
this._hostOrigin = null; | ||
this._messageQueue = []; | ||
/** | ||
* @return {Boolean} `true` if the default has been prevented, `false` otherwise. | ||
*/ | ||
window.addEventListener('message', this._onMessage.bind(this)); | ||
}, { | ||
key: "isDefaultPrevented", | ||
get: function get$$1() { | ||
return this._isDefaultPrevented; | ||
} | ||
}]); | ||
return Event; | ||
}(); | ||
var Host = function (_EventEmitter) { | ||
inherits(Host, _EventEmitter); | ||
function Host() { | ||
classCallCheck(this, Host); | ||
var _this = possibleConstructorReturn(this, (Host.__proto__ || Object.getPrototypeOf(Host)).call(this)); | ||
_this._hostOrigin = null; | ||
_this._messageQueue = []; | ||
window.addEventListener('message', _this._onMessage.bind(_this)); | ||
return _this; | ||
} | ||
@@ -400,48 +482,59 @@ | ||
*/ | ||
send(method, payload) { | ||
this._messageQueue.push({ method, payload }); | ||
this._maybeFlushMessages(); | ||
} | ||
_onMessage(e) { | ||
// Security. | ||
if (!/^https:\/\/(.+\.)?mixmax.com$/.test(e.origin)) return; | ||
// Safety belts. | ||
if (!e.data) return; | ||
createClass(Host, [{ | ||
key: 'send', | ||
value: function send(method, payload) { | ||
this._messageQueue.push({ method: method, payload: payload }); | ||
this._maybeFlushMessages(); | ||
} | ||
}, { | ||
key: '_onMessage', | ||
value: function _onMessage(e) { | ||
// Security. | ||
if (!/^https:\/\/(.+\.)?mixmax.com$/.test(e.origin)) return; | ||
switch (e.data.method) { | ||
// Handle internal methods first. | ||
case 'setOrigin': | ||
// Let the Mixmax host tell us its origin vs. hardcoding app.mixmax.com (that might change | ||
// in the future). | ||
this._setHostOrigin(e.data.payload.origin); | ||
break; | ||
// Safety belts. | ||
if (!e.data) return; | ||
// Proxy all other methods to the application. | ||
default: | ||
this.emit(e.data.method, e.data.payload); | ||
break; | ||
switch (e.data.method) { | ||
// Handle internal methods first. | ||
case 'setOrigin': | ||
// Let the Mixmax host tell us its origin vs. hardcoding app.mixmax.com (that might change | ||
// in the future). | ||
this._setHostOrigin(e.data.payload.origin); | ||
break; | ||
// Proxy all other methods to the application. | ||
default: | ||
this.emit(e.data.method, e.data.payload); | ||
break; | ||
} | ||
} | ||
} | ||
}, { | ||
key: '_maybeFlushMessages', | ||
value: function _maybeFlushMessages() { | ||
var _this2 = this; | ||
_maybeFlushMessages() { | ||
// Wait until the Mixmax host has told us its origin before messaging, so that we can lock | ||
// the target origin, for security reasons. | ||
if (!this._hostOrigin) return; | ||
// Wait until the Mixmax host has told us its origin before messaging, so that we can lock | ||
// the target origin, for security reasons. | ||
if (!this._hostOrigin) return; | ||
this._messageQueue.forEach(message => { | ||
window.parent.postMessage(message, this._hostOrigin); | ||
}); | ||
this._messageQueue = []; | ||
} | ||
this._messageQueue.forEach(function (message) { | ||
window.parent.postMessage(message, _this2._hostOrigin); | ||
}); | ||
this._messageQueue = []; | ||
} | ||
}, { | ||
key: '_setHostOrigin', | ||
value: function _setHostOrigin(origin) { | ||
if (this._hostOrigin) throw new Error('Host origin is already set'); | ||
_setHostOrigin(origin) { | ||
if (this._hostOrigin) throw new Error('Host origin is already set'); | ||
this._hostOrigin = origin; | ||
this._maybeFlushMessages(); | ||
} | ||
}]); | ||
return Host; | ||
}(eventemitter3); | ||
this._hostOrigin = origin; | ||
this._maybeFlushMessages(); | ||
} | ||
} | ||
var Host$1 = new Host(); | ||
@@ -453,9 +546,13 @@ | ||
class Sidebar extends eventemitter3 { | ||
constructor() { | ||
super(); | ||
var Sidebar = function (_EventEmitter) { | ||
inherits(Sidebar, _EventEmitter); | ||
Host$1.on('beforeContactSelected', () => { | ||
const e = new Event(); | ||
this.emit('beforeContactSelected', e); | ||
function Sidebar() { | ||
classCallCheck(this, Sidebar); | ||
var _this = possibleConstructorReturn(this, (Sidebar.__proto__ || Object.getPrototypeOf(Sidebar)).call(this)); | ||
Host$1.on('beforeContactSelected', function () { | ||
var e = new Event(); | ||
_this.emit('beforeContactSelected', e); | ||
Host$1.send('ackBeforeContactSelected', { | ||
@@ -466,10 +563,19 @@ isDefaultPrevented: e.isDefaultPrevented | ||
Host$1.on('contactSelected', contact => this.emit('contactSelected', contact)); | ||
Host$1.on('contactSelected', function (contact) { | ||
return _this.emit('contactSelected', contact); | ||
}); | ||
Host$1.on('clear', () => this.emit('clear')); | ||
Host$1.on('clear', function () { | ||
return _this.emit('clear'); | ||
}); | ||
return _this; | ||
} | ||
} | ||
return Sidebar; | ||
}(eventemitter3); | ||
var sidebar = new Sidebar(); | ||
export default sidebar; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLC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U0sTUFBS1IsSUFBTCxDQUFVLE9BQVYsQ0FBTjtLQUFqQjs7Ozs7RUFka0JNOztBQWtCdEIsY0FBZSxJQUFJQyxPQUFKLEVBQWY7Ozs7In0= |
@@ -350,2 +350,68 @@ (function (global, factory) { | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
var createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
var inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
var possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
/** | ||
@@ -364,4 +430,6 @@ * This class is used to model the lifecycle of an event emitted by an `EventEmitter`. Specifically, | ||
*/ | ||
class Event { | ||
constructor() { | ||
var Event = function () { | ||
function Event() { | ||
classCallCheck(this, Event); | ||
this._isDefaultPrevented = false; | ||
@@ -374,22 +442,36 @@ } | ||
*/ | ||
preventDefault() { | ||
this._isDefaultPrevented = true; | ||
} | ||
/** | ||
* @return {Boolean} `true` if the default has been prevented, `false` otherwise. | ||
*/ | ||
get isDefaultPrevented() { | ||
return this._isDefaultPrevented; | ||
} | ||
} | ||
class Host extends eventemitter3 { | ||
constructor() { | ||
super(); | ||
createClass(Event, [{ | ||
key: "preventDefault", | ||
value: function preventDefault() { | ||
this._isDefaultPrevented = true; | ||
} | ||
this._hostOrigin = null; | ||
this._messageQueue = []; | ||
/** | ||
* @return {Boolean} `true` if the default has been prevented, `false` otherwise. | ||
*/ | ||
window.addEventListener('message', this._onMessage.bind(this)); | ||
}, { | ||
key: "isDefaultPrevented", | ||
get: function get$$1() { | ||
return this._isDefaultPrevented; | ||
} | ||
}]); | ||
return Event; | ||
}(); | ||
var Host = function (_EventEmitter) { | ||
inherits(Host, _EventEmitter); | ||
function Host() { | ||
classCallCheck(this, Host); | ||
var _this = possibleConstructorReturn(this, (Host.__proto__ || Object.getPrototypeOf(Host)).call(this)); | ||
_this._hostOrigin = null; | ||
_this._messageQueue = []; | ||
window.addEventListener('message', _this._onMessage.bind(_this)); | ||
return _this; | ||
} | ||
@@ -406,48 +488,59 @@ | ||
*/ | ||
send(method, payload) { | ||
this._messageQueue.push({ method, payload }); | ||
this._maybeFlushMessages(); | ||
} | ||
_onMessage(e) { | ||
// Security. | ||
if (!/^https:\/\/(.+\.)?mixmax.com$/.test(e.origin)) return; | ||
// Safety belts. | ||
if (!e.data) return; | ||
createClass(Host, [{ | ||
key: 'send', | ||
value: function send(method, payload) { | ||
this._messageQueue.push({ method: method, payload: payload }); | ||
this._maybeFlushMessages(); | ||
} | ||
}, { | ||
key: '_onMessage', | ||
value: function _onMessage(e) { | ||
// Security. | ||
if (!/^https:\/\/(.+\.)?mixmax.com$/.test(e.origin)) return; | ||
switch (e.data.method) { | ||
// Handle internal methods first. | ||
case 'setOrigin': | ||
// Let the Mixmax host tell us its origin vs. hardcoding app.mixmax.com (that might change | ||
// in the future). | ||
this._setHostOrigin(e.data.payload.origin); | ||
break; | ||
// Safety belts. | ||
if (!e.data) return; | ||
// Proxy all other methods to the application. | ||
default: | ||
this.emit(e.data.method, e.data.payload); | ||
break; | ||
switch (e.data.method) { | ||
// Handle internal methods first. | ||
case 'setOrigin': | ||
// Let the Mixmax host tell us its origin vs. hardcoding app.mixmax.com (that might change | ||
// in the future). | ||
this._setHostOrigin(e.data.payload.origin); | ||
break; | ||
// Proxy all other methods to the application. | ||
default: | ||
this.emit(e.data.method, e.data.payload); | ||
break; | ||
} | ||
} | ||
} | ||
}, { | ||
key: '_maybeFlushMessages', | ||
value: function _maybeFlushMessages() { | ||
var _this2 = this; | ||
_maybeFlushMessages() { | ||
// Wait until the Mixmax host has told us its origin before messaging, so that we can lock | ||
// the target origin, for security reasons. | ||
if (!this._hostOrigin) return; | ||
// Wait until the Mixmax host has told us its origin before messaging, so that we can lock | ||
// the target origin, for security reasons. | ||
if (!this._hostOrigin) return; | ||
this._messageQueue.forEach(message => { | ||
window.parent.postMessage(message, this._hostOrigin); | ||
}); | ||
this._messageQueue = []; | ||
} | ||
this._messageQueue.forEach(function (message) { | ||
window.parent.postMessage(message, _this2._hostOrigin); | ||
}); | ||
this._messageQueue = []; | ||
} | ||
}, { | ||
key: '_setHostOrigin', | ||
value: function _setHostOrigin(origin) { | ||
if (this._hostOrigin) throw new Error('Host origin is already set'); | ||
_setHostOrigin(origin) { | ||
if (this._hostOrigin) throw new Error('Host origin is already set'); | ||
this._hostOrigin = origin; | ||
this._maybeFlushMessages(); | ||
} | ||
}]); | ||
return Host; | ||
}(eventemitter3); | ||
this._hostOrigin = origin; | ||
this._maybeFlushMessages(); | ||
} | ||
} | ||
var Host$1 = new Host(); | ||
@@ -459,9 +552,13 @@ | ||
class Sidebar extends eventemitter3 { | ||
constructor() { | ||
super(); | ||
var Sidebar = function (_EventEmitter) { | ||
inherits(Sidebar, _EventEmitter); | ||
Host$1.on('beforeContactSelected', () => { | ||
const e = new Event(); | ||
this.emit('beforeContactSelected', e); | ||
function Sidebar() { | ||
classCallCheck(this, Sidebar); | ||
var _this = possibleConstructorReturn(this, (Sidebar.__proto__ || Object.getPrototypeOf(Sidebar)).call(this)); | ||
Host$1.on('beforeContactSelected', function () { | ||
var e = new Event(); | ||
_this.emit('beforeContactSelected', e); | ||
Host$1.send('ackBeforeContactSelected', { | ||
@@ -472,8 +569,15 @@ isDefaultPrevented: e.isDefaultPrevented | ||
Host$1.on('contactSelected', contact => this.emit('contactSelected', contact)); | ||
Host$1.on('contactSelected', function (contact) { | ||
return _this.emit('contactSelected', contact); | ||
}); | ||
Host$1.on('clear', () => this.emit('clear')); | ||
Host$1.on('clear', function () { | ||
return _this.emit('clear'); | ||
}); | ||
return _this; | ||
} | ||
} | ||
return Sidebar; | ||
}(eventemitter3); | ||
var sidebar = new Sidebar(); | ||
@@ -484,1 +588,3 @@ | ||
}))); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjpudWxsLCJzb3VyY2VzIjpbIi9Vc2Vycy9icmFkL2Rldi9taXhtYXgtc2RrLWpzL25vZGVfbW9kdWxlcy9ldmVudGVtaXR0ZXIzL2luZGV4LmpzIiwiL1VzZXJzL2JyYWQvZGV2L21peG1heC1zZGstanMvc3JjL3V0aWxzL0V2ZW50LmpzIiwiL1VzZXJzL2JyYWQvZGV2L21peG1heC1zZGstanMvc3JjL3V0aWxzL0hvc3QuanMiLCIvVXNlcnMvYnJhZC9kZXYvbWl4bWF4LXNkay1qcy9zcmMvc2lkZWJhci5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5cbnZhciBoYXMgPSBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5XG4gICwgcHJlZml4ID0gJ34nO1xuXG4vKipcbiAqIENvbnN0cnVjdG9yIHRvIGNyZWF0ZSBhIHN0b3JhZ2UgZm9yIG91ciBgRUVgIG9iamVjdHMuXG4gKiBBbiBgRXZlbnRzYCBpbnN0YW5jZSBpcyBhI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FBTCxHQUFtQlcsTUFBbkI7V0FDS0gsbUJBQUw7Ozs7RUE3RGVZOztBQWlFbkIsYUFBZSxJQUFJckIsSUFBSixFQUFmOztBQ3ZFQTs7OztBQUlBLElBS01zQjs7O3FCQUNVOzs7OztXQUdQQyxFQUFMLENBQVEsdUJBQVIsRUFBaUMsWUFBTTtVQUMvQmIsSUFBSSxJQUFJWixLQUFKLEVBQVY7WUFDS2lCLElBQUwsQ0FBVSx1QkFBVixFQUFtQ0wsQ0FBbkM7YUFDS2MsSUFBTCxDQUFVLDBCQUFWLEVBQXNDOzRCQUNoQmQsRUFBRWU7T0FEeEI7S0FIRjs7V0FRS0YsRUFBTCxDQUFRLGlCQUFSLEVBQTJCLFVBQUNHLE9BQUQ7YUFBYSxNQUFLWCxJQUFMLENBQVUsaUJBQVYsRUFBNkJXLE9BQTdCLENBQWI7S0FBM0I7O1dBRUtILEVBQUwsQ0FBUSxPQUFSLEVBQWlCO2FBQU0sTUFBS1IsSUFBTCxDQUFVLE9BQVYsQ0FBTjtLQUFqQjs7Ozs7RUFka0JNOztBQWtCdEIsY0FBZSxJQUFJQyxPQUFKLEVBQWY7Ozs7Ozs7OyJ9 |
{ | ||
"name": "@mixmaxhq/sdk", | ||
"version": "2.0.2", | ||
"version": "2.0.4", | ||
"description": "Our client-side SDK.", | ||
@@ -17,6 +17,6 @@ "main": "dist/Mixmax.umd.js", | ||
"start": "gulp", | ||
"test": "NODE_ENV=test gulp test:e2e", | ||
"build": "gulp build", | ||
"upload": "env NODE_ENV=production gulp upload", | ||
"ci": "npm test" | ||
"ci": "exit 0" | ||
}, | ||
@@ -41,3 +41,2 @@ "repository": { | ||
"babel-preset-es2015": "^6.24.1", | ||
"chai": "^4.1.2", | ||
"concurrent-transform": "^1.0.0", | ||
@@ -56,3 +55,2 @@ "del": "^3.0.0", | ||
"gulp-waitfor": "^0.0.13", | ||
"gulp-webdriver": "^2.0.3", | ||
"gulp-webserver": "^0.9.1", | ||
@@ -68,6 +66,2 @@ "multibuild": "^2.2.1", | ||
"underscore": "^1.8.3", | ||
"wdio-mocha-framework": "^0.5.11", | ||
"wdio-sauce-service": "^0.4.4", | ||
"wdio-selenium-standalone-service": "^0.0.9", | ||
"webdriverio": "^4.10.0", | ||
"yargs": "^3.25.0" | ||
@@ -74,0 +68,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1072655
27
28
7404
0