@contentful/field-editor-reference 5.30.5 → 5.30.12

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.
Files changed (51) hide show
  1. package/dist/cjs/common/EntityStore.js +10 -5
  2. package/dist/cjs/common/SingleReferenceEditor.js +1 -1
  3. package/dist/cjs/components/ScheduledIconWithTooltip/ScheduledIconWithTooltip.js +16 -8
  4. package/dist/cjs/entries/WrappedEntryCard/WrappedEntryCard.js +10 -2
  5. package/dist/cjs/resources/Cards/ResourceCard.spec.js +26 -19
  6. package/dist/cjs/resources/ExternalResourceCard/ExternalResourceCard.js +1 -7
  7. package/dist/esm/common/EntityStore.js +10 -5
  8. package/dist/esm/common/SingleReferenceEditor.js +1 -1
  9. package/dist/esm/components/ScheduledIconWithTooltip/ScheduledIconWithTooltip.js +16 -8
  10. package/dist/esm/entries/WrappedEntryCard/WrappedEntryCard.js +10 -2
  11. package/dist/esm/resources/Cards/ResourceCard.spec.js +26 -19
  12. package/dist/esm/resources/ExternalResourceCard/ExternalResourceCard.js +1 -7
  13. package/dist/types/assets/MultipleMediaEditor.d.ts +2 -2
  14. package/dist/types/assets/SingleMediaEditor.d.ts +2 -2
  15. package/dist/types/assets/WrappedAssetCard/AssetCardActions.d.ts +3 -3
  16. package/dist/types/assets/WrappedAssetCard/FetchingWrappedAssetCard.d.ts +2 -2
  17. package/dist/types/assets/WrappedAssetCard/WrappedAssetCard.d.ts +2 -2
  18. package/dist/types/assets/WrappedAssetCard/WrappedAssetLink.d.ts +2 -2
  19. package/dist/types/common/EntityStore.d.ts +1 -1
  20. package/dist/types/common/MultipleReferenceEditor.d.ts +1 -1
  21. package/dist/types/common/ReferenceEditor.d.ts +1 -1
  22. package/dist/types/common/SingleReferenceEditor.d.ts +1 -1
  23. package/dist/types/common/SortableLinkList.d.ts +1 -1
  24. package/dist/types/common/queryClient.d.ts +1 -1
  25. package/dist/types/components/AssetThumbnail/AssetThumbnail.d.ts +2 -2
  26. package/dist/types/components/CreateEntryLinkButton/CreateEntryLinkButton.d.ts +1 -1
  27. package/dist/types/components/CreateEntryLinkButton/CreateEntryMenuTrigger.d.ts +1 -1
  28. package/dist/types/components/EntityStatusBadge/EntityStatusBadge.d.ts +2 -2
  29. package/dist/types/components/LinkActions/CombinedLinkActions.d.ts +2 -2
  30. package/dist/types/components/LinkActions/LinkActions.d.ts +1 -1
  31. package/dist/types/components/LinkActions/LinkEntityActions.d.ts +2 -2
  32. package/dist/types/components/LinkActions/NoLinkPermissionsInfo.d.ts +2 -2
  33. package/dist/types/components/MissingAssetCard/MissingAssetCard.d.ts +2 -2
  34. package/dist/types/components/MissingEntityCard/MissingEntityCard.d.ts +2 -2
  35. package/dist/types/components/ResourceEntityErrorCard/ResourceEntityErrorCard.d.ts +2 -2
  36. package/dist/types/components/ResourceEntityErrorCard/UnsupportedEntityCard.d.ts +2 -2
  37. package/dist/types/components/ScheduledIconWithTooltip/ScheduleTooltip.d.ts +1 -1
  38. package/dist/types/components/ScheduledIconWithTooltip/ScheduledIconWithTooltip.d.ts +1 -1
  39. package/dist/types/components/SpaceName/SpaceName.d.ts +2 -2
  40. package/dist/types/entries/MultipleEntryReferenceEditor.d.ts +2 -2
  41. package/dist/types/entries/SingleEntryReferenceEditor.d.ts +2 -2
  42. package/dist/types/entries/WrappedEntryCard/FetchingWrappedEntryCard.d.ts +2 -2
  43. package/dist/types/entries/WrappedEntryCard/WrappedEntryCard.d.ts +1 -1
  44. package/dist/types/resources/Cards/ContentfulEntryCard.d.ts +2 -2
  45. package/dist/types/resources/Cards/ExternalEntryCard.d.ts +2 -2
  46. package/dist/types/resources/Cards/ResourceCard.d.ts +2 -2
  47. package/dist/types/resources/ExternalResourceCard/ExternalResourceCard.d.ts +1 -8
  48. package/dist/types/resources/MultipleResourceReferenceEditor.d.ts +2 -2
  49. package/dist/types/resources/SingleResourceReferenceEditor.d.ts +2 -2
  50. package/dist/types/types.d.ts +3 -39
  51. package/package.json +8 -9
