cozy-viewer 21.0.0 → 21.0.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,16 @@
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
+ ## [21.0.2](https://github.com/cozy/cozy-libs/compare/cozy-viewer@21.0.1...cozy-viewer@21.0.2) (2025-03-31)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **Viewer:** Toolbar download button wasn't working ([3474f66](https://github.com/cozy/cozy-libs/commit/3474f666bc7b701417df261bf65cae951185a1d5))
11
+
12
+ ## [21.0.1](https://github.com/cozy/cozy-libs/compare/cozy-viewer@21.0.0...cozy-viewer@21.0.1) (2025-03-25)
13
+
14
+ **Note:** Version bump only for package cozy-viewer
15
+
6
16
  # [21.0.0](https://github.com/cozy/cozy-libs/compare/cozy-viewer@20.0.0...cozy-viewer@21.0.0) (2025-03-17)
7
17
 
8
18
  ### Features
@@ -55,7 +55,7 @@ var _ShareModalProvider = _interopRequireDefault(require("./providers/ShareModal
55
55
 
56
56
  var _ViewerProvider = _interopRequireDefault(require("./providers/ViewerProvider"));
57
57
 
58
- var _excluded = ["className", "disableFooter", "disablePanel", "children", "componentsProps", "isPublic"],
58
+ var _excluded = ["className", "disableFooter", "disablePanel", "children", "componentsProps", "isPublic", "currentIndex", "files", "currentURL"],
59
59
  _excluded2 = ["disableModal"];
60
60
 
61
61
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -78,10 +78,10 @@ var ViewerContainer = function ViewerContainer(props) {
78
78
  children = props.children,
79
79
  componentsProps = props.componentsProps,
80
80
  isPublic = props.isPublic,
81
- rest = (0, _objectWithoutProperties2.default)(props, _excluded);
82
- var currentIndex = props.currentIndex,
81
+ currentIndex = props.currentIndex,
83
82
  files = props.files,
84
- currentURL = props.currentURL;
83
+ currentURL = props.currentURL,
84
+ rest = (0, _objectWithoutProperties2.default)(props, _excluded);
85
85
  var toolbarRef = /*#__PURE__*/(0, _react.createRef)();
86
86
 
87
87
  var _useBreakpoints = (0, _Breakpoints.default)(),
@@ -39,6 +39,8 @@ var _Typography = _interopRequireDefault(require("cozy-ui/transpiled/react/Typog
39
39
 
40
40
  var _withBreakpoints = _interopRequireDefault(require("cozy-ui/transpiled/react/helpers/withBreakpoints"));
41
41
 
42
+ var _Encrypted = require("cozy-ui/transpiled/react/providers/Encrypted");
43
+
42
44
  var _I18n = require("cozy-ui/transpiled/react/providers/I18n");
43
45
 
44
46
  var _ToolbarFilePath = require("./ToolbarFilePath");
@@ -92,6 +94,9 @@ var Toolbar = function Toolbar(_ref) {
92
94
  var _useShareModal = (0, _ShareModalProvider.useShareModal)(),
93
95
  setShowShareModal = _useShareModal.setShowShareModal;
94
96
 
97
+ var _useEncrypted = (0, _Encrypted.useEncrypted)(),
98
+ url = _useEncrypted.url;
99
+
95
100
  var isCozySharing = window.location.pathname === '/preview';
96
101
  var isShareNotAdded = !loading && !isSharingShortcutCreated;
97
102
  var ToolbarButtons = (0, _helpers.extractChildrenCompByName)({
@@ -146,7 +151,9 @@ var Toolbar = function Toolbar(_ref) {
146
151
  icon: _Download.default
147
152
  }),
148
153
  onClick: function onClick() {
149
- return _Actions.download.action([file], {
154
+ return (0, _Actions.download)({
155
+ encryptedUrl: url
156
+ }).action([file], {
150
157
  client: client,
151
158
  webviewIntent: webviewIntent
152
159
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-viewer",
3
- "version": "21.0.0",
3
+ "version": "21.0.2",
4
4
  "description": "Cozy-Viewer provides a component to show files in a viewer.",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -13,13 +13,17 @@
13
13
  "url": "https://github.com/cozy/cozy-libs/issues"
14
14
  },
15
15
  "scripts": {
16
- "build": "rm -rf ./dist && tsc -p tsconfig-build.json && env BABEL_ENV=transpilation babel --extensions .ts,.tsx,.js,.jsx,.md,.styl,.json,.snap ./src -d ./dist --copy-files --no-copy-ignored --verbose",
16
+ "build": "yarn build:clean && yarn build:types && env BABEL_ENV=transpilation babel --extensions .ts,.tsx,.js,.jsx,.md,.styl,.json,.snap ./src -d ./dist --copy-files --no-copy-ignored --verbose",
17
+ "build:clean": "rm -rf ./dist",
18
+ "build:types": "tsc -p tsconfig-build.json",
17
19
  "start": "yarn build --watch",
18
20
  "prepublishOnly": "yarn build",
19
21
  "test": "env NODE_ENV=test jest",
20
22
  "lint": "cd .. && yarn eslint --ext js,jsx packages/cozy-viewer"
21
23
  },
22
24
  "devDependencies": {
25
+ "@babel/cli": "7.16.8",
26
+ "@babel/core": "7.16.12",
23
27
  "@testing-library/jest-dom": "^5.14.1",
24
28
  "@testing-library/react": "11.2.7",
25
29
  "@testing-library/react-hooks": "^3.2.1",
@@ -27,10 +31,10 @@
27
31
  "babel-preset-cozy-app": "^2.8.1",
28
32
  "cozy-client": "^53.1.1",
29
33
  "cozy-device-helper": "2.0.0",
30
- "cozy-harvest-lib": "^32.3.3",
34
+ "cozy-harvest-lib": "^32.3.5",
31
35
  "cozy-intent": "^2.30.0",
32
36
  "cozy-logger": "^1.17.0",
33
- "cozy-sharing": "^25.0.0",
37
+ "cozy-sharing": "^25.1.0",
34
38
  "cozy-ui": "^121.1.1",
35
39
  "identity-obj-proxy": "3.0.0",
36
40
  "jest": "26.6.3",
@@ -60,5 +64,5 @@
60
64
  "react": ">=16.12.0",
61
65
  "react-dom": ">=16.12.0"
62
66
  },
63
- "gitHead": "33dab08dabe1d4d7367cc83642c749d3af9edefa"
67
+ "gitHead": "694a8570d692d4920f30aefd6f74d02d68bbcbf6"
64
68
  }
@@ -29,9 +29,11 @@ const ViewerContainer = props => {
29
29
  children,
30
30
  componentsProps,
31
31
  isPublic,
32
+ currentIndex,
33
+ files,
34
+ currentURL,
32
35
  ...rest
33
36
  } = props
34
- const { currentIndex, files, currentURL } = props
35
37
  const toolbarRef = createRef()
36
38
  const { isDesktop } = useBreakpoints()
37
39
  const [isReadOnly, setIsReadOnly] = useState(true)
@@ -19,6 +19,7 @@ import PreviousIcon from 'cozy-ui/transpiled/react/Icons/Previous'
19
19
  import MidEllipsis from 'cozy-ui/transpiled/react/MidEllipsis'
20
20
  import Typography from 'cozy-ui/transpiled/react/Typography'
21
21
  import withBreakpoints from 'cozy-ui/transpiled/react/helpers/withBreakpoints'
22
+ import { useEncrypted } from 'cozy-ui/transpiled/react/providers/Encrypted'
22
23
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
23
24
 
24
25
  import { ToolbarFilePath } from './ToolbarFilePath'
@@ -45,6 +46,7 @@ const Toolbar = ({
45
46
  useSharingInfos()
46
47
  const { isOwner } = useSharingContext()
47
48
  const { setShowShareModal } = useShareModal()
49
+ const { url } = useEncrypted()
48
50
 
49
51
  const isCozySharing = window.location.pathname === '/preview'
50
52
  const isShareNotAdded = !loading && !isSharingShortcutCreated
@@ -107,7 +109,12 @@ const Toolbar = ({
107
109
  aria-label={t('Viewer.download')}
108
110
  label={t('Viewer.download')}
109
111
  startIcon={<Icon icon={DownloadIcon} />}
110
- onClick={() => download.action([file], { client, webviewIntent })}
112
+ onClick={() =>
113
+ download({ encryptedUrl: url }).action([file], {
114
+ client,
115
+ webviewIntent
116
+ })
117
+ }
111
118
  />
112
119
  </div>
113
120
  )}