contentful-ui-extensions-sdk
Advanced tools
Comparing version 3.10.4 to 3.10.5
@@ -26,3 +26,3 @@ 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) { | ||
},{}],"GEtI":[function(require,module,exports) { | ||
function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}module.exports=function(t,r){return{openAlert:o.bind(null,"alert"),openConfirm:o.bind(null,"confirm"),openPrompt:o.bind(null,"prompt"),openExtension:function(e){return t.call("openDialog","extension",n({id:r},i(e)))}.bind(null),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 o(e,n){return t.call("openDialog",e,i(n))}function l(e,n,r){return(r=i(r)).entityType=e,r.multiple=n,t.call("openDialog","entitySelector",r)}function i(t){return"object"===e(t)&&null!==t&&!Array.isArray(t)?t:{}}}; | ||
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)}var t=function(t){return"object"===n(t)&&null!==t&&!Array.isArray(t)},e=function(n){return t(n)?n:{}};module.exports=function(n,t){return{openAlert:o.bind(null,"alert"),openConfirm:o.bind(null,"confirm"),openPrompt:o.bind(null,"prompt"),openExtension:function(o){if((o=e(o)).id=o.id||t.extension,o.id)return n.call("openDialog","extension",o);throw new Error("Extension ID not provided.")},openCurrentApp:function(o){if((o=e(o)).id=t.app,o.id)return n.call("openDialog","app",o);throw new Error("Not in the app context.")},selectSingleEntry:r.bind(null,"Entry",!1),selectSingleAsset:r.bind(null,"Asset",!1),selectMultipleEntries:r.bind(null,"Entry",!0),selectMultipleAssets:r.bind(null,"Asset",!0)};function o(t,o){return n.call("openDialog",t,e(o))}function r(t,o,r){return(r=e(r)).entityType=t,r.multiple=o,n.call("openDialog","entitySelector",r)}}; | ||
},{}],"fqJo":[function(require,module,exports) { | ||
@@ -33,9 +33,9 @@ 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)}}}; | ||
},{}],"A2T1":[function(require,module,exports) { | ||
function t(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e="preInstall",r="postInstall",o=function(t){return"object"===n(t)&&null!==t&&!Array.isArray(t)},u=function(t){return"function"==typeof t},l=function(t){return o(t)&&u(t.then)},a=function(t){if(!u(t))return Promise.resolve({});var n;try{n=t()}catch(r){return Promise.resolve(!1)}var e=n;return l(e)||(e=Promise.resolve(e)),e.then(function(t){return!(t instanceof Error||!1===t)&&(o(t)?t:{})},function(){return!1}).catch(function(){return!1})};module.exports=function(n){var o,l=(t(o={},e,null),t(o,r,null),o);return n.addHandler("appHook",function(t){var e=t.stage,r=t.installationRequestId;return a(l[e]).then(function(t){n.send("appHookResult",{stage:e,installationRequestId:r,result:t})})}),{isInstalled:function(){return n.call("callAppMethod","isInstalled")},getParameters:function(){return n.call("callAppMethod","getParameters")},getCurrentState:function(){return n.call("callAppMethod","getCurrentState")},onConfigure:function(t){!function(t,n){if(l[t])throw new Error("Cannot register a handler twice.");if(!u(n))throw new Error("Handler must be a function.");l[t]=n}(e,t)},setReady:function(){return n.call("callAppMethod","setReady")}}}; | ||
function t(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e="preInstall",r="postInstall",o=function(t){return"object"===n(t)&&null!==t&&!Array.isArray(t)},u=function(t){return"function"==typeof t},l=function(t){return o(t)&&u(t.then)},a=function(t,n,e){if(!u(t))return Promise.resolve(n);var r;try{r=void 0===e?t():t(e)}catch(i){return Promise.resolve(!1)}var a=r;return l(a)||(a=Promise.resolve(a)),a.then(function(t){return!(t instanceof Error||!1===t)&&(o(t)?t:n)},function(){return!1}).catch(function(){return!1})};module.exports=function(n){var o,l=(t(o={},e,null),t(o,r,null),o),i=function(t,n){if(l[t])throw new Error("Cannot register a handler twice.");if(!u(n))throw new Error("Handler must be a function.");l[t]=n};return n.addHandler("appHook",function(t){var o=t.stage,u=t.installationRequestId,i=t.err;return o===e?a(l[o],{}).then(function(t){return n.send("appHookResult",{stage:o,installationRequestId:u,result:t})}):o===r?a(l[o],void 0,i||null).then(function(){return n.send("appHookResult",{stage:o,installationRequestId:u})}):Promise.resolve()}),{setReady:function(){return n.call("callAppMethod","setReady")},isInstalled:function(){return n.call("callAppMethod","isInstalled")},getParameters:function(){return n.call("callAppMethod","getParameters")},getCurrentState:function(){return n.call("callAppMethod","getCurrentState")},onConfigure:function(t){i(e,t)},onConfigurationCompleted:function(t){i(r,t)}}}; | ||
},{}],"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",LOCATION_ENTRY_EDITOR:"entry-editor",LOCATION_PAGE:"page",LOCATION_APP:"app"}; | ||
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",LOCATION_PAGE:"page",LOCATION_APP:"app",LOCATION_APP_CONFIG:"app-config"}; | ||
},{}],"LVu9":[function(require,module,exports) { | ||
var e;function r(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,t)}return n}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach(function(r){t(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function t(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var o=require("./field"),i=require("./field-locale"),u=require("./window"),a=require("./entry"),c=require("./space"),l=require("./dialogs"),s=require("./editor"),f=require("./navigator"),O=require("./app"),p=require("./locations"),d=[y,g,v,T,I],b=(t(e={},p.LOCATION_ENTRY_FIELD,d),t(e,p.LOCATION_ENTRY_FIELD_SIDEBAR,d),t(e,p.LOCATION_ENTRY_SIDEBAR,[y,g,T,I]),t(e,p.LOCATION_ENTRY_EDITOR,[y,g,T]),t(e,p.LOCATION_DIALOG,[y,A,I]),t(e,p.LOCATION_PAGE,[y]),t(e,p.LOCATION_APP,[y,E]),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||p.LOCATION_ENTRY_FIELD)===e}},user:n,parameters:t,locales:{available:o.available,default:o.default,names:o.names,fallbacks:o.fallbacks},space:c(e),dialogs:l(e,i.extension),navigator:f(e,i.extension),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 I(e,r,n){return{window:u(n,e)}}function T(e,r){var n=r.editorInterface;return{editor:s(e,n)}}function g(e,r){var n=r.locales,t=r.contentType,i=r.entry,u=r.fieldInfo;return{contentType:t,entry:a(e,i,u,function(r){return new o(e,r,n.default)})}}function v(e,r){var n=r.field;return{field:new i(e,n)}}function A(e){return{close:function(r){return e.send("closeDialog",r)}}}function E(e){return{platformAlpha:{app:O(e)}}}module.exports=function(e,r,t){return(b[r.location]||d).reduce(function(o,i){return n({},o,{},i(e,r,t))},{})}; | ||
var e;function r(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,t)}return n}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach(function(r){t(e,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function t(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var o=require("./field"),i=require("./field-locale"),a=require("./window"),u=require("./entry"),c=require("./space"),O=require("./dialogs"),l=require("./editor"),s=require("./navigator"),f=require("./app"),p=require("./locations"),d=[A,_,y,P,b],I=(t(e={},p.LOCATION_ENTRY_FIELD,d),t(e,p.LOCATION_ENTRY_FIELD_SIDEBAR,d),t(e,p.LOCATION_ENTRY_SIDEBAR,[A,_,P,b]),t(e,p.LOCATION_ENTRY_EDITOR,[A,_,P]),t(e,p.LOCATION_DIALOG,[A,N,b]),t(e,p.LOCATION_PAGE,[A]),t(e,p.LOCATION_APP,[A,T]),t(e,p.LOCATION_APP_CONFIG,[A,T]),e);function A(e,r){var n=r.user,t=r.parameters,o=r.locales,i=r.ids;return{location:{is:function(e){var n=r.location||p.LOCATION_ENTRY_FIELD;return n===p.LOCATION_APP&&(n=p.LOCATION_APP_CONFIG),e===p.LOCATION_APP&&(e=p.LOCATION_APP_CONFIG),n===e}},user:n,parameters:t,locales:{available:o.available,default:o.default,names:o.names,fallbacks:o.fallbacks},space:c(e),dialogs:O(e,i),navigator:s(e,i.extension),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 b(e,r,n){return{window:a(n,e)}}function P(e,r){var n=r.editorInterface;return{editor:l(e,n)}}function _(e,r){var n=r.locales,t=r.contentType,i=r.entry,a=r.fieldInfo;return{contentType:t,entry:u(e,i,a,function(r){return new o(e,r,n.default)})}}function y(e,r){var n=r.field;return{field:new i(e,n)}}function N(e){return{close:function(r){return e.send("closeDialog",r)}}}function T(e){return{app:f(e),platformAlpha:{app:f(e)}}}module.exports=function(e,r,t){return(I[r.location]||d).reduce(function(o,i){return n({},o,{},i(e,r,t))},{})}; | ||
},{"./field":"daBI","./field-locale":"GnXy","./window":"XV20","./entry":"BZ3n","./space":"iabO","./dialogs":"GEtI","./editor":"fqJo","./navigator":"Y2Q9","./app":"A2T1","./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") |
@@ -27,3 +27,4 @@ const Field = require('./field') | ||
[locations.LOCATION_PAGE]: [makeSharedAPI], | ||
[locations.LOCATION_APP]: [makeSharedAPI, makeAppAPI] | ||
[locations.LOCATION_APP]: [makeSharedAPI, makeAppAPI], | ||
[locations.LOCATION_APP_CONFIG]: [makeSharedAPI, makeAppAPI] | ||
} | ||
@@ -45,3 +46,13 @@ | ||
is: tested => { | ||
return (data.location || locations.LOCATION_ENTRY_FIELD) === tested | ||
let currentLocation = data.location || locations.LOCATION_ENTRY_FIELD | ||
// TODO: retire LOCATION_APP. | ||
if (currentLocation === locations.LOCATION_APP) { | ||
currentLocation = locations.LOCATION_APP_CONFIG | ||
} | ||
if (tested === locations.LOCATION_APP) { | ||
tested = locations.LOCATION_APP_CONFIG | ||
} | ||
return currentLocation === tested | ||
} | ||
@@ -58,3 +69,3 @@ }, | ||
space: createSpace(channel), | ||
dialogs: createDialogs(channel, ids.extension), | ||
dialogs: createDialogs(channel, ids), | ||
navigator: createNavigator(channel, ids.extension), | ||
@@ -105,2 +116,4 @@ notifier: { | ||
return { | ||
app: createApp(channel), | ||
// TODO: remove `platformAlpha` namespace. | ||
platformAlpha: { | ||
@@ -107,0 +120,0 @@ app: createApp(channel) |
@@ -8,7 +8,7 @@ const HOOK_STAGE_PRE_INSTALL = 'preInstall' | ||
const runHandler = handler => { | ||
const runHandler = (handler, defaultResult, handlerArg) => { | ||
// Handler was not registered. Registering a handler is not | ||
// required and we resolve with empty parameters in this case. | ||
// required. We resolve with the default provided in this case. | ||
if (!isFunction(handler)) { | ||
return Promise.resolve({}) | ||
return Promise.resolve(defaultResult) | ||
} | ||
@@ -20,3 +20,3 @@ | ||
try { | ||
maybeResultPromise = handler() | ||
maybeResultPromise = typeof handlerArg === 'undefined' ? handler() : handler(handlerArg) | ||
} catch (err) { | ||
@@ -39,3 +39,3 @@ return Promise.resolve(false) | ||
} else if (!isObject(result)) { | ||
return {} | ||
return defaultResult | ||
} else { | ||
@@ -66,9 +66,20 @@ return result | ||
channel.addHandler('appHook', ({ stage, installationRequestId }) => { | ||
return runHandler(handlers[stage]).then(result => { | ||
channel.send('appHookResult', { stage, installationRequestId, result }) | ||
}) | ||
channel.addHandler('appHook', ({ stage, installationRequestId, err }) => { | ||
if (stage === HOOK_STAGE_PRE_INSTALL) { | ||
return runHandler(handlers[stage], {}).then(result => { | ||
return channel.send('appHookResult', { stage, installationRequestId, result }) | ||
}) | ||
} else if (stage === HOOK_STAGE_POST_INSTALL) { | ||
return runHandler(handlers[stage], undefined, err || null).then(() => { | ||
return channel.send('appHookResult', { stage, installationRequestId }) | ||
}) | ||
} else { | ||
return Promise.resolve() | ||
} | ||
}) | ||
return { | ||
setReady() { | ||
return channel.call('callAppMethod', 'setReady') | ||
}, | ||
isInstalled() { | ||
@@ -81,2 +92,3 @@ return channel.call('callAppMethod', 'isInstalled') | ||
getCurrentState() { | ||
// TODO: retire this method. | ||
return channel.call('callAppMethod', 'getCurrentState') | ||
@@ -87,6 +99,6 @@ }, | ||
}, | ||
setReady() { | ||
return channel.call('callAppMethod', 'setReady') | ||
onConfigurationCompleted(handler) { | ||
setHandler(HOOK_STAGE_POST_INSTALL, handler) | ||
} | ||
} | ||
} |
@@ -1,2 +0,5 @@ | ||
module.exports = function createDialogs(channel, currentExtensionId) { | ||
const isObject = o => typeof o === 'object' && o !== null && !Array.isArray(o) | ||
const prepareOptions = options => (isObject(options) ? options : {}) | ||
module.exports = function createDialogs(channel, ids) { | ||
return { | ||
@@ -6,3 +9,4 @@ openAlert: openSimpleDialog.bind(null, 'alert'), | ||
openPrompt: openSimpleDialog.bind(null, 'prompt'), | ||
openExtension: openExtensionDialog.bind(null), | ||
openExtension: openExtensionDialog, | ||
openCurrentApp: openCurrentAppDialog, | ||
selectSingleEntry: openEntitySelector.bind(null, 'Entry', false), | ||
@@ -14,25 +18,39 @@ selectSingleAsset: openEntitySelector.bind(null, 'Asset', false), | ||
function openExtensionDialog(opts) { | ||
return channel.call('openDialog', 'extension', { | ||
id: currentExtensionId, | ||
...makeOpts(opts) | ||
}) | ||
function openSimpleDialog(type, options) { | ||
return channel.call('openDialog', type, prepareOptions(options)) | ||
} | ||
function openSimpleDialog(type, opts) { | ||
return channel.call('openDialog', type, makeOpts(opts)) | ||
function openExtensionDialog(options) { | ||
options = prepareOptions(options) | ||
// Use provided ID, default to the current extension. | ||
options.id = options.id || ids.extension | ||
if (options.id) { | ||
return channel.call('openDialog', 'extension', options) | ||
} else { | ||
throw new Error('Extension ID not provided.') | ||
} | ||
} | ||
function openEntitySelector(entityType, multiple, opts) { | ||
opts = makeOpts(opts) | ||
opts.entityType = entityType | ||
opts.multiple = multiple | ||
function openCurrentAppDialog(options) { | ||
options = prepareOptions(options) | ||
return channel.call('openDialog', 'entitySelector', opts) | ||
// Force ID of the current app. | ||
options.id = ids.app | ||
if (options.id) { | ||
return channel.call('openDialog', 'app', options) | ||
} else { | ||
throw new Error('Not in the app context.') | ||
} | ||
} | ||
function makeOpts(opts) { | ||
const valid = typeof opts === 'object' && opts !== null && !Array.isArray(opts) | ||
return valid ? opts : {} | ||
function openEntitySelector(entityType, multiple, options) { | ||
options = prepareOptions(options) | ||
options.entityType = entityType | ||
options.multiple = multiple | ||
return channel.call('openDialog', 'entitySelector', options) | ||
} | ||
} |
@@ -8,3 +8,4 @@ module.exports = { | ||
LOCATION_PAGE: 'page', | ||
LOCATION_APP: 'app' | ||
LOCATION_APP: 'app', | ||
LOCATION_APP_CONFIG: 'app-config' | ||
} |
{ | ||
"name": "contentful-ui-extensions-sdk", | ||
"description": "SDK to develop custom UI Extension for the Contentful Web App", | ||
"version": "3.10.4", | ||
"version": "3.10.5", | ||
"author": "Contentful GmbH", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -264,3 +264,3 @@ declare module 'contentful-ui-extensions-sdk' { | ||
interface OpenExtensionOptions { | ||
interface OpenCustomWidgetOptions { | ||
id?: string | ||
@@ -289,3 +289,5 @@ width?: number | 'small' | 'medium' | 'large' | 'fullWidth' | ||
/** Opens an extension in a dialog. */ | ||
openExtension: (options: OpenExtensionOptions) => Promise<any> | ||
openExtension: (options: OpenCustomWidgetOptions) => Promise<any> | ||
/** Opens the current app in a dialog */ | ||
openCurrentApp: (options?: Omit<OpenCustomWidgetOptions, 'id'>) => Promise<any> | ||
/** Opens a dialog for selecting a single entry. */ | ||
@@ -329,11 +331,30 @@ selectSingleEntry: (options?: { | ||
/** Opens an existing entry in the current Web App session. */ | ||
openEntry: (entryId: string, options?: NavigatorAPIOptions) => Promise<void> | ||
openEntry: ( | ||
entryId: string, | ||
options?: NavigatorAPIOptions | ||
) => Promise<{ navigated: boolean; entity: Object }> | ||
/** Opens an existing asset in the current Web App session. */ | ||
openAsset: (assetId: string, options?: NavigatorAPIOptions) => Promise<void> | ||
openAsset: ( | ||
assetId: string, | ||
options?: NavigatorAPIOptions | ||
) => Promise<{ navigated: boolean; entity: Object }> | ||
/** Opens a new entry in the current Web App session. */ | ||
openNewEntry: (contentTypeId: string, options?: NavigatorAPIOptions) => Promise<void> | ||
openNewEntry: ( | ||
contentTypeId: string, | ||
options?: NavigatorAPIOptions | ||
) => Promise<{ navigated: boolean; entity: Object }> | ||
/** Opens a new asset in the current Web App session. */ | ||
openNewAsset: (options: NavigatorAPIOptions) => Promise<void> | ||
openNewAsset: ( | ||
options: NavigatorAPIOptions | ||
) => Promise<{ | ||
navigated: boolean | ||
entity: Object | ||
}> | ||
/** Navigates to a page extension in the current Web App session. Calling without `options` will navigate to the home route of your page extension. */ | ||
openPageExtension: (options?: PageExtensionOptions) => Promise<void> | ||
openPageExtension: ( | ||
options?: PageExtensionOptions | ||
) => Promise<{ | ||
navigated: boolean | ||
path: string | ||
}> | ||
} | ||
@@ -370,2 +391,3 @@ | ||
extension: string | ||
app?: string | ||
space: string | ||
@@ -453,21 +475,23 @@ environment: string | ||
interface AppConfigAPI { | ||
/** Tells the web app that the app is loaded */ | ||
setReady: () => Promise<void> | ||
/** Returns true if an App is installed **/ | ||
isInstalled: () => Promise<boolean> | ||
/** Returns parameters of an App, null otherwise **/ | ||
getParameters: () => Promise<null | Object> | ||
/** Returns current state of an App, null otherwise **/ | ||
getCurrentState: () => Promise<null | Object> | ||
/** Registers a handler to be called to produce parameters for an App **/ | ||
onConfigure: (handler: Function) => Promise<void> | ||
/** Registers a handler to be called once configuration was finished **/ | ||
onConfigurationCompleted: (handler: Function) => Promise<void> | ||
} | ||
export type AppExtensionSDK = BaseExtensionSDK & { | ||
/** A set of IDs actual for the extension */ | ||
ids: Pick<IdsAPI, 'environment' | 'space' | 'user'> | ||
/** A set of IDs actual for the app */ | ||
ids: Pick<IdsAPI, 'environment' | 'space' | 'app' | 'user'> | ||
/** Apps Platform __ALPHA__ methods: subject to change **/ | ||
platformAlpha: { | ||
/** Management methods for App status and installation **/ | ||
app: { | ||
/** Returns true if an App is installed **/ | ||
isInstalled: () => Promise<boolean> | ||
/** Returns parameters of an App, null otherwise **/ | ||
getParameters: () => Promise<null | Object> | ||
/** Returns current state of an App, null otherwise **/ | ||
getCurrentState: () => Promise<null | Object> | ||
/** Registers a handler to be called to produce parameters and target state for an App **/ | ||
onConfigure: (handler: Function) => Promise<void> | ||
/** Tells the web app that the app is loaded */ | ||
setReady: () => Promise<void> | ||
} | ||
} | ||
app: AppConfigAPI | ||
platformAlpha: { app: AppConfigAPI } | ||
} | ||
@@ -493,3 +517,4 @@ | ||
LOCATION_APP: string | ||
LOCATION_APP_CONFIG: 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
88772
1856