How to use the Extensions SDK package
Overview and usage guide for the Extensions SDK package
Getting started
npm install @structdk/extension-sdkimport { createStructSDK } from '@structdk/extension-sdk';
const struct = createStructSDK({ hostOrigin: 'https://your-struct-instance.struct.com' });Actions (struct.actions)
Accessing context (getContext)
import { createStructSDK } from '@structdk/extension-sdk';
import type { TabContextPayload } from '@structdk/extension-sdk';
const struct = createStructSDK();
const ctx = await struct.actions.getContext<TabContextPayload>();
console.log('Entity:', ctx.entityType, ctx.entityId);
console.log('Slug:', ctx.slug);
Opening a modal (openModal)
Parameters
Closing a modal (closeModal)
Closing a dialog (clostHostContainer)
Display a message notification (showSnackbarMessage)
Parameters
Resizing the container (resizeContainer)
Enable auto resizing of container (enableAutoResize)
Parameters
Events (struct.events)
Changes to entity (onEntityChangedEvent)
Change in language (onLanguageChangedEvent)
Change in segment (onSegmentChangedEvent)
Handle rejected actions (onActionRejectedEvent)
Cleanup
Versioning
Package
Last updated