Socket
Socket
Sign inDemoInstall

contentful-ui-extensions-sdk

Package Overview
Dependencies
Maintainers
5
Versions
193
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contentful-ui-extensions-sdk - npm Package Compare versions

Comparing version 3.10.0 to 3.10.1

6

package.json
{
"name": "contentful-ui-extensions-sdk",
"description": "SDK to develop custom UI Extension for the Contentful Web App",
"version": "3.10.0",
"version": "3.10.1",
"author": "Contentful GmbH",

@@ -75,2 +75,6 @@ "license": "MIT",

],
"*.ts": [
"prettier --write",
"git add"
],
"*.md": [

@@ -77,0 +81,0 @@ "prettier --write",

490

typings.d.ts
declare module 'contentful-ui-extensions-sdk' {
interface SpaceMembership {
sys: {
id: string;
type: string;
};
admin: boolean;
roles: { name: string; description: string }[];
id: string
type: string
}
admin: boolean
roles: { name: string; description: string }[]
}

@@ -14,49 +13,49 @@

sys: {
id: string;
type: string;
};
firstName: string;
lastName: string;
email: string;
avatarUrl: string;
spaceMembership: SpaceMembership;
id: string
type: string
}
firstName: string
lastName: string
email: string
avatarUrl: string
spaceMembership: SpaceMembership
}
interface Items {
type: string;
linkType?: string;
validations?: Object[];
type: string
linkType?: string
validations?: Object[]
}
/* Field API */
/* Field API */
interface FieldAPI {
interface FieldAPI {
/** The ID of a field is defined in an entry's content type. */
id: string;
id: string
/** The current locale of a field the extension is attached to. */
locale: string;
locale: string
/** Holds the type of the field the extension is attached to. */
type: string;
type: string
/** Indicates if a value for this field is required **/
required: boolean;
required: boolean
/** A list of validations for this field that are defined in the content type. */
validations: Object[];
validations: Object[]
/** Defines the shape of array items **/
items?: Items;
items?: Items
/** Gets the current value of the field and locale. */
getValue: () => any;
getValue: () => any
/** Sets the value for the field and locale. */
setValue: (value: any) => Promise<any>;
setValue: (value: any) => Promise<any>
/** Removes the value for the field and locale. */
removeValue: () => Promise<void>;
removeValue: () => Promise<void>
/** Communicates to the web application if the field is in a valid state or not. */
setInvalid: (value: boolean) => void;
setInvalid: (value: boolean) => void
/** Calls the callback every time the value of the field is changed by an external event or when setValue() is called. */
onValueChanged: (callback: (value: any) => void) => Function;
onValueChanged: (callback: (value: any) => void) => Function
/** Calls the callback when the disabled status of the field changes. */
onIsDisabledChanged: (callback: Function) => Function;
onIsDisabledChanged: (callback: Function) => Function
/** Calls the callback immediately with the current validation errors and whenever the field is re-validated. */
onSchemaErrorsChanged: (callback: Function) => Function;
onSchemaErrorsChanged: (callback: Function) => Function
}

@@ -66,32 +65,31 @@

type onValueChangedType = (callback: (value: any) => void) => Function
type onValueChangeWithLocaleType = (locale: string, callback: (value: any) => void) => Function
type onIsDisabledChangedType = (callback: Function) => Function
type onIsDisabledChangedWithLocaleType = (locale: string, callback: Function) => Function
type onValueChangedType = (callback: (value: any) => void) => Function;
type onValueChangeWithLocaleType = (locale: string, callback: (value: any) => void) => Function;
type onIsDisabledChangedType = (callback: Function) => Function;
type onIsDisabledChangedWithLocaleType = (locale: string, callback: Function) => Function;
interface EntryFieldAPI {
/** The ID of a field is defined in an entry's content type. */
id: string;
id: string
/** The list of locales for the field. */
locales: string[];
/** Holds the type of the field. */
type: string;
locales: string[]
/** Holds the type of the field. */
type: string
/** Indicates if a value for this field is required **/
required: boolean;
required: boolean
/** A list of validations for this field that are defined in the content type. */
validations: Object[];
validations: Object[]
/** Defines the shape of array items **/
items?: Items;
items?: Items
/** Gets the current value of the field and locale. */
getValue: (locale?: string) => any;
getValue: (locale?: string) => any
/** Sets the value for the field and locale. */
setValue: (value: any, locale?: string) => Promise<any>;
setValue: (value: any, locale?: string) => Promise<any>
/** Removes the value for the field and locale. */
removeValue: (locale?: string) => Promise<void>;
removeValue: (locale?: string) => Promise<void>
/** Calls the callback every time the value of the field is changed by an external event or when setValue() is called. */
onValueChanged: onValueChangedType | onValueChangeWithLocaleType;
onValueChanged: onValueChangedType | onValueChangeWithLocaleType
/** Calls the callback when the disabled status of the field changes. */
onIsDisabledChanged: onIsDisabledChangedType | onIsDisabledChangedWithLocaleType;
onIsDisabledChanged: onIsDisabledChangedType | onIsDisabledChangedWithLocaleType
}

@@ -101,5 +99,5 @@

/** Returns metadata for an entry. */
getSys: () => Object;
getSys: () => Object
/** Calls the callback with metadata every time that metadata changes. */
onSysChanged: (callback: (sys: Object) => void) => Function;
onSysChanged: (callback: (sys: Object) => void) => Function
/** Allows to control the values of all other fields in the current entry. */

@@ -112,12 +110,12 @@ fields: { [key: string]: EntryFieldAPI }

interface ContentTypeField {
disabled: boolean;
id: string;
localized: boolean;
name: string;
omitted: boolean;
required: boolean;
type: string;
validations: Object[];
linkType?: string;
items?: Items;
disabled: boolean
id: string
localized: boolean
name: string
omitted: boolean
required: boolean
type: string
validations: Object[]
linkType?: string
items?: Items
}

@@ -127,6 +125,6 @@

sys: {
id: string;
type: string;
linkType: string;
};
id: string
type: string
linkType: string
}
}

