@stream-io/video-react-bindings 0.3.22 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.4.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.3.22...@stream-io/video-react-bindings-0.4.0) (2024-02-26)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@stream-io/video-client` updated to version `0.6.0`
10
+
11
+ ### ⚠ BREAKING CHANGES
12
+
13
+ * **hooks:** expose permission hooks through useCallStateHooks() (#1254)
14
+ * **react-sdk:** Visual redesign of the SDK and Demo App (#1194)
15
+
16
+ ### Features
17
+
18
+ * **hooks:** expose permission hooks through useCallStateHooks() ([#1254](https://github.com/GetStream/stream-video-js/issues/1254)) ([3eaa8bd](https://github.com/GetStream/stream-video-js/commit/3eaa8bd7592920eedb434b6ec747b6d22077ed87))
19
+ * **react-sdk:** Visual redesign of the SDK and Demo App ([#1194](https://github.com/GetStream/stream-video-js/issues/1194)) ([c1c6a7b](https://github.com/GetStream/stream-video-js/commit/c1c6a7b9bb0551442457f6d0ef5fedc92a985a3d))
20
+
5
21
  ### [0.3.22](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.3.21...@stream-io/video-react-bindings-0.3.22) (2024-02-19)
6
22
 
7
23
  ### Dependency Updates
package/dist/index.cjs.js CHANGED
@@ -30,6 +30,7 @@ const DEFAULT_NAMESPACE = 'stream-video';
30
30
  const DEFAULT_CONFIG = {
31
31
  debug: false,
32
32
  currentLanguage: DEFAULT_LANGUAGE,
33
+ fallbackLanguage: false,
33
34
  };
34
35
  const DEFAULT_TRANSLATIONS_REGISTRY = mapToRegistry({}, DEFAULT_NAMESPACE);
35
36
  const defaultTranslationFunction = (key) => key;
@@ -69,11 +70,11 @@ class StreamI18n {
69
70
  }
70
71
  return this.i18nInstance.isInitialized;
71
72
  };
72
- const { debug = DEFAULT_CONFIG.debug, currentLanguage = DEFAULT_CONFIG.currentLanguage, translationsOverrides, } = options;
73
+ const { debug = DEFAULT_CONFIG.debug, currentLanguage = DEFAULT_CONFIG.currentLanguage, fallbackLanguage = DEFAULT_CONFIG.fallbackLanguage, translationsOverrides, } = options;
73
74
  this.i18nInstance = i18next.createInstance({
74
75
  debug,
75
76
  defaultNS: DEFAULT_NAMESPACE,
76
- fallbackLng: false,
77
+ fallbackLng: fallbackLanguage,
77
78
  interpolation: { escapeValue: false },
78
79
  keySeparator: false,
79
80
  lng: currentLanguage,
@@ -107,9 +108,13 @@ const StreamI18nProvider = ({ children, ...createI18nParams }) => {
107
108
  const { i18n, t } = useCreateI18n(createI18nParams);
108
109
  return (jsxRuntime.jsx(StreamI18nContext.Provider, { value: { t, i18n }, children: children }));
109
110
  };
110
- const useCreateI18n = ({ i18nInstance, language, translationsOverrides, }) => {
111
+ const useCreateI18n = ({ i18nInstance, language, fallbackLanguage, translationsOverrides, }) => {
111
112
  const [i18n] = react.useState(() => i18nInstance ||
112
- new StreamI18n({ currentLanguage: language, translationsOverrides }));
113
+ new StreamI18n({
114
+ currentLanguage: language,
115
+ fallbackLanguage,
116
+ translationsOverrides,
117
+ }));
113
118
  const [t, setTranslationFn] = react.useState(() => defaultTranslationFunction);
114
119
  react.useEffect(() => {
115
120
  const { isInitialized } = i18n;
@@ -429,6 +434,22 @@ const useCallThumbnail = () => {
429
434
  const { thumbnails$ } = useCallState();
430
435
  return useObservableValue(thumbnails$);
431
436
  };
437
+ /**
438
+ * A hook which returns the local participant's own capabilities.
439
+ */
440
+ const useOwnCapabilities = () => {
441
+ const { ownCapabilities$ } = useCallState();
442
+ return useObservableValue(ownCapabilities$);
443
+ };
444
+ /**
445
+ * Hook that returns true if the local participant has all the given permissions.
446
+ *
447
+ * @param permissions the permissions to check.
448
+ */
449
+ const useHasPermissions = (...permissions) => {
450
+ const capabilities = useOwnCapabilities();
451
+ return permissions.every((permission) => capabilities?.includes(permission));
452
+ };
432
453
  /**
433
454
  * Returns the camera state of the current call.
434
455
  *
@@ -545,12 +566,14 @@ var CallStateHooks = /*#__PURE__*/Object.freeze({
545
566
  useCameraState: useCameraState,
546
567
  useDominantSpeaker: useDominantSpeaker,
547
568
  useHasOngoingScreenShare: useHasOngoingScreenShare,
569
+ useHasPermissions: useHasPermissions,
548
570
  useIsCallHLSBroadcastingInProgress: useIsCallHLSBroadcastingInProgress,
549
571
  useIsCallLive: useIsCallLive,
550
572
  useIsCallRecordingInProgress: useIsCallRecordingInProgress,
551
573
  useIsCallTranscribingInProgress: useIsCallTranscribingInProgress,
552
574
  useLocalParticipant: useLocalParticipant,
553
575
  useMicrophoneState: useMicrophoneState,
576
+ useOwnCapabilities: useOwnCapabilities,
554
577
  useParticipantCount: useParticipantCount,
555
578
  useParticipants: useParticipants,
556
579
  useRemoteParticipants: useRemoteParticipants,
@@ -558,27 +581,6 @@ var CallStateHooks = /*#__PURE__*/Object.freeze({
558
581
  useSpeakerState: useSpeakerState
559
582
  });
560
583
 
561
- /**
562
- * Hook that returns true if the local participant has all the given permissions.
563
- *
564
- * @param permissions the permissions to check.
565
- *
566
- * @category Call State
567
- */
568
- const useHasPermissions = (...permissions) => {
569
- const capabilities = useOwnCapabilities();
570
- return permissions.every((permission) => capabilities?.includes(permission));
571
- };
572
- /**
573
- * A hook which returns the local participant's own capabilities.
574
- *
575
- * @category Call State
576
- */
577
- const useOwnCapabilities = () => {
578
- const { ownCapabilities$ } = useCallState();
579
- return useObservableValue(ownCapabilities$);
580
- };
581
-
582
584
  /**
583
585
  * Utility hook which provides access to client's state store.
584
586
  */
@@ -619,8 +621,8 @@ const useCallStateHooks = () => CallStateHooks;
619
621
 
620
622
  const Restricted = ({ canRequestOnly, hasPermissionsOnly, requiredGrants, requireAll = true, children, }) => {
621
623
  const call = useCall();
624
+ const { useCallSettings, useOwnCapabilities } = useCallStateHooks();
622
625
  const ownCapabilities = useOwnCapabilities();
623
- const { useCallSettings } = useCallStateHooks();
624
626
  const settings = useCallSettings();
625
627
  const hasPermissions = requiredGrants[requireAll ? 'every' : 'some']((capability) => ownCapabilities?.includes(capability));
626
628
  if (hasPermissionsOnly)
@@ -647,9 +649,7 @@ exports.useCallStateHooks = useCallStateHooks;
647
649
  exports.useCalls = useCalls;
648
650
  exports.useConnectedUser = useConnectedUser;
649
651
  exports.useCreateI18n = useCreateI18n;
650
- exports.useHasPermissions = useHasPermissions;
651
652
  exports.useI18n = useI18n;
652
- exports.useOwnCapabilities = useOwnCapabilities;
653
653
  exports.useStore = useStore;
654
654
  exports.useStreamVideoClient = useStreamVideoClient;
655
655
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/utils.ts","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/permissions.ts","../../src/hooks/store.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 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 { TranslationsMap, TranslationsRegistry } from './types';\n\nexport const mapToRegistry = (\n translationsMap: TranslationsMap,\n namespace: string,\n) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n","import i18next from 'i18next';\nimport { mapToRegistry } from './utils';\nimport {\n TranslationLanguage,\n TranslationSheet,\n TranslationsMap,\n TranslatorFunction,\n} from './types';\n\nexport const DEFAULT_LANGUAGE = 'en';\nexport const DEFAULT_NAMESPACE = 'stream-video';\nconst DEFAULT_CONFIG = {\n debug: false,\n currentLanguage: DEFAULT_LANGUAGE,\n};\n\nconst DEFAULT_TRANSLATIONS_REGISTRY = mapToRegistry({}, DEFAULT_NAMESPACE);\n\nexport const defaultTranslationFunction = (key: string) => key;\n\nexport type StreamI18nConstructor = {\n /** Language into which the provided strings are translated */\n currentLanguage?: 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 /** Simple logger function */\n constructor(options: StreamI18nConstructor = {}) {\n const {\n debug = DEFAULT_CONFIG.debug,\n currentLanguage = DEFAULT_CONFIG.currentLanguage,\n translationsOverrides,\n } = options;\n\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: DEFAULT_NAMESPACE,\n fallbackLng: false,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: (key) => {\n return key;\n },\n resources: DEFAULT_TRANSLATIONS_REGISTRY,\n });\n\n if (translationsOverrides) {\n this.i18nInstance.on('initialized', () => {\n Object.entries(translationsOverrides).forEach(([lng, translations]) => {\n this.registerTranslationsForLanguage({ lng, translations });\n });\n });\n }\n }\n\n get currentLanguage() {\n this._checkIsInitialized();\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n try {\n this.t = await this.i18nInstance.init();\n } catch (e) {\n console.error(`Failed to initialize translations: ${JSON.stringify(e)}`);\n }\n return this;\n };\n\n changeLanguage = async (\n language?: TranslationLanguage,\n onChange?: (language: TranslationLanguage) => void,\n ) => {\n if (!this._checkIsInitialized()) return;\n // i18next detects the language, if none provided, but it is better\n // to show this detection here explicitly\n const browserLanguage =\n typeof window !== 'undefined' && window.navigator\n ? window.navigator.language\n : undefined;\n await this.i18nInstance.changeLanguage(language || browserLanguage);\n onChange?.(this.currentLanguage);\n };\n\n registerTranslationsForLanguage = ({\n lng,\n translations,\n }: {\n lng: TranslationLanguage;\n translations: TranslationSheet;\n }) => {\n if (!this._checkIsInitialized()) return;\n this.i18nInstance.addResourceBundle(\n lng,\n DEFAULT_NAMESPACE,\n translations,\n true,\n true,\n );\n };\n\n private _checkIsInitialized = () => {\n if (!this.i18nInstance.isInitialized) {\n console.warn(\n 'I18n instance is not initialized. Call yourStreamI18nInstance.init().',\n );\n }\n return this.i18nInstance.isInitialized;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\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?: string;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const { i18n, t } = useCreateI18n(createI18nParams);\n\n return (\n <StreamI18nContext.Provider value={{ t, i18n }}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nexport const useCreateI18n = ({\n i18nInstance,\n language,\n translationsOverrides,\n}: CreateI18nParams) => {\n const [i18n] = useState(\n () =>\n i18nInstance ||\n new StreamI18n({ currentLanguage: language, translationsOverrides }),\n );\n const [t, setTranslationFn] = useState<StreamI18n['t']>(\n () => defaultTranslationFunction,\n );\n\n useEffect(() => {\n const { isInitialized } = i18n;\n if (!isInitialized) {\n i18n.init().then((_i18n) => setTranslationFn(() => _i18n.i18nInstance.t));\n return;\n }\n if (language && i18n?.currentLanguage !== language) {\n i18n.changeLanguage(language).catch((err) => {\n console.log('Error while changing language', err);\n });\n }\n }, [i18n, i18nInstance, language, translationsOverrides]);\n\n return { i18n, t };\n};\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 * Exclude types from documentation site, but we should still add doc comments\n * @internal\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\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 * @param PropsWithChildren<StreamVideoProps>\n * @category Client State\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 *\n * @returns\n *\n * @category Client State\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\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 * @internal\n */\nexport const useObservableValue = <T>(observable$: Observable<T>) => {\n const [value, setValue] = useState<T>(() =>\n RxUtils.getCurrentValue(observable$),\n );\n useEffect(() => {\n const subscription = observable$.subscribe(setValue);\n return () => {\n subscription.unsubscribe();\n };\n }, [observable$]);\n\n return value;\n};\n","import { useMemo } from 'react';\nimport {\n Call,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n MemberResponse,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useCall } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook, which provides the current call's state.\n *\n * @category Call 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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 * @category Call State\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 StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n *\n * @category Call State\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 *\n * @category Call State\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\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 *\n * @category Call State\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 *\n * @category Call State\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 * Returns the camera state of the current call.\n *\n * @category Camera Manager State\n *\n */\nexport const useCameraState = () => {\n const call = useCall();\n const { camera } = call as Call;\n\n const devices$ = useMemo(() => camera.listDevices(), [camera]);\n\n const { state } = camera;\n const status = useObservableValue(state.status$);\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const devices = useObservableValue(devices$);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isMute = status !== 'enabled';\n\n return {\n camera,\n status,\n isEnabled: status === 'enabled',\n direction,\n mediaStream,\n devices,\n hasBrowserPermission,\n selectedDevice,\n isMute,\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n *\n * @category Microphone Manager State\n */\nexport const useMicrophoneState = () => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const devices$ = useMemo(() => microphone.listDevices(), [microphone]);\n\n const { state } = microphone;\n const status = useObservableValue(state.status$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const devices = useObservableValue(devices$);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n const isMute = status !== 'enabled';\n\n return {\n microphone,\n status,\n isEnabled: status === 'enabled',\n mediaStream,\n devices,\n selectedDevice,\n hasBrowserPermission,\n isSpeakingWhileMuted,\n isMute,\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n */\nexport const useSpeakerState = () => {\n const call = useCall();\n const { speaker } = call as Call;\n\n const devices$ = useMemo(() => speaker.listDevices(), [speaker]);\n const devices = useObservableValue(devices$);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n\n return {\n speaker,\n devices,\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 const call = useCall();\n const { screenShare } = call as Call;\n\n const status = useObservableValue(screenShare.state.status$);\n const mediaStream = useObservableValue(screenShare.state.mediaStream$);\n const isMute = status !== 'enabled';\n\n return {\n screenShare,\n mediaStream,\n status,\n isMute,\n };\n};\n","import { OwnCapability } from '@stream-io/video-client';\nimport { useCallState } from './callStateHooks';\nimport { useObservableValue } from './useObservableValue';\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 *\n * @category Call State\n */\nexport const useHasPermissions = (...permissions: OwnCapability[]): boolean => {\n const capabilities = useOwnCapabilities();\n return permissions.every((permission) => capabilities?.includes(permission));\n};\n\n/**\n * A hook which returns the local participant's own capabilities.\n *\n * @category Call State\n */\nexport const useOwnCapabilities = (): OwnCapability[] | undefined => {\n const { ownCapabilities$ } = useCallState();\n return useObservableValue(ownCapabilities$);\n};\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.readOnlyStateStore;\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 *\n * @category Client State\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n *\n * @category Client State\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import * as CallStateHooks from './callStateHooks';\n\nexport * from './permissions';\nexport * from './store';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n *\n * @category Call State\n */\nexport const useCallStateHooks = () => CallStateHooks;\n","import { OwnCapability } from '@stream-io/video-client';\n\nimport { PropsWithChildren } from 'react';\nimport { useCall } from '../contexts';\nimport { useCallStateHooks, useOwnCapabilities } 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 ownCapabilities = useOwnCapabilities();\n const { useCallSettings } = useCallStateHooks();\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","RxUtils","CallState","useMemo","_Fragment"],"mappings":";;;;;;;AAGA,MAAM,iBAAiB,GAAGA,mBAAa,CAAmB,SAAS,CAAC,CAAC;AASrE;;AAEG;AACU,MAAA,kBAAkB,GAAG,CAChC,KAAiD,KAC/C;AACF,IAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;AACjC,IAAA,QACEC,cAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACpC,QAAQ,EAAA,CACkB,EAC7B;AACJ,EAAE;AAEF;;AAEG;AACI,MAAM,OAAO,GAAG,MAAK;AAC1B,IAAA,OAAOC,gBAAU,CAAC,iBAAiB,CAAC,CAAC;AACvC;;AC7BO,MAAM,aAAa,GAAG,CAC3B,eAAgC,EAChC,SAAiB,KAEjB,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,CAAC;AACzC,IAAA,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAA0B;;ACAxB,MAAM,gBAAgB,GAAG,KAAK;AAC9B,MAAM,iBAAiB,GAAG,eAAe;AAChD,MAAM,cAAc,GAAG;AACrB,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,eAAe,EAAE,gBAAgB;CAClC,CAAC;AAEF,MAAM,6BAA6B,GAAG,aAAa,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAE9D,MAAA,0BAA0B,GAAG,CAAC,GAAW,KAAK,IAAI;MAWlD,UAAU,CAAA;;A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AG,IAAI,EACjB,QAAQ,GACQ,KAAI;AACpB,IAAA,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;AACvB,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;AAC7C,IAAA,MAAM,EAAE,eAAe,EAAE,GAAG,iBAAiB,EAAE,CAAC;AAChD,IAAA,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC,CAClE,CAAC,UAAU,KAAK,eAAe,EAAE,QAAQ,CAAC,UAAU,CAAC,CACtD,CAAC;AAEF,IAAA,IAAI,kBAAkB;QAAE,OAAO,cAAc,GAAGN,cAAA,CAAAO,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI,CAAC;IAEvE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,UAAU,KAChD,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAC1D,CAAC;AAEF,IAAA,IAAI,cAAc;QAAE,OAAO,UAAU,GAAGP,cAAA,CAAAO,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI,CAAC;IAE/D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAOP,cAAA,CAAAO,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,CAAC;AAEzD,IAAA,OAAO,IAAI,CAAC;AACd;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/utils.ts","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/store.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 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 { TranslationsMap, TranslationsRegistry } from './types';\n\nexport const mapToRegistry = (\n translationsMap: TranslationsMap,\n namespace: string,\n) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n","import i18next from 'i18next';\nimport { mapToRegistry } from './utils';\nimport {\n TranslationLanguage,\n TranslationSheet,\n TranslationsMap,\n TranslatorFunction,\n} from './types';\n\nexport const DEFAULT_LANGUAGE = 'en';\nexport const DEFAULT_NAMESPACE = 'stream-video';\nconst DEFAULT_CONFIG = {\n debug: false,\n currentLanguage: DEFAULT_LANGUAGE,\n fallbackLanguage: false,\n} as const;\n\nconst DEFAULT_TRANSLATIONS_REGISTRY = mapToRegistry({}, DEFAULT_NAMESPACE);\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 /** Simple logger function */\n constructor(options: StreamI18nConstructor = {}) {\n const {\n debug = DEFAULT_CONFIG.debug,\n currentLanguage = DEFAULT_CONFIG.currentLanguage,\n fallbackLanguage = DEFAULT_CONFIG.fallbackLanguage,\n translationsOverrides,\n } = options;\n\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: DEFAULT_NAMESPACE,\n fallbackLng: fallbackLanguage,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: (key) => {\n return key;\n },\n resources: DEFAULT_TRANSLATIONS_REGISTRY,\n });\n\n if (translationsOverrides) {\n this.i18nInstance.on('initialized', () => {\n Object.entries(translationsOverrides).forEach(([lng, translations]) => {\n this.registerTranslationsForLanguage({ lng, translations });\n });\n });\n }\n }\n\n get currentLanguage() {\n this._checkIsInitialized();\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n try {\n this.t = await this.i18nInstance.init();\n } catch (e) {\n console.error(`Failed to initialize translations: ${JSON.stringify(e)}`);\n }\n return this;\n };\n\n changeLanguage = async (\n language?: TranslationLanguage,\n onChange?: (language: TranslationLanguage) => void,\n ) => {\n if (!this._checkIsInitialized()) return;\n // i18next detects the language, if none provided, but it is better\n // to show this detection here explicitly\n const browserLanguage =\n typeof window !== 'undefined' && window.navigator\n ? window.navigator.language\n : undefined;\n await this.i18nInstance.changeLanguage(language || browserLanguage);\n onChange?.(this.currentLanguage);\n };\n\n registerTranslationsForLanguage = ({\n lng,\n translations,\n }: {\n lng: TranslationLanguage;\n translations: TranslationSheet;\n }) => {\n if (!this._checkIsInitialized()) return;\n this.i18nInstance.addResourceBundle(\n lng,\n DEFAULT_NAMESPACE,\n translations,\n true,\n true,\n );\n };\n\n private _checkIsInitialized = () => {\n if (!this.i18nInstance.isInitialized) {\n console.warn(\n 'I18n instance is not initialized. Call yourStreamI18nInstance.init().',\n );\n }\n return this.i18nInstance.isInitialized;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\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?: string;\n fallbackLanguage?: string;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const { i18n, t } = useCreateI18n(createI18nParams);\n\n return (\n <StreamI18nContext.Provider value={{ t, i18n }}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nexport const 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']>(\n () => defaultTranslationFunction,\n );\n\n useEffect(() => {\n const { isInitialized } = i18n;\n if (!isInitialized) {\n i18n.init().then((_i18n) => setTranslationFn(() => _i18n.i18nInstance.t));\n return;\n }\n if (language && i18n?.currentLanguage !== language) {\n i18n.changeLanguage(language).catch((err) => {\n console.log('Error while changing language', err);\n });\n }\n }, [i18n, i18nInstance, language, translationsOverrides]);\n\n return { i18n, t };\n};\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 * Exclude types from documentation site, but we should still add doc comments\n * @internal\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\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 * @param PropsWithChildren<StreamVideoProps>\n * @category Client State\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 *\n * @returns\n *\n * @category Client State\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\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 * @internal\n */\nexport const useObservableValue = <T>(observable$: Observable<T>) => {\n const [value, setValue] = useState<T>(() =>\n RxUtils.getCurrentValue(observable$),\n );\n useEffect(() => {\n const subscription = observable$.subscribe(setValue);\n return () => {\n subscription.unsubscribe();\n };\n }, [observable$]);\n\n return value;\n};\n","import { useMemo } from 'react';\nimport {\n Call,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n MemberResponse,\n OwnCapability,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useCall } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook, which provides the current call's state.\n *\n * @category Call 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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 * @category Call State\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 StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n *\n * @category Call State\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 *\n * @category Call State\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Camera Manager State\n *\n */\nexport const useCameraState = () => {\n const call = useCall();\n const { camera } = call as Call;\n\n const devices$ = useMemo(() => camera.listDevices(), [camera]);\n\n const { state } = camera;\n const status = useObservableValue(state.status$);\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const devices = useObservableValue(devices$);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isMute = status !== 'enabled';\n\n return {\n camera,\n status,\n isEnabled: status === 'enabled',\n direction,\n mediaStream,\n devices,\n hasBrowserPermission,\n selectedDevice,\n isMute,\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n *\n * @category Microphone Manager State\n */\nexport const useMicrophoneState = () => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const devices$ = useMemo(() => microphone.listDevices(), [microphone]);\n\n const { state } = microphone;\n const status = useObservableValue(state.status$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const devices = useObservableValue(devices$);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n const isMute = status !== 'enabled';\n\n return {\n microphone,\n status,\n isEnabled: status === 'enabled',\n mediaStream,\n devices,\n selectedDevice,\n hasBrowserPermission,\n isSpeakingWhileMuted,\n isMute,\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n */\nexport const useSpeakerState = () => {\n const call = useCall();\n const { speaker } = call as Call;\n\n const devices$ = useMemo(() => speaker.listDevices(), [speaker]);\n const devices = useObservableValue(devices$);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n\n return {\n speaker,\n devices,\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 const call = useCall();\n const { screenShare } = call as Call;\n\n const status = useObservableValue(screenShare.state.status$);\n const mediaStream = useObservableValue(screenShare.state.mediaStream$);\n const isMute = status !== 'enabled';\n\n return {\n screenShare,\n mediaStream,\n status,\n isMute,\n };\n};\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.readOnlyStateStore;\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 *\n * @category Client State\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n *\n * @category Client State\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import * as CallStateHooks from './callStateHooks';\n\nexport * from './store';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n *\n * @category Call State\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","RxUtils","CallState","useMemo","_Fragment"],"mappings":";;;;;;;AAGA,MAAM,iBAAiB,GAAGA,mBAAa,CAAmB,SAAS,CAAC,CAAC;AASrE;;AAEG;AACU,MAAA,kBAAkB,GAAG,CAChC,KAAiD,KAC/C;AACF,IAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;AACjC,IAAA,QACEC,cAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACpC,QAAQ,EAAA,CACkB,EAC7B;AACJ,EAAE;AAEF;;AAEG;AACI,MAAM,OAAO,GAAG,MAAK;AAC1B,IAAA,OAAOC,gBAAU,CAAC,iBAAiB,CAAC,CAAC;AACvC;;AC7BO,MAAM,aAAa,GAAG,CAC3B,eAAgC,EAChC,SAAiB,KAEjB,MA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AAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,UAAU,KAChD,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAC1D,CAAC;AAEF,IAAA,IAAI,cAAc;QAAE,OAAO,UAAU,GAAGP,cAAA,CAAAO,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI,CAAC;IAE/D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAOP,cAAA,CAAAO,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,CAAC;AAEzD,IAAA,OAAO,IAAI,CAAC;AACd;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.es.js CHANGED
@@ -28,6 +28,7 @@ const DEFAULT_NAMESPACE = 'stream-video';
28
28
  const DEFAULT_CONFIG = {
29
29
  debug: false,
30
30
  currentLanguage: DEFAULT_LANGUAGE,
31
+ fallbackLanguage: false,
31
32
  };
32
33
  const DEFAULT_TRANSLATIONS_REGISTRY = mapToRegistry({}, DEFAULT_NAMESPACE);
33
34
  const defaultTranslationFunction = (key) => key;
@@ -67,11 +68,11 @@ class StreamI18n {
67
68
  }
68
69
  return this.i18nInstance.isInitialized;
69
70
  };
70
- const { debug = DEFAULT_CONFIG.debug, currentLanguage = DEFAULT_CONFIG.currentLanguage, translationsOverrides, } = options;
71
+ const { debug = DEFAULT_CONFIG.debug, currentLanguage = DEFAULT_CONFIG.currentLanguage, fallbackLanguage = DEFAULT_CONFIG.fallbackLanguage, translationsOverrides, } = options;
71
72
  this.i18nInstance = i18next.createInstance({
72
73
  debug,
73
74
  defaultNS: DEFAULT_NAMESPACE,
74
- fallbackLng: false,
75
+ fallbackLng: fallbackLanguage,
75
76
  interpolation: { escapeValue: false },
76
77
  keySeparator: false,
77
78
  lng: currentLanguage,
@@ -105,9 +106,13 @@ const StreamI18nProvider = ({ children, ...createI18nParams }) => {
105
106
  const { i18n, t } = useCreateI18n(createI18nParams);
106
107
  return (jsx(StreamI18nContext.Provider, { value: { t, i18n }, children: children }));
107
108
  };
108
- const useCreateI18n = ({ i18nInstance, language, translationsOverrides, }) => {
109
+ const useCreateI18n = ({ i18nInstance, language, fallbackLanguage, translationsOverrides, }) => {
109
110
  const [i18n] = useState(() => i18nInstance ||
110
- new StreamI18n({ currentLanguage: language, translationsOverrides }));
111
+ new StreamI18n({
112
+ currentLanguage: language,
113
+ fallbackLanguage,
114
+ translationsOverrides,
115
+ }));
111
116
  const [t, setTranslationFn] = useState(() => defaultTranslationFunction);
112
117
  useEffect(() => {
113
118
  const { isInitialized } = i18n;
@@ -427,6 +432,22 @@ const useCallThumbnail = () => {
427
432
  const { thumbnails$ } = useCallState();
428
433
  return useObservableValue(thumbnails$);
429
434
  };
435
+ /**
436
+ * A hook which returns the local participant's own capabilities.
437
+ */
438
+ const useOwnCapabilities = () => {
439
+ const { ownCapabilities$ } = useCallState();
440
+ return useObservableValue(ownCapabilities$);
441
+ };
442
+ /**
443
+ * Hook that returns true if the local participant has all the given permissions.
444
+ *
445
+ * @param permissions the permissions to check.
446
+ */
447
+ const useHasPermissions = (...permissions) => {
448
+ const capabilities = useOwnCapabilities();
449
+ return permissions.every((permission) => capabilities?.includes(permission));
450
+ };
430
451
  /**
431
452
  * Returns the camera state of the current call.
432
453
  *
@@ -543,12 +564,14 @@ var CallStateHooks = /*#__PURE__*/Object.freeze({
543
564
  useCameraState: useCameraState,
544
565
  useDominantSpeaker: useDominantSpeaker,
545
566
  useHasOngoingScreenShare: useHasOngoingScreenShare,
567
+ useHasPermissions: useHasPermissions,
546
568
  useIsCallHLSBroadcastingInProgress: useIsCallHLSBroadcastingInProgress,
547
569
  useIsCallLive: useIsCallLive,
548
570
  useIsCallRecordingInProgress: useIsCallRecordingInProgress,
549
571
  useIsCallTranscribingInProgress: useIsCallTranscribingInProgress,
550
572
  useLocalParticipant: useLocalParticipant,
551
573
  useMicrophoneState: useMicrophoneState,
574
+ useOwnCapabilities: useOwnCapabilities,
552
575
  useParticipantCount: useParticipantCount,
553
576
  useParticipants: useParticipants,
554
577
  useRemoteParticipants: useRemoteParticipants,
@@ -556,27 +579,6 @@ var CallStateHooks = /*#__PURE__*/Object.freeze({
556
579
  useSpeakerState: useSpeakerState
557
580
  });
558
581
 
559
- /**
560
- * Hook that returns true if the local participant has all the given permissions.
561
- *
562
- * @param permissions the permissions to check.
563
- *
564
- * @category Call State
565
- */
566
- const useHasPermissions = (...permissions) => {
567
- const capabilities = useOwnCapabilities();
568
- return permissions.every((permission) => capabilities?.includes(permission));
569
- };
570
- /**
571
- * A hook which returns the local participant's own capabilities.
572
- *
573
- * @category Call State
574
- */
575
- const useOwnCapabilities = () => {
576
- const { ownCapabilities$ } = useCallState();
577
- return useObservableValue(ownCapabilities$);
578
- };
579
-
580
582
  /**
581
583
  * Utility hook which provides access to client's state store.
582
584
  */
@@ -617,8 +619,8 @@ const useCallStateHooks = () => CallStateHooks;
617
619
 
618
620
  const Restricted = ({ canRequestOnly, hasPermissionsOnly, requiredGrants, requireAll = true, children, }) => {
619
621
  const call = useCall();
622
+ const { useCallSettings, useOwnCapabilities } = useCallStateHooks();
620
623
  const ownCapabilities = useOwnCapabilities();
621
- const { useCallSettings } = useCallStateHooks();
622
624
  const settings = useCallSettings();
623
625
  const hasPermissions = requiredGrants[requireAll ? 'every' : 'some']((capability) => ownCapabilities?.includes(capability));
624
626
  if (hasPermissionsOnly)
@@ -631,5 +633,5 @@ const Restricted = ({ canRequestOnly, hasPermissionsOnly, requiredGrants, requir
631
633
  return null;
632
634
  };
633
635
 
634
- export { DEFAULT_LANGUAGE, DEFAULT_NAMESPACE, Restricted, StreamCallProvider, StreamI18n, StreamI18nProvider, StreamVideoProvider, defaultTranslationFunction, mapToRegistry, useCall, useCallStateHooks, useCalls, useConnectedUser, useCreateI18n, useHasPermissions, useI18n, useOwnCapabilities, useStore, useStreamVideoClient };
636
+ export { DEFAULT_LANGUAGE, DEFAULT_NAMESPACE, Restricted, StreamCallProvider, StreamI18n, StreamI18nProvider, StreamVideoProvider, defaultTranslationFunction, mapToRegistry, useCall, useCallStateHooks, useCalls, useConnectedUser, useCreateI18n, useI18n, useStore, useStreamVideoClient };
635
637
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/utils.ts","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/permissions.ts","../../src/hooks/store.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 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 { TranslationsMap, TranslationsRegistry } from './types';\n\nexport const mapToRegistry = (\n translationsMap: TranslationsMap,\n namespace: string,\n) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n","import i18next from 'i18next';\nimport { mapToRegistry } from './utils';\nimport {\n TranslationLanguage,\n TranslationSheet,\n TranslationsMap,\n TranslatorFunction,\n} from './types';\n\nexport const DEFAULT_LANGUAGE = 'en';\nexport const DEFAULT_NAMESPACE = 'stream-video';\nconst DEFAULT_CONFIG = {\n debug: false,\n currentLanguage: DEFAULT_LANGUAGE,\n};\n\nconst DEFAULT_TRANSLATIONS_REGISTRY = mapToRegistry({}, DEFAULT_NAMESPACE);\n\nexport const defaultTranslationFunction = (key: string) => key;\n\nexport type StreamI18nConstructor = {\n /** Language into which the provided strings are translated */\n currentLanguage?: 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 /** Simple logger function */\n constructor(options: StreamI18nConstructor = {}) {\n const {\n debug = DEFAULT_CONFIG.debug,\n currentLanguage = DEFAULT_CONFIG.currentLanguage,\n translationsOverrides,\n } = options;\n\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: DEFAULT_NAMESPACE,\n fallbackLng: false,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: (key) => {\n return key;\n },\n resources: DEFAULT_TRANSLATIONS_REGISTRY,\n });\n\n if (translationsOverrides) {\n this.i18nInstance.on('initialized', () => {\n Object.entries(translationsOverrides).forEach(([lng, translations]) => {\n this.registerTranslationsForLanguage({ lng, translations });\n });\n });\n }\n }\n\n get currentLanguage() {\n this._checkIsInitialized();\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n try {\n this.t = await this.i18nInstance.init();\n } catch (e) {\n console.error(`Failed to initialize translations: ${JSON.stringify(e)}`);\n }\n return this;\n };\n\n changeLanguage = async (\n language?: TranslationLanguage,\n onChange?: (language: TranslationLanguage) => void,\n ) => {\n if (!this._checkIsInitialized()) return;\n // i18next detects the language, if none provided, but it is better\n // to show this detection here explicitly\n const browserLanguage =\n typeof window !== 'undefined' && window.navigator\n ? window.navigator.language\n : undefined;\n await this.i18nInstance.changeLanguage(language || browserLanguage);\n onChange?.(this.currentLanguage);\n };\n\n registerTranslationsForLanguage = ({\n lng,\n translations,\n }: {\n lng: TranslationLanguage;\n translations: TranslationSheet;\n }) => {\n if (!this._checkIsInitialized()) return;\n this.i18nInstance.addResourceBundle(\n lng,\n DEFAULT_NAMESPACE,\n translations,\n true,\n true,\n );\n };\n\n private _checkIsInitialized = () => {\n if (!this.i18nInstance.isInitialized) {\n console.warn(\n 'I18n instance is not initialized. Call yourStreamI18nInstance.init().',\n );\n }\n return this.i18nInstance.isInitialized;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\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?: string;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const { i18n, t } = useCreateI18n(createI18nParams);\n\n return (\n <StreamI18nContext.Provider value={{ t, i18n }}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nexport const useCreateI18n = ({\n i18nInstance,\n language,\n translationsOverrides,\n}: CreateI18nParams) => {\n const [i18n] = useState(\n () =>\n i18nInstance ||\n new StreamI18n({ currentLanguage: language, translationsOverrides }),\n );\n const [t, setTranslationFn] = useState<StreamI18n['t']>(\n () => defaultTranslationFunction,\n );\n\n useEffect(() => {\n const { isInitialized } = i18n;\n if (!isInitialized) {\n i18n.init().then((_i18n) => setTranslationFn(() => _i18n.i18nInstance.t));\n return;\n }\n if (language && i18n?.currentLanguage !== language) {\n i18n.changeLanguage(language).catch((err) => {\n console.log('Error while changing language', err);\n });\n }\n }, [i18n, i18nInstance, language, translationsOverrides]);\n\n return { i18n, t };\n};\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 * Exclude types from documentation site, but we should still add doc comments\n * @internal\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\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 * @param PropsWithChildren<StreamVideoProps>\n * @category Client State\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 *\n * @returns\n *\n * @category Client State\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\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 * @internal\n */\nexport const useObservableValue = <T>(observable$: Observable<T>) => {\n const [value, setValue] = useState<T>(() =>\n RxUtils.getCurrentValue(observable$),\n );\n useEffect(() => {\n const subscription = observable$.subscribe(setValue);\n return () => {\n subscription.unsubscribe();\n };\n }, [observable$]);\n\n return value;\n};\n","import { useMemo } from 'react';\nimport {\n Call,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n MemberResponse,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useCall } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook, which provides the current call's state.\n *\n * @category Call 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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 * @category Call State\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 StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n *\n * @category Call State\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 *\n * @category Call State\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\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 *\n * @category Call State\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 *\n * @category Call State\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 * Returns the camera state of the current call.\n *\n * @category Camera Manager State\n *\n */\nexport const useCameraState = () => {\n const call = useCall();\n const { camera } = call as Call;\n\n const devices$ = useMemo(() => camera.listDevices(), [camera]);\n\n const { state } = camera;\n const status = useObservableValue(state.status$);\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const devices = useObservableValue(devices$);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isMute = status !== 'enabled';\n\n return {\n camera,\n status,\n isEnabled: status === 'enabled',\n direction,\n mediaStream,\n devices,\n hasBrowserPermission,\n selectedDevice,\n isMute,\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n *\n * @category Microphone Manager State\n */\nexport const useMicrophoneState = () => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const devices$ = useMemo(() => microphone.listDevices(), [microphone]);\n\n const { state } = microphone;\n const status = useObservableValue(state.status$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const devices = useObservableValue(devices$);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n const isMute = status !== 'enabled';\n\n return {\n microphone,\n status,\n isEnabled: status === 'enabled',\n mediaStream,\n devices,\n selectedDevice,\n hasBrowserPermission,\n isSpeakingWhileMuted,\n isMute,\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n */\nexport const useSpeakerState = () => {\n const call = useCall();\n const { speaker } = call as Call;\n\n const devices$ = useMemo(() => speaker.listDevices(), [speaker]);\n const devices = useObservableValue(devices$);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n\n return {\n speaker,\n devices,\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 const call = useCall();\n const { screenShare } = call as Call;\n\n const status = useObservableValue(screenShare.state.status$);\n const mediaStream = useObservableValue(screenShare.state.mediaStream$);\n const isMute = status !== 'enabled';\n\n return {\n screenShare,\n mediaStream,\n status,\n isMute,\n };\n};\n","import { OwnCapability } from '@stream-io/video-client';\nimport { useCallState } from './callStateHooks';\nimport { useObservableValue } from './useObservableValue';\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 *\n * @category Call State\n */\nexport const useHasPermissions = (...permissions: OwnCapability[]): boolean => {\n const capabilities = useOwnCapabilities();\n return permissions.every((permission) => capabilities?.includes(permission));\n};\n\n/**\n * A hook which returns the local participant's own capabilities.\n *\n * @category Call State\n */\nexport const useOwnCapabilities = (): OwnCapability[] | undefined => {\n const { ownCapabilities$ } = useCallState();\n return useObservableValue(ownCapabilities$);\n};\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.readOnlyStateStore;\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 *\n * @category Client State\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n *\n * @category Client State\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import * as CallStateHooks from './callStateHooks';\n\nexport * from './permissions';\nexport * from './store';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n *\n * @category Call State\n */\nexport const useCallStateHooks = () => CallStateHooks;\n","import { OwnCapability } from '@stream-io/video-client';\n\nimport { PropsWithChildren } from 'react';\nimport { useCall } from '../contexts';\nimport { useCallStateHooks, useOwnCapabilities } 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 ownCapabilities = useOwnCapabilities();\n const { useCallSettings } = useCallStateHooks();\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,CAAC;AASrE;;AAEG;AACU,MAAA,kBAAkB,GAAG,CAChC,KAAiD,KAC/C;AACF,IAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,G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AC;AAEF,IAAA,IAAI,kBAAkB;QAAE,OAAO,cAAc,GAAGA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI,CAAC;IAEvE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,UAAU,KAChD,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,CAC1D,CAAC;AAEF,IAAA,IAAI,cAAc;QAAE,OAAO,UAAU,GAAGD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,GAAG,IAAI,CAAC;IAE/D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAOD,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI,CAAC;AAEzD,IAAA,OAAO,IAAI,CAAC;AACd;;;;"}
1
+ {"version":3,"file":"index.es.js","sources":["../../src/contexts/StreamCallContext.tsx","../../src/i18n/utils.ts","../../src/i18n/StreamI18n.ts","../../src/contexts/StreamI18nContext.tsx","../../src/contexts/StreamVideoContext.tsx","../../src/hooks/useObservableValue.ts","../../src/hooks/callStateHooks.ts","../../src/hooks/store.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 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 { TranslationsMap, TranslationsRegistry } from './types';\n\nexport const mapToRegistry = (\n translationsMap: TranslationsMap,\n namespace: string,\n) =>\n Object.entries(translationsMap).reduce((acc, [lng, translations]) => {\n acc[lng] = { [namespace]: translations };\n return acc;\n }, {} as TranslationsRegistry);\n","import i18next from 'i18next';\nimport { mapToRegistry } from './utils';\nimport {\n TranslationLanguage,\n TranslationSheet,\n TranslationsMap,\n TranslatorFunction,\n} from './types';\n\nexport const DEFAULT_LANGUAGE = 'en';\nexport const DEFAULT_NAMESPACE = 'stream-video';\nconst DEFAULT_CONFIG = {\n debug: false,\n currentLanguage: DEFAULT_LANGUAGE,\n fallbackLanguage: false,\n} as const;\n\nconst DEFAULT_TRANSLATIONS_REGISTRY = mapToRegistry({}, DEFAULT_NAMESPACE);\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 /** Simple logger function */\n constructor(options: StreamI18nConstructor = {}) {\n const {\n debug = DEFAULT_CONFIG.debug,\n currentLanguage = DEFAULT_CONFIG.currentLanguage,\n fallbackLanguage = DEFAULT_CONFIG.fallbackLanguage,\n translationsOverrides,\n } = options;\n\n this.i18nInstance = i18next.createInstance({\n debug,\n defaultNS: DEFAULT_NAMESPACE,\n fallbackLng: fallbackLanguage,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: currentLanguage,\n nsSeparator: false,\n parseMissingKeyHandler: (key) => {\n return key;\n },\n resources: DEFAULT_TRANSLATIONS_REGISTRY,\n });\n\n if (translationsOverrides) {\n this.i18nInstance.on('initialized', () => {\n Object.entries(translationsOverrides).forEach(([lng, translations]) => {\n this.registerTranslationsForLanguage({ lng, translations });\n });\n });\n }\n }\n\n get currentLanguage() {\n this._checkIsInitialized();\n return this.i18nInstance.language;\n }\n\n get isInitialized() {\n return this.i18nInstance.isInitialized;\n }\n\n init = async () => {\n try {\n this.t = await this.i18nInstance.init();\n } catch (e) {\n console.error(`Failed to initialize translations: ${JSON.stringify(e)}`);\n }\n return this;\n };\n\n changeLanguage = async (\n language?: TranslationLanguage,\n onChange?: (language: TranslationLanguage) => void,\n ) => {\n if (!this._checkIsInitialized()) return;\n // i18next detects the language, if none provided, but it is better\n // to show this detection here explicitly\n const browserLanguage =\n typeof window !== 'undefined' && window.navigator\n ? window.navigator.language\n : undefined;\n await this.i18nInstance.changeLanguage(language || browserLanguage);\n onChange?.(this.currentLanguage);\n };\n\n registerTranslationsForLanguage = ({\n lng,\n translations,\n }: {\n lng: TranslationLanguage;\n translations: TranslationSheet;\n }) => {\n if (!this._checkIsInitialized()) return;\n this.i18nInstance.addResourceBundle(\n lng,\n DEFAULT_NAMESPACE,\n translations,\n true,\n true,\n );\n };\n\n private _checkIsInitialized = () => {\n if (!this.i18nInstance.isInitialized) {\n console.warn(\n 'I18n instance is not initialized. Call yourStreamI18nInstance.init().',\n );\n }\n return this.i18nInstance.isInitialized;\n };\n}\n","import {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n defaultTranslationFunction,\n StreamI18n,\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?: string;\n fallbackLanguage?: string;\n translationsOverrides?: TranslationsMap;\n};\n\nexport type StreamI18nProviderProps = CreateI18nParams;\n\nexport const StreamI18nProvider = ({\n children,\n ...createI18nParams\n}: PropsWithChildren<StreamI18nProviderProps>) => {\n const { i18n, t } = useCreateI18n(createI18nParams);\n\n return (\n <StreamI18nContext.Provider value={{ t, i18n }}>\n {children}\n </StreamI18nContext.Provider>\n );\n};\n\nexport const 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']>(\n () => defaultTranslationFunction,\n );\n\n useEffect(() => {\n const { isInitialized } = i18n;\n if (!isInitialized) {\n i18n.init().then((_i18n) => setTranslationFn(() => _i18n.i18nInstance.t));\n return;\n }\n if (language && i18n?.currentLanguage !== language) {\n i18n.changeLanguage(language).catch((err) => {\n console.log('Error while changing language', err);\n });\n }\n }, [i18n, i18nInstance, language, translationsOverrides]);\n\n return { i18n, t };\n};\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 * Exclude types from documentation site, but we should still add doc comments\n * @internal\n */\nexport type StreamVideoProps = StreamI18nProviderProps & {\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 * @param PropsWithChildren<StreamVideoProps>\n * @category Client State\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 *\n * @returns\n *\n * @category Client State\n */\nexport const useStreamVideoClient = () => {\n return useContext(StreamVideoContext);\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 * @internal\n */\nexport const useObservableValue = <T>(observable$: Observable<T>) => {\n const [value, setValue] = useState<T>(() =>\n RxUtils.getCurrentValue(observable$),\n );\n useEffect(() => {\n const subscription = observable$.subscribe(setValue);\n return () => {\n subscription.unsubscribe();\n };\n }, [observable$]);\n\n return value;\n};\n","import { useMemo } from 'react';\nimport {\n Call,\n CallIngressResponse,\n CallSessionResponse,\n CallSettingsResponse,\n CallState,\n CallStatsReport,\n Comparator,\n EgressResponse,\n MemberResponse,\n OwnCapability,\n StreamVideoParticipant,\n UserResponse,\n} from '@stream-io/video-client';\nimport { useCall } from '../contexts';\nimport { useObservableValue } from './useObservableValue';\n\n/**\n * Utility hook, which provides the current call's state.\n *\n * @category Call 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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Call State\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 * @category Call State\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 StreamVideoLocalParticipant object.\n * It signals that I have joined a call.\n *\n * @category Call State\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 *\n * @category Call State\n */\nexport const useRemoteParticipants = () => {\n const { remoteParticipants$ } = useCallState();\n return useObservableValue(remoteParticipants$);\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 *\n * @category Call State\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 *\n * @category Call State\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 *\n * @category Camera Manager State\n *\n */\nexport const useCameraState = () => {\n const call = useCall();\n const { camera } = call as Call;\n\n const devices$ = useMemo(() => camera.listDevices(), [camera]);\n\n const { state } = camera;\n const status = useObservableValue(state.status$);\n const direction = useObservableValue(state.direction$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const devices = useObservableValue(devices$);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isMute = status !== 'enabled';\n\n return {\n camera,\n status,\n isEnabled: status === 'enabled',\n direction,\n mediaStream,\n devices,\n hasBrowserPermission,\n selectedDevice,\n isMute,\n };\n};\n\n/**\n * Returns the microphone state of the current call.\n *\n * @category Microphone Manager State\n */\nexport const useMicrophoneState = () => {\n const call = useCall();\n const { microphone } = call as Call;\n\n const devices$ = useMemo(() => microphone.listDevices(), [microphone]);\n\n const { state } = microphone;\n const status = useObservableValue(state.status$);\n const mediaStream = useObservableValue(state.mediaStream$);\n const selectedDevice = useObservableValue(state.selectedDevice$);\n const devices = useObservableValue(devices$);\n const hasBrowserPermission = useObservableValue(state.hasBrowserPermission$);\n const isSpeakingWhileMuted = useObservableValue(state.speakingWhileMuted$);\n const isMute = status !== 'enabled';\n\n return {\n microphone,\n status,\n isEnabled: status === 'enabled',\n mediaStream,\n devices,\n selectedDevice,\n hasBrowserPermission,\n isSpeakingWhileMuted,\n isMute,\n };\n};\n\n/**\n * Returns the speaker state of the current call.\n */\nexport const useSpeakerState = () => {\n const call = useCall();\n const { speaker } = call as Call;\n\n const devices$ = useMemo(() => speaker.listDevices(), [speaker]);\n const devices = useObservableValue(devices$);\n const selectedDevice = useObservableValue(speaker.state.selectedDevice$);\n\n return {\n speaker,\n devices,\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 const call = useCall();\n const { screenShare } = call as Call;\n\n const status = useObservableValue(screenShare.state.status$);\n const mediaStream = useObservableValue(screenShare.state.mediaStream$);\n const isMute = status !== 'enabled';\n\n return {\n screenShare,\n mediaStream,\n status,\n isMute,\n };\n};\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.readOnlyStateStore;\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 *\n * @category Client State\n */\nexport const useCalls = () => {\n const { calls$ } = useStore();\n return useObservableValue(calls$);\n};\n\n/**\n * Returns the current connected user.\n *\n * @category Client State\n */\nexport const useConnectedUser = () => {\n const { connectedUser$ } = useStore();\n return useObservableValue(connectedUser$);\n};\n","import * as CallStateHooks from './callStateHooks';\n\nexport * from './store';\n\n/**\n * A hook-alike function that exposes all call state hooks.\n *\n * @category Call State\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,CAAC;AASrE;;AAEG;AACU,MAAA,kBAAkB,GAAG,CAChC,KAAiD,KAC/C;AACF,IAAA,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;AACjC,IAAA,QACEA,GAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAA,QAAA,EACpC,QAAQ,EAAA,CACkB,EAC7B;AACJ,EAAE;AAEF;;AAEG;AACI,MAAM,OAAO,GAAG,MAAK;AAC1B,IAAA,OAAO,UAAU,CAAC,iBAAiB,CAAC,CAAC;AACvC;;AC7BO,MAAM,aAAa,GAAG,CAC3B,eAAgC,EAChC,SAAiB,KAEjB,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,CAAC;AACzC,IAAA,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAA0B;;ACAxB,MAAM,gBAAgB,GAAG,KAAK;AAC9B,MAAM,iBAAiB,GAAG,eAAe;AAChD,MAAM,cAAc,GAAG;AACrB,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,eAAe,EAAE,gBAAgB;AACjC,IAAA,gBAAgB,EAAE,KAAK;CACf,CAAC;AAEX,MAAM,6BAA6B,GAA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: StreamI18n;
9
9
  language?: string;
10
+ fallbackLanguage?: string;
10
11
  translationsOverrides?: TranslationsMap;
11
12
  };
12
13
  export type StreamI18nProviderProps = CreateI18nParams;
13
14
  export declare const StreamI18nProvider: ({ children, ...createI18nParams }: PropsWithChildren<StreamI18nProviderProps>) => import("react/jsx-runtime").JSX.Element;
14
- export declare const useCreateI18n: ({ i18nInstance, language, translationsOverrides, }: CreateI18nParams) => {
15
+ export declare const useCreateI18n: ({ i18nInstance, language, fallbackLanguage, translationsOverrides, }: CreateI18nParams) => {
15
16
  i18n: StreamI18n;
16
17
  t: import("../i18n").TranslatorFunction;
17
18
  };
@@ -1,4 +1,4 @@
1
- import { CallIngressResponse, CallSessionResponse, CallSettingsResponse, CallState, CallStatsReport, Comparator, EgressResponse, MemberResponse, StreamVideoParticipant, UserResponse } from '@stream-io/video-client';
1
+ import { CallIngressResponse, CallSessionResponse, CallSettingsResponse, CallState, CallStatsReport, Comparator, EgressResponse, MemberResponse, OwnCapability, StreamVideoParticipant, UserResponse } from '@stream-io/video-client';
2
2
  /**
3
3
  * Utility hook, which provides the current call's state.
4
4
  *
@@ -167,6 +167,16 @@ export declare const useAnonymousParticipantCount: () => number;
167
167
  * Returns the generated thumbnail of the current call, if enabled in settings.
168
168
  */
169
169
  export declare const useCallThumbnail: () => import("@stream-io/video-client").ThumbnailResponse | undefined;
170
+ /**
171
+ * A hook which returns the local participant's own capabilities.
172
+ */
173
+ export declare const useOwnCapabilities: () => OwnCapability[] | undefined;
174
+ /**
175
+ * Hook that returns true if the local participant has all the given permissions.
176
+ *
177
+ * @param permissions the permissions to check.
178
+ */
179
+ export declare const useHasPermissions: (...permissions: OwnCapability[]) => boolean;
170
180
  /**
171
181
  * Returns the camera state of the current call.
172
182
  *
@@ -1,5 +1,4 @@
1
1
  import * as CallStateHooks from './callStateHooks';
2
- export * from './permissions';
3
2
  export * from './store';
4
3
  /**
5
4
  * A hook-alike function that exposes all call state hooks.
@@ -5,6 +5,8 @@ export declare const defaultTranslationFunction: (key: string) => string;
5
5
  export type StreamI18nConstructor = {
6
6
  /** Language into which the provided strings are translated */
7
7
  currentLanguage?: TranslationLanguage;
8
+ /** Fallback language which will be used if no translation is found for current language */
9
+ fallbackLanguage?: TranslationLanguage;
8
10
  /** Logs info level to console output. Helps find issues with loading not working. */
9
11
  debug?: boolean;
10
12
  /** Custom translations that will be merged with the defaults provided by the library. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-bindings",
3
- "version": "0.3.22",
3
+ "version": "0.4.0",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
@@ -25,12 +25,12 @@
25
25
  "rxjs": "~7.8.1"
26
26
  },
27
27
  "peerDependencies": {
28
- "@stream-io/video-client": "^0.5.11",
28
+ "@stream-io/video-client": "^0.6.0",
29
29
  "react": ">=17.0.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@rollup/plugin-typescript": "^11.1.5",
33
- "@stream-io/video-client": "^0.5.11",
33
+ "@stream-io/video-client": "^0.6.0",
34
34
  "@types/react": "^18.2.28",
35
35
  "react": "^18.2.0",
36
36
  "rimraf": "^5.0.5",
@@ -23,6 +23,7 @@ const StreamI18nContext = createContext<StreamI18nContextValue>({
23
23
  type CreateI18nParams = {
24
24
  i18nInstance?: StreamI18n;
25
25
  language?: string;
26
+ fallbackLanguage?: string;
26
27
  translationsOverrides?: TranslationsMap;
27
28
  };
28
29
 
@@ -44,12 +45,17 @@ export const StreamI18nProvider = ({
44
45
  export const useCreateI18n = ({
45
46
  i18nInstance,
46
47
  language,
48
+ fallbackLanguage,
47
49
  translationsOverrides,
48
50
  }: CreateI18nParams) => {
49
51
  const [i18n] = useState(
50
52
  () =>
51
53
  i18nInstance ||
52
- new StreamI18n({ currentLanguage: language, translationsOverrides }),
54
+ new StreamI18n({
55
+ currentLanguage: language,
56
+ fallbackLanguage,
57
+ translationsOverrides,
58
+ }),
53
59
  );
54
60
  const [t, setTranslationFn] = useState<StreamI18n['t']>(
55
61
  () => defaultTranslationFunction,
@@ -9,6 +9,7 @@ import {
9
9
  Comparator,
10
10
  EgressResponse,
11
11
  MemberResponse,
12
+ OwnCapability,
12
13
  StreamVideoParticipant,
13
14
  UserResponse,
14
15
  } from '@stream-io/video-client';
@@ -320,6 +321,24 @@ export const useCallThumbnail = () => {
320
321
  return useObservableValue(thumbnails$);
321
322
  };
322
323
 
324
+ /**
325
+ * A hook which returns the local participant's own capabilities.
326
+ */
327
+ export const useOwnCapabilities = (): OwnCapability[] | undefined => {
328
+ const { ownCapabilities$ } = useCallState();
329
+ return useObservableValue(ownCapabilities$);
330
+ };
331
+
332
+ /**
333
+ * Hook that returns true if the local participant has all the given permissions.
334
+ *
335
+ * @param permissions the permissions to check.
336
+ */
337
+ export const useHasPermissions = (...permissions: OwnCapability[]): boolean => {
338
+ const capabilities = useOwnCapabilities();
339
+ return permissions.every((permission) => capabilities?.includes(permission));
340
+ };
341
+
323
342
  /**
324
343
  * Returns the camera state of the current call.
325
344
  *
@@ -1,6 +1,5 @@
1
1
  import * as CallStateHooks from './callStateHooks';
2
2
 
3
- export * from './permissions';
4
3
  export * from './store';
5
4
 
6
5
  /**
@@ -12,7 +12,8 @@ export const DEFAULT_NAMESPACE = 'stream-video';
12
12
  const DEFAULT_CONFIG = {
13
13
  debug: false,
14
14
  currentLanguage: DEFAULT_LANGUAGE,
15
- };
15
+ fallbackLanguage: false,
16
+ } as const;
16
17
 
17
18
  const DEFAULT_TRANSLATIONS_REGISTRY = mapToRegistry({}, DEFAULT_NAMESPACE);
18
19
 
@@ -21,6 +22,8 @@ export const defaultTranslationFunction = (key: string) => key;
21
22
  export type StreamI18nConstructor = {
22
23
  /** Language into which the provided strings are translated */
23
24
  currentLanguage?: TranslationLanguage;
25
+ /** Fallback language which will be used if no translation is found for current language */
26
+ fallbackLanguage?: TranslationLanguage;
24
27
  /** Logs info level to console output. Helps find issues with loading not working. */
25
28
  debug?: boolean;
26
29
  /** Custom translations that will be merged with the defaults provided by the library. */
@@ -37,13 +40,14 @@ export class StreamI18n {
37
40
  const {
38
41
  debug = DEFAULT_CONFIG.debug,
39
42
  currentLanguage = DEFAULT_CONFIG.currentLanguage,
43
+ fallbackLanguage = DEFAULT_CONFIG.fallbackLanguage,
40
44
  translationsOverrides,
41
45
  } = options;
42
46
 
43
47
  this.i18nInstance = i18next.createInstance({
44
48
  debug,
45
49
  defaultNS: DEFAULT_NAMESPACE,
46
- fallbackLng: false,
50
+ fallbackLng: fallbackLanguage,
47
51
  interpolation: { escapeValue: false },
48
52
  keySeparator: false,
49
53
  lng: currentLanguage,
@@ -2,7 +2,7 @@ import { OwnCapability } from '@stream-io/video-client';
2
2
 
3
3
  import { PropsWithChildren } from 'react';
4
4
  import { useCall } from '../contexts';
5
- import { useCallStateHooks, useOwnCapabilities } from '../hooks';
5
+ import { useCallStateHooks } from '../hooks';
6
6
 
7
7
  type RestrictedProps = PropsWithChildren<{
8
8
  /**
@@ -32,8 +32,8 @@ export const Restricted = ({
32
32
  children,
33
33
  }: RestrictedProps) => {
34
34
  const call = useCall();
35
+ const { useCallSettings, useOwnCapabilities } = useCallStateHooks();
35
36
  const ownCapabilities = useOwnCapabilities();
36
- const { useCallSettings } = useCallStateHooks();
37
37
  const settings = useCallSettings();
38
38
  const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](
39
39
  (capability) => ownCapabilities?.includes(capability),
@@ -1,15 +0,0 @@
1
- import { OwnCapability } from '@stream-io/video-client';
2
- /**
3
- * Hook that returns true if the local participant has all the given permissions.
4
- *
5
- * @param permissions the permissions to check.
6
- *
7
- * @category Call State
8
- */
9
- export declare const useHasPermissions: (...permissions: OwnCapability[]) => boolean;
10
- /**
11
- * A hook which returns the local participant's own capabilities.
12
- *
13
- * @category Call State
14
- */
15
- export declare const useOwnCapabilities: () => OwnCapability[] | undefined;
@@ -1,25 +0,0 @@
1
- import { OwnCapability } from '@stream-io/video-client';
2
- import { useCallState } from './callStateHooks';
3
- import { useObservableValue } from './useObservableValue';
4
-
5
- /**
6
- * Hook that returns true if the local participant has all the given permissions.
7
- *
8
- * @param permissions the permissions to check.
9
- *
10
- * @category Call State
11
- */
12
- export const useHasPermissions = (...permissions: OwnCapability[]): boolean => {
13
- const capabilities = useOwnCapabilities();
14
- return permissions.every((permission) => capabilities?.includes(permission));
15
- };
16
-
17
- /**
18
- * A hook which returns the local participant's own capabilities.
19
- *
20
- * @category Call State
21
- */
22
- export const useOwnCapabilities = (): OwnCapability[] | undefined => {
23
- const { ownCapabilities$ } = useCallState();
24
- return useObservableValue(ownCapabilities$);
25
- };