quickblox 2.13.10 → 2.13.11

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/README.md CHANGED
@@ -16,7 +16,7 @@ Check out our [API Reference](https://quickblox.github.io/quickblox-javascript-s
16
16
  ## Dependencies for browser
17
17
 
18
18
  ```html
19
- <script src="https://unpkg.com/quickblox@2.13.9/quickblox.min.js"></script>
19
+ <script src="https://unpkg.com/quickblox@2.13.11/quickblox.min.js"></script>
20
20
  ```
21
21
 
22
22
  ## Bower and RequireJS
@@ -40,10 +40,10 @@ npm install quickblox --save
40
40
  And you're ready to go:
41
41
 
42
42
  ```javascript
43
- var QB = require('quickblox');
43
+ var QB = require("quickblox");
44
44
 
45
45
  // OR to create many QB instances
46
- var QuickBlox = require('quickblox').QuickBlox;
46
+ var QuickBlox = require("quickblox").QuickBlox;
47
47
  var QB1 = new QuickBlox();
48
48
  var QB2 = new QuickBlox();
49
49
  ```
@@ -54,9 +54,9 @@ var QB2 = new QuickBlox();
54
54
 
55
55
  # Browsers support
56
56
 
57
- | Edge | Firefox | Chrome | Safari | Opera | Node.js |
58
- |:----:|:-------:|:------:|:------:|:-----:|:-------:|
59
- | 14+ | 52+ | 50+ | 11.1+ | 36+ | 6+ |
57
+ | Edge | Firefox | Chrome | Safari | Opera | Node.js |
58
+ | :--: | :-----: | :----: | :----: | :---: | :-----: |
59
+ | 14+ | 52+ | 50+ | 11.1+ | 36+ | 6+ |
60
60
 
61
61
  # Documentation
62
62
 
@@ -69,7 +69,9 @@ Please raise questions, requests for help etc. via https://stackoverflow.com/que
69
69
  Feedback and suggestions for improvement always welcome :)
70
70
 
71
71
  # How to contribute
72
+
72
73
  See more information at [contributing.md](https://github.com/QuickBlox/quickblox-javascript-sdk/blob/gh-pages/.github/CONTRIBUTING.md)
73
74
 
74
75
  # License
76
+
75
77
  Apache 2.0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quickblox",
3
3
  "description": "QuickBlox JavaScript SDK",
4
- "version": "2.13.10",
4
+ "version": "2.13.11",
5
5
  "homepage": "https://quickblox.com/developers/Javascript",
6
6
  "main": "src/qbMain.js",
7
7
  "license": "(Apache-2.0)",
@@ -76,6 +76,7 @@
76
76
  }
77
77
  },