@@ -136,36 +134,36 @@

sys: {
type: string;
id: string;
version?: number;
space?: Link;
environment?: Link;
createdAt?: string;
createdBy?: Link;
updatedAt?: string;
updatedBy?: Link;
};
fields: { [key: string]: ContentTypeField };
name: string;
displayField: string;
description: string;
type: string
id: string
version?: number
space?: Link
environment?: Link
createdAt?: string
createdBy?: Link
updatedAt?: string
updatedBy?: Link
}
fields: { [key: string]: ContentTypeField }
name: string
displayField: string
description: string
}
interface EditorInterface {
sys: Object;
sys: Object
controls?: Array<{
fieldId: string;
widgetId?: string;
widgetNamespace?: string;
settings?: Object;
}>;
fieldId: string
widgetId?: string
widgetNamespace?: string
settings?: Object
}>
sidebar?: Array<{
widgetId: string;
widgetNamespace: string;
settings?: Object;
disabled?: boolean;
}>;
widgetId: string
widgetNamespace: string
settings?: Object
disabled?: boolean
}>
editor?: {
widgetId: string;
widgetNamespace: string;
settings?: Object;
widgetId: string
widgetNamespace: string
settings?: Object
}

@@ -177,13 +175,13 @@ }

interface SearchQuery {
order?: string;
skip?: number;
limit?: number;
[key: string]: any;
order?: string
skip?: number
limit?: number
[key: string]: any
}
type CollectionResponse<T> = {
items: T[];
total: number;
skip: number;
limit: number;
items: T[]
total: number
skip: number
limit: number
sys: { type: string }

@@ -193,36 +191,36 @@ }

