Commit a9d98428 authored by Renovate-Bot's avatar Renovate-Bot Committed by Bastien DUMONT
Browse files

chore(deps): update dependency babel-preset-cozy-app to v2

parent 01e28bc0
......@@ -8,7 +8,7 @@ module.exports = {
'plugin:react-hooks/recommended',
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
......
......@@ -2,32 +2,32 @@
"name": "ecolyo",
"version": "1.10.0",
"scripts": {
"tx": "tx pull --all || true",
"lint": "yarn lint:js",
"lint:js": "cs lint {src,test}/**/*.{js,jsx,ts,tsx} --fix",
"prebuild": "yarn lint",
"build": "yarn run build:css && yarn run build:browser",
"build:browser": "cs build --browser ",
"build:cs": "build:browser",
"build:css": "sass -c ./src/styles",
"build-dev": "yarn run build:css && yarn run build-dev:browser",
"build-dev:browser": "cs build --browser --config app.config.alpha.js",
"build-dev:mobile": "cs build --mobile --config app.config.alpha.js",
"build:browser": "cs build --browser ",
"build:mobile": "cs build --mobile",
"watch": "yarn watch:browser",
"watch:browser": "cs start --browser",
"watch:mobile": "cs watch --mobile",
"start:cs": "cs start --hot --browser --no-stack ",
"cozyPublish": "git fetch origin ${DEPLOY_BRANCH:-build}:${DEPLOY_BRANCH:-build} && cs publish --token $REGISTRY_TOKEN --build-commit $(git rev-parse ${DEPLOY_BRANCH:-build})",
"deploy": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build}",
"deploy-dev": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build-dev}",
"deploy-test": "git-directory-deploy --directory build/ --branch ${DEPLOY_BRANCH:-build-test} --repo=${DEPLOY_REPOSITORY:-https://forge.grandlyon.com/web-et-numerique/llle_project/ecolyo.git}",
"test": "cs test --verbose --coverage",
"cozyPublish": "git fetch origin ${DEPLOY_BRANCH:-build}:${DEPLOY_BRANCH:-build} && cs publish --token $REGISTRY_TOKEN --build-commit $(git rev-parse ${DEPLOY_BRANCH:-build})",
"build:css": "sass -c ./src/styles",
"start": "npm-run-all -p start:cs",
"build": "yarn run build:css && yarn run build:browser",
"build-dev": "yarn run build:css && yarn run build-dev:browser",
"release": "standard-version --no-verify",
"lint": "yarn lint:js",
"lint:js": "cs lint {src,test}/**/*.{js,jsx,ts,tsx} --fix",
"load-data": "cd test && importData.bat",
"prebuild": "yarn lint",
"prepare": "husky install",
"release": "standard-version --no-verify",
"start": "npm-run-all -p start:cs",
"start:cs": "cs start --hot --browser --no-stack ",
"start-stack": "cs start --hot --browser --stack",
"prepare": "husky install"
"test": "cs test --verbose --coverage",
"tx": "tx pull --all || true",
"watch": "yarn watch:browser",
"watch:browser": "cs start --browser",
"watch:mobile": "cs watch --mobile"
},
"repository": {
"type": "git",
......@@ -99,7 +99,7 @@
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"babel-polyfill": "^6.26.0",
"babel-preset-cozy-app": "1.12.0",
"babel-preset-cozy-app": "2.0.2",
"copy-webpack-plugin": "6.4.1",
"cozy-app-publish": "^0.30.0",
"cozy-jobs-cli": "^1.13.6",
......
......@@ -134,15 +134,14 @@ async function launch() {
// Enedis
await axios({
method: 'put',
url:
'http://cozy.tools:8080/data/io.cozy.accounts/88e68b8450cee09fe2f077610901094d',
url: 'http://cozy.tools:8080/data/io.cozy.accounts/88e68b8450cee09fe2f077610901094d',
headers: headers,
data: dataEnedisAccount,
})
.then(function(response) {
.then(function (response) {
console.log(JSON.stringify(response.data))
})
.catch(function(error) {
.catch(function (error) {
console.log(error)
})
......@@ -152,25 +151,24 @@ async function launch() {
headers: headers,
data: dataEnedisTrigger,
})
.then(function(response) {
.then(function (response) {
console.log(JSON.stringify(response.data))
})
.catch(function(error) {
.catch(function (error) {
console.log(error)
})
// GRDF
await axios({
method: 'put',
url:
'http://cozy.tools:8080/data/io.cozy.accounts/89e68b8450cee09fe2f077610901094d',
url: 'http://cozy.tools:8080/data/io.cozy.accounts/89e68b8450cee09fe2f077610901094d',
headers: headers,
data: dataGrdfAccount,
})
.then(function(response) {
.then(function (response) {
console.log(JSON.stringify(response.data))
})
.catch(function(error) {
.catch(function (error) {
console.log(error)
})
......@@ -180,25 +178,24 @@ async function launch() {
headers: headers,
data: dataGrdfTrigger,
})
.then(function(response) {
.then(function (response) {
console.log(JSON.stringify(response.data))
})
.catch(function(error) {
.catch(function (error) {
console.log(error)
})
// EGL
await axios({
method: 'put',
url:
'http://cozy.tools:8080/data/io.cozy.accounts/90e68b8450cee09fe2f077610901094d',
url: 'http://cozy.tools:8080/data/io.cozy.accounts/90e68b8450cee09fe2f077610901094d',
headers: headers,
data: dataEglAccount,
})
.then(function(response) {
.then(function (response) {
console.log(JSON.stringify(response.data))
})
.catch(function(error) {
.catch(function (error) {
console.log(error)
})
......@@ -208,10 +205,10 @@ async function launch() {
headers: headers,
data: dataEglTrigger,
})
.then(function(response) {
.then(function (response) {
console.log(JSON.stringify(response.data))
})
.catch(function(error) {
.catch(function (error) {
console.log(error)
})
}
......
......@@ -55,7 +55,7 @@ const AnalysisConsumption: React.FC<AnalysisConsumptionProps> = ({
const emptyFluidTypes: FluidType[] = []
for (let i = 0; i < performanceIndicators.length; i++) {
if (performanceIndicators[i] && !performanceIndicators[i].value) {
if (!performanceIndicators[i]?.value) {
emptyFluidTypes.push(fluidTypes[i])
}
}
......@@ -212,8 +212,7 @@ const AnalysisConsumption: React.FC<AnalysisConsumptionProps> = ({
</div>
{fluidTypes.map(
(fluid, index) =>
performanceIndicators[fluid] &&
performanceIndicators[fluid].value && (
performanceIndicators[fluid]?.value && (
<AnalysisConsumptionRow
key={index}
fluid={fluid}
......
......@@ -96,7 +96,7 @@ const ElecHalfHourMonthlyAnalysis: React.FC<
aggegatedDate.year,
aggegatedDate.month
)
if (subscribed && data && data.length) {
if (subscribed && data?.length) {
const aggregatedData = emas.aggregateValuesToDataLoad(data[0])
setenedisAnalysisValues(data[0])
setMonthDataloads(aggregatedData)
......@@ -220,7 +220,7 @@ const ElecHalfHourMonthlyAnalysis: React.FC<
<span className="text-18-normal"> %</span>
</div>
<div className="text-18-bold">
{elecPrice && elecPrice.price
{elecPrice?.price
? (
enedisAnalysisValues.minimumLoad *
elecPrice.price
......
......@@ -76,10 +76,7 @@ const MonthlyAnalysis: React.FC<MonthlyAnalysisProps> = ({
setPerformanceIndicators(fetchedPerformanceIndicators)
setLoadAnalysis(false)
for (let i = 0; i < fetchedPerformanceIndicators.length; i++) {
if (
fetchedPerformanceIndicators[i] &&
fetchedPerformanceIndicators[i].value
) {
if (fetchedPerformanceIndicators[i]?.value) {
setLoadAnalysis(true)
}
}
......
......@@ -50,7 +50,7 @@ const TotalAnalysisChart: React.FC<TotalAnalysisChartProps> = ({
undefined,
true
)
if (monthTotalData && monthTotalData.actualData) {
if (monthTotalData?.actualData) {
setDataLoadValueDetailArray(monthTotalData.actualData[0].valueDetail)
setTotalLoadValue(monthTotalData.actualData[0].value)
}
......
......@@ -30,9 +30,9 @@ const UncomingBar = ({
const barClass = animationEnded
? `bar-UNCOMING `
: `bar-UNCOMING bounce-${
browser && browser.name !== 'edge' ? '1' : '3'
} delay--${index % 13}`
: `bar-UNCOMING bounce-${browser?.name !== 'edge' ? '1' : '3'} delay--${
index % 13
}`
const getBandWidth = (): number => {
return xScale.bandwidth()
......
......@@ -62,7 +62,7 @@ const GenerateContentCard = (
spacing={8}
direction="column"
alignItems="center"
justify="center"
justifyContent="center"
>
<Grid item>
<StyledIcon icon={icon} size={64} />
......@@ -100,7 +100,12 @@ const StyledIconCard: React.ComponentType<StyledIconCardProps> = ({
return (
<CardBase {...props}>
<CardContentBase>
<Grid container spacing={8} alignItems="center" justify="center">
<Grid
container
spacing={8}
alignItems="center"
justifyContent="center"
>
<Grid item>{props.children}</Grid>
</Grid>
</CardContentBase>
......
......@@ -117,10 +117,7 @@ const ConnectionResult: React.FC<ConnectionResultProps> = ({
}, [deleteAccountsAndTriggers, dispatch])
useEffect(() => {
if (
fluidStatus.connection.triggerState &&
fluidStatus.connection.triggerState.last_success
) {
if (fluidStatus.connection.triggerState?.last_success) {
const result = DateTime.fromISO(
fluidStatus.connection.triggerState.last_success
)
......@@ -129,9 +126,8 @@ const ConnectionResult: React.FC<ConnectionResultProps> = ({
setLastExecutionDate('-')
}
if (
fluidStatus.connection.triggerState &&
fluidStatus.connection.triggerState.status === 'errored' &&
fluidStatus.connection.triggerState.last_error
fluidStatus.connection.triggerState?.status === 'errored' &&
fluidStatus.connection.triggerState?.last_error
) {
setStatus('errored')
setKonnectorError(
......@@ -216,9 +212,7 @@ const ConnectionResult: React.FC<ConnectionResultProps> = ({
{lastExecutionDate.toLocaleString()}
</div>
<div>
{fluidStatus &&
fluidStatus.connection &&
fluidStatus.connection.konnector &&
{fluidStatus?.connection?.konnector &&
t('konnector_form.issue') +
' ' +
fluidStatus.connection.konnector.name +
......
......@@ -150,7 +150,7 @@ const FormLogin: React.FC<FormLoginProps> = ({
}
useEffect(() => {
if (account && account.auth) {
if (account?.auth) {
const auth = account.auth
const authData = auth
if (authData.login) {
......
......@@ -45,7 +45,7 @@ const FormOAuth: React.FC<FormOAuthProps> = ({
const startOAuth = useCallback(async () => {
// If first connexion, send the usage event
if (konnector && konnector.slug && fluidStatus.lastDataDate === null) {
if (konnector?.slug && fluidStatus.lastDataDate === null) {
await UsageEventService.addEvent(client, {
type: UsageEventType.KONNECTOR_ATTEMPT_EVENT,
target: konnector.slug,
......
......@@ -79,16 +79,14 @@ const EstimatedConsumptionModal: React.FC<EstimatedConsumptionModalProps> = ({
{t(`FLUID.${FluidType[FluidType.ELECTRICITY]}.LABEL`)}
</span>
{t('consumption_visualizer.modal.list1', {
elecPrice:
prices[FluidType.ELECTRICITY] &&
prices[FluidType.ELECTRICITY].price,
elecPriceStartDate:
prices[FluidType.ELECTRICITY] &&
DateTime.fromISO(prices[FluidType.ELECTRICITY].startDate)
.setZone('utc', {
keepLocalTime: true,
})
.toLocaleString(),
elecPrice: prices[FluidType.ELECTRICITY]?.price,
elecPriceStartDate: DateTime.fromISO(
prices[FluidType.ELECTRICITY]?.startDate
)
.setZone('utc', {
keepLocalTime: true,
})
.toLocaleString(),
})}
</li>
<li>
......@@ -96,15 +94,14 @@ const EstimatedConsumptionModal: React.FC<EstimatedConsumptionModalProps> = ({
{t(`FLUID.${FluidType[FluidType.WATER]}.LABEL`)}
</span>
{t('consumption_visualizer.modal.list3', {
waterPrice:
prices[FluidType.WATER] && prices[FluidType.WATER].price,
waterPriceStartDate:
prices[FluidType.WATER] &&
DateTime.fromISO(prices[FluidType.WATER].startDate)
.setZone('utc', {
keepLocalTime: true,
})
.toLocaleString(),
waterPrice: prices[FluidType.WATER]?.price,
waterPriceStartDate: DateTime.fromISO(
prices[FluidType.WATER]?.startDate
)
.setZone('utc', {
keepLocalTime: true,
})
.toLocaleString(),
})}
</li>
<li>
......@@ -112,14 +109,14 @@ const EstimatedConsumptionModal: React.FC<EstimatedConsumptionModalProps> = ({
{t(`FLUID.${FluidType[FluidType.GAS]}.LABEL`)}
</span>
{t('consumption_visualizer.modal.list2', {
gasPrice: prices[FluidType.GAS] && prices[FluidType.GAS].price,
gasPriceStartDate:
prices[FluidType.GAS] &&
DateTime.fromISO(prices[FluidType.GAS].startDate)
.setZone('utc', {
keepLocalTime: true,
})
.toLocaleString(),
gasPrice: prices[FluidType.GAS]?.price,
gasPriceStartDate: DateTime.fromISO(
prices[FluidType.GAS]?.startDate
)
.setZone('utc', {
keepLocalTime: true,
})
.toLocaleString(),
})}
</li>
</ul>
......
......@@ -39,7 +39,7 @@ const Content: React.FC<ContentProps> = ({
* Handle Desktop scroll
*/
const handleWindowScroll = useCallback(() => {
app && app.scrollTo(0, 0)
app?.scrollTo(0, 0)
window.scrollTo(0, 0)
}, [app])
......
......@@ -53,10 +53,7 @@ const EcogestureModal: React.FC<EcogestureModalProps> = ({
} else {
setEcogestureIcon(defaultIcon)
}
if (
currentChallenge &&
currentChallenge.exploration.ecogesture_id === ecogesture._id
) {
if (currentChallenge?.exploration.ecogesture_id === ecogesture._id) {
setValidExploration(currentChallenge.exploration.id)
}
}
......
......@@ -44,8 +44,7 @@ const SingleEcogesture: React.FC<SingleEcogestureProps> = ({
const [isObjective, setIsObjective] = useState<boolean>(false)
const [isLoading, setIsLoading] = useState<boolean>(true)
const ecogestureID: string = match.params.id
const selectionCompleted =
location && location.state && location.state.selectionCompleted
const selectionCompleted = location?.state?.selectionCompleted
const ecogestureService = useMemo(
() => new EcogestureService(client),
......@@ -60,7 +59,7 @@ const SingleEcogesture: React.FC<SingleEcogestureProps> = ({
}
const [, setValidExploration] = useExploration()
const toggleMoreDetail = () => {
setIsMoreDetail((prev) => !prev)
setIsMoreDetail(prev => !prev)
}
const toggleObjective = useCallback(async () => {
if (ecogesture) {
......@@ -69,7 +68,7 @@ const SingleEcogesture: React.FC<SingleEcogestureProps> = ({
toUpdate
)
if (updatedEcogesture) {
setIsObjective((prev) => !prev)
setIsObjective(prev => !prev)
setEcogesture(updatedEcogesture)
}
}
......@@ -82,7 +81,7 @@ const SingleEcogesture: React.FC<SingleEcogestureProps> = ({
toUpdate
)
if (updatedEcogesture) {
setIsDoing((prev) => !prev)
setIsDoing(prev => !prev)
setEcogesture(updatedEcogesture)
}
}
......
......@@ -89,7 +89,7 @@ const FluidChartSlide: React.FC<FluidChartSlideProps> = ({
compareTimePeriod,
fluidType === FluidType.MULTIFLUID
)
if (subscribed && graphData && graphData.actualData.length > 0) {
if (subscribed && graphData && graphData?.actualData.length > 0) {
setChartData(graphData)
setIsDataLoaded(true)
dispatch(setLoading(false))
......
......@@ -110,8 +110,7 @@ const ConsumptionView: React.FC<ConsumptionViewProps> = ({
const expiredConsents = []
for (const fluid of fluidStatus) {
if (
fluid.connection.triggerState &&
fluid.connection.triggerState.last_error &&
fluid.connection.triggerState?.last_error &&
getKonnectorUpdateError(fluid.connection.triggerState.last_error) ===
'error_update_oauth'
) {
......
......@@ -74,8 +74,7 @@ const FluidButton: React.FC<FluidButtonProps> = ({
const serviceIsDown = () => {
return (
fluidType !== FluidType.MULTIFLUID &&
fluidStatus[fluidType] &&
fluidStatus[fluidType].status === FluidState.PARTNER_ISSUE
fluidStatus[fluidType]?.status === FluidState.PARTNER_ISSUE
)
}
......@@ -84,9 +83,7 @@ const FluidButton: React.FC<FluidButtonProps> = ({
if (
(fluidType !== FluidType.MULTIFLUID && isConnected() && isErrored()) ||
(fluidType !== FluidType.MULTIFLUID && isConnected() && isOutdated()) ||
(isConnected() &&
fluidStatus[fluidType] &&
!fluidStatus[fluidType].lastDataDate)
(isConnected() && !fluidStatus[fluidType]?.lastDataDate)
) {
setShowError(true)
}
......
......@@ -26,10 +26,9 @@ const useExploration = (): [string, Dispatch<SetStateAction<string>>] => {
useEffect(() => {
let subscribed = true
if (
currentChallenge &&
explorationID &&
currentChallenge.exploration.id === explorationID &&
currentChallenge.exploration.state === UserExplorationState.ONGOING
currentChallenge?.exploration.id === explorationID &&
currentChallenge?.exploration.state === UserExplorationState.ONGOING
) {
const checkExplo = async () => {
const explorationService = new ExplorationService(client)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment