@signalwire/js 3.8.0 → 3.9.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.
Files changed (63) hide show
  1. package/dist/core/src/BaseComponent.d.ts +3 -8
  2. package/dist/core/src/BaseComponent.d.ts.map +1 -1
  3. package/dist/core/src/BaseSession.d.ts +3 -0
  4. package/dist/core/src/BaseSession.d.ts.map +1 -1
  5. package/dist/core/src/chat/BaseChat.d.ts +0 -3
  6. package/dist/core/src/chat/BaseChat.d.ts.map +1 -1
  7. package/dist/core/src/index.d.ts +2 -2
  8. package/dist/core/src/index.d.ts.map +1 -1
  9. package/dist/core/src/rooms/methods.d.ts +14 -1
  10. package/dist/core/src/rooms/methods.d.ts.map +1 -1
  11. package/dist/core/src/types/index.d.ts +1 -0
  12. package/dist/core/src/types/index.d.ts.map +1 -1
  13. package/dist/core/src/types/video.d.ts +2 -0
  14. package/dist/core/src/types/video.d.ts.map +1 -1
  15. package/dist/core/src/types/videoLayout.d.ts +2 -0
  16. package/dist/core/src/types/videoLayout.d.ts.map +1 -1
  17. package/dist/core/src/types/videoRoomSession.d.ts +1 -3
  18. package/dist/core/src/types/videoRoomSession.d.ts.map +1 -1
  19. package/dist/core/src/utils/index.d.ts +1 -0
  20. package/dist/core/src/utils/index.d.ts.map +1 -1
  21. package/dist/core/src/utils/interfaces.d.ts +1 -1
  22. package/dist/core/src/utils/interfaces.d.ts.map +1 -1
  23. package/dist/core/src/utils/proxyUtils.d.ts +5 -0
  24. package/dist/core/src/utils/proxyUtils.d.ts.map +1 -1
  25. package/dist/index.esm.js +20 -14
  26. package/dist/index.esm.js.map +3 -3
  27. package/dist/index.js +20 -15
  28. package/dist/index.js.map +3 -3
  29. package/dist/index.umd.js +2 -2
  30. package/dist/index.umd.js.map +1 -1
  31. package/dist/js/src/BaseRoomSession.d.ts.map +1 -1
  32. package/dist/js/src/RoomSession.d.ts.map +1 -1
  33. package/dist/js/src/RoomSession.docs.d.ts +12 -7
  34. package/dist/js/src/RoomSession.docs.d.ts.map +1 -1
  35. package/dist/js/src/chat/Client.d.ts +1 -1
  36. package/dist/js/src/chat/Client.d.ts.map +1 -1
  37. package/dist/js/src/chat/Client.docs.d.ts +2 -2
  38. package/dist/js/src/index.d.ts +8 -7
  39. package/dist/js/src/index.d.ts.map +1 -1
  40. package/dist/js/src/utils/interfaces.d.ts +3 -1
  41. package/dist/js/src/utils/interfaces.d.ts.map +1 -1
  42. package/dist/js/src/video.d.ts +3 -3
  43. package/dist/js/src/video.d.ts.map +1 -1
  44. package/dist/js/src/webrtc.d.ts +1 -1
  45. package/dist/js/src/webrtc.d.ts.map +1 -1
  46. package/dist/js/tsconfig.build.tsbuildinfo +1 -1
  47. package/dist/webrtc/src/BaseConnection.d.ts.map +1 -1
  48. package/dist/webrtc/src/index.d.ts +1 -1
  49. package/dist/webrtc/src/index.d.ts.map +1 -1
  50. package/dist/webrtc/src/utils/deviceHelpers.d.ts +45 -0
  51. package/dist/webrtc/src/utils/deviceHelpers.d.ts.map +1 -1
  52. package/dist/webrtc/src/utils/interfaces.d.ts +3 -0
  53. package/dist/webrtc/src/utils/interfaces.d.ts.map +1 -1
  54. package/package.json +3 -3
  55. package/src/BaseRoomSession.ts +11 -1
  56. package/src/RoomSession.docs.ts +52 -13
  57. package/src/RoomSession.ts +2 -0
  58. package/src/chat/Client.docs.ts +2 -2
  59. package/src/chat/Client.ts +4 -13
  60. package/src/index.ts +8 -7
  61. package/src/utils/interfaces.ts +3 -0
  62. package/src/video.ts +3 -2
  63. package/src/webrtc.ts +1 -0
