From e57f9a9bb902c32bc2f71dda7da145ab51498013 Mon Sep 17 00:00:00 2001 From: build-pipeline <build-token> Date: Wed, 13 Jul 2022 08:13:36 +0000 Subject: [PATCH] publish: Merge branch 'renovate/babel-preset-cozy-app-2.x' into 'dev' generated from commit a8ad9d8d02963764da81730f652bda1f25337b37 --- ...1c62.js => ecolyo.b07c59bd0b636d97155c.js} | 25 ++-- ...1c01.js => ecolyo.ee2b5da7120569e2bb4c.js} | 32 +++-- ...48ec.js => ecolyo.cf316224f80d91ba8e19.js} | 14 +- ...c29f.js => ecolyo.a8e9eb8ff3391bee0df8.js} | 4 +- ...965e.js => ecolyo.d158f1730b2950fd83cb.js} | 133 ++++++++++-------- index.html | 2 +- services/aggregatorUsageEvents/ecolyo.js | 86 ++++++----- services/consumptionAlert/ecolyo.js | 28 ++-- .../enedisHalfHourMonthlyAnalysis/ecolyo.js | 34 +++-- services/fluidsPrices/ecolyo.js | 32 +++-- services/monthlyReportNotification/ecolyo.js | 32 +++-- ...790a.js => ecolyo.3ddba75f57f0da86cb09.js} | 7 +- 12 files changed, 260 insertions(+), 169 deletions(-) rename 2/{ecolyo.c149122cc628d8281c62.js => ecolyo.b07c59bd0b636d97155c.js} (98%) rename 3/{ecolyo.36b8ec7c4464086d1c01.js => ecolyo.ee2b5da7120569e2bb4c.js} (99%) rename 6/{ecolyo.5ea36954335bad0648ec.js => ecolyo.cf316224f80d91ba8e19.js} (94%) rename 9/{ecolyo.11294a210c09d427c29f.js => ecolyo.a8e9eb8ff3391bee0df8.js} (99%) rename app/{ecolyo.bae8d4905665ff92965e.js => ecolyo.d158f1730b2950fd83cb.js} (99%) rename vendors/{ecolyo.08cea87f518c2cc2790a.js => ecolyo.3ddba75f57f0da86cb09.js} (99%) diff --git a/2/ecolyo.c149122cc628d8281c62.js b/2/ecolyo.b07c59bd0b636d97155c.js similarity index 98% rename from 2/ecolyo.c149122cc628d8281c62.js rename to 2/ecolyo.b07c59bd0b636d97155c.js index 3cb6f18d2..354473886 100644 --- a/2/ecolyo.c149122cc628d8281c62.js +++ b/2/ecolyo.b07c59bd0b636d97155c.js @@ -180,7 +180,9 @@ var AnalysisConsumption = function AnalysisConsumption(_ref) { var emptyFluidTypes = []; for (var i = 0; i < performanceIndicators.length; i++) { - if (performanceIndicators[i] && !performanceIndicators[i].value) { + var _performanceIndicator; + + if (!((_performanceIndicator = performanceIndicators[i]) !== null && _performanceIndicator !== void 0 && _performanceIndicator.value)) { emptyFluidTypes.push(fluidTypes[i]); } } @@ -343,7 +345,9 @@ var AnalysisConsumption = function AnalysisConsumption(_ref) { connected: false, noData: false })), fluidTypes.map(function (fluid, index) { - return performanceIndicators[fluid] && performanceIndicators[fluid].value && /*#__PURE__*/_react.default.createElement(_AnalysisConsumptionRow.default, { + var _performanceIndicator2; + + return ((_performanceIndicator2 = performanceIndicators[fluid]) === null || _performanceIndicator2 === void 0 ? void 0 : _performanceIndicator2.value) && /*#__PURE__*/_react.default.createElement(_AnalysisConsumptionRow.default, { key: index, fluid: fluid, userPriceConsumption: userPriceConsumption, @@ -694,7 +698,7 @@ var TotalAnalysisChart = function TotalAnalysisChart(_ref) { case 4: monthTotalData = _context.sent; - if (monthTotalData && monthTotalData.actualData) { + if (monthTotalData !== null && monthTotalData !== void 0 && monthTotalData.actualData) { setDataLoadValueDetailArray(monthTotalData.actualData[0].valueDetail); setTotalLoadValue(monthTotalData.actualData[0].value); } @@ -1712,7 +1716,7 @@ var ElecHalfHourMonthlyAnalysis = function ElecHalfHourMonthlyAnalysis(_ref) { case 10: data = _context.sent; - if (subscribed && data && data.length) { + if (subscribed && data !== null && data !== void 0 && data.length) { aggregatedData = emas.aggregateValuesToDataLoad(data[0]); setenedisAnalysisValues(data[0]); setMonthDataloads(aggregatedData); @@ -1859,7 +1863,7 @@ var ElecHalfHourMonthlyAnalysis = function ElecHalfHourMonthlyAnalysis(_ref) { className: "text-18-normal" }, " %")), /*#__PURE__*/_react.default.createElement("div", { className: "text-18-bold" - }, elecPrice && elecPrice.price ? (enedisAnalysisValues.minimumLoad * elecPrice.price).toFixed(1) : '---', /*#__PURE__*/_react.default.createElement("span", { + }, elecPrice !== null && elecPrice !== void 0 && elecPrice.price ? (enedisAnalysisValues.minimumLoad * elecPrice.price).toFixed(1) : '---', /*#__PURE__*/_react.default.createElement("span", { className: "text-18-normal" }, " \u20AC"))) : /*#__PURE__*/_react.default.createElement("span", null, "----"))), /*#__PURE__*/_react.default.createElement("div", { onClick: toggleOpenModal, @@ -2003,7 +2007,8 @@ var MonthlyAnalysis = function MonthlyAnalysis(_ref) { function _populateData() { _populateData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() { - var consumptionService, performanceIndicatorService, periods, fetchedPerformanceIndicators, i; + var consumptionService, performanceIndicatorService, periods, fetchedPerformanceIndicators, i, _fetchedPerformanceIn; + return _regenerator.default.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { @@ -2046,7 +2051,7 @@ var MonthlyAnalysis = function MonthlyAnalysis(_ref) { setLoadAnalysis(false); for (i = 0; i < fetchedPerformanceIndicators.length; i++) { - if (fetchedPerformanceIndicators[i] && fetchedPerformanceIndicators[i].value) { + if ((_fetchedPerformanceIn = fetchedPerformanceIndicators[i]) !== null && _fetchedPerformanceIn !== void 0 && _fetchedPerformanceIn.value) { setLoadAnalysis(true); } } @@ -2807,7 +2812,7 @@ var FluidPerformanceIndicator = function FluidPerformanceIndicator(_ref) { var iconType = (0, _picto.getPicto)(fluidType); var displayedValue = '----'; - if (performanceIndicator && performanceIndicator.value) { + if (performanceIndicator !== null && performanceIndicator !== void 0 && performanceIndicator.value) { displayedValue = (0, _utils.formatNumberValues)(performanceIndicator.value).toString(); } @@ -2834,8 +2839,8 @@ var FluidPerformanceIndicator = function FluidPerformanceIndicator(_ref) { }, t('FLUID.' + _fluid.FluidType[fluidType] + '.UNIT')), /*#__PURE__*/_react.default.createElement("span", { className: "euro-value month" }, /*#__PURE__*/_react.default.createElement("span", { - className: "".concat(performanceIndicator && performanceIndicator.percentageVariation && performanceIndicator.percentageVariation > 0 ? 'positive' : 'negative') - }, performanceIndicator && performanceIndicator.percentageVariation ? performanceIndicator.percentageVariation > 0 ? "+".concat((0, _utils.formatNumberValues)(performanceIndicator.percentageVariation * 100), " %") : "-".concat((0, _utils.formatNumberValues)(Math.abs(performanceIndicator.percentageVariation) * 100), " %") : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", { + className: "".concat(performanceIndicator !== null && performanceIndicator !== void 0 && performanceIndicator.percentageVariation && (performanceIndicator === null || performanceIndicator === void 0 ? void 0 : performanceIndicator.percentageVariation) > 0 ? 'negative' : 'positive') + }, performanceIndicator !== null && performanceIndicator !== void 0 && performanceIndicator.percentageVariation ? performanceIndicator.percentageVariation > 0 ? "+".concat((0, _utils.formatNumberValues)(performanceIndicator.percentageVariation * 100), " %") : "-".concat((0, _utils.formatNumberValues)(Math.abs(performanceIndicator.percentageVariation) * 100), " %") : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", { className: "no-comparison" }, t('performance_indicator.fpi.no_comparison')))), performanceIndicator.percentageVariation && "/ ".concat((0, _utils.getPreviousMonthName)(date.minus({ month: 1 diff --git a/3/ecolyo.36b8ec7c4464086d1c01.js b/3/ecolyo.ee2b5da7120569e2bb4c.js similarity index 99% rename from 3/ecolyo.36b8ec7c4464086d1c01.js rename to 3/ecolyo.ee2b5da7120569e2bb4c.js index b9b961c89..f88d305d9 100644 --- a/3/ecolyo.36b8ec7c4464086d1c01.js +++ b/3/ecolyo.ee2b5da7120569e2bb4c.js @@ -1357,9 +1357,11 @@ var ConsumptionView = function ConsumptionView(_ref) { try { for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _fluid$connection$tri; + var fluid = _step.value; - if (fluid.connection.triggerState && fluid.connection.triggerState.last_error && (0, _utils.getKonnectorUpdateError)(fluid.connection.triggerState.last_error) === 'error_update_oauth') { + if ((_fluid$connection$tri = fluid.connection.triggerState) !== null && _fluid$connection$tri !== void 0 && _fluid$connection$tri.last_error && (0, _utils.getKonnectorUpdateError)(fluid.connection.triggerState.last_error) === 'error_update_oauth') { expiredConsents.push(fluid.fluidType); } } @@ -1744,7 +1746,7 @@ var KonnectorViewerCard = function KonnectorViewerCard(_ref) { for (_iterator.s(); !(_step = _iterator.n()).done;) { fluid = _step.value; - if (fluid.lastDataDate && fluid.lastDataDate > _lastDataDate) { + if ((fluid === null || fluid === void 0 ? void 0 : fluid.lastDataDate) > _lastDataDate) { _lastDataDate = fluid.lastDataDate; } } @@ -1774,7 +1776,7 @@ var KonnectorViewerCard = function KonnectorViewerCard(_ref) { while (1) { switch (_context2.prev = _context2.next) { case 0: - if (!(currentChallenge && currentChallenge.state === _userChallenge.UserChallengeState.DUEL && currentChallenge.duel.state === _userDuel.UserDuelState.ONGOING)) { + if (!((currentChallenge === null || currentChallenge === void 0 ? void 0 : currentChallenge.state) === _userChallenge.UserChallengeState.DUEL && (currentChallenge === null || currentChallenge === void 0 ? void 0 : currentChallenge.duel.state) === _userDuel.UserDuelState.ONGOING)) { _context2.next = 13; break; } @@ -2656,7 +2658,7 @@ var FormLogin = function FormLogin(_ref) { }(); (0, _react.useEffect)(function () { - if (account && account.auth) { + if (account !== null && account !== void 0 && account.auth) { var auth = account.auth; var authData = auth; @@ -2911,7 +2913,7 @@ var FluidChartSlide = function FluidChartSlide(_ref) { case 14: graphData = _context.sent; - if (subscribed && graphData && graphData.actualData.length > 0) { + if (subscribed && graphData && (graphData === null || graphData === void 0 ? void 0 : graphData.actualData.length) > 0) { setChartData(graphData); setIsDataLoaded(true); dispatch((0, _chart.setLoading)(false)); @@ -3048,7 +3050,7 @@ var FormOAuth = function FormOAuth(_ref) { while (1) { switch (_context.prev = _context.next) { case 0: - if (!(konnector && konnector.slug && fluidStatus.lastDataDate === null)) { + if (!(konnector !== null && konnector !== void 0 && konnector.slug && fluidStatus.lastDataDate === null)) { _context.next = 3; break; } @@ -5317,12 +5319,16 @@ var FluidButton = function FluidButton(_ref) { })), [history, fluidType, client]); var serviceIsDown = function serviceIsDown() { - return fluidType !== _fluid.FluidType.MULTIFLUID && fluidStatus[fluidType] && fluidStatus[fluidType].status === _fluid.FluidState.PARTNER_ISSUE; + var _fluidStatus$fluidTyp; + + return fluidType !== _fluid.FluidType.MULTIFLUID && ((_fluidStatus$fluidTyp = fluidStatus[fluidType]) === null || _fluidStatus$fluidTyp === void 0 ? void 0 : _fluidStatus$fluidTyp.status) === _fluid.FluidState.PARTNER_ISSUE; }; (0, _react.useEffect)(function () { + var _fluidStatus$fluidTyp2; + //Show errors only on konnected konnectors that are in error, outdated, with no data (specific case), and not in multifluid - if (fluidType !== _fluid.FluidType.MULTIFLUID && isConnected() && isErrored() || fluidType !== _fluid.FluidType.MULTIFLUID && isConnected() && isOutdated() || isConnected() && fluidStatus[fluidType] && !fluidStatus[fluidType].lastDataDate) { + if (fluidType !== _fluid.FluidType.MULTIFLUID && isConnected() && isErrored() || fluidType !== _fluid.FluidType.MULTIFLUID && isConnected() && isOutdated() || isConnected() && !((_fluidStatus$fluidTyp2 = fluidStatus[fluidType]) !== null && _fluidStatus$fluidTyp2 !== void 0 && _fluidStatus$fluidTyp2.lastDataDate)) { setShowError(true); } }, [fluidStatus, fluidType, isConnected, isErrored, isOutdated]); @@ -6421,6 +6427,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var ConnectionResult = function ConnectionResult(_ref) { + var _fluidStatus$connecti4; + var fluidStatus = _ref.fluidStatus, handleAccountDeletion = _ref.handleAccountDeletion, fluidType = _ref.fluidType; @@ -6621,7 +6629,9 @@ var ConnectionResult = function ConnectionResult(_ref) { dispatch((0, _global.setShouldRefreshConsent)(true)); }, [deleteAccountsAndTriggers, dispatch]); (0, _react.useEffect)(function () { - if (fluidStatus.connection.triggerState && fluidStatus.connection.triggerState.last_success) { + var _fluidStatus$connecti, _fluidStatus$connecti2, _fluidStatus$connecti3; + + if ((_fluidStatus$connecti = fluidStatus.connection.triggerState) !== null && _fluidStatus$connecti !== void 0 && _fluidStatus$connecti.last_success) { var result = _luxon.DateTime.fromISO(fluidStatus.connection.triggerState.last_success); setLastExecutionDate(result); @@ -6629,7 +6639,7 @@ var ConnectionResult = function ConnectionResult(_ref) { setLastExecutionDate('-'); } - if (fluidStatus.connection.triggerState && fluidStatus.connection.triggerState.status === 'errored' && fluidStatus.connection.triggerState.last_error) { + if (((_fluidStatus$connecti2 = fluidStatus.connection.triggerState) === null || _fluidStatus$connecti2 === void 0 ? void 0 : _fluidStatus$connecti2.status) === 'errored' && (_fluidStatus$connecti3 = fluidStatus.connection.triggerState) !== null && _fluidStatus$connecti3 !== void 0 && _fluidStatus$connecti3.last_error) { setStatus('errored'); setKonnectorError((0, _utils.getKonnectorUpdateError)(fluidStatus.connection.triggerState.last_error)); } @@ -6687,7 +6697,7 @@ var ConnectionResult = function ConnectionResult(_ref) { className: "connection-caption" }, t('konnector_form.label_updated_at')), /*#__PURE__*/_react.default.createElement("div", { className: "text-16-bold" - }, lastExecutionDate.toLocaleString()), /*#__PURE__*/_react.default.createElement("div", null, fluidStatus && fluidStatus.connection && fluidStatus.connection.konnector && t('konnector_form.issue') + ' ' + fluidStatus.connection.konnector.name + '.')) : + }, lastExecutionDate.toLocaleString()), /*#__PURE__*/_react.default.createElement("div", null, (fluidStatus === null || fluidStatus === void 0 ? void 0 : (_fluidStatus$connecti4 = fluidStatus.connection) === null || _fluidStatus$connecti4 === void 0 ? void 0 : _fluidStatus$connecti4.konnector) && t('konnector_form.issue') + ' ' + fluidStatus.connection.konnector.name + '.')) : /*#__PURE__*/ // Otherwise tells user to run a manual update _react.default.createElement("div", { diff --git a/6/ecolyo.5ea36954335bad0648ec.js b/6/ecolyo.cf316224f80d91ba8e19.js similarity index 94% rename from 6/ecolyo.5ea36954335bad0648ec.js rename to 6/ecolyo.cf316224f80d91ba8e19.js index a99f33730..07ee67789 100644 --- a/6/ecolyo.5ea36954335bad0648ec.js +++ b/6/ecolyo.cf316224f80d91ba8e19.js @@ -476,6 +476,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } var EstimatedConsumptionModal = function EstimatedConsumptionModal(_ref) { + var _prices$FluidType$ELE, _prices$FluidType$ELE2, _prices$FluidType$WAT, _prices$FluidType$WAT2, _prices$FluidType$GAS, _prices$FluidType$GAS2; + var open = _ref.open, handleCloseClick = _ref.handleCloseClick; @@ -557,22 +559,22 @@ var EstimatedConsumptionModal = function EstimatedConsumptionModal(_ref) { }, t('consumption_visualizer.modal.part2')), /*#__PURE__*/_react.default.createElement("ul", null, /*#__PURE__*/_react.default.createElement("li", null, /*#__PURE__*/_react.default.createElement("span", { className: "".concat(_fluid.FluidType[_fluid.FluidType.ELECTRICITY].toLowerCase()) }, t("FLUID.".concat(_fluid.FluidType[_fluid.FluidType.ELECTRICITY], ".LABEL"))), t('consumption_visualizer.modal.list1', { - elecPrice: prices[_fluid.FluidType.ELECTRICITY] && prices[_fluid.FluidType.ELECTRICITY].price, - elecPriceStartDate: prices[_fluid.FluidType.ELECTRICITY] && _luxon.DateTime.fromISO(prices[_fluid.FluidType.ELECTRICITY].startDate).setZone('utc', { + elecPrice: (_prices$FluidType$ELE = prices[_fluid.FluidType.ELECTRICITY]) === null || _prices$FluidType$ELE === void 0 ? void 0 : _prices$FluidType$ELE.price, + elecPriceStartDate: _luxon.DateTime.fromISO((_prices$FluidType$ELE2 = prices[_fluid.FluidType.ELECTRICITY]) === null || _prices$FluidType$ELE2 === void 0 ? void 0 : _prices$FluidType$ELE2.startDate).setZone('utc', { keepLocalTime: true }).toLocaleString() })), /*#__PURE__*/_react.default.createElement("li", null, /*#__PURE__*/_react.default.createElement("span", { className: "".concat(_fluid.FluidType[_fluid.FluidType.WATER].toLowerCase()) }, t("FLUID.".concat(_fluid.FluidType[_fluid.FluidType.WATER], ".LABEL"))), t('consumption_visualizer.modal.list3', { - waterPrice: prices[_fluid.FluidType.WATER] && prices[_fluid.FluidType.WATER].price, - waterPriceStartDate: prices[_fluid.FluidType.WATER] && _luxon.DateTime.fromISO(prices[_fluid.FluidType.WATER].startDate).setZone('utc', { + waterPrice: (_prices$FluidType$WAT = prices[_fluid.FluidType.WATER]) === null || _prices$FluidType$WAT === void 0 ? void 0 : _prices$FluidType$WAT.price, + waterPriceStartDate: _luxon.DateTime.fromISO((_prices$FluidType$WAT2 = prices[_fluid.FluidType.WATER]) === null || _prices$FluidType$WAT2 === void 0 ? void 0 : _prices$FluidType$WAT2.startDate).setZone('utc', { keepLocalTime: true }).toLocaleString() })), /*#__PURE__*/_react.default.createElement("li", null, /*#__PURE__*/_react.default.createElement("span", { className: "".concat(_fluid.FluidType[_fluid.FluidType.GAS].toLowerCase()) }, t("FLUID.".concat(_fluid.FluidType[_fluid.FluidType.GAS], ".LABEL"))), t('consumption_visualizer.modal.list2', { - gasPrice: prices[_fluid.FluidType.GAS] && prices[_fluid.FluidType.GAS].price, - gasPriceStartDate: prices[_fluid.FluidType.GAS] && _luxon.DateTime.fromISO(prices[_fluid.FluidType.GAS].startDate).setZone('utc', { + gasPrice: (_prices$FluidType$GAS = prices[_fluid.FluidType.GAS]) === null || _prices$FluidType$GAS === void 0 ? void 0 : _prices$FluidType$GAS.price, + gasPriceStartDate: _luxon.DateTime.fromISO((_prices$FluidType$GAS2 = prices[_fluid.FluidType.GAS]) === null || _prices$FluidType$GAS2 === void 0 ? void 0 : _prices$FluidType$GAS2.startDate).setZone('utc', { keepLocalTime: true }).toLocaleString() }))), /*#__PURE__*/_react.default.createElement("div", { diff --git a/9/ecolyo.11294a210c09d427c29f.js b/9/ecolyo.a8e9eb8ff3391bee0df8.js similarity index 99% rename from 9/ecolyo.11294a210c09d427c29f.js rename to 9/ecolyo.a8e9eb8ff3391bee0df8.js index 11c8b2ec8..03cd190d5 100644 --- a/9/ecolyo.11294a210c09d427c29f.js +++ b/9/ecolyo.a8e9eb8ff3391bee0df8.js @@ -80,6 +80,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var SingleEcogesture = function SingleEcogesture(_ref) { + var _location$state; + var match = _ref.match; var _useI18n = (0, _I18n.useI18n)(), @@ -119,7 +121,7 @@ var SingleEcogesture = function SingleEcogesture(_ref) { setIsLoading = _useState12[1]; var ecogestureID = match.params.id; - var selectionCompleted = location && location.state && location.state.selectionCompleted; + var selectionCompleted = location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.selectionCompleted; var ecogestureService = (0, _react.useMemo)(function () { return new _ecogesture.default(client); }, [client]); diff --git a/app/ecolyo.bae8d4905665ff92965e.js b/app/ecolyo.d158f1730b2950fd83cb.js similarity index 99% rename from app/ecolyo.bae8d4905665ff92965e.js rename to app/ecolyo.d158f1730b2950fd83cb.js index 5945ae8a9..7bb9f09a5 100644 --- a/app/ecolyo.bae8d4905665ff92965e.js +++ b/app/ecolyo.d158f1730b2950fd83cb.js @@ -64,7 +64,7 @@ /******/ /******/ // script path function /******/ function jsonpScriptSrc(chunkId) { -/******/ return __webpack_require__.p + "" + ({}[chunkId]||chunkId) + "/ecolyo." + {"2":"c149122cc628d8281c62","3":"36b8ec7c4464086d1c01","4":"5e481431cf0b2359d58d","5":"be40de25a698f7337c41","6":"5ea36954335bad0648ec","7":"8e0088481e1baf094fa4","8":"9053e1d3a50ee6a7d4c4","9":"11294a210c09d427c29f","10":"1823bf23fa5cf052fd8e"}[chunkId] + ".js" +/******/ return __webpack_require__.p + "" + ({}[chunkId]||chunkId) + "/ecolyo." + {"2":"b07c59bd0b636d97155c","3":"ee2b5da7120569e2bb4c","4":"5e481431cf0b2359d58d","5":"be40de25a698f7337c41","6":"cf316224f80d91ba8e19","7":"8e0088481e1baf094fa4","8":"9053e1d3a50ee6a7d4c4","9":"a8e9eb8ff3391bee0df8","10":"1823bf23fa5cf052fd8e"}[chunkId] + ".js" /******/ } /******/ /******/ // The require function @@ -1568,7 +1568,7 @@ var SplashRoot = function SplashRoot(_ref) { function _loadData() { _loadData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() { - var initializationService, partnersInfoService, ms, migrationsResult, termsStatus, profile, profileType, profileEcogesture, _yield$Promise$all, _yield$Promise$all2, ecogestureHash, duelHash, quizHash, challengeHash, explorationHash, analysisResult, fluidStatus, refDate, lastDataDate, _iterator, _step, fluid, userChallengeList, filteredCurrentOngoingChallenge, actionService, updatedUserChallenge, filteredCurrentDuelChallenge, _yield$initialization, _updatedUserChallenge, dataloads, challengeService, _yield$challengeServi, isDone, partnersInfo, today, fluidService, _updatedFluidStatus, isConcernedByPartnerIssue, _iterator2, _step2, _fluid; + var initializationService, partnersInfoService, ms, migrationsResult, termsStatus, profile, profileType, profileEcogesture, _yield$Promise$all, _yield$Promise$all2, ecogestureHash, duelHash, quizHash, challengeHash, explorationHash, analysisResult, fluidStatus, refDate, lastDataDate, _iterator, _step, fluid, userChallengeList, _filteredCurrentOngoi, _filteredCurrentOngoi2, _filteredCurrentOngoi3, _filteredCurrentDuelC, filteredCurrentOngoingChallenge, actionService, updatedUserChallenge, filteredCurrentDuelChallenge, _yield$initialization, _updatedUserChallenge, dataloads, challengeService, _yield$challengeServi, isDone, partnersInfo, today, fluidService, _updatedFluidStatus, isConcernedByPartnerIssue, _iterator2, _step2, _fluid; return _regenerator.default.wrap(function _callee$(_context) { while (1) { @@ -1703,12 +1703,12 @@ var SplashRoot = function SplashRoot(_ref) { return challenge.state === _userChallenge.UserChallengeState.ONGOING; }); // Set Notification if exploration state is notification - if (filteredCurrentOngoingChallenge[0] && filteredCurrentOngoingChallenge[0].exploration.state === _userExploration.UserExplorationState.NOTIFICATION) { + if (((_filteredCurrentOngoi = filteredCurrentOngoingChallenge[0]) === null || _filteredCurrentOngoi === void 0 ? void 0 : _filteredCurrentOngoi.exploration.state) === _userExploration.UserExplorationState.NOTIFICATION) { dispatch((0, _global.toggleChallengeExplorationNotification)(true)); } // Set action to notifcation if action is accomplished - if (!(filteredCurrentOngoingChallenge[0] && filteredCurrentOngoingChallenge[0].action.state === _userAction.UserActionState.ONGOING)) { + if (!(((_filteredCurrentOngoi2 = filteredCurrentOngoingChallenge[0]) === null || _filteredCurrentOngoi2 === void 0 ? void 0 : _filteredCurrentOngoi2.action.state) === _userAction.UserActionState.ONGOING)) { _context.next = 65; break; } @@ -1726,7 +1726,7 @@ var SplashRoot = function SplashRoot(_ref) { case 65: // Set Notification if action state is notification - if (filteredCurrentOngoingChallenge[0] && filteredCurrentOngoingChallenge[0].action.state === _userAction.UserActionState.NOTIFICATION) { + if (((_filteredCurrentOngoi3 = filteredCurrentOngoingChallenge[0]) === null || _filteredCurrentOngoi3 === void 0 ? void 0 : _filteredCurrentOngoi3.action.state) === _userAction.UserActionState.NOTIFICATION) { dispatch((0, _global.toggleChallengeActionNotification)(true)); } @@ -1734,7 +1734,7 @@ var SplashRoot = function SplashRoot(_ref) { return challenge.state === _userChallenge.UserChallengeState.DUEL; }); - if (!(filteredCurrentDuelChallenge[0] && filteredCurrentDuelChallenge[0].duel.state === _userDuel.UserDuelState.ONGOING)) { + if (!(((_filteredCurrentDuelC = filteredCurrentDuelChallenge[0]) === null || _filteredCurrentDuelC === void 0 ? void 0 : _filteredCurrentDuelC.duel.state) === _userDuel.UserDuelState.ONGOING)) { _context.next = 81; break; } @@ -1819,7 +1819,7 @@ var SplashRoot = function SplashRoot(_ref) { * enable the modal */ - if (today !== (profile && profile.partnersIssueDate.toISO()) && isConcernedByPartnerIssue) { + if (today !== (profile === null || profile === void 0 ? void 0 : profile.partnersIssueDate.toISO()) && isConcernedByPartnerIssue) { dispatch((0, _global.setPartnersIssue)(true)); } @@ -7605,29 +7605,31 @@ var PerformanceIndicatorService = /*#__PURE__*/function () { } } } else { + var _performanceIndicator2, _performanceIndicator4; + var i = performanceIndicators.length - 1; - if (performanceIndicators[i] && !performanceIndicators[i].value) { + if (!((_performanceIndicator2 = performanceIndicators[i]) !== null && _performanceIndicator2 !== void 0 && _performanceIndicator2.value)) { currentValue = 0; } else { for (var _key2 in performanceIndicators) { - var _performanceIndicator2 = performanceIndicators[_key2]; + var _performanceIndicator3 = performanceIndicators[_key2]; var _fluidType2 = parseInt(_key2); - currentValue += _performanceIndicator2.value ? converterService.LoadToEuro(_performanceIndicator2.value, _fluidType2, _performanceIndicator2 ? _performanceIndicator2.price : null) : 0; + currentValue += _performanceIndicator3.value ? converterService.LoadToEuro(_performanceIndicator3.value, _fluidType2, _performanceIndicator3 ? _performanceIndicator3.price : null) : 0; } } - if (performanceIndicators[i] && !performanceIndicators[i].compareValue) { + if (!((_performanceIndicator4 = performanceIndicators[i]) !== null && _performanceIndicator4 !== void 0 && _performanceIndicator4.compareValue)) { compareValue = 0; } else { for (var _key3 in performanceIndicators) { - var _performanceIndicator3 = performanceIndicators[_key3]; + var _performanceIndicator5 = performanceIndicators[_key3]; var _fluidType3 = parseInt(_key3); - compareValue += _performanceIndicator3.compareValue ? converterService.LoadToEuro(_performanceIndicator3.compareValue, _fluidType3, _performanceIndicator3 ? _performanceIndicator3.price : null) : 0; + compareValue += _performanceIndicator5.compareValue ? converterService.LoadToEuro(_performanceIndicator5.compareValue, _fluidType3, _performanceIndicator5 ? _performanceIndicator5.price : null) : 0; } } } @@ -8027,7 +8029,8 @@ var ConsumptionDataManager = /*#__PURE__*/function () { key: "getMaxLoad", value: function () { var _getMaxLoad = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(maxTimePeriod, timeStep, fluidTypes, compareMaxTimePeriod, isHome, withDate) { - var allData, max; + var allData, _allData, max; + return _regenerator.default.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { @@ -8042,7 +8045,7 @@ var ConsumptionDataManager = /*#__PURE__*/function () { case 3: allData = _context2.sent; - return _context2.abrupt("return", allData && allData.actualData ? Math.max.apply(Math, (0, _toConsumableArray2.default)(allData.actualData.map(function (d) { + return _context2.abrupt("return", (_allData = allData) !== null && _allData !== void 0 && _allData.actualData ? Math.max.apply(Math, (0, _toConsumableArray2.default)(allData.actualData.map(function (d) { return d.value; }))) : 0); @@ -8533,7 +8536,7 @@ var ConsumptionDataManager = /*#__PURE__*/function () { case 2: queryResult = _context8.sent; - if (!(queryResult && queryResult.data.length > 0)) { + if (!((queryResult === null || queryResult === void 0 ? void 0 : queryResult.data.length) > 0)) { _context8.next = 5; break; } @@ -8605,7 +8608,9 @@ var ConsumptionDataManager = /*#__PURE__*/function () { }, { key: "aggregateGraphData", value: function aggregateGraphData(singleFluidCharts) { - if (singleFluidCharts && singleFluidCharts[0].chartData) { + var _singleFluidCharts$; + + if ((_singleFluidCharts$ = singleFluidCharts[0]) !== null && _singleFluidCharts$ !== void 0 && _singleFluidCharts$.chartData) { var converterService = new _converter.default(); var resultChartData = { actualData: [], @@ -10001,7 +10006,9 @@ var QuizService = /*#__PURE__*/function () { key: "getMaxLoadOnLastInterval", value: function () { var _getMaxLoadOnLastInterval = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(timeStep, interval, fluidType) { - var dateMax, max, consumptionService, limit, graphData, newInterval, objectTimeStep, _newInterval; + var _graphData; + + var dateMax, max, consumptionService, limit, graphData, _graphData3, newInterval, objectTimeStep, _graphData2, _newInterval; return _regenerator.default.wrap(function _callee9$(_context9) { while (1) { @@ -10022,7 +10029,7 @@ var QuizService = /*#__PURE__*/function () { case 6: graphData = _context9.sent; - if (!(graphData && graphData.actualData)) { + if (!((_graphData = graphData) !== null && _graphData !== void 0 && _graphData.actualData)) { _context9.next = 34; break; } @@ -10081,7 +10088,7 @@ var QuizService = /*#__PURE__*/function () { } case 27: - if (max == -1 && graphData && graphData.actualData && !limit.reached) { + if (max == -1 && (_graphData2 = graphData) !== null && _graphData2 !== void 0 && _graphData2.actualData && !limit.reached) { _context9.next = 19; break; } @@ -10109,7 +10116,7 @@ var QuizService = /*#__PURE__*/function () { graphData = _context9.sent; case 33: - if (graphData && graphData.actualData) { + if ((_graphData3 = graphData) !== null && _graphData3 !== void 0 && _graphData3.actualData) { max = Math.max.apply(Math, (0, _toConsumableArray2.default)(graphData.actualData.map(function (d) { return d.value; }))); @@ -16526,7 +16533,7 @@ var QueryRunner = /*#__PURE__*/function () { case 3: result = _context2.sent; - if (!(result && result.data)) { + if (!(result !== null && result !== void 0 && result.data)) { _context2.next = 8; break; } @@ -16616,7 +16623,7 @@ var QueryRunner = /*#__PURE__*/function () { return _context4.abrupt("return", Math.max(lastDayOfPreviousMonthResult && lastDayOfPreviousMonthResult.data[0] ? lastDayOfPreviousMonthResult.data[0].load : 0, result && result.data[0] ? result.data[0].load : 0)); case 11: - if (!(result && result.data)) { + if (!(result !== null && result !== void 0 && result.data)) { _context4.next = 17; break; } @@ -16655,6 +16662,8 @@ var QueryRunner = /*#__PURE__*/function () { key: "getFirstDateData", value: function () { var _getFirstDateData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(fluidType) { + var _result$data$, _result$data$2, _result$data$3; + var query, result; return _regenerator.default.wrap(function _callee5$(_context5) { while (1) { @@ -16667,7 +16676,7 @@ var QueryRunner = /*#__PURE__*/function () { case 3: result = _context5.sent; - if (!(result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day)) { + if (!(result !== null && result !== void 0 && (_result$data$ = result.data[0]) !== null && _result$data$ !== void 0 && _result$data$.year && result !== null && result !== void 0 && (_result$data$2 = result.data[0]) !== null && _result$data$2 !== void 0 && _result$data$2.month && result !== null && result !== void 0 && (_result$data$3 = result.data[0]) !== null && _result$data$3 !== void 0 && _result$data$3.day)) { _context5.next = 6; break; } @@ -16697,6 +16706,8 @@ var QueryRunner = /*#__PURE__*/function () { key: "getLastDateData", value: function () { var _getLastDateData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(fluidType) { + var _result$data$4, _result$data$5, _result$data$6; + var query, result; return _regenerator.default.wrap(function _callee6$(_context6) { while (1) { @@ -16709,7 +16720,7 @@ var QueryRunner = /*#__PURE__*/function () { case 3: result = _context6.sent; - if (!(result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day)) { + if (!(result !== null && result !== void 0 && (_result$data$4 = result.data[0]) !== null && _result$data$4 !== void 0 && _result$data$4.year && result !== null && result !== void 0 && (_result$data$5 = result.data[0]) !== null && _result$data$5 !== void 0 && _result$data$5.month && result !== null && result !== void 0 && (_result$data$6 = result.data[0]) !== null && _result$data$6 !== void 0 && _result$data$6.day)) { _context6.next = 6; break; } @@ -19077,7 +19088,7 @@ var Content = function Content(_ref) { */ var handleWindowScroll = (0, _react.useCallback)(function () { - app && app.scrollTo(0, 0); + app === null || app === void 0 ? void 0 : app.scrollTo(0, 0); window.scrollTo(0, 0); }, [app]); // Set listners for scroll @@ -19774,7 +19785,7 @@ var DuelService = /*#__PURE__*/function () { case 9: dataLoad = _context2.sent; - if (dataLoad && dataLoad.actualData) { + if (dataLoad !== null && dataLoad !== void 0 && dataLoad.actualData) { dataLoad.actualData.forEach(function (d) { if (d.value === -1 || d.valueDetail && d.valueDetail.filter(function (data) { return data.value === -1; @@ -20802,9 +20813,9 @@ var isLastPeriodReached = function isLastPeriodReached(date, timeStep) { exports.isLastPeriodReached = isLastPeriodReached; var getLagDays = function getLagDays(fluidTypes) { - if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { + if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { return 3; - } else if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { + } else if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { return 2; } else { return 1; @@ -24369,7 +24380,7 @@ var ProfileTypeFinished = function ProfileTypeFinished(_ref) { currentChallenge = _useSelector.currentChallenge; var handleClick = function handleClick() { - if (location && location.pathname === '/ecogesture-form') { + if ((location === null || location === void 0 ? void 0 : location.pathname) === '/ecogesture-form') { history.push('/ecogesture-selection'); } else { history.goBack(); @@ -25620,7 +25631,7 @@ var AccountService = /*#__PURE__*/function () { key: "getAccountByType", value: function () { var _getAccountByType = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(type) { - var query, _yield$this$_client$q, accounts, triggerService, triggers, olderDate, olderAccountId, _iterator, _step, _trigger, filteredAccounts; + var query, _yield$this$_client$q, accounts, triggerService, triggers, olderDate, olderAccountId, _iterator, _step, _trigger$cozyMetadata, _trigger, filteredAccounts; return _regenerator.default.wrap(function _callee3$(_context3) { while (1) { @@ -25662,7 +25673,7 @@ var AccountService = /*#__PURE__*/function () { for (_iterator.s(); !(_step = _iterator.n()).done;) { _trigger = _step.value; - if (_trigger && _trigger.cozyMetadata && _trigger.cozyMetadata.createdAt && _luxon.DateTime.fromISO(_trigger.cozyMetadata.createdAt, { + if (_trigger !== null && _trigger !== void 0 && (_trigger$cozyMetadata = _trigger.cozyMetadata) !== null && _trigger$cozyMetadata !== void 0 && _trigger$cozyMetadata.createdAt && _luxon.DateTime.fromISO(_trigger.cozyMetadata.createdAt, { zone: 'utc' }) < olderDate) { olderDate = _luxon.DateTime.fromISO(_trigger.cozyMetadata.createdAt, { @@ -27520,7 +27531,9 @@ var ChallengeService = /*#__PURE__*/function () { if (challenge.state != _userChallenge3.UserChallengeState.LOCKED) isAllLocked = false; if (challenge.state === _userChallenge3.UserChallengeState.DONE) { - if (userChallenges[i + 1] && userChallenges[i + 1].state === _userChallenge3.UserChallengeState.LOCKED) { + var _userChallenges; + + if (((_userChallenges = userChallenges[i + 1]) === null || _userChallenges === void 0 ? void 0 : _userChallenges.state) === _userChallenge3.UserChallengeState.LOCKED) { userChallenges[i + 1].state = _userChallenge3.UserChallengeState.UNLOCKED; } } @@ -29336,7 +29349,7 @@ var EcogestureModal = function EcogestureModal(_ref) { setEcogestureIcon(_default2.default); } - if (currentChallenge && currentChallenge.exploration.ecogesture_id === ecogesture._id) { + if ((currentChallenge === null || currentChallenge === void 0 ? void 0 : currentChallenge.exploration.ecogesture_id) === ecogesture._id) { setValidExploration(currentChallenge.exploration.id); } @@ -29521,7 +29534,7 @@ function _getDocs() { while (1) { switch (_context4.prev = _context4.next) { case 0: - if (options && options.scope === 'conso') { + if ((options === null || options === void 0 ? void 0 : options.scope) === 'conso') { query = (0, _cozyClient.Q)(doctype).where({}).indexFields(['year', 'month', 'day']).sortBy([{ year: 'desc' }, { @@ -30884,7 +30897,7 @@ var UncomingBar = function UncomingBar(_ref) { setAnimationEnded(true); }; - var barClass = animationEnded ? "bar-UNCOMING " : "bar-UNCOMING bounce-".concat(browser && browser.name !== 'edge' ? '1' : '3', " delay--").concat(index % 13); + var barClass = animationEnded ? "bar-UNCOMING " : "bar-UNCOMING bounce-".concat((browser === null || browser === void 0 ? void 0 : browser.name) !== 'edge' ? '1' : '3', " delay--").concat(index % 13); var getBandWidth = function getBandWidth() { return xScale.bandwidth(); @@ -31961,7 +31974,7 @@ var useExploration = function useExploration() { (0, _react.useEffect)(function () { var subscribed = true; - if (currentChallenge && explorationID && currentChallenge.exploration.id === explorationID && currentChallenge.exploration.state === _userExploration.UserExplorationState.ONGOING) { + if (explorationID && (currentChallenge === null || currentChallenge === void 0 ? void 0 : currentChallenge.exploration.id) === explorationID && (currentChallenge === null || currentChallenge === void 0 ? void 0 : currentChallenge.exploration.state) === _userExploration.UserExplorationState.ONGOING) { var checkExplo = /*#__PURE__*/function () { var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() { var explorationService; @@ -33349,7 +33362,7 @@ var MatomoTracker = /*#__PURE__*/function () { var userId; var root = document.querySelector('[role=application]'); - if (root && root.dataset) { + if (root !== null && root !== void 0 && root.dataset) { cozyDomain = (0, _appDataset.readCozyDataFromDOM)('cozyDomain'); } @@ -34177,7 +34190,7 @@ var TermsService = /*#__PURE__*/function () { _yield$this$_client$q4 = (0, _slicedToArray2.default)(_yield$this$_client$q3.data, 1); terms = _yield$this$_client$q4[0]; - if (!(terms && terms.accepted)) { + if (!(terms !== null && terms !== void 0 && terms.accepted)) { _context2.next = 10; break; } @@ -34495,7 +34508,7 @@ var ConsumptionFormatterService = /*#__PURE__*/function () { }); } - if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= fluidStatus.firstDataDate && data.date <= fluidStatus.lastDataDate) { + if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.firstDataDate) && data.date <= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.lastDataDate)) { return _objectSpread(_objectSpread({}, data), {}, { state: data.value === -1 ? _dataload.DataloadState.HOLE : _dataload.DataloadState.VALID }); @@ -35486,7 +35499,7 @@ var FluidService = /*#__PURE__*/(0, _createClass2.default)(function FluidService return _fluid.FluidState.DONE; case 'errored': - if (state.last_error && state.last_error === 'LOGIN_FAILED') return _fluid.FluidState.ERROR_LOGIN_FAILED;else return _fluid.FluidState.ERROR; + if ((state === null || state === void 0 ? void 0 : state.last_error) === 'LOGIN_FAILED') return _fluid.FluidState.ERROR_LOGIN_FAILED;else return _fluid.FluidState.ERROR; default: return _fluid.FluidState.NOT_CONNECTED; @@ -35601,7 +35614,7 @@ var FluidService = /*#__PURE__*/(0, _createClass2.default)(function FluidService lastDataDates = _context2.sent; result = [{ fluidType: _fluid.FluidType.ELECTRICITY, - status: partnersInfo && partnersInfo.notification_activated && _this.isFluidInPartnerIssue(_fluid.FluidType.ELECTRICITY, _this.parseFluidStatus(elecKonnector, elecStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : _this.parseFluidStatus(elecKonnector, elecStatus), + status: partnersInfo !== null && partnersInfo !== void 0 && partnersInfo.notification_activated && _this.isFluidInPartnerIssue(_fluid.FluidType.ELECTRICITY, _this.parseFluidStatus(elecKonnector, elecStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : _this.parseFluidStatus(elecKonnector, elecStatus), firstDataDate: firstDataDates[_fluid.FluidType.ELECTRICITY], lastDataDate: lastDataDates[_fluid.FluidType.ELECTRICITY], connection: { @@ -35615,7 +35628,7 @@ var FluidService = /*#__PURE__*/(0, _createClass2.default)(function FluidService } }, { fluidType: _fluid.FluidType.WATER, - status: partnersInfo && partnersInfo.notification_activated && _this.isFluidInPartnerIssue(_fluid.FluidType.WATER, _this.parseFluidStatus(waterKonnector, waterStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : _this.parseFluidStatus(waterKonnector, waterStatus), + status: partnersInfo !== null && partnersInfo !== void 0 && partnersInfo.notification_activated && _this.isFluidInPartnerIssue(_fluid.FluidType.WATER, _this.parseFluidStatus(waterKonnector, waterStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : _this.parseFluidStatus(waterKonnector, waterStatus), firstDataDate: firstDataDates[_fluid.FluidType.WATER], lastDataDate: lastDataDates[_fluid.FluidType.WATER], connection: { @@ -35629,7 +35642,7 @@ var FluidService = /*#__PURE__*/(0, _createClass2.default)(function FluidService } }, { fluidType: _fluid.FluidType.GAS, - status: partnersInfo && partnersInfo.notification_activated && _this.isFluidInPartnerIssue(_fluid.FluidType.GAS, _this.parseFluidStatus(gasKonnector, gasStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : _this.parseFluidStatus(gasKonnector, gasStatus), + status: partnersInfo !== null && partnersInfo !== void 0 && partnersInfo.notification_activated && _this.isFluidInPartnerIssue(_fluid.FluidType.GAS, _this.parseFluidStatus(gasKonnector, gasStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : _this.parseFluidStatus(gasKonnector, gasStatus), firstDataDate: firstDataDates[_fluid.FluidType.GAS], lastDataDate: lastDataDates[_fluid.FluidType.GAS], connection: { @@ -36607,7 +36620,7 @@ var InitializationService = /*#__PURE__*/function () { case 5: loadedEcogestures = _context6.sent; - if (!(!loadedEcogestures || loadedEcogestures && loadedEcogestures.length === 0)) { + if (!(!loadedEcogestures || (loadedEcogestures === null || loadedEcogestures === void 0 ? void 0 : loadedEcogestures.length) === 0)) { _context6.next = 40; break; } @@ -36656,7 +36669,7 @@ var InitializationService = /*#__PURE__*/function () { case 27: checkCount = _context6.sent; - if (!(!checkCount || checkCount && checkCount.length !== _ecogestureData.default.length)) { + if (!(!checkCount || (checkCount === null || checkCount === void 0 ? void 0 : checkCount.length) !== _ecogestureData.default.length)) { _context6.next = 31; break; } @@ -36740,7 +36753,7 @@ var InitializationService = /*#__PURE__*/function () { case 64: _checkCount = _context6.sent; - if (!(!_checkCount || _checkCount && _checkCount.length !== _ecogestureData.default.length)) { + if (!(!_checkCount || (_checkCount === null || _checkCount === void 0 ? void 0 : _checkCount.length) !== _ecogestureData.default.length)) { _context6.next = 68; break; } @@ -36806,7 +36819,7 @@ var InitializationService = /*#__PURE__*/function () { case 3: loadedPrices = _context7.sent; - if (!(loadedPrices && loadedPrices.length)) { + if (!(loadedPrices !== null && loadedPrices !== void 0 && loadedPrices.length)) { _context7.next = 9; break; } @@ -36910,7 +36923,7 @@ var InitializationService = /*#__PURE__*/function () { case 5: loadedChallengeEntity = _context8.sent; - if (!(!loadedChallengeEntity || loadedChallengeEntity && loadedChallengeEntity.length === 0)) { + if (!(!loadedChallengeEntity || (loadedChallengeEntity === null || loadedChallengeEntity === void 0 ? void 0 : loadedChallengeEntity.length) === 0)) { _context8.next = 40; break; } @@ -36959,7 +36972,7 @@ var InitializationService = /*#__PURE__*/function () { case 27: checkCount = _context8.sent; - if (!(!checkCount || checkCount && checkCount.length !== _challengeEntity2.default.length)) { + if (!(!checkCount || (checkCount === null || checkCount === void 0 ? void 0 : checkCount.length) !== _challengeEntity2.default.length)) { _context8.next = 31; break; } @@ -37038,7 +37051,7 @@ var InitializationService = /*#__PURE__*/function () { case 63: _checkCount2 = _context8.sent; - if (!(!_checkCount2 || _checkCount2 && _checkCount2.length !== _challengeEntity2.default.length)) { + if (!(!_checkCount2 || (_checkCount2 === null || _checkCount2 === void 0 ? void 0 : _checkCount2.length) !== _challengeEntity2.default.length)) { _context8.next = 67; break; } @@ -37105,7 +37118,7 @@ var InitializationService = /*#__PURE__*/function () { case 4: loadedDuelTypes = _context9.sent; - if (!(!loadedDuelTypes || loadedDuelTypes && loadedDuelTypes.length === 0)) { + if (!(!loadedDuelTypes || (loadedDuelTypes === null || loadedDuelTypes === void 0 ? void 0 : loadedDuelTypes.length) === 0)) { _context9.next = 39; break; } @@ -37154,7 +37167,7 @@ var InitializationService = /*#__PURE__*/function () { case 26: checkCount = _context9.sent; - if (!(!checkCount || checkCount && checkCount.length !== _duelEntity2.default.length)) { + if (!(!checkCount || (checkCount === null || checkCount === void 0 ? void 0 : checkCount.length) !== _duelEntity2.default.length)) { _context9.next = 30; break; } @@ -37233,7 +37246,7 @@ var InitializationService = /*#__PURE__*/function () { case 62: _checkCount3 = _context9.sent; - if (!(!_checkCount3 || _checkCount3 && _checkCount3.length !== _duelEntity2.default.length)) { + if (!(!_checkCount3 || (_checkCount3 === null || _checkCount3 === void 0 ? void 0 : _checkCount3.length) !== _duelEntity2.default.length)) { _context9.next = 66; break; } @@ -37300,7 +37313,7 @@ var InitializationService = /*#__PURE__*/function () { case 4: loadedQuizEntity = _context10.sent; - if (!(!loadedQuizEntity || loadedQuizEntity && loadedQuizEntity.length === 0)) { + if (!(!loadedQuizEntity || (loadedQuizEntity === null || loadedQuizEntity === void 0 ? void 0 : loadedQuizEntity.length) === 0)) { _context10.next = 39; break; } @@ -37349,7 +37362,7 @@ var InitializationService = /*#__PURE__*/function () { case 26: checkCount = _context10.sent; - if (!(!checkCount || checkCount && checkCount.length !== _quizEntity2.default.length)) { + if (!(!checkCount || (checkCount === null || checkCount === void 0 ? void 0 : checkCount.length) !== _quizEntity2.default.length)) { _context10.next = 30; break; } @@ -37428,7 +37441,7 @@ var InitializationService = /*#__PURE__*/function () { case 62: _checkCount4 = _context10.sent; - if (!(!_checkCount4 || _checkCount4 && _checkCount4.length !== _quizEntity2.default.length)) { + if (!(!_checkCount4 || (_checkCount4 === null || _checkCount4 === void 0 ? void 0 : _checkCount4.length) !== _quizEntity2.default.length)) { _context10.next = 66; break; } @@ -37495,7 +37508,7 @@ var InitializationService = /*#__PURE__*/function () { case 4: loadedExplorationEntity = _context11.sent; - if (!(!loadedExplorationEntity || loadedExplorationEntity && loadedExplorationEntity.length === 0)) { + if (!(!loadedExplorationEntity || (loadedExplorationEntity === null || loadedExplorationEntity === void 0 ? void 0 : loadedExplorationEntity.length) === 0)) { _context11.next = 39; break; } @@ -37544,7 +37557,7 @@ var InitializationService = /*#__PURE__*/function () { case 26: checkCount = _context11.sent; - if (!(!checkCount || checkCount && checkCount.length !== _explorationEntity2.default.length)) { + if (!(!checkCount || (checkCount === null || checkCount === void 0 ? void 0 : checkCount.length) !== _explorationEntity2.default.length)) { _context11.next = 30; break; } @@ -37623,7 +37636,7 @@ var InitializationService = /*#__PURE__*/function () { case 62: _checkCount5 = _context11.sent; - if (!(!_checkCount5 || _checkCount5 && _checkCount5.length !== _explorationEntity2.default.length)) { + if (!(!_checkCount5 || (_checkCount5 === null || _checkCount5 === void 0 ? void 0 : _checkCount5.length) !== _explorationEntity2.default.length)) { _context11.next = 66; break; } diff --git a/index.html b/index.html index 2b992b2fb..8a39d20bc 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -<!DOCTYPE html><html lang="{{.Locale}}"><head><meta charset="utf-8"><title>Ecolyo</title><link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"><!-- PWA Manifest --><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#297EF2"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,user-scalable=0,viewport-fit=cover"><!-- PWA Chrome --><link rel="icon" sizes="192x192" href="/android-chrome-192x192.png"><link rel="icon" sizes="512x512" href="/android-chrome-512x512.png"><!-- PWA iOS --><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="apple-touch-startup-image" href="/apple-touch-icon.png"><meta name="apple-mobile-web-app-title" content="Ecolyo"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><!-- PWA Colors --><meta name="theme-color" content="#343641"><meta name="background-color" content="#121212">{{.ThemeCSS}} {{.CozyBar}}<script src="//{{.Domain}}/assets/js/piwik.js"></script></head><body><div role="application" class="application" data-cozy="{{.CozyData}}"><script src="vendors/ecolyo.08cea87f518c2cc2790a.js"></script><script src="app/ecolyo.bae8d4905665ff92965e.js"></script></div></body></html> \ No newline at end of file +<!DOCTYPE html><html lang="{{.Locale}}"><head><meta charset="utf-8"><title>Ecolyo</title><link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"><!-- PWA Manifest --><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#297EF2"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,user-scalable=0,viewport-fit=cover"><!-- PWA Chrome --><link rel="icon" sizes="192x192" href="/android-chrome-192x192.png"><link rel="icon" sizes="512x512" href="/android-chrome-512x512.png"><!-- PWA iOS --><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="apple-touch-startup-image" href="/apple-touch-icon.png"><meta name="apple-mobile-web-app-title" content="Ecolyo"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><!-- PWA Colors --><meta name="theme-color" content="#343641"><meta name="background-color" content="#121212">{{.ThemeCSS}} {{.CozyBar}}<script src="//{{.Domain}}/assets/js/piwik.js"></script></head><body><div role="application" class="application" data-cozy="{{.CozyData}}"><script src="vendors/ecolyo.3ddba75f57f0da86cb09.js"></script><script src="app/ecolyo.d158f1730b2950fd83cb.js"></script></div></body></html> \ No newline at end of file diff --git a/services/aggregatorUsageEvents/ecolyo.js b/services/aggregatorUsageEvents/ecolyo.js index c39eab08d..c9f2d8ba6 100644 --- a/services/aggregatorUsageEvents/ecolyo.js +++ b/services/aggregatorUsageEvents/ecolyo.js @@ -447,7 +447,7 @@ const buildProfileWithFuildType = async (client, fluidType) => { let formatedProfile = ''; const profile = await new _profile.default(client).getProfile(); // If profile is not filled, return empty string - if (profile && !profile.isProfileTypeCompleted) return formatedProfile; + if (!(profile !== null && profile !== void 0 && profile.isProfileTypeCompleted)) return formatedProfile; const date = _luxon.DateTime.local().setZone('utc', { keepLocalTime: true @@ -456,19 +456,19 @@ const buildProfileWithFuildType = async (client, fluidType) => { const profileType = await new _profileTypeEntity.default(client).getProfileType(date); if (fluidType === _fluid2.FluidType.ELECTRICITY) { - if (profile && profileType && profileType.warmingFluid === _profileType.WarmingType.ELECTRICITY) { + if (profile && (profileType === null || profileType === void 0 ? void 0 : profileType.warmingFluid) === _profileType.WarmingType.ELECTRICITY) { formatedProfile = 'chauffage élec'; } - if (profile && profileType && profileType.warmingFluid === _profileType.WarmingType.WOOD) { + if (profile && (profileType === null || profileType === void 0 ? void 0 : profileType.warmingFluid) === _profileType.WarmingType.WOOD) { formatedProfile = 'chauffage bois'; } - if (profile && profileType && profileType.warmingFluid === _profileType.WarmingType.FUEL) { + if (profile && (profileType === null || profileType === void 0 ? void 0 : profileType.warmingFluid) === _profileType.WarmingType.FUEL) { formatedProfile = 'chauffage fuel'; } - if (profile && profileType && profileType.hotWaterFluid === _fluid2.FluidType.ELECTRICITY) { + if (profile && (profileType === null || profileType === void 0 ? void 0 : profileType.hotWaterFluid) === _fluid2.FluidType.ELECTRICITY) { if (formatedProfile.length === 0) { formatedProfile = 'ECS'; } else { @@ -476,7 +476,7 @@ const buildProfileWithFuildType = async (client, fluidType) => { } } - if (profile && profileType && profileType.cookingFluid === _fluid2.FluidType.ELECTRICITY) { + if (profile && (profileType === null || profileType === void 0 ? void 0 : profileType.cookingFluid) === _fluid2.FluidType.ELECTRICITY) { if (formatedProfile.length === 0) { formatedProfile = 'cuisine élec'; } else { @@ -490,7 +490,7 @@ const buildProfileWithFuildType = async (client, fluidType) => { return formatedProfile; } } else if (fluidType === _fluid2.FluidType.GAS) { - if (profile && profileType && profileType.warmingFluid === _profileType.WarmingType.GAS) { + if (profile && (profileType === null || profileType === void 0 ? void 0 : profileType.warmingFluid) === _profileType.WarmingType.GAS) { formatedProfile = 'chauffage gaz'; } @@ -682,7 +682,7 @@ const sendEmailSubscription = async client => { log('info', `sendEmailSubscription`); const profile = await new _profile.default(client).getProfile(); - if (profile && profile.sendAnalysisNotification) { + if (profile !== null && profile !== void 0 && profile.sendAnalysisNotification) { const cameBackFromEmail = { createdBy: 'ecolyo', measureName: _dacc.DaccEvent.SUMMARY_SUBSCRIPTION_MONTHLY, @@ -724,7 +724,7 @@ const sendHalfHourConsumption = async client => { startDate: _luxon.DateTime.local().setZone('utc', { keepLocalTime: true }).startOf('day').toISODate(), - value: data && data.length > 0 ? 1 : 0 + value: (data === null || data === void 0 ? void 0 : data.length) > 0 ? 1 : 0 }; await sendIndicator(halfHourConsumption, client); }; @@ -1119,7 +1119,7 @@ const aggregateEvents = async (events, eventType, firstConnectionEvent, client) const currentChallenge = filteredCurrentChallenge[0] ? filteredCurrentChallenge[0] : null; let starNumbers = 0; - if (currentChallenge && currentChallenge.progress) { + if (currentChallenge !== null && currentChallenge !== void 0 && currentChallenge.progress) { starNumbers = currentChallenge.progress.actionProgress + currentChallenge.progress.explorationProgress + currentChallenge.progress.quizProgress; } @@ -78864,8 +78864,10 @@ class ConsumptionDataManager { let allData; if (isHome) { + var _allData; + allData = await this.getGraphData(maxTimePeriod, timeStep, fluidTypes, undefined, compareMaxTimePeriod, isHome); - return allData && allData.actualData ? Math.max(...allData.actualData.map(d => d.value)) : 0; + return (_allData = allData) !== null && _allData !== void 0 && _allData.actualData ? Math.max(...allData.actualData.map(d => d.value)) : 0; } else { const max = await this._queryRunnerService.fetchFluidMaxData(maxTimePeriod, timeStep, fluidTypes[0], withDate); return max; @@ -79010,7 +79012,7 @@ class ConsumptionDataManager { async checkDoctypeEntries(fluideType, timeStep) { const queryResult = await this._queryRunnerService.getEntries(fluideType, timeStep); - if (queryResult && queryResult.data.length > 0) { + if ((queryResult === null || queryResult === void 0 ? void 0 : queryResult.data.length) > 0) { return true; } @@ -79034,7 +79036,9 @@ class ConsumptionDataManager { } aggregateGraphData(singleFluidCharts) { - if (singleFluidCharts && singleFluidCharts[0].chartData) { + var _singleFluidCharts$; + + if ((_singleFluidCharts$ = singleFluidCharts[0]) !== null && _singleFluidCharts$ !== void 0 && _singleFluidCharts$.chartData) { const converterService = new _converter.default(); const resultChartData = { actualData: [], @@ -79365,7 +79369,7 @@ class ConsumptionFormatterService { }); } - if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= fluidStatus.firstDataDate && data.date <= fluidStatus.lastDataDate) { + if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.firstDataDate) && data.date <= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.lastDataDate)) { return _objectSpread(_objectSpread({}, data), {}, { state: data.value === -1 ? _dataload.DataloadState.HOLE : _dataload.DataloadState.VALID }); @@ -80014,9 +80018,9 @@ const isLastPeriodReached = (date, timeStep) => { exports.isLastPeriodReached = isLastPeriodReached; const getLagDays = fluidTypes => { - if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { + if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { return 3; - } else if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { + } else if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { return 2; } else { return 1; @@ -80511,7 +80515,7 @@ class QueryRunner { const query = this.buildListQuery(timeStep, timePeriod, fluidType, this._max_limit); const result = await this.fetchData(query); - if (result && result.data) { + if (result !== null && result !== void 0 && result.data) { const filteredResult = this.filterDataList(result, timePeriod); const mappedResult = this.mapDataList(filteredResult); return mappedResult; @@ -80543,7 +80547,7 @@ class QueryRunner { return Math.max(lastDayOfPreviousMonthResult && lastDayOfPreviousMonthResult.data[0] ? lastDayOfPreviousMonthResult.data[0].load : 0, result && result.data[0] ? result.data[0].load : 0); } - if (result && result.data) { + if (result !== null && result !== void 0 && result.data) { const filteredResult = this.filterDataList(result, maxTimePeriod); const mappedResult = this.mapDataList(filteredResult); @@ -80558,10 +80562,12 @@ class QueryRunner { } async getFirstDateData(fluidType) { + var _result$data$, _result$data$2, _result$data$3; + const query = this.buildFirstDateQuery(fluidType, 1); const result = await this.fetchData(query); - if (result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day) { + if (result !== null && result !== void 0 && (_result$data$ = result.data[0]) !== null && _result$data$ !== void 0 && _result$data$.year && result !== null && result !== void 0 && (_result$data$2 = result.data[0]) !== null && _result$data$2 !== void 0 && _result$data$2.month && result !== null && result !== void 0 && (_result$data$3 = result.data[0]) !== null && _result$data$3 !== void 0 && _result$data$3.day) { return _luxon.DateTime.local(result.data[0].year, result.data[0].month, result.data[0].day, result.data[0].hour ? result.data[0].hour : 0, result.data[0].minute ? result.data[0].minute : 0).setZone('utc', { keepLocalTime: true }); @@ -80571,10 +80577,12 @@ class QueryRunner { } async getLastDateData(fluidType) { + var _result$data$4, _result$data$5, _result$data$6; + const query = this.buildLastDateQuery(fluidType, 1); const result = await this.fetchData(query); - if (result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day) { + if (result !== null && result !== void 0 && (_result$data$4 = result.data[0]) !== null && _result$data$4 !== void 0 && _result$data$4.year && result !== null && result !== void 0 && (_result$data$5 = result.data[0]) !== null && _result$data$5 !== void 0 && _result$data$5.month && result !== null && result !== void 0 && (_result$data$6 = result.data[0]) !== null && _result$data$6 !== void 0 && _result$data$6.day) { return _luxon.DateTime.local(result.data[0].year, result.data[0].month, result.data[0].day, result.data[0].hour ? result.data[0].hour : 0, result.data[0].minute ? result.data[0].minute : 0).setZone('utc', { keepLocalTime: true }); @@ -80657,7 +80665,7 @@ class FluidService { return _fluid.FluidState.DONE; case 'errored': - if (state.last_error && state.last_error === 'LOGIN_FAILED') return _fluid.FluidState.ERROR_LOGIN_FAILED;else return _fluid.FluidState.ERROR; + if ((state === null || state === void 0 ? void 0 : state.last_error) === 'LOGIN_FAILED') return _fluid.FluidState.ERROR_LOGIN_FAILED;else return _fluid.FluidState.ERROR; default: return _fluid.FluidState.NOT_CONNECTED; @@ -80707,7 +80715,7 @@ class FluidService { const lastDataDates = await consumptionService.fetchAllLastDateData([_fluid.FluidType.ELECTRICITY, _fluid.FluidType.WATER, _fluid.FluidType.GAS]); const result = [{ fluidType: _fluid.FluidType.ELECTRICITY, - status: partnersInfo && partnersInfo.notification_activated && this.isFluidInPartnerIssue(_fluid.FluidType.ELECTRICITY, this.parseFluidStatus(elecKonnector, elecStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : this.parseFluidStatus(elecKonnector, elecStatus), + status: partnersInfo !== null && partnersInfo !== void 0 && partnersInfo.notification_activated && this.isFluidInPartnerIssue(_fluid.FluidType.ELECTRICITY, this.parseFluidStatus(elecKonnector, elecStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : this.parseFluidStatus(elecKonnector, elecStatus), firstDataDate: firstDataDates[_fluid.FluidType.ELECTRICITY], lastDataDate: lastDataDates[_fluid.FluidType.ELECTRICITY], connection: { @@ -80721,7 +80729,7 @@ class FluidService { } }, { fluidType: _fluid.FluidType.WATER, - status: partnersInfo && partnersInfo.notification_activated && this.isFluidInPartnerIssue(_fluid.FluidType.WATER, this.parseFluidStatus(waterKonnector, waterStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : this.parseFluidStatus(waterKonnector, waterStatus), + status: partnersInfo !== null && partnersInfo !== void 0 && partnersInfo.notification_activated && this.isFluidInPartnerIssue(_fluid.FluidType.WATER, this.parseFluidStatus(waterKonnector, waterStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : this.parseFluidStatus(waterKonnector, waterStatus), firstDataDate: firstDataDates[_fluid.FluidType.WATER], lastDataDate: lastDataDates[_fluid.FluidType.WATER], connection: { @@ -80735,7 +80743,7 @@ class FluidService { } }, { fluidType: _fluid.FluidType.GAS, - status: partnersInfo && partnersInfo.notification_activated && this.isFluidInPartnerIssue(_fluid.FluidType.GAS, this.parseFluidStatus(gasKonnector, gasStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : this.parseFluidStatus(gasKonnector, gasStatus), + status: partnersInfo !== null && partnersInfo !== void 0 && partnersInfo.notification_activated && this.isFluidInPartnerIssue(_fluid.FluidType.GAS, this.parseFluidStatus(gasKonnector, gasStatus), partnersInfo) ? _fluid.FluidState.PARTNER_ISSUE : this.parseFluidStatus(gasKonnector, gasStatus), firstDataDate: firstDataDates[_fluid.FluidType.GAS], lastDataDate: lastDataDates[_fluid.FluidType.GAS], connection: { @@ -94962,7 +94970,9 @@ class AccountService { let olderAccountId = null; for (const _trigger of triggers) { - if (_trigger && _trigger.cozyMetadata && _trigger.cozyMetadata.createdAt && _luxon.DateTime.fromISO(_trigger.cozyMetadata.createdAt, { + var _trigger$cozyMetadata; + + if (_trigger !== null && _trigger !== void 0 && (_trigger$cozyMetadata = _trigger.cozyMetadata) !== null && _trigger$cozyMetadata !== void 0 && _trigger$cozyMetadata.createdAt && _luxon.DateTime.fromISO(_trigger.cozyMetadata.createdAt, { zone: 'utc' }) < olderDate) { olderDate = _luxon.DateTime.fromISO(_trigger.cozyMetadata.createdAt, { @@ -96702,7 +96712,9 @@ class ChallengeService { if (challenge.state != _userChallenge2.UserChallengeState.LOCKED) isAllLocked = false; if (challenge.state === _userChallenge2.UserChallengeState.DONE) { - if (userChallenges[i + 1] && userChallenges[i + 1].state === _userChallenge2.UserChallengeState.LOCKED) { + var _userChallenges; + + if (((_userChallenges = userChallenges[i + 1]) === null || _userChallenges === void 0 ? void 0 : _userChallenges.state) === _userChallenge2.UserChallengeState.LOCKED) { userChallenges[i + 1].state = _userChallenge2.UserChallengeState.UNLOCKED; } } @@ -97518,7 +97530,7 @@ class DuelService { const consumptionService = new _consumption.default(this._client); const dataLoad = await consumptionService.getGraphData(period, _timeStep.TimeStep.DAY, fluidType, undefined, undefined, true); - if (dataLoad && dataLoad.actualData) { + if (dataLoad !== null && dataLoad !== void 0 && dataLoad.actualData) { dataLoad.actualData.forEach(d => { if (d.value === -1 || d.valueDetail && d.valueDetail.filter(data => data.value === -1).length > 0) isComplete = false; }); @@ -97775,9 +97787,11 @@ class PerformanceIndicatorService { } } } else { + var _performanceIndicator, _performanceIndicator2; + const i = performanceIndicators.length - 1; - if (performanceIndicators[i] && !performanceIndicators[i].value) { + if (!((_performanceIndicator = performanceIndicators[i]) !== null && _performanceIndicator !== void 0 && _performanceIndicator.value)) { currentValue = 0; } else { for (const key in performanceIndicators) { @@ -97787,7 +97801,7 @@ class PerformanceIndicatorService { } } - if (performanceIndicators[i] && !performanceIndicators[i].compareValue) { + if (!((_performanceIndicator2 = performanceIndicators[i]) !== null && _performanceIndicator2 !== void 0 && _performanceIndicator2.compareValue)) { compareValue = 0; } else { for (const key in performanceIndicators) { @@ -98246,6 +98260,8 @@ class QuizService { async getMaxLoadOnLastInterval(timeStep, interval, fluidType) { + var _graphData; + let dateMax = _luxon.DateTime.local().setZone('utc', { keepLocalTime: true }); @@ -98258,7 +98274,9 @@ class QuizService { }; let graphData = await consumptionService.getGraphData(interval, timeStep, fluidType); - if (graphData && graphData.actualData) { + if ((_graphData = graphData) !== null && _graphData !== void 0 && _graphData.actualData) { + var _graphData3; + max = Math.max(...graphData.actualData.map(d => d.value)); if (max == -1) { @@ -98286,6 +98304,8 @@ class QuizService { } do { + var _graphData2; + newInterval.startDate = newInterval.startDate.minus(objectTimeStep); newInterval.endDate = newInterval.endDate.minus(objectTimeStep); limit.date = newInterval.startDate; @@ -98300,7 +98320,7 @@ class QuizService { if (graphData && graphData.actualData) { max = Math.max(...graphData.actualData.map(d => d.value)); } - } while (max == -1 && graphData && graphData.actualData && !limit.reached); + } while (max == -1 && (_graphData2 = graphData) !== null && _graphData2 !== void 0 && _graphData2.actualData && !limit.reached); } if (limit.reached) { @@ -98317,7 +98337,7 @@ class QuizService { graphData = await consumptionService.getGraphData(newInterval, timeStep, fluidType); } - if (graphData && graphData.actualData) { + if ((_graphData3 = graphData) !== null && _graphData3 !== void 0 && _graphData3.actualData) { max = Math.max(...graphData.actualData.map(d => d.value)); graphData.actualData.forEach(d => { if (d.value === max) dateMax = d.date; @@ -99707,7 +99727,7 @@ class TermsService { const { data: [terms] } = await this._client.query(query); - if (terms && terms.accepted) return true;else return false; + if (terms !== null && terms !== void 0 && terms.accepted) return true;else return false; } /** * Compares the version number in the last term with the current app CGU version in the manifest diff --git a/services/consumptionAlert/ecolyo.js b/services/consumptionAlert/ecolyo.js index 59d6b22cd..51089d93c 100644 --- a/services/consumptionAlert/ecolyo.js +++ b/services/consumptionAlert/ecolyo.js @@ -77494,8 +77494,10 @@ class ConsumptionDataManager { let allData; if (isHome) { + var _allData; + allData = await this.getGraphData(maxTimePeriod, timeStep, fluidTypes, undefined, compareMaxTimePeriod, isHome); - return allData && allData.actualData ? Math.max(...allData.actualData.map(d => d.value)) : 0; + return (_allData = allData) !== null && _allData !== void 0 && _allData.actualData ? Math.max(...allData.actualData.map(d => d.value)) : 0; } else { const max = await this._queryRunnerService.fetchFluidMaxData(maxTimePeriod, timeStep, fluidTypes[0], withDate); return max; @@ -77640,7 +77642,7 @@ class ConsumptionDataManager { async checkDoctypeEntries(fluideType, timeStep) { const queryResult = await this._queryRunnerService.getEntries(fluideType, timeStep); - if (queryResult && queryResult.data.length > 0) { + if ((queryResult === null || queryResult === void 0 ? void 0 : queryResult.data.length) > 0) { return true; } @@ -77664,7 +77666,9 @@ class ConsumptionDataManager { } aggregateGraphData(singleFluidCharts) { - if (singleFluidCharts && singleFluidCharts[0].chartData) { + var _singleFluidCharts$; + + if ((_singleFluidCharts$ = singleFluidCharts[0]) !== null && _singleFluidCharts$ !== void 0 && _singleFluidCharts$.chartData) { const converterService = new _converter.default(); const resultChartData = { actualData: [], @@ -77995,7 +77999,7 @@ class ConsumptionFormatterService { }); } - if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= fluidStatus.firstDataDate && data.date <= fluidStatus.lastDataDate) { + if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.firstDataDate) && data.date <= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.lastDataDate)) { return _objectSpread(_objectSpread({}, data), {}, { state: data.value === -1 ? _dataload.DataloadState.HOLE : _dataload.DataloadState.VALID }); @@ -78644,9 +78648,9 @@ const isLastPeriodReached = (date, timeStep) => { exports.isLastPeriodReached = isLastPeriodReached; const getLagDays = fluidTypes => { - if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { + if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { return 3; - } else if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { + } else if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { return 2; } else { return 1; @@ -79141,7 +79145,7 @@ class QueryRunner { const query = this.buildListQuery(timeStep, timePeriod, fluidType, this._max_limit); const result = await this.fetchData(query); - if (result && result.data) { + if (result !== null && result !== void 0 && result.data) { const filteredResult = this.filterDataList(result, timePeriod); const mappedResult = this.mapDataList(filteredResult); return mappedResult; @@ -79173,7 +79177,7 @@ class QueryRunner { return Math.max(lastDayOfPreviousMonthResult && lastDayOfPreviousMonthResult.data[0] ? lastDayOfPreviousMonthResult.data[0].load : 0, result && result.data[0] ? result.data[0].load : 0); } - if (result && result.data) { + if (result !== null && result !== void 0 && result.data) { const filteredResult = this.filterDataList(result, maxTimePeriod); const mappedResult = this.mapDataList(filteredResult); @@ -79188,10 +79192,12 @@ class QueryRunner { } async getFirstDateData(fluidType) { + var _result$data$, _result$data$2, _result$data$3; + const query = this.buildFirstDateQuery(fluidType, 1); const result = await this.fetchData(query); - if (result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day) { + if (result !== null && result !== void 0 && (_result$data$ = result.data[0]) !== null && _result$data$ !== void 0 && _result$data$.year && result !== null && result !== void 0 && (_result$data$2 = result.data[0]) !== null && _result$data$2 !== void 0 && _result$data$2.month && result !== null && result !== void 0 && (_result$data$3 = result.data[0]) !== null && _result$data$3 !== void 0 && _result$data$3.day) { return _luxon.DateTime.local(result.data[0].year, result.data[0].month, result.data[0].day, result.data[0].hour ? result.data[0].hour : 0, result.data[0].minute ? result.data[0].minute : 0).setZone('utc', { keepLocalTime: true }); @@ -79201,10 +79207,12 @@ class QueryRunner { } async getLastDateData(fluidType) { + var _result$data$4, _result$data$5, _result$data$6; + const query = this.buildLastDateQuery(fluidType, 1); const result = await this.fetchData(query); - if (result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day) { + if (result !== null && result !== void 0 && (_result$data$4 = result.data[0]) !== null && _result$data$4 !== void 0 && _result$data$4.year && result !== null && result !== void 0 && (_result$data$5 = result.data[0]) !== null && _result$data$5 !== void 0 && _result$data$5.month && result !== null && result !== void 0 && (_result$data$6 = result.data[0]) !== null && _result$data$6 !== void 0 && _result$data$6.day) { return _luxon.DateTime.local(result.data[0].year, result.data[0].month, result.data[0].day, result.data[0].hour ? result.data[0].hour : 0, result.data[0].minute ? result.data[0].minute : 0).setZone('utc', { keepLocalTime: true }); diff --git a/services/enedisHalfHourMonthlyAnalysis/ecolyo.js b/services/enedisHalfHourMonthlyAnalysis/ecolyo.js index 86f7be983..a65d85be9 100644 --- a/services/enedisHalfHourMonthlyAnalysis/ecolyo.js +++ b/services/enedisHalfHourMonthlyAnalysis/ecolyo.js @@ -77404,8 +77404,10 @@ class ConsumptionDataManager { let allData; if (isHome) { + var _allData; + allData = await this.getGraphData(maxTimePeriod, timeStep, fluidTypes, undefined, compareMaxTimePeriod, isHome); - return allData && allData.actualData ? Math.max(...allData.actualData.map(d => d.value)) : 0; + return (_allData = allData) !== null && _allData !== void 0 && _allData.actualData ? Math.max(...allData.actualData.map(d => d.value)) : 0; } else { const max = await this._queryRunnerService.fetchFluidMaxData(maxTimePeriod, timeStep, fluidTypes[0], withDate); return max; @@ -77550,7 +77552,7 @@ class ConsumptionDataManager { async checkDoctypeEntries(fluideType, timeStep) { const queryResult = await this._queryRunnerService.getEntries(fluideType, timeStep); - if (queryResult && queryResult.data.length > 0) { + if ((queryResult === null || queryResult === void 0 ? void 0 : queryResult.data.length) > 0) { return true; } @@ -77574,7 +77576,9 @@ class ConsumptionDataManager { } aggregateGraphData(singleFluidCharts) { - if (singleFluidCharts && singleFluidCharts[0].chartData) { + var _singleFluidCharts$; + + if ((_singleFluidCharts$ = singleFluidCharts[0]) !== null && _singleFluidCharts$ !== void 0 && _singleFluidCharts$.chartData) { const converterService = new _converter.default(); const resultChartData = { actualData: [], @@ -77905,7 +77909,7 @@ class ConsumptionFormatterService { }); } - if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= fluidStatus.firstDataDate && data.date <= fluidStatus.lastDataDate) { + if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.firstDataDate) && data.date <= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.lastDataDate)) { return _objectSpread(_objectSpread({}, data), {}, { state: data.value === -1 ? _dataload.DataloadState.HOLE : _dataload.DataloadState.VALID }); @@ -78554,9 +78558,9 @@ const isLastPeriodReached = (date, timeStep) => { exports.isLastPeriodReached = isLastPeriodReached; const getLagDays = fluidTypes => { - if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { + if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { return 3; - } else if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { + } else if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { return 2; } else { return 1; @@ -79051,7 +79055,7 @@ class QueryRunner { const query = this.buildListQuery(timeStep, timePeriod, fluidType, this._max_limit); const result = await this.fetchData(query); - if (result && result.data) { + if (result !== null && result !== void 0 && result.data) { const filteredResult = this.filterDataList(result, timePeriod); const mappedResult = this.mapDataList(filteredResult); return mappedResult; @@ -79083,7 +79087,7 @@ class QueryRunner { return Math.max(lastDayOfPreviousMonthResult && lastDayOfPreviousMonthResult.data[0] ? lastDayOfPreviousMonthResult.data[0].load : 0, result && result.data[0] ? result.data[0].load : 0); } - if (result && result.data) { + if (result !== null && result !== void 0 && result.data) { const filteredResult = this.filterDataList(result, maxTimePeriod); const mappedResult = this.mapDataList(filteredResult); @@ -79098,10 +79102,12 @@ class QueryRunner { } async getFirstDateData(fluidType) { + var _result$data$, _result$data$2, _result$data$3; + const query = this.buildFirstDateQuery(fluidType, 1); const result = await this.fetchData(query); - if (result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day) { + if (result !== null && result !== void 0 && (_result$data$ = result.data[0]) !== null && _result$data$ !== void 0 && _result$data$.year && result !== null && result !== void 0 && (_result$data$2 = result.data[0]) !== null && _result$data$2 !== void 0 && _result$data$2.month && result !== null && result !== void 0 && (_result$data$3 = result.data[0]) !== null && _result$data$3 !== void 0 && _result$data$3.day) { return _luxon.DateTime.local(result.data[0].year, result.data[0].month, result.data[0].day, result.data[0].hour ? result.data[0].hour : 0, result.data[0].minute ? result.data[0].minute : 0).setZone('utc', { keepLocalTime: true }); @@ -79111,10 +79117,12 @@ class QueryRunner { } async getLastDateData(fluidType) { + var _result$data$4, _result$data$5, _result$data$6; + const query = this.buildLastDateQuery(fluidType, 1); const result = await this.fetchData(query); - if (result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day) { + if (result !== null && result !== void 0 && (_result$data$4 = result.data[0]) !== null && _result$data$4 !== void 0 && _result$data$4.year && result !== null && result !== void 0 && (_result$data$5 = result.data[0]) !== null && _result$data$5 !== void 0 && _result$data$5.month && result !== null && result !== void 0 && (_result$data$6 = result.data[0]) !== null && _result$data$6 !== void 0 && _result$data$6.day) { return _luxon.DateTime.local(result.data[0].year, result.data[0].month, result.data[0].day, result.data[0].hour ? result.data[0].hour : 0, result.data[0].minute ? result.data[0].minute : 0).setZone('utc', { keepLocalTime: true }); @@ -80107,7 +80115,7 @@ const getMonthMaxPower = async (month, year, client) => { const data = await emas.getMaxPowerByDate(year, month); const maxPowerArray = []; - if (data && data.length) { + if (data !== null && data !== void 0 && data.length) { for (const day of data) { maxPowerArray.push(day.load); } @@ -80235,10 +80243,12 @@ const syncEnedisMonthlyAnalysisDataDoctype = async ({ log('info', 'Getting first endis half hour data date'); if (lastEnedisMonthlyAnalysis.length > 0) { + var _firstEnedisMonthlyAn, _firstEnedisMonthlyAn2; + //If user has more than one entry (already synced), fetch the full history const firstEnedisMonthlyAnalysis = await cs.getFirsDataDateFromDoctype(_doctypes.ENEDIS_MONTHLY_ANALYSIS_DATA_DOCTYPE); - if (firstEnedisMonthlyAnalysis && firstEnedisMonthlyAnalysis[0].month === firstMinuteData[0].month && firstEnedisMonthlyAnalysis[0].year === firstMinuteData[0].year) { + if (((_firstEnedisMonthlyAn = firstEnedisMonthlyAnalysis[0]) === null || _firstEnedisMonthlyAn === void 0 ? void 0 : _firstEnedisMonthlyAn.month) === firstMinuteData[0].month && ((_firstEnedisMonthlyAn2 = firstEnedisMonthlyAnalysis[0]) === null || _firstEnedisMonthlyAn2 === void 0 ? void 0 : _firstEnedisMonthlyAn2.year) === firstMinuteData[0].year) { log('info', 'Every Enedis Anlysis already synchronized'); return; } else if (firstEnedisMonthlyAnalysis) { diff --git a/services/fluidsPrices/ecolyo.js b/services/fluidsPrices/ecolyo.js index 24e5f21c7..02fa858a5 100644 --- a/services/fluidsPrices/ecolyo.js +++ b/services/fluidsPrices/ecolyo.js @@ -77404,8 +77404,10 @@ class ConsumptionDataManager { let allData; if (isHome) { + var _allData; + allData = await this.getGraphData(maxTimePeriod, timeStep, fluidTypes, undefined, compareMaxTimePeriod, isHome); - return allData && allData.actualData ? Math.max(...allData.actualData.map(d => d.value)) : 0; + return (_allData = allData) !== null && _allData !== void 0 && _allData.actualData ? Math.max(...allData.actualData.map(d => d.value)) : 0; } else { const max = await this._queryRunnerService.fetchFluidMaxData(maxTimePeriod, timeStep, fluidTypes[0], withDate); return max; @@ -77550,7 +77552,7 @@ class ConsumptionDataManager { async checkDoctypeEntries(fluideType, timeStep) { const queryResult = await this._queryRunnerService.getEntries(fluideType, timeStep); - if (queryResult && queryResult.data.length > 0) { + if ((queryResult === null || queryResult === void 0 ? void 0 : queryResult.data.length) > 0) { return true; } @@ -77574,7 +77576,9 @@ class ConsumptionDataManager { } aggregateGraphData(singleFluidCharts) { - if (singleFluidCharts && singleFluidCharts[0].chartData) { + var _singleFluidCharts$; + + if ((_singleFluidCharts$ = singleFluidCharts[0]) !== null && _singleFluidCharts$ !== void 0 && _singleFluidCharts$.chartData) { const converterService = new _converter.default(); const resultChartData = { actualData: [], @@ -77905,7 +77909,7 @@ class ConsumptionFormatterService { }); } - if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= fluidStatus.firstDataDate && data.date <= fluidStatus.lastDataDate) { + if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.firstDataDate) && data.date <= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.lastDataDate)) { return _objectSpread(_objectSpread({}, data), {}, { state: data.value === -1 ? _dataload.DataloadState.HOLE : _dataload.DataloadState.VALID }); @@ -78554,9 +78558,9 @@ const isLastPeriodReached = (date, timeStep) => { exports.isLastPeriodReached = isLastPeriodReached; const getLagDays = fluidTypes => { - if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { + if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { return 3; - } else if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { + } else if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { return 2; } else { return 1; @@ -79051,7 +79055,7 @@ class QueryRunner { const query = this.buildListQuery(timeStep, timePeriod, fluidType, this._max_limit); const result = await this.fetchData(query); - if (result && result.data) { + if (result !== null && result !== void 0 && result.data) { const filteredResult = this.filterDataList(result, timePeriod); const mappedResult = this.mapDataList(filteredResult); return mappedResult; @@ -79083,7 +79087,7 @@ class QueryRunner { return Math.max(lastDayOfPreviousMonthResult && lastDayOfPreviousMonthResult.data[0] ? lastDayOfPreviousMonthResult.data[0].load : 0, result && result.data[0] ? result.data[0].load : 0); } - if (result && result.data) { + if (result !== null && result !== void 0 && result.data) { const filteredResult = this.filterDataList(result, maxTimePeriod); const mappedResult = this.mapDataList(filteredResult); @@ -79098,10 +79102,12 @@ class QueryRunner { } async getFirstDateData(fluidType) { + var _result$data$, _result$data$2, _result$data$3; + const query = this.buildFirstDateQuery(fluidType, 1); const result = await this.fetchData(query); - if (result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day) { + if (result !== null && result !== void 0 && (_result$data$ = result.data[0]) !== null && _result$data$ !== void 0 && _result$data$.year && result !== null && result !== void 0 && (_result$data$2 = result.data[0]) !== null && _result$data$2 !== void 0 && _result$data$2.month && result !== null && result !== void 0 && (_result$data$3 = result.data[0]) !== null && _result$data$3 !== void 0 && _result$data$3.day) { return _luxon.DateTime.local(result.data[0].year, result.data[0].month, result.data[0].day, result.data[0].hour ? result.data[0].hour : 0, result.data[0].minute ? result.data[0].minute : 0).setZone('utc', { keepLocalTime: true }); @@ -79111,10 +79117,12 @@ class QueryRunner { } async getLastDateData(fluidType) { + var _result$data$4, _result$data$5, _result$data$6; + const query = this.buildLastDateQuery(fluidType, 1); const result = await this.fetchData(query); - if (result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day) { + if (result !== null && result !== void 0 && (_result$data$4 = result.data[0]) !== null && _result$data$4 !== void 0 && _result$data$4.year && result !== null && result !== void 0 && (_result$data$5 = result.data[0]) !== null && _result$data$5 !== void 0 && _result$data$5.month && result !== null && result !== void 0 && (_result$data$6 = result.data[0]) !== null && _result$data$6 !== void 0 && _result$data$6.day) { return _luxon.DateTime.local(result.data[0].year, result.data[0].month, result.data[0].day, result.data[0].hour ? result.data[0].hour : 0, result.data[0].minute ? result.data[0].minute : 0).setZone('utc', { keepLocalTime: true }); @@ -80224,7 +80232,7 @@ const aggregatePrices = async (qr, cdm, firstDate, today, fluidType) => { const docToUpdate = await qr.fetchFluidRawDoctype(tp, ts, fluidType); - if (docToUpdate && data && docToUpdate.data && data.data) { + if (docToUpdate !== null && docToUpdate !== void 0 && docToUpdate.data && data !== null && data !== void 0 && data.data) { docToUpdate.data[0].price = data.data.map(price).reduce(sum); } // Save updated docs @@ -80351,7 +80359,7 @@ const applyPrices = async (client, fluidType) => { const data = await qr.fetchFluidRawDoctype(tp, timeStep, fluidType); // If lastItem has a price, skip this day (in order to save perf) - const lastItem = data && data.data && data.data[data.data.length - 1]; + const lastItem = (data === null || data === void 0 ? void 0 : data.data) && data.data[data.data.length - 1]; if (lastItem && priceData) { //if a price has been updated in backoffice re-calculates all price from the firstEditedPriceDate diff --git a/services/monthlyReportNotification/ecolyo.js b/services/monthlyReportNotification/ecolyo.js index e9853d4af..3766aeca6 100644 --- a/services/monthlyReportNotification/ecolyo.js +++ b/services/monthlyReportNotification/ecolyo.js @@ -77494,8 +77494,10 @@ class ConsumptionDataManager { let allData; if (isHome) { + var _allData; + allData = await this.getGraphData(maxTimePeriod, timeStep, fluidTypes, undefined, compareMaxTimePeriod, isHome); - return allData && allData.actualData ? Math.max(...allData.actualData.map(d => d.value)) : 0; + return (_allData = allData) !== null && _allData !== void 0 && _allData.actualData ? Math.max(...allData.actualData.map(d => d.value)) : 0; } else { const max = await this._queryRunnerService.fetchFluidMaxData(maxTimePeriod, timeStep, fluidTypes[0], withDate); return max; @@ -77640,7 +77642,7 @@ class ConsumptionDataManager { async checkDoctypeEntries(fluideType, timeStep) { const queryResult = await this._queryRunnerService.getEntries(fluideType, timeStep); - if (queryResult && queryResult.data.length > 0) { + if ((queryResult === null || queryResult === void 0 ? void 0 : queryResult.data.length) > 0) { return true; } @@ -77664,7 +77666,9 @@ class ConsumptionDataManager { } aggregateGraphData(singleFluidCharts) { - if (singleFluidCharts && singleFluidCharts[0].chartData) { + var _singleFluidCharts$; + + if ((_singleFluidCharts$ = singleFluidCharts[0]) !== null && _singleFluidCharts$ !== void 0 && _singleFluidCharts$.chartData) { const converterService = new _converter.default(); const resultChartData = { actualData: [], @@ -77995,7 +77999,7 @@ class ConsumptionFormatterService { }); } - if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= fluidStatus.firstDataDate && data.date <= fluidStatus.lastDataDate) { + if (fluidStatus.firstDataDate && fluidStatus.lastDataDate && data.date >= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.firstDataDate) && data.date <= (fluidStatus === null || fluidStatus === void 0 ? void 0 : fluidStatus.lastDataDate)) { return _objectSpread(_objectSpread({}, data), {}, { state: data.value === -1 ? _dataload.DataloadState.HOLE : _dataload.DataloadState.VALID }); @@ -78644,9 +78648,9 @@ const isLastPeriodReached = (date, timeStep) => { exports.isLastPeriodReached = isLastPeriodReached; const getLagDays = fluidTypes => { - if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { + if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.WATER)) { return 3; - } else if (fluidTypes && fluidTypes.length > 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { + } else if ((fluidTypes === null || fluidTypes === void 0 ? void 0 : fluidTypes.length) > 0 && fluidTypes !== null && fluidTypes !== void 0 && fluidTypes.includes(_fluid.FluidType.GAS)) { return 2; } else { return 1; @@ -79141,7 +79145,7 @@ class QueryRunner { const query = this.buildListQuery(timeStep, timePeriod, fluidType, this._max_limit); const result = await this.fetchData(query); - if (result && result.data) { + if (result !== null && result !== void 0 && result.data) { const filteredResult = this.filterDataList(result, timePeriod); const mappedResult = this.mapDataList(filteredResult); return mappedResult; @@ -79173,7 +79177,7 @@ class QueryRunner { return Math.max(lastDayOfPreviousMonthResult && lastDayOfPreviousMonthResult.data[0] ? lastDayOfPreviousMonthResult.data[0].load : 0, result && result.data[0] ? result.data[0].load : 0); } - if (result && result.data) { + if (result !== null && result !== void 0 && result.data) { const filteredResult = this.filterDataList(result, maxTimePeriod); const mappedResult = this.mapDataList(filteredResult); @@ -79188,10 +79192,12 @@ class QueryRunner { } async getFirstDateData(fluidType) { + var _result$data$, _result$data$2, _result$data$3; + const query = this.buildFirstDateQuery(fluidType, 1); const result = await this.fetchData(query); - if (result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day) { + if (result !== null && result !== void 0 && (_result$data$ = result.data[0]) !== null && _result$data$ !== void 0 && _result$data$.year && result !== null && result !== void 0 && (_result$data$2 = result.data[0]) !== null && _result$data$2 !== void 0 && _result$data$2.month && result !== null && result !== void 0 && (_result$data$3 = result.data[0]) !== null && _result$data$3 !== void 0 && _result$data$3.day) { return _luxon.DateTime.local(result.data[0].year, result.data[0].month, result.data[0].day, result.data[0].hour ? result.data[0].hour : 0, result.data[0].minute ? result.data[0].minute : 0).setZone('utc', { keepLocalTime: true }); @@ -79201,10 +79207,12 @@ class QueryRunner { } async getLastDateData(fluidType) { + var _result$data$4, _result$data$5, _result$data$6; + const query = this.buildLastDateQuery(fluidType, 1); const result = await this.fetchData(query); - if (result && result.data && result.data[0] && result.data[0].year && result.data[0].month && result.data[0].day) { + if (result !== null && result !== void 0 && (_result$data$4 = result.data[0]) !== null && _result$data$4 !== void 0 && _result$data$4.year && result !== null && result !== void 0 && (_result$data$5 = result.data[0]) !== null && _result$data$5 !== void 0 && _result$data$5.month && result !== null && result !== void 0 && (_result$data$6 = result.data[0]) !== null && _result$data$6 !== void 0 && _result$data$6.day) { return _luxon.DateTime.local(result.data[0].year, result.data[0].month, result.data[0].day, result.data[0].hour ? result.data[0].hour : 0, result.data[0].minute ? result.data[0].minute : 0).setZone('utc', { keepLocalTime: true }); @@ -148396,6 +148404,8 @@ const getMonthlyReport = async (year, month, client) => { const monthlyReportNotification = async ({ client }) => { + var _userProfil; + log('info', 'Fetching user profile...'); const upm = new _profile.default(client); let userProfil = await upm.getProfile(); @@ -148452,7 +148462,7 @@ const monthlyReportNotification = async ({ userProfil = await upm.getProfile(); let token = undefined; - if (userProfil && userProfil.mailToken) { + if ((_userProfil = userProfil) !== null && _userProfil !== void 0 && _userProfil.mailToken) { token = userProfil.mailToken; } diff --git a/vendors/ecolyo.08cea87f518c2cc2790a.js b/vendors/ecolyo.3ddba75f57f0da86cb09.js similarity index 99% rename from vendors/ecolyo.08cea87f518c2cc2790a.js rename to vendors/ecolyo.3ddba75f57f0da86cb09.js index 02ed9eb1b..93babb2d6 100644 --- a/vendors/ecolyo.08cea87f518c2cc2790a.js +++ b/vendors/ecolyo.3ddba75f57f0da86cb09.js @@ -239918,6 +239918,7 @@ module.exports = setMinutes "use strict"; __webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clsx", function() { return clsx; }); function toVal(mix) { var k, y, str=''; @@ -239946,7 +239947,7 @@ function toVal(mix) { return str; } -/* harmony default export */ __webpack_exports__["default"] = (function () { +function clsx() { var i=0, tmp, x, str=''; while (i < arguments.length) { if (tmp = arguments[i++]) { @@ -239957,7 +239958,9 @@ function toVal(mix) { } } return str; -}); +} + +/* harmony default export */ __webpack_exports__["default"] = (clsx); /***/ }), -- GitLab