@contentful/field-editor-slug 1.5.17 → 1.5.19
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/dist/cjs/SlugEditor.js +1 -1
- package/dist/cjs/SlugEditor.test.js +7 -7
- package/dist/cjs/SlugEditorField.js +2 -2
- package/dist/cjs/TrackingFieldConnector.js +2 -5
- package/dist/cjs/services/slugify.js +1 -1
- package/dist/cjs/styles.js +1 -1
- package/dist/esm/SlugEditor.test.js +6 -6
- package/dist/esm/TrackingFieldConnector.js +1 -4
- package/package.json +3 -3
package/dist/cjs/SlugEditor.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "SlugEditor", {
|
|
|
8
8
|
return SlugEditor;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
13
13
|
const _SlugEditorField = require("./SlugEditorField");
|
|
14
14
|
const _TrackingFieldConnector = require("./TrackingFieldConnector");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
5
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
6
6
|
const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
|
|
7
7
|
const _react1 = require("@testing-library/react");
|
|
8
8
|
require("@testing-library/jest-dom/extend-expect");
|
|
@@ -72,7 +72,7 @@ function createMocks(initialValues = {}) {
|
|
|
72
72
|
}), initialValues.titleField || '');
|
|
73
73
|
const [descriptionField] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>({
|
|
74
74
|
...field,
|
|
75
|
-
id:
|
|
75
|
+
id: "description-id",
|
|
76
76
|
setValue: jest.fn().mockImplementation(field.setValue),
|
|
77
77
|
getValue: jest.fn().mockImplementation(field.getValue),
|
|
78
78
|
onValueChanged: jest.fn().mockImplementation(field.onValueChanged)
|
|
@@ -99,7 +99,7 @@ function createMocks(initialValues = {}) {
|
|
|
99
99
|
fields: {
|
|
100
100
|
'title-id': titleField,
|
|
101
101
|
'entry-id': field,
|
|
102
|
-
|
|
102
|
+
"description-id": descriptionField
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
contentType: {
|
|
@@ -501,7 +501,7 @@ describe('SlugEditor', ()=>{
|
|
|
501
501
|
const { field, titleField, descriptionField, sdk } = createMocks({
|
|
502
502
|
field: '',
|
|
503
503
|
titleField: 'This is initial title value',
|
|
504
|
-
descriptionField:
|
|
504
|
+
descriptionField: "This is initial description value"
|
|
505
505
|
});
|
|
506
506
|
(0, _react1.render)(_react.createElement(_SlugEditor.SlugEditor, {
|
|
507
507
|
field: field,
|
|
@@ -509,7 +509,7 @@ describe('SlugEditor', ()=>{
|
|
|
509
509
|
isInitiallyDisabled: false,
|
|
510
510
|
parameters: {
|
|
511
511
|
instance: {
|
|
512
|
-
trackingFieldId:
|
|
512
|
+
trackingFieldId: "description-id"
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
}));
|
|
@@ -517,9 +517,9 @@ describe('SlugEditor', ()=>{
|
|
|
517
517
|
expect(titleField.onValueChanged).not.toHaveBeenCalled();
|
|
518
518
|
expect(descriptionField.onValueChanged).toHaveBeenCalledWith('en-US', expect.any(Function));
|
|
519
519
|
expect(field.setValue).toHaveBeenCalledTimes(1);
|
|
520
|
-
expect(field.setValue).toHaveBeenLastCalledWith(
|
|
520
|
+
expect(field.setValue).toHaveBeenLastCalledWith("this-is-initial-description-value");
|
|
521
521
|
});
|
|
522
|
-
await sdk.entry.fields[
|
|
522
|
+
await sdk.entry.fields["description-id"].setValue('Hello world!');
|
|
523
523
|
await (0, _react1.waitFor)(()=>{
|
|
524
524
|
expect(field.setValue).toHaveBeenCalledTimes(2);
|
|
525
525
|
expect(field.setValue).toHaveBeenLastCalledWith('hello-world');
|
|
@@ -16,12 +16,12 @@ _export(exports, {
|
|
|
16
16
|
return SlugEditorFieldStatic;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
19
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
20
20
|
const _f36components = require("@contentful/f36-components");
|
|
21
21
|
const _f36icons = require("@contentful/f36-icons");
|
|
22
22
|
const _usedebounce = require("use-debounce");
|
|
23
23
|
const _makeSlug = require("./services/makeSlug");
|
|
24
|
-
const _styles = _interop_require_wildcard(require("./styles"));
|
|
24
|
+
const _styles = /*#__PURE__*/ _interop_require_wildcard(require("./styles"));
|
|
25
25
|
function _getRequireWildcardCache(nodeInterop) {
|
|
26
26
|
if (typeof WeakMap !== "function") return null;
|
|
27
27
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "TrackingFieldConnector", {
|
|
|
8
8
|
return TrackingFieldConnector;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
function _define_property(obj, key, value) {
|
|
13
13
|
if (key in obj) {
|
|
14
14
|
Object.defineProperty(obj, key, {
|
|
@@ -118,10 +118,7 @@ class TrackingFieldConnector extends (_React_Component = _react.Component) {
|
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
constructor(props){
|
|
121
|
-
super(props);
|
|
122
|
-
_define_property(this, "unsubscribeValue", null);
|
|
123
|
-
_define_property(this, "unsubscribeLocalizedValue", null);
|
|
124
|
-
_define_property(this, "unsubscribeSysChanges", null);
|
|
121
|
+
super(props), _define_property(this, "unsubscribeValue", null), _define_property(this, "unsubscribeLocalizedValue", null), _define_property(this, "unsubscribeSysChanges", null);
|
|
125
122
|
const titleField = getTitleField(props.sdk, props.trackingFieldId);
|
|
126
123
|
const entrySys = props.sdk.entry.getSys();
|
|
127
124
|
const isSame = titleField ? props.field.id === titleField.id : false;
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "slugify", {
|
|
|
8
8
|
return slugify;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _speakingurl = _interop_require_default(require("speakingurl"));
|
|
11
|
+
const _speakingurl = /*#__PURE__*/ _interop_require_default(require("speakingurl"));
|
|
12
12
|
function _interop_require_default(obj) {
|
|
13
13
|
return obj && obj.__esModule ? obj : {
|
|
14
14
|
default: obj
|
package/dist/cjs/styles.js
CHANGED
|
@@ -28,7 +28,7 @@ _export(exports, {
|
|
|
28
28
|
return validationRow;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
31
|
+
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
32
32
|
const _emotion = require("emotion");
|
|
33
33
|
function _interop_require_default(obj) {
|
|
34
34
|
return obj && obj.__esModule ? obj : {
|
|
@@ -27,7 +27,7 @@ function createMocks(initialValues = {}) {
|
|
|
27
27
|
}), initialValues.titleField || '');
|
|
28
28
|
const [descriptionField] = createFakeFieldAPI((field)=>({
|
|
29
29
|
...field,
|
|
30
|
-
id:
|
|
30
|
+
id: "description-id",
|
|
31
31
|
setValue: jest.fn().mockImplementation(field.setValue),
|
|
32
32
|
getValue: jest.fn().mockImplementation(field.getValue),
|
|
33
33
|
onValueChanged: jest.fn().mockImplementation(field.onValueChanged)
|
|
@@ -54,7 +54,7 @@ function createMocks(initialValues = {}) {
|
|
|
54
54
|
fields: {
|
|
55
55
|
'title-id': titleField,
|
|
56
56
|
'entry-id': field,
|
|
57
|
-
|
|
57
|
+
"description-id": descriptionField
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
contentType: {
|
|
@@ -456,7 +456,7 @@ describe('SlugEditor', ()=>{
|
|
|
456
456
|
const { field, titleField, descriptionField, sdk } = createMocks({
|
|
457
457
|
field: '',
|
|
458
458
|
titleField: 'This is initial title value',
|
|
459
|
-
descriptionField:
|
|
459
|
+
descriptionField: "This is initial description value"
|
|
460
460
|
});
|
|
461
461
|
render(React.createElement(SlugEditor, {
|
|
462
462
|
field: field,
|
|
@@ -464,7 +464,7 @@ describe('SlugEditor', ()=>{
|
|
|
464
464
|
isInitiallyDisabled: false,
|
|
465
465
|
parameters: {
|
|
466
466
|
instance: {
|
|
467
|
-
trackingFieldId:
|
|
467
|
+
trackingFieldId: "description-id"
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
}));
|
|
@@ -472,9 +472,9 @@ describe('SlugEditor', ()=>{
|
|
|
472
472
|
expect(titleField.onValueChanged).not.toHaveBeenCalled();
|
|
473
473
|
expect(descriptionField.onValueChanged).toHaveBeenCalledWith('en-US', expect.any(Function));
|
|
474
474
|
expect(field.setValue).toHaveBeenCalledTimes(1);
|
|
475
|
-
expect(field.setValue).toHaveBeenLastCalledWith(
|
|
475
|
+
expect(field.setValue).toHaveBeenLastCalledWith("this-is-initial-description-value");
|
|
476
476
|
});
|
|
477
|
-
await sdk.entry.fields[
|
|
477
|
+
await sdk.entry.fields["description-id"].setValue('Hello world!');
|
|
478
478
|
await waitFor(()=>{
|
|
479
479
|
expect(field.setValue).toHaveBeenCalledTimes(2);
|
|
480
480
|
expect(field.setValue).toHaveBeenLastCalledWith('hello-world');
|
|
@@ -67,10 +67,7 @@ export class TrackingFieldConnector extends (_React_Component = React.Component)
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
constructor(props){
|
|
70
|
-
super(props);
|
|
71
|
-
_define_property(this, "unsubscribeValue", null);
|
|
72
|
-
_define_property(this, "unsubscribeLocalizedValue", null);
|
|
73
|
-
_define_property(this, "unsubscribeSysChanges", null);
|
|
70
|
+
super(props), _define_property(this, "unsubscribeValue", null), _define_property(this, "unsubscribeLocalizedValue", null), _define_property(this, "unsubscribeSysChanges", null);
|
|
74
71
|
const titleField = getTitleField(props.sdk, props.trackingFieldId);
|
|
75
72
|
const entrySys = props.sdk.entry.getSys();
|
|
76
73
|
const isSame = titleField ? props.field.id === titleField.id : false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-slug",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.19",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@contentful/f36-components": "^4.70.0",
|
|
39
39
|
"@contentful/f36-icons": "^4.29.0",
|
|
40
40
|
"@contentful/f36-tokens": "^4.0.5",
|
|
41
|
-
"@contentful/field-editor-shared": "^2.
|
|
41
|
+
"@contentful/field-editor-shared": "^2.4.1",
|
|
42
42
|
"@types/speakingurl": "^13.0.2",
|
|
43
43
|
"emotion": "^10.0.17",
|
|
44
44
|
"lodash": "^4.17.15",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"registry": "https://npm.pkg.github.com/"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "1d0dc6dc10cf4ad43aa48b04fa67d29ab7edaee8"
|
|
60
60
|
}
|