cozy-sharing 33.2.2 → 33.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.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +1 -0
- package/dist/state.js +10 -0
- package/dist/state.spec.js +48 -1
- package/package.json +2 -2
- package/src/index.jsx +1 -0
- package/src/state.js +12 -0
- package/src/state.spec.js +58 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
# [33.3.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.2.2...cozy-sharing@33.3.0) (2026-06-10)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **cozy-sharing:** Expose recipients from sharing ([4751522](https://github.com/cozy/cozy-libs/commit/47515222a60ec54b0537b6ca6b5cfab3e6613638))
|
|
11
|
+
|
|
6
12
|
## [33.2.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.2.1...cozy-sharing@33.2.2) (2026-06-10)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export { useSharingInfos } from './components/SharingBanner/hooks/useSharingInfo
|
|
|
27
27
|
export { ConfirmTrustedRecipientsDialog } from './ConfirmTrustedRecipientsDialog';
|
|
28
28
|
export { ShareButtonWithRecipients } from './ShareButtonWithRecipients';
|
|
29
29
|
export { DOCUMENT_TYPE } from './helpers/documentType';
|
|
30
|
+
export { getRecipientsFromSharing } from './state';
|
|
30
31
|
export { default as OpenSharingLinkButton } from './OpenSharingLinkButton';
|
|
31
32
|
export { default as OpenSharingLinkFabButton } from './OpenSharingLinkFabButton';
|
|
32
33
|
export { NativeFileSharingProvider, useNativeFileSharing } from './providers/NativeFileSharingProvider';
|
package/dist/state.js
CHANGED
|
@@ -426,7 +426,17 @@ export var getOwner = function getOwner(state, docId) {
|
|
|
426
426
|
};
|
|
427
427
|
export var getRecipients = function getRecipients(state, docId) {
|
|
428
428
|
var sharings = getDocumentSharings(state, docId);
|
|
429
|
+
return getRecipientsFromSharings(sharings, docId);
|
|
430
|
+
};
|
|
431
|
+
export var getRecipientsFromSharing = function getRecipientsFromSharing(sharing, docId) {
|
|
432
|
+
if (!sharing) {
|
|
433
|
+
return [];
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
return getRecipientsFromSharings([sharing], docId);
|
|
437
|
+
};
|
|
429
438
|
|
|
439
|
+
var getRecipientsFromSharings = function getRecipientsFromSharings(sharings, docId) {
|
|
430
440
|
if (flag('sharing.show-recipient-groups')) {
|
|
431
441
|
return getRecipientsWithGroups(sharings, docId);
|
|
432
442
|
}
|
package/dist/state.spec.js
CHANGED
|
@@ -4,7 +4,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
7
|
-
import reducer, { receiveSharings, addSharing, addSharingLink, updateSharingLink, revokeSharingLink, getRecipients, revokeRecipient, revokeSelf, updateSharing, matchingInstanceName, getSharingLink, hasSharedParent, hasSharedChild, getSharedDocIdsBySharings, getSharingType, getPermissionDocIds, getDocumentSharingType, getSharedParentPath, getExternalSharingIds, getRecipientsWithGroups } from './state';
|
|
7
|
+
import reducer, { receiveSharings, addSharing, addSharingLink, updateSharingLink, revokeSharingLink, getRecipients, getRecipientsFromSharing, revokeRecipient, revokeSelf, updateSharing, matchingInstanceName, getSharingLink, hasSharedParent, hasSharedChild, getSharedDocIdsBySharings, getSharingType, getPermissionDocIds, getDocumentSharingType, getSharedParentPath, getExternalSharingIds, getRecipientsWithGroups } from './state';
|
|
8
8
|
import { SHARING_1, SHARING_2, SHARING_3, SHARING_READ_ONLY, PERM_1, PERM_2, PERM_WITHOUT_DOC, SHARING_NO_ACTIVE, SHARING_WITH_SHORTCUT, APPS } from '../__tests__/fixtures';
|
|
9
9
|
describe('Sharing state', function () {
|
|
10
10
|
it('should have a default state', function () {
|
|
@@ -430,6 +430,53 @@ describe('Sharing state', function () {
|
|
|
430
430
|
avatarPath: '/sharings/sharing_5/recipients/1/avatar'
|
|
431
431
|
}]);
|
|
432
432
|
});
|
|
433
|
+
it('should list recipients from a shared drive sharing', function () {
|
|
434
|
+
var sharing = {
|
|
435
|
+
id: 'shared_drive_id',
|
|
436
|
+
drive: true,
|
|
437
|
+
attributes: {
|
|
438
|
+
members: [{
|
|
439
|
+
email: 'jane@doe.com',
|
|
440
|
+
instance: 'http://cozy.tools:8080',
|
|
441
|
+
name: 'Jane Doe',
|
|
442
|
+
status: 'owner'
|
|
443
|
+
}, {
|
|
444
|
+
email: 'john@doe.com',
|
|
445
|
+
instance: 'http://cozy.local:8080',
|
|
446
|
+
name: 'John Doe',
|
|
447
|
+
status: 'ready'
|
|
448
|
+
}],
|
|
449
|
+
rules: [{
|
|
450
|
+
doctype: 'io.cozy.files',
|
|
451
|
+
values: ['shared_drive_root'],
|
|
452
|
+
add: 'sync',
|
|
453
|
+
update: 'sync',
|
|
454
|
+
remove: 'sync'
|
|
455
|
+
}]
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
expect(getRecipientsFromSharing(sharing, 'child_file_id')).toEqual([{
|
|
459
|
+
email: 'jane@doe.com',
|
|
460
|
+
instance: 'http://cozy.tools:8080',
|
|
461
|
+
name: 'Jane Doe',
|
|
462
|
+
sharingId: 'shared_drive_id',
|
|
463
|
+
index: 'sharing-shared_drive_id-member-0',
|
|
464
|
+
memberIndex: 0,
|
|
465
|
+
status: 'owner',
|
|
466
|
+
type: 'two-way',
|
|
467
|
+
avatarPath: '/sharings/shared_drive_id/recipients/0/avatar'
|
|
468
|
+
}, {
|
|
469
|
+
email: 'john@doe.com',
|
|
470
|
+
instance: 'http://cozy.local:8080',
|
|
471
|
+
name: 'John Doe',
|
|
472
|
+
sharingId: 'shared_drive_id',
|
|
473
|
+
index: 'sharing-shared_drive_id-member-1',
|
|
474
|
+
memberIndex: 1,
|
|
475
|
+
status: 'ready',
|
|
476
|
+
type: 'two-way',
|
|
477
|
+
avatarPath: '/sharings/shared_drive_id/recipients/1/avatar'
|
|
478
|
+
}]);
|
|
479
|
+
});
|
|
433
480
|
});
|
|
434
481
|
});
|
|
435
482
|
describe('finding matching instance names', function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "33.
|
|
3
|
+
"version": "33.3.0",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"sideEffects": [
|
|
84
84
|
"*.css"
|
|
85
85
|
],
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "4fe0199d7042ff150315bd4a097256b2364f200c"
|
|
87
87
|
}
|
package/src/index.jsx
CHANGED
|
@@ -31,6 +31,7 @@ export { useSharingInfos } from './components/SharingBanner/hooks/useSharingInfo
|
|
|
31
31
|
export { ConfirmTrustedRecipientsDialog } from './ConfirmTrustedRecipientsDialog'
|
|
32
32
|
export { ShareButtonWithRecipients } from './ShareButtonWithRecipients'
|
|
33
33
|
export { DOCUMENT_TYPE } from './helpers/documentType'
|
|
34
|
+
export { getRecipientsFromSharing } from './state'
|
|
34
35
|
export { default as OpenSharingLinkButton } from './OpenSharingLinkButton'
|
|
35
36
|
export { default as OpenSharingLinkFabButton } from './OpenSharingLinkFabButton'
|
|
36
37
|
export {
|
package/src/state.js
CHANGED
|
@@ -338,6 +338,18 @@ export const getOwner = (state, docId) =>
|
|
|
338
338
|
|
|
339
339
|
export const getRecipients = (state, docId) => {
|
|
340
340
|
const sharings = getDocumentSharings(state, docId)
|
|
341
|
+
return getRecipientsFromSharings(sharings, docId)
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export const getRecipientsFromSharing = (sharing, docId) => {
|
|
345
|
+
if (!sharing) {
|
|
346
|
+
return []
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return getRecipientsFromSharings([sharing], docId)
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
const getRecipientsFromSharings = (sharings, docId) => {
|
|
341
353
|
if (flag('sharing.show-recipient-groups')) {
|
|
342
354
|
return getRecipientsWithGroups(sharings, docId)
|
|
343
355
|
}
|
package/src/state.spec.js
CHANGED
|
@@ -5,6 +5,7 @@ import reducer, {
|
|
|
5
5
|
updateSharingLink,
|
|
6
6
|
revokeSharingLink,
|
|
7
7
|
getRecipients,
|
|
8
|
+
getRecipientsFromSharing,
|
|
8
9
|
revokeRecipient,
|
|
9
10
|
revokeSelf,
|
|
10
11
|
updateSharing,
|
|
@@ -540,6 +541,63 @@ describe('Sharing state', () => {
|
|
|
540
541
|
}
|
|
541
542
|
])
|
|
542
543
|
})
|
|
544
|
+
|
|
545
|
+
it('should list recipients from a shared drive sharing', () => {
|
|
546
|
+
const sharing = {
|
|
547
|
+
id: 'shared_drive_id',
|
|
548
|
+
drive: true,
|
|
549
|
+
attributes: {
|
|
550
|
+
members: [
|
|
551
|
+
{
|
|
552
|
+
email: 'jane@doe.com',
|
|
553
|
+
instance: 'http://cozy.tools:8080',
|
|
554
|
+
name: 'Jane Doe',
|
|
555
|
+
status: 'owner'
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
email: 'john@doe.com',
|
|
559
|
+
instance: 'http://cozy.local:8080',
|
|
560
|
+
name: 'John Doe',
|
|
561
|
+
status: 'ready'
|
|
562
|
+
}
|
|
563
|
+
],
|
|
564
|
+
rules: [
|
|
565
|
+
{
|
|
566
|
+
doctype: 'io.cozy.files',
|
|
567
|
+
values: ['shared_drive_root'],
|
|
568
|
+
add: 'sync',
|
|
569
|
+
update: 'sync',
|
|
570
|
+
remove: 'sync'
|
|
571
|
+
}
|
|
572
|
+
]
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
expect(getRecipientsFromSharing(sharing, 'child_file_id')).toEqual([
|
|
577
|
+
{
|
|
578
|
+
email: 'jane@doe.com',
|
|
579
|
+
instance: 'http://cozy.tools:8080',
|
|
580
|
+
name: 'Jane Doe',
|
|
581
|
+
sharingId: 'shared_drive_id',
|
|
582
|
+
index: 'sharing-shared_drive_id-member-0',
|
|
583
|
+
memberIndex: 0,
|
|
584
|
+
status: 'owner',
|
|
585
|
+
type: 'two-way',
|
|
586
|
+
avatarPath: '/sharings/shared_drive_id/recipients/0/avatar'
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
email: 'john@doe.com',
|
|
590
|
+
instance: 'http://cozy.local:8080',
|
|
591
|
+
name: 'John Doe',
|
|
592
|
+
sharingId: 'shared_drive_id',
|
|
593
|
+
index: 'sharing-shared_drive_id-member-1',
|
|
594
|
+
memberIndex: 1,
|
|
595
|
+
status: 'ready',
|
|
596
|
+
type: 'two-way',
|
|
597
|
+
avatarPath: '/sharings/shared_drive_id/recipients/1/avatar'
|
|
598
|
+
}
|
|
599
|
+
])
|
|
600
|
+
})
|
|
543
601
|
})
|
|
544
602
|
})
|
|
545
603
|
|