quickblox 2.16.4 → 2.17.0-beta.2
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 +1 -1
- package/quickblox.d.ts +33 -1
- package/quickblox.js +201 -25
- package/quickblox.min.js +1 -1
- package/src/modules/qbAI.js +134 -0
- package/src/qbMain.js +4 -1
- package/src/qbProxy.js +33 -1
- package/src/qbUtils.js +5 -0
package/package.json
CHANGED
package/quickblox.d.ts
CHANGED
|
@@ -413,6 +413,35 @@ 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
|
+
message: string;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export interface AIAnswerResponse {
|
|
427
|
+
answer: string;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export declare type AIChatHistory = AIChatMessage[] | null | undefined;
|
|
431
|
+
|
|
432
|
+
interface QBAIModule{
|
|
433
|
+
//QB.ai.answerAssist
|
|
434
|
+
answerAssist(smartChatAssistantId: string,
|
|
435
|
+
message: string,
|
|
436
|
+
history :AIChatHistory,
|
|
437
|
+
callback: QBCallback<AIAnswerResponse>): void
|
|
438
|
+
//QB.ai.translate
|
|
439
|
+
translate(smartChatAssistantId: string,
|
|
440
|
+
message: string,
|
|
441
|
+
languageCode: string,
|
|
442
|
+
callback: QBCallback<AIAnswerResponse>): void
|
|
443
|
+
|
|
444
|
+
}
|
|
416
445
|
|
|
417
446
|
interface QBChatModule {
|
|
418
447
|
isConnected: boolean
|
|
@@ -549,7 +578,7 @@ interface QBChatModule {
|
|
|
549
578
|
/** Send is delivered status. */
|
|
550
579
|
sendDeliveredStatus(params: QBMessageStatusParams): void
|
|
551
580
|
ping(jidOrUserId: string | number, callback: QBCallback<any>): string
|
|
552
|
-
|
|
581
|
+
pingchat(callback: QBCallback<any>): string
|
|
553
582
|
|
|
554
583
|
dialog: {
|
|
555
584
|
/**
|
|
@@ -750,6 +779,7 @@ interface QBChatModule {
|
|
|
750
779
|
/** Get user jid from current user. */
|
|
751
780
|
getUserCurrentJid(): string
|
|
752
781
|
}
|
|
782
|
+
|
|
753
783
|
}
|
|
754
784
|
|
|
755
785
|
export declare interface QBDataFile {
|
|
@@ -1518,6 +1548,8 @@ export class QuickBlox {
|
|
|
1518
1548
|
|
|
1519
1549
|
chat: QBChatModule
|
|
1520
1550
|
|
|
1551
|
+
ai: QBAIModule
|
|
1552
|
+
|
|
1521
1553
|
content: QBContentModule
|
|
1522
1554
|
|
|
1523
1555
|
data: QBDataModule
|
package/quickblox.js
CHANGED
|
@@ -48195,7 +48195,7 @@ Helpers.prototype = {
|
|
|
48195
48195
|
* */
|
|
48196
48196
|
module.exports = ChatProxy;
|
|
48197
48197
|
|
|
48198
|
-
},{"../../plugins/streamManagement":
|
|
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){
|
|
48199
48199
|
'use strict';
|
|
48200
48200
|
|
|
48201
48201
|
var utils = require('../../qbUtils');
|
|
@@ -48516,7 +48516,7 @@ var qbChatHelpers = {
|
|
|
48516
48516
|
|
|
48517
48517
|
module.exports = qbChatHelpers;
|
|
48518
48518
|
|
|
48519
|
-
},{"../../qbConfig":
|
|
48519
|
+
},{"../../qbConfig":253,"../../qbUtils":257}],236:[function(require,module,exports){
|
|
48520
48520
|
'use strict';
|
|
48521
48521
|
|
|
48522
48522
|
var config = require('../../qbConfig'),
|
|
@@ -48638,7 +48638,7 @@ DialogProxy.prototype = {
|
|
|
48638
48638
|
|
|
48639
48639
|
module.exports = DialogProxy;
|
|
48640
48640
|
|
|
48641
|
-
},{"../../qbConfig":
|
|
48641
|
+
},{"../../qbConfig":253,"../../qbUtils":257}],237:[function(require,module,exports){
|
|
48642
48642
|
'use strict';
|
|
48643
48643
|
|
|
48644
48644
|
var config = require('../../qbConfig'),
|
|
@@ -48780,7 +48780,143 @@ MessageProxy.prototype = {
|
|
|
48780
48780
|
|
|
48781
48781
|
module.exports = MessageProxy;
|
|
48782
48782
|
|
|
48783
|
-
},{"../../qbConfig":
|
|
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
|
+
* 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}).
|
|
48800
|
+
* @memberof QB.ai
|
|
48801
|
+
* @param {String} smartChatAssistantId - Smart Chat Assistant id.
|
|
48802
|
+
* @param {String} message - Message you want to get answer for.
|
|
48803
|
+
* @param {Object[]} history - Conversation history. Used to add context.
|
|
48804
|
+
* @param {answerAssistCallback} callback - The callback function.
|
|
48805
|
+
* @example
|
|
48806
|
+
* var history = [
|
|
48807
|
+
* {role: "user", message: "Hello"},
|
|
48808
|
+
* {role: "assistant", message: "Hi"}
|
|
48809
|
+
* ];
|
|
48810
|
+
* var messageToAssist = 'Where is my order?';
|
|
48811
|
+
* QB.ai.answerAssist(smartChatAssistantId, messageToAssist, history, callback);
|
|
48812
|
+
* // or third parameters can be null
|
|
48813
|
+
* QB.ai.answerAssist(smartChatAssistantId, messageToAssist, null, callback);
|
|
48814
|
+
* */
|
|
48815
|
+
answerAssist: function(smartChatAssistantId, message, history, callback) {
|
|
48816
|
+
/**
|
|
48817
|
+
* Callback for QB.ai.answerAssist().
|
|
48818
|
+
* @param {Object} error - The error object.
|
|
48819
|
+
* @param {Object} response - The server response object.
|
|
48820
|
+
* @param {String} [response.answer] - assist answer for message
|
|
48821
|
+
* @callback answerAssistCallback
|
|
48822
|
+
* */
|
|
48823
|
+
if (!callback || typeof callback !== 'function') {
|
|
48824
|
+
throw new Error('Callback function is required and must be a function');
|
|
48825
|
+
}
|
|
48826
|
+
function validateHistory(history) {
|
|
48827
|
+
var AIRole = {
|
|
48828
|
+
user: 'user',
|
|
48829
|
+
assistant: 'assistant'
|
|
48830
|
+
};
|
|
48831
|
+
if (history !== null && history !== undefined) {
|
|
48832
|
+
if (!Array.isArray(history)) {
|
|
48833
|
+
throw new Error('History must be an array');
|
|
48834
|
+
}
|
|
48835
|
+
for (var i = 0; i < history.length; i++) {
|
|
48836
|
+
var item = history[i];
|
|
48837
|
+
if (typeof item !== 'object' || item === null || Array.isArray(item)) {
|
|
48838
|
+
throw new Error('Each element of history must be an object');
|
|
48839
|
+
}
|
|
48840
|
+
if (!('role' in item) || !('message' in item)) {
|
|
48841
|
+
throw new Error('Each element of history must have an role and message fields');
|
|
48842
|
+
}
|
|
48843
|
+
if (!(item.role === AIRole.user || item.role === AIRole.assistant)) {
|
|
48844
|
+
throw new Error('Invalid role in history item');
|
|
48845
|
+
}
|
|
48846
|
+
if (typeof item.message !== 'string') {
|
|
48847
|
+
throw new Error('Message of history item must be a string');
|
|
48848
|
+
}
|
|
48849
|
+
}
|
|
48850
|
+
}
|
|
48851
|
+
return true;
|
|
48852
|
+
}
|
|
48853
|
+
if (!validateHistory(history)) {
|
|
48854
|
+
return;
|
|
48855
|
+
}
|
|
48856
|
+
|
|
48857
|
+
var data = history ? {
|
|
48858
|
+
smart_chat_assistant_id: smartChatAssistantId,
|
|
48859
|
+
message: message,
|
|
48860
|
+
history: history,
|
|
48861
|
+
}:{
|
|
48862
|
+
smart_chat_assistant_id: smartChatAssistantId,
|
|
48863
|
+
message: message,
|
|
48864
|
+
};
|
|
48865
|
+
var attrAjax = {
|
|
48866
|
+
'type': 'POST',
|
|
48867
|
+
'url': Utils.formatUrl(AI_API_URL + '/ai_answer_assist'),
|
|
48868
|
+
'data': data,
|
|
48869
|
+
'contentType': 'application/json; charset=utf-8',
|
|
48870
|
+
'isNeedStringify': true
|
|
48871
|
+
};
|
|
48872
|
+
this.service.ajax(attrAjax, callback);
|
|
48873
|
+
},
|
|
48874
|
+
|
|
48875
|
+
/**
|
|
48876
|
+
* 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}).
|
|
48877
|
+
* @memberof QB.ai
|
|
48878
|
+
* @param {String} smartChatAssistantId - Smart Chat Assistant id.
|
|
48879
|
+
* @param {String} text - Text to translate.
|
|
48880
|
+
* @param {String} languageCode - Translation language code. All list see on page: {@link https://docs.quickblox.com/docs/js-sdk-ai-features#ai-translate }
|
|
48881
|
+
* @param {translateCallback} callback - The callback function.
|
|
48882
|
+
*
|
|
48883
|
+
* */
|
|
48884
|
+
|
|
48885
|
+
translate: function(smartChatAssistantId, text, languageCode, callback) {
|
|
48886
|
+
/**
|
|
48887
|
+
* Callback for QB.ai.translate().
|
|
48888
|
+
* @param {Object} error - The error object.
|
|
48889
|
+
* @param {Object} response - The server response object.
|
|
48890
|
+
* @param {String} [response.answer] - translated message
|
|
48891
|
+
* @callback translateCallback
|
|
48892
|
+
* @example
|
|
48893
|
+
* var textToTranslate = 'Hola!';
|
|
48894
|
+
* var languageCode = 'en';
|
|
48895
|
+
* QB.ai.translate(smartChatAssistantId, textToTranslate, languageCode, callback);
|
|
48896
|
+
* */
|
|
48897
|
+
if (!callback || typeof callback !== 'function') {
|
|
48898
|
+
throw new Error('Callback function is required and must be a function');
|
|
48899
|
+
}
|
|
48900
|
+
var data = {
|
|
48901
|
+
smart_chat_assistant_id: smartChatAssistantId,
|
|
48902
|
+
text: text,
|
|
48903
|
+
to_language: languageCode || 'en',
|
|
48904
|
+
};
|
|
48905
|
+
var attrAjax = {
|
|
48906
|
+
'type': 'POST',
|
|
48907
|
+
'url': Utils.formatUrl(AI_API_URL + '/ai_translate'),
|
|
48908
|
+
'data': data,
|
|
48909
|
+
};
|
|
48910
|
+
|
|
48911
|
+
this.service.ajax(attrAjax, callback);
|
|
48912
|
+
},
|
|
48913
|
+
|
|
48914
|
+
|
|
48915
|
+
};
|
|
48916
|
+
|
|
48917
|
+
module.exports = AIProxy;
|
|
48918
|
+
|
|
48919
|
+
},{"../qbUtils":257}],239:[function(require,module,exports){
|
|
48784
48920
|
'use strict';
|
|
48785
48921
|
|
|
48786
48922
|
var Utils = require('../qbUtils');
|
|
@@ -49005,7 +49141,7 @@ function isFunction(func) {
|
|
|
49005
49141
|
return !!(func && func.constructor && func.call && func.apply);
|
|
49006
49142
|
}
|
|
49007
49143
|
|
|
49008
|
-
},{"../qbConfig":
|
|
49144
|
+
},{"../qbConfig":253,"../qbUtils":257}],240:[function(require,module,exports){
|
|
49009
49145
|
'use strict';
|
|
49010
49146
|
|
|
49011
49147
|
var config = require('../qbConfig'),
|
|
@@ -49156,7 +49292,7 @@ function signMessage(message, secret) {
|
|
|
49156
49292
|
return cryptoSessionMsg;
|
|
49157
49293
|
}
|
|
49158
49294
|
|
|
49159
|
-
},{"../qbConfig":
|
|
49295
|
+
},{"../qbConfig":253,"../qbUtils":257,"crypto-js/hmac-sha1":51,"crypto-js/hmac-sha256":52}],241:[function(require,module,exports){
|
|
49160
49296
|
'use strict';
|
|
49161
49297
|
|
|
49162
49298
|
/*
|
|
@@ -49551,7 +49687,7 @@ parseUri.options = {
|
|
|
49551
49687
|
}
|
|
49552
49688
|
};
|
|
49553
49689
|
|
|
49554
|
-
},{"../qbConfig":
|
|
49690
|
+
},{"../qbConfig":253,"../qbUtils":257}],242:[function(require,module,exports){
|
|
49555
49691
|
'use strict';
|
|
49556
49692
|
|
|
49557
49693
|
var config = require('../qbConfig');
|
|
@@ -49933,7 +50069,7 @@ DataProxy.prototype = {
|
|
|
49933
50069
|
|
|
49934
50070
|
module.exports = DataProxy;
|
|
49935
50071
|
|
|
49936
|
-
},{"../qbConfig":
|
|
50072
|
+
},{"../qbConfig":253,"../qbUtils":257}],243:[function(require,module,exports){
|
|
49937
50073
|
(function (Buffer){(function (){
|
|
49938
50074
|
'use strict';
|
|
49939
50075
|
|
|
@@ -50172,7 +50308,7 @@ EventsProxy.prototype = {
|
|
|
50172
50308
|
module.exports = PushNotificationsProxy;
|
|
50173
50309
|
|
|
50174
50310
|
}).call(this)}).call(this,require("buffer").Buffer)
|
|
50175
|
-
},{"../qbConfig":
|
|
50311
|
+
},{"../qbConfig":253,"../qbUtils":257,"buffer":47}],244:[function(require,module,exports){
|
|
50176
50312
|
'use strict';
|
|
50177
50313
|
|
|
50178
50314
|
/*
|
|
@@ -50485,7 +50621,7 @@ function generateOrder(obj) {
|
|
|
50485
50621
|
return [obj.sort, type, obj.field].join(' ');
|
|
50486
50622
|
}
|
|
50487
50623
|
|
|
50488
|
-
},{"../qbConfig":
|
|
50624
|
+
},{"../qbConfig":253,"../qbUtils":257}],245:[function(require,module,exports){
|
|
50489
50625
|
'use strict';
|
|
50490
50626
|
|
|
50491
50627
|
/**
|
|
@@ -51288,7 +51424,7 @@ function setMediaBitrate(sdp, media, bitrate) {
|
|
|
51288
51424
|
|
|
51289
51425
|
module.exports = qbRTCPeerConnection;
|
|
51290
51426
|
|
|
51291
|
-
},{"../../qbConfig":
|
|
51427
|
+
},{"../../qbConfig":253,"./qbWebRTCHelpers":247}],246:[function(require,module,exports){
|
|
51292
51428
|
'use strict';
|
|
51293
51429
|
|
|
51294
51430
|
/**
|
|
@@ -51699,7 +51835,7 @@ function getOpponentsIdNASessions(sessions) {
|
|
|
51699
51835
|
return opponents;
|
|
51700
51836
|
}
|
|
51701
51837
|
|
|
51702
|
-
},{"../../qbConfig":
|
|
51838
|
+
},{"../../qbConfig":253,"../../qbUtils":257,"./qbRTCPeerConnection":245,"./qbWebRTCHelpers":247,"./qbWebRTCSession":248,"./qbWebRTCSignalingConstants":249,"./qbWebRTCSignalingProcessor":250,"./qbWebRTCSignalingProvider":251}],247:[function(require,module,exports){
|
|
51703
51839
|
'use strict';
|
|
51704
51840
|
|
|
51705
51841
|
/**
|
|
@@ -51845,7 +51981,7 @@ var WebRTCHelpers = {
|
|
|
51845
51981
|
|
|
51846
51982
|
module.exports = WebRTCHelpers;
|
|
51847
51983
|
|
|
51848
|
-
},{"../../qbConfig":
|
|
51984
|
+
},{"../../qbConfig":253}],248:[function(require,module,exports){
|
|
51849
51985
|
'use strict';
|
|
51850
51986
|
|
|
51851
51987
|
/**
|
|
@@ -53135,7 +53271,7 @@ function _prepareExtension(extension) {
|
|
|
53135
53271
|
|
|
53136
53272
|
module.exports = WebRTCSession;
|
|
53137
53273
|
|
|
53138
|
-
},{"../../qbConfig":
|
|
53274
|
+
},{"../../qbConfig":253,"../../qbUtils":257,"./qbRTCPeerConnection":245,"./qbWebRTCHelpers":247,"./qbWebRTCSignalingConstants":249}],249:[function(require,module,exports){
|
|
53139
53275
|
'use strict';
|
|
53140
53276
|
|
|
53141
53277
|
/**
|
|
@@ -53158,7 +53294,7 @@ WebRTCSignalingConstants.SignalingType = {
|
|
|
53158
53294
|
|
|
53159
53295
|
module.exports = WebRTCSignalingConstants;
|
|
53160
53296
|
|
|
53161
|
-
},{}],
|
|
53297
|
+
},{}],250:[function(require,module,exports){
|
|
53162
53298
|
'use strict';
|
|
53163
53299
|
|
|
53164
53300
|
/**
|
|
@@ -53316,7 +53452,7 @@ function WebRTCSignalingProcessor(service, delegate) {
|
|
|
53316
53452
|
|
|
53317
53453
|
module.exports = WebRTCSignalingProcessor;
|
|
53318
53454
|
|
|
53319
|
-
},{"./qbWebRTCSignalingConstants":
|
|
53455
|
+
},{"./qbWebRTCSignalingConstants":249,"strophe.js":208}],251:[function(require,module,exports){
|
|
53320
53456
|
'use strict';
|
|
53321
53457
|
|
|
53322
53458
|
/** JSHint inline rules */
|
|
@@ -53423,7 +53559,7 @@ WebRTCSignalingProvider.prototype._JStoXML = function (title, obj, msg) {
|
|
|
53423
53559
|
|
|
53424
53560
|
module.exports = WebRTCSignalingProvider;
|
|
53425
53561
|
|
|
53426
|
-
},{"../../qbConfig":
|
|
53562
|
+
},{"../../qbConfig":253,"../../qbUtils":257,"./qbWebRTCHelpers":247,"./qbWebRTCSignalingConstants":249,"strophe.js":208}],252:[function(require,module,exports){
|
|
53427
53563
|
'use strict';
|
|
53428
53564
|
|
|
53429
53565
|
/**
|
|
@@ -53660,7 +53796,7 @@ StreamManagement.prototype._increaseReceivedStanzasCounter = function(){
|
|
|
53660
53796
|
|
|
53661
53797
|
module.exports = StreamManagement;
|
|
53662
53798
|
|
|
53663
|
-
},{"../modules/chat/qbChatHelpers":235,"../qbUtils":
|
|
53799
|
+
},{"../modules/chat/qbChatHelpers":235,"../qbUtils":257}],253:[function(require,module,exports){
|
|
53664
53800
|
'use strict';
|
|
53665
53801
|
|
|
53666
53802
|
/*
|
|
@@ -53791,7 +53927,7 @@ config.updateSessionExpirationDate = function (tokenExpirationDate, headerHasTok
|
|
|
53791
53927
|
|
|
53792
53928
|
module.exports = config;
|
|
53793
53929
|
|
|
53794
|
-
},{}],
|
|
53930
|
+
},{}],254:[function(require,module,exports){
|
|
53795
53931
|
'use strict';
|
|
53796
53932
|
|
|
53797
53933
|
/*
|
|
@@ -53802,6 +53938,7 @@ module.exports = config;
|
|
|
53802
53938
|
*/
|
|
53803
53939
|
var config = require('./qbConfig');
|
|
53804
53940
|
var Utils = require('./qbUtils');
|
|
53941
|
+
const MessageProxy = require("./modules/chat/qbMessage");
|
|
53805
53942
|
|
|
53806
53943
|
// Actual QuickBlox API starts here
|
|
53807
53944
|
function QuickBlox() {}
|
|
@@ -53857,7 +53994,8 @@ QuickBlox.prototype = {
|
|
|
53857
53994
|
AddressBook = require('./modules/qbAddressBook'),
|
|
53858
53995
|
Chat = require('./modules/chat/qbChat'),
|
|
53859
53996
|
DialogProxy = require('./modules/chat/qbDialog'),
|
|
53860
|
-
MessageProxy = require('./modules/chat/qbMessage')
|
|
53997
|
+
MessageProxy = require('./modules/chat/qbMessage'),
|
|
53998
|
+
AIProxy = require('./modules/qbAI');
|
|
53861
53999
|
|
|
53862
54000
|
this.service = new Proxy();
|
|
53863
54001
|
this.auth = new Auth(this.service);
|
|
@@ -53869,6 +54007,7 @@ QuickBlox.prototype = {
|
|
|
53869
54007
|
this.chat = new Chat(this.service);
|
|
53870
54008
|
this.chat.dialog = new DialogProxy(this.service);
|
|
53871
54009
|
this.chat.message = new MessageProxy(this.service);
|
|
54010
|
+
this.ai = new AIProxy(this.service);
|
|
53872
54011
|
|
|
53873
54012
|
if (Utils.getEnv().browser) {
|
|
53874
54013
|
/** add adapter.js*/
|
|
@@ -54070,7 +54209,7 @@ QB.QuickBlox = QuickBlox;
|
|
|
54070
54209
|
|
|
54071
54210
|
module.exports = QB;
|
|
54072
54211
|
|
|
54073
|
-
},{"./modules/chat/qbChat":234,"./modules/chat/qbDialog":236,"./modules/chat/qbMessage":237,"./modules/
|
|
54212
|
+
},{"./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){
|
|
54074
54213
|
'use strict';
|
|
54075
54214
|
|
|
54076
54215
|
var config = require('./qbConfig');
|
|
@@ -54208,7 +54347,39 @@ ServiceProxy.prototype = {
|
|
|
54208
54347
|
if (config.timeout) {
|
|
54209
54348
|
qbRequest.timeout = config.timeout;
|
|
54210
54349
|
}
|
|
54211
|
-
|
|
54350
|
+
//browser only version
|
|
54351
|
+
// fetch(qbUrl, qbRequest)
|
|
54352
|
+
// .then(function(response){
|
|
54353
|
+
// qbResponse = response;
|
|
54354
|
+
// if (qbRequest.method === 'GET' || qbRequest.method === 'POST'){
|
|
54355
|
+
// var qbTokenExpirationDate = qbResponse.headers.get('qb-token-expirationdate');
|
|
54356
|
+
// var headerHasToken = !(qbTokenExpirationDate === null ||
|
|
54357
|
+
// typeof qbTokenExpirationDate === 'undefined');
|
|
54358
|
+
// qbTokenExpirationDate = headerHasToken ? qbTokenExpirationDate : new Date();
|
|
54359
|
+
// self.qbInst.config.updateSessionExpirationDate(qbTokenExpirationDate, headerHasToken);
|
|
54360
|
+
// console.log('[Request][fetch]','header has token:',headerHasToken );
|
|
54361
|
+
// console.log('[Request][fetch]','updateSessionExpirationDate ... Set value: ', self.qbInst.config.qbTokenExpirationDate );
|
|
54362
|
+
// }
|
|
54363
|
+
// if (qbDataType === 'text') {
|
|
54364
|
+
// return response.text();
|
|
54365
|
+
// } else {
|
|
54366
|
+
// return response.json();
|
|
54367
|
+
// }
|
|
54368
|
+
// }).catch((error) => {
|
|
54369
|
+
// console.log('fetch Error: ', error);
|
|
54370
|
+
// qbResponse = {
|
|
54371
|
+
// status: 200
|
|
54372
|
+
// };
|
|
54373
|
+
// console.log('reason: ', error);
|
|
54374
|
+
// return ' ';
|
|
54375
|
+
// }).then(function(body){
|
|
54376
|
+
// _requestCallback(null, qbResponse, body);
|
|
54377
|
+
// }).catch((error) => {
|
|
54378
|
+
// console.log('Fetch error: ', error);
|
|
54379
|
+
// _requestCallback(error);
|
|
54380
|
+
// });
|
|
54381
|
+
|
|
54382
|
+
// original version
|
|
54212
54383
|
qbFetch(qbUrl, qbRequest)
|
|
54213
54384
|
.then(function(response) {
|
|
54214
54385
|
qbResponse = response;
|
|
@@ -54337,7 +54508,7 @@ ServiceProxy.prototype = {
|
|
|
54337
54508
|
|
|
54338
54509
|
module.exports = ServiceProxy;
|
|
54339
54510
|
|
|
54340
|
-
},{"./qbConfig":
|
|
54511
|
+
},{"./qbConfig":253,"./qbUtils":257,"form-data":81,"node-fetch":105}],256:[function(require,module,exports){
|
|
54341
54512
|
'use strict';
|
|
54342
54513
|
/** JSHint inline rules */
|
|
54343
54514
|
/* globals Strophe */
|
|
@@ -54386,7 +54557,7 @@ function Connection() {
|
|
|
54386
54557
|
|
|
54387
54558
|
module.exports = Connection;
|
|
54388
54559
|
|
|
54389
|
-
},{"./qbConfig":
|
|
54560
|
+
},{"./qbConfig":253,"./qbUtils":257,"strophe.js":208}],257:[function(require,module,exports){
|
|
54390
54561
|
(function (global){(function (){
|
|
54391
54562
|
/* eslint no-console: 2 */
|
|
54392
54563
|
|
|
@@ -54515,6 +54686,11 @@ var Utils = {
|
|
|
54515
54686
|
return 'https://' + config.endpoints.api + '/' + base + resource + config.urls.type;
|
|
54516
54687
|
},
|
|
54517
54688
|
|
|
54689
|
+
formatUrl: function(base, id) {
|
|
54690
|
+
var resource = id ? '/' + id : '';
|
|
54691
|
+
return 'https://' + config.endpoints.api + '/' + base + resource;
|
|
54692
|
+
},
|
|
54693
|
+
|
|
54518
54694
|
isArray: function(arg) {
|
|
54519
54695
|
return Object.prototype.toString.call(arg) === '[object Array]';
|
|
54520
54696
|
},
|
|
@@ -54721,5 +54897,5 @@ var Utils = {
|
|
|
54721
54897
|
module.exports = Utils;
|
|
54722
54898
|
|
|
54723
54899
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
54724
|
-
},{"./qbConfig":
|
|
54900
|
+
},{"./qbConfig":253,"fs":32,"os":139}]},{},[254])(254)
|
|
54725
54901
|
});
|