chat4app-client-angular 1.0.8 → 1.0.10

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.
@@ -2041,19 +2041,19 @@
2041
2041
  });
2042
2042
  };
2043
2043
  Chat4appClientAngularService.prototype.createGroup = function (group) {
2044
- var url = this.chatUrl + "/group";
2044
+ var url = this.chatUrl + "group";
2045
2045
  return this.http.post(url, group, {
2046
2046
  headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
2047
2047
  });
2048
2048
  };
2049
2049
  Chat4appClientAngularService.prototype.getGroup = function (chatId, groupId) {
2050
- var url = this.chatUrl + "/group/" + groupId + "/" + chatId;
2050
+ var url = this.chatUrl + "group/" + groupId + "/" + chatId;
2051
2051
  return this.http.get(url, {
2052
2052
  headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
2053
2053
  });
2054
2054
  };
2055
2055
  Chat4appClientAngularService.prototype.listGroups = function (chatId, externalId) {
2056
- var url = this.chatUrl + "/group/";
2056
+ var url = this.chatUrl + "group/";
2057
2057
  if (chatId && chatId.length > 0) {
2058
2058
  url += "&chatId=" + chatId;
2059
2059
  }
@@ -2065,7 +2065,7 @@
2065
2065
  });
2066
2066
  };
2067
2067
  Chat4appClientAngularService.prototype.listFilesGroup = function (chatId, groupId) {
2068
- var url = this.chatUrl + "/group/" + chatId;
2068
+ var url = this.chatUrl + "group/" + chatId;
2069
2069
  if (groupId && groupId.length > 0) {
2070
2070
  url += "&groupId=" + chatId;
2071
2071
  }
@@ -2073,6 +2073,12 @@
2073
2073
  headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
2074
2074
  });
2075
2075
  };
2076
+ Chat4appClientAngularService.prototype.event = function (eventName, chatUserExternalId) {
2077
+ var url = this.chatUrl + "event/" + eventName + "?chatUserExternalId=" + chatUserExternalId;
2078
+ return this.http.put(url, null, {
2079
+ headers: new i1.HttpHeaders().set('Authorization', this.getBearerToken())
2080
+ });
2081
+ };
2076
2082
  /* Token */
2077
2083
  Chat4appClientAngularService.prototype.getBearerToken = function () {
2078
2084
  var ret = "Bearer " + window.sessionStorage.getItem("chat4AppSessionToken");
@@ -2211,6 +2217,8 @@
2211
2217
  chatCallback.onChatClosed(chat4appMessage);
2212
2218
  }
2213
2219
  else if (data.type == "count_notread") {
2220
+ console.log("count_notread");
2221
+ console.log(data);
2214
2222
  var chat4appMessage = new Chat4AppMessageReceive();
2215
2223
  chat4appMessage.data.chatId = data.chatId;
2216
2224
  chat4appMessage.data.chatMessageId = data.chatMessageId;
@@ -2247,7 +2255,7 @@
2247
2255
  }
2248
2256
  if (!(!this.nc || (this.nc.isClose && this.nc.isClose()))) return [3 /*break*/, 2];
2249
2257
  _b = that;
2250
- return [4 /*yield*/, nats_min.connect({ url: server, user: chatUserExternalId, pass: this.getBearerToken(), reconnect: true })];
2258
+ return [4 /*yield*/, nats_min.connect({ url: server, user: chatUserExternalId, pass: this.getBearerToken(), reconnect: false })];
2251
2259
  case 1:
2252
2260
  _b.nc = _c.sent();
2253
2261
  _c.label = 2;
@@ -2381,7 +2389,15 @@
2381
2389
  if (that.debug) {
2382
2390
  console.log("publish chat4app.user.online " + userId + " ");
2383
2391
  }
2384
- that.nc.publish("chat4app.user.online", userId);
2392
+ try {
2393
+ that.nc.publish("chat4app.user.online", userId);
2394
+ }
2395
+ catch (e) {
2396
+ if (_this.debug) {
2397
+ console.log("try reconnect...");
2398
+ }
2399
+ _this.ensureConn(userId);
2400
+ }
2385
2401
  }, 1000);
2386
2402
  if (this.debug) {
2387
2403
  console.log("Subscribe online chat4app.user." + userId + ".online");