livevoice-sdk-react-native 2.0.0 → 3.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.
Files changed (221) hide show
  1. package/README.md +158 -7
  2. package/android/build.gradle +18 -6
  3. package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +121 -221
  4. package/android/src/main/java/io/livevoice/react/__SDK.kt +17 -3
  5. package/ios/LiveVoiceRNBridge.swift +362 -0
  6. package/ios/LiveVoiceSdkReactNative.mm +247 -145
  7. package/ios/__SDK.h +16 -2
  8. package/ios/livevoice_spm_backport.rb +202 -0
  9. package/lib/module/components/BrandingView.js +71 -50
  10. package/lib/module/components/BrandingView.js.map +1 -1
  11. package/lib/module/components/ChannelView.js +368 -54
  12. package/lib/module/components/ChannelView.js.map +1 -1
  13. package/lib/module/components/ErrorView.js +17 -16
  14. package/lib/module/components/ErrorView.js.map +1 -1
  15. package/lib/module/components/LiveVoiceSpinner.js +81 -0
  16. package/lib/module/components/LiveVoiceSpinner.js.map +1 -0
  17. package/lib/module/components/LiveVoiceView.js +351 -104
  18. package/lib/module/components/LiveVoiceView.js.map +1 -1
  19. package/lib/module/components/PasswordPrompt.js +165 -0
  20. package/lib/module/components/PasswordPrompt.js.map +1 -0
  21. package/lib/module/components/PlayButtonView.js +192 -254
  22. package/lib/module/components/PlayButtonView.js.map +1 -1
  23. package/lib/module/components/ReconnectingView.js +43 -62
  24. package/lib/module/components/ReconnectingView.js.map +1 -1
  25. package/lib/module/components/WarningView.js +12 -10
  26. package/lib/module/components/WarningView.js.map +1 -1
  27. package/lib/module/icons/branding-ios.png +0 -0
  28. package/lib/module/icons/camera-off-android.png +0 -0
  29. package/lib/module/icons/camera-off-android@2x.png +0 -0
  30. package/lib/module/icons/camera-off-android@3x.png +0 -0
  31. package/lib/module/icons/cpu-android.png +0 -0
  32. package/lib/module/icons/cpu-android@2x.png +0 -0
  33. package/lib/module/icons/cpu-android@3x.png +0 -0
  34. package/lib/module/icons/cpu-ios.png +0 -0
  35. package/lib/module/icons/cpu-ios@2x.png +0 -0
  36. package/lib/module/icons/cpu-ios@3x.png +0 -0
  37. package/lib/module/icons/lock-android.png +0 -0
  38. package/lib/module/icons/lock-android@2x.png +0 -0
  39. package/lib/module/icons/lock-android@3x.png +0 -0
  40. package/lib/module/icons/lock-ios.png +0 -0
  41. package/lib/module/icons/lock-ios@2x.png +0 -0
  42. package/lib/module/icons/lock-ios@3x.png +0 -0
  43. package/lib/module/icons/mic-off-android.png +0 -0
  44. package/lib/module/icons/mic-off-android@2x.png +0 -0
  45. package/lib/module/icons/mic-off-android@3x.png +0 -0
  46. package/lib/module/icons/mic-slash-ios.png +0 -0
  47. package/lib/module/icons/mic-slash-ios@2x.png +0 -0
  48. package/lib/module/icons/mic-slash-ios@3x.png +0 -0
  49. package/lib/module/icons/video-slash-ios.png +0 -0
  50. package/lib/module/icons/video-slash-ios@2x.png +0 -0
  51. package/lib/module/icons/video-slash-ios@3x.png +0 -0
  52. package/lib/module/index.js +24 -225
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/module/sdk/Bridge.js +236 -0
  55. package/lib/module/sdk/Bridge.js.map +1 -0
  56. package/lib/module/sdk/Event.js +160 -0
  57. package/lib/module/sdk/Event.js.map +1 -0
  58. package/lib/module/sdk/Lifecycle.js +331 -0
  59. package/lib/module/sdk/Lifecycle.js.map +1 -0
  60. package/lib/module/sdk/LiveVoiceSdk.js +365 -0
  61. package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
  62. package/lib/module/sdk/LiveVoiceState.js +234 -0
  63. package/lib/module/sdk/LiveVoiceState.js.map +1 -0
  64. package/lib/module/sdk/LogEntries.js +99 -0
  65. package/lib/module/sdk/LogEntries.js.map +1 -0
  66. package/lib/module/sdk/Models.js +2 -0
  67. package/lib/module/{util/UIState.js.map → sdk/Models.js.map} +1 -1
  68. package/lib/module/sdk/NativeSdkVersions.js +24 -0
  69. package/lib/module/sdk/NativeSdkVersions.js.map +1 -0
  70. package/lib/module/sdk/Observables.js +391 -0
  71. package/lib/module/sdk/Observables.js.map +1 -0
  72. package/lib/module/sdk/Passwords.js +298 -0
  73. package/lib/module/sdk/Passwords.js.map +1 -0
  74. package/lib/module/sdk/Playback.js +35 -0
  75. package/lib/module/sdk/Playback.js.map +1 -0
  76. package/lib/module/specs/NativeLiveVoiceSdk.js +12 -10
  77. package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
  78. package/lib/module/util/Colors.js +14 -11
  79. package/lib/module/util/Colors.js.map +1 -1
  80. package/lib/module/util/Translations.js +46 -21
  81. package/lib/module/util/Translations.js.map +1 -1
  82. package/lib/module/util/freeze.js +26 -0
  83. package/lib/module/util/freeze.js.map +1 -0
  84. package/lib/module/util/logger.js +114 -0
  85. package/lib/module/util/logger.js.map +1 -0
  86. package/lib/typescript/src/components/BrandingView.d.ts +4 -0
  87. package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
  88. package/lib/typescript/src/components/ChannelView.d.ts +29 -3
  89. package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
  90. package/lib/typescript/src/components/ErrorView.d.ts +5 -3
  91. package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
  92. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts +16 -0
  93. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts.map +1 -0
  94. package/lib/typescript/src/components/LiveVoiceView.d.ts +85 -3
  95. package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
  96. package/lib/typescript/src/components/PasswordPrompt.d.ts +13 -0
  97. package/lib/typescript/src/components/PasswordPrompt.d.ts.map +1 -0
  98. package/lib/typescript/src/components/PlayButtonView.d.ts +12 -329
  99. package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
  100. package/lib/typescript/src/components/ReconnectingView.d.ts +6 -3
  101. package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -1
  102. package/lib/typescript/src/components/WarningView.d.ts.map +1 -1
  103. package/lib/typescript/src/index.d.ts +15 -144
  104. package/lib/typescript/src/index.d.ts.map +1 -1
  105. package/lib/typescript/src/sdk/Bridge.d.ts +36 -0
  106. package/lib/typescript/src/sdk/Bridge.d.ts.map +1 -0
  107. package/lib/typescript/src/sdk/Event.d.ts +97 -0
  108. package/lib/typescript/src/sdk/Event.d.ts.map +1 -0
  109. package/lib/typescript/src/sdk/Lifecycle.d.ts +191 -0
  110. package/lib/typescript/src/sdk/Lifecycle.d.ts.map +1 -0
  111. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +215 -0
  112. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
  113. package/lib/typescript/src/sdk/LiveVoiceState.d.ts +80 -0
  114. package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
  115. package/lib/typescript/src/sdk/LogEntries.d.ts +28 -0
  116. package/lib/typescript/src/sdk/LogEntries.d.ts.map +1 -0
  117. package/lib/typescript/src/sdk/Models.d.ts +114 -0
  118. package/lib/typescript/src/sdk/Models.d.ts.map +1 -0
  119. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts +6 -0
  120. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts.map +1 -0
  121. package/lib/typescript/src/sdk/Observables.d.ts +123 -0
  122. package/lib/typescript/src/sdk/Observables.d.ts.map +1 -0
  123. package/lib/typescript/src/sdk/Passwords.d.ts +72 -0
  124. package/lib/typescript/src/sdk/Passwords.d.ts.map +1 -0
  125. package/lib/typescript/src/sdk/Playback.d.ts +9 -0
  126. package/lib/typescript/src/sdk/Playback.d.ts.map +1 -0
  127. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +35 -29
  128. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -1
  129. package/lib/typescript/src/util/Colors.d.ts.map +1 -1
  130. package/lib/typescript/src/util/Translations.d.ts +30 -8
  131. package/lib/typescript/src/util/Translations.d.ts.map +1 -1
  132. package/lib/typescript/src/util/freeze.d.ts +6 -0
  133. package/lib/typescript/src/util/freeze.d.ts.map +1 -0
  134. package/lib/typescript/src/util/logger.d.ts +33 -0
  135. package/lib/typescript/src/util/logger.d.ts.map +1 -0
  136. package/livevoice-sdk-react-native.podspec +41 -16
  137. package/package.json +26 -14
  138. package/src/components/BrandingView.tsx +55 -66
  139. package/src/components/ChannelView.tsx +342 -48
  140. package/src/components/ErrorView.tsx +21 -22
  141. package/src/components/LiveVoiceSpinner.tsx +87 -0
  142. package/src/components/LiveVoiceView.tsx +360 -151
  143. package/src/components/PasswordPrompt.tsx +144 -0
  144. package/src/components/PlayButtonView.tsx +177 -279
  145. package/src/components/ReconnectingView.tsx +40 -86
  146. package/src/components/WarningView.tsx +12 -10
  147. package/src/icons/branding-ios.png +0 -0
  148. package/src/icons/camera-off-android.png +0 -0
  149. package/src/icons/camera-off-android@2x.png +0 -0
  150. package/src/icons/camera-off-android@3x.png +0 -0
  151. package/src/icons/cpu-android.png +0 -0
  152. package/src/icons/cpu-android@2x.png +0 -0
  153. package/src/icons/cpu-android@3x.png +0 -0
  154. package/src/icons/cpu-ios.png +0 -0
  155. package/src/icons/cpu-ios@2x.png +0 -0
  156. package/src/icons/cpu-ios@3x.png +0 -0
  157. package/src/icons/lock-android.png +0 -0
  158. package/src/icons/lock-android@2x.png +0 -0
  159. package/src/icons/lock-android@3x.png +0 -0
  160. package/src/icons/lock-ios.png +0 -0
  161. package/src/icons/lock-ios@2x.png +0 -0
  162. package/src/icons/lock-ios@3x.png +0 -0
  163. package/src/icons/mic-off-android.png +0 -0
  164. package/src/icons/mic-off-android@2x.png +0 -0
  165. package/src/icons/mic-off-android@3x.png +0 -0
  166. package/src/icons/mic-slash-ios.png +0 -0
  167. package/src/icons/mic-slash-ios@2x.png +0 -0
  168. package/src/icons/mic-slash-ios@3x.png +0 -0
  169. package/src/icons/video-slash-ios.png +0 -0
  170. package/src/icons/video-slash-ios@2x.png +0 -0
  171. package/src/icons/video-slash-ios@3x.png +0 -0
  172. package/src/index.tsx +105 -252
  173. package/src/sdk/Bridge.ts +259 -0
  174. package/src/sdk/Event.ts +187 -0
  175. package/src/sdk/Lifecycle.ts +366 -0
  176. package/src/sdk/LiveVoiceSdk.ts +384 -0
  177. package/src/sdk/LiveVoiceState.ts +259 -0
  178. package/src/sdk/LogEntries.ts +88 -0
  179. package/src/sdk/Models.ts +129 -0
  180. package/src/sdk/NativeSdkVersions.ts +21 -0
  181. package/src/sdk/Observables.ts +414 -0
  182. package/src/sdk/Passwords.ts +286 -0
  183. package/src/sdk/Playback.ts +30 -0
  184. package/src/specs/NativeLiveVoiceSdk.ts +56 -46
  185. package/src/util/Colors.ts +14 -11
  186. package/src/util/Translations.ts +46 -22
  187. package/src/util/freeze.ts +23 -0
  188. package/src/util/logger.ts +119 -0
  189. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeLiveVoiceSdkSpec.java +0 -186
  190. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
  191. package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec-generated.cpp +0 -235
  192. package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec.h +0 -31
  193. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -341
  194. package/android/src/main/java/io/livevoice/react/Mappings.kt +0 -85
  195. package/android/src/main/java/io/livevoice/react/NativeModels.kt +0 -79
  196. package/lib/module/components/AudioOutputSwitchView.js +0 -138
  197. package/lib/module/components/AudioOutputSwitchView.js.map +0 -1
  198. package/lib/module/components/index.js +0 -22
  199. package/lib/module/components/index.js.map +0 -1
  200. package/lib/module/icons/mic.png +0 -0
  201. package/lib/module/util/ForegroundServiceConfig.js +0 -28
  202. package/lib/module/util/ForegroundServiceConfig.js.map +0 -1
  203. package/lib/module/util/PlayingState.js +0 -21
  204. package/lib/module/util/PlayingState.js.map +0 -1
  205. package/lib/module/util/UIState.js +0 -4
  206. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts +0 -6
  207. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +0 -1
  208. package/lib/typescript/src/components/index.d.ts +0 -9
  209. package/lib/typescript/src/components/index.d.ts.map +0 -1
  210. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +0 -12
  211. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +0 -1
  212. package/lib/typescript/src/util/PlayingState.d.ts +0 -7
  213. package/lib/typescript/src/util/PlayingState.d.ts.map +0 -1
  214. package/lib/typescript/src/util/UIState.d.ts +0 -66
  215. package/lib/typescript/src/util/UIState.d.ts.map +0 -1
  216. package/src/components/AudioOutputSwitchView.tsx +0 -146
  217. package/src/components/index.tsx +0 -19
  218. package/src/icons/mic.png +0 -0
  219. package/src/util/ForegroundServiceConfig.tsx +0 -32
  220. package/src/util/PlayingState.ts +0 -18
  221. package/src/util/UIState.ts +0 -89
