cozy-sharing 10.1.4 → 10.3.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.
Files changed (142) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/ConfirmTrustedRecipientsDialog.js +1 -1
  3. package/dist/ShareButton.js +1 -1
  4. package/dist/ShareButton.spec.js +1 -1
  5. package/dist/SharedBadge.js +1 -1
  6. package/dist/SharedRecipients.js +1 -1
  7. package/dist/SharedRecipientsList.js +1 -1
  8. package/dist/SharedStatus.js +1 -1
  9. package/dist/SharingOwnerAvatar.js +1 -1
  10. package/dist/SharingProvider.js +18 -7
  11. package/dist/components/CozyPassFingerprintDialogContent.js +1 -1
  12. package/dist/components/Recipient/Identity.js +17 -17
  13. package/dist/components/Recipient/LinkRecipient.js +18 -18
  14. package/dist/components/Recipient/OwnerIdentity.js +18 -18
  15. package/dist/components/Recipient/OwnerRecipientDefault.js +2 -2
  16. package/dist/components/Recipient/RecipientConfirm.js +25 -25
  17. package/dist/components/Recipient/RecipientList.js +36 -0
  18. package/dist/components/Recipient/RecipientPlusX.js +18 -18
  19. package/dist/components/Recipient/RecipientStatus.js +17 -17
  20. package/dist/components/Recipient/RecipientWithoutStatus.js +18 -18
  21. package/dist/components/Recipient/RecipientsAvatars.js +18 -18
  22. package/dist/components/ShareAutosuggest.js +16 -16
  23. package/dist/components/ShareButton.js +2 -2
  24. package/dist/components/ShareByEmail.js +26 -26
  25. package/dist/components/ShareByLink.js +75 -50
  26. package/dist/components/ShareDialogCozyToCozy.js +25 -25
  27. package/dist/components/{EditableSharingModal.js → ShareModal/EditableSharingModal.js} +5 -5
  28. package/dist/components/{EditableSharingModal.spec.js → ShareModal/EditableSharingModal.spec.js} +6 -6
  29. package/dist/components/ShareModal/ShareModal.js +43 -0
  30. package/dist/{SharingDetailsModal.js → components/ShareModal/SharingDetailsModal.js} +28 -28
  31. package/dist/components/SharedBadge.js +6 -6
  32. package/dist/components/SharedStatus.js +4 -4
  33. package/dist/components/Sharetypeselect.js +25 -25
  34. package/dist/{SharingBanner → components/SharingBanner}/components/PublicBanner.js +1 -1
  35. package/dist/{SharingBanner → components/SharingBanner}/hooks/useSharingInfos.js +2 -2
  36. package/dist/{SharingBanner → components/SharingBanner}/index.js +1 -1
  37. package/dist/{SharingBanner → components/SharingBanner}/test/AppLike.js +2 -2
  38. package/dist/components/Tooltip.js +19 -8
  39. package/dist/components/WhoHasAccess.js +10 -20
  40. package/dist/components/WhoHasAccessLight.js +19 -1
  41. package/dist/{withLocales.js → hoc/withLocales.js} +2 -2
  42. package/dist/index.js +5 -5
  43. package/dist/{SharingBanner/components → styles}/publicBanner.styl +5 -5
  44. package/dist/stylesheet.css +340 -340
  45. package/docs/share-modal-architecture.md +44 -0
  46. package/package.json +2 -3
  47. package/src/ConfirmTrustedRecipientsDialog.jsx +1 -1
  48. package/src/ShareButton.jsx +1 -1
  49. package/src/ShareButton.spec.jsx +1 -1
  50. package/src/SharedBadge.jsx +1 -1
  51. package/src/SharedRecipients.jsx +1 -1
  52. package/src/SharedRecipientsList.jsx +1 -1
  53. package/src/SharedStatus.jsx +1 -1
  54. package/src/SharingOwnerAvatar.jsx +1 -1
  55. package/src/assets/icons/icon-arrow-down.svg +3 -0
  56. package/src/assets/icons/icon-calendar-16.svg +8 -0
  57. package/src/assets/icons/icon-check-blue.svg +59 -0
  58. package/src/assets/icons/icon-cross-bold.svg +5 -0
  59. package/src/assets/icons/icon-link.svg +14 -0
  60. package/src/assets/icons/icon-pen-16.svg +3 -0
  61. package/src/components/CozyPassFingerprintDialogContent.jsx +1 -1
  62. package/src/components/Recipient/Identity.jsx +1 -1
  63. package/src/components/Recipient/LinkRecipient.jsx +1 -1
  64. package/src/components/Recipient/OwnerIdentity.jsx +1 -1
  65. package/src/components/Recipient/RecipientConfirm.jsx +1 -1
  66. package/src/components/Recipient/RecipientList.jsx +45 -0
  67. package/src/components/Recipient/RecipientPlusX.jsx +1 -1
  68. package/src/components/Recipient/RecipientStatus.jsx +1 -1
  69. package/src/components/Recipient/RecipientWithoutStatus.jsx +1 -1
  70. package/src/components/Recipient/RecipientsAvatars.jsx +1 -1
  71. package/src/components/ShareAutosuggest.jsx +1 -1
  72. package/src/components/ShareButton.jsx +1 -1
  73. package/src/components/ShareByEmail.jsx +1 -1
  74. package/src/components/ShareByLink.jsx +12 -10
  75. package/src/components/ShareDialogCozyToCozy.jsx +1 -1
  76. package/src/components/{EditableSharingModal.jsx → ShareModal/EditableSharingModal.jsx} +5 -5
  77. package/src/components/{EditableSharingModal.spec.jsx → ShareModal/EditableSharingModal.spec.jsx} +6 -6
  78. package/src/components/ShareModal/ShareModal.jsx +45 -0
  79. package/src/{SharingDetailsModal.jsx → components/ShareModal/SharingDetailsModal.jsx} +4 -4
  80. package/src/components/SharedBadge.jsx +1 -1
  81. package/src/components/SharedStatus.jsx +2 -2
  82. package/src/components/Sharetypeselect.jsx +1 -1
  83. package/src/{SharingBanner → components/SharingBanner}/components/PublicBanner.jsx +1 -1
  84. package/src/{SharingBanner → components/SharingBanner}/hooks/useSharingInfos.jsx +2 -2
  85. package/src/{SharingBanner → components/SharingBanner}/index.jsx +1 -1
  86. package/src/{SharingBanner → components/SharingBanner}/test/AppLike.jsx +2 -2
  87. package/src/components/Tooltip.jsx +1 -1
  88. package/src/components/WhoHasAccess.jsx +11 -29
  89. package/src/components/WhoHasAccessLight.jsx +1 -1
  90. package/src/{withLocales.jsx → hoc/withLocales.jsx} +2 -2
  91. package/src/index.jsx +6 -5
  92. package/src/{SharingBanner/components → styles}/publicBanner.styl +5 -5
  93. package/dist/ShareModal.js +0 -50
  94. package/src/ShareModal.jsx +0 -51
  95. /package/{assets → dist/assets}/icons/icon-arrow-down.svg +0 -0
  96. /package/{assets → dist/assets}/icons/icon-calendar-16.svg +0 -0
  97. /package/{assets → dist/assets}/icons/icon-check-blue.svg +0 -0
  98. /package/{assets → dist/assets}/icons/icon-cross-bold.svg +0 -0
  99. /package/{assets → dist/assets}/icons/icon-link.svg +0 -0
  100. /package/{assets → dist/assets}/icons/icon-pen-16.svg +0 -0
  101. /package/dist/{SharingBanner → components/SharingBanner}/components/CozyHomeLinkIcon.js +0 -0
  102. /package/dist/{SharingBanner → components/SharingBanner}/components/PublicBanner.spec.js +0 -0
  103. /package/dist/{SharingBanner → components/SharingBanner}/components/SharingBanner.js +0 -0
  104. /package/dist/{SharingBanner → components/SharingBanner}/helpers/QueryParameter.js +0 -0
  105. /package/dist/{SharingBanner → components/SharingBanner}/helpers/QueryParameter.spec.js +0 -0
  106. /package/dist/{SharingBanner → components/SharingBanner}/hooks/useSharingInfos.spec.js +0 -0
  107. /package/dist/{SharingBanner → components/SharingBanner}/test/AcceptingSharingContext.js +0 -0
  108. /package/dist/{SharingBanner → components/SharingBanner}/test/FabProvider.js +0 -0
  109. /package/dist/{SharingBanner → components/SharingBanner}/test/ModalContext.js +0 -0
  110. /package/dist/{SharingBanner → components/SharingBanner}/test/RouterContext.js +0 -0
  111. /package/dist/{SharingBanner → components/SharingBanner}/test/ThumbnailSizeContext.js +0 -0
  112. /package/dist/{components → hooks}/useFetchDocumentPath.js +0 -0
  113. /package/dist/{components → styles}/CozyPassFingerprintDialogContent.styl +0 -0
  114. /package/dist/{components → styles}/actionmenu.styl +0 -0
  115. /package/dist/{components → styles}/autosuggest.styl +0 -0
  116. /package/dist/{components → styles}/badge.styl +0 -0
  117. /package/dist/{components → styles}/button.styl +0 -0
  118. /package/dist/{components/Recipient → styles}/recipient.styl +0 -0
  119. /package/dist/{share.styl → styles/share.styl} +0 -0
  120. /package/dist/{components → styles}/status.styl +0 -0
  121. /package/dist/{components → styles}/tooltip.styl +0 -0
  122. /package/src/{SharingBanner → components/SharingBanner}/components/CozyHomeLinkIcon.jsx +0 -0
  123. /package/src/{SharingBanner → components/SharingBanner}/components/PublicBanner.spec.jsx +0 -0
  124. /package/src/{SharingBanner → components/SharingBanner}/components/SharingBanner.jsx +0 -0
  125. /package/src/{SharingBanner → components/SharingBanner}/helpers/QueryParameter.js +0 -0
  126. /package/src/{SharingBanner → components/SharingBanner}/helpers/QueryParameter.spec.js +0 -0
  127. /package/src/{SharingBanner → components/SharingBanner}/hooks/useSharingInfos.spec.js +0 -0
  128. /package/src/{SharingBanner → components/SharingBanner}/test/AcceptingSharingContext.jsx +0 -0
  129. /package/src/{SharingBanner → components/SharingBanner}/test/FabProvider.jsx +0 -0
  130. /package/src/{SharingBanner → components/SharingBanner}/test/ModalContext.jsx +0 -0
  131. /package/src/{SharingBanner → components/SharingBanner}/test/RouterContext.jsx +0 -0
  132. /package/src/{SharingBanner → components/SharingBanner}/test/ThumbnailSizeContext.jsx +0 -0
  133. /package/src/{components → hooks}/useFetchDocumentPath.jsx +0 -0
  134. /package/src/{components → styles}/CozyPassFingerprintDialogContent.styl +0 -0
  135. /package/src/{components → styles}/actionmenu.styl +0 -0
  136. /package/src/{components → styles}/autosuggest.styl +0 -0
  137. /package/src/{components → styles}/badge.styl +0 -0
  138. /package/src/{components → styles}/button.styl +0 -0
  139. /package/src/{components/Recipient → styles}/recipient.styl +0 -0
  140. /package/src/{share.styl → styles/share.styl} +0 -0
  141. /package/src/{components → styles}/status.styl +0 -0
  142. /package/src/{components → styles}/tooltip.styl +0 -0
