react-jssip-kit 0.7.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0
4
+ - Breaking: API surface is now explicitly fixed at package root exports (`src/index.ts`). Internal `core/*` modules are not part of the public contract.
5
+ - Breaking: `SipContext` is no longer exported from package root; use `SipProvider` + hooks (`useSipKernel`, etc.).
6
+ - Breaking: `createSipKernel()` no longer accepts injected `client`/`eventManager`; kernel composition is internal-only.
7
+ - Breaking: video-related API and state were removed (`switchCamera`, `enableVideo`, `disableVideo`, `remoteVideoEnabled`, video track surface).
8
+ - Breaking: platform/jssip-lib transitional structure was removed; architecture is consolidated into `core`.
9
+ - Added: `docs/MODULES.md` with module-level architecture map and ownership notes.
10
+ - Docs: README updated with explicit public API contract and internal boundary.
11
+
12
+ ## 0.8.0
13
+ - Breaking: `SipProvider` is now kernel-only and requires `kernel` prop.
14
+ - Added `createSipKernel()` and `SipKernel` as the primary composition API.
15
+ - Added `useSipKernel()` hook for explicit direct kernel access.
16
+ - Hooks migrated internally to kernel interfaces (`store`, `commands`, `events`).
17
+ - Added new core module skeleton (`core/contracts`, `core/modules`, `core/kernel`) for modular architecture.
18
+ - Restored missing `src/jssip-lib/core/sipErrorHandler.ts` to align source with published typings/build output.
19
+
3
20
  ## 0.4.0
4
21
  - Breaking: public client control methods now require an explicit `sessionId` as the first argument (`answer`, `hangup`, mute/hold toggles, DTMF/transfer helpers).
5
22
  - Added exports for client-facing types (events, options, RTCSession/UA maps) from the package entrypoint for easier consumption.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # react-jssip-kit
2
2
 
