# Changelog

## 09/01/2018 - `1.9.5`

Several updates, including:

- 

## 08/12/2017 - `1.9.2` (hotfix)

- Hotfix: guard on `window`

## 07/12/2017 - version `1.9.0`

- The `Client` now has `login(email, password)` and `logout()`. *This should not yet be used, as the full auth functionality is still in development*
- Settings are now merged into `MultichatCoreClientSettings` which is now the way the client should be configured  (`MultichatWebsocketSettings` is no longer exposed)
	- The logging of the client is now dependent on `DEBUG`
	- `MultichatCoreClientSettings` now has the `WSS` setting that defines whether `wss://` should be used.
	- `baseUrl` had been renamed to `BASE_URL`, as it's more consistent with the rest of the settings
- Some functions have been simplified a bit internally
- It is now possible to add filtering keys to the `getMessages` call. E.g. `{page_size: 20, exclude_typing: false}}`

## 20/11/2017 - version `1.8.2`

- `rxjs` was added as a dependency, and `messagesObservable` (an Observable) is now added to `Chat` instances
- the `messages` array of `Chat` does not get updated on new messages anymore. Instead, use either `onMessage` or `messagesObservable.subscribe()` to keep track of messages
 - To get all the messages (the ones fetched from the API and the received ones), use `chat.loadedMessages`
- Internal refactoring resulting in less overriding of methods in the `Chat` class
- There is now a `receivedMessages` array in the `Chat` that gets updated on every new message
- A lot of minor refactors over the last versions, mostly TypeScript (syntax) related
- `getMessages` now returns a promise, that returns `ChatMessage` instances
- The functions on a `Chat` now return `ChatMessage` instances and not raw data

## 02/11/2017 - version `1.6.2`

- Fix response 'data' key checking on the listener finder function 

## 31/10/2017 - version `1.6.0`

### Backwards incompatible changes:

- The `ChatMessage` has a new constructor signature: `chat?: Chat, data?: ChatMessageData | MultichatMessage`. Consequences and reasons:
 - Reason: `ChatMessage` instances are very dependent on the `Chat` that they're part of
 - Consequence: Every `ChatMessage` instance now has a `chat` property that is set to a `Chat` instance
 - Consequence: The `mergeMessages` should now be implemented by classes that extend from `BaseDemultiplexedHttpChatsResource` (e.g. the `Chat` class)
 - Consequence: To implement the `ChatMessage` as a component, the constructor should be overridden to one with an empty signature, as Angular component instantiation does not allow passing a `Chat` and Message data
  - Instead, the `loadData` method should be called, like this:
  ```TypeScript
      import {Input, OnDestroy, OnInit} from "@angular/core";
      import {Chat, MultichatMessage, ChatMessageData} from "@luminum/core-chat-client";
      import {AbstractChatMessageComponent} from "@luminum/angular-chat-client";
      
      export class BaseChatMessageComponent extends AbstractChatMessageComponent implements OnInit, OnDestroy {
          @Input('data') data: MultichatMessage | ChatMessageData;
          @Input('chat') chat: Chat;
      
      
          ngOnInit() {
              let that = this;
              if (that.data) {
                  that.loadData(that.chat, this.data);
              }
          }
      }
  ```
  - This is because the `mergeMessages` should pass the `Chat` instance to the constructor of the `ChatMessage` class

### Other changes:

- Add `ChatInterface` and let `BaseDemultiplexedHttpChatsResource` implement it
- `ChatMessage` instantiation now uses the difference of the key set of passed data and local attributes to copy over properties, instead of all the keys of the past data object
 - This is necessary to allow `chat` on a `ChatMessage` to be a `Chat` instance instead of the `chat` key in the `data` argument passed to the constructor.

### Fixes:

- Actually pass the `MultichatMessage` data to the `NewMessage` constructor in the `onMessage` method, instead of the complete Websocket message (i.e. `response.data` instead of `response`)

## 29/10/2017 - version `1.5.0`

### Backwards incompatible changes:

- `ChatMessage` is now the primary used type, and no longer raw data received through HTTP calls or Websocket messages. The raw data is still available under the `rawData` property of a `ChatMessage` instance

### Other changes:

- Included `APICursorHttpResponse` in most methods that do async HTTP requests
- Remove wildcard `lodash` imports
- Allow instantiation of `ChatMessage` class with data and allow both `MultichatMessage` and `ChatMessageData` as valid argument types
- Change `Options` to the base of an intersection type with `_Options` (local) to allow non `new`-ed `Options`
- Add type alias to `APICursorHttpResponse`

## 18/10/2017 - start

- Add to NPM registry
