@telnyx/react-voice-commons-sdk 0.1.4 → 0.1.5

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 (56) hide show
  1. package/CHANGELOG.md +19 -16
  2. package/README.md +469 -469
  3. package/TelnyxVoiceCommons.podspec +31 -31
  4. package/ios/CallKitBridge.m +43 -43
  5. package/ios/CallKitBridge.swift +874 -874
  6. package/ios/VoicePnBridge.m +30 -30
  7. package/ios/VoicePnBridge.swift +86 -86
  8. package/lib/callkit/callkit-coordinator.d.ts +114 -110
  9. package/lib/callkit/callkit-coordinator.js +706 -664
  10. package/lib/callkit/callkit.d.ts +41 -41
  11. package/lib/callkit/callkit.js +242 -252
  12. package/lib/callkit/index.js +47 -15
  13. package/lib/callkit/use-callkit.d.ts +19 -19
  14. package/lib/callkit/use-callkit.js +310 -270
  15. package/lib/context/TelnyxVoiceContext.d.ts +9 -9
  16. package/lib/context/TelnyxVoiceContext.js +13 -10
  17. package/lib/hooks/use-callkit-coordinator.d.ts +17 -9
  18. package/lib/hooks/use-callkit-coordinator.js +50 -45
  19. package/lib/hooks/useAppReadyNotifier.js +15 -13
  20. package/lib/hooks/useAppStateHandler.d.ts +11 -6
  21. package/lib/hooks/useAppStateHandler.js +110 -95
  22. package/lib/index.d.ts +21 -3
  23. package/lib/index.js +201 -50
  24. package/lib/internal/CallKitHandler.d.ts +6 -6
  25. package/lib/internal/CallKitHandler.js +104 -96
  26. package/lib/internal/callkit-manager.d.ts +57 -57
  27. package/lib/internal/callkit-manager.js +316 -299
  28. package/lib/internal/calls/call-state-controller.d.ts +78 -73
  29. package/lib/internal/calls/call-state-controller.js +326 -265
  30. package/lib/internal/session/session-manager.d.ts +71 -71
  31. package/lib/internal/session/session-manager.js +437 -360
  32. package/lib/internal/user-defaults-helpers.js +39 -49
  33. package/lib/internal/voice-pn-bridge.d.ts +112 -104
  34. package/lib/internal/voice-pn-bridge.js +193 -203
  35. package/lib/models/call-state.d.ts +46 -46
  36. package/lib/models/call-state.js +74 -70
  37. package/lib/models/call.d.ts +173 -157
  38. package/lib/models/call.js +492 -448
  39. package/lib/models/config.d.ts +18 -11
  40. package/lib/models/config.js +35 -37
  41. package/lib/models/connection-state.d.ts +10 -10
  42. package/lib/models/connection-state.js +16 -16
  43. package/lib/telnyx-voice-app.d.ts +28 -28
  44. package/lib/telnyx-voice-app.js +561 -509
  45. package/lib/telnyx-voip-client.d.ts +174 -167
  46. package/lib/telnyx-voip-client.js +397 -385
  47. package/package.json +115 -115
  48. package/src/callkit/callkit-coordinator.ts +830 -830
  49. package/src/internal/calls/call-state-controller.ts +407 -407
  50. package/src/internal/session/session-manager.ts +483 -483
  51. package/src/internal/voice-pn-bridge.ts +266 -266
  52. package/src/models/call-state.ts +105 -105
  53. package/src/models/call.ts +502 -502
  54. package/src/telnyx-voice-app.tsx +787 -788
  55. package/src/telnyx-voip-client.ts +551 -551
  56. package/src/types/telnyx-sdk.d.ts +93 -93
