@stream-io/video-react-bindings 1.12.1 → 1.12.4
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/CHANGELOG.md +26 -0
- package/dist/index.cjs.js +9 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +10 -12
- package/dist/index.es.js.map +1 -1
- package/package.json +9 -6
- package/src/hooks/useObservableValue.ts +12 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.12.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.12.3...@stream-io/video-react-bindings-1.12.4) (2025-12-18)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
- `@stream-io/video-client` updated to version `1.39.1`
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
- **provenance:** add repository info to every package ([4159633](https://github.com/GetStream/stream-video-js/commit/4159633b908afe6542b4be53151da6218175426c))
|
|
14
|
+
|
|
15
|
+
## [1.12.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.12.2...@stream-io/video-react-bindings-1.12.3) (2025-12-18)
|
|
16
|
+
|
|
17
|
+
### Dependency Updates
|
|
18
|
+
|
|
19
|
+
- `@stream-io/video-client` updated to version `1.39.0`
|
|
20
|
+
|
|
21
|
+
## [1.12.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.12.1...@stream-io/video-react-bindings-1.12.2) (2025-12-11)
|
|
22
|
+
|
|
23
|
+
### Dependency Updates
|
|
24
|
+
|
|
25
|
+
- `@stream-io/video-client` updated to version `1.38.2`
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
- revert usage of useSyncExternalStore ([#2043](https://github.com/GetStream/stream-video-js/issues/2043)) ([849e896](https://github.com/GetStream/stream-video-js/commit/849e8964ac90d5785a6d608443f80156d1081744)), closes [#1953](https://github.com/GetStream/stream-video-js/issues/1953) [#2034](https://github.com/GetStream/stream-video-js/issues/2034) [#2006](https://github.com/GetStream/stream-video-js/issues/2006) [#2008](https://github.com/GetStream/stream-video-js/issues/2008)
|
|
30
|
+
|
|
5
31
|
## [1.12.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.12.0...@stream-io/video-react-bindings-1.12.1) (2025-12-08)
|
|
6
32
|
|
|
7
33
|
### Dependency Updates
|
package/dist/index.cjs.js
CHANGED
|
@@ -5,7 +5,6 @@ var react = require('react');
|
|
|
5
5
|
var i18next = require('i18next');
|
|
6
6
|
var videoClient = require('@stream-io/video-client');
|
|
7
7
|
var rxjs = require('rxjs');
|
|
8
|
-
var shim = require('use-sync-external-store/shim');
|
|
9
8
|
|
|
10
9
|
const StreamCallContext = react.createContext(undefined);
|
|
11
10
|
/**
|
|
@@ -126,25 +125,24 @@ const isReactNative = () => {
|
|
|
126
125
|
* @param defaultValue a default value. Used when the observable data can't be read or emits an error - must be stable.
|
|
127
126
|
*/
|
|
128
127
|
const useObservableValue = (observable$, defaultValue) => {
|
|
129
|
-
const
|
|
128
|
+
const [value, setValue] = react.useState(() => {
|
|
130
129
|
try {
|
|
131
130
|
return videoClient.RxUtils.getCurrentValue(observable$);
|
|
132
131
|
}
|
|
133
|
-
catch (
|
|
132
|
+
catch (err) {
|
|
134
133
|
if (typeof defaultValue === 'undefined')
|
|
135
|
-
throw
|
|
134
|
+
throw err;
|
|
136
135
|
return defaultValue;
|
|
137
136
|
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
console.log('An error occurred while reading an observable',
|
|
137
|
+
});
|
|
138
|
+
react.useEffect(() => {
|
|
139
|
+
return videoClient.RxUtils.createSubscription(observable$, setValue, (err) => {
|
|
140
|
+
console.log('An error occurred while reading an observable', err);
|
|
142
141
|
if (defaultValue)
|
|
143
|
-
|
|
142
|
+
setValue(defaultValue);
|
|
144
143
|
});
|
|
145
|
-
return unsubscribe;
|
|
146
144
|
}, [defaultValue, observable$]);
|
|
147
|
-
return
|
|
145
|
+
return value;
|
|
148
146
|
};
|
|
149
147
|
|
|
150
148
|
// kind-of memoized, used as a default value
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/helpers/platforms.ts","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/useEffectEvent.ts","../../src/hooks/store.ts","../../src/hooks/callUtilHooks.ts","../../src/hooks/index.ts","../../src/wrappers/Restricted.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useContext } from 'react';\nimport { Call } from '@stream-io/video-client';\n\nconst StreamCallContext = createContext<Call | undefined>(undefined);\n\n/**\n * The props for the StreamCallProvider component.\n */\nexport interface StreamCallProviderProps {\n /**\n * The call instance to provide to the component tree.\n */\n call?: Call;\n}\n\n/**\n * A provider for the call object.\n */\nexport const StreamCallProvider = (\n props: PropsWithChildren<StreamCallProviderProps>,\n) => {\n const { call, children } = props;\n return (\n <StreamCallContext.Provider value={call}>\n {children}\n </StreamCallContext.Provider>\n );\n};\n\n/**\n * A hook to get the call object from the closest provider.\n */\nexport const useCall = () => {\n return useContext(StreamCallContext);\n};\n","import i18next from 'i18next';\nimport {\n TranslationLanguage,\n TranslationsMap,\n TranslationsRegistry,\n TranslatorFunction,\n} from './types';\n\nconst mapToRegistry = (translationsMap: TranslationsMap, namespace: string) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n\nexport const defaultTranslationFunction = (key: string) => key;\n\nexport type StreamI18nConstructor = {\n /** Language into which the provided strings are translated */\n currentLanguage?: TranslationLanguage;\n /** Fallback language which will be used if no translation is found for current language */\n fallbackLanguage?: TranslationLanguage;\n /** Logs info level to console output. Helps find issues with loading not working. */\n debug?: boolean;\n /** Custom translations that will be merged with the defaults provided by the library. */\n translationsOverrides?: TranslationsMap;\n};\n\nexport class StreamI18n {\n /** Exposed i18n instance from the i18next library */\n i18nInstance;\n /** Translator function that converts the provided string into its equivalent in the current language. */\n t: TranslatorFunction = defaultTranslationFunction;\n\n constructor({\n debug = false,\n currentLanguage = 'en',\n fallbackLanguage,\n translationsOverrides = { en: {} },\n }: StreamI18nConstructor = {}) {\n const ns = 'stream-video';\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: ns,\n fallbackLng: fallbackLanguage,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: defaultTranslationFunction,\n resources: mapToRegistry(translationsOverrides, ns),\n });\n }\n\n get currentLanguage() {\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n this.t = await this.i18nInstance.init();\n return this.t;\n };\n\n changeLanguage = async (language?: TranslationLanguage) => {\n this.t = await this.i18nInstance.changeLanguage(language);\n return this.t;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\n TranslationLanguage,\n TranslationsMap,\n} from '../i18n';\n\ntype StreamI18nContextValue = {\n t: StreamI18n['t'];\n i18n?: StreamI18n;\n};\n\nconst StreamI18nContext = createContext<StreamI18nContextValue>({\n t: defaultTranslationFunction,\n});\n\ntype CreateI18nParams = {\n i18nInstance?: StreamI18n;\n language?: TranslationLanguage;\n fallbackLanguage?: TranslationLanguage;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const api = useCreateI18n(createI18nParams);\n return (\n <StreamI18nContext.Provider value={api}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nconst useCreateI18n = ({\n i18nInstance,\n language,\n fallbackLanguage,\n translationsOverrides,\n}: CreateI18nParams) => {\n const [i18n] = useState(\n () =>\n i18nInstance ||\n new StreamI18n({\n currentLanguage: language,\n fallbackLanguage,\n translationsOverrides,\n }),\n );\n const [t, setTranslationFn] = useState<StreamI18n['t']>(() => i18n.t);\n useEffect(() => {\n if (!i18n.isInitialized) {\n i18n.init().then(() => setTranslationFn(() => i18n.t));\n } else if (i18n.currentLanguage !== language) {\n i18n.changeLanguage(language).then(() => setTranslationFn(() => i18n.t));\n }\n }, [i18n, language]);\n\n return useMemo(() => ({ i18n, t }), [i18n, t]);\n};\n\n/**\n * A hook to get the i18n instance and translation function from the closest provider.\n *\n * Example usage:\n * const { t, i18n } = useI18n();\n * const message = t('hello_world');\n * console.log(message);\n */\nexport const useI18n = () => useContext(StreamI18nContext);\n","import { createContext, PropsWithChildren, useContext } from 'react';\nimport { StreamVideoClient } from '@stream-io/video-client';\nimport {\n StreamI18nProvider,\n StreamI18nProviderProps,\n} from './StreamI18nContext';\n\nconst StreamVideoContext = createContext<StreamVideoClient | undefined>(\n undefined,\n);\n\n/**\n * The props for the StreamVideoProvider component.\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\n /**\n * The client instance to provide to the component tree.\n */\n client: StreamVideoClient;\n};\n\n/**\n * StreamVideo is a provider component which should be used to wrap the entire application.\n * It provides the client object to all children components and initializes the i18n instance.\n */\nexport const StreamVideoProvider = ({\n children,\n client,\n i18nInstance,\n language,\n translationsOverrides,\n}: PropsWithChildren<StreamVideoProps>) => {\n return (\n <StreamVideoContext.Provider value={client}>\n <StreamI18nProvider\n i18nInstance={i18nInstance}\n language={language}\n translationsOverrides={translationsOverrides}\n >\n {children}\n </StreamI18nProvider>\n </StreamVideoContext.Provider>\n );\n};\n\n/**\n * Hook to access the nearest StreamVideo client instance.\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\n};\n","/**\n * Checks whether we are using React Native\n */\nexport const isReactNative = () => {\n if (typeof navigator === 'undefined') return false;\n return navigator.product?.toLowerCase() === 'reactnative';\n};\n","import type { Observable } from 'rxjs';\nimport { useCallback } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { RxUtils } from '@stream-io/video-client';\n\n/**\n * Utility hook which provides the current value of the given observable.\n *\n * @param observable$ the observable to read data from.\n * @param defaultValue a default value. Used when the observable data can't be read or emits an error - must be stable.\n */\nexport const useObservableValue = <T>(\n observable$: Observable<T>,\n defaultValue?: T,\n) => {\n const getSnapshot = useCallback(() => {\n try {\n return RxUtils.getCurrentValue(observable$);\n } catch (error) {\n if (typeof defaultValue === 'undefined') throw error;\n return defaultValue;\n }\n }, [defaultValue, observable$]);\n\n const subscribe = useCallback(\n (onStoreChange: (v: T) => void) => {\n const unsubscribe = RxUtils.createSubscription(\n observable$,\n onStoreChange,\n (error) => {\n console.log('An error occurred while reading an observable', error);\n\n if (defaultValue) onStoreChange(defaultValue);\n },\n );\n\n return unsubscribe;\n },\n [defaultValue, observable$],\n );\n\n return useSyncExternalStore(subscribe, getSnapshot);\n};\n","import {\n Call,\n CallClosedCaption,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n InputDeviceStatus,\n MemberResponse,\n OwnCapability,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useMemo, useState } from 'react';\nimport { Observable, of } from 'rxjs';\nimport { useCall } from '../contexts';\nimport { isReactNative } from '../helpers/platforms';\nimport { useObservableValue } from './useObservableValue';\n\n// kind-of memoized, used as a default value\nconst EMPTY_DEVICES_ARRAY = Object.freeze<MediaDeviceInfo[]>(\n [],\n) as MediaDeviceInfo[];\n\nexport type UseInputMediaDeviceOptions = {\n /**\n * If `true`, the hook will use the optimistic status to determine whether the device is muted or not.\n */\n optimisticUpdates?: boolean;\n};\n\n/**\n * Utility hook, which provides the current call's state.\n */\nexport const useCallState = () => {\n const call = useCall();\n // return an empty and unlinked CallState object if there is no call in the provider\n // this ensures that the hooks always return a value and many null checks can be avoided\n if (!call) {\n const message =\n 'You are using useCallState() outside a Call context. ' +\n 'Please wrap your component in <StreamCall /> and provide a \"call\" instance.';\n console.warn(message);\n return new CallState();\n }\n return call.state;\n};\n\n/**\n * Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.\n */\nexport const useIsCallRecordingInProgress = (): boolean => {\n const { recording$ } = useCallState();\n return useObservableValue(recording$);\n};\n\n/**\n * Utility hook which provides information whether the current call is broadcasting.\n */\nexport const useIsCallHLSBroadcastingInProgress = (): boolean => {\n const { egress$ } = useCallState();\n const egress = useObservableValue(egress$);\n if (!egress) return false;\n return egress.broadcasting;\n};\n\n/**\n * Utility hook which provides information whether the current call is live.\n */\nexport const useIsCallLive = (): boolean => {\n const { backstage$ } = useCallState();\n const isBackstageOn = useObservableValue(backstage$);\n return !isBackstageOn;\n};\n\n/**\n * Returns the list of blocked users in the current call.\n */\nexport const useCallBlockedUserIds = (): string[] => {\n const { blockedUserIds$ } = useCallState();\n return useObservableValue(blockedUserIds$);\n};\n\n/**\n * Returns the timestamp when this call was created.\n */\nexport const useCallCreatedAt = (): Date | undefined => {\n const { createdAt$ } = useCallState();\n return useObservableValue(createdAt$);\n};\n\n/**\n * Returns the timestamp when this call was ended.\n */\nexport const useCallEndedAt = (): Date | undefined => {\n const { endedAt$ } = useCallState();\n return useObservableValue(endedAt$);\n};\n\n/**\n * Returns the timestamp telling when the call is scheduled to start.\n */\nexport const useCallStartsAt = (): Date | undefined => {\n const { startsAt$ } = useCallState();\n return useObservableValue(startsAt$);\n};\n\n/**\n * Returns the timestamp when this call was updated.\n */\nexport const useCallUpdatedAt = (): Date | undefined => {\n const { updatedAt$ } = useCallState();\n return useObservableValue(updatedAt$);\n};\n\n/**\n * Returns the information about the call's creator.\n */\nexport const useCallCreatedBy = (): UserResponse | undefined => {\n const { createdBy$ } = useCallState();\n return useObservableValue(createdBy$);\n};\n\n/**\n * Returns the call's custom data.\n */\nexport const useCallCustomData = (): Record<string, any> => {\n const { custom$ } = useCallState();\n return useObservableValue(custom$);\n};\n\n/**\n * Returns the call's Egress information.\n */\nexport const useCallEgress = (): EgressResponse | undefined => {\n const { egress$ } = useCallState();\n return useObservableValue(egress$);\n};\n\n/**\n * Returns the call's Ingress information.\n */\nexport const useCallIngress = (): CallIngressResponse | undefined => {\n const { ingress$ } = useCallState();\n return useObservableValue(ingress$);\n};\n\n/**\n * Returns the data for the current call session.\n */\nexport const useCallSession = (): CallSessionResponse | undefined => {\n const { session$ } = useCallState();\n return useObservableValue(session$);\n};\n\n/**\n * Returns the call's settings.\n */\nexport const useCallSettings = (): CallSettingsResponse | undefined => {\n const { settings$ } = useCallState();\n return useObservableValue(settings$);\n};\n\n/**\n * Returns whether the call has transcribing enabled.\n */\nexport const useIsCallTranscribingInProgress = (): boolean => {\n const { transcribing$ } = useCallState();\n return useObservableValue(transcribing$);\n};\n\n/**\n * Returns information about the user who has marked this call as ended.\n */\nexport const useCallEndedBy = (): UserResponse | undefined => {\n const { endedBy$ } = useCallState();\n return useObservableValue(endedBy$);\n};\n\n/**\n * Utility hook which provides a boolean indicating whether there is\n * a participant in the current call which shares their screen.\n */\nexport const useHasOngoingScreenShare = (): boolean => {\n const { hasOngoingScreenShare$ } = useCallState();\n return useObservableValue(hasOngoingScreenShare$);\n};\n\n/**\n * Utility hook which provides the latest stats report of the current call.\n *\n * The latest stats report of the current call.\n * When stats gathering is enabled, this observable will emit a new value\n * at a regular (configurable) interval.\n *\n * Consumers of this observable can implement their own batching logic\n * in case they want to show historical stats data.\n */\nexport const useCallStatsReport = (): CallStatsReport | undefined => {\n const { callStatsReport$ } = useCallState();\n return useObservableValue(callStatsReport$);\n};\n\n/**\n * Utility hook which provides the dominant speaker of the current call.\n */\nexport const useDominantSpeaker = (): StreamVideoParticipant | undefined => {\n const { dominantSpeaker$ } = useCallState();\n return useObservableValue(dominantSpeaker$);\n};\n\n/**\n * Utility hook which provides a list of call members.\n */\nexport const useCallMembers = (): MemberResponse[] => {\n const { members$ } = useCallState();\n return useObservableValue(members$);\n};\n\n/**\n * Utility hook providing the current calling state of the call. For example, `RINGING` or `JOINED`.\n */\nexport const useCallCallingState = () => {\n const { callingState$ } = useCallState();\n return useObservableValue(callingState$);\n};\n\n/**\n * Utility hook providing the actual start time of the current session.\n * Useful for calculating the call duration.\n */\nexport const useCallStartedAt = () => {\n const { startedAt$ } = useCallState();\n return useObservableValue(startedAt$);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n *\n * @param options.sortBy - A comparator function to sort the participants by.\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\nexport const useParticipants = ({\n sortBy,\n}: {\n /**\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\n sortBy?: Comparator<StreamVideoParticipant>;\n} = {}) => {\n const { participants$ } = useCallState();\n const participants = useObservableValue(participants$);\n\n return useMemo(() => {\n if (sortBy) {\n return [...participants].sort(sortBy);\n }\n return participants;\n }, [participants, sortBy]);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n * Unlike `useParticipants`, it returns a more stable reference that is not affected\n * by participant sort settings.\n *\n * @category Call State\n */\nexport const useRawParticipants = () => {\n const { rawParticipants$ } = useCallState();\n return useObservableValue(rawParticipants$);\n};\n\n/**\n * A hook which provides a StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n */\nexport const useLocalParticipant = () => {\n const { localParticipant$ } = useCallState();\n return useObservableValue(localParticipant$);\n};\n\n/**\n * A hook which provides a list of all other participants than me that have joined an active call.\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\n};\n\n/**\n * A hook which provides a list of participants that are currently pinned.\n */\nexport const usePinnedParticipants = () => {\n const { pinnedParticipants$ } = useCallState();\n return useObservableValue(pinnedParticipants$);\n};\n\n/**\n * Returns the approximate participant count of the active call.\n * This includes the anonymous users as well, and it is computed on the server.\n */\nexport const useParticipantCount = () => {\n const { participantCount$ } = useCallState();\n return useObservableValue(participantCount$);\n};\n\n/**\n * Returns the approximate anonymous participant count of the active call.\n * The regular participants are not included in this count. It is computed on the server.\n */\nexport const useAnonymousParticipantCount = () => {\n const { anonymousParticipantCount$ } = useCallState();\n return useObservableValue(anonymousParticipantCount$);\n};\n\n/**\n * Returns the generated thumbnail of the current call, if enabled in settings.\n */\nexport const useCallThumbnail = () => {\n const { thumbnails$ } = useCallState();\n return useObservableValue(thumbnails$);\n};\n\n/**\n * A hook which returns the local participant's own capabilities.\n */\nexport const useOwnCapabilities = (): OwnCapability[] | undefined => {\n const { ownCapabilities$ } = useCallState();\n return useObservableValue(ownCapabilities$);\n};\n\n/**\n * Hook that returns true if the local participant has all the given permissions.\n *\n * @param permissions the permissions to check.\n */\nexport const useHasPermissions = (...permissions: OwnCapability[]): boolean => {\n const capabilities = useOwnCapabilities();\n return permissions.every((permission) => capabilities?.includes(permission));\n};\n\n/**\n * Returns the camera state of the current call.\n */\nexport const useCameraState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { camera } = call as Call;\n\n const { state } = camera;\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(camera);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n\n return {\n camera,\n direction,\n mediaStream,\n get devices() {\n return getDevices();\n },\n hasBrowserPermission,\n isPromptingPermission,\n selectedDevice,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n */\nexport const useMicrophoneState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const { state } = microphone;\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(microphone);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n const audioBitrateProfile = useObservableValue(state.audioBitrateProfile$);\n\n return {\n microphone,\n mediaStream,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n hasBrowserPermission,\n isPromptingPermission,\n isSpeakingWhileMuted,\n audioBitrateProfile,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n *\n * Note: This hook is not supported in React Native\n */\nexport const useSpeakerState = () => {\n if (isReactNative()) {\n throw new Error(\n 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/react-native/guides/camera-and-microphone/#speaker-management for more details',\n );\n }\n const call = useCall();\n const { speaker } = call as Call;\n\n const { getDevices } = useLazyDeviceList(speaker);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n const volume = useObservableValue(speaker.state.volume$);\n\n return {\n speaker,\n volume,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n isDeviceSelectionSupported: speaker.state.isDeviceSelectionSupported,\n };\n};\n\n/**\n * Returns the Screen Share state of the current call.\n */\nexport const useScreenShareState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { screenShare } = call as Call;\n const { state } = screenShare;\n return {\n screenShare,\n mediaStream: useObservableValue(state.mediaStream$),\n audioBitrateProfile: useObservableValue(state.audioBitrateProfile$),\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns incoming video settings for the current call, including\n * global and per-participant manual video quality overrides.\n */\nexport const useIncomingVideoSettings = () => {\n const call = useCall() as Call;\n return useObservableValue(call.dynascaleManager.incomingVideoSettings$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useCallClosedCaptions = (): CallClosedCaption[] => {\n const { closedCaptions$ } = useCallState();\n return useObservableValue(closedCaptions$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useIsCallCaptioningInProgress = (): boolean => {\n const { captioning$ } = useCallState();\n return useObservableValue(captioning$);\n};\n\nfunction getComputedStatus(\n status: InputDeviceStatus,\n pendingStatus: InputDeviceStatus,\n options: Required<UseInputMediaDeviceOptions>,\n) {\n const optimisticStatus = pendingStatus ?? status;\n\n return {\n status,\n optimisticStatus,\n isEnabled: status === 'enabled',\n isMute: status !== 'enabled',\n optimisticIsMute: optimisticStatus !== 'enabled',\n isTogglePending: optimisticStatus !== status,\n /**\n * If optimistic updates are enabled (`options.optimisticUpdates`), we\n * consider the optimistic status to determine whether the device is muted or not.\n * Otherwise, we rely on the actual status.\n */\n optionsAwareIsMute: options.optimisticUpdates\n ? optimisticStatus !== 'enabled'\n : status !== 'enabled',\n };\n}\n\ninterface DeviceManagerLike {\n listDevices(): Observable<MediaDeviceInfo[]>;\n}\n\nfunction useLazyDeviceList(manager: DeviceManagerLike) {\n const placeholderDevices$ = useMemo(() => of(EMPTY_DEVICES_ARRAY), []);\n const [devices$, setDevices$] = useState(placeholderDevices$);\n const devices = useObservableValue(devices$, EMPTY_DEVICES_ARRAY);\n\n const getDevices = () => {\n if (devices$ === placeholderDevices$) {\n setDevices$(manager.listDevices());\n }\n\n return devices ?? EMPTY_DEVICES_ARRAY;\n };\n\n return { getDevices };\n}\n","import { useCallback, useLayoutEffect, useRef } from 'react';\n\nfunction useEffectEventShim<T extends (...args: any[]) => any>(\n cb: T,\n): (...funcArgs: Parameters<T>) => ReturnType<T> {\n const cbRef = useRef(cb);\n\n useLayoutEffect(() => {\n cbRef.current = cb;\n }, [cb]);\n\n return useCallback((...args: Parameters<T>) => {\n const callback = cbRef.current;\n return callback(...args);\n }, []);\n}\n\nexport const useEffectEvent = useEffectEventShim;\n","import { useStreamVideoClient } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook which provides access to client's state store.\n */\nexport const useStore = () => {\n const client = useStreamVideoClient();\n if (!client) {\n throw new Error(\n `StreamVideoClient isn't initialized or this hook is called outside of <StreamVideo> context.`,\n );\n }\n return client.state;\n};\n\n/**\n * Utility hook which provides a list of all notifications about created calls.\n * In the ring call settings, these calls can be outgoing (I have called somebody)\n * or incoming (somebody has called me).\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import { useCallback, useEffect, useState } from 'react';\nimport { useCall } from '../contexts';\nimport { useIsCallRecordingInProgress } from './callStateHooks';\n\n/**\n * Custom hook for toggling call recording in a video call.\n *\n * This hook provides functionality to start and stop call recording,\n * along with state management for tracking the recording status\n * and the loading indicator while awaiting a response.\n */\nexport const useToggleCallRecording = () => {\n const call = useCall();\n const isCallRecordingInProgress = useIsCallRecordingInProgress();\n const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);\n\n // TODO: add permissions\n\n useEffect(() => {\n // we wait until call.recording_started/stopped event to flips the\n // `isCallRecordingInProgress` state variable.\n // Once the flip happens, we remove the loading indicator\n setIsAwaitingResponse((isAwaiting) => {\n if (isAwaiting) return false;\n return isAwaiting;\n });\n }, [isCallRecordingInProgress]);\n\n const toggleCallRecording = useCallback(async () => {\n try {\n setIsAwaitingResponse(true);\n if (isCallRecordingInProgress) {\n await call?.stopRecording();\n } else {\n await call?.startRecording();\n }\n } catch (e) {\n console.error(`Failed start recording`, e);\n throw e;\n }\n }, [call, isCallRecordingInProgress]);\n\n return { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress };\n};\n","import * as CallStateHooks from './callStateHooks';\nexport * from './useEffectEvent';\nexport * from './useObservableValue';\n\nexport * from './store';\nexport * from './callUtilHooks';\n\nexport type { UseInputMediaDeviceOptions } from './callStateHooks';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n */\nexport const useCallStateHooks = () => CallStateHooks;\n","import { OwnCapability } from '@stream-io/video-client';\n\nimport { PropsWithChildren } from 'react';\nimport { useCall } from '../contexts';\nimport { useCallStateHooks } from '../hooks';\n\ntype RestrictedProps = PropsWithChildren<{\n /**\n * Required grants for the component to be able to render supplied children elements\n */\n requiredGrants: OwnCapability[];\n /**\n * Render children only if user can request capability, but does not have it\n */\n canRequestOnly?: boolean;\n /**\n * Render children only if user has capability\n */\n hasPermissionsOnly?: boolean;\n /**\n * Require all grants specified in `requiredGrants` to be available in the `availableGrants`,\n * component by default requires only one grant to appear in both arrays to render its children\n */\n requireAll?: boolean;\n}>;\n\nexport const Restricted = ({\n canRequestOnly,\n hasPermissionsOnly,\n requiredGrants,\n requireAll = true,\n children,\n}: RestrictedProps) => {\n const call = useCall();\n const { useCallSettings, useOwnCapabilities } = useCallStateHooks();\n const ownCapabilities = useOwnCapabilities();\n const settings = useCallSettings();\n const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](\n (capability) => ownCapabilities?.includes(capability),\n );\n\n if (hasPermissionsOnly) return hasPermissions ? <>{children}</> : null;\n\n const canRequest = requiredGrants.some((capability) =>\n call?.permissionsContext.canRequest(capability, settings),\n );\n\n if (canRequestOnly) return canRequest ? <>{children}</> : null;\n\n if (hasPermissions || canRequest) return <>{children}</>;\n\n return null;\n};\n"],"names":["createContext","_jsx","useContext","useState","useEffect","useMemo","useCallback","RxUtils","useSyncExternalStore","CallState","of","useRef","useLayoutEffect","_Fragment"],"mappings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d,kBAAkB,EAClB,cAAc,EACd,UAAU,GAAG,IAAI,EACjB,QAAQ,GACQ,KAAI;AACpB,IAAA,MAAM,IAAI,GAAG,OAAO,EAAE;IACtB,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,GAAG,iBAAiB,EAAE;AACnE,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAE;AAC5C,IAAA,MAAM,QAAQ,GAAG,eAAe,EAAE;IAClC,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC,CAClE,CAAC,UAAU,KAAK,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,CACtD;AAED,IAAA,IAAI,kBAAkB;QAAE,OAAO,cAAc,GAAGL,cAAA,CAAAY,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAEtE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,UAAU,KAChD,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAC1D;AAED,IAAA,IAAI,cAAc;QAAE,OAAO,UAAU,GAAGZ,cAAA,CAAAY,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAE9D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAOZ,cAAA,CAAAY,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AAExD,IAAA,OAAO,IAAI;AACb;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/helpers/platforms.ts","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/useEffectEvent.ts","../../src/hooks/store.ts","../../src/hooks/callUtilHooks.ts","../../src/hooks/index.ts","../../src/wrappers/Restricted.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useContext } from 'react';\nimport { Call } from '@stream-io/video-client';\n\nconst StreamCallContext = createContext<Call | undefined>(undefined);\n\n/**\n * The props for the StreamCallProvider component.\n */\nexport interface StreamCallProviderProps {\n /**\n * The call instance to provide to the component tree.\n */\n call?: Call;\n}\n\n/**\n * A provider for the call object.\n */\nexport const StreamCallProvider = (\n props: PropsWithChildren<StreamCallProviderProps>,\n) => {\n const { call, children } = props;\n return (\n <StreamCallContext.Provider value={call}>\n {children}\n </StreamCallContext.Provider>\n );\n};\n\n/**\n * A hook to get the call object from the closest provider.\n */\nexport const useCall = () => {\n return useContext(StreamCallContext);\n};\n","import i18next from 'i18next';\nimport {\n TranslationLanguage,\n TranslationsMap,\n TranslationsRegistry,\n TranslatorFunction,\n} from './types';\n\nconst mapToRegistry = (translationsMap: TranslationsMap, namespace: string) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n\nexport const defaultTranslationFunction = (key: string) => key;\n\nexport type StreamI18nConstructor = {\n /** Language into which the provided strings are translated */\n currentLanguage?: TranslationLanguage;\n /** Fallback language which will be used if no translation is found for current language */\n fallbackLanguage?: TranslationLanguage;\n /** Logs info level to console output. Helps find issues with loading not working. */\n debug?: boolean;\n /** Custom translations that will be merged with the defaults provided by the library. */\n translationsOverrides?: TranslationsMap;\n};\n\nexport class StreamI18n {\n /** Exposed i18n instance from the i18next library */\n i18nInstance;\n /** Translator function that converts the provided string into its equivalent in the current language. */\n t: TranslatorFunction = defaultTranslationFunction;\n\n constructor({\n debug = false,\n currentLanguage = 'en',\n fallbackLanguage,\n translationsOverrides = { en: {} },\n }: StreamI18nConstructor = {}) {\n const ns = 'stream-video';\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: ns,\n fallbackLng: fallbackLanguage,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: defaultTranslationFunction,\n resources: mapToRegistry(translationsOverrides, ns),\n });\n }\n\n get currentLanguage() {\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n this.t = await this.i18nInstance.init();\n return this.t;\n };\n\n changeLanguage = async (language?: TranslationLanguage) => {\n this.t = await this.i18nInstance.changeLanguage(language);\n return this.t;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\n TranslationLanguage,\n TranslationsMap,\n} from '../i18n';\n\ntype StreamI18nContextValue = {\n t: StreamI18n['t'];\n i18n?: StreamI18n;\n};\n\nconst StreamI18nContext = createContext<StreamI18nContextValue>({\n t: defaultTranslationFunction,\n});\n\ntype CreateI18nParams = {\n i18nInstance?: StreamI18n;\n language?: TranslationLanguage;\n fallbackLanguage?: TranslationLanguage;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const api = useCreateI18n(createI18nParams);\n return (\n <StreamI18nContext.Provider value={api}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nconst useCreateI18n = ({\n i18nInstance,\n language,\n fallbackLanguage,\n translationsOverrides,\n}: CreateI18nParams) => {\n const [i18n] = useState(\n () =>\n i18nInstance ||\n new StreamI18n({\n currentLanguage: language,\n fallbackLanguage,\n translationsOverrides,\n }),\n );\n const [t, setTranslationFn] = useState<StreamI18n['t']>(() => i18n.t);\n useEffect(() => {\n if (!i18n.isInitialized) {\n i18n.init().then(() => setTranslationFn(() => i18n.t));\n } else if (i18n.currentLanguage !== language) {\n i18n.changeLanguage(language).then(() => setTranslationFn(() => i18n.t));\n }\n }, [i18n, language]);\n\n return useMemo(() => ({ i18n, t }), [i18n, t]);\n};\n\n/**\n * A hook to get the i18n instance and translation function from the closest provider.\n *\n * Example usage:\n * const { t, i18n } = useI18n();\n * const message = t('hello_world');\n * console.log(message);\n */\nexport const useI18n = () => useContext(StreamI18nContext);\n","import { createContext, PropsWithChildren, useContext } from 'react';\nimport { StreamVideoClient } from '@stream-io/video-client';\nimport {\n StreamI18nProvider,\n StreamI18nProviderProps,\n} from './StreamI18nContext';\n\nconst StreamVideoContext = createContext<StreamVideoClient | undefined>(\n undefined,\n);\n\n/**\n * The props for the StreamVideoProvider component.\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\n /**\n * The client instance to provide to the component tree.\n */\n client: StreamVideoClient;\n};\n\n/**\n * StreamVideo is a provider component which should be used to wrap the entire application.\n * It provides the client object to all children components and initializes the i18n instance.\n */\nexport const StreamVideoProvider = ({\n children,\n client,\n i18nInstance,\n language,\n translationsOverrides,\n}: PropsWithChildren<StreamVideoProps>) => {\n return (\n <StreamVideoContext.Provider value={client}>\n <StreamI18nProvider\n i18nInstance={i18nInstance}\n language={language}\n translationsOverrides={translationsOverrides}\n >\n {children}\n </StreamI18nProvider>\n </StreamVideoContext.Provider>\n );\n};\n\n/**\n * Hook to access the nearest StreamVideo client instance.\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\n};\n","/**\n * Checks whether we are using React Native\n */\nexport const isReactNative = () => {\n if (typeof navigator === 'undefined') return false;\n return navigator.product?.toLowerCase() === 'reactnative';\n};\n","import type { Observable } from 'rxjs';\nimport { useEffect, useState } from 'react';\nimport { RxUtils } from '@stream-io/video-client';\n\n/**\n * Utility hook which provides the current value of the given observable.\n *\n * @param observable$ the observable to read data from.\n * @param defaultValue a default value. Used when the observable data can't be read or emits an error - must be stable.\n */\nexport const useObservableValue = <T>(\n observable$: Observable<T>,\n defaultValue?: T,\n) => {\n const [value, setValue] = useState<T>(() => {\n try {\n return RxUtils.getCurrentValue(observable$);\n } catch (err) {\n if (typeof defaultValue === 'undefined') throw err;\n return defaultValue;\n }\n });\n\n useEffect(() => {\n return RxUtils.createSubscription(observable$, setValue, (err) => {\n console.log('An error occurred while reading an observable', err);\n if (defaultValue) setValue(defaultValue);\n });\n }, [defaultValue, observable$]);\n\n return value;\n};\n","import {\n Call,\n CallClosedCaption,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n InputDeviceStatus,\n MemberResponse,\n OwnCapability,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useMemo, useState } from 'react';\nimport { Observable, of } from 'rxjs';\nimport { useCall } from '../contexts';\nimport { isReactNative } from '../helpers/platforms';\nimport { useObservableValue } from './useObservableValue';\n\n// kind-of memoized, used as a default value\nconst EMPTY_DEVICES_ARRAY = Object.freeze<MediaDeviceInfo[]>(\n [],\n) as MediaDeviceInfo[];\n\nexport type UseInputMediaDeviceOptions = {\n /**\n * If `true`, the hook will use the optimistic status to determine whether the device is muted or not.\n */\n optimisticUpdates?: boolean;\n};\n\n/**\n * Utility hook, which provides the current call's state.\n */\nexport const useCallState = () => {\n const call = useCall();\n // return an empty and unlinked CallState object if there is no call in the provider\n // this ensures that the hooks always return a value and many null checks can be avoided\n if (!call) {\n const message =\n 'You are using useCallState() outside a Call context. ' +\n 'Please wrap your component in <StreamCall /> and provide a \"call\" instance.';\n console.warn(message);\n return new CallState();\n }\n return call.state;\n};\n\n/**\n * Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.\n */\nexport const useIsCallRecordingInProgress = (): boolean => {\n const { recording$ } = useCallState();\n return useObservableValue(recording$);\n};\n\n/**\n * Utility hook which provides information whether the current call is broadcasting.\n */\nexport const useIsCallHLSBroadcastingInProgress = (): boolean => {\n const { egress$ } = useCallState();\n const egress = useObservableValue(egress$);\n if (!egress) return false;\n return egress.broadcasting;\n};\n\n/**\n * Utility hook which provides information whether the current call is live.\n */\nexport const useIsCallLive = (): boolean => {\n const { backstage$ } = useCallState();\n const isBackstageOn = useObservableValue(backstage$);\n return !isBackstageOn;\n};\n\n/**\n * Returns the list of blocked users in the current call.\n */\nexport const useCallBlockedUserIds = (): string[] => {\n const { blockedUserIds$ } = useCallState();\n return useObservableValue(blockedUserIds$);\n};\n\n/**\n * Returns the timestamp when this call was created.\n */\nexport const useCallCreatedAt = (): Date | undefined => {\n const { createdAt$ } = useCallState();\n return useObservableValue(createdAt$);\n};\n\n/**\n * Returns the timestamp when this call was ended.\n */\nexport const useCallEndedAt = (): Date | undefined => {\n const { endedAt$ } = useCallState();\n return useObservableValue(endedAt$);\n};\n\n/**\n * Returns the timestamp telling when the call is scheduled to start.\n */\nexport const useCallStartsAt = (): Date | undefined => {\n const { startsAt$ } = useCallState();\n return useObservableValue(startsAt$);\n};\n\n/**\n * Returns the timestamp when this call was updated.\n */\nexport const useCallUpdatedAt = (): Date | undefined => {\n const { updatedAt$ } = useCallState();\n return useObservableValue(updatedAt$);\n};\n\n/**\n * Returns the information about the call's creator.\n */\nexport const useCallCreatedBy = (): UserResponse | undefined => {\n const { createdBy$ } = useCallState();\n return useObservableValue(createdBy$);\n};\n\n/**\n * Returns the call's custom data.\n */\nexport const useCallCustomData = (): Record<string, any> => {\n const { custom$ } = useCallState();\n return useObservableValue(custom$);\n};\n\n/**\n * Returns the call's Egress information.\n */\nexport const useCallEgress = (): EgressResponse | undefined => {\n const { egress$ } = useCallState();\n return useObservableValue(egress$);\n};\n\n/**\n * Returns the call's Ingress information.\n */\nexport const useCallIngress = (): CallIngressResponse | undefined => {\n const { ingress$ } = useCallState();\n return useObservableValue(ingress$);\n};\n\n/**\n * Returns the data for the current call session.\n */\nexport const useCallSession = (): CallSessionResponse | undefined => {\n const { session$ } = useCallState();\n return useObservableValue(session$);\n};\n\n/**\n * Returns the call's settings.\n */\nexport const useCallSettings = (): CallSettingsResponse | undefined => {\n const { settings$ } = useCallState();\n return useObservableValue(settings$);\n};\n\n/**\n * Returns whether the call has transcribing enabled.\n */\nexport const useIsCallTranscribingInProgress = (): boolean => {\n const { transcribing$ } = useCallState();\n return useObservableValue(transcribing$);\n};\n\n/**\n * Returns information about the user who has marked this call as ended.\n */\nexport const useCallEndedBy = (): UserResponse | undefined => {\n const { endedBy$ } = useCallState();\n return useObservableValue(endedBy$);\n};\n\n/**\n * Utility hook which provides a boolean indicating whether there is\n * a participant in the current call which shares their screen.\n */\nexport const useHasOngoingScreenShare = (): boolean => {\n const { hasOngoingScreenShare$ } = useCallState();\n return useObservableValue(hasOngoingScreenShare$);\n};\n\n/**\n * Utility hook which provides the latest stats report of the current call.\n *\n * The latest stats report of the current call.\n * When stats gathering is enabled, this observable will emit a new value\n * at a regular (configurable) interval.\n *\n * Consumers of this observable can implement their own batching logic\n * in case they want to show historical stats data.\n */\nexport const useCallStatsReport = (): CallStatsReport | undefined => {\n const { callStatsReport$ } = useCallState();\n return useObservableValue(callStatsReport$);\n};\n\n/**\n * Utility hook which provides the dominant speaker of the current call.\n */\nexport const useDominantSpeaker = (): StreamVideoParticipant | undefined => {\n const { dominantSpeaker$ } = useCallState();\n return useObservableValue(dominantSpeaker$);\n};\n\n/**\n * Utility hook which provides a list of call members.\n */\nexport const useCallMembers = (): MemberResponse[] => {\n const { members$ } = useCallState();\n return useObservableValue(members$);\n};\n\n/**\n * Utility hook providing the current calling state of the call. For example, `RINGING` or `JOINED`.\n */\nexport const useCallCallingState = () => {\n const { callingState$ } = useCallState();\n return useObservableValue(callingState$);\n};\n\n/**\n * Utility hook providing the actual start time of the current session.\n * Useful for calculating the call duration.\n */\nexport const useCallStartedAt = () => {\n const { startedAt$ } = useCallState();\n return useObservableValue(startedAt$);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n *\n * @param options.sortBy - A comparator function to sort the participants by.\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\nexport const useParticipants = ({\n sortBy,\n}: {\n /**\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\n sortBy?: Comparator<StreamVideoParticipant>;\n} = {}) => {\n const { participants$ } = useCallState();\n const participants = useObservableValue(participants$);\n\n return useMemo(() => {\n if (sortBy) {\n return [...participants].sort(sortBy);\n }\n return participants;\n }, [participants, sortBy]);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n * Unlike `useParticipants`, it returns a more stable reference that is not affected\n * by participant sort settings.\n *\n * @category Call State\n */\nexport const useRawParticipants = () => {\n const { rawParticipants$ } = useCallState();\n return useObservableValue(rawParticipants$);\n};\n\n/**\n * A hook which provides a StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n */\nexport const useLocalParticipant = () => {\n const { localParticipant$ } = useCallState();\n return useObservableValue(localParticipant$);\n};\n\n/**\n * A hook which provides a list of all other participants than me that have joined an active call.\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\n};\n\n/**\n * A hook which provides a list of participants that are currently pinned.\n */\nexport const usePinnedParticipants = () => {\n const { pinnedParticipants$ } = useCallState();\n return useObservableValue(pinnedParticipants$);\n};\n\n/**\n * Returns the approximate participant count of the active call.\n * This includes the anonymous users as well, and it is computed on the server.\n */\nexport const useParticipantCount = () => {\n const { participantCount$ } = useCallState();\n return useObservableValue(participantCount$);\n};\n\n/**\n * Returns the approximate anonymous participant count of the active call.\n * The regular participants are not included in this count. It is computed on the server.\n */\nexport const useAnonymousParticipantCount = () => {\n const { anonymousParticipantCount$ } = useCallState();\n return useObservableValue(anonymousParticipantCount$);\n};\n\n/**\n * Returns the generated thumbnail of the current call, if enabled in settings.\n */\nexport const useCallThumbnail = () => {\n const { thumbnails$ } = useCallState();\n return useObservableValue(thumbnails$);\n};\n\n/**\n * A hook which returns the local participant's own capabilities.\n */\nexport const useOwnCapabilities = (): OwnCapability[] | undefined => {\n const { ownCapabilities$ } = useCallState();\n return useObservableValue(ownCapabilities$);\n};\n\n/**\n * Hook that returns true if the local participant has all the given permissions.\n *\n * @param permissions the permissions to check.\n */\nexport const useHasPermissions = (...permissions: OwnCapability[]): boolean => {\n const capabilities = useOwnCapabilities();\n return permissions.every((permission) => capabilities?.includes(permission));\n};\n\n/**\n * Returns the camera state of the current call.\n */\nexport const useCameraState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { camera } = call as Call;\n\n const { state } = camera;\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(camera);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n\n return {\n camera,\n direction,\n mediaStream,\n get devices() {\n return getDevices();\n },\n hasBrowserPermission,\n isPromptingPermission,\n selectedDevice,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n */\nexport const useMicrophoneState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const { state } = microphone;\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(microphone);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n const audioBitrateProfile = useObservableValue(state.audioBitrateProfile$);\n\n return {\n microphone,\n mediaStream,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n hasBrowserPermission,\n isPromptingPermission,\n isSpeakingWhileMuted,\n audioBitrateProfile,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n *\n * Note: This hook is not supported in React Native\n */\nexport const useSpeakerState = () => {\n if (isReactNative()) {\n throw new Error(\n 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/react-native/guides/camera-and-microphone/#speaker-management for more details',\n );\n }\n const call = useCall();\n const { speaker } = call as Call;\n\n const { getDevices } = useLazyDeviceList(speaker);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n const volume = useObservableValue(speaker.state.volume$);\n\n return {\n speaker,\n volume,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n isDeviceSelectionSupported: speaker.state.isDeviceSelectionSupported,\n };\n};\n\n/**\n * Returns the Screen Share state of the current call.\n */\nexport const useScreenShareState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { screenShare } = call as Call;\n const { state } = screenShare;\n return {\n screenShare,\n mediaStream: useObservableValue(state.mediaStream$),\n audioBitrateProfile: useObservableValue(state.audioBitrateProfile$),\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns incoming video settings for the current call, including\n * global and per-participant manual video quality overrides.\n */\nexport const useIncomingVideoSettings = () => {\n const call = useCall() as Call;\n return useObservableValue(call.dynascaleManager.incomingVideoSettings$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useCallClosedCaptions = (): CallClosedCaption[] => {\n const { closedCaptions$ } = useCallState();\n return useObservableValue(closedCaptions$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useIsCallCaptioningInProgress = (): boolean => {\n const { captioning$ } = useCallState();\n return useObservableValue(captioning$);\n};\n\nfunction getComputedStatus(\n status: InputDeviceStatus,\n pendingStatus: InputDeviceStatus,\n options: Required<UseInputMediaDeviceOptions>,\n) {\n const optimisticStatus = pendingStatus ?? status;\n\n return {\n status,\n optimisticStatus,\n isEnabled: status === 'enabled',\n isMute: status !== 'enabled',\n optimisticIsMute: optimisticStatus !== 'enabled',\n isTogglePending: optimisticStatus !== status,\n /**\n * If optimistic updates are enabled (`options.optimisticUpdates`), we\n * consider the optimistic status to determine whether the device is muted or not.\n * Otherwise, we rely on the actual status.\n */\n optionsAwareIsMute: options.optimisticUpdates\n ? optimisticStatus !== 'enabled'\n : status !== 'enabled',\n };\n}\n\ninterface DeviceManagerLike {\n listDevices(): Observable<MediaDeviceInfo[]>;\n}\n\nfunction useLazyDeviceList(manager: DeviceManagerLike) {\n const placeholderDevices$ = useMemo(() => of(EMPTY_DEVICES_ARRAY), []);\n const [devices$, setDevices$] = useState(placeholderDevices$);\n const devices = useObservableValue(devices$, EMPTY_DEVICES_ARRAY);\n\n const getDevices = () => {\n if (devices$ === placeholderDevices$) {\n setDevices$(manager.listDevices());\n }\n\n return devices ?? EMPTY_DEVICES_ARRAY;\n };\n\n return { getDevices };\n}\n","import { useCallback, useLayoutEffect, useRef } from 'react';\n\nfunction useEffectEventShim<T extends (...args: any[]) => any>(\n cb: T,\n): (...funcArgs: Parameters<T>) => ReturnType<T> {\n const cbRef = useRef(cb);\n\n useLayoutEffect(() => {\n cbRef.current = cb;\n }, [cb]);\n\n return useCallback((...args: Parameters<T>) => {\n const callback = cbRef.current;\n return callback(...args);\n }, []);\n}\n\nexport const useEffectEvent = useEffectEventShim;\n","import { useStreamVideoClient } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook which provides access to client's state store.\n */\nexport const useStore = () => {\n const client = useStreamVideoClient();\n if (!client) {\n throw new Error(\n `StreamVideoClient isn't initialized or this hook is called outside of <StreamVideo> context.`,\n );\n }\n return client.state;\n};\n\n/**\n * Utility hook which provides a list of all notifications about created calls.\n * In the ring call settings, these calls can be outgoing (I have called somebody)\n * or incoming (somebody has called me).\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import { useCallback, useEffect, useState } from 'react';\nimport { useCall } from '../contexts';\nimport { useIsCallRecordingInProgress } from './callStateHooks';\n\n/**\n * Custom hook for toggling call recording in a video call.\n *\n * This hook provides functionality to start and stop call recording,\n * along with state management for tracking the recording status\n * and the loading indicator while awaiting a response.\n */\nexport const useToggleCallRecording = () => {\n const call = useCall();\n const isCallRecordingInProgress = useIsCallRecordingInProgress();\n const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);\n\n // TODO: add permissions\n\n useEffect(() => {\n // we wait until call.recording_started/stopped event to flips the\n // `isCallRecordingInProgress` state variable.\n // Once the flip happens, we remove the loading indicator\n setIsAwaitingResponse((isAwaiting) => {\n if (isAwaiting) return false;\n return isAwaiting;\n });\n }, [isCallRecordingInProgress]);\n\n const toggleCallRecording = useCallback(async () => {\n try {\n setIsAwaitingResponse(true);\n if (isCallRecordingInProgress) {\n await call?.stopRecording();\n } else {\n await call?.startRecording();\n }\n } catch (e) {\n console.error(`Failed start recording`, e);\n throw e;\n }\n }, [call, isCallRecordingInProgress]);\n\n return { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress };\n};\n","import * as CallStateHooks from './callStateHooks';\nexport * from './useEffectEvent';\nexport * from './useObservableValue';\n\nexport * from './store';\nexport * from './callUtilHooks';\n\nexport type { UseInputMediaDeviceOptions } from './callStateHooks';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n */\nexport const useCallStateHooks = () => CallStateHooks;\n","import { OwnCapability } from '@stream-io/video-client';\n\nimport { PropsWithChildren } from 'react';\nimport { useCall } from '../contexts';\nimport { useCallStateHooks } from '../hooks';\n\ntype RestrictedProps = PropsWithChildren<{\n /**\n * Required grants for the component to be able to render supplied children elements\n */\n requiredGrants: OwnCapability[];\n /**\n * Render children only if user can request capability, but does not have it\n */\n canRequestOnly?: boolean;\n /**\n * Render children only if user has capability\n */\n hasPermissionsOnly?: boolean;\n /**\n * Require all grants specified in `requiredGrants` to be available in the `availableGrants`,\n * component by default requires only one grant to appear in both arrays to render its children\n */\n requireAll?: boolean;\n}>;\n\nexport const Restricted = ({\n canRequestOnly,\n hasPermissionsOnly,\n requiredGrants,\n requireAll = true,\n children,\n}: RestrictedProps) => {\n const call = useCall();\n const { useCallSettings, useOwnCapabilities } = useCallStateHooks();\n const ownCapabilities = useOwnCapabilities();\n const settings = useCallSettings();\n const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](\n (capability) => ownCapabilities?.includes(capability),\n );\n\n if (hasPermissionsOnly) return hasPermissions ? <>{children}</> : null;\n\n const canRequest = requiredGrants.some((capability) =>\n call?.permissionsContext.canRequest(capability, settings),\n );\n\n if (canRequestOnly) return canRequest ? <>{children}</> : null;\n\n if (hasPermissions || canRequest) return <>{children}</>;\n\n return null;\n};\n"],"names":["createContext","_jsx","useContext","useState","useEffect","useMemo","RxUtils","CallState","of","useRef","useLayoutEffect","useCallback","_Fragment"],"mappings":";;;;;;;;AAGA,MAAM,iBAAiB,GAAGA,mBAAa,CAAmB,SAAS,CAAC;AAYpE;;AAEG;AACI,MAAM,kBAAkB,GAAG,CAChC,KAAiD,KAC/C;AACF,IAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK;AAChC,IAAA,QACEC,cAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACpC,QAAQ,EAAA,CACkB;AAEjC;AAEA;;AAEG;AACI,MAAM,OAAO,GAAG,MAAK;AAC1B,IAAA,OAAOC,gBAAU,CAAC,iBAAiB,CAAC;AACtC;;AC1BA,MAAM,aAAa,GAAG,CAAC,eAAgC,EAAE,SAAiB,KACxE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,KAAI;IAClE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,GAAG,YAAY,EAAE;AACxC,IAAA,OAAO,GAAG;AACZ,CAAC,EA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IAAI,UAAU;QAAE,OAAOX,cAAA,CAAAW,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AAExD,IAAA,OAAO,IAAI;AACb;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext, useContext, useState, useEffect, useMemo,
|
|
2
|
+
import { createContext, useContext, useState, useEffect, useMemo, useRef, useLayoutEffect, useCallback } from 'react';
|
|
3
3
|
import i18next from 'i18next';
|
|
4
4
|
import { RxUtils, CallState } from '@stream-io/video-client';
|
|
5
5
|
import { of } from 'rxjs';
|
|
6
|
-
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
7
6
|
|
|
8
7
|
const StreamCallContext = createContext(undefined);
|
|
9
8
|
/**
|
|
@@ -124,25 +123,24 @@ const isReactNative = () => {
|
|
|
124
123
|
* @param defaultValue a default value. Used when the observable data can't be read or emits an error - must be stable.
|
|
125
124
|
*/
|
|
126
125
|
const useObservableValue = (observable$, defaultValue) => {
|
|
127
|
-
const
|
|
126
|
+
const [value, setValue] = useState(() => {
|
|
128
127
|
try {
|
|
129
128
|
return RxUtils.getCurrentValue(observable$);
|
|
130
129
|
}
|
|
131
|
-
catch (
|
|
130
|
+
catch (err) {
|
|
132
131
|
if (typeof defaultValue === 'undefined')
|
|
133
|
-
throw
|
|
132
|
+
throw err;
|
|
134
133
|
return defaultValue;
|
|
135
134
|
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
console.log('An error occurred while reading an observable',
|
|
135
|
+
});
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
return RxUtils.createSubscription(observable$, setValue, (err) => {
|
|
138
|
+
console.log('An error occurred while reading an observable', err);
|
|
140
139
|
if (defaultValue)
|
|
141
|
-
|
|
140
|
+
setValue(defaultValue);
|
|
142
141
|
});
|
|
143
|
-
return unsubscribe;
|
|
144
142
|
}, [defaultValue, observable$]);
|
|
145
|
-
return
|
|
143
|
+
return value;
|
|
146
144
|
};
|
|
147
145
|
|
|
148
146
|
// kind-of memoized, used as a default value
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/helpers/platforms.ts","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/useEffectEvent.ts","../../src/hooks/store.ts","../../src/hooks/callUtilHooks.ts","../../src/hooks/index.ts","../../src/wrappers/Restricted.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useContext } from 'react';\nimport { Call } from '@stream-io/video-client';\n\nconst StreamCallContext = createContext<Call | undefined>(undefined);\n\n/**\n * The props for the StreamCallProvider component.\n */\nexport interface StreamCallProviderProps {\n /**\n * The call instance to provide to the component tree.\n */\n call?: Call;\n}\n\n/**\n * A provider for the call object.\n */\nexport const StreamCallProvider = (\n props: PropsWithChildren<StreamCallProviderProps>,\n) => {\n const { call, children } = props;\n return (\n <StreamCallContext.Provider value={call}>\n {children}\n </StreamCallContext.Provider>\n );\n};\n\n/**\n * A hook to get the call object from the closest provider.\n */\nexport const useCall = () => {\n return useContext(StreamCallContext);\n};\n","import i18next from 'i18next';\nimport {\n TranslationLanguage,\n TranslationsMap,\n TranslationsRegistry,\n TranslatorFunction,\n} from './types';\n\nconst mapToRegistry = (translationsMap: TranslationsMap, namespace: string) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n\nexport const defaultTranslationFunction = (key: string) => key;\n\nexport type StreamI18nConstructor = {\n /** Language into which the provided strings are translated */\n currentLanguage?: TranslationLanguage;\n /** Fallback language which will be used if no translation is found for current language */\n fallbackLanguage?: TranslationLanguage;\n /** Logs info level to console output. Helps find issues with loading not working. */\n debug?: boolean;\n /** Custom translations that will be merged with the defaults provided by the library. */\n translationsOverrides?: TranslationsMap;\n};\n\nexport class StreamI18n {\n /** Exposed i18n instance from the i18next library */\n i18nInstance;\n /** Translator function that converts the provided string into its equivalent in the current language. */\n t: TranslatorFunction = defaultTranslationFunction;\n\n constructor({\n debug = false,\n currentLanguage = 'en',\n fallbackLanguage,\n translationsOverrides = { en: {} },\n }: StreamI18nConstructor = {}) {\n const ns = 'stream-video';\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: ns,\n fallbackLng: fallbackLanguage,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: defaultTranslationFunction,\n resources: mapToRegistry(translationsOverrides, ns),\n });\n }\n\n get currentLanguage() {\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n this.t = await this.i18nInstance.init();\n return this.t;\n };\n\n changeLanguage = async (language?: TranslationLanguage) => {\n this.t = await this.i18nInstance.changeLanguage(language);\n return this.t;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\n TranslationLanguage,\n TranslationsMap,\n} from '../i18n';\n\ntype StreamI18nContextValue = {\n t: StreamI18n['t'];\n i18n?: StreamI18n;\n};\n\nconst StreamI18nContext = createContext<StreamI18nContextValue>({\n t: defaultTranslationFunction,\n});\n\ntype CreateI18nParams = {\n i18nInstance?: StreamI18n;\n language?: TranslationLanguage;\n fallbackLanguage?: TranslationLanguage;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const api = useCreateI18n(createI18nParams);\n return (\n <StreamI18nContext.Provider value={api}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nconst useCreateI18n = ({\n i18nInstance,\n language,\n fallbackLanguage,\n translationsOverrides,\n}: CreateI18nParams) => {\n const [i18n] = useState(\n () =>\n i18nInstance ||\n new StreamI18n({\n currentLanguage: language,\n fallbackLanguage,\n translationsOverrides,\n }),\n );\n const [t, setTranslationFn] = useState<StreamI18n['t']>(() => i18n.t);\n useEffect(() => {\n if (!i18n.isInitialized) {\n i18n.init().then(() => setTranslationFn(() => i18n.t));\n } else if (i18n.currentLanguage !== language) {\n i18n.changeLanguage(language).then(() => setTranslationFn(() => i18n.t));\n }\n }, [i18n, language]);\n\n return useMemo(() => ({ i18n, t }), [i18n, t]);\n};\n\n/**\n * A hook to get the i18n instance and translation function from the closest provider.\n *\n * Example usage:\n * const { t, i18n } = useI18n();\n * const message = t('hello_world');\n * console.log(message);\n */\nexport const useI18n = () => useContext(StreamI18nContext);\n","import { createContext, PropsWithChildren, useContext } from 'react';\nimport { StreamVideoClient } from '@stream-io/video-client';\nimport {\n StreamI18nProvider,\n StreamI18nProviderProps,\n} from './StreamI18nContext';\n\nconst StreamVideoContext = createContext<StreamVideoClient | undefined>(\n undefined,\n);\n\n/**\n * The props for the StreamVideoProvider component.\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\n /**\n * The client instance to provide to the component tree.\n */\n client: StreamVideoClient;\n};\n\n/**\n * StreamVideo is a provider component which should be used to wrap the entire application.\n * It provides the client object to all children components and initializes the i18n instance.\n */\nexport const StreamVideoProvider = ({\n children,\n client,\n i18nInstance,\n language,\n translationsOverrides,\n}: PropsWithChildren<StreamVideoProps>) => {\n return (\n <StreamVideoContext.Provider value={client}>\n <StreamI18nProvider\n i18nInstance={i18nInstance}\n language={language}\n translationsOverrides={translationsOverrides}\n >\n {children}\n </StreamI18nProvider>\n </StreamVideoContext.Provider>\n );\n};\n\n/**\n * Hook to access the nearest StreamVideo client instance.\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\n};\n","/**\n * Checks whether we are using React Native\n */\nexport const isReactNative = () => {\n if (typeof navigator === 'undefined') return false;\n return navigator.product?.toLowerCase() === 'reactnative';\n};\n","import type { Observable } from 'rxjs';\nimport { useCallback } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { RxUtils } from '@stream-io/video-client';\n\n/**\n * Utility hook which provides the current value of the given observable.\n *\n * @param observable$ the observable to read data from.\n * @param defaultValue a default value. Used when the observable data can't be read or emits an error - must be stable.\n */\nexport const useObservableValue = <T>(\n observable$: Observable<T>,\n defaultValue?: T,\n) => {\n const getSnapshot = useCallback(() => {\n try {\n return RxUtils.getCurrentValue(observable$);\n } catch (error) {\n if (typeof defaultValue === 'undefined') throw error;\n return defaultValue;\n }\n }, [defaultValue, observable$]);\n\n const subscribe = useCallback(\n (onStoreChange: (v: T) => void) => {\n const unsubscribe = RxUtils.createSubscription(\n observable$,\n onStoreChange,\n (error) => {\n console.log('An error occurred while reading an observable', error);\n\n if (defaultValue) onStoreChange(defaultValue);\n },\n );\n\n return unsubscribe;\n },\n [defaultValue, observable$],\n );\n\n return useSyncExternalStore(subscribe, getSnapshot);\n};\n","import {\n Call,\n CallClosedCaption,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n InputDeviceStatus,\n MemberResponse,\n OwnCapability,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useMemo, useState } from 'react';\nimport { Observable, of } from 'rxjs';\nimport { useCall } from '../contexts';\nimport { isReactNative } from '../helpers/platforms';\nimport { useObservableValue } from './useObservableValue';\n\n// kind-of memoized, used as a default value\nconst EMPTY_DEVICES_ARRAY = Object.freeze<MediaDeviceInfo[]>(\n [],\n) as MediaDeviceInfo[];\n\nexport type UseInputMediaDeviceOptions = {\n /**\n * If `true`, the hook will use the optimistic status to determine whether the device is muted or not.\n */\n optimisticUpdates?: boolean;\n};\n\n/**\n * Utility hook, which provides the current call's state.\n */\nexport const useCallState = () => {\n const call = useCall();\n // return an empty and unlinked CallState object if there is no call in the provider\n // this ensures that the hooks always return a value and many null checks can be avoided\n if (!call) {\n const message =\n 'You are using useCallState() outside a Call context. ' +\n 'Please wrap your component in <StreamCall /> and provide a \"call\" instance.';\n console.warn(message);\n return new CallState();\n }\n return call.state;\n};\n\n/**\n * Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.\n */\nexport const useIsCallRecordingInProgress = (): boolean => {\n const { recording$ } = useCallState();\n return useObservableValue(recording$);\n};\n\n/**\n * Utility hook which provides information whether the current call is broadcasting.\n */\nexport const useIsCallHLSBroadcastingInProgress = (): boolean => {\n const { egress$ } = useCallState();\n const egress = useObservableValue(egress$);\n if (!egress) return false;\n return egress.broadcasting;\n};\n\n/**\n * Utility hook which provides information whether the current call is live.\n */\nexport const useIsCallLive = (): boolean => {\n const { backstage$ } = useCallState();\n const isBackstageOn = useObservableValue(backstage$);\n return !isBackstageOn;\n};\n\n/**\n * Returns the list of blocked users in the current call.\n */\nexport const useCallBlockedUserIds = (): string[] => {\n const { blockedUserIds$ } = useCallState();\n return useObservableValue(blockedUserIds$);\n};\n\n/**\n * Returns the timestamp when this call was created.\n */\nexport const useCallCreatedAt = (): Date | undefined => {\n const { createdAt$ } = useCallState();\n return useObservableValue(createdAt$);\n};\n\n/**\n * Returns the timestamp when this call was ended.\n */\nexport const useCallEndedAt = (): Date | undefined => {\n const { endedAt$ } = useCallState();\n return useObservableValue(endedAt$);\n};\n\n/**\n * Returns the timestamp telling when the call is scheduled to start.\n */\nexport const useCallStartsAt = (): Date | undefined => {\n const { startsAt$ } = useCallState();\n return useObservableValue(startsAt$);\n};\n\n/**\n * Returns the timestamp when this call was updated.\n */\nexport const useCallUpdatedAt = (): Date | undefined => {\n const { updatedAt$ } = useCallState();\n return useObservableValue(updatedAt$);\n};\n\n/**\n * Returns the information about the call's creator.\n */\nexport const useCallCreatedBy = (): UserResponse | undefined => {\n const { createdBy$ } = useCallState();\n return useObservableValue(createdBy$);\n};\n\n/**\n * Returns the call's custom data.\n */\nexport const useCallCustomData = (): Record<string, any> => {\n const { custom$ } = useCallState();\n return useObservableValue(custom$);\n};\n\n/**\n * Returns the call's Egress information.\n */\nexport const useCallEgress = (): EgressResponse | undefined => {\n const { egress$ } = useCallState();\n return useObservableValue(egress$);\n};\n\n/**\n * Returns the call's Ingress information.\n */\nexport const useCallIngress = (): CallIngressResponse | undefined => {\n const { ingress$ } = useCallState();\n return useObservableValue(ingress$);\n};\n\n/**\n * Returns the data for the current call session.\n */\nexport const useCallSession = (): CallSessionResponse | undefined => {\n const { session$ } = useCallState();\n return useObservableValue(session$);\n};\n\n/**\n * Returns the call's settings.\n */\nexport const useCallSettings = (): CallSettingsResponse | undefined => {\n const { settings$ } = useCallState();\n return useObservableValue(settings$);\n};\n\n/**\n * Returns whether the call has transcribing enabled.\n */\nexport const useIsCallTranscribingInProgress = (): boolean => {\n const { transcribing$ } = useCallState();\n return useObservableValue(transcribing$);\n};\n\n/**\n * Returns information about the user who has marked this call as ended.\n */\nexport const useCallEndedBy = (): UserResponse | undefined => {\n const { endedBy$ } = useCallState();\n return useObservableValue(endedBy$);\n};\n\n/**\n * Utility hook which provides a boolean indicating whether there is\n * a participant in the current call which shares their screen.\n */\nexport const useHasOngoingScreenShare = (): boolean => {\n const { hasOngoingScreenShare$ } = useCallState();\n return useObservableValue(hasOngoingScreenShare$);\n};\n\n/**\n * Utility hook which provides the latest stats report of the current call.\n *\n * The latest stats report of the current call.\n * When stats gathering is enabled, this observable will emit a new value\n * at a regular (configurable) interval.\n *\n * Consumers of this observable can implement their own batching logic\n * in case they want to show historical stats data.\n */\nexport const useCallStatsReport = (): CallStatsReport | undefined => {\n const { callStatsReport$ } = useCallState();\n return useObservableValue(callStatsReport$);\n};\n\n/**\n * Utility hook which provides the dominant speaker of the current call.\n */\nexport const useDominantSpeaker = (): StreamVideoParticipant | undefined => {\n const { dominantSpeaker$ } = useCallState();\n return useObservableValue(dominantSpeaker$);\n};\n\n/**\n * Utility hook which provides a list of call members.\n */\nexport const useCallMembers = (): MemberResponse[] => {\n const { members$ } = useCallState();\n return useObservableValue(members$);\n};\n\n/**\n * Utility hook providing the current calling state of the call. For example, `RINGING` or `JOINED`.\n */\nexport const useCallCallingState = () => {\n const { callingState$ } = useCallState();\n return useObservableValue(callingState$);\n};\n\n/**\n * Utility hook providing the actual start time of the current session.\n * Useful for calculating the call duration.\n */\nexport const useCallStartedAt = () => {\n const { startedAt$ } = useCallState();\n return useObservableValue(startedAt$);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n *\n * @param options.sortBy - A comparator function to sort the participants by.\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\nexport const useParticipants = ({\n sortBy,\n}: {\n /**\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\n sortBy?: Comparator<StreamVideoParticipant>;\n} = {}) => {\n const { participants$ } = useCallState();\n const participants = useObservableValue(participants$);\n\n return useMemo(() => {\n if (sortBy) {\n return [...participants].sort(sortBy);\n }\n return participants;\n }, [participants, sortBy]);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n * Unlike `useParticipants`, it returns a more stable reference that is not affected\n * by participant sort settings.\n *\n * @category Call State\n */\nexport const useRawParticipants = () => {\n const { rawParticipants$ } = useCallState();\n return useObservableValue(rawParticipants$);\n};\n\n/**\n * A hook which provides a StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n */\nexport const useLocalParticipant = () => {\n const { localParticipant$ } = useCallState();\n return useObservableValue(localParticipant$);\n};\n\n/**\n * A hook which provides a list of all other participants than me that have joined an active call.\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\n};\n\n/**\n * A hook which provides a list of participants that are currently pinned.\n */\nexport const usePinnedParticipants = () => {\n const { pinnedParticipants$ } = useCallState();\n return useObservableValue(pinnedParticipants$);\n};\n\n/**\n * Returns the approximate participant count of the active call.\n * This includes the anonymous users as well, and it is computed on the server.\n */\nexport const useParticipantCount = () => {\n const { participantCount$ } = useCallState();\n return useObservableValue(participantCount$);\n};\n\n/**\n * Returns the approximate anonymous participant count of the active call.\n * The regular participants are not included in this count. It is computed on the server.\n */\nexport const useAnonymousParticipantCount = () => {\n const { anonymousParticipantCount$ } = useCallState();\n return useObservableValue(anonymousParticipantCount$);\n};\n\n/**\n * Returns the generated thumbnail of the current call, if enabled in settings.\n */\nexport const useCallThumbnail = () => {\n const { thumbnails$ } = useCallState();\n return useObservableValue(thumbnails$);\n};\n\n/**\n * A hook which returns the local participant's own capabilities.\n */\nexport const useOwnCapabilities = (): OwnCapability[] | undefined => {\n const { ownCapabilities$ } = useCallState();\n return useObservableValue(ownCapabilities$);\n};\n\n/**\n * Hook that returns true if the local participant has all the given permissions.\n *\n * @param permissions the permissions to check.\n */\nexport const useHasPermissions = (...permissions: OwnCapability[]): boolean => {\n const capabilities = useOwnCapabilities();\n return permissions.every((permission) => capabilities?.includes(permission));\n};\n\n/**\n * Returns the camera state of the current call.\n */\nexport const useCameraState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { camera } = call as Call;\n\n const { state } = camera;\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(camera);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n\n return {\n camera,\n direction,\n mediaStream,\n get devices() {\n return getDevices();\n },\n hasBrowserPermission,\n isPromptingPermission,\n selectedDevice,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n */\nexport const useMicrophoneState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const { state } = microphone;\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(microphone);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n const audioBitrateProfile = useObservableValue(state.audioBitrateProfile$);\n\n return {\n microphone,\n mediaStream,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n hasBrowserPermission,\n isPromptingPermission,\n isSpeakingWhileMuted,\n audioBitrateProfile,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n *\n * Note: This hook is not supported in React Native\n */\nexport const useSpeakerState = () => {\n if (isReactNative()) {\n throw new Error(\n 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/react-native/guides/camera-and-microphone/#speaker-management for more details',\n );\n }\n const call = useCall();\n const { speaker } = call as Call;\n\n const { getDevices } = useLazyDeviceList(speaker);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n const volume = useObservableValue(speaker.state.volume$);\n\n return {\n speaker,\n volume,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n isDeviceSelectionSupported: speaker.state.isDeviceSelectionSupported,\n };\n};\n\n/**\n * Returns the Screen Share state of the current call.\n */\nexport const useScreenShareState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { screenShare } = call as Call;\n const { state } = screenShare;\n return {\n screenShare,\n mediaStream: useObservableValue(state.mediaStream$),\n audioBitrateProfile: useObservableValue(state.audioBitrateProfile$),\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns incoming video settings for the current call, including\n * global and per-participant manual video quality overrides.\n */\nexport const useIncomingVideoSettings = () => {\n const call = useCall() as Call;\n return useObservableValue(call.dynascaleManager.incomingVideoSettings$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useCallClosedCaptions = (): CallClosedCaption[] => {\n const { closedCaptions$ } = useCallState();\n return useObservableValue(closedCaptions$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useIsCallCaptioningInProgress = (): boolean => {\n const { captioning$ } = useCallState();\n return useObservableValue(captioning$);\n};\n\nfunction getComputedStatus(\n status: InputDeviceStatus,\n pendingStatus: InputDeviceStatus,\n options: Required<UseInputMediaDeviceOptions>,\n) {\n const optimisticStatus = pendingStatus ?? status;\n\n return {\n status,\n optimisticStatus,\n isEnabled: status === 'enabled',\n isMute: status !== 'enabled',\n optimisticIsMute: optimisticStatus !== 'enabled',\n isTogglePending: optimisticStatus !== status,\n /**\n * If optimistic updates are enabled (`options.optimisticUpdates`), we\n * consider the optimistic status to determine whether the device is muted or not.\n * Otherwise, we rely on the actual status.\n */\n optionsAwareIsMute: options.optimisticUpdates\n ? optimisticStatus !== 'enabled'\n : status !== 'enabled',\n };\n}\n\ninterface DeviceManagerLike {\n listDevices(): Observable<MediaDeviceInfo[]>;\n}\n\nfunction useLazyDeviceList(manager: DeviceManagerLike) {\n const placeholderDevices$ = useMemo(() => of(EMPTY_DEVICES_ARRAY), []);\n const [devices$, setDevices$] = useState(placeholderDevices$);\n const devices = useObservableValue(devices$, EMPTY_DEVICES_ARRAY);\n\n const getDevices = () => {\n if (devices$ === placeholderDevices$) {\n setDevices$(manager.listDevices());\n }\n\n return devices ?? EMPTY_DEVICES_ARRAY;\n };\n\n return { getDevices };\n}\n","import { useCallback, useLayoutEffect, useRef } from 'react';\n\nfunction useEffectEventShim<T extends (...args: any[]) => any>(\n cb: T,\n): (...funcArgs: Parameters<T>) => ReturnType<T> {\n const cbRef = useRef(cb);\n\n useLayoutEffect(() => {\n cbRef.current = cb;\n }, [cb]);\n\n return useCallback((...args: Parameters<T>) => {\n const callback = cbRef.current;\n return callback(...args);\n }, []);\n}\n\nexport const useEffectEvent = useEffectEventShim;\n","import { useStreamVideoClient } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook which provides access to client's state store.\n */\nexport const useStore = () => {\n const client = useStreamVideoClient();\n if (!client) {\n throw new Error(\n `StreamVideoClient isn't initialized or this hook is called outside of <StreamVideo> context.`,\n );\n }\n return client.state;\n};\n\n/**\n * Utility hook which provides a list of all notifications about created calls.\n * In the ring call settings, these calls can be outgoing (I have called somebody)\n * or incoming (somebody has called me).\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import { useCallback, useEffect, useState } from 'react';\nimport { useCall } from '../contexts';\nimport { useIsCallRecordingInProgress } from './callStateHooks';\n\n/**\n * Custom hook for toggling call recording in a video call.\n *\n * This hook provides functionality to start and stop call recording,\n * along with state management for tracking the recording status\n * and the loading indicator while awaiting a response.\n */\nexport const useToggleCallRecording = () => {\n const call = useCall();\n const isCallRecordingInProgress = useIsCallRecordingInProgress();\n const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);\n\n // TODO: add permissions\n\n useEffect(() => {\n // we wait until call.recording_started/stopped event to flips the\n // `isCallRecordingInProgress` state variable.\n // Once the flip happens, we remove the loading indicator\n setIsAwaitingResponse((isAwaiting) => {\n if (isAwaiting) return false;\n return isAwaiting;\n });\n }, [isCallRecordingInProgress]);\n\n const toggleCallRecording = useCallback(async () => {\n try {\n setIsAwaitingResponse(true);\n if (isCallRecordingInProgress) {\n await call?.stopRecording();\n } else {\n await call?.startRecording();\n }\n } catch (e) {\n console.error(`Failed start recording`, e);\n throw e;\n }\n }, [call, isCallRecordingInProgress]);\n\n return { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress };\n};\n","import * as CallStateHooks from './callStateHooks';\nexport * from './useEffectEvent';\nexport * from './useObservableValue';\n\nexport * from './store';\nexport * from './callUtilHooks';\n\nexport type { UseInputMediaDeviceOptions } from './callStateHooks';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n */\nexport const useCallStateHooks = () => CallStateHooks;\n","import { OwnCapability } from '@stream-io/video-client';\n\nimport { PropsWithChildren } from 'react';\nimport { useCall } from '../contexts';\nimport { useCallStateHooks } from '../hooks';\n\ntype RestrictedProps = PropsWithChildren<{\n /**\n * Required grants for the component to be able to render supplied children elements\n */\n requiredGrants: OwnCapability[];\n /**\n * Render children only if user can request capability, but does not have it\n */\n canRequestOnly?: boolean;\n /**\n * Render children only if user has capability\n */\n hasPermissionsOnly?: boolean;\n /**\n * Require all grants specified in `requiredGrants` to be available in the `availableGrants`,\n * component by default requires only one grant to appear in both arrays to render its children\n */\n requireAll?: boolean;\n}>;\n\nexport const Restricted = ({\n canRequestOnly,\n hasPermissionsOnly,\n requiredGrants,\n requireAll = true,\n children,\n}: RestrictedProps) => {\n const call = useCall();\n const { useCallSettings, useOwnCapabilities } = useCallStateHooks();\n const ownCapabilities = useOwnCapabilities();\n const settings = useCallSettings();\n const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](\n (capability) => ownCapabilities?.includes(capability),\n );\n\n if (hasPermissionsOnly) return hasPermissions ? <>{children}</> : null;\n\n const canRequest = requiredGrants.some((capability) =>\n call?.permissionsContext.canRequest(capability, settings),\n );\n\n if (canRequestOnly) return canRequest ? <>{children}</> : null;\n\n if (hasPermissions || canRequest) return <>{children}</>;\n\n return null;\n};\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;;AAGA,MAAM,iBAAiB,GAAG,aAAa,CAAmB,SAAS,CAAC;AAYpE;;AAEG;AACI,MAAM,kBAAkB,GAAG,CAChC,KAAiD,KAC/C;AACF,IAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GA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AC5C,IAAA,MAAM,QAAQ,GAAG,eAAe,EAAE;IAClC,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC,CAClE,CAAC,UAAU,KAAK,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,CACtD;AAED,IAAA,IAAI,kBAAkB;QAAE,OAAO,cAAc,GAAGA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAEtE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,UAAU,KAChD,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAC1D;AAED,IAAA,IAAI,cAAc;QAAE,OAAO,UAAU,GAAGD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAE9D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAOD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AAExD,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/helpers/platforms.ts","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/useEffectEvent.ts","../../src/hooks/store.ts","../../src/hooks/callUtilHooks.ts","../../src/hooks/index.ts","../../src/wrappers/Restricted.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useContext } from 'react';\nimport { Call } from '@stream-io/video-client';\n\nconst StreamCallContext = createContext<Call | undefined>(undefined);\n\n/**\n * The props for the StreamCallProvider component.\n */\nexport interface StreamCallProviderProps {\n /**\n * The call instance to provide to the component tree.\n */\n call?: Call;\n}\n\n/**\n * A provider for the call object.\n */\nexport const StreamCallProvider = (\n props: PropsWithChildren<StreamCallProviderProps>,\n) => {\n const { call, children } = props;\n return (\n <StreamCallContext.Provider value={call}>\n {children}\n </StreamCallContext.Provider>\n );\n};\n\n/**\n * A hook to get the call object from the closest provider.\n */\nexport const useCall = () => {\n return useContext(StreamCallContext);\n};\n","import i18next from 'i18next';\nimport {\n TranslationLanguage,\n TranslationsMap,\n TranslationsRegistry,\n TranslatorFunction,\n} from './types';\n\nconst mapToRegistry = (translationsMap: TranslationsMap, namespace: string) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n\nexport const defaultTranslationFunction = (key: string) => key;\n\nexport type StreamI18nConstructor = {\n /** Language into which the provided strings are translated */\n currentLanguage?: TranslationLanguage;\n /** Fallback language which will be used if no translation is found for current language */\n fallbackLanguage?: TranslationLanguage;\n /** Logs info level to console output. Helps find issues with loading not working. */\n debug?: boolean;\n /** Custom translations that will be merged with the defaults provided by the library. */\n translationsOverrides?: TranslationsMap;\n};\n\nexport class StreamI18n {\n /** Exposed i18n instance from the i18next library */\n i18nInstance;\n /** Translator function that converts the provided string into its equivalent in the current language. */\n t: TranslatorFunction = defaultTranslationFunction;\n\n constructor({\n debug = false,\n currentLanguage = 'en',\n fallbackLanguage,\n translationsOverrides = { en: {} },\n }: StreamI18nConstructor = {}) {\n const ns = 'stream-video';\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: ns,\n fallbackLng: fallbackLanguage,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: defaultTranslationFunction,\n resources: mapToRegistry(translationsOverrides, ns),\n });\n }\n\n get currentLanguage() {\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n this.t = await this.i18nInstance.init();\n return this.t;\n };\n\n changeLanguage = async (language?: TranslationLanguage) => {\n this.t = await this.i18nInstance.changeLanguage(language);\n return this.t;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\n TranslationLanguage,\n TranslationsMap,\n} from '../i18n';\n\ntype StreamI18nContextValue = {\n t: StreamI18n['t'];\n i18n?: StreamI18n;\n};\n\nconst StreamI18nContext = createContext<StreamI18nContextValue>({\n t: defaultTranslationFunction,\n});\n\ntype CreateI18nParams = {\n i18nInstance?: StreamI18n;\n language?: TranslationLanguage;\n fallbackLanguage?: TranslationLanguage;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const api = useCreateI18n(createI18nParams);\n return (\n <StreamI18nContext.Provider value={api}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nconst useCreateI18n = ({\n i18nInstance,\n language,\n fallbackLanguage,\n translationsOverrides,\n}: CreateI18nParams) => {\n const [i18n] = useState(\n () =>\n i18nInstance ||\n new StreamI18n({\n currentLanguage: language,\n fallbackLanguage,\n translationsOverrides,\n }),\n );\n const [t, setTranslationFn] = useState<StreamI18n['t']>(() => i18n.t);\n useEffect(() => {\n if (!i18n.isInitialized) {\n i18n.init().then(() => setTranslationFn(() => i18n.t));\n } else if (i18n.currentLanguage !== language) {\n i18n.changeLanguage(language).then(() => setTranslationFn(() => i18n.t));\n }\n }, [i18n, language]);\n\n return useMemo(() => ({ i18n, t }), [i18n, t]);\n};\n\n/**\n * A hook to get the i18n instance and translation function from the closest provider.\n *\n * Example usage:\n * const { t, i18n } = useI18n();\n * const message = t('hello_world');\n * console.log(message);\n */\nexport const useI18n = () => useContext(StreamI18nContext);\n","import { createContext, PropsWithChildren, useContext } from 'react';\nimport { StreamVideoClient } from '@stream-io/video-client';\nimport {\n StreamI18nProvider,\n StreamI18nProviderProps,\n} from './StreamI18nContext';\n\nconst StreamVideoContext = createContext<StreamVideoClient | undefined>(\n undefined,\n);\n\n/**\n * The props for the StreamVideoProvider component.\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\n /**\n * The client instance to provide to the component tree.\n */\n client: StreamVideoClient;\n};\n\n/**\n * StreamVideo is a provider component which should be used to wrap the entire application.\n * It provides the client object to all children components and initializes the i18n instance.\n */\nexport const StreamVideoProvider = ({\n children,\n client,\n i18nInstance,\n language,\n translationsOverrides,\n}: PropsWithChildren<StreamVideoProps>) => {\n return (\n <StreamVideoContext.Provider value={client}>\n <StreamI18nProvider\n i18nInstance={i18nInstance}\n language={language}\n translationsOverrides={translationsOverrides}\n >\n {children}\n </StreamI18nProvider>\n </StreamVideoContext.Provider>\n );\n};\n\n/**\n * Hook to access the nearest StreamVideo client instance.\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\n};\n","/**\n * Checks whether we are using React Native\n */\nexport const isReactNative = () => {\n if (typeof navigator === 'undefined') return false;\n return navigator.product?.toLowerCase() === 'reactnative';\n};\n","import type { Observable } from 'rxjs';\nimport { useEffect, useState } from 'react';\nimport { RxUtils } from '@stream-io/video-client';\n\n/**\n * Utility hook which provides the current value of the given observable.\n *\n * @param observable$ the observable to read data from.\n * @param defaultValue a default value. Used when the observable data can't be read or emits an error - must be stable.\n */\nexport const useObservableValue = <T>(\n observable$: Observable<T>,\n defaultValue?: T,\n) => {\n const [value, setValue] = useState<T>(() => {\n try {\n return RxUtils.getCurrentValue(observable$);\n } catch (err) {\n if (typeof defaultValue === 'undefined') throw err;\n return defaultValue;\n }\n });\n\n useEffect(() => {\n return RxUtils.createSubscription(observable$, setValue, (err) => {\n console.log('An error occurred while reading an observable', err);\n if (defaultValue) setValue(defaultValue);\n });\n }, [defaultValue, observable$]);\n\n return value;\n};\n","import {\n Call,\n CallClosedCaption,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n InputDeviceStatus,\n MemberResponse,\n OwnCapability,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useMemo, useState } from 'react';\nimport { Observable, of } from 'rxjs';\nimport { useCall } from '../contexts';\nimport { isReactNative } from '../helpers/platforms';\nimport { useObservableValue } from './useObservableValue';\n\n// kind-of memoized, used as a default value\nconst EMPTY_DEVICES_ARRAY = Object.freeze<MediaDeviceInfo[]>(\n [],\n) as MediaDeviceInfo[];\n\nexport type UseInputMediaDeviceOptions = {\n /**\n * If `true`, the hook will use the optimistic status to determine whether the device is muted or not.\n */\n optimisticUpdates?: boolean;\n};\n\n/**\n * Utility hook, which provides the current call's state.\n */\nexport const useCallState = () => {\n const call = useCall();\n // return an empty and unlinked CallState object if there is no call in the provider\n // this ensures that the hooks always return a value and many null checks can be avoided\n if (!call) {\n const message =\n 'You are using useCallState() outside a Call context. ' +\n 'Please wrap your component in <StreamCall /> and provide a \"call\" instance.';\n console.warn(message);\n return new CallState();\n }\n return call.state;\n};\n\n/**\n * Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.\n */\nexport const useIsCallRecordingInProgress = (): boolean => {\n const { recording$ } = useCallState();\n return useObservableValue(recording$);\n};\n\n/**\n * Utility hook which provides information whether the current call is broadcasting.\n */\nexport const useIsCallHLSBroadcastingInProgress = (): boolean => {\n const { egress$ } = useCallState();\n const egress = useObservableValue(egress$);\n if (!egress) return false;\n return egress.broadcasting;\n};\n\n/**\n * Utility hook which provides information whether the current call is live.\n */\nexport const useIsCallLive = (): boolean => {\n const { backstage$ } = useCallState();\n const isBackstageOn = useObservableValue(backstage$);\n return !isBackstageOn;\n};\n\n/**\n * Returns the list of blocked users in the current call.\n */\nexport const useCallBlockedUserIds = (): string[] => {\n const { blockedUserIds$ } = useCallState();\n return useObservableValue(blockedUserIds$);\n};\n\n/**\n * Returns the timestamp when this call was created.\n */\nexport const useCallCreatedAt = (): Date | undefined => {\n const { createdAt$ } = useCallState();\n return useObservableValue(createdAt$);\n};\n\n/**\n * Returns the timestamp when this call was ended.\n */\nexport const useCallEndedAt = (): Date | undefined => {\n const { endedAt$ } = useCallState();\n return useObservableValue(endedAt$);\n};\n\n/**\n * Returns the timestamp telling when the call is scheduled to start.\n */\nexport const useCallStartsAt = (): Date | undefined => {\n const { startsAt$ } = useCallState();\n return useObservableValue(startsAt$);\n};\n\n/**\n * Returns the timestamp when this call was updated.\n */\nexport const useCallUpdatedAt = (): Date | undefined => {\n const { updatedAt$ } = useCallState();\n return useObservableValue(updatedAt$);\n};\n\n/**\n * Returns the information about the call's creator.\n */\nexport const useCallCreatedBy = (): UserResponse | undefined => {\n const { createdBy$ } = useCallState();\n return useObservableValue(createdBy$);\n};\n\n/**\n * Returns the call's custom data.\n */\nexport const useCallCustomData = (): Record<string, any> => {\n const { custom$ } = useCallState();\n return useObservableValue(custom$);\n};\n\n/**\n * Returns the call's Egress information.\n */\nexport const useCallEgress = (): EgressResponse | undefined => {\n const { egress$ } = useCallState();\n return useObservableValue(egress$);\n};\n\n/**\n * Returns the call's Ingress information.\n */\nexport const useCallIngress = (): CallIngressResponse | undefined => {\n const { ingress$ } = useCallState();\n return useObservableValue(ingress$);\n};\n\n/**\n * Returns the data for the current call session.\n */\nexport const useCallSession = (): CallSessionResponse | undefined => {\n const { session$ } = useCallState();\n return useObservableValue(session$);\n};\n\n/**\n * Returns the call's settings.\n */\nexport const useCallSettings = (): CallSettingsResponse | undefined => {\n const { settings$ } = useCallState();\n return useObservableValue(settings$);\n};\n\n/**\n * Returns whether the call has transcribing enabled.\n */\nexport const useIsCallTranscribingInProgress = (): boolean => {\n const { transcribing$ } = useCallState();\n return useObservableValue(transcribing$);\n};\n\n/**\n * Returns information about the user who has marked this call as ended.\n */\nexport const useCallEndedBy = (): UserResponse | undefined => {\n const { endedBy$ } = useCallState();\n return useObservableValue(endedBy$);\n};\n\n/**\n * Utility hook which provides a boolean indicating whether there is\n * a participant in the current call which shares their screen.\n */\nexport const useHasOngoingScreenShare = (): boolean => {\n const { hasOngoingScreenShare$ } = useCallState();\n return useObservableValue(hasOngoingScreenShare$);\n};\n\n/**\n * Utility hook which provides the latest stats report of the current call.\n *\n * The latest stats report of the current call.\n * When stats gathering is enabled, this observable will emit a new value\n * at a regular (configurable) interval.\n *\n * Consumers of this observable can implement their own batching logic\n * in case they want to show historical stats data.\n */\nexport const useCallStatsReport = (): CallStatsReport | undefined => {\n const { callStatsReport$ } = useCallState();\n return useObservableValue(callStatsReport$);\n};\n\n/**\n * Utility hook which provides the dominant speaker of the current call.\n */\nexport const useDominantSpeaker = (): StreamVideoParticipant | undefined => {\n const { dominantSpeaker$ } = useCallState();\n return useObservableValue(dominantSpeaker$);\n};\n\n/**\n * Utility hook which provides a list of call members.\n */\nexport const useCallMembers = (): MemberResponse[] => {\n const { members$ } = useCallState();\n return useObservableValue(members$);\n};\n\n/**\n * Utility hook providing the current calling state of the call. For example, `RINGING` or `JOINED`.\n */\nexport const useCallCallingState = () => {\n const { callingState$ } = useCallState();\n return useObservableValue(callingState$);\n};\n\n/**\n * Utility hook providing the actual start time of the current session.\n * Useful for calculating the call duration.\n */\nexport const useCallStartedAt = () => {\n const { startedAt$ } = useCallState();\n return useObservableValue(startedAt$);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n *\n * @param options.sortBy - A comparator function to sort the participants by.\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\nexport const useParticipants = ({\n sortBy,\n}: {\n /**\n * Make sure to memoize output of the `combineComparators` function\n * (or keep it out of component's scope if possible) before passing it down to this property.\n */\n sortBy?: Comparator<StreamVideoParticipant>;\n} = {}) => {\n const { participants$ } = useCallState();\n const participants = useObservableValue(participants$);\n\n return useMemo(() => {\n if (sortBy) {\n return [...participants].sort(sortBy);\n }\n return participants;\n }, [participants, sortBy]);\n};\n\n/**\n * A hook which provides a list of all participants that have joined an active call.\n * Unlike `useParticipants`, it returns a more stable reference that is not affected\n * by participant sort settings.\n *\n * @category Call State\n */\nexport const useRawParticipants = () => {\n const { rawParticipants$ } = useCallState();\n return useObservableValue(rawParticipants$);\n};\n\n/**\n * A hook which provides a StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n */\nexport const useLocalParticipant = () => {\n const { localParticipant$ } = useCallState();\n return useObservableValue(localParticipant$);\n};\n\n/**\n * A hook which provides a list of all other participants than me that have joined an active call.\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\n};\n\n/**\n * A hook which provides a list of participants that are currently pinned.\n */\nexport const usePinnedParticipants = () => {\n const { pinnedParticipants$ } = useCallState();\n return useObservableValue(pinnedParticipants$);\n};\n\n/**\n * Returns the approximate participant count of the active call.\n * This includes the anonymous users as well, and it is computed on the server.\n */\nexport const useParticipantCount = () => {\n const { participantCount$ } = useCallState();\n return useObservableValue(participantCount$);\n};\n\n/**\n * Returns the approximate anonymous participant count of the active call.\n * The regular participants are not included in this count. It is computed on the server.\n */\nexport const useAnonymousParticipantCount = () => {\n const { anonymousParticipantCount$ } = useCallState();\n return useObservableValue(anonymousParticipantCount$);\n};\n\n/**\n * Returns the generated thumbnail of the current call, if enabled in settings.\n */\nexport const useCallThumbnail = () => {\n const { thumbnails$ } = useCallState();\n return useObservableValue(thumbnails$);\n};\n\n/**\n * A hook which returns the local participant's own capabilities.\n */\nexport const useOwnCapabilities = (): OwnCapability[] | undefined => {\n const { ownCapabilities$ } = useCallState();\n return useObservableValue(ownCapabilities$);\n};\n\n/**\n * Hook that returns true if the local participant has all the given permissions.\n *\n * @param permissions the permissions to check.\n */\nexport const useHasPermissions = (...permissions: OwnCapability[]): boolean => {\n const capabilities = useOwnCapabilities();\n return permissions.every((permission) => capabilities?.includes(permission));\n};\n\n/**\n * Returns the camera state of the current call.\n */\nexport const useCameraState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { camera } = call as Call;\n\n const { state } = camera;\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(camera);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n\n return {\n camera,\n direction,\n mediaStream,\n get devices() {\n return getDevices();\n },\n hasBrowserPermission,\n isPromptingPermission,\n selectedDevice,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n */\nexport const useMicrophoneState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const { state } = microphone;\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const { getDevices } = useLazyDeviceList(microphone);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isPromptingPermission = useObservableValue(\n state.isPromptingPermission$,\n );\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n const audioBitrateProfile = useObservableValue(state.audioBitrateProfile$);\n\n return {\n microphone,\n mediaStream,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n hasBrowserPermission,\n isPromptingPermission,\n isSpeakingWhileMuted,\n audioBitrateProfile,\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n *\n * Note: This hook is not supported in React Native\n */\nexport const useSpeakerState = () => {\n if (isReactNative()) {\n throw new Error(\n 'This feature is not supported in React Native. Please visit https://getstream.io/video/docs/react-native/guides/camera-and-microphone/#speaker-management for more details',\n );\n }\n const call = useCall();\n const { speaker } = call as Call;\n\n const { getDevices } = useLazyDeviceList(speaker);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n const volume = useObservableValue(speaker.state.volume$);\n\n return {\n speaker,\n volume,\n get devices() {\n return getDevices();\n },\n selectedDevice,\n isDeviceSelectionSupported: speaker.state.isDeviceSelectionSupported,\n };\n};\n\n/**\n * Returns the Screen Share state of the current call.\n */\nexport const useScreenShareState = ({\n optimisticUpdates = true,\n}: UseInputMediaDeviceOptions = {}) => {\n const call = useCall();\n const { screenShare } = call as Call;\n const { state } = screenShare;\n return {\n screenShare,\n mediaStream: useObservableValue(state.mediaStream$),\n audioBitrateProfile: useObservableValue(state.audioBitrateProfile$),\n ...getComputedStatus(\n useObservableValue(state.status$),\n useObservableValue(state.optimisticStatus$),\n { optimisticUpdates },\n ),\n };\n};\n\n/**\n * Returns incoming video settings for the current call, including\n * global and per-participant manual video quality overrides.\n */\nexport const useIncomingVideoSettings = () => {\n const call = useCall() as Call;\n return useObservableValue(call.dynascaleManager.incomingVideoSettings$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useCallClosedCaptions = (): CallClosedCaption[] => {\n const { closedCaptions$ } = useCallState();\n return useObservableValue(closedCaptions$);\n};\n\n/**\n * Returns the current call's closed captions queue.\n */\nexport const useIsCallCaptioningInProgress = (): boolean => {\n const { captioning$ } = useCallState();\n return useObservableValue(captioning$);\n};\n\nfunction getComputedStatus(\n status: InputDeviceStatus,\n pendingStatus: InputDeviceStatus,\n options: Required<UseInputMediaDeviceOptions>,\n) {\n const optimisticStatus = pendingStatus ?? status;\n\n return {\n status,\n optimisticStatus,\n isEnabled: status === 'enabled',\n isMute: status !== 'enabled',\n optimisticIsMute: optimisticStatus !== 'enabled',\n isTogglePending: optimisticStatus !== status,\n /**\n * If optimistic updates are enabled (`options.optimisticUpdates`), we\n * consider the optimistic status to determine whether the device is muted or not.\n * Otherwise, we rely on the actual status.\n */\n optionsAwareIsMute: options.optimisticUpdates\n ? optimisticStatus !== 'enabled'\n : status !== 'enabled',\n };\n}\n\ninterface DeviceManagerLike {\n listDevices(): Observable<MediaDeviceInfo[]>;\n}\n\nfunction useLazyDeviceList(manager: DeviceManagerLike) {\n const placeholderDevices$ = useMemo(() => of(EMPTY_DEVICES_ARRAY), []);\n const [devices$, setDevices$] = useState(placeholderDevices$);\n const devices = useObservableValue(devices$, EMPTY_DEVICES_ARRAY);\n\n const getDevices = () => {\n if (devices$ === placeholderDevices$) {\n setDevices$(manager.listDevices());\n }\n\n return devices ?? EMPTY_DEVICES_ARRAY;\n };\n\n return { getDevices };\n}\n","import { useCallback, useLayoutEffect, useRef } from 'react';\n\nfunction useEffectEventShim<T extends (...args: any[]) => any>(\n cb: T,\n): (...funcArgs: Parameters<T>) => ReturnType<T> {\n const cbRef = useRef(cb);\n\n useLayoutEffect(() => {\n cbRef.current = cb;\n }, [cb]);\n\n return useCallback((...args: Parameters<T>) => {\n const callback = cbRef.current;\n return callback(...args);\n }, []);\n}\n\nexport const useEffectEvent = useEffectEventShim;\n","import { useStreamVideoClient } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook which provides access to client's state store.\n */\nexport const useStore = () => {\n const client = useStreamVideoClient();\n if (!client) {\n throw new Error(\n `StreamVideoClient isn't initialized or this hook is called outside of <StreamVideo> context.`,\n );\n }\n return client.state;\n};\n\n/**\n * Utility hook which provides a list of all notifications about created calls.\n * In the ring call settings, these calls can be outgoing (I have called somebody)\n * or incoming (somebody has called me).\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import { useCallback, useEffect, useState } from 'react';\nimport { useCall } from '../contexts';\nimport { useIsCallRecordingInProgress } from './callStateHooks';\n\n/**\n * Custom hook for toggling call recording in a video call.\n *\n * This hook provides functionality to start and stop call recording,\n * along with state management for tracking the recording status\n * and the loading indicator while awaiting a response.\n */\nexport const useToggleCallRecording = () => {\n const call = useCall();\n const isCallRecordingInProgress = useIsCallRecordingInProgress();\n const [isAwaitingResponse, setIsAwaitingResponse] = useState(false);\n\n // TODO: add permissions\n\n useEffect(() => {\n // we wait until call.recording_started/stopped event to flips the\n // `isCallRecordingInProgress` state variable.\n // Once the flip happens, we remove the loading indicator\n setIsAwaitingResponse((isAwaiting) => {\n if (isAwaiting) return false;\n return isAwaiting;\n });\n }, [isCallRecordingInProgress]);\n\n const toggleCallRecording = useCallback(async () => {\n try {\n setIsAwaitingResponse(true);\n if (isCallRecordingInProgress) {\n await call?.stopRecording();\n } else {\n await call?.startRecording();\n }\n } catch (e) {\n console.error(`Failed start recording`, e);\n throw e;\n }\n }, [call, isCallRecordingInProgress]);\n\n return { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress };\n};\n","import * as CallStateHooks from './callStateHooks';\nexport * from './useEffectEvent';\nexport * from './useObservableValue';\n\nexport * from './store';\nexport * from './callUtilHooks';\n\nexport type { UseInputMediaDeviceOptions } from './callStateHooks';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n */\nexport const useCallStateHooks = () => CallStateHooks;\n","import { OwnCapability } from '@stream-io/video-client';\n\nimport { PropsWithChildren } from 'react';\nimport { useCall } from '../contexts';\nimport { useCallStateHooks } from '../hooks';\n\ntype RestrictedProps = PropsWithChildren<{\n /**\n * Required grants for the component to be able to render supplied children elements\n */\n requiredGrants: OwnCapability[];\n /**\n * Render children only if user can request capability, but does not have it\n */\n canRequestOnly?: boolean;\n /**\n * Render children only if user has capability\n */\n hasPermissionsOnly?: boolean;\n /**\n * Require all grants specified in `requiredGrants` to be available in the `availableGrants`,\n * component by default requires only one grant to appear in both arrays to render its children\n */\n requireAll?: boolean;\n}>;\n\nexport const Restricted = ({\n canRequestOnly,\n hasPermissionsOnly,\n requiredGrants,\n requireAll = true,\n children,\n}: RestrictedProps) => {\n const call = useCall();\n const { useCallSettings, useOwnCapabilities } = useCallStateHooks();\n const ownCapabilities = useOwnCapabilities();\n const settings = useCallSettings();\n const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](\n (capability) => ownCapabilities?.includes(capability),\n );\n\n if (hasPermissionsOnly) return hasPermissions ? <>{children}</> : null;\n\n const canRequest = requiredGrants.some((capability) =>\n call?.permissionsContext.canRequest(capability, settings),\n );\n\n if (canRequestOnly) return canRequest ? <>{children}</> : null;\n\n if (hasPermissions || canRequest) return <>{children}</>;\n\n return null;\n};\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;AAGA,MAAM,iBAAiB,GAAG,aAAa,CAAmB,SAAS,CAAC;AAYpE;;AAEG;AACI,MAAM,kBAAkB,GAAG,CAChC,KAAiD,KAC/C;AACF,IAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK;AAChC,IAAA,QACEA,GAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACpC,QAAQ,EAAA,CACkB;AAEjC;AAEA;;AAEG;AACI,MAAM,OAAO,GAAG,MAAK;AAC1B,IAAA,OAAO,UAAU,CAAC,iBAAiB,CAAC;AACtC;;AC1BA,MAAM,aAAa,GAAG,CAAC,eAAgC,EAAE,SAAiB,KACxE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,KAAI;IAClE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,GAAG,YAAY,EAAE;AACxC,IAAA,OAAO,GAAG;AACZ,CAAC,EAAE,EAA0B,CAAC;AAEzB,MAAM,0BAA0B,GAAG,CAAC,GAAW,KAAK;MAa9C,UAAU,CAAA;AAMrB,IAAA,WAAA,CAAY,EACV,KAAK,GAAG,KAAK,EACb,eAAe,GAAG,IAAI,EACtB,gBAAgB,EAChB,qBAAqB,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,MACT,EAAE,EAAA;;QAP7B,IAAA,CAAA,CAAC,GAAuB,0BAA0B;QA8BlD,IAAA,CAAA,IAAI,GAAG,YAAW;YACh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,GAAG,MAAM;;ACchC,MAAM,UAAU,GAAG,CAAC,EACzB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,UAAU,GAAG,IAAI,EACjB,QAAQ,GACQ,KAAI;AACpB,IAAA,MAAM,IAAI,GAAG,OAAO,EAAE;IACtB,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,GAAG,iBAAiB,EAAE;AACnE,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAE;AAC5C,IAAA,MAAM,QAAQ,GAAG,eAAe,EAAE;IAClC,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC,CAClE,CAAC,UAAU,KAAK,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,CACtD;AAED,IAAA,IAAI,kBAAkB;QAAE,OAAO,cAAc,GAAGA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAEtE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,UAAU,KAChD,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAC1D;AAED,IAAA,IAAI,cAAc;QAAE,OAAO,UAAU,GAAGD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI;IAE9D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAOD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;AAExD,IAAA,OAAO,IAAI;AACb;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/video-react-bindings",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.4",
|
|
4
4
|
"main": "./dist/index.cjs.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
"build": "NODE_ENV=production rollup -c"
|
|
12
12
|
},
|
|
13
13
|
"sideEffects": false,
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/GetStream/stream-video-js.git",
|
|
17
|
+
"directory": "packages/react-bindings"
|
|
18
|
+
},
|
|
14
19
|
"files": [
|
|
15
20
|
"dist",
|
|
16
21
|
"src",
|
|
@@ -22,18 +27,16 @@
|
|
|
22
27
|
],
|
|
23
28
|
"dependencies": {
|
|
24
29
|
"i18next": "^25.6.0",
|
|
25
|
-
"rxjs": "~7.8.2"
|
|
26
|
-
"use-sync-external-store": "^1.6.0"
|
|
30
|
+
"rxjs": "~7.8.2"
|
|
27
31
|
},
|
|
28
32
|
"peerDependencies": {
|
|
29
|
-
"@stream-io/video-client": "^1.
|
|
33
|
+
"@stream-io/video-client": "^1.39.1",
|
|
30
34
|
"react": "^17 || ^18 || ^19"
|
|
31
35
|
},
|
|
32
36
|
"devDependencies": {
|
|
33
37
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
34
|
-
"@stream-io/video-client": "^1.
|
|
38
|
+
"@stream-io/video-client": "^1.39.1",
|
|
35
39
|
"@types/react": "~19.1.17",
|
|
36
|
-
"@types/use-sync-external-store": "^1",
|
|
37
40
|
"react": "19.1.0",
|
|
38
41
|
"rimraf": "^6.0.1",
|
|
39
42
|
"rollup": "^4.52.4",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Observable } from 'rxjs';
|
|
2
|
-
import {
|
|
3
|
-
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
4
3
|
import { RxUtils } from '@stream-io/video-client';
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -13,31 +12,21 @@ export const useObservableValue = <T>(
|
|
|
13
12
|
observable$: Observable<T>,
|
|
14
13
|
defaultValue?: T,
|
|
15
14
|
) => {
|
|
16
|
-
const
|
|
15
|
+
const [value, setValue] = useState<T>(() => {
|
|
17
16
|
try {
|
|
18
17
|
return RxUtils.getCurrentValue(observable$);
|
|
19
|
-
} catch (
|
|
20
|
-
if (typeof defaultValue === 'undefined') throw
|
|
18
|
+
} catch (err) {
|
|
19
|
+
if (typeof defaultValue === 'undefined') throw err;
|
|
21
20
|
return defaultValue;
|
|
22
21
|
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const subscribe = useCallback(
|
|
26
|
-
(onStoreChange: (v: T) => void) => {
|
|
27
|
-
const unsubscribe = RxUtils.createSubscription(
|
|
28
|
-
observable$,
|
|
29
|
-
onStoreChange,
|
|
30
|
-
(error) => {
|
|
31
|
-
console.log('An error occurred while reading an observable', error);
|
|
22
|
+
});
|
|
32
23
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
[defaultValue, observable$],
|
|
40
|
-
);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
return RxUtils.createSubscription(observable$, setValue, (err) => {
|
|
26
|
+
console.log('An error occurred while reading an observable', err);
|
|
27
|
+
if (defaultValue) setValue(defaultValue);
|
|
28
|
+
});
|
|
29
|
+
}, [defaultValue, observable$]);
|
|
41
30
|
|
|
42
|
-
return
|
|
31
|
+
return value;
|
|
43
32
|
};
|