@upscopeio/react-native-sdk 2026.3.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 (64) hide show
  1. package/README.md +291 -0
  2. package/android/build.gradle.kts +36 -0
  3. package/android/src/main/AndroidManifest.xml +2 -0
  4. package/android/src/main/kotlin/io/upscope/reactnative/UpscopeMaskedViewManager.kt +31 -0
  5. package/android/src/main/kotlin/io/upscope/reactnative/UpscopeModule.kt +297 -0
  6. package/android/src/main/kotlin/io/upscope/reactnative/UpscopePackage.kt +31 -0
  7. package/ios/UpscopeMaskedView.swift +18 -0
  8. package/ios/UpscopeMaskedViewManager.mm +4 -0
  9. package/ios/UpscopeMaskedViewManager.swift +13 -0
  10. package/ios/UpscopeModule.mm +31 -0
  11. package/ios/UpscopeModule.swift +243 -0
  12. package/lib/commonjs/NativeUpscopeMaskedView.js +10 -0
  13. package/lib/commonjs/NativeUpscopeMaskedView.js.map +1 -0
  14. package/lib/commonjs/NativeUpscopeModule.js +9 -0
  15. package/lib/commonjs/NativeUpscopeModule.js.map +1 -0
  16. package/lib/commonjs/Upscope.js +95 -0
  17. package/lib/commonjs/Upscope.js.map +1 -0
  18. package/lib/commonjs/UpscopeMasked.js +22 -0
  19. package/lib/commonjs/UpscopeMasked.js.map +1 -0
  20. package/lib/commonjs/hooks.js +98 -0
  21. package/lib/commonjs/hooks.js.map +1 -0
  22. package/lib/commonjs/index.js +58 -0
  23. package/lib/commonjs/index.js.map +1 -0
  24. package/lib/commonjs/package.json +1 -0
  25. package/lib/commonjs/types.js +2 -0
  26. package/lib/commonjs/types.js.map +1 -0
  27. package/lib/module/NativeUpscopeMaskedView.js +5 -0
  28. package/lib/module/NativeUpscopeMaskedView.js.map +1 -0
  29. package/lib/module/NativeUpscopeModule.js +5 -0
  30. package/lib/module/NativeUpscopeModule.js.map +1 -0
  31. package/lib/module/Upscope.js +91 -0
  32. package/lib/module/Upscope.js.map +1 -0
  33. package/lib/module/UpscopeMasked.js +17 -0
  34. package/lib/module/UpscopeMasked.js.map +1 -0
  35. package/lib/module/hooks.js +89 -0
  36. package/lib/module/hooks.js.map +1 -0
  37. package/lib/module/index.js +7 -0
  38. package/lib/module/index.js.map +1 -0
  39. package/lib/module/package.json +1 -0
  40. package/lib/module/types.js +2 -0
  41. package/lib/module/types.js.map +1 -0
  42. package/lib/typescript/NativeUpscopeMaskedView.d.ts +7 -0
  43. package/lib/typescript/NativeUpscopeMaskedView.d.ts.map +1 -0
  44. package/lib/typescript/NativeUpscopeModule.d.ts +20 -0
  45. package/lib/typescript/NativeUpscopeModule.d.ts.map +1 -0
  46. package/lib/typescript/Upscope.d.ts +60 -0
  47. package/lib/typescript/Upscope.d.ts.map +1 -0
  48. package/lib/typescript/UpscopeMasked.d.ts +7 -0
  49. package/lib/typescript/UpscopeMasked.d.ts.map +1 -0
  50. package/lib/typescript/hooks.d.ts +36 -0
  51. package/lib/typescript/hooks.d.ts.map +1 -0
  52. package/lib/typescript/index.d.ts +8 -0
  53. package/lib/typescript/index.d.ts.map +1 -0
  54. package/lib/typescript/types.d.ts +79 -0
  55. package/lib/typescript/types.d.ts.map +1 -0
  56. package/package.json +94 -0
  57. package/src/NativeUpscopeMaskedView.ts +9 -0
  58. package/src/NativeUpscopeModule.ts +32 -0
  59. package/src/Upscope.ts +113 -0
  60. package/src/UpscopeMasked.tsx +19 -0
  61. package/src/hooks.ts +99 -0
  62. package/src/index.ts +34 -0
  63. package/src/types.ts +109 -0
  64. package/upscopeio-react-native-sdk.podspec +17 -0
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ import { NativeEventEmitter } from "react-native";
4
+ import NativeUpscopeModule from "./NativeUpscopeModule";
5
+
6
+ /**
7
+ * Subscription handle returned by addListener. Callers must invoke remove()
8
+ * to avoid memory leaks when the component/scope unmounts.
9
+ */
10
+
11
+ // Module-level emitter — one instance for the lifetime of the JS runtime.
12
+ const emitter = new NativeEventEmitter(NativeUpscopeModule);
13
+
14
+ /**
15
+ * Imperative JS API over the native Upscope TurboModule.
16
+ *
17
+ * All methods are thin typed wrappers; no business logic lives here.
18
+ * Prefer using the React hooks in this package inside components.
19
+ */
20
+ const Upscope = {
21
+ /** Initialise the SDK. Must be called before any other method. */
22
+ initialize(config) {
23
+ NativeUpscopeModule.initialize(config);
24
+ },
25
+ /** Open a WebSocket connection to the Upscope service. */
26
+ connect() {
27
+ NativeUpscopeModule.connect();
28
+ },
29
+ /** Close the WebSocket connection. */
30
+ disconnect() {
31
+ NativeUpscopeModule.disconnect();
32
+ },
33
+ /**
34
+ * Reset the connection state.
35
+ * @param reconnect - Whether to reconnect immediately after reset. Defaults to true.
36
+ */
37
+ reset(reconnect = true) {
38
+ NativeUpscopeModule.reset(reconnect);
39
+ },
40
+ /**
41
+ * Update user identity and metadata sent to the Upscope service.
42
+ * Safe to call at any time; changes are pushed on the next sync.
43
+ */
44
+ updateConnection(params) {
45
+ NativeUpscopeModule.updateConnection(params);
46
+ },
47
+ /** Terminate the active co-browsing session. */
48
+ stopSession() {
49
+ NativeUpscopeModule.stopSession();
50
+ },
51
+ /** Request that an agent join the current session. */
52
+ requestAgent() {
53
+ NativeUpscopeModule.requestAgent();
54
+ },
55
+ /** Cancel a pending agent-join request. */
56
+ cancelAgentRequest() {
57
+ NativeUpscopeModule.cancelAgentRequest();
58
+ },
59
+ /**
60
+ * Ask the native layer to emit the current lookup code via the
61
+ * `lookupCodeChanged` event. The lookup code itself is delivered
62
+ * asynchronously through the event system.
63
+ */
64
+ getLookupCode() {
65
+ NativeUpscopeModule.getLookupCode();
66
+ },
67
+ /** Resolve the current short ID, or null if not yet assigned. */
68
+ getShortId() {
69
+ return NativeUpscopeModule.getShortId();
70
+ },
71
+ /** Resolve the watch link for the current session, or null if unavailable. */
72
+ getWatchLink() {
73
+ return NativeUpscopeModule.getWatchLink();
74
+ },
75
+ /** Send an arbitrary string message to all connected observers. */
76
+ sendCustomMessage(message) {
77
+ NativeUpscopeModule.sendCustomMessage(message);
78
+ },
79
+ /**
80
+ * Subscribe to a typed Upscope event.
81
+ *
82
+ * @param eventName - One of the well-known event names from UpscopeEventMap.
83
+ * @param callback - Invoked with the strongly-typed payload on each event.
84
+ * @returns A subscription handle. Call `.remove()` to unsubscribe.
85
+ */
86
+ addListener(eventName, callback) {
87
+ return emitter.addListener(eventName, callback);
88
+ }
89
+ };
90
+ export default Upscope;
91
+ //# sourceMappingURL=Upscope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeEventEmitter","NativeUpscopeModule","emitter","Upscope","initialize","config","connect","disconnect","reset","reconnect","updateConnection","params","stopSession","requestAgent","cancelAgentRequest","getLookupCode","getShortId","getWatchLink","sendCustomMessage","message","addListener","eventName","callback"],"sourceRoot":"../../src","sources":["Upscope.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,cAAc;AACjD,OAAOC,mBAAmB,MAAM,uBAAuB;;AAQvD;AACA;AACA;AACA;;AAKA;AACA,MAAMC,OAAO,GAAG,IAAIF,kBAAkB,CAACC,mBAAmB,CAAC;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,OAAO,GAAG;EACd;EACAC,UAAUA,CAACC,MAAqB,EAAQ;IACtCJ,mBAAmB,CAACG,UAAU,CAACC,MAA2B,CAAC;EAC7D,CAAC;EAED;EACAC,OAAOA,CAAA,EAAS;IACdL,mBAAmB,CAACK,OAAO,CAAC,CAAC;EAC/B,CAAC;EAED;EACAC,UAAUA,CAAA,EAAS;IACjBN,mBAAmB,CAACM,UAAU,CAAC,CAAC;EAClC,CAAC;EAED;AACF;AACA;AACA;EACEC,KAAKA,CAACC,SAAkB,GAAG,IAAI,EAAQ;IACrCR,mBAAmB,CAACO,KAAK,CAACC,SAAS,CAAC;EACtC,CAAC;EAED;AACF;AACA;AACA;EACEC,gBAAgBA,CAACC,MAA8B,EAAQ;IACrDV,mBAAmB,CAACS,gBAAgB,CAACC,MAA2B,CAAC;EACnE,CAAC;EAED;EACAC,WAAWA,CAAA,EAAS;IAClBX,mBAAmB,CAACW,WAAW,CAAC,CAAC;EACnC,CAAC;EAED;EACAC,YAAYA,CAAA,EAAS;IACnBZ,mBAAmB,CAACY,YAAY,CAAC,CAAC;EACpC,CAAC;EAED;EACAC,kBAAkBA,CAAA,EAAS;IACzBb,mBAAmB,CAACa,kBAAkB,CAAC,CAAC;EAC1C,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,aAAaA,CAAA,EAAS;IACpBd,mBAAmB,CAACc,aAAa,CAAC,CAAC;EACrC,CAAC;EAED;EACAC,UAAUA,CAAA,EAA2B;IACnC,OAAOf,mBAAmB,CAACe,UAAU,CAAC,CAAC;EACzC,CAAC;EAED;EACAC,YAAYA,CAAA,EAA2B;IACrC,OAAOhB,mBAAmB,CAACgB,YAAY,CAAC,CAAC;EAC3C,CAAC;EAED;EACAC,iBAAiBA,CAACC,OAAe,EAAQ;IACvClB,mBAAmB,CAACiB,iBAAiB,CAACC,OAAO,CAAC;EAChD,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CACTC,SAAY,EACZC,QAA6C,EAC1B;IACnB,OAAOpB,OAAO,CAACkB,WAAW,CAACC,SAAS,EAAEC,QAAQ,CAAC;EACjD;AACF,CAAU;AAEV,eAAenB,OAAO","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ import React from "react";
4
+ import NativeUpscopeMaskedView from "./NativeUpscopeMaskedView";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export function UpscopeMasked({
7
+ children,
8
+ style,
9
+ ...props
10
+ }) {
11
+ return /*#__PURE__*/_jsx(NativeUpscopeMaskedView, {
12
+ style: style,
13
+ ...props,
14
+ children: children
15
+ });
16
+ }
17
+ //# sourceMappingURL=UpscopeMasked.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","NativeUpscopeMaskedView","jsx","_jsx","UpscopeMasked","children","style","props"],"sourceRoot":"../../src","sources":["UpscopeMasked.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,uBAAuB,MAAM,2BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMhE,OAAO,SAASC,aAAaA,CAAC;EAC5BC,QAAQ;EACRC,KAAK;EACL,GAAGC;AACe,CAAC,EAAE;EACrB,oBACEJ,IAAA,CAACF,uBAAuB;IAACK,KAAK,EAAEA,KAAM;IAAA,GAAKC,KAAK;IAAAF,QAAA,EAC7CA;EAAQ,CACc,CAAC;AAE9B","ignoreList":[]}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ import { useState, useEffect, useMemo } from "react";
4
+ import Upscope from "./Upscope";
5
+ /**
6
+ * Returns the current WebSocket connection state, updated reactively via the
7
+ * `connectionStateChanged` event. Starts as "inactive" before the first event.
8
+ */
9
+ export function useConnectionState() {
10
+ const [state, setState] = useState("inactive");
11
+ useEffect(() => {
12
+ const sub = Upscope.addListener("connectionStateChanged", event => {
13
+ setState(event.state);
14
+ });
15
+ return () => sub.remove();
16
+ }, []);
17
+ return state;
18
+ }
19
+
20
+ /**
21
+ * Returns the current co-browsing session state. Transitions to "active" on
22
+ * `sessionStarted` and back to "inactive" on `sessionEnded`.
23
+ */
24
+ export function useSessionState() {
25
+ const [state, setState] = useState("inactive");
26
+ useEffect(() => {
27
+ const subStart = Upscope.addListener("sessionStarted", () => {
28
+ setState("active");
29
+ });
30
+ const subEnd = Upscope.addListener("sessionEnded", () => {
31
+ setState("inactive");
32
+ });
33
+ return () => {
34
+ subStart.remove();
35
+ subEnd.remove();
36
+ };
37
+ }, []);
38
+ return state;
39
+ }
40
+
41
+ /**
42
+ * Returns the SDK short ID, or null if not yet assigned.
43
+ * Resolves the current value on mount and stays in sync via `shortIdChanged`.
44
+ */
45
+ export function useShortId() {
46
+ const [shortId, setShortId] = useState(null);
47
+ useEffect(() => {
48
+ // Seed with the current value; the listener handles all subsequent changes.
49
+ Upscope.getShortId().then(setShortId);
50
+ const sub = Upscope.addListener("shortIdChanged", event => {
51
+ setShortId(event.shortId);
52
+ });
53
+ return () => sub.remove();
54
+ }, []);
55
+ return shortId;
56
+ }
57
+
58
+ /**
59
+ * Returns the current lookup code, or null until the native layer emits one.
60
+ * Updated reactively via `lookupCodeChanged`.
61
+ */
62
+ export function useLookupCode() {
63
+ const [code, setCode] = useState(null);
64
+ useEffect(() => {
65
+ const sub = Upscope.addListener("lookupCodeChanged", event => {
66
+ setCode(event.lookupCode);
67
+ });
68
+ return () => sub.remove();
69
+ }, []);
70
+ return code;
71
+ }
72
+
73
+ /**
74
+ * Returns a stable object of imperative Upscope action methods.
75
+ * Safe to use as a dependency in `useCallback` / `useEffect`.
76
+ */
77
+ export function useUpscope() {
78
+ return useMemo(() => ({
79
+ connect: Upscope.connect,
80
+ disconnect: Upscope.disconnect,
81
+ stopSession: Upscope.stopSession,
82
+ requestAgent: Upscope.requestAgent,
83
+ cancelAgentRequest: Upscope.cancelAgentRequest,
84
+ sendCustomMessage: Upscope.sendCustomMessage,
85
+ getLookupCode: Upscope.getLookupCode,
86
+ reset: Upscope.reset
87
+ }), []);
88
+ }
89
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useState","useEffect","useMemo","Upscope","useConnectionState","state","setState","sub","addListener","event","remove","useSessionState","subStart","subEnd","useShortId","shortId","setShortId","getShortId","then","useLookupCode","code","setCode","lookupCode","useUpscope","connect","disconnect","stopSession","requestAgent","cancelAgentRequest","sendCustomMessage","getLookupCode","reset"],"sourceRoot":"../../src","sources":["hooks.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,OAAO,QAAQ,OAAO;AACpD,OAAOC,OAAO,MAAM,WAAW;AAG/B;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAAoB;EACpD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGN,QAAQ,CAAkB,UAAU,CAAC;EAE/DC,SAAS,CAAC,MAAM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C;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOK,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASI,aAAaA,CAAA,EAAkB;EAC7C,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGrB,QAAQ,CAAgB,IAAI,CAAC;EAErDC,SAAS,CAAC,MAAM;IACd,MAAMM,GAAG,GAAGJ,OAAO,CAACK,WAAW,CAAC,mBAAmB,EAAGC,KAAK,IAAK;MAC9DY,OAAO,CAACZ,KAAK,CAACa,UAAU,CAAC;IAC3B,CAAC,CAAC;IACF,OAAO,MAAMf,GAAG,CAACG,MAAM,CAAC,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOU,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASG,UAAUA,CAAA,EAAG;EAC3B,OAAOrB,OAAO,CACZ,OAAO;IACLsB,OAAO,EAAErB,OAAO,CAACqB,OAAO;IACxBC,UAAU,EAAEtB,OAAO,CAACsB,UAAU;IAC9BC,WAAW,EAAEvB,OAAO,CAACuB,WAAW;IAChCC,YAAY,EAAExB,OAAO,CAACwB,YAAY;IAClCC,kBAAkB,EAAEzB,OAAO,CAACyB,kBAAkB;IAC9CC,iBAAiB,EAAE1B,OAAO,CAAC0B,iBAAiB;IAC5CC,aAAa,EAAE3B,OAAO,CAAC2B,aAAa;IACpCC,KAAK,EAAE5B,OAAO,CAAC4B;EACjB,CAAC,CAAC,EACF,EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ export { default } from "./Upscope";
4
+ export { default as Upscope } from "./Upscope";
5
+ export { useConnectionState, useSessionState, useShortId, useLookupCode, useUpscope } from "./hooks";
6
+ export { UpscopeMasked } from "./UpscopeMasked";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default","Upscope","useConnectionState","useSessionState","useShortId","useLookupCode","useUpscope","UpscopeMasked"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,OAAkB,QAAQ,WAAW;AAC9C,SAASA,OAAO,IAAIC,OAAO,QAAQ,WAAW;AAG9C,SACEC,kBAAkB,EAClBC,eAAe,EACfC,UAAU,EACVC,aAAa,EACbC,UAAU,QACL,SAAS;AAEhB,SAASC,aAAa,QAAQ,iBAAiB","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import type { ViewProps } from "react-native";
2
+ import type { HostComponent } from "react-native";
3
+ export interface NativeProps extends ViewProps {
4
+ }
5
+ declare const _default: HostComponent<NativeProps>;
6
+ export default _default;
7
+ //# sourceMappingURL=NativeUpscopeMaskedView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeUpscopeMaskedView.d.ts","sourceRoot":"","sources":["../../src/NativeUpscopeMaskedView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,MAAM,WAAW,WAAY,SAAQ,SAAS;CAAG;wBAI5C,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
@@ -0,0 +1,20 @@
1
+ import type { TurboModule } from "react-native";
2
+ export interface Spec extends TurboModule {
3
+ initialize(config: Object): void;
4
+ connect(): void;
5
+ disconnect(): void;
6
+ reset(reconnect: boolean): void;
7
+ updateConnection(params: Object): void;
8
+ stopSession(): void;
9
+ requestAgent(): void;
10
+ cancelAgentRequest(): void;
11
+ getLookupCode(): void;
12
+ getShortId(): Promise<string | null>;
13
+ getWatchLink(): Promise<string | null>;
14
+ sendCustomMessage(message: string): void;
15
+ addListener(eventName: string): void;
16
+ removeListeners(count: number): void;
17
+ }
18
+ declare const _default: Spec;
19
+ export default _default;
20
+ //# sourceMappingURL=NativeUpscopeModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeUpscopeModule.d.ts","sourceRoot":"","sources":["../../src/NativeUpscopeModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IAEvC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGjC,OAAO,IAAI,IAAI,CAAC;IAChB,UAAU,IAAI,IAAI,CAAC;IACnB,KAAK,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAGvC,WAAW,IAAI,IAAI,CAAC;IACpB,YAAY,IAAI,IAAI,CAAC;IACrB,kBAAkB,IAAI,IAAI,CAAC;IAG3B,aAAa,IAAI,IAAI,CAAC;IACtB,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACrC,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAGvC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAGzC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;;AAED,wBAAuE"}
@@ -0,0 +1,60 @@
1
+ import type { UpscopeConfig, ConnectionUpdateParams, UpscopeEventMap, UpscopeEventName } from "./types";
2
+ /**
3
+ * Subscription handle returned by addListener. Callers must invoke remove()
4
+ * to avoid memory leaks when the component/scope unmounts.
5
+ */
6
+ export interface EventSubscription {
7
+ remove(): void;
8
+ }
9
+ /**
10
+ * Imperative JS API over the native Upscope TurboModule.
11
+ *
12
+ * All methods are thin typed wrappers; no business logic lives here.
13
+ * Prefer using the React hooks in this package inside components.
14
+ */
15
+ declare const Upscope: {
16
+ /** Initialise the SDK. Must be called before any other method. */
17
+ readonly initialize: (config: UpscopeConfig) => void;
18
+ /** Open a WebSocket connection to the Upscope service. */
19
+ readonly connect: () => void;
20
+ /** Close the WebSocket connection. */
21
+ readonly disconnect: () => void;
22
+ /**
23
+ * Reset the connection state.
24
+ * @param reconnect - Whether to reconnect immediately after reset. Defaults to true.
25
+ */
26
+ readonly reset: (reconnect?: boolean) => void;
27
+ /**
28
+ * Update user identity and metadata sent to the Upscope service.
29
+ * Safe to call at any time; changes are pushed on the next sync.
30
+ */
31
+ readonly updateConnection: (params: ConnectionUpdateParams) => void;
32
+ /** Terminate the active co-browsing session. */
33
+ readonly stopSession: () => void;
34
+ /** Request that an agent join the current session. */
35
+ readonly requestAgent: () => void;
36
+ /** Cancel a pending agent-join request. */
37
+ readonly cancelAgentRequest: () => void;
38
+ /**
39
+ * Ask the native layer to emit the current lookup code via the
40
+ * `lookupCodeChanged` event. The lookup code itself is delivered
41
+ * asynchronously through the event system.
42
+ */
43
+ readonly getLookupCode: () => void;
44
+ /** Resolve the current short ID, or null if not yet assigned. */
45
+ readonly getShortId: () => Promise<string | null>;
46
+ /** Resolve the watch link for the current session, or null if unavailable. */
47
+ readonly getWatchLink: () => Promise<string | null>;
48
+ /** Send an arbitrary string message to all connected observers. */
49
+ readonly sendCustomMessage: (message: string) => void;
50
+ /**
51
+ * Subscribe to a typed Upscope event.
52
+ *
53
+ * @param eventName - One of the well-known event names from UpscopeEventMap.
54
+ * @param callback - Invoked with the strongly-typed payload on each event.
55
+ * @returns A subscription handle. Call `.remove()` to unsubscribe.
56
+ */
57
+ readonly addListener: <E extends UpscopeEventName>(eventName: E, callback: (event: UpscopeEventMap[E]) => void) => EventSubscription;
58
+ };
59
+ export default Upscope;
60
+ //# sourceMappingURL=Upscope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Upscope.d.ts","sourceRoot":"","sources":["../../src/Upscope.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,IAAI,IAAI,CAAC;CAChB;AAKD;;;;;GAKG;AACH,QAAA,MAAM,OAAO;IACX,kEAAkE;kCAC/C,aAAa,KAAG,IAAI;IAIvC,0DAA0D;4BAC/C,IAAI;IAIf,sCAAsC;+BACxB,IAAI;IAIlB;;;OAGG;iCACc,OAAO,KAAU,IAAI;IAItC;;;OAGG;wCACsB,sBAAsB,KAAG,IAAI;IAItD,gDAAgD;gCACjC,IAAI;IAInB,sDAAsD;iCACtC,IAAI;IAIpB,2CAA2C;uCACrB,IAAI;IAI1B;;;;OAIG;kCACc,IAAI;IAIrB,iEAAiE;+BACnD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIpC,8EAA8E;iCAC9D,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAItC,mEAAmE;0CACxC,MAAM,KAAG,IAAI;IAIxC;;;;;;OAMG;2BACS,CAAC,SAAS,gBAAgB,aACzB,CAAC,YACF,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,KAC5C,iBAAiB;CAGZ,CAAC;AAEX,eAAe,OAAO,CAAC"}
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import type { ViewProps } from "react-native";
3
+ export interface UpscopeMaskedProps extends ViewProps {
4
+ children: React.ReactNode;
5
+ }
6
+ export declare function UpscopeMasked({ children, style, ...props }: UpscopeMaskedProps): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=UpscopeMasked.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UpscopeMasked.d.ts","sourceRoot":"","sources":["../../src/UpscopeMasked.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,kBAAkB,2CAMpB"}
@@ -0,0 +1,36 @@
1
+ import type { ConnectionState, SessionState } from "./types";
2
+ /**
3
+ * Returns the current WebSocket connection state, updated reactively via the
4
+ * `connectionStateChanged` event. Starts as "inactive" before the first event.
5
+ */
6
+ export declare function useConnectionState(): ConnectionState;
7
+ /**
8
+ * Returns the current co-browsing session state. Transitions to "active" on
9
+ * `sessionStarted` and back to "inactive" on `sessionEnded`.
10
+ */
11
+ export declare function useSessionState(): SessionState;
12
+ /**
13
+ * Returns the SDK short ID, or null if not yet assigned.
14
+ * Resolves the current value on mount and stays in sync via `shortIdChanged`.
15
+ */
16
+ export declare function useShortId(): string | null;
17
+ /**
18
+ * Returns the current lookup code, or null until the native layer emits one.
19
+ * Updated reactively via `lookupCodeChanged`.
20
+ */
21
+ export declare function useLookupCode(): string | null;
22
+ /**
23
+ * Returns a stable object of imperative Upscope action methods.
24
+ * Safe to use as a dependency in `useCallback` / `useEffect`.
25
+ */
26
+ export declare function useUpscope(): {
27
+ connect: () => void;
28
+ disconnect: () => void;
29
+ stopSession: () => void;
30
+ requestAgent: () => void;
31
+ cancelAgentRequest: () => void;
32
+ sendCustomMessage: (message: string) => void;
33
+ getLookupCode: () => void;
34
+ reset: (reconnect?: boolean) => void;
35
+ };
36
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAWpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAiB9C;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAa1C;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,GAAG,IAAI,CAW7C;AAED;;;GAGG;AACH,wBAAgB,UAAU;;;;;;;;;EAczB"}
@@ -0,0 +1,8 @@
1
+ export { default as default } from "./Upscope";
2
+ export { default as Upscope } from "./Upscope";
3
+ export type { EventSubscription } from "./Upscope";
4
+ export { useConnectionState, useSessionState, useShortId, useLookupCode, useUpscope, } from "./hooks";
5
+ export { UpscopeMasked } from "./UpscopeMasked";
6
+ export type { UpscopeMaskedProps } from "./UpscopeMasked";
7
+ export type { ConnectionState, SessionState, SessionEndReason, UpscopeError, UpscopeConfig, ConnectionUpdateParams, Observer, UpscopeEventMap, UpscopeEventName, ConnectionStateChangedEvent, SessionStartedEvent, SessionEndedEvent, CustomMessageEvent, ObserverCountChangedEvent, ObserverLeftEvent, ShortIdChangedEvent, LookupCodeChangedEvent, } from "./types";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,aAAa,EACb,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,YAAY,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,2BAA2B,EAC3B,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,79 @@
1
+ export type ConnectionState = "inactive" | "connecting" | "connected" | "reconnecting" | "error";
2
+ export type SessionState = "inactive" | "pendingRequest" | "active" | "paused" | "ended";
3
+ export type SessionEndReason = "userStopped" | "agentStopped" | "timeout" | "error";
4
+ export interface UpscopeError {
5
+ readonly code: string;
6
+ readonly message: string;
7
+ }
8
+ export interface UpscopeConfig {
9
+ readonly apiKey: string;
10
+ readonly requireAuthorizationForSession?: boolean;
11
+ readonly autoConnect?: boolean;
12
+ readonly region?: string;
13
+ readonly showBanner?: boolean;
14
+ readonly showTerminateButton?: boolean;
15
+ readonly authorizationPromptTitle?: string;
16
+ readonly authorizationPromptMessage?: string;
17
+ readonly endOfSessionMessage?: string;
18
+ readonly stopSessionText?: string;
19
+ readonly allowRemoteClick?: boolean;
20
+ readonly allowRemoteScroll?: boolean;
21
+ readonly requireControlRequest?: boolean;
22
+ }
23
+ export interface ConnectionUpdateParams {
24
+ readonly uniqueId?: string;
25
+ readonly callName?: string;
26
+ readonly tags?: readonly string[];
27
+ readonly identities?: readonly string[];
28
+ readonly metadata?: Readonly<Record<string, string>>;
29
+ }
30
+ export interface Observer {
31
+ readonly id: string;
32
+ readonly name: string | null;
33
+ readonly screenWidth: number;
34
+ readonly screenHeight: number;
35
+ readonly windowWidth: number;
36
+ readonly windowHeight: number;
37
+ readonly hasFocus: boolean;
38
+ }
39
+ export interface ConnectionStateChangedEvent {
40
+ readonly state: ConnectionState;
41
+ readonly error?: UpscopeError;
42
+ }
43
+ export interface SessionStartedEvent {
44
+ readonly agentName: string | null;
45
+ }
46
+ export interface SessionEndedEvent {
47
+ readonly reason: SessionEndReason;
48
+ readonly error?: UpscopeError;
49
+ }
50
+ export interface CustomMessageEvent {
51
+ readonly message: string;
52
+ readonly observerId: string;
53
+ }
54
+ export interface ObserverCountChangedEvent {
55
+ readonly count: number;
56
+ }
57
+ export interface ObserverLeftEvent {
58
+ readonly observerId: string;
59
+ }
60
+ export interface ShortIdChangedEvent {
61
+ readonly shortId: string | null;
62
+ }
63
+ export interface LookupCodeChangedEvent {
64
+ readonly lookupCode: string | null;
65
+ }
66
+ export type UpscopeEventMap = {
67
+ readonly connectionStateChanged: ConnectionStateChangedEvent;
68
+ readonly sessionStarted: SessionStartedEvent;
69
+ readonly sessionEnded: SessionEndedEvent;
70
+ readonly customMessageReceived: CustomMessageEvent;
71
+ readonly error: UpscopeError;
72
+ readonly observerJoined: Observer;
73
+ readonly observerLeft: ObserverLeftEvent;
74
+ readonly observerCountChanged: ObserverCountChangedEvent;
75
+ readonly shortIdChanged: ShortIdChangedEvent;
76
+ readonly lookupCodeChanged: LookupCodeChangedEvent;
77
+ };
78
+ export type UpscopeEventName = keyof UpscopeEventMap;
79
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,YAAY,GACZ,WAAW,GACX,cAAc,GACd,OAAO,CAAC;AAEZ,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,gBAAgB,GAChB,QAAQ,GACR,QAAQ,GACR,OAAO,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,cAAc,GACd,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ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ACzC,QAAQ,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;IACzD,QAAQ,CAAC,cAAc,EAAE,mBAAmB,CAAC;IAC7C,QAAQ,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,MAAM,eAAe,CAAC"}
package/package.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "@upscopeio/react-native-sdk",
3
+ "version": "2026.3.0",
4
+ "description": "React Native SDK for Upscope cobrowsing",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "upscopeio-react-native-sdk.podspec",
16
+ "!**/__tests__",
17
+ "!**/__fixtures__",
18
+ "!**/__mocks__",
19
+ "!**/.*"
20
+ ],
21
+ "scripts": {
22
+ "typecheck": "tsc --noEmit",
23
+ "lint": "eslint \"src/**/*.{ts,tsx}\"",
24
+ "test": "jest",
25
+ "build": "bob build",
26
+ "prepublishOnly": "bob build"
27
+ },
28
+ "keywords": [
29
+ "react-native",
30
+ "upscope",
31
+ "cobrowsing",
32
+ "screen-sharing"
33
+ ],
34
+ "repository": "https://github.com/upscopeio/react-native-sdk",
35
+ "author": "Upscope <support@upscope.com>",
36
+ "license": "MIT",
37
+ "homepage": "https://github.com/upscopeio/react-native-sdk#readme",
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "devDependencies": {
42
+ "@react-native/eslint-config": "^0.76.0",
43
+ "@testing-library/react-native": "12.7.2",
44
+ "@types/jest": "^29.5.0",
45
+ "@types/react": "^18.3.28",
46
+ "eslint": "^8.57.0",
47
+ "jest": "^29.7.0",
48
+ "react": "^18.3.1",
49
+ "react-native": "^0.76.0",
50
+ "react-native-builder-bob": "^0.35.0",
51
+ "react-test-renderer": "18.3.1",
52
+ "typescript": "^5.5.0"
53
+ },
54
+ "peerDependencies": {
55
+ "react": ">=18.2.0",
56
+ "react-native": ">=0.76.0"
57
+ },
58
+ "codegenConfig": {
59
+ "name": "UpscopeSpec",
60
+ "type": "modules",
61
+ "jsSrcsDir": "src",
62
+ "android": {
63
+ "javaPackageName": "io.upscope.reactnative"
64
+ },
65
+ "ios": {
66
+ "modulesProvider": {
67
+ "UpscopeModule": "UpscopeModule"
68
+ }
69
+ }
70
+ },
71
+ "jest": {
72
+ "preset": "react-native",
73
+ "moduleFileExtensions": [
74
+ "ts",
75
+ "tsx",
76
+ "js",
77
+ "jsx"
78
+ ]
79
+ },
80
+ "react-native-builder-bob": {
81
+ "source": "src",
82
+ "output": "lib",
83
+ "targets": [
84
+ "commonjs",
85
+ "module",
86
+ [
87
+ "typescript",
88
+ {
89
+ "project": "tsconfig.build.json"
90
+ }
91
+ ]
92
+ ]
93
+ }
94
+ }
@@ -0,0 +1,9 @@
1
+ import type { ViewProps } from "react-native";
2
+ import type { HostComponent } from "react-native";
3
+ import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
4
+
5
+ export interface NativeProps extends ViewProps {}
6
+
7
+ export default codegenNativeComponent<NativeProps>(
8
+ "UpscopeMaskedView",
9
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,32 @@
1
+ import type { TurboModule } from "react-native";
2
+ import { TurboModuleRegistry } from "react-native";
3
+
4
+ export interface Spec extends TurboModule {
5
+ // Initialization
6
+ initialize(config: Object): void;
7
+
8
+ // Connection
9
+ connect(): void;
10
+ disconnect(): void;
11
+ reset(reconnect: boolean): void;
12
+ updateConnection(params: Object): void;
13
+
14
+ // Session
15
+ stopSession(): void;
16
+ requestAgent(): void;
17
+ cancelAgentRequest(): void;
18
+
19
+ // Lookup
20
+ getLookupCode(): void;
21
+ getShortId(): Promise<string | null>;
22
+ getWatchLink(): Promise<string | null>;
23
+
24
+ // Messaging
25
+ sendCustomMessage(message: string): void;
26
+
27
+ // Event support
28
+ addListener(eventName: string): void;
29
+ removeListeners(count: number): void;
30
+ }
31
+
32
+ export default TurboModuleRegistry.getEnforcing<Spec>("UpscopeModule");