interface SpaceAPI {
getContentType: (id: string) => Promise<Object>;
getContentTypes: () => Promise<CollectionResponse<Object>>;
createContentType: (data: any) => Promise<Object>;
updateContentType: (data: any) => Promise<Object>;
deleteContentType: (data: any) => Promise<Object>;
getContentType: (id: string) => Promise<Object>
getContentTypes: () => Promise<CollectionResponse<Object>>
createContentType: (data: any) => Promise<Object>
updateContentType: (data: any) => Promise<Object>
deleteContentType: (data: any) => Promise<Object>
getEntry: (id: string) => Promise<Object>;
getEntrySnapshots: (id: string) => Promise<any>;
getEntries: (query?: SearchQuery) => Promise<CollectionResponse<Object>>;
createEntry: (contentTypeId: string, data: any) => Promise<Object>;
updateEntry: (data: any) => Promise<Object>;
publishEntry: (data: any) => Promise<Object>;
unpublishEntry: (data: any) => Promise<Object>;
archiveEntry: (data: any) => Promise<Object>;
unarchiveEntry: (data: any) => Promise<Object>;
deleteEntry: (data: any) => Promise<Object>;
getPublishedEntries: (query?: SearchQuery) => Promise<CollectionResponse<Object>>;
getEntry: (id: string) => Promise<Object>
getEntrySnapshots: (id: string) => Promise<any>
getEntries: (query?: SearchQuery) => Promise<CollectionResponse<Object>>
createEntry: (contentTypeId: string, data: any) => Promise<Object>
updateEntry: (data: any) => Promise<Object>
publishEntry: (data: any) => Promise<Object>
unpublishEntry: (data: any) => Promise<Object>
archiveEntry: (data: any) => Promise<Object>
unarchiveEntry: (data: any) => Promise<Object>
deleteEntry: (data: any) => Promise<Object>
getPublishedEntries: (query?: SearchQuery) => Promise<CollectionResponse<Object>>
getAsset: (id: string) => Promise<Object>;
getAssets: (query?: SearchQuery) => Promise<CollectionResponse<Object>>;
createAsset: (data: any) => Promise<Object>;
updateAsset: (data: any) => Promise<Object>;
deleteAsset: (data: any) => Promise<Object>;
publishAsset: (data: any) => Promise<Object>;
unpublishAsset: (data: any) => Promise<Object>;
archiveAsset: (data: any) => Promise<Object>;
processAsset: (data: any, locale: string) => Promise<Object>;
unarchiveAsset: (data: any) => Promise<Object>;
getPublishedAssets: (query?: SearchQuery) => Promise<CollectionResponse<Object>>;
createUpload: (base64data: string) => void;
waitUntilAssetProcessed: (assetId: string, locale: string) => void;
getAsset: (id: string) => Promise<Object>
getAssets: (query?: SearchQuery) => Promise<CollectionResponse<Object>>
createAsset: (data: any) => Promise<Object>
updateAsset: (data: any) => Promise<Object>
deleteAsset: (data: any) => Promise<Object>
publishAsset: (data: any) => Promise<Object>
unpublishAsset: (data: any) => Promise<Object>
archiveAsset: (data: any) => Promise<Object>
processAsset: (data: any, locale: string) => Promise<Object>
unarchiveAsset: (data: any) => Promise<Object>
getPublishedAssets: (query?: SearchQuery) => Promise<CollectionResponse<Object>>
createUpload: (base64data: string) => void
waitUntilAssetProcessed: (assetId: string, locale: string) => void
/** Returns all users who belong to the space. */
getUsers: () => Promise<CollectionResponse<Object>>,
getUsers: () => Promise<CollectionResponse<Object>>

@@ -232,3 +230,3 @@ /** Returns editor interface for a given content type */

/** Returns editor interfaces for a given environment */
getEditorInterfaces: () => Promise<CollectionResponse<Object>>;
getEditorInterfaces: () => Promise<CollectionResponse<Object>>
}

@@ -240,7 +238,7 @@

/** The default locale code for the current space. */
default: string;
default: string
/** A list of locale codes of all locales available for editing in the current space. */
available: string[];
available: string[]
/** An object with keys of locale codes and values of corresponding human-readable locale names. */
names: { [key:string]: string }
names: { [key: string]: string }
}

