stream-chat-angular 3.7.4 → 3.8.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 = "3.7.4";
1
+ export declare const version = "3.8.0";
@@ -354,7 +354,7 @@
354
354
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
355
355
  }
356
356
 
357
- var version = '3.7.4';
357
+ var version = '3.8.0';
358
358
 
359
359
  /**
360
360
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -461,7 +461,7 @@
461
461
  * Creates a [`StreamChat`](https://github.com/GetStream/stream-chat-js/blob/668b3e5521339f4e14fc657834531b4c8bf8176b/src/client.ts#L124) instance using the provided `apiKey`, and connects a user with the given meta data and token. More info about [connecting users](https://getstream.io/chat/docs/javascript/init_and_users/?language=javascript) can be found in the platform documentation.
462
462
  * @param apiKey
463
463
  * @param userOrId
464
- * @param userTokenOrProvider
464
+ * @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)
465
465
  */
466
466
  ChatClientService.prototype.init = function (apiKey, userOrId, userTokenOrProvider) {
467
467
  var _a;
@@ -474,14 +474,22 @@
474
474
  this.chatClient = streamChat.StreamChat.getInstance(apiKey);
475
475
  this.chatClient.devToken;
476
476
  return [4 /*yield*/, this.ngZone.runOutsideAngular(function () { return __awaiter(_this, void 0, void 0, function () {
477
- var user;
478
- return __generator(this, function (_d) {
479
- switch (_d.label) {
477
+ var user, _d;
478
+ return __generator(this, function (_e) {
479
+ switch (_e.label) {
480
480
  case 0:
481
481
  user = typeof userOrId === 'string' ? { id: userOrId } : userOrId;
482
- return [4 /*yield*/, this.chatClient.connectUser(user, userTokenOrProvider)];
482
+ if (!(userTokenOrProvider === 'guest')) return [3 /*break*/, 2];
483
+ return [4 /*yield*/, this.chatClient.setGuestUser(user)];
483
484
  case 1:
484
- result = _d.sent();
485
+ _d = _e.sent();
486
+ return [3 /*break*/, 4];
487
+ case 2: return [4 /*yield*/, this.chatClient.connectUser(user, userTokenOrProvider)];
488
+ case 3:
489
+ _d = _e.sent();
490
+ _e.label = 4;
491
+ case 4:
492
+ result = _d;
485
493
  this.userSubject.next(this.chatClient.user);
486
494
  this.chatClient.setUserAgent("stream-chat-angular-" + version + "-" + this.chatClient.getUserAgent());
487
495
  return [2 /*return*/];