Skip to content

Commit 97c395c

Browse files
AndyTWFVeskeRm-hulbertGregHolmeskennethkalmer
committed
Chat constants reload (#2455)
* Fix incorrect links in content docs * Fix bug where support link goes to /docs/support * feat: initial ably-ui insights setup * refactor: consolidate SessionState types into a single one * cleanup: externalScriptsData doesn't change at runtime * feat: compile-time feature flags like ably-ui Local implementation of compile-time feature flags like we added in ably/ably-ui#650 * cleanup: remove unused GTM trackPageView function * chore(deps): bump @babel/helpers from 7.24.0 to 7.26.10 Bumps [@babel/helpers](https://github.com/babel/babel/tree/HEAD/packages/babel-helpers) from 7.24.0 to 7.26.10. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.26.10/packages/babel-helpers) --- updated-dependencies: - dependency-name: "@babel/helpers" dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * chat: update message version comparison function names (#2462) * chat: add JS message copying and update signature (#2470) * chat/js: rename DefaultRoomOptions to AllFeaturesEnabled * chat/js: make explicit reference to client options --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Andrew Bulat <andrii.bulat@gmail.com> Co-authored-by: Mark Hulbert <39801222+m-hulbert@users.noreply.github.com> Co-authored-by: Greg Holmes <iam@gregholmes.co.uk> Co-authored-by: Kenneth Kalmer <kenneth.kalmer@ably.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 0163816 commit 97c395c

File tree

11 files changed

+34
-30
lines changed

11 files changed

+34
-30
lines changed

content/chat/rooms/index.textile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ blang[react].
3030
</aside>
3131

3232
```[javascript]
33-
const room = await chatClient.rooms.get('basketball-stream', RoomOptionsDefaults);
33+
const room = await chatClient.rooms.get('basketball-stream', AllFeaturesEnabled);
3434
```
3535

3636
```[react]
3737
import * as Ably from 'ably';
38-
import { ChatClientProvider, ChatRoomProvider, LogLevel, RoomOptionsDefaults } from '@ably/chat';
38+
import { ChatClientProvider, ChatRoomProvider, LogLevel, AllFeaturesEnabled } from '@ably/chat';
3939

4040
const realtimeClient = new Ably.Realtime({ key: '{{API_KEY}}', clientId: 'clientId' });
4141
const chatClient = new ChatClient(realtimeClient);
@@ -45,7 +45,7 @@ const App = () => {
4545
<ChatClientProvider client={chatClient}>
4646
<ChatRoomProvider
4747
id="my-room-id"
48-
options={RoomOptionsDefaults}
48+
options={AllFeaturesEnabled}
4949
>
5050
<RestOfYourApp />
5151
</ChatRoomProvider>
@@ -96,10 +96,10 @@ blang[javascript,swift,kotlin].
9696
```
9797

9898
blang[javascript].
99-
You can also use the @RoomOptionsDefaults@ property for each @RoomOption@ to configure whether the default settings should be used:
99+
You can also use the @AllFeaturesEnabled@ property for each @RoomOption@ to configure whether preconfigured example settings should be used:
100100

101101
```[javascript]
102-
const room = await chatClient.rooms.get('basketball-stream', {presence: RoomOptionsDefaults.presence});
102+
const room = await chatClient.rooms.get('basketball-stream', {presence: AllFeaturesEnabled.presence});
103103
```
104104

105105
Or configure each feature using your own values:
@@ -114,10 +114,10 @@ Enable each feature using its associated option. The details of the options avai
114114

115115
blang[javascript].
116116
| Feature | @RoomOption@ | Default settings |
117-
| "Presence":/docs/chat/rooms/presence | @presence@ | @RoomOptionsDefaults.presence@ |
118-
| "Occupancy":/docs/chat/rooms/occupancy | @occupancy@ | @RoomOptionsDefaults.occupancy@ |
119-
| "Typing indicators":/docs/chat/rooms/typing | @typing@ | @RoomOptionsDefaults.typing@ |
120-
| "Room reactions":/docs/chat/rooms/reactions | @reactions@ | @RoomOptionsDefaults.reactions@ |
117+
| "Presence":/docs/chat/rooms/presence | @presence@ | @AllFeaturesEnabled.presence@ |
118+
| "Occupancy":/docs/chat/rooms/occupancy | @occupancy@ | @AllFeaturesEnabled.occupancy@ |
119+
| "Typing indicators":/docs/chat/rooms/typing | @typing@ | @AllFeaturesEnabled.typing@ |
120+
| "Room reactions":/docs/chat/rooms/reactions | @reactions@ | @AllFeaturesEnabled.reactions@ |
121121

122122
blang[swift,kotlin].
123123
| Feature | @RoomOption@ | Default settings |

content/chat/setup.textile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,17 @@ blang[react].
128128
blang[javascript,swift,kotlin].
129129

130130
```[javascript]
131+
import { LogLevel } from '@ably/chat'
132+
131133
const realtimeClient = new Ably.Realtime({ key: '{{API_KEY}}', clientId: '<clientId>'});
132-
const chatClient = new ChatClient(realtimeClient);
134+
const chatClient = new ChatClient(realtimeClient, { logLevel: LogLevel.Error });
133135
```
134136

135137
```[react]
136-
const realtimeClient = new Ably.Realtime({ key: '{{API_KEY}}', clientId: '<clientId>' });
137-
const chatClient = new ChatClient(realtimeClient);
138+
import { LogLevel } from '@ably/chat'
139+
140+
const realtimeClient = new Ably.Realtime({ key: '{{API_KEY}}', clientId: '<clientId>'});
141+
const chatClient = new ChatClient(realtimeClient, { logLevel: LogLevel.Error });
138142

139143
const App = () => {
140144
return (

examples/chat-online-status/javascript/src/script.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Ably from 'ably';
2-
import { ChatClient, PresenceEvent, PresenceMember, RoomOptionsDefaults } from '@ably/chat';
2+
import { ChatClient, PresenceEvent, PresenceMember, AllFeaturesEnabled } from '@ably/chat';
33
import { faker } from '@faker-js/faker';
44

55
const realtimeClient = new Ably.Realtime({
@@ -14,7 +14,7 @@ async function initializeChat() {
1414

1515
// Get ROOM with typing capabilities
1616
const room = await chatClient.rooms.get(channelName, {
17-
presence: RoomOptionsDefaults.presence,
17+
presence: AllFeaturesEnabled.presence,
1818
});
1919
const onlineStatuses = await room.presence.get();
2020

examples/chat-online-status/react/src/app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Inter } from "next/font/google";
44
import { Realtime } from 'ably';
5-
import { ChatClient, ChatClientProvider, ChatRoomProvider, RoomOptionsDefaults } from '@ably/chat';
5+
import { ChatClient, ChatClientProvider, ChatRoomProvider, AllFeaturesEnabled } from '@ably/chat';
66
import { ReactNode, useEffect, useState } from 'react';
77
import { faker } from '@faker-js/faker';
88
import '../../styles/styles.css';
@@ -34,7 +34,7 @@ export default function RootLayout({
3434
<ChatClientProvider client={chatClient}>
3535
<ChatRoomProvider
3636
id={roomName}
37-
options={RoomOptionsDefaults}
37+
options={AllFeaturesEnabled}
3838
>
3939
{children}
4040
</ChatRoomProvider>

examples/chat-room-history/javascript/src/script.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Ably from 'ably';
2-
import { ChatClient, Message, Room, RoomOptionsDefaults } from '@ably/chat';
2+
import { ChatClient, Message, Room, AllFeaturesEnabled } from '@ably/chat';
33
import { faker } from '@faker-js/faker';
44
import './styles.css';
55

@@ -16,7 +16,7 @@ const roomName = urlParams.get('name') || 'chat-room-history';
1616

1717
async function initializeChat() {
1818
chatClient = new ChatClient(realtimeClient);
19-
room = await chatClient.rooms.get(roomName, RoomOptionsDefaults);
19+
room = await chatClient.rooms.get(roomName, AllFeaturesEnabled);
2020
}
2121

2222
initializeChat().catch((error) => {

examples/chat-room-history/react/src/app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Inter } from "next/font/google";
44
import { Realtime } from 'ably';
5-
import { ChatClient, ChatClientProvider, ChatRoomProvider, RoomOptionsDefaults } from '@ably/chat';
5+
import { ChatClient, ChatClientProvider, ChatRoomProvider, AllFeaturesEnabled } from '@ably/chat';
66
import { faker } from '@faker-js/faker';
77
import '../../styles/styles.css'
88
import { useEffect, useState } from "react";
@@ -34,7 +34,7 @@ export default function RootLayout({
3434
<ChatClientProvider client={chatClient}>
3535
<ChatRoomProvider
3636
id={roomName}
37-
options={RoomOptionsDefaults}
37+
options={AllFeaturesEnabled}
3838
>
3939
{children}
4040
</ChatRoomProvider>

examples/chat-room-messages/javascript/src/script.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Ably from 'ably';
2-
import { ChatClient, Room, RoomOptionsDefaults } from '@ably/chat';
2+
import { ChatClient, Room, AllFeaturesEnabled } from '@ably/chat';
33
import './styles.css';
44

55
const mockNames = ['Bob', 'Jane', 'John', 'Sammy'];
@@ -17,7 +17,7 @@ async function initializeChat() {
1717

1818
const urlParams = new URLSearchParams(window.location.search);
1919
const roomName = urlParams.get('name') || 'chat-room-messages';
20-
room = await chatClient.rooms.get(roomName, RoomOptionsDefaults);
20+
room = await chatClient.rooms.get(roomName, AllFeaturesEnabled);
2121

2222
/** 💡 Add every every message published to the room 💡 */
2323
room.messages.subscribe((message) => {

examples/chat-room-messages/react/src/app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { Inter } from "next/font/google";
4-
import { ChatClient, ChatClientProvider, ChatRoomProvider, RoomOptionsDefaults } from '@ably/chat';
4+
import { ChatClient, ChatClientProvider, ChatRoomProvider, AllFeaturesEnabled } from '@ably/chat';
55
import { Realtime } from 'ably';
66
import '../../styles/styles.css'
77
import { useEffect, useState } from "react";
@@ -36,7 +36,7 @@ export default function RootLayout({
3636
<ChatClientProvider client={chatClient}>
3737
<ChatRoomProvider
3838
id={roomName}
39-
options={RoomOptionsDefaults}
39+
options={AllFeaturesEnabled}
4040
>
4141
{children}
4242
</ChatRoomProvider>

examples/chat-room-reactions/javascript/src/script.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Ably from 'ably';
2-
import { ChatClient, Room, RoomOptionsDefaults } from '@ably/chat';
2+
import { ChatClient, Room, AllFeaturesEnabled } from '@ably/chat';
33
import { nanoid } from 'nanoid';
44
import './styles.css';
55

@@ -14,7 +14,7 @@ async function initializeChat() {
1414
const chatClient = new ChatClient(realtimeClient);
1515
const urlParams = new URLSearchParams(window.location.search);
1616
const roomName = urlParams.get('name') || 'chat-room-reactions';
17-
room = await chatClient.rooms.get(roomName, RoomOptionsDefaults);
17+
room = await chatClient.rooms.get(roomName, AllFeaturesEnabled);
1818

1919
/** 💡 Add every room reaction published to the room 💡 */
2020
room.reactions.subscribe((reaction) => {

examples/chat-room-reactions/react/src/app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { Inter } from "next/font/google";
4-
import { ChatClient, ChatClientProvider, ChatRoomProvider, RoomOptionsDefaults } from '@ably/chat';
4+
import { ChatClient, ChatClientProvider, ChatRoomProvider, AllFeaturesEnabled } from '@ably/chat';
55
import { Realtime } from 'ably';
66
import '../../styles/styles.css'
77
import { useEffect, useState } from "react";
@@ -36,7 +36,7 @@ export default function RootLayout({
3636
<ChatClientProvider client={chatClient}>
3737
<ChatRoomProvider
3838
id={roomName}
39-
options={RoomOptionsDefaults}
39+
options={AllFeaturesEnabled}
4040
>
4141
{children}
4242
</ChatRoomProvider>

0 commit comments

Comments
 (0)