Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .github/workflows/jira.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/sca-scan.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2024 Contentstack
Copyright (c) 2022-2025 Contentstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ npm install @contentstack/app-sdk
Alternatively, you can add it inside script tag:

```html
<script src="https://unpkg.com/@contentstack/app-sdk/dist/index.js"></script>
<script src="https://unpkg.com/@contentstack/app-sdk/dist/index.js" integrity="sha512-mcJn/xSGuDGTvKiBvPfjLxbLfRpByRNzdbyldfpNie10BdFHgy7hRxACw3mQ3xbx752N85eqgMPIm8lb4Aq8pw==" crossorigin="anonymous"></script>
```

The above command will install the **app-sdk** library in your project which contains the necessary toolkit you need to manage installed apps on specific locations.
Expand Down Expand Up @@ -77,6 +77,7 @@ Locations refers to the position or the placement of the app (sidebar widget, cu
- **[SidebarWidget](#SidebarWidget)**: It's an object representing the current Sidebar widget reference in the Contentstack UI.
- **[AppConfigWidget](#AppConfigWidget)**: It's an object representing the current App configuration for the current App in the Contentstack UI.
- **[FieldModifierLocation](#FieldModifierLocation)**: It's an object representing the Field Modifier reference over the field in the Contentstack UI.
- **[ContentTypeSidebarWidget](#ContentTypeSidebarWidget)**: It's an object representing the Content Type Sidebar Widget in the Contentstack UI.

# External

Expand Down Expand Up @@ -701,6 +702,47 @@ ContentstackAppSDK.init().then(async function (appSdk) {
});
```

## ContentTypeSidebarWidget

It is an object representing the Content Type Sidebar Widget in the Contentstack UI.

**Kind**: The instance property of [ContentTypeSidebarWidget](#supported-locations)

### ContentTypeSidebarWidget.getData() ⇒ [ContentType](#ContentType)

This method retrieves the current content type data of the sidebar widget.

**Kind**: instance method of [ContentTypeSidebarWidget](#ContentTypeSidebarWidget)

**Returns**: [ContentType](#ContentType) - The current content type data.

### ContentTypeSidebarWidget.onSave(callback)

Executes the specified callback function each time the content type is saved. The callback function receives the updated content type data as an argument.

**Kind**: instance method of [ContentTypeSidebarWidget](#ContentTypeSidebarWidget)

| Param | Type | Description |
| -------- | --------------------- | ---------------------------------------------------------------- |
| callback | <code>function</code> | Function called with the updated content type data on save event |

**Throws**: Will throw an error if the provided `callback` is not a function.

**Example**

```js
const sidebarWidget = new ContentTypeSidebarWidget(
initData,
connection,
emitter
);

// Register onSave callback to execute on each save event.
sidebarWidget.onSave((updatedContentType) => {
console.log("Content type saved:", updatedContentType);
});
```

## frame

It is a class representing an iframe window from the Contentstack UI. Please note that it is not available for Custom Widgets.
Expand Down