podchat 12.5.2 → 12.5.4-snapshot.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 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.4-snapshot.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.5.2"
11
+ "version:release": "npm version 12.5.3"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
@@ -39,7 +39,7 @@
39
39
  "indexeddbshim": "^3.10.0",
40
40
  "jsdom": "^18.0.0",
41
41
  "mime": "^2.4.4",
42
- "podasync": "^2.8.3",
42
+ "podasync": "^2.8.3-snapshot.1",
43
43
  "query-string": "^6.8.1",
44
44
  "request": "^2.88.0"
45
45
  },
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',
@@ -10824,12 +10825,18 @@
10824
10825
  };
10825
10826
 
10826
10827
  if (!returnData.hasError) {
10827
- for(var i in result.result) {
10828
- stackArr.push(result.result[i]);
10829
- }
10828
+ // for(var i in result.result) {
10829
+ // stackArr.push(result.result[i]);
10830
+ // }
10831
+ stackArr.push(...result.result);
10830
10832
 
10831
10833
  consoleLogging && console.log("[SDK][exportChat] a step passed...");
10832
- wantedCount = wantedCount > result.contentCount ? result.contentCount : wantedCount;
10834
+ // wantedCount = wantedCount > result.contentCount ? result.contentCount : wantedCount;
10835
+
10836
+ if(result.result.length < stepCount) {
10837
+ wantedCount = stackArr.length
10838
+ }
10839
+
10833
10840
  setTimeout(function () {
10834
10841
  fireEvent('threadEvents', {
10835
10842
  type: 'EXPORT_CHAT',
@@ -12948,6 +12955,96 @@
12948
12955
  });
12949
12956
  };
12950
12957
 
12958
+ this.createSelfThread = function (params, callback) {
12959
+ var content = {
12960
+ type: createThreadTypes['SELF']
12961
+ };
12962
+
12963
+ if (params) {
12964
+ if (typeof params.description === 'string') {
12965
+ content.description = params.description;
12966
+ }
12967
+
12968
+ if (typeof params.metadata === 'string') {
12969
+ content.metadata = params.metadata;
12970
+ } else if (typeof params.metadata === 'object') {
12971
+ try {
12972
+ content.metadata = JSON.stringify(params.metadata);
12973
+ } catch (e) {
12974
+ consoleLogging && console.log(e);
12975
+ }
12976
+ }
12977
+
12978
+ if (typeof params.message == 'object') {
12979
+ content.message = {};
12980
+
12981
+ if (typeof params.message.text === 'string') {
12982
+ content.message.text = params.message.text;
12983
+ }
12984
+
12985
+ if (typeof params.message.uniqueId === 'string') {
12986
+ content.message.uniqueId = params.message.uniqueId;
12987
+ }
12988
+
12989
+ if (params.message.type > 0) {
12990
+ content.message.messageType = params.message.type;
12991
+ }
12992
+
12993
+ if (params.message.repliedTo > 0) {
12994
+ content.message.repliedTo = params.message.repliedTo;
12995
+ }
12996
+
12997
+ if (typeof params.message.metadata === 'string') {
12998
+ content.message.metadata = params.message.metadata;
12999
+ } else if (typeof params.message.metadata === 'object') {
13000
+ content.message.metadata = JSON.stringify(params.message.metadata);
13001
+ }
13002
+
13003
+ if (typeof params.message.systemMetadata === 'string') {
13004
+ content.message.systemMetadata = params.message.systemMetadata;
13005
+ } else if (typeof params.message.systemMetadata === 'object') {
13006
+ content.message.systemMetadata = JSON.stringify(params.message.systemMetadata);
13007
+ }
13008
+
13009
+ if (Array.isArray(params.message.forwardedMessageIds)) {
13010
+ content.message.forwardedMessageIds = params.message.forwardedMessageIds;
13011
+ content.message.forwardedUniqueIds = [];
13012
+ for (var i = 0; i < params.message.forwardedMessageIds.length; i++) {
13013
+ content.message.forwardedUniqueIds.push(Utility.generateUUID());
13014
+ }
13015
+ }
13016
+
13017
+ }
13018
+ }
13019
+
13020
+ var sendMessageParams = {
13021
+ chatMessageVOType: chatMessageVOTypes.CREATE_THREAD,
13022
+ typeCode: generalTypeCode,//params.typeCode,
13023
+ content: content
13024
+ };
13025
+
13026
+ return sendMessage(sendMessageParams, {
13027
+ onResult: function (result) {
13028
+ var returnData = {
13029
+ hasError: result.hasError,
13030
+ cache: false,
13031
+ errorMessage: result.errorMessage,
13032
+ errorCode: result.errorCode
13033
+ };
13034
+
13035
+ if (!returnData.hasError) {
13036
+ var messageContent = result.result;
13037
+
13038
+ returnData.result = {
13039
+ thread: createThread(messageContent)
13040
+ };
13041
+ }
13042
+
13043
+ callback && callback(returnData);
13044
+ }
13045
+ });
13046
+ };
13047
+
12951
13048
  this.mapStaticImage = function (params, callback) {
12952
13049
  var data = {},
12953
13050
  url = SERVICE_ADDRESSES.MAP_ADDRESS + SERVICES_PATH.STATIC_IMAGE,
package/test/test.jpg DELETED
Binary file