Skip to content

Latest commit

 

History

History
160 lines (92 loc) · 3.49 KB

integration.md

File metadata and controls

160 lines (92 loc) · 3.49 KB

@contentful/dam-app-base / Integration

Interface: Integration

Hierarchy

  • Integration

Index

Properties

Properties

color

color: string

The app's primary color


cta

cta: string

Text on the button that is displayed in the field location


description

description: string

Short description of the app


isDisabled

isDisabled: DisabledPredicateFn

Function that should return true when the button should be disabled.

param Currently selected assets

param App configuration

returns true, if the button in the field location should be disabled. false, if the button should be enabled


logo

logo: string

Path to the app's logo


makeThumbnail

makeThumbnail: ThumbnailFn

Returns the url of the thumbnail of an asset.

param Asset

param App configuration

returns Tuple containing (1) the url and (2) the text represantation of the asset (optional)


name

name: string

Name of the app


openDialog

openDialog: OpenDialogFn

Function that gets called when app wants to open a dialog. Should return an updated list of assets as a Promise.

You probably want to call sdk.openCurrentApp.

example

async function openDialog(sdk, currentValue, config) {
  return await sdk.dialogs.openCurrentApp({
    parameters: { config, currentValue },
  });
}

param (https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/)

param List of currently selected assets

param App configuration

returns Promise containing a list of selected assets


parameterDefinitions

parameterDefinitions: ParameterDefinition[]

Parameter definition which can be customized on the app configuration page and used in the callback functions.


renderDialog

renderDialog: RenderDialogFn

Function that gets called within the Iframe when the app is rendered in a dialog location.

example

function renderDialog(sdk) {
  const config = sdk.parameters.invocation;

  const container = document.createElement('div');
  container.innerHTML = `<iframe src="https://example.com/dam?folder=${config.folder}" width="400" height="650" style="border:none;"/>`;
  document.body.appendChild(container);
}

param (https://www.contentful.com/developers/docs/extensibility/app-framework/sdk/)


validateParameters

validateParameters: ValidateParametersFn

Custom code that validates installation parameters that is run before saving.

param Object containg the entered parameters.

returns string containing an error message. null if the parameters are valid.