@robono/calling-react-native 0.2.2 → 0.4.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 (307) hide show
  1. package/CHANGELOG.md +21 -2
  2. package/README.md +97 -4
  3. package/RobonoCallingRuntime.podspec +1 -1
  4. package/SBOM.spdx.json +6982 -190
  5. package/android/build.gradle +1 -1
  6. package/android/consumer-rules.pro +5 -0
  7. package/android/src/main/java/com/robono/calling/CallingRuntime.java +29 -3
  8. package/android/src/main/java/com/robono/calling/CallingWarnings.java +59 -0
  9. package/app.plugin.cjs +4 -2
  10. package/assets/countdown/1.m4a +0 -0
  11. package/assets/countdown/10.m4a +0 -0
  12. package/assets/countdown/100.m4a +0 -0
  13. package/assets/countdown/101.m4a +0 -0
  14. package/assets/countdown/102.m4a +0 -0
  15. package/assets/countdown/103.m4a +0 -0
  16. package/assets/countdown/104.m4a +0 -0
  17. package/assets/countdown/105.m4a +0 -0
  18. package/assets/countdown/106.m4a +0 -0
  19. package/assets/countdown/107.m4a +0 -0
  20. package/assets/countdown/108.m4a +0 -0
  21. package/assets/countdown/109.m4a +0 -0
  22. package/assets/countdown/11.m4a +0 -0
  23. package/assets/countdown/110.m4a +0 -0
  24. package/assets/countdown/111.m4a +0 -0
  25. package/assets/countdown/112.m4a +0 -0
  26. package/assets/countdown/113.m4a +0 -0
  27. package/assets/countdown/114.m4a +0 -0
  28. package/assets/countdown/115.m4a +0 -0
  29. package/assets/countdown/116.m4a +0 -0
  30. package/assets/countdown/117.m4a +0 -0
  31. package/assets/countdown/118.m4a +0 -0
  32. package/assets/countdown/119.m4a +0 -0
  33. package/assets/countdown/12.m4a +0 -0
  34. package/assets/countdown/120.m4a +0 -0
  35. package/assets/countdown/121.m4a +0 -0
  36. package/assets/countdown/122.m4a +0 -0
  37. package/assets/countdown/123.m4a +0 -0
  38. package/assets/countdown/124.m4a +0 -0
  39. package/assets/countdown/125.m4a +0 -0
  40. package/assets/countdown/126.m4a +0 -0
  41. package/assets/countdown/127.m4a +0 -0
  42. package/assets/countdown/128.m4a +0 -0
  43. package/assets/countdown/129.m4a +0 -0
  44. package/assets/countdown/13.m4a +0 -0
  45. package/assets/countdown/130.m4a +0 -0
  46. package/assets/countdown/131.m4a +0 -0
  47. package/assets/countdown/132.m4a +0 -0
  48. package/assets/countdown/133.m4a +0 -0
  49. package/assets/countdown/134.m4a +0 -0
  50. package/assets/countdown/135.m4a +0 -0
  51. package/assets/countdown/136.m4a +0 -0
  52. package/assets/countdown/137.m4a +0 -0
  53. package/assets/countdown/138.m4a +0 -0
  54. package/assets/countdown/139.m4a +0 -0
  55. package/assets/countdown/14.m4a +0 -0
  56. package/assets/countdown/140.m4a +0 -0
  57. package/assets/countdown/141.m4a +0 -0
  58. package/assets/countdown/142.m4a +0 -0
  59. package/assets/countdown/143.m4a +0 -0
  60. package/assets/countdown/144.m4a +0 -0
  61. package/assets/countdown/145.m4a +0 -0
  62. package/assets/countdown/146.m4a +0 -0
  63. package/assets/countdown/147.m4a +0 -0
  64. package/assets/countdown/148.m4a +0 -0
  65. package/assets/countdown/149.m4a +0 -0
  66. package/assets/countdown/15.m4a +0 -0
  67. package/assets/countdown/150.m4a +0 -0
  68. package/assets/countdown/151.m4a +0 -0
  69. package/assets/countdown/152.m4a +0 -0
  70. package/assets/countdown/153.m4a +0 -0
  71. package/assets/countdown/154.m4a +0 -0
  72. package/assets/countdown/155.m4a +0 -0
  73. package/assets/countdown/156.m4a +0 -0
  74. package/assets/countdown/157.m4a +0 -0
  75. package/assets/countdown/158.m4a +0 -0
  76. package/assets/countdown/159.m4a +0 -0
  77. package/assets/countdown/16.m4a +0 -0
  78. package/assets/countdown/160.m4a +0 -0
  79. package/assets/countdown/161.m4a +0 -0
  80. package/assets/countdown/162.m4a +0 -0
  81. package/assets/countdown/163.m4a +0 -0
  82. package/assets/countdown/164.m4a +0 -0
  83. package/assets/countdown/165.m4a +0 -0
  84. package/assets/countdown/166.m4a +0 -0
  85. package/assets/countdown/167.m4a +0 -0
  86. package/assets/countdown/168.m4a +0 -0
  87. package/assets/countdown/169.m4a +0 -0
  88. package/assets/countdown/17.m4a +0 -0
  89. package/assets/countdown/170.m4a +0 -0
  90. package/assets/countdown/171.m4a +0 -0
  91. package/assets/countdown/172.m4a +0 -0
  92. package/assets/countdown/173.m4a +0 -0
  93. package/assets/countdown/174.m4a +0 -0
  94. package/assets/countdown/175.m4a +0 -0
  95. package/assets/countdown/176.m4a +0 -0
  96. package/assets/countdown/177.m4a +0 -0
  97. package/assets/countdown/178.m4a +0 -0
  98. package/assets/countdown/179.m4a +0 -0
  99. package/assets/countdown/18.m4a +0 -0
  100. package/assets/countdown/180.m4a +0 -0
  101. package/assets/countdown/181.m4a +0 -0
  102. package/assets/countdown/182.m4a +0 -0
  103. package/assets/countdown/183.m4a +0 -0
  104. package/assets/countdown/184.m4a +0 -0
  105. package/assets/countdown/185.m4a +0 -0
  106. package/assets/countdown/186.m4a +0 -0
  107. package/assets/countdown/187.m4a +0 -0
  108. package/assets/countdown/188.m4a +0 -0
  109. package/assets/countdown/189.m4a +0 -0
  110. package/assets/countdown/19.m4a +0 -0
  111. package/assets/countdown/190.m4a +0 -0
  112. package/assets/countdown/191.m4a +0 -0
  113. package/assets/countdown/192.m4a +0 -0
  114. package/assets/countdown/193.m4a +0 -0
  115. package/assets/countdown/194.m4a +0 -0
  116. package/assets/countdown/195.m4a +0 -0
  117. package/assets/countdown/196.m4a +0 -0
  118. package/assets/countdown/197.m4a +0 -0
  119. package/assets/countdown/198.m4a +0 -0
  120. package/assets/countdown/199.m4a +0 -0
  121. package/assets/countdown/2.m4a +0 -0
  122. package/assets/countdown/20.m4a +0 -0
  123. package/assets/countdown/200.m4a +0 -0
  124. package/assets/countdown/201.m4a +0 -0
  125. package/assets/countdown/202.m4a +0 -0
  126. package/assets/countdown/203.m4a +0 -0
  127. package/assets/countdown/204.m4a +0 -0
  128. package/assets/countdown/205.m4a +0 -0
  129. package/assets/countdown/206.m4a +0 -0
  130. package/assets/countdown/207.m4a +0 -0
  131. package/assets/countdown/208.m4a +0 -0
  132. package/assets/countdown/209.m4a +0 -0
  133. package/assets/countdown/21.m4a +0 -0
  134. package/assets/countdown/210.m4a +0 -0
  135. package/assets/countdown/211.m4a +0 -0
  136. package/assets/countdown/212.m4a +0 -0
  137. package/assets/countdown/213.m4a +0 -0
  138. package/assets/countdown/214.m4a +0 -0
  139. package/assets/countdown/215.m4a +0 -0
  140. package/assets/countdown/216.m4a +0 -0
  141. package/assets/countdown/217.m4a +0 -0
  142. package/assets/countdown/218.m4a +0 -0
  143. package/assets/countdown/219.m4a +0 -0
  144. package/assets/countdown/22.m4a +0 -0
  145. package/assets/countdown/220.m4a +0 -0
  146. package/assets/countdown/221.m4a +0 -0
  147. package/assets/countdown/222.m4a +0 -0
  148. package/assets/countdown/223.m4a +0 -0
  149. package/assets/countdown/224.m4a +0 -0
  150. package/assets/countdown/225.m4a +0 -0
  151. package/assets/countdown/226.m4a +0 -0
  152. package/assets/countdown/227.m4a +0 -0
  153. package/assets/countdown/228.m4a +0 -0
  154. package/assets/countdown/229.m4a +0 -0
  155. package/assets/countdown/23.m4a +0 -0
  156. package/assets/countdown/230.m4a +0 -0
  157. package/assets/countdown/231.m4a +0 -0
  158. package/assets/countdown/232.m4a +0 -0
  159. package/assets/countdown/233.m4a +0 -0
  160. package/assets/countdown/234.m4a +0 -0
  161. package/assets/countdown/235.m4a +0 -0
  162. package/assets/countdown/236.m4a +0 -0
  163. package/assets/countdown/237.m4a +0 -0
  164. package/assets/countdown/238.m4a +0 -0
  165. package/assets/countdown/239.m4a +0 -0
  166. package/assets/countdown/24.m4a +0 -0
  167. package/assets/countdown/240.m4a +0 -0
  168. package/assets/countdown/25.m4a +0 -0
  169. package/assets/countdown/26.m4a +0 -0
  170. package/assets/countdown/27.m4a +0 -0
  171. package/assets/countdown/28.m4a +0 -0
  172. package/assets/countdown/29.m4a +0 -0
  173. package/assets/countdown/3.m4a +0 -0
  174. package/assets/countdown/30.m4a +0 -0
  175. package/assets/countdown/31.m4a +0 -0
  176. package/assets/countdown/32.m4a +0 -0
  177. package/assets/countdown/33.m4a +0 -0
  178. package/assets/countdown/34.m4a +0 -0
  179. package/assets/countdown/35.m4a +0 -0
  180. package/assets/countdown/36.m4a +0 -0
  181. package/assets/countdown/37.m4a +0 -0
  182. package/assets/countdown/38.m4a +0 -0
  183. package/assets/countdown/39.m4a +0 -0
  184. package/assets/countdown/4.m4a +0 -0
  185. package/assets/countdown/40.m4a +0 -0
  186. package/assets/countdown/41.m4a +0 -0
  187. package/assets/countdown/42.m4a +0 -0
  188. package/assets/countdown/43.m4a +0 -0
  189. package/assets/countdown/44.m4a +0 -0
  190. package/assets/countdown/45.m4a +0 -0
  191. package/assets/countdown/46.m4a +0 -0
  192. package/assets/countdown/47.m4a +0 -0
  193. package/assets/countdown/48.m4a +0 -0
  194. package/assets/countdown/49.m4a +0 -0
  195. package/assets/countdown/5.m4a +0 -0
  196. package/assets/countdown/50.m4a +0 -0
  197. package/assets/countdown/51.m4a +0 -0
  198. package/assets/countdown/52.m4a +0 -0
  199. package/assets/countdown/53.m4a +0 -0
  200. package/assets/countdown/54.m4a +0 -0
  201. package/assets/countdown/55.m4a +0 -0
  202. package/assets/countdown/56.m4a +0 -0
  203. package/assets/countdown/57.m4a +0 -0
  204. package/assets/countdown/58.m4a +0 -0
  205. package/assets/countdown/59.m4a +0 -0
  206. package/assets/countdown/6.m4a +0 -0
  207. package/assets/countdown/60.m4a +0 -0
  208. package/assets/countdown/61.m4a +0 -0
  209. package/assets/countdown/62.m4a +0 -0
  210. package/assets/countdown/63.m4a +0 -0
  211. package/assets/countdown/64.m4a +0 -0
  212. package/assets/countdown/65.m4a +0 -0
  213. package/assets/countdown/66.m4a +0 -0
  214. package/assets/countdown/67.m4a +0 -0
  215. package/assets/countdown/68.m4a +0 -0
  216. package/assets/countdown/69.m4a +0 -0
  217. package/assets/countdown/7.m4a +0 -0
  218. package/assets/countdown/70.m4a +0 -0
  219. package/assets/countdown/71.m4a +0 -0
  220. package/assets/countdown/72.m4a +0 -0
  221. package/assets/countdown/73.m4a +0 -0
  222. package/assets/countdown/74.m4a +0 -0
  223. package/assets/countdown/75.m4a +0 -0
  224. package/assets/countdown/76.m4a +0 -0
  225. package/assets/countdown/77.m4a +0 -0
  226. package/assets/countdown/78.m4a +0 -0
  227. package/assets/countdown/79.m4a +0 -0
  228. package/assets/countdown/8.m4a +0 -0
  229. package/assets/countdown/80.m4a +0 -0
  230. package/assets/countdown/81.m4a +0 -0
  231. package/assets/countdown/82.m4a +0 -0
  232. package/assets/countdown/83.m4a +0 -0
  233. package/assets/countdown/84.m4a +0 -0
  234. package/assets/countdown/85.m4a +0 -0
  235. package/assets/countdown/86.m4a +0 -0
  236. package/assets/countdown/87.m4a +0 -0
  237. package/assets/countdown/88.m4a +0 -0
  238. package/assets/countdown/89.m4a +0 -0
  239. package/assets/countdown/9.m4a +0 -0
  240. package/assets/countdown/90.m4a +0 -0
  241. package/assets/countdown/91.m4a +0 -0
  242. package/assets/countdown/92.m4a +0 -0
  243. package/assets/countdown/93.m4a +0 -0
  244. package/assets/countdown/94.m4a +0 -0
  245. package/assets/countdown/95.m4a +0 -0
  246. package/assets/countdown/96.m4a +0 -0
  247. package/assets/countdown/97.m4a +0 -0
  248. package/assets/countdown/98.m4a +0 -0
  249. package/assets/countdown/99.m4a +0 -0
  250. package/assets/countdown/beep.wav +0 -0
  251. package/assets/countdown/manifest.json +1450 -0
  252. package/broadcast/SampleHandler.swift +92 -0
  253. package/dist/CallRecord.d.ts +19 -0
  254. package/dist/CallRecord.js +22 -0
  255. package/dist/appearance.d.ts +69 -4
  256. package/dist/appearance.js +70 -5
  257. package/dist/components.d.ts +135 -0
  258. package/dist/components.js +185 -0
  259. package/dist/controller.d.mts +1 -1
  260. package/dist/controller.mjs +61 -7
  261. package/dist/countdown-assets.d.ts +1 -0
  262. package/dist/countdown-assets.js +244 -0
  263. package/dist/countdown-native.d.ts +13 -0
  264. package/dist/countdown-native.js +66 -0
  265. package/dist/countdown.d.mts +13 -0
  266. package/dist/countdown.mjs +72 -0
  267. package/dist/expo-notifications.d.ts +1 -1
  268. package/dist/expo-notifications.js +3 -3
  269. package/dist/group-phase.d.mts +4 -0
  270. package/dist/group-phase.mjs +26 -0
  271. package/dist/groups.d.ts +41 -0
  272. package/dist/groups.js +91 -0
  273. package/dist/history.d.ts +6 -15
  274. package/dist/history.js +3 -11
  275. package/dist/index.d.ts +4 -2
  276. package/dist/index.js +4 -2
  277. package/dist/native-video.d.ts +8 -0
  278. package/dist/native-video.js +10 -0
  279. package/dist/native.d.ts +2 -0
  280. package/dist/native.js +56 -3
  281. package/dist/notification-router.d.ts +2 -1
  282. package/dist/notification-router.js +4 -4
  283. package/dist/notifications.d.ts +5 -3
  284. package/dist/notifications.js +7 -5
  285. package/dist/runtime.d.ts +8 -1
  286. package/dist/runtime.js +10 -1
  287. package/dist/screens.d.ts +6 -54
  288. package/dist/screens.js +17 -42
  289. package/dist/types.d.ts +45 -1
  290. package/dist/versions.d.ts +2 -0
  291. package/dist/versions.js +3 -0
  292. package/dist/visual/RobonoIcon.d.ts +232 -0
  293. package/dist/visual/RobonoIcon.js +20 -0
  294. package/dist/visual/icon-nodes.d.ts +3 -0
  295. package/dist/visual/icon-nodes.js +2 -0
  296. package/dist/visual/icon-paths.d.ts +221 -0
  297. package/dist/visual/icon-paths.js +221 -0
  298. package/examples/CallingHost.tsx +16 -8
  299. package/examples/CustomCallingScreen.tsx +64 -0
  300. package/examples/ExpoGroupCallingHost.tsx +42 -0
  301. package/examples/GroupCallingHost.tsx +70 -0
  302. package/ios/RobonoCallingRuntime.m +30 -0
  303. package/licenses/robono-icons-lucide-license.txt +43 -0
  304. package/licenses/robono-icons-weather-attribution.txt +1 -0
  305. package/licenses/robono-icons-weather-license.txt +21 -0
  306. package/package.json +26 -5
  307. package/plugin/screensharing.cjs +39 -0