@@ -8,20 +8,20 @@ import Chip from 'cozy-ui/transpiled/react/Chips';
8
8
  import { Spinner } from 'cozy-ui/transpiled/react/Spinner';
9
9
  import palette from 'cozy-ui/transpiled/react/palette';
10
10
  import ContactSuggestion from './ContactSuggestion';
11
- var styles = {
12
- "CozyTheme--inverted": "autosuggest__CozyTheme--inverted___QJCUa",
13
- "CozyTheme--normal": "autosuggest__CozyTheme--normal___1-_dN",
14
- "container": "autosuggest__container___1dbB4",
15
- "suggestionsContainer": "autosuggest__suggestionsContainer___-PUXu",
16
- "suggestionsContainerOpen": "autosuggest__suggestionsContainerOpen___LO5cw",
17
- "input": "autosuggest__input___3b74d",
18
- "suggestionsList": "autosuggest__suggestionsList___211Pt",
19
- "suggestionHighlighted": "autosuggest__suggestionHighlighted___MbW8F",
20
- "recipientsContainer": "autosuggest__recipientsContainer___15b1_",
21
- "recipientChip": "autosuggest__recipientChip___oRxU-"
22
- };
23
11
  import { extractEmails, validateEmail } from '../helpers/email';
24
12
  import { getDisplayName, getInitials, Contact } from '../models';
