cozy-client 34.5.0 → 34.6.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/dist/CozyClient.js +1 -1
- package/dist/models/paper.js +8 -11
- package/dist/models/paper.spec.js +6 -0
- package/package.json +2 -2
package/dist/CozyClient.js
CHANGED
|
@@ -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.
|
|
2647
|
+
CozyClient.version = "34.6.0";
|
|
2648
2648
|
|
|
2649
2649
|
_microee.default.mixin(CozyClient);
|
|
2650
2650
|
|
package/dist/models/paper.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "34.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -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": "
|
|
76
|
+
"gitHead": "ef938fae49072daffdb9e2b7228306212483b54c"
|
|
77
77
|
}
|