@@ -1,14 +1,15 @@
1
- import type { Rooms } from '@signalwire/core'
1
+ import type { AssertSameType, VideoPositions, Rooms } from '@signalwire/core'
2
2
  import { BaseRoomSession } from './BaseRoomSession'
3
3
  import { RoomSessionDevice } from './RoomSessionDevice'
4
4
  import { RoomSessionScreenShare } from './RoomSessionScreenShare'
5
+ import { StartScreenShareOptions } from './utils/interfaces'
5
6
 
6
7
  export interface RoomSessionDocs<T>
7
8
  extends RoomMemberMethodsInterfaceDocs,
8
9
  RoomControlMethodsInterfaceDocs,
9
10
  RoomLayoutMethodsInterface,
10
11
  RoomSessionConstructorDocs<T>,
11
- Pick<BaseRoomSession<T>, 'on' | 'off' | 'once'> {
12
+ Pick<BaseRoomSession<T>, 'on' | 'off' | 'once' | 'removeAllListeners'> {
12
13
  /** @internal */
13
14
  stopOutboundAudio(): void
14
15
  /** @internal */
@@ -116,17 +117,26 @@ export interface RoomSessionDocs<T>
116
117
  *
117
118
  * @example Sharing the screen together with the associated audio:
118
119
  * ```typescript
119
- * await roomSession.startScreenShare({audio: true, video: true})
120
+ * await roomSession.startScreenShare({ audio: true, video: true })
120
121
  * ```
121
122
  */
122
- startScreenShare(opts: {
123
- /** Whether the screen share object should automatically join the room */
124
- autoJoin?: boolean
125
- /** Audio constraints to use when joining the room. Default: `true`. */
126
- audio?: MediaStreamConstraints['audio']
127
- /** Video constraints to use when joining the room. Default: `true`. */
128
- video?: MediaStreamConstraints['video']
129
- }): Promise<RoomSessionScreenShare>
123
+ startScreenShare(
124
+ opts: AssertSameType<
125
+ StartScreenShareOptions,
126
+ {
127
+ /** Whether the screen share object should automatically join the room. Default: `true`. */
128
+ autoJoin?: boolean
129
+ /** Audio constraints to use when joining the room. Default: `false`. */
130
+ audio?: MediaStreamConstraints['audio']
131
+ /** Video constraints to use when joining the room. Default: `true`. */
132
+ video?: MediaStreamConstraints['video']
133
+ /** Layout to use to use when joining the room. */
134
+ layout?: string
135
+ /** Automatically set positions when screen share joins the room. */
136
+ positions?: VideoPositions
137
+ }
138
+ >
139
+ ): Promise<RoomSessionScreenShare>
130
140
 
131
141
  /**
132
142
  * Adds a camera device to the room. Using this method, a user can stream
@@ -839,6 +849,10 @@ interface RoomControlMethodsInterfaceDocs {
839
849
  play(params: {
840
850
  url: string
841
851
  volume?: number
852
+ // positions?: Record<
853
+ // string,
854
+ // 'self' | 'standard' | `standard-${number}` | 'off-canvas'
855
+ // >
842
856
  }): Promise<Rooms.RoomSessionPlayback>
843
857
  }
844
858
 
@@ -887,7 +901,32 @@ interface RoomLayoutMethodsInterface {
887
901
  * await room.setLayout({name: "6x6"})
888
902
  * ```
889
903
  */
890
- setLayout(params: { name: string }): Rooms.SetLayout
904
+ setLayout(params: {
905
+ name: string
906
+ // positions?: Record<
907
+ // string,
908
+ // 'self' | 'standard' | `standard-${number}` | 'off-canvas'
909
+ // >
910
+ }): Rooms.SetLayout
911
+
912
+ // setPositions(params: {
913
+ // positions: Record<
914
+ // string,
915
+ // | 'self'
916
+ // | 'standard'
917
+ // | `standard-${number}`
918
+ // | 'off-canvas'
919
+ // >
920
+ // }): Promise<void>
921
+
922
+ // setMemberPosition(params: {
923
+ // memberId?: string
924
+ // position:
925
+ // | 'self'
926
+ // | 'standard'
927
+ // | `standard-${number}`
928
+ // | 'off-canvas'
929
+ // }): Promise<void>
891
930
  }
892
931
 
893
932
  /**
@@ -1098,7 +1137,7 @@ export interface RoomSessionEvents {
1098
1137
  * The set of members or one or more properties of a member have changed. The
1099
1138
  * event handler receives an object `e` with the updated, full list of members in
1100
1139
  * the room as `e.members`.
1101
- *
1140
+ *
1102
1141
  * @event
1103
1142
  */
1104
1143
  'memberList.updated': undefined
@@ -31,6 +31,8 @@ export const UNSAFE_PROP_ACCESS = [
31
31
  'setInputSensitivity',
32
32
  'setInputVolume',
33
33
  'setLayout',
34
+ 'setPositions',
35
+ 'setMemberPosition',
34
36
  'setOutputVolume',
35
37
  'showVideoMuted',
36
38
  'startRecording',
@@ -110,7 +110,7 @@ export interface ClientDocs
110
110
  * ```js
111
111
  * await chatClient.publish({
112
112
  * channel: 'my-channel',
113
- * message: 'Hello, world.'
113
+ * content: 'Hello, world.'
114
114
  * })
115
115
  * ```
116
116
  *
@@ -118,7 +118,7 @@ export interface ClientDocs
118
118
  * ```js
119
119
  * await chatClient.publish({
120
120
  * channel: 'my-channel',
121
- * message: {
121
+ * content: {
122
122
  * field_one: 'value_one',
123
123
  * field_two: 'value_two',
124
124
  * }
@@ -5,15 +5,12 @@ import type {
5
5
  UserOptions,
6
6
  Chat as ChatNamespace,
7
7
  } from '@signalwire/core'
8
- import { getLogger } from '@signalwire/core'
9
8
  import { createClient } from '../createClient'
10
- import {
11
- ClientApiEventsDocs,
12
- ClientDocs,
13
- } from './Client.docs'
9
+ import { ClientApiEventsDocs, ClientDocs } from './Client.docs'
14
10
 
15
11
  interface ClientApiEventsMain extends ChatNamespace.BaseChatApiEvents {}
16
- export interface ClientApiEvents extends AssertSameType<ClientApiEventsMain, ClientApiEventsDocs> {}
12
+ export interface ClientApiEvents
13
+ extends AssertSameType<ClientApiEventsMain, ClientApiEventsDocs> {}
17
14
 
18
15
  /** @ignore */
19
16
  export interface ClientFullState extends Client {}
@@ -43,7 +40,7 @@ interface ClientMain
43
40
  *
44
41
  * await chatClient.publish({
45
42
  * channel: 'mychannel1',
46
- * message: 'hello world'
43
+ * content: 'hello world'
47
44
  * })
48
45
  * ```
49
46
  *
@@ -58,12 +55,6 @@ export interface Client extends AssertSameType<ClientMain, ClientDocs> {}
58
55
  export interface ClientOptions extends UserOptions {}
59
56
 
60
57
  export const Client = function (chatOptions: ClientOptions) {
61
- if ('production' === process.env.NODE_ENV) {
62
- getLogger().warn(
63
- '`Chat` is still under development and may change in the future without prior notice.'
64
- )
65
- }
66
-
67
58
  const client = createClient<Client>(chatOptions)
68
59
  const subscribe: Client['subscribe'] = async (channels) => {
69
60
  await client.connect()
package/src/index.ts CHANGED
@@ -2,18 +2,19 @@
2
2
  * Welcome to the technical documentation for the JavaScript SDK.
3
3
  *
4
4
  * At the outer level, when you import the SignalWire JS library you get access
5
- * to two different namespaces:
5
+ * to three different namespaces:
6
6
  *
7
7
  * - {@link Video}
8
+ * - {@link Chat}
8
9
  * - {@link WebRTC}
9
10
  *
10
- * {@link Video} gives you access to the classes and methods that let you
11
- * interface with the backend Video APIs. {@link WebRTC} contains several
12
- * functions that are useful for interacting with the hardware of the user's
13
- * device.
11
+ * Video gives you access to the classes and methods that let you
12
+ * interface with the backend Video APIs. Chat gives you access to the classes and functions that you need to create a real-time chat application. WebRTC
13
+ * contains several functions that are useful for interacting with the hardware of the user's device.
14
+ *
14
15
  *
15
- * You don't know where to start? Create an instance of
16
- * {@link Video.RoomSession} to join a room, or take a look at [Getting Started
16
+ * Don't know where to start? Create an instance of
17
+ * {@link Video.RoomSession} to join a room, use the {@link Chat.Client} constructor to start a chat application, or take a look at [Getting Started
17
18
  * with the SignalWire Video
18
19
  * API](https://developer.signalwire.com/apis/docs/getting-started-with-the-signalwire-video-api-1).
19
20
  *
@@ -22,6 +22,7 @@ import type {
22
22
  OnlyFunctionProperties,
23
23
  AssertSameType,
24
24
  MemberListUpdated,
25
+ VideoPositions,
25
26
  } from '@signalwire/core'
26
27
  import { INTERNAL_MEMBER_UPDATABLE_PROPS } from '@signalwire/core'
27
28
  import type { RoomSession } from '../RoomSession'
@@ -102,6 +103,8 @@ export type StartScreenShareOptions = {
102
103
  autoJoin?: boolean
103
104
  audio?: MediaStreamConstraints['audio']
104
105
  video?: MediaStreamConstraints['video']
106
+ layout?: string
107
+ positions?: VideoPositions
105
108
  }
106
109
 
107
110
  /**
package/src/video.ts CHANGED
@@ -2,7 +2,7 @@ import { createRoomObject, Room } from './createRoomObject'
2
2
  import { createClient } from './createClient'
3
3
  import { joinRoom } from './joinRoom'
4
4
  import { MakeRoomOptions } from './Client'
5
- import { RoomSession } from './RoomSession'
5
+ import { RoomSession, RoomSessionOptions } from './RoomSession'
6
6
  import { RoomSessionDevice, RoomDevice } from './RoomSessionDevice'
7
7
  import {
8
8
  RoomSessionScreenShare,
@@ -23,7 +23,7 @@ export {
23
23
  }
24
24
 
25
25
  /** @ignore */
26
- export type { MakeRoomOptions }
26
+ export type { MakeRoomOptions, RoomSessionOptions }
27
27
 
28
28
  /** @ignore */
29
29
  export type {
@@ -33,6 +33,7 @@ export type {
33
33
  DeprecatedMemberUpdatableProps,
34
34
  DeprecatedVideoMemberHandlerParams,
35
35
  VideoMemberHandlerParams,
36
+ VideoMemberListUpdatedParams,
36
37
  } from './utils/interfaces'
37
38
 
38
39
  export type { CreateRoomObjectOptions } from './createRoomObject'
package/src/webrtc.ts CHANGED
@@ -27,4 +27,5 @@ export {
27
27
  setMediaElementSinkId,
28
28
  stopStream,
29
29
  stopTrack,
30
+ createMicrophoneAnalyzer,
30
31
  } from '@signalwire/webrtc'