cozy-harvest-lib 8.3.0 → 8.4.1
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 +30 -0
- package/dist/components/AccountForm/index.js +3 -3
- package/dist/components/AccountForm/index.spec.js +47 -0
- package/dist/sentry.js +1 -1
- package/package.json +4 -4
- package/src/components/AccountForm/index.jsx +3 -3
- package/src/components/AccountForm/index.spec.jsx +49 -0
- package/src/sentry.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
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
|
+
## [8.4.1](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@8.4.0...cozy-harvest-lib@8.4.1) (2022-04-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package cozy-harvest-lib
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [8.4.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@8.3.1...cozy-harvest-lib@8.4.0) (2022-04-22)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* Change harvest sentry url to errors.cozycloud.cc ([582f1f5](https://github.com/cozy/cozy-libs/commit/582f1f5ad85fae9b8a7e290d12717ead8cfb7438))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [8.3.1](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@8.3.0...cozy-harvest-lib@8.3.1) (2022-04-15)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* Avoid to have not sanitized fields as identifier fields ([c6ed9ec](https://github.com/cozy/cozy-libs/commit/c6ed9ec194685e5eeb9f81e5c620d17beabf0289))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
# [8.3.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@8.2.1...cozy-harvest-lib@8.3.0) (2022-04-15)
|
|
7
37
|
|
|
8
38
|
|
|
@@ -191,7 +191,7 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
191
191
|
var _this$props = this.props,
|
|
192
192
|
account = _this$props.account,
|
|
193
193
|
konnector = _this$props.konnector;
|
|
194
|
-
var identifier = manifest.getIdentifier(konnector.fields);
|
|
194
|
+
var identifier = manifest.getIdentifier(manifest.sanitizeFields(konnector.fields));
|
|
195
195
|
|
|
196
196
|
if (account && account.auth[identifier] && account.auth[identifier] !== values[identifier]) {
|
|
197
197
|
this.showConfirmationModal();
|
|
@@ -272,7 +272,7 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
272
272
|
var isReadOnlyIdentifier = Boolean(get(account, 'relationships.vaultCipher')) && this.props.readOnlyIdentifier;
|
|
273
273
|
|
|
274
274
|
if (isReadOnlyIdentifier) {
|
|
275
|
-
var identifier = manifest.getIdentifier(
|
|
275
|
+
var identifier = manifest.getIdentifier(sanitizedFields);
|
|
276
276
|
sanitizedFields[identifier].type = 'hidden';
|
|
277
277
|
}
|
|
278
278
|
|
|
@@ -308,7 +308,7 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
308
308
|
className: "u-mb-1",
|
|
309
309
|
onClick: onBack,
|
|
310
310
|
konnector: konnector,
|
|
311
|
-
identifier: get(account, "auth.".concat(manifest.getIdentifier(
|
|
311
|
+
identifier: get(account, "auth.".concat(manifest.getIdentifier(sanitizedFields)))
|
|
312
312
|
}), isRunnable({
|
|
313
313
|
win: window,
|
|
314
314
|
konnector: konnector
|
|
@@ -51,6 +51,19 @@ var fixtures = {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
+
konnectorWithAdvancedField: {
|
|
55
|
+
fields: {
|
|
56
|
+
advancedFields: {
|
|
57
|
+
folderPath: {
|
|
58
|
+
advanced: true,
|
|
59
|
+
isRequired: false
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
username: {
|
|
63
|
+
type: 'text'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
54
67
|
account: {
|
|
55
68
|
auth: {
|
|
56
69
|
username: 'Toto',
|
|
@@ -434,6 +447,40 @@ describe('AccountForm', function () {
|
|
|
434
447
|
var hiddenInput = wrapper.find('input[type="hidden"][name="username"]');
|
|
435
448
|
expect(hiddenInput).toHaveLength(1);
|
|
436
449
|
});
|
|
450
|
+
it('should render a read-only identifier field even with advancedFields field in the manifest', function () {
|
|
451
|
+
var accountWithCipher = _objectSpread(_objectSpread({}, fixtures.account), {}, {
|
|
452
|
+
relationships: {
|
|
453
|
+
vaultCipher: {
|
|
454
|
+
_id: 'fake-cipher-id',
|
|
455
|
+
_type: 'com.bitwarden.ciphers',
|
|
456
|
+
_protocol: 'bitwarden'
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
var flowState = {};
|
|
462
|
+
var wrapper = mount( /*#__PURE__*/React.createElement(I18n, {
|
|
463
|
+
lang: "en",
|
|
464
|
+
dictRequire: function dictRequire() {}
|
|
465
|
+
}, /*#__PURE__*/React.createElement(AccountForm, {
|
|
466
|
+
flowState: flowState,
|
|
467
|
+
t: t,
|
|
468
|
+
konnector: fixtures.konnectorWithAdvancedField,
|
|
469
|
+
onSubmit: onSubmit,
|
|
470
|
+
account: accountWithCipher,
|
|
471
|
+
readOnlyIdentifier: true,
|
|
472
|
+
fieldOptions: {}
|
|
473
|
+
})), {
|
|
474
|
+
context: {
|
|
475
|
+
t: t
|
|
476
|
+
},
|
|
477
|
+
childContextTypes: {
|
|
478
|
+
t: PropTypes.func
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
var hiddenInput = wrapper.find('input[type="hidden"][name="username"]');
|
|
482
|
+
expect(hiddenInput).toHaveLength(1);
|
|
483
|
+
});
|
|
437
484
|
});
|
|
438
485
|
describe('fieldOptions', function () {
|
|
439
486
|
var setup = function setup(fieldOptions) {
|
package/dist/sentry.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as Sentry from '@sentry/browser';
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export var client = new Sentry.BrowserClient({
|
|
9
|
-
dsn: 'https://
|
|
9
|
+
dsn: 'https://1f8d191bad884bf98ae8cdcb6f6abb72@errors.cozycloud.cc/39',
|
|
10
10
|
integrations: Sentry.defaultIntegrations,
|
|
11
11
|
beforeSend: function beforeSend(event) {
|
|
12
12
|
if (process.env.NODE_ENV !== 'production') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-harvest-lib",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"description": "Provides logic, modules and components for Cozy's harvest applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"babel-plugin-inline-react-svg": "1.1.2",
|
|
54
54
|
"babel-preset-cozy-app": "^2.0.2",
|
|
55
55
|
"cozy-client": "27.17.0",
|
|
56
|
-
"cozy-device-helper": "^1.
|
|
56
|
+
"cozy-device-helper": "^1.18.0",
|
|
57
57
|
"cozy-flags": "^2.8.7",
|
|
58
58
|
"cozy-keys-lib": "3.8.0",
|
|
59
|
-
"cozy-realtime": "^4.0.
|
|
59
|
+
"cozy-realtime": "^4.0.6",
|
|
60
60
|
"cozy-ui": "60.6.0",
|
|
61
61
|
"enzyme": "3.11.0",
|
|
62
62
|
"enzyme-adapter-react-16": "1.15.6",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"react-router-dom": "^5.0.1"
|
|
86
86
|
},
|
|
87
87
|
"sideEffects": false,
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "b7e9f419cdbc99ff51cbc1f385fabe9034efb899"
|
|
89
89
|
}
|
|
@@ -132,7 +132,7 @@ export class AccountForm extends PureComponent {
|
|
|
132
132
|
handleSubmit(values, form) {
|
|
133
133
|
const { account, konnector } = this.props
|
|
134
134
|
|
|
135
|
-
const identifier = manifest.getIdentifier(konnector.fields)
|
|
135
|
+
const identifier = manifest.getIdentifier(manifest.sanitizeFields(konnector.fields))
|
|
136
136
|
if (
|
|
137
137
|
account &&
|
|
138
138
|
account.auth[identifier] &&
|
|
@@ -228,7 +228,7 @@ export class AccountForm extends PureComponent {
|
|
|
228
228
|
this.props.readOnlyIdentifier
|
|
229
229
|
|
|
230
230
|
if (isReadOnlyIdentifier) {
|
|
231
|
-
const identifier = manifest.getIdentifier(
|
|
231
|
+
const identifier = manifest.getIdentifier(sanitizedFields)
|
|
232
232
|
sanitizedFields[identifier].type = 'hidden'
|
|
233
233
|
}
|
|
234
234
|
|
|
@@ -268,7 +268,7 @@ export class AccountForm extends PureComponent {
|
|
|
268
268
|
konnector={konnector}
|
|
269
269
|
identifier={get(
|
|
270
270
|
account,
|
|
271
|
-
`auth.${manifest.getIdentifier(
|
|
271
|
+
`auth.${manifest.getIdentifier(sanitizedFields)}`
|
|
272
272
|
)}
|
|
273
273
|
/>
|
|
274
274
|
)}
|
|
@@ -49,6 +49,19 @@ const fixtures = {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
+
konnectorWithAdvancedField: {
|
|
53
|
+
fields: {
|
|
54
|
+
advancedFields: {
|
|
55
|
+
folderPath: {
|
|
56
|
+
advanced: true,
|
|
57
|
+
isRequired: false
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
username: {
|
|
61
|
+
type: 'text'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
52
65
|
account: {
|
|
53
66
|
auth: {
|
|
54
67
|
username: 'Toto',
|
|
@@ -386,6 +399,42 @@ describe('AccountForm', () => {
|
|
|
386
399
|
|
|
387
400
|
const hiddenInput = wrapper.find('input[type="hidden"][name="username"]')
|
|
388
401
|
|
|
402
|
+
expect(hiddenInput).toHaveLength(1)
|
|
403
|
+
})
|
|
404
|
+
it('should render a read-only identifier field even with advancedFields field in the manifest', () => {
|
|
405
|
+
const accountWithCipher = {
|
|
406
|
+
...fixtures.account,
|
|
407
|
+
relationships: {
|
|
408
|
+
vaultCipher: {
|
|
409
|
+
_id: 'fake-cipher-id',
|
|
410
|
+
_type: 'com.bitwarden.ciphers',
|
|
411
|
+
_protocol: 'bitwarden'
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
const flowState = {}
|
|
416
|
+
const wrapper = mount(
|
|
417
|
+
<I18n lang="en" dictRequire={() => {}}>
|
|
418
|
+
<AccountForm
|
|
419
|
+
flowState={flowState}
|
|
420
|
+
t={t}
|
|
421
|
+
konnector={fixtures.konnectorWithAdvancedField}
|
|
422
|
+
onSubmit={onSubmit}
|
|
423
|
+
account={accountWithCipher}
|
|
424
|
+
readOnlyIdentifier={true}
|
|
425
|
+
fieldOptions={{}}
|
|
426
|
+
/>
|
|
427
|
+
</I18n>,
|
|
428
|
+
{
|
|
429
|
+
context: { t },
|
|
430
|
+
childContextTypes: {
|
|
431
|
+
t: PropTypes.func
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
const hiddenInput = wrapper.find('input[type="hidden"][name="username"]')
|
|
437
|
+
|
|
389
438
|
expect(hiddenInput).toHaveLength(1)
|
|
390
439
|
})
|
|
391
440
|
})
|
package/src/sentry.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as Sentry from '@sentry/browser'
|
|
|
6
6
|
* @param {SentryClient}
|
|
7
7
|
*/
|
|
8
8
|
export const client = new Sentry.BrowserClient({
|
|
9
|
-
dsn: 'https://
|
|
9
|
+
dsn: 'https://1f8d191bad884bf98ae8cdcb6f6abb72@errors.cozycloud.cc/39',
|
|
10
10
|
integrations: Sentry.defaultIntegrations,
|
|
11
11
|
beforeSend(event) {
|
|
12
12
|
if (process.env.NODE_ENV !== 'production') {
|