cozy-harvest-lib 22.2.0 → 22.4.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 CHANGED
@@ -3,6 +3,32 @@
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
+ # [22.4.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.3.0...cozy-harvest-lib@22.4.0) (2024-02-15)
7
+
8
+
9
+ ### Features
10
+
11
+ * **harvest:** Remove useless Spinner during the connection ([19f3216](https://github.com/cozy/cozy-libs/commit/19f32167dfa469459b6fffe94c633435229118c8))
12
+ * **harvest:** Upgrade cozy deps ([af60567](https://github.com/cozy/cozy-libs/commit/af605676e89727b403b73cf898ce4ad7973f4db6))
13
+ * **harvest:** Upgrade cozy-ui from 95.9.0 to 103.2.0 ([adc3937](https://github.com/cozy/cozy-libs/commit/adc393742f022615415c8c4461248100db63ac53))
14
+
15
+
16
+
17
+
18
+
19
+ # [22.3.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.2.0...cozy-harvest-lib@22.3.0) (2024-01-31)
20
+
21
+
22
+ ### Features
23
+
24
+ * Add doctype debug cards for bills, files and identities ([1e65d7d](https://github.com/cozy/cozy-libs/commit/1e65d7dde77776a19dc545073968b7b03b09a5b5))
25
+ * Add realtime to doctype debug cards ([36609e5](https://github.com/cozy/cozy-libs/commit/36609e5d9d33ace65e9ae74a56db6b0ed2f86e92))
26
+ * Pass the sourceAccountIdentifier to harvest cards ([309e16c](https://github.com/cozy/cozy-libs/commit/309e16cfb17ca08ded268ac368e8fb27dcd97710))
27
+
28
+
29
+
30
+
31
+
6
32
  # [22.2.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.1.0...cozy-harvest-lib@22.2.0) (2024-01-29)
7
33
 
8
34
 
@@ -3,9 +3,9 @@ import { createPortal } from 'react-dom';
3
3
  import { useWebviewIntent } from 'cozy-intent';
4
4
  import Backdrop from 'cozy-ui/transpiled/react/Backdrop';
5
5
  import LinearProgress from 'cozy-ui/transpiled/react/LinearProgress';
6
- import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme';
7
6
  import Typography from 'cozy-ui/transpiled/react/Typography';
8
7
  import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
8
+ import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme';
9
9
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
10
10
  import { makeStyles } from 'cozy-ui/transpiled/react/styles';
11
11
  var useStyles = makeStyles({
@@ -25,7 +25,7 @@ export var ConnectionBackdrop = function ConnectionBackdrop(_ref) {
25
25
  var _useI18n = useI18n(),
26
26
  t = _useI18n.t;
27
27
 
28
- return /*#__PURE__*/React.createElement(MuiCozyTheme, {
28
+ return /*#__PURE__*/React.createElement(CozyTheme, {
29
29
  variant: "inverted"
30
30
  }, /*#__PURE__*/React.createElement("div", {
31
31
  className: styles.container
@@ -1,4 +1,5 @@
1
1
  import React, { useMemo } from 'react';
2
+ import { models } from 'cozy-client';
2
3
  import { useDatacardOptions } from './DatacardOptionsContext';
3
4
 
4
5
  var findSuitableDataCards = function findSuitableDataCards(datacardOptions, datacardContext) {
@@ -28,7 +29,8 @@ var Datacards = function Datacards(_ref2) {
28
29
  key: i,
29
30
  konnector: konnector,
30
31
  trigger: trigger,
31
- accountId: trigger.message.account
32
+ accountId: trigger.message.account,
33
+ sourceAccountIdentifier: models.account.getAccountLogin(account)
32
34
  });
33
35
  }));
34
36
  };
@@ -524,7 +524,6 @@ export var DumbTriggerManager = /*#__PURE__*/function (_Component) {
524
524
  t = _this$props5.t,
525
525
  fieldOptions = _this$props5.fieldOptions,
526
526
  flow = _this$props5.flow,
527
- flowState = _this$props5.flowState,
528
527
  client = _this$props5.client,
529
528
  OAuthFormWrapperComp = _this$props5.OAuthFormWrapperComp,
530
529
  _this$props5$OAuthFor = _this$props5.OAuthFormWrapperCompProps,
@@ -532,7 +531,6 @@ export var DumbTriggerManager = /*#__PURE__*/function (_Component) {
532
531
  reconnect = _this$props5.reconnect,
533
532
  intentsApi = _this$props5.intentsApi,
534
533
  _onClose = _this$props5.onClose;
535
- var submitting = flowState.running;
536
534
  var _this$state = this.state,
537
535
  account = _this$state.account,
538
536
  step = _this$state.step,
@@ -543,16 +541,15 @@ export var DumbTriggerManager = /*#__PURE__*/function (_Component) {
543
541
  isWaitingPaywallCheck = _this$state.isWaitingPaywallCheck;
544
542
  var oauth = konnector.oauth;
545
543
  var showCiphersList = step === 'ciphersList';
546
- var isSubmittingSelectedCipher = submitting && selectedCipher && showCiphersList;
547
544
  var showAccountForm = step === 'accountForm';
548
545
  var konnectorPolicy = findKonnectorPolicy(konnector);
549
546
 
550
- if (isWaitingPaywallCheck || isSubmittingSelectedCipher) {
547
+ if (isWaitingPaywallCheck) {
551
548
  return /*#__PURE__*/React.createElement("div", {
552
549
  className: "u-flex u-flex-column u-flex-items-center u-pv-2"
553
550
  }, /*#__PURE__*/React.createElement(Spinner, {
554
551
  size: "xxlarge"
555
- }), isSubmittingSelectedCipher ? /*#__PURE__*/React.createElement("p", null, t('triggerManager.connecting')) : null);
552
+ }));
556
553
  }
557
554
 
558
555
  if (showPaywall) {
@@ -653,7 +650,6 @@ DumbTriggerManager.propTypes = {
653
650
  */
654
651
  fieldOptions: PropTypes.object,
655
652
  flow: PropTypes.object,
656
- flowState: PropTypes.object,
657
653
 
658
654
  /** Used to inject a component around OAuthForm, and so customize the UI from the app */
659
655
  OAuthFormWrapperComp: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
@@ -3,8 +3,8 @@ import compose from 'lodash/flowRight';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
5
  import CozyClient, { Q, queryConnect, RealTimeQueries } from 'cozy-client';
6
- import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme';
7
6
  import NavigationList, { NavigationListSection, NavigationListHeader } from 'cozy-ui/transpiled/react/NavigationList';
7
+ import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme';
8
8
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
9
9
  import BIContractActivationWindow from './BiContractActivationWindow';
10
10
  import ContractItem from './ContractItem';
@@ -44,7 +44,7 @@ var DumbContracts = function DumbContracts(_ref2) {
44
44
  if (contractData.length === 0) return null;
45
45
  var doctype = contractData[0] ? contractData[0]._type : null;
46
46
  var headerKey = customHeaderPerDoctype[doctype] || 'default';
47
- return /*#__PURE__*/React.createElement(MuiCozyTheme, null, /*#__PURE__*/React.createElement(RealTimeQueries, {
47
+ return /*#__PURE__*/React.createElement(CozyTheme, null, /*#__PURE__*/React.createElement(RealTimeQueries, {
48
48
  doctype: "io.cozy.bank.accounts"
49
49
  }), /*#__PURE__*/React.createElement(NavigationList, null, /*#__PURE__*/React.createElement(NavigationListHeader, null, t("contracts.headers.".concat(headerKey))), /*#__PURE__*/React.createElement(NavigationListSection, null, contractData && contractData.map(function (contract, i) {
50
50
  return /*#__PURE__*/React.createElement(ContractItem, {
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import ReactJsonPrint from 'react-json-print';
4
- import CozyClient, { Q, useQuery, hasQueryBeenLoaded } from 'cozy-client';
4
+ import CozyClient, { Q, useQuery, hasQueryBeenLoaded, RealTimeQueries } from 'cozy-client';
5
5
  import Button from 'cozy-ui/transpiled/react/Buttons';
6
6
  import Card from 'cozy-ui/transpiled/react/Card';
7
7
  import Divider from 'cozy-ui/transpiled/react/Divider';
@@ -46,7 +46,9 @@ var DoctypeDebugCard = function DoctypeDebugCard(_ref) {
46
46
  }
47
47
 
48
48
  var clipBoardAvailable = (_navigator$clipboard = navigator.clipboard) === null || _navigator$clipboard === void 0 ? void 0 : _navigator$clipboard.writeText;
49
- return !failed && loaded ? /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Typography, {
49
+ return !failed && loaded ? /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(RealTimeQueries, {
50
+ doctype: doctype
51
+ }), /*#__PURE__*/React.createElement(Typography, {
50
52
  variant: "button"
51
53
  }, doctype), clipBoardAvailable ? /*#__PURE__*/React.createElement(Button, {
52
54
  label: "copy",
@@ -1,3 +1,9 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+
5
+ 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; }
6
+
1
7
  /**
2
8
  * This file list all possible doctypes to datacard possibilities.
3
9
  * Its default export can be used as the value of the doctypeToDataCard
@@ -7,6 +13,8 @@
7
13
  * all dependencies that are necessary for all types of data card.
8
14
  */
9
15
  import get from 'lodash/get';
16
+ import flag from 'cozy-flags';
17
+ import DoctypeDebugCard from './DoctypeDebugCard';
10
18
  import FileDataCard from './FileDataCard';
11
19
  import GeoDataCard from './GeoDataCard';
12
20
  var timeseriesGeoJSONDatacard = {
@@ -25,7 +33,47 @@ var filesDatacard = {
25
33
  return get(trigger, 'message.folder_to_save');
26
34
  }
27
35
  };
36
+ var filesDebugDatacard = {
37
+ component: function component(options) {
38
+ return DoctypeDebugCard(_objectSpread({
39
+ doctype: 'io.cozy.files'
40
+ }, options));
41
+ },
42
+ match: function match(_ref3) {
43
+ var konnector = _ref3.konnector;
44
+ return hasPermission(konnector, 'io.cozy.files') && flag('harvest.show-doctype-debug-cards');
45
+ }
46
+ };
47
+ var identitiesDebugDatacard = {
48
+ component: function component(options) {
49
+ return DoctypeDebugCard(_objectSpread({
50
+ doctype: 'io.cozy.identities'
51
+ }, options));
52
+ },
53
+ match: function match(_ref4) {
54
+ var konnector = _ref4.konnector;
55
+ return hasPermission(konnector, 'io.cozy.identities') && flag('harvest.show-doctype-debug-cards');
56
+ }
57
+ };
58
+ var billsDebugDatacard = {
59
+ component: function component(options) {
60
+ return DoctypeDebugCard(_objectSpread({
61
+ doctype: 'io.cozy.bills'
62
+ }, options));
63
+ },
64
+ match: function match(_ref5) {
65
+ var konnector = _ref5.konnector;
66
+ return hasPermission(konnector, 'io.cozy.bills') && flag('harvest.show-doctype-debug-cards');
67
+ }
68
+ };
28
69
  var options = {
29
- datacards: [timeseriesGeoJSONDatacard, filesDatacard]
70
+ datacards: [timeseriesGeoJSONDatacard, filesDatacard, filesDebugDatacard, identitiesDebugDatacard, billsDebugDatacard]
30
71
  };
72
+
73
+ function hasPermission(konnector, doctype) {
74
+ return Object.values(konnector.permissions).filter(function (x) {
75
+ return x.type === doctype;
76
+ }).length > 0;
77
+ }
78
+
31
79
  export default options;
@@ -50,4 +50,16 @@ jest.mock('cozy-ui/transpiled/react/Icons/CloudSync2', function () {
50
50
  };
51
51
  }, {
52
52
  virtual: true
53
+ });
54
+ /* Fix error: "TypeError: (0 , _color.createNodeWithThemeCssVars) is not a function" */
55
+
56
+ jest.mock('cozy-ui/transpiled/react/utils/color', function () {
57
+ return {
58
+ createNodeWithThemeCssVars: function createNodeWithThemeCssVars() {
59
+ return null;
60
+ },
61
+ getCssVariableValue: function getCssVariableValue() {
62
+ return '#fff';
63
+ }
64
+ };
53
65
  });
@@ -543,7 +543,6 @@
543
543
  "otherAccount": "From another account…"
544
544
  },
545
545
  "triggerManager": {
546
- "connecting": "Connecting your account...",
547
546
  "confirmationModal": {
548
547
  "title": "Update credentials?",
549
548
  "description": "Your previous credentials will be definitively lost. Add a new account to keep them.",
@@ -543,7 +543,6 @@
543
543
  "otherAccount": "Depuis un autre compte…"
544
544
  },
545
545
  "triggerManager": {
546
- "connecting": "Connexion du compte…",
547
546
  "confirmationModal": {
548
547
  "title": "Mettre à jour les identifiants ?",
549
548
  "description": "Vos identifiants précédents seront perdus. Ajoutez un nouveau compte pour les conserver.",
@@ -535,7 +535,6 @@
535
535
  "otherAccount": "Uit ander account…"
536
536
  },
537
537
  "triggerManager": {
538
- "connecting": "Bezig met koppelen…",
539
538
  "confirmationModal": {
540
539
  "title": "Inloggegevens bijwerken?",
541
540
  "description": "Je vorige inloggegevens worden gewist - voeg een nieuw account toe om ze te bewaren.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-harvest-lib",
3
- "version": "22.2.0",
3
+ "version": "22.4.0",
4
4
  "description": "Provides logic, modules and components for Cozy's harvest applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -20,7 +20,7 @@
20
20
  "deploy:doc": "(cd ../.. && yarn deploy:doc)",
21
21
  "prepublishOnly": "yarn check-locales && yarn build",
22
22
  "check-locales": "./scripts/check-locales.sh",
23
- "test": "jest --runInBand",
23
+ "test": "env NODE_ENV=test jest --runInBand",
24
24
  "lint": "cd .. && yarn eslint --ext js,jsx packages/cozy-harvest-lib",
25
25
  "start": "yarn build:watch",
26
26
  "cli": "env BABEL_ENV=es5 node src/cli/index.js",
@@ -65,15 +65,15 @@
65
65
  "babel-jest": "26.6.3",
66
66
  "babel-plugin-inline-react-svg": "1.1.2",
67
67
  "babel-preset-cozy-app": "^2.1.0",
68
- "cozy-client": "^45.1.0",
68
+ "cozy-client": "^45.8.1",
69
69
  "cozy-device-helper": "^3.0.0",
70
70
  "cozy-flags": "^3.2.2",
71
71
  "cozy-intent": "^2.19.2",
72
- "cozy-interapp": ">=0.8.1",
72
+ "cozy-interapp": "^0.9.0",
73
73
  "cozy-keys-lib": "^6.0.0",
74
74
  "cozy-realtime": "^5.0.0",
75
- "cozy-tsconfig": "^1.0.0",
76
- "cozy-ui": "^95.9.0",
75
+ "cozy-tsconfig": "^1.2.0",
76
+ "cozy-ui": "^103.2.0",
77
77
  "enzyme": "3.11.0",
78
78
  "enzyme-adapter-react-16": "1.15.6",
79
79
  "form-data": "4.0.0",
@@ -94,18 +94,18 @@
94
94
  },
95
95
  "peerDependencies": {
96
96
  "@babel/runtime": ">=7.12.5",
97
- "cozy-client": ">=45.1.0",
97
+ "cozy-client": ">=45.8.1",
98
98
  "cozy-device-helper": ">=2.6.0",
99
99
  "cozy-flags": ">=2.3.5",
100
100
  "cozy-intent": ">=1.14.1",
101
- "cozy-interapp": ">=0.8.1",
101
+ "cozy-interapp": ">=0.9.0",
102
102
  "cozy-keys-lib": ">=6.0.0",
103
103
  "cozy-realtime": ">=4.2.8",
104
- "cozy-ui": ">=95.9.0",
104
+ "cozy-ui": ">=103.2.0",
105
105
  "leaflet": "^1.7.1",
106
106
  "react-router": "3.2.6",
107
107
  "react-router-dom": ">=4.3.1"
108
108
  },
109
109
  "sideEffects": false,
110
- "gitHead": "4aabca6edec79405a512a15e004db9b3ad331e67"
110
+ "gitHead": "c59d2426a15b44386711a303f5f8b5c9455a0b85"
111
111
  }
@@ -4,9 +4,9 @@ import { createPortal } from 'react-dom'
4
4
  import { useWebviewIntent } from 'cozy-intent'
5
5
  import Backdrop from 'cozy-ui/transpiled/react/Backdrop'
6
6
  import LinearProgress from 'cozy-ui/transpiled/react/LinearProgress'
7
- import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme'
8
7
  import Typography from 'cozy-ui/transpiled/react/Typography'
9
8
  import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
9
+ import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme'
10
10
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
11
11
  import { makeStyles } from 'cozy-ui/transpiled/react/styles'
12
12
 
@@ -24,7 +24,7 @@ export const ConnectionBackdrop = ({ name }) => {
24
24
  const { t } = useI18n()
25
25
 
26
26
  return (
27
- <MuiCozyTheme variant="inverted">
27
+ <CozyTheme variant="inverted">
28
28
  <div className={styles.container}>
29
29
  <Backdrop
30
30
  open
@@ -53,7 +53,7 @@ export const ConnectionBackdrop = ({ name }) => {
53
53
  </div>
54
54
  </Backdrop>
55
55
  </div>
56
- </MuiCozyTheme>
56
+ </CozyTheme>
57
57
  )
58
58
  }
59
59
 
@@ -1,5 +1,7 @@
1
1
  import React, { useMemo } from 'react'
2
2
 
3
+ import { models } from 'cozy-client'
4
+
3
5
  import { useDatacardOptions } from './DatacardOptionsContext'
4
6
 
5
7
  const findSuitableDataCards = (datacardOptions, datacardContext) => {
@@ -24,6 +26,7 @@ const Datacards = ({ konnector, account, trigger }) => {
24
26
  konnector={konnector}
25
27
  trigger={trigger}
26
28
  accountId={trigger.message.account}
29
+ sourceAccountIdentifier={models.account.getAccountLogin(account)}
27
30
  />
28
31
  ))}
29
32
  </>
@@ -309,7 +309,6 @@ export class DumbTriggerManager extends Component {
309
309
  t,
310
310
  fieldOptions,
311
311
  flow,
312
- flowState,
313
312
  client,
314
313
  OAuthFormWrapperComp,
315
314
  OAuthFormWrapperCompProps = {},
@@ -318,8 +317,6 @@ export class DumbTriggerManager extends Component {
318
317
  onClose
319
318
  } = this.props
320
319
 
321
- const submitting = flowState.running
322
-
323
320
  const {
324
321
  account,
325
322
  step,
@@ -333,18 +330,13 @@ export class DumbTriggerManager extends Component {
333
330
  const { oauth } = konnector
334
331
 
335
332
  const showCiphersList = step === 'ciphersList'
336
- const isSubmittingSelectedCipher =
337
- submitting && selectedCipher && showCiphersList
338
333
  const showAccountForm = step === 'accountForm'
339
334
  const konnectorPolicy = findKonnectorPolicy(konnector)
340
335
 
341
- if (isWaitingPaywallCheck || isSubmittingSelectedCipher) {
336
+ if (isWaitingPaywallCheck) {
342
337
  return (
343
338
  <div className="u-flex u-flex-column u-flex-items-center u-pv-2">
344
339
  <Spinner size="xxlarge" />
345
- {isSubmittingSelectedCipher ? (
346
- <p>{t('triggerManager.connecting')}</p>
347
- ) : null}
348
340
  </div>
349
341
  )
350
342
  }
@@ -459,7 +451,6 @@ DumbTriggerManager.propTypes = {
459
451
  */
460
452
  fieldOptions: PropTypes.object,
461
453
  flow: PropTypes.object,
462
- flowState: PropTypes.object,
463
454
  /** Used to inject a component around OAuthForm, and so customize the UI from the app */
464
455
  OAuthFormWrapperComp: PropTypes.oneOfType([
465
456
  PropTypes.element,
@@ -4,11 +4,11 @@ import PropTypes from 'prop-types'
4
4
  import React from 'react'
5
5
 
6
6
  import CozyClient, { Q, queryConnect, RealTimeQueries } from 'cozy-client'
7
- import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme'
8
7
  import NavigationList, {
9
8
  NavigationListSection,
10
9
  NavigationListHeader
11
10
  } from 'cozy-ui/transpiled/react/NavigationList'
11
+ import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme'
12
12
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
13
13
 
14
14
  import BIContractActivationWindow from './BiContractActivationWindow'
@@ -53,7 +53,7 @@ const DumbContracts = ({
53
53
  const headerKey = customHeaderPerDoctype[doctype] || 'default'
54
54
 
55
55
  return (
56
- <MuiCozyTheme>
56
+ <CozyTheme>
57
57
  <RealTimeQueries doctype="io.cozy.bank.accounts" />
58
58
  <NavigationList>
59
59
  <NavigationListHeader>
@@ -81,7 +81,7 @@ const DumbContracts = ({
81
81
  />
82
82
  </NavigationListSection>
83
83
  </NavigationList>
84
- </MuiCozyTheme>
84
+ </CozyTheme>
85
85
  )
86
86
  }
87
87
 
@@ -1,8 +1,12 @@
1
1
  import PropTypes from 'prop-types'
2
2
  import React from 'react'
3
3
  import ReactJsonPrint from 'react-json-print'
4
-
5
- import CozyClient, { Q, useQuery, hasQueryBeenLoaded } from 'cozy-client'
4
+ import CozyClient, {
5
+ Q,
6
+ useQuery,
7
+ hasQueryBeenLoaded,
8
+ RealTimeQueries
9
+ } from 'cozy-client'
6
10
  import Button from 'cozy-ui/transpiled/react/Buttons'
7
11
  import Card from 'cozy-ui/transpiled/react/Card'
8
12
  import Divider from 'cozy-ui/transpiled/react/Divider'
@@ -53,6 +57,7 @@ const DoctypeDebugCard = ({ sourceAccountIdentifier, konnector, doctype }) => {
53
57
  const clipBoardAvailable = navigator.clipboard?.writeText
54
58
  return !failed && loaded ? (
55
59
  <Card>
60
+ <RealTimeQueries doctype={doctype} />
56
61
  <Typography variant="button">{doctype}</Typography>
57
62
  {clipBoardAvailable ? (
58
63
  <Button
@@ -9,6 +9,9 @@
9
9
 
10
10
  import get from 'lodash/get'
11
11
 
12
+ import flag from 'cozy-flags'
13
+
14
+ import DoctypeDebugCard from './DoctypeDebugCard'
12
15
  import FileDataCard from './FileDataCard'
13
16
  import GeoDataCard from './GeoDataCard'
14
17
 
@@ -25,8 +28,45 @@ const filesDatacard = {
25
28
  match: ({ trigger }) => get(trigger, 'message.folder_to_save')
26
29
  }
27
30
 
31
+ const filesDebugDatacard = {
32
+ component: options =>
33
+ DoctypeDebugCard({ doctype: 'io.cozy.files', ...options }),
34
+ match: ({ konnector }) =>
35
+ hasPermission(konnector, 'io.cozy.files') &&
36
+ flag('harvest.show-doctype-debug-cards')
37
+ }
38
+
39
+ const identitiesDebugDatacard = {
40
+ component: options =>
41
+ DoctypeDebugCard({ doctype: 'io.cozy.identities', ...options }),
42
+ match: ({ konnector }) =>
43
+ hasPermission(konnector, 'io.cozy.identities') &&
44
+ flag('harvest.show-doctype-debug-cards')
45
+ }
46
+
47
+ const billsDebugDatacard = {
48
+ component: options =>
49
+ DoctypeDebugCard({ doctype: 'io.cozy.bills', ...options }),
50
+ match: ({ konnector }) =>
51
+ hasPermission(konnector, 'io.cozy.bills') &&
52
+ flag('harvest.show-doctype-debug-cards')
53
+ }
54
+
28
55
  const options = {
29
- datacards: [timeseriesGeoJSONDatacard, filesDatacard]
56
+ datacards: [
57
+ timeseriesGeoJSONDatacard,
58
+ filesDatacard,
59
+ filesDebugDatacard,
60
+ identitiesDebugDatacard,
61
+ billsDebugDatacard
62
+ ]
63
+ }
64
+
65
+ function hasPermission(konnector, doctype) {
66
+ return (
67
+ Object.values(konnector.permissions).filter(x => x.type === doctype)
68
+ .length > 0
69
+ )
30
70
  }
31
71
 
32
72
  export default options
package/src/jest.setup.js CHANGED
@@ -59,3 +59,9 @@ jest.mock(
59
59
  virtual: true
60
60
  }
61
61
  )
62
+
63
+ /* Fix error: "TypeError: (0 , _color.createNodeWithThemeCssVars) is not a function" */
64
+ jest.mock('cozy-ui/transpiled/react/utils/color', () => ({
65
+ createNodeWithThemeCssVars: () => null,
66
+ getCssVariableValue: () => '#fff'
67
+ }))
@@ -543,7 +543,6 @@
543
543
  "otherAccount": "From another account…"
544
544
  },
545
545
  "triggerManager": {
546
- "connecting": "Connecting your account...",
547
546
  "confirmationModal": {
548
547
  "title": "Update credentials?",
549
548
  "description": "Your previous credentials will be definitively lost. Add a new account to keep them.",
@@ -543,7 +543,6 @@
543
543
  "otherAccount": "Depuis un autre compte…"
544
544
  },
545
545
  "triggerManager": {
546
- "connecting": "Connexion du compte…",
547
546
  "confirmationModal": {
548
547
  "title": "Mettre à jour les identifiants ?",
549
548
  "description": "Vos identifiants précédents seront perdus. Ajoutez un nouveau compte pour les conserver.",
@@ -535,7 +535,6 @@
535
535
  "otherAccount": "Uit ander account…"
536
536
  },
537
537
  "triggerManager": {
538
- "connecting": "Bezig met koppelen…",
539
538
  "confirmationModal": {
540
539
  "title": "Inloggegevens bijwerken?",
541
540
  "description": "Je vorige inloggegevens worden gewist - voeg een nieuw account toe om ze te bewaren.",