cozy-sharing 38.2.0 → 39.0.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,24 @@
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
+ # [39.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@38.2.1...cozy-sharing@39.0.0) (2026-10-06)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **cozy-sharing:** Expose duplicate-invite errors at Share.errors ([80a78d9](https://github.com/cozy/cozy-libs/commit/80a78d9142033f458714ec31383a08bfe8475d01))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ - **cozy-sharing:** In an app that reads or overrides the cozy-sharing
15
+ keys Share.errors.errors._, rename them to Share.errors._.
16
+
17
+ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18
+ Claude-Session: https://claude.ai/code/session_01EzbMP6xL3QaMcFeBaPS7aA
19
+
20
+ ## [38.2.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@38.2.0...cozy-sharing@38.2.1) (2026-10-06)
21
+
22
+ **Note:** Version bump only for package cozy-sharing
23
+
6
24
  # [38.2.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@38.1.13...cozy-sharing@38.2.0) (2026-10-06)
7
25
 
8
26
  ### Bug Fixes
@@ -1,4 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { getI18n } from 'twake-i18n';
2
5
  import { getSuccessMessage, countNewRecipients, getErrorMessage } from './share';
3
6
  describe('share', function () {
4
7
  describe('getSuccessMessage', function () {
@@ -381,5 +384,32 @@ describe('share', function () {
381
384
  });
382
385
  expect(result).toEqual(["".concat(documentType, ".share.error.generic")]);
383
386
  });
387
+ describe('with the locale files', function () {
388
+ var localesDir = path.join(__dirname, '../../locales');
389
+ var locales = fs.readdirSync(localesDir).filter(function (file) {
390
+ return file.endsWith('.json');
391
+ }).map(function (file) {
392
+ return file.replace(/\.json$/, '');
393
+ }); // The locale is also passed as the default language, so that a key
394
+ // missing from it is not resolved from the English fallback
395
+
396
+ var getLocaleI18n = function getLocaleI18n(lang) {
397
+ return getI18n(lang, function (locale) {
398
+ return JSON.parse(fs.readFileSync(path.join(localesDir, "".concat(locale, ".json")), 'utf8'));
399
+ }, undefined, lang);
400
+ };
401
+
402
+ it.each(locales)('should define every key read by getErrorMessage in %s', function (lang) {
403
+ var _getLocaleI18n = getLocaleI18n(lang),
404
+ t = _getLocaleI18n.t;
405
+
406
+ for (var _i = 0, _arr = ['Share.errors.groupMemberAlreadyInSharing', 'Share.errors.contactAlreadyInSharing', 'Share.errors.sharingRights.readOnly', 'Share.errors.sharingRights.readWrite']; _i < _arr.length; _i++) {
407
+ var key = _arr[_i];
408
+ expect(t(key, {
409
+ smart_count: 1
410
+ })).not.toEqual(key);
411
+ }
412
+ });
413
+ });
384
414
  });
385
415
  });
package/locales/en.json CHANGED
@@ -78,13 +78,11 @@
78
78
  "confirm": "OK"
79
79
  },
80
80
  "errors": {
81
- "errors": {
82
- "groupMemberAlreadyInSharing": "%{groupName} members have already been invited with %{sharingRights} rights. It is not possible to invite the same contact twice with different rights. |||| Contacts have already been invited with %{sharingRights} rights. It is not possible to invite the same contact twice with different rights.",
83
- "contactAlreadyInSharing": "%{contactName} has already been invited in a group with %{sharingRights} rights. It is not possible to invite the same contact twice with different rights. |||| Contacts have already been invited with %{sharingRights} rights. It is not possible to invite the same contact twice with different rights.",
84
- "sharingRights": {
85
- "readOnly": "read",
86
- "readWrite": "write"
87
- }
81
+ "groupMemberAlreadyInSharing": "%{groupName} members have already been invited with %{sharingRights} rights. It is not possible to invite the same contact twice with different rights. |||| Contacts have already been invited with %{sharingRights} rights. It is not possible to invite the same contact twice with different rights.",
82
+ "contactAlreadyInSharing": "%{contactName} has already been invited in a group with %{sharingRights} rights. It is not possible to invite the same contact twice with different rights. |||| Contacts have already been invited with %{sharingRights} rights. It is not possible to invite the same contact twice with different rights.",
83
+ "sharingRights": {
84
+ "readOnly": "read",
85
+ "readWrite": "write"
88
86
  }
89
87
  },
90
88
  "send": "Send..."
package/locales/ru.json CHANGED
@@ -78,13 +78,11 @@
78
78
  "confirm": "OK"
79
79
  },
