cozy-client 34.5.0 → 34.6.1

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.
@@ -2644,7 +2644,7 @@ var CozyClient = /*#__PURE__*/function () {
2644
2644
  CozyClient.hooks = CozyClient.hooks || {};
2645
2645
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2646
2646
 
2647
- CozyClient.version = "34.5.0";
2647
+ CozyClient.version = "34.6.1";
2648
2648
 
2649
2649
  _microee.default.mixin(CozyClient);
2650
2650
 
@@ -16,6 +16,11 @@ var _sub = _interopRequireDefault(require("date-fns/sub"));
16
16
  */
17
17
  var PERSONAL_SPORTING_LICENCE_PERIOD_DAYS = 365;
18
18
  var PERSONAL_SPORTING_LICENCE_NOTICE_PERIOD_DAYS = 15;
19
+ var EXPIRATION_LINK_BY_LABEL = {
20
+ national_id_card: 'https://www.service-public.fr/particuliers/vosdroits/N358',
21
+ residence_permit: 'https://www.service-public.fr/particuliers/vosdroits/N110',
22
+ passport: 'https://www.service-public.fr/particuliers/vosdroits/N360'
23
+ };
19
24
  /**
20
25
  * @param {IOCozyFile} file - io.cozy.files document
21
26
  * @returns {boolean}
@@ -176,7 +181,7 @@ var computeExpirationNoticeDate = function computeExpirationNoticeDate(file) {
176
181
  /**
177
182
  * @param {IOCozyFile} file - io.cozy.files document
178
183
  * @returns {string | null} Expiration notice link
179
- * @description Computes et returns the expiration notice link of the given file, or null if it has none or it is not expiring
184
+ * @description Computes and returns the expiration notice link of the given file, or null if it has none
180
185
  */
181
186
 
182
187
 
@@ -186,16 +191,8 @@ var computeExpirationNoticeLink = function computeExpirationNoticeLink(file) {
186
191
  var _file$metadata12, _file$metadata12$qual;
187
192
 
188
193
  var qualificationLabel = (_file$metadata12 = file.metadata) === null || _file$metadata12 === void 0 ? void 0 : (_file$metadata12$qual = _file$metadata12.qualification) === null || _file$metadata12$qual === void 0 ? void 0 : _file$metadata12$qual.label;
189
-
190
- if (isExpiringFrenchNationalIdCard(file)) {
191
- return 'https://www.service-public.fr/particuliers/vosdroits/N358';
192
- }
193
-
194
- if (isExpiringGeneric(file) && qualificationLabel === 'residence_permit') {
195
- return 'https://www.service-public.fr/particuliers/vosdroits/N110';
196
- }
197
-
198
- return null;
194
+ if (!qualificationLabel) return null;
195
+ return EXPIRATION_LINK_BY_LABEL[qualificationLabel] || null;
199
196
  };
200
197
  /**
201
198
  * @param {IOCozyFile} file - io.cozy.files document
@@ -45,6 +45,11 @@ describe('Expiration', () => {
45
45
  expirationDate: '2022-09-23T11:35:58.118Z',
46
46
  noticePeriod: '90'
47
47
  })
48
+ const fakePassportFile = buildMockFile({
49
+ qualificationLabel: 'passport',
50
+ expirationDate: '2022-09-23T11:35:58.118Z',
51
+ noticePeriod: '90'
52
+ })
48
53
  const fakePersonalSportingLicenceFile = buildMockFile({
49
54
  qualificationLabel: 'personal_sporting_licence',
50
55
  referencedDate: '2022-09-23T11:35:58.118Z'
@@ -103,6 +108,7 @@ describe('Expiration', () => {
103
108
  file | link
104
109
  ${fakeNationalIdCardFile} | ${'https://www.service-public.fr/particuliers/vosdroits/N358'}
105
110
  ${fakeResidencePermitFile} | ${'https://www.service-public.fr/particuliers/vosdroits/N110'}
111
+ ${fakePassportFile} | ${'https://www.service-public.fr/particuliers/vosdroits/N360'}
106
112
  `(
107
113
  `should return "$link" link for an file with "$file.metadata.qualification.label" qualification label`,
108
114
  ({ file, link }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "34.5.0",
3
+ "version": "34.6.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "@types/jest": "^26.0.20",
19
19
  "@types/lodash": "^4.14.170",
20
20
  "btoa": "^1.2.1",
21
- "cozy-stack-client": "^34.1.5",
21
+ "cozy-stack-client": "^34.6.1",
22
22
  "date-fns": "2.29.3",
23
23
  "json-stable-stringify": "^1.0.1",
24
24
  "lodash": "^4.17.13",
@@ -73,5 +73,5 @@
73
73
  "react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
74
74
  },
75
75
  "sideEffects": false,
76
- "gitHead": "ecbee1a9f002b3c40ff8aa7b01f5418a7d9519af"
76
+ "gitHead": "3860bc98e92f4c4a610739b55b3929ba7537446f"
77
77
  }