cozy-client 36.0.0 → 36.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.
@@ -2669,7 +2669,7 @@ var CozyClient = /*#__PURE__*/function () {
2669
2669
  CozyClient.hooks = CozyClient.hooks || {};
2670
2670
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2671
2671
 
2672
- CozyClient.version = "36.0.0";
2672
+ CozyClient.version = "36.2.0";
2673
2673
 
2674
2674
  _microee.default.mixin(CozyClient);
2675
2675
 
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getIndexByFamilyNameGivenNameEmailCozyUrl = exports.getDefaultSortIndexValue = exports.makeDefaultSortIndexValue = exports.getDisplayName = exports.makeDisplayName = exports.getFullname = exports.makeFullname = exports.getPrimaryAddress = exports.getPrimaryPhone = exports.getPrimaryCozyDomain = exports.getPrimaryCozy = exports.getPrimaryEmail = exports.getInitials = exports.getPrimaryOrFirst = void 0;
8
+ exports.isContact = exports.getIndexByFamilyNameGivenNameEmailCozyUrl = exports.getDefaultSortIndexValue = exports.makeDefaultSortIndexValue = exports.getDisplayName = exports.makeDisplayName = exports.getFullname = exports.makeFullname = exports.getPrimaryAddress = exports.getPrimaryPhone = exports.getPrimaryCozyDomain = exports.getPrimaryCozy = exports.getPrimaryEmail = exports.getInitials = exports.getPrimaryOrFirst = exports.CONTACTS_DOCTYPE = void 0;
9
9
 
10
10
  var _get = _interopRequireDefault(require("lodash/get"));
11
11
 
@@ -13,6 +13,9 @@ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
13
13
 
14
14
  var _logger = _interopRequireDefault(require("../logger"));
15
15
 
16
+ var CONTACTS_DOCTYPE = 'io.cozy.contacts';
17
+ exports.CONTACTS_DOCTYPE = CONTACTS_DOCTYPE;
18
+
16
19
  var getPrimaryOrFirst = function getPrimaryOrFirst(property) {
17
20
  return function (obj) {
18
21
  return !obj[property] || obj[property].length === 0 ? '' : obj[property].find(function (property) {
@@ -259,5 +262,18 @@ var getIndexByFamilyNameGivenNameEmailCozyUrl = function getIndexByFamilyNameGiv
259
262
 
260
263
  return getDefaultSortIndexValue(contact);
261
264
  };
265
+ /**
266
+ * Whether the document is a contact
267
+ *
268
+ * @param {object} doc - A document (from io.cozy.something, or com.bitwarden or anything else)
269
+ * @returns {boolean}
270
+ */
271
+
272
+
273
+ exports.getIndexByFamilyNameGivenNameEmailCozyUrl = getIndexByFamilyNameGivenNameEmailCozyUrl;
274
+
275
+ var isContact = function isContact(doc) {
276
+ return doc._type === CONTACTS_DOCTYPE;
277
+ };
262
278
 
263
- exports.getIndexByFamilyNameGivenNameEmailCozyUrl = getIndexByFamilyNameGivenNameEmailCozyUrl;
279
+ exports.isContact = isContact;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "36.0.0",
3
+ "version": "36.2.0",
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": "^36.0.0",
21
+ "cozy-stack-client": "^36.2.0",
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": "66475ed97922a875fc12439aee820568ae9d023c"
76
+ "gitHead": "c7d354e2b7fbb02d31e833b8b04816992a93b490"
77
77
  }
@@ -1,3 +1,4 @@
1
+ export const CONTACTS_DOCTYPE: "io.cozy.contacts";
1
2
  export function getPrimaryOrFirst(property: any): (obj: any) => any;
2
3
  export function getInitials(contact: object): string;
3
4
  export function getPrimaryEmail(contact: object): string;
@@ -12,3 +13,4 @@ export function getDisplayName(contact: object): string;
12
13
  export function makeDefaultSortIndexValue(contact: object): string;
13
14
  export function getDefaultSortIndexValue(contact: object): string;
14
15
  export function getIndexByFamilyNameGivenNameEmailCozyUrl(contact: object): string;
16
+ export function isContact(doc: object): boolean;