@100mslive/hms-video-store 0.2.82 → 0.2.83

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 (92) hide show
  1. package/dist/common/ui-logger.d.ts +13 -13
  2. package/dist/core/IHMSActions.d.ts +266 -264
  3. package/dist/core/IHMSNotifications.d.ts +14 -15
  4. package/dist/core/IHMSStore.d.ts +54 -56
  5. package/dist/core/hmsSDKStore/HMSNotifications.d.ts +25 -25
  6. package/dist/core/hmsSDKStore/HMSPlaylist.d.ts +21 -21
  7. package/dist/core/hmsSDKStore/HMSReactiveStore.d.ts +79 -79
  8. package/dist/core/hmsSDKStore/HMSSDKActions.d.ts +157 -157
  9. package/dist/core/hmsSDKStore/adapter.d.ts +49 -49
  10. package/dist/core/hmsSDKStore/common/mapping.d.ts +7 -7
  11. package/dist/core/hmsSDKStore/internalTypes.d.ts +4 -4
  12. package/dist/core/hmsSDKStore/sdkTypes.d.ts +3 -2
  13. package/dist/core/hmsSDKStore/sdkUtils/ActionBatcher.d.ts +19 -19
  14. package/dist/core/hmsSDKStore/sdkUtils/sdkUtils.d.ts +2 -2
  15. package/dist/core/hmsSDKStore/sdkUtils/storeMergeUtils.d.ts +14 -14
  16. package/dist/core/index.d.ts +9 -7
  17. package/dist/core/schema/device-change.d.ts +13 -13
  18. package/dist/core/schema/error.d.ts +13 -13
  19. package/dist/core/schema/index.d.ts +11 -11
  20. package/dist/core/schema/message.d.ts +31 -31
  21. package/dist/core/schema/notification.d.ts +40 -40
  22. package/dist/core/schema/peer.d.ts +67 -67
  23. package/dist/core/schema/playlist.d.ts +127 -109
  24. package/dist/core/schema/requests.d.ts +31 -31
  25. package/dist/core/schema/role.d.ts +3 -3
  26. package/dist/core/schema/room.d.ts +23 -23
  27. package/dist/core/schema/schema.d.ts +29 -29
  28. package/dist/core/schema/settings.d.ts +5 -5
  29. package/dist/core/selectors/derivedSelectors.d.ts +29 -29
  30. package/dist/core/selectors/index.d.ts +5 -5
  31. package/dist/core/selectors/playlistselectors.d.ts +3 -3
  32. package/dist/core/selectors/selectorUtils.d.ts +18 -18
  33. package/dist/core/selectors/selectors.d.ts +185 -191
  34. package/dist/core/selectors/selectorsByID.d.ts +127 -128
  35. package/dist/core/selectors/selectorsByReference.d.ts +3 -3
  36. package/dist/hms-video-store.cjs.js +1 -0
  37. package/dist/hms-video-store.esm.js +1 -5376
  38. package/dist/index.d.ts +1 -1
  39. package/package.json +21 -84
  40. package/dist/hms-video-store.cjs.development.js +0 -5468
  41. package/dist/hms-video-store.cjs.development.js.map +0 -1
  42. package/dist/hms-video-store.cjs.production.min.js +0 -2
  43. package/dist/hms-video-store.cjs.production.min.js.map +0 -1
  44. package/dist/hms-video-store.esm.js.map +0 -1
  45. package/dist/index.js +0 -8
  46. package/dist/test/fakeStore.d.ts +0 -23
  47. package/dist/test/fixtures.d.ts +0 -3
  48. package/src/common/ui-logger.ts +0 -88
  49. package/src/core/IHMSActions.ts +0 -318
  50. package/src/core/IHMSNotifications.ts +0 -16
  51. package/src/core/IHMSStore.ts +0 -60
  52. package/src/core/hmsSDKStore/HMSNotifications.ts +0 -194
  53. package/src/core/hmsSDKStore/HMSPlaylist.ts +0 -78
  54. package/src/core/hmsSDKStore/HMSReactiveStore.ts +0 -271
  55. package/src/core/hmsSDKStore/HMSSDKActions.ts +0 -1156
  56. package/src/core/hmsSDKStore/adapter.ts +0 -244
  57. package/src/core/hmsSDKStore/common/mapping.ts +0 -32
  58. package/src/core/hmsSDKStore/internalTypes.ts +0 -8
  59. package/src/core/hmsSDKStore/sdkTypes.ts +0 -55
  60. package/src/core/hmsSDKStore/sdkUtils/ActionBatcher.ts +0 -63
  61. package/src/core/hmsSDKStore/sdkUtils/sdkUtils.ts +0 -5
  62. package/src/core/hmsSDKStore/sdkUtils/storeMergeUtils.ts +0 -98
  63. package/src/core/index.ts +0 -18
  64. package/src/core/schema/device-change.ts +0 -14
  65. package/src/core/schema/error.ts +0 -13
  66. package/src/core/schema/index.ts +0 -11
  67. package/src/core/schema/message.ts +0 -35
  68. package/src/core/schema/notification.ts +0 -41
  69. package/src/core/schema/peer.ts +0 -78
  70. package/src/core/schema/playlist.ts +0 -114
  71. package/src/core/schema/requests.ts +0 -36
  72. package/src/core/schema/role.ts +0 -5
  73. package/src/core/schema/room.ts +0 -26
  74. package/src/core/schema/schema.ts +0 -94
  75. package/src/core/schema/settings.ts +0 -5
  76. package/src/core/selectors/derivedSelectors.ts +0 -81
  77. package/src/core/selectors/index.ts +0 -5
  78. package/src/core/selectors/playlistselectors.ts +0 -67
  79. package/src/core/selectors/selectorUtils.ts +0 -63
  80. package/src/core/selectors/selectors.ts +0 -400
  81. package/src/core/selectors/selectorsByID.ts +0 -401
  82. package/src/core/selectors/selectorsByReference.ts +0 -45
  83. package/src/index.ts +0 -1
  84. package/src/test/fakeStore.ts +0 -272
  85. package/src/test/fixtures.ts +0 -22
  86. package/src/test/integration/.gitkeep +0 -0
  87. package/src/test/unit/HMSNotifications.test.ts +0 -123
  88. package/src/test/unit/reactiveStore.test.ts +0 -129
  89. package/src/test/unit/roleSelectors.test.ts +0 -85
  90. package/src/test/unit/selectors.test.ts +0 -316
  91. package/src/test/unit/selectorsByReference.test.ts +0 -27
  92. package/src/test/unit/storeMergeUtils.test.ts +0 -168