@@ -0,0 +1,92 @@
1
+ import ReplayKit
2
+ import CoreImage
3
+ import ImageIO
4
+ import Darwin
5
+
6
+ /// ReplayKit supplies video only. Call microphone audio stays with WebRTC.
7
+ final class SampleHandler: RPBroadcastSampleHandler {
8
+ private let frames = DispatchQueue(label: "robono.screen.frames")
9
+ private let slot = DispatchSemaphore(value: 1)
10
+ private let context = CIContext(options: [.cacheIntermediates: false])
11
+ private var socketFD: Int32 = -1
12
+ private var lastStatus: CFTimeInterval = 0
13
+ private var lastFrame: CFTimeInterval = 0
14
+ private var stopped = false
15
+ private var startedAt = Date()
16
+
17
+ override func broadcastStarted(withSetupInfo setupInfo: [String: NSObject]?) {
18
+ startedAt = Date()
19
+ }
20
+ override func broadcastFinished() {
21
+ frames.async { self.stopped = true; self.status(false); self.disconnect() }
22
+ }
23
+ override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with type: RPSampleBufferType) {
24
+ guard type == .video, let buffer = CMSampleBufferGetImageBuffer(sampleBuffer),
25
+ slot.wait(timeout: .now()) == .success else { return }
26
+ let orientation = (CMGetAttachment(sampleBuffer, key: RPVideoSampleOrientationKey as CFString, attachmentModeOut: nil) as? NSNumber)?.intValue ?? 1
27
+ frames.async { [self] in
28
+ defer { slot.signal() }
29
+ guard !stopped else { return }
30
+ let now = CACurrentMediaTime()
31
+ guard now - lastFrame >= 1.0 / 15.0 else { return }
32
+ lastFrame = now
33
+ guard connect() else {
34
+ if Date().timeIntervalSince(startedAt) > 20 { finish("Open the call before sharing your screen.") }
35
+ return
36
+ }
37
+ autoreleasepool {
38
+ let input = CIImage(cvPixelBuffer: buffer)
39
+ let scale = min(1, 1280 / max(input.extent.width, input.extent.height))
40
+ let image = input.transformed(by: CGAffineTransform(scaleX: scale, y: scale))
41
+ guard let jpeg = context.jpegRepresentation(of: image, colorSpace: CGColorSpaceCreateDeviceRGB(), options: [kCGImageDestinationLossyCompressionQuality as CIImageRepresentationOption: 0.7]) else { return }
42
+ let header = "HTTP/1.1 200 OK\r\nContent-Length: \(jpeg.count)\r\nBuffer-Width: \(Int(image.extent.width))\r\nBuffer-Height: \(Int(image.extent.height))\r\nBuffer-Orientation: \(orientation)\r\n\r\n"
43
+ var packet = Data(header.utf8); packet.append(jpeg)
44
+ let sent = packet.withUnsafeBytes { raw -> Bool in
45
+ guard let base = raw.baseAddress else { return false }
46
+ var offset = 0
47
+ while offset < raw.count {
48
+ let n = Darwin.send(socketFD, base.advanced(by: offset), raw.count - offset, 0)
49
+ if n <= 0 { return false }; offset += n
50
+ }
51
+ return true
52
+ }
53
+ if !sent { finish("Screen sharing ended.") }
54
+ else if now - lastStatus > 0.5 { lastStatus = now; status(true) }
55
+ }
56
+ }
57
+ }
58
+ private func connect() -> Bool {
59
+ if socketFD >= 0 { return true }
60
+ guard let group = Bundle.main.object(forInfoDictionaryKey: "RTCAppGroupIdentifier") as? String,
61
+ let url = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: group) else { return false }
62
+ let path = url.appendingPathComponent("rtc_SSFD").path
63
+ var address = sockaddr_un(); address.sun_family = sa_family_t(AF_UNIX)
64
+ let bytes = path.utf8CString
65
+ guard bytes.count <= MemoryLayout.size(ofValue: address.sun_path) else { return false }
66
+ withUnsafeMutableBytes(of: &address.sun_path) { destination in
67
+ bytes.withUnsafeBytes { source in destination.copyBytes(from: source) }
68
+ }
69
+ let fd = Darwin.socket(AF_UNIX, SOCK_STREAM, 0)
70
+ guard fd >= 0 else { return false }
71
+ var noSignal: Int32 = 1
72
+ setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &noSignal, socklen_t(MemoryLayout<Int32>.size))
73
+ var timeout = timeval(tv_sec: 2, tv_usec: 0)
74
+ setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, socklen_t(MemoryLayout<timeval>.size))
75
+ let result = withUnsafePointer(to: &address) { pointer in
76
+ pointer.withMemoryRebound(to: sockaddr.self, capacity: 1) { Darwin.connect(fd, $0, socklen_t(MemoryLayout<sockaddr_un>.size)) }
77
+ }
78
+ guard result == 0 else { Darwin.close(fd); return false }
79
+ socketFD = fd; return true
80
+ }
81
+ private func status(_ active: Bool) {
82
+ guard let group = Bundle.main.object(forInfoDictionaryKey: "RTCAppGroupIdentifier") as? String,
83
+ let url = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: group),
84
+ let data = try? JSONSerialization.data(withJSONObject: ["active": active, "at": Date().timeIntervalSince1970 * 1000]) else { return }
85
+ try? data.write(to: url.appendingPathComponent("robono-screen-status.json"), options: .atomic)
86
+ }
87
+ private func disconnect() { if socketFD >= 0 { Darwin.close(socketFD); socketFD = -1 } }
88
+ private func finish(_ message: String) {
89
+ stopped = true; status(false); disconnect()
90
+ finishBroadcastWithError(NSError(domain: "RobonoScreenSharing", code: 1, userInfo: [NSLocalizedDescriptionKey: message]))
91
+ }
92
+ }
@@ -0,0 +1,19 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import type { CallHistoryEntry } from '@robono/calling';
3
+ /** A call record, aligned with its caller. Separate from the text-bubble component. */
4
+ export declare function CallRecord({ entry, incomingColor, outgoingColor, textColor, secondaryColor, onCallBack, label, children, showTime }: {
5
+ entry: CallHistoryEntry;
6
+ incomingColor: string;
7
+ outgoingColor: string;
8
+ textColor?: string;
9
+ secondaryColor?: string;
10
+ /** Caller must recheck live availability before placing the callback. */
11
+ onCallBack?: () => void;
12
+ label: (entry: CallHistoryEntry) => {
13
+ label: string;
14
+ detail: string;
15
+ missed: boolean;
16
+ };
17
+ children?: ReactNode;
18
+ showTime?: boolean;
19
+ }): React.JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { Pressable, StyleSheet, Text, View } from 'react-native';
4
+ import { RobonoIcon } from './visual/RobonoIcon.js';
5
+ /** A call record, aligned with its caller. Separate from the text-bubble component. */
6
+ export function CallRecord({ entry, incomingColor, outgoingColor, textColor = '#ffffff', secondaryColor, onCallBack, label, children, showTime = false }) {
7
+ const description = label(entry);
8
+ const incoming = entry.role === 'callee';
9
+ const connected = entry.connectedAt != null;
10
+ const meta = [description.detail, showTime ? new Date(entry.createdAt).toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' }) : ''].filter(Boolean).join(' · ');
11
+ const actions = React.Children.toArray(children);
12
+ const content = _jsxs(_Fragment, { children: [_jsxs(View, { style: s.symbol, accessible: false, children: [_jsx(RobonoIcon, { name: description.missed ? 'missed' : entry.kind === 'video' ? 'video' : 'phone', size: 24, color: description.missed ? '#ff797e' : textColor }), !description.missed && _jsx(View, { style: [s.direction, { backgroundColor: incoming ? incomingColor : outgoingColor }], children: _jsx(RobonoIcon, { name: incoming ? 'incoming' : 'outgoing', size: 13, color: connected ? '#72ce99' : '#ff797e' }) })] }), _jsxs(View, { style: s.text, children: [_jsx(Text, { style: [s.title, { color: textColor }], children: description.label }), !!meta && _jsx(Text, { style: [s.detail, { color: secondaryColor || textColor }], children: meta })] })] });
13
+ return _jsxs(View, { style: [s.record, { backgroundColor: incoming ? incomingColor : outgoingColor, alignSelf: incoming ? 'flex-start' : 'flex-end' }], children: [onCallBack ? _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: `${description.label}${meta ? '. ' + meta : ''}`, accessibilityHint: incoming ? 'Call back' : 'Call again', onPress: onCallBack, style: ({ pressed }) => [s.main, pressed && { opacity: .65 }], children: content }) : _jsx(View, { style: s.main, children: content }), actions.length > 0 && _jsx(View, { style: s.actions, children: actions })] });
14
+ }
15
+ const s = StyleSheet.create({
16
+ record: { maxWidth: '100%', borderRadius: 14, borderWidth: 1, borderColor: '#ffffff16', flexDirection: 'row', alignItems: 'center', paddingHorizontal: 10, paddingVertical: 6 },
17
+ main: { minHeight: 48, flexDirection: 'row', alignItems: 'center', gap: 10, flexShrink: 1 },
18
+ symbol: { width: 38, height: 38, borderRadius: 12, backgroundColor: '#ffffff0d', alignItems: 'center', justifyContent: 'center' },
19
+ direction: { position: 'absolute', right: -2, bottom: -2, borderRadius: 7, padding: 1 },
20
+ text: { flexShrink: 1, gap: 3 }, title: { fontSize: 16, fontWeight: '600' }, detail: { fontSize: 12, fontVariant: ['tabular-nums'] },
21
+ actions: { borderLeftWidth: 1, borderLeftColor: '#ffffff22', marginLeft: 10, paddingLeft: 4, flexDirection: 'row', alignItems: 'center' },
22
+ });
@@ -8,8 +8,37 @@ export declare const callingColors: {
8
8
  answer: string;
9
9
  end: string;
10
10
  };