@@ -0,0 +1,298 @@
1
+ "use strict";
2
+
3
+ //===----------------------------------------------------------------------===//
4
+ //
5
+ // This source file is part of the LiveVoice SDK project
6
+ //
7
+ // Copyright (c) LiveVoice GmbH
8
+ // Licensed under the MIT license
9
+ //
10
+ // See LICENSE for license information
11
+ //
12
+ // SPDX-License-Identifier: MIT
13
+ //
14
+ //===----------------------------------------------------------------------===//
15
+
16
+ // The password round trips of the bridge (bridge.md 4.2, 4.3). Native looks up its memory and the
17
+ // host's store first; it asks here only for a password neither had. This module answers from the
18
+ // host's provider when one is set, otherwise from the built-in prompt of the most recently shown
19
+ // LiveVoiceView, otherwise it gives up. It never logs a password or a host exception's text.
20
+
21
+ import Native from "../specs/NativeLiveVoiceSdk.js";
22
+ import { writeLogEntry } from "../util/logger.js";
23
+
24
+ /** What a password is for, keyed by join code, since an event's id is unknown before joining. */
25
+
26
+ /** A password the SDK needs. `isRetry` is `true` after a rejected password in the same operation. */
27
+
28
+ /**
29
+ * Supplies a password, or `null` to give up. Giving up fails the call with `password_required`
30
+ * (for a channel `channel_password_required`), or after a rejected password with `wrong_password`
31
+ * (`channel_wrong_password`). A rejection or a thrown error gives up as well.
32
+ */
33
+
34
+ /**
35
+ * Keeps passwords between launches. The SDK loads one before asking for it, saves it once the
36
+ * server accepted it and removes it once the server rejected it. Calls for one subject complete in
37
+ * the order they were made. A failure is a cache miss; it never fails an operation.
38
+ */
39
+
40
+ /** A request waiting for the built-in prompt. `name` is its title when known. */
41
+
42
+ let provider = null;
43
+ let store = null;
44
+ let bridgeInitialized = false;
45
+
46
+ /** Requests already taken or cancelled: a snapshot delivering one again never reopens it. */
47
+ const seen = new Set();
48
+ const cancelled = new Set();
49
+ /** Requests for the built-in prompt, oldest first; the first one is shown. */
50
+ const queue = [];
51
+
52
+ /** Views that can present the prompt, in the order they were shown; the last one presents. */
53
+ const presenters = [];
54
+ let nextPresenter = 1;
55
+ const promptListeners = new Set();
56
+
57
+ /**
58
+ * Sets the provider every later password request asks, or `null` for the built-in prompt. It can
59
+ * be set before `initialize()`. The built-in prompt needs a `LiveVoiceView` on screen: without a
60
+ * provider and without a view, a request gives up and its call fails with the password error.
61
+ */
62
+ export function setPasswordProvider(newProvider) {
63
+ provider = typeof newProvider === 'function' ? newProvider : null;
64
+ }
65
+
66
+ /**
67
+ * Sets the store the SDK loads passwords from and saves them to, or `null` for none. It can be set
68
+ * before `initialize()`.
69
+ */
70
+ export function setPasswordStore(newStore) {
71
+ store = newStore != null && typeof newStore === 'object' ? newStore : null;
72
+ if (bridgeInitialized) Native.setPasswordStore(JSON.stringify({
73
+ isSet: store !== null
74
+ }));
75
+ }
76
+
77
+ /** Whether a store is set, for `initialize`'s configuration. */
78
+ export function hasPasswordStore() {
79
+ return store !== null;
80
+ }
81
+
82
+ /** `initialize` delivered its configuration; later store changes go to native at once. */
83
+ export function bridgeDidInitialize() {
84
+ bridgeInitialized = true;
85
+ }
86
+
87
+ /** `onPasswordRequest` and the snapshot's waiting requests. Each id is answered once. */
88
+ export function receivePasswordRequest(wire) {
89
+ const request = promptRequest(wire);
90
+ if (request === undefined || seen.has(request.requestId) || cancelled.has(request.requestId)) return;
91
+ seen.add(request.requestId);
92
+ const host = provider;
93
+ if (host !== null) {
94
+ const publicRequest = Object.freeze({
95
+ subject: Object.freeze({
96
+ ...request.subject
97
+ }),
98
+ isRetry: request.isRetry
99
+ });
100
+ let answer;
101
+ try {
102
+ answer = Promise.resolve(host(publicRequest));
103
+ } catch {
104
+ answerPasswordRequest(request.requestId, null, true);
105
+ return;
106
+ }
107
+ answer.then(password => answerPasswordRequest(request.requestId, typeof password === 'string' ? password : null), () => answerPasswordRequest(request.requestId, null, true));
108
+ return;
109
+ }
110
+ if (presenters.length === 0) {
111
+ // No view on screen to ask: give up with the password error.
112
+ logPrompt(request, 'noView');
113
+ answerPasswordRequest(request.requestId, null);
114
+ return;
115
+ }
116
+ queue.push(request);
117
+ notifyPrompt();
118
+ }
119
+
120
+ /** `onPasswordRequestCancelled`: the operation ended without the password. */
121
+ export function receivePasswordRequestCancellation(wire) {
122
+ const requestId = record(wire) && typeof wire.requestId === 'string' ? wire.requestId : undefined;
123
+ if (requestId === undefined) return;
124
+ cancelled.add(requestId);
125
+ const index = queue.findIndex(request => request.requestId === requestId);
126
+ if (index >= 0) {
127
+ const [dismissed] = queue.splice(index, 1);
128
+ logPrompt(dismissed, 'dismissed');
129
+ notifyPrompt();
130
+ }
131
+ }
132
+
133
+ /** `onPasswordStoreRequest`: calls the host's store and answers once its call has finished. */
134
+ export function receivePasswordStoreRequest(wire) {
135
+ if (!record(wire) || typeof wire.requestId !== 'string') return;
136
+ const requestId = wire.requestId;
137
+ const subject = passwordSubject(wire.subject);
138
+ const host = store;
139
+ if (subject === undefined || host === null) {
140
+ answerStoreRequest(requestId, false);
141
+ return;
142
+ }
143
+ const frozenSubject = Object.freeze(subject);
144
+ let call;
145
+ try {
146
+ switch (wire.operation) {
147
+ case 'load':
148
+ call = Promise.resolve(host.load(frozenSubject)).then(password => {
149
+ answerStoreRequest(requestId, true, typeof password === 'string' ? password : null);
150
+ });
151
+ break;
152
+ case 'save':
153
+ if (typeof wire.password !== 'string') {
154
+ answerStoreRequest(requestId, false);
155
+ return;
156
+ }
157
+ call = Promise.resolve(host.save(frozenSubject, wire.password)).then(() => answerStoreRequest(requestId, true));
158
+ break;
159
+ case 'remove':
160
+ call = Promise.resolve(host.remove(frozenSubject)).then(() => answerStoreRequest(requestId, true));
161
+ break;
162
+ default:
163
+ answerStoreRequest(requestId, false);
164
+ return;
165
+ }
166
+ } catch {
167
+ answerStoreRequest(requestId, false);
168
+ return;
169
+ }
170
+ // Native logs a failure without credentials; a failed load is a cache miss.
171
+ call.catch(() => answerStoreRequest(requestId, false));
172
+ }
173
+
174
+ // MARK: The built-in prompt
175
+
176
+ /** A view that can present the prompt. The most recently registered one still mounted presents. */
177
+ export function registerPresenter() {
178
+ const id = nextPresenter++;
179
+ presenters.push(id);
180
+ notifyPrompt();
181
+ return id;
182
+ }
183
+
184
+ /**
185
+ * The view went away. If it was presenting, its request gives up with the password error; with no
186
+ * view left, every waiting request does.
187
+ */
188
+ export function unregisterPresenter(id) {
189
+ const index = presenters.indexOf(id);
190
+ if (index < 0) return;
191
+ const wasPresenting = index === presenters.length - 1;
192
+ presenters.splice(index, 1);
193
+ if (wasPresenting && queue.length > 0) {
194
+ const shown = queue.shift();
195
+ logPrompt(shown, 'dismissed');
196
+ answerPasswordRequest(shown.requestId, null);
197
+ }
198
+ if (presenters.length === 0) {
199
+ for (const request of queue.splice(0)) {
200
+ logPrompt(request, 'noView');
201
+ answerPasswordRequest(request.requestId, null);
202
+ }
203
+ }
204
+ notifyPrompt();
205
+ }
206
+
207
+ /** The request `presenter` shows now, or `null`. */
208
+ export function promptFor(presenter) {
209
+ if (presenters[presenters.length - 1] !== presenter) return null;
210
+ return queue[0] ?? null;
211
+ }
212
+
213
+ /** Calls `listener` whenever the shown prompt or its presenter changes. */
214
+ export function observePrompt(listener) {
215
+ promptListeners.add(listener);
216
+ return () => {
217
+ promptListeners.delete(listener);
218
+ };
219
+ }
220
+
221
+ /** The prompt's answer: a password, or `null` for Cancel. */
222
+ export function answerPrompt(requestId, password) {
223
+ const index = queue.findIndex(request => request.requestId === requestId);
224
+ if (index < 0) return;
225
+ const [answered] = queue.splice(index, 1);
226
+ logPrompt(answered, password === null ? 'cancelled' : 'entered');
227
+ answerPasswordRequest(requestId, password);
228
+ notifyPrompt();
229
+ }
230
+
231
+ /** How the built-in prompt ended (bridge.md 3.6); never with the password. */
232
+ function logPrompt(request, result) {
233
+ writeLogEntry('LV_PASSWORD_PROMPT', 'info', {
234
+ subject: request.subject.kind,
235
+ result,
236
+ isRetry: String(request.isRetry)
237
+ });
238
+ }
239
+ function notifyPrompt() {
240
+ for (const listener of [...promptListeners]) {
241
+ try {
242
+ listener();
243
+ } catch {/* A view's update must not stop the others. */}
244
+ }
245
+ }
246
+
247
+ // MARK: Wire
248
+
249
+ function answerPasswordRequest(requestId, password, failed = false) {
250
+ Native.answerPasswordRequest(JSON.stringify(failed ? {
251
+ requestId,
252
+ password: null,
253
+ failed: true
254
+ } : {
255
+ requestId,
256
+ password
257
+ }));
258
+ }
259
+ function answerStoreRequest(requestId, ok, password) {
260
+ Native.answerPasswordStoreRequest(JSON.stringify(ok && password !== undefined ? {
261
+ requestId,
262
+ ok,
263
+ password
264
+ } : {
265
+ requestId,
266
+ ok
267
+ }));
268
+ }
269
+ function promptRequest(wire) {
270
+ if (!record(wire) || typeof wire.requestId !== 'string') return undefined;
271
+ const subject = passwordSubject(wire.subject);
272
+ if (subject === undefined) return undefined;
273
+ return {
274
+ requestId: wire.requestId,
275
+ subject,
276
+ isRetry: wire.isRetry === true,
277
+ name: typeof wire.name === 'string' && wire.name !== '' ? wire.name : null
278
+ };
279
+ }
280
+ function passwordSubject(wire) {
281
+ if (!record(wire) || typeof wire.joinCode !== 'string') return undefined;
282
+ if (wire.kind === 'event') return {
283
+ kind: 'event',
284
+ joinCode: wire.joinCode
285
+ };
286
+ if (wire.kind === 'channel' && typeof wire.channelId === 'number') {
287
+ return {
288
+ kind: 'channel',
289
+ joinCode: wire.joinCode,
290
+ channelId: wire.channelId
291
+ };
292
+ }
293
+ return undefined;
294
+ }
295
+ function record(value) {
296
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
297
+ }
298
+ //# sourceMappingURL=Passwords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Native","writeLogEntry","provider","store","bridgeInitialized","seen","Set","cancelled","queue","presenters","nextPresenter","promptListeners","setPasswordProvider","newProvider","setPasswordStore","newStore","JSON","stringify","isSet","hasPasswordStore","bridgeDidInitialize","receivePasswordRequest","wire","request","promptRequest","undefined","has","requestId","add","host","publicRequest","Object","freeze","subject","isRetry","answer","Promise","resolve","answerPasswordRequest","then","password","length","logPrompt","push","notifyPrompt","receivePasswordRequestCancellation","record","index","findIndex","dismissed","splice","receivePasswordStoreRequest","passwordSubject","answerStoreRequest","frozenSubject","call","operation","load","save","remove","catch","registerPresenter","id","unregisterPresenter","indexOf","wasPresenting","shown","shift","promptFor","presenter","observePrompt","listener","delete","answerPrompt","answered","result","kind","String","failed","ok","answerPasswordStoreRequest","name","joinCode","channelId","value","Array","isArray"],"sourceRoot":"../../../src","sources":["sdk/Passwords.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,gCAA6B;AAChD,SAASC,aAAa,QAAQ,mBAAgB;;AAE9C;;AAKA;;AAMA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAOA;;AAQA,IAAIC,QAA0C,GAAG,IAAI;AACrD,IAAIC,KAAoC,GAAG,IAAI;AAC/C,IAAIC,iBAAiB,GAAG,KAAK;;AAE7B;AACA,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;AAC9B,MAAMC,SAAS,GAAG,IAAID,GAAG,CAAS,CAAC;AACnC;AACA,MAAME,KAAsB,GAAG,EAAE;;AAEjC;AACA,MAAMC,UAAoB,GAAG,E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AS,EAAEL,IAAI,CAACK,SAAS;IACzBM,OAAO;IACPC,OAAO,EAAEZ,IAAI,CAACY,OAAO,KAAK,IAAI;IAC9B+C,IAAI,EAAE,OAAO3D,IAAI,CAAC2D,IAAI,KAAK,QAAQ,IAAI3D,IAAI,CAAC2D,IAAI,KAAK,EAAE,GAAG3D,IAAI,CAAC2D,IAAI,GAAG;EACxE,CAAC;AACH;AAEA,SAAS7B,eAAeA,CAAC9B,IAAa,EAAwC;EAC5E,IAAI,CAACwB,MAAM,CAACxB,IAAI,CAAC,IAAI,OAAOA,IAAI,CAAC4D,QAAQ,KAAK,QAAQ,EAAE,OAAOzD,SAAS;EACxE,IAAIH,IAAI,CAACsD,IAAI,KAAK,OAAO,EAAE,OAAO;IAAEA,IAAI,EAAE,OAAO;IAAEM,QAAQ,EAAE5D,IAAI,CAAC4D;EAAS,CAAC;EAC5E,IAAI5D,IAAI,CAACsD,IAAI,KAAK,SAAS,IAAI,OAAOtD,IAAI,CAAC6D,SAAS,KAAK,QAAQ,EAAE;IACjE,OAAO;MAAEP,IAAI,EAAE,SAAS;MAAEM,QAAQ,EAAE5D,IAAI,CAAC4D,QAAQ;MAAEC,SAAS,EAAE7D,IAAI,CAAC6D;IAAU,CAAC;EAChF;EACA,OAAO1D,SAAS;AAClB;AAEA,SAASqB,MAAMA,CAACsC,KAAc,EAAoC;EAChE,OAAOA,KAAK,KAAK,IAAI,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAC7E","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ //===----------------------------------------------------------------------===//
4
+ //
5
+ // This source file is part of the LiveVoice SDK project
6
+ //
7
+ // Copyright (c) LiveVoice GmbH
8
+ // Licensed under the MIT license
9
+ //
10
+ // See LICENSE for license information
11
+ //
12
+ // SPDX-License-Identifier: MIT
13
+ //
14
+ //===----------------------------------------------------------------------===//
15
+
16
+ // Internal: the action of a channel cell, the wrapper's only playback start. It is not exported
17
+ // from the package entry point; only `LiveVoiceView` calls it, for its default cells and for the
18
+ // `LiveVoiceChannelCell` objects it hands to `renderChannelCell`.
19
+
20
+ import { channelId as validateChannelId, invoke } from "./Lifecycle.js";
21
+
22
+ /** Which kind of cell acts: native checks the custom-UI permission again for `custom`. */
23
+
24
+ /**
25
+ * Starts the channel if it is stopped, stops it if it is playing, as native decides from the
26
+ * current playback state at admission (bridge.md 3.3). Resolves once the channel plays or has
27
+ * stopped; rejects with the native error otherwise.
28
+ */
29
+ export async function togglePlayback(channelId, cell) {
30
+ await invoke('togglePlayback', {
31
+ channelId: validateChannelId(channelId, 'togglePlayback'),
32
+ cell
33
+ });
34
+ }
35
+ //# sourceMappingURL=Playback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["channelId","validateChannelId","invoke","togglePlayback","cell"],"sourceRoot":"../../../src","sources":["sdk/Playback.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAASA,SAAS,IAAIC,iBAAiB,EAAEC,MAAM,QAAQ,gBAAa;;AAEpE;;AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,cAAcA,CAACH,SAAiB,EAAEI,IAAc,EAAiB;EACrF,MAAMF,MAAM,CAAC,gBAAgB,EAAE;IAAEF,SAAS,EAAEC,iBAAiB,CAACD,SAAS,EAAE,gBAAgB,CAAC;IAAEI;EAAK,CAAC,CAAC;AACrG","ignoreList":[]}
@@ -1,15 +1,17 @@
1
1
  "use strict";
