@pipecat-ai/client-react 1.0.0 → 1.1.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.
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { PipecatClient, RTVIEvent, RTVIEventHandler, Tracks, TransportState } from "@pipecat-ai/client-js";
1
+ import { RTVIEvent, RTVIEventHandler, PipecatClient, Tracks, TransportState } from "@pipecat-ai/client-js";
2
2
  import { Provider } from "jotai/react";
3
3
  import React from "react";
4
4
  import { JSX } from "react/jsx-runtime";
5
+ export const useRTVIClientEvent: <E extends RTVIEvent>(event: E, handler: RTVIEventHandler<E>) => void;
5
6
  interface Props {
6
7
  client: PipecatClient;
7
8
  jotaiStore?: React.ComponentProps<typeof Provider>["store"];
8
9
  }
9
10
  export const PipecatClientProvider: React.FC<React.PropsWithChildren<Props>>;
10
11
  export const usePipecatClient: () => PipecatClient | undefined;
11
- export const useRTVIClientEvent: <E extends RTVIEvent>(event: E, handler: RTVIEventHandler<E>) => void;
12
12
  type ParticipantType = keyof Tracks;
13
13
  type TrackType = keyof Tracks["local"];
14
14
  export const usePipecatClientMediaTrack: (trackType: TrackType, participantType: ParticipantType) => MediaStreamTrack | null;
@@ -16,7 +16,6 @@ export const PipecatClientAudio: {
16
16
  (): JSX.Element;
17
17
  displayName: string;
18
18
  };
19
- export const usePipecatClientTransportState: () => TransportState;
20
19
  /**
21
20
  * Hook to control camera state
22
21
  */
