cozy-sharing 16.15.0 → 16.16.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,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
+ # [16.16.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@16.15.1...cozy-sharing@16.16.0) (2024-12-12)
7
+
8
+
9
+ ### Features
10
+
11
+ * **cozy-sharing:** Add conditionnal prop to openSharingLink action ([ec2a8be](https://github.com/cozy/cozy-libs/commit/ec2a8be595215745e85ae0cc1e9b7493e2c5b8a4))
12
+
13
+
14
+
15
+
16
+
17
+ ## [16.15.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@16.15.0...cozy-sharing@16.15.1) (2024-12-11)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **cozy-sharing:** Do not display loader in public context ([71ff258](https://github.com/cozy/cozy-libs/commit/71ff25879d4d98dbde49035a6f1be5eb687b1500))
23
+
24
+
25
+
26
+
27
+
6
28
  # [16.15.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@16.14.0...cozy-sharing@16.15.0) (2024-12-10)
7
29
 
8
30
 
@@ -660,20 +660,23 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
660
660
  while (1) switch (_context13.prev = _context13.next) {
661
661
  case 0:
662
662
  if (!this.isPublic) {
663
- _context13.next = 3;
663
+ _context13.next = 4;
664
664
  break;
665
665
  }
666
666
 
667
667
  // In public mode, the promise below fails because the methods do not have the required permissions.
668
668
  log.warn('fetchAllSharings is not allowed in public context.');
669
+ this.setState({
670
+ allLoaded: true
671
+ });
669
672
  return _context13.abrupt("return");
670
673
 
671
- case 3:
674
+ case 4:
672
675
  _this$props = this.props, doctype = _this$props.doctype, client = _this$props.client;
673
- _context13.next = 6;
676
+ _context13.next = 7;
674
677
  return Promise.all([this.sharingCol.findByDoctype(doctype), this.permissionCol.findLinksByDoctype(doctype), client.fetchQueryAndGetFromState(fetchApps())]);
675
678
 
676
- case 6:
679
+ case 7:
677
680
  _yield$Promise$all = _context13.sent;
678
681
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
679
682
  sharings = _yield$Promise$all2[0];
@@ -689,43 +692,43 @@ export var SharingProvider = /*#__PURE__*/function (_Component) {
689
692
  hasLoadedAtLeastOnePage: true
690
693
  }); // eslint-disable-next-line promise/catch-or-return
691
694
 
692
- _context13.next = 15;
695
+ _context13.next = 16;
693
696
  return fetchNextPermissions(permissions, this.dispatch, this.permissionCol);
694
697
 
695
- case 15:
698
+ case 16:
696
699
  if (!(doctype === 'io.cozy.files')) {
697
- _context13.next = 25;
700
+ _context13.next = 26;
698
701
  break;
699
702
  }
700
703
 
701
704
  sharedDocIds = getSharedDocIdsBySharings(sharings);
702
- _context13.next = 19;
705
+ _context13.next = 20;
703
706
  return client.collection(doctype).all({
704
707
  keys: sharedDocIds
705
708
  });
706
709
 
707
- case 19:
710
+ case 20:
708
711
  resp = _context13.sent;
709
712
  folderPaths = resp.data.filter(function (f) {
710
713
  return f.type === 'directory' && !f.trashed;
711
714
  }).map(function (f) {
712
715
  return f.path;
713
716
  });
714
- _context13.next = 23;
717
+ _context13.next = 24;
715
718
  return fetchFilesPaths(client, doctype, resp.data.filter(function (f) {
716
719
  return f.type !== 'directory' && !f.trashed;
717
720
  }));
718
721
 
719
- case 23:
722
+ case 24:
720
723
  filePaths = _context13.sent;
721
724
  this.dispatch(receivePaths([].concat(_toConsumableArray(folderPaths), _toConsumableArray(filePaths))));
722
725
 
723
- case 25:
726
+ case 26:
724
727
  this.setState({
725
728
  allLoaded: true
726
729
  });
727
730
 
728
- case 26:
731
+ case 27:
729
732
  case "end":
730
733
  return _context13.stop();
731
734
  }
@@ -23,6 +23,8 @@ var makeComponent = function makeComponent(label, icon) {
23
23
 
24
24
  export var openSharingLink = function openSharingLink(_ref) {
25
25
  var isSharingShortcutCreated = _ref.isSharingShortcutCreated,
26
+ _ref$openSharingLinkD = _ref.openSharingLinkDisplayed,
27
+ openSharingLinkDisplayed = _ref$openSharingLinkD === void 0 ? true : _ref$openSharingLinkD,
26
28
  link = _ref.link;
27
29
 
28
30
  var _getActionsI18n = getActionsI18n(),
@@ -40,6 +42,9 @@ export var openSharingLink = function openSharingLink(_ref) {
40
42
  name: 'openSharingLink',
41
43
  label: label,
42
44
  icon: icon,
45
+ displayCondition: function displayCondition() {
46
+ return openSharingLinkDisplayed;
47
+ },
43
48
  action: function action() {
44
49
  openExternalLink(link);
45
50
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "16.15.0",
3
+ "version": "16.16.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -74,5 +74,5 @@
74
74
  "sideEffects": [
75
75
  "*.css"
76
76
  ],
77
- "gitHead": "d3c8e4a895af0c8dd2d597e3b1f935a8d533730b"
77
+ "gitHead": "620313f3d90b1308f01f4e1ec5bbcd76adb64174"
78
78
  }
@@ -181,6 +181,7 @@ export class SharingProvider extends Component {
181
181
  if (this.isPublic) {
182
182
  // In public mode, the promise below fails because the methods do not have the required permissions.
183
183
  log.warn('fetchAllSharings is not allowed in public context.')
184
+ this.setState({ allLoaded: true })
184
185
  return
185
186
  }
186
187
  const { doctype, client } = this.props
@@ -24,7 +24,11 @@ const makeComponent = (label, icon) => {
24
24
  return Component
25
25
  }
26
26
 
27
- export const openSharingLink = ({ isSharingShortcutCreated, link }) => {
27
+ export const openSharingLink = ({
28
+ isSharingShortcutCreated,
29
+ openSharingLinkDisplayed = true,
30
+ link
31
+ }) => {
28
32
  const { t } = getActionsI18n()
29
33
  const { icon, label } = getIconWithlabel({
30
34
  link,
@@ -36,6 +40,7 @@ export const openSharingLink = ({ isSharingShortcutCreated, link }) => {
36
40
  name: 'openSharingLink',
37
41
  label,
38
42
  icon,
43
+ displayCondition: () => openSharingLinkDisplayed,
39
44
  action: () => {
40
45
  openExternalLink(link)
41
46
  },