Comparing version 1.0.13 to 2.0.0
@@ -15,6 +15,6 @@ ;(function() { | ||
// ### socket.io-client | ||
// The main driver for this client module, the Socket.io client provides an easy | ||
// interface for talking to a Socket.io server. | ||
var io = require('socket.io-client'); | ||
// ### femio-client | ||
// The main driver for this client module, the femio-client provides an easy | ||
// interface for talking to a FEMIO server. | ||
var io = require('femio-client'); | ||
@@ -40,3 +40,3 @@ // ## HelpFem | ||
// 2. `organizationId` || `namespace` :: `String` - The namespace you would like to | ||
// connect to in your socket.io server. The option is aliased to `organizationId` | ||
// connect to in your FEMIO server. The option is aliased to `organizationId` | ||
// because Help.com namespaces are organization IDs. | ||
@@ -71,3 +71,7 @@ // 3. `user` :: `Boolean` - Whether or not the client is a user or a customer. | ||
// Set the `organizationId` and `namespace`. | ||
this.organizationId = this.namespace = options.organizationId || options.namespace; | ||
var org = options.organizationId || options.namespace; | ||
if (org === 'start') { | ||
org = undefined; | ||
} | ||
this.organizationId = this.namespace = org; | ||
@@ -88,3 +92,3 @@ // Set the `role` of the client, defaulting to `'customer'`. | ||
// Connect to the Socket.io server and store the socket information. | ||
// Connect to the FEMIO server and store the socket information. | ||
var transports = window.WebSocket && window.WebSocket.CLOSING === 2 | ||
@@ -94,6 +98,12 @@ ? ['websocket', 'polling'] | ||
this.socket = io.connect(this.uri + '/' + this.organizationId, { | ||
transports: transports | ||
this.socket = io(this.uri, { | ||
transports: transports, | ||
orgId: this.organizationId, | ||
clientId: options.clientId || undefined | ||
}); | ||
this.socket.on('error', function(err) { | ||
console.error('socket err', err); | ||
}); | ||
// Reply callback map for this client. | ||
@@ -146,3 +156,3 @@ this.replyCallbacks = {}; | ||
// `generateCallback` is a helper function to properly generate a callback | ||
// that works with Socket.io. | ||
// that works with femio-client. | ||
function generateCallback(event) { | ||
@@ -199,3 +209,3 @@ var getRegisteredCallback; | ||
// Register all the Socket.IO callbacks. | ||
// Register all the femio-client callbacks. | ||
for (var event in events) { | ||
@@ -234,2 +244,3 @@ self.socket.on(event, generateCallback(event)); | ||
meta.type && | ||
meta.type !== 'connection' && | ||
(meta.type === 'error' || meta.result !== 'SUCCESS') ? | ||
@@ -1408,2 +1419,26 @@ 'error' | ||
); | ||
}, | ||
dumpState: function(callback) { | ||
this.parent._doSimpleEmit( | ||
this.parent._emitSessionEvent, | ||
{type: 'dumpState'}, | ||
{}, | ||
callback | ||
); | ||
}, | ||
chatAndAvailabilityDetails: function(callback) { | ||
this.parent._doSimpleEmit( | ||
this.parent._emitSessionEvent, | ||
{type: 'chat-and-availability-details'}, | ||
{}, | ||
callback | ||
); | ||
}, | ||
renameCustomer: function(data, callback) { | ||
this.parent._doSimpleEmit( | ||
this.parent._emitSessionEvent, | ||
{type: 'rename-customer'}, | ||
data, | ||
callback | ||
); | ||
} | ||
@@ -1495,3 +1530,3 @@ }, | ||
// #### Generic Emit | ||
// This method can be called to send any kind of message through Socket.io without | ||
// This method can be called to send any kind of message through femio-client without | ||
// having to directly invoke the socket object. | ||
@@ -1501,3 +1536,3 @@ emit: function(type, payload) { | ||
this.socket.emit(type, payload); | ||
this.socket.send(type, payload); | ||
}, | ||
@@ -1504,0 +1539,0 @@ // #### Generate Meta |
{ | ||
"name": "help-fem", | ||
"version": "1.0.13", | ||
"version": "2.0.0", | ||
"description": "A Browserify/Node.js client module for the Help.com team's FEM.", | ||
@@ -28,3 +28,3 @@ "main": "help-fem.js", | ||
"dependencies": { | ||
"socket.io-client": "1.3", | ||
"femio-client": "git+ssh://git@github.com/helpdotcom/femio-client.git#v1.0.0", | ||
"underscore": "^1.8.2", | ||
@@ -31,0 +31,0 @@ "uuid": "^2.0.1" |
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable and can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
55027
1615
1
+ Addedfemio-client@git+ssh://git@github.com/helpdotcom/femio-client.git#v1.0.0
- Removedsocket.io-client@1.3
- Removedafter@0.8.1(transitive)
- Removedarraybuffer.slice@0.0.6(transitive)
- Removedbacko2@1.0.2(transitive)
- Removedbase64-arraybuffer@0.1.2(transitive)
- Removedbenchmark@1.0.0(transitive)
- Removedbetter-assert@1.0.2(transitive)
- Removedbindings@1.2.1(transitive)
- Removedblob@0.0.4(transitive)
- Removedbufferutil@1.2.1(transitive)
- Removedcallsite@1.0.0(transitive)
- Removedcomponent-bind@1.0.0(transitive)
- Removedcomponent-emitter@1.1.2(transitive)
- Removedcomponent-inherit@0.0.3(transitive)
- Removeddebug@0.7.41.0.4(transitive)
- Removedengine.io-client@1.5.4(transitive)
- Removedengine.io-parser@1.2.2(transitive)
- Removedhas-binary@0.1.6(transitive)
- Removedhas-cors@1.0.3(transitive)
- Removedindexof@0.0.1(transitive)
- Removedisarray@0.0.1(transitive)
- Removedjson3@3.2.6(transitive)
- Removedms@0.6.2(transitive)
- Removednan@2.22.02.4.0(transitive)
- Removedobject-component@0.0.3(transitive)
- Removedoptions@0.0.6(transitive)
- Removedparsejson@0.0.1(transitive)
- Removedparseqs@0.0.2(transitive)
- Removedparseuri@0.0.20.0.4(transitive)
- Removedsocket.io-client@1.3.7(transitive)
- Removedsocket.io-parser@2.2.4(transitive)
- Removedto-array@0.1.3(transitive)
- Removedultron@1.0.2(transitive)
- Removedutf-8-validate@1.2.2(transitive)
- Removedutf8@2.1.0(transitive)
- Removedws@0.8.0(transitive)