@upscopeio/react-native-sdk 2026.4.1 → 2026.4.2

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 (40) hide show
  1. package/README.md +135 -3
  2. package/android/build.gradle.kts +1 -1
  3. package/android/src/main/kotlin/io/upscope/reactnative/UpscopeModule.kt +193 -31
  4. package/ios/UpscopeModule.mm +3 -0
  5. package/ios/UpscopeModule.swift +195 -43
  6. package/lib/commonjs/NativeUpscopeModule.js.map +1 -1
  7. package/lib/commonjs/Upscope.js +55 -18
  8. package/lib/commonjs/Upscope.js.map +1 -1
  9. package/lib/commonjs/hooks.js +45 -2
  10. package/lib/commonjs/hooks.js.map +1 -1
  11. package/lib/commonjs/index.js +12 -0
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/version.js +1 -1
  14. package/lib/module/NativeUpscopeModule.js.map +1 -1
  15. package/lib/module/Upscope.js +57 -19
  16. package/lib/module/Upscope.js.map +1 -1
  17. package/lib/module/hooks.js +43 -2
  18. package/lib/module/hooks.js.map +1 -1
  19. package/lib/module/index.js +4 -4
  20. package/lib/module/index.js.map +1 -1
  21. package/lib/module/version.js +1 -1
  22. package/lib/typescript/NativeUpscopeModule.d.ts +3 -0
  23. package/lib/typescript/NativeUpscopeModule.d.ts.map +1 -1
  24. package/lib/typescript/Upscope.d.ts +20 -2
  25. package/lib/typescript/Upscope.d.ts.map +1 -1
  26. package/lib/typescript/hooks.d.ts +20 -3
  27. package/lib/typescript/hooks.d.ts.map +1 -1
  28. package/lib/typescript/index.d.ts +7 -7
  29. package/lib/typescript/index.d.ts.map +1 -1
  30. package/lib/typescript/types.d.ts +64 -17
  31. package/lib/typescript/types.d.ts.map +1 -1
  32. package/lib/typescript/version.d.ts +1 -1
  33. package/package.json +1 -1
  34. package/src/NativeUpscopeModule.ts +5 -0
  35. package/src/Upscope.ts +63 -20
  36. package/src/hooks.ts +56 -3
  37. package/src/index.ts +19 -10
  38. package/src/types.ts +78 -30
  39. package/src/version.ts +1 -1
  40. package/upscopeio-react-native-sdk.podspec +1 -1