@@ -252,7 +250,7 @@

/** Sets the iframe height to the given value in pixels or using scrollHeight if value is not passed */
updateHeight: (height?: number) => void;
updateHeight: (height?: number) => void
/** Listens for DOM changes and updates height when the size changes. */
startAutoResizer: () => void;
startAutoResizer: () => void
/** Stops resizing the iframe automatically. */
stopAutoResizer: () => void;
stopAutoResizer: () => void
}

@@ -263,11 +261,11 @@

interface OpenAlertOptions {
title: string;
message: string;
confirmLabel?: string;
shouldCloseOnEscapePress?: boolean;
shouldCloseOnOverlayClick?: boolean;
title: string
message: string
confirmLabel?: string
shouldCloseOnEscapePress?: boolean
shouldCloseOnOverlayClick?: boolean
}
type OpenConfirmOptions = OpenAlertOptions & {
cancelLabel?: string;
cancelLabel?: string
intent?: 'primary' | 'positive' | 'negative'

@@ -277,9 +275,11 @@ }

interface OpenExtensionOptions {
id?: string;
width?: number;
position?: 'center' | 'top';
title?: string;
shouldCloseOnOverlayClick?: boolean;
shouldCloseOnEscapePress?: boolean;
parameters?: Object;
id?: string
width?: number | 'small' | 'medium' | 'large' | 'fullWidth'
minHeight?: number | string
allowHeightOverflow?: boolean
position?: 'center' | 'top'
title?: string
shouldCloseOnOverlayClick?: boolean
shouldCloseOnEscapePress?: boolean
parameters?: Object
}

@@ -289,33 +289,33 @@

/** Opens a simple alert window (which can only be closed). */
openAlert: (options: OpenAlertOptions) => Promise<boolean>;
openAlert: (options: OpenAlertOptions) => Promise<boolean>
/** Opens a confirmation window. A user can either confirm or cancel the dialog. */
openConfirm: (options: OpenConfirmOptions) => Promise<boolean>;
openConfirm: (options: OpenConfirmOptions) => Promise<boolean>
/** Opens a prompt window. A user can either provide a string input or cancel the dialog. */
openPrompt: (options: OpenConfirmOptions & {
defaultValue?: string;
}) => Promise<string | boolean>;
openPrompt: (
options: OpenConfirmOptions & {
defaultValue?: string
}
) => Promise<string | boolean>
/** Opens an extension in a dialog. */
openExtension: (options: OpenExtensionOptions) => Promise<any>;
openExtension: (options: OpenExtensionOptions) => Promise<any>
/** Opens a dialog for selecting a single entry. */
selectSingleEntry: (options?: {
locale?: string;
contentTypes?: string[];
}) => Promise<Object | null>;
locale?: string
contentTypes?: string[]
}) => Promise<Object | null>
/** Opens a dialog for selecting multiple entries. */
selectMultipleEntries: (options?: {
locale?: string;
contentTypes?: string[];
min?: number;
max?: number;
}) => Promise<Object[] | null>;
locale?: string
contentTypes?: string[]
min?: number
max?: number
}) => Promise<Object[] | null>
/** Opens a dialog for selecting a single asset. */
selectSingleAsset: (options?: {
locale?: string;
}) => Promise<Object | null>;
selectSingleAsset: (options?: { locale?: string }) => Promise<Object | null>
/** Opens a dialog for selecting multiple assets. */
selectMultipleAssets: (options?: {
locale?: string;
min?: number;
max?: number;
}) => Promise<Object[] | null>;
locale?: string
min?: number
max?: number
}) => Promise<Object[] | null>
}

@@ -326,3 +326,3 @@

interface NavigatorAPIOptions {
slideIn?: boolean;
slideIn?: boolean
}

@@ -332,5 +332,5 @@

/** If included, you can navigate to a different page extension. If omitted, you will navigate within the current extension. */
id?: string;
id?: string
/** Navigate to a path withing your page extension. */
path?: string;
path?: string
}

