merchi_sdk_js 0.0.63 → 0.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_js",
3
- "version": "0.0.63",
3
+ "version": "0.0.65",
4
4
  "type": "module",
5
5
  "main": "src/merchi.js",
6
6
  "module": "src/merchi.js",
package/src/cart.js CHANGED
@@ -23,6 +23,7 @@ export function Cart() {
23
23
  addPropertyTo(this, 'client', User);
24
24
  addPropertyTo(this, 'clientCompany', Company);
25
25
  addPropertyTo(this, 'creationDate');
26
+ addPropertyTo(this, 'updated');
26
27
  addPropertyTo(this, 'domain', Domain);
27
28
  addPropertyTo(this, 'subtotalCost');
28
29
  addPropertyTo(this, 'taxAmount');
package/src/merchi.js CHANGED
@@ -125,7 +125,7 @@ export function merchi(backendUri, websocketUri) {
125
125
  }
126
126
 
127
127
  function getSocket() {
128
- if (socket === null) {
128
+ if (socket === null && websocketUri) {
129
129
  socket = io.connect(websocketUri);
130
130
  socket.on('update', handleUpdate);
131
131
  }
@@ -133,7 +133,10 @@ export function merchi(backendUri, websocketUri) {
133
133
  }
134
134
 
135
135
  function emit(name, data) {
136
- getSocket().emit(name, data);
136
+ var socket = getSocket();
137
+ if (socket) {
138
+ socket.emit(name, data);
139
+ }
137
140
  }
138
141
 
139
142
  this.subscribe = function (eventTypes, uri, method, onUpdate) {