cozy-harvest-lib 22.4.0 → 22.5.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/CHANGELOG.md CHANGED
@@ -3,6 +3,35 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 22.5.0 (2024-03-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Lint ([4fd054a](https://github.com/cozy/cozy-libs/commit/4fd054afb659061ef1bc1eb0c4553e4c12de9583))
12
+
13
+
14
+ ### Features
15
+
16
+ * **mespapiers:** Use showAlert instead Alerter into PapersDefinitions ([e9525f1](https://github.com/cozy/cozy-libs/commit/e9525f182341b9f0bcfa60914e2ce364e59dc933))
17
+ * Update KonnectorBlock to use sourceAccountIdentifier ([5e2b886](https://github.com/cozy/cozy-libs/commit/5e2b886f69f6018ac714548b30f8744f1c0a9347))
18
+ * Use sourceAccountIdentifier in files datacard ([2446c18](https://github.com/cozy/cozy-libs/commit/2446c18ca2d7b2b01241e6317c8ea3a2bd77ce33))
19
+
20
+
21
+
22
+
23
+
24
+ ## [22.4.1](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.4.0...cozy-harvest-lib@22.4.1) (2024-02-19)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * Get sourceAccountIdentifier with getAccountName ([9b8a446](https://github.com/cozy/cozy-libs/commit/9b8a446275ff3e733ea65ce9f958b6375f4b5009))
30
+
31
+
32
+
33
+
34
+
6
35
  # [22.4.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.3.0...cozy-harvest-lib@22.4.0) (2024-02-15)
7
36
 
8
37
 
@@ -30,7 +30,7 @@ var Datacards = function Datacards(_ref2) {
30
30
  konnector: konnector,
31
31
  trigger: trigger,
32
32
  accountId: trigger.message.account,
33
- sourceAccountIdentifier: models.account.getAccountLogin(account)
33
+ sourceAccountIdentifier: models.account.getAccountName(account)
34
34
  });
35
35
  }));
36
36
  };
@@ -43,7 +43,7 @@ var KonnectorBlock = function KonnectorBlock(_ref) {
43
43
  t = _useI18n.t;
44
44
 
45
45
  var slug = get(file, 'cozyMetadata.uploadedBy.slug');
46
- var sourceAccount = get(file, 'cozyMetadata.sourceAccount'); // TODO To be removed when UI's AppIcon use getIconURL from Cozy-Client
46
+ var sourceAccountIdentifier = get(file, 'cozyMetadata.sourceAccountIdentifier'); // TODO To be removed when UI's AppIcon use getIconURL from Cozy-Client
47
47
  // instead of its own see https://github.com/cozy/cozy-ui/issues/1723
48
48
 
49
49
  var fetchIcon = useCallback(function () {
@@ -56,18 +56,18 @@ var KonnectorBlock = function KonnectorBlock(_ref) {
56
56
  useEffect(function () {
57
57
  var fetchKonnector = /*#__PURE__*/function () {
58
58
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
59
- var client, t, slug, sourceAccount, konnector;
59
+ var client, t, slug, sourceAccountIdentifier, konnector;
60
60
  return _regeneratorRuntime.wrap(function _callee$(_context) {
61
61
  while (1) {
62
62
  switch (_context.prev = _context.next) {
63
63
  case 0:
64
- client = _ref2.client, t = _ref2.t, slug = _ref2.slug, sourceAccount = _ref2.sourceAccount;
64
+ client = _ref2.client, t = _ref2.t, slug = _ref2.slug, sourceAccountIdentifier = _ref2.sourceAccountIdentifier;
65
65
  _context.next = 3;
66
66
  return fetchKonnectorData({
67
67
  client: client,
68
68
  t: t,
69
69
  slug: slug,
70
- sourceAccount: sourceAccount
70
+ sourceAccountIdentifier: sourceAccountIdentifier
71
71
  });
72
72
 
73
73
  case 3:
@@ -91,9 +91,9 @@ var KonnectorBlock = function KonnectorBlock(_ref) {
91
91
  client: client,
92
92
  t: t,
93
93
  slug: slug,
94
- sourceAccount: sourceAccount
94
+ sourceAccountIdentifier: sourceAccountIdentifier
95
95
  });
96
- }, [client, t, slug, sourceAccount]);
96
+ }, [client, t, slug, sourceAccountIdentifier]);
97
97
 
98
98
  if (!konnector) {
99
99
  return /*#__PURE__*/React.createElement("div", {
@@ -8,7 +8,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  import keyBy from 'lodash/keyBy';
10
10
  import merge from 'lodash/merge';
11
- import { Q } from 'cozy-client';
11
+ import { Q, models } from 'cozy-client';
12
12
  import { triggers as triggersModel } from 'cozy-client/dist/models/trigger';
13
13
  import assert from '../assert';
14
14
  import logger from '../logger';
@@ -331,7 +331,17 @@ export var updateAccount = /*#__PURE__*/function () {
331
331
 
332
332
  export var saveAccount = function saveAccount(client, konnector, account) {
333
333
  assert(client && konnector && account, 'Must pass both client, konnector and account to saveAccount');
334
- return account._id ? updateAccount(client, account) : createAccount(client, konnector, account);
334
+ var sourceAccountIdentifier = models.account.getAccountLogin(account);
335
+
336
+ var updatedAccount = _objectSpread({}, account);
337
+
338
+ if (sourceAccountIdentifier) {
339
+ updatedAccount.cozyMetadata = _objectSpread(_objectSpread({}, account.cozyMetadata), {}, {
340
+ sourceAccountIdentifier: sourceAccountIdentifier
341
+ });
342
+ }
343
+
344
+ return account._id ? updateAccount(client, updatedAccount) : createAccount(client, konnector, updatedAccount);
335
345
  };
336
346
  /**
337
347
  * Deletes an account.