cozy-sharing 28.1.4 → 28.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 CHANGED
@@ -3,6 +3,12 @@
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
+ # [28.2.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@28.1.4...cozy-sharing@28.2.0) (2026-01-14)
7
+
8
+ ### Features
9
+
10
+ - Add antivirus alert when a file not been scanned yet ([9146347](https://github.com/cozy/cozy-libs/commit/91463475a1852b53442711aa8aa2efd848992f5e))
11
+
6
12
  ## [28.1.4](https://github.com/cozy/cozy-libs/compare/cozy-sharing@28.1.3...cozy-sharing@28.1.4) (2026-01-14)
7
13
 
8
14
  **Note:** Version bump only for package cozy-sharing
@@ -0,0 +1,29 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import { useI18n } from 'twake-i18n';
4
+ import Alert from 'cozy-ui/transpiled/react/Alert';
5
+
6
+ var AntivirusAlert = function AntivirusAlert(_ref) {
7
+ var _document$antivirus_s;
8
+
9
+ var document = _ref.document;
10
+
11
+ var _useI18n = useI18n(),
12
+ t = _useI18n.t;
13
+
14
+ var needsWarning = (document === null || document === void 0 ? void 0 : document.antivirus_scan) && ['pending', 'error', 'skipped'].includes((_document$antivirus_s = document.antivirus_scan) === null || _document$antivirus_s === void 0 ? void 0 : _document$antivirus_s.status);
15
+
16
+ if (!needsWarning) {
17
+ return null;
18
+ }
19
+
20
+ return /*#__PURE__*/React.createElement(Alert, {
21
+ className: "u-mb-1",
22
+ severity: "warning"
23
+ }, t('Files.share.notScannedWarning'));
24
+ };
25
+
26
+ AntivirusAlert.propTypes = {
27
+ document: PropTypes.object
28
+ };
29
+ export default AntivirusAlert;
@@ -0,0 +1,76 @@
1
+ import { render } from '@testing-library/react';
2
+ import React from 'react';
3
+ import { I18nContext } from 'twake-i18n';
4
+ import AntivirusAlert from './AntivirusAlert';
5
+ describe('AntivirusAlert', function () {
6
+ var t = jest.fn(function (key) {
7
+ return key;
8
+ });
9
+ var i18nContext = {
10
+ t: t
11
+ };
12
+
13
+ var setup = function setup(props) {
14
+ return render( /*#__PURE__*/React.createElement(I18nContext.Provider, {
15
+ value: i18nContext
16
+ }, /*#__PURE__*/React.createElement(AntivirusAlert, props)));
17
+ };
18
+
19
+ it('should render nothing if no antivirus_scan', function () {
20
+ var _setup = setup({
21
+ document: {}
22
+ }),
23
+ queryByRole = _setup.queryByRole;
24
+
25
+ expect(queryByRole('alert')).toBeNull();
26
+ });
27
+ it('should render nothing if antivirus_scan status is "scanned"', function () {
28
+ var _setup2 = setup({
29
+ document: {
30
+ antivirus_scan: {
31
+ status: 'scanned'
32
+ }
33
+ }
34
+ }),
35
+ queryByRole = _setup2.queryByRole;
36
+
37
+ expect(queryByRole('alert')).toBeNull();
38
+ });
39
+ it('should render alert if antivirus_scan status is "pending"', function () {
40
+ var _setup3 = setup({
41
+ document: {
42
+ antivirus_scan: {
43
+ status: 'pending'
44
+ }
45
+ }
46
+ }),
47
+ getByRole = _setup3.getByRole;
48
+
49
+ expect(getByRole('alert')).toBeTruthy();
50
+ expect(t).toHaveBeenCalledWith('Files.share.notScannedWarning');
51
+ });
52
+ it('should render alert if antivirus_scan status is "error"', function () {
53
+ var _setup4 = setup({
54
+ document: {
55
+ antivirus_scan: {
56
+ status: 'error'
57
+ }
58
+ }
59
+ }),
60
+ getByRole = _setup4.getByRole;
61
+
62
+ expect(getByRole('alert')).toBeTruthy();
63
+ });
64
+ it('should render alert if antivirus_scan status is "skipped"', function () {
65
+ var _setup5 = setup({
66
+ document: {
67
+ antivirus_scan: {
68
+ status: 'skipped'
69
+ }
70
+ }
71
+ }),
72
+ getByRole = _setup5.getByRole;
73
+
74
+ expect(getByRole('alert')).toBeTruthy();
75
+ });
76
+ });
@@ -6,6 +6,7 @@ import React from 'react';
6
6
  import { useI18n } from 'twake-i18n';
7
7
  import Typography from 'cozy-ui/transpiled/react/Typography';
8
8
  import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
9
+ import AntivirusAlert from './AntivirusAlert';
9
10
  import { default as DumbShareByEmail } from './ShareByEmail';
10
11
  import { default as DumbShareByLink } from './ShareByLink';
11
12
  import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer';
@@ -67,7 +68,9 @@ var SharingContent = function SharingContent(_ref) {
67
68
  className: cx(styles['share-modal-content'])
68
69
  }, /*#__PURE__*/React.createElement("div", {
69
70
  className: cx('u-pt-1-half', isMobile ? 'u-ph-1' : 'u-ph-2')
70
- }, showShareOnlyByLink && /*#__PURE__*/React.createElement("div", {
71
+ }, /*#__PURE__*/React.createElement(AntivirusAlert, {
72
+ document: document
73
+ }), showShareOnlyByLink && /*#__PURE__*/React.createElement("div", {
71
74
  className: styles['share-byemail-onlybylink']
72
75
  }, t("".concat(documentType, ".share.shareByEmail.onlyByLink"), {
73
76
  type: t("".concat(documentType, ".share.shareByEmail.type.").concat(document.type === 'directory' ? 'folder' : 'file'))
@@ -4,6 +4,7 @@ import { useI18n } from 'twake-i18n';
4
4
  import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
5
5
  import Typography from 'cozy-ui/transpiled/react/Typography';
6
6
  import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
7
+ import AntivirusAlert from './AntivirusAlert';
7
8
  import { default as DumbShareByLink } from './ShareByLink';
8
9
  import WhoHasAccess from './WhoHasAccess';
9
10
 
@@ -32,7 +33,9 @@ var ShareDialogOnlyByLink = function ShareDialogOnlyByLink(_ref) {
32
33
  title: t("".concat(documentType, ".share.title"), {
33
34
  name: document.name || document.attributes.name
34
35
  }),
35
- content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
36
+ content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AntivirusAlert, {
37
+ document: document
38
+ }), /*#__PURE__*/React.createElement(Typography, {
36
39
  variant: "h6",
37
40
  className: cx(isMobile ? 'u-ph-1 u-mt-1' : 'u-ph-2 u-mt-1-half')
38
41
  }, t('Share.contacts.whoHasAccess')), /*#__PURE__*/React.createElement(WhoHasAccess, {
@@ -6,6 +6,7 @@ import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
6
6
  import TextField from 'cozy-ui/transpiled/react/TextField';
7
7
  import Typography from 'cozy-ui/transpiled/react/Typography';
8
8
  import withLocales from '../../hoc/withLocales';
9
+ import AntivirusAlert from '../AntivirusAlert';
9
10
  import { default as DumbShareByEmail } from '../ShareByEmail';
10
11
  import WhoHasAccess from '../WhoHasAccess';
11
12
  export var DumbSharedDriveModal = withLocales(function (_ref) {
@@ -40,7 +41,9 @@ export var DumbSharedDriveModal = withLocales(function (_ref) {
40
41
  },
41
42
  content: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
42
43
  className: "u-ph-2"
43
- }, handleSharedDriveNameChange && /*#__PURE__*/React.createElement(TextField, {
44
+ }, /*#__PURE__*/React.createElement(AntivirusAlert, {
45
+ document: document
46
+ }), handleSharedDriveNameChange && /*#__PURE__*/React.createElement(TextField, {
44
47
  required: true,
45
48
  label: t('SharedDrive.sharedDriveModal.nameLabel'),
46
49
  variant: "outlined",
package/locales/en.json CHANGED
@@ -109,6 +109,7 @@
109
109
  "rw": "You can view, update, delete and add this content to your Twake. Updates you make will be seen on other Cozies."
110
110
  }
111
111
  },
112
+ "notScannedWarning": "This file has not yet been scanned for viruses. Please keep this in mind before sharing.",
112
113
  "sharedByMe": "Shared by me",
113
114
  "shared": "Shared",
114
115
  "sharedWithMe": "Shared with me",
@@ -471,5 +472,4 @@
471
472
  "errorNotificationUpdate": "Error durring shared drive modification"
472
473
  }
473
474
  }
474
- }
475
-
475
+ }
package/locales/fr.json CHANGED
@@ -107,6 +107,7 @@
107
107
  "rw": "Vous pouvez consulter, modifier et supprimer du contenu. Les modifications sur le contenu seront répercutées automatiquement entre vos Twake."
108
108
  }
109
109
  },
110
+ "notScannedWarning": "Ce fichier n'a pas encore été analysé par l'antivirus. Veuillez en tenir compte avant de le partager.",
110
111
  "sharedByMe": "Partagé",
111
112
  "shared": "Partagé",
112
113
  "sharedWithMe": "Partagé avec moi",
@@ -469,4 +470,4 @@
469
470
  "errorNotificationUpdate": "Erreur lors de la modification du drive partagé"
470
471
  }
471
472
  }
472
- }
473
+ }
package/locales/ru.json CHANGED
@@ -109,6 +109,7 @@
109
109
  "rw": "Вы можете просматривать, обновлять, удалять и добавлять этот элемент в свой Twake. Ваши обновления будут видны другим пользователям."
110
110
  }
111
111
  },
