diff --git a/index.js b/index.js index 0bd354d8688568aa89e3c1c147088aed03bf72bf..3cbe9178583e59d379e7fcdf0e149f08c29defa8 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,7 @@ const { verifyContract } = __webpack_require__(1599) const { terminateContract } = __webpack_require__(1601) const { getContractStartDate } = __webpack_require__(1602) const { getAccount, saveAccountData } = __webpack_require__(1603) -const { iSLocal } = __webpack_require__(1604) +const { isLocal } = __webpack_require__(1604) moment.locale('fr') // set the language moment.tz.setDefault('Europe/Paris') // set the timezone @@ -53,7 +53,7 @@ let startDailyDateString = startDailyDate.format('YYYY-MM-DD') const startLoadDate = moment().subtract(7, 'day') const endDate = moment() const endDateString = endDate.format('YYYY-MM-DD') -const ACCOUNT_ID = iSLocal() ? 'default_account_id' : 'enedis-sge-grandlyon' +const ACCOUNT_ID = isLocal() ? 'default_account_id' : 'enedis-sge-grandlyon' module.exports = new BaseKonnector(start) @@ -228449,7 +228449,7 @@ module.exports = { getContractStartDate } /***/ ((module, __unused_webpack_exports, __webpack_require__) => { const { log, updateOrCreate } = __webpack_require__(1) -const { iSLocal } = __webpack_require__(1604) +const { isLocal } = __webpack_require__(1604) const cozyClient = __webpack_require__(485) async function saveAccountData(accountId, accountData) { @@ -228469,7 +228469,7 @@ async function getAccount(accountId) { //TODO: refactor with usageof cozy-libs. Not working during implementation const accounts = await cozyClient.data.findAll('io.cozy.accounts') return accounts.filter(account => - iSLocal() ? account._id === accountId : account.account_type === accountId + isLocal() ? account._id === accountId : account.account_type === accountId )[0] } @@ -228480,7 +228480,7 @@ module.exports = { getAccount, saveAccountData } /* 1604 */ /***/ ((module) => { -function iSLocal() { +function isLocal() { return ( process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'local' || @@ -228488,7 +228488,7 @@ function iSLocal() { ) } -module.exports = { iSLocal } +module.exports = { isLocal } /***/ }) diff --git a/onDeleteAccount.js b/onDeleteAccount.js index 9cbc4d0e68598f58f0d840722938fd4ac5307dbc..12b657902795ec1d340726c6f0aede9049a897fd 100644 --- a/onDeleteAccount.js +++ b/onDeleteAccount.js @@ -227391,7 +227391,7 @@ module.exports = { terminateContract } /***/ ((module, __unused_webpack_exports, __webpack_require__) => { const { log, updateOrCreate } = __webpack_require__(1) -const { iSLocal } = __webpack_require__(1604) +const { isLocal } = __webpack_require__(1604) const cozyClient = __webpack_require__(485) async function saveAccountData(accountId, accountData) { @@ -227411,7 +227411,7 @@ async function getAccount(accountId) { //TODO: refactor with usageof cozy-libs. Not working during implementation const accounts = await cozyClient.data.findAll('io.cozy.accounts') return accounts.filter(account => - iSLocal() ? account._id === accountId : account.account_type === accountId + isLocal() ? account._id === accountId : account.account_type === accountId )[0] } @@ -227422,7 +227422,7 @@ module.exports = { getAccount, saveAccountData } /* 1604 */ /***/ ((module) => { -function iSLocal() { +function isLocal() { return ( process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'local' || @@ -227430,7 +227430,7 @@ function iSLocal() { ) } -module.exports = { iSLocal } +module.exports = { isLocal } /***/ }), @@ -227448,8 +227448,8 @@ const moment = __webpack_require__(1373) __webpack_require__(1510) moment.locale('fr') // set the language moment.tz.setDefault('Europe/Paris') // set the timezone -const { iSLocal } = __webpack_require__(1604) -const ACCOUNT_ID = iSLocal() ? 'default_account_id' : 'enedis-sge-grandlyon' +const { isLocal } = __webpack_require__(1604) +const ACCOUNT_ID = isLocal() ? 'default_account_id' : 'enedis-sge-grandlyon' async function onDeleteAccount() { log('info', 'Deleting account ...') @@ -227519,7 +227519,7 @@ module.exports = { onDeleteAccount } /***/ ((module, __unused_webpack_exports, __webpack_require__) => { const { log } = __webpack_require__(1) -const { iSLocal } = __webpack_require__(1604) +const { isLocal } = __webpack_require__(1604) function getAccountId() { log('info', `getAccountId`) @@ -227533,7 +227533,7 @@ function getAccountId() { function getAccountRev() { log('info', `getAccountRev`) try { - return iSLocal() + return isLocal() ? 'fakeAccountRev' : JSON.parse(process.env.COZY_FIELDS).account_rev } catch (err) { @@ -227547,7 +227547,7 @@ function getAccountRev() { */ function getAccountSecret() { try { - return iSLocal() + return isLocal() ? { baseUrl: 'https://test.fr', sgeLogin: 'test@test.com',