|
1 | | -# App Framework SDK |
| 1 | +# Contentstack App SDK Readme |
2 | 2 |
|
3 | | -## JSON Rich text editor plugin |
| 3 | +The Contentstack App SDK allows you to customize your applications. This document will help you integrate the App SDK with your application. |
4 | 4 |
|
5 | | -The **JSON Rich Text Editor Plugins** lets you add/create custom plugins to extend the functionality of your [JSON Rich Text Editor](https://www.contentstack.com/docs/developers/json-rich-text-editor/about-json-rich-text-editor/) as per your needs. You can use the prebuilt JSON RTE plugins by modifying the code to suit your requirement. |
| 5 | +## Getting started |
6 | 6 |
|
7 | | -Some of the examples of the prebuilt JSON Rich Text Editor plugins are: |
| 7 | +To include the App SDK in your project, you need to run the following command: |
8 | 8 |
|
9 | | -- Highlight: Allows you to highlight certain parts of your content, such as a whole line of text or a paragraph. |
10 | | - |
11 | | -- Info Panel: Allows you to place important content inside a colored panel to make it stand out. |
12 | | - |
13 | | -- Word Count: Allows you to track the word count for your JSON Rich Text Editor content. |
14 | | - |
15 | | -You can create JSON Rich Text Editor Plugins using the Contentstack App SDK. For more information, read our [documentation](https://www.contentstack.com/docs/developers/json-rich-text-editor-plugins/about-json-rte-plugins/). |
16 | | - |
17 | | -## Asset Sidebar Extension |
18 | | - |
19 | | -**Asset Sidebar Extensions** enable you to customize and enhance your **asset editing experience**. Using customized extensions, you can tailor your images on Contentstack according to your branding requirements.. |
20 | | - |
21 | | -You can create Asset Sidebar Extensions using the Contentstack App SDK. For more information, read our documentation. |
22 | | - |
23 | | -### AssetSidebarWidget Reference |
24 | | - |
25 | | -It is an object representing the current Asset Sidebar Widget reference in the Contentstack UI. |
| 9 | +```sh |
| 10 | +npm install @contentstack/app-sdk |
| 11 | +``` |
26 | 12 |
|
27 | | -**getData()** |
| 13 | +Alternatively, you can use the following command within the script tag to install the App SDK: |
28 | 14 |
|
29 | | -This method returns the object representing the current asset. |
| 15 | +```html |
| 16 | +<script src="https://unpkg.com/@contentstack/app-sdk@^1.2/dist/index.js"></script> |
| 17 | +``` |
30 | 18 |
|
31 | | -**setData(asset: Partial<AssetData>)** |
| 19 | +### Initializing the App SDK |
32 | 20 |
|
33 | | -This method modifies the properties of the current asset. |
| 21 | +To Initialize the App SDK you need to run the following command: |
34 | 22 |
|
35 | | -**syncAsset()** |
| 23 | +```js |
| 24 | +ContentstackAppSdk.init().then(function (appSdk) { |
| 25 | + // add code here |
| 26 | +}); |
| 27 | +``` |
36 | 28 |
|
37 | | -If your asset has been modified externally, you can use this method to load the new asset and sync its settings with the current asset. |
| 29 | +For more information, please refer to our [App SDK API Reference](https://github.com/contentstack/app-sdk-docs#contentstack-app-sdk-api-reference) document. |
38 | 30 |
|
39 | | -**updateWidth(width: number)** |
| 31 | +## Download the Boilerplate |
40 | 32 |
|
41 | | -This method is used to modify the width of the asset sidebar panel. Using this method, you can resize the panel depending on the resolution of your content. |
| 33 | +You can extend or customize the functionality of Contentstack CMS with Marketplace apps. To simplify and speed up the building process, boilerplates describe repetitive elements in a project. This boilerplate will help you build custom applications for your organization or stack. |
42 | 34 |
|
43 | | -**replaceAsset(file: File)** |
| 35 | +Download the [boilerplate](https://assets.contentstack.io/v3/assets/blt23180bf2502c7444/blt2bccdd28a2d44d1b/62fcb522da3c526fe6314886/app-boilerplate.zip?disposition=download). |
44 | 36 |
|
45 | | -This method is used to replace the current asset with a new file. Unlike setData(), where you can only modify the properties, you can use this method to replace the actual file. |
| 37 | +## UI Locations and Examples |
46 | 38 |
|
47 | | -**onSave(callback: anyFunction)** |
| 39 | +UI Locations allow you to extend Contentstack's functionality. Through these UI locations, you can customize Contentstack's default behavior and UI. Integration of third-party applications is possible using different UI locations. |
48 | 40 |
|
49 | | -This is a callback function that runs after you save the asset settings. |
| 41 | +The Contentstack App SDK currently supports the following UI Locations: |
50 | 42 |
|
51 | | -**onChange(callback: anyFunction)** |
| 43 | +- [Custom Field Location](https://www.contentstack.com/docs/developers/developer-hub/custom-field-location) |
| 44 | +- [Dashboard Location](https://www.contentstack.com/docs/developers/developer-hub/dashboard-location) |
| 45 | +- [Asset Sidebar Location](https://www.contentstack.com/docs/developers/developer-hub/asset-sidebar-location) |
| 46 | +- [App Config Location](https://www.contentstack.com/docs/developers/developer-hub/app-config-location) |
| 47 | +- [RTE Location](https://www.contentstack.com/docs/developers/developer-hub/rte-location) |
| 48 | +- [Sidebar Location](https://www.contentstack.com/docs/developers/developer-hub/sidebar-location) |
52 | 49 |
|
53 | | -This is a callback function that runs every time the user modifies the asset data. |
| 50 | +### Custom Field Location |
54 | 51 |
|
55 | | -**onPublish(callback: anyFunction)** |
| 52 | +Custom Field Location allows you to create custom fields that can be used in your content types. You can integrate with various business applications, such as [Bynder](https://www.contentstack.com/docs/developers/marketplace-apps/bynder), [Cloudinary](https://www.contentstack.com/docs/developers/marketplace-apps/cloudinary), [Shopify](https://www.contentstack.com/docs/developers/marketplace-apps/shopify), by adding them as a custom field to your stack's content type. |
56 | 53 |
|
57 | | -This is a callback function that is executed after a user publishes an asset. |
| 54 | +### Dashboard Location |
58 | 55 |
|
59 | | -**onUnPublish(callback: anyFunction)** |
| 56 | +With the Dashboard Location, you can create widgets for your stack dashboard. Integration with [Google Analytics](https://www.contentstack.com/docs/developers/marketplace-apps/google-analytics/) provides meaningful insights about your website. |
60 | 57 |
|
61 | | -This is a callback function that is executed after you unpublish an asset. |
| 58 | +### Asset Sidebar Location |
62 | 59 |
|
63 | | -**AssetData** |
| 60 | +Using the Asset Sidebar Location, you can create customized sidebar widgets to extend the functionality of your assets. |
64 | 61 |
|
65 | | -It is the property that you can modify using the setData() method. |
| 62 | +Manage, transform, and optimize your stack's assets efficiently using the [Image Preset Builder](https://www.contentstack.com/docs/developers/marketplace-apps/image-preset-builder). |
66 | 63 |
|
67 | | -## Metadata |
| 64 | +### App Config Location |
68 | 65 |
|
69 | | -Metadata is a piece of information that lets you describe or classify an asset/entry. You can manage your digital entities effectively and enable improved accessibility with additional metadata. This object manages all the CRUD operations you can perform with metadata, e.g., adding, updating, or deleting additional metadata. |
| 66 | +App Config UI Location allows you to manage all the app settings centrally. Once configured, all other locations (where the app is installed) can access these settings. |
70 | 67 |
|
| 68 | +### RTE Location |
71 | 69 |
|
72 | | -> Note: The Metadata feature allows users to update their asset metadata or entry metadata without incrementing the asset or entry version. |
| 70 | +The RTE Location allows you to create custom plugins to expand the functionality of your JSON Rich Text Editor. Using the Audience and Variables plugin, you can tailor your content as per your requirements. |
73 | 71 |
|
74 | | -### createMetadata(metadataConfig: IMetadataCreate) |
| 72 | +### Sidebar Location |
75 | 73 |
|
76 | | -```ts |
77 | | -IMetadataCreate { |
78 | | - entity_uid: string; |
79 | | - type?: "asset" | "entry"; // default: "asset"; |
80 | | - extension_uid: string; |
81 | | - _content_type_uid?: string; |
82 | | - locale?: string; |
83 | | - [key: string]: any; // other fields you want to add |
84 | | -} |
85 | | -``` |
| 74 | +The Sidebar Location provides powerful tools for analyzing and recommending ideas for your entry. Use the [Smartling](https://help.smartling.com/hc/en-us/articles/4865477629083) sidebar location to help translate your content. |
86 | 75 |
|
87 | | -This method adds new metadata for an asset or entry. It accepts metadata configuration as required arguments. This config contains basic details that you need to identify the metadata object and other data you need for your app. |
| 76 | +## Using Contentstack styles |
88 | 77 |
|
89 | | -### retrieveMetadata(metadataConfig: IMetadataRetrieve) |
| 78 | +Install the Venus UI library package to style your app according to the Contentstack UI: |
90 | 79 |
|
91 | | -```ts |
92 | | -IMetadateRetrieve { |
93 | | - uid: string; |
94 | | -} |
| 80 | +```sh |
| 81 | +npm i @contentstack/venus-components --save |
95 | 82 | ``` |
96 | 83 |
|
97 | | -This method retrieves metadata for an asset or entry. It accepts metadata configuration as required arguments. This config contains basic details that you need to identify the metadata object you want to retrieve. |
| 84 | +For more information on styling your application, refer to our [style guide](https://www.contentstack.com/docs/developers/venus-component-library/). |
98 | 85 |
|
99 | | -### updateMetadata(metadataConfig: IMetadataUpdate) |
| 86 | +## More information |
100 | 87 |
|
101 | | -```ts |
102 | | -IMetadataUpdate { |
103 | | - uid: string; |
104 | | - [key: string]: any; // other fields you want to update |
105 | | -} |
106 | | -``` |
107 | | - |
108 | | -This method updates existing metadata for an asset or entry. It accepts metadata configuration as required arguments. This config contains basic details that you need to identify the metadata object and other data you want to update. |
| 88 | +- [App SDK API Reference](https://github.com/contentstack/app-sdk-docs#readme) |
| 89 | +- [Marketplace Platform Guides](https://www.contentstack.com/docs/developers/marketplace-platform-guides/) |
| 90 | +- [Marketplace Apps](https://www.contentstack.com/docs/developers/marketplace-apps/) |
| 91 | +- [Contentstack App Development](https://www.contentstack.com/docs/developers/developer-hub/) |
109 | 92 |
|
110 | | -### deleteMetadata(metadataConfig: IMetadataDelete) |
111 | | - |
112 | | -```ts |
113 | | -IMetadateDelete { |
114 | | - uid: string; |
115 | | -} |
116 | | -``` |
| 93 | +## License |
117 | 94 |
|
118 | | -This method deletes existing metadata for an asset or entry. It accepts metadata configuration as required arguments. This config contains basic details that you need to identify the metadata object you want to delete. |
| 95 | +Licensed under [MIT](https://opensource.org/licenses/MIT). |
0 commit comments