podchat 12.6.9-snapshot.0 → 12.6.9-snapshot.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":"12.6.8","date":"۱۴۰۴/۱۱/۲۱","VersionInfo":"Release: true, Snapshot: false, Is For Test: false"}
1
+ {"version":"12.6.9-snapshot.1","date":"۱۴۰۵/۴/۲۸","VersionInfo":"Release: false, Snapshot: true, Is For Test: true"}
package/dist/node/chat.js CHANGED
@@ -2088,6 +2088,40 @@ function Chat(params) {
2088
2088
  });
2089
2089
  break;
2090
2090
 
2091
+ /**
2092
+ * Type 102 Close Thread
2093
+ */
2094
+ case _constants.chatMessageVOTypes.CLOSE_THREAD:
2095
+ if (app.store.messagesCallbacks[uniqueId]) {
2096
+ app.store.messagesCallbacks[uniqueId](_utility["default"].createReturnData(chatMessage.typeCode, chatMessage.ownerId, false, '', 0, messageContent));
2097
+ }
2098
+ if (app.sdkParams.fullResponseObject) {
2099
+ app.threadMethods.getThreads({
2100
+ threadIds: [threadId],
2101
+ typeCode: typeCode
2102
+ }, function (threadsResult) {
2103
+ var thread = threadsResult.result.threads[0];
2104
+ // thread.mute = true;
2105
+
2106
+ app.chatEvents.fireEvent('threadEvents', {
2107
+ type: 'THREAD_CLOSE',
2108
+ result: {
2109
+ thread: thread,
2110
+ typeCode: typeCode
2111
+ }
2112
+ });
2113
+ });
2114
+ } else {
2115
+ app.chatEvents.fireEvent('threadEvents', {
2116
+ type: 'THREAD_CLOSE',
2117
+ result: {
2118
+ thread: threadId,
2119
+ typeCode: typeCode
2120
+ }
2121
+ });
2122
+ }
2123
+ break;
2124
+
2091
2125
  /**
2092
2126
  * Type 110 Active Call Participants List
2093
2127
  */
@@ -8334,6 +8368,20 @@ function Chat(params) {
8334
8368
  this.getCurrentTypeCode = function () {
8335
8369
  return app.typeCodes.getActiveTypeCode().typeCode;
8336
8370
  };
8371
+ this.closeThread = function (params, callback) {
8372
+ return app.messenger.sendMessage({
8373
+ chatMessageVOType: _constants.chatMessageVOTypes.CLOSE_THREAD,
8374
+ typeCode: params.typeCode,
8375
+ subjectId: params.threadId,
8376
+ content: {},
8377
+ pushMsgType: 3,
8378
+ token: app.sdkParams.token
8379
+ }, {
8380
+ onResult: function onResult(result) {
8381
+ callback && callback(result);
8382
+ }
8383
+ });
8384
+ };
8337
8385
  init();
8338
8386
  }
8339
8387
  module.exports = Chat;
@@ -82,7 +82,8 @@ function ContactsV2(app) {
82
82
  '_token_': app.sdkParams.token,
83
83
  '_token_issuer_': 1,
84
84
  "Content-Type": "application/x-www-form-urlencoded"
85
- }
85
+ },
86
+ uniqueId: reqUniqueId
86
87
  };
