contentful-ui-extensions-sdk
Advanced tools
Comparing version 3.7.1 to 3.7.2
@@ -22,3 +22,3 @@ parcelRequire=function(e,r,n,t){var i="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function u(n,t){if(!r[n]){if(!e[n]){var f="function"==typeof parcelRequire&&parcelRequire;if(!t&&f)return f(n,!0);if(i)return i(n,!0);if(o&&"string"==typeof n)return o(n);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[n][1][r]||r},p.cache={};var l=r[n]=new u.Module(n);e[n][0].call(l.exports,p,l,l.exports,this)}return r[n].exports;function p(e){return u(p.resolve(e))}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=r,u.parent=i,u.register=function(r,n){e[r]=[function(e,r){r.exports=n},{}]};for(var f=0;f<n.length;f++)u(n[f]);if(n.length){var c=u(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):t&&(this[t]=c)}return u}({"pBGv":[function(require,module,exports) { | ||
},{}],"97BZ":[function(require,module,exports) { | ||
var n=require("./signal"),t=n.MemoizedSignal;module.exports=function(n,e,i,r){var a=e.sys,d=new t(a);n.addHandler("sysChanged",function(n){a=n,d.dispatch(a)});var u=!1,c=new t(u);return n.addHandler("editorActivityChanged",function(n){u=n,c.dispatch(u)}),{getSys:function(){return a},onSysChanged:function(n){return d.attach(n)},onEditorActivityChanged:function(n){return c.attach(n)},fields:i.reduce(function(n,t){return n[t.id]=r(t),n},{})}}; | ||
var n=require("./signal"),e=n.MemoizedSignal;module.exports=function(n,r,t,i){var u=r.sys,a=new e(u);return n.addHandler("sysChanged",function(n){u=n,a.dispatch(u)}),{getSys:function(){return u},onSysChanged:function(n){return a.attach(n)},fields:t.reduce(function(n,e){return n[e.id]=i(e),n},{})}}; | ||
},{"./signal":"HrMX"}],"iabO":[function(require,module,exports) { | ||
@@ -36,3 +36,2 @@ var e=["getContentType","getEntry","getEntrySnapshots","getAsset","getPublishedEntries","getPublishedAssets","getContentTypes","getEntries","getAssets","createContentType","createEntry","createAsset","updateContentType","updateEntry","updateAsset","deleteContentType","deleteEntry","deleteAsset","publishEntry","publishAsset","unpublishEntry","unpublishAsset","archiveEntry","archiveAsset","unarchiveEntry","unarchiveAsset","createUpload","processAsset","waitUntilAssetProcessed","getUsers"];module.exports=function(t){var s={};return e.forEach(function(e){s[e]=function(){for(var s=arguments.length,n=new Array(s),r=0;r<s;r++)n[r]=arguments[r];return t.call("callSpaceMethod",e,n)}}),s}; | ||
var i=require("./initialize"),e=require("./api"),r=require("./locations");module.exports={init:i(window,e),locations:r}; | ||
},{"./initialize":"Mq5l","./api":"LVu9","./locations":"CHnp"}]},{},["Focm"], "contentfulExtension") | ||
//# sourceMappingURL=/cf-extension-api.map | ||
},{"./initialize":"Mq5l","./api":"LVu9","./locations":"CHnp"}]},{},["Focm"], "contentfulExtension") |
@@ -12,10 +12,2 @@ const { MemoizedSignal } = require('./signal') | ||
let active = false | ||
const activityChanged = new MemoizedSignal(active) | ||
channel.addHandler('editorActivityChanged', (_active) => { | ||
active = _active | ||
activityChanged.dispatch(active) | ||
}) | ||
return { | ||
@@ -28,5 +20,2 @@ getSys () { | ||
}, | ||
onEditorActivityChanged (handler) { | ||
return activityChanged.attach(handler) | ||
}, | ||
fields: fieldInfo.reduce((acc, info) => { | ||
@@ -33,0 +22,0 @@ acc[info.id] = createEntryField(info) |
{ | ||
"name": "contentful-ui-extensions-sdk", | ||
"description": "SDK to develop custom UI Extension for the Contentful Web App", | ||
"version": "3.7.1", | ||
"version": "3.7.2", | ||
"author": "Contentful GmbH", | ||
@@ -11,3 +11,2 @@ "license": "MIT", | ||
"dist/cf-extension-api.js", | ||
"dist/cf-extension-api.map", | ||
"dist/cf-extension.css", | ||
@@ -20,3 +19,3 @@ "lib/**/*.js", | ||
"lint": "eslint --fix lib/ test/", | ||
"build": "parcel build lib/index.js --out-file cf-extension-api.js --global contentfulExtension", | ||
"build": "parcel build lib/index.js --no-source-maps --out-file cf-extension-api.js --global contentfulExtension", | ||
"prepublishOnly": "npm run build", | ||
@@ -23,0 +22,0 @@ "size": "echo \"Gzipped, estimate: $(gzip -9 -c dist/cf-extension-api.js | wc -c) bytes\"" |
@@ -27,15 +27,25 @@ declare module 'contentful-ui-extensions-sdk' { | ||
interface FieldAPI { | ||
/** The ID of a field is defined in an entry's content type. */ | ||
id: string; | ||
/** The current locale of a field the extension is attached to. */ | ||
locale: string; | ||
/** Holds the type of the field the extension is attached to. */ | ||
type: string; | ||
/** A list of validations for this field that are defined in the content type. */ | ||
validations: Object[]; | ||
/** Gets the current value of the field and locale. */ | ||
getValue: () => any; | ||
/** Sets the value for the field and locale. */ | ||
setValue: (value: any) => Promise<any>; | ||
/** Removes the value for the field and locale. */ | ||
removeValue: () => Promise<void>; | ||
/** Communicates to the web application if the field is in a valid state or not. */ | ||
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; | ||
/** Calls the callback when the disabled status of the field changes. */ | ||
onIsDisabledChanged: (callback: Function) => Function; | ||
/** Calls the callback immediately with the current validation errors and whenever the field is re-validated. */ | ||
onSchemaErrorsChanged: (callback: Function) => Function; | ||
@@ -53,11 +63,20 @@ } | ||
interface EntryFieldAPI { | ||
/** The ID of a field is defined in an entry's content type. */ | ||
id: string; | ||
/** The list of locales for the field. */ | ||
locales: string[]; | ||
/** Holds the type of the field. */ | ||
type: string; | ||
/** A list of validations for this field that are defined in the content type. */ | ||
validations: Object[]; | ||
/** Gets the current value of the field and locale. */ | ||
getValue: (locale?: string) => any; | ||
/** Sets the value for the field and locale. */ | ||
setValue: (value: any, locale?: string) => Promise<any>; | ||
/** Removes the value for the field and locale. */ | ||
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; | ||
/** Calls the callback when the disabled status of the field changes. */ | ||
onIsDisabledChanged: onIsDisabledChangedType | onIsDisabledChangedWithLocaleType; | ||
@@ -67,4 +86,7 @@ } | ||
interface EntryAPI { | ||
/** Returns metadata for an entry. */ | ||
getSys: () => Object; | ||
/** Calls the callback with metadata every time that metadata changes. */ | ||
onSysChanged: (callback: (sys: Object) => void) => Function; | ||
/** Allows to control the values of all other fields in the current entry. */ | ||
fields: { [key: string]: EntryFieldAPI } | ||
@@ -164,2 +186,3 @@ } | ||
/** Returns all users who belong to the space. */ | ||
getUsers: () => Promise<CollectionReponse<Object>> | ||
@@ -171,4 +194,7 @@ } | ||
interface LocalesAPI { | ||
/** The default locale code for the current space. */ | ||
default: string; | ||
/** A list of locale codes of all locales available for editing in the current space. */ | ||
available: string[]; | ||
/** An object with keys of locale codes and values of corresponding human-readable locale names. */ | ||
names: { [key:string]: string } | ||
@@ -180,4 +206,7 @@ } | ||
interface WindowAPI { | ||
/** Sets the iframe height to the given value in pixels or using scrollHeight if value is not passed */ | ||
updateHeight: (height?: number) => void; | ||
/** Listens for DOM changes and updates height when the size changes. */ | ||
startAutoResizer: () => void; | ||
/** Stops resizing the iframe automatically. */ | ||
stopAutoResizer: () => void; | ||
@@ -212,13 +241,13 @@ } | ||
interface DialogsAPI { | ||
/** Opens a simple alert window (which can only be closed). */ | ||
openAlert: (options: OpenAlertOptions) => Promise<boolean>; | ||
/** Opens a confirmation window. A user can either confirm or cancel the dialog. */ | ||
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>; | ||
/** Opens an extension in a dialog. */ | ||
openExtension: (options: OpenExtensionOptions) => Promise<any>; | ||
/** Opens a dialog for selecting a single entry. */ | ||
selectSingleEntry: (options?: { | ||
@@ -228,3 +257,3 @@ locale?: string; | ||
}) => Promise<Object | null>; | ||
/** Opens a dialog for selecting multiple entries. */ | ||
selectMultipleEntries: (options?: { | ||
@@ -236,7 +265,7 @@ locale?: string; | ||
}) => Promise<Object[] | null>; | ||
/** Opens a dialog for selecting a single asset. */ | ||
selectSingleAsset: (options?: { | ||
locale?: string; | ||
}) => Promise<Object | null>; | ||
/** Opens a dialog for selecting multiple assets. */ | ||
selectMultipleAssets: (options?: { | ||
@@ -256,5 +285,9 @@ locale?: string; | ||
interface NavigatorAPI { | ||
/** Opens an existing entry in the current Web App session. */ | ||
openEntry: (entryId: string, options?: NavigatorAPIOptions) => Promise<void>; | ||
/** Opens an existing asset in the current Web App session. */ | ||
openAsset: (assetId: string, options?: NavigatorAPIOptions) => Promise<void>; | ||
/** Opens a new entry in the current Web App session. */ | ||
openNewEntry: (contentTypeId: string, options?: NavigatorAPIOptions) => Promise<void>; | ||
/** Opens a new asset in the current Web App session. */ | ||
openNewAsset: (options: NavigatorAPIOptions) => Promise<void>; | ||
@@ -266,3 +299,5 @@ } | ||
interface NotifierAPI { | ||
/** Displays a success notification in the notification area of the Web App. */ | ||
success: (message: string) => void; | ||
/** Displays an error notification in the notification area of the Web App. */ | ||
error: (message: string) => void; | ||
@@ -274,2 +309,3 @@ } | ||
interface LocationAPI { | ||
/** Checks the location in which your extension is running */ | ||
is: (type: string) => boolean; | ||
@@ -286,13 +322,22 @@ } | ||
export interface ExtensionSDK { | ||
field?: FieldAPI; | ||
export interface BaseExtensionSDK { | ||
/** Allows to read and update the value of any field of the current entry and to get the entry's metadata */ | ||
entry: EntryAPI; | ||
/** Information about the content type of the entry. */ | ||
contentType: ContentType; | ||
/** Exposes methods that allow the extension to read and manipulate a wide range of objects in the space. */ | ||
space: SpaceAPI; | ||
/** Information about the current user and roles */ | ||
user: User; | ||
/** Information about the current locales */ | ||
locales: LocalesAPI; | ||
user: User; | ||
/** Methods to update the size of the iframe the extension is contained within. */ | ||
window: WindowAPI; | ||
/** Methods for opening UI dialogs: */ | ||
dialogs: DialogsAPI; | ||
/** Methods for navigating between entities stored in a Contentful space. */ | ||
navigator: NavigatorAPI; | ||
/** Methods for displaying notifications. */ | ||
notifier: NotifierAPI; | ||
/** Exposes extension configuration parameters */ | ||
parameters: ParametersAPI; | ||
@@ -302,5 +347,16 @@ location: LocationAPI; | ||
type InitCallback = (sdk: ExtensionSDK) => void; | ||
export type SidebarExtensionSDK = BaseExtensionSDK; | ||
export const init: (initCallback: InitCallback) => void; | ||
export type FieldExtensionSDK = BaseExtensionSDK & { | ||
/** Gives you access to the value and metadata of the field the extension is attached to. */ | ||
field: FieldAPI | ||
} | ||
export type DialogExtensionSDK = BaseExtensionSDK & { | ||
/** Closes the dialog and resolves openExtension promise with data */ | ||
close: (data: any) => void | ||
} | ||
export const init: (initCallback: (sdk: BaseExtensionSDK | FieldExtensionSDK | SidebarExtensionSDK | DialogExtensionSDK) => any) => void; | ||
export const locations: { | ||
@@ -307,0 +363,0 @@ LOCATION_ENTRY_FIELD: string; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1510
72275
20