13
+ var styles = {
14
+ "CozyTheme--inverted": "autosuggest__CozyTheme--inverted___3qp6I",
15
+ "CozyTheme--normal": "autosuggest__CozyTheme--normal___3fMAz",
16
+ "container": "autosuggest__container___1Yro7",
17
+ "suggestionsContainer": "autosuggest__suggestionsContainer___3EDuG",
18
+ "suggestionsContainerOpen": "autosuggest__suggestionsContainerOpen___35OCI",
19
+ "input": "autosuggest__input___1Ea-3",
20
+ "suggestionsList": "autosuggest__suggestionsList___3uRpV",
21
+ "suggestionHighlighted": "autosuggest__suggestionHighlighted___1vpXJ",
22
+ "recipientsContainer": "autosuggest__recipientsContainer___1JYxA",
23
+ "recipientChip": "autosuggest__recipientChip___d5I3R"
24
+ };
25
25
  import { cozyUrlMatch, emailMatch, groupNameMatch, fullnameMatch } from '../suggestionMatchers';
26
26
 
27
27
  var ShareAutocomplete = function ShareAutocomplete(_ref) {
@@ -132,18 +132,18 @@ var ShareAutocomplete = function ShareAutocomplete(_ref) {
132
132
  };
133
133
 
134
134
  var onAutosuggestPick = function onAutosuggestPick(value) {
135
- var _autosuggestRef$curre, _autosuggestRef$curre2;
135
+ var _autosuggestRef$curre;
136
136
 
137
137
  onPick(value);
138
138
  setInputValue('');
139
- autosuggestRef === null || autosuggestRef === void 0 ? void 0 : (_autosuggestRef$curre = autosuggestRef.current) === null || _autosuggestRef$curre === void 0 ? void 0 : (_autosuggestRef$curre2 = _autosuggestRef$curre.input) === null || _autosuggestRef$curre2 === void 0 ? void 0 : _autosuggestRef$curre2.focus();
139
+ autosuggestRef === null || autosuggestRef === void 0 || (_autosuggestRef$curre = autosuggestRef.current) === null || _autosuggestRef$curre === void 0 || (_autosuggestRef$curre = _autosuggestRef$curre.input) === null || _autosuggestRef$curre === void 0 || _autosuggestRef$curre.focus();
140
140
  };
141
141
 
142
142
  var onAutosuggestRemove = function onAutosuggestRemove(value) {
143
- var _autosuggestRef$curre3, _autosuggestRef$curre4;
143
+ var _autosuggestRef$curre2;
144
144
 
145
145
  onRemove(value);
146
- autosuggestRef === null || autosuggestRef === void 0 ? void 0 : (_autosuggestRef$curre3 = autosuggestRef.current) === null || _autosuggestRef$curre3 === void 0 ? void 0 : (_autosuggestRef$curre4 = _autosuggestRef$curre3.input) === null || _autosuggestRef$curre4 === void 0 ? void 0 : _autosuggestRef$curre4.focus();
146
+ autosuggestRef === null || autosuggestRef === void 0 || (_autosuggestRef$curre2 = autosuggestRef.current) === null || _autosuggestRef$curre2 === void 0 || (_autosuggestRef$curre2 = _autosuggestRef$curre2.input) === null || _autosuggestRef$curre2 === void 0 || _autosuggestRef$curre2.focus();
147
147
  };
148
148
 
149
149
  var renderInput = function renderInput(inputProps) {
@@ -9,8 +9,8 @@ import Icon from 'cozy-ui/transpiled/react/Icon';
9
9
  import ShareIcon from 'cozy-ui/transpiled/react/Icons/Share';
10
10
  import { Button } from 'cozy-ui/transpiled/react/deprecated/Button';
11
11
  var styles = {
12
- "coz-btn-shared": "button__coz-btn-shared___2BoMk",
13
- "coz-btn-sharedWithMe": "button__coz-btn-sharedWithMe___2Vjfh"
12
+ "coz-btn-shared": "button__coz-btn-shared___9MFbY",
13
+ "coz-btn-sharedWithMe": "button__coz-btn-sharedWithMe___25PBh"
14
14
  };
15
15
  export var ShareButton = function ShareButton(_ref) {
16
16
  var label = _ref.label,
@@ -17,34 +17,34 @@ import { hasReachRecipientsLimit } from '../helpers/recipients';
17
17
  import { getSuccessMessage } from '../helpers/successMessage';
18
18
  import { Group } from '../models';
19
19
  import { contactsResponseType, groupsResponseType } from '../propTypes';
20
+ import { isReadOnlySharing } from '../state';
20
21
  var styles = {
21
- "share-modal-content": "share__share-modal-content___XTtaK",
22
- "coz-form": "share__coz-form___33NYF",
23
- "coz-form-group": "share__coz-form-group___1PLAZ",
24
- "coz-form-desc": "share__coz-form-desc___-pmK5",
25
- "coz-form-label": "share__coz-form-label___31jb0",
26
- "coz-form-label--error": "share__coz-form-label--error___2EXCl",
27
- "coz-form-errors": "share__coz-form-errors___1rk2R",
28
- "coz-form-controls": "share__coz-form-controls___39Uwg",
29
- "coz-form-controls--full": "share__coz-form-controls--full___1YpNp",
30
- "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___3JXzz",
31
- "error": "share__error___6Ycal",
32
- "CozyTheme--inverted": "share__CozyTheme--inverted___2pLD2",
33
- "CozyTheme--normal": "share__CozyTheme--normal___qSFyr",
34
- "share-byemail-onlybylink": "share__share-byemail-onlybylink___C_7b_",
35
- "aligned-dropdown-button": "share__aligned-dropdown-button___CeTDs",
36
- "share-type-control": "share__share-type-control___KcpDf",
37
- "select-wrapper": "share__select-wrapper___3FfiH",
38
- "select-option": "share__select-option___13o6b",
39
- "select-option-label": "share__select-option-label___Zj_RU",
40
- "select-option-desc": "share__select-option-desc___6uaQq",
41
- "share-details-created": "share__share-details-created___13BO0",
42
- "share-details-perm": "share__share-details-perm___23_VF",
43
- "share-details-perm-desc": "share__share-details-perm-desc___tqfXx",
44
- "spin": "share__spin___1P7nU",
45
- "shake": "share__shake___1EeCI"
22
+ "share-modal-content": "share__share-modal-content___1iqEq",
23
+ "coz-form": "share__coz-form___1ICST",
24
+ "coz-form-group": "share__coz-form-group___VsQp7",
25
+ "coz-form-desc": "share__coz-form-desc___2mYN4",
26
+ "coz-form-label": "share__coz-form-label___bogBw",
27
+ "coz-form-label--error": "share__coz-form-label--error___3YPkf",
28
+ "coz-form-errors": "share__coz-form-errors___2xYRz",
29
+ "coz-form-controls": "share__coz-form-controls___H8kGc",
30
+ "coz-form-controls--full": "share__coz-form-controls--full___1oQXF",
31
+ "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___1zIxt",
32
+ "error": "share__error___pwqPO",
33
+ "CozyTheme--inverted": "share__CozyTheme--inverted___oxix3",
34
+ "CozyTheme--normal": "share__CozyTheme--normal___2PCy8",
35
+ "share-byemail-onlybylink": "share__share-byemail-onlybylink___29W-t",
36
+ "aligned-dropdown-button": "share__aligned-dropdown-button___3crgG",
37
+ "share-type-control": "share__share-type-control___1YoRr",
38
+ "select-wrapper": "share__select-wrapper___3XBKC",
39
+ "select-option": "share__select-option___3Jp8_",
40
+ "select-option-label": "share__select-option-label___1BWz_",
41
+ "select-option-desc": "share__select-option-desc___3jOnr",
42
+ "share-details-created": "share__share-details-created___z3nvO",
43
+ "share-details-perm": "share__share-details-perm___3HjxK",
44
+ "share-details-perm-desc": "share__share-details-perm-desc___3HyHu",
45
+ "spin": "share__spin___hhtoM",
46
+ "shake": "share__shake___2au1o"
46
47
  };
47
- import { isReadOnlySharing } from '../state';
48
48
  export var ShareByEmail = function ShareByEmail(_ref) {
49
49
  var contacts = _ref.contacts,
50
50
  groups = _ref.groups,
@@ -7,7 +7,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
7
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
8
 
9
9
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
- import copy from 'copy-text-to-clipboard';
11
10
  import PropTypes from 'prop-types';
12
11
  import React, { useState, useEffect, useCallback } from 'react';
13
12
  import Alert from 'cozy-ui/transpiled/react/Alert';
@@ -54,71 +53,97 @@ var ShareByLink = function ShareByLink(_ref) {
54
53
  isEditDialogOpen = _useState8[0],
55
54
  setIsEditDialogOpen = _useState8[1];
56
55
 
57
- var copyLinkToClipboard = useCallback(function (_ref2) {
58
- var isAutomaticCopy = _ref2.isAutomaticCopy;
56
+ var copyLinkToClipboard = useCallback( /*#__PURE__*/function () {
57
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
58
+ var isAutomaticCopy;
59
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
60
+ while (1) switch (_context.prev = _context.next) {
61
+ case 0:
62
+ isAutomaticCopy = _ref2.isAutomaticCopy;
63
+ _context.prev = 1;
64
+ _context.next = 4;
65
+ return navigator.clipboard.writeText(link);
59
66
 
60
- if (copy(link)) {
61
- setAlert({
62
- open: true,
63
- severity: 'success',
64
- message: t("".concat(documentType, ".share.shareByLink.copied"))
65
- });
66
- } else if (!isAutomaticCopy) {
67
- // In case of automatic copy, the browser can block the copy request. This is not shown to the user since it is expected and can be circumvented by clicking directly on the copy link
68
- setAlert({
69
- open: true,
70
- severity: 'error',
71
- message: t("".concat(documentType, ".share.shareByLink.failed"))
72
- });
73
- }
74
- }, [documentType, link, t]);
67
+ case 4:
68
+ setAlert({
69
+ open: true,
70
+ severity: 'success',
71
+ message: t("".concat(documentType, ".share.shareByLink.copied"))
72
+ });
73
+ _context.next = 10;
74
+ break;
75
+
76
+ case 7:
77
+ _context.prev = 7;
78
+ _context.t0 = _context["catch"](1);
79
+
80
+ if (!isAutomaticCopy) {
81
+ // In case of automatic copy, the browser can block the copy request. This is not shown to the user since it is expected and can be circumvented by clicking directly on the copy link
82
+ setAlert({
83
+ open: true,
84
+ severity: 'error',
85
+ message: t("".concat(documentType, ".share.shareByLink.failed"))
86
+ });
87
+ }
88
+
89
+ case 10:
90
+ case "end":
91
+ return _context.stop();
92
+ }
93
+ }, _callee, null, [[1, 7]]);
94
+ }));
95
+
96
+ return function (_x) {
97
+ return _ref3.apply(this, arguments);
98
+ };
99
+ }(), [documentType, link, t]);
75
100
 