package/dist/index.js DELETED
@@ -1,8 +0,0 @@
1
-
2
- 'use strict'
3
-
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./hms-video-store.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./hms-video-store.cjs.development.js')
8
- }
@@ -1,23 +0,0 @@
1
- import { HMSPeer, HMSSpeaker, HMSStore, HMSTrack } from '../core';
2
- import { HMSPlaylist, HMSRole } from '../core/schema';
3
- export declare let localPeer: HMSPeer;
4
- export declare let remotePeerOne: HMSPeer;
5
- export declare let remotePeerTwo: HMSPeer;
6
- export declare let peerScreenSharing: HMSPeer;
7
- export declare let localVideo: HMSTrack;
8
- export declare let localAudio: HMSTrack;
9
- export declare let remoteVideo: HMSTrack;
10
- export declare let screenShare: HMSTrack;
11
- export declare let auxiliaryAudio: HMSTrack;
12
- export declare let localSpeaker: HMSSpeaker;
13
- export declare let screenshareAudio: HMSTrack;
14
- export declare let hostRole: HMSRole;
15
- export declare let speakerRole: HMSRole;
16
- export declare let playlist: HMSPlaylist<any>;
17
- export declare const ROLES: {
18
- HOST: string;
19
- SPEAKER: string;
20
- VIEWER: string;
21
- NOSUBSCRIBE: string;
22
- };
23
- export declare const makeFakeStore: () => HMSStore;
@@ -1,3 +0,0 @@
1
- import { HMSPeer, HMSTrack, HMSTrackType } from '../core';
2
- export declare const makeFakeTrack: (type?: HMSTrackType | undefined) => HMSTrack;
3
- export declare const makeFakePeer: () => HMSPeer;
@@ -1,88 +0,0 @@
1
- import { HMSLogLevel } from '../core/hmsSDKStore/sdkTypes';
2
-
3
- const HMS_STORE_TAG = 'HMS-Store:';
4
-
5
- export class HMSLogger {
6
- static level: HMSLogLevel = HMSLogLevel.VERBOSE;
7
-
8
- static v(tag: string, ...data: any[]) {
9
- this.log(HMSLogLevel.VERBOSE, tag, ...data);
10
- }
11
-
12
- static d(...data: any[]) {
13
- this.log(HMSLogLevel.DEBUG, ...data);
14
- }
15
-
16
- static i(...data: any[]) {
17
- this.log(HMSLogLevel.INFO, ...data);
18
- }
19
-
20
- static w(...data: any[]) {
21
- this.log(HMSLogLevel.WARN, ...data);
22
- }
23
-
24
- static e(...data: any[]) {
25
- this.log(HMSLogLevel.ERROR, ...data);
26
- }
27
-
28
- static time(mark: string) {
29
- this.log(HMSLogLevel.TIME, '[HMSPerformanceTiming]', mark);
30
- }
31
-
32
- static timeEnd(mark: string) {
33
- this.log(HMSLogLevel.TIMEEND, '[HMSPerformanceTiming]', mark, mark);
34
- }
35
-
36
- static cleanUp() {
37
- performance.clearMarks();
38
- performance.clearMeasures();
39
- }
40
-
41
- /* eslint-disable */
42
- private static log(level: HMSLogLevel, ...data: any[]) {
43
- if (this.level.valueOf() > level.valueOf()) {
44
- return;
45
- }
46
-
47
- switch (level) {
48
- case HMSLogLevel.VERBOSE: {
49
- console.log(HMS_STORE_TAG, ...data);
50
- break;
51
- }
52
- case HMSLogLevel.DEBUG: {
53
- console.debug(HMS_STORE_TAG, ...data);
54
- break;
55
- }
56
- case HMSLogLevel.INFO: {
57
- console.info(HMS_STORE_TAG, ...data);
58
- break;
59
- }
60
- case HMSLogLevel.WARN: {
61
- console.warn(HMS_STORE_TAG, ...data);
62
- break;
63
- }
64
- case HMSLogLevel.ERROR: {
65
- console.error(HMS_STORE_TAG, ...data);
66
- break;
67
- }
68
- case HMSLogLevel.TIME: {
69
- performance.mark(data[1]);
70
- break;
71
- }
72
- case HMSLogLevel.TIMEEND: {
73
- const tag = data[0];
74
- const mark = data[1];
75
- try {
76
- const entry = performance.measure(mark, mark);
77
- //@ts-ignore
78
- this.log(HMSLogLevel.DEBUG, tag, mark, entry?.duration);
79
- performance.clearMarks(mark);
80
- performance.clearMeasures(mark);
81
- } catch (error) {
82
- this.log(HMSLogLevel.DEBUG, tag, mark, error);
83
- }
84
- break;
85
- }
86
- }
87
- }
88
- }
@@ -1,318 +0,0 @@
1
- import {
2
- HMSConfig,
3
- HMSSimulcastLayer,
4
- HMSAudioTrackSettings,
5
- HMSVideoTrackSettings,
6
- HMSLogLevel,
7
- HMSVideoPlugin,
8
- HMSAudioPlugin,
9
- } from '@100mslive/hms-video';
10
- import {
11
- HMSMessageID,
12
- HMSPeerID,
13
- HMSRoleName,
14
- HMSTrackID,
15
- HMSTrackSource,
16
- IHMSPlaylistActions,
17
- HMSChangeMultiTrackStateParams,
18
- } from './schema';
19
- import { HMSRoleChangeRequest } from './selectors';
20
- import { RTMPRecordingConfig } from './hmsSDKStore/sdkTypes';
21
-
22
- /**
23
- * The below interface defines our SDK API Surface for taking room related actions.
24
- * It talks to our 100ms backend and handles error reconnections, state managements
25
- * and lots of other things so you don't have to. You can use this gateway with any
26
- * sort of UI to make connecting to our backend easier.
27
- * In case you use react, we also provide a HMSProvider class with very powerful hooks
28
- * and out of box components which you can use to setup your website in minutes. Our
29
- * components have in built integration with this interface and you won't have to worry
30
- * about passing props if you use them.
31
- *
32
- * @remarks
33
- * There is a one to one mapping between an instance of this class and a 100ms room,
34
- * in case you're creating multiple rooms please create new instance per room.
35
- *
36
- * @category Core
37
- */
38
- export interface IHMSActions {
39
- preview(config: HMSConfig): Promise<void>;
40
- /**
41
- * join function can be used to join the room, if the room join is successful,
42
- * current details of participants and track details are populated in the store.
43
- *
44
- * @remarks
45
- * If join is called while an earlier join is in progress for the room id, it
46
- * is ignored
47
- *
48
- * @param config join config with room id, required for joining the room
49
- */
50
- join(config: HMSConfig): void;
51
-
52
- /**
53
- * This function can be used to leave the room, if the call is repeated it's ignored.
54
- */
55
- leave(): Promise<void>;
56
-
57
- /**
58
- * If you want to enable screenshare for the local peer this class can be called.
59
- * The store will be populated with the incoming track, and the subscriber(or
60
- * react component if our hook is used) will be notified/rerendered
61
- * @param enabled boolean
62
- * @param audioOnly boolean To publish only audio from screenshare
63
- */
64
- setScreenShareEnabled(enabled: boolean, audioOnly?: boolean): Promise<void>;
65
-
66
- /**
67
- * You can use the addTrack method to add an auxiliary track(canvas capture, electron screen-share, etc...)
68
- * This method adds the track to the local peer's list of auxiliary tracks and publishes it to make it available to remote peers.
69
- * @param track MediaStreamTrack - Track to be added
70
- * @param type HMSTrackSource - 'regular' | 'screen' | 'plugin' - Source of track - default: 'regular'
71
- */
72
- addTrack(track: MediaStreamTrack, type: HMSTrackSource): Promise<void>;
73
-
74
- /**
75
- * You can use the removeTrack method to remove an auxiliary track.
76
- * This method removes the track from the local peer's list of auxiliary tracks and unpublishes it.
77
- * @param trackId string - ID of the track to be removed
78
- */
79
- removeTrack(trackId: HMSTrackID): Promise<void>;
80
-
81
- /**
82
- * @deprecated The method should not be used
83
- * @see sendBroadcastMessage
84
- * Send a plain text message to all the other participants in the room.
85
- * @param message - string message to broadcast
86
- */
87
- sendMessage(message: string): void;
88
-
89
- /**
90
- * Send a plain text message to all the other participants in the room.
91
- * @param message - string message to broadcast
92
- * @param type - type of message eg: image, video etc. - optional defaults to chat
93
- */
94
- sendBroadcastMessage(message: string, type?: string): Promise<void>;
95
- /**
96
- *
97
- * @param message - string message to send
98
- * @param roles - roles to which to send the message
99
- * @param type - type of message eg: image, video etc. - optional defaults to chat
100
- */
101
- sendGroupMessage(message: string, roles: HMSRoleName[], type?: string): Promise<void>;
102
- /**
103
- *
104
- * @param message
105
- * @param peerID - id of the peer to which message has to be sent
106
- * @param type - type of message eg: image, video etc. - optional defaults to chat
107
- */
108
- sendDirectMessage(message: string, peerID: HMSPeerID, type?: string): Promise<void>;
109
-
110
- /**
111
- * If just readStatus argument is passed, the function will set read flag of every message
112
- * as the readStatus argument passed.
113
- * If both readStatus and messageId argument is passed, then just read flag of message
114
- * with passed messageId will be set as readStatus argument. if message with passed messageId is not
115
- * found in store, no change in store will take place.
116
- *
117
- * @param readStatus boolean value which you want to set as read flag for message/messages.
118
- * @param messageId message id whose read falg you want to set.
119
- */
120
- setMessageRead(readStatus: boolean, messageId?: HMSMessageID): void;
121
-
122
- /**
123
- * This function can be used to enable/disable(unmute/mute) local audio track
124
- * @param enabled boolean - true to unmute, false to mute
125
- */
126
- setLocalAudioEnabled(enabled: boolean): Promise<void>;
127
-
128
- /**
129
- * This function can be used to enable/disable(unmute/mute) local video track
130
- * @param enabled boolean - true to unmute, false to mute
131
- */
132
- setLocalVideoEnabled(enabled: boolean): Promise<void>;
133
-
134
- /**
135
- * @param trackId string - ID of the track whose mute status needs to be set
136
- * @param enabled boolean - true when we want to unmute the track and false when we want to unmute it
137
- */
138
- setEnabledTrack(trackId: HMSTrackID, enabled: boolean): Promise<void>;
139
-
140
- /**
141
- * Change settings of the local peer's audio track
142
- * @param settings HMSAudioTrackSettings
143
- * ({ volume, codec, maxBitrate, deviceId, advanced })
144
- */
145
- setAudioSettings(settings: Partial<HMSAudioTrackSettings>): Promise<void>;
146
- /**
147
- * Change settings of the local peer's video track
148
- * @param settings HMSVideoTrackSettings
149
- * ({ width, height, codec, maxFramerate, maxBitrate, deviceId, advanced })
150
- */
151
- setVideoSettings(settings: Partial<HMSVideoTrackSettings>): Promise<void>;
152
-
153
- /**
154
- * You can use the attach and detach video function
155
- * to add/remove video from an element for a track ID. The benefit of using this
156
- * instead of removing the video yourself is that it'll also auto unsubscribe to
157
- * the stream coming from server saving significant bandwidth for the user.
158
- * @param localTrackID trackID as stored in the store for the peer
159
- * @param videoElement HTML native element where the video has to be shown
160
- */
161
- attachVideo(localTrackID: HMSTrackID, videoElement: HTMLVideoElement): Promise<void>;
162
-
163
- /**
164
- * @see attachVideo
165
- */
166
- detachVideo(localTrackID: HMSTrackID, videoElement: HTMLVideoElement): Promise<void>;
167
-
168
- /**
169
- * Set the output volume of audio tracks(overall/particular audio track)
170
- * @param value number between 0-100
171
- * @param trackId string If undefined sets the overall volume(of every audio track in the room); If valid - set the volume of particular audio track
172
- *
173
- */
174
- setVolume(value: number, trackId?: HMSTrackID): void;
175
-
176
- /**
177
- * Set the audio output(speaker) device
178
- * @param deviceId string deviceId of the audio output device
179
- */
180
- setAudioOutputDevice(deviceId: string): void;
181
-
182
- /**
183
- * set the quality of the selected videoTrack
184
- * @param trackId
185
- * @param layer
186
- */
187
- setPreferredLayer(trackId: HMSTrackID, layer: HMSSimulcastLayer): void;
188
-
189
- /**
190
- * Add or remove a video plugin from/to the local peer video track. Eg. Virtual Background, Face Filters etc.
191
- * Video plugins can be added/removed at any time after the join is successful.
192
- * pluginFrameRate is the rate at which the output plugin will do processing
193
- * @param plugin HMSVideoPlugin
194
- * @param pluginFrameRate number
195
- * @see HMSVideoPlugin
196
- */
197
- addPluginToVideoTrack(plugin: HMSVideoPlugin, pluginFrameRate?: number): Promise<void>;
198
-
199
- addPluginToAudioTrack(plugin: HMSAudioPlugin): Promise<void>;
200
-
201
- /**
202
- * @see addPluginToVideoTrack
203
- */
204
- removePluginFromVideoTrack(plugin: HMSVideoPlugin): Promise<void>;
205
-
206
- removePluginFromAudioTrack(plugin: HMSAudioPlugin): Promise<void>;
207
-
208
- /**
209
- * Request for a role change of a remote peer. Can be forced.
210
- * @param forPeerId The remote peer id whose role needs to be changed
211
- * @param toRole The name of the new role.
212
- * @param [force] this being true would mean that user won't get a request to accept role change
213
- */
214
- changeRole(forPeerId: HMSPeerID, toRole: HMSRoleName, force?: boolean): Promise<void>;
215
-
216
- /**
217
- * Accept the role change request received
218
- * @param {HMSRoleChangeRequest} request The original request that was received
219
- */
220
- acceptChangeRole(request: HMSRoleChangeRequest): Promise<void>;
221
-
222
- /**
223
- * Reject pending role change request
224
- * @param {HMSRoleChangeRequest} request The original request that was received
225
- */
226
- rejectChangeRole(request: HMSRoleChangeRequest): void;
227
-
228
- /**
229
- * Change track state a remote peer's track
230
- * This can be used to mute/unmute a remote peer's track
231
- * @param forRemoteTrackID The track ID or array of track IDs for which you want to change the state
232
- * @param enabled `true` if you wish to enable(unmute permission is required) the track, `false` if you wish to disable(mute permission is required) the track
233
- */
234
- setRemoteTrackEnabled(
235
- forRemoteTrackID: HMSTrackID | HMSTrackID[],
236
- enabled: boolean,
237
- ): Promise<void>;
238
-
239
- /**
240
- * Use this to mute/unmute multipe tracks by source, role or type
241
- * @param {HMSChangeMultiTrackStateParams} params
242
- */
243
- setRemoteTracksEnabled(params: HMSChangeMultiTrackStateParams): Promise<void>;
244
-
245
- /**
246
- * Method to be called with some UI interaction after autoplay error is received
247
- * Most browsers have limitations where an audio can not be played if there was no user interaction.
248
- * SDK throws an autoplay error in this case, this method can be called after an UI interaction
249
- * to resolve the autoplay error
250
- */
251
- unblockAudio: () => Promise<void>;
252
-
253
- /**
254
- * If you have the **endRoom** permission, you can end the room. That means everyone will be kicked out.
255
- * If lock is passed as true, the room cannot be used further.
256
- */
257
- endRoom: (lock: boolean, reason: string) => Promise<void>;
258
-
259
- /**
260
- * If you have **removeOthers** permission, you can remove a peer from the room.
261
- * @param peerID peerID of the peer to be removed from the room
262
- * @param reason a string explaining why the peer is removed from the room.
263
- * This string could be used to notify the user before they're removed from the room
264
- * using the `REMOVED_FROM_ROOM` type of notification
265
- */
266
- removePeer(peerID: HMSPeerID, reason: string): Promise<void>;
267
-
268
- /**
269
- * If you want to start RTMP streaming or recording.
270
- * @param params.meetingURL This is the meeting url which is opened in a headless chrome instance for streaming and recording.
271
- * Make sure this url leads the joiner straight to the room without any preview screen or requiring additional clicks.
272
- * @param params.RTMPURLs The list of ingest URLs where the call as visible in the meeting url should be streamed.
273
- * Optional, when not specified the method is used to just start the recording.
274
- * @param params.record If you want to start the recording or not.
275
- */
276
- startRTMPOrRecording(params: RTMPRecordingConfig): Promise<void>;
277
-
278
- /**
279
- * If you want to stop both RTMP streaming and recording.
280
- */
281
- stopRTMPAndRecording(): Promise<void>;
282
-
283
- /**
284
- * If you want to update the name of peer.
285
- */
286
- changeName(name: string): Promise<void>;
287
-
288
- /**
289
- * If you want to update the metadata of peer.
290
- */
291
- changeMetadata(metadata: string | any): Promise<void>;
292
-
293
- /**
294
- * Set the type of logs from the SDK you want to be logged in the browser console.
295
- *
296
- * Note that HMSLogLevel is decremental meaning,
297
- * - HMSLogLevel.VERBOSE(0) - will log every message from SDK.
298
- * - HMSLogLevel.DEBUG(1) - will log messages that are helpful in debugging, important info, warnings and errors.
299
- * - HMSLogLevel.INFO(2) - will log important info, warnings and errors.
300
- * - HMSLogLevel.WARN(3) - will log warnings and errors.
301
- * - HMSLogLevel.ERROR(4) - will log only errors.
302
- * - HMSLogLevel.NONE(5) - won't log anything.
303
- *
304
- * Usage: `hmsActions.setLogLevel(4)` or `hmsActions.setLogLevel(HMSlogLevel.ERROR)`.
305
- */
306
- setLogLevel(level: HMSLogLevel): void;
307
-
308
- /**
309
- * audio Playlist contains all actions that can be performed on the audio playlist
310
- * This will be available after joining the room
311
- */
312
- audioPlaylist: IHMSPlaylistActions;
313
- /**
314
- * video Playlist contains all actions that can be performed on the video playlist
315
- * This will be available after joining the room
316
- */
317
- videoPlaylist: IHMSPlaylistActions;
318
- }
@@ -1,16 +0,0 @@
1
- import { HMSNotification } from './schema/notification';
2
-
3
- type NotificationCallback = (notification: HMSNotification) => void;
4
-
5
- /**
6
- * @category Core
7
- */
8
- export interface IHMSNotifications {
9
- /**
10
- * you can subscribe to notifications for new message, peer add etc. using this function.
11
- * note that this is not meant to maintain any state on your side, as the reactive store already
12
- * does that. The intent of this function is mainly to display toast notifications or send analytics.
13
- * We'll provide a display message which can be displayed as it is for common cases.
14
- */
15
- onNotification: (cb: NotificationCallback) => () => void;
16
- }
@@ -1,60 +0,0 @@
1
- import { HMSStore } from './schema';
2
- import { StateSelector, StoreApi, Subscribe } from 'zustand/vanilla';
3
- import { NamedSetState } from './hmsSDKStore/internalTypes';
4
-
5
- /**
6
- * HMS Reactive store can be used to subscribe to different parts of the store using selectors
7
- * and get a callback when the value changes.
8
- */
9
- export interface IHMSStore extends StoreApi<HMSStore> {
10
- /**
11
- * Get a part of store using a selector which is true at the current point of time.
12
- *
13
- * Usage: `store.getState(selectDominantSpeaker);`
14
- */
15
- getState: GetState<HMSStore>;
16
-
17
- /**
18
- * Subscribe to a part of store using selectors, whenever the subscribed part changes, the callback
19
- * is called with both the latest and previous value of the changed part.
20
- *
21
- * Usage:
22
- * ```
23
- * const onSpeakerUpdate = (speaker, prevSpeaker) => {
24
- * console.log("speaker changed from - ", prevSpeaker, ", to - ", speaker);
25
- * }
26
- * store.subscribe(onSpeakerUpdate, selectDominantSpeaker);
27
- * ```
28
- */
29
- subscribe: Subscribe<HMSStore>;
30
-
31
- /**
32
- * @private
33
- * @internal
34
- * @privateRemarks
35
- * wraps setState to take an additional action name parameter which can show up in redux devtools.
36
- */
37
- namedSetState: NamedSetState<HMSStore>;
38
- }
39
-
40
- interface GetState<T> {
41
- (): T;
42
- <StateSlice>(selector?: StateSelector<HMSStore, StateSlice>): StateSlice;
43
- }
44
-
45
- /**
46
- * HMS store can be used to:
47
- * - Get a part of the current store or state(getState)
48
- * - Subscribe to different parts of the store using selectors and execute a callback when the value changes.
49
- *
50
- * Both getState and subscribe use selectors to query a part the store.
51
- *
52
- *
53
- * Selectors are functions with HMSStore as an argument and returns a part of the store.
54
- *
55
- * **StoreSelector** is a type alias for this type of function.
56
- *
57
- * @category Core
58
- */
59
- export interface IHMSStoreReadOnly
60
- extends Omit<IHMSStore, 'setState' | 'namedSetState' | 'destroy'> {}