contentful-ui-extensions-sdk
Advanced tools
Comparing version 3.7.2 to 3.8.0
@@ -1,4 +0,4 @@ | ||
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) { | ||
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"pBGv":[function(require,module,exports) { | ||
var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a<e;)c&&c[a].run();a=-1,e=s.length}c=null,l=!1,u(t)}}function m(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new m(t,e)),1!==s.length||l||i(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}; | ||
var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a<e;)c&&c[a].run();a=-1,e=s.length}c=null,l=!1,u(t)}}function m(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new m(t,e)),1!==s.length||l||i(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}; | ||
},{}],"Zt7E":[function(require,module,exports) { | ||
@@ -16,5 +16,5 @@ var define; | ||
},{"es6-promise":"Zt7E","./channel":"sCMk"}],"GnXy":[function(require,module,exports) { | ||
function e(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function a(e,a){for(var n=0;n<a.length;n++){var i=a[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,n,i){return n&&a(e.prototype,n),i&&a(e,i),e}var i=require("./signal"),l=i.MemoizedSignal;module.exports=function(){function a(n,i){var t=this;e(this,a),this.id=i.id,this.locale=i.locale,this.type=i.type,this.validations=i.validations,this._value=i.value,this._valueSignal=new l(this._value),this._isDisabledSignal=new l(void 0),this._schemaErrorsChangedSignal=new l(void 0),this._channel=n,n.addHandler("valueChanged",function(e,a,n){e!==t.id||a&&a!==t.locale||(t._value=n,t._valueSignal.dispatch(n))}),n.addHandler("isDisabledChanged",function(e){t._isDisabledSignal.dispatch(e)}),n.addHandler("schemaErrorsChanged",function(e){t._schemaErrorsChangedSignal.dispatch(e)})}return n(a,[{key:"getValue",value:function(){return this._value}},{key:"setValue",value:function(e){return this._value=e,this._valueSignal.dispatch(e),this._channel.call("setValue",this.id,this.locale,e)}},{key:"removeValue",value:function(){return this._value=void 0,this._channel.call("removeValue",this.id,this.locale)}},{key:"setInvalid",value:function(e){return this._channel.call("setInvalid",e,this.locale)}},{key:"onValueChanged",value:function(e){return this._valueSignal.attach(e)}},{key:"onIsDisabledChanged",value:function(e){return this._isDisabledSignal.attach(e)}},{key:"onSchemaErrorsChanged",value:function(e){return this._schemaErrorsChangedSignal.attach(e)}}]),a}(); | ||
function e(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}function a(e,a){for(var n=0;n<a.length;n++){var i=a[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,n,i){return n&&a(e.prototype,n),i&&a(e,i),e}var i=require("./signal"),l=i.MemoizedSignal,t=["id","locale","type","required","validations","items"];module.exports=function(){function a(n,i){var r=this;e(this,a),t.forEach(function(e){void 0!==i[e]&&(r[e]=i[e])}),this._value=i.value,this._valueSignal=new l(this._value),this._isDisabledSignal=new l(void 0),this._schemaErrorsChangedSignal=new l(void 0),this._channel=n,n.addHandler("valueChanged",function(e,a,n){e!==r.id||a&&a!==r.locale||(r._value=n,r._valueSignal.dispatch(n))}),n.addHandler("isDisabledChanged",function(e){r._isDisabledSignal.dispatch(e)}),n.addHandler("schemaErrorsChanged",function(e){r._schemaErrorsChangedSignal.dispatch(e)})}return n(a,[{key:"getValue",value:function(){return this._value}},{key:"setValue",value:function(e){return this._value=e,this._valueSignal.dispatch(e),this._channel.call("setValue",this.id,this.locale,e)}},{key:"removeValue",value:function(){return this._value=void 0,this._channel.call("removeValue",this.id,this.locale)}},{key:"setInvalid",value:function(e){return this._channel.call("setInvalid",e,this.locale)}},{key:"onValueChanged",value:function(e){return this._valueSignal.attach(e)}},{key:"onIsDisabledChanged",value:function(e){return this._isDisabledSignal.attach(e)}},{key:"onSchemaErrorsChanged",value:function(e){return this._schemaErrorsChangedSignal.attach(e)}}]),a}(); | ||
},{"./signal":"HrMX"}],"daBI":[function(require,module,exports) { | ||
function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var l=0;l<t.length;l++){var a=t[l];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function l(e,l,a){return l&&t(e.prototype,l),a&&t(e,a),e}var a=require("./field-locale");function i(e,t){if(!e._fieldLocales[t])throw new Error('Unknown locale "'.concat(t,'" for field "').concat(e.id,'"'))}module.exports=function(){function t(l,n,o){var u=this;e(this,t),this.id=n.id,this.locales=n.locales,this.type=n.type,this.validations=n.validations,this._defaultLocale=o,this._fieldLocales={},this.locales.forEach(function(e){var t=n.values[e];u._fieldLocales[e]=new a(l,{id:u.id,locale:e,value:t})}),i(this,o)}return l(t,[{key:"getValue",value:function(e){return this._getFieldLocale(e).getValue()}},{key:"setValue",value:function(e,t){return this._getFieldLocale(t).setValue(e)}},{key:"removeValue",value:function(e){return this.setValue(void 0,e)}},{key:"onValueChanged",value:function(e,t){return t||(t=e,e=void 0),this._getFieldLocale(e).onValueChanged(t)}},{key:"onIsDisabledChanged",value:function(e,t){return t||(t=e,e=void 0),this._getFieldLocale(e).onIsDisabledChanged(t)}},{key:"_getFieldLocale",value:function(e){return i(this,e=e||this._defaultLocale),this._fieldLocales[e]}}]),t}(); | ||
function e(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{},l=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(l=l.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),l.forEach(function(n){t(e,n,o[n])})}return e}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function l(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var r=require("./field-locale"),i=["id","locales","type","required","validations","items"];function a(e,t){if(!e._fieldLocales[t])throw new Error('Unknown locale "'.concat(t,'" for field "').concat(e.id,'"'))}module.exports=function(){function o(l,u,c){var f=this;n(this,o),i.forEach(function(e){void 0!==u[e]&&(f[e]=u[e])}),this._defaultLocale=c,this._fieldLocales=u.locales.reduce(function(n,o){return e({},n,t({},o,new r(l,{id:u.id,locale:o,value:u.values[o]})))},{}),a(this,c)}return l(o,[{key:"getValue",value:function(e){return this._getFieldLocale(e).getValue()}},{key:"setValue",value:function(e,t){return this._getFieldLocale(t).setValue(e)}},{key:"removeValue",value:function(e){return this.setValue(void 0,e)}},{key:"onValueChanged",value:function(e,t){return t||(t=e,e=void 0),this._getFieldLocale(e).onValueChanged(t)}},{key:"onIsDisabledChanged",value:function(e,t){return t||(t=e,e=void 0),this._getFieldLocale(e).onIsDisabledChanged(t)}},{key:"_getFieldLocale",value:function(e){return a(this,e=e||this._defaultLocale),this._fieldLocales[e]}}]),o}(); | ||
},{"./field-locale":"GnXy"}],"XV20":[function(require,module,exports) { | ||
@@ -25,13 +25,15 @@ module.exports=function(e,t){var n=e.document,i=e.MutationObserver,r=function(){c.updateHeight()},u=new i(r),o=null,s=!1,c={startAutoResizer:function(){if(c.updateHeight(),s)return;s=!0,u.observe(n.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),e.addEventListener("resize",r)},stopAutoResizer:function(){if(!s)return;s=!1,u.disconnect(),e.removeEventListener("resize",r)},updateHeight:function(e){null==e&&(e=Math.ceil(n.documentElement.getBoundingClientRect().height));e!==o&&(t.send("setHeight",e),o=e)}};return c}; | ||
},{"./signal":"HrMX"}],"iabO":[function(require,module,exports) { | ||
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 e=["getContentType","getEntry","getEntrySnapshots","getAsset","getEditorInterface","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}; | ||
},{}],"6GEt":[function(require,module,exports) { | ||
function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(t)}module.exports=function(t){return{openAlert:e.bind(null,"alert"),openConfirm:e.bind(null,"confirm"),openPrompt:e.bind(null,"prompt"),openExtension:e.bind(null,"extension"),selectSingleEntry:l.bind(null,"Entry",!1),selectSingleAsset:l.bind(null,"Asset",!1),selectMultipleEntries:l.bind(null,"Entry",!0),selectMultipleAssets:l.bind(null,"Asset",!0)};function e(n,e){return t.call("openDialog",n,o(e))}function l(n,e,l){return(l=o(l)).entityType=n,l.multiple=e,t.call("openDialog","entitySelector",l)}function o(t){return"object"===n(t)&&null!==t&&!Array.isArray(t)?t:{}}}; | ||
},{}],"Y2Q9":[function(require,module,exports) { | ||
},{}],"fqJo":[function(require,module,exports) { | ||
var e=require("./signal"),n=e.MemoizedSignal;module.exports=function(e,a){var d=new n(void 0),t=new n(void 0);return e.addHandler("localeSettingsChanged",function(e){d.dispatch(e)}),e.addHandler("showDisabledFieldsChanged",function(e){t.dispatch(e)}),{editorInterface:a,onLocaleSettingsChanged:function(e){return d.attach(e)},onShowDisabledFieldsChanged:function(e){return t.attach(e)}}}; | ||
},{"./signal":"HrMX"}],"Y2Q9":[function(require,module,exports) { | ||
function t(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){n(t,e,r[e])})}return t}function n(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}module.exports=function(n){return{openEntry:function(e,r){return n.call("navigateToContentEntity",t({},r,{entityType:"Entry",id:e}))},openNewEntry:function(e,r){return n.call("navigateToContentEntity",t({},r,{entityType:"Entry",id:null,contentTypeId:e}))},openAsset:function(e,r){return n.call("navigateToContentEntity",t({},r,{entityType:"Asset",id:e}))},openNewAsset:function(e){return n.call("navigateToContentEntity",t({},e,{entityType:"Asset",id:null}))}}}; | ||
},{}],"CHnp":[function(require,module,exports) { | ||
module.exports={LOCATION_ENTRY_FIELD:"entry-field",LOCATION_ENTRY_FIELD_SIDEBAR:"entry-field-sidebar",LOCATION_ENTRY_SIDEBAR:"entry-sidebar",LOCATION_DIALOG:"dialog"}; | ||
module.exports={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"}; | ||
},{}],"LVu9":[function(require,module,exports) { | ||
var e;function r(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){n(e,r,t[r])})}return e}function n(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var t=require("./field"),o=require("./field-locale"),i=require("./window"),u=require("./entry"),a=require("./space"),c=require("./dialogs"),l=require("./navigator"),s=require("./locations"),f=[d,y,p],O=(n(e={},s.LOCATION_ENTRY_FIELD,f),n(e,s.LOCATION_ENTRY_FIELD_SIDEBAR,f),n(e,s.LOCATION_ENTRY_SIDEBAR,[d,y]),n(e,s.LOCATION_DIALOG,[d,b]),e);function d(e,r,n){var t=r.user,o=r.parameters,u=r.locales;return{location:{is:function(e){return(r.location||s.LOCATION_ENTRY_FIELD)===e}},user:t,parameters:o,locales:{available:u.available,default:u.default,names:u.names},space:a(e),window:i(n,e),dialogs:c(e),navigator:l(e),notifier:{success:function(r){return e.send("notify",{type:"success",message:r})},error:function(r){return e.send("notify",{type:"error",message:r})}}}}function y(e,r){var n=r.locales,o=r.contentType,i=r.entry,a=r.fieldInfo;return{contentType:o,entry:u(e,i,a,function(r){return new t(e,r,n.default)})}}function p(e,r){var n=r.field;return{field:new o(e,n)}}function b(e){return{close:function(r){return e.send("closeDialog",r)}}}module.exports=function(e,n,t){return(O[n.location]||f).reduce(function(o,i){return r({},o,i(e,n,t))},{})}; | ||
},{"./field":"daBI","./field-locale":"GnXy","./window":"XV20","./entry":"97BZ","./space":"iabO","./dialogs":"6GEt","./navigator":"Y2Q9","./locations":"CHnp"}],"Focm":[function(require,module,exports) { | ||
var e;function r(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){n(e,r,t[r])})}return e}function n(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var t=require("./field"),o=require("./field-locale"),i=require("./window"),u=require("./entry"),a=require("./space"),c=require("./dialogs"),l=require("./editor"),f=require("./navigator"),s=require("./locations"),d=[y,T,b,I,p],O=(n(e={},s.LOCATION_ENTRY_FIELD,d),n(e,s.LOCATION_ENTRY_FIELD_SIDEBAR,d),n(e,s.LOCATION_ENTRY_SIDEBAR,[y,T,I,p]),n(e,s.LOCATION_ENTRY_EDITOR,[y,T,I]),n(e,s.LOCATION_DIALOG,[y,v,p]),e);function y(e,r){var n=r.user,t=r.parameters,o=r.locales,i=r.ids;return{location:{is:function(e){return(r.location||s.LOCATION_ENTRY_FIELD)===e}},user:n,parameters:t,locales:{available:o.available,default:o.default,names:o.names},space:a(e),dialogs:c(e),navigator:f(e),notifier:{success:function(r){return e.send("notify",{type:"success",message:r})},error:function(r){return e.send("notify",{type:"error",message:r})}},ids:i}}function p(e,r,n){return{window:i(n,e)}}function I(e,r){var n=r.editorInterface;return{editor:l(e,n)}}function T(e,r){var n=r.locales,o=r.contentType,i=r.entry,a=r.fieldInfo;return{contentType:o,entry:u(e,i,a,function(r){return new t(e,r,n.default)})}}function b(e,r){var n=r.field;return{field:new o(e,n)}}function v(e){return{close:function(r){return e.send("closeDialog",r)}}}module.exports=function(e,n,t){return(O[n.location]||d).reduce(function(o,i){return r({},o,i(e,n,t))},{})}; | ||
},{"./field":"daBI","./field-locale":"GnXy","./window":"XV20","./entry":"97BZ","./space":"iabO","./dialogs":"6GEt","./editor":"fqJo","./navigator":"Y2Q9","./locations":"CHnp"}],"Focm":[function(require,module,exports) { | ||
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") |
@@ -7,2 +7,3 @@ const Field = require('./field') | ||
const createDialogs = require('./dialogs') | ||
const createEditor = require('./editor') | ||
const createNavigator = require('./navigator') | ||
@@ -14,3 +15,5 @@ const locations = require('./locations') | ||
makeEntryAPI, | ||
makeFieldAPI | ||
makeFieldAPI, | ||
makeEditorAPI, | ||
makeWindowAPI | ||
] | ||
@@ -21,4 +24,5 @@ | ||
[locations.LOCATION_ENTRY_FIELD_SIDEBAR]: DEFAULT_API_PRODUCERS, | ||
[locations.LOCATION_ENTRY_SIDEBAR]: [makeSharedAPI, makeEntryAPI], | ||
[locations.LOCATION_DIALOG]: [makeSharedAPI, makeDialogAPI] | ||
[locations.LOCATION_ENTRY_SIDEBAR]: [makeSharedAPI, makeEntryAPI, makeEditorAPI, makeWindowAPI], | ||
[locations.LOCATION_ENTRY_EDITOR]: [makeSharedAPI, makeEntryAPI, makeEditorAPI], | ||
[locations.LOCATION_DIALOG]: [makeSharedAPI, makeDialogAPI, makeWindowAPI] | ||
} | ||
@@ -34,4 +38,4 @@ | ||
function makeSharedAPI (channel, data, currentWindow) { | ||
const { user, parameters, locales } = data | ||
function makeSharedAPI (channel, data) { | ||
const { user, parameters, locales, ids } = data | ||
@@ -52,3 +56,2 @@ return { | ||
space: createSpace(channel), | ||
window: createWindow(currentWindow, channel), | ||
dialogs: createDialogs(channel), | ||
@@ -59,6 +62,20 @@ navigator: createNavigator(channel), | ||
error: message => channel.send('notify', { type: 'error', message }) | ||
} | ||
}, | ||
ids | ||
} | ||
} | ||
function makeWindowAPI (channel, _data, currentWindow) { | ||
return { | ||
window: createWindow(currentWindow, channel) | ||
} | ||
} | ||
function makeEditorAPI (channel, data) { | ||
const { editorInterface } = data | ||
return { | ||
editor: createEditor(channel, editorInterface) | ||
} | ||
} | ||
function makeEntryAPI (channel, { locales, contentType, entry, fieldInfo }) { | ||
@@ -65,0 +82,0 @@ const createEntryField = info => new Field(channel, info, locales.default) |
const { MemoizedSignal } = require('./signal') | ||
const INFO_PROPS = ['id', 'locale', 'type', 'required', 'validations', 'items'] | ||
module.exports = class FieldLocale { | ||
constructor (channel, fieldInfo) { | ||
this.id = fieldInfo.id | ||
this.locale = fieldInfo.locale | ||
this.type = fieldInfo.type | ||
this.validations = fieldInfo.validations | ||
INFO_PROPS.forEach(prop => { | ||
const value = fieldInfo[prop] | ||
if (typeof value !== 'undefined') { | ||
this[prop] = fieldInfo[prop] | ||
} | ||
}) | ||
this._value = fieldInfo.value | ||
@@ -10,0 +15,0 @@ this._valueSignal = new MemoizedSignal(this._value) |
const FieldLocale = require('./field-locale') | ||
const INFO_PROPS = ['id', 'locales', 'type', 'required', 'validations', 'items'] | ||
module.exports = class Field { | ||
constructor (channel, info, defaultLocale) { | ||
this.id = info.id | ||
this.locales = info.locales | ||
this.type = info.type | ||
this.validations = info.validations | ||
INFO_PROPS.forEach(prop => { | ||
const value = info[prop] | ||
if (typeof value !== 'undefined') { | ||
this[prop] = info[prop] | ||
} | ||
}) | ||
this._defaultLocale = defaultLocale | ||
this._fieldLocales = {} | ||
this.locales.forEach((locale) => { | ||
const value = info.values[locale] | ||
this._fieldLocales[locale] = | ||
new FieldLocale(channel, { id: this.id, locale, value }) | ||
}) | ||
this._fieldLocales = info.locales.reduce((acc, locale) => { | ||
const fieldLocale = new FieldLocale(channel, { | ||
id: info.id, | ||
locale, | ||
value: info.values[locale] | ||
}) | ||
return { ...acc, [locale]: fieldLocale } | ||
}, {}) | ||
assertHasLocale(this, defaultLocale) | ||
@@ -19,0 +27,0 @@ } |
@@ -5,3 +5,4 @@ module.exports = { | ||
LOCATION_ENTRY_SIDEBAR: 'entry-sidebar', | ||
LOCATION_DIALOG: 'dialog' | ||
LOCATION_DIALOG: 'dialog', | ||
LOCATION_ENTRY_EDITOR: 'entry-editor' | ||
} |
@@ -6,2 +6,3 @@ const spaceMethods = [ | ||
'getAsset', | ||
'getEditorInterface', | ||
@@ -8,0 +9,0 @@ 'getPublishedEntries', |
{ | ||
"name": "contentful-ui-extensions-sdk", | ||
"description": "SDK to develop custom UI Extension for the Contentful Web App", | ||
"version": "3.7.2", | ||
"version": "3.8.0", | ||
"author": "Contentful GmbH", | ||
@@ -20,3 +20,4 @@ "license": "MIT", | ||
"prepublishOnly": "npm run build", | ||
"size": "echo \"Gzipped, estimate: $(gzip -9 -c dist/cf-extension-api.js | wc -c) bytes\"" | ||
"size": "echo \"Gzipped, estimate: $(gzip -9 -c dist/cf-extension-api.js | wc -c) bytes\"", | ||
"integration": "node test/integration" | ||
}, | ||
@@ -29,14 +30,14 @@ "dependencies": { | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^5.14.1", | ||
"eslint": "^5.16.0", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-node": "^8.0.1", | ||
"eslint-plugin-promise": "^4.0.1", | ||
"eslint-plugin-promise": "^4.1.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"jsdom": "^13.2.0", | ||
"mocha": "^6.0.2", | ||
"parcel-bundler": "^1.11.0", | ||
"sinon": "^7.2.5", | ||
"jsdom": "^14.0.0", | ||
"mocha": "^6.1.2", | ||
"parcel-bundler": "^1.12.3", | ||
"sinon": "^7.3.1", | ||
"sinon-chai": "^3.3.0" | ||
} | ||
} |
@@ -24,2 +24,8 @@ declare module 'contentful-ui-extensions-sdk' { | ||
interface Items { | ||
type: string; | ||
linkType?: string; | ||
validations?: Object[]; | ||
} | ||
/* Field API */ | ||
@@ -34,4 +40,8 @@ | ||
type: string; | ||
/** Indicates if a value for this field is required **/ | ||
required: boolean; | ||
/** A list of validations for this field that are defined in the content type. */ | ||
validations: Object[]; | ||
/** Defines the shape of array items **/ | ||
items?: Items; | ||
@@ -70,4 +80,8 @@ /** Gets the current value of the field and locale. */ | ||
type: string; | ||
/** Indicates if a value for this field is required **/ | ||
required: boolean; | ||
/** A list of validations for this field that are defined in the content type. */ | ||
validations: Object[]; | ||
/** Defines the shape of array items **/ | ||
items?: Items; | ||
@@ -107,3 +121,3 @@ /** Gets the current value of the field and locale. */ | ||
linkType?: string; | ||
items?: Object; | ||
items?: Items; | ||
} | ||
@@ -137,2 +151,23 @@ | ||
interface EditorInterface { | ||
sys: Object; | ||
controls?: Array<{ | ||
fieldId: string; | ||
widgetId?: string; | ||
widgetNamespace?: string; | ||
settings?: Object; | ||
}>; | ||
sidebar?: Array<{ | ||
widgetId: string; | ||
widgetNamespace: string; | ||
settings?: Object; | ||
disabled?: boolean; | ||
}>; | ||
editor?: { | ||
widgetId: string; | ||
widgetNamespace: string; | ||
settings?: Object; | ||
} | ||
} | ||
/* Space API */ | ||
@@ -189,3 +224,6 @@ | ||
/** Returns all users who belong to the space. */ | ||
getUsers: () => Promise<CollectionReponse<Object>> | ||
getUsers: () => Promise<CollectionReponse<Object>>, | ||
/** Returns editor interface for a given content type */ | ||
getEditorInterface: (contentTypeId: string) => Promise<EditorInterface> | ||
} | ||
@@ -316,2 +354,22 @@ | ||
/* IDs */ | ||
interface IdsAPI { | ||
user: string; | ||
extension: string; | ||
space: string; | ||
environment: string; | ||
field: string; | ||
entry: string; | ||
contentType: string; | ||
} | ||
interface SharedEditorSDK { | ||
editor: { | ||
editorInterface: EditorInterface, | ||
onLocaleSettingsChanged: (callback: (value: { mode: 'multi' | 'single', focused?: string, active?: Array<string>} ) => any) => Function; | ||
onShowDisabledFieldsChanged: (callback: (value: boolean) => any) => Function; | ||
} | ||
} | ||
export interface BaseExtensionSDK { | ||
@@ -328,4 +386,2 @@ /** Allows to read and update the value of any field of the current entry and to get the entry's metadata */ | ||
locales: LocalesAPI; | ||
/** Methods to update the size of the iframe the extension is contained within. */ | ||
window: WindowAPI; | ||
/** Methods for opening UI dialogs: */ | ||
@@ -339,18 +395,37 @@ dialogs: DialogsAPI; | ||
parameters: ParametersAPI; | ||
/** Exposes method to identify extension's location */ | ||
location: LocationAPI; | ||
} | ||
export type SidebarExtensionSDK = BaseExtensionSDK; | ||
export type EditorExtensionSDK = BaseExtensionSDK & SharedEditorSDK & { | ||
/** A set of IDs actual for the extension */ | ||
ids: Pick<IdsAPI, 'entry' | 'contentType' | 'environment' | 'space' | 'extension' | 'user'>; | ||
}; | ||
export type FieldExtensionSDK = BaseExtensionSDK & { | ||
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 | ||
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'>; | ||
/** 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; | ||
} | ||
export const init: (initCallback: (sdk: BaseExtensionSDK | FieldExtensionSDK | SidebarExtensionSDK | DialogExtensionSDK) => any) => void; | ||
export const init: (initCallback: (sdk: FieldExtensionSDK | SidebarExtensionSDK | DialogExtensionSDK | EditorExtensionSDK) => any) => void; | ||
@@ -362,4 +437,5 @@ export const locations: { | ||
LOCATION_DIALOG: string; | ||
LOCATION_ENTRY_EDITOR: 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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
77431
21
1629
3