quickblox 2.16.3 → 2.17.0-beta.1

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.16.3/quickblox.min.js"></script>
19
+ <script src="https://unpkg.com/quickblox@2.16.4/quickblox.min.js"></script>
20
20
  ```
21
21
 
22
22
  ## Bower and RequireJS
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quickblox",
3
3
  "description": "QuickBlox JavaScript SDK",
4
- "version": "2.16.3",
4
+ "version": "2.17.0-beta.1",
5
5
  "homepage": "https://quickblox.com/developers/Javascript",
6
6
  "main": "src/qbMain.js",
7
7
  "types": "quickblox.d.ts",
package/quickblox.d.ts CHANGED
@@ -413,6 +413,31 @@ export declare type GetMessagesResult = {
413
413
  limit: number
414
414
  skip: number
415
415
  }
416
+ export class AIRole {
417
+ public static readonly user = "user";
418
+ public static readonly assistant = "assistant"
419
+ }
420
+
421
+ export interface AIChatMessage {
422
+ role: AIRole;
423
+ content: string;
424
+ }
425
+
426
+ export declare type AIChatHistory = AIChatMessage[] | null | undefined;
427
+
428
+ interface QBAIModule{
429
+ //QB.ai.answerAssist
430
+ answerAssist(smartChatAssistantId: string,
431
+ message: string,
432
+ history :AIChatHistory,
433
+ callback: QBCallback<string>): void
434
+ //QB.ai.translate
435
+ translate(smartChatAssistantId: string,
436
+ message: string,
437
+ languageCode: string,
438
+ callback: QBCallback<string>): void
439
+
440
+ }
416
441
 
417
442
  interface QBChatModule {
418
443
  isConnected: boolean
@@ -549,7 +574,7 @@ interface QBChatModule {
549
574
  /** Send is delivered status. */
550
575
  sendDeliveredStatus(params: QBMessageStatusParams): void
551
576
  ping(jidOrUserId: string | number, callback: QBCallback<any>): string
552
- ping(callback: QBCallback<any>): string
577
+ pingchat(callback: QBCallback<any>): string
553
578
 
554
579
  dialog: {
555
580
  /**
@@ -750,6 +775,7 @@ interface QBChatModule {
750
775
  /** Get user jid from current user. */
751
776
  getUserCurrentJid(): string
752
777
  }
778
+
753
779
  }
754
780
 
755
781
  export declare interface QBDataFile {
@@ -1518,6 +1544,8 @@ export class QuickBlox {
1518
1544
 
1519
1545
  chat: QBChatModule
1520
1546
 
1547
+ ai: QBAIModule
1548
+
1521
1549
  content: QBContentModule
1522
1550
 
1523
1551
  data: QBDataModule
package/quickblox.js CHANGED
@@ -47317,18 +47317,51 @@ MucProxy.prototype = {
47317
47317
 
47318
47318
  delete this.joinedRooms[jid];
47319
47319
 
47320
+ function handleLeaveAnswer(stanza) {
47321
+ var id = chatUtils.getAttr(stanza, 'id');
47322
+ var from = chatUtils.getAttr(stanza, 'from');
47323
+ var dialogId = self.helpers.getDialogIdFromNode(from);
47324
+
47325
+ var x = chatUtils.getElement(stanza, 'x');
47326
+ var xXMLNS = chatUtils.getAttr(x, 'xmlns');
47327
+ var status = chatUtils.getElement(x, 'status');
47328
+ var statusCode = chatUtils.getAttr(status, 'code');
47329
+
47330
+ if (status && statusCode == '110') {
47331
+ Utils.safeCallbackCall(callback, null, {
47332
+ dialogId: dialogId
47333
+ });
47334
+ } else {
47335
+ var type = chatUtils.getAttr(stanza, 'type');
47336
+
47337
+ if (type && type === 'error' && xXMLNS == 'http://jabber.org/protocol/muc' && id.endsWith(':join')) {
47338
+ var errorEl = chatUtils.getElement(stanza, 'error');
47339
+ var code = chatUtils.getAttr(errorEl, 'code');
47340
+ var errorMessage = chatUtils.getElementText(errorEl, 'text');
47341
+
47342
+ Utils.safeCallbackCall(callback, {
47343
+ code: code || 500,
47344
+ message: errorMessage || 'Unknown issue'
47345
+ }, {
47346
+ dialogId: dialogId
47347
+ });
47348
+ }
47349
+ }
47350
+ }
47351
+
47320
47352
  if (Utils.getEnv().browser) {
47321
47353
  var roomJid = self.helpers.getRoomJid(jid);
47322
47354
 
47323
47355
  if (typeof callback === 'function') {
47324
- self.connection.XAddTrackedHandler(callback, null, 'presence', presParams.type, null, roomJid);
47356
+ self.connection.XAddTrackedHandler(handleLeaveAnswer, null, 'presence', presParams.type, null, roomJid);
47357
+
47325
47358
  }
47326
47359
 
47327
47360
  self.connection.send(pres);
47328
47361
  } else {
47329
47362
  /** The answer don't contain id */
47330
47363
  if (typeof callback === 'function') {
47331
- self.nodeStanzasCallbacks['muc:leave'] = callback;
47364
+ self.nodeStanzasCallbacks['muc:leave'] = handleLeaveAnswer;
47332
47365
  }
47333
47366
 
47334
47367
  self.Client.send(pres);
@@ -48162,7 +48195,7 @@ Helpers.prototype = {
48162
48195
  * */
48163
48196
  module.exports = ChatProxy;
48164
48197
 
48165
- },{"../../plugins/streamManagement":251,"../../qbConfig":252,"../../qbStrophe":255,"../../qbUtils":256,"./qbChatHelpers":235,"nativescript-xmpp-client":undefined,"node-xmpp-client":111}],235:[function(require,module,exports){
48198
+ },{"../../plugins/streamManagement":252,"../../qbConfig":253,"../../qbStrophe":256,"../../qbUtils":257,"./qbChatHelpers":235,"nativescript-xmpp-client":undefined,"node-xmpp-client":111}],235:[function(require,module,exports){
48166
48199
  'use strict';
48167
48200
 
48168
48201
  var utils = require('../../qbUtils');
@@ -48483,7 +48516,7 @@ var qbChatHelpers = {
48483
48516
 
48484
48517
  module.exports = qbChatHelpers;
48485
48518
 
48486
- },{"../../qbConfig":252,"../../qbUtils":256}],236:[function(require,module,exports){
48519
+ },{"../../qbConfig":253,"../../qbUtils":257}],236:[function(require,module,exports){
48487
48520
  'use strict';
48488
48521
 
48489
48522
  var config = require('../../qbConfig'),
@@ -48605,7 +48638,7 @@ DialogProxy.prototype = {
48605
48638
 
48606
48639
  module.exports = DialogProxy;
48607
48640
 
48608
- },{"../../qbConfig":252,"../../qbUtils":256}],237:[function(require,module,exports){
48641
+ },{"../../qbConfig":253,"../../qbUtils":257}],237:[function(require,module,exports){
48609
48642
  'use strict';
48610
48643
 
48611
48644
  var config = require('../../qbConfig'),
@@ -48747,7 +48780,161 @@ MessageProxy.prototype = {
48747
48780
 
48748
48781
  module.exports = MessageProxy;
48749
48782
 
48750
- },{"../../qbConfig":252,"../../qbUtils":256}],238:[function(require,module,exports){
48783
+ },{"../../qbConfig":253,"../../qbUtils":257}],238:[function(require,module,exports){
48784
+ 'use strict';
48785
+
48786
+ var Utils = require('../qbUtils');
48787
+
48788
+ var AI_API_URL = 'ai/ai_extensions';
48789
+
48790
+ function AIProxy(service) {
48791
+ this.service = service;
48792
+ }
48793
+
48794
+ /**
48795
+ * @namespace QB.ai
48796
+ **/
48797
+ AIProxy.prototype = {
48798
+
48799
+ /**
48800
+ * Provides answer assistant functionality that helps users effortlessly send various answers considering({@link https://docs.quickblox.com/docs/js-sdk-ai-features#ai-assist-answer read more}).
48801
+ * @memberof QB.ai
48802
+ * @param {String} smartChatAssistantId - Smart Chat Assistant id.
48803
+ * @param {String} message - Message you want to get answer for.
48804
+ * @param {Object[]} history - Conversation history. Used to add context.
48805
+ * @param {answerAssistCallback} callback - The callback function.
48806
+ * @example
48807
+ * var history = [
48808
+ * {role: "user", message: "Hello"},
48809
+ * {role: "assistant", message: "Hi"}
48810
+ * ];
48811
+ * var messageToAssist = 'Where is my order?';
48812
+ * QB.ai.answerAssist(smartChatAssistantId, messageToAssist, history, callback);
48813
+ * // or third parameters can be null
48814
+ * QB.ai.answerAssist(smartChatAssistantId, messageToAssist, null, callback);
48815
+ * */
48816
+ answerAssist: function(smartChatAssistantId, message, history, callback) {
48817
+ /**
48818
+ * Callback for QB.ai.answerAssist().
48819
+ * @param {Object} error - The error object.
48820
+ * @param {Object} response - The server response object.
48821
+ * @param {String} [response.answer] - assist answer for message
48822
+ * @callback answerAssistCallback
48823
+ * */
48824
+ function validateHistory(history) {
48825
+ var AIRole = {
48826
+ user: 'user',
48827
+ assistant: 'assistant'
48828
+ };
48829
+ // throw new Error('The QB.addressbook.get accept callback function is required.');
48830
+ // isArray, isCallback
48831
+ if (history !== null && history !== undefined) {
48832
+ if (!Array.isArray(history)) {
48833
+ Utils.safeCallbackCall(callback, {
48834
+ code: 400,
48835
+ message: 'History must be an array'
48836
+ });
48837
+ return false;
48838
+ }
48839
+
48840
+ for (var i = 0; i < history.length; i++) {
48841
+ var item = history[i];
48842
+ if (typeof item !== 'object' || item === null || Array.isArray(item)) {
48843
+ Utils.safeCallbackCall(callback, {
48844
+ code: 400,
48845
+ message: 'Each element of history must be an object'
48846
+ });
48847
+ return false;
48848
+ }
48849
+
48850
+ if (!('role' in item) || !('message' in item)) {
48851
+ Utils.safeCallbackCall(callback, {
48852
+ code: 400,
48853
+ message: 'Each element of history must have an role and message fields'
48854
+ });
48855
+ return false;
48856
+ }
48857
+
48858
+ if (!(item.role === AIRole.user || item.role === AIRole.assistant)) {
48859
+ Utils.safeCallbackCall(callback, {
48860
+ code: 400,
48861
+ message: 'Invalid role in history item'
48862
+ });
48863
+ return false;
48864
+ }
48865
+
48866
+ if (typeof item.message !== 'string') {
48867
+ Utils.safeCallbackCall(callback, {
48868
+ code: 400,
48869
+ message: 'Message of history item must be a string'
48870
+ });
48871
+ return false;
48872
+ }
48873
+ }
48874
+ }
48875
+
48876
+ return true;
48877
+ }
48878
+
48879
+ if (!validateHistory(history)) {
48880
+ return;
48881
+ }
48882
+
48883
+ var data = history ? {
48884
+ smart_chat_assistant_id: smartChatAssistantId,
48885
+ message: message,
48886
+ history: history,
48887
+ }:{
48888
+ smart_chat_assistant_id: smartChatAssistantId,
48889
+ message: message,
48890
+ };
48891
+ var attrAjax = {
48892
+ 'type': 'POST',
48893
+ 'url': Utils.formatUrl(AI_API_URL + '/ai_answer_assist'),
48894
+ 'data': data,
48895
+ 'contentType': 'application/json; charset=utf-8',
48896
+ 'isNeedStringify': true
48897
+ };
48898
+ this.service.ajax(attrAjax, callback);
48899
+ },
48900
+
48901
+ /**
48902
+ * Offers translation functionality that helps users easily translate text messages in chat({@link https://docs.quickblox.com/docs/js-sdk-ai-features#ai-translate read more}).
48903
+ * @memberof QB.ai
48904
+ * @param {String} smartChatAssistantId - Smart Chat Assistant id.
48905
+ * @param {String} text - Text to translate.
48906
+ * @param {String} languageCode - Translation language code.
48907
+ * @param {translateCallback} callback - The callback function.
48908
+ * */
48909
+ //should add validation for callback as answerAssist + list of codes
48910
+ translate: function(smartChatAssistantId, text, languageCode, callback) {
48911
+ /**
48912
+ * Callback for QB.ai.translate().
48913
+ * @param {Object} error - The error object.
48914
+ * @param {Object} response - The server response object.
48915
+ * @param {String} [response.answer] - translated message
48916
+ * @callback translateCallback
48917
+ * */
48918
+ var data = {
48919
+ smart_chat_assistant_id: smartChatAssistantId,
48920
+ text: text,
48921
+ to_language: languageCode || 'en',
48922
+ };
48923
+ var attrAjax = {
48924
+ 'type': 'POST',
48925
+ 'url': Utils.formatUrl(AI_API_URL + '/ai_translate'),
48926
+ 'data': data,
48927
+ };
48928
+
48929
+ this.service.ajax(attrAjax, callback);
48930
+ },
48931
+
48932
+
48933
+ };
48934
+
48935
+ module.exports = AIProxy;
48936
+
48937
+ },{"../qbUtils":257}],239:[function(require,module,exports){
48751
48938
  'use strict';
48752
48939
 
48753
48940
  var Utils = require('../qbUtils');
@@ -48972,7 +49159,7 @@ function isFunction(func) {
48972
49159
  return !!(func && func.constructor && func.call && func.apply);
48973
49160
  }
48974
49161
 
48975
- },{"../qbConfig":252,"../qbUtils":256}],239:[function(require,module,exports){
49162
+ },{"../qbConfig":253,"../qbUtils":257}],240:[function(require,module,exports){
48976
49163
  'use strict';
48977
49164
 
48978
49165
  var config = require('../qbConfig'),
@@ -49123,7 +49310,7 @@ function signMessage(message, secret) {
49123
49310
  return cryptoSessionMsg;
49124
49311
  }
49125
49312
 
49126
- },{"../qbConfig":252,"../qbUtils":256,"crypto-js/hmac-sha1":51,"crypto-js/hmac-sha256":52}],240:[function(require,module,exports){
49313
+ },{"../qbConfig":253,"../qbUtils":257,"crypto-js/hmac-sha1":51,"crypto-js/hmac-sha256":52}],241:[function(require,module,exports){
49127
49314
  'use strict';
49128
49315
 
49129
49316
  /*
@@ -49518,7 +49705,7 @@ parseUri.options = {
49518
49705
  }
49519
49706
  };
49520
49707
 
49521
- },{"../qbConfig":252,"../qbUtils":256}],241:[function(require,module,exports){
49708
+ },{"../qbConfig":253,"../qbUtils":257}],242:[function(require,module,exports){
49522
49709
  'use strict';
49523
49710
 
49524
49711
  var config = require('../qbConfig');
@@ -49900,7 +50087,7 @@ DataProxy.prototype = {
49900
50087
 
49901
50088
  module.exports = DataProxy;
49902
50089
 
49903
- },{"../qbConfig":252,"../qbUtils":256}],242:[function(require,module,exports){
50090
+ },{"../qbConfig":253,"../qbUtils":257}],243:[function(require,module,exports){
49904
50091
  (function (Buffer){(function (){
49905
50092
  'use strict';
49906
50093
 
@@ -50139,7 +50326,7 @@ EventsProxy.prototype = {
50139
50326
  module.exports = PushNotificationsProxy;
50140
50327
 
50141
50328
  }).call(this)}).call(this,require("buffer").Buffer)
50142
- },{"../qbConfig":252,"../qbUtils":256,"buffer":47}],243:[function(require,module,exports){
50329
+ },{"../qbConfig":253,"../qbUtils":257,"buffer":47}],244:[function(require,module,exports){
50143
50330
  'use strict';
50144
50331
 
50145
50332
  /*
@@ -50452,7 +50639,7 @@ function generateOrder(obj) {
50452
50639
  return [obj.sort, type, obj.field].join(' ');
50453
50640
  }
50454
50641
 
50455
- },{"../qbConfig":252,"../qbUtils":256}],244:[function(require,module,exports){
50642
+ },{"../qbConfig":253,"../qbUtils":257}],245:[function(require,module,exports){
50456
50643
  'use strict';
50457
50644
 
50458
50645
  /**
@@ -51255,7 +51442,7 @@ function setMediaBitrate(sdp, media, bitrate) {
51255
51442
 
51256
51443
  module.exports = qbRTCPeerConnection;
51257
51444
 
51258
- },{"../../qbConfig":252,"./qbWebRTCHelpers":246}],245:[function(require,module,exports){
51445
+ },{"../../qbConfig":253,"./qbWebRTCHelpers":247}],246:[function(require,module,exports){
51259
51446
  'use strict';
51260
51447
 
51261
51448
  /**
@@ -51666,7 +51853,7 @@ function getOpponentsIdNASessions(sessions) {
51666
51853
  return opponents;
51667
51854
  }
51668
51855
 
51669
- },{"../../qbConfig":252,"../../qbUtils":256,"./qbRTCPeerConnection":244,"./qbWebRTCHelpers":246,"./qbWebRTCSession":247,"./qbWebRTCSignalingConstants":248,"./qbWebRTCSignalingProcessor":249,"./qbWebRTCSignalingProvider":250}],246:[function(require,module,exports){
51856
+ },{"../../qbConfig":253,"../../qbUtils":257,"./qbRTCPeerConnection":245,"./qbWebRTCHelpers":247,"./qbWebRTCSession":248,"./qbWebRTCSignalingConstants":249,"./qbWebRTCSignalingProcessor":250,"./qbWebRTCSignalingProvider":251}],247:[function(require,module,exports){
51670
51857
  'use strict';
51671
51858
 
51672
51859
  /**
@@ -51812,7 +51999,7 @@ var WebRTCHelpers = {
51812
51999
 
51813
52000
  module.exports = WebRTCHelpers;
51814
52001
 
51815
- },{"../../qbConfig":252}],247:[function(require,module,exports){
52002
+ },{"../../qbConfig":253}],248:[function(require,module,exports){
51816
52003
  'use strict';
51817
52004
 
51818
52005
  /**
@@ -53102,7 +53289,7 @@ function _prepareExtension(extension) {
53102
53289
 
53103
53290
  module.exports = WebRTCSession;
53104
53291
 
53105
- },{"../../qbConfig":252,"../../qbUtils":256,"./qbRTCPeerConnection":244,"./qbWebRTCHelpers":246,"./qbWebRTCSignalingConstants":248}],248:[function(require,module,exports){
53292
+ },{"../../qbConfig":253,"../../qbUtils":257,"./qbRTCPeerConnection":245,"./qbWebRTCHelpers":247,"./qbWebRTCSignalingConstants":249}],249:[function(require,module,exports){
53106
53293
  'use strict';
53107
53294
 
53108
53295
  /**
@@ -53125,7 +53312,7 @@ WebRTCSignalingConstants.SignalingType = {
53125
53312
 
53126
53313
  module.exports = WebRTCSignalingConstants;
53127
53314
 
53128
- },{}],249:[function(require,module,exports){
53315
+ },{}],250:[function(require,module,exports){
53129
53316
  'use strict';
53130
53317
 
53131
53318
  /**
@@ -53283,7 +53470,7 @@ function WebRTCSignalingProcessor(service, delegate) {
53283
53470
 
53284
53471
  module.exports = WebRTCSignalingProcessor;
53285
53472
 
53286
- },{"./qbWebRTCSignalingConstants":248,"strophe.js":208}],250:[function(require,module,exports){
53473
+ },{"./qbWebRTCSignalingConstants":249,"strophe.js":208}],251:[function(require,module,exports){
53287
53474
  'use strict';
53288
53475
 
53289
53476
  /** JSHint inline rules */
@@ -53390,7 +53577,7 @@ WebRTCSignalingProvider.prototype._JStoXML = function (title, obj, msg) {
53390
53577
 
53391
53578
  module.exports = WebRTCSignalingProvider;
53392
53579
 
53393
- },{"../../qbConfig":252,"../../qbUtils":256,"./qbWebRTCHelpers":246,"./qbWebRTCSignalingConstants":248,"strophe.js":208}],251:[function(require,module,exports){
53580
+ },{"../../qbConfig":253,"../../qbUtils":257,"./qbWebRTCHelpers":247,"./qbWebRTCSignalingConstants":249,"strophe.js":208}],252:[function(require,module,exports){
53394
53581
  'use strict';
53395
53582
 
53396
53583
  /**
@@ -53627,7 +53814,7 @@ StreamManagement.prototype._increaseReceivedStanzasCounter = function(){
53627
53814
 
53628
53815
  module.exports = StreamManagement;
53629
53816
 
53630
- },{"../modules/chat/qbChatHelpers":235,"../qbUtils":256}],252:[function(require,module,exports){
53817
+ },{"../modules/chat/qbChatHelpers":235,"../qbUtils":257}],253:[function(require,module,exports){
53631
53818
  'use strict';
53632
53819
 
53633
53820
  /*
@@ -53642,8 +53829,8 @@ module.exports = StreamManagement;
53642
53829
  */
53643
53830
 
53644
53831
  var config = {
53645
- version: '2.16.3',
53646
- buildNumber: '1158',
53832
+ version: '2.16.4',
53833
+ buildNumber: '1159',
53647
53834
  creds: {
53648
53835
  'appId': 0,
53649
53836
  'authKey': '',
@@ -53758,7 +53945,7 @@ config.updateSessionExpirationDate = function (tokenExpirationDate, headerHasTok
53758
53945
 
53759
53946
  module.exports = config;
53760
53947
 
53761
- },{}],253:[function(require,module,exports){
53948
+ },{}],254:[function(require,module,exports){
53762
53949
  'use strict';
53763
53950
 
53764
53951
  /*
@@ -53769,6 +53956,7 @@ module.exports = config;
53769
53956
  */
53770
53957
  var config = require('./qbConfig');
53771
53958
  var Utils = require('./qbUtils');
53959
+ const MessageProxy = require("./modules/chat/qbMessage");
53772
53960
 
53773
53961
  // Actual QuickBlox API starts here
53774
53962
  function QuickBlox() {}
@@ -53824,7 +54012,8 @@ QuickBlox.prototype = {
53824
54012
  AddressBook = require('./modules/qbAddressBook'),
53825
54013
  Chat = require('./modules/chat/qbChat'),
53826
54014
  DialogProxy = require('./modules/chat/qbDialog'),
53827
- MessageProxy = require('./modules/chat/qbMessage');
54015
+ MessageProxy = require('./modules/chat/qbMessage'),
54016
+ AIProxy = require('./modules/qbAI');
53828
54017
 
53829
54018
  this.service = new Proxy();
53830
54019
  this.auth = new Auth(this.service);
@@ -53836,6 +54025,7 @@ QuickBlox.prototype = {
53836
54025
  this.chat = new Chat(this.service);
53837
54026
  this.chat.dialog = new DialogProxy(this.service);
53838
54027
  this.chat.message = new MessageProxy(this.service);
54028
+ this.ai = new AIProxy(this.service);
53839
54029
 
53840
54030
  if (Utils.getEnv().browser) {
53841
54031
  /** add adapter.js*/
@@ -54037,7 +54227,7 @@ QB.QuickBlox = QuickBlox;
54037
54227
 
54038
54228
  module.exports = QB;
54039
54229
 
54040
- },{"./modules/chat/qbChat":234,"./modules/chat/qbDialog":236,"./modules/chat/qbMessage":237,"./modules/qbAddressBook":238,"./modules/qbAuth":239,"./modules/qbContent":240,"./modules/qbData":241,"./modules/qbPushNotifications":242,"./modules/qbUsers":243,"./modules/webrtc/qbWebRTCClient":245,"./qbConfig":252,"./qbProxy":254,"./qbUtils":256,"webrtc-adapter":218}],254:[function(require,module,exports){
54230
+ },{"./modules/chat/qbChat":234,"./modules/chat/qbDialog":236,"./modules/chat/qbMessage":237,"./modules/qbAI":238,"./modules/qbAddressBook":239,"./modules/qbAuth":240,"./modules/qbContent":241,"./modules/qbData":242,"./modules/qbPushNotifications":243,"./modules/qbUsers":244,"./modules/webrtc/qbWebRTCClient":246,"./qbConfig":253,"./qbProxy":255,"./qbUtils":257,"webrtc-adapter":218}],255:[function(require,module,exports){
54041
54231
  'use strict';
54042
54232
 
54043
54233
  var config = require('./qbConfig');
@@ -54175,7 +54365,39 @@ ServiceProxy.prototype = {
54175
54365
  if (config.timeout) {
54176
54366
  qbRequest.timeout = config.timeout;
54177
54367
  }
54178
-
54368
+ //browser only version
54369
+ // fetch(qbUrl, qbRequest)
54370
+ // .then(function(response){
54371
+ // qbResponse = response;
54372
+ // if (qbRequest.method === 'GET' || qbRequest.method === 'POST'){
54373
+ // var qbTokenExpirationDate = qbResponse.headers.get('qb-token-expirationdate');
54374
+ // var headerHasToken = !(qbTokenExpirationDate === null ||
54375
+ // typeof qbTokenExpirationDate === 'undefined');
54376
+ // qbTokenExpirationDate = headerHasToken ? qbTokenExpirationDate : new Date();
54377
+ // self.qbInst.config.updateSessionExpirationDate(qbTokenExpirationDate, headerHasToken);
54378
+ // console.log('[Request][fetch]','header has token:',headerHasToken );
54379
+ // console.log('[Request][fetch]','updateSessionExpirationDate ... Set value: ', self.qbInst.config.qbTokenExpirationDate );
54380
+ // }
54381
+ // if (qbDataType === 'text') {
54382
+ // return response.text();
54383
+ // } else {
54384
+ // return response.json();
54385
+ // }
54386
+ // }).catch((error) => {
54387
+ // console.log('fetch Error: ', error);
54388
+ // qbResponse = {
54389
+ // status: 200
54390
+ // };
54391
+ // console.log('reason: ', error);
54392
+ // return ' ';
54393
+ // }).then(function(body){
54394
+ // _requestCallback(null, qbResponse, body);
54395
+ // }).catch((error) => {
54396
+ // console.log('Fetch error: ', error);
54397
+ // _requestCallback(error);
54398
+ // });
54399
+
54400
+ // original version
54179
54401
  qbFetch(qbUrl, qbRequest)
54180
54402
  .then(function(response) {
54181
54403
  qbResponse = response;
@@ -54304,7 +54526,7 @@ ServiceProxy.prototype = {
54304
54526
 
54305
54527
  module.exports = ServiceProxy;
54306
54528
 
54307
- },{"./qbConfig":252,"./qbUtils":256,"form-data":81,"node-fetch":105}],255:[function(require,module,exports){
54529
+ },{"./qbConfig":253,"./qbUtils":257,"form-data":81,"node-fetch":105}],256:[function(require,module,exports){
54308
54530
  'use strict';
54309
54531
  /** JSHint inline rules */
54310
54532
  /* globals Strophe */
@@ -54353,7 +54575,7 @@ function Connection() {
54353
54575
 
54354
54576
  module.exports = Connection;
54355
54577
 
54356
- },{"./qbConfig":252,"./qbUtils":256,"strophe.js":208}],256:[function(require,module,exports){
54578
+ },{"./qbConfig":253,"./qbUtils":257,"strophe.js":208}],257:[function(require,module,exports){
54357
54579
  (function (global){(function (){
54358
54580
  /* eslint no-console: 2 */
54359
54581
 
@@ -54482,6 +54704,11 @@ var Utils = {
54482
54704
  return 'https://' + config.endpoints.api + '/' + base + resource + config.urls.type;
54483
54705
  },
54484
54706
 
54707
+ formatUrl: function(base, id) {
54708
+ var resource = id ? '/' + id : '';
54709
+ return 'https://' + config.endpoints.api + '/' + base + resource;
54710
+ },
54711
+
54485
54712
  isArray: function(arg) {
54486
54713
  return Object.prototype.toString.call(arg) === '[object Array]';
54487
54714
  },
@@ -54688,5 +54915,5 @@ var Utils = {
54688
54915
  module.exports = Utils;
54689
54916
 
54690
54917
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
54691
- },{"./qbConfig":252,"fs":32,"os":139}]},{},[253])(253)
54918
+ },{"./qbConfig":253,"fs":32,"os":139}]},{},[254])(254)
54692
54919
  });