podchat-browser 12.9.2 → 12.9.4
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/changelog.md +18 -0
- package/dist/node/buildConfig.json +1 -1
- package/dist/node/chat.js +131 -122
- package/dist/node/lib/sdkParams.js +19 -0
- package/dist/podchat-browser-bundle.js +160 -130
- package/examples/index.html +20 -0
- package/package.json +2 -2
- package/src/buildConfig.json +1 -1
- package/src/chat.js +225 -207
- package/src/lib/sdkParams.js +13 -0
package/src/chat.js
CHANGED
|
@@ -22,27 +22,32 @@ import {
|
|
|
22
22
|
|
|
23
23
|
import deviceManager from "./lib/call/deviceManager.js";
|
|
24
24
|
import {store} from "./lib/store";
|
|
25
|
+
import {sdkParams} from "./lib/sdkParams";
|
|
25
26
|
|
|
26
27
|
function Chat(params) {
|
|
27
28
|
/*******************************************************
|
|
28
29
|
* P R I V A T E V A R I A B L E S *
|
|
29
30
|
*******************************************************/
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
sdkParams.token = params.token || "111";
|
|
32
|
+
sdkParams.generalTypeCode = params.typeCode || 'default';
|
|
33
|
+
sdkParams.typeCodeOwnerId = params.typeCodeOwnerId || null;
|
|
34
|
+
sdkParams.mapApiKey = params.mapApiKey || '8b77db18704aa646ee5aaea13e7370f4f88b9e8c';
|
|
35
|
+
sdkParams.productEnv = (typeof navigator != 'undefined') ? navigator.product : 'undefined';
|
|
36
|
+
sdkParams.forceWaitQueueInMemory = (params.forceWaitQueueInMemory && typeof params.forceWaitQueueInMemory === 'boolean') ? params.forceWaitQueueInMemory : false;
|
|
37
|
+
sdkParams.grantDeviceIdFromSSO = (params.grantDeviceIdFromSSO && typeof params.grantDeviceIdFromSSO === 'boolean')
|
|
38
|
+
? params.grantDeviceIdFromSSO
|
|
39
|
+
: false;
|
|
40
|
+
sdkParams.deliveryIntervalPitch = params.deliveryIntervalPitch || 2000;
|
|
41
|
+
sdkParams.seenIntervalPitch = params.seenIntervalPitch || 2000;
|
|
42
|
+
sdkParams.systemMessageIntervalPitch = params.systemMessageIntervalPitch || 1000;
|
|
32
43
|
var asyncClient,
|
|
33
44
|
peerId,
|
|
34
45
|
oldPeerId,
|
|
35
|
-
token = params.token || "111",
|
|
36
|
-
generalTypeCode = params.typeCode || 'default',
|
|
37
|
-
typeCodeOwnerId = params.typeCodeOwnerId || null,
|
|
38
|
-
mapApiKey = params.mapApiKey || '8b77db18704aa646ee5aaea13e7370f4f88b9e8c',
|
|
39
46
|
deviceId,
|
|
40
|
-
productEnv = (typeof navigator != 'undefined') ? navigator.product : 'undefined',
|
|
41
47
|
db,
|
|
42
48
|
queueDb,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
cacheInMemory = forceWaitQueueInMemory ? true : !hasCache,
|
|
49
|
+
hasCache = sdkParams.productEnv !== 'ReactNative' && typeof Dexie != 'undefined',
|
|
50
|
+
cacheInMemory = sdkParams.forceWaitQueueInMemory ? true : !hasCache,
|
|
46
51
|
enableCache = (params.enableCache && typeof params.enableCache === 'boolean') ? params.enableCache : false,
|
|
47
52
|
canUseCache = hasCache && enableCache,
|
|
48
53
|
isCacheReady = false,
|
|
@@ -50,22 +55,16 @@ function Chat(params) {
|
|
|
50
55
|
cacheExpireTime = params.cacheExpireTime || 2 * 24 * 60 * 60 * 1000,
|
|
51
56
|
cacheSecret = 'VjaaS9YxNdVVAd3cAsRPcU5FyxRcyyV6tG6bFGjjK5RV8JJjLrXNbS5zZxnqUT6Y',
|
|
52
57
|
cacheSyncWorker,
|
|
53
|
-
grantDeviceIdFromSSO = (params.grantDeviceIdFromSSO && typeof params.grantDeviceIdFromSSO === 'boolean')
|
|
54
|
-
? params.grantDeviceIdFromSSO
|
|
55
|
-
: false,
|
|
56
58
|
messagesDelivery = {},
|
|
57
59
|
messagesSeen = {},
|
|
58
60
|
deliveryInterval,
|
|
59
|
-
deliveryIntervalPitch = params.deliveryIntervalPitch || 2000,
|
|
60
61
|
seenInterval,
|
|
61
|
-
seenIntervalPitch = params.seenIntervalPitch || 2000,
|
|
62
62
|
getImageFromLinkObjects = {},
|
|
63
63
|
locationPingTypes = {
|
|
64
64
|
'CHAT': 1,
|
|
65
65
|
'THREAD': 2,
|
|
66
66
|
'CONTACTS': 3
|
|
67
67
|
},
|
|
68
|
-
systemMessageIntervalPitch = params.systemMessageIntervalPitch || 1000,
|
|
69
68
|
isTypingInterval,
|
|
70
69
|
protocol = params.protocol || 'websocket',
|
|
71
70
|
queueHost = params.queueHost,
|
|
@@ -204,8 +203,8 @@ function Chat(params) {
|
|
|
204
203
|
asyncClient: asyncClient,
|
|
205
204
|
//Utility: Utility,
|
|
206
205
|
consoleLogging: consoleLogging,
|
|
207
|
-
generalTypeCode: generalTypeCode,
|
|
208
|
-
typeCodeOwnerId,
|
|
206
|
+
generalTypeCode: sdkParams.generalTypeCode,
|
|
207
|
+
typeCodeOwnerId: sdkParams.typeCodeOwnerId,
|
|
209
208
|
chatPingMessageInterval: chatPingMessageInterval,
|
|
210
209
|
asyncRequestTimeout: asyncRequestTimeout,
|
|
211
210
|
serverName: serverName,
|
|
@@ -229,7 +228,7 @@ function Chat(params) {
|
|
|
229
228
|
* Initialize Cache Databases
|
|
230
229
|
*/
|
|
231
230
|
startCacheDatabases(function () {
|
|
232
|
-
if (grantDeviceIdFromSSO) {
|
|
231
|
+
if (sdkParams.grantDeviceIdFromSSO) {
|
|
233
232
|
var getDeviceIdWithTokenTime = new Date().getTime();
|
|
234
233
|
getDeviceIdWithToken(function (retrievedDeviceId) {
|
|
235
234
|
if (actualTimingLog) {
|
|
@@ -305,7 +304,7 @@ function Chat(params) {
|
|
|
305
304
|
if (Object.keys(messagesDelivery).length) {
|
|
306
305
|
messagesDeliveryQueueHandler();
|
|
307
306
|
}
|
|
308
|
-
}, deliveryIntervalPitch);
|
|
307
|
+
}, sdkParams.deliveryIntervalPitch);
|
|
309
308
|
|
|
310
309
|
seenInterval && clearInterval(seenInterval);
|
|
311
310
|
|
|
@@ -313,7 +312,7 @@ function Chat(params) {
|
|
|
313
312
|
if (Object.keys(messagesSeen).length) {
|
|
314
313
|
messagesSeenQueueHandler();
|
|
315
314
|
}
|
|
316
|
-
}, seenIntervalPitch);
|
|
315
|
+
}, sdkParams.seenIntervalPitch);
|
|
317
316
|
|
|
318
317
|
//shouldReconnectCall();
|
|
319
318
|
});
|
|
@@ -424,7 +423,7 @@ function Chat(params) {
|
|
|
424
423
|
url: SERVICE_ADDRESSES.SSO_ADDRESS + SERVICES_PATH.SSO_DEVICES,
|
|
425
424
|
method: 'GET',
|
|
426
425
|
headers: {
|
|
427
|
-
'Authorization': 'Bearer ' + token
|
|
426
|
+
'Authorization': 'Bearer ' + sdkParams.token
|
|
428
427
|
}
|
|
429
428
|
};
|
|
430
429
|
|
|
@@ -503,7 +502,7 @@ function Chat(params) {
|
|
|
503
502
|
method: 'POST',
|
|
504
503
|
data: data,
|
|
505
504
|
headers: {
|
|
506
|
-
'Authorization': 'Bearer ' + token
|
|
505
|
+
'Authorization': 'Bearer ' + sdkParams.token
|
|
507
506
|
}
|
|
508
507
|
};
|
|
509
508
|
|
|
@@ -582,7 +581,7 @@ function Chat(params) {
|
|
|
582
581
|
url: SERVICE_ADDRESSES.SSO_ADDRESS + SERVICES_PATH.SSO_GET_KEY + keyId,
|
|
583
582
|
method: 'GET',
|
|
584
583
|
headers: {
|
|
585
|
-
'Authorization': 'Bearer ' + token
|
|
584
|
+
'Authorization': 'Bearer ' + sdkParams.token
|
|
586
585
|
}
|
|
587
586
|
};
|
|
588
587
|
|
|
@@ -965,7 +964,7 @@ function Chat(params) {
|
|
|
965
964
|
|
|
966
965
|
return chatMessaging.sendMessage({
|
|
967
966
|
chatMessageVOType: chatMessageVOTypes.USER_INFO,
|
|
968
|
-
typeCode: generalTypeCode//params.typeCode
|
|
967
|
+
typeCode: sdkParams.generalTypeCode//params.typeCode
|
|
969
968
|
}, {
|
|
970
969
|
onResult: function (result) {
|
|
971
970
|
var returnData = {
|
|
@@ -1236,7 +1235,7 @@ function Chat(params) {
|
|
|
1236
1235
|
* @return {undefined}
|
|
1237
1236
|
*/
|
|
1238
1237
|
chatMessageHandler = function (chatMessage) {
|
|
1239
|
-
if(chatMessage.typeCode && chatMessage.typeCode !== generalTypeCode) {
|
|
1238
|
+
if(chatMessage.typeCode && chatMessage.typeCode !== sdkParams.generalTypeCode) {
|
|
1240
1239
|
return;
|
|
1241
1240
|
}
|
|
1242
1241
|
|
|
@@ -2173,6 +2172,10 @@ function Chat(params) {
|
|
|
2173
2172
|
var threadObject = messageContent;
|
|
2174
2173
|
threadObject.unreadCount = (messageContent.unreadCount) ? messageContent.unreadCount : 0;
|
|
2175
2174
|
|
|
2175
|
+
threadObject.lastSeenMessageTime = (messageContent.lastSeenMessageNanos)
|
|
2176
|
+
? (parseInt(parseInt(messageContent.lastSeenMessageTime) / 1000) * 1000000000) + parseInt(messageContent.lastSeenMessageNanos)
|
|
2177
|
+
: (parseInt(messageContent.lastSeenMessageTime));
|
|
2178
|
+
|
|
2176
2179
|
let localThreadLastSeenUpdated = JSON.parse(JSON.stringify(messageContent));
|
|
2177
2180
|
store.threads.save(localThreadLastSeenUpdated);
|
|
2178
2181
|
store.threads.get(threadId).unreadCount.set(messageContent.unreadCount)
|
|
@@ -3054,6 +3057,9 @@ function Chat(params) {
|
|
|
3054
3057
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
|
|
3055
3058
|
}
|
|
3056
3059
|
|
|
3060
|
+
if(!messageContent) {
|
|
3061
|
+
messageContent = {};
|
|
3062
|
+
}
|
|
3057
3063
|
messageContent.threadId = threadId;
|
|
3058
3064
|
chatEvents.fireEvent('threadEvents', {
|
|
3059
3065
|
type: 'DELETE_THREAD',
|
|
@@ -3337,13 +3343,6 @@ function Chat(params) {
|
|
|
3337
3343
|
}
|
|
3338
3344
|
}
|
|
3339
3345
|
|
|
3340
|
-
chatEvents.fireEvent('messageEvents', {
|
|
3341
|
-
type: 'MESSAGE_NEW',
|
|
3342
|
-
cache: false,
|
|
3343
|
-
result: {
|
|
3344
|
-
message: message
|
|
3345
|
-
}
|
|
3346
|
-
});
|
|
3347
3346
|
|
|
3348
3347
|
var threadObject = message.conversation;
|
|
3349
3348
|
var lastMessageVoCopy = Object.assign({}, message);
|
|
@@ -3354,6 +3353,16 @@ function Chat(params) {
|
|
|
3354
3353
|
threadObject.lastParticipantName = (!!message.participant && message.participant.hasOwnProperty('name')) ? message.participant.name : '';
|
|
3355
3354
|
threadObject.lastMessage = (message.hasOwnProperty('message')) ? message.message : '';
|
|
3356
3355
|
|
|
3356
|
+
let stringMsg = JSON.parse(JSON.stringify(message));
|
|
3357
|
+
stringMsg.conversation = JSON.parse(JSON.stringify(threadObject));
|
|
3358
|
+
chatEvents.fireEvent('messageEvents', {
|
|
3359
|
+
type: 'MESSAGE_NEW',
|
|
3360
|
+
cache: false,
|
|
3361
|
+
result: {
|
|
3362
|
+
message: stringMsg
|
|
3363
|
+
}
|
|
3364
|
+
});
|
|
3365
|
+
|
|
3357
3366
|
chatEvents.fireEvent('threadEvents', {
|
|
3358
3367
|
type: 'THREAD_UNREAD_COUNT_UPDATED',
|
|
3359
3368
|
result: {
|
|
@@ -3368,17 +3377,21 @@ function Chat(params) {
|
|
|
3368
3377
|
storeThread = store.threads.get(threadObject.id);
|
|
3369
3378
|
}
|
|
3370
3379
|
|
|
3371
|
-
let unreadCount = message.conversation.unreadCount;
|
|
3380
|
+
// let unreadCount = message.conversation.unreadCount;
|
|
3372
3381
|
// store.threads.get(threadObject.id).unreadCount.set();
|
|
3373
3382
|
if(message.ownerId != chatMessaging.userInfo.id) {
|
|
3374
|
-
if(unreadCount)
|
|
3375
|
-
storeThread.unreadCount.set(
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3383
|
+
if(!storeThread.unreadCount.get())
|
|
3384
|
+
storeThread.unreadCount.set(1);
|
|
3385
|
+
else
|
|
3386
|
+
storeThread.unreadCount.increase();
|
|
3387
|
+
// if(unreadCount) {
|
|
3388
|
+
// storeThread.unreadCount.set(unreadCount);
|
|
3389
|
+
// } else {
|
|
3390
|
+
// if(!storeThread.unreadCount.get())
|
|
3391
|
+
// storeThread.unreadCount.set(1);
|
|
3392
|
+
// else
|
|
3393
|
+
// storeThread.unreadCount.increase();
|
|
3394
|
+
// }
|
|
3382
3395
|
} else {
|
|
3383
3396
|
storeThread.unreadCount.set(0);
|
|
3384
3397
|
}
|
|
@@ -4282,9 +4295,14 @@ function Chat(params) {
|
|
|
4282
4295
|
* - text {string}
|
|
4283
4296
|
* - notifyAll {boolean}
|
|
4284
4297
|
*/
|
|
4298
|
+
pushMessageVO.time = (pushMessageVO.timeNanos)
|
|
4299
|
+
? (parseInt(parseInt(pushMessageVO.time) / 1000) * 1000000000) + parseInt(pushMessageVO.timeNanos)
|
|
4300
|
+
: (parseInt(pushMessageVO.time));
|
|
4301
|
+
|
|
4285
4302
|
var pinMessage = {
|
|
4286
4303
|
threadId: threadId,
|
|
4287
4304
|
time: pushMessageVO.time,
|
|
4305
|
+
timeNanos: pushMessageVO.timeNanos,
|
|
4288
4306
|
sender: pushMessageVO.sender,
|
|
4289
4307
|
messageId: pushMessageVO.messageId,
|
|
4290
4308
|
text: pushMessageVO.text,
|
|
@@ -4493,7 +4511,7 @@ function Chat(params) {
|
|
|
4493
4511
|
|
|
4494
4512
|
var sendMessageParams = {
|
|
4495
4513
|
chatMessageVOType: chatMessageVOTypes.GET_THREADS,
|
|
4496
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
4514
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
4497
4515
|
content: content
|
|
4498
4516
|
};
|
|
4499
4517
|
|
|
@@ -4635,7 +4653,7 @@ function Chat(params) {
|
|
|
4635
4653
|
* thread's last section
|
|
4636
4654
|
*/
|
|
4637
4655
|
|
|
4638
|
-
if (typeof Worker !== 'undefined' && productEnv !== 'ReactNative' && canUseCache && cacheSecret.length > 0) {
|
|
4656
|
+
if (typeof Worker !== 'undefined' && sdkParams.productEnv !== 'ReactNative' && canUseCache && cacheSecret.length > 0) {
|
|
4639
4657
|
if (typeof cacheSyncWorker === 'undefined') {
|
|
4640
4658
|
var plainWorker = function () {
|
|
4641
4659
|
self.importScripts('https://npmcdn.com/dexie@2.0.4/dist/dexie.min.js');
|
|
@@ -4779,7 +4797,7 @@ function Chat(params) {
|
|
|
4779
4797
|
getAllThreads = function (params, callback) {
|
|
4780
4798
|
var sendMessageParams = {
|
|
4781
4799
|
chatMessageVOType: chatMessageVOTypes.GET_THREADS,
|
|
4782
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
4800
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
4783
4801
|
content: {}
|
|
4784
4802
|
};
|
|
4785
4803
|
|
|
@@ -4854,7 +4872,7 @@ function Chat(params) {
|
|
|
4854
4872
|
if (parseInt(params.threadId) > 0) {
|
|
4855
4873
|
var sendMessageParams = {
|
|
4856
4874
|
chatMessageVOType: chatMessageVOTypes.GET_HISTORY,
|
|
4857
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
4875
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
4858
4876
|
content: {},
|
|
4859
4877
|
subjectId: params.threadId
|
|
4860
4878
|
},
|
|
@@ -6044,10 +6062,10 @@ function Chat(params) {
|
|
|
6044
6062
|
updateThreadInfo = function (params, callback) {
|
|
6045
6063
|
var updateThreadInfoData = {
|
|
6046
6064
|
chatMessageVOType: chatMessageVOTypes.UPDATE_THREAD_INFO,
|
|
6047
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
6065
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
6048
6066
|
content: {},
|
|
6049
6067
|
pushMsgType: 3,
|
|
6050
|
-
token: token
|
|
6068
|
+
token: sdkParams.token
|
|
6051
6069
|
},
|
|
6052
6070
|
threadInfoContent = {},
|
|
6053
6071
|
fileUploadParams = {},
|
|
@@ -6110,13 +6128,13 @@ function Chat(params) {
|
|
|
6110
6128
|
putInChatUploadQueue({
|
|
6111
6129
|
message: {
|
|
6112
6130
|
chatMessageVOType: chatMessageVOTypes.UPDATE_THREAD_INFO,
|
|
6113
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
6131
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
6114
6132
|
subjectId: threadId,
|
|
6115
6133
|
content: threadInfoContent,
|
|
6116
6134
|
metadata: threadInfoContent.metadata,
|
|
6117
6135
|
uniqueId: fileUniqueId,
|
|
6118
6136
|
pushMsgType: 3,
|
|
6119
|
-
token: token
|
|
6137
|
+
token: sdkParams.token
|
|
6120
6138
|
},
|
|
6121
6139
|
callbacks: callback
|
|
6122
6140
|
}, function () {
|
|
@@ -6161,13 +6179,13 @@ function Chat(params) {
|
|
|
6161
6179
|
|
|
6162
6180
|
return chatMessaging.sendMessage({
|
|
6163
6181
|
chatMessageVOType: chatMessageVOTypes.UPDATE_THREAD_INFO,
|
|
6164
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
6182
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
6165
6183
|
subjectId: threadId,
|
|
6166
6184
|
content: threadInfoContent,
|
|
6167
6185
|
metadata: threadInfoContent.metadata,
|
|
6168
6186
|
uniqueId: fileUniqueId,
|
|
6169
6187
|
pushMsgType: 3,
|
|
6170
|
-
token: token
|
|
6188
|
+
token: sdkParams.token
|
|
6171
6189
|
}, {
|
|
6172
6190
|
onResult: function (result) {
|
|
6173
6191
|
callback && callback(result);
|
|
@@ -6180,13 +6198,13 @@ function Chat(params) {
|
|
|
6180
6198
|
|
|
6181
6199
|
return chatMessaging.sendMessage({
|
|
6182
6200
|
chatMessageVOType: chatMessageVOTypes.UPDATE_THREAD_INFO,
|
|
6183
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
6201
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
6184
6202
|
subjectId: threadId,
|
|
6185
6203
|
content: threadInfoContent,
|
|
6186
6204
|
metadata: threadInfoContent.metadata,
|
|
6187
6205
|
uniqueId: fileUniqueId,
|
|
6188
6206
|
pushMsgType: 3,
|
|
6189
|
-
token: token
|
|
6207
|
+
token: sdkParams.token
|
|
6190
6208
|
}, {
|
|
6191
6209
|
onResult: function (result) {
|
|
6192
6210
|
callback && callback(result);
|
|
@@ -6217,7 +6235,7 @@ function Chat(params) {
|
|
|
6217
6235
|
chatMessageVOType: chatMessageVOTypes.UPDATE_CHAT_PROFILE,
|
|
6218
6236
|
content: {},
|
|
6219
6237
|
pushMsgType: 3,
|
|
6220
|
-
token: token
|
|
6238
|
+
token: sdkParams.token
|
|
6221
6239
|
};
|
|
6222
6240
|
if (params) {
|
|
6223
6241
|
if (typeof params.bio == 'string') {
|
|
@@ -6254,7 +6272,7 @@ function Chat(params) {
|
|
|
6254
6272
|
chatMessageVOType: chatMessageVOTypes.GET_PARTICIPANT_ROLES,
|
|
6255
6273
|
pushMsgType: 3,
|
|
6256
6274
|
subjectId: params.threadId,
|
|
6257
|
-
token: token
|
|
6275
|
+
token: sdkParams.token
|
|
6258
6276
|
};
|
|
6259
6277
|
return chatMessaging.sendMessage(updateChatProfileData, {
|
|
6260
6278
|
onResult: function (result) {
|
|
@@ -6280,7 +6298,7 @@ function Chat(params) {
|
|
|
6280
6298
|
getThreadParticipants = function (params, callback) {
|
|
6281
6299
|
var sendMessageParams = {
|
|
6282
6300
|
chatMessageVOType: chatMessageVOTypes.THREAD_PARTICIPANTS,
|
|
6283
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
6301
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
6284
6302
|
content: {},
|
|
6285
6303
|
subjectId: params.threadId
|
|
6286
6304
|
},
|
|
@@ -6526,7 +6544,7 @@ function Chat(params) {
|
|
|
6526
6544
|
deliver = function (params) {
|
|
6527
6545
|
return chatMessaging.sendMessage({
|
|
6528
6546
|
chatMessageVOType: chatMessageVOTypes.DELIVERY,
|
|
6529
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
6547
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
6530
6548
|
content: params.messageId,
|
|
6531
6549
|
pushMsgType: 3
|
|
6532
6550
|
});
|
|
@@ -6546,7 +6564,7 @@ function Chat(params) {
|
|
|
6546
6564
|
seen = function (params) {
|
|
6547
6565
|
return chatMessaging.sendMessage({
|
|
6548
6566
|
chatMessageVOType: chatMessageVOTypes.SEEN,
|
|
6549
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
6567
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
6550
6568
|
content: params.messageId,
|
|
6551
6569
|
pushMsgType: 3
|
|
6552
6570
|
});
|
|
@@ -6708,7 +6726,7 @@ function Chat(params) {
|
|
|
6708
6726
|
}
|
|
6709
6727
|
|
|
6710
6728
|
if (params.responseType === 'link') {
|
|
6711
|
-
var returnLink = SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_DOWNLOAD_FILE + `?hash=${params.hashCode}&_token_=${token}&_token_issuer_=1`;
|
|
6729
|
+
var returnLink = SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_DOWNLOAD_FILE + `?hash=${params.hashCode}&_token_=${sdkParams.token}&_token_issuer_=1`;
|
|
6712
6730
|
|
|
6713
6731
|
callback({
|
|
6714
6732
|
hasError: false,
|
|
@@ -6723,7 +6741,7 @@ function Chat(params) {
|
|
|
6723
6741
|
responseType: 'blob',
|
|
6724
6742
|
uniqueId: downloadUniqueId,
|
|
6725
6743
|
headers: {
|
|
6726
|
-
'_token_': token,
|
|
6744
|
+
'_token_': sdkParams.token,
|
|
6727
6745
|
'_token_issuer_': 1,
|
|
6728
6746
|
// 'Range': 'bytes=100-200'
|
|
6729
6747
|
},
|
|
@@ -6799,7 +6817,7 @@ function Chat(params) {
|
|
|
6799
6817
|
responseType: 'blob',
|
|
6800
6818
|
uniqueId: downloadUniqueId,
|
|
6801
6819
|
headers: {
|
|
6802
|
-
'Authorization': 'Bearer ' + token
|
|
6820
|
+
'Authorization': 'Bearer ' + sdkParams.token
|
|
6803
6821
|
},
|
|
6804
6822
|
enableDownloadProgressEvents: params.enableDownloadProgressEvents,
|
|
6805
6823
|
hashCode: params.hashCode
|
|
@@ -6866,7 +6884,7 @@ function Chat(params) {
|
|
|
6866
6884
|
}
|
|
6867
6885
|
|
|
6868
6886
|
if (params.responseType === 'link') {
|
|
6869
|
-
var returnLink = SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_DOWNLOAD_IMAGE + `?hash=${params.hashCode}&_token_=${token}&_token_issuer_=1&size=${params.size}&quality=${params.quality}&crop=${params.crop}`;
|
|
6887
|
+
var returnLink = SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_DOWNLOAD_IMAGE + `?hash=${params.hashCode}&_token_=${sdkParams.token}&_token_issuer_=1&size=${params.size}&quality=${params.quality}&crop=${params.crop}`;
|
|
6870
6888
|
|
|
6871
6889
|
callback({
|
|
6872
6890
|
hasError: false,
|
|
@@ -6880,7 +6898,7 @@ function Chat(params) {
|
|
|
6880
6898
|
uniqueId: downloadUniqueId,
|
|
6881
6899
|
responseType: 'blob',
|
|
6882
6900
|
headers: {
|
|
6883
|
-
'_token_': token,
|
|
6901
|
+
'_token_': sdkParams.token,
|
|
6884
6902
|
'_token_issuer_': 1
|
|
6885
6903
|
},
|
|
6886
6904
|
data: getImageData
|
|
@@ -6921,7 +6939,7 @@ function Chat(params) {
|
|
|
6921
6939
|
responseType: 'blob',
|
|
6922
6940
|
uniqueId: downloadUniqueId,
|
|
6923
6941
|
headers: {
|
|
6924
|
-
'_token_': token,
|
|
6942
|
+
'_token_': sdkParams.token,
|
|
6925
6943
|
'_token_issuer_': 1
|
|
6926
6944
|
},
|
|
6927
6945
|
data: getImageData
|
|
@@ -7002,7 +7020,7 @@ function Chat(params) {
|
|
|
7002
7020
|
uniqueId: downloadUniqueId,
|
|
7003
7021
|
responseType: 'blob',
|
|
7004
7022
|
headers: {
|
|
7005
|
-
'Authorization': 'Bearer ' + token
|
|
7023
|
+
'Authorization': 'Bearer ' + sdkParams.token
|
|
7006
7024
|
},
|
|
7007
7025
|
enableDownloadProgressEvents: params.enableDownloadProgressEvents,
|
|
7008
7026
|
hashCode: params.hashCode
|
|
@@ -7045,7 +7063,7 @@ function Chat(params) {
|
|
|
7045
7063
|
responseType: 'blob',
|
|
7046
7064
|
uniqueId: downloadUniqueId,
|
|
7047
7065
|
headers: {
|
|
7048
|
-
'Authorization': 'Bearer ' + token
|
|
7066
|
+
'Authorization': 'Bearer ' + sdkParams.token
|
|
7049
7067
|
},
|
|
7050
7068
|
enableDownloadProgressEvents: params.enableDownloadProgressEvents,
|
|
7051
7069
|
hashCode: params.hashCode
|
|
@@ -7242,7 +7260,7 @@ function Chat(params) {
|
|
|
7242
7260
|
url: SERVICE_ADDRESSES.FILESERVER_ADDRESS + SERVICES_PATH.UPLOAD_FILE,
|
|
7243
7261
|
method: 'POST',
|
|
7244
7262
|
headers: {
|
|
7245
|
-
'_token_': token,
|
|
7263
|
+
'_token_': sdkParams.token,
|
|
7246
7264
|
'_token_issuer_': 1
|
|
7247
7265
|
},
|
|
7248
7266
|
data: uploadFileData,
|
|
@@ -7366,7 +7384,7 @@ function Chat(params) {
|
|
|
7366
7384
|
url: SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_UPLOAD_FILE_TO_USERGROUP,
|
|
7367
7385
|
method: 'POST',
|
|
7368
7386
|
headers: {
|
|
7369
|
-
'_token_': token,
|
|
7387
|
+
'_token_': sdkParams.token,
|
|
7370
7388
|
'_token_issuer_': 1
|
|
7371
7389
|
},
|
|
7372
7390
|
data: uploadFileData,
|
|
@@ -7469,7 +7487,7 @@ function Chat(params) {
|
|
|
7469
7487
|
url: SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_UPLOAD_FILE_NEW,
|
|
7470
7488
|
method: 'POST',
|
|
7471
7489
|
headers: {
|
|
7472
|
-
'Authorization': 'Bearer ' + token
|
|
7490
|
+
'Authorization': 'Bearer ' + sdkParams.token
|
|
7473
7491
|
},
|
|
7474
7492
|
data: uploadFileData,
|
|
7475
7493
|
uniqueId: uploadUniqueId
|
|
@@ -7583,7 +7601,7 @@ function Chat(params) {
|
|
|
7583
7601
|
url: SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_UPLOAD_FILE_TO_USERGROUP_NEW.replace('{userGroupHash}', uploadFileData.userGroupHash),
|
|
7584
7602
|
method: 'POST',
|
|
7585
7603
|
headers: {
|
|
7586
|
-
'Authorization': 'Bearer ' + token,
|
|
7604
|
+
'Authorization': 'Bearer ' + sdkParams.token,
|
|
7587
7605
|
},
|
|
7588
7606
|
data: uploadFileData,
|
|
7589
7607
|
uniqueId: uploadUniqueId
|
|
@@ -7686,7 +7704,7 @@ function Chat(params) {
|
|
|
7686
7704
|
url: SERVICE_ADDRESSES.POD_DRIVE_ADDRESS + SERVICES_PATH.DRIVE_UPLOAD_FILE_FROM_URL,
|
|
7687
7705
|
method: 'POST',
|
|
7688
7706
|
headers: {
|
|
7689
|
-
'_token_': token,
|
|
7707
|
+
'_token_': sdkParams.token,
|
|
7690
7708
|
'_token_issuer_': 1
|
|
7691
7709
|
},
|
|
7692
7710
|
data: uploadFileData,
|
|
@@ -7825,7 +7843,7 @@ function Chat(params) {
|
|
|
7825
7843
|
url: SERVICE_ADDRESSES.FILESERVER_ADDRESS + SERVICES_PATH.UPLOAD_IMAGE,
|
|
7826
7844
|
method: 'POST',
|
|
7827
7845
|
headers: {
|
|
7828
|
-
'_token_': token,
|
|
7846
|
+
'_token_': sdkParams.token,
|
|
7829
7847
|
'_token_issuer_': 1
|
|
7830
7848
|
},
|
|
7831
7849
|
data: uploadImageData,
|
|
@@ -7983,7 +8001,7 @@ function Chat(params) {
|
|
|
7983
8001
|
url: SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_UPLOAD_IMAGE,
|
|
7984
8002
|
method: 'POST',
|
|
7985
8003
|
headers: {
|
|
7986
|
-
'_token_': token,
|
|
8004
|
+
'_token_': sdkParams.token,
|
|
7987
8005
|
'_token_issuer_': 1
|
|
7988
8006
|
},
|
|
7989
8007
|
data: uploadImageData,
|
|
@@ -8120,7 +8138,7 @@ function Chat(params) {
|
|
|
8120
8138
|
url: SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_UPLOAD_IMAGE_NEW,
|
|
8121
8139
|
method: 'POST',
|
|
8122
8140
|
headers: {
|
|
8123
|
-
'Authorization': 'Bearer ' + token,
|
|
8141
|
+
'Authorization': 'Bearer ' + sdkParams.token,
|
|
8124
8142
|
},
|
|
8125
8143
|
data: uploadImageData,
|
|
8126
8144
|
uniqueId: uploadUniqueId
|
|
@@ -8273,7 +8291,7 @@ function Chat(params) {
|
|
|
8273
8291
|
url: SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_UPLOAD_IMAGE_TO_USERGROUP,
|
|
8274
8292
|
method: 'POST',
|
|
8275
8293
|
headers: {
|
|
8276
|
-
'_token_': token,
|
|
8294
|
+
'_token_': sdkParams.token,
|
|
8277
8295
|
'_token_issuer_': 1
|
|
8278
8296
|
},
|
|
8279
8297
|
data: uploadImageData,
|
|
@@ -8443,7 +8461,7 @@ function Chat(params) {
|
|
|
8443
8461
|
url: SERVICE_ADDRESSES.PODSPACE_FILESERVER_ADDRESS + SERVICES_PATH.PODSPACE_UPLOAD_IMAGE_TO_USERGROUP_NEW.replace('{userGroupHash}', uploadImageData.userGroupHash),
|
|
8444
8462
|
method: 'POST',
|
|
8445
8463
|
headers: {
|
|
8446
|
-
'Authorization': 'Bearer ' + token,
|
|
8464
|
+
'Authorization': 'Bearer ' + sdkParams.token,
|
|
8447
8465
|
},
|
|
8448
8466
|
data: uploadImageData,
|
|
8449
8467
|
uniqueId: uploadUniqueId
|
|
@@ -8547,7 +8565,7 @@ function Chat(params) {
|
|
|
8547
8565
|
putInChatUploadQueue({
|
|
8548
8566
|
message: {
|
|
8549
8567
|
chatMessageVOType: chatMessageVOTypes.MESSAGE,
|
|
8550
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
8568
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
8551
8569
|
messageType: (params.messageType && typeof params.messageType.toUpperCase() !== 'undefined' && chatMessageTypes[params.messageType.toUpperCase()] > 0) ? chatMessageTypes[params.messageType.toUpperCase()] : 1,
|
|
8552
8570
|
subjectId: params.threadId,
|
|
8553
8571
|
repliedTo: params.repliedTo,
|
|
@@ -8816,7 +8834,7 @@ function Chat(params) {
|
|
|
8816
8834
|
*/
|
|
8817
8835
|
getChatWaitQueue = function (threadId, active, callback) {
|
|
8818
8836
|
if (active && threadId > 0) {
|
|
8819
|
-
if (hasCache && typeof queueDb == 'object' && !forceWaitQueueInMemory) {
|
|
8837
|
+
if (hasCache && typeof queueDb == 'object' && !sdkParams.forceWaitQueueInMemory) {
|
|
8820
8838
|
queueDb.waitQ.where('threadId')
|
|
8821
8839
|
.equals(threadId)
|
|
8822
8840
|
.and(function (item) {
|
|
@@ -8986,7 +9004,7 @@ function Chat(params) {
|
|
|
8986
9004
|
* @return {undefined}
|
|
8987
9005
|
*/
|
|
8988
9006
|
deleteFromChatWaitQueue = function (item, callback) {
|
|
8989
|
-
if (hasCache && typeof queueDb == 'object' && !forceWaitQueueInMemory) {
|
|
9007
|
+
if (hasCache && typeof queueDb == 'object' && !sdkParams.forceWaitQueueInMemory) {
|
|
8990
9008
|
queueDb.waitQ.where('uniqueId')
|
|
8991
9009
|
.equals(item.uniqueId)
|
|
8992
9010
|
.and(function (item) {
|
|
@@ -9033,7 +9051,7 @@ function Chat(params) {
|
|
|
9033
9051
|
},
|
|
9034
9052
|
|
|
9035
9053
|
deleteThreadFailedMessagesFromWaitQueue = function (threadId, callback) {
|
|
9036
|
-
if (hasCache && typeof queueDb == 'object' && !forceWaitQueueInMemory) {
|
|
9054
|
+
if (hasCache && typeof queueDb == 'object' && !sdkParams.forceWaitQueueInMemory) {
|
|
9037
9055
|
queueDb.waitQ.where('threadId')
|
|
9038
9056
|
.equals(threadId)
|
|
9039
9057
|
.and(function (item) {
|
|
@@ -9104,7 +9122,7 @@ function Chat(params) {
|
|
|
9104
9122
|
var waitQueueUniqueId = (typeof item.uniqueId == 'string') ? item.uniqueId : (Array.isArray(item.uniqueId)) ? item.uniqueId[0] : null;
|
|
9105
9123
|
|
|
9106
9124
|
if (waitQueueUniqueId != null) {
|
|
9107
|
-
if (hasCache && typeof queueDb == 'object' && !forceWaitQueueInMemory) {
|
|
9125
|
+
if (hasCache && typeof queueDb == 'object' && !sdkParams.forceWaitQueueInMemory) {
|
|
9108
9126
|
queueDb.waitQ
|
|
9109
9127
|
.put({
|
|
9110
9128
|
threadId: parseInt(item.subjectId),
|
|
@@ -9133,7 +9151,7 @@ function Chat(params) {
|
|
|
9133
9151
|
},
|
|
9134
9152
|
|
|
9135
9153
|
getItemFromChatWaitQueue = function (uniqueId, callback) {
|
|
9136
|
-
if (hasCache && typeof queueDb == 'object' && !forceWaitQueueInMemory) {
|
|
9154
|
+
if (hasCache && typeof queueDb == 'object' && !sdkParams.forceWaitQueueInMemory) {
|
|
9137
9155
|
queueDb.waitQ.where('uniqueId')
|
|
9138
9156
|
.equals(uniqueId)
|
|
9139
9157
|
.and(function (item) {
|
|
@@ -9336,10 +9354,10 @@ function Chat(params) {
|
|
|
9336
9354
|
setRoleToUser = function (params, callback) {
|
|
9337
9355
|
var setRoleData = {
|
|
9338
9356
|
chatMessageVOType: chatMessageVOTypes.SET_ROLE_TO_USER,
|
|
9339
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
9357
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
9340
9358
|
content: [],
|
|
9341
9359
|
pushMsgType: 3,
|
|
9342
|
-
token: token
|
|
9360
|
+
token: sdkParams.token
|
|
9343
9361
|
};
|
|
9344
9362
|
|
|
9345
9363
|
if (params) {
|
|
@@ -9375,10 +9393,10 @@ function Chat(params) {
|
|
|
9375
9393
|
removeRoleFromUser = function (params, callback) {
|
|
9376
9394
|
var setAdminData = {
|
|
9377
9395
|
chatMessageVOType: chatMessageVOTypes.REMOVE_ROLE_FROM_USER,
|
|
9378
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
9396
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
9379
9397
|
content: [],
|
|
9380
9398
|
pushMsgType: 3,
|
|
9381
|
-
token: token
|
|
9399
|
+
token: sdkParams.token
|
|
9382
9400
|
};
|
|
9383
9401
|
|
|
9384
9402
|
if (params) {
|
|
@@ -9414,13 +9432,13 @@ function Chat(params) {
|
|
|
9414
9432
|
unPinMessage = function (params, callback) {
|
|
9415
9433
|
return chatMessaging.sendMessage({
|
|
9416
9434
|
chatMessageVOType: chatMessageVOTypes.UNPIN_MESSAGE,
|
|
9417
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
9435
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
9418
9436
|
subjectId: params.messageId,
|
|
9419
9437
|
content: JSON.stringify({
|
|
9420
9438
|
'notifyAll': (typeof params.notifyAll === 'boolean') ? params.notifyAll : false
|
|
9421
9439
|
}),
|
|
9422
9440
|
pushMsgType: 3,
|
|
9423
|
-
token: token
|
|
9441
|
+
token: sdkParams.token
|
|
9424
9442
|
}, {
|
|
9425
9443
|
onResult: function (result) {
|
|
9426
9444
|
callback && callback(result);
|
|
@@ -9565,7 +9583,7 @@ function Chat(params) {
|
|
|
9565
9583
|
method: 'GET',
|
|
9566
9584
|
data: data,
|
|
9567
9585
|
headers: {
|
|
9568
|
-
'Api-Key': mapApiKey
|
|
9586
|
+
'Api-Key': sdkParams.mapApiKey
|
|
9569
9587
|
}
|
|
9570
9588
|
};
|
|
9571
9589
|
|
|
@@ -9617,7 +9635,7 @@ function Chat(params) {
|
|
|
9617
9635
|
method: 'GET',
|
|
9618
9636
|
data: data,
|
|
9619
9637
|
headers: {
|
|
9620
|
-
'Api-Key': mapApiKey
|
|
9638
|
+
'Api-Key': sdkParams.mapApiKey
|
|
9621
9639
|
}
|
|
9622
9640
|
};
|
|
9623
9641
|
|
|
@@ -9679,7 +9697,7 @@ function Chat(params) {
|
|
|
9679
9697
|
method: 'GET',
|
|
9680
9698
|
data: data,
|
|
9681
9699
|
headers: {
|
|
9682
|
-
'Api-Key': mapApiKey
|
|
9700
|
+
'Api-Key': sdkParams.mapApiKey
|
|
9683
9701
|
}
|
|
9684
9702
|
};
|
|
9685
9703
|
|
|
@@ -9757,7 +9775,7 @@ function Chat(params) {
|
|
|
9757
9775
|
});
|
|
9758
9776
|
}
|
|
9759
9777
|
|
|
9760
|
-
data.key = mapApiKey;
|
|
9778
|
+
data.key = sdkParams.mapApiKey;
|
|
9761
9779
|
}
|
|
9762
9780
|
|
|
9763
9781
|
var keys = Object.keys(data);
|
|
@@ -9839,7 +9857,7 @@ function Chat(params) {
|
|
|
9839
9857
|
publicized.getUserInfo = function (callback) {
|
|
9840
9858
|
return chatMessaging.sendMessage({
|
|
9841
9859
|
chatMessageVOType: chatMessageVOTypes.USER_INFO,
|
|
9842
|
-
typeCode: generalTypeCode
|
|
9860
|
+
typeCode: sdkParams.generalTypeCode
|
|
9843
9861
|
}, {
|
|
9844
9862
|
onResult: function (result) {
|
|
9845
9863
|
var returnData = {
|
|
@@ -9874,7 +9892,7 @@ function Chat(params) {
|
|
|
9874
9892
|
return getHistory({
|
|
9875
9893
|
threadId: params.threadId,
|
|
9876
9894
|
allMentioned: true,
|
|
9877
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
9895
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
9878
9896
|
count: params.count || 50,
|
|
9879
9897
|
offset: params.offset || 0,
|
|
9880
9898
|
cache: false,
|
|
@@ -9889,7 +9907,7 @@ function Chat(params) {
|
|
|
9889
9907
|
return getHistory({
|
|
9890
9908
|
threadId: params.threadId,
|
|
9891
9909
|
unreadMentioned: true,
|
|
9892
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
9910
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
9893
9911
|
count: params.count || 50,
|
|
9894
9912
|
offset: params.offset || 0,
|
|
9895
9913
|
cache: false,
|
|
@@ -9903,12 +9921,12 @@ function Chat(params) {
|
|
|
9903
9921
|
publicized.getAllUnreadMessagesCount = function (params, callback) {
|
|
9904
9922
|
return chatMessaging.sendMessage({
|
|
9905
9923
|
chatMessageVOType: chatMessageVOTypes.ALL_UNREAD_MESSAGE_COUNT,
|
|
9906
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
9924
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
9907
9925
|
content: JSON.stringify({
|
|
9908
9926
|
'mute': (typeof params.countMuteThreads === 'boolean') ? params.countMuteThreads : false
|
|
9909
9927
|
}),
|
|
9910
9928
|
pushMsgType: 3,
|
|
9911
|
-
token: token
|
|
9929
|
+
token: sdkParams.token
|
|
9912
9930
|
}, {
|
|
9913
9931
|
onResult: function (result) {
|
|
9914
9932
|
callback && callback(result);
|
|
@@ -9973,7 +9991,7 @@ function Chat(params) {
|
|
|
9973
9991
|
|
|
9974
9992
|
var sendMessageParams = {
|
|
9975
9993
|
chatMessageVOType: chatMessageVOTypes.GET_CONTACTS,
|
|
9976
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
9994
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
9977
9995
|
content: content
|
|
9978
9996
|
};
|
|
9979
9997
|
|
|
@@ -10213,7 +10231,7 @@ function Chat(params) {
|
|
|
10213
10231
|
*/
|
|
10214
10232
|
var sendMessageParams = {
|
|
10215
10233
|
chatMessageVOType: chatMessageVOTypes.ADD_PARTICIPANT,
|
|
10216
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
10234
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
10217
10235
|
content: []
|
|
10218
10236
|
};
|
|
10219
10237
|
if (params) {
|
|
@@ -10277,7 +10295,7 @@ function Chat(params) {
|
|
|
10277
10295
|
|
|
10278
10296
|
var sendMessageParams = {
|
|
10279
10297
|
chatMessageVOType: chatMessageVOTypes.REMOVE_PARTICIPANT,
|
|
10280
|
-
typeCode: generalTypeCode //params.typeCode
|
|
10298
|
+
typeCode: sdkParams.generalTypeCode //params.typeCode
|
|
10281
10299
|
};
|
|
10282
10300
|
|
|
10283
10301
|
if (params) {
|
|
@@ -10324,7 +10342,7 @@ function Chat(params) {
|
|
|
10324
10342
|
|
|
10325
10343
|
var sendMessageParams = {
|
|
10326
10344
|
chatMessageVOType: chatMessageVOTypes.LEAVE_THREAD,
|
|
10327
|
-
typeCode: generalTypeCode//params.typeCode
|
|
10345
|
+
typeCode: sdkParams.generalTypeCode//params.typeCode
|
|
10328
10346
|
};
|
|
10329
10347
|
|
|
10330
10348
|
if (params) {
|
|
@@ -10477,7 +10495,7 @@ function Chat(params) {
|
|
|
10477
10495
|
|
|
10478
10496
|
var sendMessageParams = {
|
|
10479
10497
|
chatMessageVOType: chatMessageVOTypes.CREATE_THREAD,
|
|
10480
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
10498
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
10481
10499
|
content: content
|
|
10482
10500
|
};
|
|
10483
10501
|
|
|
@@ -10568,7 +10586,7 @@ function Chat(params) {
|
|
|
10568
10586
|
|
|
10569
10587
|
var sendMessageParams = {
|
|
10570
10588
|
chatMessageVOType: chatMessageVOTypes.CREATE_THREAD,
|
|
10571
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
10589
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
10572
10590
|
content: content
|
|
10573
10591
|
};
|
|
10574
10592
|
|
|
@@ -10607,7 +10625,7 @@ function Chat(params) {
|
|
|
10607
10625
|
putInChatSendQueue({
|
|
10608
10626
|
message: {
|
|
10609
10627
|
chatMessageVOType: chatMessageVOTypes.MESSAGE,
|
|
10610
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
10628
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
10611
10629
|
messageType: (params.messageType && typeof params.messageType.toUpperCase() !== 'undefined' && chatMessageTypes[params.messageType.toUpperCase()] > 0) ? chatMessageTypes[params.messageType.toUpperCase()] : chatMessageTypes.TEXT,
|
|
10612
10630
|
subjectId: params.threadId,
|
|
10613
10631
|
repliedTo: params.repliedTo,
|
|
@@ -10635,7 +10653,7 @@ function Chat(params) {
|
|
|
10635
10653
|
|
|
10636
10654
|
return chatMessaging.sendMessage({
|
|
10637
10655
|
chatMessageVOType: chatMessageVOTypes.BOT_MESSAGE,
|
|
10638
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
10656
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
10639
10657
|
subjectId: params.messageId,
|
|
10640
10658
|
content: params.content,
|
|
10641
10659
|
uniqueId: params.uniqueId,
|
|
@@ -10704,7 +10722,7 @@ function Chat(params) {
|
|
|
10704
10722
|
}
|
|
10705
10723
|
var sendMessageParams = {
|
|
10706
10724
|
chatMessageVOType: chatMessageVOTypes.CREATE_THREAD,
|
|
10707
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
10725
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
10708
10726
|
content: content
|
|
10709
10727
|
};
|
|
10710
10728
|
return chatMessaging.sendMessage(sendMessageParams, {
|
|
@@ -10778,7 +10796,7 @@ function Chat(params) {
|
|
|
10778
10796
|
error: undefined
|
|
10779
10797
|
});
|
|
10780
10798
|
}
|
|
10781
|
-
data.key = mapApiKey;
|
|
10799
|
+
data.key = sdkParams.mapApiKey;
|
|
10782
10800
|
data.marker = 'red';
|
|
10783
10801
|
}
|
|
10784
10802
|
var keys = Object.keys(data);
|
|
@@ -10835,7 +10853,7 @@ function Chat(params) {
|
|
|
10835
10853
|
};
|
|
10836
10854
|
|
|
10837
10855
|
publicized.resendMessage = function (uniqueId, callbacks) {
|
|
10838
|
-
if (hasCache && typeof queueDb == 'object' && !forceWaitQueueInMemory) {
|
|
10856
|
+
if (hasCache && typeof queueDb == 'object' && !sdkParams.forceWaitQueueInMemory) {
|
|
10839
10857
|
queueDb.waitQ.where('uniqueId')
|
|
10840
10858
|
.equals(uniqueId)
|
|
10841
10859
|
.and(function (item) {
|
|
@@ -10885,7 +10903,7 @@ function Chat(params) {
|
|
|
10885
10903
|
|
|
10886
10904
|
var clearHistoryParams = {
|
|
10887
10905
|
chatMessageVOType: chatMessageVOTypes.CLEAR_HISTORY,
|
|
10888
|
-
typeCode: generalTypeCode, //params.typeCode
|
|
10906
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode
|
|
10889
10907
|
};
|
|
10890
10908
|
|
|
10891
10909
|
if (params) {
|
|
@@ -10964,7 +10982,7 @@ function Chat(params) {
|
|
|
10964
10982
|
publicized.editMessage = function (params, callback) {
|
|
10965
10983
|
return chatMessaging.sendMessage({
|
|
10966
10984
|
chatMessageVOType: chatMessageVOTypes.EDIT_MESSAGE,
|
|
10967
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
10985
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
10968
10986
|
messageType: params.messageType,
|
|
10969
10987
|
subjectId: params.messageId,
|
|
10970
10988
|
repliedTo: params.repliedTo,
|
|
@@ -11042,7 +11060,7 @@ function Chat(params) {
|
|
|
11042
11060
|
publicized.deleteMessage = function (params, callback) {
|
|
11043
11061
|
return chatMessaging.sendMessage({
|
|
11044
11062
|
chatMessageVOType: chatMessageVOTypes.DELETE_MESSAGE,
|
|
11045
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11063
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11046
11064
|
subjectId: params.messageId,
|
|
11047
11065
|
uniqueId: params.uniqueId,
|
|
11048
11066
|
content: JSON.stringify({
|
|
@@ -11163,7 +11181,7 @@ function Chat(params) {
|
|
|
11163
11181
|
|
|
11164
11182
|
return chatMessaging.sendMessage({
|
|
11165
11183
|
chatMessageVOType: chatMessageVOTypes.DELETE_MESSAGE,
|
|
11166
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11184
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11167
11185
|
content: {
|
|
11168
11186
|
uniqueIds: uniqueIdsList,
|
|
11169
11187
|
ids: messageIdsList,
|
|
@@ -11185,7 +11203,7 @@ function Chat(params) {
|
|
|
11185
11203
|
putInChatSendQueue({
|
|
11186
11204
|
message: {
|
|
11187
11205
|
chatMessageVOType: chatMessageVOTypes.MESSAGE,
|
|
11188
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11206
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11189
11207
|
messageType: 1,
|
|
11190
11208
|
subjectId: params.threadId,
|
|
11191
11209
|
repliedTo: params.repliedTo,
|
|
@@ -11230,7 +11248,7 @@ function Chat(params) {
|
|
|
11230
11248
|
putInChatUploadQueue({
|
|
11231
11249
|
message: {
|
|
11232
11250
|
chatMessageVOType: chatMessageVOTypes.MESSAGE,
|
|
11233
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11251
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11234
11252
|
messageType: (params.messageType && typeof params.messageType.toUpperCase() !== 'undefined' && chatMessageTypes[params.messageType.toUpperCase()] > 0) ? chatMessageTypes[params.messageType.toUpperCase()] : 1,
|
|
11235
11253
|
subjectId: params.threadId,
|
|
11236
11254
|
repliedTo: params.repliedTo,
|
|
@@ -11321,7 +11339,7 @@ function Chat(params) {
|
|
|
11321
11339
|
putInChatSendQueue({
|
|
11322
11340
|
message: {
|
|
11323
11341
|
chatMessageVOType: chatMessageVOTypes.FORWARD_MESSAGE,
|
|
11324
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
11342
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
11325
11343
|
subjectId: params.threadId,
|
|
11326
11344
|
repliedTo: params.repliedTo,
|
|
11327
11345
|
content: messageIdsList,
|
|
@@ -11359,7 +11377,7 @@ function Chat(params) {
|
|
|
11359
11377
|
threadId: threadId,
|
|
11360
11378
|
uniqueId: uniqueId
|
|
11361
11379
|
});
|
|
11362
|
-
}, systemMessageIntervalPitch);
|
|
11380
|
+
}, sdkParams.systemMessageIntervalPitch);
|
|
11363
11381
|
};
|
|
11364
11382
|
|
|
11365
11383
|
publicized.stopTyping = function () {
|
|
@@ -11370,10 +11388,10 @@ function Chat(params) {
|
|
|
11370
11388
|
|
|
11371
11389
|
var deliveryListData = {
|
|
11372
11390
|
chatMessageVOType: chatMessageVOTypes.GET_MESSAGE_DELIVERY_PARTICIPANTS,
|
|
11373
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
11391
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
11374
11392
|
content: {},
|
|
11375
11393
|
pushMsgType: 3,
|
|
11376
|
-
token: token,
|
|
11394
|
+
token: sdkParams.token,
|
|
11377
11395
|
timeout: params.timeout
|
|
11378
11396
|
};
|
|
11379
11397
|
|
|
@@ -11398,10 +11416,10 @@ function Chat(params) {
|
|
|
11398
11416
|
publicized.getMessageSeenList = function (params, callback) {
|
|
11399
11417
|
var seenListData = {
|
|
11400
11418
|
chatMessageVOType: chatMessageVOTypes.GET_MESSAGE_SEEN_PARTICIPANTS,
|
|
11401
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11419
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11402
11420
|
content: {},
|
|
11403
11421
|
pushMsgType: 3,
|
|
11404
|
-
token: token,
|
|
11422
|
+
token: sdkParams.token,
|
|
11405
11423
|
timeout: params.timeout
|
|
11406
11424
|
};
|
|
11407
11425
|
|
|
@@ -11430,11 +11448,11 @@ function Chat(params) {
|
|
|
11430
11448
|
publicized.muteThread = function (params, callback) {
|
|
11431
11449
|
return chatMessaging.sendMessage({
|
|
11432
11450
|
chatMessageVOType: chatMessageVOTypes.MUTE_THREAD,
|
|
11433
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11451
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11434
11452
|
subjectId: params.threadId,
|
|
11435
11453
|
content: {},
|
|
11436
11454
|
pushMsgType: 3,
|
|
11437
|
-
token: token
|
|
11455
|
+
token: sdkParams.token
|
|
11438
11456
|
}, {
|
|
11439
11457
|
onResult: function (result) {
|
|
11440
11458
|
callback && callback(result);
|
|
@@ -11445,11 +11463,11 @@ function Chat(params) {
|
|
|
11445
11463
|
publicized.unMuteThread = function (params, callback) {
|
|
11446
11464
|
return chatMessaging.sendMessage({
|
|
11447
11465
|
chatMessageVOType: chatMessageVOTypes.UNMUTE_THREAD,
|
|
11448
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11466
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11449
11467
|
subjectId: params.threadId,
|
|
11450
11468
|
content: {},
|
|
11451
11469
|
pushMsgType: 3,
|
|
11452
|
-
token: token
|
|
11470
|
+
token: sdkParams.token
|
|
11453
11471
|
}, {
|
|
11454
11472
|
onResult: function (result) {
|
|
11455
11473
|
callback && callback(result);
|
|
@@ -11460,11 +11478,11 @@ function Chat(params) {
|
|
|
11460
11478
|
publicized.closeThread = function (params, callback) {
|
|
11461
11479
|
return chatMessaging.sendMessage({
|
|
11462
11480
|
chatMessageVOType: chatMessageVOTypes.CLOSE_THREAD,
|
|
11463
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11481
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11464
11482
|
subjectId: params.threadId,
|
|
11465
11483
|
content: {},
|
|
11466
11484
|
pushMsgType: 3,
|
|
11467
|
-
token: token
|
|
11485
|
+
token: sdkParams.token
|
|
11468
11486
|
}, {
|
|
11469
11487
|
onResult: function (result) {
|
|
11470
11488
|
callback && callback(result);
|
|
@@ -11475,10 +11493,10 @@ function Chat(params) {
|
|
|
11475
11493
|
publicized.joinPublicThread = function (params, callback) {
|
|
11476
11494
|
var joinThreadData = {
|
|
11477
11495
|
chatMessageVOType: chatMessageVOTypes.JOIN_THREAD,
|
|
11478
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11496
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11479
11497
|
content: '',
|
|
11480
11498
|
pushMsgType: 3,
|
|
11481
|
-
token: token
|
|
11499
|
+
token: sdkParams.token
|
|
11482
11500
|
};
|
|
11483
11501
|
if (params) {
|
|
11484
11502
|
if (typeof params.uniqueName === 'string' && params.uniqueName.length > 0) {
|
|
@@ -11495,10 +11513,10 @@ function Chat(params) {
|
|
|
11495
11513
|
publicized.isPublicThreadNameAvailable = function (params, callback) {
|
|
11496
11514
|
var isNameAvailableData = {
|
|
11497
11515
|
chatMessageVOType: chatMessageVOTypes.IS_NAME_AVAILABLE,
|
|
11498
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11516
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11499
11517
|
content: '',
|
|
11500
11518
|
pushMsgType: 3,
|
|
11501
|
-
token: token
|
|
11519
|
+
token: sdkParams.token
|
|
11502
11520
|
};
|
|
11503
11521
|
if (params) {
|
|
11504
11522
|
if (typeof params.uniqueName === 'string' && params.uniqueName.length > 0) {
|
|
@@ -11515,10 +11533,10 @@ function Chat(params) {
|
|
|
11515
11533
|
publicized.changeThreadPrivacy = function (params, callback) {
|
|
11516
11534
|
var sendData = {
|
|
11517
11535
|
chatMessageVOType: chatMessageVOTypes.CHANGE_THREAD_PRIVACY,
|
|
11518
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11536
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11519
11537
|
pushMsgType: 3,
|
|
11520
11538
|
content: {},
|
|
11521
|
-
token: token,
|
|
11539
|
+
token: sdkParams.token,
|
|
11522
11540
|
timeout: params.timeout
|
|
11523
11541
|
};
|
|
11524
11542
|
|
|
@@ -11573,11 +11591,11 @@ function Chat(params) {
|
|
|
11573
11591
|
publicized.pinThread = function (params, callback) {
|
|
11574
11592
|
return chatMessaging.sendMessage({
|
|
11575
11593
|
chatMessageVOType: chatMessageVOTypes.PIN_THREAD,
|
|
11576
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11594
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11577
11595
|
subjectId: params.threadId,
|
|
11578
11596
|
content: {},
|
|
11579
11597
|
pushMsgType: 3,
|
|
11580
|
-
token: token
|
|
11598
|
+
token: sdkParams.token
|
|
11581
11599
|
}, {
|
|
11582
11600
|
onResult: function (result) {
|
|
11583
11601
|
callback && callback(result);
|
|
@@ -11588,11 +11606,11 @@ function Chat(params) {
|
|
|
11588
11606
|
publicized.unPinThread = function (params, callback) {
|
|
11589
11607
|
return chatMessaging.sendMessage({
|
|
11590
11608
|
chatMessageVOType: chatMessageVOTypes.UNPIN_THREAD,
|
|
11591
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11609
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11592
11610
|
subjectId: params.threadId,
|
|
11593
11611
|
content: {},
|
|
11594
11612
|
pushMsgType: 3,
|
|
11595
|
-
token: token
|
|
11613
|
+
token: sdkParams.token
|
|
11596
11614
|
}, {
|
|
11597
11615
|
onResult: function (result) {
|
|
11598
11616
|
callback && callback(result);
|
|
@@ -11603,7 +11621,7 @@ function Chat(params) {
|
|
|
11603
11621
|
publicized.deleteThread = function (params, callback) {
|
|
11604
11622
|
var sendData = {
|
|
11605
11623
|
chatMessageVOType: chatMessageVOTypes.DELETE_MESSAGE_THREAD,
|
|
11606
|
-
typeCode: generalTypeCode//params.typeCode
|
|
11624
|
+
typeCode: sdkParams.generalTypeCode//params.typeCode
|
|
11607
11625
|
};
|
|
11608
11626
|
|
|
11609
11627
|
if (params) {
|
|
@@ -11638,13 +11656,13 @@ function Chat(params) {
|
|
|
11638
11656
|
publicized.pinMessage = function (params, callback) {
|
|
11639
11657
|
return chatMessaging.sendMessage({
|
|
11640
11658
|
chatMessageVOType: chatMessageVOTypes.PIN_MESSAGE,
|
|
11641
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
11659
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
11642
11660
|
subjectId: params.messageId,
|
|
11643
11661
|
content: JSON.stringify({
|
|
11644
11662
|
'notifyAll': (typeof params.notifyAll === 'boolean') ? params.notifyAll : false
|
|
11645
11663
|
}),
|
|
11646
11664
|
pushMsgType: 3,
|
|
11647
|
-
token: token
|
|
11665
|
+
token: sdkParams.token
|
|
11648
11666
|
}, {
|
|
11649
11667
|
onResult: function (result) {
|
|
11650
11668
|
callback && callback(result);
|
|
@@ -11657,9 +11675,9 @@ function Chat(params) {
|
|
|
11657
11675
|
publicized.spamPrivateThread = function (params, callback) {
|
|
11658
11676
|
var spamData = {
|
|
11659
11677
|
chatMessageVOType: chatMessageVOTypes.SPAM_PV_THREAD,
|
|
11660
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11678
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11661
11679
|
pushMsgType: 3,
|
|
11662
|
-
token: token,
|
|
11680
|
+
token: sdkParams.token,
|
|
11663
11681
|
timeout: params.timeout
|
|
11664
11682
|
};
|
|
11665
11683
|
|
|
@@ -11680,10 +11698,10 @@ function Chat(params) {
|
|
|
11680
11698
|
|
|
11681
11699
|
var blockData = {
|
|
11682
11700
|
chatMessageVOType: chatMessageVOTypes.BLOCK,
|
|
11683
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11701
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11684
11702
|
content: {},
|
|
11685
11703
|
pushMsgType: 3,
|
|
11686
|
-
token: token,
|
|
11704
|
+
token: sdkParams.token,
|
|
11687
11705
|
timeout: params.timeout
|
|
11688
11706
|
};
|
|
11689
11707
|
|
|
@@ -11714,9 +11732,9 @@ function Chat(params) {
|
|
|
11714
11732
|
publicized.unblock = function (params, callback) {
|
|
11715
11733
|
var unblockData = {
|
|
11716
11734
|
chatMessageVOType: chatMessageVOTypes.UNBLOCK,
|
|
11717
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11735
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11718
11736
|
pushMsgType: 3,
|
|
11719
|
-
token: token,
|
|
11737
|
+
token: sdkParams.token,
|
|
11720
11738
|
content: {},
|
|
11721
11739
|
timeout: params.timeout
|
|
11722
11740
|
};
|
|
@@ -11770,10 +11788,10 @@ function Chat(params) {
|
|
|
11770
11788
|
|
|
11771
11789
|
var getBlockedData = {
|
|
11772
11790
|
chatMessageVOType: chatMessageVOTypes.GET_BLOCKED,
|
|
11773
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11791
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11774
11792
|
content: content,
|
|
11775
11793
|
pushMsgType: 3,
|
|
11776
|
-
token: token,
|
|
11794
|
+
token: sdkParams.token,
|
|
11777
11795
|
timeout: params.timeout
|
|
11778
11796
|
};
|
|
11779
11797
|
|
|
@@ -11823,10 +11841,10 @@ function Chat(params) {
|
|
|
11823
11841
|
|
|
11824
11842
|
var getNotSeenDurationData = {
|
|
11825
11843
|
chatMessageVOType: chatMessageVOTypes.GET_NOT_SEEN_DURATION,
|
|
11826
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
11844
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
11827
11845
|
content: content,
|
|
11828
11846
|
pushMsgType: 3,
|
|
11829
|
-
token: token,
|
|
11847
|
+
token: sdkParams.token,
|
|
11830
11848
|
timeout: params.timeout
|
|
11831
11849
|
};
|
|
11832
11850
|
|
|
@@ -11866,11 +11884,11 @@ function Chat(params) {
|
|
|
11866
11884
|
|
|
11867
11885
|
if (typeof params.typeCode === 'string') {
|
|
11868
11886
|
data.typeCode = params.typeCode;
|
|
11869
|
-
} else if (generalTypeCode) {
|
|
11870
|
-
data.typeCode = generalTypeCode;
|
|
11887
|
+
} else if (sdkParams.generalTypeCode) {
|
|
11888
|
+
data.typeCode = sdkParams.generalTypeCode;
|
|
11871
11889
|
}
|
|
11872
11890
|
|
|
11873
|
-
data.ownerId = typeCodeOwnerId ? typeCodeOwnerId : (params.ownerId ? params.ownerId : undefined);
|
|
11891
|
+
data.ownerId = sdkParams.typeCodeOwnerId ? sdkParams.typeCodeOwnerId : (params.ownerId ? params.ownerId : undefined);
|
|
11874
11892
|
|
|
11875
11893
|
if (typeof params.cellphoneNumber === 'string') {
|
|
11876
11894
|
data.cellphoneNumber = params.cellphoneNumber;
|
|
@@ -11896,7 +11914,7 @@ function Chat(params) {
|
|
|
11896
11914
|
method: 'POST',
|
|
11897
11915
|
data: data,
|
|
11898
11916
|
headers: {
|
|
11899
|
-
'_token_': token,
|
|
11917
|
+
'_token_': sdkParams.token,
|
|
11900
11918
|
'_token_issuer_': 1
|
|
11901
11919
|
}
|
|
11902
11920
|
};
|
|
@@ -11999,8 +12017,8 @@ function Chat(params) {
|
|
|
11999
12017
|
chatMessageVOType: chatMessageVOTypes.ADD_CONTACTS,
|
|
12000
12018
|
content: {},
|
|
12001
12019
|
pushMsgType: 3,
|
|
12002
|
-
token: token,
|
|
12003
|
-
typeCode: generalTypeCode
|
|
12020
|
+
token: sdkParams.token,
|
|
12021
|
+
typeCode: sdkParams.generalTypeCode
|
|
12004
12022
|
},
|
|
12005
12023
|
AddContactVO = {},
|
|
12006
12024
|
firstNameList = [],
|
|
@@ -12320,7 +12338,7 @@ function Chat(params) {
|
|
|
12320
12338
|
method: 'GET',
|
|
12321
12339
|
data: data,
|
|
12322
12340
|
headers: {
|
|
12323
|
-
'_token_': token,
|
|
12341
|
+
'_token_': sdkParams.token,
|
|
12324
12342
|
'_token_issuer_': 1
|
|
12325
12343
|
}
|
|
12326
12344
|
};
|
|
@@ -12433,7 +12451,7 @@ function Chat(params) {
|
|
|
12433
12451
|
}
|
|
12434
12452
|
}
|
|
12435
12453
|
|
|
12436
|
-
data.ownerId = typeCodeOwnerId ? typeCodeOwnerId : (params.ownerId ? params.ownerId : undefined);
|
|
12454
|
+
data.ownerId = sdkParams.typeCodeOwnerId ? sdkParams.typeCodeOwnerId : (params.ownerId ? params.ownerId : undefined);
|
|
12437
12455
|
|
|
12438
12456
|
|
|
12439
12457
|
var requestParams = {
|
|
@@ -12441,7 +12459,7 @@ function Chat(params) {
|
|
|
12441
12459
|
method: 'POST',
|
|
12442
12460
|
data: data,
|
|
12443
12461
|
headers: {
|
|
12444
|
-
'_token_': token,
|
|
12462
|
+
'_token_': sdkParams.token,
|
|
12445
12463
|
'_token_issuer_': 1
|
|
12446
12464
|
}
|
|
12447
12465
|
};
|
|
@@ -12555,7 +12573,7 @@ function Chat(params) {
|
|
|
12555
12573
|
method: 'POST',
|
|
12556
12574
|
data: data,
|
|
12557
12575
|
headers: {
|
|
12558
|
-
'_token_': token,
|
|
12576
|
+
'_token_': sdkParams.token,
|
|
12559
12577
|
'_token_issuer_': 1
|
|
12560
12578
|
}
|
|
12561
12579
|
};
|
|
@@ -12823,10 +12841,10 @@ function Chat(params) {
|
|
|
12823
12841
|
publicized.createBot = function (params, callback) {
|
|
12824
12842
|
var createBotData = {
|
|
12825
12843
|
chatMessageVOType: chatMessageVOTypes.CREATE_BOT,
|
|
12826
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
12844
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
12827
12845
|
content: '',
|
|
12828
12846
|
pushMsgType: 3,
|
|
12829
|
-
token: token
|
|
12847
|
+
token: sdkParams.token
|
|
12830
12848
|
};
|
|
12831
12849
|
if (params) {
|
|
12832
12850
|
if (typeof params.botName === 'string' && params.botName.length > 0) {
|
|
@@ -12863,10 +12881,10 @@ function Chat(params) {
|
|
|
12863
12881
|
publicized.defineBotCommand = function (params, callback) {
|
|
12864
12882
|
var defineBotCommandData = {
|
|
12865
12883
|
chatMessageVOType: chatMessageVOTypes.DEFINE_BOT_COMMAND,
|
|
12866
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
12884
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
12867
12885
|
content: {},
|
|
12868
12886
|
pushMsgType: 3,
|
|
12869
|
-
token: token
|
|
12887
|
+
token: sdkParams.token
|
|
12870
12888
|
}, commandList = [];
|
|
12871
12889
|
if (params) {
|
|
12872
12890
|
if (typeof params.botName !== 'string' || params.botName.length === 0) {
|
|
@@ -12908,10 +12926,10 @@ function Chat(params) {
|
|
|
12908
12926
|
publicized.removeBotCommand = function (params, callback) {
|
|
12909
12927
|
var defineBotCommandData = {
|
|
12910
12928
|
chatMessageVOType: chatMessageVOTypes.REMOVE_BOT_COMMANDS,
|
|
12911
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
12929
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
12912
12930
|
content: {},
|
|
12913
12931
|
pushMsgType: 3,
|
|
12914
|
-
token: token
|
|
12932
|
+
token: sdkParams.token
|
|
12915
12933
|
}, commandList = [];
|
|
12916
12934
|
|
|
12917
12935
|
if (params) {
|
|
@@ -12958,10 +12976,10 @@ function Chat(params) {
|
|
|
12958
12976
|
publicized.startBot = function (params, callback) {
|
|
12959
12977
|
var startBotData = {
|
|
12960
12978
|
chatMessageVOType: chatMessageVOTypes.START_BOT,
|
|
12961
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
12979
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
12962
12980
|
content: {},
|
|
12963
12981
|
pushMsgType: 3,
|
|
12964
|
-
token: token
|
|
12982
|
+
token: sdkParams.token
|
|
12965
12983
|
};
|
|
12966
12984
|
if (params) {
|
|
12967
12985
|
if (typeof +params.threadId !== 'number' || params.threadId < 0) {
|
|
@@ -12999,10 +13017,10 @@ function Chat(params) {
|
|
|
12999
13017
|
publicized.stopBot = function (params, callback) {
|
|
13000
13018
|
var stopBotData = {
|
|
13001
13019
|
chatMessageVOType: chatMessageVOTypes.STOP_BOT,
|
|
13002
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13020
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13003
13021
|
content: {},
|
|
13004
13022
|
pushMsgType: 3,
|
|
13005
|
-
token: token
|
|
13023
|
+
token: sdkParams.token
|
|
13006
13024
|
};
|
|
13007
13025
|
if (params) {
|
|
13008
13026
|
if (typeof +params.threadId !== 'number' || params.threadId < 0) {
|
|
@@ -13040,10 +13058,10 @@ function Chat(params) {
|
|
|
13040
13058
|
publicized.getBotCommandsList = function (params, callback) {
|
|
13041
13059
|
var getBotCommandsListData = {
|
|
13042
13060
|
chatMessageVOType: chatMessageVOTypes.BOT_COMMANDS,
|
|
13043
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13061
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13044
13062
|
content: {},
|
|
13045
13063
|
pushMsgType: 3,
|
|
13046
|
-
token: token
|
|
13064
|
+
token: sdkParams.token
|
|
13047
13065
|
};
|
|
13048
13066
|
|
|
13049
13067
|
if (params) {
|
|
@@ -13077,10 +13095,10 @@ function Chat(params) {
|
|
|
13077
13095
|
publicized.getThreadAllBots = function (params, callback) {
|
|
13078
13096
|
var getThreadBotsData = {
|
|
13079
13097
|
chatMessageVOType: chatMessageVOTypes.THREAD_ALL_BOTS,
|
|
13080
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13098
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13081
13099
|
content: {},
|
|
13082
13100
|
pushMsgType: 3,
|
|
13083
|
-
token: token
|
|
13101
|
+
token: sdkParams.token
|
|
13084
13102
|
};
|
|
13085
13103
|
|
|
13086
13104
|
if (params) {
|
|
@@ -13112,10 +13130,10 @@ function Chat(params) {
|
|
|
13112
13130
|
publicized.createTag = function (params, callback) {
|
|
13113
13131
|
var createTagData = {
|
|
13114
13132
|
chatMessageVOType: chatMessageVOTypes.CREATE_TAG,
|
|
13115
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13133
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13116
13134
|
content: {},
|
|
13117
13135
|
pushMsgType: 3,
|
|
13118
|
-
token: token
|
|
13136
|
+
token: sdkParams.token
|
|
13119
13137
|
};
|
|
13120
13138
|
|
|
13121
13139
|
if (params) {
|
|
@@ -13146,10 +13164,10 @@ function Chat(params) {
|
|
|
13146
13164
|
publicized.editTag = function (params, callback) {
|
|
13147
13165
|
var sendData = {
|
|
13148
13166
|
chatMessageVOType: chatMessageVOTypes.EDIT_TAG,
|
|
13149
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13167
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13150
13168
|
content: {},
|
|
13151
13169
|
pushMsgType: 3,
|
|
13152
|
-
token: token
|
|
13170
|
+
token: sdkParams.token
|
|
13153
13171
|
};
|
|
13154
13172
|
|
|
13155
13173
|
if (params) {
|
|
@@ -13190,10 +13208,10 @@ function Chat(params) {
|
|
|
13190
13208
|
publicized.deleteTag = function (params, callback) {
|
|
13191
13209
|
var sendData = {
|
|
13192
13210
|
chatMessageVOType: chatMessageVOTypes.DELETE_TAG,
|
|
13193
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13211
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13194
13212
|
content: {},
|
|
13195
13213
|
pushMsgType: 3,
|
|
13196
|
-
token: token
|
|
13214
|
+
token: sdkParams.token
|
|
13197
13215
|
};
|
|
13198
13216
|
|
|
13199
13217
|
if (params) {
|
|
@@ -13224,10 +13242,10 @@ function Chat(params) {
|
|
|
13224
13242
|
publicized.getTagList = function (params, callback) {
|
|
13225
13243
|
var sendData = {
|
|
13226
13244
|
chatMessageVOType: chatMessageVOTypes.GET_TAG_LIST,
|
|
13227
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13245
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13228
13246
|
content: {},
|
|
13229
13247
|
pushMsgType: 3,
|
|
13230
|
-
token: token
|
|
13248
|
+
token: sdkParams.token
|
|
13231
13249
|
};
|
|
13232
13250
|
|
|
13233
13251
|
return chatMessaging.sendMessage(sendData, {
|
|
@@ -13240,7 +13258,7 @@ function Chat(params) {
|
|
|
13240
13258
|
publicized.addTagParticipants = function (params, callback) {
|
|
13241
13259
|
var sendData = {
|
|
13242
13260
|
chatMessageVOType: chatMessageVOTypes.ADD_TAG_PARTICIPANT,
|
|
13243
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13261
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13244
13262
|
content: []
|
|
13245
13263
|
};
|
|
13246
13264
|
|
|
@@ -13280,7 +13298,7 @@ function Chat(params) {
|
|
|
13280
13298
|
publicized.removeTagParticipants = function (params, callback) {
|
|
13281
13299
|
var sendData = {
|
|
13282
13300
|
chatMessageVOType: chatMessageVOTypes.REMOVE_TAG_PARTICIPANT,
|
|
13283
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13301
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13284
13302
|
content: []
|
|
13285
13303
|
};
|
|
13286
13304
|
|
|
@@ -13320,7 +13338,7 @@ function Chat(params) {
|
|
|
13320
13338
|
publicized.registerAssistant = function (params, callback) {
|
|
13321
13339
|
var sendData = {
|
|
13322
13340
|
chatMessageVOType: chatMessageVOTypes.REGISTER_ASSISTANT,
|
|
13323
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13341
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13324
13342
|
content: []
|
|
13325
13343
|
};
|
|
13326
13344
|
|
|
@@ -13389,7 +13407,7 @@ function Chat(params) {
|
|
|
13389
13407
|
publicized.deactivateAssistant = function (params, callback) {
|
|
13390
13408
|
var sendData = {
|
|
13391
13409
|
chatMessageVOType: chatMessageVOTypes.DEACTIVATE_ASSISTANT,
|
|
13392
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13410
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13393
13411
|
content: []
|
|
13394
13412
|
};
|
|
13395
13413
|
|
|
@@ -13451,7 +13469,7 @@ function Chat(params) {
|
|
|
13451
13469
|
publicized.blockAssistant = function (params, callback) {
|
|
13452
13470
|
var sendData = {
|
|
13453
13471
|
chatMessageVOType: chatMessageVOTypes.BLOCK_ASSISTANT,
|
|
13454
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13472
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13455
13473
|
content: []
|
|
13456
13474
|
};
|
|
13457
13475
|
|
|
@@ -13513,7 +13531,7 @@ function Chat(params) {
|
|
|
13513
13531
|
publicized.unblockAssistant = function (params, callback) {
|
|
13514
13532
|
var sendData = {
|
|
13515
13533
|
chatMessageVOType: chatMessageVOTypes.UNBLOCK_ASSISTANT,
|
|
13516
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13534
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13517
13535
|
content: []
|
|
13518
13536
|
};
|
|
13519
13537
|
|
|
@@ -13575,10 +13593,10 @@ function Chat(params) {
|
|
|
13575
13593
|
publicized.getAssistantsList = function (params, callback) {
|
|
13576
13594
|
var sendData = {
|
|
13577
13595
|
chatMessageVOType: chatMessageVOTypes.GET_ASSISTANTS,
|
|
13578
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13596
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13579
13597
|
content: {},
|
|
13580
13598
|
pushMsgType: 3,
|
|
13581
|
-
token: token
|
|
13599
|
+
token: sdkParams.token
|
|
13582
13600
|
};
|
|
13583
13601
|
|
|
13584
13602
|
if (params) {
|
|
@@ -13612,10 +13630,10 @@ function Chat(params) {
|
|
|
13612
13630
|
publicized.getBlockedAssistantsList = function (params, callback) {
|
|
13613
13631
|
var sendData = {
|
|
13614
13632
|
chatMessageVOType: chatMessageVOTypes.BLOCKED_ASSISTANTS,
|
|
13615
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13633
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13616
13634
|
content: {},
|
|
13617
13635
|
pushMsgType: 3,
|
|
13618
|
-
token: token
|
|
13636
|
+
token: sdkParams.token
|
|
13619
13637
|
};
|
|
13620
13638
|
|
|
13621
13639
|
if (params) {
|
|
@@ -13649,7 +13667,7 @@ function Chat(params) {
|
|
|
13649
13667
|
publicized.getAssistantsHistory = function (params, callback) {
|
|
13650
13668
|
var sendData = {
|
|
13651
13669
|
chatMessageVOType: chatMessageVOTypes.ASSISTANT_HISTORY,
|
|
13652
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
13670
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
13653
13671
|
content: {
|
|
13654
13672
|
offset: +params.offset > 0 ? +params.offset : 0,
|
|
13655
13673
|
count: +params.count > 0 ? +params.count : config.getHistoryCount
|
|
@@ -13782,7 +13800,7 @@ function Chat(params) {
|
|
|
13782
13800
|
var stackArr = [], wantedCount = 10000, stepCount = 500, offset = 0;
|
|
13783
13801
|
var sendData = {
|
|
13784
13802
|
chatMessageVOType: chatMessageVOTypes.EXPORT_CHAT,
|
|
13785
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
13803
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
13786
13804
|
content: {
|
|
13787
13805
|
offset: +params.offset > 0 ? +params.offset : offset,
|
|
13788
13806
|
count: +params.count > 0 ? +params.count : wantedCount,//config.getHistoryCount,
|
|
@@ -13996,7 +14014,7 @@ function Chat(params) {
|
|
|
13996
14014
|
|
|
13997
14015
|
var sendData = {
|
|
13998
14016
|
chatMessageVOType: chatMessageVOTypes.MUTUAL_GROUPS,
|
|
13999
|
-
typeCode: generalTypeCode,//params.typeCode,
|
|
14017
|
+
typeCode: sdkParams.generalTypeCode,//params.typeCode,
|
|
14000
14018
|
content: {
|
|
14001
14019
|
count: count,
|
|
14002
14020
|
offset: offset
|
|
@@ -14078,9 +14096,9 @@ function Chat(params) {
|
|
|
14078
14096
|
|
|
14079
14097
|
var locationPingData = {
|
|
14080
14098
|
chatMessageVOType: chatMessageVOTypes.LOCATION_PING,
|
|
14081
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
14099
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
14082
14100
|
pushMsgType: 3,
|
|
14083
|
-
token: token
|
|
14101
|
+
token: sdkParams.token
|
|
14084
14102
|
}, content = {};
|
|
14085
14103
|
|
|
14086
14104
|
if (params) {
|
|
@@ -14138,10 +14156,10 @@ function Chat(params) {
|
|
|
14138
14156
|
|
|
14139
14157
|
publicized.setToken = function (newToken) {
|
|
14140
14158
|
if (typeof newToken !== 'undefined') {
|
|
14141
|
-
token = newToken;
|
|
14142
|
-
callModule.updateToken(token);
|
|
14143
|
-
chatMessaging.updateToken(token);
|
|
14144
|
-
chatEvents.updateToken(token);
|
|
14159
|
+
sdkParams.token = newToken;
|
|
14160
|
+
callModule.updateToken(sdkParams.token);
|
|
14161
|
+
chatMessaging.updateToken(sdkParams.token);
|
|
14162
|
+
chatEvents.updateToken(sdkParams.token);
|
|
14145
14163
|
if(!chatMessaging.userInfo || !chatMessaging.userInfo.id) {
|
|
14146
14164
|
getUserAndUpdateSDKState();
|
|
14147
14165
|
}
|
|
@@ -14222,11 +14240,11 @@ function Chat(params) {
|
|
|
14222
14240
|
let userId = params.userId || chatMessaging.userInfo.id
|
|
14223
14241
|
, sendData = {
|
|
14224
14242
|
chatMessageVOType: chatMessageVOTypes.CUSTOMER_INFO,
|
|
14225
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
14243
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
14226
14244
|
content: [
|
|
14227
14245
|
userId
|
|
14228
14246
|
],
|
|
14229
|
-
token: token
|
|
14247
|
+
token: sdkParams.token
|
|
14230
14248
|
};
|
|
14231
14249
|
|
|
14232
14250
|
return chatMessaging.sendMessage(sendData, {
|
|
@@ -14241,8 +14259,8 @@ function Chat(params) {
|
|
|
14241
14259
|
}, callback) {
|
|
14242
14260
|
var sendData = {
|
|
14243
14261
|
chatMessageVOType: chatMessageVOTypes.ARCHIVE_THREAD,
|
|
14244
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
14245
|
-
token: token,
|
|
14262
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
14263
|
+
token: sdkParams.token,
|
|
14246
14264
|
subjectId: threadId
|
|
14247
14265
|
};
|
|
14248
14266
|
|
|
@@ -14257,8 +14275,8 @@ function Chat(params) {
|
|
|
14257
14275
|
}, callback) {
|
|
14258
14276
|
var sendData = {
|
|
14259
14277
|
chatMessageVOType: chatMessageVOTypes.UNARCHIVE_THREAD,
|
|
14260
|
-
typeCode: generalTypeCode, //params.typeCode,
|
|
14261
|
-
token: token,
|
|
14278
|
+
typeCode: sdkParams.generalTypeCode, //params.typeCode,
|
|
14279
|
+
token: sdkParams.token,
|
|
14262
14280
|
subjectId: threadId
|
|
14263
14281
|
};
|
|
14264
14282
|
|