cozy-sharing 33.1.2 → 33.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 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.2.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.1.2...cozy-sharing@33.2.0) (2026-06-09)
7
+
8
+ ### Features
9
+
10
+ - **cozy-sharing:** Show progress icon on done button during share ([885a715](https://github.com/cozy/cozy-libs/commit/885a71568a96354e3d962296a205efb05881a5d1))
11
+
6
12
  ## [33.1.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@33.1.1...cozy-sharing@33.1.2) (2026-06-08)
7
13
 
8
14
  ### Bug Fixes
@@ -307,7 +307,7 @@ var FederatedFolderModalContent = function FederatedFolderModalContent(_ref) {
307
307
  }), canShareByEmail && /*#__PURE__*/React.createElement(Button, {
308
308
  variant: "primary",
309
309
  label: t('FederatedFolder.share'),
310
- disabled: isSending,
310
+ busy: isSending,
311
311
  onClick: onSend
312
312
  }))
313
313
  });
@@ -7,7 +7,7 @@ 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 { fireEvent, render, waitFor } from '@testing-library/react';
10
+ import { act, fireEvent, render, waitFor } from '@testing-library/react';
11
11
  import React from 'react';
12
12
  import { createMockClient } from 'cozy-client';
13
13
  import { FederatedFolderModal } from './FederatedFolderModal';
@@ -384,36 +384,88 @@ describe('FederatedFolderModal', function () {
384
384
  }
385
385
  }, _callee9);
386
386
  })));
387
+ it('should show progress icon on Done button while share is in progress', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
388
+ var resolveShare, _setup10, findByText, getByRole, queryByRole, sendButton;
389
+
390
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
391
+ while (1) switch (_context11.prev = _context11.next) {
392
+ case 0:
393
+ usePendingRecipients.mockReturnValue({
394
+ pendingRecipients: [pendingRecipient],
395
+ setPendingRecipients: jest.fn(),
396
+ selectedOption: 'readWrite',
397
+ setSelectedOption: jest.fn()
398
+ });
399
+ getOrCreateFromArray.mockResolvedValue([pendingRecipient]);
400
+ mockShare.mockReturnValueOnce(new Promise(function (resolve) {
401
+ resolveShare = resolve;
402
+ }));
403
+ _setup10 = setup(), findByText = _setup10.findByText, getByRole = _setup10.getByRole, queryByRole = _setup10.queryByRole;
404
+ _context11.next = 6;
405
+ return findByText('Done');
406
+
407
+ case 6:
408
+ sendButton = _context11.sent;
409
+ fireEvent.click(sendButton);
410
+ _context11.next = 10;
411
+ return waitFor(function () {
412
+ expect(getByRole('button', {
413
+ name: 'Done'
414
+ })).toBeDisabled();
415
+ expect(queryByRole('progressbar')).not.toBeNull();
416
+ });
417
+
418
+ case 10:
419
+ _context11.next = 12;
420
+ return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
421
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
422
+ while (1) switch (_context10.prev = _context10.next) {
423
+ case 0:
424
+ resolveShare({});
425
+
426
+ case 1:
427
+ case "end":
428
+ return _context10.stop();
429
+ }
430
+ }, _callee10);
431
+ })));
432
+
433
+ case 12:
434
+ case "end":
435
+ return _context11.stop();
436
+ }
437
+ }, _callee11);
438
+ })));
387
439
  });
388
440
  describe('onClose callback', function () {
389
- it('should call onClose when close button is clicked', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
390
- var _setup10, findByRole, closeButton;
441
+ it('should call onClose when close button is clicked', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
442
+ var _setup11, findByRole, closeButton;
391
443
 
392
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
393
- while (1) switch (_context10.prev = _context10.next) {
444
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
445
+ while (1) switch (_context12.prev = _context12.next) {
394
446
  case 0:
395
- _setup10 = setup(), findByRole = _setup10.findByRole;
396
- _context10.next = 3;
447
+ _setup11 = setup(), findByRole = _setup11.findByRole;
448
+ _context12.next = 3;
397
449
  return findByRole('button', {
398
450
  name: /close/i
399
451
  });
400
452
 
401
453
  case 3:
402
- closeButton = _context10.sent;
454
+ closeButton = _context12.sent;
403
455
  fireEvent.click(closeButton);
404
456
  expect(mockOnClose).toHaveBeenCalled();
405
457
 
406
458
  case 6:
407
459
  case "end":
408
- return _context10.stop();
460
+ return _context12.stop();
409
461
  }
410
- }, _callee10);
462
+ }, _callee12);
411
463
  })));