@@ -79,6 +78,39 @@ interface PipecatClientMicToggleProps {
79
78
  * Headless component for controlling microphone state
80
79
  */
81
80
  export const PipecatClientMicToggle: React.FC<PipecatClientMicToggleProps>;
81
+ /**
82
+ * Hook to control screen share state using React Context
83
+ * This provides a simpler interface for basic screen share control
84
+ * For more advanced state management with Jotai atoms, use usePipecatClientScreenShare
85
+ */
86
+ export const usePipecatClientScreenShareControl: () => {
87
+ enableScreenShare: (enabled: boolean) => void;
88
+ isScreenShareEnabled: boolean;
89
+ };
90
+ interface PipecatClientScreenShareToggleProps {
91
+ /**
92
+ * Callback when screen share state changes
93
+ */
94
+ onScreenShareEnabledChanged?: (enabled: boolean) => void;
95
+ /**
96
+ * Optional prop to disable the screen share toggle.
97
+ * When disabled, changes are not applied to the client.
98
+ * @default false
99
+ */
100
+ disabled?: boolean;
101
+ /**
102
+ * Render prop that provides state and handlers to the children
103
+ */
104
+ children: (props: {
105
+ disabled?: boolean;
106
+ isScreenShareEnabled: boolean;
107
+ onClick: () => void;
108
+ }) => React.ReactNode;
109
+ }
110
+ /**
111
+ * Headless component for controlling screen share state
112
+ */
113
+ export const PipecatClientScreenShareToggle: React.FC<PipecatClientScreenShareToggleProps>;
82
114
  interface PipecatClientVideoInterface {
83
115
  aspectRatio: number;
84
116
  height: number;
@@ -117,6 +149,7 @@ export const usePipecatClientMediaDevices: () => {
117
149
  updateMic: (id: string) => void;
118
150
  updateSpeaker: (id: string) => void;
119
151
  };
152
+ export const usePipecatClientTransportState: () => TransportState;
120
153
  type _ParticipantType1 = Parameters<typeof usePipecatClientMediaTrack>[1];
121
154
  interface _Props2 {
122
155
  backgroundColor?: string;
@@ -1 +1 @@
1
- {"mappings":";;;;ACsBA;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,cAAc,CAAC,eAAoB,CAAC,CAAC,OAAO,CAAC,CAAC;CAClE;AAYD,OAAO,MAAM,uBAAuB,MAAM,EAAE,CAC1C,MAAM,iBAAiB,CAAC,KAAK,CAAC,CAoF/B,CAAC;AChHF,OAAO,MAAM,iDAGZ,CAAC;ACFF,OAAO,MAAM,qBAAsB,CAAC,SAAS,SAAS,EACpD,OAAO,CAAC,EACR,SAAS,iBAAiB,CAAC,CAAC,SAU7B,CAAC;ACRF,uBAAuB,MAAM,MAAM,CAAC;AACpC,iBAAiB,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;AA4BvC,OAAO,MAAM,6BACX,WAAW,SAAS,EACpB,iBAAiB,eAAe,4BA+D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,CAAC;IAE7B;;OAEG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;IAEpC;;OAEG;IACH,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,QAAQ,CAAC,CAAC,UAAU,EAAE,2BAA2B,GAAG,IAAI,CAAC;CAC1D;AAED,OAAO,MAAM,oGAwJZ,CAAC;AC1LF,+BAA+B,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AASvE,OAAO,MAAM;;;;;;;oBAqFJ,MAAM;oBAMN,MAAM;wBAMN,MAAM;CAiBd,CAAC;ACzHF,yBAAuB,UAAU,CAAC,iCAAiC,CAAC,CAAC,CAAC,CAAC,CAAC;AAExE;IACE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,iBAAe,CAAC;CAClC;AAED,OAAO,MAAM,iBAAiB,MAAM,EAAE,CAAC,OAAK,CAoR3C,CAAC","sources":["client-react/src/src/RTVIEventContext.ts","client-react/src/src/PipecatClientProvider.tsx","client-react/src/src/usePipecatClient.ts","client-react/src/src/useRTVIClientEvent.ts","client-react/src/src/usePipecatClientMediaTrack.ts","client-react/src/src/PipecatClientAudio.tsx","client-react/src/src/usePipecatClientTransportState.ts","client-react/src/src/usePipecatClientCamControl.ts","client-react/src/src/PipecatClientCamToggle.tsx","client-react/src/src/usePipecatClientMicControl.ts","client-react/src/src/PipecatClientMicToggle.tsx","client-react/src/src/useMergedRef.ts","client-react/src/src/PipecatClientVideo.tsx","client-react/src/src/usePipecatClientMediaDevices.ts","client-react/src/src/VoiceVisualizer.tsx","client-react/src/src/index.ts","client-react/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/**\n * Copyright (c) 2024, Daily.\n *\n * SPDX-License-Identifier: BSD-2-Clause\n */\n\nimport { PipecatClientAudio } from \"./PipecatClientAudio\";\nimport { PipecatClientCamToggle } from \"./PipecatClientCamToggle\";\nimport { PipecatClientMicToggle } from \"./PipecatClientMicToggle\";\nimport { PipecatClientProvider } from \"./PipecatClientProvider\";\nimport { PipecatClientVideo } from \"./PipecatClientVideo\";\nimport { usePipecatClient } from \"./usePipecatClient\";\nimport { usePipecatClientCamControl } from \"./usePipecatClientCamControl\";\nimport { usePipecatClientMediaDevices } from \"./usePipecatClientMediaDevices\";\nimport { usePipecatClientMediaTrack } from \"./usePipecatClientMediaTrack\";\nimport { usePipecatClientMicControl } from \"./usePipecatClientMicControl\";\nimport { usePipecatClientTransportState } from \"./usePipecatClientTransportState\";\nimport { useRTVIClientEvent } from \"./useRTVIClientEvent\";\nimport { VoiceVisualizer } from \"./VoiceVisualizer\";\n\nexport {\n PipecatClientAudio,\n PipecatClientCamToggle,\n PipecatClientMicToggle,\n PipecatClientProvider,\n PipecatClientVideo,\n usePipecatClient,\n usePipecatClientCamControl,\n usePipecatClientMediaDevices,\n usePipecatClientMediaTrack,\n usePipecatClientMicControl,\n usePipecatClientTransportState,\n useRTVIClientEvent,\n VoiceVisualizer,\n};\n"],"names":[],"version":3,"file":"index.d.ts.map"}
1
+ {"mappings":";;;;ACWA,OAAO,MAAM,qBAAsB,CAAC,SAAS,SAAS,EACpD,OAAO,CAAC,EACR,SAAS,iBAAiB,CAAC,CAAC,SAU7B,CAAC;AEAF;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,cAAc,CA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AiC,CAAC,CAAC,CAAC,CAAC,CAAC;AAExE;IACE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,iBAAe,CAAC;CAClC;AAED,OAAO,MAAM,iBAAiB,MAAM,EAAE,CAAC,OAAK,CAoR3C,CAAC","sources":["client-react/src/src/RTVIEventContext.ts","client-react/src/src/useRTVIClientEvent.ts","client-react/src/src/PipecatClientState.tsx","client-react/src/src/PipecatClientProvider.tsx","client-react/src/src/usePipecatClient.ts","client-react/src/src/usePipecatClientMediaTrack.ts","client-react/src/src/PipecatClientAudio.tsx","client-react/src/src/usePipecatClientCamControl.ts","client-react/src/src/PipecatClientCamToggle.tsx","client-react/src/src/usePipecatClientMicControl.ts","client-react/src/src/PipecatClientMicToggle.tsx","client-react/src/src/usePipecatClientScreenShareControl.ts","client-react/src/src/PipecatClientScreenShareToggle.tsx","client-react/src/src/useMergedRef.ts","client-react/src/src/PipecatClientVideo.tsx","client-react/src/src/usePipecatClientMediaDevices.ts","client-react/src/src/usePipecatClientTransportState.ts","client-react/src/src/VoiceVisualizer.tsx","client-react/src/src/index.ts","client-react/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/**\n * Copyright (c) 2024, Daily.\n *\n * SPDX-License-Identifier: BSD-2-Clause\n */\n\nimport { PipecatClientAudio } from \"./PipecatClientAudio\";\nimport { PipecatClientCamToggle } from \"./PipecatClientCamToggle\";\nimport { PipecatClientMicToggle } from \"./PipecatClientMicToggle\";\nimport { PipecatClientProvider } from \"./PipecatClientProvider\";\nimport { PipecatClientScreenShareToggle } from \"./PipecatClientScreenShareToggle\";\nimport { PipecatClientVideo } from \"./PipecatClientVideo\";\nimport { usePipecatClient } from \"./usePipecatClient\";\nimport { usePipecatClientCamControl } from \"./usePipecatClientCamControl\";\nimport { usePipecatClientMediaDevices } from \"./usePipecatClientMediaDevices\";\nimport { usePipecatClientMediaTrack } from \"./usePipecatClientMediaTrack\";\nimport { usePipecatClientMicControl } from \"./usePipecatClientMicControl\";\nimport { usePipecatClientScreenShareControl } from \"./usePipecatClientScreenShareControl\";\nimport { usePipecatClientTransportState } from \"./usePipecatClientTransportState\";\nimport { useRTVIClientEvent } from \"./useRTVIClientEvent\";\nimport { VoiceVisualizer } from \"./VoiceVisualizer\";\n\nexport {\n PipecatClientAudio,\n PipecatClientCamToggle,\n PipecatClientMicToggle,\n PipecatClientProvider,\n PipecatClientScreenShareToggle,\n PipecatClientVideo,\n usePipecatClient,\n usePipecatClientCamControl,\n usePipecatClientMediaDevices,\n usePipecatClientMediaTrack,\n usePipecatClientMicControl,\n usePipecatClientScreenShareControl,\n usePipecatClientTransportState,\n useRTVIClientEvent,\n VoiceVisualizer,\n};\n"],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js CHANGED
@@ -18,12 +18,14 @@ $parcel$export(module.exports, "PipecatClientAudio", () => $a2a1c5f475114d56$exp
18
18
  $parcel$export(module.exports, "PipecatClientCamToggle", () => $666ceba11158b494$export$dc9a029eeca8213f);
19
19
  $parcel$export(module.exports, "PipecatClientMicToggle", () => $1a9931980e271aa3$export$bc8133b69ff660a2);
20
20
  $parcel$export(module.exports, "PipecatClientProvider", () => $8df0e777e4d7dd49$export$bb43666ced7a20d0);
21
+ $parcel$export(module.exports, "PipecatClientScreenShareToggle", () => $0a9d1dc5be2e1cc2$export$93764714dfab3a46);
21
22
  $parcel$export(module.exports, "PipecatClientVideo", () => $0f97689637ada1d8$export$85974db6d0cc43b3);
22
23
  $parcel$export(module.exports, "usePipecatClient", () => $172f489fc5d91d99$export$777fa8498be78705);
23
24
  $parcel$export(module.exports, "usePipecatClientCamControl", () => $d9b24817de62910a$export$3ea2601427f0430f);
24
25
  $parcel$export(module.exports, "usePipecatClientMediaDevices", () => $9bd3e7d3a9d7acd1$export$642bc4d2d2a376f1);
25
26
  $parcel$export(module.exports, "usePipecatClientMediaTrack", () => $630203d8dad1dd45$export$9813dcd2d0c26814);
26
27
  $parcel$export(module.exports, "usePipecatClientMicControl", () => $4af0eba414c586fd$export$388e706586309ef0);
28
+ $parcel$export(module.exports, "usePipecatClientScreenShareControl", () => $5fc67d7ca05dec34$export$be63b19bd7f7d4f5);
27
29
  $parcel$export(module.exports, "usePipecatClientTransportState", () => $810478f6ae107062$export$30aee278309a867b);
28
30
  $parcel$export(module.exports, "useRTVIClientEvent", () => $8a6b68ebf0332682$export$33a6ac53b8f02625);
29
31
  $parcel$export(module.exports, "VoiceVisualizer", () => $a1dfa75b13e6bb9b$export$59bf27bd43679db6);
@@ -53,16 +55,123 @@ $parcel$export(module.exports, "VoiceVisualizer", () => $a1dfa75b13e6bb9b$export
53
55
 
54
56
 
55
57
  var $d1f89db81f967f39$exports = {};
56
- $d1f89db81f967f39$exports = JSON.parse("{\"name\":\"@pipecat-ai/client-react\",\"version\":\"1.0.0\",\"license\":\"BSD-2-Clause\",\"main\":\"dist/index.js\",\"module\":\"dist/index.module.js\",\"types\":\"dist/index.d.ts\",\"source\":\"src/index.ts\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/pipecat-ai/pipecat-client-web.git\"},\"files\":[\"dist\",\"package.json\",\"README.md\"],\"scripts\":{\"build\":\"parcel build --no-cache\",\"dev\":\"parcel watch\",\"lint\":\"eslint . --report-unused-disable-directives --max-warnings 0 --ignore-pattern 'dist/'\"},\"devDependencies\":{\"@pipecat-ai/client-js\":\"*\",\"@types/react\":\"^18.3.3\",\"@types/react-dom\":\"^18.3.0\",\"@typescript-eslint/eslint-plugin\":\"^8.32.0\",\"eslint\":\"^9.11.1\",\"eslint-config-prettier\":\"^9.1.0\",\"eslint-plugin-react-hooks\":\"^5.2.0\",\"eslint-plugin-simple-import-sort\":\"^12.1.1\",\"parcel\":\"^2.12.0\",\"react\":\"^18.3.1\",\"react-dom\":\"^18.3.1\",\"typescript\":\"^5.2.2\"},\"peerDependencies\":{\"@pipecat-ai/client-js\":\"*\",\"react\":\">=18\",\"react-dom\":\">=18\"},\"dependencies\":{\"jotai\":\"^2.9.0\"}}");
58
+ $d1f89db81f967f39$exports = JSON.parse("{\"name\":\"@pipecat-ai/client-react\",\"version\":\"1.1.0\",\"license\":\"BSD-2-Clause\",\"main\":\"dist/index.js\",\"module\":\"dist/index.module.js\",\"types\":\"dist/index.d.ts\",\"source\":\"src/index.ts\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/pipecat-ai/pipecat-client-web.git\"},\"files\":[\"dist\",\"package.json\",\"README.md\"],\"scripts\":{\"build\":\"parcel build --no-cache\",\"dev\":\"parcel watch\",\"lint\":\"eslint . --report-unused-disable-directives --max-warnings 0 --ignore-pattern 'dist/'\"},\"devDependencies\":{\"@pipecat-ai/client-js\":\"*\",\"@types/react\":\"^18.3.3\",\"@types/react-dom\":\"^18.3.0\",\"@typescript-eslint/eslint-plugin\":\"^8.32.0\",\"eslint\":\"^9.11.1\",\"eslint-config-prettier\":\"^9.1.0\",\"eslint-plugin-react-hooks\":\"^5.2.0\",\"eslint-plugin-simple-import-sort\":\"^12.1.1\",\"parcel\":\"^2.12.0\",\"react\":\"^18.3.1\",\"react-dom\":\"^18.3.1\",\"typescript\":\"^5.2.2\"},\"peerDependencies\":{\"@pipecat-ai/client-js\":\"*\",\"react\":\">=18\",\"react-dom\":\">=18\"},\"dependencies\":{\"jotai\":\"^2.9.0\"}}");
57
59
 
58
60
 
59
61
 
62
+
63
+
64
+
65
+ /**
66
+ * Copyright (c) 2024, Daily.
67
+ *
68
+ * SPDX-License-Identifier: BSD-2-Clause
69
+ */
70
+
60
71
  const $a37ab5d1bcf1d3b2$export$fe23d0ef95286467 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({
61
72
  on: ()=>{},
62
73
  off: ()=>{}
63
74
  });
64
75
 
65
76
 
77
+ const $8a6b68ebf0332682$export$33a6ac53b8f02625 = (event, handler)=>{
78
+ const { on: on, off: off } = (0, $5Zyvw$react.useContext)((0, $a37ab5d1bcf1d3b2$export$fe23d0ef95286467));
79
+ (0, $5Zyvw$react.useEffect)(()=>{
80
+ on(event, handler);
81
+ return ()=>{
82
+ off(event, handler);
83
+ };
84
+ }, [
85
+ event,
86
+ handler,
87
+ on,
88
+ off
89
+ ]);
90
+ };
91
+
92
+
93
+ const $44c6278d186dd94f$export$d6bdcccacef16204 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({
94
+ enableCam: ()=>{
95
+ throw new Error("PipecatClientCamStateContext: enableCam() called outside of provider");
96
+ },
97
+ isCamEnabled: false
98
+ });
99
+ const $44c6278d186dd94f$export$802b42df0e0d8153 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({
100
+ enableMic: ()=>{
101
+ throw new Error("PipecatClientMicStateContext: enableMic() called outside of provider");
102
+ },
103
+ isMicEnabled: false
104
+ });
105
+ const $44c6278d186dd94f$export$8e633e67c760098b = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({
106
+ enableScreenShare: ()=>{
107
+ throw new Error("PipecatClientScreenShareStateContext: enableScreenShare() called outside of provider");
108
+ },
109
+ isScreenShareEnabled: false
110
+ });
111
+ const $44c6278d186dd94f$export$db79fdf85ddd6b65 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)("disconnected");
112
+ const $44c6278d186dd94f$export$4777554fda61c378 = ({ children: children })=>{
113
+ const client = (0, $172f489fc5d91d99$export$777fa8498be78705)();
114
+ const [isCamEnabled, setIsCamEnabled] = (0, $5Zyvw$react.useState)(false);
115
+ const [isMicEnabled, setIsMicEnabled] = (0, $5Zyvw$react.useState)(false);
116
+ const [isScreenShareEnabled, setIsScreenShareEnabled] = (0, $5Zyvw$react.useState)(false);
117
+ const [transportState, setTransportState] = (0, $5Zyvw$react.useState)("disconnected");
118
+ (0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).TransportStateChanged, (state)=>{
119
+ setTransportState(state);
120
+ if (state === "initialized" && client) {
121
+ setIsCamEnabled(client.isCamEnabled ?? false);
122
+ setIsMicEnabled(client.isMicEnabled ?? false);
123
+ setIsScreenShareEnabled(client.isSharingScreen ?? false);
124
+ }
125
+ });
126
+ const enableCam = (0, $5Zyvw$react.useCallback)((enabled)=>{
127
+ setIsCamEnabled(enabled);
128
+ client?.enableCam?.(enabled);
129
+ }, [
130
+ client
131
+ ]);
132
+ const enableMic = (0, $5Zyvw$react.useCallback)((enabled)=>{
133
+ setIsMicEnabled(enabled);
134
+ client?.enableMic?.(enabled);
135
+ }, [
136
+ client
137
+ ]);
138
+ const enableScreenShare = (0, $5Zyvw$react.useCallback)((enabled)=>{
139
+ client?.enableScreenShare?.(enabled);
140
+ }, [
141
+ client
142
+ ]);
143
+ (0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).ScreenTrackStarted, (_track, participant)=>{
144
+ if (participant?.local) setIsScreenShareEnabled(true);
145
+ });
146
+ (0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).ScreenTrackStopped, (_track, participant)=>{
147
+ if (participant?.local) setIsScreenShareEnabled(false);
148
+ });
149
+ return (0, $5Zyvw$reactjsxruntime.jsx)($44c6278d186dd94f$export$db79fdf85ddd6b65.Provider, {
150
+ value: transportState,
151
+ children: (0, $5Zyvw$reactjsxruntime.jsx)($44c6278d186dd94f$export$d6bdcccacef16204.Provider, {
152
+ value: {
153
+ enableCam: enableCam,
154
+ isCamEnabled: isCamEnabled
155
+ },
156
+ children: (0, $5Zyvw$reactjsxruntime.jsx)($44c6278d186dd94f$export$802b42df0e0d8153.Provider, {
157
+ value: {
158
+ enableMic: enableMic,
159
+ isMicEnabled: isMicEnabled
160
+ },
161
+ children: (0, $5Zyvw$reactjsxruntime.jsx)($44c6278d186dd94f$export$8e633e67c760098b.Provider, {
162
+ value: {
163
+ enableScreenShare: enableScreenShare,
164
+ isScreenShareEnabled: isScreenShareEnabled
165
+ },
166
+ children: children
167
+ })
168
+ })
169
+ })
170
+ });
171
+ };
172
+
173
+
174
+
66
175
  const $8df0e777e4d7dd49$var$defaultStore = (0, $5Zyvw$jotai.createStore)();
67
176
  const $8df0e777e4d7dd49$export$67f6d73bc6cd7bb1 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({});
68
177
  const $8df0e777e4d7dd49$export$bb43666ced7a20d0 = ({ children: children, client: client, jotaiStore: jotaiStore = $8df0e777e4d7dd49$var$defaultStore })=>{
@@ -114,7 +223,9 @@ const $8df0e777e4d7dd49$export$bb43666ced7a20d0 = ({ children: children, client:
114
223
  on: on,
115
224
  off: off
116
225
  },
117
- children: children
226
+ children: (0, $5Zyvw$reactjsxruntime.jsx)((0, $44c6278d186dd94f$export$4777554fda61c378), {
227
+ children: children
228
+ })
118
229
  })
119
230
  })