@@ -7,6 +7,17 @@ class UpscopeModule: RCTEventEmitter, UpscopeDelegate {
7
7
 
8
8
  private var hasListeners = false
9
9
 
10
+ /// The emitter instance that currently has JS listeners attached. The bridge
11
+ /// can construct more than one `UpscopeModule`; delegate callbacks and
12
+ /// publisher subscriptions are routed through this stable reference so events
13
+ /// always reach the live emitter the JS side is actually subscribed to.
14
+ /// Fixes Bug #2 (session state stuck "inactive" with multiple instances).
15
+ private static weak var current: UpscopeModule?
16
+
17
+ /// Pending full-device requests awaiting a JS response, keyed by request id.
18
+ /// Access is confined to the main actor (where the handler fires).
19
+ private static var pendingFullDeviceRequests: [String: SessionRequestResponse] = [:]
20
+
10
21
  override init() {
11
22
  super.init()
12
23
  }
@@ -18,20 +29,27 @@ class UpscopeModule: RCTEventEmitter, UpscopeDelegate {
18
29
  override func supportedEvents() -> [String] {
19
30
  return [
20
31
  "connectionStateChanged",
32
+ "sessionStateChanged",
21
33
  "sessionStarted",
22
34
  "sessionEnded",
23
35
  "customMessageReceived",
24
36
  "error",
25
- "observerJoined",
26
- "observerLeft",
27
- "observerCountChanged",
37
+ "viewerJoined",
38
+ "viewerLeft",
39
+ "viewerCountChanged",
28
40
  "shortIdChanged",
29
41
  "lookupCodeChanged",
42
+ "remoteControlStateChanged",
43
+ "fullDeviceSharingStateChanged",
44
+ "fullDeviceRequest",
30
45
  ]
31
46
  }
32
47
 
33
48
  override func startObserving() {
34
49
  hasListeners = true
50
+ // Become the live emitter so delegate callbacks reach this instance.
51
+ UpscopeModule.current = self
52
+
35
53
  Task { @MainActor in
36
54
  for await shortId in Upscope.shared.shortIdPublisher.values {
37
55
  guard self.hasListeners else { break }
@@ -44,10 +62,43 @@ class UpscopeModule: RCTEventEmitter, UpscopeDelegate {
44
62
  self.sendEvent(withName: "lookupCodeChanged", body: ["lookupCode": code as Any])
45
63
  }
46
64
  }
65
+ // Drive connection/session state from current-value publishers so a fresh
66
+ // subscription immediately receives the real state (core fix for Bug #2).
67
+ Task { @MainActor in
68
+ for await state in Upscope.shared.connectionStatePublisher.values {
69
+ guard self.hasListeners else { break }
70
+ var body: [String: Any] = ["state": self.serializeConnectionState(state)]
71
+ if case let .error(error) = state {
72
+ body["error"] = self.serializeError(error)
73
+ }
74
+ self.sendEvent(withName: "connectionStateChanged", body: body)
75
+ }
76
+ }
77
+ Task { @MainActor in
78
+ for await state in Upscope.shared.sessionStatePublisher.values {
79
+ guard self.hasListeners else { break }
80
+ self.sendEvent(withName: "sessionStateChanged", body: ["state": self.serializeSessionState(state)])
81
+ }
82
+ }
83
+ Task { @MainActor in
84
+ for await state in Upscope.shared.remoteControlStatePublisher.values {
85
+ guard self.hasListeners else { break }
86
+ self.sendEvent(withName: "remoteControlStateChanged", body: ["state": self.serializeRemoteControlState(state)])
87
+ }
88
+ }
89
+ Task { @MainActor in
90
+ for await state in Upscope.shared.fullDeviceSharingStatePublisher.values {
91
+ guard self.hasListeners else { break }
92
+ self.sendEvent(withName: "fullDeviceSharingStateChanged", body: ["state": self.serializeFullDeviceSharingState(state)])
93
+ }
94
+ }
47
95
  }
48
96
 
49
97
  override func stopObserving() {
50
98
  hasListeners = false
99
+ if UpscopeModule.current === self {
100
+ UpscopeModule.current = nil
101
+ }
51
102
  }
52
103
 
53
104
  // MARK: - Initialization
@@ -55,7 +106,7 @@ class UpscopeModule: RCTEventEmitter, UpscopeDelegate {
55
106
  @objc func initialize(_ config: NSDictionary) {
56
107
  guard let apiKey = config["apiKey"] as? String else { return }
57
108
 
58
- let upscopeConfig = UpscopeConfiguration(
109
+ var upscopeConfig = UpscopeConfiguration(
59
110
  apiKey: apiKey,
60
111
  requireAuthorizationForSession: config["requireAuthorizationForSession"] as? Bool,
61
112
  autoconnect: config["autoConnect"] as? Bool,
@@ -64,7 +115,7 @@ class UpscopeModule: RCTEventEmitter, UpscopeDelegate {
64
115
  authorizationPromptTitle: config["authorizationPromptTitle"] as? String,
65
116
  authorizationPromptMessage: config["authorizationPromptMessage"] as? String,
66
117
  endOfSessionMessage: config["endOfSessionMessage"] as? String,
67
- stopSessionText: config["stopSessionText"] as? String,
118
+ stopSessionText: parseLocalizedString(config["stopSessionText"]),
68
119
  allowRemoteClick: config["allowRemoteClick"] as? Bool,
69
120
  allowRemoteScroll: config["allowRemoteScroll"] as? Bool,
70
121
  requireControlRequest: config["requireControlRequest"] as? Bool,
@@ -73,13 +124,37 @@ class UpscopeModule: RCTEventEmitter, UpscopeDelegate {
73
124
  enableLookupCodeOnShake: config["enableLookupCodeOnShake"] as? Bool,
74
125
  lookupCodeKeyTitle: config["lookupCodeKeyTitle"] as? String,
75
126
  lookupCodeKeyMessage: config["lookupCodeKeyMessage"] as? String,
76
- translationsYes: config["translationsYes"] as? String,
77
- translationsNo: config["translationsNo"] as? String,
78
- translationsOk: config["translationsOk"] as? String,
127
+ translationsYes: parseLocalizedString(config["translationsYes"]),
128
+ translationsNo: parseLocalizedString(config["translationsNo"]),
129
+ translationsOk: parseLocalizedString(config["translationsOk"]),
79
130
  wrapper: "react-native",
80
- wrapperVersion: config["wrapperVersion"] as? String
131
+ wrapperVersion: config["wrapperVersion"] as? String,
132
+ broadcastAppGroupId: config["broadcastAppGroupId"] as? String,
133
+ broadcastExtensionBundleId: config["broadcastExtensionBundleId"] as? String
81
134
  )
82
135
 
136
+ // Base domain for SDK endpoints (staging/on-prem). `baseDomain` is a
137
+ // mutable property on the native config, so set it after construction.
138
+ if let baseDomain = config["baseDomain"] as? String {
139
+ upscopeConfig.baseDomain = baseDomain
140
+ }
141
+ if let disableFullScreenWhenMasked = config["disableFullScreenWhenMasked"] as? Bool {
142
+ upscopeConfig.disableFullScreenWhenMasked = disableFullScreenWhenMasked
143
+ }
144
+
145
+ // Bridge the native full-device request hook to the JS event layer.
146
+ // Stores the response keyed by a generated id, emits `fullDeviceRequest`,
147
+ // and returns a Cancellable that clears the stored entry. The JS side
148
+ // answers via respondToFullDeviceRequest(requestId, accept).
149
+ upscopeConfig.onFullDeviceRequest = { response in
150
+ let requestId = UUID().uuidString
151
+ UpscopeModule.pendingFullDeviceRequests[requestId] = response
152
+ UpscopeModule.current?.sendEvent(withName: "fullDeviceRequest", body: ["requestId": requestId])
153
+ return FullDeviceRequestCancellable {
154
+ UpscopeModule.pendingFullDeviceRequests.removeValue(forKey: requestId)
155
+ }
156
+ }
157
+
83
158
  Task { @MainActor in
84
159
  try Upscope.shared.initialize(with: upscopeConfig)
85
160
  Upscope.shared.delegate = self
@@ -127,6 +202,29 @@ class UpscopeModule: RCTEventEmitter, UpscopeDelegate {
127
202
  Task { @MainActor in Upscope.shared.cancelAgentRequest() }
128
203
  }
129
204
 
205
+ // MARK: - Remote control / full-device sharing
206
+
207
+ @objc func stopRemoteControl() {
208
+ Task { @MainActor in Upscope.shared.stopRemoteControl() }
209
+ }
210
+
211
+ @objc func stopFullDeviceSharing() {
212
+ Task { @MainActor in Upscope.shared.stopFullDeviceSharing() }
213
+ }
214
+
215
+ @objc func respondToFullDeviceRequest(_ requestId: String, accept: Bool) {
216
+ Task { @MainActor in
217
+ guard let response = UpscopeModule.pendingFullDeviceRequests.removeValue(forKey: requestId) else {
218
+ return
219
+ }
220
+ if accept {
221
+ response.accept()
222
+ } else {
223
+ response.reject()
224
+ }
225
+ }
226
+ }
227
+
130
228
  // MARK: - Lookup
131
229
 
132
230
  @objc func getLookupCode() {
@@ -154,68 +252,94 @@ class UpscopeModule: RCTEventEmitter, UpscopeDelegate {
154
252
  }
155
253
 
156
254
  // MARK: - UpscopeDelegate
255
+ //
256
+ // Delegate callbacks are routed through `UpscopeModule.current` (the live
257
+ // emitter) rather than `self`, because the bridge may have constructed a
258
+ // different instance than the one JS is subscribed to (Bug #2).
259
+ // `emit` no-ops when no emitter is active.
260
+
261
+ /// Forwards an event to the currently active emitter, if any.
262
+ @MainActor
263
+ private static func emit(_ name: String, body: Any?) {
264
+ guard let current = current, current.hasListeners else { return }
265
+ current.sendEvent(withName: name, body: body)
266
+ }
157
267
 
158
268
  @MainActor
159
269
  func upscope(_ upscope: Upscope, didChangeConnectionState state: ConnectionState) {
160
- guard hasListeners else { return }
270
+ // Connection state is primarily driven by connectionStatePublisher in
271
+ // startObserving; this delegate path is kept as a redundant fast path.
161
272
  var body: [String: Any] = ["state": serializeConnectionState(state)]
162
273
  if case let .error(error) = state {
163
274
  body["error"] = serializeError(error)
164
275
  }
165
- sendEvent(withName: "connectionStateChanged", body: body)
276
+ UpscopeModule.emit("connectionStateChanged", body: body)
166
277
  }
167
278
 
168
279
  @MainActor
169
280
  func upscopeSessionDidStart(_ upscope: Upscope, agentName: String?) {
170
- guard hasListeners else { return }
171
- sendEvent(withName: "sessionStarted", body: ["agentName": agentName as Any])
281
+ UpscopeModule.emit("sessionStarted", body: ["agentName": agentName as Any])
172
282
  }
173
283
 
174
284
  @MainActor
175
285
  func upscopeSessionDidEnd(_ upscope: Upscope, reason: SessionEndReason) {
176
- guard hasListeners else { return }
177
- var body: [String: Any] = ["reason": serializeEndReason(reason)]
178
- if case let .error(error) = reason {
179
- body["error"] = serializeError(error)
180
- }
181
- sendEvent(withName: "sessionEnded", body: body)
286
+ UpscopeModule.emit("sessionEnded", body: ["reason": serializeEndReason(reason)])
287
+ }
288
+
289
+ @MainActor
290
+ func upscope(_ upscope: Upscope, didChangeRemoteControlState state: RemoteControlState) {
291
+ UpscopeModule.emit("remoteControlStateChanged", body: ["state": serializeRemoteControlState(state)])
182
292
  }
183
293
 
184
294
  @MainActor
185
- func upscope(_ upscope: Upscope, didReceiveCustomMessage message: String, from observerId: String) {
186
- guard hasListeners else { return }
187
- sendEvent(withName: "customMessageReceived", body: [
295
+ func upscope(_ upscope: Upscope, didChangeFullDeviceSharingState state: FullDeviceSharingState) {
296
+ UpscopeModule.emit("fullDeviceSharingStateChanged", body: ["state": serializeFullDeviceSharingState(state)])
297
+ }
298
+
299
+ @MainActor
300
+ func upscope(_ upscope: Upscope, didReceiveCustomMessage message: String, from viewerId: String) {
301
+ UpscopeModule.emit("customMessageReceived", body: [
188
302
  "message": message,
189
- "observerId": observerId,
303
+ "viewerId": viewerId,
190
304
  ])
191
305
  }
192
306
 
193
307
  @MainActor
194
308
  func upscope(_ upscope: Upscope, didEncounterError error: UpscopeError) {
195
- guard hasListeners else { return }
196
- sendEvent(withName: "error", body: serializeError(error))
309
+ UpscopeModule.emit("error", body: serializeError(error))
197
310
  }
198
311
 
199
312
  @MainActor
200
- func upscope(_ upscope: Upscope, observerDidJoin observer: Observer) {
201
- guard hasListeners else { return }
202
- sendEvent(withName: "observerJoined", body: serializeObserver(observer))
313
+ func upscope(_ upscope: Upscope, viewerDidJoin viewer: Viewer) {
314
+ UpscopeModule.emit("viewerJoined", body: serializeViewer(viewer))
203
315
  }
204
316
 
205
317
  @MainActor
206
- func upscope(_ upscope: Upscope, observerDidLeave observerId: String) {
207
- guard hasListeners else { return }
208
- sendEvent(withName: "observerLeft", body: ["observerId": observerId])
318
+ func upscope(_ upscope: Upscope, viewerDidLeave viewerId: String) {
319
+ UpscopeModule.emit("viewerLeft", body: ["viewerId": viewerId])
209
320
  }
210
321
 
211
322
  @MainActor
212
- func upscope(_ upscope: Upscope, observerCountDidChange count: Int) {
213
- guard hasListeners else { return }
214
- sendEvent(withName: "observerCountChanged", body: ["count": count])
323
+ func upscope(_ upscope: Upscope, viewerCountDidChange count: Int) {
324
+ UpscopeModule.emit("viewerCountChanged", body: ["count": count])
215
325
  }
216
326
 
217
327
  // MARK: - Serialization
218
328
 
329
+ /// Converts a JS-bridged value (either a String or a [String: String] map) into a
330
+ /// `LocalizedString`. Returns nil when the key is absent or holds an unsupported type
331
+ /// so the native SDK falls back to its server-provided default.
332
+ private func parseLocalizedString(_ value: Any?) -> LocalizedString? {
333
+ if let string = value as? String {
334
+ return .string(string)
335
+ }
336
+ if let dict = value as? [String: String] {
337
+ let entries = dict.map { LocalizedString.Entry(language: $0.key, value: $0.value) }
338
+ return .localized(entries)
339
+ }
340
+ return nil
341
+ }
342
+
219
343
  private func serializeConnectionState(_ state: ConnectionState) -> String {
220
344
  switch state {
221
345
  case .inactive: return "inactive"
@@ -226,12 +350,23 @@ class UpscopeModule: RCTEventEmitter, UpscopeDelegate {
226
350
  }
227
351
  }
228
352
 
353
+ private func serializeSessionState(_ state: SessionState) -> String {
354
+ return state.rawValue
355
+ }
356
+
357
+ private func serializeRemoteControlState(_ state: RemoteControlState) -> String {
358
+ return state.rawValue
359
+ }
360
+
361
+ private func serializeFullDeviceSharingState(_ state: FullDeviceSharingState) -> String {
362
+ return state.rawValue
363
+ }
364
+
229
365
  private func serializeEndReason(_ reason: SessionEndReason) -> String {
230
366
  switch reason {
231
367
  case .userStopped: return "userStopped"
232
368
  case .agentStopped: return "agentStopped"
233
369
  case .timeout: return "timeout"
234
- case .error: return "error"
235
370
  }
236
371
  }
237
372
 
@@ -239,15 +374,32 @@ class UpscopeModule: RCTEventEmitter, UpscopeDelegate {
239
374
  return ["code": error.code, "message": error.message]
240
375
  }
241
376
 
242
- private func serializeObserver(_ observer: Observer) -> [String: Any] {
377
+ private func serializeViewer(_ viewer: Viewer) -> [String: Any] {
243
378
  return [
244
- "id": observer.id,
245
- "name": observer.name as Any,
246
- "screenWidth": observer.screenWidth,
247
- "screenHeight": observer.screenHeight,
248
- "windowWidth": observer.windowWidth,
249
- "windowHeight": observer.windowHeight,
250
- "hasFocus": observer.hasFocus,
379
+ "id": viewer.id,
380
+ "name": viewer.name as Any,
381
+ "screenWidth": viewer.screenWidth,
382
+ "screenHeight": viewer.screenHeight,
383
+ "screenScale": viewer.screenScale,
384
+ "windowWidth": viewer.windowWidth,
385
+ "windowHeight": viewer.windowHeight,
386
+ "hasFocus": viewer.hasFocus,
251
387
  ]
252
388
  }
253
389
  }
390
+
391
+ /// Cancellable handed back from `onFullDeviceRequest`. When the SDK cancels the
392
+ /// request externally (e.g. session ended before the visitor responded), it runs
393
+ /// the closure that drops the stored `SessionRequestResponse` so a later JS
394
+ /// response to a stale id is safely ignored.
395
+ private final class FullDeviceRequestCancellable: Cancellable {
396
+ private let onCancel: () -> Void
397
+
398
+ init(onCancel: @escaping () -> Void) {
399
+ self.onCancel = onCancel
400
+ }
401
+
402
+ func cancel() {
403
+ onCancel()
404
+ }
405
+ }
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeUpscopeModule.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GA8BpCC,gCAAmB,CAACC,YAAY,CAAO,eAAe,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeUpscopeModule.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAmCpCC,gCAAmB,CAACC,YAAY,CAAO,eAAe,CAAC","ignoreList":[]}
@@ -5,16 +5,29 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _reactNative = require("react-native");
8
- var _NativeUpscopeModule = _interopRequireDefault(require("./NativeUpscopeModule"));
9
8
  var _version = require("./version");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
9
  /**
12
10
  * Subscription handle returned by addListener. Callers must invoke remove()
13
11
  * to avoid memory leaks when the component/scope unmounts.
14
12
  */
15
13
 
16
- // Module-level emitter — one instance for the lifetime of the JS runtime.
17
- const emitter = new _reactNative.NativeEventEmitter(_NativeUpscopeModule.default);
14
+ /**
15
+ * Resolve the native TurboModule lazily on first use. Resolving at import time
16
+ * runs during the initial JS bundle evaluation — before the bridgeless runtime
17
+ * has finished registering third-party TurboModules — which makes
18
+ * `getEnforcing` throw "UpscopeModule could not be found". Deferring until a
19
+ * method is actually called avoids that startup ordering issue.
20
+ */
21
+ let nativeModule;
22
+ function native() {
23
+ return nativeModule ??= _reactNative.TurboModuleRegistry.getEnforcing('UpscopeModule');
24
+ }
25
+
26
+ // Lazily-created emitter — one instance for the lifetime of the JS runtime.
27
+ let eventEmitter;
28
+ function emitter() {
29
+ return eventEmitter ??= new _reactNative.NativeEventEmitter(native());
30
+ }
18
31
 
19
32
  /**
20
33
  * Imperative JS API over the native Upscope TurboModule.
@@ -25,44 +38,68 @@ const emitter = new _reactNative.NativeEventEmitter(_NativeUpscopeModule.default
25
38
  const Upscope = {
26
39
  /** Initialise the SDK. Must be called before any other method. */
27
40
  initialize(config) {
28
- _NativeUpscopeModule.default.initialize({
41
+ native().initialize({
29
42
  ...config,
30
43
  wrapperVersion: _version.SDK_VERSION
31
44
  });
32
45
  },
33
46
  /** Open a WebSocket connection to the Upscope service. */
34
47
  connect() {
35
- _NativeUpscopeModule.default.connect();
48
+ native().connect();
36
49
  },
37
50
  /** Close the WebSocket connection. */
38
51
  disconnect() {
39
- _NativeUpscopeModule.default.disconnect();
52
+ native().disconnect();
40
53
  },
41
54
  /**
42
55
  * Reset the connection state.
43
56
  * @param reconnect - Whether to reconnect immediately after reset. Defaults to true.
44
57
  */
45
58
  reset(reconnect = true) {
46
- _NativeUpscopeModule.default.reset(reconnect);
59
+ native().reset(reconnect);
47
60
  },
48
61
  /**
49
62
  * Update user identity and metadata sent to the Upscope service.
50
63
  * Safe to call at any time; changes are pushed on the next sync.
51
64
  */
52
65
  updateConnection(params) {
53
- _NativeUpscopeModule.default.updateConnection(params);
66
+ native().updateConnection(params);
54
67
  },
55
68
  /** Terminate the active co-browsing session. */
56
69
  stopSession() {
57
- _NativeUpscopeModule.default.stopSession();
70
+ native().stopSession();
58
71
  },
59
72
  /** Request that an agent join the current session. */
60
73
  requestAgent() {
61
- _NativeUpscopeModule.default.requestAgent();
74
+ native().requestAgent();
62
75
  },
63
76
  /** Cancel a pending agent-join request. */
64
77
  cancelAgentRequest() {
65
- _NativeUpscopeModule.default.cancelAgentRequest();
78
+ native().cancelAgentRequest();
79
+ },
80
+ /**
81
+ * Revoke the agent's active remote control while keeping the session alive.
82
+ * No-op if remote control is not currently active.
83
+ */
84
+ stopRemoteControl() {
85
+ native().stopRemoteControl();
86
+ },
87
+ /**
88
+ * End full-device (broadcast) sharing and revert to in-app sharing, keeping
89
+ * the session alive. No-op if full-device sharing is not currently active.
90
+ */
91
+ stopFullDeviceSharing() {
92
+ native().stopFullDeviceSharing();
93
+ },
94
+ /**
95
+ * Answer a pending full-device sharing request delivered via the
96
+ * `fullDeviceRequest` event.
97
+ *
98
+ * @param requestId - The id from the `fullDeviceRequest` event payload.
99
+ * @param accept - `true` to allow full-device capture, `false` to reject.
100
+ */
101
+ respondToFullDeviceRequest(requestId, accept) {
102
+ native().respondToFullDeviceRequest(requestId, accept);
66
103
  },
67
104
  /**
68
105
  * Ask the native layer to emit the current lookup code via the
@@ -70,19 +107,19 @@ const Upscope = {
70
107
  * asynchronously through the event system.
71
108
  */
72
109
  getLookupCode() {
73
- _NativeUpscopeModule.default.getLookupCode();
110
+ native().getLookupCode();
74
111
  },
75
112
  /** Resolve the current short ID, or null if not yet assigned. */
76
113
  getShortId() {
77
- return _NativeUpscopeModule.default.getShortId();
114
+ return native().getShortId();
78
115
  },
79
116
  /** Resolve the watch link for the current session, or null if unavailable. */
80
117
  getWatchLink() {
81
- return _NativeUpscopeModule.default.getWatchLink();
118
+ return native().getWatchLink();
82
119
  },
83
- /** Send an arbitrary string message to all connected observers. */
120
+ /** Send an arbitrary string message to all connected viewers. */
84
121
  sendCustomMessage(message) {
85
- _NativeUpscopeModule.default.sendCustomMessage(message);
122
+ native().sendCustomMessage(message);
86
123
  },
87
124
  /**
88
125
  * Subscribe to a typed Upscope event.
@@ -92,7 +129,7 @@ const Upscope = {
92
129
  * @returns A subscription handle. Call `.remove()` to unsubscribe.
93
130
  */
94
131
  addListener(eventName, callback) {
95
- return emitter.addListener(eventName, callback);
132
+ return emitter().addListener(eventName, callback);
96
133
  }
97
134
  };
98
135
  var _default = exports.default = Upscope;
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_NativeUpscopeModule","_interopRequireDefault","_version","e","__esModule","default","emitter","NativeEventEmitter","NativeUpscopeModule","Upscope","initialize","config","wrapperVersion","SDK_VERSION","connect","disconnect","reset","reconnect","updateConnection","params","stopSession","requestAgent","cancelAgentRequest","getLookupCode","getShortId","getWatchLink","sendCustomMessage","message","addListener","eventName","callback","_default","exports"],"sourceRoot":"../../src","sources":["Upscope.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAAwC,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQxC;AACA;AACA;AACA;;AAKA;AACA,MAAMG,OAAO,GAAG,IAAIC,+BAAkB,CAACC,4BAAmB,CAAC;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,OAAO,GAAG;EACd;EACAC,UAAUA,CAACC,MAAqB,EAAQ;IACtCH,4BAAmB,CAACE,UAAU,CAAC;MAC7B,GAAGC,MAAM;MACTC,cAAc,EAAEC;IAClB,CAAsB,CAAC;EACzB,CAAC;EAED;EACAC,OAAOA,CAAA,EAAS;IACdN,4BAAmB,CAACM,OAAO,CAAC,CAAC;EAC/B,CAAC;EAED;EACAC,UAAUA,CAAA,EAAS;IACjBP,4BAAmB,CAACO,UAAU,CAAC,CAAC;EAClC,CAAC;EAED;AACF;AACA;AACA;EACEC,KAAKA,CAACC,SAAkB,GAAG,IAAI,EAAQ;IACrCT,4BAAmB,CAACQ,KAAK,CAACC,SAAS,CAAC;EACtC,CAAC;EAED;AACF;AACA;AACA;EACEC,gBAAgBA,CAACC,MAA8B,EAAQ;IACrDX,4BAAmB,CAACU,gBAAgB,CAACC,MAA2B,CAAC;EACnE,CAAC;EAED;EACAC,WAAWA,CAAA,EAAS;IAClBZ,4BAAmB,CAACY,WAAW,CAAC,CAAC;EACnC,CAAC;EAED;EACAC,YAAYA,CAAA,EAAS;IACnBb,4BAAmB,CAACa,YAAY,CAAC,CAAC;EACpC,CAAC;EAED;EACAC,kBAAkBA,CAAA,EAAS;IACzBd,4BAAmB,CAACc,kBAAkB,CAAC,CAAC;EAC1C,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,aAAaA,CAAA,EAAS;IACpBf,4BAAmB,CAACe,aAAa,CAAC,CAAC;EACrC,CAAC;EAED;EACAC,UAAUA,CAAA,EAA2B;IACnC,OAAOhB,4BAAmB,CAACgB,UAAU,CAAC,CAAC;EACzC,CAAC;EAED;EACAC,YAAYA,CAAA,EAA2B;IACrC,OAAOjB,4BAAmB,CAACiB,YAAY,CAAC,CAAC;EAC3C,CAAC;EAED;EACAC,iBAAiBA,CAACC,OAAe,EAAQ;IACvCnB,4BAAmB,CAACkB,iBAAiB,CAACC,OAAO,CAAC;EAChD,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CACTC,SAAY,EACZC,QAA6C,EAC1B;IACnB,OAAOxB,OAAO,CAACsB,WAAW,CAACC,SAAS,EAAEC,QAAQ,CAAC;EACjD;AACF,CAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3B,OAAA,GAEII,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_version","nativeModule","native","TurboModuleRegistry","getEnforcing","eventEmitter","emitter","NativeEventEmitter","Upscope","initialize","config","wrapperVersion","SDK_VERSION","connect","disconnect","reset","reconnect","updateConnection","params","stopSession","requestAgent","cancelAgentRequest","stopRemoteControl","stopFullDeviceSharing","respondToFullDeviceRequest","requestId","accept","getLookupCode","getShortId","getWatchLink","sendCustomMessage","message","addListener","eventName","callback","_default","exports","default"],"sourceRoot":"../../src","sources":["Upscope.ts"],"mappings":";;;;;;AAAA,IAAA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AA,EAAS;IACzBnB,MAAM,CAAC,CAAC,CAACmB,kBAAkB,CAAC,CAAC;EAC/B,CAAC;EAED;AACF;AACA;AACA;EACEC,iBAAiBA,CAAA,EAAS;IACxBpB,MAAM,CAAC,CAAC,CAACoB,iBAAiB,CAAC,CAAC;EAC9B,CAAC;EAED;AACF;AACA;AACA;EACEC,qBAAqBA,CAAA,EAAS;IAC5BrB,MAAM,CAAC,CAAC,CAACqB,qBAAqB,CAAC,CAAC;EAClC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,0BAA0BA,CAACC,SAAiB,EAAEC,MAAe,EAAQ;IACnExB,MAAM,CAAC,CAAC,CAACsB,0BAA0B,CAACC,SAAS,EAAEC,MAAM,CAAC;EACxD,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,aAAaA,CAAA,EAAS;IACpBzB,MAAM,CAAC,CAAC,CAACyB,aAAa,CAAC,CAAC;EAC1B,CAAC;EAED;EACAC,UAAUA,CAAA,EAA2B;IACnC,OAAO1B,MAAM,CAAC,CAAC,CAAC0B,UAAU,CAAC,CAAC;EAC9B,CAAC;EAED;EACAC,YAAYA,CAAA,EAA2B;IACrC,OAAO3B,MAAM,CAAC,CAAC,CAAC2B,YAAY,CAAC,CAAC;EAChC,CAAC;EAED;EACAC,iBAAiBA,CAACC,OAAe,EAAQ;IACvC7B,MAAM,CAAC,CAAC,CAAC4B,iBAAiB,CAACC,OAAO,CAAC;EACrC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CACTC,SAAY,EACZC,QAA6C,EAC1B;IACnB,OAAO5B,OAAO,CAAC,CAAC,CAAC0B,WAAW,CAACC,SAAS,EAAEC,QAAQ,CAAC;EACnD;AACF,CAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEI7B,OAAO","ignoreList":[]}
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useConnectionState = useConnectionState;
7
+ exports.useFullDeviceSharingState = useFullDeviceSharingState;
7
8
  exports.useLookupCode = useLookupCode;
9
+ exports.useRemoteControlState = useRemoteControlState;
8
10
  exports.useSessionState = useSessionState;
9
11
  exports.useShortId = useShortId;
10
12
  exports.useUpscope = useUpscope;
@@ -27,12 +29,19 @@ function useConnectionState() {
27
29
  }
28
30
 
29
31
  /**
30
- * Returns the current co-browsing session state. Transitions to "active" on
31
- * `sessionStarted` and back to "inactive" on `sessionEnded`.
32
+ * Returns the current co-browsing session state.
33
+ *
34
+ * Seeds and stays in sync via the `sessionStateChanged` event, which the
35
+ * native layer drives from a current-value publisher — so a fresh subscription
36
+ * immediately receives the real state, even across remounts. The
37
+ * `sessionStarted`/`sessionEnded` events provide redundant fast-path updates.
32
38
  */
33
39
  function useSessionState() {
34
40
  const [state, setState] = (0, _react.useState)("inactive");
35
41
  (0, _react.useEffect)(() => {
42
+ const subState = _Upscope.default.addListener("sessionStateChanged", event => {
43
+ setState(event.state);
44
+ });
36
45
  const subStart = _Upscope.default.addListener("sessionStarted", () => {
37
46
  setState("active");
38
47
  });
@@ -40,6 +49,7 @@ function useSessionState() {
40
49
  setState("inactive");
41
50
  });
42
51
  return () => {
52
+ subState.remove();
43
53
  subStart.remove();
44
54
  subEnd.remove();
45
55
  };
@@ -79,6 +89,36 @@ function useLookupCode() {
79
89
  return code;
80
90
  }
81
91
 
92
+ /**
93
+ * Returns whether an agent currently has remote control of the device.
94
+ * Defaults to "inactive" and stays in sync via `remoteControlStateChanged`.
95
+ */
96
+ function useRemoteControlState() {
97
+ const [state, setState] = (0, _react.useState)("inactive");
98
+ (0, _react.useEffect)(() => {
99
+ const sub = _Upscope.default.addListener("remoteControlStateChanged", event => {
100
+ setState(event.state);
101
+ });
102
+ return () => sub.remove();
103
+ }, []);
104
+ return state;
105
+ }
106
+
107
+ /**
108
+ * Returns whether full-device (broadcast) screen sharing is currently running.
109
+ * Defaults to "inactive" and stays in sync via `fullDeviceSharingStateChanged`.
110
+ */
111
+ function useFullDeviceSharingState() {
112
+ const [state, setState] = (0, _react.useState)("inactive");
113
+ (0, _react.useEffect)(() => {
114
+ const sub = _Upscope.default.addListener("fullDeviceSharingStateChanged", event => {
115
+ setState(event.state);
116
+ });
117
+ return () => sub.remove();
118
+ }, []);
119
+ return state;
120
+ }
121
+
82
122
  /**
83
123
  * Returns a stable object of imperative Upscope action methods.
84
124
  * Safe to use as a dependency in `useCallback` / `useEffect`.
@@ -90,6 +130,9 @@ function useUpscope() {
90
130
  stopSession: _Upscope.default.stopSession,
91
131
  requestAgent: _Upscope.default.requestAgent,
92
132
  cancelAgentRequest: _Upscope.default.cancelAgentRequest,
133
+ stopRemoteControl: _Upscope.default.stopRemoteControl,
134
+ stopFullDeviceSharing: _Upscope.default.stopFullDeviceSharing,
135
+ respondToFullDeviceRequest: _Upscope.default.respondToFullDeviceRequest,
93
136
  sendCustomMessage: _Upscope.default.sendCustomMessage,
94
137
  getLookupCode: _Upscope.default.getLookupCode,
95
138
  reset: _Upscope.default.reset
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_Upscope","_interopRequireDefault","e","__esModule","default","useConnectionState","state","setState","useState","useEffect","sub","Upscope","addListener","event","remove","useSessionState","subStart","subEnd","useShortId","shortId","setShortId","getShortId","then","useLookupCode","code","setCode","lookupCode","useUpscope","useMemo","connect","disconnect","stopSession","requestAgent","cancelAgentRequest","sendCustomMessage","getLookupCode","reset"],"sourceRoot":"../../src","sources":["hooks.ts"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAgC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGhC;AACA;AACA;AACA;AACO,SAASG,kBAAkBA,CAAA,EAAoB;EACpD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,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,CAACM,OAAO,CAAC;IAC3B,CAAC,CAAC;IACF,OAAO,MAAMT,GAAG,CAACI,MAAM,CAAC,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOK,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACO,SAASI,aAAaA,CAAA,EAAkB;EAC7C,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAG,IAAAjB,eAAQ,EAAgB,IAAI,CAAC;EAErD,IAAAC,gBAAS,EAAC,MAAM;IACd,MAAMC,GAAG,GAAGC,gBAAO,CAACC,WAAW,CAAC,mBAAmB,EAAGC,KAAK,IAAK;MAC9DY,OAAO,CAACZ,KAAK,CAACa,UAAU,CAAC;IAC3B,CAAC,CAAC;IACF,OAAO,MAAMhB,GAAG,CAACI,MAAM,CAAC,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOU,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAAA,EAAG;EAC3B,OAAO,IAAAC,cAAO,EACZ,OAAO;IACLC,OAAO,EAAElB,gBAAO,CAACkB,OAAO;IACxBC,UAAU,EAAEnB,gBAAO,CAACmB,UAAU;IAC9BC,WAAW,EAAEpB,gBAAO,CAACoB,WAAW;IAChCC,YAAY,EAAErB,gBAAO,CAACqB,YAAY;IAClCC,kBAAkB,EAAEtB,gBAAO,CAACsB,kBAAkB;IAC9CC,iBAAiB,EAAEvB,gBAAO,CAACuB,iBAAiB;IAC5CC,aAAa,EAAExB,gBAAO,CAACwB,aAAa;IACpCC,KAAK,EAAEzB,gBAAO,CAACyB;EACjB,CAAC,CAAC,EACF,EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_Upscope","_interopRequireDefault","e","__esModule","default","useConnectionState","state","setState","useState","useEffect","sub","Upscope","addListener","event","remove","useSessionState","subState","subStart","subEnd","useShortId","shortId","setShortId","getShortId","then","useLookupCode","code","setCode","lookupCode","useRemoteControlState","useFullDeviceSharingState","useUpscope","useMemo","connect","disconnect","stopSession","requestAgent","cancelAgentRequest","stopRemoteControl","stopFullDeviceSharing","respondToFullDeviceRequest","sendCustomMessage","getLookupCode","reset"],"sourceRoot":"../../src","sources":["hooks.ts"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAgC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQhC;AACA;AACA;AACA;AACO,SAASG,kBAAkBA,CAAA,EAAoB;EACpD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAkB,UAAU,CAAC;EAE/D,IAAAC,gBAAS,EAAC,MAAM;IACd,MAAMC,GAAG,GAAGC,gBAAO,CAACC,WAAW,CAAC,wBAAwB,EAAGC,KAAK,IAAK;MACnEN,QAAQ,CAACM,KAAK,CAACP,KAAK,CAAC;IACvB,CAAC,CAAC;IACF,OAAO,MAAMI,GAAG,CAACI,MAAM,CAAC,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOR,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASS,eAAeA,CAAA,EAAiB;EAC9C,MAAM,CAACT,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAe,UAAU,CAAC;EAE5D,IAAAC,gBAAS,EAAC,MAAM;IACd,MAAMO,QAAQ,GAAGL,gBAAO,CAACC,WAAW,CAAC,qBAAqB,EAAGC,KAAK,IAAK;MACrEN,QAAQ,CAACM,KAAK,CAACP,KAAK,CAAC;IACvB,CAAC,CAAC;IACF,MAAMW,QAAQ,GAAGN,gBAAO,CAACC,WAAW,CAAC,gBAAgB,EAAE,MAAM;MAC3DL,QAAQ,CAAC,QAAQ,CAAC;IACpB,CAAC,CAAC;IACF,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