Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
ImageLoader.propTypes = {
file: PropTypes.object.isRequired,
render: PropTypes.func.isRequired,
size: PropTypes.oneOf(['small', 'medium', 'large']),
onError: PropTypes.func,
renderFallback: PropTypes.func
}
ImageLoader.defaultProps = {
size: 'small',
onError: () => {}
}
export default withClient(ImageLoader)
) : (
)}
)
}
}
TextViewer.propTypes = {
client: PropTypes.object.isRequired,
url: PropTypes.string.isRequired,
file: FileDoctype.isRequired,
renderFallbackExtraContent: PropTypes.func
}
export default withFileUrl(withClient(TextViewer))
{({ onClick, href }) => (
)}
)
}
const AddContactButton = withClient(DumbAddContactButton)
export default AddContactButton
check: () => Promise.resolve(false),
start: resolve => resolve()
}
const isInitializedWithCozyClient = () => {
const v = localStorage.getItem('init-without-cozy-client')
return v === 'true' || v === null
}
const toggleCozyClientInitialization = () => {
const v = isInitializedWithCozyClient()
localStorage.setItem('init-without-cozy-client', v ? 'false' : 'true')
window.location.reload()
}
const Index = withClient(({ client }) => {
return (
<main>
<div>
Initialized with CozyClient:{' '}
{isInitializedWithCozyClient() ? 'yes' : 'no'}
<button>toggle</button>
<br>
You are logged in on {client.stackClient.uri} !<br>
Client options: <pre>{JSON.stringify(client.options, null, 2)}</pre>
</div>
</main>
)
})
onDismiss={() => {}}
into="body"
size="xxlarge"
>
{children}
)
}
}
FileOpener.propTypes = {
children: PropTypes.element.isRequired,
fileId: PropTypes.string.isRequired
}
export default withClient(FileOpener)
}
AppIcon.propTypes = {
alt: PropTypes.string,
/** Required if fetchIcon is not provided */
app: PropTypes.oneOfType([AppDoctype, PropTypes.string]),
/** Icon to fallback on error (optional), default cube icon */
fallbackIcon: iconPropType,
/** Custom implementation of how to fetch icon */
fetchIcon: PropTypes.func,
client: PropTypes.object.isRequired,
className: PropTypes.string,
onReady: PropTypes.func
}
export default withClient(AppIcon)
const DownloadButton = ({ t, client, file }) => (
<button> client.collection('io.cozy.files').download(file)}
label={t('Viewer.download')}
/>
)
DownloadButton.propTypes = {
t: PropTypes.func.isRequired,
client: PropTypes.object.isRequired,
file: FileDoctype
}
export default translate()(withClient(DownloadButton))
</button>
fetchIcon() {
const { client, slug, app } = this.props
return client.stackClient.getIconURL({
type: 'konnector',
slug: slug || app.slug
})
}
render() {
const { className } = this.props
return
}
}
export default withClient(KonnectorIcon)
const tosUpdated = warnings.find(w => w.code === 'tos-updated')
if (__TARGET__ === 'mobile' && tosUpdated) {
return (
)
}
return this.props.children
}
}
export default withClient(UserActionRequired)
}
ViewerControls.propTypes = {
client: PropTypes.object.isRequired,
currentFile: PropTypes.object.isRequired,
onClose: PropTypes.func.isRequired,
hasPrevious: PropTypes.bool.isRequired,
hasNext: PropTypes.bool.isRequired,
onPrevious: PropTypes.func.isRequired,
onNext: PropTypes.func.isRequired,
isMobile: PropTypes.bool.isRequired,
expanded: PropTypes.bool.isRequired,
showToolbar: PropTypes.bool.isRequired,
showNavigation: PropTypes.bool.isRequired,
isMobileApp: PropTypes.bool.isRequired
}
export default translate()(withClient(ViewerControls))