120
231
  });
@@ -128,27 +239,6 @@ const $172f489fc5d91d99$export$777fa8498be78705 = ()=>{
128
239
  };
129
240
 
130
241
 
131
- /**
132
- * Copyright (c) 2024, Daily.
133
- *
134
- * SPDX-License-Identifier: BSD-2-Clause
135
- */
136
-
137
- const $8a6b68ebf0332682$export$33a6ac53b8f02625 = (event, handler)=>{
138
- const { on: on, off: off } = (0, $5Zyvw$react.useContext)((0, $a37ab5d1bcf1d3b2$export$fe23d0ef95286467));
139
- (0, $5Zyvw$react.useEffect)(()=>{
140
- on(event, handler);
141
- return ()=>{
142
- off(event, handler);
143
- };
144
- }, [
145
- event,
146
- handler,
147
- on,
148
- off
149
- ]);
150
- };
151
-
152
242
 
153
243
  const $630203d8dad1dd45$var$localAudioTrackAtom = (0, $5Zyvw$jotai.atom)(null);
154
244
  const $630203d8dad1dd45$var$localVideoTrackAtom = (0, $5Zyvw$jotai.atom)(null);
@@ -244,46 +334,13 @@ $a2a1c5f475114d56$export$b52250cb73ff4de1.displayName = "PipecatClientAudio";
244
334
 
