@contentful/field-editor-reference 5.16.2 → 5.16.3
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/common/useEditorPermissions.spec.js +2 -2
- package/dist/esm/common/useEditorPermissions.spec.js +2 -2
- package/dist/types/__fixtures__/FakeSdk.d.ts +2 -2
- package/dist/types/assets/WrappedAssetCard/FetchingWrappedAssetCard.d.ts +2 -2
- package/dist/types/common/EntityStore.d.ts +2 -2
- package/dist/types/common/ReferenceEditor.d.ts +2 -2
- package/dist/types/common/useContentTypePermissions.d.ts +2 -2
- package/dist/types/common/useEditorPermissions.d.ts +2 -2
- package/dist/types/components/LinkActions/LinkEntityActions.d.ts +2 -2
- package/dist/types/components/LinkActions/helpers.d.ts +4 -4
- package/dist/types/resources/testHelpers/resourceEditorHelpers.d.ts +2 -2
- package/dist/types/resources/useResourceLinkActions.d.ts +2 -2
- package/dist/types/types.d.ts +1 -1
- package/package.json +6 -6
|
@@ -6,7 +6,7 @@ const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
|
|
|
6
6
|
const _reacthooks = require("@testing-library/react-hooks");
|
|
7
7
|
const _useEditorPermissions = require("./useEditorPermissions");
|
|
8
8
|
describe('useEditorPermissions', ()=>{
|
|
9
|
-
const
|
|
9
|
+
const makeFieldAppSDK = (customizeMock)=>({
|
|
10
10
|
field: (0, _fieldeditortestutils.createFakeFieldAPI)(customizeMock)[0],
|
|
11
11
|
access: {
|
|
12
12
|
can: jest.fn().mockResolvedValue(true),
|
|
@@ -19,7 +19,7 @@ describe('useEditorPermissions', ()=>{
|
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
const renderEditorPermissions = async ({ entityType , params ={} , allContentTypes =[] , customizeMock , customizeSdk })=>{
|
|
22
|
-
const sdk =
|
|
22
|
+
const sdk = makeFieldAppSDK(customizeMock);
|
|
23
23
|
customizeSdk?.(sdk);
|
|
24
24
|
const renderResult = (0, _reacthooks.renderHook)(()=>(0, _useEditorPermissions.useEditorPermissions)({
|
|
25
25
|
sdk,
|
|
@@ -2,7 +2,7 @@ import { createFakeFieldAPI } from '@contentful/field-editor-test-utils';
|
|
|
2
2
|
import { renderHook } from '@testing-library/react-hooks';
|
|
3
3
|
import { useEditorPermissions } from './useEditorPermissions';
|
|
4
4
|
describe('useEditorPermissions', ()=>{
|
|
5
|
-
const
|
|
5
|
+
const makeFieldAppSDK = (customizeMock)=>({
|
|
6
6
|
field: createFakeFieldAPI(customizeMock)[0],
|
|
7
7
|
access: {
|
|
8
8
|
can: jest.fn().mockResolvedValue(true),
|
|
@@ -15,7 +15,7 @@ describe('useEditorPermissions', ()=>{
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
const renderEditorPermissions = async ({ entityType , params ={} , allContentTypes =[] , customizeMock , customizeSdk })=>{
|
|
18
|
-
const sdk =
|
|
18
|
+
const sdk = makeFieldAppSDK(customizeMock);
|
|
19
19
|
customizeSdk?.(sdk);
|
|
20
20
|
const renderResult = renderHook(()=>useEditorPermissions({
|
|
21
21
|
sdk,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FieldAppSDK } from '@contentful/app-sdk';
|
|
2
2
|
import { Emitter } from 'mitt';
|
|
3
3
|
export type ReferenceEditorSdkProps = {
|
|
4
4
|
initialValue?: any;
|
|
5
5
|
validations?: any;
|
|
6
6
|
fetchDelay?: number;
|
|
7
7
|
};
|
|
8
|
-
export declare function newReferenceEditorFakeSdk(props?: ReferenceEditorSdkProps): [
|
|
8
|
+
export declare function newReferenceEditorFakeSdk(props?: ReferenceEditorSdkProps): [FieldAppSDK, Emitter];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { CustomCardRenderer, RenderCustomMissingEntityCard } from '../../common/customCardTypes';
|
|
3
|
-
import { Action,
|
|
3
|
+
import { Action, FieldAppSDK, ViewType, RenderDragFn } from '../../types';
|
|
4
4
|
type FetchingWrappedAssetCardProps = {
|
|
5
5
|
assetId: string;
|
|
6
6
|
isDisabled: boolean;
|
|
7
|
-
sdk:
|
|
7
|
+
sdk: FieldAppSDK;
|
|
8
8
|
viewType: ViewType | 'big_card';
|
|
9
9
|
onRemove: () => void;
|
|
10
10
|
getEntityUrl?: (id: string) => string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseAppSDK } from '@contentful/app-sdk';
|
|
3
3
|
import { Asset, ContentType, Entry, Resource, ResourceType, ScheduledAction, Space } from '../types';
|
|
4
4
|
export type ResourceInfo<R extends Resource = Resource> = {
|
|
5
5
|
resource: R;
|
|
@@ -8,7 +8,7 @@ export type ResourceInfo<R extends Resource = Resource> = {
|
|
|
8
8
|
space: Space;
|
|
9
9
|
};
|
|
10
10
|
type EntityStoreProps = {
|
|
11
|
-
sdk:
|
|
11
|
+
sdk: BaseAppSDK;
|
|
12
12
|
queryConcurrency?: number;
|
|
13
13
|
};
|
|
14
14
|
type GetOptions = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FieldConnector } from '@contentful/field-editor-shared';
|
|
3
3
|
import type { LinkActionsProps } from '../components';
|
|
4
|
-
import { Action, ActionLabels,
|
|
4
|
+
import { Action, ActionLabels, FieldAppSDK, ViewType } from '../types';
|
|
5
5
|
import { CustomCardRenderer, RenderCustomMissingEntityCard } from './customCardTypes';
|
|
6
6
|
export interface ReferenceEditorProps {
|
|
7
7
|
/**
|
|
@@ -11,7 +11,7 @@ export interface ReferenceEditorProps {
|
|
|
11
11
|
hasCardEditActions: boolean;
|
|
12
12
|
hasCardMoveActions?: boolean;
|
|
13
13
|
hasCardRemoveActions?: boolean;
|
|
14
|
-
sdk:
|
|
14
|
+
sdk: FieldAppSDK;
|
|
15
15
|
viewType: ViewType;
|
|
16
16
|
renderCustomCard?: CustomCardRenderer;
|
|
17
17
|
renderCustomActions?: (props: CustomActionProps) => React.ReactElement;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ContentType, ContentEntityType,
|
|
1
|
+
import { ContentType, ContentEntityType, FieldAppSDK } from '../types';
|
|
2
2
|
import { ReferenceValidations } from '../utils/fromFieldValidations';
|
|
3
3
|
import { ReferenceEditorProps } from './ReferenceEditor';
|
|
4
4
|
type ContentTypePermissionsProps = {
|
|
5
|
-
sdk:
|
|
5
|
+
sdk: FieldAppSDK;
|
|
6
6
|
entityType: ContentEntityType;
|
|
7
7
|
parameters: ReferenceEditorProps['parameters'];
|
|
8
8
|
allContentTypes: ContentType[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ContentType, ContentEntityType,
|
|
1
|
+
import { ContentType, ContentEntityType, FieldAppSDK } from '../types';
|
|
2
2
|
import { ReferenceEditorProps } from './ReferenceEditor';
|
|
3
3
|
export type EditorPermissionsProps = {
|
|
4
|
-
sdk:
|
|
4
|
+
sdk: FieldAppSDK;
|
|
5
5
|
entityType: ContentEntityType;
|
|
6
6
|
parameters: ReferenceEditorProps['parameters'];
|
|
7
7
|
allContentTypes: ContentType[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { EditorPermissions } from '../../common/useEditorPermissions';
|
|
3
|
-
import { Action, ActionLabels, ContentEntityType,
|
|
3
|
+
import { Action, ActionLabels, ContentEntityType, FieldAppSDK } from '../../types';
|
|
4
4
|
import { LinkActionsProps } from './LinkActions';
|
|
5
5
|
type LinkEntityActionsProps = {
|
|
6
6
|
entityType: ContentEntityType;
|
|
7
7
|
canLinkMultiple: boolean;
|
|
8
|
-
sdk:
|
|
8
|
+
sdk: FieldAppSDK;
|
|
9
9
|
isDisabled: boolean;
|
|
10
10
|
editorPermissions: EditorPermissions;
|
|
11
11
|
onCreate: (id: string, index?: number) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EditorPermissions } from '../../common/useEditorPermissions';
|
|
2
|
-
import { Asset, ContentEntityType, Entry,
|
|
2
|
+
import { Asset, ContentEntityType, Entry, FieldAppSDK } from '../../types';
|
|
3
3
|
export declare function createEntity(props: {
|
|
4
|
-
sdk:
|
|
4
|
+
sdk: FieldAppSDK;
|
|
5
5
|
entityType: ContentEntityType;
|
|
6
6
|
contentTypeId?: string;
|
|
7
7
|
}): Promise<{
|
|
@@ -15,12 +15,12 @@ export declare function createEntity(props: {
|
|
|
15
15
|
slide: import("@contentful/app-sdk/dist/types/navigator.types").NavigatorSlideInfo | undefined;
|
|
16
16
|
}>;
|
|
17
17
|
export declare function selectSingleEntity(props: {
|
|
18
|
-
sdk:
|
|
18
|
+
sdk: FieldAppSDK;
|
|
19
19
|
entityType: ContentEntityType;
|
|
20
20
|
editorPermissions: EditorPermissions;
|
|
21
21
|
}): Promise<Entry | Asset | null>;
|
|
22
22
|
export declare function selectMultipleEntities(props: {
|
|
23
|
-
sdk:
|
|
23
|
+
sdk: FieldAppSDK;
|
|
24
24
|
entityType: ContentEntityType;
|
|
25
25
|
editorPermissions: EditorPermissions;
|
|
26
26
|
}): Promise<Entry[] | Asset[] | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function mockSdkForField(fieldDefinition: any, fieldValue?: any):
|
|
1
|
+
import { FieldAppSDK } from '@contentful/app-sdk';
|
|
2
|
+
export declare function mockSdkForField(fieldDefinition: any, fieldValue?: any): FieldAppSDK;
|
|
3
3
|
type FakeEntryResource = {
|
|
4
4
|
title: string;
|
|
5
5
|
id: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FieldAppSDK } from '@contentful/app-sdk';
|
|
2
2
|
import { EntryProps } from 'contentful-management';
|
|
3
3
|
import { LinkActionsProps } from '../components';
|
|
4
|
-
export declare function useResourceLinkActions({ dialogs, field, onAfterLink, apiUrl, }: Pick<
|
|
4
|
+
export declare function useResourceLinkActions({ dialogs, field, onAfterLink, apiUrl, }: Pick<FieldAppSDK, 'field' | 'dialogs'> & {
|
|
5
5
|
apiUrl: string;
|
|
6
6
|
onAfterLink?: (e: EntryProps) => void;
|
|
7
7
|
}): LinkActionsProps;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
export type {
|
|
4
|
+
export type { BaseAppSDK, FieldAppSDK, ContentType, ContentTypeField, Link, ContentEntityType, NavigatorSlideInfo, ScheduledAction, } from '@contentful/app-sdk';
|
|
5
5
|
export type { SpaceProps as Space } from 'contentful-management';
|
|
6
6
|
export { Entry, File, Asset } from '@contentful/field-editor-shared';
|
|
7
7
|
export type { ResourceInfo } from './common/EntityStore';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-reference",
|
|
3
|
-
"version": "5.16.
|
|
3
|
+
"version": "5.16.3",
|
|
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.0.27",
|
|
39
39
|
"@contentful/f36-icons": "^4.1.0",
|
|
40
40
|
"@contentful/f36-tokens": "^4.0.0",
|
|
41
|
-
"@contentful/field-editor-shared": "^1.4.
|
|
41
|
+
"@contentful/field-editor-shared": "^1.4.2",
|
|
42
42
|
"@contentful/mimetype": "^1.4.0",
|
|
43
43
|
"@tanstack/react-query": "^4.3.9",
|
|
44
44
|
"@types/deep-equal": "^1.0.1",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"type-fest": "2.17.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@contentful/app-sdk": "^4.
|
|
59
|
-
"@contentful/field-editor-test-utils": "^1.4.
|
|
58
|
+
"@contentful/app-sdk": "^4.17.1",
|
|
59
|
+
"@contentful/field-editor-test-utils": "^1.4.3",
|
|
60
60
|
"@testing-library/react-hooks": "^5.0.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@contentful/app-sdk": "^4.
|
|
63
|
+
"@contentful/app-sdk": "^4.17.1",
|
|
64
64
|
"react": ">=16.8.0"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "ef0adb263ad287e6f78888a05727d0f2f4f8968d"
|
|
67
67
|
}
|