@@ -340,11 +340,11 @@

/** Opens an existing entry in the current Web App session. */
openEntry: (entryId: string, options?: NavigatorAPIOptions) => Promise<void>;
openEntry: (entryId: string, options?: NavigatorAPIOptions) => Promise<void>
/** Opens an existing asset in the current Web App session. */
openAsset: (assetId: string, options?: NavigatorAPIOptions) => Promise<void>;
openAsset: (assetId: string, options?: NavigatorAPIOptions) => Promise<void>
/** Opens a new entry in the current Web App session. */
openNewEntry: (contentTypeId: string, options?: NavigatorAPIOptions) => Promise<void>;
openNewEntry: (contentTypeId: string, options?: NavigatorAPIOptions) => Promise<void>
/** Opens a new asset in the current Web App session. */
openNewAsset: (options: NavigatorAPIOptions) => Promise<void>;
openNewAsset: (options: NavigatorAPIOptions) => Promise<void>
/** Navigates to a page extension in the current Web App session. Calling without `options` will navigate to the home route of your page extension. */
openPageExtension: (options?: PageExtensionOptions) => Promise<void>;
openPageExtension: (options?: PageExtensionOptions) => Promise<void>
}

@@ -356,5 +356,5 @@

/** Displays a success notification in the notification area of the Web App. */
success: (message: string) => void;
success: (message: string) => void
/** Displays an error notification in the notification area of the Web App. */
error: (message: string) => void;
error: (message: string) => void
}

@@ -366,3 +366,3 @@

/** Checks the location in which your extension is running */
is: (type: string) => boolean;
is: (type: string) => boolean
}

@@ -373,5 +373,5 @@

interface ParametersAPI {
installation: Object;
instance: Object;
invocation?: Object;
installation: Object
instance: Object
invocation?: Object
}

@@ -382,9 +382,9 @@

interface IdsAPI {
user: string;
extension: string;
space: string;
environment: string;
field: string;
entry: string;
contentType: string;
user: string
extension: string
space: string
environment: string
field: string
entry: string
contentType: string
}

@@ -394,5 +394,11 @@

editor: {
editorInterface: EditorInterface,
onLocaleSettingsChanged: (callback: (value: { mode: 'multi' | 'single', focused?: string, active?: Array<string>} ) => any) => Function;
onShowDisabledFieldsChanged: (callback: (value: boolean) => any) => Function;
editorInterface: EditorInterface
onLocaleSettingsChanged: (
callback: (value: {
mode: 'multi' | 'single'
focused?: string
active?: Array<string>
}) => any
) => Function
onShowDisabledFieldsChanged: (callback: (value: boolean) => any) => Function
}

@@ -403,51 +409,54 @@ }

