cobrowse-sdk-react-native 2.14.0 → 2.16.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 (97) hide show
  1. package/.vscode/settings.json +7 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/io/cobrowse/reactnative/CobrowseIOCommonDelegates.java +3 -3
  4. package/android/src/main/java/io/cobrowse/reactnative/CobrowseIOModule.java +23 -0
  5. package/android/src/main/java/io/cobrowse/reactnative/CommonDelegates.java +20 -83
  6. package/cobrowse-sdk-react-native.podspec +1 -1
  7. package/ios/RCTCobrowseIO.m +20 -71
  8. package/js/CBIOBroadcastPickerView.tsx +15 -0
  9. package/js/CobrowseAccessibilityService.ts +15 -0
  10. package/js/CobrowseIO.ts +156 -0
  11. package/js/CobrowseView.tsx +150 -0
  12. package/js/{Redacted.js → Redacted.tsx} +3 -2
  13. package/js/Session.ts +128 -0
  14. package/js/SessionControl.ts +38 -0
  15. package/js/Unredacted.tsx +106 -0
  16. package/js/{index.js → index.ts} +1 -0
  17. package/js/{useSession.js → useSession.ts} +5 -4
  18. package/lib/commonjs/CBIOBroadcastPickerView.js +15 -0
  19. package/lib/commonjs/CBIOBroadcastPickerView.js.map +1 -0
  20. package/lib/commonjs/CobrowseAccessibilityService.js +22 -0
  21. package/lib/commonjs/CobrowseAccessibilityService.js.map +1 -0
  22. package/lib/commonjs/CobrowseIO.js +149 -0
  23. package/lib/commonjs/CobrowseIO.js.map +1 -0
  24. package/lib/commonjs/CobrowseView.js +146 -0
  25. package/lib/commonjs/CobrowseView.js.map +1 -0
  26. package/lib/commonjs/Redacted.js +14 -0
  27. package/lib/commonjs/Redacted.js.map +1 -0
  28. package/lib/commonjs/Session.js +100 -0
  29. package/lib/commonjs/Session.js.map +1 -0
  30. package/lib/commonjs/SessionControl.js +39 -0
  31. package/lib/commonjs/SessionControl.js.map +1 -0
  32. package/lib/commonjs/Unredacted.js +82 -0
  33. package/lib/commonjs/Unredacted.js.map +1 -0
  34. package/lib/commonjs/index.js +77 -0
  35. package/lib/commonjs/index.js.map +1 -0
  36. package/lib/commonjs/useSession.js +35 -0
  37. package/lib/commonjs/useSession.js.map +1 -0
  38. package/lib/module/CBIOBroadcastPickerView.js +8 -0
  39. package/lib/module/CBIOBroadcastPickerView.js.map +1 -0
  40. package/lib/module/CobrowseAccessibilityService.js +13 -0
  41. package/lib/module/CobrowseAccessibilityService.js.map +1 -0
  42. package/lib/module/CobrowseIO.js +141 -0
  43. package/lib/module/CobrowseIO.js.map +1 -0
  44. package/lib/module/CobrowseView.js +136 -0
  45. package/lib/module/CobrowseView.js.map +1 -0
  46. package/lib/module/Redacted.js +7 -0
  47. package/lib/module/Redacted.js.map +1 -0
  48. package/lib/module/Session.js +93 -0
  49. package/lib/module/Session.js.map +1 -0
  50. package/lib/module/SessionControl.js +31 -0
  51. package/lib/module/SessionControl.js.map +1 -0
  52. package/lib/module/Unredacted.js +71 -0
  53. package/lib/module/Unredacted.js.map +1 -0
  54. package/lib/module/index.js +9 -0
  55. package/lib/module/index.js.map +1 -0
  56. package/lib/module/useSession.js +28 -0
  57. package/lib/module/useSession.js.map +1 -0
  58. package/lib/typescript/CBIOBroadcastPickerView.d.ts +8 -0
  59. package/lib/typescript/CBIOBroadcastPickerView.d.ts.map +1 -0
  60. package/lib/typescript/CobrowseAccessibilityService.d.ts +8 -0
  61. package/lib/typescript/CobrowseAccessibilityService.d.ts.map +1 -0
  62. package/lib/typescript/CobrowseIO.d.ts +30 -0
  63. package/lib/typescript/CobrowseIO.d.ts.map +1 -0
  64. package/lib/typescript/CobrowseView.d.ts +25 -0
  65. package/lib/typescript/CobrowseView.d.ts.map +1 -0
  66. package/lib/typescript/Redacted.d.ts +4 -0
  67. package/lib/typescript/Redacted.d.ts.map +1 -0
  68. package/lib/typescript/Session.d.ts +42 -0
  69. package/lib/typescript/Session.d.ts.map +1 -0
  70. package/lib/typescript/SessionControl.d.ts +17 -0
  71. package/lib/typescript/SessionControl.d.ts.map +1 -0
  72. package/lib/typescript/Unredacted.d.ts +10 -0
  73. package/lib/typescript/Unredacted.d.ts.map +1 -0
  74. package/lib/typescript/index.d.ts +10 -0
  75. package/lib/typescript/index.d.ts.map +1 -0
  76. package/lib/typescript/useSession.d.ts +3 -0
  77. package/lib/typescript/useSession.d.ts.map +1 -0
  78. package/package.json +35 -7
  79. package/tsconfig.build.json +5 -0
  80. package/tsconfig.json +28 -0
  81. package/js/CBIOBroadcastPickerView.js +0 -11
  82. package/js/CobrowseAccessibilityService.js +0 -11
  83. package/js/CobrowseIO.js +0 -141
  84. package/js/CobrowseView.js +0 -129
  85. package/js/Session.js +0 -107
  86. package/js/SessionControl.js +0 -26
  87. package/js/Unredacted.js +0 -82
  88. package/ts/CBIOBroadcastPickerView.d.ts +0 -8
  89. package/ts/CobrowseAccessibilityService.d.ts +0 -6
  90. package/ts/CobrowseIO.d.ts +0 -29
  91. package/ts/CobrowseView.d.ts +0 -20
  92. package/ts/Redacted.d.ts +0 -8
  93. package/ts/Session.d.ts +0 -58
  94. package/ts/SessionControl.d.ts +0 -9
  95. package/ts/Unredacted.d.ts +0 -15
  96. package/ts/index.d.ts +0 -7
  97. package/ts/useSession.d.ts +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSession.d.ts","sourceRoot":"","sources":["../../js/useSession.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AAEpC,wBAAgB,UAAU,IAAK,OAAO,GAAG,IAAI,CA6B5C"}
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "cobrowse-sdk-react-native",
3
- "version": "2.14.0",
3
+ "version": "2.16.0",
4
4
  "description": "Cobrowse SDK for React Native",