245
335
 
246
336
 
247
-
248
-
249
337
  /**
250
338
  * Copyright (c) 2024, Daily.
251
339
  *
252
340
  * SPDX-License-Identifier: BSD-2-Clause
253
341
  */
254
342
 
255
-
256
- const $810478f6ae107062$var$transportStateAtom = (0, $5Zyvw$jotai.atom)("disconnected");
257
- const $810478f6ae107062$export$30aee278309a867b = ()=>{
258
- const [transportState, setTransportState] = (0, $5Zyvw$jotai.useAtom)($810478f6ae107062$var$transportStateAtom);
259
- (0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).TransportStateChanged, setTransportState);
260
- return transportState;
261
- };
262
-
263
-
264
- const $d9b24817de62910a$export$3ea2601427f0430f = ()=>{
265
- const client = (0, $172f489fc5d91d99$export$777fa8498be78705)();
266
- const [isCamEnabled, setIsCamEnabled] = (0, $5Zyvw$react.useState)(client?.isCamEnabled ?? false);
267
- const transportState = (0, $810478f6ae107062$export$30aee278309a867b)();
268
- // Sync component state with client state initially
269
- (0, $5Zyvw$react.useEffect)(()=>{
270
- if (!client || transportState !== "initialized" || typeof client.isCamEnabled !== "boolean") return;
271
- setIsCamEnabled(client.isCamEnabled);
272
- }, [
273
- client,
274
- transportState
275
- ]);
276
- const enableCam = (0, $5Zyvw$react.useCallback)((enabled)=>{
277
- setIsCamEnabled(enabled);
278
- client?.enableCam?.(enabled);
279
- }, [
280
- client
281
- ]);
282
- return {
283
- enableCam: enableCam,
284
- isCamEnabled: isCamEnabled
285
- };
286
- };
343
+ const $d9b24817de62910a$export$3ea2601427f0430f = ()=>(0, $5Zyvw$react.useContext)((0, $44c6278d186dd94f$export$d6bdcccacef16204));
287
344
 
