cobrowse-sdk-react-native
Advanced tools
Comparing version 2.13.0 to 2.14.0
@@ -1,2 +0,2 @@ | ||
import { Alert } from 'react-native' | ||
import { Platform, Alert } from 'react-native' | ||
import Session from './Session' | ||
@@ -117,2 +117,10 @@ const CobrowseIONative = require('react-native').NativeModules.CobrowseIO | ||
CobrowseIO.addListener('session.requested', (session) => { | ||
if (CobrowseIO.showSessionControls === false) { | ||
CobrowseIONative.overwriteSessionIndicator() | ||
} | ||
if (Platform.OS === 'ios' && CobrowseIO.handleFullDeviceRequest) { | ||
CobrowseIONative.overwriteFullControlUI() | ||
} | ||
CobrowseIO.handleSessionRequest(session) | ||
@@ -124,3 +132,12 @@ }) | ||
CobrowseIO.handleRemoteControlRequest(session) | ||
} | ||
if (session.isActive() && session.full_device_state === 'requested') { | ||
if (CobrowseIO.handleFullDeviceRequest) { | ||
CobrowseIO.handleFullDeviceRequest(session) | ||
} else if (Platform.OS === 'android') { | ||
// accept the incoming connection by default | ||
session.setFullDevice('on') | ||
} | ||
} | ||
}) |
@@ -63,2 +63,3 @@ import React, { Component } from 'react' | ||
if (this.props.onEnded) this.props.onEnded() | ||
this.setState({ session: null }) | ||
}) | ||
@@ -65,0 +66,0 @@ } |
@@ -7,1 +7,3 @@ export { default } from './CobrowseIO' | ||
export { default as CobrowseAccessibilityService } from './CobrowseAccessibilityService' | ||
export { default as CBIOBroadcastPickerView } from './CBIOBroadcastPickerView' | ||
export { useSession } from './useSession' |
@@ -64,2 +64,6 @@ const CobrowseIONative = require('react-native').NativeModules.CobrowseIO | ||
get full_device_state () { | ||
return this._session.full_device_state | ||
} | ||
get remote_control () { | ||
@@ -66,0 +70,0 @@ return this._session.remote_control |
@@ -72,4 +72,4 @@ import React, { useRef, useEffect, useCallback, useMemo } from 'react' | ||
// HOC for adding unredaction to a whole component class | ||
export function unredact(Component) { | ||
return React.forwardRef(function Redacted(props, ref) { | ||
export function unredact (Component) { | ||
return React.forwardRef(function Redacted (props, ref) { | ||
const localRef = useUnredaction(true, Component?.name) | ||
@@ -76,0 +76,0 @@ const refs = useMemo(() => mergeRefs([localRef, ref]), [localRef, ref]) |
{ | ||
"name": "cobrowse-sdk-react-native", | ||
"version": "2.13.0", | ||
"version": "2.14.0", | ||
"description": "Cobrowse SDK for React Native", | ||
@@ -8,3 +8,4 @@ "main": "js/index.js", | ||
"scripts": { | ||
"lint-fix": "ts-standard ts/*.d.ts --fix", | ||
"lint": "ts-standard ts/*.d.ts", | ||
"lint:fix": "ts-standard ts/*.d.ts --fix", | ||
"start:dev": "nodemon --exec ./scripts/copy.sh" | ||
@@ -31,4 +32,4 @@ }, | ||
"optionalDependencies": { | ||
"@types/react": "^18.0.18", | ||
"@types/react-native": "^0.69.6" | ||
"@types/react": "^18.0.24", | ||
"@types/react-native": "^0.70.6" | ||
}, | ||
@@ -39,8 +40,8 @@ "dependencies": { | ||
"devDependencies": { | ||
"@types/react": "^18.0.18", | ||
"@types/react-native": "^0.69.6", | ||
"nodemon": "^2.0.19", | ||
"ts-standard": "^11.0.0", | ||
"typescript": "^4.8.2" | ||
"@types/react": "^18.0.24", | ||
"@types/react-native": "^0.70.6", | ||
"nodemon": "^2.0.20", | ||
"ts-standard": "^12.0.1", | ||
"typescript": "^4.8.4" | ||
} | ||
} |
# Cobrowse.io - React Native SDK | ||
Cobrowse.io is 100% free and easy to try out in your own apps. Please see full documentation at [https://docs.cobrowse.io](https://docs.cobrowse.io). | ||
Cobrowse.io is 100% free and easy to try out in your own apps. | ||
Try our **online demo** at the bottom of our homepage at <https://cobrowse.io/#tryit>. | ||
Register an account at [https://cobrowse.io/register](https://cobrowse.io/register). | ||
## Installation | ||
Please see **full documentation** at [https://docs.cobrowse.io](https://docs.cobrowse.io). | ||
```bash | ||
npm install --save cobrowse-sdk-react-native | ||
react-native link | ||
``` | ||
**Note:** For iOS you need to be using Pods to manage dependencies for `react-native link` to work out of the box (and also remember to run `pod install` after the link step). | ||
Try our **online demo** at <https://cobrowse.io/demo>. | ||
### Add your License Key | ||
## Installation | ||
Please register an account and generate your free License Key at <https://cobrowse.io/dashboard/settings>. | ||
See the [installation documentation](https://docs.cobrowse.io/sdk-installation/react-native) to get started. | ||
This will associate sessions from your mobile app with your Cobrowse account. | ||
```javascript | ||
import CobrowseIO from 'cobrowse-sdk-react-native'; | ||
CobrowseIO.license = "put your license key here"; | ||
CobrowseIO.start(); | ||
``` | ||
## Try it out | ||
@@ -51,14 +37,1 @@ | ||
Any questions at all? Please email us directly at [hello@cobrowse.io](mailto:hello@cobrowse.io). | ||
## Requirements | ||
* iOS 9.0 or later | ||
* Android API version 19 (4.4 KitKat) or later | ||
## Deployment | ||
This SDK is only available via NPM. To deploy a new version: | ||
``` | ||
npm publish | ||
``` |
@@ -7,1 +7,2 @@ export { default } from './CobrowseIO' | ||
export { default as CobrowseAccessibilityService } from './CobrowseAccessibilityService' | ||
export { useSession } from './useSession' |
import type { ReactNode, ReactElement } from 'react' | ||
type Props = Readonly<{}> & | ||
Readonly<{ | ||
children?: ReactNode | undefined | ||
}> | ||
Readonly<{ | ||
children?: ReactNode | undefined | ||
}> | ||
export default function (props: Props): ReactElement | null |
@@ -10,2 +10,4 @@ /* eslint-disable @typescript-eslint/no-extraneous-class,accessor-pairs */ | ||
export type FullDeviceState = 'on' | 'requested' | 'rejected' | 'off' | ||
export interface Agent { | ||
@@ -54,5 +56,5 @@ id: string | ||
setFullDevice (state: boolean): Promise<void> | ||
setFullDevice (state: boolean | FullDeviceState): Promise<void> | ||
setRemoteControl (state: RemoteControlState): Promise<void> | ||
} |
@@ -6,3 +6,3 @@ import React, { ReactElement, ForwardRefRenderFunction } from 'react' | ||
T = View | ScrollView | Text | Image | FlatList | SectionList | ||
>(shouldWarnUnhandledRefs?: boolean , componentName?: string): (elem: T) => void | ||
> (shouldWarnUnhandledRefs?: boolean, componentName?: string): (elem: T) => void | ||
@@ -12,3 +12,3 @@ type ForwardedRefType<T, P> = typeof React.forwardRef | ||
// HOC for adding unredaction to a whole component class | ||
export function unredact(Component: ReactElement): ForwardedRefType<View, Record<string, unknown>> | ||
export function unredact (Component: ReactElement): ForwardedRefType<View, Record<string, unknown>> | ||
@@ -15,0 +15,0 @@ // also expose a basic Component based on a View |
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
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
104372
58
578
37