Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { compose } from 'redux'
import get from 'lodash/get'
import { translate } from 'cozy-ui/react/I18n'
import { Button } from 'cozy-ui/react/Button'
import { queryConnect } from 'cozy-client/dist'
import { models } from 'cozy-client'
let instanceModel = undefined
let hasAnOffer = undefined
let isFremiumFixed = undefined
if (models) {
instanceModel = models.instance
//TODO fallback from cozy-client
isFremiumFixed = data => {
const GB = 1000 * 1000 * 1000
const PREMIUM_QUOTA = 50 * GB
const quota = get(data, 'diskUsage.data.attributes.quota', false)
return parseInt(quota) < PREMIUM_QUOTA
}
hasAnOffer = data => {
return (
!instanceModel.isSelfHosted(data) &&
instanceModel.arePremiumLinksEnabled(data) &&
instanceModel.getUuid(data) &&
!isFremiumFixed(data)
)
}
}