cozy-client 46.3.0 → 46.4.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.
@@ -2705,7 +2705,7 @@ var CozyClient = /*#__PURE__*/function () {
2705
2705
  CozyClient.hooks = CozyClient.hooks || {};
2706
2706
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2707
2707
 
2708
- CozyClient.version = "46.3.0";
2708
+ CozyClient.version = "46.4.0";
2709
2709
 
2710
2710
  _microee.default.mixin(CozyClient);
2711
2711
 
@@ -179,6 +179,10 @@
179
179
  "payment_proof_family_allowance": {
180
180
  "number":"CAF file number"
181
181
  },
182
+ "vehicle": {
183
+ "licenseNumber": "Vehicle registration number",
184
+ "confidentialNumber": "Confidential code"
185
+ },
182
186
  "vehicle_registration": {
183
187
  "number": "Vehicle registration number (VIN)"
184
188
  },
@@ -179,6 +179,10 @@
179
179
  "payment_proof_family_allowance": {
180
180
  "number":"Numéro de dossier CAF"
181
181
  },
182
+ "vehicle": {
183
+ "licenseNumber": "Plaque d'immatriculation",
184
+ "confidentialNumber": "Code confidentiel"
185
+ },
182
186
  "vehicle_registration": {
183
187
  "number": "Numéro de la carte grise (VIN)"
184
188
  },
@@ -17,6 +17,8 @@ var _locales = require("./document/locales");
17
17
 
18
18
  var _contact = require("./contact");
19
19
 
20
+ var _get = _interopRequireDefault(require("lodash/get"));
21
+
20
22
  /**
21
23
  * @typedef {import("../types").IOCozyFile} IOCozyFile
22
24
  */
@@ -30,7 +32,7 @@ var EXPIRATION_LINK_BY_LABEL = {
30
32
  };
31
33
  var KNOWN_DATE_METADATA_NAMES = ['AObtentionDate', 'BObtentionDate', 'CObtentionDate', 'DObtentionDate', 'obtentionDate', 'expirationDate', 'referencedDate', 'issueDate', 'shootingDate', 'date', 'datetime'];
32
34
  exports.KNOWN_DATE_METADATA_NAMES = KNOWN_DATE_METADATA_NAMES;
33
- var KNOWN_INFORMATION_METADATA_NAMES = ['number', 'bicNumber', 'country', 'refTaxIncome', 'contractType', 'netSocialAmount', 'employerName', 'noticePeriod'];
35
+ var KNOWN_INFORMATION_METADATA_NAMES = ['number', 'bicNumber', 'country', 'refTaxIncome', 'contractType', 'netSocialAmount', 'employerName', 'vehicle.licenseNumber', 'vehicle.confidentialNumber', 'noticePeriod'];
34
36
  exports.KNOWN_INFORMATION_METADATA_NAMES = KNOWN_INFORMATION_METADATA_NAMES;
35
37
  var KNOWN_OTHER_METADATA_NAMES = ['contact', 'page', 'qualification'];
36
38
  /**
@@ -239,6 +241,14 @@ var isExpiringSoon = function isExpiringSoon(file) {
239
241
  var isExpiringSoon = expirationDate != null && expirationNoticeDate != null && expirationNoticeDate <= now && now < expirationDate;
240
242
  return isExpiringSoon;
241
243
  };
244
+ /**
245
+ * @param {Object} params -
246
+ * @param {Object} params.metadata - An io.cozy.files metadata object
247
+ * @param {string} params.knownMetadataName - Name of the metadata
248
+ * @param {string | null} [params.value] - Value of the metadata
249
+ * @returns {{ name: string, value: string | null }} displayable metadata
250
+ */
251
+
242
252
 
243
253
  exports.isExpiringSoon = isExpiringSoon;
244
254
 
@@ -246,12 +256,15 @@ var makeMetadataQualification = function makeMetadataQualification(_ref) {
246
256
  var metadata = _ref.metadata,
247
257
  knownMetadataName = _ref.knownMetadataName,
248
258
  value = _ref.value;
249
- var shouldReturnThisMetadata = Object.keys(metadata).includes(knownMetadataName);
259
+
260
+ var _value = value || (0, _get.default)(metadata, knownMetadataName, null);
261
+
262
+ var shouldReturnThisMetadata = !!_value;
250
263
 
251
264
  if (shouldReturnThisMetadata || knownMetadataName === 'contact') {
252
265
  return {
253
266
  name: knownMetadataName,
254
- value: value || null
267
+ value: _value
255
268
  };
256
269
  }
257
270
 
@@ -268,18 +281,16 @@ var formatMetadataQualification = function formatMetadataQualification(metadata)
268
281
  var dates = KNOWN_DATE_METADATA_NAMES.map(function (dateName) {
269
282
  return makeMetadataQualification({
270
283
  metadata: metadata,
271
- knownMetadataName: dateName,
272
- value: metadata[dateName]
284
+ knownMetadataName: dateName
273
285
  });
274
286
  }).filter(Boolean).filter(function (data, _, arr) {
275
287
  if (arr.length > 1) return data.name !== 'datetime';
276
288
  return data;
277
289
  });
278
- var informations = KNOWN_INFORMATION_METADATA_NAMES.map(function (numberName) {
290
+ var informations = KNOWN_INFORMATION_METADATA_NAMES.map(function (infoName) {
279
291
  return makeMetadataQualification({
280
292
  metadata: metadata,
281
- knownMetadataName: numberName,
282
- value: metadata[numberName]
293
+ knownMetadataName: infoName
283
294
  });
284
295
  }).filter(Boolean);
285
296
  var others = KNOWN_OTHER_METADATA_NAMES.map(function (otherName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "46.3.0",
3
+ "version": "46.4.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -75,5 +75,5 @@
75
75
  "react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
76
76
  },
77
77
  "sideEffects": false,
78
- "gitHead": "c696c81b4c3c4831a4d5acb9826bee65963848fa"
78
+ "gitHead": "7425c7d2dee49b2c2c54b95695754219bbe5bc0b"
79
79
  }