/** Allows to read and update the value of any field of the current entry and to get the entry's metadata */
entry: EntryAPI;
entry: EntryAPI
/** Information about the content type of the entry. */
contentType: ContentType;
contentType: ContentType
/** Exposes methods that allow the extension to read and manipulate a wide range of objects in the space. */
space: SpaceAPI;
space: SpaceAPI
/** Information about the current user and roles */
user: User;
user: User
/** Information about the current locales */
locales: LocalesAPI;
locales: LocalesAPI
/** Methods for opening UI dialogs: */
dialogs: DialogsAPI;
dialogs: DialogsAPI
/** Methods for navigating between entities stored in a Contentful space. */
navigator: NavigatorAPI;
navigator: NavigatorAPI
/** Methods for displaying notifications. */
notifier: NotifierAPI;
notifier: NotifierAPI
/** Exposes extension configuration parameters */
parameters: ParametersAPI;
parameters: ParametersAPI
/** Exposes method to identify extension's location */
location: LocationAPI;
location: LocationAPI
}
export type EditorExtensionSDK = BaseExtensionSDK & SharedEditorSDK & {
/** A set of IDs actual for the extension */
ids: Pick<IdsAPI, 'entry' | 'contentType' | 'environment' | 'space' | 'extension' | 'user'>;
};
export type EditorExtensionSDK = BaseExtensionSDK &
SharedEditorSDK & {
/** A set of IDs actual for the extension */
ids: Pick<IdsAPI, 'entry' | 'contentType' | 'environment' | 'space' | 'extension' | 'user'>
}
export type SidebarExtensionSDK = BaseExtensionSDK & SharedEditorSDK & {
/** A set of IDs actual for the extension */
ids: Pick<IdsAPI, 'entry' | 'contentType' | 'environment' | 'space' | 'extension' | 'user'>;
/** Methods to update the size of the iframe the extension is contained within. */
window: WindowAPI;
};
export type SidebarExtensionSDK = BaseExtensionSDK &
SharedEditorSDK & {
/** A set of IDs actual for the extension */
ids: Pick<IdsAPI, 'entry' | 'contentType' | 'environment' | 'space' | 'extension' | 'user'>
/** Methods to update the size of the iframe the extension is contained within. */
window: WindowAPI
}
export type FieldExtensionSDK = BaseExtensionSDK & SharedEditorSDK & {
/** A set of IDs actual for the extension */
ids: IdsAPI;
/** Gives you access to the value and metadata of the field the extension is attached to. */
field: FieldAPI;
/** Methods to update the size of the iframe the extension is contained within. */
window: WindowAPI;
}
export type FieldExtensionSDK = BaseExtensionSDK &
SharedEditorSDK & {
/** A set of IDs actual for the extension */
ids: IdsAPI
/** Gives you access to the value and metadata of the field the extension is attached to. */
field: FieldAPI
/** Methods to update the size of the iframe the extension is contained within. */
window: WindowAPI
}
export type DialogExtensionSDK = BaseExtensionSDK & {
/** A set of IDs actual for the extension */
ids: Pick<IdsAPI, 'environment' | 'space' | 'extension' | 'user'>;
ids: Pick<IdsAPI, 'environment' | 'space' | 'extension' | 'user'>
/** Closes the dialog and resolves openExtension promise with data */
close: (data: any) => void
/** Methods to update the size of the iframe the extension is contained within. */
window: WindowAPI;
window: WindowAPI
}

@@ -457,3 +466,3 @@

/** A set of IDs actual for the extension */
ids: Pick<IdsAPI, 'environment' | 'space' | 'extension' | 'user'>;
ids: Pick<IdsAPI, 'environment' | 'space' | 'extension' | 'user'>
}

@@ -463,3 +472,3 @@

/** A set of IDs actual for the extension */
ids: Pick<IdsAPI, 'environment' | 'space' | 'user'>;
ids: Pick<IdsAPI, 'environment' | 'space' | 'user'>
/** Apps Platform __ALPHA__ methods: subject to change **/

@@ -483,14 +492,21 @@ platformAlpha: {

export const init: (initCallback: (sdk: FieldExtensionSDK | SidebarExtensionSDK | DialogExtensionSDK | EditorExtensionSDK | PageExtensionSDK | AppExtensionSDK) => any) => void;
export type KnownSDK =
| FieldExtensionSDK
| SidebarExtensionSDK
| DialogExtensionSDK
| EditorExtensionSDK
| PageExtensionSDK
| AppExtensionSDK
export const init: <T extends KnownSDK = KnownSDK>(initCallback: (sdk: T) => any) => void
export const locations: {
LOCATION_ENTRY_FIELD: string;
LOCATION_ENTRY_FIELD_SIDEBAR: string;
LOCATION_ENTRY_SIDEBAR: string;
LOCATION_DIALOG: string;
LOCATION_ENTRY_EDITOR: string;
LOCATION_PAGE: string;
LOCATION_APP: string;
LOCATION_ENTRY_FIELD: string
LOCATION_ENTRY_FIELD_SIDEBAR: string
LOCATION_ENTRY_SIDEBAR: string
LOCATION_DIALOG: string
LOCATION_ENTRY_EDITOR: string
LOCATION_PAGE: string
LOCATION_APP: string
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc