contentful-ui-extensions-sdk 4.4.1 → 4.6.0-alpha.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/dist/cf-extension-api.js +1 -1
- package/dist/entry-list.d.ts +3 -0
- package/dist/types/api.types.d.ts +11 -3
- package/dist/types/entities.d.ts +1 -1
- package/dist/types/entry-list.types.d.ts +16 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/window.types.d.ts +11 -2
- package/dist/window.d.ts +1 -1
- package/package.json +1 -1
package/dist/cf-extension-api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).contentfulExtension={})}(this,(function(e){"use strict";var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,n)};var n,r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var o=function(){function e(){this._id=0,this._listeners={}}return e.prototype.dispatch=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r in this._listeners)(e=this._listeners)[r].apply(e,t)},e.prototype.attach=function(e){var t=this;if("function"!=typeof e)throw new Error("listener function expected");var n=this._id++;return this._listeners[n]=e,function(){return delete t._listeners[n]}},e}(),i="__private__memoized__arguments__",a=function(e){function r(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var o=e.call(this)||this;if(o[n]=[],!t.length)throw new Error("Initial value to be memoized expected");return o[i]=t,o}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(r,e),r.prototype.dispatch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this[i]=t,e.prototype.dispatch.apply(this,t)},r.prototype.attach=function(t){var n=e.prototype.attach.call(this,t);return t.apply(void 0,this[i]),n},r}(o);n=i;var s=function(){function e(e,t){var n=this;this._messageHandlers={},this._responseHandlers={},this._send=function(e,t){var n=0;return function(r,o){var i=n++;try{t.postMessage({source:e,id:i,method:r,params:o},"*")}catch(e){throw e instanceof DOMException&&"DataCloneError"===e.name&&"openDialog"===r&&console.error("Error: openCurrent[App] parameters could not be parsed. You likely tried to pass functions or DOM elements as a parameter. Tip: Use the App SDK directly within the dialog location.\n\nLearn more about the dialog location: https://ctfl.io/app-sdk-dialog"),e}return i}}(e,t.parent),t.addEventListener("message",(function(e){n._handleMessage(e.data)}))}return e.prototype.call=function(e){for(var t=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this._send(e,n);return new Promise((function(e,n){t._responseHandlers[o]={resolve:e,reject:n}}))},e.prototype.send=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this._send(e,t)},e.prototype.addHandler=function(e,t){return e in this._messageHandlers||(this._messageHandlers[e]=new o),this._messageHandlers[e].attach(t)},e.prototype._handleMessage=function(e){if(e.method){var t=e.method,n=e.params,r=this._messageHandlers[t];r&&r.dispatch.apply(r,n)}else{var o=e.id,i=this._responseHandlers[o];if(!i)return;"result"in e?i.resolve(e.result):"error"in e&&i.reject(e.error),delete this._responseHandlers[o]}},e}();var l=function(){function e(e,t){var n=this;this.id=t.id,this.locale=t.locale,this.type=t.type,this.required=t.required,this.validations=t.validations,this.items=t.items,this._value=t.value,this._valueSignal=new a(this._value),this._isDisabledSignal=new a(void 0),this._schemaErrorsChangedSignal=new a(void 0),this._channel=e,e.addHandler("valueChanged",(function(e,t,r){e!==n.id||t&&t!==n.locale||(n._value=r,n._valueSignal.dispatch(r))})),e.addHandler("isDisabledChangedForFieldLocale",(function(e,t,r){e===n.id&&t===n.locale&&n._isDisabledSignal.dispatch(r)})),e.addHandler("schemaErrorsChangedForFieldLocale",(function(e,t,r){e===n.id&&t===n.locale&&n._schemaErrorsChangedSignal.dispatch(r)}))}return e.prototype.getValue=function(){return this._value},e.prototype.setValue=function(e){return this._value=e,this._valueSignal.dispatch(e),this._channel.call("setValue",this.id,this.locale,e)},e.prototype.removeValue=function(){return this._value=void 0,this._channel.call("removeValue",this.id,this.locale)},e.prototype.setInvalid=function(e){return this._channel.call("setInvalid",e,this.locale)},e.prototype.onValueChanged=function(e){return this._valueSignal.attach(e)},e.prototype.onIsDisabledChanged=function(e){return this._isDisabledSignal.attach(e)},e.prototype.onSchemaErrorsChanged=function(e){return this._schemaErrorsChangedSignal.attach(e)},e}(),u=function(){function e(e,t,n){this.id=t.id,this.locales=t.locales,this.type=t.type,this.required=t.required,this.validations=t.validations,this.items=t.items,this._defaultLocale=n,this._fieldLocales=t.locales.reduce((function(n,o){var i,a=new l(e,{id:t.id,type:t.type,required:t.required,validations:t.validations,items:t.items,locale:o,value:t.values[o]});return r(r({},n),((i={})[o]=a,i))}),{}),this.assertHasLocale(n)}return e.prototype.getValue=function(e){return this._getFieldLocale(e).getValue()},e.prototype.setValue=function(e,t){return this._getFieldLocale(t).setValue(e)},e.prototype.removeValue=function(e){return this.setValue(void 0,e)},e.prototype.onValueChanged=function(e,t){var n=t||e;return t||(e=""),this._getFieldLocale(e).onValueChanged(n)},e.prototype.onIsDisabledChanged=function(e,t){var n=t||e;return t||(e=""),this._getFieldLocale(e).onIsDisabledChanged(n)},e.prototype._getFieldLocale=function(e){return e=e||this._defaultLocale,this.assertHasLocale(e),this._fieldLocales[e]},e.prototype.getForLocale=function(e){if(!e)throw new Error("getForLocale must be passed a locale");return this._getFieldLocale(e)},e.prototype.assertHasLocale=function(e){if(!this._fieldLocales[e])throw new Error('Unknown locale "'.concat(e,'" for field "').concat(this.id,'"'))},e}();function c(e,t){var n,r=e,o=r.document,i=r.MutationObserver,a=r.ResizeObserver,s=function(){d.updateHeight()},l=new i(s),u=new a(s),c=!1,d={startAutoResizer:function(){if(d.updateHeight(),c)return;c=!0,l.observe(o.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),u.observe(o.body)},stopAutoResizer:function(){if(!c)return;c=!1,l.disconnect(),u.disconnect()},updateHeight:function(e){void 0===e&&(e=null);null===e&&(e=Math.ceil(o.documentElement.getBoundingClientRect().height));e!==n&&(t.send("setHeight",e),n=e)}};return d}var d=["getTask","getTasks","createTask","updateTask","deleteTask"];function p(e,t,n,o){var i=t.sys,s=new a(i),l=t.metadata,u=new a(l);e.addHandler("sysChanged",(function(e){i=e,s.dispatch(i)})),e.addHandler("metadataChanged",(function(e){l=e,u.dispatch(l)}));var c={};return d.forEach((function(t){c[t]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e.call("callEntryMethod",t,n)}})),r(r(r({getSys:function(){return i},publish:function(){return e.call("callEntryMethod","publish")},unpublish:function(){return e.call("callEntryMethod","unpublish")},save:function(){return e.call("callEntryMethod","save")},onSysChanged:function(e){return s.attach(e)},fields:n.reduce((function(e,t){return e[t.id]=o(t),e}),{})},l?{metadata:l}:{}),{getMetadata:function(){return l},onMetadataChanged:function(e){return u.attach(e)}}),c)}var f=["getContentType","getEntry","getEntrySnapshots","getAsset","getEditorInterface","getPublishedEntries","getPublishedAssets","getContentTypes","getEntries","getEditorInterfaces","getAssets","createContentType","createEntry","createAsset","updateContentType","updateEntry","updateAsset","deleteContentType","deleteEntry","deleteAsset","publishEntry","publishAsset","unpublishEntry","unpublishAsset","archiveEntry","archiveAsset","unarchiveEntry","unarchiveAsset","createUpload","processAsset","waitUntilAssetProcessed","getUsers","getAllScheduledActions","getEntityScheduledActions","signRequest","createTag","readTags","updateTag","deleteTag","getTeams"];function h(e,t){var n={};return f.forEach((function(t){n[t]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return console.warn("You called ".concat(String(t)," on the Space API. Since version 4.0.0 the Space API and its methods are deprecated, and they will be removed from version 5.0.0 on. We recommend that you use the CMA client instead. See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details.")),e.call("callSpaceMethod",t,n)}})),n.getCachedContentTypes=function(){return function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],t,!0)},n}var g=function(e){return"object"!=typeof(t=e)||null===t||Array.isArray(t)?{}:e;var t};function v(e,t){return{openAlert:n.bind(null,"alert"),openConfirm:n.bind(null,"confirm"),openPrompt:n.bind(null,"prompt"),openExtension:o,openCurrentApp:i,openCurrent:function(e){return t.app?i(e):o(r(r({},e),{id:t.extension}))},selectSingleEntry:a.bind(null,"Entry",!1),selectSingleAsset:a.bind(null,"Asset",!1),selectMultipleEntries:a.bind(null,"Entry",!0),selectMultipleAssets:a.bind(null,"Asset",!0)};function n(t,n){return e.call("openDialog",t,g(n))}function o(n){var o=g(n);if((o=r(r({},o),{id:o.id||t.extension})).id)return e.call("openDialog","extension",o);throw new Error("Extension ID not provided.")}function i(n){if(n=g(n),t.app){var o=r(r({},n),{id:t.app});return e.call("openDialog","app",o)}throw new Error("Not in the app context.")}function a(t,n,r){return(r=g(r)).entityType=t,r.multiple=n,e.call("openDialog","entitySelector",r)}}function y(e,t){var n=new a(void 0),r=new a(void 0);return e.addHandler("localeSettingsChanged",(function(e){n.dispatch(e)})),e.addHandler("showDisabledFieldsChanged",(function(e){r.dispatch(e)})),{editorInterface:t,onLocaleSettingsChanged:function(e){return n.attach(e)},onShowDisabledFieldsChanged:function(e){return r.attach(e)}}}function _(e,t){var n=new o;return e.addHandler("navigateSlideIn",(function(e){n.dispatch(e)})),{openEntry:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Entry",id:t}))},openNewEntry:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Entry",id:null,contentTypeId:t}))},openBulkEditor:function(t,n){return e.call("navigateToBulkEditor",r({entryId:t},n))},openAsset:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Asset",id:t}))},openNewAsset:function(t){return e.call("navigateToContentEntity",r(r({},t),{entityType:"Asset",id:null}))},openPageExtension:function(n){return e.call("navigateToPage",r({type:"extension",id:t.extension},n))},openCurrentAppPage:function(n){return e.call("navigateToPage",r({type:"app",id:t.app},n))},openAppConfig:function(){return e.call("navigateToAppConfig")},openEntriesList:function(){return e.call("navigateToSpaceEnvRoute",{route:"entries"})},openAssetsList:function(){return e.call("navigateToSpaceEnvRoute",{route:"assets"})},onSlideInNavigation:function(e){return n.attach(e)}}}var m="preInstall",E="postInstall",A=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)},C=function(e){return"function"==typeof e},w=function(e){return console.error(e),Promise.resolve(!1)},T=function(e,t,n){if(!C(e))return Promise.resolve(t);var r;try{r=void 0===n?e():e(n)}catch(e){return w(e)}var o,i=r;return A(o=i)&&C(o.then)||(i=Promise.resolve(i)),i.then((function(e){return e instanceof Error?Promise.reject(e):!1!==e&&(A(e)?e:t)}),w).catch(w)};function b(e){var t,n=((t={}).preInstall=null,t.postInstall=null,t),r=function(e,t){if(!C(t))throw new Error("Handler must be a function.");n[e]=t};return e.addHandler("appHook",(function(t){var r=t.stage,o=t.installationRequestId,i=t.err;return r===m?T(n[r],{}).then((function(t){return e.send("appHookResult",{stage:r,installationRequestId:o,result:t})})):r===E?T(n[r],void 0,i||null).then((function(){return e.send("appHookResult",{stage:r,installationRequestId:o})})):Promise.resolve()})),{setReady:function(){return e.call("callAppMethod","setReady")},isInstalled:function(){return e.call("callAppMethod","isInstalled")},getParameters:function(){return e.call("callAppMethod","getParameters")},getCurrentState:function(){return e.call("callAppMethod","getCurrentState")},onConfigure:function(e){r(m,e)},onConfigurationCompleted:function(e){r(E,e)}}}var I,L={LOCATION_ENTRY_FIELD:"entry-field",LOCATION_ENTRY_FIELD_SIDEBAR:"entry-field-sidebar",LOCATION_ENTRY_SIDEBAR:"entry-sidebar",LOCATION_DIALOG:"dialog",LOCATION_ENTRY_EDITOR:"entry-editor",LOCATION_PAGE:"page",LOCATION_APP_CONFIG:"app-config"},O=function(e){return function(t){return e.call("CMAAdapterCall",t)}};function S(e){return{makeRequest:O(e)}}var D=[N,k,function(e,t){var n=t.field;if(!n)throw new Error('FieldAPI called for location without "field" property defined.');return{field:new l(e,n)}},R,P],H=((I={})[L.LOCATION_ENTRY_FIELD]=D,I[L.LOCATION_ENTRY_FIELD_SIDEBAR]=D,I[L.LOCATION_ENTRY_SIDEBAR]=[N,k,R,P],I[L.LOCATION_ENTRY_EDITOR]=[N,k,R],I[L.LOCATION_DIALOG]=[N,function(e){return{close:function(t){return e.send("closeDialog",t)}}},P],I[L.LOCATION_PAGE]=[N],I[L.LOCATION_APP_CONFIG]=[N,function(e){return{app:b(e)}}],I);function N(e,t){var n=t.user,r=t.parameters,o=t.locales,i=t.ids,a=t.initialContentTypes,s=t.location||L.LOCATION_ENTRY_FIELD;return{cmaAdapter:S(e),location:{is:function(e){return s===e}},user:n,parameters:r,locales:{available:o.available,default:o.default,names:o.names,fallbacks:o.fallbacks,optional:o.optional,direction:o.direction},space:h(e,a),dialogs:v(e,i),navigator:_(e,i),notifier:{success:function(t){return e.send("notify",{type:"success",message:t})},error:function(t){return e.send("notify",{type:"error",message:t})},warning:function(t){return e.send("notify",{type:"warning",message:t})}},ids:i,access:{can:function(t,n,r){return e.call("checkAccess",t,n,r)},canEditAppConfig:function(){return e.call("checkAppConfigAccess")}}}}function P(e,t,n){return{window:c(n,e)}}function R(e,t){return{editor:y(e,t.editorInterface)}}function k(e,t){var n=t.locales,r=t.contentType,o=t.entry,i=t.fieldInfo;return{contentType:r,entry:p(e,o,i,(function(t){return new u(e,t,n.default)}))}}var x,M,F,V,j,q=(x=window,M=function(e,t,n){return(H[t.location]||D).reduce((function(o,i){return r(r({},o),i(e,t,n))}),{})},(F={promise:null,resolve:null}).promise=new Promise((function(e){F.resolve=e})),(j=F).promise.then((function(e){var t=e[0],n=x.document;n.addEventListener("focus",(function(){return t.send("setActive",!0)}),!0),n.addEventListener("blur",(function(){return t.send("setActive",!1)}),!0)})),function(e,t){!function(e,t){function n(r){var o=r.data;"connect"===o.method&&(e.removeEventListener("message",n),t.apply(void 0,o.params))}e.addEventListener("message",n)}(e,(function(n,r){var o=new s(n.id,e);t(o,n,r)}))}(x,(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return j.resolve(e)})),function(e,t){var n=void 0===t?{supressIframeWarning:!1}:t,r=n.makeCustomApi;n.supressIframeWarning||x.self!==x.top||console.error("Cannot use ui-extension-sdk outside of Contenful:\n\nIn order for the ui-extension-sdk to function correctly, your app needs to be run in an iframe in the Contentful Web App.\n\nLearn more about local development with the ui-extension-sdk here:\n https://www.contentful.com/developers/docs/extensibility/ui-extensions/faq/#how-can-i-use-the-ui-extension-sdk-locally"),V||(V=j.promise.then((function(e){var t,n=e[0],o=e[1],i=e[2],a=M(n,o,x);return"function"==typeof r&&(t=r(n,o)),i.forEach((function(e){n._handleMessage(e)})),[a,t]}))),V.then((function(t){var n=t[0],r=t[1];return e(n,r)}))});e.init=q,e.locations=L,Object.defineProperty(e,"__esModule",{value:!0})})),window.contentfulApp=window.contentfulExtension;
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).contentfulExtension={})}(this,(function(e){"use strict";var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,n)};var n,r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function o(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function i(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var a=function(){function e(){this._id=0,this._listeners={}}return e.prototype.dispatch=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r in this._listeners)(e=this._listeners)[r].apply(e,t)},e.prototype.attach=function(e){var t=this;if("function"!=typeof e)throw new Error("listener function expected");var n=this._id++;return this._listeners[n]=e,function(){return delete t._listeners[n]}},e}(),s="__private__memoized__arguments__",l=function(e){function r(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var o=e.call(this)||this;if(o[n]=[],!t.length)throw new Error("Initial value to be memoized expected");return o[s]=t,o}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(r,e),r.prototype.dispatch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this[s]=t,e.prototype.dispatch.apply(this,t)},r.prototype.attach=function(t){var n=e.prototype.attach.call(this,t);return t.apply(void 0,this[s]),n},r}(a);n=s;var u=function(){function e(e,t){var n=this;this._messageHandlers={},this._responseHandlers={},this._send=function(e,t){var n=0;return function(r,o){var i=n++;try{t.postMessage({source:e,id:i,method:r,params:o},"*")}catch(e){throw e instanceof DOMException&&"DataCloneError"===e.name&&"openDialog"===r&&console.error("Error: openCurrent[App] parameters could not be parsed. You likely tried to pass functions or DOM elements as a parameter. Tip: Use the App SDK directly within the dialog location.\n\nLearn more about the dialog location: https://ctfl.io/app-sdk-dialog"),e}return i}}(e,t.parent),t.addEventListener("message",(function(e){n._handleMessage(e.data)}))}return e.prototype.call=function(e){for(var t=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this._send(e,n);return new Promise((function(e,n){t._responseHandlers[o]={resolve:e,reject:n}}))},e.prototype.send=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this._send(e,t)},e.prototype.addHandler=function(e,t){return e in this._messageHandlers||(this._messageHandlers[e]=new a),this._messageHandlers[e].attach(t)},e.prototype._handleMessage=function(e){if(e.method){var t=e.method,n=e.params,r=this._messageHandlers[t];r&&r.dispatch.apply(r,n)}else{var o=e.id,i=this._responseHandlers[o];if(!i)return;"result"in e?i.resolve(e.result):"error"in e&&i.reject(e.error),delete this._responseHandlers[o]}},e}();var c=function(){function e(e,t){var n=this;this.id=t.id,this.locale=t.locale,this.type=t.type,this.required=t.required,this.validations=t.validations,this.items=t.items,this._value=t.value,this._valueSignal=new l(this._value),this._isDisabledSignal=new l(void 0),this._schemaErrorsChangedSignal=new l(void 0),this._channel=e,e.addHandler("valueChanged",(function(e,t,r){e!==n.id||t&&t!==n.locale||(n._value=r,n._valueSignal.dispatch(r))})),e.addHandler("isDisabledChangedForFieldLocale",(function(e,t,r){e===n.id&&t===n.locale&&n._isDisabledSignal.dispatch(r)})),e.addHandler("schemaErrorsChangedForFieldLocale",(function(e,t,r){e===n.id&&t===n.locale&&n._schemaErrorsChangedSignal.dispatch(r)}))}return e.prototype.getValue=function(){return this._value},e.prototype.setValue=function(e){return this._value=e,this._valueSignal.dispatch(e),this._channel.call("setValue",this.id,this.locale,e)},e.prototype.removeValue=function(){return this._value=void 0,this._channel.call("removeValue",this.id,this.locale)},e.prototype.setInvalid=function(e){return this._channel.call("setInvalid",e,this.locale)},e.prototype.onValueChanged=function(e){return this._valueSignal.attach(e)},e.prototype.onIsDisabledChanged=function(e){return this._isDisabledSignal.attach(e)},e.prototype.onSchemaErrorsChanged=function(e){return this._schemaErrorsChangedSignal.attach(e)},e}(),d=function(){function e(e,t,n){this.id=t.id,this.locales=t.locales,this.type=t.type,this.required=t.required,this.validations=t.validations,this.items=t.items,this._defaultLocale=n,this._fieldLocales=t.locales.reduce((function(n,o){var i,a=new c(e,{id:t.id,type:t.type,required:t.required,validations:t.validations,items:t.items,locale:o,value:t.values[o]});return r(r({},n),((i={})[o]=a,i))}),{}),this.assertHasLocale(n)}return e.prototype.getValue=function(e){return this._getFieldLocale(e).getValue()},e.prototype.setValue=function(e,t){return this._getFieldLocale(t).setValue(e)},e.prototype.removeValue=function(e){return this.setValue(void 0,e)},e.prototype.onValueChanged=function(e,t){var n=t||e;return t||(e=""),this._getFieldLocale(e).onValueChanged(n)},e.prototype.onIsDisabledChanged=function(e,t){var n=t||e;return t||(e=""),this._getFieldLocale(e).onIsDisabledChanged(n)},e.prototype._getFieldLocale=function(e){return e=e||this._defaultLocale,this.assertHasLocale(e),this._fieldLocales[e]},e.prototype.getForLocale=function(e){if(!e)throw new Error("getForLocale must be passed a locale");return this._getFieldLocale(e)},e.prototype.assertHasLocale=function(e){if(!this._fieldLocales[e])throw new Error('Unknown locale "'.concat(e,'" for field "').concat(this.id,'"'))},e}();function p(e,t){var n,r=e,o=r.document,i=r.MutationObserver,a=r.ResizeObserver,s=!1,l=!1,u=new Set,c=new i((function(e){!function(e){e.forEach((function(e){switch(e.type){case"attributes":if(e.target.nodeType===Node.ELEMENT_NODE){var t=e.target;f(e.type,t)?u.add(t):u.delete(t)}break;case"childList":e.addedNodes.forEach((function(t){if(t.nodeType===Node.ELEMENT_NODE){var n=t;f(e.type,n)&&u.add(n)}})),e.removedNodes.forEach((function(e){var t=e;u.delete(t)}))}}))}(e),s&&p.updateHeight()})),d=new a((function(){p.updateHeight()}));c.observe(o.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0});var p={startAutoResizer:function(e){var t=(void 0===e?{}:e).absoluteElements;if(l=Boolean(t===void 0?false:t),p.updateHeight(),s)return;s=!0,d.observe(o.body)},stopAutoResizer:function(){if(!s)return;s=!1,d.disconnect()},updateHeight:function(e){void 0===e&&(e=null);if(null===e){var r=Math.ceil(o.documentElement.getBoundingClientRect().height);if(l&&u.size){var i=r;u.forEach((function(e){i=Math.max(e.getBoundingClientRect().bottom,i)})),e=i}else e=r}e!==n&&(t.send("setHeight",e),n=e)}};return p;function f(e,t){var n=getComputedStyle(t);if("absolute"!==n.position)return!1;switch(e){case"attributes":return"none"!==n.display;default:return!0}}}var f=["getTask","getTasks","createTask","updateTask","deleteTask"];function h(e,t,n,o){var i=t.sys,a=new l(i),s=t.metadata,u=new l(s);e.addHandler("sysChanged",(function(e){i=e,a.dispatch(i)})),e.addHandler("metadataChanged",(function(e){s=e,u.dispatch(s)}));var c={};return f.forEach((function(t){c[t]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e.call("callEntryMethod",t,n)}})),r(r(r({getSys:function(){return i},publish:function(){return e.call("callEntryMethod","publish")},unpublish:function(){return e.call("callEntryMethod","unpublish")},save:function(){return e.call("callEntryMethod","save")},onSysChanged:function(e){return a.attach(e)},fields:n.reduce((function(e,t){return e[t.id]=o(t),e}),{})},s?{metadata:s}:{}),{getMetadata:function(){return s},onMetadataChanged:function(e){return u.attach(e)}}),c)}var v=["getContentType","getEntry","getEntrySnapshots","getAsset","getEditorInterface","getPublishedEntries","getPublishedAssets","getContentTypes","getEntries","getEditorInterfaces","getAssets","createContentType","createEntry","createAsset","updateContentType","updateEntry","updateAsset","deleteContentType","deleteEntry","deleteAsset","publishEntry","publishAsset","unpublishEntry","unpublishAsset","archiveEntry","archiveAsset","unarchiveEntry","unarchiveAsset","createUpload","processAsset","waitUntilAssetProcessed","getUsers","getAllScheduledActions","getEntityScheduledActions","signRequest","createTag","readTags","updateTag","deleteTag","getTeams"];function y(e,t){var n={};return v.forEach((function(t){n[t]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return console.warn("You called ".concat(String(t)," on the Space API. Since version 4.0.0 the Space API and its methods are deprecated, and they will be removed from version 5.0.0 on. We recommend that you use the CMA client instead. See https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/#using-the-contentful-management-library for more details.")),e.call("callSpaceMethod",t,n)}})),n.getCachedContentTypes=function(){return function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],t,!0)},n}var g=function(e){return"object"!=typeof(t=e)||null===t||Array.isArray(t)?{}:e;var t};function E(e,t){return{openAlert:n.bind(null,"alert"),openConfirm:n.bind(null,"confirm"),openPrompt:n.bind(null,"prompt"),openExtension:o,openCurrentApp:i,openCurrent:function(e){return t.app?i(e):o(r(r({},e),{id:t.extension}))},selectSingleEntry:a.bind(null,"Entry",!1),selectSingleAsset:a.bind(null,"Asset",!1),selectMultipleEntries:a.bind(null,"Entry",!0),selectMultipleAssets:a.bind(null,"Asset",!0)};function n(t,n){return e.call("openDialog",t,g(n))}function o(n){var o=g(n);if((o=r(r({},o),{id:o.id||t.extension})).id)return e.call("openDialog","extension",o);throw new Error("Extension ID not provided.")}function i(n){if(n=g(n),t.app){var o=r(r({},n),{id:t.app});return e.call("openDialog","app",o)}throw new Error("Not in the app context.")}function a(t,n,r){return(r=g(r)).entityType=t,r.multiple=n,e.call("openDialog","entitySelector",r)}}function m(e,t){var n=new l(void 0),r=new l(void 0);return e.addHandler("localeSettingsChanged",(function(e){n.dispatch(e)})),e.addHandler("showDisabledFieldsChanged",(function(e){r.dispatch(e)})),{editorInterface:t,onLocaleSettingsChanged:function(e){return n.attach(e)},onShowDisabledFieldsChanged:function(e){return r.attach(e)}}}function _(e,t){var n=new a;return e.addHandler("navigateSlideIn",(function(e){n.dispatch(e)})),{openEntry:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Entry",id:t}))},openNewEntry:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Entry",id:null,contentTypeId:t}))},openBulkEditor:function(t,n){return e.call("navigateToBulkEditor",r({entryId:t},n))},openAsset:function(t,n){return e.call("navigateToContentEntity",r(r({},n),{entityType:"Asset",id:t}))},openNewAsset:function(t){return e.call("navigateToContentEntity",r(r({},t),{entityType:"Asset",id:null}))},openPageExtension:function(n){return e.call("navigateToPage",r({type:"extension",id:t.extension},n))},openCurrentAppPage:function(n){return e.call("navigateToPage",r({type:"app",id:t.app},n))},openAppConfig:function(){return e.call("navigateToAppConfig")},openEntriesList:function(){return e.call("navigateToSpaceEnvRoute",{route:"entries"})},openAssetsList:function(){return e.call("navigateToSpaceEnvRoute",{route:"assets"})},onSlideInNavigation:function(e){return n.attach(e)}}}var w="preInstall",b="postInstall",A=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)},C=function(e){return"function"==typeof e},T=function(e){return console.error(e),Promise.resolve(!1)},L=function(e,t,n){if(!C(e))return Promise.resolve(t);var r;try{r=void 0===n?e():e(n)}catch(e){return T(e)}var o,i=r;return A(o=i)&&C(o.then)||(i=Promise.resolve(i)),i.then((function(e){return e instanceof Error?Promise.reject(e):!1!==e&&(A(e)?e:t)}),T).catch(T)};function I(e){var t,n=((t={}).preInstall=null,t.postInstall=null,t),r=function(e,t){if(!C(t))throw new Error("Handler must be a function.");n[e]=t};return e.addHandler("appHook",(function(t){var r=t.stage,o=t.installationRequestId,i=t.err;return r===w?L(n[r],{}).then((function(t){return e.send("appHookResult",{stage:r,installationRequestId:o,result:t})})):r===b?L(n[r],void 0,i||null).then((function(){return e.send("appHookResult",{stage:r,installationRequestId:o})})):Promise.resolve()})),{setReady:function(){return e.call("callAppMethod","setReady")},isInstalled:function(){return e.call("callAppMethod","isInstalled")},getParameters:function(){return e.call("callAppMethod","getParameters")},getCurrentState:function(){return e.call("callAppMethod","getCurrentState")},onConfigure:function(e){r(w,e)},onConfigurationCompleted:function(e){r(b,e)}}}var O={LOCATION_ENTRY_FIELD:"entry-field",LOCATION_ENTRY_FIELD_SIDEBAR:"entry-field-sidebar",LOCATION_ENTRY_SIDEBAR:"entry-sidebar",LOCATION_DIALOG:"dialog",LOCATION_ENTRY_EDITOR:"entry-editor",LOCATION_PAGE:"page",LOCATION_APP_CONFIG:"app-config",LOCATION_ENTRY_LIST:"entry-list"};function S(e){var t,n,r=this,a=function(a){return o(r,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return n=a,t?[4,D(t,a.props)]:[2];case 1:return r=o.sent(),[2,e.send("entryListResult",{msgId:a.msgId,result:r})]}}))}))};return e.addHandler("entryListUpdated",a),{onEntryListUpdated:function(e){if("function"!=typeof e)throw new Error("OnEntryListUpdated handler must be a function");t=e,n&&a(n)}}}var N,D=function(e,t){return o(void 0,void 0,void 0,(function(){var n,r;return i(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e(t)];case 1:return n=o.sent(),R(n),[2,n];case 2:return r=o.sent(),console.error(r),[2,!1];case 3:return[2]}}))}))},R=function(e){if(!1!==e){if("object"!=typeof e)throw new Error("Entry List location app data is invalid.");k(e)}},H={values:function(e){if("object"!=typeof e)throw new Error("Entry List location app data is invalid: 'values' must be an object.");if(!Object.values(e).every((function(e){return"string"==typeof e})))throw new Error("Entry List location app data is invalid: 'values' object should only have values of type 'string'.")}},k=function(e){var t=Object.keys(e);if(0===t.length)throw new Error("Entry List location app data is invalid.");t.forEach((function(t){if(!(t in H))throw new Error("Entry List location app data is invalid. Key '".concat(t,"' is not allowed."));H[t](e[t])}))},x=function(e){return function(t){return e.call("CMAAdapterCall",t)}};function P(e){return{makeRequest:x(e)}}var M=[j,q,function(e,t){var n=t.field;if(!n)throw new Error('FieldAPI called for location without "field" property defined.');return{field:new c(e,n)}},Y,V],F=((N={})[O.LOCATION_ENTRY_FIELD]=M,N[O.LOCATION_ENTRY_FIELD_SIDEBAR]=M,N[O.LOCATION_ENTRY_SIDEBAR]=[j,q,Y,V],N[O.LOCATION_ENTRY_EDITOR]=[j,q,Y],N[O.LOCATION_DIALOG]=[j,function(e){return{close:function(t){return e.send("closeDialog",t)}}},V],N[O.LOCATION_PAGE]=[j],N[O.LOCATION_APP_CONFIG]=[j,function(e){return{app:I(e)}}],N[O.LOCATION_ENTRY_LIST]=[j,function(e){return{entryList:S(e)}}],N);function j(e,t){var n=t.user,r=t.parameters,o=t.locales,i=t.ids,a=t.initialContentTypes,s=t.location||O.LOCATION_ENTRY_FIELD;return{cmaAdapter:P(e),location:{is:function(e){return s===e}},user:n,parameters:r,locales:{available:o.available,default:o.default,names:o.names,fallbacks:o.fallbacks,optional:o.optional,direction:o.direction},space:y(e,a),dialogs:E(e,i),navigator:_(e,i),notifier:{success:function(t){return e.send("notify",{type:"success",message:t})},error:function(t){return e.send("notify",{type:"error",message:t})},warning:function(t){return e.send("notify",{type:"warning",message:t})}},ids:i,access:{can:function(t,n,r){return e.call("checkAccess",t,n,r)},canEditAppConfig:function(){return e.call("checkAppConfigAccess")}}}}function V(e,t,n){return{window:p(n,e)}}function Y(e,t){return{editor:m(e,t.editorInterface)}}function q(e,t){var n=t.locales,r=t.contentType,o=t.entry,i=t.fieldInfo;return{contentType:r,entry:h(e,o,i,(function(t){return new d(e,t,n.default)}))}}var B,U,G,z,W,K=(B=window,U=function(e,t,n){return(F[t.location]||M).reduce((function(o,i){return r(r({},o),i(e,t,n))}),{})},(G={promise:null,resolve:null}).promise=new Promise((function(e){G.resolve=e})),(W=G).promise.then((function(e){var t=e[0],n=B.document;n.addEventListener("focus",(function(){return t.send("setActive",!0)}),!0),n.addEventListener("blur",(function(){return t.send("setActive",!1)}),!0)})),function(e,t){!function(e,t){function n(r){var o=r.data;"connect"===o.method&&(e.removeEventListener("message",n),t.apply(void 0,o.params))}e.addEventListener("message",n)}(e,(function(n,r){var o=new u(n.id,e);t(o,n,r)}))}(B,(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return W.resolve(e)})),function(e,t){var n=void 0===t?{supressIframeWarning:!1}:t,r=n.makeCustomApi;n.supressIframeWarning||B.self!==B.top||console.error("Cannot use ui-extension-sdk outside of Contenful:\n\nIn order for the ui-extension-sdk to function correctly, your app needs to be run in an iframe in the Contentful Web App.\n\nLearn more about local development with the ui-extension-sdk here:\n https://www.contentful.com/developers/docs/extensibility/ui-extensions/faq/#how-can-i-use-the-ui-extension-sdk-locally"),z||(z=W.promise.then((function(e){var t,n=e[0],o=e[1],i=e[2],a=U(n,o,B);return"function"==typeof r&&(t=r(n,o)),i.forEach((function(e){n._handleMessage(e)})),[a,t]}))),z.then((function(t){var n=t[0],r=t[1];return e(n,r)}))});e.init=K,e.locations=O,Object.defineProperty(e,"__esModule",{value:!0})})),window.contentfulApp=window.contentfulExtension;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContentType, EditorInterface, SpaceMembership, Role, ContentTypeField, Metadata, Entry, Task, Asset } from './entities';
|
|
1
|
+
import { ContentType, EditorInterface, SpaceMembership, Role, ContentTypeField, Metadata, Entry, Task, Asset, WorkflowDefinition } from './entities';
|
|
2
2
|
import { EntryAPI } from './entry.types';
|
|
3
3
|
import { SpaceAPI } from './space.types';
|
|
4
4
|
import { WindowAPI } from './window.types';
|
|
@@ -9,6 +9,7 @@ import { AppConfigAPI } from './app.types';
|
|
|
9
9
|
import { NavigatorAPI } from './navigator.types';
|
|
10
10
|
import { EntryFieldInfo, FieldInfo } from './field.types';
|
|
11
11
|
import { Adapter, KeyValueMap } from 'contentful-management/types';
|
|
12
|
+
import { EntryListAPI } from './entry-list.types';
|
|
12
13
|
export interface UserAPI {
|
|
13
14
|
sys: {
|
|
14
15
|
id: string;
|
|
@@ -66,6 +67,7 @@ export interface ParametersAPI {
|
|
|
66
67
|
export interface IdsAPI {
|
|
67
68
|
user: string;
|
|
68
69
|
extension?: string;
|
|
70
|
+
organization: string;
|
|
69
71
|
app?: string;
|
|
70
72
|
space: string;
|
|
71
73
|
environment: string;
|
|
@@ -114,7 +116,7 @@ export declare type JSONPatchItem = {
|
|
|
114
116
|
path: string;
|
|
115
117
|
value?: any;
|
|
116
118
|
};
|
|
117
|
-
declare type PatchEntity = Entry | Task | Asset;
|
|
119
|
+
declare type PatchEntity = Entry | Task | Asset | WorkflowDefinition;
|
|
118
120
|
export interface AccessAPI {
|
|
119
121
|
can(action: 'read' | 'update', entity: 'EditorInterface' | EditorInterface): Promise<boolean>;
|
|
120
122
|
can<T = Object>(action: CrudAction, entity: 'ContentType' | ContentType | 'Asset' | 'Entry' | T): Promise<boolean>;
|
|
@@ -188,7 +190,12 @@ export declare type AppExtensionSDK = Omit<BaseExtensionSDK, 'ids'> & {
|
|
|
188
190
|
};
|
|
189
191
|
app: AppConfigAPI;
|
|
190
192
|
};
|
|
191
|
-
export declare type
|
|
193
|
+
export declare type EntryListExtensionSDK = BaseExtensionSDK & {
|
|
194
|
+
/** A set of IDs actual for the app */
|
|
195
|
+
ids: Omit<IdsAPI, EntryScopedIds>;
|
|
196
|
+
entryList: EntryListAPI;
|
|
197
|
+
};
|
|
198
|
+
export declare type KnownSDK = FieldExtensionSDK | SidebarExtensionSDK | DialogExtensionSDK | EditorExtensionSDK | PageExtensionSDK | AppExtensionSDK | EntryListExtensionSDK;
|
|
192
199
|
export interface Locations {
|
|
193
200
|
LOCATION_ENTRY_FIELD: 'entry-field';
|
|
194
201
|
LOCATION_ENTRY_FIELD_SIDEBAR: 'entry-field-sidebar';
|
|
@@ -197,6 +204,7 @@ export interface Locations {
|
|
|
197
204
|
LOCATION_ENTRY_EDITOR: 'entry-editor';
|
|
198
205
|
LOCATION_PAGE: 'page';
|
|
199
206
|
LOCATION_APP_CONFIG: 'app-config';
|
|
207
|
+
LOCATION_ENTRY_LIST: 'entry-list';
|
|
200
208
|
}
|
|
201
209
|
export interface ConnectMessage {
|
|
202
210
|
id: string;
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AssetProps as Asset, ContentFields as ContentTypeField, ContentTypeFieldValidation, ContentTypeProps as ContentType, EditorInterfaceProps as EditorInterface, EntryProps as Entry, KeyValueMap, MetadataProps as Metadata, QueryOptions, RoleProps as Role, ScheduledActionProps as ScheduledAction, SpaceMembershipProps as SpaceMembership, TagProps as Tag, TagVisibility, TaskProps as Task, TeamProps as Team, UploadProps as Upload, UserProps as User, } from 'contentful-management/types';
|
|
1
|
+
export type { AssetProps as Asset, ContentFields as ContentTypeField, ContentTypeFieldValidation, ContentTypeProps as ContentType, EditorInterfaceProps as EditorInterface, EntryProps as Entry, KeyValueMap, MetadataProps as Metadata, QueryOptions, RoleProps as Role, ScheduledActionProps as ScheduledAction, SpaceMembershipProps as SpaceMembership, TagProps as Tag, TagVisibility, TaskProps as Task, TeamProps as Team, UploadProps as Upload, UserProps as User, WorkflowDefinitionProps as WorkflowDefinition, } from 'contentful-management/types';
|
|
2
2
|
export interface CanonicalRequest {
|
|
3
3
|
method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
4
4
|
path: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EntryProps } from 'contentful-management/types';
|
|
2
|
+
export declare type EntryListEntriesType = EntryProps[];
|
|
3
|
+
export declare type EntryListExtraDataType = {
|
|
4
|
+
values: {
|
|
5
|
+
[entryId: string]: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare type OnEntryListUpdatedHandlerReturn = EntryListExtraDataType | false;
|
|
9
|
+
export declare type OnEntryListUpdatedHandlerProps = {
|
|
10
|
+
entries: EntryListEntriesType;
|
|
11
|
+
};
|
|
12
|
+
export declare type OnEntryListUpdatedHandler = (props: OnEntryListUpdatedHandlerProps) => OnEntryListUpdatedHandlerReturn | Promise<OnEntryListUpdatedHandlerReturn>;
|
|
13
|
+
export interface EntryListAPI {
|
|
14
|
+
/** Registers a handler to be called every time entries on EntryList changes */
|
|
15
|
+
onEntryListUpdated: (handler: OnEntryListUpdatedHandler) => void;
|
|
16
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type { AccessAPI, AppExtensionSDK, ArchiveableAction, BaseExtensionSDK, ConnectMessage, ContentTypeAPI, CrudAction, DialogExtensionSDK, EditorExtensionSDK, EditorLocaleSettings, FieldExtensionSDK, IdsAPI, KnownSDK, LocalesAPI, LocationAPI, Locations, NotifierAPI, PageExtensionSDK, ParametersAPI, PublishableAction, SharedEditorSDK, SidebarExtensionSDK, UserAPI, JSONPatchItem, } from './api.types';
|
|
1
|
+
export type { AccessAPI, AppExtensionSDK, ArchiveableAction, BaseExtensionSDK, ConnectMessage, ContentTypeAPI, CrudAction, DialogExtensionSDK, EditorExtensionSDK, EditorLocaleSettings, FieldExtensionSDK, IdsAPI, KnownSDK, LocalesAPI, LocationAPI, Locations, NotifierAPI, PageExtensionSDK, ParametersAPI, PublishableAction, SharedEditorSDK, SidebarExtensionSDK, UserAPI, JSONPatchItem, EntryListExtensionSDK, } from './api.types';
|
|
2
2
|
export type { AppConfigAPI, AppState, OnConfigureHandler, OnConfigureHandlerReturn, } from './app.types';
|
|
3
3
|
export type { DialogsAPI, EntityDialogOptions, OpenAlertOptions, OpenConfirmOptions, OpenCustomWidgetOptions, } from './dialogs.types';
|
|
4
|
-
export type { Asset, CanonicalRequest, ContentType, ContentTypeField, EditorInterface, Entry, Metadata, Role, ScheduledAction, SpaceMembership, Tag, TagVisibility, Task, Team, User, } from './entities';
|
|
4
|
+
export type { Asset, CanonicalRequest, ContentType, ContentTypeField, EditorInterface, Entry, Metadata, Role, ScheduledAction, SpaceMembership, Tag, TagVisibility, Task, Team, User, WorkflowDefinition, } from './entities';
|
|
5
5
|
export type { EntryAPI, TaskAPI, TaskInputData } from './entry.types';
|
|
6
6
|
export type { FieldInfo, EntryFieldInfo, EntryFieldAPI } from './field.types';
|
|
7
7
|
export type { FieldAPI } from './field-locale.types';
|
|
@@ -10,3 +10,4 @@ export type { SpaceAPI } from './space.types';
|
|
|
10
10
|
export type { SearchQuery, CollectionResponse, ContentEntitySys, ContentEntityType, Items, Link, WithOptionalId, WithId, SerializedJSONValue, } from './utils';
|
|
11
11
|
export type { DateRangeValidationError, InValidationError, LinkContentTypeValidationError, LinkMimetypeGroupValidationError, NotResolvableValidationError, ProhibitRegexpValidationError, RangeValidationError, RegexpValidationError, RequiredValidationError, SizeValidationError, TypeValidationError, UniqueValidationError, UnknownValidationError, ValidationError, } from './validation-error';
|
|
12
12
|
export type { WindowAPI } from './window.types';
|
|
13
|
+
export type { EntryListExtraDataType, OnEntryListUpdatedHandlerReturn, OnEntryListUpdatedHandlerProps, OnEntryListUpdatedHandler, EntryListAPI, EntryListEntriesType, } from './entry-list.types';
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
export interface WindowAPI {
|
|
2
2
|
/** Sets the iframe height to the given value in pixels or using scrollHeight if value is not passed */
|
|
3
3
|
updateHeight: (height?: number) => void;
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Listens for DOM changes and updates height when the size changes.
|
|
6
|
+
*
|
|
7
|
+
* When passing absoluteElements true, an infinite loop can happen if elements are always rendered below the height of the window.
|
|
8
|
+
* e.g. transformed elements or absolute elements with negative bottom
|
|
9
|
+
* @param {Object} opts - Options to be passed to auto resize
|
|
10
|
+
* @param {Boolean} opts.absoluteElements - Defines if auto resize should consider absolut elements
|
|
11
|
+
*/
|
|
12
|
+
startAutoResizer: ({ absoluteElements }?: {
|
|
13
|
+
absoluteElements?: boolean;
|
|
14
|
+
}) => void;
|
|
6
15
|
/** Stops resizing the iframe automatically. */
|
|
7
16
|
stopAutoResizer: () => void;
|
|
8
17
|
}
|
package/dist/window.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"contentful-ui-extensions-sdk","description":"SDK to develop custom UI Extension for the Contentful Web App","version":"4.
|
|
1
|
+
{"name":"contentful-ui-extensions-sdk","description":"SDK to develop custom UI Extension for the Contentful Web App","version":"4.6.0-alpha.2","author":"Contentful GmbH","license":"MIT","repository":{"url":"https://github.com/contentful/ui-extensions-sdk.git","type":"git"},"homepage":"https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/","main":"dist/cf-extension-api.js","types":"dist/index.d.ts","files":["dist/cf-extension-api.js","dist/cf-extension-api.js.map","dist/cf-extension.css","dist/**/*.d.ts"],"scripts":{"test":"ts-mocha -p tsconfig.test.json 'test/unit/*.[jt]s' --reporter mocha-multi-reporters --reporter-options configFile=mocha.unit-reporters.json","lint":"eslint '{lib,test}/**/*.{t,j}s'","lint:fix":"npm run lint -- --fix","build":"npm run check-types && rollup -c --compact","build:debug":"npm run build -- --sourcemap","prepublishOnly":"npm run build","size":"echo \"Gzipped, estimate: $(gzip -9 -c dist/cf-extension-api.js | wc -c) bytes\"","semantic-release":"semantic-release","publish-all":"node ./scripts/publish.js","verify":"node ./scripts/verify.js","check-types":"tsc --noEmit -m commonjs","prepare":"husky install","lint-staged":"lint-staged"},"devDependencies":{"@semantic-release/changelog":"6.0.1","@semantic-release/exec":"6.0.3","@semantic-release/git":"10.0.1","@testing-library/dom":"8.13.0","@types/chai-as-promised":"7.1.5","@types/cross-spawn":"6.0.2","@types/fs-extra":"9.0.13","@types/jsdom":"16.2.14","@types/nanoid":"3.0.0","@types/sinon":"^10.0.0","@types/sinon-chai":"^3.2.5","@typescript-eslint/eslint-plugin":"4.33.0","@typescript-eslint/parser":"4.33.0","babel-eslint":"10.1.0","chai":"4.3.6","chai-as-promised":"7.1.1","contentful-management":"10.6.3","cross-spawn":"7.0.3","eslint":"7.32.0","eslint-config-prettier":"8.5.0","eslint-config-standard":"16.0.3","eslint-plugin-import":"2.26.0","eslint-plugin-node":"11.1.0","eslint-plugin-prettier":"4.0.0","eslint-plugin-promise":"6.0.0","eslint-plugin-react":"7.30.0","eslint-plugin-standard":"5.0.0","fs-extra":"10.1.0","husky":"8.0.1","jsdom":"19.0.0","lint-staged":"13.0.1","mocha":"10.0.0","mocha-junit-reporter":"2.0.2","mocha-multi-reporters":"1.5.1","mochawesome":"7.1.3","mochawesome-merge":"4.2.1","mochawesome-report-generator":"6.2.0","prettier":"2.7.1","rollup":"2.75.6","rollup-plugin-terser":"7.0.2","rollup-plugin-typescript2":"0.32.1","semantic-release":"19.0.3","sinon":"14.0.0","sinon-chai":"3.7.0","ts-mocha":"10.0.0","tslib":"2.4.0","typescript":"4.7.3"},"lint-staged":{"*.ts":["prettier --write","eslint --fix","git add"],"*.md":["prettier --write","git add"]},"release":{"branches":["master",{"name":"canary","channel":"canary","prerelease":"alpha"}],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog",["@semantic-release/npm",{"npmPublish":false}],["@semantic-release/exec",{"verifyConditionsCmd":"node ./scripts/verify.js","publishCmd":"npm run publish-all"}],["@semantic-release/git",{"message":"chore: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}","assets":["CHANGELOG.md","package.json","package-lock.json"]}],"@semantic-release/github"]},"peerDependencies":{"contentful-management":">=7.30.0"}}
|