podchat 12.4.0 → 12.5.0
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 +20 -0
- package/package.json +2 -2
- package/src/chat.js +54 -7
- package/examples/config.js +0 -59
package/changelog.md
CHANGED
|
@@ -3,10 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented here.
|
|
4
4
|
to see complete list of changelog please visit [ChangeLog](https://github.com/masoudmanson/pod-chat/blob/master/changelog.md)
|
|
5
5
|
|
|
6
|
+
## [12.5.0] - 11-7-2022
|
|
7
|
+
### Added
|
|
8
|
+
- Added global typeCode and typeCodeOwnerId
|
|
9
|
+
- Added SWITCH_TO_GROUP_CALL_REQUEST , RECORD_CALL_STARTED , fixed GET_CALLS_TO_JOIN
|
|
10
|
+
- Added callId to event type: CALL_STARTED
|
|
11
|
+
- Removed contentCount from hasNext calculation in getThreads and getHistory
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [12.4.0] - 24-5-2022
|
|
15
|
+
### Added
|
|
16
|
+
- Parameter: threadInfo in startCall and startGroupCall
|
|
17
|
+
- Parameter: joinCall to acceptCall
|
|
18
|
+
- Parameter: threadId to getCallsList
|
|
19
|
+
- Method: getCallsToJoin
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- error on eventType that has no callback
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [12.3.0] - 26-4-2022
|
|
7
26
|
### Added
|
|
8
27
|
- callNoAnswerTimeout to SDK configs
|
|
9
28
|
|
|
29
|
+
|
|
10
30
|
## [12.2.0] - 23-1-2022
|
|
11
31
|
### Added
|
|
12
32
|
- callId in END CALL events
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podchat",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.5.0",
|
|
4
4
|
"description": "Javascript SDK to use POD's Chat Service",
|
|
5
5
|
"main": "./src/chat.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"publish:snapshot": "npm run version:snapshot && npm publish --tag snapshot",
|
|
9
9
|
"version:snapshot": "npm version prerelease --preid snapshot",
|
|
10
10
|
"publish:release": "npm run version:release && npm publish",
|
|
11
|
-
"version:release": "npm version 12.
|
|
11
|
+
"version:release": "npm version 12.5.0"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
package/src/chat.js
CHANGED
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
userInfo,
|
|
68
68
|
token = params.token,
|
|
69
69
|
generalTypeCode = params.typeCode || 'default',
|
|
70
|
+
typeCodeOwnerId = params.typeCodeOwnerId || null,
|
|
70
71
|
mapApiKey = params.mapApiKey || '8b77db18704aa646ee5aaea13e7370f4f88b9e8c',
|
|
71
72
|
deviceId,
|
|
72
73
|
isNode = Utility.isNode(),
|
|
@@ -199,6 +200,9 @@
|
|
|
199
200
|
GET_CALLS_TO_JOIN: 129,
|
|
200
201
|
EXPORT_CHAT: 152,
|
|
201
202
|
|
|
203
|
+
SWITCH_TO_GROUP_CALL_REQUEST: 221,
|
|
204
|
+
RECORD_CALL_STARTED: 222,
|
|
205
|
+
|
|
202
206
|
ERROR: 999
|
|
203
207
|
},
|
|
204
208
|
inviteeVOidTypes = {
|
|
@@ -396,7 +400,6 @@
|
|
|
396
400
|
callRequestTimeout = (typeof params.callRequestTimeout === 'number' && params.callRequestTimeout >= 0) ? params.callRequestTimeout : 10000,
|
|
397
401
|
callNoAnswerTimeout = params.callOptions && params.callOptions.callNoAnswerTimeout ? params.callOptions.callNoAnswerTimeout : 0;
|
|
398
402
|
|
|
399
|
-
|
|
400
403
|
/*******************************************************
|
|
401
404
|
* P R I V A T E M E T H O D S *
|
|
402
405
|
*******************************************************/
|
|
@@ -1523,10 +1526,14 @@
|
|
|
1523
1526
|
tokenIssuer: 1
|
|
1524
1527
|
};
|
|
1525
1528
|
|
|
1526
|
-
if (params.typeCode) {
|
|
1527
|
-
messageVO.typeCode = params.typeCode;
|
|
1528
|
-
} else if (generalTypeCode) {
|
|
1529
|
+
if (params.typeCode || generalTypeCode) {
|
|
1530
|
+
messageVO.typeCode = generalTypeCode;//params.typeCode;
|
|
1531
|
+
}/* else if (generalTypeCode) {
|
|
1529
1532
|
messageVO.typeCode = generalTypeCode;
|
|
1533
|
+
}*/
|
|
1534
|
+
|
|
1535
|
+
if(typeCodeOwnerId) {
|
|
1536
|
+
messageVO.ownerId = typeCodeOwnerId;
|
|
1530
1537
|
}
|
|
1531
1538
|
|
|
1532
1539
|
if (params.messageType) {
|
|
@@ -1826,6 +1833,10 @@
|
|
|
1826
1833
|
* @return {undefined}
|
|
1827
1834
|
*/
|
|
1828
1835
|
chatMessageHandler = function (chatMessage) {
|
|
1836
|
+
if(chatMessage.typeCode && chatMessage.typeCode !== generalTypeCode) {
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1829
1840
|
var threadId = chatMessage.subjectId,
|
|
1830
1841
|
type = chatMessage.type,
|
|
1831
1842
|
// TODO Check this again
|
|
@@ -3263,6 +3274,7 @@
|
|
|
3263
3274
|
messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
3264
3275
|
}
|
|
3265
3276
|
|
|
3277
|
+
messageContent.callId = threadId;
|
|
3266
3278
|
fireEvent('callEvents', {
|
|
3267
3279
|
type: 'CALL_STARTED',
|
|
3268
3280
|
result: messageContent
|
|
@@ -3601,6 +3613,42 @@
|
|
|
3601
3613
|
|
|
3602
3614
|
break;
|
|
3603
3615
|
|
|
3616
|
+
/**
|
|
3617
|
+
* Type 129 Get Calls To Join
|
|
3618
|
+
*/
|
|
3619
|
+
case chatMessageVOTypes.GET_CALLS_TO_JOIN:
|
|
3620
|
+
if (messagesCallbacks[uniqueId]) {
|
|
3621
|
+
messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
3622
|
+
}
|
|
3623
|
+
break;
|
|
3624
|
+
|
|
3625
|
+
/**
|
|
3626
|
+
* Type 221 Event to tell us p2p call converted to a group call
|
|
3627
|
+
*/
|
|
3628
|
+
case chatMessageVOTypes.SWITCH_TO_GROUP_CALL_REQUEST:
|
|
3629
|
+
fireEvent('callEvents', {
|
|
3630
|
+
type: 'SWITCH_TO_GROUP_CALL',
|
|
3631
|
+
result: messageContent //contains: isGroup, callId, threadId
|
|
3632
|
+
});
|
|
3633
|
+
|
|
3634
|
+
break;
|
|
3635
|
+
|
|
3636
|
+
/**
|
|
3637
|
+
* Type 222 Call Recording Started
|
|
3638
|
+
*/
|
|
3639
|
+
case chatMessageVOTypes.RECORD_CALL_STARTED:
|
|
3640
|
+
if (messagesCallbacks[uniqueId]) {
|
|
3641
|
+
messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
3642
|
+
}
|
|
3643
|
+
|
|
3644
|
+
fireEvent('callEvents', {
|
|
3645
|
+
type: 'CALL_RECORDING_STARTED',
|
|
3646
|
+
result: messageContent
|
|
3647
|
+
});
|
|
3648
|
+
|
|
3649
|
+
break;
|
|
3650
|
+
|
|
3651
|
+
|
|
3604
3652
|
/**
|
|
3605
3653
|
* Type 999 All unknown errors
|
|
3606
3654
|
*/
|
|
@@ -4965,7 +5013,7 @@
|
|
|
4965
5013
|
resultData = {
|
|
4966
5014
|
threads: [],
|
|
4967
5015
|
contentCount: result.contentCount,
|
|
4968
|
-
hasNext: (offset + count < result.contentCount && messageLength > 0),
|
|
5016
|
+
hasNext: messageContent && !(messageLength < count),//(offset + count < result.contentCount && messageLength > 0),
|
|
4969
5017
|
nextOffset: offset + messageLength
|
|
4970
5018
|
},
|
|
4971
5019
|
threadData;
|
|
@@ -6249,8 +6297,7 @@
|
|
|
6249
6297
|
var resultData = {
|
|
6250
6298
|
history: history,
|
|
6251
6299
|
contentCount: result.contentCount,
|
|
6252
|
-
hasNext: (sendMessageParams.content.offset + sendMessageParams.content.count < result.contentCount &&
|
|
6253
|
-
messageLength > 0),
|
|
6300
|
+
hasNext: result.result && !(result.result.length < sendMessageParams.content.count),//(sendMessageParams.content.offset + sendMessageParams.content.count < result.contentCount &&messageLength > 0),
|
|
6254
6301
|
nextOffset: sendMessageParams.content.offset + messageLength
|
|
6255
6302
|
};
|
|
6256
6303
|
|
package/examples/config.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var CONFIG = {
|
|
2
|
-
// token: '1cfce37b60d4421db870e67dcfe407d9', // gameBOT
|
|
3
|
-
// token: '567179f126d84277b8dced22599e0b82', // takiBOT
|
|
4
|
-
// token: '1a9d91ccb4d5431b89dd74f7e0bb417b', // talkyBOT
|
|
5
|
-
// token: 'd10237d19ad24ba089f66bdfe3de9974', // Clasor
|
|
6
|
-
// token: "b135febd870746f88032df84dfb01c85", // Clasor Test BOT
|
|
7
|
-
token: 'b45fa3d386f54e34b82d81a11bc27e90',
|
|
8
|
-
|
|
9
|
-
// Permenant Integration Tokens
|
|
10
|
-
// token: "3dd6895c8dc64f93bcd43b58dcc2aab3", // Masoud Amjadi
|
|
11
|
-
// token: "9c627a9125d04ebf8455bf57bb33d2a9", // Pooria Pahlevani
|
|
12
|
-
// token: "f6464d4e0f044314b1a668f90287ba26", // Nadia Anvari
|
|
13
|
-
// token: "99506f7c32c849a9a6e2a954303b81ee", // Farhad Kheirkhah
|
|
14
|
-
// token: "979aa5de03934c73a5c6c855bd80cb04", // Mahyar Zhiani
|
|
15
|
-
// token: "a47c9016c8354236abc01395093bed5c", // Ahmad Sajadi
|
|
16
|
-
// token: "d3114ed2fd2a49b4a0a386e727c9e5fa", // Saba Safavi
|
|
17
|
-
// token: "872110b9c6944eda9bc98ef2a68dcf50", // Leila Nemati
|
|
18
|
-
|
|
19
|
-
// ActiveMQ Connection config
|
|
20
|
-
// queueHost: "10.56.16.25",
|
|
21
|
-
// queuePort: "61613",
|
|
22
|
-
// queueUsername: "root",
|
|
23
|
-
// queuePassword: "zalzalak",
|
|
24
|
-
// queueReceive: "queue-in-amjadi-stomp",
|
|
25
|
-
// queueSend: "queue-out-amjadi-stomp",
|
|
26
|
-
|
|
27
|
-
// Neshan Map Api Token
|
|
28
|
-
mapApiKey: '8b77db18704aa646ee5aaea13e7370f4f88b9e8c',
|
|
29
|
-
|
|
30
|
-
// Main Server
|
|
31
|
-
main: {
|
|
32
|
-
socketAddress: 'wss://msg.pod.ir/ws',
|
|
33
|
-
ssoHost: 'https://accounts.pod.ir',
|
|
34
|
-
platformHost: 'https://api.pod.ir/srv/core',
|
|
35
|
-
fileServer: 'https://core.pod.ir',
|
|
36
|
-
podSpaceFileServer: 'https://podspace.podland.ir',
|
|
37
|
-
serverName: 'chat-server'
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
// Sand Box Server
|
|
41
|
-
sandbox: {
|
|
42
|
-
socketAddress: "wss://chat-sandbox.pod.ir/ws",
|
|
43
|
-
ssoHost: "https://accounts.pod.ir",
|
|
44
|
-
platformHost: "https://sandbox.pod.ir:8043/srv/basic-platform",
|
|
45
|
-
fileServer: 'https://core.pod.ir',
|
|
46
|
-
podSpaceFileServer: 'http://sandbox.podspace.ir:8080',
|
|
47
|
-
serverName: "chat-server"
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
// Integration Server
|
|
51
|
-
integration: {
|
|
52
|
-
socketAddress: "ws://172.16.110.235:8003/ws",
|
|
53
|
-
ssoHost: "http://172.16.110.76",
|
|
54
|
-
platformHost: "http://172.16.110.235:8003/srv/bptest-core",
|
|
55
|
-
fileServer: 'https://core.pod.ir',
|
|
56
|
-
podSpaceFileServer: 'http://172.16.110.61:8780/podspace',
|
|
57
|
-
serverName: "chatlocal"
|
|
58
|
-
}
|
|
59
|
-
}
|