quickblox 2.16.4 → 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/package.json +1 -1
- package/quickblox.d.ts +29 -1
- package/quickblox.js +219 -25
- package/quickblox.min.js +1 -1
- package/src/modules/qbAI.js +152 -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,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
|
-
|
|
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
|
@@ -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,161 @@ 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
|
+
/**
|
|
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){
|
|
48784
48938
|
'use strict';
|
|
48785
48939
|
|
|
48786
48940
|
var Utils = require('../qbUtils');
|
|
@@ -49005,7 +49159,7 @@ function isFunction(func) {
|
|
|
49005
49159
|
return !!(func && func.constructor && func.call && func.apply);
|
|
49006
49160
|
}
|
|
49007
49161
|
|
|
49008
|
-
},{"../qbConfig":
|
|
49162
|
+
},{"../qbConfig":253,"../qbUtils":257}],240:[function(require,module,exports){
|
|
49009
49163
|
'use strict';
|
|
49010
49164
|
|
|
49011
49165
|
var config = require('../qbConfig'),
|
|
@@ -49156,7 +49310,7 @@ function signMessage(message, secret) {
|
|
|
49156
49310
|
return cryptoSessionMsg;
|
|
49157
49311
|
}
|
|
49158
49312
|
|
|
49159
|
-
},{"../qbConfig":
|
|
49313
|
+
},{"../qbConfig":253,"../qbUtils":257,"crypto-js/hmac-sha1":51,"crypto-js/hmac-sha256":52}],241:[function(require,module,exports){
|
|
49160
49314
|
'use strict';
|
|
49161
49315
|
|
|
49162
49316
|
/*
|
|
@@ -49551,7 +49705,7 @@ parseUri.options = {
|
|
|
49551
49705
|
}
|
|
49552
49706
|
};
|
|
49553
49707
|
|
|
49554
|
-
},{"../qbConfig":
|
|
49708
|
+
},{"../qbConfig":253,"../qbUtils":257}],242:[function(require,module,exports){
|
|
49555
49709
|
'use strict';
|
|
49556
49710
|
|
|
49557
49711
|
var config = require('../qbConfig');
|
|
@@ -49933,7 +50087,7 @@ DataProxy.prototype = {
|
|
|
49933
50087
|
|
|
49934
50088
|
module.exports = DataProxy;
|
|
49935
50089
|
|
|
49936
|
-
},{"../qbConfig":
|
|
50090
|
+
},{"../qbConfig":253,"../qbUtils":257}],243:[function(require,module,exports){
|
|
49937
50091
|
(function (Buffer){(function (){
|
|
49938
50092
|
'use strict';
|
|
49939
50093
|
|
|
@@ -50172,7 +50326,7 @@ EventsProxy.prototype = {
|
|
|
50172
50326
|
module.exports = PushNotificationsProxy;
|
|
50173
50327
|
|
|
50174
50328
|
}).call(this)}).call(this,require("buffer").Buffer)
|
|
50175
|
-
},{"../qbConfig":
|
|
50329
|
+
},{"../qbConfig":253,"../qbUtils":257,"buffer":47}],244:[function(require,module,exports){
|
|
50176
50330
|
'use strict';
|
|
50177
50331
|
|
|
50178
50332
|
/*
|
|
@@ -50485,7 +50639,7 @@ function generateOrder(obj) {
|
|
|
50485
50639
|
return [obj.sort, type, obj.field].join(' ');
|
|
50486
50640
|
}
|
|
50487
50641
|
|
|
50488
|
-
},{"../qbConfig":
|
|
50642
|
+
},{"../qbConfig":253,"../qbUtils":257}],245:[function(require,module,exports){
|
|
50489
50643
|
'use strict';
|
|
50490
50644
|
|
|
50491
50645
|
/**
|
|
@@ -51288,7 +51442,7 @@ function setMediaBitrate(sdp, media, bitrate) {
|
|
|
51288
51442
|
|
|
51289
51443
|
module.exports = qbRTCPeerConnection;
|
|
51290
51444
|
|
|
51291
|
-
},{"../../qbConfig":
|
|
51445
|
+
},{"../../qbConfig":253,"./qbWebRTCHelpers":247}],246:[function(require,module,exports){
|
|
51292
51446
|
'use strict';
|
|
51293
51447
|
|
|
51294
51448
|
/**
|
|
@@ -51699,7 +51853,7 @@ function getOpponentsIdNASessions(sessions) {
|
|
|
51699
51853
|
return opponents;
|
|
51700
51854
|
}
|
|
51701
51855
|
|
|
51702
|
-
},{"../../qbConfig":
|
|
51856
|
+
},{"../../qbConfig":253,"../../qbUtils":257,"./qbRTCPeerConnection":245,"./qbWebRTCHelpers":247,"./qbWebRTCSession":248,"./qbWebRTCSignalingConstants":249,"./qbWebRTCSignalingProcessor":250,"./qbWebRTCSignalingProvider":251}],247:[function(require,module,exports){
|
|
51703
51857
|
'use strict';
|
|
51704
51858
|
|
|
51705
51859
|
/**
|
|
@@ -51845,7 +51999,7 @@ var WebRTCHelpers = {
|
|
|
51845
51999
|
|
|
51846
52000
|
module.exports = WebRTCHelpers;
|
|
51847
52001
|
|
|
51848
|
-
},{"../../qbConfig":
|
|
52002
|
+
},{"../../qbConfig":253}],248:[function(require,module,exports){
|
|
51849
52003
|
'use strict';
|
|
51850
52004
|
|
|
51851
52005
|
/**
|
|
@@ -53135,7 +53289,7 @@ function _prepareExtension(extension) {
|
|
|
53135
53289
|
|
|
53136
53290
|
module.exports = WebRTCSession;
|
|
53137
53291
|
|
|
53138
|
-
},{"../../qbConfig":
|
|
53292
|
+
},{"../../qbConfig":253,"../../qbUtils":257,"./qbRTCPeerConnection":245,"./qbWebRTCHelpers":247,"./qbWebRTCSignalingConstants":249}],249:[function(require,module,exports){
|
|
53139
53293
|
'use strict';
|
|
53140
53294
|
|
|
53141
53295
|
/**
|
|
@@ -53158,7 +53312,7 @@ WebRTCSignalingConstants.SignalingType = {
|
|
|
53158
53312
|
|
|
53159
53313
|
module.exports = WebRTCSignalingConstants;
|
|
53160
53314
|
|
|
53161
|
-
},{}],
|
|
53315
|
+
},{}],250:[function(require,module,exports){
|
|
53162
53316
|
'use strict';
|
|
53163
53317
|
|
|
53164
53318
|
/**
|
|
@@ -53316,7 +53470,7 @@ function WebRTCSignalingProcessor(service, delegate) {
|
|
|
53316
53470
|
|
|
53317
53471
|
module.exports = WebRTCSignalingProcessor;
|
|
53318
53472
|
|
|
53319
|
-
},{"./qbWebRTCSignalingConstants":
|
|
53473
|
+
},{"./qbWebRTCSignalingConstants":249,"strophe.js":208}],251:[function(require,module,exports){
|
|
53320
53474
|
'use strict';
|
|
53321
53475
|
|
|
53322
53476
|
/** JSHint inline rules */
|
|
@@ -53423,7 +53577,7 @@ WebRTCSignalingProvider.prototype._JStoXML = function (title, obj, msg) {
|
|
|
53423
53577
|
|
|
53424
53578
|
module.exports = WebRTCSignalingProvider;
|
|
53425
53579
|
|
|
53426
|
-
},{"../../qbConfig":
|
|
53580
|
+
},{"../../qbConfig":253,"../../qbUtils":257,"./qbWebRTCHelpers":247,"./qbWebRTCSignalingConstants":249,"strophe.js":208}],252:[function(require,module,exports){
|
|
53427
53581
|
'use strict';
|
|
53428
53582
|
|
|
53429
53583
|
/**
|
|
@@ -53660,7 +53814,7 @@ StreamManagement.prototype._increaseReceivedStanzasCounter = function(){
|
|
|
53660
53814
|
|
|
53661
53815
|
module.exports = StreamManagement;
|
|
53662
53816
|
|
|
53663
|
-
},{"../modules/chat/qbChatHelpers":235,"../qbUtils":
|
|
53817
|
+
},{"../modules/chat/qbChatHelpers":235,"../qbUtils":257}],253:[function(require,module,exports){
|
|
53664
53818
|
'use strict';
|
|
53665
53819
|
|
|
53666
53820
|
/*
|
|
@@ -53791,7 +53945,7 @@ config.updateSessionExpirationDate = function (tokenExpirationDate, headerHasTok
|
|
|
53791
53945
|
|
|
53792
53946
|
module.exports = config;
|
|
53793
53947
|
|
|
53794
|
-
},{}],
|
|
53948
|
+
},{}],254:[function(require,module,exports){
|
|
53795
53949
|
'use strict';
|
|
53796
53950
|
|
|
53797
53951
|
/*
|
|
@@ -53802,6 +53956,7 @@ module.exports = config;
|
|
|
53802
53956
|
*/
|
|
53803
53957
|
var config = require('./qbConfig');
|
|
53804
53958
|
var Utils = require('./qbUtils');
|
|
53959
|
+
const MessageProxy = require("./modules/chat/qbMessage");
|
|
53805
53960
|
|
|
53806
53961
|
// Actual QuickBlox API starts here
|
|
53807
53962
|
function QuickBlox() {}
|
|
@@ -53857,7 +54012,8 @@ QuickBlox.prototype = {
|
|
|
53857
54012
|
AddressBook = require('./modules/qbAddressBook'),
|
|
53858
54013
|
Chat = require('./modules/chat/qbChat'),
|
|
53859
54014
|
DialogProxy = require('./modules/chat/qbDialog'),
|
|
53860
|
-
MessageProxy = require('./modules/chat/qbMessage')
|
|
54015
|
+
MessageProxy = require('./modules/chat/qbMessage'),
|
|
54016
|
+
AIProxy = require('./modules/qbAI');
|
|
53861
54017
|
|
|
53862
54018
|
this.service = new Proxy();
|
|
53863
54019
|
this.auth = new Auth(this.service);
|
|
@@ -53869,6 +54025,7 @@ QuickBlox.prototype = {
|
|
|
53869
54025
|
this.chat = new Chat(this.service);
|
|
53870
54026
|
this.chat.dialog = new DialogProxy(this.service);
|
|
53871
54027
|
this.chat.message = new MessageProxy(this.service);
|
|
54028
|
+
this.ai = new AIProxy(this.service);
|
|
53872
54029
|
|
|
53873
54030
|
if (Utils.getEnv().browser) {
|
|
53874
54031
|
/** add adapter.js*/
|
|
@@ -54070,7 +54227,7 @@ QB.QuickBlox = QuickBlox;
|
|
|
54070
54227
|
|
|
54071
54228
|
module.exports = QB;
|
|
54072
54229
|
|
|
54073
|
-
},{"./modules/chat/qbChat":234,"./modules/chat/qbDialog":236,"./modules/chat/qbMessage":237,"./modules/
|
|
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){
|
|
54074
54231
|
'use strict';
|
|
54075
54232
|
|
|
54076
54233
|
var config = require('./qbConfig');
|
|
@@ -54208,7 +54365,39 @@ ServiceProxy.prototype = {
|
|
|
54208
54365
|
if (config.timeout) {
|
|
54209
54366
|
qbRequest.timeout = config.timeout;
|
|
54210
54367
|
}
|
|
54211
|
-
|
|
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
|
|
54212
54401
|
qbFetch(qbUrl, qbRequest)
|
|
54213
54402
|
.then(function(response) {
|
|
54214
54403
|
qbResponse = response;
|
|
@@ -54337,7 +54526,7 @@ ServiceProxy.prototype = {
|
|
|
54337
54526
|
|
|
54338
54527
|
module.exports = ServiceProxy;
|
|
54339
54528
|
|
|
54340
|
-
},{"./qbConfig":
|
|
54529
|
+
},{"./qbConfig":253,"./qbUtils":257,"form-data":81,"node-fetch":105}],256:[function(require,module,exports){
|
|
54341
54530
|
'use strict';
|
|
54342
54531
|
/** JSHint inline rules */
|
|
54343
54532
|
/* globals Strophe */
|
|
@@ -54386,7 +54575,7 @@ function Connection() {
|
|
|
54386
54575
|
|
|
54387
54576
|
module.exports = Connection;
|
|
54388
54577
|
|
|
54389
|
-
},{"./qbConfig":
|
|
54578
|
+
},{"./qbConfig":253,"./qbUtils":257,"strophe.js":208}],257:[function(require,module,exports){
|
|
54390
54579
|
(function (global){(function (){
|
|
54391
54580
|
/* eslint no-console: 2 */
|
|
54392
54581
|
|
|
@@ -54515,6 +54704,11 @@ var Utils = {
|
|
|
54515
54704
|
return 'https://' + config.endpoints.api + '/' + base + resource + config.urls.type;
|
|
54516
54705
|
},
|
|
54517
54706
|
|
|
54707
|
+
formatUrl: function(base, id) {
|
|
54708
|
+
var resource = id ? '/' + id : '';
|
|
54709
|
+
return 'https://' + config.endpoints.api + '/' + base + resource;
|
|
54710
|
+
},
|
|
54711
|
+
|
|
54518
54712
|
isArray: function(arg) {
|
|
54519
54713
|
return Object.prototype.toString.call(arg) === '[object Array]';
|
|
54520
54714
|
},
|
|
@@ -54721,5 +54915,5 @@ var Utils = {
|
|
|
54721
54915
|
module.exports = Utils;
|
|
54722
54916
|
|
|
54723
54917
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
54724
|
-
},{"./qbConfig":
|
|
54918
|
+
},{"./qbConfig":253,"fs":32,"os":139}]},{},[254])(254)
|
|
54725
54919
|
});
|