DA App SDK - adobe/da-live GitHub Wiki
The Dark Alley App SDK allows you to work with protected Dark Alley content. This allows you to build fully authenticated custom apps for your creators when you have a special use case Dark Alley does not cover out of the box.
- Fullscreen apps - Great for creating first-class fullscreen apps that can integrate with the entire Adobe Experience Cloud
- Library plugins - Great for enabling integrations into DA's library.
- A site - ex: https://main--geometrixx--aemsites.aem.live
- A page - ex: https://main--geometrixx--aemsites.aem.live/tools/tags.html
- An app - ex: https://main--geometrixx--aemsites.aem.live/tools/tags/tags.js
The SDK is based on the secure PostMessage API. This API allows the SDK to securely pass messages between DA and your application. While not required, importing the SDK in HTML is recommended as it will ensure your application is ready to receive messages from DA.
<!DOCTYPE html>
<html>
<head>
<title>DA App SDK Sample</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="icon" href="data:,">
<!-- Import DA App SDK -->
<script src="https://da.live/nx/utils/sdk.js" type="module"></script>
<!-- Project App Logic -->
<script src="/tools/tags/tags.js" type="module"></script>
</head>
<body>
</body>
</html>
// Import SDK
import DA_SDK from 'https://da.live/nx/utils/sdk.js';
// Import Web Component
import './tag-browser.js';
(async function init() {
const { context, token, actions } = await DA_SDK;
const tagBrowser = document.createElement('da-tag-browser');
tagBrowser.project = context.repo;
tagBrowser.token = token;
tagBrowser.actions = actions;
document.body.append(tagBrowser);
}());
import { LitElement } from 'https://da.live/deps/lit/lit-all.min.js';
export default class DaTagSelector extends LitElement {
static properties = {
project: { type: String },
token: { type: String },
actions: { type: Object },
parent: { type: Object },
};
myButtonClicked(e) {
e.preventDefault();
// ... collect the text to insert in the document
const newText = ...
this.actions.sendText(newText); // Put the text at the cursor in the doc
this.actions.closeLibrary(); // Optional, this will close the plugin widget
}
If you wish to create a library plugin, you will need to add a plugin entry in your sidekick config.json.
"plugins": [
{
"id": "tags",
"title": "Tag Browser",
"environments": ["da-edit"],
"path": "/tools/tags.html"
}
]
Visit (fullscreen): https://da.live/app/aemsites/geometrixx/tools/tags?ref={branch-name}
Visit (library plugin): https://da.live/edit?ref={branch-name}#/aemsites/geometrixx/drafts/developer/plugin-demo
For local development, you can use a branch name of local
which will send requests to http://localhost:3000
.
The best way to notify your users of the fullscreen apps you build is to use Sidekick.
{
"project": "Block Collection"
"apps": [
{
"title": "App demo",
"description": "This is a sample app using the DA SDK.",
"image": "https://main--da-block-collection--aemsites.hlx.page/media_1061934561e8a4f01907e616a0ce0e4b74d63b92e.jpeg",
"url": "https://da.live/app/aemsites/da-block-collection/tools/demo-app"
}
]
}
https://da.live/apps#/aemsites/da-block-collection
At the top of the page you will see a section for the apps you list in Sidekick.