cozy-client 45.7.0 → 45.8.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.
@@ -2703,7 +2703,7 @@ var CozyClient = /*#__PURE__*/function () {
2703
2703
  CozyClient.hooks = CozyClient.hooks || {};
2704
2704
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2705
2705
 
2706
- CozyClient.version = "45.7.0";
2706
+ CozyClient.version = "45.8.0";
2707
2707
 
2708
2708
  _microee.default.mixin(CozyClient);
2709
2709
 
@@ -121,6 +121,10 @@ var setContractSyncStatusInAccount = function setContractSyncStatusInAccount(acc
121
121
  exports.setContractSyncStatusInAccount = setContractSyncStatusInAccount;
122
122
 
123
123
  var getAccountLogin = function getAccountLogin(account) {
124
+ if (account.identifier) {
125
+ return account.auth[account.identifier];
126
+ }
127
+
124
128
  if (account && account.auth) {
125
129
  var _iterator = _createForOfIteratorHelper(_manifest.legacyLoginFields),
126
130
  _step;
@@ -209,6 +209,33 @@ describe('account model', () => {
209
209
  })
210
210
  })
211
211
 
212
+ describe('getAccountLogin', () => {
213
+ it('should return account.identifier field if defined', () => {
214
+ expect(
215
+ getAccountLogin({
216
+ _id: 'accountid',
217
+ auth: {
218
+ login: 'loginfield',
219
+ other: 'identifierfield'
220
+ },
221
+ identifier: 'other'
222
+ })
223
+ ).toStrictEqual('identifierfield')
224
+ })
225
+
226
+ it('should return login field if no identifier is defined', () => {
227
+ expect(
228
+ getAccountLogin({
229
+ _id: 'accountid',
230
+ auth: {
231
+ login: 'loginfield',
232
+ other: 'identifierfield'
233
+ }
234
+ })
235
+ ).toStrictEqual('loginfield')
236
+ })
237
+ })
238
+
212
239
  describe('getAccountName', () => {
213
240
  it('should return auth.accountName in priority', () => {
214
241
  expect(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "45.7.0",
3
+ "version": "45.8.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": "c0c7fbf1307bb383debaa6bdb3c79c29c889dbc8"
78
+ "gitHead": "c88d681a2f65911a240a4b0bae19e88c8fd5a86e"
79
79
  }