87
88
  app.httpRequest.httpRequest(requestParams, function (result) {
88
89
  if (!result.hasError) {
@@ -212,7 +213,8 @@ function ContactsV2(app) {
212
213
  headers: {
213
214
  '_token_': app.sdkParams.token,
214
215
  '_token_issuer_': 1
215
- }
216
+ },
217
+ uniqueId: reqUniqueId
216
218
  };
217
219
  app.httpRequest.httpRequest(requestParams, function (result) {
218
220
  if (!result.hasError) {
@@ -297,7 +299,8 @@ function ContactsV2(app) {
297
299
  headers: {
298
300
  '_token_': app.sdkParams.token,
299
301
  '_token_issuer_': 1
300
- }
302
+ },
303
+ uniqueId: reqUniqueId
301
304
  };
302
305
  app.httpRequest.httpRequest(requestParams, function (result) {
303
306
  if (!result.hasError) {
@@ -343,7 +346,7 @@ function ContactsV2(app) {
343
346
  if (typeof params.uniqueId === 'string') {
344
347
  data.uniqueId = params.uniqueId;
345
348
  }
346
- if (typeof params.id === 'string') {
349
+ if (params.id) {
347
350
  data.id = params.id;
348
351
  }
349
352
  if (typeof params.firstName === 'string') {
@@ -358,10 +361,10 @@ function ContactsV2(app) {
358
361
  if (typeof params.q === 'string') {
359
362
  data.q = params.q;
360
363
  }
361
- if (typeof params.linkedUserId === 'number') {
364
+ if (params.linkedUserId) {
362
365
  data.linkedUserId = params.linkedUserId;
363
366
  }
364
- if (typeof params.targetUserId === 'string') {
367
+ if (params.targetUserId) {
365
368
  data.targetUserId = params.targetUserId;
366
369
  }
367
370
  if (typeof params.typeCode === 'string') {
@@ -408,7 +411,8 @@ function ContactsV2(app) {
408
411
  headers: {
409
412
  '_token_': app.sdkParams.token,
410
413
  '_token_issuer_': 1
411
- }
414
+ },
415
+ uniqueId: reqUniqueId
412
416
  };
413
417
  app.httpRequest.httpRequest(requestParams, function (result) {
414
418
  if (!result.hasError) {
@@ -84,6 +84,7 @@ var chatMessageVOTypes = {
84
84
  MUTE_CALL_PARTICIPANT: 97,
85
85
  UNMUTE_CALL_PARTICIPANT: 98,
86
86
  LOGOUT: 100,
87
+ CLOSE_THREAD: 102,
87
88
  ACTIVE_CALL_PARTICIPANTS: 110,
88
89
  CALL_SESSION_CREATED: 111,
89
90
  TURN_ON_VIDEO_CALL: 113,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podchat",
3
- "version": "12.6.9-snapshot.0",
3
+ "version": "12.6.9-snapshot.2",
4
4
  "description": "Javascript SDK to use POD's Chat Service",
5
5
  "main": "./dist/node/chat.js",
6
6
  "scripts": {
@@ -1 +1 @@
1
- {"version":"12.6.8","date":"۱۴۰۴/۱۱/۲۱","VersionInfo":"Release: true, Snapshot: false, Is For Test: false"}
1
+ {"version":"12.6.9-snapshot.1","date":"۱۴۰۵/۴/۲۸","VersionInfo":"Release: false, Snapshot: true, Is For Test: true"}
package/src/chat.js CHANGED
@@ -2275,6 +2275,42 @@ function Chat(params) {
2275
2275
 
2276
2276
  break;
2277
2277
 
2278
+ /**
2279
+ * Type 102 Close Thread
2280
+ */
2281
+ case chatMessageVOTypes.CLOSE_THREAD:
2282
+ if (app.store.messagesCallbacks[uniqueId]) {
2283
+ app.store.messagesCallbacks[uniqueId](Utility.createReturnData(chatMessage.typeCode, chatMessage.ownerId, false, '', 0, messageContent));
2284
+ }
2285
+
2286
+ if (app.sdkParams.fullResponseObject) {
2287
+ app.threadMethods.getThreads({
2288
+ threadIds: [threadId],
2289
+ typeCode,
2290
+ }, function (threadsResult) {
2291
+ var thread = threadsResult.result.threads[0];
2292
+ // thread.mute = true;
2293
+
2294
+ app.chatEvents.fireEvent('threadEvents', {
2295
+ type: 'THREAD_CLOSE',
2296
+ result: {
2297
+ thread: thread,
2298
+ typeCode
2299
+ }
2300
+ });
2301
+ });
2302
+ } else {
2303
+ app.chatEvents.fireEvent('threadEvents', {
2304
+ type: 'THREAD_CLOSE',
2305
+ result: {
2306
+ thread: threadId,
2307
+ typeCode,
2308
+ }
2309
+ });
2310
+ }
2311
+
2312
+ break;
2313
+
2278
2314
  /**
2279
2315
  * Type 110 Active Call Participants List
2280
2316
  */
@@ -9387,6 +9423,21 @@ function Chat(params) {
9387
9423
  return app.typeCodes.getActiveTypeCode().typeCode
9388
9424
  };
9389
9425
 
9426
+ this.closeThread = function (params, callback) {
9427
+ return app.messenger.sendMessage({
9428
+ chatMessageVOType: chatMessageVOTypes.CLOSE_THREAD,
9429
+ typeCode: params.typeCode,
9430
+ subjectId: params.threadId,
9431
+ content: {},
9432
+ pushMsgType: 3,
9433
+ token: app.sdkParams.token
9434
+ }, {
9435
+ onResult: function (result) {
9436
+ callback && callback(result);
9437
+ }
9438
+ });
9439
+ };
9440
+
9390
9441
  init();
9391
9442
  }
9392
9443
 
@@ -85,7 +85,8 @@ function ContactsV2(app) {
85
85
  '_token_': app.sdkParams.token,
86
86
  '_token_issuer_': 1,
87
87
  "Content-Type": "application/x-www-form-urlencoded"
88
- }
88
+ },
89
+ uniqueId: reqUniqueId
89
90
  };
90
91
 
91
92
  app.httpRequest.httpRequest(requestParams, function (result) {
@@ -233,7 +234,8 @@ function ContactsV2(app) {
233
234
  headers: {
234
235
  '_token_': app.sdkParams.token,
235
236
  '_token_issuer_': 1
236
- }
237
+ },
238
+ uniqueId: reqUniqueId
237
239
  };
238
240
 
239
241
  app.httpRequest.httpRequest(requestParams, function (result) {
@@ -325,7 +327,8 @@ function ContactsV2(app) {
325
327
  headers: {
326
328
  '_token_': app.sdkParams.token,
327
329
  '_token_issuer_': 1
328
- }
330
+ },
331
+ uniqueId: reqUniqueId
329
332
  };
330
333
 
331
334
  app.httpRequest.httpRequest(requestParams, function (result) {
@@ -374,7 +377,7 @@ function ContactsV2(app) {
374
377
  data.uniqueId = params.uniqueId;
375
378
  }
376
379
 
377
- if (typeof params.id === 'string') {
380
+ if (params.id) {
378
381
  data.id = params.id;
379
382
  }
380
383
 
@@ -394,11 +397,11 @@ function ContactsV2(app) {
394
397
  data.q = params.q;
395
398
  }
396
399
 
397
- if (typeof params.linkedUserId === 'number') {
400
+ if (params.linkedUserId) {
398
401
  data.linkedUserId = params.linkedUserId;
399
402
  }
400
403
 
401
- if (typeof params.targetUserId === 'string') {
404
+ if (params.targetUserId) {
402
405
  data.targetUserId = params.targetUserId;
403
406
  }
404
407
 
@@ -453,7 +456,8 @@ function ContactsV2(app) {
453
456
  headers: {
454
457
  '_token_': app.sdkParams.token,
455
458
  '_token_issuer_': 1
456
- }
459
+ },
460
+ uniqueId: reqUniqueId
457
461
  };
458
462
 
459
463
  app.httpRequest.httpRequest(requestParams, function (result) {
@@ -81,7 +81,7 @@ const chatMessageVOTypes = {
81
81
  UNMUTE_CALL_PARTICIPANT: 98,
82
82
 
83
83
  LOGOUT: 100,
84
-
84
+ CLOSE_THREAD: 102,
85
85
  ACTIVE_CALL_PARTICIPANTS: 110,
86
86
  CALL_SESSION_CREATED: 111,
87
87
  TURN_ON_VIDEO_CALL: 113,