stream-chat-angular 4.19.0 → 4.21.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.
@@ -1 +1 @@
1
- export declare const version = "4.19.0";
1
+ export declare const version = "4.21.0";
@@ -355,7 +355,7 @@
355
355
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
356
356
  }
357
357
 
358
- var version = '4.19.0';
358
+ var version = '4.21.0';
359
359
 
360
360
  /**
361
361
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -463,8 +463,9 @@
463
463
  * @param apiKey
464
464
  * @param userOrId
465
465
  * @param userTokenOrProvider You can provide a token, or the keyword 'guest' to connect as [guest user](https://getstream.io/chat/docs/javascript/authless_users/?language=javascript#guest-users)
466
+ * @param clientOptions Setting to provide to the Stream client instance
466
467
  */
467
- ChatClientService.prototype.init = function (apiKey, userOrId, userTokenOrProvider) {
468
+ ChatClientService.prototype.init = function (apiKey, userOrId, userTokenOrProvider, clientOptions) {
468
469
  var _a;
469
470
  return __awaiter(this, void 0, void 0, function () {
470
471
  var result, channels, removeNotification;
@@ -472,7 +473,7 @@
472
473
  return __generator(this, function (_d) {
473
474
  switch (_d.label) {
474
475
  case 0:
475
- this.chatClient = streamChat.StreamChat.getInstance(apiKey);
476
+ this.chatClient = streamChat.StreamChat.getInstance(apiKey, clientOptions);
476
477
  this.chatClient.devToken;
477
478
  return [4 /*yield*/, this.ngZone.runOutsideAngular(function () { return __awaiter(_this, void 0, void 0, function () {
478
479
  var user, _d, error_1, sdkPrefix;
@@ -2149,8 +2150,8 @@
2149
2150
  return __awaiter(this, void 0, void 0, function () {
2150
2151
  var imageFiles, dataFiles, videoFiles, newUploads;
2151
2152
  var _this = this;
2152
- return __generator(this, function (_d) {
2153
- switch (_d.label) {
2153
+ return __generator(this, function (_e) {
2154
+ switch (_e.label) {
2154
2155
  case 0:
2155
2156
  if (!fileList) {
2156
2157
  return [2 /*return*/];
@@ -2186,7 +2187,7 @@
2186
2187
  this.attachmentUploadsSubject.next(__spreadArray(__spreadArray([], __read(this.attachmentUploadsSubject.getValue())), __read(newUploads)));
2187
2188
  return [4 /*yield*/, this.uploadAttachments(newUploads)];
2188
2189
  case 1:
2189
- _d.sent();
2190
+ _e.sent();
2190
2191
  return [2 /*return*/];
2191
2192
  }
2192
2193
  });
@@ -2211,8 +2212,8 @@
2211
2212
  AttachmentService.prototype.retryAttachmentUpload = function (file) {
2212
2213
  return __awaiter(this, void 0, void 0, function () {
2213
2214
  var attachmentUploads, upload;
2214
- return __generator(this, function (_d) {
2215
- switch (_d.label) {
2215
+ return __generator(this, function (_e) {
2216
+ switch (_e.label) {
2216
2217
  case 0:
2217
2218
  attachmentUploads = this.attachmentUploadsSubject.getValue();
2218
2219
  upload = attachmentUploads.find(function (u) { return u.file === file; });
@@ -2223,7 +2224,7 @@
2223
2224
  this.attachmentUploadsSubject.next(__spreadArray([], __read(attachmentUploads)));
2224
2225
  return [4 /*yield*/, this.uploadAttachments([upload])];
2225
2226
  case 1:
2226
- _d.sent();
2227
+ _e.sent();
2227
2228
  return [2 /*return*/];
2228
2229
  }
2229
2230
  });
@@ -2237,24 +2238,24 @@
2237
2238
  var _a;
2238
2239
  return __awaiter(this, void 0, void 0, function () {
2239
2240
  var attachmentUploads, result, index, error_1, index;
2240
- return __generator(this, function (_d) {
2241
- switch (_d.label) {
2241
+ return __generator(this, function (_e) {
2242
+ switch (_e.label) {
2242
2243
  case 0:
2243
2244
  attachmentUploads = this.attachmentUploadsSubject.getValue();
2244
2245
  if (!(upload.state === 'success' &&
2245
2246
  !((_a = upload.fromAttachment) === null || _a === void 0 ? void 0 : _a.isCustomAttachment))) return [3 /*break*/, 5];
2246
- _d.label = 1;
2247
+ _e.label = 1;
2247
2248
  case 1:
2248
- _d.trys.push([1, 3, , 4]);
2249
+ _e.trys.push([1, 3, , 4]);
2249
2250
  return [4 /*yield*/, this.channelService.deleteAttachment(upload)];
2250
2251
  case 2:
2251
- _d.sent();
2252
+ _e.sent();
2252
2253
  result = __spreadArray([], __read(attachmentUploads));
2253
2254
  index = attachmentUploads.indexOf(upload);
2254
2255
  result.splice(index, 1);
2255
2256
  return [3 /*break*/, 4];
2256
2257
  case 3:
2257
- error_1 = _d.sent();
2258
+ error_1 = _e.sent();
2258
2259
  result = attachmentUploads;
2259
2260
  this.notificationService.addTemporaryNotification('streamChat.Error deleting attachment');
2260
2261
  return [3 /*break*/, 4];
@@ -2263,7 +2264,7 @@
2263
2264
  result = __spreadArray([], __read(attachmentUploads));
2264
2265
  index = attachmentUploads.indexOf(upload);
2265
2266
  result.splice(index, 1);
2266
- _d.label = 6;
2267
+ _e.label = 6;
2267
2268
  case 6:
2268
2269
  this.attachmentUploadsSubject.next(__spreadArray([], __read(result)));
2269
2270
  return [2 /*return*/];
@@ -2280,7 +2281,7 @@
2280
2281
  return attachmentUploads
2281
2282
  .filter(function (r) { return r.state === 'success'; })
2282
2283
  .map(function (r) {
2283
- var _a, _b, _c;
2284
+ var _a, _b, _c, _d;
2284
2285
  var attachment = {
2285
2286
  type: r.type,
2286
2287
  };
@@ -2288,14 +2289,15 @@
2288
2289
  return r.fromAttachment;
2289
2290
  }
2290
2291
  else {
2292
+ attachment.mime_type = (_a = r.file) === null || _a === void 0 ? void 0 : _a.type;
2291
2293
  if (r.type === 'image') {
2292
- attachment.fallback = (_a = r.file) === null || _a === void 0 ? void 0 : _a.name;
2294
+ attachment.fallback = (_b = r.file) === null || _b === void 0 ? void 0 : _b.name;
2293
2295
  attachment.image_url = r.url;
2294
2296
  }
2295
2297
  else {
2296
2298
  attachment.asset_url = r.url;
2297
- attachment.title = (_b = r.file) === null || _b === void 0 ? void 0 : _b.name;
2298
- attachment.file_size = (_c = r.file) === null || _c === void 0 ? void 0 : _c.size;
2299
+ attachment.title = (_c = r.file) === null || _c === void 0 ? void 0 : _c.name;
2300
+ attachment.file_size = (_d = r.file) === null || _d === void 0 ? void 0 : _d.size;
2299
2301
  attachment.thumb_url = r.thumb_url;
2300
2302
  }
2301
2303
  }
@@ -2318,6 +2320,7 @@
2318
2320
  type: 'image',
2319
2321
  file: {
2320
2322
  name: attachment.fallback,
2323
+ type: attachment.mime_type,
2321
2324
  },
2322
2325
  fromAttachment: attachment,
2323
2326
  });
@@ -2329,6 +2332,7 @@
2329
2332
  file: {
2330
2333
  name: attachment.title,
2331
2334
  size: attachment.file_size,
2335
+ type: attachment.mime_type,
2332
2336
  },
2333
2337
  type: attachment.type,
2334
2338
  thumb_url: attachment.thumb_url,
@@ -2359,13 +2363,13 @@
2359
2363
  return __awaiter(this, void 0, void 0, function () {
2360
2364
  var result, attachmentUploads;
2361
2365
  var _this = this;
2362
- return __generator(this, function (_d) {
2363
- switch (_d.label) {
2366
+ return __generator(this, function (_e) {
2367
+ switch (_e.label) {
2364
2368
  case 0:
2365
2369
  this.attachmentUploadInProgressCounterSubject.next(this.attachmentUploadInProgressCounterSubject.getValue() + 1);
2366
2370
  return [4 /*yield*/, this.channelService.uploadAttachments(uploads)];
2367
2371
  case 1:
2368
- result = _d.sent();
2372
+ result = _e.sent();
2369
2373
  attachmentUploads = this.attachmentUploadsSubject.getValue();
2370
2374
  result.forEach(function (r) {
2371
2375
  var upload = attachmentUploads.find(function (upload) { return upload.file === r.file; });