Skip to content

ExternalSmartElementsLibrary ​

Core class for integrating external smart elements libraries with the Stripo Email Editor.

typescript
class ExternalSmartElementsLibrary

Description ​

ExternalSmartElementsLibrary enables integration of dynamic content libraries that provide smart, data-driven elements for email templates. Smart elements are pre-configured, reusable components that can include dynamic content, personalization, product recommendations, or any complex HTML structures that adapt based on data. This interface allows users to browse and insert these intelligent components directly into their emails.

Import ​

typescript
import { ExternalSmartElementsLibrary } from '@stripoinc/ui-editor-extensions';

Methods ​

openSmartElementsLibrary() ​

Opens the smart elements library interface for element selection.

typescript
openSmartElementsLibrary(
  onDataSelectCallback: ExternalSmartElementSelectCallback,
  onCancelCallback: ExternalSmartElementCancelCallback
): void

Parameters ​

NameTypeDescription
onDataSelectCallbackExternalSmartElementSelectCallbackCalled when user selects a smart element
onCancelCallbackExternalSmartElementCancelCallbackCalled when user cancels

Type Definitions ​

ExternalSmartElement ​

Represents a smart element as a key-value map of properties.

typescript
type ExternalSmartElement = Record<string, string>

Common Properties:

  • p_name - Product name
  • p_image - Product image link
  • p_price - Product price
  • Custom properties based on element type

Callback Types ​

typescript
type ExternalSmartElementSelectCallback = (smartElement: ExternalSmartElement) => void;
type ExternalSmartElementCancelCallback = () => void;