cobrowse-sdk-react-native 2.8.0 → 2.10.1
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.
- package/README.md +8 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/cobrowse/reactnative/CobrowseIOModule.java +9 -1
- package/cobrowse-sdk-react-native.podspec +1 -1
- package/ios/RCTCobrowseIO.m +5 -0
- package/js/CobrowseIO.js +39 -8
- package/js/index.js +1 -0
- package/package.json +8 -8
- package/ts/CobrowseIO.d.ts +0 -3
- package/ts/index.d.ts +1 -0
- package/CHANGELOG.md +0 -37
package/README.md
CHANGED
|
@@ -53,3 +53,11 @@ Any questions at all? Please email us directly at [hello@cobrowse.io](mailto:hel
|
|
|
53
53
|
|
|
54
54
|
* iOS 9.0 or later
|
|
55
55
|
* Android API version 19 (4.4 KitKat) or later
|
|
56
|
+
|
|
57
|
+
## Deployment
|
|
58
|
+
|
|
59
|
+
This SDK is only available via NPM. To deploy a new version:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
npm publish
|
|
63
|
+
```
|
package/android/build.gradle
CHANGED
|
@@ -22,7 +22,9 @@ import io.cobrowse.CobrowseIO;
|
|
|
22
22
|
import io.cobrowse.Session;
|
|
23
23
|
import io.cobrowse.CobrowseAccessibilityService;
|
|
24
24
|
|
|
25
|
-
public class CobrowseIOModule extends ReactContextBaseJavaModule
|
|
25
|
+
public class CobrowseIOModule extends ReactContextBaseJavaModule
|
|
26
|
+
implements CobrowseIO.Delegate, CobrowseIO.SessionRequestDelegate,
|
|
27
|
+
CobrowseIO.RedactionDelegate, CobrowseIO.RemoteControlRequestDelegate {
|
|
26
28
|
|
|
27
29
|
private static final String SESSION_UPDATED = "session.updated";
|
|
28
30
|
private static final String SESSION_ENDED = "session.ended";
|
|
@@ -59,6 +61,12 @@ public class CobrowseIOModule extends ReactContextBaseJavaModule implements Cobr
|
|
|
59
61
|
.emit(SESSION_REQUESTED, Utility.convert(session));
|
|
60
62
|
}
|
|
61
63
|
|
|
64
|
+
@Override
|
|
65
|
+
public void handleRemoteControlRequest(@NonNull Activity activity, @NonNull Session session) {
|
|
66
|
+
// no-op, this will be handed on the JS side via an "updated" event handler
|
|
67
|
+
// this stub just disables the default native prompt in the SDK
|
|
68
|
+
}
|
|
69
|
+
|
|
62
70
|
@Override
|
|
63
71
|
public List<View> redactedViews(@NonNull final Activity activity) {
|
|
64
72
|
return new ArrayList<>(RedactedViewManager.redactedViews.keySet());
|
|
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.source = { :git => 'https://github.com/cobrowseio/cobrowse-sdk-react-native.git' }
|
|
13
13
|
s.platform = :ios, '9.0'
|
|
14
14
|
|
|
15
|
-
s.dependency 'CobrowseIO/Framework', '2.16.
|
|
15
|
+
s.dependency 'CobrowseIO/Framework', '2.16.4'
|
|
16
16
|
s.dependency 'React'
|
|
17
17
|
s.source_files = 'ios/*.{h,m}'
|
|
18
18
|
end
|
package/ios/RCTCobrowseIO.m
CHANGED
|
@@ -59,6 +59,11 @@ RCT_EXPORT_MODULE();
|
|
|
59
59
|
if (hasListeners) [self sendEventWithName:@SESSION_REQUESTED body:[session toDict]];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
- (void)cobrowseHandleRemoteControlRequest:(CBIOSession *)session {
|
|
63
|
+
// no-op, this will be handed on the JS side via an "updated" event handler
|
|
64
|
+
// this stub just disables the default native prompt in the SDK
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
-(NSArray<UIView *> *)cobrowseRedactedViewsForViewController:(UIViewController *)vc {
|
|
63
68
|
NSMutableArray* views = [NSMutableArray array];
|
|
64
69
|
for (UIView* v in CBIOCobrowseRedactedManager.redactedViews.allObjects) {
|
package/js/CobrowseIO.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Alert } from 'react-native'
|
|
2
2
|
import Session from './Session'
|
|
3
|
-
import CobrowseAccessibilityService from './CobrowseAccessibilityService'
|
|
4
3
|
const CobrowseIONative = require('react-native').NativeModules.CobrowseIO
|
|
5
4
|
const NativeEventEmitter = require('react-native').NativeEventEmitter
|
|
6
5
|
|
|
@@ -17,22 +16,48 @@ export default class CobrowseIO {
|
|
|
17
16
|
return 'session.ended'
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
static get accessibilityService () {
|
|
21
|
-
return CobrowseAccessibilityService
|
|
22
|
-
}
|
|
23
|
-
|
|
24
19
|
static handleSessionRequest (session) {
|
|
20
|
+
if (this._sessionRequestShown) return
|
|
21
|
+
this._sessionRequestShown = true
|
|
25
22
|
Alert.alert(
|
|
26
23
|
'Support Request',
|
|
27
24
|
'A support agent would like to use this app with you. Do you accept?',
|
|
28
25
|
[{
|
|
29
26
|
text: 'Reject',
|
|
30
|
-
onPress: () =>
|
|
27
|
+
onPress: () => {
|
|
28
|
+
this._sessionRequestShown = false
|
|
29
|
+
session.end()
|
|
30
|
+
},
|
|
31
31
|
style: 'cancel'
|
|
32
32
|
}, {
|
|
33
33
|
text: 'Accept',
|
|
34
|
-
onPress: () =>
|
|
35
|
-
|
|
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 })
|
|
36
61
|
}
|
|
37
62
|
|
|
38
63
|
static addListener (event, cb) {
|
|
@@ -91,3 +116,9 @@ export default class CobrowseIO {
|
|
|
91
116
|
CobrowseIO.addListener('session.requested', (session) => {
|
|
92
117
|
CobrowseIO.handleSessionRequest(session)
|
|
93
118
|
})
|
|
119
|
+
|
|
120
|
+
CobrowseIO.addListener('session.updated', (session) => {
|
|
121
|
+
if (session.isActive() && session.remote_control === 'requested') {
|
|
122
|
+
CobrowseIO.handleRemoteControlRequest(session)
|
|
123
|
+
}
|
|
124
|
+
})
|
package/js/index.js
CHANGED
|
@@ -2,3 +2,4 @@ export { default } from './CobrowseIO'
|
|
|
2
2
|
export { default as CobrowseView } from './CobrowseView'
|
|
3
3
|
export { default as Redacted } from './Redacted'
|
|
4
4
|
export { default as SessionControl } from './SessionControl'
|
|
5
|
+
export { default as CobrowseAccessibilityService } from './CobrowseAccessibilityService'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cobrowse-sdk-react-native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"description": "Cobrowse SDK for React Native",
|
|
5
5
|
"main": "js/index.js",
|
|
6
6
|
"types": "ts/index.d.ts",
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@types/react": "^17.0.
|
|
32
|
-
"@types/react-native": "^0.
|
|
31
|
+
"@types/react": "^17.0.38",
|
|
32
|
+
"@types/react-native": "^0.66.15"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/react": "^17.0.
|
|
37
|
-
"@types/react-native": "^0.
|
|
38
|
-
"managed-service-daemon": "^1.2.
|
|
36
|
+
"@types/react": "^17.0.38",
|
|
37
|
+
"@types/react-native": "^0.66.15",
|
|
38
|
+
"managed-service-daemon": "^1.2.1",
|
|
39
39
|
"nodemon": "^2.0.15",
|
|
40
|
-
"ts-standard": "^
|
|
41
|
-
"typescript": "^4.
|
|
40
|
+
"ts-standard": "^11.0.0",
|
|
41
|
+
"typescript": "^4.5.5",
|
|
42
42
|
"watchr": "^6.11.0"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/ts/CobrowseIO.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-extraneous-class,accessor-pairs */
|
|
2
2
|
import type { EmitterSubscription } from 'react-native'
|
|
3
3
|
import Session from './Session'
|
|
4
|
-
import CobrowseAccessibilityService from './CobrowseAccessibilityService'
|
|
5
4
|
|
|
6
5
|
export type NativeSessionEvent = 'session.updated' | 'session.ended'
|
|
7
6
|
|
|
8
7
|
export default class CobrowseIO {
|
|
9
|
-
static get accessibilityService (): CobrowseAccessibilityService
|
|
10
|
-
|
|
11
8
|
static handleSessionRequest (session?: Session): void
|
|
12
9
|
|
|
13
10
|
static addListener (eventType: NativeSessionEvent, listener: (session: Session) => void): EmitterSubscription
|
package/ts/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export { default } from './CobrowseIO'
|
|
|
2
2
|
export { default as CobrowseView } from './CobrowseView'
|
|
3
3
|
export { default as Redacted } from './Redacted'
|
|
4
4
|
export { default as SessionControl } from './SessionControl'
|
|
5
|
+
export { default as CobrowseAccessibilityService } from './CobrowseAccessibilityService'
|
package/CHANGELOG.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
-
|
|
5
|
-
## [2.8.0](https://github.com/cobrowseio/cobrowse-sdk-react-native/compare/v2.6.0...v2.8.0) (2021-11-17)
|
|
6
|
-
|
|
7
|
-
### Features
|
|
8
|
-
|
|
9
|
-
* Added APIs to control full device and remote control state, e.g. `session.setFullDevice(true)`
|
|
10
|
-
* Added TypeScript definitions
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## [2.6.0](https://github.com/cobrowseio/cobrowse-sdk-react-native/compare/v2.5.2...v2.6.0) (2021-06-14)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
### Features
|
|
17
|
-
|
|
18
|
-
* allow styling of redacted component ([614b64e](https://github.com/cobrowseio/cobrowse-sdk-react-native/commit/614b64e56a127aec693077f336935c628b609117))
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Bug Fixes
|
|
22
|
-
|
|
23
|
-
* fix for Undefined symbols error (_OBJC_CLASS_$_RCTEventDispatcher) ([d66ef6d](https://github.com/cobrowseio/cobrowse-sdk-react-native/commit/d66ef6d6767b567db524865e002867718ca6301a))
|
|
24
|
-
|
|
25
|
-
## [2.1.0] - 2019-04-26
|
|
26
|
-
|
|
27
|
-
### Features
|
|
28
|
-
|
|
29
|
-
- Added `handleSessionRequest` API to `CobrowseIO`
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
## [2.0.0] - 2019-04-24
|
|
33
|
-
|
|
34
|
-
### Features
|
|
35
|
-
- Switched to promises for all methods that previously took callback (e.g. `createSession`, `endSession`, `currentSession`)
|
|
36
|
-
- Updated example project to RN 0.59
|
|
37
|
-
- Renamed `loadSession` to `getSession` to match other SDKs
|