cozy-sharing 4.0.5 → 4.1.3

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,51 @@
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
+ ## [4.1.3](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.1.2...cozy-sharing@4.1.3) (2022-02-21)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **sharing:** Escape public name in public cozy2cozy view ([b5af978](https://github.com/cozy/cozy-libs/commit/b5af978e6f349819b8f76e097f328a87a6c18912))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.1.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.1.1...cozy-sharing@4.1.2) (2022-02-18)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **deps:** pin dependencies ([e53d065](https://github.com/cozy/cozy-libs/commit/e53d065090224ea340b2c25c3afd14f223f4d119))
23
+
24
+
25
+
26
+
27
+
28
+ ## [4.1.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.1.0...cozy-sharing@4.1.1) (2022-02-15)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **deps:** update dependency babel-plugin-inline-react-svg to v1.1.2 ([2c66da8](https://github.com/cozy/cozy-libs/commit/2c66da822e24b0d30714d7fa4cd79c26696adcc6))
34
+ * **deps:** update dependency enzyme-to-json to v3.6.2 ([4b90ff6](https://github.com/cozy/cozy-libs/commit/4b90ff66bcf692886eb197727eed1d7dd7a41cb1))
35
+
36
+
37
+
38
+
39
+
40
+ # [4.1.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.0.5...cozy-sharing@4.1.0) (2022-02-14)
41
+
42
+
43
+ ### Features
44
+
45
+ * **sharing:** Upgrade cozy-ui to benefit of new component ([db7490b](https://github.com/cozy/cozy-libs/commit/db7490ba5f1585e2a925f5c054aa611c93617bdc))
46
+
47
+
48
+
49
+
50
+
6
51
  ## [4.0.5](https://github.com/cozy/cozy-libs/compare/cozy-sharing@4.0.4...cozy-sharing@4.0.5) (2022-02-04)
7
52
 
8
53
  **Note:** Version bump only for package cozy-sharing
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
3
  import { ShareButton } from './ShareButton';
4
- jest.mock('cozy-ui/transpiled/react', function () {
4
+ jest.mock('cozy-ui/transpiled/react/Button', function () {
5
5
  return {
6
6
  Button: function Button(props) {
7
7
  if (props.t || props.t || props.lang) {
@@ -4,7 +4,7 @@ import snarkdown from 'snarkdown';
4
4
  import { useClient } from 'cozy-client';
5
5
  import Banner from 'cozy-ui/transpiled/react/Banner';
6
6
  import Button, { ButtonLink } from 'cozy-ui/transpiled/react/Button';
7
- import { useI18n } from 'cozy-ui/transpiled/react';
7
+ import { useI18n } from 'cozy-ui/transpiled/react/I18n';
8
8
  import CozyHomeLinkIcon from './CozyHomeLinkIcon';
9
9
  import getHomeLinkHref from './getHomeLinkHref';
10
10
  var styles = {
@@ -29,19 +29,21 @@ var PublicBannerCozyToCozyContent = function PublicBannerCozyToCozyContent(_ref)
29
29
  var knowMore = /*#__PURE__*/React.createElement("a", {
30
30
  href: "https://cozy.io",
31
31
  target: "_blank",
32
- className: 'u-link',
32
+ className: "u-link",
33
33
  rel: "noopener noreferrer"
34
34
  }, t('Share.banner.know_more'));
35
35
  var withAvatar = snarkdown(t('Share.banner.shared_from', {
36
36
  name: name,
37
37
  image: avatarURL
38
38
  }));
39
+ var beginning = withAvatar.split('<img src');
40
+ var translated = beginning[1].split('alt="avatar">');
39
41
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
40
- className: styles['bannermarkdown'],
41
- dangerouslySetInnerHTML: {
42
- __html: withAvatar
43
- }
44
- }), /*#__PURE__*/React.createElement("span", null, ' ', text, " ", knowMore));
42
+ className: styles['bannermarkdown']
43
+ }, beginning[0], /*#__PURE__*/React.createElement("img", {
44
+ src: avatarURL,
45
+ alt: "avatar"
46
+ }), translated[1]), /*#__PURE__*/React.createElement("span", null, ' ', text, " ", knowMore));
45
47
  };
46
48
 
47
49
  PublicBannerCozyToCozyContent.propTypes = {
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import { SharingBannerCozyToCozy } from './PublicBanner';
4
+ import { useI18n } from 'cozy-ui/transpiled/react/I18n';
5
+ import { useClient } from 'cozy-client';
6
+ jest.mock('cozy-ui/transpiled/react/I18n');
7
+ jest.mock('cozy-client');
8
+ describe('PublicBanner', function () {
9
+ beforeEach(function () {
10
+ useClient.mockReturnValue({
11
+ options: {
12
+ uri: 'http://cozy.localhost:8080'
13
+ }
14
+ });
15
+ });
16
+ it('should not add dangerous html', function () {
17
+ // Given
18
+ useI18n.mockReturnValue({
19
+ t: function t(localeToTranslate, options) {
20
+ if (localeToTranslate === 'Share.banner.shared_from') {
21
+ return "Shared from ![avatar](".concat(options.image, ") ").concat(options.name, "'s cozy.");
22
+ }
23
+
24
+ return localeToTranslate;
25
+ }
26
+ });
27
+ var publicName = '[Click me!](https://evil.com)';
28
+ var sharing = {
29
+ attributes: {
30
+ members: [{
31
+ public_name: publicName
32
+ }]
33
+ }
34
+ }; // When
35
+
36
+ var _render = render( /*#__PURE__*/React.createElement(SharingBannerCozyToCozy, {
37
+ sharing: sharing,
38
+ isSharingShortcutCreated: true,
39
+ discoveryLink: 'discoveryLink',
40
+ onClose: function onClose() {}
41
+ })),
42
+ container = _render.container; // Then
43
+
44
+
45
+ expect(container.querySelector('.bannermarkdown').innerHTML).toEqual("Shared from <img src=\"http://cozy.localhost:8080/public/avatar?fallback=initials\" alt=\"avatar\"> &lt;a href=\"https://evil.com\"&gt;Click me!&lt;/a&gt;'s cozy.");
46
+ });
47
+ });
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { CozyProvider } from 'cozy-client';
3
3
  import { Provider } from 'react-redux';
4
4
  import { createStore } from 'redux';
5
- import { I18n } from 'cozy-ui/transpiled/react';
5
+ import { I18n } from 'cozy-ui/transpiled/react/I18n';
6
6
  import SharingContext from '../../context';
7
7
  import langEn from '../../../locales/en.json';
8
8
  import { ThumbnailSizeContextProvider } from './ThumbnailSizeContext';
@@ -10,6 +10,7 @@ var styles = {
10
10
  "coz-form-controls--full": "share__coz-form-controls--full___1YpNp",
11
11
  "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___3JXzz",
12
12
  "error": "share__error___6Ycal",
13
+ "CozyTheme--inverted": "share__CozyTheme--inverted___2pLD2",
13
14
  "CozyTheme--normal": "share__CozyTheme--normal___qSFyr",
14
15
  "share-byemail-onlybylink": "share__share-byemail-onlybylink___C_7b_",
15
16
  "aligned-dropdown-button": "share__aligned-dropdown-button___CeTDs",
@@ -6,6 +6,7 @@ var ContactModel = models.contact;
6
6
  import { useI18n } from 'cozy-ui/transpiled/react/I18n';
7
7
  import Avatar from 'cozy-ui/transpiled/react/Avatar';
8
8
  var styles = {
9
+ "CozyTheme--inverted": "recipient__CozyTheme--inverted___2anJa",
9
10
  "CozyTheme--normal": "recipient__CozyTheme--normal___994FQ",
10
11
  "recipient": "recipient__recipient___2FlkK",
11
12
  "recipients-list-light": "recipient__recipients-list-light___1Rt5q",
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  var styles = {
5
+ "CozyTheme--inverted": "recipient__CozyTheme--inverted___2anJa",
5
6
  "CozyTheme--normal": "recipient__CozyTheme--normal___994FQ",
6
7
  "recipient": "recipient__recipient___2FlkK",
7
8
  "recipients-list-light": "recipient__recipients-list-light___1Rt5q",
@@ -28,6 +28,7 @@ import PaperplaneIcon from 'cozy-ui/transpiled/react/Icons/Paperplane';
28
28
  import ToTheCloudIcon from 'cozy-ui/transpiled/react/Icons/ToTheCloud';
29
29
  import AvatarPlusX from './AvatarPlusX';
30
30
  var styles = {
31
+ "CozyTheme--inverted": "recipient__CozyTheme--inverted___2anJa",
31
32
  "CozyTheme--normal": "recipient__CozyTheme--normal___994FQ",
32
33
  "recipient": "recipient__recipient___2FlkK",
33
34
  "recipients-list-light": "recipient__recipients-list-light___1Rt5q",
@@ -56,6 +57,7 @@ var modalStyles = {
56
57
  "coz-form-controls--full": "share__coz-form-controls--full___1YpNp",
57
58
  "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___3JXzz",
58
59
  "error": "share__error___6Ycal",
60
+ "CozyTheme--inverted": "share__CozyTheme--inverted___2pLD2",
59
61
  "CozyTheme--normal": "share__CozyTheme--normal___qSFyr",
60
62
  "share-byemail-onlybylink": "share__share-byemail-onlybylink___C_7b_",
61
63
  "aligned-dropdown-button": "share__aligned-dropdown-button___CeTDs",
@@ -18,9 +18,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
18
18
  import React, { Component } from 'react';
19
19
  import PropTypes from 'prop-types';
20
20
  import Autosuggest from 'react-autosuggest';
21
- import { Spinner } from 'cozy-ui/transpiled/react';
21
+ import { Spinner } from 'cozy-ui/transpiled/react/Spinner';
22
22
  import palette from 'cozy-ui/transpiled/react/palette';
23
23
  var styles = {
24
+ "CozyTheme--inverted": "autosuggest__CozyTheme--inverted___QJCUa",
24
25
  "CozyTheme--normal": "autosuggest__CozyTheme--normal___1-_dN",
25
26
  "container": "autosuggest__container___1dbB4",
26
27
  "suggestionsContainer": "autosuggest__suggestionsContainer___-PUXu",
@@ -5,8 +5,9 @@ var _excluded = ["label", "onClick", "className"],
5
5
  _excluded3 = ["label", "onClick", "className"];
6
6
  import React from 'react';
7
7
  import classNames from 'classnames';
8
- import { Button } from 'cozy-ui/transpiled/react';
8
+ import { Button } from 'cozy-ui/transpiled/react/Button';
9
9
  var styles = {
10
+ "CozyTheme--inverted": "button__CozyTheme--inverted___3s3RR",
10
11
  "CozyTheme--normal": "button__CozyTheme--normal___OteWq",
11
12
  "coz-btn-shared": "button__coz-btn-shared___2BoMk",
12
13
  "coz-btn-sharedWithMe": "button__coz-btn-sharedWithMe___2Vjfh"
@@ -40,6 +40,7 @@ var styles = {
40
40
  "coz-form-controls--full": "share__coz-form-controls--full___1YpNp",
41
41
  "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___3JXzz",
42
42
  "error": "share__error___6Ycal",
43
+ "CozyTheme--inverted": "share__CozyTheme--inverted___2pLD2",
43
44
  "CozyTheme--normal": "share__CozyTheme--normal___qSFyr",
44
45
  "share-byemail-onlybylink": "share__share-byemail-onlybylink___C_7b_",
45
46
  "aligned-dropdown-button": "share__aligned-dropdown-button___CeTDs",
@@ -43,6 +43,7 @@ var styles = {
43
43
  "coz-form-controls--full": "share__coz-form-controls--full___1YpNp",
44
44
  "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___3JXzz",
45
45
  "error": "share__error___6Ycal",
46
+ "CozyTheme--inverted": "share__CozyTheme--inverted___2pLD2",
46
47
  "CozyTheme--normal": "share__CozyTheme--normal___qSFyr",
47
48
  "share-byemail-onlybylink": "share__share-byemail-onlybylink___C_7b_",
48
49
  "aligned-dropdown-button": "share__aligned-dropdown-button___CeTDs",
@@ -19,6 +19,7 @@ var styles = {
19
19
  "coz-form-controls--full": "share__coz-form-controls--full___1YpNp",
20
20
  "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___3JXzz",
21
21
  "error": "share__error___6Ycal",
22
+ "CozyTheme--inverted": "share__CozyTheme--inverted___2pLD2",
22
23
  "CozyTheme--normal": "share__CozyTheme--normal___qSFyr",
23
24
  "share-byemail-onlybylink": "share__share-byemail-onlybylink___C_7b_",
24
25
  "aligned-dropdown-button": "share__aligned-dropdown-button___CeTDs",
@@ -27,6 +27,7 @@ var styles = {
27
27
  "coz-form-controls--full": "share__coz-form-controls--full___1YpNp",
28
28
  "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___3JXzz",
29
29
  "error": "share__error___6Ycal",
30
+ "CozyTheme--inverted": "share__CozyTheme--inverted___2pLD2",
30
31
  "CozyTheme--normal": "share__CozyTheme--normal___qSFyr",
31
32
  "share-byemail-onlybylink": "share__share-byemail-onlybylink___C_7b_",
32
33
  "aligned-dropdown-button": "share__aligned-dropdown-button___CeTDs",
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import classNames from 'classnames';
4
4
  import Icon from 'cozy-ui/transpiled/react/Icon';
5
5
  var styles = {
6
+ "CozyTheme--inverted": "badge__CozyTheme--inverted___1vv9l",
6
7
  "CozyTheme--normal": "badge__CozyTheme--normal___2pjsD",
7
8
  "shared-badge": "badge__shared-badge___2QYc_",
8
9
  "--small": "badge__--small___3i2p8",
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Button } from 'cozy-ui/transpiled/react';
3
+ import { Button } from 'cozy-ui/transpiled/react/Button';
4
4
 
5
5
  var ShareSubmit = function ShareSubmit(props) {
6
6
  return /*#__PURE__*/React.createElement(Button, {
@@ -9,7 +9,7 @@ import cx from 'classnames';
9
9
  import PropTypes from 'prop-types';
10
10
  import SelectBox, { components } from 'cozy-ui/transpiled/react/SelectBox';
11
11
  import palette from 'cozy-ui/transpiled/react/palette';
12
- import { Icon } from 'cozy-ui/transpiled/react';
12
+ import Icon from 'cozy-ui/transpiled/react/Icon';
13
13
  var styles = {
14
14
  "share-modal-content": "share__share-modal-content___XTtaK",
15
15
  "coz-form": "share__coz-form___33NYF",
@@ -22,6 +22,7 @@ var styles = {
22
22
  "coz-form-controls--full": "share__coz-form-controls--full___1YpNp",
23
23
  "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___3JXzz",
24
24
  "error": "share__error___6Ycal",
25
+ "CozyTheme--inverted": "share__CozyTheme--inverted___2pLD2",
25
26
  "CozyTheme--normal": "share__CozyTheme--normal___qSFyr",
26
27
  "share-byemail-onlybylink": "share__share-byemail-onlybylink___C_7b_",
27
28
  "aligned-dropdown-button": "share__aligned-dropdown-button___CeTDs",
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import cx from 'classnames';
4
4
  import { RecipientWithoutStatus, RecipientPlusX } from './Recipient';
5
5
  var styles = {
6
+ "CozyTheme--inverted": "recipient__CozyTheme--inverted___2anJa",
6
7
  "CozyTheme--normal": "recipient__CozyTheme--normal___994FQ",
7
8
  "recipient": "recipient__recipient___2FlkK",
8
9
  "recipients-list-light": "recipient__recipients-list-light___1Rt5q",