2
2
 
3
- /*
4
- * This source file is part of the LiveVoice SDK project
5
- *
6
- * Copyright (c) LiveVoice GmbH
7
- * Licensed under the MIT license
8
- *
9
- * See LICENSE for license information
10
- *
11
- * SPDX-License-Identifier: MIT
12
- */
3
+ //===----------------------------------------------------------------------===//
4
+ //
5
+ // This source file is part of the LiveVoice SDK project
6
+ //
7
+ // Copyright (c) LiveVoice GmbH
8
+ // Licensed under the MIT license
9
+ //
10
+ // See LICENSE for license information
11
+ //
12
+ // SPDX-License-Identifier: MIT
13
+ //
14
+ //===----------------------------------------------------------------------===//
13
15
 
14
16
  import { TurboModuleRegistry } from 'react-native';
15
17
 
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["specs/NativeLiveVoiceSdk.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAA6C,cAAc;;AAEvF;AACA;;AAgEA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,iBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["specs/NativeLiveVoiceSdk.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAA6C,cAAc;;AAEvF;AACA;;AAwEA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,iBAAiB,CAAC","ignoreList":[]}
@@ -1,22 +1,25 @@
1
1
  "use strict";
2
2
 
3
- /*
4
- * This source file is part of the LiveVoice SDK project
5
- *
6
- * Copyright (c) LiveVoice GmbH
7
- * Licensed under the MIT license
8
- *
9
- * See LICENSE for license information
10
- *
11
- * SPDX-License-Identifier: MIT
12
- */
3
+ //===----------------------------------------------------------------------===//
4
+ //
5
+ // This source file is part of the LiveVoice SDK project
6
+ //
7
+ // Copyright (c) LiveVoice GmbH
8
+ // Licensed under the MIT license
9
+ //
10
+ // See LICENSE for license information
11
+ //
12
+ // SPDX-License-Identifier: MIT
13
+ //
14
+ //===----------------------------------------------------------------------===//
13
15
 
14
16
  export const COLORS = {
15
17
  primary: '#F1521B',
16
18
  bg: '#F5F5F5',
17
19
  bgDark: '#1E1F23',
18
20
  cardBg: '#fff',
19
- cardBgDark: '#212429',
21
+ // Both native SDK views' dark background (Android `veryDarkGray`).
22
+ cardBgDark: '#212529',
20
23
  divider: '#f0f0f0',
21
24
  dividerDark: '#333333',
22
25
  white: '#fff',
@@ -1 +1 @@
1
- {"version":3,"names":["COLORS","primary","bg","bgDark","cardBg","cardBgDark","divider","dividerDark","white","black","gray"],"sourceRoot":"../../../src","sources":["util/Colors.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,MAAM,GAAG;EACpBC,OAAO,EAAE,SAAS;EAElBC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EAEjBC,MAAM,EAAE,MAAM;EACdC,UAAU,EAAE,SAAS;EAErBC,OAAO,EAAE,SAAS;EAClBC,WAAW,EAAE,SAAS;EAEtBC,KAAK,EAAE,MAAM;EACbC,KAAK,EAAE,SAAS;EAChBC,IAAI,EAAE,SAAS;EAEf,UAAU,EAAE;AACd,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["COLORS","primary","bg","bgDark","cardBg","cardBgDark","divider","dividerDark","white","black","gray"],"sourceRoot":"../../../src","sources":["util/Colors.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,MAAM,GAAG;EACpBC,OAAO,EAAE,SAAS;EAElBC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EAEjBC,MAAM,EAAE,MAAM;EACd;EACAC,UAAU,EAAE,SAAS;EAErBC,OAAO,EAAE,SAAS;EAClBC,WAAW,EAAE,SAAS;EAEtBC,KAAK,EAAE,MAAM;EACbC,KAAK,EAAE,SAAS;EAChBC,IAAI,EAAE,SAAS;EAEf,UAAU,EAAE;AACd,CAAC","ignoreList":[]}
@@ -1,41 +1,66 @@
1
1
  "use strict";
2
2
 
3
- /*
4
- * This source file is part of the LiveVoice SDK project
5
- *
6
- * Copyright (c) LiveVoice GmbH
7
- * Licensed under the MIT license
8
- *
9
- * See LICENSE for license information
10
- *
11
- * SPDX-License-Identifier: MIT
12
- */
3
+ //===----------------------------------------------------------------------===//
4
+ //
5
+ // This source file is part of the LiveVoice SDK project
6
+ //
7
+ // Copyright (c) LiveVoice GmbH
8
+ // Licensed under the MIT license
9
+ //
10
+ // See LICENSE for license information
11
+ //
12
+ // SPDX-License-Identifier: MIT
13
+ //
14
+ //===----------------------------------------------------------------------===//
13
15
 
14
16
  /**
15
- * @fileoverview Translated strings for the React Native SDK.
16
- * These methods will return a translated string for the current locale.
17
- * German, English, and Spanish are supported at this time.
17
+ * @fileoverview The native SDK's texts: the public `Translations` of the default view, and the
18
+ * built-in password prompt's own texts, which stay internal.
18
19
  */
19
20
  import LiveVoiceSdkReactNative from "../specs/NativeLiveVoiceSdk.js";
21
+
22
+ /**
23
+ * Localized strings the SDK uses for its default UI, in the device's language (English, German and
24
+ * Spanish).
25
+ *
26
+ * Reuse them in your own parts, such as a custom channel cell, so your UI matches the SDK's
27
+ * wording. Each call reads the text synchronously from the native SDK and needs no join. Error
28
+ * texts are not here: every error carries its own `message`.
29
+ */
20
30
  export const Translations = {
31
+ /** "Inactive": a channel without a speaker. */
21
32
  channelStatusOffline: () => LiveVoiceSdkReactNative.channelStatusOffline(),
33
+ /** "This event currently has no channels visible for listeners." */
22
34
  noChannels: () => LiveVoiceSdkReactNative.noChannels(),
35
+ /** "AI active": a channel whose speaker is an AI voice. */
23
36
  isAiChannelStatusMessage: () => LiveVoiceSdkReactNative.isAiChannelStatusMessage(),
37
+ /** "No matching channels": a channel filter that leaves none. */
24
38
  sdkNoMatchingChannels: () => LiveVoiceSdkReactNative.sdkNoMatchingChannels(),
39
+ /** "Attempting to reconnect…" */
25
40
  errorScreenRetrying: () => LiveVoiceSdkReactNative.errorScreenRetrying(),
41
+ /** "Reconnecting in `seconds` seconds…" */
26
42
  errorScreenRetryingIn: seconds => LiveVoiceSdkReactNative.errorScreenRetryingIn(seconds),
27
- sdkErrorGeneric: () => LiveVoiceSdkReactNative.sdkErrorGeneric(),
28
- sdkErrorInactive: () => LiveVoiceSdkReactNative.sdkErrorInactive(),
29
- sdkErrorInvalidApiKey: () => LiveVoiceSdkReactNative.sdkErrorInvalidApiKey(),
30
- sdkErrorListenerLimitReached: () => LiveVoiceSdkReactNative.sdkErrorListenerLimitReached(),
31
- sdkErrorNoNetwork: () => LiveVoiceSdkReactNative.sdkErrorNoNetwork(),
32
- sdkErrorNotFound: () => LiveVoiceSdkReactNative.sdkErrorNotFound(),
33
- sdkErrorRequestFailed: errorCode => LiveVoiceSdkReactNative.sdkErrorRequestFailed(errorCode),
34
- sdkErrorWrongPassword: () => LiveVoiceSdkReactNative.sdkErrorWrongPassword(),
43
+ /** "Retry now" */
35
44
  errorRetryNowButton: () => LiveVoiceSdkReactNative.errorRetryNowButton(),
45
+ /** "Live Audio Streaming by", before the LiveVoice logo. */
36
46
  streamingByTitle: () => LiveVoiceSdkReactNative.streamingByTitle(),
47
+ /** "Play channel", the accessibility label of a channel's play button. */
37
48
  accessibilityChannelPlay: () => LiveVoiceSdkReactNative.accessibilityChannelPlay(),
49
+ /** "Muted by speaker" */
38
50
  accessibilityChannelStatusMuted: () => LiveVoiceSdkReactNative.accessibilityChannelStatusMuted(),
51
+ /** "Stop channel", the accessibility label of a channel's stop button. */
39
52
  accessibilityChannelStop: () => LiveVoiceSdkReactNative.accessibilityChannelStop()
40
53
  };
54
+
55
+ /** Internal: the built-in password prompt's texts. Its title is the channel's or event's name when known. */
56
+ export const PasswordPromptTexts = {
57
+ title: () => LiveVoiceSdkReactNative.passwordPromptTitle(),
58
+ channelMessage: () => LiveVoiceSdkReactNative.passwordPromptChannelMessage(),
59
+ eventMessage: () => LiveVoiceSdkReactNative.passwordPromptEventMessage(),
60
+ wrongPassword: () => LiveVoiceSdkReactNative.passwordPromptWrongPassword(),
61
+ field: () => LiveVoiceSdkReactNative.passwordPromptField(),
62
+ cancelButton: () => LiveVoiceSdkReactNative.passwordPromptCancelButton(),
63
+ channelConfirmButton: () => LiveVoiceSdkReactNative.passwordPromptChannelConfirmButton(),
64
+ eventConfirmButton: () => LiveVoiceSdkReactNative.passwordPromptEventConfirmButton()
65
+ };
41
66
  //# sourceMappingURL=Translations.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["LiveVoiceSdkReactNative","Translations","channelStatusOffline","noChannels","isAiChannelStatusMessage","sdkNoMatchingChannels","errorScreenRetrying","errorScreenRetryingIn","seconds","sdkErrorGeneric","sdkErrorInactive","sdkErrorInvalidApiKey","sdkErrorListenerLimitReached","sdkErrorNoNetwork","sdkErrorNotFound","sdkErrorRequestFailed","errorCode","sdkErrorWrongPassword","errorRetryNowButton","streamingByTitle","accessibilityChannelPlay","accessibilityChannelStatusMuted","accessibilityChannelStop"],"sourceRoot":"../../../src","sources":["util/Translations.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAOA,uBAAuB,MAAM,gCAA6B;AAEjE,OAAO,MAAMC,YAAY,GAAG;EAC1BC,oBAAoB,EAAEA,CAAA,KAAcF,uBAAuB,CAACE,oBAAoB,CAAC,CAAC;EAClFC,UAAU,EAAEA,CAAA,KAAcH,uBAAuB,CAACG,UAAU,CAAC,CAAC;EAC9DC,wBAAwB,EAAEA,CAAA,KAAcJ,uBAAuB,CAACI,wBAAwB,CAAC,CAAC;EAC1FC,qBAAqB,EAAEA,CAAA,KAAcL,uBAAuB,CAACK,qBAAqB,CAAC,CAAC;EACpFC,mBAAmB,EAAEA,CAAA,KAAcN,uBAAuB,CAACM,mBAAmB,CAAC,CAAC;EAChFC,qBAAqB,EAAGC,OAAe,IAAaR,uBAAuB,CAACO,qBAAqB,CAACC,OAAO,CAAC;EAC1GC,eAAe,EAAEA,CAAA,KAAcT,uBAAuB,CAACS,eAAe,CAAC,CAAC;EACxEC,gBAAgB,EAAEA,CAAA,KAAcV,uBAAuB,CAACU,gBAAgB,CAAC,CAAC;EAC1EC,qBAAqB,EAAEA,CAAA,KAAcX,uBAAuB,CAACW,qBAAqB,CAAC,CAAC;EACpFC,4BAA4B,EAAEA,CAAA,KAAcZ,uBAAuB,CAACY,4BAA4B,CAAC,CAAC;EAClGC,iBAAiB,EAAEA,CAAA,KAAcb,uBAAuB,CAACa,iBAAiB,CAAC,CAAC;EAC5EC,gBAAgB,EAAEA,CAAA,KAAcd,uBAAuB,CAACc,gBAAgB,CAAC,CAAC;EAC1EC,qBAAqB,EAAGC,SAAiB,IAAahB,uBAAuB,CAACe,qBAAqB,CAACC,SAAS,CAAC;EAC9GC,qBAAqB,EAAEA,CAAA,KAAcjB,uBAAuB,CAACiB,qBAAqB,CAAC,CAAC;EACpFC,mBAAmB,EAAEA,CAAA,KAAclB,uBAAuB,CAACkB,mBAAmB,CAAC,CAAC;EAChFC,gBAAgB,EAAEA,CAAA,KAAcnB,uBAAuB,CAACmB,gBAAgB,CAAC,CAAC;EAC1EC,wBAAwB,EAAEA,CAAA,KAAcpB,uBAAuB,CAACoB,wBAAwB,CAAC,CAAC;EAC1FC,+BAA+B,EAAEA,CAAA,KAAcrB,uBAAuB,CAACqB,+BAA+B,CAAC,CAAC;EACxGC,wBAAwB,EAAEA,CAAA,KAActB,uBAAuB,CAACsB,wBAAwB,CAAC;AAC3F,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["LiveVoiceSdkReactNative","Translations","channelStatusOffline","noChannels","isAiChannelStatusMessage","sdkNoMatchingChannels","errorScreenRetrying","errorScreenRetryingIn","seconds","errorRetryNowButton","streamingByTitle","accessibilityChannelPlay","accessibilityChannelStatusMuted","accessibilityChannelStop","PasswordPromptTexts","title","passwordPromptTitle","channelMessage","passwordPromptChannelMessage","eventMessage","passwordPromptEventMessage","wrongPassword","passwordPromptWrongPassword","field","passwordPromptField","cancelButton","passwordPromptCancelButton","channelConfirmButton","passwordPromptChannelConfirmButton","eventConfirmButton","passwordPromptEventConfirmButton"],"sourceRoot":"../../../src","sources":["util/Translations.ts"],"mapp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AAY,EAAEA,CAAA,KAAcnB,uBAAuB,CAACoB,0BAA0B,CAAC,CAAC;EAChFC,aAAa,EAAEA,CAAA,KAAcrB,uBAAuB,CAACsB,2BAA2B,CAAC,CAAC;EAClFC,KAAK,EAAEA,CAAA,KAAcvB,uBAAuB,CAACwB,mBAAmB,CAAC,CAAC;EAClEC,YAAY,EAAEA,CAAA,KAAczB,uBAAuB,CAAC0B,0BAA0B,CAAC,CAAC;EAChFC,oBAAoB,EAAEA,CAAA,KAAc3B,uBAAuB,CAAC4B,kCAAkC,CAAC,CAAC;EAChGC,kBAAkB,EAAEA,CAAA,KAAc7B,uBAAuB,CAAC8B,gCAAgC,CAAC;AAC7F,CAAC","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ //===----------------------------------------------------------------------===//
4
+ //
5
+ // This source file is part of the LiveVoice SDK project
6
+ //
7
+ // Copyright (c) LiveVoice GmbH
8
+ // Licensed under the MIT license
9
+ //
10
+ // See LICENSE for license information
11
+ //
12
+ // SPDX-License-Identifier: MIT
13
+ //
14
+ //===----------------------------------------------------------------------===//
15
+
16
+ /**
17
+ * Freezes `value` and every plain object and array inside it, so a host cannot change what the
18
+ * SDK handed out. `Date`s and errors are left as they are.
19
+ */
20
+ export function deepFreeze(value) {
21
+ if (value === null || typeof value !== 'object' || Object.isFrozen(value)) return value;
22
+ if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype) return value;
23
+ for (const nested of Object.values(value)) deepFreeze(nested);
24
+ return Object.freeze(value);
25
+ }
26
+ //# sourceMappingURL=freeze.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["deepFreeze","value","Object","isFrozen","Array","isArray","getPrototypeOf","prototype","nested","values","freeze"],"sourceRoot":"../../../src","sources":["util/freeze.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASA,UAAUA,CAAIC,KAAQ,EAAK;EACzC,IAAIA,KAAK,KAAK,IAAI,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIC,MAAM,CAACC,QAAQ,CAACF,KAAK,CAAC,EAAE,OAAOA,KAAK;EACvF,IAAI,CAACG,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,IAAIC,MAAM,CAACI,cAAc,CAACL,KAAK,CAAC,KAAKC,MAAM,CAACK,SAAS,EAAE,OAAON,KAAK;EAC5F,KAAK,MAAMO,MAAM,IAAIN,MAAM,CAACO,MAAM,CAACR,KAAe,CAAC,EAAED,UAAU,CAACQ,MAAM,CAAC;EACvE,OAAON,MAAM,CAACQ,MAAM,CAACT,KAAK,CAAC;AAC7B","ignoreList":[]}