112
+ "notScannedWarning": "Этот файл еще не был проверен на вирусы. Пожалуйста, учтите это перед тем, как делиться.",
112
113
  "sharedByMe": "Отправлены мной",
113
114
  "shared": "Общий доступ",
114
115
  "sharedWithMe": "Доступно мне",
package/locales/vi.json CHANGED
@@ -109,6 +109,7 @@
109
109
  "rw": "Bạn có thể xem, cập nhật, xóa và thêm nội dung này vào Twake của mình. Các bản cập nhật bạn thực hiện sẽ được thấy trên các Cozies khác."
110
110
  }
111
111
  },
112
+ "notScannedWarning": "Tệp này chưa được quét vi-rút. Vui lòng lưu ý điều này trước khi chia sẻ.",
112
113
  "sharedByMe": "Được chia sẻ bởi tôi",
113
114
  "shared": "Đã chia sẻ",
114
115
  "sharedWithMe": "Được chia sẻ với tôi",
@@ -163,7 +164,7 @@
163
164
  }
164
165
  }
165
166
  },
166
- "Notes": {
167
+ "Notes": {
167
168
  "share": {
168
169
  "cta": "Chia sẻ",
169
170
  "title": "Chia sẻ \"%{name}\"",
@@ -469,4 +470,4 @@
469
470
  "errorNotificationUpdate": "Lỗi khi sửa đổi ổ đĩa được chia sẻ"
470
471
  }
471
472
  }
472
- }
473
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "28.1.4",
3
+ "version": "28.2.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -83,5 +83,5 @@
83
83
  "sideEffects": [
84
84
  "*.css"
85
85
  ],