76
101
  var onPermissionsSelected = /*#__PURE__*/function () {
77
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
78
- return _regeneratorRuntime.wrap(function _callee$(_context) {
79
- while (1) switch (_context.prev = _context.next) {
102
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(options) {
103
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
104
+ while (1) switch (_context2.prev = _context2.next) {
80
105
  case 0:
81
- _context.prev = 0;
106
+ _context2.prev = 0;
82
107
  setLoading(true);
83
- _context.next = 4;
108
+ _context2.next = 4;
84
109
  return onEnable(document, options);
85
110
 
86
111
  case 4:
87
- _context.next = 10;
112
+ _context2.next = 10;
88
113
  break;
89
114
 
90
115
  case 6:
91
- _context.prev = 6;
92
- _context.t0 = _context["catch"](0);
116
+ _context2.prev = 6;
117
+ _context2.t0 = _context2["catch"](0);
93
118
  setAlert({
94
119
  open: true,
95
120
  severity: 'error',
96
121
  message: t("".concat(documentType, ".share.error.generic"))
97
122
  });
98
- logger.log(_context.t0);
123
+ logger.log(_context2.t0);
99
124
 
100
125
  case 10:
101
- _context.prev = 10;
126
+ _context2.prev = 10;
102
127
  setLoading(false);
103
128
  setShouldCopyToClipboard(true);
104
- return _context.finish(10);
129
+ return _context2.finish(10);
105
130
 
106
131
  case 14:
107
132
  case "end":
108
- return _context.stop();
133
+ return _context2.stop();
109
134
  }
110
- }, _callee, null, [[0, 6, 10, 14]]);
135
+ }, _callee2, null, [[0, 6, 10, 14]]);
111
136
  }));