@@ -1,105 +1,105 @@
1
- /**
2
- * Represents the state of a call in the Telnyx system.
3
- *
4
- * This enum provides a simplified view of call states, abstracting away
5
- * the complexity of the underlying SIP call states.
6
- */
7
- export enum TelnyxCallState {
8
- /** Call is being initiated (outgoing) or received (incoming) */
9
- RINGING = 'RINGING',
10
-
11
- /** Call is connecting after being answered (usually from push notification) */
12
- CONNECTING = 'CONNECTING',
13
-
14
- /** Call has been answered and media is flowing */
15
- ACTIVE = 'ACTIVE',
16
-
17
- /** Call is on hold */
18
- HELD = 'HELD',
19
-
20
- /** Call has ended normally */
21
- ENDED = 'ENDED',
22
-
23
- /** Call failed to connect or was rejected */
24
- FAILED = 'FAILED',
25
-
26
- /** Call was dropped due to network issues */
27
- DROPPED = 'DROPPED',
28
- }
29
-
30
- /**
31
- * Type guard to check if a value is a valid TelnyxCallState
32
- */
33
- export function isTelnyxCallState(value: any): value is TelnyxCallState {
34
- return Object.values(TelnyxCallState).includes(value);
35
- }
36
-
37
- /**
38
- * Helper functions to determine what actions are available in each state
39
- */
40
- export const CallStateHelpers = {
41
- /**
42
- * Can the call be answered in this state?
43
- */
44
- canAnswer(state: TelnyxCallState): boolean {
45
- return state === TelnyxCallState.RINGING;
46
- },
47
-
48
- /**
49
- * Can the call be hung up in this state?
50
- */
51
- canHangup(state: TelnyxCallState): boolean {
52
- return (
53
- state === TelnyxCallState.RINGING ||
54
- state === TelnyxCallState.CONNECTING ||
55
- state === TelnyxCallState.ACTIVE ||
56
- state === TelnyxCallState.HELD
57
- );
58
- },
59
-
60
- /**
61
- * Can the call be put on hold in this state?
62
- */
63
- canHold(state: TelnyxCallState): boolean {
64
- return state === TelnyxCallState.ACTIVE;
65
- },
66
-
67
- /**
68
- * Can the call be resumed from hold in this state?
69
- */
70
- canResume(state: TelnyxCallState): boolean {
71
- return state === TelnyxCallState.HELD;
72
- },
73
-
74
- /**
75
- * Can the call be muted/unmuted in this state?
76
- */
77
- canToggleMute(state: TelnyxCallState): boolean {
78
- return state === TelnyxCallState.ACTIVE || state === TelnyxCallState.HELD;
79
- },
80
-
81
- /**
82
- * Is the call in a terminated state?
83
- */
84
- isTerminated(state: TelnyxCallState): boolean {
85
- return (
86
- state === TelnyxCallState.ENDED ||
87
- state === TelnyxCallState.FAILED ||
88
- state === TelnyxCallState.DROPPED
89
- );
90
- },
91
-
92
- /**
93
- * Is the call in an active state (can have media)?
94
- */
95
- isActive(state: TelnyxCallState): boolean {
96
- return state === TelnyxCallState.ACTIVE || state === TelnyxCallState.HELD;
97
- },
98
-
99
- /**
100
- * Is the call in a connecting state (answered but not yet active)?
101
- */
102
- isConnecting(state: TelnyxCallState): boolean {
103
- return state === TelnyxCallState.CONNECTING;
104
- },
105
- };
1
+ /**
2
+ * Represents the state of a call in the Telnyx system.
3
+ *
4
+ * This enum provides a simplified view of call states, abstracting away
5
+ * the complexity of the underlying SIP call states.
6
+ */
7
+ export enum TelnyxCallState {
8
+ /** Call is being initiated (outgoing) or received (incoming) */
9
+ RINGING = 'RINGING',
10
+
11
+ /** Call is connecting after being answered (usually from push notification) */
12
+ CONNECTING = 'CONNECTING',
13
+
14
+ /** Call has been answered and media is flowing */
15
+ ACTIVE = 'ACTIVE',
16
+
17
+ /** Call is on hold */
18
+ HELD = 'HELD',
19
+
20
+ /** Call has ended normally */
21
+ ENDED = 'ENDED',
22
+
23
+ /** Call failed to connect or was rejected */
24
+ FAILED = 'FAILED',
25
+
26
+ /** Call was dropped due to network issues */
27
+ DROPPED = 'DROPPED',
28
+ }
29
+
30
+ /**
31
+ * Type guard to check if a value is a valid TelnyxCallState
32
+ */
33
+ export function isTelnyxCallState(value: any): value is TelnyxCallState {
34
+ return Object.values(TelnyxCallState).includes(value);
35
+ }
36
+
37
+ /**
38
+ * Helper functions to determine what actions are available in each state
39
+ */
40
+ export const CallStateHelpers = {
41
+ /**
42
+ * Can the call be answered in this state?
43
+ */
44
+ canAnswer(state: TelnyxCallState): boolean {
45
+ return state === TelnyxCallState.RINGING;
46
+ },
47
+
48
+ /**
49
+ * Can the call be hung up in this state?
50
+ */
51
+ canHangup(state: TelnyxCallState): boolean {
52
+ return (
53
+ state === TelnyxCallState.RINGING ||
54
+ state === TelnyxCallState.CONNECTING ||
55
+ state === TelnyxCallState.ACTIVE ||
56
+ state === TelnyxCallState.HELD
57
+ );
58
+ },
59
+
60
+ /**
61
+ * Can the call be put on hold in this state?
62
+ */
63
+ canHold(state: TelnyxCallState): boolean {
64
+ return state === TelnyxCallState.ACTIVE;
65
+ },
66
+
67
+ /**
68
+ * Can the call be resumed from hold in this state?
69
+ */
70
+ canResume(state: TelnyxCallState): boolean {
71
+ return state === TelnyxCallState.HELD;
72
+ },
73
+
74
+ /**
75
+ * Can the call be muted/unmuted in this state?
76
+ */
77
+ canToggleMute(state: TelnyxCallState): boolean {
78
+ return state === TelnyxCallState.ACTIVE || state === TelnyxCallState.HELD;
79
+ },
80
+
81
+ /**
82
+ * Is the call in a terminated state?
83
+ */
84
+ isTerminated(state: TelnyxCallState): boolean {
85
+ return (
86
+ state === TelnyxCallState.ENDED ||
87
+ state === TelnyxCallState.FAILED ||
88
+ state === TelnyxCallState.DROPPED
89
+ );
90
+ },
91
+
92
+ /**
93
+ * Is the call in an active state (can have media)?
94
+ */
95
+ isActive(state: TelnyxCallState): boolean {
96
+ return state === TelnyxCallState.ACTIVE || state === TelnyxCallState.HELD;
97
+ },
98
+
99
+ /**
100
+ * Is the call in a connecting state (answered but not yet active)?
101
+ */
102
+ isConnecting(state: TelnyxCallState): boolean {
103
+ return state === TelnyxCallState.CONNECTING;
104
+ },
105
+ };