86
- "gitHead": "4ac3dd488a839d34625533d597919709c3bc72b8"
86
+ "gitHead": "ab4b92d67cde105ce9d2c17693c6fe2245e77627"
87
87
  }
@@ -0,0 +1,28 @@
1
+ import PropTypes from 'prop-types'
2
+ import React from 'react'
3
+ import { useI18n } from 'twake-i18n'
4
+
5
+ import Alert from 'cozy-ui/transpiled/react/Alert'
6
+
7
+ const AntivirusAlert = ({ document }) => {
8
+ const { t } = useI18n()
9
+ const needsWarning =
10
+ document?.antivirus_scan &&
11
+ ['pending', 'error', 'skipped'].includes(document.antivirus_scan?.status)
12
+
13
+ if (!needsWarning) {
14
+ return null
15
+ }
16
+
17
+ return (
18
+ <Alert className="u-mb-1" severity="warning">
19
+ {t('Files.share.notScannedWarning')}
20
+ </Alert>
21
+ )
22
+ }
23
+
24
+ AntivirusAlert.propTypes = {
25
+ document: PropTypes.object
26
+ }
27
+
28
+ export default AntivirusAlert
@@ -0,0 +1,52 @@
1
+ import { render } from '@testing-library/react'
2
+ import React from 'react'
3
+ import { I18nContext } from 'twake-i18n'
4
+
5
+ import AntivirusAlert from './AntivirusAlert'
6
+
7
+ describe('AntivirusAlert', () => {
8
+ const t = jest.fn(key => key)
9
+ const i18nContext = { t }
10
+
11
+ const setup = props => {
12
+ return render(
13
+ <I18nContext.Provider value={i18nContext}>
14
+ <AntivirusAlert {...props} />
15
+ </I18nContext.Provider>
16
+ )
17
+ }
18
+
19
+ it('should render nothing if no antivirus_scan', () => {
20
+ const { queryByRole } = setup({ document: {} })
21
+ expect(queryByRole('alert')).toBeNull()
22
+ })
23
+
24
+ it('should render nothing if antivirus_scan status is "scanned"', () => {
25
+ const { queryByRole } = setup({
26
+ document: { antivirus_scan: { status: 'scanned' } }
27
+ })
28
+ expect(queryByRole('alert')).toBeNull()
29
+ })
30
+
31
+ it('should render alert if antivirus_scan status is "pending"', () => {
32
+ const { getByRole } = setup({
33
+ document: { antivirus_scan: { status: 'pending' } }
34
+ })
35
+ expect(getByRole('alert')).toBeTruthy()
36
+ expect(t).toHaveBeenCalledWith('Files.share.notScannedWarning')
37
+ })
38
+
39
+ it('should render alert if antivirus_scan status is "error"', () => {
40
+ const { getByRole } = setup({
41
+ document: { antivirus_scan: { status: 'error' } }
42
+ })
43
+ expect(getByRole('alert')).toBeTruthy()
44
+ })
45
+
46
+ it('should render alert if antivirus_scan status is "skipped"', () => {
47
+ const { getByRole } = setup({
48
+ document: { antivirus_scan: { status: 'skipped' } }
49
+ })
50
+ expect(getByRole('alert')).toBeTruthy()
51
+ })
52
+ })
@@ -5,6 +5,7 @@ import { useI18n } from 'twake-i18n'
5
5
  import Typography from 'cozy-ui/transpiled/react/Typography'
