Skip to content

Commit ba5d184

Browse files
Merge pull request #82 from openai/add-on-ready
[feature] Add on ready
2 parents afbb5dd + 0f922cb commit ba5d184

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

.changeset/brave-dancers-add.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openai/chatkit': patch
3+
---
4+
5+
Added missing types for `chatkit.ready` event

.changeset/brown-hairs-reply.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openai/chatkit-react': minor
3+
---
4+
5+
Add `onReady` to `UseChatKitOptions`

packages/chatkit-react/src/ChatKit.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const ChatKit = React.forwardRef<OpenAIChatKit, ChatKitProps>(
6969
'chatkit.thread.change': 'onThreadChange',
7070
'chatkit.thread.load.start': 'onThreadLoadStart',
7171
'chatkit.thread.load.end': 'onThreadLoadEnd',
72+
'chatkit.ready': 'onReady',
7273
};
7374

7475
const eventNames = Object.keys(events) as (keyof ChatKitEvents)[];

packages/chatkit/types/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,9 @@ export interface OpenAIChatKit extends HTMLElement {
914914
* DOM events emitted by the `openai-chatkit` custom element.
915915
*/
916916
export type ChatKitEvents = {
917+
/** Emitted when the ChatKit frame has loaded. */
918+
'chatkit.ready': CustomEvent<void>;
919+
917920
/** Emitted when an error occurs. You should log these for monitoring and debugging. */
918921
'chatkit.error': CustomEvent<{ error: Error }>;
919922

0 commit comments

Comments
 (0)