5
- "main": "js/index.js",
6
- "types": "ts/index.d.ts",
5
+ "main": "lib/module/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "js/index",
7
9
  "scripts": {
8
- "lint": "ts-standard ts/*.d.ts",
9
- "lint:fix": "ts-standard ts/*.d.ts --fix",
10
- "start:dev": "nodemon --exec ./scripts/copy.sh"
10
+ "lint": "ts-standard",
11
+ "lint:fix": "npm run lint -- --fix",
12
+ "start:dev": "nodemon --exec ./scripts/copy.sh",
13
+ "prepack": "bob build"
11
14
  },
12
15
  "author": {
13
16
  "name": "Andy Pritchard"
@@ -35,10 +38,35 @@
35
38
  "lodash": "^4.17.21"
36
39
  },
37
40
  "devDependencies": {
41
+ "@types/lodash": "^4.14.194",
38
42
  "@types/react": "^18.0.24",
39
43
  "@types/react-native": "^0.70.6",
40
44
  "nodemon": "^2.0.20",
41
- "ts-standard": "^12.0.1",
45
+ "react-native-builder-bob": "^0.20.4",
46
+ "ts-standard": "^12.0.2",
42
47
  "typescript": "^4.8.4"
48
+ },
49
+ "ts-standard": {
50
+ "project": "tsconfig.eslint.json",
51
+ "env": [
52
+ "jest"
53
+ ],
54
+ "ignore": [
55
+ "lib"
56
+ ]
57
+ },
58
+ "react-native-builder-bob": {
59
+ "source": "js",
60
+ "output": "lib",
61
+ "targets": [
62
+ "commonjs",
63
+ "module",
64
+ [
65
+ "typescript",
66
+ {
67
+ "project": "tsconfig.build.json"
68
+ }
69
+ ]
70
+ ]
43
71
  }
