cozy-sharing 13.1.2 → 13.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 +16 -0
- package/dist/components/Recipient/GroupRecipientDetail.js +20 -1
- package/dist/components/Recipient/GroupRecipientDetailWithoutAccess.js +1 -1
- package/dist/components/ShareRecipientsInput.js +5 -11
- package/dist/components/ShareRecipientsInput.spec.js +1 -1
- package/dist/queries/queries.js +4 -5
- package/locales/en.json +5 -1
- package/locales/fr.json +5 -1
- package/package.json +2 -2
- package/src/components/Recipient/GroupRecipientDetail.jsx +22 -0
- package/src/components/Recipient/GroupRecipientDetailWithoutAccess.jsx +1 -1
- package/src/components/ShareRecipientsInput.jsx +8 -16
- package/src/components/ShareRecipientsInput.spec.jsx +1 -1
- package/src/queries/queries.js +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
# [13.2.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@13.1.2...cozy-sharing@13.2.0) (2024-04-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Only show add email suggestion when we can't send an email ([9212597](https://github.com/cozy/cozy-libs/commit/92125976900b939e985330682f9375ce22f2ab42))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* Allow to add empty group ([a16f535](https://github.com/cozy/cozy-libs/commit/a16f535008a4dbe9426ee026acdbd413280585dd))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [13.1.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@13.1.1...cozy-sharing@13.1.2) (2024-04-17)
|
|
7
23
|
|
|
8
24
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useClient, generateWebLink } from 'cozy-client';
|
|
3
|
+
import Buttons from 'cozy-ui/transpiled/react/Buttons';
|
|
2
4
|
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
5
|
+
import Empty from 'cozy-ui/transpiled/react/Empty';
|
|
3
6
|
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
4
7
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
5
8
|
import { GroupRecipientDetailWithAccess } from './GroupRecipientDetailWithAccess';
|
|
@@ -11,6 +14,7 @@ var GroupRecipientDetail = function GroupRecipientDetail(_ref) {
|
|
|
11
14
|
members = _ref.members,
|
|
12
15
|
onClose = _ref.onClose,
|
|
13
16
|
isOwner = _ref.isOwner;
|
|
17
|
+
var client = useClient();
|
|
14
18
|
|
|
15
19
|
var _useI18n = useI18n(),
|
|
16
20
|
t = _useI18n.t;
|
|
@@ -22,6 +26,12 @@ var GroupRecipientDetail = function GroupRecipientDetail(_ref) {
|
|
|
22
26
|
return ['revoked', 'mail-not-sent'].includes(member.status);
|
|
23
27
|
});
|
|
24
28
|
var ownerName = owner.public_name;
|
|
29
|
+
var contactsLink = generateWebLink({
|
|
30
|
+
cozyUrl: client.getStackClient().uri,
|
|
31
|
+
slug: 'contacts',
|
|
32
|
+
pathname: '/',
|
|
33
|
+
subDomainType: client.getInstanceOptions().subdomain
|
|
34
|
+
});
|
|
25
35
|
return /*#__PURE__*/React.createElement(Dialog, {
|
|
26
36
|
open: true,
|
|
27
37
|
size: "small",
|
|
@@ -33,7 +43,16 @@ var GroupRecipientDetail = function GroupRecipientDetail(_ref) {
|
|
|
33
43
|
})) : null),
|
|
34
44
|
content: /*#__PURE__*/React.createElement("div", {
|
|
35
45
|
className: "u-flex u-stack-xs u-flex-column"
|
|
36
|
-
},
|
|
46
|
+
}, members.length === 0 ? /*#__PURE__*/React.createElement(Empty, {
|
|
47
|
+
text: t('GroupRecipientDetail.empty.content')
|
|
48
|
+
}, /*#__PURE__*/React.createElement(Buttons, {
|
|
49
|
+
component: "a",
|
|
50
|
+
className: "u-mt-1",
|
|
51
|
+
href: contactsLink,
|
|
52
|
+
target: "_blank",
|
|
53
|
+
rel: "noopener noreferrer",
|
|
54
|
+
label: t('GroupRecipientDetail.empty.action')
|
|
55
|
+
})) : null, withAccess.length > 0 ? /*#__PURE__*/React.createElement(GroupRecipientDetailWithAccess, {
|
|
37
56
|
withAccess: withAccess
|
|
38
57
|
}) : null, withoutAccess.length > 0 ? /*#__PURE__*/React.createElement(GroupRecipientDetailWithoutAccess, {
|
|
39
58
|
withoutAccess: withoutAccess,
|
|
@@ -41,7 +41,7 @@ var GroupRecipientDetailWithoutAccess = function GroupRecipientDetailWithoutAcce
|
|
|
41
41
|
style: {
|
|
42
42
|
marginRight: '0.25rem'
|
|
43
43
|
}
|
|
44
|
-
}) : null, t("GroupRecipientDetail.withoutAccess.status.".concat(recipient.status)), isOwner ? " - ".concat(t('GroupRecipientDetail.withoutAccess.addEmail')) : null)
|
|
44
|
+
}) : null, t("GroupRecipientDetail.withoutAccess.status.".concat(recipient.status)), isOwner && recipient.status === 'mail-not-sent' ? " - ".concat(t('GroupRecipientDetail.withoutAccess.addEmail')) : null)
|
|
45
45
|
}));
|
|
46
46
|
})));
|
|
47
47
|
};
|
|
@@ -11,7 +11,7 @@ import { useQueryAll, isQueryLoading } from 'cozy-client';
|
|
|
11
11
|
import flag from 'cozy-flags';
|
|
12
12
|
import ShareAutosuggest from './ShareAutosuggest';
|
|
13
13
|
import { getContactsFromGroupId } from '../helpers/contacts';
|
|
14
|
-
import { buildReachableContactsQuery,
|
|
14
|
+
import { buildReachableContactsQuery, buildContactGroupsQuery, buildUnreachableContactsWithGroupsQuery } from '../queries/queries';
|
|
15
15
|
/**
|
|
16
16
|
* ShareRecipientsInput is responsible for fetching contacts and groups.
|
|
17
17
|
* We retrieve all the contacts that are reachable and the groups they belong to.
|
|
@@ -30,20 +30,14 @@ var ShareRecipientsInput = function ShareRecipientsInput(_ref) {
|
|
|
30
30
|
var unreachableContactsWithGroupsResult = useQueryAll(unreachableContactsWithGroupsQuery.definition, _objectSpread(_objectSpread({}, unreachableContactsWithGroupsQuery.options), {}, {
|
|
31
31
|
enabled: !!flag('sharing.show-recipient-groups')
|
|
32
32
|
}));
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return (((_contact$relationship = contact.relationships) === null || _contact$relationship === void 0 || (_contact$relationship = _contact$relationship.groups) === null || _contact$relationship === void 0 ? void 0 : _contact$relationship.data) || []).map(function (group) {
|
|
37
|
-
return group._id;
|
|
38
|
-
});
|
|
39
|
-
}))));
|
|
40
|
-
var contactGroupsByIdsResult = useQueryAll(contactGroupsByIdsQuery.definition, contactGroupsByIdsQuery.options);
|
|
41
|
-
var isLoading = isQueryLoading(reachableContactsResult) || reachableContactsResult.hasMore || isQueryLoading(contactGroupsByIdsResult) || contactGroupsByIdsResult.hasMore || flag('sharing.show-recipient-groups') && (isQueryLoading(unreachableContactsWithGroupsResult) || unreachableContactsWithGroupsResult.hasMore);
|
|
33
|
+
var contactGroupsQuery = buildContactGroupsQuery();
|
|
34
|
+
var contactGroupsResult = useQueryAll(contactGroupsQuery.definition, contactGroupsQuery.options);
|
|
35
|
+
var isLoading = isQueryLoading(reachableContactsResult) || reachableContactsResult.hasMore || isQueryLoading(contactGroupsResult) || contactGroupsResult.hasMore || flag('sharing.show-recipient-groups') && (isQueryLoading(unreachableContactsWithGroupsResult) || unreachableContactsWithGroupsResult.hasMore);
|
|
42
36
|
var currentRecipientGroups = currentRecipients.map(function (_ref2) {
|
|
43
37
|
var id = _ref2.id;
|
|
44
38
|
return id;
|
|
45
39
|
}).filter(Boolean);
|
|
46
|
-
var contactGroups = (
|
|
40
|
+
var contactGroups = (contactGroupsResult.data || []).filter(function (_ref3) {
|
|
47
41
|
var _id = _ref3._id;
|
|
48
42
|
return !flag('sharing.show-recipient-groups') || !currentRecipientGroups.includes(_id);
|
|
49
43
|
}).map(function (contactGroup) {
|
|
@@ -44,7 +44,7 @@ describe('ShareRecipientsInput component', function () {
|
|
|
44
44
|
doctype: 'io.cozy.contacts',
|
|
45
45
|
data: contacts
|
|
46
46
|
},
|
|
47
|
-
'io.cozy.contacts.groups
|
|
47
|
+
'io.cozy.contacts.groups': {
|
|
48
48
|
doctype: 'io.cozy.contacts.groups',
|
|
49
49
|
data: contactGroups
|
|
50
50
|
},
|
package/dist/queries/queries.js
CHANGED
|
@@ -53,13 +53,12 @@ export var buildReachableContactsQuery = function buildReachableContactsQuery()
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
|
-
export var
|
|
56
|
+
export var buildContactGroupsQuery = function buildContactGroupsQuery() {
|
|
57
57
|
return {
|
|
58
|
-
definition: Q(Group.doctype)
|
|
58
|
+
definition: Q(Group.doctype),
|
|
59
59
|
options: {
|
|
60
|
-
as: "io.cozy.contacts.groups
|
|
61
|
-
fetchPolicy: defaultFetchPolicy
|
|
62
|
-
enabled: ids.length > 0
|
|
60
|
+
as: "io.cozy.contacts.groups",
|
|
61
|
+
fetchPolicy: defaultFetchPolicy
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
64
|
};
|
package/locales/en.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"create-cozy": "Create my cozy",
|
|
32
32
|
"members": {
|
|
33
|
-
"count": "
|
|
33
|
+
"count": "%{smart_count} member |||| %{smart_count} members",
|
|
34
34
|
"others": "and 1 other… |||| and %{smart_count} others…",
|
|
35
35
|
"otherContacts": "other contact |||| other contacts"
|
|
36
36
|
},
|
|
@@ -400,6 +400,10 @@
|
|
|
400
400
|
},
|
|
401
401
|
"GroupRecipientDetail": {
|
|
402
402
|
"subtitle": "Managed by %{ownerName}",
|
|
403
|
+
"empty": {
|
|
404
|
+
"content": "Your contact group is empty! Quickly add members to start sharing your valuable documents with them!",
|
|
405
|
+
"action": "Open Contacts"
|
|
406
|
+
},
|
|
403
407
|
"withAccess": {
|
|
404
408
|
"title": "Access to item"
|
|
405
409
|
},
|
package/locales/fr.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"create-cozy": "Créer mon Cozy",
|
|
32
32
|
"members": {
|
|
33
|
-
"count": "
|
|
33
|
+
"count": "%{smart_count} membre |||| %{smart_count} membres",
|
|
34
34
|
"others": "et 1 autre… |||| et %{smart_count} autres…",
|
|
35
35
|
"otherContacts": "autre contact |||| autres contacts"
|
|
36
36
|
},
|
|
@@ -398,6 +398,10 @@
|
|
|
398
398
|
},
|
|
399
399
|
"GroupRecipientDetail": {
|
|
400
400
|
"subtitle": "Géré par %{ownerName}",
|
|
401
|
+
"empty": {
|
|
402
|
+
"content": "Votre groupe de contacts est vide ! Ajoutez rapidement des membres pour commencer à leur partager vos précieux documents !",
|
|
403
|
+
"action": "Ouvrir Contacts"
|
|
404
|
+
},
|
|
401
405
|
"withAccess": {
|
|
402
406
|
"title": "Accès à l’élément"
|
|
403
407
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.2.0",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"sideEffects": [
|
|
72
72
|
"*.css"
|
|
73
73
|
],
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "bbc3235a02eab7e59b21a739816258618fffdf86"
|
|
75
75
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
+
import { useClient, generateWebLink } from 'cozy-client'
|
|
4
|
+
import Buttons from 'cozy-ui/transpiled/react/Buttons'
|
|
3
5
|
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs'
|
|
6
|
+
import Empty from 'cozy-ui/transpiled/react/Empty'
|
|
4
7
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
5
8
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
6
9
|
|
|
@@ -8,6 +11,7 @@ import { GroupRecipientDetailWithAccess } from './GroupRecipientDetailWithAccess
|
|
|
8
11
|
import { GroupRecipientDetailWithoutAccess } from './GroupRecipientDetailWithoutAccess'
|
|
9
12
|
|
|
10
13
|
const GroupRecipientDetail = ({ name, owner, members, onClose, isOwner }) => {
|
|
14
|
+
const client = useClient()
|
|
11
15
|
const { t } = useI18n()
|
|
12
16
|
const withAccess = members.filter(
|
|
13
17
|
member => !['revoked', 'mail-not-sent'].includes(member.status)
|
|
@@ -17,6 +21,12 @@ const GroupRecipientDetail = ({ name, owner, members, onClose, isOwner }) => {
|
|
|
17
21
|
)
|
|
18
22
|
|
|
19
23
|
const ownerName = owner.public_name
|
|
24
|
+
const contactsLink = generateWebLink({
|
|
25
|
+
cozyUrl: client.getStackClient().uri,
|
|
26
|
+
slug: 'contacts',
|
|
27
|
+
pathname: '/',
|
|
28
|
+
subDomainType: client.getInstanceOptions().subdomain
|
|
29
|
+
})
|
|
20
30
|
|
|
21
31
|
return (
|
|
22
32
|
<Dialog
|
|
@@ -35,6 +45,18 @@ const GroupRecipientDetail = ({ name, owner, members, onClose, isOwner }) => {
|
|
|
35
45
|
}
|
|
36
46
|
content={
|
|
37
47
|
<div className="u-flex u-stack-xs u-flex-column">
|
|
48
|
+
{members.length === 0 ? (
|
|
49
|
+
<Empty text={t('GroupRecipientDetail.empty.content')}>
|
|
50
|
+
<Buttons
|
|
51
|
+
component="a"
|
|
52
|
+
className="u-mt-1"
|
|
53
|
+
href={contactsLink}
|
|
54
|
+
target="_blank"
|
|
55
|
+
rel="noopener noreferrer"
|
|
56
|
+
label={t('GroupRecipientDetail.empty.action')}
|
|
57
|
+
/>
|
|
58
|
+
</Empty>
|
|
59
|
+
) : null}
|
|
38
60
|
{withAccess.length > 0 ? (
|
|
39
61
|
<GroupRecipientDetailWithAccess withAccess={withAccess} />
|
|
40
62
|
) : null}
|
|
@@ -48,7 +48,7 @@ const GroupRecipientDetailWithoutAccess = ({ withoutAccess, isOwner }) => {
|
|
|
48
48
|
{t(
|
|
49
49
|
`GroupRecipientDetail.withoutAccess.status.${recipient.status}`
|
|
50
50
|
)}
|
|
51
|
-
{isOwner
|
|
51
|
+
{isOwner && recipient.status === 'mail-not-sent'
|
|
52
52
|
? ` - ${t('GroupRecipientDetail.withoutAccess.addEmail')}`
|
|
53
53
|
: null}
|
|
54
54
|
</div>
|
|
@@ -8,7 +8,7 @@ import ShareAutosuggest from './ShareAutosuggest'
|
|
|
8
8
|
import { getContactsFromGroupId } from '../helpers/contacts'
|
|
9
9
|
import {
|
|
10
10
|
buildReachableContactsQuery,
|
|
11
|
-
|
|
11
|
+
buildContactGroupsQuery,
|
|
12
12
|
buildUnreachableContactsWithGroupsQuery
|
|
13
13
|
} from '../queries/queries'
|
|
14
14
|
|
|
@@ -40,25 +40,17 @@ const ShareRecipientsInput = ({
|
|
|
40
40
|
}
|
|
41
41
|
)
|
|
42
42
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
group => group._id
|
|
48
|
-
)
|
|
49
|
-
})
|
|
50
|
-
)
|
|
51
|
-
])
|
|
52
|
-
const contactGroupsByIdsResult = useQueryAll(
|
|
53
|
-
contactGroupsByIdsQuery.definition,
|
|
54
|
-
contactGroupsByIdsQuery.options
|
|
43
|
+
const contactGroupsQuery = buildContactGroupsQuery()
|
|
44
|
+
const contactGroupsResult = useQueryAll(
|
|
45
|
+
contactGroupsQuery.definition,
|
|
46
|
+
contactGroupsQuery.options
|
|
55
47
|
)
|
|
56
48
|
|
|
57
49
|
const isLoading =
|
|
58
50
|
isQueryLoading(reachableContactsResult) ||
|
|
59
51
|
reachableContactsResult.hasMore ||
|
|
60
|
-
isQueryLoading(
|
|
61
|
-
|
|
52
|
+
isQueryLoading(contactGroupsResult) ||
|
|
53
|
+
contactGroupsResult.hasMore ||
|
|
62
54
|
(flag('sharing.show-recipient-groups') &&
|
|
63
55
|
(isQueryLoading(unreachableContactsWithGroupsResult) ||
|
|
64
56
|
unreachableContactsWithGroupsResult.hasMore))
|
|
@@ -66,7 +58,7 @@ const ShareRecipientsInput = ({
|
|
|
66
58
|
const currentRecipientGroups = currentRecipients
|
|
67
59
|
.map(({ id }) => id)
|
|
68
60
|
.filter(Boolean)
|
|
69
|
-
const contactGroups = (
|
|
61
|
+
const contactGroups = (contactGroupsResult.data || [])
|
|
70
62
|
.filter(
|
|
71
63
|
({ _id }) =>
|
|
72
64
|
!flag('sharing.show-recipient-groups') ||
|
package/src/queries/queries.js
CHANGED
|
@@ -59,12 +59,11 @@ export const buildReachableContactsQuery = () => ({
|
|
|
59
59
|
}
|
|
60
60
|
})
|
|
61
61
|
|
|
62
|
-
export const
|
|
63
|
-
definition: Q(Group.doctype)
|
|
62
|
+
export const buildContactGroupsQuery = () => ({
|
|
63
|
+
definition: Q(Group.doctype),
|
|
64
64
|
options: {
|
|
65
|
-
as: `io.cozy.contacts.groups
|
|
66
|
-
fetchPolicy: defaultFetchPolicy
|
|
67
|
-
enabled: ids.length > 0
|
|
65
|
+
as: `io.cozy.contacts.groups`,
|
|
66
|
+
fetchPolicy: defaultFetchPolicy
|
|
68
67
|
}
|
|
69
68
|
})
|
|
70
69
|
|