112
137
 
113
- return function onPermissionsSelected(_x) {
114
- return _ref3.apply(this, arguments);
138
+ return function onPermissionsSelected(_x2) {
139
+ return _ref4.apply(this, arguments);
115
140
  };
116
141
  }();
117
142
 
118
143
  var onCreate = /*#__PURE__*/function () {
119
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
120
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
121
- while (1) switch (_context2.prev = _context2.next) {
144
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
145
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
146
+ while (1) switch (_context3.prev = _context3.next) {
122
147
  case 0:
123
148
  if (isOnlyReadOnlyLinkAllowed({
124
149
  documentType: documentType
@@ -132,13 +157,13 @@ var ShareByLink = function ShareByLink(_ref) {
132
157
 
133
158
  case 1:
134
159
  case "end":
135
- return _context2.stop();
160
+ return _context3.stop();
136
161
  }
137
- }, _callee2);
162
+ }, _callee3);
138
163
  }));
139
164
 
140
165
  return function onCreate() {
141
- return _ref4.apply(this, arguments);
166
+ return _ref5.apply(this, arguments);
142
167
  };
143
168
  }();
144
169
 
@@ -165,28 +190,28 @@ var ShareByLink = function ShareByLink(_ref) {
165
190
  var showOnlyCopyButton = link && !isMobile || link && isMobile && !navigator.share;
166
191
 
167
192
  var shareLink = /*#__PURE__*/function () {
168
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
193
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
169
194
  var shareData;
170
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
171
- while (1) switch (_context3.prev = _context3.next) {
195
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
196
+ while (1) switch (_context4.prev = _context4.next) {
172
197
  case 0:
173
- _context3.prev = 0;
198
+ _context4.prev = 0;
174
199
  shareData = {
175
200
  text: t("".concat(documentType, ".share.shareByLink.shareDescription"), {
176
201
  name: document.name || ''
177
202
  }),
178
203
  url: link
179
204
  };
180
- _context3.next = 4;
205
+ _context4.next = 4;
181
206
  return navigator.share(shareData);
182
207
 
183
208
  case 4:
184
- _context3.next = 9;
209
+ _context4.next = 9;
185
210
  break;
186
211
 
187
212
  case 6:
188
- _context3.prev = 6;
189
- _context3.t0 = _context3["catch"](0);
213
+ _context4.prev = 6;
214
+ _context4.t0 = _context4["catch"](0);
190
215
  setAlert({
191
216
  open: true,
192
217
  severity: 'error',
@@ -195,13 +220,13 @@ var ShareByLink = function ShareByLink(_ref) {
195
220
 
196
221
  case 9:
197
222
  case "end":
198
- return _context3.stop();
223
+ return _context4.stop();
199
224
  }
200
- }, _callee3, null, [[0, 6]]);
225
+ }, _callee4, null, [[0, 6]]);
201
226
  }));
