@fishjam-cloud/react-native-client 0.21.0 → 0.22.1

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.
Files changed (77) hide show
  1. package/build/RNFishjamClientModule.d.ts +9 -4
  2. package/build/RNFishjamClientModule.d.ts.map +1 -1
  3. package/build/RNFishjamClientModule.js +1 -0
  4. package/build/RNFishjamClientModule.js.map +1 -1
  5. package/build/components/FishjamRoom/index.d.ts +6 -6
  6. package/build/components/FishjamRoom/index.d.ts.map +1 -1
  7. package/build/components/FishjamRoom/index.js +8 -10
  8. package/build/components/FishjamRoom/index.js.map +1 -1
  9. package/build/hooks/internal/useFishjamEvent.d.ts.map +1 -1
  10. package/build/hooks/internal/useFishjamEvent.js +3 -0
  11. package/build/hooks/internal/useFishjamEvent.js.map +1 -1
  12. package/build/hooks/useCallKit.d.ts +121 -0
  13. package/build/hooks/useCallKit.d.ts.map +1 -0
  14. package/build/hooks/useCallKit.js +142 -0
  15. package/build/hooks/useCallKit.js.map +1 -0
  16. package/build/hooks/useConnection.d.ts +20 -16
  17. package/build/hooks/useConnection.d.ts.map +1 -1
  18. package/build/hooks/useConnection.js +10 -11
  19. package/build/hooks/useConnection.js.map +1 -1
  20. package/build/hooks/useSandbox.d.ts +3 -3
  21. package/build/hooks/useSandbox.d.ts.map +1 -1
  22. package/build/hooks/useSandbox.js +3 -5
  23. package/build/hooks/useSandbox.js.map +1 -1
  24. package/build/index.d.ts +4 -17
  25. package/build/index.d.ts.map +1 -1
  26. package/build/index.js +3 -10
  27. package/build/index.js.map +1 -1
  28. package/build/livestream/components/LivestreamStreamer.d.ts.map +1 -0
  29. package/build/livestream/components/LivestreamStreamer.js.map +1 -0
  30. package/build/livestream/components/LivestreamViewer.d.ts.map +1 -0
  31. package/build/livestream/components/LivestreamViewer.js.map +1 -0
  32. package/build/livestream/hooks/useLivestreamStreamer.d.ts.map +1 -0
  33. package/build/{hooks → livestream/hooks}/useLivestreamStreamer.js +1 -1
  34. package/build/livestream/hooks/useLivestreamStreamer.js.map +1 -0
  35. package/build/livestream/hooks/useLivestreamViewer.d.ts.map +1 -0
  36. package/build/{hooks → livestream/hooks}/useLivestreamViewer.js +1 -1
  37. package/build/livestream/hooks/useLivestreamViewer.js.map +1 -0
  38. package/build/livestream/index.d.ts +11 -0
  39. package/build/livestream/index.d.ts.map +1 -0
  40. package/build/livestream/index.js +6 -0
  41. package/build/livestream/index.js.map +1 -0
  42. package/build/utils/config.d.ts +6 -0
  43. package/build/utils/config.d.ts.map +1 -0
  44. package/build/utils/config.js +10 -0
  45. package/build/utils/config.js.map +1 -0
  46. package/build/utils/eventPayloadValidator.d.ts.map +1 -1
  47. package/build/utils/eventPayloadValidator.js +17 -1
  48. package/build/utils/eventPayloadValidator.js.map +1 -1
  49. package/build/utils/getFishjamUrl.d.ts +2 -0
  50. package/build/utils/getFishjamUrl.d.ts.map +1 -0
  51. package/build/utils/getFishjamUrl.js +10 -0
  52. package/build/utils/getFishjamUrl.js.map +1 -0
  53. package/ios/Events.swift +26 -0
  54. package/ios/RNFishjamClient.swift +40 -4
  55. package/ios/RNFishjamClientModule.swift +221 -211
  56. package/livestream/package.json +4 -0
  57. package/package.json +2 -1
  58. package/plugin/build/types.d.ts +1 -0
  59. package/plugin/build/withFishjamIos.js +12 -0
  60. package/build/common/client.d.ts +0 -25
  61. package/build/common/client.d.ts.map +0 -1
  62. package/build/common/client.js +0 -14
  63. package/build/common/client.js.map +0 -1
  64. package/build/components/LivestreamStreamer.d.ts.map +0 -1
  65. package/build/components/LivestreamStreamer.js.map +0 -1
  66. package/build/components/LivestreamViewer.d.ts.map +0 -1
  67. package/build/components/LivestreamViewer.js.map +0 -1
  68. package/build/hooks/useLivestreamStreamer.d.ts.map +0 -1
  69. package/build/hooks/useLivestreamStreamer.js.map +0 -1
  70. package/build/hooks/useLivestreamViewer.d.ts.map +0 -1
  71. package/build/hooks/useLivestreamViewer.js.map +0 -1
  72. /package/build/{components → livestream/components}/LivestreamStreamer.d.ts +0 -0
  73. /package/build/{components → livestream/components}/LivestreamStreamer.js +0 -0
  74. /package/build/{components → livestream/components}/LivestreamViewer.d.ts +0 -0
  75. /package/build/{components → livestream/components}/LivestreamViewer.js +0 -0
  76. /package/build/{hooks → livestream/hooks}/useLivestreamStreamer.d.ts +0 -0
  77. /package/build/{hooks → livestream/hooks}/useLivestreamViewer.d.ts +0 -0
@@ -1,14 +1,14 @@
1
1
  import { PermissionResponse } from 'expo-modules-core';
2
2
  import type { NativeModule } from 'expo-modules-core/types';
3
- import type { ConnectionConfig } from './common/client';
4
3
  import type { RTCStats } from './debug/stats/types';
5
4
  import type { OnAudioDeviceEvent } from './hooks/useAudioSettings';
6
5
  import type { Camera, CameraConfigInternal, CurrentCameraChangedType } from './hooks/useCamera';
7
- import type { PeerStatus, ReconnectionStatus } from './hooks/useConnection';
6
+ import type { PeerStatus, ReconnectionStatus, ConnectionConfig } from './hooks/useConnection';
8
7
  import type { ForegroundServiceConfig } from './hooks/useForegroundService';
9
8
  import type { Peer } from './hooks/usePeers';
10
9
  import type { ScreenShareOptionsInternal } from './hooks/useScreenShare';
11
10
  import type { GenericMetadata, SimulcastConfig } from './types';
11
+ import type { CallKitAction } from './hooks/useCallKit';
12
12
  type Metadata = {
13
13
  [key: string]: unknown;
14
14
  };
