cozy-sharing 6.0.2 → 6.0.4
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 +19 -0
- package/dist/SharingBanner/hooks/useSharingInfos.js +35 -37
- package/dist/SharingBanner/hooks/useSharingInfos.spec.js +40 -44
- package/dist/SharingProvider.js +351 -375
- package/dist/SharingProvider.spec.js +29 -33
- package/dist/components/CozyPassFingerprintDialogContent.spec.js +14 -16
- package/dist/components/Recipient/LinkRecipientPermissions.js +25 -27
- package/dist/components/Recipient/Recipient.spec.js +39 -43
- package/dist/components/Recipient/RecipientPermissions.js +20 -22
- package/dist/components/ShareButton.js +0 -2
- package/dist/components/ShareByEmail.js +53 -55
- package/dist/components/ShareByEmail.spec.js +50 -52
- package/dist/components/ShareByLink.js +73 -79
- package/dist/components/ShareDialogCozyToCozy.spec.js +238 -264
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +33 -35
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.spec.js +240 -266
- package/dist/components/SharedBadge.js +0 -2
- package/dist/components/badge.styl +7 -5
- package/dist/components/button.styl +11 -12
- package/dist/components/useFetchDocumentPath.js +16 -18
- package/dist/fetchNextPermissions.js +15 -17
- package/dist/getSharedDocument.js +13 -15
- package/dist/getSharedDocument.spec.js +10 -12
- package/dist/helpers/contacts.js +65 -69
- package/dist/helpers/contacts.spec.js +30 -32
- package/dist/helpers/files.js +26 -28
- package/dist/helpers/files.spec.js +54 -58
- package/dist/helpers/sharings.js +56 -60
- package/dist/helpers/synchronousJobQueue.js +19 -21
- package/dist/helpers/synchronousJobQueue.spec.js +39 -43
- package/dist/stylesheet.css +28 -820
- package/package.json +3 -3
- package/src/components/badge.styl +7 -5
- package/src/components/button.styl +11 -12
package/dist/helpers/sharings.js
CHANGED
|
@@ -15,80 +15,76 @@ export var createSharingInStore = /*#__PURE__*/function () {
|
|
|
15
15
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref) {
|
|
16
16
|
var client, doctype, dispatch, docsId, sharing;
|
|
17
17
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
18
|
-
while (1) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
18
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
client = _ref.client, doctype = _ref.doctype, dispatch = _ref.dispatch, docsId = _ref.docsId, sharing = _ref.sharing;
|
|
21
|
+
_context2.next = 3;
|
|
22
|
+
return Promise.all(docsId.map( /*#__PURE__*/function () {
|
|
23
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id) {
|
|
24
|
+
var file, path;
|
|
25
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
26
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
if (!(doctype === 'io.cozy.files')) {
|
|
29
|
+
_context.next = 6;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
_context.next = 3;
|
|
34
|
+
return client.query(Q(doctype).getById(id));
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
case 3:
|
|
37
|
+
_context.t0 = _context.sent;
|
|
38
|
+
_context.next = 7;
|
|
39
|
+
break;
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
case 6:
|
|
42
|
+
_context.t0 = undefined;
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
case 7:
|
|
45
|
+
file = _context.t0;
|
|
46
|
+
_context.t1 = file;
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
if (!_context.t1) {
|
|
49
|
+
_context.next = 16;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
_context.t2 = file.data.path;
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
if (_context.t2) {
|
|
56
|
+
_context.next = 15;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
_context.next = 14;
|
|
61
|
+
return fetchFilesPaths(client, doctype, [file.data]);
|
|
64
62
|
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
case 14:
|
|
64
|
+
_context.t2 = _context.sent;
|
|
67
65
|
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
case 15:
|
|
67
|
+
_context.t1 = _context.t2;
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
case 16:
|
|
70
|
+
path = _context.t1;
|
|
71
|
+
dispatch(addSharing(sharing, path));
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}));
|
|
73
|
+
case 18:
|
|
74
|
+
case "end":
|
|
75
|
+
return _context.stop();
|
|
76
|
+
}
|
|
77
|
+
}, _callee);
|
|
78
|
+
}));
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
return function (_x2) {
|
|
81
|
+
return _ref3.apply(this, arguments);
|
|
82
|
+
};
|
|
83
|
+
}()));
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
85
|
+
case 3:
|
|
86
|
+
case "end":
|
|
87
|
+
return _context2.stop();
|
|
92
88
|
}
|
|
93
89
|
}, _callee2);
|
|
94
90
|
}));
|
|
@@ -25,32 +25,30 @@ export var SynchronousJobQueue = /*#__PURE__*/function () {
|
|
|
25
25
|
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
26
26
|
var job;
|
|
27
27
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
28
|
-
while (1) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.isRunning = true;
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
this.isRunning = true;
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
case 1:
|
|
33
|
+
if (!(this.queue.length > 0)) {
|
|
34
|
+
_context.next = 7;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
job = this.queue.shift();
|
|
39
|
+
_context.next = 5;
|
|
40
|
+
return job.function(job.arguments);
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
case 5:
|
|
43
|
+
_context.next = 1;
|
|
44
|
+
break;
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
case 7:
|
|
47
|
+
this.isRunning = false;
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
49
|
+
case 8:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
54
52
|
}
|
|
55
53
|
}, _callee, this);
|
|
56
54
|
}));
|
|
@@ -36,61 +36,57 @@ describe('SynchronousJobQueue', function () {
|
|
|
36
36
|
it('should execute job synchronously with SynchronousJobQueue', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
37
37
|
var synchronousJobQueue, expectedCallbackOrder;
|
|
38
38
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
39
|
-
while (1) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return flushPromises();
|
|
39
|
+
while (1) switch (_context.prev = _context.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
synchronousJobQueue = new SynchronousJobQueue();
|
|
42
|
+
synchronousJobQueue.push({
|
|
43
|
+
function: resolveAfter500Ms
|
|
44
|
+
});
|
|
45
|
+
synchronousJobQueue.push({
|
|
46
|
+
function: resolveAfter100Ms
|
|
47
|
+
});
|
|
48
|
+
jest.runAllTimers();
|
|
49
|
+
_context.next = 6;
|
|
50
|
+
return flushPromises();
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
case 6:
|
|
53
|
+
jest.runAllTimers();
|
|
54
|
+
_context.next = 9;
|
|
55
|
+
return flushPromises();
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
case 9:
|
|
58
|
+
expectedCallbackOrder = [['500Ms start'], ['500Ms end'], ['100Ms start'], ['100Ms end']];
|
|
59
|
+
expect(callback.mock.calls).toEqual(expectedCallbackOrder);
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
61
|
+
case 11:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context.stop();
|
|
66
64
|
}
|
|
67
65
|
}, _callee);
|
|
68
66
|
})));
|
|
69
67
|
it('should execute job asynchronously without SynchronousJobQueue', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
70
68
|
var expectedCallbackOrder;
|
|
71
69
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
72
|
-
while (1) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return flushPromises();
|
|
70
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
71
|
+
case 0:
|
|
72
|
+
resolveAfter500Ms();
|
|
73
|
+
resolveAfter100Ms();
|
|
74
|
+
jest.runAllTimers();
|
|
75
|
+
_context2.next = 5;
|
|
76
|
+
return flushPromises();
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
case 5:
|
|
79
|
+
jest.runAllTimers();
|
|
80
|
+
_context2.next = 8;
|
|
81
|
+
return flushPromises();
|
|
85
82
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
case 8:
|
|
84
|
+
expectedCallbackOrder = [['500Ms start'], ['100Ms start'], ['100Ms end'], ['500Ms end']];
|
|
85
|
+
expect(callback.mock.calls).toEqual(expectedCallbackOrder);
|
|
89
86
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
87
|
+
case 10:
|
|
88
|
+
case "end":
|
|
89
|
+
return _context2.stop();
|
|
94
90
|
}
|
|
95
91
|
}, _callee2);
|
|
96
92
|
})));
|