cobrowse-sdk-react-native
Advanced tools
Comparing version 2.2.2 to 2.3.0
'use strict'; | ||
import { Alert } from 'react-native'; | ||
const CobrowseIONative = require('react-native').NativeModules.CobrowseIO; | ||
const NativeEventEmitter = require('react-native').NativeEventEmitter; | ||
const NativeEventEmitter = require('react-native').NativeEventEmitter; | ||
const emitter = new NativeEventEmitter(CobrowseIONative); | ||
@@ -23,3 +24,18 @@ | ||
static handleSessionRequest(session) { | ||
this.activateSession(); | ||
Alert.alert( | ||
'Support Request', | ||
'A support agent would like to use this app with you. Do you accept?', | ||
[ | ||
{ | ||
text: 'Reject', | ||
onPress: () => this.endSession(), | ||
style: 'cancel', | ||
}, | ||
{ | ||
text: 'Accept', | ||
onPress: () => this.activateSession() | ||
}, | ||
], | ||
{cancelable: true}, | ||
); | ||
} | ||
@@ -26,0 +42,0 @@ |
@@ -29,7 +29,2 @@ import React, { Component } from 'react'; | ||
}, | ||
poweredby: { | ||
color: '#444', | ||
marginTop: 40, | ||
marginBottom: 25 | ||
}, | ||
button: { | ||
@@ -79,11 +74,2 @@ color: 'rgb(0, 122, 255)', | ||
async approveSession() { | ||
try { | ||
const session = await CobrowseIO.activateSession(); | ||
this.setState({session}); | ||
} catch(error) { | ||
this.setState({error}); | ||
} | ||
} | ||
async endSession() { | ||
@@ -116,16 +102,2 @@ try { | ||
renderApproval() { | ||
return ( | ||
<View> | ||
<Text style={[styles.text]}>A support agent would like to use this app with you. If you accept, they will only be able to see screens from this app.</Text> | ||
<TouchableOpacity onPress={()=>this.approveSession()}> | ||
<Text style={[styles.text, styles.button]}>Approve</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity onPress={()=>this.endSession()}> | ||
<Text style={[styles.text, styles.button]}>Decline</Text> | ||
</TouchableOpacity> | ||
</View> | ||
) | ||
} | ||
renderManageSession() { | ||
@@ -146,6 +118,4 @@ return ( | ||
return this.renderError(); | ||
} else if ((!session) || ((session.state === 'pending') && !session.agent)) { | ||
} else if ((!session) || ((session.state === 'pending' || session.state === 'authorizing')) { | ||
return this.renderCode(); | ||
} else if ((session.state === 'pending') && this.state.session.agent) { | ||
return this.renderApproval(); | ||
} else { | ||
@@ -160,6 +130,2 @@ return this.renderManageSession(); | ||
{this.renderContent()} | ||
<TouchableOpacity | ||
onPress={()=>Linking.openURL('https://cobrowse.io/sdk-powered-by')} > | ||
<Text style={[styles.text, styles.poweredby]}>Powered by Cobrowse.io</Text> | ||
</TouchableOpacity> | ||
</View> | ||
@@ -166,0 +132,0 @@ ); |
{ | ||
"name": "cobrowse-sdk-react-native", | ||
"version": "2.2.2", | ||
"version": "2.3.0", | ||
"description": "Cobrowse SDK for React Native", | ||
@@ -5,0 +5,0 @@ "main": "./js/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 11 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95
714111
195
16