@contentful/field-editor-shared 2.13.5 → 2.13.6
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.
|
@@ -10,47 +10,16 @@ Object.defineProperty(exports, "useReleaseStatus", {
|
|
|
10
10
|
});
|
|
11
11
|
const _react = require("react");
|
|
12
12
|
const _entityHelpers = require("../utils/entityHelpers");
|
|
13
|
+
const _getReleaseStatusBadgeConfig = require("../utils/getReleaseStatusBadgeConfig");
|
|
13
14
|
const _sanitizeLocales = require("../utils/sanitizeLocales");
|
|
14
15
|
function createReleaseLocaleStatus(locale, status) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
case 'willPublish':
|
|
24
|
-
return {
|
|
25
|
-
variant: 'positive',
|
|
26
|
-
status: 'willPublish',
|
|
27
|
-
label: 'Will publish',
|
|
28
|
-
locale
|
|
29
|
-
};
|
|
30
|
-
case 'becomesDraft':
|
|
31
|
-
return {
|
|
32
|
-
variant: 'warning',
|
|
33
|
-
status: 'becomesDraft',
|
|
34
|
-
label: 'Becomes draft',
|
|
35
|
-
locale
|
|
36
|
-
};
|
|
37
|
-
case 'remainsDraft':
|
|
38
|
-
return {
|
|
39
|
-
variant: 'warning',
|
|
40
|
-
status: 'remainsDraft',
|
|
41
|
-
label: 'Remains draft',
|
|
42
|
-
locale
|
|
43
|
-
};
|
|
44
|
-
case 'notInRelease':
|
|
45
|
-
return {
|
|
46
|
-
variant: 'secondary',
|
|
47
|
-
status: 'notInRelease',
|
|
48
|
-
label: 'Not in release',
|
|
49
|
-
locale
|
|
50
|
-
};
|
|
51
|
-
default:
|
|
52
|
-
throw new Error(`Unknown release entity status: ${status}`);
|
|
53
|
-
}
|
|
16
|
+
const { label, variant } = (0, _getReleaseStatusBadgeConfig.getReleaseStatusBadgeConfig)(status);
|
|
17
|
+
return {
|
|
18
|
+
variant,
|
|
19
|
+
status,
|
|
20
|
+
label,
|
|
21
|
+
locale
|
|
22
|
+
};
|
|
54
23
|
}
|
|
55
24
|
function getReleaseItemLocaleStatus(releaseItem, locale, previousEntityOnTimeline) {
|
|
56
25
|
if ('action' in releaseItem) {
|
|
@@ -1,46 +1,15 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { getEntityStatus } from '../utils/entityHelpers';
|
|
3
|
+
import { getReleaseStatusBadgeConfig } from '../utils/getReleaseStatusBadgeConfig';
|
|
3
4
|
import { sanitizeLocales } from '../utils/sanitizeLocales';
|
|
4
5
|
function createReleaseLocaleStatus(locale, status) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
case 'willPublish':
|
|
14
|
-
return {
|
|
15
|
-
variant: 'positive',
|
|
16
|
-
status: 'willPublish',
|
|
17
|
-
label: 'Will publish',
|
|
18
|
-
locale
|
|
19
|
-
};
|
|
20
|
-
case 'becomesDraft':
|
|
21
|
-
return {
|
|
22
|
-
variant: 'warning',
|
|
23
|
-
status: 'becomesDraft',
|
|
24
|
-
label: 'Becomes draft',
|
|
25
|
-
locale
|
|
26
|
-
};
|
|
27
|
-
case 'remainsDraft':
|
|
28
|
-
return {
|
|
29
|
-
variant: 'warning',
|
|
30
|
-
status: 'remainsDraft',
|
|
31
|
-
label: 'Remains draft',
|
|
32
|
-
locale
|
|
33
|
-
};
|
|
34
|
-
case 'notInRelease':
|
|
35
|
-
return {
|
|
36
|
-
variant: 'secondary',
|
|
37
|
-
status: 'notInRelease',
|
|
38
|
-
label: 'Not in release',
|
|
39
|
-
locale
|
|
40
|
-
};
|
|
41
|
-
default:
|
|
42
|
-
throw new Error(`Unknown release entity status: ${status}`);
|
|
43
|
-
}
|
|
6
|
+
const { label, variant } = getReleaseStatusBadgeConfig(status);
|
|
7
|
+
return {
|
|
8
|
+
variant,
|
|
9
|
+
status,
|
|
10
|
+
label,
|
|
11
|
+
locale
|
|
12
|
+
};
|
|
44
13
|
}
|
|
45
14
|
function getReleaseItemLocaleStatus(releaseItem, locale, previousEntityOnTimeline) {
|
|
46
15
|
if ('action' in releaseItem) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LocalesAPI } from '@contentful/app-sdk';
|
|
2
2
|
import type { AssetProps, EntryProps, LocaleProps, ReleaseProps } from 'contentful-management/types';
|
|
3
|
-
import type { ReleaseEntityStatus,
|
|
3
|
+
import type { ReleaseEntityStatus, ReleaseStatusMap, ReleaseV2Props } from '../types';
|
|
4
4
|
type UseActiveReleaseLocalesStatuses = {
|
|
5
5
|
entity?: EntryProps | AssetProps;
|
|
6
6
|
locales: LocaleProps[] | LocalesAPI;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-shared",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.6",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"registry": "https://npm.pkg.github.com/"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "f679be8ac8868788ca52d88939ae63d3ea046775"
|
|
62
62
|
}
|