cozy-harvest-lib 20.2.0 → 20.2.2

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,28 @@
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
+ ## [20.2.2](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@20.2.1...cozy-harvest-lib@20.2.2) (2023-11-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **harvest:** Add DialogTitle to SuggestionModal ([11a1823](https://github.com/cozy/cozy-libs/commit/11a182376faeb3d8e83179c3e47e60f0089a5aea))
12
+
13
+
14
+
15
+
16
+
17
+ ## [20.2.1](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@20.2.0...cozy-harvest-lib@20.2.1) (2023-11-13)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * Update cozy-ui peerDep to >=95.9.0 ([512d291](https://github.com/cozy/cozy-libs/commit/512d291acc6e45936b0e2b061b83963148bf757e))
23
+
24
+
25
+
26
+
27
+
6
28
  # [20.2.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@20.1.6...cozy-harvest-lib@20.2.0) (2023-11-09)
7
29
 
8
30
 
@@ -9,32 +9,29 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
9
9
 
10
10
  import PropTypes from 'prop-types';
11
11
  import React, { useState } from 'react';
12
- import { withClient } from 'cozy-client';
13
- import AppLinker, { generateWebLink } from 'cozy-ui/transpiled/react/AppLinker';
14
- import { DialogCloseButton } from 'cozy-ui/transpiled/react/CozyDialogs';
15
- import Dialog, { DialogActions, DialogContent } from 'cozy-ui/transpiled/react/Dialog';
12
+ import { generateWebLink, useClient } from 'cozy-client';
13
+ import AppLinker from 'cozy-ui/transpiled/react/AppLinker';
14
+ import Button from 'cozy-ui/transpiled/react/Buttons';
15
+ import { IllustrationDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
16
16
  import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme';
17
17
  import Typography from 'cozy-ui/transpiled/react/Typography';
18
- import { Button, ButtonLink } from 'cozy-ui/transpiled/react/deprecated/Button';
19
- import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
20
- import { translate } from 'cozy-ui/transpiled/react/providers/I18n';
18
+ import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
21
19
  import DataTypes from './DataTypes';
22
20
  import Illustration from './Illustration';
23
21
  import { getSuggestionReason } from '../../helpers/appSuggestions';
24
22
  import { getDataTypes, getKonnectorName } from '../../helpers/manifest';
25
23
 
26
24
  var KonnectorSuggestionModal = function KonnectorSuggestionModal(_ref) {
27
- var t = _ref.t,
28
- client = _ref.client,
29
- konnectorAppSuggestion = _ref.konnectorAppSuggestion,
25
+ var konnectorAppSuggestion = _ref.konnectorAppSuggestion,
30
26
  konnectorManifest = _ref.konnectorManifest,
31
27
  onClose = _ref.onClose,
32
28
  onSilence = _ref.onSilence;
29
+ var slug = konnectorAppSuggestion.slug;
30
+ var client = useClient();
33
31
 
34
- var _useBreakpoints = useBreakpoints(),
35
- isMobile = _useBreakpoints.isMobile;
32
+ var _useI18n = useI18n(),
33
+ t = _useI18n.t;
36
34
 
37
- var slug = konnectorAppSuggestion.slug;
38
35
  var cozyURL = new URL(client.getStackClient().uri);
39
36
  var storeAppName = 'store';
40
37
  var nativePath = "/discover/".concat(slug);
@@ -85,73 +82,63 @@ var KonnectorSuggestionModal = function KonnectorSuggestionModal(_ref) {
85
82
  };
86
83
  }();
87
84
 
88
- return /*#__PURE__*/React.createElement(MuiCozyTheme, null, /*#__PURE__*/React.createElement(Dialog, {
85
+ return /*#__PURE__*/React.createElement(MuiCozyTheme, null, /*#__PURE__*/React.createElement(IllustrationDialog, {
89
86
  open: true,
90
87
  onClose: onClose,
91
- fullScreen: isMobile,
92
- fullWidth: true,
93
- maxWidth: "sm",
94
- scroll: "body"
95
- }, /*#__PURE__*/React.createElement(DialogCloseButton, {
96
- onClick: onClose
97
- }), /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement("div", {
98
- className: "u-flex u-flex-column u-flex-items-center"
99
- }, /*#__PURE__*/React.createElement(Illustration, {
100
- alt: t('app.logo.alt', {
88
+ content: /*#__PURE__*/React.createElement("div", {
89
+ className: "u-flex u-flex-column u-flex-items-center u-h-100"
90
+ }, /*#__PURE__*/React.createElement(Illustration, {
91
+ alt: t('app.logo.alt', {
92
+ name: name
93
+ }),
94
+ app: slug
95
+ }), /*#__PURE__*/React.createElement(Typography, {
96
+ className: "u-mb-half",
97
+ variant: "h4"
98
+ }, t('suggestions.title', {
99
+ name: name
100
+ })), /*#__PURE__*/React.createElement(DataTypes, {
101
+ dataTypes: dataTypes,
102
+ konnectorName: name
103
+ }), reason === 'FOUND_TRANSACTION' && /*#__PURE__*/React.createElement(Typography, {
104
+ className: "u-mb-1 u-ta-center u-mt-auto",
105
+ variant: "caption",
106
+ color: "textSecondary"
107
+ }, t('suggestions.why', {
101
108
  name: name
102
- }),
103
- app: slug
104
- }), /*#__PURE__*/React.createElement(Typography, {
105
- className: "u-mb-half",
106
- variant: "h4"
107
- }, t('suggestions.title', {
108
- name: name
109
- })), /*#__PURE__*/React.createElement(DataTypes, {
110
- dataTypes: dataTypes,
111
- konnectorName: name
112
- }))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement("div", {
113
- className: "u-flex u-flex-column u-flex-items-center u-w-100"
114
- }, reason === 'FOUND_TRANSACTION' && /*#__PURE__*/React.createElement(Typography, {
115
- className: "u-mb-1",
116
- variant: "caption",
117
- color: "textSecondary"
118
- }, t('suggestions.why', {
119
- name: name
120
- }), /*#__PURE__*/React.createElement("br", null), t('suggestions.reason_bank', {
121
- name: name
122
- })), /*#__PURE__*/React.createElement(AppLinker, {
123
- app: {
124
- slug: storeAppName
125
- },
126
- nativePath: nativePath,
127
- href: generateWebLink({
128
- cozyUrl: cozyURL.origin,
129
- slug: storeAppName,
109
+ }), /*#__PURE__*/React.createElement("br", null), t('suggestions.reason_bank', {
110
+ name: name
111
+ }))),
112
+ actions: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AppLinker, {
113
+ app: {
114
+ slug: storeAppName
115
+ },
130
116
  nativePath: nativePath,
131
- subDomainType: subDomainType
132
- })
133
- }, function (_ref3) {
134
- var onClick = _ref3.onClick,
135
- href = _ref3.href;
136
- return /*#__PURE__*/React.createElement(ButtonLink, {
137
- onClick: onClick,
138
- href: href,
139
- label: t('suggestions.install'),
140
- extension: "full",
141
- className: "u-mb-half"
142
- });
143
- }), /*#__PURE__*/React.createElement(Button, {
144
- theme: "secondary",
145
- label: t('suggestions.silence'),
146
- onClick: silenceSuggestion,
147
- busy: isSilencing,
148
- extension: "full"
149
- })))));
117
+ href: generateWebLink({
118
+ cozyUrl: cozyURL.origin,
119
+ slug: storeAppName,
120
+ nativePath: nativePath,
121
+ subDomainType: subDomainType
122
+ })
123
+ }, function (_ref3) {
124
+ var onClick = _ref3.onClick,
125
+ href = _ref3.href;
126
+ return /*#__PURE__*/React.createElement(Button, {
127
+ href: href,
128
+ onClick: onClick,
129
+ label: t('suggestions.install'),
130
+ variant: "primary"
131
+ });
132
+ }), /*#__PURE__*/React.createElement(Button, {
133
+ variant: "secondary",
134
+ label: t('suggestions.silence'),
135
+ onClick: silenceSuggestion,
136
+ busy: isSilencing
137
+ }))
138
+ }));
150
139
  };