80
80
  "errors": {
81
- "errors": {
82
- "groupMemberAlreadyInSharing": "Участники %{groupName} уже были приглашены с правами %{sharingRights}. Невозможно пригласить один и тот же контакт дважды с разными правами. |||| Контакты уже были приглашены с правами %{sharingRights}. Невозможно пригласить один и тот же контакт дважды с разными правами.",
83
- "contactAlreadyInSharing": "%{contactName} уже был приглашен в группе с правами %{sharingRights}. Невозможно пригласить один и тот же контакт дважды с разными правами. |||| Контакты уже были приглашены с правами %{sharingRights}. Невозможно пригласить один и тот же контакт дважды с разными правами.",
84
- "sharingRights": {
85
- "readOnly": "чтение",
86
- "readWrite": "запись"
87
- }
81
+ "groupMemberAlreadyInSharing": "Участники %{groupName} уже были приглашены с правами %{sharingRights}. Невозможно пригласить один и тот же контакт дважды с разными правами. |||| Контакты уже были приглашены с правами %{sharingRights}. Невозможно пригласить один и тот же контакт дважды с разными правами.",
82
+ "contactAlreadyInSharing": "%{contactName} уже был приглашен в группе с правами %{sharingRights}. Невозможно пригласить один и тот же контакт дважды с разными правами. |||| Контакты уже были приглашены с правами %{sharingRights}. Невозможно пригласить один и тот же контакт дважды с разными правами.",
83
+ "sharingRights": {
84
+ "readOnly": "чтение",
85
+ "readWrite": "запись"
88
86
  }
89
87
  },
90
88
  "send": "Отправка..."
package/locales/vi.json CHANGED
@@ -78,13 +78,11 @@
78
78
  "confirm": "OK"
79
79
  },
80
80
  "errors": {
81
- "errors": {
82
- "groupMemberAlreadyInSharing": "Các thành viên của %{groupName} đã được mời với quyền %{sharingRights}. Không thể mời cùng một người liên hệ hai lần với các quyền khác nhau. |||| Các liên hệ đã được mời với quyền %{sharingRights}. Không thể mời cùng một người liên hệ hai lần với các quyền khác nhau.",
83
- "contactAlreadyInSharing": "%{contactName} đã được mời vào một nhóm với quyền %{sharingRights}. Không thể mời cùng một người liên hệ hai lần với các quyền khác nhau. |||| Các liên hệ đã được mời với quyền %{sharingRights}. Không thể mời cùng một người liên hệ hai lần với các quyền khác nhau.",
84
- "sharingRights": {
85
- "readOnly": "đọc",
86
- "readWrite": "viết"
87
- }
81
+ "groupMemberAlreadyInSharing": "Các thành viên của %{groupName} đã được mời với quyền %{sharingRights}. Không thể mời cùng một người liên hệ hai lần với các quyền khác nhau. |||| Các liên hệ đã được mời với quyền %{sharingRights}. Không thể mời cùng một người liên hệ hai lần với các quyền khác nhau.",
82
+ "contactAlreadyInSharing": "%{contactName} đã được mời vào một nhóm với quyền %{sharingRights}. Không thể mời cùng một người liên hệ hai lần với các quyền khác nhau. |||| Các liên hệ đã được mời với quyền %{sharingRights}. Không thể mời cùng một người liên hệ hai lần với các quyền khác nhau.",
83
+ "sharingRights": {
84
+ "readOnly": "đọc",
85
+ "readWrite": "viết"
88
86
  }
89
87
  },
90
88
  "send": "Gửi..."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "38.2.0",
3
+ "version": "39.0.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -58,7 +58,7 @@
58
58
  "cozy-intent": "^2.31.1",
59
59
  "cozy-minilog": "^3.10.1",
60
60
  "cozy-ui": "^140.5.0",
61
- "cozy-ui-plus": "^13.1.0",
61
+ "cozy-ui-plus": "^13.2.1",
62
62
  "jest": "30.3.0",
63
63
  "jest-environment-jsdom": "30.3.0",
64
64
  "react": "16.12.0",
@@ -84,5 +84,5 @@
84
84
  "sideEffects": [
85
85
  "*.css"
86
86
  ],
87
- "gitHead": "220f7adf050211114efcb2bb3f49ec72a34b79c9"
87
+ "gitHead": "6c0f53c29031519672da52f60cda9e3e67f2dfc0"
88
88
  }
@@ -1,3 +1,8 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+
4
+ import { getI18n } from 'twake-i18n'
5
+
1
6
  import { getSuccessMessage, countNewRecipients, getErrorMessage } from './share'
2
7
 
3
8
  describe('share', () => {
@@ -420,5 +425,40 @@ describe('share', () => {
420
425
  })
421
426
  expect(result).toEqual([`${documentType}.share.error.generic`])
422
427
  })
428
+
429
+ describe('with the locale files', () => {
430
+ const localesDir = path.join(__dirname, '../../locales')
431
+ const locales = fs
432
+ .readdirSync(localesDir)
433
+ .filter(file => file.endsWith('.json'))
434
+ .map(file => file.replace(/\.json$/, ''))
435
+ // The locale is also passed as the default language, so that a key
436
+ // missing from it is not resolved from the English fallback
437
+ const getLocaleI18n = lang =>
438
+ getI18n(
439
+ lang,
440
+ locale =>
441
+ JSON.parse(
442
+ fs.readFileSync(path.join(localesDir, `${locale}.json`), 'utf8')
443
+ ),
444
+ undefined,
445
+ lang
446
+ )
447
+
448
+ it.each(locales)(
449
+ 'should define every key read by getErrorMessage in %s',
450
+ lang => {
451
+ const { t } = getLocaleI18n(lang)
452
+ for (const key of [
453
+ 'Share.errors.groupMemberAlreadyInSharing',
454
+ 'Share.errors.contactAlreadyInSharing',
455
+ 'Share.errors.sharingRights.readOnly',
456
+ 'Share.errors.sharingRights.readWrite'
457
+ ]) {
458
+ expect(t(key, { smart_count: 1 })).not.toEqual(key)
459
+ }
460
+ }
461
+ )
462
+ })
423
463
  })
424
464
  })