claspocommon

@claspo/common


@claspo/common / DefaultEventEmitter

DefaultEventEmitter

default

A simple event emitter implementation for pub/sub communication. Supports named events and wildcard listeners that receive all events.

Example

const emitter = new DefaultEventEmitter();
const subscription = emitter.on('user:login', (data) => console.log(data));
emitter.emit('user:login', { userId: 123 });
subscription.off(); // Unsubscribe

Constructors

Constructor

new default(): default;

Creates a new DefaultEventEmitter instance.

Returns

default

Methods

createDefaultListenersState()

static createDefaultListenersState(): ListenersMap;

Creates the initial listeners state with wildcard listener support.

Returns

ListenersMap

Empty listeners map with wildcard entry

emit()

emit(
   eventName, 
   value, 
   params): void;

Emits an event to all registered listeners. Also triggers wildcard listeners that receive all events.

Parameters
ParameterTypeDescription
eventNamestringThe name of the event to emit
valueanyThe value to pass to listeners
paramsanyOptional additional parameters
Returns

void

on()

on(eventName, listener): {
  off: () => void;
};

Registers a listener for a specific event. Use '*' as event name to listen to all events.

Parameters
ParameterTypeDescription
eventNamestringThe event name to listen for
listenerEventCallbackThe callback function to invoke when the event is emitted
Returns
{
  off: () => void;
}

An object with an off method to unsubscribe

NameType
off()() => void

destroy()

destroy(): void;

Removes all event listeners and resets the emitter to initial state.

Returns

void

Properties

PropertyTypeDescription
listenersListenersMapMap of event names to their registered listeners

@claspo/common


@claspo/common / LayoutType

LayoutType

LayoutType

Enumeration of widget layout types. Determines how the widget is positioned and displayed on the page.

Enumeration Members

Enumeration MemberValueDescription
BUILT_IN"BUILT_IN"Widget embedded directly in the page content
DETACHED"DETACHED"Dialog / Popup
FLOATING_BOX"FLOATING_BOX"Floating box positioned relative to viewport corners
FLOATING_BAR"FLOATING_BAR"Horizontal bar fixed to top or bottom of viewport
LAUNCHER"LAUNCHER"Launcher trigger element that opens the main widget
CONTENT_LOCKER"CONTENT_LOCKER"Overlay that locks page content until user interaction

@claspo/common


@claspo/common / RenderMode

RenderMode

RenderMode

Enumeration of widget rendering modes. Determines how the widget responds to model changes.

Enumeration Members

Enumeration MemberValueDescription
STATIC"STATIC"Runtime mode for end users - optimized for performance
UPDATING"UPDATING"Editor mode with live updates - responds to model changes in real-time

@claspo/common


@claspo/common / WidgetInitConfig.interface

WidgetInitConfig.interface

WidgetInitConfigI

Configuration interface for initializing a widget.

Indexable

[key: string]: any

Allows additional custom properties

Properties

PropertyTypeDescription
documentModelClDocumentIDocument model containing widget structure and content
layoutTypeLayoutTypeLayout type
widgetTypeWidgetTypeWidget type
staticResourcesUrlstringBase URL for loading static resources
browserLanguage?stringNeeds for components localization
appearanceLanguage?stringNeeded for Multi-language widget.
optionalDocumentStyles?Record<string, string>Additional CSS custom properties to apply *
viewIndex?numberInitial view (page) index to display
prizePoolModels?PrizePoolModelI[]Prize pool models for gamification features
bundledComponentClasses?any[]Pre-bundled component classes for static rendering
translations?TranslationsINeeded only for Multi-language widgets. Translation strings for internationalization
trackingService?TrackingServiceIService for tracking user interactions (view, click, etc.)
zIndex?numberCSS z-index value for the widget container
disableLayoutAnimations?booleanDisables layout animations*
disableGlobalScroll?booleanDisables global scroll locking when widget is open
hostUrl?stringHost URL for API requests

TrackingServiceI

Service interface for tracking user interactions and events.

Properties

PropertyTypeDescription
send(eventName, payload?) => voidSends a custom event with optional payload
trackClick(elementId, payload?) => voidTracks a click event on a specific element
trackTargetAction(actionType, payload?) => voidTracks a target action (conversion, goal completion, etc.)

TranslationsI

type TranslationsI = Record<string, Record<string, string>>;

Translation dictionary mapping language codes to key-value translation pairs.

@claspo/common


@claspo/common / WidgetType

WidgetType

WidgetType

Enumeration of widget types. Defines the primary purpose and behavior of a widget.

Enumeration Members

Enumeration MemberValueDescription
SUBSCRIPTION_FORM"SUBSCRIPTION_FORM"Form for collecting email subscriptions
INFORMER"INFORMER"Informational popup or notification
REQUEST_FORM"REQUEST_FORM"General-purpose form for collecting user data
LAUNCHER"LAUNCHER"Trigger element that opens another widget
AGE_VERIFY"AGE_VERIFY"Age verification gate
TEASER"TEASER"Trigger element that opens the main widget

@claspo/common


@claspo/common / async/debounce

async/debounce

default()

function default<T>(func, timeout): DebouncedFunction<T>;

Creates a debounced version of a function that delays execution until after the specified timeout has elapsed since the last call.

Type Parameters

Type ParameterDescription
T extends (...args) => anyThe function type to debounce

Parameters

ParameterTypeDescription
funcTThe function to debounce
timeoutnumberDelay in milliseconds before executing (default: 300)

Returns

DebouncedFunction<T>

A debounced version of the function

Example

const debouncedSearch = debounce((query: string) => {
  fetch(`/api/search?q=${query}`);
}, 500);

@claspo/common


@claspo/common / component-manifest/ComponentManifest.interface

component-manifest/ComponentManifest.interface

ManifestMappingType

Field mapping types for integration field configuration.

Enumeration Members