@@ -22,6 +22,7 @@ type RNFishjamClient = {
22
22
  peerStatus: PeerStatus;
23
23
  reconnectionStatus: ReconnectionStatus;
24
24
  isCameraInitialized: boolean;
25
+ hasActiveCallKitSession: boolean;
25
26
  getPeers: <PeerMetadataType extends Metadata, ServerMetadata extends Metadata = GenericMetadata>() => Peer<PeerMetadataType, ServerMetadata>[];
26
27
  joinRoom: (url: string, peerToken: string, peerMetadata: Metadata, config: ConnectionConfig) => Promise<void>;
27
28
  leaveRoom: () => Promise<void>;
@@ -50,12 +51,14 @@ type RNFishjamClient = {
50
51
  setVideoTrackBandwidth: (bandwidth: number) => Promise<void>;
51
52
  changeWebRTCLoggingSeverity: (severity: string) => Promise<void>;
52
53
  getStatistics: () => Promise<RTCStats>;
53
- startForegroundService: (config: ForegroundServiceConfig) => Promise<void>;
54
- stopForegroundService: () => void;
55
54
  getCameraPermissionsAsync: () => Promise<PermissionResponse>;
56
55
  requestCameraPermissionsAsync: () => Promise<PermissionResponse>;
57
56
  getMicrophonePermissionsAsync: () => Promise<PermissionResponse>;
58
57
  requestMicrophonePermissionsAsync: () => Promise<PermissionResponse>;
58
+ startForegroundService: (config: ForegroundServiceConfig) => Promise<void>;
59
+ stopForegroundService: () => void;
60
+ startCallKitSession: (displayName: string, isVideo: boolean) => Promise<void>;
61
+ endCallKitSession: () => Promise<void>;
59
62
  };
60
63
  export declare const ReceivableEvents: {
61
64
  readonly IsMicrophoneOn: "IsMicrophoneOn";
@@ -73,6 +76,7 @@ export declare const ReceivableEvents: {
73
76
  readonly ReconnectionStatusChanged: "ReconnectionStatusChanged";
74
77
  readonly CurrentCameraChanged: "CurrentCameraChanged";
75
78
  readonly TrackAspectRatioUpdated: "TrackAspectRatioUpdated";
79
+ readonly CallKitActionPerformed: "CallKitActionPerformed";
76
80
  };
77
81
  export type ReceivableEventPayloads = {
78
82
  [ReceivableEvents.IsMicrophoneOn]: boolean;
@@ -93,6 +97,7 @@ export type ReceivableEventPayloads = {
93
97
  trackId: string;
94
98
  aspectRatio: number | null;
95
99
  };
100
+ [ReceivableEvents.CallKitActionPerformed]: CallKitAction;
96
101
  };
97
102
  declare const _default: RNFishjamClient & NativeModule<Record<keyof typeof ReceivableEvents, (payload: ReceivableEventPayloads) => void>>;
98
103
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"RNFishjamClientModule.d.ts","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE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gBAAgB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IACjD,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,EAAE,kBAAkB,CAAC;IACjE,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,EAAE,wBAAwB,CAAC;IAClE,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,EAAE;QAC1C,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;KAC5B,CAAC;IACF,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,EAAE,aAAa,CAAC;CAC1D,CAAC;wBAEuD,eAAe,GACtE,YAAY,CACV,MAAM,CACJ,MAAM,OAAO,gBAAgB,EAC7B,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAC3C,CACF;AANH,wBAMI"}
@@ -15,6 +15,7 @@ export const ReceivableEvents = {
15
15
  ReconnectionStatusChanged: 'ReconnectionStatusChanged',
16
16
  CurrentCameraChanged: 'CurrentCameraChanged',
17
17
  TrackAspectRatioUpdated: 'TrackAspectRatioUpdated',
18
+ CallKitActionPerformed: 'CallKitActionPerformed',
18
19
  };
19
20
  export default requireNativeModule('RNFishjamClient');
20
21
  //# sourceMappingURL=RNFishjamClientModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RNFishjamClientModule.js","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA6F5E,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB,EAAE,eAAe;IACzD,qBAAqB,EAAE,uBAAuB;IAC9C,WAAW,EAAE,aAAa;IAC1B,iBAAiB,EAAE,mBAAmB;IACtC,mBAAmB,EAAE,qBAAqB;IAC1C,+BAA+B,EAAE,iCAAiC;IAClE,mBAAmB,EAAE,qBAAqB;IAC1C,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,SAAS;IAClB,iBAAiB,EAAE,mBAAmB;IACtC,yBAAyB,EAAE,2BAA2B;IACtD,oBAAoB,EAAE,sBAAsB;IAC5C,uBAAuB,EAAE,yBAAyB;CAC1C,CAAC;AAuBX,eAAe,mBAAmB,CAAC,iBAAiB,CAMjD,CAAC","sourcesContent":["import { PermissionResponse, requireNativeModule } from 'expo-modules-core';\n\nimport type { NativeModule } from 'expo-modules-core/types';\nimport type { ConnectionConfig } from './common/client';\nimport type { RTCStats } from './debug/stats/types';\nimport type { OnAudioDeviceEvent } from './hooks/useAudioSettings';\nimport type {\n Camera,\n CameraConfigInternal,\n CurrentCameraChangedType,\n} from './hooks/useCamera';\nimport type { PeerStatus, ReconnectionStatus } from './hooks/useConnection';\nimport type { ForegroundServiceConfig } from './hooks/useForegroundService';\nimport type { Peer } from './hooks/usePeers';\nimport type { ScreenShareOptionsInternal } from './hooks/useScreenShare';\nimport type { GenericMetadata, SimulcastConfig } from './types';\n\ntype Metadata = { [key: string]: unknown };\n\ntype RNFishjamClient = {\n isMicrophoneOn: boolean;\n isCameraOn: boolean;\n isScreenShareOn: boolean;\n isAppScreenShareOn: boolean; // only available on ios\n cameras: readonly Camera[];\n currentCamera: Camera | null;\n peerStatus: PeerStatus;\n reconnectionStatus: ReconnectionStatus;\n isCameraInitialized: boolean;\n\n getPeers: <\n PeerMetadataType extends Metadata,\n ServerMetadata extends Metadata = GenericMetadata,\n >() => Peer<PeerMetadataType, ServerMetadata>[];\n\n joinRoom: (\n url: string,\n peerToken: string,\n peerMetadata: Metadata,\n config: ConnectionConfig,\n ) => Promise<void>;\n leaveRoom: () => Promise<void>;\n startCamera: (config: CameraConfigInternal) => Promise<boolean>;\n toggleMicrophone: () => Promise<boolean>;\n toggleCamera: () => Promise<boolean>;\n flipCamera: () => Promise<void>;\n switchCamera: (cameraId: string) => Promise<void>;\n handleScreenSharePermission: () => Promise<'granted' | 'denied'>;\n toggleScreenShare: (\n screenShareOptions: Partial<ScreenShareOptionsInternal>,\n ) => Promise<void>;\n toggleAppScreenShare: (\n screenShareOptions: Partial<ScreenShareOptionsInternal>,\n ) => Promise<void>;\n updatePeerMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateVideoTrackMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateScreenShareTrackMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n setOutputAudioDevice: (audioDevice: string) => Promise<void>;\n startAudioSwitcher: () => Promise<void>;\n stopAudioSwitcher: () => Promise<void>;\n selectAudioSessionMode: (sessionMode: string) => Promise<void>;\n showAudioRoutePicker: () => Promise<void>;\n toggleScreenShareTrackEncoding: (\n encoding: string,\n ) => Promise<SimulcastConfig>;\n setScreenShareTrackBandwidth: (bandwidth: number) => Promise<void>;\n setScreenShareTrackEncodingBandwidth: (\n encoding: string,\n bandwidth: number,\n ) => Promise<void>;\n setTargetTrackEncoding: (trackId: string, encoding: string) => Promise<void>;\n toggleVideoTrackEncoding: (encoding: string) => Promise<SimulcastConfig>;\n setVideoTrackEncodingBandwidth: (\n encoding: string,\n bandwidth: number,\n ) => Promise<void>;\n setVideoTrackBandwidth: (bandwidth: number) => Promise<void>;\n changeWebRTCLoggingSeverity: (severity: string) => Promise<void>;\n getStatistics: () => Promise<RTCStats>;\n startForegroundService: (config: ForegroundServiceConfig) => Promise<void>;\n stopForegroundService: () => void;\n getCameraPermissionsAsync: () => Promise<PermissionResponse>;\n requestCameraPermissionsAsync: () => Promise<PermissionResponse>;\n getMicrophonePermissionsAsync: () => Promise<PermissionResponse>;\n requestMicrophonePermissionsAsync: () => Promise<PermissionResponse>;\n};\n\nexport const ReceivableEvents = {\n IsMicrophoneOn: 'IsMicrophoneOn',\n IsScreenShareOn: 'IsScreenShareOn',\n IsAppScreenShareOn: 'IsAppScreenShareOn', // only for iOS\n SimulcastConfigUpdate: 'SimulcastConfigUpdate',\n PeersUpdate: 'PeersUpdate',\n AudioDeviceUpdate: 'AudioDeviceUpdate',\n BandwidthEstimation: 'BandwidthEstimation',\n ReconnectionRetriesLimitReached: 'ReconnectionRetriesLimitReached',\n ReconnectionStarted: 'ReconnectionStarted',\n Reconnected: 'Reconnected',\n Warning: 'Warning',\n PeerStatusChanged: 'PeerStatusChanged',\n ReconnectionStatusChanged: 'ReconnectionStatusChanged',\n CurrentCameraChanged: 'CurrentCameraChanged',\n TrackAspectRatioUpdated: 'TrackAspectRatioUpdated',\n} as const;\n\nexport type ReceivableEventPayloads = {\n [ReceivableEvents.IsMicrophoneOn]: boolean;\n [ReceivableEvents.IsScreenShareOn]: boolean;\n [ReceivableEvents.IsAppScreenShareOn]: boolean;\n [ReceivableEvents.SimulcastConfigUpdate]: SimulcastConfig;\n [ReceivableEvents.PeersUpdate]: void;\n [ReceivableEvents.AudioDeviceUpdate]: OnAudioDeviceEvent;\n [ReceivableEvents.BandwidthEstimation]: number | null;\n [ReceivableEvents.ReconnectionRetriesLimitReached]: void;\n [ReceivableEvents.ReconnectionStarted]: void;\n [ReceivableEvents.Reconnected]: void;\n [ReceivableEvents.Warning]: string;\n [ReceivableEvents.PeerStatusChanged]: PeerStatus;\n [ReceivableEvents.ReconnectionStatusChanged]: ReconnectionStatus;\n [ReceivableEvents.CurrentCameraChanged]: CurrentCameraChangedType;\n [ReceivableEvents.TrackAspectRatioUpdated]: {\n trackId: string;\n aspectRatio: number | null;\n };\n};\n\nexport default requireNativeModule('RNFishjamClient') as RNFishjamClient &\n NativeModule<\n Record<\n keyof typeof ReceivableEvents,\n (payload: ReceivableEventPayloads) => void\n >\n >;\n"]}
1
+ {"version":3,"file":"RNFishjamClientModule.js","sourceRoot":"","sources":["../src/RNFishjamClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAoG5E,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB,EAAE,eAAe;IACzD,qBAAqB,EAAE,uBAAuB;IAC9C,WAAW,EAAE,aAAa;IAC1B,iBAAiB,EAAE,mBAAmB;IACtC,mBAAmB,EAAE,qBAAqB;IAC1C,+BAA+B,EAAE,iCAAiC;IAClE,mBAAmB,EAAE,qBAAqB;IAC1C,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,SAAS;IAClB,iBAAiB,EAAE,mBAAmB;IACtC,yBAAyB,EAAE,2BAA2B;IACtD,oBAAoB,EAAE,sBAAsB;IAC5C,uBAAuB,EAAE,yBAAyB;IAClD,sBAAsB,EAAE,wBAAwB;CACxC,CAAC;AAwBX,eAAe,mBAAmB,CAAC,iBAAiB,CAMjD,CAAC","sourcesContent":["import { PermissionResponse, requireNativeModule } from 'expo-modules-core';\n\nimport type { NativeModule } from 'expo-modules-core/types';\nimport type { RTCStats } from './debug/stats/types';\nimport type { OnAudioDeviceEvent } from './hooks/useAudioSettings';\nimport type {\n Camera,\n CameraConfigInternal,\n CurrentCameraChangedType,\n} from './hooks/useCamera';\nimport type {\n PeerStatus,\n ReconnectionStatus,\n ConnectionConfig,\n} from './hooks/useConnection';\nimport type { ForegroundServiceConfig } from './hooks/useForegroundService';\nimport type { Peer } from './hooks/usePeers';\nimport type { ScreenShareOptionsInternal } from './hooks/useScreenShare';\nimport type { GenericMetadata, SimulcastConfig } from './types';\nimport type { CallKitAction } from './hooks/useCallKit';\n\ntype Metadata = { [key: string]: unknown };\n\ntype RNFishjamClient = {\n isMicrophoneOn: boolean;\n isCameraOn: boolean;\n isScreenShareOn: boolean;\n isAppScreenShareOn: boolean; // only available on ios\n cameras: readonly Camera[];\n currentCamera: Camera | null;\n peerStatus: PeerStatus;\n reconnectionStatus: ReconnectionStatus;\n isCameraInitialized: boolean;\n hasActiveCallKitSession: boolean;\n\n getPeers: <\n PeerMetadataType extends Metadata,\n ServerMetadata extends Metadata = GenericMetadata,\n >() => Peer<PeerMetadataType, ServerMetadata>[];\n\n joinRoom: (\n url: string,\n peerToken: string,\n peerMetadata: Metadata,\n config: ConnectionConfig,\n ) => Promise<void>;\n leaveRoom: () => Promise<void>;\n startCamera: (config: CameraConfigInternal) => Promise<boolean>;\n toggleMicrophone: () => Promise<boolean>;\n toggleCamera: () => Promise<boolean>;\n flipCamera: () => Promise<void>;\n switchCamera: (cameraId: string) => Promise<void>;\n handleScreenSharePermission: () => Promise<'granted' | 'denied'>;\n toggleScreenShare: (\n screenShareOptions: Partial<ScreenShareOptionsInternal>,\n ) => Promise<void>;\n toggleAppScreenShare: (\n screenShareOptions: Partial<ScreenShareOptionsInternal>,\n ) => Promise<void>;\n updatePeerMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateVideoTrackMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n updateScreenShareTrackMetadata: <MetadataType extends Metadata>(\n metadata: MetadataType,\n ) => Promise<void>;\n setOutputAudioDevice: (audioDevice: string) => Promise<void>;\n startAudioSwitcher: () => Promise<void>;\n stopAudioSwitcher: () => Promise<void>;\n selectAudioSessionMode: (sessionMode: string) => Promise<void>;\n showAudioRoutePicker: () => Promise<void>;\n toggleScreenShareTrackEncoding: (\n encoding: string,\n ) => Promise<SimulcastConfig>;\n setScreenShareTrackBandwidth: (bandwidth: number) => Promise<void>;\n setScreenShareTrackEncodingBandwidth: (\n encoding: string,\n bandwidth: number,\n ) => Promise<void>;\n setTargetTrackEncoding: (trackId: string, encoding: string) => Promise<void>;\n toggleVideoTrackEncoding: (encoding: string) => Promise<SimulcastConfig>;\n setVideoTrackEncodingBandwidth: (\n encoding: string,\n bandwidth: number,\n ) => Promise<void>;\n setVideoTrackBandwidth: (bandwidth: number) => Promise<void>;\n changeWebRTCLoggingSeverity: (severity: string) => Promise<void>;\n getStatistics: () => Promise<RTCStats>;\n getCameraPermissionsAsync: () => Promise<PermissionResponse>;\n requestCameraPermissionsAsync: () => Promise<PermissionResponse>;\n getMicrophonePermissionsAsync: () => Promise<PermissionResponse>;\n requestMicrophonePermissionsAsync: () => Promise<PermissionResponse>;\n startForegroundService: (config: ForegroundServiceConfig) => Promise<void>;\n stopForegroundService: () => void;\n startCallKitSession: (displayName: string, isVideo: boolean) => Promise<void>;\n endCallKitSession: () => Promise<void>;\n};\n\nexport const ReceivableEvents = {\n IsMicrophoneOn: 'IsMicrophoneOn',\n IsScreenShareOn: 'IsScreenShareOn',\n IsAppScreenShareOn: 'IsAppScreenShareOn', // only for iOS\n SimulcastConfigUpdate: 'SimulcastConfigUpdate',\n PeersUpdate: 'PeersUpdate',\n AudioDeviceUpdate: 'AudioDeviceUpdate',\n BandwidthEstimation: 'BandwidthEstimation',\n ReconnectionRetriesLimitReached: 'ReconnectionRetriesLimitReached',\n ReconnectionStarted: 'ReconnectionStarted',\n Reconnected: 'Reconnected',\n Warning: 'Warning',\n PeerStatusChanged: 'PeerStatusChanged',\n ReconnectionStatusChanged: 'ReconnectionStatusChanged',\n CurrentCameraChanged: 'CurrentCameraChanged',\n TrackAspectRatioUpdated: 'TrackAspectRatioUpdated',\n CallKitActionPerformed: 'CallKitActionPerformed',\n} as const;\n\nexport type ReceivableEventPayloads = {\n [ReceivableEvents.IsMicrophoneOn]: boolean;\n [ReceivableEvents.IsScreenShareOn]: boolean;\n [ReceivableEvents.IsAppScreenShareOn]: boolean;\n [ReceivableEvents.SimulcastConfigUpdate]: SimulcastConfig;\n [ReceivableEvents.PeersUpdate]: void;\n [ReceivableEvents.AudioDeviceUpdate]: OnAudioDeviceEvent;\n [ReceivableEvents.BandwidthEstimation]: number | null;\n [ReceivableEvents.ReconnectionRetriesLimitReached]: void;\n [ReceivableEvents.ReconnectionStarted]: void;\n [ReceivableEvents.Reconnected]: void;\n [ReceivableEvents.Warning]: string;\n [ReceivableEvents.PeerStatusChanged]: PeerStatus;\n [ReceivableEvents.ReconnectionStatusChanged]: ReconnectionStatus;\n [ReceivableEvents.CurrentCameraChanged]: CurrentCameraChangedType;\n [ReceivableEvents.TrackAspectRatioUpdated]: {\n trackId: string;\n aspectRatio: number | null;\n };\n [ReceivableEvents.CallKitActionPerformed]: CallKitAction;\n};\n\nexport default requireNativeModule('RNFishjamClient') as RNFishjamClient &\n NativeModule<\n Record<\n keyof typeof ReceivableEvents,\n (payload: ReceivableEventPayloads) => void\n >\n >;\n"]}
@@ -1,8 +1,8 @@
1
1
  export type FishjamRoomProps = {
2
2
  /**
3
- * URL to your fishjam instance
3
+ * ID of your fishjam instance
4
4
  */
5
- fishjamUrl: string;
5
+ fishjamId: string;
6
6
  /**
7
7
  * Peer Token
8
8
  */
@@ -16,18 +16,18 @@ export type FishjamRoomProps = {
16
16
  * import { FishjamRoom } from '@fishjam-cloud/react-native-client';
17
17
  * import React from 'react';
18
18
  *
19
- * const FISHJAM_URL = 'https://fishjam.io/your_fishjam';
19
+ * const FISHJAM_ID = 'your-fishjam_id';
20
20
  * const PEER_TOKEN = 'your-peer-token';
21
21
  *
22
22
  * <FishjamRoom
23
- * fishjamUrl={FISHJAM_URL}
23
+ * fishjamId={FISHJAM_ID}
24
24
  * peerToken={PEER_TOKEN}
25
25
  * />
26
26
  * ```
27
27
  * @category Components
28
28
  * @param {object} props
29
- * @param {string} props.fishjamUrl
29
+ * @param {string} props.fishjamId
30
30
  * @param {string} props.peerToken
31
31
  */
32
- export declare const FishjamRoom: ({ fishjamUrl, peerToken }: FishjamRoomProps) => import("react").JSX.Element;
32
+ export declare const FishjamRoom: ({ fishjamId, peerToken }: FishjamRoomProps) => import("react").JSX.Element;
33
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FishjamRoom/index.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW,GAAI,2BAA2B,gBAAgB,gCA8BtE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FishjamRoom/index.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW,GAAI,0BAA0B,gBAAgB,gCA4BrE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { useEffect } from 'react';
2
- import { joinRoom, leaveRoom } from '../../common/client';
3
2
  import { useCamera } from '../../hooks/useCamera';
3
+ import { useConnection } from '../../hooks/useConnection';
4
4
  import { VideosGrid } from './VideosGrid';
5
5
  import { SafeAreaView } from 'react-native';
6
6
  /**
@@ -11,21 +11,22 @@ import { SafeAreaView } from 'react-native';
11
11
  * import { FishjamRoom } from '@fishjam-cloud/react-native-client';
12
12
  * import React from 'react';
13
13
  *
14
- * const FISHJAM_URL = 'https://fishjam.io/your_fishjam';
14
+ * const FISHJAM_ID = 'your-fishjam_id';
15
15
  * const PEER_TOKEN = 'your-peer-token';
16
16
  *
17
17
  * <FishjamRoom
18
- * fishjamUrl={FISHJAM_URL}
18
+ * fishjamId={FISHJAM_ID}
19
19
  * peerToken={PEER_TOKEN}
20
20
  * />
21
21
  * ```
22
22
  * @category Components
23
23
  * @param {object} props
24
- * @param {string} props.fishjamUrl
24
+ * @param {string} props.fishjamId
25
25
  * @param {string} props.peerToken
26
26
  */
27
- export const FishjamRoom = ({ fishjamUrl, peerToken }) => {
27
+ export const FishjamRoom = ({ fishjamId, peerToken }) => {
28
28
  const { prepareCamera } = useCamera();
29
+ const { leaveRoom, joinRoom } = useConnection();
29
30
  useEffect(() => {
30
31
  const join = async () => {
31
32
  try {
@@ -34,10 +35,7 @@ export const FishjamRoom = ({ fishjamUrl, peerToken }) => {
34
35
  quality: 'HD169',
35
36
  cameraEnabled: true,
36
37
  });
37
- await joinRoom(fishjamUrl, peerToken, {
38
- peer: {},
39
- server: {},
40
- });
38
+ await joinRoom({ fishjamId, peerToken });
41
39
  }
42
40
  catch (e) {
43
41
  console.warn(e);
@@ -47,7 +45,7 @@ export const FishjamRoom = ({ fishjamUrl, peerToken }) => {
47
45
  return () => {
48
46
  leaveRoom();
49
47
  };
50
- }, [fishjamUrl, peerToken, prepareCamera]);
48
+ }, [fishjamId, peerToken, prepareCamera, joinRoom, leaveRoom]);
51
49
  return (<SafeAreaView>
52
50
  <VideosGrid />
53
51
  </SafeAreaView>);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FishjamRoom/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAa5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,UAAU,EAAE,SAAS,EAAoB,EAAE,EAAE;IACzE,MAAM,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,CAAC;IAEtC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;YACtB,IAAI,CAAC;gBACH,MAAM,aAAa,CAAC;oBAClB,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE,OAAO;oBAChB,aAAa,EAAE,IAAI;iBACpB,CAAC,CAAC;gBACH,MAAM,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE;oBACpC,IAAI,EAAE,EAAE;oBACR,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC;QACF,IAAI,EAAE,CAAC;QACP,OAAO,GAAG,EAAE;YACV,SAAS,EAAE,CAAC;QACd,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;IAE3C,OAAO,CACL,CAAC,YAAY,CACX;MAAA,CAAC,UAAU,CAAC,AAAD,EACb;IAAA,EAAE,YAAY,CAAC,CAChB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useEffect } from 'react';\nimport { joinRoom, leaveRoom } from '../../common/client';\nimport { useCamera } from '../../hooks/useCamera';\nimport { VideosGrid } from './VideosGrid';\nimport { SafeAreaView } from 'react-native';\n\nexport type FishjamRoomProps = {\n /**\n * URL to your fishjam instance\n */\n fishjamUrl: string;\n /**\n * Peer Token\n */\n peerToken: string;\n};\n\n/**\n * Simple component that enables your camera and show all tracks\n *\n * Example usage:\n * ```tsx\n * import { FishjamRoom } from '@fishjam-cloud/react-native-client';\n * import React from 'react';\n *\n * const FISHJAM_URL = 'https://fishjam.io/your_fishjam';\n * const PEER_TOKEN = 'your-peer-token';\n *\n * <FishjamRoom\n * fishjamUrl={FISHJAM_URL}\n * peerToken={PEER_TOKEN}\n * />\n * ```\n * @category Components\n * @param {object} props\n * @param {string} props.fishjamUrl\n * @param {string} props.peerToken\n */\nexport const FishjamRoom = ({ fishjamUrl, peerToken }: FishjamRoomProps) => {\n const { prepareCamera } = useCamera();\n\n useEffect(() => {\n const join = async () => {\n try {\n await prepareCamera({\n simulcastEnabled: true,\n quality: 'HD169',\n cameraEnabled: true,\n });\n await joinRoom(fishjamUrl, peerToken, {\n peer: {},\n server: {},\n });\n } catch (e) {\n console.warn(e);\n }\n };\n join();\n return () => {\n leaveRoom();\n };\n }, [fishjamUrl, peerToken, prepareCamera]);\n\n return (\n <SafeAreaView>\n <VideosGrid />\n </SafeAreaView>\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FishjamRoom/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAa5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAAoB,EAAE,EAAE;IACxE,MAAM,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,CAAC;IACtC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,CAAC;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;YACtB,IAAI,CAAC;gBACH,MAAM,aAAa,CAAC;oBAClB,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE,OAAO;oBAChB,aAAa,EAAE,IAAI;iBACpB,CAAC,CAAC;gBACH,MAAM,QAAQ,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;YAC3C,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC;QACF,IAAI,EAAE,CAAC;QACP,OAAO,GAAG,EAAE;YACV,SAAS,EAAE,CAAC;QACd,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAE/D,OAAO,CACL,CAAC,YAAY,CACX;MAAA,CAAC,UAAU,CAAC,AAAD,EACb;IAAA,EAAE,YAAY,CAAC,CAChB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useEffect } from 'react';\nimport { useCamera } from '../../hooks/useCamera';\nimport { useConnection } from '../../hooks/useConnection';\nimport { VideosGrid } from './VideosGrid';\nimport { SafeAreaView } from 'react-native';\n\nexport type FishjamRoomProps = {\n /**\n * ID of your fishjam instance\n */\n fishjamId: string;\n /**\n * Peer Token\n */\n peerToken: string;\n};\n\n/**\n * Simple component that enables your camera and show all tracks\n *\n * Example usage:\n * ```tsx\n * import { FishjamRoom } from '@fishjam-cloud/react-native-client';\n * import React from 'react';\n *\n * const FISHJAM_ID = 'your-fishjam_id';\n * const PEER_TOKEN = 'your-peer-token';\n *\n * <FishjamRoom\n * fishjamId={FISHJAM_ID}\n * peerToken={PEER_TOKEN}\n * />\n * ```\n * @category Components\n * @param {object} props\n * @param {string} props.fishjamId\n * @param {string} props.peerToken\n */\nexport const FishjamRoom = ({ fishjamId, peerToken }: FishjamRoomProps) => {\n const { prepareCamera } = useCamera();\n const { leaveRoom, joinRoom } = useConnection();\n\n useEffect(() => {\n const join = async () => {\n try {\n await prepareCamera({\n simulcastEnabled: true,\n quality: 'HD169',\n cameraEnabled: true,\n });\n await joinRoom({ fishjamId, peerToken });\n } catch (e) {\n console.warn(e);\n }\n };\n join();\n return () => {\n leaveRoom();\n };\n }, [fishjamId, peerToken, prepareCamera, joinRoom, leaveRoom]);\n\n return (\n <SafeAreaView>\n <VideosGrid />\n </SafeAreaView>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useFishjamEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/internal/useFishjamEvent.ts"],"names":[],"mappings":"AAEA,OAAqB,EACnB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAGrC,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,OAAO,gBAAgB,EACrE,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAAK,IAAI,QActD;AAED,wBAAgB,0BAA0B,CACxC,CAAC,SAAS,MAAM,OAAO,gBAAgB,EACvC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,IAAI,CAsBzD"}
1
+ {"version":3,"file":"useFishjamEvent.d.ts","sourceRoot":"","sources":["../../../src/hooks/internal/useFishjamEvent.ts"],"names":[],"mappings":"AAEA,OAAqB,EACnB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAIrC,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,OAAO,gBAAgB,EACrE,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAAK,IAAI,QActD;AAED,wBAAgB,0BAA0B,CACxC,CAAC,SAAS,MAAM,OAAO,gBAAgB,EACvC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,IAAI,CAwBzD"}
@@ -2,6 +2,7 @@ import { ZodError } from 'zod';
2
2
  import { useEffect } from 'react';
3
3
  import nativeModule from '../../RNFishjamClientModule';
4
4
  import { validateNativeEventPayload } from '../../utils/eventPayloadValidator';
5
+ import { getDebugConfig } from '../../utils/config';
5
6
  export function useFishjamEvent(eventName, callback) {
6
7
  useEffect(() => {
7
8
  const eventListener = nativeModule.addListener(eventName, (event) => {
@@ -18,6 +19,8 @@ export function validateAndLogEventPayload(eventName, payload) {
18
19
  // Double check just to make sure
19
20
  if (!__DEV__)
20
21
  return;
22
+ if (!getDebugConfig().validateEventPayloads)
23
+ return;
21
24
  try {
22
25
  validateNativeEventPayload(eventName,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AAG,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;iBACvD,IAAI,CAAC,IAAI,CAAC,EACb,iBAAiB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CACxD,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CACX,iDAAiD,SAAS,GAAG,EAC7D,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { ZodError } from 'zod';\nimport { useEffect } from 'react';\nimport nativeModule, {\n ReceivableEvents,\n ReceivableEventPayloads,\n} from '../../RNFishjamClientModule';\nimport { validateNativeEventPayload } from '../../utils/eventPayloadValidator';\n\nexport function useFishjamEvent<T extends keyof typeof ReceivableEvents>(\n eventName: T,\n callback: (event: ReceivableEventPayloads[T]) => void,\n) {\n useEffect(() => {\n const eventListener = nativeModule.addListener(eventName, (event) => {\n const payload = event[eventName];\n\n if (__DEV__) {\n validateAndLogEventPayload(eventName, payload);\n }\n\n callback(payload);\n });\n return () => eventListener.remove();\n }, [callback, eventName]);\n}\n\nexport function validateAndLogEventPayload<\n T extends keyof typeof ReceivableEvents,\n>(eventName: T, payload: ReceivableEventPayloads[T]): void {\n // Double check just to make sure\n if (!__DEV__) return;\n\n try {\n validateNativeEventPayload(eventName, payload);\n } catch (error) {\n if (error instanceof ZodError) {\n console.error(\n `Invalid payload received for event ${eventName}:\\n`,\n error.errors\n .map((err) => `- ${err.path.join('.')}: ${err.message}`)\n .join('\\n'),\n `\\n Received:\\n${JSON.stringify(payload, null, 2)}\\n\\n`,\n );\n } else {\n console.error(\n `Unexpected error validating payload for event ${eventName}:`,\n error,\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"useFishjamEvent.js","sourceRoot":"","sources":["../../../src/hooks/internal/useFishjamEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,SAA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EACb,iBAAiB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CACxD,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CACX,iDAAiD,SAAS,GAAG,EAC7D,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { ZodError } from 'zod';\nimport { useEffect } from 'react';\nimport nativeModule, {\n ReceivableEvents,\n ReceivableEventPayloads,\n} from '../../RNFishjamClientModule';\nimport { validateNativeEventPayload } from '../../utils/eventPayloadValidator';\nimport { getDebugConfig } from '../../utils/config';\n\nexport function useFishjamEvent<T extends keyof typeof ReceivableEvents>(\n eventName: T,\n callback: (event: ReceivableEventPayloads[T]) => void,\n) {\n useEffect(() => {\n const eventListener = nativeModule.addListener(eventName, (event) => {\n const payload = event[eventName];\n\n if (__DEV__) {\n validateAndLogEventPayload(eventName, payload);\n }\n\n callback(payload);\n });\n return () => eventListener.remove();\n }, [callback, eventName]);\n}\n\nexport function validateAndLogEventPayload<\n T extends keyof typeof ReceivableEvents,\n>(eventName: T, payload: ReceivableEventPayloads[T]): void {\n // Double check just to make sure\n if (!__DEV__) return;\n\n if (!getDebugConfig().validateEventPayloads) return;\n\n try {\n validateNativeEventPayload(eventName, payload);\n } catch (error) {\n if (error instanceof ZodError) {\n console.error(\n `Invalid payload received for event ${eventName}:\\n`,\n error.errors\n .map((err) => `- ${err.path.join('.')}: ${err.message}`)\n .join('\\n'),\n `\\n Received:\\n${JSON.stringify(payload, null, 2)}\\n\\n`,\n );\n } else {\n console.error(\n `Unexpected error validating payload for event ${eventName}:`,\n error,\n );\n }\n }\n}\n"]}
@@ -0,0 +1,121 @@
1
+ export type CallKitAction = {
2
+ ['started']: undefined;
3
+ ['ended']: undefined;
4
+ ['failed']: string;
5
+ ['muted']: boolean;
6
+ ['held']: boolean;
7
+ };
8
+ export type UseCallKitResult = {
9
+ /**
10
+ * Starts a CallKit session for the current call
11
+ * @param config - Configuration object containing displayName and isVideo
12
+ */
13
+ startCallKitSession: (config: CallKitConfig) => Promise<void>;
14
+ /**
15
+ * Ends the current CallKit session
16
+ */
17
+ endCallKitSession: () => Promise<void>;
18
+ /**
19
+ * Returns whether there is currently an active CallKit session
20
+ */
21
+ getCallKitSessionStatus: () => Promise<boolean>;
22
+ };
23
+ export type CallKitConfig = {
24
+ /**
25
+ * The name to display in the CallKit UI
26
+ */
27
+ displayName: string;
28
+ /**
29
+ * Whether the should support video
30
+ */
31
+ isVideo: boolean;
32
+ };
33
+ declare function useCallKitIos(): UseCallKitResult;
34
+ declare const useCallKitServiceIos: (config: CallKitConfig) => void;
35
+ declare const useCallKitEventIos: <T extends keyof CallKitAction>(action: T, callback: (event: CallKitAction[T]) => void) => void;
36
+ /**
37
+ * A hook for listening to CallKit actions on iOS. Does nothing on other platforms.
38
+ * This hook allows you to respond to user interactions with the native iOS CallKit interface,
39
+ * such as muting/unmuting the call, putting the call on hold, or ending the call from the
40
+ * system's phone UI or lock screen controls.
41
+ *
42
+ * @param {keyof CallKitAction} action - The CallKit action to listen for. Available actions:
43
+ * - `'started'` - CallKit session has started
44
+ * - `'ended'` - User ended the call from CallKit UI
45
+ * - `'failed'` - CallKit session failed to start
46
+ * - `'muted'` - User toggled mute from CallKit UI
47
+ * - `'held'` - User toggled hold from CallKit UI
48
+ *
49
+ * @param {Function} callback - Function called when the specified action occurs.
50
+ *
51
+ * @group Hooks
52
+ * @category Connection
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * import { useCallKitEvent } from '@fishjam-cloud/react-native-client';
57
+ *
58
+ * // Listen for hold state changes
59
+ * useCallKitEvent('held', (isOnHold: boolean) => {
60
+ * console.log('Call hold state:', isOnHold);
61
+ * // Handle hold state in your app
62
+ * });
63
+ * ```
64
+ */
65
+ export declare const useCallKitEvent: typeof useCallKitEventIos;
66
+ /**
67
+ * A hook for managing CallKit sessions on iOS. Does nothing on other platforms.
68
+ * CallKit provides a native iOS interface for managing VoIP calls, integrating with the system's
69
+ * phone UI and controls. Use this hook when you need fine-grained control over the CallKit session lifecycle.
70
+ *
71
+ * @returns {UseCallKitResult} An object containing methods to manage CallKit sessions:
72
+ * - `startCallKitSession(config: CallKitConfig)` - Starts a CallKit session with the given configuration
73
+ * - `endCallKitSession()` - Ends the current CallKit session
74
+ * - `getCallKitSessionStatus()` - Returns whether there is currently an active CallKit session
75
+ *
76
+ * @group Hooks
77
+ * @category Connection
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * import { useCallKit } from '@fishjam-cloud/react-native-client';
82
+ *
83
+ * const { startCallKitSession, endCallKitSession } = useCallKit();
84
+ *
85
+ * // Start a CallKit session
86
+ * await startCallKitSession({ displayName: 'John Doe', isVideo: true });
87
+ *
88
+ * // Later, end the session
89
+ * await endCallKitSession();
90
+ * ```
91
+ */
92
+ export declare const useCallKit: typeof useCallKitIos;
93
+ /**
94
+ * A convenience hook for automatically managing CallKit session lifecycle on iOS. Does nothing on other platforms.
95
+ * This hook automatically starts a CallKit session when the component mounts and ends it when the component unmounts.
96
+ * Use this hook when you want CallKit to be active for the entire lifetime of a component (e.g., during a call).
97
+ *
98
+ * @param {CallKitConfig} config - Configuration object containing:
99
+ * - `displayName` - The name to display in the CallKit UI (e.g., username, call title)
100
+ * - `isVideo` - Whether the call is video or audio only
101
+ *
102
+ * @group Hooks
103
+ * @category Connection
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * import React from 'react';
108
+ * import { useCallKitService } from '@fishjam-cloud/react-native-client';
109
+ *
110
+ * function CallScreen({ username }: { username: string }) {
111
+ * // CallKit session will automatically start when this component mounts
112
+ * // and end when it unmounts
113
+ * useCallKitService({ displayName: username, isVideo: true });
114
+ *
115
+ * return null;
116
+ * }
117
+ * ```
118
+ */
119
+ export declare const useCallKitService: typeof useCallKitServiceIos;
120
+ export {};
121
+ //# sourceMappingURL=useCallKit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCallKit.d.ts","sourceR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BAAoB,CAAC"}
@@ -0,0 +1,142 @@
1
+ import { useCallback, useEffect } from 'react';
2
+ import { Platform } from 'react-native';
3
+ import RNFishjamClient, { ReceivableEvents } from '../RNFishjamClientModule';
4
+ import { useFishjamEvent } from './internal/useFishjamEvent';
5
+ function useCallKitIos() {
6
+ const startCallKitSession = useCallback(async ({ displayName, isVideo }) => {
7
+ try {
8
+ await RNFishjamClient.startCallKitSession(displayName, isVideo);
9
+ }
10
+ catch (error) {
11
+ console.error('Failed to start CallKit session:', error);
12
+ throw error;
13
+ }
14
+ }, []);
15
+ const endCallKitSession = useCallback(async () => {
16
+ try {
17
+ await RNFishjamClient.endCallKitSession();
18
+ }
19
+ catch (error) {
20
+ console.error('Failed to end CallKit session:', error);
21
+ throw error;
22
+ }
23
+ }, []);
24
+ const getCallKitSessionStatus = useCallback(async () => {
25
+ return RNFishjamClient.hasActiveCallKitSession;
26
+ }, []);
27
+ return {
28
+ startCallKitSession,
29
+ endCallKitSession,
30
+ getCallKitSessionStatus,
31
+ };
32
+ }
33
+ const useCallKitServiceIos = (config) => {
34
+ const { displayName, isVideo } = config;
35
+ const { startCallKitSession, endCallKitSession } = useCallKitIos();
36
+ useEffect(() => {
37
+ startCallKitSession({ displayName, isVideo });
38
+ return () => {
39
+ endCallKitSession();
40
+ };
41
+ }, [startCallKitSession, endCallKitSession, displayName, isVideo]);
42
+ };
43
+ const emptyFunction = () => { };
44
+ const useCallKitEventIos = (action, callback) => {
45
+ useFishjamEvent(ReceivableEvents.CallKitActionPerformed, (event) => {
46
+ event[action] && callback(event[action]);
47
+ });
48
+ };
49
+ /**
50
+ * A hook for listening to CallKit actions on iOS. Does nothing on other platforms.
51
+ * This hook allows you to respond to user interactions with the native iOS CallKit interface,
52
+ * such as muting/unmuting the call, putting the call on hold, or ending the call from the
53
+ * system's phone UI or lock screen controls.
54
+ *
55
+ * @param {keyof CallKitAction} action - The CallKit action to listen for. Available actions:
56
+ * - `'started'` - CallKit session has started
57
+ * - `'ended'` - User ended the call from CallKit UI
58
+ * - `'failed'` - CallKit session failed to start
59
+ * - `'muted'` - User toggled mute from CallKit UI
60
+ * - `'held'` - User toggled hold from CallKit UI
61
+ *
62
+ * @param {Function} callback - Function called when the specified action occurs.
63
+ *
64
+ * @group Hooks
65
+ * @category Connection
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * import { useCallKitEvent } from '@fishjam-cloud/react-native-client';
70
+ *
71
+ * // Listen for hold state changes
72
+ * useCallKitEvent('held', (isOnHold: boolean) => {
73
+ * console.log('Call hold state:', isOnHold);
74
+ * // Handle hold state in your app
75
+ * });
76
+ * ```
77
+ */
78
+ export const useCallKitEvent = Platform.select({
79
+ ios: useCallKitEventIos,
80
+ default: emptyFunction,
81
+ });
82
+ /**
83
+ * A hook for managing CallKit sessions on iOS. Does nothing on other platforms.
84
+ * CallKit provides a native iOS interface for managing VoIP calls, integrating with the system's
85
+ * phone UI and controls. Use this hook when you need fine-grained control over the CallKit session lifecycle.
86
+ *
87
+ * @returns {UseCallKitResult} An object containing methods to manage CallKit sessions:
88
+ * - `startCallKitSession(config: CallKitConfig)` - Starts a CallKit session with the given configuration
89
+ * - `endCallKitSession()` - Ends the current CallKit session
90
+ * - `getCallKitSessionStatus()` - Returns whether there is currently an active CallKit session
91
+ *
92
+ * @group Hooks
93
+ * @category Connection
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * import { useCallKit } from '@fishjam-cloud/react-native-client';
98
+ *
99
+ * const { startCallKitSession, endCallKitSession } = useCallKit();
100
+ *
101
+ * // Start a CallKit session
102
+ * await startCallKitSession({ displayName: 'John Doe', isVideo: true });
103
+ *
104
+ * // Later, end the session
105
+ * await endCallKitSession();
106
+ * ```
107
+ */
108
+ export const useCallKit = Platform.select({
109
+ ios: useCallKitIos,
110
+ default: emptyFunction,
111
+ });
112
+ /**
113
+ * A convenience hook for automatically managing CallKit session lifecycle on iOS. Does nothing on other platforms.
114
+ * This hook automatically starts a CallKit session when the component mounts and ends it when the component unmounts.
115
+ * Use this hook when you want CallKit to be active for the entire lifetime of a component (e.g., during a call).
116
+ *
117
+ * @param {CallKitConfig} config - Configuration object containing:
118
+ * - `displayName` - The name to display in the CallKit UI (e.g., username, call title)
119
+ * - `isVideo` - Whether the call is video or audio only
120
+ *
121
+ * @group Hooks
122
+ * @category Connection
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * import React from 'react';
127
+ * import { useCallKitService } from '@fishjam-cloud/react-native-client';
128
+ *
129
+ * function CallScreen({ username }: { username: string }) {
130
+ * // CallKit session will automatically start when this component mounts
131
+ * // and end when it unmounts
132
+ * useCallKitService({ displayName: username, isVideo: true });
133
+ *
134
+ * return null;
135
+ * }
136
+ * ```
137
+ */
138
+ export const useCallKitService = Platform.select({
139
+ ios: useCallKitServiceIos,
140
+ default: emptyFunction,
141
+ });
142
+ //# sourceMappingURL=useCallKit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCallKit.js","sourceRoot":"","sources":["../../src/hooks/useCallKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,eAAe,EAAE,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAuC7D,SAAS,aAAa;IACpB,MAAM,mBAAmB,GAAG,WAAW,CACrC,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAiB,EAAE,EAAE;QAChD,IAAI,CAAC;YACH,MAAM,eAAe,CAAC,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAClE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;YACzD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,EACD,EAAE,CACH,CAAC;I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,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC7C,GAAG,EAAE,kBAAkB;IACvB,OAAO,EAAE,aAAa;CACvB,CAA8B,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;IACxC,GAAG,EAAE,aAAa;IAClB,OAAO,EAAE,aAAa;CACvB,CAAyB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC/C,GAAG,EAAE,oBAAoB;IACzB,OAAO,EAAE,aAAa;CACvB,CAAgC,CAAC","sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { Platform } from 'react-native';\nimport RNFishjamClient, { ReceivableEvents } from '../RNFishjamClientModule';\nimport { useFishjamEvent } from './internal/useFishjamEvent';\n\nexport type CallKitAction = {\n ['started']: undefined;\n ['ended']: undefined;\n ['failed']: string;\n ['muted']: boolean;\n ['held']: boolean;\n};\n\nexport type UseCallKitResult = {\n /**\n * Starts a CallKit session for the current call\n * @param config - Configuration object containing displayName and isVideo\n */\n startCallKitSession: (config: CallKitConfig) => Promise<void>;\n\n /**\n * Ends the current CallKit session\n */\n endCallKitSession: () => Promise<void>;\n\n /**\n * Returns whether there is currently an active CallKit session\n */\n getCallKitSessionStatus: () => Promise<boolean>;\n};\n\nexport type CallKitConfig = {\n /**\n * The name to display in the CallKit UI\n */\n displayName: string;\n /**\n * Whether the should support video\n */\n isVideo: boolean;\n};\n\nfunction useCallKitIos(): UseCallKitResult {\n const startCallKitSession = useCallback(\n async ({ displayName, isVideo }: CallKitConfig) => {\n try {\n await RNFishjamClient.startCallKitSession(displayName, isVideo);\n } catch (error) {\n console.error('Failed to start CallKit session:', error);\n throw error;\n }\n },\n [],\n );\n\n const endCallKitSession = useCallback(async () => {\n try {\n await RNFishjamClient.endCallKitSession();\n } catch (error) {\n console.error('Failed to end CallKit session:', error);\n throw error;\n }\n }, []);\n\n const getCallKitSessionStatus = useCallback(async () => {\n return RNFishjamClient.hasActiveCallKitSession;\n }, []);\n\n return {\n startCallKitSession,\n endCallKitSession,\n getCallKitSessionStatus,\n };\n}\n\nconst useCallKitServiceIos = (config: CallKitConfig) => {\n const { displayName, isVideo } = config;\n\n const { startCallKitSession, endCallKitSession } = useCallKitIos();\n\n useEffect(() => {\n startCallKitSession({ displayName, isVideo });\n\n return () => {\n endCallKitSession();\n };\n }, [startCallKitSession, endCallKitSession, displayName, isVideo]);\n};\n\nconst emptyFunction = () => {};\n\nconst useCallKitEventIos = <T extends keyof CallKitAction>(\n action: T,\n callback: (event: CallKitAction[T]) => void,\n) => {\n useFishjamEvent(ReceivableEvents.CallKitActionPerformed, (event) => {\n event[action] && callback(event[action]);\n });\n};\n\n/**\n * A hook for listening to CallKit actions on iOS. Does nothing on other platforms.\n * This hook allows you to respond to user interactions with the native iOS CallKit interface,\n * such as muting/unmuting the call, putting the call on hold, or ending the call from the\n * system's phone UI or lock screen controls.\n *\n * @param {keyof CallKitAction} action - The CallKit action to listen for. Available actions:\n * - `'started'` - CallKit session has started\n * - `'ended'` - User ended the call from CallKit UI\n * - `'failed'` - CallKit session failed to start\n * - `'muted'` - User toggled mute from CallKit UI\n * - `'held'` - User toggled hold from CallKit UI\n *\n * @param {Function} callback - Function called when the specified action occurs.\n *\n * @group Hooks\n * @category Connection\n *\n * @example\n * ```typescript\n * import { useCallKitEvent } from '@fishjam-cloud/react-native-client';\n *\n * // Listen for hold state changes\n * useCallKitEvent('held', (isOnHold: boolean) => {\n * console.log('Call hold state:', isOnHold);\n * // Handle hold state in your app\n * });\n * ```\n */\nexport const useCallKitEvent = Platform.select({\n ios: useCallKitEventIos,\n default: emptyFunction,\n}) as typeof useCallKitEventIos;\n\n/**\n * A hook for managing CallKit sessions on iOS. Does nothing on other platforms.\n * CallKit provides a native iOS interface for managing VoIP calls, integrating with the system's\n * phone UI and controls. Use this hook when you need fine-grained control over the CallKit session lifecycle.\n *\n * @returns {UseCallKitResult} An object containing methods to manage CallKit sessions:\n * - `startCallKitSession(config: CallKitConfig)` - Starts a CallKit session with the given configuration\n * - `endCallKitSession()` - Ends the current CallKit session\n * - `getCallKitSessionStatus()` - Returns whether there is currently an active CallKit session\n *\n * @group Hooks\n * @category Connection\n *\n * @example\n * ```typescript\n * import { useCallKit } from '@fishjam-cloud/react-native-client';\n *\n * const { startCallKitSession, endCallKitSession } = useCallKit();\n *\n * // Start a CallKit session\n * await startCallKitSession({ displayName: 'John Doe', isVideo: true });\n *\n * // Later, end the session\n * await endCallKitSession();\n * ```\n */\nexport const useCallKit = Platform.select({\n ios: useCallKitIos,\n default: emptyFunction,\n}) as typeof useCallKitIos;\n\n/**\n * A convenience hook for automatically managing CallKit session lifecycle on iOS. Does nothing on other platforms.\n * This hook automatically starts a CallKit session when the component mounts and ends it when the component unmounts.\n * Use this hook when you want CallKit to be active for the entire lifetime of a component (e.g., during a call).\n *\n * @param {CallKitConfig} config - Configuration object containing:\n * - `displayName` - The name to display in the CallKit UI (e.g., username, call title)\n * - `isVideo` - Whether the call is video or audio only\n *\n * @group Hooks\n * @category Connection\n *\n * @example\n * ```typescript\n * import React from 'react';\n * import { useCallKitService } from '@fishjam-cloud/react-native-client';\n *\n * function CallScreen({ username }: { username: string }) {\n * // CallKit session will automatically start when this component mounts\n * // and end when it unmounts\n * useCallKitService({ displayName: username, isVideo: true });\n *\n * return null;\n * }\n * ```\n */\nexport const useCallKitService = Platform.select({\n ios: useCallKitServiceIos,\n default: emptyFunction,\n}) as typeof useCallKitServiceIos;\n"]}
@@ -1,4 +1,3 @@
1
- import { ConnectionConfig } from '../common/client';
2
1
  import { GenericMetadata } from '../types';
3
2
  /**
4
3
  * Represents the possible statuses of a peer while reconnecting to room
@@ -18,6 +17,11 @@ export type ReconnectionStatus = 'idle' | 'reconnecting' | 'error';
18
17
  */
19
18
  export type PeerStatus = 'connecting' | 'connected' | 'error' | 'idle';
20
19
  export type JoinRoomConfig<PeerMetadata extends GenericMetadata = GenericMetadata> = {
20
+ /**
21
+ * Fishjam ID, which is used to connect to the room.
22
+ * You can get it at https://fishjam.io/app
23
+ */
24
+ fishjamId: string;
21
25
  /**
22
26
  * Token received from server (or Room Manager)
23
27
  */
@@ -30,22 +34,22 @@ export type JoinRoomConfig<PeerMetadata extends GenericMetadata = GenericMetadat
30
34
  * Additional connection configuration
31
35
  */
32
36
  config?: ConnectionConfig;
33
- } & ({
34
- /**
35
- * Fishjam ID, which is used to connect to the room.
36
- * Only use in sandbox.
37
- * If provided, `url` must not be set.
38
- */
39
- fishjamId: string;
40
- url?: never;
41
- } | {
37
+ };
38
+ export type ConnectionConfig = {
42
39
  /**
43
- * Fishjam URL, used to connect to the room.
44
- * If provided, `fishjamId` must not be set.
40
+ * Configuration for automatic reconnection
41
+ * sdk uses a linear backoff algorithm, that is the formula
42
+ * for the delay of the nth attempt is
43
+ * n * delayMs + initialDelayMs
44
+ *
45
+ * Pass 0 for maxAttempts to disable automatic reconnection
45
46
  */
46
- url: string;
47
- fishjamId?: never;
48
- });
47
+ reconnectConfig?: {
48
+ maxAttempts?: number;
49
+ initialDelayMs?: number;
50
+ delayMs?: number;
51
+ };
52
+ };
49
53
  /**
50
54
  * Connect/leave room. And get connection status.
51
55
  * @group Hooks
@@ -57,7 +61,7 @@ export declare function useConnection(): {
57
61
  *
58
62
  * See {@link JoinRoomConfig} for parameter list
59
63
  */
60
- joinRoom: <PeerMetadata extends GenericMetadata = GenericMetadata>({ url, peerToken, peerMetadata, config, fishjamId, }: JoinRoomConfig<PeerMetadata>) => Promise<void>;
64
+ joinRoom: <PeerMetadata extends GenericMetadata = GenericMetadata>({ peerToken, peerMetadata, config, fishjamId, }: JoinRoomConfig<PeerMetadata>) => Promise<void>;
61
65
  /**
62
66
  * Leave room and stop streaming
63
67
  * @type function
@@ -1 +1 @@
1
- {"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnection.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAGjB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAevE,MAAM,MAAM,cAAc,CACxB,YAAY,SAAS,eAAe,GAAG,eAAe,IACpD;IACF;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B,GAAG,CACA;IACE;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,KAAK,CAAC;CACb,GACD;IACE;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,CACJ,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa;IAiCzB;;;;OAIG;eAjCI,YAAY,SAAS,eAAe,0EAMxC,cAAc,CAAC,YAAY,CAAC;IA6B/B;;;OAGG;;;;EAKN"}
1
+ {"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnection.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG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