11
+ /** Separate palettes let apps follow the device without changing saved brand colors. */
12
+ export declare const callingLightColors: {
13
+ background: string;
14
+ foreground: string;
15
+ secondary: string;
16
+ control: string;
17
+ accent: string;
18
+ answer: string;
19
+ end: string;
20
+ };
21
+ export interface CallingPresentation {
22
+ colorMode: "dark" | "light" | "system";
23
+ font: "system" | "serif" | "monospace";
24
+ textScale: 1 | 1.15 | 1.3;
25
+ layout: "standard" | "compact";
26
+ controlShape: "round" | "rounded";
27
+ showAvatar: boolean;
28
+ showCallDescription: boolean;
29
+ }
30
+ export declare const callingPresentation: CallingPresentation;
11
31
  export declare const callingText: {
12
32
  call: string;
33
+ videoCall: string;
34
+ incomingVideo: string;
35
+ cameraOn: string;
36
+ cameraOff: string;
37
+ switchCamera: string;
38
+ more: string;
39
+ shareScreen: string;
40
+ stopSharing: string;
41
+ sharingScreen: string;
13
42
  contact: string;
14
43
  incoming: string;
15
44
  outgoing: string;
@@ -49,16 +78,52 @@ export interface CallingAppearance {
49
78
  appName: string;
50
79
  logoUrl: string | null;
51
80
  theme: typeof callingColors;
81
+ /** Omitted settings retain the original dark, standard layout. */
82
+ lightTheme?: typeof callingColors;
83
+ presentation?: Partial<CallingPresentation>;
52
84
  labels: typeof callingText;
53
85
  sounds: Record<SoundEvent, SoundChoice>;
54
86
  }
55
87
  export declare function defaultCallingAppearance(appName?: string): CallingAppearance;
56
88
  export declare function validateCallingAppearance(input: unknown): CallingAppearance;
89
+ /** Shared by the optional mobile screen and website preview. */
90
+ export declare function resolveCallingDesign(appearance?: CallingAppearance, deviceMode?: "light" | "dark" | "unspecified" | null): {
91
+ presentation: {
92
+ colorMode: "dark" | "light" | "system";
93
+ font: "system" | "serif" | "monospace";
94
+ textScale: 1 | 1.15 | 1.3;
95
+ layout: "standard" | "compact";
96
+ controlShape: "round" | "rounded";
97
+ showAvatar: boolean;
98
+ showCallDescription: boolean;
99
+ };
100
+ colors: {
101
+ background: string;
102
+ foreground: string;
103
+ secondary: string;
104
+ control: string;
105
+ accent: string;
106
+ answer: string;
107
+ end: string;
108
+ };
109
+ mode: "light" | "dark";
110
+ avatarSize: number;
111
+ identityGap: number;
112
+ controlRadius: number;
113
+ fontFamily: {
114
+ ios: string | undefined;
115
+ android: "serif" | "monospace" | undefined;
116
+ web: string;
117
+ };
118
+ };
57
119
  /** Choose readable icon/status-bar ink against a brand color. */
58
120
  export declare function callingInk(color: string): "#ffffff" | "#000000";
59
121
  export declare const callingIcons: {
60
- answer: string;
61
- end: string;
62
- mute: string;
63
- speaker: string;
122
+ share: "M9 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5M7 21h10M12 21V8m-4 4 4-4 4 4";
123
+ camera: "M5 5.5h9a2.5 2.5 0 0 1 2.5 2.5v8a2.5 2.5 0 0 1-2.5 2.5H5A2.5 2.5 0 0 1 2.5 16V8A2.5 2.5 0 0 1 5 5.5ZM16.5 10l5-3v10l-5-3";
124
+ flip: "M5 8a8 8 0 0 1 14-1l1 2M15 9h5V4M19 16a8 8 0 0 1-14 1l-1-2M9 15H4v5";
125
+ answer: "M5 3.5h3l2 5-2.5 2a14 14 0 0 0 6 6l2-2.5 5 2v3c0 1.2-1.1 2.1-2.3 1.9A18.5 18.5 0 0 1 3.1 5.8C2.9 4.6 3.8 3.5 5 3.5Z";
126
+ end: "M3 10.5a17 17 0 0 1 18 0v5l-5-1v-3a12 12 0 0 0-8 0v3l-5 1Z";
127
+ mute: "M9 5a3 3 0 0 1 6 0v7a3 3 0 0 1-6 0ZM5.5 11.5v.5a6.5 6.5 0 0 0 13 0v-.5M12 18.5V22m-3 0h6";
128
+ speaker: "M3 9h4l5-4v14l-5-4H3ZM16 8a5 5 0 0 1 0 8m3-11a9 9 0 0 1 0 14";
64
129
  };
@@ -1,3 +1,4 @@
1
+ import { iconPaths } from "./visual/icon-paths.js";
1
2
  /** Shared website/SDK contract. Values contain presentation only, never credentials. */
2
3
  export const callingColors = {
3
4
  background: "#080808",
@@ -8,8 +9,24 @@ export const callingColors = {
8
9
  answer: "#247949",
9
10
  end: "#bd2929",
10
11
  };
12
+ /** Separate palettes let apps follow the device without changing saved brand colors. */
13
+ export const callingLightColors = {
14
+ background: "#ffffff", foreground: "#171717", secondary: "#606060",
15
+ control: "#eeeeee", accent: "#a84b11", answer: "#247949", end: "#bd2929",
16
+ };
17
+ export const callingPresentation = {
18
+ colorMode: "dark", font: "system", textScale: 1, layout: "standard",
19
+ controlShape: "round", showAvatar: true, showCallDescription: true,
20
+ };
11
21
  export const callingText = {
12
22
  call: "Voice call",
23
+ videoCall: "Video call",
24
+ incomingVideo: "Incoming video call",
25
+ cameraOn: "Camera on",
26
+ cameraOff: "Camera off",
27
+ switchCamera: "Flip camera",
28
+ more: "More",
29
+ shareScreen: "Share screen", stopSharing: "Stop sharing", sharingScreen: "Sharing screen",
13
30
  contact: "Contact",
14
31
  incoming: "Incoming voice call",
15
32
  outgoing: "Calling…",
@@ -58,6 +75,8 @@ export function defaultCallingAppearance(appName = "") {
58
75
  appName: appName.trim().slice(0, 60),
59
76
  logoUrl: null,
60
77
  theme: { ...callingColors },
78
+ lightTheme: { ...callingLightColors },
79
+ presentation: { ...callingPresentation },
61
80
  labels: { ...callingText },
62
81
  sounds: { ...callingSounds },
63
82
  };
@@ -81,8 +100,37 @@ export function validateCallingAppearance(input) {
81
100
  }
82
101
  out.theme[key] = x;
83
102
  }
103
+ if (v.lightTheme !== undefined) {
104
+ for (const key of Object.keys(callingColors)) {
105
+ const x = v.lightTheme?.[key];
106
+ if (typeof x !== "string" || !/^#[0-9a-f]{6}$/i.test(x)) {
107
+ throw Error("Choose a valid light color for " + key + ".");
108
+ }
109
+ out.lightTheme[key] = x;
110
+ }
111
+ }
112
+ if (v.presentation !== undefined) {
113
+ if (!v.presentation || typeof v.presentation !== "object" || Array.isArray(v.presentation)) {
114
+ throw Error("Choose valid screen appearance settings.");
115
+ }
116
+ const choices = {
117
+ colorMode: ["dark", "light", "system"], font: ["system", "serif", "monospace"],
118
+ textScale: [1, 1.15, 1.3], layout: ["standard", "compact"],
119
+ controlShape: ["round", "rounded"], showAvatar: [true, false],
120
+ showCallDescription: [true, false],
121
+ };
122
+ for (const key of Object.keys(choices)) {
123
+ const value = v.presentation[key];
124
+ if (value === undefined)
125
+ continue;
126
+ if (!choices[key].includes(value)) {
127
+ throw Error("Choose a supported value for " + key + ".");
128
+ }
129
+ Object.assign(out.presentation, { [key]: value });
130
+ }
131
+ }
84
132
  for (const key of Object.keys(callingText)) {
85
- const x = v.labels?.[key];
133
+ const x = v.labels?.[key] ?? (['more', 'videoCall', 'incomingVideo', 'cameraOn', 'cameraOff', 'switchCamera', 'shareScreen', 'stopSharing', 'sharingScreen'].includes(key) ? callingText[key] : undefined);
86
134
  if (typeof x !== "string" || !x.trim() ||
87
135
  x.length >
88
136
  ([
@@ -109,6 +157,25 @@ export function validateCallingAppearance(input) {
109
157
  }
110
158
  return out;
111
159
  }
160
+ /** Shared by the optional mobile screen and website preview. */
161
+ export function resolveCallingDesign(appearance, deviceMode = "dark") {
162
+ const presentation = { ...callingPresentation, ...appearance?.presentation };
163
+ const light = presentation.colorMode === "light" ||
164
+ (presentation.colorMode === "system" && deviceMode === "light");
165
+ return {
166
+ presentation,
167
+ colors: light ? { ...callingLightColors, ...appearance?.lightTheme } : { ...callingColors, ...appearance?.theme },
168
+ mode: light ? "light" : "dark",
169
+ avatarSize: presentation.layout === "compact" ? 72 : 104,
170
+ identityGap: presentation.layout === "compact" ? 10 : 14,
171
+ controlRadius: presentation.controlShape === "rounded" ? 18 : 36,
172
+ fontFamily: {
173
+ ios: presentation.font === "serif" ? "Georgia" : presentation.font === "monospace" ? "Menlo" : undefined,
174
+ android: presentation.font === "system" ? undefined : presentation.font,
175
+ web: presentation.font === "serif" ? 'Georgia, "Times New Roman", serif' : presentation.font === "monospace" ? 'Menlo, Consolas, monospace' : '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
176
+ },
177
+ };
178
+ }
112
179
  /** Choose readable icon/status-bar ink against a brand color. */
113
180
  export function callingInk(color) {
114
181
  const channels = [1, 3, 5].map((i) => parseInt(color.slice(i, i + 2), 16) / 255).map((v) => v <= .04045 ? v / 12.92 : ((v + .055) / 1.055) ** 2.4);
@@ -119,8 +186,6 @@ export function callingInk(color) {
119
186
  : "#ffffff";
120
187
  }
121
188
  export const callingIcons = {
122
- answer: "M6 3H3c-1 0-1 1-1 2 1 9 8 16 17 17 1 0 2 0 2-1v-4l-5-2-2 3C9 16 6 13 5 9l3-2-2-4Z",
123
- end: "M2 11c6-5 14-5 20 0v5l-5-1v-4c-3-1-7-1-10 0v4l-5 1v-5Z",
124
- mute: "M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3ZM5 11v1a7 7 0 0 0 6 7v3h2v-3a7 7 0 0 0 6-7v-1h-2v1a5 5 0 0 1-10 0v-1H5Z",
125
- speaker: "M3 9v6h4l5 4V5L7 9H3Zm12-3v2a5 5 0 0 1 0 8v2a7 7 0 0 0 0-12Zm3-3v2a9 9 0 0 1 0 14v2a11 11 0 0 0 0-18Z",
189
+ share: iconPaths['screen-share'], camera: iconPaths.video, flip: iconPaths.flip,
190
+ answer: iconPaths.phone, end: iconPaths['phone-end'], mute: iconPaths.mic, speaker: iconPaths.speaker,
126
191
  };
@@ -0,0 +1,135 @@
1
+ import React, { type ComponentType, type ReactNode } from 'react';
2
+ import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
3
+ import { callingText, callingIcons, resolveCallingDesign, type CallingAppearance } from './appearance.js';
4
+ import type { CallingState } from './types.js';
5
+ export interface CallingTheme {
6
+ background: string;
7
+ foreground: string;
8
+ secondary: string;
9
+ control: string;
10
+ accent: string;
11
+ answer: string;
12
+ end: string;
13
+ }
14
+ type DefaultCallingLabels = typeof callingText;
15
+ export interface CallingLabels extends DefaultCallingLabels {
16
+ }
17
+ export type CallingAction = 'answer' | 'decline' | 'mute' | 'speaker' | 'resume' | 'end' | 'close' | 'camera' | 'flip' | 'share';
18
+ type Icon = keyof typeof callingIcons;
19
+ export interface CallingActionModel {
20
+ label: string;
21
+ visible: boolean;
22
+ disabled: boolean;
23
+ selected: boolean;
24
+ busy: boolean;
25
+ icon?: Icon;
26
+ /** Answer/decline/end use a semantic button color. Other controls use the theme. */
27
+ color?: string;
28
+ /** Hidden and disabled actions are ignored; the controller remains authoritative. */
29
+ onPress(): void;
30
+ }
31
+ export interface CallingSectionProps {
32
+ style?: StyleProp<ViewStyle>;
33
+ }
34
+ export interface CallingLayoutProps extends CallingSectionProps {
35
+ children?: ReactNode;
36
+ contentContainerStyle?: StyleProp<ViewStyle>;
37
+ }
38
+ export interface CallingAvatarProps {
39
+ size?: number;
40
+ }
41
+ export interface CallingContactProps {
42
+ nameStyle?: StyleProp<TextStyle>;
43
+ descriptionStyle?: StyleProp<TextStyle>;
44
+ }
45
+ export interface CallingStatusProps {
46
+ style?: StyleProp<TextStyle>;
47
+ detailStyle?: StyleProp<TextStyle>;
48
+ }
49
+ export interface CallingActionButtonProps extends CallingSectionProps {
50
+ action: CallingAction;
51
+ iconStyle?: StyleProp<ViewStyle>;
52
+ labelStyle?: StyleProp<TextStyle>;
53
+ }
54
+ /** Replace only the sections you need. Define component types outside render. */
55
+ export interface CallingScreenComponents {
56
+ Layout?: ComponentType<CallingLayoutProps>;
57
+ Identity?: ComponentType<CallingSectionProps>;
58
+ Brand?: ComponentType<CallingSectionProps>;
59
+ Avatar?: ComponentType<CallingAvatarProps>;
60
+ Contact?: ComponentType<CallingContactProps>;
61
+ Video?: ComponentType<CallingSectionProps>;
62
+ Status?: ComponentType<CallingStatusProps>;
63
+ Controls?: ComponentType<CallingSectionProps>;
64
+ AudioControls?: ComponentType<CallingSectionProps>;
65
+ IncomingControls?: ComponentType<CallingSectionProps>;
66
+ ActionButton?: ComponentType<CallingActionButtonProps>;
67
+ }
68
+ export interface CallingScreenProps {
69
+ state: CallingState;
70
+ appearance?: CallingAppearance;
71
+ onScreenShare?(): void;
72
+ onCamera?(enabled: boolean): void;
73
+ onSwitchCamera?(): void;
74
+ /** Supplied by NativeCallingOverlay, or your platform's video renderer. */
75
+ renderVideo?(props: {
76
+ stream: MediaStream;
77
+ local: boolean;
78
+ screen?: boolean;
79
+ style: StyleProp<ViewStyle>;
80
+ }): ReactNode;
81
+ onResume?(): void;
82
+ onAnswer(): void;
83
+ onHangUp(): void;
84
+ onMute(value: boolean): void;
85
+ onSpeaker(value: boolean): void;
86
+ onClose(): void;
87
+ theme?: Partial<CallingTheme>;
88
+ labels?: Partial<CallingLabels>;
89
+ formatError?: (code: string) => string;
90
+ insets?: {
91
+ top: number;
92
+ bottom: number;
93
+ };
94
+ components?: CallingScreenComponents;
95
+ }
96
+ export interface CallingUIValue {
97
+ renderVideo?: CallingScreenProps['renderVideo'];
98
+ state: Readonly<CallingState>;
99
+ appearance?: CallingAppearance;
100
+ theme: CallingTheme;
101
+ labels: CallingLabels;
102
+ design: ReturnType<typeof resolveCallingDesign>;
103
+ insets: {
104
+ top: number;
105
+ bottom: number;
106
+ } | null;
107
+ components: CallingScreenComponents;
108
+ title: string;
109
+ status: string;
110
+ error: string | null;
111
+ actions: Readonly<Record<CallingAction, CallingActionModel>>;
112
+ typography(size: number): TextStyle;
113
+ }
114
+ /** Read the same state, labels and guarded actions used by the supplied components. */
115
+ export declare function useCallingUI(): CallingUIValue;
116
+ export interface CallingUIProviderProps extends CallingScreenProps {
117
+ children?: ReactNode;
118
+ }
119
+ /** Presentation only: does not create a client, request microphone access or own audio. */
120
+ export declare function CallingUIProvider({ children, ...props }: CallingUIProviderProps): React.JSX.Element | null;
121
+ /** Scrollable, safe-area-aware frame. Use it when composing your own layout. */
122
+ export declare function CallingLayout({ children, style, contentContainerStyle }: CallingLayoutProps): React.JSX.Element;
123
+ export declare function CallingBrand({ style }?: CallingSectionProps): React.JSX.Element | null;
124
+ export declare function CallingAvatar({ size }?: CallingAvatarProps): React.JSX.Element | null;
125
+ export declare function CallingContact({ nameStyle, descriptionStyle }?: CallingContactProps): React.JSX.Element;
126
+ export declare function CallingStatus({ style, detailStyle }?: CallingStatusProps): React.JSX.Element;
127
+ export declare function CallingIdentity({ style }?: CallingSectionProps): React.JSX.Element;
128
+ /** A state-aware button. Hidden actions render nothing; unavailable actions are disabled. */
129
+ export declare function CallingActionButton({ action, style, iconStyle, labelStyle }: CallingActionButtonProps): React.JSX.Element | null;
130
+ export declare function CallingAudioControls({ style }?: CallingSectionProps): React.JSX.Element | null;
131
+ export declare function CallingIncomingControls({ style }?: CallingSectionProps): React.JSX.Element | null;
132
+ export declare function CallingControls({ style }?: CallingSectionProps): React.JSX.Element;
133
+ /** Video uses the same SDK layout, labels and controls on native and web. */
134
+ export declare function CallingVideo({ style }?: CallingSectionProps): React.JSX.Element | null;
135
+ export {};