288
345
 
289
346
  const $666ceba11158b494$export$dc9a029eeca8213f = ({ onCamEnabledChanged: onCamEnabledChanged, disabled: disabled = false, children: children })=>{
@@ -312,32 +369,13 @@ var $666ceba11158b494$export$2e2bcd8739ae039 = $666ceba11158b494$export$dc9a029e
312
369
 
313
370
 
314
371
 
372
+ /**
373
+ * Copyright (c) 2024, Daily.
374
+ *
375
+ * SPDX-License-Identifier: BSD-2-Clause
376
+ */
315
377
 
316
-
317
-
318
- const $4af0eba414c586fd$export$388e706586309ef0 = ()=>{
319
- const client = (0, $172f489fc5d91d99$export$777fa8498be78705)();
320
- const [isMicEnabled, setIsMicEnabled] = (0, $5Zyvw$react.useState)(client?.isMicEnabled ?? false);
321
- const transportState = (0, $810478f6ae107062$export$30aee278309a867b)();
322
- // Sync component state with client state initially
323
- (0, $5Zyvw$react.useEffect)(()=>{
324
- if (!client || transportState !== "initialized" || typeof client.isMicEnabled !== "boolean") return;
325
- setIsMicEnabled(client.isMicEnabled);
326
- }, [
327
- client,
328
- transportState
329
- ]);
330
- const enableMic = (0, $5Zyvw$react.useCallback)((enabled)=>{
331
- setIsMicEnabled(enabled);
332
- client?.enableMic?.(enabled);
333
- }, [
334
- client
335
- ]);
336
- return {
337
- enableMic: enableMic,
338
- isMicEnabled: isMicEnabled
339
- };
340
- };
378
+ const $4af0eba414c586fd$export$388e706586309ef0 = ()=>(0, $5Zyvw$react.useContext)((0, $44c6278d186dd94f$export$802b42df0e0d8153));
341
379
 
342
380
 
343
381
  const $1a9931980e271aa3$export$bc8133b69ff660a2 = ({ onMicEnabledChanged: onMicEnabledChanged, disabled: disabled = false, children: children })=>{
@@ -367,6 +405,44 @@ var $1a9931980e271aa3$export$2e2bcd8739ae039 = $1a9931980e271aa3$export$bc8133b6
367
405
 
368
406
 
369
407
 
408
+ /**
409
+ * Copyright (c) 2025, Daily.
410
+ *
411
+ * SPDX-License-Identifier: BSD-2-Clause
412
+ */
413
+
414
+ const $5fc67d7ca05dec34$export$be63b19bd7f7d4f5 = ()=>(0, $5Zyvw$react.useContext)((0, $44c6278d186dd94f$export$8e633e67c760098b));
415
+
416
+
417
+ const $0a9d1dc5be2e1cc2$export$93764714dfab3a46 = ({ onScreenShareEnabledChanged: onScreenShareEnabledChanged, disabled: disabled = false, children: children })=>{
418
+ const { enableScreenShare: enableScreenShare, isScreenShareEnabled: isScreenShareEnabled } = (0, $5fc67d7ca05dec34$export$be63b19bd7f7d4f5)();
419
+ const handleToggleScreenShare = (0, $5Zyvw$react.useCallback)(()=>{
420
+ if (disabled) return;
421
+ enableScreenShare(!isScreenShareEnabled);
422
+ }, [
423
+ disabled,
424
+ enableScreenShare,
425
+ isScreenShareEnabled
426
+ ]);
427
+ (0, $5Zyvw$react.useEffect)(()=>{
428
+ onScreenShareEnabledChanged?.(isScreenShareEnabled);
429
+ }, [
430
+ isScreenShareEnabled,
431
+ onScreenShareEnabledChanged
432
+ ]);
433
+ return (0, $5Zyvw$reactjsxruntime.jsx)((0, $5Zyvw$reactjsxruntime.Fragment), {
434
+ children: children({
435
+ isScreenShareEnabled: isScreenShareEnabled,
436
+ onClick: handleToggleScreenShare,
437
+ disabled: disabled
438
+ })
439
+ });
440
+ };
441
+ var $0a9d1dc5be2e1cc2$export$2e2bcd8739ae039 = $0a9d1dc5be2e1cc2$export$93764714dfab3a46;
442
+
443
+
444
+
445
+
370
446
  /**
371
447
  * Copyright (c) 2024, Daily.
372
448
  *
@@ -509,7 +585,11 @@ $0f97689637ada1d8$export$85974db6d0cc43b3.displayName = "PipecatClientVideo";
509
585
 
510
586
 
511
587
 
512
-
588
+ /**
589
+ * Copyright (c) 2024, Daily.
590
+ *
591
+ * SPDX-License-Identifier: BSD-2-Clause
592
+ */
513
593
 
514
594
 
515
595
 
@@ -598,6 +678,15 @@ const $9bd3e7d3a9d7acd1$export$642bc4d2d2a376f1 = ()=>{
598
678
 
599
679
 
600
680
 
681
+ /**
682
+ * Copyright (c) 2024, Daily.
683
+ *
684
+ * SPDX-License-Identifier: BSD-2-Clause
685
+ */
686
+
687
+ const $810478f6ae107062$export$30aee278309a867b = ()=>(0, $5Zyvw$react.useContext)((0, $44c6278d186dd94f$export$db79fdf85ddd6b65));
688
+
689
+
601
690
 
602
691
 
603
692