cozy-harvest-lib 32.0.0 → 32.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/components/KonnectorConfiguration/ConfigurationTab/ContractItemSecondaryText.js +4 -4
- package/dist/datacards/GeoDataCard.js +2 -2
- package/dist/datacards/trips.js +2 -2
- package/dist/helpers/triggers.js +1 -2
- package/package.json +5 -4
- package/src/components/KonnectorConfiguration/ConfigurationTab/ContractItemSecondaryText.jsx +4 -4
- package/src/datacards/GeoDataCard.jsx +2 -2
- package/src/datacards/trips.js +2 -2
- package/src/helpers/triggers.js +1 -2
- package/test/AppLike.jsx +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [32.2.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@32.1.0...cozy-harvest-lib@32.2.0) (2024-12-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **cozy-harvest:** Add missing react-redux dep ([27ee882](https://github.com/cozy/cozy-libs/commit/27ee8822365d51031a8b61ee4816005c2ea5dc33))
|
|
12
|
+
* **cozy-harvest:** Prefer use createMockClient for tests ([26a5e30](https://github.com/cozy/cozy-libs/commit/26a5e3076cb8a0928ca95bec1a9a75440ec7e7cb))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [32.1.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@32.0.0...cozy-harvest-lib@32.1.0) (2024-12-23)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* Upgrade date-fns to 2.30.0 ([aaf21c9](https://github.com/cozy/cozy-libs/commit/aaf21c98c239ca661d29b5f8a98a4014dc140ded))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
# [32.0.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@31.0.27...cozy-harvest-lib@32.0.0) (2024-12-23)
|
|
7
30
|
|
|
8
31
|
|
package/dist/components/KonnectorConfiguration/ConfigurationTab/ContractItemSecondaryText.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import dateFnsLocaleEn from 'date-fns/locale/en';
|
|
1
|
+
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
|
|
2
|
+
import dateFnsLocaleEn from 'date-fns/locale/en-US';
|
|
3
3
|
import dateFnsLocaleEs from 'date-fns/locale/es';
|
|
4
4
|
import dateFnsLocalefr from 'date-fns/locale/fr';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
@@ -34,7 +34,7 @@ var ContractItemSecondaryText = function ContractItemSecondaryText(_ref) {
|
|
|
34
34
|
style: {
|
|
35
35
|
color: '#EFA82D'
|
|
36
36
|
}
|
|
37
|
-
},
|
|
37
|
+
}, formatDistanceToNow(new Date(contract.metadata.updatedAt), {
|
|
38
38
|
addSuffix: true,
|
|
39
39
|
locale: dateFnsLocales[lang]
|
|
40
40
|
})));
|
|
@@ -53,7 +53,7 @@ var ContractItemSecondaryText = function ContractItemSecondaryText(_ref) {
|
|
|
53
53
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
|
|
54
54
|
icon: SyncIcon,
|
|
55
55
|
size: 8
|
|
56
|
-
}), ' ',
|
|
56
|
+
}), ' ', formatDistanceToNow(new Date(contract.metadata.updatedAt), {
|
|
57
57
|
addSuffix: true,
|
|
58
58
|
locale: dateFnsLocales[lang]
|
|
59
59
|
}));
|
|
@@ -11,8 +11,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
11
11
|
|
|
12
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
13
|
|
|
14
|
-
import isSameDay from 'date-fns/
|
|
15
|
-
import isSameYear from 'date-fns/
|
|
14
|
+
import isSameDay from 'date-fns/isSameDay';
|
|
15
|
+
import isSameYear from 'date-fns/isSameYear';
|
|
16
16
|
import L from 'leaflet';
|
|
17
17
|
import 'leaflet/dist/leaflet.css';
|
|
18
18
|
import sortBy from 'lodash/sortBy';
|
package/dist/datacards/trips.js
CHANGED
|
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
|
|
5
5
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import formatDistance from 'date-fns/formatDistance';
|
|
8
8
|
import flatten from 'lodash/flatten';
|
|
9
9
|
import get from 'lodash/get';
|
|
10
10
|
import keyBy from 'lodash/keyBy';
|
|
@@ -80,7 +80,7 @@ export var getEndPlaceDisplayName = function getEndPlaceDisplayName(trip) {
|
|
|
80
80
|
export var getFormattedDuration = function getFormattedDuration(trip) {
|
|
81
81
|
var startDate = new Date(trip.properties.start_fmt_time);
|
|
82
82
|
var endDate = new Date(trip.properties.end_fmt_time);
|
|
83
|
-
return
|
|
83
|
+
return formatDistance(endDate, startDate);
|
|
84
84
|
};
|
|
85
85
|
export var getModes = function getModes(trip) {
|
|
86
86
|
return uniq(flatten(trip.features.map(function (feature) {
|
package/dist/helpers/triggers.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import DateFns from 'date-fns';
|
|
2
1
|
import get from 'lodash/get';
|
|
3
2
|
import { toFrequency } from './cron';
|
|
4
3
|
import { KonnectorJobError } from './konnectors';
|
|
@@ -22,7 +21,7 @@ export var getKonnectorJobError = function getKonnectorJobError(trigger) {
|
|
|
22
21
|
export var getLastSuccessDate = function getLastSuccessDate(trigger) {
|
|
23
22
|
var lastSuccessDate = !!trigger && !!trigger.current_state && trigger.current_state.last_success;
|
|
24
23
|
if (!lastSuccessDate) return null;
|
|
25
|
-
return
|
|
24
|
+
return new Date(lastSuccessDate);
|
|
26
25
|
};
|
|
27
26
|
export var getKonnectorSlug = function getKonnectorSlug(trigger) {
|
|
28
27
|
return get(trigger, 'message.konnector');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-harvest-lib",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.2.0",
|
|
4
4
|
"description": "Provides logic, modules and components for Cozy's harvest applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"cozy-bi-auth": "0.0.25",
|
|
35
35
|
"cozy-doctypes": "^1.97.1",
|
|
36
36
|
"cozy-logger": "^1.16.1",
|
|
37
|
-
"date-fns": "
|
|
37
|
+
"date-fns": "2.30.0",
|
|
38
38
|
"final-form": "^4.18.5",
|
|
39
39
|
"lodash": "^4.17.19",
|
|
40
40
|
"microee": "^0.0.6",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"react-final-form": "^3.7.0",
|
|
43
43
|
"react-json-print": "^0.1.3",
|
|
44
44
|
"react-markdown": "^4.2.2",
|
|
45
|
+
"react-redux": "7.2.2",
|
|
45
46
|
"use-deep-compare-effect": "^1.8.1",
|
|
46
47
|
"uuid": "^3.3.2"
|
|
47
48
|
},
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
"cozy-realtime": "^5.6.2",
|
|
75
76
|
"cozy-tsconfig": "^1.8.1",
|
|
76
77
|
"cozy-ui": "^115.0.2",
|
|
77
|
-
"cozy-viewer": "^11.3.
|
|
78
|
+
"cozy-viewer": "^11.3.4",
|
|
78
79
|
"enzyme": "3.11.0",
|
|
79
80
|
"enzyme-adapter-react-16": "1.15.6",
|
|
80
81
|
"form-data": "4.0.0",
|
|
@@ -110,5 +111,5 @@
|
|
|
110
111
|
"react-router-dom": ">=6.14.2"
|
|
111
112
|
},
|
|
112
113
|
"sideEffects": false,
|
|
113
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "696d8e4c49efe1b1d5fcc3e63a8ab6a9fd6f0640"
|
|
114
115
|
}
|
package/src/components/KonnectorConfiguration/ConfigurationTab/ContractItemSecondaryText.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import dateFnsLocaleEn from 'date-fns/locale/en'
|
|
1
|
+
import formatDistanceToNow from 'date-fns/formatDistanceToNow'
|
|
2
|
+
import dateFnsLocaleEn from 'date-fns/locale/en-US'
|
|
3
3
|
import dateFnsLocaleEs from 'date-fns/locale/es'
|
|
4
4
|
import dateFnsLocalefr from 'date-fns/locale/fr'
|
|
5
5
|
import PropTypes from 'prop-types'
|
|
@@ -27,7 +27,7 @@ const ContractItemSecondaryText = ({ contract }) => {
|
|
|
27
27
|
<>
|
|
28
28
|
<Icon icon={SyncIcon} size={8} color="#FE952A" />{' '}
|
|
29
29
|
<span style={{ color: '#EFA82D' }}>
|
|
30
|
-
{
|
|
30
|
+
{formatDistanceToNow(new Date(contract.metadata.updatedAt), {
|
|
31
31
|
addSuffix: true,
|
|
32
32
|
locale: dateFnsLocales[lang]
|
|
33
33
|
})}
|
|
@@ -52,7 +52,7 @@ const ContractItemSecondaryText = ({ contract }) => {
|
|
|
52
52
|
return (
|
|
53
53
|
<>
|
|
54
54
|
<Icon icon={SyncIcon} size={8} />{' '}
|
|
55
|
-
{
|
|
55
|
+
{formatDistanceToNow(new Date(contract.metadata.updatedAt), {
|
|
56
56
|
addSuffix: true,
|
|
57
57
|
locale: dateFnsLocales[lang]
|
|
58
58
|
})}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import isSameDay from 'date-fns/
|
|
2
|
-
import isSameYear from 'date-fns/
|
|
1
|
+
import isSameDay from 'date-fns/isSameDay'
|
|
2
|
+
import isSameYear from 'date-fns/isSameYear'
|
|
3
3
|
import L from 'leaflet'
|
|
4
4
|
import 'leaflet/dist/leaflet.css'
|
|
5
5
|
import sortBy from 'lodash/sortBy'
|
package/src/datacards/trips.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import formatDistance from 'date-fns/formatDistance'
|
|
2
2
|
import flatten from 'lodash/flatten'
|
|
3
3
|
import get from 'lodash/get'
|
|
4
4
|
import keyBy from 'lodash/keyBy'
|
|
@@ -50,7 +50,7 @@ export const getEndPlaceDisplayName = trip => {
|
|
|
50
50
|
export const getFormattedDuration = trip => {
|
|
51
51
|
const startDate = new Date(trip.properties.start_fmt_time)
|
|
52
52
|
const endDate = new Date(trip.properties.end_fmt_time)
|
|
53
|
-
return
|
|
53
|
+
return formatDistance(endDate, startDate)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export const getModes = trip => {
|
package/src/helpers/triggers.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import DateFns from 'date-fns'
|
|
2
1
|
import get from 'lodash/get'
|
|
3
2
|
|
|
4
3
|
import { toFrequency } from './cron'
|
|
@@ -26,7 +25,7 @@ export const getLastSuccessDate = trigger => {
|
|
|
26
25
|
const lastSuccessDate =
|
|
27
26
|
!!trigger && !!trigger.current_state && trigger.current_state.last_success
|
|
28
27
|
if (!lastSuccessDate) return null
|
|
29
|
-
return
|
|
28
|
+
return new Date(lastSuccessDate)
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
export const getKonnectorSlug = trigger => get(trigger, 'message.konnector')
|
package/test/AppLike.jsx
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Provider as ReduxProvider } from 'react-redux'
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {
|
|
5
|
+
CozyProvider as CozyClientProvider,
|
|
6
|
+
createMockClient
|
|
7
|
+
} from 'cozy-client'
|
|
5
8
|
import { useCozyDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
|
|
6
9
|
import AlertProvider from 'cozy-ui/transpiled/react/providers/Alert'
|
|
7
10
|
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
@@ -11,8 +14,7 @@ import I18n from 'cozy-ui/transpiled/react/providers/I18n'
|
|
|
11
14
|
import DialogContext from '../src/components/DialogContext'
|
|
12
15
|
import enLocale from '../src/locales/en.json'
|
|
13
16
|
|
|
14
|
-
const defaultClient =
|
|
15
|
-
defaultClient.ensureStore()
|
|
17
|
+
const defaultClient = createMockClient({})
|
|
16
18
|
|
|
17
19
|
const AppLike = ({
|
|
18
20
|
client: clientOption,
|