3
- React provider and hooks that wrap [JsSIP](https://jssip.net/) so you can manage SIP/WebRTC calls with idiomatic React state.
3
+ React provider and hooks around [JsSIP](https://jssip.net/) for SIP/WebRTC calls with idiomatic React state.
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,50 +16,124 @@ Peer deps: `react >=18 <20` and `react-dom >=18 <20`.
16
16
  import React from "react";
17
17
  import {
18
18
  SipProvider,
19
+ useSipKernel,
20
+ useActiveSipSession,
19
21
  useSipState,
20
22
  useSipActions,
21
- createSipClientInstance,
23
+ createSipKernel,
22
24
  WebSocketInterface,
23
25
  } from "react-jssip-kit";
24
26
 
25
- const client = createSipClientInstance();
27
+ const kernel = createSipKernel();
26
28
 
27
- client.connect("sip:alice@example.com", "supersecret", {
28
- sockets: [new WebSocketInterface("wss://example.com/ws")],
29
- uri: "sip:example.com",
30
- display_name: "Alice",
31
- });
29
+ function SipBoot() {
30
+ const { commands } = useSipKernel();
31
+
32
+ React.useEffect(() => {
33
+ commands.connect("sip:alice@example.com", "supersecret", {
34
+ sockets: [new WebSocketInterface("wss://example.com/ws")],
35
+ uri: "sip:example.com",
36
+ display_name: "Alice",
37
+ });
38
+
39
+ return () => commands.disconnect();
40
+ }, [commands]);
41
+
42
+ return null;
43
+ }
32
44
 
33
45
  function CallControls() {
34
- const { sessions, sipStatus } = useSipState();
46
+ const { sipStatus } = useSipState();
47
+ const activeSession = useActiveSipSession();
35
48
  const { call, hangup, toggleMute } = useSipActions();
36
- const active = sessions[0];
37
49
 
38
50
  return (
39
51
  <div>
40
52
  <div>Status: {sipStatus}</div>
41
53
  <button onClick={() => call("sip:bob@example.com")}>Call Bob</button>
42
- <button onClick={() => hangup(active?.id)}>Hang up</button>
43
- <button onClick={() => toggleMute(active?.id)}>Toggle mute</button>
54
+ <button onClick={() => hangup(activeSession?.id)}>Hang up</button>
55
+ <button onClick={() => toggleMute(activeSession?.id)}>Toggle mute</button>
44
56
  </div>
45
57
  );
46
58
  }
47
59
 
48
60
  export function App() {
49
61
  return (
50
- <SipProvider client={client}>
62
+ <SipProvider kernel={kernel}>
63
+ <SipBoot />
51
64
  <CallControls />
52
65
  </SipProvider>
53
66
  );
54
67
  }
55
68
  ```
56
69
 
70
+ ## Migration
71
+
72
+ `SipProvider` is kernel-only.
73
+
74
+ ```tsx
75
+ // before
76
+ <SipProvider client={client} />
77
+
78
+ // after
79
+ const kernel = createSipKernel();
80
+ <SipProvider kernel={kernel} />
81
+ ```
82
+
83
+ ## Selector-first usage
84
+
85
+ Use selector hooks for minimal re-renders.
86
+
87
+ ```tsx
88
+ import { useSipSelector } from "react-jssip-kit";
89
+
90
+ const sipStatus = useSipSelector((state) => state.sipStatus);
91
+ const hasError = useSipSelector((state) => Boolean(state.error));
92
+ ```
93
+
94
+ ```tsx
95
+ import { useSipSession, useActiveSipSession } from "react-jssip-kit";
96
+
97
+ const active = useActiveSipSession();
98
+ const current = useSipSession(active?.id);
99
+ ```
100
+
101
+ ```tsx
102
+ import { useSessionMedia } from "react-jssip-kit";
103
+
104
+ const { remoteStream, audioTracks } = useSessionMedia(sessionId);
105
+ ```
106
+
57
107
  ## API surface
58
108
 
59
- - `SipProvider` supplies `SipClient` and `SipEventManager` to children.
60
- - Hooks: `useSip`, `useSipState`, `useSipActions`, `useSipEvent`, `useSipSessions`.
61
- - Components: `CallPlayer` (basic audio/video elements).
62
- - Utilities re-exported from bundled `jssip-lib`: `createSipClientInstance`, `createSipEventManager`, `WebSocketInterface`, status enums and types.
109
+ - `SipProvider` provides `SipKernel` to children.
110
+ - Hooks: `useSipKernel`, `useSipState`, `useSipSelector`, `useSipActions`, `useSipEvent`, `useSipSessionEvent`, `useSipSessions`, `useSipSession`, `useActiveSipSession`, `useSessionMedia`.
111
+ - Components: `CallPlayer` (basic remote audio element).
112
+ - Kernel utilities: `createSipKernel`, `createSipClientInstance`, `createSipEventManager`.
113
+ - JsSIP utility: `WebSocketInterface`.
114
+
115
+ ## Public API Contract (1.0.0)
116
+
117
+ The package has a single supported entrypoint: `react-jssip-kit`.
118
+
119
+ Public and supported:
120
+ - `SipProvider` and `SipProviderProps`
121
+ - Hooks listed above
122
+ - `CallPlayer`
123
+ - `createSipKernel()`
124
+ - `createSipClientInstance()`
125
+ - `createSipEventManager()`
126
+ - `SipStatus`, `CallStatus`, `CallDirection`
127
+ - Public types exported from root (`SipKernel`, `SipState`, event/call option types)
128
+
129
+ Internal (not part of public contract):
130
+ - Direct imports from `src/core/*`
131
+ - `SipContext` object
132
+ - Any file not re-exported from package root
133
+
134
+ ## Architecture notes
135
+
136
+ - Module map: `docs/MODULES.md`
63
137
 
64
138
  ## Build
65
139