@@ -117,7 +117,7 @@ const isEntityQueryKey = (queryKey)=>{
117
117
  async function fetchContentfulEntry({ urn, fetch, options }) {
118
118
  const resourceId = urn.split(':', 6)[5];
119
119
  const ENTITY_RESOURCE_ID_REGEX = RegExp("^spaces\\/(?<spaceId>[^/]+)(?:\\/environments\\/(?<environmentId>[^/]+))?\\/entries\\/(?<entityId>[^/]+)$");
120
- const resourceIdMatch = resourceId.match(ENTITY_RESOURCE_ID_REGEX);
120
+ const resourceIdMatch = resourceId?.match(ENTITY_RESOURCE_ID_REGEX);
121
121
  if (!resourceIdMatch || !resourceIdMatch?.groups?.spaceId || !resourceIdMatch?.groups?.entityId) {
122
122
  throw new Error('Not a valid crn');
123
123
  }
@@ -185,8 +185,11 @@ async function fetchExternalResource({ urn, fetch, options, spaceId, environment
185
185
  environmentId,
186
186
  resourceType,
187
187
  urn
188
- ], ({ cmaClient })=>cmaClient.raw.get(`/spaces/${spaceId}/environments/${environmentId}/resource_types/${resourceType}/resources`, {
189
- params: {
188
+ ], ({ cmaClient })=>cmaClient.resource.getMany({
189
+ spaceId,
190
+ environmentId,
191
+ resourceTypeId: resourceType,
192
+ query: {
190
193
  'sys.urn[in]': urn
191
194
  }
192
195
  }).then(({ items })=>items[0] ?? null), options),
@@ -194,8 +197,10 @@ async function fetchExternalResource({ urn, fetch, options, spaceId, environment
194
197
  'resource-types',
195
198
  spaceId,
196
199
  environmentId
197
- ], ({ cmaClient })=>(0, _contentfulmanagement.fetchAll)(({ query })=>cmaClient.raw.get(`/spaces/${spaceId}/environments/${environmentId}/resource_types`, {
198
- params: query
200
+ ], ({ cmaClient })=>(0, _contentfulmanagement.fetchAll)(({ query })=>cmaClient.resourceType.getForEnvironment({
201
+ spaceId,
202
+ environmentId,
203
+ query
199
204
  }), {}))
200
205
  ]);
201
206
  const resourceTypeEntity = resourceTypes.find((rt)=>rt.sys.id === resourceType);
@@ -107,7 +107,7 @@ function SingleReferenceEditor(props) {
107
107
  return _react.createElement(Editor, {
108
108
  ...props,
109
109
  key: `${externalReset}-reference`,
110
- entityId: value ? value.sys.id : '',
110
+ entityId: value ? value?.sys?.id : '',
111
111
  isDisabled: disabled,
112
112
  setValue: setValue,
113
113
  allContentTypes: allContentTypes
@@ -64,17 +64,25 @@ function useScheduledActions({ getEntityScheduledActions, entityId, entityType }
64
64
  type: 'loading'
65
65
  });
66
66
  _react.useEffect(()=>{
67
+ let mounted = true;
67
68
  getEntityScheduledActions(entityType, entityId).then((data)=>{
68
- setStatus({
69
- type: 'loaded',
70
- jobs: data
71
- });
69
+ if (mounted) {
70
+ setStatus({
71
+ type: 'loaded',
72
+ jobs: data
73
+ });
74
+ }
72
75
  }).catch((e)=>{
73
- setStatus({
74
- type: 'error',
75
- error: e
76
- });
76
+ if (mounted) {
77
+ setStatus({
78
+ type: 'error',
79
+ error: e
80
+ });
81
+ }
77
82
  });
83
+ return ()=>{
84
+ mounted = false;
85
+ };
78
86
  }, []);
79
87
  if (status.type === 'loading') {
80
88
  return {
@@ -65,6 +65,7 @@ function WrappedEntryCard(props) {
65
65
  const [file, setFile] = _react.useState(null);
66
66
  const { contentType } = props;
67
67
  _react.useEffect(()=>{
68
+ let mounted = true;
68
69
  if (props.entry) {
69
70
  getEntryImage({
70
71
  entry: props.entry,
@@ -72,11 +73,18 @@ function WrappedEntryCard(props) {
72
73
  localeCode: props.localeCode,
73
74
  defaultLocaleCode: props.defaultLocaleCode
74
75
  }, props.getAsset).then((file)=>{
75
- setFile(file);
76
+ if (mounted) {
77
+ setFile(file);
78
+ }
76
79
  }).catch(()=>{
77
- setFile(null);
80
+ if (mounted) {
81
+ setFile(null);
82
+ }
78
83
  });
79
84
  }
85
+ return ()=>{
86
+ mounted = false;
87
+ };
80
88
  }, [
81
89
  props.entry,
82
90
  props.getAsset,
@@ -91,17 +91,19 @@ const sdk = {
91
91
  return Promise.reject(new Error());
92
92
  })
93
93
  },
94
- Http: {
95
- get: jest.fn().mockImplementation(({ url, config })=>{
96
- if (url === '/spaces/space-id/environments/environment-id/resource_types') {
97
- return Promise.resolve({
98
- items: [
99
- _resourcetypejson.default
100
- ],
101
- pages: {}
102
- });
103
- }
104
- if (url === `/spaces/space-id/environments/environment-id/resource_types/${resolvableExternalResourceType}/resources` && config.params['sys.urn[in]'] === resolvableExternalEntityUrn) {
94
+ Locale: {
95
+ getMany: jest.fn().mockResolvedValue({
96
+ items: [
97
+ {
98
+ default: true,
99
+ code: 'en'
100
+ }
101
+ ]
102
+ })
103
+ },
104
+ Resource: {
105
+ getMany: jest.fn().mockImplementation(({ spaceId, environmentId, resourceTypeId, query })=>{
106
+ if (spaceId === 'space-id' && environmentId === 'environment-id' && resourceTypeId === resolvableExternalResourceType && query['sys.urn[in]'] === resolvableExternalEntityUrn) {
105
107
  return Promise.resolve({
106
108
  items: [
107
109
  _resourcejson.default
@@ -113,14 +115,19 @@ const sdk = {
113
115
  });
114
116
  })
115
117
  },
116
- Locale: {
117
- getMany: jest.fn().mockResolvedValue({
118
- items: [
119
- {
120
- default: true,
121
- code: 'en'
122
- }
123
- ]
118
+ ResourceType: {
119
+ getForEnvironment: jest.fn().mockImplementation(({ spaceId, environmentId })=>{
120
+ if (spaceId === 'space-id' && environmentId === 'environment-id') {
121
+ return Promise.resolve({
122
+ items: [
123
+ _resourcetypejson.default
124
+ ],
125
+ pages: {}
126
+ });
127
+ }
128
+ return Promise.resolve({
129
+ items: []
130
+ });
124
131
  })
125
132
  },
126
133
  ScheduledAction: {
@@ -59,11 +59,6 @@ function _interop_require_wildcard(obj, nodeInterop) {
59
59
  }
60
60
  return newObj;
61
61
  }
62
- const defaultProps = {
63
- isClickable: true,
64
- hasCardMoveActions: true,
65
- hasCardRemoveActions: true
66
- };
67
62
  const styles = {
68
63
  subtitle: (0, _emotion.css)({
69
64
  color: _f36tokens.default.gray600
@@ -98,7 +93,7 @@ function ExternalResourceCardDescription({ subtitle, description }) {
98
93
  }, truncatedDescription));
99
94
  }
100
95
  ExternalResourceCardDescription.displayName = 'ExternalResourceCardDescription';
101
- function ExternalResourceCard({ info, isClickable, onEdit, onRemove, onMoveTop, onMoveBottom, hasCardEditActions, hasCardMoveActions, hasCardRemoveActions, renderDragHandle, onClick, isSelected }) {
96
+ function ExternalResourceCard({ info, isClickable = true, onEdit, onRemove, onMoveTop, onMoveBottom, hasCardEditActions, hasCardMoveActions = true, hasCardRemoveActions = true, renderDragHandle, onClick, isSelected }) {
102
97
  const { resource: entity, resourceType } = info;
103
98
  const badge = ExternalEntityBadge(entity.fields.badge);
104
99
  return _react.createElement(_f36components.EntryCard, {
@@ -154,4 +149,3 @@ function ExternalResourceCard({ info, isClickable, onEdit, onRemove, onMoveTop,
154
149
  description: entity.fields.description
155
150
  }));
156
151
  }
157
- ExternalResourceCard.defaultProps = defaultProps;
@@ -38,7 +38,7 @@ const isEntityQueryKey = (queryKey)=>{
38
38
  async function fetchContentfulEntry({ urn, fetch, options }) {
39
39
  const resourceId = urn.split(':', 6)[5];
40
40
  const ENTITY_RESOURCE_ID_REGEX = RegExp("^spaces\\/(?<spaceId>[^/]+)(?:\\/environments\\/(?<environmentId>[^/]+))?\\/entries\\/(?<entityId>[^/]+)$");
41
- const resourceIdMatch = resourceId.match(ENTITY_RESOURCE_ID_REGEX);
41
+ const resourceIdMatch = resourceId?.match(ENTITY_RESOURCE_ID_REGEX);
42
42
  if (!resourceIdMatch || !resourceIdMatch?.groups?.spaceId || !resourceIdMatch?.groups?.entityId) {
43
43
  throw new Error('Not a valid crn');
44
44
  }
@@ -106,8 +106,11 @@ async function fetchExternalResource({ urn, fetch, options, spaceId, environment
106
106
  environmentId,
107
107
  resourceType,
108
108
  urn
109
- ], ({ cmaClient })=>cmaClient.raw.get(`/spaces/${spaceId}/environments/${environmentId}/resource_types/${resourceType}/resources`, {
110
- params: {
109
+ ], ({ cmaClient })=>cmaClient.resource.getMany({
110
+ spaceId,
111
+ environmentId,
112
+ resourceTypeId: resourceType,
113
+ query: {
111
114
  'sys.urn[in]': urn
112
115
  }
113
116
  }).then(({ items })=>items[0] ?? null), options),
@@ -115,8 +118,10 @@ async function fetchExternalResource({ urn, fetch, options, spaceId, environment
115
118
  'resource-types',
116
119
  spaceId,
117
120
  environmentId
118
- ], ({ cmaClient })=>fetchAll(({ query })=>cmaClient.raw.get(`/spaces/${spaceId}/environments/${environmentId}/resource_types`, {
119
- params: query
121
+ ], ({ cmaClient })=>fetchAll(({ query })=>cmaClient.resourceType.getForEnvironment({
122
+ spaceId,
123
+ environmentId,
124
+ query
120
125
  }), {}))
121
126
  ]);
122
127
  const resourceTypeEntity = resourceTypes.find((rt)=>rt.sys.id === resourceType);
@@ -57,7 +57,7 @@ export function SingleReferenceEditor(props) {
57
57
  return React.createElement(Editor, {
58
58
  ...props,
59
59
  key: `${externalReset}-reference`,
60
- entityId: value ? value.sys.id : '',
60
+ entityId: value ? value?.sys?.id : '',
61
61
  isDisabled: disabled,
62
62
  setValue: setValue,
63
63
  allContentTypes: allContentTypes
@@ -5,17 +5,25 @@ export function useScheduledActions({ getEntityScheduledActions, entityId, entit
5
5
  type: 'loading'
6
6
  });
7
7
  React.useEffect(()=>{
8
+ let mounted = true;
8
9
  getEntityScheduledActions(entityType, entityId).then((data)=>{
9
- setStatus({
10
- type: 'loaded',
11
- jobs: data
12
- });
10
+ if (mounted) {
11
+ setStatus({
12
+ type: 'loaded',
13
+ jobs: data
14
+ });
15
+ }
13
16
  }).catch((e)=>{
14
- setStatus({
15
- type: 'error',
16
- error: e
17
- });
17
+ if (mounted) {
18
+ setStatus({
19
+ type: 'error',
20
+ error: e
21
+ });
22
+ }
18
23
  });
24
+ return ()=>{
25
+ mounted = false;
26
+ };
19
27
  }, []);
20
28
  if (status.type === 'loading') {
21
29
  return {
@@ -14,6 +14,7 @@ export function WrappedEntryCard(props) {
14
14
  const [file, setFile] = React.useState(null);
15
15
  const { contentType } = props;
16
16
  React.useEffect(()=>{
17
+ let mounted = true;
17
18
  if (props.entry) {
18
19
  getEntryImage({
19
20
  entry: props.entry,
@@ -21,11 +22,18 @@ export function WrappedEntryCard(props) {
21
22
  localeCode: props.localeCode,
22
23
  defaultLocaleCode: props.defaultLocaleCode
23
24
  }, props.getAsset).then((file)=>{
24
- setFile(file);
25
+ if (mounted) {
26
+ setFile(file);
27
+ }
25
28
  }).catch(()=>{
26
- setFile(null);
29
+ if (mounted) {
30
+ setFile(null);
31
+ }
27
32
  });
28
33
  }
34
+ return ()=>{
35
+ mounted = false;
36
+ };
29
37
  }, [
30
38
  props.entry,
31
39
  props.getAsset,
@@ -41,17 +41,19 @@ const sdk = {
41
41
  return Promise.reject(new Error());
42
42
  })
43
43
  },
44
- Http: {
45
- get: jest.fn().mockImplementation(({ url, config })=>{
46
- if (url === '/spaces/space-id/environments/environment-id/resource_types') {
47
- return Promise.resolve({
48
- items: [
49
- resourceType
50
- ],
51
- pages: {}
52
- });
53
- }
54
- if (url === `/spaces/space-id/environments/environment-id/resource_types/${resolvableExternalResourceType}/resources` && config.params['sys.urn[in]'] === resolvableExternalEntityUrn) {
44
+ Locale: {
45
+ getMany: jest.fn().mockResolvedValue({
46
+ items: [
47
+ {
48
+ default: true,
49
+ code: 'en'
50
+ }
51
+ ]
52
+ })
53
+ },
54
+ Resource: {
55
+ getMany: jest.fn().mockImplementation(({ spaceId, environmentId, resourceTypeId, query })=>{
56
+ if (spaceId === 'space-id' && environmentId === 'environment-id' && resourceTypeId === resolvableExternalResourceType && query['sys.urn[in]'] === resolvableExternalEntityUrn) {
55
57
  return Promise.resolve({
56
58
  items: [
57
59
  resource
@@ -63,14 +65,19 @@ const sdk = {
63
65
  });
64
66
  })
65
67
  },
66
- Locale: {
67
- getMany: jest.fn().mockResolvedValue({
68
- items: [
69
- {
70
- default: true,
71
- code: 'en'
72
- }
73
- ]
68
+ ResourceType: {
69
+ getForEnvironment: jest.fn().mockImplementation(({ spaceId, environmentId })=>{
70
+ if (spaceId === 'space-id' && environmentId === 'environment-id') {
71
+ return Promise.resolve({
72
+ items: [
73
+ resourceType
74
+ ],
75
+ pages: {}
76
+ });
77
+ }
78
+ return Promise.resolve({
79
+ items: []
80
+ });
74
81
  })
75
82
  },
76
83
  ScheduledAction: {
@@ -3,11 +3,6 @@ import { Badge, EntryCard, MenuItem, MenuDivider, Paragraph, Caption } from '@co
3
3
  import tokens from '@contentful/f36-tokens';
4
4
  import { css } from 'emotion';
5
5
  import truncate from 'truncate';
6
- const defaultProps = {
7
- isClickable: true,
8
- hasCardMoveActions: true,
9
- hasCardRemoveActions: true
10
- };
11
6
  const styles = {
12
7
  subtitle: css({
13
8
  color: tokens.gray600
@@ -42,7 +37,7 @@ function ExternalResourceCardDescription({ subtitle, description }) {
42
37
  }, truncatedDescription));
43
38
  }
44
39
  ExternalResourceCardDescription.displayName = 'ExternalResourceCardDescription';
45
- export function ExternalResourceCard({ info, isClickable, onEdit, onRemove, onMoveTop, onMoveBottom, hasCardEditActions, hasCardMoveActions, hasCardRemoveActions, renderDragHandle, onClick, isSelected }) {
40
+ export function ExternalResourceCard({ info, isClickable = true, onEdit, onRemove, onMoveTop, onMoveBottom, hasCardEditActions, hasCardMoveActions = true, hasCardRemoveActions = true, renderDragHandle, onClick, isSelected }) {
46
41
  const { resource: entity, resourceType } = info;
47
42
  const badge = ExternalEntityBadge(entity.fields.badge);
48
43
  return React.createElement(EntryCard, {
@@ -98,4 +93,3 @@ export function ExternalResourceCard({ info, isClickable, onEdit, onRemove, onMo
98
93
  description: entity.fields.description
99
94
  }));
100
95
  }
101
- ExternalResourceCard.defaultProps = defaultProps;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { ReferenceEditorProps } from '../common/ReferenceEditor';
3
3
  type EditorProps = Pick<ReferenceEditorProps, Exclude<keyof ReferenceEditorProps, 'hasCardEditActions'>>;
4
- export declare function MultipleMediaEditor(props: EditorProps): JSX.Element;
4
+ export declare function MultipleMediaEditor(props: EditorProps): React.JSX.Element;
5
5
  export declare namespace MultipleMediaEditor {
6
6
  var defaultProps: {
7
7
  isInitiallyDisabled: boolean;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { ReferenceEditorProps } from '../common/ReferenceEditor';
3
3
  type EditorProps = Pick<ReferenceEditorProps, Exclude<keyof ReferenceEditorProps, 'hasCardEditActions'>>;
4
- export declare function SingleMediaEditor(props: EditorProps): JSX.Element;
4
+ export declare function SingleMediaEditor(props: EditorProps): React.JSX.Element;
5
5
  export declare namespace SingleMediaEditor {
6
6
  var defaultProps: {
7
7
  isInitiallyDisabled: boolean;
@@ -1,11 +1,11 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { File } from '../../types';
3
3
  export declare function renderAssetInfo(props: {
4
4
  entityFile: File;
5
- }): JSX.Element[];
5
+ }): React.JSX.Element[];
6
6
  export declare function renderActions(props: {
7
7
  onEdit?: () => void;
8
8
  onRemove?: () => void;
9
9
  isDisabled: boolean;
10
10
  entityFile?: File;
11
- }): (JSX.Element | null)[];
11
+ }): (React.JSX.Element | null)[];
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { CustomCardRenderer, RenderCustomMissingEntityCard } from '../../common/customCardTypes';
3
3
  import { Action, FieldAppSDK, ViewType, RenderDragFn } from '../../types';
4
4
  type FetchingWrappedAssetCardProps = {
@@ -13,5 +13,5 @@ type FetchingWrappedAssetCardProps = {
13
13
  renderCustomCard?: CustomCardRenderer;
14
14
  renderCustomMissingEntityCard?: RenderCustomMissingEntityCard;
15
15
  };
16
- export declare function FetchingWrappedAssetCard(props: FetchingWrappedAssetCardProps): JSX.Element;
16
+ export declare function FetchingWrappedAssetCard(props: FetchingWrappedAssetCardProps): React.JSX.Element;
17
17
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { SpaceAPI } from '@contentful/app-sdk';
3
3
  import { Asset, RenderDragFn } from '../../types';
4
4
  export interface WrappedAssetCardProps {
@@ -19,7 +19,7 @@ export interface WrappedAssetCardProps {
19
19
  isLocalized?: boolean;
20
20
  }
21
21
  export declare const WrappedAssetCard: {
22
- (props: WrappedAssetCardProps): JSX.Element;
22
+ (props: WrappedAssetCardProps): React.JSX.Element;
23
23
  defaultProps: {
24
24
  isClickable: boolean;
25
25
  };
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { SpaceAPI } from '@contentful/field-editor-shared';
3
3
  import { Asset, RenderDragFn } from '../../types';
4
4
  export interface WrappedAssetLinkProps {
@@ -14,4 +14,4 @@ export interface WrappedAssetLinkProps {
14
14
  renderDragHandle?: RenderDragFn;
15
15
  useLocalizedEntityStatus?: boolean;
16
16
  }
17
- export declare const WrappedAssetLink: (props: WrappedAssetLinkProps) => JSX.Element;
17
+ export declare const WrappedAssetLink: (props: WrappedAssetLinkProps) => React.JSX.Element;
@@ -66,5 +66,5 @@ export declare function useResource<R extends Resource = Resource>(resourceType:
66
66
  data: ResourceInfo<R> | undefined;
67
67
  error: unknown;
68
68
  };
69
- declare function EntityProvider({ children, ...props }: React.PropsWithChildren<EntityStoreProps>): JSX.Element;
69
+ declare function EntityProvider({ children, ...props }: React.PropsWithChildren<EntityStoreProps>): React.JSX.Element;
70
70
  export { EntityProvider, useEntityLoader };
@@ -19,7 +19,7 @@ export declare function MultipleReferenceEditor(props: ReferenceEditorProps & {
19
19
  entityType: ContentEntityType;
20
20
  children: (props: ReferenceEditorProps & ChildProps) => React.ReactElement;
21
21
  setIndexToUpdate?: React.Dispatch<React.SetStateAction<number | undefined>>;
22
- }): JSX.Element;
22
+ }): React.JSX.Element;
23
23
  export declare namespace MultipleReferenceEditor {
24
24
  var defaultProps: {
25
25
  hasCardEditActions: boolean;
@@ -37,7 +37,7 @@ export interface ReferenceEditorProps {
37
37
  export type CustomActionProps = LinkActionsProps;
38
38
  export declare function ReferenceEditor<T>(props: ReferenceEditorProps & {
39
39
  children: FieldConnector<T>['props']['children'];
40
- }): JSX.Element;
40
+ }): React.JSX.Element;
41
41
  export declare namespace ReferenceEditor {
42
42
  var defaultProps: {
43
43
  isInitiallyDisabled: boolean;
@@ -14,7 +14,7 @@ type ChildProps = {
14
14
  export declare function SingleReferenceEditor(props: ReferenceEditorProps & {
15
15
  entityType: ContentEntityType;
16
16
  children: (props: ChildProps) => React.ReactElement;
17
- }): JSX.Element;
17
+ }): React.JSX.Element;
18
18
  export declare namespace SingleReferenceEditor {
19
19
  var defaultProps: {
20
20
  hasCardEditActions: boolean;
@@ -23,5 +23,5 @@ type SortableLinkListProps<T> = ReferenceEditorProps & {
23
23
  };
24
24
  export declare const SortableLinkList: <T extends {
25
25
  sys: any;
26
- }>({ items, isDisabled, className, children, onSortStart, onSortEnd, updateBeforeSortStart, sortingStrategy, }: SortableLinkListProps<T>) => JSX.Element;
26
+ }>({ items, isDisabled, className, children, onSortStart, onSortEnd, updateBeforeSortStart, sortingStrategy, }: SortableLinkListProps<T>) => React.JSX.Element;
27
27
  export {};
@@ -6,4 +6,4 @@ export declare const useQuery: typeof useRQ;
6
6
  * Provides access to a query client either by sharing an existing client or
7
7
  * creating a new one.
8
8
  */
9
- export declare function SharedQueryClientProvider({ children }: React.PropsWithChildren<{}>): JSX.Element;
9
+ export declare function SharedQueryClientProvider({ children }: React.PropsWithChildren<{}>): React.JSX.Element;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { File } from '../../types';
3
3
  interface AssetThumbnailProps {
4
4
  file: File;
5
5
  }
6
- export declare function AssetThumbnail(props: AssetThumbnailProps): JSX.Element;
6
+ export declare function AssetThumbnail(props: AssetThumbnailProps): React.JSX.Element;
7
7
  export {};
@@ -15,5 +15,5 @@ interface CreateEntryLinkButtonProps {
15
15
  position: 'bottom-left' | 'bottom-right';
16
16
  };
17
17
  }
18
- export declare const CreateEntryLinkButton: ({ contentTypes, onSelect, customDropdownItems, text, testId, hasPlusIcon, useExperimentalStyles, suggestedContentTypeId, dropdownSettings, disabled, }: CreateEntryLinkButtonProps) => JSX.Element;
18
+ export declare const CreateEntryLinkButton: ({ contentTypes, onSelect, customDropdownItems, text, testId, hasPlusIcon, useExperimentalStyles, suggestedContentTypeId, dropdownSettings, disabled, }: CreateEntryLinkButtonProps) => React.JSX.Element;
19
19
  export {};
@@ -24,7 +24,7 @@ interface CreateEntryMenuTrigger {
24
24
  menuProps?: Omit<MenuProps, 'children'>;
25
25
  }
26
26
  export declare const CreateEntryMenuTrigger: {
27
- ({ contentTypes, suggestedContentTypeId, contentTypesLabel, onSelect, testId, dropdownSettings, customDropdownItems, children, menuProps, }: CreateEntryMenuTrigger): JSX.Element;
27
+ ({ contentTypes, suggestedContentTypeId, contentTypesLabel, onSelect, testId, dropdownSettings, customDropdownItems, children, menuProps, }: CreateEntryMenuTrigger): React.JSX.Element;
28
28
  defaultProps: {
29
29
  testId: string;
30
30
  contentTypesLabel: string;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { type EntityStatus } from '@contentful/f36-components';
3
3
  import { type UseScheduledActionsProps } from '../ScheduledIconWithTooltip/ScheduledIconWithTooltip';
4
4
  type EntityStatusBadgeProps = UseScheduledActionsProps & {
5
5
  status: EntityStatus;
6
6
  };
7
- export declare function EntityStatusBadge({ entityId, entityType, getEntityScheduledActions, status, ...props }: EntityStatusBadgeProps): JSX.Element;
7
+ export declare function EntityStatusBadge({ entityId, entityType, getEntityScheduledActions, status, ...props }: EntityStatusBadgeProps): React.JSX.Element;
8
8
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { LinkActionsProps } from './LinkActions';
3
3
  /**
4
4
  * Alternative, experimental alternative to <LinkActions /> that is planned to
@@ -7,4 +7,4 @@ import { LinkActionsProps } from './LinkActions';
7
7
  * Places both actions to create and link new, as well as link existing, behind
8
8
  * one action dropdown and introduces new copy for action labels.
9
9
  */
10
- export declare function CombinedLinkActions(props: LinkActionsProps): JSX.Element | null;
10
+ export declare function CombinedLinkActions(props: LinkActionsProps): React.JSX.Element | null;
@@ -23,4 +23,4 @@ export declare const testIds: {
23
23
  createAndLinkWrapper: string;
24
24
  linkExisting: string;
25
25
  };
26
- export declare function LinkActions(props: LinkActionsProps): JSX.Element | null;
26
+ export declare function LinkActions(props: LinkActionsProps): React.JSX.Element | null;
@@ -17,8 +17,8 @@ type LinkEntityActionsProps = {
17
17
  export declare function useLinkActionsProps(props: LinkEntityActionsProps): LinkActionsProps;
18
18
  export declare function LinkEntityActions({ renderCustomActions, ...props }: LinkActionsProps & {
19
19
  renderCustomActions?: (props: LinkActionsProps) => React.ReactElement;
20
- }): JSX.Element;
20
+ }): React.JSX.Element;
21
21
  export declare function CombinedLinkEntityActions({ renderCustomActions, ...props }: LinkActionsProps & {
22
22
  renderCustomActions?: (props: LinkActionsProps) => React.ReactElement;
23
- }): JSX.Element;
23
+ }): React.JSX.Element;
24
24
  export {};
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export declare function NoLinkPermissionsInfo(): JSX.Element;
1
+ import * as React from 'react';
2
+ export declare function NoLinkPermissionsInfo(): React.JSX.Element;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  export declare function MissingAssetCard(props: {
3
3
  asSquare?: boolean;
4
4
  isSelected?: boolean;
5
5
  isDisabled: boolean;
6
6
  onRemove?: Function;
7
- }): JSX.Element;
7
+ }): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  type MissingEntityCardProps = {
3
3
  customMessage?: string;
4
4
  isDisabled?: boolean;
@@ -6,5 +6,5 @@ type MissingEntityCardProps = {
6
6
  onRemove?: Function;
7
7
  providerName?: string;
8
8
  };
9
- export declare function MissingEntityCard(props: MissingEntityCardProps): JSX.Element;
9
+ export declare function MissingEntityCard(props: MissingEntityCardProps): React.JSX.Element;
10
10
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  type ResourceEntityErrorCardProps = {
3
3
  linkType: string;
4
4
  error: unknown;
@@ -6,5 +6,5 @@ type ResourceEntityErrorCardProps = {
6
6
  isDisabled: boolean;
7
7
  onRemove?: Function;
8
8
  };
9
- export declare function ResourceEntityErrorCard(props: ResourceEntityErrorCardProps): JSX.Element;
9
+ export declare function ResourceEntityErrorCard(props: ResourceEntityErrorCardProps): React.JSX.Element;
10
10
  export {};
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  type UnsupportedEntityCardProps = {
3
3
  isSelected?: boolean;
4
4
  onRemove?: Function;
5
5
  };
6
- export declare function UnsupportedEntityCard(props: UnsupportedEntityCardProps): JSX.Element;
6
+ export declare function UnsupportedEntityCard(props: UnsupportedEntityCardProps): React.JSX.Element;
7
7
  export {};
@@ -8,4 +8,4 @@ export declare const ScheduleTooltip: ({ job, jobsCount, children, }: {
8
8
  job: ScheduledAction;
9
9
  jobsCount: number;
10
10
  children: React.ReactElement;
11
- }) => JSX.Element;
11
+ }) => React.JSX.Element;
@@ -12,5 +12,5 @@ type ScheduledIconWithTooltipProps = {
12
12
  entityId: string;
13
13
  children: React.ReactElement;
14
14
  };
15
- export declare const ScheduledIconWithTooltip: ({ entityType, entityId, getEntityScheduledActions, children, }: ScheduledIconWithTooltipProps) => JSX.Element | null;
15
+ export declare const ScheduledIconWithTooltip: ({ entityType, entityId, getEntityScheduledActions, children, }: ScheduledIconWithTooltipProps) => React.JSX.Element | null;
16
16
  export {};
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  interface SourceProps {
3
3
  spaceName: string;
4
4
  environmentName?: string;
5
5
  }
6
- export declare function SpaceName(props: SourceProps): JSX.Element;
6
+ export declare function SpaceName(props: SourceProps): React.JSX.Element;
7
7
  export {};
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { ReferenceEditorProps } from '../common/ReferenceEditor';
3
- export declare function MultipleEntryReferenceEditor(props: ReferenceEditorProps): JSX.Element;
3
+ export declare function MultipleEntryReferenceEditor(props: ReferenceEditorProps): React.JSX.Element;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { ReferenceEditorProps } from '../common/ReferenceEditor';
3
- export declare function SingleEntryReferenceEditor(props: ReferenceEditorProps): JSX.Element;
3
+ export declare function SingleEntryReferenceEditor(props: ReferenceEditorProps): React.JSX.Element;
4
4
  export declare namespace SingleEntryReferenceEditor {
5
5
  var defaultProps: {
6
6
  isInitiallyDisabled: boolean;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { RenderCustomMissingEntityCard } from '../../common/customCardTypes';
3
3
  import { ReferenceEditorProps } from '../../common/ReferenceEditor';
4
4
  import { ContentType, RenderDragFn } from '../../types';
@@ -15,4 +15,4 @@ export type EntryCardReferenceEditorProps = ReferenceEditorProps & {
15
15
  renderCustomMissingEntityCard?: RenderCustomMissingEntityCard;
16
16
  isBeingDragged?: boolean;
17
17
  };
18
- export declare function FetchingWrappedEntryCard(props: EntryCardReferenceEditorProps): JSX.Element;
18
+ export declare function FetchingWrappedEntryCard(props: EntryCardReferenceEditorProps): React.JSX.Element;
@@ -26,7 +26,7 @@ export interface WrappedEntryCardProps {
26
26
  isLocalized?: boolean;
27
27
  useLocalizedEntityStatus?: boolean;
28
28
  }
29
- export declare function WrappedEntryCard(props: WrappedEntryCardProps): JSX.Element;
29
+ export declare function WrappedEntryCard(props: WrappedEntryCardProps): React.JSX.Element;
30
30
  export declare namespace WrappedEntryCard {
31
31
  var defaultProps: {
32
32
  isClickable: boolean;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { Entry } from '@contentful/field-editor-shared';
3
3
  import { RenderDragFn, ResourceInfo } from '../../types';
4
4
  export type CardActionsHandlers = {
@@ -17,5 +17,5 @@ type ContentfulEntryCardProps = {
17
17
  renderDragHandle?: RenderDragFn;
18
18
  getEntryRouteHref: (entryRoute: EntryRoute) => string;
19
19
  } & CardActionsHandlers;
20
- export declare function ContentfulEntryCard({ info, isDisabled, renderDragHandle, onRemove, onMoveTop, onMoveBottom, getEntryRouteHref, }: ContentfulEntryCardProps): JSX.Element;
20
+ export declare function ContentfulEntryCard({ info, isDisabled, renderDragHandle, onRemove, onMoveTop, onMoveBottom, getEntryRouteHref, }: ContentfulEntryCardProps): React.JSX.Element;
21
21
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { type ExternalResourceCardProps } from '../ExternalResourceCard/ExternalResourceCard';
3
3
  type ExternalEntryCardProps = ExternalResourceCardProps;
4
- export declare function ExternalEntryCard(props: ExternalEntryCardProps): JSX.Element;
4
+ export declare function ExternalEntryCard(props: ExternalEntryCardProps): React.JSX.Element;
5
5
  export {};
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { RenderDragFn, ResourceLink } from '../../types';
3
3
  import { CardActionsHandlers, EntryRoute } from './ContentfulEntryCard';
4
4
  type ResourceCardProps = {
@@ -8,5 +8,5 @@ type ResourceCardProps = {
8
8
  renderDragHandle?: RenderDragFn;
9
9
  getEntryRouteHref: (entryRoute: EntryRoute) => string;
10
10
  } & CardActionsHandlers;
11
- export declare function ResourceCard(props: ResourceCardProps): JSX.Element;
11
+ export declare function ResourceCard(props: ResourceCardProps): React.JSX.Element;
12
12
  export {};
@@ -16,11 +16,4 @@ export interface ExternalResourceCardProps {
16
16
  hasCardMoveActions?: boolean;
17
17
  hasCardRemoveActions?: boolean;
18
18
  }
19
- export declare function ExternalResourceCard({ info, isClickable, onEdit, onRemove, onMoveTop, onMoveBottom, hasCardEditActions, hasCardMoveActions, hasCardRemoveActions, renderDragHandle, onClick, isSelected, }: ExternalResourceCardProps): JSX.Element;
20
- export declare namespace ExternalResourceCard {
21
- var defaultProps: {
22
- isClickable: boolean;
23
- hasCardMoveActions: boolean;
24
- hasCardRemoveActions: boolean;
25
- };
26
- }
19
+ export declare function ExternalResourceCard({ info, isClickable, onEdit, onRemove, onMoveTop, onMoveBottom, hasCardEditActions, hasCardMoveActions, hasCardRemoveActions, renderDragHandle, onClick, isSelected, }: ExternalResourceCardProps): React.JSX.Element;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { ReferenceEditorProps } from '../common/ReferenceEditor';
3
3
  import { EntryRoute } from './Cards/ContentfulEntryCard';
4
4
  export declare function MultipleResourceReferenceEditor(props: ReferenceEditorProps & {
5
5
  apiUrl: string;
6
6
  getEntryRouteHref: (entryRoute: EntryRoute) => string;
7
- }): JSX.Element;
7
+ }): React.JSX.Element;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { ReferenceEditorProps } from '../common/ReferenceEditor';
3
3
  import { EntryRoute } from './Cards/ContentfulEntryCard';
4
4
  export declare function SingleResourceReferenceEditor(props: ReferenceEditorProps & {
5
5
  getEntryRouteHref: (entryRoute: EntryRoute) => string;
6
6
  apiUrl: string;
7
- }): JSX.Element;
7
+ }): React.JSX.Element;
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { NavigatorSlideInfo, ContentEntityType } from '@contentful/app-sdk';
3
3
  import { Entry, Asset } from '@contentful/field-editor-shared';
4
+ import { ResourceProps } from 'contentful-management';
4
5
  export type { BaseAppSDK, FieldAppSDK, ContentType, ContentTypeField, Link, ContentEntityType, NavigatorSlideInfo, ScheduledAction, } from '@contentful/app-sdk';
5
- export type { SpaceProps as Space, ResourceLink } from 'contentful-management';
6
+ export type { SpaceProps as Space, ResourceLink, ResourceProps as ExternalResource, SpaceEnvResourceTypeProps as ResourceType, } from 'contentful-management';
6
7
  export { Entry, File, Asset } from '@contentful/field-editor-shared';
7
8
  export type { ResourceInfo } from './common/EntityStore';
8
9
  export type Entity = Entry | Asset;
@@ -21,44 +22,7 @@ export type AssetLink = {
21
22
  };
22
23
  };
23
24
  export type EntityLink = EntryLink | AssetLink;
24
- type SysExternalResource<T extends string> = {
25
- sys: {
26
- type: 'Link';
27
- linkType: T;
28
- id: string;
29
- };
30
- };
31
- export type ResourceType = {
32
- sys: {
33
- type: 'ResourceType';
34
- id: string;
35
- resourceProvider: SysExternalResource<'ResourceProvider'>;
36
- };
37
- name: string;
38
- };
39
- export interface ExternalResource {
40
- sys: {
41
- type: 'Resource';
42
- urn: string;
43
- resourceProvider: SysExternalResource<'ResourceProvider'>;
44
- resourceType: SysExternalResource<'ResourceType'>;
45
- };
46
- fields: {
47
- title: string;
48
- subtitle?: string;
49
- description?: string;
50
- externalUrl?: string;
51
- badge?: {
52
- label: string;
53
- variant: 'negative' | 'positive' | 'primary' | 'secondary' | 'warning';
54
- };
55
- image?: {
56
- url: string;
57
- altText?: string;
58
- };
59
- };
60
- }
61
- export type Resource = Entry | ExternalResource;
25
+ export type Resource = Entry | ResourceProps;
62
26
  export type EntityType = 'Entry' | 'Asset' | string;
63
27
  export type SysResourceLink<T extends string> = {
64
28
  sys: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-reference",
3
- "version": "5.30.5",
3
+ "version": "5.30.12",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -35,27 +35,26 @@
35
35
  "tsc": "tsc -p ./ --noEmit"
36
36
  },
37
37
  "dependencies": {
38
- "@contentful/f36-components": "^4.67.0",
39
- "@contentful/f36-icons": "^4.28.2",
38
+ "@contentful/f36-components": "^4.70.0",
39
+ "@contentful/f36-icons": "^4.29.0",
40
40
  "@contentful/f36-tokens": "^4.0.5",
41
- "@contentful/field-editor-shared": "^1.6.0",
41
+ "@contentful/field-editor-shared": "^1.7.0",
42
42
  "@contentful/mimetype": "^2.2.29",
43
43
  "@dnd-kit/core": "^6.0.8",
44
44
  "@dnd-kit/modifiers": "^7.0.0",
45
45
  "@dnd-kit/sortable": "^8.0.0",
46
46
  "@tanstack/react-query": "^4.3.9",
47
47
  "constate": "^3.3.2",
48
- "contentful-management": "^11.30.0",
48
+ "contentful-management": "^11.35.1",
49
49
  "emotion": "^10.0.17",
50
50
  "lodash": "^4.17.15",
51
51
  "moment": "^2.20.0",
52
52
  "p-queue": "^4.0.0",
53
- "react-intersection-observer": "9.4.0",
54
- "type-fest": "2.17.0"
53
+ "react-intersection-observer": "9.4.0"
55
54
  },
56
55
  "devDependencies": {
57
56
  "@contentful/app-sdk": "^4.29.0",
58
- "@contentful/field-editor-test-utils": "^1.5.0",
57
+ "@contentful/field-editor-test-utils": "^1.5.2",
59
58
  "@testing-library/react-hooks": "^8.0.1"
60
59
  },
61
60
  "peerDependencies": {
@@ -65,5 +64,5 @@
65
64
  "publishConfig": {
66
65
  "registry": "https://npm.pkg.github.com/"
67
66
  },
68
- "gitHead": "8013feb5bcc5b6abdf4d856a61496db8bd247b7f"
67
+ "gitHead": "d734036ff89da141dbb91ade0342fb7f82cfe167"
69
68
  }