Skip to content

Files

This branch is 9318 commits behind contentful/apps:master.

dam-app-base

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 14, 2021
Oct 28, 2021
Jan 7, 2021
Jan 7, 2021
Oct 28, 2021
Jan 7, 2021
Feb 2, 2021
Oct 28, 2021
Nov 2, 2021
Oct 28, 2021
Jan 12, 2021
Jan 7, 2021

CircleCI

dam-app-base

@contentful/dam-app-base is a library that helps you to quickly build an app to integrate your DAM (Digital Asset Management) system of choice with Contentful. Many DAM integrations are very similar, therefore this library provides the boilerplate for your app and you only need to add the code for your specific service.

This library creates an app that can be used in the entry field location to select assets from your DAM service. The library also provides a configuration screen for easy customization.

Usage

import { setup } from '@contentful/dam-app-base';

setup({
  cta: 'Select assets',
  name: 'My DAM App',
  logo: 'https://example.com/logo.svg',
  color: '#d7f0fa',
  description: 'My example DAM App',
  parameterDefinitions: [
    {
      "id": "folder",
      "type": "Symbol",
      "name": "Folder",
      "description": "Preselected folder when selecting assets.",
      "required": true
    }
  ],
  validateParameters: () => null,
  makeThumbnail: asset => asset.thumbnailUrl,
  renderDialog: async (sdk) => {
    const config = sdk.parameters.invocation;

    const container = document.createElement('div');
    container.innerHTML = `<iframe src="https://example.com/dam?folder=${config.folder}" />`;
    document.body.appendChild(container);
  },
  openDialog: async (sdk, currentValue, config) => {
    return await sdk.dialogs.openCurrentApp({
      parameters: { config, currentValue },
    });
  },
  isDisabled: () => false
});

Type Documentation

Apps

These Contentful apps use @contentful/dam-app-base. Look at their source code to learn how they utilize this library: