stream-chat-angular 4.48.0 → 4.49.1

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.
Files changed (47) hide show
  1. package/assets/i18n/en.d.ts +2 -2
  2. package/assets/version.d.ts +1 -1
  3. package/bundles/stream-chat-angular.umd.js +52 -9
  4. package/bundles/stream-chat-angular.umd.js.map +1 -1
  5. package/esm2015/assets/i18n/en.js +4 -4
  6. package/esm2015/assets/version.js +2 -2
  7. package/esm2015/lib/attachment.service.js +21 -4
  8. package/esm2015/lib/channel.service.js +28 -2
  9. package/esm2015/lib/message-input/message-input.component.js +2 -2
  10. package/esm2015/lib/types.js +1 -1
  11. package/fesm2015/stream-chat-angular.js +52 -9
  12. package/fesm2015/stream-chat-angular.js.map +1 -1
  13. package/lib/channel.service.d.ts +5 -1
  14. package/lib/types.d.ts +5 -0
  15. package/package.json +1 -1
  16. package/src/assets/i18n/en.ts +5 -3
  17. package/src/assets/styles/css/index.css +1 -1
  18. package/src/assets/styles/scss/MessageInput.scss +6 -0
  19. package/src/assets/styles/scss/_base.scss +0 -41
  20. package/src/assets/styles/scss/index.scss +0 -1
  21. package/src/assets/styles/v2/css/emoji-mart.css +1 -0
  22. package/src/assets/styles/v2/css/emoji-replacement.css +1 -0
  23. package/src/assets/styles/v2/css/index.css +1 -1
  24. package/src/assets/styles/v2/css/index.layout.css +1 -1
  25. package/src/assets/styles/v2/scss/AttachmentPreviewList/AttachmentPreviewList-layout.scss +1 -0
  26. package/src/assets/styles/v2/scss/Autocomplete/Autocomplete-layout.scss +8 -0
  27. package/src/assets/styles/v2/scss/ChannelHeader/ChannelHeader-layout.scss +4 -0
  28. package/src/assets/styles/v2/scss/ChannelPreview/ChannelPreview-layout.scss +1 -0
  29. package/src/assets/styles/v2/scss/ChannelSearch/ChannelSearch-layout.scss +5 -0
  30. package/src/assets/styles/v2/scss/LinkPreview/LinkPreview-layout.scss +49 -0
  31. package/src/assets/styles/v2/scss/LinkPreview/LinkPreview-theme.scss +17 -0
  32. package/src/assets/styles/v2/scss/LinkPreview/index.scss +2 -0
  33. package/src/assets/styles/v2/scss/Message/Message-layout.scss +8 -0
  34. package/src/assets/styles/v2/scss/MessageInput/MessageInput-layout.scss +1 -1
  35. package/src/assets/styles/v2/scss/MessageList/MessageList-layout.scss +1 -0
  36. package/src/assets/styles/v2/scss/MessageList/VirtualizedMessageList-layout.scss +4 -0
  37. package/src/assets/styles/v2/scss/Notification/Notification-layout.scss +4 -0
  38. package/src/assets/styles/v2/scss/Thread/Thread-layout.scss +4 -0
  39. package/src/assets/styles/v2/scss/Tooltip/Tooltip-layout.scss +1 -0
  40. package/src/assets/styles/v2/scss/_emoji-replacement.scss +1 -0
  41. package/src/assets/styles/v2/scss/_utils.scss +5 -0
  42. package/src/assets/styles/v2/scss/index.layout.scss +1 -1
  43. package/src/assets/styles/v2/scss/index.scss +1 -1
  44. package/src/assets/version.ts +1 -1
  45. package/src/assets/styles/css/index.css.map +0 -1
  46. package/src/assets/styles/v2/css/index.css.map +0 -1
  47. package/src/assets/styles/v2/css/index.layout.css.map +0 -1
@@ -22,7 +22,8 @@ export declare const en: {
22
22
  'Error removing message pin': string;
23
23
  'Error unmuting a user ...': string;
24
24
  'Error uploading file': string;
25
- 'Error uploading image': string;
25
+ 'Error uploading file, maximum file size exceeded': string;
26
+ 'Error uploading file, extension not supported': string;
26
27
  'Error deleting attachment': string;
27
28
  'Error \u00B7 Unsent': string;
28
29
  'Error: {{ errorMessage }}': string;
@@ -82,7 +83,6 @@ export declare const en: {
82
83
  'Sending links is not allowed in this conversation': string;
83
84
  "You can't send messages in this channel": string;
84
85
  "You can't send thread replies in this channel": string;
85
- 'Unsupported file type: {{type}}': string;
86
86
  'Message not found': string;
87
87
  'No chats here yet\u2026': string;
88
88
  'user is typing': string;
@@ -1 +1 @@
1
- export declare const version = "4.48.0";
1
+ export declare const version = "4.49.1";
@@ -356,7 +356,7 @@
356
356
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
357
357
  }
358
358
 
359
- var version = '4.48.0';
359
+ var version = '4.49.1';
360
360
 
361
361
  /**
362
362
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -1274,6 +1274,7 @@
1274
1274
  case 1:
1275
1275
  uploadResults = _h.sent();
1276
1276
  uploadResults.forEach(function (uploadResult, i) {
1277
+ var _a, _b, _c, _d, _e, _f, _g;
1277
1278
  var file = uploads[i].file;
1278
1279
  var type = uploads[i].type;
1279
1280
  if (uploadResult.status === 'fulfilled') {
@@ -1287,7 +1288,32 @@
1287
1288
  });
1288
1289
  }
1289
1290
  else {
1290
- result.push({ file: file, type: type, state: 'error' });
1291
+ var reason = 'unknown';
1292
+ var extraData = void 0;
1293
+ /* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment */
1294
+ var message =
1295
+ /* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access */
1296
+ (_b = (_a = uploadResult.reason.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message;
1297
+ /* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment */
1298
+ var code =
1299
+ /* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access */
1300
+ (_d = (_c = uploadResult.reason.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.code;
1301
+ if (code === 22) {
1302
+ reason = 'file-size';
1303
+ extraData = { param: ((_e = /\d+MB/.exec(message || '')) === null || _e === void 0 ? void 0 : _e[0]) || '100MB' };
1304
+ }
1305
+ else if (code === 4 &&
1306
+ ((_f = message === null || message === void 0 ? void 0 : message.toLowerCase()) === null || _f === void 0 ? void 0 : _f.includes('file extension'))) {
1307
+ reason = 'file-extension';
1308
+ extraData = { param: ((_g = /\.\w+/.exec(message)) === null || _g === void 0 ? void 0 : _g[0]) || '' };
1309
+ }
1310
+ result.push({
1311
+ file: file,
1312
+ type: type,
1313
+ state: 'error',
1314
+ errorReason: reason,
1315
+ errorExtraInfo: extraData ? [extraData] : undefined,
1316
+ });
1291
1317
  }
1292
1318
  });
1293
1319
  return [2 /*return*/, result];
@@ -2657,6 +2683,7 @@
2657
2683
  result = _e.sent();
2658
2684
  attachmentUploads = this.attachmentUploadsSubject.getValue();
2659
2685
  result.forEach(function (r) {
2686
+ var _a, _b, _c, _d;
2660
2687
  var upload = attachmentUploads.find(function (upload) { return upload.file === r.file; });
2661
2688
  if (!upload) {
2662
2689
  if (r.url) {
@@ -2668,9 +2695,25 @@
2668
2695
  upload.url = r.url;
2669
2696
  upload.thumb_url = r.thumb_url;
2670
2697
  if (upload.state === 'error') {
2671
- _this.notificationService.addTemporaryNotification(upload.type === 'image'
2672
- ? 'streamChat.Error uploading image'
2673
- : 'streamChat.Error uploading file');
2698
+ upload.errorReason = r.errorReason;
2699
+ upload.errorExtraInfo = r.errorExtraInfo;
2700
+ var errorKey = void 0;
2701
+ var translateParams = { name: upload.file.name };
2702
+ switch (upload.errorReason) {
2703
+ case 'file-extension':
2704
+ errorKey =
2705
+ 'streamChat.Error uploading file, extension not supported';
2706
+ translateParams.ext = (_b = (_a = upload.errorExtraInfo) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.param;
2707
+ break;
2708
+ case 'file-size':
2709
+ errorKey =
2710
+ 'streamChat.Error uploading file, maximum file size exceeded';
2711
+ translateParams.limit = (_d = (_c = upload.errorExtraInfo) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.param;
2712
+ break;
2713
+ default:
2714
+ errorKey = 'streamChat.Error uploading file';
2715
+ }
2716
+ _this.notificationService.addTemporaryNotification(errorKey, 'error', undefined, translateParams);
2674
2717
  }
2675
2718
  });
2676
2719
  this.attachmentUploadInProgressCounterSubject.next(this.attachmentUploadInProgressCounterSubject.getValue() - 1);
@@ -2880,8 +2923,9 @@
2880
2923
  'Error pinning message': 'Error pinning message',
2881
2924
  'Error removing message pin': 'Error removing message pin',
2882
2925
  'Error unmuting a user ...': 'Error unmuting a user ...',
2883
- 'Error uploading file': 'Error uploading file',
2884
- 'Error uploading image': 'Error uploading image',
2926
+ 'Error uploading file': 'Error uploading file "{{ name }}"',
2927
+ 'Error uploading file, maximum file size exceeded': 'Error uploading "{{ name }}", maximum file size {{ limit }} exceeded',
2928
+ 'Error uploading file, extension not supported': 'Error uploading "{{ name }}", type {{ ext }} not supported',
2885
2929
  'Error deleting attachment': 'Error deleting attachment',
2886
2930
  'Error · Unsent': "Message couldn't be sent",
2887
2931
  'Error: {{ errorMessage }}': 'Error: {{ errorMessage }}',
@@ -2941,7 +2985,6 @@
2941
2985
  'Sending links is not allowed in this conversation': 'Sending links is not allowed in this conversation',
2942
2986
  "You can't send messages in this channel": "You can't send messages in this channel",
2943
2987
  "You can't send thread replies in this channel": "You can't send thread replies in this channel",
2944
- 'Unsupported file type: {{type}}': 'Unsupported file type: {{type}}',
2945
2988
  'Message not found': 'Message not found',
2946
2989
  'No chats here yet…': 'No chats here yet…',
2947
2990
  'user is typing': '{{ user }} is typing',
@@ -4397,7 +4440,7 @@
4397
4440
  hasBlockedMimeType ||
4398
4441
  hasNotAllowedExtension ||
4399
4442
  hasNotAllowedMimeType) {
4400
- _this.notificationService.addTemporaryNotification('streamChat.Unsupported file type: {{type}}', undefined, undefined, { type: f.type });
4443
+ _this.notificationService.addTemporaryNotification('streamChat.Error uploading file, extension not supported', undefined, undefined, { name: f.name, ext: f.type });
4401
4444
  isValid = false;
4402
4445
  }
4403
4446
  });