151
140
 
152
141
  KonnectorSuggestionModal.propTypes = {
153
- t: PropTypes.func.isRequired,
154
- client: PropTypes.object.isRequired,
155
142
  konnectorAppSuggestion: PropTypes.shape({
156
143
  // io.cozy.apps.suggestions, see https://github.com/cozy/cozy-doctypes/blob/master/docs/io.cozy.apps.suggestions.md
157
144
  slug: PropTypes.string,
@@ -167,4 +154,4 @@ KonnectorSuggestionModal.propTypes = {
167
154
  onClose: PropTypes.func.isRequired,
168
155
  onSilence: PropTypes.func.isRequired
169
156
  };
170
- export default withClient(translate()(KonnectorSuggestionModal));
157
+ export default KonnectorSuggestionModal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-harvest-lib",
3
- "version": "20.2.0",
3
+ "version": "20.2.2",
4
4
  "description": "Provides logic, modules and components for Cozy's harvest applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -79,7 +79,7 @@
79
79
  "cozy-keys-lib": "^6.0.0",
80
80
  "cozy-realtime": "^5.0.0",
81
81
  "cozy-tsconfig": "^1.0.0",
82
- "cozy-ui": "^93.1.1",
82
+ "cozy-ui": "^95.9.0",
83
83
  "enzyme": "3.11.0",
84
84
  "enzyme-adapter-react-16": "1.15.6",
85
85
  "form-data": "4.0.0",
@@ -106,11 +106,11 @@
106
106
  "cozy-intent": ">=1.14.1",
107
107
  "cozy-keys-lib": ">=6.0.0",
108
108
  "cozy-realtime": ">=4.2.8",
109
- "cozy-ui": ">=93.1.1",
109
+ "cozy-ui": ">=95.9.0",
110
110
  "leaflet": "^1.7.1",
111
111
  "react-router": "3.2.6",
112
112
  "react-router-dom": ">=4.3.1"
113
113
  },
114
114
  "sideEffects": false,
115
- "gitHead": "ee73cd53aef763628c7aedb4c43c36157333bde7"
115
+ "gitHead": "288b108251db7078b0f412f5fdd34bc2b87c20be"
116
116
  }
@@ -1,18 +1,13 @@
1
1
  import PropTypes from 'prop-types'
2
2
  import React, { useState } from 'react'
3
3
 
4
- import { withClient } from 'cozy-client'
5
- import AppLinker, { generateWebLink } from 'cozy-ui/transpiled/react/AppLinker'
6
- import { DialogCloseButton } from 'cozy-ui/transpiled/react/CozyDialogs'
7
- import Dialog, {
8
- DialogActions,
9
- DialogContent
10
- } from 'cozy-ui/transpiled/react/Dialog'
4
+ import { generateWebLink, useClient } from 'cozy-client'
5
+ import AppLinker from 'cozy-ui/transpiled/react/AppLinker'
6
+ import Button from 'cozy-ui/transpiled/react/Buttons'
7
+ import { IllustrationDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
11
8
  import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme'
12
9
  import Typography from 'cozy-ui/transpiled/react/Typography'
13
- import { Button, ButtonLink } from 'cozy-ui/transpiled/react/deprecated/Button'
14
- import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
15
- import { translate } from 'cozy-ui/transpiled/react/providers/I18n'
10
+ import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
16
11
 
17
12
  import DataTypes from './DataTypes'
18
13
  import Illustration from './Illustration'
@@ -20,15 +15,14 @@ import { getSuggestionReason } from '../../helpers/appSuggestions'
20
15
  import { getDataTypes, getKonnectorName } from '../../helpers/manifest'
21
16
 
22
17
  const KonnectorSuggestionModal = ({
23
- t,
24
- client,
25
18
  konnectorAppSuggestion,
26
19
  konnectorManifest,
27
20
  onClose,
28
21
  onSilence
29
22
  }) => {
30
- const { isMobile } = useBreakpoints()
31
23
  const { slug } = konnectorAppSuggestion
24
+ const client = useClient()
25
+ const { t } = useI18n()
32
26
  const cozyURL = new URL(client.getStackClient().uri)
33
27
  const storeAppName = 'store'
34
28
  const nativePath = `/discover/${slug}`
@@ -51,37 +45,36 @@ const KonnectorSuggestionModal = ({
51
45
 
52
46
  return (
53
47
  <MuiCozyTheme>
54
- <Dialog
48
+ <IllustrationDialog
55
49
  open
56
50
  onClose={onClose}
57
- fullScreen={isMobile}
58
- fullWidth
59
- maxWidth="sm"
60
- scroll="body"
61
- >
62
- <DialogCloseButton onClick={onClose} />
63
- <DialogContent>
64
- <div className="u-flex u-flex-column u-flex-items-center">
51
+ content={
52
+ <div className="u-flex u-flex-column u-flex-items-center u-h-100">
65
53
  <Illustration alt={t('app.logo.alt', { name })} app={slug} />
54
+
66
55
  <Typography className="u-mb-half" variant="h4">
67
56
  {t('suggestions.title', { name })}
68
57
  </Typography>
58
+
69
59
  <DataTypes dataTypes={dataTypes} konnectorName={name} />
70
- </div>
71
- </DialogContent>
72
- <DialogActions>
73
- <div className="u-flex u-flex-column u-flex-items-center u-w-100">
60
+
74
61
  {reason === 'FOUND_TRANSACTION' && (
75
62
  <Typography
76
- className="u-mb-1"
63
+ className="u-mb-1 u-ta-center u-mt-auto"
77
64
  variant="caption"
78
65
  color="textSecondary"
79
66
  >
80
67
  {t('suggestions.why', { name })}
68
+
81
69
  <br />
70
+
82
71
  {t('suggestions.reason_bank', { name })}
83
72
  </Typography>
84
73
  )}
74
+ </div>
75
+ }
76
+ actions={
77
+ <>
85
78
  <AppLinker
86
79
  app={{ slug: storeAppName }}
87
80
  nativePath={nativePath}
@@ -93,32 +86,29 @@ const KonnectorSuggestionModal = ({
93
86
  })}
94
87
  >
95
88
  {({ onClick, href }) => (
96
- <ButtonLink
97
- onClick={onClick}
89
+ <Button
98
90
  href={href}
91
+ onClick={onClick}
99
92
  label={t('suggestions.install')}
100
- extension="full"
101
- className="u-mb-half"
93
+ variant="primary"
102
94
  />
103
95
  )}
104
96
  </AppLinker>
97
+
105
98
  <Button
106
- theme="secondary"
99
+ variant="secondary"
107
100
  label={t('suggestions.silence')}
108
101
  onClick={silenceSuggestion}
109
102
  busy={isSilencing}
110
- extension="full"
111
103
  />
112
- </div>
113
- </DialogActions>
114
- </Dialog>
104
+ </>
105
+ }
106
+ />
115
107
  </MuiCozyTheme>
116
108
  )
117
109
  }
118
110
 
119
111
  KonnectorSuggestionModal.propTypes = {
120
- t: PropTypes.func.isRequired,
121
- client: PropTypes.object.isRequired,
122
112
  konnectorAppSuggestion: PropTypes.shape({
123
113
  // io.cozy.apps.suggestions, see https://github.com/cozy/cozy-doctypes/blob/master/docs/io.cozy.apps.suggestions.md
124
114
  slug: PropTypes.string,
@@ -135,4 +125,4 @@ KonnectorSuggestionModal.propTypes = {
135
125
  onSilence: PropTypes.func.isRequired
136
126
  }
137
127
 
138
- export default withClient(translate()(KonnectorSuggestionModal))
128
+ export default KonnectorSuggestionModal