UNPKG

5.24 kBMarkdownView Raw
1# Changelog
2
3This project adheres to [Semantic Versioning Scheme](http://semver.org)
4
5---
6
7## [Unreleased](https://github.com/pusher/chatkit-client-js/compare/0.7.2...HEAD)
8
9## 0.7.2 -- 2018-03-19
10
11### Changes
12
13- Subobjects of the current user (Rooms, Users, etc) are now mutated instead of
14 replaced, so any reference to a room will represent the up to date state of
15 that room.
16
17### Fixes
18
19- Remove chatty logs about requiring room membership after leaving a room
20
21## 0.7.0 -- 2018-03-13
22
23This version represents a radical departure from 0.6.X. The interface is very
24different, and there's a good chance we'll miss some of the changes in this
25log. If something isn't working after migration, the best place to look first
26is probably the
27[documentation](https://docs.pusher.com/chatkit/reference/javascript).
28
29### Changes
30
31- Methods with `onSuccess`, `onFailure` callbacks changed to return promises
32 instead. e.g.
33
34```javascript
35chatManager
36 .connect()
37 .then(currentUser => {})
38 .catch(err => {})
39```
40
41- All methods take a single object parameter (see the
42 [documentation](https://docs.pusher.com/chatkit/reference/javascript) for
43 details on each method's arguments)
44
45- Delegates renamed to `hooks` throughout. e.g.
46
47```javascript
48currentUser.subscribeToRoom({
49 roomId,
50 hooks: {
51 onNewMessage: m => {}
52 }
53})
54```
55
56- Hooks all prefixed with `on`. e.g. `onNewMessage`, `onUserStartedTyping`
57
58- `cursorSet` hook renamed to `onNewCursor`
59
60- `authContext.queryParams` and `authContext.headers` both moved to the root
61 options object in the token provider. e.g.
62
63```javascript
64const tokenProvider = new TokenProvider({
65 url: 'your.auth.url',
66 queryParams: {
67 someKey: someValue,
68 ...
69 },
70 headers: {
71 SomeHeader: 'some-value',
72 ...
73 }
74})
75```
76
77- `addUser` and `removeUser` renamed to `addUserToRoom` and `removeUserFromRoom`
78
79- methods that used to accept a `Room` object now accept a `roomId`. e.g.
80
81instead of
82
83```javascript
84currentUser.subscribeToRoom(myRoom, hooks) // WRONG
85```
86
87do
88
89```javascript
90currentUser.subscribeToRoom({ roomId: myRoom.id, hooks })
91```
92
93- The behaviour of read cursors has changed: in particular cursors are now
94 accessed via `currentUser.readCursor` and set with
95 `currentUser.setReadCursor`. See the [Read Cursors section of the
96 documentation](https://docs.pusher.com/chatkit/reference/javascript#read-cursors)
97 for details.
98
99- Presence data is now accessable on any user object under `user.presence`. e.g.
100
101```javascript
102const isOnline = user.presence.state === 'online'
103```
104
105- All users that share a common room membership are accesable under
106 `currentUser.users`, and all members of a room are accessable under
107 `room.users`.
108
109## 0.6.2 -- 2018-02-05
110
111### Fixes
112
113- Catch errors in cursors get request
114
115## 0.6.1 -- 2018-01-25
116
117### Fixes
118
119- Made sure that the `messageLimit` argument in `subscribeToRoom` was being
120 validated as a number.
121- Ensured that the `position` argument in `setCursor` is a valid number.
122- Throw an error if the userId isn't provided to the ChatManager.
123
124## 0.6.0 -- 2018-01-19
125
126### Changes
127
128- Simplify typing indicator API
129 - removed `startedTypingIn` and `stoppedTypingIn` methods
130 - instead call `isTypingIn` as frequently as you like (rate limited by the SDK)
131 - `startedTyping` and `stoppedTyping` are fired exactly once each per burst
132 of typing
133
134## 0.5.1 -- 2018-01-16
135
136### Fixes
137
138- Fixed `fetchMessageFromRoom` which wasn't passing along the values provided in the `FetchRoomMessagesOptions` parameter as query params. Thanks [@apalmer0](https://github.com/apalmer0)!
139
140
141## 0.5.0 -- 2018-01-09
142
143### Changes
144
145- `ChatManager` takes a `userId` as a required option, `TokenProvider` no
146 longer does. (`ChatManager` passes the user ID to the token provider
147 internally before requesting a token.)
148
149### Additions
150
151- `RoomDelegate` has a `cursorSet` callback, fired whenever a cursor is set in
152 the given room.
153
154- `CurrentUser` has a `setCursor` method, to set a cursor in a given room.
155
156- The `CurrentUser` object now has a `cursors` property, which contains all the
157 user's own cursors, mapped by room ID. This is guaranteed to be populated
158 before room subscriptions succeed, so e.g. `currentUser.cursors[roomId]` can
159 be used upon receiving messages to determine if they have been read already.
160
161
162## 0.4.0 -- 2018-01-04
163
164### Additions
165
166- Add initial support for receiving cursors.
167
168
169## 0.3.2 -- 2017-12-19
170
171### Changes
172
173- `addMessage` has been renamed to `sendMessage` and now expects a different set of parameters:
174
175What previously would have been this:
176
177```typescript
178currentUser.addMessage(
179 "Hi there! 👋",
180 myRoom,
181 (messageId) => {
182 console.log("Success!", messageId);
183 },
184 (error) => {
185 console.log("Error", error);
186 }
187)
188```
189
190now needs to be written like this:
191
192```typescript
193currentUser.sendMessage(
194 {
195 text: "Hey there!",
196 roomId: myRoom.id,
197 },
198 (messageId) => {
199 console.log("Success!", messageId);
200 },
201 (error) => {
202 console.log("Error", error);
203 }
204)
205```
206
207### Additions
208
209- `sendMessage` supports adding an attachment to a message. See [the docs](https://docs.pusher.com/chatkit/client/javascript#messages) for more information.
210
211
212---
213
214Older releases are not covered by this changelog.