78
78
  "scripts": {
79
+ "dev": "NODE_ENV=develop gulp watch",
79
80
  "setDependencies": "npm i && npm i -g gulp-cli && npm install rimraf -g && npm install -g jasmine",
80
81
  "lint": "jshint src --reporter=node_modules/jshint-stylish",
81
82
  "build": "cross-env NODE_ENV=production npm run lint && gulp build && gulp minify",
package/quickblox.js CHANGED
@@ -46856,7 +46856,7 @@ ChatProxy.prototype = {
46856
46856
  case Strophe.Status.AUTHFAIL:
46857
46857
  self.isConnected = false;
46858
46858
  self._isConnecting = false;
46859
-
46859
+
46860
46860
  err = Utils.getError(401, 'Status.AUTHFAIL - The authentication attempt failed', 'QBChat');
46861
46861
 
46862
46862
  if (isInitialConnect) {
@@ -47200,10 +47200,12 @@ ChatProxy.prototype = {
47200
47200
  xmlns: chatUtils.MARKERS.STATES
47201
47201
  });
47202
47202
 
47203
- if(Utils.getEnv().browser){
47204
- self.connection.send(stanza);
47205
- } else {
47206
- self.Client.send(stanza);
47203
+ if (self.connection.connected) {
47204
+ if(Utils.getEnv().browser){
47205
+ self.connection.send(stanza);
47206
+ } else {
47207
+ self.Client.send(stanza);
47208
+ }
47207
47209
  }
47208
47210
  },
47209
47211
 
@@ -47227,10 +47229,12 @@ ChatProxy.prototype = {
47227
47229
  xmlns: chatUtils.MARKERS.STATES
47228
47230
  });
47229
47231
 
47230
- if(Utils.getEnv().browser){
47231
- self.connection.send(stanza);
47232
- } else {
47233
- self.Client.send(stanza);
47232
+ if (self.connection.connected) {
47233
+ if(Utils.getEnv().browser){
47234
+ self.connection.send(stanza);
47235
+ } else {
47236
+ self.Client.send(stanza);
47237
+ }
47234
47238
  }
47235
47239
  },
47236
47240
 
@@ -53454,6 +53458,8 @@ function StreamManagement(options) {
53454
53458
  // The client send stanza counter.
53455
53459
  this._clientSentStanzasCounter = null;
53456
53460
 
53461
+ this._intervalId = null;
53462
+
53457
53463
  this._timeInterval = 2000;
53458
53464
 
53459
53465
  this.sentMessageCallback = null;
@@ -53538,7 +53544,12 @@ StreamManagement.prototype._addEnableHandlers = function () {
53538
53544
  if(tagName === 'enabled'){
53539
53545
  self._isStreamManagementEnabled = true;
53540
53546
 
53541
- setInterval(self._timeoutCallback.bind(self), self._timeInterval);
53547
+ return true;
53548
+ }
53549
+
53550
+ if (self._isStreamManagementEnabled && tagName === 'message') {
53551
+ clearInterval(self._intervalId);
53552
+ self._intervalId = setInterval(self._timeoutCallback.bind(self), self._timeInterval);
53542
53553
 
53543
53554
  return true;
53544
53555
  }
@@ -53578,17 +53589,22 @@ StreamManagement.prototype.send = function (stanza, message) {
53578
53589
  bodyContent = chatUtils.getElementText(stanzaXML, 'body') || '',
53579
53590
  attachments = chatUtils.getAllElements(stanzaXML, 'attachment') || '';
53580
53591
 
53581
- self._originalSend.call(self._c, stanza);
53582
-
53583
- if (tagName === 'message' && (type === 'chat' || type === 'groupchat') && (bodyContent || attachments.length)) {
53584
- self._sendStanzasRequest({
53585
- message: message,
53586
- time: Date.now() + self._timeInterval,
53587
- expect: self._clientSentStanzasCounter
53588
- });
53592
+ try {
53593
+ self._originalSend.call(self._c, stanza);
53594
+ } catch (e) {
53595
+ Utils.QBLog('[QBChat]', e.message);
53596
+ } finally {
53597
+ if (tagName === 'message' && (type === 'chat' || type === 'groupchat') && (bodyContent || attachments.length)) {
53598
+ self._sendStanzasRequest({
53599
+ message: message,
53600
+ time: Date.now() + self._timeInterval,
53601
+ expect: self._clientSentStanzasCounter
53602
+ });
53603
+ }
53604
+
53605
+ self._clientSentStanzasCounter++;
53589
53606
  }
53590
53607
 
53591
- self._clientSentStanzasCounter++;
53592
53608
  };
53593
53609
 
53594
53610
  StreamManagement.prototype._sendStanzasRequest = function (data) {
@@ -53597,10 +53613,14 @@ StreamManagement.prototype._sendStanzasRequest = function (data) {
53597
53613
  if(self._isStreamManagementEnabled){
53598
53614
  self._stanzasQueue.push(data);
53599
53615
 
53600
- var stanza = Utils.getEnv().browser ? $build('r', { xmlns: self._NS}) :
53601
- chatUtils.createStanza(self._nodeBuilder, { xmlns: self._NS}, 'r');
53616
+ var stanza = Utils.getEnv().browser ? $build('r', { xmlns: self._NS }) :
53617
+ chatUtils.createStanza(self._nodeBuilder, { xmlns: self._NS }, 'r');
53602
53618
 
53603
- self._originalSend.call(self._c, stanza);
53619
+ if (self._c.connected) {
53620
+ self._originalSend.call(self._c, stanza);
53621
+ } else {
53622
+ self._checkCounterOnIncomeStanza();
53623
+ }
53604
53624
  }
53605
53625
  };
53606
53626
 
@@ -53609,13 +53629,15 @@ StreamManagement.prototype.getClientSentStanzasCounter = function(){
53609
53629
  };
53610
53630
 
53611
53631
  StreamManagement.prototype._checkCounterOnIncomeStanza = function (count){
53612
- if (this._stanzasQueue[0].expect !== count){
53613
- this.sentMessageCallback(this._stanzasQueue[0].message);
53614
- } else {
53615
- this.sentMessageCallback(null, this._stanzasQueue[0].message);
53632
+ if (this._stanzasQueue.length) {
53633
+ if (this._stanzasQueue[0].expect !== count){
53634
+ this.sentMessageCallback(this._stanzasQueue[0].message);
53635
+ } else {
53636
+ this.sentMessageCallback(null, this._stanzasQueue[0].message);
53637
+ }
53638
+
53639
+ this._stanzasQueue.shift();
53616
53640
  }
53617
-
53618
- this._stanzasQueue.shift();
53619
53641
  };
53620
53642
 
53621
53643
  StreamManagement.prototype._increaseReceivedStanzasCounter = function(){
@@ -53639,8 +53661,8 @@ module.exports = StreamManagement;
53639
53661
  */
53640
53662
 
53641
53663
  var config = {
53642
- version: '2.13.10',
53643
- buildNumber: '1104',
53664
+ version: '2.13.11',
53665
+ buildNumber: '1105',
53644
53666
  creds: {
53645
53667
  appId: '',
53646
53668
  authKey: '',