@contentful/field-editor-reference 2.20.10 → 2.21.2

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,47 @@
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
+ ## [2.21.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@2.21.1...@contentful/field-editor-reference@2.21.2) (2021-10-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * [] Remove test utils from peer dependencies ([#889](https://github.com/contentful/field-editors/issues/889)) ([3694bd7](https://github.com/contentful/field-editors/commit/3694bd7e706b8beb1f685167125f36ef0cbe82de))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.21.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@2.21.0...@contentful/field-editor-reference@2.21.1) (2021-10-14)
18
+
19
+ **Note:** Version bump only for package @contentful/field-editor-reference
20
+
21
+
22
+
23
+
24
+
25
+ # [2.21.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@2.20.11...@contentful/field-editor-reference@2.21.0) (2021-10-06)
26
+
27
+
28
+ ### Features
29
+
30
+ * [EXT-3161] bump app sdk to v4 ([#881](https://github.com/contentful/field-editors/issues/881)) ([9c4a2af](https://github.com/contentful/field-editors/commit/9c4a2af07da203d59fb5f15c3a5188ecc64b1d44))
31
+
32
+
33
+
34
+
35
+
36
+ ## [2.20.11](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@2.20.10...@contentful/field-editor-reference@2.20.11) (2021-10-06)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **reference:** consistent ordering of link actions ([#884](https://github.com/contentful/field-editors/issues/884)) ([1a6bae7](https://github.com/contentful/field-editors/commit/1a6bae7825b09d91151bd80e7f55c0c1cf5ec27c))
42
+
43
+
44
+
45
+
46
+
6
47
  ## [2.20.10](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@2.20.9...@contentful/field-editor-reference@2.20.10) (2021-09-20)
7
48
 
8
49
  **Note:** Version bump only for package @contentful/field-editor-reference
@@ -143,57 +143,72 @@ export declare function newReferenceEditorFakeSdk(): (import("mitt").Emitter | {
143
143
  }>;
144
144
  getEntityScheduledActions(): Promise<never[]>;
145
145
  getCachedContentTypes: () => import("@contentful/app-sdk").ContentType[];
146
- getContentType: <T = Object>(id: string) => Promise<T>;
147
- getContentTypes: <T_1 = Object>() => Promise<import("@contentful/app-sdk").CollectionResponse<T_1>>;
148
- createContentType: <T_2 = Object, InputArgs = any>(data: InputArgs) => Promise<T_2>;
149
- updateContentType: <T_3 = Object, InputArgs_1 = any>(data: InputArgs_1) => Promise<T_3>;
150
- deleteContentType: <T_4 = Object, InputArgs_2 = any>(data: InputArgs_2) => Promise<T_4>;
151
- getEntrySnapshots: <T_5 = Object>(id: string) => Promise<import("@contentful/app-sdk").CollectionResponse<T_5>>;
152
- getEntries: <T_6 = Object, InputArgs_3 = import("@contentful/app-sdk").SearchQuery>(query?: InputArgs_3 | undefined) => Promise<import("@contentful/app-sdk").CollectionResponse<T_6>>;
153
- createEntry: <T_7 = Object, InputArgs_4 = any>(contentTypeId: string, data: InputArgs_4) => Promise<T_7>;
154
- updateEntry: <T_8 = Object, InputArgs_5 = any>(data: InputArgs_5) => Promise<T_8>;
155
- publishEntry: <T_9 = Object, InputArgs_6 = any>(data: InputArgs_6) => Promise<T_9>;
156
- unpublishEntry: <T_10 = Object, InputArgs_7 = any>(data: InputArgs_7) => Promise<T_10>;
157
- archiveEntry: <T_11 = Object, InputArgs_8 = any>(data: InputArgs_8) => Promise<T_11>;
158
- unarchiveEntry: <T_12 = Object, InputArgs_9 = any>(data: InputArgs_9) => Promise<T_12>;
159
- deleteEntry: <T_13 = Object, InputArgs_10 = any>(data: InputArgs_10) => Promise<T_13>;
160
- getPublishedEntries: <T_14 = Object, InputArgs_11 = import("@contentful/app-sdk").SearchQuery>(query?: InputArgs_11 | undefined) => Promise<import("@contentful/app-sdk").CollectionResponse<T_14>>;
161
- getAssets: <T_15 = Object, InputArgs_12 = import("@contentful/app-sdk").SearchQuery>(query?: InputArgs_12 | undefined) => Promise<import("@contentful/app-sdk").CollectionResponse<T_15>>;
162
- createAsset: <T_16 = Object, InputArgs_13 = any>(data: InputArgs_13) => Promise<T_16>;
163
- updateAsset: <T_17 = Object, InputArgs_14 = any>(data: InputArgs_14) => Promise<T_17>;
164
- deleteAsset: <T_18 = Object, InputArgs_15 = any>(data: InputArgs_15) => Promise<T_18>;
165
- publishAsset: <T_19 = Object, InputArgs_16 = any>(data: InputArgs_16) => Promise<T_19>;
166
- unpublishAsset: <T_20 = Object, InputArgs_17 = any>(data: InputArgs_17) => Promise<T_20>;
167
- archiveAsset: <T_21 = Object, InputArgs_18 = any>(data: InputArgs_18) => Promise<T_21>;
168
- processAsset: <T_22 = Object, InputArgs_19 = any>(data: InputArgs_19, locale: string) => Promise<T_22>;
169
- unarchiveAsset: <T_23 = Object, InputArgs_20 = any>(data: InputArgs_20) => Promise<T_23>;
170
- getPublishedAssets: <T_24 = Object, InputArgs_21 = import("@contentful/app-sdk").SearchQuery>(query?: InputArgs_21 | undefined) => Promise<import("@contentful/app-sdk").CollectionResponse<T_24>>;
171
- createUpload: (base64data: string) => void;
172
- waitUntilAssetProcessed: (assetId: string, locale: string) => Promise<void>;
173
- getUsers: <T_25 = Object>() => Promise<import("@contentful/app-sdk").CollectionResponse<T_25>>;
146
+ getContentType: (id: string) => Promise<import("@contentful/app-sdk").ContentType>;
147
+ getContentTypes: <Query extends import("@contentful/app-sdk").SearchQuery = import("@contentful/app-sdk").SearchQuery>(query?: Query | undefined) => Promise<import("@contentful/app-sdk").CollectionResponse<import("@contentful/app-sdk").ContentType>>;
148
+ createContentType: (data: import("@contentful/app-sdk").WithOptionalId<import("@contentful/app-sdk").ContentType>) => Promise<import("@contentful/app-sdk").ContentType>;
149
+ updateContentType: (data: import("@contentful/app-sdk").ContentType) => Promise<import("@contentful/app-sdk").ContentType>;
150
+ deleteContentType: (contentTypeId: string) => Promise<void>;
151
+ getEntrySnapshots: <Fields extends Record<string, any> = Record<string, any>>(id: string) => Promise<import("@contentful/app-sdk").CollectionResponse<{
152
+ sys: {
153
+ space?: Link<string, string> | undefined;
154
+ status?: Link<string, string> | undefined;
155
+ publishedVersion?: number | undefined;
156
+ archivedVersion?: number | undefined;
157
+ archivedBy?: Link<string, string> | undefined;
158
+ archivedAt?: string | undefined;
159
+ deletedVersion?: number | undefined;
160
+ deletedBy?: Link<string, string> | undefined;
161
+ deletedAt?: string | undefined;
162
+ snapshotType: string;
163
+ snapshotEntityType: string;
164
+ };
165
+ snapshot: import("@contentful/app-sdk").Entry<Fields>;
166
+ }>>;
167
+ getEntries: <Fields_1, Query_1 extends import("@contentful/app-sdk").SearchQuery = import("@contentful/app-sdk").SearchQuery>(query?: Query_1 | undefined) => Promise<import("@contentful/app-sdk").CollectionResponse<import("@contentful/app-sdk").Entry<Fields_1>>>;
168
+ createEntry: <Fields_2>(contentTypeId: string, data: import("@contentful/app-sdk").WithOptionalId<import("@contentful/app-sdk").Entry<Fields_2>>) => Promise<import("@contentful/app-sdk").Entry<Fields_2>>;
169
+ updateEntry: <Fields_3 extends Record<string, any> = Record<string, any>>(data: import("@contentful/app-sdk").Entry<Fields_3>) => Promise<import("@contentful/app-sdk").Entry<Fields_3>>;
170
+ publishEntry: <Fields_4 extends Record<string, any> = Record<string, any>>(data: import("@contentful/app-sdk").Entry<Fields_4>) => Promise<import("@contentful/app-sdk").Entry<Fields_4>>;
171
+ unpublishEntry: <Fields_5 extends Record<string, any> = Record<string, any>>(data: import("@contentful/app-sdk").Entry<Fields_5>) => Promise<import("@contentful/app-sdk").Entry<Fields_5>>;
172
+ archiveEntry: <Fields_6 extends Record<string, any> = Record<string, any>>(data: import("@contentful/app-sdk").Entry<Fields_6>) => Promise<import("@contentful/app-sdk").Entry<Fields_6>>;
173
+ unarchiveEntry: <Fields_7 extends Record<string, any> = Record<string, any>>(data: import("@contentful/app-sdk").Entry<Fields_7>) => Promise<import("@contentful/app-sdk").Entry<Fields_7>>;
174
+ deleteEntry: <Fields_8 extends Record<string, any> = Record<string, any>>(data: import("@contentful/app-sdk").Entry<Fields_8>) => Promise<void>;
175
+ getPublishedEntries: <Fields_9, Query_2 extends import("@contentful/app-sdk").SearchQuery = import("@contentful/app-sdk").SearchQuery>(query?: Query_2 | undefined) => Promise<import("@contentful/app-sdk").CollectionResponse<import("@contentful/app-sdk").Entry<Fields_9>>>;
176
+ getAssets: <Query_3 extends import("@contentful/app-sdk").SearchQuery = import("@contentful/app-sdk").SearchQuery>(query?: Query_3 | undefined) => Promise<import("@contentful/app-sdk").CollectionResponse<import("@contentful/app-sdk").Asset>>;
177
+ createAsset: (data: import("@contentful/app-sdk").WithOptionalId<import("@contentful/app-sdk").Asset>) => Promise<import("@contentful/app-sdk").Asset>;
178
+ updateAsset: (data: import("@contentful/app-sdk").Asset) => Promise<import("@contentful/app-sdk").Asset>;
179
+ deleteAsset: (data: import("@contentful/app-sdk").Asset) => Promise<void>;
180
+ publishAsset: (data: import("@contentful/app-sdk").Asset) => Promise<import("@contentful/app-sdk").Asset>;
181
+ unpublishAsset: (data: import("@contentful/app-sdk").Asset) => Promise<import("@contentful/app-sdk").Asset>;
182
+ archiveAsset: (data: import("@contentful/app-sdk").Asset) => Promise<import("@contentful/app-sdk").Asset>;
183
+ processAsset: (data: import("@contentful/app-sdk").Asset, locale: string) => Promise<import("@contentful/app-sdk").Asset>;
184
+ unarchiveAsset: (data: import("@contentful/app-sdk").Asset) => Promise<import("@contentful/app-sdk").Asset>;
185
+ getPublishedAssets: <Query_4 extends import("@contentful/app-sdk").SearchQuery = import("@contentful/app-sdk").SearchQuery>(query?: Query_4 | undefined) => Promise<import("@contentful/app-sdk").CollectionResponse<import("@contentful/app-sdk").Asset>>;
186
+ createUpload: (base64data: string) => Promise<import("contentful-management/types").UploadProps>;
187
+ waitUntilAssetProcessed: (assetId: string, locale: string) => Promise<import("@contentful/app-sdk").Asset>;
188
+ getUsers: () => Promise<import("@contentful/app-sdk").CollectionResponse<import("@contentful/app-sdk").User>>;
174
189
  getEditorInterface: (contentTypeId: string) => Promise<import("@contentful/app-sdk").EditorInterface>;
175
190
  getEditorInterfaces: () => Promise<import("@contentful/app-sdk").CollectionResponse<import("@contentful/app-sdk").EditorInterface>>;
176
191
  getAllScheduledActions: () => Promise<import("@contentful/app-sdk").ScheduledAction[]>;
177
192
  signRequest: (request: import("@contentful/app-sdk").CanonicalRequest) => Promise<Record<string, string>>;
178
- createTag: (id: string, name: string, visibility?: "private" | "public" | undefined) => Promise<import("@contentful/app-sdk").Tag>;
193
+ createTag: (id: string, name: string, visibility?: any) => Promise<import("@contentful/app-sdk").Tag>;
179
194
  readTags: (skip: number, limit: number) => Promise<import("@contentful/app-sdk").CollectionResponse<import("@contentful/app-sdk").Tag>>;
180
195
  updateTag: (id: string, name: string, version: number) => Promise<import("@contentful/app-sdk").Tag>;
181
196
  deleteTag: (id: string, version: number) => Promise<boolean>;
182
- getTeams: () => Promise<import("@contentful/app-sdk").CollectionResponse<import("@contentful/app-sdk").Team>>;
197
+ getTeams: (query: import("contentful-management/types").QueryOptions) => Promise<import("@contentful/app-sdk").CollectionResponse<import("contentful-management/types").TeamProps>>;
183
198
  };
184
199
  dialogs: {
185
- selectSingleAsset: () => Promise<Link>;
186
- selectMultipleAssets: () => Promise<Link[]>;
187
- selectSingleEntry: () => Promise<Link>;
188
- selectMultipleEntries: () => Promise<Link[]>;
200
+ selectSingleAsset: () => Promise<Link<string, string>>;
201
+ selectMultipleAssets: () => Promise<Link<string, string>[]>;
202
+ selectSingleEntry: () => Promise<Link<string, string>>;
203
+ selectMultipleEntries: () => Promise<Link<string, string>[]>;
189
204
  };
190
205
  navigator: {
191
206
  openNewAsset: () => Promise<{
192
- entity: Link;
207
+ entity: Link<string, string>;
193
208
  }>;
194
209
  openAsset: () => Promise<{}>;
195
210
  openNewEntry: () => Promise<{
196
- entity: Link;
211
+ entity: Link<string, string>;
197
212
  }>;
198
213
  openEntry: () => Promise<{}>;
199
214
  onSlideInNavigation: () => () => {};
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
- import { ReferenceValue, EntityType, ContentType } from '../types';
2
+ import { ReferenceValue, ContentEntityType, ContentType } from '../types';
3
3
  import { ReferenceEditorProps } from './ReferenceEditor';
4
4
  import { SortEndHandler, SortStartHandler } from 'react-sortable-hoc';
5
5
  declare type ChildProps = {
6
- entityType: EntityType;
6
+ entityType: ContentEntityType;
7
7
  items: ReferenceValue[];
8
8
  isDisabled: boolean;
9
9
  setValue: (value: ReferenceValue[]) => void;
@@ -13,7 +13,7 @@ declare type ChildProps = {
13
13
  onMove: (oldIndex: number, newIndex: number) => void;
14
14
  };
15
15
  export declare function MultipleReferenceEditor(props: ReferenceEditorProps & {
16
- entityType: EntityType;
16
+ entityType: ContentEntityType;
17
17
  children: (props: ReferenceEditorProps & ChildProps) => React.ReactElement;
18
18
  }): JSX.Element;
19
19
  export declare namespace MultipleReferenceEditor {
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
- import { ContentType, EntityType, ReferenceValue } from '../types';
2
+ import { ContentType, ContentEntityType, ReferenceValue } from '../types';
3
3
  import { ReferenceEditorProps } from './ReferenceEditor';
4
4
  declare type ChildProps = {
5
5
  entityId: string;
6
- entityType: EntityType;
6
+ entityType: ContentEntityType;
7
7
  isDisabled: boolean;
8
8
  setValue: (value: ReferenceValue | null | undefined) => void;
9
9
  allContentTypes: ContentType[];
@@ -11,7 +11,7 @@ declare type ChildProps = {
11
11
  hasCardEditActions: boolean;
12
12
  };
13
13
  export declare function SingleReferenceEditor(props: ReferenceEditorProps & {
14
- entityType: EntityType;
14
+ entityType: ContentEntityType;
15
15
  children: (props: ChildProps) => React.ReactElement;
16
16
  }): JSX.Element;
17
17
  export declare namespace SingleReferenceEditor {
@@ -9,6 +9,7 @@ export declare function useAccessApi(accessApi: AccessAPI & Partial<ExtendedAcce
9
9
  <T = Object>(action: CrudAction, entity: T | "ContentType" | import("@contentful/app-sdk").ContentType | "Asset" | "Entry"): Promise<boolean>;
10
10
  <T_1 = Object>(action: PublishableAction, entity: T_1 | "ContentType" | import("@contentful/app-sdk").ContentType | "Asset" | "Entry"): Promise<boolean>;
11
11
  <T_2 = Object>(action: ArchiveableAction, entity: T_2 | "Asset" | "Entry"): Promise<boolean>;
12
+ (action: "update", entity: import("@contentful/app-sdk").Entry<Record<string, any>> | import("@contentful/app-sdk").Task | import("@contentful/app-sdk").Asset, patch: import("@contentful/app-sdk").JSONPatchItem[]): Promise<boolean>;
12
13
  };
13
14
  canPerformActionOnEntryOfType: (action: EntryAction, contentTypeId: string) => Promise<boolean>;
14
15
  };
@@ -1,9 +1,9 @@
1
- import { ContentType, EntityType, FieldExtensionSDK } from '../types';
1
+ import { ContentType, ContentEntityType, FieldExtensionSDK } from '../types';
2
2
  import { ReferenceEditorProps } from './ReferenceEditor';
3
3
  import { ReferenceValidations } from '../utils/fromFieldValidations';
4
4
  declare type ContentTypePermissionsProps = {
5
5
  sdk: FieldExtensionSDK;
6
- entityType: EntityType;
6
+ entityType: ContentEntityType;
7
7
  parameters: ReferenceEditorProps['parameters'];
8
8
  allContentTypes: ContentType[];
9
9
  validations: ReferenceValidations;
@@ -1,8 +1,8 @@
1
- import { ContentType, EntityType, FieldExtensionSDK } from '../types';
1
+ import { ContentType, ContentEntityType, FieldExtensionSDK } from '../types';
2
2
  import { ReferenceEditorProps } from './ReferenceEditor';
3
3
  export declare type EditorPermissionsProps = {
4
4
  sdk: FieldExtensionSDK;
5
- entityType: EntityType;
5
+ entityType: ContentEntityType;
6
6
  parameters: ReferenceEditorProps['parameters'];
7
7
  allContentTypes: ContentType[];
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { EntityType, ContentType, ActionLabels, Entry, Asset, NavigatorSlideInfo } from '../../types';
2
+ import { ContentEntityType, ContentType, ActionLabels, Entry, Asset, NavigatorSlideInfo } from '../../types';
3
3
  export interface LinkActionsProps {
4
- entityType: EntityType;
4
+ entityType: ContentEntityType;
5
5
  contentTypes: ContentType[];
6
6
  canCreateEntity: boolean;
7
7
  canLinkEntity: boolean;
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
- import { Action, ActionLabels, EntityType, FieldExtensionSDK } from '../../types';
2
+ import { Action, ActionLabels, ContentEntityType, FieldExtensionSDK } from '../../types';
3
3
  import { LinkActionsProps } from './LinkActions';
4
4
  import { EditorPermissions } from '../../common/useEditorPermissions';
5
5
  declare type LinkEntityActionsProps = {
6
- entityType: EntityType;
6
+ entityType: ContentEntityType;
7
7
  canLinkMultiple: boolean;
8
8
  sdk: FieldExtensionSDK;
9
9
  isDisabled: boolean;
@@ -1,23 +1,26 @@
1
- import { EntityType, Entry, FieldExtensionSDK } from '../../types';
1
+ import { Asset, ContentEntityType, Entry, FieldExtensionSDK } from '../../types';
2
2
  import { EditorPermissions } from '../../common/useEditorPermissions';
3
3
  export declare function createEntity(props: {
4
4
  sdk: FieldExtensionSDK;
5
- entityType: EntityType;
5
+ entityType: ContentEntityType;
6
6
  contentTypeId?: string;
7
7
  }): Promise<{
8
8
  entity?: undefined;
9
9
  slide?: undefined;
10
10
  } | {
11
- entity: Entry | undefined;
12
- slide: import("@contentful/app-sdk/dist/types").NavigatorSlideInfo | undefined;
11
+ entity: Entry<Entry<Record<string, any>>> | undefined;
12
+ slide: import("@contentful/app-sdk/dist/types/navigator.types").NavigatorSlideInfo | undefined;
13
+ } | {
14
+ entity: Asset | undefined;
15
+ slide: import("@contentful/app-sdk/dist/types/navigator.types").NavigatorSlideInfo | undefined;
13
16
  }>;
14
17
  export declare function selectSingleEntity(props: {
15
18
  sdk: FieldExtensionSDK;
16
- entityType: EntityType;
19
+ entityType: ContentEntityType;
17
20
  editorPermissions: EditorPermissions;
18
- }): Promise<Entry | null>;
21
+ }): Promise<Entry<Record<string, any>> | null>;
19
22
  export declare function selectMultipleEntities(props: {
20
23
  sdk: FieldExtensionSDK;
21
- entityType: EntityType;
24
+ entityType: ContentEntityType;
22
25
  editorPermissions: EditorPermissions;
23
- }): Promise<Entry[] | null>;
26
+ }): Promise<Entry<Record<string, any>>[] | null>;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { EntityType } from '../../types';
2
+ import { ContentEntityType } from '../../types';
3
3
  export declare function MissingEntityCard(props: {
4
- entityType: EntityType;
4
+ entityType: ContentEntityType;
5
5
  asSquare?: boolean;
6
6
  isDisabled: boolean;
7
7
  onRemove?: Function;
@@ -604,18 +604,18 @@ function CombinedAssetLinkActions(props) {
604
604
  }, React.createElement(forma36ReactComponents.DropdownList, {
605
605
  testId: testIds$1.dropdown
606
606
  }, React.createElement(forma36ReactComponents.DropdownListItem, {
607
- testId: testIds$1.createAndLink,
607
+ testId: testIds$1.linkExisting,
608
608
  onClick: function onClick() {
609
609
  setOpen(false);
610
- props.onCreate();
610
+ props.onLinkExisting();
611
611
  }
612
- }, "Add new media"), React.createElement(forma36ReactComponents.DropdownListItem, {
613
- testId: testIds$1.linkExisting,
612
+ }, "Add existing media"), React.createElement(forma36ReactComponents.DropdownListItem, {
613
+ testId: testIds$1.createAndLink,
614
614
  onClick: function onClick() {
615
615
  setOpen(false);
616
- props.onLinkExisting();
616
+ props.onCreate();
617
617
  }
618
- }, "Add existing media")));
618
+ }, "Add new media")));
619
619
  }
620
620
 
621
621
  var card = /*#__PURE__*/emotion.css({
@@ -3052,7 +3052,9 @@ function renderActions(props) {
3052
3052
  testId: "card-action-edit"
3053
3053
  }, "Edit"), entityFile && React__default.createElement(forma36ReactComponents.DropdownListItem, {
3054
3054
  onClick: function onClick() {
3055
- return downloadAsset(entityFile.url);
3055
+ if (typeof entityFile.url === 'string') {
3056
+ downloadAsset(entityFile.url);
3057
+ }
3056
3058
  },
3057
3059
  testId: "card-action-download"
3058
3060
  }, "Download"), onRemove && React__default.createElement(forma36ReactComponents.DropdownListItem, {