202
227
 
203
228
  return function shareLink() {
204
- return _ref5.apply(this, arguments);
229
+ return _ref6.apply(this, arguments);
205
230
  };
206
231
  }();
207
232
 
@@ -10,31 +10,31 @@ import { default as DumbShareByLink } from './ShareByLink';
10
10
  import ShareDialogTwoStepsConfirmationContainer from './ShareDialogTwoStepsConfirmationContainer';
11
11
  import WhoHasAccess from './WhoHasAccess';
12
12
  var styles = {
13
- "share-modal-content": "share__share-modal-content___XTtaK",
14
- "coz-form": "share__coz-form___33NYF",
15
- "coz-form-group": "share__coz-form-group___1PLAZ",
16
- "coz-form-desc": "share__coz-form-desc___-pmK5",
17
- "coz-form-label": "share__coz-form-label___31jb0",
18
- "coz-form-label--error": "share__coz-form-label--error___2EXCl",
19
- "coz-form-errors": "share__coz-form-errors___1rk2R",
20
- "coz-form-controls": "share__coz-form-controls___39Uwg",
21
- "coz-form-controls--full": "share__coz-form-controls--full___1YpNp",
22
- "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___3JXzz",
23
- "error": "share__error___6Ycal",
24
- "CozyTheme--inverted": "share__CozyTheme--inverted___2pLD2",
25
- "CozyTheme--normal": "share__CozyTheme--normal___qSFyr",
26
- "share-byemail-onlybylink": "share__share-byemail-onlybylink___C_7b_",
27
- "aligned-dropdown-button": "share__aligned-dropdown-button___CeTDs",
28
- "share-type-control": "share__share-type-control___KcpDf",
29
- "select-wrapper": "share__select-wrapper___3FfiH",
30
- "select-option": "share__select-option___13o6b",
31
- "select-option-label": "share__select-option-label___Zj_RU",
32
- "select-option-desc": "share__select-option-desc___6uaQq",
33
- "share-details-created": "share__share-details-created___13BO0",
34
- "share-details-perm": "share__share-details-perm___23_VF",
35
- "share-details-perm-desc": "share__share-details-perm-desc___tqfXx",
36
- "spin": "share__spin___1P7nU",
37
- "shake": "share__shake___1EeCI"
13
+ "share-modal-content": "share__share-modal-content___1iqEq",
14
+ "coz-form": "share__coz-form___1ICST",
15
+ "coz-form-group": "share__coz-form-group___VsQp7",
16
+ "coz-form-desc": "share__coz-form-desc___2mYN4",
17
+ "coz-form-label": "share__coz-form-label___bogBw",
18
+ "coz-form-label--error": "share__coz-form-label--error___3YPkf",
19
+ "coz-form-errors": "share__coz-form-errors___2xYRz",
20
+ "coz-form-controls": "share__coz-form-controls___H8kGc",
21
+ "coz-form-controls--full": "share__coz-form-controls--full___1oQXF",
22
+ "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___1zIxt",
23
+ "error": "share__error___pwqPO",
24
+ "CozyTheme--inverted": "share__CozyTheme--inverted___oxix3",
25
+ "CozyTheme--normal": "share__CozyTheme--normal___2PCy8",
26
+ "share-byemail-onlybylink": "share__share-byemail-onlybylink___29W-t",
27
+ "aligned-dropdown-button": "share__aligned-dropdown-button___3crgG",
28
+ "share-type-control": "share__share-type-control___1YoRr",
29
+ "select-wrapper": "share__select-wrapper___3XBKC",
30
+ "select-option": "share__select-option___3Jp8_",
31
+ "select-option-label": "share__select-option-label___1BWz_",
32
+ "select-option-desc": "share__select-option-desc___3jOnr",
33
+ "share-details-created": "share__share-details-created___z3nvO",
34
+ "share-details-perm": "share__share-details-perm___3HjxK",
35
+ "share-details-perm-desc": "share__share-details-perm-desc___3HyHu",
36
+ "spin": "share__spin___hhtoM",
37
+ "shake": "share__shake___2au1o"
38
38
  };