6
6
  import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
7
7
 
8
+ import AntivirusAlert from './AntivirusAlert'
8
9
  import { default as DumbShareByEmail } from './ShareByEmail'
9
10
  import { default as DumbShareByLink } from './ShareByLink'
10
11
  import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer'
@@ -36,10 +37,10 @@ const SharingContent = ({
36
37
  }) => {
37
38
  const { t } = useI18n()
38
39
  const { isMobile } = useBreakpoints()
39
-
40
40
  return (
41
41
  <div className={cx(styles['share-modal-content'])}>
42
42
  <div className={cx('u-pt-1-half', isMobile ? 'u-ph-1' : 'u-ph-2')}>
43
+ <AntivirusAlert document={document} />
43
44
  {showShareOnlyByLink && (
44
45
  <div className={styles['share-byemail-onlybylink']}>
45
46
  {t(`${documentType}.share.shareByEmail.onlyByLink`, {
@@ -6,6 +6,7 @@ import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs'
6
6
  import Typography from 'cozy-ui/transpiled/react/Typography'
7
7
  import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
8
8
 
9
+ import AntivirusAlert from './AntivirusAlert'
9
10
  import { default as DumbShareByLink } from './ShareByLink'
10
11
  import WhoHasAccess from './WhoHasAccess'
11
12
 
@@ -34,6 +35,7 @@ const ShareDialogOnlyByLink = ({
34
35
  })}
35
36
  content={
36
37
  <>
38
+ <AntivirusAlert document={document} />
37
39
  <Typography
38
40
  variant="h6"
39
41
  className={cx(isMobile ? 'u-ph-1 u-mt-1' : 'u-ph-2 u-mt-1-half')}
@@ -8,6 +8,7 @@ import TextField from 'cozy-ui/transpiled/react/TextField'
8
8
  import Typography from 'cozy-ui/transpiled/react/Typography'
9
9
 
10
10
  import withLocales from '../../hoc/withLocales'
11
+ import AntivirusAlert from '../AntivirusAlert'
11
12
  import { default as DumbShareByEmail } from '../ShareByEmail'
12
13
  import WhoHasAccess from '../WhoHasAccess'
13
14
 
@@ -41,6 +42,7 @@ export const DumbSharedDriveModal = withLocales(
41
42
  content={
42
43
  <div>
43
44
  <div className="u-ph-2">
45
+ <AntivirusAlert document={document} />
44
46
  {handleSharedDriveNameChange && (
45
47
  <TextField
46
48
  required