412
- it('should ask confirmation when close button is clicked with pending recipients', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
413
- var _setup11, getByRole, findByRole, getByText, closeButton;
464
+ it('should ask confirmation when close button is clicked with pending recipients', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
465
+ var _setup12, getByRole, findByRole, getByText, closeButton;
414
466
 
415
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
416
- while (1) switch (_context11.prev = _context11.next) {
467
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
468
+ while (1) switch (_context13.prev = _context13.next) {
417
469
  case 0:
418
470
  usePendingRecipients.mockReturnValue({
419
471
  pendingRecipients: [{
@@ -424,14 +476,14 @@ describe('FederatedFolderModal', function () {
424
476
  selectedOption: 'readWrite',
425
477
  setSelectedOption: jest.fn()
426
478
  });
427
- _setup11 = setup(), getByRole = _setup11.getByRole, findByRole = _setup11.findByRole, getByText = _setup11.getByText;
428
- _context11.next = 4;
479
+ _setup12 = setup(), getByRole = _setup12.getByRole, findByRole = _setup12.findByRole, getByText = _setup12.getByText;
480
+ _context13.next = 4;
429
481
  return findByRole('button', {
430
482
  name: /close/i
431
483
  });
432
484
 
433
485
  case 4:
434
- closeButton = _context11.sent;
486
+ closeButton = _context13.sent;
435
487
  fireEvent.click(closeButton);
436
488
  expect(getByText("Discard the changes you haven't saved?")).toBeTruthy();
437
489
  expect(mockOnClose).not.toHaveBeenCalled();
@@ -442,15 +494,15 @@ describe('FederatedFolderModal', function () {
442
494
 
443
495
  case 10:
444
496
  case "end":
445
- return _context11.stop();
497
+ return _context13.stop();
446
498
  }
447
- }, _callee11);
499
+ }, _callee13);
448
500
  })));
449
- it('should close after discard confirmation', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
450
- var _setup12, getByRole, findByRole, getByText, closeButton;
501
+ it('should close after discard confirmation', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
502
+ var _setup13, getByRole, findByRole, getByText, closeButton;
451
503
 
452
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
453
- while (1) switch (_context12.prev = _context12.next) {
504
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
505
+ while (1) switch (_context14.prev = _context14.next) {
454
506
  case 0:
455
507
  usePendingRecipients.mockReturnValue({
456
508
  pendingRecipients: [{
@@ -461,14 +513,14 @@ describe('FederatedFolderModal', function () {
461
513
  selectedOption: 'readWrite',
462
514
  setSelectedOption: jest.fn()
463
515
  });
464
- _setup12 = setup(), getByRole = _setup12.getByRole, findByRole = _setup12.findByRole, getByText = _setup12.getByText;
465
- _context12.next = 4;
516
+ _setup13 = setup(), getByRole = _setup13.getByRole, findByRole = _setup13.findByRole, getByText = _setup13.getByText;
517
+ _context14.next = 4;
466
518
  return findByRole('button', {
467
519
  name: /close/i
468
520
  });
469
521
 
470
522
  case 4:
471
- closeButton = _context12.sent;
523
+ closeButton = _context14.sent;
472
524
  fireEvent.click(closeButton);
473
525
  expect(getByText("Discard the changes you haven't saved?")).toBeTruthy();
474
526
  fireEvent.click(getByRole('button', {
@@ -478,9 +530,9 @@ describe('FederatedFolderModal', function () {
478
530
 
479
531
  case 9:
480
532
  case "end":
481
- return _context12.stop();
533
+ return _context14.stop();
482
534
  }
483
- }, _callee12);
535
+ }, _callee14);
484
536
  })));
485
537
  });
486
538
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "33.1.2",
3
+ "version": "33.2.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": "4f63c28ae3cd8cac22487e6640006de4f5c31cfc"
86
+ "gitHead": "aeaf0cb5bb862ce8908d78862ca79e8e749982f2"
87
87
  }
@@ -269,7 +269,7 @@ const FederatedFolderModalContent = ({
269
269
  <Button
270
270
  variant="primary"
271
271
  label={t('FederatedFolder.share')}
272
- disabled={isSending}
272
+ busy={isSending}
273
273
  onClick={onSend}
274
274
  />
275
275
  )}
@@ -1,4 +1,4 @@
1
- import { fireEvent, render, waitFor } from '@testing-library/react'
1
+ import { act, fireEvent, render, waitFor } from '@testing-library/react'
2
2
  import React from 'react'
3
3
 
4
4
  import { createMockClient } from 'cozy-client'
@@ -257,6 +257,36 @@ describe('FederatedFolderModal', () => {
257
257
  expect(mockOnClose).not.toHaveBeenCalled()
258
258
  })
259
259
  })
260
+
261
+ it('should show progress icon on Done button while share is in progress', async () => {
262
+ usePendingRecipients.mockReturnValue({
263
+ pendingRecipients: [pendingRecipient],
264
+ setPendingRecipients: jest.fn(),
265
+ selectedOption: 'readWrite',
266
+ setSelectedOption: jest.fn()
267
+ })
268
+ getOrCreateFromArray.mockResolvedValue([pendingRecipient])
269
+ let resolveShare
270
+ mockShare.mockReturnValueOnce(
271
+ new Promise(resolve => {
272
+ resolveShare = resolve
273
+ })
274
+ )
275
+ const { findByText, getByRole, queryByRole } = setup()
276
+
277
+ const sendButton = await findByText('Done')
278
+
279
+ fireEvent.click(sendButton)
280
+
281
+ await waitFor(() => {
282
+ expect(getByRole('button', { name: 'Done' })).toBeDisabled()
283
+ expect(queryByRole('progressbar')).not.toBeNull()
284
+ })
285
+
286
+ await act(async () => {
287
+ resolveShare({})
288
+ })
289
+ })
260
290
  })
261
291
 
262
292
  describe('onClose callback', () => {