39
39
  /**
40
40
  * Displays the sharing interface that can be used when ShareDialogCozyToCozy is in sharing state
@@ -4,11 +4,11 @@ var _excluded = ["document"];
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
6
  import { useClient, useQueryAll } from 'cozy-client';
7
- import { default as DumbShareModal } from './ShareModal';
8
- import { useFetchDocumentPath } from './useFetchDocumentPath';
9
- import SharingContext from '../context';
10
- import { Contact } from '../models';
11
- import { buildContactsQuery, buildGroupsQuery } from '../queries/queries';
7
+ import SharingContext from '../../context';
8
+ import { useFetchDocumentPath } from '../../hooks/useFetchDocumentPath';
9
+ import { Contact } from '../../models';
10
+ import { buildContactsQuery, buildGroupsQuery } from '../../queries/queries';
11
+ import { default as DumbShareModal } from '../ShareModal';
12
12
  export var EditableSharingModal = function EditableSharingModal(_ref) {
13
13
  var document = _ref.document,
14
14
  rest = _objectWithoutProperties(_ref, _excluded);
@@ -3,12 +3,12 @@ import React from 'react';
3
3
  import { createMockClient } from 'cozy-client';
4
4
  import { BreakpointsProvider } from 'cozy-ui/transpiled/react/providers/Breakpoints';
5
5
  import { EditableSharingModal } from './EditableSharingModal';
6
- import { default as DumbShareModal } from './ShareModal';
7
- import { useFetchDocumentPath } from './useFetchDocumentPath';
8
- import AppLike from '../../test/AppLike';
9
- import { SharingProvider } from '../SharingProvider';
10
- import { receivePaths } from '../state';
11
- jest.mock('./useFetchDocumentPath', function () {
6
+ import AppLike from '../../../test/AppLike';
7
+ import { SharingProvider } from '../../SharingProvider';
8
+ import { useFetchDocumentPath } from '../../hooks/useFetchDocumentPath';
9
+ import { receivePaths } from '../../state';
10
+ import { default as DumbShareModal } from '../ShareModal';
11
+ jest.mock('../../hooks/useFetchDocumentPath', function () {
12
12
  return {
13
13
  useFetchDocumentPath: jest.fn()
14
14
  };
@@ -0,0 +1,43 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import omit from 'lodash/omit';
3
+ import React from 'react';
4
+ import { useLocation } from 'react-router';
5
+ import EditableSharingModal from './EditableSharingModal';
6
+ import { SharingDetailsModal } from './SharingDetailsModal';
7
+ import withLocales from '../../hoc/withLocales';
8
+ import { useSharingContext } from '../../hooks/useSharingContext';
9
+ export var ShareModal = withLocales(function (props) {
10
+ var _location$state;
11
+
12
+ var location = useLocation === null || useLocation === void 0 ? void 0 : useLocation();
13
+ var locationProps = location === null || location === void 0 || (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.modalProps;
14
+ var document = (locationProps === null || locationProps === void 0 ? void 0 : locationProps.document) || props.document;
15
+ var rest = omit(locationProps || props, 'document');
16
+
17
+ var _useSharingContext = useSharingContext(),
18
+ byDocId = _useSharingContext.byDocId,
19
+ isOwner = _useSharingContext.isOwner,
20
+ canReshare = _useSharingContext.canReshare,
21
+ documentType = _useSharingContext.documentType,
22
+ getOwner = _useSharingContext.getOwner,
23
+ getSharingType = _useSharingContext.getSharingType,
24
+ getRecipients = _useSharingContext.getRecipients,
25
+ revokeSelf = _useSharingContext.revokeSelf;
26
+
27
+ var isEditable = !byDocId[document.id] || isOwner(document.id) || canReshare(document.id);
28
+
29
+ if (isEditable) {
30
+ return /*#__PURE__*/React.createElement(EditableSharingModal, _extends({
31
+ document: document
32
+ }, rest));
33
+ }
34
+
35
+ return /*#__PURE__*/React.createElement(SharingDetailsModal, _extends({
36
+ document: document,
37
+ documentType: documentType,
38
+ owner: getOwner(document.id),
39
+ sharingType: getSharingType(document.id),
40
+ recipients: getRecipients(document.id),
41
+ onRevoke: revokeSelf
42
+ }, rest));
43
+ });
@@ -3,36 +3,36 @@ import React from 'react';
3
3
  import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
4
4
  import Divider from 'cozy-ui/transpiled/react/Divider';
