podchat 12.5.2 → 12.5.3

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 CHANGED
@@ -3,6 +3,18 @@
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.3] - 14-11-2022
7
+ ### Added
8
+ - Method: createSelfThread
9
+
10
+ ## [12.5.2] - 5-11-2022
11
+ ### Changed
12
+ - Modified podspace methods
13
+
14
+ ## [12.5.1] - 21-8-2022
15
+ ### Added
16
+ - ExportChat
17
+
6
18
  ## [12.5.0] - 11-7-2022
7
19
  ### Added
8
20
  - Global typeCode and typeCodeOwnerId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podchat",
3
- "version": "12.5.2",
3
+ "version": "12.5.3",
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.5.2"
11
+ "version:release": "npm version 12.5.3"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
package/src/chat.js CHANGED
@@ -218,7 +218,8 @@
218
218
  PUBLIC_GROUP: 2,
219
219
  CHANNEL_GROUP: 4,
220
220
  CHANNEL: 8,
221
- NOTIFICATION_CHANNEL: 16
221
+ NOTIFICATION_CHANNEL: 16,
222
+ SELF: 0x80
222
223
  },
223
224
  chatMessageTypes = {
224
225
  TEXT: '1',
@@ -12948,6 +12949,96 @@
12948
12949
  });
12949
12950
  };
12950
12951
 
12952
+ this.createSelfThread = function (params, callback) {
12953
+ var content = {
12954
+ type: createThreadTypes['SELF']
12955
+ };
12956
+
12957
+ if (params) {
12958
+ if (typeof params.description === 'string') {
12959
+ content.description = params.description;
12960
+ }
12961
+
12962
+ if (typeof params.metadata === 'string') {
12963
+ content.metadata = params.metadata;
12964
+ } else if (typeof params.metadata === 'object') {
12965
+ try {
12966
+ content.metadata = JSON.stringify(params.metadata);
12967
+ } catch (e) {
12968
+ consoleLogging && console.log(e);
12969
+ }
12970
+ }
12971
+
12972
+ if (typeof params.message == 'object') {
12973
+ content.message = {};
12974
+
12975
+ if (typeof params.message.text === 'string') {
12976
+ content.message.text = params.message.text;
12977
+ }
12978
+
12979
+ if (typeof params.message.uniqueId === 'string') {
12980
+ content.message.uniqueId = params.message.uniqueId;
12981
+ }
12982
+
12983
+ if (params.message.type > 0) {
12984
+ content.message.messageType = params.message.type;
12985
+ }
12986
+
12987
+ if (params.message.repliedTo > 0) {
12988
+ content.message.repliedTo = params.message.repliedTo;
12989
+ }
12990
+
12991
+ if (typeof params.message.metadata === 'string') {
12992
+ content.message.metadata = params.message.metadata;
12993
+ } else if (typeof params.message.metadata === 'object') {
12994
+ content.message.metadata = JSON.stringify(params.message.metadata);
12995
+ }
12996
+
12997
+ if (typeof params.message.systemMetadata === 'string') {
12998
+ content.message.systemMetadata = params.message.systemMetadata;
12999
+ } else if (typeof params.message.systemMetadata === 'object') {
13000
+ content.message.systemMetadata = JSON.stringify(params.message.systemMetadata);
13001
+ }
13002
+
13003
+ if (Array.isArray(params.message.forwardedMessageIds)) {
13004
+ content.message.forwardedMessageIds = params.message.forwardedMessageIds;
13005
+ content.message.forwardedUniqueIds = [];
13006
+ for (var i = 0; i < params.message.forwardedMessageIds.length; i++) {
13007
+ content.message.forwardedUniqueIds.push(Utility.generateUUID());
13008
+ }
13009
+ }
13010
+
13011
+ }
13012
+ }
13013
+
13014
+ var sendMessageParams = {
13015
+ chatMessageVOType: chatMessageVOTypes.CREATE_THREAD,
13016
+ typeCode: generalTypeCode,//params.typeCode,
13017
+ content: content
13018
+ };
13019
+
13020
+ return sendMessage(sendMessageParams, {
13021
+ onResult: function (result) {
13022
+ var returnData = {
13023
+ hasError: result.hasError,
13024
+ cache: false,
13025
+ errorMessage: result.errorMessage,
13026
+ errorCode: result.errorCode
13027
+ };
13028
+
13029
+ if (!returnData.hasError) {
13030
+ var messageContent = result.result;
13031
+
13032
+ returnData.result = {
13033
+ thread: createThread(messageContent)
13034
+ };
13035
+ }
13036
+
13037
+ callback && callback(returnData);
13038
+ }
13039
+ });
13040
+ };
13041
+
12951
13042
  this.mapStaticImage = function (params, callback) {
12952
13043
  var data = {},
12953
13044
  url = SERVICE_ADDRESSES.MAP_ADDRESS + SERVICES_PATH.STATIC_IMAGE,
package/test/test.jpg DELETED
Binary file