Enumeration MemberValue
TEXT"TEXT"
TEXT_AREA"TEXT_AREA"
INTEGER"INTEGER"
FLOAT"FLOAT"
SELECT"SELECT"
CHECKBOX_LIST"CHECKBOX_LIST"
CHECKBOX"CHECKBOX"
DATE"DATE"
DATE_TIME"DATE_TIME"

ComponentManifestI

Component manifest defining component configuration, properties, and editor controls.

Properties

PropertyTypeDescription
namestringComponent name for registration
componentTypeClComponentTypeComponent type identifier
versionstringComponent version
contextMenuModelBaseContextMenuManifestModelI[]Context menu configuration for editor
floatingControlsModelBaseFloatingControlManifestModelI[]Floating controls configuration for editor
propertyPaneModelPropertyPaneManifestIProperty pane configuration for editor
propsClBaseComponentPropsIDefault component properties
metaDescriptionComponentManifestMetaDescriptionIComponent metadata for editor display
i18nPropertyPaneModel?PropertyPaneManifestIProperty pane for i18n settings
i18nPropPaths?string[]Property paths that support internationalization for multilingual content. The editor extracts values from these paths and sends them to an AI-based translator. The renderer then replaces the original values with the translated results using the same paths. Example [ "content,label", "control,options,[id],label" ] Note: [id] extracts all object keys
focusParentOnClick?booleanIf true, clicking current component focuses it's parent component
preventDraggable?booleanIf true, prevents drag operations for current component
recursiveRemove?booleanIf true, removes children when component is removed
i18n?ComponentManifestTranslationITranslation strings by language. Used by components (e.g. error messages). Example { * "en": { * "control,validation,validationErrors,REQUIRED": "Required field", * }, *
children?ClBaseComponentI[]Default child components
mappingTypes?ManifestMappingType[]Field mapping types that component can handle
focusableElements?string[]Element names that can receive focus
actionsConditions?{ remove?: string; replace?: string; cut?: string; copy?: string; duplicate?: string; paste?: string; move?: string; }Conditions for enabling/disabling editor actions
actionsConditions.remove?string-
actionsConditions.replace?string-
actionsConditions.cut?string-
actionsConditions.copy?string-
actionsConditions.duplicate?string-
actionsConditions.paste?string-
actionsConditions.move?string-
autoContrast?AutoContrastI[]Auto-contrast configuration for color adjustments
keepGeneralTabOpenUntilInteracted?booleanIf true, keeps general tab open until user interacts
isExternalStartCapable?booleanIf true, component can be started externally
waitForResourcesLoad?booleanIf true, waits for resources to load before showing

ComponentManifestTranslationI

Translation strings organized by language code.

Indexable

[languageCode: string]: ComponentManifestTranslationItemI

ComponentManifestTranslationItemI

Translation items mapping property paths to translated values.

Indexable

[propPath: string]: string

ComponentManifestMetaDescriptionI

Component metadata for editor display and sorting.

Properties

PropertyTypeDescription
labelComponentManifestDescriptionLabelItemIDisplay labels by language
sortWeight?numberSort weight for ordering in component list
icon?stringIcon identifier for component

ComponentManifestDescriptionLabelItemI

Component labels by language code.

Indexable

[languageCode: string]: string

AutoContrastI

Auto-contrast configuration for automatic color adjustments.

Properties

PropertyTypeDescription
masterAutoContrastMemberIMaster color source
slaveAutoContrastMemberISlave color to adjust
enabledPropPathstring[]Property path to enabled flag

AutoContrastMemberI

Member of an auto-contrast pair.

Properties

PropertyTypeDescription
elementstringTarget element name
elementProp?stringElement property name
elementSubProp?stringElement sub-property name
propPath?string[]Alternative property path
dimmed?boolean | nullIf true, color is dimmed

@claspo/common


@claspo/common / component-manifest/ContextMenuManifest.interface

component-manifest/ContextMenuManifest.interface

ContextMenuManifestModelType

Context menu item types.

Enumeration Members

Enumeration MemberValueDescription
GROUP"GROUP"Group container for menu items
CONTROL"CONTROL"Individual control item

ContextMenuManifestModelName

Predefined context menu control names.

Enumeration Members

Enumeration MemberValue
FOCUS_PARENT_COMPONENT"FOCUS_PARENT_COMPONENT"
COMPONENT_OPERATIONS"COMPONENT_OPERATIONS"
BRING_BACK_FORWARD"BRING_BACK_FORWARD"

BaseContextMenuManifestModelI

Base interface for context menu manifest items.

Extended by

Properties

PropertyTypeDescription
typeContextMenuManifestModelTypeItem type (group or control)
name?ContextMenuManifestModelNamePredefined control name
propPath?string[]Property path in component model
element?stringTarget element name
elementProp?stringElement property name
elementSubProp?stringElement sub-property name
children?BaseContextMenuManifestModelI[]Child menu items

GroupContextMenuManifestModelI

Base interface for context menu manifest items.

Extends

Properties

PropertyTypeDescription
typeContextMenuManifestModelTypeItem type (group or control)
name?ContextMenuManifestModelNamePredefined control name
propPath?string[]Property path in component model
element?stringTarget element name
elementProp?stringElement property name
elementSubProp?stringElement sub-property name
childrenBaseContextMenuManifestModelI[]Child menu items

FocusParentComponentContextMenuManifestModelI

Base interface for context menu manifest items.

Extends

Properties

PropertyTypeDescription
typeContextMenuManifestModelTypeItem type (group or control)
name?ContextMenuManifestModelNamePredefined control name
propPath?string[]Property path in component model
element?stringTarget element name
elementProp?stringElement property name
elementSubProp?stringElement sub-property name
children?BaseContextMenuManifestModelI[]Child menu items
params?FocusParentComponentContextMenuManifestParamsI-

FocusParentComponentContextMenuManifestParamsI

Properties

PropertyType
hideForEntryTypeClComponentType

@claspo/common


@claspo/common / component-manifest/FloatingControlManifest.interface

component-manifest/FloatingControlManifest.interface

FloatingControlManifestModelType

Floating control item types.

Enumeration Members

Enumeration MemberValueDescription
GROUP"GROUP"Group container for controls
CONTROL"CONTROL"Individual control

FloatingControlManifestModelName

Predefined floating control names.

Enumeration Members

Enumeration MemberValue
SIZE"SIZE"
MARGIN"MARGIN"
PARENT_ALIGNMENT"PARENT_ALIGNMENT"
CONTAINER_PADDING"CONTAINER_PADDING"
SLIDES_MANAGEMENT"SLIDES_MANAGEMENT"
COLUMNS_PROPORTIONS"COLUMNS_PROPORTIONS"
VIEW_SWITCHER"VIEW_SWITCHER"
ROTATION"ROTATION"

BaseFloatingControlManifestModelI

Base interface for floating control manifest items. Floating controls appear around selected components in the editor.

Extended by

Properties

PropertyTypeDescription
typeFloatingControlManifestModelType-
name?FloatingControlManifestModelName-
propPath?string[]-
element?string-
elementProp?string-
elementSubProp?string-
propPathCondition?string-
children?BaseFloatingControlManifestModelI[]Child controls
params?anyControl-specific parameters

GroupFloatingControlManifestModelI

Base interface for floating control manifest items. Floating controls appear around selected components in the editor.

Extends

Properties

PropertyTypeDescription
typeFloatingControlManifestModelType-
name?FloatingControlManifestModelName-
propPath?string[]-
element?string-
elementProp?string-
elementSubProp?string-
propPathCondition?string-
params?anyControl-specific parameters
childrenBaseFloatingControlManifestModelI[]Child controls

SizeFloatingControlManifestModelI

Base interface for floating control manifest items. Floating controls appear around selected components in the editor.

Extends

Properties

PropertyTypeDescription
typeFloatingControlManifestModelType-
name?FloatingControlManifestModelName-
propPath?string[]-
element?string-
elementProp?string-
elementSubProp?string-
propPathCondition?string-
children?BaseFloatingControlManifestModelI[]Child controls
params?{ width?: SizeDimensionFloatingControlManifestParamsI; height?: SizeDimensionFloatingControlManifestParamsI; rotation?: RotationFloatingControlManifestParamsI; }Control-specific parameters
params.width?SizeDimensionFloatingControlManifestParamsI-
params.height?SizeDimensionFloatingControlManifestParamsI-
params.rotation?RotationFloatingControlManifestParamsI-

SizeDimensionFloatingControlManifestParamsI

Properties

PropertyType
hide?boolean
getValueFromElement?string
minValue?number
element?string
elementProp?string
propPath?string

RotationFloatingControlManifestParamsI

Properties

PropertyType
element?string
elementProp?string

ColumnsProportionsFloatingControlManifestModelI

Base interface for floating control manifest items. Floating controls appear around selected components in the editor.

Extends

Properties

PropertyTypeDescription
typeFloatingControlManifestModelType-
name?FloatingControlManifestModelName-
propPath?string[]-
element?string-
elementProp?string-
elementSubProp?string-
propPathCondition?string-
children?BaseFloatingControlManifestModelI[]Child controls
params?ColumnsProportionsFloatingControlManifestParamsIControl-specific parameters

ColumnsProportionsFloatingControlManifestParamsI

Properties

PropertyType
parent?boolean

ViewSwitcherFloatingControlsManifestModelI

Base interface for floating control manifest items. Floating controls appear around selected components in the editor.

Extends

Properties

PropertyTypeDescription
typeFloatingControlManifestModelType-
name?FloatingControlManifestModelName-
propPath?string[]-
element?string-
elementProp?string-
elementSubProp?string-
propPathCondition?string-
children?BaseFloatingControlManifestModelI[]Child controls
params{ views: ViewSwitcherFloatingControlsManifestViewI[]; }Control-specific parameters
params.viewsViewSwitcherFloatingControlsManifestViewI[]-

ViewSwitcherFloatingControlsManifestViewI

Properties

PropertyType
labelstring
valuestring

@claspo/common


@claspo/common / component-manifest/PropertyPaneManifest.interface

component-manifest/PropertyPaneManifest.interface

PropertyPaneManifestModelType

Enumeration Members

Enumeration MemberValue
CONTROL"CONTROL"
TEXT"TEXT"
GROUP"GROUP"

ClPropertyPaneManifestModelName

Enumeration Members

Enumeration MemberValue
SIZE"SIZE"
INDENTATION"INDENTATION"
ALIGNMENT"ALIGNMENT"
BACKGROUND"BACKGROUND"
BORDERS"BORDERS"
BOX_SHADOW"BOX_SHADOW"
BORDER_RADIUS"BORDER_RADIUS"
TEXT_PARAMS"TEXT_PARAMS"
TEXT_INPUT"TEXT_INPUT"
SWITCH"SWITCH"
INPUT_VALIDATION"INPUT_VALIDATION"
INPUT_LABEL"INPUT_LABEL"
SELECT"SELECT"
RADIO_BUTTONS"RADIO_BUTTONS"
IMAGE_SOURCES"IMAGE_SOURCES"
COUNTRY_PHONE_SELECT"COUNTRY_PHONE_SELECT"
HOVER_ANIMATION"HOVER_ANIMATION"
ACTIONS"ACTIONS"
DATEPICKER"DATEPICKER"
DISPLAY"DISPLAY"
COMPONENT_OPTIONS"COMPONENT_OPTIONS"
COLOR_SELECT"COLOR_SELECT"
VIDEO_URL"VIDEO_URL"
VIDEO_CUSTOM_COVER"VIDEO_CUSTOM_COVER"
DATE_FORMAT"DATE_FORMAT"
ICON_SELECT"ICON_SELECT"
INTEGRATION_FIELD_MAPPING"INTEGRATION_FIELD_MAPPING"
LIST_POSITION"LIST_POSITION"
INSERT_BLOCK"INSERT_BLOCK"
NUMBER_INPUT"NUMBER_INPUT"
PRIZE_SETTINGS"PRIZE_SETTINGS"

TabPropertyPaneManifestType

Enumeration Members

Enumeration MemberValue
DESKTOP_STYLES"DESKTOP_STYLES"
MOBILE_STYLES"MOBILE_STYLES"

TextPropertyPaneManifestParamsType

Enumeration Members

Enumeration MemberValue
SECONDARY"SECONDARY"

SizePropertyPaneOption

Enumeration Members

Enumeration MemberValue
FIXED"fixed"
FILL"fill"
HUG"hug"

IndentationPropertyPaneManifestType

Enumeration Members

Enumeration MemberValue
PADDING"PADDING"
MARGIN"MARGIN"

PropertyPaneManifestI

Property pane manifest defining editor panel structure.

Properties

PropertyTypeDescription
contentBasePropertyPaneManifestModelI[]Content tab controls
general?BasePropertyPaneManifestModelI[]General/style tab controls
header?BasePropertyPaneManifestModelI[]Header controls

BasePropertyPaneManifestModelI

Base interface for property pane controls and groups.

Extended by

Properties

PropertyTypeDescription
typePropertyPaneManifestModelType-
name?ClPropertyPaneManifestModelNameonly CONTROL type requires this field
propPath?string[]propPath is used to specify full path to the prop unline combination of element, elementProp and optional elementSubProp
element?string-
elementProp?string-
elementSubProp?string-
propPathCondition?string-
params?any-
displayCondition?string-
hideSyncSelect?boolean-
syncSelectDisplayCondition?string-
syncSelectOptions?(string | null)[]-
children?BasePropertyPaneManifestModelI[]only GROUP type requires this field

DisableControlIfPropPathMatchValueParamsI

Properties

PropertyType
propPathstring[]
valueany

TransformerConfig

Type Parameters

Type Parameter
TParams

Properties

PropertyType
namestring
params?TParams

GroupPropertyPaneManifestModelI

Extends

Properties

PropertyTypeDescription
childrenBasePropertyPaneManifestModelI[]only GROUP type requires this field

BorderPropertyPaneManifestModelI

Extends

Properties


BorderPropertyPaneManifestParamsI

Properties

PropertyType
minValue?number
maxValue?number
hideAdditionalParams?boolean

BackgroundPropertyPaneManifestModelI

Extends

Properties


BackgroundPropertyPaneManifestParamsI

Properties

PropertyType
labelstring
onlyColorSelectionboolean
disableGradientSelectionboolean
hideSwitch?boolean
propertystring
disabledColor?string

TabPropertyPaneManifestModelI

Extends

Properties

PropertyTypeDescription
childrenBasePropertyPaneManifestModelI[]only GROUP type requires this field
paramsTabPropertyPaneManifestParamsI-

TabPropertyPaneManifestParamsI

Properties

PropertyType
labelstring
type?TabPropertyPaneManifestType

TextPropertyPaneManifestModelI

Extends

Properties


TextPropertyPaneManifestParamsI

Properties

PropertyType
textstring
translateParams?object
type?SECONDARY
styles?string[]
classes?string[]

SizePropertyPaneManifestModelI

Extends

Properties

PropertyType
params{ [key: string]: SizePropertyPaneManifestParamsI; }

SizePropertyPaneManifestParamsI

Properties

PropertyType
optionsSizePropertyPaneOption[]
minValue?number
element?string
elementProp?string
propPath?string

IndentationPropertyPaneManifestModelI

Extends

Properties


IndentationPropertyPaneManifestParamsI

Properties

PropertyType
indentationTypeIndentationPropertyPaneManifestType
horizontalOnly?boolean

HoverAnimationPropertyPaneManifestModelI

Extends

Properties


HoverAnimationPropertyPaneManifestParamsI

Properties

PropertyType
animationTypeProp{ elementProp?: string; propPath?: string[]; }
animationTypeProp.elementProp?string
animationTypeProp.propPath?string[]

ColorSelectPropertyPaneManifestModelI

Extends

Properties


ColorSelectPropertyPaneManifestParamsI

Properties

PropertyType
label?string
validators?BaseInputValidatorsI

BaseInputValidatorsI

Properties

PropertyType
requiredboolean
min?number
max?number

TextInputPropertyPaneManifestModelI

Extends

Properties


TextInputPropertyPaneManifestParamsI

Properties

PropertyType
label?string
subLabel?string
description?string
placeholder?string
validators?BaseInputValidatorsI
defaultValue?any
transformers?TransformerConfig<undefined>[]

TextColorPropertyPaneManifestParamsI

Properties

PropertyType
label?string
mode?string

SwitchPropertyPaneManifestModelI

Extends

Properties


SwitchPropertyPaneManifestParamsI

Properties

PropertyType
labelstring
description?string
tooltip?string
getValueMapper?object
setValueMapper?object
boldLabel?boolean

SwitchWithInputPropertyPaneManifestModelI

Extends

Properties


SwitchWithInputPropertyPaneManifestParamsI

Properties

PropertyType
labelstring
switchPropPathstring[]
inputPropPathstring[]
unitMeasure?string
minValue?number
maxValue?number
switchOnDependantSwitchByPropPath?string[]
switchOffDependantSwitchByPropPath?string[]

DisplayPropertyPaneManifestModelI

Extends

Properties


DisplayPropertyPaneManifestParamsI

Properties

PropertyType
labelstring
description?string
displayPropertyValue?string

InputValidationPropertyPaneManifestModelI

Extends

Properties


ValidationPropertyPaneManifestParamsI

Properties

PropertyType
validationPropPathstring[]
requiredboolean

SelectOptionI

Properties

PropertyType
labelstring
valueany

SelectPropertyPaneManifestModelI

Extends

Properties


SelectPropertyPaneManifestParamsI

Properties

PropertyType
labelstring
optionsSelectOptionI[]
overlayWidth?number
defaultValue?any

TextStylesPropertyPaneManifestModelI

Extends

Properties


TextStylesPropertyPaneManifestParamsI

Properties

PropertyType
label?string
element?string
showPlaceholderControl?boolean
hideTextAlign?boolean
hideStyleSelect?boolean
hideFontSize?boolean
fontSizePlaceholder?string
hideTextShadow?boolean
hideLetterSpacing?boolean

RadioButtonsPropertyPaneManifestModelI

Extends

Properties


RadioButtonsPropertyPaneManifestParamsI

Properties

PropertyType
labelstring
optionsSelectOptionI[]
reactToAnyStateChanges?boolean

OptionsPropertyPaneManifestModelI

Extends

Properties


OptionsPropertyPaneManifestParamsI

Properties

PropertyType
header?string
tooltip?string
origin?boolean
optionsPropPathstring[]
optionsAlphabeticSortPropPathstring[]
integrationNamePropPathstring[]

DatepickerPropertyPaneManifestModelI

Extends

Properties


DatepickerPropertyPaneManifestParamsI

Properties

PropertyType
labelstring
showTime?boolean
placeholder?boolean
minDate?string
rawDate?boolean

FloatingComponentPositionPropertyPaneManifestModelI

Extends

Properties


FloatingComponentPositionPropertyPaneManifestParamsI

Properties

PropertyType
labelstring
xnumber
ynumber

ActionsPropertyPaneManifestModelI

Extends

Properties


ActionsPropertyPaneManifestParamsI

Properties

PropertyType
origin?boolean

IntegrationFieldMappingPropertyPaneManifestModelI

Extends

Properties


IntegrationFieldMappingPropertyPaneManifestParamsI

Properties

PropertyType
namePropPathstring[]
integrationNamePropPathstring[]
groupNamePropPathstring[]
fieldNamePropPathstring[]
fieldTypePropPathstring[]
validationPropPathstring[]
placeholderPropPathstring[]
labelPropPathstring[]
optionsPropPathstring[]

InsertBlockPropertyPaneManifestModelI

Extends

Properties


InsertBlockPropertyPaneManifestParamsI

Properties

PropertyType
elementstring
labelstring
isLinkAvailableboolean
originboolean

IconSelectPaneManifestModelI

Extends

Properties


IconSelectPaneManifestParamsI

Properties

PropertyType
optionsIconSelectOptionForPropertyPaneManifestI[]
label?string
excludeImageTypes?string[]
enableCustomIcons?boolean
storageType?string

IconSelectOptionForPropertyPaneManifestI

Properties

PropertyType
iconstring
valueany
inlineSvg?boolean

PrizeSettingsPropertyPaneManifestModelI

Extends

Properties


PrizeSettingsPropertyPaneManifestParamsI

Properties

PropertyType
minOptions?number
linkedGamifiedComponentType?| ClComponentType | null
prizeImageEnabled?boolean

@claspo/common


@claspo/common / document/Document.interface

document/Document.interface

ClComponentType

Enumeration of component types in the widget system.

Enumeration Members

Enumeration MemberValue
VIEW"VIEW"
CONTAINER"CONTAINER"
TEXT"TEXT"
INPUT"INPUT"
BUTTON"BUTTON"
IMAGE"IMAGE"
CONSENT"CONSENT"
COUNTDOWN_TIMER"COUNTDOWN_TIMER"
PROMO_CODE"PROMO_CODE"
MULTIPLE_INPUT"MULTIPLE_INPUT"
VIDEO"VIDEO"
SLIDER"SLIDER"
SLIDE"SLIDE"
SOCIAL"SOCIAL"
COLUMNS"COLUMNS"
COLUMN"COLUMN"
PRIZE_BASED_GAMING"PRIZE_BASED_GAMING"

ClDocumentHandlerType

Enumeration of handler event types.

Enumeration Members

Enumeration MemberValue
CLICK"CLICK"

ClDocumentActionType

Enumeration of available action types.

Enumeration Members

Enumeration MemberValue
SHOW_WIDGET"SHOW_WIDGET"
OPEN_LINK"OPEN_LINK"
SUBSCRIBE_CONTACT"SUBSCRIBE_CONTACT"
REQUEST"REQUEST"
CLOSE_WIDGET"CLOSE_WIDGET"
GO_TO_VIEW"GO_TO_VIEW"
GO_TO_PREVIOUS_VIEW"GO_TO_PREVIOUS_VIEW"
GO_TO_NEXT_VIEW"GO_TO_NEXT_VIEW"
CLICK"CLICK"

ClDocumentOpenLinkActionTarget

Link target options.

Enumeration Members

Enumeration MemberValueDescription
SELF"_self"Open in same window
BLANK"_blank"Open in new tab/window

ClWidgetVerticalPosition

Vertical position options for widgets.

Enumeration Members

Enumeration MemberValue
TOP"TOP"
CENTER"CENTER"
BOTTOM"BOTTOM"

ClWidgetHorizontalPosition

Horizontal position options for widgets.

Enumeration Members

Enumeration MemberValue
LEFT"LEFT"
CENTER"CENTER"
RIGHT"RIGHT"

ClLauncherEntryAnimationType

Launcher entry animation types.

Enumeration Members

Enumeration MemberValue
SLIDE_TO_TOP"SLIDE_TO_TOP"
SLIDE_TO_BOTTOM"SLIDE_TO_BOTTOM"
SLIDE_TO_LEFT"SLIDE_TO_LEFT"
SLIDE_TO_RIGHT"SLIDE_TO_RIGHT"

ClLoopAnimationType

Available loop animation types.

Enumeration Members

Enumeration MemberValue
PULSE"PULSE"
VIBRATE"VIBRATE"
WOBBLE"WOBBLE"
SHAKE"SHAKE"
JELLO"JELLO"
BOUNCE"BOUNCE"
BLINK"BLINK"
FLICKER"FLICKER"
PING"PING"

ClCloseButtonHorizontalPosition

Close button horizontal position options.

Enumeration Members

Enumeration MemberValue
LEFT"LEFT"
RIGHT"RIGHT"

ClDocumentI

Root document structure containing views and shared configuration.

Properties

PropertyTypeDescription
viewsClBaseComponentI[]Array of view components (pages/screens)
sharedClDocumentSharedIShared document configuration and styling

ClBaseComponentI

Base interface for all component models in the document tree.

Properties

PropertyTypeDescription
idstringUnique component identifier
pathnumber[]Position path in the component tree (array of indices)
typeClComponentTypeComponent type identifier
versionstringComponent version string
propsClBaseComponentPropsIComponent properties and configuration
namestringComponent name for registration
label?stringDisplay label (used for views)
children?ClBaseComponentI[]Child components
focusParentOnClick?booleanIf true, clicking focuses the parent instead
preventDraggable?booleanIf true, prevents drag-and-drop on this component
recursiveRemove?booleanIf true, removing this component removes children recursively

ClBaseComponentPropsI

Component properties interface with styling, handlers, and content.

Properties

PropertyTypeDescription
adaptiveStyles?BaseComponentAdaptiveStylesIPlatform-specific styles (desktop/mobile)
styles?ClBaseComponentElementParamsI[]Environment-independent styles
handlers?ClDocumentHandlerI[]Event handlers attached to the component
content?anyContent configuration (text, images, etc.)
control?anyForm control configuration
isAlignRestricted?booleanIf true, alignment options are restricted
floating?booleanIf true, component floats above other content

BaseComponentAdaptiveStylesI

Platform-specific style configurations.

Properties

PropertyTypeDescription
desktopClBaseComponentElementParamsI[]Desktop viewport styles
mobileClBaseComponentElementParamsI[]Mobile viewport styles

ClBaseComponentElementParamsI

Element styling parameters for a single element within a component.

Properties

PropertyTypeDescription
elementstringElement identifier (e.g., 'host', 'button', 'label')
styleAttributesClComponentStyleAttributesICSS style properties
hoverStyleAttributes?ClComponentStyleAttributesIStyles applied on hover
hoverAnimationType?stringType of hover animation
placeholderStyleAttributes?ClComponentStyleAttributesIStyles for placeholder text (inputs)
markerStyleAttributes?ClComponentStyleAttributesIStyles for list markers
params?anyAdditional element parameters
classes?stringCSS class names to apply

ClComponentStyleAttributesI

Map of CSS style property names to values.

Indexable

[key: string]: string

ClDocumentHandlerI

Event handler configuration for a component.

Properties

PropertyTypeDescription
typeCLICKType of event to handle
actionsClDocumentActionI<any>[]Actions to execute when event fires
relativeSelector?stringOptional CSS selector for targeting child elements

ClDocumentActionI

Action configuration for event handlers.

Type Parameters

Type ParameterDescription
TType of action parameters

Properties

PropertyTypeDescription
typeClDocumentActionTypeAction type identifier
params?TAction-specific parameters

ClDocumentOpenLinkActionParamsI

Parameters for the OPEN_LINK action.

Properties

PropertyTypeDescription
linkstringURL to open
targetClDocumentOpenLinkActionTargetTarget window for the link
tagsEnabledbooleanIf true, merge tags in the URL are processed
trackClickParams?{ [key: string]: string; }Additional tracking parameters
customData?stringCustom data to pass with the action
countAsTargetAction?booleanIf true, counts as a conversion/target action

ClDocumentGoToViewActionParamsI

Parameters for navigating to a specific view.

Properties

PropertyTypeDescription
viewIdstringTarget view identifier
trackClick?booleanIf true, tracks the navigation click
trackClickParams?{ [key: string]: string; }Additional tracking parameters
countAsTargetAction?booleanIf true, counts as a conversion/target action

ClDocumentGoToNextViewActionParamsI

Parameters for navigating to the next view.

Properties

PropertyTypeDescription
trackClick?booleanIf true, tracks the navigation click
trackClickParams?{ [key: string]: string; }Additional tracking parameters

ClDocumentGoToPreviousViewActionParamsI

Parameters for navigating to the previous view.

Properties

PropertyTypeDescription
trackClick?booleanIf true, tracks the navigation click
trackClickParams?{ [key: string]: string; }Additional tracking parameters
countAsTargetAction?booleanIf true, counts as a conversion/target action

ClDocumentCloseWidgetActionParamsI

Parameters for closing the widget.

Properties

PropertyTypeDescription
trackClickParams?{ [key: string]: string; }Additional tracking parameters
countAsTargetAction?booleanIf true, counts as a conversion/target action

ClDocumentSubscribeContactActionParamsI

Parameters for the subscribe contact action.

Extended by

Properties

PropertyTypeDescription
viewIndexOnSuccessnumberView index to show on successful subscription
viewIndexOnSubscribednumberView index to show if already subscribed
viewIndexOnErrornumberView index to show on error

ClDocumentShowWidgetActionParamsI

Parameters for showing another widget.

Properties

PropertyTypeDescription
variantId?numberVariant ID of the widget to show
closeWidget?booleanIf true, closes current widget when showing the new one
countAsTargetAction?booleanIf true, counts as a conversion/target action

ClDocumentRequestActionParamsI

Parameters for the request/submit action.

Extends

Properties

PropertyTypeDescription
viewIndexOnSuccessnumberView index to show on successful subscription
viewIndexOnSubscribednumberView index to show if already subscribed
viewIndexOnErrornumberView index to show on error
countAsTargetAction?booleanIf true, counts as a conversion/target action

ClDocumentSharedI

Shared document configuration applied across all views.

Properties

PropertyTypeDescription
headerFontFamilystringFont family for headers
textFontFamilystringFont family for body text
textClasses{ [key: string]: ClDocumentSharedTextClassI; }Predefined text style classes
googleFontsstring[]Google Fonts to load
floatingBox?ClFloatingBoxParamsIFloating box layout configuration
floatingBar?ClFloatingBarParamsIFloating bar layout configuration
launcher?ClLauncherParamsILauncher configuration
dialog?ClDialogParamsIDialog/modal configuration
closeIcon?ClCloseButtonParamsIClose button configuration
colorSchemaName?stringActive color schema name
cssVars?ClDocumentCssVarsICSS custom properties (variables)
actualSize?ClDocumentActualSizeI[]Actual rendered sizes per view
linkParams?ClDocumentLinkParamsILink styling parameters
mobileBreakpointWidth?numberBreakpoint width for mobile/desktop switch
zIndex?numberCSS z-index for the widget

ClDialogParamsI

Dialog/modal background configuration.

Properties

PropertyTypeDescription
backgroundstringBackground color or style

ClDocumentSharedTextClassI

Shared text style class definition.

Properties

PropertyTypeDescription
idstringUnique class identifier
namestringDisplay name of the class
isHeaderbooleanIf true, this is a header style
styleAttributesanyCSS style attributes
placeholderStyleAttributes?anyPlaceholder text styles

ClFloatingBoxParamsI

Floating box positioning parameters.

Properties

PropertyTypeDescription
verticalPositionClWidgetVerticalPositionVertical position on desktop
horizontalPositionClWidgetHorizontalPositionHorizontal position on desktop
verticalOffsetstringVertical offset from position
horizontalOffsetstringHorizontal offset from position
mobileClFloatingBoxEnvironmentParamsIMobile-specific positioning

ClFloatingBoxEnvironmentParamsI

Environment-specific floating box positioning.

Properties

PropertyTypeDescription
verticalPositionClWidgetVerticalPositionVertical position
horizontalPositionClWidgetHorizontalPositionHorizontal position
verticalOffsetstringVertical offset from position
horizontalOffsetstringHorizontal offset from position

ClFloatingBarParamsI

Floating bar positioning parameters.

Properties

PropertyTypeDescription
desktopClFloatingBarEnvironmentParamsIDesktop positioning
mobileClFloatingBarEnvironmentParamsIMobile positioning

ClFloatingBarEnvironmentParamsI

Environment-specific floating bar positioning.

Properties

PropertyTypeDescription
verticalPositionClWidgetVerticalPositionVertical position
horizontalPositionClWidgetHorizontalPositionHorizontal position
verticalOffsetstringVertical offset from position
horizontalOffsetstringHorizontal offset from position

ClLauncherParamsI

Launcher widget configuration.

Properties

PropertyTypeDescription
desktopClLauncherEnvironmentParamsIDesktop positioning
mobileClLauncherEnvironmentParamsIMobile positioning
entryAnimationClLauncherEntryAnimationIEntry animation configuration
loopAnimationClLoopAnimationILoop animation configuration

ClLauncherEnvironmentParamsI

Environment-specific launcher positioning.

Properties

PropertyTypeDescription
verticalPositionClWidgetVerticalPositionVertical position
horizontalPositionClWidgetHorizontalPositionHorizontal position
verticalOffsetstringVertical offset from position
horizontalOffsetstringHorizontal offset from position

ClLauncherEntryAnimationI

Launcher entry animation configuration.

Properties

PropertyTypeDescription
typeClLauncherEntryAnimationType | nullAnimation type or null for no animation

ClLoopAnimationI

Loop animation configuration.

Properties

PropertyTypeDescription
typeClLoopAnimationType | nullAnimation type or null for no animation
params?anyAnimation-specific parameters

ClCloseButtonParamsI

Close button configuration.

Properties

PropertyTypeDescription
desktop?ClCloseButtonEnvironmentParamsIDesktop close button settings
mobile?ClCloseButtonEnvironmentParamsIMobile close button settings
showOnViews?string[]View IDs where close button should be shown
enabled?booleanIf true, close button is enabled

ClCloseButtonEnvironmentParamsI

Environment-specific close button configuration.

Extends

Properties

PropertyTypeDescription
verticalOffsetstringVertical offset from position
horizontalOffsetstringHorizontal offset from position
widthstringButton width
heightstringButton height
horizontalPositionClCloseButtonHorizontalPositionHorizontal position
contentstringIcon content (index for default, URL for custom)
defaultIconbooleanIf true, uses a default icon
color?stringIcon color
size?numberIcon size

ClIconEnvironmentParamsI

Icon configuration for buttons.

Extended by

Properties

PropertyTypeDescription
contentstringIcon content (index for default, URL for custom)
defaultIconbooleanIf true, uses a default icon
color?stringIcon color
size?numberIcon size

ClDocumentCssVarsI

CSS custom properties (variables) map.

Indexable

[key: string]: string

ClDocumentActualSizeI

Actual rendered size of a view.

Properties

PropertyTypeDescription
viewIdstringView identifier
desktopClDocumentEnvironmentActualSizeDesktop dimensions
mobileClDocumentEnvironmentActualSizeMobile dimensions

ClDocumentEnvironmentActualSize

Environment-specific actual size dimensions.

Properties

PropertyTypeDescription
widthstringWidth value
heightstringHeight value

ClDocumentLinkParamsI

Link styling parameters.

Properties

PropertyTypeDescription
color?stringLink color
removeUnderline?booleanIf true, removes underline from links

ClDocumentActionParams

type ClDocumentActionParams = 
  | ClDocumentOpenLinkActionParamsI
  | ClDocumentGoToViewActionParamsI
  | ClDocumentGoToNextViewActionParamsI
  | ClDocumentGoToPreviousViewActionParamsI
  | ClDocumentCloseWidgetActionParamsI
  | ClDocumentSubscribeContactActionParamsI
  | ClDocumentShowWidgetActionParamsI
  | ClDocumentRequestActionParamsI;

Union type of all possible action parameter types.

@claspo/common


@claspo/common / dom/ViewportSize

dom/ViewportSize

default

Utility class for measuring viewport dimensions. Provides static methods to get viewport size, width, height, and scrollbar width.

Constructors

Constructor

new default(): default;
Returns

default

Methods

size()

static size(htmlDocumentObject?): ViewportSizeI;

Returns the current viewport size (width and height).

Parameters
ParameterTypeDescription
htmlDocumentObject?DocumentOptional document object (defaults to window.document)
Returns

ViewportSizeI

Object containing viewport width and height

width()

static width(htmlDocumentObject?): number;

Returns the viewport width in pixels. Uses the maximum of clientWidth and innerWidth for cross-browser compatibility.

Parameters
ParameterTypeDescription
htmlDocumentObject?DocumentOptional document object (defaults to window.document)
Returns

number

Viewport width in pixels

height()

static height(htmlDocumentObject?): number;

Returns the viewport height in pixels. Uses the maximum of clientHeight and innerHeight for cross-browser compatibility.

Parameters
ParameterTypeDescription
htmlDocumentObject?DocumentOptional document object (defaults to window.document)
Returns

number

Viewport height in pixels

scrollbarWidth()

static scrollbarWidth(htmlDocumentObject?): number;

Returns the scrollbar width in pixels. Calculated as the difference between innerWidth and clientWidth.

Parameters
ParameterTypeDescription
htmlDocumentObject?DocumentOptional document object (defaults to window.document)
Returns

number

Scrollbar width in pixels (0 if no scrollbar)


ViewportSizeI

Represents viewport dimensions.

Properties

PropertyTypeDescription
widthnumberViewport width in pixels
heightnumberViewport height in pixels

@claspo/common


@claspo/common / dom/copyToClipboard

dom/copyToClipboard

default()

function default(textToCopy): Promise<void>;

Copies text to the system clipboard using the Clipboard API. Trims whitespace and replaces <br> tags with spaces.

Parameters

ParameterTypeDescription
textToCopystringThe text to copy to the clipboard

Returns

Promise<void>

A promise that resolves when the text is copied, or rejects if clipboard is unavailable

Example

copyToClipboard('Hello World').then(() => console.log('Copied!'));

@claspo/common


@claspo/common / dom/insertHtmlIntoElement

dom/insertHtmlIntoElement

default()

function default(params): void;

Safely inserts HTML content into a DOM element after sanitizing it. Can either replace existing content or append to it.

Parameters

ParameterTypeDescription
paramsInsertHtmlIntoElementParamsIConfiguration object with element, html, and optional appendHtml flag

Returns

void

Example

insertHtmlIntoElement({
  element: document.getElementById('container'),
  html: '<p>Hello</p>',
  appendHtml: true
});

InsertHtmlIntoElementParamsI

Parameters for inserting HTML into an element.

Properties

PropertyTypeDescription
elementElementThe target DOM element to insert HTML into
htmlstringThe HTML string to insert
appendHtml?booleanIf true, appends HTML to existing content; otherwise replaces it

@claspo/common


@claspo/common / dom/sanitizeHTML

dom/sanitizeHTML

default()

function default(html): string;

Sanitizes HTML content by removing potentially dangerous elements and attributes. Removes script tags, style tags, event handlers, and javascript: URLs.

Parameters

ParameterTypeDescription
htmlstringThe HTML string to sanitize

Returns

string

The sanitized HTML string safe for insertion into the DOM

Example

const safe = sanitizeHTML('<div onclick="alert(1)">Hello</div>');
// Returns: '<div>Hello</div>'

@claspo/common


@claspo/common / flat

flat

flat()

function flat<T>(arr, depth): T[];

Flattens a nested array to a specified depth. Similar to Array.prototype.flat() but with broader browser support.

Type Parameters

Type ParameterDescription
TThe element type of the array

Parameters

ParameterTypeDescription
arr(T | T[])[]The array to flatten
depthnumberThe depth level to flatten (default: 1)

Returns

T[]

A new flattened array

Example

flat([[1, 2], [3, [4, 5]]], 1); // [1, 2, 3, [4, 5]]
flat([[1, 2], [3, [4, 5]]], 2); // [1, 2, 3, 4, 5]

@claspo/common


@claspo/common / object/isDictionary

object/isDictionary

default()

function default(object): boolean;

Checks if a value is a plain object (dictionary). Returns true for objects that are not null and not arrays.

Parameters

ParameterTypeDescription
objectunknownThe value to check

Returns

boolean

True if the value is a plain object, false otherwise

Example

isDictionary({a: 1});    // true
isDictionary([1, 2, 3]); // false
isDictionary(null);      // false

@claspo/common


@claspo/common / object/omitKeys

object/omitKeys

default()

function default<T, K>(kv, ignoreKeys): Omit<T, K>;

Creates a new object with specified keys omitted.

Type Parameters

Type ParameterDescription
T extends Record<string, unknown>The source object type
K extends string | number | symbolThe keys to omit

Parameters

ParameterTypeDescription
kvTThe source object
ignoreKeysK[]Array of keys to exclude from the result

Returns

Omit<T, K>

A new object without the specified keys

Example

const obj = { a: 1, b: 2, c: 3 };
omitKeys(obj, ['b']); // { a: 1, c: 3 }

@claspo/common


@claspo/common / utils/NumericDecline

utils/NumericDecline

default()

function default(
   itemsCount, 
   translateKeys, 
   language): string;

Returns the correct grammatical form based on a numeric value. Handles pluralization rules for different languages (English, Russian, etc.).

Parameters

ParameterTypeDescription
itemsCountnumberThe number to determine the form for
translateKeysstring[]Array of translation keys [singular, plural, genitive plural]
languagestringThe language code (e.g., 'en', 'ru')

Returns

string

The appropriate translation key for the given count

Example

getNumericDecline(1, ['item', 'items', 'items'], 'en');  // 'item'
getNumericDecline(5, ['item', 'items', 'items'], 'en');  // 'items'
getNumericDecline(21, ['товар', 'товара', 'товаров'], 'ru'); // 'товар'

@claspo/common


@claspo/common / utils/addEventListener

utils/addEventListener

default()

function default(
   element, 
   eventType, 
   callback, 
   options?): void;

Adds an event listener to an element, with fallback to base implementation. Handles cases where addEventListener may have been overridden.

Parameters

ParameterTypeDescription
elementEventTargetThe target element to attach the listener to
eventTypestringThe event type to listen for (e.g., 'click', 'load')
callbackEventListenerOrEventListenerObjectThe callback function or object to invoke
options?boolean | AddEventListenerOptionsOptional listener options (capture, passive, etc.)

Returns

void

Example

addEventListenerToElement(button, 'click', () => console.log('clicked'));