5
5
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
6
- import OwnerIdentity from './components/Recipient/OwnerIdentity';
7
- import WhoHasAccess from './components/WhoHasAccess';
8
- import { getDisplayName } from './models';
6
+ import { getDisplayName } from '../../models';
9
7
  var styles = {
10
- "share-modal-content": "share__share-modal-content___XTtaK",
11
- "coz-form": "share__coz-form___33NYF",
12
- "coz-form-group": "share__coz-form-group___1PLAZ",
13
- "coz-form-desc": "share__coz-form-desc___-pmK5",
14
- "coz-form-label": "share__coz-form-label___31jb0",
15
- "coz-form-label--error": "share__coz-form-label--error___2EXCl",
16
- "coz-form-errors": "share__coz-form-errors___1rk2R",
17
- "coz-form-controls": "share__coz-form-controls___39Uwg",
18
- "coz-form-controls--full": "share__coz-form-controls--full___1YpNp",
19
- "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___3JXzz",
20
- "error": "share__error___6Ycal",
21
- "CozyTheme--inverted": "share__CozyTheme--inverted___2pLD2",
22
- "CozyTheme--normal": "share__CozyTheme--normal___qSFyr",
23
- "share-byemail-onlybylink": "share__share-byemail-onlybylink___C_7b_",
24
- "aligned-dropdown-button": "share__aligned-dropdown-button___CeTDs",
25
- "share-type-control": "share__share-type-control___KcpDf",
26
- "select-wrapper": "share__select-wrapper___3FfiH",
27
- "select-option": "share__select-option___13o6b",
28
- "select-option-label": "share__select-option-label___Zj_RU",
29
- "select-option-desc": "share__select-option-desc___6uaQq",
30
- "share-details-created": "share__share-details-created___13BO0",
31
- "share-details-perm": "share__share-details-perm___23_VF",
32
- "share-details-perm-desc": "share__share-details-perm-desc___tqfXx",
33
- "spin": "share__spin___1P7nU",
34
- "shake": "share__shake___1EeCI"
8
+ "share-modal-content": "share__share-modal-content___1iqEq",
9
+ "coz-form": "share__coz-form___1ICST",
10
+ "coz-form-group": "share__coz-form-group___VsQp7",
11
+ "coz-form-desc": "share__coz-form-desc___2mYN4",
12
+ "coz-form-label": "share__coz-form-label___bogBw",
13
+ "coz-form-label--error": "share__coz-form-label--error___3YPkf",
14
+ "coz-form-errors": "share__coz-form-errors___2xYRz",
15
+ "coz-form-controls": "share__coz-form-controls___H8kGc",
16
+ "coz-form-controls--full": "share__coz-form-controls--full___1oQXF",
17
+ "coz-form-controls--dispatch": "share__coz-form-controls--dispatch___1zIxt",
18
+ "error": "share__error___pwqPO",
19
+ "CozyTheme--inverted": "share__CozyTheme--inverted___oxix3",
20
+ "CozyTheme--normal": "share__CozyTheme--normal___2PCy8",
21
+ "share-byemail-onlybylink": "share__share-byemail-onlybylink___29W-t",
22
+ "aligned-dropdown-button": "share__aligned-dropdown-button___3crgG",
23
+ "share-type-control": "share__share-type-control___1YoRr",
24
+ "select-wrapper": "share__select-wrapper___3XBKC",
25
+ "select-option": "share__select-option___3Jp8_",
26
+ "select-option-label": "share__select-option-label___1BWz_",
27
+ "select-option-desc": "share__select-option-desc___3jOnr",
28
+ "share-details-created": "share__share-details-created___z3nvO",
29
+ "share-details-perm": "share__share-details-perm___3HjxK",
30
+ "share-details-perm-desc": "share__share-details-perm-desc___3HyHu",
31
+ "spin": "share__spin___hhtoM",
32
+ "shake": "share__shake___2au1o"
35
33
  };
34
+ import OwnerIdentity from '../Recipient/OwnerIdentity';
35
+ import WhoHasAccess from '../WhoHasAccess';
36
36
  export var SharingDetailsModal = function SharingDetailsModal(_ref) {
37
37
  var onClose = _ref.onClose,
38
38
  sharingType = _ref.sharingType,
@@ -5,12 +5,12 @@ import Icon from 'cozy-ui/transpiled/react/Icon';
5
5
  import ShareIcon from 'cozy-ui/transpiled/react/Icons/Share';
6
6
  import palette from 'cozy-ui/transpiled/react/palette';
7
7
  var styles = {
8
- "shared-badge": "badge__shared-badge___2QYc_",
9
- "--small": "badge__--small___3i2p8",
10
- "shared-badge-icon": "badge__shared-badge-icon___kngsy",
11
- "--xsmall": "badge__--xsmall___1SOfR",
12
- "--by-me": "badge__--by-me___3zfDg",
13
- "--with-me": "badge__--with-me___30u7z"
8
+ "shared-badge": "badge__shared-badge___2jGsy",
9
+ "--small": "badge__--small___2VMyY",
10
+ "shared-badge-icon": "badge__shared-badge-icon___3s9t1",
11
+ "--xsmall": "badge__--xsmall___2cEGG",
12
+ "--by-me": "badge__--by-me___3aTHb",
13
+ "--with-me": "badge__--with-me___3jW7R"
14
14
  };
15
15
 
16
16
  var SharedBadge = function SharedBadge(_ref) {
@@ -3,10 +3,6 @@ import React from 'react';
3
3
  import palette from 'cozy-ui/transpiled/react/palette';
4
4
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
5
5
  import { SharingTooltip, TooltipRecipientList } from './Tooltip';
6
- var styles = {
7
- "shared-status": "status__shared-status___J15Fy",
8
- "shared-status-label": "status__shared-status-label___2AWic"
9
- };
10
6
 
11
7
  var LinkIcon = function LinkIcon(props) {
12
8
  return /*#__PURE__*/React.createElement("svg", props, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("path", {
@@ -26,6 +22,10 @@ LinkIcon.defaultProps = {
26
22
  xmlnsXlink: "http://www.w3.org/1999/xlink"
27
23
  };
28
24
  import { getDisplayName } from '../models';
25
+ var styles = {
26
+ "shared-status": "status__shared-status___2HpyL",
27
+ "shared-status-label": "status__shared-status-label___1-jvS"
28
+ };
29
29
  export var SharedStatus = function SharedStatus(_ref) {
30
30
  var className = _ref.className,
31
31
  docId = _ref.docId,