44
72
  }
@@ -0,0 +1,5 @@
1
+
2
+ {
3
+ "extends": "./tsconfig",
4
+ "exclude": ["Example"]
5
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "./*",
4
+ "paths": {
5
+ "cobrowse-sdk-react-native": ["./js/index"]
6
+ },
7
+ "allowUnreachableCode": false,
8
+ "allowUnusedLabels": false,
9
+ "esModuleInterop": true,
10
+ "importsNotUsedAsValues": "error",
11
+ "forceConsistentCasingInFileNames": true,
12
+ "jsx": "react",
13
+ "lib": ["esnext"],
14
+ "module": "esnext",
15
+ "moduleResolution": "node",
16
+ "noFallthroughCasesInSwitch": true,
17
+ "noImplicitReturns": true,
18
+ "noImplicitUseStrict": false,
19
+ "noStrictGenericChecks": false,
20
+ "noUncheckedIndexedAccess": true,
21
+ "noUnusedLocals": true,
22
+ "noUnusedParameters": true,
23
+ "resolveJsonModule": true,
24
+ "skipLibCheck": true,
25
+ "strict": true,
26
+ "target": "esnext"
27
+ }
28
+ }
@@ -1,11 +0,0 @@
1
- import React from 'react'
2
- import { Platform, requireNativeComponent } from 'react-native'
3
-
4
- const CBIOBroadcastPickerView = requireNativeComponent(
5
- 'CBIOBroadcastPickerView'
6
- )
7
-
8
- export default function (props) {
9
- // this native component is only available on iOS
10
- return Platform.OS === 'ios' ? <CBIOBroadcastPickerView {...props} /> : null
11
- }
@@ -1,11 +0,0 @@
1
- const CobrowseIONative = require('react-native').NativeModules.CobrowseIO
2
-
3
- export default class CobrowseAccessibilityService {
4
- static showSetup () {
5
- return CobrowseIONative.accessibilityServiceShowSetup()
6
- }
7
-
8
- static isRunning () {
9
- return CobrowseIONative.accessibilityServiceIsRunning()
10
- }
11
- }
package/js/CobrowseIO.js DELETED
@@ -1,141 +0,0 @@
1
- import { Platform, Alert } from 'react-native'
2
- import Session from './Session'
3
- const CobrowseIONative = require('react-native').NativeModules.CobrowseIO
4
- const NativeEventEmitter = require('react-native').NativeEventEmitter
5
-
6
- const emitter = new NativeEventEmitter(CobrowseIONative)
7
-
8
- export default class CobrowseIO {
9
- /** @deprecated */
10
- static get SESSION_UPDATED () {
11
- return 'session.updated'
12
- }
13
-
14
- /** @deprecated */
15
- static get SESSION_ENDED () {
16
- return 'session.ended'
17
- }
18
-
19
- static handleSessionRequest (session) {
20
- if (this._sessionRequestShown) return
21
- this._sessionRequestShown = true
22
- Alert.alert(
23
- 'Support Request',
24
- 'A support agent would like to use this app with you. Do you accept?',
25
- [{
26
- text: 'Reject',
27
- onPress: () => {
28
- this._sessionRequestShown = false
29
- session.end()
30
- },
31
- style: 'cancel'
32
- }, {
33
- text: 'Accept',
34
- onPress: () => {
35
- this._sessionRequestShown = false
36
- session.activate()
37
- }
38
- }], { cancelable: false })
39
- }
40
-
41
- static handleRemoteControlRequest (session) {
42
- if (this._remoteControlRequestShown) return
43
- this._remoteControlRequestShown = true
44
- Alert.alert(
45
- 'Remote Control Request',
46
- 'A support agent would like to take remote control of this app. Do you accept?',
47
- [{
48
- text: 'Reject',
49
- onPress: () => {
50
- this._remoteControlRequestShown = false
51
- session.setRemoteControl('rejected')
52
- },
53
- style: 'cancel'
54
- }, {
55
- text: 'Accept',
56
- onPress: () => {
57
- this._remoteControlRequestShown = false
58
- session.setRemoteControl('on')
59
- }
60
- }], { cancelable: false })
61
- }
62
-
63
- static addListener (event, cb) {
64
- return emitter.addListener(event, (session) => cb(new Session(session)))
65
- }
66
-
67
- static start () {
68
- return CobrowseIONative.start()
69
- }
70
-
71
- static stop () {
72
- return CobrowseIONative.stop()
73
- }
74
-
75
- static set api (api) {
76
- CobrowseIONative.api(api)
77
- }
78
-
79
- static set license (license) {
80
- CobrowseIONative.license(license)
81
- }
82
-
83
- static set customData (customData) {
84
- CobrowseIONative.customData(customData)
85
- }
86
-
87
- static set deviceToken (token) {
88
- CobrowseIONative.deviceToken(token)
89
- }
90
-
91
- static currentSession () {
92
- return CobrowseIONative.currentSession().then((session) => session ? new Session(session) : null)
93
- }
94
-
95
- static createSession () {
96
- return CobrowseIONative.createSession().then((session) => session ? new Session(session) : null)
97
- }
98
-
99
- static getSession (codeOrId) {
100
- return CobrowseIONative.getSession(codeOrId).then((session) => session ? new Session(session) : null)
101
- }
102
-
103
- /** @deprecated */
104
- static activateSession () {
105
- return CobrowseIONative.activateSession().then((session) => session ? new Session(session) : null)
106
- }
107
-
108
- /** @deprecated */
109
- static endSession () {
110
- return CobrowseIONative.endSession()
111
- }
112
- }
113
-
114
- // the session.requested event is considered internal, it should
115
- // not be used outside these bindings
116
- CobrowseIO.addListener('session.requested', (session) => {
117
- if (CobrowseIO.showSessionControls === false) {
118
- CobrowseIONative.overwriteSessionIndicator()
119
- }
120
-
121
- if (Platform.OS === 'ios' && CobrowseIO.handleFullDeviceRequest) {
122
- CobrowseIONative.overwriteFullControlUI()
123
- }
124
-
125
- CobrowseIO.handleSessionRequest(session)
126
- })
127
-
128
- CobrowseIO.addListener('session.updated', (session) => {
129
- if (session.isActive() && session.remote_control === 'requested') {
130
- CobrowseIO.handleRemoteControlRequest(session)
131
- }
132
-
133
- if (session.isActive() && session.full_device_state === 'requested') {
134
- if (CobrowseIO.handleFullDeviceRequest) {
135
- CobrowseIO.handleFullDeviceRequest(session)
136
- } else if (Platform.OS === 'android') {
137
- // accept the incoming connection by default
138
- session.setFullDevice('on')
139
- }
140
- }
141
- })
@@ -1,129 +0,0 @@
1
- import React, { Component } from 'react'
2
- import {
3
- View,
4
- Text,
5
- ActivityIndicator,
6
- TouchableOpacity,
7
- StyleSheet
8
- } from 'react-native'
9
- import CobrowseIO from './CobrowseIO'
10
-
11
- const styles = StyleSheet.create({
12
- container: {
13
- flex: 1,
14
- justifyContent: 'flex-end'
15
- },
16
- text: {
17
- textAlign: 'center',
18
- margin: 15,
19
- fontSize: 15,
20
- lineHeight: 20
21
- },
22
- code: {
23
- fontSize: 29,
24
- padding: 20,
25
- fontWeight: 'bold',
26
- textAlign: 'center'
27
- },
28
- button: {
29
- color: 'rgb(0, 122, 255)',
30
- fontSize: 18,
31
- margin: 10
32
- }
33
- })
34
-
35
- export default class CobrowseView extends Component {
36
- constructor () {
37
- super()
38
- this.state = { error: null, session: null }
39
- }
40
-
41
- async componentDidMount () {
42
- if (this.props.license) {
43
- console.warn('Passing license to view is deprecated. Use CobrowseIO.license = "..." instead')
44
- CobrowseIO.license = this.props.license
45
- }
46
-
47
- try {
48
- const current = await CobrowseIO.currentSession()
49
- if (current) this.setState({ session: current })
50
- else {
51
- const session = await CobrowseIO.createSession()
52
- this.setState({ session })
53
- }
54
- } catch (error) {
55
- this.setState({ error })
56
- }
57
-
58
- this.updateListener = CobrowseIO.addListener('session.updated', (session) => {
59
- this.setState({ session })
60
- })
61
- this.endListener = CobrowseIO.addListener('session.ended', (session) => {
62
- if (this.props.onEnded) this.props.onEnded()
63
- this.setState({ session: null })
64
- })
65
- }
66
-
67
- componentWillUnmount () {
68
- if (this.updateListener) this.updateListener.remove()
69
- if (this.endListener) this.endListener.remove()
70
- }
71
-
72
- async endSession () {
73
- try {
74
- const { session } = this.state
75
- await session.end()
76
- this.setState({ session: null })
77
- } catch (error) {
78
- this.setState({ error })
79
- }
80
- }
81
-
82
- renderError () {
83
- return (
84
- <Text style={[styles.text]}>{this.state.error.message}</Text>
85
- )
86
- }
87
-
88
- renderCode () {
89
- let code = this.state.session && this.state.session.code
90
- if (code) code = code.substr(0, 3) + '-' + code.substr(3)
91
- return (
92
- <View>
93
- <Text style={[styles.code, { opacity: code ? 1 : 0.2 }]}>{code || '000-000'}</Text>
94
- <Text style={[styles.text]}>Provide this code to your support agent to begin screen sharing.</Text>
95
- <ActivityIndicator />
96
- </View>
97
- )
98
- }
99
-
100
- renderManageSession () {
101
- return (
102
- <View>
103
- <Text style={[styles.text]}>You{"'"}re sharing screens from this app with a support agent.</Text>
104
- <TouchableOpacity onPress={() => this.endSession()}>
105
- <Text style={[styles.text, styles.button]}>End Session</Text>
106
- </TouchableOpacity>
107
- </View>
108
- )
109
- }
110
-
111
- renderContent () {
112
- const { error, session } = this.state
113
- if (error) {
114
- return this.renderError()
115
- } else if ((!session) || (session.state === 'pending' || session.state === 'authorizing')) {
116
- return this.renderCode()
117
- } else {
118
- return this.renderManageSession()
119
- }
120
- }
121
-
122
- render () {
123
- return (
124
- <View style={styles.container}>
125
- {this.renderContent()}
126
- </View>
127
- )
128
- }
129
- }
package/js/Session.js DELETED
@@ -1,107 +0,0 @@
1
- const CobrowseIONative = require('react-native').NativeModules.CobrowseIO
2
- const NativeEventEmitter = require('react-native').NativeEventEmitter
3
-
4
- const emitter = new NativeEventEmitter(CobrowseIONative)
5
-
6
- export default class Session {
7
- constructor (session) {
8
- this._session = session || {}
9
- this._listen()
10
- }
11
-
12
- _update (session, onMatch) {
13
- if (this._session.id === undefined || (session && this._session.id === session.id)) {
14
- this._session = session
15
- if (typeof onMatch === 'function') onMatch()
16
- }
17
- }
18
-
19
- _listen () {
20
- const updates = emitter.addListener('session.updated', (session) => this._update(session))
21
- const ended = emitter.addListener('session.ended', (session) => {
22
- this._update(session, () => {
23
- updates.remove()
24
- ended.remove()
25
- })
26
- })
27
- }
28
-
29
- addListener (eventType, listener) {
30
- // TODO: this class should extend EventEmitter and forward
31
- // on the non-namespaced versions of these events
32
- switch (eventType) {
33
- case 'ended':
34
- eventType = 'session.updated'
35
- break
36
- case 'updated':
37
- eventType = 'session.ended'
38
- break
39
- }
40
-
41
- return emitter.addListener(eventType, (session) => {
42
- this._update(session, () => {
43
- listener(this)
44
- })
45
- })
46
- }
47
-
48
- get id () {
49
- return this._session.id
50
- }
51
-
52
- get code () {
53
- return this._session.code
54
- }
55
-
56
- get state () {
57
- return this._session.state
58
- }
59
-
60
- get full_device () {
61
- return this._session.full_device
62
- }
63
-
64
- get full_device_state () {
65
- return this._session.full_device_state
66
- }
67
-
68
- get remote_control () {
69
- return this._session.remote_control
70
- }
71
-
72
- get agent () {
73
- return this._session.agent
74
- }
75
-
76
- activate () {
77
- return CobrowseIONative.activateSession().then(() => {})
78
- }
79
-
80
- end () {
81
- return CobrowseIONative.endSession()
82
- }
83
-
84
- isActive () {
85
- return this._session.state === 'active'
86
- }
87
-
88
- isAuthorizing () {
89
- return this._session.state === 'authorizing'
90
- }
91
-
92
- isPending () {
93
- return this._session.state === 'pending'
94
- }
95
-
96
- isEnded () {
97
- return this._session.state === 'ended'
98
- }
99
-
100
- setFullDevice (state) {
101
- return CobrowseIONative.updateSession({ full_device: state })
102
- }
103
-
104
- setRemoteControl (state) {
105
- return CobrowseIONative.updateSession({ remote_control: state })
106
- }
107
- }
@@ -1,26 +0,0 @@
1
- import React from 'react'
2
- import CobrowseIO from './CobrowseIO'
3
-
4
- export default class SessionControl extends React.Component {
5
- constructor () {
6
- super()
7
- this.state = { session: null }
8
- }
9
-
10
- async componentDidMount () {
11
- this.setState({ session: await CobrowseIO.currentSession() })
12
- this.updateListener = CobrowseIO.addListener(CobrowseIO.SESSION_UPDATED, (session) => {
13
- this.setState({ session })
14
- })
15
- }
16
-
17
- componentWillUnmount () {
18
- if (this.updateListener) this.updateListener.remove()
19
- }
20
-
21
- render () {
22
- const { session } = this.state
23
- if (session && session.isActive()) return this.props.children
24
- else return null
25
- }
26
- }
package/js/Unredacted.js DELETED
@@ -1,82 +0,0 @@
1
- import React, { useRef, useEffect, useCallback, useMemo } from 'react'
2
- import { View, findNodeHandle } from 'react-native'
3
- import { throttle } from 'lodash'
4
- const CobrowseIONative = require('react-native').NativeModules.CobrowseIO
5
-
6
- function mergeRefs (refs) {
7
- return (value) => {
8
- refs.forEach((ref) => {
9
- if (typeof ref === 'function') {
10
- ref(value)
11
- } else if (ref != null) {
12
- ref.current = value
13
- }
14
- })
15
- }
16
- }
17
-
18
- const unredactedTags = new Set()
19
- const sendUnredactionUpdates = throttle(() => {
20
- CobrowseIONative.setUnredactedTags([...unredactedTags])
21
- }, 50, { leading: false })
22
-
23
- const removeUnredactedView = (view) => {
24
- if (view) {
25
- unredactedTags.delete(view)
26
- sendUnredactionUpdates()
27
- }
28
- }
29
-
30
- export const useUnredaction = (shouldWarnUnhandledRefs = true, componentName = '') => {
31
- const ref = useRef(null)
32
-
33
- const setRef = useCallback((node) => {
34
- let hasRemovedRef = false
35
- if (ref.current) {
36
- hasRemovedRef = true
37
- removeUnredactedView(ref.current)
38
- }
39
-
40
- if (node) {
41
- const view = findNodeHandle(node)
42
-
43
- if (view) {
44
- unredactedTags.add(view)
45
- sendUnredactionUpdates()
46
-
47
- ref.current = view
48
- } else {
49
- console.warn(`Failed to apply unredact() to ${componentName} due to view not found`)
50
- }
51
- } else if (!hasRemovedRef) {
52
- console.warn(
53
- `Failed to apply unredact() to ${componentName} due to null node handle – make sure you are forwarding refs`
54
- )
55
- }
56
- }, [])
57
-
58
- useEffect(() => {
59
- if (shouldWarnUnhandledRefs && !ref.current) {
60
- console.warn(
61
- `Failed to apply unredact() to ${componentName} due to null node handle – make sure the setRef function is called with the ref`
62
- )
63
- }
64
-
65
- return () => removeUnredactedView(ref.current)
66
- }, [])
67
-
68
- return setRef
69
- }
70
-
71
- // HOC for adding unredaction to a whole component class
72
- export function unredact (Component) {
73
- return React.forwardRef(function Redacted (props, ref) {
74
- const localRef = useUnredaction(true, Component?.name)
75
- const refs = useMemo(() => mergeRefs([localRef, ref]), [localRef, ref])
76
- return <Component {...props} collapsable={false} ref={refs} />
77
- })
78
- }
79
-
80
- // also expose a basic Component based on a View
81
- const Unredacted = unredact(View)
82
- export default Unredacted
@@ -1,8 +0,0 @@
1
- import type { ReactElement } from 'react'
2
- import type { ViewProps } from 'react-native'
3
-
4
- type Props = Readonly<{
5
- buttonColor?: string
6
- }> & ViewProps
7
-
8
- export default function (props: Props): ReactElement | null
@@ -1,6 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-extraneous-class,accessor-pairs */
2
- export default class CobrowseAccessibilityService {
3
- static showSetup (): Promise<void>
4
-
5
- static isRunning (): Promise<boolean>
6
- }
@@ -1,29 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-extraneous-class,accessor-pairs */
2
- import type { EmitterSubscription } from 'react-native'
3
- import Session from './Session'
4
-
5
- export type NativeSessionEvent = 'session.updated' | 'session.ended'
6
-
7
- export default class CobrowseIO {
8
- static handleSessionRequest (session?: Session): void
9
-
10
- static addListener (eventType: NativeSessionEvent, listener: (session: Session) => void): EmitterSubscription
11
-
12
- static start (): void
13
-
14
- static stop (): void
15
-
16
- static set api (api: string)
17
-
18
- static set license (license: string)
19
-
20
- static set customData (customData: Record<string, any>)
21
-
22
- static set deviceToken (token: string)
23
-
24
- static currentSession (): Promise<Session>
25
-
26
- static createSession (): Promise<Session>
27
-
28
- static getSession (codeOrId: string): Promise<Session>
29
- }
@@ -1,20 +0,0 @@
1
- import type { Component } from 'react'
2
- import type { View, Text } from 'react-native'
3
-
4
- export default class CobrowseView extends Component {
5
- componentDidMount (): Promise<void>
6
-
7
- componentWillUnmount (): void
8
-
9
- endSession (): Promise<void>
10
-
11
- renderError (): Text
12
-
13
- renderCode (): View
14
-
15
- renderManageSession (): View
16
-
17
- renderContent (): Text | View
18
-
19
- render (): View
20
- }
package/ts/Redacted.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { ReactNode, ReactElement } from 'react'
2
-
3
- type Props = Readonly<{}> &
4
- Readonly<{
5
- children?: ReactNode | undefined
6
- }>
7
-
8
- export default function (props: Props): ReactElement | null